local t=Roact.PureComponent:extend(script.Name)function t.init(t)t.FrameSize,t.SetFrameSize=Roact.createBinding(UDim2.new())t:UpdateTextBounds(t.props.Text)end function t.willUpdate(l,t)if l.props.Text~=t.Text then l:UpdateTextBounds(t.Text)end end function t.UpdateTextBounds(l,t)l.TextBounds=TextService:GetTextSize((t:gsub("\060\098\114 \047\062","\n")):gsub("\060\046-\062",""),10,Enum.Font.Gotham,Vector2.new(math.huge,math.huge))end function t.render(t)return new("\070\114\097\109\101",{AnchorPoint=Vector2.new(.5,0);BackgroundColor3=Color3.fromRGB(58,58,58),BackgroundTransparency=0;BorderSizePixel=0;Position=UDim2.new(.5,0,1,2);Size=UDim2.fromOffset(t.TextBounds.X+20,t.TextBounds.Y+8);ZIndex=2;Visible=t.props.IsVisible},{Corners=new("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,3)});Arrow=new("\070\114\097\109\101",{AnchorPoint=Vector2.new(.5,.5);BackgroundColor3=Color3.fromRGB(58,58,58);BackgroundTransparency=0;BorderSizePixel=0,Position=UDim2.new(.5,0,0,0);Size=UDim2.new(0,6,0,6),ZIndex=2});Text=new("\084\101\120\116\076\097\098\101\108",{BackgroundTransparency=1,Size=UDim2.new(1,0,1,0);ZIndex=2,Font=Enum.Font.Gotham;RichText=true;Text=t.props.Text,TextColor3=Color3.fromRGB(255,255,255);TextSize=10;TextXAlignment=Enum.TextXAlignment.Center;TextYAlignment=Enum.TextYAlignment.Center})})end return t

local Tooltip = Roact.PureComponent:extend(script.Name)

function Tooltip:init()
    self.FrameSize, self.SetFrameSize = Roact.createBinding(UDim2.new())
    self:UpdateTextBounds(self.props.Text)
end

function Tooltip:willUpdate(nextProps)
    if self.props.Text ~= nextProps.Text then
        self:UpdateTextBounds(nextProps.Text)
    end
end

function Tooltip:UpdateTextBounds(Text)
    self.TextBounds = TextService:GetTextSize(
        Text:gsub('<br />', '\n'):gsub('<.->', ''),
        10,
        Enum.Font.Gotham,
        Vector2.new(math.huge, math.huge)
    )
end

function Tooltip:render()
    return new('Frame', {
        AnchorPoint = Vector2.new(0.5, 0);
        BackgroundColor3 = Color3.fromRGB(58, 58, 58);
        BackgroundTransparency = 0;
        BorderSizePixel = 0;
        Position = UDim2.new(0.5, 0, 1, 2);
        Size = UDim2.fromOffset(self.TextBounds.X + 20, self.TextBounds.Y + 8);
        ZIndex = 2;
        Visible = self.props.IsVisible;
    }, {
        Corners = new('UICorner', {
            CornerRadius = UDim.new(0, 3);
        });
        Arrow = new('Frame', {
            AnchorPoint = Vector2.new(0.5, 0.5);
            BackgroundColor3 = Color3.fromRGB(58, 58, 58);
            BackgroundTransparency = 0;
            BorderSizePixel = 0;
            Position = UDim2.new(0.5, 0, 0, 0);
            Size = UDim2.new(0, 6, 0, 6);
            ZIndex = 2;
        });
        Text = new('TextLabel', {
            BackgroundTransparency = 1;
            Size = UDim2.new(1, 0, 1, 0);
            ZIndex = 2;
            Font = Enum.Font.Gotham;
            RichText = true;
            Text = self.props.Text;
            TextColor3 = Color3.fromRGB(255, 255, 255);
            TextSize = 10;
            TextXAlignment = Enum.TextXAlignment.Center;
            TextYAlignment = Enum.TextYAlignment.Center;
        });
    })
end

return Tooltip
