local M=game:GetService("\076\105\103\104\116\105\110\103")local B=game:GetService("\082\117\110\083\101\114\118\105\099\101")local f=(game:GetService("\080\108\097\121\101\114\115")).LocalPlayer local e=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local D=game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")local A=(game:GetService("\087\111\114\107\115\112\097\099\101")).CurrentCamera local n=f:GetMouse()local H=script local b=require(H.Creator)local d=require(H.Elements)local z=require(H.Acrylic)local p=H.Components local s=require(p.Notification)local C=b.New local R=protectgui or syn and syn.protect_gui or function() end local U=C("\083\099\114\101\101\110\071\117\105",{Parent=B:IsStudio()and f.PlayerGui or game:GetService("\067\111\114\101\071\117\105")})R(U)s:Init(U)local J={Version="\049\046\049\046\048";OpenFrames={};Options={},Themes=(require(H.Themes)).Names,Window=nil;WindowFrame=nil;Unloaded=false,Theme="\068\097\114\107";DialogOpen=false;UseAcrylic=false;Acrylic=false,Transparency=true,MinimizeKeybind=nil;MinimizeKey=Enum.KeyCode.LeftControl;GUI=U}function J.SafeCallback(B,M,...)if not M then return end local f,e=pcall(M,...)if not f then local M,B=e:find("\058\037\100\043\058 ")if not B then return J:Notify({Title="\073\110\116\101\114\102\097\099\101";Content="\067\097\108\108\098\097\099\107 \101\114\114\111\114";SubContent=e;Duration=5})end return J:Notify({Title="\073\110\116\101\114\102\097\099\101";Content="\067\097\108\108\098\097\099\107 \101\114\114\111\114";SubContent=e:sub(B+1);Duration=5})end end function J.Round(f,M,B)if B==0 then return math.floor(M)end M=tostring(M)return M:find("\037\046")and tonumber(M:sub(1,M:find("\037\046")+B))or M end local o=(require(H.Icons)).assets function J.GetIcon(B,M)if M~=nil and o["\108\117\099\105\100\101-"..M]then return o["\108\117\099\105\100\101-"..M]end return nil end local j={}j.__index=j j.__namecall=function(M,B,...)return j[B](...)end for M,B in ipairs(d)do j["\065\100\100"..B.__type]=function(M,f,e)B.Container=M.Container B.Type=M.Type B.ScrollFrame=M.ScrollFrame B.Library=J return B:New(f,e)end end J.Elements=j function J.CreateWindow(B,M)assert(M.Title,"\087\105\110\100\111\119 - \077\105\115\115\105\110\103 \084\105\116\108\101")if J.Window then print("\089\111\117 \099\097\110\110\111\116 \099\114\101\097\116\101 \109\111\114\101 \116\104\097\110 \111\110\101 \119\105\110\100\111\119\046")return end J.MinimizeKey=M.MinimizeKey or Enum.KeyCode.LeftControl J.UseAcrylic=M.Acrylic or false J.Acrylic=M.Acrylic or false J.Theme=M.Theme or"\068\097\114\107"if M.Acrylic then z.init()end local f=(require(p.Window))({Parent=U,Size=M.Size;Title=M.Title,SubTitle=M.SubTitle,TabWidth=M.TabWidth})J.Window=f J:SetTheme(M.Theme)return f end function J.SetTheme(B,M)if J.Window and table.find(J.Themes,M)then J.Theme=M b.UpdateTheme()end end function J.Destroy(M)if J.Window then J.Unloaded=true if J.UseAcrylic then J.Window.AcrylicPaint.Model:Destroy()end b.Disconnect()J.GUI:Destroy()end end function J.ToggleAcrylic(B,M)if J.Window then if J.UseAcrylic then J.Acrylic=M J.Window.AcrylicPaint.Model.Transparency=M and.98 or 1 if M then z.Enable()else z.Disable()end end end end function J.ToggleTransparency(B,M)if J.Window then J.Window.AcrylicPaint.Frame.Background.BackgroundTransparency=M and.35 or 0 end end function J.Notify(B,M)return s:New(M)end if getgenv then(getgenv()).Fluent=J end return J
local Lighting = game:GetService("Lighting")
local RunService = game:GetService("RunService")
local LocalPlayer = game:GetService("Players").LocalPlayer
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local Camera = game:GetService("Workspace").CurrentCamera
local Mouse = LocalPlayer:GetMouse()

