local m=Vector2.new(0,0)local C=require(script.Parent:WaitForChild("\066\097\115\101\067\097\109\101\114\097"))local W=setmetatable({},C)W.__index=W local e=require(script.Parent:WaitForChild("\067\097\109\101\114\097\085\116\105\108\115"))function W.new()local m=setmetatable(C.new(),W)m.isFollowCamera=false m.isCameraToggle=false m.lastUpdate=tick()m.cameraToggleSpring=e.Spring.new(5,0)return m end local U=require(script.Parent:WaitForChild("\067\097\109\101\114\097\073\110\112\117\116"))function W.GetCameraToggleOffset(m,C)if not m.isCameraToggle then return Vector3.new()end local W=m.currentSubjectDistance if U.getTogglePan()then m.cameraToggleSpring.goal=math.clamp(e.map(W,.5,m.FIRST_PERSON_DISTANCE_THRESHOLD,0,1),0,1)else m.cameraToggleSpring.goal=0 end return Vector3.new(0,m.cameraToggleSpring:step(C)*(math.clamp(e.map(W,.5,64,0,1),0,1)+1),0)end function W.SetCameraMovementMode(m,W)C.SetCameraMovementMode(m,W)m.isFollowCamera=W==Enum.ComputerCameraMovementMode.Follow m.isCameraToggle=W==Enum.ComputerCameraMovementMode.CameraToggle end local h=CFrame.fromOrientation(-0.26179938779915,0,0)local Y=game:GetService("\080\108\097\121\101\114\115")local N=0 local c=game:GetService("\086\082\083\101\114\118\105\099\101")function W.Update(m)local C=tick()local W=C-m.lastUpdate local B=workspace.CurrentCamera local b=B.CFrame local j=B.Focus local y=nil if m.resetCameraAngle then local C=m:GetHumanoidRootPart()if C then y=(C.CFrame*h).lookVector else y=h.lookVector end m.resetCameraAngle=false end local G=m:GetHumanoid()local L=B.CameraSubject local r=L and L:IsA("\086\101\104\105\099\108\101\083\101\097\116")local f=L and L:IsA("\083\107\097\116\101\098\111\097\114\100\080\108\097\116\102\111\114\109")local d=G and G:GetState()==Enum.HumanoidStateType.Climbing if m.lastUpdate==nil or W>1 then m.lastCameraTransform=nil end local S=U.getRotation()m:StepZoom()local x=m:GetCameraHeight()if U.getRotation()~=Vector2.new()then N=0 m.lastUserPanCamera=tick()end local K=C-m.lastUserPanCamera<2 local V=m:GetSubjectPosition()if V and(Y.LocalPlayer and B)then local C=m:GetCameraToSubjectDistance()if C<.5 then C=.5 end if m:GetIsMouseLocked()and not m:IsInFirstPerson()then local C=m:CalculateNewLookCFrameFromArg(y,S)local W=m:GetMouseLockOffset()local U=(W.X*C.RightVector+W.Y*C.UpVector)+W.Z*C.LookVector if e.IsFiniteVector3(U)then V=V+U end elseif U.getRotation()==Vector2.new()and m.lastCameraTransform then local C=m:IsInFirstPerson()if not r and not f then if m.isFollowCamera and(d and(m.lastUpdate and(G and G.Torso)))then if C then if m.lastSubjectCFrame and((r or f)and L:IsA("\066\097\115\101\080\097\114\116"))then local C=-e.GetAngleBetweenXZVectors(m.lastSubjectCFrame.lookVector,L.CFrame.lookVector)if e.IsFinite(C)then S=S+Vector2.new(C,0)end N=0 end elseif not K then N=math.clamp(N+3.8397243543875*W,0,4.3633231299858)local C=math.clamp(N*W,0,1)if m:IsInFirstPerson()and(not m.isFollowCamera or not m.isClimbing)then C=1 end local U=e.GetAngleBetweenXZVectors(G.Torso.CFrame.lookVector,m:GetCameraLookVector())if e.IsFinite(U)and math.abs(U)>.0001 then S=S+Vector2.new(U*C,0)end end elseif m.isFollowCamera and(not C and(not K and not c.VREnabled))then local C=e.GetAngleBetweenXZVectors(-(m.lastCameraTransform.p-V),m:GetCameraLookVector())if e.IsFinite(C)and(math.abs(C)>.0001 and.4*W<math.abs(C))then S=S+Vector2.new(C,0)end end elseif m.lastUpdate and(G and G.Torso)then if C then if m.lastSubjectCFrame and((r or f)and L:IsA("\066\097\115\101\080\097\114\116"))then v27=-e.GetAngleBetweenXZVectors(m.lastSubjectCFrame.lookVector,L.CFrame.lookVector)if e.IsFinite(v27)then S=S+Vector2.new(v27,0)end N=0 end elseif not K then N=math.clamp(N+3.8397243543875*W,0,4.3633231299858)v28=math.clamp(N*W,0,1)if m:IsInFirstPerson()and(not m.isFollowCamera or not m.isClimbing)then v28=1 end v29=e.GetAngleBetweenXZVectors(G.Torso.CFrame.lookVector,m:GetCameraLookVector())if e.IsFinite(v29)and math.abs(v29)>.0001 then S=S+Vector2.new(v29*v28,0)end end elseif m.isFollowCamera and(not C and(not K and not c.VREnabled))then v30=e.GetAngleBetweenXZVectors(-(m.lastCameraTransform.p-V),m:GetCameraLookVector())if e.IsFinite(v30)and(math.abs(v30)>.0001 and.4*W<math.abs(v30))then S=S+Vector2.new(v30,0)end end end if not m.isFollowCamera then local e=c.VREnabled if e then local C=m:GetVRFocus(V,W)else v32=CFrame.new(V)end local U=v32.p if e and not m:IsInFirstPerson()then local W=(V-B.CFrame.p).magnitude if C<W or S.x~=0 then local e=m:CalculateNewLookVectorFromArg(nil,S)*math.min(W,C)local h=U-e local Y=B.CFrame.lookVector if S.x~=0 then Y=e end local N=CFrame.new(h,Vector3.new(h.x+Y.x,h.y,h.z+Y.z))+Vector3.new(0,x,0)end else v38=CFrame.new(U-C*m:CalculateNewLookVectorFromArg(y,S),U)end else if c.VREnabled then v32=m:GetVRFocus(V,W)else v32=CFrame.new(V)end v38=CFrame.new(v32.p-C*m:CalculateNewLookVectorFromArg(y,S),v32.p)+Vector3.new(0,x,0)end local h=m:GetCameraToggleOffset(W)j=v32+h b=v38+h m.lastCameraTransform=b m.lastCameraFocus=j if(r or f)and L:IsA("\066\097\115\101\080\097\114\116")then m.lastSubjectCFrame=L.CFrame else m.lastSubjectCFrame=nil end end m.lastUpdate=C return b,j end function W.EnterFirstPerson(m)m.inFirstPerson=true m:UpdateMouseBehavior()end function W.LeaveFirstPerson(m)m.inFirstPerson=false m:UpdateMouseBehavior()end return W


