layui.define("jquery",function(e){"use strict";function i(e){var i=this;i.config=a.extend({},i.config,n.config,e),i.render()}var a=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var i=this;return i.config=a.extend({},i.config,e),i},on:function(e,i){return layui.onevent.call(this,d,e,i)}}),d="carousel",r="layui-this",s="layui-carousel-left",u="layui-carousel-right",c="layui-carousel-prev",m="layui-carousel-next",t="layui-carousel-arrow",l="layui-carousel-ind";i.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},i.prototype.render=function(){var e=this,i=e.config;i.elem=a(i.elem),i.elem[0]&&(e.elemItem=i.elem.find(">*[carousel-item]>*"),i.index<0&&(i.index=0),i.index>=e.elemItem.length&&(i.index=e.elemItem.length-1),i.interval<800&&(i.interval=800),i.full?i.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):i.elem.css({width:i.width,height:i.height}),i.elem.attr("lay-anim",i.anim),e.elemItem.eq(i.index).addClass(r),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},i.prototype.reload=function(e){var i=this;clearInterval(i.timer),i.config=a.extend({},i.config,e),i.render()},i.prototype.prevIndex=function(){var e=this.config.index-1;return e=e<0?this.elemItem.length-1:e},i.prototype.nextIndex=function(){var e=this.config.index+1;return e=e>=this.elemItem.length?0:e},i.prototype.addIndex=function(e){var i=this.config;i.index=i.index+(e=e||1),i.index>=this.elemItem.length&&(i.index=0)},i.prototype.subIndex=function(e){var i=this.config;i.index=i.index-(e=e||1),i.index<0&&(i.index=this.elemItem.length-1)},i.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(clearInterval(e.timer),e.timer=setInterval(function(){e.slide()},i.interval))},i.prototype.arrow=function(){var i=this,e=i.config,n=a(['<button class="layui-icon '+t+'" lay-type="sub">'+("updown"===e.anim?"&#xe619;":"&#xe603;")+"</button>",'<button class="layui-icon '+t+'" lay-type="add">'+("updown"===e.anim?"&#xe61a;":"&#xe602;")+"</button>"].join(""));e.elem.attr("lay-arrow",e.arrow),e.elem.find("."+t)[0]&&e.elem.find("."+t).remove(),e.elem.append(n),n.on("click",function(){var e=a(this).attr("lay-type");i.slide(e)})},i.prototype.indicator=function(){var i,n=this,t=n.config,e=n.elemInd=a(['<div class="'+l+'"><ul>',(i=[],layui.each(n.elemItem,function(e){i.push("<li"+(t.index===e?' class="layui-this"':"")+"></li>")}),i.join("")),"</ul></div>"].join(""));t.elem.attr("lay-indicator",t.indicator),t.elem.find("."+l)[0]&&t.elem.find("."+l).remove(),t.elem.append(e),"updown"===t.anim&&e.css("margin-top",-e.height()/2),e.find("li").on("hover"===t.trigger?"mouseover":t.trigger,function(){var e=a(this).index();e>t.index?n.slide("add",e-t.index):e<t.index&&n.slide("sub",t.index-e)})},i.prototype.slide=function(e,i){var n=this,t=n.elemItem,a=n.config,l=a.index,o=a.elem.attr("lay-filter");n.haveSlide||("sub"===e?(n.subIndex(i),t.eq(a.index).addClass(c),setTimeout(function(){t.eq(l).addClass(u),t.eq(a.index).addClass(u)},50)):(n.addIndex(i),t.eq(a.index).addClass(m),setTimeout(function(){t.eq(l).addClass(s),t.eq(a.index).addClass(s)},50)),setTimeout(function(){t.removeClass(r+" "+c+" "+m+" "+s+" "+u),t.eq(a.index).addClass(r),n.haveSlide=!1},300),n.elemInd.find("li").eq(a.index).addClass(r).siblings().removeClass(r),n.haveSlide=!0,layui.event.call(this,d,"change("+o+")",{index:a.index,prevIndex:l,item:t.eq(a.index)}))},i.prototype.events=function(){var e=this,i=e.config;i.elem.data("haveEvents")||(i.elem.on("mouseenter",function(){clearInterval(e.timer)}).on("mouseleave",function(){e.autoplay()}),i.elem.data("haveEvents",!0))},n.render=function(e){return new i(e)},e(d,n)});