UNPKG

14 kBJavaScriptView Raw
1/**
2 * @license React
3 * react-jsx-runtime.react-server.development.js
4 *
5 * Copyright (c) Meta Platforms, Inc. and affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */
10
11"use strict";
12"production" !== process.env.NODE_ENV &&
13 (function () {
14 function getComponentNameFromType(type) {
15 if (null == type) return null;
16 if ("function" === typeof type)
17 return type.$$typeof === REACT_CLIENT_REFERENCE
18 ? null
19 : type.displayName || type.name || null;
20 if ("string" === typeof type) return type;
21 switch (type) {
22 case REACT_FRAGMENT_TYPE:
23 return "Fragment";
24 case REACT_PROFILER_TYPE:
25 return "Profiler";
26 case REACT_STRICT_MODE_TYPE:
27 return "StrictMode";
28 case REACT_SUSPENSE_TYPE:
29 return "Suspense";
30 case REACT_SUSPENSE_LIST_TYPE:
31 return "SuspenseList";
32 case REACT_ACTIVITY_TYPE:
33 return "Activity";
34 case REACT_VIEW_TRANSITION_TYPE:
35 return "ViewTransition";
36 }
37 if ("object" === typeof type)
38 switch (
39 ("number" === typeof type.tag &&
40 console.error(
41 "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
42 ),
43 type.$$typeof)
44 ) {
45 case REACT_PORTAL_TYPE:
46 return "Portal";
47 case REACT_CONTEXT_TYPE:
48 return type.displayName || "Context";
49 case REACT_CONSUMER_TYPE:
50 return (type._context.displayName || "Context") + ".Consumer";
51 case REACT_FORWARD_REF_TYPE:
52 var innerType = type.render;
53 type = type.displayName;
54 type ||
55 ((type = innerType.displayName || innerType.name || ""),
56 (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
57 return type;
58 case REACT_MEMO_TYPE:
59 return (
60 (innerType = type.displayName || null),
61 null !== innerType
62 ? innerType
63 : getComponentNameFromType(type.type) || "Memo"
64 );
65 case REACT_LAZY_TYPE:
66 innerType = type._payload;
67 type = type._init;
68 try {
69 return getComponentNameFromType(type(innerType));
70 } catch (x) {}
71 }
72 return null;
73 }
74 function testStringCoercion(value) {
75 return "" + value;
76 }
77 function checkKeyStringCoercion(value) {
78 try {
79 testStringCoercion(value);
80 var JSCompiler_inline_result = !1;
81 } catch (e) {
82 JSCompiler_inline_result = !0;
83 }
84 if (JSCompiler_inline_result) {
85 JSCompiler_inline_result = console;
86 var JSCompiler_temp_const = JSCompiler_inline_result.error;
87 var JSCompiler_inline_result$jscomp$0 =
88 ("function" === typeof Symbol &&
89 Symbol.toStringTag &&
90 value[Symbol.toStringTag]) ||
91 value.constructor.name ||
92 "Object";
93 JSCompiler_temp_const.call(
94 JSCompiler_inline_result,
95 "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
96 JSCompiler_inline_result$jscomp$0
97 );
98 return testStringCoercion(value);
99 }
100 }
101 function getTaskName(type) {
102 if (type === REACT_FRAGMENT_TYPE) return "<>";
103 if (
104 "object" === typeof type &&
105 null !== type &&
106 type.$$typeof === REACT_LAZY_TYPE
107 )
108 return "<...>";
109 try {
110 var name = getComponentNameFromType(type);
111 return name ? "<" + name + ">" : "<...>";
112 } catch (x) {
113 return "<...>";
114 }
115 }
116 function getOwner() {
117 var dispatcher = ReactSharedInternalsServer.A;
118 return null === dispatcher ? null : dispatcher.getOwner();
119 }
120 function UnknownOwner() {
121 return Error("react-stack-top-frame");
122 }
123 function hasValidKey(config) {
124 if (hasOwnProperty.call(config, "key")) {
125 var getter = Object.getOwnPropertyDescriptor(config, "key").get;
126 if (getter && getter.isReactWarning) return !1;
127 }
128 return void 0 !== config.key;
129 }
130 function defineKeyPropWarningGetter(props, displayName) {
131 function warnAboutAccessingKey() {
132 specialPropKeyWarningShown ||
133 ((specialPropKeyWarningShown = !0),
134 console.error(
135 "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
136 displayName
137 ));
138 }
139 warnAboutAccessingKey.isReactWarning = !0;
140 Object.defineProperty(props, "key", {
141 get: warnAboutAccessingKey,
142 configurable: !0
143 });
144 }
145 function elementRefGetterWithDeprecationWarning() {
146 var componentName = getComponentNameFromType(this.type);
147 didWarnAboutElementRef[componentName] ||
148 ((didWarnAboutElementRef[componentName] = !0),
149 console.error(
150 "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
151 ));
152 componentName = this.props.ref;
153 return void 0 !== componentName ? componentName : null;
154 }
155 function ReactElement(type, key, props, owner, debugStack, debugTask) {
156 var refProp = props.ref;
157 type = {
158 $$typeof: REACT_ELEMENT_TYPE,
159 type: type,
160 key: key,
161 props: props,
162 _owner: owner
163 };
164 null !== (void 0 !== refProp ? refProp : null)
165 ? Object.defineProperty(type, "ref", {
166 enumerable: !1,
167 get: elementRefGetterWithDeprecationWarning
168 })
169 : Object.defineProperty(type, "ref", { enumerable: !1, value: null });
170 type._store = {};
171 Object.defineProperty(type._store, "validated", {
172 configurable: !1,
173 enumerable: !1,
174 writable: !0,
175 value: 0
176 });
177 Object.defineProperty(type, "_debugInfo", {
178 configurable: !1,
179 enumerable: !1,
180 writable: !0,
181 value: null
182 });
183 Object.defineProperty(type, "_debugStack", {
184 configurable: !1,
185 enumerable: !1,
186 writable: !0,
187 value: debugStack
188 });
189 Object.defineProperty(type, "_debugTask", {
190 configurable: !1,
191 enumerable: !1,
192 writable: !0,
193 value: debugTask
194 });
195 Object.freeze && (Object.freeze(type.props), Object.freeze(type));
196 return type;
197 }
198 function jsxDEVImpl(
199 type,
200 config,
201 maybeKey,
202 isStaticChildren,
203 debugStack,
204 debugTask
205 ) {
206 var children = config.children;
207 if (void 0 !== children)
208 if (isStaticChildren)
209 if (isArrayImpl(children)) {
210 for (
211 isStaticChildren = 0;
212 isStaticChildren < children.length;
213 isStaticChildren++
214 )
215 validateChildKeys(children[isStaticChildren]);
216 Object.freeze && Object.freeze(children);
217 } else
218 console.error(
219 "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
220 );
221 else validateChildKeys(children);
222 if (hasOwnProperty.call(config, "key")) {
223 children = getComponentNameFromType(type);
224 var keys = Object.keys(config).filter(function (k) {
225 return "key" !== k;
226 });
227 isStaticChildren =
228 0 < keys.length
229 ? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
230 : "{key: someKey}";
231 didWarnAboutKeySpread[children + isStaticChildren] ||
232 ((keys =
233 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
234 console.error(
235 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
236 isStaticChildren,
237 children,
238 keys,
239 children
240 ),
241 (didWarnAboutKeySpread[children + isStaticChildren] = !0));
242 }
243 children = null;
244 void 0 !== maybeKey &&
245 (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
246 hasValidKey(config) &&
247 (checkKeyStringCoercion(config.key), (children = "" + config.key));
248 if ("key" in config) {
249 maybeKey = {};
250 for (var propName in config)
251 "key" !== propName && (maybeKey[propName] = config[propName]);
252 } else maybeKey = config;
253 children &&
254 defineKeyPropWarningGetter(
255 maybeKey,
256 "function" === typeof type
257 ? type.displayName || type.name || "Unknown"
258 : type
259 );
260 return ReactElement(
261 type,
262 children,
263 maybeKey,
264 getOwner(),
265 debugStack,
266 debugTask
267 );
268 }
269 function validateChildKeys(node) {
270 isValidElement(node)
271 ? node._store && (node._store.validated = 1)
272 : "object" === typeof node &&
273 null !== node &&
274 node.$$typeof === REACT_LAZY_TYPE &&
275 ("fulfilled" === node._payload.status
276 ? isValidElement(node._payload.value) &&
277 node._payload.value._store &&
278 (node._payload.value._store.validated = 1)
279 : node._store && (node._store.validated = 1));
280 }
281 function isValidElement(object) {
282 return (
283 "object" === typeof object &&
284 null !== object &&
285 object.$$typeof === REACT_ELEMENT_TYPE
286 );
287 }
288 var React = require("react"),
289 REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
290 REACT_PORTAL_TYPE = Symbol.for("react.portal"),
291 REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
292 REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
293 REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
294 REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
295 REACT_CONTEXT_TYPE = Symbol.for("react.context"),
296 REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
297 REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
298 REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
299 REACT_MEMO_TYPE = Symbol.for("react.memo"),
300 REACT_LAZY_TYPE = Symbol.for("react.lazy"),
301 REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
302 REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
303 REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
304 ReactSharedInternalsServer =
305 React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
306 if (!ReactSharedInternalsServer)
307 throw Error(
308 'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
309 );
310 var hasOwnProperty = Object.prototype.hasOwnProperty,
311 isArrayImpl = Array.isArray,
312 createTask = console.createTask
313 ? console.createTask
314 : function () {
315 return null;
316 };
317 React = {
318 react_stack_bottom_frame: function (callStackForError) {
319 return callStackForError();
320 }
321 };
322 var specialPropKeyWarningShown;
323 var didWarnAboutElementRef = {};
324 var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
325 React,
326 UnknownOwner
327 )();
328 var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
329 var didWarnAboutKeySpread = {};
330 exports.Fragment = REACT_FRAGMENT_TYPE;
331 exports.jsx = function (type, config, maybeKey) {
332 var trackActualOwner =
333 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++;
334 if (trackActualOwner) {
335 var previousStackTraceLimit = Error.stackTraceLimit;
336 Error.stackTraceLimit = 10;
337 var debugStackDEV = Error("react-stack-top-frame");
338 Error.stackTraceLimit = previousStackTraceLimit;
339 } else debugStackDEV = unknownOwnerDebugStack;
340 return jsxDEVImpl(
341 type,
342 config,
343 maybeKey,
344 !1,
345 debugStackDEV,
346 trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
347 );
348 };
349 exports.jsxDEV = function (type, config, maybeKey, isStaticChildren) {
350 var trackActualOwner =
351 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++;
352 if (trackActualOwner) {
353 var previousStackTraceLimit = Error.stackTraceLimit;
354 Error.stackTraceLimit = 10;
355 var debugStackDEV = Error("react-stack-top-frame");
356 Error.stackTraceLimit = previousStackTraceLimit;
357 } else debugStackDEV = unknownOwnerDebugStack;
358 return jsxDEVImpl(
359 type,
360 config,
361 maybeKey,
362 isStaticChildren,
363 debugStackDEV,
364 trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
365 );
366 };
367 exports.jsxs = function (type, config, maybeKey) {
368 var trackActualOwner =
369 1e4 > ReactSharedInternalsServer.recentlyCreatedOwnerStacks++;
370 if (trackActualOwner) {
371 var previousStackTraceLimit = Error.stackTraceLimit;
372 Error.stackTraceLimit = 10;
373 var debugStackDEV = Error("react-stack-top-frame");
374 Error.stackTraceLimit = previousStackTraceLimit;
375 } else debugStackDEV = unknownOwnerDebugStack;
376 return jsxDEVImpl(
377 type,
378 config,
379 maybeKey,
380 !0,
381 debugStackDEV,
382 trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
383 );
384 };
385 })();