!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0&&!this.legs[a]?this.buildLeg(a):void 0},a.prototype.repositionLegs=function(){return c.each(this.legs,function(){return this.reposition()})},a.prototype.next=function(){return this.hideLeg(),this.currentLegIndex++,this.currentLegIndex>this.totalLegs-1?this.$original.trigger("stop.tourbus"):this.showLeg()},a.prototype.prev=function(){return this.hideLeg(),this.currentLegIndex--,this.currentLegIndex<0?this.$original.trigger("stop.tourbus"):this.showLeg()},a.prototype.destroy=function(){return c.each(this.legs,function(){return this.destroy()}),this.legs=[],delete this.constructor._busses[this.id],this._teardownEvents(),this.$original.removeData("tourbus"),this.$el.remove()},a.prototype._configureElement=function(){return this.$el=c("
"),this.el=this.$el[0],this.$el.attr({id:this.elId}),this.$el.addClass(f.dataProp(this.rawData["class"],this.options["class"])),this.$container.append(this.$el)},a.prototype._log=function(){return f.dataProp(this.rawData.debug,this.options.debug)?console.log.apply(console,["TOURBUS "+this.id+":"].concat(g.call(arguments))):void 0},a.prototype._setupEvents=function(){return this.$original.on("depart.tourbus",c.proxy(this.depart,this)),this.$original.on("stop.tourbus",c.proxy(this.stop,this)),this.$original.on("next.tourbus",c.proxy(this.next,this)),this.$original.on("prev.tourbus",c.proxy(this.prev,this))},a.prototype._teardownEvents=function(){return this.$original.off(".tourbus")},a}()}).call(this)},{"./leg":3,"./utils":4}],3:[function(a,b){(function(){var c,d,e,f;c=jQuery,e=a("./utils"),b.exports=d=function(){function a(a){if(this.options=a,this.$original=this.options.original,this.bus=this.options.bus,this.rawData=this.options.rawData,this.index=this.options.index,this.$target=c(this.options.target),this.id=""+this.bus.id+"-"+this.options.index,this.elId="tourbus-leg-"+this.id,this.visible=!1,0===this.$target.length)throw""+this.$target.selector+" is not an element!";this.content=this.$original.html(),this._setupOptions(),this._configureElement(),this._configureTarget(),this._configureScroll(),this._setupEvents(),this.bus._log("leg "+this.index+" made with options",this.options)}return a.prototype.render=function(){var a,b;return a="centered"===this.options.orientation?"":"tourbus-arrow",this.$el.addClass(" "+a+" tourbus-arrow-"+this.options.orientation+" "),b="
\n "+this.content+"\n
",this.$el.css({width:this.options.width,zIndex:this.options.zindex}).html(b),this},a.prototype.destroy=function(){return this.$el.remove(),this._teardownEvents()},a.prototype.reposition=function(){return this._configureTarget(),this._position()},a.prototype._position=function(){var a,b,c,d;return"centered"!==this.options.orientation&&(c={},b={top:"left",bottom:"left",left:"top",right:"top"},"number"==typeof this.options.arrow&&(this.options.arrow+="px"),c[b[this.options.orientation]]=this.options.arrow,d="#"+this.elId+".tourbus-arrow",this.bus._log("adding rule for "+this.elId,c),f(""+d+":before, "+d+":after",c)),a=this._offsets(),this.bus._log("setting offsets on leg",a),this.$el.css(a)},a.prototype.show=function(){return this.visible=!0,this.$el.css({visibility:"visible",opacity:1,zIndex:this.options.zindex}),this.scrollIntoView()},a.prototype.hide=function(){return this.visible=!1,this.$el.css(this.bus.options.debug?{visibility:"visible",opacity:.4,zIndex:0}:{visibility:"hidden"})},a.prototype.scrollIntoView=function(){var a;if(this.willScroll)return a=e.dataProp(this.options.scrollTo,this.$el),this.bus._log("scrolling to",a,this.scrollSettings),c.scrollTo(a,this.scrollSettings)},a.prototype._setupOptions=function(){var a,b,c,d,f,g;for(b=this.bus.options.leg,a=["class","top","left","scrollTo","scrollSpeed","scrollContext","margin","arrow","align","width","zindex","orientation"],g=[],d=0,f=a.length;f>d;d++)c=a[d],g.push(this.options[c]=e.dataProp(this.rawData[c],b[c]));return g},a.prototype._configureElement=function(){return this.$el=c("
"),this.el=this.$el[0],this.$el.attr({id:this.elId}),this.$el.addClass(this.options["class"]),this.$el.css({zIndex:this.options.zindex})},a.prototype._setupEvents=function(){return this.$el.on("click",".tourbus-next",c.proxy(this.bus.next,this.bus)),this.$el.on("click",".tourbus-prev",c.proxy(this.bus.prev,this.bus)),this.$el.on("click",".tourbus-stop",c.proxy(this.bus.stop,this.bus))},a.prototype._teardownEvents=function(){return this.$el.off("click")},a.prototype._configureTarget=function(){return this.targetOffset=this.$target.offset(),e.dataProp(this.options.top,!1)&&(this.targetOffset.top=this.options.top),e.dataProp(this.options.left,!1)&&(this.targetOffset.left=this.options.left),this.targetWidth=this.$target.outerWidth(),this.targetHeight=this.$target.outerHeight()},a.prototype._configureScroll=function(){return this.willScroll=c.fn.scrollTo&&this.options.scrollTo!==!1,this.scrollSettings={offset:-this.options.scrollContext,easing:"linear",axis:"y",duration:this.options.scrollSpeed}},a.prototype._offsets=function(){var a,b,d,f,g,h,i,j;switch(d=this.$el.height(),f=this.$el.width(),g={},this.options.orientation){case"centered":i=c(window).height(),g.top=this.options.top,e.dataProp(g.top,!1)||(g.top=i/2-d/2),g.left=this.targetWidth/2-f/2;break;case"left":g.top=this.targetOffset.top,g.left=this.targetOffset.left-f-this.options.margin;break;case"right":g.top=this.targetOffset.top,g.left=this.targetOffset.left+this.targetWidth+this.options.margin;break;case"top":g.top=this.targetOffset.top-d-this.options.margin,g.left=this.targetOffset.left;break;case"bottom":g.top=this.targetOffset.top+this.targetHeight+this.options.margin,g.left=this.targetOffset.left}if(j={top:["left","right"],bottom:["left","right"],left:["top","bottom"],right:["top","bottom"]},e.include(this.options.orientation,j[this.options.align]))switch(this.options.align){case"right":g.left+=this.targetWidth-f;break;case"bottom":g.top+=this.targetHeight-d}else"center"===this.options.align&&(e.include(this.options.orientation,j.left)?(h=this.targetWidth/2,b=f/2,a="left"):(h=this.targetHeight/2,b=d/2,a="top"),h>b?g[a]+=h-b:g[a]-=b-h);return g},a}(),f=function(a){var b;return a.type="text/css",document.getElementsByTagName("head")[0].appendChild(a),b=document.styleSheets[document.styleSheets.length-1],function(a,d){var e,f;f=c.map(function(){var a;a=[];for(e in d)a.push(e);return a}(),function(a){return""+a+":"+d[a]}).join(";");try{b.insertRule?b.insertRule(""+a+" { "+f+" }",(b.cssRules||b.rules).length):b.addRule(a,f)}catch(g){}}}(document.createElement("style"))}).call(this)},{"./utils":4}],4:[function(a,b){(function(){b.exports={dataProp:function(a,b){return null===a||"undefined"==typeof a?b:a},include:function(a,b){return-1!==jQuery.inArray(a,b||[])}}}).call(this)},{}]},{},[1,2,3,4]);