<commit_before><style>
	.menubar {
		height: 24px;
		background-color: #eee;
		list-style: none;
		margin: 0;
		padding: 0 4px;
		border-bottom: 1px solid rgba(0,0,0,0.25);
		box-sizing: border-box;
	}

	.menubar .shortcut,
	.menubar [data-shortcut]+span {
		display: inline-block;
		padding-left: 8px;
		color: #57A700;
	}

	.menubar * {
		box-sizing: border-box;
		transition: 0.1s;
	}

	.menubar li {
		position: relative;
		cursor: default;
		margin: 0;
		padding: 2px 8px;
		display: inline-block;
		height: 24px;
		line-height: 20px;
		white-space: nowrap;
		min-width: 40px;
	}

	.menubar li.open {
		background-color: #BCED85;
	}

	.menubar li:active {
		background-color: #7ED321;
	}

	.menubar ul {
		position: absolute;
		padding: 0;
		margin: 0 -8px;
		top: 23px;
		background-color: white;
		border: 1px solid rgba(0,0,0,0.25);
		display: flex;
		flex-direction: column;
		display: none;
		box-shadow: 1px 3px 4px 0 rgba(0,0,0,0.5);
		opacity: 0;
	}

	.menubar ul ul {
		z-index: 1;
		left: 40px;
	}

	.menubar li.open > ul {
		display: block;
		opacity: 1.0;
	}

	.menubar li.separator {
		background-color: rgba(0,0,0,0.25);
		height: 1px;
		padding: 0;
		margin: 4px 0;
	}

	.menubar ul li {
		display: flex;
	}

	.menubar ul li > *:first-child {
		flex-grow: 1;
	}

	.menubar ul li > *:not(:first-child) {
		margin-left: 8px;
	}
