1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | (function (global, factory) {
|
11 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
12 | typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
|
13 | (global = global || self, factory(global.ReactDOMServer = {}, global.React));
|
14 | }(this, (function (exports, React) { 'use strict';
|
15 |
|
16 | var ReactVersion = '18.0.0-fc46dba67-20220329';
|
17 |
|
18 | var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | function warn(format) {
|
26 | {
|
27 | {
|
28 | for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
29 | args[_key - 1] = arguments[_key];
|
30 | }
|
31 |
|
32 | printWarning('warn', format, args);
|
33 | }
|
34 | }
|
35 | }
|
36 | function error(format) {
|
37 | {
|
38 | {
|
39 | for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
40 | args[_key2 - 1] = arguments[_key2];
|
41 | }
|
42 |
|
43 | printWarning('error', format, args);
|
44 | }
|
45 | }
|
46 | }
|
47 |
|
48 | function printWarning(level, format, args) {
|
49 |
|
50 |
|
51 | {
|
52 | var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
53 | var stack = ReactDebugCurrentFrame.getStackAddendum();
|
54 |
|
55 | if (stack !== '') {
|
56 | format += '%s';
|
57 | args = args.concat([stack]);
|
58 | }
|
59 |
|
60 |
|
61 | var argsWithFormat = args.map(function (item) {
|
62 | return String(item);
|
63 | });
|
64 |
|
65 | argsWithFormat.unshift('Warning: ' + format);
|
66 |
|
67 |
|
68 |
|
69 | Function.prototype.apply.call(console[level], console, argsWithFormat);
|
70 | }
|
71 | }
|
72 |
|
73 | function scheduleWork(callback) {
|
74 | callback();
|
75 | }
|
76 | var VIEW_SIZE = 512;
|
77 | var currentView = null;
|
78 | var writtenBytes = 0;
|
79 | function beginWriting(destination) {
|
80 | currentView = new Uint8Array(VIEW_SIZE);
|
81 | writtenBytes = 0;
|
82 | }
|
83 | function writeChunk(destination, chunk) {
|
84 | if (chunk.length === 0) {
|
85 | return;
|
86 | }
|
87 |
|
88 | if (chunk.length > VIEW_SIZE) {
|
89 |
|
90 |
|
91 |
|
92 | if (writtenBytes > 0) {
|
93 | destination.enqueue(new Uint8Array(currentView.buffer, 0, writtenBytes));
|
94 | currentView = new Uint8Array(VIEW_SIZE);
|
95 | writtenBytes = 0;
|
96 | }
|
97 |
|
98 | destination.enqueue(chunk);
|
99 | return;
|
100 | }
|
101 |
|
102 | var bytesToWrite = chunk;
|
103 | var allowableBytes = currentView.length - writtenBytes;
|
104 |
|
105 | if (allowableBytes < bytesToWrite.length) {
|
106 |
|
107 |
|
108 | if (allowableBytes === 0) {
|
109 |
|
110 | destination.enqueue(currentView);
|
111 | } else {
|
112 |
|
113 |
|
114 | currentView.set(bytesToWrite.subarray(0, allowableBytes), writtenBytes);
|
115 |
|
116 | destination.enqueue(currentView);
|
117 | bytesToWrite = bytesToWrite.subarray(allowableBytes);
|
118 | }
|
119 |
|
120 | currentView = new Uint8Array(VIEW_SIZE);
|
121 | writtenBytes = 0;
|
122 | }
|
123 |
|
124 | currentView.set(bytesToWrite, writtenBytes);
|
125 | writtenBytes += bytesToWrite.length;
|
126 | }
|
127 | function writeChunkAndReturn(destination, chunk) {
|
128 | writeChunk(destination, chunk);
|
129 |
|
130 | return true;
|
131 | }
|
132 | function completeWriting(destination) {
|
133 | if (currentView && writtenBytes > 0) {
|
134 | destination.enqueue(new Uint8Array(currentView.buffer, 0, writtenBytes));
|
135 | currentView = null;
|
136 | writtenBytes = 0;
|
137 | }
|
138 | }
|
139 | function close(destination) {
|
140 | destination.close();
|
141 | }
|
142 | var textEncoder = new TextEncoder();
|
143 | function stringToChunk(content) {
|
144 | return textEncoder.encode(content);
|
145 | }
|
146 | function stringToPrecomputedChunk(content) {
|
147 | return textEncoder.encode(content);
|
148 | }
|
149 | function closeWithError(destination, error) {
|
150 | if (typeof destination.error === 'function') {
|
151 |
|
152 | destination.error(error);
|
153 | } else {
|
154 |
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 | destination.close();
|
161 | }
|
162 | }
|
163 |
|
164 | |
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 | function typeName(value) {
|
175 | {
|
176 |
|
177 | var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
178 | var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
179 | return type;
|
180 | }
|
181 | }
|
182 |
|
183 |
|
184 | function willCoercionThrow(value) {
|
185 | {
|
186 | try {
|
187 | testStringCoercion(value);
|
188 | return false;
|
189 | } catch (e) {
|
190 | return true;
|
191 | }
|
192 | }
|
193 | }
|
194 |
|
195 | function testStringCoercion(value) {
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 | return '' + value;
|
220 | }
|
221 |
|
222 | function checkAttributeStringCoercion(value, attributeName) {
|
223 | {
|
224 | if (willCoercionThrow(value)) {
|
225 | error('The provided `%s` attribute is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', attributeName, typeName(value));
|
226 |
|
227 | return testStringCoercion(value);
|
228 | }
|
229 | }
|
230 | }
|
231 | function checkCSSPropertyStringCoercion(value, propName) {
|
232 | {
|
233 | if (willCoercionThrow(value)) {
|
234 | error('The provided `%s` CSS property is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', propName, typeName(value));
|
235 |
|
236 | return testStringCoercion(value);
|
237 | }
|
238 | }
|
239 | }
|
240 | function checkHtmlStringCoercion(value) {
|
241 | {
|
242 | if (willCoercionThrow(value)) {
|
243 | error('The provided HTML markup uses a value of unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
244 |
|
245 | return testStringCoercion(value);
|
246 | }
|
247 | }
|
248 | }
|
249 |
|
250 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
251 |
|
252 |
|
253 |
|
254 | var RESERVED = 0;
|
255 |
|
256 |
|
257 | var STRING = 1;
|
258 |
|
259 |
|
260 |
|
261 |
|
262 | var BOOLEANISH_STRING = 2;
|
263 |
|
264 |
|
265 |
|
266 | var BOOLEAN = 3;
|
267 |
|
268 |
|
269 |
|
270 |
|
271 | var OVERLOADED_BOOLEAN = 4;
|
272 |
|
273 |
|
274 | var NUMERIC = 5;
|
275 |
|
276 |
|
277 | var POSITIVE_NUMERIC = 6;
|
278 |
|
279 |
|
280 | var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
281 |
|
282 |
|
283 | var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
284 | var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
285 | var illegalAttributeNameCache = {};
|
286 | var validatedAttributeNameCache = {};
|
287 | function isAttributeNameSafe(attributeName) {
|
288 | if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
|
289 | return true;
|
290 | }
|
291 |
|
292 | if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
|
293 | return false;
|
294 | }
|
295 |
|
296 | if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
|
297 | validatedAttributeNameCache[attributeName] = true;
|
298 | return true;
|
299 | }
|
300 |
|
301 | illegalAttributeNameCache[attributeName] = true;
|
302 |
|
303 | {
|
304 | error('Invalid attribute name: `%s`', attributeName);
|
305 | }
|
306 |
|
307 | return false;
|
308 | }
|
309 | function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
|
310 | if (propertyInfo !== null && propertyInfo.type === RESERVED) {
|
311 | return false;
|
312 | }
|
313 |
|
314 | switch (typeof value) {
|
315 | case 'function':
|
316 |
|
317 | case 'symbol':
|
318 |
|
319 | return true;
|
320 |
|
321 | case 'boolean':
|
322 | {
|
323 | if (isCustomComponentTag) {
|
324 | return false;
|
325 | }
|
326 |
|
327 | if (propertyInfo !== null) {
|
328 | return !propertyInfo.acceptsBooleans;
|
329 | } else {
|
330 | var prefix = name.toLowerCase().slice(0, 5);
|
331 | return prefix !== 'data-' && prefix !== 'aria-';
|
332 | }
|
333 | }
|
334 |
|
335 | default:
|
336 | return false;
|
337 | }
|
338 | }
|
339 | function getPropertyInfo(name) {
|
340 | return properties.hasOwnProperty(name) ? properties[name] : null;
|
341 | }
|
342 |
|
343 | function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL, removeEmptyString) {
|
344 | this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
|
345 | this.attributeName = attributeName;
|
346 | this.attributeNamespace = attributeNamespace;
|
347 | this.mustUseProperty = mustUseProperty;
|
348 | this.propertyName = name;
|
349 | this.type = type;
|
350 | this.sanitizeURL = sanitizeURL;
|
351 | this.removeEmptyString = removeEmptyString;
|
352 | }
|
353 |
|
354 |
|
355 |
|
356 |
|
357 | var properties = {};
|
358 |
|
359 | var reservedProps = ['children', 'dangerouslySetInnerHTML',
|
360 |
|
361 |
|
362 | 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'];
|
363 |
|
364 | reservedProps.forEach(function (name) {
|
365 | properties[name] = new PropertyInfoRecord(name, RESERVED, false,
|
366 | name,
|
367 | null,
|
368 | false,
|
369 | false);
|
370 | });
|
371 |
|
372 |
|
373 | [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
|
374 | var name = _ref[0],
|
375 | attributeName = _ref[1];
|
376 | properties[name] = new PropertyInfoRecord(name, STRING, false,
|
377 | attributeName,
|
378 | null,
|
379 | false,
|
380 | false);
|
381 | });
|
382 |
|
383 |
|
384 |
|
385 | ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
|
386 | properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false,
|
387 | name.toLowerCase(),
|
388 | null,
|
389 | false,
|
390 | false);
|
391 | });
|
392 |
|
393 |
|
394 |
|
395 |
|
396 | ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
|
397 | properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false,
|
398 | name,
|
399 | null,
|
400 | false,
|
401 | false);
|
402 | });
|
403 |
|
404 | ['allowFullScreen', 'async',
|
405 |
|
406 | 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'disableRemotePlayback', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
|
407 | 'itemScope'].forEach(function (name) {
|
408 | properties[name] = new PropertyInfoRecord(name, BOOLEAN, false,
|
409 | name.toLowerCase(),
|
410 | null,
|
411 | false,
|
412 | false);
|
413 | });
|
414 |
|
415 |
|
416 | ['checked',
|
417 |
|
418 | 'multiple', 'muted', 'selected'
|
419 |
|
420 |
|
421 | ].forEach(function (name) {
|
422 | properties[name] = new PropertyInfoRecord(name, BOOLEAN, true,
|
423 | name,
|
424 | null,
|
425 | false,
|
426 | false);
|
427 | });
|
428 |
|
429 |
|
430 | ['capture', 'download'
|
431 |
|
432 |
|
433 | ].forEach(function (name) {
|
434 | properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false,
|
435 | name,
|
436 | null,
|
437 | false,
|
438 | false);
|
439 | });
|
440 |
|
441 | ['cols', 'rows', 'size', 'span'
|
442 |
|
443 |
|
444 | ].forEach(function (name) {
|
445 | properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false,
|
446 | name,
|
447 | null,
|
448 | false,
|
449 | false);
|
450 | });
|
451 |
|
452 | ['rowSpan', 'start'].forEach(function (name) {
|
453 | properties[name] = new PropertyInfoRecord(name, NUMERIC, false,
|
454 | name.toLowerCase(),
|
455 | null,
|
456 | false,
|
457 | false);
|
458 | });
|
459 | var CAMELIZE = /[\-\:]([a-z])/g;
|
460 |
|
461 | var capitalize = function (token) {
|
462 | return token[1].toUpperCase();
|
463 | };
|
464 |
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 | ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'
|
471 |
|
472 |
|
473 | ].forEach(function (attributeName) {
|
474 | var name = attributeName.replace(CAMELIZE, capitalize);
|
475 | properties[name] = new PropertyInfoRecord(name, STRING, false,
|
476 | attributeName, null,
|
477 | false,
|
478 | false);
|
479 | });
|
480 |
|
481 | ['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'
|
482 |
|
483 |
|
484 | ].forEach(function (attributeName) {
|
485 | var name = attributeName.replace(CAMELIZE, capitalize);
|
486 | properties[name] = new PropertyInfoRecord(name, STRING, false,
|
487 | attributeName, 'http://www.w3.org/1999/xlink', false,
|
488 | false);
|
489 | });
|
490 |
|
491 | ['xml:base', 'xml:lang', 'xml:space'
|
492 |
|
493 |
|
494 | ].forEach(function (attributeName) {
|
495 | var name = attributeName.replace(CAMELIZE, capitalize);
|
496 | properties[name] = new PropertyInfoRecord(name, STRING, false,
|
497 | attributeName, 'http://www.w3.org/XML/1998/namespace', false,
|
498 | false);
|
499 | });
|
500 |
|
501 |
|
502 |
|
503 | ['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
|
504 | properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false,
|
505 | attributeName.toLowerCase(),
|
506 | null,
|
507 | false,
|
508 | false);
|
509 | });
|
510 |
|
511 |
|
512 | var xlinkHref = 'xlinkHref';
|
513 | properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false,
|
514 | 'xlink:href', 'http://www.w3.org/1999/xlink', true,
|
515 | false);
|
516 | ['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
|
517 | properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false,
|
518 | attributeName.toLowerCase(),
|
519 | null,
|
520 | true,
|
521 | true);
|
522 | });
|
523 |
|
524 | |
525 |
|
526 |
|
527 | var isUnitlessNumber = {
|
528 | animationIterationCount: true,
|
529 | aspectRatio: true,
|
530 | borderImageOutset: true,
|
531 | borderImageSlice: true,
|
532 | borderImageWidth: true,
|
533 | boxFlex: true,
|
534 | boxFlexGroup: true,
|
535 | boxOrdinalGroup: true,
|
536 | columnCount: true,
|
537 | columns: true,
|
538 | flex: true,
|
539 | flexGrow: true,
|
540 | flexPositive: true,
|
541 | flexShrink: true,
|
542 | flexNegative: true,
|
543 | flexOrder: true,
|
544 | gridArea: true,
|
545 | gridRow: true,
|
546 | gridRowEnd: true,
|
547 | gridRowSpan: true,
|
548 | gridRowStart: true,
|
549 | gridColumn: true,
|
550 | gridColumnEnd: true,
|
551 | gridColumnSpan: true,
|
552 | gridColumnStart: true,
|
553 | fontWeight: true,
|
554 | lineClamp: true,
|
555 | lineHeight: true,
|
556 | opacity: true,
|
557 | order: true,
|
558 | orphans: true,
|
559 | tabSize: true,
|
560 | widows: true,
|
561 | zIndex: true,
|
562 | zoom: true,
|
563 |
|
564 | fillOpacity: true,
|
565 | floodOpacity: true,
|
566 | stopOpacity: true,
|
567 | strokeDasharray: true,
|
568 | strokeDashoffset: true,
|
569 | strokeMiterlimit: true,
|
570 | strokeOpacity: true,
|
571 | strokeWidth: true
|
572 | };
|
573 | |
574 |
|
575 |
|
576 |
|
577 |
|
578 |
|
579 |
|
580 | function prefixKey(prefix, key) {
|
581 | return prefix + key.charAt(0).toUpperCase() + key.substring(1);
|
582 | }
|
583 | |
584 |
|
585 |
|
586 |
|
587 |
|
588 |
|
589 | var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
|
590 |
|
591 |
|
592 | Object.keys(isUnitlessNumber).forEach(function (prop) {
|
593 | prefixes.forEach(function (prefix) {
|
594 | isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
|
595 | });
|
596 | });
|
597 |
|
598 | var hasReadOnlyValue = {
|
599 | button: true,
|
600 | checkbox: true,
|
601 | image: true,
|
602 | hidden: true,
|
603 | radio: true,
|
604 | reset: true,
|
605 | submit: true
|
606 | };
|
607 | function checkControlledValueProps(tagName, props) {
|
608 | {
|
609 | if (!(hasReadOnlyValue[props.type] || props.onChange || props.onInput || props.readOnly || props.disabled || props.value == null)) {
|
610 | error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
611 | }
|
612 |
|
613 | if (!(props.onChange || props.readOnly || props.disabled || props.checked == null)) {
|
614 | error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
615 | }
|
616 | }
|
617 | }
|
618 |
|
619 | function isCustomComponent(tagName, props) {
|
620 | if (tagName.indexOf('-') === -1) {
|
621 | return typeof props.is === 'string';
|
622 | }
|
623 |
|
624 | switch (tagName) {
|
625 |
|
626 |
|
627 |
|
628 |
|
629 | case 'annotation-xml':
|
630 | case 'color-profile':
|
631 | case 'font-face':
|
632 | case 'font-face-src':
|
633 | case 'font-face-uri':
|
634 | case 'font-face-format':
|
635 | case 'font-face-name':
|
636 | case 'missing-glyph':
|
637 | return false;
|
638 |
|
639 | default:
|
640 | return true;
|
641 | }
|
642 | }
|
643 |
|
644 | var ariaProperties = {
|
645 | 'aria-current': 0,
|
646 |
|
647 | 'aria-description': 0,
|
648 | 'aria-details': 0,
|
649 | 'aria-disabled': 0,
|
650 |
|
651 | 'aria-hidden': 0,
|
652 |
|
653 | 'aria-invalid': 0,
|
654 |
|
655 | 'aria-keyshortcuts': 0,
|
656 | 'aria-label': 0,
|
657 | 'aria-roledescription': 0,
|
658 |
|
659 | 'aria-autocomplete': 0,
|
660 | 'aria-checked': 0,
|
661 | 'aria-expanded': 0,
|
662 | 'aria-haspopup': 0,
|
663 | 'aria-level': 0,
|
664 | 'aria-modal': 0,
|
665 | 'aria-multiline': 0,
|
666 | 'aria-multiselectable': 0,
|
667 | 'aria-orientation': 0,
|
668 | 'aria-placeholder': 0,
|
669 | 'aria-pressed': 0,
|
670 | 'aria-readonly': 0,
|
671 | 'aria-required': 0,
|
672 | 'aria-selected': 0,
|
673 | 'aria-sort': 0,
|
674 | 'aria-valuemax': 0,
|
675 | 'aria-valuemin': 0,
|
676 | 'aria-valuenow': 0,
|
677 | 'aria-valuetext': 0,
|
678 |
|
679 | 'aria-atomic': 0,
|
680 | 'aria-busy': 0,
|
681 | 'aria-live': 0,
|
682 | 'aria-relevant': 0,
|
683 |
|
684 | 'aria-dropeffect': 0,
|
685 | 'aria-grabbed': 0,
|
686 |
|
687 | 'aria-activedescendant': 0,
|
688 | 'aria-colcount': 0,
|
689 | 'aria-colindex': 0,
|
690 | 'aria-colspan': 0,
|
691 | 'aria-controls': 0,
|
692 | 'aria-describedby': 0,
|
693 | 'aria-errormessage': 0,
|
694 | 'aria-flowto': 0,
|
695 | 'aria-labelledby': 0,
|
696 | 'aria-owns': 0,
|
697 | 'aria-posinset': 0,
|
698 | 'aria-rowcount': 0,
|
699 | 'aria-rowindex': 0,
|
700 | 'aria-rowspan': 0,
|
701 | 'aria-setsize': 0
|
702 | };
|
703 |
|
704 | var warnedProperties = {};
|
705 | var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
|
706 | var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
707 |
|
708 | function validateProperty(tagName, name) {
|
709 | {
|
710 | if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
|
711 | return true;
|
712 | }
|
713 |
|
714 | if (rARIACamel.test(name)) {
|
715 | var ariaName = 'aria-' + name.slice(4).toLowerCase();
|
716 | var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null;
|
717 |
|
718 |
|
719 | if (correctName == null) {
|
720 | error('Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
|
721 |
|
722 | warnedProperties[name] = true;
|
723 | return true;
|
724 | }
|
725 |
|
726 |
|
727 | if (name !== correctName) {
|
728 | error('Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
|
729 |
|
730 | warnedProperties[name] = true;
|
731 | return true;
|
732 | }
|
733 | }
|
734 |
|
735 | if (rARIA.test(name)) {
|
736 | var lowerCasedName = name.toLowerCase();
|
737 | var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
|
738 |
|
739 |
|
740 | if (standardName == null) {
|
741 | warnedProperties[name] = true;
|
742 | return false;
|
743 | }
|
744 |
|
745 |
|
746 | if (name !== standardName) {
|
747 | error('Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
|
748 |
|
749 | warnedProperties[name] = true;
|
750 | return true;
|
751 | }
|
752 | }
|
753 | }
|
754 |
|
755 | return true;
|
756 | }
|
757 |
|
758 | function warnInvalidARIAProps(type, props) {
|
759 | {
|
760 | var invalidProps = [];
|
761 |
|
762 | for (var key in props) {
|
763 | var isValid = validateProperty(type, key);
|
764 |
|
765 | if (!isValid) {
|
766 | invalidProps.push(key);
|
767 | }
|
768 | }
|
769 |
|
770 | var unknownPropString = invalidProps.map(function (prop) {
|
771 | return '`' + prop + '`';
|
772 | }).join(', ');
|
773 |
|
774 | if (invalidProps.length === 1) {
|
775 | error('Invalid aria prop %s on <%s> tag. ' + 'For details, see https://reactjs.org/link/invalid-aria-props', unknownPropString, type);
|
776 | } else if (invalidProps.length > 1) {
|
777 | error('Invalid aria props %s on <%s> tag. ' + 'For details, see https://reactjs.org/link/invalid-aria-props', unknownPropString, type);
|
778 | }
|
779 | }
|
780 | }
|
781 |
|
782 | function validateProperties(type, props) {
|
783 | if (isCustomComponent(type, props)) {
|
784 | return;
|
785 | }
|
786 |
|
787 | warnInvalidARIAProps(type, props);
|
788 | }
|
789 |
|
790 | var didWarnValueNull = false;
|
791 | function validateProperties$1(type, props) {
|
792 | {
|
793 | if (type !== 'input' && type !== 'textarea' && type !== 'select') {
|
794 | return;
|
795 | }
|
796 |
|
797 | if (props != null && props.value === null && !didWarnValueNull) {
|
798 | didWarnValueNull = true;
|
799 |
|
800 | if (type === 'select' && props.multiple) {
|
801 | error('`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type);
|
802 | } else {
|
803 | error('`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type);
|
804 | }
|
805 | }
|
806 | }
|
807 | }
|
808 |
|
809 |
|
810 |
|
811 |
|
812 | var possibleStandardNames = {
|
813 |
|
814 | accept: 'accept',
|
815 | acceptcharset: 'acceptCharset',
|
816 | 'accept-charset': 'acceptCharset',
|
817 | accesskey: 'accessKey',
|
818 | action: 'action',
|
819 | allowfullscreen: 'allowFullScreen',
|
820 | alt: 'alt',
|
821 | as: 'as',
|
822 | async: 'async',
|
823 | autocapitalize: 'autoCapitalize',
|
824 | autocomplete: 'autoComplete',
|
825 | autocorrect: 'autoCorrect',
|
826 | autofocus: 'autoFocus',
|
827 | autoplay: 'autoPlay',
|
828 | autosave: 'autoSave',
|
829 | capture: 'capture',
|
830 | cellpadding: 'cellPadding',
|
831 | cellspacing: 'cellSpacing',
|
832 | challenge: 'challenge',
|
833 | charset: 'charSet',
|
834 | checked: 'checked',
|
835 | children: 'children',
|
836 | cite: 'cite',
|
837 | class: 'className',
|
838 | classid: 'classID',
|
839 | classname: 'className',
|
840 | cols: 'cols',
|
841 | colspan: 'colSpan',
|
842 | content: 'content',
|
843 | contenteditable: 'contentEditable',
|
844 | contextmenu: 'contextMenu',
|
845 | controls: 'controls',
|
846 | controlslist: 'controlsList',
|
847 | coords: 'coords',
|
848 | crossorigin: 'crossOrigin',
|
849 | dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
|
850 | data: 'data',
|
851 | datetime: 'dateTime',
|
852 | default: 'default',
|
853 | defaultchecked: 'defaultChecked',
|
854 | defaultvalue: 'defaultValue',
|
855 | defer: 'defer',
|
856 | dir: 'dir',
|
857 | disabled: 'disabled',
|
858 | disablepictureinpicture: 'disablePictureInPicture',
|
859 | disableremoteplayback: 'disableRemotePlayback',
|
860 | download: 'download',
|
861 | draggable: 'draggable',
|
862 | enctype: 'encType',
|
863 | enterkeyhint: 'enterKeyHint',
|
864 | for: 'htmlFor',
|
865 | form: 'form',
|
866 | formmethod: 'formMethod',
|
867 | formaction: 'formAction',
|
868 | formenctype: 'formEncType',
|
869 | formnovalidate: 'formNoValidate',
|
870 | formtarget: 'formTarget',
|
871 | frameborder: 'frameBorder',
|
872 | headers: 'headers',
|
873 | height: 'height',
|
874 | hidden: 'hidden',
|
875 | high: 'high',
|
876 | href: 'href',
|
877 | hreflang: 'hrefLang',
|
878 | htmlfor: 'htmlFor',
|
879 | httpequiv: 'httpEquiv',
|
880 | 'http-equiv': 'httpEquiv',
|
881 | icon: 'icon',
|
882 | id: 'id',
|
883 | imagesizes: 'imageSizes',
|
884 | imagesrcset: 'imageSrcSet',
|
885 | innerhtml: 'innerHTML',
|
886 | inputmode: 'inputMode',
|
887 | integrity: 'integrity',
|
888 | is: 'is',
|
889 | itemid: 'itemID',
|
890 | itemprop: 'itemProp',
|
891 | itemref: 'itemRef',
|
892 | itemscope: 'itemScope',
|
893 | itemtype: 'itemType',
|
894 | keyparams: 'keyParams',
|
895 | keytype: 'keyType',
|
896 | kind: 'kind',
|
897 | label: 'label',
|
898 | lang: 'lang',
|
899 | list: 'list',
|
900 | loop: 'loop',
|
901 | low: 'low',
|
902 | manifest: 'manifest',
|
903 | marginwidth: 'marginWidth',
|
904 | marginheight: 'marginHeight',
|
905 | max: 'max',
|
906 | maxlength: 'maxLength',
|
907 | media: 'media',
|
908 | mediagroup: 'mediaGroup',
|
909 | method: 'method',
|
910 | min: 'min',
|
911 | minlength: 'minLength',
|
912 | multiple: 'multiple',
|
913 | muted: 'muted',
|
914 | name: 'name',
|
915 | nomodule: 'noModule',
|
916 | nonce: 'nonce',
|
917 | novalidate: 'noValidate',
|
918 | open: 'open',
|
919 | optimum: 'optimum',
|
920 | pattern: 'pattern',
|
921 | placeholder: 'placeholder',
|
922 | playsinline: 'playsInline',
|
923 | poster: 'poster',
|
924 | preload: 'preload',
|
925 | profile: 'profile',
|
926 | radiogroup: 'radioGroup',
|
927 | readonly: 'readOnly',
|
928 | referrerpolicy: 'referrerPolicy',
|
929 | rel: 'rel',
|
930 | required: 'required',
|
931 | reversed: 'reversed',
|
932 | role: 'role',
|
933 | rows: 'rows',
|
934 | rowspan: 'rowSpan',
|
935 | sandbox: 'sandbox',
|
936 | scope: 'scope',
|
937 | scoped: 'scoped',
|
938 | scrolling: 'scrolling',
|
939 | seamless: 'seamless',
|
940 | selected: 'selected',
|
941 | shape: 'shape',
|
942 | size: 'size',
|
943 | sizes: 'sizes',
|
944 | span: 'span',
|
945 | spellcheck: 'spellCheck',
|
946 | src: 'src',
|
947 | srcdoc: 'srcDoc',
|
948 | srclang: 'srcLang',
|
949 | srcset: 'srcSet',
|
950 | start: 'start',
|
951 | step: 'step',
|
952 | style: 'style',
|
953 | summary: 'summary',
|
954 | tabindex: 'tabIndex',
|
955 | target: 'target',
|
956 | title: 'title',
|
957 | type: 'type',
|
958 | usemap: 'useMap',
|
959 | value: 'value',
|
960 | width: 'width',
|
961 | wmode: 'wmode',
|
962 | wrap: 'wrap',
|
963 |
|
964 | about: 'about',
|
965 | accentheight: 'accentHeight',
|
966 | 'accent-height': 'accentHeight',
|
967 | accumulate: 'accumulate',
|
968 | additive: 'additive',
|
969 | alignmentbaseline: 'alignmentBaseline',
|
970 | 'alignment-baseline': 'alignmentBaseline',
|
971 | allowreorder: 'allowReorder',
|
972 | alphabetic: 'alphabetic',
|
973 | amplitude: 'amplitude',
|
974 | arabicform: 'arabicForm',
|
975 | 'arabic-form': 'arabicForm',
|
976 | ascent: 'ascent',
|
977 | attributename: 'attributeName',
|
978 | attributetype: 'attributeType',
|
979 | autoreverse: 'autoReverse',
|
980 | azimuth: 'azimuth',
|
981 | basefrequency: 'baseFrequency',
|
982 | baselineshift: 'baselineShift',
|
983 | 'baseline-shift': 'baselineShift',
|
984 | baseprofile: 'baseProfile',
|
985 | bbox: 'bbox',
|
986 | begin: 'begin',
|
987 | bias: 'bias',
|
988 | by: 'by',
|
989 | calcmode: 'calcMode',
|
990 | capheight: 'capHeight',
|
991 | 'cap-height': 'capHeight',
|
992 | clip: 'clip',
|
993 | clippath: 'clipPath',
|
994 | 'clip-path': 'clipPath',
|
995 | clippathunits: 'clipPathUnits',
|
996 | cliprule: 'clipRule',
|
997 | 'clip-rule': 'clipRule',
|
998 | color: 'color',
|
999 | colorinterpolation: 'colorInterpolation',
|
1000 | 'color-interpolation': 'colorInterpolation',
|
1001 | colorinterpolationfilters: 'colorInterpolationFilters',
|
1002 | 'color-interpolation-filters': 'colorInterpolationFilters',
|
1003 | colorprofile: 'colorProfile',
|
1004 | 'color-profile': 'colorProfile',
|
1005 | colorrendering: 'colorRendering',
|
1006 | 'color-rendering': 'colorRendering',
|
1007 | contentscripttype: 'contentScriptType',
|
1008 | contentstyletype: 'contentStyleType',
|
1009 | cursor: 'cursor',
|
1010 | cx: 'cx',
|
1011 | cy: 'cy',
|
1012 | d: 'd',
|
1013 | datatype: 'datatype',
|
1014 | decelerate: 'decelerate',
|
1015 | descent: 'descent',
|
1016 | diffuseconstant: 'diffuseConstant',
|
1017 | direction: 'direction',
|
1018 | display: 'display',
|
1019 | divisor: 'divisor',
|
1020 | dominantbaseline: 'dominantBaseline',
|
1021 | 'dominant-baseline': 'dominantBaseline',
|
1022 | dur: 'dur',
|
1023 | dx: 'dx',
|
1024 | dy: 'dy',
|
1025 | edgemode: 'edgeMode',
|
1026 | elevation: 'elevation',
|
1027 | enablebackground: 'enableBackground',
|
1028 | 'enable-background': 'enableBackground',
|
1029 | end: 'end',
|
1030 | exponent: 'exponent',
|
1031 | externalresourcesrequired: 'externalResourcesRequired',
|
1032 | fill: 'fill',
|
1033 | fillopacity: 'fillOpacity',
|
1034 | 'fill-opacity': 'fillOpacity',
|
1035 | fillrule: 'fillRule',
|
1036 | 'fill-rule': 'fillRule',
|
1037 | filter: 'filter',
|
1038 | filterres: 'filterRes',
|
1039 | filterunits: 'filterUnits',
|
1040 | floodopacity: 'floodOpacity',
|
1041 | 'flood-opacity': 'floodOpacity',
|
1042 | floodcolor: 'floodColor',
|
1043 | 'flood-color': 'floodColor',
|
1044 | focusable: 'focusable',
|
1045 | fontfamily: 'fontFamily',
|
1046 | 'font-family': 'fontFamily',
|
1047 | fontsize: 'fontSize',
|
1048 | 'font-size': 'fontSize',
|
1049 | fontsizeadjust: 'fontSizeAdjust',
|
1050 | 'font-size-adjust': 'fontSizeAdjust',
|
1051 | fontstretch: 'fontStretch',
|
1052 | 'font-stretch': 'fontStretch',
|
1053 | fontstyle: 'fontStyle',
|
1054 | 'font-style': 'fontStyle',
|
1055 | fontvariant: 'fontVariant',
|
1056 | 'font-variant': 'fontVariant',
|
1057 | fontweight: 'fontWeight',
|
1058 | 'font-weight': 'fontWeight',
|
1059 | format: 'format',
|
1060 | from: 'from',
|
1061 | fx: 'fx',
|
1062 | fy: 'fy',
|
1063 | g1: 'g1',
|
1064 | g2: 'g2',
|
1065 | glyphname: 'glyphName',
|
1066 | 'glyph-name': 'glyphName',
|
1067 | glyphorientationhorizontal: 'glyphOrientationHorizontal',
|
1068 | 'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
|
1069 | glyphorientationvertical: 'glyphOrientationVertical',
|
1070 | 'glyph-orientation-vertical': 'glyphOrientationVertical',
|
1071 | glyphref: 'glyphRef',
|
1072 | gradienttransform: 'gradientTransform',
|
1073 | gradientunits: 'gradientUnits',
|
1074 | hanging: 'hanging',
|
1075 | horizadvx: 'horizAdvX',
|
1076 | 'horiz-adv-x': 'horizAdvX',
|
1077 | horizoriginx: 'horizOriginX',
|
1078 | 'horiz-origin-x': 'horizOriginX',
|
1079 | ideographic: 'ideographic',
|
1080 | imagerendering: 'imageRendering',
|
1081 | 'image-rendering': 'imageRendering',
|
1082 | in2: 'in2',
|
1083 | in: 'in',
|
1084 | inlist: 'inlist',
|
1085 | intercept: 'intercept',
|
1086 | k1: 'k1',
|
1087 | k2: 'k2',
|
1088 | k3: 'k3',
|
1089 | k4: 'k4',
|
1090 | k: 'k',
|
1091 | kernelmatrix: 'kernelMatrix',
|
1092 | kernelunitlength: 'kernelUnitLength',
|
1093 | kerning: 'kerning',
|
1094 | keypoints: 'keyPoints',
|
1095 | keysplines: 'keySplines',
|
1096 | keytimes: 'keyTimes',
|
1097 | lengthadjust: 'lengthAdjust',
|
1098 | letterspacing: 'letterSpacing',
|
1099 | 'letter-spacing': 'letterSpacing',
|
1100 | lightingcolor: 'lightingColor',
|
1101 | 'lighting-color': 'lightingColor',
|
1102 | limitingconeangle: 'limitingConeAngle',
|
1103 | local: 'local',
|
1104 | markerend: 'markerEnd',
|
1105 | 'marker-end': 'markerEnd',
|
1106 | markerheight: 'markerHeight',
|
1107 | markermid: 'markerMid',
|
1108 | 'marker-mid': 'markerMid',
|
1109 | markerstart: 'markerStart',
|
1110 | 'marker-start': 'markerStart',
|
1111 | markerunits: 'markerUnits',
|
1112 | markerwidth: 'markerWidth',
|
1113 | mask: 'mask',
|
1114 | maskcontentunits: 'maskContentUnits',
|
1115 | maskunits: 'maskUnits',
|
1116 | mathematical: 'mathematical',
|
1117 | mode: 'mode',
|
1118 | numoctaves: 'numOctaves',
|
1119 | offset: 'offset',
|
1120 | opacity: 'opacity',
|
1121 | operator: 'operator',
|
1122 | order: 'order',
|
1123 | orient: 'orient',
|
1124 | orientation: 'orientation',
|
1125 | origin: 'origin',
|
1126 | overflow: 'overflow',
|
1127 | overlineposition: 'overlinePosition',
|
1128 | 'overline-position': 'overlinePosition',
|
1129 | overlinethickness: 'overlineThickness',
|
1130 | 'overline-thickness': 'overlineThickness',
|
1131 | paintorder: 'paintOrder',
|
1132 | 'paint-order': 'paintOrder',
|
1133 | panose1: 'panose1',
|
1134 | 'panose-1': 'panose1',
|
1135 | pathlength: 'pathLength',
|
1136 | patterncontentunits: 'patternContentUnits',
|
1137 | patterntransform: 'patternTransform',
|
1138 | patternunits: 'patternUnits',
|
1139 | pointerevents: 'pointerEvents',
|
1140 | 'pointer-events': 'pointerEvents',
|
1141 | points: 'points',
|
1142 | pointsatx: 'pointsAtX',
|
1143 | pointsaty: 'pointsAtY',
|
1144 | pointsatz: 'pointsAtZ',
|
1145 | prefix: 'prefix',
|
1146 | preservealpha: 'preserveAlpha',
|
1147 | preserveaspectratio: 'preserveAspectRatio',
|
1148 | primitiveunits: 'primitiveUnits',
|
1149 | property: 'property',
|
1150 | r: 'r',
|
1151 | radius: 'radius',
|
1152 | refx: 'refX',
|
1153 | refy: 'refY',
|
1154 | renderingintent: 'renderingIntent',
|
1155 | 'rendering-intent': 'renderingIntent',
|
1156 | repeatcount: 'repeatCount',
|
1157 | repeatdur: 'repeatDur',
|
1158 | requiredextensions: 'requiredExtensions',
|
1159 | requiredfeatures: 'requiredFeatures',
|
1160 | resource: 'resource',
|
1161 | restart: 'restart',
|
1162 | result: 'result',
|
1163 | results: 'results',
|
1164 | rotate: 'rotate',
|
1165 | rx: 'rx',
|
1166 | ry: 'ry',
|
1167 | scale: 'scale',
|
1168 | security: 'security',
|
1169 | seed: 'seed',
|
1170 | shaperendering: 'shapeRendering',
|
1171 | 'shape-rendering': 'shapeRendering',
|
1172 | slope: 'slope',
|
1173 | spacing: 'spacing',
|
1174 | specularconstant: 'specularConstant',
|
1175 | specularexponent: 'specularExponent',
|
1176 | speed: 'speed',
|
1177 | spreadmethod: 'spreadMethod',
|
1178 | startoffset: 'startOffset',
|
1179 | stddeviation: 'stdDeviation',
|
1180 | stemh: 'stemh',
|
1181 | stemv: 'stemv',
|
1182 | stitchtiles: 'stitchTiles',
|
1183 | stopcolor: 'stopColor',
|
1184 | 'stop-color': 'stopColor',
|
1185 | stopopacity: 'stopOpacity',
|
1186 | 'stop-opacity': 'stopOpacity',
|
1187 | strikethroughposition: 'strikethroughPosition',
|
1188 | 'strikethrough-position': 'strikethroughPosition',
|
1189 | strikethroughthickness: 'strikethroughThickness',
|
1190 | 'strikethrough-thickness': 'strikethroughThickness',
|
1191 | string: 'string',
|
1192 | stroke: 'stroke',
|
1193 | strokedasharray: 'strokeDasharray',
|
1194 | 'stroke-dasharray': 'strokeDasharray',
|
1195 | strokedashoffset: 'strokeDashoffset',
|
1196 | 'stroke-dashoffset': 'strokeDashoffset',
|
1197 | strokelinecap: 'strokeLinecap',
|
1198 | 'stroke-linecap': 'strokeLinecap',
|
1199 | strokelinejoin: 'strokeLinejoin',
|
1200 | 'stroke-linejoin': 'strokeLinejoin',
|
1201 | strokemiterlimit: 'strokeMiterlimit',
|
1202 | 'stroke-miterlimit': 'strokeMiterlimit',
|
1203 | strokewidth: 'strokeWidth',
|
1204 | 'stroke-width': 'strokeWidth',
|
1205 | strokeopacity: 'strokeOpacity',
|
1206 | 'stroke-opacity': 'strokeOpacity',
|
1207 | suppresscontenteditablewarning: 'suppressContentEditableWarning',
|
1208 | suppresshydrationwarning: 'suppressHydrationWarning',
|
1209 | surfacescale: 'surfaceScale',
|
1210 | systemlanguage: 'systemLanguage',
|
1211 | tablevalues: 'tableValues',
|
1212 | targetx: 'targetX',
|
1213 | targety: 'targetY',
|
1214 | textanchor: 'textAnchor',
|
1215 | 'text-anchor': 'textAnchor',
|
1216 | textdecoration: 'textDecoration',
|
1217 | 'text-decoration': 'textDecoration',
|
1218 | textlength: 'textLength',
|
1219 | textrendering: 'textRendering',
|
1220 | 'text-rendering': 'textRendering',
|
1221 | to: 'to',
|
1222 | transform: 'transform',
|
1223 | typeof: 'typeof',
|
1224 | u1: 'u1',
|
1225 | u2: 'u2',
|
1226 | underlineposition: 'underlinePosition',
|
1227 | 'underline-position': 'underlinePosition',
|
1228 | underlinethickness: 'underlineThickness',
|
1229 | 'underline-thickness': 'underlineThickness',
|
1230 | unicode: 'unicode',
|
1231 | unicodebidi: 'unicodeBidi',
|
1232 | 'unicode-bidi': 'unicodeBidi',
|
1233 | unicoderange: 'unicodeRange',
|
1234 | 'unicode-range': 'unicodeRange',
|
1235 | unitsperem: 'unitsPerEm',
|
1236 | 'units-per-em': 'unitsPerEm',
|
1237 | unselectable: 'unselectable',
|
1238 | valphabetic: 'vAlphabetic',
|
1239 | 'v-alphabetic': 'vAlphabetic',
|
1240 | values: 'values',
|
1241 | vectoreffect: 'vectorEffect',
|
1242 | 'vector-effect': 'vectorEffect',
|
1243 | version: 'version',
|
1244 | vertadvy: 'vertAdvY',
|
1245 | 'vert-adv-y': 'vertAdvY',
|
1246 | vertoriginx: 'vertOriginX',
|
1247 | 'vert-origin-x': 'vertOriginX',
|
1248 | vertoriginy: 'vertOriginY',
|
1249 | 'vert-origin-y': 'vertOriginY',
|
1250 | vhanging: 'vHanging',
|
1251 | 'v-hanging': 'vHanging',
|
1252 | videographic: 'vIdeographic',
|
1253 | 'v-ideographic': 'vIdeographic',
|
1254 | viewbox: 'viewBox',
|
1255 | viewtarget: 'viewTarget',
|
1256 | visibility: 'visibility',
|
1257 | vmathematical: 'vMathematical',
|
1258 | 'v-mathematical': 'vMathematical',
|
1259 | vocab: 'vocab',
|
1260 | widths: 'widths',
|
1261 | wordspacing: 'wordSpacing',
|
1262 | 'word-spacing': 'wordSpacing',
|
1263 | writingmode: 'writingMode',
|
1264 | 'writing-mode': 'writingMode',
|
1265 | x1: 'x1',
|
1266 | x2: 'x2',
|
1267 | x: 'x',
|
1268 | xchannelselector: 'xChannelSelector',
|
1269 | xheight: 'xHeight',
|
1270 | 'x-height': 'xHeight',
|
1271 | xlinkactuate: 'xlinkActuate',
|
1272 | 'xlink:actuate': 'xlinkActuate',
|
1273 | xlinkarcrole: 'xlinkArcrole',
|
1274 | 'xlink:arcrole': 'xlinkArcrole',
|
1275 | xlinkhref: 'xlinkHref',
|
1276 | 'xlink:href': 'xlinkHref',
|
1277 | xlinkrole: 'xlinkRole',
|
1278 | 'xlink:role': 'xlinkRole',
|
1279 | xlinkshow: 'xlinkShow',
|
1280 | 'xlink:show': 'xlinkShow',
|
1281 | xlinktitle: 'xlinkTitle',
|
1282 | 'xlink:title': 'xlinkTitle',
|
1283 | xlinktype: 'xlinkType',
|
1284 | 'xlink:type': 'xlinkType',
|
1285 | xmlbase: 'xmlBase',
|
1286 | 'xml:base': 'xmlBase',
|
1287 | xmllang: 'xmlLang',
|
1288 | 'xml:lang': 'xmlLang',
|
1289 | xmlns: 'xmlns',
|
1290 | 'xml:space': 'xmlSpace',
|
1291 | xmlnsxlink: 'xmlnsXlink',
|
1292 | 'xmlns:xlink': 'xmlnsXlink',
|
1293 | xmlspace: 'xmlSpace',
|
1294 | y1: 'y1',
|
1295 | y2: 'y2',
|
1296 | y: 'y',
|
1297 | ychannelselector: 'yChannelSelector',
|
1298 | z: 'z',
|
1299 | zoomandpan: 'zoomAndPan'
|
1300 | };
|
1301 |
|
1302 | var validateProperty$1 = function () {};
|
1303 |
|
1304 | {
|
1305 | var warnedProperties$1 = {};
|
1306 | var EVENT_NAME_REGEX = /^on./;
|
1307 | var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
|
1308 | var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
|
1309 | var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
1310 |
|
1311 | validateProperty$1 = function (tagName, name, value, eventRegistry) {
|
1312 | if (hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
|
1313 | return true;
|
1314 | }
|
1315 |
|
1316 | var lowerCasedName = name.toLowerCase();
|
1317 |
|
1318 | if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
|
1319 | error('React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
|
1320 |
|
1321 | warnedProperties$1[name] = true;
|
1322 | return true;
|
1323 | }
|
1324 |
|
1325 |
|
1326 | if (eventRegistry != null) {
|
1327 | var registrationNameDependencies = eventRegistry.registrationNameDependencies,
|
1328 | possibleRegistrationNames = eventRegistry.possibleRegistrationNames;
|
1329 |
|
1330 | if (registrationNameDependencies.hasOwnProperty(name)) {
|
1331 | return true;
|
1332 | }
|
1333 |
|
1334 | var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
|
1335 |
|
1336 | if (registrationName != null) {
|
1337 | error('Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
|
1338 |
|
1339 | warnedProperties$1[name] = true;
|
1340 | return true;
|
1341 | }
|
1342 |
|
1343 | if (EVENT_NAME_REGEX.test(name)) {
|
1344 | error('Unknown event handler property `%s`. It will be ignored.', name);
|
1345 |
|
1346 | warnedProperties$1[name] = true;
|
1347 | return true;
|
1348 | }
|
1349 | } else if (EVENT_NAME_REGEX.test(name)) {
|
1350 |
|
1351 |
|
1352 |
|
1353 | if (INVALID_EVENT_NAME_REGEX.test(name)) {
|
1354 | error('Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
|
1355 | }
|
1356 |
|
1357 | warnedProperties$1[name] = true;
|
1358 | return true;
|
1359 | }
|
1360 |
|
1361 |
|
1362 | if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
|
1363 | return true;
|
1364 | }
|
1365 |
|
1366 | if (lowerCasedName === 'innerhtml') {
|
1367 | error('Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
|
1368 |
|
1369 | warnedProperties$1[name] = true;
|
1370 | return true;
|
1371 | }
|
1372 |
|
1373 | if (lowerCasedName === 'aria') {
|
1374 | error('The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
|
1375 |
|
1376 | warnedProperties$1[name] = true;
|
1377 | return true;
|
1378 | }
|
1379 |
|
1380 | if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
|
1381 | error('Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
|
1382 |
|
1383 | warnedProperties$1[name] = true;
|
1384 | return true;
|
1385 | }
|
1386 |
|
1387 | if (typeof value === 'number' && isNaN(value)) {
|
1388 | error('Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
|
1389 |
|
1390 | warnedProperties$1[name] = true;
|
1391 | return true;
|
1392 | }
|
1393 |
|
1394 | var propertyInfo = getPropertyInfo(name);
|
1395 | var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED;
|
1396 |
|
1397 | if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
|
1398 | var standardName = possibleStandardNames[lowerCasedName];
|
1399 |
|
1400 | if (standardName !== name) {
|
1401 | error('Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
|
1402 |
|
1403 | warnedProperties$1[name] = true;
|
1404 | return true;
|
1405 | }
|
1406 | } else if (!isReserved && name !== lowerCasedName) {
|
1407 |
|
1408 |
|
1409 | error('React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName);
|
1410 |
|
1411 | warnedProperties$1[name] = true;
|
1412 | return true;
|
1413 | }
|
1414 |
|
1415 | if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
|
1416 | if (value) {
|
1417 | error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.', value, name, name, value, name);
|
1418 | } else {
|
1419 | error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name);
|
1420 | }
|
1421 |
|
1422 | warnedProperties$1[name] = true;
|
1423 | return true;
|
1424 | }
|
1425 |
|
1426 |
|
1427 |
|
1428 | if (isReserved) {
|
1429 | return true;
|
1430 | }
|
1431 |
|
1432 |
|
1433 | if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
|
1434 | warnedProperties$1[name] = true;
|
1435 | return false;
|
1436 | }
|
1437 |
|
1438 |
|
1439 | if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
|
1440 | error('Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
|
1441 |
|
1442 | warnedProperties$1[name] = true;
|
1443 | return true;
|
1444 | }
|
1445 |
|
1446 | return true;
|
1447 | };
|
1448 | }
|
1449 |
|
1450 | var warnUnknownProperties = function (type, props, eventRegistry) {
|
1451 | {
|
1452 | var unknownProps = [];
|
1453 |
|
1454 | for (var key in props) {
|
1455 | var isValid = validateProperty$1(type, key, props[key], eventRegistry);
|
1456 |
|
1457 | if (!isValid) {
|
1458 | unknownProps.push(key);
|
1459 | }
|
1460 | }
|
1461 |
|
1462 | var unknownPropString = unknownProps.map(function (prop) {
|
1463 | return '`' + prop + '`';
|
1464 | }).join(', ');
|
1465 |
|
1466 | if (unknownProps.length === 1) {
|
1467 | error('Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://reactjs.org/link/attribute-behavior ', unknownPropString, type);
|
1468 | } else if (unknownProps.length > 1) {
|
1469 | error('Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://reactjs.org/link/attribute-behavior ', unknownPropString, type);
|
1470 | }
|
1471 | }
|
1472 | };
|
1473 |
|
1474 | function validateProperties$2(type, props, eventRegistry) {
|
1475 | if (isCustomComponent(type, props)) {
|
1476 | return;
|
1477 | }
|
1478 |
|
1479 | warnUnknownProperties(type, props, eventRegistry);
|
1480 | }
|
1481 |
|
1482 | var warnValidStyle = function () {};
|
1483 |
|
1484 | {
|
1485 |
|
1486 | var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
|
1487 | var msPattern = /^-ms-/;
|
1488 | var hyphenPattern = /-(.)/g;
|
1489 |
|
1490 | var badStyleValueWithSemicolonPattern = /;\s*$/;
|
1491 | var warnedStyleNames = {};
|
1492 | var warnedStyleValues = {};
|
1493 | var warnedForNaNValue = false;
|
1494 | var warnedForInfinityValue = false;
|
1495 |
|
1496 | var camelize = function (string) {
|
1497 | return string.replace(hyphenPattern, function (_, character) {
|
1498 | return character.toUpperCase();
|
1499 | });
|
1500 | };
|
1501 |
|
1502 | var warnHyphenatedStyleName = function (name) {
|
1503 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
1504 | return;
|
1505 | }
|
1506 |
|
1507 | warnedStyleNames[name] = true;
|
1508 |
|
1509 | error('Unsupported style property %s. Did you mean %s?', name,
|
1510 |
|
1511 |
|
1512 | camelize(name.replace(msPattern, 'ms-')));
|
1513 | };
|
1514 |
|
1515 | var warnBadVendoredStyleName = function (name) {
|
1516 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
1517 | return;
|
1518 | }
|
1519 |
|
1520 | warnedStyleNames[name] = true;
|
1521 |
|
1522 | error('Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
|
1523 | };
|
1524 |
|
1525 | var warnStyleValueWithSemicolon = function (name, value) {
|
1526 | if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
|
1527 | return;
|
1528 | }
|
1529 |
|
1530 | warnedStyleValues[value] = true;
|
1531 |
|
1532 | error("Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
|
1533 | };
|
1534 |
|
1535 | var warnStyleValueIsNaN = function (name, value) {
|
1536 | if (warnedForNaNValue) {
|
1537 | return;
|
1538 | }
|
1539 |
|
1540 | warnedForNaNValue = true;
|
1541 |
|
1542 | error('`NaN` is an invalid value for the `%s` css style property.', name);
|
1543 | };
|
1544 |
|
1545 | var warnStyleValueIsInfinity = function (name, value) {
|
1546 | if (warnedForInfinityValue) {
|
1547 | return;
|
1548 | }
|
1549 |
|
1550 | warnedForInfinityValue = true;
|
1551 |
|
1552 | error('`Infinity` is an invalid value for the `%s` css style property.', name);
|
1553 | };
|
1554 |
|
1555 | warnValidStyle = function (name, value) {
|
1556 | if (name.indexOf('-') > -1) {
|
1557 | warnHyphenatedStyleName(name);
|
1558 | } else if (badVendoredStyleNamePattern.test(name)) {
|
1559 | warnBadVendoredStyleName(name);
|
1560 | } else if (badStyleValueWithSemicolonPattern.test(value)) {
|
1561 | warnStyleValueWithSemicolon(name, value);
|
1562 | }
|
1563 |
|
1564 | if (typeof value === 'number') {
|
1565 | if (isNaN(value)) {
|
1566 | warnStyleValueIsNaN(name, value);
|
1567 | } else if (!isFinite(value)) {
|
1568 | warnStyleValueIsInfinity(name, value);
|
1569 | }
|
1570 | }
|
1571 | };
|
1572 | }
|
1573 |
|
1574 | var warnValidStyle$1 = warnValidStyle;
|
1575 |
|
1576 |
|
1577 | var matchHtmlRegExp = /["'&<>]/;
|
1578 | |
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 |
|
1584 |
|
1585 |
|
1586 | function escapeHtml(string) {
|
1587 | {
|
1588 | checkHtmlStringCoercion(string);
|
1589 | }
|
1590 |
|
1591 | var str = '' + string;
|
1592 | var match = matchHtmlRegExp.exec(str);
|
1593 |
|
1594 | if (!match) {
|
1595 | return str;
|
1596 | }
|
1597 |
|
1598 | var escape;
|
1599 | var html = '';
|
1600 | var index;
|
1601 | var lastIndex = 0;
|
1602 |
|
1603 | for (index = match.index; index < str.length; index++) {
|
1604 | switch (str.charCodeAt(index)) {
|
1605 | case 34:
|
1606 |
|
1607 | escape = '"';
|
1608 | break;
|
1609 |
|
1610 | case 38:
|
1611 |
|
1612 | escape = '&';
|
1613 | break;
|
1614 |
|
1615 | case 39:
|
1616 |
|
1617 | escape = ''';
|
1618 |
|
1619 | break;
|
1620 |
|
1621 | case 60:
|
1622 |
|
1623 | escape = '<';
|
1624 | break;
|
1625 |
|
1626 | case 62:
|
1627 |
|
1628 | escape = '>';
|
1629 | break;
|
1630 |
|
1631 | default:
|
1632 | continue;
|
1633 | }
|
1634 |
|
1635 | if (lastIndex !== index) {
|
1636 | html += str.substring(lastIndex, index);
|
1637 | }
|
1638 |
|
1639 | lastIndex = index + 1;
|
1640 | html += escape;
|
1641 | }
|
1642 |
|
1643 | return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
|
1644 | }
|
1645 |
|
1646 | |
1647 |
|
1648 |
|
1649 |
|
1650 |
|
1651 |
|
1652 |
|
1653 |
|
1654 | function escapeTextForBrowser(text) {
|
1655 | if (typeof text === 'boolean' || typeof text === 'number') {
|
1656 |
|
1657 |
|
1658 |
|
1659 | return '' + text;
|
1660 | }
|
1661 |
|
1662 | return escapeHtml(text);
|
1663 | }
|
1664 |
|
1665 | var uppercasePattern = /([A-Z])/g;
|
1666 | var msPattern$1 = /^ms-/;
|
1667 | |
1668 |
|
1669 |
|
1670 |
|
1671 |
|
1672 |
|
1673 |
|
1674 |
|
1675 |
|
1676 |
|
1677 |
|
1678 |
|
1679 |
|
1680 |
|
1681 | function hyphenateStyleName(name) {
|
1682 | return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern$1, '-ms-');
|
1683 | }
|
1684 |
|
1685 |
|
1686 |
|
1687 |
|
1688 |
|
1689 |
|
1690 |
|
1691 |
|
1692 |
|
1693 |
|
1694 |
|
1695 | var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
|
1696 | var didWarn = false;
|
1697 |
|
1698 | function sanitizeURL(url) {
|
1699 | {
|
1700 | if (!didWarn && isJavaScriptProtocol.test(url)) {
|
1701 | didWarn = true;
|
1702 |
|
1703 | error('A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url));
|
1704 | }
|
1705 | }
|
1706 | }
|
1707 |
|
1708 | var isArrayImpl = Array.isArray;
|
1709 |
|
1710 | function isArray(a) {
|
1711 | return isArrayImpl(a);
|
1712 | }
|
1713 |
|
1714 | var startInlineScript = stringToPrecomputedChunk('<script>');
|
1715 | var endInlineScript = stringToPrecomputedChunk('</script>');
|
1716 | var startScriptSrc = stringToPrecomputedChunk('<script src="');
|
1717 | var startModuleSrc = stringToPrecomputedChunk('<script type="module" src="');
|
1718 | var endAsyncScript = stringToPrecomputedChunk('" async=""></script>');
|
1719 |
|
1720 | function createResponseState(identifierPrefix, nonce, bootstrapScriptContent, bootstrapScripts, bootstrapModules) {
|
1721 | var idPrefix = identifierPrefix === undefined ? '' : identifierPrefix;
|
1722 | var inlineScriptWithNonce = nonce === undefined ? startInlineScript : stringToPrecomputedChunk('<script nonce="' + escapeTextForBrowser(nonce) + '">');
|
1723 | var bootstrapChunks = [];
|
1724 |
|
1725 | if (bootstrapScriptContent !== undefined) {
|
1726 | bootstrapChunks.push(inlineScriptWithNonce, stringToChunk(escapeTextForBrowser(bootstrapScriptContent)), endInlineScript);
|
1727 | }
|
1728 |
|
1729 | if (bootstrapScripts !== undefined) {
|
1730 | for (var i = 0; i < bootstrapScripts.length; i++) {
|
1731 | bootstrapChunks.push(startScriptSrc, stringToChunk(escapeTextForBrowser(bootstrapScripts[i])), endAsyncScript);
|
1732 | }
|
1733 | }
|
1734 |
|
1735 | if (bootstrapModules !== undefined) {
|
1736 | for (var _i = 0; _i < bootstrapModules.length; _i++) {
|
1737 | bootstrapChunks.push(startModuleSrc, stringToChunk(escapeTextForBrowser(bootstrapModules[_i])), endAsyncScript);
|
1738 | }
|
1739 | }
|
1740 |
|
1741 | return {
|
1742 | bootstrapChunks: bootstrapChunks,
|
1743 | startInlineScript: inlineScriptWithNonce,
|
1744 | placeholderPrefix: stringToPrecomputedChunk(idPrefix + 'P:'),
|
1745 | segmentPrefix: stringToPrecomputedChunk(idPrefix + 'S:'),
|
1746 | boundaryPrefix: idPrefix + 'B:',
|
1747 | idPrefix: idPrefix,
|
1748 | nextSuspenseID: 0,
|
1749 | sentCompleteSegmentFunction: false,
|
1750 | sentCompleteBoundaryFunction: false,
|
1751 | sentClientRenderFunction: false
|
1752 | };
|
1753 | }
|
1754 |
|
1755 |
|
1756 |
|
1757 | var ROOT_HTML_MODE = 0;
|
1758 |
|
1759 | var HTML_MODE = 1;
|
1760 | var SVG_MODE = 2;
|
1761 | var MATHML_MODE = 3;
|
1762 | var HTML_TABLE_MODE = 4;
|
1763 | var HTML_TABLE_BODY_MODE = 5;
|
1764 | var HTML_TABLE_ROW_MODE = 6;
|
1765 | var HTML_COLGROUP_MODE = 7;
|
1766 |
|
1767 |
|
1768 | function createFormatContext(insertionMode, selectedValue) {
|
1769 | return {
|
1770 | insertionMode: insertionMode,
|
1771 | selectedValue: selectedValue
|
1772 | };
|
1773 | }
|
1774 |
|
1775 | function createRootFormatContext(namespaceURI) {
|
1776 | var insertionMode = namespaceURI === 'http://www.w3.org/2000/svg' ? SVG_MODE : namespaceURI === 'http://www.w3.org/1998/Math/MathML' ? MATHML_MODE : ROOT_HTML_MODE;
|
1777 | return createFormatContext(insertionMode, null);
|
1778 | }
|
1779 | function getChildFormatContext(parentContext, type, props) {
|
1780 | switch (type) {
|
1781 | case 'select':
|
1782 | return createFormatContext(HTML_MODE, props.value != null ? props.value : props.defaultValue);
|
1783 |
|
1784 | case 'svg':
|
1785 | return createFormatContext(SVG_MODE, null);
|
1786 |
|
1787 | case 'math':
|
1788 | return createFormatContext(MATHML_MODE, null);
|
1789 |
|
1790 | case 'foreignObject':
|
1791 | return createFormatContext(HTML_MODE, null);
|
1792 |
|
1793 |
|
1794 |
|
1795 | case 'table':
|
1796 | return createFormatContext(HTML_TABLE_MODE, null);
|
1797 |
|
1798 | case 'thead':
|
1799 | case 'tbody':
|
1800 | case 'tfoot':
|
1801 | return createFormatContext(HTML_TABLE_BODY_MODE, null);
|
1802 |
|
1803 | case 'colgroup':
|
1804 | return createFormatContext(HTML_COLGROUP_MODE, null);
|
1805 |
|
1806 | case 'tr':
|
1807 | return createFormatContext(HTML_TABLE_ROW_MODE, null);
|
1808 | }
|
1809 |
|
1810 | if (parentContext.insertionMode >= HTML_TABLE_MODE) {
|
1811 |
|
1812 |
|
1813 | return createFormatContext(HTML_MODE, null);
|
1814 | }
|
1815 |
|
1816 | if (parentContext.insertionMode === ROOT_HTML_MODE) {
|
1817 |
|
1818 | return createFormatContext(HTML_MODE, null);
|
1819 | }
|
1820 |
|
1821 | return parentContext;
|
1822 | }
|
1823 | var UNINITIALIZED_SUSPENSE_BOUNDARY_ID = null;
|
1824 | function assignSuspenseBoundaryID(responseState) {
|
1825 | var generatedID = responseState.nextSuspenseID++;
|
1826 | return stringToPrecomputedChunk(responseState.boundaryPrefix + generatedID.toString(16));
|
1827 | }
|
1828 | function makeId(responseState, treeId, localId) {
|
1829 | var idPrefix = responseState.idPrefix;
|
1830 | var id = ':' + idPrefix + 'R' + treeId;
|
1831 |
|
1832 |
|
1833 |
|
1834 | if (localId > 0) {
|
1835 | id += 'H' + localId.toString(32);
|
1836 | }
|
1837 |
|
1838 | return id + ':';
|
1839 | }
|
1840 |
|
1841 | function encodeHTMLTextNode(text) {
|
1842 | return escapeTextForBrowser(text);
|
1843 | }
|
1844 |
|
1845 | var textSeparator = stringToPrecomputedChunk('<!-- -->');
|
1846 | function pushTextInstance(target, text, responseState) {
|
1847 | if (text === '') {
|
1848 |
|
1849 | return;
|
1850 | }
|
1851 |
|
1852 |
|
1853 | target.push(stringToChunk(encodeHTMLTextNode(text)), textSeparator);
|
1854 | }
|
1855 | var styleNameCache = new Map();
|
1856 |
|
1857 | function processStyleName(styleName) {
|
1858 | var chunk = styleNameCache.get(styleName);
|
1859 |
|
1860 | if (chunk !== undefined) {
|
1861 | return chunk;
|
1862 | }
|
1863 |
|
1864 | var result = stringToPrecomputedChunk(escapeTextForBrowser(hyphenateStyleName(styleName)));
|
1865 | styleNameCache.set(styleName, result);
|
1866 | return result;
|
1867 | }
|
1868 |
|
1869 | var styleAttributeStart = stringToPrecomputedChunk(' style="');
|
1870 | var styleAssign = stringToPrecomputedChunk(':');
|
1871 | var styleSeparator = stringToPrecomputedChunk(';');
|
1872 |
|
1873 | function pushStyle(target, responseState, style) {
|
1874 | if (typeof style !== 'object') {
|
1875 | throw new Error('The `style` prop expects a mapping from style properties to values, ' + "not a string. For example, style={{marginRight: spacing + 'em'}} when " + 'using JSX.');
|
1876 | }
|
1877 |
|
1878 | var isFirst = true;
|
1879 |
|
1880 | for (var styleName in style) {
|
1881 | if (!hasOwnProperty.call(style, styleName)) {
|
1882 | continue;
|
1883 | }
|
1884 |
|
1885 |
|
1886 |
|
1887 |
|
1888 |
|
1889 |
|
1890 |
|
1891 |
|
1892 | var styleValue = style[styleName];
|
1893 |
|
1894 | if (styleValue == null || typeof styleValue === 'boolean' || styleValue === '') {
|
1895 |
|
1896 | continue;
|
1897 | }
|
1898 |
|
1899 | var nameChunk = void 0;
|
1900 | var valueChunk = void 0;
|
1901 | var isCustomProperty = styleName.indexOf('--') === 0;
|
1902 |
|
1903 | if (isCustomProperty) {
|
1904 | nameChunk = stringToChunk(escapeTextForBrowser(styleName));
|
1905 |
|
1906 | {
|
1907 | checkCSSPropertyStringCoercion(styleValue, styleName);
|
1908 | }
|
1909 |
|
1910 | valueChunk = stringToChunk(escapeTextForBrowser(('' + styleValue).trim()));
|
1911 | } else {
|
1912 | {
|
1913 | warnValidStyle$1(styleName, styleValue);
|
1914 | }
|
1915 |
|
1916 | nameChunk = processStyleName(styleName);
|
1917 |
|
1918 | if (typeof styleValue === 'number') {
|
1919 | if (styleValue !== 0 && !hasOwnProperty.call(isUnitlessNumber, styleName)) {
|
1920 | valueChunk = stringToChunk(styleValue + 'px');
|
1921 | } else {
|
1922 | valueChunk = stringToChunk('' + styleValue);
|
1923 | }
|
1924 | } else {
|
1925 | {
|
1926 | checkCSSPropertyStringCoercion(styleValue, styleName);
|
1927 | }
|
1928 |
|
1929 | valueChunk = stringToChunk(escapeTextForBrowser(('' + styleValue).trim()));
|
1930 | }
|
1931 | }
|
1932 |
|
1933 | if (isFirst) {
|
1934 | isFirst = false;
|
1935 |
|
1936 | target.push(styleAttributeStart, nameChunk, styleAssign, valueChunk);
|
1937 | } else {
|
1938 | target.push(styleSeparator, nameChunk, styleAssign, valueChunk);
|
1939 | }
|
1940 | }
|
1941 |
|
1942 | if (!isFirst) {
|
1943 | target.push(attributeEnd);
|
1944 | }
|
1945 | }
|
1946 |
|
1947 | var attributeSeparator = stringToPrecomputedChunk(' ');
|
1948 | var attributeAssign = stringToPrecomputedChunk('="');
|
1949 | var attributeEnd = stringToPrecomputedChunk('"');
|
1950 | var attributeEmptyString = stringToPrecomputedChunk('=""');
|
1951 |
|
1952 | function pushAttribute(target, responseState, name, value) {
|
1953 | switch (name) {
|
1954 | case 'style':
|
1955 | {
|
1956 | pushStyle(target, responseState, value);
|
1957 | return;
|
1958 | }
|
1959 |
|
1960 | case 'defaultValue':
|
1961 | case 'defaultChecked':
|
1962 |
|
1963 | case 'innerHTML':
|
1964 |
|
1965 | case 'suppressContentEditableWarning':
|
1966 | case 'suppressHydrationWarning':
|
1967 |
|
1968 | return;
|
1969 | }
|
1970 |
|
1971 | if (
|
1972 |
|
1973 | name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
|
1974 | return;
|
1975 | }
|
1976 |
|
1977 | var propertyInfo = getPropertyInfo(name);
|
1978 |
|
1979 | if (propertyInfo !== null) {
|
1980 |
|
1981 | switch (typeof value) {
|
1982 | case 'function':
|
1983 |
|
1984 | case 'symbol':
|
1985 |
|
1986 | return;
|
1987 |
|
1988 | case 'boolean':
|
1989 | {
|
1990 | if (!propertyInfo.acceptsBooleans) {
|
1991 | return;
|
1992 | }
|
1993 | }
|
1994 | }
|
1995 |
|
1996 | var attributeName = propertyInfo.attributeName;
|
1997 | var attributeNameChunk = stringToChunk(attributeName);
|
1998 |
|
1999 | switch (propertyInfo.type) {
|
2000 | case BOOLEAN:
|
2001 | if (value) {
|
2002 | target.push(attributeSeparator, attributeNameChunk, attributeEmptyString);
|
2003 | }
|
2004 |
|
2005 | return;
|
2006 |
|
2007 | case OVERLOADED_BOOLEAN:
|
2008 | if (value === true) {
|
2009 | target.push(attributeSeparator, attributeNameChunk, attributeEmptyString);
|
2010 | } else if (value === false) ; else {
|
2011 | target.push(attributeSeparator, attributeNameChunk, attributeAssign, stringToChunk(escapeTextForBrowser(value)), attributeEnd);
|
2012 | }
|
2013 |
|
2014 | return;
|
2015 |
|
2016 | case NUMERIC:
|
2017 | if (!isNaN(value)) {
|
2018 | target.push(attributeSeparator, attributeNameChunk, attributeAssign, stringToChunk(escapeTextForBrowser(value)), attributeEnd);
|
2019 | }
|
2020 |
|
2021 | break;
|
2022 |
|
2023 | case POSITIVE_NUMERIC:
|
2024 | if (!isNaN(value) && value >= 1) {
|
2025 | target.push(attributeSeparator, attributeNameChunk, attributeAssign, stringToChunk(escapeTextForBrowser(value)), attributeEnd);
|
2026 | }
|
2027 |
|
2028 | break;
|
2029 |
|
2030 | default:
|
2031 | if (propertyInfo.sanitizeURL) {
|
2032 | {
|
2033 | checkAttributeStringCoercion(value, attributeName);
|
2034 | }
|
2035 |
|
2036 | value = '' + value;
|
2037 | sanitizeURL(value);
|
2038 | }
|
2039 |
|
2040 | target.push(attributeSeparator, attributeNameChunk, attributeAssign, stringToChunk(escapeTextForBrowser(value)), attributeEnd);
|
2041 | }
|
2042 | } else if (isAttributeNameSafe(name)) {
|
2043 |
|
2044 | switch (typeof value) {
|
2045 | case 'function':
|
2046 |
|
2047 | case 'symbol':
|
2048 |
|
2049 | return;
|
2050 |
|
2051 | case 'boolean':
|
2052 | {
|
2053 | var prefix = name.toLowerCase().slice(0, 5);
|
2054 |
|
2055 | if (prefix !== 'data-' && prefix !== 'aria-') {
|
2056 | return;
|
2057 | }
|
2058 | }
|
2059 | }
|
2060 |
|
2061 | target.push(attributeSeparator, stringToChunk(name), attributeAssign, stringToChunk(escapeTextForBrowser(value)), attributeEnd);
|
2062 | }
|
2063 | }
|
2064 |
|
2065 | var endOfStartTag = stringToPrecomputedChunk('>');
|
2066 | var endOfStartTagSelfClosing = stringToPrecomputedChunk('/>');
|
2067 |
|
2068 | function pushInnerHTML(target, innerHTML, children) {
|
2069 | if (innerHTML != null) {
|
2070 | if (children != null) {
|
2071 | throw new Error('Can only set one of `children` or `props.dangerouslySetInnerHTML`.');
|
2072 | }
|
2073 |
|
2074 | if (typeof innerHTML !== 'object' || !('__html' in innerHTML)) {
|
2075 | throw new Error('`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://reactjs.org/link/dangerously-set-inner-html ' + 'for more information.');
|
2076 | }
|
2077 |
|
2078 | var html = innerHTML.__html;
|
2079 |
|
2080 | if (html !== null && html !== undefined) {
|
2081 | {
|
2082 | checkHtmlStringCoercion(html);
|
2083 | }
|
2084 |
|
2085 | target.push(stringToChunk('' + html));
|
2086 | }
|
2087 | }
|
2088 | }
|
2089 |
|
2090 |
|
2091 |
|
2092 | var didWarnDefaultInputValue = false;
|
2093 | var didWarnDefaultChecked = false;
|
2094 | var didWarnDefaultSelectValue = false;
|
2095 | var didWarnDefaultTextareaValue = false;
|
2096 | var didWarnInvalidOptionChildren = false;
|
2097 | var didWarnInvalidOptionInnerHTML = false;
|
2098 | var didWarnSelectedSetOnOption = false;
|
2099 |
|
2100 | function checkSelectProp(props, propName) {
|
2101 | {
|
2102 | var value = props[propName];
|
2103 |
|
2104 | if (value != null) {
|
2105 | var array = isArray(value);
|
2106 |
|
2107 | if (props.multiple && !array) {
|
2108 | error('The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.', propName);
|
2109 | } else if (!props.multiple && array) {
|
2110 | error('The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.', propName);
|
2111 | }
|
2112 | }
|
2113 | }
|
2114 | }
|
2115 |
|
2116 | function pushStartSelect(target, props, responseState) {
|
2117 | {
|
2118 | checkControlledValueProps('select', props);
|
2119 | checkSelectProp(props, 'value');
|
2120 | checkSelectProp(props, 'defaultValue');
|
2121 |
|
2122 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultSelectValue) {
|
2123 | error('Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components');
|
2124 |
|
2125 | didWarnDefaultSelectValue = true;
|
2126 | }
|
2127 | }
|
2128 |
|
2129 | target.push(startChunkForTag('select'));
|
2130 | var children = null;
|
2131 | var innerHTML = null;
|
2132 |
|
2133 | for (var propKey in props) {
|
2134 | if (hasOwnProperty.call(props, propKey)) {
|
2135 | var propValue = props[propKey];
|
2136 |
|
2137 | if (propValue == null) {
|
2138 | continue;
|
2139 | }
|
2140 |
|
2141 | switch (propKey) {
|
2142 | case 'children':
|
2143 | children = propValue;
|
2144 | break;
|
2145 |
|
2146 | case 'dangerouslySetInnerHTML':
|
2147 |
|
2148 |
|
2149 | innerHTML = propValue;
|
2150 | break;
|
2151 |
|
2152 | case 'defaultValue':
|
2153 | case 'value':
|
2154 |
|
2155 | break;
|
2156 |
|
2157 | default:
|
2158 | pushAttribute(target, responseState, propKey, propValue);
|
2159 | break;
|
2160 | }
|
2161 | }
|
2162 | }
|
2163 |
|
2164 | target.push(endOfStartTag);
|
2165 | pushInnerHTML(target, innerHTML, children);
|
2166 | return children;
|
2167 | }
|
2168 |
|
2169 | function flattenOptionChildren(children) {
|
2170 | var content = '';
|
2171 |
|
2172 |
|
2173 | React.Children.forEach(children, function (child) {
|
2174 | if (child == null) {
|
2175 | return;
|
2176 | }
|
2177 |
|
2178 | content += child;
|
2179 |
|
2180 | {
|
2181 | if (!didWarnInvalidOptionChildren && typeof child !== 'string' && typeof child !== 'number') {
|
2182 | didWarnInvalidOptionChildren = true;
|
2183 |
|
2184 | error('Cannot infer the option value of complex children. ' + 'Pass a `value` prop or use a plain string as children to <option>.');
|
2185 | }
|
2186 | }
|
2187 | });
|
2188 | return content;
|
2189 | }
|
2190 |
|
2191 | var selectedMarkerAttribute = stringToPrecomputedChunk(' selected=""');
|
2192 |
|
2193 | function pushStartOption(target, props, responseState, formatContext) {
|
2194 | var selectedValue = formatContext.selectedValue;
|
2195 | target.push(startChunkForTag('option'));
|
2196 | var children = null;
|
2197 | var value = null;
|
2198 | var selected = null;
|
2199 | var innerHTML = null;
|
2200 |
|
2201 | for (var propKey in props) {
|
2202 | if (hasOwnProperty.call(props, propKey)) {
|
2203 | var propValue = props[propKey];
|
2204 |
|
2205 | if (propValue == null) {
|
2206 | continue;
|
2207 | }
|
2208 |
|
2209 | switch (propKey) {
|
2210 | case 'children':
|
2211 | children = propValue;
|
2212 | break;
|
2213 |
|
2214 | case 'selected':
|
2215 |
|
2216 | selected = propValue;
|
2217 |
|
2218 | {
|
2219 |
|
2220 | if (!didWarnSelectedSetOnOption) {
|
2221 | error('Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.');
|
2222 |
|
2223 | didWarnSelectedSetOnOption = true;
|
2224 | }
|
2225 | }
|
2226 |
|
2227 | break;
|
2228 |
|
2229 | case 'dangerouslySetInnerHTML':
|
2230 | innerHTML = propValue;
|
2231 | break;
|
2232 |
|
2233 |
|
2234 | case 'value':
|
2235 | value = propValue;
|
2236 |
|
2237 |
|
2238 |
|
2239 | default:
|
2240 | pushAttribute(target, responseState, propKey, propValue);
|
2241 | break;
|
2242 | }
|
2243 | }
|
2244 | }
|
2245 |
|
2246 | if (selectedValue != null) {
|
2247 | var stringValue;
|
2248 |
|
2249 | if (value !== null) {
|
2250 | {
|
2251 | checkAttributeStringCoercion(value, 'value');
|
2252 | }
|
2253 |
|
2254 | stringValue = '' + value;
|
2255 | } else {
|
2256 | {
|
2257 | if (innerHTML !== null) {
|
2258 | if (!didWarnInvalidOptionInnerHTML) {
|
2259 | didWarnInvalidOptionInnerHTML = true;
|
2260 |
|
2261 | error('Pass a `value` prop if you set dangerouslyInnerHTML so React knows ' + 'which value should be selected.');
|
2262 | }
|
2263 | }
|
2264 | }
|
2265 |
|
2266 | stringValue = flattenOptionChildren(children);
|
2267 | }
|
2268 |
|
2269 | if (isArray(selectedValue)) {
|
2270 |
|
2271 | for (var i = 0; i < selectedValue.length; i++) {
|
2272 | {
|
2273 | checkAttributeStringCoercion(selectedValue[i], 'value');
|
2274 | }
|
2275 |
|
2276 | var v = '' + selectedValue[i];
|
2277 |
|
2278 | if (v === stringValue) {
|
2279 | target.push(selectedMarkerAttribute);
|
2280 | break;
|
2281 | }
|
2282 | }
|
2283 | } else {
|
2284 | {
|
2285 | checkAttributeStringCoercion(selectedValue, 'select.value');
|
2286 | }
|
2287 |
|
2288 | if ('' + selectedValue === stringValue) {
|
2289 | target.push(selectedMarkerAttribute);
|
2290 | }
|
2291 | }
|
2292 | } else if (selected) {
|
2293 | target.push(selectedMarkerAttribute);
|
2294 | }
|
2295 |
|
2296 | target.push(endOfStartTag);
|
2297 | pushInnerHTML(target, innerHTML, children);
|
2298 | return children;
|
2299 | }
|
2300 |
|
2301 | function pushInput(target, props, responseState) {
|
2302 | {
|
2303 | checkControlledValueProps('input', props);
|
2304 |
|
2305 | if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnDefaultChecked) {
|
2306 | error('%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components', 'A component', props.type);
|
2307 |
|
2308 | didWarnDefaultChecked = true;
|
2309 | }
|
2310 |
|
2311 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultInputValue) {
|
2312 | error('%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components', 'A component', props.type);
|
2313 |
|
2314 | didWarnDefaultInputValue = true;
|
2315 | }
|
2316 | }
|
2317 |
|
2318 | target.push(startChunkForTag('input'));
|
2319 | var value = null;
|
2320 | var defaultValue = null;
|
2321 | var checked = null;
|
2322 | var defaultChecked = null;
|
2323 |
|
2324 | for (var propKey in props) {
|
2325 | if (hasOwnProperty.call(props, propKey)) {
|
2326 | var propValue = props[propKey];
|
2327 |
|
2328 | if (propValue == null) {
|
2329 | continue;
|
2330 | }
|
2331 |
|
2332 | switch (propKey) {
|
2333 | case 'children':
|
2334 | case 'dangerouslySetInnerHTML':
|
2335 | throw new Error('input' + " is a self-closing tag and must neither have `children` nor " + 'use `dangerouslySetInnerHTML`.');
|
2336 |
|
2337 |
|
2338 | case 'defaultChecked':
|
2339 | defaultChecked = propValue;
|
2340 | break;
|
2341 |
|
2342 | case 'defaultValue':
|
2343 | defaultValue = propValue;
|
2344 | break;
|
2345 |
|
2346 | case 'checked':
|
2347 | checked = propValue;
|
2348 | break;
|
2349 |
|
2350 | case 'value':
|
2351 | value = propValue;
|
2352 | break;
|
2353 |
|
2354 | default:
|
2355 | pushAttribute(target, responseState, propKey, propValue);
|
2356 | break;
|
2357 | }
|
2358 | }
|
2359 | }
|
2360 |
|
2361 | if (checked !== null) {
|
2362 | pushAttribute(target, responseState, 'checked', checked);
|
2363 | } else if (defaultChecked !== null) {
|
2364 | pushAttribute(target, responseState, 'checked', defaultChecked);
|
2365 | }
|
2366 |
|
2367 | if (value !== null) {
|
2368 | pushAttribute(target, responseState, 'value', value);
|
2369 | } else if (defaultValue !== null) {
|
2370 | pushAttribute(target, responseState, 'value', defaultValue);
|
2371 | }
|
2372 |
|
2373 | target.push(endOfStartTagSelfClosing);
|
2374 | return null;
|
2375 | }
|
2376 |
|
2377 | function pushStartTextArea(target, props, responseState) {
|
2378 | {
|
2379 | checkControlledValueProps('textarea', props);
|
2380 |
|
2381 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultTextareaValue) {
|
2382 | error('Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components');
|
2383 |
|
2384 | didWarnDefaultTextareaValue = true;
|
2385 | }
|
2386 | }
|
2387 |
|
2388 | target.push(startChunkForTag('textarea'));
|
2389 | var value = null;
|
2390 | var defaultValue = null;
|
2391 | var children = null;
|
2392 |
|
2393 | for (var propKey in props) {
|
2394 | if (hasOwnProperty.call(props, propKey)) {
|
2395 | var propValue = props[propKey];
|
2396 |
|
2397 | if (propValue == null) {
|
2398 | continue;
|
2399 | }
|
2400 |
|
2401 | switch (propKey) {
|
2402 | case 'children':
|
2403 | children = propValue;
|
2404 | break;
|
2405 |
|
2406 | case 'value':
|
2407 | value = propValue;
|
2408 | break;
|
2409 |
|
2410 | case 'defaultValue':
|
2411 | defaultValue = propValue;
|
2412 | break;
|
2413 |
|
2414 | case 'dangerouslySetInnerHTML':
|
2415 | throw new Error('`dangerouslySetInnerHTML` does not make sense on <textarea>.');
|
2416 |
|
2417 |
|
2418 | default:
|
2419 | pushAttribute(target, responseState, propKey, propValue);
|
2420 | break;
|
2421 | }
|
2422 | }
|
2423 | }
|
2424 |
|
2425 | if (value === null && defaultValue !== null) {
|
2426 | value = defaultValue;
|
2427 | }
|
2428 |
|
2429 | target.push(endOfStartTag);
|
2430 |
|
2431 | if (children != null) {
|
2432 | {
|
2433 | error('Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
|
2434 | }
|
2435 |
|
2436 | if (value != null) {
|
2437 | throw new Error('If you supply `defaultValue` on a <textarea>, do not pass children.');
|
2438 | }
|
2439 |
|
2440 | if (isArray(children)) {
|
2441 | if (children.length > 1) {
|
2442 | throw new Error('<textarea> can only have at most one child.');
|
2443 | }
|
2444 |
|
2445 |
|
2446 |
|
2447 | {
|
2448 | checkHtmlStringCoercion(children[0]);
|
2449 | }
|
2450 |
|
2451 | value = '' + children[0];
|
2452 | }
|
2453 |
|
2454 | {
|
2455 | checkHtmlStringCoercion(children);
|
2456 | }
|
2457 |
|
2458 | value = '' + children;
|
2459 | }
|
2460 |
|
2461 | if (typeof value === 'string' && value[0] === '\n') {
|
2462 |
|
2463 |
|
2464 |
|
2465 |
|
2466 |
|
2467 |
|
2468 |
|
2469 |
|
2470 |
|
2471 |
|
2472 | target.push(leadingNewline);
|
2473 | }
|
2474 |
|
2475 |
|
2476 |
|
2477 |
|
2478 | if (value !== null) {
|
2479 | {
|
2480 | checkAttributeStringCoercion(value, 'value');
|
2481 | }
|
2482 |
|
2483 | target.push(stringToChunk(encodeHTMLTextNode('' + value)));
|
2484 | }
|
2485 |
|
2486 | return null;
|
2487 | }
|
2488 |
|
2489 | function pushSelfClosing(target, props, tag, responseState) {
|
2490 | target.push(startChunkForTag(tag));
|
2491 |
|
2492 | for (var propKey in props) {
|
2493 | if (hasOwnProperty.call(props, propKey)) {
|
2494 | var propValue = props[propKey];
|
2495 |
|
2496 | if (propValue == null) {
|
2497 | continue;
|
2498 | }
|
2499 |
|
2500 | switch (propKey) {
|
2501 | case 'children':
|
2502 | case 'dangerouslySetInnerHTML':
|
2503 | throw new Error(tag + " is a self-closing tag and must neither have `children` nor " + 'use `dangerouslySetInnerHTML`.');
|
2504 |
|
2505 |
|
2506 | default:
|
2507 | pushAttribute(target, responseState, propKey, propValue);
|
2508 | break;
|
2509 | }
|
2510 | }
|
2511 | }
|
2512 |
|
2513 | target.push(endOfStartTagSelfClosing);
|
2514 | return null;
|
2515 | }
|
2516 |
|
2517 | function pushStartMenuItem(target, props, responseState) {
|
2518 | target.push(startChunkForTag('menuitem'));
|
2519 |
|
2520 | for (var propKey in props) {
|
2521 | if (hasOwnProperty.call(props, propKey)) {
|
2522 | var propValue = props[propKey];
|
2523 |
|
2524 | if (propValue == null) {
|
2525 | continue;
|
2526 | }
|
2527 |
|
2528 | switch (propKey) {
|
2529 | case 'children':
|
2530 | case 'dangerouslySetInnerHTML':
|
2531 | throw new Error('menuitems cannot have `children` nor `dangerouslySetInnerHTML`.');
|
2532 |
|
2533 |
|
2534 | default:
|
2535 | pushAttribute(target, responseState, propKey, propValue);
|
2536 | break;
|
2537 | }
|
2538 | }
|
2539 | }
|
2540 |
|
2541 | target.push(endOfStartTag);
|
2542 | return null;
|
2543 | }
|
2544 |
|
2545 | function pushStartGenericElement(target, props, tag, responseState) {
|
2546 | target.push(startChunkForTag(tag));
|
2547 | var children = null;
|
2548 | var innerHTML = null;
|
2549 |
|
2550 | for (var propKey in props) {
|
2551 | if (hasOwnProperty.call(props, propKey)) {
|
2552 | var propValue = props[propKey];
|
2553 |
|
2554 | if (propValue == null) {
|
2555 | continue;
|
2556 | }
|
2557 |
|
2558 | switch (propKey) {
|
2559 | case 'children':
|
2560 | children = propValue;
|
2561 | break;
|
2562 |
|
2563 | case 'dangerouslySetInnerHTML':
|
2564 | innerHTML = propValue;
|
2565 | break;
|
2566 |
|
2567 | default:
|
2568 | pushAttribute(target, responseState, propKey, propValue);
|
2569 | break;
|
2570 | }
|
2571 | }
|
2572 | }
|
2573 |
|
2574 | target.push(endOfStartTag);
|
2575 | pushInnerHTML(target, innerHTML, children);
|
2576 |
|
2577 | if (typeof children === 'string') {
|
2578 |
|
2579 |
|
2580 | target.push(stringToChunk(encodeHTMLTextNode(children)));
|
2581 | return null;
|
2582 | }
|
2583 |
|
2584 | return children;
|
2585 | }
|
2586 |
|
2587 | function pushStartCustomElement(target, props, tag, responseState) {
|
2588 | target.push(startChunkForTag(tag));
|
2589 | var children = null;
|
2590 | var innerHTML = null;
|
2591 |
|
2592 | for (var propKey in props) {
|
2593 | if (hasOwnProperty.call(props, propKey)) {
|
2594 | var propValue = props[propKey];
|
2595 |
|
2596 | if (propValue == null) {
|
2597 | continue;
|
2598 | }
|
2599 |
|
2600 | switch (propKey) {
|
2601 | case 'children':
|
2602 | children = propValue;
|
2603 | break;
|
2604 |
|
2605 | case 'dangerouslySetInnerHTML':
|
2606 | innerHTML = propValue;
|
2607 | break;
|
2608 |
|
2609 | case 'style':
|
2610 | pushStyle(target, responseState, propValue);
|
2611 | break;
|
2612 |
|
2613 | case 'suppressContentEditableWarning':
|
2614 | case 'suppressHydrationWarning':
|
2615 |
|
2616 | break;
|
2617 |
|
2618 | default:
|
2619 | if (isAttributeNameSafe(propKey) && typeof propValue !== 'function' && typeof propValue !== 'symbol') {
|
2620 | target.push(attributeSeparator, stringToChunk(propKey), attributeAssign, stringToChunk(escapeTextForBrowser(propValue)), attributeEnd);
|
2621 | }
|
2622 |
|
2623 | break;
|
2624 | }
|
2625 | }
|
2626 | }
|
2627 |
|
2628 | target.push(endOfStartTag);
|
2629 | pushInnerHTML(target, innerHTML, children);
|
2630 | return children;
|
2631 | }
|
2632 |
|
2633 | var leadingNewline = stringToPrecomputedChunk('\n');
|
2634 |
|
2635 | function pushStartPreformattedElement(target, props, tag, responseState) {
|
2636 | target.push(startChunkForTag(tag));
|
2637 | var children = null;
|
2638 | var innerHTML = null;
|
2639 |
|
2640 | for (var propKey in props) {
|
2641 | if (hasOwnProperty.call(props, propKey)) {
|
2642 | var propValue = props[propKey];
|
2643 |
|
2644 | if (propValue == null) {
|
2645 | continue;
|
2646 | }
|
2647 |
|
2648 | switch (propKey) {
|
2649 | case 'children':
|
2650 | children = propValue;
|
2651 | break;
|
2652 |
|
2653 | case 'dangerouslySetInnerHTML':
|
2654 | innerHTML = propValue;
|
2655 | break;
|
2656 |
|
2657 | default:
|
2658 | pushAttribute(target, responseState, propKey, propValue);
|
2659 | break;
|
2660 | }
|
2661 | }
|
2662 | }
|
2663 |
|
2664 | target.push(endOfStartTag);
|
2665 |
|
2666 |
|
2667 |
|
2668 |
|
2669 |
|
2670 |
|
2671 |
|
2672 |
|
2673 |
|
2674 |
|
2675 |
|
2676 |
|
2677 | if (innerHTML != null) {
|
2678 | if (children != null) {
|
2679 | throw new Error('Can only set one of `children` or `props.dangerouslySetInnerHTML`.');
|
2680 | }
|
2681 |
|
2682 | if (typeof innerHTML !== 'object' || !('__html' in innerHTML)) {
|
2683 | throw new Error('`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://reactjs.org/link/dangerously-set-inner-html ' + 'for more information.');
|
2684 | }
|
2685 |
|
2686 | var html = innerHTML.__html;
|
2687 |
|
2688 | if (html !== null && html !== undefined) {
|
2689 | if (typeof html === 'string' && html.length > 0 && html[0] === '\n') {
|
2690 | target.push(leadingNewline, stringToChunk(html));
|
2691 | } else {
|
2692 | {
|
2693 | checkHtmlStringCoercion(html);
|
2694 | }
|
2695 |
|
2696 | target.push(stringToChunk('' + html));
|
2697 | }
|
2698 | }
|
2699 | }
|
2700 |
|
2701 | if (typeof children === 'string' && children[0] === '\n') {
|
2702 | target.push(leadingNewline);
|
2703 | }
|
2704 |
|
2705 | return children;
|
2706 | }
|
2707 |
|
2708 |
|
2709 |
|
2710 |
|
2711 | var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/;
|
2712 |
|
2713 | var validatedTagCache = new Map();
|
2714 |
|
2715 | function startChunkForTag(tag) {
|
2716 | var tagStartChunk = validatedTagCache.get(tag);
|
2717 |
|
2718 | if (tagStartChunk === undefined) {
|
2719 | if (!VALID_TAG_REGEX.test(tag)) {
|
2720 | throw new Error("Invalid tag: " + tag);
|
2721 | }
|
2722 |
|
2723 | tagStartChunk = stringToPrecomputedChunk('<' + tag);
|
2724 | validatedTagCache.set(tag, tagStartChunk);
|
2725 | }
|
2726 |
|
2727 | return tagStartChunk;
|
2728 | }
|
2729 |
|
2730 | var DOCTYPE = stringToPrecomputedChunk('<!DOCTYPE html>');
|
2731 | function pushStartInstance(target, type, props, responseState, formatContext) {
|
2732 | {
|
2733 | validateProperties(type, props);
|
2734 | validateProperties$1(type, props);
|
2735 | validateProperties$2(type, props, null);
|
2736 |
|
2737 | if (!props.suppressContentEditableWarning && props.contentEditable && props.children != null) {
|
2738 | error('A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.');
|
2739 | }
|
2740 |
|
2741 | if (formatContext.insertionMode !== SVG_MODE && formatContext.insertionMode !== MATHML_MODE) {
|
2742 | if (type.indexOf('-') === -1 && typeof props.is !== 'string' && type.toLowerCase() !== type) {
|
2743 | error('<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', type);
|
2744 | }
|
2745 | }
|
2746 | }
|
2747 |
|
2748 | switch (type) {
|
2749 |
|
2750 | case 'select':
|
2751 | return pushStartSelect(target, props, responseState);
|
2752 |
|
2753 | case 'option':
|
2754 | return pushStartOption(target, props, responseState, formatContext);
|
2755 |
|
2756 | case 'textarea':
|
2757 | return pushStartTextArea(target, props, responseState);
|
2758 |
|
2759 | case 'input':
|
2760 | return pushInput(target, props, responseState);
|
2761 |
|
2762 | case 'menuitem':
|
2763 | return pushStartMenuItem(target, props, responseState);
|
2764 |
|
2765 |
|
2766 | case 'listing':
|
2767 | case 'pre':
|
2768 | {
|
2769 | return pushStartPreformattedElement(target, props, type, responseState);
|
2770 | }
|
2771 |
|
2772 |
|
2773 | case 'area':
|
2774 | case 'base':
|
2775 | case 'br':
|
2776 | case 'col':
|
2777 | case 'embed':
|
2778 | case 'hr':
|
2779 | case 'img':
|
2780 | case 'keygen':
|
2781 | case 'link':
|
2782 | case 'meta':
|
2783 | case 'param':
|
2784 | case 'source':
|
2785 | case 'track':
|
2786 | case 'wbr':
|
2787 | {
|
2788 | return pushSelfClosing(target, props, type, responseState);
|
2789 | }
|
2790 |
|
2791 |
|
2792 |
|
2793 | case 'annotation-xml':
|
2794 | case 'color-profile':
|
2795 | case 'font-face':
|
2796 | case 'font-face-src':
|
2797 | case 'font-face-uri':
|
2798 | case 'font-face-format':
|
2799 | case 'font-face-name':
|
2800 | case 'missing-glyph':
|
2801 | {
|
2802 | return pushStartGenericElement(target, props, type, responseState);
|
2803 | }
|
2804 |
|
2805 | case 'html':
|
2806 | {
|
2807 | if (formatContext.insertionMode === ROOT_HTML_MODE) {
|
2808 |
|
2809 |
|
2810 |
|
2811 | target.push(DOCTYPE);
|
2812 | }
|
2813 |
|
2814 | return pushStartGenericElement(target, props, type, responseState);
|
2815 | }
|
2816 |
|
2817 | default:
|
2818 | {
|
2819 | if (type.indexOf('-') === -1 && typeof props.is !== 'string') {
|
2820 |
|
2821 | return pushStartGenericElement(target, props, type, responseState);
|
2822 | } else {
|
2823 |
|
2824 | return pushStartCustomElement(target, props, type, responseState);
|
2825 | }
|
2826 | }
|
2827 | }
|
2828 | }
|
2829 | var endTag1 = stringToPrecomputedChunk('</');
|
2830 | var endTag2 = stringToPrecomputedChunk('>');
|
2831 | function pushEndInstance(target, type, props) {
|
2832 | switch (type) {
|
2833 |
|
2834 |
|
2835 |
|
2836 | case 'area':
|
2837 | case 'base':
|
2838 | case 'br':
|
2839 | case 'col':
|
2840 | case 'embed':
|
2841 | case 'hr':
|
2842 | case 'img':
|
2843 | case 'input':
|
2844 | case 'keygen':
|
2845 | case 'link':
|
2846 | case 'meta':
|
2847 | case 'param':
|
2848 | case 'source':
|
2849 | case 'track':
|
2850 | case 'wbr':
|
2851 | {
|
2852 |
|
2853 | break;
|
2854 | }
|
2855 |
|
2856 | default:
|
2857 | {
|
2858 | target.push(endTag1, stringToChunk(type), endTag2);
|
2859 | }
|
2860 | }
|
2861 | }
|
2862 | function writeCompletedRoot(destination, responseState) {
|
2863 | var bootstrapChunks = responseState.bootstrapChunks;
|
2864 | var i = 0;
|
2865 |
|
2866 | for (; i < bootstrapChunks.length - 1; i++) {
|
2867 | writeChunk(destination, bootstrapChunks[i]);
|
2868 | }
|
2869 |
|
2870 | if (i < bootstrapChunks.length) {
|
2871 | return writeChunkAndReturn(destination, bootstrapChunks[i]);
|
2872 | }
|
2873 |
|
2874 | return true;
|
2875 | }
|
2876 |
|
2877 |
|
2878 |
|
2879 |
|
2880 | var placeholder1 = stringToPrecomputedChunk('<template id="');
|
2881 | var placeholder2 = stringToPrecomputedChunk('"></template>');
|
2882 | function writePlaceholder(destination, responseState, id) {
|
2883 | writeChunk(destination, placeholder1);
|
2884 | writeChunk(destination, responseState.placeholderPrefix);
|
2885 | var formattedID = stringToChunk(id.toString(16));
|
2886 | writeChunk(destination, formattedID);
|
2887 | return writeChunkAndReturn(destination, placeholder2);
|
2888 | }
|
2889 |
|
2890 | var startCompletedSuspenseBoundary = stringToPrecomputedChunk('<!--$-->');
|
2891 | var startPendingSuspenseBoundary1 = stringToPrecomputedChunk('<!--$?--><template id="');
|
2892 | var startPendingSuspenseBoundary2 = stringToPrecomputedChunk('"></template>');
|
2893 | var startClientRenderedSuspenseBoundary = stringToPrecomputedChunk('<!--$!-->');
|
2894 | var endSuspenseBoundary = stringToPrecomputedChunk('<!--/$-->');
|
2895 | function writeStartCompletedSuspenseBoundary(destination, responseState) {
|
2896 | return writeChunkAndReturn(destination, startCompletedSuspenseBoundary);
|
2897 | }
|
2898 | function writeStartPendingSuspenseBoundary(destination, responseState, id) {
|
2899 | writeChunk(destination, startPendingSuspenseBoundary1);
|
2900 |
|
2901 | if (id === null) {
|
2902 | throw new Error('An ID must have been assigned before we can complete the boundary.');
|
2903 | }
|
2904 |
|
2905 | writeChunk(destination, id);
|
2906 | return writeChunkAndReturn(destination, startPendingSuspenseBoundary2);
|
2907 | }
|
2908 | function writeStartClientRenderedSuspenseBoundary(destination, responseState) {
|
2909 | return writeChunkAndReturn(destination, startClientRenderedSuspenseBoundary);
|
2910 | }
|
2911 | function writeEndCompletedSuspenseBoundary(destination, responseState) {
|
2912 | return writeChunkAndReturn(destination, endSuspenseBoundary);
|
2913 | }
|
2914 | function writeEndPendingSuspenseBoundary(destination, responseState) {
|
2915 | return writeChunkAndReturn(destination, endSuspenseBoundary);
|
2916 | }
|
2917 | function writeEndClientRenderedSuspenseBoundary(destination, responseState) {
|
2918 | return writeChunkAndReturn(destination, endSuspenseBoundary);
|
2919 | }
|
2920 | var startSegmentHTML = stringToPrecomputedChunk('<div hidden id="');
|
2921 | var startSegmentHTML2 = stringToPrecomputedChunk('">');
|
2922 | var endSegmentHTML = stringToPrecomputedChunk('</div>');
|
2923 | var startSegmentSVG = stringToPrecomputedChunk('<svg aria-hidden="true" style="display:none" id="');
|
2924 | var startSegmentSVG2 = stringToPrecomputedChunk('">');
|
2925 | var endSegmentSVG = stringToPrecomputedChunk('</svg>');
|
2926 | var startSegmentMathML = stringToPrecomputedChunk('<math aria-hidden="true" style="display:none" id="');
|
2927 | var startSegmentMathML2 = stringToPrecomputedChunk('">');
|
2928 | var endSegmentMathML = stringToPrecomputedChunk('</math>');
|
2929 | var startSegmentTable = stringToPrecomputedChunk('<table hidden id="');
|
2930 | var startSegmentTable2 = stringToPrecomputedChunk('">');
|
2931 | var endSegmentTable = stringToPrecomputedChunk('</table>');
|
2932 | var startSegmentTableBody = stringToPrecomputedChunk('<table hidden><tbody id="');
|
2933 | var startSegmentTableBody2 = stringToPrecomputedChunk('">');
|
2934 | var endSegmentTableBody = stringToPrecomputedChunk('</tbody></table>');
|
2935 | var startSegmentTableRow = stringToPrecomputedChunk('<table hidden><tr id="');
|
2936 | var startSegmentTableRow2 = stringToPrecomputedChunk('">');
|
2937 | var endSegmentTableRow = stringToPrecomputedChunk('</tr></table>');
|
2938 | var startSegmentColGroup = stringToPrecomputedChunk('<table hidden><colgroup id="');
|
2939 | var startSegmentColGroup2 = stringToPrecomputedChunk('">');
|
2940 | var endSegmentColGroup = stringToPrecomputedChunk('</colgroup></table>');
|
2941 | function writeStartSegment(destination, responseState, formatContext, id) {
|
2942 | switch (formatContext.insertionMode) {
|
2943 | case ROOT_HTML_MODE:
|
2944 | case HTML_MODE:
|
2945 | {
|
2946 | writeChunk(destination, startSegmentHTML);
|
2947 | writeChunk(destination, responseState.segmentPrefix);
|
2948 | writeChunk(destination, stringToChunk(id.toString(16)));
|
2949 | return writeChunkAndReturn(destination, startSegmentHTML2);
|
2950 | }
|
2951 |
|
2952 | case SVG_MODE:
|
2953 | {
|
2954 | writeChunk(destination, startSegmentSVG);
|
2955 | writeChunk(destination, responseState.segmentPrefix);
|
2956 | writeChunk(destination, stringToChunk(id.toString(16)));
|
2957 | return writeChunkAndReturn(destination, startSegmentSVG2);
|
2958 | }
|
2959 |
|
2960 | case MATHML_MODE:
|
2961 | {
|
2962 | writeChunk(destination, startSegmentMathML);
|
2963 | writeChunk(destination, responseState.segmentPrefix);
|
2964 | writeChunk(destination, stringToChunk(id.toString(16)));
|
2965 | return writeChunkAndReturn(destination, startSegmentMathML2);
|
2966 | }
|
2967 |
|
2968 | case HTML_TABLE_MODE:
|
2969 | {
|
2970 | writeChunk(destination, startSegmentTable);
|
2971 | writeChunk(destination, responseState.segmentPrefix);
|
2972 | writeChunk(destination, stringToChunk(id.toString(16)));
|
2973 | return writeChunkAndReturn(destination, startSegmentTable2);
|
2974 | }
|
2975 |
|
2976 |
|
2977 |
|
2978 |
|
2979 |
|
2980 | case HTML_TABLE_BODY_MODE:
|
2981 | {
|
2982 | writeChunk(destination, startSegmentTableBody);
|
2983 | writeChunk(destination, responseState.segmentPrefix);
|
2984 | writeChunk(destination, stringToChunk(id.toString(16)));
|
2985 | return writeChunkAndReturn(destination, startSegmentTableBody2);
|
2986 | }
|
2987 |
|
2988 | case HTML_TABLE_ROW_MODE:
|
2989 | {
|
2990 | writeChunk(destination, startSegmentTableRow);
|
2991 | writeChunk(destination, responseState.segmentPrefix);
|
2992 | writeChunk(destination, stringToChunk(id.toString(16)));
|
2993 | return writeChunkAndReturn(destination, startSegmentTableRow2);
|
2994 | }
|
2995 |
|
2996 | case HTML_COLGROUP_MODE:
|
2997 | {
|
2998 | writeChunk(destination, startSegmentColGroup);
|
2999 | writeChunk(destination, responseState.segmentPrefix);
|
3000 | writeChunk(destination, stringToChunk(id.toString(16)));
|
3001 | return writeChunkAndReturn(destination, startSegmentColGroup2);
|
3002 | }
|
3003 |
|
3004 | default:
|
3005 | {
|
3006 | throw new Error('Unknown insertion mode. This is a bug in React.');
|
3007 | }
|
3008 | }
|
3009 | }
|
3010 | function writeEndSegment(destination, formatContext) {
|
3011 | switch (formatContext.insertionMode) {
|
3012 | case ROOT_HTML_MODE:
|
3013 | case HTML_MODE:
|
3014 | {
|
3015 | return writeChunkAndReturn(destination, endSegmentHTML);
|
3016 | }
|
3017 |
|
3018 | case SVG_MODE:
|
3019 | {
|
3020 | return writeChunkAndReturn(destination, endSegmentSVG);
|
3021 | }
|
3022 |
|
3023 | case MATHML_MODE:
|
3024 | {
|
3025 | return writeChunkAndReturn(destination, endSegmentMathML);
|
3026 | }
|
3027 |
|
3028 | case HTML_TABLE_MODE:
|
3029 | {
|
3030 | return writeChunkAndReturn(destination, endSegmentTable);
|
3031 | }
|
3032 |
|
3033 | case HTML_TABLE_BODY_MODE:
|
3034 | {
|
3035 | return writeChunkAndReturn(destination, endSegmentTableBody);
|
3036 | }
|
3037 |
|
3038 | case HTML_TABLE_ROW_MODE:
|
3039 | {
|
3040 | return writeChunkAndReturn(destination, endSegmentTableRow);
|
3041 | }
|
3042 |
|
3043 | case HTML_COLGROUP_MODE:
|
3044 | {
|
3045 | return writeChunkAndReturn(destination, endSegmentColGroup);
|
3046 | }
|
3047 |
|
3048 | default:
|
3049 | {
|
3050 | throw new Error('Unknown insertion mode. This is a bug in React.');
|
3051 | }
|
3052 | }
|
3053 | }
|
3054 |
|
3055 |
|
3056 |
|
3057 |
|
3058 |
|
3059 |
|
3060 |
|
3061 |
|
3062 |
|
3063 |
|
3064 |
|
3065 |
|
3066 |
|
3067 |
|
3068 |
|
3069 |
|
3070 |
|
3071 |
|
3072 |
|
3073 |
|
3074 |
|
3075 |
|
3076 |
|
3077 |
|
3078 |
|
3079 |
|
3080 |
|
3081 |
|
3082 |
|
3083 |
|
3084 |
|
3085 |
|
3086 |
|
3087 |
|
3088 |
|
3089 |
|
3090 |
|
3091 |
|
3092 |
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 |
|
3098 |
|
3099 |
|
3100 |
|
3101 |
|
3102 |
|
3103 |
|
3104 |
|
3105 |
|
3106 |
|
3107 |
|
3108 |
|
3109 |
|
3110 |
|
3111 |
|
3112 |
|
3113 |
|
3114 |
|
3115 |
|
3116 |
|
3117 |
|
3118 |
|
3119 |
|
3120 |
|
3121 |
|
3122 |
|
3123 |
|
3124 |
|
3125 |
|
3126 |
|
3127 |
|
3128 |
|
3129 |
|
3130 |
|
3131 |
|
3132 |
|
3133 |
|
3134 |
|
3135 |
|
3136 |
|
3137 |
|
3138 |
|
3139 |
|
3140 |
|
3141 |
|
3142 |
|
3143 |
|
3144 |
|
3145 |
|
3146 |
|
3147 |
|
3148 |
|
3149 |
|
3150 |
|
3151 |
|
3152 |
|
3153 |
|
3154 |
|
3155 | var completeSegmentFunction = 'function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)}';
|
3156 | var completeBoundaryFunction = 'function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}}';
|
3157 | var clientRenderFunction = 'function $RX(a){if(a=document.getElementById(a))a=a.previousSibling,a.data="$!",a._reactRetry&&a._reactRetry()}';
|
3158 | var completeSegmentScript1Full = stringToPrecomputedChunk(completeSegmentFunction + ';$RS("');
|
3159 | var completeSegmentScript1Partial = stringToPrecomputedChunk('$RS("');
|
3160 | var completeSegmentScript2 = stringToPrecomputedChunk('","');
|
3161 | var completeSegmentScript3 = stringToPrecomputedChunk('")</script>');
|
3162 | function writeCompletedSegmentInstruction(destination, responseState, contentSegmentID) {
|
3163 | writeChunk(destination, responseState.startInlineScript);
|
3164 |
|
3165 | if (!responseState.sentCompleteSegmentFunction) {
|
3166 |
|
3167 | responseState.sentCompleteSegmentFunction = true;
|
3168 | writeChunk(destination, completeSegmentScript1Full);
|
3169 | } else {
|
3170 |
|
3171 | writeChunk(destination, completeSegmentScript1Partial);
|
3172 | }
|
3173 |
|
3174 | writeChunk(destination, responseState.segmentPrefix);
|
3175 | var formattedID = stringToChunk(contentSegmentID.toString(16));
|
3176 | writeChunk(destination, formattedID);
|
3177 | writeChunk(destination, completeSegmentScript2);
|
3178 | writeChunk(destination, responseState.placeholderPrefix);
|
3179 | writeChunk(destination, formattedID);
|
3180 | return writeChunkAndReturn(destination, completeSegmentScript3);
|
3181 | }
|
3182 | var completeBoundaryScript1Full = stringToPrecomputedChunk(completeBoundaryFunction + ';$RC("');
|
3183 | var completeBoundaryScript1Partial = stringToPrecomputedChunk('$RC("');
|
3184 | var completeBoundaryScript2 = stringToPrecomputedChunk('","');
|
3185 | var completeBoundaryScript3 = stringToPrecomputedChunk('")</script>');
|
3186 | function writeCompletedBoundaryInstruction(destination, responseState, boundaryID, contentSegmentID) {
|
3187 | writeChunk(destination, responseState.startInlineScript);
|
3188 |
|
3189 | if (!responseState.sentCompleteBoundaryFunction) {
|
3190 |
|
3191 | responseState.sentCompleteBoundaryFunction = true;
|
3192 | writeChunk(destination, completeBoundaryScript1Full);
|
3193 | } else {
|
3194 |
|
3195 | writeChunk(destination, completeBoundaryScript1Partial);
|
3196 | }
|
3197 |
|
3198 | if (boundaryID === null) {
|
3199 | throw new Error('An ID must have been assigned before we can complete the boundary.');
|
3200 | }
|
3201 |
|
3202 | var formattedContentID = stringToChunk(contentSegmentID.toString(16));
|
3203 | writeChunk(destination, boundaryID);
|
3204 | writeChunk(destination, completeBoundaryScript2);
|
3205 | writeChunk(destination, responseState.segmentPrefix);
|
3206 | writeChunk(destination, formattedContentID);
|
3207 | return writeChunkAndReturn(destination, completeBoundaryScript3);
|
3208 | }
|
3209 | var clientRenderScript1Full = stringToPrecomputedChunk(clientRenderFunction + ';$RX("');
|
3210 | var clientRenderScript1Partial = stringToPrecomputedChunk('$RX("');
|
3211 | var clientRenderScript2 = stringToPrecomputedChunk('")</script>');
|
3212 | function writeClientRenderBoundaryInstruction(destination, responseState, boundaryID) {
|
3213 | writeChunk(destination, responseState.startInlineScript);
|
3214 |
|
3215 | if (!responseState.sentClientRenderFunction) {
|
3216 |
|
3217 | responseState.sentClientRenderFunction = true;
|
3218 | writeChunk(destination, clientRenderScript1Full);
|
3219 | } else {
|
3220 |
|
3221 | writeChunk(destination, clientRenderScript1Partial);
|
3222 | }
|
3223 |
|
3224 | if (boundaryID === null) {
|
3225 | throw new Error('An ID must have been assigned before we can complete the boundary.');
|
3226 | }
|
3227 |
|
3228 | writeChunk(destination, boundaryID);
|
3229 | return writeChunkAndReturn(destination, clientRenderScript2);
|
3230 | }
|
3231 |
|
3232 | var assign = Object.assign;
|
3233 |
|
3234 |
|
3235 |
|
3236 |
|
3237 |
|
3238 | var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
3239 | var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
3240 | var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
3241 | var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
3242 | var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
3243 | var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
3244 | var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
3245 | var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
3246 | var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
3247 | var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
3248 | var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
3249 | var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
3250 | var REACT_SCOPE_TYPE = Symbol.for('react.scope');
|
3251 | var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for('react.debug_trace_mode');
|
3252 | var REACT_LEGACY_HIDDEN_TYPE = Symbol.for('react.legacy_hidden');
|
3253 | var REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for('react.default_value');
|
3254 | var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
3255 | var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
3256 | function getIteratorFn(maybeIterable) {
|
3257 | if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
3258 | return null;
|
3259 | }
|
3260 |
|
3261 | var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
3262 |
|
3263 | if (typeof maybeIterator === 'function') {
|
3264 | return maybeIterator;
|
3265 | }
|
3266 |
|
3267 | return null;
|
3268 | }
|
3269 |
|
3270 | function getWrappedName(outerType, innerType, wrapperName) {
|
3271 | var displayName = outerType.displayName;
|
3272 |
|
3273 | if (displayName) {
|
3274 | return displayName;
|
3275 | }
|
3276 |
|
3277 | var functionName = innerType.displayName || innerType.name || '';
|
3278 | return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
3279 | }
|
3280 |
|
3281 |
|
3282 | function getContextName(type) {
|
3283 | return type.displayName || 'Context';
|
3284 | }
|
3285 |
|
3286 |
|
3287 | function getComponentNameFromType(type) {
|
3288 | if (type == null) {
|
3289 |
|
3290 | return null;
|
3291 | }
|
3292 |
|
3293 | {
|
3294 | if (typeof type.tag === 'number') {
|
3295 | error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
3296 | }
|
3297 | }
|
3298 |
|
3299 | if (typeof type === 'function') {
|
3300 | return type.displayName || type.name || null;
|
3301 | }
|
3302 |
|
3303 | if (typeof type === 'string') {
|
3304 | return type;
|
3305 | }
|
3306 |
|
3307 | switch (type) {
|
3308 | case REACT_FRAGMENT_TYPE:
|
3309 | return 'Fragment';
|
3310 |
|
3311 | case REACT_PORTAL_TYPE:
|
3312 | return 'Portal';
|
3313 |
|
3314 | case REACT_PROFILER_TYPE:
|
3315 | return 'Profiler';
|
3316 |
|
3317 | case REACT_STRICT_MODE_TYPE:
|
3318 | return 'StrictMode';
|
3319 |
|
3320 | case REACT_SUSPENSE_TYPE:
|
3321 | return 'Suspense';
|
3322 |
|
3323 | case REACT_SUSPENSE_LIST_TYPE:
|
3324 | return 'SuspenseList';
|
3325 |
|
3326 | }
|
3327 |
|
3328 | if (typeof type === 'object') {
|
3329 | switch (type.$$typeof) {
|
3330 | case REACT_CONTEXT_TYPE:
|
3331 | var context = type;
|
3332 | return getContextName(context) + '.Consumer';
|
3333 |
|
3334 | case REACT_PROVIDER_TYPE:
|
3335 | var provider = type;
|
3336 | return getContextName(provider._context) + '.Provider';
|
3337 |
|
3338 | case REACT_FORWARD_REF_TYPE:
|
3339 | return getWrappedName(type, type.render, 'ForwardRef');
|
3340 |
|
3341 | case REACT_MEMO_TYPE:
|
3342 | var outerName = type.displayName || null;
|
3343 |
|
3344 | if (outerName !== null) {
|
3345 | return outerName;
|
3346 | }
|
3347 |
|
3348 | return getComponentNameFromType(type.type) || 'Memo';
|
3349 |
|
3350 | case REACT_LAZY_TYPE:
|
3351 | {
|
3352 | var lazyComponent = type;
|
3353 | var payload = lazyComponent._payload;
|
3354 | var init = lazyComponent._init;
|
3355 |
|
3356 | try {
|
3357 | return getComponentNameFromType(init(payload));
|
3358 | } catch (x) {
|
3359 | return null;
|
3360 | }
|
3361 | }
|
3362 |
|
3363 |
|
3364 | }
|
3365 | }
|
3366 |
|
3367 | return null;
|
3368 | }
|
3369 |
|
3370 |
|
3371 |
|
3372 |
|
3373 |
|
3374 | var disabledDepth = 0;
|
3375 | var prevLog;
|
3376 | var prevInfo;
|
3377 | var prevWarn;
|
3378 | var prevError;
|
3379 | var prevGroup;
|
3380 | var prevGroupCollapsed;
|
3381 | var prevGroupEnd;
|
3382 |
|
3383 | function disabledLog() {}
|
3384 |
|
3385 | disabledLog.__reactDisabledLog = true;
|
3386 | function disableLogs() {
|
3387 | {
|
3388 | if (disabledDepth === 0) {
|
3389 |
|
3390 | prevLog = console.log;
|
3391 | prevInfo = console.info;
|
3392 | prevWarn = console.warn;
|
3393 | prevError = console.error;
|
3394 | prevGroup = console.group;
|
3395 | prevGroupCollapsed = console.groupCollapsed;
|
3396 | prevGroupEnd = console.groupEnd;
|
3397 |
|
3398 | var props = {
|
3399 | configurable: true,
|
3400 | enumerable: true,
|
3401 | value: disabledLog,
|
3402 | writable: true
|
3403 | };
|
3404 |
|
3405 | Object.defineProperties(console, {
|
3406 | info: props,
|
3407 | log: props,
|
3408 | warn: props,
|
3409 | error: props,
|
3410 | group: props,
|
3411 | groupCollapsed: props,
|
3412 | groupEnd: props
|
3413 | });
|
3414 |
|
3415 | }
|
3416 |
|
3417 | disabledDepth++;
|
3418 | }
|
3419 | }
|
3420 | function reenableLogs() {
|
3421 | {
|
3422 | disabledDepth--;
|
3423 |
|
3424 | if (disabledDepth === 0) {
|
3425 |
|
3426 | var props = {
|
3427 | configurable: true,
|
3428 | enumerable: true,
|
3429 | writable: true
|
3430 | };
|
3431 |
|
3432 | Object.defineProperties(console, {
|
3433 | log: assign({}, props, {
|
3434 | value: prevLog
|
3435 | }),
|
3436 | info: assign({}, props, {
|
3437 | value: prevInfo
|
3438 | }),
|
3439 | warn: assign({}, props, {
|
3440 | value: prevWarn
|
3441 | }),
|
3442 | error: assign({}, props, {
|
3443 | value: prevError
|
3444 | }),
|
3445 | group: assign({}, props, {
|
3446 | value: prevGroup
|
3447 | }),
|
3448 | groupCollapsed: assign({}, props, {
|
3449 | value: prevGroupCollapsed
|
3450 | }),
|
3451 | groupEnd: assign({}, props, {
|
3452 | value: prevGroupEnd
|
3453 | })
|
3454 | });
|
3455 |
|
3456 | }
|
3457 |
|
3458 | if (disabledDepth < 0) {
|
3459 | error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
3460 | }
|
3461 | }
|
3462 | }
|
3463 |
|
3464 | var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
3465 | var prefix;
|
3466 | function describeBuiltInComponentFrame(name, source, ownerFn) {
|
3467 | {
|
3468 | if (prefix === undefined) {
|
3469 |
|
3470 | try {
|
3471 | throw Error();
|
3472 | } catch (x) {
|
3473 | var match = x.stack.trim().match(/\n( *(at )?)/);
|
3474 | prefix = match && match[1] || '';
|
3475 | }
|
3476 | }
|
3477 |
|
3478 |
|
3479 | return '\n' + prefix + name;
|
3480 | }
|
3481 | }
|
3482 | var reentry = false;
|
3483 | var componentFrameCache;
|
3484 |
|
3485 | {
|
3486 | var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
3487 | componentFrameCache = new PossiblyWeakMap();
|
3488 | }
|
3489 |
|
3490 | function describeNativeComponentFrame(fn, construct) {
|
3491 |
|
3492 | if ( !fn || reentry) {
|
3493 | return '';
|
3494 | }
|
3495 |
|
3496 | {
|
3497 | var frame = componentFrameCache.get(fn);
|
3498 |
|
3499 | if (frame !== undefined) {
|
3500 | return frame;
|
3501 | }
|
3502 | }
|
3503 |
|
3504 | var control;
|
3505 | reentry = true;
|
3506 | var previousPrepareStackTrace = Error.prepareStackTrace;
|
3507 |
|
3508 | Error.prepareStackTrace = undefined;
|
3509 | var previousDispatcher;
|
3510 |
|
3511 | {
|
3512 | previousDispatcher = ReactCurrentDispatcher.current;
|
3513 |
|
3514 |
|
3515 | ReactCurrentDispatcher.current = null;
|
3516 | disableLogs();
|
3517 | }
|
3518 |
|
3519 | try {
|
3520 |
|
3521 | if (construct) {
|
3522 |
|
3523 | var Fake = function () {
|
3524 | throw Error();
|
3525 | };
|
3526 |
|
3527 |
|
3528 | Object.defineProperty(Fake.prototype, 'props', {
|
3529 | set: function () {
|
3530 |
|
3531 |
|
3532 | throw Error();
|
3533 | }
|
3534 | });
|
3535 |
|
3536 | if (typeof Reflect === 'object' && Reflect.construct) {
|
3537 |
|
3538 |
|
3539 | try {
|
3540 | Reflect.construct(Fake, []);
|
3541 | } catch (x) {
|
3542 | control = x;
|
3543 | }
|
3544 |
|
3545 | Reflect.construct(fn, [], Fake);
|
3546 | } else {
|
3547 | try {
|
3548 | Fake.call();
|
3549 | } catch (x) {
|
3550 | control = x;
|
3551 | }
|
3552 |
|
3553 | fn.call(Fake.prototype);
|
3554 | }
|
3555 | } else {
|
3556 | try {
|
3557 | throw Error();
|
3558 | } catch (x) {
|
3559 | control = x;
|
3560 | }
|
3561 |
|
3562 | fn();
|
3563 | }
|
3564 | } catch (sample) {
|
3565 |
|
3566 | if (sample && control && typeof sample.stack === 'string') {
|
3567 |
|
3568 |
|
3569 | var sampleLines = sample.stack.split('\n');
|
3570 | var controlLines = control.stack.split('\n');
|
3571 | var s = sampleLines.length - 1;
|
3572 | var c = controlLines.length - 1;
|
3573 |
|
3574 | while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
3575 |
|
3576 |
|
3577 |
|
3578 |
|
3579 |
|
3580 |
|
3581 | c--;
|
3582 | }
|
3583 |
|
3584 | for (; s >= 1 && c >= 0; s--, c--) {
|
3585 |
|
3586 |
|
3587 | if (sampleLines[s] !== controlLines[c]) {
|
3588 |
|
3589 |
|
3590 |
|
3591 |
|
3592 |
|
3593 | if (s !== 1 || c !== 1) {
|
3594 | do {
|
3595 | s--;
|
3596 | c--;
|
3597 |
|
3598 |
|
3599 | if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
3600 |
|
3601 | var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
|
3602 |
|
3603 |
|
3604 |
|
3605 |
|
3606 | if (fn.displayName && _frame.includes('<anonymous>')) {
|
3607 | _frame = _frame.replace('<anonymous>', fn.displayName);
|
3608 | }
|
3609 |
|
3610 | {
|
3611 | if (typeof fn === 'function') {
|
3612 | componentFrameCache.set(fn, _frame);
|
3613 | }
|
3614 | }
|
3615 |
|
3616 |
|
3617 | return _frame;
|
3618 | }
|
3619 | } while (s >= 1 && c >= 0);
|
3620 | }
|
3621 |
|
3622 | break;
|
3623 | }
|
3624 | }
|
3625 | }
|
3626 | } finally {
|
3627 | reentry = false;
|
3628 |
|
3629 | {
|
3630 | ReactCurrentDispatcher.current = previousDispatcher;
|
3631 | reenableLogs();
|
3632 | }
|
3633 |
|
3634 | Error.prepareStackTrace = previousPrepareStackTrace;
|
3635 | }
|
3636 |
|
3637 |
|
3638 | var name = fn ? fn.displayName || fn.name : '';
|
3639 | var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
3640 |
|
3641 | {
|
3642 | if (typeof fn === 'function') {
|
3643 | componentFrameCache.set(fn, syntheticFrame);
|
3644 | }
|
3645 | }
|
3646 |
|
3647 | return syntheticFrame;
|
3648 | }
|
3649 |
|
3650 | function describeClassComponentFrame(ctor, source, ownerFn) {
|
3651 | {
|
3652 | return describeNativeComponentFrame(ctor, true);
|
3653 | }
|
3654 | }
|
3655 | function describeFunctionComponentFrame(fn, source, ownerFn) {
|
3656 | {
|
3657 | return describeNativeComponentFrame(fn, false);
|
3658 | }
|
3659 | }
|
3660 |
|
3661 | function shouldConstruct(Component) {
|
3662 | var prototype = Component.prototype;
|
3663 | return !!(prototype && prototype.isReactComponent);
|
3664 | }
|
3665 |
|
3666 | function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
3667 |
|
3668 | if (type == null) {
|
3669 | return '';
|
3670 | }
|
3671 |
|
3672 | if (typeof type === 'function') {
|
3673 | {
|
3674 | return describeNativeComponentFrame(type, shouldConstruct(type));
|
3675 | }
|
3676 | }
|
3677 |
|
3678 | if (typeof type === 'string') {
|
3679 | return describeBuiltInComponentFrame(type);
|
3680 | }
|
3681 |
|
3682 | switch (type) {
|
3683 | case REACT_SUSPENSE_TYPE:
|
3684 | return describeBuiltInComponentFrame('Suspense');
|
3685 |
|
3686 | case REACT_SUSPENSE_LIST_TYPE:
|
3687 | return describeBuiltInComponentFrame('SuspenseList');
|
3688 | }
|
3689 |
|
3690 | if (typeof type === 'object') {
|
3691 | switch (type.$$typeof) {
|
3692 | case REACT_FORWARD_REF_TYPE:
|
3693 | return describeFunctionComponentFrame(type.render);
|
3694 |
|
3695 | case REACT_MEMO_TYPE:
|
3696 |
|
3697 | return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
3698 |
|
3699 | case REACT_LAZY_TYPE:
|
3700 | {
|
3701 | var lazyComponent = type;
|
3702 | var payload = lazyComponent._payload;
|
3703 | var init = lazyComponent._init;
|
3704 |
|
3705 | try {
|
3706 |
|
3707 | return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
3708 | } catch (x) {}
|
3709 | }
|
3710 | }
|
3711 | }
|
3712 |
|
3713 | return '';
|
3714 | }
|
3715 |
|
3716 | var loggedTypeFailures = {};
|
3717 | var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
3718 |
|
3719 | function setCurrentlyValidatingElement(element) {
|
3720 | {
|
3721 | if (element) {
|
3722 | var owner = element._owner;
|
3723 | var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
3724 | ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
3725 | } else {
|
3726 | ReactDebugCurrentFrame.setExtraStackFrame(null);
|
3727 | }
|
3728 | }
|
3729 | }
|
3730 |
|
3731 | function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
3732 | {
|
3733 |
|
3734 | var has = Function.call.bind(hasOwnProperty);
|
3735 |
|
3736 | for (var typeSpecName in typeSpecs) {
|
3737 | if (has(typeSpecs, typeSpecName)) {
|
3738 | var error$1 = void 0;
|
3739 |
|
3740 |
|
3741 |
|
3742 | try {
|
3743 |
|
3744 |
|
3745 | if (typeof typeSpecs[typeSpecName] !== 'function') {
|
3746 |
|
3747 | 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`.');
|
3748 | err.name = 'Invariant Violation';
|
3749 | throw err;
|
3750 | }
|
3751 |
|
3752 | error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
3753 | } catch (ex) {
|
3754 | error$1 = ex;
|
3755 | }
|
3756 |
|
3757 | if (error$1 && !(error$1 instanceof Error)) {
|
3758 | setCurrentlyValidatingElement(element);
|
3759 |
|
3760 | 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);
|
3761 |
|
3762 | setCurrentlyValidatingElement(null);
|
3763 | }
|
3764 |
|
3765 | if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
3766 |
|
3767 |
|
3768 | loggedTypeFailures[error$1.message] = true;
|
3769 | setCurrentlyValidatingElement(element);
|
3770 |
|
3771 | error('Failed %s type: %s', location, error$1.message);
|
3772 |
|
3773 | setCurrentlyValidatingElement(null);
|
3774 | }
|
3775 | }
|
3776 | }
|
3777 | }
|
3778 | }
|
3779 |
|
3780 | var warnedAboutMissingGetChildContext;
|
3781 |
|
3782 | {
|
3783 | warnedAboutMissingGetChildContext = {};
|
3784 | }
|
3785 |
|
3786 | var emptyContextObject = {};
|
3787 |
|
3788 | {
|
3789 | Object.freeze(emptyContextObject);
|
3790 | }
|
3791 |
|
3792 | function getMaskedContext(type, unmaskedContext) {
|
3793 | {
|
3794 | var contextTypes = type.contextTypes;
|
3795 |
|
3796 | if (!contextTypes) {
|
3797 | return emptyContextObject;
|
3798 | }
|
3799 |
|
3800 | var context = {};
|
3801 |
|
3802 | for (var key in contextTypes) {
|
3803 | context[key] = unmaskedContext[key];
|
3804 | }
|
3805 |
|
3806 | {
|
3807 | var name = getComponentNameFromType(type) || 'Unknown';
|
3808 | checkPropTypes(contextTypes, context, 'context', name);
|
3809 | }
|
3810 |
|
3811 | return context;
|
3812 | }
|
3813 | }
|
3814 | function processChildContext(instance, type, parentContext, childContextTypes) {
|
3815 | {
|
3816 |
|
3817 |
|
3818 | if (typeof instance.getChildContext !== 'function') {
|
3819 | {
|
3820 | var componentName = getComponentNameFromType(type) || 'Unknown';
|
3821 |
|
3822 | if (!warnedAboutMissingGetChildContext[componentName]) {
|
3823 | warnedAboutMissingGetChildContext[componentName] = true;
|
3824 |
|
3825 | error('%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName);
|
3826 | }
|
3827 | }
|
3828 |
|
3829 | return parentContext;
|
3830 | }
|
3831 |
|
3832 | var childContext = instance.getChildContext();
|
3833 |
|
3834 | for (var contextKey in childContext) {
|
3835 | if (!(contextKey in childContextTypes)) {
|
3836 | throw new Error((getComponentNameFromType(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes.");
|
3837 | }
|
3838 | }
|
3839 |
|
3840 | {
|
3841 | var name = getComponentNameFromType(type) || 'Unknown';
|
3842 | checkPropTypes(childContextTypes, childContext, 'child context', name);
|
3843 | }
|
3844 |
|
3845 | return assign({}, parentContext, childContext);
|
3846 | }
|
3847 | }
|
3848 |
|
3849 | var rendererSigil;
|
3850 |
|
3851 | {
|
3852 |
|
3853 | rendererSigil = {};
|
3854 | }
|
3855 |
|
3856 |
|
3857 |
|
3858 | var rootContextSnapshot = null;
|
3859 |
|
3860 |
|
3861 |
|
3862 | var currentActiveSnapshot = null;
|
3863 |
|
3864 | function popNode(prev) {
|
3865 | {
|
3866 | prev.context._currentValue = prev.parentValue;
|
3867 | }
|
3868 | }
|
3869 |
|
3870 | function pushNode(next) {
|
3871 | {
|
3872 | next.context._currentValue = next.value;
|
3873 | }
|
3874 | }
|
3875 |
|
3876 | function popToNearestCommonAncestor(prev, next) {
|
3877 | if (prev === next) ; else {
|
3878 | popNode(prev);
|
3879 | var parentPrev = prev.parent;
|
3880 | var parentNext = next.parent;
|
3881 |
|
3882 | if (parentPrev === null) {
|
3883 | if (parentNext !== null) {
|
3884 | throw new Error('The stacks must reach the root at the same time. This is a bug in React.');
|
3885 | }
|
3886 | } else {
|
3887 | if (parentNext === null) {
|
3888 | throw new Error('The stacks must reach the root at the same time. This is a bug in React.');
|
3889 | }
|
3890 |
|
3891 | popToNearestCommonAncestor(parentPrev, parentNext);
|
3892 | }
|
3893 |
|
3894 |
|
3895 | pushNode(next);
|
3896 | }
|
3897 | }
|
3898 |
|
3899 | function popAllPrevious(prev) {
|
3900 | popNode(prev);
|
3901 | var parentPrev = prev.parent;
|
3902 |
|
3903 | if (parentPrev !== null) {
|
3904 | popAllPrevious(parentPrev);
|
3905 | }
|
3906 | }
|
3907 |
|
3908 | function pushAllNext(next) {
|
3909 | var parentNext = next.parent;
|
3910 |
|
3911 | if (parentNext !== null) {
|
3912 | pushAllNext(parentNext);
|
3913 | }
|
3914 |
|
3915 | pushNode(next);
|
3916 | }
|
3917 |
|
3918 | function popPreviousToCommonLevel(prev, next) {
|
3919 | popNode(prev);
|
3920 | var parentPrev = prev.parent;
|
3921 |
|
3922 | if (parentPrev === null) {
|
3923 | throw new Error('The depth must equal at least at zero before reaching the root. This is a bug in React.');
|
3924 | }
|
3925 |
|
3926 | if (parentPrev.depth === next.depth) {
|
3927 |
|
3928 | popToNearestCommonAncestor(parentPrev, next);
|
3929 | } else {
|
3930 |
|
3931 | popPreviousToCommonLevel(parentPrev, next);
|
3932 | }
|
3933 | }
|
3934 |
|
3935 | function popNextToCommonLevel(prev, next) {
|
3936 | var parentNext = next.parent;
|
3937 |
|
3938 | if (parentNext === null) {
|
3939 | throw new Error('The depth must equal at least at zero before reaching the root. This is a bug in React.');
|
3940 | }
|
3941 |
|
3942 | if (prev.depth === parentNext.depth) {
|
3943 |
|
3944 | popToNearestCommonAncestor(prev, parentNext);
|
3945 | } else {
|
3946 |
|
3947 | popNextToCommonLevel(prev, parentNext);
|
3948 | }
|
3949 |
|
3950 | pushNode(next);
|
3951 | }
|
3952 |
|
3953 |
|
3954 |
|
3955 |
|
3956 |
|
3957 | function switchContext(newSnapshot) {
|
3958 |
|
3959 |
|
3960 |
|
3961 |
|
3962 |
|
3963 |
|
3964 |
|
3965 |
|
3966 | var prev = currentActiveSnapshot;
|
3967 | var next = newSnapshot;
|
3968 |
|
3969 | if (prev !== next) {
|
3970 | if (prev === null) {
|
3971 |
|
3972 | pushAllNext(next);
|
3973 | } else if (next === null) {
|
3974 | popAllPrevious(prev);
|
3975 | } else if (prev.depth === next.depth) {
|
3976 | popToNearestCommonAncestor(prev, next);
|
3977 | } else if (prev.depth > next.depth) {
|
3978 | popPreviousToCommonLevel(prev, next);
|
3979 | } else {
|
3980 | popNextToCommonLevel(prev, next);
|
3981 | }
|
3982 |
|
3983 | currentActiveSnapshot = next;
|
3984 | }
|
3985 | }
|
3986 | function pushProvider(context, nextValue) {
|
3987 | var prevValue;
|
3988 |
|
3989 | {
|
3990 | prevValue = context._currentValue;
|
3991 | context._currentValue = nextValue;
|
3992 |
|
3993 | {
|
3994 | if (context._currentRenderer !== undefined && context._currentRenderer !== null && context._currentRenderer !== rendererSigil) {
|
3995 | error('Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.');
|
3996 | }
|
3997 |
|
3998 | context._currentRenderer = rendererSigil;
|
3999 | }
|
4000 | }
|
4001 |
|
4002 | var prevNode = currentActiveSnapshot;
|
4003 | var newNode = {
|
4004 | parent: prevNode,
|
4005 | depth: prevNode === null ? 0 : prevNode.depth + 1,
|
4006 | context: context,
|
4007 | parentValue: prevValue,
|
4008 | value: nextValue
|
4009 | };
|
4010 | currentActiveSnapshot = newNode;
|
4011 | return newNode;
|
4012 | }
|
4013 | function popProvider(context) {
|
4014 | var prevSnapshot = currentActiveSnapshot;
|
4015 |
|
4016 | if (prevSnapshot === null) {
|
4017 | throw new Error('Tried to pop a Context at the root of the app. This is a bug in React.');
|
4018 | }
|
4019 |
|
4020 | {
|
4021 | if (prevSnapshot.context !== context) {
|
4022 | error('The parent context is not the expected context. This is probably a bug in React.');
|
4023 | }
|
4024 | }
|
4025 |
|
4026 | {
|
4027 | var value = prevSnapshot.parentValue;
|
4028 |
|
4029 | if (value === REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED) {
|
4030 | prevSnapshot.context._currentValue = prevSnapshot.context._defaultValue;
|
4031 | } else {
|
4032 | prevSnapshot.context._currentValue = value;
|
4033 | }
|
4034 |
|
4035 | {
|
4036 | if (context._currentRenderer !== undefined && context._currentRenderer !== null && context._currentRenderer !== rendererSigil) {
|
4037 | error('Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.');
|
4038 | }
|
4039 |
|
4040 | context._currentRenderer = rendererSigil;
|
4041 | }
|
4042 | }
|
4043 |
|
4044 | return currentActiveSnapshot = prevSnapshot.parent;
|
4045 | }
|
4046 | function getActiveContext() {
|
4047 | return currentActiveSnapshot;
|
4048 | }
|
4049 | function readContext(context) {
|
4050 | var value = context._currentValue ;
|
4051 | return value;
|
4052 | }
|
4053 |
|
4054 | |
4055 |
|
4056 |
|
4057 |
|
4058 |
|
4059 |
|
4060 |
|
4061 |
|
4062 |
|
4063 | function get(key) {
|
4064 | return key._reactInternals;
|
4065 | }
|
4066 | function set(key, value) {
|
4067 | key._reactInternals = value;
|
4068 | }
|
4069 |
|
4070 | var didWarnAboutNoopUpdateForComponent = {};
|
4071 | var didWarnAboutDeprecatedWillMount = {};
|
4072 | var didWarnAboutUninitializedState;
|
4073 | var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate;
|
4074 | var didWarnAboutLegacyLifecyclesAndDerivedState;
|
4075 | var didWarnAboutUndefinedDerivedState;
|
4076 | var warnOnUndefinedDerivedState;
|
4077 | var warnOnInvalidCallback;
|
4078 | var didWarnAboutDirectlyAssigningPropsToState;
|
4079 | var didWarnAboutContextTypeAndContextTypes;
|
4080 | var didWarnAboutInvalidateContextType;
|
4081 |
|
4082 | {
|
4083 | didWarnAboutUninitializedState = new Set();
|
4084 | didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set();
|
4085 | didWarnAboutLegacyLifecyclesAndDerivedState = new Set();
|
4086 | didWarnAboutDirectlyAssigningPropsToState = new Set();
|
4087 | didWarnAboutUndefinedDerivedState = new Set();
|
4088 | didWarnAboutContextTypeAndContextTypes = new Set();
|
4089 | didWarnAboutInvalidateContextType = new Set();
|
4090 | var didWarnOnInvalidCallback = new Set();
|
4091 |
|
4092 | warnOnInvalidCallback = function (callback, callerName) {
|
4093 | if (callback === null || typeof callback === 'function') {
|
4094 | return;
|
4095 | }
|
4096 |
|
4097 | var key = callerName + '_' + callback;
|
4098 |
|
4099 | if (!didWarnOnInvalidCallback.has(key)) {
|
4100 | didWarnOnInvalidCallback.add(key);
|
4101 |
|
4102 | error('%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
|
4103 | }
|
4104 | };
|
4105 |
|
4106 | warnOnUndefinedDerivedState = function (type, partialState) {
|
4107 | if (partialState === undefined) {
|
4108 | var componentName = getComponentNameFromType(type) || 'Component';
|
4109 |
|
4110 | if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
|
4111 | didWarnAboutUndefinedDerivedState.add(componentName);
|
4112 |
|
4113 | error('%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName);
|
4114 | }
|
4115 | }
|
4116 | };
|
4117 | }
|
4118 |
|
4119 | function warnNoop(publicInstance, callerName) {
|
4120 | {
|
4121 | var _constructor = publicInstance.constructor;
|
4122 | var componentName = _constructor && getComponentNameFromType(_constructor) || 'ReactClass';
|
4123 | var warningKey = componentName + '.' + callerName;
|
4124 |
|
4125 | if (didWarnAboutNoopUpdateForComponent[warningKey]) {
|
4126 | return;
|
4127 | }
|
4128 |
|
4129 | error('%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
|
4130 |
|
4131 | didWarnAboutNoopUpdateForComponent[warningKey] = true;
|
4132 | }
|
4133 | }
|
4134 |
|
4135 | var classComponentUpdater = {
|
4136 | isMounted: function (inst) {
|
4137 | return false;
|
4138 | },
|
4139 | enqueueSetState: function (inst, payload, callback) {
|
4140 | var internals = get(inst);
|
4141 |
|
4142 | if (internals.queue === null) {
|
4143 | warnNoop(inst, 'setState');
|
4144 | } else {
|
4145 | internals.queue.push(payload);
|
4146 |
|
4147 | {
|
4148 | if (callback !== undefined && callback !== null) {
|
4149 | warnOnInvalidCallback(callback, 'setState');
|
4150 | }
|
4151 | }
|
4152 | }
|
4153 | },
|
4154 | enqueueReplaceState: function (inst, payload, callback) {
|
4155 | var internals = get(inst);
|
4156 | internals.replace = true;
|
4157 | internals.queue = [payload];
|
4158 |
|
4159 | {
|
4160 | if (callback !== undefined && callback !== null) {
|
4161 | warnOnInvalidCallback(callback, 'setState');
|
4162 | }
|
4163 | }
|
4164 | },
|
4165 | enqueueForceUpdate: function (inst, callback) {
|
4166 | var internals = get(inst);
|
4167 |
|
4168 | if (internals.queue === null) {
|
4169 | warnNoop(inst, 'forceUpdate');
|
4170 | } else {
|
4171 | {
|
4172 | if (callback !== undefined && callback !== null) {
|
4173 | warnOnInvalidCallback(callback, 'setState');
|
4174 | }
|
4175 | }
|
4176 | }
|
4177 | }
|
4178 | };
|
4179 |
|
4180 | function applyDerivedStateFromProps(instance, ctor, getDerivedStateFromProps, prevState, nextProps) {
|
4181 | var partialState = getDerivedStateFromProps(nextProps, prevState);
|
4182 |
|
4183 | {
|
4184 | warnOnUndefinedDerivedState(ctor, partialState);
|
4185 | }
|
4186 |
|
4187 |
|
4188 | var newState = partialState === null || partialState === undefined ? prevState : assign({}, prevState, partialState);
|
4189 | return newState;
|
4190 | }
|
4191 |
|
4192 | function constructClassInstance(ctor, props, maskedLegacyContext) {
|
4193 | var context = emptyContextObject;
|
4194 | var contextType = ctor.contextType;
|
4195 |
|
4196 | {
|
4197 | if ('contextType' in ctor) {
|
4198 | var isValid =
|
4199 | contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined;
|
4200 |
|
4201 | if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) {
|
4202 | didWarnAboutInvalidateContextType.add(ctor);
|
4203 | var addendum = '';
|
4204 |
|
4205 | if (contextType === undefined) {
|
4206 | addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.';
|
4207 | } else if (typeof contextType !== 'object') {
|
4208 | addendum = ' However, it is set to a ' + typeof contextType + '.';
|
4209 | } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
|
4210 | addendum = ' Did you accidentally pass the Context.Provider instead?';
|
4211 | } else if (contextType._context !== undefined) {
|
4212 |
|
4213 | addendum = ' Did you accidentally pass the Context.Consumer instead?';
|
4214 | } else {
|
4215 | addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
|
4216 | }
|
4217 |
|
4218 | error('%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentNameFromType(ctor) || 'Component', addendum);
|
4219 | }
|
4220 | }
|
4221 | }
|
4222 |
|
4223 | if (typeof contextType === 'object' && contextType !== null) {
|
4224 | context = readContext(contextType);
|
4225 | } else {
|
4226 | context = maskedLegacyContext;
|
4227 | }
|
4228 |
|
4229 | var instance = new ctor(props, context);
|
4230 |
|
4231 | {
|
4232 | if (typeof ctor.getDerivedStateFromProps === 'function' && (instance.state === null || instance.state === undefined)) {
|
4233 | var componentName = getComponentNameFromType(ctor) || 'Component';
|
4234 |
|
4235 | if (!didWarnAboutUninitializedState.has(componentName)) {
|
4236 | didWarnAboutUninitializedState.add(componentName);
|
4237 |
|
4238 | error('`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, instance.state === null ? 'null' : 'undefined', componentName);
|
4239 | }
|
4240 | }
|
4241 |
|
4242 |
|
4243 |
|
4244 |
|
4245 | if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') {
|
4246 | var foundWillMountName = null;
|
4247 | var foundWillReceivePropsName = null;
|
4248 | var foundWillUpdateName = null;
|
4249 |
|
4250 | if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) {
|
4251 | foundWillMountName = 'componentWillMount';
|
4252 | } else if (typeof instance.UNSAFE_componentWillMount === 'function') {
|
4253 | foundWillMountName = 'UNSAFE_componentWillMount';
|
4254 | }
|
4255 |
|
4256 | if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
|
4257 | foundWillReceivePropsName = 'componentWillReceiveProps';
|
4258 | } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') {
|
4259 | foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
|
4260 | }
|
4261 |
|
4262 | if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
|
4263 | foundWillUpdateName = 'componentWillUpdate';
|
4264 | } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') {
|
4265 | foundWillUpdateName = 'UNSAFE_componentWillUpdate';
|
4266 | }
|
4267 |
|
4268 | if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
|
4269 | var _componentName = getComponentNameFromType(ctor) || 'Component';
|
4270 |
|
4271 | var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()';
|
4272 |
|
4273 | if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) {
|
4274 | didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName);
|
4275 |
|
4276 | error('Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://reactjs.org/link/unsafe-component-lifecycles', _componentName, newApiName, foundWillMountName !== null ? "\n " + foundWillMountName : '', foundWillReceivePropsName !== null ? "\n " + foundWillReceivePropsName : '', foundWillUpdateName !== null ? "\n " + foundWillUpdateName : '');
|
4277 | }
|
4278 | }
|
4279 | }
|
4280 | }
|
4281 |
|
4282 | return instance;
|
4283 | }
|
4284 |
|
4285 | function checkClassInstance(instance, ctor, newProps) {
|
4286 | {
|
4287 | var name = getComponentNameFromType(ctor) || 'Component';
|
4288 | var renderPresent = instance.render;
|
4289 |
|
4290 | if (!renderPresent) {
|
4291 | if (ctor.prototype && typeof ctor.prototype.render === 'function') {
|
4292 | error('%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name);
|
4293 | } else {
|
4294 | error('%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name);
|
4295 | }
|
4296 | }
|
4297 |
|
4298 | if (instance.getInitialState && !instance.getInitialState.isReactClassApproved && !instance.state) {
|
4299 | error('getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name);
|
4300 | }
|
4301 |
|
4302 | if (instance.getDefaultProps && !instance.getDefaultProps.isReactClassApproved) {
|
4303 | error('getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name);
|
4304 | }
|
4305 |
|
4306 | if (instance.propTypes) {
|
4307 | error('propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name);
|
4308 | }
|
4309 |
|
4310 | if (instance.contextType) {
|
4311 | error('contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name);
|
4312 | }
|
4313 |
|
4314 | {
|
4315 | if (instance.contextTypes) {
|
4316 | error('contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name);
|
4317 | }
|
4318 |
|
4319 | if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) {
|
4320 | didWarnAboutContextTypeAndContextTypes.add(ctor);
|
4321 |
|
4322 | error('%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name);
|
4323 | }
|
4324 | }
|
4325 |
|
4326 | if (typeof instance.componentShouldUpdate === 'function') {
|
4327 | error('%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name);
|
4328 | }
|
4329 |
|
4330 | if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') {
|
4331 | error('%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentNameFromType(ctor) || 'A pure component');
|
4332 | }
|
4333 |
|
4334 | if (typeof instance.componentDidUnmount === 'function') {
|
4335 | error('%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name);
|
4336 | }
|
4337 |
|
4338 | if (typeof instance.componentDidReceiveProps === 'function') {
|
4339 | error('%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name);
|
4340 | }
|
4341 |
|
4342 | if (typeof instance.componentWillRecieveProps === 'function') {
|
4343 | error('%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name);
|
4344 | }
|
4345 |
|
4346 | if (typeof instance.UNSAFE_componentWillRecieveProps === 'function') {
|
4347 | error('%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name);
|
4348 | }
|
4349 |
|
4350 | var hasMutatedProps = instance.props !== newProps;
|
4351 |
|
4352 | if (instance.props !== undefined && hasMutatedProps) {
|
4353 | error('%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name);
|
4354 | }
|
4355 |
|
4356 | if (instance.defaultProps) {
|
4357 | error('Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name);
|
4358 | }
|
4359 |
|
4360 | if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) {
|
4361 | didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor);
|
4362 |
|
4363 | error('%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentNameFromType(ctor));
|
4364 | }
|
4365 |
|
4366 | if (typeof instance.getDerivedStateFromProps === 'function') {
|
4367 | error('%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name);
|
4368 | }
|
4369 |
|
4370 | if (typeof instance.getDerivedStateFromError === 'function') {
|
4371 | error('%s: getDerivedStateFromError() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name);
|
4372 | }
|
4373 |
|
4374 | if (typeof ctor.getSnapshotBeforeUpdate === 'function') {
|
4375 | error('%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name);
|
4376 | }
|
4377 |
|
4378 | var _state = instance.state;
|
4379 |
|
4380 | if (_state && (typeof _state !== 'object' || isArray(_state))) {
|
4381 | error('%s.state: must be set to an object or null', name);
|
4382 | }
|
4383 |
|
4384 | if (typeof instance.getChildContext === 'function' && typeof ctor.childContextTypes !== 'object') {
|
4385 | error('%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name);
|
4386 | }
|
4387 | }
|
4388 | }
|
4389 |
|
4390 | function callComponentWillMount(type, instance) {
|
4391 | var oldState = instance.state;
|
4392 |
|
4393 | if (typeof instance.componentWillMount === 'function') {
|
4394 | {
|
4395 | if ( instance.componentWillMount.__suppressDeprecationWarning !== true) {
|
4396 | var componentName = getComponentNameFromType(type) || 'Unknown';
|
4397 |
|
4398 | if (!didWarnAboutDeprecatedWillMount[componentName]) {
|
4399 | warn(
|
4400 | 'componentWillMount has been renamed, and is not recommended for use. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move code from componentWillMount to componentDidMount (preferred in most cases) ' + 'or the constructor.\n' + '\nPlease update the following components: %s', componentName);
|
4401 |
|
4402 | didWarnAboutDeprecatedWillMount[componentName] = true;
|
4403 | }
|
4404 | }
|
4405 | }
|
4406 |
|
4407 | instance.componentWillMount();
|
4408 | }
|
4409 |
|
4410 | if (typeof instance.UNSAFE_componentWillMount === 'function') {
|
4411 | instance.UNSAFE_componentWillMount();
|
4412 | }
|
4413 |
|
4414 | if (oldState !== instance.state) {
|
4415 | {
|
4416 | error('%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentNameFromType(type) || 'Component');
|
4417 | }
|
4418 |
|
4419 | classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
|
4420 | }
|
4421 | }
|
4422 |
|
4423 | function processUpdateQueue(internalInstance, inst, props, maskedLegacyContext) {
|
4424 | if (internalInstance.queue !== null && internalInstance.queue.length > 0) {
|
4425 | var oldQueue = internalInstance.queue;
|
4426 | var oldReplace = internalInstance.replace;
|
4427 | internalInstance.queue = null;
|
4428 | internalInstance.replace = false;
|
4429 |
|
4430 | if (oldReplace && oldQueue.length === 1) {
|
4431 | inst.state = oldQueue[0];
|
4432 | } else {
|
4433 | var nextState = oldReplace ? oldQueue[0] : inst.state;
|
4434 | var dontMutate = true;
|
4435 |
|
4436 | for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
|
4437 | var partial = oldQueue[i];
|
4438 | var partialState = typeof partial === 'function' ? partial.call(inst, nextState, props, maskedLegacyContext) : partial;
|
4439 |
|
4440 | if (partialState != null) {
|
4441 | if (dontMutate) {
|
4442 | dontMutate = false;
|
4443 | nextState = assign({}, nextState, partialState);
|
4444 | } else {
|
4445 | assign(nextState, partialState);
|
4446 | }
|
4447 | }
|
4448 | }
|
4449 |
|
4450 | inst.state = nextState;
|
4451 | }
|
4452 | } else {
|
4453 | internalInstance.queue = null;
|
4454 | }
|
4455 | }
|
4456 |
|
4457 |
|
4458 | function mountClassInstance(instance, ctor, newProps, maskedLegacyContext) {
|
4459 | {
|
4460 | checkClassInstance(instance, ctor, newProps);
|
4461 | }
|
4462 |
|
4463 | var initialState = instance.state !== undefined ? instance.state : null;
|
4464 | instance.updater = classComponentUpdater;
|
4465 | instance.props = newProps;
|
4466 | instance.state = initialState;
|
4467 |
|
4468 |
|
4469 | var internalInstance = {
|
4470 | queue: [],
|
4471 | replace: false
|
4472 | };
|
4473 | set(instance, internalInstance);
|
4474 | var contextType = ctor.contextType;
|
4475 |
|
4476 | if (typeof contextType === 'object' && contextType !== null) {
|
4477 | instance.context = readContext(contextType);
|
4478 | } else {
|
4479 | instance.context = maskedLegacyContext;
|
4480 | }
|
4481 |
|
4482 | {
|
4483 | if (instance.state === newProps) {
|
4484 | var componentName = getComponentNameFromType(ctor) || 'Component';
|
4485 |
|
4486 | if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) {
|
4487 | didWarnAboutDirectlyAssigningPropsToState.add(componentName);
|
4488 |
|
4489 | error('%s: It is not recommended to assign props directly to state ' + "because updates to props won't be reflected in state. " + 'In most cases, it is better to use props directly.', componentName);
|
4490 | }
|
4491 | }
|
4492 | }
|
4493 |
|
4494 | var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
|
4495 |
|
4496 | if (typeof getDerivedStateFromProps === 'function') {
|
4497 | instance.state = applyDerivedStateFromProps(instance, ctor, getDerivedStateFromProps, initialState, newProps);
|
4498 | }
|
4499 |
|
4500 |
|
4501 |
|
4502 | if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) {
|
4503 | callComponentWillMount(ctor, instance);
|
4504 |
|
4505 |
|
4506 | processUpdateQueue(internalInstance, instance, newProps, maskedLegacyContext);
|
4507 | }
|
4508 | }
|
4509 |
|
4510 |
|
4511 |
|
4512 |
|
4513 |
|
4514 |
|
4515 |
|
4516 |
|
4517 |
|
4518 |
|
4519 |
|
4520 |
|
4521 |
|
4522 |
|
4523 |
|
4524 |
|
4525 |
|
4526 |
|
4527 |
|
4528 |
|
4529 |
|
4530 |
|
4531 |
|
4532 |
|
4533 |
|
4534 |
|
4535 |
|
4536 |
|
4537 |
|
4538 |
|
4539 |
|
4540 |
|
4541 |
|
4542 |
|
4543 |
|
4544 |
|
4545 |
|
4546 |
|
4547 |
|
4548 |
|
4549 |
|
4550 |
|
4551 |
|
4552 |
|
4553 |
|
4554 |
|
4555 |
|
4556 |
|
4557 |
|
4558 |
|
4559 |
|
4560 |
|
4561 | var emptyTreeContext = {
|
4562 | id: 1,
|
4563 | overflow: ''
|
4564 | };
|
4565 | function getTreeId(context) {
|
4566 | var overflow = context.overflow;
|
4567 | var idWithLeadingBit = context.id;
|
4568 | var id = idWithLeadingBit & ~getLeadingBit(idWithLeadingBit);
|
4569 | return id.toString(32) + overflow;
|
4570 | }
|
4571 | function pushTreeContext(baseContext, totalChildren, index) {
|
4572 | var baseIdWithLeadingBit = baseContext.id;
|
4573 | var baseOverflow = baseContext.overflow;
|
4574 |
|
4575 |
|
4576 | var baseLength = getBitLength(baseIdWithLeadingBit) - 1;
|
4577 | var baseId = baseIdWithLeadingBit & ~(1 << baseLength);
|
4578 | var slot = index + 1;
|
4579 | var length = getBitLength(totalChildren) + baseLength;
|
4580 |
|
4581 |
|
4582 | if (length > 30) {
|
4583 |
|
4584 |
|
4585 |
|
4586 |
|
4587 |
|
4588 |
|
4589 |
|
4590 |
|
4591 |
|
4592 |
|
4593 |
|
4594 |
|
4595 |
|
4596 | var numberOfOverflowBits = baseLength - baseLength % 5;
|
4597 |
|
4598 | var newOverflowBits = (1 << numberOfOverflowBits) - 1;
|
4599 |
|
4600 | var newOverflow = (baseId & newOverflowBits).toString(32);
|
4601 |
|
4602 | var restOfBaseId = baseId >> numberOfOverflowBits;
|
4603 | var restOfBaseLength = baseLength - numberOfOverflowBits;
|
4604 |
|
4605 |
|
4606 | var restOfLength = getBitLength(totalChildren) + restOfBaseLength;
|
4607 | var restOfNewBits = slot << restOfBaseLength;
|
4608 | var id = restOfNewBits | restOfBaseId;
|
4609 | var overflow = newOverflow + baseOverflow;
|
4610 | return {
|
4611 | id: 1 << restOfLength | id,
|
4612 | overflow: overflow
|
4613 | };
|
4614 | } else {
|
4615 |
|
4616 | var newBits = slot << baseLength;
|
4617 |
|
4618 | var _id = newBits | baseId;
|
4619 |
|
4620 | var _overflow = baseOverflow;
|
4621 | return {
|
4622 | id: 1 << length | _id,
|
4623 | overflow: _overflow
|
4624 | };
|
4625 | }
|
4626 | }
|
4627 |
|
4628 | function getBitLength(number) {
|
4629 | return 32 - clz32(number);
|
4630 | }
|
4631 |
|
4632 | function getLeadingBit(id) {
|
4633 | return 1 << getBitLength(id) - 1;
|
4634 | }
|
4635 |
|
4636 |
|
4637 | var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback;
|
4638 |
|
4639 |
|
4640 |
|
4641 | var log = Math.log;
|
4642 | var LN2 = Math.LN2;
|
4643 |
|
4644 | function clz32Fallback(x) {
|
4645 | var asUint = x >>> 0;
|
4646 |
|
4647 | if (asUint === 0) {
|
4648 | return 32;
|
4649 | }
|
4650 |
|
4651 | return 31 - (log(asUint) / LN2 | 0) | 0;
|
4652 | }
|
4653 |
|
4654 | |
4655 |
|
4656 |
|
4657 |
|
4658 | function is(x, y) {
|
4659 | return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y
|
4660 | ;
|
4661 | }
|
4662 |
|
4663 | var objectIs = typeof Object.is === 'function' ? Object.is : is;
|
4664 |
|
4665 | var currentlyRenderingComponent = null;
|
4666 | var currentlyRenderingTask = null;
|
4667 | var firstWorkInProgressHook = null;
|
4668 | var workInProgressHook = null;
|
4669 |
|
4670 | var isReRender = false;
|
4671 |
|
4672 | var didScheduleRenderPhaseUpdate = false;
|
4673 |
|
4674 | var localIdCounter = 0;
|
4675 |
|
4676 | var renderPhaseUpdates = null;
|
4677 |
|
4678 | var numberOfReRenders = 0;
|
4679 | var RE_RENDER_LIMIT = 25;
|
4680 | var isInHookUserCodeInDev = false;
|
4681 |
|
4682 | var currentHookNameInDev;
|
4683 |
|
4684 | function resolveCurrentlyRenderingComponent() {
|
4685 | if (currentlyRenderingComponent === null) {
|
4686 | throw new 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:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.');
|
4687 | }
|
4688 |
|
4689 | {
|
4690 | if (isInHookUserCodeInDev) {
|
4691 | error('Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://reactjs.org/link/rules-of-hooks');
|
4692 | }
|
4693 | }
|
4694 |
|
4695 | return currentlyRenderingComponent;
|
4696 | }
|
4697 |
|
4698 | function areHookInputsEqual(nextDeps, prevDeps) {
|
4699 | if (prevDeps === null) {
|
4700 | {
|
4701 | error('%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
|
4702 | }
|
4703 |
|
4704 | return false;
|
4705 | }
|
4706 |
|
4707 | {
|
4708 |
|
4709 |
|
4710 | if (nextDeps.length !== prevDeps.length) {
|
4711 | error('The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, "[" + nextDeps.join(', ') + "]", "[" + prevDeps.join(', ') + "]");
|
4712 | }
|
4713 | }
|
4714 |
|
4715 | for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
|
4716 | if (objectIs(nextDeps[i], prevDeps[i])) {
|
4717 | continue;
|
4718 | }
|
4719 |
|
4720 | return false;
|
4721 | }
|
4722 |
|
4723 | return true;
|
4724 | }
|
4725 |
|
4726 | function createHook() {
|
4727 | if (numberOfReRenders > 0) {
|
4728 | throw new Error('Rendered more hooks than during the previous render');
|
4729 | }
|
4730 |
|
4731 | return {
|
4732 | memoizedState: null,
|
4733 | queue: null,
|
4734 | next: null
|
4735 | };
|
4736 | }
|
4737 |
|
4738 | function createWorkInProgressHook() {
|
4739 | if (workInProgressHook === null) {
|
4740 |
|
4741 | if (firstWorkInProgressHook === null) {
|
4742 | isReRender = false;
|
4743 | firstWorkInProgressHook = workInProgressHook = createHook();
|
4744 | } else {
|
4745 |
|
4746 | isReRender = true;
|
4747 | workInProgressHook = firstWorkInProgressHook;
|
4748 | }
|
4749 | } else {
|
4750 | if (workInProgressHook.next === null) {
|
4751 | isReRender = false;
|
4752 |
|
4753 | workInProgressHook = workInProgressHook.next = createHook();
|
4754 | } else {
|
4755 |
|
4756 | isReRender = true;
|
4757 | workInProgressHook = workInProgressHook.next;
|
4758 | }
|
4759 | }
|
4760 |
|
4761 | return workInProgressHook;
|
4762 | }
|
4763 |
|
4764 | function prepareToUseHooks(task, componentIdentity) {
|
4765 | currentlyRenderingComponent = componentIdentity;
|
4766 | currentlyRenderingTask = task;
|
4767 |
|
4768 | {
|
4769 | isInHookUserCodeInDev = false;
|
4770 | }
|
4771 |
|
4772 |
|
4773 |
|
4774 |
|
4775 |
|
4776 |
|
4777 |
|
4778 |
|
4779 | localIdCounter = 0;
|
4780 | }
|
4781 | function finishHooks(Component, props, children, refOrContext) {
|
4782 |
|
4783 |
|
4784 | while (didScheduleRenderPhaseUpdate) {
|
4785 |
|
4786 |
|
4787 |
|
4788 |
|
4789 | didScheduleRenderPhaseUpdate = false;
|
4790 | localIdCounter = 0;
|
4791 | numberOfReRenders += 1;
|
4792 |
|
4793 | workInProgressHook = null;
|
4794 | children = Component(props, refOrContext);
|
4795 | }
|
4796 |
|
4797 | resetHooksState();
|
4798 | return children;
|
4799 | }
|
4800 | function checkDidRenderIdHook() {
|
4801 |
|
4802 |
|
4803 |
|
4804 | var didRenderIdHook = localIdCounter !== 0;
|
4805 | return didRenderIdHook;
|
4806 | }
|
4807 |
|
4808 | function resetHooksState() {
|
4809 | {
|
4810 | isInHookUserCodeInDev = false;
|
4811 | }
|
4812 |
|
4813 | currentlyRenderingComponent = null;
|
4814 | currentlyRenderingTask = null;
|
4815 | didScheduleRenderPhaseUpdate = false;
|
4816 | firstWorkInProgressHook = null;
|
4817 | numberOfReRenders = 0;
|
4818 | renderPhaseUpdates = null;
|
4819 | workInProgressHook = null;
|
4820 | }
|
4821 |
|
4822 | function readContext$1(context) {
|
4823 | {
|
4824 | if (isInHookUserCodeInDev) {
|
4825 | error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().');
|
4826 | }
|
4827 | }
|
4828 |
|
4829 | return readContext(context);
|
4830 | }
|
4831 |
|
4832 | function useContext(context) {
|
4833 | {
|
4834 | currentHookNameInDev = 'useContext';
|
4835 | }
|
4836 |
|
4837 | resolveCurrentlyRenderingComponent();
|
4838 | return readContext(context);
|
4839 | }
|
4840 |
|
4841 | function basicStateReducer(state, action) {
|
4842 |
|
4843 | return typeof action === 'function' ? action(state) : action;
|
4844 | }
|
4845 |
|
4846 | function useState(initialState) {
|
4847 | {
|
4848 | currentHookNameInDev = 'useState';
|
4849 | }
|
4850 |
|
4851 | return useReducer(basicStateReducer,
|
4852 | initialState);
|
4853 | }
|
4854 | function useReducer(reducer, initialArg, init) {
|
4855 | {
|
4856 | if (reducer !== basicStateReducer) {
|
4857 | currentHookNameInDev = 'useReducer';
|
4858 | }
|
4859 | }
|
4860 |
|
4861 | currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
|
4862 | workInProgressHook = createWorkInProgressHook();
|
4863 |
|
4864 | if (isReRender) {
|
4865 |
|
4866 |
|
4867 | var queue = workInProgressHook.queue;
|
4868 | var dispatch = queue.dispatch;
|
4869 |
|
4870 | if (renderPhaseUpdates !== null) {
|
4871 |
|
4872 | var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
|
4873 |
|
4874 | if (firstRenderPhaseUpdate !== undefined) {
|
4875 | renderPhaseUpdates.delete(queue);
|
4876 | var newState = workInProgressHook.memoizedState;
|
4877 | var update = firstRenderPhaseUpdate;
|
4878 |
|
4879 | do {
|
4880 |
|
4881 |
|
4882 |
|
4883 | var action = update.action;
|
4884 |
|
4885 | {
|
4886 | isInHookUserCodeInDev = true;
|
4887 | }
|
4888 |
|
4889 | newState = reducer(newState, action);
|
4890 |
|
4891 | {
|
4892 | isInHookUserCodeInDev = false;
|
4893 | }
|
4894 |
|
4895 | update = update.next;
|
4896 | } while (update !== null);
|
4897 |
|
4898 | workInProgressHook.memoizedState = newState;
|
4899 | return [newState, dispatch];
|
4900 | }
|
4901 | }
|
4902 |
|
4903 | return [workInProgressHook.memoizedState, dispatch];
|
4904 | } else {
|
4905 | {
|
4906 | isInHookUserCodeInDev = true;
|
4907 | }
|
4908 |
|
4909 | var initialState;
|
4910 |
|
4911 | if (reducer === basicStateReducer) {
|
4912 |
|
4913 | initialState = typeof initialArg === 'function' ? initialArg() : initialArg;
|
4914 | } else {
|
4915 | initialState = init !== undefined ? init(initialArg) : initialArg;
|
4916 | }
|
4917 |
|
4918 | {
|
4919 | isInHookUserCodeInDev = false;
|
4920 | }
|
4921 |
|
4922 | workInProgressHook.memoizedState = initialState;
|
4923 |
|
4924 | var _queue = workInProgressHook.queue = {
|
4925 | last: null,
|
4926 | dispatch: null
|
4927 | };
|
4928 |
|
4929 | var _dispatch = _queue.dispatch = dispatchAction.bind(null, currentlyRenderingComponent, _queue);
|
4930 |
|
4931 | return [workInProgressHook.memoizedState, _dispatch];
|
4932 | }
|
4933 | }
|
4934 |
|
4935 | function useMemo(nextCreate, deps) {
|
4936 | currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
|
4937 | workInProgressHook = createWorkInProgressHook();
|
4938 | var nextDeps = deps === undefined ? null : deps;
|
4939 |
|
4940 | if (workInProgressHook !== null) {
|
4941 | var prevState = workInProgressHook.memoizedState;
|
4942 |
|
4943 | if (prevState !== null) {
|
4944 | if (nextDeps !== null) {
|
4945 | var prevDeps = prevState[1];
|
4946 |
|
4947 | if (areHookInputsEqual(nextDeps, prevDeps)) {
|
4948 | return prevState[0];
|
4949 | }
|
4950 | }
|
4951 | }
|
4952 | }
|
4953 |
|
4954 | {
|
4955 | isInHookUserCodeInDev = true;
|
4956 | }
|
4957 |
|
4958 | var nextValue = nextCreate();
|
4959 |
|
4960 | {
|
4961 | isInHookUserCodeInDev = false;
|
4962 | }
|
4963 |
|
4964 | workInProgressHook.memoizedState = [nextValue, nextDeps];
|
4965 | return nextValue;
|
4966 | }
|
4967 |
|
4968 | function useRef(initialValue) {
|
4969 | currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
|
4970 | workInProgressHook = createWorkInProgressHook();
|
4971 | var previousRef = workInProgressHook.memoizedState;
|
4972 |
|
4973 | if (previousRef === null) {
|
4974 | var ref = {
|
4975 | current: initialValue
|
4976 | };
|
4977 |
|
4978 | {
|
4979 | Object.seal(ref);
|
4980 | }
|
4981 |
|
4982 | workInProgressHook.memoizedState = ref;
|
4983 | return ref;
|
4984 | } else {
|
4985 | return previousRef;
|
4986 | }
|
4987 | }
|
4988 |
|
4989 | function useLayoutEffect(create, inputs) {
|
4990 | {
|
4991 | currentHookNameInDev = 'useLayoutEffect';
|
4992 |
|
4993 | error('useLayoutEffect does nothing on the server, because its effect cannot ' + "be encoded into the server renderer's output format. This will lead " + 'to a mismatch between the initial, non-hydrated UI and the intended ' + 'UI. To avoid this, useLayoutEffect should only be used in ' + 'components that render exclusively on the client. ' + 'See https://reactjs.org/link/uselayouteffect-ssr for common fixes.');
|
4994 | }
|
4995 | }
|
4996 |
|
4997 | function dispatchAction(componentIdentity, queue, action) {
|
4998 | if (numberOfReRenders >= RE_RENDER_LIMIT) {
|
4999 | throw new Error('Too many re-renders. React limits the number of renders to prevent ' + 'an infinite loop.');
|
5000 | }
|
5001 |
|
5002 | if (componentIdentity === currentlyRenderingComponent) {
|
5003 |
|
5004 |
|
5005 |
|
5006 | didScheduleRenderPhaseUpdate = true;
|
5007 | var update = {
|
5008 | action: action,
|
5009 | next: null
|
5010 | };
|
5011 |
|
5012 | if (renderPhaseUpdates === null) {
|
5013 | renderPhaseUpdates = new Map();
|
5014 | }
|
5015 |
|
5016 | var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
|
5017 |
|
5018 | if (firstRenderPhaseUpdate === undefined) {
|
5019 | renderPhaseUpdates.set(queue, update);
|
5020 | } else {
|
5021 |
|
5022 | var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
|
5023 |
|
5024 | while (lastRenderPhaseUpdate.next !== null) {
|
5025 | lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
|
5026 | }
|
5027 |
|
5028 | lastRenderPhaseUpdate.next = update;
|
5029 | }
|
5030 | }
|
5031 | }
|
5032 |
|
5033 | function useCallback(callback, deps) {
|
5034 | return useMemo(function () {
|
5035 | return callback;
|
5036 | }, deps);
|
5037 | }
|
5038 |
|
5039 |
|
5040 |
|
5041 | function useMutableSource(source, getSnapshot, subscribe) {
|
5042 | resolveCurrentlyRenderingComponent();
|
5043 | return getSnapshot(source._source);
|
5044 | }
|
5045 |
|
5046 | function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
5047 | if (getServerSnapshot === undefined) {
|
5048 | throw new Error('Missing getServerSnapshot, which is required for ' + 'server-rendered content. Will revert to client rendering.');
|
5049 | }
|
5050 |
|
5051 | return getServerSnapshot();
|
5052 | }
|
5053 |
|
5054 | function useDeferredValue(value) {
|
5055 | resolveCurrentlyRenderingComponent();
|
5056 | return value;
|
5057 | }
|
5058 |
|
5059 | function unsupportedStartTransition() {
|
5060 | throw new Error('startTransition cannot be called during server rendering.');
|
5061 | }
|
5062 |
|
5063 | function useTransition() {
|
5064 | resolveCurrentlyRenderingComponent();
|
5065 | return [false, unsupportedStartTransition];
|
5066 | }
|
5067 |
|
5068 | function useId() {
|
5069 | var task = currentlyRenderingTask;
|
5070 | var treeId = getTreeId(task.treeContext);
|
5071 | var responseState = currentResponseState;
|
5072 |
|
5073 | if (responseState === null) {
|
5074 | throw new Error('Invalid hook call. Hooks can only be called inside of the body of a function component.');
|
5075 | }
|
5076 |
|
5077 | var localId = localIdCounter++;
|
5078 | return makeId(responseState, treeId, localId);
|
5079 | }
|
5080 |
|
5081 | function noop() {}
|
5082 |
|
5083 | var Dispatcher = {
|
5084 | readContext: readContext$1,
|
5085 | useContext: useContext,
|
5086 | useMemo: useMemo,
|
5087 | useReducer: useReducer,
|
5088 | useRef: useRef,
|
5089 | useState: useState,
|
5090 | useInsertionEffect: noop,
|
5091 | useLayoutEffect: useLayoutEffect,
|
5092 | useCallback: useCallback,
|
5093 |
|
5094 | useImperativeHandle: noop,
|
5095 |
|
5096 | useEffect: noop,
|
5097 |
|
5098 | useDebugValue: noop,
|
5099 | useDeferredValue: useDeferredValue,
|
5100 | useTransition: useTransition,
|
5101 | useId: useId,
|
5102 |
|
5103 | useMutableSource: useMutableSource,
|
5104 | useSyncExternalStore: useSyncExternalStore
|
5105 | };
|
5106 |
|
5107 | var currentResponseState = null;
|
5108 | function setCurrentResponseState(responseState) {
|
5109 | currentResponseState = responseState;
|
5110 | }
|
5111 |
|
5112 | function getStackByComponentStackNode(componentStack) {
|
5113 | try {
|
5114 | var info = '';
|
5115 | var node = componentStack;
|
5116 |
|
5117 | do {
|
5118 | switch (node.tag) {
|
5119 | case 0:
|
5120 | info += describeBuiltInComponentFrame(node.type, null, null);
|
5121 | break;
|
5122 |
|
5123 | case 1:
|
5124 | info += describeFunctionComponentFrame(node.type, null, null);
|
5125 | break;
|
5126 |
|
5127 | case 2:
|
5128 | info += describeClassComponentFrame(node.type, null, null);
|
5129 | break;
|
5130 | }
|
5131 |
|
5132 | node = node.parent;
|
5133 | } while (node);
|
5134 |
|
5135 | return info;
|
5136 | } catch (x) {
|
5137 | return '\nError generating stack: ' + x.message + '\n' + x.stack;
|
5138 | }
|
5139 | }
|
5140 |
|
5141 | var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
5142 | var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
5143 | var PENDING = 0;
|
5144 | var COMPLETED = 1;
|
5145 | var FLUSHED = 2;
|
5146 | var ABORTED = 3;
|
5147 | var ERRORED = 4;
|
5148 | var OPEN = 0;
|
5149 | var CLOSING = 1;
|
5150 | var CLOSED = 2;
|
5151 |
|
5152 |
|
5153 |
|
5154 |
|
5155 |
|
5156 |
|
5157 |
|
5158 |
|
5159 |
|
5160 |
|
5161 |
|
5162 |
|
5163 |
|
5164 |
|
5165 |
|
5166 | var DEFAULT_PROGRESSIVE_CHUNK_SIZE = 12800;
|
5167 |
|
5168 | function defaultErrorHandler(error) {
|
5169 | console['error'](error);
|
5170 | }
|
5171 |
|
5172 | function noop$1() {}
|
5173 |
|
5174 | function createRequest(children, responseState, rootFormatContext, progressiveChunkSize, onError, onAllReady, onShellReady, onShellError, onFatalError) {
|
5175 | var pingedTasks = [];
|
5176 | var abortSet = new Set();
|
5177 | var request = {
|
5178 | destination: null,
|
5179 | responseState: responseState,
|
5180 | progressiveChunkSize: progressiveChunkSize === undefined ? DEFAULT_PROGRESSIVE_CHUNK_SIZE : progressiveChunkSize,
|
5181 | status: OPEN,
|
5182 | fatalError: null,
|
5183 | nextSegmentId: 0,
|
5184 | allPendingTasks: 0,
|
5185 | pendingRootTasks: 0,
|
5186 | completedRootSegment: null,
|
5187 | abortableTasks: abortSet,
|
5188 | pingedTasks: pingedTasks,
|
5189 | clientRenderedBoundaries: [],
|
5190 | completedBoundaries: [],
|
5191 | partialBoundaries: [],
|
5192 | onError: onError === undefined ? defaultErrorHandler : onError,
|
5193 | onAllReady: onAllReady === undefined ? noop$1 : onAllReady,
|
5194 | onShellReady: onShellReady === undefined ? noop$1 : onShellReady,
|
5195 | onShellError: onShellError === undefined ? noop$1 : onShellError,
|
5196 | onFatalError: onFatalError === undefined ? noop$1 : onFatalError
|
5197 | };
|
5198 |
|
5199 | var rootSegment = createPendingSegment(request, 0, null, rootFormatContext);
|
5200 |
|
5201 | rootSegment.parentFlushed = true;
|
5202 | var rootTask = createTask(request, children, null, rootSegment, abortSet, emptyContextObject, rootContextSnapshot, emptyTreeContext);
|
5203 | pingedTasks.push(rootTask);
|
5204 | return request;
|
5205 | }
|
5206 |
|
5207 | function pingTask(request, task) {
|
5208 | var pingedTasks = request.pingedTasks;
|
5209 | pingedTasks.push(task);
|
5210 |
|
5211 | if (pingedTasks.length === 1) {
|
5212 | scheduleWork(function () {
|
5213 | return performWork(request);
|
5214 | });
|
5215 | }
|
5216 | }
|
5217 |
|
5218 | function createSuspenseBoundary(request, fallbackAbortableTasks) {
|
5219 | return {
|
5220 | id: UNINITIALIZED_SUSPENSE_BOUNDARY_ID,
|
5221 | rootSegmentID: -1,
|
5222 | parentFlushed: false,
|
5223 | pendingTasks: 0,
|
5224 | forceClientRender: false,
|
5225 | completedSegments: [],
|
5226 | byteSize: 0,
|
5227 | fallbackAbortableTasks: fallbackAbortableTasks
|
5228 | };
|
5229 | }
|
5230 |
|
5231 | function createTask(request, node, blockedBoundary, blockedSegment, abortSet, legacyContext, context, treeContext) {
|
5232 | request.allPendingTasks++;
|
5233 |
|
5234 | if (blockedBoundary === null) {
|
5235 | request.pendingRootTasks++;
|
5236 | } else {
|
5237 | blockedBoundary.pendingTasks++;
|
5238 | }
|
5239 |
|
5240 | var task = {
|
5241 | node: node,
|
5242 | ping: function () {
|
5243 | return pingTask(request, task);
|
5244 | },
|
5245 | blockedBoundary: blockedBoundary,
|
5246 | blockedSegment: blockedSegment,
|
5247 | abortSet: abortSet,
|
5248 | legacyContext: legacyContext,
|
5249 | context: context,
|
5250 | treeContext: treeContext
|
5251 | };
|
5252 |
|
5253 | {
|
5254 | task.componentStack = null;
|
5255 | }
|
5256 |
|
5257 | abortSet.add(task);
|
5258 | return task;
|
5259 | }
|
5260 |
|
5261 | function createPendingSegment(request, index, boundary, formatContext) {
|
5262 | return {
|
5263 | status: PENDING,
|
5264 | id: -1,
|
5265 |
|
5266 | index: index,
|
5267 | parentFlushed: false,
|
5268 | chunks: [],
|
5269 | children: [],
|
5270 | formatContext: formatContext,
|
5271 | boundary: boundary
|
5272 | };
|
5273 | }
|
5274 |
|
5275 |
|
5276 | var currentTaskInDEV = null;
|
5277 |
|
5278 | function getCurrentStackInDEV() {
|
5279 | {
|
5280 | if (currentTaskInDEV === null || currentTaskInDEV.componentStack === null) {
|
5281 | return '';
|
5282 | }
|
5283 |
|
5284 | return getStackByComponentStackNode(currentTaskInDEV.componentStack);
|
5285 | }
|
5286 | }
|
5287 |
|
5288 | function pushBuiltInComponentStackInDEV(task, type) {
|
5289 | {
|
5290 | task.componentStack = {
|
5291 | tag: 0,
|
5292 | parent: task.componentStack,
|
5293 | type: type
|
5294 | };
|
5295 | }
|
5296 | }
|
5297 |
|
5298 | function pushFunctionComponentStackInDEV(task, type) {
|
5299 | {
|
5300 | task.componentStack = {
|
5301 | tag: 1,
|
5302 | parent: task.componentStack,
|
5303 | type: type
|
5304 | };
|
5305 | }
|
5306 | }
|
5307 |
|
5308 | function pushClassComponentStackInDEV(task, type) {
|
5309 | {
|
5310 | task.componentStack = {
|
5311 | tag: 2,
|
5312 | parent: task.componentStack,
|
5313 | type: type
|
5314 | };
|
5315 | }
|
5316 | }
|
5317 |
|
5318 | function popComponentStackInDEV(task) {
|
5319 | {
|
5320 | if (task.componentStack === null) {
|
5321 | error('Unexpectedly popped too many stack frames. This is a bug in React.');
|
5322 | } else {
|
5323 | task.componentStack = task.componentStack.parent;
|
5324 | }
|
5325 | }
|
5326 | }
|
5327 |
|
5328 | function logRecoverableError(request, error) {
|
5329 |
|
5330 |
|
5331 | var onError = request.onError;
|
5332 | onError(error);
|
5333 | }
|
5334 |
|
5335 | function fatalError(request, error) {
|
5336 |
|
5337 |
|
5338 |
|
5339 | var onShellError = request.onShellError;
|
5340 | onShellError(error);
|
5341 | var onFatalError = request.onFatalError;
|
5342 | onFatalError(error);
|
5343 |
|
5344 | if (request.destination !== null) {
|
5345 | request.status = CLOSED;
|
5346 | closeWithError(request.destination, error);
|
5347 | } else {
|
5348 | request.status = CLOSING;
|
5349 | request.fatalError = error;
|
5350 | }
|
5351 | }
|
5352 |
|
5353 | function renderSuspenseBoundary(request, task, props) {
|
5354 | pushBuiltInComponentStackInDEV(task, 'Suspense');
|
5355 | var parentBoundary = task.blockedBoundary;
|
5356 | var parentSegment = task.blockedSegment;
|
5357 |
|
5358 |
|
5359 |
|
5360 |
|
5361 | var fallback = props.fallback;
|
5362 | var content = props.children;
|
5363 | var fallbackAbortSet = new Set();
|
5364 | var newBoundary = createSuspenseBoundary(request, fallbackAbortSet);
|
5365 | var insertionIndex = parentSegment.chunks.length;
|
5366 |
|
5367 | var boundarySegment = createPendingSegment(request, insertionIndex, newBoundary, parentSegment.formatContext);
|
5368 | parentSegment.children.push(boundarySegment);
|
5369 |
|
5370 | var contentRootSegment = createPendingSegment(request, 0, null, parentSegment.formatContext);
|
5371 |
|
5372 |
|
5373 | contentRootSegment.parentFlushed = true;
|
5374 |
|
5375 |
|
5376 |
|
5377 |
|
5378 |
|
5379 |
|
5380 |
|
5381 | task.blockedBoundary = newBoundary;
|
5382 | task.blockedSegment = contentRootSegment;
|
5383 |
|
5384 | try {
|
5385 |
|
5386 | renderNode(request, task, content);
|
5387 | contentRootSegment.status = COMPLETED;
|
5388 | queueCompletedSegment(newBoundary, contentRootSegment);
|
5389 |
|
5390 | if (newBoundary.pendingTasks === 0) {
|
5391 |
|
5392 |
|
5393 |
|
5394 | popComponentStackInDEV(task);
|
5395 | return;
|
5396 | }
|
5397 | } catch (error) {
|
5398 | contentRootSegment.status = ERRORED;
|
5399 | logRecoverableError(request, error);
|
5400 | newBoundary.forceClientRender = true;
|
5401 |
|
5402 |
|
5403 | } finally {
|
5404 | task.blockedBoundary = parentBoundary;
|
5405 | task.blockedSegment = parentSegment;
|
5406 | }
|
5407 |
|
5408 |
|
5409 |
|
5410 | var suspendedFallbackTask = createTask(request, fallback, parentBoundary, boundarySegment, fallbackAbortSet, task.legacyContext, task.context, task.treeContext);
|
5411 |
|
5412 | {
|
5413 | suspendedFallbackTask.componentStack = task.componentStack;
|
5414 | }
|
5415 |
|
5416 |
|
5417 |
|
5418 | request.pingedTasks.push(suspendedFallbackTask);
|
5419 | popComponentStackInDEV(task);
|
5420 | }
|
5421 |
|
5422 | function renderHostElement(request, task, type, props) {
|
5423 | pushBuiltInComponentStackInDEV(task, type);
|
5424 | var segment = task.blockedSegment;
|
5425 | var children = pushStartInstance(segment.chunks, type, props, request.responseState, segment.formatContext);
|
5426 | var prevContext = segment.formatContext;
|
5427 | segment.formatContext = getChildFormatContext(prevContext, type, props);
|
5428 |
|
5429 |
|
5430 | renderNode(request, task, children);
|
5431 |
|
5432 |
|
5433 | segment.formatContext = prevContext;
|
5434 | pushEndInstance(segment.chunks, type);
|
5435 | popComponentStackInDEV(task);
|
5436 | }
|
5437 |
|
5438 | function shouldConstruct$1(Component) {
|
5439 | return Component.prototype && Component.prototype.isReactComponent;
|
5440 | }
|
5441 |
|
5442 | function renderWithHooks(request, task, Component, props, secondArg) {
|
5443 | var componentIdentity = {};
|
5444 | prepareToUseHooks(task, componentIdentity);
|
5445 | var result = Component(props, secondArg);
|
5446 | return finishHooks(Component, props, result, secondArg);
|
5447 | }
|
5448 |
|
5449 | function finishClassComponent(request, task, instance, Component, props) {
|
5450 | var nextChildren = instance.render();
|
5451 |
|
5452 | {
|
5453 | if (instance.props !== props) {
|
5454 | if (!didWarnAboutReassigningProps) {
|
5455 | error('It looks like %s is reassigning its own `this.props` while rendering. ' + 'This is not supported and can lead to confusing bugs.', getComponentNameFromType(Component) || 'a component');
|
5456 | }
|
5457 |
|
5458 | didWarnAboutReassigningProps = true;
|
5459 | }
|
5460 | }
|
5461 |
|
5462 | {
|
5463 | var childContextTypes = Component.childContextTypes;
|
5464 |
|
5465 | if (childContextTypes !== null && childContextTypes !== undefined) {
|
5466 | var previousContext = task.legacyContext;
|
5467 | var mergedContext = processChildContext(instance, Component, previousContext, childContextTypes);
|
5468 | task.legacyContext = mergedContext;
|
5469 | renderNodeDestructive(request, task, nextChildren);
|
5470 | task.legacyContext = previousContext;
|
5471 | return;
|
5472 | }
|
5473 | }
|
5474 |
|
5475 | renderNodeDestructive(request, task, nextChildren);
|
5476 | }
|
5477 |
|
5478 | function renderClassComponent(request, task, Component, props) {
|
5479 | pushClassComponentStackInDEV(task, Component);
|
5480 | var maskedContext = getMaskedContext(Component, task.legacyContext) ;
|
5481 | var instance = constructClassInstance(Component, props, maskedContext);
|
5482 | mountClassInstance(instance, Component, props, maskedContext);
|
5483 | finishClassComponent(request, task, instance, Component, props);
|
5484 | popComponentStackInDEV(task);
|
5485 | }
|
5486 |
|
5487 | var didWarnAboutBadClass = {};
|
5488 | var didWarnAboutModulePatternComponent = {};
|
5489 | var didWarnAboutContextTypeOnFunctionComponent = {};
|
5490 | var didWarnAboutGetDerivedStateOnFunctionComponent = {};
|
5491 | var didWarnAboutReassigningProps = false;
|
5492 | var didWarnAboutGenerators = false;
|
5493 | var didWarnAboutMaps = false;
|
5494 | var hasWarnedAboutUsingContextAsConsumer = false;
|
5495 |
|
5496 |
|
5497 | function renderIndeterminateComponent(request, task, Component, props) {
|
5498 | var legacyContext;
|
5499 |
|
5500 | {
|
5501 | legacyContext = getMaskedContext(Component, task.legacyContext);
|
5502 | }
|
5503 |
|
5504 | pushFunctionComponentStackInDEV(task, Component);
|
5505 |
|
5506 | {
|
5507 | if (Component.prototype && typeof Component.prototype.render === 'function') {
|
5508 | var componentName = getComponentNameFromType(Component) || 'Unknown';
|
5509 |
|
5510 | if (!didWarnAboutBadClass[componentName]) {
|
5511 | error("The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName);
|
5512 |
|
5513 | didWarnAboutBadClass[componentName] = true;
|
5514 | }
|
5515 | }
|
5516 | }
|
5517 |
|
5518 | var value = renderWithHooks(request, task, Component, props, legacyContext);
|
5519 | var hasId = checkDidRenderIdHook();
|
5520 |
|
5521 | {
|
5522 |
|
5523 |
|
5524 | if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
|
5525 | var _componentName = getComponentNameFromType(Component) || 'Unknown';
|
5526 |
|
5527 | if (!didWarnAboutModulePatternComponent[_componentName]) {
|
5528 | error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName, _componentName, _componentName);
|
5529 |
|
5530 | didWarnAboutModulePatternComponent[_componentName] = true;
|
5531 | }
|
5532 | }
|
5533 | }
|
5534 |
|
5535 | if (
|
5536 |
|
5537 | typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) {
|
5538 | {
|
5539 | var _componentName2 = getComponentNameFromType(Component) || 'Unknown';
|
5540 |
|
5541 | if (!didWarnAboutModulePatternComponent[_componentName2]) {
|
5542 | error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName2, _componentName2, _componentName2);
|
5543 |
|
5544 | didWarnAboutModulePatternComponent[_componentName2] = true;
|
5545 | }
|
5546 | }
|
5547 |
|
5548 | mountClassInstance(value, Component, props, legacyContext);
|
5549 | finishClassComponent(request, task, value, Component, props);
|
5550 | } else {
|
5551 |
|
5552 | {
|
5553 | validateFunctionComponentInDev(Component);
|
5554 | }
|
5555 |
|
5556 |
|
5557 |
|
5558 | if (hasId) {
|
5559 |
|
5560 |
|
5561 | var prevTreeContext = task.treeContext;
|
5562 | var totalChildren = 1;
|
5563 | var index = 0;
|
5564 | task.treeContext = pushTreeContext(prevTreeContext, totalChildren, index);
|
5565 |
|
5566 | try {
|
5567 | renderNodeDestructive(request, task, value);
|
5568 | } finally {
|
5569 | task.treeContext = prevTreeContext;
|
5570 | }
|
5571 | } else {
|
5572 | renderNodeDestructive(request, task, value);
|
5573 | }
|
5574 | }
|
5575 |
|
5576 | popComponentStackInDEV(task);
|
5577 | }
|
5578 |
|
5579 | function validateFunctionComponentInDev(Component) {
|
5580 | {
|
5581 | if (Component) {
|
5582 | if (Component.childContextTypes) {
|
5583 | error('%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component');
|
5584 | }
|
5585 | }
|
5586 |
|
5587 | if (typeof Component.getDerivedStateFromProps === 'function') {
|
5588 | var _componentName3 = getComponentNameFromType(Component) || 'Unknown';
|
5589 |
|
5590 | if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3]) {
|
5591 | error('%s: Function components do not support getDerivedStateFromProps.', _componentName3);
|
5592 |
|
5593 | didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] = true;
|
5594 | }
|
5595 | }
|
5596 |
|
5597 | if (typeof Component.contextType === 'object' && Component.contextType !== null) {
|
5598 | var _componentName4 = getComponentNameFromType(Component) || 'Unknown';
|
5599 |
|
5600 | if (!didWarnAboutContextTypeOnFunctionComponent[_componentName4]) {
|
5601 | error('%s: Function components do not support contextType.', _componentName4);
|
5602 |
|
5603 | didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true;
|
5604 | }
|
5605 | }
|
5606 | }
|
5607 | }
|
5608 |
|
5609 | function resolveDefaultProps(Component, baseProps) {
|
5610 | if (Component && Component.defaultProps) {
|
5611 |
|
5612 | var props = assign({}, baseProps);
|
5613 | var defaultProps = Component.defaultProps;
|
5614 |
|
5615 | for (var propName in defaultProps) {
|
5616 | if (props[propName] === undefined) {
|
5617 | props[propName] = defaultProps[propName];
|
5618 | }
|
5619 | }
|
5620 |
|
5621 | return props;
|
5622 | }
|
5623 |
|
5624 | return baseProps;
|
5625 | }
|
5626 |
|
5627 | function renderForwardRef(request, task, type, props, ref) {
|
5628 | pushFunctionComponentStackInDEV(task, type.render);
|
5629 | var children = renderWithHooks(request, task, type.render, props, ref);
|
5630 | var hasId = checkDidRenderIdHook();
|
5631 |
|
5632 | if (hasId) {
|
5633 |
|
5634 |
|
5635 | var prevTreeContext = task.treeContext;
|
5636 | var totalChildren = 1;
|
5637 | var index = 0;
|
5638 | task.treeContext = pushTreeContext(prevTreeContext, totalChildren, index);
|
5639 |
|
5640 | try {
|
5641 | renderNodeDestructive(request, task, children);
|
5642 | } finally {
|
5643 | task.treeContext = prevTreeContext;
|
5644 | }
|
5645 | } else {
|
5646 | renderNodeDestructive(request, task, children);
|
5647 | }
|
5648 |
|
5649 | popComponentStackInDEV(task);
|
5650 | }
|
5651 |
|
5652 | function renderMemo(request, task, type, props, ref) {
|
5653 | var innerType = type.type;
|
5654 | var resolvedProps = resolveDefaultProps(innerType, props);
|
5655 | renderElement(request, task, innerType, resolvedProps, ref);
|
5656 | }
|
5657 |
|
5658 | function renderContextConsumer(request, task, context, props) {
|
5659 |
|
5660 |
|
5661 |
|
5662 |
|
5663 |
|
5664 |
|
5665 |
|
5666 | {
|
5667 | if (context._context === undefined) {
|
5668 |
|
5669 |
|
5670 |
|
5671 | if (context !== context.Consumer) {
|
5672 | if (!hasWarnedAboutUsingContextAsConsumer) {
|
5673 | hasWarnedAboutUsingContextAsConsumer = true;
|
5674 |
|
5675 | error('Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
5676 | }
|
5677 | }
|
5678 | } else {
|
5679 | context = context._context;
|
5680 | }
|
5681 | }
|
5682 |
|
5683 | var render = props.children;
|
5684 |
|
5685 | {
|
5686 | if (typeof render !== 'function') {
|
5687 | error('A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.');
|
5688 | }
|
5689 | }
|
5690 |
|
5691 | var newValue = readContext(context);
|
5692 | var newChildren = render(newValue);
|
5693 | renderNodeDestructive(request, task, newChildren);
|
5694 | }
|
5695 |
|
5696 | function renderContextProvider(request, task, type, props) {
|
5697 | var context = type._context;
|
5698 | var value = props.value;
|
5699 | var children = props.children;
|
5700 | var prevSnapshot;
|
5701 |
|
5702 | {
|
5703 | prevSnapshot = task.context;
|
5704 | }
|
5705 |
|
5706 | task.context = pushProvider(context, value);
|
5707 | renderNodeDestructive(request, task, children);
|
5708 | task.context = popProvider(context);
|
5709 |
|
5710 | {
|
5711 | if (prevSnapshot !== task.context) {
|
5712 | error('Popping the context provider did not return back to the original snapshot. This is a bug in React.');
|
5713 | }
|
5714 | }
|
5715 | }
|
5716 |
|
5717 | function renderLazyComponent(request, task, lazyComponent, props, ref) {
|
5718 | pushBuiltInComponentStackInDEV(task, 'Lazy');
|
5719 | var payload = lazyComponent._payload;
|
5720 | var init = lazyComponent._init;
|
5721 | var Component = init(payload);
|
5722 | var resolvedProps = resolveDefaultProps(Component, props);
|
5723 | renderElement(request, task, Component, resolvedProps, ref);
|
5724 | popComponentStackInDEV(task);
|
5725 | }
|
5726 |
|
5727 | function renderElement(request, task, type, props, ref) {
|
5728 | if (typeof type === 'function') {
|
5729 | if (shouldConstruct$1(type)) {
|
5730 | renderClassComponent(request, task, type, props);
|
5731 | return;
|
5732 | } else {
|
5733 | renderIndeterminateComponent(request, task, type, props);
|
5734 | return;
|
5735 | }
|
5736 | }
|
5737 |
|
5738 | if (typeof type === 'string') {
|
5739 | renderHostElement(request, task, type, props);
|
5740 | return;
|
5741 | }
|
5742 |
|
5743 | switch (type) {
|
5744 |
|
5745 |
|
5746 |
|
5747 |
|
5748 |
|
5749 |
|
5750 |
|
5751 |
|
5752 | case REACT_LEGACY_HIDDEN_TYPE:
|
5753 | case REACT_DEBUG_TRACING_MODE_TYPE:
|
5754 | case REACT_STRICT_MODE_TYPE:
|
5755 | case REACT_PROFILER_TYPE:
|
5756 | case REACT_FRAGMENT_TYPE:
|
5757 | {
|
5758 | renderNodeDestructive(request, task, props.children);
|
5759 | return;
|
5760 | }
|
5761 |
|
5762 | case REACT_SUSPENSE_LIST_TYPE:
|
5763 | {
|
5764 | pushBuiltInComponentStackInDEV(task, 'SuspenseList');
|
5765 |
|
5766 | renderNodeDestructive(request, task, props.children);
|
5767 | popComponentStackInDEV(task);
|
5768 | return;
|
5769 | }
|
5770 |
|
5771 | case REACT_SCOPE_TYPE:
|
5772 | {
|
5773 |
|
5774 | throw new Error('ReactDOMServer does not yet support scope components.');
|
5775 | }
|
5776 |
|
5777 |
|
5778 | case REACT_SUSPENSE_TYPE:
|
5779 | {
|
5780 | {
|
5781 | renderSuspenseBoundary(request, task, props);
|
5782 | }
|
5783 |
|
5784 | return;
|
5785 | }
|
5786 | }
|
5787 |
|
5788 | if (typeof type === 'object' && type !== null) {
|
5789 | switch (type.$$typeof) {
|
5790 | case REACT_FORWARD_REF_TYPE:
|
5791 | {
|
5792 | renderForwardRef(request, task, type, props, ref);
|
5793 | return;
|
5794 | }
|
5795 |
|
5796 | case REACT_MEMO_TYPE:
|
5797 | {
|
5798 | renderMemo(request, task, type, props, ref);
|
5799 | return;
|
5800 | }
|
5801 |
|
5802 | case REACT_PROVIDER_TYPE:
|
5803 | {
|
5804 | renderContextProvider(request, task, type, props);
|
5805 | return;
|
5806 | }
|
5807 |
|
5808 | case REACT_CONTEXT_TYPE:
|
5809 | {
|
5810 | renderContextConsumer(request, task, type, props);
|
5811 | return;
|
5812 | }
|
5813 |
|
5814 | case REACT_LAZY_TYPE:
|
5815 | {
|
5816 | renderLazyComponent(request, task, type, props);
|
5817 | return;
|
5818 | }
|
5819 | }
|
5820 | }
|
5821 |
|
5822 | var info = '';
|
5823 |
|
5824 | {
|
5825 | if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
5826 | 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.';
|
5827 | }
|
5828 | }
|
5829 |
|
5830 | throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + (type == null ? type : typeof type) + "." + info));
|
5831 | }
|
5832 |
|
5833 | function validateIterable(iterable, iteratorFn) {
|
5834 | {
|
5835 |
|
5836 |
|
5837 | if (typeof Symbol === 'function' &&
|
5838 | iterable[Symbol.toStringTag] === 'Generator') {
|
5839 | if (!didWarnAboutGenerators) {
|
5840 | error('Using Generators as children is unsupported and will likely yield ' + 'unexpected results because enumerating a generator mutates it. ' + 'You may convert it to an array with `Array.from()` or the ' + '`[...spread]` operator before rendering. Keep in mind ' + 'you might need to polyfill these features for older browsers.');
|
5841 | }
|
5842 |
|
5843 | didWarnAboutGenerators = true;
|
5844 | }
|
5845 |
|
5846 |
|
5847 | if (iterable.entries === iteratorFn) {
|
5848 | if (!didWarnAboutMaps) {
|
5849 | error('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
|
5850 | }
|
5851 |
|
5852 | didWarnAboutMaps = true;
|
5853 | }
|
5854 | }
|
5855 | }
|
5856 |
|
5857 |
|
5858 |
|
5859 | function renderNodeDestructive(request, task, node) {
|
5860 |
|
5861 |
|
5862 | task.node = node;
|
5863 |
|
5864 | if (typeof node === 'object' && node !== null) {
|
5865 | switch (node.$$typeof) {
|
5866 | case REACT_ELEMENT_TYPE:
|
5867 | {
|
5868 | var element = node;
|
5869 | var type = element.type;
|
5870 | var props = element.props;
|
5871 | var ref = element.ref;
|
5872 | renderElement(request, task, type, props, ref);
|
5873 | return;
|
5874 | }
|
5875 |
|
5876 | case REACT_PORTAL_TYPE:
|
5877 | throw new Error('Portals are not currently supported by the server renderer. ' + 'Render them conditionally so that they only appear on the client render.');
|
5878 |
|
5879 |
|
5880 | case REACT_LAZY_TYPE:
|
5881 | {
|
5882 | {
|
5883 | var lazyNode = node;
|
5884 | var payload = lazyNode._payload;
|
5885 | var init = lazyNode._init;
|
5886 | var resolvedNode = init(payload);
|
5887 | renderNodeDestructive(request, task, resolvedNode);
|
5888 | return;
|
5889 | }
|
5890 | }
|
5891 | }
|
5892 |
|
5893 | if (isArray(node)) {
|
5894 | renderChildrenArray(request, task, node);
|
5895 | return;
|
5896 | }
|
5897 |
|
5898 | var iteratorFn = getIteratorFn(node);
|
5899 |
|
5900 | if (iteratorFn) {
|
5901 | {
|
5902 | validateIterable(node, iteratorFn);
|
5903 | }
|
5904 |
|
5905 | var iterator = iteratorFn.call(node);
|
5906 |
|
5907 | if (iterator) {
|
5908 |
|
5909 |
|
5910 |
|
5911 |
|
5912 |
|
5913 | var step = iterator.next();
|
5914 |
|
5915 | if (!step.done) {
|
5916 | var children = [];
|
5917 |
|
5918 | do {
|
5919 | children.push(step.value);
|
5920 | step = iterator.next();
|
5921 | } while (!step.done);
|
5922 |
|
5923 | renderChildrenArray(request, task, children);
|
5924 | return;
|
5925 | }
|
5926 |
|
5927 | return;
|
5928 | }
|
5929 | }
|
5930 |
|
5931 | var childString = Object.prototype.toString.call(node);
|
5932 | throw new Error("Objects are not valid as a React child (found: " + (childString === '[object Object]' ? 'object with keys {' + Object.keys(node).join(', ') + '}' : childString) + "). " + 'If you meant to render a collection of children, use an array ' + 'instead.');
|
5933 | }
|
5934 |
|
5935 | if (typeof node === 'string') {
|
5936 | pushTextInstance(task.blockedSegment.chunks, node, request.responseState);
|
5937 | return;
|
5938 | }
|
5939 |
|
5940 | if (typeof node === 'number') {
|
5941 | pushTextInstance(task.blockedSegment.chunks, '' + node, request.responseState);
|
5942 | return;
|
5943 | }
|
5944 |
|
5945 | {
|
5946 | if (typeof node === 'function') {
|
5947 | error('Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.');
|
5948 | }
|
5949 | }
|
5950 | }
|
5951 |
|
5952 | function renderChildrenArray(request, task, children) {
|
5953 | var totalChildren = children.length;
|
5954 |
|
5955 | for (var i = 0; i < totalChildren; i++) {
|
5956 | var prevTreeContext = task.treeContext;
|
5957 | task.treeContext = pushTreeContext(prevTreeContext, totalChildren, i);
|
5958 |
|
5959 | try {
|
5960 |
|
5961 |
|
5962 | renderNode(request, task, children[i]);
|
5963 | } finally {
|
5964 | task.treeContext = prevTreeContext;
|
5965 | }
|
5966 | }
|
5967 | }
|
5968 |
|
5969 | function spawnNewSuspendedTask(request, task, x) {
|
5970 |
|
5971 | var segment = task.blockedSegment;
|
5972 | var insertionIndex = segment.chunks.length;
|
5973 | var newSegment = createPendingSegment(request, insertionIndex, null, segment.formatContext);
|
5974 | segment.children.push(newSegment);
|
5975 | var newTask = createTask(request, task.node, task.blockedBoundary, newSegment, task.abortSet, task.legacyContext, task.context, task.treeContext);
|
5976 |
|
5977 | {
|
5978 | if (task.componentStack !== null) {
|
5979 |
|
5980 |
|
5981 | newTask.componentStack = task.componentStack.parent;
|
5982 | }
|
5983 | }
|
5984 |
|
5985 | var ping = newTask.ping;
|
5986 | x.then(ping, ping);
|
5987 | }
|
5988 |
|
5989 |
|
5990 |
|
5991 | function renderNode(request, task, node) {
|
5992 |
|
5993 |
|
5994 |
|
5995 |
|
5996 | var previousFormatContext = task.blockedSegment.formatContext;
|
5997 | var previousLegacyContext = task.legacyContext;
|
5998 | var previousContext = task.context;
|
5999 | var previousComponentStack = null;
|
6000 |
|
6001 | {
|
6002 | previousComponentStack = task.componentStack;
|
6003 | }
|
6004 |
|
6005 | try {
|
6006 | return renderNodeDestructive(request, task, node);
|
6007 | } catch (x) {
|
6008 | resetHooksState();
|
6009 |
|
6010 | if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
|
6011 | spawnNewSuspendedTask(request, task, x);
|
6012 |
|
6013 |
|
6014 | task.blockedSegment.formatContext = previousFormatContext;
|
6015 | task.legacyContext = previousLegacyContext;
|
6016 | task.context = previousContext;
|
6017 |
|
6018 | switchContext(previousContext);
|
6019 |
|
6020 | {
|
6021 | task.componentStack = previousComponentStack;
|
6022 | }
|
6023 |
|
6024 | return;
|
6025 | } else {
|
6026 |
|
6027 |
|
6028 | task.blockedSegment.formatContext = previousFormatContext;
|
6029 | task.legacyContext = previousLegacyContext;
|
6030 | task.context = previousContext;
|
6031 |
|
6032 | switchContext(previousContext);
|
6033 |
|
6034 | {
|
6035 | task.componentStack = previousComponentStack;
|
6036 | }
|
6037 |
|
6038 |
|
6039 |
|
6040 | throw x;
|
6041 | }
|
6042 | }
|
6043 | }
|
6044 |
|
6045 | function erroredTask(request, boundary, segment, error) {
|
6046 |
|
6047 | logRecoverableError(request, error);
|
6048 |
|
6049 | if (boundary === null) {
|
6050 | fatalError(request, error);
|
6051 | } else {
|
6052 | boundary.pendingTasks--;
|
6053 |
|
6054 | if (!boundary.forceClientRender) {
|
6055 | boundary.forceClientRender = true;
|
6056 |
|
6057 |
|
6058 | if (boundary.parentFlushed) {
|
6059 |
|
6060 |
|
6061 |
|
6062 |
|
6063 | request.clientRenderedBoundaries.push(boundary);
|
6064 | }
|
6065 | }
|
6066 | }
|
6067 |
|
6068 | request.allPendingTasks--;
|
6069 |
|
6070 | if (request.allPendingTasks === 0) {
|
6071 | var onAllReady = request.onAllReady;
|
6072 | onAllReady();
|
6073 | }
|
6074 | }
|
6075 |
|
6076 | function abortTaskSoft(task) {
|
6077 |
|
6078 |
|
6079 |
|
6080 | var request = this;
|
6081 | var boundary = task.blockedBoundary;
|
6082 | var segment = task.blockedSegment;
|
6083 | segment.status = ABORTED;
|
6084 | finishedTask(request, boundary, segment);
|
6085 | }
|
6086 |
|
6087 | function abortTask(task) {
|
6088 |
|
6089 |
|
6090 | var request = this;
|
6091 | var boundary = task.blockedBoundary;
|
6092 | var segment = task.blockedSegment;
|
6093 | segment.status = ABORTED;
|
6094 |
|
6095 | if (boundary === null) {
|
6096 | request.allPendingTasks--;
|
6097 |
|
6098 |
|
6099 | if (request.status !== CLOSED) {
|
6100 | request.status = CLOSED;
|
6101 |
|
6102 | if (request.destination !== null) {
|
6103 | close(request.destination);
|
6104 | }
|
6105 | }
|
6106 | } else {
|
6107 | boundary.pendingTasks--;
|
6108 |
|
6109 | if (!boundary.forceClientRender) {
|
6110 | boundary.forceClientRender = true;
|
6111 |
|
6112 | if (boundary.parentFlushed) {
|
6113 | request.clientRenderedBoundaries.push(boundary);
|
6114 | }
|
6115 | }
|
6116 |
|
6117 |
|
6118 |
|
6119 | boundary.fallbackAbortableTasks.forEach(abortTask, request);
|
6120 | boundary.fallbackAbortableTasks.clear();
|
6121 | request.allPendingTasks--;
|
6122 |
|
6123 | if (request.allPendingTasks === 0) {
|
6124 | var onAllReady = request.onAllReady;
|
6125 | onAllReady();
|
6126 | }
|
6127 | }
|
6128 | }
|
6129 |
|
6130 | function queueCompletedSegment(boundary, segment) {
|
6131 | if (segment.chunks.length === 0 && segment.children.length === 1 && segment.children[0].boundary === null) {
|
6132 |
|
6133 |
|
6134 | var childSegment = segment.children[0];
|
6135 | childSegment.id = segment.id;
|
6136 | childSegment.parentFlushed = true;
|
6137 |
|
6138 | if (childSegment.status === COMPLETED) {
|
6139 | queueCompletedSegment(boundary, childSegment);
|
6140 | }
|
6141 | } else {
|
6142 | var completedSegments = boundary.completedSegments;
|
6143 | completedSegments.push(segment);
|
6144 | }
|
6145 | }
|
6146 |
|
6147 | function finishedTask(request, boundary, segment) {
|
6148 | if (boundary === null) {
|
6149 | if (segment.parentFlushed) {
|
6150 | if (request.completedRootSegment !== null) {
|
6151 | throw new Error('There can only be one root segment. This is a bug in React.');
|
6152 | }
|
6153 |
|
6154 | request.completedRootSegment = segment;
|
6155 | }
|
6156 |
|
6157 | request.pendingRootTasks--;
|
6158 |
|
6159 | if (request.pendingRootTasks === 0) {
|
6160 |
|
6161 | request.onShellError = noop$1;
|
6162 | var onShellReady = request.onShellReady;
|
6163 | onShellReady();
|
6164 | }
|
6165 | } else {
|
6166 | boundary.pendingTasks--;
|
6167 |
|
6168 | if (boundary.forceClientRender) ; else if (boundary.pendingTasks === 0) {
|
6169 |
|
6170 | if (segment.parentFlushed) {
|
6171 |
|
6172 |
|
6173 |
|
6174 | if (segment.status === COMPLETED) {
|
6175 | queueCompletedSegment(boundary, segment);
|
6176 | }
|
6177 | }
|
6178 |
|
6179 | if (boundary.parentFlushed) {
|
6180 |
|
6181 |
|
6182 | request.completedBoundaries.push(boundary);
|
6183 | }
|
6184 |
|
6185 |
|
6186 |
|
6187 |
|
6188 | boundary.fallbackAbortableTasks.forEach(abortTaskSoft, request);
|
6189 | boundary.fallbackAbortableTasks.clear();
|
6190 | } else {
|
6191 | if (segment.parentFlushed) {
|
6192 |
|
6193 |
|
6194 |
|
6195 | if (segment.status === COMPLETED) {
|
6196 | queueCompletedSegment(boundary, segment);
|
6197 | var completedSegments = boundary.completedSegments;
|
6198 |
|
6199 | if (completedSegments.length === 1) {
|
6200 |
|
6201 |
|
6202 |
|
6203 | if (boundary.parentFlushed) {
|
6204 | request.partialBoundaries.push(boundary);
|
6205 | }
|
6206 | }
|
6207 | }
|
6208 | }
|
6209 | }
|
6210 | }
|
6211 |
|
6212 | request.allPendingTasks--;
|
6213 |
|
6214 | if (request.allPendingTasks === 0) {
|
6215 |
|
6216 |
|
6217 | var onAllReady = request.onAllReady;
|
6218 | onAllReady();
|
6219 | }
|
6220 | }
|
6221 |
|
6222 | function retryTask(request, task) {
|
6223 | var segment = task.blockedSegment;
|
6224 |
|
6225 | if (segment.status !== PENDING) {
|
6226 |
|
6227 | return;
|
6228 | }
|
6229 |
|
6230 |
|
6231 |
|
6232 |
|
6233 | switchContext(task.context);
|
6234 | var prevTaskInDEV = null;
|
6235 |
|
6236 | {
|
6237 | prevTaskInDEV = currentTaskInDEV;
|
6238 | currentTaskInDEV = task;
|
6239 | }
|
6240 |
|
6241 | try {
|
6242 |
|
6243 |
|
6244 | renderNodeDestructive(request, task, task.node);
|
6245 | task.abortSet.delete(task);
|
6246 | segment.status = COMPLETED;
|
6247 | finishedTask(request, task.blockedBoundary, segment);
|
6248 | } catch (x) {
|
6249 | resetHooksState();
|
6250 |
|
6251 | if (typeof x === 'object' && x !== null && typeof x.then === 'function') {
|
6252 |
|
6253 | var ping = task.ping;
|
6254 | x.then(ping, ping);
|
6255 | } else {
|
6256 | task.abortSet.delete(task);
|
6257 | segment.status = ERRORED;
|
6258 | erroredTask(request, task.blockedBoundary, segment, x);
|
6259 | }
|
6260 | } finally {
|
6261 | {
|
6262 | currentTaskInDEV = prevTaskInDEV;
|
6263 | }
|
6264 | }
|
6265 | }
|
6266 |
|
6267 | function performWork(request) {
|
6268 | if (request.status === CLOSED) {
|
6269 | return;
|
6270 | }
|
6271 |
|
6272 | var prevContext = getActiveContext();
|
6273 | var prevDispatcher = ReactCurrentDispatcher$1.current;
|
6274 | ReactCurrentDispatcher$1.current = Dispatcher;
|
6275 | var prevGetCurrentStackImpl;
|
6276 |
|
6277 | {
|
6278 | prevGetCurrentStackImpl = ReactDebugCurrentFrame$1.getCurrentStack;
|
6279 | ReactDebugCurrentFrame$1.getCurrentStack = getCurrentStackInDEV;
|
6280 | }
|
6281 |
|
6282 | var prevResponseState = currentResponseState;
|
6283 | setCurrentResponseState(request.responseState);
|
6284 |
|
6285 | try {
|
6286 | var pingedTasks = request.pingedTasks;
|
6287 | var i;
|
6288 |
|
6289 | for (i = 0; i < pingedTasks.length; i++) {
|
6290 | var task = pingedTasks[i];
|
6291 | retryTask(request, task);
|
6292 | }
|
6293 |
|
6294 | pingedTasks.splice(0, i);
|
6295 |
|
6296 | if (request.destination !== null) {
|
6297 | flushCompletedQueues(request, request.destination);
|
6298 | }
|
6299 | } catch (error) {
|
6300 | logRecoverableError(request, error);
|
6301 | fatalError(request, error);
|
6302 | } finally {
|
6303 | setCurrentResponseState(prevResponseState);
|
6304 | ReactCurrentDispatcher$1.current = prevDispatcher;
|
6305 |
|
6306 | {
|
6307 | ReactDebugCurrentFrame$1.getCurrentStack = prevGetCurrentStackImpl;
|
6308 | }
|
6309 |
|
6310 | if (prevDispatcher === Dispatcher) {
|
6311 |
|
6312 |
|
6313 |
|
6314 |
|
6315 |
|
6316 |
|
6317 |
|
6318 | switchContext(prevContext);
|
6319 | }
|
6320 | }
|
6321 | }
|
6322 |
|
6323 | function flushSubtree(request, destination, segment) {
|
6324 | segment.parentFlushed = true;
|
6325 |
|
6326 | switch (segment.status) {
|
6327 | case PENDING:
|
6328 | {
|
6329 |
|
6330 |
|
6331 | var segmentID = segment.id = request.nextSegmentId++;
|
6332 | return writePlaceholder(destination, request.responseState, segmentID);
|
6333 | }
|
6334 |
|
6335 | case COMPLETED:
|
6336 | {
|
6337 | segment.status = FLUSHED;
|
6338 | var r = true;
|
6339 | var chunks = segment.chunks;
|
6340 | var chunkIdx = 0;
|
6341 | var children = segment.children;
|
6342 |
|
6343 | for (var childIdx = 0; childIdx < children.length; childIdx++) {
|
6344 | var nextChild = children[childIdx];
|
6345 |
|
6346 | for (; chunkIdx < nextChild.index; chunkIdx++) {
|
6347 | writeChunk(destination, chunks[chunkIdx]);
|
6348 | }
|
6349 |
|
6350 | r = flushSegment(request, destination, nextChild);
|
6351 | }
|
6352 |
|
6353 |
|
6354 | for (; chunkIdx < chunks.length - 1; chunkIdx++) {
|
6355 | writeChunk(destination, chunks[chunkIdx]);
|
6356 | }
|
6357 |
|
6358 | if (chunkIdx < chunks.length) {
|
6359 | r = writeChunkAndReturn(destination, chunks[chunkIdx]);
|
6360 | }
|
6361 |
|
6362 | return r;
|
6363 | }
|
6364 |
|
6365 | default:
|
6366 | {
|
6367 | throw new Error('Aborted, errored or already flushed boundaries should not be flushed again. This is a bug in React.');
|
6368 | }
|
6369 | }
|
6370 | }
|
6371 |
|
6372 | function flushSegment(request, destination, segment) {
|
6373 | var boundary = segment.boundary;
|
6374 |
|
6375 | if (boundary === null) {
|
6376 |
|
6377 | return flushSubtree(request, destination, segment);
|
6378 | }
|
6379 |
|
6380 | boundary.parentFlushed = true;
|
6381 |
|
6382 |
|
6383 | if (boundary.forceClientRender) {
|
6384 |
|
6385 |
|
6386 | writeStartClientRenderedSuspenseBoundary(destination, request.responseState);
|
6387 |
|
6388 | flushSubtree(request, destination, segment);
|
6389 | return writeEndClientRenderedSuspenseBoundary(destination, request.responseState);
|
6390 | } else if (boundary.pendingTasks > 0) {
|
6391 |
|
6392 |
|
6393 | boundary.rootSegmentID = request.nextSegmentId++;
|
6394 |
|
6395 | if (boundary.completedSegments.length > 0) {
|
6396 |
|
6397 | request.partialBoundaries.push(boundary);
|
6398 | }
|
6399 |
|
6400 |
|
6401 | var id = boundary.id = assignSuspenseBoundaryID(request.responseState);
|
6402 | writeStartPendingSuspenseBoundary(destination, request.responseState, id);
|
6403 |
|
6404 | flushSubtree(request, destination, segment);
|
6405 | return writeEndPendingSuspenseBoundary(destination, request.responseState);
|
6406 | } else if (boundary.byteSize > request.progressiveChunkSize) {
|
6407 |
|
6408 |
|
6409 |
|
6410 |
|
6411 |
|
6412 |
|
6413 | boundary.rootSegmentID = request.nextSegmentId++;
|
6414 | request.completedBoundaries.push(boundary);
|
6415 |
|
6416 | writeStartPendingSuspenseBoundary(destination, request.responseState, boundary.id);
|
6417 |
|
6418 | flushSubtree(request, destination, segment);
|
6419 | return writeEndPendingSuspenseBoundary(destination, request.responseState);
|
6420 | } else {
|
6421 |
|
6422 | writeStartCompletedSuspenseBoundary(destination, request.responseState);
|
6423 | var completedSegments = boundary.completedSegments;
|
6424 |
|
6425 | if (completedSegments.length !== 1) {
|
6426 | throw new Error('A previously unvisited boundary must have exactly one root segment. This is a bug in React.');
|
6427 | }
|
6428 |
|
6429 | var contentSegment = completedSegments[0];
|
6430 | flushSegment(request, destination, contentSegment);
|
6431 | return writeEndCompletedSuspenseBoundary(destination, request.responseState);
|
6432 | }
|
6433 | }
|
6434 |
|
6435 | function flushClientRenderedBoundary(request, destination, boundary) {
|
6436 | return writeClientRenderBoundaryInstruction(destination, request.responseState, boundary.id);
|
6437 | }
|
6438 |
|
6439 | function flushSegmentContainer(request, destination, segment) {
|
6440 | writeStartSegment(destination, request.responseState, segment.formatContext, segment.id);
|
6441 | flushSegment(request, destination, segment);
|
6442 | return writeEndSegment(destination, segment.formatContext);
|
6443 | }
|
6444 |
|
6445 | function flushCompletedBoundary(request, destination, boundary) {
|
6446 | var completedSegments = boundary.completedSegments;
|
6447 | var i = 0;
|
6448 |
|
6449 | for (; i < completedSegments.length; i++) {
|
6450 | var segment = completedSegments[i];
|
6451 | flushPartiallyCompletedSegment(request, destination, boundary, segment);
|
6452 | }
|
6453 |
|
6454 | completedSegments.length = 0;
|
6455 | return writeCompletedBoundaryInstruction(destination, request.responseState, boundary.id, boundary.rootSegmentID);
|
6456 | }
|
6457 |
|
6458 | function flushPartialBoundary(request, destination, boundary) {
|
6459 | var completedSegments = boundary.completedSegments;
|
6460 | var i = 0;
|
6461 |
|
6462 | for (; i < completedSegments.length; i++) {
|
6463 | var segment = completedSegments[i];
|
6464 |
|
6465 | if (!flushPartiallyCompletedSegment(request, destination, boundary, segment)) {
|
6466 | i++;
|
6467 | completedSegments.splice(0, i);
|
6468 |
|
6469 |
|
6470 | return false;
|
6471 | }
|
6472 | }
|
6473 |
|
6474 | completedSegments.splice(0, i);
|
6475 | return true;
|
6476 | }
|
6477 |
|
6478 | function flushPartiallyCompletedSegment(request, destination, boundary, segment) {
|
6479 | if (segment.status === FLUSHED) {
|
6480 |
|
6481 | return true;
|
6482 | }
|
6483 |
|
6484 | var segmentID = segment.id;
|
6485 |
|
6486 | if (segmentID === -1) {
|
6487 |
|
6488 |
|
6489 | var rootSegmentID = segment.id = boundary.rootSegmentID;
|
6490 |
|
6491 | if (rootSegmentID === -1) {
|
6492 | throw new Error('A root segment ID must have been assigned by now. This is a bug in React.');
|
6493 | }
|
6494 |
|
6495 | return flushSegmentContainer(request, destination, segment);
|
6496 | } else {
|
6497 | flushSegmentContainer(request, destination, segment);
|
6498 | return writeCompletedSegmentInstruction(destination, request.responseState, segmentID);
|
6499 | }
|
6500 | }
|
6501 |
|
6502 | function flushCompletedQueues(request, destination) {
|
6503 | beginWriting();
|
6504 |
|
6505 | try {
|
6506 |
|
6507 |
|
6508 |
|
6509 |
|
6510 |
|
6511 |
|
6512 |
|
6513 | var completedRootSegment = request.completedRootSegment;
|
6514 |
|
6515 | if (completedRootSegment !== null && request.pendingRootTasks === 0) {
|
6516 | flushSegment(request, destination, completedRootSegment);
|
6517 | request.completedRootSegment = null;
|
6518 | writeCompletedRoot(destination, request.responseState);
|
6519 | }
|
6520 |
|
6521 |
|
6522 |
|
6523 |
|
6524 | var clientRenderedBoundaries = request.clientRenderedBoundaries;
|
6525 | var i;
|
6526 |
|
6527 | for (i = 0; i < clientRenderedBoundaries.length; i++) {
|
6528 | var boundary = clientRenderedBoundaries[i];
|
6529 |
|
6530 | if (!flushClientRenderedBoundary(request, destination, boundary)) {
|
6531 | request.destination = null;
|
6532 | i++;
|
6533 | clientRenderedBoundaries.splice(0, i);
|
6534 | return;
|
6535 | }
|
6536 | }
|
6537 |
|
6538 | clientRenderedBoundaries.splice(0, i);
|
6539 |
|
6540 |
|
6541 |
|
6542 | var completedBoundaries = request.completedBoundaries;
|
6543 |
|
6544 | for (i = 0; i < completedBoundaries.length; i++) {
|
6545 | var _boundary = completedBoundaries[i];
|
6546 |
|
6547 | if (!flushCompletedBoundary(request, destination, _boundary)) {
|
6548 | request.destination = null;
|
6549 | i++;
|
6550 | completedBoundaries.splice(0, i);
|
6551 | return;
|
6552 | }
|
6553 | }
|
6554 |
|
6555 | completedBoundaries.splice(0, i);
|
6556 |
|
6557 |
|
6558 | completeWriting(destination);
|
6559 | beginWriting(destination);
|
6560 |
|
6561 |
|
6562 |
|
6563 | var partialBoundaries = request.partialBoundaries;
|
6564 |
|
6565 | for (i = 0; i < partialBoundaries.length; i++) {
|
6566 | var _boundary2 = partialBoundaries[i];
|
6567 |
|
6568 | if (!flushPartialBoundary(request, destination, _boundary2)) {
|
6569 | request.destination = null;
|
6570 | i++;
|
6571 | partialBoundaries.splice(0, i);
|
6572 | return;
|
6573 | }
|
6574 | }
|
6575 |
|
6576 | partialBoundaries.splice(0, i);
|
6577 |
|
6578 |
|
6579 |
|
6580 | var largeBoundaries = request.completedBoundaries;
|
6581 |
|
6582 | for (i = 0; i < largeBoundaries.length; i++) {
|
6583 | var _boundary3 = largeBoundaries[i];
|
6584 |
|
6585 | if (!flushCompletedBoundary(request, destination, _boundary3)) {
|
6586 | request.destination = null;
|
6587 | i++;
|
6588 | largeBoundaries.splice(0, i);
|
6589 | return;
|
6590 | }
|
6591 | }
|
6592 |
|
6593 | largeBoundaries.splice(0, i);
|
6594 | } finally {
|
6595 | completeWriting(destination);
|
6596 |
|
6597 | if (request.allPendingTasks === 0 && request.pingedTasks.length === 0 && request.clientRenderedBoundaries.length === 0 && request.completedBoundaries.length === 0
|
6598 |
|
6599 | ) {
|
6600 | {
|
6601 | if (request.abortableTasks.size !== 0) {
|
6602 | error('There was still abortable task at the root when we closed. This is a bug in React.');
|
6603 | }
|
6604 | }
|
6605 |
|
6606 |
|
6607 | close(destination);
|
6608 | }
|
6609 | }
|
6610 | }
|
6611 |
|
6612 | function startWork(request) {
|
6613 | scheduleWork(function () {
|
6614 | return performWork(request);
|
6615 | });
|
6616 | }
|
6617 | function startFlowing(request, destination) {
|
6618 | if (request.status === CLOSING) {
|
6619 | request.status = CLOSED;
|
6620 | closeWithError(destination, request.fatalError);
|
6621 | return;
|
6622 | }
|
6623 |
|
6624 | if (request.status === CLOSED) {
|
6625 | return;
|
6626 | }
|
6627 |
|
6628 | if (request.destination !== null) {
|
6629 |
|
6630 | return;
|
6631 | }
|
6632 |
|
6633 | request.destination = destination;
|
6634 |
|
6635 | try {
|
6636 | flushCompletedQueues(request, destination);
|
6637 | } catch (error) {
|
6638 | logRecoverableError(request, error);
|
6639 | fatalError(request, error);
|
6640 | }
|
6641 | }
|
6642 |
|
6643 | function abort(request) {
|
6644 | try {
|
6645 | var abortableTasks = request.abortableTasks;
|
6646 | abortableTasks.forEach(abortTask, request);
|
6647 | abortableTasks.clear();
|
6648 |
|
6649 | if (request.destination !== null) {
|
6650 | flushCompletedQueues(request, request.destination);
|
6651 | }
|
6652 | } catch (error) {
|
6653 | logRecoverableError(request, error);
|
6654 | fatalError(request, error);
|
6655 | }
|
6656 | }
|
6657 |
|
6658 | function renderToReadableStream(children, options) {
|
6659 | return new Promise(function (resolve, reject) {
|
6660 | var onFatalError;
|
6661 | var onAllReady;
|
6662 | var allReady = new Promise(function (res, rej) {
|
6663 | onAllReady = res;
|
6664 | onFatalError = rej;
|
6665 | });
|
6666 |
|
6667 | function onShellReady() {
|
6668 | var stream = new ReadableStream({
|
6669 | type: 'bytes',
|
6670 | pull: function (controller) {
|
6671 | startFlowing(request, controller);
|
6672 | },
|
6673 | cancel: function (reason) {
|
6674 | abort(request);
|
6675 | }
|
6676 | });
|
6677 |
|
6678 | stream.allReady = allReady;
|
6679 | resolve(stream);
|
6680 | }
|
6681 |
|
6682 | function onShellError(error) {
|
6683 |
|
6684 |
|
6685 |
|
6686 | allReady.catch(function () {});
|
6687 | reject(error);
|
6688 | }
|
6689 |
|
6690 | var request = createRequest(children, createResponseState(options ? options.identifierPrefix : undefined, options ? options.nonce : undefined, options ? options.bootstrapScriptContent : undefined, options ? options.bootstrapScripts : undefined, options ? options.bootstrapModules : undefined), createRootFormatContext(options ? options.namespaceURI : undefined), options ? options.progressiveChunkSize : undefined, options ? options.onError : undefined, onAllReady, onShellReady, onShellError, onFatalError);
|
6691 |
|
6692 | if (options && options.signal) {
|
6693 | var signal = options.signal;
|
6694 |
|
6695 | var listener = function () {
|
6696 | abort(request);
|
6697 | signal.removeEventListener('abort', listener);
|
6698 | };
|
6699 |
|
6700 | signal.addEventListener('abort', listener);
|
6701 | }
|
6702 |
|
6703 | startWork(request);
|
6704 | });
|
6705 | }
|
6706 |
|
6707 | exports.renderToReadableStream = renderToReadableStream;
|
6708 | exports.version = ReactVersion;
|
6709 |
|
6710 | })));
|