local q=require(script.Parent.Parent.Packages.t)local U=require(script.Parent.Parent.Packages.Roact)local j=U.Component:extend("\079\110\082\111\111\116\101\100\076\105\115\116\101\110\101\114")j.validateProps=q.strictInterface({onRooted=q.callback})function j.init(q)q.onAncestryChanged=function(U)if U:IsDescendantOf(game)then q.props.onRooted(U)end end end function j.render(q)return U.createElement("\070\111\108\100\101\114",{[U.Event.AncestryChanged]=q.onAncestryChanged})end return j
--[[
	This is a child component that listens for the event "all parents have been
	set". In didMount, parents of the mounted component are not required to be
	set, therefore we can't do ancestry checks (like checking to see if the
	mounted component is a child of CoreGui or PlayerGui). This component makes
	it easy to do this check and trigger functions when all parents are assigned
	after didMount.
]]

local t = require(script.Parent.Parent.Packages.t)
local Roact = require(script.Parent.Parent.Packages.Roact)

local OnRootedListener = Roact.Component:extend("OnRootedListener")

OnRootedListener.validateProps = t.strictInterface({
	onRooted = t.callback,
})

function OnRootedListener:init()
	self.onAncestryChanged = function(instance)
		if instance:IsDescendantOf(game) then
			self.props.onRooted(instance)
		end
	end
end

function OnRootedListener:render()
	return Roact.createElement("Folder", {
		[Roact.Event.AncestryChanged] = self.onAncestryChanged,
	})
end

return OnRootedListener