local v1 = Vector2.new(0, 0);
local v2 = require(script.Parent:WaitForChild("BaseCamera"));
local v3 = setmetatable({}, v2);
v3.__index = v3;
local u1 = require(script.Parent:WaitForChild("CameraUtils"));
function v3.new()
	local v4 = setmetatable(v2.new(), v3);
	v4.isFollowCamera = false;
	v4.isCameraToggle = false;
	v4.lastUpdate = tick();
	v4.cameraToggleSpring = u1.Spring.new(5, 0);
	return v4;
end;
local u2 = require(script.Parent:WaitForChild("CameraInput"));
function v3.GetCameraToggleOffset(p1, p2)
	if not p1.isCameraToggle then
		return Vector3.new();
	end;
	local l__currentSubjectDistance__5 = p1.currentSubjectDistance;
	if u2.getTogglePan() then
		p1.cameraToggleSpring.goal = math.clamp(u1.map(l__currentSubjectDistance__5, 0.5, p1.FIRST_PERSON_DISTANCE_THRESHOLD, 0, 1), 0, 1);
	else
		p1.cameraToggleSpring.goal = 0;
	end;
	return Vector3.new(0, p1.cameraToggleSpring:step(p2) * (math.clamp(u1.map(l__currentSubjectDistance__5, 0.5, 64, 0, 1), 0, 1) + 1), 0);
