UNPKG

18 kBJavaScriptView Raw
1/**
2 * @license React
3 * react.production.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";
12var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
13 REACT_PORTAL_TYPE = Symbol.for("react.portal"),
14 REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
15 REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
16 REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
17 REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
18 REACT_CONTEXT_TYPE = Symbol.for("react.context"),
19 REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
20 REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
21 REACT_MEMO_TYPE = Symbol.for("react.memo"),
22 REACT_LAZY_TYPE = Symbol.for("react.lazy"),
23 REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
24 REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
25 MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
26function getIteratorFn(maybeIterable) {
27 if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
28 maybeIterable =
29 (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
30 maybeIterable["@@iterator"];
31 return "function" === typeof maybeIterable ? maybeIterable : null;
32}
33var ReactNoopUpdateQueue = {
34 isMounted: function () {
35 return !1;
36 },
37 enqueueForceUpdate: function () {},
38 enqueueReplaceState: function () {},
39 enqueueSetState: function () {}
40 },
41 assign = Object.assign,
42 emptyObject = {};
43function Component(props, context, updater) {
44 this.props = props;
45 this.context = context;
46 this.refs = emptyObject;
47 this.updater = updater || ReactNoopUpdateQueue;
48}
49Component.prototype.isReactComponent = {};
50Component.prototype.setState = function (partialState, callback) {
51 if (
52 "object" !== typeof partialState &&
53 "function" !== typeof partialState &&
54 null != partialState
55 )
56 throw Error(
57 "takes an object of state variables to update or a function which returns an object of state variables."
58 );
59 this.updater.enqueueSetState(this, partialState, callback, "setState");
60};
61Component.prototype.forceUpdate = function (callback) {
62 this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
63};
64function ComponentDummy() {}
65ComponentDummy.prototype = Component.prototype;
66function PureComponent(props, context, updater) {
67 this.props = props;
68 this.context = context;
69 this.refs = emptyObject;
70 this.updater = updater || ReactNoopUpdateQueue;
71}
72var pureComponentPrototype = (PureComponent.prototype = new ComponentDummy());
73pureComponentPrototype.constructor = PureComponent;
74assign(pureComponentPrototype, Component.prototype);
75pureComponentPrototype.isPureReactComponent = !0;
76var isArrayImpl = Array.isArray;
77function noop() {}
78var ReactSharedInternals = { H: null, A: null, T: null, S: null },
79 hasOwnProperty = Object.prototype.hasOwnProperty;
80function ReactElement(type, key, props) {
81 var refProp = props.ref;
82 return {
83 $$typeof: REACT_ELEMENT_TYPE,
84 type: type,
85 key: key,
86 ref: void 0 !== refProp ? refProp : null,
87 props: props
88 };
89}
90function cloneAndReplaceKey(oldElement, newKey) {
91 return ReactElement(oldElement.type, newKey, oldElement.props);
92}
93function isValidElement(object) {
94 return (
95 "object" === typeof object &&
96 null !== object &&
97 object.$$typeof === REACT_ELEMENT_TYPE
98 );
99}
100function escape(key) {
101 var escaperLookup = { "=": "=0", ":": "=2" };
102 return (
103 "$" +
104 key.replace(/[=:]/g, function (match) {
105 return escaperLookup[match];
106 })
107 );
108}
109var userProvidedKeyEscapeRegex = /\/+/g;
110function getElementKey(element, index) {
111 return "object" === typeof element && null !== element && null != element.key
112 ? escape("" + element.key)
113 : index.toString(36);
114}
115function resolveThenable(thenable) {
116 switch (thenable.status) {
117 case "fulfilled":
118 return thenable.value;
119 case "rejected":
120 throw thenable.reason;
121 default:
122 switch (
123 ("string" === typeof thenable.status
124 ? thenable.then(noop, noop)
125 : ((thenable.status = "pending"),
126 thenable.then(
127 function (fulfilledValue) {
128 "pending" === thenable.status &&
129 ((thenable.status = "fulfilled"),
130 (thenable.value = fulfilledValue));
131 },
132 function (error) {
133 "pending" === thenable.status &&
134 ((thenable.status = "rejected"), (thenable.reason = error));
135 }
136 )),
137 thenable.status)
138 ) {
139 case "fulfilled":
140 return thenable.value;
141 case "rejected":
142 throw thenable.reason;
143 }
144 }
145 throw thenable;
146}
147function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
148 var type = typeof children;
149 if ("undefined" === type || "boolean" === type) children = null;
150 var invokeCallback = !1;
151 if (null === children) invokeCallback = !0;
152 else
153 switch (type) {
154 case "bigint":
155 case "string":
156 case "number":
157 invokeCallback = !0;
158 break;
159 case "object":
160 switch (children.$$typeof) {
161 case REACT_ELEMENT_TYPE:
162 case REACT_PORTAL_TYPE:
163 invokeCallback = !0;
164 break;
165 case REACT_LAZY_TYPE:
166 return (
167 (invokeCallback = children._init),
168 mapIntoArray(
169 invokeCallback(children._payload),
170 array,
171 escapedPrefix,
172 nameSoFar,
173 callback
174 )
175 );
176 }
177 }
178 if (invokeCallback)
179 return (
180 (callback = callback(children)),
181 (invokeCallback =
182 "" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar),
183 isArrayImpl(callback)
184 ? ((escapedPrefix = ""),
185 null != invokeCallback &&
186 (escapedPrefix =
187 invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
188 mapIntoArray(callback, array, escapedPrefix, "", function (c) {
189 return c;
190 }))
191 : null != callback &&
192 (isValidElement(callback) &&
193 (callback = cloneAndReplaceKey(
194 callback,
195 escapedPrefix +
196 (null == callback.key ||
197 (children && children.key === callback.key)
198 ? ""
199 : ("" + callback.key).replace(
200 userProvidedKeyEscapeRegex,
201 "$&/"
202 ) + "/") +
203 invokeCallback
204 )),
205 array.push(callback)),
206 1
207 );
208 invokeCallback = 0;
209 var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
210 if (isArrayImpl(children))
211 for (var i = 0; i < children.length; i++)
212 (nameSoFar = children[i]),
213 (type = nextNamePrefix + getElementKey(nameSoFar, i)),
214 (invokeCallback += mapIntoArray(
215 nameSoFar,
216 array,
217 escapedPrefix,
218 type,
219 callback
220 ));
221 else if (((i = getIteratorFn(children)), "function" === typeof i))
222 for (
223 children = i.call(children), i = 0;
224 !(nameSoFar = children.next()).done;
225
226 )
227 (nameSoFar = nameSoFar.value),
228 (type = nextNamePrefix + getElementKey(nameSoFar, i++)),
229 (invokeCallback += mapIntoArray(
230 nameSoFar,
231 array,
232 escapedPrefix,
233 type,
234 callback
235 ));
236 else if ("object" === type) {
237 if ("function" === typeof children.then)
238 return mapIntoArray(
239 resolveThenable(children),
240 array,
241 escapedPrefix,
242 nameSoFar,
243 callback
244 );
245 array = String(children);
246 throw Error(
247 "Objects are not valid as a React child (found: " +
248 ("[object Object]" === array
249 ? "object with keys {" + Object.keys(children).join(", ") + "}"
250 : array) +
251 "). If you meant to render a collection of children, use an array instead."
252 );
253 }
254 return invokeCallback;
255}
256function mapChildren(children, func, context) {
257 if (null == children) return children;
258 var result = [],
259 count = 0;
260 mapIntoArray(children, result, "", "", function (child) {
261 return func.call(context, child, count++);
262 });
263 return result;
264}
265function lazyInitializer(payload) {
266 if (-1 === payload._status) {
267 var ctor = payload._result,
268 thenable = ctor();
269 thenable.then(
270 function (moduleObject) {
271 if (0 === payload._status || -1 === payload._status)
272 (payload._status = 1),
273 (payload._result = moduleObject),
274 void 0 === thenable.status &&
275 ((thenable.status = "fulfilled"),
276 (thenable.value = moduleObject));
277 },
278 function (error) {
279 if (0 === payload._status || -1 === payload._status)
280 (payload._status = 2),
281 (payload._result = error),
282 void 0 === thenable.status &&
283 ((thenable.status = "rejected"), (thenable.reason = error));
284 }
285 );
286 -1 === payload._status &&
287 ((payload._status = 0), (payload._result = thenable));
288 }
289 if (1 === payload._status) return payload._result.default;
290 throw payload._result;
291}
292var reportGlobalError =
293 "function" === typeof reportError
294 ? reportError
295 : function (error) {
296 if (
297 "object" === typeof window &&
298 "function" === typeof window.ErrorEvent
299 ) {
300 var event = new window.ErrorEvent("error", {
301 bubbles: !0,
302 cancelable: !0,
303 message:
304 "object" === typeof error &&
305 null !== error &&
306 "string" === typeof error.message
307 ? String(error.message)
308 : String(error),
309 error: error
310 });
311 if (!window.dispatchEvent(event)) return;
312 } else if (
313 "object" === typeof process &&
314 "function" === typeof process.emit
315 ) {
316 process.emit("uncaughtException", error);
317 return;
318 }
319 console.error(error);
320 };
321function startTransition(scope) {
322 var prevTransition = ReactSharedInternals.T,
323 currentTransition = {};
324 currentTransition.types =
325 null !== prevTransition ? prevTransition.types : null;
326 ReactSharedInternals.T = currentTransition;
327 try {
328 var returnValue = scope(),
329 onStartTransitionFinish = ReactSharedInternals.S;
330 null !== onStartTransitionFinish &&
331 onStartTransitionFinish(currentTransition, returnValue);
332 "object" === typeof returnValue &&
333 null !== returnValue &&
334 "function" === typeof returnValue.then &&
335 returnValue.then(noop, reportGlobalError);
336 } catch (error) {
337 reportGlobalError(error);
338 } finally {
339 null !== prevTransition &&
340 null !== currentTransition.types &&
341 (prevTransition.types = currentTransition.types),
342 (ReactSharedInternals.T = prevTransition);
343 }
344}
345function addTransitionType(type) {
346 var transition = ReactSharedInternals.T;
347 if (null !== transition) {
348 var transitionTypes = transition.types;
349 null === transitionTypes
350 ? (transition.types = [type])
351 : -1 === transitionTypes.indexOf(type) && transitionTypes.push(type);
352 } else startTransition(addTransitionType.bind(null, type));
353}
354var Children = {
355 map: mapChildren,
356 forEach: function (children, forEachFunc, forEachContext) {
357 mapChildren(
358 children,
359 function () {
360 forEachFunc.apply(this, arguments);
361 },
362 forEachContext
363 );
364 },
365 count: function (children) {
366 var n = 0;
367 mapChildren(children, function () {
368 n++;
369 });
370 return n;
371 },
372 toArray: function (children) {
373 return (
374 mapChildren(children, function (child) {
375 return child;
376 }) || []
377 );
378 },
379 only: function (children) {
380 if (!isValidElement(children))
381 throw Error(
382 "React.Children.only expected to receive a single React element child."
383 );
384 return children;
385 }
386};
387exports.Activity = REACT_ACTIVITY_TYPE;
388exports.Children = Children;
389exports.Component = Component;
390exports.Fragment = REACT_FRAGMENT_TYPE;
391exports.Profiler = REACT_PROFILER_TYPE;
392exports.PureComponent = PureComponent;
393exports.StrictMode = REACT_STRICT_MODE_TYPE;
394exports.Suspense = REACT_SUSPENSE_TYPE;
395exports.ViewTransition = REACT_VIEW_TRANSITION_TYPE;
396exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
397 ReactSharedInternals;
398exports.__COMPILER_RUNTIME = {
399 __proto__: null,
400 c: function (size) {
401 return ReactSharedInternals.H.useMemoCache(size);
402 }
403};
404exports.addTransitionType = addTransitionType;
405exports.cache = function (fn) {
406 return function () {
407 return fn.apply(null, arguments);
408 };
409};
410exports.cacheSignal = function () {
411 return null;
412};
413exports.cloneElement = function (element, config, children) {
414 if (null === element || void 0 === element)
415 throw Error(
416 "The argument must be a React element, but you passed " + element + "."
417 );
418 var props = assign({}, element.props),
419 key = element.key;
420 if (null != config)
421 for (propName in (void 0 !== config.key && (key = "" + config.key), config))
422 !hasOwnProperty.call(config, propName) ||
423 "key" === propName ||
424 "__self" === propName ||
425 "__source" === propName ||
426 ("ref" === propName && void 0 === config.ref) ||
427 (props[propName] = config[propName]);
428 var propName = arguments.length - 2;
429 if (1 === propName) props.children = children;
430 else if (1 < propName) {
431 for (var childArray = Array(propName), i = 0; i < propName; i++)
432 childArray[i] = arguments[i + 2];
433 props.children = childArray;
434 }
435 return ReactElement(element.type, key, props);
436};
437exports.createContext = function (defaultValue) {
438 defaultValue = {
439 $$typeof: REACT_CONTEXT_TYPE,
440 _currentValue: defaultValue,
441 _currentValue2: defaultValue,
442 _threadCount: 0,
443 Provider: null,
444 Consumer: null
445 };
446 defaultValue.Provider = defaultValue;
447 defaultValue.Consumer = {
448 $$typeof: REACT_CONSUMER_TYPE,
449 _context: defaultValue
450 };
451 return defaultValue;
452};
453exports.createElement = function (type, config, children) {
454 var propName,
455 props = {},
456 key = null;
457 if (null != config)
458 for (propName in (void 0 !== config.key && (key = "" + config.key), config))
459 hasOwnProperty.call(config, propName) &&
460 "key" !== propName &&
461 "__self" !== propName &&
462 "__source" !== propName &&
463 (props[propName] = config[propName]);
464 var childrenLength = arguments.length - 2;
465 if (1 === childrenLength) props.children = children;
466 else if (1 < childrenLength) {
467 for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
468 childArray[i] = arguments[i + 2];
469 props.children = childArray;
470 }
471 if (type && type.defaultProps)
472 for (propName in ((childrenLength = type.defaultProps), childrenLength))
473 void 0 === props[propName] &&
474 (props[propName] = childrenLength[propName]);
475 return ReactElement(type, key, props);
476};
477exports.createRef = function () {
478 return { current: null };
479};
480exports.forwardRef = function (render) {
481 return { $$typeof: REACT_FORWARD_REF_TYPE, render: render };
482};
483exports.isValidElement = isValidElement;
484exports.lazy = function (ctor) {
485 return {
486 $$typeof: REACT_LAZY_TYPE,
487 _payload: { _status: -1, _result: ctor },
488 _init: lazyInitializer
489 };
490};
491exports.memo = function (type, compare) {
492 return {
493 $$typeof: REACT_MEMO_TYPE,
494 type: type,
495 compare: void 0 === compare ? null : compare
496 };
497};
498exports.startTransition = startTransition;
499exports.unstable_useCacheRefresh = function () {
500 return ReactSharedInternals.H.useCacheRefresh();
501};
502exports.use = function (usable) {
503 return ReactSharedInternals.H.use(usable);
504};
505exports.useActionState = function (action, initialState, permalink) {
506 return ReactSharedInternals.H.useActionState(action, initialState, permalink);
507};
508exports.useCallback = function (callback, deps) {
509 return ReactSharedInternals.H.useCallback(callback, deps);
510};
511exports.useContext = function (Context) {
512 return ReactSharedInternals.H.useContext(Context);
513};
514exports.useDebugValue = function () {};
515exports.useDeferredValue = function (value, initialValue) {
516 return ReactSharedInternals.H.useDeferredValue(value, initialValue);
517};
518exports.useEffect = function (create, deps) {
519 return ReactSharedInternals.H.useEffect(create, deps);
520};
521exports.useEffectEvent = function (callback) {
522 return ReactSharedInternals.H.useEffectEvent(callback);
523};
524exports.useId = function () {
525 return ReactSharedInternals.H.useId();
526};
527exports.useImperativeHandle = function (ref, create, deps) {
528 return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);
529};
530exports.useInsertionEffect = function (create, deps) {
531 return ReactSharedInternals.H.useInsertionEffect(create, deps);
532};
533exports.useLayoutEffect = function (create, deps) {
534 return ReactSharedInternals.H.useLayoutEffect(create, deps);
535};
536exports.useMemo = function (create, deps) {
537 return ReactSharedInternals.H.useMemo(create, deps);
538};
539exports.useOptimistic = function (passthrough, reducer) {
540 return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
541};
542exports.useReducer = function (reducer, initialArg, init) {
543 return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
544};
545exports.useRef = function (initialValue) {
546 return ReactSharedInternals.H.useRef(initialValue);
547};
548exports.useState = function (initialState) {
549 return ReactSharedInternals.H.useState(initialState);
550};
551exports.useSyncExternalStore = function (
552 subscribe,
553 getSnapshot,
554 getServerSnapshot
555) {
556 return ReactSharedInternals.H.useSyncExternalStore(
557 subscribe,
558 getSnapshot,
559 getServerSnapshot
560 );
561};
562exports.useTransition = function () {
563 return ReactSharedInternals.H.useTransition();
564};
565exports.version = "19.3.0";