basant307/AI_Governance_Project
048
1/**2 * @license React3 * react-reconciler-reflection.development.js4 *5 * Copyright (c) Meta Platforms, Inc. and affiliates.6 *7 * This source code is licensed under the MIT license found in the8 * LICENSE file in the root directory of this source tree.9 */10 11"use strict";12"production" !== process.env.NODE_ENV &&13 (function () {14 function getNearestMountedFiber(fiber) {15 var node = fiber,16 nearestMounted = fiber;17 if (fiber.alternate) for (; node.return; ) node = node.return;18 else {19 fiber = node;20 do21 (node = fiber),22 0 !== (node.flags & 4098) && (nearestMounted = node.return),23 (fiber = node.return);24 while (fiber);25 }26 return 3 === node.tag ? nearestMounted : null;27 }28 function assertIsMounted(fiber) {29 if (getNearestMountedFiber(fiber) !== fiber)30 throw Error("Unable to find node on an unmounted component.");31 }32 function findCurrentFiberUsingSlowPath(fiber) {33 var alternate = fiber.alternate;34 if (!alternate) {35 alternate = getNearestMountedFiber(fiber);36 if (null === alternate)37 throw Error("Unable to find node on an unmounted component.");38 return alternate !== fiber ? null : fiber;39 }40 for (var a = fiber, b = alternate; ; ) {41 var parentA = a.return;42 if (null === parentA) break;43 var parentB = parentA.alternate;44 if (null === parentB) {45 b = parentA.return;46 if (null !== b) {47 a = b;48 continue;49 }50 break;51 }52 if (parentA.child === parentB.child) {53 for (parentB = parentA.child; parentB; ) {54 if (parentB === a) return assertIsMounted(parentA), fiber;55 if (parentB === b) return assertIsMounted(parentA), alternate;56 parentB = parentB.sibling;57 }58 throw Error("Unable to find node on an unmounted component.");59 }60 if (a.return !== b.return) (a = parentA), (b = parentB);61 else {62 for (var didFindChild = !1, _child = parentA.child; _child; ) {63 if (_child === a) {64 didFindChild = !0;65 a = parentA;66 b = parentB;67 break;68 }69 if (_child === b) {70 didFindChild = !0;71 b = parentA;72 a = parentB;73 break;74 }75 _child = _child.sibling;76 }77 if (!didFindChild) {78 for (_child = parentB.child; _child; ) {79 if (_child === a) {80 didFindChild = !0;81 a = parentB;82 b = parentA;83 break;84 }85 if (_child === b) {86 didFindChild = !0;87 b = parentB;88 a = parentA;89 break;90 }91 _child = _child.sibling;92 }93 if (!didFindChild)94 throw Error(95 "Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue."96 );97 }98 }99 if (a.alternate !== b)100 throw Error(101 "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue."102 );103 }104 if (3 !== a.tag)105 throw Error("Unable to find node on an unmounted component.");106 return a.stateNode.current === a ? fiber : alternate;107 }108 function findCurrentHostFiberImpl(node) {109 var tag = node.tag;110 if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return node;111 for (node = node.child; null !== node; ) {112 tag = findCurrentHostFiberImpl(node);113 if (null !== tag) return tag;114 node = node.sibling;115 }116 return null;117 }118 function findCurrentHostFiberWithNoPortalsImpl(node) {119 var tag = node.tag;120 if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return node;121 for (node = node.child; null !== node; ) {122 if (123 4 !== node.tag &&124 ((tag = findCurrentHostFiberWithNoPortalsImpl(node)), null !== tag)125 )126 return tag;127 node = node.sibling;128 }129 return null;130 }131 function traverseVisibleHostChildren(132 child,133 searchWithinHosts,134 fn,135 a,136 b,137 c138 ) {139 for (; null !== child; ) {140 if (141 (5 === child.tag && fn(child, a, b, c)) ||142 ((22 !== child.tag || null === child.memoizedState) &&143 (searchWithinHosts || 5 !== child.tag) &&144 traverseVisibleHostChildren(145 child.child,146 searchWithinHosts,147 fn,148 a,149 b,150 c151 ))152 )153 return !0;154 child = child.sibling;155 }156 return !1;157 }158 function getFragmentParentHostFiber(fiber) {159 for (fiber = fiber.return; null !== fiber; ) {160 if (3 === fiber.tag || 5 === fiber.tag) return fiber;161 fiber = fiber.return;162 }163 return null;164 }165 function findFragmentInstanceSiblings(result, self, child) {166 for (167 var foundSelf =168 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : !1;169 null !== child;170 171 ) {172 if (child === self)173 if (((foundSelf = !0), child.sibling)) child = child.sibling;174 else return !0;175 if (5 === child.tag) {176 if (foundSelf) return (result[1] = child), !0;177 result[0] = child;178 } else if (179 (22 !== child.tag || null === child.memoizedState) &&180 findFragmentInstanceSiblings(result, self, child.child, foundSelf)181 )182 return !0;183 child = child.sibling;184 }185 return !1;186 }187 function findNextSibling(child) {188 searchTarget = child;189 return !0;190 }191 function isFiberPrecedingCheck(child, target, boundary) {192 return child === boundary193 ? !0194 : child === target195 ? ((searchTarget = child), !0)196 : !1;197 }198 function isFiberFollowingCheck(child, target, boundary) {199 return child === boundary200 ? ((searchBoundary = child), !1)201 : child === target202 ? (null !== searchBoundary && (searchTarget = child), !0)203 : !1;204 }205 function getParentForFragmentAncestors(inst) {206 if (null === inst) return null;207 do inst = null === inst ? null : inst.return;208 while (inst && 5 !== inst.tag && 27 !== inst.tag && 3 !== inst.tag);209 return inst ? inst : null;210 }211 function getLowestCommonAncestor(instA, instB, getParent) {212 for (var depthA = 0, tempA = instA; tempA; tempA = getParent(tempA))213 depthA++;214 tempA = 0;215 for (var tempB = instB; tempB; tempB = getParent(tempB)) tempA++;216 for (; 0 < depthA - tempA; ) (instA = getParent(instA)), depthA--;217 for (; 0 < tempA - depthA; ) (instB = getParent(instB)), tempA--;218 for (; depthA--; ) {219 if (instA === instB || (null !== instB && instA === instB.alternate))220 return instA;221 instA = getParent(instA);222 instB = getParent(instB);223 }224 return null;225 }226 var searchTarget = null,227 searchBoundary = null;228 exports.doesFiberContain = function (parentFiber, childFiber) {229 for (230 var parentFiberAlternate = parentFiber.alternate;231 null !== childFiber;232 233 ) {234 if (childFiber === parentFiber || childFiber === parentFiberAlternate)235 return !0;236 childFiber = childFiber.return;237 }238 return !1;239 };240 exports.fiberIsPortaledIntoHost = function (fiber) {241 var foundPortalParent = !1;242 for (fiber = fiber.return; null !== fiber; ) {243 4 === fiber.tag && (foundPortalParent = !0);244 if (3 === fiber.tag || 5 === fiber.tag) break;245 fiber = fiber.return;246 }247 return foundPortalParent;248 };249 exports.findCurrentFiberUsingSlowPath = findCurrentFiberUsingSlowPath;250 exports.findCurrentHostFiber = function (parent) {251 parent = findCurrentFiberUsingSlowPath(parent);252 return null !== parent ? findCurrentHostFiberImpl(parent) : null;253 };254 exports.findCurrentHostFiberWithNoPortals = function (parent) {255 parent = findCurrentFiberUsingSlowPath(parent);256 return null !== parent257 ? findCurrentHostFiberWithNoPortalsImpl(parent)258 : null;259 };260 exports.getActivityInstanceFromFiber = function (fiber) {261 if (31 === fiber.tag) {262 var activityState = fiber.memoizedState;263 null === activityState &&264 ((fiber = fiber.alternate),265 null !== fiber && (activityState = fiber.memoizedState));266 if (null !== activityState) return activityState.dehydrated;267 }268 return null;269 };270 exports.getContainerFromFiber = function (fiber) {271 return 3 === fiber.tag ? fiber.stateNode.containerInfo : null;272 };273 exports.getFragmentInstanceSiblings = function (fiber) {274 var result = [null, null],275 parentHostFiber = getFragmentParentHostFiber(fiber);276 if (null === parentHostFiber) return result;277 findFragmentInstanceSiblings(result, fiber, parentHostFiber.child);278 return result;279 };280 exports.getFragmentParentHostFiber = getFragmentParentHostFiber;281 exports.getInstanceFromHostFiber = function (fiber) {282 switch (fiber.tag) {283 case 5:284 return fiber.stateNode;285 case 3:286 return fiber.stateNode.containerInfo;287 default:288 throw Error("Expected to find a host node. This is a bug in React.");289 }290 };291 exports.getLowestCommonAncestor = getLowestCommonAncestor;292 exports.getNearestMountedFiber = getNearestMountedFiber;293 exports.getNextSiblingHostFiber = function (fiber) {294 traverseVisibleHostChildren(fiber.sibling, !1, findNextSibling);295 fiber = searchTarget;296 searchTarget = null;297 return fiber;298 };299 exports.getSuspenseInstanceFromFiber = function (fiber) {300 if (13 === fiber.tag) {301 var suspenseState = fiber.memoizedState;302 null === suspenseState &&303 ((fiber = fiber.alternate),304 null !== fiber && (suspenseState = fiber.memoizedState));305 if (null !== suspenseState) return suspenseState.dehydrated;306 }307 return null;308 };309 exports.isFiberContainedByFragment = function (fiber, fragmentFiber) {310 for (; null !== fiber; ) {311 if (312 7 === fiber.tag &&313 (fiber === fragmentFiber || fiber.alternate === fragmentFiber)314 )315 return !0;316 fiber = fiber.return;317 }318 return !1;319 };320 exports.isFiberFollowing = function (fiber, otherFiber) {321 var commonAncestor = getLowestCommonAncestor(322 fiber,323 otherFiber,324 getParentForFragmentAncestors325 );326 if (null === commonAncestor) return !1;327 traverseVisibleHostChildren(328 commonAncestor,329 !0,330 isFiberFollowingCheck,331 otherFiber,332 fiber333 );334 fiber = searchTarget;335 searchBoundary = searchTarget = null;336 return null !== fiber;337 };338 exports.isFiberPreceding = function (fiber, otherFiber) {339 var commonAncestor = getLowestCommonAncestor(340 fiber,341 otherFiber,342 getParentForFragmentAncestors343 );344 if (null === commonAncestor) return !1;345 traverseVisibleHostChildren(346 commonAncestor,347 !0,348 isFiberPrecedingCheck,349 otherFiber,350 fiber351 );352 fiber = searchTarget;353 searchTarget = null;354 return null !== fiber;355 };356 exports.isFiberSuspenseAndTimedOut = function (fiber) {357 var memoizedState = fiber.memoizedState;358 return (359 13 === fiber.tag &&360 null !== memoizedState &&361 null === memoizedState.dehydrated362 );363 };364 exports.isFragmentContainedByFiber = function (fragmentFiber) {365 var current = fragmentFiber;366 for (367 fragmentFiber = getFragmentParentHostFiber(fragmentFiber);368 null !== current;369 370 ) {371 if (372 !(373 (5 !== current.tag && 3 !== current.tag) ||374 (current !== fragmentFiber && current.alternate !== fragmentFiber)375 )376 )377 return !0;378 current = current.return;379 }380 return !1;381 };382 exports.traverseFragmentInstance = function (fragmentFiber, fn, a, b, c) {383 traverseVisibleHostChildren(fragmentFiber.child, !1, fn, a, b, c);384 };385 exports.traverseFragmentInstanceDeeply = function (386 fragmentFiber,387 fn,388 a,389 b,390 c391 ) {392 traverseVisibleHostChildren(fragmentFiber.child, !0, fn, a, b, c);393 };394 })();395 