local v,Y=pcall(function()return(UserSettings()):IsUserFeatureEnabled("\085\115\101\114\070\108\097\103\082\101\109\111\118\101\077\101\115\115\097\103\101\070\114\111\109\077\101\115\115\097\103\101\076\111\103")end)local y={}local w=(game:GetService("\067\104\097\116")):WaitForChild("\067\108\105\101\110\116\067\104\097\116\077\111\100\117\108\101\115")local I=script.Parent local n={}n.__index=n function n.Destroy(v)v.Destroyed=true end function n.SetActive(v,Y)if Y==v.Active then return end if Y==false then v.MessageLogDisplay:Clear()else v.MessageLogDisplay:SetCurrentChannelName(v.Name)for Y=1,#v.MessageLog,1 do v.MessageLogDisplay:AddMessage(v.MessageLog[Y])end end v.Active=Y end local z=v or Y function n.UpdateMessageFiltered(v,Y)local y=1 local w=v.MessageLog local I=nil while y<=#w do local v=w[y]if v.ID==Y.ID then I=v break end y=y+1 end if I then I.Message=Y.Message I.IsFiltered=true if not v.Active then return end else v:AddMessageToChannelByTimeStamp(Y)return end if z and I.Message==""then table.remove(v.MessageLog,y)end v.MessageLogDisplay:UpdateMessageFiltered(I)end local m=require(w:WaitForChild("\067\104\097\116\083\101\116\116\105\110\103\115"))function n.AddMessageToChannel(v,Y)table.insert(v.MessageLog,Y)if v.Active then v.MessageLogDisplay:AddMessage(Y)end if m.MessageHistoryLengthPerChannel<#v.MessageLog then v:RemoveLastMessageFromChannel()end end function n.InternalAddMessageAtTimeStamp(v,Y)for y=1,#v.MessageLog,1 do if Y.Time<v.MessageLog[y].Time then table.insert(v.MessageLog,y,Y)return end end table.insert(v.MessageLog,Y)end function n.AddMessagesToChannelByTimeStamp(v,Y,y)for y=y,#Y,1 do v:InternalAddMessageAtTimeStamp(Y[y])end while m.MessageHistoryLengthPerChannel<#v.MessageLog do table.remove(v.MessageLog,1)end if v.Active then v.MessageLogDisplay:Clear()for Y=1,#v.MessageLog,1 do v.MessageLogDisplay:AddMessage(v.MessageLog[Y])end end end function n.AddMessageToChannelByTimeStamp(v,Y)if not(#v.MessageLog>=1)then v:AddMessageToChannel(Y)return end if Y.Time<v.MessageLog[1].Time then return end if v.MessageLog[#v.MessageLog].Time<=Y.Time then v:AddMessageToChannel(Y)return end for y=1,#v.MessageLog,1 do if Y.Time<v.MessageLog[y].Time then table.insert(v.MessageLog,y,Y)if m.MessageHistoryLengthPerChannel<#v.MessageLog then v:RemoveLastMessageFromChannel()end if v.Active then v.MessageLogDisplay:AddMessageAtIndex(Y,y)end return end end end function n.RemoveLastMessageFromChannel(v)table.remove(v.MessageLog,1)if v.Active then v.MessageLogDisplay:RemoveLastMessage()end end function n.ClearMessageLog(v)v.MessageLog={}if v.Active then v.MessageLogDisplay:Clear()end end function n.RegisterChannelTab(v,Y)v.ChannelTab=Y end function y.new(v,Y)local y=setmetatable({},n)y.Destroyed=false y.Active=false y.MessageLog={}y.MessageLogDisplay=Y y.ChannelTab=nil y.Name=v return y end return y
-- Decompiled with the Synapse X Luau decompiler.

local v1, v2 = pcall(function()
	return UserSettings():IsUserFeatureEnabled("UserFlagRemoveMessageFromMessageLog")
end)
local v3 = {}
local l__ClientChatModules__4 = game:GetService("Chat"):WaitForChild("ClientChatModules")
local l__Parent__5 = script.Parent
local v6 = {}
v6.__index = v6
function v6.Destroy(p1)
	p1.Destroyed = true