end;
function v3.SetCameraMovementMode(p3, p4)
	v2.SetCameraMovementMode(p3, p4);
	p3.isFollowCamera = p4 == Enum.ComputerCameraMovementMode.Follow;
	p3.isCameraToggle = p4 == Enum.ComputerCameraMovementMode.CameraToggle;
end;
local u3 = CFrame.fromOrientation(-0.2617993877991494, 0, 0);
local l__Players__4 = game:GetService("Players");
local u5 = 0;
local l__VRService__6 = game:GetService("VRService");
function v3.Update(p5)
	local v6 = tick();
	local v7 = v6 - p5.lastUpdate;
	local l__CurrentCamera__8 = workspace.CurrentCamera;
	local v9 = l__CurrentCamera__8.CFrame;
	local v10 = l__CurrentCamera__8.Focus;
	local v11 = nil;
	if p5.resetCameraAngle then
		local v12 = p5:GetHumanoidRootPart();
		if v12 then
			v11 = (v12.CFrame * u3).lookVector;
		else
			v11 = u3.lookVector;
		end;
		p5.resetCameraAngle = false;
	end;
	local v13 = p5:GetHumanoid();
	local l__CameraSubject__14 = l__CurrentCamera__8.CameraSubject;
	local v15 = l__CameraSubject__14 and l__CameraSubject__14:IsA("VehicleSeat");
	local v16 = l__CameraSubject__14 and l__CameraSubject__14:IsA("SkateboardPlatform");
	local v17 = v13 and v13:GetState() == Enum.HumanoidStateType.Climbing;
	if p5.lastUpdate == nil or v7 > 1 then
		p5.lastCameraTransform = nil;
	end;
	local v18 = u2.getRotation();
	p5:StepZoom();
	local v19 = p5:GetCameraHeight();
	if u2.getRotation() ~= Vector2.new() then
		u5 = 0;
		p5.lastUserPanCamera = tick();
	end;
	local v20 = v6 - p5.lastUserPanCamera < 2;
	local v21 = p5:GetSubjectPosition();
	if v21 and l__Players__4.LocalPlayer and l__CurrentCamera__8 then
		local v22 = p5:GetCameraToSubjectDistance();
		if v22 < 0.5 then
			v22 = 0.5;
		end;
		if p5:GetIsMouseLocked() and not p5:IsInFirstPerson() then
			local v23 = p5:CalculateNewLookCFrameFromArg(v11, v18);
			local v24 = p5:GetMouseLockOffset();
			local v25 = v24.X * v23.RightVector + v24.Y * v23.UpVector + v24.Z * v23.LookVector;
			if u1.IsFiniteVector3(v25) then
				v21 = v21 + v25;
			end;
		elseif u2.getRotation() == Vector2.new() and p5.lastCameraTransform then
			local v26 = p5:IsInFirstPerson();
			if not v15 and not v16 then
				if p5.isFollowCamera and v17 and p5.lastUpdate and v13 and v13.Torso then
					if v26 then
						if p5.lastSubjectCFrame and ((v15 or v16) and l__CameraSubject__14:IsA("BasePart")) then
							local v27 = -u1.GetAngleBetweenXZVectors(p5.lastSubjectCFrame.lookVector, l__CameraSubject__14.CFrame.lookVector);
							if u1.IsFinite(v27) then
								v18 = v18 + Vector2.new(v27, 0);
							end;
							u5 = 0;
						end;
					elseif not v20 then
						u5 = math.clamp(u5 + 3.839724354387525 * v7, 0, 4.363323129985824);
						local v28 = math.clamp(u5 * v7, 0, 1);
						if p5:IsInFirstPerson() and (not p5.isFollowCamera or not p5.isClimbing) then
							v28 = 1;
						end;
						local v29 = u1.GetAngleBetweenXZVectors(v13.Torso.CFrame.lookVector, p5:GetCameraLookVector());
						if u1.IsFinite(v29) and math.abs(v29) > 0.0001 then
							v18 = v18 + Vector2.new(v29 * v28, 0);
						end;
					end;
				elseif p5.isFollowCamera and not v26 and not v20 and not l__VRService__6.VREnabled then
					local v30 = u1.GetAngleBetweenXZVectors(-(p5.lastCameraTransform.p - v21), p5:GetCameraLookVector());
					if u1.IsFinite(v30) and math.abs(v30) > 0.0001 and 0.4 * v7 < math.abs(v30) then
						v18 = v18 + Vector2.new(v30, 0);
					end;
				end;
			elseif p5.lastUpdate and v13 and v13.Torso then
				if v26 then
					if p5.lastSubjectCFrame and ((v15 or v16) and l__CameraSubject__14:IsA("BasePart")) then
						v27 = -u1.GetAngleBetweenXZVectors(p5.lastSubjectCFrame.lookVector, l__CameraSubject__14.CFrame.lookVector);
						if u1.IsFinite(v27) then
							v18 = v18 + Vector2.new(v27, 0);
						end;
						u5 = 0;
					end;
				elseif not v20 then
					u5 = math.clamp(u5 + 3.839724354387525 * v7, 0, 4.363323129985824);
					v28 = math.clamp(u5 * v7, 0, 1);
					if p5:IsInFirstPerson() and (not p5.isFollowCamera or not p5.isClimbing) then
						v28 = 1;
					end;
					v29 = u1.GetAngleBetweenXZVectors(v13.Torso.CFrame.lookVector, p5:GetCameraLookVector());
					if u1.IsFinite(v29) and math.abs(v29) > 0.0001 then
						v18 = v18 + Vector2.new(v29 * v28, 0);
					end;
				end;
			elseif p5.isFollowCamera and not v26 and not v20 and not l__VRService__6.VREnabled then
				v30 = u1.GetAngleBetweenXZVectors(-(p5.lastCameraTransform.p - v21), p5:GetCameraLookVector());
				if u1.IsFinite(v30) and math.abs(v30) > 0.0001 and 0.4 * v7 < math.abs(v30) then
					v18 = v18 + Vector2.new(v30, 0);
				end;
			end;
		end;
		if not p5.isFollowCamera then
			local l__VREnabled__31 = l__VRService__6.VREnabled;
			if l__VREnabled__31 then
				local v32 = p5:GetVRFocus(v21, v7);
			else
				v32 = CFrame.new(v21);
			end;
			local l__p__33 = v32.p;
			if l__VREnabled__31 and not p5:IsInFirstPerson() then
				local l__magnitude__34 = (v21 - l__CurrentCamera__8.CFrame.p).magnitude;
				if v22 < l__magnitude__34 or v18.x ~= 0 then
					local v35 = p5:CalculateNewLookVectorFromArg(nil, v18) * math.min(l__magnitude__34, v22);
					local v36 = l__p__33 - v35;
					local v37 = l__CurrentCamera__8.CFrame.lookVector;
					if v18.x ~= 0 then
						v37 = v35;
					end;
					local v38 = CFrame.new(v36, (Vector3.new(v36.x + v37.x, v36.y, v36.z + v37.z))) + Vector3.new(0, v19, 0);
				end;
			else
				v38 = CFrame.new(l__p__33 - v22 * p5:CalculateNewLookVectorFromArg(v11, v18), l__p__33);
			end;
		else
			if l__VRService__6.VREnabled then
				v32 = p5:GetVRFocus(v21, v7);
			else
				v32 = CFrame.new(v21);
			end;
			v38 = CFrame.new(v32.p - v22 * p5:CalculateNewLookVectorFromArg(v11, v18), v32.p) + Vector3.new(0, v19, 0);
		end;
		local v39 = p5:GetCameraToggleOffset(v7);
		v10 = v32 + v39;
		v9 = v38 + v39;
		p5.lastCameraTransform = v9;
		p5.lastCameraFocus = v10;
		if (v15 or v16) and l__CameraSubject__14:IsA("BasePart") then
			p5.lastSubjectCFrame = l__CameraSubject__14.CFrame;
		else
			p5.lastSubjectCFrame = nil;
		end;
	end;
	p5.lastUpdate = v6;
	return v9, v10;
end;
function v3.EnterFirstPerson(p6)
	p6.inFirstPerson = true;
	p6:UpdateMouseBehavior();
end;
function v3.LeaveFirstPerson(p7)
	p7.inFirstPerson = false;
	p7:UpdateMouseBehavior();
end;
return v3;
