<?php
use \Elementor\Controls_Stack;
use \Elementor\Repeater;
use \Elementor\Utils;
use \Elementor\Controls_Manager;
use \Elementor\Group_Control_Border;
use \Elementor\Group_Control_Box_Shadow;
use \Elementor\Group_Control_Typography;
use \Elementor\Widget_Base;
use \Elementor\Group_Control_Background;
use \Elementor\Group_Control_Image_Size;
use \Elementor\Group_Control_Text_Shadow;
use \Elementor\Group_Control_Css_Filter;

class Rswpthemes_Awt_Posts_Carousel extends Widget_Base {

	/**
	 * Get widget name.
	 *
	 * Retrieve oEmbed widget name.
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @return string Widget name.
	 */
	public function get_name() {
		return 'rswpthemes_awt_posts_carousel';
	}

	/**
	 * Get widget title.
	 *
	 * Retrieve oEmbed widget title.
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @return string Widget title.
	 */
	public function get_title() {
		return __( 'Awt Posts Carousel', 'author-website-templates' );
	}

	/**
	 * Get widget icon.
	 *
	 * Retrieve oEmbed widget icon.
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @return string Widget icon.
	 */
	public function get_icon() {
		return 'dashicons dashicons-layout';
	}

	/**
	 * Get widget categories.
	 *
	 * Retrieve the list of categories the oEmbed widget belongs to.
	 *
	 * @since 1.0.0
	 * @access public
	 *
	 * @return array Widget categories.
	 */
	public function get_categories() {
		return [ 'rswpthemes_awt_widgets' ];
	}

	public function get_style_depends() {
		return [ 'rswpthemes-awt-posts-carousel', 'owl-carousel' ];
	}
	public function get_script_depends() {
		return [ 'rswpthemes-awt-posts-carousel', 'owl-carousel' ];
	}

