<?php

namespace MasterAddons\Addons;

use MasterAddons\Inc\Classes\Base\Master_Widget;
use \Elementor\Controls_Manager;
use \Elementor\Controls_Stack;
use \Elementor\Utils;
use \Elementor\Group_Control_Border;
use \Elementor\Core\Kits\Documents\Tabs\Global_Typography;
use \Elementor\Group_Control_Box_Shadow;
use \Elementor\Group_Control_Typography;

use MasterAddons\Inc\Classes\Helper;
use MasterAddons\Inc\Admin\Config;

if (!defined('ABSPATH')) exit; // If this file is called directly, abort.

class Dual_Heading extends Master_Widget
{
	use \MasterAddons\Inc\Traits\Widget_Notice;
	use \MasterAddons\Inc\Traits\Widget_Assets_Trait;

	public function get_name()
	{
		return 'ma-dual-heading';
	}

	public function get_title()
	{
		return esc_html__('Dual Heading', 'master-addons' );
	}

	public function get_icon()
	{
		return 'jltma-icon ' . Config::get_addon_icon($this->get_name());
	}

	public function get_keywords()
	{
		return ['heading', 'headlines', 'dual headline', 'gradient', 'gradient heading', 'gradient headlines'];
	}

	protected function register_controls()
	{

		/**
		 * Master Addons: Dual Heading Content Section
		 */
		$this->start_controls_section(
			'ma_el_dual_heading_content',
			[
				'label' => esc_html__('Content', 'master-addons' ),
			]
		);

		$this->add_control(
			'ma_el_dual_heading_styles_preset',
			[
				'label'   => esc_html__('Style Preset', 'master-addons' ),
				'type'    => Controls_Manager::SELECT,
				'default' => '-style2',
				'options' => [
					'-style1' => esc_html__('Style 1', 'master-addons' ),
					'-style2' => esc_html__('Style 2', 'master-addons' ),
					// '-style3' => esc_html__('Background Text', 'master-addons' ),
				],
			]
		);

		$this->add_responsive_control(
			'ma_el_dual_heading_alignment',
			[
				'label'       => esc_html__('Alignment', 'master-addons' ),
				'type'        => Controls_Manager::CHOOSE,
				'label_block' => false,
				'options'     => [
					'left' => [
						'title' => esc_html__('Left', 'master-addons' ),
						'icon'  => 'eicon-text-align-left',
					],
					'center' => [
						'title' => esc_html__('Center', 'master-addons' ),
						'icon'  => 'eicon-text-align-center',
					],
					'right' => [
						'title' => esc_html__('Right', 'master-addons' ),
						'icon'  => 'eicon-text-align-right',
					],
				],
				'default'   => 'center',
				'selectors' => [
					'{{WRAPPER}} .jltma-dual-heading .jltma-dual-heading-wrapper, {{WRAPPER}} .jltma-sec-head-style' => 'text-align: {{VALUE}};',
				],
			]
		);

		$this->add_control(
			'ma_el_dual_first_heading',
			[
				'label'       => esc_html__('First Heading', 'master-addons' ),
				'type'        => Controls_Manager::TEXT,
				'label_block' => true,
				'default'     => esc_html__('First', 'master-addons' ),
			]
		);

		$this->add_control(
			'ma_el_dual_second_heading',
			[
				'label'       => esc_html__('Second Heading', 'master-addons' ),
				'type'        => Controls_Manager::TEXT,
				'label_block' => true,
				'default'     => esc_html__('Second', 'master-addons' ),
			]
		);

		$this->add_control(
			'ma_el_dual_heading_title_link',
			[
				'label'       => esc_html__('Heading URL', 'master-addons' ),
				'type'        => Controls_Manager::URL,
				'placeholder' => esc_html__('https://master-addons.com', 'master-addons' ),
				'label_block' => true,
				'condition'   => [
					'ma_el_dual_heading_styles_preset' => '-style2',
				],
			]
		);

		$this->add_control(
			'ma_el_dual_heading_description',
			[
				'label'       => esc_html__('Sub Heading', 'master-addons' ),
				'type'        => Controls_Manager::TEXTAREA,
				'label_block' => true,
				'dynamic'     => ['active' => true],
				'default'     => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit. Architecto modi vel repudiandae reiciendis, cupiditate quod voluptatibus, placeat ad assumenda molestiae alias quisquam', 'master-addons' ),
			]
		);

		$this->add_control(
			'ma_el_dual_heading_icon_show',
			[
				'label'        => esc_html__('Enable Icon', 'master-addons' ),
				'type'         => Controls_Manager::SWITCHER,
				'default'      => 'no',
				'return_value' => 'yes',
				'condition'    => [
					'ma_el_dual_heading_styles_preset' => '-style2',
				],
			]
		);

		$this->add_control(
			'ma_el_dual_heading_icon',
			[
				'label'            => esc_html__('Icon', 'master-addons' ),
				'description'      => esc_html__('Please choose an icon from the list.', 'master-addons' ),
				'type'             => Controls_Manager::ICONS,
				'fa4compatibility' => 'icon',
				'default'          => [
					'value'   => 'fab fa-elementor',
					'library' => 'brand',
				],
				'render_type' => 'template',
				'condition'   => [
					'ma_el_dual_heading_icon_show'     => 'yes',
					'ma_el_dual_heading_styles_preset' => '-style2',
				]
			]
		);

		$this->add_control(
			'title_html_tag',
			[
				'label'   => __('Heading Tag', 'master-addons' ),
				'type'    => Controls_Manager::CHOOSE,
				'options' => Helper::jltma_heading_tags(),
				'default' => 'h1',
			]
		);

		$this->end_controls_section();

		/*
			* Master Addons: Dual Heading First Part Styling Section
			*/
		$this->start_controls_section(
			'ma_el_dual_first_heading_styles',
			[
				'label' => esc_html__('First Heading', 'master-addons' ),
				'tab'   => Controls_Manager::TAB_STYLE
			]
		);

		$this->add_control(
			'ma_el_dual_heading_first_text_color',
			[
				'label'		=> esc_html__('Text Color', 'master-addons' ),
				'type'		=> Controls_Manager::COLOR,
				'default' => '#1fb5ac',
				'selectors'	=> [
					'{{WRAPPER}} .jltma-dual-heading .jltma-dual-heading-wrapper .jltma-dual-heading-title .jltma-first-heading, {{WRAPPER}} .jltma-section-title span'
					=> 'color: {{VALUE}};',
				],
			]
		);

		$this->add_control(
			'ma_el_dual_heading_first_bg_color',
			[
				'label'     => __('Background', 'master-addons' ),
				'type'      => Controls_Manager::COLOR,
				'default'   => '#704aff',
				'selectors' => [
					'{{WRAPPER}} .jltma-dual-heading .jltma-dual-heading-wrapper .jltma-dual-heading-title .jltma-first-heading, {{WRAPPER}} .jltma-sec-head-container .jltma-sec-head-style:after'
					=> 'background-color: {{VALUE}};',
				],
			]
		);

		// $this->add_responsive_control(
		// 	'ma_el_dual_first_heading_alignment',
		// 	[
		// 		'label'       => esc_html__('Alignment', 'master-addons' ),
		// 		'type'        => Controls_Manager::CHOOSE,
		// 		'label_block' => false,
		// 		'options'     => [
		// 			'left' => [
		// 				'title' => esc_html__('Left', 'master-addons' ),
		// 				'icon'  => 'eicon-text-align-left',
		// 			],
		// 			'center' => [
		// 				'title' => esc_html__('Center', 'master-addons' ),
		// 				'icon'  => 'eicon-text-align-center',
		// 			],
		// 			'right' => [
		// 				'title' => esc_html__('Right', 'master-addons' ),
		// 				'icon'  => 'eicon-text-align-right',
		// 			],
		// 		],
		// 		'default'   => 'center',
		// 		'selectors' => [
		// 			'{{WRAPPER}} .jltma-dual-heading-title' => 'text-align: {{VALUE}};',
		// 		],
		// 		'condition' 	=> [
		// 			'ma_el_dual_heading_styles_preset' => '-style2',
		// 		],
		// 	]
		// );

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'ma_el_dual_first_heading_typography',
				'global' => [
					'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
				],
				'selector' => '{{WRAPPER}} .jltma-dual-heading .jltma-dual-heading-wrapper .jltma-dual-heading-title  .jltma-first-heading,{{WRAPPER}} .jltma-section-title span',
			]
		);

		$this->add_responsive_control(
			'ma_el_dual_first_heading_padding',
			[
				'label'         => __('Padding', 'master-addons' ),
				'type'          => Controls_Manager::DIMENSIONS,
				'size_units'    => ['px', 'em', '%'],
				'selectors'     => [
					'{{WRAPPER}} .jltma-dual-heading .jltma-dual-heading-wrapper .jltma-dual-heading-title  .jltma-first-heading,{{WRAPPER}} .jltma-section-title span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
				],
			]
		);

		$this->add_responsive_control(
			'ma_el_dual_first_heading_margin',
			[
				'label'         => __('Margin', 'master-addons' ),
				'type'          => Controls_Manager::DIMENSIONS,
				'size_units'    => ['px', 'em', '%'],
				'selectors'     => [
					'{{WRAPPER}} .jltma-dual-heading .jltma-dual-heading-wrapper .jltma-dual-heading-title  .jltma-first-heading,{{WRAPPER}} .jltma-section-title span' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
				],
			]
		);

		$this->end_controls_section();

		/*
			* Master Addons: Dual Heading Second Part Styling Section
			*/
		$this->start_controls_section(
			'ma_el_dual_second_heading_styles',
			[
				'label' => esc_html__('Second Heading', 'master-addons' ),
				'tab'   => Controls_Manager::TAB_STYLE
			]
		);

		$this->add_control(
			'ma_el_dual_heading_second_text_color',
			[
				'label'		=> esc_html__('Text Color', 'master-addons' ),
				'type'		=> Controls_Manager::COLOR,
				'default' => '#132C47',
				'selectors'	=> [
					'{{WRAPPER}} .jltma-dual-heading .jltma-dual-heading-wrapper .jltma-dual-heading-title .jltma-second-heading,
						{{WRAPPER}} .jltma-section-title' =>
					'color: {{VALUE}};',
				],

			]
		);

		$this->add_control(
			'ma_el_dual_heading_second_bg_color',
			[
				'label'     => __('Background', 'master-addons' ),
				'type'      => Controls_Manager::COLOR,
				'selectors' => [
					'{{WRAPPER}} .jltma-dual-heading .jltma-dual-heading-wrapper .jltma-dual-heading-title .jltma-second-heading' =>
					'background-color: {{VALUE}};',
				],

				'condition' => [
					'ma_el_dual_heading_styles_preset' => '-style2',
				],
			]
		);

		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name'     => 'ma_el_dual_second_heading_typography',
				'global'   => [
					'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
				],
				'selector' =>
				'{{WRAPPER}} .jltma-dual-heading .jltma-dual-heading-wrapper .jltma-dual-heading-title .jltma-second-heading,                          {{WRAPPER}} .jltma-section-title',
			]
		);

		$this->add_responsive_control(
			'ma_el_dual_second_heading_padding',
			[
				'label'         => __('Padding', 'master-addons' ),
				'type'          => Controls_Manager::DIMENSIONS,
				'size_units'    => ['px', 'em', '%'],
				'selectors'     => [
					'{{WRAPPER}} .jltma-dual-heading .jltma-second-heading,
						{{WRAPPER}} .jltma-section-description' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
				],
			]
		);

		$this->add_responsive_control(
			'ma_el_dual_second_heading_margin',
			[
				'label'         => __('Margin', 'master-addons' ),
				'type'          => Controls_Manager::DIMENSIONS,
				'size_units'    => ['px', 'em', '%'],
				'selectors'     => [
					'{{WRAPPER}} .jltma-dual-heading .jltma-second-heading,
						{{WRAPPER}} .jltma-section-description' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
				],
			]
		);
		$this->end_controls_section();

		/*
				* Master Addons: Dual Heading description Styling Section
			*/
		$this->start_controls_section(
			'ma_el_dual_heading_description_styles',
			[
				'label' => esc_html__('Description', 'master-addons' ),
				'tab'   => Controls_Manager::TAB_STYLE
			]
		);

		// $this->add_responsive_control(
		// 	'ma_el_dual_desc_heading_alignment',
		// 	[
		// 		'label'       => esc_html__('Alignment', 'master-addons' ),
		// 		'type'        => Controls_Manager::CHOOSE,
		// 		'label_block' => false,
		// 		'options'     => [
		// 			'left' => [
		// 				'title' => esc_html__('Left', 'master-addons' ),
		// 				'icon'  => 'eicon-text-align-left',
		// 			],
		// 			'center' => [
		// 				'title' => esc_html__('Center', 'master-addons' ),
		// 				'icon'  => 'eicon-text-align-center',
		// 			],
		// 			'right' => [
		// 				'title' => esc_html__('Right', 'master-addons' ),
		// 				'icon'  => 'eicon-text-align-right',
		// 			],
		// 		],
		// 		'default'   => 'center',
		// 		'selectors' => [
		// 			'{{WRAPPER}} .jltma-dual-heading-description' => 'text-align: {{VALUE}};',
		// 		],
		// 		'condition' 	=> [
		// 			'ma_el_dual_heading_styles_preset' => '-style2',
		// 		],
		// 	]
		// );
		$this->add_control(
			'ma_el_dual_heading_description_text_color',
			[
				'label'		=> esc_html__('Text Color', 'master-addons' ),
				'type'		=> Controls_Manager::COLOR,
				'default' => '#989B9E',
				'selectors'	=> [
					'{{WRAPPER}} .jltma-dual-heading .jltma-dual-heading-wrapper .jltma-dual-heading-description,
						{{WRAPPER}} .jltma-section-description' =>
					'color: {{VALUE}};',
				],
			]
		);
		$this->add_group_control(
			Group_Control_Typography::get_type(),
			[
				'name' => 'ma_el_dual_heading_description_typography',
				'global' => [
					'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
				],
				'selector' => '{{WRAPPER}} .jltma-dual-heading .jltma-dual-heading-wrapper .jltma-dual-heading-description,
					{{WRAPPER}} .jltma-section-description',
			]
		);
		$this->add_responsive_control(
			'ma_el_dual_description_padding',
			[
				'label'         => __('Padding', 'master-addons' ),
				'type'          => Controls_Manager::DIMENSIONS,
				'size_units'    => ['px', 'em', '%'],
				'selectors'     => [
					'{{WRAPPER}} .jltma-dual-heading .jltma-dual-heading-description,
						{{WRAPPER}} .jltma-section-description' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
				],
			]
		);

		$this->add_responsive_control(
			'ma_el_dual_description_margin',
			[
				'label'         => __('Margin', 'master-addons' ),
				'type'          => Controls_Manager::DIMENSIONS,
				'size_units'    => ['px', 'em', '%'],
				'selectors'     => [
					'{{WRAPPER}} .jltma-dual-heading .jltma-dual-heading-description,
						{{WRAPPER}} .jltma-section-description' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
				],
			]
		);

		$this->end_controls_section();

		/*
			 * Master Addons: Icon Styling
			 */
		$this->start_controls_section(
			'ma_el_dual_heading_icon_style',
			[
				'label' => esc_html__('Icon Style', 'master-addons' ),
				'tab'   => Controls_Manager::TAB_STYLE,
				'condition' => [
					'ma_el_dual_heading_icon_show'     => 'yes',
					'ma_el_dual_heading_styles_preset' => '-style2'
				],
			]
		);

		$this->add_control(
			'ma_el_dual_heading_icon_size',
			[
				'label'   => __('Icon Size (px)', 'master-addons' ),
				'type'    => Controls_Manager::SLIDER,
				'default' => [
					'size' => 40,
				],
				'range' => [
					'px' => [
						'min' => 40,
						'max' => 500,
					],
				],
				'selectors' => [
					'{{WRAPPER}} .jltma-dual-heading-icon i' => 'font-size: {{SIZE}}{{UNIT}};',
					'{{WRAPPER}} .jltma-dual-heading-icon svg' => 'width: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$this->start_controls_tabs('ma_el_dual_heading_icon_style_tabs');

		$this->start_controls_tab('normal', ['label' => esc_html__('Normal', 'master-addons' )]);

		$this->add_control(
			'ma_el_dual_heading_icon_style_color',
			[
				'label'     => esc_html__('Icon Color', 'master-addons' ),
				'type'      => Controls_Manager::COLOR,
				'default'   => '#8c8c8c',
				'selectors' => [
					'{{WRAPPER}} .jltma-dual-heading-icon i' => 'color: {{VALUE}};',
					'{{WRAPPER}} .jltma-dual-heading-icon svg path' => 'color: {{VALUE}};'
				],
			]
		);

		$this->end_controls_tab();

		$this->start_controls_tab(
			'ma_el_dual_heading_icon_hover_color',
			[
				'label' => esc_html__('Hover', 'master-addons' )
			]
		);

		$this->add_control(
			'ma_el_dual_heading_icon_size_hover',
			[
				'label'   => __('Size', 'master-addons' ),
				'type'    => Controls_Manager::SLIDER,
				'default' => [
					'size' => 40,
				],
				'range' => [
					'px' => [
						'min' => 40,
						'max' => 500,
					],
				],
				'selectors' => [
					'{{WRAPPER}} .jltma-dual-heading-icon i:hover' => 'font-size: {{SIZE}}{{UNIT}};',
				],
			]
		);

		$this->add_control(
			'ma_el_dual_heading_icon_style_hover_text_color',
			[
				'label'     => esc_html__('Icon Color', 'master-addons' ),
				'type'      => Controls_Manager::COLOR,
				'default'   => '#8c8c8c',
				'selectors' => [
					'{{WRAPPER}} .jltma-dual-heading-icon i:hover'                               => 'color: {{VALUE}};'
				],
			]
		);
		$this->end_controls_tab();

		$this->end_controls_section();

		// Help Docs section (links from config.php)
		$this->jltma_help_docs();

		$this->upgrade_to_pro_message();
	}

	protected function render()
	{
		$settings = $this->get_settings_for_display();

?>

		<?php if ($settings['ma_el_dual_heading_styles_preset'] == '-style1') { ?>

			<div class="jltma-sec-head-container">
				<div class="jltma-sec-head-style">
					<<?php echo Utils::print_validated_html_tag( $settings['title_html_tag'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- print_validated_html_tag returns a whitelisted tag name ?> class="jltma-section-title"><span><?php echo esc_html($settings['ma_el_dual_first_heading']); ?></span><br><?php echo esc_html($settings['ma_el_dual_second_heading']); ?></<?php echo Utils::print_validated_html_tag( $settings['title_html_tag'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- print_validated_html_tag returns a whitelisted tag name ?>><!-- /.section-title -->

					<?php if ($settings['ma_el_dual_heading_description'] != "") : ?>
						<div class="jltma-section-description"><?php echo wp_kses_post($this->parse_text_editor($settings['ma_el_dual_heading_description'])); ?></div><!-- /.section-description -->
					<?php endif; ?>
				</div><!-- /.sec-head-style -->
			</div><!-- /.sec-head-container -->

		<?php } elseif ($settings['ma_el_dual_heading_styles_preset'] == '-style2') { ?>

			<div id="jltma-heading-<?php echo esc_attr($this->get_id()); ?>" class="jltma-dual-heading">
				<div class="jltma-dual-heading-wrapper">
					<?php if ($settings['ma_el_dual_heading_icon_show'] == 'yes') : ?>
						<span class="jltma-dual-heading-icon">
							<?php
                            $migrated = isset($settings['__fa4_migrated']['ma_el_dual_heading_icon']);
                            $is_new   = empty($settings['icon']) && \Elementor\Icons_Manager::is_migration_allowed();

                            if ($is_new || $migrated){
                                \Elementor\Icons_Manager::render_icon($settings['ma_el_dual_heading_icon'], ['aria-hidden' => 'true']);
                            } else { ?>
                                <i class="<?php echo esc_attr($settings['icon']); ?>" aria-hidden="true"></i>
                            <?php } ?>
						</span>
					<?php endif; ?>

					<<?php echo Utils::print_validated_html_tag( $settings['title_html_tag'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- print_validated_html_tag returns a whitelisted tag name ?> class="jltma-dual-heading-title">
						<?php if (isset($settings['ma_el_dual_heading_title_link']['url']) && $settings['ma_el_dual_heading_title_link']['url'] != "") {
							$this->add_link_attributes('ma_el_dual_heading_title_link', $settings['ma_el_dual_heading_title_link']); ?>
							<a <?php echo $this->get_render_attribute_string('ma_el_dual_heading_title_link'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Elementor get_render_attribute_string() returns safe HTML attributes ?>>
							<?php } ?>

							<span class="jltma-first-heading"><?php echo esc_html($this->parse_text_editor($settings['ma_el_dual_first_heading'])); ?></span><span class="jltma-second-heading"><?php echo esc_html($this->parse_text_editor($settings['ma_el_dual_second_heading'])); ?></span>

							<?php if (isset($settings['ma_el_dual_heading_title_link']['url']) && $settings['ma_el_dual_heading_title_link']['url'] != "") { ?>
							</a>
						<?php } ?>
					</<?php echo Utils::print_validated_html_tag( $settings['title_html_tag'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- print_validated_html_tag returns a whitelisted tag name ?>>

					<?php if ($settings['ma_el_dual_heading_description'] != "") : ?>
						<p class="jltma-dual-heading-description"><?php echo wp_kses_post($this->parse_text_editor($settings['ma_el_dual_heading_description'])); ?></p>
					<?php endif; ?>
				</div>
			</div>

		<?php } ?>

	<?php
	}

	protected function content_template()
	{ ?>

		<# if ( '-style1'==settings.ma_el_dual_heading_styles_preset ) { #>

			<# var dhTitleTag = settings.title_html_tag || 'h2'; #>
			<div class="jltma-sec-head-container">
				<div class="jltma-sec-head-style">
					<{{ dhTitleTag }} class="jltma-section-title"><span>{{{ settings.ma_el_dual_first_heading }}}</span><br>{{{ settings.ma_el_dual_second_heading }}}</{{ dhTitleTag }}><!-- /.section-title -->

					<# if ( settings.ma_el_dual_heading_description !== '' ) { #>
						<div class="jltma-section-description">{{{ settings.ma_el_dual_heading_description }}}</div><!-- /.section-description -->
					<# } #>
				</div><!-- /.sec-head-style -->
			</div><!-- /.sec-head-container -->

			<# } else{ #>

				<div id="jltma-heading" class="jltma-dual-heading">
					<div class="jltma-dual-heading-wrapper">
						<# if ( settings.ma_el_dual_heading_icon_show=='yes' ) { #>
							<span class="jltma-dual-heading-icon"><i class="{{ settings.ma_el_dual_heading_icon.value }}"></i></span>
							<# } #>
								<# var dhTitleTag = settings.title_html_tag || 'h1'; #>
								<{{ dhTitleTag }} class="jltma-dual-heading-title">
									<#
										var dhLink = settings.ma_el_dual_heading_title_link || {};
										var dhAttrs = '';
										if ( dhLink.is_external ) { dhAttrs += ' target="_blank"'; }
										if ( dhLink.nofollow ) { dhAttrs += ' rel="nofollow"'; }
										if ( dhLink.custom_attributes ) {
											dhLink.custom_attributes.split( ',' ).forEach( function( pair ) {
												var kv = pair.split( '|' );
												var key = ( kv[0] || '' ).trim().replace( /[^a-zA-Z0-9_-]/g, '' );
												var val = ( kv[1] || '' ).trim();
												if ( key ) { dhAttrs += ' ' + key + '="' + val + '"'; }
											} );
										}
									#>
									<# if ( dhLink.url ) { #>
										<a href="{{ dhLink.url }}"{{{ dhAttrs }}}>
									<# } #>
										<span class="jltma-first-heading">{{{ settings.ma_el_dual_first_heading }}}</span><span class="jltma-second-heading">{{{ settings.ma_el_dual_second_heading }}}</span>
									<# if ( dhLink.url ) { #>
										</a>
									<# } #>
								</{{ dhTitleTag }}>
								<# if ( settings.ma_el_dual_heading_description !="" ) { #>
									<p class="jltma-dual-heading-description">{{{ settings.ma_el_dual_heading_description }}}</p>
									<# } #>
					</div>
				</div>
				<# } #>

			<?php
		}
	}
