/* global wp */
import { Base } from './customizer.js';
import { BaseControl } from './base/control.js';
import { ColorControl } from './color/control.js';
import { PaletteControl } from './palette/control.js';
import { RangeControl } from './range/control.js';
import { SwitchControl } from './switch/control.js';
import { RadioIconControl } from './radio-icon/control.js';
import { MultiRadioIconControl } from './multi-radio-icon/control.js';
import { BuilderControl } from './layout-builder/control.js';
import { AvailableControl } from './available/control.js';
import { BackgroundControl } from './background/control.js';
import { BorderControl } from './border/control.js';
import { BordersControl } from './borders/control.js';
import { TypographyControl } from './typography/control.js';
import { TitleControl } from './title/control.js';
import { FocusButtonControl } from './focus-button/control.js';
import { ColorLinkControl } from './color-link/control.js';
import { TextControl } from './text/control.js';
import { MeasureControl } from './measure/control.js';
import { EditorControl } from './editor/control.js';
import { SocialControl } from './social/control.js';
import { ContactControl } from './contact/control.js';
import { CheckIconControl } from './check-icon/control.js';
import { SelectControl } from './select/control.js';
import { SorterControl } from './sorter/control.js';
import { RowControl } from './row-layout/control.js';
import { TabsControl } from './tabs/control.js';
import { BoxShadowControl } from './boxshadow/control.js';

wp.customize.controlConstructor.code4rest_shadow_control = BoxShadowControl;
wp.customize.controlConstructor.code4rest_tab_control = TabsControl;
wp.customize.controlConstructor.code4rest_borders_control = BordersControl;
wp.customize.controlConstructor.code4rest_row_control = RowControl;
wp.customize.controlConstructor.code4rest_sorter_control = SorterControl;
wp.customize.controlConstructor.code4rest_select_control = SelectControl;
wp.customize.controlConstructor.code4rest_check_icon_control = CheckIconControl;
wp.customize.controlConstructor.code4rest_contact_control = ContactControl;
wp.customize.controlConstructor.code4rest_social_control = SocialControl;
wp.customize.controlConstructor.code4rest_editor_control = EditorControl;
wp.customize.controlConstructor.code4rest_measure_control = MeasureControl;
wp.customize.controlConstructor.code4rest_text_control = TextControl;
wp.customize.controlConstructor.code4rest_color_link_control = ColorLinkControl;
wp.customize.controlConstructor.code4rest_focus_button_control = FocusButtonControl;
wp.customize.controlConstructor.code4rest_title_control = TitleControl;
wp.customize.controlConstructor.code4rest_typography_control = TypographyControl;
wp.customize.controlConstructor.code4rest_border_control = BorderControl;
wp.customize.controlConstructor.code4rest_background_control = BackgroundControl;
wp.customize.controlConstructor.code4rest_color_palette_control = PaletteControl;
wp.customize.controlConstructor.code4rest_available_control = AvailableControl;
wp.customize.controlConstructor.code4rest_builder_control = BuilderControl;
wp.customize.controlConstructor.code4rest_color_control = ColorControl;
wp.customize.controlConstructor.code4rest_range_control = RangeControl;
wp.customize.controlConstructor.code4rest_switch_control = SwitchControl;
wp.customize.controlConstructor.code4rest_radio_icon_control = RadioIconControl;
wp.customize.controlConstructor.code4rest_multi_radio_icon_control = MultiRadioIconControl;

window.addEventListener( 'load', () => {
	let deviceButtons = document.querySelector('#customize-footer-actions .devices' );
	deviceButtons.addEventListener( 'click', function(e) {
		let event = new CustomEvent( 'code4restChangedRepsonsivePreview', {
			'detail': e.target.dataset.device
		} );
		document.dispatchEvent( event );
	} );
} );