	/**
	 * Register oEmbed widget controls.
	 *
	 * Adds different input fields to allow the user to change and customize the widget settings.
	 *
	 * @since 1.0.0
	 * @access protected
	 */
	protected function register_controls() {

		$this->start_controls_section(
			'rswpthemes_awt_post_layouts_query_section',
			[
				'label' => __( 'Query', 'author-website-templates' ),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
		);
		$this->start_controls_tabs(
			'rswpthemes_awt_post_layouts_query_tabs'
		);
		$this->start_controls_tab(
			'rswpthemes_awt_post_layouts_query_include',
			[
				'label' => __( 'Include', 'author-website-templates' ),
			]
		);
		$select_post_categories = array();
		$select_post_cats = get_terms( 'category' );
		foreach ($select_post_cats as $select_post_cat) :
			$select_post_categories[$select_post_cat->slug] = $select_post_cat->name;
		endforeach;
		$this->add_control(
			'select_categories',
			[
				'label' => __( 'Select Categories', 'author-website-templates' ),
				'type' => Controls_Manager::SELECT2,
				'multiple' => true,
				'options' => $select_post_categories,
				'separator' => 'before',
			]
		);

		$this->add_control(
			'post_authors_include',
			[
				'label' => __( 'Include Authors', 'author-website-templates' ),
				'description' => __( 'Insert Author ID seperated by Comma.', 'author-website-templates' ),
				'type' => Controls_Manager::TEXTAREA,
				'placeholder'=> '79,109',
				'rows' => '2',
				'multiple' => true,
				'options' => $select_post_categories,
				'separator' => 'before',
			]
		);

		$this->end_controls_tab();
		$this->start_controls_tab(
			'rswpthemes_awt_post_layouts_query_exclude',
			[
				'label' => __( 'Exclude', 'author-website-templates' ),
			]
		);
		$this->add_control(
			'exclude_categories',
			[
				'label' => __( 'Exclude Categories', 'author-website-templates' ),
				'description' => __( 'Insert Category ID seperatef by Comma.', 'author-website-templates' ),
				'type' => Controls_Manager::TEXTAREA,
				'placeholder'=> '107,116',
				'rows' => '2',
				'separator' => 'before',
			]
		);

		$this->add_control(
			'exclude_authors',
			[
				'label' => __( 'Exclude Authors', 'author-website-templates' ),
				'description' => __( 'Insert Author ID seperated by Comma.', 'author-website-templates' ),
				'type' => Controls_Manager::TEXTAREA,
				'placeholder'=> '57,86',
				'rows' => '2',
				'separator' => 'before',
			]
		);
		$this->add_control(
			'post_offset',
			[
				'label' => __( 'Offset', 'author-website-templates' ),
				'type' => Controls_Manager::NUMBER,
				'default' => 0,
				'separator' => 'before',
				'min' => 0,
				'max' => 100,
				'step' => 1,
			]
		);

		$this->end_controls_tab();
		$this->end_controls_tabs();

		$this->add_control(
			'posts_count',
			[
				'label' => __( 'Posts Per Page', 'author-website-templates' ),
				'type' => Controls_Manager::NUMBER,
				'min' => 1,
				'max' => 12,
				'step' => 1,
				'default' => 6,
				'separator' => 'before',
			]
		);
		$this->add_control(
			'ignore_sticky_post',
			[
				'label'        => __( 'Ignore Sticky Post?', 'author-website-templates' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_on'     => __( 'YES', 'author-website-templates' ),
				'label_off'    => __( 'NO', 'author-website-templates' ),
				'return_value' => 'true',
				'default'      => 'true',
				'separator'		=> 'before',
			]
		);
		$this->end_controls_section();

		$this->start_controls_section(
			'rswpthemes_awt_post_layouts_element_on_off_section',
			[
				'label' => __( 'Post Element On//Off', 'author-website-templates' ),
				'tab' => Controls_Manager::TAB_CONTENT,
			]
		);
		$this->add_control(
			'post_meta_show',
			[
				'label'        => __( 'Show Post Meta?', 'author-website-templates' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_on'     => __( 'Show', 'author-website-templates' ),
				'label_off'    => __( 'Hide', 'author-website-templates' ),
				'return_value' => 'true',
				'default'      => 'true',
				'separator' => 'before',
			]
		);
		$this->add_control(
			'post_meta_data',
			[
				'label' => __( 'Post Meta', 'author-website-templates' ),
				'type' => Controls_Manager::SELECT2,
				'multiple' => true,
				'separator'	=> 'before',
				'options' => [
					'author'	=>	__( 'Author', 'author-website-templates' ),
					'date'	=>	__( 'Date', 'author-website-templates' ),
					'comments'	=>	__( 'Comments', 'author-website-templates' ),
				],
				'default'	=> ['author', 'date'],
				'condition'	=>	[
					'post_meta_show'	=>	'true',
				]
			]
		);
		$this->add_control(
			'post_meta_position',
			[
				'label'     => __( 'Meta Position', 'author-website-templates' ),
				'type'      => Controls_Manager::SELECT,
				'default'   => 'b_title',
				'separator' => 'before',
				'condition' => [
					'post_meta_show' => 'true',
				],
				'options' => [
					'b_title'  => __( 'Bellow Post Title', 'author-website-templates' ),
					'b_excerpt' => __( 'Bellow Post Excerpt', 'author-website-templates' ),
					'b_button' => __( 'Bellow Read More Button', 'author-website-templates' ),
					'b_thumbnail' => __( 'Bellow Post Thumbnail', 'author-website-templates' ),
				],
			]
		);
		$this->add_control(
			'post_excerpt_show',
			[
				'label'        => __( 'Show Excerpt?', 'author-website-templates' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_on'     => __( 'Show', 'author-website-templates' ),
				'label_off'    => __( 'Hide', 'author-website-templates' ),
				'return_value' => 'true',
				'default'      => 'true',
				'separator'		=> 'before',
			]
		);
		$this->add_control(
			'post_excerpt_type',
			[
				'label' => __( 'Excerpt Type', 'author-website-templates' ),
				'type' => Controls_Manager::SELECT,
				'default' => 'excerpt',
				'options' => [
					'excerpt' => esc_html__( 'Excerpt', 'author-website-templates' ),
					'fullcontent'  => esc_html__( 'Full Content', 'author-website-templates' ),
				],
				'separator'		=> 'before',
				'condition'	=>	[
					'post_excerpt_show'	=>	'true',
				]
			]
		);
		$this->add_control(
			'post_excerpt_length',
			[
				'label' => __( 'Excerpt Length', 'author-website-templates' ),
				'type' => Controls_Manager::NUMBER,
				'min' => 70,
				'max' => 600,
				'step' => 10,
				'default' => 150,
				'separator'		=> 'before',
				'condition'	=>	[
					'post_excerpt_type'	=>	'excerpt',
				]
			]
		);

		$this->add_control(
			'post_title_show',
			[
				'label'        => __( 'Show Title?', 'author-website-templates' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_on'     => __( 'Show', 'author-website-templates' ),
				'label_off'    => __( 'Hide', 'author-website-templates' ),
				'return_value' => 'true',
				'default'      => 'true',
				'separator'		=> 'before',
			]
		);
		$this->add_control(
			'post_category_show',
			[
				'label'        => __( 'Show Category?', 'author-website-templates' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_on'     => __( 'Show', 'author-website-templates' ),
				'label_off'    => __( 'Hide', 'author-website-templates' ),
				'return_value' => 'true',
				'default'      => 'true',
				'separator'		=> 'before',
			]
		);
		$this->add_control(
			'post_category_position',
			[
				'label'     => __( 'Category Position', 'author-website-templates' ),
				'type'      => Controls_Manager::SELECT,
				'default'   => 'half_over_thumbnail',
				'separator'		=> 'before',
				'condition' => [
					'post_category_show' => 'true',
				],
				'options' => [
					'top_left_corner'  => __( 'Top Left Corner', 'author-website-templates' ),
					'top_right_corner' => __( 'Top Right Corner', 'author-website-templates' ),
					'bottom_left_corner' => __( 'Bottom Left Corner', 'author-website-templates' ),
					'bottom_right_corner' => __( 'Bottom Right Corner', 'author-website-templates' ),
					'above_title' => __( 'Above Post Title', 'author-website-templates' ),
					'half_over_thumbnail' => __( 'Half Over Thumbnail', 'author-website-templates' ),
				],
			]
		);
		$this->add_control(
			'read_button_show',
			[
				'label'        => __( 'Show Read More Button?', 'author-website-templates' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_on'     => __( 'Show', 'author-website-templates' ),
				'label_off'    => __( 'Hide', 'author-website-templates' ),
				'return_value' => 'true',
				'default'      => 'false',
				'separator'	=> 'before',
			]
		);

		$this->add_control(
			'read_more_button_text',
			[
				'label'        => __( 'Button Text', 'author-website-templates' ),
				'type'         => Controls_Manager::TEXT,
				'default'      => __( 'Read More', 'author-website-templates' ),
				'separator'	=> 'before',
				'condition'		=>	[
					'read_button_show'	=>	'true',
				]
			]
		);
		$this->add_control(
			'post_pagination_show',
			[
				'label' => __( 'Pagination', 'author-website-templates' ),
				'type' => Controls_Manager::SELECT,
				'separator'	=> 'before',
				'options'	=>	[
					'none' => __( 'None', 'author-website-templates' ),
					'number' => __( 'Number', 'author-website-templates' ),
					'navs' => __( 'Next / Prev', 'author-website-templates' ),
				],
				'default'      => 'none',
			]
		);
		$this->add_control(
			'east_pagination_alignment',
			[
				'label' => __( 'Pagination Alignment', 'author-website-templates' ),
				'type' => Controls_Manager::SELECT,
				'default'      => 'center',
				'separator'	=> 'before',
				'options'	=>	[
					'start'	=>	__( 'Left', 'author-website-templates' ),
					'center'	=>	__( 'Center', 'author-website-templates' ),
					'end'	=>	__( 'Right', 'author-website-templates' ),
				],
				'condition'	=>	[
					'post_pagination_show'	=>	'number'
				]
			]
		);

		$this->end_controls_section();
		$this->start_controls_section(
			'slider_settings',
			[
				'label' => __( 'Slides Settings', 'author-website-templates' ),
				'tab'   => Controls_Manager::TAB_CONTENT,
			]
		);
		$this->add_control(
			'slide_to_show',
			[
				'label' => __( 'Slide To Show', 'author-website-templates' ),
				'type' => Controls_Manager::NUMBER,
				'min' => 1,
				'max' => 12,
				'step' => 1,
				'default' => 3,
			]
		);
		$this->add_control(
			'margin',
			[
				'label' => __( 'Margin', 'author-website-templates' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ 'px' ],
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 1000,
						'step' => 5,
					],
				],
				'default' => [
					'unit' => 'px',
					'size' => 30,
				],
			]
		);
		$this->add_control(
			'slider_smart_speed',
			[
				'label' => __( 'Smart Speed', 'author-website-templates' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ 'px' ],
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 2000,
						'step' => 10,
					],
				],
				'default' => [
					'unit' => 'px',
					'size' => 400,
				],
			]
		);
		$this->add_control(
			'slider_fluid_speed',
			[
				'label' => __( 'Fluid Speed', 'author-website-templates' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ 'px' ],
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 2000,
						'step' => 10,
					],
				],
				'default' => [
					'unit' => 'px',
					'size' => 400,
				],
			]
		);
		$this->add_control(
			'slider_autoplay_speed',
			[
				'label' => __( 'Auto Play Speed', 'author-website-templates' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ 'px' ],
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 2000,
						'step' => 10,
					],
				],
				'default' => [
					'unit' => 'px',
					'size' => 400,
				],
			]
		);
		$this->add_control(
			'slider_nav_speed',
			[
				'label' => __( 'Nav Speed', 'author-website-templates' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ 'px' ],
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 2000,
						'step' => 10,
					],
				],
				'default' => [
					'unit' => 'px',
					'size' => 400,
				],
			]
		);

		$this->add_control(
			'center_mode_true',
			[
				'label'        => __( 'Center Mode True?', 'author-website-templates' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_on'     => __( 'Yes', 'author-website-templates' ),
				'label_off'    => __( 'No', 'author-website-templates' ),
				'return_value' => 'true',
				'default'      => 'true',
			]
		);
		$this->add_control(
			'autoplay_hover_push',
			[
				'label'        => __( 'Auto Play Hover', 'author-website-templates' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_on'     => __( 'Yes', 'author-website-templates' ),
				'label_off'    => __( 'No', 'author-website-templates' ),
				'return_value' => 'true',
				'default'      => 'true',
			]
		);
		$this->add_control(
			'nav',
			[
				'label'        => __( 'Navigation Arrow', 'author-website-templates' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_on'     => __( 'Show', 'author-website-templates' ),
				'label_off'    => __( 'Hide', 'author-website-templates' ),
				'return_value' => 'true',
				'default'      => 'true',
			]
		);

		$this->add_control(
			'autoplay',
			[
				'label'        => __( 'Auto Play', 'author-website-templates' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_on'     => __( 'Yes', 'author-website-templates' ),
				'label_off'    => __( 'No', 'author-website-templates' ),
				'return_value' => 'true',
				'default'      => 'true',
			]
		);
		$this->add_control(
			'loop',
			[
				'label'        => __( 'Loop', 'author-website-templates' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_on'     => __( 'Yes', 'author-website-templates' ),
				'label_off'    => __( 'No', 'author-website-templates' ),
				'return_value' => 'true',
				'default'      => 'true',
			]
		);
		$this->add_control(
			'mouseDrag',
			[
				'label'        => __( 'Mouse Drag', 'author-website-templates' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_on'     => __( 'Yes', 'author-website-templates' ),
				'label_off'    => __( 'No', 'author-website-templates' ),
				'return_value' => 'true',
				'default'      => 'true',
			]
		);
		$this->add_control(
			'touchDrag',
			[
				'label'        => __( 'Touch Drag', 'author-website-templates' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_on'     => __( 'Yes', 'author-website-templates' ),
				'label_off'    => __( 'No', 'author-website-templates' ),
				'return_value' => 'true',
				'default'      => 'true',
			]
		);
		$this->add_control(
			'autoplayTimeout',
			[
				'label'     => __( 'Autoplay Timeout', 'author-website-templates' ),
				'type'      => Controls_Manager::SELECT,
				'default'   => '5000',
				'condition' => [
					'autoplay' => 'true',
				],
				'options' => [
					'5000'  => __( '5 Seconds', 'author-website-templates' ),
					'10000' => __( '10 Seconds', 'author-website-templates' ),
					'15000' => __( '15 Seconds', 'author-website-templates' ),
					'20000' => __( '20 Seconds', 'author-website-templates' ),
					'25000' => __( '25 Seconds', 'author-website-templates' ),
					'30000' => __( '30 Seconds', 'author-website-templates' ),
				],
			]
		);
		$this->end_controls_section();

		$this->start_controls_section(
			'responsive_settings',
			[
				'label' => __( 'Responsive Settings', 'author-website-templates' ),
				'tab'   => Controls_Manager::TAB_CONTENT,
			]
		);
		$this->add_control(
			'mobile_screen',
			[
				'label' => __( 'Mobile Screen for 360px', 'author-website-templates' ),
				'type' => Controls_Manager::NUMBER,
				'min' => 1,
				'max' => 12,
				'step' => 1,
				'default' => 1,
			]
		);
		$this->add_control(
			'mobile_margin',
			[
				'label' => __( 'Mobile Margin', 'author-website-templates' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ 'px' ],
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 1000,
						'step' => 5,
					],
				],
				'default' => [
					'unit' => 'px',
					'size' => 30,
				],
			]
		);
		$this->add_control(
			'hr',
			[
				'type' => Controls_Manager::DIVIDER,
				'label'        => __( 'Label', 'author-website-templates' ),
			]
		);
		$this->add_control(
			'tablet_screen',
			[
				'label' => __( 'Tablet Screen for 768px', 'author-website-templates' ),
				'type' => Controls_Manager::NUMBER,
				'min' => 1,
				'max' => 12,
				'step' => 1,
				'default' => 1,

			]
		);
		$this->add_control(
			'tablet_margin',
			[
				'label' => __( 'Tablet Margin', 'author-website-templates' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ 'px' ],
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 1000,
						'step' => 5,
					],
				],
				'default' => [
					'unit' => 'px',
					'size' => 30,
				],
			]
		);
		$this->add_control(
			'hr2',
			[
				'type' => Controls_Manager::DIVIDER,
				'label'        => __( 'Label', 'author-website-templates' ),
			]
		);
		$this->add_control(
			'medium_screen',
			[
				'label' => __( 'Tablet Screen for 992px - 1200', 'author-website-templates' ),
				'type' => Controls_Manager::NUMBER,
				'min' => 1,
				'max' => 12,
				'step' => 1,
				'default' => 1,

			]
		);
		$this->add_control(
			'medium_margin',
			[
				'label' => __( 'Tablet Margin', 'author-website-templates' ),
				'type' => Controls_Manager::SLIDER,
				'size_units' => [ 'px' ],
				'range' => [
					'px' => [
						'min' => 0,
						'max' => 1000,
						'step' => 5,
					],
				],
				'default' => [
					'unit' => 'px',
					'size' => 30,
				],
			]
		);

		$this->end_controls_section();
		/*Style Tab*/
		$this->start_controls_section(
			'post_style_section',
			[
				'label' => __( 'Box', 'author-website-templates' ),
				'tab'   => Controls_Manager::TAB_STYLE,
			]
		);
		$this->start_controls_tabs(
			'post_box_style_tabs'
		);
		$this->start_controls_tab(
			'post_style_normal_tab',
			[
				'label' => __( 'Normal', 'author-website-templates' ),
			]
		);

		$this->add_group_control(
			Group_Control_Background::get_type(),
			[
				'name' => 'post_box_background',
				'separator'	=> 'before',
				'label' => __( 'Box Background', 'author-website-templates' ),
				'types' => [ 'classic', 'gradient' ],
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one, {{WRAPPER}} .rswpthemes-awt-posts-layout-one__content-wrapper',
			]
		);
		$this->add_group_control(
			Group_Control_Box_Shadow::get_type(),
			[
				'name' => 'box_shadow',
				'separator'	=> 'before',
				'label' => __( 'Box Shadow', 'author-website-templates' ),
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one',
			]
		);

		$this->add_responsive_control(
			'post_box_padding',
			[
				'label' => __( 'Content Padding', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', 'em', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__content-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);
		$this->add_responsive_control(
			'post_item_box_padding',
			[
				'label' => __( 'Item Padding', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', 'em', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);
		$this->add_responsive_control(
			'post_box_margin',
			[
				'label' => __( 'Item Margin', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', 'em', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);

		$this->add_group_control(
			Group_Control_Border::get_type(),
			[
				'name' => 'post_box_border',
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one',
				'separator' => 'before',
			]
		);

		$this->add_control(
			'post_content_alignment',
			[
				'label'     => __( 'Text AlignMent', 'author-website-templates' ),
				'type'      => Controls_Manager::SELECT,
				'default'   => 'left',
				'options' => [
					'left'  => __( 'Left', 'author-website-templates' ),
					'center' => __( 'Center', 'author-website-templates' ),
					'right' => __( 'Right', 'author-website-templates' ),
				],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__content-wrapper' => 'text-align: {{VALUE}}',
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__blog-meta ul' => 'justify-content: {{VALUE}}',
				]
			]
		);
		$this->end_controls_tab();
		$this->start_controls_tab(
			'post_style_hover_tab',
			[
				'label' => __( 'Hover', 'author-website-templates' ),
			]
		);
		$this->add_group_control(
			Group_Control_Background::get_type(),
			[
				'name' => 'post_box_hover_background',
				'label' => __( 'Box Background', 'author-website-templates' ),
				'types' => [ 'classic', 'gradient' ],
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one:hover',
			]
		);
		$this->add_group_control(
			Group_Control_Box_Shadow::get_type(),
			[
				'name' => 'post_box_hover_shadow',
				'label' => __( 'Box Shadow', 'author-website-templates' ),
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one:hover',
			]
		);
		$this->end_controls_tab();
		$this->end_controls_tabs();

		$this->end_controls_section();
		$this->start_controls_section(
			'post_thumnail_style',
			[
				'label' => __( 'Post Thumbnail', 'author-website-templates' ),
				'tab'   => Controls_Manager::TAB_STYLE,
			]
		);
		$this->start_controls_tabs(
			'post_thumbnail_style_tab'
		);
		$this->start_controls_tab(
			'post_thumbnail_style_normal_tab',
			[
				'label' => __( 'Normal', 'author-website-templates' ),
			]
		);

		$this->add_responsive_control(
			'post_thumbnail_width',
			[
				'label' => esc_html__( 'Width', 'author-website-templates' ),
				'type' => Controls_Manager::SLIDER,
				'default' => [
					'unit' => '%',
				],
				'tablet_default' => [
					'unit' => '%',
				],
				'mobile_default' => [
					'unit' => '%',
				],
				'size_units' => [ '%', 'px', 'vw' ],
				'range' => [
					'%' => [
						'min' => 1,
						'max' => 100,
					],
					'px' => [
						'min' => 1,
						'max' => 1000,
					],
					'vw' => [
						'min' => 1,
						'max' => 100,
					],
				],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__thumbnail img' => 'width: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$this->add_responsive_control(
			'post_thumbnail_max_width',
			[
				'label' => esc_html__( 'Max Width', 'author-website-templates' ),
				'type' => Controls_Manager::SLIDER,
				'default' => [
					'unit' => '%',
				],
				'tablet_default' => [
					'unit' => '%',
				],
				'mobile_default' => [
					'unit' => '%',
				],
				'size_units' => [ '%', 'px', 'vw' ],
				'range' => [
					'%' => [
						'min' => 1,
						'max' => 100,
					],
					'px' => [
						'min' => 1,
						'max' => 1000,
					],
					'vw' => [
						'min' => 1,
						'max' => 100,
					],
				],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__thumbnail img' => 'max-width: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$this->add_responsive_control(
			'post_thumbnail_height',
			[
				'label' => esc_html__( 'Height', 'author-website-templates' ),
				'type' => Controls_Manager::SLIDER,
				'default' => [
					'unit' => 'px',
				],
				'tablet_default' => [
					'unit' => 'px',
				],
				'mobile_default' => [
					'unit' => 'px',
				],
				'size_units' => [ 'px', '%' ],
				'range' => [
					'px' => [
						'min' => 1,
						'max' => 500,
					],
					'%' => [
						'min' => 1,
						'max' => 100,
					],
				],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__thumbnail img' => 'height: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$this->add_responsive_control(
			'post_thumbnail_object-fit',
			[
				'label' => esc_html__( 'Object Fit', 'author-website-templates' ),
				'type' => Controls_Manager::SELECT,
				'condition' => [
					'post_thumbnail_height[size]!' => '',
				],
				'options' => [
					'' => esc_html__( 'Default', 'author-website-templates' ),
					'fill' => esc_html__( 'Fill', 'author-website-templates' ),
					'cover' => esc_html__( 'Cover', 'author-website-templates' ),
					'contain' => esc_html__( 'Contain', 'author-website-templates' ),
				],
				'default' => 'cover',
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__thumbnail img' => 'object-fit: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Css_Filter::get_type(),
			[
				'name' => 'post_thumbnail_filter',
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__thumbnail img',
			]
		);
		$this->add_control(
			'post_thumbnail_border_radius',
			[
				'label' => __( 'Border Radius', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one .rswpthemes-awt-posts-layout-one__thumbnail img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);
		$this->end_controls_tab();
		$this->start_controls_tab(
			'post_thumbnail_style_hover_tab',
			[
				'label' => __( 'Hover', 'author-website-templates' ),
			]
		);
		$this->add_group_control(
			Group_Control_Css_Filter::get_type(),
			[
				'name' => 'post_thumbnail_hover_filter',
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__thumbnail img:hover',
			]
		);
		$this->add_control(
			'post_thumbnail_border_hover_radius',
			[
				'label' => __( 'Border Radius', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__thumbnail img:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);
		$this->end_controls_tab();
		$this->end_controls_tabs();
		$this->end_controls_section();
		$this->start_controls_section(
			'post_title_style',
			[
				'label' => __( 'Post Title', 'author-website-templates' ),
				'tab'   => Controls_Manager::TAB_STYLE,
				'condition' => [
					'post_title_show' => 'true',
				]
			]
		);
		$this->start_controls_tabs(
			'style_title_tabs'
		);
		$this->start_controls_tab(
			'title_tab_normal',
			[
				'label' => __( 'Normal', 'author-website-templates' ),
			]
		);
		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'post_title_typography',
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__title h2',
			]
		);

		$this->add_control(
			'post_title_color',
			[
				'label' => __( 'Title Color', 'author-website-templates' ),
				'type' => Controls_Manager::COLOR,
				'default' => '',
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__title h2 a' => 'color: {{VALUE}};',
				],
			]
		);
		$this->add_responsive_control(
			'post_title_padding',
			[
				'label' => __( 'Padding', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', 'em', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__title h2' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);
		$this->add_responsive_control(
			'post_title_margin',
			[
				'label' => __( 'Margin', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', 'em', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__title h2' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);

		$this->end_controls_tab();
		$this->start_controls_tab(
			'title_tab_hover',
			[
				'label' => __( 'hover', 'author-website-templates' ),
			]
		);
		$this->add_control(
			'post_title_hover_color',
			[
				'label' => __( 'Title Hover Color', 'author-website-templates' ),
				'type' => Controls_Manager::COLOR,
				'default' => '',
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__title h2 a:hover' => 'color: {{VALUE}};',
				],
			]
		);
		$this->add_group_control(
			Group_Control_Text_Shadow::get_type(),
			[
				'name' => 'post_title_text_hover_shadow',
				'label' => __( 'Text Shadow', 'author-website-templates' ),
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__title h2',
			]
		);

		$this->add_control(
			'show_post_title_border',
			[
				'label'        => __( 'Show Border?', 'author-website-templates' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_on'     => __( 'Show', 'author-website-templates' ),
				'label_off'    => __( 'Hide', 'author-website-templates' ),
				'return_value' => 'true',
				'default'      => 'true',

			]
		);

		$this->add_control(
			'post_title_border_color',
			[
				'label' => __( 'Border Color', 'author-website-templates' ),
				'type' => Controls_Manager::COLOR,
				'default' => '',
				'condition' => [
					'show_post_title_border' => 'true',
				],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__title h2 a' => 'background-image: linear-gradient(to right, {{VALUE}} 0%, {{VALUE}} 100%);',
				],
			]
		);
		$this->end_controls_tabs();
		$this->end_controls_section();
		$this->start_controls_section(
			'post_excerpt_style',
			[
				'label' => __( 'Post Excerpt', 'author-website-templates' ),
				'tab'   => Controls_Manager::TAB_STYLE,
				'condition'	=>	[
					'post_excerpt_show' => 'true',
				]
			]
		);
		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'post_excerpt_typography',
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__excerpt',
			]
		);
		$this->add_control(
			'post_excerpt_color',
			[
				'label' => __( 'Description Color', 'author-website-templates' ),
				'type' => Controls_Manager::COLOR,
				'default' => '',
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__excerpt' => 'color: {{VALUE}};',
				],
			]
		);
		$this->add_group_control(
			Group_Control_Text_Shadow::get_type(),
			[
				'name' => 'post_excerpt_text_shadow',
				'label' => __( 'Text Shadow', 'author-website-templates' ),
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__excerpt p',
			]
		);
		$this->add_responsive_control(
			'post_excerpt_padding',
			[
				'label' => __( 'Padding', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', 'em', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__excerpt p' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);
		$this->add_responsive_control(
			'post_excerpt_margin',
			[
				'label' => __( 'Margin', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', 'em', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__excerpt p' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);

		$this->end_controls_section();
		$this->start_controls_section(
			'post_category_style',
			[
				'label' => __( 'Post category', 'author-website-templates' ),
				'tab'   => Controls_Manager::TAB_STYLE,
				'condition'	=>	[
					'post_category_show' => 'true',
				]
			]
		);
		$this->start_controls_tabs(
			'post_category_style_tab'
		);
		$this->start_controls_tab(
			'post_category_normal_tab',
			[
				'label'	=>	__( 'Normal', 'author-website-templates' ),
			]
		);
		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'post_category_typography',
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__categories a',
			]
		);
		$this->add_control(
			'post_category_color',
			[
				'label' => __( 'Category Color', 'author-website-templates' ),
				'type' => Controls_Manager::COLOR,
				'default' => '',
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__categories a' => 'color: {{VALUE}};',
				],
			]
		);
		$this->add_control(
			'post_category_bg_color',
			[
				'label' => __( 'Category Background', 'author-website-templates' ),
				'type' => Controls_Manager::COLOR,
				'default' => '',
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__categories a' => 'background: {{VALUE}};',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Border::get_type(),
			[
				'name' => 'post_category_border',
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__categories a',
				'separator' => 'before',
			]
		);

		$this->add_control(
			'post_category_border_radius',
			[
				'label' => __( 'Border Radius', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__categories a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);
		$this->add_group_control(
			Group_Control_Text_Shadow::get_type(),
			[
				'name' => 'post_category_text_shadow',
				'label' => __( 'Text Shadow', 'author-website-templates' ),
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__categories a',
			]
		);
		$this->add_responsive_control(
			'post_category_padding',
			[
				'label' => __( 'Padding', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', 'em', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__categories a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);
		$this->add_responsive_control(
			'post_category_margin',
			[
				'label' => __( 'Margin', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', 'em', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__categories' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);
		$this->end_controls_tab();
		$this->start_controls_tab(
			'post_category_hover_tab',
			[
				'label'	=>	__( 'Hover', 'author-website-templates' ),
			]
		);
		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'post_category_hover_typography',
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__categories a:hover',
			]
		);
		$this->add_control(
			'post_category_hover_color',
			[
				'label' => __( 'Category Color', 'author-website-templates' ),
				'type' => Controls_Manager::COLOR,
				'default' => '',
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__categories a:hover' => 'color: {{VALUE}};',
				],
			]
		);
		$this->add_control(
			'post_category_bg_hover_color',
			[
				'label' => __( 'Category Background', 'author-website-templates' ),
				'type' => Controls_Manager::COLOR,
				'default' => '',
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__categories a:hover' => 'background: {{VALUE}};',
				],
			]
		);
		$this->add_group_control(
			Group_Control_Border::get_type(),
			[
				'name' => 'post_category_hover_border',
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__categories a:hover',
				'separator' => 'before',
			]
		);
		$this->add_control(
			'post_category_border_hover_radius',
			[
				'label' => __( 'Border Radius', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__categories a:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);
		$this->add_group_control(
			Group_Control_Text_Shadow::get_type(),
			[
				'name' => 'post_category_text_hover_shadow',
				'label' => __( 'Text Shadow', 'author-website-templates' ),
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__categories a:hover',
			]
		);
		$this->end_controls_tab();
		$this->end_controls_tabs();
		$this->end_controls_section();
		$this->start_controls_section(
			'post_meta_style',
			[
				'label' => __( 'Post Meta', 'author-website-templates' ),
				'tab'   => Controls_Manager::TAB_STYLE,
				'condition'	=>	[
					'post_meta_show' => 'true',
				]
			]
		);
		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'post_meta_typography',
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__blog-meta ul li',
			]
		);
		$this->add_control(
			'post_meta_color',
			[
				'label' => __( 'Meta Text Color', 'author-website-templates' ),
				'type' => Controls_Manager::COLOR,
				'default' => '',
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__blog-meta ul li a' => 'color: {{VALUE}};',
				],
			]
		);
		$this->add_control(
			'post_meta_icon_color',
			[
				'label' => __( 'Icon Color', 'author-website-templates' ),
				'type' => Controls_Manager::COLOR,
				'default' => '',
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__blog-meta ul li a span.rswpthemes-icon, {{WRAPPER}} .rswpthemes-awt-posts-layout-one__blog-meta ul li span.rswpthemes-icon' => 'color: {{VALUE}};',
				],
			]
		);

		$this->add_responsive_control(
			'post_meta_padding',
			[
				'label' => __( 'Padding', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', 'em', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__blog-meta ul' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);
		$this->add_responsive_control(
			'post_meta_margin',
			[
				'label' => __( 'Margin', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', 'em', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__blog-meta ul' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);

		$this->end_controls_section();

		$this->start_controls_section(
			'post_read_button_style',
			[
				'label' => __( 'Read More Button', 'author-website-templates' ),
				'tab'   => Controls_Manager::TAB_STYLE,
				'condition'	=> [
					'read_button_show'	=> 'true',
				]
			]
		);
		$this->start_controls_tabs(
			'readmore_button_tabs'
		);
		$this->start_controls_tab(
				'style_normal_button',
				[
					'label' => __( 'Normal', 'author-website-templates' ),
				]
			);
		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'post_read_button_typography',
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__read-more a',
			]
		);
		$this->add_control(
			'post_read_button_color',
			[
				'label' => __( 'Button Color', 'author-website-templates' ),
				'type' => Controls_Manager::COLOR,
				'default' => '',
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__read-more a' => 'color: {{VALUE}};',
				],
			]
		);
		$this->add_control(
			'post_read_button_bg_color',
			[
				'label' => __( 'Button Background', 'author-website-templates' ),
				'type' => Controls_Manager::COLOR,
				'default' => '',
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__read-more a' => 'background: {{VALUE}};',
				],
			]
		);
		$this->add_group_control(
			Group_Control_Border::get_type(),
			[
				'name' => 'post_read_button_border',
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__read-more a',
				'separator' => 'before',
			]
		);
		$this->add_control(
			'post_read_button_border_radius',
			[
				'label' => __( 'Border Radius', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__read-more a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);
		$this->add_group_control(
			Group_Control_Text_Shadow::get_type(),
			[
				'name' => 'post_read_button_text_shadow',
				'label' => __( 'Text Shadow', 'author-website-templates' ),
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__read-more a',
			]
		);
		$this->add_responsive_control(
			'post_read_button_padding',
			[
				'label' => __( 'Padding', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', 'em', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__read-more a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);
		$this->add_responsive_control(
			'post_read_button_margin',
			[
				'label' => __( 'Margin', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', 'em', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__read-more a' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
				'separator' => 'before',
			]
		);
		$this->end_controls_tab();
		$this->start_controls_tab(
			'style_hover_button',
			[
				'label' => __( 'Hover', 'author-website-templates' ),
			]
		);
		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'post_read_button_hover_typography',
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__read-more a:hover',
			]
		);
		$this->add_control(
			'post_read_button_hover_color',
			[
				'label' => __( 'Button Color', 'author-website-templates' ),
				'type' => Controls_Manager::COLOR,
				'default' => '',
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__read-more a:hover' => 'color: {{VALUE}};',
				],
			]
		);
		$this->add_control(
			'post_read_button_bg_hover_color',
			[
				'label' => __( 'Button Background', 'author-website-templates' ),
				'type' => Controls_Manager::COLOR,
				'default' => '',
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__read-more a:hover' => 'background: {{VALUE}};',
				],
			]
		);
		$this->add_group_control(
			Group_Control_Border::get_type(),
			[
				'name' => 'post_read_button_hover_border',
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__read-more a:hover',
				'separator' => 'before',
			]
		);
		$this->add_control(
			'post_read_button_border_hover_radius',
			[
				'label' => __( 'Border Radius', 'author-website-templates' ),
				'type' => Controls_Manager::DIMENSIONS,
				'size_units' => [ 'px', '%' ],
				'selectors' => [
					'{{WRAPPER}} .rswpthemes-awt-posts-layout-one__read-more a:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
				],
			]
		);
		$this->add_group_control(
			Group_Control_Text_Shadow::get_type(),
			[
				'name' => 'post_read_button_hover_text_shadow',
				'label' => __( 'Text Shadow', 'author-website-templates' ),
				'selector' => '{{WRAPPER}} .rswpthemes-awt-posts-layout-one__read-more a:hover',
			]
		);

		$this->end_controls_tab();
		$this->end_controls_tabs();
		$this->end_controls_section();

	}

	/**
	 * Render oEmbed widget output on the frontend.
	 *
	 * Written in PHP and used to generate the final HTML.
	 *
	 * @since 1.0.0
	 * @access protected
	 */
	protected function render() {

		$settings = $this->get_settings_for_display();
		/**
		 * Slider Settings
		 */
		$sliderDynamicId 		   = rand(10, 100000);
		$nav             		   = $settings['nav'] ? $settings['nav'] : 'false';

		$autoplay        		   = $settings['autoplay'] ? $settings['autoplay'] : 'false';
		$autoplayhoverpush         = $settings['autoplay_hover_push'] ? $settings['autoplay_hover_push'] : 'true';
		$loop            		   = $settings['loop'] ? $settings['loop'] : 'false';
		$mouseDrag       		   = $settings['mouseDrag'] ? $settings['mouseDrag'] : 'false';
		$touchDrag       		   = $settings['touchDrag'] ? $settings['touchDrag'] : 'false';
		$smartspeed       		   = $settings['slider_smart_speed'] ? $settings['slider_smart_speed'] : '250';
		$fluidspeed       		   = $settings['slider_fluid_speed'] ? $settings['slider_fluid_speed'] : 'false';
		$autoplayspeed       	   = $settings['slider_autoplay_speed'] ? $settings['slider_autoplay_speed'] : 'false';
		$navspeed       	       = $settings['slider_nav_speed'] ? $settings['slider_nav_speed'] : 'false';

		$center_mode_true       	       = $settings['center_mode_true'] ? $settings['center_mode_true'] : 'false';
		$autoplayTimeout 		   = $settings['autoplayTimeout'] ? $settings['autoplayTimeout'] : '0';
		$slide_to_show   		   = $settings['slide_to_show'];
		$slide_to_show_on_mobile   = $settings['mobile_screen'];
		$slide_to_show_on_tablet   = $settings['tablet_screen'];
		$slide_to_show_on_medium   = $settings['medium_screen'];
		$item_margin     		   = $settings['margin'];
		$item_margin_on_mobile     = $settings['mobile_margin'];
		$item_margin_on_tablet     = $settings['tablet_margin'];
		$item_margin_on_medium     = $settings['medium_margin'];
		$this->add_render_attribute(
            'slider-wrapper',
            [
                'class'                 => 'posts_carousel_active owl-carousel',
                'id'                    => 'active-mainslider-'.esc_attr($sliderDynamicId),
                'data-items'       		=> $slide_to_show,
                'data-mobile-items'     => $slide_to_show_on_mobile,
                'data-tablet-items'     => $slide_to_show_on_tablet,
                'data-medium-items'     => $slide_to_show_on_medium,
                'data-nav'              => $nav,
                'data-loop'             => $loop,
                'data-autoplay'         => $autoplay,
                'data-autoplay-timeout' => $autoplayTimeout,
                'data-mouse-drag'       => $mouseDrag,
                'data-touch-drag'       => $touchDrag,
                'data-margin'           => $item_margin['size'],
                'data-mobile-margin'    => $item_margin_on_mobile['size'],
                'data-tablet-margin'    => $item_margin_on_tablet['size'],
                'data-medium-margin'    => $item_margin_on_medium['size'],
                'data-smart-speed'    => $smartspeed['size'],
                'data-autoplay-speed'    => $autoplayspeed['size'],
                'data-fluid-speed'    => $fluidspeed['size'],
                'data-nav-speed'    => $navspeed['size'],
                'data-auto-hover'    => $autoplayhoverpush,
                'data-center-mode'    => $center_mode_true,
            ]
        );
		$rswpthemes_awt_get_categories = $settings['select_categories'];
		$rswpthemes_awt_posts_count = $settings['posts_count'];
		$authorIn = $settings['post_authors_include'];
		$postOffset = $settings['post_offset'];
		$excludeCategories = $settings['exclude_categories'];
		$excludeAuthors = $settings['exclude_authors'];
		$ignoreStickyPosts = $settings['ignore_sticky_post'];
		$rswpthemes_awt_meta_position = $settings['post_meta_position'];

		if ( get_query_var('paged') ) {
	    $paged = get_query_var('paged');
		} elseif ( get_query_var('page') ) { // if is static front page
		    $paged = get_query_var('page');
		} else {
		    $paged = 1;
		}
		$get_post_args = array(
			'post_type' => array('post'),
			'posts_per_page' => $rswpthemes_awt_posts_count,
			'paged'			=> $paged,
		);

		if (!empty($rswpthemes_awt_get_categories)) {
			$rswpthemes_awt_category_string = implode(',', $rswpthemes_awt_get_categories);
			$get_post_args['category_name'] = $rswpthemes_awt_category_string;
		}
		if (!empty($authorIn)) {
			$get_post_args['author_in'] = explode(',' , $authorIn);
		}
		if ( 0 != $postOffset ) {
			$get_post_args['offset'] = absint($postOffset);
		}
		if (!empty($excludeCategories)) {
			$get_post_args['category__not_in'] = explode(',' , $excludeCategories);
		}
		if (!empty($excludeAuthors)) {
			$get_post_args['author__not_in'] = explode(',' , $excludeAuthors);
		}
		if ('true' != $ignoreStickyPosts) {
			$get_post_args['post__not_in'] = get_option('sticky_posts');
		}

		$rswpthemes_awt_post_query = new \WP_Query( $get_post_args );

		$slider_active = $slider_item = $post_columns_class = "";

		$slider_item = 'blog-grid-layout ';
		?>
		<div class="rswpthemes-awt-posts-carousel-section">
			<div class="container">
				<?php
					if ($rswpthemes_awt_post_query->have_posts()) :
						echo '<div '.$this->get_render_attribute_string('slider-wrapper').'>'; //start row
						while ($rswpthemes_awt_post_query->have_posts()) :
							$rswpthemes_awt_post_query->the_post();
								echo '<div class="'. $slider_item .'">'; //Start Column
									echo '<div class="rswpthemes-awt-posts-layout-one">';
										//start single post wrapper
										echo '<div class="rswpthemes-awt-posts-layout-one__thumbnail">';
											$this->rswpthemes_awt_render_post_thumbnail('author-portfolio-pro-grid-thumbnail');
										echo '</div>';
										echo '<div class="rswpthemes-awt-posts-layout-one__content-wrapper">'; //start content wrapper
											$this->rswpthemes_awt_render_category();
											if('b_thumbnail' === $rswpthemes_awt_meta_position):
												$this->rswpthemes_awt_render_post_meta();
											endif;
											$this->rswpthemes_awt_render_title();
											if('b_title' === $rswpthemes_awt_meta_position):
												$this->rswpthemes_awt_render_post_meta();
											endif;
											$this->rswpthemes_awt_render_excerpt();
											if('b_excerpt' === $rswpthemes_awt_meta_position):
												$this->rswpthemes_awt_render_post_meta();
											endif;
											$this->rswpthemes_awt_render_readmore_button();
											if('b_button' === $rswpthemes_awt_meta_position):
												$this->rswpthemes_awt_render_post_meta();
											endif;
										echo '</div>'; //End Content Wrapper
									echo '</div>'; // end single post wrapper
								echo '</div>'; // End column
						endwhile;
						echo '</div>'; //end row
					endif;
				?>
			</div>
		</div>
		<?php
		wp_reset_postdata();
	}

	public function rswpthemes_awt_render_post_thumbnail(){
		$settings = $this->get_settings_for_display();

		$rswpthemes_awt_post_category_show = $settings['post_category_show'];
		// $rswpthemes_awt_show_category_over_image = $settings['show_category_over_image'];
		$rswpthemes_awt_post_category_position = $settings['post_category_position'];
		// $rswpthemes_awt_category_wrapper = has_post_thumbnail() ? '' : ' position-static';

		if (has_post_thumbnail()) {
			if ('top_left_corner' === $rswpthemes_awt_post_category_position) {
			$rswpthemes_awt_post_caegory_wrapper_classes = ' position-left-top-corner';
			}elseif('top_right_corner' === $rswpthemes_awt_post_category_position){
				$rswpthemes_awt_post_caegory_wrapper_classes = ' position-right-top-corner';
			}elseif('bottom_left_corner' === $rswpthemes_awt_post_category_position){
				$rswpthemes_awt_post_caegory_wrapper_classes = ' position-bottom-left-corner';
			}elseif('bottom_right_corner' === $rswpthemes_awt_post_category_position){
				$rswpthemes_awt_post_caegory_wrapper_classes = ' position-bottom-right-corner';
			}elseif('above_title' === $rswpthemes_awt_post_category_position){
				$rswpthemes_awt_post_caegory_wrapper_classes = ' position-above-title position-static';
			}elseif('half_over_thumbnail' === $rswpthemes_awt_post_category_position){
				$rswpthemes_awt_post_caegory_wrapper_classes = ' position-half-over-thumbnail';
			}
		}else{
			$rswpthemes_awt_post_caegory_wrapper_classes = ' position-above-title position-static';
		}
		?>
			<a href="<?php the_permalink();?>"><?php the_post_thumbnail();?></a>
			<?php if('true' === $rswpthemes_awt_post_category_show && 'above_title' !== $rswpthemes_awt_post_category_position) : ?>
			<div class="rswpthemes-awt-posts-layout-one__categories<?php echo esc_attr($rswpthemes_awt_post_caegory_wrapper_classes);?>">
				<?php
					$categories_list = get_the_category_list( esc_html__( ', ', 'eafe' ) );
					if ( $categories_list ) {
						/* translators: 1: list of categories. */
						printf( '<span class="cat-links">' . esc_html__( '%1$s', 'eafe' ) . '</span>', $categories_list ); // WPCS: XSS OK.
					}
					?>
			</div>
			<?php endif;
	}
	public function rswpthemes_awt_render_title(){
		$settings = $this->get_settings_for_display();
		$rswpthemes_awt_post_title_show = $settings['post_title_show'];
		if('true' === $rswpthemes_awt_post_title_show):
			?>
			<div class="rswpthemes-awt-posts-layout-one__title">
				<h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
			</div>
		<?php endif;
	}
	public function rswpthemes_awt_render_excerpt(){
		$settings = $this->get_settings_for_display();
		$rswpthemes_awt_post_excerpt_type = $settings['post_excerpt_type'];
		$rswpthemes_awt_post_excerpt_show = $settings['post_excerpt_show'];
		$rswpthemes_awt_post_excerpt_length = $settings['post_excerpt_length'];
		if('true' === $rswpthemes_awt_post_excerpt_show) :
			if ('excerpt' === $rswpthemes_awt_post_excerpt_type)  :
		?>
			<div class="rswpthemes-awt-posts-layout-one__excerpt">
				<p>
					<?php echo esc_html( rswpthemes_awt_get_excerpt( $rswpthemes_awt_post_excerpt_length ) );?>
				</p>
			</div>
		<?php
			elseif ('fullcontent' === $rswpthemes_awt_post_excerpt_type) :
				?>
				<div class="rswpthemes-awt-post-full-content-as-excerpt">
					<?php the_content(); ?>
				</div>
				<?php
			endif;
		endif;
	}
	public function rswpthemes_awt_render_readmore_button(){
		$settings = $this->get_settings_for_display();
		$rswpthemes_awt_read_button_show = $settings['read_button_show'];
		$rswpthemes_awt_read_more_button_text = $settings['read_more_button_text'];
		if('true' === $rswpthemes_awt_read_button_show):
		?>
		<div class="rswpthemes-awt-posts-layout-one__read-more">
			<a href="<?php the_permalink();?>"><?php echo esc_html($rswpthemes_awt_read_more_button_text); ?></a>
		</div>
		<?php endif;
	}
	public function rswpthemes_awt_render_post_meta(){
		$settings = $this->get_settings_for_display();
		$rswpthemes_awt_post_meta_show = $settings['post_meta_show'];
		$rswpthemes_awt_post_meta_data = is_array($settings['post_meta_data']) ? $settings['post_meta_data'] : array();
		if('true' === $rswpthemes_awt_post_meta_show) :
		?>
		<div class="rswpthemes-awt-posts-layout-one__blog-meta">
			<ul>
				<?php if(in_array('author', $rswpthemes_awt_post_meta_data)) : ?>
				<li class="author-meta"><a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ) ); ?>"><span class="post-author-image"><?php echo get_avatar( get_the_author_meta('ID'), 30); ?></span> <?php echo esc_html( get_the_author() ); ?></a></li>
				<?php endif;
				if(in_array('date', $rswpthemes_awt_post_meta_data)) :
				?>
				<li><a href="#"> <span class="rswpthemes-icon icon-calendar-days-solid"></span><?php rswpthemes_awt_posted_on(); ?></a></li>
				<?php endif;
				if(in_array('comments', $rswpthemes_awt_post_meta_data)) :
				?>
				<li><span class="rswpthemes-icon icon-comment-solid"></span> <?php rswpthemes_awt_comment_popuplink(); ?></li>
				<?php endif; ?>
			</ul>
		</div>
		<?php endif;
	}
	public function rswpthemes_awt_render_category(){
		$settings = $this->get_settings_for_display();
		$rswpthemes_awt_post_category_show = $settings['post_category_show'];
		// $rswpthemes_awt_show_category_over_image = $settings['show_category_over_image'];
		$rswpthemes_awt_post_category_position = $settings['post_category_position'];
		if('true' === $rswpthemes_awt_post_category_show && 'above_title' === $rswpthemes_awt_post_category_position) : ?>
		<div class="rswpthemes-awt-posts-layout-one__categories position-static">
				<?php
				$categories_list = get_the_category_list( esc_html__( ', ', 'author-website-templates' ) );
				if ( $categories_list ):
					/* translators: 1: list of categories. */
					printf( '<span class="cat-links">' . __( '%1$s', 'author-website-templates' ) . '</span>', $categories_list ); // WPCS: XSS OK.
				endif;
				?>
		</div>
		<?php endif;
	}

}