decord/source/__polyfill/06xxx/module_6783.js
github-actions da5b5e5efe chore: update source for alpha 346.6
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
2026-09-12 13:45:10 +00:00

475 lines
18 KiB
JavaScript

// Module ID: 6783
// Function ID: 6784
// Dependencies: [41, 42, 93, 95, 98, 19, 17, 21, 6784, 6762, 6778, 6785, 6787, 6760, 6789, 6788, 6790, 6791, 6761, 6775]
// Exports: default
// Module 6783
import handlerIDToTag2 from "handlerIDToTag" /* 6760 */;
import tagMessage from "tagMessage" /* 6761 */;
import _mod6778 from "module_6778" /* 6778 */;
import RNGestureHandlerModuleDefault from "RNGestureHandlerModule" /* 6785 */;
import transformIntoHandlerTags from "transformIntoHandlerTags" /* 6787 */;
import ghQueueMicrotask from "ghQueueMicrotask" /* 6788 */;
import _classCallCheck from "_classCallCheck" /* 41 */;
import _createClass from "_createClass" /* 42 */;
import hasOwnProperty from "_possibleConstructorReturn" /* 93 */;
import _getPrototypeOf from "_getPrototypeOf" /* 95 */;
import _inherits from "_inherits" /* 98 */;
import noop from "module_19" /* 19 */;
require = fn;
function _isNativeReflectConstruct() {
try {
const _Boolean = Boolean;
const call = valueOf.call;
const _Reflect = Reflect;
const _Boolean2 = Boolean;
if (typeof call === "unknown") {
let callResult = valueOf();
} else {
callResult = call(constructResult);
}
closure_0 = !callResult;
_isNativeReflectConstruct = function _isNativeReflectConstruct() {
return closure_0;
};
return _isNativeReflectConstruct();
} catch (err) {
}
}
get_ActivityIndicator = fn(17);
({ DeviceEventEmitter, Platform } = get_ActivityIndicator);
const jsx = fn(21).jsx;
fn(6784).customDirectEventTypes.topGestureHandlerEvent = { registrationName: "onGestureHandlerEvent" };
let closure_10 = { [fn(6762).State.UNDETERMINED]: undefined, [fn(6762).State.BEGAN]: "onBegan", [fn(6762).State.FAILED]: "onFailed", [fn(6762).State.CANCELLED]: "onCancelled", [fn(6762).State.ACTIVE]: "onActivated", [fn(6762).State.END]: "onEnded" };
export default function createHandler(name) {
name = name.name;
const Handler = name;
let allowedProps = name.allowedProps;
if (allowedProps === undefined) {
allowedProps = [];
}
let config = name.config;
if (config === undefined) {
config = {};
}
({ transformProps: _classCallCheck, customNativeProps } = name);
if (customNativeProps === undefined) {
customNativeProps = [];
}
class Handler {
constructor(arg0) {
self = this;
tmp = closure_3(this, Handler);
items = [];
items[0] = name;
tmp2 = metroRequire;
obj = metroRequire(Handler);
tmp3 = hasOwnProperty;
if (closure_9()) {
tmp5 = globalThis;
_Reflect = Reflect;
constructResult = Reflect.construct(obj, items, tmp2(self).constructor);
} else {
constructResult = obj.apply(self, items);
}
tmp3Result = tmp3(self, constructResult);
closure_0 = tmp3Result;
tmp3Result.handlerTag = -1;
tmp3Result.onGestureHandlerEvent = (nativeEvent) => {
if (nativeEvent.nativeEvent.handlerTag === closure_0.handlerTag) {
if (typeof tmp.props.onGestureEvent === "function") {
const props2 = tmp.props;
const onGestureEvent = props2.onGestureEvent;
if (onGestureEvent != null) {
onGestureEvent(nativeEvent);
}
}
} else {
const props = tmp.props;
if (props.onGestureHandlerEvent != null) {
const result = onGestureHandlerEvent(nativeEvent);
}
}
};
tmp3Result.onGestureHandlerStateChange = (nativeEvent) => {
if (nativeEvent.nativeEvent.handlerTag === closure_0.handlerTag) {
if (typeof tmp.props.onHandlerStateChange === "function") {
const props2 = tmp.props;
if (props2.onHandlerStateChange != null) {
onHandlerStateChange(nativeEvent);
}
}
let tmp7 = tmp6;
if (closure_10[nativeEvent.nativeEvent.state]) {
tmp7 = tmp.props[tmp6];
}
let tmp8 = tmp7;
if (tmp7) {
tmp8 = typeof tmp7 === "function";
}
if (tmp8) {
tmp7(nativeEvent);
}
} else {
const props = tmp.props;
if (props.onGestureHandlerStateChange != null) {
const result = onGestureHandlerStateChange(nativeEvent);
}
}
};
tmp3Result.refHandler = (viewNode) => {
closure_0.viewNode = viewNode;
const Children = noop.Children;
const props = Children.only(closure_0.props.children).props;
let ref;
if (props != null) {
ref = props.ref;
}
if (ref) {
if (typeof ref === "function") {
ref(viewNode);
} else {
ref.current = viewNode;
}
}
};
tmp3Result.createGestureHandler = (config) => {
closure_0.handlerTag = _mod6778.getNextHandlerTag();
closure_0.config = config;
RNGestureHandlerModuleDefault.createGestureHandler(Handler, closure_0.handlerTag, config);
const obj3 = RNGestureHandlerModuleDefault;
obj3.configureRelations(closure_0.handlerTag, transformIntoHandlerTags.selectProperties(config, ["waitFor", "simultaneousHandlers", "blocksHandlers"]));
};
tmp3Result.attachGestureHandler = (viewTag) => {
closure_0.viewTag = viewTag;
let result = handlerIDToTag2.registerOldGestureHandler(closure_0.handlerTag, { onGestureEvent: closure_0.onGestureHandlerEvent, onGestureStateChange: closure_0.onGestureHandlerStateChange });
const props = closure_0.props;
let onGestureEvent;
if (props != null) {
onGestureEvent = props.onGestureEvent;
}
let tmp6 = onGestureEvent;
if (onGestureEvent) {
let tmp7 = "current" in onGestureEvent;
if (!tmp7) {
tmp7 = "workletEventHandler" in onGestureEvent;
}
tmp6 = tmp7;
}
const props2 = tmp.props;
if (!tmp6) {
if (!onHandlerStateChange) {
if (onGestureEvent) {
if ("__isNative" in onGestureEvent) {
let REANIMATED_WORKLET = tmp2(6789).ActionType.NATIVE_ANIMATED_EVENT;
}
}
REANIMATED_WORKLET = tmp2(6789).ActionType.JS_FUNCTION_OLD_API;
}
RNGestureHandlerModuleDefault.attachGestureHandler(tmp.handlerTag, viewTag, REANIMATED_WORKLET);
const result1 = tmp2(6787).scheduleFlushOperations();
const tmp2Result = tmp2(6787);
tmp2(6788).ghQueueMicrotask(() => {
const MountRegistry = Handler(config[16]).MountRegistry;
const result = MountRegistry.gestureHandlerWillMount(closure_1_0);
});
}
REANIMATED_WORKLET = tmp2(6789).ActionType.REANIMATED_WORKLET;
};
tmp3Result.setGestureHandlerConfig = (config) => {
closure_0.config = config;
const result = RNGestureHandlerModuleDefault.setGestureHandlerConfig(closure_0.handlerTag, config);
const obj2 = RNGestureHandlerModuleDefault;
obj2.configureRelations(closure_0.handlerTag, transformIntoHandlerTags.selectProperties(config, ["waitFor", "simultaneousHandlers", "blocksHandlers"]));
const result1 = transformIntoHandlerTags.scheduleFlushOperations();
};
tmp3Result.config = {};
tmp3Result.propsRef = closure_8.createRef();
tmp3Result.isMountedRef = closure_8.createRef();
tmp3Result.state = { allowTouches: true };
if (name.id) {
tmp7 = closure_0;
tmp8 = c2;
if (undefined !== closure_0(c2[13]).handlerIDToTag[name.id]) {
tmp9 = globalThis;
_Error = Error;
_HermesInternal = HermesInternal;
str = "\" already registered";
str2 = "Handler with ID \"";
tmp10 = new.target;
tmp11 = new.target;
error = new Error("Handler with ID \"" + name.id + "\" already registered");
tmp13 = error;
throw error;
} else {
tmp7(tmp8[13]).handlerIDToTag[name.id] = tmp3Result.handlerTag;
}
}
return tmp3Result;
}
}
_inherits(Handler, noop.Component);
const entry = {
key: "componentDidMount",
value: function componentDidMount() {
const self = this;
const props = this.props;
this.isMountedRef.current = true;
if (Array.isArray(props.simultaneousHandlers)) {
let someResult = simultaneousHandlers.some((current) => {
let tmp = current;
if (current) {
tmp = null === current.current;
}
return tmp;
});
} else {
someResult = simultaneousHandlers;
if (simultaneousHandlers) {
someResult = null === simultaneousHandlers.current;
}
}
if (someResult) {
if (someResult) {
Handler(6788).ghQueueMicrotask(() => {
self.update(1);
});
const obj = Handler(6788);
}
const props2 = self.props;
const items = [];
const obj2 = Handler(6787);
HermesBuiltin.arraySpread(_createClass, HermesBuiltin.arraySpread(importDefault, 0));
self.createGestureHandler(obj2.filterConfig(_classCallCheck ? _classCallCheck(props2) : props2, items, dependencyMap));
if (self.viewNode) {
self.attachGestureHandler(allowedProps(6791)(self.viewNode));
} else {
const _Error = Error;
const _HermesInternal = HermesInternal;
const error = new Error("[Gesture Handler] Failed to obtain view for " + Handler.displayName + ". Note that old API doesn't support functional components.");
throw error;
}
const tmp11 = _classCallCheck ? _classCallCheck(props2) : props2;
} else {
const waitFor = props.waitFor;
const _Array = Array;
if (Array.isArray(waitFor)) {
let someResult1 = waitFor.some((current) => {
let tmp = current;
if (current) {
tmp = null === current.current;
}
return tmp;
});
} else {
someResult1 = waitFor;
if (waitFor) {
someResult1 = null === waitFor.current;
}
}
}
}
};
let items = [
entry,
{
key: "componentDidUpdate",
value: function componentDidUpdate() {
const self = this;
const tmp = allowedProps(config[17])(this.viewNode);
if (this.viewTag !== tmp) {
self.attachGestureHandler(tmp);
}
self.update(1);
}
},
{
key: "componentWillUnmount",
value: function componentWillUnmount() {
const self = this;
const inspectorToggleListener = this.inspectorToggleListener;
if (inspectorToggleListener != null) {
inspectorToggleListener.remove();
}
self.isMountedRef.current = false;
const result = Handler(config[13]).unregisterOldGestureHandler(self.handlerTag);
const obj = Handler(config[13]);
allowedProps(config[11]).dropGestureHandler(self.handlerTag);
const obj2 = allowedProps(config[11]);
const result1 = Handler(config[12]).scheduleFlushOperations();
if (self.props.id) {
const handlerIDToTag = tmp4(tmp5[13]).handlerIDToTag;
delete tmp[tmp2];
}
const MountRegistry = tmp4(tmp5[16]).MountRegistry;
const result2 = MountRegistry.gestureHandlerWillUnmount(self);
}
},
{
key: "update",
value: function update(arg0) {
const self = this;
closure_0 = arg0;
if (this.isMountedRef.current) {
const props = self.props;
const _Array = Array;
if (Array.isArray(props.simultaneousHandlers)) {
let someResult = simultaneousHandlers.some((current) => {
let tmp = current;
if (current) {
tmp = null === current.current;
}
return tmp;
});
} else {
someResult = simultaneousHandlers;
if (simultaneousHandlers) {
someResult = null === simultaneousHandlers.current;
}
}
if (someResult) {
if (someResult) {
if (arg0 > 0) {
ghQueueMicrotask.ghQueueMicrotask(() => {
self.update(closure_0 - 1);
});
}
}
const props2 = self.props;
const items = [];
const obj = transformIntoHandlerTags;
const tmp7 = require;
HermesBuiltin.arraySpread(customNativeProps, HermesBuiltin.arraySpread(allowedProps, 0));
const filterConfigResult = obj.filterConfig(_classCallCheck ? _classCallCheck(props2) : props2, items, config);
const tmp9 = _classCallCheck ? _classCallCheck(props2) : props2;
if (!tmp7Result.deepEqual(self.config, filterConfigResult)) {
const result = self.setGestureHandlerConfig(filterConfigResult);
}
tmp7Result = tmp7(6761);
} else {
const waitFor = props.waitFor;
const _Array2 = Array;
if (Array.isArray(waitFor)) {
let someResult1 = waitFor.some((current) => {
let tmp = current;
if (current) {
tmp = null === current.current;
}
return tmp;
});
} else {
someResult1 = waitFor;
if (waitFor) {
someResult1 = null === waitFor.current;
}
}
}
}
}
},
{
key: "setNativeProps",
value: function setNativeProps(arg0) {
const self = this;
const obj = {};
const merged = Object.assign(this.props);
const merged1 = Object.assign(arg0);
let tmp3 = obj;
if (_classCallCheck) {
tmp3 = _classCallCheck(obj);
}
const items = [...customNativeProps];
const result = self.setGestureHandlerConfig(transformIntoHandlerTags.filterConfig(tmp3, items, config));
}
},
{
key: "render",
value: function render() {
const self = this;
({ onGestureHandlerEvent, props } = this);
({ onGestureEvent, onGestureHandlerEvent: onGestureHandlerEvent2 } = props);
if (onGestureEvent) {
if (typeof onGestureEvent !== "function") {
let tmp2 = onGestureEvent;
if (onGestureHandlerEvent2) {
const _Error3 = Error;
const error = new Error("Nesting touch handlers with native animated driver is not supported yet");
throw error;
}
}
({ onGestureHandlerStateChange, props: props2 } = self);
({ onHandlerStateChange, onGestureHandlerStateChange: onGestureHandlerStateChange2 } = props2);
if (onHandlerStateChange) {
if (typeof onHandlerStateChange !== "function") {
let tmp3 = onHandlerStateChange;
if (onGestureHandlerStateChange2) {
const _Error2 = Error;
const error1 = new Error("Nesting touch handlers with native animated driver is not supported yet");
throw error1;
}
}
let tmp4;
if (self.state.allowTouches) {
tmp4 = tmp2;
}
const obj = { onGestureHandlerEvent: tmp4, onGestureHandlerStateChange: null };
let tmp5;
if (self.state.allowTouches) {
tmp5 = tmp3;
}
obj.onGestureHandlerStateChange = tmp5;
self.propsRef.current = obj;
try {
const Children = noop.Children;
const onlyResult = Children.only(self.props.children);
const obj3 = { ref: self.refHandler, collapsable: false };
if (obj4.isTestEnv()) {
const obj5 = { handlerType: Handler, handlerTag: self.handlerTag, enabled: self.props.enabled };
let obj6 = obj5;
} else {
obj6 = {};
}
const merged = Object.assign(obj6);
let testID = self.props.testID;
if (testID == null) {
testID = onlyResult.props.testID;
}
obj3.testID = testID;
const merged1 = Object.assign(obj);
return noop.cloneElement(onlyResult, obj3, onlyResult.props.children);
} catch (err) {
const _Error = Error;
const _HermesInternal = HermesInternal;
const error2 = new Error(tagMessage.tagMessage("" + Handler + " got more than one view as a child. If you want the gesture to work on multiple views, wrap them with a common parent and attach the gesture to that view."));
throw error2;
}
}
tmp3 = onGestureHandlerStateChange;
if (onGestureHandlerStateChange2) {
tmp3 = onGestureHandlerStateChange;
if (typeof onGestureHandlerStateChange2 !== "function") {
const _Error5 = Error;
const error3 = new Error("Nesting touch handlers with native animated driver is not supported yet");
throw error3;
}
}
}
tmp2 = onGestureHandlerEvent;
if (onGestureHandlerEvent2) {
tmp2 = onGestureHandlerEvent;
if (typeof onGestureHandlerEvent2 !== "function") {
const _Error4 = Error;
const error4 = new Error("Nesting touch handlers with native animated driver is not supported yet");
throw error4;
}
}
}
}
];
let tmp2 = customNativeProps(Handler, items);
tmp2.displayName = name;
tmp2.contextType = allowedProps(config[19]);
return tmp2;
};