const AUTOPLAY_INTERVAL_IN_SECONDS = 5

document.addEventListener('DOMContentLoaded', () => {
	document.querySelectorAll(".pinewood_pro__hero_slider.glide").forEach(el => {
		const enableAutoplay = el.dataset.autoplay === "1"
		const autoplayInterval = isNaN(parseInt(el.dataset.delay)) ? AUTOPLAY_INTERVAL_IN_SECONDS : parseInt(el.dataset.delay)
		const pauseOnHover = el.dataset.pauseOnHover === "1"

		new Glide(el, {
			type: "carousel",
			autoplay: enableAutoplay ? (autoplayInterval * 1000) : false,
			hoverpause: pauseOnHover,
			rewind: true,
			perView: 1,
		}).mount()
	})
});