UNPKG

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