</style>
<script>
	component.classList.add('menubar');
	b8r.on(component, ['mouseup', 'keydown(Space)'], 'menubar', 'action');
	b8r.on(component, ['focus', 'mouseover', 'mousedown'], 'menubar', 'open');
	b8r.on(component, ['blur', 'keydown(Escape)'], 'menubar', 'close');

	const add_shortcut_span = elt => {
		var caption = elt.getAttribute('data-shortcut').split('-');
		caption.forEach((s, i) => {
			caption[i] = b8r.modifierKeys[s] || s.replace(/Key|Digit/, '');
		});
		caption = caption.join('');
		const span = b8r.create('span');
		span.textContent = caption;
		elt.parentElement.appendChild(span);
	}

	find('[data-shortcut').forEach(add_shortcut_span);

	find('[data-event]').forEach(elt => {
		var handler_def = elt.getAttribute('data-event');
		if (elt.getAttribute('data-shortcut')) {
			handler_def = handler_def.replace(/\bmenuclick\b([^:]*):/, 'shortcut,click,keydown(Space)\1:');
		} else {
			handler_def = handler_def.replace(/\bmenuclick\b([^:]*):/, 'click,keydown(Space)\1:');
		}
		if (elt.matches('li')) {
			elt.setAttribute('data-event', handler_def);
		} else {
			elt.closest('li').setAttribute('data-event', handler_def);
			elt.removeAttribute('data-event');
		}
	});

	// keyboard navigation
	b8r.makeArray(component.querySelectorAll('li:not(.separator)')).forEach(elt => elt.setAttribute('tabindex', 0));

	require('shortcuts.js').setup();

	function close_all_menus() {
		b8r.off(document.body, 'mousedown', 'menubar', 'close');
		b8r.find('.menubar.open,.menubar .open').forEach(elt => elt.classList.remove('open'));
	}

	b8r.register('menubar', {
		action(evt){
			if(!evt.target.matches('.menubar') && !evt.target.parentElement.matches('.menubar')) {
				close_all_menus();
			}
		},
		open(evt){<commit_msg>dragging to activate menu was broken<commit_after><style>
	.menubar {
		height: 24px;
		background-color: #eee;
		list-style: none;
		margin: 0;
		padding: 0 4px;
		border-bottom: 1px solid rgba(0,0,0,0.25);
		box-sizing: border-box;
	}

	.menubar .shortcut,
	.menubar [data-shortcut]+span {
		display: inline-block;
		padding-left: 8px;
		color: #57A700;
	}

	.menubar * {
		box-sizing: border-box;
		transition: 0.1s;
	}

	.menubar li {
		position: relative;
		cursor: default;
		margin: 0;
		padding: 2px 8px;
		display: inline-block;
		height: 24px;
		line-height: 20px;
		white-space: nowrap;
		min-width: 40px;
	}

	.menubar li.open {
		background-color: #BCED85;
	}

	.menubar li:active {
		background-color: #7ED321;
	}

	.menubar ul {
		position: absolute;
		padding: 0;
		margin: 0 -8px;
		top: 23px;
		background-color: white;
		border: 1px solid rgba(0,0,0,0.25);
		display: flex;
		flex-direction: column;
		display: none;
		box-shadow: 1px 3px 4px 0 rgba(0,0,0,0.5);
		opacity: 0;
	}

	.menubar ul ul {
		z-index: 1;
		left: 40px;
	}

	.menubar li.open > ul {
		display: block;
		opacity: 1.0;
	}

	.menubar li.separator {
		background-color: rgba(0,0,0,0.25);
		height: 1px;
		padding: 0;
		margin: 4px 0;
	}

	.menubar ul li {
		display: flex;
	}

	.menubar ul li > *:first-child {
		flex-grow: 1;
	}

	.menubar ul li > *:not(:first-child) {
		margin-left: 8px;
	}
</style>
<script>
	component.classList.add('menubar');
	b8r.on(component, ['mouseup', 'keydown(Space)'], 'menubar', 'action');
	b8r.on(component, ['focus', 'mouseover', 'mousedown'], 'menubar', 'open');
	b8r.on(component, ['blur', 'keydown(Escape)'], 'menubar', 'close');

	const add_shortcut_span = elt => {
		var caption = elt.getAttribute('data-shortcut').split('-');
		caption.forEach((s, i) => {
			caption[i] = b8r.modifierKeys[s] || s.replace(/Key|Digit/, '');
		});
		caption = caption.join('');
		const span = b8r.create('span');
		span.textContent = caption;
		elt.parentElement.appendChild(span);
	}

	find('[data-shortcut').forEach(add_shortcut_span);

	find('[data-event]').forEach(elt => {
		var handler_def = elt.getAttribute('data-event');
		if (elt.getAttribute('data-shortcut')) {
			handler_def = handler_def.replace(/\bmenuclick\b([^:]*):/, 'shortcut,mouseup,keydown(Space)\1:');
		} else {
			handler_def = handler_def.replace(/\bmenuclick\b([^:]*):/, 'mouseup,keydown(Space)\1:');
		}
		if (elt.matches('li')) {
			elt.setAttribute('data-event', handler_def);
		} else {
			elt.closest('li').setAttribute('data-event', handler_def);
			elt.removeAttribute('data-event');
		}
	});

	// keyboard navigation
	b8r.makeArray(component.querySelectorAll('li:not(.separator)')).forEach(elt => elt.setAttribute('tabindex', 0));

	require('shortcuts.js').setup();

	function close_all_menus() {
		b8r.off(document.body, 'mousedown', 'menubar', 'close');
		b8r.find('.menubar.open,.menubar .open').forEach(elt => elt.classList.remove('open'));
	}

	b8r.register('menubar', {
		action(evt){
			if(!evt.target.matches('.menubar') && !evt.target.parentElement.matches('.menubar')) {
				close_all_menus();
			}
		},
		open(evt){
{'fraction_non_alphanumeric': 0.19461897857257934, 'fraction_numerical': 0.027710649266956662, 'mean_word_length': 3.934817170111288, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4990451', 'n_tokens_mistral': 2815, 'n_tokens_neox': 2508, 'n_words': 438}