<?php

defined( 'ABSPATH' ) || exit; // Exit if accessed directly.

class Safelayout_ribbon_elementor_control extends \Elementor\Base_Data_Control {

	public function get_type(): string {
		return 'Safelayout_ribbon_control';
	}

	public function get_default_value(): string {
		return '<div class="safelayout-ei-ribbon-block" style="filter: drop-shadow(rgb(0, 0, 0) 0px 1px 1px);"><div class="sl-ei-ribbon-block-effect001 sl-ei-ribbon-block-effect001-" style="font-weight: bold; --sl-ei-box-ribbon-text-color: #00f; --sl-ei-box-ribbon-background-color: linear-gradient(0deg, #fff2c6 0%, #FF8D28 100%); --sl-ei-box-ribbon-pattern-opacity: 0.2; --sl-ei-box-ribbon-pos-offset: 0px; --sl-ei-box-ribbon-effect-border-color: #00f; font-size: 16px;"><span class="sl-ei-ribbon-block-effect-border001"></span><div>Ribbon</div></div><style type="text/css" data-no-optimize="1" data-no-minify="1">.sl-ei-ribbon-block-effect001{background:var(--sl-ei-box-ribbon-background-color);clip-path:polygon(-15px 0, calc(100% + 15px) 0, calc(100% + 15px) calc(100% - 45px), -15px 100%);color:var(--sl-ei-box-ribbon-text-color);display:inline-block;font-size:24px;left:var(--sl-ei-box-ribbon-pos-offset);line-height:1.5;margin:0 12px 5px;min-width:20px;padding:20px 10px 50px;pointer-events:auto !important;position:absolute;top:-12px;z-index:1}.sl-ei-ribbon-block-effect001:after,.sl-ei-ribbon-block-effect001:before{background:var(--sl-ei-box-ribbon-background-color);clip-path:polygon(100% 0, 100% 100%, 0 100%);content:"";filter:brightness(.6);height:12px;left:-12px;position:absolute;top:0;width:12px}.sl-ei-ribbon-block-effect001:after{clip-path:polygon(0 0, 100% 100%, 0 100%);left:auto;right:-12px}.sl-ei-ribbon-block-effect001-right{left:auto;right:var(--sl-ei-box-ribbon-pos-offset)}.sl-ei-ribbon-block-effect001-center{left:calc(50% + var(--sl-ei-box-ribbon-pos-offset));transform:translateX(-50%)}.sl-ei-ribbon-block-effect-border001:after{border:1px dashed var(--sl-ei-box-ribbon-effect-border-color) !important;border-radius:inherit;bottom:0;content:"";display:inherit;left:0;position:absolute;right:0;top:0}.sl-ei-ribbon-block-effect-border001:after{left:3px;right:3px;top:-3px}</style></div>attsafelayoutatt4attsafelayoutatt%7B%22key%22%3A4%2C%22content%22%3A%22Ribbon%22%2C%22align%22%3A%22%22%2C%22textColor%22%3A%22%2300f%22%2C%22bgColor%22%3A%22linear-gradient(0deg%2C%20%23fff2c6%200%25%2C%20%23FF8D28%20100%25)%22%2C%22bold%22%3Atrue%2C%22italic%22%3Afalse%2C%22uppercase%22%3Afalse%2C%22fontSize%22%3A%2216px%22%2C%22lineHeight%22%3A%221.5%22%2C%22letterSpacing%22%3A%220px%22%2C%22posOffset%22%3A0%2C%22hasBgShadow%22%3Atrue%2C%22bgShadow%22%3A%220px%201px%201px%20%23000%22%2C%22hasTextShadow%22%3Afalse%2C%22textShadow%22%3A%221px%201px%202px%20%23fff%22%2C%22blockMargin%22%3A%7B%7D%2C%22blockPadding%22%3A%7B%7D%2C%22bgPattern%22%3A%22No%20Pattern%22%2C%22patternOpacity%22%3A0.2%2C%22effect%22%3A%22effect001%22%2C%22hasEffectBorder%22%3Atrue%2C%22effectBorderColor%22%3A%22%2300f%22%2C%22classes%22%3A%22%22%7D';
	}

	public function enqueue(): void {
		wp_register_script(
			'safelayout-ribbon-elementor-control',
			SAFELAYOUT_ICONS_URL . 'elementor/safelayout_ribbon.js',
			array(),
			SAFELAYOUT_ICONS_VERSION,
			array(
				'in_footer' => false,
			)
		);
		wp_enqueue_script( 'safelayout-ribbon-elementor-control' );
	}

	public function content_template(): void {
		?>
			<div id="sl-ei-ribbon-elementor-body"></div>
			<input type="hidden" id="sl-ei-ribbon-elementor-value" data-setting="{{ data.name }}" />
		<?php
	}

}