-- Decompiled with the Synapse X Luau decompiler.


local v1 = require(script.Parent:WaitForChild("CameraUtils"));
local l__Players__2 = game:GetService("Players");
local v3, v4 = pcall(function()
	return UserSettings():IsUserFeatureEnabled("UserPortraitPopperFix");
end);
local v5 = require(script.Parent:WaitForChild("BaseOcclusion"));
local v6 = setmetatable({}, v5);
v6.__index = v6;
function v6.new()
	local v7 = setmetatable(v5.new(), v6);
	v7.camera = nil;
	v7.cameraSubjectChangeConn = nil;
	v7.subjectPart = nil;
	v7.playerCharacters = {};
	v7.vehicleParts = {};
	v7.lastPopAmount = 0;
	v7.lastZoomLevel = 0;
	v7.popperEnabled = false;
	return v7;
end;
function v6.GetOcclusionMode(p1)
	return Enum.DevCameraOcclusionMode.Zoom;
end;
function v6.Enable(p2, p3)

end;
function v6.CharacterAdded(p4, p5, p6)
	p4.playerCharacters[p6] = p5;
end;
function v6.CharacterRemoving(p7, p8, p9)
	p7.playerCharacters[p9] = nil;
end;
local u1 = v3 or v4;
function v6.Update(p10, p11, p12, p13)
	if not p10.popperEnabled then
		return p12, p13;
	end;
	p10.camera = game.Workspace.CurrentCamera;
	local v8 = p12;
	local v9 = p13.p;
	if u1 and p10.subjectPart then
		v9 = p10.subjectPart.CFrame.p;
	end;
	local v10 = {};
	for v11, v12 in pairs(p10.playerCharacters) do
		v10[#v10 + 1] = v12;
	end;
	for v13 = 1, #p10.vehicleParts do
		v10[#v10 + 1] = p10.vehicleParts[v13];
	end;
	local l__CFrame__14 = p10.camera.CFrame;
	p10.camera.CFrame = p12;
	p10.camera.Focus = p13;
	local l__Magnitude__15 = (p12.p - v9).Magnitude;
	if math.abs(l__Magnitude__15 - p10.lastZoomLevel) > 0.001 then
		p10.lastPopAmount = 0;
	end;
	local v16 = p10.camera:GetLargestCutoffDistance(v10);
	if v16 < p10.lastPopAmount then
		v16 = p10.lastPopAmount;
	end;
	if v16 > 0 then
		v8 = p12 + p12.lookVector * v16;
		p10.lastPopAmount = v16 - 0.3;
		if p10.lastPopAmount < 0 then
			p10.lastPopAmount = 0;
		end;
	end;
	p10.lastZoomLevel = l__Magnitude__15;
	return v8, p13;
end;
local u2 = { "Humanoid", "VehicleSeat", "SkateboardPlatform" };
function v6.OnCameraSubjectChanged(p14, p15)
	p14.vehicleParts = {};
	p14.lastPopAmount = 0;
	if p15 then
		p14.popperEnabled = false;
		for v17, v18 in pairs(u2) do
			if p15:IsA(v18) then
				p14.popperEnabled = true;
				break;
			end;
		end;
		if p15:IsA("VehicleSeat") then
			p14.vehicleParts = p15:GetConnectedParts(true);
		end;
		if u1 then
			if p15:IsA("BasePart") then
				p14.subjectPart = p15;
				return;
			end;
			if p15:IsA("Model") then
				if p15.PrimaryPart then
					p14.subjectPart = p15.PrimaryPart;
					return;
				else
					for v19, v20 in pairs(p15:GetChildren()) do
						if v20:IsA("BasePart") then
							p14.subjectPart = v20;
							return;
						end;
					end;
					return;
				end;
			elseif p15:IsA("Humanoid") then
				p14.subjectPart = p15.RootPart;
			end;
		end;
	end;
end;
return v6;

