mixin switch_tab(name, title, checked=false)
	- let button_id = `switch-tab-${name}-button`
	input(checked=checked type="radio" name="switch-tab-button" id=button_id)
	label(for=button_id) #{title}
	.tab
		block


mixin color_slider_tr(name, title)
	tr
		td(style="white-space: nowrap") #{title}:
		td #[input(type="color" id=`switch-color-${name}-input`)]
		td #[input(type="range" id=`switch-color-${name}-brightness-slider` style="min-width: 150px")]
		td &nbsp;&nbsp;&nbsp;
		td #[button(id=`switch-color-${name}-default-button` class="small" title="Reset default") &#8635;]


.window#switch-window(style="width: min-content")
	.window-header
		.window-grab Switch settings
		button.window-button-close #[b &times;]

	.tabs-box
		+switch_tab("edid", "EDIDs collection", true)
			table
				tr
					td(colspan="2")
						select#switch-edid-selector(
							size="8"
							style="width: -webkit-fill-available; width: -moz-available;"
						)
					td(rowspan="2" style="vertical-align: top")
						table.kv
							tr
								td Manufacturer:
								td.value#switch-edid-info-mfc-id
							tr
								td Product ID:
								td.value#switch-edid-info-product-id
							tr
								td Serial:
								td.value#switch-edid-info-serial
							tr
								td Monitor name:
								td.value#switch-edid-info-monitor-name
							tr
								td Extra serial:
								td.value#switch-edid-info-monitor-serial
							tr
								td Audio enabled:
								td.value#switch-edid-info-audio
							tr
								td Data:
								td #[button.small#switch-edid-copy-data-button(disabled) Copy]
				tr
					td #[button#switch-edid-add-button Add new]
					td(style="float: right") #[button#switch-edid-remove-button(disabled) Remove]

		+switch_tab("colors", "Color scheme")
			table
				+color_slider_tr("active", "Selected port")
				+color_slider_tr("inactive", "Inactive port")
				+color_slider_tr("beacon", "Blinking beacon")
				tr
					td #[hr]
					td #[hr]
					td #[hr]
					td
					td #[hr]
				+color_slider_tr("flashing", "Flashing downlink")
				+color_slider_tr("bootloader", "Bootloader mode")
