UNPKG

105 kBJavaScriptView Raw
1import { Current, commitAttachRef, detachAllRef, eventCenter, internal_safe_get, internal_safe_set, invokeEffects, internal_force_update, onAndSyncApis, noPromiseApis, otherApis, initPxTransform, Link, getEnv, Events, ENV_TYPE, createRef, render, internal_inline_style, internal_get_original, interceptors, RefsArray, useEffect, useLayoutEffect, useReducer, useState, useDidShow, useDidHide, usePullDownRefresh, useReachBottom, usePageScroll, useResize, useShareAppMessage, useTabItemTap, useRouter, useScope, useRef, useCallback, useMemo, useImperativeHandle, useContext, createContext, memo, setIsUsingDiff } from '@tarojs/taro';
2
3function _typeof(obj) {
4 "@babel/helpers - typeof";
5
6 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
7 _typeof = function (obj) {
8 return typeof obj;
9 };
10 } else {
11 _typeof = function (obj) {
12 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
13 };
14 }
15
16 return _typeof(obj);
17}
18
19function _classCallCheck(instance, Constructor) {
20 if (!(instance instanceof Constructor)) {
21 throw new TypeError("Cannot call a class as a function");
22 }
23}
24
25function _defineProperties(target, props) {
26 for (var i = 0; i < props.length; i++) {
27 var descriptor = props[i];
28 descriptor.enumerable = descriptor.enumerable || false;
29 descriptor.configurable = true;
30 if ("value" in descriptor) descriptor.writable = true;
31 Object.defineProperty(target, descriptor.key, descriptor);
32 }
33}
34
35function _createClass(Constructor, protoProps, staticProps) {
36 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
37 if (staticProps) _defineProperties(Constructor, staticProps);
38 return Constructor;
39}
40
41function _defineProperty(obj, key, value) {
42 if (key in obj) {
43 Object.defineProperty(obj, key, {
44 value: value,
45 enumerable: true,
46 configurable: true,
47 writable: true
48 });
49 } else {
50 obj[key] = value;
51 }
52
53 return obj;
54}
55
56function _inherits(subClass, superClass) {
57 if (typeof superClass !== "function" && superClass !== null) {
58 throw new TypeError("Super expression must either be null or a function");
59 }
60
61 subClass.prototype = Object.create(superClass && superClass.prototype, {
62 constructor: {
63 value: subClass,
64 writable: true,
65 configurable: true
66 }
67 });
68 if (superClass) _setPrototypeOf(subClass, superClass);
69}
70
71function _getPrototypeOf(o) {
72 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
73 return o.__proto__ || Object.getPrototypeOf(o);
74 };
75 return _getPrototypeOf(o);
76}
77
78function _setPrototypeOf(o, p) {
79 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
80 o.__proto__ = p;
81 return o;
82 };
83
84 return _setPrototypeOf(o, p);
85}
86
87function _isNativeReflectConstruct() {
88 if (typeof Reflect === "undefined" || !Reflect.construct) return false;
89 if (Reflect.construct.sham) return false;
90 if (typeof Proxy === "function") return true;
91
92 try {
93 Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
94 return true;
95 } catch (e) {
96 return false;
97 }
98}
99
100function _assertThisInitialized(self) {
101 if (self === void 0) {
102 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
103 }
104
105 return self;
106}
107
108function _possibleConstructorReturn(self, call) {
109 if (call && (typeof call === "object" || typeof call === "function")) {
110 return call;
111 }
112
113 return _assertThisInitialized(self);
114}
115
116function _createSuper(Derived) {
117 var hasNativeReflectConstruct = _isNativeReflectConstruct();
118
119 return function _createSuperInternal() {
120 var Super = _getPrototypeOf(Derived),
121 result;
122
123 if (hasNativeReflectConstruct) {
124 var NewTarget = _getPrototypeOf(this).constructor;
125
126 result = Reflect.construct(Super, arguments, NewTarget);
127 } else {
128 result = Super.apply(this, arguments);
129 }
130
131 return _possibleConstructorReturn(this, result);
132 };
133}
134
135function _toConsumableArray(arr) {
136 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
137}
138
139function _arrayWithoutHoles(arr) {
140 if (Array.isArray(arr)) return _arrayLikeToArray(arr);
141}
142
143function _iterableToArray(iter) {
144 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
145}
146
147function _unsupportedIterableToArray(o, minLen) {
148 if (!o) return;
149 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
150 var n = Object.prototype.toString.call(o).slice(8, -1);
151 if (n === "Object" && o.constructor) n = o.constructor.name;
152 if (n === "Map" || n === "Set") return Array.from(o);
153 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
154}
155
156function _arrayLikeToArray(arr, len) {
157 if (len == null || len > arr.length) len = arr.length;
158
159 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
160
161 return arr2;
162}
163
164function _nonIterableSpread() {
165 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
166}
167
168/* eslint-disable */
169var objectIs = Object.is || function (x, y) {
170 if (x === y) {
171 return x !== 0 || 1 / x === 1 / y;
172 }
173
174 return x !== x && y !== y;
175};
176
177function shallowEqual(obj1, obj2) {
178 if (_typeof(obj1) !== 'object' && _typeof(obj2) !== 'object') {
179 return obj1 === obj2;
180 }
181
182 if (obj1 === null && obj2 === null) {
183 return true;
184 }
185
186 if (obj1 === null || obj2 === null) {
187 return false;
188 }
189
190 if (objectIs(obj1, obj2)) {
191 return true;
192 }
193
194 var obj1Keys = obj1 ? Object.keys(obj1) : [];
195 var obj2Keys = obj2 ? Object.keys(obj2) : [];
196
197 if (obj1Keys.length !== obj2Keys.length) {
198 return false;
199 }
200
201 for (var i = 0; i < obj1Keys.length; i++) {
202 var obj1KeyItem = obj1Keys[i];
203
204 if (!obj2.hasOwnProperty(obj1KeyItem) || !objectIs(obj1[obj1KeyItem], obj2[obj1KeyItem])) {
205 return false;
206 }
207 }
208
209 return true;
210}
211
212var SimpleMap = /*#__PURE__*/function () {
213 function SimpleMap() {
214 _classCallCheck(this, SimpleMap);
215
216 this.cache = [];
217 this.size = 0;
218 }
219
220 _createClass(SimpleMap, [{
221 key: "set",
222 value: function set(k, v) {
223 var len = this.cache.length;
224
225 if (!len) {
226 this.cache.push({
227 k: k,
228 v: v
229 });
230 this.size += 1;
231 return;
232 }
233
234 for (var i = 0; i < len; i++) {
235 var item = this.cache[i];
236
237 if (item.k === k) {
238 item.v = v;
239 return;
240 }
241 }
242
243 this.cache.push({
244 k: k,
245 v: v
246 });
247 this.size += 1;
248 }
249 }, {
250 key: "get",
251 value: function get(k) {
252 var len = this.cache.length;
253
254 if (!len) {
255 return;
256 }
257
258 for (var i = 0; i < len; i++) {
259 var item = this.cache[i];
260
261 if (item.k === k) {
262 return item.v;
263 }
264 }
265 }
266 }, {
267 key: "has",
268 value: function has(k) {
269 var len = this.cache.length;
270
271 if (!len) {
272 return false;
273 }
274
275 for (var i = 0; i < len; i++) {
276 var item = this.cache[i];
277
278 if (item.k === k) {
279 return true;
280 }
281 }
282
283 return false;
284 }
285 }, {
286 key: "delete",
287 value: function _delete(k) {
288 var len = this.cache.length;
289
290 for (var i = 0; i < len; i++) {
291 var item = this.cache[i];
292
293 if (item.k === k) {
294 this.cache.splice(i, 1);
295 this.size -= 1;
296 return true;
297 }
298 }
299
300 return false;
301 }
302 }, {
303 key: "clear",
304 value: function clear() {
305 var len = this.cache.length;
306 this.size = 0;
307
308 if (!len) {
309 return;
310 }
311
312 while (len) {
313 this.cache.pop();
314 len--;
315 }
316 }
317 }]);
318
319 return SimpleMap;
320}();
321
322function addLeadingSlash(path) {
323 return path.charAt(0) === '/' ? path : '/' + path;
324}
325
326function getCurrentPageUrl() {
327 var pages = getCurrentPages();
328 var currentPage = pages[pages.length - 1];
329 return addLeadingSlash(currentPage.route || currentPage.__route__);
330}
331
332var nextTick = function nextTick(fn) {
333 var _fn;
334
335 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
336 args[_key - 1] = arguments[_key];
337 }
338
339 fn = typeof fn === 'function' ? (_fn = fn).bind.apply(_fn, [null].concat(args)) : fn;
340 var timerFunc = tt.nextTick ? tt.nextTick : setTimeout;
341 timerFunc(fn);
342};
343
344var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
345
346function createCommonjsModule(fn, module) {
347 return module = { exports: {} }, fn(module, module.exports), module.exports;
348}
349
350/** Detect free variable `global` from Node.js. */
351
352var freeGlobal = _typeof(commonjsGlobal) == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
353var _freeGlobal = freeGlobal;
354
355/** Detect free variable `self`. */
356
357var freeSelf = (typeof self === "undefined" ? "undefined" : _typeof(self)) == 'object' && self && self.Object === Object && self;
358/** Used as a reference to the global object. */
359
360var root = _freeGlobal || freeSelf || Function('return this')();
361var _root = root;
362
363/** Built-in value references. */
364
365var _Symbol2 = _root.Symbol;
366var _Symbol = _Symbol2;
367
368/** Used for built-in method references. */
369
370var objectProto = Object.prototype;
371/** Used to check objects for own properties. */
372
373var hasOwnProperty = objectProto.hasOwnProperty;
374/**
375 * Used to resolve the
376 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
377 * of values.
378 */
379
380var nativeObjectToString = objectProto.toString;
381/** Built-in value references. */
382
383var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
384/**
385 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
386 *
387 * @private
388 * @param {*} value The value to query.
389 * @returns {string} Returns the raw `toStringTag`.
390 */
391
392function getRawTag(value) {
393 var isOwn = hasOwnProperty.call(value, symToStringTag),
394 tag = value[symToStringTag];
395
396 try {
397 value[symToStringTag] = undefined;
398 var unmasked = true;
399 } catch (e) {}
400
401 var result = nativeObjectToString.call(value);
402
403 if (unmasked) {
404 if (isOwn) {
405 value[symToStringTag] = tag;
406 } else {
407 delete value[symToStringTag];
408 }
409 }
410
411 return result;
412}
413
414var _getRawTag = getRawTag;
415
416/** Used for built-in method references. */
417var objectProto$1 = Object.prototype;
418/**
419 * Used to resolve the
420 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
421 * of values.
422 */
423
424var nativeObjectToString$1 = objectProto$1.toString;
425/**
426 * Converts `value` to a string using `Object.prototype.toString`.
427 *
428 * @private
429 * @param {*} value The value to convert.
430 * @returns {string} Returns the converted string.
431 */
432
433function objectToString(value) {
434 return nativeObjectToString$1.call(value);
435}
436
437var _objectToString = objectToString;
438
439/** `Object#toString` result references. */
440
441var nullTag = '[object Null]',
442 undefinedTag = '[object Undefined]';
443/** Built-in value references. */
444
445var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
446/**
447 * The base implementation of `getTag` without fallbacks for buggy environments.
448 *
449 * @private
450 * @param {*} value The value to query.
451 * @returns {string} Returns the `toStringTag`.
452 */
453
454function baseGetTag(value) {
455 if (value == null) {
456 return value === undefined ? undefinedTag : nullTag;
457 }
458
459 return symToStringTag$1 && symToStringTag$1 in Object(value) ? _getRawTag(value) : _objectToString(value);
460}
461
462var _baseGetTag = baseGetTag;
463
464/**
465 * Creates a unary function that invokes `func` with its argument transformed.
466 *
467 * @private
468 * @param {Function} func The function to wrap.
469 * @param {Function} transform The argument transform.
470 * @returns {Function} Returns the new function.
471 */
472function overArg(func, transform) {
473 return function (arg) {
474 return func(transform(arg));
475 };
476}
477
478var _overArg = overArg;
479
480/** Built-in value references. */
481
482var getPrototype = _overArg(Object.getPrototypeOf, Object);
483var _getPrototype = getPrototype;
484
485/**
486 * Checks if `value` is object-like. A value is object-like if it's not `null`
487 * and has a `typeof` result of "object".
488 *
489 * @static
490 * @memberOf _
491 * @since 4.0.0
492 * @category Lang
493 * @param {*} value The value to check.
494 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
495 * @example
496 *
497 * _.isObjectLike({});
498 * // => true
499 *
500 * _.isObjectLike([1, 2, 3]);
501 * // => true
502 *
503 * _.isObjectLike(_.noop);
504 * // => false
505 *
506 * _.isObjectLike(null);
507 * // => false
508 */
509function isObjectLike(value) {
510 return value != null && _typeof(value) == 'object';
511}
512
513var isObjectLike_1 = isObjectLike;
514
515/** `Object#toString` result references. */
516
517var objectTag = '[object Object]';
518/** Used for built-in method references. */
519
520var funcProto = Function.prototype,
521 objectProto$2 = Object.prototype;
522/** Used to resolve the decompiled source of functions. */
523
524var funcToString = funcProto.toString;
525/** Used to check objects for own properties. */
526
527var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
528/** Used to infer the `Object` constructor. */
529
530var objectCtorString = funcToString.call(Object);
531/**
532 * Checks if `value` is a plain object, that is, an object created by the
533 * `Object` constructor or one with a `[[Prototype]]` of `null`.
534 *
535 * @static
536 * @memberOf _
537 * @since 0.8.0
538 * @category Lang
539 * @param {*} value The value to check.
540 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
541 * @example
542 *
543 * function Foo() {
544 * this.a = 1;
545 * }
546 *
547 * _.isPlainObject(new Foo);
548 * // => false
549 *
550 * _.isPlainObject([1, 2, 3]);
551 * // => false
552 *
553 * _.isPlainObject({ 'x': 0, 'y': 0 });
554 * // => true
555 *
556 * _.isPlainObject(Object.create(null));
557 * // => true
558 */
559
560function isPlainObject(value) {
561 if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag) {
562 return false;
563 }
564
565 var proto = _getPrototype(value);
566
567 if (proto === null) {
568 return true;
569 }
570
571 var Ctor = hasOwnProperty$1.call(proto, 'constructor') && proto.constructor;
572 return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
573}
574
575var isPlainObject_1 = isPlainObject;
576
577function isEmptyObject(obj) {
578 if (!obj || !isPlainObject_1(obj)) {
579 return false;
580 }
581
582 for (var n in obj) {
583 if (obj.hasOwnProperty(n)) {
584 return false;
585 }
586 }
587
588 return true;
589}
590function isUndefined(o) {
591 return o === undefined;
592}
593function isFunction(arg) {
594 return typeof arg === 'function';
595}
596function isArray(arg) {
597 return Array.isArray(arg);
598}
599function shakeFnFromObject(obj) {
600 var newObj;
601
602 if (isArray(obj)) {
603 newObj = [];
604 var len = obj.length;
605
606 for (var i = 0; i < len; i++) {
607 newObj.push(shakeFnFromObject(obj[i]));
608 }
609 } else if (isPlainObject_1(obj)) {
610 newObj = {};
611
612 for (var key in obj) {
613 if (isFunction(obj[key])) {
614 continue;
615 }
616
617 var ret = shakeFnFromObject(obj[key]);
618 newObj[key] = ret;
619 }
620 } else {
621 return obj;
622 }
623
624 return newObj;
625}
626var keyList = Object.keys;
627var hasProp = Object.prototype.hasOwnProperty;
628
629function diffArrToPath(to, from) {
630 var res = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
631 var keyPrev = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
632 var len = to.length;
633
634 var _loop = function _loop(i) {
635 var toItem = to[i];
636 var fromItem = from[i];
637 var targetKey = "".concat(keyPrev, "[").concat(i, "]");
638
639 if (toItem === fromItem) {
640 return "continue";
641 } else if (_typeof(toItem) !== _typeof(fromItem)) {
642 res[targetKey] = toItem;
643 } else {
644 if (_typeof(toItem) !== 'object') {
645 res[targetKey] = toItem;
646 } else {
647 var arrTo = isArray(toItem);
648 var arrFrom = isArray(fromItem);
649
650 if (arrTo !== arrFrom) {
651 res[targetKey] = toItem;
652 } else if (arrTo && arrFrom) {
653 if (toItem.length < fromItem.length) {
654 res[targetKey] = toItem;
655 } else {
656 // 数组
657 diffArrToPath(toItem, fromItem, res, "".concat(targetKey));
658 }
659 } else {
660 if (!toItem || !fromItem || keyList(toItem).length < keyList(fromItem).length) {
661 res[targetKey] = toItem;
662 } else {
663 // 对象
664 var shouldDiffObject = true;
665 Object.keys(fromItem).some(function (key) {
666 if (typeof toItem[key] === 'undefined' && typeof fromItem[key] !== 'undefined') {
667 shouldDiffObject = false;
668 return true;
669 }
670 });
671
672 if (shouldDiffObject) {
673 diffObjToPath(toItem, fromItem, res, "".concat(targetKey, "."));
674 } else {
675 res[targetKey] = toItem;
676 }
677 }
678 }
679 }
680 }
681 };
682
683 for (var i = 0; i < len; i++) {
684 var _ret = _loop(i);
685
686 if (_ret === "continue") continue;
687 }
688
689 return res;
690} // 比较的对象均为plainObject,且函数已被过滤
691
692
693function diffObjToPath(to, from) {
694 var res = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
695 var keyPrev = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
696 var keys = keyList(to);
697 var len = keys.length;
698
699 var _loop2 = function _loop2(i) {
700 var key = keys[i];
701 var toItem = to[key];
702 var fromItem = from[key];
703 var targetKey = "".concat(keyPrev).concat(key);
704
705 if (toItem === fromItem) {
706 return "continue";
707 } else if (!hasProp.call(from, key)) {
708 res[targetKey] = toItem;
709 } else if (_typeof(toItem) !== _typeof(fromItem)) {
710 res[targetKey] = toItem;
711 } else {
712 if (_typeof(toItem) !== 'object') {
713 res[targetKey] = toItem;
714 } else {
715 var arrTo = isArray(toItem);
716 var arrFrom = isArray(fromItem);
717
718 if (arrTo !== arrFrom) {
719 res[targetKey] = toItem;
720 } else if (arrTo && arrFrom) {
721 if (toItem.length < fromItem.length) {
722 res[targetKey] = toItem;
723 } else {
724 // 数组
725 diffArrToPath(toItem, fromItem, res, "".concat(targetKey));
726 }
727 } else {
728 // null
729 if (!toItem || !fromItem) {
730 res[targetKey] = toItem;
731 } else {
732 // 对象
733 var shouldDiffObject = true;
734 Object.keys(fromItem).some(function (key) {
735 if (typeof toItem[key] === 'undefined' && typeof fromItem[key] !== 'undefined') {
736 shouldDiffObject = false;
737 return true;
738 }
739 });
740
741 if (shouldDiffObject) {
742 diffObjToPath(toItem, fromItem, res, "".concat(targetKey, "."));
743 } else {
744 res[targetKey] = toItem;
745 }
746 }
747 }
748 }
749 }
750 };
751
752 for (var i = 0; i < len; i++) {
753 var _ret2 = _loop2(i);
754
755 if (_ret2 === "continue") continue;
756 }
757
758 return res;
759}
760function queryToJson(str) {
761 var dec = decodeURIComponent;
762 var qp = str.split('&');
763 var ret = {};
764 var name;
765 var val;
766
767 for (var i = 0, l = qp.length, item; i < l; ++i) {
768 item = qp[i];
769
770 if (item.length) {
771 var s = item.indexOf('=');
772
773 if (s < 0) {
774 name = dec(item);
775 val = '';
776 } else {
777 name = dec(item.slice(0, s));
778 val = dec(item.slice(s + 1));
779 }
780
781 if (typeof ret[name] === 'string') {
782 // inline'd type check
783 ret[name] = [ret[name]];
784 }
785
786 if (isArray(ret[name])) {
787 ret[name].push(val);
788 } else {
789 ret[name] = val;
790 }
791 }
792 }
793
794 return ret; // Object
795}
796
797var _loadTime = new Date().getTime().toString();
798
799var _i = 1;
800function getUniqueKey() {
801 return _loadTime + _i++;
802}
803
804function triggerLoopRef(that, dom, handler) {
805 var handlerType = _typeof(handler);
806
807 if (handlerType !== 'function' && handlerType !== 'object') {
808 return console.warn("\u5FAA\u73AF Ref \u53EA\u652F\u6301\u51FD\u6570\u6216 createRef()\uFF0C\u5F53\u524D\u7C7B\u578B\u4E3A\uFF1A".concat(handlerType));
809 }
810
811 if (handlerType === 'object') {
812 handler.current = dom;
813 } else if (handlerType === 'function') {
814 handler.call(that, dom);
815 }
816}
817
818function handleLoopRef(component, id, type, handler) {
819 if (!component) return null;
820 var res;
821
822 if (type === 'component') {
823 component.selectComponent(id, function (res) {
824 res = res ? res.$component || res : null;
825 res && triggerLoopRef(component.$component, res, handler);
826 });
827 } else {
828 var query = wx.createSelectorQuery()["in"](component);
829 res = query.select(id);
830 res && triggerLoopRef(component.$component, res, handler);
831 }
832
833 return null;
834}
835var id$1 = 0;
836
837function genId() {
838 return String(id$1++);
839}
840
841var compIdsMapper;
842
843try {
844 compIdsMapper = new Map();
845} catch (error) {
846 compIdsMapper = new SimpleMap();
847}
848
849function genCompid(key, isNeedCreate) {
850 if (!Current || !Current.current || !Current.current.$scope) return [];
851 var prevId = compIdsMapper.get(key);
852
853 if (isNeedCreate) {
854 var _id = genId();
855
856 compIdsMapper.set(key, _id);
857 return [prevId, _id];
858 } else {
859 var _id2 = prevId || genId();
860
861 !prevId && compIdsMapper.set(key, _id2);
862 return [null, _id2];
863 }
864}
865var prefix = 0;
866function genCompPrefix() {
867 return String(prefix++);
868}
869
870var data = {};
871function cacheDataSet(key, val) {
872 data[key] = val;
873}
874function cacheDataGet(key, delelteAfterGet) {
875 var temp = data[key];
876 delelteAfterGet && delete data[key];
877 return temp;
878}
879function cacheDataHas(key) {
880 return key in data;
881}
882
883var Manager = /*#__PURE__*/function () {
884 function Manager() {
885 _classCallCheck(this, Manager);
886
887 _defineProperty(this, "map", {});
888
889 _defineProperty(this, "observers", {});
890 }
891
892 _createClass(Manager, [{
893 key: "set",
894 value: function set() {
895 var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
896 var compid = arguments.length > 1 ? arguments[1] : undefined;
897 var previd = arguments.length > 2 ? arguments[2] : undefined;
898 if (!compid) return;
899
900 if (previd) {
901 this["delete"](previd);
902 }
903
904 var observers = this.observers;
905
906 if (!this.map[compid]) {
907 Object.defineProperty(this.map, compid, {
908 configurable: true,
909 get: function get() {
910 return this["__".concat(compid)];
911 },
912 set: function set(props) {
913 this["__".concat(compid)] = props;
914 var component = observers[compid] && observers[compid].component;
915 var ComponentClass = observers[compid] && observers[compid].ComponentClass;
916 if (!component || !ComponentClass || !component.__isReady) return;
917 var nextProps = filterProps(ComponentClass.defaultProps, props, component.props);
918 component.props = nextProps;
919 nextTick(function () {
920 component._unsafeCallUpdate = true;
921 updateComponent(component);
922 component._unsafeCallUpdate = false;
923 });
924 }
925 });
926 }
927
928 this.map[compid] = props;
929 }
930 }, {
931 key: "delete",
932 value: function _delete(compid) {
933 delete this.map[compid];
934 delete this.map["__".concat(compid)];
935 delete this.observers[compid];
936 }
937 }]);
938
939 return Manager;
940}();
941
942var propsManager = new Manager();
943
944var anonymousFnNamePreffix = 'funPrivate';
945var preloadPrivateKey = '__preload_';
946var preloadInitedComponent = '$preloadComponent';
947var PRELOAD_DATA_KEY = 'preload';
948var pageExtraFns = ['onPullDownRefresh', 'onReachBottom', 'onShareAppMessage', 'onPageScroll', 'onTabItemTap'];
949
950function bindProperties(weappComponentConf, ComponentClass, isPage) {
951 weappComponentConf.properties = {};
952
953 if (isPage) {
954 weappComponentConf.properties[preloadPrivateKey] = {
955 type: null,
956 value: null
957 };
958 }
959
960 weappComponentConf.properties.compid = {
961 type: null,
962 value: null,
963 observer: function observer(newVal, oldVal) {
964 var _this = this;
965
966 // 头条基础库1.38.2后,太早 setData $taroCompReady 为 true 时,setData 虽然成功,但 slot 会不显示。
967 // 因此不在 observer 里 initComponent,在组件 attached 时 initComponent 吧。
968 // initComponent.apply(this, [ComponentClass, isPage])
969 if (oldVal && oldVal !== newVal) {
970 var extraProps = this.data.extraProps;
971 var component = this.$component;
972 propsManager.observers[newVal] = {
973 component: component,
974 ComponentClass: component.constructor
975 };
976 var nextProps = filterProps(component.constructor.defaultProps, propsManager.map[newVal], component.props, extraProps || null);
977 this.$component.props = nextProps;
978 nextTick(function () {
979 _this.$component._unsafeCallUpdate = true;
980 updateComponent(_this.$component);
981 _this.$component._unsafeCallUpdate = false;
982 });
983 }
984 }
985 };
986}
987
988function bindBehaviors(weappComponentConf, ComponentClass) {
989 if (ComponentClass.behaviors) {
990 weappComponentConf.behaviors = ComponentClass.behaviors;
991 }
992}
993
994function bindStaticOptions(weappComponentConf, ComponentClass) {
995 if (ComponentClass.options) {
996 weappComponentConf.options = ComponentClass.options;
997 }
998}
999
1000function bindStaticFns(weappComponentConf, ComponentClass) {
1001 for (var key in ComponentClass) {
1002 typeof ComponentClass[key] === 'function' && (weappComponentConf[key] = ComponentClass[key]);
1003 } // 低版本 IOS 下部分属性不能直接访问
1004
1005
1006 Object.getOwnPropertyNames(ComponentClass).forEach(function (key) {
1007 var excludes = ['arguments', 'caller', 'length', 'name', 'prototype'];
1008
1009 if (excludes.indexOf(key) < 0) {
1010 typeof ComponentClass[key] === 'function' && (weappComponentConf[key] = ComponentClass[key]);
1011 }
1012 });
1013}
1014
1015function processEvent(eventHandlerName, obj) {
1016 if (obj[eventHandlerName]) return;
1017
1018 obj[eventHandlerName] = function (event) {
1019 if (event) {
1020 event.preventDefault = function () {};
1021
1022 event.stopPropagation = function () {};
1023
1024 event.currentTarget = event.currentTarget || event.target || {};
1025
1026 if (event.target) {
1027 Object.assign(event.target, event.detail);
1028 }
1029
1030 Object.assign(event.currentTarget, event.detail);
1031 }
1032
1033 var scope = this.$component;
1034 if (!scope || !scope[eventHandlerName]) return;
1035 var callScope = scope;
1036 var isAnonymousFn = eventHandlerName.indexOf(anonymousFnNamePreffix) > -1;
1037 var realArgs = [];
1038 var detailArgs = [];
1039 var datasetArgs = [];
1040 var isScopeBinded = false; // 解析从dataset中传过来的参数
1041
1042 var dataset = event.currentTarget.dataset || {};
1043 var bindArgs = {};
1044 var eventType = event.type ? event.type.toLocaleLowerCase() : null;
1045 if (event.detail && event.detail.__detail) Object.assign(dataset, event.detail.__detail);
1046 Object.keys(dataset).forEach(function (key) {
1047 var keyLower = key.toLocaleLowerCase();
1048
1049 if (/^e/.test(keyLower)) {
1050 // 小程序属性里中划线后跟一个下划线会解析成不同的结果
1051 keyLower = keyLower.replace(/^e/, '');
1052
1053 if (keyLower.indexOf(eventType) >= 0) {
1054 var argName = keyLower.replace(eventType, '');
1055
1056 if (/^(a[a-z]|so)$/.test(argName)) {
1057 bindArgs[argName] = dataset[key];
1058 }
1059 }
1060 }
1061 }); // 如果是通过triggerEvent触发,并且带有参数
1062
1063 if (event.detail && event.detail.__arguments && event.detail.__arguments.length > 0) {
1064 detailArgs = event.detail.__arguments;
1065 } // 普通的事件(非匿名函数),会直接call
1066
1067
1068 if (!isAnonymousFn) {
1069 if ('so' in bindArgs) {
1070 if (bindArgs['so'] !== 'this') {
1071 callScope = bindArgs['so'];
1072 }
1073
1074 isScopeBinded = true;
1075 delete bindArgs['so'];
1076 }
1077
1078 if (detailArgs.length > 0) {
1079 !isScopeBinded && detailArgs[0] && (callScope = detailArgs[0]);
1080 detailArgs.shift();
1081 }
1082
1083 if (!isEmptyObject(bindArgs)) {
1084 datasetArgs = Object.keys(bindArgs).sort().map(function (key) {
1085 return bindArgs[key];
1086 });
1087 }
1088
1089 realArgs = [].concat(_toConsumableArray(datasetArgs), _toConsumableArray(detailArgs), [event]);
1090 } else {
1091 // 匿名函数,会将scope作为第一个参数
1092 var _scope = null;
1093
1094 if ('so' in bindArgs) {
1095 if (bindArgs['so'] !== 'this') {
1096 _scope = bindArgs['so'];
1097 }
1098
1099 isScopeBinded = true;
1100 delete bindArgs['so'];
1101 }
1102
1103 if (detailArgs.length > 0) {
1104 !isScopeBinded && detailArgs[0] && (callScope = detailArgs[0]);
1105 detailArgs.shift();
1106 }
1107
1108 if (!isEmptyObject(bindArgs)) {
1109 datasetArgs = Object.keys(bindArgs).sort().map(function (key) {
1110 return bindArgs[key];
1111 });
1112 }
1113
1114 realArgs = [_scope].concat(_toConsumableArray(datasetArgs), _toConsumableArray(detailArgs), [event]);
1115 }
1116
1117 return scope[eventHandlerName].apply(callScope, realArgs);
1118 };
1119}
1120
1121function bindEvents(weappComponentConf, events, isPage) {
1122 weappComponentConf.methods = weappComponentConf.methods || {};
1123 var target = isPage ? weappComponentConf : weappComponentConf.methods;
1124 events.forEach(function (name) {
1125 processEvent(name, target);
1126 });
1127}
1128
1129function filterProps() {
1130 var defaultProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1131 var propsFromPropsManager = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1132 var curAllProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1133 var newProps = Object.assign({}, curAllProps, propsFromPropsManager);
1134
1135 if (!isEmptyObject(defaultProps)) {
1136 for (var propName in defaultProps) {
1137 if (newProps[propName] === undefined) {
1138 newProps[propName] = defaultProps[propName];
1139 }
1140 }
1141 }
1142
1143 return newProps;
1144}
1145function componentTrigger(component, key, args) {
1146 args = args || [];
1147
1148 if (key === 'componentDidMount') {
1149 if (component['$$hasLoopRef']) {
1150 Current.current = component;
1151 Current.index = 0;
1152 component._disableEffect = true;
1153
1154 component._createData(component.state, component.props, true);
1155
1156 component._disableEffect = false;
1157 Current.current = null;
1158 }
1159
1160 if (component['$$refs'] && component['$$refs'].length > 0) {
1161 var refs = {};
1162 var refComponents = [];
1163 component['$$refs'].forEach(function (ref) {
1164 refComponents.push(new Promise(function (resolve, reject) {
1165 var query = tt.createSelectorQuery()["in"](component.$scope);
1166
1167 if (ref.type === 'component') {
1168 component.$scope.selectComponent("#".concat(ref.id), function (target) {
1169 resolve({
1170 target: target ? target.$component || target : null,
1171 ref: ref
1172 });
1173 });
1174 } else {
1175 resolve({
1176 target: query.select("#".concat(ref.id)),
1177 ref: ref
1178 });
1179 }
1180 }));
1181 });
1182 Promise.all(refComponents).then(function (targets) {
1183 targets.forEach(function (_ref) {
1184 var ref = _ref.ref,
1185 target = _ref.target;
1186 commitAttachRef(ref, target, component, refs, true);
1187 ref.target = target;
1188 });
1189 component.refs = Object.assign({}, component.refs || {}, refs); // 此处执行componentDidMount
1190
1191 component[key] && typeof component[key] === 'function' && component[key].apply(component, _toConsumableArray(args));
1192 })["catch"](function (err) {
1193 console.error(err);
1194 component[key] && typeof component[key] === 'function' && component[key].apply(component, _toConsumableArray(args));
1195 }); // 此处跳过执行componentDidMount,在refComponents完成后再次执行
1196
1197 return;
1198 }
1199 }
1200
1201 if (key === 'componentWillUnmount') {
1202 var compid = component.$scope.data.compid;
1203 if (compid) propsManager["delete"](compid);
1204 }
1205
1206 component[key] && typeof component[key] === 'function' && component[key].apply(component, _toConsumableArray(args));
1207
1208 if (key === 'componentWillUnmount') {
1209 component._dirty = true;
1210 component._disable = true;
1211 component.$router = {
1212 params: {},
1213 path: ''
1214 };
1215 component._pendingStates = [];
1216 component._pendingCallbacks = []; // refs
1217
1218 detachAllRef(component);
1219 }
1220
1221 if (key === 'componentWillMount') {
1222 component._dirty = false;
1223 component._disable = false;
1224 component.state = component.getState();
1225 }
1226}
1227var hasPageInited = false;
1228
1229function initComponent(ComponentClass, isPage) {
1230 if (!this.$component || this.$component.__isReady) return; // ready之后才可以setData,
1231 // ready之前,小程序组件初始化时仍然会触发observer,__isReady为否的时候放弃处理observer
1232
1233 this.$component.__isReady = true;
1234
1235 if (isPage && !hasPageInited) {
1236 hasPageInited = true;
1237 } // 页面Ready的时候setData更新,此时并未didMount,触发observer但不会触发子组件更新
1238 // 小程序组件ready,但是数据并没有ready,需要通过updateComponent来初始化数据,setData完成之后才是真正意义上的组件ready
1239 // 动态组件执行改造函数副本的时,在初始化数据前计算好props
1240
1241
1242 if (hasPageInited && !isPage) {
1243 var compid = this.data.compid;
1244
1245 if (compid) {
1246 propsManager.observers[compid] = {
1247 component: this.$component,
1248 ComponentClass: ComponentClass
1249 };
1250 }
1251
1252 var nextProps = filterProps(ComponentClass.defaultProps, propsManager.map[compid], this.$component.props);
1253 this.$component.props = nextProps;
1254 }
1255
1256 if (hasPageInited || isPage) {
1257 mountComponent(this.$component);
1258 }
1259}
1260
1261function createComponent(ComponentClass, isPage) {
1262 var initData = {};
1263 var componentProps = filterProps(ComponentClass.defaultProps);
1264 var componentInstance = new ComponentClass(componentProps);
1265 componentInstance._constructor && componentInstance._constructor(componentProps);
1266
1267 try {
1268 Current.current = componentInstance;
1269 Current.index = 0;
1270 componentInstance.state = componentInstance._createData() || componentInstance.state;
1271 } catch (err) {
1272 if (isPage) {
1273 console.warn("[Taro warn] \u8BF7\u7ED9\u9875\u9762\u63D0\u4F9B\u521D\u59CB `state` \u4EE5\u63D0\u9AD8\u521D\u6B21\u6E32\u67D3\u6027\u80FD\uFF01");
1274 } else {
1275 console.warn("[Taro warn] \u8BF7\u7ED9\u7EC4\u4EF6\u63D0\u4F9B\u4E00\u4E2A `defaultProps` \u4EE5\u63D0\u9AD8\u521D\u6B21\u6E32\u67D3\u6027\u80FD\uFF01");
1276 }
1277
1278 console.warn(err);
1279 }
1280
1281 initData = Object.assign({}, initData, componentInstance.props, componentInstance.state);
1282 var weappComponentConf = {
1283 data: initData,
1284 created: function created() {
1285 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1286 isPage && (hasPageInited = false);
1287
1288 if (isPage && cacheDataHas(preloadInitedComponent)) {
1289 this.$component = cacheDataGet(preloadInitedComponent, true);
1290 this.$component.$componentType = 'PAGE';
1291 } else {
1292 this.$component = new ComponentClass({}, isPage);
1293 }
1294
1295 this.$component._init(this);
1296
1297 this.$component.render = this.$component._createData;
1298 this.$component.__propTypes = ComponentClass.propTypes;
1299
1300 if (isPage) {
1301 if (cacheDataHas(PRELOAD_DATA_KEY)) {
1302 var data = cacheDataGet(PRELOAD_DATA_KEY, true);
1303 this.$component.$router.preload = data;
1304 }
1305
1306 Object.assign(this.$component.$router.params, options);
1307
1308 if (cacheDataHas(options[preloadPrivateKey])) {
1309 this.$component.$preloadData = cacheDataGet(options[preloadPrivateKey], true);
1310 } else {
1311 this.$component.$preloadData = {};
1312 }
1313
1314 this.$component.$router.path = getCurrentPageUrl();
1315 initComponent.apply(this, [ComponentClass, isPage]);
1316 }
1317 },
1318 attached: function attached() {
1319 initComponent.apply(this, [ComponentClass, isPage]);
1320 },
1321 ready: function ready() {
1322 if (!this.$component.__mounted) {
1323 this.$component.__mounted = true;
1324 componentTrigger(this.$component, 'componentDidMount');
1325 }
1326 },
1327 detached: function detached() {
1328 var component = this.$component;
1329 componentTrigger(component, 'componentWillUnmount');
1330 component.hooks.forEach(function (hook) {
1331 if (isFunction(hook.cleanup)) {
1332 hook.cleanup();
1333 }
1334 });
1335 var events = component.$$renderPropsEvents;
1336
1337 if (isArray(events)) {
1338 events.forEach(function (e) {
1339 return eventCenter.off(e);
1340 });
1341 }
1342 }
1343 };
1344
1345 if (isPage) {
1346 weappComponentConf['onLoad'] = weappComponentConf['created'];
1347 weappComponentConf['onReady'] = weappComponentConf['ready'];
1348 weappComponentConf['onUnload'] = weappComponentConf['detached'];
1349
1350 weappComponentConf['onShow'] = function () {
1351 componentTrigger(this.$component, 'componentDidShow');
1352 };
1353
1354 weappComponentConf['onHide'] = function () {
1355 componentTrigger(this.$component, 'componentDidHide');
1356 };
1357
1358 pageExtraFns.forEach(function (fn) {
1359 if (componentInstance[fn] && typeof componentInstance[fn] === 'function') {
1360 weappComponentConf[fn] = function () {
1361 var component = this.$component;
1362
1363 if (component && component[fn] && typeof component[fn] === 'function') {
1364 return component[fn].apply(component, arguments);
1365 }
1366 };
1367 }
1368 });
1369 ComponentClass.$$componentPath && cacheDataSet(ComponentClass.$$componentPath, ComponentClass);
1370 }
1371
1372 bindProperties(weappComponentConf, ComponentClass, isPage);
1373 bindBehaviors(weappComponentConf, ComponentClass);
1374 bindStaticFns(weappComponentConf, ComponentClass);
1375 bindStaticOptions(weappComponentConf, ComponentClass);
1376 ComponentClass['$$events'] && bindEvents(weappComponentConf, ComponentClass['$$events'], isPage);
1377
1378 if (ComponentClass['externalClasses'] && ComponentClass['externalClasses'].length) {
1379 weappComponentConf['externalClasses'] = ComponentClass['externalClasses'];
1380 }
1381
1382 return weappComponentConf;
1383}
1384
1385/** @license React v16.13.1
1386 * react-is.production.min.js
1387 *
1388 * Copyright (c) Facebook, Inc. and its affiliates.
1389 *
1390 * This source code is licensed under the MIT license found in the
1391 * LICENSE file in the root directory of this source tree.
1392 */
1393var b = "function" === typeof Symbol && Symbol["for"],
1394 c = b ? Symbol["for"]("react.element") : 60103,
1395 d = b ? Symbol["for"]("react.portal") : 60106,
1396 e = b ? Symbol["for"]("react.fragment") : 60107,
1397 f = b ? Symbol["for"]("react.strict_mode") : 60108,
1398 g = b ? Symbol["for"]("react.profiler") : 60114,
1399 h = b ? Symbol["for"]("react.provider") : 60109,
1400 k = b ? Symbol["for"]("react.context") : 60110,
1401 l = b ? Symbol["for"]("react.async_mode") : 60111,
1402 m = b ? Symbol["for"]("react.concurrent_mode") : 60111,
1403 n = b ? Symbol["for"]("react.forward_ref") : 60112,
1404 p = b ? Symbol["for"]("react.suspense") : 60113,
1405 q = b ? Symbol["for"]("react.suspense_list") : 60120,
1406 r = b ? Symbol["for"]("react.memo") : 60115,
1407 t = b ? Symbol["for"]("react.lazy") : 60116,
1408 v = b ? Symbol["for"]("react.block") : 60121,
1409 w = b ? Symbol["for"]("react.fundamental") : 60117,
1410 x = b ? Symbol["for"]("react.responder") : 60118,
1411 y = b ? Symbol["for"]("react.scope") : 60119;
1412
1413function z(a) {
1414 if ("object" === _typeof(a) && null !== a) {
1415 var u = a.$$typeof;
1416
1417 switch (u) {
1418 case c:
1419 switch (a = a.type, a) {
1420 case l:
1421 case m:
1422 case e:
1423 case g:
1424 case f:
1425 case p:
1426 return a;
1427
1428 default:
1429 switch (a = a && a.$$typeof, a) {
1430 case k:
1431 case n:
1432 case t:
1433 case r:
1434 case h:
1435 return a;
1436
1437 default:
1438 return u;
1439 }
1440
1441 }
1442
1443 case d:
1444 return u;
1445 }
1446 }
1447}
1448
1449function A(a) {
1450 return z(a) === m;
1451}
1452
1453var AsyncMode = l;
1454var ConcurrentMode = m;
1455var ContextConsumer = k;
1456var ContextProvider = h;
1457var Element = c;
1458var ForwardRef = n;
1459var Fragment = e;
1460var Lazy = t;
1461var Memo = r;
1462var Portal = d;
1463var Profiler = g;
1464var StrictMode = f;
1465var Suspense = p;
1466
1467var isAsyncMode = function isAsyncMode(a) {
1468 return A(a) || z(a) === l;
1469};
1470
1471var isConcurrentMode = A;
1472
1473var isContextConsumer = function isContextConsumer(a) {
1474 return z(a) === k;
1475};
1476
1477var isContextProvider = function isContextProvider(a) {
1478 return z(a) === h;
1479};
1480
1481var isElement = function isElement(a) {
1482 return "object" === _typeof(a) && null !== a && a.$$typeof === c;
1483};
1484
1485var isForwardRef = function isForwardRef(a) {
1486 return z(a) === n;
1487};
1488
1489var isFragment = function isFragment(a) {
1490 return z(a) === e;
1491};
1492
1493var isLazy = function isLazy(a) {
1494 return z(a) === t;
1495};
1496
1497var isMemo = function isMemo(a) {
1498 return z(a) === r;
1499};
1500
1501var isPortal = function isPortal(a) {
1502 return z(a) === d;
1503};
1504
1505var isProfiler = function isProfiler(a) {
1506 return z(a) === g;
1507};
1508
1509var isStrictMode = function isStrictMode(a) {
1510 return z(a) === f;
1511};
1512
1513var isSuspense = function isSuspense(a) {
1514 return z(a) === p;
1515};
1516
1517var isValidElementType = function isValidElementType(a) {
1518 return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === _typeof(a) && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
1519};
1520
1521var typeOf = z;
1522var reactIs_production_min = {
1523 AsyncMode: AsyncMode,
1524 ConcurrentMode: ConcurrentMode,
1525 ContextConsumer: ContextConsumer,
1526 ContextProvider: ContextProvider,
1527 Element: Element,
1528 ForwardRef: ForwardRef,
1529 Fragment: Fragment,
1530 Lazy: Lazy,
1531 Memo: Memo,
1532 Portal: Portal,
1533 Profiler: Profiler,
1534 StrictMode: StrictMode,
1535 Suspense: Suspense,
1536 isAsyncMode: isAsyncMode,
1537 isConcurrentMode: isConcurrentMode,
1538 isContextConsumer: isContextConsumer,
1539 isContextProvider: isContextProvider,
1540 isElement: isElement,
1541 isForwardRef: isForwardRef,
1542 isFragment: isFragment,
1543 isLazy: isLazy,
1544 isMemo: isMemo,
1545 isPortal: isPortal,
1546 isProfiler: isProfiler,
1547 isStrictMode: isStrictMode,
1548 isSuspense: isSuspense,
1549 isValidElementType: isValidElementType,
1550 typeOf: typeOf
1551};
1552
1553var reactIs_development = createCommonjsModule(function (module, exports) {
1554
1555 if (process.env.NODE_ENV !== "production") {
1556 (function () {
1557 // nor polyfill, then a plain number is used for performance.
1558
1559 var hasSymbol = typeof Symbol === 'function' && Symbol["for"];
1560 var REACT_ELEMENT_TYPE = hasSymbol ? Symbol["for"]('react.element') : 0xeac7;
1561 var REACT_PORTAL_TYPE = hasSymbol ? Symbol["for"]('react.portal') : 0xeaca;
1562 var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol["for"]('react.fragment') : 0xeacb;
1563 var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol["for"]('react.strict_mode') : 0xeacc;
1564 var REACT_PROFILER_TYPE = hasSymbol ? Symbol["for"]('react.profiler') : 0xead2;
1565 var REACT_PROVIDER_TYPE = hasSymbol ? Symbol["for"]('react.provider') : 0xeacd;
1566 var REACT_CONTEXT_TYPE = hasSymbol ? Symbol["for"]('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
1567 // (unstable) APIs that have been removed. Can we remove the symbols?
1568
1569 var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol["for"]('react.async_mode') : 0xeacf;
1570 var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol["for"]('react.concurrent_mode') : 0xeacf;
1571 var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol["for"]('react.forward_ref') : 0xead0;
1572 var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol["for"]('react.suspense') : 0xead1;
1573 var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol["for"]('react.suspense_list') : 0xead8;
1574 var REACT_MEMO_TYPE = hasSymbol ? Symbol["for"]('react.memo') : 0xead3;
1575 var REACT_LAZY_TYPE = hasSymbol ? Symbol["for"]('react.lazy') : 0xead4;
1576 var REACT_BLOCK_TYPE = hasSymbol ? Symbol["for"]('react.block') : 0xead9;
1577 var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol["for"]('react.fundamental') : 0xead5;
1578 var REACT_RESPONDER_TYPE = hasSymbol ? Symbol["for"]('react.responder') : 0xead6;
1579 var REACT_SCOPE_TYPE = hasSymbol ? Symbol["for"]('react.scope') : 0xead7;
1580
1581 function isValidElementType(type) {
1582 return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1583 type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || _typeof(type) === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
1584 }
1585
1586 function typeOf(object) {
1587 if (_typeof(object) === 'object' && object !== null) {
1588 var $$typeof = object.$$typeof;
1589
1590 switch ($$typeof) {
1591 case REACT_ELEMENT_TYPE:
1592 var type = object.type;
1593
1594 switch (type) {
1595 case REACT_ASYNC_MODE_TYPE:
1596 case REACT_CONCURRENT_MODE_TYPE:
1597 case REACT_FRAGMENT_TYPE:
1598 case REACT_PROFILER_TYPE:
1599 case REACT_STRICT_MODE_TYPE:
1600 case REACT_SUSPENSE_TYPE:
1601 return type;
1602
1603 default:
1604 var $$typeofType = type && type.$$typeof;
1605
1606 switch ($$typeofType) {
1607 case REACT_CONTEXT_TYPE:
1608 case REACT_FORWARD_REF_TYPE:
1609 case REACT_LAZY_TYPE:
1610 case REACT_MEMO_TYPE:
1611 case REACT_PROVIDER_TYPE:
1612 return $$typeofType;
1613
1614 default:
1615 return $$typeof;
1616 }
1617
1618 }
1619
1620 case REACT_PORTAL_TYPE:
1621 return $$typeof;
1622 }
1623 }
1624
1625 return undefined;
1626 } // AsyncMode is deprecated along with isAsyncMode
1627
1628
1629 var AsyncMode = REACT_ASYNC_MODE_TYPE;
1630 var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
1631 var ContextConsumer = REACT_CONTEXT_TYPE;
1632 var ContextProvider = REACT_PROVIDER_TYPE;
1633 var Element = REACT_ELEMENT_TYPE;
1634 var ForwardRef = REACT_FORWARD_REF_TYPE;
1635 var Fragment = REACT_FRAGMENT_TYPE;
1636 var Lazy = REACT_LAZY_TYPE;
1637 var Memo = REACT_MEMO_TYPE;
1638 var Portal = REACT_PORTAL_TYPE;
1639 var Profiler = REACT_PROFILER_TYPE;
1640 var StrictMode = REACT_STRICT_MODE_TYPE;
1641 var Suspense = REACT_SUSPENSE_TYPE;
1642 var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
1643
1644 function isAsyncMode(object) {
1645 {
1646 if (!hasWarnedAboutDeprecatedIsAsyncMode) {
1647 hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
1648
1649 console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
1650 }
1651 }
1652 return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
1653 }
1654
1655 function isConcurrentMode(object) {
1656 return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
1657 }
1658
1659 function isContextConsumer(object) {
1660 return typeOf(object) === REACT_CONTEXT_TYPE;
1661 }
1662
1663 function isContextProvider(object) {
1664 return typeOf(object) === REACT_PROVIDER_TYPE;
1665 }
1666
1667 function isElement(object) {
1668 return _typeof(object) === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1669 }
1670
1671 function isForwardRef(object) {
1672 return typeOf(object) === REACT_FORWARD_REF_TYPE;
1673 }
1674
1675 function isFragment(object) {
1676 return typeOf(object) === REACT_FRAGMENT_TYPE;
1677 }
1678
1679 function isLazy(object) {
1680 return typeOf(object) === REACT_LAZY_TYPE;
1681 }
1682
1683 function isMemo(object) {
1684 return typeOf(object) === REACT_MEMO_TYPE;
1685 }
1686
1687 function isPortal(object) {
1688 return typeOf(object) === REACT_PORTAL_TYPE;
1689 }
1690
1691 function isProfiler(object) {
1692 return typeOf(object) === REACT_PROFILER_TYPE;
1693 }
1694
1695 function isStrictMode(object) {
1696 return typeOf(object) === REACT_STRICT_MODE_TYPE;
1697 }
1698
1699 function isSuspense(object) {
1700 return typeOf(object) === REACT_SUSPENSE_TYPE;
1701 }
1702
1703 exports.AsyncMode = AsyncMode;
1704 exports.ConcurrentMode = ConcurrentMode;
1705 exports.ContextConsumer = ContextConsumer;
1706 exports.ContextProvider = ContextProvider;
1707 exports.Element = Element;
1708 exports.ForwardRef = ForwardRef;
1709 exports.Fragment = Fragment;
1710 exports.Lazy = Lazy;
1711 exports.Memo = Memo;
1712 exports.Portal = Portal;
1713 exports.Profiler = Profiler;
1714 exports.StrictMode = StrictMode;
1715 exports.Suspense = Suspense;
1716 exports.isAsyncMode = isAsyncMode;
1717 exports.isConcurrentMode = isConcurrentMode;
1718 exports.isContextConsumer = isContextConsumer;
1719 exports.isContextProvider = isContextProvider;
1720 exports.isElement = isElement;
1721 exports.isForwardRef = isForwardRef;
1722 exports.isFragment = isFragment;
1723 exports.isLazy = isLazy;
1724 exports.isMemo = isMemo;
1725 exports.isPortal = isPortal;
1726 exports.isProfiler = isProfiler;
1727 exports.isStrictMode = isStrictMode;
1728 exports.isSuspense = isSuspense;
1729 exports.isValidElementType = isValidElementType;
1730 exports.typeOf = typeOf;
1731 })();
1732 }
1733});
1734var reactIs_development_1 = reactIs_development.AsyncMode;
1735var reactIs_development_2 = reactIs_development.ConcurrentMode;
1736var reactIs_development_3 = reactIs_development.ContextConsumer;
1737var reactIs_development_4 = reactIs_development.ContextProvider;
1738var reactIs_development_5 = reactIs_development.Element;
1739var reactIs_development_6 = reactIs_development.ForwardRef;
1740var reactIs_development_7 = reactIs_development.Fragment;
1741var reactIs_development_8 = reactIs_development.Lazy;
1742var reactIs_development_9 = reactIs_development.Memo;
1743var reactIs_development_10 = reactIs_development.Portal;
1744var reactIs_development_11 = reactIs_development.Profiler;
1745var reactIs_development_12 = reactIs_development.StrictMode;
1746var reactIs_development_13 = reactIs_development.Suspense;
1747var reactIs_development_14 = reactIs_development.isAsyncMode;
1748var reactIs_development_15 = reactIs_development.isConcurrentMode;
1749var reactIs_development_16 = reactIs_development.isContextConsumer;
1750var reactIs_development_17 = reactIs_development.isContextProvider;
1751var reactIs_development_18 = reactIs_development.isElement;
1752var reactIs_development_19 = reactIs_development.isForwardRef;
1753var reactIs_development_20 = reactIs_development.isFragment;
1754var reactIs_development_21 = reactIs_development.isLazy;
1755var reactIs_development_22 = reactIs_development.isMemo;
1756var reactIs_development_23 = reactIs_development.isPortal;
1757var reactIs_development_24 = reactIs_development.isProfiler;
1758var reactIs_development_25 = reactIs_development.isStrictMode;
1759var reactIs_development_26 = reactIs_development.isSuspense;
1760var reactIs_development_27 = reactIs_development.isValidElementType;
1761var reactIs_development_28 = reactIs_development.typeOf;
1762
1763var reactIs = createCommonjsModule(function (module) {
1764
1765 if (process.env.NODE_ENV === 'production') {
1766 module.exports = reactIs_production_min;
1767 } else {
1768 module.exports = reactIs_development;
1769 }
1770});
1771
1772/*
1773object-assign
1774(c) Sindre Sorhus
1775@license MIT
1776*/
1777/* eslint-disable no-unused-vars */
1778
1779var getOwnPropertySymbols = Object.getOwnPropertySymbols;
1780var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
1781var propIsEnumerable = Object.prototype.propertyIsEnumerable;
1782
1783function toObject(val) {
1784 if (val === null || val === undefined) {
1785 throw new TypeError('Object.assign cannot be called with null or undefined');
1786 }
1787
1788 return Object(val);
1789}
1790
1791function shouldUseNative() {
1792 try {
1793 if (!Object.assign) {
1794 return false;
1795 } // Detect buggy property enumeration order in older V8 versions.
1796 // https://bugs.chromium.org/p/v8/issues/detail?id=4118
1797
1798
1799 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
1800
1801 test1[5] = 'de';
1802
1803 if (Object.getOwnPropertyNames(test1)[0] === '5') {
1804 return false;
1805 } // https://bugs.chromium.org/p/v8/issues/detail?id=3056
1806
1807
1808 var test2 = {};
1809
1810 for (var i = 0; i < 10; i++) {
1811 test2['_' + String.fromCharCode(i)] = i;
1812 }
1813
1814 var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
1815 return test2[n];
1816 });
1817
1818 if (order2.join('') !== '0123456789') {
1819 return false;
1820 } // https://bugs.chromium.org/p/v8/issues/detail?id=3056
1821
1822
1823 var test3 = {};
1824 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
1825 test3[letter] = letter;
1826 });
1827
1828 if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
1829 return false;
1830 }
1831
1832 return true;
1833 } catch (err) {
1834 // We don't expect any of the above to throw, but better to be safe.
1835 return false;
1836 }
1837}
1838
1839var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
1840 var from;
1841 var to = toObject(target);
1842 var symbols;
1843
1844 for (var s = 1; s < arguments.length; s++) {
1845 from = Object(arguments[s]);
1846
1847 for (var key in from) {
1848 if (hasOwnProperty$2.call(from, key)) {
1849 to[key] = from[key];
1850 }
1851 }
1852
1853 if (getOwnPropertySymbols) {
1854 symbols = getOwnPropertySymbols(from);
1855
1856 for (var i = 0; i < symbols.length; i++) {
1857 if (propIsEnumerable.call(from, symbols[i])) {
1858 to[symbols[i]] = from[symbols[i]];
1859 }
1860 }
1861 }
1862 }
1863
1864 return to;
1865};
1866
1867/**
1868 * Copyright (c) 2013-present, Facebook, Inc.
1869 *
1870 * This source code is licensed under the MIT license found in the
1871 * LICENSE file in the root directory of this source tree.
1872 */
1873
1874var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
1875var ReactPropTypesSecret_1 = ReactPropTypesSecret;
1876
1877var printWarning = function printWarning() {};
1878
1879if (process.env.NODE_ENV !== 'production') {
1880 var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
1881 var loggedTypeFailures = {};
1882 var has = Function.call.bind(Object.prototype.hasOwnProperty);
1883
1884 printWarning = function printWarning(text) {
1885 var message = 'Warning: ' + text;
1886
1887 if (typeof console !== 'undefined') {
1888 console.error(message);
1889 }
1890
1891 try {
1892 // --- Welcome to debugging React ---
1893 // This error was thrown as a convenience so that you can use this stack
1894 // to find the callsite that caused this warning to fire.
1895 throw new Error(message);
1896 } catch (x) {}
1897 };
1898}
1899/**
1900 * Assert that the values match with the type specs.
1901 * Error messages are memorized and will only be shown once.
1902 *
1903 * @param {object} typeSpecs Map of name to a ReactPropType
1904 * @param {object} values Runtime values that need to be type-checked
1905 * @param {string} location e.g. "prop", "context", "child context"
1906 * @param {string} componentName Name of the component for error messages.
1907 * @param {?Function} getStack Returns the component stack.
1908 * @private
1909 */
1910
1911
1912function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
1913 if (process.env.NODE_ENV !== 'production') {
1914 for (var typeSpecName in typeSpecs) {
1915 if (has(typeSpecs, typeSpecName)) {
1916 var error; // Prop type validation may throw. In case they do, we don't want to
1917 // fail the render phase where it didn't fail before. So we log it.
1918 // After these have been cleaned up, we'll let them throw.
1919
1920 try {
1921 // This is intentionally an invariant that gets caught. It's the same
1922 // behavior as without this statement except with a better message.
1923 if (typeof typeSpecs[typeSpecName] !== 'function') {
1924 var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + _typeof(typeSpecs[typeSpecName]) + '`.');
1925 err.name = 'Invariant Violation';
1926 throw err;
1927 }
1928
1929 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
1930 } catch (ex) {
1931 error = ex;
1932 }
1933
1934 if (error && !(error instanceof Error)) {
1935 printWarning((componentName || 'React class') + ': type specification of ' + location + ' `' + typeSpecName + '` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a ' + _typeof(error) + '. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).');
1936 }
1937
1938 if (error instanceof Error && !(error.message in loggedTypeFailures)) {
1939 // Only monitor this failure once because there tends to be a lot of the
1940 // same error.
1941 loggedTypeFailures[error.message] = true;
1942 var stack = getStack ? getStack() : '';
1943 printWarning('Failed ' + location + ' type: ' + error.message + (stack != null ? stack : ''));
1944 }
1945 }
1946 }
1947 }
1948}
1949/**
1950 * Resets warning cache when testing.
1951 *
1952 * @private
1953 */
1954
1955
1956checkPropTypes.resetWarningCache = function () {
1957 if (process.env.NODE_ENV !== 'production') {
1958 loggedTypeFailures = {};
1959 }
1960};
1961
1962var checkPropTypes_1 = checkPropTypes;
1963
1964var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
1965
1966var printWarning$1 = function printWarning() {};
1967
1968if (process.env.NODE_ENV !== 'production') {
1969 printWarning$1 = function printWarning(text) {
1970 var message = 'Warning: ' + text;
1971
1972 if (typeof console !== 'undefined') {
1973 console.error(message);
1974 }
1975
1976 try {
1977 // --- Welcome to debugging React ---
1978 // This error was thrown as a convenience so that you can use this stack
1979 // to find the callsite that caused this warning to fire.
1980 throw new Error(message);
1981 } catch (x) {}
1982 };
1983}
1984
1985function emptyFunctionThatReturnsNull() {
1986 return null;
1987}
1988
1989var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, throwOnDirectAccess) {
1990 /* global Symbol */
1991 var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
1992 var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
1993
1994 /**
1995 * Returns the iterator method function contained on the iterable object.
1996 *
1997 * Be sure to invoke the function with the iterable as context:
1998 *
1999 * var iteratorFn = getIteratorFn(myIterable);
2000 * if (iteratorFn) {
2001 * var iterator = iteratorFn.call(myIterable);
2002 * ...
2003 * }
2004 *
2005 * @param {?object} maybeIterable
2006 * @return {?function}
2007 */
2008
2009 function getIteratorFn(maybeIterable) {
2010 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
2011
2012 if (typeof iteratorFn === 'function') {
2013 return iteratorFn;
2014 }
2015 }
2016 /**
2017 * Collection of methods that allow declaration and validation of props that are
2018 * supplied to React components. Example usage:
2019 *
2020 * var Props = require('ReactPropTypes');
2021 * var MyArticle = React.createClass({
2022 * propTypes: {
2023 * // An optional string prop named "description".
2024 * description: Props.string,
2025 *
2026 * // A required enum prop named "category".
2027 * category: Props.oneOf(['News','Photos']).isRequired,
2028 *
2029 * // A prop named "dialog" that requires an instance of Dialog.
2030 * dialog: Props.instanceOf(Dialog).isRequired
2031 * },
2032 * render: function() { ... }
2033 * });
2034 *
2035 * A more formal specification of how these methods are used:
2036 *
2037 * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
2038 * decl := ReactPropTypes.{type}(.isRequired)?
2039 *
2040 * Each and every declaration produces a function with the same signature. This
2041 * allows the creation of custom validation functions. For example:
2042 *
2043 * var MyLink = React.createClass({
2044 * propTypes: {
2045 * // An optional string or URI prop named "href".
2046 * href: function(props, propName, componentName) {
2047 * var propValue = props[propName];
2048 * if (propValue != null && typeof propValue !== 'string' &&
2049 * !(propValue instanceof URI)) {
2050 * return new Error(
2051 * 'Expected a string or an URI for ' + propName + ' in ' +
2052 * componentName
2053 * );
2054 * }
2055 * }
2056 * },
2057 * render: function() {...}
2058 * });
2059 *
2060 * @internal
2061 */
2062
2063
2064 var ANONYMOUS = '<<anonymous>>'; // Important!
2065 // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
2066
2067 var ReactPropTypes = {
2068 array: createPrimitiveTypeChecker('array'),
2069 bool: createPrimitiveTypeChecker('boolean'),
2070 func: createPrimitiveTypeChecker('function'),
2071 number: createPrimitiveTypeChecker('number'),
2072 object: createPrimitiveTypeChecker('object'),
2073 string: createPrimitiveTypeChecker('string'),
2074 symbol: createPrimitiveTypeChecker('symbol'),
2075 any: createAnyTypeChecker(),
2076 arrayOf: createArrayOfTypeChecker,
2077 element: createElementTypeChecker(),
2078 elementType: createElementTypeTypeChecker(),
2079 instanceOf: createInstanceTypeChecker,
2080 node: createNodeChecker(),
2081 objectOf: createObjectOfTypeChecker,
2082 oneOf: createEnumTypeChecker,
2083 oneOfType: createUnionTypeChecker,
2084 shape: createShapeTypeChecker,
2085 exact: createStrictShapeTypeChecker
2086 };
2087 /**
2088 * inlined Object.is polyfill to avoid requiring consumers ship their own
2089 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
2090 */
2091
2092 /*eslint-disable no-self-compare*/
2093
2094 function is(x, y) {
2095 // SameValue algorithm
2096 if (x === y) {
2097 // Steps 1-5, 7-10
2098 // Steps 6.b-6.e: +0 != -0
2099 return x !== 0 || 1 / x === 1 / y;
2100 } else {
2101 // Step 6.a: NaN == NaN
2102 return x !== x && y !== y;
2103 }
2104 }
2105 /*eslint-enable no-self-compare*/
2106
2107 /**
2108 * We use an Error-like object for backward compatibility as people may call
2109 * PropTypes directly and inspect their output. However, we don't use real
2110 * Errors anymore. We don't inspect their stack anyway, and creating them
2111 * is prohibitively expensive if they are created too often, such as what
2112 * happens in oneOfType() for any type before the one that matched.
2113 */
2114
2115
2116 function PropTypeError(message) {
2117 this.message = message;
2118 this.stack = '';
2119 } // Make `instanceof Error` still work for returned errors.
2120
2121
2122 PropTypeError.prototype = Error.prototype;
2123
2124 function createChainableTypeChecker(validate) {
2125 if (process.env.NODE_ENV !== 'production') {
2126 var manualPropTypeCallCache = {};
2127 var manualPropTypeWarningCount = 0;
2128 }
2129
2130 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
2131 componentName = componentName || ANONYMOUS;
2132 propFullName = propFullName || propName;
2133
2134 if (secret !== ReactPropTypesSecret_1) {
2135 if (throwOnDirectAccess) {
2136 // New behavior only for users of `prop-types` package
2137 var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
2138 err.name = 'Invariant Violation';
2139 throw err;
2140 } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
2141 // Old behavior for people using React.PropTypes
2142 var cacheKey = componentName + ':' + propName;
2143
2144 if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors
2145 manualPropTypeWarningCount < 3) {
2146 printWarning$1('You are manually calling a React.PropTypes validation ' + 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.');
2147 manualPropTypeCallCache[cacheKey] = true;
2148 manualPropTypeWarningCount++;
2149 }
2150 }
2151 }
2152
2153 if (props[propName] == null) {
2154 if (isRequired) {
2155 if (props[propName] === null) {
2156 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
2157 }
2158
2159 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
2160 }
2161
2162 return null;
2163 } else {
2164 return validate(props, propName, componentName, location, propFullName);
2165 }
2166 }
2167
2168 var chainedCheckType = checkType.bind(null, false);
2169 chainedCheckType.isRequired = checkType.bind(null, true);
2170 return chainedCheckType;
2171 }
2172
2173 function createPrimitiveTypeChecker(expectedType) {
2174 function validate(props, propName, componentName, location, propFullName, secret) {
2175 var propValue = props[propName];
2176 var propType = getPropType(propValue);
2177
2178 if (propType !== expectedType) {
2179 // `propValue` being instance of, say, date/regexp, pass the 'object'
2180 // check, but we can offer a more precise error message here rather than
2181 // 'of type `object`'.
2182 var preciseType = getPreciseType(propValue);
2183 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
2184 }
2185
2186 return null;
2187 }
2188
2189 return createChainableTypeChecker(validate);
2190 }
2191
2192 function createAnyTypeChecker() {
2193 return createChainableTypeChecker(emptyFunctionThatReturnsNull);
2194 }
2195
2196 function createArrayOfTypeChecker(typeChecker) {
2197 function validate(props, propName, componentName, location, propFullName) {
2198 if (typeof typeChecker !== 'function') {
2199 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
2200 }
2201
2202 var propValue = props[propName];
2203
2204 if (!Array.isArray(propValue)) {
2205 var propType = getPropType(propValue);
2206 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
2207 }
2208
2209 for (var i = 0; i < propValue.length; i++) {
2210 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
2211
2212 if (error instanceof Error) {
2213 return error;
2214 }
2215 }
2216
2217 return null;
2218 }
2219
2220 return createChainableTypeChecker(validate);
2221 }
2222
2223 function createElementTypeChecker() {
2224 function validate(props, propName, componentName, location, propFullName) {
2225 var propValue = props[propName];
2226
2227 if (!isValidElement(propValue)) {
2228 var propType = getPropType(propValue);
2229 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
2230 }
2231
2232 return null;
2233 }
2234
2235 return createChainableTypeChecker(validate);
2236 }
2237
2238 function createElementTypeTypeChecker() {
2239 function validate(props, propName, componentName, location, propFullName) {
2240 var propValue = props[propName];
2241
2242 if (!reactIs.isValidElementType(propValue)) {
2243 var propType = getPropType(propValue);
2244 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
2245 }
2246
2247 return null;
2248 }
2249
2250 return createChainableTypeChecker(validate);
2251 }
2252
2253 function createInstanceTypeChecker(expectedClass) {
2254 function validate(props, propName, componentName, location, propFullName) {
2255 if (!(props[propName] instanceof expectedClass)) {
2256 var expectedClassName = expectedClass.name || ANONYMOUS;
2257 var actualClassName = getClassName(props[propName]);
2258 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
2259 }
2260
2261 return null;
2262 }
2263
2264 return createChainableTypeChecker(validate);
2265 }
2266
2267 function createEnumTypeChecker(expectedValues) {
2268 if (!Array.isArray(expectedValues)) {
2269 if (process.env.NODE_ENV !== 'production') {
2270 if (arguments.length > 1) {
2271 printWarning$1('Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).');
2272 } else {
2273 printWarning$1('Invalid argument supplied to oneOf, expected an array.');
2274 }
2275 }
2276
2277 return emptyFunctionThatReturnsNull;
2278 }
2279
2280 function validate(props, propName, componentName, location, propFullName) {
2281 var propValue = props[propName];
2282
2283 for (var i = 0; i < expectedValues.length; i++) {
2284 if (is(propValue, expectedValues[i])) {
2285 return null;
2286 }
2287 }
2288
2289 var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
2290 var type = getPreciseType(value);
2291
2292 if (type === 'symbol') {
2293 return String(value);
2294 }
2295
2296 return value;
2297 });
2298 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
2299 }
2300
2301 return createChainableTypeChecker(validate);
2302 }
2303
2304 function createObjectOfTypeChecker(typeChecker) {
2305 function validate(props, propName, componentName, location, propFullName) {
2306 if (typeof typeChecker !== 'function') {
2307 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
2308 }
2309
2310 var propValue = props[propName];
2311 var propType = getPropType(propValue);
2312
2313 if (propType !== 'object') {
2314 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
2315 }
2316
2317 for (var key in propValue) {
2318 if (has$1(propValue, key)) {
2319 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
2320
2321 if (error instanceof Error) {
2322 return error;
2323 }
2324 }
2325 }
2326
2327 return null;
2328 }
2329
2330 return createChainableTypeChecker(validate);
2331 }
2332
2333 function createUnionTypeChecker(arrayOfTypeCheckers) {
2334 if (!Array.isArray(arrayOfTypeCheckers)) {
2335 process.env.NODE_ENV !== 'production' ? printWarning$1('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
2336 return emptyFunctionThatReturnsNull;
2337 }
2338
2339 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
2340 var checker = arrayOfTypeCheckers[i];
2341
2342 if (typeof checker !== 'function') {
2343 printWarning$1('Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.');
2344 return emptyFunctionThatReturnsNull;
2345 }
2346 }
2347
2348 function validate(props, propName, componentName, location, propFullName) {
2349 for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
2350 var checker = arrayOfTypeCheckers[i];
2351
2352 if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
2353 return null;
2354 }
2355 }
2356
2357 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
2358 }
2359
2360 return createChainableTypeChecker(validate);
2361 }
2362
2363 function createNodeChecker() {
2364 function validate(props, propName, componentName, location, propFullName) {
2365 if (!isNode(props[propName])) {
2366 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
2367 }
2368
2369 return null;
2370 }
2371
2372 return createChainableTypeChecker(validate);
2373 }
2374
2375 function createShapeTypeChecker(shapeTypes) {
2376 function validate(props, propName, componentName, location, propFullName) {
2377 var propValue = props[propName];
2378 var propType = getPropType(propValue);
2379
2380 if (propType !== 'object') {
2381 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
2382 }
2383
2384 for (var key in shapeTypes) {
2385 var checker = shapeTypes[key];
2386
2387 if (!checker) {
2388 continue;
2389 }
2390
2391 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
2392
2393 if (error) {
2394 return error;
2395 }
2396 }
2397
2398 return null;
2399 }
2400
2401 return createChainableTypeChecker(validate);
2402 }
2403
2404 function createStrictShapeTypeChecker(shapeTypes) {
2405 function validate(props, propName, componentName, location, propFullName) {
2406 var propValue = props[propName];
2407 var propType = getPropType(propValue);
2408
2409 if (propType !== 'object') {
2410 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
2411 } // We need to check all keys in case some are required but missing from
2412 // props.
2413
2414
2415 var allKeys = objectAssign({}, props[propName], shapeTypes);
2416
2417 for (var key in allKeys) {
2418 var checker = shapeTypes[key];
2419
2420 if (!checker) {
2421 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' '));
2422 }
2423
2424 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
2425
2426 if (error) {
2427 return error;
2428 }
2429 }
2430
2431 return null;
2432 }
2433
2434 return createChainableTypeChecker(validate);
2435 }
2436
2437 function isNode(propValue) {
2438 switch (_typeof(propValue)) {
2439 case 'number':
2440 case 'string':
2441 case 'undefined':
2442 return true;
2443
2444 case 'boolean':
2445 return !propValue;
2446
2447 case 'object':
2448 if (Array.isArray(propValue)) {
2449 return propValue.every(isNode);
2450 }
2451
2452 if (propValue === null || isValidElement(propValue)) {
2453 return true;
2454 }
2455
2456 var iteratorFn = getIteratorFn(propValue);
2457
2458 if (iteratorFn) {
2459 var iterator = iteratorFn.call(propValue);
2460 var step;
2461
2462 if (iteratorFn !== propValue.entries) {
2463 while (!(step = iterator.next()).done) {
2464 if (!isNode(step.value)) {
2465 return false;
2466 }
2467 }
2468 } else {
2469 // Iterator will provide entry [k,v] tuples rather than values.
2470 while (!(step = iterator.next()).done) {
2471 var entry = step.value;
2472
2473 if (entry) {
2474 if (!isNode(entry[1])) {
2475 return false;
2476 }
2477 }
2478 }
2479 }
2480 } else {
2481 return false;
2482 }
2483
2484 return true;
2485
2486 default:
2487 return false;
2488 }
2489 }
2490
2491 function isSymbol(propType, propValue) {
2492 // Native Symbol.
2493 if (propType === 'symbol') {
2494 return true;
2495 } // falsy value can't be a Symbol
2496
2497
2498 if (!propValue) {
2499 return false;
2500 } // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
2501
2502
2503 if (propValue['@@toStringTag'] === 'Symbol') {
2504 return true;
2505 } // Fallback for non-spec compliant Symbols which are polyfilled.
2506
2507
2508 if (typeof Symbol === 'function' && propValue instanceof Symbol) {
2509 return true;
2510 }
2511
2512 return false;
2513 } // Equivalent of `typeof` but with special handling for array and regexp.
2514
2515
2516 function getPropType(propValue) {
2517 var propType = _typeof(propValue);
2518
2519 if (Array.isArray(propValue)) {
2520 return 'array';
2521 }
2522
2523 if (propValue instanceof RegExp) {
2524 // Old webkits (at least until Android 4.0) return 'function' rather than
2525 // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
2526 // passes PropTypes.object.
2527 return 'object';
2528 }
2529
2530 if (isSymbol(propType, propValue)) {
2531 return 'symbol';
2532 }
2533
2534 return propType;
2535 } // This handles more types than `getPropType`. Only used for error messages.
2536 // See `createPrimitiveTypeChecker`.
2537
2538
2539 function getPreciseType(propValue) {
2540 if (typeof propValue === 'undefined' || propValue === null) {
2541 return '' + propValue;
2542 }
2543
2544 var propType = getPropType(propValue);
2545
2546 if (propType === 'object') {
2547 if (propValue instanceof Date) {
2548 return 'date';
2549 } else if (propValue instanceof RegExp) {
2550 return 'regexp';
2551 }
2552 }
2553
2554 return propType;
2555 } // Returns a string that is postfixed to a warning about an invalid type.
2556 // For example, "undefined" or "of type array"
2557
2558
2559 function getPostfixForTypeWarning(value) {
2560 var type = getPreciseType(value);
2561
2562 switch (type) {
2563 case 'array':
2564 case 'object':
2565 return 'an ' + type;
2566
2567 case 'boolean':
2568 case 'date':
2569 case 'regexp':
2570 return 'a ' + type;
2571
2572 default:
2573 return type;
2574 }
2575 } // Returns class name of the object, if any.
2576
2577
2578 function getClassName(propValue) {
2579 if (!propValue.constructor || !propValue.constructor.name) {
2580 return ANONYMOUS;
2581 }
2582
2583 return propValue.constructor.name;
2584 }
2585
2586 ReactPropTypes.checkPropTypes = checkPropTypes_1;
2587 ReactPropTypes.resetWarningCache = checkPropTypes_1.resetWarningCache;
2588 ReactPropTypes.PropTypes = ReactPropTypes;
2589 return ReactPropTypes;
2590};
2591
2592function emptyFunction() {}
2593
2594function emptyFunctionWithReset() {}
2595
2596emptyFunctionWithReset.resetWarningCache = emptyFunction;
2597
2598var factoryWithThrowingShims = function factoryWithThrowingShims() {
2599 function shim(props, propName, componentName, location, propFullName, secret) {
2600 if (secret === ReactPropTypesSecret_1) {
2601 // It is still safe when called from React.
2602 return;
2603 }
2604
2605 var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
2606 err.name = 'Invariant Violation';
2607 throw err;
2608 }
2609 shim.isRequired = shim;
2610
2611 function getShim() {
2612 return shim;
2613 }
2614 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
2615
2616 var ReactPropTypes = {
2617 array: shim,
2618 bool: shim,
2619 func: shim,
2620 number: shim,
2621 object: shim,
2622 string: shim,
2623 symbol: shim,
2624 any: shim,
2625 arrayOf: getShim,
2626 element: shim,
2627 elementType: shim,
2628 instanceOf: getShim,
2629 node: shim,
2630 objectOf: getShim,
2631 oneOf: getShim,
2632 oneOfType: getShim,
2633 shape: getShim,
2634 exact: getShim,
2635 checkPropTypes: emptyFunctionWithReset,
2636 resetWarningCache: emptyFunction
2637 };
2638 ReactPropTypes.PropTypes = ReactPropTypes;
2639 return ReactPropTypes;
2640};
2641
2642var propTypes = createCommonjsModule(function (module) {
2643 /**
2644 * Copyright (c) 2013-present, Facebook, Inc.
2645 *
2646 * This source code is licensed under the MIT license found in the
2647 * LICENSE file in the root directory of this source tree.
2648 */
2649 if (process.env.NODE_ENV !== 'production') {
2650 var ReactIs = reactIs; // By explicitly using `prop-types` you are opting into new development behavior.
2651 // http://fb.me/prop-types-in-prod
2652
2653 var throwOnDirectAccess = true;
2654 module.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
2655 } else {
2656 // By explicitly using `prop-types` you are opting into new production behavior.
2657 // http://fb.me/prop-types-in-prod
2658 module.exports = factoryWithThrowingShims();
2659 }
2660});
2661
2662var isDEV = typeof process === 'undefined' || !process.env || process.env.NODE_ENV !== 'production';
2663
2664function hasNewLifecycle(component) {
2665 var getDerivedStateFromProps = component.constructor.getDerivedStateFromProps,
2666 getSnapshotBeforeUpdate = component.getSnapshotBeforeUpdate;
2667 return isFunction(getDerivedStateFromProps) || isFunction(getSnapshotBeforeUpdate);
2668}
2669
2670function callGetDerivedStateFromProps(component, props, state) {
2671 var getDerivedStateFromProps = component.constructor.getDerivedStateFromProps;
2672 var newState;
2673
2674 if (isFunction(getDerivedStateFromProps)) {
2675 var partialState = getDerivedStateFromProps(props, state);
2676
2677 if (!isUndefined(partialState)) {
2678 newState = Object.assign({}, state, partialState);
2679 } else {
2680 console.warn('getDerivedStateFromProps 没有返回任何内容,这个生命周期必须返回 null 或一个新对象。');
2681 }
2682 }
2683
2684 return newState;
2685}
2686
2687function callGetSnapshotBeforeUpdate(component, props, state) {
2688 var getSnapshotBeforeUpdate = component.getSnapshotBeforeUpdate;
2689 var snapshot;
2690
2691 if (isFunction(getSnapshotBeforeUpdate)) {
2692 snapshot = getSnapshotBeforeUpdate.call(component, props, state);
2693 }
2694
2695 return snapshot;
2696}
2697
2698function updateComponent(component) {
2699 var props = component.props,
2700 __propTypes = component.__propTypes;
2701
2702 if (isDEV && __propTypes) {
2703 var componentName = component.constructor.name;
2704
2705 if (isUndefined(componentName)) {
2706 var names = component.constructor.toString().match(/^function\s*([^\s(]+)/);
2707 componentName = isArray(names) ? names[0] : 'Component';
2708 }
2709
2710 propTypes.checkPropTypes(__propTypes, props, 'prop', componentName);
2711 }
2712
2713 var prevProps = component.prevProps || props;
2714 component.props = prevProps;
2715
2716 if (component.__mounted && component._unsafeCallUpdate === true && !hasNewLifecycle(component) && component.componentWillReceiveProps) {
2717 component._disable = true;
2718 component.componentWillReceiveProps(props);
2719 component._disable = false;
2720 }
2721
2722 var state = component.getState();
2723 var prevState = component.prevState || state;
2724 var stateFromProps = callGetDerivedStateFromProps(component, props, state);
2725
2726 if (!isUndefined(stateFromProps)) {
2727 state = stateFromProps;
2728 }
2729
2730 var skip = false;
2731
2732 if (component.__mounted) {
2733 if (typeof component.shouldComponentUpdate === 'function' && !component._isForceUpdate && component.shouldComponentUpdate(props, state) === false) {
2734 skip = true;
2735 } else if (!hasNewLifecycle(component) && isFunction(component.componentWillUpdate)) {
2736 component.componentWillUpdate(props, state);
2737 }
2738 }
2739
2740 component.props = props;
2741 component.state = state;
2742 component._dirty = false;
2743 component._isForceUpdate = false;
2744
2745 if (!skip) {
2746 doUpdate(component, prevProps, prevState);
2747 }
2748
2749 component.prevProps = component.props;
2750 component.prevState = component.state;
2751}
2752
2753function injectContextType(component) {
2754 var ctxType = component.constructor.contextType;
2755
2756 if (ctxType) {
2757 var context = ctxType.context;
2758 var emitter = context.emitter;
2759
2760 if (emitter === null) {
2761 component.context = context._defaultValue;
2762 return;
2763 }
2764
2765 if (!component._hasContext) {
2766 component._hasContext = true;
2767 emitter.on(function (_) {
2768 return enqueueRender(component);
2769 });
2770 }
2771
2772 component.context = emitter.value;
2773 }
2774}
2775
2776function mountComponent(component) {
2777 var props = component.props; // 在willMount前执行构造函数的副本
2778
2779 if (!component.__componentWillMountTriggered) {
2780 component._constructor && component._constructor(props);
2781 }
2782
2783 var newState = callGetDerivedStateFromProps(component, props, component.state);
2784
2785 if (!isUndefined(newState)) {
2786 component.state = newState;
2787 }
2788
2789 component._dirty = false;
2790 component._disable = false;
2791 component._isForceUpdate = false;
2792
2793 if (!component.__componentWillMountTriggered) {
2794 component.__componentWillMountTriggered = true;
2795
2796 if (!hasNewLifecycle(component)) {
2797 componentTrigger(component, 'componentWillMount');
2798 }
2799 }
2800
2801 doUpdate(component, props, component.state);
2802 component.prevProps = component.props;
2803 component.prevState = component.state;
2804}
2805
2806function doUpdate(component, prevProps, prevState) {
2807 var state = component.state,
2808 _component$props = component.props,
2809 props = _component$props === void 0 ? {} : _component$props;
2810 var data = state || {};
2811
2812 if (component._createData) {
2813 if (component.__isReady) {
2814 injectContextType(component);
2815 Current.current = component;
2816 Current.index = 0;
2817 invokeEffects(component, true);
2818 }
2819
2820 data = component._createData(state, props) || data;
2821
2822 if (component.__isReady) {
2823 Current.current = null;
2824 }
2825 }
2826
2827 data = Object.assign({}, props, data);
2828
2829 if (component.$usedState && component.$usedState.length) {
2830 var _data = {};
2831 component.$usedState.forEach(function (key) {
2832 var val = internal_safe_get(data, key);
2833
2834 if (typeof val === 'undefined') {
2835 return;
2836 }
2837
2838 if (_typeof(val) === 'object') {
2839 if (isEmptyObject(val)) return internal_safe_set(_data, key, val);
2840 val = shakeFnFromObject(val); // 避免筛选完 Fn 后产生了空对象还去渲染
2841
2842 if (!isEmptyObject(val)) internal_safe_set(_data, key, val);
2843 } else {
2844 internal_safe_set(_data, key, val);
2845 }
2846 });
2847 data = _data;
2848 }
2849
2850 data['$taroCompReady'] = true;
2851 var dataDiff = diffObjToPath(data, component.$scope.data);
2852 var __mounted = component.__mounted;
2853 var snapshot;
2854
2855 if (__mounted) {
2856 snapshot = callGetSnapshotBeforeUpdate(component, prevProps, prevState);
2857 } // 每次 setData 都独立生成一个 callback 数组
2858
2859
2860 var cbs = [];
2861
2862 if (component._pendingCallbacks && component._pendingCallbacks.length) {
2863 cbs = component._pendingCallbacks;
2864 component._pendingCallbacks = [];
2865 }
2866
2867 var cb = function cb() {
2868 invokeEffects(component);
2869
2870 if (component.__mounted) {
2871 if (component['$$refs'] && component['$$refs'].length > 0) {
2872 component['$$refs'].forEach(function (ref) {
2873 // 只有 component 类型能做判断。因为 querySelector 每次调用都一定返回 nodeRefs,无法得知 dom 类型的挂载状态。
2874 if (ref.type !== 'component') return;
2875 component.$scope.selectComponent("#".concat(ref.id), function (target) {
2876 target = target ? target.$component || target : null;
2877 var prevRef = ref.target;
2878
2879 if (target !== prevRef) {
2880 commitAttachRef(ref, target, component, component.refs);
2881 ref.target = target;
2882 }
2883 });
2884 });
2885 }
2886
2887 if (component['$$hasLoopRef']) {
2888 Current.current = component;
2889 Current.index = 0;
2890 component._disableEffect = true;
2891
2892 component._createData(component.state, component.props, true);
2893
2894 component._disableEffect = false;
2895 Current.current = null;
2896 }
2897
2898 if (typeof component.componentDidUpdate === 'function') {
2899 component.componentDidUpdate(prevProps, prevState, snapshot);
2900 }
2901 }
2902
2903 if (cbs.length) {
2904 var i = cbs.length;
2905
2906 while (--i >= 0) {
2907 typeof cbs[i] === 'function' && cbs[i].call(component);
2908 }
2909 }
2910 };
2911
2912 if (Object.keys(dataDiff).length === 0) {
2913 cb();
2914 invokeEffects(component);
2915 } else {
2916 component.$scope.setData(dataDiff, cb);
2917 }
2918}
2919
2920var items = [];
2921function enqueueRender(component) {
2922 var isForceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2923 // tslint:disable-next-line:no-conditional-assignment
2924 component._isForceUpdate = isForceUpdate;
2925
2926 if (!component._dirty && (component._dirty = true) && items.push(component) === 1) {
2927 nextTick(function () {
2928 rerender();
2929 });
2930 }
2931}
2932function rerender() {
2933 var p;
2934 var list = items;
2935 items = []; // tslint:disable-next-line:no-conditional-assignment
2936
2937 while (p = list.pop()) {
2938 if (p._dirty) {
2939 updateComponent(p, true);
2940 }
2941 }
2942}
2943
2944// #私有的__componentProps更新用于触发子组件中对应obsever,生命周期componentWillReciveProps,componentShouldUpdate在这里处理
2945// #父组件传过来的props放到data.__props中供模板使用,这么做的目的是模拟reciveProps生命周期
2946// 执行顺序:组件setState -> 组件_createData() -> 对应的小程序组件setData(组件更新)-> 子组件的__componentProps.observer执行
2947// -> 触发子组件componentWillReciveProps,更新子组件props,componentShouldUpdate -> 子组件_createData -> 子组件setData
2948
2949var PRELOAD_DATA_KEY$1 = 'preload';
2950
2951var BaseComponent = /*#__PURE__*/function () {
2952 // _createData的时候生成,小程序中通过data.__createData访问
2953 // this.props,小程序中通过data.__props访问
2954 // 会在componentDidMount后置为true
2955 // hooks
2956 function BaseComponent() {
2957 var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2958 var isPage = arguments.length > 1 ? arguments[1] : undefined;
2959
2960 _classCallCheck(this, BaseComponent);
2961
2962 _defineProperty(this, "__computed", {});
2963
2964 _defineProperty(this, "__props", {});
2965
2966 _defineProperty(this, "__isReady", false);
2967
2968 _defineProperty(this, "__mounted", false);
2969
2970 _defineProperty(this, "nextProps", {});
2971
2972 _defineProperty(this, "_dirty", true);
2973
2974 _defineProperty(this, "_disable", true);
2975
2976 _defineProperty(this, "_isForceUpdate", false);
2977
2978 _defineProperty(this, "_pendingStates", []);
2979
2980 _defineProperty(this, "_pendingCallbacks", []);
2981
2982 _defineProperty(this, "$componentType", '');
2983
2984 _defineProperty(this, "refs", {});
2985
2986 _defineProperty(this, "$router", {
2987 params: {},
2988 path: ''
2989 });
2990
2991 _defineProperty(this, "_afterScheduleEffect", false);
2992
2993 _defineProperty(this, "_disableEffect", false);
2994
2995 _defineProperty(this, "hooks", []);
2996
2997 _defineProperty(this, "effects", []);
2998
2999 _defineProperty(this, "layoutEffects", []);
3000
3001 this.state = {};
3002 this.props = props;
3003 this.$componentType = isPage ? 'PAGE' : 'COMPONENT';
3004 this.$prefix = genCompPrefix();
3005 this.isTaroComponent = this.$componentType && this.$router && this._pendingStates;
3006 }
3007
3008 _createClass(BaseComponent, [{
3009 key: "_constructor",
3010 value: function _constructor(props) {
3011 this.props = props || {};
3012 }
3013 }, {
3014 key: "_init",
3015 value: function _init(scope) {
3016 this.$scope = scope;
3017 }
3018 }, {
3019 key: "setState",
3020 value: function setState(state, callback) {
3021 if (state) {
3022 (this._pendingStates = this._pendingStates || []).push(state);
3023 }
3024
3025 if (typeof callback === 'function') {
3026 (this._pendingCallbacks = this._pendingCallbacks || []).push(callback);
3027 }
3028
3029 if (!this._disable) {
3030 enqueueRender(this, callback === internal_force_update);
3031 }
3032 }
3033 }, {
3034 key: "getState",
3035 value: function getState() {
3036 var _this = this;
3037
3038 var _pendingStates = this._pendingStates,
3039 state = this.state,
3040 props = this.props;
3041 var stateClone = Object.assign({}, state);
3042 delete stateClone.__data;
3043
3044 if (!_pendingStates.length) {
3045 return stateClone;
3046 }
3047
3048 var queue = _pendingStates.concat();
3049
3050 this._pendingStates.length = 0;
3051 queue.forEach(function (nextState) {
3052 if (typeof nextState === 'function') {
3053 nextState = nextState.call(_this, stateClone, props);
3054 }
3055
3056 Object.assign(stateClone, nextState);
3057 });
3058 return stateClone;
3059 }
3060 }, {
3061 key: "forceUpdate",
3062 value: function forceUpdate(callback) {
3063 if (typeof callback === 'function') {
3064 (this._pendingCallbacks = this._pendingCallbacks || []).push(callback);
3065 }
3066
3067 this._isForceUpdate = true;
3068 updateComponent(this);
3069 }
3070 }, {
3071 key: "$preload",
3072 value: function $preload(key, value) {
3073 var preloadData = cacheDataGet(PRELOAD_DATA_KEY$1) || {};
3074
3075 if (_typeof(key) === 'object') {
3076 for (var k in key) {
3077 preloadData[k] = key[k];
3078 }
3079 } else {
3080 preloadData[key] = value;
3081 }
3082
3083 cacheDataSet(PRELOAD_DATA_KEY$1, preloadData);
3084 } // 会被匿名函数调用
3085
3086 }, {
3087 key: "__triggerPropsFn",
3088 value: function __triggerPropsFn(key, args) {
3089 var keyChain = key.split('.');
3090 var reduxFnPrefix = '__event_';
3091 var reduxFnName = reduxFnPrefix + keyChain.shift(); // redux标识过的方法,直接调用
3092
3093 if (reduxFnName in this) {
3094 var scope = args.shift();
3095 var fn;
3096
3097 if (keyChain.length > 0) {
3098 fn = internal_safe_get(this[reduxFnName], keyChain.join('.'));
3099 } else {
3100 fn = this[reduxFnName];
3101 }
3102
3103 fn.apply(scope, args);
3104 } else {
3105 // 普通的
3106 var keyLower = key.toLocaleLowerCase();
3107 var payload = {
3108 __isCustomEvt: true,
3109 __arguments: args
3110 };
3111 var detail = this.$scope.dataset;
3112
3113 if (Object.keys(detail).length) {
3114 payload.__detail = detail;
3115 }
3116
3117 this.$scope.triggerEvent(keyLower, payload);
3118 }
3119 }
3120 }]);
3121
3122 return BaseComponent;
3123}();
3124
3125var PureComponent = /*#__PURE__*/function (_Component) {
3126 _inherits(PureComponent, _Component);
3127
3128 var _super = _createSuper(PureComponent);
3129
3130 function PureComponent() {
3131 var _this;
3132
3133 _classCallCheck(this, PureComponent);
3134
3135 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3136 args[_key] = arguments[_key];
3137 }
3138
3139 _this = _super.call.apply(_super, [this].concat(args));
3140
3141 _defineProperty(_assertThisInitialized(_this), "isPureComponent", true);
3142
3143 return _this;
3144 }
3145
3146 _createClass(PureComponent, [{
3147 key: "shouldComponentUpdate",
3148 value: function shouldComponentUpdate(nextProps, nextState) {
3149 return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
3150 }
3151 }]);
3152
3153 return PureComponent;
3154}(BaseComponent);
3155
3156function createApp(AppClass) {
3157 var app = new AppClass();
3158 var weappAppConf = {
3159 onLaunch: function onLaunch(options) {
3160 app.$app = this;
3161 app.$app.$router = app.$router = {
3162 params: options
3163 };
3164
3165 if (app.componentWillMount) {
3166 app.componentWillMount();
3167 }
3168
3169 if (app.componentDidMount) {
3170 app.componentDidMount();
3171 }
3172 },
3173 onShow: function onShow(options) {
3174 Object.assign(app.$router.params, options);
3175
3176 if (app.componentDidShow) {
3177 app.componentDidShow();
3178 }
3179 },
3180 onHide: function onHide() {
3181 if (app.componentDidHide) {
3182 app.componentDidHide();
3183 }
3184 },
3185 onError: function onError(err) {
3186 if (app.componentDidCatchError) {
3187 app.componentDidCatchError(err);
3188 }
3189 },
3190 onPageNotFound: function onPageNotFound(obj) {
3191 if (app.componentDidNotFound) {
3192 app.componentDidNotFound(obj);
3193 }
3194 }
3195 };
3196 return Object.assign(weappAppConf, app);
3197}
3198
3199var RequestQueue = {
3200 MAX_REQUEST: 5,
3201 queue: [],
3202 pendingQueue: [],
3203 request: function request(options) {
3204 this.queue.push(options);
3205 return this.run();
3206 },
3207 run: function run() {
3208 var _this = this;
3209
3210 if (!this.queue.length) return;
3211
3212 var _loop = function _loop() {
3213 var options = _this.queue.shift();
3214
3215 var successFn = options.success;
3216 var failFn = options.fail;
3217
3218 options.success = function () {
3219 _this.pendingQueue = _this.pendingQueue.filter(function (item) {
3220 return item !== options;
3221 });
3222
3223 _this.run();
3224
3225 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3226 args[_key] = arguments[_key];
3227 }
3228
3229 successFn && successFn.apply(options, args);
3230 };
3231
3232 options.fail = function () {
3233 _this.pendingQueue = _this.pendingQueue.filter(function (item) {
3234 return item !== options;
3235 });
3236
3237 _this.run();
3238
3239 for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
3240 args[_key2] = arguments[_key2];
3241 }
3242
3243 failFn && failFn.apply(options, args);
3244 };
3245
3246 _this.pendingQueue.push(options);
3247
3248 return {
3249 v: tt.request(options)
3250 };
3251 };
3252
3253 while (this.pendingQueue.length < this.MAX_REQUEST) {
3254 var _ret = _loop();
3255
3256 if (_typeof(_ret) === "object") return _ret.v;
3257 }
3258 }
3259};
3260
3261function taroInterceptor(chain) {
3262 return request(chain.requestParams);
3263}
3264
3265var link = new Link(taroInterceptor);
3266
3267function request(options) {
3268 options = options || {};
3269
3270 if (typeof options === 'string') {
3271 options = {
3272 url: options
3273 };
3274 }
3275
3276 var originSuccess = options['success'];
3277 var originFail = options['fail'];
3278 var originComplete = options['complete'];
3279 var requestTask;
3280 var p = new Promise(function (resolve, reject) {
3281 options['success'] = function (res) {
3282 originSuccess && originSuccess(res);
3283 resolve(res);
3284 };
3285
3286 options['fail'] = function (res) {
3287 originFail && originFail(res);
3288 reject(res);
3289 };
3290
3291 options['complete'] = function (res) {
3292 originComplete && originComplete(res);
3293 };
3294
3295 requestTask = RequestQueue.request(options);
3296 });
3297
3298 p.abort = function (cb) {
3299 cb && cb();
3300
3301 if (requestTask) {
3302 requestTask.abort();
3303 }
3304
3305 return p;
3306 };
3307
3308 return p;
3309}
3310
3311function processApis(taro) {
3312 var weApis = Object.assign({}, onAndSyncApis, noPromiseApis, otherApis);
3313 var preloadPrivateKey = '__preload_';
3314 var preloadInitedComponent = '$preloadComponent';
3315 Object.keys(weApis).forEach(function (key) {
3316 if (!(key in tt)) {
3317 taro[key] = function () {
3318 console.warn("\u5934\u6761\u5C0F\u7A0B\u5E8F\u6682\u4E0D\u652F\u6301 ".concat(key));
3319 };
3320
3321 return;
3322 }
3323
3324 if (!onAndSyncApis[key] && !noPromiseApis[key]) {
3325 taro[key] = function (options) {
3326 for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
3327 args[_key3 - 1] = arguments[_key3];
3328 }
3329
3330 options = options || {};
3331 var task = null;
3332 var obj = Object.assign({}, options);
3333
3334 if (typeof options === 'string') {
3335 if (args.length) {
3336 var _tt;
3337
3338 return (_tt = tt)[key].apply(_tt, [options].concat(args));
3339 }
3340
3341 return tt[key](options);
3342 }
3343
3344 if (key === 'navigateTo' || key === 'redirectTo') {
3345 var url = obj['url'] ? obj['url'].replace(/^\//, '') : '';
3346 if (url.indexOf('?') > -1) url = url.split('?')[0];
3347 var Component = cacheDataGet(url);
3348
3349 if (Component) {
3350 var component = new Component();
3351
3352 if (component.componentWillPreload) {
3353 var cacheKey = getUniqueKey();
3354 var MarkIndex = obj.url.indexOf('?');
3355 var hasMark = MarkIndex > -1;
3356 var urlQueryStr = hasMark ? obj.url.substring(MarkIndex + 1, obj.url.length) : '';
3357 var params = queryToJson(urlQueryStr);
3358 obj.url += (hasMark ? '&' : '?') + "".concat(preloadPrivateKey, "=").concat(cacheKey);
3359 cacheDataSet(cacheKey, component.componentWillPreload(params));
3360 cacheDataSet(preloadInitedComponent, component);
3361 }
3362 }
3363 }
3364
3365 var p = new Promise(function (resolve, reject) {
3366 ['fail', 'success', 'complete'].forEach(function (k) {
3367 obj[k] = function (res) {
3368 options[k] && options[k](res);
3369
3370 if (k === 'success') {
3371 if (key === 'connectSocket') {
3372 resolve(Promise.resolve().then(function () {
3373 return Object.assign(task, res);
3374 }));
3375 } else {
3376 resolve(res);
3377 }
3378 } else if (k === 'fail') {
3379 reject(res);
3380 }
3381 };
3382 });
3383
3384 if (args.length) {
3385 var _tt2;
3386
3387 task = (_tt2 = tt)[key].apply(_tt2, [obj].concat(args));
3388 } else {
3389 task = tt[key](obj);
3390 }
3391 });
3392
3393 if (key === 'uploadFile' || key === 'downloadFile') {
3394 p.progress = function (cb) {
3395 if (task) {
3396 task.onProgressUpdate(cb);
3397 }
3398
3399 return p;
3400 };
3401
3402 p.abort = function (cb) {
3403 cb && cb();
3404
3405 if (task) {
3406 task.abort();
3407 }
3408
3409 return p;
3410 };
3411 }
3412
3413 return p;
3414 };
3415 } else {
3416 taro[key] = function () {
3417 for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
3418 args[_key4] = arguments[_key4];
3419 }
3420
3421 var argsLen = args.length;
3422 var newArgs = args.concat();
3423 var lastArg = newArgs[argsLen - 1];
3424
3425 if (lastArg && lastArg.isTaroComponent && lastArg.$scope) {
3426 newArgs.splice(argsLen - 1, 1, lastArg.$scope);
3427 }
3428
3429 return tt[key].apply(tt, newArgs);
3430 };
3431 }
3432 });
3433}
3434
3435function pxTransform(size) {
3436 var _ref = this.config || {},
3437 _ref$designWidth = _ref.designWidth,
3438 designWidth = _ref$designWidth === void 0 ? 750 : _ref$designWidth,
3439 _ref$deviceRatio = _ref.deviceRatio,
3440 deviceRatio = _ref$deviceRatio === void 0 ? {
3441 '640': 2.34 / 2,
3442 '750': 1,
3443 '828': 1.81 / 2
3444 } : _ref$deviceRatio;
3445
3446 if (!(designWidth in deviceRatio)) {
3447 throw new Error("deviceRatio \u914D\u7F6E\u4E2D\u4E0D\u5B58\u5728 ".concat(designWidth, " \u7684\u8BBE\u7F6E\uFF01"));
3448 }
3449
3450 return parseInt(size, 10) / deviceRatio[designWidth] + 'rpx';
3451}
3452
3453function initNativeApi(taro) {
3454 processApis(taro);
3455 taro.request = link.request.bind(link);
3456 taro.addInterceptor = link.addInterceptor.bind(link);
3457 taro.cleanInterceptors = link.cleanInterceptors.bind(link);
3458 taro.getCurrentPages = getCurrentPages;
3459 taro.getApp = getApp;
3460 taro.initPxTransform = initPxTransform.bind(taro);
3461 taro.pxTransform = pxTransform.bind(taro);
3462}
3463
3464/* eslint-disable camelcase */
3465var Taro = {
3466 Component: BaseComponent,
3467 PureComponent: PureComponent,
3468 createApp: createApp,
3469 initNativeApi: initNativeApi,
3470 Events: Events,
3471 eventCenter: eventCenter,
3472 getEnv: getEnv,
3473 createRef: createRef,
3474 render: render,
3475 ENV_TYPE: ENV_TYPE,
3476 internal_safe_get: internal_safe_get,
3477 internal_safe_set: internal_safe_set,
3478 internal_inline_style: internal_inline_style,
3479 createComponent: createComponent,
3480 internal_get_original: internal_get_original,
3481 interceptors: interceptors,
3482 RefsArray: RefsArray,
3483 handleLoopRef: handleLoopRef,
3484 propsManager: propsManager,
3485 genCompid: genCompid,
3486 useEffect: useEffect,
3487 useLayoutEffect: useLayoutEffect,
3488 useReducer: useReducer,
3489 useState: useState,
3490 useDidShow: useDidShow,
3491 useDidHide: useDidHide,
3492 usePullDownRefresh: usePullDownRefresh,
3493 useReachBottom: useReachBottom,
3494 usePageScroll: usePageScroll,
3495 useResize: useResize,
3496 useShareAppMessage: useShareAppMessage,
3497 useTabItemTap: useTabItemTap,
3498 useRouter: useRouter,
3499 useScope: useScope,
3500 useRef: useRef,
3501 useCallback: useCallback,
3502 useMemo: useMemo,
3503 useImperativeHandle: useImperativeHandle,
3504 useContext: useContext,
3505 createContext: createContext,
3506 memo: memo,
3507 shallowEqual: shallowEqual,
3508 setIsUsingDiff: setIsUsingDiff
3509};
3510initNativeApi(Taro);
3511
3512export default Taro;
3513export { Taro };
3514//# sourceMappingURL=index.esm.js.map