local _,ns = ...
ns.ADDUIEVENT("PLAYER_LOGIN", function()
if not AddUIDB.raidframebuff then return end

hooksecurefunc('CompactUnitFrame_UtilSetBuff', function(buffFrame, aura)
	if aura.duration < 61 or aura.expirationTime - GetTime()<61 then 
		local fontsize = buffFrame:GetHeight()/1.7
		buffFrame.cooldown:GetRegions():SetFont(STANDARD_TEXT_FONT, fontsize, nil)
		buffFrame.cooldown:SetHideCountdownNumbers(false)
	else
		buffFrame.cooldown:SetHideCountdownNumbers(true)
	end
end)

hooksecurefunc('CompactUnitFrame_UtilSetDebuff', function(debuffFrame, aura)
	local debuffsize = debuffFrame:GetParent():GetHeight()/3
	if aura.dispelName then
		debuffFrame:SetSize(debuffsize*1.3,debuffsize*1.3)
		debuffFrame.cooldown:GetRegions():SetFont(STANDARD_TEXT_FONT, debuffFrame:GetHeight()/1.8, nil)
		if (aura.duration < 61 or aura.expirationTime - GetTime()<61) and aura.expirationTime - GetTime()>0 then 
			debuffFrame.cooldown:SetHideCountdownNumbers(false)
		else
			debuffFrame.cooldown:SetHideCountdownNumbers(true)
		end
	elseif (aura.duration < 61 or aura.expirationTime - GetTime()<61) and aura.expirationTime - GetTime()>0 then 
		debuffFrame:SetSize(debuffsize,debuffsize)
		debuffFrame.cooldown:SetHideCountdownNumbers(false)
		debuffFrame.cooldown:GetRegions():SetFont(STANDARD_TEXT_FONT, debuffFrame:GetHeight()/1.8, nil)
	else
		debuffFrame:SetSize(debuffsize*.7,debuffsize*.7)
		debuffFrame.cooldown:SetHideCountdownNumbers(true)
	end
end)

hooksecurefunc('CompactUnitFrame_UpdatePrivateAuras', function(frame)
	if not frame.PrivateAuraAnchors then
		return;
	end
	local framesize = frame:GetParent():GetHeight()/3
	frame.PrivateAuraAnchor1:SetSize(framesize*1.4,framesize*1.4)
	if not frame.PrivateAuraAnchor1.cooldown then return end
	frame.PrivateAuraAnchor1.cooldown:SetHideCountdownNumbers(false)
	frame.PrivateAuraAnchor1.cooldown:GetRegions():SetFont(STANDARD_TEXT_FONT, frame.PrivateAuraAnchor1.cooldown:GetHeight()/1.8, nil)
end)

end)