local H=require((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\078\101\118\101\114\109\111\114\101"))local A=H("\082\111\116\097\116\105\110\103\076\097\098\101\108")local Q={}Q.ClassName="\082\111\116\097\116\105\110\103\076\097\098\101\108\066\117\105\108\100\101\114"Q.__index=Q function Q.new(H)local A=setmetatable({},Q)if H then A:WithTemplate(H)end return A end function Q.WithTemplate(Q,H)Q._template=H Q._label=A.new()Q._label:SetTemplate(H)local u=Instance.new("\070\114\097\109\101")u.Name=H.Name.."\095\082\111\116\097\116\105\110\103\076\097\098\101\108"u.Size=H.Size u.AnchorPoint=H.AnchorPoint u.Position=H.Position u.SizeConstraint=H.SizeConstraint u.BackgroundTransparency=1 u.BorderSizePixel=0 local T=Instance.new("\070\114\097\109\101")T.Name="\067\111\110\116\097\105\110\101\114"T.SizeConstraint=Enum.SizeConstraint.RelativeYY T.Size=UDim2.new(1,0,1,0)T.BackgroundTransparency=1 T.Parent=u u.Parent=H.Parent return Q:WithGui(u)end function Q.WithGui(A,H)A._label:SetGui(H)A._label.TextXAlignment=A._template.TextXAlignment.Name A._label.Text=A._template.Text A._template.Parent=nil return A end function Q.Create(H)H._label:UpdateRender()return H._label end return Q
--- Builds a new RotatingLabel. See RotatingLabel for more details.
-- @classmod RotatingLabelBuilder

local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore"))

local RotatingLabel = require("RotatingLabel")

local RotatingLabelBuilder = {}
RotatingLabelBuilder.ClassName = "RotatingLabelBuilder"
RotatingLabelBuilder.__index = RotatingLabelBuilder

--- Starts building a new rotating label with the template, if given
function RotatingLabelBuilder.new(template)
	local self = setmetatable({}, RotatingLabelBuilder)

	if template then
		self:WithTemplate(template)
	end

	return self
end

--- Sets the tempate to use, the label will get those properties
function RotatingLabelBuilder:WithTemplate(template)
	self._template = template

	self._label = RotatingLabel.new()
	self._label:SetTemplate(template)

	local frame = Instance.new("Frame")
	frame.Name = template.Name .. "_RotatingLabel"
	frame.Size = template.Size
	frame.AnchorPoint = template.AnchorPoint
	frame.Position = template.Position
	frame.SizeConstraint = template.SizeConstraint
	frame.BackgroundTransparency = 1
	frame.BorderSizePixel = 0

	local container = Instance.new("Frame")
	container.Name = "Container"
	container.SizeConstraint = Enum.SizeConstraint.RelativeYY
	container.Size = UDim2.new(1, 0, 1, 0)
	container.BackgroundTransparency = 1

	container.Parent = frame
	frame.Parent = template.Parent

	return self:WithGui(frame)
end

function RotatingLabelBuilder:WithGui(gui)
	self._label:SetGui(gui)
	self._label.TextXAlignment = self._template.TextXAlignment.Name
	self._label.Text = self._template.Text

	self._template.Parent = nil

	return self
end

--- Creates the new label and returns it
function RotatingLabelBuilder:Create()
	self._label:UpdateRender()

	return self._label
end

return RotatingLabelBuilder