<?php

namespace Prodigy\Includes\Support\Addons\Elementor\Widgets;

use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Widget_Base;

if ( ! defined( 'ABSPATH' ) ) {
	die( '-1' );
}

/**
 * @version 3.1.2
 */
class Prodigy_Products_Brands extends Widget_Base {

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

	/**
	 * Get widget title.
	 *
	 * Retrieve oEmbed widget title.
	 *
	 * @return string Widget title.
	 * @since 1.0.0
	 * @access public
	 */
	public function get_title() {
		return __( 'Products Brands', 'prodigy-commerce' );
	}

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

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


	/**
	 * 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() {
		/*
		 * General
		 */
		$this->start_controls_section(
			'prg_style_products_brands',
			array(
				'label'     => __( 'General', 'prodigy-commerce' ),
				'tab'       => Controls_Manager::TAB_STYLE,
				'separator' => 'after',
			)
		);

		$this->add_control(
			'prg_brand_enable_swatches',
			array(
				'label'        => __( 'Enable Swatches', 'prodigy-commerce' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_off'    => __( 'Hide', 'prodigy-commerce' ),
				'label_on'     => __( 'Show', 'prodigy-commerce' ),
				'return_value' => 'yes',
				'default'      => '',
				'render_type'  => 'template',
			)
		);

		$this->add_control(
			'prg_logo_brand_name_displaying',
			array(
				'label'        => __( 'Brand Name', 'prodigy-commerce' ),
				'type'         => Controls_Manager::SWITCHER,
				'label_on'     => __( 'Show', 'prodigy-commerce' ),
				'label_off'    => __( 'Hide', 'prodigy-commerce' ),
				'return_value' => 'block',
				'default'      => 'block',
				'condition'    => array(
					'prg_brand_enable_swatches' => 'yes',
				),
				'selectors'    => array(
					'{{WRAPPER}} .prodigy-logo-brand__name' => 'display: {{VALUE}} !important',
				),
			)
		);

		$this->add_responsive_control(
			'prg_general_barnds_swatch_alignment',
			array(
				'label'          => __( 'Alignment', 'prodigy-commerce' ),
				'type'           => Controls_Manager::SELECT,
				'default'        => 'start',
				'tablet_default' => 'center',
				'mobile_default' => 'end',
				'options'        => array(
					'start'  => __( 'Left', 'prodigy-commerce' ),
					'center' => __( 'Center', 'prodigy-commerce' ),
					'end'    => __( 'Right', 'prodigy-commerce' ),
				),
				'condition'      => array(
					'prg_brand_enable_swatches' => 'yes',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-radio__logo-btn-wrap' => 'justify-content: {{VALUE}} !important',
				),
			)
		);

		$this->add_responsive_control(
			'prg_general_barnds_padding',
			array(
				'label'          => __( 'Padding', 'prodigy-commerce' ),
				'type'           => Controls_Manager::DIMENSIONS,
				'size_units'     => array( 'px', 'em' ),
				'default'        => array(
					'unit'     => 'px',
					'top'      => '16',
					'right'    => '0',
					'bottom'   => '16',
					'left'     => '0',
					'isLinked' => false,
				),
				'tablet_default' => array(
					'unit'     => 'px',
					'top'      => '16',
					'right'    => '0',
					'bottom'   => '16',
					'left'     => '0',
					'isLinked' => false,
				),
				'mobile_default' => array(
					'unit'     => 'px',
					'top'      => '16',
					'right'    => '0',
					'bottom'   => '16',
					'left'     => '0',
					'isLinked' => false,
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-select__brands-widget' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-product__logo-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
				),
			)
		);

		$this->add_responsive_control(
			'prg_general_barnds_margin',
			array(
				'label'          => __( 'Margin', 'prodigy-commerce' ),
				'type'           => Controls_Manager::DIMENSIONS,
				'size_units'     => array( 'px', 'em' ),
				'default'        => array(
					'unit'     => 'px',
					'top'      => '0',
					'right'    => '0',
					'bottom'   => '0',
					'left'     => '0',
					'isLinked' => false,
				),
				'tablet_default' => array(
					'unit'     => 'px',
					'top'      => '0',
					'right'    => '0',
					'bottom'   => '0',
					'left'     => '0',
					'isLinked' => false,
				),
				'mobile_default' => array(
					'unit'     => 'px',
					'top'      => '0',
					'right'    => '0',
					'bottom'   => '0',
					'left'     => '0',
					'isLinked' => false,
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-select__brands-widget' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-product__logo-item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
				),
			)
		);

		$this->add_responsive_control(
			'prg_logo_brand_name_alignment',
			array(
				'label'          => __( 'Name Alignment', 'prodigy-commerce' ),
				'type'           => Controls_Manager::SELECT,
				'default'        => 'left',
				'tablet_default' => 'left',
				'mobile_default' => 'left',
				'options'        => array(
					'left'   => __( 'Left', 'prodigy-commerce' ),
					'center' => __( 'Center', 'prodigy-commerce' ),
					'right'  => __( 'Right', 'prodigy-commerce' ),
				),
				'condition'      => array(
					'prg_logo_brand_name_displaying' => array(
						'block',
					),
					'prg_brand_enable_swatches' => 'yes',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-logo-brand__name' => 'text-align: {{VALUE}} !important',
				),
			)
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			array(
				'name'           => 'prg_brands_select_text_typography',
				'label'          => __( 'Typography', 'prodigy-commerce' ),
				'selector'       => '{{WRAPPER}} .prodigy-logo-brand__name',
				'condition'      => array(
					'prg_logo_brand_name_displaying' => array(
						'block',
					),
					'prg_brand_enable_swatches' => 'yes',
				),
				'fields_options' => array(
					'typography'     => array( 'default' => 'yes' ),
					'font_size'      => array(
						'default'        => array(
							'unit' => 'px',
							'size' => 15,
						),
						'tablet_default' => array(
							'unit' => 'px',
							'size' => 15,
						),
						'mobile_default' => array(
							'unit' => 'px',
							'size' => 15,
						),
					),
					'font_weight'    => array(
						'default' => 400,
					),
					'line_height'    => array(
						'default'        => array(
							'unit' => 'em',
							'size' => 1,
						),
						'tablet_default' => array(
							'unit' => 'em',
							'size' => 1,
						),
						'mobile_default' => array(
							'unit' => 'em',
							'size' => 1,
						),
					),
					'letter_spacing' => array(
						'default'        => array(
							'unit' => 'px',
							'size' => 0,
						),
						'tablet_default' => array(
							'unit' => 'px',
							'size' => 0,
						),
						'mobile_default' => array(
							'unit' => 'px',
							'size' => 0,
						),
					),
					'word_spacing'   => array(
						'default'        => array(
							'unit' => 'em',
							'size' => 0,
						),
						'tablet_default' => array(
							'unit' => 'em',
							'size' => 0,
						),
						'mobile_default' => array(
							'unit' => 'em',
							'size' => 0,
						),
					),
				),
			)
		);

		$this->add_control(
			'prg_brands_select_text_color',
			array(
				'label'      => __( 'Color', 'prodigy-commerce' ),
				'type'       => Controls_Manager::COLOR,
				'input_type' => 'color',
				'default'    => '#2a3658',
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-logo-brand__name' => 'color: {{VALUE}} !important',
				),
				'condition'      => array(
					'prg_logo_brand_name_displaying' => array(
						'block',
					),
					'prg_brand_enable_swatches' => 'yes',
				),
			)
		);

