


import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import AutoConfig
from ..clip.configuration_clip import CLIPVisionConfig


lowerCamelCase		=	logging.get_logger(__name__)





class       _a							(       _lowercase):
	_a						:						Dict   					=							'''vision-text-dual-encoder'''
	_a						:						Tuple   					=							True




	def __init__(      self		:	List[Any]	,      _SCREAMING_SNAKE_CASE		:	Optional[int]=512	,      _SCREAMING_SNAKE_CASE		:	int=2.6592	,      **_SCREAMING_SNAKE_CASE		:	Tuple	)-> Union[str, Any]:
			super().__init__(**_SCREAMING_SNAKE_CASE	)

			if "vision_config" not in kwargs:
					raise ValueError('''`vision_config` can not be `None`.'''	)

			if "text_config" not in kwargs:
					raise ValueError('''`text_config` can not be `None`.'''	)

			lowerCAmelCase__     :    Tuple					  =      kwargs.pop('''vision_config'''	)
			lowerCAmelCase__     :    Any					  =      kwargs.pop('''text_config'''	)

			lowerCAmelCase__     :    Optional[Any]					  =      vision_config.pop('''model_type'''	)
			lowerCAmelCase__     :    Any					  =      text_config.pop('''model_type'''	)

			if vision_model_type == "clip":
					lowerCAmelCase__     :    Tuple					  =      AutoConfig.for_model(_SCREAMING_SNAKE_CASE	,      **_SCREAMING_SNAKE_CASE	).vision_config
			elif vision_model_type == "clip_vision_model":
					lowerCAmelCase__     :    List[str]					  =      CLIPVisionConfig(**_SCREAMING_SNAKE_CASE	)
			else:
					lowerCAmelCase__     :    Dict					  =      AutoConfig.for_model(_SCREAMING_SNAKE_CASE	,      **_SCREAMING_SNAKE_CASE	)

			lowerCAmelCase__     :    Dict					  =      AutoConfig.for_model(_SCREAMING_SNAKE_CASE	,      **_SCREAMING_SNAKE_CASE	)

			lowerCAmelCase__     :    int					  =      projection_dim
			lowerCAmelCase__     :    Any					  =      logit_scale_init_value




	@classmethod
	def 							UpperCAmelCase__(      cls		:	Optional[Any]	,      _SCREAMING_SNAKE_CASE		:	PretrainedConfig	,      _SCREAMING_SNAKE_CASE		:	PretrainedConfig	,      **_SCREAMING_SNAKE_CASE		:	List[Any]	)-> str:
			return cls(vision_config=vision_config.to_dict()	,      text_config=text_config.to_dict()	,      **_SCREAMING_SNAKE_CASE	)




	def 							UpperCAmelCase__(      self		:	Union[str, Any]	)-> Union[str, Any]:
			lowerCAmelCase__     :    Optional[int]					  =      copy.deepcopy(self.__dict__	)
			lowerCAmelCase__     :    Any					  =      self.vision_config.to_dict()
			lowerCAmelCase__     :    int					  =      self.text_config.to_dict()
			lowerCAmelCase__     :    Dict					  =      self.__class__.model_type
			return output








from math import radians as angle_to_radians
from math import sin

# Acceleration Constant on Earth (unit m/s^2)
lowerCamelCase		=	9.8_0_6_6_5






def   lowerCamelCase_					( _a			,     _a ):




		"""simple docstring"""






		if not isinstance(_a			,     (int, float) ):
				raise TypeError('''Invalid velocity. Should be a positive number.''' )

		if not isinstance(_a			,     (int, float) ):
				raise TypeError('''Invalid angle. Range is 1-90 degrees.''' )

		# Ensure valid angle
		if angle > 90 or angle < 1:
				raise ValueError('''Invalid angle. Range is 1-90 degrees.''' )

		# Ensure valid velocity
		if init_velocity < 0:
				raise ValueError('''Invalid velocity. Should be a positive number.''' )






def   lowerCamelCase_					( _a			,     _a ):




		"""simple docstring"""






		check_args(_a			,     _a )
		lowerCAmelCase__     :    Any					  =      angle_to_radians(2 * angle )
		return round(init_velocity**2 * sin(_a ) / g			,     2 )






def   lowerCamelCase_					( _a			,     _a ):




		"""simple docstring"""






		check_args(_a			,     _a )
		lowerCAmelCase__     :    Optional[Any]					  =      angle_to_radians(_a )
		return round(init_velocity**2 * sin(_a ) ** 2 / (2 * g)			,     2 )






def   lowerCamelCase_					( _a			,     _a ):




		"""simple docstring"""






		check_args(_a			,     _a )
		lowerCAmelCase__     :    Optional[int]					  =      angle_to_radians(_a )
		return round(2 * init_velocity * sin(_a ) / g			,     2 )






def   lowerCamelCase_					( ):




		"""simple docstring"""






		lowerCAmelCase__  ,			lowerCAmelCase__     :    Optional[int]					  =      25, 20
		assert horizontal_distance(_a			,     _a ) == 40.97
		assert max_height(_a			,     _a ) == 3.73
		assert total_time(_a			,     _a ) == 1.74


if __name__ == "__main__":
		from doctest import testmod

		testmod()

		# Get input from user
		lowerCamelCase		=	float(input('''Initial Velocity: ''').strip())

		# Get input from user
		lowerCamelCase		=	float(input('''angle: ''').strip())

		# Print results
		print()
		print('''Results: ''')
		print(f'''Horizontal Distance: {horizontal_distance(init_vel, angle)!s} [m]''')
		print(f'''Maximum Height: {max_height(init_vel, angle)!s} [m]''')
		print(f'''Total Time: {total_time(init_vel, angle)!s} [s]''')




