function scrollQue() { var r, n, a, o = {}, s = 0, l = !0, c = !0, d = !1, t = !1, i = { duration: 600, interval: -0.7, percentage: 0.75, enable: !0, docSlider: !1, pageChangeReset: !1, }, o = { setEvents: function (e) { function t() { l && (requestAnimationFrame(function () { (l = !0), c && (o.setQuery(), o.runQuery()); }), (l = !1)); } if ( (c && !e && window.addEventListener("load", o.runQuery), window.addEventListener("scroll", t), d) ) { e = docSlider.getElements().pages; for (var i = 0; i < e.length; i++) e[i].addEventListener("scroll", function (e) { if ( docSlider.getCurrentIndex() + "" !== (e = e.target.getAttribute("data-ds-index")) ) return !1; docSlider._getWheelEnable() && t(); }); } window.addEventListener("resize", function () { 0 < s && clearTimeout(s), (s = setTimeout(function () { c && (o.searchElements(), o.setQuery(), o.runQuery()); }, 200)); }); }, setOptions: function (t, i) { var s = {}; if (void 0 !== t) return ( Object.keys(t).forEach(function (e) { "[object Object]" === Object.prototype.toString.call(t[e]) ? (s[e] = o.setOptions(t[e], i[e])) : ((s[e] = t[e]), void 0 !== i && void 0 !== i[e] && (s[e] = i[e])); }), s ); }, searchElements: function () { r = []; for ( var e = document.querySelectorAll("[data-cues]:not([data-disabled])"), t = 0; t < e.length; t++ ) { for (var i = e[t], s = 0; s < i.children.length; s++) { var n = i.children[s]; o.setAttrPtoC(n, "data-cue", i, "data-cues", ""), o.setAttrPtoC(n, "data-duration", i, "data-duration", !1), o.setAttrPtoC(n, "data-interval", i, "data-interval", !1), o.setAttrPtoC(n, "data-sort", i, "data-sort", !1), o.setAttrPtoC(n, "data-addClass", i, "data-addClass", !1), o.setAttrPtoC(n, "data-group", i, "data-group", !1), o.setAttrPtoC(n, "data-delay", i, "data-delay", !1); } i.setAttribute("data-disabled", "true"); } for ( e = document.querySelectorAll('[data-cue]:not([data-show="true"])'), t = 0; t < e.length; t++ ) (i = e[t]), r.push({ elm: i, cue: o.getAttr(i, "data-cue", "fadeIn"), duration: Number(o.getAttr(i, "data-duration", a.duration)), interval: Number(o.getAttr(i, "data-interval", a.interval)), order: o.getOrderNumber(i), sort: o.getAttr(i, "data-sort", null), addClass: o.getAttr(i, "data-addClass", null), group: o.getAttr(i, "data-group", null), delay: Number(o.getAttr(i, "data-delay", 0)), }); if (d) for (e = docSlider.getElements().pages.length, t = 0; t < e; t++) for ( i = document.querySelectorAll( '[data-ds-index="' + t + '"] [data-cue]:not([data-scpage])' ), s = 0; s < i.length; s++ ) i[s].setAttribute("data-scpage", t); }, sortElements: function () { for ( var e = arguments[0], r = [].slice.call(arguments).slice(1), t = { $jscomp$loop$prop$i$4: 0 }; t.$jscomp$loop$prop$i$4 < r.length; (t = { $jscomp$loop$prop$i$4: t.$jscomp$loop$prop$i$4 }) .$jscomp$loop$prop$i$4++ ) e.sort( (function (n) { return function (e, t) { var i = void 0 === r[n.$jscomp$loop$prop$i$4][1] || r[n.$jscomp$loop$prop$i$4][1], s = r[n.$jscomp$loop$prop$i$4][0]; return e[s] > t[s] ? i ? 1 : -1 : e[s] < t[s] ? i ? -1 : 1 : 0; }; })(t) ); }, randElements: function (e) { for (var t = e.length - 1; 0 < t; t--) { var i = Math.floor(Math.random() * (t + 1)), s = e[t]; (e[t] = e[i]), (e[i] = s); } return e; }, setDurationValue: function (e, t, i) { return void 0 !== t && ((t = t.duration), (e = -1 === (i + "").indexOf(".") ? e + t + i : e + t + t * i) < 0) ? 0 : e; }, getOrderNumber: function (e) { return e.hasAttribute("data-order") ? 0 <= (e = Number(e.getAttribute("data-order"))) ? e : Math.pow(2, 53) - 1 + e : Math.pow(2, 52) - 1; }, setAttrPtoC: function (e, t, i, s, n) { i.hasAttribute(s) ? e.hasAttribute(t) || e.setAttribute(t, i.getAttribute(s)) : !1 !== n && e.setAttribute(t, n); }, getAttr: function (e, t, i) { return e.hasAttribute(t) ? e.getAttribute(t) : i; }, getOffsetTop: function (e) { return ( e.getBoundingClientRect().top + (window.pageYOffset || document.documentElement.scrollTop) ); }, setClassNames: function (e, t) { if (t) { t = t.split(" "); for (var i = 0; i < t.length; i++) e.classList.add(t[i]); } }, setQuery: function () { n = {}; for (var e = 0; e < r.length; e++) { var t = r[e], i = t.group || "$" + o.getOffsetTop(t.elm); if (!t.elm.hasAttribute("data-show")) { if (d) { var s = t.elm.getAttribute("data-scpage"); if (s !== docSlider.getCurrentIndex() + "" && null !== s) continue; } void 0 === n[i] && (n[i] = []), n[i].push(t); } } }, runQuery: function () { for ( var e = Object.keys(n), t = {}, i = 0; i < e.length; t = { $jscomp$loop$prop$elms$6: t.$jscomp$loop$prop$elms$6, $jscomp$loop$prop$interval$7: t.$jscomp$loop$prop$interval$7, }, i++ ) if ( ((t.$jscomp$loop$prop$elms$6 = n[e[i]]), o.isElementIn(t.$jscomp$loop$prop$elms$6[0].elm)) ) { "reverse" === t.$jscomp$loop$prop$elms$6[0].sort ? t.$jscomp$loop$prop$elms$6.reverse() : "random" === t.$jscomp$loop$prop$elms$6[0].sort && o.randElements(t.$jscomp$loop$prop$elms$6), o.sortElements(t.$jscomp$loop$prop$elms$6, ["order"]); for ( var s = (t.$jscomp$loop$prop$interval$7 = 0); s < t.$jscomp$loop$prop$elms$6.length; s++ ) !(function (t) { return function (e) { t.$jscomp$loop$prop$elms$6[e].elm.setAttribute( "data-show", "true" ), o.setClassNames( t.$jscomp$loop$prop$elms$6[e].elm, t.$jscomp$loop$prop$elms$6[e].addClass ), (t.$jscomp$loop$prop$interval$7 = o.setDurationValue( t.$jscomp$loop$prop$interval$7, t.$jscomp$loop$prop$elms$6[e - 1], t.$jscomp$loop$prop$elms$6[e].interval )), (t.$jscomp$loop$prop$elms$6[e].elm.style.animationName = t.$jscomp$loop$prop$elms$6[e].cue), (t.$jscomp$loop$prop$elms$6[e].elm.style.animationDuration = t.$jscomp$loop$prop$elms$6[e].duration + "ms"), (t.$jscomp$loop$prop$elms$6[ e ].elm.style.animationTimingFunction = "ease"), (t.$jscomp$loop$prop$elms$6[e].elm.style.animationDelay = t.$jscomp$loop$prop$interval$7 + t.$jscomp$loop$prop$elms$6[e].delay + "ms"), (t.$jscomp$loop$prop$elms$6[ e ].elm.style.animationDirection = "normal"), (t.$jscomp$loop$prop$elms$6[e].elm.style.animationFillMode = "both"); }; })(t)(s); delete n[e[i]]; } }, isElementIn: function (e) { var t = e.hasAttribute("data-scpage") ? o.isScrollEndWithDocSlider : o.isScrollEnd; return ( window.pageYOffset > o.getOffsetTop(e) - window.innerHeight * a.percentage || t() ); }, isScrollEnd: function () { var e = window.document.documentElement; return ( (window.document.body.scrollTop || e.scrollTop) >= e.scrollHeight - e.clientHeight ); }, isScrollEndWithDocSlider: function () { var e = docSlider.getCurrentPage(); return e.scrollTop >= e.scrollHeight - e.clientHeight; }, }; return { init: function (e) { (a = o.setOptions(i, e)), (c = a.enable), (d = a.docSlider), (t = a.pageChangeReset), d || (o.setEvents(), o.searchElements(), o.setQuery()); }, update: function () { c && (o.searchElements(), o.setQuery(), o.runQuery()); }, enable: function (e) { (c = void 0 === e ? !c : e), scrollCue.update(); }, _hasDocSlider: function () { return d; }, _hasPageChangeReset: function () { return t; }, _initWithDocSlider: function (e) { o.setEvents(e), o.searchElements(), o.setQuery(); }, _updateWithDocSlider: function () { c && (o.setQuery(), o.runQuery()); }, _searchElements: function () { o.searchElements(); }, }; } export default scrollQue;