// Metro module 283 (f284). import recordTouchStart from "./recordTouchStart"; import { getCurrentProps, getNativeElementReference } from "./Module136"; import { getFabricUIManager } from "./Module71"; import ResponderEvent from "./ResponderEvent"; import { setTarget, setCurrentTarget } from "./Module134"; import ReadOnlyElement from "./ReadOnlyElement"; let c292_5, c292_6, c292_7, c292_8, c292_9, dispatchResponderEvent; const getHandler = function getHandler(a0, registrationName) { const r10 = getCurrentProps(a0)[registrationName]; if (typeof r10 === "function") { return r10; } }; dispatchResponderEvent = function dispatchResponderEvent(a0, a1, a2, a3) { let r38; const r11 = c292_7[a1]; const registrationName = r11.registrationName; if (registrationName != null) { const handler = getHandler(a0, registrationName); if (handler != null) { const responderEvent = new ResponderEvent(a1, { bubbles: false, cancelable: true }, a2, r11, recordTouchStart.touchHistory); const r31 = a3 ?? null; setTarget(responderEvent, r31); setCurrentTarget(responderEvent, a0); try { r38 = handler(responderEvent); } catch (r39) { if (!c292_9) { c292_9 = true; c292_8 = r39; } } setCurrentTarget(responderEvent, null); return r38; } } }; c292_5 = null; c292_6 = 0; const dependencies = ["topTouchStart"]; const dependencies2 = ["topTouchMove"]; const dependencies3 = ["topTouchCancel", "topTouchEnd"]; c292_7 = { startShouldSetResponder: { phasedRegistrationNames: { bubbled: "onStartShouldSetResponder", captured: "onStartShouldSetResponderCapture" }, dependencies }, scrollShouldSetResponder: { phasedRegistrationNames: { bubbled: "onScrollShouldSetResponder", captured: "onScrollShouldSetResponderCapture" }, dependencies: ["topScroll"] }, selectionChangeShouldSetResponder: { phasedRegistrationNames: { bubbled: "onSelectionChangeShouldSetResponder", captured: "onSelectionChangeShouldSetResponderCapture" }, dependencies: ["topSelectionChange"] }, moveShouldSetResponder: { phasedRegistrationNames: { bubbled: "onMoveShouldSetResponder", captured: "onMoveShouldSetResponderCapture" }, dependencies: dependencies2 }, responderStart: { registrationName: "onResponderStart", dependencies }, responderMove: { registrationName: "onResponderMove", dependencies: dependencies2 }, responderEnd: { registrationName: "onResponderEnd", dependencies: dependencies3 }, responderRelease: { registrationName: "onResponderRelease", dependencies: dependencies3 }, responderTerminationRequest: { registrationName: "onResponderTerminationRequest", dependencies: [] }, responderGrant: { registrationName: "onResponderGrant", dependencies: [] }, responderReject: { registrationName: "onResponderReject", dependencies: [] }, responderTerminate: { registrationName: "onResponderTerminate", dependencies: [] } }; c292_8 = null; c292_9 = false; export function rethrowCaughtError() { if (c292_9) { const r1 = c292_8; c292_9 = false; c292_8 = null; throw r1; } } export function processResponderEvent(a0, a1, a2) { let r83, r85; const r8 = a0 === "topTouchStart"; if (r8) { c292_6 = c292_6 + 1; } else if (a0 === "topTouchEnd" || a0 === "topTouchCancel") { const r38 = c292_6; if (!(r38 >= 0)) { return void 0; } c292_6 = r38 - 1; } if (!r8 && a0 !== "topTouchMove") { if (a0 === "topTouchEnd" || a0 === "topTouchCancel") { recordTouchStart.recordTouchTrack(a0, a2); } } else { recordTouchStart.recordTouchTrack(a0, a2); } const r56 = a1 instanceof ReadOnlyElement ? a1 : null; if (r56 != null && (a0 === "topScroll" && a2.responderIgnoreScroll !== true || c292_6 > 0 && a0 === "topSelectionChange" || r8 || a0 === "topTouchMove") && r56 != null) { const r21 = r8 ? "startShouldSetResponder" : a0 !== "topTouchMove" ? a0 === "topSelectionChange" ? "selectionChangeShouldSetResponder" : "scrollShouldSetResponder" : "moveShouldSetResponder"; L66: { const r69 = c292_5 == null; let r71 = false; let r72 = r56; if (!r69) { const r73 = c292_5; const r18 = r73.contains(r56); let r75 = r73; if (!r18) { const r77 = r56.contains(r73); r75 = r56; if (!r77) { let parentElement = r73.parentElement; const r79 = parentElement != null; r75 = null; if (r79) { do { const r19 = parentElement.contains(r56); const r81 = parentElement; r75 = r81; if (r19) { break; } const parentElement2 = r81.parentElement; r83 = parentElement2 != null; parentElement = parentElement2; r75 = null; } while (r83); } } } const r84 = r75 == null; r85 = null; if (r84) { break L66; } const r86 = c292_5; r71 = false; r72 = r75; if (r75 === r86) { r71 = true; r72 = r75; } } let r87 = r71 ? r72.parentElement : r72; const r88 = r87 == null; r85 = null; if (!r88) { const r26 = []; while (r87 != null) { r26.unshift(r87); r87 = r87.parentElement; } const r92 = c292_7[r21]; const responderEvent = new ResponderEvent(r21, { bubbles: true, cancelable: true }, a2, r92, recordTouchStart.touchHistory); setTarget(responderEvent, r56); const phasedRegistrationNames = r92.phasedRegistrationNames; const r105 = phasedRegistrationNames == null; r85 = null; if (!r105) { const { bubbled, captured } = phasedRegistrationNames; const r108 = 0 < r26.length; let r110 = 0; if (r108) { do { const r111 = r26[r110]; const r117 = getCurrentProps(r111)[captured]; const r1 = r110; const r118 = typeof r117 === "function" ? r117 : void 0; if (r118 != null) { setCurrentTarget(responderEvent, r111); if (r118(responderEvent) === true) { setCurrentTarget(responderEvent, null); r85 = r111; break L66; } } r110 = r1 + 1; } while (r110 < r26.length); } let r127 = r26.length - 1; while (0 <= r127) { const r128 = r26[r127]; const r134 = getCurrentProps(r128)[bubbled]; const r135 = r127; const r136 = typeof r134 === "function" ? r134 : void 0; if (r136 != null) { setCurrentTarget(responderEvent, r128); if (r136(responderEvent) === true) { setCurrentTarget(responderEvent, null); r85 = r128; break L66; } } r127 = r135 - 1; } setCurrentTarget(responderEvent, null); r85 = null; } } } if (r85 != null && r85 !== c292_5) { const r164 = dispatchResponderEvent(r85, "responderGrant", a2, r56) === true; if (c292_5 != null) { const r185 = c292_5; if (dispatchResponderEvent(r185, "responderTerminationRequest", a2, r56) !== false) { dispatchResponderEvent(r185, "responderTerminate", a2, r56); const r204 = c292_5; c292_5 = r85; const fabricUIManager2 = getFabricUIManager(); if (r204 != null) { const nativeElementReference3 = getNativeElementReference(r204); if (nativeElementReference3 != null && fabricUIManager2 != null) { fabricUIManager2.setIsJSResponder(nativeElementReference3, false, r164); } } if (r85 != null) { const nativeElementReference4 = getNativeElementReference(r85); if (nativeElementReference4 != null && fabricUIManager2 != null) { fabricUIManager2.setIsJSResponder(nativeElementReference4, true, r164); } } } else { dispatchResponderEvent(r85, "responderReject", a2, r56); } } else { const r166 = c292_5; c292_5 = r85; const fabricUIManager = getFabricUIManager(); if (r166 != null) { const nativeElementReference = getNativeElementReference(r166); if (nativeElementReference != null && fabricUIManager != null) { fabricUIManager.setIsJSResponder(nativeElementReference, false, r164); } } if (r85 != null) { const nativeElementReference2 = getNativeElementReference(r85); if (nativeElementReference2 != null && fabricUIManager != null) { fabricUIManager.setIsJSResponder(nativeElementReference2, true, r164); } } } } } if (c292_5 != null) { const r224 = c292_5; if (r8) { dispatchResponderEvent(r224, "responderStart", a2, r56); } else if (a0 === "topTouchMove") { dispatchResponderEvent(r224, "responderMove", a2, r56); } else if (a0 === "topTouchEnd" || a0 === "topTouchCancel") { dispatchResponderEvent(r224, "responderEnd", a2, r56); if (a0 === "topTouchCancel") { dispatchResponderEvent(r224, "responderTerminate", a2, r56); const r271 = c292_5; c292_5 = null; const fabricUIManager4 = getFabricUIManager(); if (r271 != null) { const nativeElementReference6 = getNativeElementReference(r271); if (nativeElementReference6 != null && fabricUIManager4 != null) { fabricUIManager4.setIsJSResponder(nativeElementReference6, false, false); } } } else { const touches = a2.touches; const isArray = Array.isArray(touches); if (isArray ? touches.length === 0 : !isArray) { dispatchResponderEvent(r224, "responderRelease", a2, r56); const r251 = c292_5; c292_5 = null; const fabricUIManager3 = getFabricUIManager(); if (r251 != null) { const nativeElementReference5 = getNativeElementReference(r251); if (nativeElementReference5 != null && fabricUIManager3 != null) { fabricUIManager3.setIsJSResponder(nativeElementReference5, false, false); } } } } } } }