<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use Prodigy\Includes\Helpers\Prodigy_Template;

$params = $params ?? array();
$result = array_merge( $params, array( 'as_panel' => false ) );
$logo_block_uid           = $result['uid'] ?? $params['uid'] ?? '';
$logo_block_template_args = function ( int $mlc_block_index ) use ( $result, $logo_block_uid ) {
	return array_merge(
		array( 'args' => array_merge( $result, array( 'mlc_block_index' => $mlc_block_index ) ) ),
		array( 'uid' => $logo_block_uid )
	);
};

$show_switcher = ! empty( $params['is_logo_tool_multiple_locations'] );
?>

<?php if ( ! empty( $params['is_enable_logo'] ) ) : ?>
	<div class="prodigy-logo-tool logo-container-js">
		<div class="prodigy-logo-tool__container opened">
			<?php Prodigy_Template::prodigy_get_template( 'single-product/logo/logo-block.php', $logo_block_template_args( 0 ) ); ?>
		</div>
		<div class="prodigy-logo-tool__container container-js closed">
			<?php if ( $show_switcher ) : ?>
				<?php Prodigy_Template::prodigy_get_template( 'single-product/logo/logo-switcher.php', $params['settings'] ); ?>
			<?php endif; ?>
			<?php Prodigy_Template::prodigy_get_template( 'single-product/logo/logo-block.php', $logo_block_template_args( 1 ) ); ?>
		</div>
		<template id="logo-form-template" aria-hidden="true">
			<div class="prodigy-logo-tool__container container-js closed">
				<?php if ( $show_switcher ) : ?>
					<?php Prodigy_Template::prodigy_get_template( 'single-product/logo/logo-switcher.php', $params['settings'] ); ?>
				<?php endif; ?>
				<?php Prodigy_Template::prodigy_get_template( 'single-product/logo/logo-block.php', $logo_block_template_args( 2 ) ); ?>
			</div>
		</template>
	</div>
<?php endif; ?>
