UNPKG

56.8 kBJavaScriptView Raw
1(function webpackUniversalModuleDefinition(root, factory) {
2 if(typeof exports === 'object' && typeof module === 'object')
3 module.exports = factory(require("react"));
4 else if(typeof define === 'function' && define.amd)
5 define(["react"], factory);
6 else if(typeof exports === 'object')
7 exports["react-highlight-words"] = factory(require("react"));
8 else
9 root["react-highlight-words"] = factory(root["react"]);
10})(this, function(__WEBPACK_EXTERNAL_MODULE_14__) {
11return /******/ (function(modules) { // webpackBootstrap
12/******/ // The module cache
13/******/ var installedModules = {};
14/******/
15/******/ // The require function
16/******/ function __webpack_require__(moduleId) {
17/******/
18/******/ // Check if module is in cache
19/******/ if(installedModules[moduleId])
20/******/ return installedModules[moduleId].exports;
21/******/
22/******/ // Create a new module (and put it into the cache)
23/******/ var module = installedModules[moduleId] = {
24/******/ exports: {},
25/******/ id: moduleId,
26/******/ loaded: false
27/******/ };
28/******/
29/******/ // Execute the module function
30/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31/******/
32/******/ // Flag the module as loaded
33/******/ module.loaded = true;
34/******/
35/******/ // Return the exports of the module
36/******/ return module.exports;
37/******/ }
38/******/
39/******/
40/******/ // expose the modules object (__webpack_modules__)
41/******/ __webpack_require__.m = modules;
42/******/
43/******/ // expose the module cache
44/******/ __webpack_require__.c = installedModules;
45/******/
46/******/ // __webpack_public_path__
47/******/ __webpack_require__.p = "";
48/******/
49/******/ // Load entry module and return exports
50/******/ return __webpack_require__(0);
51/******/ })
52/************************************************************************/
53/******/ ([
54/* 0 */
55/***/ (function(module, exports, __webpack_require__) {
56
57 module.exports = __webpack_require__(1);
58
59
60/***/ }),
61/* 1 */
62/***/ (function(module, exports, __webpack_require__) {
63
64 'use strict';
65
66 Object.defineProperty(exports, '__esModule', {
67 value: true
68 });
69
70 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
71
72 var _Highlighter = __webpack_require__(2);
73
74 var _Highlighter2 = _interopRequireDefault(_Highlighter);
75
76 exports['default'] = _Highlighter2['default'];
77 module.exports = exports['default'];
78
79/***/ }),
80/* 2 */
81/***/ (function(module, exports, __webpack_require__) {
82
83 'use strict';
84
85 Object.defineProperty(exports, '__esModule', {
86 value: true
87 });
88 exports['default'] = Highlighter;
89
90 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
91
92 var _highlightWordsCore = __webpack_require__(3);
93
94 var _propTypes = __webpack_require__(4);
95
96 var _propTypes2 = _interopRequireDefault(_propTypes);
97
98 var _react = __webpack_require__(14);
99
100 var _memoizeOne = __webpack_require__(15);
101
102 var _memoizeOne2 = _interopRequireDefault(_memoizeOne);
103
104 Highlighter.propTypes = {
105 activeClassName: _propTypes2['default'].string,
106 activeIndex: _propTypes2['default'].number,
107 activeStyle: _propTypes2['default'].object,
108 autoEscape: _propTypes2['default'].bool,
109 className: _propTypes2['default'].string,
110 findChunks: _propTypes2['default'].func,
111 highlightClassName: _propTypes2['default'].oneOfType([_propTypes2['default'].object, _propTypes2['default'].string]),
112 highlightStyle: _propTypes2['default'].object,
113 highlightTag: _propTypes2['default'].oneOfType([_propTypes2['default'].node, _propTypes2['default'].func, _propTypes2['default'].string]),
114 sanitize: _propTypes2['default'].func,
115 searchWords: _propTypes2['default'].arrayOf(_propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].instanceOf(RegExp)])).isRequired,
116 textToHighlight: _propTypes2['default'].string.isRequired,
117 unhighlightClassName: _propTypes2['default'].string,
118 unhighlightStyle: _propTypes2['default'].object
119 };
120
121 /**
122 * Highlights all occurrences of search terms (searchText) within a string (textToHighlight).
123 * This function returns an array of strings and <span>s (wrapping highlighted words).
124 */
125
126 function Highlighter(_ref) {
127 var _ref$activeClassName = _ref.activeClassName;
128 var activeClassName = _ref$activeClassName === undefined ? '' : _ref$activeClassName;
129 var _ref$activeIndex = _ref.activeIndex;
130 var activeIndex = _ref$activeIndex === undefined ? -1 : _ref$activeIndex;
131 var activeStyle = _ref.activeStyle;
132 var autoEscape = _ref.autoEscape;
133 var _ref$caseSensitive = _ref.caseSensitive;
134 var caseSensitive = _ref$caseSensitive === undefined ? false : _ref$caseSensitive;
135 var className = _ref.className;
136 var findChunks = _ref.findChunks;
137 var _ref$highlightClassName = _ref.highlightClassName;
138 var highlightClassName = _ref$highlightClassName === undefined ? '' : _ref$highlightClassName;
139 var _ref$highlightStyle = _ref.highlightStyle;
140 var highlightStyle = _ref$highlightStyle === undefined ? {} : _ref$highlightStyle;
141 var _ref$highlightTag = _ref.highlightTag;
142 var highlightTag = _ref$highlightTag === undefined ? 'mark' : _ref$highlightTag;
143 var sanitize = _ref.sanitize;
144 var searchWords = _ref.searchWords;
145 var textToHighlight = _ref.textToHighlight;
146 var _ref$unhighlightClassName = _ref.unhighlightClassName;
147 var unhighlightClassName = _ref$unhighlightClassName === undefined ? '' : _ref$unhighlightClassName;
148 var unhighlightStyle = _ref.unhighlightStyle;
149
150 var chunks = (0, _highlightWordsCore.findAll)({
151 autoEscape: autoEscape,
152 caseSensitive: caseSensitive,
153 findChunks: findChunks,
154 sanitize: sanitize,
155 searchWords: searchWords,
156 textToHighlight: textToHighlight
157 });
158 var HighlightTag = highlightTag;
159 var highlightIndex = -1;
160 var highlightClassNames = '';
161 var highlightStyles = undefined;
162
163 var lowercaseProps = function lowercaseProps(object) {
164 var mapped = {};
165 for (var key in object) {
166 mapped[key.toLowerCase()] = object[key];
167 }
168 return mapped;
169 };
170 var memoizedLowercaseProps = (0, _memoizeOne2['default'])(lowercaseProps);
171
172 return (0, _react.createElement)('span', {
173 className: className,
174 children: chunks.map(function (chunk, index) {
175 var text = textToHighlight.substr(chunk.start, chunk.end - chunk.start);
176
177 if (chunk.highlight) {
178 highlightIndex++;
179
180 var highlightClass = undefined;
181 if (typeof highlightClassName === 'object') {
182 if (!caseSensitive) {
183 highlightClassName = memoizedLowercaseProps(highlightClassName);
184 highlightClass = highlightClassName[text.toLowerCase()];
185 } else {
186 highlightClass = highlightClassName[text];
187 }
188 } else {
189 highlightClass = highlightClassName;
190 }
191
192 var isActive = highlightIndex === +activeIndex;
193
194 highlightClassNames = highlightClass + ' ' + (isActive ? activeClassName : '');
195 highlightStyles = isActive === true && activeStyle != null ? Object.assign({}, highlightStyle, activeStyle) : highlightStyle;
196
197 var props = {
198 children: text,
199 className: highlightClassNames,
200 key: index,
201 style: highlightStyles
202 };
203
204 // Don't attach arbitrary props to DOM elements; this triggers React DEV warnings (https://fb.me/react-unknown-prop)
205 // Only pass through the highlightIndex attribute for custom components.
206 if (typeof HighlightTag !== 'string') {
207 props.highlightIndex = highlightIndex;
208 }
209
210 return (0, _react.createElement)(HighlightTag, props);
211 } else {
212 return (0, _react.createElement)('span', {
213 children: text,
214 className: unhighlightClassName,
215 key: index,
216 style: unhighlightStyle
217 });
218 }
219 })
220 });
221 }
222
223 module.exports = exports['default'];
224
225/***/ }),
226/* 3 */
227/***/ (function(module, exports) {
228
229 module.exports =
230 /******/ (function(modules) { // webpackBootstrap
231 /******/ // The module cache
232 /******/ var installedModules = {};
233 /******/
234 /******/ // The require function
235 /******/ function __webpack_require__(moduleId) {
236 /******/
237 /******/ // Check if module is in cache
238 /******/ if(installedModules[moduleId])
239 /******/ return installedModules[moduleId].exports;
240 /******/
241 /******/ // Create a new module (and put it into the cache)
242 /******/ var module = installedModules[moduleId] = {
243 /******/ exports: {},
244 /******/ id: moduleId,
245 /******/ loaded: false
246 /******/ };
247 /******/
248 /******/ // Execute the module function
249 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
250 /******/
251 /******/ // Flag the module as loaded
252 /******/ module.loaded = true;
253 /******/
254 /******/ // Return the exports of the module
255 /******/ return module.exports;
256 /******/ }
257 /******/
258 /******/
259 /******/ // expose the modules object (__webpack_modules__)
260 /******/ __webpack_require__.m = modules;
261 /******/
262 /******/ // expose the module cache
263 /******/ __webpack_require__.c = installedModules;
264 /******/
265 /******/ // __webpack_public_path__
266 /******/ __webpack_require__.p = "";
267 /******/
268 /******/ // Load entry module and return exports
269 /******/ return __webpack_require__(0);
270 /******/ })
271 /************************************************************************/
272 /******/ ([
273 /* 0 */
274 /***/ (function(module, exports, __webpack_require__) {
275
276 module.exports = __webpack_require__(1);
277
278
279 /***/ }),
280 /* 1 */
281 /***/ (function(module, exports, __webpack_require__) {
282
283 'use strict';
284
285 Object.defineProperty(exports, "__esModule", {
286 value: true
287 });
288
289 var _utils = __webpack_require__(2);
290
291 Object.defineProperty(exports, 'combineChunks', {
292 enumerable: true,
293 get: function get() {
294 return _utils.combineChunks;
295 }
296 });
297 Object.defineProperty(exports, 'fillInChunks', {
298 enumerable: true,
299 get: function get() {
300 return _utils.fillInChunks;
301 }
302 });
303 Object.defineProperty(exports, 'findAll', {
304 enumerable: true,
305 get: function get() {
306 return _utils.findAll;
307 }
308 });
309 Object.defineProperty(exports, 'findChunks', {
310 enumerable: true,
311 get: function get() {
312 return _utils.findChunks;
313 }
314 });
315
316 /***/ }),
317 /* 2 */
318 /***/ (function(module, exports) {
319
320 'use strict';
321
322 Object.defineProperty(exports, "__esModule", {
323 value: true
324 });
325 /**
326 * Creates an array of chunk objects representing both higlightable and non highlightable pieces of text that match each search word.
327 * @return Array of "chunks" (where a Chunk is { start:number, end:number, highlight:boolean })
328 */
329 var findAll = exports.findAll = function findAll(_ref) {
330 var autoEscape = _ref.autoEscape,
331 _ref$caseSensitive = _ref.caseSensitive,
332 caseSensitive = _ref$caseSensitive === undefined ? false : _ref$caseSensitive,
333 _ref$findChunks = _ref.findChunks,
334 findChunks = _ref$findChunks === undefined ? defaultFindChunks : _ref$findChunks,
335 sanitize = _ref.sanitize,
336 searchWords = _ref.searchWords,
337 textToHighlight = _ref.textToHighlight;
338 return fillInChunks({
339 chunksToHighlight: combineChunks({
340 chunks: findChunks({
341 autoEscape: autoEscape,
342 caseSensitive: caseSensitive,
343 sanitize: sanitize,
344 searchWords: searchWords,
345 textToHighlight: textToHighlight
346 })
347 }),
348 totalLength: textToHighlight ? textToHighlight.length : 0
349 });
350 };
351
352 /**
353 * Takes an array of {start:number, end:number} objects and combines chunks that overlap into single chunks.
354 * @return {start:number, end:number}[]
355 */
356 var combineChunks = exports.combineChunks = function combineChunks(_ref2) {
357 var chunks = _ref2.chunks;
358
359 chunks = chunks.sort(function (first, second) {
360 return first.start - second.start;
361 }).reduce(function (processedChunks, nextChunk) {
362 // First chunk just goes straight in the array...
363 if (processedChunks.length === 0) {
364 return [nextChunk];
365 } else {
366 // ... subsequent chunks get checked to see if they overlap...
367 var prevChunk = processedChunks.pop();
368 if (nextChunk.start <= prevChunk.end) {
369 // It may be the case that prevChunk completely surrounds nextChunk, so take the
370 // largest of the end indeces.
371 var endIndex = Math.max(prevChunk.end, nextChunk.end);
372 processedChunks.push({ start: prevChunk.start, end: endIndex });
373 } else {
374 processedChunks.push(prevChunk, nextChunk);
375 }
376 return processedChunks;
377 }
378 }, []);
379
380 return chunks;
381 };
382
383 /**
384 * Examine text for any matches.
385 * If we find matches, add them to the returned array as a "chunk" object ({start:number, end:number}).
386 * @return {start:number, end:number}[]
387 */
388 var defaultFindChunks = function defaultFindChunks(_ref3) {
389 var autoEscape = _ref3.autoEscape,
390 caseSensitive = _ref3.caseSensitive,
391 _ref3$sanitize = _ref3.sanitize,
392 sanitize = _ref3$sanitize === undefined ? identity : _ref3$sanitize,
393 searchWords = _ref3.searchWords,
394 textToHighlight = _ref3.textToHighlight;
395
396 textToHighlight = sanitize(textToHighlight);
397
398 return searchWords.filter(function (searchWord) {
399 return searchWord;
400 }) // Remove empty words
401 .reduce(function (chunks, searchWord) {
402 searchWord = sanitize(searchWord);
403
404 if (autoEscape) {
405 searchWord = escapeRegExpFn(searchWord);
406 }
407
408 var regex = new RegExp(searchWord, caseSensitive ? 'g' : 'gi');
409
410 var match = void 0;
411 while (match = regex.exec(textToHighlight)) {
412 var start = match.index;
413 var end = regex.lastIndex;
414 // We do not return zero-length matches
415 if (end > start) {
416 chunks.push({ start: start, end: end });
417 }
418
419 // Prevent browsers like Firefox from getting stuck in an infinite loop
420 // See http://www.regexguru.com/2008/04/watch-out-for-zero-length-matches/
421 if (match.index == regex.lastIndex) {
422 regex.lastIndex++;
423 }
424 }
425
426 return chunks;
427 }, []);
428 };
429 // Allow the findChunks to be overridden in findAll,
430 // but for backwards compatibility we export as the old name
431 exports.findChunks = defaultFindChunks;
432
433 /**
434 * Given a set of chunks to highlight, create an additional set of chunks
435 * to represent the bits of text between the highlighted text.
436 * @param chunksToHighlight {start:number, end:number}[]
437 * @param totalLength number
438 * @return {start:number, end:number, highlight:boolean}[]
439 */
440
441 var fillInChunks = exports.fillInChunks = function fillInChunks(_ref4) {
442 var chunksToHighlight = _ref4.chunksToHighlight,
443 totalLength = _ref4.totalLength;
444
445 var allChunks = [];
446 var append = function append(start, end, highlight) {
447 if (end - start > 0) {
448 allChunks.push({
449 start: start,
450 end: end,
451 highlight: highlight
452 });
453 }
454 };
455
456 if (chunksToHighlight.length === 0) {
457 append(0, totalLength, false);
458 } else {
459 var lastIndex = 0;
460 chunksToHighlight.forEach(function (chunk) {
461 append(lastIndex, chunk.start, false);
462 append(chunk.start, chunk.end, true);
463 lastIndex = chunk.end;
464 });
465 append(lastIndex, totalLength, false);
466 }
467 return allChunks;
468 };
469
470 function identity(value) {
471 return value;
472 }
473
474 function escapeRegExpFn(str) {
475 return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
476 }
477
478 /***/ })
479 /******/ ]);
480 //# sourceMappingURL=index.js.map
481
482/***/ }),
483/* 4 */
484/***/ (function(module, exports, __webpack_require__) {
485
486 /* WEBPACK VAR INJECTION */(function(process) {/**
487 * Copyright (c) 2013-present, Facebook, Inc.
488 *
489 * This source code is licensed under the MIT license found in the
490 * LICENSE file in the root directory of this source tree.
491 */
492
493 if (process.env.NODE_ENV !== 'production') {
494 var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
495 Symbol.for &&
496 Symbol.for('react.element')) ||
497 0xeac7;
498
499 var isValidElement = function(object) {
500 return typeof object === 'object' &&
501 object !== null &&
502 object.$$typeof === REACT_ELEMENT_TYPE;
503 };
504
505 // By explicitly using `prop-types` you are opting into new development behavior.
506 // http://fb.me/prop-types-in-prod
507 var throwOnDirectAccess = true;
508 module.exports = __webpack_require__(6)(isValidElement, throwOnDirectAccess);
509 } else {
510 // By explicitly using `prop-types` you are opting into new production behavior.
511 // http://fb.me/prop-types-in-prod
512 module.exports = __webpack_require__(13)();
513 }
514
515 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
516
517/***/ }),
518/* 5 */
519/***/ (function(module, exports) {
520
521 // shim for using process in browser
522 var process = module.exports = {};
523
524 // cached from whatever global is present so that test runners that stub it
525 // don't break things. But we need to wrap it in a try catch in case it is
526 // wrapped in strict mode code which doesn't define any globals. It's inside a
527 // function because try/catches deoptimize in certain engines.
528
529 var cachedSetTimeout;
530 var cachedClearTimeout;
531
532 function defaultSetTimout() {
533 throw new Error('setTimeout has not been defined');
534 }
535 function defaultClearTimeout () {
536 throw new Error('clearTimeout has not been defined');
537 }
538 (function () {
539 try {
540 if (typeof setTimeout === 'function') {
541 cachedSetTimeout = setTimeout;
542 } else {
543 cachedSetTimeout = defaultSetTimout;
544 }
545 } catch (e) {
546 cachedSetTimeout = defaultSetTimout;
547 }
548 try {
549 if (typeof clearTimeout === 'function') {
550 cachedClearTimeout = clearTimeout;
551 } else {
552 cachedClearTimeout = defaultClearTimeout;
553 }
554 } catch (e) {
555 cachedClearTimeout = defaultClearTimeout;
556 }
557 } ())
558 function runTimeout(fun) {
559 if (cachedSetTimeout === setTimeout) {
560 //normal enviroments in sane situations
561 return setTimeout(fun, 0);
562 }
563 // if setTimeout wasn't available but was latter defined
564 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
565 cachedSetTimeout = setTimeout;
566 return setTimeout(fun, 0);
567 }
568 try {
569 // when when somebody has screwed with setTimeout but no I.E. maddness
570 return cachedSetTimeout(fun, 0);
571 } catch(e){
572 try {
573 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
574 return cachedSetTimeout.call(null, fun, 0);
575 } catch(e){
576 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
577 return cachedSetTimeout.call(this, fun, 0);
578 }
579 }
580
581
582 }
583 function runClearTimeout(marker) {
584 if (cachedClearTimeout === clearTimeout) {
585 //normal enviroments in sane situations
586 return clearTimeout(marker);
587 }
588 // if clearTimeout wasn't available but was latter defined
589 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
590 cachedClearTimeout = clearTimeout;
591 return clearTimeout(marker);
592 }
593 try {
594 // when when somebody has screwed with setTimeout but no I.E. maddness
595 return cachedClearTimeout(marker);
596 } catch (e){
597 try {
598 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
599 return cachedClearTimeout.call(null, marker);
600 } catch (e){
601 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
602 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
603 return cachedClearTimeout.call(this, marker);
604 }
605 }
606
607
608
609 }
610 var queue = [];
611 var draining = false;
612 var currentQueue;
613 var queueIndex = -1;
614
615 function cleanUpNextTick() {
616 if (!draining || !currentQueue) {
617 return;
618 }
619 draining = false;
620 if (currentQueue.length) {
621 queue = currentQueue.concat(queue);
622 } else {
623 queueIndex = -1;
624 }
625 if (queue.length) {
626 drainQueue();
627 }
628 }
629
630 function drainQueue() {
631 if (draining) {
632 return;
633 }
634 var timeout = runTimeout(cleanUpNextTick);
635 draining = true;
636
637 var len = queue.length;
638 while(len) {
639 currentQueue = queue;
640 queue = [];
641 while (++queueIndex < len) {
642 if (currentQueue) {
643 currentQueue[queueIndex].run();
644 }
645 }
646 queueIndex = -1;
647 len = queue.length;
648 }
649 currentQueue = null;
650 draining = false;
651 runClearTimeout(timeout);
652 }
653
654 process.nextTick = function (fun) {
655 var args = new Array(arguments.length - 1);
656 if (arguments.length > 1) {
657 for (var i = 1; i < arguments.length; i++) {
658 args[i - 1] = arguments[i];
659 }
660 }
661 queue.push(new Item(fun, args));
662 if (queue.length === 1 && !draining) {
663 runTimeout(drainQueue);
664 }
665 };
666
667 // v8 likes predictible objects
668 function Item(fun, array) {
669 this.fun = fun;
670 this.array = array;
671 }
672 Item.prototype.run = function () {
673 this.fun.apply(null, this.array);
674 };
675 process.title = 'browser';
676 process.browser = true;
677 process.env = {};
678 process.argv = [];
679 process.version = ''; // empty string to avoid regexp issues
680 process.versions = {};
681
682 function noop() {}
683
684 process.on = noop;
685 process.addListener = noop;
686 process.once = noop;
687 process.off = noop;
688 process.removeListener = noop;
689 process.removeAllListeners = noop;
690 process.emit = noop;
691 process.prependListener = noop;
692 process.prependOnceListener = noop;
693
694 process.listeners = function (name) { return [] }
695
696 process.binding = function (name) {
697 throw new Error('process.binding is not supported');
698 };
699
700 process.cwd = function () { return '/' };
701 process.chdir = function (dir) {
702 throw new Error('process.chdir is not supported');
703 };
704 process.umask = function() { return 0; };
705
706
707/***/ }),
708/* 6 */
709/***/ (function(module, exports, __webpack_require__) {
710
711 /* WEBPACK VAR INJECTION */(function(process) {/**
712 * Copyright (c) 2013-present, Facebook, Inc.
713 *
714 * This source code is licensed under the MIT license found in the
715 * LICENSE file in the root directory of this source tree.
716 */
717
718 'use strict';
719
720 var emptyFunction = __webpack_require__(7);
721 var invariant = __webpack_require__(8);
722 var warning = __webpack_require__(9);
723 var assign = __webpack_require__(10);
724
725 var ReactPropTypesSecret = __webpack_require__(11);
726 var checkPropTypes = __webpack_require__(12);
727
728 module.exports = function(isValidElement, throwOnDirectAccess) {
729 /* global Symbol */
730 var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
731 var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
732
733 /**
734 * Returns the iterator method function contained on the iterable object.
735 *
736 * Be sure to invoke the function with the iterable as context:
737 *
738 * var iteratorFn = getIteratorFn(myIterable);
739 * if (iteratorFn) {
740 * var iterator = iteratorFn.call(myIterable);
741 * ...
742 * }
743 *
744 * @param {?object} maybeIterable
745 * @return {?function}
746 */
747 function getIteratorFn(maybeIterable) {
748 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
749 if (typeof iteratorFn === 'function') {
750 return iteratorFn;
751 }
752 }
753
754 /**
755 * Collection of methods that allow declaration and validation of props that are
756 * supplied to React components. Example usage:
757 *
758 * var Props = require('ReactPropTypes');
759 * var MyArticle = React.createClass({
760 * propTypes: {
761 * // An optional string prop named "description".
762 * description: Props.string,
763 *
764 * // A required enum prop named "category".
765 * category: Props.oneOf(['News','Photos']).isRequired,
766 *
767 * // A prop named "dialog" that requires an instance of Dialog.
768 * dialog: Props.instanceOf(Dialog).isRequired
769 * },
770 * render: function() { ... }
771 * });
772 *
773 * A more formal specification of how these methods are used:
774 *
775 * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
776 * decl := ReactPropTypes.{type}(.isRequired)?
777 *
778 * Each and every declaration produces a function with the same signature. This
779 * allows the creation of custom validation functions. For example:
780 *
781 * var MyLink = React.createClass({
782 * propTypes: {
783 * // An optional string or URI prop named "href".
784 * href: function(props, propName, componentName) {
785 * var propValue = props[propName];
786 * if (propValue != null && typeof propValue !== 'string' &&
787 * !(propValue instanceof URI)) {
788 * return new Error(
789 * 'Expected a string or an URI for ' + propName + ' in ' +
790 * componentName
791 * );
792 * }
793 * }
794 * },
795 * render: function() {...}
796 * });
797 *
798 * @internal
799 */
800
801 var ANONYMOUS = '<<anonymous>>';
802
803 // Important!
804 // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
805 var ReactPropTypes = {
806 array: createPrimitiveTypeChecker('array'),
807 bool: createPrimitiveTypeChecker('boolean'),
808 func: createPrimitiveTypeChecker('function'),
809 number: createPrimitiveTypeChecker('number'),
810 object: createPrimitiveTypeChecker('object'),
811 string: createPrimitiveTypeChecker('string'),
812 symbol: createPrimitiveTypeChecker('symbol'),
813
814 any: createAnyTypeChecker(),
815 arrayOf: createArrayOfTypeChecker,
816 element: createElementTypeChecker(),
817 instanceOf: createInstanceTypeChecker,
818 node: createNodeChecker(),
819 objectOf: createObjectOfTypeChecker,
820 oneOf: createEnumTypeChecker,
821 oneOfType: createUnionTypeChecker,
822 shape: createShapeTypeChecker,
823 exact: createStrictShapeTypeChecker,
824 };
825
826 /**
827 * inlined Object.is polyfill to avoid requiring consumers ship their own
828 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
829 */
830 /*eslint-disable no-self-compare*/
831 function is(x, y) {
832 // SameValue algorithm
833 if (x === y) {
834 // Steps 1-5, 7-10
835 // Steps 6.b-6.e: +0 != -0
836 return x !== 0 || 1 / x === 1 / y;
837 } else {
838 // Step 6.a: NaN == NaN
839 return x !== x && y !== y;
840 }
841 }
842 /*eslint-enable no-self-compare*/
843
844 /**
845 * We use an Error-like object for backward compatibility as people may call
846 * PropTypes directly and inspect their output. However, we don't use real
847 * Errors anymore. We don't inspect their stack anyway, and creating them
848 * is prohibitively expensive if they are created too often, such as what
849 * happens in oneOfType() for any type before the one that matched.
850 */
851 function PropTypeError(message) {
852 this.message = message;
853 this.stack = '';
854 }
855 // Make `instanceof Error` still work for returned errors.
856 PropTypeError.prototype = Error.prototype;
857
858 function createChainableTypeChecker(validate) {
859 if (process.env.NODE_ENV !== 'production') {
860 var manualPropTypeCallCache = {};
861 var manualPropTypeWarningCount = 0;
862 }
863 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
864 componentName = componentName || ANONYMOUS;
865 propFullName = propFullName || propName;
866
867 if (secret !== ReactPropTypesSecret) {
868 if (throwOnDirectAccess) {
869 // New behavior only for users of `prop-types` package
870 invariant(
871 false,
872 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
873 'Use `PropTypes.checkPropTypes()` to call them. ' +
874 'Read more at http://fb.me/use-check-prop-types'
875 );
876 } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
877 // Old behavior for people using React.PropTypes
878 var cacheKey = componentName + ':' + propName;
879 if (
880 !manualPropTypeCallCache[cacheKey] &&
881 // Avoid spamming the console because they are often not actionable except for lib authors
882 manualPropTypeWarningCount < 3
883 ) {
884 warning(
885 false,
886 'You are manually calling a React.PropTypes validation ' +
887 'function for the `%s` prop on `%s`. This is deprecated ' +
888 'and will throw in the standalone `prop-types` package. ' +
889 'You may be seeing this warning due to a third-party PropTypes ' +
890 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
891 propFullName,
892 componentName
893 );
894 manualPropTypeCallCache[cacheKey] = true;
895 manualPropTypeWarningCount++;
896 }
897 }
898 }
899 if (props[propName] == null) {
900 if (isRequired) {
901 if (props[propName] === null) {
902 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
903 }
904 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
905 }
906 return null;
907 } else {
908 return validate(props, propName, componentName, location, propFullName);
909 }
910 }
911
912 var chainedCheckType = checkType.bind(null, false);
913 chainedCheckType.isRequired = checkType.bind(null, true);
914
915 return chainedCheckType;
916 }
917
918 function createPrimitiveTypeChecker(expectedType) {
919 function validate(props, propName, componentName, location, propFullName, secret) {
920 var propValue = props[propName];
921 var propType = getPropType(propValue);
922 if (propType !== expectedType) {
923 // `propValue` being instance of, say, date/regexp, pass the 'object'
924 // check, but we can offer a more precise error message here rather than
925 // 'of type `object`'.
926 var preciseType = getPreciseType(propValue);
927
928 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
929 }
930 return null;
931 }
932 return createChainableTypeChecker(validate);
933 }
934
935 function createAnyTypeChecker() {
936 return createChainableTypeChecker(emptyFunction.thatReturnsNull);
937 }
938
939 function createArrayOfTypeChecker(typeChecker) {
940 function validate(props, propName, componentName, location, propFullName) {
941 if (typeof typeChecker !== 'function') {
942 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
943 }
944 var propValue = props[propName];
945 if (!Array.isArray(propValue)) {
946 var propType = getPropType(propValue);
947 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
948 }
949 for (var i = 0; i < propValue.length; i++) {
950 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
951 if (error instanceof Error) {
952 return error;
953 }
954 }
955 return null;
956 }
957 return createChainableTypeChecker(validate);
958 }
959
960 function createElementTypeChecker() {
961 function validate(props, propName, componentName, location, propFullName) {
962 var propValue = props[propName];
963 if (!isValidElement(propValue)) {
964 var propType = getPropType(propValue);
965 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
966 }
967 return null;
968 }
969 return createChainableTypeChecker(validate);
970 }
971
972 function createInstanceTypeChecker(expectedClass) {
973 function validate(props, propName, componentName, location, propFullName) {
974 if (!(props[propName] instanceof expectedClass)) {
975 var expectedClassName = expectedClass.name || ANONYMOUS;
976 var actualClassName = getClassName(props[propName]);
977 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
978 }
979 return null;
980 }
981 return createChainableTypeChecker(validate);
982 }
983
984 function createEnumTypeChecker(expectedValues) {
985 if (!Array.isArray(expectedValues)) {
986 process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
987 return emptyFunction.thatReturnsNull;
988 }
989
990 function validate(props, propName, componentName, location, propFullName) {
991 var propValue = props[propName];
992 for (var i = 0; i < expectedValues.length; i++) {
993 if (is(propValue, expectedValues[i])) {
994 return null;
995 }
996 }
997
998 var valuesString = JSON.stringify(expectedValues);
999 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
1000 }
1001 return createChainableTypeChecker(validate);
1002 }
1003
1004 function createObjectOfTypeChecker(typeChecker) {
1005 function validate(props, propName, componentName, location, propFullName) {
1006 if (typeof typeChecker !== 'function') {
1007 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
1008 }
1009 var propValue = props[propName];
1010 var propType = getPropType(propValue);
1011 if (propType !== 'object') {
1012 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
1013 }
1014 for (var key in propValue) {
1015 if (propValue.hasOwnProperty(key)) {
1016 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1017 if (error instanceof Error) {
1018 return error;
1019 }
1020 }
1021 }
1022 return null;
1023 }
1024 return createChainableTypeChecker(validate);
1025 }
1026
1027 function createUnionTypeChecker(arrayOfTypeCheckers) {
1028 if (!Array.isArray(arrayOfTypeCheckers)) {
1029 process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
1030 return emptyFunction.thatReturnsNull;
1031 }
1032
1033 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1034 var checker = arrayOfTypeCheckers[i];
1035 if (typeof checker !== 'function') {
1036 warning(
1037 false,
1038 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
1039 'received %s at index %s.',
1040 getPostfixForTypeWarning(checker),
1041 i
1042 );
1043 return emptyFunction.thatReturnsNull;
1044 }
1045 }
1046
1047 function validate(props, propName, componentName, location, propFullName) {
1048 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1049 var checker = arrayOfTypeCheckers[i];
1050 if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
1051 return null;
1052 }
1053 }
1054
1055 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
1056 }
1057 return createChainableTypeChecker(validate);
1058 }
1059
1060 function createNodeChecker() {
1061 function validate(props, propName, componentName, location, propFullName) {
1062 if (!isNode(props[propName])) {
1063 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
1064 }
1065 return null;
1066 }
1067 return createChainableTypeChecker(validate);
1068 }
1069
1070 function createShapeTypeChecker(shapeTypes) {
1071 function validate(props, propName, componentName, location, propFullName) {
1072 var propValue = props[propName];
1073 var propType = getPropType(propValue);
1074 if (propType !== 'object') {
1075 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1076 }
1077 for (var key in shapeTypes) {
1078 var checker = shapeTypes[key];
1079 if (!checker) {
1080 continue;
1081 }
1082 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1083 if (error) {
1084 return error;
1085 }
1086 }
1087 return null;
1088 }
1089 return createChainableTypeChecker(validate);
1090 }
1091
1092 function createStrictShapeTypeChecker(shapeTypes) {
1093 function validate(props, propName, componentName, location, propFullName) {
1094 var propValue = props[propName];
1095 var propType = getPropType(propValue);
1096 if (propType !== 'object') {
1097 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1098 }
1099 // We need to check all keys in case some are required but missing from
1100 // props.
1101 var allKeys = assign({}, props[propName], shapeTypes);
1102 for (var key in allKeys) {
1103 var checker = shapeTypes[key];
1104 if (!checker) {
1105 return new PropTypeError(
1106 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
1107 '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
1108 '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
1109 );
1110 }
1111 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
1112 if (error) {
1113 return error;
1114 }
1115 }
1116 return null;
1117 }
1118
1119 return createChainableTypeChecker(validate);
1120 }
1121
1122 function isNode(propValue) {
1123 switch (typeof propValue) {
1124 case 'number':
1125 case 'string':
1126 case 'undefined':
1127 return true;
1128 case 'boolean':
1129 return !propValue;
1130 case 'object':
1131 if (Array.isArray(propValue)) {
1132 return propValue.every(isNode);
1133 }
1134 if (propValue === null || isValidElement(propValue)) {
1135 return true;
1136 }
1137
1138 var iteratorFn = getIteratorFn(propValue);
1139 if (iteratorFn) {
1140 var iterator = iteratorFn.call(propValue);
1141 var step;
1142 if (iteratorFn !== propValue.entries) {
1143 while (!(step = iterator.next()).done) {
1144 if (!isNode(step.value)) {
1145 return false;
1146 }
1147 }
1148 } else {
1149 // Iterator will provide entry [k,v] tuples rather than values.
1150 while (!(step = iterator.next()).done) {
1151 var entry = step.value;
1152 if (entry) {
1153 if (!isNode(entry[1])) {
1154 return false;
1155 }
1156 }
1157 }
1158 }
1159 } else {
1160 return false;
1161 }
1162
1163 return true;
1164 default:
1165 return false;
1166 }
1167 }
1168
1169 function isSymbol(propType, propValue) {
1170 // Native Symbol.
1171 if (propType === 'symbol') {
1172 return true;
1173 }
1174
1175 // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
1176 if (propValue['@@toStringTag'] === 'Symbol') {
1177 return true;
1178 }
1179
1180 // Fallback for non-spec compliant Symbols which are polyfilled.
1181 if (typeof Symbol === 'function' && propValue instanceof Symbol) {
1182 return true;
1183 }
1184
1185 return false;
1186 }
1187
1188 // Equivalent of `typeof` but with special handling for array and regexp.
1189 function getPropType(propValue) {
1190 var propType = typeof propValue;
1191 if (Array.isArray(propValue)) {
1192 return 'array';
1193 }
1194 if (propValue instanceof RegExp) {
1195 // Old webkits (at least until Android 4.0) return 'function' rather than
1196 // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
1197 // passes PropTypes.object.
1198 return 'object';
1199 }
1200 if (isSymbol(propType, propValue)) {
1201 return 'symbol';
1202 }
1203 return propType;
1204 }
1205
1206 // This handles more types than `getPropType`. Only used for error messages.
1207 // See `createPrimitiveTypeChecker`.
1208 function getPreciseType(propValue) {
1209 if (typeof propValue === 'undefined' || propValue === null) {
1210 return '' + propValue;
1211 }
1212 var propType = getPropType(propValue);
1213 if (propType === 'object') {
1214 if (propValue instanceof Date) {
1215 return 'date';
1216 } else if (propValue instanceof RegExp) {
1217 return 'regexp';
1218 }
1219 }
1220 return propType;
1221 }
1222
1223 // Returns a string that is postfixed to a warning about an invalid type.
1224 // For example, "undefined" or "of type array"
1225 function getPostfixForTypeWarning(value) {
1226 var type = getPreciseType(value);
1227 switch (type) {
1228 case 'array':
1229 case 'object':
1230 return 'an ' + type;
1231 case 'boolean':
1232 case 'date':
1233 case 'regexp':
1234 return 'a ' + type;
1235 default:
1236 return type;
1237 }
1238 }
1239
1240 // Returns class name of the object, if any.
1241 function getClassName(propValue) {
1242 if (!propValue.constructor || !propValue.constructor.name) {
1243 return ANONYMOUS;
1244 }
1245 return propValue.constructor.name;
1246 }
1247
1248 ReactPropTypes.checkPropTypes = checkPropTypes;
1249 ReactPropTypes.PropTypes = ReactPropTypes;
1250
1251 return ReactPropTypes;
1252 };
1253
1254 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
1255
1256/***/ }),
1257/* 7 */
1258/***/ (function(module, exports) {
1259
1260 "use strict";
1261
1262 /**
1263 * Copyright (c) 2013-present, Facebook, Inc.
1264 *
1265 * This source code is licensed under the MIT license found in the
1266 * LICENSE file in the root directory of this source tree.
1267 *
1268 *
1269 */
1270
1271 function makeEmptyFunction(arg) {
1272 return function () {
1273 return arg;
1274 };
1275 }
1276
1277 /**
1278 * This function accepts and discards inputs; it has no side effects. This is
1279 * primarily useful idiomatically for overridable function endpoints which
1280 * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
1281 */
1282 var emptyFunction = function emptyFunction() {};
1283
1284 emptyFunction.thatReturns = makeEmptyFunction;
1285 emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
1286 emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
1287 emptyFunction.thatReturnsNull = makeEmptyFunction(null);
1288 emptyFunction.thatReturnsThis = function () {
1289 return this;
1290 };
1291 emptyFunction.thatReturnsArgument = function (arg) {
1292 return arg;
1293 };
1294
1295 module.exports = emptyFunction;
1296
1297/***/ }),
1298/* 8 */
1299/***/ (function(module, exports, __webpack_require__) {
1300
1301 /* WEBPACK VAR INJECTION */(function(process) {/**
1302 * Copyright (c) 2013-present, Facebook, Inc.
1303 *
1304 * This source code is licensed under the MIT license found in the
1305 * LICENSE file in the root directory of this source tree.
1306 *
1307 */
1308
1309 'use strict';
1310
1311 /**
1312 * Use invariant() to assert state which your program assumes to be true.
1313 *
1314 * Provide sprintf-style format (only %s is supported) and arguments
1315 * to provide information about what broke and what you were
1316 * expecting.
1317 *
1318 * The invariant message will be stripped in production, but the invariant
1319 * will remain to ensure logic does not differ in production.
1320 */
1321
1322 var validateFormat = function validateFormat(format) {};
1323
1324 if (process.env.NODE_ENV !== 'production') {
1325 validateFormat = function validateFormat(format) {
1326 if (format === undefined) {
1327 throw new Error('invariant requires an error message argument');
1328 }
1329 };
1330 }
1331
1332 function invariant(condition, format, a, b, c, d, e, f) {
1333 validateFormat(format);
1334
1335 if (!condition) {
1336 var error;
1337 if (format === undefined) {
1338 error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
1339 } else {
1340 var args = [a, b, c, d, e, f];
1341 var argIndex = 0;
1342 error = new Error(format.replace(/%s/g, function () {
1343 return args[argIndex++];
1344 }));
1345 error.name = 'Invariant Violation';
1346 }
1347
1348 error.framesToPop = 1; // we don't care about invariant's own frame
1349 throw error;
1350 }
1351 }
1352
1353 module.exports = invariant;
1354 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
1355
1356/***/ }),
1357/* 9 */
1358/***/ (function(module, exports, __webpack_require__) {
1359
1360 /* WEBPACK VAR INJECTION */(function(process) {/**
1361 * Copyright (c) 2014-present, Facebook, Inc.
1362 *
1363 * This source code is licensed under the MIT license found in the
1364 * LICENSE file in the root directory of this source tree.
1365 *
1366 */
1367
1368 'use strict';
1369
1370 var emptyFunction = __webpack_require__(7);
1371
1372 /**
1373 * Similar to invariant but only logs a warning if the condition is not met.
1374 * This can be used to log issues in development environments in critical
1375 * paths. Removing the logging code for production environments will keep the
1376 * same logic and follow the same code paths.
1377 */
1378
1379 var warning = emptyFunction;
1380
1381 if (process.env.NODE_ENV !== 'production') {
1382 var printWarning = function printWarning(format) {
1383 for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1384 args[_key - 1] = arguments[_key];
1385 }
1386
1387 var argIndex = 0;
1388 var message = 'Warning: ' + format.replace(/%s/g, function () {
1389 return args[argIndex++];
1390 });
1391 if (typeof console !== 'undefined') {
1392 console.error(message);
1393 }
1394 try {
1395 // --- Welcome to debugging React ---
1396 // This error was thrown as a convenience so that you can use this stack
1397 // to find the callsite that caused this warning to fire.
1398 throw new Error(message);
1399 } catch (x) {}
1400 };
1401
1402 warning = function warning(condition, format) {
1403 if (format === undefined) {
1404 throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
1405 }
1406
1407 if (format.indexOf('Failed Composite propType: ') === 0) {
1408 return; // Ignore CompositeComponent proptype check.
1409 }
1410
1411 if (!condition) {
1412 for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
1413 args[_key2 - 2] = arguments[_key2];
1414 }
1415
1416 printWarning.apply(undefined, [format].concat(args));
1417 }
1418 };
1419 }
1420
1421 module.exports = warning;
1422 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
1423
1424/***/ }),
1425/* 10 */
1426/***/ (function(module, exports) {
1427
1428 /*
1429 object-assign
1430 (c) Sindre Sorhus
1431 @license MIT
1432 */
1433
1434 'use strict';
1435 /* eslint-disable no-unused-vars */
1436 var getOwnPropertySymbols = Object.getOwnPropertySymbols;
1437 var hasOwnProperty = Object.prototype.hasOwnProperty;
1438 var propIsEnumerable = Object.prototype.propertyIsEnumerable;
1439
1440 function toObject(val) {
1441 if (val === null || val === undefined) {
1442 throw new TypeError('Object.assign cannot be called with null or undefined');
1443 }
1444
1445 return Object(val);
1446 }
1447
1448 function shouldUseNative() {
1449 try {
1450 if (!Object.assign) {
1451 return false;
1452 }
1453
1454 // Detect buggy property enumeration order in older V8 versions.
1455
1456 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
1457 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
1458 test1[5] = 'de';
1459 if (Object.getOwnPropertyNames(test1)[0] === '5') {
1460 return false;
1461 }
1462
1463 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
1464 var test2 = {};
1465 for (var i = 0; i < 10; i++) {
1466 test2['_' + String.fromCharCode(i)] = i;
1467 }
1468 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
1469 return test2[n];
1470 });
1471 if (order2.join('') !== '0123456789') {
1472 return false;
1473 }
1474
1475 // https://bugs.chromium.org/p/v8/issues/detail?id=3056
1476 var test3 = {};
1477 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
1478 test3[letter] = letter;
1479 });
1480 if (Object.keys(Object.assign({}, test3)).join('') !==
1481 'abcdefghijklmnopqrst') {
1482 return false;
1483 }
1484
1485 return true;
1486 } catch (err) {
1487 // We don't expect any of the above to throw, but better to be safe.
1488 return false;
1489 }
1490 }
1491
1492 module.exports = shouldUseNative() ? Object.assign : function (target, source) {
1493 var from;
1494 var to = toObject(target);
1495 var symbols;
1496
1497 for (var s = 1; s < arguments.length; s++) {
1498 from = Object(arguments[s]);
1499
1500 for (var key in from) {
1501 if (hasOwnProperty.call(from, key)) {
1502 to[key] = from[key];
1503 }
1504 }
1505
1506 if (getOwnPropertySymbols) {
1507 symbols = getOwnPropertySymbols(from);
1508 for (var i = 0; i < symbols.length; i++) {
1509 if (propIsEnumerable.call(from, symbols[i])) {
1510 to[symbols[i]] = from[symbols[i]];
1511 }
1512 }
1513 }
1514 }
1515
1516 return to;
1517 };
1518
1519
1520/***/ }),
1521/* 11 */
1522/***/ (function(module, exports) {
1523
1524 /**
1525 * Copyright (c) 2013-present, Facebook, Inc.
1526 *
1527 * This source code is licensed under the MIT license found in the
1528 * LICENSE file in the root directory of this source tree.
1529 */
1530
1531 'use strict';
1532
1533 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
1534
1535 module.exports = ReactPropTypesSecret;
1536
1537
1538/***/ }),
1539/* 12 */
1540/***/ (function(module, exports, __webpack_require__) {
1541
1542 /* WEBPACK VAR INJECTION */(function(process) {/**
1543 * Copyright (c) 2013-present, Facebook, Inc.
1544 *
1545 * This source code is licensed under the MIT license found in the
1546 * LICENSE file in the root directory of this source tree.
1547 */
1548
1549 'use strict';
1550
1551 if (process.env.NODE_ENV !== 'production') {
1552 var invariant = __webpack_require__(8);
1553 var warning = __webpack_require__(9);
1554 var ReactPropTypesSecret = __webpack_require__(11);
1555 var loggedTypeFailures = {};
1556 }
1557
1558 /**
1559 * Assert that the values match with the type specs.
1560 * Error messages are memorized and will only be shown once.
1561 *
1562 * @param {object} typeSpecs Map of name to a ReactPropType
1563 * @param {object} values Runtime values that need to be type-checked
1564 * @param {string} location e.g. "prop", "context", "child context"
1565 * @param {string} componentName Name of the component for error messages.
1566 * @param {?Function} getStack Returns the component stack.
1567 * @private
1568 */
1569 function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
1570 if (process.env.NODE_ENV !== 'production') {
1571 for (var typeSpecName in typeSpecs) {
1572 if (typeSpecs.hasOwnProperty(typeSpecName)) {
1573 var error;
1574 // Prop type validation may throw. In case they do, we don't want to
1575 // fail the render phase where it didn't fail before. So we log it.
1576 // After these have been cleaned up, we'll let them throw.
1577 try {
1578 // This is intentionally an invariant that gets caught. It's the same
1579 // behavior as without this statement except with a better message.
1580 invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]);
1581 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
1582 } catch (ex) {
1583 error = ex;
1584 }
1585 warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
1586 if (error instanceof Error && !(error.message in loggedTypeFailures)) {
1587 // Only monitor this failure once because there tends to be a lot of the
1588 // same error.
1589 loggedTypeFailures[error.message] = true;
1590
1591 var stack = getStack ? getStack() : '';
1592
1593 warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
1594 }
1595 }
1596 }
1597 }
1598 }
1599
1600 module.exports = checkPropTypes;
1601
1602 /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
1603
1604/***/ }),
1605/* 13 */
1606/***/ (function(module, exports, __webpack_require__) {
1607
1608 /**
1609 * Copyright (c) 2013-present, Facebook, Inc.
1610 *
1611 * This source code is licensed under the MIT license found in the
1612 * LICENSE file in the root directory of this source tree.
1613 */
1614
1615 'use strict';
1616
1617 var emptyFunction = __webpack_require__(7);
1618 var invariant = __webpack_require__(8);
1619 var ReactPropTypesSecret = __webpack_require__(11);
1620
1621 module.exports = function() {
1622 function shim(props, propName, componentName, location, propFullName, secret) {
1623 if (secret === ReactPropTypesSecret) {
1624 // It is still safe when called from React.
1625 return;
1626 }
1627 invariant(
1628 false,
1629 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
1630 'Use PropTypes.checkPropTypes() to call them. ' +
1631 'Read more at http://fb.me/use-check-prop-types'
1632 );
1633 };
1634 shim.isRequired = shim;
1635 function getShim() {
1636 return shim;
1637 };
1638 // Important!
1639 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
1640 var ReactPropTypes = {
1641 array: shim,
1642 bool: shim,
1643 func: shim,
1644 number: shim,
1645 object: shim,
1646 string: shim,
1647 symbol: shim,
1648
1649 any: shim,
1650 arrayOf: getShim,
1651 element: shim,
1652 instanceOf: getShim,
1653 node: shim,
1654 objectOf: getShim,
1655 oneOf: getShim,
1656 oneOfType: getShim,
1657 shape: getShim,
1658 exact: getShim
1659 };
1660
1661 ReactPropTypes.checkPropTypes = emptyFunction;
1662 ReactPropTypes.PropTypes = ReactPropTypes;
1663
1664 return ReactPropTypes;
1665 };
1666
1667
1668/***/ }),
1669/* 14 */
1670/***/ (function(module, exports) {
1671
1672 module.exports = __WEBPACK_EXTERNAL_MODULE_14__;
1673
1674/***/ }),
1675/* 15 */
1676/***/ (function(module, exports) {
1677
1678 'use strict';
1679
1680 var simpleIsEqual = function simpleIsEqual(a, b) {
1681 return a === b;
1682 };
1683
1684 function index (resultFn) {
1685 var isEqual = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : simpleIsEqual;
1686
1687 var lastThis = void 0;
1688 var lastArgs = [];
1689 var lastResult = void 0;
1690 var calledOnce = false;
1691
1692 var isNewArgEqualToLast = function isNewArgEqualToLast(newArg, index) {
1693 return isEqual(newArg, lastArgs[index]);
1694 };
1695
1696 var result = function result() {
1697 for (var _len = arguments.length, newArgs = Array(_len), _key = 0; _key < _len; _key++) {
1698 newArgs[_key] = arguments[_key];
1699 }
1700
1701 if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) {
1702 return lastResult;
1703 }
1704
1705 calledOnce = true;
1706 lastThis = this;
1707 lastArgs = newArgs;
1708 lastResult = resultFn.apply(this, newArgs);
1709 return lastResult;
1710 };
1711
1712 return result;
1713 }
1714
1715 module.exports = index;
1716
1717
1718/***/ })
1719/******/ ])
1720});
1721;
1722//# sourceMappingURL=main.umd.js.map
\No newline at end of file