UNPKG

react-on-rails-rsc

Version:

React Server Components support for react_on_rails Ruby gem

1,027 lines 172 kB
/** * @license React * react-server-dom-webpack-server.edge.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ "use strict"; "production" !== process.env.NODE_ENV && (function () { function voidHandler() { } function _defineProperty(obj, key, value) { key in obj ? Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }) : (obj[key] = value); return obj; } function handleErrorInNextTick(error) { setTimeout(function () { throw error; }); } function writeChunkAndReturn(destination, chunk) { if (0 !== chunk.byteLength) if (2048 < chunk.byteLength) 0 < writtenBytes && (destination.enqueue(new Uint8Array(currentView.buffer, 0, writtenBytes)), (currentView = new Uint8Array(2048)), (writtenBytes = 0)), destination.enqueue(chunk); else { var allowableBytes = currentView.length - writtenBytes; allowableBytes < chunk.byteLength && (0 === allowableBytes ? destination.enqueue(currentView) : (currentView.set(chunk.subarray(0, allowableBytes), writtenBytes), destination.enqueue(currentView), (chunk = chunk.subarray(allowableBytes))), (currentView = new Uint8Array(2048)), (writtenBytes = 0)); currentView.set(chunk, writtenBytes); writtenBytes += chunk.byteLength; } return !0; } function stringToChunk(content) { return textEncoder.encode(content); } function byteLengthOfChunk(chunk) { return chunk.byteLength; } function closeWithError(destination, error) { "function" === typeof destination.error ? destination.error(error) : destination.close(); } function isClientReference(reference) { return reference.$$typeof === CLIENT_REFERENCE_TAG$1; } function registerClientReferenceImpl(proxyImplementation, id, async) { return Object.defineProperties(proxyImplementation, { $$typeof: { value: CLIENT_REFERENCE_TAG$1 }, $$id: { value: id }, $$async: { value: async } }); } function bind() { var newFn = FunctionBind.apply(this, arguments); if (this.$$typeof === SERVER_REFERENCE_TAG) { null != arguments[0] && console.error('Cannot bind "this" of a Server Action. Pass null or undefined as the first argument to .bind().'); var args = ArraySlice.call(arguments, 1), $$typeof = { value: SERVER_REFERENCE_TAG }, $$id = { value: this.$$id }; args = { value: this.$$bound ? this.$$bound.concat(args) : args }; return Object.defineProperties(newFn, { $$typeof: $$typeof, $$id: $$id, $$bound: args, $$location: { value: this.$$location, configurable: !0 }, bind: { value: bind, configurable: !0 } }); } return newFn; } function getReference(target, name) { switch (name) { case "$$typeof": return target.$$typeof; case "$$id": return target.$$id; case "$$async": return target.$$async; case "name": return target.name; case "defaultProps": return; case "toJSON": return; case Symbol.toPrimitive: return Object.prototype[Symbol.toPrimitive]; case Symbol.toStringTag: return Object.prototype[Symbol.toStringTag]; case "__esModule": var moduleId = target.$$id; target.default = registerClientReferenceImpl(function () { throw Error("Attempted to call the default export of " + moduleId + " from the server but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."); }, target.$$id + "#", target.$$async); return !0; case "then": if (target.then) return target.then; if (target.$$async) return; var clientReference = registerClientReferenceImpl({}, target.$$id, !0), proxy = new Proxy(clientReference, proxyHandlers$1); target.status = "fulfilled"; target.value = proxy; return (target.then = registerClientReferenceImpl(function (resolve) { return Promise.resolve(resolve(proxy)); }, target.$$id + "#then", !1)); } if ("symbol" === typeof name) throw Error("Cannot read Symbol exports. Only named exports are supported on a client module imported on the server."); clientReference = target[name]; clientReference || ((clientReference = registerClientReferenceImpl(function () { throw Error("Attempted to call " + String(name) + "() from the server but " + String(name) + " is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."); }, target.$$id + "#" + name, target.$$async)), Object.defineProperty(clientReference, "name", { value: name }), (clientReference = target[name] = new Proxy(clientReference, deepProxyHandlers))); return clientReference; } function trimOptions(options) { if (null == options) return null; var hasProperties = !1, trimmed = {}, key; for (key in options) null != options[key] && ((hasProperties = !0), (trimmed[key] = options[key])); return hasProperties ? trimmed : null; } function prepareStackTrace(error, structuredStackTrace) { error = (error.name || "Error") + ": " + (error.message || ""); for (var i = 0; i < structuredStackTrace.length; i++) error += "\n at " + structuredStackTrace[i].toString(); return error; } function parseStackTrace(error, skipFrames) { a: { var previousPrepare = Error.prepareStackTrace; Error.prepareStackTrace = prepareStackTrace; try { var stack = String(error.stack); break a; } finally { Error.prepareStackTrace = previousPrepare; } stack = void 0; } stack.startsWith("Error: react-stack-top-frame\n") && (stack = stack.slice(29)); error = stack.indexOf("react-stack-bottom-frame"); -1 !== error && (error = stack.lastIndexOf("\n", error)); -1 !== error && (stack = stack.slice(0, error)); stack = stack.split("\n"); for (error = []; skipFrames < stack.length; skipFrames++) if ((previousPrepare = frameRegExp.exec(stack[skipFrames]))) { var name = previousPrepare[1] || ""; "<anonymous>" === name && (name = ""); var filename = previousPrepare[2] || previousPrepare[5] || ""; "<anonymous>" === filename && (filename = ""); error.push([ name, filename, +(previousPrepare[3] || previousPrepare[6]), +(previousPrepare[4] || previousPrepare[7]) ]); } return error; } function createTemporaryReference(temporaryReferences, id) { var reference = Object.defineProperties(function () { throw Error("Attempted to call a temporary Client Reference from the server but it is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."); }, { $$typeof: { value: TEMPORARY_REFERENCE_TAG } }); reference = new Proxy(reference, proxyHandlers); temporaryReferences.set(reference, id); return reference; } function getIteratorFn(maybeIterable) { if (null === maybeIterable || "object" !== typeof maybeIterable) return null; maybeIterable = (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || maybeIterable["@@iterator"]; return "function" === typeof maybeIterable ? maybeIterable : null; } function noop$1() { } function trackUsedThenable(thenableState, thenable, index) { index = thenableState[index]; void 0 === index ? thenableState.push(thenable) : index !== thenable && (thenable.then(noop$1, noop$1), (thenable = index)); switch (thenable.status) { case "fulfilled": return thenable.value; case "rejected": throw thenable.reason; default: "string" === typeof thenable.status ? thenable.then(noop$1, noop$1) : ((thenableState = thenable), (thenableState.status = "pending"), thenableState.then(function (fulfilledValue) { if ("pending" === thenable.status) { var fulfilledThenable = thenable; fulfilledThenable.status = "fulfilled"; fulfilledThenable.value = fulfilledValue; } }, function (error) { if ("pending" === thenable.status) { var rejectedThenable = thenable; rejectedThenable.status = "rejected"; rejectedThenable.reason = error; } })); switch (thenable.status) { case "fulfilled": return thenable.value; case "rejected": throw thenable.reason; } suspendedThenable = thenable; throw SuspenseException; } } function getSuspendedThenable() { if (null === suspendedThenable) throw Error("Expected a suspended thenable. This is a bug in React. Please file an issue."); var thenable = suspendedThenable; suspendedThenable = null; return thenable; } function prepareToUseHooksForComponent(prevThenableState, componentDebugInfo) { thenableIndexCounter = 0; thenableState = prevThenableState; currentComponentDebugInfo = componentDebugInfo; } function getThenableStateAfterSuspending() { var state = thenableState || []; state._componentDebugInfo = currentComponentDebugInfo; thenableState = currentComponentDebugInfo = null; return state; } function unsupportedHook() { throw Error("This Hook is not supported in Server Components."); } function unsupportedRefresh() { throw Error("Refreshing the cache is not supported in Server Components."); } function unsupportedContext() { throw Error("Cannot read a Client Context from a Server Component."); } function resolveOwner() { if (currentOwner) return currentOwner; if (supportsComponentStorage) { var owner = componentStorage.getStore(); if (owner) return owner; } return null; } function isObjectPrototype(object) { if (!object) return !1; var ObjectPrototype = Object.prototype; if (object === ObjectPrototype) return !0; if (getPrototypeOf(object)) return !1; object = Object.getOwnPropertyNames(object); for (var i = 0; i < object.length; i++) if (!(object[i] in ObjectPrototype)) return !1; return !0; } function isSimpleObject(object) { if (!isObjectPrototype(getPrototypeOf(object))) return !1; for (var names = Object.getOwnPropertyNames(object), i = 0; i < names.length; i++) { var descriptor = Object.getOwnPropertyDescriptor(object, names[i]); if (!descriptor || (!descriptor.enumerable && (("key" !== names[i] && "ref" !== names[i]) || "function" !== typeof descriptor.get))) return !1; } return !0; } function objectName(object) { return Object.prototype.toString .call(object) .replace(/^\[object (.*)\]$/, function (m, p0) { return p0; }); } function describeKeyForErrorMessage(key) { var encodedKey = JSON.stringify(key); return '"' + key + '"' === encodedKey ? key : encodedKey; } function describeValueForErrorMessage(value) { switch (typeof value) { case "string": return JSON.stringify(10 >= value.length ? value : value.slice(0, 10) + "..."); case "object": if (isArrayImpl(value)) return "[...]"; if (null !== value && value.$$typeof === CLIENT_REFERENCE_TAG) return "client"; value = objectName(value); return "Object" === value ? "{...}" : value; case "function": return value.$$typeof === CLIENT_REFERENCE_TAG ? "client" : (value = value.displayName || value.name) ? "function " + value : "function"; default: return String(value); } } function describeElementType(type) { if ("string" === typeof type) return type; switch (type) { case REACT_SUSPENSE_TYPE: return "Suspense"; case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList"; } if ("object" === typeof type) switch (type.$$typeof) { case REACT_FORWARD_REF_TYPE: return describeElementType(type.render); case REACT_MEMO_TYPE: return describeElementType(type.type); case REACT_LAZY_TYPE: var payload = type._payload; type = type._init; try { return describeElementType(type(payload)); } catch (x) { } } return ""; } function describeObjectForErrorMessage(objectOrArray, expandedName) { var objKind = objectName(objectOrArray); if ("Object" !== objKind && "Array" !== objKind) return objKind; var start = -1, length = 0; if (isArrayImpl(objectOrArray)) if (jsxChildrenParents.has(objectOrArray)) { var type = jsxChildrenParents.get(objectOrArray); objKind = "<" + describeElementType(type) + ">"; for (var i = 0; i < objectOrArray.length; i++) { var value = objectOrArray[i]; value = "string" === typeof value ? value : "object" === typeof value && null !== value ? "{" + describeObjectForErrorMessage(value) + "}" : "{" + describeValueForErrorMessage(value) + "}"; "" + i === expandedName ? ((start = objKind.length), (length = value.length), (objKind += value)) : (objKind = 15 > value.length && 40 > objKind.length + value.length ? objKind + value : objKind + "{...}"); } objKind += "</" + describeElementType(type) + ">"; } else { objKind = "["; for (type = 0; type < objectOrArray.length; type++) 0 < type && (objKind += ", "), (i = objectOrArray[type]), (i = "object" === typeof i && null !== i ? describeObjectForErrorMessage(i) : describeValueForErrorMessage(i)), "" + type === expandedName ? ((start = objKind.length), (length = i.length), (objKind += i)) : (objKind = 10 > i.length && 40 > objKind.length + i.length ? objKind + i : objKind + "..."); objKind += "]"; } else if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE) objKind = "<" + describeElementType(objectOrArray.type) + "/>"; else { if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) return "client"; if (jsxPropsParents.has(objectOrArray)) { objKind = jsxPropsParents.get(objectOrArray); objKind = "<" + (describeElementType(objKind) || "..."); type = Object.keys(objectOrArray); for (i = 0; i < type.length; i++) { objKind += " "; value = type[i]; objKind += describeKeyForErrorMessage(value) + "="; var _value2 = objectOrArray[value]; var _substr2 = value === expandedName && "object" === typeof _value2 && null !== _value2 ? describeObjectForErrorMessage(_value2) : describeValueForErrorMessage(_value2); "string" !== typeof _value2 && (_substr2 = "{" + _substr2 + "}"); value === expandedName ? ((start = objKind.length), (length = _substr2.length), (objKind += _substr2)) : (objKind = 10 > _substr2.length && 40 > objKind.length + _substr2.length ? objKind + _substr2 : objKind + "..."); } objKind += ">"; } else { objKind = "{"; type = Object.keys(objectOrArray); for (i = 0; i < type.length; i++) 0 < i && (objKind += ", "), (value = type[i]), (objKind += describeKeyForErrorMessage(value) + ": "), (_value2 = objectOrArray[value]), (_value2 = "object" === typeof _value2 && null !== _value2 ? describeObjectForErrorMessage(_value2) : describeValueForErrorMessage(_value2)), value === expandedName ? ((start = objKind.length), (length = _value2.length), (objKind += _value2)) : (objKind = 10 > _value2.length && 40 > objKind.length + _value2.length ? objKind + _value2 : objKind + "..."); objKind += "}"; } } return void 0 === expandedName ? objKind : -1 < start && 0 < length ? ((objectOrArray = " ".repeat(start) + "^".repeat(length)), "\n " + objKind + "\n " + objectOrArray) : "\n " + objKind; } function defaultFilterStackFrame(filename) { return ("" !== filename && !filename.startsWith("node:") && !filename.includes("node_modules")); } function filterStackTrace(request, error, skipFrames) { request = request.filterStackFrame; error = parseStackTrace(error, skipFrames); for (skipFrames = 0; skipFrames < error.length; skipFrames++) { var callsite = error[skipFrames], functionName = callsite[0], url = callsite[1]; if (url.startsWith("rsc://React/")) { var envIdx = url.indexOf("/", 12), suffixIdx = url.lastIndexOf("?"); -1 < envIdx && -1 < suffixIdx && (url = callsite[1] = url.slice(envIdx + 1, suffixIdx)); } request(url, functionName) || (error.splice(skipFrames, 1), skipFrames--); } return error; } function patchConsole(consoleInst, methodName) { var descriptor = Object.getOwnPropertyDescriptor(consoleInst, methodName); if (descriptor && (descriptor.configurable || descriptor.writable) && "function" === typeof descriptor.value) { var originalMethod = descriptor.value; descriptor = Object.getOwnPropertyDescriptor(originalMethod, "name"); var wrapperMethod = function () { var request = resolveRequest(); if (("assert" !== methodName || !arguments[0]) && null !== request) { var stack = filterStackTrace(request, Error("react-stack-top-frame"), 1); request.pendingChunks++; var id = request.nextChunkId++, owner = resolveOwner(); emitConsoleChunk(request, id, methodName, owner, stack, arguments); } return originalMethod.apply(this, arguments); }; descriptor && Object.defineProperty(wrapperMethod, "name", descriptor); Object.defineProperty(consoleInst, methodName, { value: wrapperMethod }); } } function getCurrentStackInDEV() { return ""; } function defaultErrorHandler(error) { console.error(error); } function defaultPostponeHandler() { } function RequestInstance(type, model, bundlerConfig, onError, identifierPrefix, onPostpone, temporaryReferences, environmentName, filterStackFrame, onAllReady, onFatalError) { if (null !== ReactSharedInternalsServer.A && ReactSharedInternalsServer.A !== DefaultAsyncDispatcher) throw Error("Currently React only supports one RSC renderer at a time."); ReactSharedInternalsServer.A = DefaultAsyncDispatcher; ReactSharedInternalsServer.getCurrentStack = getCurrentStackInDEV; var abortSet = new Set(), pingedTasks = [], hints = new Set(); this.type = type; this.status = OPENING; this.flushScheduled = !1; this.destination = this.fatalError = null; this.bundlerConfig = bundlerConfig; this.cache = new Map(); this.pendingChunks = this.nextChunkId = 0; this.hints = hints; this.abortListeners = new Set(); this.abortableTasks = abortSet; this.pingedTasks = pingedTasks; this.completedImportChunks = []; this.completedHintChunks = []; this.completedRegularChunks = []; this.completedErrorChunks = []; this.writtenSymbols = new Map(); this.writtenClientReferences = new Map(); this.writtenServerReferences = new Map(); this.writtenObjects = new WeakMap(); this.temporaryReferences = temporaryReferences; this.identifierPrefix = identifierPrefix || ""; this.identifierCount = 1; this.taintCleanupQueue = []; this.onError = void 0 === onError ? defaultErrorHandler : onError; this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone; this.onAllReady = onAllReady; this.onFatalError = onFatalError; this.environmentName = void 0 === environmentName ? function () { return "Server"; } : "function" !== typeof environmentName ? function () { return environmentName; } : environmentName; this.filterStackFrame = void 0 === filterStackFrame ? defaultFilterStackFrame : filterStackFrame; this.didWarnForKey = null; type = createTask(this, model, null, !1, abortSet, null); pingedTasks.push(type); } function noop() { } function resolveRequest() { if (currentRequest) return currentRequest; if (supportsRequestStorage) { var store = requestStorage.getStore(); if (store) return store; } return null; } function serializeThenable(request, task, thenable) { var newTask = createTask(request, null, task.keyPath, task.implicitSlot, request.abortableTasks, task.debugOwner); (task = thenable._debugInfo) && forwardDebugInfo(request, newTask.id, task); switch (thenable.status) { case "fulfilled": return ((newTask.model = thenable.value), pingTask(request, newTask), newTask.id); case "rejected": task = thenable.reason; var digest = logRecoverableError(request, task, null); emitErrorChunk(request, newTask.id, digest, task); newTask.status = ERRORED$1; request.abortableTasks.delete(newTask); return newTask.id; default: if (request.status === ABORTING) return (request.abortableTasks.delete(newTask), (newTask.status = ABORTED), (task = stringify(serializeByValueID(request.fatalError))), emitModelChunk(request, newTask.id, task), newTask.id); "string" !== typeof thenable.status && ((thenable.status = "pending"), thenable.then(function (fulfilledValue) { "pending" === thenable.status && ((thenable.status = "fulfilled"), (thenable.value = fulfilledValue)); }, function (error) { "pending" === thenable.status && ((thenable.status = "rejected"), (thenable.reason = error)); })); } thenable.then(function (value) { newTask.model = value; pingTask(request, newTask); }, function (reason) { if (newTask.status === PENDING$1) { var _digest = logRecoverableError(request, reason, newTask); emitErrorChunk(request, newTask.id, _digest, reason); newTask.status = ERRORED$1; request.abortableTasks.delete(newTask); enqueueFlush(request); } }); return newTask.id; } function serializeReadableStream(request, task, stream) { function progress(entry) { if (!aborted) if (entry.done) request.abortListeners.delete(abortStream), (entry = streamTask.id.toString(16) + ":C\n"), request.completedRegularChunks.push(stringToChunk(entry)), enqueueFlush(request), (aborted = !0); else try { (streamTask.model = entry.value), request.pendingChunks++, tryStreamTask(request, streamTask), enqueueFlush(request), reader.read().then(progress, error); } catch (x$0) { error(x$0); } } function error(reason) { if (!aborted) { aborted = !0; request.abortListeners.delete(abortStream); var digest = logRecoverableError(request, reason, streamTask); emitErrorChunk(request, streamTask.id, digest, reason); enqueueFlush(request); reader.cancel(reason).then(error, error); } } function abortStream(reason) { if (!aborted) { aborted = !0; request.abortListeners.delete(abortStream); var digest = logRecoverableError(request, reason, streamTask); emitErrorChunk(request, streamTask.id, digest, reason); enqueueFlush(request); reader.cancel(reason).then(error, error); } } var supportsBYOB = stream.supportsBYOB; if (void 0 === supportsBYOB) try { stream.getReader({ mode: "byob" }).releaseLock(), (supportsBYOB = !0); } catch (x) { supportsBYOB = !1; } var reader = stream.getReader(), streamTask = createTask(request, task.model, task.keyPath, task.implicitSlot, request.abortableTasks, task.debugOwner); request.abortableTasks.delete(streamTask); request.pendingChunks++; task = streamTask.id.toString(16) + ":" + (supportsBYOB ? "r" : "R") + "\n"; request.completedRegularChunks.push(stringToChunk(task)); var aborted = !1; request.abortListeners.add(abortStream); reader.read().then(progress, error); return serializeByValueID(streamTask.id); } function serializeAsyncIterable(request, task, iterable, iterator) { function progress(entry) { if (!aborted) if (entry.done) { request.abortListeners.delete(abortIterable); if (void 0 === entry.value) var endStreamRow = streamTask.id.toString(16) + ":C\n"; else try { var chunkId = outlineModel(request, entry.value); endStreamRow = streamTask.id.toString(16) + ":C" + stringify(serializeByValueID(chunkId)) + "\n"; } catch (x) { error(x); return; } request.completedRegularChunks.push(stringToChunk(endStreamRow)); enqueueFlush(request); aborted = !0; } else try { (streamTask.model = entry.value), request.pendingChunks++, tryStreamTask(request, streamTask), enqueueFlush(request), callIteratorInDEV(iterator, progress, error); } catch (x$1) { error(x$1); } } function error(reason) { if (!aborted) { aborted = !0; request.abortListeners.delete(abortIterable); var digest = logRecoverableError(request, reason, streamTask); emitErrorChunk(request, streamTask.id, digest, reason); enqueueFlush(request); "function" === typeof iterator.throw && iterator.throw(reason).then(error, error); } } function abortIterable(reason) { if (!aborted) { aborted = !0; request.abortListeners.delete(abortIterable); var digest = logRecoverableError(request, reason, streamTask); emitErrorChunk(request, streamTask.id, digest, reason); enqueueFlush(request); "function" === typeof iterator.throw && iterator.throw(reason).then(error, error); } } var isIterator = iterable === iterator, streamTask = createTask(request, task.model, task.keyPath, task.implicitSlot, request.abortableTasks, task.debugOwner); request.abortableTasks.delete(streamTask); request.pendingChunks++; task = streamTask.id.toString(16) + ":" + (isIterator ? "x" : "X") + "\n"; request.completedRegularChunks.push(stringToChunk(task)); (iterable = iterable._debugInfo) && forwardDebugInfo(request, streamTask.id, iterable); var aborted = !1; request.abortListeners.add(abortIterable); callIteratorInDEV(iterator, progress, error); return serializeByValueID(streamTask.id); } function emitHint(request, code, model) { model = stringify(model); var id = request.nextChunkId++; code = serializeRowHeader("H" + code, id) + model + "\n"; code = stringToChunk(code); request.completedHintChunks.push(code); enqueueFlush(request); } function readThenable(thenable) { if ("fulfilled" === thenable.status) return thenable.value; if ("rejected" === thenable.status) throw thenable.reason; throw thenable; } function createLazyWrapperAroundWakeable(wakeable) { switch (wakeable.status) { case "fulfilled": case "rejected": break; default: "string" !== typeof wakeable.status && ((wakeable.status = "pending"), wakeable.then(function (fulfilledValue) { "pending" === wakeable.status && ((wakeable.status = "fulfilled"), (wakeable.value = fulfilledValue)); }, function (error) { "pending" === wakeable.status && ((wakeable.status = "rejected"), (wakeable.reason = error)); })); } var lazyType = { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable }; lazyType._debugInfo = wakeable._debugInfo || []; return lazyType; } function callWithDebugContextInDEV(request, task, callback, arg) { currentOwner = { name: "", env: task.environmentName, key: null, owner: task.debugOwner }; try { return callback(arg); } finally { currentOwner = null; } } function renderFunctionComponent(request, task, key, Component, props) { var prevThenableState = task.thenableState; task.thenableState = null; if (null === debugID) return outlineTask(request, task); if (null !== prevThenableState) var componentDebugInfo = prevThenableState._componentDebugInfo; else { var componentDebugID = debugID; componentDebugInfo = Component.displayName || Component.name || ""; var componentEnv = (0, request.environmentName)(); request.pendingChunks++; componentDebugInfo = { name: componentDebugInfo, env: componentEnv, key: key, owner: task.debugOwner }; componentDebugInfo.props = props; outlineComponentInfo(request, componentDebugInfo); emitDebugChunk(request, componentDebugID, componentDebugInfo); task.environmentName = componentEnv; } prepareToUseHooksForComponent(prevThenableState, componentDebugInfo); props = supportsComponentStorage ? componentStorage.run(componentDebugInfo, callComponentInDEV, Component, props, componentDebugInfo) : callComponentInDEV(Component, props, componentDebugInfo); if (request.status === ABORTING) throw (("object" !== typeof props || null === props || "function" !== typeof props.then || isClientReference(props) || props.then(voidHandler, voidHandler), null)); if ("object" === typeof props && null !== props && !isClientReference(props)) { if ("function" === typeof props.then) { prevThenableState = props; prevThenableState.then(function (resolvedValue) { "object" === typeof resolvedValue && null !== resolvedValue && resolvedValue.$$typeof === REACT_ELEMENT_TYPE && (resolvedValue._store.validated = 1); }, voidHandler); if ("fulfilled" === prevThenableState.status) return prevThenableState.value; props = createLazyWrapperAroundWakeable(props); } var iteratorFn = getIteratorFn(props); if (iteratorFn) { var iterableChild = props; props = _defineProperty({}, Symbol.iterator, function () { var iterator = iteratorFn.call(iterableChild); iterator !== iterableChild || ("[object GeneratorFunction]" === Object.prototype.toString.call(Component) && "[object Generator]" === Object.prototype.toString.call(iterableChild)) || callWithDebugContextInDEV(request, task, function () { console.error("Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. "); }); return iterator; }); props._debugInfo = iterableChild._debugInfo; } else if ("function" !== typeof props[ASYNC_ITERATOR] || ("function" === typeof ReadableStream && props instanceof ReadableStream)) props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1); else { var _iterableChild = props; props = _defineProperty({}, ASYNC_ITERATOR, function () { var iterator = _iterableChild[ASYNC_ITERATOR](); iterator !== _iterableChild || ("[object AsyncGeneratorFunction]" === Object.prototype.toString.call(Component) && "[object AsyncGenerator]" === Object.prototype.toString.call(_iterableChild)) || callWithDebugContextInDEV(request, task, function () { console.error("Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. "); }); return iterator; }); props._debugInfo = _iterableChild._debugInfo; } } prevThenableState = task.keyPath; componentDebugID = task.implicitSlot; null !== key ? (task.keyPath = null === prevThenableState ? key : prevThenableState + "," + key) : null === prevThenableState && (task.implicitSlot = !0); key = renderModelDestructive(request, task, emptyRoot, "", props); task.keyPath = prevThenableState; task.implicitSlot = componentDebugID; return key; } function renderFragment(request, task, children) { for (var i = 0; i < children.length; i++) { var child = children[i]; null === child || "object" !== typeof child || child.$$typeof !== REACT_ELEMENT_TYPE || null !== child.key || child._store.validated || (child._store.validated = 2); } if (null !== task.keyPath) return ((request = [ REACT_ELEMENT_TYPE, REACT_FRAGMENT_TYPE, task.keyPath, { children: children }, null ]), task.implicitSlot ? [request] : request); if ((i = children._debugInfo)) { if (null === debugID) return outlineTask(request, task); forwardDebugInfo(request, debugID, i); children = Array.from(children); } return children; } function renderAsyncFragment(request, task, children, getAsyncIterator) { if (null !== task.keyPath) return ((request = [ REACT_ELEMENT_TYPE, REACT_FRAGMENT_TYPE, task.keyPath, { children: children }, null ]), task.implicitSlot ? [request] : request); getAsyncIterator = getAsyncIterator.call(children); return serializeAsyncIterable(request, task, children, getAsyncIterator); } function outlineTask(request, task) { task = createTask(request, task.model, task.keyPath, task.implicitSlot, request.abortableTasks, task.debugOwner); retryTask(request, task); return task.status === COMPLETED ? serializeByValueID(task.id) : "$L" + task.id.toString(16); } function renderElement(request, task, type, key, ref, props) { if (null !== ref && void 0 !== ref) throw Error("Refs cannot be used in Server Components, nor passed to Client Components."); jsxPropsParents.set(props, type); "object" === typeof props.children && null !== props.children && jsxChildrenParents.set(props.children, type); if ("function" !== typeof type || isClientReference(type) || type.$$typeof === TEMPORARY_REFERENCE_TAG) { if (type === REACT_FRAGMENT_TYPE && null === key) return ((type = task.implicitSlot), null === task.keyPath && (task.implicitSlot = !0), (request = renderModelDestructive(request, task, emptyRoot, "", props.children)), (task.implicitSlot = type), request); if (null != type && "object" === typeof type && !isClientReference(type)) switch (type.$$typeof) { case REACT_LAZY_TYPE: type = callLazyInitInDEV(type); if (request.status === ABORTING) throw null; return renderElement(request, task, type, key, ref, props); case REACT_FORWARD_REF_TYPE: return renderFunctionComponent(request, task, key, type.render, props); case REACT_MEMO_TYPE: return renderElement(request, task, type.type, key, ref, props); case REACT_ELEMENT_TYPE: type._store.validated = 1; } } else return renderFunctionComponent(request, task, key, type, props); ref = task.keyPath; null === key ? (key = ref) : null !== ref && (key = ref + "," + key); null !== task.debugOwner && outlineComponentInfo(request, task.debugOwner); request = [REACT_ELEMENT_TYPE, type, key, props, task.debugOwner]; task = task.implicitSlot && null !== key ? [request] : request; return task; } function pingTask(request, task) { var pingedTasks = request.pingedTasks; pingedTasks.push(task); 1 === pingedTasks.length && ((request.flushScheduled = null !== request.destination), request.type === PRERENDER || request.status === OPENING ? scheduleMicrotask(function () { return performWork(request); }) : setTimeout(function () { return performWork(request); }, 0)); } function createTask(request, model, keyPath