'), "string" == typeof a && i.css("background-image", "url(" + a + ")"), this.$overlay = i, this.$elmt.prepend(i)), this.$elmt.addClass("vegas-container"), n || this.$elmt.append(s), setTimeout(function () { r.trigger("init"), r._goto(r.slide), r.settings.autoplay && r.trigger("play") }, 1) }, _preload: function () { var t, s; for (s = 0; s < this.settings.slides.length; s++)(this.settings.preload || this.settings.preloadImages) && this.settings.slides[s].src && (t = new Image, t.src = this.settings.slides[s].src), (this.settings.preload || this.settings.preloadVideos) && this.support.video && this.settings.slides[s].video && (this.settings.slides[s].video instanceof Array ? this._video(this.settings.slides[s].video) : this._video(this.settings.slides[s].video.src)) }, _random: function (t) { return t[Math.floor(Math.random() * t.length)] }, _slideShow: function () { var t = this; this.total > 1 && !this.ended && !this.paused && !this.noshow && (this.timeout = setTimeout(function () { t.next() }, this._options("delay"))) }, _timer: function (t) { var s = this; clearTimeout(this.timeout), this.$timer && (this.$timer.removeClass("vegas-timer-running").find("div").css("transition-duration", "0ms"), this.ended || this.paused || this.noshow || t && setTimeout(function () { s.$timer.addClass("vegas-timer-running").find("div").css("transition-duration", s._options("delay") - 100 + "ms") }, 100)) }, _video: function (t) { var s, e, n = t.toString(); return i[n] ? i[n] : (t instanceof Array == !1 && (t = [t]), s = document.createElement("video"), s.preload = !0, t.forEach(function (t) { e = document.createElement("source"), e.src = t, s.appendChild(e) }), i[n] = s, s) }, _fadeOutSound: function (t, s) { var i = this, e = s / 10, n = t.volume - .09; n > 0 ? (t.volume = n, setTimeout(function () { i._fadeOutSound(t, s) }, e)) : t.pause() }, _fadeInSound: function (t, s) { var i = this, e = s / 10, n = t.volume + .09; 1 > n && (t.volume = n, setTimeout(function () { i._fadeInSound(t, s) }, e)) }, _options: function (t, s) { return void 0 === s && (s = this.slide), void 0 !== this.settings.slides[s][t] ? this.settings.slides[s][t] : this.settings[t] }, _goto: function (s) { function i() { f._timer(!0), setTimeout(function () { y && (f.support.transition ? (h.css("transition", "all " + _ + "ms").addClass("vegas-transition-" + y + "-out"), h.each(function () { var t = h.find("video").get(0); t && (t.volume = 1, f._fadeOutSound(t, _)) }), e.css("transition", "all " + _ + "ms").addClass("vegas-transition-" + y + "-in")) : e.fadeIn(_)); for (var t = 0; t < h.length - 4; t++)h.eq(t).remove(); f.trigger("walk"), f._slideShow() }, 100) } "undefined" == typeof this.settings.slides[s] && (s = 0), this.slide = s; var e, n, o, a, r, h = this.$elmt.children(".vegas-slide"), d = this.settings.slides[s].src, l = this.settings.slides[s].video, g = this._options("delay"), u = this._options("align"), c = this._options("valign"), p = this._options("cover"), m = this._options("color") || this.$elmt.css("background-color"), f = this, v = h.length, y = this._options("transition"), _ = this._options("transitionDuration"), w = this._options("animation"), b = this._options("animationDuration"); this.settings.firstTransition && this.first && (y = this.settings.firstTransition || y), this.settings.firstTransitionDuration && this.first && (_ = this.settings.firstTransitionDuration || _), this.first && (this.first = !1), "repeat" !== p && (p === !0 ? p = "cover" : p === !1 && (p = "contain")), ("random" === y || y instanceof Array) && (y = y instanceof Array ? this._random(y) : this._random(this.transitions)), ("random" === w || w instanceof Array) && (w = w instanceof Array ? this._random(w) : this._random(this.animations)), ("auto" === _ || _ > g) && (_ = g), "auto" === b && (b = g), e = t('
'), this.support.transition && y && e.addClass("vegas-transition-" + y), this.support.video && l ? (a = l instanceof Array ? this._video(l) : this._video(l.src), a.loop = void 0 !== l.loop ? l.loop : !0, a.muted = void 0 !== l.mute ? l.mute : !0, a.muted === !1 ? (a.volume = 0, this._fadeInSound(a, _)) : a.pause(), o = t(a).addClass("vegas-video").css("background-color", m), this.support.objectFit ? o.css("object-position", u + " " + c).css("object-fit", p).css("width", "100%").css("height", "100%") : "contain" === p && o.css("width", "100%").css("height", "100%"), e.append(o)) : (r = new Image, n = t('
').css("background-image", 'url("' + d + '")').css("background-color", m).css("background-position", u + " " + c), "repeat" === p ? n.css("background-repeat", "repeat") : n.css("background-size", p), this.support.transition && w && n.addClass("vegas-animation-" + w).css("animation-duration", b + "ms"), e.append(n)), this.support.transition || e.css("display", "none"), v ? h.eq(v - 1).after(e) : this.$elmt.prepend(e), h.css("transition", "all 0ms").each(function () { this.className = "vegas-slide", "VIDEO" === this.tagName && (this.className += " vegas-video"), y && (this.className += " vegas-transition-" + y, this.className += " vegas-transition-" + y + "-in") }), f._timer(!1), a ? (4 === a.readyState && (a.currentTime = 0), a.play(), i()) : (r.src = d, r.complete ? i() : r.onload = i) }, _end: function () { this.ended = !0, this._timer(!1), this.trigger("end") }, shuffle: function () { for (var t, s, i = this.total - 1; i > 0; i--)s = Math.floor(Math.random() * (i + 1)), t = this.settings.slides[i], this.settings.slides[i] = this.settings.slides[s], this.settings.slides[s] = t }, play: function () { this.paused && (this.paused = !1, this.next(), this.trigger("play")) }, pause: function () { this._timer(!1), this.paused = !0, this.trigger("pause") }, toggle: function () { this.paused ? this.play() : this.pause() }, playing: function () { return !this.paused && !this.noshow }, current: function (t) { return t ? { slide: this.slide, data: this.settings.slides[this.slide] } : this.slide }, jump: function (t) { 0 > t || t > this.total - 1 || t === this.slide || (this.slide = t, this._goto(this.slide)) }, next: function () { if (this.slide++, this.slide >= this.total) { if (!this.settings.loop) return this._end(); this.slide = 0 } this._goto(this.slide) }, previous: function () { if (this.slide--, this.slide < 0) { if (!this.settings.loop) return void this.slide++; this.slide = this.total - 1 } this._goto(this.slide) }, trigger: function (t) { var s = []; s = "init" === t ? [this.settings] : [this.slide, this.settings.slides[this.slide]], this.$elmt.trigger("vegas" + t, s), "function" == typeof this.settings[t] && this.settings[t].apply(this.$elmt, s) }, options: function (i, e) { var n = this.settings.slides.slice(); if ("object" == typeof i) this.settings = t.extend({}, s, t.vegas.defaults, i); else { if ("string" != typeof i) return this.settings; if (void 0 === e) return this.settings[i]; this.settings[i] = e } this.settings.slides !== n && (this.total = this.settings.slides.length, this.noshow = this.total < 2, this._preload()) }, destroy: function () { clearTimeout(this.timeout), this.$elmt.removeClass("vegas-container"), this.$elmt.find("> .vegas-slide").remove(), this.$elmt.find("> .vegas-wrapper").clone(!0).children().appendTo(this.$elmt), this.$elmt.find("> .vegas-wrapper").remove(), this.settings.timer && this.$timer.remove(), this.settings.overlay && this.$overlay.remove(), this.elmt._vegas = null } }, t.fn.vegas = function (t) { var s, i = arguments, n = !1; if (void 0 === t || "object" == typeof t) return this.each(function () { this._vegas || (this._vegas = new e(this, t)) }); if ("string" == typeof t) { if (this.each(function () { var e = this._vegas; if (!e) throw new Error("No Vegas applied to this element."); "function" == typeof e[t] && "_" !== t[0] ? s = e[t].apply(e, [].slice.call(i, 1)) : n = !0 }), n) throw new Error('No method "' + t + '" in Vegas.'); return void 0 !== s ? s : this } }, t.vegas = {}, t.vegas.defaults = s, t.vegas.isVideoCompatible = function () { return !/(Android|webOS|Phone|iPad|iPod|BlackBerry|Windows Phone)/i.test(navigator.userAgent) } }(window.jQuery || window.Zepto);
//# sourceMappingURL=vegas.min.js.map