/**
 * Public accordion exclusive-open runtime.
 * Enqueued when an accordion block is present.
 */
import { initBmAccordion } from '../shared/bmAccordion';

let booted = false;

function boot() {
	if ( booted ) {
		return;
	}
	booted = true;
	initBmAccordion( document );
}

if ( typeof window !== 'undefined' ) {
	window.jocbmAccordion = {
		...( window.jocbmAccordion || {} ),
		init: initBmAccordion,
	};

	if ( document.readyState === 'loading' ) {
		document.addEventListener( 'DOMContentLoaded', boot, { once: true } );
	} else {
		boot();
	}
}