local Root = script
local Creator = require(Root.Creator)
local ElementsTable = require(Root.Elements)
local Acrylic = require(Root.Acrylic)
local Components = Root.Components
local NotificationModule = require(Components.Notification)

local New = Creator.New

local ProtectGui = protectgui or (syn and syn.protect_gui) or function() end
local GUI = New("ScreenGui", {
	Parent = RunService:IsStudio() and LocalPlayer.PlayerGui or game:GetService("CoreGui"),
})
ProtectGui(GUI)
NotificationModule:Init(GUI)

local Library = {
	Version = "1.1.0",

	OpenFrames = {},
	Options = {},
	Themes = require(Root.Themes).Names,

	Window = nil,
	WindowFrame = nil,
	Unloaded = false,

	Theme = "Dark",
	DialogOpen = false,
	UseAcrylic = false,
	Acrylic = false,
	Transparency = true,
	MinimizeKeybind = nil,
	MinimizeKey = Enum.KeyCode.LeftControl,

	GUI = GUI,
}

function Library:SafeCallback(Function, ...)
	if not Function then
		return
	end

	local Success, Event = pcall(Function, ...)
	if not Success then
		local _, i = Event:find(":%d+: ")

		if not i then
			return Library:Notify({
				Title = "Interface",
				Content = "Callback error",
				SubContent = Event,
				Duration = 5,
			})
		end

		return Library:Notify({
			Title = "Interface",
			Content = "Callback error",
			SubContent = Event:sub(i + 1),
			Duration = 5,
		})
	end
end

function Library:Round(Number, Factor)
	if Factor == 0 then
		return math.floor(Number)
	end
	Number = tostring(Number)
	return Number:find("%.") and tonumber(Number:sub(1, Number:find("%.") + Factor)) or Number
end

local Icons = require(Root.Icons).assets
function Library:GetIcon(Name)
	if Name ~= nil and Icons["lucide-" .. Name] then
		return Icons["lucide-" .. Name]
	end
	return nil
end

local Elements = {}
Elements.__index = Elements
Elements.__namecall = function(Table, Key, ...)
	return Elements[Key](...)
end

for _, ElementComponent in ipairs(ElementsTable) do
	Elements["Add" .. ElementComponent.__type] = function(self, Idx, Config)
		ElementComponent.Container = self.Container
		ElementComponent.Type = self.Type
		ElementComponent.ScrollFrame = self.ScrollFrame
		ElementComponent.Library = Library

		return ElementComponent:New(Idx, Config)
	end
end

Library.Elements = Elements

function Library:CreateWindow(Config)
	assert(Config.Title, "Window - Missing Title")

	if Library.Window then
		print("You cannot create more than one window.")
		return
	end

	Library.MinimizeKey = Config.MinimizeKey or Enum.KeyCode.LeftControl
	Library.UseAcrylic = Config.Acrylic or false
	Library.Acrylic = Config.Acrylic or false
	Library.Theme = Config.Theme or "Dark"
	if Config.Acrylic then
		Acrylic.init()
	end

	local Window = require(Components.Window)({
		Parent = GUI,
		Size = Config.Size,
		Title = Config.Title,
		SubTitle = Config.SubTitle,
		TabWidth = Config.TabWidth,
	})

	Library.Window = Window
	Library:SetTheme(Config.Theme)

	return Window
end

function Library:SetTheme(Value)
	if Library.Window and table.find(Library.Themes, Value) then
		Library.Theme = Value
		Creator.UpdateTheme()
	end
end

function Library:Destroy()
	if Library.Window then
		Library.Unloaded = true
		if Library.UseAcrylic then
			Library.Window.AcrylicPaint.Model:Destroy()
		end
		Creator.Disconnect()
		Library.GUI:Destroy()
	end
end

function Library:ToggleAcrylic(Value)
	if Library.Window then
		if Library.UseAcrylic then
			Library.Acrylic = Value
			Library.Window.AcrylicPaint.Model.Transparency = Value and 0.98 or 1
			if Value then
				Acrylic.Enable()
			else
				Acrylic.Disable()
			end
		end
	end
end

function Library:ToggleTransparency(Value)
	if Library.Window then
		Library.Window.AcrylicPaint.Frame.Background.BackgroundTransparency = Value and 0.35 or 0
	end
end

function Library:Notify(Config)
	return NotificationModule:New(Config)
end

if getgenv then
	getgenv().Fluent = Library
end

return Library
