9380 lines
312 KiB
JavaScript
9380 lines
312 KiB
JavaScript
/**
|
|
* 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.
|
|
*
|
|
* @noflow
|
|
* @nolint
|
|
* @providesModule ReactNativeRenderer-prod
|
|
* @preventMunge
|
|
* @generated SignedSource<<fe2907fc6f39fbb87dcc99c2ab30ab51>>
|
|
*/
|
|
|
|
"use strict";
|
|
require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore");
|
|
var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"),
|
|
React = require("react"),
|
|
Scheduler = require("scheduler"),
|
|
isArrayImpl = Array.isArray,
|
|
hasError = !1,
|
|
caughtError = null,
|
|
getFiberCurrentPropsFromNode$1 = null,
|
|
getInstanceFromNode = null,
|
|
getNodeFromInstance = null;
|
|
function executeDispatch(event, listener, inst) {
|
|
event.currentTarget = getNodeFromInstance(inst);
|
|
try {
|
|
listener(event);
|
|
} catch (error) {
|
|
hasError || ((hasError = !0), (caughtError = error));
|
|
}
|
|
event.currentTarget = null;
|
|
}
|
|
function executeDirectDispatch(event) {
|
|
var dispatchListener = event._dispatchListeners,
|
|
dispatchInstance = event._dispatchInstances;
|
|
if (isArrayImpl(dispatchListener)) throw Error("Invalid `event`.");
|
|
event.currentTarget = dispatchListener
|
|
? getNodeFromInstance(dispatchInstance)
|
|
: null;
|
|
dispatchListener = dispatchListener ? dispatchListener(event) : null;
|
|
event.currentTarget = null;
|
|
event._dispatchListeners = null;
|
|
event._dispatchInstances = null;
|
|
return dispatchListener;
|
|
}
|
|
var assign = Object.assign;
|
|
function functionThatReturnsTrue() {
|
|
return !0;
|
|
}
|
|
function functionThatReturnsFalse() {
|
|
return !1;
|
|
}
|
|
function SyntheticEvent(
|
|
dispatchConfig,
|
|
targetInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
) {
|
|
this.dispatchConfig = dispatchConfig;
|
|
this._targetInst = targetInst;
|
|
this.nativeEvent = nativeEvent;
|
|
this._dispatchInstances = this._dispatchListeners = null;
|
|
dispatchConfig = this.constructor.Interface;
|
|
for (var propName in dispatchConfig)
|
|
dispatchConfig.hasOwnProperty(propName) &&
|
|
((targetInst = dispatchConfig[propName])
|
|
? (this[propName] = targetInst(nativeEvent))
|
|
: "target" === propName
|
|
? (this.target = nativeEventTarget)
|
|
: (this[propName] = nativeEvent[propName]));
|
|
this.isDefaultPrevented = (
|
|
null != nativeEvent.defaultPrevented
|
|
? nativeEvent.defaultPrevented
|
|
: !1 === nativeEvent.returnValue
|
|
)
|
|
? functionThatReturnsTrue
|
|
: functionThatReturnsFalse;
|
|
this.isPropagationStopped = functionThatReturnsFalse;
|
|
return this;
|
|
}
|
|
assign(SyntheticEvent.prototype, {
|
|
preventDefault: function () {
|
|
this.defaultPrevented = !0;
|
|
var event = this.nativeEvent;
|
|
event &&
|
|
(event.preventDefault
|
|
? event.preventDefault()
|
|
: "unknown" !== typeof event.returnValue && (event.returnValue = !1),
|
|
(this.isDefaultPrevented = functionThatReturnsTrue));
|
|
},
|
|
stopPropagation: function () {
|
|
var event = this.nativeEvent;
|
|
event &&
|
|
(event.stopPropagation
|
|
? event.stopPropagation()
|
|
: "unknown" !== typeof event.cancelBubble && (event.cancelBubble = !0),
|
|
(this.isPropagationStopped = functionThatReturnsTrue));
|
|
},
|
|
persist: function () {
|
|
this.isPersistent = functionThatReturnsTrue;
|
|
},
|
|
isPersistent: functionThatReturnsFalse,
|
|
destructor: function () {
|
|
var Interface = this.constructor.Interface,
|
|
propName;
|
|
for (propName in Interface) this[propName] = null;
|
|
this.nativeEvent = this._targetInst = this.dispatchConfig = null;
|
|
this.isPropagationStopped = this.isDefaultPrevented =
|
|
functionThatReturnsFalse;
|
|
this._dispatchInstances = this._dispatchListeners = null;
|
|
}
|
|
});
|
|
SyntheticEvent.Interface = {
|
|
type: null,
|
|
target: null,
|
|
currentTarget: function () {
|
|
return null;
|
|
},
|
|
eventPhase: null,
|
|
bubbles: null,
|
|
cancelable: null,
|
|
timeStamp: function (event) {
|
|
return event.timeStamp || Date.now();
|
|
},
|
|
defaultPrevented: null,
|
|
isTrusted: null
|
|
};
|
|
SyntheticEvent.extend = function (Interface) {
|
|
function E() {}
|
|
function Class() {
|
|
return Super.apply(this, arguments);
|
|
}
|
|
var Super = this;
|
|
E.prototype = Super.prototype;
|
|
var prototype = new E();
|
|
assign(prototype, Class.prototype);
|
|
Class.prototype = prototype;
|
|
Class.prototype.constructor = Class;
|
|
Class.Interface = assign({}, Super.Interface, Interface);
|
|
Class.extend = Super.extend;
|
|
addEventPoolingTo(Class);
|
|
return Class;
|
|
};
|
|
addEventPoolingTo(SyntheticEvent);
|
|
function createOrGetPooledEvent(
|
|
dispatchConfig,
|
|
targetInst,
|
|
nativeEvent,
|
|
nativeInst
|
|
) {
|
|
if (this.eventPool.length) {
|
|
var instance = this.eventPool.pop();
|
|
this.call(instance, dispatchConfig, targetInst, nativeEvent, nativeInst);
|
|
return instance;
|
|
}
|
|
return new this(dispatchConfig, targetInst, nativeEvent, nativeInst);
|
|
}
|
|
function releasePooledEvent(event) {
|
|
if (!(event instanceof this))
|
|
throw Error(
|
|
"Trying to release an event instance into a pool of a different type."
|
|
);
|
|
event.destructor();
|
|
10 > this.eventPool.length && this.eventPool.push(event);
|
|
}
|
|
function addEventPoolingTo(EventConstructor) {
|
|
EventConstructor.getPooled = createOrGetPooledEvent;
|
|
EventConstructor.eventPool = [];
|
|
EventConstructor.release = releasePooledEvent;
|
|
}
|
|
var ResponderSyntheticEvent = SyntheticEvent.extend({
|
|
touchHistory: function () {
|
|
return null;
|
|
}
|
|
});
|
|
function isStartish(topLevelType) {
|
|
return "topTouchStart" === topLevelType;
|
|
}
|
|
function isMoveish(topLevelType) {
|
|
return "topTouchMove" === topLevelType;
|
|
}
|
|
var startDependencies = ["topTouchStart"],
|
|
moveDependencies = ["topTouchMove"],
|
|
endDependencies = ["topTouchCancel", "topTouchEnd"],
|
|
touchBank = [],
|
|
touchHistory = {
|
|
touchBank: touchBank,
|
|
numberActiveTouches: 0,
|
|
indexOfSingleActiveTouch: -1,
|
|
mostRecentTimeStamp: 0
|
|
};
|
|
function timestampForTouch(touch) {
|
|
return touch.timeStamp || touch.timestamp;
|
|
}
|
|
function getTouchIdentifier(_ref) {
|
|
_ref = _ref.identifier;
|
|
if (null == _ref) throw Error("Touch object is missing identifier.");
|
|
return _ref;
|
|
}
|
|
function recordTouchStart(touch) {
|
|
var identifier = getTouchIdentifier(touch),
|
|
touchRecord = touchBank[identifier];
|
|
touchRecord
|
|
? ((touchRecord.touchActive = !0),
|
|
(touchRecord.startPageX = touch.pageX),
|
|
(touchRecord.startPageY = touch.pageY),
|
|
(touchRecord.startTimeStamp = timestampForTouch(touch)),
|
|
(touchRecord.currentPageX = touch.pageX),
|
|
(touchRecord.currentPageY = touch.pageY),
|
|
(touchRecord.currentTimeStamp = timestampForTouch(touch)),
|
|
(touchRecord.previousPageX = touch.pageX),
|
|
(touchRecord.previousPageY = touch.pageY),
|
|
(touchRecord.previousTimeStamp = timestampForTouch(touch)))
|
|
: ((touchRecord = {
|
|
touchActive: !0,
|
|
startPageX: touch.pageX,
|
|
startPageY: touch.pageY,
|
|
startTimeStamp: timestampForTouch(touch),
|
|
currentPageX: touch.pageX,
|
|
currentPageY: touch.pageY,
|
|
currentTimeStamp: timestampForTouch(touch),
|
|
previousPageX: touch.pageX,
|
|
previousPageY: touch.pageY,
|
|
previousTimeStamp: timestampForTouch(touch)
|
|
}),
|
|
(touchBank[identifier] = touchRecord));
|
|
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
|
|
}
|
|
function recordTouchMove(touch) {
|
|
var touchRecord = touchBank[getTouchIdentifier(touch)];
|
|
touchRecord &&
|
|
((touchRecord.touchActive = !0),
|
|
(touchRecord.previousPageX = touchRecord.currentPageX),
|
|
(touchRecord.previousPageY = touchRecord.currentPageY),
|
|
(touchRecord.previousTimeStamp = touchRecord.currentTimeStamp),
|
|
(touchRecord.currentPageX = touch.pageX),
|
|
(touchRecord.currentPageY = touch.pageY),
|
|
(touchRecord.currentTimeStamp = timestampForTouch(touch)),
|
|
(touchHistory.mostRecentTimeStamp = timestampForTouch(touch)));
|
|
}
|
|
function recordTouchEnd(touch) {
|
|
var touchRecord = touchBank[getTouchIdentifier(touch)];
|
|
touchRecord &&
|
|
((touchRecord.touchActive = !1),
|
|
(touchRecord.previousPageX = touchRecord.currentPageX),
|
|
(touchRecord.previousPageY = touchRecord.currentPageY),
|
|
(touchRecord.previousTimeStamp = touchRecord.currentTimeStamp),
|
|
(touchRecord.currentPageX = touch.pageX),
|
|
(touchRecord.currentPageY = touch.pageY),
|
|
(touchRecord.currentTimeStamp = timestampForTouch(touch)),
|
|
(touchHistory.mostRecentTimeStamp = timestampForTouch(touch)));
|
|
}
|
|
var instrumentationCallback,
|
|
ResponderTouchHistoryStore = {
|
|
instrument: function (callback) {
|
|
instrumentationCallback = callback;
|
|
},
|
|
recordTouchTrack: function (topLevelType, nativeEvent) {
|
|
null != instrumentationCallback &&
|
|
instrumentationCallback(topLevelType, nativeEvent);
|
|
if (isMoveish(topLevelType))
|
|
nativeEvent.changedTouches.forEach(recordTouchMove);
|
|
else if (isStartish(topLevelType))
|
|
nativeEvent.changedTouches.forEach(recordTouchStart),
|
|
(touchHistory.numberActiveTouches = nativeEvent.touches.length),
|
|
1 === touchHistory.numberActiveTouches &&
|
|
(touchHistory.indexOfSingleActiveTouch =
|
|
nativeEvent.touches[0].identifier);
|
|
else if (
|
|
"topTouchEnd" === topLevelType ||
|
|
"topTouchCancel" === topLevelType
|
|
)
|
|
if (
|
|
(nativeEvent.changedTouches.forEach(recordTouchEnd),
|
|
(touchHistory.numberActiveTouches = nativeEvent.touches.length),
|
|
1 === touchHistory.numberActiveTouches)
|
|
)
|
|
for (
|
|
topLevelType = 0;
|
|
topLevelType < touchBank.length;
|
|
topLevelType++
|
|
)
|
|
if (
|
|
((nativeEvent = touchBank[topLevelType]),
|
|
null != nativeEvent && nativeEvent.touchActive)
|
|
) {
|
|
touchHistory.indexOfSingleActiveTouch = topLevelType;
|
|
break;
|
|
}
|
|
},
|
|
touchHistory: touchHistory
|
|
};
|
|
function accumulate(current, next) {
|
|
if (null == next)
|
|
throw Error("Accumulated items must not be null or undefined.");
|
|
return null == current
|
|
? next
|
|
: isArrayImpl(current)
|
|
? current.concat(next)
|
|
: isArrayImpl(next)
|
|
? [current].concat(next)
|
|
: [current, next];
|
|
}
|
|
function accumulateInto(current, next) {
|
|
if (null == next)
|
|
throw Error("Accumulated items must not be null or undefined.");
|
|
if (null == current) return next;
|
|
if (isArrayImpl(current)) {
|
|
if (isArrayImpl(next)) return current.push.apply(current, next), current;
|
|
current.push(next);
|
|
return current;
|
|
}
|
|
return isArrayImpl(next) ? [current].concat(next) : [current, next];
|
|
}
|
|
function forEachAccumulated(arr, cb, scope) {
|
|
Array.isArray(arr) ? arr.forEach(cb, scope) : arr && cb.call(scope, arr);
|
|
}
|
|
var responderInst = null,
|
|
trackedTouchCount = 0;
|
|
function changeResponder(nextResponderInst, blockHostResponder) {
|
|
var oldResponderInst = responderInst;
|
|
responderInst = nextResponderInst;
|
|
if (null !== ResponderEventPlugin.GlobalResponderHandler)
|
|
ResponderEventPlugin.GlobalResponderHandler.onChange(
|
|
oldResponderInst,
|
|
nextResponderInst,
|
|
blockHostResponder
|
|
);
|
|
}
|
|
var eventTypes = {
|
|
startShouldSetResponder: {
|
|
phasedRegistrationNames: {
|
|
bubbled: "onStartShouldSetResponder",
|
|
captured: "onStartShouldSetResponderCapture"
|
|
},
|
|
dependencies: startDependencies
|
|
},
|
|
scrollShouldSetResponder: {
|
|
phasedRegistrationNames: {
|
|
bubbled: "onScrollShouldSetResponder",
|
|
captured: "onScrollShouldSetResponderCapture"
|
|
},
|
|
dependencies: ["topScroll"]
|
|
},
|
|
selectionChangeShouldSetResponder: {
|
|
phasedRegistrationNames: {
|
|
bubbled: "onSelectionChangeShouldSetResponder",
|
|
captured: "onSelectionChangeShouldSetResponderCapture"
|
|
},
|
|
dependencies: ["topSelectionChange"]
|
|
},
|
|
moveShouldSetResponder: {
|
|
phasedRegistrationNames: {
|
|
bubbled: "onMoveShouldSetResponder",
|
|
captured: "onMoveShouldSetResponderCapture"
|
|
},
|
|
dependencies: moveDependencies
|
|
},
|
|
responderStart: {
|
|
registrationName: "onResponderStart",
|
|
dependencies: startDependencies
|
|
},
|
|
responderMove: {
|
|
registrationName: "onResponderMove",
|
|
dependencies: moveDependencies
|
|
},
|
|
responderEnd: {
|
|
registrationName: "onResponderEnd",
|
|
dependencies: endDependencies
|
|
},
|
|
responderRelease: {
|
|
registrationName: "onResponderRelease",
|
|
dependencies: endDependencies
|
|
},
|
|
responderTerminationRequest: {
|
|
registrationName: "onResponderTerminationRequest",
|
|
dependencies: []
|
|
},
|
|
responderGrant: { registrationName: "onResponderGrant", dependencies: [] },
|
|
responderReject: { registrationName: "onResponderReject", dependencies: [] },
|
|
responderTerminate: {
|
|
registrationName: "onResponderTerminate",
|
|
dependencies: []
|
|
}
|
|
};
|
|
function getParent$1(inst) {
|
|
do inst = inst.return;
|
|
while (inst && 5 !== inst.tag);
|
|
return inst ? inst : null;
|
|
}
|
|
function traverseTwoPhase$1(inst, fn, arg) {
|
|
for (var path = []; inst; ) path.push(inst), (inst = getParent$1(inst));
|
|
for (inst = path.length; 0 < inst--; ) fn(path[inst], "captured", arg);
|
|
for (inst = 0; inst < path.length; inst++) fn(path[inst], "bubbled", arg);
|
|
}
|
|
function getListener$1(inst, registrationName) {
|
|
inst = inst.stateNode;
|
|
if (null === inst) return null;
|
|
inst = getFiberCurrentPropsFromNode$1(inst);
|
|
if (null === inst) return null;
|
|
if ((inst = inst[registrationName]) && "function" !== typeof inst)
|
|
throw Error(
|
|
"Expected `" +
|
|
registrationName +
|
|
"` listener to be a function, instead got a value of `" +
|
|
typeof inst +
|
|
"` type."
|
|
);
|
|
return inst;
|
|
}
|
|
function accumulateDirectionalDispatches$1(inst, phase, event) {
|
|
if (
|
|
(phase = getListener$1(
|
|
inst,
|
|
event.dispatchConfig.phasedRegistrationNames[phase]
|
|
))
|
|
)
|
|
(event._dispatchListeners = accumulateInto(
|
|
event._dispatchListeners,
|
|
phase
|
|
)),
|
|
(event._dispatchInstances = accumulateInto(
|
|
event._dispatchInstances,
|
|
inst
|
|
));
|
|
}
|
|
function accumulateDirectDispatchesSingle$1(event) {
|
|
if (event && event.dispatchConfig.registrationName) {
|
|
var inst = event._targetInst;
|
|
if (inst && event && event.dispatchConfig.registrationName) {
|
|
var listener = getListener$1(inst, event.dispatchConfig.registrationName);
|
|
listener &&
|
|
((event._dispatchListeners = accumulateInto(
|
|
event._dispatchListeners,
|
|
listener
|
|
)),
|
|
(event._dispatchInstances = accumulateInto(
|
|
event._dispatchInstances,
|
|
inst
|
|
)));
|
|
}
|
|
}
|
|
}
|
|
function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
|
|
if (event && event.dispatchConfig.phasedRegistrationNames) {
|
|
var targetInst = event._targetInst;
|
|
targetInst = targetInst ? getParent$1(targetInst) : null;
|
|
traverseTwoPhase$1(targetInst, accumulateDirectionalDispatches$1, event);
|
|
}
|
|
}
|
|
function accumulateTwoPhaseDispatchesSingle$1(event) {
|
|
event &&
|
|
event.dispatchConfig.phasedRegistrationNames &&
|
|
traverseTwoPhase$1(
|
|
event._targetInst,
|
|
accumulateDirectionalDispatches$1,
|
|
event
|
|
);
|
|
}
|
|
var ResponderEventPlugin = {
|
|
_getResponder: function () {
|
|
return responderInst;
|
|
},
|
|
eventTypes: eventTypes,
|
|
extractEvents: function (
|
|
topLevelType,
|
|
targetInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
) {
|
|
if (isStartish(topLevelType)) trackedTouchCount += 1;
|
|
else if (
|
|
"topTouchEnd" === topLevelType ||
|
|
"topTouchCancel" === topLevelType
|
|
)
|
|
if (0 <= trackedTouchCount) --trackedTouchCount;
|
|
else return null;
|
|
ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent);
|
|
if (
|
|
targetInst &&
|
|
(("topScroll" === topLevelType && !nativeEvent.responderIgnoreScroll) ||
|
|
(0 < trackedTouchCount && "topSelectionChange" === topLevelType) ||
|
|
isStartish(topLevelType) ||
|
|
isMoveish(topLevelType))
|
|
) {
|
|
var shouldSetEventType = isStartish(topLevelType)
|
|
? eventTypes.startShouldSetResponder
|
|
: isMoveish(topLevelType)
|
|
? eventTypes.moveShouldSetResponder
|
|
: "topSelectionChange" === topLevelType
|
|
? eventTypes.selectionChangeShouldSetResponder
|
|
: eventTypes.scrollShouldSetResponder;
|
|
if (responderInst)
|
|
b: {
|
|
var JSCompiler_temp = responderInst;
|
|
for (
|
|
var depthA = 0, tempA = JSCompiler_temp;
|
|
tempA;
|
|
tempA = getParent$1(tempA)
|
|
)
|
|
depthA++;
|
|
tempA = 0;
|
|
for (var tempB = targetInst; tempB; tempB = getParent$1(tempB))
|
|
tempA++;
|
|
for (; 0 < depthA - tempA; )
|
|
(JSCompiler_temp = getParent$1(JSCompiler_temp)), depthA--;
|
|
for (; 0 < tempA - depthA; )
|
|
(targetInst = getParent$1(targetInst)), tempA--;
|
|
for (; depthA--; ) {
|
|
if (
|
|
JSCompiler_temp === targetInst ||
|
|
JSCompiler_temp === targetInst.alternate
|
|
)
|
|
break b;
|
|
JSCompiler_temp = getParent$1(JSCompiler_temp);
|
|
targetInst = getParent$1(targetInst);
|
|
}
|
|
JSCompiler_temp = null;
|
|
}
|
|
else JSCompiler_temp = targetInst;
|
|
targetInst = JSCompiler_temp;
|
|
JSCompiler_temp = targetInst === responderInst;
|
|
shouldSetEventType = ResponderSyntheticEvent.getPooled(
|
|
shouldSetEventType,
|
|
targetInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
);
|
|
shouldSetEventType.touchHistory =
|
|
ResponderTouchHistoryStore.touchHistory;
|
|
JSCompiler_temp
|
|
? forEachAccumulated(
|
|
shouldSetEventType,
|
|
accumulateTwoPhaseDispatchesSingleSkipTarget
|
|
)
|
|
: forEachAccumulated(
|
|
shouldSetEventType,
|
|
accumulateTwoPhaseDispatchesSingle$1
|
|
);
|
|
b: {
|
|
JSCompiler_temp = shouldSetEventType._dispatchListeners;
|
|
targetInst = shouldSetEventType._dispatchInstances;
|
|
if (isArrayImpl(JSCompiler_temp))
|
|
for (
|
|
depthA = 0;
|
|
depthA < JSCompiler_temp.length &&
|
|
!shouldSetEventType.isPropagationStopped();
|
|
depthA++
|
|
) {
|
|
if (
|
|
JSCompiler_temp[depthA](shouldSetEventType, targetInst[depthA])
|
|
) {
|
|
JSCompiler_temp = targetInst[depthA];
|
|
break b;
|
|
}
|
|
}
|
|
else if (
|
|
JSCompiler_temp &&
|
|
JSCompiler_temp(shouldSetEventType, targetInst)
|
|
) {
|
|
JSCompiler_temp = targetInst;
|
|
break b;
|
|
}
|
|
JSCompiler_temp = null;
|
|
}
|
|
shouldSetEventType._dispatchInstances = null;
|
|
shouldSetEventType._dispatchListeners = null;
|
|
shouldSetEventType.isPersistent() ||
|
|
shouldSetEventType.constructor.release(shouldSetEventType);
|
|
if (JSCompiler_temp && JSCompiler_temp !== responderInst)
|
|
if (
|
|
((shouldSetEventType = ResponderSyntheticEvent.getPooled(
|
|
eventTypes.responderGrant,
|
|
JSCompiler_temp,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
)),
|
|
(shouldSetEventType.touchHistory =
|
|
ResponderTouchHistoryStore.touchHistory),
|
|
forEachAccumulated(
|
|
shouldSetEventType,
|
|
accumulateDirectDispatchesSingle$1
|
|
),
|
|
(targetInst = !0 === executeDirectDispatch(shouldSetEventType)),
|
|
responderInst)
|
|
)
|
|
if (
|
|
((depthA = ResponderSyntheticEvent.getPooled(
|
|
eventTypes.responderTerminationRequest,
|
|
responderInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
)),
|
|
(depthA.touchHistory = ResponderTouchHistoryStore.touchHistory),
|
|
forEachAccumulated(depthA, accumulateDirectDispatchesSingle$1),
|
|
(tempA =
|
|
!depthA._dispatchListeners || executeDirectDispatch(depthA)),
|
|
depthA.isPersistent() || depthA.constructor.release(depthA),
|
|
tempA)
|
|
) {
|
|
depthA = ResponderSyntheticEvent.getPooled(
|
|
eventTypes.responderTerminate,
|
|
responderInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
);
|
|
depthA.touchHistory = ResponderTouchHistoryStore.touchHistory;
|
|
forEachAccumulated(depthA, accumulateDirectDispatchesSingle$1);
|
|
var JSCompiler_temp$jscomp$0 = accumulate(
|
|
JSCompiler_temp$jscomp$0,
|
|
[shouldSetEventType, depthA]
|
|
);
|
|
changeResponder(JSCompiler_temp, targetInst);
|
|
} else
|
|
(shouldSetEventType = ResponderSyntheticEvent.getPooled(
|
|
eventTypes.responderReject,
|
|
JSCompiler_temp,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
)),
|
|
(shouldSetEventType.touchHistory =
|
|
ResponderTouchHistoryStore.touchHistory),
|
|
forEachAccumulated(
|
|
shouldSetEventType,
|
|
accumulateDirectDispatchesSingle$1
|
|
),
|
|
(JSCompiler_temp$jscomp$0 = accumulate(
|
|
JSCompiler_temp$jscomp$0,
|
|
shouldSetEventType
|
|
));
|
|
else
|
|
(JSCompiler_temp$jscomp$0 = accumulate(
|
|
JSCompiler_temp$jscomp$0,
|
|
shouldSetEventType
|
|
)),
|
|
changeResponder(JSCompiler_temp, targetInst);
|
|
else JSCompiler_temp$jscomp$0 = null;
|
|
} else JSCompiler_temp$jscomp$0 = null;
|
|
shouldSetEventType = responderInst && isStartish(topLevelType);
|
|
JSCompiler_temp = responderInst && isMoveish(topLevelType);
|
|
targetInst =
|
|
responderInst &&
|
|
("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType);
|
|
if (
|
|
(shouldSetEventType = shouldSetEventType
|
|
? eventTypes.responderStart
|
|
: JSCompiler_temp
|
|
? eventTypes.responderMove
|
|
: targetInst
|
|
? eventTypes.responderEnd
|
|
: null)
|
|
)
|
|
(shouldSetEventType = ResponderSyntheticEvent.getPooled(
|
|
shouldSetEventType,
|
|
responderInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
)),
|
|
(shouldSetEventType.touchHistory =
|
|
ResponderTouchHistoryStore.touchHistory),
|
|
forEachAccumulated(
|
|
shouldSetEventType,
|
|
accumulateDirectDispatchesSingle$1
|
|
),
|
|
(JSCompiler_temp$jscomp$0 = accumulate(
|
|
JSCompiler_temp$jscomp$0,
|
|
shouldSetEventType
|
|
));
|
|
shouldSetEventType = responderInst && "topTouchCancel" === topLevelType;
|
|
if (
|
|
(topLevelType =
|
|
responderInst &&
|
|
!shouldSetEventType &&
|
|
("topTouchEnd" === topLevelType || "topTouchCancel" === topLevelType))
|
|
)
|
|
a: {
|
|
if ((topLevelType = nativeEvent.touches) && 0 !== topLevelType.length)
|
|
for (
|
|
JSCompiler_temp = 0;
|
|
JSCompiler_temp < topLevelType.length;
|
|
JSCompiler_temp++
|
|
)
|
|
if (
|
|
((targetInst = topLevelType[JSCompiler_temp].target),
|
|
null !== targetInst &&
|
|
void 0 !== targetInst &&
|
|
0 !== targetInst)
|
|
) {
|
|
depthA = getInstanceFromNode(targetInst);
|
|
b: {
|
|
for (targetInst = responderInst; depthA; ) {
|
|
if (
|
|
targetInst === depthA ||
|
|
targetInst === depthA.alternate
|
|
) {
|
|
targetInst = !0;
|
|
break b;
|
|
}
|
|
depthA = getParent$1(depthA);
|
|
}
|
|
targetInst = !1;
|
|
}
|
|
if (targetInst) {
|
|
topLevelType = !1;
|
|
break a;
|
|
}
|
|
}
|
|
topLevelType = !0;
|
|
}
|
|
if (
|
|
(topLevelType = shouldSetEventType
|
|
? eventTypes.responderTerminate
|
|
: topLevelType
|
|
? eventTypes.responderRelease
|
|
: null)
|
|
)
|
|
(nativeEvent = ResponderSyntheticEvent.getPooled(
|
|
topLevelType,
|
|
responderInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
)),
|
|
(nativeEvent.touchHistory = ResponderTouchHistoryStore.touchHistory),
|
|
forEachAccumulated(nativeEvent, accumulateDirectDispatchesSingle$1),
|
|
(JSCompiler_temp$jscomp$0 = accumulate(
|
|
JSCompiler_temp$jscomp$0,
|
|
nativeEvent
|
|
)),
|
|
changeResponder(null);
|
|
return JSCompiler_temp$jscomp$0;
|
|
},
|
|
GlobalResponderHandler: null,
|
|
injection: {
|
|
injectGlobalResponderHandler: function (GlobalResponderHandler) {
|
|
ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler;
|
|
}
|
|
}
|
|
},
|
|
eventPluginOrder = null,
|
|
namesToPlugins = {};
|
|
function recomputePluginOrdering() {
|
|
if (eventPluginOrder)
|
|
for (var pluginName in namesToPlugins) {
|
|
var pluginModule = namesToPlugins[pluginName],
|
|
pluginIndex = eventPluginOrder.indexOf(pluginName);
|
|
if (-1 >= pluginIndex)
|
|
throw Error(
|
|
"EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" +
|
|
(pluginName + "`.")
|
|
);
|
|
if (!plugins[pluginIndex]) {
|
|
if (!pluginModule.extractEvents)
|
|
throw Error(
|
|
"EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" +
|
|
(pluginName + "` does not.")
|
|
);
|
|
plugins[pluginIndex] = pluginModule;
|
|
pluginIndex = pluginModule.eventTypes;
|
|
for (var eventName in pluginIndex) {
|
|
var JSCompiler_inline_result = void 0;
|
|
var dispatchConfig = pluginIndex[eventName];
|
|
if (eventNameDispatchConfigs.hasOwnProperty(eventName))
|
|
throw Error(
|
|
"EventPluginRegistry: More than one plugin attempted to publish the same event name, `" +
|
|
(eventName + "`.")
|
|
);
|
|
eventNameDispatchConfigs[eventName] = dispatchConfig;
|
|
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
|
|
if (phasedRegistrationNames) {
|
|
for (JSCompiler_inline_result in phasedRegistrationNames)
|
|
phasedRegistrationNames.hasOwnProperty(
|
|
JSCompiler_inline_result
|
|
) &&
|
|
publishRegistrationName(
|
|
phasedRegistrationNames[JSCompiler_inline_result],
|
|
pluginModule
|
|
);
|
|
JSCompiler_inline_result = !0;
|
|
} else
|
|
dispatchConfig.registrationName
|
|
? (publishRegistrationName(
|
|
dispatchConfig.registrationName,
|
|
pluginModule
|
|
),
|
|
(JSCompiler_inline_result = !0))
|
|
: (JSCompiler_inline_result = !1);
|
|
if (!JSCompiler_inline_result)
|
|
throw Error(
|
|
"EventPluginRegistry: Failed to publish event `" +
|
|
eventName +
|
|
"` for plugin `" +
|
|
pluginName +
|
|
"`."
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function publishRegistrationName(registrationName, pluginModule) {
|
|
if (registrationNameModules[registrationName])
|
|
throw Error(
|
|
"EventPluginRegistry: More than one plugin attempted to publish the same registration name, `" +
|
|
(registrationName + "`.")
|
|
);
|
|
registrationNameModules[registrationName] = pluginModule;
|
|
}
|
|
var plugins = [],
|
|
eventNameDispatchConfigs = {},
|
|
registrationNameModules = {};
|
|
function getListener(inst, registrationName) {
|
|
inst = inst.stateNode;
|
|
if (null === inst) return null;
|
|
inst = getFiberCurrentPropsFromNode$1(inst);
|
|
if (null === inst) return null;
|
|
if ((inst = inst[registrationName]) && "function" !== typeof inst)
|
|
throw Error(
|
|
"Expected `" +
|
|
registrationName +
|
|
"` listener to be a function, instead got a value of `" +
|
|
typeof inst +
|
|
"` type."
|
|
);
|
|
return inst;
|
|
}
|
|
var customBubblingEventTypes =
|
|
ReactNativePrivateInterface.ReactNativeViewConfigRegistry
|
|
.customBubblingEventTypes,
|
|
customDirectEventTypes =
|
|
ReactNativePrivateInterface.ReactNativeViewConfigRegistry
|
|
.customDirectEventTypes;
|
|
function accumulateDirectionalDispatches(inst, phase, event) {
|
|
if (
|
|
(phase = getListener(
|
|
inst,
|
|
event.dispatchConfig.phasedRegistrationNames[phase]
|
|
))
|
|
)
|
|
(event._dispatchListeners = accumulateInto(
|
|
event._dispatchListeners,
|
|
phase
|
|
)),
|
|
(event._dispatchInstances = accumulateInto(
|
|
event._dispatchInstances,
|
|
inst
|
|
));
|
|
}
|
|
function traverseTwoPhase(inst, fn, arg, skipBubbling) {
|
|
for (var path = []; inst; ) {
|
|
path.push(inst);
|
|
do inst = inst.return;
|
|
while (inst && 5 !== inst.tag);
|
|
inst = inst ? inst : null;
|
|
}
|
|
for (inst = path.length; 0 < inst--; ) fn(path[inst], "captured", arg);
|
|
if (skipBubbling) fn(path[0], "bubbled", arg);
|
|
else
|
|
for (inst = 0; inst < path.length; inst++) fn(path[inst], "bubbled", arg);
|
|
}
|
|
function accumulateTwoPhaseDispatchesSingle(event) {
|
|
event &&
|
|
event.dispatchConfig.phasedRegistrationNames &&
|
|
traverseTwoPhase(
|
|
event._targetInst,
|
|
accumulateDirectionalDispatches,
|
|
event,
|
|
!1
|
|
);
|
|
}
|
|
function accumulateDirectDispatchesSingle(event) {
|
|
if (event && event.dispatchConfig.registrationName) {
|
|
var inst = event._targetInst;
|
|
if (inst && event && event.dispatchConfig.registrationName) {
|
|
var listener = getListener(inst, event.dispatchConfig.registrationName);
|
|
listener &&
|
|
((event._dispatchListeners = accumulateInto(
|
|
event._dispatchListeners,
|
|
listener
|
|
)),
|
|
(event._dispatchInstances = accumulateInto(
|
|
event._dispatchInstances,
|
|
inst
|
|
)));
|
|
}
|
|
}
|
|
}
|
|
if (eventPluginOrder)
|
|
throw Error(
|
|
"EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React."
|
|
);
|
|
eventPluginOrder = Array.prototype.slice.call([
|
|
"ResponderEventPlugin",
|
|
"ReactNativeBridgeEventPlugin"
|
|
]);
|
|
recomputePluginOrdering();
|
|
var injectedNamesToPlugins$jscomp$inline_234 = {
|
|
ResponderEventPlugin: ResponderEventPlugin,
|
|
ReactNativeBridgeEventPlugin: {
|
|
eventTypes: {},
|
|
extractEvents: function (
|
|
topLevelType,
|
|
targetInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
) {
|
|
if (null == targetInst) return null;
|
|
var bubbleDispatchConfig = customBubblingEventTypes[topLevelType],
|
|
directDispatchConfig = customDirectEventTypes[topLevelType];
|
|
if (!bubbleDispatchConfig && !directDispatchConfig)
|
|
throw Error(
|
|
'Unsupported top level event type "' + topLevelType + '" dispatched'
|
|
);
|
|
topLevelType = SyntheticEvent.getPooled(
|
|
bubbleDispatchConfig || directDispatchConfig,
|
|
targetInst,
|
|
nativeEvent,
|
|
nativeEventTarget
|
|
);
|
|
if (bubbleDispatchConfig)
|
|
null != topLevelType &&
|
|
null != topLevelType.dispatchConfig.phasedRegistrationNames &&
|
|
topLevelType.dispatchConfig.phasedRegistrationNames.skipBubbling
|
|
? topLevelType &&
|
|
topLevelType.dispatchConfig.phasedRegistrationNames &&
|
|
traverseTwoPhase(
|
|
topLevelType._targetInst,
|
|
accumulateDirectionalDispatches,
|
|
topLevelType,
|
|
!0
|
|
)
|
|
: forEachAccumulated(
|
|
topLevelType,
|
|
accumulateTwoPhaseDispatchesSingle
|
|
);
|
|
else if (directDispatchConfig)
|
|
forEachAccumulated(topLevelType, accumulateDirectDispatchesSingle);
|
|
else return null;
|
|
return topLevelType;
|
|
}
|
|
}
|
|
},
|
|
isOrderingDirty$jscomp$inline_235 = !1,
|
|
pluginName$jscomp$inline_236;
|
|
for (pluginName$jscomp$inline_236 in injectedNamesToPlugins$jscomp$inline_234)
|
|
if (
|
|
injectedNamesToPlugins$jscomp$inline_234.hasOwnProperty(
|
|
pluginName$jscomp$inline_236
|
|
)
|
|
) {
|
|
var pluginModule$jscomp$inline_237 =
|
|
injectedNamesToPlugins$jscomp$inline_234[pluginName$jscomp$inline_236];
|
|
if (
|
|
!namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_236) ||
|
|
namesToPlugins[pluginName$jscomp$inline_236] !==
|
|
pluginModule$jscomp$inline_237
|
|
) {
|
|
if (namesToPlugins[pluginName$jscomp$inline_236])
|
|
throw Error(
|
|
"EventPluginRegistry: Cannot inject two different event plugins using the same name, `" +
|
|
(pluginName$jscomp$inline_236 + "`.")
|
|
);
|
|
namesToPlugins[pluginName$jscomp$inline_236] =
|
|
pluginModule$jscomp$inline_237;
|
|
isOrderingDirty$jscomp$inline_235 = !0;
|
|
}
|
|
}
|
|
isOrderingDirty$jscomp$inline_235 && recomputePluginOrdering();
|
|
var instanceCache = new Map(),
|
|
instanceProps = new Map();
|
|
function getInstanceFromTag(tag) {
|
|
return instanceCache.get(tag) || null;
|
|
}
|
|
function batchedUpdatesImpl(fn, bookkeeping) {
|
|
return fn(bookkeeping);
|
|
}
|
|
var isInsideEventHandler = !1;
|
|
function batchedUpdates$1(fn, bookkeeping) {
|
|
if (isInsideEventHandler) return fn(bookkeeping);
|
|
isInsideEventHandler = !0;
|
|
try {
|
|
return batchedUpdatesImpl(fn, bookkeeping);
|
|
} finally {
|
|
isInsideEventHandler = !1;
|
|
}
|
|
}
|
|
var eventQueue = null;
|
|
function executeDispatchesAndReleaseTopLevel(e) {
|
|
if (e) {
|
|
var dispatchListeners = e._dispatchListeners,
|
|
dispatchInstances = e._dispatchInstances;
|
|
if (isArrayImpl(dispatchListeners))
|
|
for (
|
|
var i = 0;
|
|
i < dispatchListeners.length && !e.isPropagationStopped();
|
|
i++
|
|
)
|
|
executeDispatch(e, dispatchListeners[i], dispatchInstances[i]);
|
|
else
|
|
dispatchListeners &&
|
|
executeDispatch(e, dispatchListeners, dispatchInstances);
|
|
e._dispatchListeners = null;
|
|
e._dispatchInstances = null;
|
|
e.isPersistent() || e.constructor.release(e);
|
|
}
|
|
}
|
|
var EMPTY_NATIVE_EVENT = {};
|
|
function _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam) {
|
|
var nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT,
|
|
inst = getInstanceFromTag(rootNodeID),
|
|
target = null;
|
|
null != inst && (target = inst.stateNode);
|
|
batchedUpdates$1(function () {
|
|
var JSCompiler_inline_result = target;
|
|
for (
|
|
var events = null, legacyPlugins = plugins, i = 0;
|
|
i < legacyPlugins.length;
|
|
i++
|
|
) {
|
|
var possiblePlugin = legacyPlugins[i];
|
|
possiblePlugin &&
|
|
(possiblePlugin = possiblePlugin.extractEvents(
|
|
topLevelType,
|
|
inst,
|
|
nativeEvent,
|
|
JSCompiler_inline_result
|
|
)) &&
|
|
(events = accumulateInto(events, possiblePlugin));
|
|
}
|
|
JSCompiler_inline_result = events;
|
|
null !== JSCompiler_inline_result &&
|
|
(eventQueue = accumulateInto(eventQueue, JSCompiler_inline_result));
|
|
JSCompiler_inline_result = eventQueue;
|
|
eventQueue = null;
|
|
if (JSCompiler_inline_result) {
|
|
forEachAccumulated(
|
|
JSCompiler_inline_result,
|
|
executeDispatchesAndReleaseTopLevel
|
|
);
|
|
if (eventQueue)
|
|
throw Error(
|
|
"processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented."
|
|
);
|
|
if (hasError)
|
|
throw (
|
|
((JSCompiler_inline_result = caughtError),
|
|
(hasError = !1),
|
|
(caughtError = null),
|
|
JSCompiler_inline_result)
|
|
);
|
|
}
|
|
});
|
|
}
|
|
ReactNativePrivateInterface.RCTEventEmitter.register({
|
|
receiveEvent: function (rootNodeID, topLevelType, nativeEventParam) {
|
|
_receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam);
|
|
},
|
|
receiveTouches: function (eventTopLevelType, touches, changedIndices) {
|
|
if (
|
|
"topTouchEnd" === eventTopLevelType ||
|
|
"topTouchCancel" === eventTopLevelType
|
|
) {
|
|
var JSCompiler_temp = [];
|
|
for (var i = 0; i < changedIndices.length; i++) {
|
|
var index$0 = changedIndices[i];
|
|
JSCompiler_temp.push(touches[index$0]);
|
|
touches[index$0] = null;
|
|
}
|
|
for (i = changedIndices = 0; i < touches.length; i++)
|
|
(index$0 = touches[i]),
|
|
null !== index$0 && (touches[changedIndices++] = index$0);
|
|
touches.length = changedIndices;
|
|
} else
|
|
for (JSCompiler_temp = [], i = 0; i < changedIndices.length; i++)
|
|
JSCompiler_temp.push(touches[changedIndices[i]]);
|
|
for (
|
|
changedIndices = 0;
|
|
changedIndices < JSCompiler_temp.length;
|
|
changedIndices++
|
|
) {
|
|
i = JSCompiler_temp[changedIndices];
|
|
i.changedTouches = JSCompiler_temp;
|
|
i.touches = touches;
|
|
index$0 = null;
|
|
var target = i.target;
|
|
null === target || void 0 === target || 1 > target || (index$0 = target);
|
|
_receiveRootNodeIDEvent(index$0, eventTopLevelType, i);
|
|
}
|
|
}
|
|
});
|
|
getFiberCurrentPropsFromNode$1 = function (stateNode) {
|
|
return instanceProps.get(stateNode._nativeTag) || null;
|
|
};
|
|
getInstanceFromNode = getInstanceFromTag;
|
|
getNodeFromInstance = function (inst) {
|
|
inst = inst.stateNode;
|
|
var tag = inst._nativeTag;
|
|
void 0 === tag &&
|
|
null != inst.canonical &&
|
|
((tag = inst.canonical.nativeTag), (inst = inst.canonical.publicInstance));
|
|
if (!tag) throw Error("All native instances should have a tag.");
|
|
return inst;
|
|
};
|
|
ResponderEventPlugin.injection.injectGlobalResponderHandler({
|
|
onChange: function (from, to, blockNativeResponder) {
|
|
null !== to
|
|
? ReactNativePrivateInterface.UIManager.setJSResponder(
|
|
to.stateNode._nativeTag,
|
|
blockNativeResponder
|
|
)
|
|
: ReactNativePrivateInterface.UIManager.clearJSResponder();
|
|
}
|
|
});
|
|
var ReactSharedInternals =
|
|
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
|
|
REACT_ELEMENT_TYPE = Symbol.for("react.element"),
|
|
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
|
|
REACT_PROVIDER_TYPE = Symbol.for("react.provider"),
|
|
REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
|
|
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
|
REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
Symbol.for("react.scope");
|
|
Symbol.for("react.debug_trace_mode");
|
|
var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
|
|
Symbol.for("react.legacy_hidden");
|
|
Symbol.for("react.cache");
|
|
Symbol.for("react.tracing_marker");
|
|
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
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;
|
|
}
|
|
Symbol.for("react.client.reference");
|
|
function getNearestMountedFiber(fiber) {
|
|
var node = fiber,
|
|
nearestMounted = fiber;
|
|
if (fiber.alternate) for (; node.return; ) node = node.return;
|
|
else {
|
|
fiber = node;
|
|
do
|
|
(node = fiber),
|
|
0 !== (node.flags & 4098) && (nearestMounted = node.return),
|
|
(fiber = node.return);
|
|
while (fiber);
|
|
}
|
|
return 3 === node.tag ? nearestMounted : null;
|
|
}
|
|
function assertIsMounted(fiber) {
|
|
if (getNearestMountedFiber(fiber) !== fiber)
|
|
throw Error("Unable to find node on an unmounted component.");
|
|
}
|
|
function findCurrentFiberUsingSlowPath(fiber) {
|
|
var alternate = fiber.alternate;
|
|
if (!alternate) {
|
|
alternate = getNearestMountedFiber(fiber);
|
|
if (null === alternate)
|
|
throw Error("Unable to find node on an unmounted component.");
|
|
return alternate !== fiber ? null : fiber;
|
|
}
|
|
for (var a = fiber, b = alternate; ; ) {
|
|
var parentA = a.return;
|
|
if (null === parentA) break;
|
|
var parentB = parentA.alternate;
|
|
if (null === parentB) {
|
|
b = parentA.return;
|
|
if (null !== b) {
|
|
a = b;
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
if (parentA.child === parentB.child) {
|
|
for (parentB = parentA.child; parentB; ) {
|
|
if (parentB === a) return assertIsMounted(parentA), fiber;
|
|
if (parentB === b) return assertIsMounted(parentA), alternate;
|
|
parentB = parentB.sibling;
|
|
}
|
|
throw Error("Unable to find node on an unmounted component.");
|
|
}
|
|
if (a.return !== b.return) (a = parentA), (b = parentB);
|
|
else {
|
|
for (var didFindChild = !1, child$1 = parentA.child; child$1; ) {
|
|
if (child$1 === a) {
|
|
didFindChild = !0;
|
|
a = parentA;
|
|
b = parentB;
|
|
break;
|
|
}
|
|
if (child$1 === b) {
|
|
didFindChild = !0;
|
|
b = parentA;
|
|
a = parentB;
|
|
break;
|
|
}
|
|
child$1 = child$1.sibling;
|
|
}
|
|
if (!didFindChild) {
|
|
for (child$1 = parentB.child; child$1; ) {
|
|
if (child$1 === a) {
|
|
didFindChild = !0;
|
|
a = parentB;
|
|
b = parentA;
|
|
break;
|
|
}
|
|
if (child$1 === b) {
|
|
didFindChild = !0;
|
|
b = parentB;
|
|
a = parentA;
|
|
break;
|
|
}
|
|
child$1 = child$1.sibling;
|
|
}
|
|
if (!didFindChild)
|
|
throw Error(
|
|
"Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue."
|
|
);
|
|
}
|
|
}
|
|
if (a.alternate !== b)
|
|
throw Error(
|
|
"Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
}
|
|
if (3 !== a.tag)
|
|
throw Error("Unable to find node on an unmounted component.");
|
|
return a.stateNode.current === a ? fiber : alternate;
|
|
}
|
|
function findCurrentHostFiber(parent) {
|
|
parent = findCurrentFiberUsingSlowPath(parent);
|
|
return null !== parent ? findCurrentHostFiberImpl(parent) : null;
|
|
}
|
|
function findCurrentHostFiberImpl(node) {
|
|
var tag = node.tag;
|
|
if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return node;
|
|
for (node = node.child; null !== node; ) {
|
|
tag = findCurrentHostFiberImpl(node);
|
|
if (null !== tag) return tag;
|
|
node = node.sibling;
|
|
}
|
|
return null;
|
|
}
|
|
var emptyObject = {},
|
|
removedKeys = null,
|
|
removedKeyCount = 0,
|
|
deepDifferOptions = { unsafelyIgnoreFunctions: !0 };
|
|
function defaultDiffer(prevProp, nextProp) {
|
|
return "object" !== typeof nextProp || null === nextProp
|
|
? !0
|
|
: ReactNativePrivateInterface.deepDiffer(
|
|
prevProp,
|
|
nextProp,
|
|
deepDifferOptions
|
|
);
|
|
}
|
|
function restoreDeletedValuesInNestedArray(
|
|
updatePayload,
|
|
node,
|
|
validAttributes
|
|
) {
|
|
if (isArrayImpl(node))
|
|
for (var i = node.length; i-- && 0 < removedKeyCount; )
|
|
restoreDeletedValuesInNestedArray(
|
|
updatePayload,
|
|
node[i],
|
|
validAttributes
|
|
);
|
|
else if (node && 0 < removedKeyCount)
|
|
for (i in removedKeys)
|
|
if (removedKeys[i]) {
|
|
var nextProp = node[i];
|
|
if (void 0 !== nextProp) {
|
|
var attributeConfig = validAttributes[i];
|
|
if (attributeConfig) {
|
|
"function" === typeof nextProp && (nextProp = !0);
|
|
"undefined" === typeof nextProp && (nextProp = null);
|
|
if ("object" !== typeof attributeConfig)
|
|
updatePayload[i] = nextProp;
|
|
else if (
|
|
"function" === typeof attributeConfig.diff ||
|
|
"function" === typeof attributeConfig.process
|
|
)
|
|
(nextProp =
|
|
"function" === typeof attributeConfig.process
|
|
? attributeConfig.process(nextProp)
|
|
: nextProp),
|
|
(updatePayload[i] = nextProp);
|
|
removedKeys[i] = !1;
|
|
removedKeyCount--;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function diffNestedProperty(
|
|
updatePayload,
|
|
prevProp,
|
|
nextProp,
|
|
validAttributes
|
|
) {
|
|
if (!updatePayload && prevProp === nextProp) return updatePayload;
|
|
if (!prevProp || !nextProp)
|
|
return nextProp
|
|
? addNestedProperty(updatePayload, nextProp, validAttributes)
|
|
: prevProp
|
|
? clearNestedProperty(updatePayload, prevProp, validAttributes)
|
|
: updatePayload;
|
|
if (!isArrayImpl(prevProp) && !isArrayImpl(nextProp))
|
|
return diffProperties(updatePayload, prevProp, nextProp, validAttributes);
|
|
if (isArrayImpl(prevProp) && isArrayImpl(nextProp)) {
|
|
var minLength =
|
|
prevProp.length < nextProp.length ? prevProp.length : nextProp.length,
|
|
i;
|
|
for (i = 0; i < minLength; i++)
|
|
updatePayload = diffNestedProperty(
|
|
updatePayload,
|
|
prevProp[i],
|
|
nextProp[i],
|
|
validAttributes
|
|
);
|
|
for (; i < prevProp.length; i++)
|
|
updatePayload = clearNestedProperty(
|
|
updatePayload,
|
|
prevProp[i],
|
|
validAttributes
|
|
);
|
|
for (; i < nextProp.length; i++)
|
|
updatePayload = addNestedProperty(
|
|
updatePayload,
|
|
nextProp[i],
|
|
validAttributes
|
|
);
|
|
return updatePayload;
|
|
}
|
|
return isArrayImpl(prevProp)
|
|
? diffProperties(
|
|
updatePayload,
|
|
ReactNativePrivateInterface.flattenStyle(prevProp),
|
|
nextProp,
|
|
validAttributes
|
|
)
|
|
: diffProperties(
|
|
updatePayload,
|
|
prevProp,
|
|
ReactNativePrivateInterface.flattenStyle(nextProp),
|
|
validAttributes
|
|
);
|
|
}
|
|
function addNestedProperty(updatePayload, nextProp, validAttributes) {
|
|
if (!nextProp) return updatePayload;
|
|
if (!isArrayImpl(nextProp))
|
|
return diffProperties(
|
|
updatePayload,
|
|
emptyObject,
|
|
nextProp,
|
|
validAttributes
|
|
);
|
|
for (var i = 0; i < nextProp.length; i++)
|
|
updatePayload = addNestedProperty(
|
|
updatePayload,
|
|
nextProp[i],
|
|
validAttributes
|
|
);
|
|
return updatePayload;
|
|
}
|
|
function clearNestedProperty(updatePayload, prevProp, validAttributes) {
|
|
if (!prevProp) return updatePayload;
|
|
if (!isArrayImpl(prevProp))
|
|
return diffProperties(
|
|
updatePayload,
|
|
prevProp,
|
|
emptyObject,
|
|
validAttributes
|
|
);
|
|
for (var i = 0; i < prevProp.length; i++)
|
|
updatePayload = clearNestedProperty(
|
|
updatePayload,
|
|
prevProp[i],
|
|
validAttributes
|
|
);
|
|
return updatePayload;
|
|
}
|
|
function diffProperties(updatePayload, prevProps, nextProps, validAttributes) {
|
|
var attributeConfig, propKey;
|
|
for (propKey in nextProps)
|
|
if ((attributeConfig = validAttributes[propKey])) {
|
|
var prevProp = prevProps[propKey];
|
|
var nextProp = nextProps[propKey];
|
|
"function" === typeof nextProp &&
|
|
((nextProp = !0), "function" === typeof prevProp && (prevProp = !0));
|
|
"undefined" === typeof nextProp &&
|
|
((nextProp = null),
|
|
"undefined" === typeof prevProp && (prevProp = null));
|
|
removedKeys && (removedKeys[propKey] = !1);
|
|
if (updatePayload && void 0 !== updatePayload[propKey])
|
|
if ("object" !== typeof attributeConfig)
|
|
updatePayload[propKey] = nextProp;
|
|
else {
|
|
if (
|
|
"function" === typeof attributeConfig.diff ||
|
|
"function" === typeof attributeConfig.process
|
|
)
|
|
(attributeConfig =
|
|
"function" === typeof attributeConfig.process
|
|
? attributeConfig.process(nextProp)
|
|
: nextProp),
|
|
(updatePayload[propKey] = attributeConfig);
|
|
}
|
|
else if (prevProp !== nextProp)
|
|
if ("object" !== typeof attributeConfig)
|
|
defaultDiffer(prevProp, nextProp) &&
|
|
((updatePayload || (updatePayload = {}))[propKey] = nextProp);
|
|
else if (
|
|
"function" === typeof attributeConfig.diff ||
|
|
"function" === typeof attributeConfig.process
|
|
) {
|
|
if (
|
|
void 0 === prevProp ||
|
|
("function" === typeof attributeConfig.diff
|
|
? attributeConfig.diff(prevProp, nextProp)
|
|
: defaultDiffer(prevProp, nextProp))
|
|
)
|
|
(attributeConfig =
|
|
"function" === typeof attributeConfig.process
|
|
? attributeConfig.process(nextProp)
|
|
: nextProp),
|
|
((updatePayload || (updatePayload = {}))[propKey] =
|
|
attributeConfig);
|
|
} else
|
|
(removedKeys = null),
|
|
(removedKeyCount = 0),
|
|
(updatePayload = diffNestedProperty(
|
|
updatePayload,
|
|
prevProp,
|
|
nextProp,
|
|
attributeConfig
|
|
)),
|
|
0 < removedKeyCount &&
|
|
updatePayload &&
|
|
(restoreDeletedValuesInNestedArray(
|
|
updatePayload,
|
|
nextProp,
|
|
attributeConfig
|
|
),
|
|
(removedKeys = null));
|
|
}
|
|
for (var propKey$3 in prevProps)
|
|
void 0 === nextProps[propKey$3] &&
|
|
(!(attributeConfig = validAttributes[propKey$3]) ||
|
|
(updatePayload && void 0 !== updatePayload[propKey$3]) ||
|
|
((prevProp = prevProps[propKey$3]),
|
|
void 0 !== prevProp &&
|
|
("object" !== typeof attributeConfig ||
|
|
"function" === typeof attributeConfig.diff ||
|
|
"function" === typeof attributeConfig.process
|
|
? (((updatePayload || (updatePayload = {}))[propKey$3] = null),
|
|
removedKeys || (removedKeys = {}),
|
|
removedKeys[propKey$3] ||
|
|
((removedKeys[propKey$3] = !0), removedKeyCount++))
|
|
: (updatePayload = clearNestedProperty(
|
|
updatePayload,
|
|
prevProp,
|
|
attributeConfig
|
|
)))));
|
|
return updatePayload;
|
|
}
|
|
function mountSafeCallback_NOT_REALLY_SAFE(context, callback) {
|
|
return function () {
|
|
if (
|
|
callback &&
|
|
("boolean" !== typeof context.__isMounted || context.__isMounted)
|
|
)
|
|
return callback.apply(context, arguments);
|
|
};
|
|
}
|
|
var ReactNativeFiberHostComponent = (function () {
|
|
function ReactNativeFiberHostComponent(tag, viewConfig) {
|
|
this.viewConfig = this._internalFiberInstanceHandleDEV = void 0;
|
|
this._nativeTag = tag;
|
|
this._children = [];
|
|
this.viewConfig = viewConfig;
|
|
}
|
|
var _proto = ReactNativeFiberHostComponent.prototype;
|
|
_proto.blur = function () {
|
|
ReactNativePrivateInterface.TextInputState.blurTextInput(this);
|
|
};
|
|
_proto.focus = function () {
|
|
ReactNativePrivateInterface.TextInputState.focusTextInput(this);
|
|
};
|
|
_proto.measure = function (callback) {
|
|
ReactNativePrivateInterface.UIManager.measure(
|
|
this._nativeTag,
|
|
mountSafeCallback_NOT_REALLY_SAFE(this, callback)
|
|
);
|
|
};
|
|
_proto.measureInWindow = function (callback) {
|
|
ReactNativePrivateInterface.UIManager.measureInWindow(
|
|
this._nativeTag,
|
|
mountSafeCallback_NOT_REALLY_SAFE(this, callback)
|
|
);
|
|
};
|
|
_proto.measureLayout = function (relativeToNativeNode, onSuccess, onFail) {
|
|
if ("number" === typeof relativeToNativeNode)
|
|
var relativeNode = relativeToNativeNode;
|
|
else
|
|
relativeToNativeNode._nativeTag &&
|
|
(relativeNode = relativeToNativeNode._nativeTag);
|
|
null != relativeNode &&
|
|
ReactNativePrivateInterface.UIManager.measureLayout(
|
|
this._nativeTag,
|
|
relativeNode,
|
|
mountSafeCallback_NOT_REALLY_SAFE(this, onFail),
|
|
mountSafeCallback_NOT_REALLY_SAFE(this, onSuccess)
|
|
);
|
|
};
|
|
_proto.setNativeProps = function (nativeProps) {
|
|
nativeProps = diffProperties(
|
|
null,
|
|
emptyObject,
|
|
nativeProps,
|
|
this.viewConfig.validAttributes
|
|
);
|
|
null != nativeProps &&
|
|
ReactNativePrivateInterface.UIManager.updateView(
|
|
this._nativeTag,
|
|
this.viewConfig.uiViewClassName,
|
|
nativeProps
|
|
);
|
|
};
|
|
return ReactNativeFiberHostComponent;
|
|
})(),
|
|
scheduleCallback$2 = Scheduler.unstable_scheduleCallback,
|
|
cancelCallback$1 = Scheduler.unstable_cancelCallback,
|
|
shouldYield = Scheduler.unstable_shouldYield,
|
|
requestPaint = Scheduler.unstable_requestPaint,
|
|
now = Scheduler.unstable_now,
|
|
ImmediatePriority = Scheduler.unstable_ImmediatePriority,
|
|
UserBlockingPriority = Scheduler.unstable_UserBlockingPriority,
|
|
NormalPriority = Scheduler.unstable_NormalPriority,
|
|
IdlePriority = Scheduler.unstable_IdlePriority,
|
|
rendererID = null,
|
|
injectedHook = null;
|
|
function onCommitRoot(root) {
|
|
if (injectedHook && "function" === typeof injectedHook.onCommitFiberRoot)
|
|
try {
|
|
injectedHook.onCommitFiberRoot(
|
|
rendererID,
|
|
root,
|
|
void 0,
|
|
128 === (root.current.flags & 128)
|
|
);
|
|
} catch (err) {}
|
|
}
|
|
var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback,
|
|
log = Math.log,
|
|
LN2 = Math.LN2;
|
|
function clz32Fallback(x) {
|
|
x >>>= 0;
|
|
return 0 === x ? 32 : (31 - ((log(x) / LN2) | 0)) | 0;
|
|
}
|
|
var nextTransitionLane = 128,
|
|
nextRetryLane = 4194304;
|
|
function getHighestPriorityLanes(lanes) {
|
|
var pendingSyncLanes = lanes & 42;
|
|
if (0 !== pendingSyncLanes) return pendingSyncLanes;
|
|
switch (lanes & -lanes) {
|
|
case 1:
|
|
return 1;
|
|
case 2:
|
|
return 2;
|
|
case 4:
|
|
return 4;
|
|
case 8:
|
|
return 8;
|
|
case 16:
|
|
return 16;
|
|
case 32:
|
|
return 32;
|
|
case 64:
|
|
return 64;
|
|
case 128:
|
|
case 256:
|
|
case 512:
|
|
case 1024:
|
|
case 2048:
|
|
case 4096:
|
|
case 8192:
|
|
case 16384:
|
|
case 32768:
|
|
case 65536:
|
|
case 131072:
|
|
case 262144:
|
|
case 524288:
|
|
case 1048576:
|
|
case 2097152:
|
|
return lanes & 4194176;
|
|
case 4194304:
|
|
case 8388608:
|
|
case 16777216:
|
|
case 33554432:
|
|
return lanes & 62914560;
|
|
case 67108864:
|
|
return 67108864;
|
|
case 134217728:
|
|
return 134217728;
|
|
case 268435456:
|
|
return 268435456;
|
|
case 536870912:
|
|
return 536870912;
|
|
case 1073741824:
|
|
return 0;
|
|
default:
|
|
return lanes;
|
|
}
|
|
}
|
|
function getNextLanes(root, wipLanes) {
|
|
var pendingLanes = root.pendingLanes;
|
|
if (0 === pendingLanes) return 0;
|
|
var nextLanes = 0,
|
|
suspendedLanes = root.suspendedLanes;
|
|
root = root.pingedLanes;
|
|
var nonIdlePendingLanes = pendingLanes & 134217727;
|
|
0 !== nonIdlePendingLanes
|
|
? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes),
|
|
0 !== pendingLanes
|
|
? (nextLanes = getHighestPriorityLanes(pendingLanes))
|
|
: ((root &= nonIdlePendingLanes),
|
|
0 !== root && (nextLanes = getHighestPriorityLanes(root))))
|
|
: ((pendingLanes &= ~suspendedLanes),
|
|
0 !== pendingLanes
|
|
? (nextLanes = getHighestPriorityLanes(pendingLanes))
|
|
: 0 !== root && (nextLanes = getHighestPriorityLanes(root)));
|
|
return 0 === nextLanes
|
|
? 0
|
|
: 0 !== wipLanes &&
|
|
wipLanes !== nextLanes &&
|
|
0 === (wipLanes & suspendedLanes) &&
|
|
((suspendedLanes = nextLanes & -nextLanes),
|
|
(root = wipLanes & -wipLanes),
|
|
suspendedLanes >= root ||
|
|
(32 === suspendedLanes && 0 !== (root & 4194176)))
|
|
? wipLanes
|
|
: nextLanes;
|
|
}
|
|
function computeExpirationTime(lane, currentTime) {
|
|
switch (lane) {
|
|
case 1:
|
|
case 2:
|
|
case 4:
|
|
case 8:
|
|
return currentTime + 250;
|
|
case 16:
|
|
case 32:
|
|
case 64:
|
|
case 128:
|
|
case 256:
|
|
case 512:
|
|
case 1024:
|
|
case 2048:
|
|
case 4096:
|
|
case 8192:
|
|
case 16384:
|
|
case 32768:
|
|
case 65536:
|
|
case 131072:
|
|
case 262144:
|
|
case 524288:
|
|
case 1048576:
|
|
case 2097152:
|
|
return currentTime + 5e3;
|
|
case 4194304:
|
|
case 8388608:
|
|
case 16777216:
|
|
case 33554432:
|
|
return -1;
|
|
case 67108864:
|
|
case 134217728:
|
|
case 268435456:
|
|
case 536870912:
|
|
case 1073741824:
|
|
return -1;
|
|
default:
|
|
return -1;
|
|
}
|
|
}
|
|
function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) {
|
|
if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) return 0;
|
|
root = root.pendingLanes & -536870913;
|
|
return 0 !== root ? root : root & 536870912 ? 536870912 : 0;
|
|
}
|
|
function claimNextTransitionLane() {
|
|
var lane = nextTransitionLane;
|
|
nextTransitionLane <<= 1;
|
|
0 === (nextTransitionLane & 4194176) && (nextTransitionLane = 128);
|
|
return lane;
|
|
}
|
|
function claimNextRetryLane() {
|
|
var lane = nextRetryLane;
|
|
nextRetryLane <<= 1;
|
|
0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304);
|
|
return lane;
|
|
}
|
|
function createLaneMap(initial) {
|
|
for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial);
|
|
return laneMap;
|
|
}
|
|
function markRootUpdated$1(root, updateLane) {
|
|
root.pendingLanes |= updateLane;
|
|
268435456 !== updateLane &&
|
|
((root.suspendedLanes = 0), (root.pingedLanes = 0));
|
|
}
|
|
function markRootFinished(root, remainingLanes, spawnedLane) {
|
|
var noLongerPendingLanes = root.pendingLanes & ~remainingLanes;
|
|
root.pendingLanes = remainingLanes;
|
|
root.suspendedLanes = 0;
|
|
root.pingedLanes = 0;
|
|
root.expiredLanes &= remainingLanes;
|
|
root.entangledLanes &= remainingLanes;
|
|
root.errorRecoveryDisabledLanes &= remainingLanes;
|
|
root.shellSuspendCounter = 0;
|
|
remainingLanes = root.entanglements;
|
|
for (
|
|
var expirationTimes = root.expirationTimes,
|
|
hiddenUpdates = root.hiddenUpdates;
|
|
0 < noLongerPendingLanes;
|
|
|
|
) {
|
|
var index$7 = 31 - clz32(noLongerPendingLanes),
|
|
lane = 1 << index$7;
|
|
remainingLanes[index$7] = 0;
|
|
expirationTimes[index$7] = -1;
|
|
var hiddenUpdatesForLane = hiddenUpdates[index$7];
|
|
if (null !== hiddenUpdatesForLane)
|
|
for (
|
|
hiddenUpdates[index$7] = null, index$7 = 0;
|
|
index$7 < hiddenUpdatesForLane.length;
|
|
index$7++
|
|
) {
|
|
var update = hiddenUpdatesForLane[index$7];
|
|
null !== update && (update.lane &= -536870913);
|
|
}
|
|
noLongerPendingLanes &= ~lane;
|
|
}
|
|
0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0);
|
|
}
|
|
function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) {
|
|
root.pendingLanes |= spawnedLane;
|
|
root.suspendedLanes &= ~spawnedLane;
|
|
var spawnedLaneIndex = 31 - clz32(spawnedLane);
|
|
root.entangledLanes |= spawnedLane;
|
|
root.entanglements[spawnedLaneIndex] =
|
|
root.entanglements[spawnedLaneIndex] |
|
|
1073741824 |
|
|
(entangledLanes & 4194218);
|
|
}
|
|
function markRootEntangled(root, entangledLanes) {
|
|
var rootEntangledLanes = (root.entangledLanes |= entangledLanes);
|
|
for (root = root.entanglements; rootEntangledLanes; ) {
|
|
var index$8 = 31 - clz32(rootEntangledLanes),
|
|
lane = 1 << index$8;
|
|
(lane & entangledLanes) | (root[index$8] & entangledLanes) &&
|
|
(root[index$8] |= entangledLanes);
|
|
rootEntangledLanes &= ~lane;
|
|
}
|
|
}
|
|
var currentUpdatePriority = 0;
|
|
function lanesToEventPriority(lanes) {
|
|
lanes &= -lanes;
|
|
return 2 < lanes
|
|
? 8 < lanes
|
|
? 0 !== (lanes & 134217727)
|
|
? 32
|
|
: 268435456
|
|
: 8
|
|
: 2;
|
|
}
|
|
function shim$1() {
|
|
throw Error(
|
|
"The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
}
|
|
var getViewConfigForType =
|
|
ReactNativePrivateInterface.ReactNativeViewConfigRegistry.get,
|
|
nextReactTag = 3;
|
|
function allocateTag() {
|
|
var tag = nextReactTag;
|
|
1 === tag % 10 && (tag += 2);
|
|
nextReactTag = tag + 2;
|
|
return tag;
|
|
}
|
|
function recursivelyUncacheFiberNode(node) {
|
|
if ("number" === typeof node)
|
|
instanceCache.delete(node), instanceProps.delete(node);
|
|
else {
|
|
var tag = node._nativeTag;
|
|
instanceCache.delete(tag);
|
|
instanceProps.delete(tag);
|
|
node._children.forEach(recursivelyUncacheFiberNode);
|
|
}
|
|
}
|
|
function finalizeInitialChildren(parentInstance) {
|
|
if (0 === parentInstance._children.length) return !1;
|
|
var nativeTags = parentInstance._children.map(function (child) {
|
|
return "number" === typeof child ? child : child._nativeTag;
|
|
});
|
|
ReactNativePrivateInterface.UIManager.setChildren(
|
|
parentInstance._nativeTag,
|
|
nativeTags
|
|
);
|
|
return !1;
|
|
}
|
|
function getPublicInstance(instance) {
|
|
return null != instance.canonical && null != instance.canonical.publicInstance
|
|
? instance.canonical.publicInstance
|
|
: instance;
|
|
}
|
|
var scheduleTimeout = setTimeout,
|
|
cancelTimeout = clearTimeout,
|
|
valueStack = [],
|
|
index = -1;
|
|
function createCursor(defaultValue) {
|
|
return { current: defaultValue };
|
|
}
|
|
function pop(cursor) {
|
|
0 > index ||
|
|
((cursor.current = valueStack[index]), (valueStack[index] = null), index--);
|
|
}
|
|
function push(cursor, value) {
|
|
index++;
|
|
valueStack[index] = cursor.current;
|
|
cursor.current = value;
|
|
}
|
|
var emptyContextObject = {};
|
|
function is(x, y) {
|
|
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
|
|
}
|
|
var objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
contextStackCursor = createCursor(null),
|
|
contextFiberStackCursor = createCursor(null),
|
|
rootInstanceStackCursor = createCursor(null);
|
|
function pushHostContainer(fiber, nextRootInstance) {
|
|
push(rootInstanceStackCursor, nextRootInstance);
|
|
push(contextFiberStackCursor, fiber);
|
|
push(contextStackCursor, null);
|
|
pop(contextStackCursor);
|
|
push(contextStackCursor, { isInAParentText: !1 });
|
|
}
|
|
function popHostContainer() {
|
|
pop(contextStackCursor);
|
|
pop(contextFiberStackCursor);
|
|
pop(rootInstanceStackCursor);
|
|
}
|
|
function pushHostContext(fiber) {
|
|
var context = contextStackCursor.current;
|
|
var JSCompiler_inline_result = fiber.type;
|
|
JSCompiler_inline_result =
|
|
"AndroidTextInput" === JSCompiler_inline_result ||
|
|
"RCTMultilineTextInputView" === JSCompiler_inline_result ||
|
|
"RCTSinglelineTextInputView" === JSCompiler_inline_result ||
|
|
"RCTText" === JSCompiler_inline_result ||
|
|
"RCTVirtualText" === JSCompiler_inline_result;
|
|
JSCompiler_inline_result =
|
|
context.isInAParentText !== JSCompiler_inline_result
|
|
? { isInAParentText: JSCompiler_inline_result }
|
|
: context;
|
|
context !== JSCompiler_inline_result &&
|
|
(push(contextFiberStackCursor, fiber),
|
|
push(contextStackCursor, JSCompiler_inline_result));
|
|
}
|
|
function popHostContext(fiber) {
|
|
contextFiberStackCursor.current === fiber &&
|
|
(pop(contextStackCursor), pop(contextFiberStackCursor));
|
|
}
|
|
var hydrationErrors = null,
|
|
concurrentQueues = [],
|
|
concurrentQueuesIndex = 0,
|
|
concurrentlyUpdatedLanes = 0;
|
|
function finishQueueingConcurrentUpdates() {
|
|
for (
|
|
var endIndex = concurrentQueuesIndex,
|
|
i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0);
|
|
i < endIndex;
|
|
|
|
) {
|
|
var fiber = concurrentQueues[i];
|
|
concurrentQueues[i++] = null;
|
|
var queue = concurrentQueues[i];
|
|
concurrentQueues[i++] = null;
|
|
var update = concurrentQueues[i];
|
|
concurrentQueues[i++] = null;
|
|
var lane = concurrentQueues[i];
|
|
concurrentQueues[i++] = null;
|
|
if (null !== queue && null !== update) {
|
|
var pending = queue.pending;
|
|
null === pending
|
|
? (update.next = update)
|
|
: ((update.next = pending.next), (pending.next = update));
|
|
queue.pending = update;
|
|
}
|
|
0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane);
|
|
}
|
|
}
|
|
function enqueueUpdate$1(fiber, queue, update, lane) {
|
|
concurrentQueues[concurrentQueuesIndex++] = fiber;
|
|
concurrentQueues[concurrentQueuesIndex++] = queue;
|
|
concurrentQueues[concurrentQueuesIndex++] = update;
|
|
concurrentQueues[concurrentQueuesIndex++] = lane;
|
|
concurrentlyUpdatedLanes |= lane;
|
|
fiber.lanes |= lane;
|
|
fiber = fiber.alternate;
|
|
null !== fiber && (fiber.lanes |= lane);
|
|
}
|
|
function enqueueConcurrentRenderForLane(fiber, lane) {
|
|
enqueueUpdate$1(fiber, null, null, lane);
|
|
return getRootForUpdatedFiber(fiber);
|
|
}
|
|
function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) {
|
|
sourceFiber.lanes |= lane;
|
|
var alternate = sourceFiber.alternate;
|
|
null !== alternate && (alternate.lanes |= lane);
|
|
for (var isHidden = !1, parent = sourceFiber.return; null !== parent; )
|
|
(parent.childLanes |= lane),
|
|
(alternate = parent.alternate),
|
|
null !== alternate && (alternate.childLanes |= lane),
|
|
22 === parent.tag &&
|
|
((sourceFiber = parent.stateNode),
|
|
null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)),
|
|
(sourceFiber = parent),
|
|
(parent = parent.return);
|
|
isHidden &&
|
|
null !== update &&
|
|
3 === sourceFiber.tag &&
|
|
((parent = sourceFiber.stateNode),
|
|
(isHidden = 31 - clz32(lane)),
|
|
(parent = parent.hiddenUpdates),
|
|
(sourceFiber = parent[isHidden]),
|
|
null === sourceFiber
|
|
? (parent[isHidden] = [update])
|
|
: sourceFiber.push(update),
|
|
(update.lane = lane | 536870912));
|
|
}
|
|
function getRootForUpdatedFiber(sourceFiber) {
|
|
if (50 < nestedUpdateCount)
|
|
throw (
|
|
((nestedUpdateCount = 0),
|
|
(rootWithNestedUpdates = null),
|
|
Error(
|
|
"Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops."
|
|
))
|
|
);
|
|
for (var parent = sourceFiber.return; null !== parent; )
|
|
(sourceFiber = parent), (parent = sourceFiber.return);
|
|
return 3 === sourceFiber.tag ? sourceFiber.stateNode : null;
|
|
}
|
|
var firstScheduledRoot = null,
|
|
lastScheduledRoot = null,
|
|
didScheduleMicrotask = !1,
|
|
mightHavePendingSyncWork = !1,
|
|
isFlushingWork = !1,
|
|
currentEventTransitionLane = 0;
|
|
function ensureRootIsScheduled(root) {
|
|
root !== lastScheduledRoot &&
|
|
null === root.next &&
|
|
(null === lastScheduledRoot
|
|
? (firstScheduledRoot = lastScheduledRoot = root)
|
|
: (lastScheduledRoot = lastScheduledRoot.next = root));
|
|
mightHavePendingSyncWork = !0;
|
|
didScheduleMicrotask ||
|
|
((didScheduleMicrotask = !0),
|
|
scheduleCallback$2(ImmediatePriority, processRootScheduleInMicrotask));
|
|
scheduleTaskForRootDuringMicrotask(root, now());
|
|
}
|
|
function flushSyncWorkAcrossRoots_impl(onlyLegacy) {
|
|
if (!isFlushingWork && mightHavePendingSyncWork) {
|
|
var errors = null;
|
|
isFlushingWork = !0;
|
|
do {
|
|
var didPerformSomeWork = !1;
|
|
for (var root = firstScheduledRoot; null !== root; ) {
|
|
if (!onlyLegacy || 0 === root.tag) {
|
|
var workInProgressRootRenderLanes$11 = workInProgressRootRenderLanes,
|
|
nextLanes = getNextLanes(
|
|
root,
|
|
root === workInProgressRoot ? workInProgressRootRenderLanes$11 : 0
|
|
);
|
|
if (0 !== (nextLanes & 3))
|
|
try {
|
|
didPerformSomeWork = !0;
|
|
workInProgressRootRenderLanes$11 = root;
|
|
if (0 !== (executionContext & 6))
|
|
throw Error("Should not already be working.");
|
|
if (!flushPassiveEffects()) {
|
|
var exitStatus = renderRootSync(
|
|
workInProgressRootRenderLanes$11,
|
|
nextLanes
|
|
);
|
|
if (
|
|
0 !== workInProgressRootRenderLanes$11.tag &&
|
|
2 === exitStatus
|
|
) {
|
|
var originallyAttemptedLanes = nextLanes,
|
|
errorRetryLanes = getLanesToRetrySynchronouslyOnError(
|
|
workInProgressRootRenderLanes$11,
|
|
originallyAttemptedLanes
|
|
);
|
|
0 !== errorRetryLanes &&
|
|
((nextLanes = errorRetryLanes),
|
|
(exitStatus = recoverFromConcurrentError(
|
|
workInProgressRootRenderLanes$11,
|
|
originallyAttemptedLanes,
|
|
errorRetryLanes
|
|
)));
|
|
}
|
|
if (1 === exitStatus)
|
|
throw (
|
|
((originallyAttemptedLanes = workInProgressRootFatalError),
|
|
prepareFreshStack(workInProgressRootRenderLanes$11, 0),
|
|
markRootSuspended(
|
|
workInProgressRootRenderLanes$11,
|
|
nextLanes,
|
|
0
|
|
),
|
|
ensureRootIsScheduled(workInProgressRootRenderLanes$11),
|
|
originallyAttemptedLanes)
|
|
);
|
|
6 === exitStatus
|
|
? markRootSuspended(
|
|
workInProgressRootRenderLanes$11,
|
|
nextLanes,
|
|
workInProgressDeferredLane
|
|
)
|
|
: ((workInProgressRootRenderLanes$11.finishedWork =
|
|
workInProgressRootRenderLanes$11.current.alternate),
|
|
(workInProgressRootRenderLanes$11.finishedLanes =
|
|
nextLanes),
|
|
commitRoot(
|
|
workInProgressRootRenderLanes$11,
|
|
workInProgressRootRecoverableErrors,
|
|
workInProgressTransitions,
|
|
workInProgressRootDidIncludeRecursiveRenderUpdate,
|
|
workInProgressDeferredLane
|
|
));
|
|
}
|
|
ensureRootIsScheduled(workInProgressRootRenderLanes$11);
|
|
} catch (error) {
|
|
null === errors ? (errors = [error]) : errors.push(error);
|
|
}
|
|
}
|
|
root = root.next;
|
|
}
|
|
} while (didPerformSomeWork);
|
|
isFlushingWork = !1;
|
|
if (null !== errors) {
|
|
if (1 < errors.length) {
|
|
if ("function" === typeof AggregateError)
|
|
throw new AggregateError(errors);
|
|
for (onlyLegacy = 1; onlyLegacy < errors.length; onlyLegacy++)
|
|
(didPerformSomeWork = throwError.bind(null, errors[onlyLegacy])),
|
|
scheduleCallback$2(ImmediatePriority, didPerformSomeWork);
|
|
}
|
|
throw errors[0];
|
|
}
|
|
}
|
|
}
|
|
function throwError(error) {
|
|
throw error;
|
|
}
|
|
function processRootScheduleInMicrotask() {
|
|
mightHavePendingSyncWork = didScheduleMicrotask = !1;
|
|
for (
|
|
var currentTime = now(), prev = null, root = firstScheduledRoot;
|
|
null !== root;
|
|
|
|
) {
|
|
var next = root.next,
|
|
nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime);
|
|
0 === nextLanes
|
|
? ((root.next = null),
|
|
null === prev ? (firstScheduledRoot = next) : (prev.next = next),
|
|
null === next && (lastScheduledRoot = prev))
|
|
: ((prev = root),
|
|
0 !== (nextLanes & 3) && (mightHavePendingSyncWork = !0));
|
|
root = next;
|
|
}
|
|
currentEventTransitionLane = 0;
|
|
flushSyncWorkAcrossRoots_impl(!1);
|
|
}
|
|
function scheduleTaskForRootDuringMicrotask(root, currentTime) {
|
|
for (
|
|
var suspendedLanes = root.suspendedLanes,
|
|
pingedLanes = root.pingedLanes,
|
|
expirationTimes = root.expirationTimes,
|
|
lanes = root.pendingLanes & -62914561;
|
|
0 < lanes;
|
|
|
|
) {
|
|
var index$5 = 31 - clz32(lanes),
|
|
lane = 1 << index$5,
|
|
expirationTime = expirationTimes[index$5];
|
|
if (-1 === expirationTime) {
|
|
if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes))
|
|
expirationTimes[index$5] = computeExpirationTime(lane, currentTime);
|
|
} else expirationTime <= currentTime && (root.expiredLanes |= lane);
|
|
lanes &= ~lane;
|
|
}
|
|
currentTime = workInProgressRoot;
|
|
suspendedLanes = workInProgressRootRenderLanes;
|
|
suspendedLanes = getNextLanes(
|
|
root,
|
|
root === currentTime ? suspendedLanes : 0
|
|
);
|
|
pingedLanes = root.callbackNode;
|
|
if (
|
|
0 === suspendedLanes ||
|
|
(root === currentTime && 2 === workInProgressSuspendedReason) ||
|
|
null !== root.cancelPendingCommit
|
|
)
|
|
return (
|
|
null !== pingedLanes &&
|
|
null !== pingedLanes &&
|
|
cancelCallback$1(pingedLanes),
|
|
(root.callbackNode = null),
|
|
(root.callbackPriority = 0)
|
|
);
|
|
if (0 !== (suspendedLanes & 3))
|
|
return (
|
|
null !== pingedLanes &&
|
|
null !== pingedLanes &&
|
|
cancelCallback$1(pingedLanes),
|
|
(root.callbackPriority = 2),
|
|
(root.callbackNode = null),
|
|
2
|
|
);
|
|
currentTime = suspendedLanes & -suspendedLanes;
|
|
if (currentTime === root.callbackPriority) return currentTime;
|
|
null !== pingedLanes && cancelCallback$1(pingedLanes);
|
|
switch (lanesToEventPriority(suspendedLanes)) {
|
|
case 2:
|
|
suspendedLanes = ImmediatePriority;
|
|
break;
|
|
case 8:
|
|
suspendedLanes = UserBlockingPriority;
|
|
break;
|
|
case 32:
|
|
suspendedLanes = NormalPriority;
|
|
break;
|
|
case 268435456:
|
|
suspendedLanes = IdlePriority;
|
|
break;
|
|
default:
|
|
suspendedLanes = NormalPriority;
|
|
}
|
|
pingedLanes = performConcurrentWorkOnRoot.bind(null, root);
|
|
suspendedLanes = scheduleCallback$2(suspendedLanes, pingedLanes);
|
|
root.callbackPriority = currentTime;
|
|
root.callbackNode = suspendedLanes;
|
|
return currentTime;
|
|
}
|
|
var hasForceUpdate = !1;
|
|
function initializeUpdateQueue(fiber) {
|
|
fiber.updateQueue = {
|
|
baseState: fiber.memoizedState,
|
|
firstBaseUpdate: null,
|
|
lastBaseUpdate: null,
|
|
shared: { pending: null, lanes: 0, hiddenCallbacks: null },
|
|
callbacks: null
|
|
};
|
|
}
|
|
function cloneUpdateQueue(current, workInProgress) {
|
|
current = current.updateQueue;
|
|
workInProgress.updateQueue === current &&
|
|
(workInProgress.updateQueue = {
|
|
baseState: current.baseState,
|
|
firstBaseUpdate: current.firstBaseUpdate,
|
|
lastBaseUpdate: current.lastBaseUpdate,
|
|
shared: current.shared,
|
|
callbacks: null
|
|
});
|
|
}
|
|
function createUpdate(lane) {
|
|
return { lane: lane, tag: 0, payload: null, callback: null, next: null };
|
|
}
|
|
function enqueueUpdate(fiber, update, lane) {
|
|
var updateQueue = fiber.updateQueue;
|
|
if (null === updateQueue) return null;
|
|
updateQueue = updateQueue.shared;
|
|
if (0 !== (executionContext & 2)) {
|
|
var pending = updateQueue.pending;
|
|
null === pending
|
|
? (update.next = update)
|
|
: ((update.next = pending.next), (pending.next = update));
|
|
updateQueue.pending = update;
|
|
update = getRootForUpdatedFiber(fiber);
|
|
markUpdateLaneFromFiberToRoot(fiber, null, lane);
|
|
return update;
|
|
}
|
|
enqueueUpdate$1(fiber, updateQueue, update, lane);
|
|
return getRootForUpdatedFiber(fiber);
|
|
}
|
|
function entangleTransitions(root, fiber, lane) {
|
|
fiber = fiber.updateQueue;
|
|
if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 4194176))) {
|
|
var queueLanes = fiber.lanes;
|
|
queueLanes &= root.pendingLanes;
|
|
lane |= queueLanes;
|
|
fiber.lanes = lane;
|
|
markRootEntangled(root, lane);
|
|
}
|
|
}
|
|
function enqueueCapturedUpdate(workInProgress, capturedUpdate) {
|
|
var queue = workInProgress.updateQueue,
|
|
current = workInProgress.alternate;
|
|
if (
|
|
null !== current &&
|
|
((current = current.updateQueue), queue === current)
|
|
) {
|
|
var newFirst = null,
|
|
newLast = null;
|
|
queue = queue.firstBaseUpdate;
|
|
if (null !== queue) {
|
|
do {
|
|
var clone = {
|
|
lane: queue.lane,
|
|
tag: queue.tag,
|
|
payload: queue.payload,
|
|
callback: null,
|
|
next: null
|
|
};
|
|
null === newLast
|
|
? (newFirst = newLast = clone)
|
|
: (newLast = newLast.next = clone);
|
|
queue = queue.next;
|
|
} while (null !== queue);
|
|
null === newLast
|
|
? (newFirst = newLast = capturedUpdate)
|
|
: (newLast = newLast.next = capturedUpdate);
|
|
} else newFirst = newLast = capturedUpdate;
|
|
queue = {
|
|
baseState: current.baseState,
|
|
firstBaseUpdate: newFirst,
|
|
lastBaseUpdate: newLast,
|
|
shared: current.shared,
|
|
callbacks: current.callbacks
|
|
};
|
|
workInProgress.updateQueue = queue;
|
|
return;
|
|
}
|
|
workInProgress = queue.lastBaseUpdate;
|
|
null === workInProgress
|
|
? (queue.firstBaseUpdate = capturedUpdate)
|
|
: (workInProgress.next = capturedUpdate);
|
|
queue.lastBaseUpdate = capturedUpdate;
|
|
}
|
|
function processUpdateQueue(
|
|
workInProgress$jscomp$0,
|
|
props,
|
|
instance$jscomp$0,
|
|
renderLanes
|
|
) {
|
|
var queue = workInProgress$jscomp$0.updateQueue;
|
|
hasForceUpdate = !1;
|
|
var firstBaseUpdate = queue.firstBaseUpdate,
|
|
lastBaseUpdate = queue.lastBaseUpdate,
|
|
pendingQueue = queue.shared.pending;
|
|
if (null !== pendingQueue) {
|
|
queue.shared.pending = null;
|
|
var lastPendingUpdate = pendingQueue,
|
|
firstPendingUpdate = lastPendingUpdate.next;
|
|
lastPendingUpdate.next = null;
|
|
null === lastBaseUpdate
|
|
? (firstBaseUpdate = firstPendingUpdate)
|
|
: (lastBaseUpdate.next = firstPendingUpdate);
|
|
lastBaseUpdate = lastPendingUpdate;
|
|
var current = workInProgress$jscomp$0.alternate;
|
|
null !== current &&
|
|
((current = current.updateQueue),
|
|
(pendingQueue = current.lastBaseUpdate),
|
|
pendingQueue !== lastBaseUpdate &&
|
|
(null === pendingQueue
|
|
? (current.firstBaseUpdate = firstPendingUpdate)
|
|
: (pendingQueue.next = firstPendingUpdate),
|
|
(current.lastBaseUpdate = lastPendingUpdate)));
|
|
}
|
|
if (null !== firstBaseUpdate) {
|
|
var newState = queue.baseState;
|
|
lastBaseUpdate = 0;
|
|
current = firstPendingUpdate = lastPendingUpdate = null;
|
|
pendingQueue = firstBaseUpdate;
|
|
do {
|
|
var updateLane = pendingQueue.lane & -536870913,
|
|
isHiddenUpdate = updateLane !== pendingQueue.lane;
|
|
if (
|
|
isHiddenUpdate
|
|
? (workInProgressRootRenderLanes & updateLane) === updateLane
|
|
: (renderLanes & updateLane) === updateLane
|
|
) {
|
|
null !== current &&
|
|
(current = current.next =
|
|
{
|
|
lane: 0,
|
|
tag: pendingQueue.tag,
|
|
payload: pendingQueue.payload,
|
|
callback: null,
|
|
next: null
|
|
});
|
|
a: {
|
|
var workInProgress = workInProgress$jscomp$0,
|
|
update = pendingQueue;
|
|
updateLane = props;
|
|
var instance = instance$jscomp$0;
|
|
switch (update.tag) {
|
|
case 1:
|
|
workInProgress = update.payload;
|
|
if ("function" === typeof workInProgress) {
|
|
newState = workInProgress.call(instance, newState, updateLane);
|
|
break a;
|
|
}
|
|
newState = workInProgress;
|
|
break a;
|
|
case 3:
|
|
workInProgress.flags = (workInProgress.flags & -65537) | 128;
|
|
case 0:
|
|
workInProgress = update.payload;
|
|
updateLane =
|
|
"function" === typeof workInProgress
|
|
? workInProgress.call(instance, newState, updateLane)
|
|
: workInProgress;
|
|
if (null === updateLane || void 0 === updateLane) break a;
|
|
newState = assign({}, newState, updateLane);
|
|
break a;
|
|
case 2:
|
|
hasForceUpdate = !0;
|
|
}
|
|
}
|
|
updateLane = pendingQueue.callback;
|
|
null !== updateLane &&
|
|
((workInProgress$jscomp$0.flags |= 64),
|
|
isHiddenUpdate && (workInProgress$jscomp$0.flags |= 8192),
|
|
(isHiddenUpdate = queue.callbacks),
|
|
null === isHiddenUpdate
|
|
? (queue.callbacks = [updateLane])
|
|
: isHiddenUpdate.push(updateLane));
|
|
} else
|
|
(isHiddenUpdate = {
|
|
lane: updateLane,
|
|
tag: pendingQueue.tag,
|
|
payload: pendingQueue.payload,
|
|
callback: pendingQueue.callback,
|
|
next: null
|
|
}),
|
|
null === current
|
|
? ((firstPendingUpdate = current = isHiddenUpdate),
|
|
(lastPendingUpdate = newState))
|
|
: (current = current.next = isHiddenUpdate),
|
|
(lastBaseUpdate |= updateLane);
|
|
pendingQueue = pendingQueue.next;
|
|
if (null === pendingQueue)
|
|
if (((pendingQueue = queue.shared.pending), null === pendingQueue))
|
|
break;
|
|
else
|
|
(isHiddenUpdate = pendingQueue),
|
|
(pendingQueue = isHiddenUpdate.next),
|
|
(isHiddenUpdate.next = null),
|
|
(queue.lastBaseUpdate = isHiddenUpdate),
|
|
(queue.shared.pending = null);
|
|
} while (1);
|
|
null === current && (lastPendingUpdate = newState);
|
|
queue.baseState = lastPendingUpdate;
|
|
queue.firstBaseUpdate = firstPendingUpdate;
|
|
queue.lastBaseUpdate = current;
|
|
null === firstBaseUpdate && (queue.shared.lanes = 0);
|
|
workInProgressRootSkippedLanes |= lastBaseUpdate;
|
|
workInProgress$jscomp$0.lanes = lastBaseUpdate;
|
|
workInProgress$jscomp$0.memoizedState = newState;
|
|
}
|
|
}
|
|
function callCallback(callback, context) {
|
|
if ("function" !== typeof callback)
|
|
throw Error(
|
|
"Invalid argument passed as callback. Expected a function. Instead received: " +
|
|
callback
|
|
);
|
|
callback.call(context);
|
|
}
|
|
function commitCallbacks(updateQueue, context) {
|
|
var callbacks = updateQueue.callbacks;
|
|
if (null !== callbacks)
|
|
for (
|
|
updateQueue.callbacks = null, updateQueue = 0;
|
|
updateQueue < callbacks.length;
|
|
updateQueue++
|
|
)
|
|
callCallback(callbacks[updateQueue], context);
|
|
}
|
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
function shallowEqual(objA, objB) {
|
|
if (objectIs(objA, objB)) return !0;
|
|
if (
|
|
"object" !== typeof objA ||
|
|
null === objA ||
|
|
"object" !== typeof objB ||
|
|
null === objB
|
|
)
|
|
return !1;
|
|
var keysA = Object.keys(objA),
|
|
keysB = Object.keys(objB);
|
|
if (keysA.length !== keysB.length) return !1;
|
|
for (keysB = 0; keysB < keysA.length; keysB++) {
|
|
var currentKey = keysA[keysB];
|
|
if (
|
|
!hasOwnProperty.call(objB, currentKey) ||
|
|
!objectIs(objA[currentKey], objB[currentKey])
|
|
)
|
|
return !1;
|
|
}
|
|
return !0;
|
|
}
|
|
function describeComponentFrame(name, ownerName) {
|
|
var sourceInfo = "";
|
|
ownerName && (sourceInfo = " (created by " + ownerName + ")");
|
|
return "\n in " + (name || "Unknown") + sourceInfo;
|
|
}
|
|
function describeFunctionComponentFrame(fn) {
|
|
return fn
|
|
? describeComponentFrame(fn.displayName || fn.name || null, null)
|
|
: "";
|
|
}
|
|
function describeFiber(fiber) {
|
|
switch (fiber.tag) {
|
|
case 26:
|
|
case 27:
|
|
case 5:
|
|
return describeComponentFrame(fiber.type, null);
|
|
case 16:
|
|
return describeComponentFrame("Lazy", null);
|
|
case 13:
|
|
return describeComponentFrame("Suspense", null);
|
|
case 19:
|
|
return describeComponentFrame("SuspenseList", null);
|
|
case 0:
|
|
case 2:
|
|
case 15:
|
|
return describeFunctionComponentFrame(fiber.type);
|
|
case 11:
|
|
return describeFunctionComponentFrame(fiber.type.render);
|
|
case 1:
|
|
return (fiber = describeFunctionComponentFrame(fiber.type)), fiber;
|
|
default:
|
|
return "";
|
|
}
|
|
}
|
|
function getStackByFiberInDevAndProd(workInProgress) {
|
|
try {
|
|
var info = "";
|
|
do
|
|
(info += describeFiber(workInProgress)),
|
|
(workInProgress = workInProgress.return);
|
|
while (workInProgress);
|
|
return info;
|
|
} catch (x) {
|
|
return "\nError generating stack: " + x.message + "\n" + x.stack;
|
|
}
|
|
}
|
|
var SuspenseException = Error(
|
|
"Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`"
|
|
),
|
|
SuspenseyCommitException = Error(
|
|
"Suspense Exception: This is not a real error, and should not leak into userspace. If you're seeing this, it's likely a bug in React."
|
|
),
|
|
noopSuspenseyCommitThenable = { then: function () {} };
|
|
function isThenableResolved(thenable) {
|
|
thenable = thenable.status;
|
|
return "fulfilled" === thenable || "rejected" === thenable;
|
|
}
|
|
function noop() {}
|
|
function trackUsedThenable(thenableState, thenable, index) {
|
|
index = thenableState[index];
|
|
void 0 === index
|
|
? thenableState.push(thenable)
|
|
: index !== thenable && (thenable.then(noop, noop), (thenable = index));
|
|
switch (thenable.status) {
|
|
case "fulfilled":
|
|
return thenable.value;
|
|
case "rejected":
|
|
throw (
|
|
((thenableState = thenable.reason),
|
|
checkIfUseWrappedInAsyncCatch(thenableState),
|
|
thenableState)
|
|
);
|
|
default:
|
|
if ("string" === typeof thenable.status) thenable.then(noop, noop);
|
|
else {
|
|
thenableState = workInProgressRoot;
|
|
if (null !== thenableState && 100 < thenableState.shellSuspendCounter)
|
|
throw Error(
|
|
"async/await is not yet supported in Client Components, only Server Components. This error is often caused by accidentally adding `'use client'` to a module that was originally written for the server."
|
|
);
|
|
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 (
|
|
((thenableState = thenable.reason),
|
|
checkIfUseWrappedInAsyncCatch(thenableState),
|
|
thenableState)
|
|
);
|
|
}
|
|
suspendedThenable = thenable;
|
|
throw SuspenseException;
|
|
}
|
|
}
|
|
var suspendedThenable = null;
|
|
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 checkIfUseWrappedInAsyncCatch(rejectedReason) {
|
|
if (rejectedReason === SuspenseException)
|
|
throw Error(
|
|
"Hooks are not supported inside an async component. This error is often caused by accidentally adding `'use client'` to a module that was originally written for the server."
|
|
);
|
|
}
|
|
var thenableState$1 = null,
|
|
thenableIndexCounter$1 = 0;
|
|
function unwrapThenable(thenable) {
|
|
var index = thenableIndexCounter$1;
|
|
thenableIndexCounter$1 += 1;
|
|
null === thenableState$1 && (thenableState$1 = []);
|
|
return trackUsedThenable(thenableState$1, thenable, index);
|
|
}
|
|
function convertStringRefToCallbackRef(
|
|
returnFiber,
|
|
current,
|
|
element,
|
|
mixedRef
|
|
) {
|
|
function ref(value) {
|
|
var refs = inst.refs;
|
|
null === value ? delete refs[stringRef] : (refs[stringRef] = value);
|
|
}
|
|
var stringRef = "" + mixedRef;
|
|
returnFiber = element._owner;
|
|
if (!returnFiber)
|
|
throw Error(
|
|
"Element ref was specified as a string (" +
|
|
stringRef +
|
|
") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://react.dev/link/refs-must-have-owner for more information."
|
|
);
|
|
if (1 !== returnFiber.tag)
|
|
throw Error(
|
|
"Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref"
|
|
);
|
|
var inst = returnFiber.stateNode;
|
|
if (!inst)
|
|
throw Error(
|
|
"Missing owner for string ref " +
|
|
stringRef +
|
|
". This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
if (
|
|
null !== current &&
|
|
null !== current.ref &&
|
|
"function" === typeof current.ref &&
|
|
current.ref._stringRef === stringRef
|
|
)
|
|
return current.ref;
|
|
ref._stringRef = stringRef;
|
|
return ref;
|
|
}
|
|
function coerceRef(returnFiber, current, workInProgress, element) {
|
|
var mixedRef = element.ref;
|
|
returnFiber =
|
|
"string" === typeof mixedRef ||
|
|
"number" === typeof mixedRef ||
|
|
"boolean" === typeof mixedRef
|
|
? convertStringRefToCallbackRef(returnFiber, current, element, mixedRef)
|
|
: mixedRef;
|
|
workInProgress.ref = returnFiber;
|
|
}
|
|
function throwOnInvalidObjectType(returnFiber, newChild) {
|
|
returnFiber = Object.prototype.toString.call(newChild);
|
|
throw Error(
|
|
"Objects are not valid as a React child (found: " +
|
|
("[object Object]" === returnFiber
|
|
? "object with keys {" + Object.keys(newChild).join(", ") + "}"
|
|
: returnFiber) +
|
|
"). If you meant to render a collection of children, use an array instead."
|
|
);
|
|
}
|
|
function resolveLazy(lazyType) {
|
|
var init = lazyType._init;
|
|
return init(lazyType._payload);
|
|
}
|
|
function createChildReconciler(shouldTrackSideEffects) {
|
|
function deleteChild(returnFiber, childToDelete) {
|
|
if (shouldTrackSideEffects) {
|
|
var deletions = returnFiber.deletions;
|
|
null === deletions
|
|
? ((returnFiber.deletions = [childToDelete]), (returnFiber.flags |= 16))
|
|
: deletions.push(childToDelete);
|
|
}
|
|
}
|
|
function deleteRemainingChildren(returnFiber, currentFirstChild) {
|
|
if (!shouldTrackSideEffects) return null;
|
|
for (; null !== currentFirstChild; )
|
|
deleteChild(returnFiber, currentFirstChild),
|
|
(currentFirstChild = currentFirstChild.sibling);
|
|
return null;
|
|
}
|
|
function mapRemainingChildren(currentFirstChild) {
|
|
for (var existingChildren = new Map(); null !== currentFirstChild; )
|
|
null !== currentFirstChild.key
|
|
? existingChildren.set(currentFirstChild.key, currentFirstChild)
|
|
: existingChildren.set(currentFirstChild.index, currentFirstChild),
|
|
(currentFirstChild = currentFirstChild.sibling);
|
|
return existingChildren;
|
|
}
|
|
function useFiber(fiber, pendingProps) {
|
|
fiber = createWorkInProgress(fiber, pendingProps);
|
|
fiber.index = 0;
|
|
fiber.sibling = null;
|
|
return fiber;
|
|
}
|
|
function placeChild(newFiber, lastPlacedIndex, newIndex) {
|
|
newFiber.index = newIndex;
|
|
if (!shouldTrackSideEffects)
|
|
return (newFiber.flags |= 1048576), lastPlacedIndex;
|
|
newIndex = newFiber.alternate;
|
|
if (null !== newIndex)
|
|
return (
|
|
(newIndex = newIndex.index),
|
|
newIndex < lastPlacedIndex
|
|
? ((newFiber.flags |= 33554434), lastPlacedIndex)
|
|
: newIndex
|
|
);
|
|
newFiber.flags |= 33554434;
|
|
return lastPlacedIndex;
|
|
}
|
|
function placeSingleChild(newFiber) {
|
|
shouldTrackSideEffects &&
|
|
null === newFiber.alternate &&
|
|
(newFiber.flags |= 33554434);
|
|
return newFiber;
|
|
}
|
|
function updateTextNode(returnFiber, current, textContent, lanes) {
|
|
if (null === current || 6 !== current.tag)
|
|
return (
|
|
(current = createFiberFromText(textContent, returnFiber.mode, lanes)),
|
|
(current.return = returnFiber),
|
|
current
|
|
);
|
|
current = useFiber(current, textContent);
|
|
current.return = returnFiber;
|
|
return current;
|
|
}
|
|
function updateElement(returnFiber, current, element, lanes) {
|
|
var elementType = element.type;
|
|
if (elementType === REACT_FRAGMENT_TYPE)
|
|
return updateFragment(
|
|
returnFiber,
|
|
current,
|
|
element.props.children,
|
|
lanes,
|
|
element.key
|
|
);
|
|
if (
|
|
null !== current &&
|
|
(current.elementType === elementType ||
|
|
("object" === typeof elementType &&
|
|
null !== elementType &&
|
|
elementType.$$typeof === REACT_LAZY_TYPE &&
|
|
resolveLazy(elementType) === current.type))
|
|
)
|
|
return (
|
|
(lanes = useFiber(current, element.props)),
|
|
coerceRef(returnFiber, current, lanes, element),
|
|
(lanes.return = returnFiber),
|
|
lanes
|
|
);
|
|
lanes = createFiberFromTypeAndProps(
|
|
element.type,
|
|
element.key,
|
|
element.props,
|
|
null,
|
|
returnFiber.mode,
|
|
lanes
|
|
);
|
|
coerceRef(returnFiber, current, lanes, element);
|
|
lanes.return = returnFiber;
|
|
return lanes;
|
|
}
|
|
function updatePortal(returnFiber, current, portal, lanes) {
|
|
if (
|
|
null === current ||
|
|
4 !== current.tag ||
|
|
current.stateNode.containerInfo !== portal.containerInfo ||
|
|
current.stateNode.implementation !== portal.implementation
|
|
)
|
|
return (
|
|
(current = createFiberFromPortal(portal, returnFiber.mode, lanes)),
|
|
(current.return = returnFiber),
|
|
current
|
|
);
|
|
current = useFiber(current, portal.children || []);
|
|
current.return = returnFiber;
|
|
return current;
|
|
}
|
|
function updateFragment(returnFiber, current, fragment, lanes, key) {
|
|
if (null === current || 7 !== current.tag)
|
|
return (
|
|
(current = createFiberFromFragment(
|
|
fragment,
|
|
returnFiber.mode,
|
|
lanes,
|
|
key
|
|
)),
|
|
(current.return = returnFiber),
|
|
current
|
|
);
|
|
current = useFiber(current, fragment);
|
|
current.return = returnFiber;
|
|
return current;
|
|
}
|
|
function createChild(returnFiber, newChild, lanes) {
|
|
if (
|
|
("string" === typeof newChild && "" !== newChild) ||
|
|
"number" === typeof newChild
|
|
)
|
|
return (
|
|
(newChild = createFiberFromText(
|
|
"" + newChild,
|
|
returnFiber.mode,
|
|
lanes
|
|
)),
|
|
(newChild.return = returnFiber),
|
|
newChild
|
|
);
|
|
if ("object" === typeof newChild && null !== newChild) {
|
|
switch (newChild.$$typeof) {
|
|
case REACT_ELEMENT_TYPE:
|
|
return (
|
|
(lanes = createFiberFromTypeAndProps(
|
|
newChild.type,
|
|
newChild.key,
|
|
newChild.props,
|
|
null,
|
|
returnFiber.mode,
|
|
lanes
|
|
)),
|
|
coerceRef(returnFiber, null, lanes, newChild),
|
|
(lanes.return = returnFiber),
|
|
lanes
|
|
);
|
|
case REACT_PORTAL_TYPE:
|
|
return (
|
|
(newChild = createFiberFromPortal(
|
|
newChild,
|
|
returnFiber.mode,
|
|
lanes
|
|
)),
|
|
(newChild.return = returnFiber),
|
|
newChild
|
|
);
|
|
case REACT_LAZY_TYPE:
|
|
var init = newChild._init;
|
|
return createChild(returnFiber, init(newChild._payload), lanes);
|
|
}
|
|
if (isArrayImpl(newChild) || getIteratorFn(newChild))
|
|
return (
|
|
(newChild = createFiberFromFragment(
|
|
newChild,
|
|
returnFiber.mode,
|
|
lanes,
|
|
null
|
|
)),
|
|
(newChild.return = returnFiber),
|
|
newChild
|
|
);
|
|
if ("function" === typeof newChild.then)
|
|
return createChild(returnFiber, unwrapThenable(newChild), lanes);
|
|
if (newChild.$$typeof === REACT_CONTEXT_TYPE)
|
|
return createChild(
|
|
returnFiber,
|
|
readContextDuringReconciliation(returnFiber, newChild, lanes),
|
|
lanes
|
|
);
|
|
throwOnInvalidObjectType(returnFiber, newChild);
|
|
}
|
|
return null;
|
|
}
|
|
function updateSlot(returnFiber, oldFiber, newChild, lanes) {
|
|
var key = null !== oldFiber ? oldFiber.key : null;
|
|
if (
|
|
("string" === typeof newChild && "" !== newChild) ||
|
|
"number" === typeof newChild
|
|
)
|
|
return null !== key
|
|
? null
|
|
: updateTextNode(returnFiber, oldFiber, "" + newChild, lanes);
|
|
if ("object" === typeof newChild && null !== newChild) {
|
|
switch (newChild.$$typeof) {
|
|
case REACT_ELEMENT_TYPE:
|
|
return newChild.key === key
|
|
? updateElement(returnFiber, oldFiber, newChild, lanes)
|
|
: null;
|
|
case REACT_PORTAL_TYPE:
|
|
return newChild.key === key
|
|
? updatePortal(returnFiber, oldFiber, newChild, lanes)
|
|
: null;
|
|
case REACT_LAZY_TYPE:
|
|
return (
|
|
(key = newChild._init),
|
|
updateSlot(returnFiber, oldFiber, key(newChild._payload), lanes)
|
|
);
|
|
}
|
|
if (isArrayImpl(newChild) || getIteratorFn(newChild))
|
|
return null !== key
|
|
? null
|
|
: updateFragment(returnFiber, oldFiber, newChild, lanes, null);
|
|
if ("function" === typeof newChild.then)
|
|
return updateSlot(
|
|
returnFiber,
|
|
oldFiber,
|
|
unwrapThenable(newChild),
|
|
lanes
|
|
);
|
|
if (newChild.$$typeof === REACT_CONTEXT_TYPE)
|
|
return updateSlot(
|
|
returnFiber,
|
|
oldFiber,
|
|
readContextDuringReconciliation(returnFiber, newChild, lanes),
|
|
lanes
|
|
);
|
|
throwOnInvalidObjectType(returnFiber, newChild);
|
|
}
|
|
return null;
|
|
}
|
|
function updateFromMap(
|
|
existingChildren,
|
|
returnFiber,
|
|
newIdx,
|
|
newChild,
|
|
lanes
|
|
) {
|
|
if (
|
|
("string" === typeof newChild && "" !== newChild) ||
|
|
"number" === typeof newChild
|
|
)
|
|
return (
|
|
(existingChildren = existingChildren.get(newIdx) || null),
|
|
updateTextNode(returnFiber, existingChildren, "" + newChild, lanes)
|
|
);
|
|
if ("object" === typeof newChild && null !== newChild) {
|
|
switch (newChild.$$typeof) {
|
|
case REACT_ELEMENT_TYPE:
|
|
return (
|
|
(existingChildren =
|
|
existingChildren.get(
|
|
null === newChild.key ? newIdx : newChild.key
|
|
) || null),
|
|
updateElement(returnFiber, existingChildren, newChild, lanes)
|
|
);
|
|
case REACT_PORTAL_TYPE:
|
|
return (
|
|
(existingChildren =
|
|
existingChildren.get(
|
|
null === newChild.key ? newIdx : newChild.key
|
|
) || null),
|
|
updatePortal(returnFiber, existingChildren, newChild, lanes)
|
|
);
|
|
case REACT_LAZY_TYPE:
|
|
var init = newChild._init;
|
|
return updateFromMap(
|
|
existingChildren,
|
|
returnFiber,
|
|
newIdx,
|
|
init(newChild._payload),
|
|
lanes
|
|
);
|
|
}
|
|
if (isArrayImpl(newChild) || getIteratorFn(newChild))
|
|
return (
|
|
(existingChildren = existingChildren.get(newIdx) || null),
|
|
updateFragment(returnFiber, existingChildren, newChild, lanes, null)
|
|
);
|
|
if ("function" === typeof newChild.then)
|
|
return updateFromMap(
|
|
existingChildren,
|
|
returnFiber,
|
|
newIdx,
|
|
unwrapThenable(newChild),
|
|
lanes
|
|
);
|
|
if (newChild.$$typeof === REACT_CONTEXT_TYPE)
|
|
return updateFromMap(
|
|
existingChildren,
|
|
returnFiber,
|
|
newIdx,
|
|
readContextDuringReconciliation(returnFiber, newChild, lanes),
|
|
lanes
|
|
);
|
|
throwOnInvalidObjectType(returnFiber, newChild);
|
|
}
|
|
return null;
|
|
}
|
|
function reconcileChildrenArray(
|
|
returnFiber,
|
|
currentFirstChild,
|
|
newChildren,
|
|
lanes
|
|
) {
|
|
for (
|
|
var resultingFirstChild = null,
|
|
previousNewFiber = null,
|
|
oldFiber = currentFirstChild,
|
|
newIdx = (currentFirstChild = 0),
|
|
nextOldFiber = null;
|
|
null !== oldFiber && newIdx < newChildren.length;
|
|
newIdx++
|
|
) {
|
|
oldFiber.index > newIdx
|
|
? ((nextOldFiber = oldFiber), (oldFiber = null))
|
|
: (nextOldFiber = oldFiber.sibling);
|
|
var newFiber = updateSlot(
|
|
returnFiber,
|
|
oldFiber,
|
|
newChildren[newIdx],
|
|
lanes
|
|
);
|
|
if (null === newFiber) {
|
|
null === oldFiber && (oldFiber = nextOldFiber);
|
|
break;
|
|
}
|
|
shouldTrackSideEffects &&
|
|
oldFiber &&
|
|
null === newFiber.alternate &&
|
|
deleteChild(returnFiber, oldFiber);
|
|
currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx);
|
|
null === previousNewFiber
|
|
? (resultingFirstChild = newFiber)
|
|
: (previousNewFiber.sibling = newFiber);
|
|
previousNewFiber = newFiber;
|
|
oldFiber = nextOldFiber;
|
|
}
|
|
if (newIdx === newChildren.length)
|
|
return (
|
|
deleteRemainingChildren(returnFiber, oldFiber), resultingFirstChild
|
|
);
|
|
if (null === oldFiber) {
|
|
for (; newIdx < newChildren.length; newIdx++)
|
|
(oldFiber = createChild(returnFiber, newChildren[newIdx], lanes)),
|
|
null !== oldFiber &&
|
|
((currentFirstChild = placeChild(
|
|
oldFiber,
|
|
currentFirstChild,
|
|
newIdx
|
|
)),
|
|
null === previousNewFiber
|
|
? (resultingFirstChild = oldFiber)
|
|
: (previousNewFiber.sibling = oldFiber),
|
|
(previousNewFiber = oldFiber));
|
|
return resultingFirstChild;
|
|
}
|
|
for (
|
|
oldFiber = mapRemainingChildren(oldFiber);
|
|
newIdx < newChildren.length;
|
|
newIdx++
|
|
)
|
|
(nextOldFiber = updateFromMap(
|
|
oldFiber,
|
|
returnFiber,
|
|
newIdx,
|
|
newChildren[newIdx],
|
|
lanes
|
|
)),
|
|
null !== nextOldFiber &&
|
|
(shouldTrackSideEffects &&
|
|
null !== nextOldFiber.alternate &&
|
|
oldFiber.delete(
|
|
null === nextOldFiber.key ? newIdx : nextOldFiber.key
|
|
),
|
|
(currentFirstChild = placeChild(
|
|
nextOldFiber,
|
|
currentFirstChild,
|
|
newIdx
|
|
)),
|
|
null === previousNewFiber
|
|
? (resultingFirstChild = nextOldFiber)
|
|
: (previousNewFiber.sibling = nextOldFiber),
|
|
(previousNewFiber = nextOldFiber));
|
|
shouldTrackSideEffects &&
|
|
oldFiber.forEach(function (child) {
|
|
return deleteChild(returnFiber, child);
|
|
});
|
|
return resultingFirstChild;
|
|
}
|
|
function reconcileChildrenIterator(
|
|
returnFiber,
|
|
currentFirstChild,
|
|
newChildrenIterable,
|
|
lanes
|
|
) {
|
|
var iteratorFn = getIteratorFn(newChildrenIterable);
|
|
if ("function" !== typeof iteratorFn)
|
|
throw Error(
|
|
"An object is not an iterable. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
newChildrenIterable = iteratorFn.call(newChildrenIterable);
|
|
if (null == newChildrenIterable)
|
|
throw Error("An iterable object provided no iterator.");
|
|
for (
|
|
var previousNewFiber = (iteratorFn = null),
|
|
oldFiber = currentFirstChild,
|
|
newIdx = (currentFirstChild = 0),
|
|
nextOldFiber = null,
|
|
step = newChildrenIterable.next();
|
|
null !== oldFiber && !step.done;
|
|
newIdx++, step = newChildrenIterable.next()
|
|
) {
|
|
oldFiber.index > newIdx
|
|
? ((nextOldFiber = oldFiber), (oldFiber = null))
|
|
: (nextOldFiber = oldFiber.sibling);
|
|
var newFiber = updateSlot(returnFiber, oldFiber, step.value, lanes);
|
|
if (null === newFiber) {
|
|
null === oldFiber && (oldFiber = nextOldFiber);
|
|
break;
|
|
}
|
|
shouldTrackSideEffects &&
|
|
oldFiber &&
|
|
null === newFiber.alternate &&
|
|
deleteChild(returnFiber, oldFiber);
|
|
currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx);
|
|
null === previousNewFiber
|
|
? (iteratorFn = newFiber)
|
|
: (previousNewFiber.sibling = newFiber);
|
|
previousNewFiber = newFiber;
|
|
oldFiber = nextOldFiber;
|
|
}
|
|
if (step.done)
|
|
return deleteRemainingChildren(returnFiber, oldFiber), iteratorFn;
|
|
if (null === oldFiber) {
|
|
for (; !step.done; newIdx++, step = newChildrenIterable.next())
|
|
(step = createChild(returnFiber, step.value, lanes)),
|
|
null !== step &&
|
|
((currentFirstChild = placeChild(step, currentFirstChild, newIdx)),
|
|
null === previousNewFiber
|
|
? (iteratorFn = step)
|
|
: (previousNewFiber.sibling = step),
|
|
(previousNewFiber = step));
|
|
return iteratorFn;
|
|
}
|
|
for (
|
|
oldFiber = mapRemainingChildren(oldFiber);
|
|
!step.done;
|
|
newIdx++, step = newChildrenIterable.next()
|
|
)
|
|
(step = updateFromMap(oldFiber, returnFiber, newIdx, step.value, lanes)),
|
|
null !== step &&
|
|
(shouldTrackSideEffects &&
|
|
null !== step.alternate &&
|
|
oldFiber.delete(null === step.key ? newIdx : step.key),
|
|
(currentFirstChild = placeChild(step, currentFirstChild, newIdx)),
|
|
null === previousNewFiber
|
|
? (iteratorFn = step)
|
|
: (previousNewFiber.sibling = step),
|
|
(previousNewFiber = step));
|
|
shouldTrackSideEffects &&
|
|
oldFiber.forEach(function (child) {
|
|
return deleteChild(returnFiber, child);
|
|
});
|
|
return iteratorFn;
|
|
}
|
|
function reconcileChildFibersImpl(
|
|
returnFiber,
|
|
currentFirstChild,
|
|
newChild,
|
|
lanes
|
|
) {
|
|
"object" === typeof newChild &&
|
|
null !== newChild &&
|
|
newChild.type === REACT_FRAGMENT_TYPE &&
|
|
null === newChild.key &&
|
|
(newChild = newChild.props.children);
|
|
if ("object" === typeof newChild && null !== newChild) {
|
|
switch (newChild.$$typeof) {
|
|
case REACT_ELEMENT_TYPE:
|
|
a: {
|
|
for (
|
|
var key = newChild.key, child = currentFirstChild;
|
|
null !== child;
|
|
|
|
) {
|
|
if (child.key === key) {
|
|
key = newChild.type;
|
|
if (key === REACT_FRAGMENT_TYPE) {
|
|
if (7 === child.tag) {
|
|
deleteRemainingChildren(returnFiber, child.sibling);
|
|
currentFirstChild = useFiber(
|
|
child,
|
|
newChild.props.children
|
|
);
|
|
currentFirstChild.return = returnFiber;
|
|
returnFiber = currentFirstChild;
|
|
break a;
|
|
}
|
|
} else if (
|
|
child.elementType === key ||
|
|
("object" === typeof key &&
|
|
null !== key &&
|
|
key.$$typeof === REACT_LAZY_TYPE &&
|
|
resolveLazy(key) === child.type)
|
|
) {
|
|
deleteRemainingChildren(returnFiber, child.sibling);
|
|
currentFirstChild = useFiber(child, newChild.props);
|
|
coerceRef(returnFiber, child, currentFirstChild, newChild);
|
|
currentFirstChild.return = returnFiber;
|
|
returnFiber = currentFirstChild;
|
|
break a;
|
|
}
|
|
deleteRemainingChildren(returnFiber, child);
|
|
break;
|
|
} else deleteChild(returnFiber, child);
|
|
child = child.sibling;
|
|
}
|
|
newChild.type === REACT_FRAGMENT_TYPE
|
|
? ((currentFirstChild = createFiberFromFragment(
|
|
newChild.props.children,
|
|
returnFiber.mode,
|
|
lanes,
|
|
newChild.key
|
|
)),
|
|
(currentFirstChild.return = returnFiber),
|
|
(returnFiber = currentFirstChild))
|
|
: ((lanes = createFiberFromTypeAndProps(
|
|
newChild.type,
|
|
newChild.key,
|
|
newChild.props,
|
|
null,
|
|
returnFiber.mode,
|
|
lanes
|
|
)),
|
|
coerceRef(returnFiber, currentFirstChild, lanes, newChild),
|
|
(lanes.return = returnFiber),
|
|
(returnFiber = lanes));
|
|
}
|
|
return placeSingleChild(returnFiber);
|
|
case REACT_PORTAL_TYPE:
|
|
a: {
|
|
for (child = newChild.key; null !== currentFirstChild; ) {
|
|
if (currentFirstChild.key === child)
|
|
if (
|
|
4 === currentFirstChild.tag &&
|
|
currentFirstChild.stateNode.containerInfo ===
|
|
newChild.containerInfo &&
|
|
currentFirstChild.stateNode.implementation ===
|
|
newChild.implementation
|
|
) {
|
|
deleteRemainingChildren(
|
|
returnFiber,
|
|
currentFirstChild.sibling
|
|
);
|
|
currentFirstChild = useFiber(
|
|
currentFirstChild,
|
|
newChild.children || []
|
|
);
|
|
currentFirstChild.return = returnFiber;
|
|
returnFiber = currentFirstChild;
|
|
break a;
|
|
} else {
|
|
deleteRemainingChildren(returnFiber, currentFirstChild);
|
|
break;
|
|
}
|
|
else deleteChild(returnFiber, currentFirstChild);
|
|
currentFirstChild = currentFirstChild.sibling;
|
|
}
|
|
currentFirstChild = createFiberFromPortal(
|
|
newChild,
|
|
returnFiber.mode,
|
|
lanes
|
|
);
|
|
currentFirstChild.return = returnFiber;
|
|
returnFiber = currentFirstChild;
|
|
}
|
|
return placeSingleChild(returnFiber);
|
|
case REACT_LAZY_TYPE:
|
|
return (
|
|
(child = newChild._init),
|
|
reconcileChildFibersImpl(
|
|
returnFiber,
|
|
currentFirstChild,
|
|
child(newChild._payload),
|
|
lanes
|
|
)
|
|
);
|
|
}
|
|
if (isArrayImpl(newChild))
|
|
return reconcileChildrenArray(
|
|
returnFiber,
|
|
currentFirstChild,
|
|
newChild,
|
|
lanes
|
|
);
|
|
if (getIteratorFn(newChild))
|
|
return reconcileChildrenIterator(
|
|
returnFiber,
|
|
currentFirstChild,
|
|
newChild,
|
|
lanes
|
|
);
|
|
if ("function" === typeof newChild.then)
|
|
return reconcileChildFibersImpl(
|
|
returnFiber,
|
|
currentFirstChild,
|
|
unwrapThenable(newChild),
|
|
lanes
|
|
);
|
|
if (newChild.$$typeof === REACT_CONTEXT_TYPE)
|
|
return reconcileChildFibersImpl(
|
|
returnFiber,
|
|
currentFirstChild,
|
|
readContextDuringReconciliation(returnFiber, newChild, lanes),
|
|
lanes
|
|
);
|
|
throwOnInvalidObjectType(returnFiber, newChild);
|
|
}
|
|
return ("string" === typeof newChild && "" !== newChild) ||
|
|
"number" === typeof newChild
|
|
? ((newChild = "" + newChild),
|
|
null !== currentFirstChild && 6 === currentFirstChild.tag
|
|
? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling),
|
|
(currentFirstChild = useFiber(currentFirstChild, newChild)),
|
|
(currentFirstChild.return = returnFiber),
|
|
(returnFiber = currentFirstChild))
|
|
: (deleteRemainingChildren(returnFiber, currentFirstChild),
|
|
(currentFirstChild = createFiberFromText(
|
|
newChild,
|
|
returnFiber.mode,
|
|
lanes
|
|
)),
|
|
(currentFirstChild.return = returnFiber),
|
|
(returnFiber = currentFirstChild)),
|
|
placeSingleChild(returnFiber))
|
|
: deleteRemainingChildren(returnFiber, currentFirstChild);
|
|
}
|
|
return function (returnFiber, currentFirstChild, newChild, lanes) {
|
|
thenableIndexCounter$1 = 0;
|
|
returnFiber = reconcileChildFibersImpl(
|
|
returnFiber,
|
|
currentFirstChild,
|
|
newChild,
|
|
lanes
|
|
);
|
|
thenableState$1 = null;
|
|
return returnFiber;
|
|
};
|
|
}
|
|
var reconcileChildFibers = createChildReconciler(!0),
|
|
mountChildFibers = createChildReconciler(!1),
|
|
currentTreeHiddenStackCursor = createCursor(null),
|
|
prevEntangledRenderLanesCursor = createCursor(0);
|
|
function pushHiddenContext(fiber, context) {
|
|
fiber = entangledRenderLanes;
|
|
push(prevEntangledRenderLanesCursor, fiber);
|
|
push(currentTreeHiddenStackCursor, context);
|
|
entangledRenderLanes = fiber | context.baseLanes;
|
|
}
|
|
function reuseHiddenContextOnStack() {
|
|
push(prevEntangledRenderLanesCursor, entangledRenderLanes);
|
|
push(currentTreeHiddenStackCursor, currentTreeHiddenStackCursor.current);
|
|
}
|
|
function popHiddenContext() {
|
|
entangledRenderLanes = prevEntangledRenderLanesCursor.current;
|
|
pop(currentTreeHiddenStackCursor);
|
|
pop(prevEntangledRenderLanesCursor);
|
|
}
|
|
var suspenseHandlerStackCursor = createCursor(null),
|
|
shellBoundary = null;
|
|
function pushPrimaryTreeSuspenseHandler(handler) {
|
|
var current = handler.alternate;
|
|
push(suspenseStackCursor, suspenseStackCursor.current & 1);
|
|
push(suspenseHandlerStackCursor, handler);
|
|
null === shellBoundary &&
|
|
(null === current || null !== currentTreeHiddenStackCursor.current
|
|
? (shellBoundary = handler)
|
|
: null !== current.memoizedState && (shellBoundary = handler));
|
|
}
|
|
function pushOffscreenSuspenseHandler(fiber) {
|
|
if (22 === fiber.tag) {
|
|
if (
|
|
(push(suspenseStackCursor, suspenseStackCursor.current),
|
|
push(suspenseHandlerStackCursor, fiber),
|
|
null === shellBoundary)
|
|
) {
|
|
var current = fiber.alternate;
|
|
null !== current &&
|
|
null !== current.memoizedState &&
|
|
(shellBoundary = fiber);
|
|
}
|
|
} else reuseSuspenseHandlerOnStack(fiber);
|
|
}
|
|
function reuseSuspenseHandlerOnStack() {
|
|
push(suspenseStackCursor, suspenseStackCursor.current);
|
|
push(suspenseHandlerStackCursor, suspenseHandlerStackCursor.current);
|
|
}
|
|
function popSuspenseHandler(fiber) {
|
|
pop(suspenseHandlerStackCursor);
|
|
shellBoundary === fiber && (shellBoundary = null);
|
|
pop(suspenseStackCursor);
|
|
}
|
|
var suspenseStackCursor = createCursor(0);
|
|
function findFirstSuspended(row) {
|
|
for (var node = row; null !== node; ) {
|
|
if (13 === node.tag) {
|
|
var state = node.memoizedState;
|
|
if (null !== state && (null === state.dehydrated || shim$1() || shim$1()))
|
|
return node;
|
|
} else if (19 === node.tag && void 0 !== node.memoizedProps.revealOrder) {
|
|
if (0 !== (node.flags & 128)) return node;
|
|
} else if (null !== node.child) {
|
|
node.child.return = node;
|
|
node = node.child;
|
|
continue;
|
|
}
|
|
if (node === row) break;
|
|
for (; null === node.sibling; ) {
|
|
if (null === node.return || node.return === row) return null;
|
|
node = node.return;
|
|
}
|
|
node.sibling.return = node.return;
|
|
node = node.sibling;
|
|
}
|
|
return null;
|
|
}
|
|
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher,
|
|
ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig,
|
|
renderLanes = 0,
|
|
currentlyRenderingFiber$1 = null,
|
|
currentHook = null,
|
|
workInProgressHook = null,
|
|
didScheduleRenderPhaseUpdate = !1,
|
|
didScheduleRenderPhaseUpdateDuringThisPass = !1,
|
|
shouldDoubleInvokeUserFnsInHooksDEV = !1,
|
|
thenableIndexCounter = 0,
|
|
thenableState = null,
|
|
globalClientIdCounter = 0;
|
|
function throwInvalidHookError() {
|
|
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://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."
|
|
);
|
|
}
|
|
function areHookInputsEqual(nextDeps, prevDeps) {
|
|
if (null === prevDeps) return !1;
|
|
for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++)
|
|
if (!objectIs(nextDeps[i], prevDeps[i])) return !1;
|
|
return !0;
|
|
}
|
|
function renderWithHooks(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
props,
|
|
secondArg,
|
|
nextRenderLanes
|
|
) {
|
|
renderLanes = nextRenderLanes;
|
|
currentlyRenderingFiber$1 = workInProgress;
|
|
workInProgress.memoizedState = null;
|
|
workInProgress.updateQueue = null;
|
|
workInProgress.lanes = 0;
|
|
ReactCurrentDispatcher$1.current =
|
|
null === current || null === current.memoizedState
|
|
? HooksDispatcherOnMount
|
|
: HooksDispatcherOnUpdate;
|
|
shouldDoubleInvokeUserFnsInHooksDEV = !1;
|
|
current = Component(props, secondArg);
|
|
shouldDoubleInvokeUserFnsInHooksDEV = !1;
|
|
didScheduleRenderPhaseUpdateDuringThisPass &&
|
|
(current = renderWithHooksAgain(
|
|
workInProgress,
|
|
Component,
|
|
props,
|
|
secondArg
|
|
));
|
|
finishRenderingHooks();
|
|
return current;
|
|
}
|
|
function finishRenderingHooks() {
|
|
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
|
|
var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next;
|
|
renderLanes = 0;
|
|
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
|
|
didScheduleRenderPhaseUpdate = !1;
|
|
thenableIndexCounter = 0;
|
|
thenableState = null;
|
|
if (didRenderTooFewHooks)
|
|
throw Error(
|
|
"Rendered fewer hooks than expected. This may be caused by an accidental early return statement."
|
|
);
|
|
}
|
|
function renderWithHooksAgain(workInProgress, Component, props, secondArg) {
|
|
currentlyRenderingFiber$1 = workInProgress;
|
|
var numberOfReRenders = 0;
|
|
do {
|
|
didScheduleRenderPhaseUpdateDuringThisPass && (thenableState = null);
|
|
thenableIndexCounter = 0;
|
|
didScheduleRenderPhaseUpdateDuringThisPass = !1;
|
|
if (25 <= numberOfReRenders)
|
|
throw Error(
|
|
"Too many re-renders. React limits the number of renders to prevent an infinite loop."
|
|
);
|
|
numberOfReRenders += 1;
|
|
workInProgressHook = currentHook = null;
|
|
workInProgress.updateQueue = null;
|
|
ReactCurrentDispatcher$1.current = HooksDispatcherOnRerender;
|
|
var children = Component(props, secondArg);
|
|
} while (didScheduleRenderPhaseUpdateDuringThisPass);
|
|
return children;
|
|
}
|
|
function bailoutHooks(current, workInProgress, lanes) {
|
|
workInProgress.updateQueue = current.updateQueue;
|
|
workInProgress.flags &= -2053;
|
|
current.lanes &= ~lanes;
|
|
}
|
|
function resetHooksOnUnwind(workInProgress) {
|
|
if (didScheduleRenderPhaseUpdate) {
|
|
for (
|
|
workInProgress = workInProgress.memoizedState;
|
|
null !== workInProgress;
|
|
|
|
) {
|
|
var queue = workInProgress.queue;
|
|
null !== queue && (queue.pending = null);
|
|
workInProgress = workInProgress.next;
|
|
}
|
|
didScheduleRenderPhaseUpdate = !1;
|
|
}
|
|
renderLanes = 0;
|
|
workInProgressHook = currentHook = currentlyRenderingFiber$1 = null;
|
|
didScheduleRenderPhaseUpdateDuringThisPass = !1;
|
|
thenableIndexCounter = 0;
|
|
thenableState = null;
|
|
}
|
|
function mountWorkInProgressHook() {
|
|
var hook = {
|
|
memoizedState: null,
|
|
baseState: null,
|
|
baseQueue: null,
|
|
queue: null,
|
|
next: null
|
|
};
|
|
null === workInProgressHook
|
|
? (currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook)
|
|
: (workInProgressHook = workInProgressHook.next = hook);
|
|
return workInProgressHook;
|
|
}
|
|
function updateWorkInProgressHook() {
|
|
if (null === currentHook) {
|
|
var nextCurrentHook = currentlyRenderingFiber$1.alternate;
|
|
nextCurrentHook =
|
|
null !== nextCurrentHook ? nextCurrentHook.memoizedState : null;
|
|
} else nextCurrentHook = currentHook.next;
|
|
var nextWorkInProgressHook =
|
|
null === workInProgressHook
|
|
? currentlyRenderingFiber$1.memoizedState
|
|
: workInProgressHook.next;
|
|
if (null !== nextWorkInProgressHook)
|
|
(workInProgressHook = nextWorkInProgressHook),
|
|
(currentHook = nextCurrentHook);
|
|
else {
|
|
if (null === nextCurrentHook) {
|
|
if (null === currentlyRenderingFiber$1.alternate)
|
|
throw Error(
|
|
"Update hook called on initial render. This is likely a bug in React. Please file an issue."
|
|
);
|
|
throw Error("Rendered more hooks than during the previous render.");
|
|
}
|
|
currentHook = nextCurrentHook;
|
|
nextCurrentHook = {
|
|
memoizedState: currentHook.memoizedState,
|
|
baseState: currentHook.baseState,
|
|
baseQueue: currentHook.baseQueue,
|
|
queue: currentHook.queue,
|
|
next: null
|
|
};
|
|
null === workInProgressHook
|
|
? (currentlyRenderingFiber$1.memoizedState = workInProgressHook =
|
|
nextCurrentHook)
|
|
: (workInProgressHook = workInProgressHook.next = nextCurrentHook);
|
|
}
|
|
return workInProgressHook;
|
|
}
|
|
var createFunctionComponentUpdateQueue;
|
|
createFunctionComponentUpdateQueue = function () {
|
|
return { lastEffect: null, events: null, stores: null };
|
|
};
|
|
function useThenable(thenable) {
|
|
var index = thenableIndexCounter;
|
|
thenableIndexCounter += 1;
|
|
null === thenableState && (thenableState = []);
|
|
thenable = trackUsedThenable(thenableState, thenable, index);
|
|
null === currentlyRenderingFiber$1.alternate &&
|
|
(null === workInProgressHook
|
|
? null === currentlyRenderingFiber$1.memoizedState
|
|
: null === workInProgressHook.next) &&
|
|
(ReactCurrentDispatcher$1.current = HooksDispatcherOnMount);
|
|
return thenable;
|
|
}
|
|
function use(usable) {
|
|
if (null !== usable && "object" === typeof usable) {
|
|
if ("function" === typeof usable.then) return useThenable(usable);
|
|
if (usable.$$typeof === REACT_CONTEXT_TYPE) return readContext(usable);
|
|
}
|
|
throw Error("An unsupported type was passed to use(): " + String(usable));
|
|
}
|
|
function basicStateReducer(state, action) {
|
|
return "function" === typeof action ? action(state) : action;
|
|
}
|
|
function updateReducer(reducer) {
|
|
var hook = updateWorkInProgressHook(),
|
|
current = currentHook,
|
|
queue = hook.queue;
|
|
if (null === queue)
|
|
throw Error(
|
|
"Should have a queue. This is likely a bug in React. Please file an issue."
|
|
);
|
|
queue.lastRenderedReducer = reducer;
|
|
var baseQueue = hook.baseQueue,
|
|
pendingQueue = queue.pending;
|
|
if (null !== pendingQueue) {
|
|
if (null !== baseQueue) {
|
|
var baseFirst = baseQueue.next;
|
|
baseQueue.next = pendingQueue.next;
|
|
pendingQueue.next = baseFirst;
|
|
}
|
|
current.baseQueue = baseQueue = pendingQueue;
|
|
queue.pending = null;
|
|
}
|
|
pendingQueue = hook.baseState;
|
|
if (null === baseQueue) hook.memoizedState = pendingQueue;
|
|
else {
|
|
current = baseQueue.next;
|
|
var newBaseQueueFirst = (baseFirst = null),
|
|
newBaseQueueLast = null,
|
|
update = current;
|
|
do {
|
|
var updateLane = update.lane & -536870913;
|
|
if (
|
|
updateLane !== update.lane
|
|
? (workInProgressRootRenderLanes & updateLane) === updateLane
|
|
: (renderLanes & updateLane) === updateLane
|
|
)
|
|
null !== newBaseQueueLast &&
|
|
(newBaseQueueLast = newBaseQueueLast.next =
|
|
{
|
|
lane: 0,
|
|
revertLane: 0,
|
|
action: update.action,
|
|
hasEagerState: update.hasEagerState,
|
|
eagerState: update.eagerState,
|
|
next: null
|
|
}),
|
|
(updateLane = update.action),
|
|
shouldDoubleInvokeUserFnsInHooksDEV &&
|
|
reducer(pendingQueue, updateLane),
|
|
(pendingQueue = update.hasEagerState
|
|
? update.eagerState
|
|
: reducer(pendingQueue, updateLane));
|
|
else {
|
|
var clone = {
|
|
lane: updateLane,
|
|
revertLane: update.revertLane,
|
|
action: update.action,
|
|
hasEagerState: update.hasEagerState,
|
|
eagerState: update.eagerState,
|
|
next: null
|
|
};
|
|
null === newBaseQueueLast
|
|
? ((newBaseQueueFirst = newBaseQueueLast = clone),
|
|
(baseFirst = pendingQueue))
|
|
: (newBaseQueueLast = newBaseQueueLast.next = clone);
|
|
currentlyRenderingFiber$1.lanes |= updateLane;
|
|
workInProgressRootSkippedLanes |= updateLane;
|
|
}
|
|
update = update.next;
|
|
} while (null !== update && update !== current);
|
|
null === newBaseQueueLast
|
|
? (baseFirst = pendingQueue)
|
|
: (newBaseQueueLast.next = newBaseQueueFirst);
|
|
objectIs(pendingQueue, hook.memoizedState) || (didReceiveUpdate = !0);
|
|
hook.memoizedState = pendingQueue;
|
|
hook.baseState = baseFirst;
|
|
hook.baseQueue = newBaseQueueLast;
|
|
queue.lastRenderedState = pendingQueue;
|
|
}
|
|
null === baseQueue && (queue.lanes = 0);
|
|
return [hook.memoizedState, queue.dispatch];
|
|
}
|
|
function rerenderReducer(reducer) {
|
|
var hook = updateWorkInProgressHook(),
|
|
queue = hook.queue;
|
|
if (null === queue)
|
|
throw Error(
|
|
"Should have a queue. This is likely a bug in React. Please file an issue."
|
|
);
|
|
queue.lastRenderedReducer = reducer;
|
|
var dispatch = queue.dispatch,
|
|
lastRenderPhaseUpdate = queue.pending,
|
|
newState = hook.memoizedState;
|
|
if (null !== lastRenderPhaseUpdate) {
|
|
queue.pending = null;
|
|
var update = (lastRenderPhaseUpdate = lastRenderPhaseUpdate.next);
|
|
do (newState = reducer(newState, update.action)), (update = update.next);
|
|
while (update !== lastRenderPhaseUpdate);
|
|
objectIs(newState, hook.memoizedState) || (didReceiveUpdate = !0);
|
|
hook.memoizedState = newState;
|
|
null === hook.baseQueue && (hook.baseState = newState);
|
|
queue.lastRenderedState = newState;
|
|
}
|
|
return [newState, dispatch];
|
|
}
|
|
function updateSyncExternalStore(subscribe, getSnapshot) {
|
|
var fiber = currentlyRenderingFiber$1,
|
|
hook = updateWorkInProgressHook();
|
|
var nextSnapshot = getSnapshot();
|
|
var snapshotChanged = !objectIs(
|
|
(currentHook || hook).memoizedState,
|
|
nextSnapshot
|
|
);
|
|
snapshotChanged &&
|
|
((hook.memoizedState = nextSnapshot), (didReceiveUpdate = !0));
|
|
hook = hook.queue;
|
|
updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [
|
|
subscribe
|
|
]);
|
|
if (
|
|
hook.getSnapshot !== getSnapshot ||
|
|
snapshotChanged ||
|
|
(null !== workInProgressHook && workInProgressHook.memoizedState.tag & 1)
|
|
) {
|
|
fiber.flags |= 2048;
|
|
pushEffect(
|
|
9,
|
|
updateStoreInstance.bind(null, fiber, hook, nextSnapshot, getSnapshot),
|
|
{ destroy: void 0 },
|
|
null
|
|
);
|
|
if (null === workInProgressRoot)
|
|
throw Error(
|
|
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
|
);
|
|
0 !== (renderLanes & 60) ||
|
|
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
|
}
|
|
return nextSnapshot;
|
|
}
|
|
function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) {
|
|
fiber.flags |= 16384;
|
|
fiber = { getSnapshot: getSnapshot, value: renderedSnapshot };
|
|
getSnapshot = currentlyRenderingFiber$1.updateQueue;
|
|
null === getSnapshot
|
|
? ((getSnapshot = createFunctionComponentUpdateQueue()),
|
|
(currentlyRenderingFiber$1.updateQueue = getSnapshot),
|
|
(getSnapshot.stores = [fiber]))
|
|
: ((renderedSnapshot = getSnapshot.stores),
|
|
null === renderedSnapshot
|
|
? (getSnapshot.stores = [fiber])
|
|
: renderedSnapshot.push(fiber));
|
|
}
|
|
function updateStoreInstance(fiber, inst, nextSnapshot, getSnapshot) {
|
|
inst.value = nextSnapshot;
|
|
inst.getSnapshot = getSnapshot;
|
|
checkIfSnapshotChanged(inst) && forceStoreRerender(fiber);
|
|
}
|
|
function subscribeToStore(fiber, inst, subscribe) {
|
|
return subscribe(function () {
|
|
checkIfSnapshotChanged(inst) && forceStoreRerender(fiber);
|
|
});
|
|
}
|
|
function checkIfSnapshotChanged(inst) {
|
|
var latestGetSnapshot = inst.getSnapshot;
|
|
inst = inst.value;
|
|
try {
|
|
var nextValue = latestGetSnapshot();
|
|
return !objectIs(inst, nextValue);
|
|
} catch (error) {
|
|
return !0;
|
|
}
|
|
}
|
|
function forceStoreRerender(fiber) {
|
|
var root = enqueueConcurrentRenderForLane(fiber, 2);
|
|
null !== root && scheduleUpdateOnFiber(root, fiber, 2);
|
|
}
|
|
function mountStateImpl(initialState) {
|
|
var hook = mountWorkInProgressHook();
|
|
if ("function" === typeof initialState) {
|
|
var initialStateInitializer = initialState;
|
|
initialState = initialStateInitializer();
|
|
shouldDoubleInvokeUserFnsInHooksDEV && initialStateInitializer();
|
|
}
|
|
hook.memoizedState = hook.baseState = initialState;
|
|
hook.queue = {
|
|
pending: null,
|
|
lanes: 0,
|
|
dispatch: null,
|
|
lastRenderedReducer: basicStateReducer,
|
|
lastRenderedState: initialState
|
|
};
|
|
return hook;
|
|
}
|
|
function pushEffect(tag, create, inst, deps) {
|
|
tag = { tag: tag, create: create, inst: inst, deps: deps, next: null };
|
|
create = currentlyRenderingFiber$1.updateQueue;
|
|
null === create
|
|
? ((create = createFunctionComponentUpdateQueue()),
|
|
(currentlyRenderingFiber$1.updateQueue = create),
|
|
(create.lastEffect = tag.next = tag))
|
|
: ((inst = create.lastEffect),
|
|
null === inst
|
|
? (create.lastEffect = tag.next = tag)
|
|
: ((deps = inst.next),
|
|
(inst.next = tag),
|
|
(tag.next = deps),
|
|
(create.lastEffect = tag)));
|
|
return tag;
|
|
}
|
|
function updateRef() {
|
|
return updateWorkInProgressHook().memoizedState;
|
|
}
|
|
function mountEffectImpl(fiberFlags, hookFlags, create, deps) {
|
|
var hook = mountWorkInProgressHook();
|
|
currentlyRenderingFiber$1.flags |= fiberFlags;
|
|
hook.memoizedState = pushEffect(
|
|
1 | hookFlags,
|
|
create,
|
|
{ destroy: void 0 },
|
|
void 0 === deps ? null : deps
|
|
);
|
|
}
|
|
function updateEffectImpl(fiberFlags, hookFlags, create, deps) {
|
|
var hook = updateWorkInProgressHook();
|
|
deps = void 0 === deps ? null : deps;
|
|
var inst = hook.memoizedState.inst;
|
|
null !== currentHook &&
|
|
null !== deps &&
|
|
areHookInputsEqual(deps, currentHook.memoizedState.deps)
|
|
? (hook.memoizedState = pushEffect(hookFlags, create, inst, deps))
|
|
: ((currentlyRenderingFiber$1.flags |= fiberFlags),
|
|
(hook.memoizedState = pushEffect(1 | hookFlags, create, inst, deps)));
|
|
}
|
|
function mountEffect(create, deps) {
|
|
mountEffectImpl(8390656, 8, create, deps);
|
|
}
|
|
function updateEffect(create, deps) {
|
|
updateEffectImpl(2048, 8, create, deps);
|
|
}
|
|
function updateInsertionEffect(create, deps) {
|
|
return updateEffectImpl(4, 2, create, deps);
|
|
}
|
|
function updateLayoutEffect(create, deps) {
|
|
return updateEffectImpl(4, 4, create, deps);
|
|
}
|
|
function imperativeHandleEffect(create, ref) {
|
|
if ("function" === typeof ref)
|
|
return (
|
|
(create = create()),
|
|
ref(create),
|
|
function () {
|
|
ref(null);
|
|
}
|
|
);
|
|
if (null !== ref && void 0 !== ref)
|
|
return (
|
|
(create = create()),
|
|
(ref.current = create),
|
|
function () {
|
|
ref.current = null;
|
|
}
|
|
);
|
|
}
|
|
function updateImperativeHandle(ref, create, deps) {
|
|
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
|
|
updateEffectImpl(4, 4, imperativeHandleEffect.bind(null, create, ref), deps);
|
|
}
|
|
function mountDebugValue() {}
|
|
function updateCallback(callback, deps) {
|
|
var hook = updateWorkInProgressHook();
|
|
deps = void 0 === deps ? null : deps;
|
|
var prevState = hook.memoizedState;
|
|
if (null !== deps && areHookInputsEqual(deps, prevState[1]))
|
|
return prevState[0];
|
|
hook.memoizedState = [callback, deps];
|
|
return callback;
|
|
}
|
|
function updateMemo(nextCreate, deps) {
|
|
var hook = updateWorkInProgressHook();
|
|
deps = void 0 === deps ? null : deps;
|
|
var prevState = hook.memoizedState;
|
|
if (null !== deps && areHookInputsEqual(deps, prevState[1]))
|
|
return prevState[0];
|
|
prevState = nextCreate();
|
|
shouldDoubleInvokeUserFnsInHooksDEV && nextCreate();
|
|
hook.memoizedState = [prevState, deps];
|
|
return prevState;
|
|
}
|
|
function mountDeferredValueImpl(hook, value, initialValue) {
|
|
return void 0 !== initialValue && 0 === (renderLanes & 1073741824)
|
|
? ((hook.memoizedState = initialValue),
|
|
(hook = requestDeferredLane()),
|
|
(currentlyRenderingFiber$1.lanes |= hook),
|
|
(workInProgressRootSkippedLanes |= hook),
|
|
initialValue)
|
|
: (hook.memoizedState = value);
|
|
}
|
|
function updateDeferredValueImpl(hook, prevValue, value, initialValue) {
|
|
if (objectIs(value, prevValue)) return value;
|
|
if (null !== currentTreeHiddenStackCursor.current)
|
|
return (
|
|
(hook = mountDeferredValueImpl(hook, value, initialValue)),
|
|
objectIs(hook, prevValue) || (didReceiveUpdate = !0),
|
|
hook
|
|
);
|
|
if (0 === (renderLanes & 42))
|
|
return (didReceiveUpdate = !0), (hook.memoizedState = value);
|
|
hook = requestDeferredLane();
|
|
currentlyRenderingFiber$1.lanes |= hook;
|
|
workInProgressRootSkippedLanes |= hook;
|
|
return prevValue;
|
|
}
|
|
function startTransition(fiber, queue, pendingState, finishedState, callback) {
|
|
var previousPriority = currentUpdatePriority;
|
|
currentUpdatePriority =
|
|
0 !== previousPriority && 8 > previousPriority ? previousPriority : 8;
|
|
var prevTransition = ReactCurrentBatchConfig$2.transition,
|
|
currentTransition = { _callbacks: new Set() };
|
|
ReactCurrentBatchConfig$2.transition = null;
|
|
dispatchSetState(fiber, queue, pendingState);
|
|
ReactCurrentBatchConfig$2.transition = currentTransition;
|
|
try {
|
|
dispatchSetState(fiber, queue, finishedState), callback();
|
|
} catch (error) {
|
|
throw error;
|
|
} finally {
|
|
(currentUpdatePriority = previousPriority),
|
|
(ReactCurrentBatchConfig$2.transition = prevTransition);
|
|
}
|
|
}
|
|
function updateId() {
|
|
return updateWorkInProgressHook().memoizedState;
|
|
}
|
|
function dispatchReducerAction(fiber, queue, action) {
|
|
var lane = requestUpdateLane(fiber);
|
|
action = {
|
|
lane: lane,
|
|
revertLane: 0,
|
|
action: action,
|
|
hasEagerState: !1,
|
|
eagerState: null,
|
|
next: null
|
|
};
|
|
isRenderPhaseUpdate(fiber)
|
|
? enqueueRenderPhaseUpdate(queue, action)
|
|
: (enqueueUpdate$1(fiber, queue, action, lane),
|
|
(action = getRootForUpdatedFiber(fiber)),
|
|
null !== action &&
|
|
(scheduleUpdateOnFiber(action, fiber, lane),
|
|
entangleTransitionUpdate(action, queue, lane)));
|
|
}
|
|
function dispatchSetState(fiber, queue, action) {
|
|
var lane = requestUpdateLane(fiber),
|
|
update = {
|
|
lane: lane,
|
|
revertLane: 0,
|
|
action: action,
|
|
hasEagerState: !1,
|
|
eagerState: null,
|
|
next: null
|
|
};
|
|
if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, update);
|
|
else {
|
|
var alternate = fiber.alternate;
|
|
if (
|
|
0 === fiber.lanes &&
|
|
(null === alternate || 0 === alternate.lanes) &&
|
|
((alternate = queue.lastRenderedReducer), null !== alternate)
|
|
)
|
|
try {
|
|
var currentState = queue.lastRenderedState,
|
|
eagerState = alternate(currentState, action);
|
|
update.hasEagerState = !0;
|
|
update.eagerState = eagerState;
|
|
if (objectIs(eagerState, currentState)) {
|
|
enqueueUpdate$1(fiber, queue, update, 0);
|
|
null === workInProgressRoot && finishQueueingConcurrentUpdates();
|
|
return;
|
|
}
|
|
} catch (error) {
|
|
} finally {
|
|
}
|
|
enqueueUpdate$1(fiber, queue, update, lane);
|
|
action = getRootForUpdatedFiber(fiber);
|
|
null !== action &&
|
|
(scheduleUpdateOnFiber(action, fiber, lane),
|
|
entangleTransitionUpdate(action, queue, lane));
|
|
}
|
|
}
|
|
function isRenderPhaseUpdate(fiber) {
|
|
var alternate = fiber.alternate;
|
|
return (
|
|
fiber === currentlyRenderingFiber$1 ||
|
|
(null !== alternate && alternate === currentlyRenderingFiber$1)
|
|
);
|
|
}
|
|
function enqueueRenderPhaseUpdate(queue, update) {
|
|
didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate =
|
|
!0;
|
|
var pending = queue.pending;
|
|
null === pending
|
|
? (update.next = update)
|
|
: ((update.next = pending.next), (pending.next = update));
|
|
queue.pending = update;
|
|
}
|
|
function entangleTransitionUpdate(root, queue, lane) {
|
|
if (0 !== (lane & 4194176)) {
|
|
var queueLanes = queue.lanes;
|
|
queueLanes &= root.pendingLanes;
|
|
lane |= queueLanes;
|
|
queue.lanes = lane;
|
|
markRootEntangled(root, lane);
|
|
}
|
|
}
|
|
var ContextOnlyDispatcher = {
|
|
readContext: readContext,
|
|
use: use,
|
|
useCallback: throwInvalidHookError,
|
|
useContext: throwInvalidHookError,
|
|
useEffect: throwInvalidHookError,
|
|
useImperativeHandle: throwInvalidHookError,
|
|
useInsertionEffect: throwInvalidHookError,
|
|
useLayoutEffect: throwInvalidHookError,
|
|
useMemo: throwInvalidHookError,
|
|
useReducer: throwInvalidHookError,
|
|
useRef: throwInvalidHookError,
|
|
useState: throwInvalidHookError,
|
|
useDebugValue: throwInvalidHookError,
|
|
useDeferredValue: throwInvalidHookError,
|
|
useTransition: throwInvalidHookError,
|
|
useSyncExternalStore: throwInvalidHookError,
|
|
useId: throwInvalidHookError
|
|
},
|
|
HooksDispatcherOnMount = {
|
|
readContext: readContext,
|
|
use: use,
|
|
useCallback: function (callback, deps) {
|
|
mountWorkInProgressHook().memoizedState = [
|
|
callback,
|
|
void 0 === deps ? null : deps
|
|
];
|
|
return callback;
|
|
},
|
|
useContext: readContext,
|
|
useEffect: mountEffect,
|
|
useImperativeHandle: function (ref, create, deps) {
|
|
deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;
|
|
mountEffectImpl(
|
|
4194308,
|
|
4,
|
|
imperativeHandleEffect.bind(null, create, ref),
|
|
deps
|
|
);
|
|
},
|
|
useLayoutEffect: function (create, deps) {
|
|
return mountEffectImpl(4194308, 4, create, deps);
|
|
},
|
|
useInsertionEffect: function (create, deps) {
|
|
mountEffectImpl(4, 2, create, deps);
|
|
},
|
|
useMemo: function (nextCreate, deps) {
|
|
var hook = mountWorkInProgressHook();
|
|
deps = void 0 === deps ? null : deps;
|
|
var nextValue = nextCreate();
|
|
shouldDoubleInvokeUserFnsInHooksDEV && nextCreate();
|
|
hook.memoizedState = [nextValue, deps];
|
|
return nextValue;
|
|
},
|
|
useReducer: function (reducer, initialArg, init) {
|
|
var hook = mountWorkInProgressHook();
|
|
if (void 0 !== init) {
|
|
var initialState = init(initialArg);
|
|
shouldDoubleInvokeUserFnsInHooksDEV && init(initialArg);
|
|
} else initialState = initialArg;
|
|
hook.memoizedState = hook.baseState = initialState;
|
|
reducer = {
|
|
pending: null,
|
|
lanes: 0,
|
|
dispatch: null,
|
|
lastRenderedReducer: reducer,
|
|
lastRenderedState: initialState
|
|
};
|
|
hook.queue = reducer;
|
|
reducer = reducer.dispatch = dispatchReducerAction.bind(
|
|
null,
|
|
currentlyRenderingFiber$1,
|
|
reducer
|
|
);
|
|
return [hook.memoizedState, reducer];
|
|
},
|
|
useRef: function (initialValue) {
|
|
var hook = mountWorkInProgressHook();
|
|
initialValue = { current: initialValue };
|
|
return (hook.memoizedState = initialValue);
|
|
},
|
|
useState: function (initialState) {
|
|
initialState = mountStateImpl(initialState);
|
|
var queue = initialState.queue,
|
|
dispatch = dispatchSetState.bind(
|
|
null,
|
|
currentlyRenderingFiber$1,
|
|
queue
|
|
);
|
|
queue.dispatch = dispatch;
|
|
return [initialState.memoizedState, dispatch];
|
|
},
|
|
useDebugValue: mountDebugValue,
|
|
useDeferredValue: function (value, initialValue) {
|
|
var hook = mountWorkInProgressHook();
|
|
return mountDeferredValueImpl(hook, value, initialValue);
|
|
},
|
|
useTransition: function () {
|
|
var stateHook = mountStateImpl(!1);
|
|
stateHook = startTransition.bind(
|
|
null,
|
|
currentlyRenderingFiber$1,
|
|
stateHook.queue,
|
|
!0,
|
|
!1
|
|
);
|
|
mountWorkInProgressHook().memoizedState = stateHook;
|
|
return [!1, stateHook];
|
|
},
|
|
useSyncExternalStore: function (subscribe, getSnapshot) {
|
|
var fiber = currentlyRenderingFiber$1,
|
|
hook = mountWorkInProgressHook();
|
|
var nextSnapshot = getSnapshot();
|
|
if (null === workInProgressRoot)
|
|
throw Error(
|
|
"Expected a work-in-progress root. This is a bug in React. Please file an issue."
|
|
);
|
|
0 !== (workInProgressRootRenderLanes & 60) ||
|
|
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
|
hook.memoizedState = nextSnapshot;
|
|
var inst = { value: nextSnapshot, getSnapshot: getSnapshot };
|
|
hook.queue = inst;
|
|
mountEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [
|
|
subscribe
|
|
]);
|
|
fiber.flags |= 2048;
|
|
pushEffect(
|
|
9,
|
|
updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot),
|
|
{ destroy: void 0 },
|
|
null
|
|
);
|
|
return nextSnapshot;
|
|
},
|
|
useId: function () {
|
|
var hook = mountWorkInProgressHook(),
|
|
identifierPrefix = workInProgressRoot.identifierPrefix,
|
|
globalClientId = globalClientIdCounter++;
|
|
identifierPrefix =
|
|
":" + identifierPrefix + "r" + globalClientId.toString(32) + ":";
|
|
return (hook.memoizedState = identifierPrefix);
|
|
}
|
|
},
|
|
HooksDispatcherOnUpdate = {
|
|
readContext: readContext,
|
|
use: use,
|
|
useCallback: updateCallback,
|
|
useContext: readContext,
|
|
useEffect: updateEffect,
|
|
useImperativeHandle: updateImperativeHandle,
|
|
useInsertionEffect: updateInsertionEffect,
|
|
useLayoutEffect: updateLayoutEffect,
|
|
useMemo: updateMemo,
|
|
useReducer: updateReducer,
|
|
useRef: updateRef,
|
|
useState: function () {
|
|
return updateReducer(basicStateReducer);
|
|
},
|
|
useDebugValue: mountDebugValue,
|
|
useDeferredValue: function (value, initialValue) {
|
|
var hook = updateWorkInProgressHook();
|
|
return updateDeferredValueImpl(
|
|
hook,
|
|
currentHook.memoizedState,
|
|
value,
|
|
initialValue
|
|
);
|
|
},
|
|
useTransition: function () {
|
|
var booleanOrThenable = updateReducer(basicStateReducer)[0],
|
|
start = updateWorkInProgressHook().memoizedState;
|
|
return [
|
|
"boolean" === typeof booleanOrThenable
|
|
? booleanOrThenable
|
|
: useThenable(booleanOrThenable),
|
|
start
|
|
];
|
|
},
|
|
useSyncExternalStore: updateSyncExternalStore,
|
|
useId: updateId
|
|
},
|
|
HooksDispatcherOnRerender = {
|
|
readContext: readContext,
|
|
use: use,
|
|
useCallback: updateCallback,
|
|
useContext: readContext,
|
|
useEffect: updateEffect,
|
|
useImperativeHandle: updateImperativeHandle,
|
|
useInsertionEffect: updateInsertionEffect,
|
|
useLayoutEffect: updateLayoutEffect,
|
|
useMemo: updateMemo,
|
|
useReducer: rerenderReducer,
|
|
useRef: updateRef,
|
|
useState: function () {
|
|
return rerenderReducer(basicStateReducer);
|
|
},
|
|
useDebugValue: mountDebugValue,
|
|
useDeferredValue: function (value, initialValue) {
|
|
var hook = updateWorkInProgressHook();
|
|
return null === currentHook
|
|
? mountDeferredValueImpl(hook, value, initialValue)
|
|
: updateDeferredValueImpl(
|
|
hook,
|
|
currentHook.memoizedState,
|
|
value,
|
|
initialValue
|
|
);
|
|
},
|
|
useTransition: function () {
|
|
var booleanOrThenable = rerenderReducer(basicStateReducer)[0],
|
|
start = updateWorkInProgressHook().memoizedState;
|
|
return [
|
|
"boolean" === typeof booleanOrThenable
|
|
? booleanOrThenable
|
|
: useThenable(booleanOrThenable),
|
|
start
|
|
];
|
|
},
|
|
useSyncExternalStore: updateSyncExternalStore,
|
|
useId: updateId
|
|
};
|
|
function resolveDefaultProps(Component, baseProps) {
|
|
if (Component && Component.defaultProps) {
|
|
baseProps = assign({}, baseProps);
|
|
Component = Component.defaultProps;
|
|
for (var propName in Component)
|
|
void 0 === baseProps[propName] &&
|
|
(baseProps[propName] = Component[propName]);
|
|
return baseProps;
|
|
}
|
|
return baseProps;
|
|
}
|
|
function applyDerivedStateFromProps(
|
|
workInProgress,
|
|
ctor,
|
|
getDerivedStateFromProps,
|
|
nextProps
|
|
) {
|
|
ctor = workInProgress.memoizedState;
|
|
getDerivedStateFromProps = getDerivedStateFromProps(nextProps, ctor);
|
|
getDerivedStateFromProps =
|
|
null === getDerivedStateFromProps || void 0 === getDerivedStateFromProps
|
|
? ctor
|
|
: assign({}, ctor, getDerivedStateFromProps);
|
|
workInProgress.memoizedState = getDerivedStateFromProps;
|
|
0 === workInProgress.lanes &&
|
|
(workInProgress.updateQueue.baseState = getDerivedStateFromProps);
|
|
}
|
|
var classComponentUpdater = {
|
|
isMounted: function (component) {
|
|
return (component = component._reactInternals)
|
|
? getNearestMountedFiber(component) === component
|
|
: !1;
|
|
},
|
|
enqueueSetState: function (inst, payload, callback) {
|
|
inst = inst._reactInternals;
|
|
var lane = requestUpdateLane(inst),
|
|
update = createUpdate(lane);
|
|
update.payload = payload;
|
|
void 0 !== callback && null !== callback && (update.callback = callback);
|
|
payload = enqueueUpdate(inst, update, lane);
|
|
null !== payload &&
|
|
(scheduleUpdateOnFiber(payload, inst, lane),
|
|
entangleTransitions(payload, inst, lane));
|
|
},
|
|
enqueueReplaceState: function (inst, payload, callback) {
|
|
inst = inst._reactInternals;
|
|
var lane = requestUpdateLane(inst),
|
|
update = createUpdate(lane);
|
|
update.tag = 1;
|
|
update.payload = payload;
|
|
void 0 !== callback && null !== callback && (update.callback = callback);
|
|
payload = enqueueUpdate(inst, update, lane);
|
|
null !== payload &&
|
|
(scheduleUpdateOnFiber(payload, inst, lane),
|
|
entangleTransitions(payload, inst, lane));
|
|
},
|
|
enqueueForceUpdate: function (inst, callback) {
|
|
inst = inst._reactInternals;
|
|
var lane = requestUpdateLane(inst),
|
|
update = createUpdate(lane);
|
|
update.tag = 2;
|
|
void 0 !== callback && null !== callback && (update.callback = callback);
|
|
callback = enqueueUpdate(inst, update, lane);
|
|
null !== callback &&
|
|
(scheduleUpdateOnFiber(callback, inst, lane),
|
|
entangleTransitions(callback, inst, lane));
|
|
}
|
|
};
|
|
function checkShouldComponentUpdate(
|
|
workInProgress,
|
|
ctor,
|
|
oldProps,
|
|
newProps,
|
|
oldState,
|
|
newState,
|
|
nextContext
|
|
) {
|
|
workInProgress = workInProgress.stateNode;
|
|
return "function" === typeof workInProgress.shouldComponentUpdate
|
|
? workInProgress.shouldComponentUpdate(newProps, newState, nextContext)
|
|
: ctor.prototype && ctor.prototype.isPureReactComponent
|
|
? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)
|
|
: !0;
|
|
}
|
|
function constructClassInstance(workInProgress, ctor, props) {
|
|
var context = emptyContextObject,
|
|
contextType = ctor.contextType;
|
|
"object" === typeof contextType &&
|
|
null !== contextType &&
|
|
(context = readContext(contextType));
|
|
ctor = new ctor(props, context);
|
|
workInProgress.memoizedState =
|
|
null !== ctor.state && void 0 !== ctor.state ? ctor.state : null;
|
|
ctor.updater = classComponentUpdater;
|
|
workInProgress.stateNode = ctor;
|
|
ctor._reactInternals = workInProgress;
|
|
return ctor;
|
|
}
|
|
function callComponentWillReceiveProps(
|
|
workInProgress,
|
|
instance,
|
|
newProps,
|
|
nextContext
|
|
) {
|
|
workInProgress = instance.state;
|
|
"function" === typeof instance.componentWillReceiveProps &&
|
|
instance.componentWillReceiveProps(newProps, nextContext);
|
|
"function" === typeof instance.UNSAFE_componentWillReceiveProps &&
|
|
instance.UNSAFE_componentWillReceiveProps(newProps, nextContext);
|
|
instance.state !== workInProgress &&
|
|
classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
|
|
}
|
|
function mountClassInstance(workInProgress, ctor, newProps, renderLanes) {
|
|
var instance = workInProgress.stateNode;
|
|
instance.props = newProps;
|
|
instance.state = workInProgress.memoizedState;
|
|
instance.refs = {};
|
|
initializeUpdateQueue(workInProgress);
|
|
var contextType = ctor.contextType;
|
|
instance.context =
|
|
"object" === typeof contextType && null !== contextType
|
|
? readContext(contextType)
|
|
: emptyContextObject;
|
|
instance.state = workInProgress.memoizedState;
|
|
contextType = ctor.getDerivedStateFromProps;
|
|
"function" === typeof contextType &&
|
|
(applyDerivedStateFromProps(workInProgress, ctor, contextType, newProps),
|
|
(instance.state = workInProgress.memoizedState));
|
|
"function" === typeof ctor.getDerivedStateFromProps ||
|
|
"function" === typeof instance.getSnapshotBeforeUpdate ||
|
|
("function" !== typeof instance.UNSAFE_componentWillMount &&
|
|
"function" !== typeof instance.componentWillMount) ||
|
|
((ctor = instance.state),
|
|
"function" === typeof instance.componentWillMount &&
|
|
instance.componentWillMount(),
|
|
"function" === typeof instance.UNSAFE_componentWillMount &&
|
|
instance.UNSAFE_componentWillMount(),
|
|
ctor !== instance.state &&
|
|
classComponentUpdater.enqueueReplaceState(instance, instance.state, null),
|
|
processUpdateQueue(workInProgress, newProps, instance, renderLanes),
|
|
(instance.state = workInProgress.memoizedState));
|
|
"function" === typeof instance.componentDidMount &&
|
|
(workInProgress.flags |= 4194308);
|
|
}
|
|
var CapturedStacks = new WeakMap();
|
|
function createCapturedValueAtFiber(value, source) {
|
|
if ("object" === typeof value && null !== value) {
|
|
var stack = CapturedStacks.get(value);
|
|
"string" !== typeof stack &&
|
|
((stack = getStackByFiberInDevAndProd(source)),
|
|
CapturedStacks.set(value, stack));
|
|
} else stack = getStackByFiberInDevAndProd(source);
|
|
return { value: value, source: source, stack: stack, digest: null };
|
|
}
|
|
function createCapturedValueFromError(value, digest, stack) {
|
|
"string" === typeof stack && CapturedStacks.set(value, stack);
|
|
return {
|
|
value: value,
|
|
source: null,
|
|
stack: null != stack ? stack : null,
|
|
digest: null != digest ? digest : null
|
|
};
|
|
}
|
|
if (
|
|
"function" !==
|
|
typeof ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog
|
|
)
|
|
throw Error(
|
|
"Expected ReactFiberErrorDialog.showErrorDialog to be a function."
|
|
);
|
|
function logCapturedError(boundary, errorInfo) {
|
|
try {
|
|
!1 !==
|
|
ReactNativePrivateInterface.ReactFiberErrorDialog.showErrorDialog({
|
|
componentStack: null !== errorInfo.stack ? errorInfo.stack : "",
|
|
error: errorInfo.value,
|
|
errorBoundary:
|
|
null !== boundary && 1 === boundary.tag ? boundary.stateNode : null
|
|
}) && console.error(errorInfo.value);
|
|
} catch (e) {
|
|
setTimeout(function () {
|
|
throw e;
|
|
});
|
|
}
|
|
}
|
|
function createRootErrorUpdate(fiber, errorInfo, lane) {
|
|
lane = createUpdate(lane);
|
|
lane.tag = 3;
|
|
lane.payload = { element: null };
|
|
var error = errorInfo.value;
|
|
lane.callback = function () {
|
|
hasUncaughtError || ((hasUncaughtError = !0), (firstUncaughtError = error));
|
|
logCapturedError(fiber, errorInfo);
|
|
};
|
|
return lane;
|
|
}
|
|
function createClassErrorUpdate(fiber, errorInfo, lane) {
|
|
lane = createUpdate(lane);
|
|
lane.tag = 3;
|
|
var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
|
|
if ("function" === typeof getDerivedStateFromError) {
|
|
var error = errorInfo.value;
|
|
lane.payload = function () {
|
|
return getDerivedStateFromError(error);
|
|
};
|
|
lane.callback = function () {
|
|
logCapturedError(fiber, errorInfo);
|
|
};
|
|
}
|
|
var inst = fiber.stateNode;
|
|
null !== inst &&
|
|
"function" === typeof inst.componentDidCatch &&
|
|
(lane.callback = function () {
|
|
logCapturedError(fiber, errorInfo);
|
|
"function" !== typeof getDerivedStateFromError &&
|
|
(null === legacyErrorBoundariesThatAlreadyFailed
|
|
? (legacyErrorBoundariesThatAlreadyFailed = new Set([this]))
|
|
: legacyErrorBoundariesThatAlreadyFailed.add(this));
|
|
var stack = errorInfo.stack;
|
|
this.componentDidCatch(errorInfo.value, {
|
|
componentStack: null !== stack ? stack : ""
|
|
});
|
|
});
|
|
return lane;
|
|
}
|
|
function throwException(
|
|
root,
|
|
returnFiber,
|
|
sourceFiber,
|
|
value,
|
|
rootRenderLanes
|
|
) {
|
|
sourceFiber.flags |= 32768;
|
|
if (
|
|
null !== value &&
|
|
"object" === typeof value &&
|
|
"function" === typeof value.then
|
|
) {
|
|
var tag = sourceFiber.tag;
|
|
0 !== (sourceFiber.mode & 1) ||
|
|
(0 !== tag && 11 !== tag && 15 !== tag) ||
|
|
((tag = sourceFiber.alternate)
|
|
? ((sourceFiber.updateQueue = tag.updateQueue),
|
|
(sourceFiber.memoizedState = tag.memoizedState),
|
|
(sourceFiber.lanes = tag.lanes))
|
|
: ((sourceFiber.updateQueue = null),
|
|
(sourceFiber.memoizedState = null)));
|
|
tag = suspenseHandlerStackCursor.current;
|
|
if (null !== tag) {
|
|
switch (tag.tag) {
|
|
case 13:
|
|
return (
|
|
sourceFiber.mode & 1 &&
|
|
(null === shellBoundary
|
|
? renderDidSuspendDelayIfPossible()
|
|
: null === tag.alternate &&
|
|
0 === workInProgressRootExitStatus &&
|
|
(workInProgressRootExitStatus = 3)),
|
|
(tag.flags &= -257),
|
|
0 === (tag.mode & 1)
|
|
? tag === returnFiber
|
|
? (tag.flags |= 65536)
|
|
: ((tag.flags |= 128),
|
|
(sourceFiber.flags |= 131072),
|
|
(sourceFiber.flags &= -52805),
|
|
1 === sourceFiber.tag &&
|
|
(null === sourceFiber.alternate
|
|
? (sourceFiber.tag = 17)
|
|
: ((returnFiber = createUpdate(2)),
|
|
(returnFiber.tag = 2),
|
|
enqueueUpdate(sourceFiber, returnFiber, 2))),
|
|
(sourceFiber.lanes |= 2))
|
|
: ((tag.flags |= 65536), (tag.lanes = rootRenderLanes)),
|
|
value === noopSuspenseyCommitThenable
|
|
? (tag.flags |= 16384)
|
|
: ((returnFiber = tag.updateQueue),
|
|
null === returnFiber
|
|
? (tag.updateQueue = new Set([value]))
|
|
: returnFiber.add(value),
|
|
tag.mode & 1 &&
|
|
attachPingListener(root, value, rootRenderLanes)),
|
|
!1
|
|
);
|
|
case 22:
|
|
if (tag.mode & 1)
|
|
return (
|
|
(tag.flags |= 65536),
|
|
value === noopSuspenseyCommitThenable
|
|
? (tag.flags |= 16384)
|
|
: ((returnFiber = tag.updateQueue),
|
|
null === returnFiber
|
|
? ((returnFiber = {
|
|
transitions: null,
|
|
markerInstances: null,
|
|
retryQueue: new Set([value])
|
|
}),
|
|
(tag.updateQueue = returnFiber))
|
|
: ((sourceFiber = returnFiber.retryQueue),
|
|
null === sourceFiber
|
|
? (returnFiber.retryQueue = new Set([value]))
|
|
: sourceFiber.add(value)),
|
|
attachPingListener(root, value, rootRenderLanes)),
|
|
!1
|
|
);
|
|
}
|
|
throw Error(
|
|
"Unexpected Suspense handler tag (" +
|
|
tag.tag +
|
|
"). This is a bug in React."
|
|
);
|
|
}
|
|
if (1 === root.tag)
|
|
return (
|
|
attachPingListener(root, value, rootRenderLanes),
|
|
renderDidSuspendDelayIfPossible(),
|
|
!1
|
|
);
|
|
value = Error(
|
|
"A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition."
|
|
);
|
|
}
|
|
root = value = createCapturedValueAtFiber(value, sourceFiber);
|
|
4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2);
|
|
null === workInProgressRootConcurrentErrors
|
|
? (workInProgressRootConcurrentErrors = [root])
|
|
: workInProgressRootConcurrentErrors.push(root);
|
|
if (null === returnFiber) return !0;
|
|
root = returnFiber;
|
|
do {
|
|
switch (root.tag) {
|
|
case 3:
|
|
return (
|
|
(root.flags |= 65536),
|
|
(rootRenderLanes &= -rootRenderLanes),
|
|
(root.lanes |= rootRenderLanes),
|
|
(rootRenderLanes = createRootErrorUpdate(
|
|
root,
|
|
value,
|
|
rootRenderLanes
|
|
)),
|
|
enqueueCapturedUpdate(root, rootRenderLanes),
|
|
!1
|
|
);
|
|
case 1:
|
|
if (
|
|
((returnFiber = value),
|
|
(sourceFiber = root.type),
|
|
(tag = root.stateNode),
|
|
0 === (root.flags & 128) &&
|
|
("function" === typeof sourceFiber.getDerivedStateFromError ||
|
|
(null !== tag &&
|
|
"function" === typeof tag.componentDidCatch &&
|
|
(null === legacyErrorBoundariesThatAlreadyFailed ||
|
|
!legacyErrorBoundariesThatAlreadyFailed.has(tag)))))
|
|
)
|
|
return (
|
|
(root.flags |= 65536),
|
|
(rootRenderLanes &= -rootRenderLanes),
|
|
(root.lanes |= rootRenderLanes),
|
|
(rootRenderLanes = createClassErrorUpdate(
|
|
root,
|
|
returnFiber,
|
|
rootRenderLanes
|
|
)),
|
|
enqueueCapturedUpdate(root, rootRenderLanes),
|
|
!1
|
|
);
|
|
}
|
|
root = root.return;
|
|
} while (null !== root);
|
|
return !1;
|
|
}
|
|
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner,
|
|
SelectiveHydrationException = Error(
|
|
"This is not a real error. It's an implementation detail of React's selective hydration feature. If this leaks into userspace, it's a bug in React. Please file an issue."
|
|
),
|
|
didReceiveUpdate = !1;
|
|
function reconcileChildren(current, workInProgress, nextChildren, renderLanes) {
|
|
workInProgress.child =
|
|
null === current
|
|
? mountChildFibers(workInProgress, null, nextChildren, renderLanes)
|
|
: reconcileChildFibers(
|
|
workInProgress,
|
|
current.child,
|
|
nextChildren,
|
|
renderLanes
|
|
);
|
|
}
|
|
function updateForwardRef(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
renderLanes
|
|
) {
|
|
Component = Component.render;
|
|
var ref = workInProgress.ref;
|
|
prepareToReadContext(workInProgress, renderLanes);
|
|
nextProps = renderWithHooks(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
ref,
|
|
renderLanes
|
|
);
|
|
if (null !== current && !didReceiveUpdate)
|
|
return (
|
|
bailoutHooks(current, workInProgress, renderLanes),
|
|
bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes)
|
|
);
|
|
workInProgress.flags |= 1;
|
|
reconcileChildren(current, workInProgress, nextProps, renderLanes);
|
|
return workInProgress.child;
|
|
}
|
|
function updateMemoComponent(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
renderLanes
|
|
) {
|
|
if (null === current) {
|
|
var type = Component.type;
|
|
if (
|
|
"function" === typeof type &&
|
|
!shouldConstruct(type) &&
|
|
void 0 === type.defaultProps &&
|
|
null === Component.compare &&
|
|
void 0 === Component.defaultProps
|
|
)
|
|
return (
|
|
(workInProgress.tag = 15),
|
|
(workInProgress.type = type),
|
|
updateSimpleMemoComponent(
|
|
current,
|
|
workInProgress,
|
|
type,
|
|
nextProps,
|
|
renderLanes
|
|
)
|
|
);
|
|
current = createFiberFromTypeAndProps(
|
|
Component.type,
|
|
null,
|
|
nextProps,
|
|
workInProgress,
|
|
workInProgress.mode,
|
|
renderLanes
|
|
);
|
|
current.ref = workInProgress.ref;
|
|
current.return = workInProgress;
|
|
return (workInProgress.child = current);
|
|
}
|
|
type = current.child;
|
|
if (0 === (current.lanes & renderLanes)) {
|
|
var prevProps = type.memoizedProps;
|
|
Component = Component.compare;
|
|
Component = null !== Component ? Component : shallowEqual;
|
|
if (Component(prevProps, nextProps) && current.ref === workInProgress.ref)
|
|
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
|
}
|
|
workInProgress.flags |= 1;
|
|
current = createWorkInProgress(type, nextProps);
|
|
current.ref = workInProgress.ref;
|
|
current.return = workInProgress;
|
|
return (workInProgress.child = current);
|
|
}
|
|
function updateSimpleMemoComponent(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
renderLanes
|
|
) {
|
|
if (null !== current) {
|
|
var prevProps = current.memoizedProps;
|
|
if (
|
|
shallowEqual(prevProps, nextProps) &&
|
|
current.ref === workInProgress.ref
|
|
)
|
|
if (
|
|
((didReceiveUpdate = !1),
|
|
(workInProgress.pendingProps = nextProps = prevProps),
|
|
0 !== (current.lanes & renderLanes))
|
|
)
|
|
0 !== (current.flags & 131072) && (didReceiveUpdate = !0);
|
|
else
|
|
return (
|
|
(workInProgress.lanes = current.lanes),
|
|
bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes)
|
|
);
|
|
}
|
|
return updateFunctionComponent(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
renderLanes
|
|
);
|
|
}
|
|
function updateOffscreenComponent(current, workInProgress, renderLanes) {
|
|
var nextProps = workInProgress.pendingProps,
|
|
nextChildren = nextProps.children,
|
|
nextIsDetached = 0 !== (workInProgress.stateNode._pendingVisibility & 2),
|
|
prevState = null !== current ? current.memoizedState : null;
|
|
markRef(current, workInProgress);
|
|
if ("hidden" === nextProps.mode || nextIsDetached) {
|
|
if (0 !== (workInProgress.flags & 128)) {
|
|
renderLanes =
|
|
null !== prevState ? prevState.baseLanes | renderLanes : renderLanes;
|
|
if (null !== current) {
|
|
nextProps = workInProgress.child = current.child;
|
|
for (nextChildren = 0; null !== nextProps; )
|
|
(nextChildren =
|
|
nextChildren | nextProps.lanes | nextProps.childLanes),
|
|
(nextProps = nextProps.sibling);
|
|
workInProgress.childLanes = nextChildren & ~renderLanes;
|
|
} else (workInProgress.childLanes = 0), (workInProgress.child = null);
|
|
return deferHiddenOffscreenComponent(
|
|
current,
|
|
workInProgress,
|
|
renderLanes
|
|
);
|
|
}
|
|
if (0 === (workInProgress.mode & 1))
|
|
(workInProgress.memoizedState = { baseLanes: 0, cachePool: null }),
|
|
reuseHiddenContextOnStack();
|
|
else {
|
|
if (0 === (renderLanes & 536870912))
|
|
return (
|
|
(workInProgress.lanes = workInProgress.childLanes = 536870912),
|
|
deferHiddenOffscreenComponent(
|
|
current,
|
|
workInProgress,
|
|
null !== prevState ? prevState.baseLanes | renderLanes : renderLanes
|
|
)
|
|
);
|
|
workInProgress.memoizedState = { baseLanes: 0, cachePool: null };
|
|
null !== prevState
|
|
? pushHiddenContext(workInProgress, prevState)
|
|
: reuseHiddenContextOnStack();
|
|
}
|
|
pushOffscreenSuspenseHandler(workInProgress);
|
|
} else
|
|
null !== prevState
|
|
? (pushHiddenContext(workInProgress, prevState),
|
|
reuseSuspenseHandlerOnStack(workInProgress),
|
|
(workInProgress.memoizedState = null))
|
|
: (reuseHiddenContextOnStack(),
|
|
reuseSuspenseHandlerOnStack(workInProgress));
|
|
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
|
|
return workInProgress.child;
|
|
}
|
|
function deferHiddenOffscreenComponent(current, workInProgress, nextBaseLanes) {
|
|
workInProgress.memoizedState = { baseLanes: nextBaseLanes, cachePool: null };
|
|
reuseHiddenContextOnStack();
|
|
pushOffscreenSuspenseHandler(workInProgress);
|
|
return null;
|
|
}
|
|
function markRef(current, workInProgress) {
|
|
var ref = workInProgress.ref;
|
|
if (null === ref)
|
|
null !== current &&
|
|
null !== current.ref &&
|
|
(workInProgress.flags |= 2097664);
|
|
else {
|
|
if ("function" !== typeof ref && "object" !== typeof ref)
|
|
throw Error(
|
|
"Expected ref to be a function, an object returned by React.createRef(), or undefined/null."
|
|
);
|
|
if (null === current || current.ref !== ref)
|
|
workInProgress.flags |= 2097664;
|
|
}
|
|
}
|
|
function updateFunctionComponent(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
renderLanes
|
|
) {
|
|
prepareToReadContext(workInProgress, renderLanes);
|
|
Component = renderWithHooks(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
void 0,
|
|
renderLanes
|
|
);
|
|
if (null !== current && !didReceiveUpdate)
|
|
return (
|
|
bailoutHooks(current, workInProgress, renderLanes),
|
|
bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes)
|
|
);
|
|
workInProgress.flags |= 1;
|
|
reconcileChildren(current, workInProgress, Component, renderLanes);
|
|
return workInProgress.child;
|
|
}
|
|
function replayFunctionComponent(
|
|
current,
|
|
workInProgress,
|
|
nextProps,
|
|
Component,
|
|
secondArg,
|
|
renderLanes
|
|
) {
|
|
prepareToReadContext(workInProgress, renderLanes);
|
|
nextProps = renderWithHooksAgain(
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
secondArg
|
|
);
|
|
finishRenderingHooks();
|
|
if (null !== current && !didReceiveUpdate)
|
|
return (
|
|
bailoutHooks(current, workInProgress, renderLanes),
|
|
bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes)
|
|
);
|
|
workInProgress.flags |= 1;
|
|
reconcileChildren(current, workInProgress, nextProps, renderLanes);
|
|
return workInProgress.child;
|
|
}
|
|
function updateClassComponent(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
renderLanes
|
|
) {
|
|
prepareToReadContext(workInProgress, renderLanes);
|
|
if (null === workInProgress.stateNode)
|
|
resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress),
|
|
constructClassInstance(workInProgress, Component, nextProps),
|
|
mountClassInstance(workInProgress, Component, nextProps, renderLanes),
|
|
(nextProps = !0);
|
|
else if (null === current) {
|
|
var instance = workInProgress.stateNode,
|
|
oldProps = workInProgress.memoizedProps;
|
|
instance.props = oldProps;
|
|
var oldContext = instance.context,
|
|
contextType = Component.contextType,
|
|
nextContext = emptyContextObject;
|
|
"object" === typeof contextType &&
|
|
null !== contextType &&
|
|
(nextContext = readContext(contextType));
|
|
var getDerivedStateFromProps = Component.getDerivedStateFromProps;
|
|
(contextType =
|
|
"function" === typeof getDerivedStateFromProps ||
|
|
"function" === typeof instance.getSnapshotBeforeUpdate) ||
|
|
("function" !== typeof instance.UNSAFE_componentWillReceiveProps &&
|
|
"function" !== typeof instance.componentWillReceiveProps) ||
|
|
((oldProps !== nextProps || oldContext !== nextContext) &&
|
|
callComponentWillReceiveProps(
|
|
workInProgress,
|
|
instance,
|
|
nextProps,
|
|
nextContext
|
|
));
|
|
hasForceUpdate = !1;
|
|
var oldState = workInProgress.memoizedState;
|
|
instance.state = oldState;
|
|
processUpdateQueue(workInProgress, nextProps, instance, renderLanes);
|
|
oldContext = workInProgress.memoizedState;
|
|
oldProps !== nextProps || oldState !== oldContext || hasForceUpdate
|
|
? ("function" === typeof getDerivedStateFromProps &&
|
|
(applyDerivedStateFromProps(
|
|
workInProgress,
|
|
Component,
|
|
getDerivedStateFromProps,
|
|
nextProps
|
|
),
|
|
(oldContext = workInProgress.memoizedState)),
|
|
(oldProps =
|
|
hasForceUpdate ||
|
|
checkShouldComponentUpdate(
|
|
workInProgress,
|
|
Component,
|
|
oldProps,
|
|
nextProps,
|
|
oldState,
|
|
oldContext,
|
|
nextContext
|
|
))
|
|
? (contextType ||
|
|
("function" !== typeof instance.UNSAFE_componentWillMount &&
|
|
"function" !== typeof instance.componentWillMount) ||
|
|
("function" === typeof instance.componentWillMount &&
|
|
instance.componentWillMount(),
|
|
"function" === typeof instance.UNSAFE_componentWillMount &&
|
|
instance.UNSAFE_componentWillMount()),
|
|
"function" === typeof instance.componentDidMount &&
|
|
(workInProgress.flags |= 4194308))
|
|
: ("function" === typeof instance.componentDidMount &&
|
|
(workInProgress.flags |= 4194308),
|
|
(workInProgress.memoizedProps = nextProps),
|
|
(workInProgress.memoizedState = oldContext)),
|
|
(instance.props = nextProps),
|
|
(instance.state = oldContext),
|
|
(instance.context = nextContext),
|
|
(nextProps = oldProps))
|
|
: ("function" === typeof instance.componentDidMount &&
|
|
(workInProgress.flags |= 4194308),
|
|
(nextProps = !1));
|
|
} else {
|
|
instance = workInProgress.stateNode;
|
|
cloneUpdateQueue(current, workInProgress);
|
|
nextContext = workInProgress.memoizedProps;
|
|
contextType =
|
|
workInProgress.type === workInProgress.elementType
|
|
? nextContext
|
|
: resolveDefaultProps(workInProgress.type, nextContext);
|
|
instance.props = contextType;
|
|
getDerivedStateFromProps = workInProgress.pendingProps;
|
|
var oldContext$jscomp$0 = instance.context;
|
|
oldContext = Component.contextType;
|
|
oldProps = emptyContextObject;
|
|
"object" === typeof oldContext &&
|
|
null !== oldContext &&
|
|
(oldProps = readContext(oldContext));
|
|
oldState = Component.getDerivedStateFromProps;
|
|
(oldContext =
|
|
"function" === typeof oldState ||
|
|
"function" === typeof instance.getSnapshotBeforeUpdate) ||
|
|
("function" !== typeof instance.UNSAFE_componentWillReceiveProps &&
|
|
"function" !== typeof instance.componentWillReceiveProps) ||
|
|
((nextContext !== getDerivedStateFromProps ||
|
|
oldContext$jscomp$0 !== oldProps) &&
|
|
callComponentWillReceiveProps(
|
|
workInProgress,
|
|
instance,
|
|
nextProps,
|
|
oldProps
|
|
));
|
|
hasForceUpdate = !1;
|
|
oldContext$jscomp$0 = workInProgress.memoizedState;
|
|
instance.state = oldContext$jscomp$0;
|
|
processUpdateQueue(workInProgress, nextProps, instance, renderLanes);
|
|
var newState = workInProgress.memoizedState;
|
|
nextContext !== getDerivedStateFromProps ||
|
|
oldContext$jscomp$0 !== newState ||
|
|
hasForceUpdate
|
|
? ("function" === typeof oldState &&
|
|
(applyDerivedStateFromProps(
|
|
workInProgress,
|
|
Component,
|
|
oldState,
|
|
nextProps
|
|
),
|
|
(newState = workInProgress.memoizedState)),
|
|
(contextType =
|
|
hasForceUpdate ||
|
|
checkShouldComponentUpdate(
|
|
workInProgress,
|
|
Component,
|
|
contextType,
|
|
nextProps,
|
|
oldContext$jscomp$0,
|
|
newState,
|
|
oldProps
|
|
) ||
|
|
!1)
|
|
? (oldContext ||
|
|
("function" !== typeof instance.UNSAFE_componentWillUpdate &&
|
|
"function" !== typeof instance.componentWillUpdate) ||
|
|
("function" === typeof instance.componentWillUpdate &&
|
|
instance.componentWillUpdate(nextProps, newState, oldProps),
|
|
"function" === typeof instance.UNSAFE_componentWillUpdate &&
|
|
instance.UNSAFE_componentWillUpdate(
|
|
nextProps,
|
|
newState,
|
|
oldProps
|
|
)),
|
|
"function" === typeof instance.componentDidUpdate &&
|
|
(workInProgress.flags |= 4),
|
|
"function" === typeof instance.getSnapshotBeforeUpdate &&
|
|
(workInProgress.flags |= 1024))
|
|
: ("function" !== typeof instance.componentDidUpdate ||
|
|
(nextContext === current.memoizedProps &&
|
|
oldContext$jscomp$0 === current.memoizedState) ||
|
|
(workInProgress.flags |= 4),
|
|
"function" !== typeof instance.getSnapshotBeforeUpdate ||
|
|
(nextContext === current.memoizedProps &&
|
|
oldContext$jscomp$0 === current.memoizedState) ||
|
|
(workInProgress.flags |= 1024),
|
|
(workInProgress.memoizedProps = nextProps),
|
|
(workInProgress.memoizedState = newState)),
|
|
(instance.props = nextProps),
|
|
(instance.state = newState),
|
|
(instance.context = oldProps),
|
|
(nextProps = contextType))
|
|
: ("function" !== typeof instance.componentDidUpdate ||
|
|
(nextContext === current.memoizedProps &&
|
|
oldContext$jscomp$0 === current.memoizedState) ||
|
|
(workInProgress.flags |= 4),
|
|
"function" !== typeof instance.getSnapshotBeforeUpdate ||
|
|
(nextContext === current.memoizedProps &&
|
|
oldContext$jscomp$0 === current.memoizedState) ||
|
|
(workInProgress.flags |= 1024),
|
|
(nextProps = !1));
|
|
}
|
|
return finishClassComponent(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
nextProps,
|
|
!1,
|
|
renderLanes
|
|
);
|
|
}
|
|
function finishClassComponent(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
shouldUpdate,
|
|
hasContext,
|
|
renderLanes
|
|
) {
|
|
markRef(current, workInProgress);
|
|
hasContext = 0 !== (workInProgress.flags & 128);
|
|
if (!shouldUpdate && !hasContext)
|
|
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
|
shouldUpdate = workInProgress.stateNode;
|
|
ReactCurrentOwner$1.current = workInProgress;
|
|
Component =
|
|
hasContext && "function" !== typeof Component.getDerivedStateFromError
|
|
? null
|
|
: shouldUpdate.render();
|
|
workInProgress.flags |= 1;
|
|
null !== current && hasContext
|
|
? ((workInProgress.child = reconcileChildFibers(
|
|
workInProgress,
|
|
current.child,
|
|
null,
|
|
renderLanes
|
|
)),
|
|
(workInProgress.child = reconcileChildFibers(
|
|
workInProgress,
|
|
null,
|
|
Component,
|
|
renderLanes
|
|
)))
|
|
: reconcileChildren(current, workInProgress, Component, renderLanes);
|
|
workInProgress.memoizedState = shouldUpdate.state;
|
|
return workInProgress.child;
|
|
}
|
|
var SUSPENDED_MARKER = { dehydrated: null, treeContext: null, retryLane: 0 };
|
|
function mountSuspenseOffscreenState(renderLanes) {
|
|
return { baseLanes: renderLanes, cachePool: null };
|
|
}
|
|
function getRemainingWorkInPrimaryTree(
|
|
current,
|
|
primaryTreeDidDefer,
|
|
renderLanes
|
|
) {
|
|
current = null !== current ? current.childLanes & ~renderLanes : 0;
|
|
primaryTreeDidDefer && (current |= workInProgressDeferredLane);
|
|
return current;
|
|
}
|
|
function updateSuspenseComponent(current, workInProgress, renderLanes) {
|
|
var nextProps = workInProgress.pendingProps,
|
|
showFallback = !1,
|
|
didSuspend = 0 !== (workInProgress.flags & 128),
|
|
JSCompiler_temp;
|
|
(JSCompiler_temp = didSuspend) ||
|
|
(JSCompiler_temp =
|
|
null !== current && null === current.memoizedState
|
|
? !1
|
|
: 0 !== (suspenseStackCursor.current & 2));
|
|
JSCompiler_temp && ((showFallback = !0), (workInProgress.flags &= -129));
|
|
JSCompiler_temp = 0 !== (workInProgress.flags & 32);
|
|
workInProgress.flags &= -33;
|
|
if (null === current) {
|
|
didSuspend = nextProps.children;
|
|
nextProps = nextProps.fallback;
|
|
if (showFallback) {
|
|
reuseSuspenseHandlerOnStack(workInProgress);
|
|
showFallback = workInProgress.mode;
|
|
var progressedPrimaryFragment = workInProgress.child;
|
|
didSuspend = { mode: "hidden", children: didSuspend };
|
|
0 === (showFallback & 1) && null !== progressedPrimaryFragment
|
|
? ((progressedPrimaryFragment.childLanes = 0),
|
|
(progressedPrimaryFragment.pendingProps = didSuspend))
|
|
: (progressedPrimaryFragment = createFiberFromOffscreen(
|
|
didSuspend,
|
|
showFallback,
|
|
0,
|
|
null
|
|
));
|
|
nextProps = createFiberFromFragment(
|
|
nextProps,
|
|
showFallback,
|
|
renderLanes,
|
|
null
|
|
);
|
|
progressedPrimaryFragment.return = workInProgress;
|
|
nextProps.return = workInProgress;
|
|
progressedPrimaryFragment.sibling = nextProps;
|
|
workInProgress.child = progressedPrimaryFragment;
|
|
showFallback = workInProgress.child;
|
|
showFallback.memoizedState = mountSuspenseOffscreenState(renderLanes);
|
|
showFallback.childLanes = getRemainingWorkInPrimaryTree(
|
|
current,
|
|
JSCompiler_temp,
|
|
renderLanes
|
|
);
|
|
workInProgress.memoizedState = SUSPENDED_MARKER;
|
|
return nextProps;
|
|
}
|
|
pushPrimaryTreeSuspenseHandler(workInProgress);
|
|
return mountSuspensePrimaryChildren(workInProgress, didSuspend);
|
|
}
|
|
progressedPrimaryFragment = current.memoizedState;
|
|
if (null !== progressedPrimaryFragment) {
|
|
var dehydrated = progressedPrimaryFragment.dehydrated;
|
|
if (null !== dehydrated)
|
|
return updateDehydratedSuspenseComponent(
|
|
current,
|
|
workInProgress,
|
|
didSuspend,
|
|
JSCompiler_temp,
|
|
nextProps,
|
|
dehydrated,
|
|
progressedPrimaryFragment,
|
|
renderLanes
|
|
);
|
|
}
|
|
if (showFallback) {
|
|
reuseSuspenseHandlerOnStack(workInProgress);
|
|
showFallback = nextProps.fallback;
|
|
didSuspend = workInProgress.mode;
|
|
progressedPrimaryFragment = current.child;
|
|
dehydrated = progressedPrimaryFragment.sibling;
|
|
var primaryChildProps = { mode: "hidden", children: nextProps.children };
|
|
0 === (didSuspend & 1) && workInProgress.child !== progressedPrimaryFragment
|
|
? ((nextProps = workInProgress.child),
|
|
(nextProps.childLanes = 0),
|
|
(nextProps.pendingProps = primaryChildProps),
|
|
(workInProgress.deletions = null))
|
|
: ((nextProps = createWorkInProgress(
|
|
progressedPrimaryFragment,
|
|
primaryChildProps
|
|
)),
|
|
(nextProps.subtreeFlags =
|
|
progressedPrimaryFragment.subtreeFlags & 31457280));
|
|
null !== dehydrated
|
|
? (showFallback = createWorkInProgress(dehydrated, showFallback))
|
|
: ((showFallback = createFiberFromFragment(
|
|
showFallback,
|
|
didSuspend,
|
|
renderLanes,
|
|
null
|
|
)),
|
|
(showFallback.flags |= 2));
|
|
showFallback.return = workInProgress;
|
|
nextProps.return = workInProgress;
|
|
nextProps.sibling = showFallback;
|
|
workInProgress.child = nextProps;
|
|
nextProps = showFallback;
|
|
showFallback = workInProgress.child;
|
|
didSuspend = current.child.memoizedState;
|
|
didSuspend =
|
|
null === didSuspend
|
|
? mountSuspenseOffscreenState(renderLanes)
|
|
: { baseLanes: didSuspend.baseLanes | renderLanes, cachePool: null };
|
|
showFallback.memoizedState = didSuspend;
|
|
showFallback.childLanes = getRemainingWorkInPrimaryTree(
|
|
current,
|
|
JSCompiler_temp,
|
|
renderLanes
|
|
);
|
|
workInProgress.memoizedState = SUSPENDED_MARKER;
|
|
return nextProps;
|
|
}
|
|
pushPrimaryTreeSuspenseHandler(workInProgress);
|
|
JSCompiler_temp = current.child;
|
|
current = JSCompiler_temp.sibling;
|
|
JSCompiler_temp = createWorkInProgress(JSCompiler_temp, {
|
|
mode: "visible",
|
|
children: nextProps.children
|
|
});
|
|
0 === (workInProgress.mode & 1) && (JSCompiler_temp.lanes = renderLanes);
|
|
JSCompiler_temp.return = workInProgress;
|
|
JSCompiler_temp.sibling = null;
|
|
null !== current &&
|
|
((renderLanes = workInProgress.deletions),
|
|
null === renderLanes
|
|
? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16))
|
|
: renderLanes.push(current));
|
|
workInProgress.child = JSCompiler_temp;
|
|
workInProgress.memoizedState = null;
|
|
return JSCompiler_temp;
|
|
}
|
|
function mountSuspensePrimaryChildren(workInProgress, primaryChildren) {
|
|
primaryChildren = createFiberFromOffscreen(
|
|
{ mode: "visible", children: primaryChildren },
|
|
workInProgress.mode,
|
|
0,
|
|
null
|
|
);
|
|
primaryChildren.return = workInProgress;
|
|
return (workInProgress.child = primaryChildren);
|
|
}
|
|
function retrySuspenseComponentWithoutHydrating(
|
|
current,
|
|
workInProgress,
|
|
renderLanes,
|
|
recoverableError
|
|
) {
|
|
null !== recoverableError &&
|
|
(null === hydrationErrors
|
|
? (hydrationErrors = [recoverableError])
|
|
: hydrationErrors.push(recoverableError));
|
|
reconcileChildFibers(workInProgress, current.child, null, renderLanes);
|
|
current = mountSuspensePrimaryChildren(
|
|
workInProgress,
|
|
workInProgress.pendingProps.children
|
|
);
|
|
current.flags |= 2;
|
|
workInProgress.memoizedState = null;
|
|
return current;
|
|
}
|
|
function updateDehydratedSuspenseComponent(
|
|
current,
|
|
workInProgress,
|
|
didSuspend,
|
|
didPrimaryChildrenDefer,
|
|
nextProps,
|
|
suspenseInstance,
|
|
suspenseState,
|
|
renderLanes
|
|
) {
|
|
if (didSuspend) {
|
|
if (workInProgress.flags & 256)
|
|
return (
|
|
pushPrimaryTreeSuspenseHandler(workInProgress),
|
|
(workInProgress.flags &= -257),
|
|
(didPrimaryChildrenDefer = createCapturedValueFromError(
|
|
Error(
|
|
"There was an error while hydrating this Suspense boundary. Switched to client rendering."
|
|
)
|
|
)),
|
|
retrySuspenseComponentWithoutHydrating(
|
|
current,
|
|
workInProgress,
|
|
renderLanes,
|
|
didPrimaryChildrenDefer
|
|
)
|
|
);
|
|
if (null !== workInProgress.memoizedState)
|
|
return (
|
|
reuseSuspenseHandlerOnStack(workInProgress),
|
|
(workInProgress.child = current.child),
|
|
(workInProgress.flags |= 128),
|
|
null
|
|
);
|
|
reuseSuspenseHandlerOnStack(workInProgress);
|
|
suspenseState = nextProps.fallback;
|
|
didSuspend = workInProgress.mode;
|
|
nextProps = createFiberFromOffscreen(
|
|
{ mode: "visible", children: nextProps.children },
|
|
didSuspend,
|
|
0,
|
|
null
|
|
);
|
|
suspenseState = createFiberFromFragment(
|
|
suspenseState,
|
|
didSuspend,
|
|
renderLanes,
|
|
null
|
|
);
|
|
suspenseState.flags |= 2;
|
|
nextProps.return = workInProgress;
|
|
suspenseState.return = workInProgress;
|
|
nextProps.sibling = suspenseState;
|
|
workInProgress.child = nextProps;
|
|
0 !== (workInProgress.mode & 1) &&
|
|
reconcileChildFibers(workInProgress, current.child, null, renderLanes);
|
|
nextProps = workInProgress.child;
|
|
nextProps.memoizedState = mountSuspenseOffscreenState(renderLanes);
|
|
nextProps.childLanes = getRemainingWorkInPrimaryTree(
|
|
current,
|
|
didPrimaryChildrenDefer,
|
|
renderLanes
|
|
);
|
|
workInProgress.memoizedState = SUSPENDED_MARKER;
|
|
return suspenseState;
|
|
}
|
|
pushPrimaryTreeSuspenseHandler(workInProgress);
|
|
if (0 === (workInProgress.mode & 1))
|
|
return retrySuspenseComponentWithoutHydrating(
|
|
current,
|
|
workInProgress,
|
|
renderLanes,
|
|
null
|
|
);
|
|
if (shim$1())
|
|
return (
|
|
(didPrimaryChildrenDefer = shim$1().digest),
|
|
(suspenseState = Error(
|
|
"The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering."
|
|
)),
|
|
(suspenseState.digest = didPrimaryChildrenDefer),
|
|
(didPrimaryChildrenDefer = createCapturedValueFromError(
|
|
suspenseState,
|
|
didPrimaryChildrenDefer,
|
|
void 0
|
|
)),
|
|
retrySuspenseComponentWithoutHydrating(
|
|
current,
|
|
workInProgress,
|
|
renderLanes,
|
|
didPrimaryChildrenDefer
|
|
)
|
|
);
|
|
didPrimaryChildrenDefer = 0 !== (renderLanes & current.childLanes);
|
|
if (didReceiveUpdate || didPrimaryChildrenDefer) {
|
|
didPrimaryChildrenDefer = workInProgressRoot;
|
|
if (null !== didPrimaryChildrenDefer) {
|
|
nextProps = renderLanes & -renderLanes;
|
|
if (0 !== (nextProps & 42)) nextProps = 1;
|
|
else
|
|
switch (nextProps) {
|
|
case 2:
|
|
nextProps = 1;
|
|
break;
|
|
case 8:
|
|
nextProps = 4;
|
|
break;
|
|
case 32:
|
|
nextProps = 16;
|
|
break;
|
|
case 128:
|
|
case 256:
|
|
case 512:
|
|
case 1024:
|
|
case 2048:
|
|
case 4096:
|
|
case 8192:
|
|
case 16384:
|
|
case 32768:
|
|
case 65536:
|
|
case 131072:
|
|
case 262144:
|
|
case 524288:
|
|
case 1048576:
|
|
case 2097152:
|
|
case 4194304:
|
|
case 8388608:
|
|
case 16777216:
|
|
case 33554432:
|
|
nextProps = 64;
|
|
break;
|
|
case 268435456:
|
|
nextProps = 134217728;
|
|
break;
|
|
default:
|
|
nextProps = 0;
|
|
}
|
|
nextProps =
|
|
0 !==
|
|
(nextProps & (didPrimaryChildrenDefer.suspendedLanes | renderLanes))
|
|
? 0
|
|
: nextProps;
|
|
if (0 !== nextProps && nextProps !== suspenseState.retryLane)
|
|
throw (
|
|
((suspenseState.retryLane = nextProps),
|
|
enqueueConcurrentRenderForLane(current, nextProps),
|
|
scheduleUpdateOnFiber(didPrimaryChildrenDefer, current, nextProps),
|
|
SelectiveHydrationException)
|
|
);
|
|
}
|
|
shim$1() || renderDidSuspendDelayIfPossible();
|
|
return retrySuspenseComponentWithoutHydrating(
|
|
current,
|
|
workInProgress,
|
|
renderLanes,
|
|
null
|
|
);
|
|
}
|
|
if (shim$1())
|
|
return (
|
|
(workInProgress.flags |= 128),
|
|
(workInProgress.child = current.child),
|
|
retryDehydratedSuspenseBoundary.bind(null, current),
|
|
shim$1(),
|
|
null
|
|
);
|
|
current = mountSuspensePrimaryChildren(workInProgress, nextProps.children);
|
|
current.flags |= 4096;
|
|
return current;
|
|
}
|
|
function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) {
|
|
fiber.lanes |= renderLanes;
|
|
var alternate = fiber.alternate;
|
|
null !== alternate && (alternate.lanes |= renderLanes);
|
|
scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot);
|
|
}
|
|
function initSuspenseListRenderState(
|
|
workInProgress,
|
|
isBackwards,
|
|
tail,
|
|
lastContentRow,
|
|
tailMode
|
|
) {
|
|
var renderState = workInProgress.memoizedState;
|
|
null === renderState
|
|
? (workInProgress.memoizedState = {
|
|
isBackwards: isBackwards,
|
|
rendering: null,
|
|
renderingStartTime: 0,
|
|
last: lastContentRow,
|
|
tail: tail,
|
|
tailMode: tailMode
|
|
})
|
|
: ((renderState.isBackwards = isBackwards),
|
|
(renderState.rendering = null),
|
|
(renderState.renderingStartTime = 0),
|
|
(renderState.last = lastContentRow),
|
|
(renderState.tail = tail),
|
|
(renderState.tailMode = tailMode));
|
|
}
|
|
function updateSuspenseListComponent(current, workInProgress, renderLanes) {
|
|
var nextProps = workInProgress.pendingProps,
|
|
revealOrder = nextProps.revealOrder,
|
|
tailMode = nextProps.tail;
|
|
reconcileChildren(current, workInProgress, nextProps.children, renderLanes);
|
|
nextProps = suspenseStackCursor.current;
|
|
if (0 !== (nextProps & 2))
|
|
(nextProps = (nextProps & 1) | 2), (workInProgress.flags |= 128);
|
|
else {
|
|
if (null !== current && 0 !== (current.flags & 128))
|
|
a: for (current = workInProgress.child; null !== current; ) {
|
|
if (13 === current.tag)
|
|
null !== current.memoizedState &&
|
|
scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress);
|
|
else if (19 === current.tag)
|
|
scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress);
|
|
else if (null !== current.child) {
|
|
current.child.return = current;
|
|
current = current.child;
|
|
continue;
|
|
}
|
|
if (current === workInProgress) break a;
|
|
for (; null === current.sibling; ) {
|
|
if (null === current.return || current.return === workInProgress)
|
|
break a;
|
|
current = current.return;
|
|
}
|
|
current.sibling.return = current.return;
|
|
current = current.sibling;
|
|
}
|
|
nextProps &= 1;
|
|
}
|
|
push(suspenseStackCursor, nextProps);
|
|
if (0 === (workInProgress.mode & 1)) workInProgress.memoizedState = null;
|
|
else
|
|
switch (revealOrder) {
|
|
case "forwards":
|
|
renderLanes = workInProgress.child;
|
|
for (revealOrder = null; null !== renderLanes; )
|
|
(current = renderLanes.alternate),
|
|
null !== current &&
|
|
null === findFirstSuspended(current) &&
|
|
(revealOrder = renderLanes),
|
|
(renderLanes = renderLanes.sibling);
|
|
renderLanes = revealOrder;
|
|
null === renderLanes
|
|
? ((revealOrder = workInProgress.child),
|
|
(workInProgress.child = null))
|
|
: ((revealOrder = renderLanes.sibling), (renderLanes.sibling = null));
|
|
initSuspenseListRenderState(
|
|
workInProgress,
|
|
!1,
|
|
revealOrder,
|
|
renderLanes,
|
|
tailMode
|
|
);
|
|
break;
|
|
case "backwards":
|
|
renderLanes = null;
|
|
revealOrder = workInProgress.child;
|
|
for (workInProgress.child = null; null !== revealOrder; ) {
|
|
current = revealOrder.alternate;
|
|
if (null !== current && null === findFirstSuspended(current)) {
|
|
workInProgress.child = revealOrder;
|
|
break;
|
|
}
|
|
current = revealOrder.sibling;
|
|
revealOrder.sibling = renderLanes;
|
|
renderLanes = revealOrder;
|
|
revealOrder = current;
|
|
}
|
|
initSuspenseListRenderState(
|
|
workInProgress,
|
|
!0,
|
|
renderLanes,
|
|
null,
|
|
tailMode
|
|
);
|
|
break;
|
|
case "together":
|
|
initSuspenseListRenderState(workInProgress, !1, null, null, void 0);
|
|
break;
|
|
default:
|
|
workInProgress.memoizedState = null;
|
|
}
|
|
return workInProgress.child;
|
|
}
|
|
function resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress) {
|
|
0 === (workInProgress.mode & 1) &&
|
|
null !== current &&
|
|
((current.alternate = null),
|
|
(workInProgress.alternate = null),
|
|
(workInProgress.flags |= 2));
|
|
}
|
|
function bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) {
|
|
null !== current && (workInProgress.dependencies = current.dependencies);
|
|
workInProgressRootSkippedLanes |= workInProgress.lanes;
|
|
if (0 === (renderLanes & workInProgress.childLanes)) return null;
|
|
if (null !== current && workInProgress.child !== current.child)
|
|
throw Error("Resuming work not yet implemented.");
|
|
if (null !== workInProgress.child) {
|
|
current = workInProgress.child;
|
|
renderLanes = createWorkInProgress(current, current.pendingProps);
|
|
workInProgress.child = renderLanes;
|
|
for (renderLanes.return = workInProgress; null !== current.sibling; )
|
|
(current = current.sibling),
|
|
(renderLanes = renderLanes.sibling =
|
|
createWorkInProgress(current, current.pendingProps)),
|
|
(renderLanes.return = workInProgress);
|
|
renderLanes.sibling = null;
|
|
}
|
|
return workInProgress.child;
|
|
}
|
|
function attemptEarlyBailoutIfNoScheduledUpdate(
|
|
current,
|
|
workInProgress,
|
|
renderLanes
|
|
) {
|
|
switch (workInProgress.tag) {
|
|
case 3:
|
|
pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
|
break;
|
|
case 27:
|
|
case 5:
|
|
pushHostContext(workInProgress);
|
|
break;
|
|
case 4:
|
|
pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
|
break;
|
|
case 10:
|
|
var newValue = workInProgress.memoizedProps.value,
|
|
context = workInProgress.type._context;
|
|
push(valueCursor, context._currentValue);
|
|
context._currentValue = newValue;
|
|
break;
|
|
case 13:
|
|
newValue = workInProgress.memoizedState;
|
|
if (null !== newValue) {
|
|
if (null !== newValue.dehydrated)
|
|
return (
|
|
pushPrimaryTreeSuspenseHandler(workInProgress),
|
|
(workInProgress.flags |= 128),
|
|
null
|
|
);
|
|
if (0 !== (renderLanes & workInProgress.child.childLanes))
|
|
return updateSuspenseComponent(current, workInProgress, renderLanes);
|
|
pushPrimaryTreeSuspenseHandler(workInProgress);
|
|
current = bailoutOnAlreadyFinishedWork(
|
|
current,
|
|
workInProgress,
|
|
renderLanes
|
|
);
|
|
return null !== current ? current.sibling : null;
|
|
}
|
|
pushPrimaryTreeSuspenseHandler(workInProgress);
|
|
break;
|
|
case 19:
|
|
newValue = 0 !== (renderLanes & workInProgress.childLanes);
|
|
if (0 !== (current.flags & 128)) {
|
|
if (newValue)
|
|
return updateSuspenseListComponent(
|
|
current,
|
|
workInProgress,
|
|
renderLanes
|
|
);
|
|
workInProgress.flags |= 128;
|
|
}
|
|
context = workInProgress.memoizedState;
|
|
null !== context &&
|
|
((context.rendering = null),
|
|
(context.tail = null),
|
|
(context.lastEffect = null));
|
|
push(suspenseStackCursor, suspenseStackCursor.current);
|
|
if (newValue) break;
|
|
else return null;
|
|
case 22:
|
|
case 23:
|
|
return (
|
|
(workInProgress.lanes = 0),
|
|
updateOffscreenComponent(current, workInProgress, renderLanes)
|
|
);
|
|
}
|
|
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
|
|
}
|
|
function beginWork(current, workInProgress, renderLanes) {
|
|
if (null !== current)
|
|
if (current.memoizedProps !== workInProgress.pendingProps)
|
|
didReceiveUpdate = !0;
|
|
else {
|
|
if (
|
|
0 === (current.lanes & renderLanes) &&
|
|
0 === (workInProgress.flags & 128)
|
|
)
|
|
return (
|
|
(didReceiveUpdate = !1),
|
|
attemptEarlyBailoutIfNoScheduledUpdate(
|
|
current,
|
|
workInProgress,
|
|
renderLanes
|
|
)
|
|
);
|
|
didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1;
|
|
}
|
|
else didReceiveUpdate = !1;
|
|
workInProgress.lanes = 0;
|
|
switch (workInProgress.tag) {
|
|
case 2:
|
|
var Component = workInProgress.type;
|
|
resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress);
|
|
current = workInProgress.pendingProps;
|
|
prepareToReadContext(workInProgress, renderLanes);
|
|
var value = renderWithHooks(
|
|
null,
|
|
workInProgress,
|
|
Component,
|
|
current,
|
|
void 0,
|
|
renderLanes
|
|
);
|
|
workInProgress.flags |= 1;
|
|
"object" === typeof value &&
|
|
null !== value &&
|
|
"function" === typeof value.render &&
|
|
void 0 === value.$$typeof
|
|
? ((workInProgress.tag = 1),
|
|
(workInProgress.memoizedState = null),
|
|
(workInProgress.updateQueue = null),
|
|
(workInProgress.memoizedState =
|
|
null !== value.state && void 0 !== value.state
|
|
? value.state
|
|
: null),
|
|
initializeUpdateQueue(workInProgress),
|
|
(value.updater = classComponentUpdater),
|
|
(workInProgress.stateNode = value),
|
|
(value._reactInternals = workInProgress),
|
|
mountClassInstance(workInProgress, Component, current, renderLanes),
|
|
(workInProgress = finishClassComponent(
|
|
null,
|
|
workInProgress,
|
|
Component,
|
|
!0,
|
|
!1,
|
|
renderLanes
|
|
)))
|
|
: ((workInProgress.tag = 0),
|
|
reconcileChildren(null, workInProgress, value, renderLanes),
|
|
(workInProgress = workInProgress.child));
|
|
return workInProgress;
|
|
case 16:
|
|
Component = workInProgress.elementType;
|
|
a: {
|
|
resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress);
|
|
current = workInProgress.pendingProps;
|
|
value = Component._init;
|
|
Component = value(Component._payload);
|
|
workInProgress.type = Component;
|
|
value = workInProgress.tag = resolveLazyComponentTag(Component);
|
|
current = resolveDefaultProps(Component, current);
|
|
switch (value) {
|
|
case 0:
|
|
workInProgress = updateFunctionComponent(
|
|
null,
|
|
workInProgress,
|
|
Component,
|
|
current,
|
|
renderLanes
|
|
);
|
|
break a;
|
|
case 1:
|
|
workInProgress = updateClassComponent(
|
|
null,
|
|
workInProgress,
|
|
Component,
|
|
current,
|
|
renderLanes
|
|
);
|
|
break a;
|
|
case 11:
|
|
workInProgress = updateForwardRef(
|
|
null,
|
|
workInProgress,
|
|
Component,
|
|
current,
|
|
renderLanes
|
|
);
|
|
break a;
|
|
case 14:
|
|
workInProgress = updateMemoComponent(
|
|
null,
|
|
workInProgress,
|
|
Component,
|
|
resolveDefaultProps(Component.type, current),
|
|
renderLanes
|
|
);
|
|
break a;
|
|
}
|
|
throw Error(
|
|
"Element type is invalid. Received a promise that resolves to: " +
|
|
Component +
|
|
". Lazy element type must resolve to a class or function."
|
|
);
|
|
}
|
|
return workInProgress;
|
|
case 0:
|
|
return (
|
|
(Component = workInProgress.type),
|
|
(value = workInProgress.pendingProps),
|
|
(value =
|
|
workInProgress.elementType === Component
|
|
? value
|
|
: resolveDefaultProps(Component, value)),
|
|
updateFunctionComponent(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
value,
|
|
renderLanes
|
|
)
|
|
);
|
|
case 1:
|
|
return (
|
|
(Component = workInProgress.type),
|
|
(value = workInProgress.pendingProps),
|
|
(value =
|
|
workInProgress.elementType === Component
|
|
? value
|
|
: resolveDefaultProps(Component, value)),
|
|
updateClassComponent(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
value,
|
|
renderLanes
|
|
)
|
|
);
|
|
case 3:
|
|
pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);
|
|
if (null === current)
|
|
throw Error("Should have a current fiber. This is a bug in React.");
|
|
value = workInProgress.pendingProps;
|
|
Component = workInProgress.memoizedState.element;
|
|
cloneUpdateQueue(current, workInProgress);
|
|
processUpdateQueue(workInProgress, value, null, renderLanes);
|
|
value = workInProgress.memoizedState.element;
|
|
value === Component
|
|
? (workInProgress = bailoutOnAlreadyFinishedWork(
|
|
current,
|
|
workInProgress,
|
|
renderLanes
|
|
))
|
|
: (reconcileChildren(current, workInProgress, value, renderLanes),
|
|
(workInProgress = workInProgress.child));
|
|
return workInProgress;
|
|
case 26:
|
|
case 27:
|
|
case 5:
|
|
return (
|
|
pushHostContext(workInProgress),
|
|
(Component = workInProgress.pendingProps.children),
|
|
markRef(current, workInProgress),
|
|
reconcileChildren(current, workInProgress, Component, renderLanes),
|
|
workInProgress.child
|
|
);
|
|
case 6:
|
|
return null;
|
|
case 13:
|
|
return updateSuspenseComponent(current, workInProgress, renderLanes);
|
|
case 4:
|
|
return (
|
|
pushHostContainer(
|
|
workInProgress,
|
|
workInProgress.stateNode.containerInfo
|
|
),
|
|
(Component = workInProgress.pendingProps),
|
|
null === current
|
|
? (workInProgress.child = reconcileChildFibers(
|
|
workInProgress,
|
|
null,
|
|
Component,
|
|
renderLanes
|
|
))
|
|
: reconcileChildren(current, workInProgress, Component, renderLanes),
|
|
workInProgress.child
|
|
);
|
|
case 11:
|
|
return (
|
|
(Component = workInProgress.type),
|
|
(value = workInProgress.pendingProps),
|
|
(value =
|
|
workInProgress.elementType === Component
|
|
? value
|
|
: resolveDefaultProps(Component, value)),
|
|
updateForwardRef(current, workInProgress, Component, value, renderLanes)
|
|
);
|
|
case 7:
|
|
return (
|
|
reconcileChildren(
|
|
current,
|
|
workInProgress,
|
|
workInProgress.pendingProps,
|
|
renderLanes
|
|
),
|
|
workInProgress.child
|
|
);
|
|
case 8:
|
|
return (
|
|
reconcileChildren(
|
|
current,
|
|
workInProgress,
|
|
workInProgress.pendingProps.children,
|
|
renderLanes
|
|
),
|
|
workInProgress.child
|
|
);
|
|
case 12:
|
|
return (
|
|
reconcileChildren(
|
|
current,
|
|
workInProgress,
|
|
workInProgress.pendingProps.children,
|
|
renderLanes
|
|
),
|
|
workInProgress.child
|
|
);
|
|
case 10:
|
|
a: {
|
|
Component = workInProgress.type._context;
|
|
value = workInProgress.pendingProps;
|
|
var oldProps = workInProgress.memoizedProps,
|
|
newValue = value.value;
|
|
push(valueCursor, Component._currentValue);
|
|
Component._currentValue = newValue;
|
|
if (null !== oldProps)
|
|
if (objectIs(oldProps.value, newValue)) {
|
|
if (oldProps.children === value.children) {
|
|
workInProgress = bailoutOnAlreadyFinishedWork(
|
|
current,
|
|
workInProgress,
|
|
renderLanes
|
|
);
|
|
break a;
|
|
}
|
|
} else
|
|
for (
|
|
oldProps = workInProgress.child,
|
|
null !== oldProps && (oldProps.return = workInProgress);
|
|
null !== oldProps;
|
|
|
|
) {
|
|
var list = oldProps.dependencies;
|
|
if (null !== list) {
|
|
newValue = oldProps.child;
|
|
for (
|
|
var dependency = list.firstContext;
|
|
null !== dependency;
|
|
|
|
) {
|
|
if (dependency.context === Component) {
|
|
if (1 === oldProps.tag) {
|
|
dependency = createUpdate(renderLanes & -renderLanes);
|
|
dependency.tag = 2;
|
|
var updateQueue = oldProps.updateQueue;
|
|
if (null !== updateQueue) {
|
|
updateQueue = updateQueue.shared;
|
|
var pending = updateQueue.pending;
|
|
null === pending
|
|
? (dependency.next = dependency)
|
|
: ((dependency.next = pending.next),
|
|
(pending.next = dependency));
|
|
updateQueue.pending = dependency;
|
|
}
|
|
}
|
|
oldProps.lanes |= renderLanes;
|
|
dependency = oldProps.alternate;
|
|
null !== dependency && (dependency.lanes |= renderLanes);
|
|
scheduleContextWorkOnParentPath(
|
|
oldProps.return,
|
|
renderLanes,
|
|
workInProgress
|
|
);
|
|
list.lanes |= renderLanes;
|
|
break;
|
|
}
|
|
dependency = dependency.next;
|
|
}
|
|
} else if (10 === oldProps.tag)
|
|
newValue =
|
|
oldProps.type === workInProgress.type ? null : oldProps.child;
|
|
else if (18 === oldProps.tag) {
|
|
newValue = oldProps.return;
|
|
if (null === newValue)
|
|
throw Error(
|
|
"We just came from a parent so we must have had a parent. This is a bug in React."
|
|
);
|
|
newValue.lanes |= renderLanes;
|
|
list = newValue.alternate;
|
|
null !== list && (list.lanes |= renderLanes);
|
|
scheduleContextWorkOnParentPath(
|
|
newValue,
|
|
renderLanes,
|
|
workInProgress
|
|
);
|
|
newValue = oldProps.sibling;
|
|
} else newValue = oldProps.child;
|
|
if (null !== newValue) newValue.return = oldProps;
|
|
else
|
|
for (newValue = oldProps; null !== newValue; ) {
|
|
if (newValue === workInProgress) {
|
|
newValue = null;
|
|
break;
|
|
}
|
|
oldProps = newValue.sibling;
|
|
if (null !== oldProps) {
|
|
oldProps.return = newValue.return;
|
|
newValue = oldProps;
|
|
break;
|
|
}
|
|
newValue = newValue.return;
|
|
}
|
|
oldProps = newValue;
|
|
}
|
|
reconcileChildren(current, workInProgress, value.children, renderLanes);
|
|
workInProgress = workInProgress.child;
|
|
}
|
|
return workInProgress;
|
|
case 9:
|
|
return (
|
|
(value = workInProgress.type),
|
|
(Component = workInProgress.pendingProps.children),
|
|
prepareToReadContext(workInProgress, renderLanes),
|
|
(value = readContext(value)),
|
|
(Component = Component(value)),
|
|
(workInProgress.flags |= 1),
|
|
reconcileChildren(current, workInProgress, Component, renderLanes),
|
|
workInProgress.child
|
|
);
|
|
case 14:
|
|
return (
|
|
(Component = workInProgress.type),
|
|
(value = resolveDefaultProps(Component, workInProgress.pendingProps)),
|
|
(value = resolveDefaultProps(Component.type, value)),
|
|
updateMemoComponent(
|
|
current,
|
|
workInProgress,
|
|
Component,
|
|
value,
|
|
renderLanes
|
|
)
|
|
);
|
|
case 15:
|
|
return updateSimpleMemoComponent(
|
|
current,
|
|
workInProgress,
|
|
workInProgress.type,
|
|
workInProgress.pendingProps,
|
|
renderLanes
|
|
);
|
|
case 17:
|
|
return (
|
|
(Component = workInProgress.type),
|
|
(value = workInProgress.pendingProps),
|
|
(value =
|
|
workInProgress.elementType === Component
|
|
? value
|
|
: resolveDefaultProps(Component, value)),
|
|
resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress),
|
|
(workInProgress.tag = 1),
|
|
prepareToReadContext(workInProgress, renderLanes),
|
|
constructClassInstance(workInProgress, Component, value),
|
|
mountClassInstance(workInProgress, Component, value, renderLanes),
|
|
finishClassComponent(
|
|
null,
|
|
workInProgress,
|
|
Component,
|
|
!0,
|
|
!1,
|
|
renderLanes
|
|
)
|
|
);
|
|
case 19:
|
|
return updateSuspenseListComponent(current, workInProgress, renderLanes);
|
|
case 22:
|
|
return updateOffscreenComponent(current, workInProgress, renderLanes);
|
|
}
|
|
throw Error(
|
|
"Unknown unit of work tag (" +
|
|
workInProgress.tag +
|
|
"). This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
}
|
|
var valueCursor = createCursor(null),
|
|
currentlyRenderingFiber = null,
|
|
lastContextDependency = null,
|
|
lastFullyObservedContext = null;
|
|
function resetContextDependencies() {
|
|
lastFullyObservedContext =
|
|
lastContextDependency =
|
|
currentlyRenderingFiber =
|
|
null;
|
|
}
|
|
function popProvider(context) {
|
|
context._currentValue = valueCursor.current;
|
|
pop(valueCursor);
|
|
}
|
|
function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) {
|
|
for (; null !== parent; ) {
|
|
var alternate = parent.alternate;
|
|
(parent.childLanes & renderLanes) !== renderLanes
|
|
? ((parent.childLanes |= renderLanes),
|
|
null !== alternate && (alternate.childLanes |= renderLanes))
|
|
: null !== alternate &&
|
|
(alternate.childLanes & renderLanes) !== renderLanes &&
|
|
(alternate.childLanes |= renderLanes);
|
|
if (parent === propagationRoot) break;
|
|
parent = parent.return;
|
|
}
|
|
}
|
|
function prepareToReadContext(workInProgress, renderLanes) {
|
|
currentlyRenderingFiber = workInProgress;
|
|
lastFullyObservedContext = lastContextDependency = null;
|
|
workInProgress = workInProgress.dependencies;
|
|
null !== workInProgress &&
|
|
null !== workInProgress.firstContext &&
|
|
(0 !== (workInProgress.lanes & renderLanes) && (didReceiveUpdate = !0),
|
|
(workInProgress.firstContext = null));
|
|
}
|
|
function readContext(context) {
|
|
return readContextForConsumer(currentlyRenderingFiber, context);
|
|
}
|
|
function readContextDuringReconciliation(consumer, context, renderLanes) {
|
|
null === currentlyRenderingFiber &&
|
|
prepareToReadContext(consumer, renderLanes);
|
|
return readContextForConsumer(consumer, context);
|
|
}
|
|
function readContextForConsumer(consumer, context) {
|
|
var value = context._currentValue;
|
|
if (lastFullyObservedContext !== context)
|
|
if (
|
|
((context = { context: context, memoizedValue: value, next: null }),
|
|
null === lastContextDependency)
|
|
) {
|
|
if (null === consumer)
|
|
throw 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()."
|
|
);
|
|
lastContextDependency = context;
|
|
consumer.dependencies = { lanes: 0, firstContext: context };
|
|
} else lastContextDependency = lastContextDependency.next = context;
|
|
return value;
|
|
}
|
|
var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig;
|
|
function handleAsyncAction() {}
|
|
function scheduleRetryEffect(workInProgress, retryQueue) {
|
|
null !== retryQueue
|
|
? (workInProgress.flags |= 4)
|
|
: workInProgress.flags & 16384 &&
|
|
((retryQueue =
|
|
22 !== workInProgress.tag ? claimNextRetryLane() : 536870912),
|
|
(workInProgress.lanes |= retryQueue));
|
|
}
|
|
function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {
|
|
switch (renderState.tailMode) {
|
|
case "hidden":
|
|
hasRenderedATailFallback = renderState.tail;
|
|
for (var lastTailNode = null; null !== hasRenderedATailFallback; )
|
|
null !== hasRenderedATailFallback.alternate &&
|
|
(lastTailNode = hasRenderedATailFallback),
|
|
(hasRenderedATailFallback = hasRenderedATailFallback.sibling);
|
|
null === lastTailNode
|
|
? (renderState.tail = null)
|
|
: (lastTailNode.sibling = null);
|
|
break;
|
|
case "collapsed":
|
|
lastTailNode = renderState.tail;
|
|
for (var lastTailNode$61 = null; null !== lastTailNode; )
|
|
null !== lastTailNode.alternate && (lastTailNode$61 = lastTailNode),
|
|
(lastTailNode = lastTailNode.sibling);
|
|
null === lastTailNode$61
|
|
? hasRenderedATailFallback || null === renderState.tail
|
|
? (renderState.tail = null)
|
|
: (renderState.tail.sibling = null)
|
|
: (lastTailNode$61.sibling = null);
|
|
}
|
|
}
|
|
function bubbleProperties(completedWork) {
|
|
var didBailout =
|
|
null !== completedWork.alternate &&
|
|
completedWork.alternate.child === completedWork.child,
|
|
newChildLanes = 0,
|
|
subtreeFlags = 0;
|
|
if (didBailout)
|
|
for (var child$62 = completedWork.child; null !== child$62; )
|
|
(newChildLanes |= child$62.lanes | child$62.childLanes),
|
|
(subtreeFlags |= child$62.subtreeFlags & 31457280),
|
|
(subtreeFlags |= child$62.flags & 31457280),
|
|
(child$62.return = completedWork),
|
|
(child$62 = child$62.sibling);
|
|
else
|
|
for (child$62 = completedWork.child; null !== child$62; )
|
|
(newChildLanes |= child$62.lanes | child$62.childLanes),
|
|
(subtreeFlags |= child$62.subtreeFlags),
|
|
(subtreeFlags |= child$62.flags),
|
|
(child$62.return = completedWork),
|
|
(child$62 = child$62.sibling);
|
|
completedWork.subtreeFlags |= subtreeFlags;
|
|
completedWork.childLanes = newChildLanes;
|
|
return didBailout;
|
|
}
|
|
function completeWork(current, workInProgress, renderLanes) {
|
|
var newProps = workInProgress.pendingProps;
|
|
switch (workInProgress.tag) {
|
|
case 2:
|
|
case 16:
|
|
case 15:
|
|
case 0:
|
|
case 11:
|
|
case 7:
|
|
case 8:
|
|
case 12:
|
|
case 9:
|
|
case 14:
|
|
return bubbleProperties(workInProgress), null;
|
|
case 1:
|
|
return bubbleProperties(workInProgress), null;
|
|
case 3:
|
|
return (
|
|
(renderLanes = workInProgress.stateNode),
|
|
popHostContainer(),
|
|
renderLanes.pendingContext &&
|
|
((renderLanes.context = renderLanes.pendingContext),
|
|
(renderLanes.pendingContext = null)),
|
|
(null !== current && null !== current.child) ||
|
|
null === current ||
|
|
(current.memoizedState.isDehydrated &&
|
|
0 === (workInProgress.flags & 256)) ||
|
|
((workInProgress.flags |= 1024),
|
|
null !== hydrationErrors &&
|
|
(queueRecoverableErrors(hydrationErrors),
|
|
(hydrationErrors = null))),
|
|
bubbleProperties(workInProgress),
|
|
null
|
|
);
|
|
case 26:
|
|
case 27:
|
|
case 5:
|
|
popHostContext(workInProgress);
|
|
var type = workInProgress.type;
|
|
if (null !== current && null != workInProgress.stateNode)
|
|
current.memoizedProps !== newProps && (workInProgress.flags |= 4);
|
|
else {
|
|
if (!newProps) {
|
|
if (null === workInProgress.stateNode)
|
|
throw Error(
|
|
"We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
bubbleProperties(workInProgress);
|
|
return null;
|
|
}
|
|
current = rootInstanceStackCursor.current;
|
|
renderLanes = allocateTag();
|
|
type = getViewConfigForType(type);
|
|
var updatePayload = diffProperties(
|
|
null,
|
|
emptyObject,
|
|
newProps,
|
|
type.validAttributes
|
|
);
|
|
ReactNativePrivateInterface.UIManager.createView(
|
|
renderLanes,
|
|
type.uiViewClassName,
|
|
current,
|
|
updatePayload
|
|
);
|
|
current = new ReactNativeFiberHostComponent(
|
|
renderLanes,
|
|
type,
|
|
workInProgress
|
|
);
|
|
instanceCache.set(renderLanes, workInProgress);
|
|
instanceProps.set(renderLanes, newProps);
|
|
a: for (renderLanes = workInProgress.child; null !== renderLanes; ) {
|
|
if (5 === renderLanes.tag || 6 === renderLanes.tag)
|
|
current._children.push(renderLanes.stateNode);
|
|
else if (4 !== renderLanes.tag && null !== renderLanes.child) {
|
|
renderLanes.child.return = renderLanes;
|
|
renderLanes = renderLanes.child;
|
|
continue;
|
|
}
|
|
if (renderLanes === workInProgress) break a;
|
|
for (; null === renderLanes.sibling; ) {
|
|
if (
|
|
null === renderLanes.return ||
|
|
renderLanes.return === workInProgress
|
|
)
|
|
break a;
|
|
renderLanes = renderLanes.return;
|
|
}
|
|
renderLanes.sibling.return = renderLanes.return;
|
|
renderLanes = renderLanes.sibling;
|
|
}
|
|
workInProgress.stateNode = current;
|
|
finalizeInitialChildren(current) && (workInProgress.flags |= 4);
|
|
}
|
|
bubbleProperties(workInProgress);
|
|
workInProgress.flags &= -16777217;
|
|
return null;
|
|
case 6:
|
|
if (current && null != workInProgress.stateNode)
|
|
current.memoizedProps !== newProps && (workInProgress.flags |= 4);
|
|
else {
|
|
if ("string" !== typeof newProps && null === workInProgress.stateNode)
|
|
throw Error(
|
|
"We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
renderLanes = rootInstanceStackCursor.current;
|
|
if (!contextStackCursor.current.isInAParentText)
|
|
throw Error(
|
|
"Text strings must be rendered within a <Text> component."
|
|
);
|
|
current = allocateTag();
|
|
ReactNativePrivateInterface.UIManager.createView(
|
|
current,
|
|
"RCTRawText",
|
|
renderLanes,
|
|
{ text: newProps }
|
|
);
|
|
instanceCache.set(current, workInProgress);
|
|
workInProgress.stateNode = current;
|
|
}
|
|
bubbleProperties(workInProgress);
|
|
return null;
|
|
case 13:
|
|
newProps = workInProgress.memoizedState;
|
|
if (
|
|
null === current ||
|
|
(null !== current.memoizedState &&
|
|
null !== current.memoizedState.dehydrated)
|
|
) {
|
|
if (null !== newProps && null !== newProps.dehydrated) {
|
|
if (null === current) {
|
|
throw Error(
|
|
"A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React."
|
|
);
|
|
throw Error(
|
|
"Expected prepareToHydrateHostSuspenseInstance() to never be called. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
}
|
|
0 === (workInProgress.flags & 128) &&
|
|
(workInProgress.memoizedState = null);
|
|
workInProgress.flags |= 4;
|
|
bubbleProperties(workInProgress);
|
|
type = !1;
|
|
} else
|
|
null !== hydrationErrors &&
|
|
(queueRecoverableErrors(hydrationErrors), (hydrationErrors = null)),
|
|
(type = !0);
|
|
if (!type) {
|
|
if (workInProgress.flags & 256)
|
|
return popSuspenseHandler(workInProgress), workInProgress;
|
|
popSuspenseHandler(workInProgress);
|
|
return null;
|
|
}
|
|
}
|
|
popSuspenseHandler(workInProgress);
|
|
if (0 !== (workInProgress.flags & 128))
|
|
return (workInProgress.lanes = renderLanes), workInProgress;
|
|
renderLanes = null !== newProps;
|
|
renderLanes !== (null !== current && null !== current.memoizedState) &&
|
|
renderLanes &&
|
|
(workInProgress.child.flags |= 8192);
|
|
scheduleRetryEffect(workInProgress, workInProgress.updateQueue);
|
|
bubbleProperties(workInProgress);
|
|
return null;
|
|
case 4:
|
|
return popHostContainer(), bubbleProperties(workInProgress), null;
|
|
case 10:
|
|
return (
|
|
popProvider(workInProgress.type._context),
|
|
bubbleProperties(workInProgress),
|
|
null
|
|
);
|
|
case 17:
|
|
return bubbleProperties(workInProgress), null;
|
|
case 19:
|
|
pop(suspenseStackCursor);
|
|
type = workInProgress.memoizedState;
|
|
if (null === type) return bubbleProperties(workInProgress), null;
|
|
newProps = 0 !== (workInProgress.flags & 128);
|
|
updatePayload = type.rendering;
|
|
if (null === updatePayload)
|
|
if (newProps) cutOffTailIfNeeded(type, !1);
|
|
else {
|
|
if (
|
|
0 !== workInProgressRootExitStatus ||
|
|
(null !== current && 0 !== (current.flags & 128))
|
|
)
|
|
for (current = workInProgress.child; null !== current; ) {
|
|
updatePayload = findFirstSuspended(current);
|
|
if (null !== updatePayload) {
|
|
workInProgress.flags |= 128;
|
|
cutOffTailIfNeeded(type, !1);
|
|
current = updatePayload.updateQueue;
|
|
workInProgress.updateQueue = current;
|
|
scheduleRetryEffect(workInProgress, current);
|
|
workInProgress.subtreeFlags = 0;
|
|
for (current = workInProgress.child; null !== current; )
|
|
resetWorkInProgress(current, renderLanes),
|
|
(current = current.sibling);
|
|
push(
|
|
suspenseStackCursor,
|
|
(suspenseStackCursor.current & 1) | 2
|
|
);
|
|
return workInProgress.child;
|
|
}
|
|
current = current.sibling;
|
|
}
|
|
null !== type.tail &&
|
|
now() > workInProgressRootRenderTargetTime &&
|
|
((workInProgress.flags |= 128),
|
|
(newProps = !0),
|
|
cutOffTailIfNeeded(type, !1),
|
|
(workInProgress.lanes = 4194304));
|
|
}
|
|
else {
|
|
if (!newProps)
|
|
if (
|
|
((current = findFirstSuspended(updatePayload)), null !== current)
|
|
) {
|
|
if (
|
|
((workInProgress.flags |= 128),
|
|
(newProps = !0),
|
|
(renderLanes = current.updateQueue),
|
|
(workInProgress.updateQueue = renderLanes),
|
|
scheduleRetryEffect(workInProgress, renderLanes),
|
|
cutOffTailIfNeeded(type, !0),
|
|
null === type.tail &&
|
|
"hidden" === type.tailMode &&
|
|
!updatePayload.alternate)
|
|
)
|
|
return bubbleProperties(workInProgress), null;
|
|
} else
|
|
2 * now() - type.renderingStartTime >
|
|
workInProgressRootRenderTargetTime &&
|
|
536870912 !== renderLanes &&
|
|
((workInProgress.flags |= 128),
|
|
(newProps = !0),
|
|
cutOffTailIfNeeded(type, !1),
|
|
(workInProgress.lanes = 4194304));
|
|
type.isBackwards
|
|
? ((updatePayload.sibling = workInProgress.child),
|
|
(workInProgress.child = updatePayload))
|
|
: ((renderLanes = type.last),
|
|
null !== renderLanes
|
|
? (renderLanes.sibling = updatePayload)
|
|
: (workInProgress.child = updatePayload),
|
|
(type.last = updatePayload));
|
|
}
|
|
if (null !== type.tail)
|
|
return (
|
|
(workInProgress = type.tail),
|
|
(type.rendering = workInProgress),
|
|
(type.tail = workInProgress.sibling),
|
|
(type.renderingStartTime = now()),
|
|
(workInProgress.sibling = null),
|
|
(renderLanes = suspenseStackCursor.current),
|
|
push(
|
|
suspenseStackCursor,
|
|
newProps ? (renderLanes & 1) | 2 : renderLanes & 1
|
|
),
|
|
workInProgress
|
|
);
|
|
bubbleProperties(workInProgress);
|
|
return null;
|
|
case 22:
|
|
case 23:
|
|
return (
|
|
popSuspenseHandler(workInProgress),
|
|
popHiddenContext(),
|
|
(newProps = null !== workInProgress.memoizedState),
|
|
null !== current
|
|
? (null !== current.memoizedState) !== newProps &&
|
|
(workInProgress.flags |= 8192)
|
|
: newProps && (workInProgress.flags |= 8192),
|
|
newProps && 0 !== (workInProgress.mode & 1)
|
|
? 0 !== (renderLanes & 536870912) &&
|
|
0 === (workInProgress.flags & 128) &&
|
|
(bubbleProperties(workInProgress),
|
|
workInProgress.subtreeFlags & 6 && (workInProgress.flags |= 8192))
|
|
: bubbleProperties(workInProgress),
|
|
(renderLanes = workInProgress.updateQueue),
|
|
null !== renderLanes &&
|
|
scheduleRetryEffect(workInProgress, renderLanes.retryQueue),
|
|
null
|
|
);
|
|
case 24:
|
|
return null;
|
|
case 25:
|
|
return null;
|
|
}
|
|
throw Error(
|
|
"Unknown unit of work tag (" +
|
|
workInProgress.tag +
|
|
"). This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
}
|
|
function unwindWork(current, workInProgress) {
|
|
switch (workInProgress.tag) {
|
|
case 1:
|
|
return (
|
|
(current = workInProgress.flags),
|
|
current & 65536
|
|
? ((workInProgress.flags = (current & -65537) | 128), workInProgress)
|
|
: null
|
|
);
|
|
case 3:
|
|
return (
|
|
popHostContainer(),
|
|
(current = workInProgress.flags),
|
|
0 !== (current & 65536) && 0 === (current & 128)
|
|
? ((workInProgress.flags = (current & -65537) | 128), workInProgress)
|
|
: null
|
|
);
|
|
case 26:
|
|
case 27:
|
|
case 5:
|
|
return popHostContext(workInProgress), null;
|
|
case 13:
|
|
popSuspenseHandler(workInProgress);
|
|
current = workInProgress.memoizedState;
|
|
if (
|
|
null !== current &&
|
|
null !== current.dehydrated &&
|
|
null === workInProgress.alternate
|
|
)
|
|
throw Error(
|
|
"Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue."
|
|
);
|
|
current = workInProgress.flags;
|
|
return current & 65536
|
|
? ((workInProgress.flags = (current & -65537) | 128), workInProgress)
|
|
: null;
|
|
case 19:
|
|
return pop(suspenseStackCursor), null;
|
|
case 4:
|
|
return popHostContainer(), null;
|
|
case 10:
|
|
return popProvider(workInProgress.type._context), null;
|
|
case 22:
|
|
case 23:
|
|
return (
|
|
popSuspenseHandler(workInProgress),
|
|
popHiddenContext(),
|
|
(current = workInProgress.flags),
|
|
current & 65536
|
|
? ((workInProgress.flags = (current & -65537) | 128), workInProgress)
|
|
: null
|
|
);
|
|
case 24:
|
|
return null;
|
|
case 25:
|
|
return null;
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
function unwindInterruptedWork(current, interruptedWork) {
|
|
switch (interruptedWork.tag) {
|
|
case 3:
|
|
popHostContainer();
|
|
break;
|
|
case 26:
|
|
case 27:
|
|
case 5:
|
|
popHostContext(interruptedWork);
|
|
break;
|
|
case 4:
|
|
popHostContainer();
|
|
break;
|
|
case 13:
|
|
popSuspenseHandler(interruptedWork);
|
|
break;
|
|
case 19:
|
|
pop(suspenseStackCursor);
|
|
break;
|
|
case 10:
|
|
popProvider(interruptedWork.type._context);
|
|
break;
|
|
case 22:
|
|
case 23:
|
|
popSuspenseHandler(interruptedWork), popHiddenContext();
|
|
}
|
|
}
|
|
var offscreenSubtreeIsHidden = !1,
|
|
offscreenSubtreeWasHidden = !1,
|
|
PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set,
|
|
nextEffect = null;
|
|
function safelyAttachRef(current, nearestMountedAncestor) {
|
|
try {
|
|
var ref = current.ref;
|
|
if (null !== ref) {
|
|
var instance = current.stateNode;
|
|
switch (current.tag) {
|
|
case 26:
|
|
case 27:
|
|
case 5:
|
|
var instanceToUse = getPublicInstance(instance);
|
|
break;
|
|
default:
|
|
instanceToUse = instance;
|
|
}
|
|
"function" === typeof ref
|
|
? (current.refCleanup = ref(instanceToUse))
|
|
: (ref.current = instanceToUse);
|
|
}
|
|
} catch (error) {
|
|
captureCommitPhaseError(current, nearestMountedAncestor, error);
|
|
}
|
|
}
|
|
function safelyDetachRef(current, nearestMountedAncestor) {
|
|
var ref = current.ref,
|
|
refCleanup = current.refCleanup;
|
|
if (null !== ref)
|
|
if ("function" === typeof refCleanup)
|
|
try {
|
|
refCleanup();
|
|
} catch (error) {
|
|
captureCommitPhaseError(current, nearestMountedAncestor, error);
|
|
} finally {
|
|
(current.refCleanup = null),
|
|
(current = current.alternate),
|
|
null != current && (current.refCleanup = null);
|
|
}
|
|
else if ("function" === typeof ref)
|
|
try {
|
|
ref(null);
|
|
} catch (error$76) {
|
|
captureCommitPhaseError(current, nearestMountedAncestor, error$76);
|
|
}
|
|
else ref.current = null;
|
|
}
|
|
function safelyCallDestroy(current, nearestMountedAncestor, destroy) {
|
|
try {
|
|
destroy();
|
|
} catch (error) {
|
|
captureCommitPhaseError(current, nearestMountedAncestor, error);
|
|
}
|
|
}
|
|
var shouldFireAfterActiveInstanceBlur = !1;
|
|
function commitBeforeMutationEffects(root, firstChild) {
|
|
for (nextEffect = firstChild; null !== nextEffect; )
|
|
if (
|
|
((root = nextEffect),
|
|
(firstChild = root.child),
|
|
0 !== (root.subtreeFlags & 1028) && null !== firstChild)
|
|
)
|
|
(firstChild.return = root), (nextEffect = firstChild);
|
|
else
|
|
for (; null !== nextEffect; ) {
|
|
root = nextEffect;
|
|
try {
|
|
var current = root.alternate,
|
|
flags = root.flags;
|
|
switch (root.tag) {
|
|
case 0:
|
|
break;
|
|
case 11:
|
|
case 15:
|
|
break;
|
|
case 1:
|
|
if (0 !== (flags & 1024) && null !== current) {
|
|
var prevProps = current.memoizedProps,
|
|
prevState = current.memoizedState,
|
|
instance = root.stateNode,
|
|
snapshot = instance.getSnapshotBeforeUpdate(
|
|
root.elementType === root.type
|
|
? prevProps
|
|
: resolveDefaultProps(root.type, prevProps),
|
|
prevState
|
|
);
|
|
instance.__reactInternalSnapshotBeforeUpdate = snapshot;
|
|
}
|
|
break;
|
|
case 3:
|
|
break;
|
|
case 5:
|
|
case 26:
|
|
case 27:
|
|
case 6:
|
|
case 4:
|
|
case 17:
|
|
break;
|
|
default:
|
|
if (0 !== (flags & 1024))
|
|
throw Error(
|
|
"This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
}
|
|
} catch (error) {
|
|
captureCommitPhaseError(root, root.return, error);
|
|
}
|
|
firstChild = root.sibling;
|
|
if (null !== firstChild) {
|
|
firstChild.return = root.return;
|
|
nextEffect = firstChild;
|
|
break;
|
|
}
|
|
nextEffect = root.return;
|
|
}
|
|
current = shouldFireAfterActiveInstanceBlur;
|
|
shouldFireAfterActiveInstanceBlur = !1;
|
|
return current;
|
|
}
|
|
function commitHookEffectListUnmount(
|
|
flags,
|
|
finishedWork,
|
|
nearestMountedAncestor
|
|
) {
|
|
var updateQueue = finishedWork.updateQueue;
|
|
updateQueue = null !== updateQueue ? updateQueue.lastEffect : null;
|
|
if (null !== updateQueue) {
|
|
var effect = (updateQueue = updateQueue.next);
|
|
do {
|
|
if ((effect.tag & flags) === flags) {
|
|
var inst = effect.inst,
|
|
destroy = inst.destroy;
|
|
void 0 !== destroy &&
|
|
((inst.destroy = void 0),
|
|
safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy));
|
|
}
|
|
effect = effect.next;
|
|
} while (effect !== updateQueue);
|
|
}
|
|
}
|
|
function commitHookEffectListMount(flags, finishedWork) {
|
|
finishedWork = finishedWork.updateQueue;
|
|
finishedWork = null !== finishedWork ? finishedWork.lastEffect : null;
|
|
if (null !== finishedWork) {
|
|
var effect = (finishedWork = finishedWork.next);
|
|
do {
|
|
if ((effect.tag & flags) === flags) {
|
|
var create$77 = effect.create,
|
|
inst = effect.inst;
|
|
create$77 = create$77();
|
|
inst.destroy = create$77;
|
|
}
|
|
effect = effect.next;
|
|
} while (effect !== finishedWork);
|
|
}
|
|
}
|
|
function commitHookLayoutEffects(finishedWork, hookFlags) {
|
|
try {
|
|
commitHookEffectListMount(hookFlags, finishedWork);
|
|
} catch (error) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error);
|
|
}
|
|
}
|
|
function commitClassCallbacks(finishedWork) {
|
|
var updateQueue = finishedWork.updateQueue;
|
|
if (null !== updateQueue) {
|
|
var instance = finishedWork.stateNode;
|
|
try {
|
|
commitCallbacks(updateQueue, instance);
|
|
} catch (error) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error);
|
|
}
|
|
}
|
|
}
|
|
function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) {
|
|
var flags = finishedWork.flags;
|
|
switch (finishedWork.tag) {
|
|
case 0:
|
|
case 11:
|
|
case 15:
|
|
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
|
|
flags & 4 && commitHookLayoutEffects(finishedWork, 5);
|
|
break;
|
|
case 1:
|
|
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
|
|
if (flags & 4)
|
|
if (((finishedRoot = finishedWork.stateNode), null === current))
|
|
try {
|
|
finishedRoot.componentDidMount();
|
|
} catch (error) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error);
|
|
}
|
|
else {
|
|
var prevProps =
|
|
finishedWork.elementType === finishedWork.type
|
|
? current.memoizedProps
|
|
: resolveDefaultProps(finishedWork.type, current.memoizedProps);
|
|
current = current.memoizedState;
|
|
try {
|
|
finishedRoot.componentDidUpdate(
|
|
prevProps,
|
|
current,
|
|
finishedRoot.__reactInternalSnapshotBeforeUpdate
|
|
);
|
|
} catch (error$78) {
|
|
captureCommitPhaseError(
|
|
finishedWork,
|
|
finishedWork.return,
|
|
error$78
|
|
);
|
|
}
|
|
}
|
|
flags & 64 && commitClassCallbacks(finishedWork);
|
|
flags & 512 && safelyAttachRef(finishedWork, finishedWork.return);
|
|
break;
|
|
case 3:
|
|
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
|
|
if (flags & 64 && ((flags = finishedWork.updateQueue), null !== flags)) {
|
|
finishedRoot = null;
|
|
if (null !== finishedWork.child)
|
|
switch (finishedWork.child.tag) {
|
|
case 27:
|
|
case 5:
|
|
finishedRoot = getPublicInstance(finishedWork.child.stateNode);
|
|
break;
|
|
case 1:
|
|
finishedRoot = finishedWork.child.stateNode;
|
|
}
|
|
try {
|
|
commitCallbacks(flags, finishedRoot);
|
|
} catch (error) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error);
|
|
}
|
|
}
|
|
break;
|
|
case 26:
|
|
case 27:
|
|
case 5:
|
|
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
|
|
flags & 512 && safelyAttachRef(finishedWork, finishedWork.return);
|
|
break;
|
|
case 12:
|
|
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
|
|
break;
|
|
case 13:
|
|
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
|
|
break;
|
|
case 22:
|
|
if (0 !== (finishedWork.mode & 1)) {
|
|
if (
|
|
((prevProps =
|
|
null !== finishedWork.memoizedState || offscreenSubtreeIsHidden),
|
|
!prevProps)
|
|
) {
|
|
current =
|
|
(null !== current && null !== current.memoizedState) ||
|
|
offscreenSubtreeWasHidden;
|
|
var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden,
|
|
prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden;
|
|
offscreenSubtreeIsHidden = prevProps;
|
|
(offscreenSubtreeWasHidden = current) &&
|
|
!prevOffscreenSubtreeWasHidden
|
|
? recursivelyTraverseReappearLayoutEffects(
|
|
finishedRoot,
|
|
finishedWork,
|
|
0 !== (finishedWork.subtreeFlags & 8772)
|
|
)
|
|
: recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
|
|
offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden;
|
|
offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden;
|
|
}
|
|
} else recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
|
|
flags & 512 &&
|
|
("manual" === finishedWork.memoizedProps.mode
|
|
? safelyAttachRef(finishedWork, finishedWork.return)
|
|
: safelyDetachRef(finishedWork, finishedWork.return));
|
|
break;
|
|
default:
|
|
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
|
|
}
|
|
}
|
|
function detachFiberAfterEffects(fiber) {
|
|
var alternate = fiber.alternate;
|
|
null !== alternate &&
|
|
((fiber.alternate = null), detachFiberAfterEffects(alternate));
|
|
fiber.child = null;
|
|
fiber.deletions = null;
|
|
fiber.sibling = null;
|
|
fiber.stateNode = null;
|
|
fiber.return = null;
|
|
fiber.dependencies = null;
|
|
fiber.memoizedProps = null;
|
|
fiber.memoizedState = null;
|
|
fiber.pendingProps = null;
|
|
fiber.stateNode = null;
|
|
fiber.updateQueue = null;
|
|
}
|
|
function isHostParent(fiber) {
|
|
return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag;
|
|
}
|
|
function getHostSibling(fiber) {
|
|
a: for (;;) {
|
|
for (; null === fiber.sibling; ) {
|
|
if (null === fiber.return || isHostParent(fiber.return)) return null;
|
|
fiber = fiber.return;
|
|
}
|
|
fiber.sibling.return = fiber.return;
|
|
for (
|
|
fiber = fiber.sibling;
|
|
5 !== fiber.tag && 6 !== fiber.tag && 18 !== fiber.tag;
|
|
|
|
) {
|
|
if (fiber.flags & 2) continue a;
|
|
if (null === fiber.child || 4 === fiber.tag) continue a;
|
|
else (fiber.child.return = fiber), (fiber = fiber.child);
|
|
}
|
|
if (!(fiber.flags & 2)) return fiber.stateNode;
|
|
}
|
|
}
|
|
function insertOrAppendPlacementNodeIntoContainer(node, before, parent) {
|
|
var tag = node.tag;
|
|
if (5 === tag || 6 === tag)
|
|
if (((node = node.stateNode), before)) {
|
|
if ("number" === typeof parent)
|
|
throw Error("Container does not support insertBefore operation");
|
|
} else
|
|
ReactNativePrivateInterface.UIManager.setChildren(parent, [
|
|
"number" === typeof node ? node : node._nativeTag
|
|
]);
|
|
else if (4 !== tag && ((node = node.child), null !== node))
|
|
for (
|
|
insertOrAppendPlacementNodeIntoContainer(node, before, parent),
|
|
node = node.sibling;
|
|
null !== node;
|
|
|
|
)
|
|
insertOrAppendPlacementNodeIntoContainer(node, before, parent),
|
|
(node = node.sibling);
|
|
}
|
|
function insertOrAppendPlacementNode(node, before, parent) {
|
|
var tag = node.tag;
|
|
if (5 === tag || 6 === tag)
|
|
if (((node = node.stateNode), before)) {
|
|
tag = parent._children;
|
|
var index = tag.indexOf(node);
|
|
0 <= index
|
|
? (tag.splice(index, 1),
|
|
(before = tag.indexOf(before)),
|
|
tag.splice(before, 0, node),
|
|
ReactNativePrivateInterface.UIManager.manageChildren(
|
|
parent._nativeTag,
|
|
[index],
|
|
[before],
|
|
[],
|
|
[],
|
|
[]
|
|
))
|
|
: ((before = tag.indexOf(before)),
|
|
tag.splice(before, 0, node),
|
|
ReactNativePrivateInterface.UIManager.manageChildren(
|
|
parent._nativeTag,
|
|
[],
|
|
[],
|
|
["number" === typeof node ? node : node._nativeTag],
|
|
[before],
|
|
[]
|
|
));
|
|
} else
|
|
(before = "number" === typeof node ? node : node._nativeTag),
|
|
(tag = parent._children),
|
|
(index = tag.indexOf(node)),
|
|
0 <= index
|
|
? (tag.splice(index, 1),
|
|
tag.push(node),
|
|
ReactNativePrivateInterface.UIManager.manageChildren(
|
|
parent._nativeTag,
|
|
[index],
|
|
[tag.length - 1],
|
|
[],
|
|
[],
|
|
[]
|
|
))
|
|
: (tag.push(node),
|
|
ReactNativePrivateInterface.UIManager.manageChildren(
|
|
parent._nativeTag,
|
|
[],
|
|
[],
|
|
[before],
|
|
[tag.length - 1],
|
|
[]
|
|
));
|
|
else if (4 !== tag && ((node = node.child), null !== node))
|
|
for (
|
|
insertOrAppendPlacementNode(node, before, parent), node = node.sibling;
|
|
null !== node;
|
|
|
|
)
|
|
insertOrAppendPlacementNode(node, before, parent), (node = node.sibling);
|
|
}
|
|
var hostParent = null,
|
|
hostParentIsContainer = !1;
|
|
function recursivelyTraverseDeletionEffects(
|
|
finishedRoot,
|
|
nearestMountedAncestor,
|
|
parent
|
|
) {
|
|
for (parent = parent.child; null !== parent; )
|
|
commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, parent),
|
|
(parent = parent.sibling);
|
|
}
|
|
function commitDeletionEffectsOnFiber(
|
|
finishedRoot,
|
|
nearestMountedAncestor,
|
|
deletedFiber
|
|
) {
|
|
if (injectedHook && "function" === typeof injectedHook.onCommitFiberUnmount)
|
|
try {
|
|
injectedHook.onCommitFiberUnmount(rendererID, deletedFiber);
|
|
} catch (err) {}
|
|
switch (deletedFiber.tag) {
|
|
case 26:
|
|
case 27:
|
|
case 5:
|
|
offscreenSubtreeWasHidden ||
|
|
safelyDetachRef(deletedFiber, nearestMountedAncestor);
|
|
case 6:
|
|
var prevHostParent = hostParent,
|
|
prevHostParentIsContainer = hostParentIsContainer;
|
|
hostParent = null;
|
|
recursivelyTraverseDeletionEffects(
|
|
finishedRoot,
|
|
nearestMountedAncestor,
|
|
deletedFiber
|
|
);
|
|
hostParent = prevHostParent;
|
|
hostParentIsContainer = prevHostParentIsContainer;
|
|
null !== hostParent &&
|
|
(hostParentIsContainer
|
|
? ((finishedRoot = hostParent),
|
|
recursivelyUncacheFiberNode(deletedFiber.stateNode),
|
|
ReactNativePrivateInterface.UIManager.manageChildren(
|
|
finishedRoot,
|
|
[],
|
|
[],
|
|
[],
|
|
[],
|
|
[0]
|
|
))
|
|
: ((finishedRoot = hostParent),
|
|
(nearestMountedAncestor = deletedFiber.stateNode),
|
|
recursivelyUncacheFiberNode(nearestMountedAncestor),
|
|
(deletedFiber = finishedRoot._children),
|
|
(nearestMountedAncestor = deletedFiber.indexOf(
|
|
nearestMountedAncestor
|
|
)),
|
|
deletedFiber.splice(nearestMountedAncestor, 1),
|
|
ReactNativePrivateInterface.UIManager.manageChildren(
|
|
finishedRoot._nativeTag,
|
|
[],
|
|
[],
|
|
[],
|
|
[],
|
|
[nearestMountedAncestor]
|
|
)));
|
|
break;
|
|
case 18:
|
|
null !== hostParent && shim$1();
|
|
break;
|
|
case 4:
|
|
prevHostParent = hostParent;
|
|
prevHostParentIsContainer = hostParentIsContainer;
|
|
hostParent = deletedFiber.stateNode.containerInfo;
|
|
hostParentIsContainer = !0;
|
|
recursivelyTraverseDeletionEffects(
|
|
finishedRoot,
|
|
nearestMountedAncestor,
|
|
deletedFiber
|
|
);
|
|
hostParent = prevHostParent;
|
|
hostParentIsContainer = prevHostParentIsContainer;
|
|
break;
|
|
case 0:
|
|
case 11:
|
|
case 14:
|
|
case 15:
|
|
if (
|
|
!offscreenSubtreeWasHidden &&
|
|
((prevHostParent = deletedFiber.updateQueue),
|
|
null !== prevHostParent &&
|
|
((prevHostParent = prevHostParent.lastEffect),
|
|
null !== prevHostParent))
|
|
) {
|
|
prevHostParentIsContainer = prevHostParent = prevHostParent.next;
|
|
do {
|
|
var tag = prevHostParentIsContainer.tag,
|
|
inst = prevHostParentIsContainer.inst,
|
|
destroy = inst.destroy;
|
|
void 0 !== destroy &&
|
|
(0 !== (tag & 2)
|
|
? ((inst.destroy = void 0),
|
|
safelyCallDestroy(
|
|
deletedFiber,
|
|
nearestMountedAncestor,
|
|
destroy
|
|
))
|
|
: 0 !== (tag & 4) &&
|
|
((inst.destroy = void 0),
|
|
safelyCallDestroy(
|
|
deletedFiber,
|
|
nearestMountedAncestor,
|
|
destroy
|
|
)));
|
|
prevHostParentIsContainer = prevHostParentIsContainer.next;
|
|
} while (prevHostParentIsContainer !== prevHostParent);
|
|
}
|
|
recursivelyTraverseDeletionEffects(
|
|
finishedRoot,
|
|
nearestMountedAncestor,
|
|
deletedFiber
|
|
);
|
|
break;
|
|
case 1:
|
|
if (
|
|
!offscreenSubtreeWasHidden &&
|
|
(safelyDetachRef(deletedFiber, nearestMountedAncestor),
|
|
(prevHostParent = deletedFiber.stateNode),
|
|
"function" === typeof prevHostParent.componentWillUnmount)
|
|
)
|
|
try {
|
|
(prevHostParent.props = deletedFiber.memoizedProps),
|
|
(prevHostParent.state = deletedFiber.memoizedState),
|
|
prevHostParent.componentWillUnmount();
|
|
} catch (error) {
|
|
captureCommitPhaseError(deletedFiber, nearestMountedAncestor, error);
|
|
}
|
|
recursivelyTraverseDeletionEffects(
|
|
finishedRoot,
|
|
nearestMountedAncestor,
|
|
deletedFiber
|
|
);
|
|
break;
|
|
case 21:
|
|
recursivelyTraverseDeletionEffects(
|
|
finishedRoot,
|
|
nearestMountedAncestor,
|
|
deletedFiber
|
|
);
|
|
break;
|
|
case 22:
|
|
safelyDetachRef(deletedFiber, nearestMountedAncestor);
|
|
deletedFiber.mode & 1
|
|
? ((offscreenSubtreeWasHidden =
|
|
(prevHostParent = offscreenSubtreeWasHidden) ||
|
|
null !== deletedFiber.memoizedState),
|
|
recursivelyTraverseDeletionEffects(
|
|
finishedRoot,
|
|
nearestMountedAncestor,
|
|
deletedFiber
|
|
),
|
|
(offscreenSubtreeWasHidden = prevHostParent))
|
|
: recursivelyTraverseDeletionEffects(
|
|
finishedRoot,
|
|
nearestMountedAncestor,
|
|
deletedFiber
|
|
);
|
|
break;
|
|
default:
|
|
recursivelyTraverseDeletionEffects(
|
|
finishedRoot,
|
|
nearestMountedAncestor,
|
|
deletedFiber
|
|
);
|
|
}
|
|
}
|
|
function getRetryCache(finishedWork) {
|
|
switch (finishedWork.tag) {
|
|
case 13:
|
|
case 19:
|
|
var retryCache = finishedWork.stateNode;
|
|
null === retryCache &&
|
|
(retryCache = finishedWork.stateNode = new PossiblyWeakSet());
|
|
return retryCache;
|
|
case 22:
|
|
return (
|
|
(finishedWork = finishedWork.stateNode),
|
|
(retryCache = finishedWork._retryCache),
|
|
null === retryCache &&
|
|
(retryCache = finishedWork._retryCache = new PossiblyWeakSet()),
|
|
retryCache
|
|
);
|
|
default:
|
|
throw Error(
|
|
"Unexpected Suspense handler tag (" +
|
|
finishedWork.tag +
|
|
"). This is a bug in React."
|
|
);
|
|
}
|
|
}
|
|
function attachSuspenseRetryListeners(finishedWork, wakeables) {
|
|
var retryCache = getRetryCache(finishedWork);
|
|
wakeables.forEach(function (wakeable) {
|
|
var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable);
|
|
retryCache.has(wakeable) ||
|
|
(retryCache.add(wakeable), wakeable.then(retry, retry));
|
|
});
|
|
}
|
|
function recursivelyTraverseMutationEffects(root$jscomp$0, parentFiber) {
|
|
var deletions = parentFiber.deletions;
|
|
if (null !== deletions)
|
|
for (var i = 0; i < deletions.length; i++) {
|
|
var childToDelete = deletions[i];
|
|
try {
|
|
var root = root$jscomp$0,
|
|
returnFiber = parentFiber,
|
|
parent = returnFiber;
|
|
a: for (; null !== parent; ) {
|
|
switch (parent.tag) {
|
|
case 27:
|
|
case 5:
|
|
hostParent = parent.stateNode;
|
|
hostParentIsContainer = !1;
|
|
break a;
|
|
case 3:
|
|
hostParent = parent.stateNode.containerInfo;
|
|
hostParentIsContainer = !0;
|
|
break a;
|
|
case 4:
|
|
hostParent = parent.stateNode.containerInfo;
|
|
hostParentIsContainer = !0;
|
|
break a;
|
|
}
|
|
parent = parent.return;
|
|
}
|
|
if (null === hostParent)
|
|
throw Error(
|
|
"Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
commitDeletionEffectsOnFiber(root, returnFiber, childToDelete);
|
|
hostParent = null;
|
|
hostParentIsContainer = !1;
|
|
var alternate = childToDelete.alternate;
|
|
null !== alternate && (alternate.return = null);
|
|
childToDelete.return = null;
|
|
} catch (error) {
|
|
captureCommitPhaseError(childToDelete, parentFiber, error);
|
|
}
|
|
}
|
|
if (parentFiber.subtreeFlags & 12854)
|
|
for (parentFiber = parentFiber.child; null !== parentFiber; )
|
|
commitMutationEffectsOnFiber(parentFiber, root$jscomp$0),
|
|
(parentFiber = parentFiber.sibling);
|
|
}
|
|
function commitMutationEffectsOnFiber(finishedWork, root) {
|
|
var current = finishedWork.alternate,
|
|
flags = finishedWork.flags;
|
|
switch (finishedWork.tag) {
|
|
case 0:
|
|
case 11:
|
|
case 14:
|
|
case 15:
|
|
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
if (flags & 4) {
|
|
try {
|
|
commitHookEffectListUnmount(3, finishedWork, finishedWork.return),
|
|
commitHookEffectListMount(3, finishedWork);
|
|
} catch (error) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error);
|
|
}
|
|
try {
|
|
commitHookEffectListUnmount(5, finishedWork, finishedWork.return);
|
|
} catch (error$86) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error$86);
|
|
}
|
|
}
|
|
break;
|
|
case 1:
|
|
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
flags & 512 &&
|
|
null !== current &&
|
|
safelyDetachRef(current, current.return);
|
|
flags & 64 &&
|
|
offscreenSubtreeIsHidden &&
|
|
((finishedWork = finishedWork.updateQueue),
|
|
null !== finishedWork &&
|
|
((flags = finishedWork.callbacks),
|
|
null !== flags &&
|
|
((current = finishedWork.shared.hiddenCallbacks),
|
|
(finishedWork.shared.hiddenCallbacks =
|
|
null === current ? flags : current.concat(flags)))));
|
|
break;
|
|
case 26:
|
|
case 27:
|
|
case 5:
|
|
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
flags & 512 &&
|
|
null !== current &&
|
|
safelyDetachRef(current, current.return);
|
|
if (flags & 4 && ((flags = finishedWork.stateNode), null != flags)) {
|
|
var newProps = finishedWork.memoizedProps;
|
|
current = null !== current ? current.memoizedProps : newProps;
|
|
finishedWork.updateQueue = null;
|
|
try {
|
|
var viewConfig = flags.viewConfig;
|
|
instanceProps.set(flags._nativeTag, newProps);
|
|
var updatePayload = diffProperties(
|
|
null,
|
|
current,
|
|
newProps,
|
|
viewConfig.validAttributes
|
|
);
|
|
null != updatePayload &&
|
|
ReactNativePrivateInterface.UIManager.updateView(
|
|
flags._nativeTag,
|
|
viewConfig.uiViewClassName,
|
|
updatePayload
|
|
);
|
|
} catch (error$89) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error$89);
|
|
}
|
|
}
|
|
break;
|
|
case 6:
|
|
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
if (flags & 4) {
|
|
if (null === finishedWork.stateNode)
|
|
throw Error(
|
|
"This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
flags = finishedWork.stateNode;
|
|
current = finishedWork.memoizedProps;
|
|
try {
|
|
ReactNativePrivateInterface.UIManager.updateView(
|
|
flags,
|
|
"RCTRawText",
|
|
{ text: current }
|
|
);
|
|
} catch (error$90) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error$90);
|
|
}
|
|
}
|
|
break;
|
|
case 3:
|
|
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
break;
|
|
case 4:
|
|
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
break;
|
|
case 13:
|
|
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
finishedWork.child.flags & 8192 &&
|
|
((current = null !== current && null !== current.memoizedState),
|
|
null === finishedWork.memoizedState ||
|
|
current ||
|
|
(globalMostRecentFallbackTime = now()));
|
|
flags & 4 &&
|
|
((flags = finishedWork.updateQueue),
|
|
null !== flags &&
|
|
((finishedWork.updateQueue = null),
|
|
attachSuspenseRetryListeners(finishedWork, flags)));
|
|
break;
|
|
case 22:
|
|
flags & 512 &&
|
|
null !== current &&
|
|
safelyDetachRef(current, current.return);
|
|
viewConfig = null !== finishedWork.memoizedState;
|
|
updatePayload = null !== current && null !== current.memoizedState;
|
|
if (finishedWork.mode & 1) {
|
|
var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden,
|
|
prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden;
|
|
offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden || viewConfig;
|
|
offscreenSubtreeWasHidden =
|
|
prevOffscreenSubtreeWasHidden || updatePayload;
|
|
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden;
|
|
offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden;
|
|
} else recursivelyTraverseMutationEffects(root, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
root = finishedWork.stateNode;
|
|
root._current = finishedWork;
|
|
root._visibility &= -3;
|
|
root._visibility |= root._pendingVisibility & 2;
|
|
if (
|
|
flags & 8192 &&
|
|
((root._visibility = viewConfig
|
|
? root._visibility & -2
|
|
: root._visibility | 1),
|
|
viewConfig &&
|
|
((root = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden),
|
|
null === current ||
|
|
updatePayload ||
|
|
root ||
|
|
(0 !== (finishedWork.mode & 1) &&
|
|
recursivelyTraverseDisappearLayoutEffects(finishedWork))),
|
|
null === finishedWork.memoizedProps ||
|
|
"manual" !== finishedWork.memoizedProps.mode)
|
|
)
|
|
a: for (current = null, root = finishedWork; ; ) {
|
|
if (5 === root.tag) {
|
|
if (null === current) {
|
|
current = root;
|
|
try {
|
|
if (((newProps = root.stateNode), viewConfig)) {
|
|
var viewConfig$jscomp$0 = newProps.viewConfig;
|
|
var updatePayload$jscomp$0 = diffProperties(
|
|
null,
|
|
emptyObject,
|
|
{ style: { display: "none" } },
|
|
viewConfig$jscomp$0.validAttributes
|
|
);
|
|
ReactNativePrivateInterface.UIManager.updateView(
|
|
newProps._nativeTag,
|
|
viewConfig$jscomp$0.uiViewClassName,
|
|
updatePayload$jscomp$0
|
|
);
|
|
} else {
|
|
var instance = root.stateNode,
|
|
props = root.memoizedProps,
|
|
viewConfig$jscomp$1 = instance.viewConfig,
|
|
prevProps = assign({}, props, {
|
|
style: [props.style, { display: "none" }]
|
|
});
|
|
var updatePayload$jscomp$1 = diffProperties(
|
|
null,
|
|
prevProps,
|
|
props,
|
|
viewConfig$jscomp$1.validAttributes
|
|
);
|
|
ReactNativePrivateInterface.UIManager.updateView(
|
|
instance._nativeTag,
|
|
viewConfig$jscomp$1.uiViewClassName,
|
|
updatePayload$jscomp$1
|
|
);
|
|
}
|
|
} catch (error) {
|
|
captureCommitPhaseError(
|
|
finishedWork,
|
|
finishedWork.return,
|
|
error
|
|
);
|
|
}
|
|
}
|
|
} else if (6 === root.tag) {
|
|
if (null === current)
|
|
try {
|
|
throw Error("Not yet implemented.");
|
|
} catch (error$80) {
|
|
captureCommitPhaseError(
|
|
finishedWork,
|
|
finishedWork.return,
|
|
error$80
|
|
);
|
|
}
|
|
} else if (
|
|
((22 !== root.tag && 23 !== root.tag) ||
|
|
null === root.memoizedState ||
|
|
root === finishedWork) &&
|
|
null !== root.child
|
|
) {
|
|
root.child.return = root;
|
|
root = root.child;
|
|
continue;
|
|
}
|
|
if (root === finishedWork) break a;
|
|
for (; null === root.sibling; ) {
|
|
if (null === root.return || root.return === finishedWork) break a;
|
|
current === root && (current = null);
|
|
root = root.return;
|
|
}
|
|
current === root && (current = null);
|
|
root.sibling.return = root.return;
|
|
root = root.sibling;
|
|
}
|
|
flags & 4 &&
|
|
((flags = finishedWork.updateQueue),
|
|
null !== flags &&
|
|
((current = flags.retryQueue),
|
|
null !== current &&
|
|
((flags.retryQueue = null),
|
|
attachSuspenseRetryListeners(finishedWork, current))));
|
|
break;
|
|
case 19:
|
|
recursivelyTraverseMutationEffects(root, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
flags & 4 &&
|
|
((flags = finishedWork.updateQueue),
|
|
null !== flags &&
|
|
((finishedWork.updateQueue = null),
|
|
attachSuspenseRetryListeners(finishedWork, flags)));
|
|
break;
|
|
case 21:
|
|
break;
|
|
default:
|
|
recursivelyTraverseMutationEffects(root, finishedWork),
|
|
commitReconciliationEffects(finishedWork);
|
|
}
|
|
}
|
|
function commitReconciliationEffects(finishedWork) {
|
|
var flags = finishedWork.flags;
|
|
if (flags & 2) {
|
|
try {
|
|
a: {
|
|
for (var parent = finishedWork.return; null !== parent; ) {
|
|
if (isHostParent(parent)) {
|
|
var JSCompiler_inline_result = parent;
|
|
break a;
|
|
}
|
|
parent = parent.return;
|
|
}
|
|
throw Error(
|
|
"Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
}
|
|
switch (JSCompiler_inline_result.tag) {
|
|
case 27:
|
|
case 5:
|
|
var parent$jscomp$0 = JSCompiler_inline_result.stateNode;
|
|
JSCompiler_inline_result.flags & 32 &&
|
|
(JSCompiler_inline_result.flags &= -33);
|
|
var before = getHostSibling(finishedWork);
|
|
insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0);
|
|
break;
|
|
case 3:
|
|
case 4:
|
|
var parent$81 = JSCompiler_inline_result.stateNode.containerInfo,
|
|
before$82 = getHostSibling(finishedWork);
|
|
insertOrAppendPlacementNodeIntoContainer(
|
|
finishedWork,
|
|
before$82,
|
|
parent$81
|
|
);
|
|
break;
|
|
default:
|
|
throw Error(
|
|
"Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
}
|
|
} catch (error) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error);
|
|
}
|
|
finishedWork.flags &= -3;
|
|
}
|
|
flags & 4096 && (finishedWork.flags &= -4097);
|
|
}
|
|
function recursivelyTraverseLayoutEffects(root, parentFiber) {
|
|
if (parentFiber.subtreeFlags & 8772)
|
|
for (parentFiber = parentFiber.child; null !== parentFiber; )
|
|
commitLayoutEffectOnFiber(root, parentFiber.alternate, parentFiber),
|
|
(parentFiber = parentFiber.sibling);
|
|
}
|
|
function recursivelyTraverseDisappearLayoutEffects(parentFiber) {
|
|
for (parentFiber = parentFiber.child; null !== parentFiber; ) {
|
|
var finishedWork = parentFiber;
|
|
switch (finishedWork.tag) {
|
|
case 0:
|
|
case 11:
|
|
case 14:
|
|
case 15:
|
|
commitHookEffectListUnmount(4, finishedWork, finishedWork.return);
|
|
recursivelyTraverseDisappearLayoutEffects(finishedWork);
|
|
break;
|
|
case 1:
|
|
safelyDetachRef(finishedWork, finishedWork.return);
|
|
var instance = finishedWork.stateNode;
|
|
if ("function" === typeof instance.componentWillUnmount) {
|
|
var current = finishedWork,
|
|
nearestMountedAncestor = finishedWork.return;
|
|
try {
|
|
var current$jscomp$0 = current;
|
|
instance.props = current$jscomp$0.memoizedProps;
|
|
instance.state = current$jscomp$0.memoizedState;
|
|
instance.componentWillUnmount();
|
|
} catch (error) {
|
|
captureCommitPhaseError(current, nearestMountedAncestor, error);
|
|
}
|
|
}
|
|
recursivelyTraverseDisappearLayoutEffects(finishedWork);
|
|
break;
|
|
case 26:
|
|
case 27:
|
|
case 5:
|
|
safelyDetachRef(finishedWork, finishedWork.return);
|
|
recursivelyTraverseDisappearLayoutEffects(finishedWork);
|
|
break;
|
|
case 22:
|
|
safelyDetachRef(finishedWork, finishedWork.return);
|
|
null === finishedWork.memoizedState &&
|
|
recursivelyTraverseDisappearLayoutEffects(finishedWork);
|
|
break;
|
|
default:
|
|
recursivelyTraverseDisappearLayoutEffects(finishedWork);
|
|
}
|
|
parentFiber = parentFiber.sibling;
|
|
}
|
|
}
|
|
function recursivelyTraverseReappearLayoutEffects(
|
|
finishedRoot$jscomp$0,
|
|
parentFiber,
|
|
includeWorkInProgressEffects
|
|
) {
|
|
includeWorkInProgressEffects =
|
|
includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772);
|
|
for (parentFiber = parentFiber.child; null !== parentFiber; ) {
|
|
var finishedRoot = finishedRoot$jscomp$0,
|
|
finishedWork = parentFiber,
|
|
flags = finishedWork.flags;
|
|
switch (finishedWork.tag) {
|
|
case 0:
|
|
case 11:
|
|
case 15:
|
|
recursivelyTraverseReappearLayoutEffects(
|
|
finishedRoot,
|
|
finishedWork,
|
|
includeWorkInProgressEffects
|
|
);
|
|
commitHookLayoutEffects(finishedWork, 4);
|
|
break;
|
|
case 1:
|
|
recursivelyTraverseReappearLayoutEffects(
|
|
finishedRoot,
|
|
finishedWork,
|
|
includeWorkInProgressEffects
|
|
);
|
|
var instance = finishedWork.stateNode;
|
|
if ("function" === typeof instance.componentDidMount)
|
|
try {
|
|
instance.componentDidMount();
|
|
} catch (error) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error);
|
|
}
|
|
finishedRoot = finishedWork.updateQueue;
|
|
if (null !== finishedRoot) {
|
|
var hiddenCallbacks = finishedRoot.shared.hiddenCallbacks;
|
|
if (null !== hiddenCallbacks)
|
|
for (
|
|
finishedRoot.shared.hiddenCallbacks = null, finishedRoot = 0;
|
|
finishedRoot < hiddenCallbacks.length;
|
|
finishedRoot++
|
|
)
|
|
callCallback(hiddenCallbacks[finishedRoot], instance);
|
|
}
|
|
includeWorkInProgressEffects &&
|
|
flags & 64 &&
|
|
commitClassCallbacks(finishedWork);
|
|
safelyAttachRef(finishedWork, finishedWork.return);
|
|
break;
|
|
case 26:
|
|
case 27:
|
|
case 5:
|
|
recursivelyTraverseReappearLayoutEffects(
|
|
finishedRoot,
|
|
finishedWork,
|
|
includeWorkInProgressEffects
|
|
);
|
|
safelyAttachRef(finishedWork, finishedWork.return);
|
|
break;
|
|
case 12:
|
|
recursivelyTraverseReappearLayoutEffects(
|
|
finishedRoot,
|
|
finishedWork,
|
|
includeWorkInProgressEffects
|
|
);
|
|
break;
|
|
case 13:
|
|
recursivelyTraverseReappearLayoutEffects(
|
|
finishedRoot,
|
|
finishedWork,
|
|
includeWorkInProgressEffects
|
|
);
|
|
break;
|
|
case 22:
|
|
null === finishedWork.memoizedState &&
|
|
recursivelyTraverseReappearLayoutEffects(
|
|
finishedRoot,
|
|
finishedWork,
|
|
includeWorkInProgressEffects
|
|
);
|
|
safelyAttachRef(finishedWork, finishedWork.return);
|
|
break;
|
|
default:
|
|
recursivelyTraverseReappearLayoutEffects(
|
|
finishedRoot,
|
|
finishedWork,
|
|
includeWorkInProgressEffects
|
|
);
|
|
}
|
|
parentFiber = parentFiber.sibling;
|
|
}
|
|
}
|
|
function commitHookPassiveMountEffects(finishedWork, hookFlags) {
|
|
try {
|
|
commitHookEffectListMount(hookFlags, finishedWork);
|
|
} catch (error) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error);
|
|
}
|
|
}
|
|
function recursivelyTraversePassiveMountEffects(root, parentFiber) {
|
|
if (parentFiber.subtreeFlags & 10256)
|
|
for (parentFiber = parentFiber.child; null !== parentFiber; )
|
|
commitPassiveMountOnFiber(root, parentFiber),
|
|
(parentFiber = parentFiber.sibling);
|
|
}
|
|
function commitPassiveMountOnFiber(finishedRoot, finishedWork) {
|
|
var flags = finishedWork.flags;
|
|
switch (finishedWork.tag) {
|
|
case 0:
|
|
case 11:
|
|
case 15:
|
|
recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork);
|
|
flags & 2048 && commitHookPassiveMountEffects(finishedWork, 9);
|
|
break;
|
|
case 3:
|
|
recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork);
|
|
break;
|
|
case 23:
|
|
break;
|
|
case 22:
|
|
flags = finishedWork.stateNode;
|
|
null !== finishedWork.memoizedState
|
|
? flags._visibility & 4
|
|
? recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork)
|
|
: finishedWork.mode & 1 ||
|
|
((flags._visibility |= 4),
|
|
recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork))
|
|
: flags._visibility & 4
|
|
? recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork)
|
|
: ((flags._visibility |= 4),
|
|
recursivelyTraverseReconnectPassiveEffects(
|
|
finishedRoot,
|
|
finishedWork
|
|
));
|
|
break;
|
|
case 24:
|
|
recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork);
|
|
break;
|
|
default:
|
|
recursivelyTraversePassiveMountEffects(finishedRoot, finishedWork);
|
|
}
|
|
}
|
|
function recursivelyTraverseReconnectPassiveEffects(
|
|
finishedRoot$jscomp$0,
|
|
parentFiber
|
|
) {
|
|
for (parentFiber = parentFiber.child; null !== parentFiber; ) {
|
|
var finishedRoot = finishedRoot$jscomp$0,
|
|
finishedWork = parentFiber;
|
|
switch (finishedWork.tag) {
|
|
case 0:
|
|
case 11:
|
|
case 15:
|
|
recursivelyTraverseReconnectPassiveEffects(finishedRoot, finishedWork);
|
|
commitHookPassiveMountEffects(finishedWork, 8);
|
|
break;
|
|
case 23:
|
|
break;
|
|
case 22:
|
|
var instance = finishedWork.stateNode;
|
|
null !== finishedWork.memoizedState
|
|
? instance._visibility & 4
|
|
? recursivelyTraverseReconnectPassiveEffects(
|
|
finishedRoot,
|
|
finishedWork
|
|
)
|
|
: finishedWork.mode & 1 ||
|
|
((instance._visibility |= 4),
|
|
recursivelyTraverseReconnectPassiveEffects(
|
|
finishedRoot,
|
|
finishedWork
|
|
))
|
|
: ((instance._visibility |= 4),
|
|
recursivelyTraverseReconnectPassiveEffects(
|
|
finishedRoot,
|
|
finishedWork
|
|
));
|
|
break;
|
|
case 24:
|
|
recursivelyTraverseReconnectPassiveEffects(finishedRoot, finishedWork);
|
|
break;
|
|
default:
|
|
recursivelyTraverseReconnectPassiveEffects(finishedRoot, finishedWork);
|
|
}
|
|
parentFiber = parentFiber.sibling;
|
|
}
|
|
}
|
|
var suspenseyCommitFlag = 8192;
|
|
function recursivelyAccumulateSuspenseyCommit(parentFiber) {
|
|
if (parentFiber.subtreeFlags & suspenseyCommitFlag)
|
|
for (parentFiber = parentFiber.child; null !== parentFiber; )
|
|
accumulateSuspenseyCommitOnFiber(parentFiber),
|
|
(parentFiber = parentFiber.sibling);
|
|
}
|
|
function accumulateSuspenseyCommitOnFiber(fiber) {
|
|
switch (fiber.tag) {
|
|
case 26:
|
|
recursivelyAccumulateSuspenseyCommit(fiber);
|
|
if (fiber.flags & suspenseyCommitFlag && null !== fiber.memoizedState)
|
|
throw Error(
|
|
"The current renderer does not support Resources. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
break;
|
|
case 5:
|
|
recursivelyAccumulateSuspenseyCommit(fiber);
|
|
break;
|
|
case 3:
|
|
case 4:
|
|
recursivelyAccumulateSuspenseyCommit(fiber);
|
|
break;
|
|
case 22:
|
|
if (null === fiber.memoizedState) {
|
|
var current = fiber.alternate;
|
|
null !== current && null !== current.memoizedState
|
|
? ((current = suspenseyCommitFlag),
|
|
(suspenseyCommitFlag = 16777216),
|
|
recursivelyAccumulateSuspenseyCommit(fiber),
|
|
(suspenseyCommitFlag = current))
|
|
: recursivelyAccumulateSuspenseyCommit(fiber);
|
|
}
|
|
break;
|
|
default:
|
|
recursivelyAccumulateSuspenseyCommit(fiber);
|
|
}
|
|
}
|
|
function detachAlternateSiblings(parentFiber) {
|
|
var previousFiber = parentFiber.alternate;
|
|
if (
|
|
null !== previousFiber &&
|
|
((parentFiber = previousFiber.child), null !== parentFiber)
|
|
) {
|
|
previousFiber.child = null;
|
|
do
|
|
(previousFiber = parentFiber.sibling),
|
|
(parentFiber.sibling = null),
|
|
(parentFiber = previousFiber);
|
|
while (null !== parentFiber);
|
|
}
|
|
}
|
|
function recursivelyTraversePassiveUnmountEffects(parentFiber) {
|
|
var deletions = parentFiber.deletions;
|
|
if (0 !== (parentFiber.flags & 16)) {
|
|
if (null !== deletions)
|
|
for (var i = 0; i < deletions.length; i++) {
|
|
var childToDelete = deletions[i];
|
|
nextEffect = childToDelete;
|
|
commitPassiveUnmountEffectsInsideOfDeletedTree_begin(
|
|
childToDelete,
|
|
parentFiber
|
|
);
|
|
}
|
|
detachAlternateSiblings(parentFiber);
|
|
}
|
|
if (parentFiber.subtreeFlags & 10256)
|
|
for (parentFiber = parentFiber.child; null !== parentFiber; )
|
|
commitPassiveUnmountOnFiber(parentFiber),
|
|
(parentFiber = parentFiber.sibling);
|
|
}
|
|
function commitPassiveUnmountOnFiber(finishedWork) {
|
|
switch (finishedWork.tag) {
|
|
case 0:
|
|
case 11:
|
|
case 15:
|
|
recursivelyTraversePassiveUnmountEffects(finishedWork);
|
|
finishedWork.flags & 2048 &&
|
|
commitHookEffectListUnmount(9, finishedWork, finishedWork.return);
|
|
break;
|
|
case 22:
|
|
var instance = finishedWork.stateNode;
|
|
null !== finishedWork.memoizedState &&
|
|
instance._visibility & 4 &&
|
|
(null === finishedWork.return || 13 !== finishedWork.return.tag)
|
|
? ((instance._visibility &= -5),
|
|
recursivelyTraverseDisconnectPassiveEffects(finishedWork))
|
|
: recursivelyTraversePassiveUnmountEffects(finishedWork);
|
|
break;
|
|
default:
|
|
recursivelyTraversePassiveUnmountEffects(finishedWork);
|
|
}
|
|
}
|
|
function recursivelyTraverseDisconnectPassiveEffects(parentFiber) {
|
|
var deletions = parentFiber.deletions;
|
|
if (0 !== (parentFiber.flags & 16)) {
|
|
if (null !== deletions)
|
|
for (var i = 0; i < deletions.length; i++) {
|
|
var childToDelete = deletions[i];
|
|
nextEffect = childToDelete;
|
|
commitPassiveUnmountEffectsInsideOfDeletedTree_begin(
|
|
childToDelete,
|
|
parentFiber
|
|
);
|
|
}
|
|
detachAlternateSiblings(parentFiber);
|
|
}
|
|
for (parentFiber = parentFiber.child; null !== parentFiber; ) {
|
|
deletions = parentFiber;
|
|
switch (deletions.tag) {
|
|
case 0:
|
|
case 11:
|
|
case 15:
|
|
commitHookEffectListUnmount(8, deletions, deletions.return);
|
|
recursivelyTraverseDisconnectPassiveEffects(deletions);
|
|
break;
|
|
case 22:
|
|
i = deletions.stateNode;
|
|
i._visibility & 4 &&
|
|
((i._visibility &= -5),
|
|
recursivelyTraverseDisconnectPassiveEffects(deletions));
|
|
break;
|
|
default:
|
|
recursivelyTraverseDisconnectPassiveEffects(deletions);
|
|
}
|
|
parentFiber = parentFiber.sibling;
|
|
}
|
|
}
|
|
function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(
|
|
deletedSubtreeRoot,
|
|
nearestMountedAncestor
|
|
) {
|
|
for (; null !== nextEffect; ) {
|
|
var fiber = nextEffect;
|
|
switch (fiber.tag) {
|
|
case 0:
|
|
case 11:
|
|
case 15:
|
|
commitHookEffectListUnmount(8, fiber, nearestMountedAncestor);
|
|
}
|
|
var child = fiber.child;
|
|
if (null !== child) (child.return = fiber), (nextEffect = child);
|
|
else
|
|
a: for (fiber = deletedSubtreeRoot; null !== nextEffect; ) {
|
|
child = nextEffect;
|
|
var sibling = child.sibling,
|
|
returnFiber = child.return;
|
|
detachFiberAfterEffects(child);
|
|
if (child === fiber) {
|
|
nextEffect = null;
|
|
break a;
|
|
}
|
|
if (null !== sibling) {
|
|
sibling.return = returnFiber;
|
|
nextEffect = sibling;
|
|
break a;
|
|
}
|
|
nextEffect = returnFiber;
|
|
}
|
|
}
|
|
}
|
|
var PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map,
|
|
ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher,
|
|
ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner,
|
|
ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig,
|
|
executionContext = 0,
|
|
workInProgressRoot = null,
|
|
workInProgress = null,
|
|
workInProgressRootRenderLanes = 0,
|
|
workInProgressSuspendedReason = 0,
|
|
workInProgressThrownValue = null,
|
|
workInProgressRootDidAttachPingListener = !1,
|
|
entangledRenderLanes = 0,
|
|
workInProgressRootExitStatus = 0,
|
|
workInProgressRootFatalError = null,
|
|
workInProgressRootSkippedLanes = 0,
|
|
workInProgressRootInterleavedUpdatedLanes = 0,
|
|
workInProgressRootPingedLanes = 0,
|
|
workInProgressDeferredLane = 0,
|
|
workInProgressRootConcurrentErrors = null,
|
|
workInProgressRootRecoverableErrors = null,
|
|
workInProgressRootDidIncludeRecursiveRenderUpdate = !1,
|
|
globalMostRecentFallbackTime = 0,
|
|
workInProgressRootRenderTargetTime = Infinity,
|
|
workInProgressTransitions = null,
|
|
hasUncaughtError = !1,
|
|
firstUncaughtError = null,
|
|
legacyErrorBoundariesThatAlreadyFailed = null,
|
|
rootDoesHavePassiveEffects = !1,
|
|
rootWithPendingPassiveEffects = null,
|
|
pendingPassiveEffectsLanes = 0,
|
|
nestedUpdateCount = 0,
|
|
rootWithNestedUpdates = null;
|
|
function requestUpdateLane(fiber) {
|
|
if (0 === (fiber.mode & 1)) return 2;
|
|
if (0 !== (executionContext & 2) && 0 !== workInProgressRootRenderLanes)
|
|
return workInProgressRootRenderLanes & -workInProgressRootRenderLanes;
|
|
fiber = ReactCurrentBatchConfig$1.transition;
|
|
null !== fiber && fiber._callbacks.add(handleAsyncAction);
|
|
if (null !== fiber)
|
|
return (
|
|
0 === currentEventTransitionLane &&
|
|
(currentEventTransitionLane = claimNextTransitionLane()),
|
|
currentEventTransitionLane
|
|
);
|
|
fiber = currentUpdatePriority;
|
|
return 0 !== fiber ? fiber : 32;
|
|
}
|
|
function requestDeferredLane() {
|
|
0 === workInProgressDeferredLane &&
|
|
(workInProgressDeferredLane =
|
|
0 !== (workInProgressRootRenderLanes & 536870912)
|
|
? 536870912
|
|
: claimNextTransitionLane());
|
|
var suspenseHandler = suspenseHandlerStackCursor.current;
|
|
null !== suspenseHandler && (suspenseHandler.flags |= 32);
|
|
return workInProgressDeferredLane;
|
|
}
|
|
function scheduleUpdateOnFiber(root, fiber, lane) {
|
|
if (
|
|
(root === workInProgressRoot && 2 === workInProgressSuspendedReason) ||
|
|
null !== root.cancelPendingCommit
|
|
)
|
|
prepareFreshStack(root, 0),
|
|
markRootSuspended(
|
|
root,
|
|
workInProgressRootRenderLanes,
|
|
workInProgressDeferredLane
|
|
);
|
|
markRootUpdated$1(root, lane);
|
|
if (0 === (executionContext & 2) || root !== workInProgressRoot)
|
|
root === workInProgressRoot &&
|
|
(0 === (executionContext & 2) &&
|
|
(workInProgressRootInterleavedUpdatedLanes |= lane),
|
|
4 === workInProgressRootExitStatus &&
|
|
markRootSuspended(
|
|
root,
|
|
workInProgressRootRenderLanes,
|
|
workInProgressDeferredLane
|
|
)),
|
|
ensureRootIsScheduled(root),
|
|
2 === lane &&
|
|
0 === executionContext &&
|
|
0 === (fiber.mode & 1) &&
|
|
((workInProgressRootRenderTargetTime = now() + 500),
|
|
flushSyncWorkAcrossRoots_impl(!0));
|
|
}
|
|
function performConcurrentWorkOnRoot(root, didTimeout) {
|
|
if (0 !== (executionContext & 6))
|
|
throw Error("Should not already be working.");
|
|
var originalCallbackNode = root.callbackNode;
|
|
if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode)
|
|
return null;
|
|
var lanes = getNextLanes(
|
|
root,
|
|
root === workInProgressRoot ? workInProgressRootRenderLanes : 0
|
|
);
|
|
if (0 === lanes) return null;
|
|
var exitStatus = (didTimeout =
|
|
0 === (lanes & 60) && 0 === (lanes & root.expiredLanes) && !didTimeout)
|
|
? renderRootConcurrent(root, lanes)
|
|
: renderRootSync(root, lanes);
|
|
if (0 !== exitStatus) {
|
|
var renderWasConcurrent = didTimeout;
|
|
do {
|
|
if (6 === exitStatus) markRootSuspended(root, lanes, 0);
|
|
else {
|
|
didTimeout = root.current.alternate;
|
|
if (
|
|
renderWasConcurrent &&
|
|
!isRenderConsistentWithExternalStores(didTimeout)
|
|
) {
|
|
exitStatus = renderRootSync(root, lanes);
|
|
renderWasConcurrent = !1;
|
|
continue;
|
|
}
|
|
if (2 === exitStatus) {
|
|
renderWasConcurrent = lanes;
|
|
var errorRetryLanes = getLanesToRetrySynchronouslyOnError(
|
|
root,
|
|
renderWasConcurrent
|
|
);
|
|
0 !== errorRetryLanes &&
|
|
((lanes = errorRetryLanes),
|
|
(exitStatus = recoverFromConcurrentError(
|
|
root,
|
|
renderWasConcurrent,
|
|
errorRetryLanes
|
|
)));
|
|
}
|
|
if (1 === exitStatus)
|
|
throw (
|
|
((originalCallbackNode = workInProgressRootFatalError),
|
|
prepareFreshStack(root, 0),
|
|
markRootSuspended(root, lanes, 0),
|
|
ensureRootIsScheduled(root),
|
|
originalCallbackNode)
|
|
);
|
|
root.finishedWork = didTimeout;
|
|
root.finishedLanes = lanes;
|
|
a: {
|
|
renderWasConcurrent = root;
|
|
switch (exitStatus) {
|
|
case 0:
|
|
case 1:
|
|
throw Error("Root did not complete. This is a bug in React.");
|
|
case 4:
|
|
if ((lanes & 4194176) === lanes) {
|
|
markRootSuspended(
|
|
renderWasConcurrent,
|
|
lanes,
|
|
workInProgressDeferredLane
|
|
);
|
|
break a;
|
|
}
|
|
break;
|
|
case 2:
|
|
case 3:
|
|
case 5:
|
|
break;
|
|
default:
|
|
throw Error("Unknown root exit status.");
|
|
}
|
|
if (
|
|
(lanes & 62914560) === lanes &&
|
|
3 === exitStatus &&
|
|
((exitStatus = globalMostRecentFallbackTime + 300 - now()),
|
|
10 < exitStatus)
|
|
) {
|
|
markRootSuspended(
|
|
renderWasConcurrent,
|
|
lanes,
|
|
workInProgressDeferredLane
|
|
);
|
|
if (0 !== getNextLanes(renderWasConcurrent, 0)) break a;
|
|
renderWasConcurrent.timeoutHandle = scheduleTimeout(
|
|
commitRootWhenReady.bind(
|
|
null,
|
|
renderWasConcurrent,
|
|
didTimeout,
|
|
workInProgressRootRecoverableErrors,
|
|
workInProgressTransitions,
|
|
workInProgressRootDidIncludeRecursiveRenderUpdate,
|
|
lanes,
|
|
workInProgressDeferredLane
|
|
),
|
|
exitStatus
|
|
);
|
|
break a;
|
|
}
|
|
commitRootWhenReady(
|
|
renderWasConcurrent,
|
|
didTimeout,
|
|
workInProgressRootRecoverableErrors,
|
|
workInProgressTransitions,
|
|
workInProgressRootDidIncludeRecursiveRenderUpdate,
|
|
lanes,
|
|
workInProgressDeferredLane
|
|
);
|
|
}
|
|
}
|
|
break;
|
|
} while (1);
|
|
}
|
|
ensureRootIsScheduled(root);
|
|
scheduleTaskForRootDuringMicrotask(root, now());
|
|
root =
|
|
root.callbackNode === originalCallbackNode
|
|
? performConcurrentWorkOnRoot.bind(null, root)
|
|
: null;
|
|
return root;
|
|
}
|
|
function recoverFromConcurrentError(
|
|
root,
|
|
originallyAttemptedLanes,
|
|
errorRetryLanes
|
|
) {
|
|
var errorsFromFirstAttempt = workInProgressRootConcurrentErrors,
|
|
JSCompiler_inline_result;
|
|
(JSCompiler_inline_result = root.current.memoizedState.isDehydrated) &&
|
|
(prepareFreshStack(root, errorRetryLanes).flags |= 256);
|
|
errorRetryLanes = renderRootSync(root, errorRetryLanes);
|
|
if (2 !== errorRetryLanes) {
|
|
if (workInProgressRootDidAttachPingListener && !JSCompiler_inline_result)
|
|
return (
|
|
(root.errorRecoveryDisabledLanes |= originallyAttemptedLanes),
|
|
(workInProgressRootInterleavedUpdatedLanes |= originallyAttemptedLanes),
|
|
4
|
|
);
|
|
root = workInProgressRootRecoverableErrors;
|
|
workInProgressRootRecoverableErrors = errorsFromFirstAttempt;
|
|
null !== root && queueRecoverableErrors(root);
|
|
}
|
|
return errorRetryLanes;
|
|
}
|
|
function queueRecoverableErrors(errors) {
|
|
null === workInProgressRootRecoverableErrors
|
|
? (workInProgressRootRecoverableErrors = errors)
|
|
: workInProgressRootRecoverableErrors.push.apply(
|
|
workInProgressRootRecoverableErrors,
|
|
errors
|
|
);
|
|
}
|
|
function commitRootWhenReady(
|
|
root,
|
|
finishedWork,
|
|
recoverableErrors,
|
|
transitions,
|
|
didIncludeRenderPhaseUpdate,
|
|
lanes,
|
|
spawnedLane
|
|
) {
|
|
0 === (lanes & 42) && accumulateSuspenseyCommitOnFiber(finishedWork);
|
|
commitRoot(
|
|
root,
|
|
recoverableErrors,
|
|
transitions,
|
|
didIncludeRenderPhaseUpdate,
|
|
spawnedLane
|
|
);
|
|
}
|
|
function isRenderConsistentWithExternalStores(finishedWork) {
|
|
for (var node = finishedWork; ; ) {
|
|
if (node.flags & 16384) {
|
|
var updateQueue = node.updateQueue;
|
|
if (
|
|
null !== updateQueue &&
|
|
((updateQueue = updateQueue.stores), null !== updateQueue)
|
|
)
|
|
for (var i = 0; i < updateQueue.length; i++) {
|
|
var check = updateQueue[i],
|
|
getSnapshot = check.getSnapshot;
|
|
check = check.value;
|
|
try {
|
|
if (!objectIs(getSnapshot(), check)) return !1;
|
|
} catch (error) {
|
|
return !1;
|
|
}
|
|
}
|
|
}
|
|
updateQueue = node.child;
|
|
if (node.subtreeFlags & 16384 && null !== updateQueue)
|
|
(updateQueue.return = node), (node = updateQueue);
|
|
else {
|
|
if (node === finishedWork) break;
|
|
for (; null === node.sibling; ) {
|
|
if (null === node.return || node.return === finishedWork) return !0;
|
|
node = node.return;
|
|
}
|
|
node.sibling.return = node.return;
|
|
node = node.sibling;
|
|
}
|
|
}
|
|
return !0;
|
|
}
|
|
function markRootSuspended(root, suspendedLanes, spawnedLane) {
|
|
suspendedLanes &= ~workInProgressRootPingedLanes;
|
|
suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes;
|
|
root.suspendedLanes |= suspendedLanes;
|
|
root.pingedLanes &= ~suspendedLanes;
|
|
for (
|
|
var expirationTimes = root.expirationTimes, lanes = suspendedLanes;
|
|
0 < lanes;
|
|
|
|
) {
|
|
var index$6 = 31 - clz32(lanes),
|
|
lane = 1 << index$6;
|
|
expirationTimes[index$6] = -1;
|
|
lanes &= ~lane;
|
|
}
|
|
0 !== spawnedLane &&
|
|
markSpawnedDeferredLane(root, spawnedLane, suspendedLanes);
|
|
}
|
|
function resetWorkInProgressStack() {
|
|
if (null !== workInProgress) {
|
|
if (0 === workInProgressSuspendedReason)
|
|
var interruptedWork = workInProgress.return;
|
|
else
|
|
(interruptedWork = workInProgress),
|
|
resetContextDependencies(),
|
|
resetHooksOnUnwind(interruptedWork),
|
|
(thenableState$1 = null),
|
|
(thenableIndexCounter$1 = 0),
|
|
(interruptedWork = workInProgress);
|
|
for (; null !== interruptedWork; )
|
|
unwindInterruptedWork(interruptedWork.alternate, interruptedWork),
|
|
(interruptedWork = interruptedWork.return);
|
|
workInProgress = null;
|
|
}
|
|
}
|
|
function prepareFreshStack(root, lanes) {
|
|
root.finishedWork = null;
|
|
root.finishedLanes = 0;
|
|
var timeoutHandle = root.timeoutHandle;
|
|
-1 !== timeoutHandle &&
|
|
((root.timeoutHandle = -1), cancelTimeout(timeoutHandle));
|
|
timeoutHandle = root.cancelPendingCommit;
|
|
null !== timeoutHandle &&
|
|
((root.cancelPendingCommit = null), timeoutHandle());
|
|
resetWorkInProgressStack();
|
|
workInProgressRoot = root;
|
|
workInProgress = timeoutHandle = createWorkInProgress(root.current, null);
|
|
workInProgressRootRenderLanes = lanes;
|
|
workInProgressSuspendedReason = 0;
|
|
workInProgressThrownValue = null;
|
|
workInProgressRootDidAttachPingListener = !1;
|
|
workInProgressRootExitStatus = 0;
|
|
workInProgressRootFatalError = null;
|
|
workInProgressDeferredLane =
|
|
workInProgressRootPingedLanes =
|
|
workInProgressRootInterleavedUpdatedLanes =
|
|
workInProgressRootSkippedLanes =
|
|
0;
|
|
workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors =
|
|
null;
|
|
workInProgressRootDidIncludeRecursiveRenderUpdate = !1;
|
|
0 !== (lanes & 8) && (lanes |= lanes & 32);
|
|
var allEntangledLanes = root.entangledLanes;
|
|
if (0 !== allEntangledLanes)
|
|
for (
|
|
root = root.entanglements, allEntangledLanes &= lanes;
|
|
0 < allEntangledLanes;
|
|
|
|
) {
|
|
var index$4 = 31 - clz32(allEntangledLanes),
|
|
lane = 1 << index$4;
|
|
lanes |= root[index$4];
|
|
allEntangledLanes &= ~lane;
|
|
}
|
|
entangledRenderLanes = lanes;
|
|
finishQueueingConcurrentUpdates();
|
|
return timeoutHandle;
|
|
}
|
|
function handleThrow(root, thrownValue) {
|
|
currentlyRenderingFiber$1 = null;
|
|
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
|
|
ReactCurrentOwner.current = null;
|
|
thrownValue === SuspenseException
|
|
? ((thrownValue = getSuspendedThenable()),
|
|
(root = suspenseHandlerStackCursor.current),
|
|
(workInProgressSuspendedReason =
|
|
(null !== root &&
|
|
((workInProgressRootRenderLanes & 4194176) ===
|
|
workInProgressRootRenderLanes
|
|
? null !== shellBoundary
|
|
: ((workInProgressRootRenderLanes & 62914560) !==
|
|
workInProgressRootRenderLanes &&
|
|
0 === (workInProgressRootRenderLanes & 536870912)) ||
|
|
root !== shellBoundary)) ||
|
|
0 !== (workInProgressRootSkippedLanes & 134217727) ||
|
|
0 !== (workInProgressRootInterleavedUpdatedLanes & 134217727)
|
|
? 3
|
|
: 2))
|
|
: thrownValue === SuspenseyCommitException
|
|
? ((thrownValue = getSuspendedThenable()),
|
|
(workInProgressSuspendedReason = 4))
|
|
: (workInProgressSuspendedReason =
|
|
thrownValue === SelectiveHydrationException
|
|
? 8
|
|
: null !== thrownValue &&
|
|
"object" === typeof thrownValue &&
|
|
"function" === typeof thrownValue.then
|
|
? 6
|
|
: 1);
|
|
workInProgressThrownValue = thrownValue;
|
|
null === workInProgress &&
|
|
((workInProgressRootExitStatus = 1),
|
|
(workInProgressRootFatalError = thrownValue));
|
|
}
|
|
function pushDispatcher() {
|
|
var prevDispatcher = ReactCurrentDispatcher.current;
|
|
ReactCurrentDispatcher.current = ContextOnlyDispatcher;
|
|
return null === prevDispatcher ? ContextOnlyDispatcher : prevDispatcher;
|
|
}
|
|
function renderDidSuspendDelayIfPossible() {
|
|
workInProgressRootExitStatus = 4;
|
|
(0 === (workInProgressRootSkippedLanes & 134217727) &&
|
|
0 === (workInProgressRootInterleavedUpdatedLanes & 134217727)) ||
|
|
null === workInProgressRoot ||
|
|
markRootSuspended(
|
|
workInProgressRoot,
|
|
workInProgressRootRenderLanes,
|
|
workInProgressDeferredLane
|
|
);
|
|
}
|
|
function renderRootSync(root, lanes) {
|
|
var prevExecutionContext = executionContext;
|
|
executionContext |= 2;
|
|
var prevDispatcher = pushDispatcher();
|
|
if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes)
|
|
(workInProgressTransitions = null), prepareFreshStack(root, lanes);
|
|
lanes = !1;
|
|
a: do
|
|
try {
|
|
if (0 !== workInProgressSuspendedReason && null !== workInProgress) {
|
|
var unitOfWork = workInProgress,
|
|
thrownValue = workInProgressThrownValue;
|
|
switch (workInProgressSuspendedReason) {
|
|
case 8:
|
|
resetWorkInProgressStack();
|
|
workInProgressRootExitStatus = 6;
|
|
break a;
|
|
case 3:
|
|
case 2:
|
|
lanes ||
|
|
null !== suspenseHandlerStackCursor.current ||
|
|
(lanes = !0);
|
|
default:
|
|
(workInProgressSuspendedReason = 0),
|
|
(workInProgressThrownValue = null),
|
|
throwAndUnwindWorkLoop(root, unitOfWork, thrownValue);
|
|
}
|
|
}
|
|
workLoopSync();
|
|
break;
|
|
} catch (thrownValue$94) {
|
|
handleThrow(root, thrownValue$94);
|
|
}
|
|
while (1);
|
|
lanes && root.shellSuspendCounter++;
|
|
resetContextDependencies();
|
|
executionContext = prevExecutionContext;
|
|
ReactCurrentDispatcher.current = prevDispatcher;
|
|
if (null !== workInProgress)
|
|
throw Error(
|
|
"Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
workInProgressRoot = null;
|
|
workInProgressRootRenderLanes = 0;
|
|
finishQueueingConcurrentUpdates();
|
|
return workInProgressRootExitStatus;
|
|
}
|
|
function workLoopSync() {
|
|
for (; null !== workInProgress; ) performUnitOfWork(workInProgress);
|
|
}
|
|
function renderRootConcurrent(root, lanes) {
|
|
var prevExecutionContext = executionContext;
|
|
executionContext |= 2;
|
|
var prevDispatcher = pushDispatcher();
|
|
if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes)
|
|
(workInProgressTransitions = null),
|
|
(workInProgressRootRenderTargetTime = now() + 500),
|
|
prepareFreshStack(root, lanes);
|
|
a: do
|
|
try {
|
|
if (0 !== workInProgressSuspendedReason && null !== workInProgress) {
|
|
lanes = workInProgress;
|
|
var thrownValue = workInProgressThrownValue;
|
|
b: switch (workInProgressSuspendedReason) {
|
|
case 1:
|
|
workInProgressSuspendedReason = 0;
|
|
workInProgressThrownValue = null;
|
|
throwAndUnwindWorkLoop(root, lanes, thrownValue);
|
|
break;
|
|
case 2:
|
|
if (isThenableResolved(thrownValue)) {
|
|
workInProgressSuspendedReason = 0;
|
|
workInProgressThrownValue = null;
|
|
replaySuspendedUnitOfWork(lanes);
|
|
break;
|
|
}
|
|
lanes = function () {
|
|
2 === workInProgressSuspendedReason &&
|
|
workInProgressRoot === root &&
|
|
(workInProgressSuspendedReason = 7);
|
|
ensureRootIsScheduled(root);
|
|
};
|
|
thrownValue.then(lanes, lanes);
|
|
break a;
|
|
case 3:
|
|
workInProgressSuspendedReason = 7;
|
|
break a;
|
|
case 4:
|
|
workInProgressSuspendedReason = 5;
|
|
break a;
|
|
case 7:
|
|
isThenableResolved(thrownValue)
|
|
? ((workInProgressSuspendedReason = 0),
|
|
(workInProgressThrownValue = null),
|
|
replaySuspendedUnitOfWork(lanes))
|
|
: ((workInProgressSuspendedReason = 0),
|
|
(workInProgressThrownValue = null),
|
|
throwAndUnwindWorkLoop(root, lanes, thrownValue));
|
|
break;
|
|
case 5:
|
|
switch (workInProgress.tag) {
|
|
case 5:
|
|
case 26:
|
|
case 27:
|
|
lanes = workInProgress;
|
|
workInProgressSuspendedReason = 0;
|
|
workInProgressThrownValue = null;
|
|
var sibling = lanes.sibling;
|
|
if (null !== sibling) workInProgress = sibling;
|
|
else {
|
|
var returnFiber = lanes.return;
|
|
null !== returnFiber
|
|
? ((workInProgress = returnFiber),
|
|
completeUnitOfWork(returnFiber))
|
|
: (workInProgress = null);
|
|
}
|
|
break b;
|
|
}
|
|
workInProgressSuspendedReason = 0;
|
|
workInProgressThrownValue = null;
|
|
throwAndUnwindWorkLoop(root, lanes, thrownValue);
|
|
break;
|
|
case 6:
|
|
workInProgressSuspendedReason = 0;
|
|
workInProgressThrownValue = null;
|
|
throwAndUnwindWorkLoop(root, lanes, thrownValue);
|
|
break;
|
|
case 8:
|
|
resetWorkInProgressStack();
|
|
workInProgressRootExitStatus = 6;
|
|
break a;
|
|
default:
|
|
throw Error("Unexpected SuspendedReason. This is a bug in React.");
|
|
}
|
|
}
|
|
workLoopConcurrent();
|
|
break;
|
|
} catch (thrownValue$96) {
|
|
handleThrow(root, thrownValue$96);
|
|
}
|
|
while (1);
|
|
resetContextDependencies();
|
|
ReactCurrentDispatcher.current = prevDispatcher;
|
|
executionContext = prevExecutionContext;
|
|
if (null !== workInProgress) return 0;
|
|
workInProgressRoot = null;
|
|
workInProgressRootRenderLanes = 0;
|
|
finishQueueingConcurrentUpdates();
|
|
return workInProgressRootExitStatus;
|
|
}
|
|
function workLoopConcurrent() {
|
|
for (; null !== workInProgress && !shouldYield(); )
|
|
performUnitOfWork(workInProgress);
|
|
}
|
|
function performUnitOfWork(unitOfWork) {
|
|
var next = beginWork(unitOfWork.alternate, unitOfWork, entangledRenderLanes);
|
|
unitOfWork.memoizedProps = unitOfWork.pendingProps;
|
|
null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next);
|
|
ReactCurrentOwner.current = null;
|
|
}
|
|
function replaySuspendedUnitOfWork(unitOfWork) {
|
|
var current = unitOfWork.alternate;
|
|
switch (unitOfWork.tag) {
|
|
case 2:
|
|
unitOfWork.tag = 0;
|
|
case 15:
|
|
case 0:
|
|
var Component = unitOfWork.type,
|
|
unresolvedProps = unitOfWork.pendingProps;
|
|
unresolvedProps =
|
|
unitOfWork.elementType === Component
|
|
? unresolvedProps
|
|
: resolveDefaultProps(Component, unresolvedProps);
|
|
current = replayFunctionComponent(
|
|
current,
|
|
unitOfWork,
|
|
unresolvedProps,
|
|
Component,
|
|
void 0,
|
|
workInProgressRootRenderLanes
|
|
);
|
|
break;
|
|
case 11:
|
|
Component = unitOfWork.type.render;
|
|
unresolvedProps = unitOfWork.pendingProps;
|
|
unresolvedProps =
|
|
unitOfWork.elementType === Component
|
|
? unresolvedProps
|
|
: resolveDefaultProps(Component, unresolvedProps);
|
|
current = replayFunctionComponent(
|
|
current,
|
|
unitOfWork,
|
|
unresolvedProps,
|
|
Component,
|
|
unitOfWork.ref,
|
|
workInProgressRootRenderLanes
|
|
);
|
|
break;
|
|
case 5:
|
|
resetHooksOnUnwind(unitOfWork);
|
|
default:
|
|
unwindInterruptedWork(current, unitOfWork),
|
|
(unitOfWork = workInProgress =
|
|
resetWorkInProgress(unitOfWork, entangledRenderLanes)),
|
|
(current = beginWork(current, unitOfWork, entangledRenderLanes));
|
|
}
|
|
unitOfWork.memoizedProps = unitOfWork.pendingProps;
|
|
null === current
|
|
? completeUnitOfWork(unitOfWork)
|
|
: (workInProgress = current);
|
|
ReactCurrentOwner.current = null;
|
|
}
|
|
function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) {
|
|
resetContextDependencies();
|
|
resetHooksOnUnwind(unitOfWork);
|
|
thenableState$1 = null;
|
|
thenableIndexCounter$1 = 0;
|
|
var returnFiber = unitOfWork.return;
|
|
try {
|
|
if (
|
|
throwException(
|
|
root,
|
|
returnFiber,
|
|
unitOfWork,
|
|
thrownValue,
|
|
workInProgressRootRenderLanes
|
|
)
|
|
) {
|
|
workInProgressRootExitStatus = 1;
|
|
workInProgressRootFatalError = thrownValue;
|
|
workInProgress = null;
|
|
return;
|
|
}
|
|
} catch (error) {
|
|
if (null !== returnFiber) throw ((workInProgress = returnFiber), error);
|
|
workInProgressRootExitStatus = 1;
|
|
workInProgressRootFatalError = thrownValue;
|
|
workInProgress = null;
|
|
return;
|
|
}
|
|
if (unitOfWork.flags & 32768)
|
|
a: {
|
|
root = unitOfWork;
|
|
do {
|
|
unitOfWork = unwindWork(root.alternate, root);
|
|
if (null !== unitOfWork) {
|
|
unitOfWork.flags &= 32767;
|
|
workInProgress = unitOfWork;
|
|
break a;
|
|
}
|
|
root = root.return;
|
|
null !== root &&
|
|
((root.flags |= 32768),
|
|
(root.subtreeFlags = 0),
|
|
(root.deletions = null));
|
|
workInProgress = root;
|
|
} while (null !== root);
|
|
workInProgressRootExitStatus = 6;
|
|
workInProgress = null;
|
|
}
|
|
else completeUnitOfWork(unitOfWork);
|
|
}
|
|
function completeUnitOfWork(unitOfWork) {
|
|
var completedWork = unitOfWork;
|
|
do {
|
|
unitOfWork = completedWork.return;
|
|
var next = completeWork(
|
|
completedWork.alternate,
|
|
completedWork,
|
|
entangledRenderLanes
|
|
);
|
|
if (null !== next) {
|
|
workInProgress = next;
|
|
return;
|
|
}
|
|
completedWork = completedWork.sibling;
|
|
if (null !== completedWork) {
|
|
workInProgress = completedWork;
|
|
return;
|
|
}
|
|
workInProgress = completedWork = unitOfWork;
|
|
} while (null !== completedWork);
|
|
0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 5);
|
|
}
|
|
function commitRoot(
|
|
root,
|
|
recoverableErrors,
|
|
transitions,
|
|
didIncludeRenderPhaseUpdate,
|
|
spawnedLane
|
|
) {
|
|
var previousUpdateLanePriority = currentUpdatePriority,
|
|
prevTransition = ReactCurrentBatchConfig.transition;
|
|
try {
|
|
(ReactCurrentBatchConfig.transition = null),
|
|
(currentUpdatePriority = 2),
|
|
commitRootImpl(
|
|
root,
|
|
recoverableErrors,
|
|
transitions,
|
|
didIncludeRenderPhaseUpdate,
|
|
previousUpdateLanePriority,
|
|
spawnedLane
|
|
);
|
|
} finally {
|
|
(ReactCurrentBatchConfig.transition = prevTransition),
|
|
(currentUpdatePriority = previousUpdateLanePriority);
|
|
}
|
|
return null;
|
|
}
|
|
function commitRootImpl(
|
|
root,
|
|
recoverableErrors,
|
|
transitions,
|
|
didIncludeRenderPhaseUpdate,
|
|
renderPriorityLevel,
|
|
spawnedLane
|
|
) {
|
|
do flushPassiveEffects();
|
|
while (null !== rootWithPendingPassiveEffects);
|
|
if (0 !== (executionContext & 6))
|
|
throw Error("Should not already be working.");
|
|
didIncludeRenderPhaseUpdate = root.finishedWork;
|
|
transitions = root.finishedLanes;
|
|
if (null === didIncludeRenderPhaseUpdate) return null;
|
|
root.finishedWork = null;
|
|
root.finishedLanes = 0;
|
|
if (didIncludeRenderPhaseUpdate === root.current)
|
|
throw Error(
|
|
"Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue."
|
|
);
|
|
root.callbackNode = null;
|
|
root.callbackPriority = 0;
|
|
root.cancelPendingCommit = null;
|
|
var remainingLanes =
|
|
didIncludeRenderPhaseUpdate.lanes | didIncludeRenderPhaseUpdate.childLanes;
|
|
remainingLanes |= concurrentlyUpdatedLanes;
|
|
markRootFinished(root, remainingLanes, spawnedLane);
|
|
root === workInProgressRoot &&
|
|
((workInProgress = workInProgressRoot = null),
|
|
(workInProgressRootRenderLanes = 0));
|
|
(0 === (didIncludeRenderPhaseUpdate.subtreeFlags & 10256) &&
|
|
0 === (didIncludeRenderPhaseUpdate.flags & 10256)) ||
|
|
rootDoesHavePassiveEffects ||
|
|
((rootDoesHavePassiveEffects = !0),
|
|
scheduleCallback(NormalPriority, function () {
|
|
flushPassiveEffects();
|
|
return null;
|
|
}));
|
|
spawnedLane = 0 !== (didIncludeRenderPhaseUpdate.flags & 15990);
|
|
if (0 !== (didIncludeRenderPhaseUpdate.subtreeFlags & 15990) || spawnedLane) {
|
|
spawnedLane = ReactCurrentBatchConfig.transition;
|
|
ReactCurrentBatchConfig.transition = null;
|
|
remainingLanes = currentUpdatePriority;
|
|
currentUpdatePriority = 2;
|
|
var prevExecutionContext = executionContext;
|
|
executionContext |= 4;
|
|
ReactCurrentOwner.current = null;
|
|
commitBeforeMutationEffects(root, didIncludeRenderPhaseUpdate);
|
|
commitMutationEffectsOnFiber(didIncludeRenderPhaseUpdate, root);
|
|
root.current = didIncludeRenderPhaseUpdate;
|
|
commitLayoutEffectOnFiber(
|
|
root,
|
|
didIncludeRenderPhaseUpdate.alternate,
|
|
didIncludeRenderPhaseUpdate
|
|
);
|
|
requestPaint();
|
|
executionContext = prevExecutionContext;
|
|
currentUpdatePriority = remainingLanes;
|
|
ReactCurrentBatchConfig.transition = spawnedLane;
|
|
} else root.current = didIncludeRenderPhaseUpdate;
|
|
rootDoesHavePassiveEffects &&
|
|
((rootDoesHavePassiveEffects = !1),
|
|
(rootWithPendingPassiveEffects = root),
|
|
(pendingPassiveEffectsLanes = transitions));
|
|
remainingLanes = root.pendingLanes;
|
|
0 === remainingLanes && (legacyErrorBoundariesThatAlreadyFailed = null);
|
|
onCommitRoot(didIncludeRenderPhaseUpdate.stateNode, renderPriorityLevel);
|
|
ensureRootIsScheduled(root);
|
|
if (null !== recoverableErrors)
|
|
for (
|
|
renderPriorityLevel = root.onRecoverableError,
|
|
didIncludeRenderPhaseUpdate = 0;
|
|
didIncludeRenderPhaseUpdate < recoverableErrors.length;
|
|
didIncludeRenderPhaseUpdate++
|
|
)
|
|
(spawnedLane = recoverableErrors[didIncludeRenderPhaseUpdate]),
|
|
(remainingLanes = {
|
|
digest: spawnedLane.digest,
|
|
componentStack: spawnedLane.stack
|
|
}),
|
|
renderPriorityLevel(spawnedLane.value, remainingLanes);
|
|
if (hasUncaughtError)
|
|
throw (
|
|
((hasUncaughtError = !1),
|
|
(root = firstUncaughtError),
|
|
(firstUncaughtError = null),
|
|
root)
|
|
);
|
|
0 !== (pendingPassiveEffectsLanes & 3) &&
|
|
0 !== root.tag &&
|
|
flushPassiveEffects();
|
|
remainingLanes = root.pendingLanes;
|
|
0 !== (transitions & 4194218) && 0 !== (remainingLanes & 42)
|
|
? root === rootWithNestedUpdates
|
|
? nestedUpdateCount++
|
|
: ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))
|
|
: (nestedUpdateCount = 0);
|
|
flushSyncWorkAcrossRoots_impl(!1);
|
|
return null;
|
|
}
|
|
function flushPassiveEffects() {
|
|
if (null !== rootWithPendingPassiveEffects) {
|
|
var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes),
|
|
prevTransition = ReactCurrentBatchConfig.transition,
|
|
previousPriority = currentUpdatePriority;
|
|
try {
|
|
ReactCurrentBatchConfig.transition = null;
|
|
currentUpdatePriority = 32 > renderPriority ? 32 : renderPriority;
|
|
if (null === rootWithPendingPassiveEffects)
|
|
var JSCompiler_inline_result = !1;
|
|
else {
|
|
renderPriority = rootWithPendingPassiveEffects;
|
|
rootWithPendingPassiveEffects = null;
|
|
pendingPassiveEffectsLanes = 0;
|
|
if (0 !== (executionContext & 6))
|
|
throw Error("Cannot flush passive effects while already rendering.");
|
|
var prevExecutionContext = executionContext;
|
|
executionContext |= 4;
|
|
commitPassiveUnmountOnFiber(renderPriority.current);
|
|
commitPassiveMountOnFiber(renderPriority, renderPriority.current);
|
|
executionContext = prevExecutionContext;
|
|
flushSyncWorkAcrossRoots_impl(!1);
|
|
if (
|
|
injectedHook &&
|
|
"function" === typeof injectedHook.onPostCommitFiberRoot
|
|
)
|
|
try {
|
|
injectedHook.onPostCommitFiberRoot(rendererID, renderPriority);
|
|
} catch (err) {}
|
|
JSCompiler_inline_result = !0;
|
|
}
|
|
return JSCompiler_inline_result;
|
|
} finally {
|
|
(currentUpdatePriority = previousPriority),
|
|
(ReactCurrentBatchConfig.transition = prevTransition);
|
|
}
|
|
}
|
|
return !1;
|
|
}
|
|
function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) {
|
|
sourceFiber = createCapturedValueAtFiber(error, sourceFiber);
|
|
sourceFiber = createRootErrorUpdate(rootFiber, sourceFiber, 2);
|
|
rootFiber = enqueueUpdate(rootFiber, sourceFiber, 2);
|
|
null !== rootFiber &&
|
|
(markRootUpdated$1(rootFiber, 2), ensureRootIsScheduled(rootFiber));
|
|
}
|
|
function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error) {
|
|
if (3 === sourceFiber.tag)
|
|
captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error);
|
|
else
|
|
for (; null !== nearestMountedAncestor; ) {
|
|
if (3 === nearestMountedAncestor.tag) {
|
|
captureCommitPhaseErrorOnRoot(
|
|
nearestMountedAncestor,
|
|
sourceFiber,
|
|
error
|
|
);
|
|
break;
|
|
} else if (1 === nearestMountedAncestor.tag) {
|
|
var instance = nearestMountedAncestor.stateNode;
|
|
if (
|
|
"function" ===
|
|
typeof nearestMountedAncestor.type.getDerivedStateFromError ||
|
|
("function" === typeof instance.componentDidCatch &&
|
|
(null === legacyErrorBoundariesThatAlreadyFailed ||
|
|
!legacyErrorBoundariesThatAlreadyFailed.has(instance)))
|
|
) {
|
|
sourceFiber = createCapturedValueAtFiber(error, sourceFiber);
|
|
sourceFiber = createClassErrorUpdate(
|
|
nearestMountedAncestor,
|
|
sourceFiber,
|
|
2
|
|
);
|
|
nearestMountedAncestor = enqueueUpdate(
|
|
nearestMountedAncestor,
|
|
sourceFiber,
|
|
2
|
|
);
|
|
null !== nearestMountedAncestor &&
|
|
(markRootUpdated$1(nearestMountedAncestor, 2),
|
|
ensureRootIsScheduled(nearestMountedAncestor));
|
|
break;
|
|
}
|
|
}
|
|
nearestMountedAncestor = nearestMountedAncestor.return;
|
|
}
|
|
}
|
|
function attachPingListener(root, wakeable, lanes) {
|
|
var pingCache = root.pingCache;
|
|
if (null === pingCache) {
|
|
pingCache = root.pingCache = new PossiblyWeakMap();
|
|
var threadIDs = new Set();
|
|
pingCache.set(wakeable, threadIDs);
|
|
} else
|
|
(threadIDs = pingCache.get(wakeable)),
|
|
void 0 === threadIDs &&
|
|
((threadIDs = new Set()), pingCache.set(wakeable, threadIDs));
|
|
threadIDs.has(lanes) ||
|
|
((workInProgressRootDidAttachPingListener = !0),
|
|
threadIDs.add(lanes),
|
|
(root = pingSuspendedRoot.bind(null, root, wakeable, lanes)),
|
|
wakeable.then(root, root));
|
|
}
|
|
function pingSuspendedRoot(root, wakeable, pingedLanes) {
|
|
var pingCache = root.pingCache;
|
|
null !== pingCache && pingCache.delete(wakeable);
|
|
root.pingedLanes |= root.suspendedLanes & pingedLanes;
|
|
workInProgressRoot === root &&
|
|
(workInProgressRootRenderLanes & pingedLanes) === pingedLanes &&
|
|
(4 === workInProgressRootExitStatus ||
|
|
(3 === workInProgressRootExitStatus &&
|
|
(workInProgressRootRenderLanes & 62914560) ===
|
|
workInProgressRootRenderLanes &&
|
|
300 > now() - globalMostRecentFallbackTime)
|
|
? 0 === (executionContext & 2) && prepareFreshStack(root, 0)
|
|
: (workInProgressRootPingedLanes |= pingedLanes));
|
|
ensureRootIsScheduled(root);
|
|
}
|
|
function retryTimedOutBoundary(boundaryFiber, retryLane) {
|
|
0 === retryLane &&
|
|
(retryLane = 0 === (boundaryFiber.mode & 1) ? 2 : claimNextRetryLane());
|
|
boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane);
|
|
null !== boundaryFiber &&
|
|
(markRootUpdated$1(boundaryFiber, retryLane),
|
|
ensureRootIsScheduled(boundaryFiber));
|
|
}
|
|
function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
var suspenseState = boundaryFiber.memoizedState,
|
|
retryLane = 0;
|
|
null !== suspenseState && (retryLane = suspenseState.retryLane);
|
|
retryTimedOutBoundary(boundaryFiber, retryLane);
|
|
}
|
|
function resolveRetryWakeable(boundaryFiber, wakeable) {
|
|
var retryLane = 0;
|
|
switch (boundaryFiber.tag) {
|
|
case 13:
|
|
var retryCache = boundaryFiber.stateNode;
|
|
var suspenseState = boundaryFiber.memoizedState;
|
|
null !== suspenseState && (retryLane = suspenseState.retryLane);
|
|
break;
|
|
case 19:
|
|
retryCache = boundaryFiber.stateNode;
|
|
break;
|
|
case 22:
|
|
retryCache = boundaryFiber.stateNode._retryCache;
|
|
break;
|
|
default:
|
|
throw Error(
|
|
"Pinged unknown suspense boundary type. This is probably a bug in React."
|
|
);
|
|
}
|
|
null !== retryCache && retryCache.delete(wakeable);
|
|
retryTimedOutBoundary(boundaryFiber, retryLane);
|
|
}
|
|
function scheduleCallback(priorityLevel, callback) {
|
|
return scheduleCallback$2(priorityLevel, callback);
|
|
}
|
|
function FiberNode(tag, pendingProps, key, mode) {
|
|
this.tag = tag;
|
|
this.key = key;
|
|
this.sibling =
|
|
this.child =
|
|
this.return =
|
|
this.stateNode =
|
|
this.type =
|
|
this.elementType =
|
|
null;
|
|
this.index = 0;
|
|
this.refCleanup = this.ref = null;
|
|
this.pendingProps = pendingProps;
|
|
this.dependencies =
|
|
this.memoizedState =
|
|
this.updateQueue =
|
|
this.memoizedProps =
|
|
null;
|
|
this.mode = mode;
|
|
this.subtreeFlags = this.flags = 0;
|
|
this.deletions = null;
|
|
this.childLanes = this.lanes = 0;
|
|
this.alternate = null;
|
|
}
|
|
function createFiber(tag, pendingProps, key, mode) {
|
|
return new FiberNode(tag, pendingProps, key, mode);
|
|
}
|
|
function shouldConstruct(Component) {
|
|
Component = Component.prototype;
|
|
return !(!Component || !Component.isReactComponent);
|
|
}
|
|
function resolveLazyComponentTag(Component) {
|
|
if ("function" === typeof Component)
|
|
return shouldConstruct(Component) ? 1 : 0;
|
|
if (void 0 !== Component && null !== Component) {
|
|
Component = Component.$$typeof;
|
|
if (Component === REACT_FORWARD_REF_TYPE) return 11;
|
|
if (Component === REACT_MEMO_TYPE) return 14;
|
|
}
|
|
return 2;
|
|
}
|
|
function createWorkInProgress(current, pendingProps) {
|
|
var workInProgress = current.alternate;
|
|
null === workInProgress
|
|
? ((workInProgress = createFiber(
|
|
current.tag,
|
|
pendingProps,
|
|
current.key,
|
|
current.mode
|
|
)),
|
|
(workInProgress.elementType = current.elementType),
|
|
(workInProgress.type = current.type),
|
|
(workInProgress.stateNode = current.stateNode),
|
|
(workInProgress.alternate = current),
|
|
(current.alternate = workInProgress))
|
|
: ((workInProgress.pendingProps = pendingProps),
|
|
(workInProgress.type = current.type),
|
|
(workInProgress.flags = 0),
|
|
(workInProgress.subtreeFlags = 0),
|
|
(workInProgress.deletions = null));
|
|
workInProgress.flags = current.flags & 31457280;
|
|
workInProgress.childLanes = current.childLanes;
|
|
workInProgress.lanes = current.lanes;
|
|
workInProgress.child = current.child;
|
|
workInProgress.memoizedProps = current.memoizedProps;
|
|
workInProgress.memoizedState = current.memoizedState;
|
|
workInProgress.updateQueue = current.updateQueue;
|
|
pendingProps = current.dependencies;
|
|
workInProgress.dependencies =
|
|
null === pendingProps
|
|
? null
|
|
: { lanes: pendingProps.lanes, firstContext: pendingProps.firstContext };
|
|
workInProgress.sibling = current.sibling;
|
|
workInProgress.index = current.index;
|
|
workInProgress.ref = current.ref;
|
|
workInProgress.refCleanup = current.refCleanup;
|
|
return workInProgress;
|
|
}
|
|
function resetWorkInProgress(workInProgress, renderLanes) {
|
|
workInProgress.flags &= 31457282;
|
|
var current = workInProgress.alternate;
|
|
null === current
|
|
? ((workInProgress.childLanes = 0),
|
|
(workInProgress.lanes = renderLanes),
|
|
(workInProgress.child = null),
|
|
(workInProgress.subtreeFlags = 0),
|
|
(workInProgress.memoizedProps = null),
|
|
(workInProgress.memoizedState = null),
|
|
(workInProgress.updateQueue = null),
|
|
(workInProgress.dependencies = null),
|
|
(workInProgress.stateNode = null))
|
|
: ((workInProgress.childLanes = current.childLanes),
|
|
(workInProgress.lanes = current.lanes),
|
|
(workInProgress.child = current.child),
|
|
(workInProgress.subtreeFlags = 0),
|
|
(workInProgress.deletions = null),
|
|
(workInProgress.memoizedProps = current.memoizedProps),
|
|
(workInProgress.memoizedState = current.memoizedState),
|
|
(workInProgress.updateQueue = current.updateQueue),
|
|
(workInProgress.type = current.type),
|
|
(renderLanes = current.dependencies),
|
|
(workInProgress.dependencies =
|
|
null === renderLanes
|
|
? null
|
|
: {
|
|
lanes: renderLanes.lanes,
|
|
firstContext: renderLanes.firstContext
|
|
}));
|
|
return workInProgress;
|
|
}
|
|
function createFiberFromTypeAndProps(
|
|
type,
|
|
key,
|
|
pendingProps,
|
|
owner,
|
|
mode,
|
|
lanes
|
|
) {
|
|
var fiberTag = 2;
|
|
owner = type;
|
|
if ("function" === typeof type) shouldConstruct(type) && (fiberTag = 1);
|
|
else if ("string" === typeof type) fiberTag = 5;
|
|
else
|
|
a: switch (type) {
|
|
case REACT_FRAGMENT_TYPE:
|
|
return createFiberFromFragment(pendingProps.children, mode, lanes, key);
|
|
case REACT_STRICT_MODE_TYPE:
|
|
fiberTag = 8;
|
|
mode |= 8;
|
|
0 !== (mode & 1) && (mode |= 16);
|
|
break;
|
|
case REACT_PROFILER_TYPE:
|
|
return (
|
|
(type = createFiber(12, pendingProps, key, mode | 2)),
|
|
(type.elementType = REACT_PROFILER_TYPE),
|
|
(type.lanes = lanes),
|
|
type
|
|
);
|
|
case REACT_SUSPENSE_TYPE:
|
|
return (
|
|
(type = createFiber(13, pendingProps, key, mode)),
|
|
(type.elementType = REACT_SUSPENSE_TYPE),
|
|
(type.lanes = lanes),
|
|
type
|
|
);
|
|
case REACT_SUSPENSE_LIST_TYPE:
|
|
return (
|
|
(type = createFiber(19, pendingProps, key, mode)),
|
|
(type.elementType = REACT_SUSPENSE_LIST_TYPE),
|
|
(type.lanes = lanes),
|
|
type
|
|
);
|
|
case REACT_OFFSCREEN_TYPE:
|
|
return createFiberFromOffscreen(pendingProps, mode, lanes, key);
|
|
default:
|
|
if ("object" === typeof type && null !== type)
|
|
switch (type.$$typeof) {
|
|
case REACT_PROVIDER_TYPE:
|
|
fiberTag = 10;
|
|
break a;
|
|
case REACT_CONTEXT_TYPE:
|
|
fiberTag = 9;
|
|
break a;
|
|
case REACT_CONSUMER_TYPE:
|
|
case REACT_FORWARD_REF_TYPE:
|
|
fiberTag = 11;
|
|
break a;
|
|
case REACT_MEMO_TYPE:
|
|
fiberTag = 14;
|
|
break a;
|
|
case REACT_LAZY_TYPE:
|
|
fiberTag = 16;
|
|
owner = null;
|
|
break a;
|
|
}
|
|
throw Error(
|
|
"Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " +
|
|
((null == type ? type : typeof type) + ".")
|
|
);
|
|
}
|
|
key = createFiber(fiberTag, pendingProps, key, mode);
|
|
key.elementType = type;
|
|
key.type = owner;
|
|
key.lanes = lanes;
|
|
return key;
|
|
}
|
|
function createFiberFromFragment(elements, mode, lanes, key) {
|
|
elements = createFiber(7, elements, key, mode);
|
|
elements.lanes = lanes;
|
|
return elements;
|
|
}
|
|
function createFiberFromOffscreen(pendingProps, mode, lanes, key) {
|
|
pendingProps = createFiber(22, pendingProps, key, mode);
|
|
pendingProps.elementType = REACT_OFFSCREEN_TYPE;
|
|
pendingProps.lanes = lanes;
|
|
var primaryChildInstance = {
|
|
_visibility: 1,
|
|
_pendingVisibility: 1,
|
|
_pendingMarkers: null,
|
|
_retryCache: null,
|
|
_transitions: null,
|
|
_current: null,
|
|
detach: function () {
|
|
var fiber = primaryChildInstance._current;
|
|
if (null === fiber)
|
|
throw Error(
|
|
"Calling Offscreen.detach before instance handle has been set."
|
|
);
|
|
if (0 === (primaryChildInstance._pendingVisibility & 2)) {
|
|
var root = enqueueConcurrentRenderForLane(fiber, 2);
|
|
null !== root &&
|
|
((primaryChildInstance._pendingVisibility |= 2),
|
|
scheduleUpdateOnFiber(root, fiber, 2));
|
|
}
|
|
},
|
|
attach: function () {
|
|
var fiber = primaryChildInstance._current;
|
|
if (null === fiber)
|
|
throw Error(
|
|
"Calling Offscreen.detach before instance handle has been set."
|
|
);
|
|
if (0 !== (primaryChildInstance._pendingVisibility & 2)) {
|
|
var root = enqueueConcurrentRenderForLane(fiber, 2);
|
|
null !== root &&
|
|
((primaryChildInstance._pendingVisibility &= -3),
|
|
scheduleUpdateOnFiber(root, fiber, 2));
|
|
}
|
|
}
|
|
};
|
|
pendingProps.stateNode = primaryChildInstance;
|
|
return pendingProps;
|
|
}
|
|
function createFiberFromText(content, mode, lanes) {
|
|
content = createFiber(6, content, null, mode);
|
|
content.lanes = lanes;
|
|
return content;
|
|
}
|
|
function createFiberFromPortal(portal, mode, lanes) {
|
|
mode = createFiber(
|
|
4,
|
|
null !== portal.children ? portal.children : [],
|
|
portal.key,
|
|
mode
|
|
);
|
|
mode.lanes = lanes;
|
|
mode.stateNode = {
|
|
containerInfo: portal.containerInfo,
|
|
pendingChildren: null,
|
|
implementation: portal.implementation
|
|
};
|
|
return mode;
|
|
}
|
|
function FiberRootNode(
|
|
containerInfo,
|
|
tag,
|
|
hydrate,
|
|
identifierPrefix,
|
|
onRecoverableError,
|
|
formState
|
|
) {
|
|
this.tag = tag;
|
|
this.containerInfo = containerInfo;
|
|
this.finishedWork =
|
|
this.pingCache =
|
|
this.current =
|
|
this.pendingChildren =
|
|
null;
|
|
this.timeoutHandle = -1;
|
|
this.callbackNode =
|
|
this.next =
|
|
this.pendingContext =
|
|
this.context =
|
|
this.cancelPendingCommit =
|
|
null;
|
|
this.callbackPriority = 0;
|
|
this.expirationTimes = createLaneMap(-1);
|
|
this.entangledLanes =
|
|
this.shellSuspendCounter =
|
|
this.errorRecoveryDisabledLanes =
|
|
this.finishedLanes =
|
|
this.expiredLanes =
|
|
this.pingedLanes =
|
|
this.suspendedLanes =
|
|
this.pendingLanes =
|
|
0;
|
|
this.entanglements = createLaneMap(0);
|
|
this.hiddenUpdates = createLaneMap(null);
|
|
this.identifierPrefix = identifierPrefix;
|
|
this.onRecoverableError = onRecoverableError;
|
|
this.formState = formState;
|
|
this.incompleteTransitions = new Map();
|
|
}
|
|
function createPortal$1(children, containerInfo, implementation) {
|
|
var key =
|
|
3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null;
|
|
return {
|
|
$$typeof: REACT_PORTAL_TYPE,
|
|
key: null == key ? null : "" + key,
|
|
children: children,
|
|
containerInfo: containerInfo,
|
|
implementation: implementation
|
|
};
|
|
}
|
|
function findHostInstance(component) {
|
|
var fiber = component._reactInternals;
|
|
if (void 0 === fiber) {
|
|
if ("function" === typeof component.render)
|
|
throw Error("Unable to find node on an unmounted component.");
|
|
component = Object.keys(component).join(",");
|
|
throw Error(
|
|
"Argument appears to not be a ReactComponent. Keys: " + component
|
|
);
|
|
}
|
|
component = findCurrentHostFiber(fiber);
|
|
return null === component ? null : getPublicInstance(component.stateNode);
|
|
}
|
|
function updateContainer(element, container, parentComponent, callback) {
|
|
parentComponent = container.current;
|
|
var lane = requestUpdateLane(parentComponent);
|
|
null === container.context
|
|
? (container.context = emptyContextObject)
|
|
: (container.pendingContext = emptyContextObject);
|
|
container = createUpdate(lane);
|
|
container.payload = { element: element };
|
|
callback = void 0 === callback ? null : callback;
|
|
null !== callback && (container.callback = callback);
|
|
element = enqueueUpdate(parentComponent, container, lane);
|
|
null !== element &&
|
|
(scheduleUpdateOnFiber(element, parentComponent, lane),
|
|
entangleTransitions(element, parentComponent, lane));
|
|
return lane;
|
|
}
|
|
function emptyFindFiberByHostInstance() {
|
|
return null;
|
|
}
|
|
function findNodeHandle(componentOrHandle) {
|
|
if (null == componentOrHandle) return null;
|
|
if ("number" === typeof componentOrHandle) return componentOrHandle;
|
|
if (componentOrHandle._nativeTag) return componentOrHandle._nativeTag;
|
|
if (
|
|
null != componentOrHandle.canonical &&
|
|
null != componentOrHandle.canonical.nativeTag
|
|
)
|
|
return componentOrHandle.canonical.nativeTag;
|
|
var nativeTag =
|
|
ReactNativePrivateInterface.getNativeTagFromPublicInstance(
|
|
componentOrHandle
|
|
);
|
|
if (nativeTag) return nativeTag;
|
|
componentOrHandle = findHostInstance(componentOrHandle);
|
|
return null == componentOrHandle
|
|
? componentOrHandle
|
|
: null != componentOrHandle._nativeTag
|
|
? componentOrHandle._nativeTag
|
|
: ReactNativePrivateInterface.getNativeTagFromPublicInstance(
|
|
componentOrHandle
|
|
);
|
|
}
|
|
function getInspectorDataForInstance() {
|
|
throw Error("getInspectorDataForInstance() is not available in production");
|
|
}
|
|
function onRecoverableError(error) {
|
|
console.error(error);
|
|
}
|
|
function unmountComponentAtNode(containerTag) {
|
|
var root = roots.get(containerTag);
|
|
root &&
|
|
updateContainer(null, root, null, function () {
|
|
roots.delete(containerTag);
|
|
});
|
|
}
|
|
batchedUpdatesImpl = function (fn, a) {
|
|
var prevExecutionContext = executionContext;
|
|
executionContext |= 1;
|
|
try {
|
|
return fn(a);
|
|
} finally {
|
|
(executionContext = prevExecutionContext),
|
|
0 === executionContext &&
|
|
((workInProgressRootRenderTargetTime = now() + 500),
|
|
flushSyncWorkAcrossRoots_impl(!0));
|
|
}
|
|
};
|
|
var roots = new Map(),
|
|
devToolsConfig$jscomp$inline_1100 = {
|
|
findFiberByHostInstance: getInstanceFromTag,
|
|
bundleType: 0,
|
|
version: "18.3.0-canary-9372c6311-20240315",
|
|
rendererPackageName: "react-native-renderer",
|
|
rendererConfig: {
|
|
getInspectorDataForInstance: getInspectorDataForInstance,
|
|
getInspectorDataForViewTag: function () {
|
|
throw Error(
|
|
"getInspectorDataForViewTag() is not available in production"
|
|
);
|
|
},
|
|
getInspectorDataForViewAtPoint: function () {
|
|
throw Error(
|
|
"getInspectorDataForViewAtPoint() is not available in production."
|
|
);
|
|
}.bind(null, findNodeHandle)
|
|
}
|
|
};
|
|
var internals$jscomp$inline_1342 = {
|
|
bundleType: devToolsConfig$jscomp$inline_1100.bundleType,
|
|
version: devToolsConfig$jscomp$inline_1100.version,
|
|
rendererPackageName: devToolsConfig$jscomp$inline_1100.rendererPackageName,
|
|
rendererConfig: devToolsConfig$jscomp$inline_1100.rendererConfig,
|
|
overrideHookState: null,
|
|
overrideHookStateDeletePath: null,
|
|
overrideHookStateRenamePath: null,
|
|
overrideProps: null,
|
|
overridePropsDeletePath: null,
|
|
overridePropsRenamePath: null,
|
|
setErrorHandler: null,
|
|
setSuspenseHandler: null,
|
|
scheduleUpdate: null,
|
|
currentDispatcherRef: ReactSharedInternals.ReactCurrentDispatcher,
|
|
findHostInstanceByFiber: function (fiber) {
|
|
fiber = findCurrentHostFiber(fiber);
|
|
return null === fiber ? null : fiber.stateNode;
|
|
},
|
|
findFiberByHostInstance:
|
|
devToolsConfig$jscomp$inline_1100.findFiberByHostInstance ||
|
|
emptyFindFiberByHostInstance,
|
|
findHostInstancesForRefresh: null,
|
|
scheduleRefresh: null,
|
|
scheduleRoot: null,
|
|
setRefreshHandler: null,
|
|
getCurrentFiber: null,
|
|
reconcilerVersion: "18.3.0-canary-9372c6311-20240315"
|
|
};
|
|
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
|
var hook$jscomp$inline_1343 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
|
if (
|
|
!hook$jscomp$inline_1343.isDisabled &&
|
|
hook$jscomp$inline_1343.supportsFiber
|
|
)
|
|
try {
|
|
(rendererID = hook$jscomp$inline_1343.inject(
|
|
internals$jscomp$inline_1342
|
|
)),
|
|
(injectedHook = hook$jscomp$inline_1343);
|
|
} catch (err) {}
|
|
}
|
|
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
|
|
computeComponentStackForErrorReporting: function (reactTag) {
|
|
return (reactTag = getInstanceFromTag(reactTag))
|
|
? getStackByFiberInDevAndProd(reactTag)
|
|
: "";
|
|
}
|
|
};
|
|
exports.createPortal = function (children, containerTag) {
|
|
return createPortal$1(
|
|
children,
|
|
containerTag,
|
|
null,
|
|
2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null
|
|
);
|
|
};
|
|
exports.dispatchCommand = function (handle, command, args) {
|
|
var nativeTag =
|
|
null != handle._nativeTag
|
|
? handle._nativeTag
|
|
: ReactNativePrivateInterface.getNativeTagFromPublicInstance(handle);
|
|
null != nativeTag &&
|
|
((handle = ReactNativePrivateInterface.getNodeFromPublicInstance(handle)),
|
|
null != handle
|
|
? nativeFabricUIManager.dispatchCommand(handle, command, args)
|
|
: ReactNativePrivateInterface.UIManager.dispatchViewManagerCommand(
|
|
nativeTag,
|
|
command,
|
|
args
|
|
));
|
|
};
|
|
exports.findHostInstance_DEPRECATED = function (componentOrHandle) {
|
|
return null == componentOrHandle
|
|
? null
|
|
: componentOrHandle.canonical && componentOrHandle.canonical.publicInstance
|
|
? componentOrHandle.canonical.publicInstance
|
|
: componentOrHandle._nativeTag
|
|
? componentOrHandle
|
|
: findHostInstance(componentOrHandle);
|
|
};
|
|
exports.findNodeHandle = findNodeHandle;
|
|
exports.getInspectorDataForInstance = getInspectorDataForInstance;
|
|
exports.isChildPublicInstance = function () {
|
|
throw Error("isChildPublicInstance() is not available in production.");
|
|
};
|
|
exports.render = function (element, containerTag, callback) {
|
|
var root = roots.get(containerTag);
|
|
if (!root) {
|
|
root = new FiberRootNode(containerTag, 0, !1, "", onRecoverableError, null);
|
|
var JSCompiler_inline_result = createFiber(3, null, null, 0);
|
|
root.current = JSCompiler_inline_result;
|
|
JSCompiler_inline_result.stateNode = root;
|
|
JSCompiler_inline_result.memoizedState = {
|
|
element: null,
|
|
isDehydrated: !1,
|
|
cache: null
|
|
};
|
|
initializeUpdateQueue(JSCompiler_inline_result);
|
|
roots.set(containerTag, root);
|
|
}
|
|
updateContainer(element, root, null, callback);
|
|
a: if (((element = root.current), element.child))
|
|
switch (element.child.tag) {
|
|
case 27:
|
|
case 5:
|
|
element = getPublicInstance(element.child.stateNode);
|
|
break a;
|
|
default:
|
|
element = element.child.stateNode;
|
|
}
|
|
else element = null;
|
|
return element;
|
|
};
|
|
exports.sendAccessibilityEvent = function (handle, eventType) {
|
|
var nativeTag =
|
|
null != handle._nativeTag
|
|
? handle._nativeTag
|
|
: ReactNativePrivateInterface.getNativeTagFromPublicInstance(handle);
|
|
null != nativeTag &&
|
|
((handle = ReactNativePrivateInterface.getNodeFromPublicInstance(handle)),
|
|
null != handle
|
|
? nativeFabricUIManager.sendAccessibilityEvent(handle, eventType)
|
|
: ReactNativePrivateInterface.legacySendAccessibilityEvent(
|
|
nativeTag,
|
|
eventType
|
|
));
|
|
};
|
|
exports.unmountComponentAtNode = unmountComponentAtNode;
|
|
exports.unmountComponentAtNodeAndRemoveContainer = function (containerTag) {
|
|
unmountComponentAtNode(containerTag);
|
|
ReactNativePrivateInterface.UIManager.removeRootView(containerTag);
|
|
};
|
|
exports.unstable_batchedUpdates = batchedUpdates$1;
|