{%- set classes = settings.classes | merge( [ base_styles.base ] ) | join(' ') | trim %}
{%- set id_attribute = settings._cssid is not empty ? 'id=' ~ settings._cssid | e('html_attr') : '' %}
{%- set interactions_attribute = interactions is not empty ? 'data-interactions=' ~ interactions | json_encode | e('html_attr') : '' %}
{%- set required_attribute = settings.required ? 'required' : '' %}
{%- set multiple_attribute = settings.multiple ? 'multiple' : '' %}
{%- set accept_attribute = settings['file-types'] is not empty ? 'accept=' ~ settings['file-types'] | e('html_attr') : '' %}
{%- set name = settings.name is not empty ? settings.name : settings._cssid is not empty ? settings._cssid : id %}
{%- set name_attribute = settings.multiple ? 'name=' ~ ( name ~ '[]' ) | e('html_attr') : 'name=' ~ name | e('html_attr') %}
{% set conditions_enabled = settings.cfef_logic|default(false) %}
{% set field_group_class = 'elementor-field-group elementor-field-group-' ~ name ~ ' cfef-atomic-field-group' %}

{% if conditions_enabled %}
<div class="{{ field_group_class | e('html_attr') }}" data-field-id="{{ name | e('html_attr') }}">
{% endif %}
<input
	{{ id_attribute }}
	{{ name_attribute }}
	class="{{ classes }}"
	type="file"
	data-interaction-id="{{ interaction_id | default(id) }}"
	data-max-file-size="{{ settings['max-file-size'] }}"
	data-max-files="{{ settings['max-files'] }}"
	data-attachment-type="{{ settings['attachment-type'] | e('html_attr') }}"
	{{ settings.attributes | raw }}
	{{ interactions_attribute }}
	{{ accept_attribute | raw }}
	{{ required_attribute }}
	{{ multiple_attribute }}
/>

{% if conditions_enabled %}
{% set logic_data_json = settings.cfef_logic_repeater is not empty ? settings.cfef_logic_repeater : '[]' %}
{% set safe_field_key = name|replace({'\\':'\\\\','"':'\\"'}) %}
<template class="cfef_logic_data_js cfef-atomic-field-logic cfef-hidden" data-field-id="{{ name | e('html_attr') }}">
{"{{ safe_field_key }}":{"display_mode":"{{ settings.cfef_logic_mode|default('show') | e('js') }}","fire_action":"{{ settings.cfef_logic_meet|default('All') | e('js') }}","logic_data":{{ logic_data_json | raw }}}}
</template>
</div>
{% endif %}