		$this->add_responsive_control(
			'prg_logo_brand_name_spacing',
			array(
				'label'          => __( 'Text Spacing', 'prodigy-commerce' ),
				'type'           => Controls_Manager::SLIDER,
				'size_units'     => array( 'px' ),
				'default'        => array(
					'size' => 8,
					'unit' => 'px',
				),
				'tablet_default' => array(
					'size' => 8,
					'unit' => 'px',
				),
				'mobile_default' => array(
					'size' => 8,
					'unit' => 'px',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-logo-brand__name' => 'margin-top: {{SIZE}}{{UNIT}}',
				),
				'condition'      => array(
					'prg_logo_brand_name_displaying' => array(
						'block',
					),
					'prg_brand_enable_swatches' => 'yes',
				),
			)
		);

		$this->add_control(
			'prg_brand_dropdown_default_text',
			array(
				'label'   => __( 'Dropdown Default text', 'prodigy-commerce' ),
				'type'    => Controls_Manager::TEXT,
				'default' => 'Choose an option...',
				'condition' => array(
					'prg_brand_enable_swatches' => '',
				),
			)
		);

		$this->add_responsive_control(
			'prg_general_barnds_alignment',
			array(
				'label'          => __( 'Alignment', 'prodigy-commerce' ),
				'type'           => Controls_Manager::SELECT,
				'default'        => 'start',
				'tablet_default' => 'center',
				'mobile_default' => 'end',
				'options'        => array(
					'start'  => __( 'Left', 'prodigy-commerce' ),
					'center' => __( 'Center', 'prodigy-commerce' ),
					'end'    => __( 'Right', 'prodigy-commerce' ),
				),
				'description'    => __( 'In order to use this setting, width of the select should be less than 100%', 'prodigy-commerce' ),
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-select__brands-widget' => 'align-items: {{VALUE}} !important',
				),
			)
		);

		$this->add_responsive_control(
			'prg_general_brands_width',
			array(
				'label'          => __( 'Width', 'prodigy-commerce' ),
				'type'           => Controls_Manager::SLIDER,
				'size_units'     => array( 'px', '%' ),
				'default'        => array(
					'size' => 100,
					'unit' => '%',
				),
				'tablet_default' => array(
					'size' => 100,
					'unit' => '%',
				),
				'mobile_default' => array(
					'size' => 100,
					'unit' => '%',
				),
				'range'          => array(
					'px' => array(
						'min'  => 0,
						'max'  => 2000,
						'step' => 1,
					),
					'%'  => array(
						'min'  => 0,
						'max'  => 100,
						'step' => 1,
					),
				),
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-select__brands-widget' => 'width: {{SIZE}}{{UNIT}}',
				),
			)
		);

		$this->add_control(
			'prg_brands_select',
			array(
				'label'     => __( 'Select', 'prodigy-commerce' ),
				'type'      => Controls_Manager::HEADING,
				'separator' => 'before',
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
			)
		);

		$this->add_responsive_control(
			'prg_brands_select_alignment',
			array(
				'label'          => __( 'Alignment', 'prodigy-commerce' ),
				'type'           => Controls_Manager::SELECT,
				'default'        => 'left',
				'tablet_default' => 'left',
				'mobile_default' => 'left',
				'options'        => array(
					'left'   => __( 'Left', 'prodigy-commerce' ),
					'center' => __( 'Center', 'prodigy-commerce' ),
					'right'  => __( 'Right', 'prodigy-commerce' ),
				),
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-select__brands' => 'text-align: {{VALUE}}',
				),
			)
		);

		$this->add_responsive_control(
			'prg_general_select_width',
			array(
				'label'          => __( 'Width', 'prodigy-commerce' ),
				'type'           => Controls_Manager::SLIDER,
				'size_units'     => array( 'px', '%' ),
				'default'        => array(
					'size' => 100,
					'unit' => '%',
				),
				'tablet_default' => array(
					'size' => 100,
					'unit' => '%',
				),
				'mobile_default' => array(
					'size' => 100,
					'unit' => '%',
				),
				'range'          => array(
					'px' => array(
						'min'  => 0,
						'max'  => 2000,
						'step' => 1,
					),
					'%'  => array(
						'min'  => 0,
						'max'  => 100,
						'step' => 1,
					),
				),
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-select__brands' => 'width: {{SIZE}}{{UNIT}}',
				),
			)
		);

		$this->add_control(
			'prg_brand_select_border_color',
			array(
				'label'      => __( 'Select Border Color', 'prodigy-commerce' ),
				'type'       => Controls_Manager::COLOR,
				'input_type' => 'color',
				'default'    => '#bfc2cc',
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-dd-header' => 'border-color: {{VALUE}}',
				),
			)
		);

		$this->add_control(
			'prg_brand_select_arrow_color',
			array(
				'label'      => __( 'Select Arrow Color', 'prodigy-commerce' ),
				'type'       => Controls_Manager::COLOR,
				'input_type' => 'color',
				'default'    => '#000000',
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-dd .ms-list-option .ms-dd-arrow:before' => 'border-top-color: {{VALUE}};border-left-color: {{VALUE}} !important',
				),
			)
		);

		$this->add_control(
			'prg_brand_select_border_radius',
			array(
				'label'      => __( 'Select Radius', 'prodigy-commerce' ),
				'type'       => Controls_Manager::SLIDER,
				'size_units' => array( 'px' ),
				'default'    => array(
					'size' => 0,
					'unit' => 'px',
				),
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-dd-header' => 'border-radius: {{SIZE}}{{UNIT}}',
				),
			)
		);

		$this->add_control(
			'prg_brand_dropdown_block_border_radius',
			array(
				'label'      => __( 'Dropdown Radius', 'prodigy-commerce' ),
				'type'       => Controls_Manager::SLIDER,
				'size_units' => array( 'px' ),
				'default'    => array(
					'size' => 0,
					'unit' => 'px',
				),
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-dd ul.ms-options' => 'border-radius: {{SIZE}}{{UNIT}}',
				),
			)
		);

		$this->add_control(
			'prg_brand_dropdown_height',
			array(
				'label'      => __( 'Dropdown Hight', 'prodigy-commerce' ),
				'type'       => Controls_Manager::SLIDER,
				'size_units' => array( 'px' ),
				'default'    => array(
					'size' => 186,
					'unit' => 'px',
				),
				'range'      => array(
					'px' => array(
						'min'  => 0,
						'max'  => 1000,
						'step' => 1,
					),
				),
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-select__brands ul.ms-options' => 'max-height: {{SIZE}}{{UNIT}}',
				),
			)
		);

		$this->start_controls_tabs( 'Brand Options Tabs' );

		$this->start_controls_tab(
			'prg_brand_options_bg_color_tab_normal',
			array(
				'label' => __( 'Normal', 'prodigy-commerce' ),
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
			)
		);

		$this->add_control(
			'prg_brand_options_item_bg_color',
			array(
				'label'      => __( 'Background Color', 'prodigy-commerce' ),
				'type'       => Controls_Manager::COLOR,
				'input_type' => 'color',
				'default'    => '#ffffff',
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-dd .ms-list-option' => 'background-color: {{VALUE}}',
				),
			)
		);

		$this->add_control(
			'prg_brand_options_color_value',
			array(
				'label'      => __( 'Option Text Color', 'prodigy-commerce' ),
				'type'       => Controls_Manager::COLOR,
				'input_type' => 'color',
				'default'    => '#2a3658',
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-options .ms-dd-label' => 'color: {{VALUE}} !important',
				),
			)
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'prg_brand_options_item_tab_hover',
			array(
				'label' => __( 'Hover', 'prodigy-commerce' ),
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
			)
		);

		$this->add_control(
			'prg_brand_options_item_bg_color_tab_hover',
			array(
				'label'      => __( 'Background Color', 'prodigy-commerce' ),
				'type'       => Controls_Manager::COLOR,
				'input_type' => 'color',
				'default'    => '#0274be',
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-dd .ms-list-option:hover' => 'background-color: {{VALUE}} !important',
				),
			)
		);

		$this->add_control(
			'prg_brand_options_color_hover_value',
			array(
				'label'      => __( 'Option Text Color Hover', 'prodigy-commerce' ),
				'type'       => Controls_Manager::COLOR,
				'input_type' => 'color',
				'default'    => '#ffffff',
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-dd .ms-list-option:hover .ms-dd-label' => 'color: {{VALUE}} !important',
				),
			)
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'prg_brand_options_item_tab_selected',
			array(
				'label' => __( 'Selected', 'prodigy-commerce' ),
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
			)
		);

		$this->add_control(
			'prg_brand_options_item_bg_color_tab_selected',
			array(
				'label'      => __( 'Background Color', 'prodigy-commerce' ),
				'type'       => Controls_Manager::COLOR,
				'input_type' => 'color',
				'default'    => '#0274be',
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-select__brands li.ms-list-option.option-selected.enabled:not(:first-child)' => 'background: {{VALUE}} !important',
				),
			)
		);

		$this->add_control(
			'prg_brand_options_color_selected_value',
			array(
				'label'      => __( 'Option Text Color Selected', 'prodigy-commerce' ),
				'type'       => Controls_Manager::COLOR,
				'input_type' => 'color',
				'default'    => 'white',
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-select__brands li.ms-list-option.option-selected:not(:first-child) .ms-dd-label' => 'color: {{VALUE}} !important',
				),
			)
		);

		$this->end_controls_tab();

		$this->end_controls_tabs();

		$this->add_control(
			'prg_brand_options_img',
			array(
				'label'     => __( 'Image', 'prodigy-commerce' ),
				'type'      => Controls_Manager::HEADING,
				'separator' => 'before',
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
			)
		);

		$this->add_responsive_control(
			'prg_brand_options_img_displaying',
			array(
				'label'          => __( 'Displaying', 'prodigy-commerce' ),
				'type'           => Controls_Manager::SELECT,
				'default'        => 'block',
				'tablet_default' => 'block',
				'mobile_default' => 'block',
				'options'        => array(
					'block' => __( 'Show', 'prodigy-commerce' ),
					'none'  => __( 'Hide', 'prodigy-commerce' ),
				),
				'condition'      => array(
					'prg_brand_enable_swatches' => '',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-dd .ms-dd-option-image' => 'display: {{VALUE}} !important',
				),
			)
		);

		$this->add_responsive_control(
			'prg_brand_options_img_alignment',
			array(
				'label'          => __( 'Alignment', 'prodigy-commerce' ),
				'type'           => Controls_Manager::SELECT,
				'default'        => 'row',
				'tablet_default' => 'row',
				'mobile_default' => 'row',
				'options'        => array(
					'row'         => __( 'Normal', 'prodigy-commerce' ),
					'row-reverse' => __( 'Reverse', 'prodigy-commerce' ),
				),
				'condition'      => array(
					'prg_brand_options_img_displaying' => array(
						'block',
					),
					'prg_brand_enable_swatches' => '',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-dd .ms-middle' => 'flex-direction: {{VALUE}} !important',
				),
			)
		);

		$this->add_responsive_control(
			'prg_brand_options_img_margin',
			array(
				'label'          => __( 'Margin', 'prodigy-commerce' ),
				'type'           => Controls_Manager::DIMENSIONS,
				'size_units'     => array( 'px', 'em', '%' ),
				'default'        => array(
					'unit'     => 'px',
					'top'      => '0',
					'right'    => '12',
					'bottom'   => '0',
					'left'     => '0',
					'isLinked' => false,
				),
				'tablet_default' => array(
					'unit'     => 'px',
					'top'      => '0',
					'right'    => '12',
					'bottom'   => '0',
					'left'     => '0',
					'isLinked' => false,
				),
				'mobile_default' => array(
					'unit'     => 'px',
					'top'      => '0',
					'right'    => '12',
					'bottom'   => '0',
					'left'     => '0',
					'isLinked' => false,
				),
				'condition'      => array(
					'prg_brand_options_img_displaying' => array(
						'block',
					),
					'prg_brand_enable_swatches' => '',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-dd .ms-dd-option-image' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
				),
			)
		);

		$this->add_responsive_control(
			'prg_brand_options_img_width',
			array(
				'label'          => __( 'Width', 'prodigy-commerce' ),
				'type'           => Controls_Manager::SLIDER,
				'size_units'     => array( 'px' ),
				'default'        => array(
					'size' => 24,
					'unit' => 'px',
				),
				'tablet_default' => array(
					'size' => 24,
					'unit' => 'px',
				),
				'mobile_default' => array(
					'size' => 24,
					'unit' => 'px',
				),
				'condition'      => array(
					'prg_brand_options_img_displaying' => array(
						'block',
					),
					'prg_brand_enable_swatches' => '',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-dd .ms-dd-option-image' => 'width: {{SIZE}}{{UNIT}}; min-width: {{SIZE}}{{UNIT}}',
				),
			)
		);

		$this->add_responsive_control(
			'prg_brand_options_img_height',
			array(
				'label'          => __( 'Height', 'prodigy-commerce' ),
				'type'           => Controls_Manager::SLIDER,
				'size_units'     => array( 'px' ),
				'default'        => array(
					'size' => 24,
					'unit' => 'px',
				),
				'tablet_default' => array(
					'size' => 24,
					'unit' => 'px',
				),
				'mobile_default' => array(
					'size' => 24,
					'unit' => 'px',
				),
				'condition'      => array(
					'prg_brand_options_img_displaying' => array(
						'block',
					),
					'prg_brand_enable_swatches' => '',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-dd .ms-dd-option-image' => 'height: {{SIZE}}{{UNIT}}',
				),
			)
		);

		$this->add_responsive_control(
			'prg_brand_options_img_border_radius',
			array(
				'label'          => __( 'Border Radius', 'prodigy-commerce' ),
				'type'           => Controls_Manager::SLIDER,
				'size_units'     => array( 'px', '%' ),
				'default'        => array(
					'size' => 0,
					'unit' => 'px',
				),
				'tablet_default' => array(
					'size' => 24,
					'unit' => 'px',
				),
				'mobile_default' => array(
					'size' => 24,
					'unit' => 'px',
				),
				'condition'      => array(
					'prg_brand_options_img_displaying' => array(
						'block',
					),
					'prg_brand_enable_swatches' => '',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-dd .ms-dd-option-image' => 'border-radius: {{SIZE}}{{UNIT}}',
				),
			)
		);

		$this->add_control(
			'prg_brand_options_img_color_border',
			array(
				'label'      => __( 'Border Color', 'prodigy-commerce' ),
				'type'       => Controls_Manager::COLOR,
				'input_type' => 'color',
				'default'    => '#e9eaee',
				'condition'  => array(
					'prg_brand_options_img_border_type' => array(
						'dotted',
						'dashed',
						'solid',
						'double',
						'groove',
						'ridge',
						'inset',
						'outset',
						'hidden',
					),
				),
				'condition'  => array(
					'prg_brand_options_img_displaying' => array(
						'block',
					),
					'prg_brand_enable_swatches' => '',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-dd .ms-dd-option-image' => 'border-color: {{SIZE}}{{UNIT}}',
				),
			)
		);

		$this->add_control(
			'prg_brand_options_img_border_width',
			array(
				'label'      => __( 'Border Width', 'prodigy-commerce' ),
				'type'       => Controls_Manager::DIMENSIONS,
				'size_units' => array( 'px' ),
				'default'    => array(
					'unit'     => 'px',
					'top'      => '1',
					'right'    => '1',
					'bottom'   => '1',
					'left'     => '1',
					'isLinked' => true,
				),
				'condition'  => array(
					'prg_brand_options_img_displaying' => array(
						'block',
					),
					'prg_brand_enable_swatches' => '',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-dd .ms-dd-option-image' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important',
				),
			)
		);

		$this->add_control(
			'prg_brand_options_img_border_type',
			array(
				'label'     => __( 'Border Type', 'prodigy-commerce' ),
				'type'      => Controls_Manager::SELECT,
				'default'   => 'solid',
				'options'   => array(
					'none'   => esc_attr( 'none' ),
					'dotted' => esc_attr( 'dotted' ),
					'dashed' => esc_attr( 'dashed' ),
					'double' => esc_attr( 'double' ),
					'groove' => esc_attr( 'groove' ),
					'ridge'  => esc_attr( 'ridge' ),
					'inset'  => esc_attr( 'inset' ),
					'outset' => esc_attr( 'outset' ),
					'hidden' => esc_attr( 'hidden' ),
					'solid'  => esc_attr( 'solid' ),
				),
				'condition' => array(
					'prg_brand_options_img_displaying' => array(
						'block',
					),
					'prg_brand_enable_swatches' => '',
				),
				'selectors' => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-dd .ms-dd-option-image' => 'border-style: {{SIZE}} !important',
				),
			)
		);

		$this->add_control(
			'prg_brand_options_img_bg_border',
			array(
				'label'      => __( 'Background Color', 'prodigy-commerce' ),
				'type'       => Controls_Manager::COLOR,
				'input_type' => 'color',
				'default'    => '#e9eaee',
				'condition'  => array(
					'prg_brand_options_img_displaying' => array(
						'block',
					),
					'prg_brand_enable_swatches' => '',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-select__brands .ms-dd .ms-dd-option-image' => 'background-color: {{VALUE}}',
				),
			)
		);

		$this->add_control(
			'prg_brand_swatch_image_button',
			array(
				'label'     => __( 'Image', 'prodigy-commerce' ),
				'type'      => Controls_Manager::HEADING,
				'separator' => 'before',
				'condition' => array(
					'prg_brand_enable_swatches' => 'yes',
				),
			)
		);

		$this->add_responsive_control(
			'prg_brand_swatch_object_fit',
			array(
				'label'          => __( 'Object Fit', 'prodigy-commerce' ),
				'type'           => Controls_Manager::SELECT,
				'default'        => 'contain',
				'tablet_default' => 'contain',
				'mobile_default' => 'contain',
				'options'        => array(
					'cover'   => __( 'Cover', 'prodigy-commerce' ),
					'contain' => __( 'Contain', 'prodigy-commerce' ),
				),
				'condition' => array(
					'prg_brand_enable_swatches' => 'yes',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-logo-brand label.prodigy-logo-brand__label img' => 'object-fit: {{VALUE}} !important',
				),
			)
		);

		$this->add_responsive_control(
			'prg_brand_swatch_image_button_width',
			array(
				'label'          => __( 'Width', 'prodigy-commerce' ),
				'type'           => Controls_Manager::SLIDER,
				'size_units'     => array( 'px' ),
				'range'          => array(
					'px' => array(
						'min'  => 0,
						'max'  => 2000,
						'step' => 1,
					),
				),
				'default'        => array(
					'size' => 100,
					'unit' => 'px',
				),
				'tablet_default' => array(
					'size' => 100,
					'unit' => 'px',
				),
				'mobile_default' => array(
					'size' => 84,
					'unit' => 'px',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-radio__swatch-btn.prodigy-radio__swatch-logo-btn' => 'width: {{SIZE}}{{UNIT}} !important',
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-logo-brand__name' => 'width: {{SIZE}}{{UNIT}} !important',
				),
				'condition'      => array(
					'prg_brand_enable_swatches' => 'yes',
				),
			)
		);

		$this->add_responsive_control(
			'prg_brand_swatch_image_button_height',
			array(
				'label'          => __( 'Height', 'prodigy-commerce' ),
				'type'           => Controls_Manager::SLIDER,
				'size_units'     => array( 'px' ),
				'range'          => array(
					'px' => array(
						'min'  => 0,
						'max'  => 2000,
						'step' => 1,
					),
				),
				'default'        => array(
					'size' => 100,
					'unit' => 'px',
				),
				'tablet_default' => array(
					'size' => 100,
					'unit' => 'px',
				),
				'mobile_default' => array(
					'size' => 84,
					'unit' => 'px',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-radio__swatch-btn.prodigy-radio__swatch-logo-btn' => 'height: {{SIZE}}{{UNIT}} !important',
				),
				'condition'      => array(
					'prg_brand_enable_swatches' => 'yes',
				),
			)
		);

		$this->add_control(
			'prg_brand_swatch_image_button_bg_color',
			array(
				'label'      => __( 'Background Color', 'prodigy-commerce' ),
				'type'       => Controls_Manager::COLOR,
				'input_type' => 'color',
				'default'    => '#e9eaee',
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-custom-template label.prodigy-logo-brand__label img' => 'background-color: {{VALUE}}',
				),
				'condition'  => array(
					'prg_brand_enable_swatches' => 'yes',
				),
			)
		);

		$this->add_responsive_control(
			'prg_brand_swatch_image_button_column_gap',
			array(
				'label'      => __( 'Values Horizontal Gap', 'prodigy-commerce' ),
				'type'       => Controls_Manager::SLIDER,
				'size_units' => array( 'px' ),
				'default'    => array(
					'size' => 4,
					'unit' => 'px',
				),
				'tablet_default' => array(
					'size' => 4,
					'unit' => 'px',
				),
				'mobile_default' => array(
					'size' => 4,
					'unit' => 'px',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-custom-template .prodigy-radio__logo-btn-wrap' => 'column-gap: {{SIZE}}{{UNIT}}',
				),
				'condition'  => array(
					'prg_brand_enable_swatches' => 'yes',
				),
			)
		);

		$this->add_responsive_control(
			'prg_brand_swatch_image_button_row_gap',
			array(
				'label'      => __( 'Values Vertical Gap', 'prodigy-commerce' ),
				'type'       => Controls_Manager::SLIDER,
				'size_units' => array( 'px' ),
				'default'    => array(
					'size' => 8,
					'unit' => 'px',
				),
				'tablet_default' => array(
					'size' => 8,
					'unit' => 'px',
				),
				'mobile_default' => array(
					'size' => 8,
					'unit' => 'px',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-custom-template .prodigy-radio__logo-btn-wrap' => 'row-gap: {{SIZE}}{{UNIT}}',
				),
				'condition'  => array(
					'prg_brand_enable_swatches' => 'yes',
				),
			)
		);

		$this->add_responsive_control(
			'prg_brand_swatch_image_border_radius',
			array(
				'label'      => __( 'Border Radius', 'prodigy-commerce' ),
				'type'       => Controls_Manager::SLIDER,
				'size_units' => array( '%' ),
				'default'    => array(
					'size' => 0,
					'unit' => 'px',
				),
				'tablet_default' => array(
					'size' => 0,
					'unit' => 'px',
				),
				'mobile_default' => array(
					'size' => 0,
					'unit' => 'px',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-radio__swatch-btn.prodigy-radio__swatch-logo-btn'     => 'border-radius: {{SIZE}}{{UNIT}}',
					'{{WRAPPER}} .prodigy-radio__swatch-btn.prodigy-radio__swatch-logo-btn > *' => 'border-radius: {{SIZE}}{{UNIT}}',
					'{{WRAPPER}} label.prodigy-logo-brand__label img'                           => 'border-radius: {{SIZE}}{{UNIT}}',
				),
				'condition'  => array(
					'prg_brand_enable_swatches' => 'yes',
				),
			)
		);

		$this->add_control(
			'prg_brand_swatch_image_transition',
			array(
				'label'     => __( 'Transition Duration', 'prodigy-commerce' ),
				'type'      => Controls_Manager::SLIDER,
				'range'     => array(
					'px' => array(
						'min'  => 0,
						'max'  => 10,
						'step' => 0.1,
					),
				),
				'default'   => array(
					'unit' => 'px',
					'size' => 0.1,
				),
				'condition'  => array(
					'prg_brand_enable_swatches' => 'yes',
				),
				'selectors' => array(
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-custom-template .prodigy-radio__swatch-btn.prodigy-radio__swatch-logo-btn > input ~ *' => 'transition: transform {{SIZE}}s linear',
				),
			)
		);

		$this->start_controls_tabs( 'prg_brand_swatch_image_hover' );

		$this->start_controls_tab(
			'prg_brand_swatch_image_hover_scale',
			array(
				'label'     => __( 'Hover', 'prodigy-commerce' ),
				'condition' => array(
					'prg_brand_enable_swatches' => 'yes',
				),
			)
		);

		$this->add_responsive_control(
			'prg_brand_swatch_image_hover_scale_effect',
			array(
				'label'          => __( 'Scale', 'prodigy-commerce' ),
				'type'           => Controls_Manager::SLIDER,
				'size_units'     => array( 'px' ),
				'range'          => array(
					'px' => array(
						'min'  => 0.1,
						'max'  => 5,
						'step' => 0.1,
					),
				),
				'default'        => array(
					'size' => 1,
					'unit' => '',
				),
				'tablet_default' => array(
					'size' => 1,
					'unit' => '',
				),
				'mobile_default' => array(
					'size' => 1,
					'unit' => '',
				),
				'condition' => array(
					'prg_brand_enable_swatches' => 'yes',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-custom-template .prodigy-radio__swatch-btn.prodigy-radio__swatch-logo-btn > input:hover ~ * ' => 'transform: scale({{SIZE}})',
				),
			)
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'prg_brand_swatch_image_checked_scale',
			array(
				'label'     => __( 'Checked', 'prodigy-commerce' ),
				'condition' => array(
					'prg_brand_enable_swatches' => 'yes',
				),
			)
		);

		$this->add_responsive_control(
			'prg_brand_swatch_image_checked_scale_effect',
			array(
				'label'          => __( 'Scale', 'prodigy-commerce' ),
				'type'           => Controls_Manager::SLIDER,
				'size_units'     => array( 'px' ),
				'range'          => array(
					'px' => array(
						'min'  => 0.1,
						'max'  => 5,
						'step' => 0.1,
					),
				),
				'default'        => array(
					'size' => 0.95,
					'unit' => '',
				),
				'tablet_default' => array(
					'size' => 0.95,
					'unit' => '',
				),
				'mobile_default' => array(
					'size' => 0.95,
					'unit' => '',
				),
				'condition' => array(
					'prg_brand_enable_swatches' => 'yes',
				),
				'selectors'      => array(
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-custom-template .prodigy-radio__swatch-btn.prodigy-radio__swatch-logo-btn > input:checked ~ * ' => 'transform: scale({{SIZE}})',
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-custom-template .prodigy-radio__swatch-btn.prodigy-radio__swatch-logo-btn > input:focus ~ * ' => 'transform: scale({{SIZE}})',
				),
			)
		);

		$this->end_controls_tab();

		$this->end_controls_tabs();

		$this->start_controls_tabs( 'prg_brand_swatch_image_button_border_color' );

		$this->start_controls_tab(
			'prg_brand_swatch_image_border_color_normal',
			array(
				'label'     => __( 'Normal', 'prodigy-commerce' ),
				'condition' => array(
					'prg_brand_enable_swatches' => 'yes',
				),
			)
		);

		$this->add_control(
			'prg_brand_swatch_image_button_normal_border_type',
			array(
				'label'     => __( 'Border Type', 'prodigy-commerce' ),
				'type'      => Controls_Manager::SELECT,
				'default'   => 'solid',
				'options'   => array(
					'none'   => esc_attr( 'none' ),
					'dotted' => esc_attr( 'dotted' ),
					'dashed' => esc_attr( 'dashed' ),
					'double' => esc_attr( 'double' ),
					'groove' => esc_attr( 'groove' ),
					'ridge'  => esc_attr( 'ridge' ),
					'inset'  => esc_attr( 'inset' ),
					'outset' => esc_attr( 'outset' ),
					'hidden' => esc_attr( 'hidden' ),
					'solid'  => esc_attr( 'solid' ),
				),
				'condition' => array(
					'prg_brand_enable_swatches' => 'yes',
				),
				'selectors' => array(
					'{{WRAPPER}} .prodigy-custom-template >.prodigy-logo-brand .prodigy-radio__swatch-btn > input:not([type="image"]) + label' => 'border-style: {{VALUE}}',
				),
			)
		);

		$this->add_control(
			'prg_brand_swatch_image_button_normal_border_width',
			array(
				'label'      => __( 'Border Width', 'prodigy-commerce' ),
				'type'       => Controls_Manager::SLIDER,
				'size_units' => array( 'px' ),
				'default'    => array(
					'unit'     => 'px',
					'size'     => 1,
				),
				'range'      => array(
					'px' => array(
						'min'  => 0,
						'max'  => 100,
						'step' => 1,
					),
				),
				'condition'  => array(
					'prg_brand_enable_swatches' => 'yes',
					'prg_brand_swatch_image_button_normal_border_type' => array(
						'dotted',
						'dashed',
						'solid',
						'double',
						'groove',
						'ridge',
						'inset',
						'outset',
						'hidden',
					),
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-custom-template >.prodigy-logo-brand .prodigy-radio__swatch-btn > input:not([type="image"]) + label' => 'border-width: {{SIZE}}{{UNIT}} !important',
				),
			)
		);

		$this->add_control(
			'prg_product_logo_tool_enable_select_block_logo_image_button_border_color_normal_border_color',
			array(
				'label'      => __( 'Border Color', 'prodigy-commerce' ),
				'type'       => Controls_Manager::COLOR,
				'input_type' => 'color',
				'default'    => '#e9eaee',
				'condition'  => array(
					'prg_brand_enable_swatches' => 'yes',
					'prg_brand_swatch_image_button_normal_border_type' => array(
						'dotted',
						'dashed',
						'solid',
						'double',
						'groove',
						'ridge',
						'inset',
						'outset',
						'hidden',
					),
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-custom-template >.prodigy-logo-brand .prodigy-radio__swatch-btn > input:not([type="image"]) + label' => 'border-color: {{VALUE}}',
				),
			)
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'prg_brand_swatch_image_button_border_color_checked',
			array(
				'label'     => __( 'Checked', 'prodigy-commerce' ),
				'condition' => array(
					'prg_brand_enable_swatches' => 'yes',
				),
			)
		);

		$this->add_control(
			'prg_brand_swatch_image_button_border_color_checked_border_offset',
			array(
				'label'      => __( 'Outline Border Offset', 'prodigy-commerce' ),
				'type'       => Controls_Manager::SLIDER,
				'size_units' => array( 'px' ),
				'default'    => array(
					'size' => 1,
					'unit' => 'px',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-radio__swatch-btn.prodigy-radio__swatch-logo-btn > input:checked + label' => 'outline-offset: {{SIZE}}{{UNIT}}',
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-radio__swatch-btn.prodigy-radio__swatch-logo-btn > input:focus + label'   => 'outline-offset: {{SIZE}}{{UNIT}}',
				),
				'condition' => array(
					'prg_brand_enable_swatches' => 'yes',
				),
			)
		);

		$this->add_control(
			'prg_brand_swatch_image_button_border_color_checked_outline_width',
			array(
				'label'      => __( 'Outline Border Width', 'prodigy-commerce' ),
				'type'       => Controls_Manager::SLIDER,
				'size_units' => array( 'px', 'em' ),
				'default'    => array(
					'unit' => 'px',
					'size' => '1',
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-radio__swatch-btn.prodigy-radio__swatch-logo-btn > input:checked + label' => 'outline-width: {{SIZE}}{{UNIT}}',
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-radio__swatch-btn.prodigy-radio__swatch-logo-btn > input:focus + label'   => 'outline-width: {{SIZE}}{{UNIT}}',
				),
				'condition' => array(
					'prg_brand_enable_swatches' => 'yes',
				),
			)
		);

		$this->add_control(
			'prg_brand_swatch_image_button_border_color_checked_border_type',
			array(
				'label'     => __( 'Outline Border Type', 'prodigy-commerce' ),
				'type'      => Controls_Manager::SELECT,
				'default'   => 'solid',
				'options'   => array(
					'none'   => esc_attr( 'none' ),
					'dotted' => esc_attr( 'dotted' ),
					'dashed' => esc_attr( 'dashed' ),
					'double' => esc_attr( 'double' ),
					'groove' => esc_attr( 'groove' ),
					'ridge'  => esc_attr( 'ridge' ),
					'inset'  => esc_attr( 'inset' ),
					'outset' => esc_attr( 'outset' ),
					'hidden' => esc_attr( 'hidden' ),
					'solid'  => esc_attr( 'solid' ),
				),
				'selectors' => array(
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-radio__swatch-btn.prodigy-radio__swatch-logo-btn > input:checked + label' => 'outline-style: {{VALUE}}',
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-radio__swatch-btn.prodigy-radio__swatch-logo-btn > input:focus + label'   => 'outline-style: {{VALUE}}',
				),
				'condition' => array(
					'prg_brand_enable_swatches' => 'yes',
				),
			)
		);

		$this->add_control(
			'prg_brand_swatch_image_button_border_color_checked_color_checked',
			array(
				'label'      => __( 'Checked Outline Color', 'prodigy-commerce' ),
				'type'       => Controls_Manager::COLOR,
				'input_type' => 'color',
				'default'    => '#2a3658',
				'condition'  => array(
					'prg_brand_enable_swatches' => 'yes',
					'prg_brand_swatch_image_button_border_color_checked_border_type' => array(
						'dotted',
						'dashed',
						'solid',
						'double',
						'groove',
						'ridge',
						'inset',
						'outset',
						'hidden',
					),
				),
				'selectors'  => array(
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-radio__swatch-btn.prodigy-radio__swatch-logo-btn > input:checked + label' => 'outline-color: {{VALUE}}',
					'{{WRAPPER}} .prodigy-logo-brand .prodigy-radio__swatch-btn.prodigy-radio__swatch-logo-btn > input:focus + label'   => 'outline-color: {{VALUE}}',
				),
			)
		);

		$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.
	 *
	 * @access protected
	 */
	protected function render() {
		$widget_options = $this->get_settings_for_display();

		do_action( 'prodigy_get_template_products_brands', $widget_options );
	}
}
