local z=script.Parent.Parent return function(a)local m=require(z.Bundles)local x=m.data local g=m.themeSystem local M=m.icons local W=m.Fusion local A=W.New local S=W.Children local l=W.Value local h=W.Observer local R=W.OnEvent local j=W.Computed local T=require(z.utilities)local d=T.get local H=T.animate local o=T.typecheck local G=T.customFont local N=require(z.simpleElements)local L=N.UIPadding local I=N.UICorner local J,k=o(a,{Name="",DisabledText="";IsEnabled=false;Visible=false;Callback=function() end},{a.DisabledText and""or"\068\105\115\097\098\108\101\100\084\101\120\116",a.IsEnabled and""or"\073\115\069\110\097\098\108\101\100",a.Visible and""or"\086\105\115\105\098\108\101"})assert(J,table.concat(k,"\n"))local X=x.find("\115\101\108\101\099\116\101\100\084\097\098")local E=x.find("\115\101\097\114\099\104\084\101\120\116")local Z=x.add(a)local F=a.Parent local Q=a.Name local Y=a.Visible or l(true)local p=a.IsEnabled or l(true)local e=a.DisabledText or l("\067\111\109\112\111\110\101\110\116 \068\105\115\097\098\108\101\100")local i=a.Callback local D=l(d(X.string)==(d(Z.tab)).uid);(h(X.string)):onChange(function()D:set(d(X.string)==(d(Z.tab)).uid)end)local u=H(function()return d(D)and 0 or 1 end,40,1);(A("\084\101\120\116\066\117\116\116\111\110"))({Interactable=j(function()if not d(p)then return false end return d(D)end);Visible=j(function()if d(E.string)~=""and not string.find((d(Q)):lower(),(d(E.string)):lower())or not d(Y)then return false end return true end),Parent=F;Size=UDim2.new(1,0,0,36);BackgroundColor3=g.background2;BackgroundTransparency=u;[R("\065\099\116\105\118\097\116\101\100")]=function()if not d(p)then return end task.spawn(d(i))end,[S]={I(6);(A("\070\114\097\109\101"))({ZIndex=2,Visible=j(function()if not d(p)then return true end return false end);BackgroundTransparency=H(function()return d(D)and.2 or 1 end,40,1),BackgroundColor3=g.disabledBackground,Size=UDim2.fromScale(1,1);[S]={I(6),(A("\073\109\097\103\101\076\097\098\101\108"))({Size=UDim2.fromOffset(24,24);AnchorPoint=Vector2.new(0,.5);Position=UDim2.new(0,5,.5,0);BackgroundTransparency=1,Image=M.lock,ImageColor3=g.disabledText;ImageTransparency=u});(A("\084\101\120\116\076\097\098\101\108"))({FontFace=G("\077\111\110\116\115\101\114\114\097\116",Enum.FontWeight.Bold);BackgroundTransparency=1;Size=UDim2.new(1,-24,0,18);TextColor3=g.disabledText;TextTransparency=u;TextScaled=true;AnchorPoint=Vector2.new(0,.5);Position=UDim2.new(0,29,.5,0);Text=e,TextXAlignment=Enum.TextXAlignment.Left;RichText=true,[S]={L(0,5)}})}}),(A("\070\114\097\109\101"))({Size=UDim2.fromScale(1,1);BackgroundTransparency=1,[S]={L(0,8);(A("\084\101\120\116\076\097\098\101\108"))({FontFace=G("\077\111\110\116\115\101\114\114\097\116",Enum.FontWeight.Bold),Size=UDim2.new(1,-39,0,18);BackgroundTransparency=1;TextColor3=g.text,TextScaled=true;AnchorPoint=Vector2.new(0,.5),Position=UDim2.new(0,0,.5,0),Text=Q;TextTransparency=u;TextXAlignment=Enum.TextXAlignment.Left;RichText=true});(A("\073\109\097\103\101\076\097\098\101\108"))({Size=UDim2.fromOffset(24,24);AnchorPoint=Vector2.new(1,.5),Position=UDim2.new(1,0,.5,0),BackgroundTransparency=1,Image=M.fingerprint,ImageColor3=g.text2;ImageTransparency=u})}})}})local w={}function w.SetName(a,z)local m,x=o({SetName=z},{SetName=""})assert(m,table.concat(x,"\n"))Q:set(z)end function w.SetCallback(a,z)local m,x=o({SetCallback=z},{SetCallback=function() end})assert(m,table.concat(x,"\n"))i:set(z)end function w.Fire(z)task.spawn(d(i))end function w.Enable(z)p:set(true)end function w.Disable(z)p:set(false)end function w.Visible(z)Y:set(true)end function w.Invisible(z)Y:set(false)end return w end
local darius = script.Parent.Parent
return function(property)
	local Bundles = require(darius.Bundles)
	local data = Bundles.data
	local theme = Bundles.themeSystem
	local icons = Bundles.icons
	local Fusion = Bundles.Fusion
		local new = Fusion.New
		local children = Fusion.Children
		local value = Fusion.Value
		local observe = Fusion.Observer
		local onevent = Fusion.OnEvent
		local computed = Fusion.Computed

	local utilities = require(darius.utilities)
	local get = utilities.get
	local animate = utilities.animate
	local typecheck = utilities.typecheck
	local customFont = utilities.customFont

	local simpleElements = require(darius.simpleElements)
	local UIPadding = simpleElements.UIPadding
	local UICorner = simpleElements.UICorner

	-- Typecheck

	local didPass, failedItems = typecheck(property,{
		Name = "",
		DisabledText = "",
        IsEnabled = false,
		Visible = false,
        Callback = function()end
	},{
		property.DisabledText and "" or "DisabledText",
		property.IsEnabled and "" or "IsEnabled",
		property.Visible and "" or "Visible"
	})
	assert(didPass, table.concat(failedItems, "\n"))

	-- Data

	local selectedTab = data.find("selectedTab")
	local searchText = data.find("searchText")
	local button = data.add(property)

	-- Properties

	local _parent = property.Parent
	local name = property.Name
	local visible = property.Visible or value(true)
	local isEnabled = property.IsEnabled or value(true)
	local disabledText = property.DisabledText or value("Component Disabled")
	local callback = property.Callback

	-- Variables

	local isSelected = value(get(selectedTab.string) == get(button.tab).uid)
	observe(selectedTab.string):onChange(function()
		isSelected:set(get(selectedTab.string) == get(button.tab).uid)
	end)
	local selectedAnimation = animate(function()
		return get(isSelected) and 0 or 1
	end, 40, 1)

	-- Button

	new "TextButton" {
		Interactable = computed(function()
			if not get(isEnabled) then
				return false
			end
			return get(isSelected)
		end),
		Visible = computed(function()
			if get(searchText.string) ~= "" and not string.find(get(name):lower(), get(searchText.string):lower()) or not get(visible) then
				return false
			end
			return true
		end),
		Parent = _parent,
		Size = UDim2.new(1,0,0,36),
		BackgroundColor3 = theme.background2,
		BackgroundTransparency = selectedAnimation,

		[onevent "Activated"] = function()
			if not get(isEnabled) then
				return
			end
			task.spawn(get(callback))
		end,

		[children] = {
			UICorner(6),
			new "Frame" { -- Disabled Frame
				ZIndex = 2,
				Visible = computed(function()
					if not get(isEnabled)  then
						return true
					end
					return false
				end),
				BackgroundTransparency = animate(function()
					return get(isSelected) and 0.2 or 1
				end,40,1),
				BackgroundColor3 = theme.disabledBackground,
				Size = UDim2.fromScale(1,1),

				[children] = {
					UICorner(6),
					new "ImageLabel" { -- Icon
						Size = UDim2.fromOffset(24,24),
						AnchorPoint = Vector2.new(0,0.5),
						Position = UDim2.new(0,5,0.5,0),
						BackgroundTransparency = 1,
						Image = icons.lock,
						ImageColor3 = theme.disabledText,
						ImageTransparency = selectedAnimation,
					},
					new "TextLabel" {
						FontFace = customFont("Montserrat", Enum.FontWeight.Bold),
						BackgroundTransparency = 1,
						Size = UDim2.new(1,-24,0,18),
						TextColor3 = theme.disabledText,
						TextTransparency = selectedAnimation,
						TextScaled = true,
						AnchorPoint = Vector2.new(0,0.5),
						Position = UDim2.new(0,29,0.5,0),
						Text = disabledText,
						TextXAlignment = Enum.TextXAlignment.Left,
						RichText = true,

						[children] = {
							UIPadding(0,5)
						}
					}
				}
			},
			new "Frame" {
				Size = UDim2.fromScale(1,1),
				BackgroundTransparency = 1,
				[children] = {
					UIPadding(0,8),
					new "TextLabel" { -- Title
						FontFace = customFont("Montserrat", Enum.FontWeight.Bold),
						Size = UDim2.new(1,-39,0,18),
						BackgroundTransparency = 1,
						TextColor3 = theme.text,
						TextScaled = true,
						AnchorPoint = Vector2.new(0,0.5),
						Position = UDim2.new(0,0,0.5,0),
						Text = name,
						TextTransparency = selectedAnimation,
						TextXAlignment = Enum.TextXAlignment.Left,
						RichText = true
					},
					new "ImageLabel" { -- Icon
						Size = UDim2.fromOffset(24,24),
						AnchorPoint = Vector2.new(1,0.5),
						Position = UDim2.new(1,0,0.5,0),
						BackgroundTransparency = 1,
						Image = icons.fingerprint,
						ImageColor3 = theme.text2,
						ImageTransparency = selectedAnimation
					}
				}
			}
		}
	}

	local returnFunctions = {}
	function returnFunctions:SetName(newText)
		local _didPass, _failedItems = typecheck({['SetName'] = newText}, {SetName = ""})
		assert(_didPass, table.concat(_failedItems, "\n"))

		name:set(newText)
	end
	function returnFunctions:SetCallback(newFunction)
		local _didPass, _failedItems = typecheck({['SetCallback'] = newFunction}, {SetCallback = function()end})
		assert(_didPass, table.concat(_failedItems, "\n"))

		callback:set(newFunction)
	end
	function returnFunctions:Fire()
		task.spawn(get(callback))
	end
	function returnFunctions:Enable()
		isEnabled:set(true)
	end
	function returnFunctions:Disable()
		isEnabled:set(false)
	end
	function returnFunctions:Visible()
		visible:set(true)
	end
	function returnFunctions:Invisible()
		visible:set(false)
	end
	return returnFunctions
end