react-native
Version:
A framework for building native apps using React
1,402 lines (1,397 loc) • 636 kB
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
* @preventMunge
* @generated SignedSource<<e233b479345be01ec0cc3c6e337839a2>>
*
* This file was sync'd from the facebook/react repository.
*/
"use strict";
__DEV__ &&
(function () {
function commitMount() {
throw Error(
"The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue."
);
}
function findHook(fiber, id) {
for (fiber = fiber.memoizedState; null !== fiber && 0 < id; )
(fiber = fiber.next), id--;
return fiber;
}
function copyWithSetImpl(obj, path, index, value) {
if (index >= path.length) return value;
var key = path[index],
updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
updated[key] = copyWithSetImpl(obj[key], path, index + 1, value);
return updated;
}
function copyWithRename(obj, oldPath, newPath) {
if (oldPath.length !== newPath.length)
warn("copyWithRename() expects paths of the same length");
else {
for (var i = 0; i < newPath.length - 1; i++)
if (oldPath[i] !== newPath[i]) {
warn(
"copyWithRename() expects paths to be the same except for the deepest key"
);
return;
}
return copyWithRenameImpl(obj, oldPath, newPath, 0);
}
}
function copyWithRenameImpl(obj, oldPath, newPath, index) {
var oldKey = oldPath[index],
updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
index + 1 === oldPath.length
? ((updated[newPath[index]] = updated[oldKey]),
isArrayImpl(updated)
? updated.splice(oldKey, 1)
: delete updated[oldKey])
: (updated[oldKey] = copyWithRenameImpl(
obj[oldKey],
oldPath,
newPath,
index + 1
));
return updated;
}
function copyWithDeleteImpl(obj, path, index) {
var key = path[index],
updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
if (index + 1 === path.length)
return (
isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key],
updated
);
updated[key] = copyWithDeleteImpl(obj[key], path, index + 1);
return updated;
}
function shouldSuspendImpl() {
return !1;
}
function shouldErrorImpl() {
return null;
}
function createFiber(tag, pendingProps, key, mode) {
return new FiberNode(tag, pendingProps, key, mode);
}
function scheduleRoot(root, element) {
root.context === emptyContextObject &&
(0 === root.tag && flushPassiveEffects(),
updateContainerImpl(root.current, 2, element, root, null, null),
flushSyncWork());
}
function scheduleRefresh(root, update) {
if (null !== resolveFamily) {
var staleFamilies = update.staleFamilies;
update = update.updatedFamilies;
flushPassiveEffects();
scheduleFibersWithFamiliesRecursively(
root.current,
update,
staleFamilies
);
flushSyncWork();
}
}
function setRefreshHandler(handler) {
resolveFamily = handler;
}
function warnInvalidHookAccess() {
error$jscomp$0(
"Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://react.dev/link/rules-of-hooks"
);
}
function warnInvalidContextAccess() {
error$jscomp$0(
"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()."
);
}
function warnForMissingKey() {}
function setToSortedString(set) {
var array = [];
set.forEach(function (value) {
array.push(value);
});
return array.sort().join(", ");
}
function batchedUpdatesImpl(fn, bookkeeping) {
return fn(bookkeeping);
}
function warn(format) {
if (!suppressWarning) {
for (
var _len = arguments.length,
args = Array(1 < _len ? _len - 1 : 0),
_key = 1;
_key < _len;
_key++
)
args[_key - 1] = arguments[_key];
printWarning("warn", format, args);
}
}
function error$jscomp$0(format) {
if (!suppressWarning) {
for (
var _len2 = arguments.length,
args = Array(1 < _len2 ? _len2 - 1 : 0),
_key2 = 1;
_key2 < _len2;
_key2++
)
args[_key2 - 1] = arguments[_key2];
printWarning("error", format, args);
}
}
function printWarning(level, format, args) {
if (ReactSharedInternals.getCurrentStack) {
var stack = ReactSharedInternals.getCurrentStack();
"" !== stack && ((format += "%s"), (args = args.concat([stack])));
}
args.unshift(format);
Function.prototype.apply.call(console[level], console, args);
}
function getIteratorFn(maybeIterable) {
if (null === maybeIterable || "object" !== typeof maybeIterable)
return null;
maybeIterable =
(MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
maybeIterable["@@iterator"];
return "function" === typeof maybeIterable ? maybeIterable : null;
}
function disabledLog() {}
function disableLogs() {
if (0 === disabledDepth) {
prevLog = console.log;
prevInfo = console.info;
prevWarn = console.warn;
prevError = console.error;
prevGroup = console.group;
prevGroupCollapsed = console.groupCollapsed;
prevGroupEnd = console.groupEnd;
var props = {
configurable: !0,
enumerable: !0,
value: disabledLog,
writable: !0
};
Object.defineProperties(console, {
info: props,
log: props,
warn: props,
error: props,
group: props,
groupCollapsed: props,
groupEnd: props
});
}
disabledDepth++;
}
function reenableLogs() {
disabledDepth--;
if (0 === disabledDepth) {
var props = { configurable: !0, enumerable: !0, writable: !0 };
Object.defineProperties(console, {
log: assign({}, props, { value: prevLog }),
info: assign({}, props, { value: prevInfo }),
warn: assign({}, props, { value: prevWarn }),
error: assign({}, props, { value: prevError }),
group: assign({}, props, { value: prevGroup }),
groupCollapsed: assign({}, props, { value: prevGroupCollapsed }),
groupEnd: assign({}, props, { value: prevGroupEnd })
});
}
0 > disabledDepth &&
error$jscomp$0(
"disabledDepth fell below zero. This is a bug in React. Please file an issue."
);
}
function describeBuiltInComponentFrame(name) {
if (void 0 === prefix)
try {
throw Error();
} catch (x) {
var match = x.stack.trim().match(/\n( *(at )?)/);
prefix = (match && match[1]) || "";
suffix =
-1 < x.stack.indexOf("\n at")
? " (<anonymous>)"
: -1 < x.stack.indexOf("@")
? "@unknown:0:0"
: "";
}
return "\n" + prefix + name + suffix;
}
function describeNativeComponentFrame(fn, construct) {
if (!fn || reentry) return "";
var frame = componentFrameCache.get(fn);
if (void 0 !== frame) return frame;
reentry = !0;
frame = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var previousDispatcher = null;
previousDispatcher = ReactSharedInternals.H;
ReactSharedInternals.H = null;
disableLogs();
try {
var RunInRootFrame = {
DetermineComponentFrameRoot: function () {
try {
if (construct) {
var Fake = function () {
throw Error();
};
Object.defineProperty(Fake.prototype, "props", {
set: function () {
throw Error();
}
});
if ("object" === typeof Reflect && Reflect.construct) {
try {
Reflect.construct(Fake, []);
} catch (x) {
var control = x;
}
Reflect.construct(fn, [], Fake);
} else {
try {
Fake.call();
} catch (x$0) {
control = x$0;
}
fn.call(Fake.prototype);
}
} else {
try {
throw Error();
} catch (x$1) {
control = x$1;
}
(Fake = fn()) &&
"function" === typeof Fake.catch &&
Fake.catch(function () {});
}
} catch (sample) {
if (sample && control && "string" === typeof sample.stack)
return [sample.stack, control.stack];
}
return [null, null];
}
};
RunInRootFrame.DetermineComponentFrameRoot.displayName =
"DetermineComponentFrameRoot";
var namePropDescriptor = Object.getOwnPropertyDescriptor(
RunInRootFrame.DetermineComponentFrameRoot,
"name"
);
namePropDescriptor &&
namePropDescriptor.configurable &&
Object.defineProperty(
RunInRootFrame.DetermineComponentFrameRoot,
"name",
{ value: "DetermineComponentFrameRoot" }
);
var _RunInRootFrame$Deter =
RunInRootFrame.DetermineComponentFrameRoot(),
sampleStack = _RunInRootFrame$Deter[0],
controlStack = _RunInRootFrame$Deter[1];
if (sampleStack && controlStack) {
var sampleLines = sampleStack.split("\n"),
controlLines = controlStack.split("\n");
for (
_RunInRootFrame$Deter = namePropDescriptor = 0;
namePropDescriptor < sampleLines.length &&
!sampleLines[namePropDescriptor].includes(
"DetermineComponentFrameRoot"
);
)
namePropDescriptor++;
for (
;
_RunInRootFrame$Deter < controlLines.length &&
!controlLines[_RunInRootFrame$Deter].includes(
"DetermineComponentFrameRoot"
);
)
_RunInRootFrame$Deter++;
if (
namePropDescriptor === sampleLines.length ||
_RunInRootFrame$Deter === controlLines.length
)
for (
namePropDescriptor = sampleLines.length - 1,
_RunInRootFrame$Deter = controlLines.length - 1;
1 <= namePropDescriptor &&
0 <= _RunInRootFrame$Deter &&
sampleLines[namePropDescriptor] !==
controlLines[_RunInRootFrame$Deter];
)
_RunInRootFrame$Deter--;
for (
;
1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter;
namePropDescriptor--, _RunInRootFrame$Deter--
)
if (
sampleLines[namePropDescriptor] !==
controlLines[_RunInRootFrame$Deter]
) {
if (1 !== namePropDescriptor || 1 !== _RunInRootFrame$Deter) {
do
if (
(namePropDescriptor--,
_RunInRootFrame$Deter--,
0 > _RunInRootFrame$Deter ||
sampleLines[namePropDescriptor] !==
controlLines[_RunInRootFrame$Deter])
) {
var _frame =
"\n" +
sampleLines[namePropDescriptor].replace(
" at new ",
" at "
);
fn.displayName &&
_frame.includes("<anonymous>") &&
(_frame = _frame.replace("<anonymous>", fn.displayName));
"function" === typeof fn &&
componentFrameCache.set(fn, _frame);
return _frame;
}
while (1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter);
}
break;
}
}
} finally {
(reentry = !1),
(ReactSharedInternals.H = previousDispatcher),
reenableLogs(),
(Error.prepareStackTrace = frame);
}
sampleLines = (sampleLines = fn ? fn.displayName || fn.name : "")
? describeBuiltInComponentFrame(sampleLines)
: "";
"function" === typeof fn && componentFrameCache.set(fn, sampleLines);
return sampleLines;
}
function describeFiber(fiber) {
switch (fiber.tag) {
case 26:
case 27:
case 5:
return describeBuiltInComponentFrame(fiber.type);
case 16:
return describeBuiltInComponentFrame("Lazy");
case 13:
return describeBuiltInComponentFrame("Suspense");
case 19:
return describeBuiltInComponentFrame("SuspenseList");
case 0:
case 15:
return (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber;
case 11:
return (
(fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber
);
case 1:
return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber;
default:
return "";
}
}
function getStackByFiberInDevAndProd(workInProgress) {
try {
var info = "";
do {
info += describeFiber(workInProgress);
var debugInfo = workInProgress._debugInfo;
if (debugInfo)
for (var i = debugInfo.length - 1; 0 <= i; i--) {
var entry = debugInfo[i];
if ("string" === typeof entry.name) {
var JSCompiler_temp_const = info,
env = entry.env;
var JSCompiler_inline_result = describeBuiltInComponentFrame(
entry.name + (env ? " [" + env + "]" : "")
);
info = JSCompiler_temp_const + JSCompiler_inline_result;
}
}
workInProgress = workInProgress.return;
} while (workInProgress);
return info;
} catch (x) {
return "\nError generating stack: " + x.message + "\n" + x.stack;
}
}
function getComponentNameFromType(type) {
if (null == type) return null;
if ("function" === typeof type)
return type.$$typeof === REACT_CLIENT_REFERENCE
? null
: type.displayName || type.name || null;
if ("string" === typeof type) return type;
switch (type) {
case REACT_FRAGMENT_TYPE:
return "Fragment";
case REACT_PORTAL_TYPE:
return "Portal";
case REACT_PROFILER_TYPE:
return "Profiler";
case REACT_STRICT_MODE_TYPE:
return "StrictMode";
case REACT_SUSPENSE_TYPE:
return "Suspense";
case REACT_SUSPENSE_LIST_TYPE:
return "SuspenseList";
}
if ("object" === typeof type)
switch (
("number" === typeof type.tag &&
error$jscomp$0(
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
),
type.$$typeof)
) {
case REACT_CONTEXT_TYPE:
return (type.displayName || "Context") + ".Provider";
case REACT_CONSUMER_TYPE:
return (type._context.displayName || "Context") + ".Consumer";
case REACT_FORWARD_REF_TYPE:
var innerType = type.render;
type = type.displayName;
type ||
((type = innerType.displayName || innerType.name || ""),
(type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
return type;
case REACT_MEMO_TYPE:
return (
(innerType = type.displayName || null),
null !== innerType
? innerType
: getComponentNameFromType(type.type) || "Memo"
);
case REACT_LAZY_TYPE:
innerType = type._payload;
type = type._init;
try {
return getComponentNameFromType(type(innerType));
} catch (x) {}
}
return null;
}
function getComponentNameFromFiber(fiber) {
var type = fiber.type;
switch (fiber.tag) {
case 24:
return "Cache";
case 9:
return (type._context.displayName || "Context") + ".Consumer";
case 10:
return (type.displayName || "Context") + ".Provider";
case 18:
return "DehydratedFragment";
case 11:
return (
(fiber = type.render),
(fiber = fiber.displayName || fiber.name || ""),
type.displayName ||
("" !== fiber ? "ForwardRef(" + fiber + ")" : "ForwardRef")
);
case 7:
return "Fragment";
case 26:
case 27:
case 5:
return type;
case 4:
return "Portal";
case 3:
return "Root";
case 6:
return "Text";
case 16:
return getComponentNameFromType(type);
case 8:
return type === REACT_STRICT_MODE_TYPE ? "StrictMode" : "Mode";
case 22:
return "Offscreen";
case 12:
return "Profiler";
case 21:
return "Scope";
case 13:
return "Suspense";
case 19:
return "SuspenseList";
case 25:
return "TracingMarker";
case 17:
case 28:
case 1:
case 0:
case 14:
case 15:
if ("function" === typeof type)
return type.displayName || type.name || null;
if ("string" === typeof type) return type;
break;
case 29:
type = fiber._debugInfo;
if (null != type)
for (var i = type.length - 1; 0 <= i; i--)
if ("string" === typeof type[i].name) return type[i].name;
if (null !== fiber.return)
return getComponentNameFromFiber(fiber.return);
}
return null;
}
function getCurrentFiberStackInDev() {
return null === current ? "" : getStackByFiberInDevAndProd(current);
}
function runWithFiberInDEV(fiber, callback, arg0, arg1, arg2, arg3, arg4) {
var previousFiber = current;
ReactSharedInternals.getCurrentStack =
null === fiber ? null : getCurrentFiberStackInDev;
isRendering = !1;
current = fiber;
try {
return callback(arg0, arg1, arg2, arg3, arg4);
} finally {
current = previousFiber;
}
throw Error(
"runWithFiberInDEV should never be called in production. This is a bug in React."
);
}
function validateEventDispatches(event) {
var dispatchListeners = event._dispatchListeners,
dispatchInstances = event._dispatchInstances;
dispatchListeners = (event = isArrayImpl(dispatchListeners))
? dispatchListeners.length
: dispatchListeners
? 1
: 0;
var instancesIsArr = isArrayImpl(dispatchInstances);
dispatchInstances = instancesIsArr
? dispatchInstances.length
: dispatchInstances
? 1
: 0;
(instancesIsArr === event && dispatchInstances === dispatchListeners) ||
error$jscomp$0("EventPluginUtils: Invalid `event`.");
}
function executeDispatch(event, listener, inst) {
event.currentTarget = getNodeFromInstance$1(inst);
try {
listener(event);
} catch (error$2) {
hasError || ((hasError = !0), (caughtError = error$2));
}
event.currentTarget = null;
}
function executeDirectDispatch(event) {
validateEventDispatches(event);
var dispatchListener = event._dispatchListeners,
dispatchInstance = event._dispatchInstances;
if (isArrayImpl(dispatchListener)) throw Error("Invalid `event`.");
event.currentTarget = dispatchListener
? getNodeFromInstance$1(dispatchInstance)
: null;
dispatchListener = dispatchListener ? dispatchListener(event) : null;
event.currentTarget = null;
event._dispatchListeners = null;
event._dispatchInstances = null;
return dispatchListener;
}
function functionThatReturnsTrue() {
return !0;
}
function functionThatReturnsFalse() {
return !1;
}
function SyntheticEvent(
dispatchConfig,
targetInst,
nativeEvent,
nativeEventTarget
) {
delete this.nativeEvent;
delete this.preventDefault;
delete this.stopPropagation;
delete this.isDefaultPrevented;
delete this.isPropagationStopped;
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) &&
(delete this[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;
}
function getPooledWarningPropertyDefinition(propName, getVal) {
function warn(action, result) {
error$jscomp$0(
"This synthetic event is reused for performance reasons. If you're seeing this, you're %s `%s` on a released/nullified synthetic event. %s. If you must keep the original synthetic event around, use event.persist(). See https://react.dev/link/event-pooling for more information.",
action,
propName,
result
);
}
var isFunction = "function" === typeof getVal;
return {
configurable: !0,
set: function (val) {
warn(
isFunction ? "setting the method" : "setting the property",
"This is effectively a no-op"
);
return val;
},
get: function () {
warn(
isFunction ? "accessing the method" : "accessing the property",
isFunction ? "This is a no-op function" : "This is set to null"
);
return getVal;
}
};
}
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;
}
function isStartish(topLevelType) {
return "topTouchStart" === topLevelType;
}
function isMoveish(topLevelType) {
return "topTouchMove" === topLevelType;
}
function timestampForTouch(touch) {
return touch.timeStamp || touch.timestamp;
}
function getTouchIdentifier(_ref) {
_ref = _ref.identifier;
if (null == _ref) throw Error("Touch object is missing identifier.");
20 < _ref &&
error$jscomp$0(
"Touch identifier %s is greater than maximum supported %s which causes performance issues backfilling array locations for all of the indices.",
_ref,
20
);
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)))
: warn(
"Cannot record touch move without a touch start.\nTouch Move: %s\nTouch Bank: %s",
printTouch(touch),
printTouchBank()
);
}
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)))
: warn(
"Cannot record touch end without a touch start.\nTouch End: %s\nTouch Bank: %s",
printTouch(touch),
printTouchBank()
);
}
function printTouch(touch) {
return JSON.stringify({
identifier: touch.identifier,
pageX: touch.pageX,
pageY: touch.pageY,
timestamp: timestampForTouch(touch)
});
}
function printTouchBank() {
var printed = JSON.stringify(touchBank.slice(0, 20));
20 < touchBank.length &&
(printed += " (original size: " + touchBank.length + ")");
return printed;
}
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);
}
function changeResponder(nextResponderInst, blockHostResponder) {
var oldResponderInst = responderInst;
responderInst = nextResponderInst;
if (null !== ResponderEventPlugin.GlobalResponderHandler)
ResponderEventPlugin.GlobalResponderHandler.onChange(
oldResponderInst,
nextResponderInst,
blockHostResponder
);
}
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) {
inst || error$jscomp$0("Dispatching inst must not be null");
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
);
}
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],
pluginModule$jscomp$0 = pluginModule,
eventName$jscomp$0 = eventName;
if (eventNameDispatchConfigs.hasOwnProperty(eventName$jscomp$0))
throw Error(
"EventPluginRegistry: More than one plugin attempted to publish the same event name, `" +
(eventName$jscomp$0 + "`.")
);
eventNameDispatchConfigs[eventName$jscomp$0] = dispatchConfig;
if (
(eventName$jscomp$0 = dispatchConfig.phasedRegistrationNames)
) {
for (JSCompiler_inline_result in eventName$jscomp$0)
eventName$jscomp$0.hasOwnProperty(JSCompiler_inline_result) &&
publishRegistrationName(
eventName$jscomp$0[JSCompiler_inline_result],
pluginModule$jscomp$0
);
JSCompiler_inline_result = !0;
} else
dispatchConfig.registrationName
? (publishRegistrationName(
dispatchConfig.registrationName,
pluginModule$jscomp$0
),
(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;
registrationName.toLowerCase();
}
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;
}
function accumulateDirectionalDispatches(inst, phase, event) {
inst || error$jscomp$0("Dispatching inst must not be null");
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
)));
}
}
}
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$1,
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$1,
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 in prevProps)
void 0 === nextProps[_propKey] &&
(!(attributeConfig = validAttributes[_propKey]) ||
(updatePayload && void 0 !== updatePayload[_propKey]) ||
((prevProp = prevProps[_propKey]),
void 0 !== prevProp &&
("object" !== typeof attributeConfig ||
"function" === typeof attributeConfig.diff ||
"function" === typeof attributeConfig.process
? (((updatePayload || (updatePayload = {}))[_propKey] = null),
removedKeys || (removedKeys = {}),
removedKeys[_propKey] ||
((removedKeys[_propKey] = !0), removedKeyCount++))
: (updatePayload = clearNestedProperty(
updatePayload,
prevProp,
attributeConfig
)))));
return updatePayload;
}
function fastAddProperties(payload, props, validAttributes) {
if (isArrayImpl(props)) {
for (var i = 0; i < props.length; i++)
payload = fastAddProperties(payload, props[i], validAttributes);
return payload;
}
for (i in props) {
var prop = props[i],
attributeConfig = validAttributes[i];
if (null != attributeConfig) {
var newValue = void 0;
if (void 0 === prop)
if (payload && void 0 !== payload[i]) newValue = null;
else continue;
else
"function" === typeof prop
? (newValue = !0)
: "object" !== typeof attributeConfig
? (newValue = prop)
: "function" === typeof attributeConfig.process
? (newValue = attributeConfig.process(prop))
: "function" === typeof attributeConfig.diff &&
(newValue = prop);
void 0 !== newValue
? (payload || (payload = {}), (payload[i] = newValue))
: (payload = fastAddProperties(payload, prop, attributeConfig));
}
}
return payload;
}
function batchedUpdates$1(fn, bookkeeping) {
if (isInsideEventHandler) return fn(bookkeeping);
isInsideEventHandler = !0;
try {
return batchedUpdatesImpl(fn, bookkeeping);
} finally {
isInsideEventHandler = !1;
}
}
function executeDispatchesAndReleaseTopLevel(e) {
if (e) {
var dispatchListeners = e._dispatchListeners,
dispatchInstances = e._dispatchInstances;
validateEventDispatches(e);
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);
}
}
function dispatchEvent(target, topLevelType, nativeEvent) {
var eventTarget = null;
if (null != target) {
var stateNode = target.stateNode;
null != stateNode && (eventTarget = getPublicInstance(stateNode));
}
batchedUpdates$1(function () {
var event = { eventName: topLevelType, nativeEvent: nativeEvent };
ReactNativePrivateInterface.RawEventEmitter.emit(topLevelType, event);
ReactNativePrivateInterface.RawEventEmitter.emit("*", event);
event = eventTarget;
for (
var events = null, legacyPlugins = plugins, i = 0;
i < legacyPlugins.length;
i++
) {
var possiblePlugin = legacyPlugins[i];
possiblePlugin &&
(possiblePlugin = possiblePlugin.extractEvents(
topLevelType,
target,
nativeEvent,
event
)) &&
(events = accumulateInto(events, possiblePlugin));
}
event = events;
null !== event && (eventQueue = accumulateInto(eventQueue, event));
event = eventQueue;
eventQueue = null;
if (event) {
forEachAccumulated(event, executeDispatchesAndReleaseTopLevel);
if (eventQueue)
throw Error(