local l=Cheer.CreateComponent("\066\084\068\111\099\107",View,true)function l.Start(y)View.Visible=true;(getfenv(1)).Core=y local S=l.AddSelectionButton(y.Assets.UndoInactiveDecal,"\085\078\068\079\n\040\083\104\105\102\116 \043 \090\041")local T=l.AddSelectionButton(y.Assets.RedoInactiveDecal,"\082\069\068\079\n\040\083\104\105\102\116 \043 \089\041")local s=l.AddSelectionButton(y.Assets.DeleteInactiveDecal,"\068\069\076\069\084\069\n\040\083\104\105\102\116 \043 \088\041")local i=l.AddSelectionButton(y.Assets.ExportInactiveDecal,"\069\088\080\079\082\084\n\040\083\104\105\102\116 \043 \080\041")local I=l.AddSelectionButton(y.Assets.CloneInactiveDecal,"\067\076\079\078\069\n\040\083\104\105\102\116 \043 \067\041")Cheer.Bind(S,y.History.Undo)Cheer.Bind(T,y.History.Redo)Cheer.Bind(I,y.CloneSelection)Cheer.Bind(s,y.DeleteSelection)Cheer.Bind(i,y.ExportSelection)Cheer.Bind(y.History.Changed,function()S.Image=y.History.Index==0 and y.Assets.UndoInactiveDecal or y.Assets.UndoActiveDecal T.Image=y.History.Index==#y.History.Stack and y.Assets.RedoInactiveDecal or y.Assets.RedoActiveDecal end)Cheer.Bind(y.Selection.Changed,function()I.Image=#y.Selection.Items==0 and y.Assets.CloneInactiveDecal or y.Assets.CloneActiveDecal s.Image=#y.Selection.Items==0 and y.Assets.DeleteInactiveDecal or y.Assets.DeleteActiveDecal i.Image=#y.Selection.Items==0 and y.Assets.ExportInactiveDecal or y.Assets.ExportActiveDecal end)Cheer.Bind(y.ToolChanged,function()for l,S in pairs(l.ToolButtons)do S.BackgroundTransparency=l==y.CurrentTool and 0 or 1 end end)Cheer.Bind(View.InfoButtons.HelpButton,function()(Cheer(View.ToolInformation)).HideCurrentSection()View.HelpInfo.Visible=not View.HelpInfo.Visible end);(Cheer(View.ToolInformation)).Start(y)return l end function l.AddSelectionButton(l,y)local S=View.SelectionButton:Clone()local T=#View.SelectionButtons:GetChildren()S.Parent=View.SelectionButtons S.Image=l S.Visible=true S.Position=UDim2.new((T%2)*.5,0,0,S.AbsoluteSize.Y*math.floor(T/2));(Cheer(View.Tooltip,S)).Start(y)return S end l.ToolButtons={}function l.AddToolButton(y,S,T,s)local i=View.ToolButton:Clone()local I=#View.ToolButtons:GetChildren()i.Parent=View.ToolButtons i.BackgroundColor3=T.Color and T.Color.Color or Color3.new(0,0,0)i.BackgroundTransparency=Core.CurrentTool==T and 0 or 1 i.Image=y i.Visible=true i.Hotkey.Text=S l.ToolButtons[T]=i Cheer.Bind(i,Support.Call(Core.EquipTool,T));(Cheer(View.ToolInformation)).RegisterSection(s)Support.AddGuiInputListener(i,"\066\101\103\097\110",{"\077\111\117\115\101\066\117\116\116\111\110\049"},false,function()(Cheer(View.ToolInformation)).ProcessClick(T,s)end)Support.AddGuiInputListener(i,"\066\101\103\097\110",{"\077\111\117\115\101\077\111\118\101\109\101\110\116"},false,function()(Cheer(View.ToolInformation)).ProcessHover(T,s)end)Support.AddGuiInputListener(i,"\069\110\100\101\100",{"\077\111\117\115\101\077\111\118\101\109\101\110\116"},true,function()(Cheer(View.ToolInformation)).ProcessUnhover(T,s)end)local v=nil Support.AddGuiInputListener(i,"\066\101\103\097\110",{"\084\111\117\099\104"},false,function()local l=tick()v=l wait(.5)if v==l then(Cheer(View.ToolInformation)).ProcessClick(T,s)end end)Support.AddGuiInputListener(i,"\069\110\100\101\100",{"\084\111\117\099\104"},true,function()v=nil end)i.Position=UDim2.new((I%2)*.5,0,0,i.AbsoluteSize.Y*math.floor(I/2))return i end
-- Create component
local Component = Cheer.CreateComponent("BTDock", View, true)

function Component.Start(Core)
	-- Show the view
	View.Visible = true

	-- Store core API reference
	getfenv(1).Core = Core

	-- Create selection buttons
	local UndoButton = Component.AddSelectionButton(Core.Assets.UndoInactiveDecal, "UNDO\n(Shift + Z)")
	local RedoButton = Component.AddSelectionButton(Core.Assets.RedoInactiveDecal, "REDO\n(Shift + Y)")
	local DeleteButton = Component.AddSelectionButton(Core.Assets.DeleteInactiveDecal, "DELETE\n(Shift + X)")
	local ExportButton = Component.AddSelectionButton(Core.Assets.ExportInactiveDecal, "EXPORT\n(Shift + P)")
	local CloneButton = Component.AddSelectionButton(Core.Assets.CloneInactiveDecal, "CLONE\n(Shift + C)")

	-- Connect selection buttons to core systems
	Cheer.Bind(UndoButton, Core.History.Undo)
	Cheer.Bind(RedoButton, Core.History.Redo)
	Cheer.Bind(CloneButton, Core.CloneSelection)
	Cheer.Bind(DeleteButton, Core.DeleteSelection)
	Cheer.Bind(ExportButton, Core.ExportSelection)

	-- Highlight history selection buttons according to state
	Cheer.Bind(Core.History.Changed, function()
		UndoButton.Image = (Core.History.Index == 0) and Core.Assets.UndoInactiveDecal or Core.Assets.UndoActiveDecal
		RedoButton.Image = (Core.History.Index == #Core.History.Stack) and Core.Assets.RedoInactiveDecal
			or Core.Assets.RedoActiveDecal
	end)

	-- Highlight clone/delete/export buttons according to selection state
	Cheer.Bind(Core.Selection.Changed, function()
		CloneButton.Image = (#Core.Selection.Items == 0) and Core.Assets.CloneInactiveDecal
			or Core.Assets.CloneActiveDecal
		DeleteButton.Image = (#Core.Selection.Items == 0) and Core.Assets.DeleteInactiveDecal
			or Core.Assets.DeleteActiveDecal
		ExportButton.Image = (#Core.Selection.Items == 0) and Core.Assets.ExportInactiveDecal
			or Core.Assets.ExportActiveDecal
	end)

	-- Highlight current tools
	Cheer.Bind(Core.ToolChanged, function()
		for Tool, Button in pairs(Component.ToolButtons) do
			Button.BackgroundTransparency = (Tool == Core.CurrentTool) and 0 or 1
		end
	end)

	-- Toggle help section on help button click
	Cheer.Bind(View.InfoButtons.HelpButton, function()
		Cheer(View.ToolInformation).HideCurrentSection()
		View.HelpInfo.Visible = not View.HelpInfo.Visible
	end)

	-- Start tool information section manager
	Cheer(View.ToolInformation).Start(Core)

	-- Return component for chaining
	return Component
end

function Component.AddSelectionButton(InitialIcon, Tooltip)
	-- Create the button
	local Button = View.SelectionButton:Clone()
	local Index = #View.SelectionButtons:GetChildren()
	Button.Parent = View.SelectionButtons
	Button.Image = InitialIcon
	Button.Visible = true

	-- Position the button
	Button.Position = UDim2.new(Index % 2 * 0.5, 0, 0, Button.AbsoluteSize.Y * math.floor(Index / 2))

	-- Add a tooltip to the button
	Cheer(View.Tooltip, Button).Start(Tooltip)

	-- Return the button
	return Button
end

Component.ToolButtons = {}

function Component.AddToolButton(Icon, Hotkey, Tool, InfoSection)
	-- Create the button
	local Button = View.ToolButton:Clone()
	local Index = #View.ToolButtons:GetChildren()
	Button.Parent = View.ToolButtons
	Button.BackgroundColor3 = Tool.Color and Tool.Color.Color or Color3.new(0, 0, 0)
	Button.BackgroundTransparency = (Core.CurrentTool == Tool) and 0 or 1
	Button.Image = Icon
	Button.Visible = true
	Button.Hotkey.Text = Hotkey

	-- Register the button
	Component.ToolButtons[Tool] = Button

	-- Trigger tool when button is pressed
	Cheer.Bind(Button, Support.Call(Core.EquipTool, Tool))

	-- Register information section
	Cheer(View.ToolInformation).RegisterSection(InfoSection)

	-- Trigger information section on interactions with button
	Support.AddGuiInputListener(Button, "Began", { "MouseButton1" }, false, function()
		Cheer(View.ToolInformation).ProcessClick(Tool, InfoSection)
	end)
	Support.AddGuiInputListener(Button, "Began", { "MouseMovement" }, false, function()
		Cheer(View.ToolInformation).ProcessHover(Tool, InfoSection)
	end)
	Support.AddGuiInputListener(Button, "Ended", { "MouseMovement" }, true, function()
		Cheer(View.ToolInformation).ProcessUnhover(Tool, InfoSection)
	end)

	-- Time how long each press on the button lasts
	local TouchStart = nil
	Support.AddGuiInputListener(Button, "Began", { "Touch" }, false, function()
		local Timestamp = tick()
		TouchStart = Timestamp
		wait(0.5)

		-- Trigger tool info if still touching after delay
		if TouchStart == Timestamp then
			Cheer(View.ToolInformation).ProcessClick(Tool, InfoSection)
		end
	end)
	Support.AddGuiInputListener(Button, "Ended", { "Touch" }, true, function()
		TouchStart = nil
	end)

	-- Position the button
	Button.Position = UDim2.new(Index % 2 * 0.5, 0, 0, Button.AbsoluteSize.Y * math.floor(Index / 2))

	-- Return the button
	return Button
end
