local s=Cheer.CreateComponent("\066\084\084\111\111\108\073\110\102\111\114\109\097\116\105\111\110\077\097\110\097\103\101\114",View)function s.Start(I)(getfenv(1)).Core=I return s end function s.RegisterSection(I)local c=s.GetSection(I)Cheer.Bind(c.MouseEnter,function()if s.CurrentSection==c then s.CurrentFadeTimer=false end end)Cheer.Bind(c.MouseLeave,function()s.StartFadeTimer(true)end)end function s.StartFadeTimer(I)if s.CurrentFadeTimer==false and not I then return end local c=HttpService:GenerateGUID()s.CurrentFadeTimer=c Delay(2,function()if s.CurrentFadeTimer==c then s.HideCurrentSection()end end)end function s.StartShowTimer(I)if s.LastTrigger=="\067\108\105\099\107"then return end local c=HttpService:GenerateGUID()s.CurrentShowTimer=c Delay(.25,function()if s.CurrentShowTimer==c then s.ShowSection(I,"\072\111\118\101\114")s.StartFadeTimer()end end)end function s.ProcessHover(I,c)if s.LastTrigger=="\067\108\105\099\107"then return end wait()s.StartShowTimer(c)end function s.ShowSection(I,c)s.HideCurrentSection()local M=s.GetSection(I)s.CurrentSection=M s.LastTrigger=c M.Visible=true end function s.ProcessUnhover(I,c)s.CurrentShowTimer=nil if s.LastTrigger=="\067\108\105\099\107"then return end local M=s.GetSection(c)if s.CurrentSection==M then s.StartFadeTimer()end end function s.ProcessClick(I,c)s.ShowSection(c,"\067\108\105\099\107")s.StartFadeTimer()end function s.HideCurrentSection()if not s.CurrentSection then return end s.CurrentSection.Visible=false s.CurrentFadeTimer=nil s.CurrentSection=nil s.LastTrigger=nil end function s.GetSection(s)return View:FindFirstChild(s)end return s

local Component = Cheer.CreateComponent('BTToolInformationManager', View);

function Component.Start(Core)

	-- Save reference to core API
	getfenv(1).Core = Core;

	-- Return component for chaining
	return Component;

end;

function Component.RegisterSection(SectionName)
	-- Registers triggers for the given section

	-- Get section
	local Section = Component.GetSection(SectionName);

	-- Reset fade timer on hover
	Cheer.Bind(Section.MouseEnter, function ()
		if Component.CurrentSection == Section then
			Component.CurrentFadeTimer = false;
		end;
	end);

	-- Start fade time on unhover
	Cheer.Bind(Section.MouseLeave, function ()
		Component.StartFadeTimer(true);
	end);

end;

function Component.StartFadeTimer(Override)
	-- Creates timer to disappear current section after 2 seconds unless overridden

	if Component.CurrentFadeTimer == false and not Override then
		return;
	end;

	-- Generate unique trigger ID
	local TriggerId = HttpService:GenerateGUID();

	-- Register timer
	Component.CurrentFadeTimer = TriggerId;

	-- Start timer
	Delay(2, function ()
		if Component.CurrentFadeTimer == TriggerId then
			Component.HideCurrentSection();
		end;
	end);

end;

function Component.StartShowTimer(SectionName)
	-- Creates timer to show content after hovering for over half a second

	-- Only override current section if also triggered by hover
	if Component.LastTrigger == 'Click' then
		return;
	end;

	-- Generate unique trigger ID
	local TriggerId = HttpService:GenerateGUID();

	-- Register timer
	Component.CurrentShowTimer = TriggerId;

	-- Start timer
	Delay(0.25, function ()
		if Component.CurrentShowTimer == TriggerId then
			Component.ShowSection(SectionName, 'Hover');
			Component.StartFadeTimer();
		end;
	end);

end;

function Component.ProcessHover(Tool, SectionName)

	-- Only override current section if also triggered by hover
	if Component.LastTrigger == 'Click' then
		return;
	end;

	wait();

	-- Start a show timer
	Component.StartShowTimer(SectionName);

end;

function Component.ShowSection(SectionName, TriggerType)

	-- Hide any current section
	Component.HideCurrentSection();

	-- Get section
	local Section = Component.GetSection(SectionName);

	-- Set new current section
	Component.CurrentSection = Section;
	Component.LastTrigger = TriggerType;

	-- Show the new section
	Section.Visible = true;

end;

function Component.ProcessUnhover(Tool, SectionName)

	-- Clear any other show timer
	Component.CurrentShowTimer = nil;

	-- Only override current section if triggered by a hover
	if Component.LastTrigger == 'Click' then
		return;
	end;

	-- Get section
	local Section = Component.GetSection(SectionName);

	-- Disappear after 2 seconds unless overridden
	if Component.CurrentSection == Section then
		Component.StartFadeTimer();
	end;

end;

function Component.ProcessClick(Tool, SectionName)

	-- Show the new section
	Component.ShowSection(SectionName, 'Click');

	-- Disappear after 2 seconds unless overridden
	Component.StartFadeTimer();

end;

function Component.HideCurrentSection()

	-- Ensure there is a current section
	if not Component.CurrentSection then
		return;
	end;

	-- Hide section
	Component.CurrentSection.Visible = false;

	-- Disable section fade timer if any
	Component.CurrentFadeTimer = nil;

	-- Unregister current section
	Component.CurrentSection = nil;
	Component.LastTrigger = nil;

end;

function Component.GetSection(SectionName)

	-- Return the information section with the given name
	return View:FindFirstChild(SectionName);

end;

return Component;
