(function(){
	// Simple readiness flag once all component constructors are present
	function allReady(){
		return !!(window.PrimaryNodeComponent && window.ClusterMembersComponent && window.NodeDetailsComponent && window.FirmwareComponent && window.FirmwareFormComponent && window.ClusterViewComponent && window.FirmwareViewComponent && window.TopologyGraphComponent && window.MemberCardOverlayComponent && window.ClusterStatusComponent && window.DrawerComponent && window.WiFiConfigComponent);
	}
	window.waitForComponentsReady = function(timeoutMs = 5000){
		return new Promise((resolve, reject) => {
			const start = Date.now();
			(function check(){
				if (allReady()) return resolve(true);
				if (Date.now() - start > timeoutMs) return reject(new Error('Components did not load in time'));
				setTimeout(check, 25);
			})();
		});
	};
})(); 