/**
 * Public tabs nav runtime (burger menu close-on-select).
 * Tiny custom JS — no library. Enqueued only when a tabs block is present.
 * WordPress prints this handle at most once per page.
 */
import { initBmTabsNav } from '../shared/bmTabsNav';

let booted = false;

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

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

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