local K=require(Vendor:WaitForChild("\082\111\097\099\116"))local D=require(UI:WaitForChild("\084\111\111\108\077\097\110\117\097\108\087\105\110\100\111\119"))local function C(C,s,N)local w=N:WaitForChild("\072\101\108\112\066\117\116\116\111\110")local P=false local M=nil local function n()if not P then w.TextTransparency=0;(w:WaitForChild("\066\097\099\107\103\114\111\117\110\100")).BackgroundTransparency=0 end end local function d()if not P then w.TextTransparency=.5;(w:WaitForChild("\066\097\099\107\103\114\111\117\110\100")).BackgroundTransparency=.75 end end local function F()w.TextTransparency=P and 0 or.5;(w:WaitForChild("\066\097\099\107\103\114\111\117\110\100")).BackgroundTransparency=P and 0 or.75 if P then d()P=false M=K.unmount(M)else n()P=true local N=K.createElement(D,{Text=C,ThemeColor=s})M=K.mount(N,Core.UI,"\084\111\111\108\077\097\110\117\097\108\087\105\110\100\111\119")end end N.Activated:Connect(F)w.Activated:Connect(F)N.InputBegan:Connect(n)N.InputEnded:Connect(d)w.InputBegan:Connect(n)w.InputEnded:Connect(d)end return C
-- Libraries
local Roact = require(Vendor:WaitForChild("Roact"))
local ToolManualWindow = require(UI:WaitForChild("ToolManualWindow"))

local function ListenForManualWindowTrigger(Text, ThemeColor, SignatureButton)
	local HelpButton = SignatureButton:WaitForChild("HelpButton")

	local IsManualOpen = false
	local ManualHandle = nil

	local function BeginHover()
		if not IsManualOpen then
			HelpButton.TextTransparency = 0
			HelpButton:WaitForChild("Background").BackgroundTransparency = 0
		end
	end

	local function EndHover()
		if not IsManualOpen then
			HelpButton.TextTransparency = 0.5
			HelpButton:WaitForChild("Background").BackgroundTransparency = 0.75
		end
	end

	local function ToggleManual()
		HelpButton.TextTransparency = IsManualOpen and 0 or 0.5
		HelpButton:WaitForChild("Background").BackgroundTransparency = IsManualOpen and 0 or 0.75

		-- Close manual if open
		if IsManualOpen then
			EndHover()
			IsManualOpen = false
			ManualHandle = Roact.unmount(ManualHandle)

		-- Open manual if closed
		else
			BeginHover()
			IsManualOpen = true
			local ManualElement = Roact.createElement(ToolManualWindow, {
				Text = Text,
				ThemeColor = ThemeColor,
			})
			ManualHandle = Roact.mount(ManualElement, Core.UI, "ToolManualWindow")
		end
	end

	-- Enable help button
	SignatureButton.Activated:Connect(ToggleManual)
	HelpButton.Activated:Connect(ToggleManual)
	SignatureButton.InputBegan:Connect(BeginHover)
	SignatureButton.InputEnded:Connect(EndHover)
	HelpButton.InputBegan:Connect(BeginHover)
	HelpButton.InputEnded:Connect(EndHover)
end

return ListenForManualWindowTrigger
