@financial-times/n-myft-ui 24.0.1 → 25.0.0-beta.3
Sign up to get free protection for your applications and to get access to all the features.
- package/.circleci/config.yml +18 -18
- package/README.md +51 -0
- package/build-state/npm-shrinkwrap.json +36418 -6805
- package/components/collections/collections.jsx +68 -0
- package/components/collections/collections.test.js +83 -0
- package/components/concept-list/concept-list.jsx +63 -0
- package/components/concept-list/concept-list.test.js +116 -0
- package/components/follow-button/__tests__/follow-button.test.js +3 -3
- package/components/follow-button/follow-button.jsx +3 -3
- package/components/index.js +15 -0
- package/components/pin-button/pin-button.jsx +40 -0
- package/components/pin-button/pin-button.test.js +57 -0
- package/components/save-for-later/save-for-later.jsx +103 -0
- package/components/save-for-later/save-for-later.test.js +59 -0
- package/demos/app.js +2 -4
- package/demos/templates/demo.html +7 -7
- package/demos/templates/demo.jsx +93 -1
- package/dist/bundles/bundle.js +3141 -0
- package/package.json +18 -8
- package/webpack.config.js +34 -0
- package/components/collections/collections.html +0 -77
- package/components/concept-list/concept-list.html +0 -28
- package/components/pin-button/pin-button.html +0 -20
- package/components/save-for-later/save-for-later.html +0 -67
@@ -0,0 +1,3141 @@
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
3
|
+
module.exports = factory();
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
5
|
+
define([], factory);
|
6
|
+
else if(typeof exports === 'object')
|
7
|
+
exports["@financial-times/n-myft-ui"] = factory();
|
8
|
+
else
|
9
|
+
root["@financial-times/n-myft-ui"] = factory();
|
10
|
+
})(typeof self !== 'undefined' ? self : this, function() {
|
11
|
+
return /******/ (function(modules) { // webpackBootstrap
|
12
|
+
/******/ // The module cache
|
13
|
+
/******/ var installedModules = {};
|
14
|
+
/******/
|
15
|
+
/******/ // The require function
|
16
|
+
/******/ function __webpack_require__(moduleId) {
|
17
|
+
/******/
|
18
|
+
/******/ // Check if module is in cache
|
19
|
+
/******/ if(installedModules[moduleId]) {
|
20
|
+
/******/ return installedModules[moduleId].exports;
|
21
|
+
/******/ }
|
22
|
+
/******/ // Create a new module (and put it into the cache)
|
23
|
+
/******/ var module = installedModules[moduleId] = {
|
24
|
+
/******/ i: moduleId,
|
25
|
+
/******/ l: false,
|
26
|
+
/******/ exports: {}
|
27
|
+
/******/ };
|
28
|
+
/******/
|
29
|
+
/******/ // Execute the module function
|
30
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
31
|
+
/******/
|
32
|
+
/******/ // Flag the module as loaded
|
33
|
+
/******/ module.l = true;
|
34
|
+
/******/
|
35
|
+
/******/ // Return the exports of the module
|
36
|
+
/******/ return module.exports;
|
37
|
+
/******/ }
|
38
|
+
/******/
|
39
|
+
/******/
|
40
|
+
/******/ // expose the modules object (__webpack_modules__)
|
41
|
+
/******/ __webpack_require__.m = modules;
|
42
|
+
/******/
|
43
|
+
/******/ // expose the module cache
|
44
|
+
/******/ __webpack_require__.c = installedModules;
|
45
|
+
/******/
|
46
|
+
/******/ // define getter function for harmony exports
|
47
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
48
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
49
|
+
/******/ Object.defineProperty(exports, name, {
|
50
|
+
/******/ configurable: false,
|
51
|
+
/******/ enumerable: true,
|
52
|
+
/******/ get: getter
|
53
|
+
/******/ });
|
54
|
+
/******/ }
|
55
|
+
/******/ };
|
56
|
+
/******/
|
57
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
58
|
+
/******/ __webpack_require__.n = function(module) {
|
59
|
+
/******/ var getter = module && module.__esModule ?
|
60
|
+
/******/ function getDefault() { return module['default']; } :
|
61
|
+
/******/ function getModuleExports() { return module; };
|
62
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
63
|
+
/******/ return getter;
|
64
|
+
/******/ };
|
65
|
+
/******/
|
66
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
67
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
68
|
+
/******/
|
69
|
+
/******/ // __webpack_public_path__
|
70
|
+
/******/ __webpack_require__.p = "";
|
71
|
+
/******/
|
72
|
+
/******/ // Load entry module and return exports
|
73
|
+
/******/ return __webpack_require__(__webpack_require__.s = 4);
|
74
|
+
/******/ })
|
75
|
+
/************************************************************************/
|
76
|
+
/******/ ([
|
77
|
+
/* 0 */
|
78
|
+
/***/ (function(module, exports, __webpack_require__) {
|
79
|
+
|
80
|
+
"use strict";
|
81
|
+
|
82
|
+
|
83
|
+
if (process.env.NODE_ENV === 'production') {
|
84
|
+
module.exports = __webpack_require__(5);
|
85
|
+
} else {
|
86
|
+
module.exports = __webpack_require__(6);
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
/***/ }),
|
91
|
+
/* 1 */
|
92
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
93
|
+
|
94
|
+
"use strict";
|
95
|
+
/* harmony export (immutable) */ __webpack_exports__["a"] = CsrfToken;
|
96
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
|
97
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
|
98
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
function CsrfToken({ cacheablePersonalisedUrl, csrfToken }) {
|
103
|
+
|
104
|
+
let inputProps = {};
|
105
|
+
|
106
|
+
if (cacheablePersonalisedUrl) {
|
107
|
+
inputProps = _extends({}, inputProps, {
|
108
|
+
'data-myft-csrf-token': csrfToken
|
109
|
+
});
|
110
|
+
}
|
111
|
+
|
112
|
+
if (csrfToken) {
|
113
|
+
inputProps.value = csrfToken;
|
114
|
+
}
|
115
|
+
|
116
|
+
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('input', _extends({}, inputProps, {
|
117
|
+
type: 'hidden',
|
118
|
+
name: 'token'
|
119
|
+
}));
|
120
|
+
}
|
121
|
+
|
122
|
+
/***/ }),
|
123
|
+
/* 2 */
|
124
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
125
|
+
|
126
|
+
"use strict";
|
127
|
+
/* harmony export (immutable) */ __webpack_exports__["a"] = FollowButton;
|
128
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
|
129
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
|
130
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__csrf_token_input__ = __webpack_require__(1);
|
131
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
function generateFormProps(props) {
|
137
|
+
let generatedProps = {};
|
138
|
+
|
139
|
+
const {
|
140
|
+
collectionName,
|
141
|
+
followPlusDigestEmail,
|
142
|
+
conceptId,
|
143
|
+
setFollowButtonStateToSelected,
|
144
|
+
cacheablePersonalisedUrl
|
145
|
+
} = props;
|
146
|
+
|
147
|
+
if (collectionName) {
|
148
|
+
generatedProps['data-myft-tracking'] = `collectionName=${collectionName}`;
|
149
|
+
}
|
150
|
+
|
151
|
+
if (followPlusDigestEmail) {
|
152
|
+
generatedProps['action'] = `/__myft/api/core/follow-plus-digest-email/${conceptId}?method=put`;
|
153
|
+
generatedProps['data-myft-ui-variant'] = 'followPlusDigestEmail';
|
154
|
+
} else {
|
155
|
+
if (setFollowButtonStateToSelected && cacheablePersonalisedUrl) {
|
156
|
+
generatedProps['action'] = `/myft/remove/${conceptId}`;
|
157
|
+
generatedProps['data-js-action'] = `/__myft/api/core/followed/concept/${conceptId}?method=delete`;
|
158
|
+
} else {
|
159
|
+
generatedProps['action'] = `/myft/add/${conceptId}`;
|
160
|
+
generatedProps['data-js-action'] = `/__myft/api/core/followed/concept/${conceptId}?method=put`;
|
161
|
+
}
|
162
|
+
}
|
163
|
+
|
164
|
+
return generatedProps;
|
165
|
+
}
|
166
|
+
|
167
|
+
function generateButtonProps(props) {
|
168
|
+
|
169
|
+
const {
|
170
|
+
cacheablePersonalisedUrl,
|
171
|
+
setFollowButtonStateToSelected,
|
172
|
+
name,
|
173
|
+
buttonText,
|
174
|
+
variant,
|
175
|
+
conceptId,
|
176
|
+
alternateText,
|
177
|
+
followPlusDigestEmail
|
178
|
+
} = props;
|
179
|
+
|
180
|
+
let generatedProps = {
|
181
|
+
'data-concept-id': conceptId,
|
182
|
+
'n-myft-follow-button': 'true',
|
183
|
+
'data-trackable': 'follow',
|
184
|
+
type: 'submit'
|
185
|
+
};
|
186
|
+
|
187
|
+
if (cacheablePersonalisedUrl && setFollowButtonStateToSelected) {
|
188
|
+
generatedProps['aria-label'] = `Remove ${name} from myFT`;
|
189
|
+
generatedProps['title'] = `Remove ${name} from myFT`;
|
190
|
+
generatedProps['data-alternate-label'] = `Add ${name} to myFT`;
|
191
|
+
generatedProps['aria-pressed'] = true;
|
192
|
+
|
193
|
+
if (alternateText) {
|
194
|
+
generatedProps['data-alternate-text'] = alternateText;
|
195
|
+
} else {
|
196
|
+
if (buttonText) {
|
197
|
+
generatedProps['data-alternate-text'] = buttonText;
|
198
|
+
} else {
|
199
|
+
generatedProps['data-alternate-text'] = 'Add to myFT';
|
200
|
+
}
|
201
|
+
}
|
202
|
+
} else {
|
203
|
+
generatedProps['aria-pressed'] = false;
|
204
|
+
generatedProps['aria-label'] = `Add ${name} to myFT`;
|
205
|
+
generatedProps['title'] = `Add ${name} to myFT`;
|
206
|
+
generatedProps['data-alternate-label'] = `Remove ${name} from myFT`;
|
207
|
+
if (alternateText) {
|
208
|
+
generatedProps['data-alternate-text'] = alternateText;
|
209
|
+
} else {
|
210
|
+
if (buttonText) {
|
211
|
+
generatedProps['data-alternate-text'] = buttonText;
|
212
|
+
} else {
|
213
|
+
generatedProps['data-alternate-text'] = 'Added';
|
214
|
+
}
|
215
|
+
}
|
216
|
+
}
|
217
|
+
|
218
|
+
if (variant) {
|
219
|
+
generatedProps[`n-myft-follow-button--${variant}`] = 'true';
|
220
|
+
}
|
221
|
+
|
222
|
+
if (followPlusDigestEmail) {
|
223
|
+
generatedProps['data-trackable-context-messaging'] = 'add-to-myft-plus-digest-button';
|
224
|
+
}
|
225
|
+
|
226
|
+
return generatedProps;
|
227
|
+
}
|
228
|
+
|
229
|
+
function getButtonText(props) {
|
230
|
+
|
231
|
+
const {
|
232
|
+
buttonText,
|
233
|
+
setFollowButtonStateToSelected,
|
234
|
+
cacheablePersonalisedUrl
|
235
|
+
} = props;
|
236
|
+
let outputText;
|
237
|
+
|
238
|
+
if (buttonText) {
|
239
|
+
outputText = buttonText;
|
240
|
+
} else {
|
241
|
+
if (setFollowButtonStateToSelected && cacheablePersonalisedUrl) {
|
242
|
+
outputText = 'Added';
|
243
|
+
} else {
|
244
|
+
outputText = 'Add to myFT';
|
245
|
+
}
|
246
|
+
}
|
247
|
+
|
248
|
+
return outputText;
|
249
|
+
}
|
250
|
+
|
251
|
+
/**
|
252
|
+
*
|
253
|
+
* @param {Object} props
|
254
|
+
* @param {string} props.name
|
255
|
+
* @param {Object} props.flags
|
256
|
+
* @param {string} props.extraClasses
|
257
|
+
* @param {string} props.conceptId
|
258
|
+
* @param {string} props.variant
|
259
|
+
* @param {string} props.buttonText
|
260
|
+
* @param {*} props.setFollowButtonStateToSelected
|
261
|
+
* @param {string} props.cacheablePersonalisedUrl
|
262
|
+
* @param {string} props.alternateText
|
263
|
+
* @param {*} props.followPlusDigestEmail
|
264
|
+
* @param {string} props.collectionName
|
265
|
+
*/
|
266
|
+
function FollowButton(props) {
|
267
|
+
|
268
|
+
const {
|
269
|
+
name,
|
270
|
+
flags,
|
271
|
+
extraClasses,
|
272
|
+
conceptId,
|
273
|
+
variant
|
274
|
+
} = props;
|
275
|
+
|
276
|
+
const formProps = generateFormProps(props);
|
277
|
+
const buttonProps = generateButtonProps(props);
|
278
|
+
|
279
|
+
const getVariantClass = variant => variant ? `n-myft-follow-button--${variant}` : '';
|
280
|
+
|
281
|
+
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
282
|
+
__WEBPACK_IMPORTED_MODULE_0_react__["Fragment"],
|
283
|
+
null,
|
284
|
+
flags.myFtApiWrite && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
285
|
+
'form',
|
286
|
+
_extends({
|
287
|
+
className: `n-myft-ui n-myft-ui--follow ${extraClasses || ''}`,
|
288
|
+
method: 'GET',
|
289
|
+
'data-myft-ui': 'follow',
|
290
|
+
'data-concept-id': conceptId
|
291
|
+
}, formProps),
|
292
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_1__csrf_token_input__["a" /* default */], { cacheablePersonalisedUrl: props.cacheablePersonalisedUrl, csrfToken: props.csrfToken }),
|
293
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('div', {
|
294
|
+
className: 'n-myft-ui__announcement o-normalise-visually-hidden',
|
295
|
+
'aria-live': 'assertive',
|
296
|
+
'data-pressed-text': `Now following ${name}.`,
|
297
|
+
'data-unpressed-text': `No longer following ${name}.`
|
298
|
+
}),
|
299
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
300
|
+
'button',
|
301
|
+
_extends({}, buttonProps, {
|
302
|
+
className: [`n-myft-follow-button ${getVariantClass(variant)}`] }),
|
303
|
+
getButtonText(props)
|
304
|
+
)
|
305
|
+
)
|
306
|
+
);
|
307
|
+
}
|
308
|
+
|
309
|
+
/***/ }),
|
310
|
+
/* 3 */
|
311
|
+
/***/ (function(module, exports, __webpack_require__) {
|
312
|
+
|
313
|
+
"use strict";
|
314
|
+
/*
|
315
|
+
object-assign
|
316
|
+
(c) Sindre Sorhus
|
317
|
+
@license MIT
|
318
|
+
*/
|
319
|
+
|
320
|
+
|
321
|
+
/* eslint-disable no-unused-vars */
|
322
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
323
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
324
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
325
|
+
|
326
|
+
function toObject(val) {
|
327
|
+
if (val === null || val === undefined) {
|
328
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
329
|
+
}
|
330
|
+
|
331
|
+
return Object(val);
|
332
|
+
}
|
333
|
+
|
334
|
+
function shouldUseNative() {
|
335
|
+
try {
|
336
|
+
if (!Object.assign) {
|
337
|
+
return false;
|
338
|
+
}
|
339
|
+
|
340
|
+
// Detect buggy property enumeration order in older V8 versions.
|
341
|
+
|
342
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
343
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
344
|
+
test1[5] = 'de';
|
345
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
346
|
+
return false;
|
347
|
+
}
|
348
|
+
|
349
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
350
|
+
var test2 = {};
|
351
|
+
for (var i = 0; i < 10; i++) {
|
352
|
+
test2['_' + String.fromCharCode(i)] = i;
|
353
|
+
}
|
354
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
355
|
+
return test2[n];
|
356
|
+
});
|
357
|
+
if (order2.join('') !== '0123456789') {
|
358
|
+
return false;
|
359
|
+
}
|
360
|
+
|
361
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
362
|
+
var test3 = {};
|
363
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
364
|
+
test3[letter] = letter;
|
365
|
+
});
|
366
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
367
|
+
'abcdefghijklmnopqrst') {
|
368
|
+
return false;
|
369
|
+
}
|
370
|
+
|
371
|
+
return true;
|
372
|
+
} catch (err) {
|
373
|
+
// We don't expect any of the above to throw, but better to be safe.
|
374
|
+
return false;
|
375
|
+
}
|
376
|
+
}
|
377
|
+
|
378
|
+
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
379
|
+
var from;
|
380
|
+
var to = toObject(target);
|
381
|
+
var symbols;
|
382
|
+
|
383
|
+
for (var s = 1; s < arguments.length; s++) {
|
384
|
+
from = Object(arguments[s]);
|
385
|
+
|
386
|
+
for (var key in from) {
|
387
|
+
if (hasOwnProperty.call(from, key)) {
|
388
|
+
to[key] = from[key];
|
389
|
+
}
|
390
|
+
}
|
391
|
+
|
392
|
+
if (getOwnPropertySymbols) {
|
393
|
+
symbols = getOwnPropertySymbols(from);
|
394
|
+
for (var i = 0; i < symbols.length; i++) {
|
395
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
396
|
+
to[symbols[i]] = from[symbols[i]];
|
397
|
+
}
|
398
|
+
}
|
399
|
+
}
|
400
|
+
}
|
401
|
+
|
402
|
+
return to;
|
403
|
+
};
|
404
|
+
|
405
|
+
|
406
|
+
/***/ }),
|
407
|
+
/* 4 */
|
408
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
409
|
+
|
410
|
+
"use strict";
|
411
|
+
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
412
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__csrf_token_input__ = __webpack_require__(1);
|
413
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__follow_button_follow_button__ = __webpack_require__(2);
|
414
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__concept_list_concept_list__ = __webpack_require__(7);
|
415
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__collections_collections__ = __webpack_require__(8);
|
416
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__save_for_later_save_for_later__ = __webpack_require__(9);
|
417
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__pin_button_pin_button__ = __webpack_require__(10);
|
418
|
+
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "CsrfToken", function() { return __WEBPACK_IMPORTED_MODULE_0__csrf_token_input__["a"]; });
|
419
|
+
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "FollowButton", function() { return __WEBPACK_IMPORTED_MODULE_1__follow_button_follow_button__["a"]; });
|
420
|
+
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ConceptList", function() { return __WEBPACK_IMPORTED_MODULE_2__concept_list_concept_list__["a"]; });
|
421
|
+
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Collections", function() { return __WEBPACK_IMPORTED_MODULE_3__collections_collections__["a"]; });
|
422
|
+
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "SaveForLater", function() { return __WEBPACK_IMPORTED_MODULE_4__save_for_later_save_for_later__["a"]; });
|
423
|
+
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "PinButton", function() { return __WEBPACK_IMPORTED_MODULE_5__pin_button_pin_button__["a"]; });
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
/***/ }),
|
434
|
+
/* 5 */
|
435
|
+
/***/ (function(module, exports, __webpack_require__) {
|
436
|
+
|
437
|
+
"use strict";
|
438
|
+
/** @license React v17.0.2
|
439
|
+
* react.production.min.js
|
440
|
+
*
|
441
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
442
|
+
*
|
443
|
+
* This source code is licensed under the MIT license found in the
|
444
|
+
* LICENSE file in the root directory of this source tree.
|
445
|
+
*/
|
446
|
+
var l=__webpack_require__(3),n=60103,p=60106;exports.Fragment=60107;exports.StrictMode=60108;exports.Profiler=60114;var q=60109,r=60110,t=60112;exports.Suspense=60113;var u=60115,v=60116;
|
447
|
+
if("function"===typeof Symbol&&Symbol.for){var w=Symbol.for;n=w("react.element");p=w("react.portal");exports.Fragment=w("react.fragment");exports.StrictMode=w("react.strict_mode");exports.Profiler=w("react.profiler");q=w("react.provider");r=w("react.context");t=w("react.forward_ref");exports.Suspense=w("react.suspense");u=w("react.memo");v=w("react.lazy")}var x="function"===typeof Symbol&&Symbol.iterator;
|
448
|
+
function y(a){if(null===a||"object"!==typeof a)return null;a=x&&a[x]||a["@@iterator"];return"function"===typeof a?a:null}function z(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}
|
449
|
+
var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},B={};function C(a,b,c){this.props=a;this.context=b;this.refs=B;this.updater=c||A}C.prototype.isReactComponent={};C.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error(z(85));this.updater.enqueueSetState(this,a,b,"setState")};C.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};
|
450
|
+
function D(){}D.prototype=C.prototype;function E(a,b,c){this.props=a;this.context=b;this.refs=B;this.updater=c||A}var F=E.prototype=new D;F.constructor=E;l(F,C.prototype);F.isPureReactComponent=!0;var G={current:null},H=Object.prototype.hasOwnProperty,I={key:!0,ref:!0,__self:!0,__source:!0};
|
451
|
+
function J(a,b,c){var e,d={},k=null,h=null;if(null!=b)for(e in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=""+b.key),b)H.call(b,e)&&!I.hasOwnProperty(e)&&(d[e]=b[e]);var g=arguments.length-2;if(1===g)d.children=c;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];d.children=f}if(a&&a.defaultProps)for(e in g=a.defaultProps,g)void 0===d[e]&&(d[e]=g[e]);return{$$typeof:n,type:a,key:k,ref:h,props:d,_owner:G.current}}
|
452
|
+
function K(a,b){return{$$typeof:n,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function L(a){return"object"===typeof a&&null!==a&&a.$$typeof===n}function escape(a){var b={"=":"=0",":":"=2"};return"$"+a.replace(/[=:]/g,function(a){return b[a]})}var M=/\/+/g;function N(a,b){return"object"===typeof a&&null!==a&&null!=a.key?escape(""+a.key):b.toString(36)}
|
453
|
+
function O(a,b,c,e,d){var k=typeof a;if("undefined"===k||"boolean"===k)a=null;var h=!1;if(null===a)h=!0;else switch(k){case "string":case "number":h=!0;break;case "object":switch(a.$$typeof){case n:case p:h=!0}}if(h)return h=a,d=d(h),a=""===e?"."+N(h,0):e,Array.isArray(d)?(c="",null!=a&&(c=a.replace(M,"$&/")+"/"),O(d,b,c,"",function(a){return a})):null!=d&&(L(d)&&(d=K(d,c+(!d.key||h&&h.key===d.key?"":(""+d.key).replace(M,"$&/")+"/")+a)),b.push(d)),1;h=0;e=""===e?".":e+":";if(Array.isArray(a))for(var g=
|
454
|
+
0;g<a.length;g++){k=a[g];var f=e+N(k,g);h+=O(k,b,c,f,d)}else if(f=y(a),"function"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=e+N(k,g++),h+=O(k,b,c,f,d);else if("object"===k)throw b=""+a,Error(z(31,"[object Object]"===b?"object with keys {"+Object.keys(a).join(", ")+"}":b));return h}function P(a,b,c){if(null==a)return a;var e=[],d=0;O(a,e,"","",function(a){return b.call(c,a,d++)});return e}
|
455
|
+
function Q(a){if(-1===a._status){var b=a._result;b=b();a._status=0;a._result=b;b.then(function(b){0===a._status&&(b=b.default,a._status=1,a._result=b)},function(b){0===a._status&&(a._status=2,a._result=b)})}if(1===a._status)return a._result;throw a._result;}var R={current:null};function S(){var a=R.current;if(null===a)throw Error(z(321));return a}var T={ReactCurrentDispatcher:R,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:G,IsSomeRendererActing:{current:!1},assign:l};
|
456
|
+
exports.Children={map:P,forEach:function(a,b,c){P(a,function(){b.apply(this,arguments)},c)},count:function(a){var b=0;P(a,function(){b++});return b},toArray:function(a){return P(a,function(a){return a})||[]},only:function(a){if(!L(a))throw Error(z(143));return a}};exports.Component=C;exports.PureComponent=E;exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T;
|
457
|
+
exports.cloneElement=function(a,b,c){if(null===a||void 0===a)throw Error(z(267,a));var e=l({},a.props),d=a.key,k=a.ref,h=a._owner;if(null!=b){void 0!==b.ref&&(k=b.ref,h=G.current);void 0!==b.key&&(d=""+b.key);if(a.type&&a.type.defaultProps)var g=a.type.defaultProps;for(f in b)H.call(b,f)&&!I.hasOwnProperty(f)&&(e[f]=void 0===b[f]&&void 0!==g?g[f]:b[f])}var f=arguments.length-2;if(1===f)e.children=c;else if(1<f){g=Array(f);for(var m=0;m<f;m++)g[m]=arguments[m+2];e.children=g}return{$$typeof:n,type:a.type,
|
458
|
+
key:d,ref:k,props:e,_owner:h}};exports.createContext=function(a,b){void 0===b&&(b=null);a={$$typeof:r,_calculateChangedBits:b,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null};a.Provider={$$typeof:q,_context:a};return a.Consumer=a};exports.createElement=J;exports.createFactory=function(a){var b=J.bind(null,a);b.type=a;return b};exports.createRef=function(){return{current:null}};exports.forwardRef=function(a){return{$$typeof:t,render:a}};exports.isValidElement=L;
|
459
|
+
exports.lazy=function(a){return{$$typeof:v,_payload:{_status:-1,_result:a},_init:Q}};exports.memo=function(a,b){return{$$typeof:u,type:a,compare:void 0===b?null:b}};exports.useCallback=function(a,b){return S().useCallback(a,b)};exports.useContext=function(a,b){return S().useContext(a,b)};exports.useDebugValue=function(){};exports.useEffect=function(a,b){return S().useEffect(a,b)};exports.useImperativeHandle=function(a,b,c){return S().useImperativeHandle(a,b,c)};
|
460
|
+
exports.useLayoutEffect=function(a,b){return S().useLayoutEffect(a,b)};exports.useMemo=function(a,b){return S().useMemo(a,b)};exports.useReducer=function(a,b,c){return S().useReducer(a,b,c)};exports.useRef=function(a){return S().useRef(a)};exports.useState=function(a){return S().useState(a)};exports.version="17.0.2";
|
461
|
+
|
462
|
+
|
463
|
+
/***/ }),
|
464
|
+
/* 6 */
|
465
|
+
/***/ (function(module, exports, __webpack_require__) {
|
466
|
+
|
467
|
+
"use strict";
|
468
|
+
/** @license React v17.0.2
|
469
|
+
* react.development.js
|
470
|
+
*
|
471
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
472
|
+
*
|
473
|
+
* This source code is licensed under the MIT license found in the
|
474
|
+
* LICENSE file in the root directory of this source tree.
|
475
|
+
*/
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
if (process.env.NODE_ENV !== "production") {
|
480
|
+
(function() {
|
481
|
+
'use strict';
|
482
|
+
|
483
|
+
var _assign = __webpack_require__(3);
|
484
|
+
|
485
|
+
// TODO: this is special because it gets imported during build.
|
486
|
+
var ReactVersion = '17.0.2';
|
487
|
+
|
488
|
+
// ATTENTION
|
489
|
+
// When adding new symbols to this file,
|
490
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
491
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
492
|
+
// nor polyfill, then a plain number is used for performance.
|
493
|
+
var REACT_ELEMENT_TYPE = 0xeac7;
|
494
|
+
var REACT_PORTAL_TYPE = 0xeaca;
|
495
|
+
exports.Fragment = 0xeacb;
|
496
|
+
exports.StrictMode = 0xeacc;
|
497
|
+
exports.Profiler = 0xead2;
|
498
|
+
var REACT_PROVIDER_TYPE = 0xeacd;
|
499
|
+
var REACT_CONTEXT_TYPE = 0xeace;
|
500
|
+
var REACT_FORWARD_REF_TYPE = 0xead0;
|
501
|
+
exports.Suspense = 0xead1;
|
502
|
+
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
|
503
|
+
var REACT_MEMO_TYPE = 0xead3;
|
504
|
+
var REACT_LAZY_TYPE = 0xead4;
|
505
|
+
var REACT_BLOCK_TYPE = 0xead9;
|
506
|
+
var REACT_SERVER_BLOCK_TYPE = 0xeada;
|
507
|
+
var REACT_FUNDAMENTAL_TYPE = 0xead5;
|
508
|
+
var REACT_SCOPE_TYPE = 0xead7;
|
509
|
+
var REACT_OPAQUE_ID_TYPE = 0xeae0;
|
510
|
+
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
|
511
|
+
var REACT_OFFSCREEN_TYPE = 0xeae2;
|
512
|
+
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
|
513
|
+
|
514
|
+
if (typeof Symbol === 'function' && Symbol.for) {
|
515
|
+
var symbolFor = Symbol.for;
|
516
|
+
REACT_ELEMENT_TYPE = symbolFor('react.element');
|
517
|
+
REACT_PORTAL_TYPE = symbolFor('react.portal');
|
518
|
+
exports.Fragment = symbolFor('react.fragment');
|
519
|
+
exports.StrictMode = symbolFor('react.strict_mode');
|
520
|
+
exports.Profiler = symbolFor('react.profiler');
|
521
|
+
REACT_PROVIDER_TYPE = symbolFor('react.provider');
|
522
|
+
REACT_CONTEXT_TYPE = symbolFor('react.context');
|
523
|
+
REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
|
524
|
+
exports.Suspense = symbolFor('react.suspense');
|
525
|
+
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
|
526
|
+
REACT_MEMO_TYPE = symbolFor('react.memo');
|
527
|
+
REACT_LAZY_TYPE = symbolFor('react.lazy');
|
528
|
+
REACT_BLOCK_TYPE = symbolFor('react.block');
|
529
|
+
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
|
530
|
+
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
|
531
|
+
REACT_SCOPE_TYPE = symbolFor('react.scope');
|
532
|
+
REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
|
533
|
+
REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
|
534
|
+
REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
|
535
|
+
REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
|
536
|
+
}
|
537
|
+
|
538
|
+
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
539
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
540
|
+
function getIteratorFn(maybeIterable) {
|
541
|
+
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
542
|
+
return null;
|
543
|
+
}
|
544
|
+
|
545
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
546
|
+
|
547
|
+
if (typeof maybeIterator === 'function') {
|
548
|
+
return maybeIterator;
|
549
|
+
}
|
550
|
+
|
551
|
+
return null;
|
552
|
+
}
|
553
|
+
|
554
|
+
/**
|
555
|
+
* Keeps track of the current dispatcher.
|
556
|
+
*/
|
557
|
+
var ReactCurrentDispatcher = {
|
558
|
+
/**
|
559
|
+
* @internal
|
560
|
+
* @type {ReactComponent}
|
561
|
+
*/
|
562
|
+
current: null
|
563
|
+
};
|
564
|
+
|
565
|
+
/**
|
566
|
+
* Keeps track of the current batch's configuration such as how long an update
|
567
|
+
* should suspend for if it needs to.
|
568
|
+
*/
|
569
|
+
var ReactCurrentBatchConfig = {
|
570
|
+
transition: 0
|
571
|
+
};
|
572
|
+
|
573
|
+
/**
|
574
|
+
* Keeps track of the current owner.
|
575
|
+
*
|
576
|
+
* The current owner is the component who should own any components that are
|
577
|
+
* currently being constructed.
|
578
|
+
*/
|
579
|
+
var ReactCurrentOwner = {
|
580
|
+
/**
|
581
|
+
* @internal
|
582
|
+
* @type {ReactComponent}
|
583
|
+
*/
|
584
|
+
current: null
|
585
|
+
};
|
586
|
+
|
587
|
+
var ReactDebugCurrentFrame = {};
|
588
|
+
var currentExtraStackFrame = null;
|
589
|
+
function setExtraStackFrame(stack) {
|
590
|
+
{
|
591
|
+
currentExtraStackFrame = stack;
|
592
|
+
}
|
593
|
+
}
|
594
|
+
|
595
|
+
{
|
596
|
+
ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
|
597
|
+
{
|
598
|
+
currentExtraStackFrame = stack;
|
599
|
+
}
|
600
|
+
}; // Stack implementation injected by the current renderer.
|
601
|
+
|
602
|
+
|
603
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
604
|
+
|
605
|
+
ReactDebugCurrentFrame.getStackAddendum = function () {
|
606
|
+
var stack = ''; // Add an extra top frame while an element is being validated
|
607
|
+
|
608
|
+
if (currentExtraStackFrame) {
|
609
|
+
stack += currentExtraStackFrame;
|
610
|
+
} // Delegate to the injected renderer-specific implementation
|
611
|
+
|
612
|
+
|
613
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
614
|
+
|
615
|
+
if (impl) {
|
616
|
+
stack += impl() || '';
|
617
|
+
}
|
618
|
+
|
619
|
+
return stack;
|
620
|
+
};
|
621
|
+
}
|
622
|
+
|
623
|
+
/**
|
624
|
+
* Used by act() to track whether you're inside an act() scope.
|
625
|
+
*/
|
626
|
+
var IsSomeRendererActing = {
|
627
|
+
current: false
|
628
|
+
};
|
629
|
+
|
630
|
+
var ReactSharedInternals = {
|
631
|
+
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
632
|
+
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
633
|
+
ReactCurrentOwner: ReactCurrentOwner,
|
634
|
+
IsSomeRendererActing: IsSomeRendererActing,
|
635
|
+
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
636
|
+
assign: _assign
|
637
|
+
};
|
638
|
+
|
639
|
+
{
|
640
|
+
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
|
641
|
+
}
|
642
|
+
|
643
|
+
// by calls to these methods by a Babel plugin.
|
644
|
+
//
|
645
|
+
// In PROD (or in packages without access to React internals),
|
646
|
+
// they are left as they are instead.
|
647
|
+
|
648
|
+
function warn(format) {
|
649
|
+
{
|
650
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
651
|
+
args[_key - 1] = arguments[_key];
|
652
|
+
}
|
653
|
+
|
654
|
+
printWarning('warn', format, args);
|
655
|
+
}
|
656
|
+
}
|
657
|
+
function error(format) {
|
658
|
+
{
|
659
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
660
|
+
args[_key2 - 1] = arguments[_key2];
|
661
|
+
}
|
662
|
+
|
663
|
+
printWarning('error', format, args);
|
664
|
+
}
|
665
|
+
}
|
666
|
+
|
667
|
+
function printWarning(level, format, args) {
|
668
|
+
// When changing this logic, you might want to also
|
669
|
+
// update consoleWithStackDev.www.js as well.
|
670
|
+
{
|
671
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
672
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
673
|
+
|
674
|
+
if (stack !== '') {
|
675
|
+
format += '%s';
|
676
|
+
args = args.concat([stack]);
|
677
|
+
}
|
678
|
+
|
679
|
+
var argsWithFormat = args.map(function (item) {
|
680
|
+
return '' + item;
|
681
|
+
}); // Careful: RN currently depends on this prefix
|
682
|
+
|
683
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
684
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
685
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
686
|
+
|
687
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
688
|
+
}
|
689
|
+
}
|
690
|
+
|
691
|
+
var didWarnStateUpdateForUnmountedComponent = {};
|
692
|
+
|
693
|
+
function warnNoop(publicInstance, callerName) {
|
694
|
+
{
|
695
|
+
var _constructor = publicInstance.constructor;
|
696
|
+
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
697
|
+
var warningKey = componentName + "." + callerName;
|
698
|
+
|
699
|
+
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
700
|
+
return;
|
701
|
+
}
|
702
|
+
|
703
|
+
error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
|
704
|
+
|
705
|
+
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
706
|
+
}
|
707
|
+
}
|
708
|
+
/**
|
709
|
+
* This is the abstract API for an update queue.
|
710
|
+
*/
|
711
|
+
|
712
|
+
|
713
|
+
var ReactNoopUpdateQueue = {
|
714
|
+
/**
|
715
|
+
* Checks whether or not this composite component is mounted.
|
716
|
+
* @param {ReactClass} publicInstance The instance we want to test.
|
717
|
+
* @return {boolean} True if mounted, false otherwise.
|
718
|
+
* @protected
|
719
|
+
* @final
|
720
|
+
*/
|
721
|
+
isMounted: function (publicInstance) {
|
722
|
+
return false;
|
723
|
+
},
|
724
|
+
|
725
|
+
/**
|
726
|
+
* Forces an update. This should only be invoked when it is known with
|
727
|
+
* certainty that we are **not** in a DOM transaction.
|
728
|
+
*
|
729
|
+
* You may want to call this when you know that some deeper aspect of the
|
730
|
+
* component's state has changed but `setState` was not called.
|
731
|
+
*
|
732
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
733
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
734
|
+
*
|
735
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
736
|
+
* @param {?function} callback Called after component is updated.
|
737
|
+
* @param {?string} callerName name of the calling function in the public API.
|
738
|
+
* @internal
|
739
|
+
*/
|
740
|
+
enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
741
|
+
warnNoop(publicInstance, 'forceUpdate');
|
742
|
+
},
|
743
|
+
|
744
|
+
/**
|
745
|
+
* Replaces all of the state. Always use this or `setState` to mutate state.
|
746
|
+
* You should treat `this.state` as immutable.
|
747
|
+
*
|
748
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
749
|
+
* accessing `this.state` after calling this method may return the old value.
|
750
|
+
*
|
751
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
752
|
+
* @param {object} completeState Next state.
|
753
|
+
* @param {?function} callback Called after component is updated.
|
754
|
+
* @param {?string} callerName name of the calling function in the public API.
|
755
|
+
* @internal
|
756
|
+
*/
|
757
|
+
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
758
|
+
warnNoop(publicInstance, 'replaceState');
|
759
|
+
},
|
760
|
+
|
761
|
+
/**
|
762
|
+
* Sets a subset of the state. This only exists because _pendingState is
|
763
|
+
* internal. This provides a merging strategy that is not available to deep
|
764
|
+
* properties which is confusing. TODO: Expose pendingState or don't use it
|
765
|
+
* during the merge.
|
766
|
+
*
|
767
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
768
|
+
* @param {object} partialState Next partial state to be merged with state.
|
769
|
+
* @param {?function} callback Called after component is updated.
|
770
|
+
* @param {?string} Name of the calling function in the public API.
|
771
|
+
* @internal
|
772
|
+
*/
|
773
|
+
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
774
|
+
warnNoop(publicInstance, 'setState');
|
775
|
+
}
|
776
|
+
};
|
777
|
+
|
778
|
+
var emptyObject = {};
|
779
|
+
|
780
|
+
{
|
781
|
+
Object.freeze(emptyObject);
|
782
|
+
}
|
783
|
+
/**
|
784
|
+
* Base class helpers for the updating state of a component.
|
785
|
+
*/
|
786
|
+
|
787
|
+
|
788
|
+
function Component(props, context, updater) {
|
789
|
+
this.props = props;
|
790
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
791
|
+
|
792
|
+
this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
|
793
|
+
// renderer.
|
794
|
+
|
795
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
796
|
+
}
|
797
|
+
|
798
|
+
Component.prototype.isReactComponent = {};
|
799
|
+
/**
|
800
|
+
* Sets a subset of the state. Always use this to mutate
|
801
|
+
* state. You should treat `this.state` as immutable.
|
802
|
+
*
|
803
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
804
|
+
* accessing `this.state` after calling this method may return the old value.
|
805
|
+
*
|
806
|
+
* There is no guarantee that calls to `setState` will run synchronously,
|
807
|
+
* as they may eventually be batched together. You can provide an optional
|
808
|
+
* callback that will be executed when the call to setState is actually
|
809
|
+
* completed.
|
810
|
+
*
|
811
|
+
* When a function is provided to setState, it will be called at some point in
|
812
|
+
* the future (not synchronously). It will be called with the up to date
|
813
|
+
* component arguments (state, props, context). These values can be different
|
814
|
+
* from this.* because your function may be called after receiveProps but before
|
815
|
+
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
816
|
+
* assigned to this.
|
817
|
+
*
|
818
|
+
* @param {object|function} partialState Next partial state or function to
|
819
|
+
* produce next partial state to be merged with current state.
|
820
|
+
* @param {?function} callback Called after state is updated.
|
821
|
+
* @final
|
822
|
+
* @protected
|
823
|
+
*/
|
824
|
+
|
825
|
+
Component.prototype.setState = function (partialState, callback) {
|
826
|
+
if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
|
827
|
+
{
|
828
|
+
throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." );
|
829
|
+
}
|
830
|
+
}
|
831
|
+
|
832
|
+
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
833
|
+
};
|
834
|
+
/**
|
835
|
+
* Forces an update. This should only be invoked when it is known with
|
836
|
+
* certainty that we are **not** in a DOM transaction.
|
837
|
+
*
|
838
|
+
* You may want to call this when you know that some deeper aspect of the
|
839
|
+
* component's state has changed but `setState` was not called.
|
840
|
+
*
|
841
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
842
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
843
|
+
*
|
844
|
+
* @param {?function} callback Called after update is complete.
|
845
|
+
* @final
|
846
|
+
* @protected
|
847
|
+
*/
|
848
|
+
|
849
|
+
|
850
|
+
Component.prototype.forceUpdate = function (callback) {
|
851
|
+
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
852
|
+
};
|
853
|
+
/**
|
854
|
+
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
855
|
+
* we would like to deprecate them, we're not going to move them over to this
|
856
|
+
* modern base class. Instead, we define a getter that warns if it's accessed.
|
857
|
+
*/
|
858
|
+
|
859
|
+
|
860
|
+
{
|
861
|
+
var deprecatedAPIs = {
|
862
|
+
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
863
|
+
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
864
|
+
};
|
865
|
+
|
866
|
+
var defineDeprecationWarning = function (methodName, info) {
|
867
|
+
Object.defineProperty(Component.prototype, methodName, {
|
868
|
+
get: function () {
|
869
|
+
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
870
|
+
|
871
|
+
return undefined;
|
872
|
+
}
|
873
|
+
});
|
874
|
+
};
|
875
|
+
|
876
|
+
for (var fnName in deprecatedAPIs) {
|
877
|
+
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
878
|
+
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
879
|
+
}
|
880
|
+
}
|
881
|
+
}
|
882
|
+
|
883
|
+
function ComponentDummy() {}
|
884
|
+
|
885
|
+
ComponentDummy.prototype = Component.prototype;
|
886
|
+
/**
|
887
|
+
* Convenience component with default shallow equality check for sCU.
|
888
|
+
*/
|
889
|
+
|
890
|
+
function PureComponent(props, context, updater) {
|
891
|
+
this.props = props;
|
892
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
893
|
+
|
894
|
+
this.refs = emptyObject;
|
895
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
896
|
+
}
|
897
|
+
|
898
|
+
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
899
|
+
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
|
900
|
+
|
901
|
+
_assign(pureComponentPrototype, Component.prototype);
|
902
|
+
|
903
|
+
pureComponentPrototype.isPureReactComponent = true;
|
904
|
+
|
905
|
+
// an immutable object with a single mutable value
|
906
|
+
function createRef() {
|
907
|
+
var refObject = {
|
908
|
+
current: null
|
909
|
+
};
|
910
|
+
|
911
|
+
{
|
912
|
+
Object.seal(refObject);
|
913
|
+
}
|
914
|
+
|
915
|
+
return refObject;
|
916
|
+
}
|
917
|
+
|
918
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
919
|
+
var functionName = innerType.displayName || innerType.name || '';
|
920
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
921
|
+
}
|
922
|
+
|
923
|
+
function getContextName(type) {
|
924
|
+
return type.displayName || 'Context';
|
925
|
+
}
|
926
|
+
|
927
|
+
function getComponentName(type) {
|
928
|
+
if (type == null) {
|
929
|
+
// Host root, text node or just invalid type.
|
930
|
+
return null;
|
931
|
+
}
|
932
|
+
|
933
|
+
{
|
934
|
+
if (typeof type.tag === 'number') {
|
935
|
+
error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
936
|
+
}
|
937
|
+
}
|
938
|
+
|
939
|
+
if (typeof type === 'function') {
|
940
|
+
return type.displayName || type.name || null;
|
941
|
+
}
|
942
|
+
|
943
|
+
if (typeof type === 'string') {
|
944
|
+
return type;
|
945
|
+
}
|
946
|
+
|
947
|
+
switch (type) {
|
948
|
+
case exports.Fragment:
|
949
|
+
return 'Fragment';
|
950
|
+
|
951
|
+
case REACT_PORTAL_TYPE:
|
952
|
+
return 'Portal';
|
953
|
+
|
954
|
+
case exports.Profiler:
|
955
|
+
return 'Profiler';
|
956
|
+
|
957
|
+
case exports.StrictMode:
|
958
|
+
return 'StrictMode';
|
959
|
+
|
960
|
+
case exports.Suspense:
|
961
|
+
return 'Suspense';
|
962
|
+
|
963
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
964
|
+
return 'SuspenseList';
|
965
|
+
}
|
966
|
+
|
967
|
+
if (typeof type === 'object') {
|
968
|
+
switch (type.$$typeof) {
|
969
|
+
case REACT_CONTEXT_TYPE:
|
970
|
+
var context = type;
|
971
|
+
return getContextName(context) + '.Consumer';
|
972
|
+
|
973
|
+
case REACT_PROVIDER_TYPE:
|
974
|
+
var provider = type;
|
975
|
+
return getContextName(provider._context) + '.Provider';
|
976
|
+
|
977
|
+
case REACT_FORWARD_REF_TYPE:
|
978
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
979
|
+
|
980
|
+
case REACT_MEMO_TYPE:
|
981
|
+
return getComponentName(type.type);
|
982
|
+
|
983
|
+
case REACT_BLOCK_TYPE:
|
984
|
+
return getComponentName(type._render);
|
985
|
+
|
986
|
+
case REACT_LAZY_TYPE:
|
987
|
+
{
|
988
|
+
var lazyComponent = type;
|
989
|
+
var payload = lazyComponent._payload;
|
990
|
+
var init = lazyComponent._init;
|
991
|
+
|
992
|
+
try {
|
993
|
+
return getComponentName(init(payload));
|
994
|
+
} catch (x) {
|
995
|
+
return null;
|
996
|
+
}
|
997
|
+
}
|
998
|
+
}
|
999
|
+
}
|
1000
|
+
|
1001
|
+
return null;
|
1002
|
+
}
|
1003
|
+
|
1004
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
1005
|
+
var RESERVED_PROPS = {
|
1006
|
+
key: true,
|
1007
|
+
ref: true,
|
1008
|
+
__self: true,
|
1009
|
+
__source: true
|
1010
|
+
};
|
1011
|
+
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
1012
|
+
|
1013
|
+
{
|
1014
|
+
didWarnAboutStringRefs = {};
|
1015
|
+
}
|
1016
|
+
|
1017
|
+
function hasValidRef(config) {
|
1018
|
+
{
|
1019
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
1020
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
1021
|
+
|
1022
|
+
if (getter && getter.isReactWarning) {
|
1023
|
+
return false;
|
1024
|
+
}
|
1025
|
+
}
|
1026
|
+
}
|
1027
|
+
|
1028
|
+
return config.ref !== undefined;
|
1029
|
+
}
|
1030
|
+
|
1031
|
+
function hasValidKey(config) {
|
1032
|
+
{
|
1033
|
+
if (hasOwnProperty.call(config, 'key')) {
|
1034
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
1035
|
+
|
1036
|
+
if (getter && getter.isReactWarning) {
|
1037
|
+
return false;
|
1038
|
+
}
|
1039
|
+
}
|
1040
|
+
}
|
1041
|
+
|
1042
|
+
return config.key !== undefined;
|
1043
|
+
}
|
1044
|
+
|
1045
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
1046
|
+
var warnAboutAccessingKey = function () {
|
1047
|
+
{
|
1048
|
+
if (!specialPropKeyWarningShown) {
|
1049
|
+
specialPropKeyWarningShown = true;
|
1050
|
+
|
1051
|
+
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
1052
|
+
}
|
1053
|
+
}
|
1054
|
+
};
|
1055
|
+
|
1056
|
+
warnAboutAccessingKey.isReactWarning = true;
|
1057
|
+
Object.defineProperty(props, 'key', {
|
1058
|
+
get: warnAboutAccessingKey,
|
1059
|
+
configurable: true
|
1060
|
+
});
|
1061
|
+
}
|
1062
|
+
|
1063
|
+
function defineRefPropWarningGetter(props, displayName) {
|
1064
|
+
var warnAboutAccessingRef = function () {
|
1065
|
+
{
|
1066
|
+
if (!specialPropRefWarningShown) {
|
1067
|
+
specialPropRefWarningShown = true;
|
1068
|
+
|
1069
|
+
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
1070
|
+
}
|
1071
|
+
}
|
1072
|
+
};
|
1073
|
+
|
1074
|
+
warnAboutAccessingRef.isReactWarning = true;
|
1075
|
+
Object.defineProperty(props, 'ref', {
|
1076
|
+
get: warnAboutAccessingRef,
|
1077
|
+
configurable: true
|
1078
|
+
});
|
1079
|
+
}
|
1080
|
+
|
1081
|
+
function warnIfStringRefCannotBeAutoConverted(config) {
|
1082
|
+
{
|
1083
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
1084
|
+
var componentName = getComponentName(ReactCurrentOwner.current.type);
|
1085
|
+
|
1086
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
1087
|
+
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);
|
1088
|
+
|
1089
|
+
didWarnAboutStringRefs[componentName] = true;
|
1090
|
+
}
|
1091
|
+
}
|
1092
|
+
}
|
1093
|
+
}
|
1094
|
+
/**
|
1095
|
+
* Factory method to create a new React element. This no longer adheres to
|
1096
|
+
* the class pattern, so do not use new to call it. Also, instanceof check
|
1097
|
+
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
1098
|
+
* if something is a React Element.
|
1099
|
+
*
|
1100
|
+
* @param {*} type
|
1101
|
+
* @param {*} props
|
1102
|
+
* @param {*} key
|
1103
|
+
* @param {string|object} ref
|
1104
|
+
* @param {*} owner
|
1105
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
1106
|
+
* different from the `owner` when React.createElement is called, so that we
|
1107
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
1108
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
1109
|
+
* change in behavior.
|
1110
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
1111
|
+
* indicating filename, line number, and/or other information.
|
1112
|
+
* @internal
|
1113
|
+
*/
|
1114
|
+
|
1115
|
+
|
1116
|
+
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
1117
|
+
var element = {
|
1118
|
+
// This tag allows us to uniquely identify this as a React Element
|
1119
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
1120
|
+
// Built-in properties that belong on the element
|
1121
|
+
type: type,
|
1122
|
+
key: key,
|
1123
|
+
ref: ref,
|
1124
|
+
props: props,
|
1125
|
+
// Record the component responsible for creating this element.
|
1126
|
+
_owner: owner
|
1127
|
+
};
|
1128
|
+
|
1129
|
+
{
|
1130
|
+
// The validation flag is currently mutative. We put it on
|
1131
|
+
// an external backing store so that we can freeze the whole object.
|
1132
|
+
// This can be replaced with a WeakMap once they are implemented in
|
1133
|
+
// commonly used development environments.
|
1134
|
+
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
1135
|
+
// the validation flag non-enumerable (where possible, which should
|
1136
|
+
// include every environment we run tests in), so the test framework
|
1137
|
+
// ignores it.
|
1138
|
+
|
1139
|
+
Object.defineProperty(element._store, 'validated', {
|
1140
|
+
configurable: false,
|
1141
|
+
enumerable: false,
|
1142
|
+
writable: true,
|
1143
|
+
value: false
|
1144
|
+
}); // self and source are DEV only properties.
|
1145
|
+
|
1146
|
+
Object.defineProperty(element, '_self', {
|
1147
|
+
configurable: false,
|
1148
|
+
enumerable: false,
|
1149
|
+
writable: false,
|
1150
|
+
value: self
|
1151
|
+
}); // Two elements created in two different places should be considered
|
1152
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
1153
|
+
|
1154
|
+
Object.defineProperty(element, '_source', {
|
1155
|
+
configurable: false,
|
1156
|
+
enumerable: false,
|
1157
|
+
writable: false,
|
1158
|
+
value: source
|
1159
|
+
});
|
1160
|
+
|
1161
|
+
if (Object.freeze) {
|
1162
|
+
Object.freeze(element.props);
|
1163
|
+
Object.freeze(element);
|
1164
|
+
}
|
1165
|
+
}
|
1166
|
+
|
1167
|
+
return element;
|
1168
|
+
};
|
1169
|
+
/**
|
1170
|
+
* Create and return a new ReactElement of the given type.
|
1171
|
+
* See https://reactjs.org/docs/react-api.html#createelement
|
1172
|
+
*/
|
1173
|
+
|
1174
|
+
function createElement(type, config, children) {
|
1175
|
+
var propName; // Reserved names are extracted
|
1176
|
+
|
1177
|
+
var props = {};
|
1178
|
+
var key = null;
|
1179
|
+
var ref = null;
|
1180
|
+
var self = null;
|
1181
|
+
var source = null;
|
1182
|
+
|
1183
|
+
if (config != null) {
|
1184
|
+
if (hasValidRef(config)) {
|
1185
|
+
ref = config.ref;
|
1186
|
+
|
1187
|
+
{
|
1188
|
+
warnIfStringRefCannotBeAutoConverted(config);
|
1189
|
+
}
|
1190
|
+
}
|
1191
|
+
|
1192
|
+
if (hasValidKey(config)) {
|
1193
|
+
key = '' + config.key;
|
1194
|
+
}
|
1195
|
+
|
1196
|
+
self = config.__self === undefined ? null : config.__self;
|
1197
|
+
source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
|
1198
|
+
|
1199
|
+
for (propName in config) {
|
1200
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
1201
|
+
props[propName] = config[propName];
|
1202
|
+
}
|
1203
|
+
}
|
1204
|
+
} // Children can be more than one argument, and those are transferred onto
|
1205
|
+
// the newly allocated props object.
|
1206
|
+
|
1207
|
+
|
1208
|
+
var childrenLength = arguments.length - 2;
|
1209
|
+
|
1210
|
+
if (childrenLength === 1) {
|
1211
|
+
props.children = children;
|
1212
|
+
} else if (childrenLength > 1) {
|
1213
|
+
var childArray = Array(childrenLength);
|
1214
|
+
|
1215
|
+
for (var i = 0; i < childrenLength; i++) {
|
1216
|
+
childArray[i] = arguments[i + 2];
|
1217
|
+
}
|
1218
|
+
|
1219
|
+
{
|
1220
|
+
if (Object.freeze) {
|
1221
|
+
Object.freeze(childArray);
|
1222
|
+
}
|
1223
|
+
}
|
1224
|
+
|
1225
|
+
props.children = childArray;
|
1226
|
+
} // Resolve default props
|
1227
|
+
|
1228
|
+
|
1229
|
+
if (type && type.defaultProps) {
|
1230
|
+
var defaultProps = type.defaultProps;
|
1231
|
+
|
1232
|
+
for (propName in defaultProps) {
|
1233
|
+
if (props[propName] === undefined) {
|
1234
|
+
props[propName] = defaultProps[propName];
|
1235
|
+
}
|
1236
|
+
}
|
1237
|
+
}
|
1238
|
+
|
1239
|
+
{
|
1240
|
+
if (key || ref) {
|
1241
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
1242
|
+
|
1243
|
+
if (key) {
|
1244
|
+
defineKeyPropWarningGetter(props, displayName);
|
1245
|
+
}
|
1246
|
+
|
1247
|
+
if (ref) {
|
1248
|
+
defineRefPropWarningGetter(props, displayName);
|
1249
|
+
}
|
1250
|
+
}
|
1251
|
+
}
|
1252
|
+
|
1253
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
1254
|
+
}
|
1255
|
+
function cloneAndReplaceKey(oldElement, newKey) {
|
1256
|
+
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
1257
|
+
return newElement;
|
1258
|
+
}
|
1259
|
+
/**
|
1260
|
+
* Clone and return a new ReactElement using element as the starting point.
|
1261
|
+
* See https://reactjs.org/docs/react-api.html#cloneelement
|
1262
|
+
*/
|
1263
|
+
|
1264
|
+
function cloneElement(element, config, children) {
|
1265
|
+
if (!!(element === null || element === undefined)) {
|
1266
|
+
{
|
1267
|
+
throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." );
|
1268
|
+
}
|
1269
|
+
}
|
1270
|
+
|
1271
|
+
var propName; // Original props are copied
|
1272
|
+
|
1273
|
+
var props = _assign({}, element.props); // Reserved names are extracted
|
1274
|
+
|
1275
|
+
|
1276
|
+
var key = element.key;
|
1277
|
+
var ref = element.ref; // Self is preserved since the owner is preserved.
|
1278
|
+
|
1279
|
+
var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
|
1280
|
+
// transpiler, and the original source is probably a better indicator of the
|
1281
|
+
// true owner.
|
1282
|
+
|
1283
|
+
var source = element._source; // Owner will be preserved, unless ref is overridden
|
1284
|
+
|
1285
|
+
var owner = element._owner;
|
1286
|
+
|
1287
|
+
if (config != null) {
|
1288
|
+
if (hasValidRef(config)) {
|
1289
|
+
// Silently steal the ref from the parent.
|
1290
|
+
ref = config.ref;
|
1291
|
+
owner = ReactCurrentOwner.current;
|
1292
|
+
}
|
1293
|
+
|
1294
|
+
if (hasValidKey(config)) {
|
1295
|
+
key = '' + config.key;
|
1296
|
+
} // Remaining properties override existing props
|
1297
|
+
|
1298
|
+
|
1299
|
+
var defaultProps;
|
1300
|
+
|
1301
|
+
if (element.type && element.type.defaultProps) {
|
1302
|
+
defaultProps = element.type.defaultProps;
|
1303
|
+
}
|
1304
|
+
|
1305
|
+
for (propName in config) {
|
1306
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
1307
|
+
if (config[propName] === undefined && defaultProps !== undefined) {
|
1308
|
+
// Resolve default props
|
1309
|
+
props[propName] = defaultProps[propName];
|
1310
|
+
} else {
|
1311
|
+
props[propName] = config[propName];
|
1312
|
+
}
|
1313
|
+
}
|
1314
|
+
}
|
1315
|
+
} // Children can be more than one argument, and those are transferred onto
|
1316
|
+
// the newly allocated props object.
|
1317
|
+
|
1318
|
+
|
1319
|
+
var childrenLength = arguments.length - 2;
|
1320
|
+
|
1321
|
+
if (childrenLength === 1) {
|
1322
|
+
props.children = children;
|
1323
|
+
} else if (childrenLength > 1) {
|
1324
|
+
var childArray = Array(childrenLength);
|
1325
|
+
|
1326
|
+
for (var i = 0; i < childrenLength; i++) {
|
1327
|
+
childArray[i] = arguments[i + 2];
|
1328
|
+
}
|
1329
|
+
|
1330
|
+
props.children = childArray;
|
1331
|
+
}
|
1332
|
+
|
1333
|
+
return ReactElement(element.type, key, ref, self, source, owner, props);
|
1334
|
+
}
|
1335
|
+
/**
|
1336
|
+
* Verifies the object is a ReactElement.
|
1337
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
1338
|
+
* @param {?object} object
|
1339
|
+
* @return {boolean} True if `object` is a ReactElement.
|
1340
|
+
* @final
|
1341
|
+
*/
|
1342
|
+
|
1343
|
+
function isValidElement(object) {
|
1344
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
1345
|
+
}
|
1346
|
+
|
1347
|
+
var SEPARATOR = '.';
|
1348
|
+
var SUBSEPARATOR = ':';
|
1349
|
+
/**
|
1350
|
+
* Escape and wrap key so it is safe to use as a reactid
|
1351
|
+
*
|
1352
|
+
* @param {string} key to be escaped.
|
1353
|
+
* @return {string} the escaped key.
|
1354
|
+
*/
|
1355
|
+
|
1356
|
+
function escape(key) {
|
1357
|
+
var escapeRegex = /[=:]/g;
|
1358
|
+
var escaperLookup = {
|
1359
|
+
'=': '=0',
|
1360
|
+
':': '=2'
|
1361
|
+
};
|
1362
|
+
var escapedString = key.replace(escapeRegex, function (match) {
|
1363
|
+
return escaperLookup[match];
|
1364
|
+
});
|
1365
|
+
return '$' + escapedString;
|
1366
|
+
}
|
1367
|
+
/**
|
1368
|
+
* TODO: Test that a single child and an array with one item have the same key
|
1369
|
+
* pattern.
|
1370
|
+
*/
|
1371
|
+
|
1372
|
+
|
1373
|
+
var didWarnAboutMaps = false;
|
1374
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
1375
|
+
|
1376
|
+
function escapeUserProvidedKey(text) {
|
1377
|
+
return text.replace(userProvidedKeyEscapeRegex, '$&/');
|
1378
|
+
}
|
1379
|
+
/**
|
1380
|
+
* Generate a key string that identifies a element within a set.
|
1381
|
+
*
|
1382
|
+
* @param {*} element A element that could contain a manual key.
|
1383
|
+
* @param {number} index Index that is used if a manual key is not provided.
|
1384
|
+
* @return {string}
|
1385
|
+
*/
|
1386
|
+
|
1387
|
+
|
1388
|
+
function getElementKey(element, index) {
|
1389
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
1390
|
+
// that we don't block potential future ES APIs.
|
1391
|
+
if (typeof element === 'object' && element !== null && element.key != null) {
|
1392
|
+
// Explicit key
|
1393
|
+
return escape('' + element.key);
|
1394
|
+
} // Implicit key determined by the index in the set
|
1395
|
+
|
1396
|
+
|
1397
|
+
return index.toString(36);
|
1398
|
+
}
|
1399
|
+
|
1400
|
+
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
1401
|
+
var type = typeof children;
|
1402
|
+
|
1403
|
+
if (type === 'undefined' || type === 'boolean') {
|
1404
|
+
// All of the above are perceived as null.
|
1405
|
+
children = null;
|
1406
|
+
}
|
1407
|
+
|
1408
|
+
var invokeCallback = false;
|
1409
|
+
|
1410
|
+
if (children === null) {
|
1411
|
+
invokeCallback = true;
|
1412
|
+
} else {
|
1413
|
+
switch (type) {
|
1414
|
+
case 'string':
|
1415
|
+
case 'number':
|
1416
|
+
invokeCallback = true;
|
1417
|
+
break;
|
1418
|
+
|
1419
|
+
case 'object':
|
1420
|
+
switch (children.$$typeof) {
|
1421
|
+
case REACT_ELEMENT_TYPE:
|
1422
|
+
case REACT_PORTAL_TYPE:
|
1423
|
+
invokeCallback = true;
|
1424
|
+
}
|
1425
|
+
|
1426
|
+
}
|
1427
|
+
}
|
1428
|
+
|
1429
|
+
if (invokeCallback) {
|
1430
|
+
var _child = children;
|
1431
|
+
var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
|
1432
|
+
// so that it's consistent if the number of children grows:
|
1433
|
+
|
1434
|
+
var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
1435
|
+
|
1436
|
+
if (Array.isArray(mappedChild)) {
|
1437
|
+
var escapedChildKey = '';
|
1438
|
+
|
1439
|
+
if (childKey != null) {
|
1440
|
+
escapedChildKey = escapeUserProvidedKey(childKey) + '/';
|
1441
|
+
}
|
1442
|
+
|
1443
|
+
mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
|
1444
|
+
return c;
|
1445
|
+
});
|
1446
|
+
} else if (mappedChild != null) {
|
1447
|
+
if (isValidElement(mappedChild)) {
|
1448
|
+
mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
1449
|
+
// traverseAllChildren used to do for objects as children
|
1450
|
+
escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
1451
|
+
mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
|
1452
|
+
escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
|
1453
|
+
}
|
1454
|
+
|
1455
|
+
array.push(mappedChild);
|
1456
|
+
}
|
1457
|
+
|
1458
|
+
return 1;
|
1459
|
+
}
|
1460
|
+
|
1461
|
+
var child;
|
1462
|
+
var nextName;
|
1463
|
+
var subtreeCount = 0; // Count of children found in the current subtree.
|
1464
|
+
|
1465
|
+
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
1466
|
+
|
1467
|
+
if (Array.isArray(children)) {
|
1468
|
+
for (var i = 0; i < children.length; i++) {
|
1469
|
+
child = children[i];
|
1470
|
+
nextName = nextNamePrefix + getElementKey(child, i);
|
1471
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
1472
|
+
}
|
1473
|
+
} else {
|
1474
|
+
var iteratorFn = getIteratorFn(children);
|
1475
|
+
|
1476
|
+
if (typeof iteratorFn === 'function') {
|
1477
|
+
var iterableChildren = children;
|
1478
|
+
|
1479
|
+
{
|
1480
|
+
// Warn about using Maps as children
|
1481
|
+
if (iteratorFn === iterableChildren.entries) {
|
1482
|
+
if (!didWarnAboutMaps) {
|
1483
|
+
warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
|
1484
|
+
}
|
1485
|
+
|
1486
|
+
didWarnAboutMaps = true;
|
1487
|
+
}
|
1488
|
+
}
|
1489
|
+
|
1490
|
+
var iterator = iteratorFn.call(iterableChildren);
|
1491
|
+
var step;
|
1492
|
+
var ii = 0;
|
1493
|
+
|
1494
|
+
while (!(step = iterator.next()).done) {
|
1495
|
+
child = step.value;
|
1496
|
+
nextName = nextNamePrefix + getElementKey(child, ii++);
|
1497
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
1498
|
+
}
|
1499
|
+
} else if (type === 'object') {
|
1500
|
+
var childrenString = '' + children;
|
1501
|
+
|
1502
|
+
{
|
1503
|
+
{
|
1504
|
+
throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). If you meant to render a collection of children, use an array instead." );
|
1505
|
+
}
|
1506
|
+
}
|
1507
|
+
}
|
1508
|
+
}
|
1509
|
+
|
1510
|
+
return subtreeCount;
|
1511
|
+
}
|
1512
|
+
|
1513
|
+
/**
|
1514
|
+
* Maps children that are typically specified as `props.children`.
|
1515
|
+
*
|
1516
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
|
1517
|
+
*
|
1518
|
+
* The provided mapFunction(child, index) will be called for each
|
1519
|
+
* leaf child.
|
1520
|
+
*
|
1521
|
+
* @param {?*} children Children tree container.
|
1522
|
+
* @param {function(*, int)} func The map function.
|
1523
|
+
* @param {*} context Context for mapFunction.
|
1524
|
+
* @return {object} Object containing the ordered map of results.
|
1525
|
+
*/
|
1526
|
+
function mapChildren(children, func, context) {
|
1527
|
+
if (children == null) {
|
1528
|
+
return children;
|
1529
|
+
}
|
1530
|
+
|
1531
|
+
var result = [];
|
1532
|
+
var count = 0;
|
1533
|
+
mapIntoArray(children, result, '', '', function (child) {
|
1534
|
+
return func.call(context, child, count++);
|
1535
|
+
});
|
1536
|
+
return result;
|
1537
|
+
}
|
1538
|
+
/**
|
1539
|
+
* Count the number of children that are typically specified as
|
1540
|
+
* `props.children`.
|
1541
|
+
*
|
1542
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrencount
|
1543
|
+
*
|
1544
|
+
* @param {?*} children Children tree container.
|
1545
|
+
* @return {number} The number of children.
|
1546
|
+
*/
|
1547
|
+
|
1548
|
+
|
1549
|
+
function countChildren(children) {
|
1550
|
+
var n = 0;
|
1551
|
+
mapChildren(children, function () {
|
1552
|
+
n++; // Don't return anything
|
1553
|
+
});
|
1554
|
+
return n;
|
1555
|
+
}
|
1556
|
+
|
1557
|
+
/**
|
1558
|
+
* Iterates through children that are typically specified as `props.children`.
|
1559
|
+
*
|
1560
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
1561
|
+
*
|
1562
|
+
* The provided forEachFunc(child, index) will be called for each
|
1563
|
+
* leaf child.
|
1564
|
+
*
|
1565
|
+
* @param {?*} children Children tree container.
|
1566
|
+
* @param {function(*, int)} forEachFunc
|
1567
|
+
* @param {*} forEachContext Context for forEachContext.
|
1568
|
+
*/
|
1569
|
+
function forEachChildren(children, forEachFunc, forEachContext) {
|
1570
|
+
mapChildren(children, function () {
|
1571
|
+
forEachFunc.apply(this, arguments); // Don't return anything.
|
1572
|
+
}, forEachContext);
|
1573
|
+
}
|
1574
|
+
/**
|
1575
|
+
* Flatten a children object (typically specified as `props.children`) and
|
1576
|
+
* return an array with appropriately re-keyed children.
|
1577
|
+
*
|
1578
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
1579
|
+
*/
|
1580
|
+
|
1581
|
+
|
1582
|
+
function toArray(children) {
|
1583
|
+
return mapChildren(children, function (child) {
|
1584
|
+
return child;
|
1585
|
+
}) || [];
|
1586
|
+
}
|
1587
|
+
/**
|
1588
|
+
* Returns the first child in a collection of children and verifies that there
|
1589
|
+
* is only one child in the collection.
|
1590
|
+
*
|
1591
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenonly
|
1592
|
+
*
|
1593
|
+
* The current implementation of this function assumes that a single child gets
|
1594
|
+
* passed without a wrapper, but the purpose of this helper function is to
|
1595
|
+
* abstract away the particular structure of children.
|
1596
|
+
*
|
1597
|
+
* @param {?object} children Child collection structure.
|
1598
|
+
* @return {ReactElement} The first and only `ReactElement` contained in the
|
1599
|
+
* structure.
|
1600
|
+
*/
|
1601
|
+
|
1602
|
+
|
1603
|
+
function onlyChild(children) {
|
1604
|
+
if (!isValidElement(children)) {
|
1605
|
+
{
|
1606
|
+
throw Error( "React.Children.only expected to receive a single React element child." );
|
1607
|
+
}
|
1608
|
+
}
|
1609
|
+
|
1610
|
+
return children;
|
1611
|
+
}
|
1612
|
+
|
1613
|
+
function createContext(defaultValue, calculateChangedBits) {
|
1614
|
+
if (calculateChangedBits === undefined) {
|
1615
|
+
calculateChangedBits = null;
|
1616
|
+
} else {
|
1617
|
+
{
|
1618
|
+
if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
|
1619
|
+
error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
|
1620
|
+
}
|
1621
|
+
}
|
1622
|
+
}
|
1623
|
+
|
1624
|
+
var context = {
|
1625
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
1626
|
+
_calculateChangedBits: calculateChangedBits,
|
1627
|
+
// As a workaround to support multiple concurrent renderers, we categorize
|
1628
|
+
// some renderers as primary and others as secondary. We only expect
|
1629
|
+
// there to be two concurrent renderers at most: React Native (primary) and
|
1630
|
+
// Fabric (secondary); React DOM (primary) and React ART (secondary).
|
1631
|
+
// Secondary renderers store their context values on separate fields.
|
1632
|
+
_currentValue: defaultValue,
|
1633
|
+
_currentValue2: defaultValue,
|
1634
|
+
// Used to track how many concurrent renderers this context currently
|
1635
|
+
// supports within in a single renderer. Such as parallel server rendering.
|
1636
|
+
_threadCount: 0,
|
1637
|
+
// These are circular
|
1638
|
+
Provider: null,
|
1639
|
+
Consumer: null
|
1640
|
+
};
|
1641
|
+
context.Provider = {
|
1642
|
+
$$typeof: REACT_PROVIDER_TYPE,
|
1643
|
+
_context: context
|
1644
|
+
};
|
1645
|
+
var hasWarnedAboutUsingNestedContextConsumers = false;
|
1646
|
+
var hasWarnedAboutUsingConsumerProvider = false;
|
1647
|
+
var hasWarnedAboutDisplayNameOnConsumer = false;
|
1648
|
+
|
1649
|
+
{
|
1650
|
+
// A separate object, but proxies back to the original context object for
|
1651
|
+
// backwards compatibility. It has a different $$typeof, so we can properly
|
1652
|
+
// warn for the incorrect usage of Context as a Consumer.
|
1653
|
+
var Consumer = {
|
1654
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
1655
|
+
_context: context,
|
1656
|
+
_calculateChangedBits: context._calculateChangedBits
|
1657
|
+
}; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
|
1658
|
+
|
1659
|
+
Object.defineProperties(Consumer, {
|
1660
|
+
Provider: {
|
1661
|
+
get: function () {
|
1662
|
+
if (!hasWarnedAboutUsingConsumerProvider) {
|
1663
|
+
hasWarnedAboutUsingConsumerProvider = true;
|
1664
|
+
|
1665
|
+
error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
|
1666
|
+
}
|
1667
|
+
|
1668
|
+
return context.Provider;
|
1669
|
+
},
|
1670
|
+
set: function (_Provider) {
|
1671
|
+
context.Provider = _Provider;
|
1672
|
+
}
|
1673
|
+
},
|
1674
|
+
_currentValue: {
|
1675
|
+
get: function () {
|
1676
|
+
return context._currentValue;
|
1677
|
+
},
|
1678
|
+
set: function (_currentValue) {
|
1679
|
+
context._currentValue = _currentValue;
|
1680
|
+
}
|
1681
|
+
},
|
1682
|
+
_currentValue2: {
|
1683
|
+
get: function () {
|
1684
|
+
return context._currentValue2;
|
1685
|
+
},
|
1686
|
+
set: function (_currentValue2) {
|
1687
|
+
context._currentValue2 = _currentValue2;
|
1688
|
+
}
|
1689
|
+
},
|
1690
|
+
_threadCount: {
|
1691
|
+
get: function () {
|
1692
|
+
return context._threadCount;
|
1693
|
+
},
|
1694
|
+
set: function (_threadCount) {
|
1695
|
+
context._threadCount = _threadCount;
|
1696
|
+
}
|
1697
|
+
},
|
1698
|
+
Consumer: {
|
1699
|
+
get: function () {
|
1700
|
+
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
1701
|
+
hasWarnedAboutUsingNestedContextConsumers = true;
|
1702
|
+
|
1703
|
+
error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
1704
|
+
}
|
1705
|
+
|
1706
|
+
return context.Consumer;
|
1707
|
+
}
|
1708
|
+
},
|
1709
|
+
displayName: {
|
1710
|
+
get: function () {
|
1711
|
+
return context.displayName;
|
1712
|
+
},
|
1713
|
+
set: function (displayName) {
|
1714
|
+
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
1715
|
+
warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
1716
|
+
|
1717
|
+
hasWarnedAboutDisplayNameOnConsumer = true;
|
1718
|
+
}
|
1719
|
+
}
|
1720
|
+
}
|
1721
|
+
}); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
|
1722
|
+
|
1723
|
+
context.Consumer = Consumer;
|
1724
|
+
}
|
1725
|
+
|
1726
|
+
{
|
1727
|
+
context._currentRenderer = null;
|
1728
|
+
context._currentRenderer2 = null;
|
1729
|
+
}
|
1730
|
+
|
1731
|
+
return context;
|
1732
|
+
}
|
1733
|
+
|
1734
|
+
var Uninitialized = -1;
|
1735
|
+
var Pending = 0;
|
1736
|
+
var Resolved = 1;
|
1737
|
+
var Rejected = 2;
|
1738
|
+
|
1739
|
+
function lazyInitializer(payload) {
|
1740
|
+
if (payload._status === Uninitialized) {
|
1741
|
+
var ctor = payload._result;
|
1742
|
+
var thenable = ctor(); // Transition to the next state.
|
1743
|
+
|
1744
|
+
var pending = payload;
|
1745
|
+
pending._status = Pending;
|
1746
|
+
pending._result = thenable;
|
1747
|
+
thenable.then(function (moduleObject) {
|
1748
|
+
if (payload._status === Pending) {
|
1749
|
+
var defaultExport = moduleObject.default;
|
1750
|
+
|
1751
|
+
{
|
1752
|
+
if (defaultExport === undefined) {
|
1753
|
+
error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
|
1754
|
+
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
|
1755
|
+
}
|
1756
|
+
} // Transition to the next state.
|
1757
|
+
|
1758
|
+
|
1759
|
+
var resolved = payload;
|
1760
|
+
resolved._status = Resolved;
|
1761
|
+
resolved._result = defaultExport;
|
1762
|
+
}
|
1763
|
+
}, function (error) {
|
1764
|
+
if (payload._status === Pending) {
|
1765
|
+
// Transition to the next state.
|
1766
|
+
var rejected = payload;
|
1767
|
+
rejected._status = Rejected;
|
1768
|
+
rejected._result = error;
|
1769
|
+
}
|
1770
|
+
});
|
1771
|
+
}
|
1772
|
+
|
1773
|
+
if (payload._status === Resolved) {
|
1774
|
+
return payload._result;
|
1775
|
+
} else {
|
1776
|
+
throw payload._result;
|
1777
|
+
}
|
1778
|
+
}
|
1779
|
+
|
1780
|
+
function lazy(ctor) {
|
1781
|
+
var payload = {
|
1782
|
+
// We use these fields to store the result.
|
1783
|
+
_status: -1,
|
1784
|
+
_result: ctor
|
1785
|
+
};
|
1786
|
+
var lazyType = {
|
1787
|
+
$$typeof: REACT_LAZY_TYPE,
|
1788
|
+
_payload: payload,
|
1789
|
+
_init: lazyInitializer
|
1790
|
+
};
|
1791
|
+
|
1792
|
+
{
|
1793
|
+
// In production, this would just set it on the object.
|
1794
|
+
var defaultProps;
|
1795
|
+
var propTypes; // $FlowFixMe
|
1796
|
+
|
1797
|
+
Object.defineProperties(lazyType, {
|
1798
|
+
defaultProps: {
|
1799
|
+
configurable: true,
|
1800
|
+
get: function () {
|
1801
|
+
return defaultProps;
|
1802
|
+
},
|
1803
|
+
set: function (newDefaultProps) {
|
1804
|
+
error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
1805
|
+
|
1806
|
+
defaultProps = newDefaultProps; // Match production behavior more closely:
|
1807
|
+
// $FlowFixMe
|
1808
|
+
|
1809
|
+
Object.defineProperty(lazyType, 'defaultProps', {
|
1810
|
+
enumerable: true
|
1811
|
+
});
|
1812
|
+
}
|
1813
|
+
},
|
1814
|
+
propTypes: {
|
1815
|
+
configurable: true,
|
1816
|
+
get: function () {
|
1817
|
+
return propTypes;
|
1818
|
+
},
|
1819
|
+
set: function (newPropTypes) {
|
1820
|
+
error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
1821
|
+
|
1822
|
+
propTypes = newPropTypes; // Match production behavior more closely:
|
1823
|
+
// $FlowFixMe
|
1824
|
+
|
1825
|
+
Object.defineProperty(lazyType, 'propTypes', {
|
1826
|
+
enumerable: true
|
1827
|
+
});
|
1828
|
+
}
|
1829
|
+
}
|
1830
|
+
});
|
1831
|
+
}
|
1832
|
+
|
1833
|
+
return lazyType;
|
1834
|
+
}
|
1835
|
+
|
1836
|
+
function forwardRef(render) {
|
1837
|
+
{
|
1838
|
+
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
1839
|
+
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
1840
|
+
} else if (typeof render !== 'function') {
|
1841
|
+
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
1842
|
+
} else {
|
1843
|
+
if (render.length !== 0 && render.length !== 2) {
|
1844
|
+
error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
|
1845
|
+
}
|
1846
|
+
}
|
1847
|
+
|
1848
|
+
if (render != null) {
|
1849
|
+
if (render.defaultProps != null || render.propTypes != null) {
|
1850
|
+
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
1851
|
+
}
|
1852
|
+
}
|
1853
|
+
}
|
1854
|
+
|
1855
|
+
var elementType = {
|
1856
|
+
$$typeof: REACT_FORWARD_REF_TYPE,
|
1857
|
+
render: render
|
1858
|
+
};
|
1859
|
+
|
1860
|
+
{
|
1861
|
+
var ownName;
|
1862
|
+
Object.defineProperty(elementType, 'displayName', {
|
1863
|
+
enumerable: false,
|
1864
|
+
configurable: true,
|
1865
|
+
get: function () {
|
1866
|
+
return ownName;
|
1867
|
+
},
|
1868
|
+
set: function (name) {
|
1869
|
+
ownName = name;
|
1870
|
+
|
1871
|
+
if (render.displayName == null) {
|
1872
|
+
render.displayName = name;
|
1873
|
+
}
|
1874
|
+
}
|
1875
|
+
});
|
1876
|
+
}
|
1877
|
+
|
1878
|
+
return elementType;
|
1879
|
+
}
|
1880
|
+
|
1881
|
+
// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
|
1882
|
+
|
1883
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
1884
|
+
|
1885
|
+
function isValidElementType(type) {
|
1886
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
1887
|
+
return true;
|
1888
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
1889
|
+
|
1890
|
+
|
1891
|
+
if (type === exports.Fragment || type === exports.Profiler || type === REACT_DEBUG_TRACING_MODE_TYPE || type === exports.StrictMode || type === exports.Suspense || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
|
1892
|
+
return true;
|
1893
|
+
}
|
1894
|
+
|
1895
|
+
if (typeof type === 'object' && type !== null) {
|
1896
|
+
if (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_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
|
1897
|
+
return true;
|
1898
|
+
}
|
1899
|
+
}
|
1900
|
+
|
1901
|
+
return false;
|
1902
|
+
}
|
1903
|
+
|
1904
|
+
function memo(type, compare) {
|
1905
|
+
{
|
1906
|
+
if (!isValidElementType(type)) {
|
1907
|
+
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
1908
|
+
}
|
1909
|
+
}
|
1910
|
+
|
1911
|
+
var elementType = {
|
1912
|
+
$$typeof: REACT_MEMO_TYPE,
|
1913
|
+
type: type,
|
1914
|
+
compare: compare === undefined ? null : compare
|
1915
|
+
};
|
1916
|
+
|
1917
|
+
{
|
1918
|
+
var ownName;
|
1919
|
+
Object.defineProperty(elementType, 'displayName', {
|
1920
|
+
enumerable: false,
|
1921
|
+
configurable: true,
|
1922
|
+
get: function () {
|
1923
|
+
return ownName;
|
1924
|
+
},
|
1925
|
+
set: function (name) {
|
1926
|
+
ownName = name;
|
1927
|
+
|
1928
|
+
if (type.displayName == null) {
|
1929
|
+
type.displayName = name;
|
1930
|
+
}
|
1931
|
+
}
|
1932
|
+
});
|
1933
|
+
}
|
1934
|
+
|
1935
|
+
return elementType;
|
1936
|
+
}
|
1937
|
+
|
1938
|
+
function resolveDispatcher() {
|
1939
|
+
var dispatcher = ReactCurrentDispatcher.current;
|
1940
|
+
|
1941
|
+
if (!(dispatcher !== null)) {
|
1942
|
+
{
|
1943
|
+
throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." );
|
1944
|
+
}
|
1945
|
+
}
|
1946
|
+
|
1947
|
+
return dispatcher;
|
1948
|
+
}
|
1949
|
+
|
1950
|
+
function useContext(Context, unstable_observedBits) {
|
1951
|
+
var dispatcher = resolveDispatcher();
|
1952
|
+
|
1953
|
+
{
|
1954
|
+
if (unstable_observedBits !== undefined) {
|
1955
|
+
error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://reactjs.org/link/rules-of-hooks' : '');
|
1956
|
+
} // TODO: add a more generic warning for invalid values.
|
1957
|
+
|
1958
|
+
|
1959
|
+
if (Context._context !== undefined) {
|
1960
|
+
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
1961
|
+
// and nobody should be using this in existing code.
|
1962
|
+
|
1963
|
+
if (realContext.Consumer === Context) {
|
1964
|
+
error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
|
1965
|
+
} else if (realContext.Provider === Context) {
|
1966
|
+
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
1967
|
+
}
|
1968
|
+
}
|
1969
|
+
}
|
1970
|
+
|
1971
|
+
return dispatcher.useContext(Context, unstable_observedBits);
|
1972
|
+
}
|
1973
|
+
function useState(initialState) {
|
1974
|
+
var dispatcher = resolveDispatcher();
|
1975
|
+
return dispatcher.useState(initialState);
|
1976
|
+
}
|
1977
|
+
function useReducer(reducer, initialArg, init) {
|
1978
|
+
var dispatcher = resolveDispatcher();
|
1979
|
+
return dispatcher.useReducer(reducer, initialArg, init);
|
1980
|
+
}
|
1981
|
+
function useRef(initialValue) {
|
1982
|
+
var dispatcher = resolveDispatcher();
|
1983
|
+
return dispatcher.useRef(initialValue);
|
1984
|
+
}
|
1985
|
+
function useEffect(create, deps) {
|
1986
|
+
var dispatcher = resolveDispatcher();
|
1987
|
+
return dispatcher.useEffect(create, deps);
|
1988
|
+
}
|
1989
|
+
function useLayoutEffect(create, deps) {
|
1990
|
+
var dispatcher = resolveDispatcher();
|
1991
|
+
return dispatcher.useLayoutEffect(create, deps);
|
1992
|
+
}
|
1993
|
+
function useCallback(callback, deps) {
|
1994
|
+
var dispatcher = resolveDispatcher();
|
1995
|
+
return dispatcher.useCallback(callback, deps);
|
1996
|
+
}
|
1997
|
+
function useMemo(create, deps) {
|
1998
|
+
var dispatcher = resolveDispatcher();
|
1999
|
+
return dispatcher.useMemo(create, deps);
|
2000
|
+
}
|
2001
|
+
function useImperativeHandle(ref, create, deps) {
|
2002
|
+
var dispatcher = resolveDispatcher();
|
2003
|
+
return dispatcher.useImperativeHandle(ref, create, deps);
|
2004
|
+
}
|
2005
|
+
function useDebugValue(value, formatterFn) {
|
2006
|
+
{
|
2007
|
+
var dispatcher = resolveDispatcher();
|
2008
|
+
return dispatcher.useDebugValue(value, formatterFn);
|
2009
|
+
}
|
2010
|
+
}
|
2011
|
+
|
2012
|
+
// Helpers to patch console.logs to avoid logging during side-effect free
|
2013
|
+
// replaying on render function. This currently only patches the object
|
2014
|
+
// lazily which won't cover if the log function was extracted eagerly.
|
2015
|
+
// We could also eagerly patch the method.
|
2016
|
+
var disabledDepth = 0;
|
2017
|
+
var prevLog;
|
2018
|
+
var prevInfo;
|
2019
|
+
var prevWarn;
|
2020
|
+
var prevError;
|
2021
|
+
var prevGroup;
|
2022
|
+
var prevGroupCollapsed;
|
2023
|
+
var prevGroupEnd;
|
2024
|
+
|
2025
|
+
function disabledLog() {}
|
2026
|
+
|
2027
|
+
disabledLog.__reactDisabledLog = true;
|
2028
|
+
function disableLogs() {
|
2029
|
+
{
|
2030
|
+
if (disabledDepth === 0) {
|
2031
|
+
/* eslint-disable react-internal/no-production-logging */
|
2032
|
+
prevLog = console.log;
|
2033
|
+
prevInfo = console.info;
|
2034
|
+
prevWarn = console.warn;
|
2035
|
+
prevError = console.error;
|
2036
|
+
prevGroup = console.group;
|
2037
|
+
prevGroupCollapsed = console.groupCollapsed;
|
2038
|
+
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
2039
|
+
|
2040
|
+
var props = {
|
2041
|
+
configurable: true,
|
2042
|
+
enumerable: true,
|
2043
|
+
value: disabledLog,
|
2044
|
+
writable: true
|
2045
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
2046
|
+
|
2047
|
+
Object.defineProperties(console, {
|
2048
|
+
info: props,
|
2049
|
+
log: props,
|
2050
|
+
warn: props,
|
2051
|
+
error: props,
|
2052
|
+
group: props,
|
2053
|
+
groupCollapsed: props,
|
2054
|
+
groupEnd: props
|
2055
|
+
});
|
2056
|
+
/* eslint-enable react-internal/no-production-logging */
|
2057
|
+
}
|
2058
|
+
|
2059
|
+
disabledDepth++;
|
2060
|
+
}
|
2061
|
+
}
|
2062
|
+
function reenableLogs() {
|
2063
|
+
{
|
2064
|
+
disabledDepth--;
|
2065
|
+
|
2066
|
+
if (disabledDepth === 0) {
|
2067
|
+
/* eslint-disable react-internal/no-production-logging */
|
2068
|
+
var props = {
|
2069
|
+
configurable: true,
|
2070
|
+
enumerable: true,
|
2071
|
+
writable: true
|
2072
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
2073
|
+
|
2074
|
+
Object.defineProperties(console, {
|
2075
|
+
log: _assign({}, props, {
|
2076
|
+
value: prevLog
|
2077
|
+
}),
|
2078
|
+
info: _assign({}, props, {
|
2079
|
+
value: prevInfo
|
2080
|
+
}),
|
2081
|
+
warn: _assign({}, props, {
|
2082
|
+
value: prevWarn
|
2083
|
+
}),
|
2084
|
+
error: _assign({}, props, {
|
2085
|
+
value: prevError
|
2086
|
+
}),
|
2087
|
+
group: _assign({}, props, {
|
2088
|
+
value: prevGroup
|
2089
|
+
}),
|
2090
|
+
groupCollapsed: _assign({}, props, {
|
2091
|
+
value: prevGroupCollapsed
|
2092
|
+
}),
|
2093
|
+
groupEnd: _assign({}, props, {
|
2094
|
+
value: prevGroupEnd
|
2095
|
+
})
|
2096
|
+
});
|
2097
|
+
/* eslint-enable react-internal/no-production-logging */
|
2098
|
+
}
|
2099
|
+
|
2100
|
+
if (disabledDepth < 0) {
|
2101
|
+
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
2102
|
+
}
|
2103
|
+
}
|
2104
|
+
}
|
2105
|
+
|
2106
|
+
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
2107
|
+
var prefix;
|
2108
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
2109
|
+
{
|
2110
|
+
if (prefix === undefined) {
|
2111
|
+
// Extract the VM specific prefix used by each line.
|
2112
|
+
try {
|
2113
|
+
throw Error();
|
2114
|
+
} catch (x) {
|
2115
|
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
2116
|
+
prefix = match && match[1] || '';
|
2117
|
+
}
|
2118
|
+
} // We use the prefix to ensure our stacks line up with native stack frames.
|
2119
|
+
|
2120
|
+
|
2121
|
+
return '\n' + prefix + name;
|
2122
|
+
}
|
2123
|
+
}
|
2124
|
+
var reentry = false;
|
2125
|
+
var componentFrameCache;
|
2126
|
+
|
2127
|
+
{
|
2128
|
+
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
2129
|
+
componentFrameCache = new PossiblyWeakMap();
|
2130
|
+
}
|
2131
|
+
|
2132
|
+
function describeNativeComponentFrame(fn, construct) {
|
2133
|
+
// If something asked for a stack inside a fake render, it should get ignored.
|
2134
|
+
if (!fn || reentry) {
|
2135
|
+
return '';
|
2136
|
+
}
|
2137
|
+
|
2138
|
+
{
|
2139
|
+
var frame = componentFrameCache.get(fn);
|
2140
|
+
|
2141
|
+
if (frame !== undefined) {
|
2142
|
+
return frame;
|
2143
|
+
}
|
2144
|
+
}
|
2145
|
+
|
2146
|
+
var control;
|
2147
|
+
reentry = true;
|
2148
|
+
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
2149
|
+
|
2150
|
+
Error.prepareStackTrace = undefined;
|
2151
|
+
var previousDispatcher;
|
2152
|
+
|
2153
|
+
{
|
2154
|
+
previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
|
2155
|
+
// for warnings.
|
2156
|
+
|
2157
|
+
ReactCurrentDispatcher$1.current = null;
|
2158
|
+
disableLogs();
|
2159
|
+
}
|
2160
|
+
|
2161
|
+
try {
|
2162
|
+
// This should throw.
|
2163
|
+
if (construct) {
|
2164
|
+
// Something should be setting the props in the constructor.
|
2165
|
+
var Fake = function () {
|
2166
|
+
throw Error();
|
2167
|
+
}; // $FlowFixMe
|
2168
|
+
|
2169
|
+
|
2170
|
+
Object.defineProperty(Fake.prototype, 'props', {
|
2171
|
+
set: function () {
|
2172
|
+
// We use a throwing setter instead of frozen or non-writable props
|
2173
|
+
// because that won't throw in a non-strict mode function.
|
2174
|
+
throw Error();
|
2175
|
+
}
|
2176
|
+
});
|
2177
|
+
|
2178
|
+
if (typeof Reflect === 'object' && Reflect.construct) {
|
2179
|
+
// We construct a different control for this case to include any extra
|
2180
|
+
// frames added by the construct call.
|
2181
|
+
try {
|
2182
|
+
Reflect.construct(Fake, []);
|
2183
|
+
} catch (x) {
|
2184
|
+
control = x;
|
2185
|
+
}
|
2186
|
+
|
2187
|
+
Reflect.construct(fn, [], Fake);
|
2188
|
+
} else {
|
2189
|
+
try {
|
2190
|
+
Fake.call();
|
2191
|
+
} catch (x) {
|
2192
|
+
control = x;
|
2193
|
+
}
|
2194
|
+
|
2195
|
+
fn.call(Fake.prototype);
|
2196
|
+
}
|
2197
|
+
} else {
|
2198
|
+
try {
|
2199
|
+
throw Error();
|
2200
|
+
} catch (x) {
|
2201
|
+
control = x;
|
2202
|
+
}
|
2203
|
+
|
2204
|
+
fn();
|
2205
|
+
}
|
2206
|
+
} catch (sample) {
|
2207
|
+
// This is inlined manually because closure doesn't do it for us.
|
2208
|
+
if (sample && control && typeof sample.stack === 'string') {
|
2209
|
+
// This extracts the first frame from the sample that isn't also in the control.
|
2210
|
+
// Skipping one frame that we assume is the frame that calls the two.
|
2211
|
+
var sampleLines = sample.stack.split('\n');
|
2212
|
+
var controlLines = control.stack.split('\n');
|
2213
|
+
var s = sampleLines.length - 1;
|
2214
|
+
var c = controlLines.length - 1;
|
2215
|
+
|
2216
|
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
2217
|
+
// We expect at least one stack frame to be shared.
|
2218
|
+
// Typically this will be the root most one. However, stack frames may be
|
2219
|
+
// cut off due to maximum stack limits. In this case, one maybe cut off
|
2220
|
+
// earlier than the other. We assume that the sample is longer or the same
|
2221
|
+
// and there for cut off earlier. So we should find the root most frame in
|
2222
|
+
// the sample somewhere in the control.
|
2223
|
+
c--;
|
2224
|
+
}
|
2225
|
+
|
2226
|
+
for (; s >= 1 && c >= 0; s--, c--) {
|
2227
|
+
// Next we find the first one that isn't the same which should be the
|
2228
|
+
// frame that called our sample function and the control.
|
2229
|
+
if (sampleLines[s] !== controlLines[c]) {
|
2230
|
+
// In V8, the first line is describing the message but other VMs don't.
|
2231
|
+
// If we're about to return the first line, and the control is also on the same
|
2232
|
+
// line, that's a pretty good indicator that our sample threw at same line as
|
2233
|
+
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
2234
|
+
// This can happen if you passed a class to function component, or non-function.
|
2235
|
+
if (s !== 1 || c !== 1) {
|
2236
|
+
do {
|
2237
|
+
s--;
|
2238
|
+
c--; // We may still have similar intermediate frames from the construct call.
|
2239
|
+
// The next one that isn't the same should be our match though.
|
2240
|
+
|
2241
|
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
2242
|
+
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
2243
|
+
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
|
2244
|
+
|
2245
|
+
{
|
2246
|
+
if (typeof fn === 'function') {
|
2247
|
+
componentFrameCache.set(fn, _frame);
|
2248
|
+
}
|
2249
|
+
} // Return the line we found.
|
2250
|
+
|
2251
|
+
|
2252
|
+
return _frame;
|
2253
|
+
}
|
2254
|
+
} while (s >= 1 && c >= 0);
|
2255
|
+
}
|
2256
|
+
|
2257
|
+
break;
|
2258
|
+
}
|
2259
|
+
}
|
2260
|
+
}
|
2261
|
+
} finally {
|
2262
|
+
reentry = false;
|
2263
|
+
|
2264
|
+
{
|
2265
|
+
ReactCurrentDispatcher$1.current = previousDispatcher;
|
2266
|
+
reenableLogs();
|
2267
|
+
}
|
2268
|
+
|
2269
|
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
2270
|
+
} // Fallback to just using the name if we couldn't make it throw.
|
2271
|
+
|
2272
|
+
|
2273
|
+
var name = fn ? fn.displayName || fn.name : '';
|
2274
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
2275
|
+
|
2276
|
+
{
|
2277
|
+
if (typeof fn === 'function') {
|
2278
|
+
componentFrameCache.set(fn, syntheticFrame);
|
2279
|
+
}
|
2280
|
+
}
|
2281
|
+
|
2282
|
+
return syntheticFrame;
|
2283
|
+
}
|
2284
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
2285
|
+
{
|
2286
|
+
return describeNativeComponentFrame(fn, false);
|
2287
|
+
}
|
2288
|
+
}
|
2289
|
+
|
2290
|
+
function shouldConstruct(Component) {
|
2291
|
+
var prototype = Component.prototype;
|
2292
|
+
return !!(prototype && prototype.isReactComponent);
|
2293
|
+
}
|
2294
|
+
|
2295
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
2296
|
+
|
2297
|
+
if (type == null) {
|
2298
|
+
return '';
|
2299
|
+
}
|
2300
|
+
|
2301
|
+
if (typeof type === 'function') {
|
2302
|
+
{
|
2303
|
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
2304
|
+
}
|
2305
|
+
}
|
2306
|
+
|
2307
|
+
if (typeof type === 'string') {
|
2308
|
+
return describeBuiltInComponentFrame(type);
|
2309
|
+
}
|
2310
|
+
|
2311
|
+
switch (type) {
|
2312
|
+
case exports.Suspense:
|
2313
|
+
return describeBuiltInComponentFrame('Suspense');
|
2314
|
+
|
2315
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
2316
|
+
return describeBuiltInComponentFrame('SuspenseList');
|
2317
|
+
}
|
2318
|
+
|
2319
|
+
if (typeof type === 'object') {
|
2320
|
+
switch (type.$$typeof) {
|
2321
|
+
case REACT_FORWARD_REF_TYPE:
|
2322
|
+
return describeFunctionComponentFrame(type.render);
|
2323
|
+
|
2324
|
+
case REACT_MEMO_TYPE:
|
2325
|
+
// Memo may contain any component type so we recursively resolve it.
|
2326
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
2327
|
+
|
2328
|
+
case REACT_BLOCK_TYPE:
|
2329
|
+
return describeFunctionComponentFrame(type._render);
|
2330
|
+
|
2331
|
+
case REACT_LAZY_TYPE:
|
2332
|
+
{
|
2333
|
+
var lazyComponent = type;
|
2334
|
+
var payload = lazyComponent._payload;
|
2335
|
+
var init = lazyComponent._init;
|
2336
|
+
|
2337
|
+
try {
|
2338
|
+
// Lazy may contain any component type so we recursively resolve it.
|
2339
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
2340
|
+
} catch (x) {}
|
2341
|
+
}
|
2342
|
+
}
|
2343
|
+
}
|
2344
|
+
|
2345
|
+
return '';
|
2346
|
+
}
|
2347
|
+
|
2348
|
+
var loggedTypeFailures = {};
|
2349
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
2350
|
+
|
2351
|
+
function setCurrentlyValidatingElement(element) {
|
2352
|
+
{
|
2353
|
+
if (element) {
|
2354
|
+
var owner = element._owner;
|
2355
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
2356
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
2357
|
+
} else {
|
2358
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
2359
|
+
}
|
2360
|
+
}
|
2361
|
+
}
|
2362
|
+
|
2363
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
2364
|
+
{
|
2365
|
+
// $FlowFixMe This is okay but Flow doesn't know it.
|
2366
|
+
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
2367
|
+
|
2368
|
+
for (var typeSpecName in typeSpecs) {
|
2369
|
+
if (has(typeSpecs, typeSpecName)) {
|
2370
|
+
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
2371
|
+
// fail the render phase where it didn't fail before. So we log it.
|
2372
|
+
// After these have been cleaned up, we'll let them throw.
|
2373
|
+
|
2374
|
+
try {
|
2375
|
+
// This is intentionally an invariant that gets caught. It's the same
|
2376
|
+
// behavior as without this statement except with a better message.
|
2377
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
2378
|
+
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] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
|
2379
|
+
err.name = 'Invariant Violation';
|
2380
|
+
throw err;
|
2381
|
+
}
|
2382
|
+
|
2383
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
2384
|
+
} catch (ex) {
|
2385
|
+
error$1 = ex;
|
2386
|
+
}
|
2387
|
+
|
2388
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
2389
|
+
setCurrentlyValidatingElement(element);
|
2390
|
+
|
2391
|
+
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
|
2392
|
+
|
2393
|
+
setCurrentlyValidatingElement(null);
|
2394
|
+
}
|
2395
|
+
|
2396
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
2397
|
+
// Only monitor this failure once because there tends to be a lot of the
|
2398
|
+
// same error.
|
2399
|
+
loggedTypeFailures[error$1.message] = true;
|
2400
|
+
setCurrentlyValidatingElement(element);
|
2401
|
+
|
2402
|
+
error('Failed %s type: %s', location, error$1.message);
|
2403
|
+
|
2404
|
+
setCurrentlyValidatingElement(null);
|
2405
|
+
}
|
2406
|
+
}
|
2407
|
+
}
|
2408
|
+
}
|
2409
|
+
}
|
2410
|
+
|
2411
|
+
function setCurrentlyValidatingElement$1(element) {
|
2412
|
+
{
|
2413
|
+
if (element) {
|
2414
|
+
var owner = element._owner;
|
2415
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
2416
|
+
setExtraStackFrame(stack);
|
2417
|
+
} else {
|
2418
|
+
setExtraStackFrame(null);
|
2419
|
+
}
|
2420
|
+
}
|
2421
|
+
}
|
2422
|
+
|
2423
|
+
var propTypesMisspellWarningShown;
|
2424
|
+
|
2425
|
+
{
|
2426
|
+
propTypesMisspellWarningShown = false;
|
2427
|
+
}
|
2428
|
+
|
2429
|
+
function getDeclarationErrorAddendum() {
|
2430
|
+
if (ReactCurrentOwner.current) {
|
2431
|
+
var name = getComponentName(ReactCurrentOwner.current.type);
|
2432
|
+
|
2433
|
+
if (name) {
|
2434
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
2435
|
+
}
|
2436
|
+
}
|
2437
|
+
|
2438
|
+
return '';
|
2439
|
+
}
|
2440
|
+
|
2441
|
+
function getSourceInfoErrorAddendum(source) {
|
2442
|
+
if (source !== undefined) {
|
2443
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
2444
|
+
var lineNumber = source.lineNumber;
|
2445
|
+
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
2446
|
+
}
|
2447
|
+
|
2448
|
+
return '';
|
2449
|
+
}
|
2450
|
+
|
2451
|
+
function getSourceInfoErrorAddendumForProps(elementProps) {
|
2452
|
+
if (elementProps !== null && elementProps !== undefined) {
|
2453
|
+
return getSourceInfoErrorAddendum(elementProps.__source);
|
2454
|
+
}
|
2455
|
+
|
2456
|
+
return '';
|
2457
|
+
}
|
2458
|
+
/**
|
2459
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
2460
|
+
* object keys are not valid. This allows us to keep track of children between
|
2461
|
+
* updates.
|
2462
|
+
*/
|
2463
|
+
|
2464
|
+
|
2465
|
+
var ownerHasKeyUseWarning = {};
|
2466
|
+
|
2467
|
+
function getCurrentComponentErrorInfo(parentType) {
|
2468
|
+
var info = getDeclarationErrorAddendum();
|
2469
|
+
|
2470
|
+
if (!info) {
|
2471
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
2472
|
+
|
2473
|
+
if (parentName) {
|
2474
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
2475
|
+
}
|
2476
|
+
}
|
2477
|
+
|
2478
|
+
return info;
|
2479
|
+
}
|
2480
|
+
/**
|
2481
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
2482
|
+
* This element is in an array. The array could grow and shrink or be
|
2483
|
+
* reordered. All children that haven't already been validated are required to
|
2484
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
2485
|
+
* will only be shown once.
|
2486
|
+
*
|
2487
|
+
* @internal
|
2488
|
+
* @param {ReactElement} element Element that requires a key.
|
2489
|
+
* @param {*} parentType element's parent's type.
|
2490
|
+
*/
|
2491
|
+
|
2492
|
+
|
2493
|
+
function validateExplicitKey(element, parentType) {
|
2494
|
+
if (!element._store || element._store.validated || element.key != null) {
|
2495
|
+
return;
|
2496
|
+
}
|
2497
|
+
|
2498
|
+
element._store.validated = true;
|
2499
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
2500
|
+
|
2501
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
2502
|
+
return;
|
2503
|
+
}
|
2504
|
+
|
2505
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
2506
|
+
// property, it may be the creator of the child that's responsible for
|
2507
|
+
// assigning it a key.
|
2508
|
+
|
2509
|
+
var childOwner = '';
|
2510
|
+
|
2511
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
2512
|
+
// Give the component that originally created this child.
|
2513
|
+
childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
|
2514
|
+
}
|
2515
|
+
|
2516
|
+
{
|
2517
|
+
setCurrentlyValidatingElement$1(element);
|
2518
|
+
|
2519
|
+
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
2520
|
+
|
2521
|
+
setCurrentlyValidatingElement$1(null);
|
2522
|
+
}
|
2523
|
+
}
|
2524
|
+
/**
|
2525
|
+
* Ensure that every element either is passed in a static location, in an
|
2526
|
+
* array with an explicit keys property defined, or in an object literal
|
2527
|
+
* with valid key property.
|
2528
|
+
*
|
2529
|
+
* @internal
|
2530
|
+
* @param {ReactNode} node Statically passed child of any type.
|
2531
|
+
* @param {*} parentType node's parent's type.
|
2532
|
+
*/
|
2533
|
+
|
2534
|
+
|
2535
|
+
function validateChildKeys(node, parentType) {
|
2536
|
+
if (typeof node !== 'object') {
|
2537
|
+
return;
|
2538
|
+
}
|
2539
|
+
|
2540
|
+
if (Array.isArray(node)) {
|
2541
|
+
for (var i = 0; i < node.length; i++) {
|
2542
|
+
var child = node[i];
|
2543
|
+
|
2544
|
+
if (isValidElement(child)) {
|
2545
|
+
validateExplicitKey(child, parentType);
|
2546
|
+
}
|
2547
|
+
}
|
2548
|
+
} else if (isValidElement(node)) {
|
2549
|
+
// This element was passed in a valid location.
|
2550
|
+
if (node._store) {
|
2551
|
+
node._store.validated = true;
|
2552
|
+
}
|
2553
|
+
} else if (node) {
|
2554
|
+
var iteratorFn = getIteratorFn(node);
|
2555
|
+
|
2556
|
+
if (typeof iteratorFn === 'function') {
|
2557
|
+
// Entry iterators used to provide implicit keys,
|
2558
|
+
// but now we print a separate warning for them later.
|
2559
|
+
if (iteratorFn !== node.entries) {
|
2560
|
+
var iterator = iteratorFn.call(node);
|
2561
|
+
var step;
|
2562
|
+
|
2563
|
+
while (!(step = iterator.next()).done) {
|
2564
|
+
if (isValidElement(step.value)) {
|
2565
|
+
validateExplicitKey(step.value, parentType);
|
2566
|
+
}
|
2567
|
+
}
|
2568
|
+
}
|
2569
|
+
}
|
2570
|
+
}
|
2571
|
+
}
|
2572
|
+
/**
|
2573
|
+
* Given an element, validate that its props follow the propTypes definition,
|
2574
|
+
* provided by the type.
|
2575
|
+
*
|
2576
|
+
* @param {ReactElement} element
|
2577
|
+
*/
|
2578
|
+
|
2579
|
+
|
2580
|
+
function validatePropTypes(element) {
|
2581
|
+
{
|
2582
|
+
var type = element.type;
|
2583
|
+
|
2584
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
2585
|
+
return;
|
2586
|
+
}
|
2587
|
+
|
2588
|
+
var propTypes;
|
2589
|
+
|
2590
|
+
if (typeof type === 'function') {
|
2591
|
+
propTypes = type.propTypes;
|
2592
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
2593
|
+
// Inner props are checked in the reconciler.
|
2594
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
2595
|
+
propTypes = type.propTypes;
|
2596
|
+
} else {
|
2597
|
+
return;
|
2598
|
+
}
|
2599
|
+
|
2600
|
+
if (propTypes) {
|
2601
|
+
// Intentionally inside to avoid triggering lazy initializers:
|
2602
|
+
var name = getComponentName(type);
|
2603
|
+
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
2604
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
2605
|
+
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
2606
|
+
|
2607
|
+
var _name = getComponentName(type);
|
2608
|
+
|
2609
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
2610
|
+
}
|
2611
|
+
|
2612
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
2613
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
2614
|
+
}
|
2615
|
+
}
|
2616
|
+
}
|
2617
|
+
/**
|
2618
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
2619
|
+
* @param {ReactElement} fragment
|
2620
|
+
*/
|
2621
|
+
|
2622
|
+
|
2623
|
+
function validateFragmentProps(fragment) {
|
2624
|
+
{
|
2625
|
+
var keys = Object.keys(fragment.props);
|
2626
|
+
|
2627
|
+
for (var i = 0; i < keys.length; i++) {
|
2628
|
+
var key = keys[i];
|
2629
|
+
|
2630
|
+
if (key !== 'children' && key !== 'key') {
|
2631
|
+
setCurrentlyValidatingElement$1(fragment);
|
2632
|
+
|
2633
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
2634
|
+
|
2635
|
+
setCurrentlyValidatingElement$1(null);
|
2636
|
+
break;
|
2637
|
+
}
|
2638
|
+
}
|
2639
|
+
|
2640
|
+
if (fragment.ref !== null) {
|
2641
|
+
setCurrentlyValidatingElement$1(fragment);
|
2642
|
+
|
2643
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
2644
|
+
|
2645
|
+
setCurrentlyValidatingElement$1(null);
|
2646
|
+
}
|
2647
|
+
}
|
2648
|
+
}
|
2649
|
+
function createElementWithValidation(type, props, children) {
|
2650
|
+
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
2651
|
+
// succeed and there will likely be errors in render.
|
2652
|
+
|
2653
|
+
if (!validType) {
|
2654
|
+
var info = '';
|
2655
|
+
|
2656
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
2657
|
+
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
2658
|
+
}
|
2659
|
+
|
2660
|
+
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
2661
|
+
|
2662
|
+
if (sourceInfo) {
|
2663
|
+
info += sourceInfo;
|
2664
|
+
} else {
|
2665
|
+
info += getDeclarationErrorAddendum();
|
2666
|
+
}
|
2667
|
+
|
2668
|
+
var typeString;
|
2669
|
+
|
2670
|
+
if (type === null) {
|
2671
|
+
typeString = 'null';
|
2672
|
+
} else if (Array.isArray(type)) {
|
2673
|
+
typeString = 'array';
|
2674
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
2675
|
+
typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
|
2676
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
2677
|
+
} else {
|
2678
|
+
typeString = typeof type;
|
2679
|
+
}
|
2680
|
+
|
2681
|
+
{
|
2682
|
+
error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
2683
|
+
}
|
2684
|
+
}
|
2685
|
+
|
2686
|
+
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
|
2687
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
2688
|
+
|
2689
|
+
if (element == null) {
|
2690
|
+
return element;
|
2691
|
+
} // Skip key warning if the type isn't valid since our key validation logic
|
2692
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
2693
|
+
// We don't want exception behavior to differ between dev and prod.
|
2694
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
2695
|
+
// fixed, the key warnings will appear.)
|
2696
|
+
|
2697
|
+
|
2698
|
+
if (validType) {
|
2699
|
+
for (var i = 2; i < arguments.length; i++) {
|
2700
|
+
validateChildKeys(arguments[i], type);
|
2701
|
+
}
|
2702
|
+
}
|
2703
|
+
|
2704
|
+
if (type === exports.Fragment) {
|
2705
|
+
validateFragmentProps(element);
|
2706
|
+
} else {
|
2707
|
+
validatePropTypes(element);
|
2708
|
+
}
|
2709
|
+
|
2710
|
+
return element;
|
2711
|
+
}
|
2712
|
+
var didWarnAboutDeprecatedCreateFactory = false;
|
2713
|
+
function createFactoryWithValidation(type) {
|
2714
|
+
var validatedFactory = createElementWithValidation.bind(null, type);
|
2715
|
+
validatedFactory.type = type;
|
2716
|
+
|
2717
|
+
{
|
2718
|
+
if (!didWarnAboutDeprecatedCreateFactory) {
|
2719
|
+
didWarnAboutDeprecatedCreateFactory = true;
|
2720
|
+
|
2721
|
+
warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
|
2722
|
+
} // Legacy hook: remove it
|
2723
|
+
|
2724
|
+
|
2725
|
+
Object.defineProperty(validatedFactory, 'type', {
|
2726
|
+
enumerable: false,
|
2727
|
+
get: function () {
|
2728
|
+
warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
2729
|
+
|
2730
|
+
Object.defineProperty(this, 'type', {
|
2731
|
+
value: type
|
2732
|
+
});
|
2733
|
+
return type;
|
2734
|
+
}
|
2735
|
+
});
|
2736
|
+
}
|
2737
|
+
|
2738
|
+
return validatedFactory;
|
2739
|
+
}
|
2740
|
+
function cloneElementWithValidation(element, props, children) {
|
2741
|
+
var newElement = cloneElement.apply(this, arguments);
|
2742
|
+
|
2743
|
+
for (var i = 2; i < arguments.length; i++) {
|
2744
|
+
validateChildKeys(arguments[i], newElement.type);
|
2745
|
+
}
|
2746
|
+
|
2747
|
+
validatePropTypes(newElement);
|
2748
|
+
return newElement;
|
2749
|
+
}
|
2750
|
+
|
2751
|
+
{
|
2752
|
+
|
2753
|
+
try {
|
2754
|
+
var frozenObject = Object.freeze({});
|
2755
|
+
/* eslint-disable no-new */
|
2756
|
+
|
2757
|
+
new Map([[frozenObject, null]]);
|
2758
|
+
new Set([frozenObject]);
|
2759
|
+
/* eslint-enable no-new */
|
2760
|
+
} catch (e) {
|
2761
|
+
}
|
2762
|
+
}
|
2763
|
+
|
2764
|
+
var createElement$1 = createElementWithValidation ;
|
2765
|
+
var cloneElement$1 = cloneElementWithValidation ;
|
2766
|
+
var createFactory = createFactoryWithValidation ;
|
2767
|
+
var Children = {
|
2768
|
+
map: mapChildren,
|
2769
|
+
forEach: forEachChildren,
|
2770
|
+
count: countChildren,
|
2771
|
+
toArray: toArray,
|
2772
|
+
only: onlyChild
|
2773
|
+
};
|
2774
|
+
|
2775
|
+
exports.Children = Children;
|
2776
|
+
exports.Component = Component;
|
2777
|
+
exports.PureComponent = PureComponent;
|
2778
|
+
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
2779
|
+
exports.cloneElement = cloneElement$1;
|
2780
|
+
exports.createContext = createContext;
|
2781
|
+
exports.createElement = createElement$1;
|
2782
|
+
exports.createFactory = createFactory;
|
2783
|
+
exports.createRef = createRef;
|
2784
|
+
exports.forwardRef = forwardRef;
|
2785
|
+
exports.isValidElement = isValidElement;
|
2786
|
+
exports.lazy = lazy;
|
2787
|
+
exports.memo = memo;
|
2788
|
+
exports.useCallback = useCallback;
|
2789
|
+
exports.useContext = useContext;
|
2790
|
+
exports.useDebugValue = useDebugValue;
|
2791
|
+
exports.useEffect = useEffect;
|
2792
|
+
exports.useImperativeHandle = useImperativeHandle;
|
2793
|
+
exports.useLayoutEffect = useLayoutEffect;
|
2794
|
+
exports.useMemo = useMemo;
|
2795
|
+
exports.useReducer = useReducer;
|
2796
|
+
exports.useRef = useRef;
|
2797
|
+
exports.useState = useState;
|
2798
|
+
exports.version = ReactVersion;
|
2799
|
+
})();
|
2800
|
+
}
|
2801
|
+
|
2802
|
+
|
2803
|
+
/***/ }),
|
2804
|
+
/* 7 */
|
2805
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2806
|
+
|
2807
|
+
"use strict";
|
2808
|
+
/* harmony export (immutable) */ __webpack_exports__["a"] = ConceptList;
|
2809
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
|
2810
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
|
2811
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__follow_button_follow_button__ = __webpack_require__(2);
|
2812
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
2813
|
+
|
2814
|
+
|
2815
|
+
|
2816
|
+
|
2817
|
+
function ConceptList({ flags, concepts, contentType, conceptListTitle, trackable }) {
|
2818
|
+
|
2819
|
+
const {
|
2820
|
+
myFtApi,
|
2821
|
+
myFtApiWrite
|
2822
|
+
} = flags;
|
2823
|
+
|
2824
|
+
const generateTrackableProps = (primary, seconday) => {
|
2825
|
+
return {
|
2826
|
+
'data-trackable': primary ? primary : seconday
|
2827
|
+
};
|
2828
|
+
};
|
2829
|
+
|
2830
|
+
const shouldDisplay = () => {
|
2831
|
+
if (myFtApi && myFtApiWrite && Array.isArray(concepts) && concepts.length) {
|
2832
|
+
return true;
|
2833
|
+
}
|
2834
|
+
|
2835
|
+
return false;
|
2836
|
+
};
|
2837
|
+
|
2838
|
+
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2839
|
+
__WEBPACK_IMPORTED_MODULE_0_react__["Fragment"],
|
2840
|
+
null,
|
2841
|
+
shouldDisplay() && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2842
|
+
'div',
|
2843
|
+
_extends({
|
2844
|
+
className: 'concept-list'
|
2845
|
+
}, generateTrackableProps(trackable, 'concept-list')),
|
2846
|
+
(contentType || conceptListTitle) && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2847
|
+
'h2',
|
2848
|
+
{ className: 'concept-list__title' },
|
2849
|
+
conceptListTitle ? conceptListTitle : `Follow the topics in this ${contentType}`
|
2850
|
+
),
|
2851
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2852
|
+
'ul',
|
2853
|
+
{ className: 'concept-list__list' },
|
2854
|
+
concepts.map((concept, index) => {
|
2855
|
+
const {
|
2856
|
+
relativeUrl,
|
2857
|
+
url,
|
2858
|
+
conceptTrackable,
|
2859
|
+
prefLabel,
|
2860
|
+
id
|
2861
|
+
} = concept;
|
2862
|
+
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2863
|
+
'li',
|
2864
|
+
{ key: index, className: 'concept-list__list-item' },
|
2865
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2866
|
+
'a',
|
2867
|
+
_extends({
|
2868
|
+
href: relativeUrl || url
|
2869
|
+
}, generateTrackableProps(conceptTrackable, 'concept'), {
|
2870
|
+
className: 'concept-list__concept' }),
|
2871
|
+
prefLabel
|
2872
|
+
),
|
2873
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_1__follow_button_follow_button__["a" /* default */], { conceptId: id, name: prefLabel, flags: flags })
|
2874
|
+
);
|
2875
|
+
})
|
2876
|
+
)
|
2877
|
+
)
|
2878
|
+
);
|
2879
|
+
}
|
2880
|
+
|
2881
|
+
/***/ }),
|
2882
|
+
/* 8 */
|
2883
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2884
|
+
|
2885
|
+
"use strict";
|
2886
|
+
/* harmony export (immutable) */ __webpack_exports__["a"] = Collections;
|
2887
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
|
2888
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
|
2889
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__csrf_token_input__ = __webpack_require__(1);
|
2890
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__follow_button_follow_button__ = __webpack_require__(2);
|
2891
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
2892
|
+
|
2893
|
+
|
2894
|
+
|
2895
|
+
|
2896
|
+
|
2897
|
+
function Collections({ title, liteStyle, flags, collectionName, trackable, concepts = [] }) {
|
2898
|
+
const getLiteStyleModifier = () => liteStyle ? 'lite' : 'regular';
|
2899
|
+
let formProps = {
|
2900
|
+
method: 'POST',
|
2901
|
+
action: '#',
|
2902
|
+
'data-myft-ui': 'follow',
|
2903
|
+
'data-concept-id': concepts.map(concept => concept.id).join(',')
|
2904
|
+
};
|
2905
|
+
|
2906
|
+
if (collectionName) {
|
2907
|
+
formProps['data-myft-tracking'] = collectionName;
|
2908
|
+
}
|
2909
|
+
|
2910
|
+
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2911
|
+
'section',
|
2912
|
+
{
|
2913
|
+
className: `collection collection--${getLiteStyleModifier()}`,
|
2914
|
+
'data-trackable': trackable ? trackable : 'collection' },
|
2915
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2916
|
+
'header',
|
2917
|
+
{ className: `collection__header collection__header--${getLiteStyleModifier()}` },
|
2918
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2919
|
+
'h2',
|
2920
|
+
{ className: `collection__title collection__title--${getLiteStyleModifier()}` },
|
2921
|
+
title
|
2922
|
+
)
|
2923
|
+
),
|
2924
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2925
|
+
'ul',
|
2926
|
+
{ className: 'collection__concepts' },
|
2927
|
+
concepts && concepts.map((concept, index) => __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2928
|
+
'li',
|
2929
|
+
{ className: 'collection__concept', key: index },
|
2930
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_2__follow_button_follow_button__["a" /* default */], { variant: liteStyle ? 'primary' : 'inverse', buttonText: concept.name, flags: flags, collectionName: collectionName })
|
2931
|
+
))
|
2932
|
+
),
|
2933
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2934
|
+
'div',
|
2935
|
+
{ className: 'collection__meta' },
|
2936
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2937
|
+
'form',
|
2938
|
+
_extends({}, formProps, {
|
2939
|
+
className: 'n-myft-ui n-myft-ui--follow n-ui-hide-core collection-follow-all' }),
|
2940
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('input', {
|
2941
|
+
type: 'hidden',
|
2942
|
+
name: 'directType',
|
2943
|
+
value: concepts.map(concept => concept.directType).join(',')
|
2944
|
+
}),
|
2945
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_1__csrf_token_input__["a" /* default */], null),
|
2946
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('input', {
|
2947
|
+
type: 'hidden',
|
2948
|
+
name: 'name',
|
2949
|
+
value: concepts.map(concept => concept.name).join(',')
|
2950
|
+
}),
|
2951
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2952
|
+
'button',
|
2953
|
+
{
|
2954
|
+
type: 'submit',
|
2955
|
+
'aria-pressed': 'false',
|
2956
|
+
className: `collection-follow-all__button collection-follow-all__button--${getLiteStyleModifier()}`,
|
2957
|
+
'data-trackable': 'follow all',
|
2958
|
+
'data-concept-id': concepts.map(concept => concept.id).join(','),
|
2959
|
+
'aria-label': `Add all topics in the ${title} collection to my F T`,
|
2960
|
+
'data-alternate-label': `Remove all topics in the ${title} collection from my F T`,
|
2961
|
+
'data-alternate-text': 'Added',
|
2962
|
+
title: `Add all topics in the ${title} collection to my F T` },
|
2963
|
+
'Add all to myFT'
|
2964
|
+
)
|
2965
|
+
)
|
2966
|
+
)
|
2967
|
+
);
|
2968
|
+
}
|
2969
|
+
|
2970
|
+
/***/ }),
|
2971
|
+
/* 9 */
|
2972
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
2973
|
+
|
2974
|
+
"use strict";
|
2975
|
+
/* harmony export (immutable) */ __webpack_exports__["a"] = SaveForLater;
|
2976
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
|
2977
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
|
2978
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__csrf_token_input__ = __webpack_require__(1);
|
2979
|
+
|
2980
|
+
|
2981
|
+
|
2982
|
+
const ButtonContent = ({ saveButtonWithIcon, buttonText, isSaved, appIsStreamPage }) => {
|
2983
|
+
|
2984
|
+
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2985
|
+
__WEBPACK_IMPORTED_MODULE_0_react__["Fragment"],
|
2986
|
+
null,
|
2987
|
+
saveButtonWithIcon && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2988
|
+
'span',
|
2989
|
+
{ className: 'save-button-with-icon-copy', 'data-variant-label': true },
|
2990
|
+
buttonText && buttonText,
|
2991
|
+
!buttonText && (isSaved ? 'Saved' : 'Save')
|
2992
|
+
),
|
2993
|
+
!saveButtonWithIcon && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2994
|
+
__WEBPACK_IMPORTED_MODULE_0_react__["Fragment"],
|
2995
|
+
null,
|
2996
|
+
buttonText && buttonText,
|
2997
|
+
!buttonText && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
2998
|
+
__WEBPACK_IMPORTED_MODULE_0_react__["Fragment"],
|
2999
|
+
null,
|
3000
|
+
appIsStreamPage !== true && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
3001
|
+
__WEBPACK_IMPORTED_MODULE_0_react__["Fragment"],
|
3002
|
+
null,
|
3003
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
3004
|
+
'span',
|
3005
|
+
{ className: 'save-button-longer-copy', 'data-variant-label': true },
|
3006
|
+
isSaved ? 'Saved ' : 'Save '
|
3007
|
+
),
|
3008
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
3009
|
+
'span',
|
3010
|
+
{ className: 'n-myft-ui__button--viewport-large', 'aria-hidden': 'true' },
|
3011
|
+
'to myFT'
|
3012
|
+
)
|
3013
|
+
),
|
3014
|
+
appIsStreamPage === true && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
3015
|
+
'span',
|
3016
|
+
null,
|
3017
|
+
isSaved ? 'Saved' : 'Save'
|
3018
|
+
)
|
3019
|
+
)
|
3020
|
+
)
|
3021
|
+
);
|
3022
|
+
};
|
3023
|
+
function SaveForLater({ flags, contentId, title, variant, trackableId, isSaved, appIsStreamPage, alternateText, saveButtonWithIcon, buttonText }) {
|
3024
|
+
|
3025
|
+
const { myFtApiWrite } = flags;
|
3026
|
+
|
3027
|
+
const generateSubmitButtonProps = () => {
|
3028
|
+
let props = {
|
3029
|
+
type: 'submit',
|
3030
|
+
'data-trackable': trackableId ? trackableId : 'save-for-later',
|
3031
|
+
'data-text-variant': appIsStreamPage !== true ? 'save-button-with-icon-copy' : 'save-button-longer-copy',
|
3032
|
+
'data-content-id': contentId,
|
3033
|
+
className: saveButtonWithIcon ? 'n-myft-ui__save-button-with-icon' : `n-myft-ui__button ${variant ? `n-myft-ui__button--${variant}` : ''}`
|
3034
|
+
};
|
3035
|
+
|
3036
|
+
if (isSaved) {
|
3037
|
+
let titleText = `${title ? `${title} is` : ''} Saved to myFT`;
|
3038
|
+
props['title'] = title;
|
3039
|
+
props['aria-label'] = titleText;
|
3040
|
+
props['data-alternate-label'] = title ? `Save ${title} to myFT for later` : 'Save this article to myFT for later';
|
3041
|
+
props['aria-pressed'] = true;
|
3042
|
+
} else {
|
3043
|
+
let titleText = title ? `Save ${title} to myFT for later` : 'Save this article to myFT for later';
|
3044
|
+
props['title'] = titleText;
|
3045
|
+
props['aria-label'] = titleText;
|
3046
|
+
props['data-alternate-label'] = `${title ? `${title} is` : ''} Saved to myFT`;
|
3047
|
+
props['aria-pressed'] = false;
|
3048
|
+
}
|
3049
|
+
|
3050
|
+
if (alternateText) {
|
3051
|
+
props['data-alternate-text'] = alternateText;
|
3052
|
+
} else if (isSaved) {
|
3053
|
+
props['data-alternate-text'] = 'Save ';
|
3054
|
+
} else {
|
3055
|
+
props['data-alternate-text'] = 'Saved ';
|
3056
|
+
}
|
3057
|
+
|
3058
|
+
return props;
|
3059
|
+
};
|
3060
|
+
|
3061
|
+
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
3062
|
+
__WEBPACK_IMPORTED_MODULE_0_react__["Fragment"],
|
3063
|
+
null,
|
3064
|
+
myFtApiWrite && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
3065
|
+
'form',
|
3066
|
+
{ className: 'n-myft-ui n-myft-ui--save', method: 'GET',
|
3067
|
+
'data-content-id': contentId,
|
3068
|
+
'data-myft-ui': 'saved',
|
3069
|
+
action: `/myft/save/${contentId}`,
|
3070
|
+
'data-js-action': `/__myft/api/core/saved/content/${contentId}?method=put` },
|
3071
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_1__csrf_token_input__["a" /* default */], null),
|
3072
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('div', {
|
3073
|
+
className: 'n-myft-ui__announcement o-normalise-visually-hidden',
|
3074
|
+
'aria-live': 'assertive',
|
3075
|
+
'data-pressed-text': 'Article saved in My FT.',
|
3076
|
+
'data-unpressed-text': 'Removed article from My FT.'
|
3077
|
+
}),
|
3078
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
3079
|
+
'button',
|
3080
|
+
generateSubmitButtonProps(),
|
3081
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(ButtonContent, { buttonText: buttonText, saveButtonWithIcon: saveButtonWithIcon, isSaved: isSaved, appIsStreamPage: appIsStreamPage })
|
3082
|
+
)
|
3083
|
+
)
|
3084
|
+
);
|
3085
|
+
}
|
3086
|
+
|
3087
|
+
/***/ }),
|
3088
|
+
/* 10 */
|
3089
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
3090
|
+
|
3091
|
+
"use strict";
|
3092
|
+
/* harmony export (immutable) */ __webpack_exports__["a"] = PinButton;
|
3093
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);
|
3094
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);
|
3095
|
+
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__csrf_token_input__ = __webpack_require__(1);
|
3096
|
+
|
3097
|
+
|
3098
|
+
function PinButton({ showPrioritiseButton, id, name, directType, prioritised }) {
|
3099
|
+
|
3100
|
+
const getAction = () => `/__myft/api/core/prioritised/concept/${id}?method=${prioritised ? 'delete' : 'put'}`;
|
3101
|
+
|
3102
|
+
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
3103
|
+
__WEBPACK_IMPORTED_MODULE_0_react__["Fragment"],
|
3104
|
+
null,
|
3105
|
+
showPrioritiseButton && __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
3106
|
+
__WEBPACK_IMPORTED_MODULE_0_react__["Fragment"],
|
3107
|
+
null,
|
3108
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('span', { className: 'myft-pin-divider' }),
|
3109
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
3110
|
+
'div',
|
3111
|
+
{ className: 'myft-pin-button-wrapper' },
|
3112
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(
|
3113
|
+
'form',
|
3114
|
+
{ method: 'post', action: getAction(), 'data-myft-prioritise': true },
|
3115
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_1__csrf_token_input__["a" /* default */], null),
|
3116
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('input', { type: 'hidden', value: name, name: 'name' }),
|
3117
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('input', { type: 'hidden', value: directType || 'http://www.ft.com/ontology/concept/Concept', name: 'directType' }),
|
3118
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('div', {
|
3119
|
+
className: 'n-myft-ui__announcement o-normalise-visually-hidden',
|
3120
|
+
'aria-live': 'assertive',
|
3121
|
+
'data-pressed-text': `${name} pinned in myFT.`,
|
3122
|
+
'data-unpressed-text': `Unpinned ${name} from myFT.`
|
3123
|
+
}),
|
3124
|
+
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('button', { id: `myft-pin-button__${id}`,
|
3125
|
+
className: 'myft-pin-button',
|
3126
|
+
'data-prioritise-button': true,
|
3127
|
+
'data-trackable': 'prioritised',
|
3128
|
+
'data-concept-id': id,
|
3129
|
+
'data-prioritised': prioritised ? true : false,
|
3130
|
+
'aria-label': `${prioritised ? 'Unpin' : 'Pin'} ${name} ${prioritised ? 'from' : 'in'} myFT`,
|
3131
|
+
'aria-pressed': prioritised ? true : false,
|
3132
|
+
title: `${prioritised ? 'Unpin' : 'Pin'} ${name}` })
|
3133
|
+
)
|
3134
|
+
)
|
3135
|
+
)
|
3136
|
+
);
|
3137
|
+
}
|
3138
|
+
|
3139
|
+
/***/ })
|
3140
|
+
/******/ ]);
|
3141
|
+
});
|