local r=(require(script.Parent.loader)).load(script)local Q=r("\066\097\115\105\099\080\097\110\101")local t=r("\080\108\117\103\105\110\084\101\109\112\108\097\116\101\080\114\111\118\105\100\101\114")local x=setmetatable({},Q)x.__index=x x.ClassName="\067\104\101\099\107\098\111\120"function x.new(r,w)local E=setmetatable(Q.new((r:GetService(t)):Clone("\067\104\101\099\107\098\111\120\084\101\109\112\108\097\116\101")),x)E._serviceBag=assert(r,"\078\111 \115\101\114\118\105\099\101\066\097\103")E._checked=w.BoolValue or error("\078\111 \099\104\101\099\107\101\100\086\097\108\117\101")E._checkButton=E.Gui.CheckButton E._textLabel=E.Gui.TextLabel E._textLabel.Text=w.Name or error("\078\111 \110\097\109\101")E._maid:GiveTask(E.Gui.MouseButton1Click:connect(function()E._checked.Value=not E._checked.Value end))E._maid:GiveTask(E._checkButton.MouseButton1Click:connect(function()E._checked.Value=not E._checked.Value end))E._maid:GiveTask(E._checked.Changed:connect(function()E:_updateRender()end))E:_updateRender()return E end function x.GetBoolValue(r)return r._checked end function x.WithRenderData(Q,r)Q._renderData=r or error("\078\111 \082\101\110\100\101\114\068\097\116\097")Q._textLabel.Text=tostring(Q._renderData.Name)return Q end function x._updateRender(r)if r._checked.Value then r._checkButton.Text="\088"else r._checkButton.Text=""end end return x
--[=[
	@class Checkbox
]=]

local require = require(script.Parent.loader).load(script)

local BasicPane = require("BasicPane")
local PluginTemplateProvider = require("PluginTemplateProvider")

local Checkbox = setmetatable({}, BasicPane)
Checkbox.__index = Checkbox
Checkbox.ClassName = "Checkbox"

function Checkbox.new(serviceBag, options)
	local self = setmetatable(BasicPane.new(serviceBag:GetService(PluginTemplateProvider):Clone("CheckboxTemplate")), Checkbox)

	self._serviceBag = assert(serviceBag, "No serviceBag")

	self._checked = options.BoolValue or error("No checkedValue")

	self._checkButton = self.Gui.CheckButton
	self._textLabel = self.Gui.TextLabel
	self._textLabel.Text = options.Name or error("No name")

	self._maid:GiveTask(self.Gui.MouseButton1Click:connect(function()
		self._checked.Value = not self._checked.Value
	end))

	self._maid:GiveTask(self._checkButton.MouseButton1Click:connect(function()
		self._checked.Value = not self._checked.Value
	end))

	self._maid:GiveTask(self._checked.Changed:connect(function()
		self:_updateRender()
	end))
	self:_updateRender()

	return self
end

function Checkbox:GetBoolValue()
	return self._checked
end

function Checkbox:WithRenderData(RenderData)
	self._renderData = RenderData or error("No RenderData")
	self._textLabel.Text = tostring(self._renderData.Name)

	return self
end

function Checkbox:_updateRender()
	if self._checked.Value then
		self._checkButton.Text = "X"
	else
		self._checkButton.Text = ""
	end
end

return Checkbox