/*!
 * OpenUI5
 * (c) Copyright 2026 SAP SE or an SAP affiliate company.
 * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
 */
(function (window) {
	"use strict";
	var Core;
	var Lib;

	//initialize the loader
	function boot() {
		if (window.sap.ui.require("sap/ui/core/Core") && window.sap.ui.require("sap/ui/core/Lib")) {
			Core = window.sap.ui.require("sap/ui/core/Core");
			Lib = window.sap.ui.require("sap/ui/core/Lib");
			initTags();
			return;
		}

		window.sap.ui.require(["sap/ui/core/Core", "sap/ui/core/Lib"],
			function (_Core, _Lib) {
				Core = _Core;
				Lib = _Lib;

				/**
				 * @deprecated As of version 1.120
				 */
				Core.boot();

				Core.ready().then(initTags);
			});
	}

	function registerLibraryTags(oIntegrationLib) {
		const mCustomElements = oIntegrationLib.extensions?.["sap.ui.integration"]?.customElements;

		if (!mCustomElements) {
			return;
		}

		//collect all the implementation classes and require them
		window.sap.ui.require(Object.values(mCustomElements));
	}

	function initTags() {
		Lib.load({ name: "sap.ui.integration" })
			.then(function (oIntegrationLib) {
				//register the tags for this library
				registerLibraryTags(oIntegrationLib);
			});
	}

	boot();
})(window);