@openedx/frontend-build 15.0.0-alpha.2 → 15.0.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/README.md +1 -1
  2. package/config/.eslintrc.js +1 -0
  3. package/config/data/paragonUtils.js +171 -0
  4. package/config/jest/setupTest.js +35 -0
  5. package/config/jest.config.js +4 -1
  6. package/config/webpack.common.config.js +44 -0
  7. package/config/webpack.dev-stage.config.js +1 -0
  8. package/config/webpack.dev.config.js +57 -35
  9. package/config/webpack.prod.config.js +2 -1
  10. package/lib/plugins/paragon-webpack-plugin/ParagonWebpackPlugin.js +126 -0
  11. package/lib/plugins/paragon-webpack-plugin/index.js +3 -0
  12. package/lib/plugins/paragon-webpack-plugin/utils/assetUtils.js +75 -0
  13. package/lib/plugins/paragon-webpack-plugin/utils/htmlUtils.js +69 -0
  14. package/lib/plugins/paragon-webpack-plugin/utils/index.js +9 -0
  15. package/lib/plugins/paragon-webpack-plugin/utils/paragonStylesheetUtils.js +120 -0
  16. package/lib/plugins/paragon-webpack-plugin/utils/scriptUtils.js +144 -0
  17. package/lib/plugins/paragon-webpack-plugin/utils/stylesheetUtils.js +107 -0
  18. package/lib/plugins/paragon-webpack-plugin/utils/tagUtils.js +58 -0
  19. package/package.json +22 -14
  20. package/.eslintignore +0 -5
  21. package/.eslintrc.js +0 -10
  22. package/.github/workflows/add-depr-ticket-to-depr-board.yml +0 -19
  23. package/.github/workflows/add-remove-label-on-comment.yml +0 -20
  24. package/.github/workflows/ci.yml +0 -30
  25. package/.github/workflows/commitlint.yml +0 -17
  26. package/.github/workflows/lockfileversion-check.yml +0 -13
  27. package/.github/workflows/release.yml +0 -34
  28. package/.github/workflows/self-assign-issue.yml +0 -12
  29. package/.github/workflows/sync-master-alpha.yml +0 -35
  30. package/.nvmrc +0 -1
  31. package/coverage/clover.xml +0 -6
  32. package/coverage/coverage-final.json +0 -1
  33. package/coverage/lcov-report/base.css +0 -224
  34. package/coverage/lcov-report/block-navigation.js +0 -87
  35. package/coverage/lcov-report/favicon.png +0 -0
  36. package/coverage/lcov-report/index.html +0 -101
  37. package/coverage/lcov-report/prettify.css +0 -1
  38. package/coverage/lcov-report/prettify.js +0 -2
  39. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  40. package/coverage/lcov-report/sorter.js +0 -196
  41. package/coverage/lcov.info +0 -0
  42. package/docs/0001-non-usage-of-gatsby.rst +0 -37
  43. package/docs/0002-js-environment-config.md +0 -47
  44. package/docs/0003-fedx-scripts-serve.md +0 -37
  45. package/example/.env +0 -0
  46. package/example/.env.development +0 -3
  47. package/example/.env.test +0 -2
  48. package/example/.eslintignore +0 -5
  49. package/example/.eslintrc.js +0 -3
  50. package/example/dist/1382e1cbf8d733d7301cdd212192bfea.jpg +0 -0
  51. package/example/dist/652.70be34739115e11aaeb3.js +0 -3
  52. package/example/dist/652.70be34739115e11aaeb3.js.LICENSE.txt +0 -41
  53. package/example/dist/652.70be34739115e11aaeb3.js.map +0 -1
  54. package/example/dist/app.9b26aa9c728d62e6064d.css +0 -3
  55. package/example/dist/app.9b26aa9c728d62e6064d.css.map +0 -1
  56. package/example/dist/app.9b26aa9c728d62e6064d.js +0 -2
  57. package/example/dist/app.9b26aa9c728d62e6064d.js.map +0 -1
  58. package/example/dist/babel/App.js +0 -94
  59. package/example/dist/babel/App.js.map +0 -1
  60. package/example/dist/babel/App.test.jsx +0 -11
  61. package/example/dist/babel/Image.tsx +0 -16
  62. package/example/dist/babel/__snapshots__/App.test.jsx.snap +0 -120
  63. package/example/dist/babel/apple.jpg +0 -0
  64. package/example/dist/babel/apple.svg +0 -1
  65. package/example/dist/babel/index.js +0 -13
  66. package/example/dist/babel/index.js.map +0 -1
  67. package/example/dist/babel/style.scss +0 -9
  68. package/example/dist/cb28cdb1468c915e27e5cec9af64f22f.svg +0 -1
  69. package/example/dist/index.html +0 -4
  70. package/example/dist/report.html +0 -39
  71. package/example/dist/runtime.40856db71d718a3e9d37.js +0 -2
  72. package/example/dist/runtime.40856db71d718a3e9d37.js.map +0 -1
  73. package/example/env.config.js +0 -6
  74. package/example/node_modules/.package-lock.json +0 -98
  75. package/example/node_modules/js-tokens/CHANGELOG.md +0 -151
  76. package/example/node_modules/js-tokens/LICENSE +0 -21
  77. package/example/node_modules/js-tokens/README.md +0 -240
  78. package/example/node_modules/js-tokens/index.js +0 -23
  79. package/example/node_modules/js-tokens/package.json +0 -30
  80. package/example/node_modules/loose-envify/LICENSE +0 -21
  81. package/example/node_modules/loose-envify/README.md +0 -45
  82. package/example/node_modules/loose-envify/cli.js +0 -16
  83. package/example/node_modules/loose-envify/custom.js +0 -4
  84. package/example/node_modules/loose-envify/index.js +0 -3
  85. package/example/node_modules/loose-envify/loose-envify.js +0 -36
  86. package/example/node_modules/loose-envify/package.json +0 -36
  87. package/example/node_modules/loose-envify/replace.js +0 -65
  88. package/example/node_modules/object-assign/index.js +0 -90
  89. package/example/node_modules/object-assign/license +0 -21
  90. package/example/node_modules/object-assign/package.json +0 -42
  91. package/example/node_modules/object-assign/readme.md +0 -61
  92. package/example/node_modules/prop-types/LICENSE +0 -21
  93. package/example/node_modules/prop-types/README.md +0 -302
  94. package/example/node_modules/prop-types/checkPropTypes.js +0 -103
  95. package/example/node_modules/prop-types/factory.js +0 -19
  96. package/example/node_modules/prop-types/factoryWithThrowingShims.js +0 -65
  97. package/example/node_modules/prop-types/factoryWithTypeCheckers.js +0 -610
  98. package/example/node_modules/prop-types/index.js +0 -19
  99. package/example/node_modules/prop-types/lib/ReactPropTypesSecret.js +0 -12
  100. package/example/node_modules/prop-types/lib/has.js +0 -1
  101. package/example/node_modules/prop-types/package.json +0 -60
  102. package/example/node_modules/prop-types/prop-types.js +0 -1315
  103. package/example/node_modules/prop-types/prop-types.min.js +0 -1
  104. package/example/node_modules/react/LICENSE +0 -21
  105. package/example/node_modules/react/README.md +0 -13
  106. package/example/node_modules/react/build-info.json +0 -8
  107. package/example/node_modules/react/cjs/react-jsx-dev-runtime.development.js +0 -889
  108. package/example/node_modules/react/cjs/react-jsx-dev-runtime.production.min.js +0 -9
  109. package/example/node_modules/react/cjs/react-jsx-runtime.development.js +0 -911
  110. package/example/node_modules/react/cjs/react-jsx-runtime.production.min.js +0 -10
  111. package/example/node_modules/react/cjs/react.development.js +0 -1912
  112. package/example/node_modules/react/cjs/react.production.min.js +0 -25
  113. package/example/node_modules/react/index.js +0 -7
  114. package/example/node_modules/react/jsx-dev-runtime.js +0 -7
  115. package/example/node_modules/react/jsx-runtime.js +0 -7
  116. package/example/node_modules/react/package.json +0 -44
  117. package/example/node_modules/react/umd/react.development.js +0 -3318
  118. package/example/node_modules/react/umd/react.production.min.js +0 -32
  119. package/example/node_modules/react/umd/react.profiling.min.js +0 -39
  120. package/example/node_modules/react-dom/LICENSE +0 -21
  121. package/example/node_modules/react-dom/README.md +0 -54
  122. package/example/node_modules/react-dom/build-info.json +0 -8
  123. package/example/node_modules/react-dom/cjs/react-dom-server.browser.development.js +0 -4043
  124. package/example/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js +0 -54
  125. package/example/node_modules/react-dom/cjs/react-dom-server.node.development.js +0 -4085
  126. package/example/node_modules/react-dom/cjs/react-dom-server.node.production.min.js +0 -55
  127. package/example/node_modules/react-dom/cjs/react-dom-test-utils.development.js +0 -1480
  128. package/example/node_modules/react-dom/cjs/react-dom-test-utils.production.min.js +0 -35
  129. package/example/node_modules/react-dom/cjs/react-dom-unstable-fizz.browser.development.js +0 -141
  130. package/example/node_modules/react-dom/cjs/react-dom-unstable-fizz.browser.production.min.js +0 -11
  131. package/example/node_modules/react-dom/cjs/react-dom-unstable-fizz.node.development.js +0 -162
  132. package/example/node_modules/react-dom/cjs/react-dom-unstable-fizz.node.production.min.js +0 -12
  133. package/example/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.development.js +0 -1629
  134. package/example/node_modules/react-dom/cjs/react-dom-unstable-native-dependencies.production.min.js +0 -31
  135. package/example/node_modules/react-dom/cjs/react-dom.development.js +0 -25012
  136. package/example/node_modules/react-dom/cjs/react-dom.production.min.js +0 -292
  137. package/example/node_modules/react-dom/cjs/react-dom.profiling.min.js +0 -299
  138. package/example/node_modules/react-dom/index.js +0 -38
  139. package/example/node_modules/react-dom/package.json +0 -60
  140. package/example/node_modules/react-dom/profiling.js +0 -38
  141. package/example/node_modules/react-dom/server.browser.js +0 -7
  142. package/example/node_modules/react-dom/server.js +0 -3
  143. package/example/node_modules/react-dom/server.node.js +0 -7
  144. package/example/node_modules/react-dom/test-utils.js +0 -7
  145. package/example/node_modules/react-dom/umd/react-dom-server.browser.development.js +0 -4147
  146. package/example/node_modules/react-dom/umd/react-dom-server.browser.production.min.js +0 -45
  147. package/example/node_modules/react-dom/umd/react-dom-test-utils.development.js +0 -1499
  148. package/example/node_modules/react-dom/umd/react-dom-test-utils.production.min.js +0 -30
  149. package/example/node_modules/react-dom/umd/react-dom-unstable-fizz.browser.development.js +0 -141
  150. package/example/node_modules/react-dom/umd/react-dom-unstable-fizz.browser.production.min.js +0 -10
  151. package/example/node_modules/react-dom/umd/react-dom-unstable-native-dependencies.development.js +0 -1628
  152. package/example/node_modules/react-dom/umd/react-dom-unstable-native-dependencies.production.min.js +0 -28
  153. package/example/node_modules/react-dom/umd/react-dom.development.js +0 -25147
  154. package/example/node_modules/react-dom/umd/react-dom.production.min.js +0 -239
  155. package/example/node_modules/react-dom/umd/react-dom.profiling.min.js +0 -247
  156. package/example/node_modules/react-dom/unstable-fizz.browser.js +0 -7
  157. package/example/node_modules/react-dom/unstable-fizz.js +0 -3
  158. package/example/node_modules/react-dom/unstable-fizz.node.js +0 -7
  159. package/example/node_modules/react-dom/unstable-native-dependencies.js +0 -7
  160. package/example/node_modules/react-is/LICENSE +0 -21
  161. package/example/node_modules/react-is/README.md +0 -104
  162. package/example/node_modules/react-is/build-info.json +0 -8
  163. package/example/node_modules/react-is/cjs/react-is.development.js +0 -181
  164. package/example/node_modules/react-is/cjs/react-is.production.min.js +0 -15
  165. package/example/node_modules/react-is/index.js +0 -7
  166. package/example/node_modules/react-is/package.json +0 -27
  167. package/example/node_modules/react-is/umd/react-is.development.js +0 -181
  168. package/example/node_modules/react-is/umd/react-is.production.min.js +0 -13
  169. package/example/node_modules/react-test-renderer/LICENSE +0 -21
  170. package/example/node_modules/react-test-renderer/README.md +0 -26
  171. package/example/node_modules/react-test-renderer/build-info.json +0 -8
  172. package/example/node_modules/react-test-renderer/cjs/react-test-renderer-shallow.development.js +0 -1019
  173. package/example/node_modules/react-test-renderer/cjs/react-test-renderer-shallow.production.min.js +0 -35
  174. package/example/node_modules/react-test-renderer/cjs/react-test-renderer.development.js +0 -15596
  175. package/example/node_modules/react-test-renderer/cjs/react-test-renderer.production.min.js +0 -181
  176. package/example/node_modules/react-test-renderer/index.js +0 -7
  177. package/example/node_modules/react-test-renderer/package.json +0 -41
  178. package/example/node_modules/react-test-renderer/shallow.js +0 -7
  179. package/example/node_modules/react-test-renderer/umd/react-test-renderer-shallow.development.js +0 -1176
  180. package/example/node_modules/react-test-renderer/umd/react-test-renderer-shallow.production.min.js +0 -31
  181. package/example/node_modules/react-test-renderer/umd/react-test-renderer.development.js +0 -15709
  182. package/example/node_modules/react-test-renderer/umd/react-test-renderer.production.min.js +0 -151
  183. package/example/node_modules/scheduler/LICENSE +0 -21
  184. package/example/node_modules/scheduler/README.md +0 -9
  185. package/example/node_modules/scheduler/build-info.json +0 -8
  186. package/example/node_modules/scheduler/cjs/scheduler-tracing.development.js +0 -349
  187. package/example/node_modules/scheduler/cjs/scheduler-tracing.production.min.js +0 -10
  188. package/example/node_modules/scheduler/cjs/scheduler-tracing.profiling.min.js +0 -17
  189. package/example/node_modules/scheduler/cjs/scheduler-unstable_mock.development.js +0 -857
  190. package/example/node_modules/scheduler/cjs/scheduler-unstable_mock.production.min.js +0 -20
  191. package/example/node_modules/scheduler/cjs/scheduler.development.js +0 -858
  192. package/example/node_modules/scheduler/cjs/scheduler.production.min.js +0 -21
  193. package/example/node_modules/scheduler/index.js +0 -7
  194. package/example/node_modules/scheduler/package.json +0 -39
  195. package/example/node_modules/scheduler/tracing-profiling.js +0 -7
  196. package/example/node_modules/scheduler/tracing.js +0 -7
  197. package/example/node_modules/scheduler/umd/scheduler-tracing.development.js +0 -80
  198. package/example/node_modules/scheduler/umd/scheduler-tracing.production.min.js +0 -80
  199. package/example/node_modules/scheduler/umd/scheduler-tracing.profiling.min.js +0 -80
  200. package/example/node_modules/scheduler/umd/scheduler-unstable_mock.development.js +0 -857
  201. package/example/node_modules/scheduler/umd/scheduler-unstable_mock.production.min.js +0 -17
  202. package/example/node_modules/scheduler/umd/scheduler.development.js +0 -152
  203. package/example/node_modules/scheduler/umd/scheduler.production.min.js +0 -146
  204. package/example/node_modules/scheduler/umd/scheduler.profiling.min.js +0 -146
  205. package/example/node_modules/scheduler/unstable_mock.js +0 -7
  206. package/example/package-lock.json +0 -110
  207. package/example/package.json +0 -24
  208. package/example/public/index.html +0 -13
  209. package/example/src/App.jsx +0 -43
  210. package/example/src/App.test.jsx +0 -11
  211. package/example/src/Image.tsx +0 -16
  212. package/example/src/__snapshots__/App.test.jsx.snap +0 -120
  213. package/example/src/apple.jpg +0 -0
  214. package/example/src/apple.svg +0 -1
  215. package/example/src/index.jsx +0 -13
  216. package/example/src/style.scss +0 -9
  217. package/example/tsconfig.json +0 -16
  218. package/openedx.yaml +0 -10
  219. package/renovate.json +0 -22
  220. package/smoke-test.sh +0 -11
