! function(e, t) {
    "function" == typeof define && define.amd ? define(t) : "object" == typeof exports ? module.exports = t(require, exports, module) : e.scrollReveal = t()
}(this, function() {
    return window.scrollReveal = function(e) {
        "use strict";

        function t(i) {
            return this instanceof t ? (r = this, r.elems = {}, r.serial = 1, r.blocked = !1, r.config = o(r.defaults, i), r.isMobile() && !r.config.mobile || !r.isSupported() ? void r.destroy() : (r.config.viewport === e.document.documentElement ? (e.addEventListener("scroll", a, !1), e.addEventListener("resize", a, !1)) : r.config.viewport.addEventListener("scroll", a, !1), void r.init(!0))) : new t(i)
        }
        var i, o, a, r;
        return t.prototype = {
            defaults: {
                enter: "bottom",
                move: "8px",
                over: "0.6s",
                wait: "0s",
                easing: "ease",
                scale: {
                    direction: "up",
                    power: "5%"
                },
                rotate: {
                    x: 0,
                    y: 0,
                    z: 0
                },
                opacity: 0,
                mobile: !1,
                reset: !1,
                viewport: e.document.documentElement,
                delay: "once",
                vFactor: .6,
                complete: function() {}
            },
            init: function(e) {
                var t, i, o;
                o = Array.prototype.slice.call(r.config.viewport.querySelectorAll("[data-sr]")), o.forEach(function(e) {
                    t = r.serial++, i = r.elems[t] = {
                        domEl: e
                    }, i.config = r.configFactory(i), i.styles = r.styleFactory(i), i.seen = !1, e.removeAttribute("data-sr"), e.setAttribute("style", i.styles.inline + i.styles.initial)
                }), r.scrolled = r.scrollY(), r.animate(e)
            },
            animate: function(e) {
                function t(e) {
                    var t = r.elems[e];
                    setTimeout(function() {
                        t.domEl.setAttribute("style", t.styles.inline), t.config.complete(t.domEl), delete r.elems[e]
                    }, t.styles.duration)
                }
                var i, o, a;
                for (i in r.elems) r.elems.hasOwnProperty(i) && (o = r.elems[i], a = r.isElemInViewport(o), a ? ("always" === r.config.delay || "onload" === r.config.delay && e || "once" === r.config.delay && !o.seen ? o.domEl.setAttribute("style", o.styles.inline + o.styles.target + o.styles.transition) : o.domEl.setAttribute("style", o.styles.inline + o.styles.target + o.styles.reset), o.seen = !0, o.config.reset || o.animating || (o.animating = !0, t(i))) : !a && o.config.reset && o.domEl.setAttribute("style", o.styles.inline + o.styles.initial + o.styles.reset));
                r.blocked = !1
            },
            configFactory: function(e) {
                var t = {},
                    i = {},
                    a = e.domEl.getAttribute("data-sr").split(/[, ]+/);
                return a.forEach(function(e, i) {
                    switch (e) {
                        case "enter":
                            t.enter = a[i + 1];
                            break;
                        case "wait":
                            t.wait = a[i + 1];
                            break;
                        case "move":
                            t.move = a[i + 1];
                            break;
                        case "ease":
                            t.move = a[i + 1], t.ease = "ease";
                            break;
                        case "ease-in":
                            if ("up" == a[i + 1] || "down" == a[i + 1]) {
                                t.scale.direction = a[i + 1], t.scale.power = a[i + 2], t.easing = "ease-in";
                                break
                            }
                            t.move = a[i + 1], t.easing = "ease-in";
                            break;
                        case "ease-in-out":
                            if ("up" == a[i + 1] || "down" == a[i + 1]) {
                                t.scale.direction = a[i + 1], t.scale.power = a[i + 2], t.easing = "ease-in-out";
                                break
                            }
                            t.move = a[i + 1], t.easing = "ease-in-out";
                            break;
                        case "ease-out":
                            if ("up" == a[i + 1] || "down" == a[i + 1]) {
                                t.scale.direction = a[i + 1], t.scale.power = a[i + 2], t.easing = "ease-out";
                                break
                            }
                            t.move = a[i + 1], t.easing = "ease-out";
                            break;
                        case "hustle":
                            if ("up" == a[i + 1] || "down" == a[i + 1]) {
                                t.scale.direction = a[i + 1], t.scale.power = a[i + 2], t.easing = "cubic-bezier( 0.6, 0.2, 0.1, 1 )";
                                break
                            }
                            t.move = a[i + 1], t.easing = "cubic-bezier( 0.6, 0.2, 0.1, 1 )";
                            break;
                        case "over":
                            t.over = a[i + 1];
                            break;
                        case "flip":
                        case "pitch":
                            t.rotate = t.rotate || {}, t.rotate.x = a[i + 1];
                            break;
                        case "spin":
                        case "yaw":
                            t.rotate = t.rotate || {}, t.rotate.y = a[i + 1];
                            break;
                        case "roll":
                            t.rotate = t.rotate || {}, t.rotate.z = a[i + 1];
                            break;
                        case "reset":
                            t.reset = "no" == a[i - 1] ? !1 : !0;
                            break;
                        case "scale":
                            if (t.scale = {}, "up" == a[i + 1] || "down" == a[i + 1]) {
                                t.scale.direction = a[i + 1], t.scale.power = a[i + 2];
                                break
                            }
                            t.scale.power = a[i + 1];
                            break;
                        case "vFactor":
                        case "vF":
                            t.vFactor = a[i + 1];
                            break;
                        case "opacity":
                            t.opacity = a[i + 1];
                            break;
                        default:
                            return
                    }
                }), i = o(i, r.config), i = o(i, t), "top" === i.enter || "bottom" === i.enter ? i.axis = "Y" : ("left" === i.enter || "right" === i.enter) && (i.axis = "X"), ("top" === i.enter || "left" === i.enter) && (i.move = "-" + i.move), i
            },
            styleFactory: function(e) {
                function t() {
                    0 !== parseInt(s.move) && (o += " translate" + s.axis + "(" + s.move + ")", r += " translate" + s.axis + "(0)"), 0 !== parseInt(s.scale.power) && ("up" === s.scale.direction ? s.scale.value = 1 - .01 * parseFloat(s.scale.power) : "down" === s.scale.direction && (s.scale.value = 1 + .01 * parseFloat(s.scale.power)), o += " scale(" + s.scale.value + ")", r += " scale(1)"), s.rotate.x && (o += " rotateX(" + s.rotate.x + ")", r += " rotateX(0)"), s.rotate.y && (o += " rotateY(" + s.rotate.y + ")", r += " rotateY(0)"), s.rotate.z && (o += " rotateZ(" + s.rotate.z + ")", r += " rotateZ(0)"), o += "; opacity: " + s.opacity + "; ", r += "; opacity: 1; "
                }
                var i, o, a, r, n, s = e.config,
                    c = 1e3 * (parseFloat(s.over) + parseFloat(s.wait));
                return i = e.domEl.getAttribute("style") ? e.domEl.getAttribute("style") + "; visibility: visible; " : "visibility: visible; ", n = "-webkit-transition: -webkit-transform " + s.over + " " + s.easing + " " + s.wait + ", opacity " + s.over + " " + s.easing + " " + s.wait + "; transition: transform " + s.over + " " + s.easing + " " + s.wait + ", opacity " + s.over + " " + s.easing + " " + s.wait + "; -webkit-perspective: 1000;-webkit-backface-visibility: hidden;", a = "-webkit-transition: -webkit-transform " + s.over + " " + s.easing + " 0s, opacity " + s.over + " " + s.easing + " 0s; transition: transform " + s.over + " " + s.easing + " 0s, opacity " + s.over + " " + s.easing + " 0s; -webkit-perspective: 1000; -webkit-backface-visibility: hidden; ", o = "transform:", r = "transform:", t(), o += "-webkit-transform:", r += "-webkit-transform:", t(), {
                    transition: n,
                    initial: o,
                    target: r,
                    reset: a,
                    inline: i,
                    duration: c
                }
            },
            getViewportH: function() {
                var t = r.config.viewport.clientHeight,
                    i = e.innerHeight;
                return r.config.viewport === e.document.documentElement && i > t ? i : t
            },
            scrollY: function() {
                return r.config.viewport === e.document.documentElement ? e.pageYOffset : r.config.viewport.scrollTop + r.config.viewport.offsetTop
            },
            getOffset: function(e) {
                var t = 0,
                    i = 0;
                do isNaN(e.offsetTop) || (t += e.offsetTop), isNaN(e.offsetLeft) || (i += e.offsetLeft); while (e = e.offsetParent);
                return {
                    top: t,
                    left: i
                }
            },
            isElemInViewport: function(t) {
                function i() {
                    var e = n + a * c,
                        t = s - a * c,
                        i = r.scrolled + r.getViewportH(),
                        o = r.scrolled;
                    return i > e && t > o
                }

                function o() {
                    var i = t.domEl,
                        o = i.currentStyle || e.getComputedStyle(i, null);
                    return "fixed" === o.position
                }
                var a = t.domEl.offsetHeight,
                    n = r.getOffset(t.domEl).top,
                    s = n + a,
                    c = t.config.vFactor || 0;
                return i() || o()
            },
            isMobile: function() {
                var t = navigator.userAgent || navigator.vendor || e.opera;
                return /(ipad|playbook|silk|android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(t) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0, 4)) ? !0 : !1
            },
            isSupported: function() {
                for (var e = document.createElement("sensor"), t = "Webkit,Moz,O,".split(","), i = ("transition " + t.join("transition,")).split(","), o = 0; o < i.length; o++)
                    if ("" === !e.style[i[o]]) return !1;
                return !0
            },
            destroy: function() {
                var e = r.config.viewport,
                    t = Array.prototype.slice.call(e.querySelectorAll("[data-sr]"));
                t.forEach(function(e) {
                    e.removeAttribute("data-sr")
                })
            }
        }, a = function() {
            r.blocked || (r.blocked = !0, r.scrolled = r.scrollY(), i(function() {
                r.animate()
            }))
        }, o = function(e, t) {
            for (var i in t) t.hasOwnProperty(i) && (e[i] = t[i]);
            return e
        }, i = function() {
            return e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || function(t) {
                e.setTimeout(t, 1e3 / 60)
            }
        }(), t
    }(window), scrollReveal
});