local y="\066\097\115\101\070\114\097\109\101"local k="\066\097\115\101\077\101\115\115\097\103\101"local S="\085\112\100\097\116\101\084\101\120\116\070\117\110\099\116\105\111\110"local x="\071\101\116\072\101\105\103\104\116\070\117\110\099\116\105\111\110"local T="\070\097\100\101\073\110\070\117\110\099\116\105\111\110"local M="\070\097\100\101\079\117\116\070\117\110\099\116\105\111\110"local X="\085\112\100\097\116\101\065\110\105\109\070\117\110\099\116\105\111\110"local G=game:GetService("\080\108\097\121\101\114\115")local h=G.LocalPlayer while not h do G.ChildAdded:wait()h=G.LocalPlayer end local F=script.Parent.Parent local Q=require(F:WaitForChild("\067\104\097\116\083\101\116\116\105\110\103\115"))local v={}local m={}m.__index=m local p=Instance.new("\084\101\120\116\076\097\098\101\108")p.Selectable=false p.TextWrapped=true p.Position=UDim2.new(1,0,1,0)function WaitUntilParentedCorrectly()while not p:IsDescendantOf(h)do p.AncestryChanged:wait()end end local t={}function m.GetStringTextBounds(T,y,k,S,x)WaitUntilParentedCorrectly()x=x or false if not t[y]then t[y]={}end if not t[y][k]then t[y][k]={}end if not t[y][k][x]then t[y][k][x]={}end if not t[y][k][x][S]then p.Text=y p.Font=k p.TextSize=S if x then p.TextWrapped=true p.Size=x else p.TextWrapped=false end t[y][k][x][S]=p.TextBounds end return t[y][k][x][S]end
---Creator function return object keys
local KEY_BASE_FRAME = "BaseFrame"
local KEY_BASE_MESSAGE = "BaseMessage"
local KEY_UPDATE_TEXT_FUNC = "UpdateTextFunction"
local KEY_GET_HEIGHT = "GetHeightFunction"
local KEY_FADE_IN = "FadeInFunction"
local KEY_FADE_OUT = "FadeOutFunction"
local KEY_UPDATE_ANIMATION = "UpdateAnimFunction"

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
while not LocalPlayer do
	Players.ChildAdded:wait()
	LocalPlayer = Players.LocalPlayer
end

local clientChatModules = script.Parent.Parent
local ChatSettings = require(clientChatModules:WaitForChild("ChatSettings"))

local module = {}
local methods = {}
methods.__index = methods

local testLabel = Instance.new("TextLabel")
testLabel.Selectable = false
testLabel.TextWrapped = true
testLabel.Position = UDim2.new(1, 0, 1, 0)

function WaitUntilParentedCorrectly()
	while not testLabel:IsDescendantOf(LocalPlayer) do
		testLabel.AncestryChanged:wait()
	end
end

local TextSizeCache = {}
function methods:GetStringTextBounds(text, font, textSize, sizeBounds)
	WaitUntilParentedCorrectly()
	sizeBounds = sizeBounds or false
	if not TextSizeCache[text] then
		TextSizeCache[text] = {}
	end
	if not TextSizeCache[text][font] then
		TextSizeCache[text][font] = {}
	end
	if not TextSizeCache[text][font][sizeBounds] then
		TextSizeCache[text][font][sizeBounds] = {}
	end
	if not TextSizeCache[text][font][sizeBounds][textSize] then
		testLabel.Text = text
		testLabel.Font = font
		testLabel.TextSize = textSize
		if sizeBounds then
			testLabel.TextWrapped = true
			testLabel.Size = sizeBounds
		else
			testLabel.TextWrapped = false
		end
		TextSizeCache[text][font][sizeBounds][textSize] = testLabel.TextBounds
	end
	return TextSizeCache[text][font][sizeBounds][textSize]
end
