"use strict";

// Import dependencies
import("/js/core.js").then(() =>
	import("/js/damper.js").then(() => {
		const dependencies = setInterval(() => {
			if (
				typeof core === "function" &&
				typeof core.damper === "function"
			) {
				clearInterval(dependencies);
				clearTimeout(timeout);
				initialization();
			}
		}, 10);
		const timeout = setTimeout(() => {
			clearInterval(dependencies);
			initialization();
		}, 5000);

		function initialization() {
			if (typeof core.cart === "undefined") {
				// Not initialized

				// Write to the core
				core.cart = class cart {
					/**
					 * Products in cart ["product/148181", "product/148181", "product/148181"...]
					 */
					static cart = [];
				};
			}
		}
	})
);
