(function(){vara=[].slice;!function(b){varc,d,e,f,g,h,i,j,k,l,m;returnf=b.tourbus=function(){varc,d;returnc=1<=arguments.length?a.call(arguments,0):[],d=c[0],e.hasOwnProperty(d)?c=c.slice(1):dinstanceofb?d="build":"string"==typeofd?(d="build",c[0]=b(c[0])):b.error("Unknown method of $.tourbus --",c),e[d].apply(this,c)},b.fn.tourbus=function(){varc;returnc=1<=arguments.length?a.call(arguments,0):[],this.each(function(){returnc.unshift(b(this)),f.apply(null,["build"].concat(a.call(c))),this})},e={build:function(a,c){vard;returnnull==c&&(c={}),c=b.extend(!0,{},f.defaults,c),d=[],ainstanceofb||(a=b(a)),a.each(function(){returnd.push(i(this,c))}),0===d.length&&b.error(""+a.selector+" was not found!"),1===d.length?d[0]:d},destroyAll:function(){vara,b,c;c=[];for(binj)a=j[b],c.push(a.destroy());returnc},expose:function(a){returna.tourbus={Bus:c,Leg:d}}},f.defaults={debug:!1,autoDepart:!1,target:"body",startAt:0,onDepart:function(){returnnull},onStop:function(){returnnull},onLegStart:function(){returnnull},onLegEnd:function(){returnnull},leg:{scrollTo:null,scrollSpeed:150,scrollContext:100,orientation:"bottom",align:"left",width:"auto",margin:10,top:null,left:null,arrow:"35%"}},c=function(){functionc(a,c){this.id=g(),this.$target=b(c.target),this.$el=b(a),this.$el.data({tourbus:this}),this.options=c,this.currentLegIndex=null,this.legs=null,this.legEls=this.$el.children("li"),this.totalLegs=this.legEls.length,this._setupEvents(),this.options.autoDepart&&this.$el.trigger("depart.tourbus"),this._log("built tourbus with el",a.toString(),"and options",this.options)}returnc.prototype.depart=function(){returnthis.running=!0,this.options.onDepart(this),this._log("departing",this),this.legs=this._buildLegs(),this.currentLegIndex=this.options.startAt,this.showLeg()},c.prototype.stop=function(){returnthis.running?(this.legs&&b.each(this.legs,b.proxy(this.hideLeg,this)),this.currentLegIndex=this.options.startAt,this.options.onStop(this),this.running=!1):void0},c.prototype.on=function(a,b,c){returnthis.$target.on(a,b,c)},c.prototype.currentLeg=function(){returnnull===this.currentLegIndex?null:this.legs[this.currentLegIndex]},c.prototype.showLeg=function(a){varb,c;returnnull==a&&(a=this.currentLegIndex),b=this.legs[a],this._log("showLeg:",b),c=this.options.onLegStart(b,this),c!==!1?b.show():void0},c.prototype.hideLeg=function(a){varb,c;returnnull==a&&(a=this.currentLegIndex),b=this.legs[a],this._log("hideLeg:",b),c=this.options.onLegEnd(b,this),c!==!1?b.hide():void0},c.prototype.repositionLegs=function(){returnthis.legs?b.each(this.legs,function(){returnthis.reposition()}):void0},c.prototype.next=function(){returnthis.hideLeg(),this.currentLegIndex++,this.currentLegIndex>this.totalLegs-1?this.stop():this.showLeg()},c.prototype.prev=function(){returnthis.hideLeg(),this.currentLegIndex--,this.currentLegIndex<0?this.stop():this.showLeg()},c.prototype.destroy=function(){returnthis.legs&&b.each(this.legs,function(){returnthis.destroy()}),this.legs=null,deletej[this.id],this._teardownEvents()},c.prototype._buildLegs=function(){vara=this;returnthis.legs&&b.each(this.legs,function(a,b){returnb.destroy()}),b.map(this.legEls,function(c,e){varf,g,h;returnf=b(c),g=f.data(),h=newd({content:f.html(),target:g.el||"body",bus:a,index:e,rawData:g}),h.render(),a.$target.append(h.$el),h._position(),h.hide(),h})},c.prototype._log=function(){returnthis.options.debug?console.log.apply(console,["TOURBUS "+this.id+":"].concat(a.call(arguments))):void0},c.prototype._setupEvents=function(){returnthis.$el.on("depart.tourbus",b.proxy(this.depart,this)),this.$el.on("stop.tourbus",b.proxy(this.stop,this)),this.$el.on("next.tourbus",b.proxy(this.next,this)),this.$el.on("prev.tourbus",b.proxy(this.prev,this))},c.prototype._teardownEvents=function(){returnthis.$el.off(".tourbus")},c}(),d=function(){functiona(a){if(this.bus=a.bus,this.rawData=a.rawData,this.content=a.content,this.index=a.index,this.options=a,this.$target=b(a.target),0===this.$target.length)throw""+this.$target.selector+" is not an element!";this._setupOp