local S,a=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 j={}local u=(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 P=script.Parent local V={}V.__index=V function V.Destroy(S)S.Destroyed=true end function V.SetActive(S,a)if a==S.Active then return end if a==false then S.MessageLogDisplay:Clear()else S.MessageLogDisplay:SetCurrentChannelName(S.Name)for a=1,#S.MessageLog,1 do S.MessageLogDisplay:AddMessage(S.MessageLog[a])end end S.Active=a end local C=S or a function V.UpdateMessageFiltered(S,a)local j=1 local u=S.MessageLog local P=nil while j<=#u do local S=u[j]if S.ID==a.ID then P=S break end j=j+1 end if P then P.Message=a.Message P.IsFiltered=true if not S.Active then return end else S:AddMessageToChannelByTimeStamp(a)return end if C and P.Message==""then table.remove(S.MessageLog,j)end S.MessageLogDisplay:UpdateMessageFiltered(P)end local p=require(u:WaitForChild("\067\104\097\116\083\101\116\116\105\110\103\115"))function V.AddMessageToChannel(S,a)table.insert(S.MessageLog,a)if S.Active then S.MessageLogDisplay:AddMessage(a)end if p.MessageHistoryLengthPerChannel<#S.MessageLog then S:RemoveLastMessageFromChannel()end end function V.InternalAddMessageAtTimeStamp(S,a)for j=1,#S.MessageLog,1 do if a.Time<S.MessageLog[j].Time then table.insert(S.MessageLog,j,a)return end end table.insert(S.MessageLog,a)end function V.AddMessagesToChannelByTimeStamp(S,a,j)for j=j,#a,1 do S:InternalAddMessageAtTimeStamp(a[j])end while p.MessageHistoryLengthPerChannel<#S.MessageLog do table.remove(S.MessageLog,1)end if S.Active then S.MessageLogDisplay:Clear()for a=1,#S.MessageLog,1 do S.MessageLogDisplay:AddMessage(S.MessageLog[a])end end end function V.AddMessageToChannelByTimeStamp(S,a)if not(#S.MessageLog>=1)then S:AddMessageToChannel(a)return end if a.Time<S.MessageLog[1].Time then return end if S.MessageLog[#S.MessageLog].Time<=a.Time then S:AddMessageToChannel(a)return end for j=1,#S.MessageLog,1 do if a.Time<S.MessageLog[j].Time then table.insert(S.MessageLog,j,a)if p.MessageHistoryLengthPerChannel<#S.MessageLog then S:RemoveLastMessageFromChannel()end if S.Active then S.MessageLogDisplay:AddMessageAtIndex(a,j)end return end end end function V.RemoveLastMessageFromChannel(S)table.remove(S.MessageLog,1)if S.Active then S.MessageLogDisplay:RemoveLastMessage()end end function V.ClearMessageLog(S)S.MessageLog={}if S.Active then S.MessageLogDisplay:Clear()end end function V.RegisterChannelTab(S,a)S.ChannelTab=a end function j.new(S,a)local j=setmetatable({},V)j.Destroyed=false j.Active=false j.MessageLog={}j.MessageLogDisplay=a j.ChannelTab=nil j.Name=S return j end return j


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;