@@ -1,4147 +0,0 @@
1
- /** @license React v16.14.0
2
- * react-dom-server.browser.development.js
3
- *
4
- * Copyright (c) Facebook, Inc. and its affiliates.
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE file in the root directory of this source tree.
8
- */
9
-
10
- 'use strict';
11
-
12
- (function (global, factory) {
13
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
14
- typeof define === 'function' && define.amd ? define(['react'], factory) :
15
- (global = global || self, global.ReactDOMServer = factory(global.React));
16
- }(this, (function (React) { 'use strict';
17
-
18
- // Do not require this module directly! Use normal `invariant` calls with
19
- // template literal strings. The messages will be replaced with error codes
20
- // during build.
21
- function formatProdErrorMessage(code) {
22
- var url = 'https://reactjs.org/docs/error-decoder.html?invariant=' + code;
23
-
24
- for (var i = 1; i < arguments.length; i++) {
25
- url += '&args[]=' + encodeURIComponent(arguments[i]);
26
- }
27
-
28
- return "Minified React error #" + code + "; visit " + url + " for the full message or " + 'use the non-minified dev environment for full errors and additional ' + 'helpful warnings.';
29
- }
30
-
31
- var ReactVersion = '16.14.0';
32
-
33
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
34
- // Current owner and dispatcher used to share the same ref,
35
- // but PR #14548 split them out to better support the react-debug-tools package.
36
-
37
- if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
38
- ReactSharedInternals.ReactCurrentDispatcher = {
39
- current: null
40
- };
41
- }
42
-
43
- if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
44
- ReactSharedInternals.ReactCurrentBatchConfig = {
45
- suspense: null
46
- };
47
- }
48
-
49
- // by calls to these methods by a Babel plugin.
50
- //
51
- // In PROD (or in packages without access to React internals),
52
- // they are left as they are instead.
53
-
54
- function warn(format) {
55
- {
56
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
57
- args[_key - 1] = arguments[_key];
58
- }
59
-
60
- printWarning('warn', format, args);
61
- }
62
- }
63
- function error(format) {
64
- {
65
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
66
- args[_key2 - 1] = arguments[_key2];
67
- }
68
-
69
- printWarning('error', format, args);
70
- }
71
- }
72
-
73
- function printWarning(level, format, args) {
74
- // When changing this logic, you might want to also
75
- // update consoleWithStackDev.www.js as well.
76
- {
77
- var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
78
-
79
- if (!hasExistingStack) {
80
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
81
- var stack = ReactDebugCurrentFrame.getStackAddendum();
82
-
83
- if (stack !== '') {
84
- format += '%s';
85
- args = args.concat([stack]);
86
- }
87
- }
88
-
89
- var argsWithFormat = args.map(function (item) {
90
- return '' + item;
91
- }); // Careful: RN currently depends on this prefix
92
-
93
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
94
- // breaks IE9: https://github.com/facebook/react/issues/13610
95
- // eslint-disable-next-line react-internal/no-production-logging
96
-
97
- Function.prototype.apply.call(console[level], console, argsWithFormat);
98
-
99
- try {
100
- // --- Welcome to debugging React ---
101
- // This error was thrown as a convenience so that you can use this stack
102
- // to find the callsite that caused this warning to fire.
103
- var argIndex = 0;
104
- var message = 'Warning: ' + format.replace(/%s/g, function () {
105
- return args[argIndex++];
106
- });
107
- throw new Error(message);
108
- } catch (x) {}
109
- }
110
- }
111
-
112
- var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
113
- var _assign = ReactInternals.assign;
114
-
115
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
116
- // nor polyfill, then a plain number is used for performance.
117
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
118
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
119
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
120
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
121
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
122
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
123
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
124
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
125
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
126
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
127
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
128
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
129
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
130
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
131
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
132
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
133
-
134
- var Uninitialized = -1;
135
- var Pending = 0;
136
- var Resolved = 1;
137
- var Rejected = 2;
138
- function refineResolvedLazyComponent(lazyComponent) {
139
- return lazyComponent._status === Resolved ? lazyComponent._result : null;
140
- }
141
- function initializeLazyComponentType(lazyComponent) {
142
- if (lazyComponent._status === Uninitialized) {
143
- lazyComponent._status = Pending;
144
- var ctor = lazyComponent._ctor;
145
- var thenable = ctor();
146
- lazyComponent._result = thenable;
147
- thenable.then(function (moduleObject) {
148
- if (lazyComponent._status === Pending) {
149
- var defaultExport = moduleObject.default;
150
-
151
- {
152
- if (defaultExport === undefined) {
153
- error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + "const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
154
- }
155
- }
156
-
157
- lazyComponent._status = Resolved;
158
- lazyComponent._result = defaultExport;
159
- }
160
- }, function (error) {
161
- if (lazyComponent._status === Pending) {
162
- lazyComponent._status = Rejected;
163
- lazyComponent._result = error;
164
- }
165
- });
166
- }
167
- }
168
-
169
- function getWrappedName(outerType, innerType, wrapperName) {
170
- var functionName = innerType.displayName || innerType.name || '';
171
- return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
172
- }
173
-
174
- function getComponentName(type) {
175
- if (type == null) {
176
- // Host root, text node or just invalid type.
177
- return null;
178
- }
179
-
180
- {
181
- if (typeof type.tag === 'number') {
182
- error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
183
- }
184
- }
185
-
186
- if (typeof type === 'function') {
187
- return type.displayName || type.name || null;
188
- }
189
-
190
- if (typeof type === 'string') {
191
- return type;
192
- }
193
-
194
- switch (type) {
195
- case REACT_FRAGMENT_TYPE:
196
- return 'Fragment';
197
-
198
- case REACT_PORTAL_TYPE:
199
- return 'Portal';
200
-
201
- case REACT_PROFILER_TYPE:
202
- return "Profiler";
203
-
204
- case REACT_STRICT_MODE_TYPE:
205
- return 'StrictMode';
206
-
207
- case REACT_SUSPENSE_TYPE:
208
- return 'Suspense';
209
-
210
- case REACT_SUSPENSE_LIST_TYPE:
211
- return 'SuspenseList';
212
- }
213
-
214
- if (typeof type === 'object') {
215
- switch (type.$$typeof) {
216
- case REACT_CONTEXT_TYPE:
217
- return 'Context.Consumer';
218
-
219
- case REACT_PROVIDER_TYPE:
220
- return 'Context.Provider';
221
-
222
- case REACT_FORWARD_REF_TYPE:
223
- return getWrappedName(type, type.render, 'ForwardRef');
224
-
225
- case REACT_MEMO_TYPE:
226
- return getComponentName(type.type);
227
-
228
- case REACT_BLOCK_TYPE:
229
- return getComponentName(type.render);
230
-
231
- case REACT_LAZY_TYPE:
232
- {
233
- var thenable = type;
234
- var resolvedThenable = refineResolvedLazyComponent(thenable);
235
-
236
- if (resolvedThenable) {
237
- return getComponentName(resolvedThenable);
238
- }
239
-
240
- break;
241
- }
242
- }
243
- }
244
-
245
- return null;
246
- }
247
-
248
- var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
249
- function describeComponentFrame (name, source, ownerName) {
250
- var sourceInfo = '';
251
-
252
- if (source) {
253
- var path = source.fileName;
254
- var fileName = path.replace(BEFORE_SLASH_RE, '');
255
-
256
- {
257
- // In DEV, include code for a common special case:
258
- // prefer "folder/index.js" instead of just "index.js".
259
- if (/^index\./.test(fileName)) {
260
- var match = path.match(BEFORE_SLASH_RE);
261
-
262
- if (match) {
263
- var pathBeforeSlash = match[1];
264
-
265
- if (pathBeforeSlash) {
266
- var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
267
- fileName = folderName + '/' + fileName;
268
- }
269
- }
270
- }
271
- }
272
-
273
- sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
274
- } else if (ownerName) {
275
- sourceInfo = ' (created by ' + ownerName + ')';
276
- }
277
-
278
- return '\n in ' + (name || 'Unknown') + sourceInfo;
279
- }
280
-
281
- var enableSuspenseServerRenderer = false;
282
-
283
- var enableDeprecatedFlareAPI = false; // Experimental Host Component support.
284
-
285
- /**
286
- * Copyright (c) 2013-present, Facebook, Inc.
287
- *
288
- * This source code is licensed under the MIT license found in the
289
- * LICENSE file in the root directory of this source tree.
290
- */
291
-
292
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
293
-
294
- var ReactPropTypesSecret_1 = ReactPropTypesSecret;
295
-
296
- var printWarning$1 = function() {};
297
-
298
- {
299
- var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
300
- var loggedTypeFailures = {};
301
- var has = Function.call.bind(Object.prototype.hasOwnProperty);
302
-
303
- printWarning$1 = function(text) {
304
- var message = 'Warning: ' + text;
305
- if (typeof console !== 'undefined') {
306
- console.error(message);
307
- }
308
- try {
309
- // --- Welcome to debugging React ---
310
- // This error was thrown as a convenience so that you can use this stack
311
- // to find the callsite that caused this warning to fire.
312
- throw new Error(message);
313
- } catch (x) {}
314
- };
315
- }
316
-
317
- /**
318
- * Assert that the values match with the type specs.
319
- * Error messages are memorized and will only be shown once.
320
- *
321
- * @param {object} typeSpecs Map of name to a ReactPropType
322
- * @param {object} values Runtime values that need to be type-checked
323
- * @param {string} location e.g. "prop", "context", "child context"
324
- * @param {string} componentName Name of the component for error messages.
325
- * @param {?Function} getStack Returns the component stack.
326
- * @private
327
- */
328
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
329
- {
330
- for (var typeSpecName in typeSpecs) {
331
- if (has(typeSpecs, typeSpecName)) {
332
- var error;
333
- // Prop type validation may throw. In case they do, we don't want to
334
- // fail the render phase where it didn't fail before. So we log it.
335
- // After these have been cleaned up, we'll let them throw.
336
- try {
337
- // This is intentionally an invariant that gets caught. It's the same
338
- // behavior as without this statement except with a better message.
339
- if (typeof typeSpecs[typeSpecName] !== 'function') {
340
- var err = Error(
341
- (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
342
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
343
- );
344
- err.name = 'Invariant Violation';
345
- throw err;
346
- }
347
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
348
- } catch (ex) {
349
- error = ex;
350
- }
351
- if (error && !(error instanceof Error)) {
352
- printWarning$1(
353
- (componentName || 'React class') + ': type specification of ' +
354
- location + ' `' + typeSpecName + '` is invalid; the type checker ' +
355
- 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
356
- 'You may have forgotten to pass an argument to the type checker ' +
357
- 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
358
- 'shape all require an argument).'
359
- );
360
- }
361
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
362
- // Only monitor this failure once because there tends to be a lot of the
363
- // same error.
364
- loggedTypeFailures[error.message] = true;
365
-
366
- var stack = getStack ? getStack() : '';
367
-
368
- printWarning$1(
369
- 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
370
- );
371
- }
372
- }
373
- }
374
- }
375
- }
376
-
377
- /**
378
- * Resets warning cache when testing.
379
- *
380
- * @private
381
- */
382
- checkPropTypes.resetWarningCache = function() {
383
- {
384
- loggedTypeFailures = {};
385
- }
386
- };
387
-
388
- var checkPropTypes_1 = checkPropTypes;
389
-
390
- var ReactDebugCurrentFrame;
391
- var didWarnAboutInvalidateContextType;
392
-
393
- {
394
- ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
395
- didWarnAboutInvalidateContextType = new Set();
396
- }
397
-
398
- var emptyObject = {};
399
-
400
- {
401
- Object.freeze(emptyObject);
402
- }
403
-
404
- function maskContext(type, context) {
405
- var contextTypes = type.contextTypes;
406
-
407
- if (!contextTypes) {
408
- return emptyObject;
409
- }
410
-
411
- var maskedContext = {};
412
-
413
- for (var contextName in contextTypes) {
414
- maskedContext[contextName] = context[contextName];
415
- }
416
-
417
- return maskedContext;
418
- }
419
-
420
- function checkContextTypes(typeSpecs, values, location) {
421
- {
422
- checkPropTypes_1(typeSpecs, values, location, 'Component', ReactDebugCurrentFrame.getCurrentStack);
423
- }
424
- }
425
-
426
- function validateContextBounds(context, threadID) {
427
- // If we don't have enough slots in this context to store this threadID,
428
- // fill it in without leaving any holes to ensure that the VM optimizes
429
- // this as non-holey index properties.
430
- // (Note: If `react` package is < 16.6, _threadCount is undefined.)
431
- for (var i = context._threadCount | 0; i <= threadID; i++) {
432
- // We assume that this is the same as the defaultValue which might not be
433
- // true if we're rendering inside a secondary renderer but they are
434
- // secondary because these use cases are very rare.
435
- context[i] = context._currentValue2;
436
- context._threadCount = i + 1;
437
- }
438
- }
439
- function processContext(type, context, threadID, isClass) {
440
- if (isClass) {
441
- var contextType = type.contextType;
442
-
443
- {
444
- if ('contextType' in type) {
445
- var isValid = // Allow null for conditional declaration
446
- contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a <Context.Consumer>
447
-
448
- if (!isValid && !didWarnAboutInvalidateContextType.has(type)) {
449
- didWarnAboutInvalidateContextType.add(type);
450
- var addendum = '';
451
-
452
- if (contextType === undefined) {
453
- 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.';
454
- } else if (typeof contextType !== 'object') {
455
- addendum = ' However, it is set to a ' + typeof contextType + '.';
456
- } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) {
457
- addendum = ' Did you accidentally pass the Context.Provider instead?';
458
- } else if (contextType._context !== undefined) {
459
- // <Context.Consumer>
460
- addendum = ' Did you accidentally pass the Context.Consumer instead?';
461
- } else {
462
- addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.';
463
- }
464
-
465
- error('%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(type) || 'Component', addendum);
466
- }
467
- }
468
- }
469
-
470
- if (typeof contextType === 'object' && contextType !== null) {
471
- validateContextBounds(contextType, threadID);
472
- return contextType[threadID];
473
- }
474
-
475
- {
476
- var maskedContext = maskContext(type, context);
477
-
478
- {
479
- if (type.contextTypes) {
480
- checkContextTypes(type.contextTypes, maskedContext, 'context');
481
- }
482
- }
483
-
484
- return maskedContext;
485
- }
486
- } else {
487
- {
488
- var _maskedContext = maskContext(type, context);
489
-
490
- {
491
- if (type.contextTypes) {
492
- checkContextTypes(type.contextTypes, _maskedContext, 'context');
493
- }
494
- }
495
-
496
- return _maskedContext;
497
- }
498
- }
499
- }
500
-
501
- var nextAvailableThreadIDs = new Uint16Array(16);
502
-
503
- for (var i = 0; i < 15; i++) {
504
- nextAvailableThreadIDs[i] = i + 1;
505
- }
506
-
507
- nextAvailableThreadIDs[15] = 0;
508
-
509
- function growThreadCountAndReturnNextAvailable() {
510
- var oldArray = nextAvailableThreadIDs;
511
- var oldSize = oldArray.length;
512
- var newSize = oldSize * 2;
513
-
514
- if (!(newSize <= 0x10000)) {
515
- {
516
- throw Error( "Maximum number of concurrent React renderers exceeded. This can happen if you are not properly destroying the Readable provided by React. Ensure that you call .destroy() on it if you no longer want to read from it, and did not read to the end. If you use .pipe() this should be automatic." );
517
- }
518
- }
519
-
520
- var newArray = new Uint16Array(newSize);
521
- newArray.set(oldArray);
522
- nextAvailableThreadIDs = newArray;
523
- nextAvailableThreadIDs[0] = oldSize + 1;
524
-
525
- for (var _i = oldSize; _i < newSize - 1; _i++) {
526
- nextAvailableThreadIDs[_i] = _i + 1;
527
- }
528
-
529
- nextAvailableThreadIDs[newSize - 1] = 0;
530
- return oldSize;
531
- }
532
-
533
- function allocThreadID() {
534
- var nextID = nextAvailableThreadIDs[0];
535
-
536
- if (nextID === 0) {
537
- return growThreadCountAndReturnNextAvailable();
538
- }
539
-
540
- nextAvailableThreadIDs[0] = nextAvailableThreadIDs[nextID];
541
- return nextID;
542
- }
543
- function freeThreadID(id) {
544
- nextAvailableThreadIDs[id] = nextAvailableThreadIDs[0];
545
- nextAvailableThreadIDs[0] = id;
546
- }
547
-
548
- // A reserved attribute.
549
- // It is handled by React separately and shouldn't be written to the DOM.
550
- var RESERVED = 0; // A simple string attribute.
551
- // Attributes that aren't in the whitelist are presumed to have this type.
552
-
553
- var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called
554
- // "enumerated" attributes with "true" and "false" as possible values.
555
- // When true, it should be set to a "true" string.
556
- // When false, it should be set to a "false" string.
557
-
558
- var BOOLEANISH_STRING = 2; // A real boolean attribute.
559
- // When true, it should be present (set either to an empty string or its name).
560
- // When false, it should be omitted.
561
-
562
- var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value.
563
- // When true, it should be present (set either to an empty string or its name).
564
- // When false, it should be omitted.
565
- // For any other value, should be present with that value.
566
-
567
- var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric.
568
- // When falsy, it should be removed.
569
-
570
- var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
571
- // When falsy, it should be removed.
572
-
573
- var POSITIVE_NUMERIC = 6;
574
-
575
- /* eslint-disable max-len */
576
- 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";
577
- /* eslint-enable max-len */
578
-
579
- var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
580
- var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
581
- var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
582
- var hasOwnProperty = Object.prototype.hasOwnProperty;
583
- var illegalAttributeNameCache = {};
584
- var validatedAttributeNameCache = {};
585
- function isAttributeNameSafe(attributeName) {
586
- if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) {
587
- return true;
588
- }
589
-
590
- if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) {
591
- return false;
592
- }
593
-
594
- if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
595
- validatedAttributeNameCache[attributeName] = true;
596
- return true;
597
- }
598
-
599
- illegalAttributeNameCache[attributeName] = true;
600
-
601
- {
602
- error('Invalid attribute name: `%s`', attributeName);
603
- }
604
-
605
- return false;
606
- }
607
- function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
608
- if (propertyInfo !== null) {
609
- return propertyInfo.type === RESERVED;
610
- }
611
-
612
- if (isCustomComponentTag) {
613
- return false;
614
- }
615
-
616
- if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
617
- return true;
618
- }
619
-
620
- return false;
621
- }
622
- function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
623
- if (propertyInfo !== null && propertyInfo.type === RESERVED) {
624
- return false;
625
- }
626
-
627
- switch (typeof value) {
628
- case 'function': // $FlowIssue symbol is perfectly valid here
629
-
630
- case 'symbol':
631
- // eslint-disable-line
632
- return true;
633
-
634
- case 'boolean':
635
- {
636
- if (isCustomComponentTag) {
637
- return false;
638
- }
639
-
640
- if (propertyInfo !== null) {
641
- return !propertyInfo.acceptsBooleans;
642
- } else {
643
- var prefix = name.toLowerCase().slice(0, 5);
644
- return prefix !== 'data-' && prefix !== 'aria-';
645
- }
646
- }
647
-
648
- default:
649
- return false;
650
- }
651
- }
652
- function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
653
- if (value === null || typeof value === 'undefined') {
654
- return true;
655
- }
656
-
657
- if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
658
- return true;
659
- }
660
-
661
- if (isCustomComponentTag) {
662
- return false;
663
- }
664
-
665
- if (propertyInfo !== null) {
666
- switch (propertyInfo.type) {
667
- case BOOLEAN:
668
- return !value;
669
-
670
- case OVERLOADED_BOOLEAN:
671
- return value === false;
672
-
673
- case NUMERIC:
674
- return isNaN(value);
675
-
676
- case POSITIVE_NUMERIC:
677
- return isNaN(value) || value < 1;
678
- }
679
- }
680
-
681
- return false;
682
- }
683
- function getPropertyInfo(name) {
684
- return properties.hasOwnProperty(name) ? properties[name] : null;
685
- }
686
-
687
- function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) {
688
- this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
689
- this.attributeName = attributeName;
690
- this.attributeNamespace = attributeNamespace;
691
- this.mustUseProperty = mustUseProperty;
692
- this.propertyName = name;
693
- this.type = type;
694
- this.sanitizeURL = sanitizeURL;
695
- } // When adding attributes to this list, be sure to also add them to
696
- // the `possibleStandardNames` module to ensure casing and incorrect
697
- // name warnings.
698
-
699
-
700
- var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM.
701
-
702
- var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular
703
- // elements (not just inputs). Now that ReactDOMInput assigns to the
704
- // defaultValue property -- do we need this?
705
- 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'];
706
-
707
- reservedProps.forEach(function (name) {
708
- properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty
709
- name, // attributeName
710
- null, // attributeNamespace
711
- false);
712
- }); // A few React string attributes have a different name.
713
- // This is a mapping from React prop names to the attribute names.
714
-
715
- [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
716
- var name = _ref[0],
717
- attributeName = _ref[1];
718
- properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
719
- attributeName, // attributeName
720
- null, // attributeNamespace
721
- false);
722
- }); // These are "enumerated" HTML attributes that accept "true" and "false".
723
- // In React, we let users pass `true` and `false` even though technically
724
- // these aren't boolean attributes (they are coerced to strings).
725
-
726
- ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
727
- properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
728
- name.toLowerCase(), // attributeName
729
- null, // attributeNamespace
730
- false);
731
- }); // These are "enumerated" SVG attributes that accept "true" and "false".
732
- // In React, we let users pass `true` and `false` even though technically
733
- // these aren't boolean attributes (they are coerced to strings).
734
- // Since these are SVG attributes, their attribute names are case-sensitive.
735
-
736
- ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) {
737
- properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty
738
- name, // attributeName
739
- null, // attributeNamespace
740
- false);
741
- }); // These are HTML boolean attributes.
742
-
743
- ['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM
744
- // on the client side because the browsers are inconsistent. Instead we call focus().
745
- 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata
746
- 'itemScope'].forEach(function (name) {
747
- properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty
748
- name.toLowerCase(), // attributeName
749
- null, // attributeNamespace
750
- false);
751
- }); // These are the few React props that we set as DOM properties
752
- // rather than attributes. These are all booleans.
753
-
754
- ['checked', // Note: `option.selected` is not updated if `select.multiple` is
755
- // disabled with `removeAttribute`. We have special logic for handling this.
756
- 'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list,
757
- // you'll need to set attributeName to name.toLowerCase()
758
- // instead in the assignment below.
759
- ].forEach(function (name) {
760
- properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty
761
- name, // attributeName
762
- null, // attributeNamespace
763
- false);
764
- }); // These are HTML attributes that are "overloaded booleans": they behave like
765
- // booleans, but can also accept a string value.
766
-
767
- ['capture', 'download' // NOTE: if you add a camelCased prop to this list,
768
- // you'll need to set attributeName to name.toLowerCase()
769
- // instead in the assignment below.
770
- ].forEach(function (name) {
771
- properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty
772
- name, // attributeName
773
- null, // attributeNamespace
774
- false);
775
- }); // These are HTML attributes that must be positive numbers.
776
-
777
- ['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list,
778
- // you'll need to set attributeName to name.toLowerCase()
779
- // instead in the assignment below.
780
- ].forEach(function (name) {
781
- properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty
782
- name, // attributeName
783
- null, // attributeNamespace
784
- false);
785
- }); // These are HTML attributes that must be numbers.
786
-
787
- ['rowSpan', 'start'].forEach(function (name) {
788
- properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty
789
- name.toLowerCase(), // attributeName
790
- null, // attributeNamespace
791
- false);
792
- });
793
- var CAMELIZE = /[\-\:]([a-z])/g;
794
-
795
- var capitalize = function (token) {
796
- return token[1].toUpperCase();
797
- }; // This is a list of all SVG attributes that need special casing, namespacing,
798
- // or boolean value assignment. Regular attributes that just accept strings
799
- // and have the same names are omitted, just like in the HTML whitelist.
800
- // Some of these attributes can be hard to find. This list was created by
801
- // scraping the MDN documentation.
802
-
803
-
804
- ['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' // NOTE: if you add a camelCased prop to this list,
805
- // you'll need to set attributeName to name.toLowerCase()
806
- // instead in the assignment below.
807
- ].forEach(function (attributeName) {
808
- var name = attributeName.replace(CAMELIZE, capitalize);
809
- properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
810
- attributeName, null, // attributeNamespace
811
- false);
812
- }); // String SVG attributes with the xlink namespace.
813
-
814
- ['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list,
815
- // you'll need to set attributeName to name.toLowerCase()
816
- // instead in the assignment below.
817
- ].forEach(function (attributeName) {
818
- var name = attributeName.replace(CAMELIZE, capitalize);
819
- properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
820
- attributeName, 'http://www.w3.org/1999/xlink', false);
821
- }); // String SVG attributes with the xml namespace.
822
-
823
- ['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list,
824
- // you'll need to set attributeName to name.toLowerCase()
825
- // instead in the assignment below.
826
- ].forEach(function (attributeName) {
827
- var name = attributeName.replace(CAMELIZE, capitalize);
828
- properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty
829
- attributeName, 'http://www.w3.org/XML/1998/namespace', false);
830
- }); // These attribute exists both in HTML and SVG.
831
- // The attribute name is case-sensitive in SVG so we can't just use
832
- // the React name like we do for attributes that exist only in HTML.
833
-
834
- ['tabIndex', 'crossOrigin'].forEach(function (attributeName) {
835
- properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
836
- attributeName.toLowerCase(), // attributeName
837
- null, // attributeNamespace
838
- false);
839
- }); // These attributes accept URLs. These must not allow javascript: URLS.
840
- // These will also need to accept Trusted Types object in the future.
841
-
842
- var xlinkHref = 'xlinkHref';
843
- properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty
844
- 'xlink:href', 'http://www.w3.org/1999/xlink', true);
845
- ['src', 'href', 'action', 'formAction'].forEach(function (attributeName) {
846
- properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty
847
- attributeName.toLowerCase(), // attributeName
848
- null, // attributeNamespace
849
- true);
850
- });
851
-
852
- var ReactDebugCurrentFrame$1 = null;
853
-
854
- {
855
- ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
856
- } // A javascript: URL can contain leading C0 control or \u0020 SPACE,
857
- // and any newline or tab are filtered out as if they're not part of the URL.
858
- // https://url.spec.whatwg.org/#url-parsing
859
- // Tab or newline are defined as \r\n\t:
860
- // https://infra.spec.whatwg.org/#ascii-tab-or-newline
861
- // A C0 control is a code point in the range \u0000 NULL to \u001F
862
- // INFORMATION SEPARATOR ONE, inclusive:
863
- // https://infra.spec.whatwg.org/#c0-control-or-space
864
-
865
- /* eslint-disable max-len */
866
-
867
-
868
- 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;
869
- var didWarn = false;
870
-
871
- function sanitizeURL(url) {
872
- {
873
- if (!didWarn && isJavaScriptProtocol.test(url)) {
874
- didWarn = true;
875
-
876
- 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));
877
- }
878
- }
879
- }
880
-
881
- // code copied and modified from escape-html
882
-
883
- /**
884
- * Module variables.
885
- * @private
886
- */
887
- var matchHtmlRegExp = /["'&<>]/;
888
- /**
889
- * Escapes special characters and HTML entities in a given html string.
890
- *
891
- * @param {string} string HTML string to escape for later insertion
892
- * @return {string}
893
- * @public
894
- */
895
-
896
- function escapeHtml(string) {
897
- var str = '' + string;
898
- var match = matchHtmlRegExp.exec(str);
899
-
900
- if (!match) {
901
- return str;
902
- }
903
-
904
- var escape;
905
- var html = '';
906
- var index;
907
- var lastIndex = 0;
908
-
909
- for (index = match.index; index < str.length; index++) {
910
- switch (str.charCodeAt(index)) {
911
- case 34:
912
- // "
913
- escape = '&quot;';
914
- break;
915
-
916
- case 38:
917
- // &
918
- escape = '&amp;';
919
- break;
920
-
921
- case 39:
922
- // '
923
- escape = '&#x27;'; // modified from escape-html; used to be '&#39'
924
-
925
- break;
926
-
927
- case 60:
928
- // <
929
- escape = '&lt;';
930
- break;
931
-
932
- case 62:
933
- // >
934
- escape = '&gt;';
935
- break;
936
-
937
- default:
938
- continue;
939
- }
940
-
941
- if (lastIndex !== index) {
942
- html += str.substring(lastIndex, index);
943
- }
944
-
945
- lastIndex = index + 1;
946
- html += escape;
947
- }
948
-
949
- return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
950
- } // end code copied and modified from escape-html
951
-
952
- /**
953
- * Escapes text to prevent scripting attacks.
954
- *
955
- * @param {*} text Text value to escape.
956
- * @return {string} An escaped string.
957
- */
958
-
959
-
960
- function escapeTextForBrowser(text) {
961
- if (typeof text === 'boolean' || typeof text === 'number') {
962
- // this shortcircuit helps perf for types that we know will never have
963
- // special characters, especially given that this function is used often
964
- // for numeric dom ids.
965
- return '' + text;
966
- }
967
-
968
- return escapeHtml(text);
969
- }
970
-
971
- /**
972
- * Escapes attribute value to prevent scripting attacks.
973
- *
974
- * @param {*} value Value to escape.
975
- * @return {string} An escaped string.
976
- */
977
-
978
- function quoteAttributeValueForBrowser(value) {
979
- return '"' + escapeTextForBrowser(value) + '"';
980
- }
981
-
982
- function createMarkupForRoot() {
983
- return ROOT_ATTRIBUTE_NAME + '=""';
984
- }
985
- /**
986
- * Creates markup for a property.
987
- *
988
- * @param {string} name
989
- * @param {*} value
990
- * @return {?string} Markup string, or null if the property was invalid.
991
- */
992
-
993
- function createMarkupForProperty(name, value) {
994
- var propertyInfo = getPropertyInfo(name);
995
-
996
- if (name !== 'style' && shouldIgnoreAttribute(name, propertyInfo, false)) {
997
- return '';
998
- }
999
-
1000
- if (shouldRemoveAttribute(name, value, propertyInfo, false)) {
1001
- return '';
1002
- }
1003
-
1004
- if (propertyInfo !== null) {
1005
- var attributeName = propertyInfo.attributeName;
1006
- var type = propertyInfo.type;
1007
-
1008
- if (type === BOOLEAN || type === OVERLOADED_BOOLEAN && value === true) {
1009
- return attributeName + '=""';
1010
- } else {
1011
- if (propertyInfo.sanitizeURL) {
1012
- value = '' + value;
1013
- sanitizeURL(value);
1014
- }
1015
-
1016
- return attributeName + '=' + quoteAttributeValueForBrowser(value);
1017
- }
1018
- } else if (isAttributeNameSafe(name)) {
1019
- return name + '=' + quoteAttributeValueForBrowser(value);
1020
- }
1021
-
1022
- return '';
1023
- }
1024
- /**
1025
- * Creates markup for a custom property.
1026
- *
1027
- * @param {string} name
1028
- * @param {*} value
1029
- * @return {string} Markup string, or empty string if the property was invalid.
1030
- */
1031
-
1032
- function createMarkupForCustomAttribute(name, value) {
1033
- if (!isAttributeNameSafe(name) || value == null) {
1034
- return '';
1035
- }
1036
-
1037
- return name + '=' + quoteAttributeValueForBrowser(value);
1038
- }
1039
-
1040
- /**
1041
- * inlined Object.is polyfill to avoid requiring consumers ship their own
1042
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
1043
- */
1044
- function is(x, y) {
1045
- return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
1046
- ;
1047
- }
1048
-
1049
- var objectIs = typeof Object.is === 'function' ? Object.is : is;
1050
-
1051
- var currentlyRenderingComponent = null;
1052
- var firstWorkInProgressHook = null;
1053
- var workInProgressHook = null; // Whether the work-in-progress hook is a re-rendered hook
1054
-
1055
- var isReRender = false; // Whether an update was scheduled during the currently executing render pass.
1056
-
1057
- var didScheduleRenderPhaseUpdate = false; // Lazily created map of render-phase updates
1058
-
1059
- var renderPhaseUpdates = null; // Counter to prevent infinite loops.
1060
-
1061
- var numberOfReRenders = 0;
1062
- var RE_RENDER_LIMIT = 25;
1063
- var isInHookUserCodeInDev = false; // In DEV, this is the name of the currently executing primitive hook
1064
-
1065
- var currentHookNameInDev;
1066
-
1067
- function resolveCurrentlyRenderingComponent() {
1068
- if (!(currentlyRenderingComponent !== null)) {
1069
- {
1070
- throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." );
1071
- }
1072
- }
1073
-
1074
- {
1075
- if (isInHookUserCodeInDev) {
1076
- 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://fb.me/rules-of-hooks');
1077
- }
1078
- }
1079
-
1080
- return currentlyRenderingComponent;
1081
- }
1082
-
1083
- function areHookInputsEqual(nextDeps, prevDeps) {
1084
- if (prevDeps === null) {
1085
- {
1086
- 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);
1087
- }
1088
-
1089
- return false;
1090
- }
1091
-
1092
- {
1093
- // Don't bother comparing lengths in prod because these arrays should be
1094
- // passed inline.
1095
- if (nextDeps.length !== prevDeps.length) {
1096
- 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(', ') + "]");
1097
- }
1098
- }
1099
-
1100
- for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
1101
- if (objectIs(nextDeps[i], prevDeps[i])) {
1102
- continue;
1103
- }
1104
-
1105
- return false;
1106
- }
1107
-
1108
- return true;
1109
- }
1110
-
1111
- function createHook() {
1112
- if (numberOfReRenders > 0) {
1113
- {
1114
- {
1115
- throw Error( "Rendered more hooks than during the previous render" );
1116
- }
1117
- }
1118
- }
1119
-
1120
- return {
1121
- memoizedState: null,
1122
- queue: null,
1123
- next: null
1124
- };
1125
- }
1126
-
1127
- function createWorkInProgressHook() {
1128
- if (workInProgressHook === null) {
1129
- // This is the first hook in the list
1130
- if (firstWorkInProgressHook === null) {
1131
- isReRender = false;
1132
- firstWorkInProgressHook = workInProgressHook = createHook();
1133
- } else {
1134
- // There's already a work-in-progress. Reuse it.
1135
- isReRender = true;
1136
- workInProgressHook = firstWorkInProgressHook;
1137
- }
1138
- } else {
1139
- if (workInProgressHook.next === null) {
1140
- isReRender = false; // Append to the end of the list
1141
-
1142
- workInProgressHook = workInProgressHook.next = createHook();
1143
- } else {
1144
- // There's already a work-in-progress. Reuse it.
1145
- isReRender = true;
1146
- workInProgressHook = workInProgressHook.next;
1147
- }
1148
- }
1149
-
1150
- return workInProgressHook;
1151
- }
1152
-
1153
- function prepareToUseHooks(componentIdentity) {
1154
- currentlyRenderingComponent = componentIdentity;
1155
-
1156
- {
1157
- isInHookUserCodeInDev = false;
1158
- } // The following should have already been reset
1159
- // didScheduleRenderPhaseUpdate = false;
1160
- // firstWorkInProgressHook = null;
1161
- // numberOfReRenders = 0;
1162
- // renderPhaseUpdates = null;
1163
- // workInProgressHook = null;
1164
-
1165
- }
1166
- function finishHooks(Component, props, children, refOrContext) {
1167
- // This must be called after every function component to prevent hooks from
1168
- // being used in classes.
1169
- while (didScheduleRenderPhaseUpdate) {
1170
- // Updates were scheduled during the render phase. They are stored in
1171
- // the `renderPhaseUpdates` map. Call the component again, reusing the
1172
- // work-in-progress hooks and applying the additional updates on top. Keep
1173
- // restarting until no more updates are scheduled.
1174
- didScheduleRenderPhaseUpdate = false;
1175
- numberOfReRenders += 1; // Start over from the beginning of the list
1176
-
1177
- workInProgressHook = null;
1178
- children = Component(props, refOrContext);
1179
- }
1180
-
1181
- currentlyRenderingComponent = null;
1182
- firstWorkInProgressHook = null;
1183
- numberOfReRenders = 0;
1184
- renderPhaseUpdates = null;
1185
- workInProgressHook = null;
1186
-
1187
- {
1188
- isInHookUserCodeInDev = false;
1189
- } // These were reset above
1190
- // currentlyRenderingComponent = null;
1191
- // didScheduleRenderPhaseUpdate = false;
1192
- // firstWorkInProgressHook = null;
1193
- // numberOfReRenders = 0;
1194
- // renderPhaseUpdates = null;
1195
- // workInProgressHook = null;
1196
-
1197
-
1198
- return children;
1199
- }
1200
-
1201
- function readContext(context, observedBits) {
1202
- var threadID = currentThreadID;
1203
- validateContextBounds(context, threadID);
1204
-
1205
- {
1206
- if (isInHookUserCodeInDev) {
1207
- 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().');
1208
- }
1209
- }
1210
-
1211
- return context[threadID];
1212
- }
1213
-
1214
- function useContext(context, observedBits) {
1215
- {
1216
- currentHookNameInDev = 'useContext';
1217
- }
1218
-
1219
- resolveCurrentlyRenderingComponent();
1220
- var threadID = currentThreadID;
1221
- validateContextBounds(context, threadID);
1222
- return context[threadID];
1223
- }
1224
-
1225
- function basicStateReducer(state, action) {
1226
- // $FlowFixMe: Flow doesn't like mixed types
1227
- return typeof action === 'function' ? action(state) : action;
1228
- }
1229
-
1230
- function useState(initialState) {
1231
- {
1232
- currentHookNameInDev = 'useState';
1233
- }
1234
-
1235
- return useReducer(basicStateReducer, // useReducer has a special case to support lazy useState initializers
1236
- initialState);
1237
- }
1238
- function useReducer(reducer, initialArg, init) {
1239
- {
1240
- if (reducer !== basicStateReducer) {
1241
- currentHookNameInDev = 'useReducer';
1242
- }
1243
- }
1244
-
1245
- currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
1246
- workInProgressHook = createWorkInProgressHook();
1247
-
1248
- if (isReRender) {
1249
- // This is a re-render. Apply the new render phase updates to the previous
1250
- // current hook.
1251
- var queue = workInProgressHook.queue;
1252
- var dispatch = queue.dispatch;
1253
-
1254
- if (renderPhaseUpdates !== null) {
1255
- // Render phase updates are stored in a map of queue -> linked list
1256
- var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
1257
-
1258
- if (firstRenderPhaseUpdate !== undefined) {
1259
- renderPhaseUpdates.delete(queue);
1260
- var newState = workInProgressHook.memoizedState;
1261
- var update = firstRenderPhaseUpdate;
1262
-
1263
- do {
1264
- // Process this render phase update. We don't have to check the
1265
- // priority because it will always be the same as the current
1266
- // render's.
1267
- var action = update.action;
1268
-
1269
- {
1270
- isInHookUserCodeInDev = true;
1271
- }
1272
-
1273
- newState = reducer(newState, action);
1274
-
1275
- {
1276
- isInHookUserCodeInDev = false;
1277
- }
1278
-
1279
- update = update.next;
1280
- } while (update !== null);
1281
-
1282
- workInProgressHook.memoizedState = newState;
1283
- return [newState, dispatch];
1284
- }
1285
- }
1286
-
1287
- return [workInProgressHook.memoizedState, dispatch];
1288
- } else {
1289
- {
1290
- isInHookUserCodeInDev = true;
1291
- }
1292
-
1293
- var initialState;
1294
-
1295
- if (reducer === basicStateReducer) {
1296
- // Special case for `useState`.
1297
- initialState = typeof initialArg === 'function' ? initialArg() : initialArg;
1298
- } else {
1299
- initialState = init !== undefined ? init(initialArg) : initialArg;
1300
- }
1301
-
1302
- {
1303
- isInHookUserCodeInDev = false;
1304
- }
1305
-
1306
- workInProgressHook.memoizedState = initialState;
1307
-
1308
- var _queue = workInProgressHook.queue = {
1309
- last: null,
1310
- dispatch: null
1311
- };
1312
-
1313
- var _dispatch = _queue.dispatch = dispatchAction.bind(null, currentlyRenderingComponent, _queue);
1314
-
1315
- return [workInProgressHook.memoizedState, _dispatch];
1316
- }
1317
- }
1318
-
1319
- function useMemo(nextCreate, deps) {
1320
- currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
1321
- workInProgressHook = createWorkInProgressHook();
1322
- var nextDeps = deps === undefined ? null : deps;
1323
-
1324
- if (workInProgressHook !== null) {
1325
- var prevState = workInProgressHook.memoizedState;
1326
-
1327
- if (prevState !== null) {
1328
- if (nextDeps !== null) {
1329
- var prevDeps = prevState[1];
1330
-
1331
- if (areHookInputsEqual(nextDeps, prevDeps)) {
1332
- return prevState[0];
1333
- }
1334
- }
1335
- }
1336
- }
1337
-
1338
- {
1339
- isInHookUserCodeInDev = true;
1340
- }
1341
-
1342
- var nextValue = nextCreate();
1343
-
1344
- {
1345
- isInHookUserCodeInDev = false;
1346
- }
1347
-
1348
- workInProgressHook.memoizedState = [nextValue, nextDeps];
1349
- return nextValue;
1350
- }
1351
-
1352
- function useRef(initialValue) {
1353
- currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
1354
- workInProgressHook = createWorkInProgressHook();
1355
- var previousRef = workInProgressHook.memoizedState;
1356
-
1357
- if (previousRef === null) {
1358
- var ref = {
1359
- current: initialValue
1360
- };
1361
-
1362
- {
1363
- Object.seal(ref);
1364
- }
1365
-
1366
- workInProgressHook.memoizedState = ref;
1367
- return ref;
1368
- } else {
1369
- return previousRef;
1370
- }
1371
- }
1372
-
1373
- function useLayoutEffect(create, inputs) {
1374
- {
1375
- currentHookNameInDev = 'useLayoutEffect';
1376
-
1377
- 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://fb.me/react-uselayouteffect-ssr for common fixes.');
1378
- }
1379
- }
1380
-
1381
- function dispatchAction(componentIdentity, queue, action) {
1382
- if (!(numberOfReRenders < RE_RENDER_LIMIT)) {
1383
- {
1384
- throw Error( "Too many re-renders. React limits the number of renders to prevent an infinite loop." );
1385
- }
1386
- }
1387
-
1388
- if (componentIdentity === currentlyRenderingComponent) {
1389
- // This is a render phase update. Stash it in a lazily-created map of
1390
- // queue -> linked list of updates. After this render pass, we'll restart
1391
- // and apply the stashed updates on top of the work-in-progress hook.
1392
- didScheduleRenderPhaseUpdate = true;
1393
- var update = {
1394
- action: action,
1395
- next: null
1396
- };
1397
-
1398
- if (renderPhaseUpdates === null) {
1399
- renderPhaseUpdates = new Map();
1400
- }
1401
-
1402
- var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
1403
-
1404
- if (firstRenderPhaseUpdate === undefined) {
1405
- renderPhaseUpdates.set(queue, update);
1406
- } else {
1407
- // Append the update to the end of the list.
1408
- var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
1409
-
1410
- while (lastRenderPhaseUpdate.next !== null) {
1411
- lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
1412
- }
1413
-
1414
- lastRenderPhaseUpdate.next = update;
1415
- }
1416
- }
1417
- }
1418
-
1419
- function useCallback(callback, deps) {
1420
- // Callbacks are passed as they are in the server environment.
1421
- return callback;
1422
- }
1423
-
1424
- function useResponder(responder, props) {
1425
- return {
1426
- props: props,
1427
- responder: responder
1428
- };
1429
- }
1430
-
1431
- function useDeferredValue(value, config) {
1432
- resolveCurrentlyRenderingComponent();
1433
- return value;
1434
- }
1435
-
1436
- function useTransition(config) {
1437
- resolveCurrentlyRenderingComponent();
1438
-
1439
- var startTransition = function (callback) {
1440
- callback();
1441
- };
1442
-
1443
- return [startTransition, false];
1444
- }
1445
-
1446
- function noop() {}
1447
-
1448
- var currentThreadID = 0;
1449
- function setCurrentThreadID(threadID) {
1450
- currentThreadID = threadID;
1451
- }
1452
- var Dispatcher = {
1453
- readContext: readContext,
1454
- useContext: useContext,
1455
- useMemo: useMemo,
1456
- useReducer: useReducer,
1457
- useRef: useRef,
1458
- useState: useState,
1459
- useLayoutEffect: useLayoutEffect,
1460
- useCallback: useCallback,
1461
- // useImperativeHandle is not run in the server environment
1462
- useImperativeHandle: noop,
1463
- // Effects are not run in the server environment.
1464
- useEffect: noop,
1465
- // Debugging effect
1466
- useDebugValue: noop,
1467
- useResponder: useResponder,
1468
- useDeferredValue: useDeferredValue,
1469
- useTransition: useTransition
1470
- };
1471
-
1472
- var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
1473
- var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
1474
- var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
1475
- var Namespaces = {
1476
- html: HTML_NAMESPACE,
1477
- mathml: MATH_NAMESPACE,
1478
- svg: SVG_NAMESPACE
1479
- }; // Assumes there is no parent namespace.
1480
-
1481
- function getIntrinsicNamespace(type) {
1482
- switch (type) {
1483
- case 'svg':
1484
- return SVG_NAMESPACE;
1485
-
1486
- case 'math':
1487
- return MATH_NAMESPACE;
1488
-
1489
- default:
1490
- return HTML_NAMESPACE;
1491
- }
1492
- }
1493
- function getChildNamespace(parentNamespace, type) {
1494
- if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) {
1495
- // No (or default) parent namespace: potential entry point.
1496
- return getIntrinsicNamespace(type);
1497
- }
1498
-
1499
- if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
1500
- // We're leaving SVG.
1501
- return HTML_NAMESPACE;
1502
- } // By default, pass namespace below.
1503
-
1504
-
1505
- return parentNamespace;
1506
- }
1507
-
1508
- var ReactDebugCurrentFrame$2 = null;
1509
- var ReactControlledValuePropTypes = {
1510
- checkPropTypes: null
1511
- };
1512
-
1513
- {
1514
- ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
1515
- var hasReadOnlyValue = {
1516
- button: true,
1517
- checkbox: true,
1518
- image: true,
1519
- hidden: true,
1520
- radio: true,
1521
- reset: true,
1522
- submit: true
1523
- };
1524
- var propTypes = {
1525
- value: function (props, propName, componentName) {
1526
- if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) {
1527
- return null;
1528
- }
1529
-
1530
- return new 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`.');
1531
- },
1532
- checked: function (props, propName, componentName) {
1533
- if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableDeprecatedFlareAPI ) {
1534
- return null;
1535
- }
1536
-
1537
- return new 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`.');
1538
- }
1539
- };
1540
- /**
1541
- * Provide a linked `value` attribute for controlled forms. You should not use
1542
- * this outside of the ReactDOM controlled form components.
1543
- */
1544
-
1545
- ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) {
1546
- checkPropTypes_1(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$2.getStackAddendum);
1547
- };
1548
- }
1549
-
1550
- // For HTML, certain tags should omit their close tag. We keep a whitelist for
1551
- // those special-case tags.
1552
- var omittedCloseTags = {
1553
- area: true,
1554
- base: true,
1555
- br: true,
1556
- col: true,
1557
- embed: true,
1558
- hr: true,
1559
- img: true,
1560
- input: true,
1561
- keygen: true,
1562
- link: true,
1563
- meta: true,
1564
- param: true,
1565
- source: true,
1566
- track: true,
1567
- wbr: true // NOTE: menuitem's close tag should be omitted, but that causes problems.
1568
-
1569
- };
1570
-
1571
- // `omittedCloseTags` except that `menuitem` should still have its closing tag.
1572
-
1573
- var voidElementTags = _assign({
1574
- menuitem: true
1575
- }, omittedCloseTags);
1576
-
1577
- var HTML = '__html';
1578
- var ReactDebugCurrentFrame$3 = null;
1579
-
1580
- {
1581
- ReactDebugCurrentFrame$3 = ReactSharedInternals.ReactDebugCurrentFrame;
1582
- }
1583
-
1584
- function assertValidProps(tag, props) {
1585
- if (!props) {
1586
- return;
1587
- } // Note the use of `==` which checks for null or undefined.
1588
-
1589
-
1590
- if (voidElementTags[tag]) {
1591
- if (!(props.children == null && props.dangerouslySetInnerHTML == null)) {
1592
- {
1593
- throw Error( tag + " is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`." + ( ReactDebugCurrentFrame$3.getStackAddendum() ) );
1594
- }
1595
- }
1596
- }
1597
-
1598
- if (props.dangerouslySetInnerHTML != null) {
1599
- if (!(props.children == null)) {
1600
- {
1601
- throw Error( "Can only set one of `children` or `props.dangerouslySetInnerHTML`." );
1602
- }
1603
- }
1604
-
1605
- if (!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML)) {
1606
- {
1607
- throw Error( "`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information." );
1608
- }
1609
- }
1610
- }
1611
-
1612
- {
1613
- if (!props.suppressContentEditableWarning && props.contentEditable && props.children != null) {
1614
- 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.');
1615
- }
1616
- }
1617
-
1618
- if (!(props.style == null || typeof props.style === 'object')) {
1619
- {
1620
- throw Error( "The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX." + ( ReactDebugCurrentFrame$3.getStackAddendum() ) );
1621
- }
1622
- }
1623
- }
1624
-
1625
- /**
1626
- * CSS properties which accept numbers but are not in units of "px".
1627
- */
1628
- var isUnitlessNumber = {
1629
- animationIterationCount: true,
1630
- borderImageOutset: true,
1631
- borderImageSlice: true,
1632
- borderImageWidth: true,
1633
- boxFlex: true,
1634
- boxFlexGroup: true,
1635
- boxOrdinalGroup: true,
1636
- columnCount: true,
1637
- columns: true,
1638
- flex: true,
1639
- flexGrow: true,
1640
- flexPositive: true,
1641
- flexShrink: true,
1642
- flexNegative: true,
1643
- flexOrder: true,
1644
- gridArea: true,
1645
- gridRow: true,
1646
- gridRowEnd: true,
1647
- gridRowSpan: true,
1648
- gridRowStart: true,
1649
- gridColumn: true,
1650
- gridColumnEnd: true,
1651
- gridColumnSpan: true,
1652
- gridColumnStart: true,
1653
- fontWeight: true,
1654
- lineClamp: true,
1655
- lineHeight: true,
1656
- opacity: true,
1657
- order: true,
1658
- orphans: true,
1659
- tabSize: true,
1660
- widows: true,
1661
- zIndex: true,
1662
- zoom: true,
1663
- // SVG-related properties
1664
- fillOpacity: true,
1665
- floodOpacity: true,
1666
- stopOpacity: true,
1667
- strokeDasharray: true,
1668
- strokeDashoffset: true,
1669
- strokeMiterlimit: true,
1670
- strokeOpacity: true,
1671
- strokeWidth: true
1672
- };
1673
- /**
1674
- * @param {string} prefix vendor-specific prefix, eg: Webkit
1675
- * @param {string} key style name, eg: transitionDuration
1676
- * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
1677
- * WebkitTransitionDuration
1678
- */
1679
-
1680
- function prefixKey(prefix, key) {
1681
- return prefix + key.charAt(0).toUpperCase() + key.substring(1);
1682
- }
1683
- /**
1684
- * Support style names that may come passed in prefixed by adding permutations
1685
- * of vendor prefixes.
1686
- */
1687
-
1688
-
1689
- var prefixes = ['Webkit', 'ms', 'Moz', 'O']; // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
1690
- // infinite loop, because it iterates over the newly added props too.
1691
-
1692
- Object.keys(isUnitlessNumber).forEach(function (prop) {
1693
- prefixes.forEach(function (prefix) {
1694
- isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
1695
- });
1696
- });
1697
-
1698
- /**
1699
- * Convert a value into the proper css writable value. The style name `name`
1700
- * should be logical (no hyphens), as specified
1701
- * in `CSSProperty.isUnitlessNumber`.
1702
- *
1703
- * @param {string} name CSS property name such as `topMargin`.
1704
- * @param {*} value CSS property value such as `10px`.
1705
- * @return {string} Normalized style value with dimensions applied.
1706
- */
1707
-
1708
- function dangerousStyleValue(name, value, isCustomProperty) {
1709
- // Note that we've removed escapeTextForBrowser() calls here since the
1710
- // whole string will be escaped when the attribute is injected into
1711
- // the markup. If you provide unsafe user data here they can inject
1712
- // arbitrary CSS which may be problematic (I couldn't repro this):
1713
- // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
1714
- // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
1715
- // This is not an XSS hole but instead a potential CSS injection issue
1716
- // which has lead to a greater discussion about how we're going to
1717
- // trust URLs moving forward. See #2115901
1718
- var isEmpty = value == null || typeof value === 'boolean' || value === '';
1719
-
1720
- if (isEmpty) {
1721
- return '';
1722
- }
1723
-
1724
- if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
1725
- return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
1726
- }
1727
-
1728
- return ('' + value).trim();
1729
- }
1730
-
1731
- var uppercasePattern = /([A-Z])/g;
1732
- var msPattern = /^ms-/;
1733
- /**
1734
- * Hyphenates a camelcased CSS property name, for example:
1735
- *
1736
- * > hyphenateStyleName('backgroundColor')
1737
- * < "background-color"
1738
- * > hyphenateStyleName('MozTransition')
1739
- * < "-moz-transition"
1740
- * > hyphenateStyleName('msTransition')
1741
- * < "-ms-transition"
1742
- *
1743
- * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
1744
- * is converted to `-ms-`.
1745
- */
1746
-
1747
- function hyphenateStyleName(name) {
1748
- return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
1749
- }
1750
-
1751
- function isCustomComponent(tagName, props) {
1752
- if (tagName.indexOf('-') === -1) {
1753
- return typeof props.is === 'string';
1754
- }
1755
-
1756
- switch (tagName) {
1757
- // These are reserved SVG and MathML elements.
1758
- // We don't mind this whitelist too much because we expect it to never grow.
1759
- // The alternative is to track the namespace in a few places which is convoluted.
1760
- // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts
1761
- case 'annotation-xml':
1762
- case 'color-profile':
1763
- case 'font-face':
1764
- case 'font-face-src':
1765
- case 'font-face-uri':
1766
- case 'font-face-format':
1767
- case 'font-face-name':
1768
- case 'missing-glyph':
1769
- return false;
1770
-
1771
- default:
1772
- return true;
1773
- }
1774
- }
1775
-
1776
- var warnValidStyle = function () {};
1777
-
1778
- {
1779
- // 'msTransform' is correct, but the other prefixes should be capitalized
1780
- var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
1781
- var msPattern$1 = /^-ms-/;
1782
- var hyphenPattern = /-(.)/g; // style values shouldn't contain a semicolon
1783
-
1784
- var badStyleValueWithSemicolonPattern = /;\s*$/;
1785
- var warnedStyleNames = {};
1786
- var warnedStyleValues = {};
1787
- var warnedForNaNValue = false;
1788
- var warnedForInfinityValue = false;
1789
-
1790
- var camelize = function (string) {
1791
- return string.replace(hyphenPattern, function (_, character) {
1792
- return character.toUpperCase();
1793
- });
1794
- };
1795
-
1796
- var warnHyphenatedStyleName = function (name) {
1797
- if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
1798
- return;
1799
- }
1800
-
1801
- warnedStyleNames[name] = true;
1802
-
1803
- error('Unsupported style property %s. Did you mean %s?', name, // As Andi Smith suggests
1804
- // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
1805
- // is converted to lowercase `ms`.
1806
- camelize(name.replace(msPattern$1, 'ms-')));
1807
- };
1808
-
1809
- var warnBadVendoredStyleName = function (name) {
1810
- if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
1811
- return;
1812
- }
1813
-
1814
- warnedStyleNames[name] = true;
1815
-
1816
- error('Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1));
1817
- };
1818
-
1819
- var warnStyleValueWithSemicolon = function (name, value) {
1820
- if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
1821
- return;
1822
- }
1823
-
1824
- warnedStyleValues[value] = true;
1825
-
1826
- error("Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, ''));
1827
- };
1828
-
1829
- var warnStyleValueIsNaN = function (name, value) {
1830
- if (warnedForNaNValue) {
1831
- return;
1832
- }
1833
-
1834
- warnedForNaNValue = true;
1835
-
1836
- error('`NaN` is an invalid value for the `%s` css style property.', name);
1837
- };
1838
-
1839
- var warnStyleValueIsInfinity = function (name, value) {
1840
- if (warnedForInfinityValue) {
1841
- return;
1842
- }
1843
-
1844
- warnedForInfinityValue = true;
1845
-
1846
- error('`Infinity` is an invalid value for the `%s` css style property.', name);
1847
- };
1848
-
1849
- warnValidStyle = function (name, value) {
1850
- if (name.indexOf('-') > -1) {
1851
- warnHyphenatedStyleName(name);
1852
- } else if (badVendoredStyleNamePattern.test(name)) {
1853
- warnBadVendoredStyleName(name);
1854
- } else if (badStyleValueWithSemicolonPattern.test(value)) {
1855
- warnStyleValueWithSemicolon(name, value);
1856
- }
1857
-
1858
- if (typeof value === 'number') {
1859
- if (isNaN(value)) {
1860
- warnStyleValueIsNaN(name, value);
1861
- } else if (!isFinite(value)) {
1862
- warnStyleValueIsInfinity(name, value);
1863
- }
1864
- }
1865
- };
1866
- }
1867
-
1868
- var warnValidStyle$1 = warnValidStyle;
1869
-
1870
- var ariaProperties = {
1871
- 'aria-current': 0,
1872
- // state
1873
- 'aria-details': 0,
1874
- 'aria-disabled': 0,
1875
- // state
1876
- 'aria-hidden': 0,
1877
- // state
1878
- 'aria-invalid': 0,
1879
- // state
1880
- 'aria-keyshortcuts': 0,
1881
- 'aria-label': 0,
1882
- 'aria-roledescription': 0,
1883
- // Widget Attributes
1884
- 'aria-autocomplete': 0,
1885
- 'aria-checked': 0,
1886
- 'aria-expanded': 0,
1887
- 'aria-haspopup': 0,
1888
- 'aria-level': 0,
1889
- 'aria-modal': 0,
1890
- 'aria-multiline': 0,
1891
- 'aria-multiselectable': 0,
1892
- 'aria-orientation': 0,
1893
- 'aria-placeholder': 0,
1894
- 'aria-pressed': 0,
1895
- 'aria-readonly': 0,
1896
- 'aria-required': 0,
1897
- 'aria-selected': 0,
1898
- 'aria-sort': 0,
1899
- 'aria-valuemax': 0,
1900
- 'aria-valuemin': 0,
1901
- 'aria-valuenow': 0,
1902
- 'aria-valuetext': 0,
1903
- // Live Region Attributes
1904
- 'aria-atomic': 0,
1905
- 'aria-busy': 0,
1906
- 'aria-live': 0,
1907
- 'aria-relevant': 0,
1908
- // Drag-and-Drop Attributes
1909
- 'aria-dropeffect': 0,
1910
- 'aria-grabbed': 0,
1911
- // Relationship Attributes
1912
- 'aria-activedescendant': 0,
1913
- 'aria-colcount': 0,
1914
- 'aria-colindex': 0,
1915
- 'aria-colspan': 0,
1916
- 'aria-controls': 0,
1917
- 'aria-describedby': 0,
1918
- 'aria-errormessage': 0,
1919
- 'aria-flowto': 0,
1920
- 'aria-labelledby': 0,
1921
- 'aria-owns': 0,
1922
- 'aria-posinset': 0,
1923
- 'aria-rowcount': 0,
1924
- 'aria-rowindex': 0,
1925
- 'aria-rowspan': 0,
1926
- 'aria-setsize': 0
1927
- };
1928
-
1929
- var warnedProperties = {};
1930
- var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
1931
- var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
1932
- var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
1933
-
1934
- function validateProperty(tagName, name) {
1935
- {
1936
- if (hasOwnProperty$1.call(warnedProperties, name) && warnedProperties[name]) {
1937
- return true;
1938
- }
1939
-
1940
- if (rARIACamel.test(name)) {
1941
- var ariaName = 'aria-' + name.slice(4).toLowerCase();
1942
- var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null; // If this is an aria-* attribute, but is not listed in the known DOM
1943
- // DOM properties, then it is an invalid aria-* attribute.
1944
-
1945
- if (correctName == null) {
1946
- error('Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
1947
-
1948
- warnedProperties[name] = true;
1949
- return true;
1950
- } // aria-* attributes should be lowercase; suggest the lowercase version.
1951
-
1952
-
1953
- if (name !== correctName) {
1954
- error('Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
1955
-
1956
- warnedProperties[name] = true;
1957
- return true;
1958
- }
1959
- }
1960
-
1961
- if (rARIA.test(name)) {
1962
- var lowerCasedName = name.toLowerCase();
1963
- var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null; // If this is an aria-* attribute, but is not listed in the known DOM
1964
- // DOM properties, then it is an invalid aria-* attribute.
1965
-
1966
- if (standardName == null) {
1967
- warnedProperties[name] = true;
1968
- return false;
1969
- } // aria-* attributes should be lowercase; suggest the lowercase version.
1970
-
1971
-
1972
- if (name !== standardName) {
1973
- error('Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
1974
-
1975
- warnedProperties[name] = true;
1976
- return true;
1977
- }
1978
- }
1979
- }
1980
-
1981
- return true;
1982
- }
1983
-
1984
- function warnInvalidARIAProps(type, props) {
1985
- {
1986
- var invalidProps = [];
1987
-
1988
- for (var key in props) {
1989
- var isValid = validateProperty(type, key);
1990
-
1991
- if (!isValid) {
1992
- invalidProps.push(key);
1993
- }
1994
- }
1995
-
1996
- var unknownPropString = invalidProps.map(function (prop) {
1997
- return '`' + prop + '`';
1998
- }).join(', ');
1999
-
2000
- if (invalidProps.length === 1) {
2001
- error('Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
2002
- } else if (invalidProps.length > 1) {
2003
- error('Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop', unknownPropString, type);
2004
- }
2005
- }
2006
- }
2007
-
2008
- function validateProperties(type, props) {
2009
- if (isCustomComponent(type, props)) {
2010
- return;
2011
- }
2012
-
2013
- warnInvalidARIAProps(type, props);
2014
- }
2015
-
2016
- var didWarnValueNull = false;
2017
- function validateProperties$1(type, props) {
2018
- {
2019
- if (type !== 'input' && type !== 'textarea' && type !== 'select') {
2020
- return;
2021
- }
2022
-
2023
- if (props != null && props.value === null && !didWarnValueNull) {
2024
- didWarnValueNull = true;
2025
-
2026
- if (type === 'select' && props.multiple) {
2027
- 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);
2028
- } else {
2029
- error('`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type);
2030
- }
2031
- }
2032
- }
2033
- }
2034
-
2035
- /**
2036
- * Mapping from registration name to plugin module
2037
- */
2038
-
2039
- var registrationNameModules = {};
2040
- /**
2041
- * Mapping from lowercase registration names to the properly cased version,
2042
- * used to warn in the case of missing event handlers. Available
2043
- * only in true.
2044
- * @type {Object}
2045
- */
2046
-
2047
- var possibleRegistrationNames = {} ; // Trust the developer to only use possibleRegistrationNames in true
2048
-
2049
- // When adding attributes to the HTML or SVG whitelist, be sure to
2050
- // also add them to this module to ensure casing and incorrect name
2051
- // warnings.
2052
- var possibleStandardNames = {
2053
- // HTML
2054
- accept: 'accept',
2055
- acceptcharset: 'acceptCharset',
2056
- 'accept-charset': 'acceptCharset',
2057
- accesskey: 'accessKey',
2058
- action: 'action',
2059
- allowfullscreen: 'allowFullScreen',
2060
- alt: 'alt',
2061
- as: 'as',
2062
- async: 'async',
2063
- autocapitalize: 'autoCapitalize',
2064
- autocomplete: 'autoComplete',
2065
- autocorrect: 'autoCorrect',
2066
- autofocus: 'autoFocus',
2067
- autoplay: 'autoPlay',
2068
- autosave: 'autoSave',
2069
- capture: 'capture',
2070
- cellpadding: 'cellPadding',
2071
- cellspacing: 'cellSpacing',
2072
- challenge: 'challenge',
2073
- charset: 'charSet',
2074
- checked: 'checked',
2075
- children: 'children',
2076
- cite: 'cite',
2077
- class: 'className',
2078
- classid: 'classID',
2079
- classname: 'className',
2080
- cols: 'cols',
2081
- colspan: 'colSpan',
2082
- content: 'content',
2083
- contenteditable: 'contentEditable',
2084
- contextmenu: 'contextMenu',
2085
- controls: 'controls',
2086
- controlslist: 'controlsList',
2087
- coords: 'coords',
2088
- crossorigin: 'crossOrigin',
2089
- dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
2090
- data: 'data',
2091
- datetime: 'dateTime',
2092
- default: 'default',
2093
- defaultchecked: 'defaultChecked',
2094
- defaultvalue: 'defaultValue',
2095
- defer: 'defer',
2096
- dir: 'dir',
2097
- disabled: 'disabled',
2098
- disablepictureinpicture: 'disablePictureInPicture',
2099
- download: 'download',
2100
- draggable: 'draggable',
2101
- enctype: 'encType',
2102
- for: 'htmlFor',
2103
- form: 'form',
2104
- formmethod: 'formMethod',
2105
- formaction: 'formAction',
2106
- formenctype: 'formEncType',
2107
- formnovalidate: 'formNoValidate',
2108
- formtarget: 'formTarget',
2109
- frameborder: 'frameBorder',
2110
- headers: 'headers',
2111
- height: 'height',
2112
- hidden: 'hidden',
2113
- high: 'high',
2114
- href: 'href',
2115
- hreflang: 'hrefLang',
2116
- htmlfor: 'htmlFor',
2117
- httpequiv: 'httpEquiv',
2118
- 'http-equiv': 'httpEquiv',
2119
- icon: 'icon',
2120
- id: 'id',
2121
- innerhtml: 'innerHTML',
2122
- inputmode: 'inputMode',
2123
- integrity: 'integrity',
2124
- is: 'is',
2125
- itemid: 'itemID',
2126
- itemprop: 'itemProp',
2127
- itemref: 'itemRef',
2128
- itemscope: 'itemScope',
2129
- itemtype: 'itemType',
2130
- keyparams: 'keyParams',
2131
- keytype: 'keyType',
2132
- kind: 'kind',
2133
- label: 'label',
2134
- lang: 'lang',
2135
- list: 'list',
2136
- loop: 'loop',
2137
- low: 'low',
2138
- manifest: 'manifest',
2139
- marginwidth: 'marginWidth',
2140
- marginheight: 'marginHeight',
2141
- max: 'max',
2142
- maxlength: 'maxLength',
2143
- media: 'media',
2144
- mediagroup: 'mediaGroup',
2145
- method: 'method',
2146
- min: 'min',
2147
- minlength: 'minLength',
2148
- multiple: 'multiple',
2149
- muted: 'muted',
2150
- name: 'name',
2151
- nomodule: 'noModule',
2152
- nonce: 'nonce',
2153
- novalidate: 'noValidate',
2154
- open: 'open',
2155
- optimum: 'optimum',
2156
- pattern: 'pattern',
2157
- placeholder: 'placeholder',
2158
- playsinline: 'playsInline',
2159
- poster: 'poster',
2160
- preload: 'preload',
2161
- profile: 'profile',
2162
- radiogroup: 'radioGroup',
2163
- readonly: 'readOnly',
2164
- referrerpolicy: 'referrerPolicy',
2165
- rel: 'rel',
2166
- required: 'required',
2167
- reversed: 'reversed',
2168
- role: 'role',
2169
- rows: 'rows',
2170
- rowspan: 'rowSpan',
2171
- sandbox: 'sandbox',
2172
- scope: 'scope',
2173
- scoped: 'scoped',
2174
- scrolling: 'scrolling',
2175
- seamless: 'seamless',
2176
- selected: 'selected',
2177
- shape: 'shape',
2178
- size: 'size',
2179
- sizes: 'sizes',
2180
- span: 'span',
2181
- spellcheck: 'spellCheck',
2182
- src: 'src',
2183
- srcdoc: 'srcDoc',
2184
- srclang: 'srcLang',
2185
- srcset: 'srcSet',
2186
- start: 'start',
2187
- step: 'step',
2188
- style: 'style',
2189
- summary: 'summary',
2190
- tabindex: 'tabIndex',
2191
- target: 'target',
2192
- title: 'title',
2193
- type: 'type',
2194
- usemap: 'useMap',
2195
- value: 'value',
2196
- width: 'width',
2197
- wmode: 'wmode',
2198
- wrap: 'wrap',
2199
- // SVG
2200
- about: 'about',
2201
- accentheight: 'accentHeight',
2202
- 'accent-height': 'accentHeight',
2203
- accumulate: 'accumulate',
2204
- additive: 'additive',
2205
- alignmentbaseline: 'alignmentBaseline',
2206
- 'alignment-baseline': 'alignmentBaseline',
2207
- allowreorder: 'allowReorder',
2208
- alphabetic: 'alphabetic',
2209
- amplitude: 'amplitude',
2210
- arabicform: 'arabicForm',
2211
- 'arabic-form': 'arabicForm',
2212
- ascent: 'ascent',
2213
- attributename: 'attributeName',
2214
- attributetype: 'attributeType',
2215
- autoreverse: 'autoReverse',
2216
- azimuth: 'azimuth',
2217
- basefrequency: 'baseFrequency',
2218
- baselineshift: 'baselineShift',
2219
- 'baseline-shift': 'baselineShift',
2220
- baseprofile: 'baseProfile',
2221
- bbox: 'bbox',
2222
- begin: 'begin',
2223
- bias: 'bias',
2224
- by: 'by',
2225
- calcmode: 'calcMode',
2226
- capheight: 'capHeight',
2227
- 'cap-height': 'capHeight',
2228
- clip: 'clip',
2229
- clippath: 'clipPath',
2230
- 'clip-path': 'clipPath',
2231
- clippathunits: 'clipPathUnits',
2232
- cliprule: 'clipRule',
2233
- 'clip-rule': 'clipRule',
2234
- color: 'color',
2235
- colorinterpolation: 'colorInterpolation',
2236
- 'color-interpolation': 'colorInterpolation',
2237
- colorinterpolationfilters: 'colorInterpolationFilters',
2238
- 'color-interpolation-filters': 'colorInterpolationFilters',
2239
- colorprofile: 'colorProfile',
2240
- 'color-profile': 'colorProfile',
2241
- colorrendering: 'colorRendering',
2242
- 'color-rendering': 'colorRendering',
2243
- contentscripttype: 'contentScriptType',
2244
- contentstyletype: 'contentStyleType',
2245
- cursor: 'cursor',
2246
- cx: 'cx',
2247
- cy: 'cy',
2248
- d: 'd',
2249
- datatype: 'datatype',
2250
- decelerate: 'decelerate',
2251
- descent: 'descent',
2252
- diffuseconstant: 'diffuseConstant',
2253
- direction: 'direction',
2254
- display: 'display',
2255
- divisor: 'divisor',
2256
- dominantbaseline: 'dominantBaseline',
2257
- 'dominant-baseline': 'dominantBaseline',
2258
- dur: 'dur',
2259
- dx: 'dx',
2260
- dy: 'dy',
2261
- edgemode: 'edgeMode',
2262
- elevation: 'elevation',
2263
- enablebackground: 'enableBackground',
2264
- 'enable-background': 'enableBackground',
2265
- end: 'end',
2266
- exponent: 'exponent',
2267
- externalresourcesrequired: 'externalResourcesRequired',
2268
- fill: 'fill',
2269
- fillopacity: 'fillOpacity',
2270
- 'fill-opacity': 'fillOpacity',
2271
- fillrule: 'fillRule',
2272
- 'fill-rule': 'fillRule',
2273
- filter: 'filter',
2274
- filterres: 'filterRes',
2275
- filterunits: 'filterUnits',
2276
- floodopacity: 'floodOpacity',
2277
- 'flood-opacity': 'floodOpacity',
2278
- floodcolor: 'floodColor',
2279
- 'flood-color': 'floodColor',
2280
- focusable: 'focusable',
2281
- fontfamily: 'fontFamily',
2282
- 'font-family': 'fontFamily',
2283
- fontsize: 'fontSize',
2284
- 'font-size': 'fontSize',
2285
- fontsizeadjust: 'fontSizeAdjust',
2286
- 'font-size-adjust': 'fontSizeAdjust',
2287
- fontstretch: 'fontStretch',
2288
- 'font-stretch': 'fontStretch',
2289
- fontstyle: 'fontStyle',
2290
- 'font-style': 'fontStyle',
2291
- fontvariant: 'fontVariant',
2292
- 'font-variant': 'fontVariant',
2293
- fontweight: 'fontWeight',
2294
- 'font-weight': 'fontWeight',
2295
- format: 'format',
2296
- from: 'from',
2297
- fx: 'fx',
2298
- fy: 'fy',
2299
- g1: 'g1',
2300
- g2: 'g2',
2301
- glyphname: 'glyphName',
2302
- 'glyph-name': 'glyphName',
2303
- glyphorientationhorizontal: 'glyphOrientationHorizontal',
2304
- 'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
2305
- glyphorientationvertical: 'glyphOrientationVertical',
2306
- 'glyph-orientation-vertical': 'glyphOrientationVertical',
2307
- glyphref: 'glyphRef',
2308
- gradienttransform: 'gradientTransform',
2309
- gradientunits: 'gradientUnits',
2310
- hanging: 'hanging',
2311
- horizadvx: 'horizAdvX',
2312
- 'horiz-adv-x': 'horizAdvX',
2313
- horizoriginx: 'horizOriginX',
2314
- 'horiz-origin-x': 'horizOriginX',
2315
- ideographic: 'ideographic',
2316
- imagerendering: 'imageRendering',
2317
- 'image-rendering': 'imageRendering',
2318
- in2: 'in2',
2319
- in: 'in',
2320
- inlist: 'inlist',
2321
- intercept: 'intercept',
2322
- k1: 'k1',
2323
- k2: 'k2',
2324
- k3: 'k3',
2325
- k4: 'k4',
2326
- k: 'k',
2327
- kernelmatrix: 'kernelMatrix',
2328
- kernelunitlength: 'kernelUnitLength',
2329
- kerning: 'kerning',
2330
- keypoints: 'keyPoints',
2331
- keysplines: 'keySplines',
2332
- keytimes: 'keyTimes',
2333
- lengthadjust: 'lengthAdjust',
2334
- letterspacing: 'letterSpacing',
2335
- 'letter-spacing': 'letterSpacing',
2336
- lightingcolor: 'lightingColor',
2337
- 'lighting-color': 'lightingColor',
2338
- limitingconeangle: 'limitingConeAngle',
2339
- local: 'local',
2340
- markerend: 'markerEnd',
2341
- 'marker-end': 'markerEnd',
2342
- markerheight: 'markerHeight',
2343
- markermid: 'markerMid',
2344
- 'marker-mid': 'markerMid',
2345
- markerstart: 'markerStart',
2346
- 'marker-start': 'markerStart',
2347
- markerunits: 'markerUnits',
2348
- markerwidth: 'markerWidth',
2349
- mask: 'mask',
2350
- maskcontentunits: 'maskContentUnits',
2351
- maskunits: 'maskUnits',
2352
- mathematical: 'mathematical',
2353
- mode: 'mode',
2354
- numoctaves: 'numOctaves',
2355
- offset: 'offset',
2356
- opacity: 'opacity',
2357
- operator: 'operator',
2358
- order: 'order',
2359
- orient: 'orient',
2360
- orientation: 'orientation',
2361
- origin: 'origin',
2362
- overflow: 'overflow',
2363
- overlineposition: 'overlinePosition',
2364
- 'overline-position': 'overlinePosition',
2365
- overlinethickness: 'overlineThickness',
2366
- 'overline-thickness': 'overlineThickness',
2367
- paintorder: 'paintOrder',
2368
- 'paint-order': 'paintOrder',
2369
- panose1: 'panose1',
2370
- 'panose-1': 'panose1',
2371
- pathlength: 'pathLength',
2372
- patterncontentunits: 'patternContentUnits',
2373
- patterntransform: 'patternTransform',
2374
- patternunits: 'patternUnits',
2375
- pointerevents: 'pointerEvents',
2376
- 'pointer-events': 'pointerEvents',
2377
- points: 'points',
2378
- pointsatx: 'pointsAtX',
2379
- pointsaty: 'pointsAtY',
2380
- pointsatz: 'pointsAtZ',
2381
- prefix: 'prefix',
2382
- preservealpha: 'preserveAlpha',
2383
- preserveaspectratio: 'preserveAspectRatio',
2384
- primitiveunits: 'primitiveUnits',
2385
- property: 'property',
2386
- r: 'r',
2387
- radius: 'radius',
2388
- refx: 'refX',
2389
- refy: 'refY',
2390
- renderingintent: 'renderingIntent',
2391
- 'rendering-intent': 'renderingIntent',
2392
- repeatcount: 'repeatCount',
2393
- repeatdur: 'repeatDur',
2394
- requiredextensions: 'requiredExtensions',
2395
- requiredfeatures: 'requiredFeatures',
2396
- resource: 'resource',
2397
- restart: 'restart',
2398
- result: 'result',
2399
- results: 'results',
2400
- rotate: 'rotate',
2401
- rx: 'rx',
2402
- ry: 'ry',
2403
- scale: 'scale',
2404
- security: 'security',
2405
- seed: 'seed',
2406
- shaperendering: 'shapeRendering',
2407
- 'shape-rendering': 'shapeRendering',
2408
- slope: 'slope',
2409
- spacing: 'spacing',
2410
- specularconstant: 'specularConstant',
2411
- specularexponent: 'specularExponent',
2412
- speed: 'speed',
2413
- spreadmethod: 'spreadMethod',
2414
- startoffset: 'startOffset',
2415
- stddeviation: 'stdDeviation',
2416
- stemh: 'stemh',
2417
- stemv: 'stemv',
2418
- stitchtiles: 'stitchTiles',
2419
- stopcolor: 'stopColor',
2420
- 'stop-color': 'stopColor',
2421
- stopopacity: 'stopOpacity',
2422
- 'stop-opacity': 'stopOpacity',
2423
- strikethroughposition: 'strikethroughPosition',
2424
- 'strikethrough-position': 'strikethroughPosition',
2425
- strikethroughthickness: 'strikethroughThickness',
2426
- 'strikethrough-thickness': 'strikethroughThickness',
2427
- string: 'string',
2428
- stroke: 'stroke',
2429
- strokedasharray: 'strokeDasharray',
2430
- 'stroke-dasharray': 'strokeDasharray',
2431
- strokedashoffset: 'strokeDashoffset',
2432
- 'stroke-dashoffset': 'strokeDashoffset',
2433
- strokelinecap: 'strokeLinecap',
2434
- 'stroke-linecap': 'strokeLinecap',
2435
- strokelinejoin: 'strokeLinejoin',
2436
- 'stroke-linejoin': 'strokeLinejoin',
2437
- strokemiterlimit: 'strokeMiterlimit',
2438
- 'stroke-miterlimit': 'strokeMiterlimit',
2439
- strokewidth: 'strokeWidth',
2440
- 'stroke-width': 'strokeWidth',
2441
- strokeopacity: 'strokeOpacity',
2442
- 'stroke-opacity': 'strokeOpacity',
2443
- suppresscontenteditablewarning: 'suppressContentEditableWarning',
2444
- suppresshydrationwarning: 'suppressHydrationWarning',
2445
- surfacescale: 'surfaceScale',
2446
- systemlanguage: 'systemLanguage',
2447
- tablevalues: 'tableValues',
2448
- targetx: 'targetX',
2449
- targety: 'targetY',
2450
- textanchor: 'textAnchor',
2451
- 'text-anchor': 'textAnchor',
2452
- textdecoration: 'textDecoration',
2453
- 'text-decoration': 'textDecoration',
2454
- textlength: 'textLength',
2455
- textrendering: 'textRendering',
2456
- 'text-rendering': 'textRendering',
2457
- to: 'to',
2458
- transform: 'transform',
2459
- typeof: 'typeof',
2460
- u1: 'u1',
2461
- u2: 'u2',
2462
- underlineposition: 'underlinePosition',
2463
- 'underline-position': 'underlinePosition',
2464
- underlinethickness: 'underlineThickness',
2465
- 'underline-thickness': 'underlineThickness',
2466
- unicode: 'unicode',
2467
- unicodebidi: 'unicodeBidi',
2468
- 'unicode-bidi': 'unicodeBidi',
2469
- unicoderange: 'unicodeRange',
2470
- 'unicode-range': 'unicodeRange',
2471
- unitsperem: 'unitsPerEm',
2472
- 'units-per-em': 'unitsPerEm',
2473
- unselectable: 'unselectable',
2474
- valphabetic: 'vAlphabetic',
2475
- 'v-alphabetic': 'vAlphabetic',
2476
- values: 'values',
2477
- vectoreffect: 'vectorEffect',
2478
- 'vector-effect': 'vectorEffect',
2479
- version: 'version',
2480
- vertadvy: 'vertAdvY',
2481
- 'vert-adv-y': 'vertAdvY',
2482
- vertoriginx: 'vertOriginX',
2483
- 'vert-origin-x': 'vertOriginX',
2484
- vertoriginy: 'vertOriginY',
2485
- 'vert-origin-y': 'vertOriginY',
2486
- vhanging: 'vHanging',
2487
- 'v-hanging': 'vHanging',
2488
- videographic: 'vIdeographic',
2489
- 'v-ideographic': 'vIdeographic',
2490
- viewbox: 'viewBox',
2491
- viewtarget: 'viewTarget',
2492
- visibility: 'visibility',
2493
- vmathematical: 'vMathematical',
2494
- 'v-mathematical': 'vMathematical',
2495
- vocab: 'vocab',
2496
- widths: 'widths',
2497
- wordspacing: 'wordSpacing',
2498
- 'word-spacing': 'wordSpacing',
2499
- writingmode: 'writingMode',
2500
- 'writing-mode': 'writingMode',
2501
- x1: 'x1',
2502
- x2: 'x2',
2503
- x: 'x',
2504
- xchannelselector: 'xChannelSelector',
2505
- xheight: 'xHeight',
2506
- 'x-height': 'xHeight',
2507
- xlinkactuate: 'xlinkActuate',
2508
- 'xlink:actuate': 'xlinkActuate',
2509
- xlinkarcrole: 'xlinkArcrole',
2510
- 'xlink:arcrole': 'xlinkArcrole',
2511
- xlinkhref: 'xlinkHref',
2512
- 'xlink:href': 'xlinkHref',
2513
- xlinkrole: 'xlinkRole',
2514
- 'xlink:role': 'xlinkRole',
2515
- xlinkshow: 'xlinkShow',
2516
- 'xlink:show': 'xlinkShow',
2517
- xlinktitle: 'xlinkTitle',
2518
- 'xlink:title': 'xlinkTitle',
2519
- xlinktype: 'xlinkType',
2520
- 'xlink:type': 'xlinkType',
2521
- xmlbase: 'xmlBase',
2522
- 'xml:base': 'xmlBase',
2523
- xmllang: 'xmlLang',
2524
- 'xml:lang': 'xmlLang',
2525
- xmlns: 'xmlns',
2526
- 'xml:space': 'xmlSpace',
2527
- xmlnsxlink: 'xmlnsXlink',
2528
- 'xmlns:xlink': 'xmlnsXlink',
2529
- xmlspace: 'xmlSpace',
2530
- y1: 'y1',
2531
- y2: 'y2',
2532
- y: 'y',
2533
- ychannelselector: 'yChannelSelector',
2534
- z: 'z',
2535
- zoomandpan: 'zoomAndPan'
2536
- };
2537
-
2538
- var validateProperty$1 = function () {};
2539
-
2540
- {
2541
- var warnedProperties$1 = {};
2542
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
2543
- var EVENT_NAME_REGEX = /^on./;
2544
- var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
2545
- var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
2546
- var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
2547
-
2548
- validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
2549
- if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
2550
- return true;
2551
- }
2552
-
2553
- var lowerCasedName = name.toLowerCase();
2554
-
2555
- if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
2556
- 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.');
2557
-
2558
- warnedProperties$1[name] = true;
2559
- return true;
2560
- } // We can't rely on the event system being injected on the server.
2561
-
2562
-
2563
- if (canUseEventSystem) {
2564
- if (registrationNameModules.hasOwnProperty(name)) {
2565
- return true;
2566
- }
2567
-
2568
- var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
2569
-
2570
- if (registrationName != null) {
2571
- error('Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName);
2572
-
2573
- warnedProperties$1[name] = true;
2574
- return true;
2575
- }
2576
-
2577
- if (EVENT_NAME_REGEX.test(name)) {
2578
- error('Unknown event handler property `%s`. It will be ignored.', name);
2579
-
2580
- warnedProperties$1[name] = true;
2581
- return true;
2582
- }
2583
- } else if (EVENT_NAME_REGEX.test(name)) {
2584
- // If no event plugins have been injected, we are in a server environment.
2585
- // So we can't tell if the event name is correct for sure, but we can filter
2586
- // out known bad ones like `onclick`. We can't suggest a specific replacement though.
2587
- if (INVALID_EVENT_NAME_REGEX.test(name)) {
2588
- error('Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name);
2589
- }
2590
-
2591
- warnedProperties$1[name] = true;
2592
- return true;
2593
- } // Let the ARIA attribute hook validate ARIA attributes
2594
-
2595
-
2596
- if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
2597
- return true;
2598
- }
2599
-
2600
- if (lowerCasedName === 'innerhtml') {
2601
- error('Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
2602
-
2603
- warnedProperties$1[name] = true;
2604
- return true;
2605
- }
2606
-
2607
- if (lowerCasedName === 'aria') {
2608
- error('The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
2609
-
2610
- warnedProperties$1[name] = true;
2611
- return true;
2612
- }
2613
-
2614
- if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
2615
- error('Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value);
2616
-
2617
- warnedProperties$1[name] = true;
2618
- return true;
2619
- }
2620
-
2621
- if (typeof value === 'number' && isNaN(value)) {
2622
- error('Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name);
2623
-
2624
- warnedProperties$1[name] = true;
2625
- return true;
2626
- }
2627
-
2628
- var propertyInfo = getPropertyInfo(name);
2629
- var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED; // Known attributes should match the casing specified in the property config.
2630
-
2631
- if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
2632
- var standardName = possibleStandardNames[lowerCasedName];
2633
-
2634
- if (standardName !== name) {
2635
- error('Invalid DOM property `%s`. Did you mean `%s`?', name, standardName);
2636
-
2637
- warnedProperties$1[name] = true;
2638
- return true;
2639
- }
2640
- } else if (!isReserved && name !== lowerCasedName) {
2641
- // Unknown attributes should have lowercase casing since that's how they
2642
- // will be cased anyway with server rendering.
2643
- 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);
2644
-
2645
- warnedProperties$1[name] = true;
2646
- return true;
2647
- }
2648
-
2649
- if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
2650
- if (value) {
2651
- 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);
2652
- } else {
2653
- 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);
2654
- }
2655
-
2656
- warnedProperties$1[name] = true;
2657
- return true;
2658
- } // Now that we've validated casing, do not validate
2659
- // data types for reserved props
2660
-
2661
-
2662
- if (isReserved) {
2663
- return true;
2664
- } // Warn when a known attribute is a bad type
2665
-
2666
-
2667
- if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
2668
- warnedProperties$1[name] = true;
2669
- return false;
2670
- } // Warn when passing the strings 'false' or 'true' into a boolean prop
2671
-
2672
-
2673
- if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
2674
- 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);
2675
-
2676
- warnedProperties$1[name] = true;
2677
- return true;
2678
- }
2679
-
2680
- return true;
2681
- };
2682
- }
2683
-
2684
- var warnUnknownProperties = function (type, props, canUseEventSystem) {
2685
- {
2686
- var unknownProps = [];
2687
-
2688
- for (var key in props) {
2689
- var isValid = validateProperty$1(type, key, props[key], canUseEventSystem);
2690
-
2691
- if (!isValid) {
2692
- unknownProps.push(key);
2693
- }
2694
- }
2695
-
2696
- var unknownPropString = unknownProps.map(function (prop) {
2697
- return '`' + prop + '`';
2698
- }).join(', ');
2699
-
2700
- if (unknownProps.length === 1) {
2701
- 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://fb.me/react-attribute-behavior', unknownPropString, type);
2702
- } else if (unknownProps.length > 1) {
2703
- 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://fb.me/react-attribute-behavior', unknownPropString, type);
2704
- }
2705
- }
2706
- };
2707
-
2708
- function validateProperties$2(type, props, canUseEventSystem) {
2709
- if (isCustomComponent(type, props)) {
2710
- return;
2711
- }
2712
-
2713
- warnUnknownProperties(type, props, canUseEventSystem);
2714
- }
2715
-
2716
- var toArray = React.Children.toArray; // This is only used in DEV.
2717
- // Each entry is `this.stack` from a currently executing renderer instance.
2718
- // (There may be more than one because ReactDOMServer is reentrant).
2719
- // Each stack is an array of frames which may contain nested stacks of elements.
2720
-
2721
- var currentDebugStacks = [];
2722
- var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
2723
- var ReactDebugCurrentFrame$4;
2724
- var prevGetCurrentStackImpl = null;
2725
-
2726
- var getCurrentServerStackImpl = function () {
2727
- return '';
2728
- };
2729
-
2730
- var describeStackFrame = function (element) {
2731
- return '';
2732
- };
2733
-
2734
- var validatePropertiesInDevelopment = function (type, props) {};
2735
-
2736
- var pushCurrentDebugStack = function (stack) {};
2737
-
2738
- var pushElementToDebugStack = function (element) {};
2739
-
2740
- var popCurrentDebugStack = function () {};
2741
-
2742
- var hasWarnedAboutUsingContextAsConsumer = false;
2743
-
2744
- {
2745
- ReactDebugCurrentFrame$4 = ReactSharedInternals.ReactDebugCurrentFrame;
2746
-
2747
- validatePropertiesInDevelopment = function (type, props) {
2748
- validateProperties(type, props);
2749
- validateProperties$1(type, props);
2750
- validateProperties$2(type, props,
2751
- /* canUseEventSystem */
2752
- false);
2753
- };
2754
-
2755
- describeStackFrame = function (element) {
2756
- var source = element._source;
2757
- var type = element.type;
2758
- var name = getComponentName(type);
2759
- var ownerName = null;
2760
- return describeComponentFrame(name, source, ownerName);
2761
- };
2762
-
2763
- pushCurrentDebugStack = function (stack) {
2764
- currentDebugStacks.push(stack);
2765
-
2766
- if (currentDebugStacks.length === 1) {
2767
- // We are entering a server renderer.
2768
- // Remember the previous (e.g. client) global stack implementation.
2769
- prevGetCurrentStackImpl = ReactDebugCurrentFrame$4.getCurrentStack;
2770
- ReactDebugCurrentFrame$4.getCurrentStack = getCurrentServerStackImpl;
2771
- }
2772
- };
2773
-
2774
- pushElementToDebugStack = function (element) {
2775
- // For the innermost executing ReactDOMServer call,
2776
- var stack = currentDebugStacks[currentDebugStacks.length - 1]; // Take the innermost executing frame (e.g. <Foo>),
2777
-
2778
- var frame = stack[stack.length - 1]; // and record that it has one more element associated with it.
2779
-
2780
- frame.debugElementStack.push(element); // We only need this because we tail-optimize single-element
2781
- // children and directly handle them in an inner loop instead of
2782
- // creating separate frames for them.
2783
- };
2784
-
2785
- popCurrentDebugStack = function () {
2786
- currentDebugStacks.pop();
2787
-
2788
- if (currentDebugStacks.length === 0) {
2789
- // We are exiting the server renderer.
2790
- // Restore the previous (e.g. client) global stack implementation.
2791
- ReactDebugCurrentFrame$4.getCurrentStack = prevGetCurrentStackImpl;
2792
- prevGetCurrentStackImpl = null;
2793
- }
2794
- };
2795
-
2796
- getCurrentServerStackImpl = function () {
2797
- if (currentDebugStacks.length === 0) {
2798
- // Nothing is currently rendering.
2799
- return '';
2800
- } // ReactDOMServer is reentrant so there may be multiple calls at the same time.
2801
- // Take the frames from the innermost call which is the last in the array.
2802
-
2803
-
2804
- var frames = currentDebugStacks[currentDebugStacks.length - 1];
2805
- var stack = ''; // Go through every frame in the stack from the innermost one.
2806
-
2807
- for (var i = frames.length - 1; i >= 0; i--) {
2808
- var frame = frames[i]; // Every frame might have more than one debug element stack entry associated with it.
2809
- // This is because single-child nesting doesn't create materialized frames.
2810
- // Instead it would push them through `pushElementToDebugStack()`.
2811
-
2812
- var debugElementStack = frame.debugElementStack;
2813
-
2814
- for (var ii = debugElementStack.length - 1; ii >= 0; ii--) {
2815
- stack += describeStackFrame(debugElementStack[ii]);
2816
- }
2817
- }
2818
-
2819
- return stack;
2820
- };
2821
- }
2822
-
2823
- var didWarnDefaultInputValue = false;
2824
- var didWarnDefaultChecked = false;
2825
- var didWarnDefaultSelectValue = false;
2826
- var didWarnDefaultTextareaValue = false;
2827
- var didWarnInvalidOptionChildren = false;
2828
- var didWarnAboutNoopUpdateForComponent = {};
2829
- var didWarnAboutBadClass = {};
2830
- var didWarnAboutModulePatternComponent = {};
2831
- var didWarnAboutDeprecatedWillMount = {};
2832
- var didWarnAboutUndefinedDerivedState = {};
2833
- var didWarnAboutUninitializedState = {};
2834
- var valuePropNames = ['value', 'defaultValue'];
2835
- var newlineEatingTags = {
2836
- listing: true,
2837
- pre: true,
2838
- textarea: true
2839
- }; // We accept any tag to be rendered but since this gets injected into arbitrary
2840
- // HTML, we want to make sure that it's a safe tag.
2841
- // http://www.w3.org/TR/REC-xml/#NT-Name
2842
-
2843
- var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
2844
-
2845
- var validatedTagCache = {};
2846
-
2847
- function validateDangerousTag(tag) {
2848
- if (!validatedTagCache.hasOwnProperty(tag)) {
2849
- if (!VALID_TAG_REGEX.test(tag)) {
2850
- {
2851
- throw Error( "Invalid tag: " + tag );
2852
- }
2853
- }
2854
-
2855
- validatedTagCache[tag] = true;
2856
- }
2857
- }
2858
-
2859
- var styleNameCache = {};
2860
-
2861
- var processStyleName = function (styleName) {
2862
- if (styleNameCache.hasOwnProperty(styleName)) {
2863
- return styleNameCache[styleName];
2864
- }
2865
-
2866
- var result = hyphenateStyleName(styleName);
2867
- styleNameCache[styleName] = result;
2868
- return result;
2869
- };
2870
-
2871
- function createMarkupForStyles(styles) {
2872
- var serialized = '';
2873
- var delimiter = '';
2874
-
2875
- for (var styleName in styles) {
2876
- if (!styles.hasOwnProperty(styleName)) {
2877
- continue;
2878
- }
2879
-
2880
- var isCustomProperty = styleName.indexOf('--') === 0;
2881
- var styleValue = styles[styleName];
2882
-
2883
- {
2884
- if (!isCustomProperty) {
2885
- warnValidStyle$1(styleName, styleValue);
2886
- }
2887
- }
2888
-
2889
- if (styleValue != null) {
2890
- serialized += delimiter + (isCustomProperty ? styleName : processStyleName(styleName)) + ':';
2891
- serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
2892
- delimiter = ';';
2893
- }
2894
- }
2895
-
2896
- return serialized || null;
2897
- }
2898
-
2899
- function warnNoop(publicInstance, callerName) {
2900
- {
2901
- var _constructor = publicInstance.constructor;
2902
- var componentName = _constructor && getComponentName(_constructor) || 'ReactClass';
2903
- var warningKey = componentName + '.' + callerName;
2904
-
2905
- if (didWarnAboutNoopUpdateForComponent[warningKey]) {
2906
- return;
2907
- }
2908
-
2909
- 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);
2910
-
2911
- didWarnAboutNoopUpdateForComponent[warningKey] = true;
2912
- }
2913
- }
2914
-
2915
- function shouldConstruct(Component) {
2916
- return Component.prototype && Component.prototype.isReactComponent;
2917
- }
2918
-
2919
- function getNonChildrenInnerMarkup(props) {
2920
- var innerHTML = props.dangerouslySetInnerHTML;
2921
-
2922
- if (innerHTML != null) {
2923
- if (innerHTML.__html != null) {
2924
- return innerHTML.__html;
2925
- }
2926
- } else {
2927
- var content = props.children;
2928
-
2929
- if (typeof content === 'string' || typeof content === 'number') {
2930
- return escapeTextForBrowser(content);
2931
- }
2932
- }
2933
-
2934
- return null;
2935
- }
2936
-
2937
- function flattenTopLevelChildren(children) {
2938
- if (!React.isValidElement(children)) {
2939
- return toArray(children);
2940
- }
2941
-
2942
- var element = children;
2943
-
2944
- if (element.type !== REACT_FRAGMENT_TYPE) {
2945
- return [element];
2946
- }
2947
-
2948
- var fragmentChildren = element.props.children;
2949
-
2950
- if (!React.isValidElement(fragmentChildren)) {
2951
- return toArray(fragmentChildren);
2952
- }
2953
-
2954
- var fragmentChildElement = fragmentChildren;
2955
- return [fragmentChildElement];
2956
- }
2957
-
2958
- function flattenOptionChildren(children) {
2959
- if (children === undefined || children === null) {
2960
- return children;
2961
- }
2962
-
2963
- var content = ''; // Flatten children and warn if they aren't strings or numbers;
2964
- // invalid types are ignored.
2965
-
2966
- React.Children.forEach(children, function (child) {
2967
- if (child == null) {
2968
- return;
2969
- }
2970
-
2971
- content += child;
2972
-
2973
- {
2974
- if (!didWarnInvalidOptionChildren && typeof child !== 'string' && typeof child !== 'number') {
2975
- didWarnInvalidOptionChildren = true;
2976
-
2977
- error('Only strings and numbers are supported as <option> children.');
2978
- }
2979
- }
2980
- });
2981
- return content;
2982
- }
2983
-
2984
- var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
2985
- var STYLE = 'style';
2986
- var RESERVED_PROPS = {
2987
- children: null,
2988
- dangerouslySetInnerHTML: null,
2989
- suppressContentEditableWarning: null,
2990
- suppressHydrationWarning: null
2991
- };
2992
-
2993
- function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeStaticMarkup, isRootElement) {
2994
- var ret = '<' + tagVerbatim;
2995
-
2996
- for (var propKey in props) {
2997
- if (!hasOwnProperty$2.call(props, propKey)) {
2998
- continue;
2999
- }
3000
-
3001
- var propValue = props[propKey];
3002
-
3003
- if (propValue == null) {
3004
- continue;
3005
- }
3006
-
3007
- if (propKey === STYLE) {
3008
- propValue = createMarkupForStyles(propValue);
3009
- }
3010
-
3011
- var markup = null;
3012
-
3013
- if (isCustomComponent(tagLowercase, props)) {
3014
- if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
3015
- markup = createMarkupForCustomAttribute(propKey, propValue);
3016
- }
3017
- } else {
3018
- markup = createMarkupForProperty(propKey, propValue);
3019
- }
3020
-
3021
- if (markup) {
3022
- ret += ' ' + markup;
3023
- }
3024
- } // For static pages, no need to put React ID and checksum. Saves lots of
3025
- // bytes.
3026
-
3027
-
3028
- if (makeStaticMarkup) {
3029
- return ret;
3030
- }
3031
-
3032
- if (isRootElement) {
3033
- ret += ' ' + createMarkupForRoot();
3034
- }
3035
-
3036
- return ret;
3037
- }
3038
-
3039
- function validateRenderResult(child, type) {
3040
- if (child === undefined) {
3041
- {
3042
- {
3043
- throw Error( (getComponentName(type) || 'Component') + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null." );
3044
- }
3045
- }
3046
- }
3047
- }
3048
-
3049
- function resolve(child, context, threadID) {
3050
- while (React.isValidElement(child)) {
3051
- // Safe because we just checked it's an element.
3052
- var element = child;
3053
- var Component = element.type;
3054
-
3055
- {
3056
- pushElementToDebugStack(element);
3057
- }
3058
-
3059
- if (typeof Component !== 'function') {
3060
- break;
3061
- }
3062
-
3063
- processChild(element, Component);
3064
- } // Extra closure so queue and replace can be captured properly
3065
-
3066
-
3067
- function processChild(element, Component) {
3068
- var isClass = shouldConstruct(Component);
3069
- var publicContext = processContext(Component, context, threadID, isClass);
3070
- var queue = [];
3071
- var replace = false;
3072
- var updater = {
3073
- isMounted: function (publicInstance) {
3074
- return false;
3075
- },
3076
- enqueueForceUpdate: function (publicInstance) {
3077
- if (queue === null) {
3078
- warnNoop(publicInstance, 'forceUpdate');
3079
- return null;
3080
- }
3081
- },
3082
- enqueueReplaceState: function (publicInstance, completeState) {
3083
- replace = true;
3084
- queue = [completeState];
3085
- },
3086
- enqueueSetState: function (publicInstance, currentPartialState) {
3087
- if (queue === null) {
3088
- warnNoop(publicInstance, 'setState');
3089
- return null;
3090
- }
3091
-
3092
- queue.push(currentPartialState);
3093
- }
3094
- };
3095
- var inst;
3096
-
3097
- if (isClass) {
3098
- inst = new Component(element.props, publicContext, updater);
3099
-
3100
- if (typeof Component.getDerivedStateFromProps === 'function') {
3101
- {
3102
- if (inst.state === null || inst.state === undefined) {
3103
- var componentName = getComponentName(Component) || 'Unknown';
3104
-
3105
- if (!didWarnAboutUninitializedState[componentName]) {
3106
- 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, inst.state === null ? 'null' : 'undefined', componentName);
3107
-
3108
- didWarnAboutUninitializedState[componentName] = true;
3109
- }
3110
- }
3111
- }
3112
-
3113
- var partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
3114
-
3115
- {
3116
- if (partialState === undefined) {
3117
- var _componentName = getComponentName(Component) || 'Unknown';
3118
-
3119
- if (!didWarnAboutUndefinedDerivedState[_componentName]) {
3120
- error('%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', _componentName);
3121
-
3122
- didWarnAboutUndefinedDerivedState[_componentName] = true;
3123
- }
3124
- }
3125
- }
3126
-
3127
- if (partialState != null) {
3128
- inst.state = _assign({}, inst.state, partialState);
3129
- }
3130
- }
3131
- } else {
3132
- {
3133
- if (Component.prototype && typeof Component.prototype.render === 'function') {
3134
- var _componentName2 = getComponentName(Component) || 'Unknown';
3135
-
3136
- if (!didWarnAboutBadClass[_componentName2]) {
3137
- 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.', _componentName2, _componentName2);
3138
-
3139
- didWarnAboutBadClass[_componentName2] = true;
3140
- }
3141
- }
3142
- }
3143
-
3144
- var componentIdentity = {};
3145
- prepareToUseHooks(componentIdentity);
3146
- inst = Component(element.props, publicContext, updater);
3147
- inst = finishHooks(Component, element.props, inst, publicContext);
3148
-
3149
- if (inst == null || inst.render == null) {
3150
- child = inst;
3151
- validateRenderResult(child, Component);
3152
- return;
3153
- }
3154
-
3155
- {
3156
- var _componentName3 = getComponentName(Component) || 'Unknown';
3157
-
3158
- if (!didWarnAboutModulePatternComponent[_componentName3]) {
3159
- 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.', _componentName3, _componentName3, _componentName3);
3160
-
3161
- didWarnAboutModulePatternComponent[_componentName3] = true;
3162
- }
3163
- }
3164
- }
3165
-
3166
- inst.props = element.props;
3167
- inst.context = publicContext;
3168
- inst.updater = updater;
3169
- var initialState = inst.state;
3170
-
3171
- if (initialState === undefined) {
3172
- inst.state = initialState = null;
3173
- }
3174
-
3175
- if (typeof inst.UNSAFE_componentWillMount === 'function' || typeof inst.componentWillMount === 'function') {
3176
- if (typeof inst.componentWillMount === 'function') {
3177
- {
3178
- if ( inst.componentWillMount.__suppressDeprecationWarning !== true) {
3179
- var _componentName4 = getComponentName(Component) || 'Unknown';
3180
-
3181
- if (!didWarnAboutDeprecatedWillMount[_componentName4]) {
3182
- warn( // keep this warning in sync with ReactStrictModeWarning.js
3183
- 'componentWillMount has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-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', _componentName4);
3184
-
3185
- didWarnAboutDeprecatedWillMount[_componentName4] = true;
3186
- }
3187
- }
3188
- } // In order to support react-lifecycles-compat polyfilled components,
3189
- // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
3190
-
3191
-
3192
- if (typeof Component.getDerivedStateFromProps !== 'function') {
3193
- inst.componentWillMount();
3194
- }
3195
- }
3196
-
3197
- if (typeof inst.UNSAFE_componentWillMount === 'function' && typeof Component.getDerivedStateFromProps !== 'function') {
3198
- // In order to support react-lifecycles-compat polyfilled components,
3199
- // Unsafe lifecycles should not be invoked for any component with the new gDSFP.
3200
- inst.UNSAFE_componentWillMount();
3201
- }
3202
-
3203
- if (queue.length) {
3204
- var oldQueue = queue;
3205
- var oldReplace = replace;
3206
- queue = null;
3207
- replace = false;
3208
-
3209
- if (oldReplace && oldQueue.length === 1) {
3210
- inst.state = oldQueue[0];
3211
- } else {
3212
- var nextState = oldReplace ? oldQueue[0] : inst.state;
3213
- var dontMutate = true;
3214
-
3215
- for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
3216
- var partial = oldQueue[i];
3217
-
3218
- var _partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
3219
-
3220
- if (_partialState != null) {
3221
- if (dontMutate) {
3222
- dontMutate = false;
3223
- nextState = _assign({}, nextState, _partialState);
3224
- } else {
3225
- _assign(nextState, _partialState);
3226
- }
3227
- }
3228
- }
3229
-
3230
- inst.state = nextState;
3231
- }
3232
- } else {
3233
- queue = null;
3234
- }
3235
- }
3236
-
3237
- child = inst.render();
3238
-
3239
- {
3240
- if (child === undefined && inst.render._isMockFunction) {
3241
- // This is probably bad practice. Consider warning here and
3242
- // deprecating this convenience.
3243
- child = null;
3244
- }
3245
- }
3246
-
3247
- validateRenderResult(child, Component);
3248
- var childContext;
3249
-
3250
- {
3251
- if (typeof inst.getChildContext === 'function') {
3252
- var _childContextTypes = Component.childContextTypes;
3253
-
3254
- if (typeof _childContextTypes === 'object') {
3255
- childContext = inst.getChildContext();
3256
-
3257
- for (var contextKey in childContext) {
3258
- if (!(contextKey in _childContextTypes)) {
3259
- {
3260
- throw Error( (getComponentName(Component) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes." );
3261
- }
3262
- }
3263
- }
3264
- } else {
3265
- {
3266
- error('%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
3267
- }
3268
- }
3269
- }
3270
-
3271
- if (childContext) {
3272
- context = _assign({}, context, childContext);
3273
- }
3274
- }
3275
- }
3276
-
3277
- return {
3278
- child: child,
3279
- context: context
3280
- };
3281
- }
3282
-
3283
- var ReactDOMServerRenderer =
3284
- /*#__PURE__*/
3285
- function () {
3286
- // TODO: type this more strictly:
3287
- // DEV-only
3288
- function ReactDOMServerRenderer(children, makeStaticMarkup) {
3289
- var flatChildren = flattenTopLevelChildren(children);
3290
- var topFrame = {
3291
- type: null,
3292
- // Assume all trees start in the HTML namespace (not totally true, but
3293
- // this is what we did historically)
3294
- domNamespace: Namespaces.html,
3295
- children: flatChildren,
3296
- childIndex: 0,
3297
- context: emptyObject,
3298
- footer: ''
3299
- };
3300
-
3301
- {
3302
- topFrame.debugElementStack = [];
3303
- }
3304
-
3305
- this.threadID = allocThreadID();
3306
- this.stack = [topFrame];
3307
- this.exhausted = false;
3308
- this.currentSelectValue = null;
3309
- this.previousWasTextNode = false;
3310
- this.makeStaticMarkup = makeStaticMarkup;
3311
- this.suspenseDepth = 0; // Context (new API)
3312
-
3313
- this.contextIndex = -1;
3314
- this.contextStack = [];
3315
- this.contextValueStack = [];
3316
-
3317
- {
3318
- this.contextProviderStack = [];
3319
- }
3320
- }
3321
-
3322
- var _proto = ReactDOMServerRenderer.prototype;
3323
-
3324
- _proto.destroy = function destroy() {
3325
- if (!this.exhausted) {
3326
- this.exhausted = true;
3327
- this.clearProviders();
3328
- freeThreadID(this.threadID);
3329
- }
3330
- }
3331
- /**
3332
- * Note: We use just two stacks regardless of how many context providers you have.
3333
- * Providers are always popped in the reverse order to how they were pushed
3334
- * so we always know on the way down which provider you'll encounter next on the way up.
3335
- * On the way down, we push the current provider, and its context value *before*
3336
- * we mutated it, onto the stacks. Therefore, on the way up, we always know which
3337
- * provider needs to be "restored" to which value.
3338
- * https://github.com/facebook/react/pull/12985#issuecomment-396301248
3339
- */
3340
- ;
3341
-
3342
- _proto.pushProvider = function pushProvider(provider) {
3343
- var index = ++this.contextIndex;
3344
- var context = provider.type._context;
3345
- var threadID = this.threadID;
3346
- validateContextBounds(context, threadID);
3347
- var previousValue = context[threadID]; // Remember which value to restore this context to on our way up.
3348
-
3349
- this.contextStack[index] = context;
3350
- this.contextValueStack[index] = previousValue;
3351
-
3352
- {
3353
- // Only used for push/pop mismatch warnings.
3354
- this.contextProviderStack[index] = provider;
3355
- } // Mutate the current value.
3356
-
3357
-
3358
- context[threadID] = provider.props.value;
3359
- };
3360
-
3361
- _proto.popProvider = function popProvider(provider) {
3362
- var index = this.contextIndex;
3363
-
3364
- {
3365
- if (index < 0 || provider !== this.contextProviderStack[index]) {
3366
- error('Unexpected pop.');
3367
- }
3368
- }
3369
-
3370
- var context = this.contextStack[index];
3371
- var previousValue = this.contextValueStack[index]; // "Hide" these null assignments from Flow by using `any`
3372
- // because conceptually they are deletions--as long as we
3373
- // promise to never access values beyond `this.contextIndex`.
3374
-
3375
- this.contextStack[index] = null;
3376
- this.contextValueStack[index] = null;
3377
-
3378
- {
3379
- this.contextProviderStack[index] = null;
3380
- }
3381
-
3382
- this.contextIndex--; // Restore to the previous value we stored as we were walking down.
3383
- // We've already verified that this context has been expanded to accommodate
3384
- // this thread id, so we don't need to do it again.
3385
-
3386
- context[this.threadID] = previousValue;
3387
- };
3388
-
3389
- _proto.clearProviders = function clearProviders() {
3390
- // Restore any remaining providers on the stack to previous values
3391
- for (var index = this.contextIndex; index >= 0; index--) {
3392
- var context = this.contextStack[index];
3393
- var previousValue = this.contextValueStack[index];
3394
- context[this.threadID] = previousValue;
3395
- }
3396
- };
3397
-
3398
- _proto.read = function read(bytes) {
3399
- if (this.exhausted) {
3400
- return null;
3401
- }
3402
-
3403
- var prevThreadID = currentThreadID;
3404
- setCurrentThreadID(this.threadID);
3405
- var prevDispatcher = ReactCurrentDispatcher.current;
3406
- ReactCurrentDispatcher.current = Dispatcher;
3407
-
3408
- try {
3409
- // Markup generated within <Suspense> ends up buffered until we know
3410
- // nothing in that boundary suspended
3411
- var out = [''];
3412
- var suspended = false;
3413
-
3414
- while (out[0].length < bytes) {
3415
- if (this.stack.length === 0) {
3416
- this.exhausted = true;
3417
- freeThreadID(this.threadID);
3418
- break;
3419
- }
3420
-
3421
- var frame = this.stack[this.stack.length - 1];
3422
-
3423
- if (suspended || frame.childIndex >= frame.children.length) {
3424
- var footer = frame.footer;
3425
-
3426
- if (footer !== '') {
3427
- this.previousWasTextNode = false;
3428
- }
3429
-
3430
- this.stack.pop();
3431
-
3432
- if (frame.type === 'select') {
3433
- this.currentSelectValue = null;
3434
- } else if (frame.type != null && frame.type.type != null && frame.type.type.$$typeof === REACT_PROVIDER_TYPE) {
3435
- var provider = frame.type;
3436
- this.popProvider(provider);
3437
- } else if (frame.type === REACT_SUSPENSE_TYPE) {
3438
- this.suspenseDepth--;
3439
- var buffered = out.pop();
3440
-
3441
- if (suspended) {
3442
- suspended = false; // If rendering was suspended at this boundary, render the fallbackFrame
3443
-
3444
- var fallbackFrame = frame.fallbackFrame;
3445
-
3446
- if (!fallbackFrame) {
3447
- {
3448
- throw Error(true ? "ReactDOMServer did not find an internal fallback frame for Suspense. This is a bug in React. Please file an issue." : formatProdErrorMessage(303));
3449
- }
3450
- }
3451
-
3452
- this.stack.push(fallbackFrame);
3453
- out[this.suspenseDepth] += '<!--$!-->'; // Skip flushing output since we're switching to the fallback
3454
-
3455
- continue;
3456
- } else {
3457
- out[this.suspenseDepth] += buffered;
3458
- }
3459
- } // Flush output
3460
-
3461
-
3462
- out[this.suspenseDepth] += footer;
3463
- continue;
3464
- }
3465
-
3466
- var child = frame.children[frame.childIndex++];
3467
- var outBuffer = '';
3468
-
3469
- if (true) {
3470
- pushCurrentDebugStack(this.stack); // We're starting work on this frame, so reset its inner stack.
3471
-
3472
- frame.debugElementStack.length = 0;
3473
- }
3474
-
3475
- try {
3476
- outBuffer += this.render(child, frame.context, frame.domNamespace);
3477
- } catch (err) {
3478
- if (err != null && typeof err.then === 'function') {
3479
- if (enableSuspenseServerRenderer) {
3480
- if (!(this.suspenseDepth > 0)) {
3481
- {
3482
- throw Error(true ? "A React component suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display." : formatProdErrorMessage(342));
3483
- }
3484
- }
3485
-
3486
- suspended = true;
3487
- } else {
3488
- if (!false) {
3489
- {
3490
- throw Error(true ? "ReactDOMServer does not yet support Suspense." : formatProdErrorMessage(294));
3491
- }
3492
- }
3493
- }
3494
- } else {
3495
- throw err;
3496
- }
3497
- } finally {
3498
- if (true) {
3499
- popCurrentDebugStack();
3500
- }
3501
- }
3502
-
3503
- if (out.length <= this.suspenseDepth) {
3504
- out.push('');
3505
- }
3506
-
3507
- out[this.suspenseDepth] += outBuffer;
3508
- }
3509
-
3510
- return out[0];
3511
- } finally {
3512
- ReactCurrentDispatcher.current = prevDispatcher;
3513
- setCurrentThreadID(prevThreadID);
3514
- }
3515
- };
3516
-
3517
- _proto.render = function render(child, context, parentNamespace) {
3518
- if (typeof child === 'string' || typeof child === 'number') {
3519
- var text = '' + child;
3520
-
3521
- if (text === '') {
3522
- return '';
3523
- }
3524
-
3525
- if (this.makeStaticMarkup) {
3526
- return escapeTextForBrowser(text);
3527
- }
3528
-
3529
- if (this.previousWasTextNode) {
3530
- return '<!-- -->' + escapeTextForBrowser(text);
3531
- }
3532
-
3533
- this.previousWasTextNode = true;
3534
- return escapeTextForBrowser(text);
3535
- } else {
3536
- var nextChild;
3537
-
3538
- var _resolve = resolve(child, context, this.threadID);
3539
-
3540
- nextChild = _resolve.child;
3541
- context = _resolve.context;
3542
-
3543
- if (nextChild === null || nextChild === false) {
3544
- return '';
3545
- } else if (!React.isValidElement(nextChild)) {
3546
- if (nextChild != null && nextChild.$$typeof != null) {
3547
- // Catch unexpected special types early.
3548
- var $$typeof = nextChild.$$typeof;
3549
-
3550
- if (!($$typeof !== REACT_PORTAL_TYPE)) {
3551
- {
3552
- throw Error( "Portals are not currently supported by the server renderer. Render them conditionally so that they only appear on the client render." );
3553
- }
3554
- } // Catch-all to prevent an infinite loop if React.Children.toArray() supports some new type.
3555
-
3556
-
3557
- {
3558
- {
3559
- throw Error( "Unknown element-like object type: " + $$typeof.toString() + ". This is likely a bug in React. Please file an issue." );
3560
- }
3561
- }
3562
- }
3563
-
3564
- var nextChildren = toArray(nextChild);
3565
- var frame = {
3566
- type: null,
3567
- domNamespace: parentNamespace,
3568
- children: nextChildren,
3569
- childIndex: 0,
3570
- context: context,
3571
- footer: ''
3572
- };
3573
-
3574
- {
3575
- frame.debugElementStack = [];
3576
- }
3577
-
3578
- this.stack.push(frame);
3579
- return '';
3580
- } // Safe because we just checked it's an element.
3581
-
3582
-
3583
- var nextElement = nextChild;
3584
- var elementType = nextElement.type;
3585
-
3586
- if (typeof elementType === 'string') {
3587
- return this.renderDOM(nextElement, context, parentNamespace);
3588
- }
3589
-
3590
- switch (elementType) {
3591
- case REACT_STRICT_MODE_TYPE:
3592
- case REACT_CONCURRENT_MODE_TYPE:
3593
- case REACT_PROFILER_TYPE:
3594
- case REACT_SUSPENSE_LIST_TYPE:
3595
- case REACT_FRAGMENT_TYPE:
3596
- {
3597
- var _nextChildren = toArray(nextChild.props.children);
3598
-
3599
- var _frame = {
3600
- type: null,
3601
- domNamespace: parentNamespace,
3602
- children: _nextChildren,
3603
- childIndex: 0,
3604
- context: context,
3605
- footer: ''
3606
- };
3607
-
3608
- {
3609
- _frame.debugElementStack = [];
3610
- }
3611
-
3612
- this.stack.push(_frame);
3613
- return '';
3614
- }
3615
-
3616
- case REACT_SUSPENSE_TYPE:
3617
- {
3618
- {
3619
- {
3620
- {
3621
- throw Error( "ReactDOMServer does not yet support Suspense." );
3622
- }
3623
- }
3624
- }
3625
- }
3626
- }
3627
-
3628
- if (typeof elementType === 'object' && elementType !== null) {
3629
- switch (elementType.$$typeof) {
3630
- case REACT_FORWARD_REF_TYPE:
3631
- {
3632
- var element = nextChild;
3633
-
3634
- var _nextChildren4;
3635
-
3636
- var componentIdentity = {};
3637
- prepareToUseHooks(componentIdentity);
3638
- _nextChildren4 = elementType.render(element.props, element.ref);
3639
- _nextChildren4 = finishHooks(elementType.render, element.props, _nextChildren4, element.ref);
3640
- _nextChildren4 = toArray(_nextChildren4);
3641
- var _frame4 = {
3642
- type: null,
3643
- domNamespace: parentNamespace,
3644
- children: _nextChildren4,
3645
- childIndex: 0,
3646
- context: context,
3647
- footer: ''
3648
- };
3649
-
3650
- {
3651
- _frame4.debugElementStack = [];
3652
- }
3653
-
3654
- this.stack.push(_frame4);
3655
- return '';
3656
- }
3657
-
3658
- case REACT_MEMO_TYPE:
3659
- {
3660
- var _element = nextChild;
3661
- var _nextChildren5 = [React.createElement(elementType.type, _assign({
3662
- ref: _element.ref
3663
- }, _element.props))];
3664
- var _frame5 = {
3665
- type: null,
3666
- domNamespace: parentNamespace,
3667
- children: _nextChildren5,
3668
- childIndex: 0,
3669
- context: context,
3670
- footer: ''
3671
- };
3672
-
3673
- {
3674
- _frame5.debugElementStack = [];
3675
- }
3676
-
3677
- this.stack.push(_frame5);
3678
- return '';
3679
- }
3680
-
3681
- case REACT_PROVIDER_TYPE:
3682
- {
3683
- var provider = nextChild;
3684
- var nextProps = provider.props;
3685
-
3686
- var _nextChildren6 = toArray(nextProps.children);
3687
-
3688
- var _frame6 = {
3689
- type: provider,
3690
- domNamespace: parentNamespace,
3691
- children: _nextChildren6,
3692
- childIndex: 0,
3693
- context: context,
3694
- footer: ''
3695
- };
3696
-
3697
- {
3698
- _frame6.debugElementStack = [];
3699
- }
3700
-
3701
- this.pushProvider(provider);
3702
- this.stack.push(_frame6);
3703
- return '';
3704
- }
3705
-
3706
- case REACT_CONTEXT_TYPE:
3707
- {
3708
- var reactContext = nextChild.type; // The logic below for Context differs depending on PROD or DEV mode. In
3709
- // DEV mode, we create a separate object for Context.Consumer that acts
3710
- // like a proxy to Context. This proxy object adds unnecessary code in PROD
3711
- // so we use the old behaviour (Context.Consumer references Context) to
3712
- // reduce size and overhead. The separate object references context via
3713
- // a property called "_context", which also gives us the ability to check
3714
- // in DEV mode if this property exists or not and warn if it does not.
3715
-
3716
- {
3717
- if (reactContext._context === undefined) {
3718
- // This may be because it's a Context (rather than a Consumer).
3719
- // Or it may be because it's older React where they're the same thing.
3720
- // We only want to warn if we're sure it's a new React.
3721
- if (reactContext !== reactContext.Consumer) {
3722
- if (!hasWarnedAboutUsingContextAsConsumer) {
3723
- hasWarnedAboutUsingContextAsConsumer = true;
3724
-
3725
- error('Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
3726
- }
3727
- }
3728
- } else {
3729
- reactContext = reactContext._context;
3730
- }
3731
- }
3732
-
3733
- var _nextProps = nextChild.props;
3734
- var threadID = this.threadID;
3735
- validateContextBounds(reactContext, threadID);
3736
- var nextValue = reactContext[threadID];
3737
-
3738
- var _nextChildren7 = toArray(_nextProps.children(nextValue));
3739
-
3740
- var _frame7 = {
3741
- type: nextChild,
3742
- domNamespace: parentNamespace,
3743
- children: _nextChildren7,
3744
- childIndex: 0,
3745
- context: context,
3746
- footer: ''
3747
- };
3748
-
3749
- {
3750
- _frame7.debugElementStack = [];
3751
- }
3752
-
3753
- this.stack.push(_frame7);
3754
- return '';
3755
- }
3756
- // eslint-disable-next-line-no-fallthrough
3757
-
3758
- case REACT_FUNDAMENTAL_TYPE:
3759
- {
3760
-
3761
- {
3762
- {
3763
- throw Error( "ReactDOMServer does not yet support the fundamental API." );
3764
- }
3765
- }
3766
- }
3767
- // eslint-disable-next-line-no-fallthrough
3768
-
3769
- case REACT_LAZY_TYPE:
3770
- {
3771
- var _element2 = nextChild;
3772
- var lazyComponent = nextChild.type; // Attempt to initialize lazy component regardless of whether the
3773
- // suspense server-side renderer is enabled so synchronously
3774
- // resolved constructors are supported.
3775
-
3776
- initializeLazyComponentType(lazyComponent);
3777
-
3778
- switch (lazyComponent._status) {
3779
- case Resolved:
3780
- {
3781
- var _nextChildren9 = [React.createElement(lazyComponent._result, _assign({
3782
- ref: _element2.ref
3783
- }, _element2.props))];
3784
- var _frame9 = {
3785
- type: null,
3786
- domNamespace: parentNamespace,
3787
- children: _nextChildren9,
3788
- childIndex: 0,
3789
- context: context,
3790
- footer: ''
3791
- };
3792
-
3793
- {
3794
- _frame9.debugElementStack = [];
3795
- }
3796
-
3797
- this.stack.push(_frame9);
3798
- return '';
3799
- }
3800
-
3801
- case Rejected:
3802
- throw lazyComponent._result;
3803
-
3804
- case Pending:
3805
- default:
3806
- {
3807
- {
3808
- throw Error( "ReactDOMServer does not yet support lazy-loaded components." );
3809
- }
3810
- }
3811
-
3812
- }
3813
- }
3814
- // eslint-disable-next-line-no-fallthrough
3815
-
3816
- case REACT_SCOPE_TYPE:
3817
- {
3818
-
3819
- {
3820
- {
3821
- throw Error( "ReactDOMServer does not yet support scope components." );
3822
- }
3823
- }
3824
- }
3825
- }
3826
- }
3827
-
3828
- var info = '';
3829
-
3830
- {
3831
- var owner = nextElement._owner;
3832
-
3833
- if (elementType === undefined || typeof elementType === 'object' && elementType !== null && Object.keys(elementType).length === 0) {
3834
- 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.';
3835
- }
3836
-
3837
- var ownerName = owner ? getComponentName(owner) : null;
3838
-
3839
- if (ownerName) {
3840
- info += '\n\nCheck the render method of `' + ownerName + '`.';
3841
- }
3842
- }
3843
-
3844
- {
3845
- {
3846
- throw Error( "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (elementType == null ? elementType : typeof elementType) + "." + info );
3847
- }
3848
- }
3849
- }
3850
- };
3851
-
3852
- _proto.renderDOM = function renderDOM(element, context, parentNamespace) {
3853
- var tag = element.type.toLowerCase();
3854
- var namespace = parentNamespace;
3855
-
3856
- if (parentNamespace === Namespaces.html) {
3857
- namespace = getIntrinsicNamespace(tag);
3858
- }
3859
-
3860
- {
3861
- if (namespace === Namespaces.html) {
3862
- // Should this check be gated by parent namespace? Not sure we want to
3863
- // allow <SVG> or <mATH>.
3864
- if (tag !== element.type) {
3865
- error('<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', element.type);
3866
- }
3867
- }
3868
- }
3869
-
3870
- validateDangerousTag(tag);
3871
- var props = element.props;
3872
-
3873
- if (tag === 'input') {
3874
- {
3875
- ReactControlledValuePropTypes.checkPropTypes('input', props);
3876
-
3877
- if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnDefaultChecked) {
3878
- 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://fb.me/react-controlled-components', 'A component', props.type);
3879
-
3880
- didWarnDefaultChecked = true;
3881
- }
3882
-
3883
- if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultInputValue) {
3884
- 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://fb.me/react-controlled-components', 'A component', props.type);
3885
-
3886
- didWarnDefaultInputValue = true;
3887
- }
3888
- }
3889
-
3890
- props = _assign({
3891
- type: undefined
3892
- }, props, {
3893
- defaultChecked: undefined,
3894
- defaultValue: undefined,
3895
- value: props.value != null ? props.value : props.defaultValue,
3896
- checked: props.checked != null ? props.checked : props.defaultChecked
3897
- });
3898
- } else if (tag === 'textarea') {
3899
- {
3900
- ReactControlledValuePropTypes.checkPropTypes('textarea', props);
3901
-
3902
- if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultTextareaValue) {
3903
- 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://fb.me/react-controlled-components');
3904
-
3905
- didWarnDefaultTextareaValue = true;
3906
- }
3907
- }
3908
-
3909
- var initialValue = props.value;
3910
-
3911
- if (initialValue == null) {
3912
- var defaultValue = props.defaultValue; // TODO (yungsters): Remove support for children content in <textarea>.
3913
-
3914
- var textareaChildren = props.children;
3915
-
3916
- if (textareaChildren != null) {
3917
- {
3918
- error('Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
3919
- }
3920
-
3921
- if (!(defaultValue == null)) {
3922
- {
3923
- throw Error( "If you supply `defaultValue` on a <textarea>, do not pass children." );
3924
- }
3925
- }
3926
-
3927
- if (Array.isArray(textareaChildren)) {
3928
- if (!(textareaChildren.length <= 1)) {
3929
- {
3930
- throw Error( "<textarea> can only have at most one child." );
3931
- }
3932
- }
3933
-
3934
- textareaChildren = textareaChildren[0];
3935
- }
3936
-
3937
- defaultValue = '' + textareaChildren;
3938
- }
3939
-
3940
- if (defaultValue == null) {
3941
- defaultValue = '';
3942
- }
3943
-
3944
- initialValue = defaultValue;
3945
- }
3946
-
3947
- props = _assign({}, props, {
3948
- value: undefined,
3949
- children: '' + initialValue
3950
- });
3951
- } else if (tag === 'select') {
3952
- {
3953
- ReactControlledValuePropTypes.checkPropTypes('select', props);
3954
-
3955
- for (var i = 0; i < valuePropNames.length; i++) {
3956
- var propName = valuePropNames[i];
3957
-
3958
- if (props[propName] == null) {
3959
- continue;
3960
- }
3961
-
3962
- var isArray = Array.isArray(props[propName]);
3963
-
3964
- if (props.multiple && !isArray) {
3965
- error('The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.', propName);
3966
- } else if (!props.multiple && isArray) {
3967
- error('The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.', propName);
3968
- }
3969
- }
3970
-
3971
- if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultSelectValue) {
3972
- 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://fb.me/react-controlled-components');
3973
-
3974
- didWarnDefaultSelectValue = true;
3975
- }
3976
- }
3977
-
3978
- this.currentSelectValue = props.value != null ? props.value : props.defaultValue;
3979
- props = _assign({}, props, {
3980
- value: undefined
3981
- });
3982
- } else if (tag === 'option') {
3983
- var selected = null;
3984
- var selectValue = this.currentSelectValue;
3985
- var optionChildren = flattenOptionChildren(props.children);
3986
-
3987
- if (selectValue != null) {
3988
- var value;
3989
-
3990
- if (props.value != null) {
3991
- value = props.value + '';
3992
- } else {
3993
- value = optionChildren;
3994
- }
3995
-
3996
- selected = false;
3997
-
3998
- if (Array.isArray(selectValue)) {
3999
- // multiple
4000
- for (var j = 0; j < selectValue.length; j++) {
4001
- if ('' + selectValue[j] === value) {
4002
- selected = true;
4003
- break;
4004
- }
4005
- }
4006
- } else {
4007
- selected = '' + selectValue === value;
4008
- }
4009
-
4010
- props = _assign({
4011
- selected: undefined,
4012
- children: undefined
4013
- }, props, {
4014
- selected: selected,
4015
- children: optionChildren
4016
- });
4017
- }
4018
- }
4019
-
4020
- {
4021
- validatePropertiesInDevelopment(tag, props);
4022
- }
4023
-
4024
- assertValidProps(tag, props);
4025
- var out = createOpenTagMarkup(element.type, tag, props, namespace, this.makeStaticMarkup, this.stack.length === 1);
4026
- var footer = '';
4027
-
4028
- if (omittedCloseTags.hasOwnProperty(tag)) {
4029
- out += '/>';
4030
- } else {
4031
- out += '>';
4032
- footer = '</' + element.type + '>';
4033
- }
4034
-
4035
- var children;
4036
- var innerMarkup = getNonChildrenInnerMarkup(props);
4037
-
4038
- if (innerMarkup != null) {
4039
- children = [];
4040
-
4041
- if (newlineEatingTags.hasOwnProperty(tag) && innerMarkup.charAt(0) === '\n') {
4042
- // text/html ignores the first character in these tags if it's a newline
4043
- // Prefer to break application/xml over text/html (for now) by adding
4044
- // a newline specifically to get eaten by the parser. (Alternately for
4045
- // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
4046
- // \r is normalized out by HTMLTextAreaElement#value.)
4047
- // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
4048
- // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
4049
- // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
4050
- // See: Parsing of "textarea" "listing" and "pre" elements
4051
- // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
4052
- out += '\n';
4053
- }
4054
-
4055
- out += innerMarkup;
4056
- } else {
4057
- children = toArray(props.children);
4058
- }
4059
-
4060
- var frame = {
4061
- domNamespace: getChildNamespace(parentNamespace, element.type),
4062
- type: tag,
4063
- children: children,
4064
- childIndex: 0,
4065
- context: context,
4066
- footer: footer
4067
- };
4068
-
4069
- {
4070
- frame.debugElementStack = [];
4071
- }
4072
-
4073
- this.stack.push(frame);
4074
- this.previousWasTextNode = false;
4075
- return out;
4076
- };
4077
-
4078
- return ReactDOMServerRenderer;
4079
- }();
4080
-
4081
- /**
4082
- * Render a ReactElement to its initial HTML. This should only be used on the
4083
- * server.
4084
- * See https://reactjs.org/docs/react-dom-server.html#rendertostring
4085
- */
4086
-
4087
- function renderToString(element) {
4088
- var renderer = new ReactDOMServerRenderer(element, false);
4089
-
4090
- try {
4091
- var markup = renderer.read(Infinity);
4092
- return markup;
4093
- } finally {
4094
- renderer.destroy();
4095
- }
4096
- }
4097
- /**
4098
- * Similar to renderToString, except this doesn't create extra DOM attributes
4099
- * such as data-react-id that React uses internally.
4100
- * See https://reactjs.org/docs/react-dom-server.html#rendertostaticmarkup
4101
- */
4102
-
4103
- function renderToStaticMarkup(element) {
4104
- var renderer = new ReactDOMServerRenderer(element, true);
4105
-
4106
- try {
4107
- var markup = renderer.read(Infinity);
4108
- return markup;
4109
- } finally {
4110
- renderer.destroy();
4111
- }
4112
- }
4113
-
4114
- function renderToNodeStream() {
4115
- {
4116
- {
4117
- throw Error( "ReactDOMServer.renderToNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToString() instead." );
4118
- }
4119
- }
4120
- }
4121
-
4122
- function renderToStaticNodeStream() {
4123
- {
4124
- {
4125
- throw Error( "ReactDOMServer.renderToStaticNodeStream(): The streaming API is not available in the browser. Use ReactDOMServer.renderToStaticMarkup() instead." );
4126
- }
4127
- }
4128
- } // Note: when changing this, also consider https://github.com/facebook/react/issues/11526
4129
-
4130
-
4131
- var ReactDOMServer = {
4132
- renderToString: renderToString,
4133
- renderToStaticMarkup: renderToStaticMarkup,
4134
- renderToNodeStream: renderToNodeStream,
4135
- renderToStaticNodeStream: renderToStaticNodeStream,
4136
- version: ReactVersion
4137
- };
4138
-
4139
- // TODO: decide on the top-level export form.
4140
- // This is hacky but makes it work with both Rollup and Jest
4141
-
4142
-
4143
- var server_browser = ReactDOMServer.default || ReactDOMServer;
4144
-
4145
- return server_browser;
4146
-
4147
- })));