end
function v6.SetActive(p2, p3)
	if p3 == p2.Active then
		return
	end
	if p3 == false then
		p2.MessageLogDisplay:Clear()
	else
		p2.MessageLogDisplay:SetCurrentChannelName(p2.Name)
		for v7 = 1, #p2.MessageLog do
			p2.MessageLogDisplay:AddMessage(p2.MessageLog[v7])
		end
	end
	p2.Active = p3
end
local u1 = v1 or v2
function v6.UpdateMessageFiltered(p4, p5)
	local v8 = 1
	local l__MessageLog__9 = p4.MessageLog
	local v10 = nil
	while v8 <= #l__MessageLog__9 do
		local v11 = l__MessageLog__9[v8]
		if v11.ID == p5.ID then
			v10 = v11
			break
		end
		v8 = v8 + 1
	end
	if v10 then
		v10.Message = p5.Message
		v10.IsFiltered = true
		if not p4.Active then
			return
		end
	else
		p4:AddMessageToChannelByTimeStamp(p5)
		return
	end
	if u1 and v10.Message == "" then
		table.remove(p4.MessageLog, v8)
	end
	p4.MessageLogDisplay:UpdateMessageFiltered(v10)
end
local u2 = require(l__ClientChatModules__4:WaitForChild("ChatSettings"))
function v6.AddMessageToChannel(p6, p7)
	table.insert(p6.MessageLog, p7)
	if p6.Active then
		p6.MessageLogDisplay:AddMessage(p7)
	end
	if u2.MessageHistoryLengthPerChannel < #p6.MessageLog then
		p6:RemoveLastMessageFromChannel()
	end
end
function v6.InternalAddMessageAtTimeStamp(p8, p9)
	for v12 = 1, #p8.MessageLog do
		if p9.Time < p8.MessageLog[v12].Time then
			table.insert(p8.MessageLog, v12, p9)
			return
		end
	end
	table.insert(p8.MessageLog, p9)
end
function v6.AddMessagesToChannelByTimeStamp(p10, p11, p12)
	for v13 = p12, #p11 do
		p10:InternalAddMessageAtTimeStamp(p11[v13])
	end
	while u2.MessageHistoryLengthPerChannel < #p10.MessageLog do
		table.remove(p10.MessageLog, 1)
	end
	if p10.Active then
		p10.MessageLogDisplay:Clear()
		for v14 = 1, #p10.MessageLog do
			p10.MessageLogDisplay:AddMessage(p10.MessageLog[v14])
		end
	end
end
function v6.AddMessageToChannelByTimeStamp(p13, p14)
	if not (#p13.MessageLog >= 1) then
		p13:AddMessageToChannel(p14)
		return
	end
	if p14.Time < p13.MessageLog[1].Time then
		return
	end
	if p13.MessageLog[#p13.MessageLog].Time <= p14.Time then
		p13:AddMessageToChannel(p14)
		return
	end
	for v15 = 1, #p13.MessageLog do
		if p14.Time < p13.MessageLog[v15].Time then
			table.insert(p13.MessageLog, v15, p14)
			if u2.MessageHistoryLengthPerChannel < #p13.MessageLog then
				p13:RemoveLastMessageFromChannel()
			end
			if p13.Active then
				p13.MessageLogDisplay:AddMessageAtIndex(p14, v15)
			end
			return
		end
	end
end
function v6.RemoveLastMessageFromChannel(p15)
	table.remove(p15.MessageLog, 1)
	if p15.Active then
		p15.MessageLogDisplay:RemoveLastMessage()
	end
end
function v6.ClearMessageLog(p16)
	p16.MessageLog = {}
	if p16.Active then
		p16.MessageLogDisplay:Clear()
	end
end
function v6.RegisterChannelTab(p17, p18)
	p17.ChannelTab = p18
end
function v3.new(p19, p20)
	local v16 = setmetatable({}, v6)
	v16.Destroyed = false
	v16.Active = false
	v16.MessageLog = {}
	v16.MessageLogDisplay = p20
	v16.ChannelTab = nil
	v16.Name = p19
	return v16
end
return v3
