diff --git a/ajax/libs/shepherd/0.2.0/shepherd.js b/ajax/libs/shepherd/0.2.0/shepherd.js
new file mode 100644
index 000000000..96d80fd7f
--- /dev/null
+++ b/ajax/libs/shepherd/0.2.0/shepherd.js
@@ -0,0 +1,409 @@
+(function() {
+ var ATTACHMENT, Evented, Shepherd, Step, addClass, createFromHTML, extend, matchesSelector, parseShorthand, removeClass, uniqueId, _ref,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ _ref = Tether.Utils, extend = _ref.extend, removeClass = _ref.removeClass, addClass = _ref.addClass, Evented = _ref.Evented;
+
+ ATTACHMENT = {
+ 'top': 'top center',
+ 'left': 'middle right',
+ 'right': 'middle left',
+ 'bottom': 'bottom center'
+ };
+
+ uniqueId = (function() {
+ var id;
+ id = 0;
+ return function() {
+ return id++;
+ };
+ })();
+
+ createFromHTML = function(html) {
+ var el;
+ el = document.createElement('div');
+ el.innerHTML = html;
+ return el.children[0];
+ };
+
+ matchesSelector = function(el, sel) {
+ var matches, _ref1, _ref2, _ref3, _ref4;
+ matches = (_ref1 = (_ref2 = (_ref3 = (_ref4 = el.matches) != null ? _ref4 : el.matchesSelector) != null ? _ref3 : el.webkitMatchesSelector) != null ? _ref2 : el.mozMatchesSelector) != null ? _ref1 : el.oMatchesSelector;
+ return matches.call(el, sel);
+ };
+
+ parseShorthand = function(obj, props) {
+ var i, out, prop, vals, _i, _len;
+ if (obj == null) {
+ return obj;
+ } else if (typeof obj === 'object') {
+ return obj;
+ } else {
+ vals = obj.split(' ');
+ if (vals.length > props.length) {
+ vals[0] = vals.slice(0, +(vals.length - props.length) + 1 || 9e9).join(' ');
+ vals.splice(1, vals.length - props.length);
+ }
+ out = {};
+ for (i = _i = 0, _len = props.length; _i < _len; i = ++_i) {
+ prop = props[i];
+ out[prop] = vals[i];
+ }
+ return out;
+ }
+ };
+
+ Step = (function(_super) {
+ __extends(Step, _super);
+
+ function Step(shepherd, options) {
+ this.shepherd = shepherd;
+ this.destroy = __bind(this.destroy, this);
+ this.scrollTo = __bind(this.scrollTo, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.hide = __bind(this.hide, this);
+ this.show = __bind(this.show, this);
+ this.setOptions(options);
+ }
+
+ Step.prototype.setOptions = function(options) {
+ var event, handler, _base, _ref1;
+ this.options = options != null ? options : {};
+ this.destroy();
+ this.id = this.options.id || this.id || ("step-" + (uniqueId()));
+ if (this.options.when) {
+ _ref1 = this.options.when;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ this.on(event, handler, this);
+ }
+ }
+ return (_base = this.options).buttons != null ? (_base = this.options).buttons : _base.buttons = [
+ {
+ text: 'Next',
+ action: this.shepherd.next
+ }
+ ];
+ };
+
+ Step.prototype.bindAdvance = function() {
+ var event, handler, selector, _ref1,
+ _this = this;
+ _ref1 = parseShorthand(this.options.advanceOn, ['event', 'selector']), event = _ref1.event, selector = _ref1.selector;
+ handler = function(e) {
+ if (selector != null) {
+ if (matchesSelector(e.target, selector)) {
+ return _this.shepherd.advance();
+ }
+ } else {
+ if (_this.el && e.target === _this.el) {
+ return _this.shepherd.advance();
+ }
+ }
+ };
+ document.body.addEventListener(event, handler);
+ return this.on('destroy', function() {
+ return document.body.removeEventListener(event, handler);
+ });
+ };
+
+ Step.prototype.getAttachTo = function() {
+ var opts;
+ opts = parseShorthand(this.options.attachTo, ['element', 'on']);
+ if (opts == null) {
+ opts = {};
+ }
+ if (typeof opts.element === 'string') {
+ opts.element = document.querySelector(opts.element);
+ if (opts.element == null) {
+ throw new Error("Shepherd step's attachTo was not found in the page");
+ }
+ }
+ return opts;
+ };
+
+ Step.prototype.setupTether = function() {
+ var attachment, opts, tetherOpts;
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("Using the attachment feature of Shepherd requires the Tether library");
+ }
+ opts = this.getAttachTo();
+ attachment = ATTACHMENT[opts.on || 'right'];
+ if (opts.element == null) {
+ opts.element = 'viewport';
+ attachment = 'middle center';
+ }
+ tetherOpts = {
+ classPrefix: 'shepherd',
+ element: this.el,
+ constraints: [
+ {
+ to: 'window',
+ pin: true,
+ attachment: 'together'
+ }
+ ],
+ target: opts.element,
+ offset: opts.offset || '0 0',
+ attachment: attachment
+ };
+ return this.tether = new Tether(extend(tetherOpts, this.options.tetherOptions));
+ };
+
+ Step.prototype.show = function() {
+ var _ref1,
+ _this = this;
+ if (this.el == null) {
+ this.render();
+ }
+ addClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.enable();
+ }
+ if (this.options.scrollTo) {
+ setTimeout(function() {
+ return _this.scrollTo();
+ });
+ }
+ return this.trigger('show');
+ };
+
+ Step.prototype.hide = function() {
+ var _ref1;
+ removeClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.disable();
+ }
+ return this.trigger('hide');
+ };
+
+ Step.prototype.cancel = function() {
+ this.hide();
+ return this.trigger('cancel');
+ };
+
+ Step.prototype.complete = function() {
+ this.hide();
+ return this.trigger('complete');
+ };
+
+ Step.prototype.scrollTo = function() {
+ var $attachTo, elHeight, elLeft, elTop, element, height, left, offset, top, _ref1;
+ element = this.getAttachTo().element;
+ if (element == null) {
+ return;
+ }
+ $attachTo = jQuery(element);
+ _ref1 = $attachTo.offset(), top = _ref1.top, left = _ref1.left;
+ height = $attachTo.outerHeight();
+ offset = $(this.el).offset();
+ elTop = offset.top;
+ elLeft = offset.left;
+ elHeight = $(this.el).outerHeight();
+ if (top < pageYOffset || elTop < pageYOffset) {
+ return jQuery(document.body).scrollTop(Math.min(top, elTop) - 10);
+ } else if ((top + height) > (pageYOffset + innerHeight) || (elTop + elHeight) > (pageYOffset + innerHeight)) {
+ return jQuery(document.body).scrollTop(Math.max(top + height, elTop + elHeight) - innerHeight + 10);
+ }
+ };
+
+ Step.prototype.destroy = function() {
+ var _ref1;
+ if (this.el != null) {
+ document.body.removeChild(this.el);
+ delete this.el;
+ }
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ return this.trigger('destroy');
+ };
+
+ Step.prototype.render = function() {
+ var button, buttons, cfg, content, footer, header, paragraph, paragraphs, text, _i, _j, _len, _len1, _ref1, _ref2, _ref3;
+ if (this.el != null) {
+ this.destroy();
+ }
+ this.el = createFromHTML("
");
+ content = document.createElement('div');
+ content.className = 'shepherd-content';
+ this.el.appendChild(content);
+ if (this.options.title != null) {
+ header = document.createElement('header');
+ header.innerHTML = "" + this.options.title + "
";
+ this.el.className += ' shepherd-has-title';
+ content.appendChild(header);
+ }
+ if (this.options.text != null) {
+ text = createFromHTML("");
+ paragraphs = this.options.text;
+ if (typeof paragraphs === 'string') {
+ paragraphs = [paragraphs];
+ }
+ for (_i = 0, _len = paragraphs.length; _i < _len; _i++) {
+ paragraph = paragraphs[_i];
+ text.innerHTML += "" + paragraph + "
";
+ }
+ content.appendChild(text);
+ }
+ footer = document.createElement('footer');
+ if (this.options.buttons) {
+ buttons = createFromHTML("");
+ _ref2 = this.options.buttons;
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
+ cfg = _ref2[_j];
+ button = createFromHTML("" + cfg.text + "");
+ buttons.appendChild(button);
+ this.bindButtonEvents(cfg, button.querySelector('a'));
+ }
+ footer.appendChild(buttons);
+ }
+ content.appendChild(footer);
+ document.body.appendChild(this.el);
+ this.setupTether();
+ if (this.options.advanceOn) {
+ return this.bindAdvance();
+ }
+ };
+
+ Step.prototype.bindButtonEvents = function(cfg, el) {
+ var event, handler, page, _ref1,
+ _this = this;
+ if (cfg.events == null) {
+ cfg.events = {};
+ }
+ if (cfg.action != null) {
+ cfg.events.click = cfg.action;
+ }
+ _ref1 = cfg.events;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ if (typeof handler === 'string') {
+ page = handler;
+ handler = function() {
+ return _this.shepherd.show(page);
+ };
+ }
+ el.addEventListener(event, handler);
+ }
+ return this.on('destroy', function() {
+ var _ref2, _results;
+ _ref2 = cfg.events;
+ _results = [];
+ for (event in _ref2) {
+ handler = _ref2[event];
+ _results.push(el.removeEventListener(event, handler));
+ }
+ return _results;
+ });
+ };
+
+ return Step;
+
+ })(Evented);
+
+ Shepherd = (function(_super) {
+ __extends(Shepherd, _super);
+
+ function Shepherd(options) {
+ var _ref1;
+ this.options = options != null ? options : {};
+ this.hide = __bind(this.hide, this);
+ this.cancel = __bind(this.cancel, this);
+ this.back = __bind(this.back, this);
+ this.next = __bind(this.next, this);
+ this.steps = (_ref1 = this.options.steps) != null ? _ref1 : [];
+ }
+
+ Shepherd.prototype.addStep = function(name, step) {
+ if (step == null) {
+ step = name;
+ } else {
+ step.id = name;
+ }
+ step = extend({}, this.options.defaults, step);
+ return this.steps.push(new Step(this, step));
+ };
+
+ Shepherd.prototype.getById = function(id) {
+ var step, _i, _len, _ref1;
+ _ref1 = this.steps;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ step = _ref1[_i];
+ if (step.id === id) {
+ return step;
+ }
+ }
+ };
+
+ Shepherd.prototype.next = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ if (index === this.steps.length - 1) {
+ this.hide(index);
+ return this.trigger('complete');
+ } else {
+ return this.show(index + 1);
+ }
+ };
+
+ Shepherd.prototype.back = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ return this.show(index - 1);
+ };
+
+ Shepherd.prototype.cancel = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.cancel();
+ }
+ return this.trigger('cancel');
+ };
+
+ Shepherd.prototype.hide = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ return this.trigger('hide');
+ };
+
+ Shepherd.prototype.show = function(key) {
+ var next;
+ if (key == null) {
+ key = 0;
+ }
+ if (this.currentStep) {
+ this.currentStep.hide();
+ }
+ if (typeof key === 'string') {
+ next = this.getById(key);
+ } else {
+ next = this.steps[key];
+ }
+ if (next) {
+ this.trigger('shown', {
+ step: next,
+ previous: this.currentStep
+ });
+ this.currentStep = next;
+ return next.show();
+ }
+ };
+
+ Shepherd.prototype.start = function() {
+ this.currentStep = null;
+ return this.next();
+ };
+
+ return Shepherd;
+
+ })(Evented);
+
+ window.Shepherd = Shepherd;
+
+}).call(this);
diff --git a/ajax/libs/shepherd/0.2.0/shepherd.min.js b/ajax/libs/shepherd/0.2.0/shepherd.min.js
new file mode 100644
index 000000000..fa79d7792
--- /dev/null
+++ b/ajax/libs/shepherd/0.2.0/shepherd.min.js
@@ -0,0 +1,2 @@
+/*! shepherd.js 0.2.0 */
+(function(){var a,b,c,d,e,f,g,h,i,j,k,l,m=function(a,b){return function(){return a.apply(b,arguments)}},n={}.hasOwnProperty,o=function(a,b){function c(){this.constructor=a}for(var d in b)n.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};l=Tether.Utils,g=l.extend,j=l.removeClass,e=l.addClass,b=l.Evented,a={top:"top center",left:"middle right",right:"middle left",bottom:"bottom center"},k=function(){var a;return a=0,function(){return a++}}(),f=function(a){var b;return b=document.createElement("div"),b.innerHTML=a,b.children[0]},h=function(a,b){var c,d,e,f,g;return c=null!=(d=null!=(e=null!=(f=null!=(g=a.matches)?g:a.matchesSelector)?f:a.webkitMatchesSelector)?e:a.mozMatchesSelector)?d:a.oMatchesSelector,c.call(a,b)},i=function(a,b){var c,d,e,f,g,h;if(null==a)return a;if("object"==typeof a)return a;for(f=a.split(" "),f.length>b.length&&(f[0]=f.slice(0,+(f.length-b.length)+1||9e9).join(" "),f.splice(1,f.length-b.length)),d={},c=g=0,h=b.length;h>g;c=++g)e=b[c],d[e]=f[c];return d},d=function(b){function c(a,b){this.shepherd=a,this.destroy=m(this.destroy,this),this.scrollTo=m(this.scrollTo,this),this.complete=m(this.complete,this),this.cancel=m(this.cancel,this),this.hide=m(this.hide,this),this.show=m(this.show,this),this.setOptions(b)}return o(c,b),c.prototype.setOptions=function(a){var b,c,d,e;if(this.options=null!=a?a:{},this.destroy(),this.id=this.options.id||this.id||"step-"+k(),this.options.when){e=this.options.when;for(b in e)c=e[b],this.on(b,c,this)}return null!=(d=this.options).buttons?(d=this.options).buttons:d.buttons=[{text:"Next",action:this.shepherd.next}]},c.prototype.bindAdvance=function(){var a,b,c,d,e=this;return d=i(this.options.advanceOn,["event","selector"]),a=d.event,c=d.selector,b=function(a){if(null!=c){if(h(a.target,c))return e.shepherd.advance()}else if(e.el&&a.target===e.el)return e.shepherd.advance()},document.body.addEventListener(a,b),this.on("destroy",function(){return document.body.removeEventListener(a,b)})},c.prototype.getAttachTo=function(){var a;if(a=i(this.options.attachTo,["element","on"]),null==a&&(a={}),"string"==typeof a.element&&(a.element=document.querySelector(a.element),null==a.element))throw new Error("Shepherd step's attachTo was not found in the page");return a},c.prototype.setupTether=function(){var b,c,d;if("undefined"==typeof Tether||null===Tether)throw new Error("Using the attachment feature of Shepherd requires the Tether library");return c=this.getAttachTo(),b=a[c.on||"right"],null==c.element&&(c.element="viewport",b="middle center"),d={classPrefix:"shepherd",element:this.el,constraints:[{to:"window",pin:!0,attachment:"together"}],target:c.element,offset:c.offset||"0 0",attachment:b},this.tether=new Tether(g(d,this.options.tetherOptions))},c.prototype.show=function(){var a,b=this;return null==this.el&&this.render(),e(this.el,"shepherd-open"),null!=(a=this.tether)&&a.enable(),this.options.scrollTo&&setTimeout(function(){return b.scrollTo()}),this.trigger("show")},c.prototype.hide=function(){var a;return j(this.el,"shepherd-open"),null!=(a=this.tether)&&a.disable(),this.trigger("hide")},c.prototype.cancel=function(){return this.hide(),this.trigger("cancel")},c.prototype.complete=function(){return this.hide(),this.trigger("complete")},c.prototype.scrollTo=function(){var a,b,c,d,e,f,g,h,i,j;return e=this.getAttachTo().element,null!=e?(a=jQuery(e),j=a.offset(),i=j.top,g=j.left,f=a.outerHeight(),h=$(this.el).offset(),d=h.top,c=h.left,b=$(this.el).outerHeight(),pageYOffset>i||pageYOffset>d?jQuery(document.body).scrollTop(Math.min(i,d)-10):i+f>pageYOffset+innerHeight||d+b>pageYOffset+innerHeight?jQuery(document.body).scrollTop(Math.max(i+f,d+b)-innerHeight+10):void 0):void 0},c.prototype.destroy=function(){var a;return null!=this.el&&(document.body.removeChild(this.el),delete this.el),null!=(a=this.tether)&&a.destroy(),this.trigger("destroy")},c.prototype.render=function(){var a,b,c,d,e,g,h,i,j,k,l,m,n,o,p,q;if(null!=this.el&&this.destroy(),this.el=f(""),d=document.createElement("div"),d.className="shepherd-content",this.el.appendChild(d),null!=this.options.title&&(g=document.createElement("header"),g.innerHTML=""+this.options.title+"
",this.el.className+=" shepherd-has-title",d.appendChild(g)),null!=this.options.text){for(j=f(""),i=this.options.text,"string"==typeof i&&(i=[i]),k=0,m=i.length;m>k;k++)h=i[k],j.innerHTML+=""+h+"
";d.appendChild(j)}if(e=document.createElement("footer"),this.options.buttons){for(b=f(""),p=this.options.buttons,l=0,n=p.length;n>l;l++)c=p[l],a=f(""+c.text+""),b.appendChild(a),this.bindButtonEvents(c,a.querySelector("a"));e.appendChild(b)}return d.appendChild(e),document.body.appendChild(this.el),this.setupTether(),this.options.advanceOn?this.bindAdvance():void 0},c.prototype.bindButtonEvents=function(a,b){var c,d,e,f,g=this;null==a.events&&(a.events={}),null!=a.action&&(a.events.click=a.action),f=a.events;for(c in f)d=f[c],"string"==typeof d&&(e=d,d=function(){return g.shepherd.show(e)}),b.addEventListener(c,d);return this.on("destroy",function(){var e,f;e=a.events,f=[];for(c in e)d=e[c],f.push(b.removeEventListener(c,d));return f})},c}(b),c=function(a){function b(a){var b;this.options=null!=a?a:{},this.hide=m(this.hide,this),this.cancel=m(this.cancel,this),this.back=m(this.back,this),this.next=m(this.next,this),this.steps=null!=(b=this.options.steps)?b:[]}return o(b,a),b.prototype.addStep=function(a,b){return null==b?b=a:b.id=a,b=g({},this.options.defaults,b),this.steps.push(new d(this,b))},b.prototype.getById=function(a){var b,c,d,e;for(e=this.steps,c=0,d=e.length;d>c;c++)if(b=e[c],b.id===a)return b},b.prototype.next=function(){var a;return a=this.steps.indexOf(this.currentStep),a===this.steps.length-1?(this.hide(a),this.trigger("complete")):this.show(a+1)},b.prototype.back=function(){var a;return a=this.steps.indexOf(this.currentStep),this.show(a-1)},b.prototype.cancel=function(){var a;return null!=(a=this.currentStep)&&a.cancel(),this.trigger("cancel")},b.prototype.hide=function(){var a;return null!=(a=this.currentStep)&&a.hide(),this.trigger("hide")},b.prototype.show=function(a){var b;return null==a&&(a=0),this.currentStep&&this.currentStep.hide(),b="string"==typeof a?this.getById(a):this.steps[a],b?(this.trigger("shown",{step:b,previous:this.currentStep}),this.currentStep=b,b.show()):void 0},b.prototype.start=function(){return this.currentStep=null,this.next()},b}(b),window.Shepherd=c}).call(this);
\ No newline at end of file
diff --git a/ajax/libs/shepherd/0.2.1/shepherd.js b/ajax/libs/shepherd/0.2.1/shepherd.js
new file mode 100644
index 000000000..96d80fd7f
--- /dev/null
+++ b/ajax/libs/shepherd/0.2.1/shepherd.js
@@ -0,0 +1,409 @@
+(function() {
+ var ATTACHMENT, Evented, Shepherd, Step, addClass, createFromHTML, extend, matchesSelector, parseShorthand, removeClass, uniqueId, _ref,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ _ref = Tether.Utils, extend = _ref.extend, removeClass = _ref.removeClass, addClass = _ref.addClass, Evented = _ref.Evented;
+
+ ATTACHMENT = {
+ 'top': 'top center',
+ 'left': 'middle right',
+ 'right': 'middle left',
+ 'bottom': 'bottom center'
+ };
+
+ uniqueId = (function() {
+ var id;
+ id = 0;
+ return function() {
+ return id++;
+ };
+ })();
+
+ createFromHTML = function(html) {
+ var el;
+ el = document.createElement('div');
+ el.innerHTML = html;
+ return el.children[0];
+ };
+
+ matchesSelector = function(el, sel) {
+ var matches, _ref1, _ref2, _ref3, _ref4;
+ matches = (_ref1 = (_ref2 = (_ref3 = (_ref4 = el.matches) != null ? _ref4 : el.matchesSelector) != null ? _ref3 : el.webkitMatchesSelector) != null ? _ref2 : el.mozMatchesSelector) != null ? _ref1 : el.oMatchesSelector;
+ return matches.call(el, sel);
+ };
+
+ parseShorthand = function(obj, props) {
+ var i, out, prop, vals, _i, _len;
+ if (obj == null) {
+ return obj;
+ } else if (typeof obj === 'object') {
+ return obj;
+ } else {
+ vals = obj.split(' ');
+ if (vals.length > props.length) {
+ vals[0] = vals.slice(0, +(vals.length - props.length) + 1 || 9e9).join(' ');
+ vals.splice(1, vals.length - props.length);
+ }
+ out = {};
+ for (i = _i = 0, _len = props.length; _i < _len; i = ++_i) {
+ prop = props[i];
+ out[prop] = vals[i];
+ }
+ return out;
+ }
+ };
+
+ Step = (function(_super) {
+ __extends(Step, _super);
+
+ function Step(shepherd, options) {
+ this.shepherd = shepherd;
+ this.destroy = __bind(this.destroy, this);
+ this.scrollTo = __bind(this.scrollTo, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.hide = __bind(this.hide, this);
+ this.show = __bind(this.show, this);
+ this.setOptions(options);
+ }
+
+ Step.prototype.setOptions = function(options) {
+ var event, handler, _base, _ref1;
+ this.options = options != null ? options : {};
+ this.destroy();
+ this.id = this.options.id || this.id || ("step-" + (uniqueId()));
+ if (this.options.when) {
+ _ref1 = this.options.when;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ this.on(event, handler, this);
+ }
+ }
+ return (_base = this.options).buttons != null ? (_base = this.options).buttons : _base.buttons = [
+ {
+ text: 'Next',
+ action: this.shepherd.next
+ }
+ ];
+ };
+
+ Step.prototype.bindAdvance = function() {
+ var event, handler, selector, _ref1,
+ _this = this;
+ _ref1 = parseShorthand(this.options.advanceOn, ['event', 'selector']), event = _ref1.event, selector = _ref1.selector;
+ handler = function(e) {
+ if (selector != null) {
+ if (matchesSelector(e.target, selector)) {
+ return _this.shepherd.advance();
+ }
+ } else {
+ if (_this.el && e.target === _this.el) {
+ return _this.shepherd.advance();
+ }
+ }
+ };
+ document.body.addEventListener(event, handler);
+ return this.on('destroy', function() {
+ return document.body.removeEventListener(event, handler);
+ });
+ };
+
+ Step.prototype.getAttachTo = function() {
+ var opts;
+ opts = parseShorthand(this.options.attachTo, ['element', 'on']);
+ if (opts == null) {
+ opts = {};
+ }
+ if (typeof opts.element === 'string') {
+ opts.element = document.querySelector(opts.element);
+ if (opts.element == null) {
+ throw new Error("Shepherd step's attachTo was not found in the page");
+ }
+ }
+ return opts;
+ };
+
+ Step.prototype.setupTether = function() {
+ var attachment, opts, tetherOpts;
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("Using the attachment feature of Shepherd requires the Tether library");
+ }
+ opts = this.getAttachTo();
+ attachment = ATTACHMENT[opts.on || 'right'];
+ if (opts.element == null) {
+ opts.element = 'viewport';
+ attachment = 'middle center';
+ }
+ tetherOpts = {
+ classPrefix: 'shepherd',
+ element: this.el,
+ constraints: [
+ {
+ to: 'window',
+ pin: true,
+ attachment: 'together'
+ }
+ ],
+ target: opts.element,
+ offset: opts.offset || '0 0',
+ attachment: attachment
+ };
+ return this.tether = new Tether(extend(tetherOpts, this.options.tetherOptions));
+ };
+
+ Step.prototype.show = function() {
+ var _ref1,
+ _this = this;
+ if (this.el == null) {
+ this.render();
+ }
+ addClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.enable();
+ }
+ if (this.options.scrollTo) {
+ setTimeout(function() {
+ return _this.scrollTo();
+ });
+ }
+ return this.trigger('show');
+ };
+
+ Step.prototype.hide = function() {
+ var _ref1;
+ removeClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.disable();
+ }
+ return this.trigger('hide');
+ };
+
+ Step.prototype.cancel = function() {
+ this.hide();
+ return this.trigger('cancel');
+ };
+
+ Step.prototype.complete = function() {
+ this.hide();
+ return this.trigger('complete');
+ };
+
+ Step.prototype.scrollTo = function() {
+ var $attachTo, elHeight, elLeft, elTop, element, height, left, offset, top, _ref1;
+ element = this.getAttachTo().element;
+ if (element == null) {
+ return;
+ }
+ $attachTo = jQuery(element);
+ _ref1 = $attachTo.offset(), top = _ref1.top, left = _ref1.left;
+ height = $attachTo.outerHeight();
+ offset = $(this.el).offset();
+ elTop = offset.top;
+ elLeft = offset.left;
+ elHeight = $(this.el).outerHeight();
+ if (top < pageYOffset || elTop < pageYOffset) {
+ return jQuery(document.body).scrollTop(Math.min(top, elTop) - 10);
+ } else if ((top + height) > (pageYOffset + innerHeight) || (elTop + elHeight) > (pageYOffset + innerHeight)) {
+ return jQuery(document.body).scrollTop(Math.max(top + height, elTop + elHeight) - innerHeight + 10);
+ }
+ };
+
+ Step.prototype.destroy = function() {
+ var _ref1;
+ if (this.el != null) {
+ document.body.removeChild(this.el);
+ delete this.el;
+ }
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ return this.trigger('destroy');
+ };
+
+ Step.prototype.render = function() {
+ var button, buttons, cfg, content, footer, header, paragraph, paragraphs, text, _i, _j, _len, _len1, _ref1, _ref2, _ref3;
+ if (this.el != null) {
+ this.destroy();
+ }
+ this.el = createFromHTML("");
+ content = document.createElement('div');
+ content.className = 'shepherd-content';
+ this.el.appendChild(content);
+ if (this.options.title != null) {
+ header = document.createElement('header');
+ header.innerHTML = "" + this.options.title + "
";
+ this.el.className += ' shepherd-has-title';
+ content.appendChild(header);
+ }
+ if (this.options.text != null) {
+ text = createFromHTML("");
+ paragraphs = this.options.text;
+ if (typeof paragraphs === 'string') {
+ paragraphs = [paragraphs];
+ }
+ for (_i = 0, _len = paragraphs.length; _i < _len; _i++) {
+ paragraph = paragraphs[_i];
+ text.innerHTML += "" + paragraph + "
";
+ }
+ content.appendChild(text);
+ }
+ footer = document.createElement('footer');
+ if (this.options.buttons) {
+ buttons = createFromHTML("");
+ _ref2 = this.options.buttons;
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
+ cfg = _ref2[_j];
+ button = createFromHTML("" + cfg.text + "");
+ buttons.appendChild(button);
+ this.bindButtonEvents(cfg, button.querySelector('a'));
+ }
+ footer.appendChild(buttons);
+ }
+ content.appendChild(footer);
+ document.body.appendChild(this.el);
+ this.setupTether();
+ if (this.options.advanceOn) {
+ return this.bindAdvance();
+ }
+ };
+
+ Step.prototype.bindButtonEvents = function(cfg, el) {
+ var event, handler, page, _ref1,
+ _this = this;
+ if (cfg.events == null) {
+ cfg.events = {};
+ }
+ if (cfg.action != null) {
+ cfg.events.click = cfg.action;
+ }
+ _ref1 = cfg.events;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ if (typeof handler === 'string') {
+ page = handler;
+ handler = function() {
+ return _this.shepherd.show(page);
+ };
+ }
+ el.addEventListener(event, handler);
+ }
+ return this.on('destroy', function() {
+ var _ref2, _results;
+ _ref2 = cfg.events;
+ _results = [];
+ for (event in _ref2) {
+ handler = _ref2[event];
+ _results.push(el.removeEventListener(event, handler));
+ }
+ return _results;
+ });
+ };
+
+ return Step;
+
+ })(Evented);
+
+ Shepherd = (function(_super) {
+ __extends(Shepherd, _super);
+
+ function Shepherd(options) {
+ var _ref1;
+ this.options = options != null ? options : {};
+ this.hide = __bind(this.hide, this);
+ this.cancel = __bind(this.cancel, this);
+ this.back = __bind(this.back, this);
+ this.next = __bind(this.next, this);
+ this.steps = (_ref1 = this.options.steps) != null ? _ref1 : [];
+ }
+
+ Shepherd.prototype.addStep = function(name, step) {
+ if (step == null) {
+ step = name;
+ } else {
+ step.id = name;
+ }
+ step = extend({}, this.options.defaults, step);
+ return this.steps.push(new Step(this, step));
+ };
+
+ Shepherd.prototype.getById = function(id) {
+ var step, _i, _len, _ref1;
+ _ref1 = this.steps;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ step = _ref1[_i];
+ if (step.id === id) {
+ return step;
+ }
+ }
+ };
+
+ Shepherd.prototype.next = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ if (index === this.steps.length - 1) {
+ this.hide(index);
+ return this.trigger('complete');
+ } else {
+ return this.show(index + 1);
+ }
+ };
+
+ Shepherd.prototype.back = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ return this.show(index - 1);
+ };
+
+ Shepherd.prototype.cancel = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.cancel();
+ }
+ return this.trigger('cancel');
+ };
+
+ Shepherd.prototype.hide = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ return this.trigger('hide');
+ };
+
+ Shepherd.prototype.show = function(key) {
+ var next;
+ if (key == null) {
+ key = 0;
+ }
+ if (this.currentStep) {
+ this.currentStep.hide();
+ }
+ if (typeof key === 'string') {
+ next = this.getById(key);
+ } else {
+ next = this.steps[key];
+ }
+ if (next) {
+ this.trigger('shown', {
+ step: next,
+ previous: this.currentStep
+ });
+ this.currentStep = next;
+ return next.show();
+ }
+ };
+
+ Shepherd.prototype.start = function() {
+ this.currentStep = null;
+ return this.next();
+ };
+
+ return Shepherd;
+
+ })(Evented);
+
+ window.Shepherd = Shepherd;
+
+}).call(this);
diff --git a/ajax/libs/shepherd/0.2.1/shepherd.min.js b/ajax/libs/shepherd/0.2.1/shepherd.min.js
new file mode 100644
index 000000000..0da5e3acc
--- /dev/null
+++ b/ajax/libs/shepherd/0.2.1/shepherd.min.js
@@ -0,0 +1,2 @@
+/*! shepherd.js 0.2.1 */
+(function(){var a,b,c,d,e,f,g,h,i,j,k,l,m=function(a,b){return function(){return a.apply(b,arguments)}},n={}.hasOwnProperty,o=function(a,b){function c(){this.constructor=a}for(var d in b)n.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};l=Tether.Utils,g=l.extend,j=l.removeClass,e=l.addClass,b=l.Evented,a={top:"top center",left:"middle right",right:"middle left",bottom:"bottom center"},k=function(){var a;return a=0,function(){return a++}}(),f=function(a){var b;return b=document.createElement("div"),b.innerHTML=a,b.children[0]},h=function(a,b){var c,d,e,f,g;return c=null!=(d=null!=(e=null!=(f=null!=(g=a.matches)?g:a.matchesSelector)?f:a.webkitMatchesSelector)?e:a.mozMatchesSelector)?d:a.oMatchesSelector,c.call(a,b)},i=function(a,b){var c,d,e,f,g,h;if(null==a)return a;if("object"==typeof a)return a;for(f=a.split(" "),f.length>b.length&&(f[0]=f.slice(0,+(f.length-b.length)+1||9e9).join(" "),f.splice(1,f.length-b.length)),d={},c=g=0,h=b.length;h>g;c=++g)e=b[c],d[e]=f[c];return d},d=function(b){function c(a,b){this.shepherd=a,this.destroy=m(this.destroy,this),this.scrollTo=m(this.scrollTo,this),this.complete=m(this.complete,this),this.cancel=m(this.cancel,this),this.hide=m(this.hide,this),this.show=m(this.show,this),this.setOptions(b)}return o(c,b),c.prototype.setOptions=function(a){var b,c,d,e;if(this.options=null!=a?a:{},this.destroy(),this.id=this.options.id||this.id||"step-"+k(),this.options.when){e=this.options.when;for(b in e)c=e[b],this.on(b,c,this)}return null!=(d=this.options).buttons?(d=this.options).buttons:d.buttons=[{text:"Next",action:this.shepherd.next}]},c.prototype.bindAdvance=function(){var a,b,c,d,e=this;return d=i(this.options.advanceOn,["event","selector"]),a=d.event,c=d.selector,b=function(a){if(null!=c){if(h(a.target,c))return e.shepherd.advance()}else if(e.el&&a.target===e.el)return e.shepherd.advance()},document.body.addEventListener(a,b),this.on("destroy",function(){return document.body.removeEventListener(a,b)})},c.prototype.getAttachTo=function(){var a;if(a=i(this.options.attachTo,["element","on"]),null==a&&(a={}),"string"==typeof a.element&&(a.element=document.querySelector(a.element),null==a.element))throw new Error("Shepherd step's attachTo was not found in the page");return a},c.prototype.setupTether=function(){var b,c,d;if("undefined"==typeof Tether||null===Tether)throw new Error("Using the attachment feature of Shepherd requires the Tether library");return c=this.getAttachTo(),b=a[c.on||"right"],null==c.element&&(c.element="viewport",b="middle center"),d={classPrefix:"shepherd",element:this.el,constraints:[{to:"window",pin:!0,attachment:"together"}],target:c.element,offset:c.offset||"0 0",attachment:b},this.tether=new Tether(g(d,this.options.tetherOptions))},c.prototype.show=function(){var a,b=this;return null==this.el&&this.render(),e(this.el,"shepherd-open"),null!=(a=this.tether)&&a.enable(),this.options.scrollTo&&setTimeout(function(){return b.scrollTo()}),this.trigger("show")},c.prototype.hide=function(){var a;return j(this.el,"shepherd-open"),null!=(a=this.tether)&&a.disable(),this.trigger("hide")},c.prototype.cancel=function(){return this.hide(),this.trigger("cancel")},c.prototype.complete=function(){return this.hide(),this.trigger("complete")},c.prototype.scrollTo=function(){var a,b,c,d,e,f,g,h,i,j;return e=this.getAttachTo().element,null!=e?(a=jQuery(e),j=a.offset(),i=j.top,g=j.left,f=a.outerHeight(),h=$(this.el).offset(),d=h.top,c=h.left,b=$(this.el).outerHeight(),pageYOffset>i||pageYOffset>d?jQuery(document.body).scrollTop(Math.min(i,d)-10):i+f>pageYOffset+innerHeight||d+b>pageYOffset+innerHeight?jQuery(document.body).scrollTop(Math.max(i+f,d+b)-innerHeight+10):void 0):void 0},c.prototype.destroy=function(){var a;return null!=this.el&&(document.body.removeChild(this.el),delete this.el),null!=(a=this.tether)&&a.destroy(),this.trigger("destroy")},c.prototype.render=function(){var a,b,c,d,e,g,h,i,j,k,l,m,n,o,p,q;if(null!=this.el&&this.destroy(),this.el=f(""),d=document.createElement("div"),d.className="shepherd-content",this.el.appendChild(d),null!=this.options.title&&(g=document.createElement("header"),g.innerHTML=""+this.options.title+"
",this.el.className+=" shepherd-has-title",d.appendChild(g)),null!=this.options.text){for(j=f(""),i=this.options.text,"string"==typeof i&&(i=[i]),k=0,m=i.length;m>k;k++)h=i[k],j.innerHTML+=""+h+"
";d.appendChild(j)}if(e=document.createElement("footer"),this.options.buttons){for(b=f(""),p=this.options.buttons,l=0,n=p.length;n>l;l++)c=p[l],a=f(""+c.text+""),b.appendChild(a),this.bindButtonEvents(c,a.querySelector("a"));e.appendChild(b)}return d.appendChild(e),document.body.appendChild(this.el),this.setupTether(),this.options.advanceOn?this.bindAdvance():void 0},c.prototype.bindButtonEvents=function(a,b){var c,d,e,f,g=this;null==a.events&&(a.events={}),null!=a.action&&(a.events.click=a.action),f=a.events;for(c in f)d=f[c],"string"==typeof d&&(e=d,d=function(){return g.shepherd.show(e)}),b.addEventListener(c,d);return this.on("destroy",function(){var e,f;e=a.events,f=[];for(c in e)d=e[c],f.push(b.removeEventListener(c,d));return f})},c}(b),c=function(a){function b(a){var b;this.options=null!=a?a:{},this.hide=m(this.hide,this),this.cancel=m(this.cancel,this),this.back=m(this.back,this),this.next=m(this.next,this),this.steps=null!=(b=this.options.steps)?b:[]}return o(b,a),b.prototype.addStep=function(a,b){return null==b?b=a:b.id=a,b=g({},this.options.defaults,b),this.steps.push(new d(this,b))},b.prototype.getById=function(a){var b,c,d,e;for(e=this.steps,c=0,d=e.length;d>c;c++)if(b=e[c],b.id===a)return b},b.prototype.next=function(){var a;return a=this.steps.indexOf(this.currentStep),a===this.steps.length-1?(this.hide(a),this.trigger("complete")):this.show(a+1)},b.prototype.back=function(){var a;return a=this.steps.indexOf(this.currentStep),this.show(a-1)},b.prototype.cancel=function(){var a;return null!=(a=this.currentStep)&&a.cancel(),this.trigger("cancel")},b.prototype.hide=function(){var a;return null!=(a=this.currentStep)&&a.hide(),this.trigger("hide")},b.prototype.show=function(a){var b;return null==a&&(a=0),this.currentStep&&this.currentStep.hide(),b="string"==typeof a?this.getById(a):this.steps[a],b?(this.trigger("shown",{step:b,previous:this.currentStep}),this.currentStep=b,b.show()):void 0},b.prototype.start=function(){return this.currentStep=null,this.next()},b}(b),window.Shepherd=c}).call(this);
\ No newline at end of file
diff --git a/ajax/libs/shepherd/0.3.0/shepherd.js b/ajax/libs/shepherd/0.3.0/shepherd.js
new file mode 100644
index 000000000..386d41cb0
--- /dev/null
+++ b/ajax/libs/shepherd/0.3.0/shepherd.js
@@ -0,0 +1,1815 @@
+/*! shepherd 0.3.0 */
+/*! tether 0.4.8 */
+(function() {
+ var Evented, addClass, defer, deferred, extend, flush, getBounds, getOffsetParent, getOrigin, getScrollParent, hasClass, node, removeClass, uniqueId, updateClasses, zeroPosCache,
+ __hasProp = {}.hasOwnProperty,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
+ __slice = [].slice;
+
+ if (window.Tether == null) {
+ window.Tether = {};
+ }
+
+ getScrollParent = function(el) {
+ var parent, position, scrollParent, style, _ref;
+ position = getComputedStyle(el).position;
+ if (position === 'fixed') {
+ return el;
+ }
+ scrollParent = void 0;
+ parent = el;
+ while (parent = parent.parentNode) {
+ try {
+ style = getComputedStyle(parent);
+ } catch (_error) {}
+ if (style == null) {
+ return parent;
+ }
+ if (/(auto|scroll)/.test(style['overflow'] + style['overflow-y'] + style['overflow-x'])) {
+ if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) {
+ return parent;
+ }
+ }
+ }
+ return document.body;
+ };
+
+ uniqueId = (function() {
+ var id;
+ id = 0;
+ return function() {
+ return id++;
+ };
+ })();
+
+ zeroPosCache = {};
+
+ getOrigin = function(doc) {
+ var id, k, node, v, _ref;
+ node = doc._tetherZeroElement;
+ if (node == null) {
+ node = doc.createElement('div');
+ node.setAttribute('data-tether-id', uniqueId());
+ extend(node.style, {
+ top: 0,
+ left: 0,
+ position: 'absolute'
+ });
+ doc.body.appendChild(node);
+ doc._tetherZeroElement = node;
+ }
+ id = node.getAttribute('data-tether-id');
+ if (zeroPosCache[id] == null) {
+ zeroPosCache[id] = {};
+ _ref = node.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ zeroPosCache[id][k] = v;
+ }
+ defer(function() {
+ return zeroPosCache[id] = void 0;
+ });
+ }
+ return zeroPosCache[id];
+ };
+
+ node = null;
+
+ getBounds = function(el) {
+ var box, doc, docEl, k, origin, v, _ref;
+ if (el === document) {
+ doc = document;
+ el = document.documentElement;
+ } else {
+ doc = el.ownerDocument;
+ }
+ docEl = doc.documentElement;
+ box = {};
+ _ref = el.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ box[k] = v;
+ }
+ origin = getOrigin(doc);
+ box.top -= origin.top;
+ box.left -= origin.left;
+ box.top = box.top - docEl.clientTop;
+ box.left = box.left - docEl.clientLeft;
+ box.right = doc.body.clientWidth - box.width - box.left;
+ box.bottom = doc.body.clientHeight - box.height - box.top;
+ return box;
+ };
+
+ getOffsetParent = function(el) {
+ return el.offsetParent || document.documentElement;
+ };
+
+ extend = function(out) {
+ var args, key, obj, val, _i, _len, _ref;
+ if (out == null) {
+ out = {};
+ }
+ args = [];
+ Array.prototype.push.apply(args, arguments);
+ _ref = args.slice(1);
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ obj = _ref[_i];
+ if (obj) {
+ for (key in obj) {
+ if (!__hasProp.call(obj, key)) continue;
+ val = obj[key];
+ out[key] = val;
+ }
+ }
+ }
+ return out;
+ };
+
+ removeClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ _results.push(el.classList.remove(cls));
+ }
+ return _results;
+ } else {
+ return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' ');
+ }
+ };
+
+ addClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ _results.push(el.classList.add(cls));
+ }
+ return _results;
+ } else {
+ removeClass(el, name);
+ return el.className += " " + name;
+ }
+ };
+
+ hasClass = function(el, name) {
+ if (el.classList != null) {
+ return el.classList.contains(name);
+ } else {
+ return new RegExp("(^| )" + name + "( |$)", 'gi').test(el.className);
+ }
+ };
+
+ updateClasses = function(el, add, all) {
+ var cls, _i, _j, _len, _len1, _results;
+ for (_i = 0, _len = all.length; _i < _len; _i++) {
+ cls = all[_i];
+ if (__indexOf.call(add, cls) < 0) {
+ if (hasClass(el, cls)) {
+ removeClass(el, cls);
+ }
+ }
+ }
+ _results = [];
+ for (_j = 0, _len1 = add.length; _j < _len1; _j++) {
+ cls = add[_j];
+ if (!hasClass(el, cls)) {
+ _results.push(addClass(el, cls));
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ deferred = [];
+
+ defer = function(fn) {
+ return deferred.push(fn);
+ };
+
+ flush = function() {
+ var fn, _results;
+ _results = [];
+ while (fn = deferred.pop()) {
+ _results.push(fn());
+ }
+ return _results;
+ };
+
+ Evented = (function() {
+ function Evented() {}
+
+ Evented.prototype.on = function(event, handler, ctx, once) {
+ var _base;
+ if (once == null) {
+ once = false;
+ }
+ if (this.bindings == null) {
+ this.bindings = {};
+ }
+ if ((_base = this.bindings)[event] == null) {
+ _base[event] = [];
+ }
+ return this.bindings[event].push({
+ handler: handler,
+ ctx: ctx,
+ once: once
+ });
+ };
+
+ Evented.prototype.once = function(event, handler, ctx) {
+ return this.on(event, handler, ctx, true);
+ };
+
+ Evented.prototype.off = function(event, handler) {
+ var i, _ref, _results;
+ if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
+ return;
+ }
+ if (handler == null) {
+ return delete this.bindings[event];
+ } else {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ if (this.bindings[event][i].handler === handler) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ Evented.prototype.trigger = function() {
+ var args, ctx, event, handler, i, once, _ref, _ref1, _results;
+ event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+ if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
+ handler.apply(ctx != null ? ctx : this, args);
+ if (once) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ return Evented;
+
+ })();
+
+ Tether.Utils = {
+ getScrollParent: getScrollParent,
+ getBounds: getBounds,
+ getOffsetParent: getOffsetParent,
+ extend: extend,
+ addClass: addClass,
+ removeClass: removeClass,
+ hasClass: hasClass,
+ updateClasses: updateClasses,
+ defer: defer,
+ flush: flush,
+ uniqueId: uniqueId,
+ Evented: Evented
+ };
+
+}).call(this);
+
+(function() {
+ var MIRROR_LR, MIRROR_TB, OFFSET_MAP, addClass, addOffset, attachmentToOffset, autoToFixedAttachment, defer, extend, flush, getBounds, getOffsetParent, getOuterSize, getScrollParent, getSize, now, offsetToPx, parseAttachment, parseOffset, position, removeClass, tethers, transformKey, updateClasses, within, _Tether, _ref,
+ __slice = [].slice,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("You must include the utils.js file before tether.js");
+ }
+
+ _ref = Tether.Utils, getScrollParent = _ref.getScrollParent, getSize = _ref.getSize, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getOffsetParent = _ref.getOffsetParent, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, updateClasses = _ref.updateClasses, defer = _ref.defer, flush = _ref.flush;
+
+ within = function(a, b, diff) {
+ if (diff == null) {
+ diff = 1;
+ }
+ return (a + diff >= b && b >= a - diff);
+ };
+
+ transformKey = (function() {
+ var el, key, _i, _len, _ref1;
+ el = document.createElement('div');
+ _ref1 = ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ key = _ref1[_i];
+ if (el.style[key] !== void 0) {
+ return key;
+ }
+ }
+ })();
+
+ tethers = [];
+
+ position = function() {
+ var tether, _i, _len;
+ for (_i = 0, _len = tethers.length; _i < _len; _i++) {
+ tether = tethers[_i];
+ tether.position(false);
+ }
+ return flush();
+ };
+
+ now = function() {
+ var _ref1;
+ return (_ref1 = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref1 : +(new Date);
+ };
+
+ (function() {
+ var event, lastCall, lastDuration, pendingTimeout, tick, _i, _len, _ref1, _results;
+ lastCall = null;
+ lastDuration = null;
+ pendingTimeout = null;
+ tick = function() {
+ if ((lastDuration != null) && lastDuration > 16) {
+ lastDuration = Math.min(lastDuration - 16, 250);
+ pendingTimeout = setTimeout(tick, 250);
+ return;
+ }
+ if ((lastCall != null) && (now() - lastCall) < 10) {
+ return;
+ }
+ if (pendingTimeout != null) {
+ clearTimeout(pendingTimeout);
+ pendingTimeout = null;
+ }
+ lastCall = now();
+ position();
+ return lastDuration = now() - lastCall;
+ };
+ _ref1 = ['resize', 'scroll'];
+ _results = [];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ event = _ref1[_i];
+ _results.push(window.addEventListener(event, tick));
+ }
+ return _results;
+ })();
+
+ MIRROR_LR = {
+ center: 'center',
+ left: 'right',
+ right: 'left'
+ };
+
+ MIRROR_TB = {
+ middle: 'middle',
+ top: 'bottom',
+ bottom: 'top'
+ };
+
+ OFFSET_MAP = {
+ top: 0,
+ left: 0,
+ middle: '50%',
+ center: '50%',
+ bottom: '100%',
+ right: '100%'
+ };
+
+ autoToFixedAttachment = function(attachment, relativeToAttachment) {
+ var left, top;
+ left = attachment.left, top = attachment.top;
+ if (left === 'auto') {
+ left = MIRROR_LR[relativeToAttachment.left];
+ }
+ if (top === 'auto') {
+ top = MIRROR_TB[relativeToAttachment.top];
+ }
+ return {
+ left: left,
+ top: top
+ };
+ };
+
+ attachmentToOffset = function(attachment) {
+ var _ref1, _ref2;
+ return {
+ left: (_ref1 = OFFSET_MAP[attachment.left]) != null ? _ref1 : attachment.left,
+ top: (_ref2 = OFFSET_MAP[attachment.top]) != null ? _ref2 : attachment.top
+ };
+ };
+
+ addOffset = function() {
+ var left, offsets, out, top, _i, _len, _ref1;
+ offsets = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ out = {
+ top: 0,
+ left: 0
+ };
+ for (_i = 0, _len = offsets.length; _i < _len; _i++) {
+ _ref1 = offsets[_i], top = _ref1.top, left = _ref1.left;
+ if (typeof top === 'string') {
+ top = parseFloat(top, 10);
+ }
+ if (typeof left === 'string') {
+ left = parseFloat(left, 10);
+ }
+ out.top += top;
+ out.left += left;
+ }
+ return out;
+ };
+
+ offsetToPx = function(offset, size) {
+ if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
+ offset.left = parseFloat(offset.left, 10) / 100 * size.width;
+ }
+ if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
+ offset.top = parseFloat(offset.top, 10) / 100 * size.height;
+ }
+ return offset;
+ };
+
+ parseAttachment = parseOffset = function(value) {
+ var left, top, _ref1;
+ _ref1 = value.split(' '), top = _ref1[0], left = _ref1[1];
+ return {
+ top: top,
+ left: left
+ };
+ };
+
+ _Tether = (function() {
+ _Tether.modules = [];
+
+ function _Tether(options) {
+ this.position = __bind(this.position, this);
+ var module, _i, _len, _ref1, _ref2;
+ tethers.push(this);
+ this.history = [];
+ this.setOptions(options, false);
+ _ref1 = Tether.modules;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ module = _ref1[_i];
+ if ((_ref2 = module.initialize) != null) {
+ _ref2.call(this);
+ }
+ }
+ this.position();
+ }
+
+ _Tether.prototype.getClass = function(key) {
+ var _ref1, _ref2;
+ if ((_ref1 = this.options.classes) != null ? _ref1[key] : void 0) {
+ return this.options.classes[key];
+ } else if (((_ref2 = this.options.classes) != null ? _ref2[key] : void 0) !== false) {
+ if (this.options.classPrefix) {
+ return "" + this.options.classPrefix + "-" + key;
+ } else {
+ return key;
+ }
+ } else {
+ return '';
+ }
+ };
+
+ _Tether.prototype.setOptions = function(options, position) {
+ var defaults, key, _i, _len, _ref1, _ref2;
+ this.options = options;
+ if (position == null) {
+ position = true;
+ }
+ defaults = {
+ offset: '0 0',
+ targetOffset: '0 0',
+ targetAttachment: 'auto auto',
+ classPrefix: 'tether'
+ };
+ this.options = extend(defaults, this.options);
+ _ref1 = this.options, this.element = _ref1.element, this.target = _ref1.target, this.targetModifier = _ref1.targetModifier;
+ if (this.target === 'viewport') {
+ this.target = document.body;
+ this.targetModifier = 'visible';
+ } else if (this.target === 'scroll-handle') {
+ this.target = document.body;
+ this.targetModifier = 'scroll-handle';
+ }
+ _ref2 = ['element', 'target'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ key = _ref2[_i];
+ if (this[key] == null) {
+ throw new Error("Tether Error: Both element and target must be defined");
+ }
+ if (this[key].jquery != null) {
+ this[key] = this[key][0];
+ } else if (typeof this[key] === 'string') {
+ this[key] = document.querySelector(this[key]);
+ }
+ }
+ addClass(this.element, this.getClass('element'));
+ addClass(this.target, this.getClass('target'));
+ if (!this.options.attachment) {
+ throw new Error("Tether Error: You must provide an attachment");
+ }
+ this.targetAttachment = parseAttachment(this.options.targetAttachment);
+ this.attachment = parseAttachment(this.options.attachment);
+ this.offset = parseOffset(this.options.offset);
+ this.targetOffset = parseOffset(this.options.targetOffset);
+ if (this.scrollParent != null) {
+ this.disable();
+ }
+ if (this.targetModifier === 'scroll-handle') {
+ this.scrollParent = this.target;
+ } else {
+ this.scrollParent = getScrollParent(this.target);
+ }
+ if (this.options.enabled !== false) {
+ return this.enable(position);
+ }
+ };
+
+ _Tether.prototype.getTargetBounds = function() {
+ var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target;
+ if (this.targetModifier != null) {
+ switch (this.targetModifier) {
+ case 'visible':
+ if (this.target === document.body) {
+ return {
+ top: pageYOffset,
+ left: pageXOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(this.target);
+ out = {
+ height: bounds.height,
+ width: bounds.width,
+ top: bounds.top,
+ left: bounds.left
+ };
+ out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
+ out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight)));
+ out.height = Math.min(innerHeight, out.height);
+ out.height -= 2;
+ out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
+ out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth)));
+ out.width = Math.min(innerWidth, out.width);
+ out.width -= 2;
+ if (out.top < pageYOffset) {
+ out.top = pageYOffset;
+ }
+ if (out.left < pageXOffset) {
+ out.left = pageXOffset;
+ }
+ return out;
+ }
+ break;
+ case 'scroll-handle':
+ target = this.target;
+ if (target === document.body) {
+ target = document.documentElement;
+ bounds = {
+ left: pageXOffset,
+ top: pageYOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(target);
+ }
+ style = getComputedStyle(target);
+ hasBottomScroll = target.scrollWidth > target.clientWidth || 'scroll' === [style.overflow, style.overflowX] || this.target !== document.body;
+ scrollBottom = 0;
+ if (hasBottomScroll) {
+ scrollBottom = 15;
+ }
+ height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
+ out = {
+ width: 15,
+ height: height * 0.975 * (height / target.scrollHeight),
+ left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
+ };
+ fitAdj = 0;
+ if (height < 408 && this.target === document.body) {
+ fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
+ }
+ if (this.target !== document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ scrollPercentage = target.scrollTop / (target.scrollHeight - height);
+ out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
+ if (this.target === document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ return out;
+ }
+ } else {
+ return getBounds(this.target);
+ }
+ };
+
+ _Tether.prototype.clearCache = function() {
+ return this._cache = {};
+ };
+
+ _Tether.prototype.cache = function(k, getter) {
+ if (this._cache == null) {
+ this._cache = {};
+ }
+ if (this._cache[k] == null) {
+ this._cache[k] = getter.call(this);
+ }
+ return this._cache[k];
+ };
+
+ _Tether.prototype.enable = function(position) {
+ if (position == null) {
+ position = true;
+ }
+ addClass(this.target, this.getClass('enabled'));
+ addClass(this.element, this.getClass('enabled'));
+ this.enabled = true;
+ if (this.scrollParent !== document) {
+ this.scrollParent.addEventListener('scroll', this.position);
+ }
+ if (position) {
+ return this.position();
+ }
+ };
+
+ _Tether.prototype.disable = function() {
+ removeClass(this.target, this.getClass('enabled'));
+ removeClass(this.element, this.getClass('enabled'));
+ this.enabled = false;
+ if (this.scrollParent != null) {
+ return this.scrollParent.removeEventListener('scroll', this.position);
+ }
+ };
+
+ _Tether.prototype.destroy = function() {
+ var i, tether, _i, _len, _results;
+ this.disable();
+ _results = [];
+ for (i = _i = 0, _len = tethers.length; _i < _len; i = ++_i) {
+ tether = tethers[i];
+ if (tether === this) {
+ tethers.splice(i, 1);
+ break;
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ _Tether.prototype.updateAttachClasses = function(elementAttach, targetAttach) {
+ var add, all, side, sides, _i, _j, _len, _len1, _ref1,
+ _this = this;
+ if (elementAttach == null) {
+ elementAttach = this.attachment;
+ }
+ if (targetAttach == null) {
+ targetAttach = this.targetAttachment;
+ }
+ sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
+ if ((_ref1 = this._addAttachClasses) != null ? _ref1.length : void 0) {
+ this._addAttachClasses.splice(0, this._addAttachClasses.length);
+ }
+ add = this._addAttachClasses != null ? this._addAttachClasses : this._addAttachClasses = [];
+ if (elementAttach.top) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.top);
+ }
+ if (elementAttach.left) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.left);
+ }
+ if (targetAttach.top) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.top);
+ }
+ if (targetAttach.left) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.left);
+ }
+ all = [];
+ for (_i = 0, _len = sides.length; _i < _len; _i++) {
+ side = sides[_i];
+ all.push("" + (this.getClass('element-attached')) + "-" + side);
+ }
+ for (_j = 0, _len1 = sides.length; _j < _len1; _j++) {
+ side = sides[_j];
+ all.push("" + (this.getClass('target-attached')) + "-" + side);
+ }
+ return defer(function() {
+ if (_this._addAttachClasses == null) {
+ return;
+ }
+ updateClasses(_this.element, _this._addAttachClasses, all);
+ updateClasses(_this.target, _this._addAttachClasses, all);
+ return _this._addAttachClasses = void 0;
+ });
+ };
+
+ _Tether.prototype.position = function(flushChanges) {
+ var elementPos, elementStyle, height, left, manualOffset, manualTargetOffset, module, next, offset, offsetBorder, offsetParent, offsetParentSize, offsetParentStyle, offsetPosition, ret, scrollLeft, scrollTop, side, targetAttachment, targetOffset, targetPos, targetSize, top, width, _i, _j, _len, _len1, _ref1, _ref2, _ref3, _ref4,
+ _this = this;
+ if (flushChanges == null) {
+ flushChanges = true;
+ }
+ if (!this.enabled) {
+ return;
+ }
+ this.clearCache();
+ targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
+ this.updateAttachClasses(this.attachment, targetAttachment);
+ elementPos = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ });
+ width = elementPos.width, height = elementPos.height;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref1 = this.lastSize, width = _ref1.width, height = _ref1.height;
+ } else {
+ this.lastSize = {
+ width: width,
+ height: height
+ };
+ }
+ targetSize = targetPos = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ offset = offsetToPx(attachmentToOffset(this.attachment), {
+ width: width,
+ height: height
+ });
+ targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
+ manualOffset = offsetToPx(this.offset, {
+ width: width,
+ height: height
+ });
+ manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
+ offset = addOffset(offset, manualOffset);
+ targetOffset = addOffset(targetOffset, manualTargetOffset);
+ left = targetPos.left + targetOffset.left - offset.left;
+ top = targetPos.top + targetOffset.top - offset.top;
+ _ref2 = Tether.modules;
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ module = _ref2[_i];
+ ret = module.position.call(this, {
+ left: left,
+ top: top,
+ targetAttachment: targetAttachment,
+ targetPos: targetPos,
+ elementPos: elementPos,
+ offset: offset,
+ targetOffset: targetOffset,
+ manualOffset: manualOffset,
+ manualTargetOffset: manualTargetOffset
+ });
+ if ((ret == null) || typeof ret !== 'object') {
+ continue;
+ } else if (ret === false) {
+ return false;
+ } else {
+ top = ret.top, left = ret.left;
+ }
+ }
+ next = {
+ page: {
+ top: top,
+ bottom: document.body.scrollHeight - top - height,
+ left: left,
+ right: document.body.scrollWidth - left - width
+ },
+ viewport: {
+ top: top - pageYOffset,
+ bottom: pageYOffset - top - height + innerHeight,
+ left: left - pageXOffset,
+ right: pageXOffset - left - width + innerWidth
+ }
+ };
+ if (((_ref3 = this.options.optimizations) != null ? _ref3.moveElement : void 0) !== false && (this.targetModifier == null)) {
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ offsetPosition = this.cache('target-offsetparent-bounds', function() {
+ return getBounds(offsetParent);
+ });
+ offsetParentStyle = getComputedStyle(offsetParent);
+ elementStyle = getComputedStyle(this.element);
+ offsetParentSize = offsetPosition;
+ offsetBorder = {};
+ _ref4 = ['top', 'left', 'bottom', 'right'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ offsetBorder[side] = parseFloat(offsetParentStyle["border-" + side + "-width"]);
+ }
+ offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
+ offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
+ if (next.page.top >= (offsetPosition.top + offsetBorder.top) && next.page.bottom >= offsetPosition.bottom) {
+ if (next.page.left >= (offsetPosition.left + offsetBorder.left) && next.page.right >= offsetPosition.right) {
+ scrollTop = offsetParent.scrollTop;
+ scrollLeft = offsetParent.scrollLeft;
+ next.offset = {
+ top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
+ left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
+ };
+ }
+ }
+ }
+ this.move(next);
+ this.history.unshift(next);
+ if (this.history.length > 3) {
+ this.history.pop();
+ }
+ if (flushChanges) {
+ flush();
+ }
+ return true;
+ };
+
+ _Tether.prototype.move = function(position) {
+ var css, elVal, found, key, moved, offsetParent, point, same, transcribe, type, val, write, writeCSS, _i, _len, _ref1, _ref2,
+ _this = this;
+ if (this.element.parentNode == null) {
+ return;
+ }
+ same = {};
+ for (type in position) {
+ same[type] = {};
+ for (key in position[type]) {
+ found = false;
+ _ref1 = this.history;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ point = _ref1[_i];
+ if (!within((_ref2 = point[type]) != null ? _ref2[key] : void 0, position[type][key])) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ same[type][key] = true;
+ }
+ }
+ }
+ css = {
+ top: '',
+ left: '',
+ right: '',
+ bottom: ''
+ };
+ transcribe = function(same, pos) {
+ var xPos, yPos, _ref3;
+ if (((_ref3 = _this.options.optimizations) != null ? _ref3.gpu : void 0) !== false) {
+ if (same.top) {
+ css.top = 0;
+ yPos = pos.top;
+ } else {
+ css.bottom = 0;
+ yPos = -pos.bottom;
+ }
+ if (same.left) {
+ css.left = 0;
+ xPos = pos.left;
+ } else {
+ css.right = 0;
+ xPos = -pos.right;
+ }
+ css[transformKey] = "translateX(" + (Math.round(xPos)) + "px) translateY(" + (Math.round(yPos)) + "px)";
+ if (transformKey !== 'msTransform') {
+ return css[transformKey] += " translateZ(0)";
+ }
+ } else {
+ if (same.top) {
+ css.top = "" + pos.top + "px";
+ } else {
+ css.bottom = "" + pos.bottom + "px";
+ }
+ if (same.left) {
+ return css.left = "" + pos.left + "px";
+ } else {
+ return css.right = "" + pos.right + "px";
+ }
+ }
+ };
+ moved = false;
+ if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
+ css.position = 'absolute';
+ transcribe(same.page, position.page);
+ } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
+ css.position = 'fixed';
+ transcribe(same.viewport, position.viewport);
+ } else if ((same.offset != null) && same.offset.top && same.offset.left) {
+ css.position = 'absolute';
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ if (getOffsetParent(this.element) !== offsetParent) {
+ defer(function() {
+ _this.element.parentNode.removeChild(_this.element);
+ return offsetParent.appendChild(_this.element);
+ });
+ }
+ transcribe(same.offset, position.offset);
+ moved = true;
+ } else {
+ css.position = 'absolute';
+ transcribe({
+ top: true,
+ left: true
+ }, position.page);
+ }
+ if (!moved && this.element.parentNode.tagName !== 'BODY') {
+ this.element.parentNode.removeChild(this.element);
+ document.body.appendChild(this.element);
+ }
+ writeCSS = {};
+ write = false;
+ for (key in css) {
+ val = css[key];
+ elVal = this.element.style[key];
+ if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) {
+ elVal = parseFloat(elVal);
+ val = parseFloat(val);
+ }
+ if (elVal !== val) {
+ write = true;
+ writeCSS[key] = css[key];
+ }
+ }
+ if (write) {
+ return defer(function() {
+ return extend(_this.element.style, writeCSS);
+ });
+ }
+ };
+
+ return _Tether;
+
+ })();
+
+ Tether.position = position;
+
+ window.Tether = extend(_Tether, Tether);
+
+}).call(this);
+
+(function() {
+ var BOUNDS_FORMAT, MIRROR_ATTACH, defer, extend, getBoundingRect, getBounds, getOuterSize, getSize, updateClasses, _ref,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+
+ _ref = Tether.Utils, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getSize = _ref.getSize, extend = _ref.extend, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ MIRROR_ATTACH = {
+ left: 'right',
+ right: 'left',
+ top: 'bottom',
+ bottom: 'top',
+ middle: 'middle'
+ };
+
+ BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
+
+ getBoundingRect = function(tether, to) {
+ var i, pos, side, size, style, _i, _len;
+ if (to === 'scrollParent') {
+ to = tether.scrollParent;
+ } else if (to === 'window') {
+ to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
+ }
+ if (to === document) {
+ to = to.documentElement;
+ }
+ if (to.nodeType != null) {
+ pos = size = getBounds(to);
+ style = getComputedStyle(to);
+ to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
+ for (i = _i = 0, _len = BOUNDS_FORMAT.length; _i < _len; i = ++_i) {
+ side = BOUNDS_FORMAT[i];
+ if (side === 'top' || side === 'left') {
+ to[i] += parseFloat(style["border-" + side + "-width"]);
+ } else {
+ to[i] -= parseFloat(style["border-" + side + "-width"]);
+ }
+ }
+ }
+ return to;
+ };
+
+ Tether.modules.push({
+ position: function(_arg) {
+ var addClasses, allClasses, attachment, bounds, changeAttachX, changeAttachY, cls, constraint, eAttachment, height, left, oob, oobClass, p, pin, pinned, pinnedClass, removeClass, side, tAttachment, targetAttachment, targetHeight, targetSize, targetWidth, to, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8,
+ _this = this;
+ top = _arg.top, left = _arg.left, targetAttachment = _arg.targetAttachment;
+ if (!this.options.constraints) {
+ return true;
+ }
+ removeClass = function(prefix) {
+ var side, _i, _len, _results;
+ _this.removeClass(prefix);
+ _results = [];
+ for (_i = 0, _len = BOUNDS_FORMAT.length; _i < _len; _i++) {
+ side = BOUNDS_FORMAT[_i];
+ _results.push(_this.removeClass("" + prefix + "-" + side));
+ }
+ return _results;
+ };
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref2 = this.lastSize, width = _ref2.width, height = _ref2.height;
+ }
+ targetSize = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ targetHeight = targetSize.height;
+ targetWidth = targetSize.width;
+ tAttachment = {};
+ eAttachment = {};
+ allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
+ _ref3 = this.options.constraints;
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ constraint = _ref3[_i];
+ if (constraint.outOfBoundsClass) {
+ allClasses.push(constraint.outOfBoundsClass);
+ }
+ if (constraint.pinnedClass) {
+ allClasses.push(constraint.pinnedClass);
+ }
+ }
+ for (_j = 0, _len1 = allClasses.length; _j < _len1; _j++) {
+ cls = allClasses[_j];
+ _ref4 = ['left', 'top', 'right', 'bottom'];
+ for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
+ side = _ref4[_k];
+ allClasses.push("" + cls + "-" + side);
+ }
+ }
+ addClasses = [];
+ tAttachment = extend({}, targetAttachment);
+ eAttachment = extend({}, this.attachment);
+ _ref5 = this.options.constraints;
+ for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) {
+ constraint = _ref5[_l];
+ to = constraint.to, attachment = constraint.attachment, pin = constraint.pin;
+ if (attachment == null) {
+ attachment = '';
+ }
+ if (__indexOf.call(attachment, ' ') >= 0) {
+ _ref6 = attachment.split(' '), changeAttachY = _ref6[0], changeAttachX = _ref6[1];
+ } else {
+ changeAttachX = changeAttachY = attachment;
+ }
+ bounds = getBoundingRect(this, to);
+ if (changeAttachY === 'target' || changeAttachY === 'both') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ }
+ }
+ if (changeAttachY === 'together') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ if (eAttachment.top === 'bottom') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top += height;
+ eAttachment.top = 'top';
+ } else if (eAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ if (eAttachment.top === 'top') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (eAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ }
+ if (changeAttachX === 'target' || changeAttachX === 'both') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ }
+ if (left + width > bounds[2] && tAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ }
+ }
+ if (changeAttachX === 'together') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ if (eAttachment.left === 'right') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left += width;
+ eAttachment.left = 'left';
+ } else if (eAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ } else if (left + width > bounds[2] && tAttachment.left === 'right') {
+ if (eAttachment.left === 'left') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (eAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left += width;
+ eAttachment.left = 'left';
+ }
+ }
+ }
+ if (changeAttachY === 'element' || changeAttachY === 'both') {
+ if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (changeAttachX === 'element' || changeAttachX === 'both') {
+ if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ }
+ if (typeof pin === 'string') {
+ pin = (function() {
+ var _len4, _m, _ref7, _results;
+ _ref7 = pin.split(',');
+ _results = [];
+ for (_m = 0, _len4 = _ref7.length; _m < _len4; _m++) {
+ p = _ref7[_m];
+ _results.push(p.trim());
+ }
+ return _results;
+ })();
+ } else if (pin === true) {
+ pin = ['top', 'left', 'right', 'bottom'];
+ }
+ pin || (pin = []);
+ pinned = [];
+ oob = [];
+ if (top < bounds[1]) {
+ if (__indexOf.call(pin, 'top') >= 0) {
+ top = bounds[1];
+ pinned.push('top');
+ } else {
+ oob.push('top');
+ }
+ }
+ if (top + height > bounds[3]) {
+ if (__indexOf.call(pin, 'bottom') >= 0) {
+ top = bounds[3] - height;
+ pinned.push('bottom');
+ } else {
+ oob.push('bottom');
+ }
+ }
+ if (left < bounds[0]) {
+ if (__indexOf.call(pin, 'left') >= 0) {
+ left = bounds[0];
+ pinned.push('left');
+ } else {
+ oob.push('left');
+ }
+ }
+ if (left + width > bounds[2]) {
+ if (__indexOf.call(pin, 'right') >= 0) {
+ left = bounds[2] - width;
+ pinned.push('right');
+ } else {
+ oob.push('right');
+ }
+ }
+ if (pinned.length) {
+ pinnedClass = (_ref7 = this.options.pinnedClass) != null ? _ref7 : this.getClass('pinned');
+ addClasses.push(pinnedClass);
+ for (_m = 0, _len4 = pinned.length; _m < _len4; _m++) {
+ side = pinned[_m];
+ addClasses.push("" + pinnedClass + "-" + side);
+ }
+ }
+ if (oob.length) {
+ oobClass = (_ref8 = this.options.outOfBoundsClass) != null ? _ref8 : this.getClass('out-of-bounds');
+ addClasses.push(oobClass);
+ for (_n = 0, _len5 = oob.length; _n < _len5; _n++) {
+ side = oob[_n];
+ addClasses.push("" + oobClass + "-" + side);
+ }
+ }
+ if (__indexOf.call(pinned, 'left') >= 0 || __indexOf.call(pinned, 'right') >= 0) {
+ eAttachment.left = tAttachment.left = false;
+ }
+ if (__indexOf.call(pinned, 'top') >= 0 || __indexOf.call(pinned, 'bottom') >= 0) {
+ eAttachment.top = tAttachment.top = false;
+ }
+ if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== this.attachment.top || eAttachment.left !== this.attachment.left) {
+ this.updateAttachClasses(eAttachment, tAttachment);
+ }
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+(function() {
+ var defer, getBounds, updateClasses, _ref;
+
+ _ref = Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ Tether.modules.push({
+ position: function(_arg) {
+ var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5,
+ _this = this;
+ top = _arg.top, left = _arg.left;
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ targetPos = this.getTargetBounds();
+ bottom = top + height;
+ right = left + width;
+ abutted = [];
+ if (top <= targetPos.bottom && bottom >= targetPos.top) {
+ _ref2 = ['left', 'right'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ side = _ref2[_i];
+ if ((_ref3 = targetPos[side]) === left || _ref3 === right) {
+ abutted.push(side);
+ }
+ }
+ }
+ if (left <= targetPos.right && right >= targetPos.left) {
+ _ref4 = ['top', 'bottom'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) {
+ abutted.push(side);
+ }
+ }
+ }
+ allClasses = [];
+ addClasses = [];
+ sides = ['left', 'top', 'right', 'bottom'];
+ allClasses.push(this.getClass('abutted'));
+ for (_k = 0, _len2 = sides.length; _k < _len2; _k++) {
+ side = sides[_k];
+ allClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ if (abutted.length) {
+ addClasses.push(this.getClass('abutted'));
+ }
+ for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) {
+ side = abutted[_l];
+ addClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return true;
+ }
+ });
+
+}).call(this);
+
+(function() {
+ Tether.modules.push({
+ position: function(_arg) {
+ var left, result, shift, shiftLeft, shiftTop, top, _ref;
+ top = _arg.top, left = _arg.left;
+ if (!this.options.shift) {
+ return;
+ }
+ result = function(val) {
+ if (typeof val === 'function') {
+ return val.call(this, {
+ top: top,
+ left: left
+ });
+ } else {
+ return val;
+ }
+ };
+ shift = result(this.options.shift);
+ if (typeof shift === 'string') {
+ shift = shift.split(' ');
+ shift[1] || (shift[1] = shift[0]);
+ shiftTop = shift[0], shiftLeft = shift[1];
+ shiftTop = parseFloat(shiftTop, 10);
+ shiftLeft = parseFloat(shiftLeft, 10);
+ } else {
+ _ref = [shift.top, shift.left], shiftTop = _ref[0], shiftLeft = _ref[1];
+ }
+ top += shiftTop;
+ left += shiftLeft;
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+(function() {
+ var ATTACHMENT, Evented, Shepherd, Step, Tour, addClass, createFromHTML, extend, matchesSelector, parseShorthand, removeClass, uniqueId, _ref,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ _ref = Tether.Utils, extend = _ref.extend, removeClass = _ref.removeClass, addClass = _ref.addClass, Evented = _ref.Evented;
+
+ ATTACHMENT = {
+ 'top': 'top center',
+ 'left': 'middle right',
+ 'right': 'middle left',
+ 'bottom': 'bottom center'
+ };
+
+ uniqueId = (function() {
+ var id;
+ id = 0;
+ return function() {
+ return id++;
+ };
+ })();
+
+ createFromHTML = function(html) {
+ var el;
+ el = document.createElement('div');
+ el.innerHTML = html;
+ return el.children[0];
+ };
+
+ matchesSelector = function(el, sel) {
+ var matches, _ref1, _ref2, _ref3, _ref4;
+ matches = (_ref1 = (_ref2 = (_ref3 = (_ref4 = el.matches) != null ? _ref4 : el.matchesSelector) != null ? _ref3 : el.webkitMatchesSelector) != null ? _ref2 : el.mozMatchesSelector) != null ? _ref1 : el.oMatchesSelector;
+ return matches.call(el, sel);
+ };
+
+ parseShorthand = function(obj, props) {
+ var i, out, prop, vals, _i, _len;
+ if (obj == null) {
+ return obj;
+ } else if (typeof obj === 'object') {
+ return obj;
+ } else {
+ vals = obj.split(' ');
+ if (vals.length > props.length) {
+ vals[0] = vals.slice(0, +(vals.length - props.length) + 1 || 9e9).join(' ');
+ vals.splice(1, vals.length - props.length);
+ }
+ out = {};
+ for (i = _i = 0, _len = props.length; _i < _len; i = ++_i) {
+ prop = props[i];
+ out[prop] = vals[i];
+ }
+ return out;
+ }
+ };
+
+ Step = (function(_super) {
+ __extends(Step, _super);
+
+ function Step(tour, options) {
+ this.tour = tour;
+ this.destroy = __bind(this.destroy, this);
+ this.scrollTo = __bind(this.scrollTo, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.isOpen = __bind(this.isOpen, this);
+ this.hide = __bind(this.hide, this);
+ this.show = __bind(this.show, this);
+ this.setOptions(options);
+ this;
+ }
+
+ Step.prototype.setOptions = function(options) {
+ var event, handler, _base, _ref1;
+ this.options = options != null ? options : {};
+ this.destroy();
+ this.id = this.options.id || this.id || ("step-" + (uniqueId()));
+ if (this.options.when) {
+ _ref1 = this.options.when;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ this.on(event, handler, this);
+ }
+ }
+ return (_base = this.options).buttons != null ? (_base = this.options).buttons : _base.buttons = [
+ {
+ text: 'Next',
+ action: this.tour.next
+ }
+ ];
+ };
+
+ Step.prototype.getTour = function() {
+ return this.tour;
+ };
+
+ Step.prototype.bindAdvance = function() {
+ var event, handler, selector, _ref1,
+ _this = this;
+ _ref1 = parseShorthand(this.options.advanceOn, ['event', 'selector']), event = _ref1.event, selector = _ref1.selector;
+ handler = function(e) {
+ if (!_this.isOpen()) {
+ return;
+ }
+ if (selector != null) {
+ if (matchesSelector(e.target, selector)) {
+ return _this.tour.next();
+ }
+ } else {
+ if (_this.el && e.target === _this.el) {
+ return _this.tour.next();
+ }
+ }
+ };
+ document.body.addEventListener(event, handler);
+ return this.on('destroy', function() {
+ return document.body.removeEventListener(event, handler);
+ });
+ };
+
+ Step.prototype.getAttachTo = function() {
+ var opts;
+ opts = parseShorthand(this.options.attachTo, ['element', 'on']);
+ if (opts == null) {
+ opts = {};
+ }
+ if (typeof opts.element === 'string') {
+ opts.element = document.querySelector(opts.element);
+ if (opts.element == null) {
+ throw new Error("Shepherd step's attachTo was not found in the page");
+ }
+ }
+ return opts;
+ };
+
+ Step.prototype.setupTether = function() {
+ var attachment, opts, tetherOpts;
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("Using the attachment feature of Shepherd requires the Tether library");
+ }
+ opts = this.getAttachTo();
+ attachment = ATTACHMENT[opts.on || 'right'];
+ if (opts.element == null) {
+ opts.element = 'viewport';
+ attachment = 'middle center';
+ }
+ tetherOpts = {
+ classPrefix: 'shepherd',
+ element: this.el,
+ constraints: [
+ {
+ to: 'window',
+ pin: true,
+ attachment: 'together'
+ }
+ ],
+ target: opts.element,
+ offset: opts.offset || '0 0',
+ attachment: attachment
+ };
+ return this.tether = new Tether(extend(tetherOpts, this.options.tetherOptions));
+ };
+
+ Step.prototype.show = function() {
+ var _ref1,
+ _this = this;
+ if (this.el == null) {
+ this.render();
+ }
+ addClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.enable();
+ }
+ if (this.options.scrollTo) {
+ setTimeout(function() {
+ return _this.scrollTo();
+ });
+ }
+ return this.trigger('show');
+ };
+
+ Step.prototype.hide = function() {
+ var _ref1;
+ removeClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.disable();
+ }
+ return this.trigger('hide');
+ };
+
+ Step.prototype.isOpen = function() {
+ return hasClass(this.el, 'shepherd-open');
+ };
+
+ Step.prototype.cancel = function() {
+ this.hide();
+ return this.trigger('cancel');
+ };
+
+ Step.prototype.complete = function() {
+ this.hide();
+ return this.trigger('complete');
+ };
+
+ Step.prototype.scrollTo = function() {
+ var $attachTo, elHeight, elLeft, elTop, element, height, left, offset, top, _ref1;
+ element = this.getAttachTo().element;
+ if (element == null) {
+ return;
+ }
+ $attachTo = jQuery(element);
+ _ref1 = $attachTo.offset(), top = _ref1.top, left = _ref1.left;
+ height = $attachTo.outerHeight();
+ offset = $(this.el).offset();
+ elTop = offset.top;
+ elLeft = offset.left;
+ elHeight = $(this.el).outerHeight();
+ if (top < pageYOffset || elTop < pageYOffset) {
+ return jQuery(document.body).scrollTop(Math.min(top, elTop) - 10);
+ } else if ((top + height) > (pageYOffset + innerHeight) || (elTop + elHeight) > (pageYOffset + innerHeight)) {
+ return jQuery(document.body).scrollTop(Math.max(top + height, elTop + elHeight) - innerHeight + 10);
+ }
+ };
+
+ Step.prototype.destroy = function() {
+ var _ref1;
+ if (this.el != null) {
+ document.body.removeChild(this.el);
+ delete this.el;
+ }
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ return this.trigger('destroy');
+ };
+
+ Step.prototype.render = function() {
+ var button, buttons, cfg, content, footer, header, paragraph, paragraphs, text, _i, _j, _len, _len1, _ref1, _ref2, _ref3;
+ if (this.el != null) {
+ this.destroy();
+ }
+ this.el = createFromHTML("");
+ content = document.createElement('div');
+ content.className = 'shepherd-content';
+ this.el.appendChild(content);
+ if (this.options.title != null) {
+ header = document.createElement('header');
+ header.innerHTML = "" + this.options.title + "
";
+ this.el.className += ' shepherd-has-title';
+ content.appendChild(header);
+ }
+ if (this.options.text != null) {
+ text = createFromHTML("");
+ paragraphs = this.options.text;
+ if (typeof paragraphs === 'string') {
+ paragraphs = [paragraphs];
+ }
+ for (_i = 0, _len = paragraphs.length; _i < _len; _i++) {
+ paragraph = paragraphs[_i];
+ text.innerHTML += "" + paragraph + "
";
+ }
+ content.appendChild(text);
+ }
+ footer = document.createElement('footer');
+ if (this.options.buttons) {
+ buttons = createFromHTML("");
+ _ref2 = this.options.buttons;
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
+ cfg = _ref2[_j];
+ button = createFromHTML("" + cfg.text + "");
+ buttons.appendChild(button);
+ this.bindButtonEvents(cfg, button.querySelector('a'));
+ }
+ footer.appendChild(buttons);
+ }
+ content.appendChild(footer);
+ document.body.appendChild(this.el);
+ this.setupTether();
+ if (this.options.advanceOn) {
+ return this.bindAdvance();
+ }
+ };
+
+ Step.prototype.bindButtonEvents = function(cfg, el) {
+ var event, handler, page, _ref1,
+ _this = this;
+ if (cfg.events == null) {
+ cfg.events = {};
+ }
+ if (cfg.action != null) {
+ cfg.events.click = cfg.action;
+ }
+ _ref1 = cfg.events;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ if (typeof handler === 'string') {
+ page = handler;
+ handler = function() {
+ return _this.tour.show(page);
+ };
+ }
+ el.addEventListener(event, handler);
+ }
+ return this.on('destroy', function() {
+ var _ref2, _results;
+ _ref2 = cfg.events;
+ _results = [];
+ for (event in _ref2) {
+ handler = _ref2[event];
+ _results.push(el.removeEventListener(event, handler));
+ }
+ return _results;
+ });
+ };
+
+ return Step;
+
+ })(Evented);
+
+ Tour = (function(_super) {
+ __extends(Tour, _super);
+
+ function Tour(options) {
+ var event, _i, _len, _ref1, _ref2,
+ _this = this;
+ this.options = options != null ? options : {};
+ this.hide = __bind(this.hide, this);
+ this.cancel = __bind(this.cancel, this);
+ this.back = __bind(this.back, this);
+ this.next = __bind(this.next, this);
+ this.steps = (_ref1 = this.options.steps) != null ? _ref1 : [];
+ _ref2 = ['complete', 'cancel', 'hide', 'start', 'show'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ event = _ref2[_i];
+ this.on(event, function(opts) {
+ if (opts == null) {
+ opts = {};
+ }
+ opts.tour = _this;
+ return Shepherd.trigger(event, opts);
+ });
+ }
+ this;
+ }
+
+ Tour.prototype.addStep = function(name, step) {
+ var _ref1;
+ if (step == null) {
+ step = name;
+ }
+ if (!(step instanceof Step)) {
+ if ((_ref1 = typeof name) === 'string' || _ref1 === 'number') {
+ step.id = name.toString();
+ }
+ step = extend({}, this.options.defaults, step);
+ step = new Step(this, step);
+ } else {
+ step.tour = this;
+ }
+ this.steps.push(step);
+ return step;
+ };
+
+ Tour.prototype.getById = function(id) {
+ var step, _i, _len, _ref1;
+ _ref1 = this.steps;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ step = _ref1[_i];
+ if (step.id === id) {
+ return step;
+ }
+ }
+ };
+
+ Tour.prototype.getCurrentStep = function() {
+ return this.currentStep;
+ };
+
+ Tour.prototype.next = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ if (index === this.steps.length - 1) {
+ this.hide(index);
+ this.trigger('complete');
+ return this.done();
+ } else {
+ return this.show(index + 1);
+ }
+ };
+
+ Tour.prototype.back = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ return this.show(index - 1);
+ };
+
+ Tour.prototype.cancel = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.cancel();
+ }
+ this.trigger('cancel');
+ return this.done();
+ };
+
+ Tour.prototype.hide = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('hide');
+ return this.done();
+ };
+
+ Tour.prototype.done = function() {
+ return Shepherd.activeTour = null;
+ };
+
+ Tour.prototype.show = function(key) {
+ var next;
+ if (key == null) {
+ key = 0;
+ }
+ if (this.currentStep) {
+ this.currentStep.hide();
+ }
+ Shepherd.activeTour = this;
+ if (typeof key === 'string') {
+ next = this.getById(key);
+ } else {
+ next = this.steps[key];
+ }
+ if (next) {
+ this.trigger('show', {
+ step: next,
+ previous: this.currentStep
+ });
+ this.currentStep = next;
+ return next.show();
+ }
+ };
+
+ Tour.prototype.start = function() {
+ this.trigger('start');
+ this.currentStep = null;
+ return this.next();
+ };
+
+ return Tour;
+
+ })(Evented);
+
+ Shepherd = new Evented;
+
+ extend(Shepherd, {
+ Tour: Tour,
+ Step: Step
+ });
+
+ window.Shepherd = Shepherd;
+
+}).call(this);
diff --git a/ajax/libs/shepherd/0.3.0/shepherd.min.js b/ajax/libs/shepherd/0.3.0/shepherd.min.js
new file mode 100644
index 000000000..d2bba5f8b
--- /dev/null
+++ b/ajax/libs/shepherd/0.3.0/shepherd.min.js
@@ -0,0 +1,2 @@
+/*! shepherd 0.3.0 */
+(function(){var t,e,n,o,i,s,r,h,l,a,p,u,f,c,d,g,m={}.hasOwnProperty,v=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},b=[].slice;null==window.Tether&&(window.Tether={}),a=function(t){var e,n,o,i,s;if(n=getComputedStyle(t).position,"fixed"===n)return t;for(o=void 0,e=t;e=e.parentNode;){try{i=getComputedStyle(e)}catch(r){}if(null==i)return e;if(/(auto|scroll)/.test(i.overflow+i["overflow-y"]+i["overflow-x"])&&("absolute"!==n||"relative"===(s=i.position)||"absolute"===s||"fixed"===s))return e}return document.body},c=function(){var t;return t=0,function(){return t++}}(),g={},l=function(t){var e,o,s,r,h;if(s=t._tetherZeroElement,null==s&&(s=t.createElement("div"),s.setAttribute("data-tether-id",c()),i(s.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(s),t._tetherZeroElement=s),e=s.getAttribute("data-tether-id"),null==g[e]){g[e]={},h=s.getBoundingClientRect();for(o in h)r=h[o],g[e][o]=r;n(function(){return g[e]=void 0})}return g[e]},u=null,r=function(t){var e,n,o,i,s,r,h;t===document?(n=document,t=document.documentElement):n=t.ownerDocument,o=n.documentElement,e={},h=t.getBoundingClientRect();for(i in h)r=h[i],e[i]=r;return s=l(n),e.top-=s.top,e.left-=s.left,e.top=e.top-o.clientTop,e.left=e.left-o.clientLeft,e.right=n.body.clientWidth-e.width-e.left,e.bottom=n.body.clientHeight-e.height-e.top,e},h=function(t){return t.offsetParent||document.documentElement},i=function(t){var e,n,o,i,s,r,h;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),h=e.slice(1),s=0,r=h.length;r>s;s++)if(o=h[s])for(n in o)m.call(o,n)&&(i=o[n],t[n]=i);return t},f=function(t,e){var n,o,i,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],o=0,i=s.length;i>o;o++)n=s[o],r.push(t.classList.remove(n));return r}return t.className=t.className.replace(new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi")," ")},e=function(t,e){var n,o,i,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],o=0,i=s.length;i>o;o++)n=s[o],r.push(t.classList.add(n));return r}return f(t,e),t.className+=" "+e},p=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},d=function(t,n,o){var i,s,r,h,l,a;for(s=0,h=o.length;h>s;s++)i=o[s],v.call(n,i)<0&&p(t,i)&&f(t,i);for(a=[],r=0,l=n.length;l>r;r++)i=n[r],a.push(p(t,i)?void 0:e(t,i));return a},o=[],n=function(t){return o.push(t)},s=function(){var t,e;for(e=[];t=o.pop();)e.push(t());return e},t=function(){function t(){}return t.prototype.on=function(t,e,n,o){var i;return null==o&&(o=!1),null==this.bindings&&(this.bindings={}),null==(i=this.bindings)[t]&&(i[t]=[]),this.bindings[t].push({handler:e,ctx:n,once:o})},t.prototype.once=function(t,e,n){return this.on(t,e,n,!0)},t.prototype.off=function(t,e){var n,o,i;if(null!=(null!=(o=this.bindings)?o[t]:void 0)){if(null==e)return delete this.bindings[t];for(n=0,i=[];n=e&&e>=t-n},T=function(){var t,e,n,o,i;for(t=document.createElement("div"),i=["transform","webkitTransform","OTransform","MozTransform","msTransform"],n=0,o=i.length;o>n;n++)if(e=i[n],void 0!==t.style[e])return e}(),C=[],y=function(){var t,e,n;for(e=0,n=C.length;n>e;e++)t=C[e],t.position(!1);return a()},g=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance?"function"==typeof performance.now?performance.now():void 0:void 0)?t:+new Date},function(){var t,e,n,o,i,s,r,h,l;for(e=null,n=null,o=null,i=function(){if(null!=n&&n>16)return n=Math.min(n-16,250),void(o=setTimeout(i,250));if(!(null!=e&&g()-e<10))return null!=o&&(clearTimeout(o),o=null),e=g(),y(),n=g()-e},h=["resize","scroll"],l=[],s=0,r=h.length;r>s;s++)t=h[s],l.push(window.addEventListener(t,i));return l}(),t={center:"center",left:"right",right:"left"},e={middle:"middle",top:"bottom",bottom:"top"},n={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},r=function(n,o){var i,s;return i=n.left,s=n.top,"auto"===i&&(i=t[o.left]),"auto"===s&&(s=e[o.top]),{left:i,top:s}},s=function(t){var e,o;return{left:null!=(e=n[t.left])?e:t.left,top:null!=(o=n[t.top])?o:t.top}},i=function(){var t,e,n,o,i,s,r;for(e=1<=arguments.length?M.call(arguments,0):[],n={top:0,left:0},i=0,s=e.length;s>i;i++)r=e[i],o=r.top,t=r.left,"string"==typeof o&&(o=parseFloat(o,10)),"string"==typeof t&&(t=parseFloat(t,10)),n.top+=o,n.left+=t;return n},m=function(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t},v=b=function(t){var e,n,o;return o=t.split(" "),n=o[0],e=o[1],{top:n,left:e}},S=function(){function t(t){this.position=A(this.position,this);var e,n,o,i,s;for(C.push(this),this.history=[],this.setOptions(t,!1),i=Tether.modules,n=0,o=i.length;o>n;n++)e=i[n],null!=(s=e.initialize)&&s.call(this);this.position()}return t.modules=[],t.prototype.getClass=function(t){var e,n;return(null!=(e=this.options.classes)?e[t]:void 0)?this.options.classes[t]:(null!=(n=this.options.classes)?n[t]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+t:t:""},t.prototype.setOptions=function(t,e){var n,i,s,r,h,a;for(this.options=t,null==e&&(e=!0),n={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=l(n,this.options),h=this.options,this.element=h.element,this.target=h.target,this.targetModifier=h.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),a=["element","target"],s=0,r=a.length;r>s;s++){if(i=a[s],null==this[i])throw new Error("Tether Error: Both element and target must be defined");null!=this[i].jquery?this[i]=this[i][0]:"string"==typeof this[i]&&(this[i]=document.querySelector(this[i]))}if(o(this.element,this.getClass("element")),o(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=v(this.options.targetAttachment),this.attachment=v(this.options.attachment),this.offset=b(this.options.offset),this.targetOffset=b(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent="scroll-handle"===this.targetModifier?this.target:c(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,n,o,i,s,r,h,l;if(null==this.targetModifier)return p(this.target);switch(this.targetModifier){case"visible":return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:(t=p(this.target),i={height:t.height,width:t.width,top:t.top,left:t.left},i.height=Math.min(i.height,t.height-(pageYOffset-t.top)),i.height=Math.min(i.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),i.height=Math.min(innerHeight,i.height),i.height-=2,i.width=Math.min(i.width,t.width-(pageXOffset-t.left)),i.width=Math.min(i.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),i.width=Math.min(innerWidth,i.width),i.width-=2,i.topl.clientWidth||"scroll"===[h.overflow,h.overflowX]||this.target!==document.body,s=0,n&&(s=15),o=t.height-parseFloat(h.borderTopWidth)-parseFloat(h.borderBottomWidth)-s,i={width:15,height:.975*o*(o/l.scrollHeight),left:t.left+t.width-parseFloat(h.borderLeftWidth)-15},e=0,408>o&&this.target===document.body&&(e=-11e-5*Math.pow(o,2)-.00727*o+22.58),this.target!==document.body&&(i.height=Math.max(i.height,24)),r=l.scrollTop/(l.scrollHeight-o),i.top=r*(o-i.height-e)+t.top+parseFloat(h.borderTopWidth),this.target===document.body&&(i.height=Math.max(i.height,24)),i}},t.prototype.clearCache=function(){return this._cache={}},t.prototype.cache=function(t,e){return null==this._cache&&(this._cache={}),null==this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},t.prototype.enable=function(t){return null==t&&(t=!0),o(this.target,this.getClass("enabled")),o(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t?this.position():void 0},t.prototype.disable=function(){return w(this.target,this.getClass("enabled")),w(this.element,this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},t.prototype.destroy=function(){var t,e,n,o,i;for(this.disable(),i=[],t=n=0,o=C.length;o>n;t=++n){if(e=C[t],e===this){C.splice(t,1);break}i.push(void 0)}return i},t.prototype.updateAttachClasses=function(t,e){var n,o,i,s,r,l,a,p,u,f=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),s=["left","top","bottom","right","middle","center"],(null!=(u=this._addAttachClasses)?u.length:void 0)&&this._addAttachClasses.splice(0,this._addAttachClasses.length),n=null!=this._addAttachClasses?this._addAttachClasses:this._addAttachClasses=[],t.top&&n.push(""+this.getClass("element-attached")+"-"+t.top),t.left&&n.push(""+this.getClass("element-attached")+"-"+t.left),e.top&&n.push(""+this.getClass("target-attached")+"-"+e.top),e.left&&n.push(""+this.getClass("target-attached")+"-"+e.left),o=[],r=0,a=s.length;a>r;r++)i=s[r],o.push(""+this.getClass("element-attached")+"-"+i);for(l=0,p=s.length;p>l;l++)i=s[l],o.push(""+this.getClass("target-attached")+"-"+i);return h(function(){return null!=f._addAttachClasses?(O(f.element,f._addAttachClasses,o),O(f.target,f._addAttachClasses,o),f._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,n,o,h,l,f,c,d,g,v,b,y,w,C,T,O,x,S,E,M,A,_,P,B,H,L,Y,z,F,W,N,X,j=this;if(null==t&&(t=!0),this.enabled){for(this.clearCache(),E=r(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,E),e=this.cache("element-bounds",function(){return p(j.element)}),B=e.width,o=e.height,0===B&&0===o&&null!=this.lastSize?(F=this.lastSize,B=F.width,o=F.height):this.lastSize={width:B,height:o},_=A=this.cache("target-bounds",function(){return j.getTargetBounds()}),g=m(s(this.attachment),{width:B,height:o}),M=m(s(E),_),l=m(this.offset,{width:B,height:o}),f=m(this.targetOffset,_),g=i(g,l),M=i(M,f),h=A.left+M.left-g.left,P=A.top+M.top-g.top,W=Tether.modules,H=0,Y=W.length;Y>H;H++)if(c=W[H],T=c.position.call(this,{left:h,top:P,targetAttachment:E,targetPos:A,elementPos:e,offset:g,targetOffset:M,manualOffset:l,manualTargetOffset:f}),null!=T&&"object"==typeof T){if(T===!1)return!1;P=T.top,h=T.left}if(d={page:{top:P,bottom:document.body.scrollHeight-P-o,left:h,right:document.body.scrollWidth-h-B},viewport:{top:P-pageYOffset,bottom:pageYOffset-P-o+innerHeight,left:h-pageXOffset,right:pageXOffset-h-B+innerWidth}},(null!=(N=this.options.optimizations)?N.moveElement:void 0)!==!1&&null==this.targetModifier){for(b=this.cache("target-offsetparent",function(){return u(j.target)}),C=this.cache("target-offsetparent-bounds",function(){return p(b)}),w=getComputedStyle(b),n=getComputedStyle(this.element),y=C,v={},X=["top","left","bottom","right"],L=0,z=X.length;z>L;L++)S=X[L],v[S]=parseFloat(w["border-"+S+"-width"]);C.right=document.body.scrollWidth-C.left-y.width+v.right,C.bottom=document.body.scrollHeight-C.top-y.height+v.bottom,d.page.top>=C.top+v.top&&d.page.bottom>=C.bottom&&d.page.left>=C.left+v.left&&d.page.right>=C.right&&(x=b.scrollTop,O=b.scrollLeft,d.offset={top:d.page.top-C.top+x-v.top,left:d.page.left-C.left+O-v.left})}return this.move(d),this.history.unshift(d),this.history.length>3&&this.history.pop(),t&&a(),!0}},t.prototype.move=function(t){var e,n,o,i,s,r,a,p,f,c,d,g,m,v,b,y,w,C=this;if(null!=this.element.parentNode){p={};for(c in t){p[c]={};for(i in t[c]){for(o=!1,y=this.history,v=0,b=y.length;b>v;v++)if(a=y[v],!x(null!=(w=a[c])?w[i]:void 0,t[c][i])){o=!0;break}o||(p[c][i]=!0)}}e={top:"",left:"",right:"",bottom:""},f=function(t,n){var o,i,s;return(null!=(s=C.options.optimizations)?s.gpu:void 0)===!1?(t.top?e.top=""+n.top+"px":e.bottom=""+n.bottom+"px",t.left?e.left=""+n.left+"px":e.right=""+n.right+"px"):(t.top?(e.top=0,i=n.top):(e.bottom=0,i=-n.bottom),t.left?(e.left=0,o=n.left):(e.right=0,o=-n.right),e[T]="translateX("+Math.round(o)+"px) translateY("+Math.round(i)+"px)","msTransform"!==T?e[T]+=" translateZ(0)":void 0)},s=!1,(p.page.top||p.page.bottom)&&(p.page.left||p.page.right)?(e.position="absolute",f(p.page,t.page)):(p.viewport.top||p.viewport.bottom)&&(p.viewport.left||p.viewport.right)?(e.position="fixed",f(p.viewport,t.viewport)):null!=p.offset&&p.offset.top&&p.offset.left?(e.position="absolute",r=this.cache("target-offsetparent",function(){return u(C.target)}),u(this.element)!==r&&h(function(){return C.element.parentNode.removeChild(C.element),r.appendChild(C.element)}),f(p.offset,t.offset),s=!0):(e.position="absolute",f({top:!0,left:!0},t.page)),s||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),m={},g=!1;for(i in e)d=e[i],n=this.element.style[i],""===n||""===d||"top"!==i&&"left"!==i&&"bottom"!==i&&"right"!==i||(n=parseFloat(n),d=parseFloat(d)),n!==d&&(g=!0,m[i]=e[i]);return g?h(function(){return l(C.element.style,m)}):void 0}},t}(),Tether.position=y,window.Tether=l(S,Tether)}.call(this),function(){var t,e,n,o,i,s,r,h,l,a,p=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};a=Tether.Utils,r=a.getOuterSize,s=a.getBounds,h=a.getSize,o=a.extend,l=a.updateClasses,n=a.defer,e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},t=["left","top","right","bottom"],i=function(e,n){var o,i,r,h,l,a,p;if("scrollParent"===n?n=e.scrollParent:"window"===n&&(n=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),n===document&&(n=n.documentElement),null!=n.nodeType)for(i=h=s(n),l=getComputedStyle(n),n=[i.left,i.top,h.width+i.left,h.height+i.top],o=a=0,p=t.length;p>a;o=++a)r=t[o],"top"===r||"left"===r?n[o]+=parseFloat(l["border-"+r+"-width"]):n[o]-=parseFloat(l["border-"+r+"-width"]);return n},Tether.modules.push({position:function(e){var r,h,a,u,f,c,d,g,m,v,b,y,w,C,T,O,x,S,E,M,A,_,P,B,H,L,Y,z,F,W,N,X,j,k,q,U,R,$,D,I,Q,Z,G,J,K,V,te,ee=this;if(L=e.top,b=e.left,A=e.targetAttachment,!this.options.constraints)return!0;for(S=function(e){var n,o,i,s;for(ee.removeClass(e),s=[],o=0,i=t.length;i>o;o++)n=t[o],s.push(ee.removeClass(""+e+"-"+n));return s},I=this.cache("element-bounds",function(){return s(ee.element)}),v=I.height,Y=I.width,0===Y&&0===v&&null!=this.lastSize&&(Q=this.lastSize,Y=Q.width,v=Q.height),P=this.cache("target-bounds",function(){return ee.getTargetBounds()}),_=P.height,B=P.width,M={},m={},h=[this.getClass("pinned"),this.getClass("out-of-bounds")],Z=this.options.constraints,z=0,X=Z.length;X>z;z++)g=Z[z],g.outOfBoundsClass&&h.push(g.outOfBoundsClass),g.pinnedClass&&h.push(g.pinnedClass);for(F=0,j=h.length;j>F;F++)for(d=h[F],G=["left","top","right","bottom"],W=0,k=G.length;k>W;W++)E=G[W],h.push(""+d+"-"+E);for(r=[],M=o({},A),m=o({},this.attachment),J=this.options.constraints,N=0,q=J.length;q>N;N++){if(g=J[N],H=g.to,a=g.attachment,T=g.pin,null==a&&(a=""),p.call(a," ")>=0?(K=a.split(" "),c=K[0],f=K[1]):f=c=a,u=i(this,H),("target"===c||"both"===c)&&(Lu[3]&&"bottom"===M.top&&(L-=_,M.top="top")),"together"===c&&(Lu[3]&&"bottom"===M.top&&("top"===m.top?(L-=_,M.top="top",L-=v,m.top="bottom"):"bottom"===m.top&&(L-=_,M.top="top",L+=v,m.top="top"))),("target"===f||"both"===f)&&(bu[2]&&"right"===M.left&&(b-=B,M.left="left")),"together"===f&&(bu[2]&&"right"===M.left&&("left"===m.left?(b-=B,M.left="left",b-=Y,m.left="right"):"right"===m.left&&(b-=B,M.left="left",b+=Y,m.left="left"))),("element"===c||"both"===c)&&(Lu[3]&&"top"===m.top&&(L-=v,m.top="bottom")),("element"===f||"both"===f)&&(bu[2]&&"left"===m.left&&(b-=Y,m.left="right")),"string"==typeof T?T=function(){var t,e,n,o;for(n=T.split(","),o=[],e=0,t=n.length;t>e;e++)C=n[e],o.push(C.trim());return o}():T===!0&&(T=["top","left","right","bottom"]),T||(T=[]),O=[],y=[],L=0?(L=u[1],O.push("top")):y.push("top")),L+v>u[3]&&(p.call(T,"bottom")>=0?(L=u[3]-v,O.push("bottom")):y.push("bottom")),b=0?(b=u[0],O.push("left")):y.push("left")),b+Y>u[2]&&(p.call(T,"right")>=0?(b=u[2]-Y,O.push("right")):y.push("right")),O.length)for(x=null!=(V=this.options.pinnedClass)?V:this.getClass("pinned"),r.push(x),$=0,U=O.length;U>$;$++)E=O[$],r.push(""+x+"-"+E);if(y.length)for(w=null!=(te=this.options.outOfBoundsClass)?te:this.getClass("out-of-bounds"),r.push(w),D=0,R=y.length;R>D;D++)E=y[D],r.push(""+w+"-"+E);(p.call(O,"left")>=0||p.call(O,"right")>=0)&&(m.left=M.left=!1),(p.call(O,"top")>=0||p.call(O,"bottom")>=0)&&(m.top=M.top=!1),(M.top!==A.top||M.left!==A.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,M)}return n(function(){return l(ee.target,r,h),l(ee.element,r,h)}),{top:L,left:b}}})}.call(this),function(){var t,e,n,o;o=Tether.Utils,e=o.getBounds,n=o.updateClasses,t=o.defer,Tether.modules.push({position:function(o){var i,s,r,h,l,a,p,u,f,c,d,g,m,v,b,y,w,C,T,O,x,S,E,M,A,_=this;if(d=o.top,a=o.left,x=this.cache("element-bounds",function(){return e(_.element)}),l=x.height,g=x.width,c=this.getTargetBounds(),h=d+l,p=a+g,i=[],d<=c.bottom&&h>=c.top)for(S=["left","right"],m=0,w=S.length;w>m;m++)u=S[m],((E=c[u])===a||E===p)&&i.push(u);if(a<=c.right&&p>=c.left)for(M=["top","bottom"],v=0,C=M.length;C>v;v++)u=M[v],((A=c[u])===d||A===h)&&i.push(u);for(r=[],s=[],f=["left","top","right","bottom"],r.push(this.getClass("abutted")),b=0,T=f.length;T>b;b++)u=f[b],r.push(""+this.getClass("abutted")+"-"+u);for(i.length&&s.push(this.getClass("abutted")),y=0,O=i.length;O>y;y++)u=i[y],s.push(""+this.getClass("abutted")+"-"+u);return t(function(){return n(_.target,s,r),n(_.element,s,r)}),!0}})}.call(this),function(){Tether.modules.push({position:function(t){var e,n,o,i,s,r,h;return r=t.top,e=t.left,this.options.shift?(n=function(t){return"function"==typeof t?t.call(this,{top:r,left:e}):t},o=n(this.options.shift),"string"==typeof o?(o=o.split(" "),o[1]||(o[1]=o[0]),s=o[0],i=o[1],s=parseFloat(s,10),i=parseFloat(i,10)):(h=[o.top,o.left],s=h[0],i=h[1]),r+=s,e+=i,{top:r,left:e}):void 0}})}.call(this),function(){var t,e,n,o,i,s,r,h,l,a,p,u,f,c=function(t,e){return function(){return t.apply(e,arguments)}},d={}.hasOwnProperty,g=function(t,e){function n(){this.constructor=t}for(var o in e)d.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};f=Tether.Utils,h=f.extend,p=f.removeClass,s=f.addClass,e=f.Evented,t={top:"top center",left:"middle right",right:"middle left",bottom:"bottom center"},u=function(){var t;return t=0,function(){return t++}}(),r=function(t){var e;return e=document.createElement("div"),e.innerHTML=t,e.children[0]},l=function(t,e){var n,o,i,s,r;return n=null!=(o=null!=(i=null!=(s=null!=(r=t.matches)?r:t.matchesSelector)?s:t.webkitMatchesSelector)?i:t.mozMatchesSelector)?o:t.oMatchesSelector,n.call(t,e)},a=function(t,e){var n,o,i,s,r,h;if(null==t)return t;if("object"==typeof t)return t;for(s=t.split(" "),s.length>e.length&&(s[0]=s.slice(0,+(s.length-e.length)+1||9e9).join(" "),s.splice(1,s.length-e.length)),o={},n=r=0,h=e.length;h>r;n=++r)i=e[n],o[i]=s[n];return o},o=function(e){function n(t,e){this.tour=t,this.destroy=c(this.destroy,this),this.scrollTo=c(this.scrollTo,this),this.complete=c(this.complete,this),this.cancel=c(this.cancel,this),this.isOpen=c(this.isOpen,this),this.hide=c(this.hide,this),this.show=c(this.show,this),this.setOptions(e)}return g(n,e),n.prototype.setOptions=function(t){var e,n,o,i;if(this.options=null!=t?t:{},this.destroy(),this.id=this.options.id||this.id||"step-"+u(),this.options.when){i=this.options.when;for(e in i)n=i[e],this.on(e,n,this)}return null!=(o=this.options).buttons?(o=this.options).buttons:o.buttons=[{text:"Next",action:this.tour.next}]},n.prototype.getTour=function(){return this.tour},n.prototype.bindAdvance=function(){var t,e,n,o,i=this;return o=a(this.options.advanceOn,["event","selector"]),t=o.event,n=o.selector,e=function(t){if(i.isOpen())if(null!=n){if(l(t.target,n))return i.tour.next()}else if(i.el&&t.target===i.el)return i.tour.next()},document.body.addEventListener(t,e),this.on("destroy",function(){return document.body.removeEventListener(t,e)})},n.prototype.getAttachTo=function(){var t;if(t=a(this.options.attachTo,["element","on"]),null==t&&(t={}),"string"==typeof t.element&&(t.element=document.querySelector(t.element),null==t.element))throw new Error("Shepherd step's attachTo was not found in the page");return t},n.prototype.setupTether=function(){var e,n,o;if("undefined"==typeof Tether||null===Tether)throw new Error("Using the attachment feature of Shepherd requires the Tether library");return n=this.getAttachTo(),e=t[n.on||"right"],null==n.element&&(n.element="viewport",e="middle center"),o={classPrefix:"shepherd",element:this.el,constraints:[{to:"window",pin:!0,attachment:"together"}],target:n.element,offset:n.offset||"0 0",attachment:e},this.tether=new Tether(h(o,this.options.tetherOptions))},n.prototype.show=function(){var t,e=this;return null==this.el&&this.render(),s(this.el,"shepherd-open"),null!=(t=this.tether)&&t.enable(),this.options.scrollTo&&setTimeout(function(){return e.scrollTo()}),this.trigger("show")},n.prototype.hide=function(){var t;return p(this.el,"shepherd-open"),null!=(t=this.tether)&&t.disable(),this.trigger("hide")},n.prototype.isOpen=function(){return hasClass(this.el,"shepherd-open")},n.prototype.cancel=function(){return this.hide(),this.trigger("cancel")},n.prototype.complete=function(){return this.hide(),this.trigger("complete")},n.prototype.scrollTo=function(){var t,e,n,o,i,s,r,h,l,a;return i=this.getAttachTo().element,null!=i?(t=jQuery(i),a=t.offset(),l=a.top,r=a.left,s=t.outerHeight(),h=$(this.el).offset(),o=h.top,n=h.left,e=$(this.el).outerHeight(),pageYOffset>l||pageYOffset>o?jQuery(document.body).scrollTop(Math.min(l,o)-10):l+s>pageYOffset+innerHeight||o+e>pageYOffset+innerHeight?jQuery(document.body).scrollTop(Math.max(l+s,o+e)-innerHeight+10):void 0):void 0},n.prototype.destroy=function(){var t;return null!=this.el&&(document.body.removeChild(this.el),delete this.el),null!=(t=this.tether)&&t.destroy(),this.trigger("destroy")},n.prototype.render=function(){var t,e,n,o,i,s,h,l,a,p,u,f,c,d,g,m;if(null!=this.el&&this.destroy(),this.el=r(""),o=document.createElement("div"),o.className="shepherd-content",this.el.appendChild(o),null!=this.options.title&&(s=document.createElement("header"),s.innerHTML=""+this.options.title+"
",this.el.className+=" shepherd-has-title",o.appendChild(s)),null!=this.options.text){for(a=r(""),l=this.options.text,"string"==typeof l&&(l=[l]),p=0,f=l.length;f>p;p++)h=l[p],a.innerHTML+=""+h+"
";o.appendChild(a)}if(i=document.createElement("footer"),this.options.buttons){for(e=r(""),g=this.options.buttons,u=0,c=g.length;c>u;u++)n=g[u],t=r(""+n.text+""),e.appendChild(t),this.bindButtonEvents(n,t.querySelector("a"));i.appendChild(e)}return o.appendChild(i),document.body.appendChild(this.el),this.setupTether(),this.options.advanceOn?this.bindAdvance():void 0},n.prototype.bindButtonEvents=function(t,e){var n,o,i,s,r=this;null==t.events&&(t.events={}),null!=t.action&&(t.events.click=t.action),s=t.events;for(n in s)o=s[n],"string"==typeof o&&(i=o,o=function(){return r.tour.show(i)}),e.addEventListener(n,o);return this.on("destroy",function(){var i,s;i=t.events,s=[];for(n in i)o=i[n],s.push(e.removeEventListener(n,o));return s})},n}(e),i=function(t){function e(t){var e,o,i,s,r,h=this;for(this.options=null!=t?t:{},this.hide=c(this.hide,this),this.cancel=c(this.cancel,this),this.back=c(this.back,this),this.next=c(this.next,this),this.steps=null!=(s=this.options.steps)?s:[],r=["complete","cancel","hide","start","show"],o=0,i=r.length;i>o;o++)e=r[o],this.on(e,function(t){return null==t&&(t={}),t.tour=h,n.trigger(e,t)})}return g(e,t),e.prototype.addStep=function(t,e){var n;return null==e&&(e=t),e instanceof o?e.tour=this:(("string"==(n=typeof t)||"number"===n)&&(e.id=t.toString()),e=h({},this.options.defaults,e),e=new o(this,e)),this.steps.push(e),e},e.prototype.getById=function(t){var e,n,o,i;for(i=this.steps,n=0,o=i.length;o>n;n++)if(e=i[n],e.id===t)return e},e.prototype.getCurrentStep=function(){return this.currentStep},e.prototype.next=function(){var t;return t=this.steps.indexOf(this.currentStep),t===this.steps.length-1?(this.hide(t),this.trigger("complete"),this.done()):this.show(t+1)},e.prototype.back=function(){var t;return t=this.steps.indexOf(this.currentStep),this.show(t-1)},e.prototype.cancel=function(){var t;return null!=(t=this.currentStep)&&t.cancel(),this.trigger("cancel"),this.done()},e.prototype.hide=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("hide"),this.done()},e.prototype.done=function(){return n.activeTour=null},e.prototype.show=function(t){var e;return null==t&&(t=0),this.currentStep&&this.currentStep.hide(),n.activeTour=this,e="string"==typeof t?this.getById(t):this.steps[t],e?(this.trigger("show",{step:e,previous:this.currentStep}),this.currentStep=e,e.show()):void 0},e.prototype.start=function(){return this.trigger("start"),this.currentStep=null,this.next()},e}(e),n=new e,h(n,{Tour:i,Step:o}),window.Shepherd=n}.call(this);
\ No newline at end of file
diff --git a/ajax/libs/shepherd/0.3.1/shepherd.js b/ajax/libs/shepherd/0.3.1/shepherd.js
new file mode 100644
index 000000000..e7af1e598
--- /dev/null
+++ b/ajax/libs/shepherd/0.3.1/shepherd.js
@@ -0,0 +1,1793 @@
+/*! shepherd 0.3.1 */
+/*! tether 0.4.8 */
+(function() {
+ var Evented, addClass, defer, deferred, extend, flush, getBounds, getOffsetParent, getOrigin, getScrollParent, hasClass, node, removeClass, uniqueId, updateClasses, zeroPosCache,
+ __hasProp = {}.hasOwnProperty,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
+ __slice = [].slice;
+
+ if (window.Tether == null) {
+ window.Tether = {};
+ }
+
+ getScrollParent = function(el) {
+ var parent, position, scrollParent, style, _ref;
+ position = getComputedStyle(el).position;
+ if (position === 'fixed') {
+ return el;
+ }
+ scrollParent = void 0;
+ parent = el;
+ while (parent = parent.parentNode) {
+ try {
+ style = getComputedStyle(parent);
+ } catch (_error) {}
+ if (style == null) {
+ return parent;
+ }
+ if (/(auto|scroll)/.test(style['overflow'] + style['overflow-y'] + style['overflow-x'])) {
+ if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) {
+ return parent;
+ }
+ }
+ }
+ return document.body;
+ };
+
+ uniqueId = (function() {
+ var id;
+ id = 0;
+ return function() {
+ return id++;
+ };
+ })();
+
+ zeroPosCache = {};
+
+ getOrigin = function(doc) {
+ var id, k, node, v, _ref;
+ node = doc._tetherZeroElement;
+ if (node == null) {
+ node = doc.createElement('div');
+ node.setAttribute('data-tether-id', uniqueId());
+ extend(node.style, {
+ top: 0,
+ left: 0,
+ position: 'absolute'
+ });
+ doc.body.appendChild(node);
+ doc._tetherZeroElement = node;
+ }
+ id = node.getAttribute('data-tether-id');
+ if (zeroPosCache[id] == null) {
+ zeroPosCache[id] = {};
+ _ref = node.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ zeroPosCache[id][k] = v;
+ }
+ defer(function() {
+ return zeroPosCache[id] = void 0;
+ });
+ }
+ return zeroPosCache[id];
+ };
+
+ node = null;
+
+ getBounds = function(el) {
+ var box, doc, docEl, k, origin, v, _ref;
+ if (el === document) {
+ doc = document;
+ el = document.documentElement;
+ } else {
+ doc = el.ownerDocument;
+ }
+ docEl = doc.documentElement;
+ box = {};
+ _ref = el.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ box[k] = v;
+ }
+ origin = getOrigin(doc);
+ box.top -= origin.top;
+ box.left -= origin.left;
+ box.top = box.top - docEl.clientTop;
+ box.left = box.left - docEl.clientLeft;
+ box.right = doc.body.clientWidth - box.width - box.left;
+ box.bottom = doc.body.clientHeight - box.height - box.top;
+ return box;
+ };
+
+ getOffsetParent = function(el) {
+ return el.offsetParent || document.documentElement;
+ };
+
+ extend = function(out) {
+ var args, key, obj, val, _i, _len, _ref;
+ if (out == null) {
+ out = {};
+ }
+ args = [];
+ Array.prototype.push.apply(args, arguments);
+ _ref = args.slice(1);
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ obj = _ref[_i];
+ if (obj) {
+ for (key in obj) {
+ if (!__hasProp.call(obj, key)) continue;
+ val = obj[key];
+ out[key] = val;
+ }
+ }
+ }
+ return out;
+ };
+
+ removeClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ _results.push(el.classList.remove(cls));
+ }
+ return _results;
+ } else {
+ return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' ');
+ }
+ };
+
+ addClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ _results.push(el.classList.add(cls));
+ }
+ return _results;
+ } else {
+ removeClass(el, name);
+ return el.className += " " + name;
+ }
+ };
+
+ hasClass = function(el, name) {
+ if (el.classList != null) {
+ return el.classList.contains(name);
+ } else {
+ return new RegExp("(^| )" + name + "( |$)", 'gi').test(el.className);
+ }
+ };
+
+ updateClasses = function(el, add, all) {
+ var cls, _i, _j, _len, _len1, _results;
+ for (_i = 0, _len = all.length; _i < _len; _i++) {
+ cls = all[_i];
+ if (__indexOf.call(add, cls) < 0) {
+ if (hasClass(el, cls)) {
+ removeClass(el, cls);
+ }
+ }
+ }
+ _results = [];
+ for (_j = 0, _len1 = add.length; _j < _len1; _j++) {
+ cls = add[_j];
+ if (!hasClass(el, cls)) {
+ _results.push(addClass(el, cls));
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ deferred = [];
+
+ defer = function(fn) {
+ return deferred.push(fn);
+ };
+
+ flush = function() {
+ var fn, _results;
+ _results = [];
+ while (fn = deferred.pop()) {
+ _results.push(fn());
+ }
+ return _results;
+ };
+
+ Evented = (function() {
+ function Evented() {}
+
+ Evented.prototype.on = function(event, handler, ctx, once) {
+ var _base;
+ if (once == null) {
+ once = false;
+ }
+ if (this.bindings == null) {
+ this.bindings = {};
+ }
+ if ((_base = this.bindings)[event] == null) {
+ _base[event] = [];
+ }
+ return this.bindings[event].push({
+ handler: handler,
+ ctx: ctx,
+ once: once
+ });
+ };
+
+ Evented.prototype.once = function(event, handler, ctx) {
+ return this.on(event, handler, ctx, true);
+ };
+
+ Evented.prototype.off = function(event, handler) {
+ var i, _ref, _results;
+ if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
+ return;
+ }
+ if (handler == null) {
+ return delete this.bindings[event];
+ } else {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ if (this.bindings[event][i].handler === handler) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ Evented.prototype.trigger = function() {
+ var args, ctx, event, handler, i, once, _ref, _ref1, _results;
+ event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+ if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
+ handler.apply(ctx != null ? ctx : this, args);
+ if (once) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ return Evented;
+
+ })();
+
+ Tether.Utils = {
+ getScrollParent: getScrollParent,
+ getBounds: getBounds,
+ getOffsetParent: getOffsetParent,
+ extend: extend,
+ addClass: addClass,
+ removeClass: removeClass,
+ hasClass: hasClass,
+ updateClasses: updateClasses,
+ defer: defer,
+ flush: flush,
+ uniqueId: uniqueId,
+ Evented: Evented
+ };
+
+}).call(this);
+
+(function() {
+ var MIRROR_LR, MIRROR_TB, OFFSET_MAP, addClass, addOffset, attachmentToOffset, autoToFixedAttachment, defer, extend, flush, getBounds, getOffsetParent, getOuterSize, getScrollParent, getSize, now, offsetToPx, parseAttachment, parseOffset, position, removeClass, tethers, transformKey, updateClasses, within, _Tether, _ref,
+ __slice = [].slice,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("You must include the utils.js file before tether.js");
+ }
+
+ _ref = Tether.Utils, getScrollParent = _ref.getScrollParent, getSize = _ref.getSize, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getOffsetParent = _ref.getOffsetParent, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, updateClasses = _ref.updateClasses, defer = _ref.defer, flush = _ref.flush;
+
+ within = function(a, b, diff) {
+ if (diff == null) {
+ diff = 1;
+ }
+ return (a + diff >= b && b >= a - diff);
+ };
+
+ transformKey = (function() {
+ var el, key, _i, _len, _ref1;
+ el = document.createElement('div');
+ _ref1 = ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ key = _ref1[_i];
+ if (el.style[key] !== void 0) {
+ return key;
+ }
+ }
+ })();
+
+ tethers = [];
+
+ position = function() {
+ var tether, _i, _len;
+ for (_i = 0, _len = tethers.length; _i < _len; _i++) {
+ tether = tethers[_i];
+ tether.position(false);
+ }
+ return flush();
+ };
+
+ now = function() {
+ var _ref1;
+ return (_ref1 = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref1 : +(new Date);
+ };
+
+ (function() {
+ var event, lastCall, lastDuration, pendingTimeout, tick, _i, _len, _ref1, _results;
+ lastCall = null;
+ lastDuration = null;
+ pendingTimeout = null;
+ tick = function() {
+ if ((lastDuration != null) && lastDuration > 16) {
+ lastDuration = Math.min(lastDuration - 16, 250);
+ pendingTimeout = setTimeout(tick, 250);
+ return;
+ }
+ if ((lastCall != null) && (now() - lastCall) < 10) {
+ return;
+ }
+ if (pendingTimeout != null) {
+ clearTimeout(pendingTimeout);
+ pendingTimeout = null;
+ }
+ lastCall = now();
+ position();
+ return lastDuration = now() - lastCall;
+ };
+ _ref1 = ['resize', 'scroll'];
+ _results = [];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ event = _ref1[_i];
+ _results.push(window.addEventListener(event, tick));
+ }
+ return _results;
+ })();
+
+ MIRROR_LR = {
+ center: 'center',
+ left: 'right',
+ right: 'left'
+ };
+
+ MIRROR_TB = {
+ middle: 'middle',
+ top: 'bottom',
+ bottom: 'top'
+ };
+
+ OFFSET_MAP = {
+ top: 0,
+ left: 0,
+ middle: '50%',
+ center: '50%',
+ bottom: '100%',
+ right: '100%'
+ };
+
+ autoToFixedAttachment = function(attachment, relativeToAttachment) {
+ var left, top;
+ left = attachment.left, top = attachment.top;
+ if (left === 'auto') {
+ left = MIRROR_LR[relativeToAttachment.left];
+ }
+ if (top === 'auto') {
+ top = MIRROR_TB[relativeToAttachment.top];
+ }
+ return {
+ left: left,
+ top: top
+ };
+ };
+
+ attachmentToOffset = function(attachment) {
+ var _ref1, _ref2;
+ return {
+ left: (_ref1 = OFFSET_MAP[attachment.left]) != null ? _ref1 : attachment.left,
+ top: (_ref2 = OFFSET_MAP[attachment.top]) != null ? _ref2 : attachment.top
+ };
+ };
+
+ addOffset = function() {
+ var left, offsets, out, top, _i, _len, _ref1;
+ offsets = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ out = {
+ top: 0,
+ left: 0
+ };
+ for (_i = 0, _len = offsets.length; _i < _len; _i++) {
+ _ref1 = offsets[_i], top = _ref1.top, left = _ref1.left;
+ if (typeof top === 'string') {
+ top = parseFloat(top, 10);
+ }
+ if (typeof left === 'string') {
+ left = parseFloat(left, 10);
+ }
+ out.top += top;
+ out.left += left;
+ }
+ return out;
+ };
+
+ offsetToPx = function(offset, size) {
+ if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
+ offset.left = parseFloat(offset.left, 10) / 100 * size.width;
+ }
+ if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
+ offset.top = parseFloat(offset.top, 10) / 100 * size.height;
+ }
+ return offset;
+ };
+
+ parseAttachment = parseOffset = function(value) {
+ var left, top, _ref1;
+ _ref1 = value.split(' '), top = _ref1[0], left = _ref1[1];
+ return {
+ top: top,
+ left: left
+ };
+ };
+
+ _Tether = (function() {
+ _Tether.modules = [];
+
+ function _Tether(options) {
+ this.position = __bind(this.position, this);
+ var module, _i, _len, _ref1, _ref2;
+ tethers.push(this);
+ this.history = [];
+ this.setOptions(options, false);
+ _ref1 = Tether.modules;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ module = _ref1[_i];
+ if ((_ref2 = module.initialize) != null) {
+ _ref2.call(this);
+ }
+ }
+ this.position();
+ }
+
+ _Tether.prototype.getClass = function(key) {
+ var _ref1, _ref2;
+ if ((_ref1 = this.options.classes) != null ? _ref1[key] : void 0) {
+ return this.options.classes[key];
+ } else if (((_ref2 = this.options.classes) != null ? _ref2[key] : void 0) !== false) {
+ if (this.options.classPrefix) {
+ return "" + this.options.classPrefix + "-" + key;
+ } else {
+ return key;
+ }
+ } else {
+ return '';
+ }
+ };
+
+ _Tether.prototype.setOptions = function(options, position) {
+ var defaults, key, _i, _len, _ref1, _ref2;
+ this.options = options;
+ if (position == null) {
+ position = true;
+ }
+ defaults = {
+ offset: '0 0',
+ targetOffset: '0 0',
+ targetAttachment: 'auto auto',
+ classPrefix: 'tether'
+ };
+ this.options = extend(defaults, this.options);
+ _ref1 = this.options, this.element = _ref1.element, this.target = _ref1.target, this.targetModifier = _ref1.targetModifier;
+ if (this.target === 'viewport') {
+ this.target = document.body;
+ this.targetModifier = 'visible';
+ } else if (this.target === 'scroll-handle') {
+ this.target = document.body;
+ this.targetModifier = 'scroll-handle';
+ }
+ _ref2 = ['element', 'target'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ key = _ref2[_i];
+ if (this[key] == null) {
+ throw new Error("Tether Error: Both element and target must be defined");
+ }
+ if (this[key].jquery != null) {
+ this[key] = this[key][0];
+ } else if (typeof this[key] === 'string') {
+ this[key] = document.querySelector(this[key]);
+ }
+ }
+ addClass(this.element, this.getClass('element'));
+ addClass(this.target, this.getClass('target'));
+ if (!this.options.attachment) {
+ throw new Error("Tether Error: You must provide an attachment");
+ }
+ this.targetAttachment = parseAttachment(this.options.targetAttachment);
+ this.attachment = parseAttachment(this.options.attachment);
+ this.offset = parseOffset(this.options.offset);
+ this.targetOffset = parseOffset(this.options.targetOffset);
+ if (this.scrollParent != null) {
+ this.disable();
+ }
+ if (this.targetModifier === 'scroll-handle') {
+ this.scrollParent = this.target;
+ } else {
+ this.scrollParent = getScrollParent(this.target);
+ }
+ if (this.options.enabled !== false) {
+ return this.enable(position);
+ }
+ };
+
+ _Tether.prototype.getTargetBounds = function() {
+ var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target;
+ if (this.targetModifier != null) {
+ switch (this.targetModifier) {
+ case 'visible':
+ if (this.target === document.body) {
+ return {
+ top: pageYOffset,
+ left: pageXOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(this.target);
+ out = {
+ height: bounds.height,
+ width: bounds.width,
+ top: bounds.top,
+ left: bounds.left
+ };
+ out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
+ out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight)));
+ out.height = Math.min(innerHeight, out.height);
+ out.height -= 2;
+ out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
+ out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth)));
+ out.width = Math.min(innerWidth, out.width);
+ out.width -= 2;
+ if (out.top < pageYOffset) {
+ out.top = pageYOffset;
+ }
+ if (out.left < pageXOffset) {
+ out.left = pageXOffset;
+ }
+ return out;
+ }
+ break;
+ case 'scroll-handle':
+ target = this.target;
+ if (target === document.body) {
+ target = document.documentElement;
+ bounds = {
+ left: pageXOffset,
+ top: pageYOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(target);
+ }
+ style = getComputedStyle(target);
+ hasBottomScroll = target.scrollWidth > target.clientWidth || 'scroll' === [style.overflow, style.overflowX] || this.target !== document.body;
+ scrollBottom = 0;
+ if (hasBottomScroll) {
+ scrollBottom = 15;
+ }
+ height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
+ out = {
+ width: 15,
+ height: height * 0.975 * (height / target.scrollHeight),
+ left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
+ };
+ fitAdj = 0;
+ if (height < 408 && this.target === document.body) {
+ fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
+ }
+ if (this.target !== document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ scrollPercentage = target.scrollTop / (target.scrollHeight - height);
+ out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
+ if (this.target === document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ return out;
+ }
+ } else {
+ return getBounds(this.target);
+ }
+ };
+
+ _Tether.prototype.clearCache = function() {
+ return this._cache = {};
+ };
+
+ _Tether.prototype.cache = function(k, getter) {
+ if (this._cache == null) {
+ this._cache = {};
+ }
+ if (this._cache[k] == null) {
+ this._cache[k] = getter.call(this);
+ }
+ return this._cache[k];
+ };
+
+ _Tether.prototype.enable = function(position) {
+ if (position == null) {
+ position = true;
+ }
+ addClass(this.target, this.getClass('enabled'));
+ addClass(this.element, this.getClass('enabled'));
+ this.enabled = true;
+ if (this.scrollParent !== document) {
+ this.scrollParent.addEventListener('scroll', this.position);
+ }
+ if (position) {
+ return this.position();
+ }
+ };
+
+ _Tether.prototype.disable = function() {
+ removeClass(this.target, this.getClass('enabled'));
+ removeClass(this.element, this.getClass('enabled'));
+ this.enabled = false;
+ if (this.scrollParent != null) {
+ return this.scrollParent.removeEventListener('scroll', this.position);
+ }
+ };
+
+ _Tether.prototype.destroy = function() {
+ var i, tether, _i, _len, _results;
+ this.disable();
+ _results = [];
+ for (i = _i = 0, _len = tethers.length; _i < _len; i = ++_i) {
+ tether = tethers[i];
+ if (tether === this) {
+ tethers.splice(i, 1);
+ break;
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ _Tether.prototype.updateAttachClasses = function(elementAttach, targetAttach) {
+ var add, all, side, sides, _i, _j, _len, _len1, _ref1,
+ _this = this;
+ if (elementAttach == null) {
+ elementAttach = this.attachment;
+ }
+ if (targetAttach == null) {
+ targetAttach = this.targetAttachment;
+ }
+ sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
+ if ((_ref1 = this._addAttachClasses) != null ? _ref1.length : void 0) {
+ this._addAttachClasses.splice(0, this._addAttachClasses.length);
+ }
+ add = this._addAttachClasses != null ? this._addAttachClasses : this._addAttachClasses = [];
+ if (elementAttach.top) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.top);
+ }
+ if (elementAttach.left) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.left);
+ }
+ if (targetAttach.top) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.top);
+ }
+ if (targetAttach.left) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.left);
+ }
+ all = [];
+ for (_i = 0, _len = sides.length; _i < _len; _i++) {
+ side = sides[_i];
+ all.push("" + (this.getClass('element-attached')) + "-" + side);
+ }
+ for (_j = 0, _len1 = sides.length; _j < _len1; _j++) {
+ side = sides[_j];
+ all.push("" + (this.getClass('target-attached')) + "-" + side);
+ }
+ return defer(function() {
+ if (_this._addAttachClasses == null) {
+ return;
+ }
+ updateClasses(_this.element, _this._addAttachClasses, all);
+ updateClasses(_this.target, _this._addAttachClasses, all);
+ return _this._addAttachClasses = void 0;
+ });
+ };
+
+ _Tether.prototype.position = function(flushChanges) {
+ var elementPos, elementStyle, height, left, manualOffset, manualTargetOffset, module, next, offset, offsetBorder, offsetParent, offsetParentSize, offsetParentStyle, offsetPosition, ret, scrollLeft, scrollTop, side, targetAttachment, targetOffset, targetPos, targetSize, top, width, _i, _j, _len, _len1, _ref1, _ref2, _ref3, _ref4,
+ _this = this;
+ if (flushChanges == null) {
+ flushChanges = true;
+ }
+ if (!this.enabled) {
+ return;
+ }
+ this.clearCache();
+ targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
+ this.updateAttachClasses(this.attachment, targetAttachment);
+ elementPos = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ });
+ width = elementPos.width, height = elementPos.height;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref1 = this.lastSize, width = _ref1.width, height = _ref1.height;
+ } else {
+ this.lastSize = {
+ width: width,
+ height: height
+ };
+ }
+ targetSize = targetPos = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ offset = offsetToPx(attachmentToOffset(this.attachment), {
+ width: width,
+ height: height
+ });
+ targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
+ manualOffset = offsetToPx(this.offset, {
+ width: width,
+ height: height
+ });
+ manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
+ offset = addOffset(offset, manualOffset);
+ targetOffset = addOffset(targetOffset, manualTargetOffset);
+ left = targetPos.left + targetOffset.left - offset.left;
+ top = targetPos.top + targetOffset.top - offset.top;
+ _ref2 = Tether.modules;
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ module = _ref2[_i];
+ ret = module.position.call(this, {
+ left: left,
+ top: top,
+ targetAttachment: targetAttachment,
+ targetPos: targetPos,
+ elementPos: elementPos,
+ offset: offset,
+ targetOffset: targetOffset,
+ manualOffset: manualOffset,
+ manualTargetOffset: manualTargetOffset
+ });
+ if ((ret == null) || typeof ret !== 'object') {
+ continue;
+ } else if (ret === false) {
+ return false;
+ } else {
+ top = ret.top, left = ret.left;
+ }
+ }
+ next = {
+ page: {
+ top: top,
+ bottom: document.body.scrollHeight - top - height,
+ left: left,
+ right: document.body.scrollWidth - left - width
+ },
+ viewport: {
+ top: top - pageYOffset,
+ bottom: pageYOffset - top - height + innerHeight,
+ left: left - pageXOffset,
+ right: pageXOffset - left - width + innerWidth
+ }
+ };
+ if (((_ref3 = this.options.optimizations) != null ? _ref3.moveElement : void 0) !== false && (this.targetModifier == null)) {
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ offsetPosition = this.cache('target-offsetparent-bounds', function() {
+ return getBounds(offsetParent);
+ });
+ offsetParentStyle = getComputedStyle(offsetParent);
+ elementStyle = getComputedStyle(this.element);
+ offsetParentSize = offsetPosition;
+ offsetBorder = {};
+ _ref4 = ['top', 'left', 'bottom', 'right'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ offsetBorder[side] = parseFloat(offsetParentStyle["border-" + side + "-width"]);
+ }
+ offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
+ offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
+ if (next.page.top >= (offsetPosition.top + offsetBorder.top) && next.page.bottom >= offsetPosition.bottom) {
+ if (next.page.left >= (offsetPosition.left + offsetBorder.left) && next.page.right >= offsetPosition.right) {
+ scrollTop = offsetParent.scrollTop;
+ scrollLeft = offsetParent.scrollLeft;
+ next.offset = {
+ top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
+ left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
+ };
+ }
+ }
+ }
+ this.move(next);
+ this.history.unshift(next);
+ if (this.history.length > 3) {
+ this.history.pop();
+ }
+ if (flushChanges) {
+ flush();
+ }
+ return true;
+ };
+
+ _Tether.prototype.move = function(position) {
+ var css, elVal, found, key, moved, offsetParent, point, same, transcribe, type, val, write, writeCSS, _i, _len, _ref1, _ref2,
+ _this = this;
+ if (this.element.parentNode == null) {
+ return;
+ }
+ same = {};
+ for (type in position) {
+ same[type] = {};
+ for (key in position[type]) {
+ found = false;
+ _ref1 = this.history;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ point = _ref1[_i];
+ if (!within((_ref2 = point[type]) != null ? _ref2[key] : void 0, position[type][key])) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ same[type][key] = true;
+ }
+ }
+ }
+ css = {
+ top: '',
+ left: '',
+ right: '',
+ bottom: ''
+ };
+ transcribe = function(same, pos) {
+ var xPos, yPos, _ref3;
+ if (((_ref3 = _this.options.optimizations) != null ? _ref3.gpu : void 0) !== false) {
+ if (same.top) {
+ css.top = 0;
+ yPos = pos.top;
+ } else {
+ css.bottom = 0;
+ yPos = -pos.bottom;
+ }
+ if (same.left) {
+ css.left = 0;
+ xPos = pos.left;
+ } else {
+ css.right = 0;
+ xPos = -pos.right;
+ }
+ css[transformKey] = "translateX(" + (Math.round(xPos)) + "px) translateY(" + (Math.round(yPos)) + "px)";
+ if (transformKey !== 'msTransform') {
+ return css[transformKey] += " translateZ(0)";
+ }
+ } else {
+ if (same.top) {
+ css.top = "" + pos.top + "px";
+ } else {
+ css.bottom = "" + pos.bottom + "px";
+ }
+ if (same.left) {
+ return css.left = "" + pos.left + "px";
+ } else {
+ return css.right = "" + pos.right + "px";
+ }
+ }
+ };
+ moved = false;
+ if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
+ css.position = 'absolute';
+ transcribe(same.page, position.page);
+ } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
+ css.position = 'fixed';
+ transcribe(same.viewport, position.viewport);
+ } else if ((same.offset != null) && same.offset.top && same.offset.left) {
+ css.position = 'absolute';
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ if (getOffsetParent(this.element) !== offsetParent) {
+ defer(function() {
+ _this.element.parentNode.removeChild(_this.element);
+ return offsetParent.appendChild(_this.element);
+ });
+ }
+ transcribe(same.offset, position.offset);
+ moved = true;
+ } else {
+ css.position = 'absolute';
+ transcribe({
+ top: true,
+ left: true
+ }, position.page);
+ }
+ if (!moved && this.element.parentNode.tagName !== 'BODY') {
+ this.element.parentNode.removeChild(this.element);
+ document.body.appendChild(this.element);
+ }
+ writeCSS = {};
+ write = false;
+ for (key in css) {
+ val = css[key];
+ elVal = this.element.style[key];
+ if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) {
+ elVal = parseFloat(elVal);
+ val = parseFloat(val);
+ }
+ if (elVal !== val) {
+ write = true;
+ writeCSS[key] = css[key];
+ }
+ }
+ if (write) {
+ return defer(function() {
+ return extend(_this.element.style, writeCSS);
+ });
+ }
+ };
+
+ return _Tether;
+
+ })();
+
+ Tether.position = position;
+
+ window.Tether = extend(_Tether, Tether);
+
+}).call(this);
+
+(function() {
+ var BOUNDS_FORMAT, MIRROR_ATTACH, defer, extend, getBoundingRect, getBounds, getOuterSize, getSize, updateClasses, _ref,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+
+ _ref = Tether.Utils, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getSize = _ref.getSize, extend = _ref.extend, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ MIRROR_ATTACH = {
+ left: 'right',
+ right: 'left',
+ top: 'bottom',
+ bottom: 'top',
+ middle: 'middle'
+ };
+
+ BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
+
+ getBoundingRect = function(tether, to) {
+ var i, pos, side, size, style, _i, _len;
+ if (to === 'scrollParent') {
+ to = tether.scrollParent;
+ } else if (to === 'window') {
+ to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
+ }
+ if (to === document) {
+ to = to.documentElement;
+ }
+ if (to.nodeType != null) {
+ pos = size = getBounds(to);
+ style = getComputedStyle(to);
+ to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
+ for (i = _i = 0, _len = BOUNDS_FORMAT.length; _i < _len; i = ++_i) {
+ side = BOUNDS_FORMAT[i];
+ if (side === 'top' || side === 'left') {
+ to[i] += parseFloat(style["border-" + side + "-width"]);
+ } else {
+ to[i] -= parseFloat(style["border-" + side + "-width"]);
+ }
+ }
+ }
+ return to;
+ };
+
+ Tether.modules.push({
+ position: function(_arg) {
+ var addClasses, allClasses, attachment, bounds, changeAttachX, changeAttachY, cls, constraint, eAttachment, height, left, oob, oobClass, p, pin, pinned, pinnedClass, removeClass, side, tAttachment, targetAttachment, targetHeight, targetSize, targetWidth, to, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8,
+ _this = this;
+ top = _arg.top, left = _arg.left, targetAttachment = _arg.targetAttachment;
+ if (!this.options.constraints) {
+ return true;
+ }
+ removeClass = function(prefix) {
+ var side, _i, _len, _results;
+ _this.removeClass(prefix);
+ _results = [];
+ for (_i = 0, _len = BOUNDS_FORMAT.length; _i < _len; _i++) {
+ side = BOUNDS_FORMAT[_i];
+ _results.push(_this.removeClass("" + prefix + "-" + side));
+ }
+ return _results;
+ };
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref2 = this.lastSize, width = _ref2.width, height = _ref2.height;
+ }
+ targetSize = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ targetHeight = targetSize.height;
+ targetWidth = targetSize.width;
+ tAttachment = {};
+ eAttachment = {};
+ allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
+ _ref3 = this.options.constraints;
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ constraint = _ref3[_i];
+ if (constraint.outOfBoundsClass) {
+ allClasses.push(constraint.outOfBoundsClass);
+ }
+ if (constraint.pinnedClass) {
+ allClasses.push(constraint.pinnedClass);
+ }
+ }
+ for (_j = 0, _len1 = allClasses.length; _j < _len1; _j++) {
+ cls = allClasses[_j];
+ _ref4 = ['left', 'top', 'right', 'bottom'];
+ for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
+ side = _ref4[_k];
+ allClasses.push("" + cls + "-" + side);
+ }
+ }
+ addClasses = [];
+ tAttachment = extend({}, targetAttachment);
+ eAttachment = extend({}, this.attachment);
+ _ref5 = this.options.constraints;
+ for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) {
+ constraint = _ref5[_l];
+ to = constraint.to, attachment = constraint.attachment, pin = constraint.pin;
+ if (attachment == null) {
+ attachment = '';
+ }
+ if (__indexOf.call(attachment, ' ') >= 0) {
+ _ref6 = attachment.split(' '), changeAttachY = _ref6[0], changeAttachX = _ref6[1];
+ } else {
+ changeAttachX = changeAttachY = attachment;
+ }
+ bounds = getBoundingRect(this, to);
+ if (changeAttachY === 'target' || changeAttachY === 'both') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ }
+ }
+ if (changeAttachY === 'together') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ if (eAttachment.top === 'bottom') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top += height;
+ eAttachment.top = 'top';
+ } else if (eAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ if (eAttachment.top === 'top') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (eAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ }
+ if (changeAttachX === 'target' || changeAttachX === 'both') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ }
+ if (left + width > bounds[2] && tAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ }
+ }
+ if (changeAttachX === 'together') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ if (eAttachment.left === 'right') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left += width;
+ eAttachment.left = 'left';
+ } else if (eAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ } else if (left + width > bounds[2] && tAttachment.left === 'right') {
+ if (eAttachment.left === 'left') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (eAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left += width;
+ eAttachment.left = 'left';
+ }
+ }
+ }
+ if (changeAttachY === 'element' || changeAttachY === 'both') {
+ if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (changeAttachX === 'element' || changeAttachX === 'both') {
+ if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ }
+ if (typeof pin === 'string') {
+ pin = (function() {
+ var _len4, _m, _ref7, _results;
+ _ref7 = pin.split(',');
+ _results = [];
+ for (_m = 0, _len4 = _ref7.length; _m < _len4; _m++) {
+ p = _ref7[_m];
+ _results.push(p.trim());
+ }
+ return _results;
+ })();
+ } else if (pin === true) {
+ pin = ['top', 'left', 'right', 'bottom'];
+ }
+ pin || (pin = []);
+ pinned = [];
+ oob = [];
+ if (top < bounds[1]) {
+ if (__indexOf.call(pin, 'top') >= 0) {
+ top = bounds[1];
+ pinned.push('top');
+ } else {
+ oob.push('top');
+ }
+ }
+ if (top + height > bounds[3]) {
+ if (__indexOf.call(pin, 'bottom') >= 0) {
+ top = bounds[3] - height;
+ pinned.push('bottom');
+ } else {
+ oob.push('bottom');
+ }
+ }
+ if (left < bounds[0]) {
+ if (__indexOf.call(pin, 'left') >= 0) {
+ left = bounds[0];
+ pinned.push('left');
+ } else {
+ oob.push('left');
+ }
+ }
+ if (left + width > bounds[2]) {
+ if (__indexOf.call(pin, 'right') >= 0) {
+ left = bounds[2] - width;
+ pinned.push('right');
+ } else {
+ oob.push('right');
+ }
+ }
+ if (pinned.length) {
+ pinnedClass = (_ref7 = this.options.pinnedClass) != null ? _ref7 : this.getClass('pinned');
+ addClasses.push(pinnedClass);
+ for (_m = 0, _len4 = pinned.length; _m < _len4; _m++) {
+ side = pinned[_m];
+ addClasses.push("" + pinnedClass + "-" + side);
+ }
+ }
+ if (oob.length) {
+ oobClass = (_ref8 = this.options.outOfBoundsClass) != null ? _ref8 : this.getClass('out-of-bounds');
+ addClasses.push(oobClass);
+ for (_n = 0, _len5 = oob.length; _n < _len5; _n++) {
+ side = oob[_n];
+ addClasses.push("" + oobClass + "-" + side);
+ }
+ }
+ if (__indexOf.call(pinned, 'left') >= 0 || __indexOf.call(pinned, 'right') >= 0) {
+ eAttachment.left = tAttachment.left = false;
+ }
+ if (__indexOf.call(pinned, 'top') >= 0 || __indexOf.call(pinned, 'bottom') >= 0) {
+ eAttachment.top = tAttachment.top = false;
+ }
+ if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== this.attachment.top || eAttachment.left !== this.attachment.left) {
+ this.updateAttachClasses(eAttachment, tAttachment);
+ }
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+(function() {
+ var defer, getBounds, updateClasses, _ref;
+
+ _ref = Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ Tether.modules.push({
+ position: function(_arg) {
+ var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5,
+ _this = this;
+ top = _arg.top, left = _arg.left;
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ targetPos = this.getTargetBounds();
+ bottom = top + height;
+ right = left + width;
+ abutted = [];
+ if (top <= targetPos.bottom && bottom >= targetPos.top) {
+ _ref2 = ['left', 'right'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ side = _ref2[_i];
+ if ((_ref3 = targetPos[side]) === left || _ref3 === right) {
+ abutted.push(side);
+ }
+ }
+ }
+ if (left <= targetPos.right && right >= targetPos.left) {
+ _ref4 = ['top', 'bottom'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) {
+ abutted.push(side);
+ }
+ }
+ }
+ allClasses = [];
+ addClasses = [];
+ sides = ['left', 'top', 'right', 'bottom'];
+ allClasses.push(this.getClass('abutted'));
+ for (_k = 0, _len2 = sides.length; _k < _len2; _k++) {
+ side = sides[_k];
+ allClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ if (abutted.length) {
+ addClasses.push(this.getClass('abutted'));
+ }
+ for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) {
+ side = abutted[_l];
+ addClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return true;
+ }
+ });
+
+}).call(this);
+
+(function() {
+ Tether.modules.push({
+ position: function(_arg) {
+ var left, result, shift, shiftLeft, shiftTop, top, _ref;
+ top = _arg.top, left = _arg.left;
+ if (!this.options.shift) {
+ return;
+ }
+ result = function(val) {
+ if (typeof val === 'function') {
+ return val.call(this, {
+ top: top,
+ left: left
+ });
+ } else {
+ return val;
+ }
+ };
+ shift = result(this.options.shift);
+ if (typeof shift === 'string') {
+ shift = shift.split(' ');
+ shift[1] || (shift[1] = shift[0]);
+ shiftTop = shift[0], shiftLeft = shift[1];
+ shiftTop = parseFloat(shiftTop, 10);
+ shiftLeft = parseFloat(shiftLeft, 10);
+ } else {
+ _ref = [shift.top, shift.left], shiftTop = _ref[0], shiftLeft = _ref[1];
+ }
+ top += shiftTop;
+ left += shiftLeft;
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+(function() {
+ var ATTACHMENT, Evented, Shepherd, Step, Tour, addClass, createFromHTML, extend, getBounds, matchesSelector, parseShorthand, removeClass, uniqueId, _ref,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ _ref = Tether.Utils, extend = _ref.extend, removeClass = _ref.removeClass, addClass = _ref.addClass, Evented = _ref.Evented, getBounds = _ref.getBounds, uniqueId = _ref.uniqueId;
+
+ ATTACHMENT = {
+ 'top': 'top center',
+ 'left': 'middle right',
+ 'right': 'middle left',
+ 'bottom': 'bottom center'
+ };
+
+ createFromHTML = function(html) {
+ var el;
+ el = document.createElement('div');
+ el.innerHTML = html;
+ return el.children[0];
+ };
+
+ matchesSelector = function(el, sel) {
+ var matches, _ref1, _ref2, _ref3, _ref4;
+ matches = (_ref1 = (_ref2 = (_ref3 = (_ref4 = el.matches) != null ? _ref4 : el.matchesSelector) != null ? _ref3 : el.webkitMatchesSelector) != null ? _ref2 : el.mozMatchesSelector) != null ? _ref1 : el.oMatchesSelector;
+ return matches.call(el, sel);
+ };
+
+ parseShorthand = function(obj, props) {
+ var i, out, prop, vals, _i, _len;
+ if (obj == null) {
+ return obj;
+ } else if (typeof obj === 'object') {
+ return obj;
+ } else {
+ vals = obj.split(' ');
+ if (vals.length > props.length) {
+ vals[0] = vals.slice(0, +(vals.length - props.length) + 1 || 9e9).join(' ');
+ vals.splice(1, vals.length - props.length);
+ }
+ out = {};
+ for (i = _i = 0, _len = props.length; _i < _len; i = ++_i) {
+ prop = props[i];
+ out[prop] = vals[i];
+ }
+ return out;
+ }
+ };
+
+ Step = (function(_super) {
+ __extends(Step, _super);
+
+ function Step(tour, options) {
+ this.tour = tour;
+ this.destroy = __bind(this.destroy, this);
+ this.scrollTo = __bind(this.scrollTo, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.isOpen = __bind(this.isOpen, this);
+ this.hide = __bind(this.hide, this);
+ this.show = __bind(this.show, this);
+ this.setOptions(options);
+ this;
+ }
+
+ Step.prototype.setOptions = function(options) {
+ var event, handler, _base, _ref1;
+ this.options = options != null ? options : {};
+ this.destroy();
+ this.id = this.options.id || this.id || ("step-" + (uniqueId()));
+ if (this.options.when) {
+ _ref1 = this.options.when;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ this.on(event, handler, this);
+ }
+ }
+ return (_base = this.options).buttons != null ? (_base = this.options).buttons : _base.buttons = [
+ {
+ text: 'Next',
+ action: this.tour.next
+ }
+ ];
+ };
+
+ Step.prototype.getTour = function() {
+ return this.tour;
+ };
+
+ Step.prototype.bindAdvance = function() {
+ var event, handler, selector, _ref1,
+ _this = this;
+ _ref1 = parseShorthand(this.options.advanceOn, ['event', 'selector']), event = _ref1.event, selector = _ref1.selector;
+ handler = function(e) {
+ if (!_this.isOpen()) {
+ return;
+ }
+ if (selector != null) {
+ if (matchesSelector(e.target, selector)) {
+ return _this.tour.next();
+ }
+ } else {
+ if (_this.el && e.target === _this.el) {
+ return _this.tour.next();
+ }
+ }
+ };
+ document.body.addEventListener(event, handler);
+ return this.on('destroy', function() {
+ return document.body.removeEventListener(event, handler);
+ });
+ };
+
+ Step.prototype.getAttachTo = function() {
+ var opts;
+ opts = parseShorthand(this.options.attachTo, ['element', 'on']);
+ if (opts == null) {
+ opts = {};
+ }
+ if (typeof opts.element === 'string') {
+ opts.element = document.querySelector(opts.element);
+ if (opts.element == null) {
+ throw new Error("Shepherd step's attachTo was not found in the page");
+ }
+ }
+ return opts;
+ };
+
+ Step.prototype.setupTether = function() {
+ var attachment, opts, tetherOpts;
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("Using the attachment feature of Shepherd requires the Tether library");
+ }
+ opts = this.getAttachTo();
+ attachment = ATTACHMENT[opts.on || 'right'];
+ if (opts.element == null) {
+ opts.element = 'viewport';
+ attachment = 'middle center';
+ }
+ tetherOpts = {
+ classPrefix: 'shepherd',
+ element: this.el,
+ constraints: [
+ {
+ to: 'window',
+ pin: true,
+ attachment: 'together'
+ }
+ ],
+ target: opts.element,
+ offset: opts.offset || '0 0',
+ attachment: attachment
+ };
+ return this.tether = new Tether(extend(tetherOpts, this.options.tetherOptions));
+ };
+
+ Step.prototype.show = function() {
+ var _ref1,
+ _this = this;
+ if (this.el == null) {
+ this.render();
+ }
+ addClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.enable();
+ }
+ if (this.options.scrollTo) {
+ setTimeout(function() {
+ return _this.scrollTo();
+ });
+ }
+ return this.trigger('show');
+ };
+
+ Step.prototype.hide = function() {
+ var _ref1;
+ removeClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.disable();
+ }
+ return this.trigger('hide');
+ };
+
+ Step.prototype.isOpen = function() {
+ return hasClass(this.el, 'shepherd-open');
+ };
+
+ Step.prototype.cancel = function() {
+ this.hide();
+ return this.trigger('cancel');
+ };
+
+ Step.prototype.complete = function() {
+ this.hide();
+ return this.trigger('complete');
+ };
+
+ Step.prototype.scrollTo = function() {
+ var element;
+ element = this.getAttachTo().element;
+ return element != null ? element.scrollIntoView() : void 0;
+ };
+
+ Step.prototype.destroy = function() {
+ var _ref1;
+ if (this.el != null) {
+ document.body.removeChild(this.el);
+ delete this.el;
+ }
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ return this.trigger('destroy');
+ };
+
+ Step.prototype.render = function() {
+ var button, buttons, cfg, content, footer, header, paragraph, paragraphs, text, _i, _j, _len, _len1, _ref1, _ref2, _ref3;
+ if (this.el != null) {
+ this.destroy();
+ }
+ this.el = createFromHTML("");
+ content = document.createElement('div');
+ content.className = 'shepherd-content';
+ this.el.appendChild(content);
+ if (this.options.title != null) {
+ header = document.createElement('header');
+ header.innerHTML = "" + this.options.title + "
";
+ this.el.className += ' shepherd-has-title';
+ content.appendChild(header);
+ }
+ if (this.options.text != null) {
+ text = createFromHTML("");
+ paragraphs = this.options.text;
+ if (typeof paragraphs === 'string') {
+ paragraphs = [paragraphs];
+ }
+ for (_i = 0, _len = paragraphs.length; _i < _len; _i++) {
+ paragraph = paragraphs[_i];
+ text.innerHTML += "" + paragraph + "
";
+ }
+ content.appendChild(text);
+ }
+ footer = document.createElement('footer');
+ if (this.options.buttons) {
+ buttons = createFromHTML("");
+ _ref2 = this.options.buttons;
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
+ cfg = _ref2[_j];
+ button = createFromHTML("" + cfg.text + "");
+ buttons.appendChild(button);
+ this.bindButtonEvents(cfg, button.querySelector('a'));
+ }
+ footer.appendChild(buttons);
+ }
+ content.appendChild(footer);
+ document.body.appendChild(this.el);
+ this.setupTether();
+ if (this.options.advanceOn) {
+ return this.bindAdvance();
+ }
+ };
+
+ Step.prototype.bindButtonEvents = function(cfg, el) {
+ var event, handler, page, _ref1,
+ _this = this;
+ if (cfg.events == null) {
+ cfg.events = {};
+ }
+ if (cfg.action != null) {
+ cfg.events.click = cfg.action;
+ }
+ _ref1 = cfg.events;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ if (typeof handler === 'string') {
+ page = handler;
+ handler = function() {
+ return _this.tour.show(page);
+ };
+ }
+ el.addEventListener(event, handler);
+ }
+ return this.on('destroy', function() {
+ var _ref2, _results;
+ _ref2 = cfg.events;
+ _results = [];
+ for (event in _ref2) {
+ handler = _ref2[event];
+ _results.push(el.removeEventListener(event, handler));
+ }
+ return _results;
+ });
+ };
+
+ return Step;
+
+ })(Evented);
+
+ Tour = (function(_super) {
+ __extends(Tour, _super);
+
+ function Tour(options) {
+ var event, _i, _len, _ref1, _ref2,
+ _this = this;
+ this.options = options != null ? options : {};
+ this.hide = __bind(this.hide, this);
+ this.cancel = __bind(this.cancel, this);
+ this.back = __bind(this.back, this);
+ this.next = __bind(this.next, this);
+ this.steps = (_ref1 = this.options.steps) != null ? _ref1 : [];
+ _ref2 = ['complete', 'cancel', 'hide', 'start', 'show'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ event = _ref2[_i];
+ this.on(event, function(opts) {
+ if (opts == null) {
+ opts = {};
+ }
+ opts.tour = _this;
+ return Shepherd.trigger(event, opts);
+ });
+ }
+ this;
+ }
+
+ Tour.prototype.addStep = function(name, step) {
+ var _ref1;
+ if (step == null) {
+ step = name;
+ }
+ if (!(step instanceof Step)) {
+ if ((_ref1 = typeof name) === 'string' || _ref1 === 'number') {
+ step.id = name.toString();
+ }
+ step = extend({}, this.options.defaults, step);
+ step = new Step(this, step);
+ } else {
+ step.tour = this;
+ }
+ this.steps.push(step);
+ return step;
+ };
+
+ Tour.prototype.getById = function(id) {
+ var step, _i, _len, _ref1;
+ _ref1 = this.steps;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ step = _ref1[_i];
+ if (step.id === id) {
+ return step;
+ }
+ }
+ };
+
+ Tour.prototype.getCurrentStep = function() {
+ return this.currentStep;
+ };
+
+ Tour.prototype.next = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ if (index === this.steps.length - 1) {
+ this.hide(index);
+ this.trigger('complete');
+ return this.done();
+ } else {
+ return this.show(index + 1);
+ }
+ };
+
+ Tour.prototype.back = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ return this.show(index - 1);
+ };
+
+ Tour.prototype.cancel = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.cancel();
+ }
+ this.trigger('cancel');
+ return this.done();
+ };
+
+ Tour.prototype.hide = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('hide');
+ return this.done();
+ };
+
+ Tour.prototype.done = function() {
+ return Shepherd.activeTour = null;
+ };
+
+ Tour.prototype.show = function(key) {
+ var next;
+ if (key == null) {
+ key = 0;
+ }
+ if (this.currentStep) {
+ this.currentStep.hide();
+ }
+ Shepherd.activeTour = this;
+ if (typeof key === 'string') {
+ next = this.getById(key);
+ } else {
+ next = this.steps[key];
+ }
+ if (next) {
+ this.trigger('show', {
+ step: next,
+ previous: this.currentStep
+ });
+ this.currentStep = next;
+ return next.show();
+ }
+ };
+
+ Tour.prototype.start = function() {
+ this.trigger('start');
+ this.currentStep = null;
+ return this.next();
+ };
+
+ return Tour;
+
+ })(Evented);
+
+ Shepherd = new Evented;
+
+ extend(Shepherd, {
+ Tour: Tour,
+ Step: Step
+ });
+
+ window.Shepherd = Shepherd;
+
+}).call(this);
diff --git a/ajax/libs/shepherd/0.3.1/shepherd.min.js b/ajax/libs/shepherd/0.3.1/shepherd.min.js
new file mode 100644
index 000000000..f35abc2e9
--- /dev/null
+++ b/ajax/libs/shepherd/0.3.1/shepherd.min.js
@@ -0,0 +1,2 @@
+/*! shepherd 0.3.1 */
+(function(){var t,e,n,o,i,s,r,h,l,a,p,u,f,c,d,g,m={}.hasOwnProperty,v=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},b=[].slice;null==window.Tether&&(window.Tether={}),a=function(t){var e,n,o,i,s;if(n=getComputedStyle(t).position,"fixed"===n)return t;for(o=void 0,e=t;e=e.parentNode;){try{i=getComputedStyle(e)}catch(r){}if(null==i)return e;if(/(auto|scroll)/.test(i.overflow+i["overflow-y"]+i["overflow-x"])&&("absolute"!==n||"relative"===(s=i.position)||"absolute"===s||"fixed"===s))return e}return document.body},c=function(){var t;return t=0,function(){return t++}}(),g={},l=function(t){var e,o,s,r,h;if(s=t._tetherZeroElement,null==s&&(s=t.createElement("div"),s.setAttribute("data-tether-id",c()),i(s.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(s),t._tetherZeroElement=s),e=s.getAttribute("data-tether-id"),null==g[e]){g[e]={},h=s.getBoundingClientRect();for(o in h)r=h[o],g[e][o]=r;n(function(){return g[e]=void 0})}return g[e]},u=null,r=function(t){var e,n,o,i,s,r,h;t===document?(n=document,t=document.documentElement):n=t.ownerDocument,o=n.documentElement,e={},h=t.getBoundingClientRect();for(i in h)r=h[i],e[i]=r;return s=l(n),e.top-=s.top,e.left-=s.left,e.top=e.top-o.clientTop,e.left=e.left-o.clientLeft,e.right=n.body.clientWidth-e.width-e.left,e.bottom=n.body.clientHeight-e.height-e.top,e},h=function(t){return t.offsetParent||document.documentElement},i=function(t){var e,n,o,i,s,r,h;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),h=e.slice(1),s=0,r=h.length;r>s;s++)if(o=h[s])for(n in o)m.call(o,n)&&(i=o[n],t[n]=i);return t},f=function(t,e){var n,o,i,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],o=0,i=s.length;i>o;o++)n=s[o],r.push(t.classList.remove(n));return r}return t.className=t.className.replace(new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi")," ")},e=function(t,e){var n,o,i,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],o=0,i=s.length;i>o;o++)n=s[o],r.push(t.classList.add(n));return r}return f(t,e),t.className+=" "+e},p=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},d=function(t,n,o){var i,s,r,h,l,a;for(s=0,h=o.length;h>s;s++)i=o[s],v.call(n,i)<0&&p(t,i)&&f(t,i);for(a=[],r=0,l=n.length;l>r;r++)i=n[r],a.push(p(t,i)?void 0:e(t,i));return a},o=[],n=function(t){return o.push(t)},s=function(){var t,e;for(e=[];t=o.pop();)e.push(t());return e},t=function(){function t(){}return t.prototype.on=function(t,e,n,o){var i;return null==o&&(o=!1),null==this.bindings&&(this.bindings={}),null==(i=this.bindings)[t]&&(i[t]=[]),this.bindings[t].push({handler:e,ctx:n,once:o})},t.prototype.once=function(t,e,n){return this.on(t,e,n,!0)},t.prototype.off=function(t,e){var n,o,i;if(null!=(null!=(o=this.bindings)?o[t]:void 0)){if(null==e)return delete this.bindings[t];for(n=0,i=[];n=e&&e>=t-n},T=function(){var t,e,n,o,i;for(t=document.createElement("div"),i=["transform","webkitTransform","OTransform","MozTransform","msTransform"],n=0,o=i.length;o>n;n++)if(e=i[n],void 0!==t.style[e])return e}(),C=[],y=function(){var t,e,n;for(e=0,n=C.length;n>e;e++)t=C[e],t.position(!1);return a()},g=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance?"function"==typeof performance.now?performance.now():void 0:void 0)?t:+new Date},function(){var t,e,n,o,i,s,r,h,l;for(e=null,n=null,o=null,i=function(){if(null!=n&&n>16)return n=Math.min(n-16,250),void(o=setTimeout(i,250));if(!(null!=e&&g()-e<10))return null!=o&&(clearTimeout(o),o=null),e=g(),y(),n=g()-e},h=["resize","scroll"],l=[],s=0,r=h.length;r>s;s++)t=h[s],l.push(window.addEventListener(t,i));return l}(),t={center:"center",left:"right",right:"left"},e={middle:"middle",top:"bottom",bottom:"top"},n={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},r=function(n,o){var i,s;return i=n.left,s=n.top,"auto"===i&&(i=t[o.left]),"auto"===s&&(s=e[o.top]),{left:i,top:s}},s=function(t){var e,o;return{left:null!=(e=n[t.left])?e:t.left,top:null!=(o=n[t.top])?o:t.top}},i=function(){var t,e,n,o,i,s,r;for(e=1<=arguments.length?A.call(arguments,0):[],n={top:0,left:0},i=0,s=e.length;s>i;i++)r=e[i],o=r.top,t=r.left,"string"==typeof o&&(o=parseFloat(o,10)),"string"==typeof t&&(t=parseFloat(t,10)),n.top+=o,n.left+=t;return n},m=function(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t},v=b=function(t){var e,n,o;return o=t.split(" "),n=o[0],e=o[1],{top:n,left:e}},S=function(){function t(t){this.position=M(this.position,this);var e,n,o,i,s;for(C.push(this),this.history=[],this.setOptions(t,!1),i=Tether.modules,n=0,o=i.length;o>n;n++)e=i[n],null!=(s=e.initialize)&&s.call(this);this.position()}return t.modules=[],t.prototype.getClass=function(t){var e,n;return(null!=(e=this.options.classes)?e[t]:void 0)?this.options.classes[t]:(null!=(n=this.options.classes)?n[t]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+t:t:""},t.prototype.setOptions=function(t,e){var n,i,s,r,h,a;for(this.options=t,null==e&&(e=!0),n={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=l(n,this.options),h=this.options,this.element=h.element,this.target=h.target,this.targetModifier=h.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),a=["element","target"],s=0,r=a.length;r>s;s++){if(i=a[s],null==this[i])throw new Error("Tether Error: Both element and target must be defined");null!=this[i].jquery?this[i]=this[i][0]:"string"==typeof this[i]&&(this[i]=document.querySelector(this[i]))}if(o(this.element,this.getClass("element")),o(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=v(this.options.targetAttachment),this.attachment=v(this.options.attachment),this.offset=b(this.options.offset),this.targetOffset=b(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent="scroll-handle"===this.targetModifier?this.target:c(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,n,o,i,s,r,h,l;if(null==this.targetModifier)return p(this.target);switch(this.targetModifier){case"visible":return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:(t=p(this.target),i={height:t.height,width:t.width,top:t.top,left:t.left},i.height=Math.min(i.height,t.height-(pageYOffset-t.top)),i.height=Math.min(i.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),i.height=Math.min(innerHeight,i.height),i.height-=2,i.width=Math.min(i.width,t.width-(pageXOffset-t.left)),i.width=Math.min(i.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),i.width=Math.min(innerWidth,i.width),i.width-=2,i.topl.clientWidth||"scroll"===[h.overflow,h.overflowX]||this.target!==document.body,s=0,n&&(s=15),o=t.height-parseFloat(h.borderTopWidth)-parseFloat(h.borderBottomWidth)-s,i={width:15,height:.975*o*(o/l.scrollHeight),left:t.left+t.width-parseFloat(h.borderLeftWidth)-15},e=0,408>o&&this.target===document.body&&(e=-11e-5*Math.pow(o,2)-.00727*o+22.58),this.target!==document.body&&(i.height=Math.max(i.height,24)),r=l.scrollTop/(l.scrollHeight-o),i.top=r*(o-i.height-e)+t.top+parseFloat(h.borderTopWidth),this.target===document.body&&(i.height=Math.max(i.height,24)),i}},t.prototype.clearCache=function(){return this._cache={}},t.prototype.cache=function(t,e){return null==this._cache&&(this._cache={}),null==this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},t.prototype.enable=function(t){return null==t&&(t=!0),o(this.target,this.getClass("enabled")),o(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t?this.position():void 0},t.prototype.disable=function(){return w(this.target,this.getClass("enabled")),w(this.element,this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},t.prototype.destroy=function(){var t,e,n,o,i;for(this.disable(),i=[],t=n=0,o=C.length;o>n;t=++n){if(e=C[t],e===this){C.splice(t,1);break}i.push(void 0)}return i},t.prototype.updateAttachClasses=function(t,e){var n,o,i,s,r,l,a,p,u,f=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),s=["left","top","bottom","right","middle","center"],(null!=(u=this._addAttachClasses)?u.length:void 0)&&this._addAttachClasses.splice(0,this._addAttachClasses.length),n=null!=this._addAttachClasses?this._addAttachClasses:this._addAttachClasses=[],t.top&&n.push(""+this.getClass("element-attached")+"-"+t.top),t.left&&n.push(""+this.getClass("element-attached")+"-"+t.left),e.top&&n.push(""+this.getClass("target-attached")+"-"+e.top),e.left&&n.push(""+this.getClass("target-attached")+"-"+e.left),o=[],r=0,a=s.length;a>r;r++)i=s[r],o.push(""+this.getClass("element-attached")+"-"+i);for(l=0,p=s.length;p>l;l++)i=s[l],o.push(""+this.getClass("target-attached")+"-"+i);return h(function(){return null!=f._addAttachClasses?(O(f.element,f._addAttachClasses,o),O(f.target,f._addAttachClasses,o),f._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,n,o,h,l,f,c,d,g,v,b,y,w,C,T,O,x,S,E,A,M,_,B,P,L,z,F,W,H,Y,N,X,k=this;if(null==t&&(t=!0),this.enabled){for(this.clearCache(),E=r(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,E),e=this.cache("element-bounds",function(){return p(k.element)}),P=e.width,o=e.height,0===P&&0===o&&null!=this.lastSize?(H=this.lastSize,P=H.width,o=H.height):this.lastSize={width:P,height:o},_=M=this.cache("target-bounds",function(){return k.getTargetBounds()}),g=m(s(this.attachment),{width:P,height:o}),A=m(s(E),_),l=m(this.offset,{width:P,height:o}),f=m(this.targetOffset,_),g=i(g,l),A=i(A,f),h=M.left+A.left-g.left,B=M.top+A.top-g.top,Y=Tether.modules,L=0,F=Y.length;F>L;L++)if(c=Y[L],T=c.position.call(this,{left:h,top:B,targetAttachment:E,targetPos:M,elementPos:e,offset:g,targetOffset:A,manualOffset:l,manualTargetOffset:f}),null!=T&&"object"==typeof T){if(T===!1)return!1;B=T.top,h=T.left}if(d={page:{top:B,bottom:document.body.scrollHeight-B-o,left:h,right:document.body.scrollWidth-h-P},viewport:{top:B-pageYOffset,bottom:pageYOffset-B-o+innerHeight,left:h-pageXOffset,right:pageXOffset-h-P+innerWidth}},(null!=(N=this.options.optimizations)?N.moveElement:void 0)!==!1&&null==this.targetModifier){for(b=this.cache("target-offsetparent",function(){return u(k.target)}),C=this.cache("target-offsetparent-bounds",function(){return p(b)}),w=getComputedStyle(b),n=getComputedStyle(this.element),y=C,v={},X=["top","left","bottom","right"],z=0,W=X.length;W>z;z++)S=X[z],v[S]=parseFloat(w["border-"+S+"-width"]);C.right=document.body.scrollWidth-C.left-y.width+v.right,C.bottom=document.body.scrollHeight-C.top-y.height+v.bottom,d.page.top>=C.top+v.top&&d.page.bottom>=C.bottom&&d.page.left>=C.left+v.left&&d.page.right>=C.right&&(x=b.scrollTop,O=b.scrollLeft,d.offset={top:d.page.top-C.top+x-v.top,left:d.page.left-C.left+O-v.left})}return this.move(d),this.history.unshift(d),this.history.length>3&&this.history.pop(),t&&a(),!0}},t.prototype.move=function(t){var e,n,o,i,s,r,a,p,f,c,d,g,m,v,b,y,w,C=this;if(null!=this.element.parentNode){p={};for(c in t){p[c]={};for(i in t[c]){for(o=!1,y=this.history,v=0,b=y.length;b>v;v++)if(a=y[v],!x(null!=(w=a[c])?w[i]:void 0,t[c][i])){o=!0;break}o||(p[c][i]=!0)}}e={top:"",left:"",right:"",bottom:""},f=function(t,n){var o,i,s;return(null!=(s=C.options.optimizations)?s.gpu:void 0)===!1?(t.top?e.top=""+n.top+"px":e.bottom=""+n.bottom+"px",t.left?e.left=""+n.left+"px":e.right=""+n.right+"px"):(t.top?(e.top=0,i=n.top):(e.bottom=0,i=-n.bottom),t.left?(e.left=0,o=n.left):(e.right=0,o=-n.right),e[T]="translateX("+Math.round(o)+"px) translateY("+Math.round(i)+"px)","msTransform"!==T?e[T]+=" translateZ(0)":void 0)},s=!1,(p.page.top||p.page.bottom)&&(p.page.left||p.page.right)?(e.position="absolute",f(p.page,t.page)):(p.viewport.top||p.viewport.bottom)&&(p.viewport.left||p.viewport.right)?(e.position="fixed",f(p.viewport,t.viewport)):null!=p.offset&&p.offset.top&&p.offset.left?(e.position="absolute",r=this.cache("target-offsetparent",function(){return u(C.target)}),u(this.element)!==r&&h(function(){return C.element.parentNode.removeChild(C.element),r.appendChild(C.element)}),f(p.offset,t.offset),s=!0):(e.position="absolute",f({top:!0,left:!0},t.page)),s||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),m={},g=!1;for(i in e)d=e[i],n=this.element.style[i],""===n||""===d||"top"!==i&&"left"!==i&&"bottom"!==i&&"right"!==i||(n=parseFloat(n),d=parseFloat(d)),n!==d&&(g=!0,m[i]=e[i]);return g?h(function(){return l(C.element.style,m)}):void 0}},t}(),Tether.position=y,window.Tether=l(S,Tether)}.call(this),function(){var t,e,n,o,i,s,r,h,l,a,p=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};a=Tether.Utils,r=a.getOuterSize,s=a.getBounds,h=a.getSize,o=a.extend,l=a.updateClasses,n=a.defer,e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},t=["left","top","right","bottom"],i=function(e,n){var o,i,r,h,l,a,p;if("scrollParent"===n?n=e.scrollParent:"window"===n&&(n=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),n===document&&(n=n.documentElement),null!=n.nodeType)for(i=h=s(n),l=getComputedStyle(n),n=[i.left,i.top,h.width+i.left,h.height+i.top],o=a=0,p=t.length;p>a;o=++a)r=t[o],"top"===r||"left"===r?n[o]+=parseFloat(l["border-"+r+"-width"]):n[o]-=parseFloat(l["border-"+r+"-width"]);return n},Tether.modules.push({position:function(e){var r,h,a,u,f,c,d,g,m,v,b,y,w,C,T,O,x,S,E,A,M,_,B,P,L,z,F,W,H,Y,N,X,k,j,q,U,I,R,D,Z,$,V,G,J,K,Q,te,ee=this;if(z=e.top,b=e.left,M=e.targetAttachment,!this.options.constraints)return!0;for(S=function(e){var n,o,i,s;for(ee.removeClass(e),s=[],o=0,i=t.length;i>o;o++)n=t[o],s.push(ee.removeClass(""+e+"-"+n));return s},Z=this.cache("element-bounds",function(){return s(ee.element)}),v=Z.height,F=Z.width,0===F&&0===v&&null!=this.lastSize&&($=this.lastSize,F=$.width,v=$.height),B=this.cache("target-bounds",function(){return ee.getTargetBounds()}),_=B.height,P=B.width,A={},m={},h=[this.getClass("pinned"),this.getClass("out-of-bounds")],V=this.options.constraints,W=0,X=V.length;X>W;W++)g=V[W],g.outOfBoundsClass&&h.push(g.outOfBoundsClass),g.pinnedClass&&h.push(g.pinnedClass);for(H=0,k=h.length;k>H;H++)for(d=h[H],G=["left","top","right","bottom"],Y=0,j=G.length;j>Y;Y++)E=G[Y],h.push(""+d+"-"+E);for(r=[],A=o({},M),m=o({},this.attachment),J=this.options.constraints,N=0,q=J.length;q>N;N++){if(g=J[N],L=g.to,a=g.attachment,T=g.pin,null==a&&(a=""),p.call(a," ")>=0?(K=a.split(" "),c=K[0],f=K[1]):f=c=a,u=i(this,L),("target"===c||"both"===c)&&(zu[3]&&"bottom"===A.top&&(z-=_,A.top="top")),"together"===c&&(zu[3]&&"bottom"===A.top&&("top"===m.top?(z-=_,A.top="top",z-=v,m.top="bottom"):"bottom"===m.top&&(z-=_,A.top="top",z+=v,m.top="top"))),("target"===f||"both"===f)&&(bu[2]&&"right"===A.left&&(b-=P,A.left="left")),"together"===f&&(bu[2]&&"right"===A.left&&("left"===m.left?(b-=P,A.left="left",b-=F,m.left="right"):"right"===m.left&&(b-=P,A.left="left",b+=F,m.left="left"))),("element"===c||"both"===c)&&(zu[3]&&"top"===m.top&&(z-=v,m.top="bottom")),("element"===f||"both"===f)&&(bu[2]&&"left"===m.left&&(b-=F,m.left="right")),"string"==typeof T?T=function(){var t,e,n,o;for(n=T.split(","),o=[],e=0,t=n.length;t>e;e++)C=n[e],o.push(C.trim());return o}():T===!0&&(T=["top","left","right","bottom"]),T||(T=[]),O=[],y=[],z=0?(z=u[1],O.push("top")):y.push("top")),z+v>u[3]&&(p.call(T,"bottom")>=0?(z=u[3]-v,O.push("bottom")):y.push("bottom")),b=0?(b=u[0],O.push("left")):y.push("left")),b+F>u[2]&&(p.call(T,"right")>=0?(b=u[2]-F,O.push("right")):y.push("right")),O.length)for(x=null!=(Q=this.options.pinnedClass)?Q:this.getClass("pinned"),r.push(x),R=0,U=O.length;U>R;R++)E=O[R],r.push(""+x+"-"+E);if(y.length)for(w=null!=(te=this.options.outOfBoundsClass)?te:this.getClass("out-of-bounds"),r.push(w),D=0,I=y.length;I>D;D++)E=y[D],r.push(""+w+"-"+E);(p.call(O,"left")>=0||p.call(O,"right")>=0)&&(m.left=A.left=!1),(p.call(O,"top")>=0||p.call(O,"bottom")>=0)&&(m.top=A.top=!1),(A.top!==M.top||A.left!==M.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,A)}return n(function(){return l(ee.target,r,h),l(ee.element,r,h)}),{top:z,left:b}}})}.call(this),function(){var t,e,n,o;o=Tether.Utils,e=o.getBounds,n=o.updateClasses,t=o.defer,Tether.modules.push({position:function(o){var i,s,r,h,l,a,p,u,f,c,d,g,m,v,b,y,w,C,T,O,x,S,E,A,M,_=this;if(d=o.top,a=o.left,x=this.cache("element-bounds",function(){return e(_.element)}),l=x.height,g=x.width,c=this.getTargetBounds(),h=d+l,p=a+g,i=[],d<=c.bottom&&h>=c.top)for(S=["left","right"],m=0,w=S.length;w>m;m++)u=S[m],((E=c[u])===a||E===p)&&i.push(u);if(a<=c.right&&p>=c.left)for(A=["top","bottom"],v=0,C=A.length;C>v;v++)u=A[v],((M=c[u])===d||M===h)&&i.push(u);for(r=[],s=[],f=["left","top","right","bottom"],r.push(this.getClass("abutted")),b=0,T=f.length;T>b;b++)u=f[b],r.push(""+this.getClass("abutted")+"-"+u);for(i.length&&s.push(this.getClass("abutted")),y=0,O=i.length;O>y;y++)u=i[y],s.push(""+this.getClass("abutted")+"-"+u);return t(function(){return n(_.target,s,r),n(_.element,s,r)}),!0}})}.call(this),function(){Tether.modules.push({position:function(t){var e,n,o,i,s,r,h;return r=t.top,e=t.left,this.options.shift?(n=function(t){return"function"==typeof t?t.call(this,{top:r,left:e}):t},o=n(this.options.shift),"string"==typeof o?(o=o.split(" "),o[1]||(o[1]=o[0]),s=o[0],i=o[1],s=parseFloat(s,10),i=parseFloat(i,10)):(h=[o.top,o.left],s=h[0],i=h[1]),r+=s,e+=i,{top:r,left:e}):void 0}})}.call(this),function(){var t,e,n,o,i,s,r,h,l,a,p,u,f,c,d=function(t,e){return function(){return t.apply(e,arguments)}},g={}.hasOwnProperty,m=function(t,e){function n(){this.constructor=t}for(var o in e)g.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};c=Tether.Utils,h=c.extend,u=c.removeClass,s=c.addClass,e=c.Evented,l=c.getBounds,f=c.uniqueId,t={top:"top center",left:"middle right",right:"middle left",bottom:"bottom center"},r=function(t){var e;return e=document.createElement("div"),e.innerHTML=t,e.children[0]},a=function(t,e){var n,o,i,s,r;return n=null!=(o=null!=(i=null!=(s=null!=(r=t.matches)?r:t.matchesSelector)?s:t.webkitMatchesSelector)?i:t.mozMatchesSelector)?o:t.oMatchesSelector,n.call(t,e)},p=function(t,e){var n,o,i,s,r,h;if(null==t)return t;if("object"==typeof t)return t;for(s=t.split(" "),s.length>e.length&&(s[0]=s.slice(0,+(s.length-e.length)+1||9e9).join(" "),s.splice(1,s.length-e.length)),o={},n=r=0,h=e.length;h>r;n=++r)i=e[n],o[i]=s[n];return o},o=function(e){function n(t,e){this.tour=t,this.destroy=d(this.destroy,this),this.scrollTo=d(this.scrollTo,this),this.complete=d(this.complete,this),this.cancel=d(this.cancel,this),this.isOpen=d(this.isOpen,this),this.hide=d(this.hide,this),this.show=d(this.show,this),this.setOptions(e)}return m(n,e),n.prototype.setOptions=function(t){var e,n,o,i;if(this.options=null!=t?t:{},this.destroy(),this.id=this.options.id||this.id||"step-"+f(),this.options.when){i=this.options.when;for(e in i)n=i[e],this.on(e,n,this)}return null!=(o=this.options).buttons?(o=this.options).buttons:o.buttons=[{text:"Next",action:this.tour.next}]},n.prototype.getTour=function(){return this.tour},n.prototype.bindAdvance=function(){var t,e,n,o,i=this;return o=p(this.options.advanceOn,["event","selector"]),t=o.event,n=o.selector,e=function(t){if(i.isOpen())if(null!=n){if(a(t.target,n))return i.tour.next()}else if(i.el&&t.target===i.el)return i.tour.next()},document.body.addEventListener(t,e),this.on("destroy",function(){return document.body.removeEventListener(t,e)})},n.prototype.getAttachTo=function(){var t;if(t=p(this.options.attachTo,["element","on"]),null==t&&(t={}),"string"==typeof t.element&&(t.element=document.querySelector(t.element),null==t.element))throw new Error("Shepherd step's attachTo was not found in the page");return t},n.prototype.setupTether=function(){var e,n,o;if("undefined"==typeof Tether||null===Tether)throw new Error("Using the attachment feature of Shepherd requires the Tether library");return n=this.getAttachTo(),e=t[n.on||"right"],null==n.element&&(n.element="viewport",e="middle center"),o={classPrefix:"shepherd",element:this.el,constraints:[{to:"window",pin:!0,attachment:"together"}],target:n.element,offset:n.offset||"0 0",attachment:e},this.tether=new Tether(h(o,this.options.tetherOptions))},n.prototype.show=function(){var t,e=this;return null==this.el&&this.render(),s(this.el,"shepherd-open"),null!=(t=this.tether)&&t.enable(),this.options.scrollTo&&setTimeout(function(){return e.scrollTo()}),this.trigger("show")},n.prototype.hide=function(){var t;return u(this.el,"shepherd-open"),null!=(t=this.tether)&&t.disable(),this.trigger("hide")},n.prototype.isOpen=function(){return hasClass(this.el,"shepherd-open")},n.prototype.cancel=function(){return this.hide(),this.trigger("cancel")},n.prototype.complete=function(){return this.hide(),this.trigger("complete")},n.prototype.scrollTo=function(){var t;return t=this.getAttachTo().element,null!=t?t.scrollIntoView():void 0},n.prototype.destroy=function(){var t;return null!=this.el&&(document.body.removeChild(this.el),delete this.el),null!=(t=this.tether)&&t.destroy(),this.trigger("destroy")},n.prototype.render=function(){var t,e,n,o,i,s,h,l,a,p,u,f,c,d,g,m;if(null!=this.el&&this.destroy(),this.el=r(""),o=document.createElement("div"),o.className="shepherd-content",this.el.appendChild(o),null!=this.options.title&&(s=document.createElement("header"),s.innerHTML=""+this.options.title+"
",this.el.className+=" shepherd-has-title",o.appendChild(s)),null!=this.options.text){for(a=r(""),l=this.options.text,"string"==typeof l&&(l=[l]),p=0,f=l.length;f>p;p++)h=l[p],a.innerHTML+=""+h+"
";o.appendChild(a)}if(i=document.createElement("footer"),this.options.buttons){for(e=r(""),g=this.options.buttons,u=0,c=g.length;c>u;u++)n=g[u],t=r(""+n.text+""),e.appendChild(t),this.bindButtonEvents(n,t.querySelector("a"));i.appendChild(e)}return o.appendChild(i),document.body.appendChild(this.el),this.setupTether(),this.options.advanceOn?this.bindAdvance():void 0},n.prototype.bindButtonEvents=function(t,e){var n,o,i,s,r=this;null==t.events&&(t.events={}),null!=t.action&&(t.events.click=t.action),s=t.events;for(n in s)o=s[n],"string"==typeof o&&(i=o,o=function(){return r.tour.show(i)}),e.addEventListener(n,o);return this.on("destroy",function(){var i,s;i=t.events,s=[];for(n in i)o=i[n],s.push(e.removeEventListener(n,o));return s})},n}(e),i=function(t){function e(t){var e,o,i,s,r,h=this;for(this.options=null!=t?t:{},this.hide=d(this.hide,this),this.cancel=d(this.cancel,this),this.back=d(this.back,this),this.next=d(this.next,this),this.steps=null!=(s=this.options.steps)?s:[],r=["complete","cancel","hide","start","show"],o=0,i=r.length;i>o;o++)e=r[o],this.on(e,function(t){return null==t&&(t={}),t.tour=h,n.trigger(e,t)})}return m(e,t),e.prototype.addStep=function(t,e){var n;return null==e&&(e=t),e instanceof o?e.tour=this:(("string"==(n=typeof t)||"number"===n)&&(e.id=t.toString()),e=h({},this.options.defaults,e),e=new o(this,e)),this.steps.push(e),e},e.prototype.getById=function(t){var e,n,o,i;for(i=this.steps,n=0,o=i.length;o>n;n++)if(e=i[n],e.id===t)return e},e.prototype.getCurrentStep=function(){return this.currentStep},e.prototype.next=function(){var t;return t=this.steps.indexOf(this.currentStep),t===this.steps.length-1?(this.hide(t),this.trigger("complete"),this.done()):this.show(t+1)},e.prototype.back=function(){var t;return t=this.steps.indexOf(this.currentStep),this.show(t-1)},e.prototype.cancel=function(){var t;return null!=(t=this.currentStep)&&t.cancel(),this.trigger("cancel"),this.done()},e.prototype.hide=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("hide"),this.done()},e.prototype.done=function(){return n.activeTour=null},e.prototype.show=function(t){var e;return null==t&&(t=0),this.currentStep&&this.currentStep.hide(),n.activeTour=this,e="string"==typeof t?this.getById(t):this.steps[t],e?(this.trigger("show",{step:e,previous:this.currentStep}),this.currentStep=e,e.show()):void 0},e.prototype.start=function(){return this.trigger("start"),this.currentStep=null,this.next()},e}(e),n=new e,h(n,{Tour:i,Step:o}),window.Shepherd=n}.call(this);
\ No newline at end of file
diff --git a/ajax/libs/shepherd/0.4.0/shepherd.js b/ajax/libs/shepherd/0.4.0/shepherd.js
new file mode 100644
index 000000000..9617910f7
--- /dev/null
+++ b/ajax/libs/shepherd/0.4.0/shepherd.js
@@ -0,0 +1,1793 @@
+/*! shepherd 0.4.0 */
+/*! tether 0.4.8 */
+(function() {
+ var Evented, addClass, defer, deferred, extend, flush, getBounds, getOffsetParent, getOrigin, getScrollParent, hasClass, node, removeClass, uniqueId, updateClasses, zeroPosCache,
+ __hasProp = {}.hasOwnProperty,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
+ __slice = [].slice;
+
+ if (window.Tether == null) {
+ window.Tether = {};
+ }
+
+ getScrollParent = function(el) {
+ var parent, position, scrollParent, style, _ref;
+ position = getComputedStyle(el).position;
+ if (position === 'fixed') {
+ return el;
+ }
+ scrollParent = void 0;
+ parent = el;
+ while (parent = parent.parentNode) {
+ try {
+ style = getComputedStyle(parent);
+ } catch (_error) {}
+ if (style == null) {
+ return parent;
+ }
+ if (/(auto|scroll)/.test(style['overflow'] + style['overflow-y'] + style['overflow-x'])) {
+ if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) {
+ return parent;
+ }
+ }
+ }
+ return document.body;
+ };
+
+ uniqueId = (function() {
+ var id;
+ id = 0;
+ return function() {
+ return id++;
+ };
+ })();
+
+ zeroPosCache = {};
+
+ getOrigin = function(doc) {
+ var id, k, node, v, _ref;
+ node = doc._tetherZeroElement;
+ if (node == null) {
+ node = doc.createElement('div');
+ node.setAttribute('data-tether-id', uniqueId());
+ extend(node.style, {
+ top: 0,
+ left: 0,
+ position: 'absolute'
+ });
+ doc.body.appendChild(node);
+ doc._tetherZeroElement = node;
+ }
+ id = node.getAttribute('data-tether-id');
+ if (zeroPosCache[id] == null) {
+ zeroPosCache[id] = {};
+ _ref = node.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ zeroPosCache[id][k] = v;
+ }
+ defer(function() {
+ return zeroPosCache[id] = void 0;
+ });
+ }
+ return zeroPosCache[id];
+ };
+
+ node = null;
+
+ getBounds = function(el) {
+ var box, doc, docEl, k, origin, v, _ref;
+ if (el === document) {
+ doc = document;
+ el = document.documentElement;
+ } else {
+ doc = el.ownerDocument;
+ }
+ docEl = doc.documentElement;
+ box = {};
+ _ref = el.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ box[k] = v;
+ }
+ origin = getOrigin(doc);
+ box.top -= origin.top;
+ box.left -= origin.left;
+ box.top = box.top - docEl.clientTop;
+ box.left = box.left - docEl.clientLeft;
+ box.right = doc.body.clientWidth - box.width - box.left;
+ box.bottom = doc.body.clientHeight - box.height - box.top;
+ return box;
+ };
+
+ getOffsetParent = function(el) {
+ return el.offsetParent || document.documentElement;
+ };
+
+ extend = function(out) {
+ var args, key, obj, val, _i, _len, _ref;
+ if (out == null) {
+ out = {};
+ }
+ args = [];
+ Array.prototype.push.apply(args, arguments);
+ _ref = args.slice(1);
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ obj = _ref[_i];
+ if (obj) {
+ for (key in obj) {
+ if (!__hasProp.call(obj, key)) continue;
+ val = obj[key];
+ out[key] = val;
+ }
+ }
+ }
+ return out;
+ };
+
+ removeClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ _results.push(el.classList.remove(cls));
+ }
+ return _results;
+ } else {
+ return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' ');
+ }
+ };
+
+ addClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ _results.push(el.classList.add(cls));
+ }
+ return _results;
+ } else {
+ removeClass(el, name);
+ return el.className += " " + name;
+ }
+ };
+
+ hasClass = function(el, name) {
+ if (el.classList != null) {
+ return el.classList.contains(name);
+ } else {
+ return new RegExp("(^| )" + name + "( |$)", 'gi').test(el.className);
+ }
+ };
+
+ updateClasses = function(el, add, all) {
+ var cls, _i, _j, _len, _len1, _results;
+ for (_i = 0, _len = all.length; _i < _len; _i++) {
+ cls = all[_i];
+ if (__indexOf.call(add, cls) < 0) {
+ if (hasClass(el, cls)) {
+ removeClass(el, cls);
+ }
+ }
+ }
+ _results = [];
+ for (_j = 0, _len1 = add.length; _j < _len1; _j++) {
+ cls = add[_j];
+ if (!hasClass(el, cls)) {
+ _results.push(addClass(el, cls));
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ deferred = [];
+
+ defer = function(fn) {
+ return deferred.push(fn);
+ };
+
+ flush = function() {
+ var fn, _results;
+ _results = [];
+ while (fn = deferred.pop()) {
+ _results.push(fn());
+ }
+ return _results;
+ };
+
+ Evented = (function() {
+ function Evented() {}
+
+ Evented.prototype.on = function(event, handler, ctx, once) {
+ var _base;
+ if (once == null) {
+ once = false;
+ }
+ if (this.bindings == null) {
+ this.bindings = {};
+ }
+ if ((_base = this.bindings)[event] == null) {
+ _base[event] = [];
+ }
+ return this.bindings[event].push({
+ handler: handler,
+ ctx: ctx,
+ once: once
+ });
+ };
+
+ Evented.prototype.once = function(event, handler, ctx) {
+ return this.on(event, handler, ctx, true);
+ };
+
+ Evented.prototype.off = function(event, handler) {
+ var i, _ref, _results;
+ if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
+ return;
+ }
+ if (handler == null) {
+ return delete this.bindings[event];
+ } else {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ if (this.bindings[event][i].handler === handler) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ Evented.prototype.trigger = function() {
+ var args, ctx, event, handler, i, once, _ref, _ref1, _results;
+ event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+ if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
+ handler.apply(ctx != null ? ctx : this, args);
+ if (once) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ return Evented;
+
+ })();
+
+ Tether.Utils = {
+ getScrollParent: getScrollParent,
+ getBounds: getBounds,
+ getOffsetParent: getOffsetParent,
+ extend: extend,
+ addClass: addClass,
+ removeClass: removeClass,
+ hasClass: hasClass,
+ updateClasses: updateClasses,
+ defer: defer,
+ flush: flush,
+ uniqueId: uniqueId,
+ Evented: Evented
+ };
+
+}).call(this);
+
+(function() {
+ var MIRROR_LR, MIRROR_TB, OFFSET_MAP, addClass, addOffset, attachmentToOffset, autoToFixedAttachment, defer, extend, flush, getBounds, getOffsetParent, getOuterSize, getScrollParent, getSize, now, offsetToPx, parseAttachment, parseOffset, position, removeClass, tethers, transformKey, updateClasses, within, _Tether, _ref,
+ __slice = [].slice,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("You must include the utils.js file before tether.js");
+ }
+
+ _ref = Tether.Utils, getScrollParent = _ref.getScrollParent, getSize = _ref.getSize, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getOffsetParent = _ref.getOffsetParent, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, updateClasses = _ref.updateClasses, defer = _ref.defer, flush = _ref.flush;
+
+ within = function(a, b, diff) {
+ if (diff == null) {
+ diff = 1;
+ }
+ return (a + diff >= b && b >= a - diff);
+ };
+
+ transformKey = (function() {
+ var el, key, _i, _len, _ref1;
+ el = document.createElement('div');
+ _ref1 = ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ key = _ref1[_i];
+ if (el.style[key] !== void 0) {
+ return key;
+ }
+ }
+ })();
+
+ tethers = [];
+
+ position = function() {
+ var tether, _i, _len;
+ for (_i = 0, _len = tethers.length; _i < _len; _i++) {
+ tether = tethers[_i];
+ tether.position(false);
+ }
+ return flush();
+ };
+
+ now = function() {
+ var _ref1;
+ return (_ref1 = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref1 : +(new Date);
+ };
+
+ (function() {
+ var event, lastCall, lastDuration, pendingTimeout, tick, _i, _len, _ref1, _results;
+ lastCall = null;
+ lastDuration = null;
+ pendingTimeout = null;
+ tick = function() {
+ if ((lastDuration != null) && lastDuration > 16) {
+ lastDuration = Math.min(lastDuration - 16, 250);
+ pendingTimeout = setTimeout(tick, 250);
+ return;
+ }
+ if ((lastCall != null) && (now() - lastCall) < 10) {
+ return;
+ }
+ if (pendingTimeout != null) {
+ clearTimeout(pendingTimeout);
+ pendingTimeout = null;
+ }
+ lastCall = now();
+ position();
+ return lastDuration = now() - lastCall;
+ };
+ _ref1 = ['resize', 'scroll'];
+ _results = [];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ event = _ref1[_i];
+ _results.push(window.addEventListener(event, tick));
+ }
+ return _results;
+ })();
+
+ MIRROR_LR = {
+ center: 'center',
+ left: 'right',
+ right: 'left'
+ };
+
+ MIRROR_TB = {
+ middle: 'middle',
+ top: 'bottom',
+ bottom: 'top'
+ };
+
+ OFFSET_MAP = {
+ top: 0,
+ left: 0,
+ middle: '50%',
+ center: '50%',
+ bottom: '100%',
+ right: '100%'
+ };
+
+ autoToFixedAttachment = function(attachment, relativeToAttachment) {
+ var left, top;
+ left = attachment.left, top = attachment.top;
+ if (left === 'auto') {
+ left = MIRROR_LR[relativeToAttachment.left];
+ }
+ if (top === 'auto') {
+ top = MIRROR_TB[relativeToAttachment.top];
+ }
+ return {
+ left: left,
+ top: top
+ };
+ };
+
+ attachmentToOffset = function(attachment) {
+ var _ref1, _ref2;
+ return {
+ left: (_ref1 = OFFSET_MAP[attachment.left]) != null ? _ref1 : attachment.left,
+ top: (_ref2 = OFFSET_MAP[attachment.top]) != null ? _ref2 : attachment.top
+ };
+ };
+
+ addOffset = function() {
+ var left, offsets, out, top, _i, _len, _ref1;
+ offsets = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ out = {
+ top: 0,
+ left: 0
+ };
+ for (_i = 0, _len = offsets.length; _i < _len; _i++) {
+ _ref1 = offsets[_i], top = _ref1.top, left = _ref1.left;
+ if (typeof top === 'string') {
+ top = parseFloat(top, 10);
+ }
+ if (typeof left === 'string') {
+ left = parseFloat(left, 10);
+ }
+ out.top += top;
+ out.left += left;
+ }
+ return out;
+ };
+
+ offsetToPx = function(offset, size) {
+ if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
+ offset.left = parseFloat(offset.left, 10) / 100 * size.width;
+ }
+ if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
+ offset.top = parseFloat(offset.top, 10) / 100 * size.height;
+ }
+ return offset;
+ };
+
+ parseAttachment = parseOffset = function(value) {
+ var left, top, _ref1;
+ _ref1 = value.split(' '), top = _ref1[0], left = _ref1[1];
+ return {
+ top: top,
+ left: left
+ };
+ };
+
+ _Tether = (function() {
+ _Tether.modules = [];
+
+ function _Tether(options) {
+ this.position = __bind(this.position, this);
+ var module, _i, _len, _ref1, _ref2;
+ tethers.push(this);
+ this.history = [];
+ this.setOptions(options, false);
+ _ref1 = Tether.modules;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ module = _ref1[_i];
+ if ((_ref2 = module.initialize) != null) {
+ _ref2.call(this);
+ }
+ }
+ this.position();
+ }
+
+ _Tether.prototype.getClass = function(key) {
+ var _ref1, _ref2;
+ if ((_ref1 = this.options.classes) != null ? _ref1[key] : void 0) {
+ return this.options.classes[key];
+ } else if (((_ref2 = this.options.classes) != null ? _ref2[key] : void 0) !== false) {
+ if (this.options.classPrefix) {
+ return "" + this.options.classPrefix + "-" + key;
+ } else {
+ return key;
+ }
+ } else {
+ return '';
+ }
+ };
+
+ _Tether.prototype.setOptions = function(options, position) {
+ var defaults, key, _i, _len, _ref1, _ref2;
+ this.options = options;
+ if (position == null) {
+ position = true;
+ }
+ defaults = {
+ offset: '0 0',
+ targetOffset: '0 0',
+ targetAttachment: 'auto auto',
+ classPrefix: 'tether'
+ };
+ this.options = extend(defaults, this.options);
+ _ref1 = this.options, this.element = _ref1.element, this.target = _ref1.target, this.targetModifier = _ref1.targetModifier;
+ if (this.target === 'viewport') {
+ this.target = document.body;
+ this.targetModifier = 'visible';
+ } else if (this.target === 'scroll-handle') {
+ this.target = document.body;
+ this.targetModifier = 'scroll-handle';
+ }
+ _ref2 = ['element', 'target'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ key = _ref2[_i];
+ if (this[key] == null) {
+ throw new Error("Tether Error: Both element and target must be defined");
+ }
+ if (this[key].jquery != null) {
+ this[key] = this[key][0];
+ } else if (typeof this[key] === 'string') {
+ this[key] = document.querySelector(this[key]);
+ }
+ }
+ addClass(this.element, this.getClass('element'));
+ addClass(this.target, this.getClass('target'));
+ if (!this.options.attachment) {
+ throw new Error("Tether Error: You must provide an attachment");
+ }
+ this.targetAttachment = parseAttachment(this.options.targetAttachment);
+ this.attachment = parseAttachment(this.options.attachment);
+ this.offset = parseOffset(this.options.offset);
+ this.targetOffset = parseOffset(this.options.targetOffset);
+ if (this.scrollParent != null) {
+ this.disable();
+ }
+ if (this.targetModifier === 'scroll-handle') {
+ this.scrollParent = this.target;
+ } else {
+ this.scrollParent = getScrollParent(this.target);
+ }
+ if (this.options.enabled !== false) {
+ return this.enable(position);
+ }
+ };
+
+ _Tether.prototype.getTargetBounds = function() {
+ var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target;
+ if (this.targetModifier != null) {
+ switch (this.targetModifier) {
+ case 'visible':
+ if (this.target === document.body) {
+ return {
+ top: pageYOffset,
+ left: pageXOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(this.target);
+ out = {
+ height: bounds.height,
+ width: bounds.width,
+ top: bounds.top,
+ left: bounds.left
+ };
+ out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
+ out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight)));
+ out.height = Math.min(innerHeight, out.height);
+ out.height -= 2;
+ out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
+ out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth)));
+ out.width = Math.min(innerWidth, out.width);
+ out.width -= 2;
+ if (out.top < pageYOffset) {
+ out.top = pageYOffset;
+ }
+ if (out.left < pageXOffset) {
+ out.left = pageXOffset;
+ }
+ return out;
+ }
+ break;
+ case 'scroll-handle':
+ target = this.target;
+ if (target === document.body) {
+ target = document.documentElement;
+ bounds = {
+ left: pageXOffset,
+ top: pageYOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(target);
+ }
+ style = getComputedStyle(target);
+ hasBottomScroll = target.scrollWidth > target.clientWidth || 'scroll' === [style.overflow, style.overflowX] || this.target !== document.body;
+ scrollBottom = 0;
+ if (hasBottomScroll) {
+ scrollBottom = 15;
+ }
+ height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
+ out = {
+ width: 15,
+ height: height * 0.975 * (height / target.scrollHeight),
+ left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
+ };
+ fitAdj = 0;
+ if (height < 408 && this.target === document.body) {
+ fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
+ }
+ if (this.target !== document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ scrollPercentage = target.scrollTop / (target.scrollHeight - height);
+ out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
+ if (this.target === document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ return out;
+ }
+ } else {
+ return getBounds(this.target);
+ }
+ };
+
+ _Tether.prototype.clearCache = function() {
+ return this._cache = {};
+ };
+
+ _Tether.prototype.cache = function(k, getter) {
+ if (this._cache == null) {
+ this._cache = {};
+ }
+ if (this._cache[k] == null) {
+ this._cache[k] = getter.call(this);
+ }
+ return this._cache[k];
+ };
+
+ _Tether.prototype.enable = function(position) {
+ if (position == null) {
+ position = true;
+ }
+ addClass(this.target, this.getClass('enabled'));
+ addClass(this.element, this.getClass('enabled'));
+ this.enabled = true;
+ if (this.scrollParent !== document) {
+ this.scrollParent.addEventListener('scroll', this.position);
+ }
+ if (position) {
+ return this.position();
+ }
+ };
+
+ _Tether.prototype.disable = function() {
+ removeClass(this.target, this.getClass('enabled'));
+ removeClass(this.element, this.getClass('enabled'));
+ this.enabled = false;
+ if (this.scrollParent != null) {
+ return this.scrollParent.removeEventListener('scroll', this.position);
+ }
+ };
+
+ _Tether.prototype.destroy = function() {
+ var i, tether, _i, _len, _results;
+ this.disable();
+ _results = [];
+ for (i = _i = 0, _len = tethers.length; _i < _len; i = ++_i) {
+ tether = tethers[i];
+ if (tether === this) {
+ tethers.splice(i, 1);
+ break;
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ _Tether.prototype.updateAttachClasses = function(elementAttach, targetAttach) {
+ var add, all, side, sides, _i, _j, _len, _len1, _ref1,
+ _this = this;
+ if (elementAttach == null) {
+ elementAttach = this.attachment;
+ }
+ if (targetAttach == null) {
+ targetAttach = this.targetAttachment;
+ }
+ sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
+ if ((_ref1 = this._addAttachClasses) != null ? _ref1.length : void 0) {
+ this._addAttachClasses.splice(0, this._addAttachClasses.length);
+ }
+ add = this._addAttachClasses != null ? this._addAttachClasses : this._addAttachClasses = [];
+ if (elementAttach.top) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.top);
+ }
+ if (elementAttach.left) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.left);
+ }
+ if (targetAttach.top) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.top);
+ }
+ if (targetAttach.left) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.left);
+ }
+ all = [];
+ for (_i = 0, _len = sides.length; _i < _len; _i++) {
+ side = sides[_i];
+ all.push("" + (this.getClass('element-attached')) + "-" + side);
+ }
+ for (_j = 0, _len1 = sides.length; _j < _len1; _j++) {
+ side = sides[_j];
+ all.push("" + (this.getClass('target-attached')) + "-" + side);
+ }
+ return defer(function() {
+ if (_this._addAttachClasses == null) {
+ return;
+ }
+ updateClasses(_this.element, _this._addAttachClasses, all);
+ updateClasses(_this.target, _this._addAttachClasses, all);
+ return _this._addAttachClasses = void 0;
+ });
+ };
+
+ _Tether.prototype.position = function(flushChanges) {
+ var elementPos, elementStyle, height, left, manualOffset, manualTargetOffset, module, next, offset, offsetBorder, offsetParent, offsetParentSize, offsetParentStyle, offsetPosition, ret, scrollLeft, scrollTop, side, targetAttachment, targetOffset, targetPos, targetSize, top, width, _i, _j, _len, _len1, _ref1, _ref2, _ref3, _ref4,
+ _this = this;
+ if (flushChanges == null) {
+ flushChanges = true;
+ }
+ if (!this.enabled) {
+ return;
+ }
+ this.clearCache();
+ targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
+ this.updateAttachClasses(this.attachment, targetAttachment);
+ elementPos = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ });
+ width = elementPos.width, height = elementPos.height;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref1 = this.lastSize, width = _ref1.width, height = _ref1.height;
+ } else {
+ this.lastSize = {
+ width: width,
+ height: height
+ };
+ }
+ targetSize = targetPos = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ offset = offsetToPx(attachmentToOffset(this.attachment), {
+ width: width,
+ height: height
+ });
+ targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
+ manualOffset = offsetToPx(this.offset, {
+ width: width,
+ height: height
+ });
+ manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
+ offset = addOffset(offset, manualOffset);
+ targetOffset = addOffset(targetOffset, manualTargetOffset);
+ left = targetPos.left + targetOffset.left - offset.left;
+ top = targetPos.top + targetOffset.top - offset.top;
+ _ref2 = Tether.modules;
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ module = _ref2[_i];
+ ret = module.position.call(this, {
+ left: left,
+ top: top,
+ targetAttachment: targetAttachment,
+ targetPos: targetPos,
+ elementPos: elementPos,
+ offset: offset,
+ targetOffset: targetOffset,
+ manualOffset: manualOffset,
+ manualTargetOffset: manualTargetOffset
+ });
+ if ((ret == null) || typeof ret !== 'object') {
+ continue;
+ } else if (ret === false) {
+ return false;
+ } else {
+ top = ret.top, left = ret.left;
+ }
+ }
+ next = {
+ page: {
+ top: top,
+ bottom: document.body.scrollHeight - top - height,
+ left: left,
+ right: document.body.scrollWidth - left - width
+ },
+ viewport: {
+ top: top - pageYOffset,
+ bottom: pageYOffset - top - height + innerHeight,
+ left: left - pageXOffset,
+ right: pageXOffset - left - width + innerWidth
+ }
+ };
+ if (((_ref3 = this.options.optimizations) != null ? _ref3.moveElement : void 0) !== false && (this.targetModifier == null)) {
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ offsetPosition = this.cache('target-offsetparent-bounds', function() {
+ return getBounds(offsetParent);
+ });
+ offsetParentStyle = getComputedStyle(offsetParent);
+ elementStyle = getComputedStyle(this.element);
+ offsetParentSize = offsetPosition;
+ offsetBorder = {};
+ _ref4 = ['top', 'left', 'bottom', 'right'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ offsetBorder[side] = parseFloat(offsetParentStyle["border-" + side + "-width"]);
+ }
+ offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
+ offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
+ if (next.page.top >= (offsetPosition.top + offsetBorder.top) && next.page.bottom >= offsetPosition.bottom) {
+ if (next.page.left >= (offsetPosition.left + offsetBorder.left) && next.page.right >= offsetPosition.right) {
+ scrollTop = offsetParent.scrollTop;
+ scrollLeft = offsetParent.scrollLeft;
+ next.offset = {
+ top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
+ left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
+ };
+ }
+ }
+ }
+ this.move(next);
+ this.history.unshift(next);
+ if (this.history.length > 3) {
+ this.history.pop();
+ }
+ if (flushChanges) {
+ flush();
+ }
+ return true;
+ };
+
+ _Tether.prototype.move = function(position) {
+ var css, elVal, found, key, moved, offsetParent, point, same, transcribe, type, val, write, writeCSS, _i, _len, _ref1, _ref2,
+ _this = this;
+ if (this.element.parentNode == null) {
+ return;
+ }
+ same = {};
+ for (type in position) {
+ same[type] = {};
+ for (key in position[type]) {
+ found = false;
+ _ref1 = this.history;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ point = _ref1[_i];
+ if (!within((_ref2 = point[type]) != null ? _ref2[key] : void 0, position[type][key])) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ same[type][key] = true;
+ }
+ }
+ }
+ css = {
+ top: '',
+ left: '',
+ right: '',
+ bottom: ''
+ };
+ transcribe = function(same, pos) {
+ var xPos, yPos, _ref3;
+ if (((_ref3 = _this.options.optimizations) != null ? _ref3.gpu : void 0) !== false) {
+ if (same.top) {
+ css.top = 0;
+ yPos = pos.top;
+ } else {
+ css.bottom = 0;
+ yPos = -pos.bottom;
+ }
+ if (same.left) {
+ css.left = 0;
+ xPos = pos.left;
+ } else {
+ css.right = 0;
+ xPos = -pos.right;
+ }
+ css[transformKey] = "translateX(" + (Math.round(xPos)) + "px) translateY(" + (Math.round(yPos)) + "px)";
+ if (transformKey !== 'msTransform') {
+ return css[transformKey] += " translateZ(0)";
+ }
+ } else {
+ if (same.top) {
+ css.top = "" + pos.top + "px";
+ } else {
+ css.bottom = "" + pos.bottom + "px";
+ }
+ if (same.left) {
+ return css.left = "" + pos.left + "px";
+ } else {
+ return css.right = "" + pos.right + "px";
+ }
+ }
+ };
+ moved = false;
+ if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
+ css.position = 'absolute';
+ transcribe(same.page, position.page);
+ } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
+ css.position = 'fixed';
+ transcribe(same.viewport, position.viewport);
+ } else if ((same.offset != null) && same.offset.top && same.offset.left) {
+ css.position = 'absolute';
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ if (getOffsetParent(this.element) !== offsetParent) {
+ defer(function() {
+ _this.element.parentNode.removeChild(_this.element);
+ return offsetParent.appendChild(_this.element);
+ });
+ }
+ transcribe(same.offset, position.offset);
+ moved = true;
+ } else {
+ css.position = 'absolute';
+ transcribe({
+ top: true,
+ left: true
+ }, position.page);
+ }
+ if (!moved && this.element.parentNode.tagName !== 'BODY') {
+ this.element.parentNode.removeChild(this.element);
+ document.body.appendChild(this.element);
+ }
+ writeCSS = {};
+ write = false;
+ for (key in css) {
+ val = css[key];
+ elVal = this.element.style[key];
+ if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) {
+ elVal = parseFloat(elVal);
+ val = parseFloat(val);
+ }
+ if (elVal !== val) {
+ write = true;
+ writeCSS[key] = css[key];
+ }
+ }
+ if (write) {
+ return defer(function() {
+ return extend(_this.element.style, writeCSS);
+ });
+ }
+ };
+
+ return _Tether;
+
+ })();
+
+ Tether.position = position;
+
+ window.Tether = extend(_Tether, Tether);
+
+}).call(this);
+
+(function() {
+ var BOUNDS_FORMAT, MIRROR_ATTACH, defer, extend, getBoundingRect, getBounds, getOuterSize, getSize, updateClasses, _ref,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+
+ _ref = Tether.Utils, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getSize = _ref.getSize, extend = _ref.extend, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ MIRROR_ATTACH = {
+ left: 'right',
+ right: 'left',
+ top: 'bottom',
+ bottom: 'top',
+ middle: 'middle'
+ };
+
+ BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
+
+ getBoundingRect = function(tether, to) {
+ var i, pos, side, size, style, _i, _len;
+ if (to === 'scrollParent') {
+ to = tether.scrollParent;
+ } else if (to === 'window') {
+ to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
+ }
+ if (to === document) {
+ to = to.documentElement;
+ }
+ if (to.nodeType != null) {
+ pos = size = getBounds(to);
+ style = getComputedStyle(to);
+ to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
+ for (i = _i = 0, _len = BOUNDS_FORMAT.length; _i < _len; i = ++_i) {
+ side = BOUNDS_FORMAT[i];
+ if (side === 'top' || side === 'left') {
+ to[i] += parseFloat(style["border-" + side + "-width"]);
+ } else {
+ to[i] -= parseFloat(style["border-" + side + "-width"]);
+ }
+ }
+ }
+ return to;
+ };
+
+ Tether.modules.push({
+ position: function(_arg) {
+ var addClasses, allClasses, attachment, bounds, changeAttachX, changeAttachY, cls, constraint, eAttachment, height, left, oob, oobClass, p, pin, pinned, pinnedClass, removeClass, side, tAttachment, targetAttachment, targetHeight, targetSize, targetWidth, to, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8,
+ _this = this;
+ top = _arg.top, left = _arg.left, targetAttachment = _arg.targetAttachment;
+ if (!this.options.constraints) {
+ return true;
+ }
+ removeClass = function(prefix) {
+ var side, _i, _len, _results;
+ _this.removeClass(prefix);
+ _results = [];
+ for (_i = 0, _len = BOUNDS_FORMAT.length; _i < _len; _i++) {
+ side = BOUNDS_FORMAT[_i];
+ _results.push(_this.removeClass("" + prefix + "-" + side));
+ }
+ return _results;
+ };
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref2 = this.lastSize, width = _ref2.width, height = _ref2.height;
+ }
+ targetSize = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ targetHeight = targetSize.height;
+ targetWidth = targetSize.width;
+ tAttachment = {};
+ eAttachment = {};
+ allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
+ _ref3 = this.options.constraints;
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ constraint = _ref3[_i];
+ if (constraint.outOfBoundsClass) {
+ allClasses.push(constraint.outOfBoundsClass);
+ }
+ if (constraint.pinnedClass) {
+ allClasses.push(constraint.pinnedClass);
+ }
+ }
+ for (_j = 0, _len1 = allClasses.length; _j < _len1; _j++) {
+ cls = allClasses[_j];
+ _ref4 = ['left', 'top', 'right', 'bottom'];
+ for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
+ side = _ref4[_k];
+ allClasses.push("" + cls + "-" + side);
+ }
+ }
+ addClasses = [];
+ tAttachment = extend({}, targetAttachment);
+ eAttachment = extend({}, this.attachment);
+ _ref5 = this.options.constraints;
+ for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) {
+ constraint = _ref5[_l];
+ to = constraint.to, attachment = constraint.attachment, pin = constraint.pin;
+ if (attachment == null) {
+ attachment = '';
+ }
+ if (__indexOf.call(attachment, ' ') >= 0) {
+ _ref6 = attachment.split(' '), changeAttachY = _ref6[0], changeAttachX = _ref6[1];
+ } else {
+ changeAttachX = changeAttachY = attachment;
+ }
+ bounds = getBoundingRect(this, to);
+ if (changeAttachY === 'target' || changeAttachY === 'both') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ }
+ }
+ if (changeAttachY === 'together') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ if (eAttachment.top === 'bottom') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top += height;
+ eAttachment.top = 'top';
+ } else if (eAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ if (eAttachment.top === 'top') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (eAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ }
+ if (changeAttachX === 'target' || changeAttachX === 'both') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ }
+ if (left + width > bounds[2] && tAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ }
+ }
+ if (changeAttachX === 'together') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ if (eAttachment.left === 'right') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left += width;
+ eAttachment.left = 'left';
+ } else if (eAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ } else if (left + width > bounds[2] && tAttachment.left === 'right') {
+ if (eAttachment.left === 'left') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (eAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left += width;
+ eAttachment.left = 'left';
+ }
+ }
+ }
+ if (changeAttachY === 'element' || changeAttachY === 'both') {
+ if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (changeAttachX === 'element' || changeAttachX === 'both') {
+ if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ }
+ if (typeof pin === 'string') {
+ pin = (function() {
+ var _len4, _m, _ref7, _results;
+ _ref7 = pin.split(',');
+ _results = [];
+ for (_m = 0, _len4 = _ref7.length; _m < _len4; _m++) {
+ p = _ref7[_m];
+ _results.push(p.trim());
+ }
+ return _results;
+ })();
+ } else if (pin === true) {
+ pin = ['top', 'left', 'right', 'bottom'];
+ }
+ pin || (pin = []);
+ pinned = [];
+ oob = [];
+ if (top < bounds[1]) {
+ if (__indexOf.call(pin, 'top') >= 0) {
+ top = bounds[1];
+ pinned.push('top');
+ } else {
+ oob.push('top');
+ }
+ }
+ if (top + height > bounds[3]) {
+ if (__indexOf.call(pin, 'bottom') >= 0) {
+ top = bounds[3] - height;
+ pinned.push('bottom');
+ } else {
+ oob.push('bottom');
+ }
+ }
+ if (left < bounds[0]) {
+ if (__indexOf.call(pin, 'left') >= 0) {
+ left = bounds[0];
+ pinned.push('left');
+ } else {
+ oob.push('left');
+ }
+ }
+ if (left + width > bounds[2]) {
+ if (__indexOf.call(pin, 'right') >= 0) {
+ left = bounds[2] - width;
+ pinned.push('right');
+ } else {
+ oob.push('right');
+ }
+ }
+ if (pinned.length) {
+ pinnedClass = (_ref7 = this.options.pinnedClass) != null ? _ref7 : this.getClass('pinned');
+ addClasses.push(pinnedClass);
+ for (_m = 0, _len4 = pinned.length; _m < _len4; _m++) {
+ side = pinned[_m];
+ addClasses.push("" + pinnedClass + "-" + side);
+ }
+ }
+ if (oob.length) {
+ oobClass = (_ref8 = this.options.outOfBoundsClass) != null ? _ref8 : this.getClass('out-of-bounds');
+ addClasses.push(oobClass);
+ for (_n = 0, _len5 = oob.length; _n < _len5; _n++) {
+ side = oob[_n];
+ addClasses.push("" + oobClass + "-" + side);
+ }
+ }
+ if (__indexOf.call(pinned, 'left') >= 0 || __indexOf.call(pinned, 'right') >= 0) {
+ eAttachment.left = tAttachment.left = false;
+ }
+ if (__indexOf.call(pinned, 'top') >= 0 || __indexOf.call(pinned, 'bottom') >= 0) {
+ eAttachment.top = tAttachment.top = false;
+ }
+ if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== this.attachment.top || eAttachment.left !== this.attachment.left) {
+ this.updateAttachClasses(eAttachment, tAttachment);
+ }
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+(function() {
+ var defer, getBounds, updateClasses, _ref;
+
+ _ref = Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ Tether.modules.push({
+ position: function(_arg) {
+ var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5,
+ _this = this;
+ top = _arg.top, left = _arg.left;
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ targetPos = this.getTargetBounds();
+ bottom = top + height;
+ right = left + width;
+ abutted = [];
+ if (top <= targetPos.bottom && bottom >= targetPos.top) {
+ _ref2 = ['left', 'right'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ side = _ref2[_i];
+ if ((_ref3 = targetPos[side]) === left || _ref3 === right) {
+ abutted.push(side);
+ }
+ }
+ }
+ if (left <= targetPos.right && right >= targetPos.left) {
+ _ref4 = ['top', 'bottom'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) {
+ abutted.push(side);
+ }
+ }
+ }
+ allClasses = [];
+ addClasses = [];
+ sides = ['left', 'top', 'right', 'bottom'];
+ allClasses.push(this.getClass('abutted'));
+ for (_k = 0, _len2 = sides.length; _k < _len2; _k++) {
+ side = sides[_k];
+ allClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ if (abutted.length) {
+ addClasses.push(this.getClass('abutted'));
+ }
+ for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) {
+ side = abutted[_l];
+ addClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return true;
+ }
+ });
+
+}).call(this);
+
+(function() {
+ Tether.modules.push({
+ position: function(_arg) {
+ var left, result, shift, shiftLeft, shiftTop, top, _ref;
+ top = _arg.top, left = _arg.left;
+ if (!this.options.shift) {
+ return;
+ }
+ result = function(val) {
+ if (typeof val === 'function') {
+ return val.call(this, {
+ top: top,
+ left: left
+ });
+ } else {
+ return val;
+ }
+ };
+ shift = result(this.options.shift);
+ if (typeof shift === 'string') {
+ shift = shift.split(' ');
+ shift[1] || (shift[1] = shift[0]);
+ shiftTop = shift[0], shiftLeft = shift[1];
+ shiftTop = parseFloat(shiftTop, 10);
+ shiftLeft = parseFloat(shiftLeft, 10);
+ } else {
+ _ref = [shift.top, shift.left], shiftTop = _ref[0], shiftLeft = _ref[1];
+ }
+ top += shiftTop;
+ left += shiftLeft;
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+(function() {
+ var ATTACHMENT, Evented, Shepherd, Step, Tour, addClass, createFromHTML, extend, getBounds, matchesSelector, parseShorthand, removeClass, uniqueId, _ref,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ _ref = Tether.Utils, extend = _ref.extend, removeClass = _ref.removeClass, addClass = _ref.addClass, Evented = _ref.Evented, getBounds = _ref.getBounds, uniqueId = _ref.uniqueId;
+
+ ATTACHMENT = {
+ 'top': 'top center',
+ 'left': 'middle right',
+ 'right': 'middle left',
+ 'bottom': 'bottom center'
+ };
+
+ createFromHTML = function(html) {
+ var el;
+ el = document.createElement('div');
+ el.innerHTML = html;
+ return el.children[0];
+ };
+
+ matchesSelector = function(el, sel) {
+ var matches, _ref1, _ref2, _ref3, _ref4;
+ matches = (_ref1 = (_ref2 = (_ref3 = (_ref4 = el.matches) != null ? _ref4 : el.matchesSelector) != null ? _ref3 : el.webkitMatchesSelector) != null ? _ref2 : el.mozMatchesSelector) != null ? _ref1 : el.oMatchesSelector;
+ return matches.call(el, sel);
+ };
+
+ parseShorthand = function(obj, props) {
+ var i, out, prop, vals, _i, _len;
+ if (obj == null) {
+ return obj;
+ } else if (typeof obj === 'object') {
+ return obj;
+ } else {
+ vals = obj.split(' ');
+ if (vals.length > props.length) {
+ vals[0] = vals.slice(0, +(vals.length - props.length) + 1 || 9e9).join(' ');
+ vals.splice(1, vals.length - props.length);
+ }
+ out = {};
+ for (i = _i = 0, _len = props.length; _i < _len; i = ++_i) {
+ prop = props[i];
+ out[prop] = vals[i];
+ }
+ return out;
+ }
+ };
+
+ Step = (function(_super) {
+ __extends(Step, _super);
+
+ function Step(tour, options) {
+ this.tour = tour;
+ this.destroy = __bind(this.destroy, this);
+ this.scrollTo = __bind(this.scrollTo, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.isOpen = __bind(this.isOpen, this);
+ this.hide = __bind(this.hide, this);
+ this.show = __bind(this.show, this);
+ this.setOptions(options);
+ this;
+ }
+
+ Step.prototype.setOptions = function(options) {
+ var event, handler, _base, _ref1;
+ this.options = options != null ? options : {};
+ this.destroy();
+ this.id = this.options.id || this.id || ("step-" + (uniqueId()));
+ if (this.options.when) {
+ _ref1 = this.options.when;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ this.on(event, handler, this);
+ }
+ }
+ return (_base = this.options).buttons != null ? (_base = this.options).buttons : _base.buttons = [
+ {
+ text: 'Next',
+ action: this.tour.next
+ }
+ ];
+ };
+
+ Step.prototype.getTour = function() {
+ return this.tour;
+ };
+
+ Step.prototype.bindAdvance = function() {
+ var event, handler, selector, _ref1,
+ _this = this;
+ _ref1 = parseShorthand(this.options.advanceOn, ['selector', 'event']), event = _ref1.event, selector = _ref1.selector;
+ handler = function(e) {
+ if (!_this.isOpen()) {
+ return;
+ }
+ if (selector != null) {
+ if (matchesSelector(e.target, selector)) {
+ return _this.tour.next();
+ }
+ } else {
+ if (_this.el && e.target === _this.el) {
+ return _this.tour.next();
+ }
+ }
+ };
+ document.body.addEventListener(event, handler);
+ return this.on('destroy', function() {
+ return document.body.removeEventListener(event, handler);
+ });
+ };
+
+ Step.prototype.getAttachTo = function() {
+ var opts;
+ opts = parseShorthand(this.options.attachTo, ['element', 'on']);
+ if (opts == null) {
+ opts = {};
+ }
+ if (typeof opts.element === 'string') {
+ opts.element = document.querySelector(opts.element);
+ if (opts.element == null) {
+ throw new Error("Shepherd step's attachTo was not found in the page");
+ }
+ }
+ return opts;
+ };
+
+ Step.prototype.setupTether = function() {
+ var attachment, opts, tetherOpts;
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("Using the attachment feature of Shepherd requires the Tether library");
+ }
+ opts = this.getAttachTo();
+ attachment = ATTACHMENT[opts.on || 'right'];
+ if (opts.element == null) {
+ opts.element = 'viewport';
+ attachment = 'middle center';
+ }
+ tetherOpts = {
+ classPrefix: 'shepherd',
+ element: this.el,
+ constraints: [
+ {
+ to: 'window',
+ pin: true,
+ attachment: 'together'
+ }
+ ],
+ target: opts.element,
+ offset: opts.offset || '0 0',
+ attachment: attachment
+ };
+ return this.tether = new Tether(extend(tetherOpts, this.options.tetherOptions));
+ };
+
+ Step.prototype.show = function() {
+ var _ref1,
+ _this = this;
+ if (this.el == null) {
+ this.render();
+ }
+ addClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.enable();
+ }
+ if (this.options.scrollTo) {
+ setTimeout(function() {
+ return _this.scrollTo();
+ });
+ }
+ return this.trigger('show');
+ };
+
+ Step.prototype.hide = function() {
+ var _ref1;
+ removeClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.disable();
+ }
+ return this.trigger('hide');
+ };
+
+ Step.prototype.isOpen = function() {
+ return hasClass(this.el, 'shepherd-open');
+ };
+
+ Step.prototype.cancel = function() {
+ this.hide();
+ return this.trigger('cancel');
+ };
+
+ Step.prototype.complete = function() {
+ this.hide();
+ return this.trigger('complete');
+ };
+
+ Step.prototype.scrollTo = function() {
+ var element;
+ element = this.getAttachTo().element;
+ return element != null ? element.scrollIntoView() : void 0;
+ };
+
+ Step.prototype.destroy = function() {
+ var _ref1;
+ if (this.el != null) {
+ document.body.removeChild(this.el);
+ delete this.el;
+ }
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ return this.trigger('destroy');
+ };
+
+ Step.prototype.render = function() {
+ var button, buttons, cfg, content, footer, header, paragraph, paragraphs, text, _i, _j, _len, _len1, _ref1, _ref2, _ref3;
+ if (this.el != null) {
+ this.destroy();
+ }
+ this.el = createFromHTML("");
+ content = document.createElement('div');
+ content.className = 'shepherd-content';
+ this.el.appendChild(content);
+ if (this.options.title != null) {
+ header = document.createElement('header');
+ header.innerHTML = "" + this.options.title + "
";
+ this.el.className += ' shepherd-has-title';
+ content.appendChild(header);
+ }
+ if (this.options.text != null) {
+ text = createFromHTML("");
+ paragraphs = this.options.text;
+ if (typeof paragraphs === 'string') {
+ paragraphs = [paragraphs];
+ }
+ for (_i = 0, _len = paragraphs.length; _i < _len; _i++) {
+ paragraph = paragraphs[_i];
+ text.innerHTML += "" + paragraph + "
";
+ }
+ content.appendChild(text);
+ }
+ footer = document.createElement('footer');
+ if (this.options.buttons) {
+ buttons = createFromHTML("");
+ _ref2 = this.options.buttons;
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
+ cfg = _ref2[_j];
+ button = createFromHTML("" + cfg.text + "");
+ buttons.appendChild(button);
+ this.bindButtonEvents(cfg, button.querySelector('a'));
+ }
+ footer.appendChild(buttons);
+ }
+ content.appendChild(footer);
+ document.body.appendChild(this.el);
+ this.setupTether();
+ if (this.options.advanceOn) {
+ return this.bindAdvance();
+ }
+ };
+
+ Step.prototype.bindButtonEvents = function(cfg, el) {
+ var event, handler, page, _ref1,
+ _this = this;
+ if (cfg.events == null) {
+ cfg.events = {};
+ }
+ if (cfg.action != null) {
+ cfg.events.click = cfg.action;
+ }
+ _ref1 = cfg.events;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ if (typeof handler === 'string') {
+ page = handler;
+ handler = function() {
+ return _this.tour.show(page);
+ };
+ }
+ el.addEventListener(event, handler);
+ }
+ return this.on('destroy', function() {
+ var _ref2, _results;
+ _ref2 = cfg.events;
+ _results = [];
+ for (event in _ref2) {
+ handler = _ref2[event];
+ _results.push(el.removeEventListener(event, handler));
+ }
+ return _results;
+ });
+ };
+
+ return Step;
+
+ })(Evented);
+
+ Tour = (function(_super) {
+ __extends(Tour, _super);
+
+ function Tour(options) {
+ var event, _i, _len, _ref1, _ref2,
+ _this = this;
+ this.options = options != null ? options : {};
+ this.hide = __bind(this.hide, this);
+ this.cancel = __bind(this.cancel, this);
+ this.back = __bind(this.back, this);
+ this.next = __bind(this.next, this);
+ this.steps = (_ref1 = this.options.steps) != null ? _ref1 : [];
+ _ref2 = ['complete', 'cancel', 'hide', 'start', 'show'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ event = _ref2[_i];
+ this.on(event, function(opts) {
+ if (opts == null) {
+ opts = {};
+ }
+ opts.tour = _this;
+ return Shepherd.trigger(event, opts);
+ });
+ }
+ this;
+ }
+
+ Tour.prototype.addStep = function(name, step) {
+ var _ref1;
+ if (step == null) {
+ step = name;
+ }
+ if (!(step instanceof Step)) {
+ if ((_ref1 = typeof name) === 'string' || _ref1 === 'number') {
+ step.id = name.toString();
+ }
+ step = extend({}, this.options.defaults, step);
+ step = new Step(this, step);
+ } else {
+ step.tour = this;
+ }
+ this.steps.push(step);
+ return step;
+ };
+
+ Tour.prototype.getById = function(id) {
+ var step, _i, _len, _ref1;
+ _ref1 = this.steps;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ step = _ref1[_i];
+ if (step.id === id) {
+ return step;
+ }
+ }
+ };
+
+ Tour.prototype.getCurrentStep = function() {
+ return this.currentStep;
+ };
+
+ Tour.prototype.next = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ if (index === this.steps.length - 1) {
+ this.hide(index);
+ this.trigger('complete');
+ return this.done();
+ } else {
+ return this.show(index + 1);
+ }
+ };
+
+ Tour.prototype.back = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ return this.show(index - 1);
+ };
+
+ Tour.prototype.cancel = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.cancel();
+ }
+ this.trigger('cancel');
+ return this.done();
+ };
+
+ Tour.prototype.hide = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('hide');
+ return this.done();
+ };
+
+ Tour.prototype.done = function() {
+ return Shepherd.activeTour = null;
+ };
+
+ Tour.prototype.show = function(key) {
+ var next;
+ if (key == null) {
+ key = 0;
+ }
+ if (this.currentStep) {
+ this.currentStep.hide();
+ }
+ Shepherd.activeTour = this;
+ if (typeof key === 'string') {
+ next = this.getById(key);
+ } else {
+ next = this.steps[key];
+ }
+ if (next) {
+ this.trigger('show', {
+ step: next,
+ previous: this.currentStep
+ });
+ this.currentStep = next;
+ return next.show();
+ }
+ };
+
+ Tour.prototype.start = function() {
+ this.trigger('start');
+ this.currentStep = null;
+ return this.next();
+ };
+
+ return Tour;
+
+ })(Evented);
+
+ Shepherd = new Evented;
+
+ extend(Shepherd, {
+ Tour: Tour,
+ Step: Step
+ });
+
+ window.Shepherd = Shepherd;
+
+}).call(this);
diff --git a/ajax/libs/shepherd/0.4.0/shepherd.min.js b/ajax/libs/shepherd/0.4.0/shepherd.min.js
new file mode 100644
index 000000000..6fecbcfbc
--- /dev/null
+++ b/ajax/libs/shepherd/0.4.0/shepherd.min.js
@@ -0,0 +1,2 @@
+/*! shepherd 0.4.0 */
+(function(){var t,e,n,o,i,s,r,h,l,a,p,u,f,c,d,g,m={}.hasOwnProperty,v=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},b=[].slice;null==window.Tether&&(window.Tether={}),a=function(t){var e,n,o,i,s;if(n=getComputedStyle(t).position,"fixed"===n)return t;for(o=void 0,e=t;e=e.parentNode;){try{i=getComputedStyle(e)}catch(r){}if(null==i)return e;if(/(auto|scroll)/.test(i.overflow+i["overflow-y"]+i["overflow-x"])&&("absolute"!==n||"relative"===(s=i.position)||"absolute"===s||"fixed"===s))return e}return document.body},c=function(){var t;return t=0,function(){return t++}}(),g={},l=function(t){var e,o,s,r,h;if(s=t._tetherZeroElement,null==s&&(s=t.createElement("div"),s.setAttribute("data-tether-id",c()),i(s.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(s),t._tetherZeroElement=s),e=s.getAttribute("data-tether-id"),null==g[e]){g[e]={},h=s.getBoundingClientRect();for(o in h)r=h[o],g[e][o]=r;n(function(){return g[e]=void 0})}return g[e]},u=null,r=function(t){var e,n,o,i,s,r,h;t===document?(n=document,t=document.documentElement):n=t.ownerDocument,o=n.documentElement,e={},h=t.getBoundingClientRect();for(i in h)r=h[i],e[i]=r;return s=l(n),e.top-=s.top,e.left-=s.left,e.top=e.top-o.clientTop,e.left=e.left-o.clientLeft,e.right=n.body.clientWidth-e.width-e.left,e.bottom=n.body.clientHeight-e.height-e.top,e},h=function(t){return t.offsetParent||document.documentElement},i=function(t){var e,n,o,i,s,r,h;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),h=e.slice(1),s=0,r=h.length;r>s;s++)if(o=h[s])for(n in o)m.call(o,n)&&(i=o[n],t[n]=i);return t},f=function(t,e){var n,o,i,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],o=0,i=s.length;i>o;o++)n=s[o],r.push(t.classList.remove(n));return r}return t.className=t.className.replace(new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi")," ")},e=function(t,e){var n,o,i,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],o=0,i=s.length;i>o;o++)n=s[o],r.push(t.classList.add(n));return r}return f(t,e),t.className+=" "+e},p=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},d=function(t,n,o){var i,s,r,h,l,a;for(s=0,h=o.length;h>s;s++)i=o[s],v.call(n,i)<0&&p(t,i)&&f(t,i);for(a=[],r=0,l=n.length;l>r;r++)i=n[r],a.push(p(t,i)?void 0:e(t,i));return a},o=[],n=function(t){return o.push(t)},s=function(){var t,e;for(e=[];t=o.pop();)e.push(t());return e},t=function(){function t(){}return t.prototype.on=function(t,e,n,o){var i;return null==o&&(o=!1),null==this.bindings&&(this.bindings={}),null==(i=this.bindings)[t]&&(i[t]=[]),this.bindings[t].push({handler:e,ctx:n,once:o})},t.prototype.once=function(t,e,n){return this.on(t,e,n,!0)},t.prototype.off=function(t,e){var n,o,i;if(null!=(null!=(o=this.bindings)?o[t]:void 0)){if(null==e)return delete this.bindings[t];for(n=0,i=[];n=e&&e>=t-n},T=function(){var t,e,n,o,i;for(t=document.createElement("div"),i=["transform","webkitTransform","OTransform","MozTransform","msTransform"],n=0,o=i.length;o>n;n++)if(e=i[n],void 0!==t.style[e])return e}(),C=[],y=function(){var t,e,n;for(e=0,n=C.length;n>e;e++)t=C[e],t.position(!1);return a()},g=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance?"function"==typeof performance.now?performance.now():void 0:void 0)?t:+new Date},function(){var t,e,n,o,i,s,r,h,l;for(e=null,n=null,o=null,i=function(){if(null!=n&&n>16)return n=Math.min(n-16,250),void(o=setTimeout(i,250));if(!(null!=e&&g()-e<10))return null!=o&&(clearTimeout(o),o=null),e=g(),y(),n=g()-e},h=["resize","scroll"],l=[],s=0,r=h.length;r>s;s++)t=h[s],l.push(window.addEventListener(t,i));return l}(),t={center:"center",left:"right",right:"left"},e={middle:"middle",top:"bottom",bottom:"top"},n={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},r=function(n,o){var i,s;return i=n.left,s=n.top,"auto"===i&&(i=t[o.left]),"auto"===s&&(s=e[o.top]),{left:i,top:s}},s=function(t){var e,o;return{left:null!=(e=n[t.left])?e:t.left,top:null!=(o=n[t.top])?o:t.top}},i=function(){var t,e,n,o,i,s,r;for(e=1<=arguments.length?A.call(arguments,0):[],n={top:0,left:0},i=0,s=e.length;s>i;i++)r=e[i],o=r.top,t=r.left,"string"==typeof o&&(o=parseFloat(o,10)),"string"==typeof t&&(t=parseFloat(t,10)),n.top+=o,n.left+=t;return n},m=function(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t},v=b=function(t){var e,n,o;return o=t.split(" "),n=o[0],e=o[1],{top:n,left:e}},S=function(){function t(t){this.position=M(this.position,this);var e,n,o,i,s;for(C.push(this),this.history=[],this.setOptions(t,!1),i=Tether.modules,n=0,o=i.length;o>n;n++)e=i[n],null!=(s=e.initialize)&&s.call(this);this.position()}return t.modules=[],t.prototype.getClass=function(t){var e,n;return(null!=(e=this.options.classes)?e[t]:void 0)?this.options.classes[t]:(null!=(n=this.options.classes)?n[t]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+t:t:""},t.prototype.setOptions=function(t,e){var n,i,s,r,h,a;for(this.options=t,null==e&&(e=!0),n={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=l(n,this.options),h=this.options,this.element=h.element,this.target=h.target,this.targetModifier=h.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),a=["element","target"],s=0,r=a.length;r>s;s++){if(i=a[s],null==this[i])throw new Error("Tether Error: Both element and target must be defined");null!=this[i].jquery?this[i]=this[i][0]:"string"==typeof this[i]&&(this[i]=document.querySelector(this[i]))}if(o(this.element,this.getClass("element")),o(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=v(this.options.targetAttachment),this.attachment=v(this.options.attachment),this.offset=b(this.options.offset),this.targetOffset=b(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent="scroll-handle"===this.targetModifier?this.target:c(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,n,o,i,s,r,h,l;if(null==this.targetModifier)return p(this.target);switch(this.targetModifier){case"visible":return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:(t=p(this.target),i={height:t.height,width:t.width,top:t.top,left:t.left},i.height=Math.min(i.height,t.height-(pageYOffset-t.top)),i.height=Math.min(i.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),i.height=Math.min(innerHeight,i.height),i.height-=2,i.width=Math.min(i.width,t.width-(pageXOffset-t.left)),i.width=Math.min(i.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),i.width=Math.min(innerWidth,i.width),i.width-=2,i.topl.clientWidth||"scroll"===[h.overflow,h.overflowX]||this.target!==document.body,s=0,n&&(s=15),o=t.height-parseFloat(h.borderTopWidth)-parseFloat(h.borderBottomWidth)-s,i={width:15,height:.975*o*(o/l.scrollHeight),left:t.left+t.width-parseFloat(h.borderLeftWidth)-15},e=0,408>o&&this.target===document.body&&(e=-11e-5*Math.pow(o,2)-.00727*o+22.58),this.target!==document.body&&(i.height=Math.max(i.height,24)),r=l.scrollTop/(l.scrollHeight-o),i.top=r*(o-i.height-e)+t.top+parseFloat(h.borderTopWidth),this.target===document.body&&(i.height=Math.max(i.height,24)),i}},t.prototype.clearCache=function(){return this._cache={}},t.prototype.cache=function(t,e){return null==this._cache&&(this._cache={}),null==this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},t.prototype.enable=function(t){return null==t&&(t=!0),o(this.target,this.getClass("enabled")),o(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t?this.position():void 0},t.prototype.disable=function(){return w(this.target,this.getClass("enabled")),w(this.element,this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},t.prototype.destroy=function(){var t,e,n,o,i;for(this.disable(),i=[],t=n=0,o=C.length;o>n;t=++n){if(e=C[t],e===this){C.splice(t,1);break}i.push(void 0)}return i},t.prototype.updateAttachClasses=function(t,e){var n,o,i,s,r,l,a,p,u,f=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),s=["left","top","bottom","right","middle","center"],(null!=(u=this._addAttachClasses)?u.length:void 0)&&this._addAttachClasses.splice(0,this._addAttachClasses.length),n=null!=this._addAttachClasses?this._addAttachClasses:this._addAttachClasses=[],t.top&&n.push(""+this.getClass("element-attached")+"-"+t.top),t.left&&n.push(""+this.getClass("element-attached")+"-"+t.left),e.top&&n.push(""+this.getClass("target-attached")+"-"+e.top),e.left&&n.push(""+this.getClass("target-attached")+"-"+e.left),o=[],r=0,a=s.length;a>r;r++)i=s[r],o.push(""+this.getClass("element-attached")+"-"+i);for(l=0,p=s.length;p>l;l++)i=s[l],o.push(""+this.getClass("target-attached")+"-"+i);return h(function(){return null!=f._addAttachClasses?(O(f.element,f._addAttachClasses,o),O(f.target,f._addAttachClasses,o),f._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,n,o,h,l,f,c,d,g,v,b,y,w,C,T,O,x,S,E,A,M,_,B,P,L,z,F,W,H,Y,N,X,k=this;if(null==t&&(t=!0),this.enabled){for(this.clearCache(),E=r(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,E),e=this.cache("element-bounds",function(){return p(k.element)}),P=e.width,o=e.height,0===P&&0===o&&null!=this.lastSize?(H=this.lastSize,P=H.width,o=H.height):this.lastSize={width:P,height:o},_=M=this.cache("target-bounds",function(){return k.getTargetBounds()}),g=m(s(this.attachment),{width:P,height:o}),A=m(s(E),_),l=m(this.offset,{width:P,height:o}),f=m(this.targetOffset,_),g=i(g,l),A=i(A,f),h=M.left+A.left-g.left,B=M.top+A.top-g.top,Y=Tether.modules,L=0,F=Y.length;F>L;L++)if(c=Y[L],T=c.position.call(this,{left:h,top:B,targetAttachment:E,targetPos:M,elementPos:e,offset:g,targetOffset:A,manualOffset:l,manualTargetOffset:f}),null!=T&&"object"==typeof T){if(T===!1)return!1;B=T.top,h=T.left}if(d={page:{top:B,bottom:document.body.scrollHeight-B-o,left:h,right:document.body.scrollWidth-h-P},viewport:{top:B-pageYOffset,bottom:pageYOffset-B-o+innerHeight,left:h-pageXOffset,right:pageXOffset-h-P+innerWidth}},(null!=(N=this.options.optimizations)?N.moveElement:void 0)!==!1&&null==this.targetModifier){for(b=this.cache("target-offsetparent",function(){return u(k.target)}),C=this.cache("target-offsetparent-bounds",function(){return p(b)}),w=getComputedStyle(b),n=getComputedStyle(this.element),y=C,v={},X=["top","left","bottom","right"],z=0,W=X.length;W>z;z++)S=X[z],v[S]=parseFloat(w["border-"+S+"-width"]);C.right=document.body.scrollWidth-C.left-y.width+v.right,C.bottom=document.body.scrollHeight-C.top-y.height+v.bottom,d.page.top>=C.top+v.top&&d.page.bottom>=C.bottom&&d.page.left>=C.left+v.left&&d.page.right>=C.right&&(x=b.scrollTop,O=b.scrollLeft,d.offset={top:d.page.top-C.top+x-v.top,left:d.page.left-C.left+O-v.left})}return this.move(d),this.history.unshift(d),this.history.length>3&&this.history.pop(),t&&a(),!0}},t.prototype.move=function(t){var e,n,o,i,s,r,a,p,f,c,d,g,m,v,b,y,w,C=this;if(null!=this.element.parentNode){p={};for(c in t){p[c]={};for(i in t[c]){for(o=!1,y=this.history,v=0,b=y.length;b>v;v++)if(a=y[v],!x(null!=(w=a[c])?w[i]:void 0,t[c][i])){o=!0;break}o||(p[c][i]=!0)}}e={top:"",left:"",right:"",bottom:""},f=function(t,n){var o,i,s;return(null!=(s=C.options.optimizations)?s.gpu:void 0)===!1?(t.top?e.top=""+n.top+"px":e.bottom=""+n.bottom+"px",t.left?e.left=""+n.left+"px":e.right=""+n.right+"px"):(t.top?(e.top=0,i=n.top):(e.bottom=0,i=-n.bottom),t.left?(e.left=0,o=n.left):(e.right=0,o=-n.right),e[T]="translateX("+Math.round(o)+"px) translateY("+Math.round(i)+"px)","msTransform"!==T?e[T]+=" translateZ(0)":void 0)},s=!1,(p.page.top||p.page.bottom)&&(p.page.left||p.page.right)?(e.position="absolute",f(p.page,t.page)):(p.viewport.top||p.viewport.bottom)&&(p.viewport.left||p.viewport.right)?(e.position="fixed",f(p.viewport,t.viewport)):null!=p.offset&&p.offset.top&&p.offset.left?(e.position="absolute",r=this.cache("target-offsetparent",function(){return u(C.target)}),u(this.element)!==r&&h(function(){return C.element.parentNode.removeChild(C.element),r.appendChild(C.element)}),f(p.offset,t.offset),s=!0):(e.position="absolute",f({top:!0,left:!0},t.page)),s||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),m={},g=!1;for(i in e)d=e[i],n=this.element.style[i],""===n||""===d||"top"!==i&&"left"!==i&&"bottom"!==i&&"right"!==i||(n=parseFloat(n),d=parseFloat(d)),n!==d&&(g=!0,m[i]=e[i]);return g?h(function(){return l(C.element.style,m)}):void 0}},t}(),Tether.position=y,window.Tether=l(S,Tether)}.call(this),function(){var t,e,n,o,i,s,r,h,l,a,p=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};a=Tether.Utils,r=a.getOuterSize,s=a.getBounds,h=a.getSize,o=a.extend,l=a.updateClasses,n=a.defer,e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},t=["left","top","right","bottom"],i=function(e,n){var o,i,r,h,l,a,p;if("scrollParent"===n?n=e.scrollParent:"window"===n&&(n=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),n===document&&(n=n.documentElement),null!=n.nodeType)for(i=h=s(n),l=getComputedStyle(n),n=[i.left,i.top,h.width+i.left,h.height+i.top],o=a=0,p=t.length;p>a;o=++a)r=t[o],"top"===r||"left"===r?n[o]+=parseFloat(l["border-"+r+"-width"]):n[o]-=parseFloat(l["border-"+r+"-width"]);return n},Tether.modules.push({position:function(e){var r,h,a,u,f,c,d,g,m,v,b,y,w,C,T,O,x,S,E,A,M,_,B,P,L,z,F,W,H,Y,N,X,k,j,q,U,I,R,D,Z,$,V,G,J,K,Q,te,ee=this;if(z=e.top,b=e.left,M=e.targetAttachment,!this.options.constraints)return!0;for(S=function(e){var n,o,i,s;for(ee.removeClass(e),s=[],o=0,i=t.length;i>o;o++)n=t[o],s.push(ee.removeClass(""+e+"-"+n));return s},Z=this.cache("element-bounds",function(){return s(ee.element)}),v=Z.height,F=Z.width,0===F&&0===v&&null!=this.lastSize&&($=this.lastSize,F=$.width,v=$.height),B=this.cache("target-bounds",function(){return ee.getTargetBounds()}),_=B.height,P=B.width,A={},m={},h=[this.getClass("pinned"),this.getClass("out-of-bounds")],V=this.options.constraints,W=0,X=V.length;X>W;W++)g=V[W],g.outOfBoundsClass&&h.push(g.outOfBoundsClass),g.pinnedClass&&h.push(g.pinnedClass);for(H=0,k=h.length;k>H;H++)for(d=h[H],G=["left","top","right","bottom"],Y=0,j=G.length;j>Y;Y++)E=G[Y],h.push(""+d+"-"+E);for(r=[],A=o({},M),m=o({},this.attachment),J=this.options.constraints,N=0,q=J.length;q>N;N++){if(g=J[N],L=g.to,a=g.attachment,T=g.pin,null==a&&(a=""),p.call(a," ")>=0?(K=a.split(" "),c=K[0],f=K[1]):f=c=a,u=i(this,L),("target"===c||"both"===c)&&(zu[3]&&"bottom"===A.top&&(z-=_,A.top="top")),"together"===c&&(zu[3]&&"bottom"===A.top&&("top"===m.top?(z-=_,A.top="top",z-=v,m.top="bottom"):"bottom"===m.top&&(z-=_,A.top="top",z+=v,m.top="top"))),("target"===f||"both"===f)&&(bu[2]&&"right"===A.left&&(b-=P,A.left="left")),"together"===f&&(bu[2]&&"right"===A.left&&("left"===m.left?(b-=P,A.left="left",b-=F,m.left="right"):"right"===m.left&&(b-=P,A.left="left",b+=F,m.left="left"))),("element"===c||"both"===c)&&(zu[3]&&"top"===m.top&&(z-=v,m.top="bottom")),("element"===f||"both"===f)&&(bu[2]&&"left"===m.left&&(b-=F,m.left="right")),"string"==typeof T?T=function(){var t,e,n,o;for(n=T.split(","),o=[],e=0,t=n.length;t>e;e++)C=n[e],o.push(C.trim());return o}():T===!0&&(T=["top","left","right","bottom"]),T||(T=[]),O=[],y=[],z=0?(z=u[1],O.push("top")):y.push("top")),z+v>u[3]&&(p.call(T,"bottom")>=0?(z=u[3]-v,O.push("bottom")):y.push("bottom")),b=0?(b=u[0],O.push("left")):y.push("left")),b+F>u[2]&&(p.call(T,"right")>=0?(b=u[2]-F,O.push("right")):y.push("right")),O.length)for(x=null!=(Q=this.options.pinnedClass)?Q:this.getClass("pinned"),r.push(x),R=0,U=O.length;U>R;R++)E=O[R],r.push(""+x+"-"+E);if(y.length)for(w=null!=(te=this.options.outOfBoundsClass)?te:this.getClass("out-of-bounds"),r.push(w),D=0,I=y.length;I>D;D++)E=y[D],r.push(""+w+"-"+E);(p.call(O,"left")>=0||p.call(O,"right")>=0)&&(m.left=A.left=!1),(p.call(O,"top")>=0||p.call(O,"bottom")>=0)&&(m.top=A.top=!1),(A.top!==M.top||A.left!==M.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,A)}return n(function(){return l(ee.target,r,h),l(ee.element,r,h)}),{top:z,left:b}}})}.call(this),function(){var t,e,n,o;o=Tether.Utils,e=o.getBounds,n=o.updateClasses,t=o.defer,Tether.modules.push({position:function(o){var i,s,r,h,l,a,p,u,f,c,d,g,m,v,b,y,w,C,T,O,x,S,E,A,M,_=this;if(d=o.top,a=o.left,x=this.cache("element-bounds",function(){return e(_.element)}),l=x.height,g=x.width,c=this.getTargetBounds(),h=d+l,p=a+g,i=[],d<=c.bottom&&h>=c.top)for(S=["left","right"],m=0,w=S.length;w>m;m++)u=S[m],((E=c[u])===a||E===p)&&i.push(u);if(a<=c.right&&p>=c.left)for(A=["top","bottom"],v=0,C=A.length;C>v;v++)u=A[v],((M=c[u])===d||M===h)&&i.push(u);for(r=[],s=[],f=["left","top","right","bottom"],r.push(this.getClass("abutted")),b=0,T=f.length;T>b;b++)u=f[b],r.push(""+this.getClass("abutted")+"-"+u);for(i.length&&s.push(this.getClass("abutted")),y=0,O=i.length;O>y;y++)u=i[y],s.push(""+this.getClass("abutted")+"-"+u);return t(function(){return n(_.target,s,r),n(_.element,s,r)}),!0}})}.call(this),function(){Tether.modules.push({position:function(t){var e,n,o,i,s,r,h;return r=t.top,e=t.left,this.options.shift?(n=function(t){return"function"==typeof t?t.call(this,{top:r,left:e}):t},o=n(this.options.shift),"string"==typeof o?(o=o.split(" "),o[1]||(o[1]=o[0]),s=o[0],i=o[1],s=parseFloat(s,10),i=parseFloat(i,10)):(h=[o.top,o.left],s=h[0],i=h[1]),r+=s,e+=i,{top:r,left:e}):void 0}})}.call(this),function(){var t,e,n,o,i,s,r,h,l,a,p,u,f,c,d=function(t,e){return function(){return t.apply(e,arguments)}},g={}.hasOwnProperty,m=function(t,e){function n(){this.constructor=t}for(var o in e)g.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};c=Tether.Utils,h=c.extend,u=c.removeClass,s=c.addClass,e=c.Evented,l=c.getBounds,f=c.uniqueId,t={top:"top center",left:"middle right",right:"middle left",bottom:"bottom center"},r=function(t){var e;return e=document.createElement("div"),e.innerHTML=t,e.children[0]},a=function(t,e){var n,o,i,s,r;return n=null!=(o=null!=(i=null!=(s=null!=(r=t.matches)?r:t.matchesSelector)?s:t.webkitMatchesSelector)?i:t.mozMatchesSelector)?o:t.oMatchesSelector,n.call(t,e)},p=function(t,e){var n,o,i,s,r,h;if(null==t)return t;if("object"==typeof t)return t;for(s=t.split(" "),s.length>e.length&&(s[0]=s.slice(0,+(s.length-e.length)+1||9e9).join(" "),s.splice(1,s.length-e.length)),o={},n=r=0,h=e.length;h>r;n=++r)i=e[n],o[i]=s[n];return o},o=function(e){function n(t,e){this.tour=t,this.destroy=d(this.destroy,this),this.scrollTo=d(this.scrollTo,this),this.complete=d(this.complete,this),this.cancel=d(this.cancel,this),this.isOpen=d(this.isOpen,this),this.hide=d(this.hide,this),this.show=d(this.show,this),this.setOptions(e)}return m(n,e),n.prototype.setOptions=function(t){var e,n,o,i;if(this.options=null!=t?t:{},this.destroy(),this.id=this.options.id||this.id||"step-"+f(),this.options.when){i=this.options.when;for(e in i)n=i[e],this.on(e,n,this)}return null!=(o=this.options).buttons?(o=this.options).buttons:o.buttons=[{text:"Next",action:this.tour.next}]},n.prototype.getTour=function(){return this.tour},n.prototype.bindAdvance=function(){var t,e,n,o,i=this;return o=p(this.options.advanceOn,["selector","event"]),t=o.event,n=o.selector,e=function(t){if(i.isOpen())if(null!=n){if(a(t.target,n))return i.tour.next()}else if(i.el&&t.target===i.el)return i.tour.next()},document.body.addEventListener(t,e),this.on("destroy",function(){return document.body.removeEventListener(t,e)})},n.prototype.getAttachTo=function(){var t;if(t=p(this.options.attachTo,["element","on"]),null==t&&(t={}),"string"==typeof t.element&&(t.element=document.querySelector(t.element),null==t.element))throw new Error("Shepherd step's attachTo was not found in the page");return t},n.prototype.setupTether=function(){var e,n,o;if("undefined"==typeof Tether||null===Tether)throw new Error("Using the attachment feature of Shepherd requires the Tether library");return n=this.getAttachTo(),e=t[n.on||"right"],null==n.element&&(n.element="viewport",e="middle center"),o={classPrefix:"shepherd",element:this.el,constraints:[{to:"window",pin:!0,attachment:"together"}],target:n.element,offset:n.offset||"0 0",attachment:e},this.tether=new Tether(h(o,this.options.tetherOptions))},n.prototype.show=function(){var t,e=this;return null==this.el&&this.render(),s(this.el,"shepherd-open"),null!=(t=this.tether)&&t.enable(),this.options.scrollTo&&setTimeout(function(){return e.scrollTo()}),this.trigger("show")},n.prototype.hide=function(){var t;return u(this.el,"shepherd-open"),null!=(t=this.tether)&&t.disable(),this.trigger("hide")},n.prototype.isOpen=function(){return hasClass(this.el,"shepherd-open")},n.prototype.cancel=function(){return this.hide(),this.trigger("cancel")},n.prototype.complete=function(){return this.hide(),this.trigger("complete")},n.prototype.scrollTo=function(){var t;return t=this.getAttachTo().element,null!=t?t.scrollIntoView():void 0},n.prototype.destroy=function(){var t;return null!=this.el&&(document.body.removeChild(this.el),delete this.el),null!=(t=this.tether)&&t.destroy(),this.trigger("destroy")},n.prototype.render=function(){var t,e,n,o,i,s,h,l,a,p,u,f,c,d,g,m;if(null!=this.el&&this.destroy(),this.el=r(""),o=document.createElement("div"),o.className="shepherd-content",this.el.appendChild(o),null!=this.options.title&&(s=document.createElement("header"),s.innerHTML=""+this.options.title+"
",this.el.className+=" shepherd-has-title",o.appendChild(s)),null!=this.options.text){for(a=r(""),l=this.options.text,"string"==typeof l&&(l=[l]),p=0,f=l.length;f>p;p++)h=l[p],a.innerHTML+=""+h+"
";o.appendChild(a)}if(i=document.createElement("footer"),this.options.buttons){for(e=r(""),g=this.options.buttons,u=0,c=g.length;c>u;u++)n=g[u],t=r(""+n.text+""),e.appendChild(t),this.bindButtonEvents(n,t.querySelector("a"));i.appendChild(e)}return o.appendChild(i),document.body.appendChild(this.el),this.setupTether(),this.options.advanceOn?this.bindAdvance():void 0},n.prototype.bindButtonEvents=function(t,e){var n,o,i,s,r=this;null==t.events&&(t.events={}),null!=t.action&&(t.events.click=t.action),s=t.events;for(n in s)o=s[n],"string"==typeof o&&(i=o,o=function(){return r.tour.show(i)}),e.addEventListener(n,o);return this.on("destroy",function(){var i,s;i=t.events,s=[];for(n in i)o=i[n],s.push(e.removeEventListener(n,o));return s})},n}(e),i=function(t){function e(t){var e,o,i,s,r,h=this;for(this.options=null!=t?t:{},this.hide=d(this.hide,this),this.cancel=d(this.cancel,this),this.back=d(this.back,this),this.next=d(this.next,this),this.steps=null!=(s=this.options.steps)?s:[],r=["complete","cancel","hide","start","show"],o=0,i=r.length;i>o;o++)e=r[o],this.on(e,function(t){return null==t&&(t={}),t.tour=h,n.trigger(e,t)})}return m(e,t),e.prototype.addStep=function(t,e){var n;return null==e&&(e=t),e instanceof o?e.tour=this:(("string"==(n=typeof t)||"number"===n)&&(e.id=t.toString()),e=h({},this.options.defaults,e),e=new o(this,e)),this.steps.push(e),e},e.prototype.getById=function(t){var e,n,o,i;for(i=this.steps,n=0,o=i.length;o>n;n++)if(e=i[n],e.id===t)return e},e.prototype.getCurrentStep=function(){return this.currentStep},e.prototype.next=function(){var t;return t=this.steps.indexOf(this.currentStep),t===this.steps.length-1?(this.hide(t),this.trigger("complete"),this.done()):this.show(t+1)},e.prototype.back=function(){var t;return t=this.steps.indexOf(this.currentStep),this.show(t-1)},e.prototype.cancel=function(){var t;return null!=(t=this.currentStep)&&t.cancel(),this.trigger("cancel"),this.done()},e.prototype.hide=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("hide"),this.done()},e.prototype.done=function(){return n.activeTour=null},e.prototype.show=function(t){var e;return null==t&&(t=0),this.currentStep&&this.currentStep.hide(),n.activeTour=this,e="string"==typeof t?this.getById(t):this.steps[t],e?(this.trigger("show",{step:e,previous:this.currentStep}),this.currentStep=e,e.show()):void 0},e.prototype.start=function(){return this.trigger("start"),this.currentStep=null,this.next()},e}(e),n=new e,h(n,{Tour:i,Step:o}),window.Shepherd=n}.call(this);
\ No newline at end of file
diff --git a/ajax/libs/shepherd/0.4.1/shepherd.js b/ajax/libs/shepherd/0.4.1/shepherd.js
new file mode 100644
index 000000000..f25ab77a0
--- /dev/null
+++ b/ajax/libs/shepherd/0.4.1/shepherd.js
@@ -0,0 +1,1794 @@
+/*! shepherd 0.2.1 */
+/*! tether 0.4.8 */
+(function() {
+ var Evented, addClass, defer, deferred, extend, flush, getBounds, getOffsetParent, getOrigin, getScrollParent, hasClass, node, removeClass, uniqueId, updateClasses, zeroPosCache,
+ __hasProp = {}.hasOwnProperty,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
+ __slice = [].slice;
+
+ if (window.Tether == null) {
+ window.Tether = {};
+ }
+
+ getScrollParent = function(el) {
+ var parent, position, scrollParent, style, _ref;
+ position = getComputedStyle(el).position;
+ if (position === 'fixed') {
+ return el;
+ }
+ scrollParent = void 0;
+ parent = el;
+ while (parent = parent.parentNode) {
+ try {
+ style = getComputedStyle(parent);
+ } catch (_error) {}
+ if (style == null) {
+ return parent;
+ }
+ if (/(auto|scroll)/.test(style['overflow'] + style['overflow-y'] + style['overflow-x'])) {
+ if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) {
+ return parent;
+ }
+ }
+ }
+ return document.body;
+ };
+
+ uniqueId = (function() {
+ var id;
+ id = 0;
+ return function() {
+ return id++;
+ };
+ })();
+
+ zeroPosCache = {};
+
+ getOrigin = function(doc) {
+ var id, k, node, v, _ref;
+ node = doc._tetherZeroElement;
+ if (node == null) {
+ node = doc.createElement('div');
+ node.setAttribute('data-tether-id', uniqueId());
+ extend(node.style, {
+ top: 0,
+ left: 0,
+ position: 'absolute'
+ });
+ doc.body.appendChild(node);
+ doc._tetherZeroElement = node;
+ }
+ id = node.getAttribute('data-tether-id');
+ if (zeroPosCache[id] == null) {
+ zeroPosCache[id] = {};
+ _ref = node.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ zeroPosCache[id][k] = v;
+ }
+ defer(function() {
+ return zeroPosCache[id] = void 0;
+ });
+ }
+ return zeroPosCache[id];
+ };
+
+ node = null;
+
+ getBounds = function(el) {
+ var box, doc, docEl, k, origin, v, _ref;
+ if (el === document) {
+ doc = document;
+ el = document.documentElement;
+ } else {
+ doc = el.ownerDocument;
+ }
+ docEl = doc.documentElement;
+ box = {};
+ _ref = el.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ box[k] = v;
+ }
+ origin = getOrigin(doc);
+ box.top -= origin.top;
+ box.left -= origin.left;
+ box.top = box.top - docEl.clientTop;
+ box.left = box.left - docEl.clientLeft;
+ box.right = doc.body.clientWidth - box.width - box.left;
+ box.bottom = doc.body.clientHeight - box.height - box.top;
+ return box;
+ };
+
+ getOffsetParent = function(el) {
+ return el.offsetParent || document.documentElement;
+ };
+
+ extend = function(out) {
+ var args, key, obj, val, _i, _len, _ref;
+ if (out == null) {
+ out = {};
+ }
+ args = [];
+ Array.prototype.push.apply(args, arguments);
+ _ref = args.slice(1);
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ obj = _ref[_i];
+ if (obj) {
+ for (key in obj) {
+ if (!__hasProp.call(obj, key)) continue;
+ val = obj[key];
+ out[key] = val;
+ }
+ }
+ }
+ return out;
+ };
+
+ removeClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ _results.push(el.classList.remove(cls));
+ }
+ return _results;
+ } else {
+ return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' ');
+ }
+ };
+
+ addClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ _results.push(el.classList.add(cls));
+ }
+ return _results;
+ } else {
+ removeClass(el, name);
+ return el.className += " " + name;
+ }
+ };
+
+ hasClass = function(el, name) {
+ if (el.classList != null) {
+ return el.classList.contains(name);
+ } else {
+ return new RegExp("(^| )" + name + "( |$)", 'gi').test(el.className);
+ }
+ };
+
+ updateClasses = function(el, add, all) {
+ var cls, _i, _j, _len, _len1, _results;
+ for (_i = 0, _len = all.length; _i < _len; _i++) {
+ cls = all[_i];
+ if (__indexOf.call(add, cls) < 0) {
+ if (hasClass(el, cls)) {
+ removeClass(el, cls);
+ }
+ }
+ }
+ _results = [];
+ for (_j = 0, _len1 = add.length; _j < _len1; _j++) {
+ cls = add[_j];
+ if (!hasClass(el, cls)) {
+ _results.push(addClass(el, cls));
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ deferred = [];
+
+ defer = function(fn) {
+ return deferred.push(fn);
+ };
+
+ flush = function() {
+ var fn, _results;
+ _results = [];
+ while (fn = deferred.pop()) {
+ _results.push(fn());
+ }
+ return _results;
+ };
+
+ Evented = (function() {
+ function Evented() {}
+
+ Evented.prototype.on = function(event, handler, ctx, once) {
+ var _base;
+ if (once == null) {
+ once = false;
+ }
+ if (this.bindings == null) {
+ this.bindings = {};
+ }
+ if ((_base = this.bindings)[event] == null) {
+ _base[event] = [];
+ }
+ return this.bindings[event].push({
+ handler: handler,
+ ctx: ctx,
+ once: once
+ });
+ };
+
+ Evented.prototype.once = function(event, handler, ctx) {
+ return this.on(event, handler, ctx, true);
+ };
+
+ Evented.prototype.off = function(event, handler) {
+ var i, _ref, _results;
+ if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
+ return;
+ }
+ if (handler == null) {
+ return delete this.bindings[event];
+ } else {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ if (this.bindings[event][i].handler === handler) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ Evented.prototype.trigger = function() {
+ var args, ctx, event, handler, i, once, _ref, _ref1, _results;
+ event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+ if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
+ handler.apply(ctx != null ? ctx : this, args);
+ if (once) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ return Evented;
+
+ })();
+
+ Tether.Utils = {
+ getScrollParent: getScrollParent,
+ getBounds: getBounds,
+ getOffsetParent: getOffsetParent,
+ extend: extend,
+ addClass: addClass,
+ removeClass: removeClass,
+ hasClass: hasClass,
+ updateClasses: updateClasses,
+ defer: defer,
+ flush: flush,
+ uniqueId: uniqueId,
+ Evented: Evented
+ };
+
+}).call(this);
+
+(function() {
+ var MIRROR_LR, MIRROR_TB, OFFSET_MAP, addClass, addOffset, attachmentToOffset, autoToFixedAttachment, defer, extend, flush, getBounds, getOffsetParent, getOuterSize, getScrollParent, getSize, now, offsetToPx, parseAttachment, parseOffset, position, removeClass, tethers, transformKey, updateClasses, within, _Tether, _ref,
+ __slice = [].slice,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("You must include the utils.js file before tether.js");
+ }
+
+ _ref = Tether.Utils, getScrollParent = _ref.getScrollParent, getSize = _ref.getSize, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getOffsetParent = _ref.getOffsetParent, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, updateClasses = _ref.updateClasses, defer = _ref.defer, flush = _ref.flush;
+
+ within = function(a, b, diff) {
+ if (diff == null) {
+ diff = 1;
+ }
+ return (a + diff >= b && b >= a - diff);
+ };
+
+ transformKey = (function() {
+ var el, key, _i, _len, _ref1;
+ el = document.createElement('div');
+ _ref1 = ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ key = _ref1[_i];
+ if (el.style[key] !== void 0) {
+ return key;
+ }
+ }
+ })();
+
+ tethers = [];
+
+ position = function() {
+ var tether, _i, _len;
+ for (_i = 0, _len = tethers.length; _i < _len; _i++) {
+ tether = tethers[_i];
+ tether.position(false);
+ }
+ return flush();
+ };
+
+ now = function() {
+ var _ref1;
+ return (_ref1 = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref1 : +(new Date);
+ };
+
+ (function() {
+ var event, lastCall, lastDuration, pendingTimeout, tick, _i, _len, _ref1, _results;
+ lastCall = null;
+ lastDuration = null;
+ pendingTimeout = null;
+ tick = function() {
+ if ((lastDuration != null) && lastDuration > 16) {
+ lastDuration = Math.min(lastDuration - 16, 250);
+ pendingTimeout = setTimeout(tick, 250);
+ return;
+ }
+ if ((lastCall != null) && (now() - lastCall) < 10) {
+ return;
+ }
+ if (pendingTimeout != null) {
+ clearTimeout(pendingTimeout);
+ pendingTimeout = null;
+ }
+ lastCall = now();
+ position();
+ return lastDuration = now() - lastCall;
+ };
+ _ref1 = ['resize', 'scroll'];
+ _results = [];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ event = _ref1[_i];
+ _results.push(window.addEventListener(event, tick));
+ }
+ return _results;
+ })();
+
+ MIRROR_LR = {
+ center: 'center',
+ left: 'right',
+ right: 'left'
+ };
+
+ MIRROR_TB = {
+ middle: 'middle',
+ top: 'bottom',
+ bottom: 'top'
+ };
+
+ OFFSET_MAP = {
+ top: 0,
+ left: 0,
+ middle: '50%',
+ center: '50%',
+ bottom: '100%',
+ right: '100%'
+ };
+
+ autoToFixedAttachment = function(attachment, relativeToAttachment) {
+ var left, top;
+ left = attachment.left, top = attachment.top;
+ if (left === 'auto') {
+ left = MIRROR_LR[relativeToAttachment.left];
+ }
+ if (top === 'auto') {
+ top = MIRROR_TB[relativeToAttachment.top];
+ }
+ return {
+ left: left,
+ top: top
+ };
+ };
+
+ attachmentToOffset = function(attachment) {
+ var _ref1, _ref2;
+ return {
+ left: (_ref1 = OFFSET_MAP[attachment.left]) != null ? _ref1 : attachment.left,
+ top: (_ref2 = OFFSET_MAP[attachment.top]) != null ? _ref2 : attachment.top
+ };
+ };
+
+ addOffset = function() {
+ var left, offsets, out, top, _i, _len, _ref1;
+ offsets = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ out = {
+ top: 0,
+ left: 0
+ };
+ for (_i = 0, _len = offsets.length; _i < _len; _i++) {
+ _ref1 = offsets[_i], top = _ref1.top, left = _ref1.left;
+ if (typeof top === 'string') {
+ top = parseFloat(top, 10);
+ }
+ if (typeof left === 'string') {
+ left = parseFloat(left, 10);
+ }
+ out.top += top;
+ out.left += left;
+ }
+ return out;
+ };
+
+ offsetToPx = function(offset, size) {
+ if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
+ offset.left = parseFloat(offset.left, 10) / 100 * size.width;
+ }
+ if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
+ offset.top = parseFloat(offset.top, 10) / 100 * size.height;
+ }
+ return offset;
+ };
+
+ parseAttachment = parseOffset = function(value) {
+ var left, top, _ref1;
+ _ref1 = value.split(' '), top = _ref1[0], left = _ref1[1];
+ return {
+ top: top,
+ left: left
+ };
+ };
+
+ _Tether = (function() {
+ _Tether.modules = [];
+
+ function _Tether(options) {
+ this.position = __bind(this.position, this);
+ var module, _i, _len, _ref1, _ref2;
+ tethers.push(this);
+ this.history = [];
+ this.setOptions(options, false);
+ _ref1 = Tether.modules;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ module = _ref1[_i];
+ if ((_ref2 = module.initialize) != null) {
+ _ref2.call(this);
+ }
+ }
+ this.position();
+ }
+
+ _Tether.prototype.getClass = function(key) {
+ var _ref1, _ref2;
+ if ((_ref1 = this.options.classes) != null ? _ref1[key] : void 0) {
+ return this.options.classes[key];
+ } else if (((_ref2 = this.options.classes) != null ? _ref2[key] : void 0) !== false) {
+ if (this.options.classPrefix) {
+ return "" + this.options.classPrefix + "-" + key;
+ } else {
+ return key;
+ }
+ } else {
+ return '';
+ }
+ };
+
+ _Tether.prototype.setOptions = function(options, position) {
+ var defaults, key, _i, _len, _ref1, _ref2;
+ this.options = options;
+ if (position == null) {
+ position = true;
+ }
+ defaults = {
+ offset: '0 0',
+ targetOffset: '0 0',
+ targetAttachment: 'auto auto',
+ classPrefix: 'tether'
+ };
+ this.options = extend(defaults, this.options);
+ _ref1 = this.options, this.element = _ref1.element, this.target = _ref1.target, this.targetModifier = _ref1.targetModifier;
+ if (this.target === 'viewport') {
+ this.target = document.body;
+ this.targetModifier = 'visible';
+ } else if (this.target === 'scroll-handle') {
+ this.target = document.body;
+ this.targetModifier = 'scroll-handle';
+ }
+ _ref2 = ['element', 'target'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ key = _ref2[_i];
+ if (this[key] == null) {
+ throw new Error("Tether Error: Both element and target must be defined");
+ }
+ if (this[key].jquery != null) {
+ this[key] = this[key][0];
+ } else if (typeof this[key] === 'string') {
+ this[key] = document.querySelector(this[key]);
+ }
+ }
+ addClass(this.element, this.getClass('element'));
+ addClass(this.target, this.getClass('target'));
+ if (!this.options.attachment) {
+ throw new Error("Tether Error: You must provide an attachment");
+ }
+ this.targetAttachment = parseAttachment(this.options.targetAttachment);
+ this.attachment = parseAttachment(this.options.attachment);
+ this.offset = parseOffset(this.options.offset);
+ this.targetOffset = parseOffset(this.options.targetOffset);
+ if (this.scrollParent != null) {
+ this.disable();
+ }
+ if (this.targetModifier === 'scroll-handle') {
+ this.scrollParent = this.target;
+ } else {
+ this.scrollParent = getScrollParent(this.target);
+ }
+ if (this.options.enabled !== false) {
+ return this.enable(position);
+ }
+ };
+
+ _Tether.prototype.getTargetBounds = function() {
+ var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target;
+ if (this.targetModifier != null) {
+ switch (this.targetModifier) {
+ case 'visible':
+ if (this.target === document.body) {
+ return {
+ top: pageYOffset,
+ left: pageXOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(this.target);
+ out = {
+ height: bounds.height,
+ width: bounds.width,
+ top: bounds.top,
+ left: bounds.left
+ };
+ out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
+ out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight)));
+ out.height = Math.min(innerHeight, out.height);
+ out.height -= 2;
+ out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
+ out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth)));
+ out.width = Math.min(innerWidth, out.width);
+ out.width -= 2;
+ if (out.top < pageYOffset) {
+ out.top = pageYOffset;
+ }
+ if (out.left < pageXOffset) {
+ out.left = pageXOffset;
+ }
+ return out;
+ }
+ break;
+ case 'scroll-handle':
+ target = this.target;
+ if (target === document.body) {
+ target = document.documentElement;
+ bounds = {
+ left: pageXOffset,
+ top: pageYOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(target);
+ }
+ style = getComputedStyle(target);
+ hasBottomScroll = target.scrollWidth > target.clientWidth || 'scroll' === [style.overflow, style.overflowX] || this.target !== document.body;
+ scrollBottom = 0;
+ if (hasBottomScroll) {
+ scrollBottom = 15;
+ }
+ height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
+ out = {
+ width: 15,
+ height: height * 0.975 * (height / target.scrollHeight),
+ left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
+ };
+ fitAdj = 0;
+ if (height < 408 && this.target === document.body) {
+ fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
+ }
+ if (this.target !== document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ scrollPercentage = target.scrollTop / (target.scrollHeight - height);
+ out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
+ if (this.target === document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ return out;
+ }
+ } else {
+ return getBounds(this.target);
+ }
+ };
+
+ _Tether.prototype.clearCache = function() {
+ return this._cache = {};
+ };
+
+ _Tether.prototype.cache = function(k, getter) {
+ if (this._cache == null) {
+ this._cache = {};
+ }
+ if (this._cache[k] == null) {
+ this._cache[k] = getter.call(this);
+ }
+ return this._cache[k];
+ };
+
+ _Tether.prototype.enable = function(position) {
+ if (position == null) {
+ position = true;
+ }
+ addClass(this.target, this.getClass('enabled'));
+ addClass(this.element, this.getClass('enabled'));
+ this.enabled = true;
+ if (this.scrollParent !== document) {
+ this.scrollParent.addEventListener('scroll', this.position);
+ }
+ if (position) {
+ return this.position();
+ }
+ };
+
+ _Tether.prototype.disable = function() {
+ removeClass(this.target, this.getClass('enabled'));
+ removeClass(this.element, this.getClass('enabled'));
+ this.enabled = false;
+ if (this.scrollParent != null) {
+ return this.scrollParent.removeEventListener('scroll', this.position);
+ }
+ };
+
+ _Tether.prototype.destroy = function() {
+ var i, tether, _i, _len, _results;
+ this.disable();
+ _results = [];
+ for (i = _i = 0, _len = tethers.length; _i < _len; i = ++_i) {
+ tether = tethers[i];
+ if (tether === this) {
+ tethers.splice(i, 1);
+ break;
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ _Tether.prototype.updateAttachClasses = function(elementAttach, targetAttach) {
+ var add, all, side, sides, _i, _j, _len, _len1, _ref1,
+ _this = this;
+ if (elementAttach == null) {
+ elementAttach = this.attachment;
+ }
+ if (targetAttach == null) {
+ targetAttach = this.targetAttachment;
+ }
+ sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
+ if ((_ref1 = this._addAttachClasses) != null ? _ref1.length : void 0) {
+ this._addAttachClasses.splice(0, this._addAttachClasses.length);
+ }
+ add = this._addAttachClasses != null ? this._addAttachClasses : this._addAttachClasses = [];
+ if (elementAttach.top) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.top);
+ }
+ if (elementAttach.left) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.left);
+ }
+ if (targetAttach.top) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.top);
+ }
+ if (targetAttach.left) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.left);
+ }
+ all = [];
+ for (_i = 0, _len = sides.length; _i < _len; _i++) {
+ side = sides[_i];
+ all.push("" + (this.getClass('element-attached')) + "-" + side);
+ }
+ for (_j = 0, _len1 = sides.length; _j < _len1; _j++) {
+ side = sides[_j];
+ all.push("" + (this.getClass('target-attached')) + "-" + side);
+ }
+ return defer(function() {
+ if (_this._addAttachClasses == null) {
+ return;
+ }
+ updateClasses(_this.element, _this._addAttachClasses, all);
+ updateClasses(_this.target, _this._addAttachClasses, all);
+ return _this._addAttachClasses = void 0;
+ });
+ };
+
+ _Tether.prototype.position = function(flushChanges) {
+ var elementPos, elementStyle, height, left, manualOffset, manualTargetOffset, module, next, offset, offsetBorder, offsetParent, offsetParentSize, offsetParentStyle, offsetPosition, ret, scrollLeft, scrollTop, side, targetAttachment, targetOffset, targetPos, targetSize, top, width, _i, _j, _len, _len1, _ref1, _ref2, _ref3, _ref4,
+ _this = this;
+ if (flushChanges == null) {
+ flushChanges = true;
+ }
+ if (!this.enabled) {
+ return;
+ }
+ this.clearCache();
+ targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
+ this.updateAttachClasses(this.attachment, targetAttachment);
+ elementPos = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ });
+ width = elementPos.width, height = elementPos.height;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref1 = this.lastSize, width = _ref1.width, height = _ref1.height;
+ } else {
+ this.lastSize = {
+ width: width,
+ height: height
+ };
+ }
+ targetSize = targetPos = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ offset = offsetToPx(attachmentToOffset(this.attachment), {
+ width: width,
+ height: height
+ });
+ targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
+ manualOffset = offsetToPx(this.offset, {
+ width: width,
+ height: height
+ });
+ manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
+ offset = addOffset(offset, manualOffset);
+ targetOffset = addOffset(targetOffset, manualTargetOffset);
+ left = targetPos.left + targetOffset.left - offset.left;
+ top = targetPos.top + targetOffset.top - offset.top;
+ _ref2 = Tether.modules;
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ module = _ref2[_i];
+ ret = module.position.call(this, {
+ left: left,
+ top: top,
+ targetAttachment: targetAttachment,
+ targetPos: targetPos,
+ elementPos: elementPos,
+ offset: offset,
+ targetOffset: targetOffset,
+ manualOffset: manualOffset,
+ manualTargetOffset: manualTargetOffset
+ });
+ if ((ret == null) || typeof ret !== 'object') {
+ continue;
+ } else if (ret === false) {
+ return false;
+ } else {
+ top = ret.top, left = ret.left;
+ }
+ }
+ next = {
+ page: {
+ top: top,
+ bottom: document.body.scrollHeight - top - height,
+ left: left,
+ right: document.body.scrollWidth - left - width
+ },
+ viewport: {
+ top: top - pageYOffset,
+ bottom: pageYOffset - top - height + innerHeight,
+ left: left - pageXOffset,
+ right: pageXOffset - left - width + innerWidth
+ }
+ };
+ if (((_ref3 = this.options.optimizations) != null ? _ref3.moveElement : void 0) !== false && (this.targetModifier == null)) {
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ offsetPosition = this.cache('target-offsetparent-bounds', function() {
+ return getBounds(offsetParent);
+ });
+ offsetParentStyle = getComputedStyle(offsetParent);
+ elementStyle = getComputedStyle(this.element);
+ offsetParentSize = offsetPosition;
+ offsetBorder = {};
+ _ref4 = ['top', 'left', 'bottom', 'right'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ offsetBorder[side] = parseFloat(offsetParentStyle["border-" + side + "-width"]);
+ }
+ offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
+ offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
+ if (next.page.top >= (offsetPosition.top + offsetBorder.top) && next.page.bottom >= offsetPosition.bottom) {
+ if (next.page.left >= (offsetPosition.left + offsetBorder.left) && next.page.right >= offsetPosition.right) {
+ scrollTop = offsetParent.scrollTop;
+ scrollLeft = offsetParent.scrollLeft;
+ next.offset = {
+ top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
+ left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
+ };
+ }
+ }
+ }
+ this.move(next);
+ this.history.unshift(next);
+ if (this.history.length > 3) {
+ this.history.pop();
+ }
+ if (flushChanges) {
+ flush();
+ }
+ return true;
+ };
+
+ _Tether.prototype.move = function(position) {
+ var css, elVal, found, key, moved, offsetParent, point, same, transcribe, type, val, write, writeCSS, _i, _len, _ref1, _ref2,
+ _this = this;
+ if (this.element.parentNode == null) {
+ return;
+ }
+ same = {};
+ for (type in position) {
+ same[type] = {};
+ for (key in position[type]) {
+ found = false;
+ _ref1 = this.history;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ point = _ref1[_i];
+ if (!within((_ref2 = point[type]) != null ? _ref2[key] : void 0, position[type][key])) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ same[type][key] = true;
+ }
+ }
+ }
+ css = {
+ top: '',
+ left: '',
+ right: '',
+ bottom: ''
+ };
+ transcribe = function(same, pos) {
+ var xPos, yPos, _ref3;
+ if (((_ref3 = _this.options.optimizations) != null ? _ref3.gpu : void 0) !== false) {
+ if (same.top) {
+ css.top = 0;
+ yPos = pos.top;
+ } else {
+ css.bottom = 0;
+ yPos = -pos.bottom;
+ }
+ if (same.left) {
+ css.left = 0;
+ xPos = pos.left;
+ } else {
+ css.right = 0;
+ xPos = -pos.right;
+ }
+ css[transformKey] = "translateX(" + (Math.round(xPos)) + "px) translateY(" + (Math.round(yPos)) + "px)";
+ if (transformKey !== 'msTransform') {
+ return css[transformKey] += " translateZ(0)";
+ }
+ } else {
+ if (same.top) {
+ css.top = "" + pos.top + "px";
+ } else {
+ css.bottom = "" + pos.bottom + "px";
+ }
+ if (same.left) {
+ return css.left = "" + pos.left + "px";
+ } else {
+ return css.right = "" + pos.right + "px";
+ }
+ }
+ };
+ moved = false;
+ if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
+ css.position = 'absolute';
+ transcribe(same.page, position.page);
+ } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
+ css.position = 'fixed';
+ transcribe(same.viewport, position.viewport);
+ } else if ((same.offset != null) && same.offset.top && same.offset.left) {
+ css.position = 'absolute';
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ if (getOffsetParent(this.element) !== offsetParent) {
+ defer(function() {
+ _this.element.parentNode.removeChild(_this.element);
+ return offsetParent.appendChild(_this.element);
+ });
+ }
+ transcribe(same.offset, position.offset);
+ moved = true;
+ } else {
+ css.position = 'absolute';
+ transcribe({
+ top: true,
+ left: true
+ }, position.page);
+ }
+ if (!moved && this.element.parentNode.tagName !== 'BODY') {
+ this.element.parentNode.removeChild(this.element);
+ document.body.appendChild(this.element);
+ }
+ writeCSS = {};
+ write = false;
+ for (key in css) {
+ val = css[key];
+ elVal = this.element.style[key];
+ if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) {
+ elVal = parseFloat(elVal);
+ val = parseFloat(val);
+ }
+ if (elVal !== val) {
+ write = true;
+ writeCSS[key] = css[key];
+ }
+ }
+ if (write) {
+ return defer(function() {
+ return extend(_this.element.style, writeCSS);
+ });
+ }
+ };
+
+ return _Tether;
+
+ })();
+
+ Tether.position = position;
+
+ window.Tether = extend(_Tether, Tether);
+
+}).call(this);
+
+(function() {
+ var BOUNDS_FORMAT, MIRROR_ATTACH, defer, extend, getBoundingRect, getBounds, getOuterSize, getSize, updateClasses, _ref,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+
+ _ref = Tether.Utils, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getSize = _ref.getSize, extend = _ref.extend, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ MIRROR_ATTACH = {
+ left: 'right',
+ right: 'left',
+ top: 'bottom',
+ bottom: 'top',
+ middle: 'middle'
+ };
+
+ BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
+
+ getBoundingRect = function(tether, to) {
+ var i, pos, side, size, style, _i, _len;
+ if (to === 'scrollParent') {
+ to = tether.scrollParent;
+ } else if (to === 'window') {
+ to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
+ }
+ if (to === document) {
+ to = to.documentElement;
+ }
+ if (to.nodeType != null) {
+ pos = size = getBounds(to);
+ style = getComputedStyle(to);
+ to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
+ for (i = _i = 0, _len = BOUNDS_FORMAT.length; _i < _len; i = ++_i) {
+ side = BOUNDS_FORMAT[i];
+ if (side === 'top' || side === 'left') {
+ to[i] += parseFloat(style["border-" + side + "-width"]);
+ } else {
+ to[i] -= parseFloat(style["border-" + side + "-width"]);
+ }
+ }
+ }
+ return to;
+ };
+
+ Tether.modules.push({
+ position: function(_arg) {
+ var addClasses, allClasses, attachment, bounds, changeAttachX, changeAttachY, cls, constraint, eAttachment, height, left, oob, oobClass, p, pin, pinned, pinnedClass, removeClass, side, tAttachment, targetAttachment, targetHeight, targetSize, targetWidth, to, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8,
+ _this = this;
+ top = _arg.top, left = _arg.left, targetAttachment = _arg.targetAttachment;
+ if (!this.options.constraints) {
+ return true;
+ }
+ removeClass = function(prefix) {
+ var side, _i, _len, _results;
+ _this.removeClass(prefix);
+ _results = [];
+ for (_i = 0, _len = BOUNDS_FORMAT.length; _i < _len; _i++) {
+ side = BOUNDS_FORMAT[_i];
+ _results.push(_this.removeClass("" + prefix + "-" + side));
+ }
+ return _results;
+ };
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref2 = this.lastSize, width = _ref2.width, height = _ref2.height;
+ }
+ targetSize = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ targetHeight = targetSize.height;
+ targetWidth = targetSize.width;
+ tAttachment = {};
+ eAttachment = {};
+ allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
+ _ref3 = this.options.constraints;
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ constraint = _ref3[_i];
+ if (constraint.outOfBoundsClass) {
+ allClasses.push(constraint.outOfBoundsClass);
+ }
+ if (constraint.pinnedClass) {
+ allClasses.push(constraint.pinnedClass);
+ }
+ }
+ for (_j = 0, _len1 = allClasses.length; _j < _len1; _j++) {
+ cls = allClasses[_j];
+ _ref4 = ['left', 'top', 'right', 'bottom'];
+ for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
+ side = _ref4[_k];
+ allClasses.push("" + cls + "-" + side);
+ }
+ }
+ addClasses = [];
+ tAttachment = extend({}, targetAttachment);
+ eAttachment = extend({}, this.attachment);
+ _ref5 = this.options.constraints;
+ for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) {
+ constraint = _ref5[_l];
+ to = constraint.to, attachment = constraint.attachment, pin = constraint.pin;
+ if (attachment == null) {
+ attachment = '';
+ }
+ if (__indexOf.call(attachment, ' ') >= 0) {
+ _ref6 = attachment.split(' '), changeAttachY = _ref6[0], changeAttachX = _ref6[1];
+ } else {
+ changeAttachX = changeAttachY = attachment;
+ }
+ bounds = getBoundingRect(this, to);
+ if (changeAttachY === 'target' || changeAttachY === 'both') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ }
+ }
+ if (changeAttachY === 'together') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ if (eAttachment.top === 'bottom') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top += height;
+ eAttachment.top = 'top';
+ } else if (eAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ if (eAttachment.top === 'top') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (eAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ }
+ if (changeAttachX === 'target' || changeAttachX === 'both') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ }
+ if (left + width > bounds[2] && tAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ }
+ }
+ if (changeAttachX === 'together') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ if (eAttachment.left === 'right') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left += width;
+ eAttachment.left = 'left';
+ } else if (eAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ } else if (left + width > bounds[2] && tAttachment.left === 'right') {
+ if (eAttachment.left === 'left') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (eAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left += width;
+ eAttachment.left = 'left';
+ }
+ }
+ }
+ if (changeAttachY === 'element' || changeAttachY === 'both') {
+ if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (changeAttachX === 'element' || changeAttachX === 'both') {
+ if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ }
+ if (typeof pin === 'string') {
+ pin = (function() {
+ var _len4, _m, _ref7, _results;
+ _ref7 = pin.split(',');
+ _results = [];
+ for (_m = 0, _len4 = _ref7.length; _m < _len4; _m++) {
+ p = _ref7[_m];
+ _results.push(p.trim());
+ }
+ return _results;
+ })();
+ } else if (pin === true) {
+ pin = ['top', 'left', 'right', 'bottom'];
+ }
+ pin || (pin = []);
+ pinned = [];
+ oob = [];
+ if (top < bounds[1]) {
+ if (__indexOf.call(pin, 'top') >= 0) {
+ top = bounds[1];
+ pinned.push('top');
+ } else {
+ oob.push('top');
+ }
+ }
+ if (top + height > bounds[3]) {
+ if (__indexOf.call(pin, 'bottom') >= 0) {
+ top = bounds[3] - height;
+ pinned.push('bottom');
+ } else {
+ oob.push('bottom');
+ }
+ }
+ if (left < bounds[0]) {
+ if (__indexOf.call(pin, 'left') >= 0) {
+ left = bounds[0];
+ pinned.push('left');
+ } else {
+ oob.push('left');
+ }
+ }
+ if (left + width > bounds[2]) {
+ if (__indexOf.call(pin, 'right') >= 0) {
+ left = bounds[2] - width;
+ pinned.push('right');
+ } else {
+ oob.push('right');
+ }
+ }
+ if (pinned.length) {
+ pinnedClass = (_ref7 = this.options.pinnedClass) != null ? _ref7 : this.getClass('pinned');
+ addClasses.push(pinnedClass);
+ for (_m = 0, _len4 = pinned.length; _m < _len4; _m++) {
+ side = pinned[_m];
+ addClasses.push("" + pinnedClass + "-" + side);
+ }
+ }
+ if (oob.length) {
+ oobClass = (_ref8 = this.options.outOfBoundsClass) != null ? _ref8 : this.getClass('out-of-bounds');
+ addClasses.push(oobClass);
+ for (_n = 0, _len5 = oob.length; _n < _len5; _n++) {
+ side = oob[_n];
+ addClasses.push("" + oobClass + "-" + side);
+ }
+ }
+ if (__indexOf.call(pinned, 'left') >= 0 || __indexOf.call(pinned, 'right') >= 0) {
+ eAttachment.left = tAttachment.left = false;
+ }
+ if (__indexOf.call(pinned, 'top') >= 0 || __indexOf.call(pinned, 'bottom') >= 0) {
+ eAttachment.top = tAttachment.top = false;
+ }
+ if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== this.attachment.top || eAttachment.left !== this.attachment.left) {
+ this.updateAttachClasses(eAttachment, tAttachment);
+ }
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+(function() {
+ var defer, getBounds, updateClasses, _ref;
+
+ _ref = Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ Tether.modules.push({
+ position: function(_arg) {
+ var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5,
+ _this = this;
+ top = _arg.top, left = _arg.left;
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ targetPos = this.getTargetBounds();
+ bottom = top + height;
+ right = left + width;
+ abutted = [];
+ if (top <= targetPos.bottom && bottom >= targetPos.top) {
+ _ref2 = ['left', 'right'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ side = _ref2[_i];
+ if ((_ref3 = targetPos[side]) === left || _ref3 === right) {
+ abutted.push(side);
+ }
+ }
+ }
+ if (left <= targetPos.right && right >= targetPos.left) {
+ _ref4 = ['top', 'bottom'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) {
+ abutted.push(side);
+ }
+ }
+ }
+ allClasses = [];
+ addClasses = [];
+ sides = ['left', 'top', 'right', 'bottom'];
+ allClasses.push(this.getClass('abutted'));
+ for (_k = 0, _len2 = sides.length; _k < _len2; _k++) {
+ side = sides[_k];
+ allClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ if (abutted.length) {
+ addClasses.push(this.getClass('abutted'));
+ }
+ for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) {
+ side = abutted[_l];
+ addClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return true;
+ }
+ });
+
+}).call(this);
+
+(function() {
+ Tether.modules.push({
+ position: function(_arg) {
+ var left, result, shift, shiftLeft, shiftTop, top, _ref;
+ top = _arg.top, left = _arg.left;
+ if (!this.options.shift) {
+ return;
+ }
+ result = function(val) {
+ if (typeof val === 'function') {
+ return val.call(this, {
+ top: top,
+ left: left
+ });
+ } else {
+ return val;
+ }
+ };
+ shift = result(this.options.shift);
+ if (typeof shift === 'string') {
+ shift = shift.split(' ');
+ shift[1] || (shift[1] = shift[0]);
+ shiftTop = shift[0], shiftLeft = shift[1];
+ shiftTop = parseFloat(shiftTop, 10);
+ shiftLeft = parseFloat(shiftLeft, 10);
+ } else {
+ _ref = [shift.top, shift.left], shiftTop = _ref[0], shiftLeft = _ref[1];
+ }
+ top += shiftTop;
+ left += shiftLeft;
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+(function() {
+ var ATTACHMENT, Evented, Shepherd, Step, Tour, addClass, createFromHTML, extend, getBounds, matchesSelector, parseShorthand, removeClass, uniqueId, _ref,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ _ref = Tether.Utils, extend = _ref.extend, removeClass = _ref.removeClass, addClass = _ref.addClass, Evented = _ref.Evented, getBounds = _ref.getBounds, uniqueId = _ref.uniqueId;
+
+ ATTACHMENT = {
+ 'top': 'top center',
+ 'left': 'middle right',
+ 'right': 'middle left',
+ 'bottom': 'bottom center'
+ };
+
+ createFromHTML = function(html) {
+ var el;
+ el = document.createElement('div');
+ el.innerHTML = html;
+ return el.children[0];
+ };
+
+ matchesSelector = function(el, sel) {
+ var matches, _ref1, _ref2, _ref3, _ref4;
+ matches = (_ref1 = (_ref2 = (_ref3 = (_ref4 = el.matches) != null ? _ref4 : el.matchesSelector) != null ? _ref3 : el.webkitMatchesSelector) != null ? _ref2 : el.mozMatchesSelector) != null ? _ref1 : el.oMatchesSelector;
+ return matches.call(el, sel);
+ };
+
+ parseShorthand = function(obj, props) {
+ var i, out, prop, vals, _i, _len;
+ if (obj == null) {
+ return obj;
+ } else if (typeof obj === 'object') {
+ return obj;
+ } else {
+ vals = obj.split(' ');
+ if (vals.length > props.length) {
+ vals[0] = vals.slice(0, +(vals.length - props.length) + 1 || 9e9).join(' ');
+ vals.splice(1, vals.length - props.length);
+ }
+ out = {};
+ for (i = _i = 0, _len = props.length; _i < _len; i = ++_i) {
+ prop = props[i];
+ out[prop] = vals[i];
+ }
+ return out;
+ }
+ };
+
+ Step = (function(_super) {
+ __extends(Step, _super);
+
+ function Step(tour, options) {
+ this.tour = tour;
+ this.destroy = __bind(this.destroy, this);
+ this.scrollTo = __bind(this.scrollTo, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.isOpen = __bind(this.isOpen, this);
+ this.hide = __bind(this.hide, this);
+ this.show = __bind(this.show, this);
+ this.setOptions(options);
+ this;
+ }
+
+ Step.prototype.setOptions = function(options) {
+ var event, handler, _base, _ref1;
+ this.options = options != null ? options : {};
+ this.destroy();
+ this.id = this.options.id || this.id || ("step-" + (uniqueId()));
+ if (this.options.when) {
+ _ref1 = this.options.when;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ this.on(event, handler, this);
+ }
+ }
+ return (_base = this.options).buttons != null ? (_base = this.options).buttons : _base.buttons = [
+ {
+ text: 'Next',
+ action: this.tour.next
+ }
+ ];
+ };
+
+ Step.prototype.getTour = function() {
+ return this.tour;
+ };
+
+ Step.prototype.bindAdvance = function() {
+ var event, handler, selector, _ref1,
+ _this = this;
+ _ref1 = parseShorthand(this.options.advanceOn, ['selector', 'event']), event = _ref1.event, selector = _ref1.selector;
+ handler = function(e) {
+ if (!_this.isOpen()) {
+ return;
+ }
+ if (selector != null) {
+ if (matchesSelector(e.target, selector)) {
+ return _this.tour.next();
+ }
+ } else {
+ if (_this.el && e.target === _this.el) {
+ return _this.tour.next();
+ }
+ }
+ };
+ document.body.addEventListener(event, handler);
+ return this.on('destroy', function() {
+ return document.body.removeEventListener(event, handler);
+ });
+ };
+
+ Step.prototype.getAttachTo = function() {
+ var opts;
+ opts = parseShorthand(this.options.attachTo, ['element', 'on']);
+ if (opts == null) {
+ opts = {};
+ }
+ if (typeof opts.element === 'string') {
+ opts.element = document.querySelector(opts.element);
+ if (opts.element == null) {
+ throw new Error("Shepherd step's attachTo was not found in the page");
+ }
+ }
+ return opts;
+ };
+
+ Step.prototype.setupTether = function() {
+ var attachment, opts, tetherOpts;
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("Using the attachment feature of Shepherd requires the Tether library");
+ }
+ opts = this.getAttachTo();
+ attachment = ATTACHMENT[opts.on || 'right'];
+ if (opts.element == null) {
+ opts.element = 'viewport';
+ attachment = 'middle center';
+ }
+ tetherOpts = {
+ classPrefix: 'shepherd',
+ element: this.el,
+ constraints: [
+ {
+ to: 'window',
+ pin: true,
+ attachment: 'together'
+ }
+ ],
+ target: opts.element,
+ offset: opts.offset || '0 0',
+ attachment: attachment
+ };
+ return this.tether = new Tether(extend(tetherOpts, this.options.tetherOptions));
+ };
+
+ Step.prototype.show = function() {
+ var _ref1,
+ _this = this;
+ if (this.el == null) {
+ this.render();
+ }
+ addClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.enable();
+ }
+ if (this.options.scrollTo) {
+ setTimeout(function() {
+ return _this.scrollTo();
+ });
+ }
+ return this.trigger('show');
+ };
+
+ Step.prototype.hide = function() {
+ var _ref1;
+ removeClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.disable();
+ }
+ return this.trigger('hide');
+ };
+
+ Step.prototype.isOpen = function() {
+ return hasClass(this.el, 'shepherd-open');
+ };
+
+ Step.prototype.cancel = function() {
+ this.hide();
+ return this.trigger('cancel');
+ };
+
+ Step.prototype.complete = function() {
+ this.hide();
+ return this.trigger('complete');
+ };
+
+ Step.prototype.scrollTo = function() {
+ var element;
+ element = this.getAttachTo().element;
+ return element != null ? element.scrollIntoView() : void 0;
+ };
+
+ Step.prototype.destroy = function() {
+ var _ref1;
+ if (this.el != null) {
+ document.body.removeChild(this.el);
+ delete this.el;
+ }
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ return this.trigger('destroy');
+ };
+
+ Step.prototype.render = function() {
+ var button, buttons, cfg, content, footer, header, paragraph, paragraphs, text, _i, _j, _len, _len1, _ref1, _ref2, _ref3;
+ if (this.el != null) {
+ this.destroy();
+ }
+ this.el = createFromHTML("");
+ content = document.createElement('div');
+ content.className = 'shepherd-content';
+ this.el.appendChild(content);
+ if (this.options.title != null) {
+ header = document.createElement('header');
+ header.innerHTML = "" + this.options.title + "
";
+ this.el.className += ' shepherd-has-title';
+ content.appendChild(header);
+ }
+ if (this.options.text != null) {
+ text = createFromHTML("");
+ paragraphs = this.options.text;
+ if (typeof paragraphs === 'string') {
+ paragraphs = [paragraphs];
+ }
+ for (_i = 0, _len = paragraphs.length; _i < _len; _i++) {
+ paragraph = paragraphs[_i];
+ text.innerHTML += "" + paragraph + "
";
+ }
+ content.appendChild(text);
+ }
+ footer = document.createElement('footer');
+ if (this.options.buttons) {
+ buttons = createFromHTML("");
+ _ref2 = this.options.buttons;
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
+ cfg = _ref2[_j];
+ button = createFromHTML("" + cfg.text + "");
+ buttons.appendChild(button);
+ this.bindButtonEvents(cfg, button.querySelector('a'));
+ }
+ footer.appendChild(buttons);
+ }
+ content.appendChild(footer);
+ document.body.appendChild(this.el);
+ this.setupTether();
+ if (this.options.advanceOn) {
+ return this.bindAdvance();
+ }
+ };
+
+ Step.prototype.bindButtonEvents = function(cfg, el) {
+ var event, handler, page, _ref1,
+ _this = this;
+ if (cfg.events == null) {
+ cfg.events = {};
+ }
+ if (cfg.action != null) {
+ cfg.events.click = cfg.action;
+ }
+ _ref1 = cfg.events;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ if (typeof handler === 'string') {
+ page = handler;
+ handler = function() {
+ return _this.tour.show(page);
+ };
+ }
+ el.addEventListener(event, handler);
+ }
+ return this.on('destroy', function() {
+ var _ref2, _results;
+ _ref2 = cfg.events;
+ _results = [];
+ for (event in _ref2) {
+ handler = _ref2[event];
+ _results.push(el.removeEventListener(event, handler));
+ }
+ return _results;
+ });
+ };
+
+ return Step;
+
+ })(Evented);
+
+ Tour = (function(_super) {
+ __extends(Tour, _super);
+
+ function Tour(options) {
+ var event, _i, _len, _ref1, _ref2,
+ _this = this;
+ this.options = options != null ? options : {};
+ this.hide = __bind(this.hide, this);
+ this.cancel = __bind(this.cancel, this);
+ this.back = __bind(this.back, this);
+ this.next = __bind(this.next, this);
+ this.steps = (_ref1 = this.options.steps) != null ? _ref1 : [];
+ _ref2 = ['complete', 'cancel', 'hide', 'start', 'show'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ event = _ref2[_i];
+ this.on(event, function(opts) {
+ if (opts == null) {
+ opts = {};
+ }
+ opts.tour = _this;
+ return Shepherd.trigger(event, opts);
+ });
+ }
+ this;
+ }
+
+ Tour.prototype.addStep = function(name, step) {
+ var _ref1;
+ if (step == null) {
+ step = name;
+ }
+ if (!(step instanceof Step)) {
+ if ((_ref1 = typeof name) === 'string' || _ref1 === 'number') {
+ step.id = name.toString();
+ }
+ step = extend({}, this.options.defaults, step);
+ step = new Step(this, step);
+ } else {
+ step.tour = this;
+ }
+ this.steps.push(step);
+ return step;
+ };
+
+ Tour.prototype.getById = function(id) {
+ var step, _i, _len, _ref1;
+ _ref1 = this.steps;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ step = _ref1[_i];
+ if (step.id === id) {
+ return step;
+ }
+ }
+ };
+
+ Tour.prototype.getCurrentStep = function() {
+ return this.currentStep;
+ };
+
+ Tour.prototype.next = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ if (index === this.steps.length - 1) {
+ this.hide(index);
+ this.trigger('complete');
+ return this.done();
+ } else {
+ return this.show(index + 1);
+ }
+ };
+
+ Tour.prototype.back = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ return this.show(index - 1);
+ };
+
+ Tour.prototype.cancel = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.cancel();
+ }
+ this.trigger('cancel');
+ return this.done();
+ };
+
+ Tour.prototype.hide = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('hide');
+ return this.done();
+ };
+
+ Tour.prototype.done = function() {
+ return Shepherd.activeTour = null;
+ };
+
+ Tour.prototype.show = function(key) {
+ var next;
+ if (key == null) {
+ key = 0;
+ }
+ if (this.currentStep) {
+ this.currentStep.hide();
+ }
+ Shepherd.activeTour = this;
+ if (typeof key === 'string') {
+ next = this.getById(key);
+ } else {
+ next = this.steps[key];
+ }
+ if (next) {
+ this.trigger('show', {
+ step: next,
+ previous: this.currentStep
+ });
+ this.currentStep = next;
+ return next.show();
+ }
+ };
+
+ Tour.prototype.start = function() {
+ this.trigger('start');
+ this.currentStep = null;
+ return this.next();
+ };
+
+ return Tour;
+
+ })(Evented);
+
+ Shepherd = new Evented;
+
+ extend(Shepherd, {
+ Tour: Tour,
+ Step: Step,
+ Evented: Evented
+ });
+
+ window.Shepherd = Shepherd;
+
+}).call(this);
diff --git a/ajax/libs/shepherd/0.4.1/shepherd.min.js b/ajax/libs/shepherd/0.4.1/shepherd.min.js
new file mode 100644
index 000000000..491abac16
--- /dev/null
+++ b/ajax/libs/shepherd/0.4.1/shepherd.min.js
@@ -0,0 +1,2 @@
+/*! shepherd 0.4.1 */
+(function(){var t,e,n,o,i,s,r,h,l,a,p,u,f,c,d,g,m={}.hasOwnProperty,v=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1},b=[].slice;null==window.Tether&&(window.Tether={}),a=function(t){var e,n,o,i,s;if(n=getComputedStyle(t).position,"fixed"===n)return t;for(o=void 0,e=t;e=e.parentNode;){try{i=getComputedStyle(e)}catch(r){}if(null==i)return e;if(/(auto|scroll)/.test(i.overflow+i["overflow-y"]+i["overflow-x"])&&("absolute"!==n||"relative"===(s=i.position)||"absolute"===s||"fixed"===s))return e}return document.body},c=function(){var t;return t=0,function(){return t++}}(),g={},l=function(t){var e,o,s,r,h;if(s=t._tetherZeroElement,null==s&&(s=t.createElement("div"),s.setAttribute("data-tether-id",c()),i(s.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(s),t._tetherZeroElement=s),e=s.getAttribute("data-tether-id"),null==g[e]){g[e]={},h=s.getBoundingClientRect();for(o in h)r=h[o],g[e][o]=r;n(function(){return g[e]=void 0})}return g[e]},u=null,r=function(t){var e,n,o,i,s,r,h;t===document?(n=document,t=document.documentElement):n=t.ownerDocument,o=n.documentElement,e={},h=t.getBoundingClientRect();for(i in h)r=h[i],e[i]=r;return s=l(n),e.top-=s.top,e.left-=s.left,e.top=e.top-o.clientTop,e.left=e.left-o.clientLeft,e.right=n.body.clientWidth-e.width-e.left,e.bottom=n.body.clientHeight-e.height-e.top,e},h=function(t){return t.offsetParent||document.documentElement},i=function(t){var e,n,o,i,s,r,h;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),h=e.slice(1),s=0,r=h.length;r>s;s++)if(o=h[s])for(n in o)m.call(o,n)&&(i=o[n],t[n]=i);return t},f=function(t,e){var n,o,i,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],o=0,i=s.length;i>o;o++)n=s[o],r.push(t.classList.remove(n));return r}return t.className=t.className.replace(new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi")," ")},e=function(t,e){var n,o,i,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],o=0,i=s.length;i>o;o++)n=s[o],r.push(t.classList.add(n));return r}return f(t,e),t.className+=" "+e},p=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},d=function(t,n,o){var i,s,r,h,l,a;for(s=0,h=o.length;h>s;s++)i=o[s],v.call(n,i)<0&&p(t,i)&&f(t,i);for(a=[],r=0,l=n.length;l>r;r++)i=n[r],a.push(p(t,i)?void 0:e(t,i));return a},o=[],n=function(t){return o.push(t)},s=function(){var t,e;for(e=[];t=o.pop();)e.push(t());return e},t=function(){function t(){}return t.prototype.on=function(t,e,n,o){var i;return null==o&&(o=!1),null==this.bindings&&(this.bindings={}),null==(i=this.bindings)[t]&&(i[t]=[]),this.bindings[t].push({handler:e,ctx:n,once:o})},t.prototype.once=function(t,e,n){return this.on(t,e,n,!0)},t.prototype.off=function(t,e){var n,o,i;if(null!=(null!=(o=this.bindings)?o[t]:void 0)){if(null==e)return delete this.bindings[t];for(n=0,i=[];n=e&&e>=t-n},T=function(){var t,e,n,o,i;for(t=document.createElement("div"),i=["transform","webkitTransform","OTransform","MozTransform","msTransform"],n=0,o=i.length;o>n;n++)if(e=i[n],void 0!==t.style[e])return e}(),C=[],y=function(){var t,e,n;for(e=0,n=C.length;n>e;e++)t=C[e],t.position(!1);return a()},g=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance?"function"==typeof performance.now?performance.now():void 0:void 0)?t:+new Date},function(){var t,e,n,o,i,s,r,h,l;for(e=null,n=null,o=null,i=function(){if(null!=n&&n>16)return n=Math.min(n-16,250),void(o=setTimeout(i,250));if(!(null!=e&&g()-e<10))return null!=o&&(clearTimeout(o),o=null),e=g(),y(),n=g()-e},h=["resize","scroll"],l=[],s=0,r=h.length;r>s;s++)t=h[s],l.push(window.addEventListener(t,i));return l}(),t={center:"center",left:"right",right:"left"},e={middle:"middle",top:"bottom",bottom:"top"},n={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},r=function(n,o){var i,s;return i=n.left,s=n.top,"auto"===i&&(i=t[o.left]),"auto"===s&&(s=e[o.top]),{left:i,top:s}},s=function(t){var e,o;return{left:null!=(e=n[t.left])?e:t.left,top:null!=(o=n[t.top])?o:t.top}},i=function(){var t,e,n,o,i,s,r;for(e=1<=arguments.length?A.call(arguments,0):[],n={top:0,left:0},i=0,s=e.length;s>i;i++)r=e[i],o=r.top,t=r.left,"string"==typeof o&&(o=parseFloat(o,10)),"string"==typeof t&&(t=parseFloat(t,10)),n.top+=o,n.left+=t;return n},m=function(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t},v=b=function(t){var e,n,o;return o=t.split(" "),n=o[0],e=o[1],{top:n,left:e}},S=function(){function t(t){this.position=M(this.position,this);var e,n,o,i,s;for(C.push(this),this.history=[],this.setOptions(t,!1),i=Tether.modules,n=0,o=i.length;o>n;n++)e=i[n],null!=(s=e.initialize)&&s.call(this);this.position()}return t.modules=[],t.prototype.getClass=function(t){var e,n;return(null!=(e=this.options.classes)?e[t]:void 0)?this.options.classes[t]:(null!=(n=this.options.classes)?n[t]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+t:t:""},t.prototype.setOptions=function(t,e){var n,i,s,r,h,a;for(this.options=t,null==e&&(e=!0),n={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=l(n,this.options),h=this.options,this.element=h.element,this.target=h.target,this.targetModifier=h.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),a=["element","target"],s=0,r=a.length;r>s;s++){if(i=a[s],null==this[i])throw new Error("Tether Error: Both element and target must be defined");null!=this[i].jquery?this[i]=this[i][0]:"string"==typeof this[i]&&(this[i]=document.querySelector(this[i]))}if(o(this.element,this.getClass("element")),o(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=v(this.options.targetAttachment),this.attachment=v(this.options.attachment),this.offset=b(this.options.offset),this.targetOffset=b(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent="scroll-handle"===this.targetModifier?this.target:c(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,n,o,i,s,r,h,l;if(null==this.targetModifier)return p(this.target);switch(this.targetModifier){case"visible":return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:(t=p(this.target),i={height:t.height,width:t.width,top:t.top,left:t.left},i.height=Math.min(i.height,t.height-(pageYOffset-t.top)),i.height=Math.min(i.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),i.height=Math.min(innerHeight,i.height),i.height-=2,i.width=Math.min(i.width,t.width-(pageXOffset-t.left)),i.width=Math.min(i.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),i.width=Math.min(innerWidth,i.width),i.width-=2,i.topl.clientWidth||"scroll"===[h.overflow,h.overflowX]||this.target!==document.body,s=0,n&&(s=15),o=t.height-parseFloat(h.borderTopWidth)-parseFloat(h.borderBottomWidth)-s,i={width:15,height:.975*o*(o/l.scrollHeight),left:t.left+t.width-parseFloat(h.borderLeftWidth)-15},e=0,408>o&&this.target===document.body&&(e=-11e-5*Math.pow(o,2)-.00727*o+22.58),this.target!==document.body&&(i.height=Math.max(i.height,24)),r=l.scrollTop/(l.scrollHeight-o),i.top=r*(o-i.height-e)+t.top+parseFloat(h.borderTopWidth),this.target===document.body&&(i.height=Math.max(i.height,24)),i}},t.prototype.clearCache=function(){return this._cache={}},t.prototype.cache=function(t,e){return null==this._cache&&(this._cache={}),null==this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},t.prototype.enable=function(t){return null==t&&(t=!0),o(this.target,this.getClass("enabled")),o(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t?this.position():void 0},t.prototype.disable=function(){return w(this.target,this.getClass("enabled")),w(this.element,this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},t.prototype.destroy=function(){var t,e,n,o,i;for(this.disable(),i=[],t=n=0,o=C.length;o>n;t=++n){if(e=C[t],e===this){C.splice(t,1);break}i.push(void 0)}return i},t.prototype.updateAttachClasses=function(t,e){var n,o,i,s,r,l,a,p,u,f=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),s=["left","top","bottom","right","middle","center"],(null!=(u=this._addAttachClasses)?u.length:void 0)&&this._addAttachClasses.splice(0,this._addAttachClasses.length),n=null!=this._addAttachClasses?this._addAttachClasses:this._addAttachClasses=[],t.top&&n.push(""+this.getClass("element-attached")+"-"+t.top),t.left&&n.push(""+this.getClass("element-attached")+"-"+t.left),e.top&&n.push(""+this.getClass("target-attached")+"-"+e.top),e.left&&n.push(""+this.getClass("target-attached")+"-"+e.left),o=[],r=0,a=s.length;a>r;r++)i=s[r],o.push(""+this.getClass("element-attached")+"-"+i);for(l=0,p=s.length;p>l;l++)i=s[l],o.push(""+this.getClass("target-attached")+"-"+i);return h(function(){return null!=f._addAttachClasses?(O(f.element,f._addAttachClasses,o),O(f.target,f._addAttachClasses,o),f._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,n,o,h,l,f,c,d,g,v,b,y,w,C,T,O,x,S,E,A,M,_,B,P,L,z,F,W,H,Y,N,X,k=this;if(null==t&&(t=!0),this.enabled){for(this.clearCache(),E=r(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,E),e=this.cache("element-bounds",function(){return p(k.element)}),P=e.width,o=e.height,0===P&&0===o&&null!=this.lastSize?(H=this.lastSize,P=H.width,o=H.height):this.lastSize={width:P,height:o},_=M=this.cache("target-bounds",function(){return k.getTargetBounds()}),g=m(s(this.attachment),{width:P,height:o}),A=m(s(E),_),l=m(this.offset,{width:P,height:o}),f=m(this.targetOffset,_),g=i(g,l),A=i(A,f),h=M.left+A.left-g.left,B=M.top+A.top-g.top,Y=Tether.modules,L=0,F=Y.length;F>L;L++)if(c=Y[L],T=c.position.call(this,{left:h,top:B,targetAttachment:E,targetPos:M,elementPos:e,offset:g,targetOffset:A,manualOffset:l,manualTargetOffset:f}),null!=T&&"object"==typeof T){if(T===!1)return!1;B=T.top,h=T.left}if(d={page:{top:B,bottom:document.body.scrollHeight-B-o,left:h,right:document.body.scrollWidth-h-P},viewport:{top:B-pageYOffset,bottom:pageYOffset-B-o+innerHeight,left:h-pageXOffset,right:pageXOffset-h-P+innerWidth}},(null!=(N=this.options.optimizations)?N.moveElement:void 0)!==!1&&null==this.targetModifier){for(b=this.cache("target-offsetparent",function(){return u(k.target)}),C=this.cache("target-offsetparent-bounds",function(){return p(b)}),w=getComputedStyle(b),n=getComputedStyle(this.element),y=C,v={},X=["top","left","bottom","right"],z=0,W=X.length;W>z;z++)S=X[z],v[S]=parseFloat(w["border-"+S+"-width"]);C.right=document.body.scrollWidth-C.left-y.width+v.right,C.bottom=document.body.scrollHeight-C.top-y.height+v.bottom,d.page.top>=C.top+v.top&&d.page.bottom>=C.bottom&&d.page.left>=C.left+v.left&&d.page.right>=C.right&&(x=b.scrollTop,O=b.scrollLeft,d.offset={top:d.page.top-C.top+x-v.top,left:d.page.left-C.left+O-v.left})}return this.move(d),this.history.unshift(d),this.history.length>3&&this.history.pop(),t&&a(),!0}},t.prototype.move=function(t){var e,n,o,i,s,r,a,p,f,c,d,g,m,v,b,y,w,C=this;if(null!=this.element.parentNode){p={};for(c in t){p[c]={};for(i in t[c]){for(o=!1,y=this.history,v=0,b=y.length;b>v;v++)if(a=y[v],!x(null!=(w=a[c])?w[i]:void 0,t[c][i])){o=!0;break}o||(p[c][i]=!0)}}e={top:"",left:"",right:"",bottom:""},f=function(t,n){var o,i,s;return(null!=(s=C.options.optimizations)?s.gpu:void 0)===!1?(t.top?e.top=""+n.top+"px":e.bottom=""+n.bottom+"px",t.left?e.left=""+n.left+"px":e.right=""+n.right+"px"):(t.top?(e.top=0,i=n.top):(e.bottom=0,i=-n.bottom),t.left?(e.left=0,o=n.left):(e.right=0,o=-n.right),e[T]="translateX("+Math.round(o)+"px) translateY("+Math.round(i)+"px)","msTransform"!==T?e[T]+=" translateZ(0)":void 0)},s=!1,(p.page.top||p.page.bottom)&&(p.page.left||p.page.right)?(e.position="absolute",f(p.page,t.page)):(p.viewport.top||p.viewport.bottom)&&(p.viewport.left||p.viewport.right)?(e.position="fixed",f(p.viewport,t.viewport)):null!=p.offset&&p.offset.top&&p.offset.left?(e.position="absolute",r=this.cache("target-offsetparent",function(){return u(C.target)}),u(this.element)!==r&&h(function(){return C.element.parentNode.removeChild(C.element),r.appendChild(C.element)}),f(p.offset,t.offset),s=!0):(e.position="absolute",f({top:!0,left:!0},t.page)),s||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),m={},g=!1;for(i in e)d=e[i],n=this.element.style[i],""===n||""===d||"top"!==i&&"left"!==i&&"bottom"!==i&&"right"!==i||(n=parseFloat(n),d=parseFloat(d)),n!==d&&(g=!0,m[i]=e[i]);return g?h(function(){return l(C.element.style,m)}):void 0}},t}(),Tether.position=y,window.Tether=l(S,Tether)}.call(this),function(){var t,e,n,o,i,s,r,h,l,a,p=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};a=Tether.Utils,r=a.getOuterSize,s=a.getBounds,h=a.getSize,o=a.extend,l=a.updateClasses,n=a.defer,e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},t=["left","top","right","bottom"],i=function(e,n){var o,i,r,h,l,a,p;if("scrollParent"===n?n=e.scrollParent:"window"===n&&(n=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),n===document&&(n=n.documentElement),null!=n.nodeType)for(i=h=s(n),l=getComputedStyle(n),n=[i.left,i.top,h.width+i.left,h.height+i.top],o=a=0,p=t.length;p>a;o=++a)r=t[o],"top"===r||"left"===r?n[o]+=parseFloat(l["border-"+r+"-width"]):n[o]-=parseFloat(l["border-"+r+"-width"]);return n},Tether.modules.push({position:function(e){var r,h,a,u,f,c,d,g,m,v,b,y,w,C,T,O,x,S,E,A,M,_,B,P,L,z,F,W,H,Y,N,X,k,j,q,U,I,R,D,Z,$,V,G,J,K,Q,te,ee=this;if(z=e.top,b=e.left,M=e.targetAttachment,!this.options.constraints)return!0;for(S=function(e){var n,o,i,s;for(ee.removeClass(e),s=[],o=0,i=t.length;i>o;o++)n=t[o],s.push(ee.removeClass(""+e+"-"+n));return s},Z=this.cache("element-bounds",function(){return s(ee.element)}),v=Z.height,F=Z.width,0===F&&0===v&&null!=this.lastSize&&($=this.lastSize,F=$.width,v=$.height),B=this.cache("target-bounds",function(){return ee.getTargetBounds()}),_=B.height,P=B.width,A={},m={},h=[this.getClass("pinned"),this.getClass("out-of-bounds")],V=this.options.constraints,W=0,X=V.length;X>W;W++)g=V[W],g.outOfBoundsClass&&h.push(g.outOfBoundsClass),g.pinnedClass&&h.push(g.pinnedClass);for(H=0,k=h.length;k>H;H++)for(d=h[H],G=["left","top","right","bottom"],Y=0,j=G.length;j>Y;Y++)E=G[Y],h.push(""+d+"-"+E);for(r=[],A=o({},M),m=o({},this.attachment),J=this.options.constraints,N=0,q=J.length;q>N;N++){if(g=J[N],L=g.to,a=g.attachment,T=g.pin,null==a&&(a=""),p.call(a," ")>=0?(K=a.split(" "),c=K[0],f=K[1]):f=c=a,u=i(this,L),("target"===c||"both"===c)&&(zu[3]&&"bottom"===A.top&&(z-=_,A.top="top")),"together"===c&&(zu[3]&&"bottom"===A.top&&("top"===m.top?(z-=_,A.top="top",z-=v,m.top="bottom"):"bottom"===m.top&&(z-=_,A.top="top",z+=v,m.top="top"))),("target"===f||"both"===f)&&(bu[2]&&"right"===A.left&&(b-=P,A.left="left")),"together"===f&&(bu[2]&&"right"===A.left&&("left"===m.left?(b-=P,A.left="left",b-=F,m.left="right"):"right"===m.left&&(b-=P,A.left="left",b+=F,m.left="left"))),("element"===c||"both"===c)&&(zu[3]&&"top"===m.top&&(z-=v,m.top="bottom")),("element"===f||"both"===f)&&(bu[2]&&"left"===m.left&&(b-=F,m.left="right")),"string"==typeof T?T=function(){var t,e,n,o;for(n=T.split(","),o=[],e=0,t=n.length;t>e;e++)C=n[e],o.push(C.trim());return o}():T===!0&&(T=["top","left","right","bottom"]),T||(T=[]),O=[],y=[],z=0?(z=u[1],O.push("top")):y.push("top")),z+v>u[3]&&(p.call(T,"bottom")>=0?(z=u[3]-v,O.push("bottom")):y.push("bottom")),b=0?(b=u[0],O.push("left")):y.push("left")),b+F>u[2]&&(p.call(T,"right")>=0?(b=u[2]-F,O.push("right")):y.push("right")),O.length)for(x=null!=(Q=this.options.pinnedClass)?Q:this.getClass("pinned"),r.push(x),R=0,U=O.length;U>R;R++)E=O[R],r.push(""+x+"-"+E);if(y.length)for(w=null!=(te=this.options.outOfBoundsClass)?te:this.getClass("out-of-bounds"),r.push(w),D=0,I=y.length;I>D;D++)E=y[D],r.push(""+w+"-"+E);(p.call(O,"left")>=0||p.call(O,"right")>=0)&&(m.left=A.left=!1),(p.call(O,"top")>=0||p.call(O,"bottom")>=0)&&(m.top=A.top=!1),(A.top!==M.top||A.left!==M.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,A)}return n(function(){return l(ee.target,r,h),l(ee.element,r,h)}),{top:z,left:b}}})}.call(this),function(){var t,e,n,o;o=Tether.Utils,e=o.getBounds,n=o.updateClasses,t=o.defer,Tether.modules.push({position:function(o){var i,s,r,h,l,a,p,u,f,c,d,g,m,v,b,y,w,C,T,O,x,S,E,A,M,_=this;if(d=o.top,a=o.left,x=this.cache("element-bounds",function(){return e(_.element)}),l=x.height,g=x.width,c=this.getTargetBounds(),h=d+l,p=a+g,i=[],d<=c.bottom&&h>=c.top)for(S=["left","right"],m=0,w=S.length;w>m;m++)u=S[m],((E=c[u])===a||E===p)&&i.push(u);if(a<=c.right&&p>=c.left)for(A=["top","bottom"],v=0,C=A.length;C>v;v++)u=A[v],((M=c[u])===d||M===h)&&i.push(u);for(r=[],s=[],f=["left","top","right","bottom"],r.push(this.getClass("abutted")),b=0,T=f.length;T>b;b++)u=f[b],r.push(""+this.getClass("abutted")+"-"+u);for(i.length&&s.push(this.getClass("abutted")),y=0,O=i.length;O>y;y++)u=i[y],s.push(""+this.getClass("abutted")+"-"+u);return t(function(){return n(_.target,s,r),n(_.element,s,r)}),!0}})}.call(this),function(){Tether.modules.push({position:function(t){var e,n,o,i,s,r,h;return r=t.top,e=t.left,this.options.shift?(n=function(t){return"function"==typeof t?t.call(this,{top:r,left:e}):t},o=n(this.options.shift),"string"==typeof o?(o=o.split(" "),o[1]||(o[1]=o[0]),s=o[0],i=o[1],s=parseFloat(s,10),i=parseFloat(i,10)):(h=[o.top,o.left],s=h[0],i=h[1]),r+=s,e+=i,{top:r,left:e}):void 0}})}.call(this),function(){var t,e,n,o,i,s,r,h,l,a,p,u,f,c,d=function(t,e){return function(){return t.apply(e,arguments)}},g={}.hasOwnProperty,m=function(t,e){function n(){this.constructor=t}for(var o in e)g.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};c=Tether.Utils,h=c.extend,u=c.removeClass,s=c.addClass,e=c.Evented,l=c.getBounds,f=c.uniqueId,t={top:"top center",left:"middle right",right:"middle left",bottom:"bottom center"},r=function(t){var e;return e=document.createElement("div"),e.innerHTML=t,e.children[0]},a=function(t,e){var n,o,i,s,r;return n=null!=(o=null!=(i=null!=(s=null!=(r=t.matches)?r:t.matchesSelector)?s:t.webkitMatchesSelector)?i:t.mozMatchesSelector)?o:t.oMatchesSelector,n.call(t,e)},p=function(t,e){var n,o,i,s,r,h;if(null==t)return t;if("object"==typeof t)return t;for(s=t.split(" "),s.length>e.length&&(s[0]=s.slice(0,+(s.length-e.length)+1||9e9).join(" "),s.splice(1,s.length-e.length)),o={},n=r=0,h=e.length;h>r;n=++r)i=e[n],o[i]=s[n];return o},o=function(e){function n(t,e){this.tour=t,this.destroy=d(this.destroy,this),this.scrollTo=d(this.scrollTo,this),this.complete=d(this.complete,this),this.cancel=d(this.cancel,this),this.isOpen=d(this.isOpen,this),this.hide=d(this.hide,this),this.show=d(this.show,this),this.setOptions(e)}return m(n,e),n.prototype.setOptions=function(t){var e,n,o,i;if(this.options=null!=t?t:{},this.destroy(),this.id=this.options.id||this.id||"step-"+f(),this.options.when){i=this.options.when;for(e in i)n=i[e],this.on(e,n,this)}return null!=(o=this.options).buttons?(o=this.options).buttons:o.buttons=[{text:"Next",action:this.tour.next}]},n.prototype.getTour=function(){return this.tour},n.prototype.bindAdvance=function(){var t,e,n,o,i=this;return o=p(this.options.advanceOn,["selector","event"]),t=o.event,n=o.selector,e=function(t){if(i.isOpen())if(null!=n){if(a(t.target,n))return i.tour.next()}else if(i.el&&t.target===i.el)return i.tour.next()},document.body.addEventListener(t,e),this.on("destroy",function(){return document.body.removeEventListener(t,e)})},n.prototype.getAttachTo=function(){var t;if(t=p(this.options.attachTo,["element","on"]),null==t&&(t={}),"string"==typeof t.element&&(t.element=document.querySelector(t.element),null==t.element))throw new Error("Shepherd step's attachTo was not found in the page");return t},n.prototype.setupTether=function(){var e,n,o;if("undefined"==typeof Tether||null===Tether)throw new Error("Using the attachment feature of Shepherd requires the Tether library");return n=this.getAttachTo(),e=t[n.on||"right"],null==n.element&&(n.element="viewport",e="middle center"),o={classPrefix:"shepherd",element:this.el,constraints:[{to:"window",pin:!0,attachment:"together"}],target:n.element,offset:n.offset||"0 0",attachment:e},this.tether=new Tether(h(o,this.options.tetherOptions))},n.prototype.show=function(){var t,e=this;return null==this.el&&this.render(),s(this.el,"shepherd-open"),null!=(t=this.tether)&&t.enable(),this.options.scrollTo&&setTimeout(function(){return e.scrollTo()}),this.trigger("show")},n.prototype.hide=function(){var t;return u(this.el,"shepherd-open"),null!=(t=this.tether)&&t.disable(),this.trigger("hide")},n.prototype.isOpen=function(){return hasClass(this.el,"shepherd-open")},n.prototype.cancel=function(){return this.hide(),this.trigger("cancel")},n.prototype.complete=function(){return this.hide(),this.trigger("complete")},n.prototype.scrollTo=function(){var t;return t=this.getAttachTo().element,null!=t?t.scrollIntoView():void 0},n.prototype.destroy=function(){var t;return null!=this.el&&(document.body.removeChild(this.el),delete this.el),null!=(t=this.tether)&&t.destroy(),this.trigger("destroy")},n.prototype.render=function(){var t,e,n,o,i,s,h,l,a,p,u,f,c,d,g,m;if(null!=this.el&&this.destroy(),this.el=r(""),o=document.createElement("div"),o.className="shepherd-content",this.el.appendChild(o),null!=this.options.title&&(s=document.createElement("header"),s.innerHTML=""+this.options.title+"
",this.el.className+=" shepherd-has-title",o.appendChild(s)),null!=this.options.text){for(a=r(""),l=this.options.text,"string"==typeof l&&(l=[l]),p=0,f=l.length;f>p;p++)h=l[p],a.innerHTML+=""+h+"
";o.appendChild(a)}if(i=document.createElement("footer"),this.options.buttons){for(e=r(""),g=this.options.buttons,u=0,c=g.length;c>u;u++)n=g[u],t=r(""+n.text+""),e.appendChild(t),this.bindButtonEvents(n,t.querySelector("a"));i.appendChild(e)}return o.appendChild(i),document.body.appendChild(this.el),this.setupTether(),this.options.advanceOn?this.bindAdvance():void 0},n.prototype.bindButtonEvents=function(t,e){var n,o,i,s,r=this;null==t.events&&(t.events={}),null!=t.action&&(t.events.click=t.action),s=t.events;for(n in s)o=s[n],"string"==typeof o&&(i=o,o=function(){return r.tour.show(i)}),e.addEventListener(n,o);return this.on("destroy",function(){var i,s;i=t.events,s=[];for(n in i)o=i[n],s.push(e.removeEventListener(n,o));return s})},n}(e),i=function(t){function e(t){var e,o,i,s,r,h=this;for(this.options=null!=t?t:{},this.hide=d(this.hide,this),this.cancel=d(this.cancel,this),this.back=d(this.back,this),this.next=d(this.next,this),this.steps=null!=(s=this.options.steps)?s:[],r=["complete","cancel","hide","start","show"],o=0,i=r.length;i>o;o++)e=r[o],this.on(e,function(t){return null==t&&(t={}),t.tour=h,n.trigger(e,t)})}return m(e,t),e.prototype.addStep=function(t,e){var n;return null==e&&(e=t),e instanceof o?e.tour=this:(("string"==(n=typeof t)||"number"===n)&&(e.id=t.toString()),e=h({},this.options.defaults,e),e=new o(this,e)),this.steps.push(e),e},e.prototype.getById=function(t){var e,n,o,i;for(i=this.steps,n=0,o=i.length;o>n;n++)if(e=i[n],e.id===t)return e},e.prototype.getCurrentStep=function(){return this.currentStep},e.prototype.next=function(){var t;return t=this.steps.indexOf(this.currentStep),t===this.steps.length-1?(this.hide(t),this.trigger("complete"),this.done()):this.show(t+1)},e.prototype.back=function(){var t;return t=this.steps.indexOf(this.currentStep),this.show(t-1)},e.prototype.cancel=function(){var t;return null!=(t=this.currentStep)&&t.cancel(),this.trigger("cancel"),this.done()},e.prototype.hide=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("hide"),this.done()},e.prototype.done=function(){return n.activeTour=null},e.prototype.show=function(t){var e;return null==t&&(t=0),this.currentStep&&this.currentStep.hide(),n.activeTour=this,e="string"==typeof t?this.getById(t):this.steps[t],e?(this.trigger("show",{step:e,previous:this.currentStep}),this.currentStep=e,e.show()):void 0},e.prototype.start=function(){return this.trigger("start"),this.currentStep=null,this.next()},e}(e),n=new e,h(n,{Tour:i,Step:o,Evented:e}),window.Shepherd=n}.call(this);
\ No newline at end of file
diff --git a/ajax/libs/shepherd/0.4.2/shepherd.js b/ajax/libs/shepherd/0.4.2/shepherd.js
new file mode 100644
index 000000000..86e1a2ca2
--- /dev/null
+++ b/ajax/libs/shepherd/0.4.2/shepherd.js
@@ -0,0 +1,1801 @@
+/*! shepherd 0.4.2 */
+/*! tether 0.5.0 */
+(function() {
+ var Evented, addClass, defer, deferred, extend, flush, getBounds, getOffsetParent, getOrigin, getScrollParent, hasClass, node, removeClass, uniqueId, updateClasses, zeroPosCache,
+ __hasProp = {}.hasOwnProperty,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
+ __slice = [].slice;
+
+ if (window.Tether == null) {
+ window.Tether = {};
+ }
+
+ getScrollParent = function(el) {
+ var parent, position, scrollParent, style, _ref;
+ position = getComputedStyle(el).position;
+ if (position === 'fixed') {
+ return el;
+ }
+ scrollParent = void 0;
+ parent = el;
+ while (parent = parent.parentNode) {
+ try {
+ style = getComputedStyle(parent);
+ } catch (_error) {}
+ if (style == null) {
+ return parent;
+ }
+ if (/(auto|scroll)/.test(style['overflow'] + style['overflow-y'] + style['overflow-x'])) {
+ if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) {
+ return parent;
+ }
+ }
+ }
+ return document.body;
+ };
+
+ uniqueId = (function() {
+ var id;
+ id = 0;
+ return function() {
+ return id++;
+ };
+ })();
+
+ zeroPosCache = {};
+
+ getOrigin = function(doc) {
+ var id, k, node, v, _ref;
+ node = doc._tetherZeroElement;
+ if (node == null) {
+ node = doc.createElement('div');
+ node.setAttribute('data-tether-id', uniqueId());
+ extend(node.style, {
+ top: 0,
+ left: 0,
+ position: 'absolute'
+ });
+ doc.body.appendChild(node);
+ doc._tetherZeroElement = node;
+ }
+ id = node.getAttribute('data-tether-id');
+ if (zeroPosCache[id] == null) {
+ zeroPosCache[id] = {};
+ _ref = node.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ zeroPosCache[id][k] = v;
+ }
+ defer(function() {
+ return zeroPosCache[id] = void 0;
+ });
+ }
+ return zeroPosCache[id];
+ };
+
+ node = null;
+
+ getBounds = function(el) {
+ var box, doc, docEl, k, origin, v, _ref;
+ if (el === document) {
+ doc = document;
+ el = document.documentElement;
+ } else {
+ doc = el.ownerDocument;
+ }
+ docEl = doc.documentElement;
+ box = {};
+ _ref = el.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ box[k] = v;
+ }
+ origin = getOrigin(doc);
+ box.top -= origin.top;
+ box.left -= origin.left;
+ if (box.width == null) {
+ box.width = document.body.scrollWidth - box.left - box.right;
+ }
+ if (box.height == null) {
+ box.height = document.body.scrollHeight - box.top - box.bottom;
+ }
+ box.top = box.top - docEl.clientTop;
+ box.left = box.left - docEl.clientLeft;
+ box.right = doc.body.clientWidth - box.width - box.left;
+ box.bottom = doc.body.clientHeight - box.height - box.top;
+ return box;
+ };
+
+ getOffsetParent = function(el) {
+ return el.offsetParent || document.documentElement;
+ };
+
+ extend = function(out) {
+ var args, key, obj, val, _i, _len, _ref;
+ if (out == null) {
+ out = {};
+ }
+ args = [];
+ Array.prototype.push.apply(args, arguments);
+ _ref = args.slice(1);
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ obj = _ref[_i];
+ if (obj) {
+ for (key in obj) {
+ if (!__hasProp.call(obj, key)) continue;
+ val = obj[key];
+ out[key] = val;
+ }
+ }
+ }
+ return out;
+ };
+
+ removeClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ _results.push(el.classList.remove(cls));
+ }
+ return _results;
+ } else {
+ return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' ');
+ }
+ };
+
+ addClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ _results.push(el.classList.add(cls));
+ }
+ return _results;
+ } else {
+ removeClass(el, name);
+ return el.className += " " + name;
+ }
+ };
+
+ hasClass = function(el, name) {
+ if (el.classList != null) {
+ return el.classList.contains(name);
+ } else {
+ return new RegExp("(^| )" + name + "( |$)", 'gi').test(el.className);
+ }
+ };
+
+ updateClasses = function(el, add, all) {
+ var cls, _i, _j, _len, _len1, _results;
+ for (_i = 0, _len = all.length; _i < _len; _i++) {
+ cls = all[_i];
+ if (__indexOf.call(add, cls) < 0) {
+ if (hasClass(el, cls)) {
+ removeClass(el, cls);
+ }
+ }
+ }
+ _results = [];
+ for (_j = 0, _len1 = add.length; _j < _len1; _j++) {
+ cls = add[_j];
+ if (!hasClass(el, cls)) {
+ _results.push(addClass(el, cls));
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ deferred = [];
+
+ defer = function(fn) {
+ return deferred.push(fn);
+ };
+
+ flush = function() {
+ var fn, _results;
+ _results = [];
+ while (fn = deferred.pop()) {
+ _results.push(fn());
+ }
+ return _results;
+ };
+
+ Evented = (function() {
+ function Evented() {}
+
+ Evented.prototype.on = function(event, handler, ctx, once) {
+ var _base;
+ if (once == null) {
+ once = false;
+ }
+ if (this.bindings == null) {
+ this.bindings = {};
+ }
+ if ((_base = this.bindings)[event] == null) {
+ _base[event] = [];
+ }
+ return this.bindings[event].push({
+ handler: handler,
+ ctx: ctx,
+ once: once
+ });
+ };
+
+ Evented.prototype.once = function(event, handler, ctx) {
+ return this.on(event, handler, ctx, true);
+ };
+
+ Evented.prototype.off = function(event, handler) {
+ var i, _ref, _results;
+ if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
+ return;
+ }
+ if (handler == null) {
+ return delete this.bindings[event];
+ } else {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ if (this.bindings[event][i].handler === handler) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ Evented.prototype.trigger = function() {
+ var args, ctx, event, handler, i, once, _ref, _ref1, _results;
+ event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+ if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
+ handler.apply(ctx != null ? ctx : this, args);
+ if (once) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ return Evented;
+
+ })();
+
+ Tether.Utils = {
+ getScrollParent: getScrollParent,
+ getBounds: getBounds,
+ getOffsetParent: getOffsetParent,
+ extend: extend,
+ addClass: addClass,
+ removeClass: removeClass,
+ hasClass: hasClass,
+ updateClasses: updateClasses,
+ defer: defer,
+ flush: flush,
+ uniqueId: uniqueId,
+ Evented: Evented
+ };
+
+}).call(this);
+
+(function() {
+ var MIRROR_LR, MIRROR_TB, OFFSET_MAP, addClass, addOffset, attachmentToOffset, autoToFixedAttachment, defer, extend, flush, getBounds, getOffsetParent, getOuterSize, getScrollParent, getSize, now, offsetToPx, parseAttachment, parseOffset, position, removeClass, tethers, transformKey, updateClasses, within, _Tether, _ref,
+ __slice = [].slice,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("You must include the utils.js file before tether.js");
+ }
+
+ _ref = Tether.Utils, getScrollParent = _ref.getScrollParent, getSize = _ref.getSize, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getOffsetParent = _ref.getOffsetParent, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, updateClasses = _ref.updateClasses, defer = _ref.defer, flush = _ref.flush;
+
+ within = function(a, b, diff) {
+ if (diff == null) {
+ diff = 1;
+ }
+ return (a + diff >= b && b >= a - diff);
+ };
+
+ transformKey = (function() {
+ var el, key, _i, _len, _ref1;
+ el = document.createElement('div');
+ _ref1 = ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ key = _ref1[_i];
+ if (el.style[key] !== void 0) {
+ return key;
+ }
+ }
+ })();
+
+ tethers = [];
+
+ position = function() {
+ var tether, _i, _len;
+ for (_i = 0, _len = tethers.length; _i < _len; _i++) {
+ tether = tethers[_i];
+ tether.position(false);
+ }
+ return flush();
+ };
+
+ now = function() {
+ var _ref1;
+ return (_ref1 = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref1 : +(new Date);
+ };
+
+ (function() {
+ var event, lastCall, lastDuration, pendingTimeout, tick, _i, _len, _ref1, _results;
+ lastCall = null;
+ lastDuration = null;
+ pendingTimeout = null;
+ tick = function() {
+ if ((lastDuration != null) && lastDuration > 16) {
+ lastDuration = Math.min(lastDuration - 16, 250);
+ pendingTimeout = setTimeout(tick, 250);
+ return;
+ }
+ if ((lastCall != null) && (now() - lastCall) < 10) {
+ return;
+ }
+ if (pendingTimeout != null) {
+ clearTimeout(pendingTimeout);
+ pendingTimeout = null;
+ }
+ lastCall = now();
+ position();
+ return lastDuration = now() - lastCall;
+ };
+ _ref1 = ['resize', 'scroll', 'touchmove'];
+ _results = [];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ event = _ref1[_i];
+ _results.push(window.addEventListener(event, tick));
+ }
+ return _results;
+ })();
+
+ MIRROR_LR = {
+ center: 'center',
+ left: 'right',
+ right: 'left'
+ };
+
+ MIRROR_TB = {
+ middle: 'middle',
+ top: 'bottom',
+ bottom: 'top'
+ };
+
+ OFFSET_MAP = {
+ top: 0,
+ left: 0,
+ middle: '50%',
+ center: '50%',
+ bottom: '100%',
+ right: '100%'
+ };
+
+ autoToFixedAttachment = function(attachment, relativeToAttachment) {
+ var left, top;
+ left = attachment.left, top = attachment.top;
+ if (left === 'auto') {
+ left = MIRROR_LR[relativeToAttachment.left];
+ }
+ if (top === 'auto') {
+ top = MIRROR_TB[relativeToAttachment.top];
+ }
+ return {
+ left: left,
+ top: top
+ };
+ };
+
+ attachmentToOffset = function(attachment) {
+ var _ref1, _ref2;
+ return {
+ left: (_ref1 = OFFSET_MAP[attachment.left]) != null ? _ref1 : attachment.left,
+ top: (_ref2 = OFFSET_MAP[attachment.top]) != null ? _ref2 : attachment.top
+ };
+ };
+
+ addOffset = function() {
+ var left, offsets, out, top, _i, _len, _ref1;
+ offsets = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ out = {
+ top: 0,
+ left: 0
+ };
+ for (_i = 0, _len = offsets.length; _i < _len; _i++) {
+ _ref1 = offsets[_i], top = _ref1.top, left = _ref1.left;
+ if (typeof top === 'string') {
+ top = parseFloat(top, 10);
+ }
+ if (typeof left === 'string') {
+ left = parseFloat(left, 10);
+ }
+ out.top += top;
+ out.left += left;
+ }
+ return out;
+ };
+
+ offsetToPx = function(offset, size) {
+ if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
+ offset.left = parseFloat(offset.left, 10) / 100 * size.width;
+ }
+ if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
+ offset.top = parseFloat(offset.top, 10) / 100 * size.height;
+ }
+ return offset;
+ };
+
+ parseAttachment = parseOffset = function(value) {
+ var left, top, _ref1;
+ _ref1 = value.split(' '), top = _ref1[0], left = _ref1[1];
+ return {
+ top: top,
+ left: left
+ };
+ };
+
+ _Tether = (function() {
+ _Tether.modules = [];
+
+ function _Tether(options) {
+ this.position = __bind(this.position, this);
+ var module, _i, _len, _ref1, _ref2;
+ tethers.push(this);
+ this.history = [];
+ this.setOptions(options, false);
+ _ref1 = Tether.modules;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ module = _ref1[_i];
+ if ((_ref2 = module.initialize) != null) {
+ _ref2.call(this);
+ }
+ }
+ this.position();
+ }
+
+ _Tether.prototype.getClass = function(key) {
+ var _ref1, _ref2;
+ if ((_ref1 = this.options.classes) != null ? _ref1[key] : void 0) {
+ return this.options.classes[key];
+ } else if (((_ref2 = this.options.classes) != null ? _ref2[key] : void 0) !== false) {
+ if (this.options.classPrefix) {
+ return "" + this.options.classPrefix + "-" + key;
+ } else {
+ return key;
+ }
+ } else {
+ return '';
+ }
+ };
+
+ _Tether.prototype.setOptions = function(options, position) {
+ var defaults, key, _i, _len, _ref1, _ref2;
+ this.options = options;
+ if (position == null) {
+ position = true;
+ }
+ defaults = {
+ offset: '0 0',
+ targetOffset: '0 0',
+ targetAttachment: 'auto auto',
+ classPrefix: 'tether'
+ };
+ this.options = extend(defaults, this.options);
+ _ref1 = this.options, this.element = _ref1.element, this.target = _ref1.target, this.targetModifier = _ref1.targetModifier;
+ if (this.target === 'viewport') {
+ this.target = document.body;
+ this.targetModifier = 'visible';
+ } else if (this.target === 'scroll-handle') {
+ this.target = document.body;
+ this.targetModifier = 'scroll-handle';
+ }
+ _ref2 = ['element', 'target'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ key = _ref2[_i];
+ if (this[key] == null) {
+ throw new Error("Tether Error: Both element and target must be defined");
+ }
+ if (this[key].jquery != null) {
+ this[key] = this[key][0];
+ } else if (typeof this[key] === 'string') {
+ this[key] = document.querySelector(this[key]);
+ }
+ }
+ addClass(this.element, this.getClass('element'));
+ addClass(this.target, this.getClass('target'));
+ if (!this.options.attachment) {
+ throw new Error("Tether Error: You must provide an attachment");
+ }
+ this.targetAttachment = parseAttachment(this.options.targetAttachment);
+ this.attachment = parseAttachment(this.options.attachment);
+ this.offset = parseOffset(this.options.offset);
+ this.targetOffset = parseOffset(this.options.targetOffset);
+ if (this.scrollParent != null) {
+ this.disable();
+ }
+ if (this.targetModifier === 'scroll-handle') {
+ this.scrollParent = this.target;
+ } else {
+ this.scrollParent = getScrollParent(this.target);
+ }
+ if (this.options.enabled !== false) {
+ return this.enable(position);
+ }
+ };
+
+ _Tether.prototype.getTargetBounds = function() {
+ var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target;
+ if (this.targetModifier != null) {
+ switch (this.targetModifier) {
+ case 'visible':
+ if (this.target === document.body) {
+ return {
+ top: pageYOffset,
+ left: pageXOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(this.target);
+ out = {
+ height: bounds.height,
+ width: bounds.width,
+ top: bounds.top,
+ left: bounds.left
+ };
+ out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
+ out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight)));
+ out.height = Math.min(innerHeight, out.height);
+ out.height -= 2;
+ out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
+ out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth)));
+ out.width = Math.min(innerWidth, out.width);
+ out.width -= 2;
+ if (out.top < pageYOffset) {
+ out.top = pageYOffset;
+ }
+ if (out.left < pageXOffset) {
+ out.left = pageXOffset;
+ }
+ return out;
+ }
+ break;
+ case 'scroll-handle':
+ target = this.target;
+ if (target === document.body) {
+ target = document.documentElement;
+ bounds = {
+ left: pageXOffset,
+ top: pageYOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(target);
+ }
+ style = getComputedStyle(target);
+ hasBottomScroll = target.scrollWidth > target.clientWidth || 'scroll' === [style.overflow, style.overflowX] || this.target !== document.body;
+ scrollBottom = 0;
+ if (hasBottomScroll) {
+ scrollBottom = 15;
+ }
+ height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
+ out = {
+ width: 15,
+ height: height * 0.975 * (height / target.scrollHeight),
+ left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
+ };
+ fitAdj = 0;
+ if (height < 408 && this.target === document.body) {
+ fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
+ }
+ if (this.target !== document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ scrollPercentage = target.scrollTop / (target.scrollHeight - height);
+ out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
+ if (this.target === document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ return out;
+ }
+ } else {
+ return getBounds(this.target);
+ }
+ };
+
+ _Tether.prototype.clearCache = function() {
+ return this._cache = {};
+ };
+
+ _Tether.prototype.cache = function(k, getter) {
+ if (this._cache == null) {
+ this._cache = {};
+ }
+ if (this._cache[k] == null) {
+ this._cache[k] = getter.call(this);
+ }
+ return this._cache[k];
+ };
+
+ _Tether.prototype.enable = function(position) {
+ if (position == null) {
+ position = true;
+ }
+ addClass(this.target, this.getClass('enabled'));
+ addClass(this.element, this.getClass('enabled'));
+ this.enabled = true;
+ if (this.scrollParent !== document) {
+ this.scrollParent.addEventListener('scroll', this.position);
+ }
+ if (position) {
+ return this.position();
+ }
+ };
+
+ _Tether.prototype.disable = function() {
+ removeClass(this.target, this.getClass('enabled'));
+ removeClass(this.element, this.getClass('enabled'));
+ this.enabled = false;
+ if (this.scrollParent != null) {
+ return this.scrollParent.removeEventListener('scroll', this.position);
+ }
+ };
+
+ _Tether.prototype.destroy = function() {
+ var i, tether, _i, _len, _results;
+ this.disable();
+ _results = [];
+ for (i = _i = 0, _len = tethers.length; _i < _len; i = ++_i) {
+ tether = tethers[i];
+ if (tether === this) {
+ tethers.splice(i, 1);
+ break;
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ _Tether.prototype.updateAttachClasses = function(elementAttach, targetAttach) {
+ var add, all, side, sides, _i, _j, _len, _len1, _ref1,
+ _this = this;
+ if (elementAttach == null) {
+ elementAttach = this.attachment;
+ }
+ if (targetAttach == null) {
+ targetAttach = this.targetAttachment;
+ }
+ sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
+ if ((_ref1 = this._addAttachClasses) != null ? _ref1.length : void 0) {
+ this._addAttachClasses.splice(0, this._addAttachClasses.length);
+ }
+ add = this._addAttachClasses != null ? this._addAttachClasses : this._addAttachClasses = [];
+ if (elementAttach.top) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.top);
+ }
+ if (elementAttach.left) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.left);
+ }
+ if (targetAttach.top) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.top);
+ }
+ if (targetAttach.left) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.left);
+ }
+ all = [];
+ for (_i = 0, _len = sides.length; _i < _len; _i++) {
+ side = sides[_i];
+ all.push("" + (this.getClass('element-attached')) + "-" + side);
+ }
+ for (_j = 0, _len1 = sides.length; _j < _len1; _j++) {
+ side = sides[_j];
+ all.push("" + (this.getClass('target-attached')) + "-" + side);
+ }
+ return defer(function() {
+ if (_this._addAttachClasses == null) {
+ return;
+ }
+ updateClasses(_this.element, _this._addAttachClasses, all);
+ updateClasses(_this.target, _this._addAttachClasses, all);
+ return _this._addAttachClasses = void 0;
+ });
+ };
+
+ _Tether.prototype.position = function(flushChanges) {
+ var elementPos, elementStyle, height, left, manualOffset, manualTargetOffset, module, next, offset, offsetBorder, offsetParent, offsetParentSize, offsetParentStyle, offsetPosition, ret, scrollLeft, scrollTop, side, targetAttachment, targetOffset, targetPos, targetSize, top, width, _i, _j, _len, _len1, _ref1, _ref2, _ref3, _ref4,
+ _this = this;
+ if (flushChanges == null) {
+ flushChanges = true;
+ }
+ if (!this.enabled) {
+ return;
+ }
+ this.clearCache();
+ targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
+ this.updateAttachClasses(this.attachment, targetAttachment);
+ elementPos = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ });
+ width = elementPos.width, height = elementPos.height;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref1 = this.lastSize, width = _ref1.width, height = _ref1.height;
+ } else {
+ this.lastSize = {
+ width: width,
+ height: height
+ };
+ }
+ targetSize = targetPos = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ offset = offsetToPx(attachmentToOffset(this.attachment), {
+ width: width,
+ height: height
+ });
+ targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
+ manualOffset = offsetToPx(this.offset, {
+ width: width,
+ height: height
+ });
+ manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
+ offset = addOffset(offset, manualOffset);
+ targetOffset = addOffset(targetOffset, manualTargetOffset);
+ left = targetPos.left + targetOffset.left - offset.left;
+ top = targetPos.top + targetOffset.top - offset.top;
+ _ref2 = Tether.modules;
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ module = _ref2[_i];
+ ret = module.position.call(this, {
+ left: left,
+ top: top,
+ targetAttachment: targetAttachment,
+ targetPos: targetPos,
+ elementPos: elementPos,
+ offset: offset,
+ targetOffset: targetOffset,
+ manualOffset: manualOffset,
+ manualTargetOffset: manualTargetOffset
+ });
+ if ((ret == null) || typeof ret !== 'object') {
+ continue;
+ } else if (ret === false) {
+ return false;
+ } else {
+ top = ret.top, left = ret.left;
+ }
+ }
+ next = {
+ page: {
+ top: top,
+ bottom: document.body.scrollHeight - top - height,
+ left: left,
+ right: document.body.scrollWidth - left - width
+ },
+ viewport: {
+ top: top - pageYOffset,
+ bottom: pageYOffset - top - height + innerHeight,
+ left: left - pageXOffset,
+ right: pageXOffset - left - width + innerWidth
+ }
+ };
+ if (((_ref3 = this.options.optimizations) != null ? _ref3.moveElement : void 0) !== false && (this.targetModifier == null)) {
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ offsetPosition = this.cache('target-offsetparent-bounds', function() {
+ return getBounds(offsetParent);
+ });
+ offsetParentStyle = getComputedStyle(offsetParent);
+ elementStyle = getComputedStyle(this.element);
+ offsetParentSize = offsetPosition;
+ offsetBorder = {};
+ _ref4 = ['Top', 'Left', 'Bottom', 'Right'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ offsetBorder[side] = parseFloat(offsetParentStyle["border" + side + "Width"]);
+ }
+ offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
+ offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
+ if (next.page.top >= (offsetPosition.top + offsetBorder.top) && next.page.bottom >= offsetPosition.bottom) {
+ if (next.page.left >= (offsetPosition.left + offsetBorder.left) && next.page.right >= offsetPosition.right) {
+ scrollTop = offsetParent.scrollTop;
+ scrollLeft = offsetParent.scrollLeft;
+ next.offset = {
+ top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
+ left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
+ };
+ }
+ }
+ }
+ this.move(next);
+ this.history.unshift(next);
+ if (this.history.length > 3) {
+ this.history.pop();
+ }
+ if (flushChanges) {
+ flush();
+ }
+ return true;
+ };
+
+ _Tether.prototype.move = function(position) {
+ var css, elVal, found, key, moved, offsetParent, point, same, transcribe, type, val, write, writeCSS, _i, _len, _ref1, _ref2,
+ _this = this;
+ if (this.element.parentNode == null) {
+ return;
+ }
+ same = {};
+ for (type in position) {
+ same[type] = {};
+ for (key in position[type]) {
+ found = false;
+ _ref1 = this.history;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ point = _ref1[_i];
+ if (!within((_ref2 = point[type]) != null ? _ref2[key] : void 0, position[type][key])) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ same[type][key] = true;
+ }
+ }
+ }
+ css = {
+ top: '',
+ left: '',
+ right: '',
+ bottom: ''
+ };
+ transcribe = function(same, pos) {
+ var xPos, yPos, _ref3;
+ if (((_ref3 = _this.options.optimizations) != null ? _ref3.gpu : void 0) !== false) {
+ if (same.top) {
+ css.top = 0;
+ yPos = pos.top;
+ } else {
+ css.bottom = 0;
+ yPos = -pos.bottom;
+ }
+ if (same.left) {
+ css.left = 0;
+ xPos = pos.left;
+ } else {
+ css.right = 0;
+ xPos = -pos.right;
+ }
+ css[transformKey] = "translateX(" + (Math.round(xPos)) + "px) translateY(" + (Math.round(yPos)) + "px)";
+ if (transformKey !== 'msTransform') {
+ return css[transformKey] += " translateZ(0)";
+ }
+ } else {
+ if (same.top) {
+ css.top = "" + pos.top + "px";
+ } else {
+ css.bottom = "" + pos.bottom + "px";
+ }
+ if (same.left) {
+ return css.left = "" + pos.left + "px";
+ } else {
+ return css.right = "" + pos.right + "px";
+ }
+ }
+ };
+ moved = false;
+ if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
+ css.position = 'absolute';
+ transcribe(same.page, position.page);
+ } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
+ css.position = 'fixed';
+ transcribe(same.viewport, position.viewport);
+ } else if ((same.offset != null) && same.offset.top && same.offset.left) {
+ css.position = 'absolute';
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ if (getOffsetParent(this.element) !== offsetParent) {
+ defer(function() {
+ _this.element.parentNode.removeChild(_this.element);
+ return offsetParent.appendChild(_this.element);
+ });
+ }
+ transcribe(same.offset, position.offset);
+ moved = true;
+ } else {
+ css.position = 'absolute';
+ transcribe({
+ top: true,
+ left: true
+ }, position.page);
+ }
+ if (!moved && this.element.parentNode.tagName !== 'BODY') {
+ this.element.parentNode.removeChild(this.element);
+ document.body.appendChild(this.element);
+ }
+ writeCSS = {};
+ write = false;
+ for (key in css) {
+ val = css[key];
+ elVal = this.element.style[key];
+ if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) {
+ elVal = parseFloat(elVal);
+ val = parseFloat(val);
+ }
+ if (elVal !== val) {
+ write = true;
+ writeCSS[key] = css[key];
+ }
+ }
+ if (write) {
+ return defer(function() {
+ return extend(_this.element.style, writeCSS);
+ });
+ }
+ };
+
+ return _Tether;
+
+ })();
+
+ Tether.position = position;
+
+ window.Tether = extend(_Tether, Tether);
+
+}).call(this);
+
+(function() {
+ var BOUNDS_FORMAT, MIRROR_ATTACH, defer, extend, getBoundingRect, getBounds, getOuterSize, getSize, updateClasses, _ref,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+
+ _ref = Tether.Utils, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getSize = _ref.getSize, extend = _ref.extend, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ MIRROR_ATTACH = {
+ left: 'right',
+ right: 'left',
+ top: 'bottom',
+ bottom: 'top',
+ middle: 'middle'
+ };
+
+ BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
+
+ getBoundingRect = function(tether, to) {
+ var i, pos, side, size, style, _i, _len;
+ if (to === 'scrollParent') {
+ to = tether.scrollParent;
+ } else if (to === 'window') {
+ to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
+ }
+ if (to === document) {
+ to = to.documentElement;
+ }
+ if (to.nodeType != null) {
+ pos = size = getBounds(to);
+ style = getComputedStyle(to);
+ to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
+ for (i = _i = 0, _len = BOUNDS_FORMAT.length; _i < _len; i = ++_i) {
+ side = BOUNDS_FORMAT[i];
+ side = side[0].toUpperCase() + side.substr(1);
+ if (side === 'Top' || side === 'Left') {
+ to[i] += parseFloat(style["border" + side + "Width"]);
+ } else {
+ to[i] -= parseFloat(style["border" + side + "Width"]);
+ }
+ }
+ }
+ return to;
+ };
+
+ Tether.modules.push({
+ position: function(_arg) {
+ var addClasses, allClasses, attachment, bounds, changeAttachX, changeAttachY, cls, constraint, eAttachment, height, left, oob, oobClass, p, pin, pinned, pinnedClass, removeClass, side, tAttachment, targetAttachment, targetHeight, targetSize, targetWidth, to, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8,
+ _this = this;
+ top = _arg.top, left = _arg.left, targetAttachment = _arg.targetAttachment;
+ if (!this.options.constraints) {
+ return true;
+ }
+ removeClass = function(prefix) {
+ var side, _i, _len, _results;
+ _this.removeClass(prefix);
+ _results = [];
+ for (_i = 0, _len = BOUNDS_FORMAT.length; _i < _len; _i++) {
+ side = BOUNDS_FORMAT[_i];
+ _results.push(_this.removeClass("" + prefix + "-" + side));
+ }
+ return _results;
+ };
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref2 = this.lastSize, width = _ref2.width, height = _ref2.height;
+ }
+ targetSize = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ targetHeight = targetSize.height;
+ targetWidth = targetSize.width;
+ tAttachment = {};
+ eAttachment = {};
+ allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
+ _ref3 = this.options.constraints;
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ constraint = _ref3[_i];
+ if (constraint.outOfBoundsClass) {
+ allClasses.push(constraint.outOfBoundsClass);
+ }
+ if (constraint.pinnedClass) {
+ allClasses.push(constraint.pinnedClass);
+ }
+ }
+ for (_j = 0, _len1 = allClasses.length; _j < _len1; _j++) {
+ cls = allClasses[_j];
+ _ref4 = ['left', 'top', 'right', 'bottom'];
+ for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
+ side = _ref4[_k];
+ allClasses.push("" + cls + "-" + side);
+ }
+ }
+ addClasses = [];
+ tAttachment = extend({}, targetAttachment);
+ eAttachment = extend({}, this.attachment);
+ _ref5 = this.options.constraints;
+ for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) {
+ constraint = _ref5[_l];
+ to = constraint.to, attachment = constraint.attachment, pin = constraint.pin;
+ if (attachment == null) {
+ attachment = '';
+ }
+ if (__indexOf.call(attachment, ' ') >= 0) {
+ _ref6 = attachment.split(' '), changeAttachY = _ref6[0], changeAttachX = _ref6[1];
+ } else {
+ changeAttachX = changeAttachY = attachment;
+ }
+ bounds = getBoundingRect(this, to);
+ if (changeAttachY === 'target' || changeAttachY === 'both') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ }
+ }
+ if (changeAttachY === 'together') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ if (eAttachment.top === 'bottom') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top += height;
+ eAttachment.top = 'top';
+ } else if (eAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ if (eAttachment.top === 'top') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (eAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ }
+ if (changeAttachX === 'target' || changeAttachX === 'both') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ }
+ if (left + width > bounds[2] && tAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ }
+ }
+ if (changeAttachX === 'together') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ if (eAttachment.left === 'right') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left += width;
+ eAttachment.left = 'left';
+ } else if (eAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ } else if (left + width > bounds[2] && tAttachment.left === 'right') {
+ if (eAttachment.left === 'left') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (eAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left += width;
+ eAttachment.left = 'left';
+ }
+ }
+ }
+ if (changeAttachY === 'element' || changeAttachY === 'both') {
+ if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (changeAttachX === 'element' || changeAttachX === 'both') {
+ if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ }
+ if (typeof pin === 'string') {
+ pin = (function() {
+ var _len4, _m, _ref7, _results;
+ _ref7 = pin.split(',');
+ _results = [];
+ for (_m = 0, _len4 = _ref7.length; _m < _len4; _m++) {
+ p = _ref7[_m];
+ _results.push(p.trim());
+ }
+ return _results;
+ })();
+ } else if (pin === true) {
+ pin = ['top', 'left', 'right', 'bottom'];
+ }
+ pin || (pin = []);
+ pinned = [];
+ oob = [];
+ if (top < bounds[1]) {
+ if (__indexOf.call(pin, 'top') >= 0) {
+ top = bounds[1];
+ pinned.push('top');
+ } else {
+ oob.push('top');
+ }
+ }
+ if (top + height > bounds[3]) {
+ if (__indexOf.call(pin, 'bottom') >= 0) {
+ top = bounds[3] - height;
+ pinned.push('bottom');
+ } else {
+ oob.push('bottom');
+ }
+ }
+ if (left < bounds[0]) {
+ if (__indexOf.call(pin, 'left') >= 0) {
+ left = bounds[0];
+ pinned.push('left');
+ } else {
+ oob.push('left');
+ }
+ }
+ if (left + width > bounds[2]) {
+ if (__indexOf.call(pin, 'right') >= 0) {
+ left = bounds[2] - width;
+ pinned.push('right');
+ } else {
+ oob.push('right');
+ }
+ }
+ if (pinned.length) {
+ pinnedClass = (_ref7 = this.options.pinnedClass) != null ? _ref7 : this.getClass('pinned');
+ addClasses.push(pinnedClass);
+ for (_m = 0, _len4 = pinned.length; _m < _len4; _m++) {
+ side = pinned[_m];
+ addClasses.push("" + pinnedClass + "-" + side);
+ }
+ }
+ if (oob.length) {
+ oobClass = (_ref8 = this.options.outOfBoundsClass) != null ? _ref8 : this.getClass('out-of-bounds');
+ addClasses.push(oobClass);
+ for (_n = 0, _len5 = oob.length; _n < _len5; _n++) {
+ side = oob[_n];
+ addClasses.push("" + oobClass + "-" + side);
+ }
+ }
+ if (__indexOf.call(pinned, 'left') >= 0 || __indexOf.call(pinned, 'right') >= 0) {
+ eAttachment.left = tAttachment.left = false;
+ }
+ if (__indexOf.call(pinned, 'top') >= 0 || __indexOf.call(pinned, 'bottom') >= 0) {
+ eAttachment.top = tAttachment.top = false;
+ }
+ if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== this.attachment.top || eAttachment.left !== this.attachment.left) {
+ this.updateAttachClasses(eAttachment, tAttachment);
+ }
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+(function() {
+ var defer, getBounds, updateClasses, _ref;
+
+ _ref = Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ Tether.modules.push({
+ position: function(_arg) {
+ var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5,
+ _this = this;
+ top = _arg.top, left = _arg.left;
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ targetPos = this.getTargetBounds();
+ bottom = top + height;
+ right = left + width;
+ abutted = [];
+ if (top <= targetPos.bottom && bottom >= targetPos.top) {
+ _ref2 = ['left', 'right'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ side = _ref2[_i];
+ if ((_ref3 = targetPos[side]) === left || _ref3 === right) {
+ abutted.push(side);
+ }
+ }
+ }
+ if (left <= targetPos.right && right >= targetPos.left) {
+ _ref4 = ['top', 'bottom'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) {
+ abutted.push(side);
+ }
+ }
+ }
+ allClasses = [];
+ addClasses = [];
+ sides = ['left', 'top', 'right', 'bottom'];
+ allClasses.push(this.getClass('abutted'));
+ for (_k = 0, _len2 = sides.length; _k < _len2; _k++) {
+ side = sides[_k];
+ allClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ if (abutted.length) {
+ addClasses.push(this.getClass('abutted'));
+ }
+ for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) {
+ side = abutted[_l];
+ addClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return true;
+ }
+ });
+
+}).call(this);
+
+(function() {
+ Tether.modules.push({
+ position: function(_arg) {
+ var left, result, shift, shiftLeft, shiftTop, top, _ref;
+ top = _arg.top, left = _arg.left;
+ if (!this.options.shift) {
+ return;
+ }
+ result = function(val) {
+ if (typeof val === 'function') {
+ return val.call(this, {
+ top: top,
+ left: left
+ });
+ } else {
+ return val;
+ }
+ };
+ shift = result(this.options.shift);
+ if (typeof shift === 'string') {
+ shift = shift.split(' ');
+ shift[1] || (shift[1] = shift[0]);
+ shiftTop = shift[0], shiftLeft = shift[1];
+ shiftTop = parseFloat(shiftTop, 10);
+ shiftLeft = parseFloat(shiftLeft, 10);
+ } else {
+ _ref = [shift.top, shift.left], shiftTop = _ref[0], shiftLeft = _ref[1];
+ }
+ top += shiftTop;
+ left += shiftLeft;
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+(function() {
+ var ATTACHMENT, Evented, Shepherd, Step, Tour, addClass, createFromHTML, extend, getBounds, matchesSelector, parseShorthand, removeClass, uniqueId, _ref,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ _ref = Tether.Utils, extend = _ref.extend, removeClass = _ref.removeClass, addClass = _ref.addClass, Evented = _ref.Evented, getBounds = _ref.getBounds, uniqueId = _ref.uniqueId;
+
+ ATTACHMENT = {
+ 'top': 'top center',
+ 'left': 'middle right',
+ 'right': 'middle left',
+ 'bottom': 'bottom center'
+ };
+
+ createFromHTML = function(html) {
+ var el;
+ el = document.createElement('div');
+ el.innerHTML = html;
+ return el.children[0];
+ };
+
+ matchesSelector = function(el, sel) {
+ var matches, _ref1, _ref2, _ref3, _ref4;
+ matches = (_ref1 = (_ref2 = (_ref3 = (_ref4 = el.matches) != null ? _ref4 : el.matchesSelector) != null ? _ref3 : el.webkitMatchesSelector) != null ? _ref2 : el.mozMatchesSelector) != null ? _ref1 : el.oMatchesSelector;
+ return matches.call(el, sel);
+ };
+
+ parseShorthand = function(obj, props) {
+ var i, out, prop, vals, _i, _len;
+ if (obj == null) {
+ return obj;
+ } else if (typeof obj === 'object') {
+ return obj;
+ } else {
+ vals = obj.split(' ');
+ if (vals.length > props.length) {
+ vals[0] = vals.slice(0, +(vals.length - props.length) + 1 || 9e9).join(' ');
+ vals.splice(1, vals.length - props.length);
+ }
+ out = {};
+ for (i = _i = 0, _len = props.length; _i < _len; i = ++_i) {
+ prop = props[i];
+ out[prop] = vals[i];
+ }
+ return out;
+ }
+ };
+
+ Step = (function(_super) {
+ __extends(Step, _super);
+
+ function Step(tour, options) {
+ this.tour = tour;
+ this.destroy = __bind(this.destroy, this);
+ this.scrollTo = __bind(this.scrollTo, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.isOpen = __bind(this.isOpen, this);
+ this.hide = __bind(this.hide, this);
+ this.show = __bind(this.show, this);
+ this.setOptions(options);
+ this;
+ }
+
+ Step.prototype.setOptions = function(options) {
+ var event, handler, _base, _ref1;
+ this.options = options != null ? options : {};
+ this.destroy();
+ this.id = this.options.id || this.id || ("step-" + (uniqueId()));
+ if (this.options.when) {
+ _ref1 = this.options.when;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ this.on(event, handler, this);
+ }
+ }
+ return (_base = this.options).buttons != null ? (_base = this.options).buttons : _base.buttons = [
+ {
+ text: 'Next',
+ action: this.tour.next
+ }
+ ];
+ };
+
+ Step.prototype.getTour = function() {
+ return this.tour;
+ };
+
+ Step.prototype.bindAdvance = function() {
+ var event, handler, selector, _ref1,
+ _this = this;
+ _ref1 = parseShorthand(this.options.advanceOn, ['selector', 'event']), event = _ref1.event, selector = _ref1.selector;
+ handler = function(e) {
+ if (!_this.isOpen()) {
+ return;
+ }
+ if (selector != null) {
+ if (matchesSelector(e.target, selector)) {
+ return _this.tour.next();
+ }
+ } else {
+ if (_this.el && e.target === _this.el) {
+ return _this.tour.next();
+ }
+ }
+ };
+ document.body.addEventListener(event, handler);
+ return this.on('destroy', function() {
+ return document.body.removeEventListener(event, handler);
+ });
+ };
+
+ Step.prototype.getAttachTo = function() {
+ var opts;
+ opts = parseShorthand(this.options.attachTo, ['element', 'on']);
+ if (opts == null) {
+ opts = {};
+ }
+ if (typeof opts.element === 'string') {
+ opts.element = document.querySelector(opts.element);
+ if (opts.element == null) {
+ throw new Error("Shepherd step's attachTo was not found in the page");
+ }
+ }
+ return opts;
+ };
+
+ Step.prototype.setupTether = function() {
+ var attachment, opts, tetherOpts;
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("Using the attachment feature of Shepherd requires the Tether library");
+ }
+ opts = this.getAttachTo();
+ attachment = ATTACHMENT[opts.on || 'right'];
+ if (opts.element == null) {
+ opts.element = 'viewport';
+ attachment = 'middle center';
+ }
+ tetherOpts = {
+ classPrefix: 'shepherd',
+ element: this.el,
+ constraints: [
+ {
+ to: 'window',
+ pin: true,
+ attachment: 'together'
+ }
+ ],
+ target: opts.element,
+ offset: opts.offset || '0 0',
+ attachment: attachment
+ };
+ return this.tether = new Tether(extend(tetherOpts, this.options.tetherOptions));
+ };
+
+ Step.prototype.show = function() {
+ var _ref1,
+ _this = this;
+ if (this.el == null) {
+ this.render();
+ }
+ addClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.enable();
+ }
+ if (this.options.scrollTo) {
+ setTimeout(function() {
+ return _this.scrollTo();
+ });
+ }
+ return this.trigger('show');
+ };
+
+ Step.prototype.hide = function() {
+ var _ref1;
+ removeClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.disable();
+ }
+ return this.trigger('hide');
+ };
+
+ Step.prototype.isOpen = function() {
+ return hasClass(this.el, 'shepherd-open');
+ };
+
+ Step.prototype.cancel = function() {
+ this.hide();
+ return this.trigger('cancel');
+ };
+
+ Step.prototype.complete = function() {
+ this.hide();
+ return this.trigger('complete');
+ };
+
+ Step.prototype.scrollTo = function() {
+ var element;
+ element = this.getAttachTo().element;
+ return element != null ? element.scrollIntoView() : void 0;
+ };
+
+ Step.prototype.destroy = function() {
+ var _ref1;
+ if (this.el != null) {
+ document.body.removeChild(this.el);
+ delete this.el;
+ }
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ return this.trigger('destroy');
+ };
+
+ Step.prototype.render = function() {
+ var button, buttons, cfg, content, footer, header, paragraph, paragraphs, text, _i, _j, _len, _len1, _ref1, _ref2, _ref3;
+ if (this.el != null) {
+ this.destroy();
+ }
+ this.el = createFromHTML("");
+ content = document.createElement('div');
+ content.className = 'shepherd-content';
+ this.el.appendChild(content);
+ if (this.options.title != null) {
+ header = document.createElement('header');
+ header.innerHTML = "" + this.options.title + "
";
+ this.el.className += ' shepherd-has-title';
+ content.appendChild(header);
+ }
+ if (this.options.text != null) {
+ text = createFromHTML("");
+ paragraphs = this.options.text;
+ if (typeof paragraphs === 'string') {
+ paragraphs = [paragraphs];
+ }
+ for (_i = 0, _len = paragraphs.length; _i < _len; _i++) {
+ paragraph = paragraphs[_i];
+ text.innerHTML += "" + paragraph + "
";
+ }
+ content.appendChild(text);
+ }
+ footer = document.createElement('footer');
+ if (this.options.buttons) {
+ buttons = createFromHTML("");
+ _ref2 = this.options.buttons;
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
+ cfg = _ref2[_j];
+ button = createFromHTML("" + cfg.text + "");
+ buttons.appendChild(button);
+ this.bindButtonEvents(cfg, button.querySelector('a'));
+ }
+ footer.appendChild(buttons);
+ }
+ content.appendChild(footer);
+ document.body.appendChild(this.el);
+ this.setupTether();
+ if (this.options.advanceOn) {
+ return this.bindAdvance();
+ }
+ };
+
+ Step.prototype.bindButtonEvents = function(cfg, el) {
+ var event, handler, page, _ref1,
+ _this = this;
+ if (cfg.events == null) {
+ cfg.events = {};
+ }
+ if (cfg.action != null) {
+ cfg.events.click = cfg.action;
+ }
+ _ref1 = cfg.events;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ if (typeof handler === 'string') {
+ page = handler;
+ handler = function() {
+ return _this.tour.show(page);
+ };
+ }
+ el.addEventListener(event, handler);
+ }
+ return this.on('destroy', function() {
+ var _ref2, _results;
+ _ref2 = cfg.events;
+ _results = [];
+ for (event in _ref2) {
+ handler = _ref2[event];
+ _results.push(el.removeEventListener(event, handler));
+ }
+ return _results;
+ });
+ };
+
+ return Step;
+
+ })(Evented);
+
+ Tour = (function(_super) {
+ __extends(Tour, _super);
+
+ function Tour(options) {
+ var event, _i, _len, _ref1, _ref2,
+ _this = this;
+ this.options = options != null ? options : {};
+ this.hide = __bind(this.hide, this);
+ this.cancel = __bind(this.cancel, this);
+ this.back = __bind(this.back, this);
+ this.next = __bind(this.next, this);
+ this.steps = (_ref1 = this.options.steps) != null ? _ref1 : [];
+ _ref2 = ['complete', 'cancel', 'hide', 'start', 'show'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ event = _ref2[_i];
+ this.on(event, function(opts) {
+ if (opts == null) {
+ opts = {};
+ }
+ opts.tour = _this;
+ return Shepherd.trigger(event, opts);
+ });
+ }
+ this;
+ }
+
+ Tour.prototype.addStep = function(name, step) {
+ var _ref1;
+ if (step == null) {
+ step = name;
+ }
+ if (!(step instanceof Step)) {
+ if ((_ref1 = typeof name) === 'string' || _ref1 === 'number') {
+ step.id = name.toString();
+ }
+ step = extend({}, this.options.defaults, step);
+ step = new Step(this, step);
+ } else {
+ step.tour = this;
+ }
+ this.steps.push(step);
+ return step;
+ };
+
+ Tour.prototype.getById = function(id) {
+ var step, _i, _len, _ref1;
+ _ref1 = this.steps;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ step = _ref1[_i];
+ if (step.id === id) {
+ return step;
+ }
+ }
+ };
+
+ Tour.prototype.getCurrentStep = function() {
+ return this.currentStep;
+ };
+
+ Tour.prototype.next = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ if (index === this.steps.length - 1) {
+ this.hide(index);
+ this.trigger('complete');
+ return this.done();
+ } else {
+ return this.show(index + 1);
+ }
+ };
+
+ Tour.prototype.back = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ return this.show(index - 1);
+ };
+
+ Tour.prototype.cancel = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.cancel();
+ }
+ this.trigger('cancel');
+ return this.done();
+ };
+
+ Tour.prototype.hide = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('hide');
+ return this.done();
+ };
+
+ Tour.prototype.done = function() {
+ return Shepherd.activeTour = null;
+ };
+
+ Tour.prototype.show = function(key) {
+ var next;
+ if (key == null) {
+ key = 0;
+ }
+ if (this.currentStep) {
+ this.currentStep.hide();
+ }
+ Shepherd.activeTour = this;
+ if (typeof key === 'string') {
+ next = this.getById(key);
+ } else {
+ next = this.steps[key];
+ }
+ if (next) {
+ this.trigger('show', {
+ step: next,
+ previous: this.currentStep
+ });
+ this.currentStep = next;
+ return next.show();
+ }
+ };
+
+ Tour.prototype.start = function() {
+ this.trigger('start');
+ this.currentStep = null;
+ return this.next();
+ };
+
+ return Tour;
+
+ })(Evented);
+
+ Shepherd = new Evented;
+
+ extend(Shepherd, {
+ Tour: Tour,
+ Step: Step,
+ Evented: Evented
+ });
+
+ window.Shepherd = Shepherd;
+
+}).call(this);
diff --git a/ajax/libs/shepherd/0.4.2/shepherd.min.js b/ajax/libs/shepherd/0.4.2/shepherd.min.js
new file mode 100644
index 000000000..9a7901b3c
--- /dev/null
+++ b/ajax/libs/shepherd/0.4.2/shepherd.min.js
@@ -0,0 +1,2 @@
+/*! shepherd 0.4.2 */
+(function(){var t,e,o,n,i,s,r,h,l,a,p,u,f,c,d,g,m={}.hasOwnProperty,v=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1},b=[].slice;null==window.Tether&&(window.Tether={}),a=function(t){var e,o,n,i,s;if(o=getComputedStyle(t).position,"fixed"===o)return t;for(n=void 0,e=t;e=e.parentNode;){try{i=getComputedStyle(e)}catch(r){}if(null==i)return e;if(/(auto|scroll)/.test(i.overflow+i["overflow-y"]+i["overflow-x"])&&("absolute"!==o||"relative"===(s=i.position)||"absolute"===s||"fixed"===s))return e}return document.body},c=function(){var t;return t=0,function(){return t++}}(),g={},l=function(t){var e,n,s,r,h;if(s=t._tetherZeroElement,null==s&&(s=t.createElement("div"),s.setAttribute("data-tether-id",c()),i(s.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(s),t._tetherZeroElement=s),e=s.getAttribute("data-tether-id"),null==g[e]){g[e]={},h=s.getBoundingClientRect();for(n in h)r=h[n],g[e][n]=r;o(function(){return g[e]=void 0})}return g[e]},u=null,r=function(t){var e,o,n,i,s,r,h;t===document?(o=document,t=document.documentElement):o=t.ownerDocument,n=o.documentElement,e={},h=t.getBoundingClientRect();for(i in h)r=h[i],e[i]=r;return s=l(o),e.top-=s.top,e.left-=s.left,null==e.width&&(e.width=document.body.scrollWidth-e.left-e.right),null==e.height&&(e.height=document.body.scrollHeight-e.top-e.bottom),e.top=e.top-n.clientTop,e.left=e.left-n.clientLeft,e.right=o.body.clientWidth-e.width-e.left,e.bottom=o.body.clientHeight-e.height-e.top,e},h=function(t){return t.offsetParent||document.documentElement},i=function(t){var e,o,n,i,s,r,h;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),h=e.slice(1),s=0,r=h.length;r>s;s++)if(n=h[s])for(o in n)m.call(n,o)&&(i=n[o],t[o]=i);return t},f=function(t,e){var o,n,i,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],n=0,i=s.length;i>n;n++)o=s[n],r.push(t.classList.remove(o));return r}return t.className=t.className.replace(new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi")," ")},e=function(t,e){var o,n,i,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],n=0,i=s.length;i>n;n++)o=s[n],r.push(t.classList.add(o));return r}return f(t,e),t.className+=" "+e},p=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},d=function(t,o,n){var i,s,r,h,l,a;for(s=0,h=n.length;h>s;s++)i=n[s],v.call(o,i)<0&&p(t,i)&&f(t,i);for(a=[],r=0,l=o.length;l>r;r++)i=o[r],a.push(p(t,i)?void 0:e(t,i));return a},n=[],o=function(t){return n.push(t)},s=function(){var t,e;for(e=[];t=n.pop();)e.push(t());return e},t=function(){function t(){}return t.prototype.on=function(t,e,o,n){var i;return null==n&&(n=!1),null==this.bindings&&(this.bindings={}),null==(i=this.bindings)[t]&&(i[t]=[]),this.bindings[t].push({handler:e,ctx:o,once:n})},t.prototype.once=function(t,e,o){return this.on(t,e,o,!0)},t.prototype.off=function(t,e){var o,n,i;if(null!=(null!=(n=this.bindings)?n[t]:void 0)){if(null==e)return delete this.bindings[t];for(o=0,i=[];o=e&&e>=t-o},T=function(){var t,e,o,n,i;for(t=document.createElement("div"),i=["transform","webkitTransform","OTransform","MozTransform","msTransform"],o=0,n=i.length;n>o;o++)if(e=i[o],void 0!==t.style[e])return e}(),C=[],y=function(){var t,e,o;for(e=0,o=C.length;o>e;e++)t=C[e],t.position(!1);return a()},g=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance?"function"==typeof performance.now?performance.now():void 0:void 0)?t:+new Date},function(){var t,e,o,n,i,s,r,h,l;for(e=null,o=null,n=null,i=function(){if(null!=o&&o>16)return o=Math.min(o-16,250),void(n=setTimeout(i,250));if(!(null!=e&&g()-e<10))return null!=n&&(clearTimeout(n),n=null),e=g(),y(),o=g()-e},h=["resize","scroll","touchmove"],l=[],s=0,r=h.length;r>s;s++)t=h[s],l.push(window.addEventListener(t,i));return l}(),t={center:"center",left:"right",right:"left"},e={middle:"middle",top:"bottom",bottom:"top"},o={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},r=function(o,n){var i,s;return i=o.left,s=o.top,"auto"===i&&(i=t[n.left]),"auto"===s&&(s=e[n.top]),{left:i,top:s}},s=function(t){var e,n;return{left:null!=(e=o[t.left])?e:t.left,top:null!=(n=o[t.top])?n:t.top}},i=function(){var t,e,o,n,i,s,r;for(e=1<=arguments.length?A.call(arguments,0):[],o={top:0,left:0},i=0,s=e.length;s>i;i++)r=e[i],n=r.top,t=r.left,"string"==typeof n&&(n=parseFloat(n,10)),"string"==typeof t&&(t=parseFloat(t,10)),o.top+=n,o.left+=t;return o},m=function(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t},v=b=function(t){var e,o,n;return n=t.split(" "),o=n[0],e=n[1],{top:o,left:e}},S=function(){function t(t){this.position=M(this.position,this);var e,o,n,i,s;for(C.push(this),this.history=[],this.setOptions(t,!1),i=Tether.modules,o=0,n=i.length;n>o;o++)e=i[o],null!=(s=e.initialize)&&s.call(this);this.position()}return t.modules=[],t.prototype.getClass=function(t){var e,o;return(null!=(e=this.options.classes)?e[t]:void 0)?this.options.classes[t]:(null!=(o=this.options.classes)?o[t]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+t:t:""},t.prototype.setOptions=function(t,e){var o,i,s,r,h,a;for(this.options=t,null==e&&(e=!0),o={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=l(o,this.options),h=this.options,this.element=h.element,this.target=h.target,this.targetModifier=h.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),a=["element","target"],s=0,r=a.length;r>s;s++){if(i=a[s],null==this[i])throw new Error("Tether Error: Both element and target must be defined");null!=this[i].jquery?this[i]=this[i][0]:"string"==typeof this[i]&&(this[i]=document.querySelector(this[i]))}if(n(this.element,this.getClass("element")),n(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=v(this.options.targetAttachment),this.attachment=v(this.options.attachment),this.offset=b(this.options.offset),this.targetOffset=b(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent="scroll-handle"===this.targetModifier?this.target:c(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,o,n,i,s,r,h,l;if(null==this.targetModifier)return p(this.target);switch(this.targetModifier){case"visible":return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:(t=p(this.target),i={height:t.height,width:t.width,top:t.top,left:t.left},i.height=Math.min(i.height,t.height-(pageYOffset-t.top)),i.height=Math.min(i.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),i.height=Math.min(innerHeight,i.height),i.height-=2,i.width=Math.min(i.width,t.width-(pageXOffset-t.left)),i.width=Math.min(i.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),i.width=Math.min(innerWidth,i.width),i.width-=2,i.topl.clientWidth||"scroll"===[h.overflow,h.overflowX]||this.target!==document.body,s=0,o&&(s=15),n=t.height-parseFloat(h.borderTopWidth)-parseFloat(h.borderBottomWidth)-s,i={width:15,height:.975*n*(n/l.scrollHeight),left:t.left+t.width-parseFloat(h.borderLeftWidth)-15},e=0,408>n&&this.target===document.body&&(e=-11e-5*Math.pow(n,2)-.00727*n+22.58),this.target!==document.body&&(i.height=Math.max(i.height,24)),r=l.scrollTop/(l.scrollHeight-n),i.top=r*(n-i.height-e)+t.top+parseFloat(h.borderTopWidth),this.target===document.body&&(i.height=Math.max(i.height,24)),i}},t.prototype.clearCache=function(){return this._cache={}},t.prototype.cache=function(t,e){return null==this._cache&&(this._cache={}),null==this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},t.prototype.enable=function(t){return null==t&&(t=!0),n(this.target,this.getClass("enabled")),n(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t?this.position():void 0},t.prototype.disable=function(){return w(this.target,this.getClass("enabled")),w(this.element,this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},t.prototype.destroy=function(){var t,e,o,n,i;for(this.disable(),i=[],t=o=0,n=C.length;n>o;t=++o){if(e=C[t],e===this){C.splice(t,1);break}i.push(void 0)}return i},t.prototype.updateAttachClasses=function(t,e){var o,n,i,s,r,l,a,p,u,f=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),s=["left","top","bottom","right","middle","center"],(null!=(u=this._addAttachClasses)?u.length:void 0)&&this._addAttachClasses.splice(0,this._addAttachClasses.length),o=null!=this._addAttachClasses?this._addAttachClasses:this._addAttachClasses=[],t.top&&o.push(""+this.getClass("element-attached")+"-"+t.top),t.left&&o.push(""+this.getClass("element-attached")+"-"+t.left),e.top&&o.push(""+this.getClass("target-attached")+"-"+e.top),e.left&&o.push(""+this.getClass("target-attached")+"-"+e.left),n=[],r=0,a=s.length;a>r;r++)i=s[r],n.push(""+this.getClass("element-attached")+"-"+i);for(l=0,p=s.length;p>l;l++)i=s[l],n.push(""+this.getClass("target-attached")+"-"+i);return h(function(){return null!=f._addAttachClasses?(O(f.element,f._addAttachClasses,n),O(f.target,f._addAttachClasses,n),f._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,o,n,h,l,f,c,d,g,v,b,y,w,C,T,O,x,S,E,A,M,B,_,L,P,W,z,F,H,Y,N,X,k=this;if(null==t&&(t=!0),this.enabled){for(this.clearCache(),E=r(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,E),e=this.cache("element-bounds",function(){return p(k.element)}),L=e.width,n=e.height,0===L&&0===n&&null!=this.lastSize?(H=this.lastSize,L=H.width,n=H.height):this.lastSize={width:L,height:n},B=M=this.cache("target-bounds",function(){return k.getTargetBounds()}),g=m(s(this.attachment),{width:L,height:n}),A=m(s(E),B),l=m(this.offset,{width:L,height:n}),f=m(this.targetOffset,B),g=i(g,l),A=i(A,f),h=M.left+A.left-g.left,_=M.top+A.top-g.top,Y=Tether.modules,P=0,z=Y.length;z>P;P++)if(c=Y[P],T=c.position.call(this,{left:h,top:_,targetAttachment:E,targetPos:M,elementPos:e,offset:g,targetOffset:A,manualOffset:l,manualTargetOffset:f}),null!=T&&"object"==typeof T){if(T===!1)return!1;_=T.top,h=T.left}if(d={page:{top:_,bottom:document.body.scrollHeight-_-n,left:h,right:document.body.scrollWidth-h-L},viewport:{top:_-pageYOffset,bottom:pageYOffset-_-n+innerHeight,left:h-pageXOffset,right:pageXOffset-h-L+innerWidth}},(null!=(N=this.options.optimizations)?N.moveElement:void 0)!==!1&&null==this.targetModifier){for(b=this.cache("target-offsetparent",function(){return u(k.target)}),C=this.cache("target-offsetparent-bounds",function(){return p(b)}),w=getComputedStyle(b),o=getComputedStyle(this.element),y=C,v={},X=["Top","Left","Bottom","Right"],W=0,F=X.length;F>W;W++)S=X[W],v[S]=parseFloat(w["border"+S+"Width"]);C.right=document.body.scrollWidth-C.left-y.width+v.right,C.bottom=document.body.scrollHeight-C.top-y.height+v.bottom,d.page.top>=C.top+v.top&&d.page.bottom>=C.bottom&&d.page.left>=C.left+v.left&&d.page.right>=C.right&&(x=b.scrollTop,O=b.scrollLeft,d.offset={top:d.page.top-C.top+x-v.top,left:d.page.left-C.left+O-v.left})}return this.move(d),this.history.unshift(d),this.history.length>3&&this.history.pop(),t&&a(),!0}},t.prototype.move=function(t){var e,o,n,i,s,r,a,p,f,c,d,g,m,v,b,y,w,C=this;if(null!=this.element.parentNode){p={};for(c in t){p[c]={};for(i in t[c]){for(n=!1,y=this.history,v=0,b=y.length;b>v;v++)if(a=y[v],!x(null!=(w=a[c])?w[i]:void 0,t[c][i])){n=!0;break}n||(p[c][i]=!0)}}e={top:"",left:"",right:"",bottom:""},f=function(t,o){var n,i,s;return(null!=(s=C.options.optimizations)?s.gpu:void 0)===!1?(t.top?e.top=""+o.top+"px":e.bottom=""+o.bottom+"px",t.left?e.left=""+o.left+"px":e.right=""+o.right+"px"):(t.top?(e.top=0,i=o.top):(e.bottom=0,i=-o.bottom),t.left?(e.left=0,n=o.left):(e.right=0,n=-o.right),e[T]="translateX("+Math.round(n)+"px) translateY("+Math.round(i)+"px)","msTransform"!==T?e[T]+=" translateZ(0)":void 0)},s=!1,(p.page.top||p.page.bottom)&&(p.page.left||p.page.right)?(e.position="absolute",f(p.page,t.page)):(p.viewport.top||p.viewport.bottom)&&(p.viewport.left||p.viewport.right)?(e.position="fixed",f(p.viewport,t.viewport)):null!=p.offset&&p.offset.top&&p.offset.left?(e.position="absolute",r=this.cache("target-offsetparent",function(){return u(C.target)}),u(this.element)!==r&&h(function(){return C.element.parentNode.removeChild(C.element),r.appendChild(C.element)}),f(p.offset,t.offset),s=!0):(e.position="absolute",f({top:!0,left:!0},t.page)),s||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),m={},g=!1;for(i in e)d=e[i],o=this.element.style[i],""===o||""===d||"top"!==i&&"left"!==i&&"bottom"!==i&&"right"!==i||(o=parseFloat(o),d=parseFloat(d)),o!==d&&(g=!0,m[i]=e[i]);return g?h(function(){return l(C.element.style,m)}):void 0}},t}(),Tether.position=y,window.Tether=l(S,Tether)}.call(this),function(){var t,e,o,n,i,s,r,h,l,a,p=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1};a=Tether.Utils,r=a.getOuterSize,s=a.getBounds,h=a.getSize,n=a.extend,l=a.updateClasses,o=a.defer,e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},t=["left","top","right","bottom"],i=function(e,o){var n,i,r,h,l,a,p;if("scrollParent"===o?o=e.scrollParent:"window"===o&&(o=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),o===document&&(o=o.documentElement),null!=o.nodeType)for(i=h=s(o),l=getComputedStyle(o),o=[i.left,i.top,h.width+i.left,h.height+i.top],n=a=0,p=t.length;p>a;n=++a)r=t[n],r=r[0].toUpperCase()+r.substr(1),"Top"===r||"Left"===r?o[n]+=parseFloat(l["border"+r+"Width"]):o[n]-=parseFloat(l["border"+r+"Width"]);return o},Tether.modules.push({position:function(e){var r,h,a,u,f,c,d,g,m,v,b,y,w,C,T,O,x,S,E,A,M,B,_,L,P,W,z,F,H,Y,N,X,k,j,q,U,I,R,D,Z,$,V,G,J,K,Q,te,ee=this;if(W=e.top,b=e.left,M=e.targetAttachment,!this.options.constraints)return!0;for(S=function(e){var o,n,i,s;for(ee.removeClass(e),s=[],n=0,i=t.length;i>n;n++)o=t[n],s.push(ee.removeClass(""+e+"-"+o));return s},Z=this.cache("element-bounds",function(){return s(ee.element)}),v=Z.height,z=Z.width,0===z&&0===v&&null!=this.lastSize&&($=this.lastSize,z=$.width,v=$.height),_=this.cache("target-bounds",function(){return ee.getTargetBounds()}),B=_.height,L=_.width,A={},m={},h=[this.getClass("pinned"),this.getClass("out-of-bounds")],V=this.options.constraints,F=0,X=V.length;X>F;F++)g=V[F],g.outOfBoundsClass&&h.push(g.outOfBoundsClass),g.pinnedClass&&h.push(g.pinnedClass);for(H=0,k=h.length;k>H;H++)for(d=h[H],G=["left","top","right","bottom"],Y=0,j=G.length;j>Y;Y++)E=G[Y],h.push(""+d+"-"+E);for(r=[],A=n({},M),m=n({},this.attachment),J=this.options.constraints,N=0,q=J.length;q>N;N++){if(g=J[N],P=g.to,a=g.attachment,T=g.pin,null==a&&(a=""),p.call(a," ")>=0?(K=a.split(" "),c=K[0],f=K[1]):f=c=a,u=i(this,P),("target"===c||"both"===c)&&(Wu[3]&&"bottom"===A.top&&(W-=B,A.top="top")),"together"===c&&(Wu[3]&&"bottom"===A.top&&("top"===m.top?(W-=B,A.top="top",W-=v,m.top="bottom"):"bottom"===m.top&&(W-=B,A.top="top",W+=v,m.top="top"))),("target"===f||"both"===f)&&(bu[2]&&"right"===A.left&&(b-=L,A.left="left")),"together"===f&&(bu[2]&&"right"===A.left&&("left"===m.left?(b-=L,A.left="left",b-=z,m.left="right"):"right"===m.left&&(b-=L,A.left="left",b+=z,m.left="left"))),("element"===c||"both"===c)&&(Wu[3]&&"top"===m.top&&(W-=v,m.top="bottom")),("element"===f||"both"===f)&&(bu[2]&&"left"===m.left&&(b-=z,m.left="right")),"string"==typeof T?T=function(){var t,e,o,n;for(o=T.split(","),n=[],e=0,t=o.length;t>e;e++)C=o[e],n.push(C.trim());return n}():T===!0&&(T=["top","left","right","bottom"]),T||(T=[]),O=[],y=[],W=0?(W=u[1],O.push("top")):y.push("top")),W+v>u[3]&&(p.call(T,"bottom")>=0?(W=u[3]-v,O.push("bottom")):y.push("bottom")),b=0?(b=u[0],O.push("left")):y.push("left")),b+z>u[2]&&(p.call(T,"right")>=0?(b=u[2]-z,O.push("right")):y.push("right")),O.length)for(x=null!=(Q=this.options.pinnedClass)?Q:this.getClass("pinned"),r.push(x),R=0,U=O.length;U>R;R++)E=O[R],r.push(""+x+"-"+E);if(y.length)for(w=null!=(te=this.options.outOfBoundsClass)?te:this.getClass("out-of-bounds"),r.push(w),D=0,I=y.length;I>D;D++)E=y[D],r.push(""+w+"-"+E);(p.call(O,"left")>=0||p.call(O,"right")>=0)&&(m.left=A.left=!1),(p.call(O,"top")>=0||p.call(O,"bottom")>=0)&&(m.top=A.top=!1),(A.top!==M.top||A.left!==M.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,A)}return o(function(){return l(ee.target,r,h),l(ee.element,r,h)}),{top:W,left:b}}})}.call(this),function(){var t,e,o,n;n=Tether.Utils,e=n.getBounds,o=n.updateClasses,t=n.defer,Tether.modules.push({position:function(n){var i,s,r,h,l,a,p,u,f,c,d,g,m,v,b,y,w,C,T,O,x,S,E,A,M,B=this;if(d=n.top,a=n.left,x=this.cache("element-bounds",function(){return e(B.element)}),l=x.height,g=x.width,c=this.getTargetBounds(),h=d+l,p=a+g,i=[],d<=c.bottom&&h>=c.top)for(S=["left","right"],m=0,w=S.length;w>m;m++)u=S[m],((E=c[u])===a||E===p)&&i.push(u);if(a<=c.right&&p>=c.left)for(A=["top","bottom"],v=0,C=A.length;C>v;v++)u=A[v],((M=c[u])===d||M===h)&&i.push(u);for(r=[],s=[],f=["left","top","right","bottom"],r.push(this.getClass("abutted")),b=0,T=f.length;T>b;b++)u=f[b],r.push(""+this.getClass("abutted")+"-"+u);for(i.length&&s.push(this.getClass("abutted")),y=0,O=i.length;O>y;y++)u=i[y],s.push(""+this.getClass("abutted")+"-"+u);return t(function(){return o(B.target,s,r),o(B.element,s,r)}),!0}})}.call(this),function(){Tether.modules.push({position:function(t){var e,o,n,i,s,r,h;return r=t.top,e=t.left,this.options.shift?(o=function(t){return"function"==typeof t?t.call(this,{top:r,left:e}):t},n=o(this.options.shift),"string"==typeof n?(n=n.split(" "),n[1]||(n[1]=n[0]),s=n[0],i=n[1],s=parseFloat(s,10),i=parseFloat(i,10)):(h=[n.top,n.left],s=h[0],i=h[1]),r+=s,e+=i,{top:r,left:e}):void 0}})}.call(this),function(){var t,e,o,n,i,s,r,h,l,a,p,u,f,c,d=function(t,e){return function(){return t.apply(e,arguments)}},g={}.hasOwnProperty,m=function(t,e){function o(){this.constructor=t}for(var n in e)g.call(e,n)&&(t[n]=e[n]);return o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype,t};c=Tether.Utils,h=c.extend,u=c.removeClass,s=c.addClass,e=c.Evented,l=c.getBounds,f=c.uniqueId,t={top:"top center",left:"middle right",right:"middle left",bottom:"bottom center"},r=function(t){var e;return e=document.createElement("div"),e.innerHTML=t,e.children[0]},a=function(t,e){var o,n,i,s,r;return o=null!=(n=null!=(i=null!=(s=null!=(r=t.matches)?r:t.matchesSelector)?s:t.webkitMatchesSelector)?i:t.mozMatchesSelector)?n:t.oMatchesSelector,o.call(t,e)},p=function(t,e){var o,n,i,s,r,h;if(null==t)return t;if("object"==typeof t)return t;for(s=t.split(" "),s.length>e.length&&(s[0]=s.slice(0,+(s.length-e.length)+1||9e9).join(" "),s.splice(1,s.length-e.length)),n={},o=r=0,h=e.length;h>r;o=++r)i=e[o],n[i]=s[o];return n},n=function(e){function o(t,e){this.tour=t,this.destroy=d(this.destroy,this),this.scrollTo=d(this.scrollTo,this),this.complete=d(this.complete,this),this.cancel=d(this.cancel,this),this.isOpen=d(this.isOpen,this),this.hide=d(this.hide,this),this.show=d(this.show,this),this.setOptions(e)}return m(o,e),o.prototype.setOptions=function(t){var e,o,n,i;if(this.options=null!=t?t:{},this.destroy(),this.id=this.options.id||this.id||"step-"+f(),this.options.when){i=this.options.when;for(e in i)o=i[e],this.on(e,o,this)}return null!=(n=this.options).buttons?(n=this.options).buttons:n.buttons=[{text:"Next",action:this.tour.next}]},o.prototype.getTour=function(){return this.tour},o.prototype.bindAdvance=function(){var t,e,o,n,i=this;return n=p(this.options.advanceOn,["selector","event"]),t=n.event,o=n.selector,e=function(t){if(i.isOpen())if(null!=o){if(a(t.target,o))return i.tour.next()}else if(i.el&&t.target===i.el)return i.tour.next()},document.body.addEventListener(t,e),this.on("destroy",function(){return document.body.removeEventListener(t,e)})},o.prototype.getAttachTo=function(){var t;if(t=p(this.options.attachTo,["element","on"]),null==t&&(t={}),"string"==typeof t.element&&(t.element=document.querySelector(t.element),null==t.element))throw new Error("Shepherd step's attachTo was not found in the page");return t},o.prototype.setupTether=function(){var e,o,n;if("undefined"==typeof Tether||null===Tether)throw new Error("Using the attachment feature of Shepherd requires the Tether library");return o=this.getAttachTo(),e=t[o.on||"right"],null==o.element&&(o.element="viewport",e="middle center"),n={classPrefix:"shepherd",element:this.el,constraints:[{to:"window",pin:!0,attachment:"together"}],target:o.element,offset:o.offset||"0 0",attachment:e},this.tether=new Tether(h(n,this.options.tetherOptions))},o.prototype.show=function(){var t,e=this;return null==this.el&&this.render(),s(this.el,"shepherd-open"),null!=(t=this.tether)&&t.enable(),this.options.scrollTo&&setTimeout(function(){return e.scrollTo()}),this.trigger("show")},o.prototype.hide=function(){var t;return u(this.el,"shepherd-open"),null!=(t=this.tether)&&t.disable(),this.trigger("hide")},o.prototype.isOpen=function(){return hasClass(this.el,"shepherd-open")},o.prototype.cancel=function(){return this.hide(),this.trigger("cancel")},o.prototype.complete=function(){return this.hide(),this.trigger("complete")},o.prototype.scrollTo=function(){var t;return t=this.getAttachTo().element,null!=t?t.scrollIntoView():void 0},o.prototype.destroy=function(){var t;return null!=this.el&&(document.body.removeChild(this.el),delete this.el),null!=(t=this.tether)&&t.destroy(),this.trigger("destroy")},o.prototype.render=function(){var t,e,o,n,i,s,h,l,a,p,u,f,c,d,g,m;if(null!=this.el&&this.destroy(),this.el=r(""),n=document.createElement("div"),n.className="shepherd-content",this.el.appendChild(n),null!=this.options.title&&(s=document.createElement("header"),s.innerHTML=""+this.options.title+"
",this.el.className+=" shepherd-has-title",n.appendChild(s)),null!=this.options.text){for(a=r(""),l=this.options.text,"string"==typeof l&&(l=[l]),p=0,f=l.length;f>p;p++)h=l[p],a.innerHTML+=""+h+"
";n.appendChild(a)}if(i=document.createElement("footer"),this.options.buttons){for(e=r(""),g=this.options.buttons,u=0,c=g.length;c>u;u++)o=g[u],t=r(""+o.text+""),e.appendChild(t),this.bindButtonEvents(o,t.querySelector("a"));i.appendChild(e)}return n.appendChild(i),document.body.appendChild(this.el),this.setupTether(),this.options.advanceOn?this.bindAdvance():void 0},o.prototype.bindButtonEvents=function(t,e){var o,n,i,s,r=this;null==t.events&&(t.events={}),null!=t.action&&(t.events.click=t.action),s=t.events;for(o in s)n=s[o],"string"==typeof n&&(i=n,n=function(){return r.tour.show(i)}),e.addEventListener(o,n);return this.on("destroy",function(){var i,s;i=t.events,s=[];for(o in i)n=i[o],s.push(e.removeEventListener(o,n));return s})},o}(e),i=function(t){function e(t){var e,n,i,s,r,h=this;for(this.options=null!=t?t:{},this.hide=d(this.hide,this),this.cancel=d(this.cancel,this),this.back=d(this.back,this),this.next=d(this.next,this),this.steps=null!=(s=this.options.steps)?s:[],r=["complete","cancel","hide","start","show"],n=0,i=r.length;i>n;n++)e=r[n],this.on(e,function(t){return null==t&&(t={}),t.tour=h,o.trigger(e,t)})}return m(e,t),e.prototype.addStep=function(t,e){var o;return null==e&&(e=t),e instanceof n?e.tour=this:(("string"==(o=typeof t)||"number"===o)&&(e.id=t.toString()),e=h({},this.options.defaults,e),e=new n(this,e)),this.steps.push(e),e},e.prototype.getById=function(t){var e,o,n,i;for(i=this.steps,o=0,n=i.length;n>o;o++)if(e=i[o],e.id===t)return e},e.prototype.getCurrentStep=function(){return this.currentStep},e.prototype.next=function(){var t;return t=this.steps.indexOf(this.currentStep),t===this.steps.length-1?(this.hide(t),this.trigger("complete"),this.done()):this.show(t+1)},e.prototype.back=function(){var t;return t=this.steps.indexOf(this.currentStep),this.show(t-1)},e.prototype.cancel=function(){var t;return null!=(t=this.currentStep)&&t.cancel(),this.trigger("cancel"),this.done()},e.prototype.hide=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("hide"),this.done()},e.prototype.done=function(){return o.activeTour=null},e.prototype.show=function(t){var e;return null==t&&(t=0),this.currentStep&&this.currentStep.hide(),o.activeTour=this,e="string"==typeof t?this.getById(t):this.steps[t],e?(this.trigger("show",{step:e,previous:this.currentStep}),this.currentStep=e,e.show()):void 0},e.prototype.start=function(){return this.trigger("start"),this.currentStep=null,this.next()},e}(e),o=new e,h(o,{Tour:i,Step:n,Evented:e}),window.Shepherd=o}.call(this);
\ No newline at end of file
diff --git a/ajax/libs/shepherd/0.4.3/shepherd.js b/ajax/libs/shepherd/0.4.3/shepherd.js
new file mode 100644
index 000000000..7b6198d17
--- /dev/null
+++ b/ajax/libs/shepherd/0.4.3/shepherd.js
@@ -0,0 +1,1887 @@
+/*! shepherd 0.4.3 */
+/*! tether 0.6.5 */
+
+
+(function(root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(factory);
+ } else if (typeof exports === 'object') {
+ module.exports = factory(require,exports,module);
+ } else {
+ root.Tether = factory();
+ }
+}(this, function(require,exports,module) {
+
+(function() {
+ var Evented, addClass, defer, deferred, extend, flush, getBounds, getOffsetParent, getOrigin, getScrollBarSize, getScrollParent, hasClass, node, removeClass, uniqueId, updateClasses, zeroPosCache,
+ __hasProp = {}.hasOwnProperty,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
+ __slice = [].slice;
+
+ if (this.Tether == null) {
+ this.Tether = {
+ modules: []
+ };
+ }
+
+ getScrollParent = function(el) {
+ var parent, position, scrollParent, style, _ref;
+ position = getComputedStyle(el).position;
+ if (position === 'fixed') {
+ return el;
+ }
+ scrollParent = void 0;
+ parent = el;
+ while (parent = parent.parentNode) {
+ try {
+ style = getComputedStyle(parent);
+ } catch (_error) {}
+ if (style == null) {
+ return parent;
+ }
+ if (/(auto|scroll)/.test(style['overflow'] + style['overflow-y'] + style['overflow-x'])) {
+ if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) {
+ return parent;
+ }
+ }
+ }
+ return document.body;
+ };
+
+ uniqueId = (function() {
+ var id;
+ id = 0;
+ return function() {
+ return id++;
+ };
+ })();
+
+ zeroPosCache = {};
+
+ getOrigin = function(doc) {
+ var id, k, node, v, _ref;
+ node = doc._tetherZeroElement;
+ if (node == null) {
+ node = doc.createElement('div');
+ node.setAttribute('data-tether-id', uniqueId());
+ extend(node.style, {
+ top: 0,
+ left: 0,
+ position: 'absolute'
+ });
+ doc.body.appendChild(node);
+ doc._tetherZeroElement = node;
+ }
+ id = node.getAttribute('data-tether-id');
+ if (zeroPosCache[id] == null) {
+ zeroPosCache[id] = {};
+ _ref = node.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ zeroPosCache[id][k] = v;
+ }
+ defer(function() {
+ return zeroPosCache[id] = void 0;
+ });
+ }
+ return zeroPosCache[id];
+ };
+
+ node = null;
+
+ getBounds = function(el) {
+ var box, doc, docEl, k, origin, v, _ref;
+ if (el === document) {
+ doc = document;
+ el = document.documentElement;
+ } else {
+ doc = el.ownerDocument;
+ }
+ docEl = doc.documentElement;
+ box = {};
+ _ref = el.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ box[k] = v;
+ }
+ origin = getOrigin(doc);
+ box.top -= origin.top;
+ box.left -= origin.left;
+ if (box.width == null) {
+ box.width = document.body.scrollWidth - box.left - box.right;
+ }
+ if (box.height == null) {
+ box.height = document.body.scrollHeight - box.top - box.bottom;
+ }
+ box.top = box.top - docEl.clientTop;
+ box.left = box.left - docEl.clientLeft;
+ box.right = doc.body.clientWidth - box.width - box.left;
+ box.bottom = doc.body.clientHeight - box.height - box.top;
+ return box;
+ };
+
+ getOffsetParent = function(el) {
+ return el.offsetParent || document.documentElement;
+ };
+
+ getScrollBarSize = function() {
+ var inner, outer, width, widthContained, widthScroll;
+ inner = document.createElement('div');
+ inner.style.width = '100%';
+ inner.style.height = '200px';
+ outer = document.createElement('div');
+ extend(outer.style, {
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ pointerEvents: 'none',
+ visibility: 'hidden',
+ width: '200px',
+ height: '150px',
+ overflow: 'hidden'
+ });
+ outer.appendChild(inner);
+ document.body.appendChild(outer);
+ widthContained = inner.offsetWidth;
+ outer.style.overflow = 'scroll';
+ widthScroll = inner.offsetWidth;
+ if (widthContained === widthScroll) {
+ widthScroll = outer.clientWidth;
+ }
+ document.body.removeChild(outer);
+ width = widthContained - widthScroll;
+ return {
+ width: width,
+ height: width
+ };
+ };
+
+ extend = function(out) {
+ var args, key, obj, val, _i, _len, _ref;
+ if (out == null) {
+ out = {};
+ }
+ args = [];
+ Array.prototype.push.apply(args, arguments);
+ _ref = args.slice(1);
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ obj = _ref[_i];
+ if (obj) {
+ for (key in obj) {
+ if (!__hasProp.call(obj, key)) continue;
+ val = obj[key];
+ out[key] = val;
+ }
+ }
+ }
+ return out;
+ };
+
+ removeClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ if (cls.trim()) {
+ _results.push(el.classList.remove(cls));
+ }
+ }
+ return _results;
+ } else {
+ return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' ');
+ }
+ };
+
+ addClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ if (cls.trim()) {
+ _results.push(el.classList.add(cls));
+ }
+ }
+ return _results;
+ } else {
+ removeClass(el, name);
+ return el.className += " " + name;
+ }
+ };
+
+ hasClass = function(el, name) {
+ if (el.classList != null) {
+ return el.classList.contains(name);
+ } else {
+ return new RegExp("(^| )" + name + "( |$)", 'gi').test(el.className);
+ }
+ };
+
+ updateClasses = function(el, add, all) {
+ var cls, _i, _j, _len, _len1, _results;
+ for (_i = 0, _len = all.length; _i < _len; _i++) {
+ cls = all[_i];
+ if (__indexOf.call(add, cls) < 0) {
+ if (hasClass(el, cls)) {
+ removeClass(el, cls);
+ }
+ }
+ }
+ _results = [];
+ for (_j = 0, _len1 = add.length; _j < _len1; _j++) {
+ cls = add[_j];
+ if (!hasClass(el, cls)) {
+ _results.push(addClass(el, cls));
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ deferred = [];
+
+ defer = function(fn) {
+ return deferred.push(fn);
+ };
+
+ flush = function() {
+ var fn, _results;
+ _results = [];
+ while (fn = deferred.pop()) {
+ _results.push(fn());
+ }
+ return _results;
+ };
+
+ Evented = (function() {
+ function Evented() {}
+
+ Evented.prototype.on = function(event, handler, ctx, once) {
+ var _base;
+ if (once == null) {
+ once = false;
+ }
+ if (this.bindings == null) {
+ this.bindings = {};
+ }
+ if ((_base = this.bindings)[event] == null) {
+ _base[event] = [];
+ }
+ return this.bindings[event].push({
+ handler: handler,
+ ctx: ctx,
+ once: once
+ });
+ };
+
+ Evented.prototype.once = function(event, handler, ctx) {
+ return this.on(event, handler, ctx, true);
+ };
+
+ Evented.prototype.off = function(event, handler) {
+ var i, _ref, _results;
+ if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
+ return;
+ }
+ if (handler == null) {
+ return delete this.bindings[event];
+ } else {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ if (this.bindings[event][i].handler === handler) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ Evented.prototype.trigger = function() {
+ var args, ctx, event, handler, i, once, _ref, _ref1, _results;
+ event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+ if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
+ handler.apply(ctx != null ? ctx : this, args);
+ if (once) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ return Evented;
+
+ })();
+
+ this.Tether.Utils = {
+ getScrollParent: getScrollParent,
+ getBounds: getBounds,
+ getOffsetParent: getOffsetParent,
+ extend: extend,
+ addClass: addClass,
+ removeClass: removeClass,
+ hasClass: hasClass,
+ updateClasses: updateClasses,
+ defer: defer,
+ flush: flush,
+ uniqueId: uniqueId,
+ Evented: Evented,
+ getScrollBarSize: getScrollBarSize
+ };
+
+}).call(this);
+
+(function() {
+ var MIRROR_LR, MIRROR_TB, OFFSET_MAP, Tether, addClass, addOffset, attachmentToOffset, autoToFixedAttachment, defer, extend, flush, getBounds, getOffsetParent, getOuterSize, getScrollBarSize, getScrollParent, getSize, now, offsetToPx, parseAttachment, parseOffset, position, removeClass, tethers, transformKey, updateClasses, within, _Tether, _ref,
+ __slice = [].slice,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+
+ if (this.Tether == null) {
+ throw new Error("You must include the utils.js file before tether.js");
+ }
+
+ Tether = this.Tether;
+
+ _ref = Tether.Utils, getScrollParent = _ref.getScrollParent, getSize = _ref.getSize, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getOffsetParent = _ref.getOffsetParent, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, updateClasses = _ref.updateClasses, defer = _ref.defer, flush = _ref.flush, getScrollBarSize = _ref.getScrollBarSize;
+
+ within = function(a, b, diff) {
+ if (diff == null) {
+ diff = 1;
+ }
+ return (a + diff >= b && b >= a - diff);
+ };
+
+ transformKey = (function() {
+ var el, key, _i, _len, _ref1;
+ el = document.createElement('div');
+ _ref1 = ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ key = _ref1[_i];
+ if (el.style[key] !== void 0) {
+ return key;
+ }
+ }
+ })();
+
+ tethers = [];
+
+ position = function() {
+ var tether, _i, _len;
+ for (_i = 0, _len = tethers.length; _i < _len; _i++) {
+ tether = tethers[_i];
+ tether.position(false);
+ }
+ return flush();
+ };
+
+ now = function() {
+ var _ref1;
+ return (_ref1 = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref1 : +(new Date);
+ };
+
+ (function() {
+ var event, lastCall, lastDuration, pendingTimeout, tick, _i, _len, _ref1, _results;
+ lastCall = null;
+ lastDuration = null;
+ pendingTimeout = null;
+ tick = function() {
+ if ((lastDuration != null) && lastDuration > 16) {
+ lastDuration = Math.min(lastDuration - 16, 250);
+ pendingTimeout = setTimeout(tick, 250);
+ return;
+ }
+ if ((lastCall != null) && (now() - lastCall) < 10) {
+ return;
+ }
+ if (pendingTimeout != null) {
+ clearTimeout(pendingTimeout);
+ pendingTimeout = null;
+ }
+ lastCall = now();
+ position();
+ return lastDuration = now() - lastCall;
+ };
+ _ref1 = ['resize', 'scroll', 'touchmove'];
+ _results = [];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ event = _ref1[_i];
+ _results.push(window.addEventListener(event, tick));
+ }
+ return _results;
+ })();
+
+ MIRROR_LR = {
+ center: 'center',
+ left: 'right',
+ right: 'left'
+ };
+
+ MIRROR_TB = {
+ middle: 'middle',
+ top: 'bottom',
+ bottom: 'top'
+ };
+
+ OFFSET_MAP = {
+ top: 0,
+ left: 0,
+ middle: '50%',
+ center: '50%',
+ bottom: '100%',
+ right: '100%'
+ };
+
+ autoToFixedAttachment = function(attachment, relativeToAttachment) {
+ var left, top;
+ left = attachment.left, top = attachment.top;
+ if (left === 'auto') {
+ left = MIRROR_LR[relativeToAttachment.left];
+ }
+ if (top === 'auto') {
+ top = MIRROR_TB[relativeToAttachment.top];
+ }
+ return {
+ left: left,
+ top: top
+ };
+ };
+
+ attachmentToOffset = function(attachment) {
+ var _ref1, _ref2;
+ return {
+ left: (_ref1 = OFFSET_MAP[attachment.left]) != null ? _ref1 : attachment.left,
+ top: (_ref2 = OFFSET_MAP[attachment.top]) != null ? _ref2 : attachment.top
+ };
+ };
+
+ addOffset = function() {
+ var left, offsets, out, top, _i, _len, _ref1;
+ offsets = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ out = {
+ top: 0,
+ left: 0
+ };
+ for (_i = 0, _len = offsets.length; _i < _len; _i++) {
+ _ref1 = offsets[_i], top = _ref1.top, left = _ref1.left;
+ if (typeof top === 'string') {
+ top = parseFloat(top, 10);
+ }
+ if (typeof left === 'string') {
+ left = parseFloat(left, 10);
+ }
+ out.top += top;
+ out.left += left;
+ }
+ return out;
+ };
+
+ offsetToPx = function(offset, size) {
+ if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
+ offset.left = parseFloat(offset.left, 10) / 100 * size.width;
+ }
+ if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
+ offset.top = parseFloat(offset.top, 10) / 100 * size.height;
+ }
+ return offset;
+ };
+
+ parseAttachment = parseOffset = function(value) {
+ var left, top, _ref1;
+ _ref1 = value.split(' '), top = _ref1[0], left = _ref1[1];
+ return {
+ top: top,
+ left: left
+ };
+ };
+
+ _Tether = (function() {
+ _Tether.modules = [];
+
+ function _Tether(options) {
+ this.position = __bind(this.position, this);
+ var module, _i, _len, _ref1, _ref2;
+ tethers.push(this);
+ this.history = [];
+ this.setOptions(options, false);
+ _ref1 = Tether.modules;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ module = _ref1[_i];
+ if ((_ref2 = module.initialize) != null) {
+ _ref2.call(this);
+ }
+ }
+ this.position();
+ }
+
+ _Tether.prototype.getClass = function(key) {
+ var _ref1, _ref2;
+ if ((_ref1 = this.options.classes) != null ? _ref1[key] : void 0) {
+ return this.options.classes[key];
+ } else if (((_ref2 = this.options.classes) != null ? _ref2[key] : void 0) !== false) {
+ if (this.options.classPrefix) {
+ return "" + this.options.classPrefix + "-" + key;
+ } else {
+ return key;
+ }
+ } else {
+ return '';
+ }
+ };
+
+ _Tether.prototype.setOptions = function(options, position) {
+ var defaults, key, _i, _len, _ref1, _ref2;
+ this.options = options;
+ if (position == null) {
+ position = true;
+ }
+ defaults = {
+ offset: '0 0',
+ targetOffset: '0 0',
+ targetAttachment: 'auto auto',
+ classPrefix: 'tether'
+ };
+ this.options = extend(defaults, this.options);
+ _ref1 = this.options, this.element = _ref1.element, this.target = _ref1.target, this.targetModifier = _ref1.targetModifier;
+ if (this.target === 'viewport') {
+ this.target = document.body;
+ this.targetModifier = 'visible';
+ } else if (this.target === 'scroll-handle') {
+ this.target = document.body;
+ this.targetModifier = 'scroll-handle';
+ }
+ _ref2 = ['element', 'target'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ key = _ref2[_i];
+ if (this[key] == null) {
+ throw new Error("Tether Error: Both element and target must be defined");
+ }
+ if (this[key].jquery != null) {
+ this[key] = this[key][0];
+ } else if (typeof this[key] === 'string') {
+ this[key] = document.querySelector(this[key]);
+ }
+ }
+ addClass(this.element, this.getClass('element'));
+ addClass(this.target, this.getClass('target'));
+ if (!this.options.attachment) {
+ throw new Error("Tether Error: You must provide an attachment");
+ }
+ this.targetAttachment = parseAttachment(this.options.targetAttachment);
+ this.attachment = parseAttachment(this.options.attachment);
+ this.offset = parseOffset(this.options.offset);
+ this.targetOffset = parseOffset(this.options.targetOffset);
+ if (this.scrollParent != null) {
+ this.disable();
+ }
+ if (this.targetModifier === 'scroll-handle') {
+ this.scrollParent = this.target;
+ } else {
+ this.scrollParent = getScrollParent(this.target);
+ }
+ if (this.options.enabled !== false) {
+ return this.enable(position);
+ }
+ };
+
+ _Tether.prototype.getTargetBounds = function() {
+ var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target;
+ if (this.targetModifier != null) {
+ switch (this.targetModifier) {
+ case 'visible':
+ if (this.target === document.body) {
+ return {
+ top: pageYOffset,
+ left: pageXOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(this.target);
+ out = {
+ height: bounds.height,
+ width: bounds.width,
+ top: bounds.top,
+ left: bounds.left
+ };
+ out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
+ out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight)));
+ out.height = Math.min(innerHeight, out.height);
+ out.height -= 2;
+ out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
+ out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth)));
+ out.width = Math.min(innerWidth, out.width);
+ out.width -= 2;
+ if (out.top < pageYOffset) {
+ out.top = pageYOffset;
+ }
+ if (out.left < pageXOffset) {
+ out.left = pageXOffset;
+ }
+ return out;
+ }
+ break;
+ case 'scroll-handle':
+ target = this.target;
+ if (target === document.body) {
+ target = document.documentElement;
+ bounds = {
+ left: pageXOffset,
+ top: pageYOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(target);
+ }
+ style = getComputedStyle(target);
+ hasBottomScroll = target.scrollWidth > target.clientWidth || 'scroll' === [style.overflow, style.overflowX] || this.target !== document.body;
+ scrollBottom = 0;
+ if (hasBottomScroll) {
+ scrollBottom = 15;
+ }
+ height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
+ out = {
+ width: 15,
+ height: height * 0.975 * (height / target.scrollHeight),
+ left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
+ };
+ fitAdj = 0;
+ if (height < 408 && this.target === document.body) {
+ fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
+ }
+ if (this.target !== document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ scrollPercentage = this.target.scrollTop / (target.scrollHeight - height);
+ out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
+ if (this.target === document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ return out;
+ }
+ } else {
+ return getBounds(this.target);
+ }
+ };
+
+ _Tether.prototype.clearCache = function() {
+ return this._cache = {};
+ };
+
+ _Tether.prototype.cache = function(k, getter) {
+ if (this._cache == null) {
+ this._cache = {};
+ }
+ if (this._cache[k] == null) {
+ this._cache[k] = getter.call(this);
+ }
+ return this._cache[k];
+ };
+
+ _Tether.prototype.enable = function(position) {
+ if (position == null) {
+ position = true;
+ }
+ addClass(this.target, this.getClass('enabled'));
+ addClass(this.element, this.getClass('enabled'));
+ this.enabled = true;
+ if (this.scrollParent !== document) {
+ this.scrollParent.addEventListener('scroll', this.position);
+ }
+ if (position) {
+ return this.position();
+ }
+ };
+
+ _Tether.prototype.disable = function() {
+ removeClass(this.target, this.getClass('enabled'));
+ removeClass(this.element, this.getClass('enabled'));
+ this.enabled = false;
+ if (this.scrollParent != null) {
+ return this.scrollParent.removeEventListener('scroll', this.position);
+ }
+ };
+
+ _Tether.prototype.destroy = function() {
+ var i, tether, _i, _len, _results;
+ this.disable();
+ _results = [];
+ for (i = _i = 0, _len = tethers.length; _i < _len; i = ++_i) {
+ tether = tethers[i];
+ if (tether === this) {
+ tethers.splice(i, 1);
+ break;
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ _Tether.prototype.updateAttachClasses = function(elementAttach, targetAttach) {
+ var add, all, side, sides, _i, _j, _len, _len1, _ref1,
+ _this = this;
+ if (elementAttach == null) {
+ elementAttach = this.attachment;
+ }
+ if (targetAttach == null) {
+ targetAttach = this.targetAttachment;
+ }
+ sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
+ if ((_ref1 = this._addAttachClasses) != null ? _ref1.length : void 0) {
+ this._addAttachClasses.splice(0, this._addAttachClasses.length);
+ }
+ add = this._addAttachClasses != null ? this._addAttachClasses : this._addAttachClasses = [];
+ if (elementAttach.top) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.top);
+ }
+ if (elementAttach.left) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.left);
+ }
+ if (targetAttach.top) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.top);
+ }
+ if (targetAttach.left) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.left);
+ }
+ all = [];
+ for (_i = 0, _len = sides.length; _i < _len; _i++) {
+ side = sides[_i];
+ all.push("" + (this.getClass('element-attached')) + "-" + side);
+ }
+ for (_j = 0, _len1 = sides.length; _j < _len1; _j++) {
+ side = sides[_j];
+ all.push("" + (this.getClass('target-attached')) + "-" + side);
+ }
+ return defer(function() {
+ if (_this._addAttachClasses == null) {
+ return;
+ }
+ updateClasses(_this.element, _this._addAttachClasses, all);
+ updateClasses(_this.target, _this._addAttachClasses, all);
+ return _this._addAttachClasses = void 0;
+ });
+ };
+
+ _Tether.prototype.position = function(flushChanges) {
+ var elementPos, elementStyle, height, left, manualOffset, manualTargetOffset, module, next, offset, offsetBorder, offsetParent, offsetParentSize, offsetParentStyle, offsetPosition, ret, scrollLeft, scrollTop, scrollbarSize, side, targetAttachment, targetOffset, targetPos, targetSize, top, width, _i, _j, _len, _len1, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6,
+ _this = this;
+ if (flushChanges == null) {
+ flushChanges = true;
+ }
+ if (!this.enabled) {
+ return;
+ }
+ this.clearCache();
+ targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
+ this.updateAttachClasses(this.attachment, targetAttachment);
+ elementPos = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ });
+ width = elementPos.width, height = elementPos.height;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref1 = this.lastSize, width = _ref1.width, height = _ref1.height;
+ } else {
+ this.lastSize = {
+ width: width,
+ height: height
+ };
+ }
+ targetSize = targetPos = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ offset = offsetToPx(attachmentToOffset(this.attachment), {
+ width: width,
+ height: height
+ });
+ targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
+ manualOffset = offsetToPx(this.offset, {
+ width: width,
+ height: height
+ });
+ manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
+ offset = addOffset(offset, manualOffset);
+ targetOffset = addOffset(targetOffset, manualTargetOffset);
+ left = targetPos.left + targetOffset.left - offset.left;
+ top = targetPos.top + targetOffset.top - offset.top;
+ _ref2 = Tether.modules;
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ module = _ref2[_i];
+ ret = module.position.call(this, {
+ left: left,
+ top: top,
+ targetAttachment: targetAttachment,
+ targetPos: targetPos,
+ attachment: this.attachment,
+ elementPos: elementPos,
+ offset: offset,
+ targetOffset: targetOffset,
+ manualOffset: manualOffset,
+ manualTargetOffset: manualTargetOffset,
+ scrollbarSize: scrollbarSize
+ });
+ if ((ret == null) || typeof ret !== 'object') {
+ continue;
+ } else if (ret === false) {
+ return false;
+ } else {
+ top = ret.top, left = ret.left;
+ }
+ }
+ next = {
+ page: {
+ top: top,
+ left: left
+ },
+ viewport: {
+ top: top - pageYOffset,
+ bottom: pageYOffset - top - height + innerHeight,
+ left: left - pageXOffset,
+ right: pageXOffset - left - width + innerWidth
+ }
+ };
+ if (document.body.scrollWidth > window.innerWidth) {
+ scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
+ next.viewport.bottom -= scrollbarSize.height;
+ }
+ if (document.body.scrollHeight > window.innerHeight) {
+ scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
+ next.viewport.right -= scrollbarSize.width;
+ }
+ if (((_ref3 = document.body.style.position) !== '' && _ref3 !== 'static') || ((_ref4 = document.body.parentElement.style.position) !== '' && _ref4 !== 'static')) {
+ next.page.bottom = document.body.scrollHeight - top - height;
+ next.page.right = document.body.scrollWidth - left - width;
+ }
+ if (((_ref5 = this.options.optimizations) != null ? _ref5.moveElement : void 0) !== false && (this.targetModifier == null)) {
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ offsetPosition = this.cache('target-offsetparent-bounds', function() {
+ return getBounds(offsetParent);
+ });
+ offsetParentStyle = getComputedStyle(offsetParent);
+ elementStyle = getComputedStyle(this.element);
+ offsetParentSize = offsetPosition;
+ offsetBorder = {};
+ _ref6 = ['Top', 'Left', 'Bottom', 'Right'];
+ for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
+ side = _ref6[_j];
+ offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle["border" + side + "Width"]);
+ }
+ offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
+ offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
+ if (next.page.top >= (offsetPosition.top + offsetBorder.top) && next.page.bottom >= offsetPosition.bottom) {
+ if (next.page.left >= (offsetPosition.left + offsetBorder.left) && next.page.right >= offsetPosition.right) {
+ scrollTop = offsetParent.scrollTop;
+ scrollLeft = offsetParent.scrollLeft;
+ next.offset = {
+ top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
+ left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
+ };
+ }
+ }
+ }
+ this.move(next);
+ this.history.unshift(next);
+ if (this.history.length > 3) {
+ this.history.pop();
+ }
+ if (flushChanges) {
+ flush();
+ }
+ return true;
+ };
+
+ _Tether.prototype.move = function(position) {
+ var css, elVal, found, key, moved, offsetParent, point, same, transcribe, type, val, write, writeCSS, _i, _len, _ref1, _ref2,
+ _this = this;
+ if (this.element.parentNode == null) {
+ return;
+ }
+ same = {};
+ for (type in position) {
+ same[type] = {};
+ for (key in position[type]) {
+ found = false;
+ _ref1 = this.history;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ point = _ref1[_i];
+ if (!within((_ref2 = point[type]) != null ? _ref2[key] : void 0, position[type][key])) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ same[type][key] = true;
+ }
+ }
+ }
+ css = {
+ top: '',
+ left: '',
+ right: '',
+ bottom: ''
+ };
+ transcribe = function(same, pos) {
+ var xPos, yPos, _ref3;
+ if (((_ref3 = _this.options.optimizations) != null ? _ref3.gpu : void 0) !== false) {
+ if (same.top) {
+ css.top = 0;
+ yPos = pos.top;
+ } else {
+ css.bottom = 0;
+ yPos = -pos.bottom;
+ }
+ if (same.left) {
+ css.left = 0;
+ xPos = pos.left;
+ } else {
+ css.right = 0;
+ xPos = -pos.right;
+ }
+ css[transformKey] = "translateX(" + (Math.round(xPos)) + "px) translateY(" + (Math.round(yPos)) + "px)";
+ if (transformKey !== 'msTransform') {
+ return css[transformKey] += " translateZ(0)";
+ }
+ } else {
+ if (same.top) {
+ css.top = "" + pos.top + "px";
+ } else {
+ css.bottom = "" + pos.bottom + "px";
+ }
+ if (same.left) {
+ return css.left = "" + pos.left + "px";
+ } else {
+ return css.right = "" + pos.right + "px";
+ }
+ }
+ };
+ moved = false;
+ if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
+ css.position = 'absolute';
+ transcribe(same.page, position.page);
+ } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
+ css.position = 'fixed';
+ transcribe(same.viewport, position.viewport);
+ } else if ((same.offset != null) && same.offset.top && same.offset.left) {
+ css.position = 'absolute';
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ if (getOffsetParent(this.element) !== offsetParent) {
+ defer(function() {
+ _this.element.parentNode.removeChild(_this.element);
+ return offsetParent.appendChild(_this.element);
+ });
+ }
+ transcribe(same.offset, position.offset);
+ moved = true;
+ } else {
+ css.position = 'absolute';
+ transcribe({
+ top: true,
+ left: true
+ }, position.page);
+ }
+ if (!moved && this.element.parentNode.tagName !== 'BODY') {
+ this.element.parentNode.removeChild(this.element);
+ document.body.appendChild(this.element);
+ }
+ writeCSS = {};
+ write = false;
+ for (key in css) {
+ val = css[key];
+ elVal = this.element.style[key];
+ if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) {
+ elVal = parseFloat(elVal);
+ val = parseFloat(val);
+ }
+ if (elVal !== val) {
+ write = true;
+ writeCSS[key] = css[key];
+ }
+ }
+ if (write) {
+ return defer(function() {
+ return extend(_this.element.style, writeCSS);
+ });
+ }
+ };
+
+ return _Tether;
+
+ })();
+
+ Tether.position = position;
+
+ this.Tether = extend(_Tether, Tether);
+
+}).call(this);
+
+(function() {
+ var BOUNDS_FORMAT, MIRROR_ATTACH, defer, extend, getBoundingRect, getBounds, getOuterSize, getSize, updateClasses, _ref,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+
+ _ref = this.Tether.Utils, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getSize = _ref.getSize, extend = _ref.extend, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ MIRROR_ATTACH = {
+ left: 'right',
+ right: 'left',
+ top: 'bottom',
+ bottom: 'top',
+ middle: 'middle'
+ };
+
+ BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
+
+ getBoundingRect = function(tether, to) {
+ var i, pos, side, size, style, _i, _len;
+ if (to === 'scrollParent') {
+ to = tether.scrollParent;
+ } else if (to === 'window') {
+ to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
+ }
+ if (to === document) {
+ to = to.documentElement;
+ }
+ if (to.nodeType != null) {
+ pos = size = getBounds(to);
+ style = getComputedStyle(to);
+ to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
+ for (i = _i = 0, _len = BOUNDS_FORMAT.length; _i < _len; i = ++_i) {
+ side = BOUNDS_FORMAT[i];
+ side = side[0].toUpperCase() + side.substr(1);
+ if (side === 'Top' || side === 'Left') {
+ to[i] += parseFloat(style["border" + side + "Width"]);
+ } else {
+ to[i] -= parseFloat(style["border" + side + "Width"]);
+ }
+ }
+ }
+ return to;
+ };
+
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var addClasses, allClasses, attachment, bounds, changeAttachX, changeAttachY, cls, constraint, eAttachment, height, left, oob, oobClass, p, pin, pinned, pinnedClass, removeClass, side, tAttachment, targetAttachment, targetHeight, targetSize, targetWidth, to, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8,
+ _this = this;
+ top = _arg.top, left = _arg.left, targetAttachment = _arg.targetAttachment;
+ if (!this.options.constraints) {
+ return true;
+ }
+ removeClass = function(prefix) {
+ var side, _i, _len, _results;
+ _this.removeClass(prefix);
+ _results = [];
+ for (_i = 0, _len = BOUNDS_FORMAT.length; _i < _len; _i++) {
+ side = BOUNDS_FORMAT[_i];
+ _results.push(_this.removeClass("" + prefix + "-" + side));
+ }
+ return _results;
+ };
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref2 = this.lastSize, width = _ref2.width, height = _ref2.height;
+ }
+ targetSize = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ targetHeight = targetSize.height;
+ targetWidth = targetSize.width;
+ tAttachment = {};
+ eAttachment = {};
+ allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
+ _ref3 = this.options.constraints;
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ constraint = _ref3[_i];
+ if (constraint.outOfBoundsClass) {
+ allClasses.push(constraint.outOfBoundsClass);
+ }
+ if (constraint.pinnedClass) {
+ allClasses.push(constraint.pinnedClass);
+ }
+ }
+ for (_j = 0, _len1 = allClasses.length; _j < _len1; _j++) {
+ cls = allClasses[_j];
+ _ref4 = ['left', 'top', 'right', 'bottom'];
+ for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
+ side = _ref4[_k];
+ allClasses.push("" + cls + "-" + side);
+ }
+ }
+ addClasses = [];
+ tAttachment = extend({}, targetAttachment);
+ eAttachment = extend({}, this.attachment);
+ _ref5 = this.options.constraints;
+ for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) {
+ constraint = _ref5[_l];
+ to = constraint.to, attachment = constraint.attachment, pin = constraint.pin;
+ if (attachment == null) {
+ attachment = '';
+ }
+ if (__indexOf.call(attachment, ' ') >= 0) {
+ _ref6 = attachment.split(' '), changeAttachY = _ref6[0], changeAttachX = _ref6[1];
+ } else {
+ changeAttachX = changeAttachY = attachment;
+ }
+ bounds = getBoundingRect(this, to);
+ if (changeAttachY === 'target' || changeAttachY === 'both') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ }
+ }
+ if (changeAttachY === 'together') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ if (eAttachment.top === 'bottom') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top += height;
+ eAttachment.top = 'top';
+ } else if (eAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ if (eAttachment.top === 'top') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (eAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ if (tAttachment.top === 'middle') {
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ }
+ if (changeAttachX === 'target' || changeAttachX === 'both') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ }
+ if (left + width > bounds[2] && tAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ }
+ }
+ if (changeAttachX === 'together') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ if (eAttachment.left === 'right') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left += width;
+ eAttachment.left = 'left';
+ } else if (eAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ } else if (left + width > bounds[2] && tAttachment.left === 'right') {
+ if (eAttachment.left === 'left') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (eAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left += width;
+ eAttachment.left = 'left';
+ }
+ } else if (tAttachment.left === 'center') {
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ }
+ }
+ if (changeAttachY === 'element' || changeAttachY === 'both') {
+ if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (changeAttachX === 'element' || changeAttachX === 'both') {
+ if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ }
+ if (typeof pin === 'string') {
+ pin = (function() {
+ var _len4, _m, _ref7, _results;
+ _ref7 = pin.split(',');
+ _results = [];
+ for (_m = 0, _len4 = _ref7.length; _m < _len4; _m++) {
+ p = _ref7[_m];
+ _results.push(p.trim());
+ }
+ return _results;
+ })();
+ } else if (pin === true) {
+ pin = ['top', 'left', 'right', 'bottom'];
+ }
+ pin || (pin = []);
+ pinned = [];
+ oob = [];
+ if (top < bounds[1]) {
+ if (__indexOf.call(pin, 'top') >= 0) {
+ top = bounds[1];
+ pinned.push('top');
+ } else {
+ oob.push('top');
+ }
+ }
+ if (top + height > bounds[3]) {
+ if (__indexOf.call(pin, 'bottom') >= 0) {
+ top = bounds[3] - height;
+ pinned.push('bottom');
+ } else {
+ oob.push('bottom');
+ }
+ }
+ if (left < bounds[0]) {
+ if (__indexOf.call(pin, 'left') >= 0) {
+ left = bounds[0];
+ pinned.push('left');
+ } else {
+ oob.push('left');
+ }
+ }
+ if (left + width > bounds[2]) {
+ if (__indexOf.call(pin, 'right') >= 0) {
+ left = bounds[2] - width;
+ pinned.push('right');
+ } else {
+ oob.push('right');
+ }
+ }
+ if (pinned.length) {
+ pinnedClass = (_ref7 = this.options.pinnedClass) != null ? _ref7 : this.getClass('pinned');
+ addClasses.push(pinnedClass);
+ for (_m = 0, _len4 = pinned.length; _m < _len4; _m++) {
+ side = pinned[_m];
+ addClasses.push("" + pinnedClass + "-" + side);
+ }
+ }
+ if (oob.length) {
+ oobClass = (_ref8 = this.options.outOfBoundsClass) != null ? _ref8 : this.getClass('out-of-bounds');
+ addClasses.push(oobClass);
+ for (_n = 0, _len5 = oob.length; _n < _len5; _n++) {
+ side = oob[_n];
+ addClasses.push("" + oobClass + "-" + side);
+ }
+ }
+ if (__indexOf.call(pinned, 'left') >= 0 || __indexOf.call(pinned, 'right') >= 0) {
+ eAttachment.left = tAttachment.left = false;
+ }
+ if (__indexOf.call(pinned, 'top') >= 0 || __indexOf.call(pinned, 'bottom') >= 0) {
+ eAttachment.top = tAttachment.top = false;
+ }
+ if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== this.attachment.top || eAttachment.left !== this.attachment.left) {
+ this.updateAttachClasses(eAttachment, tAttachment);
+ }
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+(function() {
+ var defer, getBounds, updateClasses, _ref;
+
+ _ref = this.Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5,
+ _this = this;
+ top = _arg.top, left = _arg.left;
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ targetPos = this.getTargetBounds();
+ bottom = top + height;
+ right = left + width;
+ abutted = [];
+ if (top <= targetPos.bottom && bottom >= targetPos.top) {
+ _ref2 = ['left', 'right'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ side = _ref2[_i];
+ if ((_ref3 = targetPos[side]) === left || _ref3 === right) {
+ abutted.push(side);
+ }
+ }
+ }
+ if (left <= targetPos.right && right >= targetPos.left) {
+ _ref4 = ['top', 'bottom'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) {
+ abutted.push(side);
+ }
+ }
+ }
+ allClasses = [];
+ addClasses = [];
+ sides = ['left', 'top', 'right', 'bottom'];
+ allClasses.push(this.getClass('abutted'));
+ for (_k = 0, _len2 = sides.length; _k < _len2; _k++) {
+ side = sides[_k];
+ allClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ if (abutted.length) {
+ addClasses.push(this.getClass('abutted'));
+ }
+ for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) {
+ side = abutted[_l];
+ addClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return true;
+ }
+ });
+
+}).call(this);
+
+(function() {
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var left, result, shift, shiftLeft, shiftTop, top, _ref;
+ top = _arg.top, left = _arg.left;
+ if (!this.options.shift) {
+ return;
+ }
+ result = function(val) {
+ if (typeof val === 'function') {
+ return val.call(this, {
+ top: top,
+ left: left
+ });
+ } else {
+ return val;
+ }
+ };
+ shift = result(this.options.shift);
+ if (typeof shift === 'string') {
+ shift = shift.split(' ');
+ shift[1] || (shift[1] = shift[0]);
+ shiftTop = shift[0], shiftLeft = shift[1];
+ shiftTop = parseFloat(shiftTop, 10);
+ shiftLeft = parseFloat(shiftLeft, 10);
+ } else {
+ _ref = [shift.top, shift.left], shiftTop = _ref[0], shiftLeft = _ref[1];
+ }
+ top += shiftTop;
+ left += shiftLeft;
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+return this.Tether;
+
+}));
+
+(function() {
+ var ATTACHMENT, Evented, Shepherd, Step, Tour, addClass, createFromHTML, extend, getBounds, matchesSelector, parseShorthand, removeClass, uniqueId, _ref,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ _ref = Tether.Utils, extend = _ref.extend, removeClass = _ref.removeClass, addClass = _ref.addClass, Evented = _ref.Evented, getBounds = _ref.getBounds, uniqueId = _ref.uniqueId;
+
+ ATTACHMENT = {
+ 'top': 'top center',
+ 'left': 'middle right',
+ 'right': 'middle left',
+ 'bottom': 'bottom center'
+ };
+
+ createFromHTML = function(html) {
+ var el;
+ el = document.createElement('div');
+ el.innerHTML = html;
+ return el.children[0];
+ };
+
+ matchesSelector = function(el, sel) {
+ var matches, _ref1, _ref2, _ref3, _ref4;
+ matches = (_ref1 = (_ref2 = (_ref3 = (_ref4 = el.matches) != null ? _ref4 : el.matchesSelector) != null ? _ref3 : el.webkitMatchesSelector) != null ? _ref2 : el.mozMatchesSelector) != null ? _ref1 : el.oMatchesSelector;
+ return matches.call(el, sel);
+ };
+
+ parseShorthand = function(obj, props) {
+ var i, out, prop, vals, _i, _len;
+ if (obj == null) {
+ return obj;
+ } else if (typeof obj === 'object') {
+ return obj;
+ } else {
+ vals = obj.split(' ');
+ if (vals.length > props.length) {
+ vals[0] = vals.slice(0, +(vals.length - props.length) + 1 || 9e9).join(' ');
+ vals.splice(1, vals.length - props.length);
+ }
+ out = {};
+ for (i = _i = 0, _len = props.length; _i < _len; i = ++_i) {
+ prop = props[i];
+ out[prop] = vals[i];
+ }
+ return out;
+ }
+ };
+
+ Step = (function(_super) {
+ __extends(Step, _super);
+
+ function Step(tour, options) {
+ this.tour = tour;
+ this.destroy = __bind(this.destroy, this);
+ this.scrollTo = __bind(this.scrollTo, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.isOpen = __bind(this.isOpen, this);
+ this.hide = __bind(this.hide, this);
+ this.show = __bind(this.show, this);
+ this.setOptions(options);
+ this;
+ }
+
+ Step.prototype.setOptions = function(options) {
+ var event, handler, _base, _ref1;
+ this.options = options != null ? options : {};
+ this.destroy();
+ this.id = this.options.id || this.id || ("step-" + (uniqueId()));
+ if (this.options.when) {
+ _ref1 = this.options.when;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ this.on(event, handler, this);
+ }
+ }
+ return (_base = this.options).buttons != null ? (_base = this.options).buttons : _base.buttons = [
+ {
+ text: 'Next',
+ action: this.tour.next
+ }
+ ];
+ };
+
+ Step.prototype.getTour = function() {
+ return this.tour;
+ };
+
+ Step.prototype.bindAdvance = function() {
+ var event, handler, selector, _ref1,
+ _this = this;
+ _ref1 = parseShorthand(this.options.advanceOn, ['selector', 'event']), event = _ref1.event, selector = _ref1.selector;
+ handler = function(e) {
+ if (!_this.isOpen()) {
+ return;
+ }
+ if (selector != null) {
+ if (matchesSelector(e.target, selector)) {
+ return _this.tour.next();
+ }
+ } else {
+ if (_this.el && e.target === _this.el) {
+ return _this.tour.next();
+ }
+ }
+ };
+ document.body.addEventListener(event, handler);
+ return this.on('destroy', function() {
+ return document.body.removeEventListener(event, handler);
+ });
+ };
+
+ Step.prototype.getAttachTo = function() {
+ var opts;
+ opts = parseShorthand(this.options.attachTo, ['element', 'on']);
+ if (opts == null) {
+ opts = {};
+ }
+ if (typeof opts.element === 'string') {
+ opts.element = document.querySelector(opts.element);
+ if (opts.element == null) {
+ throw new Error("Shepherd step's attachTo was not found in the page");
+ }
+ }
+ return opts;
+ };
+
+ Step.prototype.setupTether = function() {
+ var attachment, opts, tetherOpts;
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("Using the attachment feature of Shepherd requires the Tether library");
+ }
+ opts = this.getAttachTo();
+ attachment = ATTACHMENT[opts.on || 'right'];
+ if (opts.element == null) {
+ opts.element = 'viewport';
+ attachment = 'middle center';
+ }
+ tetherOpts = {
+ classPrefix: 'shepherd',
+ element: this.el,
+ constraints: [
+ {
+ to: 'window',
+ pin: true,
+ attachment: 'together'
+ }
+ ],
+ target: opts.element,
+ offset: opts.offset || '0 0',
+ attachment: attachment
+ };
+ return this.tether = new Tether(extend(tetherOpts, this.options.tetherOptions));
+ };
+
+ Step.prototype.show = function() {
+ var _ref1,
+ _this = this;
+ if (this.el == null) {
+ this.render();
+ }
+ addClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.enable();
+ }
+ if (this.options.scrollTo) {
+ setTimeout(function() {
+ return _this.scrollTo();
+ });
+ }
+ return this.trigger('show');
+ };
+
+ Step.prototype.hide = function() {
+ var _ref1;
+ removeClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.disable();
+ }
+ return this.trigger('hide');
+ };
+
+ Step.prototype.isOpen = function() {
+ return hasClass(this.el, 'shepherd-open');
+ };
+
+ Step.prototype.cancel = function() {
+ this.hide();
+ return this.trigger('cancel');
+ };
+
+ Step.prototype.complete = function() {
+ this.hide();
+ return this.trigger('complete');
+ };
+
+ Step.prototype.scrollTo = function() {
+ var element;
+ element = this.getAttachTo().element;
+ return element != null ? element.scrollIntoView() : void 0;
+ };
+
+ Step.prototype.destroy = function() {
+ var _ref1;
+ if (this.el != null) {
+ document.body.removeChild(this.el);
+ delete this.el;
+ }
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ return this.trigger('destroy');
+ };
+
+ Step.prototype.render = function() {
+ var button, buttons, cfg, content, footer, header, paragraph, paragraphs, text, _i, _j, _len, _len1, _ref1, _ref2, _ref3;
+ if (this.el != null) {
+ this.destroy();
+ }
+ this.el = createFromHTML("");
+ content = document.createElement('div');
+ content.className = 'shepherd-content';
+ this.el.appendChild(content);
+ if (this.options.title != null) {
+ header = document.createElement('header');
+ header.innerHTML = "" + this.options.title + "
";
+ this.el.className += ' shepherd-has-title';
+ content.appendChild(header);
+ }
+ if (this.options.text != null) {
+ text = createFromHTML("");
+ paragraphs = this.options.text;
+ if (typeof paragraphs === 'string') {
+ paragraphs = [paragraphs];
+ }
+ for (_i = 0, _len = paragraphs.length; _i < _len; _i++) {
+ paragraph = paragraphs[_i];
+ text.innerHTML += "" + paragraph + "
";
+ }
+ content.appendChild(text);
+ }
+ footer = document.createElement('footer');
+ if (this.options.buttons) {
+ buttons = createFromHTML("");
+ _ref2 = this.options.buttons;
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
+ cfg = _ref2[_j];
+ button = createFromHTML("" + cfg.text + "");
+ buttons.appendChild(button);
+ this.bindButtonEvents(cfg, button.querySelector('a'));
+ }
+ footer.appendChild(buttons);
+ }
+ content.appendChild(footer);
+ document.body.appendChild(this.el);
+ this.setupTether();
+ if (this.options.advanceOn) {
+ return this.bindAdvance();
+ }
+ };
+
+ Step.prototype.bindButtonEvents = function(cfg, el) {
+ var event, handler, page, _ref1,
+ _this = this;
+ if (cfg.events == null) {
+ cfg.events = {};
+ }
+ if (cfg.action != null) {
+ cfg.events.click = cfg.action;
+ }
+ _ref1 = cfg.events;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ if (typeof handler === 'string') {
+ page = handler;
+ handler = function() {
+ return _this.tour.show(page);
+ };
+ }
+ el.addEventListener(event, handler);
+ }
+ return this.on('destroy', function() {
+ var _ref2, _results;
+ _ref2 = cfg.events;
+ _results = [];
+ for (event in _ref2) {
+ handler = _ref2[event];
+ _results.push(el.removeEventListener(event, handler));
+ }
+ return _results;
+ });
+ };
+
+ return Step;
+
+ })(Evented);
+
+ Tour = (function(_super) {
+ __extends(Tour, _super);
+
+ function Tour(options) {
+ var event, _i, _len, _ref1, _ref2,
+ _this = this;
+ this.options = options != null ? options : {};
+ this.hide = __bind(this.hide, this);
+ this.cancel = __bind(this.cancel, this);
+ this.back = __bind(this.back, this);
+ this.next = __bind(this.next, this);
+ this.steps = (_ref1 = this.options.steps) != null ? _ref1 : [];
+ _ref2 = ['complete', 'cancel', 'hide', 'start', 'show'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ event = _ref2[_i];
+ this.on(event, function(opts) {
+ if (opts == null) {
+ opts = {};
+ }
+ opts.tour = _this;
+ return Shepherd.trigger(event, opts);
+ });
+ }
+ this;
+ }
+
+ Tour.prototype.addStep = function(name, step) {
+ var _ref1;
+ if (step == null) {
+ step = name;
+ }
+ if (!(step instanceof Step)) {
+ if ((_ref1 = typeof name) === 'string' || _ref1 === 'number') {
+ step.id = name.toString();
+ }
+ step = extend({}, this.options.defaults, step);
+ step = new Step(this, step);
+ } else {
+ step.tour = this;
+ }
+ this.steps.push(step);
+ return step;
+ };
+
+ Tour.prototype.getById = function(id) {
+ var step, _i, _len, _ref1;
+ _ref1 = this.steps;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ step = _ref1[_i];
+ if (step.id === id) {
+ return step;
+ }
+ }
+ };
+
+ Tour.prototype.getCurrentStep = function() {
+ return this.currentStep;
+ };
+
+ Tour.prototype.next = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ if (index === this.steps.length - 1) {
+ this.hide(index);
+ this.trigger('complete');
+ return this.done();
+ } else {
+ return this.show(index + 1);
+ }
+ };
+
+ Tour.prototype.back = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ return this.show(index - 1);
+ };
+
+ Tour.prototype.cancel = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.cancel();
+ }
+ this.trigger('cancel');
+ return this.done();
+ };
+
+ Tour.prototype.hide = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('hide');
+ return this.done();
+ };
+
+ Tour.prototype.done = function() {
+ return Shepherd.activeTour = null;
+ };
+
+ Tour.prototype.show = function(key) {
+ var next;
+ if (key == null) {
+ key = 0;
+ }
+ if (this.currentStep) {
+ this.currentStep.hide();
+ }
+ Shepherd.activeTour = this;
+ if (typeof key === 'string') {
+ next = this.getById(key);
+ } else {
+ next = this.steps[key];
+ }
+ if (next) {
+ this.trigger('show', {
+ step: next,
+ previous: this.currentStep
+ });
+ this.currentStep = next;
+ return next.show();
+ }
+ };
+
+ Tour.prototype.start = function() {
+ this.trigger('start');
+ this.currentStep = null;
+ return this.next();
+ };
+
+ return Tour;
+
+ })(Evented);
+
+ Shepherd = new Evented;
+
+ extend(Shepherd, {
+ Tour: Tour,
+ Step: Step,
+ Evented: Evented
+ });
+
+ window.Shepherd = Shepherd;
+
+}).call(this);
diff --git a/ajax/libs/shepherd/0.4.3/shepherd.min.js b/ajax/libs/shepherd/0.4.3/shepherd.min.js
new file mode 100644
index 000000000..c0851c982
--- /dev/null
+++ b/ajax/libs/shepherd/0.4.3/shepherd.min.js
@@ -0,0 +1,2 @@
+/*! shepherd 0.4.3 */
+!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e(require,exports,module):t.Tether=e()}(this,function(){return function(){var t,e,o,i,n,s,r,h,l,a,p,u,f,d,c,g,m,v={}.hasOwnProperty,b=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1},y=[].slice;null==this.Tether&&(this.Tether={modules:[]}),p=function(t){var e,o,i,n,s;if(o=getComputedStyle(t).position,"fixed"===o)return t;for(i=void 0,e=t;e=e.parentNode;){try{n=getComputedStyle(e)}catch(r){}if(null==n)return e;if(/(auto|scroll)/.test(n.overflow+n["overflow-y"]+n["overflow-x"])&&("absolute"!==o||"relative"===(s=n.position)||"absolute"===s||"fixed"===s))return e}return document.body},c=function(){var t;return t=0,function(){return t++}}(),m={},l=function(t){var e,i,s,r,h;if(s=t._tetherZeroElement,null==s&&(s=t.createElement("div"),s.setAttribute("data-tether-id",c()),n(s.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(s),t._tetherZeroElement=s),e=s.getAttribute("data-tether-id"),null==m[e]){m[e]={},h=s.getBoundingClientRect();for(i in h)r=h[i],m[e][i]=r;o(function(){return m[e]=void 0})}return m[e]},f=null,r=function(t){var e,o,i,n,s,r,h;t===document?(o=document,t=document.documentElement):o=t.ownerDocument,i=o.documentElement,e={},h=t.getBoundingClientRect();for(n in h)r=h[n],e[n]=r;return s=l(o),e.top-=s.top,e.left-=s.left,null==e.width&&(e.width=document.body.scrollWidth-e.left-e.right),null==e.height&&(e.height=document.body.scrollHeight-e.top-e.bottom),e.top=e.top-i.clientTop,e.left=e.left-i.clientLeft,e.right=o.body.clientWidth-e.width-e.left,e.bottom=o.body.clientHeight-e.height-e.top,e},h=function(t){return t.offsetParent||document.documentElement},a=function(){var t,e,o,i,s;return t=document.createElement("div"),t.style.width="100%",t.style.height="200px",e=document.createElement("div"),n(e.style,{position:"absolute",top:0,left:0,pointerEvents:"none",visibility:"hidden",width:"200px",height:"150px",overflow:"hidden"}),e.appendChild(t),document.body.appendChild(e),i=t.offsetWidth,e.style.overflow="scroll",s=t.offsetWidth,i===s&&(s=e.clientWidth),document.body.removeChild(e),o=i-s,{width:o,height:o}},n=function(t){var e,o,i,n,s,r,h;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),h=e.slice(1),s=0,r=h.length;r>s;s++)if(i=h[s])for(o in i)v.call(i,o)&&(n=i[o],t[o]=n);return t},d=function(t,e){var o,i,n,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],i=0,n=s.length;n>i;i++)o=s[i],o.trim()&&r.push(t.classList.remove(o));return r}return t.className=t.className.replace(new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi")," ")},e=function(t,e){var o,i,n,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],i=0,n=s.length;n>i;i++)o=s[i],o.trim()&&r.push(t.classList.add(o));return r}return d(t,e),t.className+=" "+e},u=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},g=function(t,o,i){var n,s,r,h,l,a;for(s=0,h=i.length;h>s;s++)n=i[s],b.call(o,n)<0&&u(t,n)&&d(t,n);for(a=[],r=0,l=o.length;l>r;r++)n=o[r],a.push(u(t,n)?void 0:e(t,n));return a},i=[],o=function(t){return i.push(t)},s=function(){var t,e;for(e=[];t=i.pop();)e.push(t());return e},t=function(){function t(){}return t.prototype.on=function(t,e,o,i){var n;return null==i&&(i=!1),null==this.bindings&&(this.bindings={}),null==(n=this.bindings)[t]&&(n[t]=[]),this.bindings[t].push({handler:e,ctx:o,once:i})},t.prototype.once=function(t,e,o){return this.on(t,e,o,!0)},t.prototype.off=function(t,e){var o,i,n;if(null!=(null!=(i=this.bindings)?i[t]:void 0)){if(null==e)return delete this.bindings[t];for(o=0,n=[];o=e&&e>=t-o},x=function(){var t,e,o,i,n;for(t=document.createElement("div"),n=["transform","webkitTransform","OTransform","MozTransform","msTransform"],o=0,i=n.length;i>o;o++)if(e=n[o],void 0!==t.style[e])return e}(),O=[],C=function(){var t,e,o;for(e=0,o=O.length;o>e;e++)t=O[e],t.position(!1);return p()},v=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance?"function"==typeof performance.now?performance.now():void 0:void 0)?t:+new Date},function(){var t,e,o,i,n,s,r,h,l;for(e=null,o=null,i=null,n=function(){if(null!=o&&o>16)return o=Math.min(o-16,250),void(i=setTimeout(n,250));if(!(null!=e&&v()-e<10))return null!=i&&(clearTimeout(i),i=null),e=v(),C(),o=v()-e},h=["resize","scroll","touchmove"],l=[],s=0,r=h.length;r>s;s++)t=h[s],l.push(window.addEventListener(t,n));return l}(),t={center:"center",left:"right",right:"left"},e={middle:"middle",top:"bottom",bottom:"top"},o={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},h=function(o,i){var n,s;return n=o.left,s=o.top,"auto"===n&&(n=t[i.left]),"auto"===s&&(s=e[i.top]),{left:n,top:s}},r=function(t){var e,i;return{left:null!=(e=o[t.left])?e:t.left,top:null!=(i=o[t.top])?i:t.top}},s=function(){var t,e,o,i,n,s,r;for(e=1<=arguments.length?B.call(arguments,0):[],o={top:0,left:0},n=0,s=e.length;s>n;n++)r=e[n],i=r.top,t=r.left,"string"==typeof i&&(i=parseFloat(i,10)),"string"==typeof t&&(t=parseFloat(t,10)),o.top+=i,o.left+=t;return o},b=function(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t},y=w=function(t){var e,o,i;return i=t.split(" "),o=i[0],e=i[1],{top:o,left:e}},A=function(){function t(t){this.position=W(this.position,this);var e,o,n,s,r;for(O.push(this),this.history=[],this.setOptions(t,!1),s=i.modules,o=0,n=s.length;n>o;o++)e=s[o],null!=(r=e.initialize)&&r.call(this);this.position()}return t.modules=[],t.prototype.getClass=function(t){var e,o;return(null!=(e=this.options.classes)?e[t]:void 0)?this.options.classes[t]:(null!=(o=this.options.classes)?o[t]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+t:t:""},t.prototype.setOptions=function(t,e){var o,i,s,r,h,l;for(this.options=t,null==e&&(e=!0),o={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=a(o,this.options),h=this.options,this.element=h.element,this.target=h.target,this.targetModifier=h.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),l=["element","target"],s=0,r=l.length;r>s;s++){if(i=l[s],null==this[i])throw new Error("Tether Error: Both element and target must be defined");null!=this[i].jquery?this[i]=this[i][0]:"string"==typeof this[i]&&(this[i]=document.querySelector(this[i]))}if(n(this.element,this.getClass("element")),n(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=y(this.options.targetAttachment),this.attachment=y(this.options.attachment),this.offset=w(this.options.offset),this.targetOffset=w(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent="scroll-handle"===this.targetModifier?this.target:g(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,o,i,n,s,r,h,l;if(null==this.targetModifier)return u(this.target);switch(this.targetModifier){case"visible":return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:(t=u(this.target),n={height:t.height,width:t.width,top:t.top,left:t.left},n.height=Math.min(n.height,t.height-(pageYOffset-t.top)),n.height=Math.min(n.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),n.height=Math.min(innerHeight,n.height),n.height-=2,n.width=Math.min(n.width,t.width-(pageXOffset-t.left)),n.width=Math.min(n.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),n.width=Math.min(innerWidth,n.width),n.width-=2,n.topl.clientWidth||"scroll"===[h.overflow,h.overflowX]||this.target!==document.body,s=0,o&&(s=15),i=t.height-parseFloat(h.borderTopWidth)-parseFloat(h.borderBottomWidth)-s,n={width:15,height:.975*i*(i/l.scrollHeight),left:t.left+t.width-parseFloat(h.borderLeftWidth)-15},e=0,408>i&&this.target===document.body&&(e=-11e-5*Math.pow(i,2)-.00727*i+22.58),this.target!==document.body&&(n.height=Math.max(n.height,24)),r=this.target.scrollTop/(l.scrollHeight-i),n.top=r*(i-n.height-e)+t.top+parseFloat(h.borderTopWidth),this.target===document.body&&(n.height=Math.max(n.height,24)),n}},t.prototype.clearCache=function(){return this._cache={}},t.prototype.cache=function(t,e){return null==this._cache&&(this._cache={}),null==this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},t.prototype.enable=function(t){return null==t&&(t=!0),n(this.target,this.getClass("enabled")),n(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t?this.position():void 0},t.prototype.disable=function(){return T(this.target,this.getClass("enabled")),T(this.element,this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},t.prototype.destroy=function(){var t,e,o,i,n;for(this.disable(),n=[],t=o=0,i=O.length;i>o;t=++o){if(e=O[t],e===this){O.splice(t,1);break}n.push(void 0)}return n},t.prototype.updateAttachClasses=function(t,e){var o,i,n,s,r,h,a,p,u,f=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),s=["left","top","bottom","right","middle","center"],(null!=(u=this._addAttachClasses)?u.length:void 0)&&this._addAttachClasses.splice(0,this._addAttachClasses.length),o=null!=this._addAttachClasses?this._addAttachClasses:this._addAttachClasses=[],t.top&&o.push(""+this.getClass("element-attached")+"-"+t.top),t.left&&o.push(""+this.getClass("element-attached")+"-"+t.left),e.top&&o.push(""+this.getClass("target-attached")+"-"+e.top),e.left&&o.push(""+this.getClass("target-attached")+"-"+e.left),i=[],r=0,a=s.length;a>r;r++)n=s[r],i.push(""+this.getClass("element-attached")+"-"+n);for(h=0,p=s.length;p>h;h++)n=s[h],i.push(""+this.getClass("target-attached")+"-"+n);return l(function(){return null!=f._addAttachClasses?(S(f.element,f._addAttachClasses,i),S(f.target,f._addAttachClasses,i),f._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,o,n,l,a,d,g,m,v,y,w,C,T,O,x,S,E,A,M,B,W,L,_,P,z,H,F,Y,N,X,j,k,q,U,I,R=this;if(null==t&&(t=!0),this.enabled){for(this.clearCache(),B=h(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,B),e=this.cache("element-bounds",function(){return u(R.element)}),z=e.width,n=e.height,0===z&&0===n&&null!=this.lastSize?(X=this.lastSize,z=X.width,n=X.height):this.lastSize={width:z,height:n},_=L=this.cache("target-bounds",function(){return R.getTargetBounds()}),v=b(r(this.attachment),{width:z,height:n}),W=b(r(B),_),a=b(this.offset,{width:z,height:n}),d=b(this.targetOffset,_),v=s(v,a),W=s(W,d),l=L.left+W.left-v.left,P=L.top+W.top-v.top,j=i.modules,H=0,Y=j.length;Y>H;H++)if(g=j[H],x=g.position.call(this,{left:l,top:P,targetAttachment:B,targetPos:L,attachment:this.attachment,elementPos:e,offset:v,targetOffset:W,manualOffset:a,manualTargetOffset:d,scrollbarSize:A}),null!=x&&"object"==typeof x){if(x===!1)return!1;P=x.top,l=x.left}if(m={page:{top:P,left:l},viewport:{top:P-pageYOffset,bottom:pageYOffset-P-n+innerHeight,left:l-pageXOffset,right:pageXOffset-l-z+innerWidth}},document.body.scrollWidth>window.innerWidth&&(A=this.cache("scrollbar-size",c),m.viewport.bottom-=A.height),document.body.scrollHeight>window.innerHeight&&(A=this.cache("scrollbar-size",c),m.viewport.right-=A.width),(""!==(k=document.body.style.position)&&"static"!==k||""!==(q=document.body.parentElement.style.position)&&"static"!==q)&&(m.page.bottom=document.body.scrollHeight-P-n,m.page.right=document.body.scrollWidth-l-z),(null!=(U=this.options.optimizations)?U.moveElement:void 0)!==!1&&null==this.targetModifier){for(w=this.cache("target-offsetparent",function(){return f(R.target)}),O=this.cache("target-offsetparent-bounds",function(){return u(w)}),T=getComputedStyle(w),o=getComputedStyle(this.element),C=O,y={},I=["Top","Left","Bottom","Right"],F=0,N=I.length;N>F;F++)M=I[F],y[M.toLowerCase()]=parseFloat(T["border"+M+"Width"]);O.right=document.body.scrollWidth-O.left-C.width+y.right,O.bottom=document.body.scrollHeight-O.top-C.height+y.bottom,m.page.top>=O.top+y.top&&m.page.bottom>=O.bottom&&m.page.left>=O.left+y.left&&m.page.right>=O.right&&(E=w.scrollTop,S=w.scrollLeft,m.offset={top:m.page.top-O.top+E-y.top,left:m.page.left-O.left+S-y.left})}return this.move(m),this.history.unshift(m),this.history.length>3&&this.history.pop(),t&&p(),!0}},t.prototype.move=function(t){var e,o,i,n,s,r,h,p,u,d,c,g,m,v,b,y,w,C=this;if(null!=this.element.parentNode){p={};for(d in t){p[d]={};for(n in t[d]){for(i=!1,y=this.history,v=0,b=y.length;b>v;v++)if(h=y[v],!E(null!=(w=h[d])?w[n]:void 0,t[d][n])){i=!0;break}i||(p[d][n]=!0)}}e={top:"",left:"",right:"",bottom:""},u=function(t,o){var i,n,s;return(null!=(s=C.options.optimizations)?s.gpu:void 0)===!1?(t.top?e.top=""+o.top+"px":e.bottom=""+o.bottom+"px",t.left?e.left=""+o.left+"px":e.right=""+o.right+"px"):(t.top?(e.top=0,n=o.top):(e.bottom=0,n=-o.bottom),t.left?(e.left=0,i=o.left):(e.right=0,i=-o.right),e[x]="translateX("+Math.round(i)+"px) translateY("+Math.round(n)+"px)","msTransform"!==x?e[x]+=" translateZ(0)":void 0)},s=!1,(p.page.top||p.page.bottom)&&(p.page.left||p.page.right)?(e.position="absolute",u(p.page,t.page)):(p.viewport.top||p.viewport.bottom)&&(p.viewport.left||p.viewport.right)?(e.position="fixed",u(p.viewport,t.viewport)):null!=p.offset&&p.offset.top&&p.offset.left?(e.position="absolute",r=this.cache("target-offsetparent",function(){return f(C.target)}),f(this.element)!==r&&l(function(){return C.element.parentNode.removeChild(C.element),r.appendChild(C.element)}),u(p.offset,t.offset),s=!0):(e.position="absolute",u({top:!0,left:!0},t.page)),s||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),m={},g=!1;for(n in e)c=e[n],o=this.element.style[n],""===o||""===c||"top"!==n&&"left"!==n&&"bottom"!==n&&"right"!==n||(o=parseFloat(o),c=parseFloat(c)),o!==c&&(g=!0,m[n]=e[n]);return g?l(function(){return a(C.element.style,m)}):void 0}},t}(),i.position=C,this.Tether=a(A,i)}.call(this),function(){var t,e,o,i,n,s,r,h,l,a,p=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1};a=this.Tether.Utils,r=a.getOuterSize,s=a.getBounds,h=a.getSize,i=a.extend,l=a.updateClasses,o=a.defer,e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},t=["left","top","right","bottom"],n=function(e,o){var i,n,r,h,l,a,p;if("scrollParent"===o?o=e.scrollParent:"window"===o&&(o=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),o===document&&(o=o.documentElement),null!=o.nodeType)for(n=h=s(o),l=getComputedStyle(o),o=[n.left,n.top,h.width+n.left,h.height+n.top],i=a=0,p=t.length;p>a;i=++a)r=t[i],r=r[0].toUpperCase()+r.substr(1),"Top"===r||"Left"===r?o[i]+=parseFloat(l["border"+r+"Width"]):o[i]-=parseFloat(l["border"+r+"Width"]);return o},this.Tether.modules.push({position:function(e){var r,h,a,u,f,d,c,g,m,v,b,y,w,C,T,O,x,S,E,A,M,B,W,L,_,P,z,H,F,Y,N,X,j,k,q,U,I,R,D,Z,$,V,G,J,K,Q,te,ee=this;if(P=e.top,b=e.left,M=e.targetAttachment,!this.options.constraints)return!0;for(S=function(e){var o,i,n,s;for(ee.removeClass(e),s=[],i=0,n=t.length;n>i;i++)o=t[i],s.push(ee.removeClass(""+e+"-"+o));return s},Z=this.cache("element-bounds",function(){return s(ee.element)}),v=Z.height,z=Z.width,0===z&&0===v&&null!=this.lastSize&&($=this.lastSize,z=$.width,v=$.height),W=this.cache("target-bounds",function(){return ee.getTargetBounds()}),B=W.height,L=W.width,A={},m={},h=[this.getClass("pinned"),this.getClass("out-of-bounds")],V=this.options.constraints,H=0,X=V.length;X>H;H++)g=V[H],g.outOfBoundsClass&&h.push(g.outOfBoundsClass),g.pinnedClass&&h.push(g.pinnedClass);for(F=0,j=h.length;j>F;F++)for(c=h[F],G=["left","top","right","bottom"],Y=0,k=G.length;k>Y;Y++)E=G[Y],h.push(""+c+"-"+E);for(r=[],A=i({},M),m=i({},this.attachment),J=this.options.constraints,N=0,q=J.length;q>N;N++){if(g=J[N],_=g.to,a=g.attachment,T=g.pin,null==a&&(a=""),p.call(a," ")>=0?(K=a.split(" "),d=K[0],f=K[1]):f=d=a,u=n(this,_),("target"===d||"both"===d)&&(Pu[3]&&"bottom"===A.top&&(P-=B,A.top="top")),"together"===d&&(Pu[3]&&"bottom"===A.top&&("top"===m.top?(P-=B,A.top="top",P-=v,m.top="bottom"):"bottom"===m.top&&(P-=B,A.top="top",P+=v,m.top="top")),"middle"===A.top&&(P+v>u[3]&&"top"===m.top?(P-=v,m.top="bottom"):Pu[2]&&"right"===A.left&&(b-=L,A.left="left")),"together"===f&&(bu[2]&&"right"===A.left?"left"===m.left?(b-=L,A.left="left",b-=z,m.left="right"):"right"===m.left&&(b-=L,A.left="left",b+=z,m.left="left"):"center"===A.left&&(b+z>u[2]&&"left"===m.left?(b-=z,m.left="right"):bu[3]&&"top"===m.top&&(P-=v,m.top="bottom")),("element"===f||"both"===f)&&(bu[2]&&"left"===m.left&&(b-=z,m.left="right")),"string"==typeof T?T=function(){var t,e,o,i;for(o=T.split(","),i=[],e=0,t=o.length;t>e;e++)C=o[e],i.push(C.trim());return i}():T===!0&&(T=["top","left","right","bottom"]),T||(T=[]),O=[],y=[],P=0?(P=u[1],O.push("top")):y.push("top")),P+v>u[3]&&(p.call(T,"bottom")>=0?(P=u[3]-v,O.push("bottom")):y.push("bottom")),b=0?(b=u[0],O.push("left")):y.push("left")),b+z>u[2]&&(p.call(T,"right")>=0?(b=u[2]-z,O.push("right")):y.push("right")),O.length)for(x=null!=(Q=this.options.pinnedClass)?Q:this.getClass("pinned"),r.push(x),R=0,U=O.length;U>R;R++)E=O[R],r.push(""+x+"-"+E);if(y.length)for(w=null!=(te=this.options.outOfBoundsClass)?te:this.getClass("out-of-bounds"),r.push(w),D=0,I=y.length;I>D;D++)E=y[D],r.push(""+w+"-"+E);(p.call(O,"left")>=0||p.call(O,"right")>=0)&&(m.left=A.left=!1),(p.call(O,"top")>=0||p.call(O,"bottom")>=0)&&(m.top=A.top=!1),(A.top!==M.top||A.left!==M.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,A)}return o(function(){return l(ee.target,r,h),l(ee.element,r,h)}),{top:P,left:b}}})}.call(this),function(){var t,e,o,i;i=this.Tether.Utils,e=i.getBounds,o=i.updateClasses,t=i.defer,this.Tether.modules.push({position:function(i){var n,s,r,h,l,a,p,u,f,d,c,g,m,v,b,y,w,C,T,O,x,S,E,A,M,B=this;if(c=i.top,a=i.left,x=this.cache("element-bounds",function(){return e(B.element)}),l=x.height,g=x.width,d=this.getTargetBounds(),h=c+l,p=a+g,n=[],c<=d.bottom&&h>=d.top)for(S=["left","right"],m=0,w=S.length;w>m;m++)u=S[m],((E=d[u])===a||E===p)&&n.push(u);if(a<=d.right&&p>=d.left)for(A=["top","bottom"],v=0,C=A.length;C>v;v++)u=A[v],((M=d[u])===c||M===h)&&n.push(u);for(r=[],s=[],f=["left","top","right","bottom"],r.push(this.getClass("abutted")),b=0,T=f.length;T>b;b++)u=f[b],r.push(""+this.getClass("abutted")+"-"+u);for(n.length&&s.push(this.getClass("abutted")),y=0,O=n.length;O>y;y++)u=n[y],s.push(""+this.getClass("abutted")+"-"+u);return t(function(){return o(B.target,s,r),o(B.element,s,r)}),!0}})}.call(this),function(){this.Tether.modules.push({position:function(t){var e,o,i,n,s,r,h;return r=t.top,e=t.left,this.options.shift?(o=function(t){return"function"==typeof t?t.call(this,{top:r,left:e}):t},i=o(this.options.shift),"string"==typeof i?(i=i.split(" "),i[1]||(i[1]=i[0]),s=i[0],n=i[1],s=parseFloat(s,10),n=parseFloat(n,10)):(h=[i.top,i.left],s=h[0],n=h[1]),r+=s,e+=n,{top:r,left:e}):void 0}})}.call(this),this.Tether}),function(){var t,e,o,i,n,s,r,h,l,a,p,u,f,d,c=function(t,e){return function(){return t.apply(e,arguments)}},g={}.hasOwnProperty,m=function(t,e){function o(){this.constructor=t}for(var i in e)g.call(e,i)&&(t[i]=e[i]);return o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype,t};d=Tether.Utils,h=d.extend,u=d.removeClass,s=d.addClass,e=d.Evented,l=d.getBounds,f=d.uniqueId,t={top:"top center",left:"middle right",right:"middle left",bottom:"bottom center"},r=function(t){var e;return e=document.createElement("div"),e.innerHTML=t,e.children[0]},a=function(t,e){var o,i,n,s,r;return o=null!=(i=null!=(n=null!=(s=null!=(r=t.matches)?r:t.matchesSelector)?s:t.webkitMatchesSelector)?n:t.mozMatchesSelector)?i:t.oMatchesSelector,o.call(t,e)},p=function(t,e){var o,i,n,s,r,h;if(null==t)return t;if("object"==typeof t)return t;for(s=t.split(" "),s.length>e.length&&(s[0]=s.slice(0,+(s.length-e.length)+1||9e9).join(" "),s.splice(1,s.length-e.length)),i={},o=r=0,h=e.length;h>r;o=++r)n=e[o],i[n]=s[o];return i},i=function(e){function o(t,e){this.tour=t,this.destroy=c(this.destroy,this),this.scrollTo=c(this.scrollTo,this),this.complete=c(this.complete,this),this.cancel=c(this.cancel,this),this.isOpen=c(this.isOpen,this),this.hide=c(this.hide,this),this.show=c(this.show,this),this.setOptions(e)}return m(o,e),o.prototype.setOptions=function(t){var e,o,i,n;if(this.options=null!=t?t:{},this.destroy(),this.id=this.options.id||this.id||"step-"+f(),this.options.when){n=this.options.when;for(e in n)o=n[e],this.on(e,o,this)}return null!=(i=this.options).buttons?(i=this.options).buttons:i.buttons=[{text:"Next",action:this.tour.next}]},o.prototype.getTour=function(){return this.tour},o.prototype.bindAdvance=function(){var t,e,o,i,n=this;return i=p(this.options.advanceOn,["selector","event"]),t=i.event,o=i.selector,e=function(t){if(n.isOpen())if(null!=o){if(a(t.target,o))return n.tour.next()}else if(n.el&&t.target===n.el)return n.tour.next()},document.body.addEventListener(t,e),this.on("destroy",function(){return document.body.removeEventListener(t,e)})},o.prototype.getAttachTo=function(){var t;if(t=p(this.options.attachTo,["element","on"]),null==t&&(t={}),"string"==typeof t.element&&(t.element=document.querySelector(t.element),null==t.element))throw new Error("Shepherd step's attachTo was not found in the page");return t},o.prototype.setupTether=function(){var e,o,i;if("undefined"==typeof Tether||null===Tether)throw new Error("Using the attachment feature of Shepherd requires the Tether library");return o=this.getAttachTo(),e=t[o.on||"right"],null==o.element&&(o.element="viewport",e="middle center"),i={classPrefix:"shepherd",element:this.el,constraints:[{to:"window",pin:!0,attachment:"together"}],target:o.element,offset:o.offset||"0 0",attachment:e},this.tether=new Tether(h(i,this.options.tetherOptions))},o.prototype.show=function(){var t,e=this;return null==this.el&&this.render(),s(this.el,"shepherd-open"),null!=(t=this.tether)&&t.enable(),this.options.scrollTo&&setTimeout(function(){return e.scrollTo()}),this.trigger("show")},o.prototype.hide=function(){var t;return u(this.el,"shepherd-open"),null!=(t=this.tether)&&t.disable(),this.trigger("hide")},o.prototype.isOpen=function(){return hasClass(this.el,"shepherd-open")},o.prototype.cancel=function(){return this.hide(),this.trigger("cancel")},o.prototype.complete=function(){return this.hide(),this.trigger("complete")},o.prototype.scrollTo=function(){var t;return t=this.getAttachTo().element,null!=t?t.scrollIntoView():void 0},o.prototype.destroy=function(){var t;return null!=this.el&&(document.body.removeChild(this.el),delete this.el),null!=(t=this.tether)&&t.destroy(),this.trigger("destroy")},o.prototype.render=function(){var t,e,o,i,n,s,h,l,a,p,u,f,d,c,g,m;if(null!=this.el&&this.destroy(),this.el=r(""),i=document.createElement("div"),i.className="shepherd-content",this.el.appendChild(i),null!=this.options.title&&(s=document.createElement("header"),s.innerHTML=""+this.options.title+"
",this.el.className+=" shepherd-has-title",i.appendChild(s)),null!=this.options.text){for(a=r(""),l=this.options.text,"string"==typeof l&&(l=[l]),p=0,f=l.length;f>p;p++)h=l[p],a.innerHTML+=""+h+"
";i.appendChild(a)}if(n=document.createElement("footer"),this.options.buttons){for(e=r(""),g=this.options.buttons,u=0,d=g.length;d>u;u++)o=g[u],t=r(""+o.text+""),e.appendChild(t),this.bindButtonEvents(o,t.querySelector("a"));n.appendChild(e)}return i.appendChild(n),document.body.appendChild(this.el),this.setupTether(),this.options.advanceOn?this.bindAdvance():void 0},o.prototype.bindButtonEvents=function(t,e){var o,i,n,s,r=this;null==t.events&&(t.events={}),null!=t.action&&(t.events.click=t.action),s=t.events;for(o in s)i=s[o],"string"==typeof i&&(n=i,i=function(){return r.tour.show(n)}),e.addEventListener(o,i);return this.on("destroy",function(){var n,s;n=t.events,s=[];for(o in n)i=n[o],s.push(e.removeEventListener(o,i));return s})},o}(e),n=function(t){function e(t){var e,i,n,s,r,h=this;for(this.options=null!=t?t:{},this.hide=c(this.hide,this),this.cancel=c(this.cancel,this),this.back=c(this.back,this),this.next=c(this.next,this),this.steps=null!=(s=this.options.steps)?s:[],r=["complete","cancel","hide","start","show"],i=0,n=r.length;n>i;i++)e=r[i],this.on(e,function(t){return null==t&&(t={}),t.tour=h,o.trigger(e,t)})}return m(e,t),e.prototype.addStep=function(t,e){var o;return null==e&&(e=t),e instanceof i?e.tour=this:(("string"==(o=typeof t)||"number"===o)&&(e.id=t.toString()),e=h({},this.options.defaults,e),e=new i(this,e)),this.steps.push(e),e},e.prototype.getById=function(t){var e,o,i,n;for(n=this.steps,o=0,i=n.length;i>o;o++)if(e=n[o],e.id===t)return e},e.prototype.getCurrentStep=function(){return this.currentStep},e.prototype.next=function(){var t;return t=this.steps.indexOf(this.currentStep),t===this.steps.length-1?(this.hide(t),this.trigger("complete"),this.done()):this.show(t+1)},e.prototype.back=function(){var t;return t=this.steps.indexOf(this.currentStep),this.show(t-1)},e.prototype.cancel=function(){var t;return null!=(t=this.currentStep)&&t.cancel(),this.trigger("cancel"),this.done()},e.prototype.hide=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("hide"),this.done()},e.prototype.done=function(){return o.activeTour=null},e.prototype.show=function(t){var e;return null==t&&(t=0),this.currentStep&&this.currentStep.hide(),o.activeTour=this,e="string"==typeof t?this.getById(t):this.steps[t],e?(this.trigger("show",{step:e,previous:this.currentStep}),this.currentStep=e,e.show()):void 0},e.prototype.start=function(){return this.trigger("start"),this.currentStep=null,this.next()},e}(e),o=new e,h(o,{Tour:n,Step:i,Evented:e}),window.Shepherd=o}.call(this);
\ No newline at end of file
diff --git a/ajax/libs/shepherd/0.4.4/shepherd.js b/ajax/libs/shepherd/0.4.4/shepherd.js
new file mode 100644
index 000000000..f90383a43
--- /dev/null
+++ b/ajax/libs/shepherd/0.4.4/shepherd.js
@@ -0,0 +1,1887 @@
+/*! shepherd 0.4.4 */
+/*! tether 0.6.5 */
+
+
+(function(root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(factory);
+ } else if (typeof exports === 'object') {
+ module.exports = factory(require,exports,module);
+ } else {
+ root.Tether = factory();
+ }
+}(this, function(require,exports,module) {
+
+(function() {
+ var Evented, addClass, defer, deferred, extend, flush, getBounds, getOffsetParent, getOrigin, getScrollBarSize, getScrollParent, hasClass, node, removeClass, uniqueId, updateClasses, zeroPosCache,
+ __hasProp = {}.hasOwnProperty,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
+ __slice = [].slice;
+
+ if (this.Tether == null) {
+ this.Tether = {
+ modules: []
+ };
+ }
+
+ getScrollParent = function(el) {
+ var parent, position, scrollParent, style, _ref;
+ position = getComputedStyle(el).position;
+ if (position === 'fixed') {
+ return el;
+ }
+ scrollParent = void 0;
+ parent = el;
+ while (parent = parent.parentNode) {
+ try {
+ style = getComputedStyle(parent);
+ } catch (_error) {}
+ if (style == null) {
+ return parent;
+ }
+ if (/(auto|scroll)/.test(style['overflow'] + style['overflow-y'] + style['overflow-x'])) {
+ if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) {
+ return parent;
+ }
+ }
+ }
+ return document.body;
+ };
+
+ uniqueId = (function() {
+ var id;
+ id = 0;
+ return function() {
+ return id++;
+ };
+ })();
+
+ zeroPosCache = {};
+
+ getOrigin = function(doc) {
+ var id, k, node, v, _ref;
+ node = doc._tetherZeroElement;
+ if (node == null) {
+ node = doc.createElement('div');
+ node.setAttribute('data-tether-id', uniqueId());
+ extend(node.style, {
+ top: 0,
+ left: 0,
+ position: 'absolute'
+ });
+ doc.body.appendChild(node);
+ doc._tetherZeroElement = node;
+ }
+ id = node.getAttribute('data-tether-id');
+ if (zeroPosCache[id] == null) {
+ zeroPosCache[id] = {};
+ _ref = node.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ zeroPosCache[id][k] = v;
+ }
+ defer(function() {
+ return zeroPosCache[id] = void 0;
+ });
+ }
+ return zeroPosCache[id];
+ };
+
+ node = null;
+
+ getBounds = function(el) {
+ var box, doc, docEl, k, origin, v, _ref;
+ if (el === document) {
+ doc = document;
+ el = document.documentElement;
+ } else {
+ doc = el.ownerDocument;
+ }
+ docEl = doc.documentElement;
+ box = {};
+ _ref = el.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ box[k] = v;
+ }
+ origin = getOrigin(doc);
+ box.top -= origin.top;
+ box.left -= origin.left;
+ if (box.width == null) {
+ box.width = document.body.scrollWidth - box.left - box.right;
+ }
+ if (box.height == null) {
+ box.height = document.body.scrollHeight - box.top - box.bottom;
+ }
+ box.top = box.top - docEl.clientTop;
+ box.left = box.left - docEl.clientLeft;
+ box.right = doc.body.clientWidth - box.width - box.left;
+ box.bottom = doc.body.clientHeight - box.height - box.top;
+ return box;
+ };
+
+ getOffsetParent = function(el) {
+ return el.offsetParent || document.documentElement;
+ };
+
+ getScrollBarSize = function() {
+ var inner, outer, width, widthContained, widthScroll;
+ inner = document.createElement('div');
+ inner.style.width = '100%';
+ inner.style.height = '200px';
+ outer = document.createElement('div');
+ extend(outer.style, {
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ pointerEvents: 'none',
+ visibility: 'hidden',
+ width: '200px',
+ height: '150px',
+ overflow: 'hidden'
+ });
+ outer.appendChild(inner);
+ document.body.appendChild(outer);
+ widthContained = inner.offsetWidth;
+ outer.style.overflow = 'scroll';
+ widthScroll = inner.offsetWidth;
+ if (widthContained === widthScroll) {
+ widthScroll = outer.clientWidth;
+ }
+ document.body.removeChild(outer);
+ width = widthContained - widthScroll;
+ return {
+ width: width,
+ height: width
+ };
+ };
+
+ extend = function(out) {
+ var args, key, obj, val, _i, _len, _ref;
+ if (out == null) {
+ out = {};
+ }
+ args = [];
+ Array.prototype.push.apply(args, arguments);
+ _ref = args.slice(1);
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ obj = _ref[_i];
+ if (obj) {
+ for (key in obj) {
+ if (!__hasProp.call(obj, key)) continue;
+ val = obj[key];
+ out[key] = val;
+ }
+ }
+ }
+ return out;
+ };
+
+ removeClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ if (cls.trim()) {
+ _results.push(el.classList.remove(cls));
+ }
+ }
+ return _results;
+ } else {
+ return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' ');
+ }
+ };
+
+ addClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ if (cls.trim()) {
+ _results.push(el.classList.add(cls));
+ }
+ }
+ return _results;
+ } else {
+ removeClass(el, name);
+ return el.className += " " + name;
+ }
+ };
+
+ hasClass = function(el, name) {
+ if (el.classList != null) {
+ return el.classList.contains(name);
+ } else {
+ return new RegExp("(^| )" + name + "( |$)", 'gi').test(el.className);
+ }
+ };
+
+ updateClasses = function(el, add, all) {
+ var cls, _i, _j, _len, _len1, _results;
+ for (_i = 0, _len = all.length; _i < _len; _i++) {
+ cls = all[_i];
+ if (__indexOf.call(add, cls) < 0) {
+ if (hasClass(el, cls)) {
+ removeClass(el, cls);
+ }
+ }
+ }
+ _results = [];
+ for (_j = 0, _len1 = add.length; _j < _len1; _j++) {
+ cls = add[_j];
+ if (!hasClass(el, cls)) {
+ _results.push(addClass(el, cls));
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ deferred = [];
+
+ defer = function(fn) {
+ return deferred.push(fn);
+ };
+
+ flush = function() {
+ var fn, _results;
+ _results = [];
+ while (fn = deferred.pop()) {
+ _results.push(fn());
+ }
+ return _results;
+ };
+
+ Evented = (function() {
+ function Evented() {}
+
+ Evented.prototype.on = function(event, handler, ctx, once) {
+ var _base;
+ if (once == null) {
+ once = false;
+ }
+ if (this.bindings == null) {
+ this.bindings = {};
+ }
+ if ((_base = this.bindings)[event] == null) {
+ _base[event] = [];
+ }
+ return this.bindings[event].push({
+ handler: handler,
+ ctx: ctx,
+ once: once
+ });
+ };
+
+ Evented.prototype.once = function(event, handler, ctx) {
+ return this.on(event, handler, ctx, true);
+ };
+
+ Evented.prototype.off = function(event, handler) {
+ var i, _ref, _results;
+ if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
+ return;
+ }
+ if (handler == null) {
+ return delete this.bindings[event];
+ } else {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ if (this.bindings[event][i].handler === handler) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ Evented.prototype.trigger = function() {
+ var args, ctx, event, handler, i, once, _ref, _ref1, _results;
+ event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+ if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
+ handler.apply(ctx != null ? ctx : this, args);
+ if (once) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ return Evented;
+
+ })();
+
+ this.Tether.Utils = {
+ getScrollParent: getScrollParent,
+ getBounds: getBounds,
+ getOffsetParent: getOffsetParent,
+ extend: extend,
+ addClass: addClass,
+ removeClass: removeClass,
+ hasClass: hasClass,
+ updateClasses: updateClasses,
+ defer: defer,
+ flush: flush,
+ uniqueId: uniqueId,
+ Evented: Evented,
+ getScrollBarSize: getScrollBarSize
+ };
+
+}).call(this);
+
+(function() {
+ var MIRROR_LR, MIRROR_TB, OFFSET_MAP, Tether, addClass, addOffset, attachmentToOffset, autoToFixedAttachment, defer, extend, flush, getBounds, getOffsetParent, getOuterSize, getScrollBarSize, getScrollParent, getSize, now, offsetToPx, parseAttachment, parseOffset, position, removeClass, tethers, transformKey, updateClasses, within, _Tether, _ref,
+ __slice = [].slice,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+
+ if (this.Tether == null) {
+ throw new Error("You must include the utils.js file before tether.js");
+ }
+
+ Tether = this.Tether;
+
+ _ref = Tether.Utils, getScrollParent = _ref.getScrollParent, getSize = _ref.getSize, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getOffsetParent = _ref.getOffsetParent, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, updateClasses = _ref.updateClasses, defer = _ref.defer, flush = _ref.flush, getScrollBarSize = _ref.getScrollBarSize;
+
+ within = function(a, b, diff) {
+ if (diff == null) {
+ diff = 1;
+ }
+ return (a + diff >= b && b >= a - diff);
+ };
+
+ transformKey = (function() {
+ var el, key, _i, _len, _ref1;
+ el = document.createElement('div');
+ _ref1 = ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ key = _ref1[_i];
+ if (el.style[key] !== void 0) {
+ return key;
+ }
+ }
+ })();
+
+ tethers = [];
+
+ position = function() {
+ var tether, _i, _len;
+ for (_i = 0, _len = tethers.length; _i < _len; _i++) {
+ tether = tethers[_i];
+ tether.position(false);
+ }
+ return flush();
+ };
+
+ now = function() {
+ var _ref1;
+ return (_ref1 = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref1 : +(new Date);
+ };
+
+ (function() {
+ var event, lastCall, lastDuration, pendingTimeout, tick, _i, _len, _ref1, _results;
+ lastCall = null;
+ lastDuration = null;
+ pendingTimeout = null;
+ tick = function() {
+ if ((lastDuration != null) && lastDuration > 16) {
+ lastDuration = Math.min(lastDuration - 16, 250);
+ pendingTimeout = setTimeout(tick, 250);
+ return;
+ }
+ if ((lastCall != null) && (now() - lastCall) < 10) {
+ return;
+ }
+ if (pendingTimeout != null) {
+ clearTimeout(pendingTimeout);
+ pendingTimeout = null;
+ }
+ lastCall = now();
+ position();
+ return lastDuration = now() - lastCall;
+ };
+ _ref1 = ['resize', 'scroll', 'touchmove'];
+ _results = [];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ event = _ref1[_i];
+ _results.push(window.addEventListener(event, tick));
+ }
+ return _results;
+ })();
+
+ MIRROR_LR = {
+ center: 'center',
+ left: 'right',
+ right: 'left'
+ };
+
+ MIRROR_TB = {
+ middle: 'middle',
+ top: 'bottom',
+ bottom: 'top'
+ };
+
+ OFFSET_MAP = {
+ top: 0,
+ left: 0,
+ middle: '50%',
+ center: '50%',
+ bottom: '100%',
+ right: '100%'
+ };
+
+ autoToFixedAttachment = function(attachment, relativeToAttachment) {
+ var left, top;
+ left = attachment.left, top = attachment.top;
+ if (left === 'auto') {
+ left = MIRROR_LR[relativeToAttachment.left];
+ }
+ if (top === 'auto') {
+ top = MIRROR_TB[relativeToAttachment.top];
+ }
+ return {
+ left: left,
+ top: top
+ };
+ };
+
+ attachmentToOffset = function(attachment) {
+ var _ref1, _ref2;
+ return {
+ left: (_ref1 = OFFSET_MAP[attachment.left]) != null ? _ref1 : attachment.left,
+ top: (_ref2 = OFFSET_MAP[attachment.top]) != null ? _ref2 : attachment.top
+ };
+ };
+
+ addOffset = function() {
+ var left, offsets, out, top, _i, _len, _ref1;
+ offsets = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ out = {
+ top: 0,
+ left: 0
+ };
+ for (_i = 0, _len = offsets.length; _i < _len; _i++) {
+ _ref1 = offsets[_i], top = _ref1.top, left = _ref1.left;
+ if (typeof top === 'string') {
+ top = parseFloat(top, 10);
+ }
+ if (typeof left === 'string') {
+ left = parseFloat(left, 10);
+ }
+ out.top += top;
+ out.left += left;
+ }
+ return out;
+ };
+
+ offsetToPx = function(offset, size) {
+ if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
+ offset.left = parseFloat(offset.left, 10) / 100 * size.width;
+ }
+ if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
+ offset.top = parseFloat(offset.top, 10) / 100 * size.height;
+ }
+ return offset;
+ };
+
+ parseAttachment = parseOffset = function(value) {
+ var left, top, _ref1;
+ _ref1 = value.split(' '), top = _ref1[0], left = _ref1[1];
+ return {
+ top: top,
+ left: left
+ };
+ };
+
+ _Tether = (function() {
+ _Tether.modules = [];
+
+ function _Tether(options) {
+ this.position = __bind(this.position, this);
+ var module, _i, _len, _ref1, _ref2;
+ tethers.push(this);
+ this.history = [];
+ this.setOptions(options, false);
+ _ref1 = Tether.modules;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ module = _ref1[_i];
+ if ((_ref2 = module.initialize) != null) {
+ _ref2.call(this);
+ }
+ }
+ this.position();
+ }
+
+ _Tether.prototype.getClass = function(key) {
+ var _ref1, _ref2;
+ if ((_ref1 = this.options.classes) != null ? _ref1[key] : void 0) {
+ return this.options.classes[key];
+ } else if (((_ref2 = this.options.classes) != null ? _ref2[key] : void 0) !== false) {
+ if (this.options.classPrefix) {
+ return "" + this.options.classPrefix + "-" + key;
+ } else {
+ return key;
+ }
+ } else {
+ return '';
+ }
+ };
+
+ _Tether.prototype.setOptions = function(options, position) {
+ var defaults, key, _i, _len, _ref1, _ref2;
+ this.options = options;
+ if (position == null) {
+ position = true;
+ }
+ defaults = {
+ offset: '0 0',
+ targetOffset: '0 0',
+ targetAttachment: 'auto auto',
+ classPrefix: 'tether'
+ };
+ this.options = extend(defaults, this.options);
+ _ref1 = this.options, this.element = _ref1.element, this.target = _ref1.target, this.targetModifier = _ref1.targetModifier;
+ if (this.target === 'viewport') {
+ this.target = document.body;
+ this.targetModifier = 'visible';
+ } else if (this.target === 'scroll-handle') {
+ this.target = document.body;
+ this.targetModifier = 'scroll-handle';
+ }
+ _ref2 = ['element', 'target'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ key = _ref2[_i];
+ if (this[key] == null) {
+ throw new Error("Tether Error: Both element and target must be defined");
+ }
+ if (this[key].jquery != null) {
+ this[key] = this[key][0];
+ } else if (typeof this[key] === 'string') {
+ this[key] = document.querySelector(this[key]);
+ }
+ }
+ addClass(this.element, this.getClass('element'));
+ addClass(this.target, this.getClass('target'));
+ if (!this.options.attachment) {
+ throw new Error("Tether Error: You must provide an attachment");
+ }
+ this.targetAttachment = parseAttachment(this.options.targetAttachment);
+ this.attachment = parseAttachment(this.options.attachment);
+ this.offset = parseOffset(this.options.offset);
+ this.targetOffset = parseOffset(this.options.targetOffset);
+ if (this.scrollParent != null) {
+ this.disable();
+ }
+ if (this.targetModifier === 'scroll-handle') {
+ this.scrollParent = this.target;
+ } else {
+ this.scrollParent = getScrollParent(this.target);
+ }
+ if (this.options.enabled !== false) {
+ return this.enable(position);
+ }
+ };
+
+ _Tether.prototype.getTargetBounds = function() {
+ var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target;
+ if (this.targetModifier != null) {
+ switch (this.targetModifier) {
+ case 'visible':
+ if (this.target === document.body) {
+ return {
+ top: pageYOffset,
+ left: pageXOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(this.target);
+ out = {
+ height: bounds.height,
+ width: bounds.width,
+ top: bounds.top,
+ left: bounds.left
+ };
+ out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
+ out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight)));
+ out.height = Math.min(innerHeight, out.height);
+ out.height -= 2;
+ out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
+ out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth)));
+ out.width = Math.min(innerWidth, out.width);
+ out.width -= 2;
+ if (out.top < pageYOffset) {
+ out.top = pageYOffset;
+ }
+ if (out.left < pageXOffset) {
+ out.left = pageXOffset;
+ }
+ return out;
+ }
+ break;
+ case 'scroll-handle':
+ target = this.target;
+ if (target === document.body) {
+ target = document.documentElement;
+ bounds = {
+ left: pageXOffset,
+ top: pageYOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(target);
+ }
+ style = getComputedStyle(target);
+ hasBottomScroll = target.scrollWidth > target.clientWidth || 'scroll' === [style.overflow, style.overflowX] || this.target !== document.body;
+ scrollBottom = 0;
+ if (hasBottomScroll) {
+ scrollBottom = 15;
+ }
+ height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
+ out = {
+ width: 15,
+ height: height * 0.975 * (height / target.scrollHeight),
+ left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
+ };
+ fitAdj = 0;
+ if (height < 408 && this.target === document.body) {
+ fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
+ }
+ if (this.target !== document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ scrollPercentage = this.target.scrollTop / (target.scrollHeight - height);
+ out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
+ if (this.target === document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ return out;
+ }
+ } else {
+ return getBounds(this.target);
+ }
+ };
+
+ _Tether.prototype.clearCache = function() {
+ return this._cache = {};
+ };
+
+ _Tether.prototype.cache = function(k, getter) {
+ if (this._cache == null) {
+ this._cache = {};
+ }
+ if (this._cache[k] == null) {
+ this._cache[k] = getter.call(this);
+ }
+ return this._cache[k];
+ };
+
+ _Tether.prototype.enable = function(position) {
+ if (position == null) {
+ position = true;
+ }
+ addClass(this.target, this.getClass('enabled'));
+ addClass(this.element, this.getClass('enabled'));
+ this.enabled = true;
+ if (this.scrollParent !== document) {
+ this.scrollParent.addEventListener('scroll', this.position);
+ }
+ if (position) {
+ return this.position();
+ }
+ };
+
+ _Tether.prototype.disable = function() {
+ removeClass(this.target, this.getClass('enabled'));
+ removeClass(this.element, this.getClass('enabled'));
+ this.enabled = false;
+ if (this.scrollParent != null) {
+ return this.scrollParent.removeEventListener('scroll', this.position);
+ }
+ };
+
+ _Tether.prototype.destroy = function() {
+ var i, tether, _i, _len, _results;
+ this.disable();
+ _results = [];
+ for (i = _i = 0, _len = tethers.length; _i < _len; i = ++_i) {
+ tether = tethers[i];
+ if (tether === this) {
+ tethers.splice(i, 1);
+ break;
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ _Tether.prototype.updateAttachClasses = function(elementAttach, targetAttach) {
+ var add, all, side, sides, _i, _j, _len, _len1, _ref1,
+ _this = this;
+ if (elementAttach == null) {
+ elementAttach = this.attachment;
+ }
+ if (targetAttach == null) {
+ targetAttach = this.targetAttachment;
+ }
+ sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
+ if ((_ref1 = this._addAttachClasses) != null ? _ref1.length : void 0) {
+ this._addAttachClasses.splice(0, this._addAttachClasses.length);
+ }
+ add = this._addAttachClasses != null ? this._addAttachClasses : this._addAttachClasses = [];
+ if (elementAttach.top) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.top);
+ }
+ if (elementAttach.left) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.left);
+ }
+ if (targetAttach.top) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.top);
+ }
+ if (targetAttach.left) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.left);
+ }
+ all = [];
+ for (_i = 0, _len = sides.length; _i < _len; _i++) {
+ side = sides[_i];
+ all.push("" + (this.getClass('element-attached')) + "-" + side);
+ }
+ for (_j = 0, _len1 = sides.length; _j < _len1; _j++) {
+ side = sides[_j];
+ all.push("" + (this.getClass('target-attached')) + "-" + side);
+ }
+ return defer(function() {
+ if (_this._addAttachClasses == null) {
+ return;
+ }
+ updateClasses(_this.element, _this._addAttachClasses, all);
+ updateClasses(_this.target, _this._addAttachClasses, all);
+ return _this._addAttachClasses = void 0;
+ });
+ };
+
+ _Tether.prototype.position = function(flushChanges) {
+ var elementPos, elementStyle, height, left, manualOffset, manualTargetOffset, module, next, offset, offsetBorder, offsetParent, offsetParentSize, offsetParentStyle, offsetPosition, ret, scrollLeft, scrollTop, scrollbarSize, side, targetAttachment, targetOffset, targetPos, targetSize, top, width, _i, _j, _len, _len1, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6,
+ _this = this;
+ if (flushChanges == null) {
+ flushChanges = true;
+ }
+ if (!this.enabled) {
+ return;
+ }
+ this.clearCache();
+ targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
+ this.updateAttachClasses(this.attachment, targetAttachment);
+ elementPos = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ });
+ width = elementPos.width, height = elementPos.height;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref1 = this.lastSize, width = _ref1.width, height = _ref1.height;
+ } else {
+ this.lastSize = {
+ width: width,
+ height: height
+ };
+ }
+ targetSize = targetPos = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ offset = offsetToPx(attachmentToOffset(this.attachment), {
+ width: width,
+ height: height
+ });
+ targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
+ manualOffset = offsetToPx(this.offset, {
+ width: width,
+ height: height
+ });
+ manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
+ offset = addOffset(offset, manualOffset);
+ targetOffset = addOffset(targetOffset, manualTargetOffset);
+ left = targetPos.left + targetOffset.left - offset.left;
+ top = targetPos.top + targetOffset.top - offset.top;
+ _ref2 = Tether.modules;
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ module = _ref2[_i];
+ ret = module.position.call(this, {
+ left: left,
+ top: top,
+ targetAttachment: targetAttachment,
+ targetPos: targetPos,
+ attachment: this.attachment,
+ elementPos: elementPos,
+ offset: offset,
+ targetOffset: targetOffset,
+ manualOffset: manualOffset,
+ manualTargetOffset: manualTargetOffset,
+ scrollbarSize: scrollbarSize
+ });
+ if ((ret == null) || typeof ret !== 'object') {
+ continue;
+ } else if (ret === false) {
+ return false;
+ } else {
+ top = ret.top, left = ret.left;
+ }
+ }
+ next = {
+ page: {
+ top: top,
+ left: left
+ },
+ viewport: {
+ top: top - pageYOffset,
+ bottom: pageYOffset - top - height + innerHeight,
+ left: left - pageXOffset,
+ right: pageXOffset - left - width + innerWidth
+ }
+ };
+ if (document.body.scrollWidth > window.innerWidth) {
+ scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
+ next.viewport.bottom -= scrollbarSize.height;
+ }
+ if (document.body.scrollHeight > window.innerHeight) {
+ scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
+ next.viewport.right -= scrollbarSize.width;
+ }
+ if (((_ref3 = document.body.style.position) !== '' && _ref3 !== 'static') || ((_ref4 = document.body.parentElement.style.position) !== '' && _ref4 !== 'static')) {
+ next.page.bottom = document.body.scrollHeight - top - height;
+ next.page.right = document.body.scrollWidth - left - width;
+ }
+ if (((_ref5 = this.options.optimizations) != null ? _ref5.moveElement : void 0) !== false && (this.targetModifier == null)) {
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ offsetPosition = this.cache('target-offsetparent-bounds', function() {
+ return getBounds(offsetParent);
+ });
+ offsetParentStyle = getComputedStyle(offsetParent);
+ elementStyle = getComputedStyle(this.element);
+ offsetParentSize = offsetPosition;
+ offsetBorder = {};
+ _ref6 = ['Top', 'Left', 'Bottom', 'Right'];
+ for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
+ side = _ref6[_j];
+ offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle["border" + side + "Width"]);
+ }
+ offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
+ offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
+ if (next.page.top >= (offsetPosition.top + offsetBorder.top) && next.page.bottom >= offsetPosition.bottom) {
+ if (next.page.left >= (offsetPosition.left + offsetBorder.left) && next.page.right >= offsetPosition.right) {
+ scrollTop = offsetParent.scrollTop;
+ scrollLeft = offsetParent.scrollLeft;
+ next.offset = {
+ top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
+ left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
+ };
+ }
+ }
+ }
+ this.move(next);
+ this.history.unshift(next);
+ if (this.history.length > 3) {
+ this.history.pop();
+ }
+ if (flushChanges) {
+ flush();
+ }
+ return true;
+ };
+
+ _Tether.prototype.move = function(position) {
+ var css, elVal, found, key, moved, offsetParent, point, same, transcribe, type, val, write, writeCSS, _i, _len, _ref1, _ref2,
+ _this = this;
+ if (this.element.parentNode == null) {
+ return;
+ }
+ same = {};
+ for (type in position) {
+ same[type] = {};
+ for (key in position[type]) {
+ found = false;
+ _ref1 = this.history;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ point = _ref1[_i];
+ if (!within((_ref2 = point[type]) != null ? _ref2[key] : void 0, position[type][key])) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ same[type][key] = true;
+ }
+ }
+ }
+ css = {
+ top: '',
+ left: '',
+ right: '',
+ bottom: ''
+ };
+ transcribe = function(same, pos) {
+ var xPos, yPos, _ref3;
+ if (((_ref3 = _this.options.optimizations) != null ? _ref3.gpu : void 0) !== false) {
+ if (same.top) {
+ css.top = 0;
+ yPos = pos.top;
+ } else {
+ css.bottom = 0;
+ yPos = -pos.bottom;
+ }
+ if (same.left) {
+ css.left = 0;
+ xPos = pos.left;
+ } else {
+ css.right = 0;
+ xPos = -pos.right;
+ }
+ css[transformKey] = "translateX(" + (Math.round(xPos)) + "px) translateY(" + (Math.round(yPos)) + "px)";
+ if (transformKey !== 'msTransform') {
+ return css[transformKey] += " translateZ(0)";
+ }
+ } else {
+ if (same.top) {
+ css.top = "" + pos.top + "px";
+ } else {
+ css.bottom = "" + pos.bottom + "px";
+ }
+ if (same.left) {
+ return css.left = "" + pos.left + "px";
+ } else {
+ return css.right = "" + pos.right + "px";
+ }
+ }
+ };
+ moved = false;
+ if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
+ css.position = 'absolute';
+ transcribe(same.page, position.page);
+ } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
+ css.position = 'fixed';
+ transcribe(same.viewport, position.viewport);
+ } else if ((same.offset != null) && same.offset.top && same.offset.left) {
+ css.position = 'absolute';
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ if (getOffsetParent(this.element) !== offsetParent) {
+ defer(function() {
+ _this.element.parentNode.removeChild(_this.element);
+ return offsetParent.appendChild(_this.element);
+ });
+ }
+ transcribe(same.offset, position.offset);
+ moved = true;
+ } else {
+ css.position = 'absolute';
+ transcribe({
+ top: true,
+ left: true
+ }, position.page);
+ }
+ if (!moved && this.element.parentNode.tagName !== 'BODY') {
+ this.element.parentNode.removeChild(this.element);
+ document.body.appendChild(this.element);
+ }
+ writeCSS = {};
+ write = false;
+ for (key in css) {
+ val = css[key];
+ elVal = this.element.style[key];
+ if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) {
+ elVal = parseFloat(elVal);
+ val = parseFloat(val);
+ }
+ if (elVal !== val) {
+ write = true;
+ writeCSS[key] = css[key];
+ }
+ }
+ if (write) {
+ return defer(function() {
+ return extend(_this.element.style, writeCSS);
+ });
+ }
+ };
+
+ return _Tether;
+
+ })();
+
+ Tether.position = position;
+
+ this.Tether = extend(_Tether, Tether);
+
+}).call(this);
+
+(function() {
+ var BOUNDS_FORMAT, MIRROR_ATTACH, defer, extend, getBoundingRect, getBounds, getOuterSize, getSize, updateClasses, _ref,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+
+ _ref = this.Tether.Utils, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getSize = _ref.getSize, extend = _ref.extend, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ MIRROR_ATTACH = {
+ left: 'right',
+ right: 'left',
+ top: 'bottom',
+ bottom: 'top',
+ middle: 'middle'
+ };
+
+ BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
+
+ getBoundingRect = function(tether, to) {
+ var i, pos, side, size, style, _i, _len;
+ if (to === 'scrollParent') {
+ to = tether.scrollParent;
+ } else if (to === 'window') {
+ to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
+ }
+ if (to === document) {
+ to = to.documentElement;
+ }
+ if (to.nodeType != null) {
+ pos = size = getBounds(to);
+ style = getComputedStyle(to);
+ to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
+ for (i = _i = 0, _len = BOUNDS_FORMAT.length; _i < _len; i = ++_i) {
+ side = BOUNDS_FORMAT[i];
+ side = side[0].toUpperCase() + side.substr(1);
+ if (side === 'Top' || side === 'Left') {
+ to[i] += parseFloat(style["border" + side + "Width"]);
+ } else {
+ to[i] -= parseFloat(style["border" + side + "Width"]);
+ }
+ }
+ }
+ return to;
+ };
+
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var addClasses, allClasses, attachment, bounds, changeAttachX, changeAttachY, cls, constraint, eAttachment, height, left, oob, oobClass, p, pin, pinned, pinnedClass, removeClass, side, tAttachment, targetAttachment, targetHeight, targetSize, targetWidth, to, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8,
+ _this = this;
+ top = _arg.top, left = _arg.left, targetAttachment = _arg.targetAttachment;
+ if (!this.options.constraints) {
+ return true;
+ }
+ removeClass = function(prefix) {
+ var side, _i, _len, _results;
+ _this.removeClass(prefix);
+ _results = [];
+ for (_i = 0, _len = BOUNDS_FORMAT.length; _i < _len; _i++) {
+ side = BOUNDS_FORMAT[_i];
+ _results.push(_this.removeClass("" + prefix + "-" + side));
+ }
+ return _results;
+ };
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref2 = this.lastSize, width = _ref2.width, height = _ref2.height;
+ }
+ targetSize = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ targetHeight = targetSize.height;
+ targetWidth = targetSize.width;
+ tAttachment = {};
+ eAttachment = {};
+ allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
+ _ref3 = this.options.constraints;
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ constraint = _ref3[_i];
+ if (constraint.outOfBoundsClass) {
+ allClasses.push(constraint.outOfBoundsClass);
+ }
+ if (constraint.pinnedClass) {
+ allClasses.push(constraint.pinnedClass);
+ }
+ }
+ for (_j = 0, _len1 = allClasses.length; _j < _len1; _j++) {
+ cls = allClasses[_j];
+ _ref4 = ['left', 'top', 'right', 'bottom'];
+ for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
+ side = _ref4[_k];
+ allClasses.push("" + cls + "-" + side);
+ }
+ }
+ addClasses = [];
+ tAttachment = extend({}, targetAttachment);
+ eAttachment = extend({}, this.attachment);
+ _ref5 = this.options.constraints;
+ for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) {
+ constraint = _ref5[_l];
+ to = constraint.to, attachment = constraint.attachment, pin = constraint.pin;
+ if (attachment == null) {
+ attachment = '';
+ }
+ if (__indexOf.call(attachment, ' ') >= 0) {
+ _ref6 = attachment.split(' '), changeAttachY = _ref6[0], changeAttachX = _ref6[1];
+ } else {
+ changeAttachX = changeAttachY = attachment;
+ }
+ bounds = getBoundingRect(this, to);
+ if (changeAttachY === 'target' || changeAttachY === 'both') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ }
+ }
+ if (changeAttachY === 'together') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ if (eAttachment.top === 'bottom') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top += height;
+ eAttachment.top = 'top';
+ } else if (eAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ if (eAttachment.top === 'top') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (eAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ if (tAttachment.top === 'middle') {
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ }
+ if (changeAttachX === 'target' || changeAttachX === 'both') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ }
+ if (left + width > bounds[2] && tAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ }
+ }
+ if (changeAttachX === 'together') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ if (eAttachment.left === 'right') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left += width;
+ eAttachment.left = 'left';
+ } else if (eAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ } else if (left + width > bounds[2] && tAttachment.left === 'right') {
+ if (eAttachment.left === 'left') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (eAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left += width;
+ eAttachment.left = 'left';
+ }
+ } else if (tAttachment.left === 'center') {
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ }
+ }
+ if (changeAttachY === 'element' || changeAttachY === 'both') {
+ if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (changeAttachX === 'element' || changeAttachX === 'both') {
+ if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ }
+ if (typeof pin === 'string') {
+ pin = (function() {
+ var _len4, _m, _ref7, _results;
+ _ref7 = pin.split(',');
+ _results = [];
+ for (_m = 0, _len4 = _ref7.length; _m < _len4; _m++) {
+ p = _ref7[_m];
+ _results.push(p.trim());
+ }
+ return _results;
+ })();
+ } else if (pin === true) {
+ pin = ['top', 'left', 'right', 'bottom'];
+ }
+ pin || (pin = []);
+ pinned = [];
+ oob = [];
+ if (top < bounds[1]) {
+ if (__indexOf.call(pin, 'top') >= 0) {
+ top = bounds[1];
+ pinned.push('top');
+ } else {
+ oob.push('top');
+ }
+ }
+ if (top + height > bounds[3]) {
+ if (__indexOf.call(pin, 'bottom') >= 0) {
+ top = bounds[3] - height;
+ pinned.push('bottom');
+ } else {
+ oob.push('bottom');
+ }
+ }
+ if (left < bounds[0]) {
+ if (__indexOf.call(pin, 'left') >= 0) {
+ left = bounds[0];
+ pinned.push('left');
+ } else {
+ oob.push('left');
+ }
+ }
+ if (left + width > bounds[2]) {
+ if (__indexOf.call(pin, 'right') >= 0) {
+ left = bounds[2] - width;
+ pinned.push('right');
+ } else {
+ oob.push('right');
+ }
+ }
+ if (pinned.length) {
+ pinnedClass = (_ref7 = this.options.pinnedClass) != null ? _ref7 : this.getClass('pinned');
+ addClasses.push(pinnedClass);
+ for (_m = 0, _len4 = pinned.length; _m < _len4; _m++) {
+ side = pinned[_m];
+ addClasses.push("" + pinnedClass + "-" + side);
+ }
+ }
+ if (oob.length) {
+ oobClass = (_ref8 = this.options.outOfBoundsClass) != null ? _ref8 : this.getClass('out-of-bounds');
+ addClasses.push(oobClass);
+ for (_n = 0, _len5 = oob.length; _n < _len5; _n++) {
+ side = oob[_n];
+ addClasses.push("" + oobClass + "-" + side);
+ }
+ }
+ if (__indexOf.call(pinned, 'left') >= 0 || __indexOf.call(pinned, 'right') >= 0) {
+ eAttachment.left = tAttachment.left = false;
+ }
+ if (__indexOf.call(pinned, 'top') >= 0 || __indexOf.call(pinned, 'bottom') >= 0) {
+ eAttachment.top = tAttachment.top = false;
+ }
+ if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== this.attachment.top || eAttachment.left !== this.attachment.left) {
+ this.updateAttachClasses(eAttachment, tAttachment);
+ }
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+(function() {
+ var defer, getBounds, updateClasses, _ref;
+
+ _ref = this.Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5,
+ _this = this;
+ top = _arg.top, left = _arg.left;
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ targetPos = this.getTargetBounds();
+ bottom = top + height;
+ right = left + width;
+ abutted = [];
+ if (top <= targetPos.bottom && bottom >= targetPos.top) {
+ _ref2 = ['left', 'right'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ side = _ref2[_i];
+ if ((_ref3 = targetPos[side]) === left || _ref3 === right) {
+ abutted.push(side);
+ }
+ }
+ }
+ if (left <= targetPos.right && right >= targetPos.left) {
+ _ref4 = ['top', 'bottom'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) {
+ abutted.push(side);
+ }
+ }
+ }
+ allClasses = [];
+ addClasses = [];
+ sides = ['left', 'top', 'right', 'bottom'];
+ allClasses.push(this.getClass('abutted'));
+ for (_k = 0, _len2 = sides.length; _k < _len2; _k++) {
+ side = sides[_k];
+ allClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ if (abutted.length) {
+ addClasses.push(this.getClass('abutted'));
+ }
+ for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) {
+ side = abutted[_l];
+ addClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return true;
+ }
+ });
+
+}).call(this);
+
+(function() {
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var left, result, shift, shiftLeft, shiftTop, top, _ref;
+ top = _arg.top, left = _arg.left;
+ if (!this.options.shift) {
+ return;
+ }
+ result = function(val) {
+ if (typeof val === 'function') {
+ return val.call(this, {
+ top: top,
+ left: left
+ });
+ } else {
+ return val;
+ }
+ };
+ shift = result(this.options.shift);
+ if (typeof shift === 'string') {
+ shift = shift.split(' ');
+ shift[1] || (shift[1] = shift[0]);
+ shiftTop = shift[0], shiftLeft = shift[1];
+ shiftTop = parseFloat(shiftTop, 10);
+ shiftLeft = parseFloat(shiftLeft, 10);
+ } else {
+ _ref = [shift.top, shift.left], shiftTop = _ref[0], shiftLeft = _ref[1];
+ }
+ top += shiftTop;
+ left += shiftLeft;
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+return this.Tether;
+
+}));
+
+(function() {
+ var ATTACHMENT, Evented, Shepherd, Step, Tour, addClass, createFromHTML, extend, getBounds, hasClass, matchesSelector, parseShorthand, removeClass, uniqueId, _ref,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ _ref = Tether.Utils, extend = _ref.extend, removeClass = _ref.removeClass, addClass = _ref.addClass, hasClass = _ref.hasClass, Evented = _ref.Evented, getBounds = _ref.getBounds, uniqueId = _ref.uniqueId;
+
+ ATTACHMENT = {
+ 'top': 'top center',
+ 'left': 'middle right',
+ 'right': 'middle left',
+ 'bottom': 'bottom center'
+ };
+
+ createFromHTML = function(html) {
+ var el;
+ el = document.createElement('div');
+ el.innerHTML = html;
+ return el.children[0];
+ };
+
+ matchesSelector = function(el, sel) {
+ var matches, _ref1, _ref2, _ref3, _ref4;
+ matches = (_ref1 = (_ref2 = (_ref3 = (_ref4 = el.matches) != null ? _ref4 : el.matchesSelector) != null ? _ref3 : el.webkitMatchesSelector) != null ? _ref2 : el.mozMatchesSelector) != null ? _ref1 : el.oMatchesSelector;
+ return matches.call(el, sel);
+ };
+
+ parseShorthand = function(obj, props) {
+ var i, out, prop, vals, _i, _len;
+ if (obj == null) {
+ return obj;
+ } else if (typeof obj === 'object') {
+ return obj;
+ } else {
+ vals = obj.split(' ');
+ if (vals.length > props.length) {
+ vals[0] = vals.slice(0, +(vals.length - props.length) + 1 || 9e9).join(' ');
+ vals.splice(1, vals.length - props.length);
+ }
+ out = {};
+ for (i = _i = 0, _len = props.length; _i < _len; i = ++_i) {
+ prop = props[i];
+ out[prop] = vals[i];
+ }
+ return out;
+ }
+ };
+
+ Step = (function(_super) {
+ __extends(Step, _super);
+
+ function Step(tour, options) {
+ this.tour = tour;
+ this.destroy = __bind(this.destroy, this);
+ this.scrollTo = __bind(this.scrollTo, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.isOpen = __bind(this.isOpen, this);
+ this.hide = __bind(this.hide, this);
+ this.show = __bind(this.show, this);
+ this.setOptions(options);
+ this;
+ }
+
+ Step.prototype.setOptions = function(options) {
+ var event, handler, _base, _ref1;
+ this.options = options != null ? options : {};
+ this.destroy();
+ this.id = this.options.id || this.id || ("step-" + (uniqueId()));
+ if (this.options.when) {
+ _ref1 = this.options.when;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ this.on(event, handler, this);
+ }
+ }
+ return (_base = this.options).buttons != null ? (_base = this.options).buttons : _base.buttons = [
+ {
+ text: 'Next',
+ action: this.tour.next
+ }
+ ];
+ };
+
+ Step.prototype.getTour = function() {
+ return this.tour;
+ };
+
+ Step.prototype.bindAdvance = function() {
+ var event, handler, selector, _ref1,
+ _this = this;
+ _ref1 = parseShorthand(this.options.advanceOn, ['selector', 'event']), event = _ref1.event, selector = _ref1.selector;
+ handler = function(e) {
+ if (!_this.isOpen()) {
+ return;
+ }
+ if (selector != null) {
+ if (matchesSelector(e.target, selector)) {
+ return _this.tour.next();
+ }
+ } else {
+ if (_this.el && e.target === _this.el) {
+ return _this.tour.next();
+ }
+ }
+ };
+ document.body.addEventListener(event, handler);
+ return this.on('destroy', function() {
+ return document.body.removeEventListener(event, handler);
+ });
+ };
+
+ Step.prototype.getAttachTo = function() {
+ var opts;
+ opts = parseShorthand(this.options.attachTo, ['element', 'on']);
+ if (opts == null) {
+ opts = {};
+ }
+ if (typeof opts.element === 'string') {
+ opts.element = document.querySelector(opts.element);
+ if (opts.element == null) {
+ throw new Error("Shepherd step's attachTo was not found in the page");
+ }
+ }
+ return opts;
+ };
+
+ Step.prototype.setupTether = function() {
+ var attachment, opts, tetherOpts;
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("Using the attachment feature of Shepherd requires the Tether library");
+ }
+ opts = this.getAttachTo();
+ attachment = ATTACHMENT[opts.on || 'right'];
+ if (opts.element == null) {
+ opts.element = 'viewport';
+ attachment = 'middle center';
+ }
+ tetherOpts = {
+ classPrefix: 'shepherd',
+ element: this.el,
+ constraints: [
+ {
+ to: 'window',
+ pin: true,
+ attachment: 'together'
+ }
+ ],
+ target: opts.element,
+ offset: opts.offset || '0 0',
+ attachment: attachment
+ };
+ return this.tether = new Tether(extend(tetherOpts, this.options.tetherOptions));
+ };
+
+ Step.prototype.show = function() {
+ var _ref1,
+ _this = this;
+ if (this.el == null) {
+ this.render();
+ }
+ addClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.enable();
+ }
+ if (this.options.scrollTo) {
+ setTimeout(function() {
+ return _this.scrollTo();
+ });
+ }
+ return this.trigger('show');
+ };
+
+ Step.prototype.hide = function() {
+ var _ref1;
+ removeClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.disable();
+ }
+ return this.trigger('hide');
+ };
+
+ Step.prototype.isOpen = function() {
+ return hasClass(this.el, 'shepherd-open');
+ };
+
+ Step.prototype.cancel = function() {
+ this.hide();
+ return this.trigger('cancel');
+ };
+
+ Step.prototype.complete = function() {
+ this.hide();
+ return this.trigger('complete');
+ };
+
+ Step.prototype.scrollTo = function() {
+ var element;
+ element = this.getAttachTo().element;
+ return element != null ? element.scrollIntoView() : void 0;
+ };
+
+ Step.prototype.destroy = function() {
+ var _ref1;
+ if (this.el != null) {
+ document.body.removeChild(this.el);
+ delete this.el;
+ }
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ return this.trigger('destroy');
+ };
+
+ Step.prototype.render = function() {
+ var button, buttons, cfg, content, footer, header, paragraph, paragraphs, text, _i, _j, _len, _len1, _ref1, _ref2, _ref3;
+ if (this.el != null) {
+ this.destroy();
+ }
+ this.el = createFromHTML("");
+ content = document.createElement('div');
+ content.className = 'shepherd-content';
+ this.el.appendChild(content);
+ if (this.options.title != null) {
+ header = document.createElement('header');
+ header.innerHTML = "" + this.options.title + "
";
+ this.el.className += ' shepherd-has-title';
+ content.appendChild(header);
+ }
+ if (this.options.text != null) {
+ text = createFromHTML("");
+ paragraphs = this.options.text;
+ if (typeof paragraphs === 'string') {
+ paragraphs = [paragraphs];
+ }
+ for (_i = 0, _len = paragraphs.length; _i < _len; _i++) {
+ paragraph = paragraphs[_i];
+ text.innerHTML += "" + paragraph + "
";
+ }
+ content.appendChild(text);
+ }
+ footer = document.createElement('footer');
+ if (this.options.buttons) {
+ buttons = createFromHTML("");
+ _ref2 = this.options.buttons;
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
+ cfg = _ref2[_j];
+ button = createFromHTML("" + cfg.text + "");
+ buttons.appendChild(button);
+ this.bindButtonEvents(cfg, button.querySelector('a'));
+ }
+ footer.appendChild(buttons);
+ }
+ content.appendChild(footer);
+ document.body.appendChild(this.el);
+ this.setupTether();
+ if (this.options.advanceOn) {
+ return this.bindAdvance();
+ }
+ };
+
+ Step.prototype.bindButtonEvents = function(cfg, el) {
+ var event, handler, page, _ref1,
+ _this = this;
+ if (cfg.events == null) {
+ cfg.events = {};
+ }
+ if (cfg.action != null) {
+ cfg.events.click = cfg.action;
+ }
+ _ref1 = cfg.events;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ if (typeof handler === 'string') {
+ page = handler;
+ handler = function() {
+ return _this.tour.show(page);
+ };
+ }
+ el.addEventListener(event, handler);
+ }
+ return this.on('destroy', function() {
+ var _ref2, _results;
+ _ref2 = cfg.events;
+ _results = [];
+ for (event in _ref2) {
+ handler = _ref2[event];
+ _results.push(el.removeEventListener(event, handler));
+ }
+ return _results;
+ });
+ };
+
+ return Step;
+
+ })(Evented);
+
+ Tour = (function(_super) {
+ __extends(Tour, _super);
+
+ function Tour(options) {
+ var event, _i, _len, _ref1, _ref2,
+ _this = this;
+ this.options = options != null ? options : {};
+ this.hide = __bind(this.hide, this);
+ this.cancel = __bind(this.cancel, this);
+ this.back = __bind(this.back, this);
+ this.next = __bind(this.next, this);
+ this.steps = (_ref1 = this.options.steps) != null ? _ref1 : [];
+ _ref2 = ['complete', 'cancel', 'hide', 'start', 'show'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ event = _ref2[_i];
+ this.on(event, function(opts) {
+ if (opts == null) {
+ opts = {};
+ }
+ opts.tour = _this;
+ return Shepherd.trigger(event, opts);
+ });
+ }
+ this;
+ }
+
+ Tour.prototype.addStep = function(name, step) {
+ var _ref1;
+ if (step == null) {
+ step = name;
+ }
+ if (!(step instanceof Step)) {
+ if ((_ref1 = typeof name) === 'string' || _ref1 === 'number') {
+ step.id = name.toString();
+ }
+ step = extend({}, this.options.defaults, step);
+ step = new Step(this, step);
+ } else {
+ step.tour = this;
+ }
+ this.steps.push(step);
+ return step;
+ };
+
+ Tour.prototype.getById = function(id) {
+ var step, _i, _len, _ref1;
+ _ref1 = this.steps;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ step = _ref1[_i];
+ if (step.id === id) {
+ return step;
+ }
+ }
+ };
+
+ Tour.prototype.getCurrentStep = function() {
+ return this.currentStep;
+ };
+
+ Tour.prototype.next = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ if (index === this.steps.length - 1) {
+ this.hide(index);
+ this.trigger('complete');
+ return this.done();
+ } else {
+ return this.show(index + 1);
+ }
+ };
+
+ Tour.prototype.back = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ return this.show(index - 1);
+ };
+
+ Tour.prototype.cancel = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.cancel();
+ }
+ this.trigger('cancel');
+ return this.done();
+ };
+
+ Tour.prototype.hide = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('hide');
+ return this.done();
+ };
+
+ Tour.prototype.done = function() {
+ return Shepherd.activeTour = null;
+ };
+
+ Tour.prototype.show = function(key) {
+ var next;
+ if (key == null) {
+ key = 0;
+ }
+ if (this.currentStep) {
+ this.currentStep.hide();
+ }
+ Shepherd.activeTour = this;
+ if (typeof key === 'string') {
+ next = this.getById(key);
+ } else {
+ next = this.steps[key];
+ }
+ if (next) {
+ this.trigger('show', {
+ step: next,
+ previous: this.currentStep
+ });
+ this.currentStep = next;
+ return next.show();
+ }
+ };
+
+ Tour.prototype.start = function() {
+ this.trigger('start');
+ this.currentStep = null;
+ return this.next();
+ };
+
+ return Tour;
+
+ })(Evented);
+
+ Shepherd = new Evented;
+
+ extend(Shepherd, {
+ Tour: Tour,
+ Step: Step,
+ Evented: Evented
+ });
+
+ window.Shepherd = Shepherd;
+
+}).call(this);
diff --git a/ajax/libs/shepherd/0.4.4/shepherd.min.js b/ajax/libs/shepherd/0.4.4/shepherd.min.js
new file mode 100644
index 000000000..4b43955dd
--- /dev/null
+++ b/ajax/libs/shepherd/0.4.4/shepherd.min.js
@@ -0,0 +1,2 @@
+/*! shepherd 0.4.4 */
+!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e(require,exports,module):t.Tether=e()}(this,function(){return function(){var t,e,o,i,n,s,r,h,l,a,p,u,f,d,c,g,m,v={}.hasOwnProperty,b=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1},y=[].slice;null==this.Tether&&(this.Tether={modules:[]}),p=function(t){var e,o,i,n,s;if(o=getComputedStyle(t).position,"fixed"===o)return t;for(i=void 0,e=t;e=e.parentNode;){try{n=getComputedStyle(e)}catch(r){}if(null==n)return e;if(/(auto|scroll)/.test(n.overflow+n["overflow-y"]+n["overflow-x"])&&("absolute"!==o||"relative"===(s=n.position)||"absolute"===s||"fixed"===s))return e}return document.body},c=function(){var t;return t=0,function(){return t++}}(),m={},l=function(t){var e,i,s,r,h;if(s=t._tetherZeroElement,null==s&&(s=t.createElement("div"),s.setAttribute("data-tether-id",c()),n(s.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(s),t._tetherZeroElement=s),e=s.getAttribute("data-tether-id"),null==m[e]){m[e]={},h=s.getBoundingClientRect();for(i in h)r=h[i],m[e][i]=r;o(function(){return m[e]=void 0})}return m[e]},f=null,r=function(t){var e,o,i,n,s,r,h;t===document?(o=document,t=document.documentElement):o=t.ownerDocument,i=o.documentElement,e={},h=t.getBoundingClientRect();for(n in h)r=h[n],e[n]=r;return s=l(o),e.top-=s.top,e.left-=s.left,null==e.width&&(e.width=document.body.scrollWidth-e.left-e.right),null==e.height&&(e.height=document.body.scrollHeight-e.top-e.bottom),e.top=e.top-i.clientTop,e.left=e.left-i.clientLeft,e.right=o.body.clientWidth-e.width-e.left,e.bottom=o.body.clientHeight-e.height-e.top,e},h=function(t){return t.offsetParent||document.documentElement},a=function(){var t,e,o,i,s;return t=document.createElement("div"),t.style.width="100%",t.style.height="200px",e=document.createElement("div"),n(e.style,{position:"absolute",top:0,left:0,pointerEvents:"none",visibility:"hidden",width:"200px",height:"150px",overflow:"hidden"}),e.appendChild(t),document.body.appendChild(e),i=t.offsetWidth,e.style.overflow="scroll",s=t.offsetWidth,i===s&&(s=e.clientWidth),document.body.removeChild(e),o=i-s,{width:o,height:o}},n=function(t){var e,o,i,n,s,r,h;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),h=e.slice(1),s=0,r=h.length;r>s;s++)if(i=h[s])for(o in i)v.call(i,o)&&(n=i[o],t[o]=n);return t},d=function(t,e){var o,i,n,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],i=0,n=s.length;n>i;i++)o=s[i],o.trim()&&r.push(t.classList.remove(o));return r}return t.className=t.className.replace(new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi")," ")},e=function(t,e){var o,i,n,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],i=0,n=s.length;n>i;i++)o=s[i],o.trim()&&r.push(t.classList.add(o));return r}return d(t,e),t.className+=" "+e},u=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},g=function(t,o,i){var n,s,r,h,l,a;for(s=0,h=i.length;h>s;s++)n=i[s],b.call(o,n)<0&&u(t,n)&&d(t,n);for(a=[],r=0,l=o.length;l>r;r++)n=o[r],a.push(u(t,n)?void 0:e(t,n));return a},i=[],o=function(t){return i.push(t)},s=function(){var t,e;for(e=[];t=i.pop();)e.push(t());return e},t=function(){function t(){}return t.prototype.on=function(t,e,o,i){var n;return null==i&&(i=!1),null==this.bindings&&(this.bindings={}),null==(n=this.bindings)[t]&&(n[t]=[]),this.bindings[t].push({handler:e,ctx:o,once:i})},t.prototype.once=function(t,e,o){return this.on(t,e,o,!0)},t.prototype.off=function(t,e){var o,i,n;if(null!=(null!=(i=this.bindings)?i[t]:void 0)){if(null==e)return delete this.bindings[t];for(o=0,n=[];o=e&&e>=t-o},x=function(){var t,e,o,i,n;for(t=document.createElement("div"),n=["transform","webkitTransform","OTransform","MozTransform","msTransform"],o=0,i=n.length;i>o;o++)if(e=n[o],void 0!==t.style[e])return e}(),O=[],C=function(){var t,e,o;for(e=0,o=O.length;o>e;e++)t=O[e],t.position(!1);return p()},v=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance?"function"==typeof performance.now?performance.now():void 0:void 0)?t:+new Date},function(){var t,e,o,i,n,s,r,h,l;for(e=null,o=null,i=null,n=function(){if(null!=o&&o>16)return o=Math.min(o-16,250),void(i=setTimeout(n,250));if(!(null!=e&&v()-e<10))return null!=i&&(clearTimeout(i),i=null),e=v(),C(),o=v()-e},h=["resize","scroll","touchmove"],l=[],s=0,r=h.length;r>s;s++)t=h[s],l.push(window.addEventListener(t,n));return l}(),t={center:"center",left:"right",right:"left"},e={middle:"middle",top:"bottom",bottom:"top"},o={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},h=function(o,i){var n,s;return n=o.left,s=o.top,"auto"===n&&(n=t[i.left]),"auto"===s&&(s=e[i.top]),{left:n,top:s}},r=function(t){var e,i;return{left:null!=(e=o[t.left])?e:t.left,top:null!=(i=o[t.top])?i:t.top}},s=function(){var t,e,o,i,n,s,r;for(e=1<=arguments.length?B.call(arguments,0):[],o={top:0,left:0},n=0,s=e.length;s>n;n++)r=e[n],i=r.top,t=r.left,"string"==typeof i&&(i=parseFloat(i,10)),"string"==typeof t&&(t=parseFloat(t,10)),o.top+=i,o.left+=t;return o},b=function(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t},y=w=function(t){var e,o,i;return i=t.split(" "),o=i[0],e=i[1],{top:o,left:e}},A=function(){function t(t){this.position=W(this.position,this);var e,o,n,s,r;for(O.push(this),this.history=[],this.setOptions(t,!1),s=i.modules,o=0,n=s.length;n>o;o++)e=s[o],null!=(r=e.initialize)&&r.call(this);this.position()}return t.modules=[],t.prototype.getClass=function(t){var e,o;return(null!=(e=this.options.classes)?e[t]:void 0)?this.options.classes[t]:(null!=(o=this.options.classes)?o[t]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+t:t:""},t.prototype.setOptions=function(t,e){var o,i,s,r,h,l;for(this.options=t,null==e&&(e=!0),o={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=a(o,this.options),h=this.options,this.element=h.element,this.target=h.target,this.targetModifier=h.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),l=["element","target"],s=0,r=l.length;r>s;s++){if(i=l[s],null==this[i])throw new Error("Tether Error: Both element and target must be defined");null!=this[i].jquery?this[i]=this[i][0]:"string"==typeof this[i]&&(this[i]=document.querySelector(this[i]))}if(n(this.element,this.getClass("element")),n(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=y(this.options.targetAttachment),this.attachment=y(this.options.attachment),this.offset=w(this.options.offset),this.targetOffset=w(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent="scroll-handle"===this.targetModifier?this.target:g(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,o,i,n,s,r,h,l;if(null==this.targetModifier)return u(this.target);switch(this.targetModifier){case"visible":return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:(t=u(this.target),n={height:t.height,width:t.width,top:t.top,left:t.left},n.height=Math.min(n.height,t.height-(pageYOffset-t.top)),n.height=Math.min(n.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),n.height=Math.min(innerHeight,n.height),n.height-=2,n.width=Math.min(n.width,t.width-(pageXOffset-t.left)),n.width=Math.min(n.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),n.width=Math.min(innerWidth,n.width),n.width-=2,n.topl.clientWidth||"scroll"===[h.overflow,h.overflowX]||this.target!==document.body,s=0,o&&(s=15),i=t.height-parseFloat(h.borderTopWidth)-parseFloat(h.borderBottomWidth)-s,n={width:15,height:.975*i*(i/l.scrollHeight),left:t.left+t.width-parseFloat(h.borderLeftWidth)-15},e=0,408>i&&this.target===document.body&&(e=-11e-5*Math.pow(i,2)-.00727*i+22.58),this.target!==document.body&&(n.height=Math.max(n.height,24)),r=this.target.scrollTop/(l.scrollHeight-i),n.top=r*(i-n.height-e)+t.top+parseFloat(h.borderTopWidth),this.target===document.body&&(n.height=Math.max(n.height,24)),n}},t.prototype.clearCache=function(){return this._cache={}},t.prototype.cache=function(t,e){return null==this._cache&&(this._cache={}),null==this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},t.prototype.enable=function(t){return null==t&&(t=!0),n(this.target,this.getClass("enabled")),n(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t?this.position():void 0},t.prototype.disable=function(){return T(this.target,this.getClass("enabled")),T(this.element,this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},t.prototype.destroy=function(){var t,e,o,i,n;for(this.disable(),n=[],t=o=0,i=O.length;i>o;t=++o){if(e=O[t],e===this){O.splice(t,1);break}n.push(void 0)}return n},t.prototype.updateAttachClasses=function(t,e){var o,i,n,s,r,h,a,p,u,f=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),s=["left","top","bottom","right","middle","center"],(null!=(u=this._addAttachClasses)?u.length:void 0)&&this._addAttachClasses.splice(0,this._addAttachClasses.length),o=null!=this._addAttachClasses?this._addAttachClasses:this._addAttachClasses=[],t.top&&o.push(""+this.getClass("element-attached")+"-"+t.top),t.left&&o.push(""+this.getClass("element-attached")+"-"+t.left),e.top&&o.push(""+this.getClass("target-attached")+"-"+e.top),e.left&&o.push(""+this.getClass("target-attached")+"-"+e.left),i=[],r=0,a=s.length;a>r;r++)n=s[r],i.push(""+this.getClass("element-attached")+"-"+n);for(h=0,p=s.length;p>h;h++)n=s[h],i.push(""+this.getClass("target-attached")+"-"+n);return l(function(){return null!=f._addAttachClasses?(S(f.element,f._addAttachClasses,i),S(f.target,f._addAttachClasses,i),f._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,o,n,l,a,d,g,m,v,y,w,C,T,O,x,S,E,A,M,B,W,L,_,P,z,H,F,Y,N,X,j,k,q,U,I,R=this;if(null==t&&(t=!0),this.enabled){for(this.clearCache(),B=h(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,B),e=this.cache("element-bounds",function(){return u(R.element)}),z=e.width,n=e.height,0===z&&0===n&&null!=this.lastSize?(X=this.lastSize,z=X.width,n=X.height):this.lastSize={width:z,height:n},_=L=this.cache("target-bounds",function(){return R.getTargetBounds()}),v=b(r(this.attachment),{width:z,height:n}),W=b(r(B),_),a=b(this.offset,{width:z,height:n}),d=b(this.targetOffset,_),v=s(v,a),W=s(W,d),l=L.left+W.left-v.left,P=L.top+W.top-v.top,j=i.modules,H=0,Y=j.length;Y>H;H++)if(g=j[H],x=g.position.call(this,{left:l,top:P,targetAttachment:B,targetPos:L,attachment:this.attachment,elementPos:e,offset:v,targetOffset:W,manualOffset:a,manualTargetOffset:d,scrollbarSize:A}),null!=x&&"object"==typeof x){if(x===!1)return!1;P=x.top,l=x.left}if(m={page:{top:P,left:l},viewport:{top:P-pageYOffset,bottom:pageYOffset-P-n+innerHeight,left:l-pageXOffset,right:pageXOffset-l-z+innerWidth}},document.body.scrollWidth>window.innerWidth&&(A=this.cache("scrollbar-size",c),m.viewport.bottom-=A.height),document.body.scrollHeight>window.innerHeight&&(A=this.cache("scrollbar-size",c),m.viewport.right-=A.width),(""!==(k=document.body.style.position)&&"static"!==k||""!==(q=document.body.parentElement.style.position)&&"static"!==q)&&(m.page.bottom=document.body.scrollHeight-P-n,m.page.right=document.body.scrollWidth-l-z),(null!=(U=this.options.optimizations)?U.moveElement:void 0)!==!1&&null==this.targetModifier){for(w=this.cache("target-offsetparent",function(){return f(R.target)}),O=this.cache("target-offsetparent-bounds",function(){return u(w)}),T=getComputedStyle(w),o=getComputedStyle(this.element),C=O,y={},I=["Top","Left","Bottom","Right"],F=0,N=I.length;N>F;F++)M=I[F],y[M.toLowerCase()]=parseFloat(T["border"+M+"Width"]);O.right=document.body.scrollWidth-O.left-C.width+y.right,O.bottom=document.body.scrollHeight-O.top-C.height+y.bottom,m.page.top>=O.top+y.top&&m.page.bottom>=O.bottom&&m.page.left>=O.left+y.left&&m.page.right>=O.right&&(E=w.scrollTop,S=w.scrollLeft,m.offset={top:m.page.top-O.top+E-y.top,left:m.page.left-O.left+S-y.left})}return this.move(m),this.history.unshift(m),this.history.length>3&&this.history.pop(),t&&p(),!0}},t.prototype.move=function(t){var e,o,i,n,s,r,h,p,u,d,c,g,m,v,b,y,w,C=this;if(null!=this.element.parentNode){p={};for(d in t){p[d]={};for(n in t[d]){for(i=!1,y=this.history,v=0,b=y.length;b>v;v++)if(h=y[v],!E(null!=(w=h[d])?w[n]:void 0,t[d][n])){i=!0;break}i||(p[d][n]=!0)}}e={top:"",left:"",right:"",bottom:""},u=function(t,o){var i,n,s;return(null!=(s=C.options.optimizations)?s.gpu:void 0)===!1?(t.top?e.top=""+o.top+"px":e.bottom=""+o.bottom+"px",t.left?e.left=""+o.left+"px":e.right=""+o.right+"px"):(t.top?(e.top=0,n=o.top):(e.bottom=0,n=-o.bottom),t.left?(e.left=0,i=o.left):(e.right=0,i=-o.right),e[x]="translateX("+Math.round(i)+"px) translateY("+Math.round(n)+"px)","msTransform"!==x?e[x]+=" translateZ(0)":void 0)},s=!1,(p.page.top||p.page.bottom)&&(p.page.left||p.page.right)?(e.position="absolute",u(p.page,t.page)):(p.viewport.top||p.viewport.bottom)&&(p.viewport.left||p.viewport.right)?(e.position="fixed",u(p.viewport,t.viewport)):null!=p.offset&&p.offset.top&&p.offset.left?(e.position="absolute",r=this.cache("target-offsetparent",function(){return f(C.target)}),f(this.element)!==r&&l(function(){return C.element.parentNode.removeChild(C.element),r.appendChild(C.element)}),u(p.offset,t.offset),s=!0):(e.position="absolute",u({top:!0,left:!0},t.page)),s||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),m={},g=!1;for(n in e)c=e[n],o=this.element.style[n],""===o||""===c||"top"!==n&&"left"!==n&&"bottom"!==n&&"right"!==n||(o=parseFloat(o),c=parseFloat(c)),o!==c&&(g=!0,m[n]=e[n]);return g?l(function(){return a(C.element.style,m)}):void 0}},t}(),i.position=C,this.Tether=a(A,i)}.call(this),function(){var t,e,o,i,n,s,r,h,l,a,p=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1};a=this.Tether.Utils,r=a.getOuterSize,s=a.getBounds,h=a.getSize,i=a.extend,l=a.updateClasses,o=a.defer,e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},t=["left","top","right","bottom"],n=function(e,o){var i,n,r,h,l,a,p;if("scrollParent"===o?o=e.scrollParent:"window"===o&&(o=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),o===document&&(o=o.documentElement),null!=o.nodeType)for(n=h=s(o),l=getComputedStyle(o),o=[n.left,n.top,h.width+n.left,h.height+n.top],i=a=0,p=t.length;p>a;i=++a)r=t[i],r=r[0].toUpperCase()+r.substr(1),"Top"===r||"Left"===r?o[i]+=parseFloat(l["border"+r+"Width"]):o[i]-=parseFloat(l["border"+r+"Width"]);return o},this.Tether.modules.push({position:function(e){var r,h,a,u,f,d,c,g,m,v,b,y,w,C,T,O,x,S,E,A,M,B,W,L,_,P,z,H,F,Y,N,X,j,k,q,U,I,R,D,Z,$,V,G,J,K,Q,te,ee=this;if(P=e.top,b=e.left,M=e.targetAttachment,!this.options.constraints)return!0;for(S=function(e){var o,i,n,s;for(ee.removeClass(e),s=[],i=0,n=t.length;n>i;i++)o=t[i],s.push(ee.removeClass(""+e+"-"+o));return s},Z=this.cache("element-bounds",function(){return s(ee.element)}),v=Z.height,z=Z.width,0===z&&0===v&&null!=this.lastSize&&($=this.lastSize,z=$.width,v=$.height),W=this.cache("target-bounds",function(){return ee.getTargetBounds()}),B=W.height,L=W.width,A={},m={},h=[this.getClass("pinned"),this.getClass("out-of-bounds")],V=this.options.constraints,H=0,X=V.length;X>H;H++)g=V[H],g.outOfBoundsClass&&h.push(g.outOfBoundsClass),g.pinnedClass&&h.push(g.pinnedClass);for(F=0,j=h.length;j>F;F++)for(c=h[F],G=["left","top","right","bottom"],Y=0,k=G.length;k>Y;Y++)E=G[Y],h.push(""+c+"-"+E);for(r=[],A=i({},M),m=i({},this.attachment),J=this.options.constraints,N=0,q=J.length;q>N;N++){if(g=J[N],_=g.to,a=g.attachment,T=g.pin,null==a&&(a=""),p.call(a," ")>=0?(K=a.split(" "),d=K[0],f=K[1]):f=d=a,u=n(this,_),("target"===d||"both"===d)&&(Pu[3]&&"bottom"===A.top&&(P-=B,A.top="top")),"together"===d&&(Pu[3]&&"bottom"===A.top&&("top"===m.top?(P-=B,A.top="top",P-=v,m.top="bottom"):"bottom"===m.top&&(P-=B,A.top="top",P+=v,m.top="top")),"middle"===A.top&&(P+v>u[3]&&"top"===m.top?(P-=v,m.top="bottom"):Pu[2]&&"right"===A.left&&(b-=L,A.left="left")),"together"===f&&(bu[2]&&"right"===A.left?"left"===m.left?(b-=L,A.left="left",b-=z,m.left="right"):"right"===m.left&&(b-=L,A.left="left",b+=z,m.left="left"):"center"===A.left&&(b+z>u[2]&&"left"===m.left?(b-=z,m.left="right"):bu[3]&&"top"===m.top&&(P-=v,m.top="bottom")),("element"===f||"both"===f)&&(bu[2]&&"left"===m.left&&(b-=z,m.left="right")),"string"==typeof T?T=function(){var t,e,o,i;for(o=T.split(","),i=[],e=0,t=o.length;t>e;e++)C=o[e],i.push(C.trim());return i}():T===!0&&(T=["top","left","right","bottom"]),T||(T=[]),O=[],y=[],P=0?(P=u[1],O.push("top")):y.push("top")),P+v>u[3]&&(p.call(T,"bottom")>=0?(P=u[3]-v,O.push("bottom")):y.push("bottom")),b=0?(b=u[0],O.push("left")):y.push("left")),b+z>u[2]&&(p.call(T,"right")>=0?(b=u[2]-z,O.push("right")):y.push("right")),O.length)for(x=null!=(Q=this.options.pinnedClass)?Q:this.getClass("pinned"),r.push(x),R=0,U=O.length;U>R;R++)E=O[R],r.push(""+x+"-"+E);if(y.length)for(w=null!=(te=this.options.outOfBoundsClass)?te:this.getClass("out-of-bounds"),r.push(w),D=0,I=y.length;I>D;D++)E=y[D],r.push(""+w+"-"+E);(p.call(O,"left")>=0||p.call(O,"right")>=0)&&(m.left=A.left=!1),(p.call(O,"top")>=0||p.call(O,"bottom")>=0)&&(m.top=A.top=!1),(A.top!==M.top||A.left!==M.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,A)}return o(function(){return l(ee.target,r,h),l(ee.element,r,h)}),{top:P,left:b}}})}.call(this),function(){var t,e,o,i;i=this.Tether.Utils,e=i.getBounds,o=i.updateClasses,t=i.defer,this.Tether.modules.push({position:function(i){var n,s,r,h,l,a,p,u,f,d,c,g,m,v,b,y,w,C,T,O,x,S,E,A,M,B=this;if(c=i.top,a=i.left,x=this.cache("element-bounds",function(){return e(B.element)}),l=x.height,g=x.width,d=this.getTargetBounds(),h=c+l,p=a+g,n=[],c<=d.bottom&&h>=d.top)for(S=["left","right"],m=0,w=S.length;w>m;m++)u=S[m],((E=d[u])===a||E===p)&&n.push(u);if(a<=d.right&&p>=d.left)for(A=["top","bottom"],v=0,C=A.length;C>v;v++)u=A[v],((M=d[u])===c||M===h)&&n.push(u);for(r=[],s=[],f=["left","top","right","bottom"],r.push(this.getClass("abutted")),b=0,T=f.length;T>b;b++)u=f[b],r.push(""+this.getClass("abutted")+"-"+u);for(n.length&&s.push(this.getClass("abutted")),y=0,O=n.length;O>y;y++)u=n[y],s.push(""+this.getClass("abutted")+"-"+u);return t(function(){return o(B.target,s,r),o(B.element,s,r)}),!0}})}.call(this),function(){this.Tether.modules.push({position:function(t){var e,o,i,n,s,r,h;return r=t.top,e=t.left,this.options.shift?(o=function(t){return"function"==typeof t?t.call(this,{top:r,left:e}):t},i=o(this.options.shift),"string"==typeof i?(i=i.split(" "),i[1]||(i[1]=i[0]),s=i[0],n=i[1],s=parseFloat(s,10),n=parseFloat(n,10)):(h=[i.top,i.left],s=h[0],n=h[1]),r+=s,e+=n,{top:r,left:e}):void 0}})}.call(this),this.Tether}),function(){var t,e,o,i,n,s,r,h,l,a,p,u,f,d,c,g=function(t,e){return function(){return t.apply(e,arguments)}},m={}.hasOwnProperty,v=function(t,e){function o(){this.constructor=t}for(var i in e)m.call(e,i)&&(t[i]=e[i]);return o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype,t};c=Tether.Utils,h=c.extend,f=c.removeClass,s=c.addClass,a=c.hasClass,e=c.Evented,l=c.getBounds,d=c.uniqueId,t={top:"top center",left:"middle right",right:"middle left",bottom:"bottom center"},r=function(t){var e;return e=document.createElement("div"),e.innerHTML=t,e.children[0]},p=function(t,e){var o,i,n,s,r;return o=null!=(i=null!=(n=null!=(s=null!=(r=t.matches)?r:t.matchesSelector)?s:t.webkitMatchesSelector)?n:t.mozMatchesSelector)?i:t.oMatchesSelector,o.call(t,e)},u=function(t,e){var o,i,n,s,r,h;if(null==t)return t;if("object"==typeof t)return t;for(s=t.split(" "),s.length>e.length&&(s[0]=s.slice(0,+(s.length-e.length)+1||9e9).join(" "),s.splice(1,s.length-e.length)),i={},o=r=0,h=e.length;h>r;o=++r)n=e[o],i[n]=s[o];return i},i=function(e){function o(t,e){this.tour=t,this.destroy=g(this.destroy,this),this.scrollTo=g(this.scrollTo,this),this.complete=g(this.complete,this),this.cancel=g(this.cancel,this),this.isOpen=g(this.isOpen,this),this.hide=g(this.hide,this),this.show=g(this.show,this),this.setOptions(e)}return v(o,e),o.prototype.setOptions=function(t){var e,o,i,n;if(this.options=null!=t?t:{},this.destroy(),this.id=this.options.id||this.id||"step-"+d(),this.options.when){n=this.options.when;for(e in n)o=n[e],this.on(e,o,this)}return null!=(i=this.options).buttons?(i=this.options).buttons:i.buttons=[{text:"Next",action:this.tour.next}]},o.prototype.getTour=function(){return this.tour},o.prototype.bindAdvance=function(){var t,e,o,i,n=this;return i=u(this.options.advanceOn,["selector","event"]),t=i.event,o=i.selector,e=function(t){if(n.isOpen())if(null!=o){if(p(t.target,o))return n.tour.next()}else if(n.el&&t.target===n.el)return n.tour.next()},document.body.addEventListener(t,e),this.on("destroy",function(){return document.body.removeEventListener(t,e)})},o.prototype.getAttachTo=function(){var t;if(t=u(this.options.attachTo,["element","on"]),null==t&&(t={}),"string"==typeof t.element&&(t.element=document.querySelector(t.element),null==t.element))throw new Error("Shepherd step's attachTo was not found in the page");return t},o.prototype.setupTether=function(){var e,o,i;if("undefined"==typeof Tether||null===Tether)throw new Error("Using the attachment feature of Shepherd requires the Tether library");return o=this.getAttachTo(),e=t[o.on||"right"],null==o.element&&(o.element="viewport",e="middle center"),i={classPrefix:"shepherd",element:this.el,constraints:[{to:"window",pin:!0,attachment:"together"}],target:o.element,offset:o.offset||"0 0",attachment:e},this.tether=new Tether(h(i,this.options.tetherOptions))},o.prototype.show=function(){var t,e=this;return null==this.el&&this.render(),s(this.el,"shepherd-open"),null!=(t=this.tether)&&t.enable(),this.options.scrollTo&&setTimeout(function(){return e.scrollTo()}),this.trigger("show")},o.prototype.hide=function(){var t;return f(this.el,"shepherd-open"),null!=(t=this.tether)&&t.disable(),this.trigger("hide")},o.prototype.isOpen=function(){return a(this.el,"shepherd-open")},o.prototype.cancel=function(){return this.hide(),this.trigger("cancel")},o.prototype.complete=function(){return this.hide(),this.trigger("complete")},o.prototype.scrollTo=function(){var t;return t=this.getAttachTo().element,null!=t?t.scrollIntoView():void 0},o.prototype.destroy=function(){var t;return null!=this.el&&(document.body.removeChild(this.el),delete this.el),null!=(t=this.tether)&&t.destroy(),this.trigger("destroy")},o.prototype.render=function(){var t,e,o,i,n,s,h,l,a,p,u,f,d,c,g,m;if(null!=this.el&&this.destroy(),this.el=r(""),i=document.createElement("div"),i.className="shepherd-content",this.el.appendChild(i),null!=this.options.title&&(s=document.createElement("header"),s.innerHTML=""+this.options.title+"
",this.el.className+=" shepherd-has-title",i.appendChild(s)),null!=this.options.text){for(a=r(""),l=this.options.text,"string"==typeof l&&(l=[l]),p=0,f=l.length;f>p;p++)h=l[p],a.innerHTML+=""+h+"
";i.appendChild(a)}if(n=document.createElement("footer"),this.options.buttons){for(e=r(""),g=this.options.buttons,u=0,d=g.length;d>u;u++)o=g[u],t=r(""+o.text+""),e.appendChild(t),this.bindButtonEvents(o,t.querySelector("a"));n.appendChild(e)}return i.appendChild(n),document.body.appendChild(this.el),this.setupTether(),this.options.advanceOn?this.bindAdvance():void 0},o.prototype.bindButtonEvents=function(t,e){var o,i,n,s,r=this;null==t.events&&(t.events={}),null!=t.action&&(t.events.click=t.action),s=t.events;for(o in s)i=s[o],"string"==typeof i&&(n=i,i=function(){return r.tour.show(n)}),e.addEventListener(o,i);return this.on("destroy",function(){var n,s;n=t.events,s=[];for(o in n)i=n[o],s.push(e.removeEventListener(o,i));return s})},o}(e),n=function(t){function e(t){var e,i,n,s,r,h=this;for(this.options=null!=t?t:{},this.hide=g(this.hide,this),this.cancel=g(this.cancel,this),this.back=g(this.back,this),this.next=g(this.next,this),this.steps=null!=(s=this.options.steps)?s:[],r=["complete","cancel","hide","start","show"],i=0,n=r.length;n>i;i++)e=r[i],this.on(e,function(t){return null==t&&(t={}),t.tour=h,o.trigger(e,t)})}return v(e,t),e.prototype.addStep=function(t,e){var o;return null==e&&(e=t),e instanceof i?e.tour=this:(("string"==(o=typeof t)||"number"===o)&&(e.id=t.toString()),e=h({},this.options.defaults,e),e=new i(this,e)),this.steps.push(e),e},e.prototype.getById=function(t){var e,o,i,n;for(n=this.steps,o=0,i=n.length;i>o;o++)if(e=n[o],e.id===t)return e},e.prototype.getCurrentStep=function(){return this.currentStep},e.prototype.next=function(){var t;return t=this.steps.indexOf(this.currentStep),t===this.steps.length-1?(this.hide(t),this.trigger("complete"),this.done()):this.show(t+1)},e.prototype.back=function(){var t;return t=this.steps.indexOf(this.currentStep),this.show(t-1)},e.prototype.cancel=function(){var t;return null!=(t=this.currentStep)&&t.cancel(),this.trigger("cancel"),this.done()},e.prototype.hide=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("hide"),this.done()},e.prototype.done=function(){return o.activeTour=null},e.prototype.show=function(t){var e;return null==t&&(t=0),this.currentStep&&this.currentStep.hide(),o.activeTour=this,e="string"==typeof t?this.getById(t):this.steps[t],e?(this.trigger("show",{step:e,previous:this.currentStep}),this.currentStep=e,e.show()):void 0},e.prototype.start=function(){return this.trigger("start"),this.currentStep=null,this.next()},e}(e),o=new e,h(o,{Tour:n,Step:i,Evented:e}),window.Shepherd=o}.call(this);
\ No newline at end of file
diff --git a/ajax/libs/shepherd/0.4.5/shepherd.js b/ajax/libs/shepherd/0.4.5/shepherd.js
new file mode 100644
index 000000000..c2a167d3e
--- /dev/null
+++ b/ajax/libs/shepherd/0.4.5/shepherd.js
@@ -0,0 +1,1887 @@
+/*! shepherd 0.4.5 */
+/*! tether 0.6.5 */
+
+
+(function(root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(factory);
+ } else if (typeof exports === 'object') {
+ module.exports = factory(require,exports,module);
+ } else {
+ root.Tether = factory();
+ }
+}(this, function(require,exports,module) {
+
+(function() {
+ var Evented, addClass, defer, deferred, extend, flush, getBounds, getOffsetParent, getOrigin, getScrollBarSize, getScrollParent, hasClass, node, removeClass, uniqueId, updateClasses, zeroPosCache,
+ __hasProp = {}.hasOwnProperty,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
+ __slice = [].slice;
+
+ if (this.Tether == null) {
+ this.Tether = {
+ modules: []
+ };
+ }
+
+ getScrollParent = function(el) {
+ var parent, position, scrollParent, style, _ref;
+ position = getComputedStyle(el).position;
+ if (position === 'fixed') {
+ return el;
+ }
+ scrollParent = void 0;
+ parent = el;
+ while (parent = parent.parentNode) {
+ try {
+ style = getComputedStyle(parent);
+ } catch (_error) {}
+ if (style == null) {
+ return parent;
+ }
+ if (/(auto|scroll)/.test(style['overflow'] + style['overflow-y'] + style['overflow-x'])) {
+ if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) {
+ return parent;
+ }
+ }
+ }
+ return document.body;
+ };
+
+ uniqueId = (function() {
+ var id;
+ id = 0;
+ return function() {
+ return id++;
+ };
+ })();
+
+ zeroPosCache = {};
+
+ getOrigin = function(doc) {
+ var id, k, node, v, _ref;
+ node = doc._tetherZeroElement;
+ if (node == null) {
+ node = doc.createElement('div');
+ node.setAttribute('data-tether-id', uniqueId());
+ extend(node.style, {
+ top: 0,
+ left: 0,
+ position: 'absolute'
+ });
+ doc.body.appendChild(node);
+ doc._tetherZeroElement = node;
+ }
+ id = node.getAttribute('data-tether-id');
+ if (zeroPosCache[id] == null) {
+ zeroPosCache[id] = {};
+ _ref = node.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ zeroPosCache[id][k] = v;
+ }
+ defer(function() {
+ return zeroPosCache[id] = void 0;
+ });
+ }
+ return zeroPosCache[id];
+ };
+
+ node = null;
+
+ getBounds = function(el) {
+ var box, doc, docEl, k, origin, v, _ref;
+ if (el === document) {
+ doc = document;
+ el = document.documentElement;
+ } else {
+ doc = el.ownerDocument;
+ }
+ docEl = doc.documentElement;
+ box = {};
+ _ref = el.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ box[k] = v;
+ }
+ origin = getOrigin(doc);
+ box.top -= origin.top;
+ box.left -= origin.left;
+ if (box.width == null) {
+ box.width = document.body.scrollWidth - box.left - box.right;
+ }
+ if (box.height == null) {
+ box.height = document.body.scrollHeight - box.top - box.bottom;
+ }
+ box.top = box.top - docEl.clientTop;
+ box.left = box.left - docEl.clientLeft;
+ box.right = doc.body.clientWidth - box.width - box.left;
+ box.bottom = doc.body.clientHeight - box.height - box.top;
+ return box;
+ };
+
+ getOffsetParent = function(el) {
+ return el.offsetParent || document.documentElement;
+ };
+
+ getScrollBarSize = function() {
+ var inner, outer, width, widthContained, widthScroll;
+ inner = document.createElement('div');
+ inner.style.width = '100%';
+ inner.style.height = '200px';
+ outer = document.createElement('div');
+ extend(outer.style, {
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ pointerEvents: 'none',
+ visibility: 'hidden',
+ width: '200px',
+ height: '150px',
+ overflow: 'hidden'
+ });
+ outer.appendChild(inner);
+ document.body.appendChild(outer);
+ widthContained = inner.offsetWidth;
+ outer.style.overflow = 'scroll';
+ widthScroll = inner.offsetWidth;
+ if (widthContained === widthScroll) {
+ widthScroll = outer.clientWidth;
+ }
+ document.body.removeChild(outer);
+ width = widthContained - widthScroll;
+ return {
+ width: width,
+ height: width
+ };
+ };
+
+ extend = function(out) {
+ var args, key, obj, val, _i, _len, _ref;
+ if (out == null) {
+ out = {};
+ }
+ args = [];
+ Array.prototype.push.apply(args, arguments);
+ _ref = args.slice(1);
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ obj = _ref[_i];
+ if (obj) {
+ for (key in obj) {
+ if (!__hasProp.call(obj, key)) continue;
+ val = obj[key];
+ out[key] = val;
+ }
+ }
+ }
+ return out;
+ };
+
+ removeClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ if (cls.trim()) {
+ _results.push(el.classList.remove(cls));
+ }
+ }
+ return _results;
+ } else {
+ return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' ');
+ }
+ };
+
+ addClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ if (cls.trim()) {
+ _results.push(el.classList.add(cls));
+ }
+ }
+ return _results;
+ } else {
+ removeClass(el, name);
+ return el.className += " " + name;
+ }
+ };
+
+ hasClass = function(el, name) {
+ if (el.classList != null) {
+ return el.classList.contains(name);
+ } else {
+ return new RegExp("(^| )" + name + "( |$)", 'gi').test(el.className);
+ }
+ };
+
+ updateClasses = function(el, add, all) {
+ var cls, _i, _j, _len, _len1, _results;
+ for (_i = 0, _len = all.length; _i < _len; _i++) {
+ cls = all[_i];
+ if (__indexOf.call(add, cls) < 0) {
+ if (hasClass(el, cls)) {
+ removeClass(el, cls);
+ }
+ }
+ }
+ _results = [];
+ for (_j = 0, _len1 = add.length; _j < _len1; _j++) {
+ cls = add[_j];
+ if (!hasClass(el, cls)) {
+ _results.push(addClass(el, cls));
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ deferred = [];
+
+ defer = function(fn) {
+ return deferred.push(fn);
+ };
+
+ flush = function() {
+ var fn, _results;
+ _results = [];
+ while (fn = deferred.pop()) {
+ _results.push(fn());
+ }
+ return _results;
+ };
+
+ Evented = (function() {
+ function Evented() {}
+
+ Evented.prototype.on = function(event, handler, ctx, once) {
+ var _base;
+ if (once == null) {
+ once = false;
+ }
+ if (this.bindings == null) {
+ this.bindings = {};
+ }
+ if ((_base = this.bindings)[event] == null) {
+ _base[event] = [];
+ }
+ return this.bindings[event].push({
+ handler: handler,
+ ctx: ctx,
+ once: once
+ });
+ };
+
+ Evented.prototype.once = function(event, handler, ctx) {
+ return this.on(event, handler, ctx, true);
+ };
+
+ Evented.prototype.off = function(event, handler) {
+ var i, _ref, _results;
+ if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
+ return;
+ }
+ if (handler == null) {
+ return delete this.bindings[event];
+ } else {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ if (this.bindings[event][i].handler === handler) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ Evented.prototype.trigger = function() {
+ var args, ctx, event, handler, i, once, _ref, _ref1, _results;
+ event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+ if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
+ handler.apply(ctx != null ? ctx : this, args);
+ if (once) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ return Evented;
+
+ })();
+
+ this.Tether.Utils = {
+ getScrollParent: getScrollParent,
+ getBounds: getBounds,
+ getOffsetParent: getOffsetParent,
+ extend: extend,
+ addClass: addClass,
+ removeClass: removeClass,
+ hasClass: hasClass,
+ updateClasses: updateClasses,
+ defer: defer,
+ flush: flush,
+ uniqueId: uniqueId,
+ Evented: Evented,
+ getScrollBarSize: getScrollBarSize
+ };
+
+}).call(this);
+
+(function() {
+ var MIRROR_LR, MIRROR_TB, OFFSET_MAP, Tether, addClass, addOffset, attachmentToOffset, autoToFixedAttachment, defer, extend, flush, getBounds, getOffsetParent, getOuterSize, getScrollBarSize, getScrollParent, getSize, now, offsetToPx, parseAttachment, parseOffset, position, removeClass, tethers, transformKey, updateClasses, within, _Tether, _ref,
+ __slice = [].slice,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+
+ if (this.Tether == null) {
+ throw new Error("You must include the utils.js file before tether.js");
+ }
+
+ Tether = this.Tether;
+
+ _ref = Tether.Utils, getScrollParent = _ref.getScrollParent, getSize = _ref.getSize, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getOffsetParent = _ref.getOffsetParent, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, updateClasses = _ref.updateClasses, defer = _ref.defer, flush = _ref.flush, getScrollBarSize = _ref.getScrollBarSize;
+
+ within = function(a, b, diff) {
+ if (diff == null) {
+ diff = 1;
+ }
+ return (a + diff >= b && b >= a - diff);
+ };
+
+ transformKey = (function() {
+ var el, key, _i, _len, _ref1;
+ el = document.createElement('div');
+ _ref1 = ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ key = _ref1[_i];
+ if (el.style[key] !== void 0) {
+ return key;
+ }
+ }
+ })();
+
+ tethers = [];
+
+ position = function() {
+ var tether, _i, _len;
+ for (_i = 0, _len = tethers.length; _i < _len; _i++) {
+ tether = tethers[_i];
+ tether.position(false);
+ }
+ return flush();
+ };
+
+ now = function() {
+ var _ref1;
+ return (_ref1 = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref1 : +(new Date);
+ };
+
+ (function() {
+ var event, lastCall, lastDuration, pendingTimeout, tick, _i, _len, _ref1, _results;
+ lastCall = null;
+ lastDuration = null;
+ pendingTimeout = null;
+ tick = function() {
+ if ((lastDuration != null) && lastDuration > 16) {
+ lastDuration = Math.min(lastDuration - 16, 250);
+ pendingTimeout = setTimeout(tick, 250);
+ return;
+ }
+ if ((lastCall != null) && (now() - lastCall) < 10) {
+ return;
+ }
+ if (pendingTimeout != null) {
+ clearTimeout(pendingTimeout);
+ pendingTimeout = null;
+ }
+ lastCall = now();
+ position();
+ return lastDuration = now() - lastCall;
+ };
+ _ref1 = ['resize', 'scroll', 'touchmove'];
+ _results = [];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ event = _ref1[_i];
+ _results.push(window.addEventListener(event, tick));
+ }
+ return _results;
+ })();
+
+ MIRROR_LR = {
+ center: 'center',
+ left: 'right',
+ right: 'left'
+ };
+
+ MIRROR_TB = {
+ middle: 'middle',
+ top: 'bottom',
+ bottom: 'top'
+ };
+
+ OFFSET_MAP = {
+ top: 0,
+ left: 0,
+ middle: '50%',
+ center: '50%',
+ bottom: '100%',
+ right: '100%'
+ };
+
+ autoToFixedAttachment = function(attachment, relativeToAttachment) {
+ var left, top;
+ left = attachment.left, top = attachment.top;
+ if (left === 'auto') {
+ left = MIRROR_LR[relativeToAttachment.left];
+ }
+ if (top === 'auto') {
+ top = MIRROR_TB[relativeToAttachment.top];
+ }
+ return {
+ left: left,
+ top: top
+ };
+ };
+
+ attachmentToOffset = function(attachment) {
+ var _ref1, _ref2;
+ return {
+ left: (_ref1 = OFFSET_MAP[attachment.left]) != null ? _ref1 : attachment.left,
+ top: (_ref2 = OFFSET_MAP[attachment.top]) != null ? _ref2 : attachment.top
+ };
+ };
+
+ addOffset = function() {
+ var left, offsets, out, top, _i, _len, _ref1;
+ offsets = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ out = {
+ top: 0,
+ left: 0
+ };
+ for (_i = 0, _len = offsets.length; _i < _len; _i++) {
+ _ref1 = offsets[_i], top = _ref1.top, left = _ref1.left;
+ if (typeof top === 'string') {
+ top = parseFloat(top, 10);
+ }
+ if (typeof left === 'string') {
+ left = parseFloat(left, 10);
+ }
+ out.top += top;
+ out.left += left;
+ }
+ return out;
+ };
+
+ offsetToPx = function(offset, size) {
+ if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
+ offset.left = parseFloat(offset.left, 10) / 100 * size.width;
+ }
+ if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
+ offset.top = parseFloat(offset.top, 10) / 100 * size.height;
+ }
+ return offset;
+ };
+
+ parseAttachment = parseOffset = function(value) {
+ var left, top, _ref1;
+ _ref1 = value.split(' '), top = _ref1[0], left = _ref1[1];
+ return {
+ top: top,
+ left: left
+ };
+ };
+
+ _Tether = (function() {
+ _Tether.modules = [];
+
+ function _Tether(options) {
+ this.position = __bind(this.position, this);
+ var module, _i, _len, _ref1, _ref2;
+ tethers.push(this);
+ this.history = [];
+ this.setOptions(options, false);
+ _ref1 = Tether.modules;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ module = _ref1[_i];
+ if ((_ref2 = module.initialize) != null) {
+ _ref2.call(this);
+ }
+ }
+ this.position();
+ }
+
+ _Tether.prototype.getClass = function(key) {
+ var _ref1, _ref2;
+ if ((_ref1 = this.options.classes) != null ? _ref1[key] : void 0) {
+ return this.options.classes[key];
+ } else if (((_ref2 = this.options.classes) != null ? _ref2[key] : void 0) !== false) {
+ if (this.options.classPrefix) {
+ return "" + this.options.classPrefix + "-" + key;
+ } else {
+ return key;
+ }
+ } else {
+ return '';
+ }
+ };
+
+ _Tether.prototype.setOptions = function(options, position) {
+ var defaults, key, _i, _len, _ref1, _ref2;
+ this.options = options;
+ if (position == null) {
+ position = true;
+ }
+ defaults = {
+ offset: '0 0',
+ targetOffset: '0 0',
+ targetAttachment: 'auto auto',
+ classPrefix: 'tether'
+ };
+ this.options = extend(defaults, this.options);
+ _ref1 = this.options, this.element = _ref1.element, this.target = _ref1.target, this.targetModifier = _ref1.targetModifier;
+ if (this.target === 'viewport') {
+ this.target = document.body;
+ this.targetModifier = 'visible';
+ } else if (this.target === 'scroll-handle') {
+ this.target = document.body;
+ this.targetModifier = 'scroll-handle';
+ }
+ _ref2 = ['element', 'target'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ key = _ref2[_i];
+ if (this[key] == null) {
+ throw new Error("Tether Error: Both element and target must be defined");
+ }
+ if (this[key].jquery != null) {
+ this[key] = this[key][0];
+ } else if (typeof this[key] === 'string') {
+ this[key] = document.querySelector(this[key]);
+ }
+ }
+ addClass(this.element, this.getClass('element'));
+ addClass(this.target, this.getClass('target'));
+ if (!this.options.attachment) {
+ throw new Error("Tether Error: You must provide an attachment");
+ }
+ this.targetAttachment = parseAttachment(this.options.targetAttachment);
+ this.attachment = parseAttachment(this.options.attachment);
+ this.offset = parseOffset(this.options.offset);
+ this.targetOffset = parseOffset(this.options.targetOffset);
+ if (this.scrollParent != null) {
+ this.disable();
+ }
+ if (this.targetModifier === 'scroll-handle') {
+ this.scrollParent = this.target;
+ } else {
+ this.scrollParent = getScrollParent(this.target);
+ }
+ if (this.options.enabled !== false) {
+ return this.enable(position);
+ }
+ };
+
+ _Tether.prototype.getTargetBounds = function() {
+ var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target;
+ if (this.targetModifier != null) {
+ switch (this.targetModifier) {
+ case 'visible':
+ if (this.target === document.body) {
+ return {
+ top: pageYOffset,
+ left: pageXOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(this.target);
+ out = {
+ height: bounds.height,
+ width: bounds.width,
+ top: bounds.top,
+ left: bounds.left
+ };
+ out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
+ out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight)));
+ out.height = Math.min(innerHeight, out.height);
+ out.height -= 2;
+ out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
+ out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth)));
+ out.width = Math.min(innerWidth, out.width);
+ out.width -= 2;
+ if (out.top < pageYOffset) {
+ out.top = pageYOffset;
+ }
+ if (out.left < pageXOffset) {
+ out.left = pageXOffset;
+ }
+ return out;
+ }
+ break;
+ case 'scroll-handle':
+ target = this.target;
+ if (target === document.body) {
+ target = document.documentElement;
+ bounds = {
+ left: pageXOffset,
+ top: pageYOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(target);
+ }
+ style = getComputedStyle(target);
+ hasBottomScroll = target.scrollWidth > target.clientWidth || 'scroll' === [style.overflow, style.overflowX] || this.target !== document.body;
+ scrollBottom = 0;
+ if (hasBottomScroll) {
+ scrollBottom = 15;
+ }
+ height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
+ out = {
+ width: 15,
+ height: height * 0.975 * (height / target.scrollHeight),
+ left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
+ };
+ fitAdj = 0;
+ if (height < 408 && this.target === document.body) {
+ fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
+ }
+ if (this.target !== document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ scrollPercentage = this.target.scrollTop / (target.scrollHeight - height);
+ out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
+ if (this.target === document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ return out;
+ }
+ } else {
+ return getBounds(this.target);
+ }
+ };
+
+ _Tether.prototype.clearCache = function() {
+ return this._cache = {};
+ };
+
+ _Tether.prototype.cache = function(k, getter) {
+ if (this._cache == null) {
+ this._cache = {};
+ }
+ if (this._cache[k] == null) {
+ this._cache[k] = getter.call(this);
+ }
+ return this._cache[k];
+ };
+
+ _Tether.prototype.enable = function(position) {
+ if (position == null) {
+ position = true;
+ }
+ addClass(this.target, this.getClass('enabled'));
+ addClass(this.element, this.getClass('enabled'));
+ this.enabled = true;
+ if (this.scrollParent !== document) {
+ this.scrollParent.addEventListener('scroll', this.position);
+ }
+ if (position) {
+ return this.position();
+ }
+ };
+
+ _Tether.prototype.disable = function() {
+ removeClass(this.target, this.getClass('enabled'));
+ removeClass(this.element, this.getClass('enabled'));
+ this.enabled = false;
+ if (this.scrollParent != null) {
+ return this.scrollParent.removeEventListener('scroll', this.position);
+ }
+ };
+
+ _Tether.prototype.destroy = function() {
+ var i, tether, _i, _len, _results;
+ this.disable();
+ _results = [];
+ for (i = _i = 0, _len = tethers.length; _i < _len; i = ++_i) {
+ tether = tethers[i];
+ if (tether === this) {
+ tethers.splice(i, 1);
+ break;
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ _Tether.prototype.updateAttachClasses = function(elementAttach, targetAttach) {
+ var add, all, side, sides, _i, _j, _len, _len1, _ref1,
+ _this = this;
+ if (elementAttach == null) {
+ elementAttach = this.attachment;
+ }
+ if (targetAttach == null) {
+ targetAttach = this.targetAttachment;
+ }
+ sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
+ if ((_ref1 = this._addAttachClasses) != null ? _ref1.length : void 0) {
+ this._addAttachClasses.splice(0, this._addAttachClasses.length);
+ }
+ add = this._addAttachClasses != null ? this._addAttachClasses : this._addAttachClasses = [];
+ if (elementAttach.top) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.top);
+ }
+ if (elementAttach.left) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.left);
+ }
+ if (targetAttach.top) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.top);
+ }
+ if (targetAttach.left) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.left);
+ }
+ all = [];
+ for (_i = 0, _len = sides.length; _i < _len; _i++) {
+ side = sides[_i];
+ all.push("" + (this.getClass('element-attached')) + "-" + side);
+ }
+ for (_j = 0, _len1 = sides.length; _j < _len1; _j++) {
+ side = sides[_j];
+ all.push("" + (this.getClass('target-attached')) + "-" + side);
+ }
+ return defer(function() {
+ if (_this._addAttachClasses == null) {
+ return;
+ }
+ updateClasses(_this.element, _this._addAttachClasses, all);
+ updateClasses(_this.target, _this._addAttachClasses, all);
+ return _this._addAttachClasses = void 0;
+ });
+ };
+
+ _Tether.prototype.position = function(flushChanges) {
+ var elementPos, elementStyle, height, left, manualOffset, manualTargetOffset, module, next, offset, offsetBorder, offsetParent, offsetParentSize, offsetParentStyle, offsetPosition, ret, scrollLeft, scrollTop, scrollbarSize, side, targetAttachment, targetOffset, targetPos, targetSize, top, width, _i, _j, _len, _len1, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6,
+ _this = this;
+ if (flushChanges == null) {
+ flushChanges = true;
+ }
+ if (!this.enabled) {
+ return;
+ }
+ this.clearCache();
+ targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
+ this.updateAttachClasses(this.attachment, targetAttachment);
+ elementPos = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ });
+ width = elementPos.width, height = elementPos.height;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref1 = this.lastSize, width = _ref1.width, height = _ref1.height;
+ } else {
+ this.lastSize = {
+ width: width,
+ height: height
+ };
+ }
+ targetSize = targetPos = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ offset = offsetToPx(attachmentToOffset(this.attachment), {
+ width: width,
+ height: height
+ });
+ targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
+ manualOffset = offsetToPx(this.offset, {
+ width: width,
+ height: height
+ });
+ manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
+ offset = addOffset(offset, manualOffset);
+ targetOffset = addOffset(targetOffset, manualTargetOffset);
+ left = targetPos.left + targetOffset.left - offset.left;
+ top = targetPos.top + targetOffset.top - offset.top;
+ _ref2 = Tether.modules;
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ module = _ref2[_i];
+ ret = module.position.call(this, {
+ left: left,
+ top: top,
+ targetAttachment: targetAttachment,
+ targetPos: targetPos,
+ attachment: this.attachment,
+ elementPos: elementPos,
+ offset: offset,
+ targetOffset: targetOffset,
+ manualOffset: manualOffset,
+ manualTargetOffset: manualTargetOffset,
+ scrollbarSize: scrollbarSize
+ });
+ if ((ret == null) || typeof ret !== 'object') {
+ continue;
+ } else if (ret === false) {
+ return false;
+ } else {
+ top = ret.top, left = ret.left;
+ }
+ }
+ next = {
+ page: {
+ top: top,
+ left: left
+ },
+ viewport: {
+ top: top - pageYOffset,
+ bottom: pageYOffset - top - height + innerHeight,
+ left: left - pageXOffset,
+ right: pageXOffset - left - width + innerWidth
+ }
+ };
+ if (document.body.scrollWidth > window.innerWidth) {
+ scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
+ next.viewport.bottom -= scrollbarSize.height;
+ }
+ if (document.body.scrollHeight > window.innerHeight) {
+ scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
+ next.viewport.right -= scrollbarSize.width;
+ }
+ if (((_ref3 = document.body.style.position) !== '' && _ref3 !== 'static') || ((_ref4 = document.body.parentElement.style.position) !== '' && _ref4 !== 'static')) {
+ next.page.bottom = document.body.scrollHeight - top - height;
+ next.page.right = document.body.scrollWidth - left - width;
+ }
+ if (((_ref5 = this.options.optimizations) != null ? _ref5.moveElement : void 0) !== false && (this.targetModifier == null)) {
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ offsetPosition = this.cache('target-offsetparent-bounds', function() {
+ return getBounds(offsetParent);
+ });
+ offsetParentStyle = getComputedStyle(offsetParent);
+ elementStyle = getComputedStyle(this.element);
+ offsetParentSize = offsetPosition;
+ offsetBorder = {};
+ _ref6 = ['Top', 'Left', 'Bottom', 'Right'];
+ for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
+ side = _ref6[_j];
+ offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle["border" + side + "Width"]);
+ }
+ offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
+ offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
+ if (next.page.top >= (offsetPosition.top + offsetBorder.top) && next.page.bottom >= offsetPosition.bottom) {
+ if (next.page.left >= (offsetPosition.left + offsetBorder.left) && next.page.right >= offsetPosition.right) {
+ scrollTop = offsetParent.scrollTop;
+ scrollLeft = offsetParent.scrollLeft;
+ next.offset = {
+ top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
+ left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
+ };
+ }
+ }
+ }
+ this.move(next);
+ this.history.unshift(next);
+ if (this.history.length > 3) {
+ this.history.pop();
+ }
+ if (flushChanges) {
+ flush();
+ }
+ return true;
+ };
+
+ _Tether.prototype.move = function(position) {
+ var css, elVal, found, key, moved, offsetParent, point, same, transcribe, type, val, write, writeCSS, _i, _len, _ref1, _ref2,
+ _this = this;
+ if (this.element.parentNode == null) {
+ return;
+ }
+ same = {};
+ for (type in position) {
+ same[type] = {};
+ for (key in position[type]) {
+ found = false;
+ _ref1 = this.history;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ point = _ref1[_i];
+ if (!within((_ref2 = point[type]) != null ? _ref2[key] : void 0, position[type][key])) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ same[type][key] = true;
+ }
+ }
+ }
+ css = {
+ top: '',
+ left: '',
+ right: '',
+ bottom: ''
+ };
+ transcribe = function(same, pos) {
+ var xPos, yPos, _ref3;
+ if (((_ref3 = _this.options.optimizations) != null ? _ref3.gpu : void 0) !== false) {
+ if (same.top) {
+ css.top = 0;
+ yPos = pos.top;
+ } else {
+ css.bottom = 0;
+ yPos = -pos.bottom;
+ }
+ if (same.left) {
+ css.left = 0;
+ xPos = pos.left;
+ } else {
+ css.right = 0;
+ xPos = -pos.right;
+ }
+ css[transformKey] = "translateX(" + (Math.round(xPos)) + "px) translateY(" + (Math.round(yPos)) + "px)";
+ if (transformKey !== 'msTransform') {
+ return css[transformKey] += " translateZ(0)";
+ }
+ } else {
+ if (same.top) {
+ css.top = "" + pos.top + "px";
+ } else {
+ css.bottom = "" + pos.bottom + "px";
+ }
+ if (same.left) {
+ return css.left = "" + pos.left + "px";
+ } else {
+ return css.right = "" + pos.right + "px";
+ }
+ }
+ };
+ moved = false;
+ if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
+ css.position = 'absolute';
+ transcribe(same.page, position.page);
+ } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
+ css.position = 'fixed';
+ transcribe(same.viewport, position.viewport);
+ } else if ((same.offset != null) && same.offset.top && same.offset.left) {
+ css.position = 'absolute';
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ if (getOffsetParent(this.element) !== offsetParent) {
+ defer(function() {
+ _this.element.parentNode.removeChild(_this.element);
+ return offsetParent.appendChild(_this.element);
+ });
+ }
+ transcribe(same.offset, position.offset);
+ moved = true;
+ } else {
+ css.position = 'absolute';
+ transcribe({
+ top: true,
+ left: true
+ }, position.page);
+ }
+ if (!moved && this.element.parentNode.tagName !== 'BODY') {
+ this.element.parentNode.removeChild(this.element);
+ document.body.appendChild(this.element);
+ }
+ writeCSS = {};
+ write = false;
+ for (key in css) {
+ val = css[key];
+ elVal = this.element.style[key];
+ if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) {
+ elVal = parseFloat(elVal);
+ val = parseFloat(val);
+ }
+ if (elVal !== val) {
+ write = true;
+ writeCSS[key] = css[key];
+ }
+ }
+ if (write) {
+ return defer(function() {
+ return extend(_this.element.style, writeCSS);
+ });
+ }
+ };
+
+ return _Tether;
+
+ })();
+
+ Tether.position = position;
+
+ this.Tether = extend(_Tether, Tether);
+
+}).call(this);
+
+(function() {
+ var BOUNDS_FORMAT, MIRROR_ATTACH, defer, extend, getBoundingRect, getBounds, getOuterSize, getSize, updateClasses, _ref,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+
+ _ref = this.Tether.Utils, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getSize = _ref.getSize, extend = _ref.extend, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ MIRROR_ATTACH = {
+ left: 'right',
+ right: 'left',
+ top: 'bottom',
+ bottom: 'top',
+ middle: 'middle'
+ };
+
+ BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
+
+ getBoundingRect = function(tether, to) {
+ var i, pos, side, size, style, _i, _len;
+ if (to === 'scrollParent') {
+ to = tether.scrollParent;
+ } else if (to === 'window') {
+ to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
+ }
+ if (to === document) {
+ to = to.documentElement;
+ }
+ if (to.nodeType != null) {
+ pos = size = getBounds(to);
+ style = getComputedStyle(to);
+ to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
+ for (i = _i = 0, _len = BOUNDS_FORMAT.length; _i < _len; i = ++_i) {
+ side = BOUNDS_FORMAT[i];
+ side = side[0].toUpperCase() + side.substr(1);
+ if (side === 'Top' || side === 'Left') {
+ to[i] += parseFloat(style["border" + side + "Width"]);
+ } else {
+ to[i] -= parseFloat(style["border" + side + "Width"]);
+ }
+ }
+ }
+ return to;
+ };
+
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var addClasses, allClasses, attachment, bounds, changeAttachX, changeAttachY, cls, constraint, eAttachment, height, left, oob, oobClass, p, pin, pinned, pinnedClass, removeClass, side, tAttachment, targetAttachment, targetHeight, targetSize, targetWidth, to, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8,
+ _this = this;
+ top = _arg.top, left = _arg.left, targetAttachment = _arg.targetAttachment;
+ if (!this.options.constraints) {
+ return true;
+ }
+ removeClass = function(prefix) {
+ var side, _i, _len, _results;
+ _this.removeClass(prefix);
+ _results = [];
+ for (_i = 0, _len = BOUNDS_FORMAT.length; _i < _len; _i++) {
+ side = BOUNDS_FORMAT[_i];
+ _results.push(_this.removeClass("" + prefix + "-" + side));
+ }
+ return _results;
+ };
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref2 = this.lastSize, width = _ref2.width, height = _ref2.height;
+ }
+ targetSize = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ targetHeight = targetSize.height;
+ targetWidth = targetSize.width;
+ tAttachment = {};
+ eAttachment = {};
+ allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
+ _ref3 = this.options.constraints;
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ constraint = _ref3[_i];
+ if (constraint.outOfBoundsClass) {
+ allClasses.push(constraint.outOfBoundsClass);
+ }
+ if (constraint.pinnedClass) {
+ allClasses.push(constraint.pinnedClass);
+ }
+ }
+ for (_j = 0, _len1 = allClasses.length; _j < _len1; _j++) {
+ cls = allClasses[_j];
+ _ref4 = ['left', 'top', 'right', 'bottom'];
+ for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
+ side = _ref4[_k];
+ allClasses.push("" + cls + "-" + side);
+ }
+ }
+ addClasses = [];
+ tAttachment = extend({}, targetAttachment);
+ eAttachment = extend({}, this.attachment);
+ _ref5 = this.options.constraints;
+ for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) {
+ constraint = _ref5[_l];
+ to = constraint.to, attachment = constraint.attachment, pin = constraint.pin;
+ if (attachment == null) {
+ attachment = '';
+ }
+ if (__indexOf.call(attachment, ' ') >= 0) {
+ _ref6 = attachment.split(' '), changeAttachY = _ref6[0], changeAttachX = _ref6[1];
+ } else {
+ changeAttachX = changeAttachY = attachment;
+ }
+ bounds = getBoundingRect(this, to);
+ if (changeAttachY === 'target' || changeAttachY === 'both') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ }
+ }
+ if (changeAttachY === 'together') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ if (eAttachment.top === 'bottom') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top += height;
+ eAttachment.top = 'top';
+ } else if (eAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ if (eAttachment.top === 'top') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (eAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ if (tAttachment.top === 'middle') {
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ }
+ if (changeAttachX === 'target' || changeAttachX === 'both') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ }
+ if (left + width > bounds[2] && tAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ }
+ }
+ if (changeAttachX === 'together') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ if (eAttachment.left === 'right') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left += width;
+ eAttachment.left = 'left';
+ } else if (eAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ } else if (left + width > bounds[2] && tAttachment.left === 'right') {
+ if (eAttachment.left === 'left') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (eAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left += width;
+ eAttachment.left = 'left';
+ }
+ } else if (tAttachment.left === 'center') {
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ }
+ }
+ if (changeAttachY === 'element' || changeAttachY === 'both') {
+ if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (changeAttachX === 'element' || changeAttachX === 'both') {
+ if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ }
+ if (typeof pin === 'string') {
+ pin = (function() {
+ var _len4, _m, _ref7, _results;
+ _ref7 = pin.split(',');
+ _results = [];
+ for (_m = 0, _len4 = _ref7.length; _m < _len4; _m++) {
+ p = _ref7[_m];
+ _results.push(p.trim());
+ }
+ return _results;
+ })();
+ } else if (pin === true) {
+ pin = ['top', 'left', 'right', 'bottom'];
+ }
+ pin || (pin = []);
+ pinned = [];
+ oob = [];
+ if (top < bounds[1]) {
+ if (__indexOf.call(pin, 'top') >= 0) {
+ top = bounds[1];
+ pinned.push('top');
+ } else {
+ oob.push('top');
+ }
+ }
+ if (top + height > bounds[3]) {
+ if (__indexOf.call(pin, 'bottom') >= 0) {
+ top = bounds[3] - height;
+ pinned.push('bottom');
+ } else {
+ oob.push('bottom');
+ }
+ }
+ if (left < bounds[0]) {
+ if (__indexOf.call(pin, 'left') >= 0) {
+ left = bounds[0];
+ pinned.push('left');
+ } else {
+ oob.push('left');
+ }
+ }
+ if (left + width > bounds[2]) {
+ if (__indexOf.call(pin, 'right') >= 0) {
+ left = bounds[2] - width;
+ pinned.push('right');
+ } else {
+ oob.push('right');
+ }
+ }
+ if (pinned.length) {
+ pinnedClass = (_ref7 = this.options.pinnedClass) != null ? _ref7 : this.getClass('pinned');
+ addClasses.push(pinnedClass);
+ for (_m = 0, _len4 = pinned.length; _m < _len4; _m++) {
+ side = pinned[_m];
+ addClasses.push("" + pinnedClass + "-" + side);
+ }
+ }
+ if (oob.length) {
+ oobClass = (_ref8 = this.options.outOfBoundsClass) != null ? _ref8 : this.getClass('out-of-bounds');
+ addClasses.push(oobClass);
+ for (_n = 0, _len5 = oob.length; _n < _len5; _n++) {
+ side = oob[_n];
+ addClasses.push("" + oobClass + "-" + side);
+ }
+ }
+ if (__indexOf.call(pinned, 'left') >= 0 || __indexOf.call(pinned, 'right') >= 0) {
+ eAttachment.left = tAttachment.left = false;
+ }
+ if (__indexOf.call(pinned, 'top') >= 0 || __indexOf.call(pinned, 'bottom') >= 0) {
+ eAttachment.top = tAttachment.top = false;
+ }
+ if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== this.attachment.top || eAttachment.left !== this.attachment.left) {
+ this.updateAttachClasses(eAttachment, tAttachment);
+ }
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+(function() {
+ var defer, getBounds, updateClasses, _ref;
+
+ _ref = this.Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5,
+ _this = this;
+ top = _arg.top, left = _arg.left;
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ targetPos = this.getTargetBounds();
+ bottom = top + height;
+ right = left + width;
+ abutted = [];
+ if (top <= targetPos.bottom && bottom >= targetPos.top) {
+ _ref2 = ['left', 'right'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ side = _ref2[_i];
+ if ((_ref3 = targetPos[side]) === left || _ref3 === right) {
+ abutted.push(side);
+ }
+ }
+ }
+ if (left <= targetPos.right && right >= targetPos.left) {
+ _ref4 = ['top', 'bottom'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) {
+ abutted.push(side);
+ }
+ }
+ }
+ allClasses = [];
+ addClasses = [];
+ sides = ['left', 'top', 'right', 'bottom'];
+ allClasses.push(this.getClass('abutted'));
+ for (_k = 0, _len2 = sides.length; _k < _len2; _k++) {
+ side = sides[_k];
+ allClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ if (abutted.length) {
+ addClasses.push(this.getClass('abutted'));
+ }
+ for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) {
+ side = abutted[_l];
+ addClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return true;
+ }
+ });
+
+}).call(this);
+
+(function() {
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var left, result, shift, shiftLeft, shiftTop, top, _ref;
+ top = _arg.top, left = _arg.left;
+ if (!this.options.shift) {
+ return;
+ }
+ result = function(val) {
+ if (typeof val === 'function') {
+ return val.call(this, {
+ top: top,
+ left: left
+ });
+ } else {
+ return val;
+ }
+ };
+ shift = result(this.options.shift);
+ if (typeof shift === 'string') {
+ shift = shift.split(' ');
+ shift[1] || (shift[1] = shift[0]);
+ shiftTop = shift[0], shiftLeft = shift[1];
+ shiftTop = parseFloat(shiftTop, 10);
+ shiftLeft = parseFloat(shiftLeft, 10);
+ } else {
+ _ref = [shift.top, shift.left], shiftTop = _ref[0], shiftLeft = _ref[1];
+ }
+ top += shiftTop;
+ left += shiftLeft;
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+return this.Tether;
+
+}));
+
+(function() {
+ var ATTACHMENT, Evented, Shepherd, Step, Tour, addClass, createFromHTML, extend, getBounds, hasClass, matchesSelector, parseShorthand, removeClass, uniqueId, _ref,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ _ref = Tether.Utils, extend = _ref.extend, removeClass = _ref.removeClass, addClass = _ref.addClass, hasClass = _ref.hasClass, Evented = _ref.Evented, getBounds = _ref.getBounds, uniqueId = _ref.uniqueId;
+
+ ATTACHMENT = {
+ 'top': 'top center',
+ 'left': 'middle right',
+ 'right': 'middle left',
+ 'bottom': 'bottom center'
+ };
+
+ createFromHTML = function(html) {
+ var el;
+ el = document.createElement('div');
+ el.innerHTML = html;
+ return el.children[0];
+ };
+
+ matchesSelector = function(el, sel) {
+ var matches, _ref1, _ref2, _ref3, _ref4;
+ matches = (_ref1 = (_ref2 = (_ref3 = (_ref4 = el.matches) != null ? _ref4 : el.matchesSelector) != null ? _ref3 : el.webkitMatchesSelector) != null ? _ref2 : el.mozMatchesSelector) != null ? _ref1 : el.oMatchesSelector;
+ return matches.call(el, sel);
+ };
+
+ parseShorthand = function(obj, props) {
+ var i, out, prop, vals, _i, _len;
+ if (obj == null) {
+ return obj;
+ } else if (typeof obj === 'object') {
+ return obj;
+ } else {
+ vals = obj.split(' ');
+ if (vals.length > props.length) {
+ vals[0] = vals.slice(0, +(vals.length - props.length) + 1 || 9e9).join(' ');
+ vals.splice(1, vals.length - props.length);
+ }
+ out = {};
+ for (i = _i = 0, _len = props.length; _i < _len; i = ++_i) {
+ prop = props[i];
+ out[prop] = vals[i];
+ }
+ return out;
+ }
+ };
+
+ Step = (function(_super) {
+ __extends(Step, _super);
+
+ function Step(tour, options) {
+ this.tour = tour;
+ this.destroy = __bind(this.destroy, this);
+ this.scrollTo = __bind(this.scrollTo, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.isOpen = __bind(this.isOpen, this);
+ this.hide = __bind(this.hide, this);
+ this.show = __bind(this.show, this);
+ this.setOptions(options);
+ this;
+ }
+
+ Step.prototype.setOptions = function(options) {
+ var event, handler, _base, _ref1;
+ this.options = options != null ? options : {};
+ this.destroy();
+ this.id = this.options.id || this.id || ("step-" + (uniqueId()));
+ if (this.options.when) {
+ _ref1 = this.options.when;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ this.on(event, handler, this);
+ }
+ }
+ return (_base = this.options).buttons != null ? (_base = this.options).buttons : _base.buttons = [
+ {
+ text: 'Next',
+ action: this.tour.next
+ }
+ ];
+ };
+
+ Step.prototype.getTour = function() {
+ return this.tour;
+ };
+
+ Step.prototype.bindAdvance = function() {
+ var event, handler, selector, _ref1,
+ _this = this;
+ _ref1 = parseShorthand(this.options.advanceOn, ['selector', 'event']), event = _ref1.event, selector = _ref1.selector;
+ handler = function(e) {
+ if (!_this.isOpen()) {
+ return;
+ }
+ if (selector != null) {
+ if (matchesSelector(e.target, selector)) {
+ return _this.tour.next();
+ }
+ } else {
+ if (_this.el && e.target === _this.el) {
+ return _this.tour.next();
+ }
+ }
+ };
+ document.body.addEventListener(event, handler);
+ return this.on('destroy', function() {
+ return document.body.removeEventListener(event, handler);
+ });
+ };
+
+ Step.prototype.getAttachTo = function() {
+ var opts;
+ opts = parseShorthand(this.options.attachTo, ['element', 'on']);
+ if (opts == null) {
+ opts = {};
+ }
+ if (typeof opts.element === 'string') {
+ opts.element = document.querySelector(opts.element);
+ if (opts.element == null) {
+ throw new Error("Shepherd step's attachTo was not found in the page");
+ }
+ }
+ return opts;
+ };
+
+ Step.prototype.setupTether = function() {
+ var attachment, opts, tetherOpts;
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("Using the attachment feature of Shepherd requires the Tether library");
+ }
+ opts = this.getAttachTo();
+ attachment = ATTACHMENT[opts.on || 'right'];
+ if (opts.element == null) {
+ opts.element = 'viewport';
+ attachment = 'middle center';
+ }
+ tetherOpts = {
+ classPrefix: 'shepherd',
+ element: this.el,
+ constraints: [
+ {
+ to: 'window',
+ pin: true,
+ attachment: 'together'
+ }
+ ],
+ target: opts.element,
+ offset: opts.offset || '0 0',
+ attachment: attachment
+ };
+ return this.tether = new Tether(extend(tetherOpts, this.options.tetherOptions));
+ };
+
+ Step.prototype.show = function() {
+ var _ref1,
+ _this = this;
+ if (this.el == null) {
+ this.render();
+ }
+ addClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.enable();
+ }
+ if (this.options.scrollTo) {
+ setTimeout(function() {
+ return _this.scrollTo();
+ });
+ }
+ return this.trigger('show');
+ };
+
+ Step.prototype.hide = function() {
+ var _ref1;
+ removeClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.disable();
+ }
+ return this.trigger('hide');
+ };
+
+ Step.prototype.isOpen = function() {
+ return hasClass(this.el, 'shepherd-open');
+ };
+
+ Step.prototype.cancel = function() {
+ this.hide();
+ return this.trigger('cancel');
+ };
+
+ Step.prototype.complete = function() {
+ this.hide();
+ return this.trigger('complete');
+ };
+
+ Step.prototype.scrollTo = function() {
+ var element;
+ element = this.getAttachTo().element;
+ return element != null ? element.scrollIntoView() : void 0;
+ };
+
+ Step.prototype.destroy = function() {
+ var _ref1;
+ if (this.el != null) {
+ document.body.removeChild(this.el);
+ delete this.el;
+ }
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ return this.trigger('destroy');
+ };
+
+ Step.prototype.render = function() {
+ var button, buttons, cfg, content, footer, header, paragraph, paragraphs, text, _i, _j, _len, _len1, _ref1, _ref2, _ref3;
+ if (this.el != null) {
+ this.destroy();
+ }
+ this.el = createFromHTML("");
+ content = document.createElement('div');
+ content.className = 'shepherd-content';
+ this.el.appendChild(content);
+ if (this.options.title != null) {
+ header = document.createElement('header');
+ header.innerHTML = "" + this.options.title + "
";
+ this.el.className += ' shepherd-has-title';
+ content.appendChild(header);
+ }
+ if (this.options.text != null) {
+ text = createFromHTML("");
+ paragraphs = this.options.text;
+ if (typeof paragraphs === 'string') {
+ paragraphs = [paragraphs];
+ }
+ for (_i = 0, _len = paragraphs.length; _i < _len; _i++) {
+ paragraph = paragraphs[_i];
+ text.innerHTML += "" + paragraph + "
";
+ }
+ content.appendChild(text);
+ }
+ footer = document.createElement('footer');
+ if (this.options.buttons) {
+ buttons = createFromHTML("");
+ _ref2 = this.options.buttons;
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
+ cfg = _ref2[_j];
+ button = createFromHTML("" + cfg.text + "");
+ buttons.appendChild(button);
+ this.bindButtonEvents(cfg, button.querySelector('a'));
+ }
+ footer.appendChild(buttons);
+ }
+ content.appendChild(footer);
+ document.body.appendChild(this.el);
+ this.setupTether();
+ if (this.options.advanceOn) {
+ return this.bindAdvance();
+ }
+ };
+
+ Step.prototype.bindButtonEvents = function(cfg, el) {
+ var event, handler, page, _ref1,
+ _this = this;
+ if (cfg.events == null) {
+ cfg.events = {};
+ }
+ if (cfg.action != null) {
+ cfg.events.click = cfg.action;
+ }
+ _ref1 = cfg.events;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ if (typeof handler === 'string') {
+ page = handler;
+ handler = function() {
+ return _this.tour.show(page);
+ };
+ }
+ el.addEventListener(event, handler);
+ }
+ return this.on('destroy', function() {
+ var _ref2, _results;
+ _ref2 = cfg.events;
+ _results = [];
+ for (event in _ref2) {
+ handler = _ref2[event];
+ _results.push(el.removeEventListener(event, handler));
+ }
+ return _results;
+ });
+ };
+
+ return Step;
+
+ })(Evented);
+
+ Tour = (function(_super) {
+ __extends(Tour, _super);
+
+ function Tour(options) {
+ var event, _i, _len, _ref1, _ref2,
+ _this = this;
+ this.options = options != null ? options : {};
+ this.hide = __bind(this.hide, this);
+ this.cancel = __bind(this.cancel, this);
+ this.back = __bind(this.back, this);
+ this.next = __bind(this.next, this);
+ this.steps = (_ref1 = this.options.steps) != null ? _ref1 : [];
+ _ref2 = ['complete', 'cancel', 'hide', 'start', 'show'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ event = _ref2[_i];
+ this.on(event, function(opts) {
+ if (opts == null) {
+ opts = {};
+ }
+ opts.tour = _this;
+ return Shepherd.trigger(event, opts);
+ });
+ }
+ this;
+ }
+
+ Tour.prototype.addStep = function(name, step) {
+ var _ref1;
+ if (step == null) {
+ step = name;
+ }
+ if (!(step instanceof Step)) {
+ if ((_ref1 = typeof name) === 'string' || _ref1 === 'number') {
+ step.id = name.toString();
+ }
+ step = extend({}, this.options.defaults, step);
+ step = new Step(this, step);
+ } else {
+ step.tour = this;
+ }
+ this.steps.push(step);
+ return step;
+ };
+
+ Tour.prototype.getById = function(id) {
+ var step, _i, _len, _ref1;
+ _ref1 = this.steps;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ step = _ref1[_i];
+ if (step.id === id) {
+ return step;
+ }
+ }
+ };
+
+ Tour.prototype.getCurrentStep = function() {
+ return this.currentStep;
+ };
+
+ Tour.prototype.next = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ if (index === this.steps.length - 1) {
+ this.hide(index);
+ this.trigger('complete');
+ return this.done();
+ } else {
+ return this.show(index + 1);
+ }
+ };
+
+ Tour.prototype.back = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ return this.show(index - 1);
+ };
+
+ Tour.prototype.cancel = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.cancel();
+ }
+ this.trigger('cancel');
+ return this.done();
+ };
+
+ Tour.prototype.hide = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('hide');
+ return this.done();
+ };
+
+ Tour.prototype.done = function() {
+ return Shepherd.activeTour = null;
+ };
+
+ Tour.prototype.show = function(key) {
+ var next;
+ if (key == null) {
+ key = 0;
+ }
+ if (this.currentStep) {
+ this.currentStep.hide();
+ }
+ Shepherd.activeTour = this;
+ if (typeof key === 'string') {
+ next = this.getById(key);
+ } else {
+ next = this.steps[key];
+ }
+ if (next) {
+ this.trigger('show', {
+ step: next,
+ previous: this.currentStep
+ });
+ this.currentStep = next;
+ return next.show();
+ }
+ };
+
+ Tour.prototype.start = function() {
+ this.trigger('start');
+ this.currentStep = null;
+ return this.next();
+ };
+
+ return Tour;
+
+ })(Evented);
+
+ Shepherd = new Evented;
+
+ extend(Shepherd, {
+ Tour: Tour,
+ Step: Step,
+ Evented: Evented
+ });
+
+ window.Shepherd = Shepherd;
+
+}).call(this);
diff --git a/ajax/libs/shepherd/0.4.5/shepherd.min.js b/ajax/libs/shepherd/0.4.5/shepherd.min.js
new file mode 100644
index 000000000..0044675c7
--- /dev/null
+++ b/ajax/libs/shepherd/0.4.5/shepherd.min.js
@@ -0,0 +1,2 @@
+/*! shepherd 0.4.5 */
+!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e(require,exports,module):t.Tether=e()}(this,function(){return function(){var t,e,o,i,n,s,r,h,l,a,p,u,f,d,c,g,m,b={}.hasOwnProperty,v=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1},y=[].slice;null==this.Tether&&(this.Tether={modules:[]}),p=function(t){var e,o,i,n,s;if(o=getComputedStyle(t).position,"fixed"===o)return t;for(i=void 0,e=t;e=e.parentNode;){try{n=getComputedStyle(e)}catch(r){}if(null==n)return e;if(/(auto|scroll)/.test(n.overflow+n["overflow-y"]+n["overflow-x"])&&("absolute"!==o||"relative"===(s=n.position)||"absolute"===s||"fixed"===s))return e}return document.body},c=function(){var t;return t=0,function(){return t++}}(),m={},l=function(t){var e,i,s,r,h;if(s=t._tetherZeroElement,null==s&&(s=t.createElement("div"),s.setAttribute("data-tether-id",c()),n(s.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(s),t._tetherZeroElement=s),e=s.getAttribute("data-tether-id"),null==m[e]){m[e]={},h=s.getBoundingClientRect();for(i in h)r=h[i],m[e][i]=r;o(function(){return m[e]=void 0})}return m[e]},f=null,r=function(t){var e,o,i,n,s,r,h;t===document?(o=document,t=document.documentElement):o=t.ownerDocument,i=o.documentElement,e={},h=t.getBoundingClientRect();for(n in h)r=h[n],e[n]=r;return s=l(o),e.top-=s.top,e.left-=s.left,null==e.width&&(e.width=document.body.scrollWidth-e.left-e.right),null==e.height&&(e.height=document.body.scrollHeight-e.top-e.bottom),e.top=e.top-i.clientTop,e.left=e.left-i.clientLeft,e.right=o.body.clientWidth-e.width-e.left,e.bottom=o.body.clientHeight-e.height-e.top,e},h=function(t){return t.offsetParent||document.documentElement},a=function(){var t,e,o,i,s;return t=document.createElement("div"),t.style.width="100%",t.style.height="200px",e=document.createElement("div"),n(e.style,{position:"absolute",top:0,left:0,pointerEvents:"none",visibility:"hidden",width:"200px",height:"150px",overflow:"hidden"}),e.appendChild(t),document.body.appendChild(e),i=t.offsetWidth,e.style.overflow="scroll",s=t.offsetWidth,i===s&&(s=e.clientWidth),document.body.removeChild(e),o=i-s,{width:o,height:o}},n=function(t){var e,o,i,n,s,r,h;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),h=e.slice(1),s=0,r=h.length;r>s;s++)if(i=h[s])for(o in i)b.call(i,o)&&(n=i[o],t[o]=n);return t},d=function(t,e){var o,i,n,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],i=0,n=s.length;n>i;i++)o=s[i],o.trim()&&r.push(t.classList.remove(o));return r}return t.className=t.className.replace(new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi")," ")},e=function(t,e){var o,i,n,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],i=0,n=s.length;n>i;i++)o=s[i],o.trim()&&r.push(t.classList.add(o));return r}return d(t,e),t.className+=" "+e},u=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},g=function(t,o,i){var n,s,r,h,l,a;for(s=0,h=i.length;h>s;s++)n=i[s],v.call(o,n)<0&&u(t,n)&&d(t,n);for(a=[],r=0,l=o.length;l>r;r++)n=o[r],a.push(u(t,n)?void 0:e(t,n));return a},i=[],o=function(t){return i.push(t)},s=function(){var t,e;for(e=[];t=i.pop();)e.push(t());return e},t=function(){function t(){}return t.prototype.on=function(t,e,o,i){var n;return null==i&&(i=!1),null==this.bindings&&(this.bindings={}),null==(n=this.bindings)[t]&&(n[t]=[]),this.bindings[t].push({handler:e,ctx:o,once:i})},t.prototype.once=function(t,e,o){return this.on(t,e,o,!0)},t.prototype.off=function(t,e){var o,i,n;if(null!=(null!=(i=this.bindings)?i[t]:void 0)){if(null==e)return delete this.bindings[t];for(o=0,n=[];o=e&&e>=t-o},x=function(){var t,e,o,i,n;for(t=document.createElement("div"),n=["transform","webkitTransform","OTransform","MozTransform","msTransform"],o=0,i=n.length;i>o;o++)if(e=n[o],void 0!==t.style[e])return e}(),O=[],C=function(){var t,e,o;for(e=0,o=O.length;o>e;e++)t=O[e],t.position(!1);return p()},b=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance.now():void 0)?t:+new Date},function(){var t,e,o,i,n,s,r,h,l;for(e=null,o=null,i=null,n=function(){if(null!=o&&o>16)return o=Math.min(o-16,250),void(i=setTimeout(n,250));if(!(null!=e&&b()-e<10))return null!=i&&(clearTimeout(i),i=null),e=b(),C(),o=b()-e},h=["resize","scroll","touchmove"],l=[],s=0,r=h.length;r>s;s++)t=h[s],l.push(window.addEventListener(t,n));return l}(),t={center:"center",left:"right",right:"left"},e={middle:"middle",top:"bottom",bottom:"top"},o={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},h=function(o,i){var n,s;return n=o.left,s=o.top,"auto"===n&&(n=t[i.left]),"auto"===s&&(s=e[i.top]),{left:n,top:s}},r=function(t){var e,i;return{left:null!=(e=o[t.left])?e:t.left,top:null!=(i=o[t.top])?i:t.top}},s=function(){var t,e,o,i,n,s,r;for(e=1<=arguments.length?B.call(arguments,0):[],o={top:0,left:0},n=0,s=e.length;s>n;n++)r=e[n],i=r.top,t=r.left,"string"==typeof i&&(i=parseFloat(i,10)),"string"==typeof t&&(t=parseFloat(t,10)),o.top+=i,o.left+=t;return o},v=function(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t},y=w=function(t){var e,o,i;return i=t.split(" "),o=i[0],e=i[1],{top:o,left:e}},A=function(){function t(t){this.position=W(this.position,this);var e,o,n,s,r;for(O.push(this),this.history=[],this.setOptions(t,!1),s=i.modules,o=0,n=s.length;n>o;o++)e=s[o],null!=(r=e.initialize)&&r.call(this);this.position()}return t.modules=[],t.prototype.getClass=function(t){var e,o;return(null!=(e=this.options.classes)?e[t]:void 0)?this.options.classes[t]:(null!=(o=this.options.classes)?o[t]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+t:t:""},t.prototype.setOptions=function(t,e){var o,i,s,r,h,l;for(this.options=t,null==e&&(e=!0),o={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=a(o,this.options),h=this.options,this.element=h.element,this.target=h.target,this.targetModifier=h.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),l=["element","target"],s=0,r=l.length;r>s;s++){if(i=l[s],null==this[i])throw new Error("Tether Error: Both element and target must be defined");null!=this[i].jquery?this[i]=this[i][0]:"string"==typeof this[i]&&(this[i]=document.querySelector(this[i]))}if(n(this.element,this.getClass("element")),n(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=y(this.options.targetAttachment),this.attachment=y(this.options.attachment),this.offset=w(this.options.offset),this.targetOffset=w(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent="scroll-handle"===this.targetModifier?this.target:g(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,o,i,n,s,r,h,l;if(null==this.targetModifier)return u(this.target);switch(this.targetModifier){case"visible":return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:(t=u(this.target),n={height:t.height,width:t.width,top:t.top,left:t.left},n.height=Math.min(n.height,t.height-(pageYOffset-t.top)),n.height=Math.min(n.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),n.height=Math.min(innerHeight,n.height),n.height-=2,n.width=Math.min(n.width,t.width-(pageXOffset-t.left)),n.width=Math.min(n.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),n.width=Math.min(innerWidth,n.width),n.width-=2,n.topl.clientWidth||"scroll"===[h.overflow,h.overflowX]||this.target!==document.body,s=0,o&&(s=15),i=t.height-parseFloat(h.borderTopWidth)-parseFloat(h.borderBottomWidth)-s,n={width:15,height:.975*i*(i/l.scrollHeight),left:t.left+t.width-parseFloat(h.borderLeftWidth)-15},e=0,408>i&&this.target===document.body&&(e=-11e-5*Math.pow(i,2)-.00727*i+22.58),this.target!==document.body&&(n.height=Math.max(n.height,24)),r=this.target.scrollTop/(l.scrollHeight-i),n.top=r*(i-n.height-e)+t.top+parseFloat(h.borderTopWidth),this.target===document.body&&(n.height=Math.max(n.height,24)),n}},t.prototype.clearCache=function(){return this._cache={}},t.prototype.cache=function(t,e){return null==this._cache&&(this._cache={}),null==this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},t.prototype.enable=function(t){return null==t&&(t=!0),n(this.target,this.getClass("enabled")),n(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t?this.position():void 0},t.prototype.disable=function(){return T(this.target,this.getClass("enabled")),T(this.element,this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},t.prototype.destroy=function(){var t,e,o,i,n;for(this.disable(),n=[],t=o=0,i=O.length;i>o;t=++o){if(e=O[t],e===this){O.splice(t,1);break}n.push(void 0)}return n},t.prototype.updateAttachClasses=function(t,e){var o,i,n,s,r,h,a,p,u,f=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),s=["left","top","bottom","right","middle","center"],(null!=(u=this._addAttachClasses)?u.length:void 0)&&this._addAttachClasses.splice(0,this._addAttachClasses.length),o=null!=this._addAttachClasses?this._addAttachClasses:this._addAttachClasses=[],t.top&&o.push(""+this.getClass("element-attached")+"-"+t.top),t.left&&o.push(""+this.getClass("element-attached")+"-"+t.left),e.top&&o.push(""+this.getClass("target-attached")+"-"+e.top),e.left&&o.push(""+this.getClass("target-attached")+"-"+e.left),i=[],r=0,a=s.length;a>r;r++)n=s[r],i.push(""+this.getClass("element-attached")+"-"+n);for(h=0,p=s.length;p>h;h++)n=s[h],i.push(""+this.getClass("target-attached")+"-"+n);return l(function(){return null!=f._addAttachClasses?(S(f.element,f._addAttachClasses,i),S(f.target,f._addAttachClasses,i),f._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,o,n,l,a,d,g,m,b,y,w,C,T,O,x,S,E,A,M,B,W,L,_,P,z,H,F,Y,N,X,j,k,q,U,I,R=this;if(null==t&&(t=!0),this.enabled){for(this.clearCache(),B=h(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,B),e=this.cache("element-bounds",function(){return u(R.element)}),z=e.width,n=e.height,0===z&&0===n&&null!=this.lastSize?(X=this.lastSize,z=X.width,n=X.height):this.lastSize={width:z,height:n},_=L=this.cache("target-bounds",function(){return R.getTargetBounds()}),b=v(r(this.attachment),{width:z,height:n}),W=v(r(B),_),a=v(this.offset,{width:z,height:n}),d=v(this.targetOffset,_),b=s(b,a),W=s(W,d),l=L.left+W.left-b.left,P=L.top+W.top-b.top,j=i.modules,H=0,Y=j.length;Y>H;H++)if(g=j[H],x=g.position.call(this,{left:l,top:P,targetAttachment:B,targetPos:L,attachment:this.attachment,elementPos:e,offset:b,targetOffset:W,manualOffset:a,manualTargetOffset:d,scrollbarSize:A}),null!=x&&"object"==typeof x){if(x===!1)return!1;P=x.top,l=x.left}if(m={page:{top:P,left:l},viewport:{top:P-pageYOffset,bottom:pageYOffset-P-n+innerHeight,left:l-pageXOffset,right:pageXOffset-l-z+innerWidth}},document.body.scrollWidth>window.innerWidth&&(A=this.cache("scrollbar-size",c),m.viewport.bottom-=A.height),document.body.scrollHeight>window.innerHeight&&(A=this.cache("scrollbar-size",c),m.viewport.right-=A.width),(""!==(k=document.body.style.position)&&"static"!==k||""!==(q=document.body.parentElement.style.position)&&"static"!==q)&&(m.page.bottom=document.body.scrollHeight-P-n,m.page.right=document.body.scrollWidth-l-z),(null!=(U=this.options.optimizations)?U.moveElement:void 0)!==!1&&null==this.targetModifier){for(w=this.cache("target-offsetparent",function(){return f(R.target)}),O=this.cache("target-offsetparent-bounds",function(){return u(w)}),T=getComputedStyle(w),o=getComputedStyle(this.element),C=O,y={},I=["Top","Left","Bottom","Right"],F=0,N=I.length;N>F;F++)M=I[F],y[M.toLowerCase()]=parseFloat(T["border"+M+"Width"]);O.right=document.body.scrollWidth-O.left-C.width+y.right,O.bottom=document.body.scrollHeight-O.top-C.height+y.bottom,m.page.top>=O.top+y.top&&m.page.bottom>=O.bottom&&m.page.left>=O.left+y.left&&m.page.right>=O.right&&(E=w.scrollTop,S=w.scrollLeft,m.offset={top:m.page.top-O.top+E-y.top,left:m.page.left-O.left+S-y.left})}return this.move(m),this.history.unshift(m),this.history.length>3&&this.history.pop(),t&&p(),!0}},t.prototype.move=function(t){var e,o,i,n,s,r,h,p,u,d,c,g,m,b,v,y,w,C=this;if(null!=this.element.parentNode){p={};for(d in t){p[d]={};for(n in t[d]){for(i=!1,y=this.history,b=0,v=y.length;v>b;b++)if(h=y[b],!E(null!=(w=h[d])?w[n]:void 0,t[d][n])){i=!0;break}i||(p[d][n]=!0)}}e={top:"",left:"",right:"",bottom:""},u=function(t,o){var i,n,s;return(null!=(s=C.options.optimizations)?s.gpu:void 0)===!1?(t.top?e.top=""+o.top+"px":e.bottom=""+o.bottom+"px",t.left?e.left=""+o.left+"px":e.right=""+o.right+"px"):(t.top?(e.top=0,n=o.top):(e.bottom=0,n=-o.bottom),t.left?(e.left=0,i=o.left):(e.right=0,i=-o.right),e[x]="translateX("+Math.round(i)+"px) translateY("+Math.round(n)+"px)","msTransform"!==x?e[x]+=" translateZ(0)":void 0)},s=!1,(p.page.top||p.page.bottom)&&(p.page.left||p.page.right)?(e.position="absolute",u(p.page,t.page)):(p.viewport.top||p.viewport.bottom)&&(p.viewport.left||p.viewport.right)?(e.position="fixed",u(p.viewport,t.viewport)):null!=p.offset&&p.offset.top&&p.offset.left?(e.position="absolute",r=this.cache("target-offsetparent",function(){return f(C.target)}),f(this.element)!==r&&l(function(){return C.element.parentNode.removeChild(C.element),r.appendChild(C.element)}),u(p.offset,t.offset),s=!0):(e.position="absolute",u({top:!0,left:!0},t.page)),s||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),m={},g=!1;for(n in e)c=e[n],o=this.element.style[n],""===o||""===c||"top"!==n&&"left"!==n&&"bottom"!==n&&"right"!==n||(o=parseFloat(o),c=parseFloat(c)),o!==c&&(g=!0,m[n]=e[n]);return g?l(function(){return a(C.element.style,m)}):void 0}},t}(),i.position=C,this.Tether=a(A,i)}.call(this),function(){var t,e,o,i,n,s,r,h,l,a,p=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1};a=this.Tether.Utils,r=a.getOuterSize,s=a.getBounds,h=a.getSize,i=a.extend,l=a.updateClasses,o=a.defer,e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},t=["left","top","right","bottom"],n=function(e,o){var i,n,r,h,l,a,p;if("scrollParent"===o?o=e.scrollParent:"window"===o&&(o=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),o===document&&(o=o.documentElement),null!=o.nodeType)for(n=h=s(o),l=getComputedStyle(o),o=[n.left,n.top,h.width+n.left,h.height+n.top],i=a=0,p=t.length;p>a;i=++a)r=t[i],r=r[0].toUpperCase()+r.substr(1),"Top"===r||"Left"===r?o[i]+=parseFloat(l["border"+r+"Width"]):o[i]-=parseFloat(l["border"+r+"Width"]);return o},this.Tether.modules.push({position:function(e){var r,h,a,u,f,d,c,g,m,b,v,y,w,C,T,O,x,S,E,A,M,B,W,L,_,P,z,H,F,Y,N,X,j,k,q,U,I,R,D,Z,$,V,G,J,K,Q,te,ee=this;if(P=e.top,v=e.left,M=e.targetAttachment,!this.options.constraints)return!0;for(S=function(e){var o,i,n,s;for(ee.removeClass(e),s=[],i=0,n=t.length;n>i;i++)o=t[i],s.push(ee.removeClass(""+e+"-"+o));return s},Z=this.cache("element-bounds",function(){return s(ee.element)}),b=Z.height,z=Z.width,0===z&&0===b&&null!=this.lastSize&&($=this.lastSize,z=$.width,b=$.height),W=this.cache("target-bounds",function(){return ee.getTargetBounds()}),B=W.height,L=W.width,A={},m={},h=[this.getClass("pinned"),this.getClass("out-of-bounds")],V=this.options.constraints,H=0,X=V.length;X>H;H++)g=V[H],g.outOfBoundsClass&&h.push(g.outOfBoundsClass),g.pinnedClass&&h.push(g.pinnedClass);for(F=0,j=h.length;j>F;F++)for(c=h[F],G=["left","top","right","bottom"],Y=0,k=G.length;k>Y;Y++)E=G[Y],h.push(""+c+"-"+E);for(r=[],A=i({},M),m=i({},this.attachment),J=this.options.constraints,N=0,q=J.length;q>N;N++){if(g=J[N],_=g.to,a=g.attachment,T=g.pin,null==a&&(a=""),p.call(a," ")>=0?(K=a.split(" "),d=K[0],f=K[1]):f=d=a,u=n(this,_),("target"===d||"both"===d)&&(Pu[3]&&"bottom"===A.top&&(P-=B,A.top="top")),"together"===d&&(Pu[3]&&"bottom"===A.top&&("top"===m.top?(P-=B,A.top="top",P-=b,m.top="bottom"):"bottom"===m.top&&(P-=B,A.top="top",P+=b,m.top="top")),"middle"===A.top&&(P+b>u[3]&&"top"===m.top?(P-=b,m.top="bottom"):Pu[2]&&"right"===A.left&&(v-=L,A.left="left")),"together"===f&&(vu[2]&&"right"===A.left?"left"===m.left?(v-=L,A.left="left",v-=z,m.left="right"):"right"===m.left&&(v-=L,A.left="left",v+=z,m.left="left"):"center"===A.left&&(v+z>u[2]&&"left"===m.left?(v-=z,m.left="right"):vu[3]&&"top"===m.top&&(P-=b,m.top="bottom")),("element"===f||"both"===f)&&(vu[2]&&"left"===m.left&&(v-=z,m.left="right")),"string"==typeof T?T=function(){var t,e,o,i;for(o=T.split(","),i=[],e=0,t=o.length;t>e;e++)C=o[e],i.push(C.trim());return i}():T===!0&&(T=["top","left","right","bottom"]),T||(T=[]),O=[],y=[],P=0?(P=u[1],O.push("top")):y.push("top")),P+b>u[3]&&(p.call(T,"bottom")>=0?(P=u[3]-b,O.push("bottom")):y.push("bottom")),v=0?(v=u[0],O.push("left")):y.push("left")),v+z>u[2]&&(p.call(T,"right")>=0?(v=u[2]-z,O.push("right")):y.push("right")),O.length)for(x=null!=(Q=this.options.pinnedClass)?Q:this.getClass("pinned"),r.push(x),R=0,U=O.length;U>R;R++)E=O[R],r.push(""+x+"-"+E);if(y.length)for(w=null!=(te=this.options.outOfBoundsClass)?te:this.getClass("out-of-bounds"),r.push(w),D=0,I=y.length;I>D;D++)E=y[D],r.push(""+w+"-"+E);(p.call(O,"left")>=0||p.call(O,"right")>=0)&&(m.left=A.left=!1),(p.call(O,"top")>=0||p.call(O,"bottom")>=0)&&(m.top=A.top=!1),(A.top!==M.top||A.left!==M.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,A)}return o(function(){return l(ee.target,r,h),l(ee.element,r,h)}),{top:P,left:v}}})}.call(this),function(){var t,e,o,i;i=this.Tether.Utils,e=i.getBounds,o=i.updateClasses,t=i.defer,this.Tether.modules.push({position:function(i){var n,s,r,h,l,a,p,u,f,d,c,g,m,b,v,y,w,C,T,O,x,S,E,A,M,B=this;if(c=i.top,a=i.left,x=this.cache("element-bounds",function(){return e(B.element)}),l=x.height,g=x.width,d=this.getTargetBounds(),h=c+l,p=a+g,n=[],c<=d.bottom&&h>=d.top)for(S=["left","right"],m=0,w=S.length;w>m;m++)u=S[m],((E=d[u])===a||E===p)&&n.push(u);if(a<=d.right&&p>=d.left)for(A=["top","bottom"],b=0,C=A.length;C>b;b++)u=A[b],((M=d[u])===c||M===h)&&n.push(u);for(r=[],s=[],f=["left","top","right","bottom"],r.push(this.getClass("abutted")),v=0,T=f.length;T>v;v++)u=f[v],r.push(""+this.getClass("abutted")+"-"+u);for(n.length&&s.push(this.getClass("abutted")),y=0,O=n.length;O>y;y++)u=n[y],s.push(""+this.getClass("abutted")+"-"+u);return t(function(){return o(B.target,s,r),o(B.element,s,r)}),!0}})}.call(this),function(){this.Tether.modules.push({position:function(t){var e,o,i,n,s,r,h;return r=t.top,e=t.left,this.options.shift?(o=function(t){return"function"==typeof t?t.call(this,{top:r,left:e}):t},i=o(this.options.shift),"string"==typeof i?(i=i.split(" "),i[1]||(i[1]=i[0]),s=i[0],n=i[1],s=parseFloat(s,10),n=parseFloat(n,10)):(h=[i.top,i.left],s=h[0],n=h[1]),r+=s,e+=n,{top:r,left:e}):void 0}})}.call(this),this.Tether}),function(){var t,e,o,i,n,s,r,h,l,a,p,u,f,d,c,g=function(t,e){return function(){return t.apply(e,arguments)}},m={}.hasOwnProperty,b=function(t,e){function o(){this.constructor=t}for(var i in e)m.call(e,i)&&(t[i]=e[i]);return o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype,t};c=Tether.Utils,h=c.extend,f=c.removeClass,s=c.addClass,a=c.hasClass,e=c.Evented,l=c.getBounds,d=c.uniqueId,t={top:"top center",left:"middle right",right:"middle left",bottom:"bottom center"},r=function(t){var e;return e=document.createElement("div"),e.innerHTML=t,e.children[0]},p=function(t,e){var o,i,n,s,r;return o=null!=(i=null!=(n=null!=(s=null!=(r=t.matches)?r:t.matchesSelector)?s:t.webkitMatchesSelector)?n:t.mozMatchesSelector)?i:t.oMatchesSelector,o.call(t,e)},u=function(t,e){var o,i,n,s,r,h;if(null==t)return t;if("object"==typeof t)return t;for(s=t.split(" "),s.length>e.length&&(s[0]=s.slice(0,+(s.length-e.length)+1||9e9).join(" "),s.splice(1,s.length-e.length)),i={},o=r=0,h=e.length;h>r;o=++r)n=e[o],i[n]=s[o];return i},i=function(e){function o(t,e){this.tour=t,this.destroy=g(this.destroy,this),this.scrollTo=g(this.scrollTo,this),this.complete=g(this.complete,this),this.cancel=g(this.cancel,this),this.isOpen=g(this.isOpen,this),this.hide=g(this.hide,this),this.show=g(this.show,this),this.setOptions(e)}return b(o,e),o.prototype.setOptions=function(t){var e,o,i,n;if(this.options=null!=t?t:{},this.destroy(),this.id=this.options.id||this.id||"step-"+d(),this.options.when){n=this.options.when;for(e in n)o=n[e],this.on(e,o,this)}return null!=(i=this.options).buttons?(i=this.options).buttons:i.buttons=[{text:"Next",action:this.tour.next}]},o.prototype.getTour=function(){return this.tour},o.prototype.bindAdvance=function(){var t,e,o,i,n=this;return i=u(this.options.advanceOn,["selector","event"]),t=i.event,o=i.selector,e=function(t){if(n.isOpen())if(null!=o){if(p(t.target,o))return n.tour.next()}else if(n.el&&t.target===n.el)return n.tour.next()},document.body.addEventListener(t,e),this.on("destroy",function(){return document.body.removeEventListener(t,e)})},o.prototype.getAttachTo=function(){var t;if(t=u(this.options.attachTo,["element","on"]),null==t&&(t={}),"string"==typeof t.element&&(t.element=document.querySelector(t.element),null==t.element))throw new Error("Shepherd step's attachTo was not found in the page");return t},o.prototype.setupTether=function(){var e,o,i;if("undefined"==typeof Tether||null===Tether)throw new Error("Using the attachment feature of Shepherd requires the Tether library");return o=this.getAttachTo(),e=t[o.on||"right"],null==o.element&&(o.element="viewport",e="middle center"),i={classPrefix:"shepherd",element:this.el,constraints:[{to:"window",pin:!0,attachment:"together"}],target:o.element,offset:o.offset||"0 0",attachment:e},this.tether=new Tether(h(i,this.options.tetherOptions))},o.prototype.show=function(){var t,e=this;return null==this.el&&this.render(),s(this.el,"shepherd-open"),null!=(t=this.tether)&&t.enable(),this.options.scrollTo&&setTimeout(function(){return e.scrollTo()}),this.trigger("show")},o.prototype.hide=function(){var t;return f(this.el,"shepherd-open"),null!=(t=this.tether)&&t.disable(),this.trigger("hide")},o.prototype.isOpen=function(){return a(this.el,"shepherd-open")},o.prototype.cancel=function(){return this.hide(),this.trigger("cancel")},o.prototype.complete=function(){return this.hide(),this.trigger("complete")},o.prototype.scrollTo=function(){var t;return t=this.getAttachTo().element,null!=t?t.scrollIntoView():void 0},o.prototype.destroy=function(){var t;return null!=this.el&&(document.body.removeChild(this.el),delete this.el),null!=(t=this.tether)&&t.destroy(),this.trigger("destroy")},o.prototype.render=function(){var t,e,o,i,n,s,h,l,a,p,u,f,d,c,g,m;if(null!=this.el&&this.destroy(),this.el=r(""),i=document.createElement("div"),i.className="shepherd-content",this.el.appendChild(i),null!=this.options.title&&(s=document.createElement("header"),s.innerHTML=""+this.options.title+"
",this.el.className+=" shepherd-has-title",i.appendChild(s)),null!=this.options.text){for(a=r(""),l=this.options.text,"string"==typeof l&&(l=[l]),p=0,f=l.length;f>p;p++)h=l[p],a.innerHTML+=""+h+"
";i.appendChild(a)}if(n=document.createElement("footer"),this.options.buttons){for(e=r(""),g=this.options.buttons,u=0,d=g.length;d>u;u++)o=g[u],t=r(""+o.text+""),e.appendChild(t),this.bindButtonEvents(o,t.querySelector("a"));n.appendChild(e)}return i.appendChild(n),document.body.appendChild(this.el),this.setupTether(),this.options.advanceOn?this.bindAdvance():void 0},o.prototype.bindButtonEvents=function(t,e){var o,i,n,s,r=this;null==t.events&&(t.events={}),null!=t.action&&(t.events.click=t.action),s=t.events;for(o in s)i=s[o],"string"==typeof i&&(n=i,i=function(){return r.tour.show(n)}),e.addEventListener(o,i);return this.on("destroy",function(){var n,s;n=t.events,s=[];for(o in n)i=n[o],s.push(e.removeEventListener(o,i));return s})},o}(e),n=function(t){function e(t){var e,i,n,s,r,h=this;for(this.options=null!=t?t:{},this.hide=g(this.hide,this),this.cancel=g(this.cancel,this),this.back=g(this.back,this),this.next=g(this.next,this),this.steps=null!=(s=this.options.steps)?s:[],r=["complete","cancel","hide","start","show"],i=0,n=r.length;n>i;i++)e=r[i],this.on(e,function(t){return null==t&&(t={}),t.tour=h,o.trigger(e,t)})}return b(e,t),e.prototype.addStep=function(t,e){var o;return null==e&&(e=t),e instanceof i?e.tour=this:(("string"==(o=typeof t)||"number"===o)&&(e.id=t.toString()),e=h({},this.options.defaults,e),e=new i(this,e)),this.steps.push(e),e},e.prototype.getById=function(t){var e,o,i,n;for(n=this.steps,o=0,i=n.length;i>o;o++)if(e=n[o],e.id===t)return e},e.prototype.getCurrentStep=function(){return this.currentStep},e.prototype.next=function(){var t;return t=this.steps.indexOf(this.currentStep),t===this.steps.length-1?(this.hide(t),this.trigger("complete"),this.done()):this.show(t+1)},e.prototype.back=function(){var t;return t=this.steps.indexOf(this.currentStep),this.show(t-1)},e.prototype.cancel=function(){var t;return null!=(t=this.currentStep)&&t.cancel(),this.trigger("cancel"),this.done()},e.prototype.hide=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("hide"),this.done()},e.prototype.done=function(){return o.activeTour=null},e.prototype.show=function(t){var e;return null==t&&(t=0),this.currentStep&&this.currentStep.hide(),o.activeTour=this,e="string"==typeof t?this.getById(t):this.steps[t],e?(this.trigger("show",{step:e,previous:this.currentStep}),this.currentStep=e,e.show()):void 0},e.prototype.start=function(){return this.trigger("start"),this.currentStep=null,this.next()},e}(e),o=new e,h(o,{Tour:n,Step:i,Evented:e}),window.Shepherd=o}.call(this);
\ No newline at end of file
diff --git a/ajax/libs/shepherd/0.4.6/shepherd.js b/ajax/libs/shepherd/0.4.6/shepherd.js
new file mode 100644
index 000000000..de8b87ca5
--- /dev/null
+++ b/ajax/libs/shepherd/0.4.6/shepherd.js
@@ -0,0 +1,1886 @@
+/*! shepherd 0.4.5 */
+/*! tether 0.6.5 */
+
+
+(function(root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(factory);
+ } else if (typeof exports === 'object') {
+ module.exports = factory(require,exports,module);
+ } else {
+ root.Tether = factory();
+ }
+}(this, function(require,exports,module) {
+
+(function() {
+ var Evented, addClass, defer, deferred, extend, flush, getBounds, getOffsetParent, getOrigin, getScrollBarSize, getScrollParent, hasClass, node, removeClass, uniqueId, updateClasses, zeroPosCache,
+ __hasProp = {}.hasOwnProperty,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
+ __slice = [].slice;
+
+ if (this.Tether == null) {
+ this.Tether = {
+ modules: []
+ };
+ }
+
+ getScrollParent = function(el) {
+ var parent, position, scrollParent, style, _ref;
+ position = getComputedStyle(el).position;
+ if (position === 'fixed') {
+ return el;
+ }
+ scrollParent = void 0;
+ parent = el;
+ while (parent = parent.parentNode) {
+ try {
+ style = getComputedStyle(parent);
+ } catch (_error) {}
+ if (style == null) {
+ return parent;
+ }
+ if (/(auto|scroll)/.test(style['overflow'] + style['overflow-y'] + style['overflow-x'])) {
+ if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) {
+ return parent;
+ }
+ }
+ }
+ return document.body;
+ };
+
+ uniqueId = (function() {
+ var id;
+ id = 0;
+ return function() {
+ return id++;
+ };
+ })();
+
+ zeroPosCache = {};
+
+ getOrigin = function(doc) {
+ var id, k, node, v, _ref;
+ node = doc._tetherZeroElement;
+ if (node == null) {
+ node = doc.createElement('div');
+ node.setAttribute('data-tether-id', uniqueId());
+ extend(node.style, {
+ top: 0,
+ left: 0,
+ position: 'absolute'
+ });
+ doc.body.appendChild(node);
+ doc._tetherZeroElement = node;
+ }
+ id = node.getAttribute('data-tether-id');
+ if (zeroPosCache[id] == null) {
+ zeroPosCache[id] = {};
+ _ref = node.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ zeroPosCache[id][k] = v;
+ }
+ defer(function() {
+ return zeroPosCache[id] = void 0;
+ });
+ }
+ return zeroPosCache[id];
+ };
+
+ node = null;
+
+ getBounds = function(el) {
+ var box, doc, docEl, k, origin, v, _ref;
+ if (el === document) {
+ doc = document;
+ el = document.documentElement;
+ } else {
+ doc = el.ownerDocument;
+ }
+ docEl = doc.documentElement;
+ box = {};
+ _ref = el.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ box[k] = v;
+ }
+ origin = getOrigin(doc);
+ box.top -= origin.top;
+ box.left -= origin.left;
+ if (box.width == null) {
+ box.width = document.body.scrollWidth - box.left - box.right;
+ }
+ if (box.height == null) {
+ box.height = document.body.scrollHeight - box.top - box.bottom;
+ }
+ box.top = box.top - docEl.clientTop;
+ box.left = box.left - docEl.clientLeft;
+ box.right = doc.body.clientWidth - box.width - box.left;
+ box.bottom = doc.body.clientHeight - box.height - box.top;
+ return box;
+ };
+
+ getOffsetParent = function(el) {
+ return el.offsetParent || document.documentElement;
+ };
+
+ getScrollBarSize = function() {
+ var inner, outer, width, widthContained, widthScroll;
+ inner = document.createElement('div');
+ inner.style.width = '100%';
+ inner.style.height = '200px';
+ outer = document.createElement('div');
+ extend(outer.style, {
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ pointerEvents: 'none',
+ visibility: 'hidden',
+ width: '200px',
+ height: '150px',
+ overflow: 'hidden'
+ });
+ outer.appendChild(inner);
+ document.body.appendChild(outer);
+ widthContained = inner.offsetWidth;
+ outer.style.overflow = 'scroll';
+ widthScroll = inner.offsetWidth;
+ if (widthContained === widthScroll) {
+ widthScroll = outer.clientWidth;
+ }
+ document.body.removeChild(outer);
+ width = widthContained - widthScroll;
+ return {
+ width: width,
+ height: width
+ };
+ };
+
+ extend = function(out) {
+ var args, key, obj, val, _i, _len, _ref;
+ if (out == null) {
+ out = {};
+ }
+ args = [];
+ Array.prototype.push.apply(args, arguments);
+ _ref = args.slice(1);
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ obj = _ref[_i];
+ if (obj) {
+ for (key in obj) {
+ if (!__hasProp.call(obj, key)) continue;
+ val = obj[key];
+ out[key] = val;
+ }
+ }
+ }
+ return out;
+ };
+
+ removeClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ if (cls.trim()) {
+ _results.push(el.classList.remove(cls));
+ }
+ }
+ return _results;
+ } else {
+ return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' ');
+ }
+ };
+
+ addClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ if (cls.trim()) {
+ _results.push(el.classList.add(cls));
+ }
+ }
+ return _results;
+ } else {
+ removeClass(el, name);
+ return el.className += " " + name;
+ }
+ };
+
+ hasClass = function(el, name) {
+ if (el.classList != null) {
+ return el.classList.contains(name);
+ } else {
+ return new RegExp("(^| )" + name + "( |$)", 'gi').test(el.className);
+ }
+ };
+
+ updateClasses = function(el, add, all) {
+ var cls, _i, _j, _len, _len1, _results;
+ for (_i = 0, _len = all.length; _i < _len; _i++) {
+ cls = all[_i];
+ if (__indexOf.call(add, cls) < 0) {
+ if (hasClass(el, cls)) {
+ removeClass(el, cls);
+ }
+ }
+ }
+ _results = [];
+ for (_j = 0, _len1 = add.length; _j < _len1; _j++) {
+ cls = add[_j];
+ if (!hasClass(el, cls)) {
+ _results.push(addClass(el, cls));
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ deferred = [];
+
+ defer = function(fn) {
+ return deferred.push(fn);
+ };
+
+ flush = function() {
+ var fn, _results;
+ _results = [];
+ while (fn = deferred.pop()) {
+ _results.push(fn());
+ }
+ return _results;
+ };
+
+ Evented = (function() {
+ function Evented() {}
+
+ Evented.prototype.on = function(event, handler, ctx, once) {
+ var _base;
+ if (once == null) {
+ once = false;
+ }
+ if (this.bindings == null) {
+ this.bindings = {};
+ }
+ if ((_base = this.bindings)[event] == null) {
+ _base[event] = [];
+ }
+ return this.bindings[event].push({
+ handler: handler,
+ ctx: ctx,
+ once: once
+ });
+ };
+
+ Evented.prototype.once = function(event, handler, ctx) {
+ return this.on(event, handler, ctx, true);
+ };
+
+ Evented.prototype.off = function(event, handler) {
+ var i, _ref, _results;
+ if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
+ return;
+ }
+ if (handler == null) {
+ return delete this.bindings[event];
+ } else {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ if (this.bindings[event][i].handler === handler) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ Evented.prototype.trigger = function() {
+ var args, ctx, event, handler, i, once, _ref, _ref1, _results;
+ event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+ if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
+ handler.apply(ctx != null ? ctx : this, args);
+ if (once) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ return Evented;
+
+ })();
+
+ this.Tether.Utils = {
+ getScrollParent: getScrollParent,
+ getBounds: getBounds,
+ getOffsetParent: getOffsetParent,
+ extend: extend,
+ addClass: addClass,
+ removeClass: removeClass,
+ hasClass: hasClass,
+ updateClasses: updateClasses,
+ defer: defer,
+ flush: flush,
+ uniqueId: uniqueId,
+ Evented: Evented,
+ getScrollBarSize: getScrollBarSize
+ };
+
+}).call(this);
+
+(function() {
+ var MIRROR_LR, MIRROR_TB, OFFSET_MAP, Tether, addClass, addOffset, attachmentToOffset, autoToFixedAttachment, defer, extend, flush, getBounds, getOffsetParent, getOuterSize, getScrollBarSize, getScrollParent, getSize, now, offsetToPx, parseAttachment, parseOffset, position, removeClass, tethers, transformKey, updateClasses, within, _Tether, _ref,
+ __slice = [].slice,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+
+ if (this.Tether == null) {
+ throw new Error("You must include the utils.js file before tether.js");
+ }
+
+ Tether = this.Tether;
+
+ _ref = Tether.Utils, getScrollParent = _ref.getScrollParent, getSize = _ref.getSize, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getOffsetParent = _ref.getOffsetParent, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, updateClasses = _ref.updateClasses, defer = _ref.defer, flush = _ref.flush, getScrollBarSize = _ref.getScrollBarSize;
+
+ within = function(a, b, diff) {
+ if (diff == null) {
+ diff = 1;
+ }
+ return (a + diff >= b && b >= a - diff);
+ };
+
+ transformKey = (function() {
+ var el, key, _i, _len, _ref1;
+ el = document.createElement('div');
+ _ref1 = ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ key = _ref1[_i];
+ if (el.style[key] !== void 0) {
+ return key;
+ }
+ }
+ })();
+
+ tethers = [];
+
+ position = function() {
+ var tether, _i, _len;
+ for (_i = 0, _len = tethers.length; _i < _len; _i++) {
+ tether = tethers[_i];
+ tether.position(false);
+ }
+ return flush();
+ };
+
+ now = function() {
+ var _ref1;
+ return (_ref1 = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref1 : +(new Date);
+ };
+
+ (function() {
+ var event, lastCall, lastDuration, pendingTimeout, tick, _i, _len, _ref1, _results;
+ lastCall = null;
+ lastDuration = null;
+ pendingTimeout = null;
+ tick = function() {
+ if ((lastDuration != null) && lastDuration > 16) {
+ lastDuration = Math.min(lastDuration - 16, 250);
+ pendingTimeout = setTimeout(tick, 250);
+ return;
+ }
+ if ((lastCall != null) && (now() - lastCall) < 10) {
+ return;
+ }
+ if (pendingTimeout != null) {
+ clearTimeout(pendingTimeout);
+ pendingTimeout = null;
+ }
+ lastCall = now();
+ position();
+ return lastDuration = now() - lastCall;
+ };
+ _ref1 = ['resize', 'scroll', 'touchmove'];
+ _results = [];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ event = _ref1[_i];
+ _results.push(window.addEventListener(event, tick));
+ }
+ return _results;
+ })();
+
+ MIRROR_LR = {
+ center: 'center',
+ left: 'right',
+ right: 'left'
+ };
+
+ MIRROR_TB = {
+ middle: 'middle',
+ top: 'bottom',
+ bottom: 'top'
+ };
+
+ OFFSET_MAP = {
+ top: 0,
+ left: 0,
+ middle: '50%',
+ center: '50%',
+ bottom: '100%',
+ right: '100%'
+ };
+
+ autoToFixedAttachment = function(attachment, relativeToAttachment) {
+ var left, top;
+ left = attachment.left, top = attachment.top;
+ if (left === 'auto') {
+ left = MIRROR_LR[relativeToAttachment.left];
+ }
+ if (top === 'auto') {
+ top = MIRROR_TB[relativeToAttachment.top];
+ }
+ return {
+ left: left,
+ top: top
+ };
+ };
+
+ attachmentToOffset = function(attachment) {
+ var _ref1, _ref2;
+ return {
+ left: (_ref1 = OFFSET_MAP[attachment.left]) != null ? _ref1 : attachment.left,
+ top: (_ref2 = OFFSET_MAP[attachment.top]) != null ? _ref2 : attachment.top
+ };
+ };
+
+ addOffset = function() {
+ var left, offsets, out, top, _i, _len, _ref1;
+ offsets = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ out = {
+ top: 0,
+ left: 0
+ };
+ for (_i = 0, _len = offsets.length; _i < _len; _i++) {
+ _ref1 = offsets[_i], top = _ref1.top, left = _ref1.left;
+ if (typeof top === 'string') {
+ top = parseFloat(top, 10);
+ }
+ if (typeof left === 'string') {
+ left = parseFloat(left, 10);
+ }
+ out.top += top;
+ out.left += left;
+ }
+ return out;
+ };
+
+ offsetToPx = function(offset, size) {
+ if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
+ offset.left = parseFloat(offset.left, 10) / 100 * size.width;
+ }
+ if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
+ offset.top = parseFloat(offset.top, 10) / 100 * size.height;
+ }
+ return offset;
+ };
+
+ parseAttachment = parseOffset = function(value) {
+ var left, top, _ref1;
+ _ref1 = value.split(' '), top = _ref1[0], left = _ref1[1];
+ return {
+ top: top,
+ left: left
+ };
+ };
+
+ _Tether = (function() {
+ _Tether.modules = [];
+
+ function _Tether(options) {
+ this.position = __bind(this.position, this);
+ var module, _i, _len, _ref1, _ref2;
+ tethers.push(this);
+ this.history = [];
+ this.setOptions(options, false);
+ _ref1 = Tether.modules;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ module = _ref1[_i];
+ if ((_ref2 = module.initialize) != null) {
+ _ref2.call(this);
+ }
+ }
+ this.position();
+ }
+
+ _Tether.prototype.getClass = function(key) {
+ var _ref1, _ref2;
+ if ((_ref1 = this.options.classes) != null ? _ref1[key] : void 0) {
+ return this.options.classes[key];
+ } else if (((_ref2 = this.options.classes) != null ? _ref2[key] : void 0) !== false) {
+ if (this.options.classPrefix) {
+ return "" + this.options.classPrefix + "-" + key;
+ } else {
+ return key;
+ }
+ } else {
+ return '';
+ }
+ };
+
+ _Tether.prototype.setOptions = function(options, position) {
+ var defaults, key, _i, _len, _ref1, _ref2;
+ this.options = options;
+ if (position == null) {
+ position = true;
+ }
+ defaults = {
+ offset: '0 0',
+ targetOffset: '0 0',
+ targetAttachment: 'auto auto',
+ classPrefix: 'tether'
+ };
+ this.options = extend(defaults, this.options);
+ _ref1 = this.options, this.element = _ref1.element, this.target = _ref1.target, this.targetModifier = _ref1.targetModifier;
+ if (this.target === 'viewport') {
+ this.target = document.body;
+ this.targetModifier = 'visible';
+ } else if (this.target === 'scroll-handle') {
+ this.target = document.body;
+ this.targetModifier = 'scroll-handle';
+ }
+ _ref2 = ['element', 'target'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ key = _ref2[_i];
+ if (this[key] == null) {
+ throw new Error("Tether Error: Both element and target must be defined");
+ }
+ if (this[key].jquery != null) {
+ this[key] = this[key][0];
+ } else if (typeof this[key] === 'string') {
+ this[key] = document.querySelector(this[key]);
+ }
+ }
+ addClass(this.element, this.getClass('element'));
+ addClass(this.target, this.getClass('target'));
+ if (!this.options.attachment) {
+ throw new Error("Tether Error: You must provide an attachment");
+ }
+ this.targetAttachment = parseAttachment(this.options.targetAttachment);
+ this.attachment = parseAttachment(this.options.attachment);
+ this.offset = parseOffset(this.options.offset);
+ this.targetOffset = parseOffset(this.options.targetOffset);
+ if (this.scrollParent != null) {
+ this.disable();
+ }
+ if (this.targetModifier === 'scroll-handle') {
+ this.scrollParent = this.target;
+ } else {
+ this.scrollParent = getScrollParent(this.target);
+ }
+ if (this.options.enabled !== false) {
+ return this.enable(position);
+ }
+ };
+
+ _Tether.prototype.getTargetBounds = function() {
+ var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target;
+ if (this.targetModifier != null) {
+ switch (this.targetModifier) {
+ case 'visible':
+ if (this.target === document.body) {
+ return {
+ top: pageYOffset,
+ left: pageXOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(this.target);
+ out = {
+ height: bounds.height,
+ width: bounds.width,
+ top: bounds.top,
+ left: bounds.left
+ };
+ out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
+ out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight)));
+ out.height = Math.min(innerHeight, out.height);
+ out.height -= 2;
+ out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
+ out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth)));
+ out.width = Math.min(innerWidth, out.width);
+ out.width -= 2;
+ if (out.top < pageYOffset) {
+ out.top = pageYOffset;
+ }
+ if (out.left < pageXOffset) {
+ out.left = pageXOffset;
+ }
+ return out;
+ }
+ break;
+ case 'scroll-handle':
+ target = this.target;
+ if (target === document.body) {
+ target = document.documentElement;
+ bounds = {
+ left: pageXOffset,
+ top: pageYOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(target);
+ }
+ style = getComputedStyle(target);
+ hasBottomScroll = target.scrollWidth > target.clientWidth || 'scroll' === [style.overflow, style.overflowX] || this.target !== document.body;
+ scrollBottom = 0;
+ if (hasBottomScroll) {
+ scrollBottom = 15;
+ }
+ height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
+ out = {
+ width: 15,
+ height: height * 0.975 * (height / target.scrollHeight),
+ left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
+ };
+ fitAdj = 0;
+ if (height < 408 && this.target === document.body) {
+ fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
+ }
+ if (this.target !== document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ scrollPercentage = this.target.scrollTop / (target.scrollHeight - height);
+ out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
+ if (this.target === document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ return out;
+ }
+ } else {
+ return getBounds(this.target);
+ }
+ };
+
+ _Tether.prototype.clearCache = function() {
+ return this._cache = {};
+ };
+
+ _Tether.prototype.cache = function(k, getter) {
+ if (this._cache == null) {
+ this._cache = {};
+ }
+ if (this._cache[k] == null) {
+ this._cache[k] = getter.call(this);
+ }
+ return this._cache[k];
+ };
+
+ _Tether.prototype.enable = function(position) {
+ if (position == null) {
+ position = true;
+ }
+ addClass(this.target, this.getClass('enabled'));
+ addClass(this.element, this.getClass('enabled'));
+ this.enabled = true;
+ if (this.scrollParent !== document) {
+ this.scrollParent.addEventListener('scroll', this.position);
+ }
+ if (position) {
+ return this.position();
+ }
+ };
+
+ _Tether.prototype.disable = function() {
+ removeClass(this.target, this.getClass('enabled'));
+ removeClass(this.element, this.getClass('enabled'));
+ this.enabled = false;
+ if (this.scrollParent != null) {
+ return this.scrollParent.removeEventListener('scroll', this.position);
+ }
+ };
+
+ _Tether.prototype.destroy = function() {
+ var i, tether, _i, _len, _results;
+ this.disable();
+ _results = [];
+ for (i = _i = 0, _len = tethers.length; _i < _len; i = ++_i) {
+ tether = tethers[i];
+ if (tether === this) {
+ tethers.splice(i, 1);
+ break;
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ _Tether.prototype.updateAttachClasses = function(elementAttach, targetAttach) {
+ var add, all, side, sides, _i, _j, _len, _len1, _ref1,
+ _this = this;
+ if (elementAttach == null) {
+ elementAttach = this.attachment;
+ }
+ if (targetAttach == null) {
+ targetAttach = this.targetAttachment;
+ }
+ sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
+ if ((_ref1 = this._addAttachClasses) != null ? _ref1.length : void 0) {
+ this._addAttachClasses.splice(0, this._addAttachClasses.length);
+ }
+ add = this._addAttachClasses != null ? this._addAttachClasses : this._addAttachClasses = [];
+ if (elementAttach.top) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.top);
+ }
+ if (elementAttach.left) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.left);
+ }
+ if (targetAttach.top) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.top);
+ }
+ if (targetAttach.left) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.left);
+ }
+ all = [];
+ for (_i = 0, _len = sides.length; _i < _len; _i++) {
+ side = sides[_i];
+ all.push("" + (this.getClass('element-attached')) + "-" + side);
+ }
+ for (_j = 0, _len1 = sides.length; _j < _len1; _j++) {
+ side = sides[_j];
+ all.push("" + (this.getClass('target-attached')) + "-" + side);
+ }
+ return defer(function() {
+ if (_this._addAttachClasses == null) {
+ return;
+ }
+ updateClasses(_this.element, _this._addAttachClasses, all);
+ updateClasses(_this.target, _this._addAttachClasses, all);
+ return _this._addAttachClasses = void 0;
+ });
+ };
+
+ _Tether.prototype.position = function(flushChanges) {
+ var elementPos, elementStyle, height, left, manualOffset, manualTargetOffset, module, next, offset, offsetBorder, offsetParent, offsetParentSize, offsetParentStyle, offsetPosition, ret, scrollLeft, scrollTop, scrollbarSize, side, targetAttachment, targetOffset, targetPos, targetSize, top, width, _i, _j, _len, _len1, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6,
+ _this = this;
+ if (flushChanges == null) {
+ flushChanges = true;
+ }
+ if (!this.enabled) {
+ return;
+ }
+ this.clearCache();
+ targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
+ this.updateAttachClasses(this.attachment, targetAttachment);
+ elementPos = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ });
+ width = elementPos.width, height = elementPos.height;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref1 = this.lastSize, width = _ref1.width, height = _ref1.height;
+ } else {
+ this.lastSize = {
+ width: width,
+ height: height
+ };
+ }
+ targetSize = targetPos = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ offset = offsetToPx(attachmentToOffset(this.attachment), {
+ width: width,
+ height: height
+ });
+ targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
+ manualOffset = offsetToPx(this.offset, {
+ width: width,
+ height: height
+ });
+ manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
+ offset = addOffset(offset, manualOffset);
+ targetOffset = addOffset(targetOffset, manualTargetOffset);
+ left = targetPos.left + targetOffset.left - offset.left;
+ top = targetPos.top + targetOffset.top - offset.top;
+ _ref2 = Tether.modules;
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ module = _ref2[_i];
+ ret = module.position.call(this, {
+ left: left,
+ top: top,
+ targetAttachment: targetAttachment,
+ targetPos: targetPos,
+ attachment: this.attachment,
+ elementPos: elementPos,
+ offset: offset,
+ targetOffset: targetOffset,
+ manualOffset: manualOffset,
+ manualTargetOffset: manualTargetOffset,
+ scrollbarSize: scrollbarSize
+ });
+ if ((ret == null) || typeof ret !== 'object') {
+ continue;
+ } else if (ret === false) {
+ return false;
+ } else {
+ top = ret.top, left = ret.left;
+ }
+ }
+ next = {
+ page: {
+ top: top,
+ left: left
+ },
+ viewport: {
+ top: top - pageYOffset,
+ bottom: pageYOffset - top - height + innerHeight,
+ left: left - pageXOffset,
+ right: pageXOffset - left - width + innerWidth
+ }
+ };
+ if (document.body.scrollWidth > window.innerWidth) {
+ scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
+ next.viewport.bottom -= scrollbarSize.height;
+ }
+ if (document.body.scrollHeight > window.innerHeight) {
+ scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
+ next.viewport.right -= scrollbarSize.width;
+ }
+ if (((_ref3 = document.body.style.position) !== '' && _ref3 !== 'static') || ((_ref4 = document.body.parentElement.style.position) !== '' && _ref4 !== 'static')) {
+ next.page.bottom = document.body.scrollHeight - top - height;
+ next.page.right = document.body.scrollWidth - left - width;
+ }
+ if (((_ref5 = this.options.optimizations) != null ? _ref5.moveElement : void 0) !== false && (this.targetModifier == null)) {
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ offsetPosition = this.cache('target-offsetparent-bounds', function() {
+ return getBounds(offsetParent);
+ });
+ offsetParentStyle = getComputedStyle(offsetParent);
+ elementStyle = getComputedStyle(this.element);
+ offsetParentSize = offsetPosition;
+ offsetBorder = {};
+ _ref6 = ['Top', 'Left', 'Bottom', 'Right'];
+ for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
+ side = _ref6[_j];
+ offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle["border" + side + "Width"]);
+ }
+ offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
+ offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
+ if (next.page.top >= (offsetPosition.top + offsetBorder.top) && next.page.bottom >= offsetPosition.bottom) {
+ if (next.page.left >= (offsetPosition.left + offsetBorder.left) && next.page.right >= offsetPosition.right) {
+ scrollTop = offsetParent.scrollTop;
+ scrollLeft = offsetParent.scrollLeft;
+ next.offset = {
+ top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
+ left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
+ };
+ }
+ }
+ }
+ this.move(next);
+ this.history.unshift(next);
+ if (this.history.length > 3) {
+ this.history.pop();
+ }
+ if (flushChanges) {
+ flush();
+ }
+ return true;
+ };
+
+ _Tether.prototype.move = function(position) {
+ var css, elVal, found, key, moved, offsetParent, point, same, transcribe, type, val, write, writeCSS, _i, _len, _ref1, _ref2,
+ _this = this;
+ if (this.element.parentNode == null) {
+ return;
+ }
+ same = {};
+ for (type in position) {
+ same[type] = {};
+ for (key in position[type]) {
+ found = false;
+ _ref1 = this.history;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ point = _ref1[_i];
+ if (!within((_ref2 = point[type]) != null ? _ref2[key] : void 0, position[type][key])) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ same[type][key] = true;
+ }
+ }
+ }
+ css = {
+ top: '',
+ left: '',
+ right: '',
+ bottom: ''
+ };
+ transcribe = function(same, pos) {
+ var xPos, yPos, _ref3;
+ if (((_ref3 = _this.options.optimizations) != null ? _ref3.gpu : void 0) !== false) {
+ if (same.top) {
+ css.top = 0;
+ yPos = pos.top;
+ } else {
+ css.bottom = 0;
+ yPos = -pos.bottom;
+ }
+ if (same.left) {
+ css.left = 0;
+ xPos = pos.left;
+ } else {
+ css.right = 0;
+ xPos = -pos.right;
+ }
+ css[transformKey] = "translateX(" + (Math.round(xPos)) + "px) translateY(" + (Math.round(yPos)) + "px)";
+ if (transformKey !== 'msTransform') {
+ return css[transformKey] += " translateZ(0)";
+ }
+ } else {
+ if (same.top) {
+ css.top = "" + pos.top + "px";
+ } else {
+ css.bottom = "" + pos.bottom + "px";
+ }
+ if (same.left) {
+ return css.left = "" + pos.left + "px";
+ } else {
+ return css.right = "" + pos.right + "px";
+ }
+ }
+ };
+ moved = false;
+ if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
+ css.position = 'absolute';
+ transcribe(same.page, position.page);
+ } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
+ css.position = 'fixed';
+ transcribe(same.viewport, position.viewport);
+ } else if ((same.offset != null) && same.offset.top && same.offset.left) {
+ css.position = 'absolute';
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ if (getOffsetParent(this.element) !== offsetParent) {
+ defer(function() {
+ _this.element.parentNode.removeChild(_this.element);
+ return offsetParent.appendChild(_this.element);
+ });
+ }
+ transcribe(same.offset, position.offset);
+ moved = true;
+ } else {
+ css.position = 'absolute';
+ transcribe({
+ top: true,
+ left: true
+ }, position.page);
+ }
+ if (!moved && this.element.parentNode.tagName !== 'BODY') {
+ this.element.parentNode.removeChild(this.element);
+ document.body.appendChild(this.element);
+ }
+ writeCSS = {};
+ write = false;
+ for (key in css) {
+ val = css[key];
+ elVal = this.element.style[key];
+ if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) {
+ elVal = parseFloat(elVal);
+ val = parseFloat(val);
+ }
+ if (elVal !== val) {
+ write = true;
+ writeCSS[key] = css[key];
+ }
+ }
+ if (write) {
+ return defer(function() {
+ return extend(_this.element.style, writeCSS);
+ });
+ }
+ };
+
+ return _Tether;
+
+ })();
+
+ Tether.position = position;
+
+ this.Tether = extend(_Tether, Tether);
+
+}).call(this);
+
+(function() {
+ var BOUNDS_FORMAT, MIRROR_ATTACH, defer, extend, getBoundingRect, getBounds, getOuterSize, getSize, updateClasses, _ref,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+
+ _ref = this.Tether.Utils, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getSize = _ref.getSize, extend = _ref.extend, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ MIRROR_ATTACH = {
+ left: 'right',
+ right: 'left',
+ top: 'bottom',
+ bottom: 'top',
+ middle: 'middle'
+ };
+
+ BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
+
+ getBoundingRect = function(tether, to) {
+ var i, pos, side, size, style, _i, _len;
+ if (to === 'scrollParent') {
+ to = tether.scrollParent;
+ } else if (to === 'window') {
+ to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
+ }
+ if (to === document) {
+ to = to.documentElement;
+ }
+ if (to.nodeType != null) {
+ pos = size = getBounds(to);
+ style = getComputedStyle(to);
+ to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
+ for (i = _i = 0, _len = BOUNDS_FORMAT.length; _i < _len; i = ++_i) {
+ side = BOUNDS_FORMAT[i];
+ side = side[0].toUpperCase() + side.substr(1);
+ if (side === 'Top' || side === 'Left') {
+ to[i] += parseFloat(style["border" + side + "Width"]);
+ } else {
+ to[i] -= parseFloat(style["border" + side + "Width"]);
+ }
+ }
+ }
+ return to;
+ };
+
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var addClasses, allClasses, attachment, bounds, changeAttachX, changeAttachY, cls, constraint, eAttachment, height, left, oob, oobClass, p, pin, pinned, pinnedClass, removeClass, side, tAttachment, targetAttachment, targetHeight, targetSize, targetWidth, to, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8,
+ _this = this;
+ top = _arg.top, left = _arg.left, targetAttachment = _arg.targetAttachment;
+ if (!this.options.constraints) {
+ return true;
+ }
+ removeClass = function(prefix) {
+ var side, _i, _len, _results;
+ _this.removeClass(prefix);
+ _results = [];
+ for (_i = 0, _len = BOUNDS_FORMAT.length; _i < _len; _i++) {
+ side = BOUNDS_FORMAT[_i];
+ _results.push(_this.removeClass("" + prefix + "-" + side));
+ }
+ return _results;
+ };
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref2 = this.lastSize, width = _ref2.width, height = _ref2.height;
+ }
+ targetSize = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ targetHeight = targetSize.height;
+ targetWidth = targetSize.width;
+ tAttachment = {};
+ eAttachment = {};
+ allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
+ _ref3 = this.options.constraints;
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ constraint = _ref3[_i];
+ if (constraint.outOfBoundsClass) {
+ allClasses.push(constraint.outOfBoundsClass);
+ }
+ if (constraint.pinnedClass) {
+ allClasses.push(constraint.pinnedClass);
+ }
+ }
+ for (_j = 0, _len1 = allClasses.length; _j < _len1; _j++) {
+ cls = allClasses[_j];
+ _ref4 = ['left', 'top', 'right', 'bottom'];
+ for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
+ side = _ref4[_k];
+ allClasses.push("" + cls + "-" + side);
+ }
+ }
+ addClasses = [];
+ tAttachment = extend({}, targetAttachment);
+ eAttachment = extend({}, this.attachment);
+ _ref5 = this.options.constraints;
+ for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) {
+ constraint = _ref5[_l];
+ to = constraint.to, attachment = constraint.attachment, pin = constraint.pin;
+ if (attachment == null) {
+ attachment = '';
+ }
+ if (__indexOf.call(attachment, ' ') >= 0) {
+ _ref6 = attachment.split(' '), changeAttachY = _ref6[0], changeAttachX = _ref6[1];
+ } else {
+ changeAttachX = changeAttachY = attachment;
+ }
+ bounds = getBoundingRect(this, to);
+ if (changeAttachY === 'target' || changeAttachY === 'both') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ }
+ }
+ if (changeAttachY === 'together') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ if (eAttachment.top === 'bottom') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top += height;
+ eAttachment.top = 'top';
+ } else if (eAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ if (eAttachment.top === 'top') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (eAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ if (tAttachment.top === 'middle') {
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ }
+ if (changeAttachX === 'target' || changeAttachX === 'both') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ }
+ if (left + width > bounds[2] && tAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ }
+ }
+ if (changeAttachX === 'together') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ if (eAttachment.left === 'right') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left += width;
+ eAttachment.left = 'left';
+ } else if (eAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ } else if (left + width > bounds[2] && tAttachment.left === 'right') {
+ if (eAttachment.left === 'left') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (eAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left += width;
+ eAttachment.left = 'left';
+ }
+ } else if (tAttachment.left === 'center') {
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ }
+ }
+ if (changeAttachY === 'element' || changeAttachY === 'both') {
+ if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (changeAttachX === 'element' || changeAttachX === 'both') {
+ if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ }
+ if (typeof pin === 'string') {
+ pin = (function() {
+ var _len4, _m, _ref7, _results;
+ _ref7 = pin.split(',');
+ _results = [];
+ for (_m = 0, _len4 = _ref7.length; _m < _len4; _m++) {
+ p = _ref7[_m];
+ _results.push(p.trim());
+ }
+ return _results;
+ })();
+ } else if (pin === true) {
+ pin = ['top', 'left', 'right', 'bottom'];
+ }
+ pin || (pin = []);
+ pinned = [];
+ oob = [];
+ if (top < bounds[1]) {
+ if (__indexOf.call(pin, 'top') >= 0) {
+ top = bounds[1];
+ pinned.push('top');
+ } else {
+ oob.push('top');
+ }
+ }
+ if (top + height > bounds[3]) {
+ if (__indexOf.call(pin, 'bottom') >= 0) {
+ top = bounds[3] - height;
+ pinned.push('bottom');
+ } else {
+ oob.push('bottom');
+ }
+ }
+ if (left < bounds[0]) {
+ if (__indexOf.call(pin, 'left') >= 0) {
+ left = bounds[0];
+ pinned.push('left');
+ } else {
+ oob.push('left');
+ }
+ }
+ if (left + width > bounds[2]) {
+ if (__indexOf.call(pin, 'right') >= 0) {
+ left = bounds[2] - width;
+ pinned.push('right');
+ } else {
+ oob.push('right');
+ }
+ }
+ if (pinned.length) {
+ pinnedClass = (_ref7 = this.options.pinnedClass) != null ? _ref7 : this.getClass('pinned');
+ addClasses.push(pinnedClass);
+ for (_m = 0, _len4 = pinned.length; _m < _len4; _m++) {
+ side = pinned[_m];
+ addClasses.push("" + pinnedClass + "-" + side);
+ }
+ }
+ if (oob.length) {
+ oobClass = (_ref8 = this.options.outOfBoundsClass) != null ? _ref8 : this.getClass('out-of-bounds');
+ addClasses.push(oobClass);
+ for (_n = 0, _len5 = oob.length; _n < _len5; _n++) {
+ side = oob[_n];
+ addClasses.push("" + oobClass + "-" + side);
+ }
+ }
+ if (__indexOf.call(pinned, 'left') >= 0 || __indexOf.call(pinned, 'right') >= 0) {
+ eAttachment.left = tAttachment.left = false;
+ }
+ if (__indexOf.call(pinned, 'top') >= 0 || __indexOf.call(pinned, 'bottom') >= 0) {
+ eAttachment.top = tAttachment.top = false;
+ }
+ if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== this.attachment.top || eAttachment.left !== this.attachment.left) {
+ this.updateAttachClasses(eAttachment, tAttachment);
+ }
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+(function() {
+ var defer, getBounds, updateClasses, _ref;
+
+ _ref = this.Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5,
+ _this = this;
+ top = _arg.top, left = _arg.left;
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ targetPos = this.getTargetBounds();
+ bottom = top + height;
+ right = left + width;
+ abutted = [];
+ if (top <= targetPos.bottom && bottom >= targetPos.top) {
+ _ref2 = ['left', 'right'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ side = _ref2[_i];
+ if ((_ref3 = targetPos[side]) === left || _ref3 === right) {
+ abutted.push(side);
+ }
+ }
+ }
+ if (left <= targetPos.right && right >= targetPos.left) {
+ _ref4 = ['top', 'bottom'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) {
+ abutted.push(side);
+ }
+ }
+ }
+ allClasses = [];
+ addClasses = [];
+ sides = ['left', 'top', 'right', 'bottom'];
+ allClasses.push(this.getClass('abutted'));
+ for (_k = 0, _len2 = sides.length; _k < _len2; _k++) {
+ side = sides[_k];
+ allClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ if (abutted.length) {
+ addClasses.push(this.getClass('abutted'));
+ }
+ for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) {
+ side = abutted[_l];
+ addClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return true;
+ }
+ });
+
+}).call(this);
+
+(function() {
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var left, result, shift, shiftLeft, shiftTop, top, _ref;
+ top = _arg.top, left = _arg.left;
+ if (!this.options.shift) {
+ return;
+ }
+ result = function(val) {
+ if (typeof val === 'function') {
+ return val.call(this, {
+ top: top,
+ left: left
+ });
+ } else {
+ return val;
+ }
+ };
+ shift = result(this.options.shift);
+ if (typeof shift === 'string') {
+ shift = shift.split(' ');
+ shift[1] || (shift[1] = shift[0]);
+ shiftTop = shift[0], shiftLeft = shift[1];
+ shiftTop = parseFloat(shiftTop, 10);
+ shiftLeft = parseFloat(shiftLeft, 10);
+ } else {
+ _ref = [shift.top, shift.left], shiftTop = _ref[0], shiftLeft = _ref[1];
+ }
+ top += shiftTop;
+ left += shiftLeft;
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+return this.Tether;
+
+}));
+
+(function() {
+ var ATTACHMENT, Evented, Shepherd, Step, Tour, addClass, createFromHTML, extend, getBounds, hasClass, matchesSelector, parseShorthand, removeClass, uniqueId, _ref,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ _ref = Tether.Utils, extend = _ref.extend, removeClass = _ref.removeClass, addClass = _ref.addClass, hasClass = _ref.hasClass, Evented = _ref.Evented, getBounds = _ref.getBounds, uniqueId = _ref.uniqueId;
+
+ ATTACHMENT = {
+ 'top': 'top center',
+ 'left': 'middle right',
+ 'right': 'middle left',
+ 'bottom': 'bottom center'
+ };
+
+ createFromHTML = function(html) {
+ var el;
+ el = document.createElement('div');
+ el.innerHTML = html;
+ return el.children[0];
+ };
+
+ matchesSelector = function(el, sel) {
+ var matches, _ref1, _ref2, _ref3, _ref4;
+ matches = (_ref1 = (_ref2 = (_ref3 = (_ref4 = el.matches) != null ? _ref4 : el.matchesSelector) != null ? _ref3 : el.webkitMatchesSelector) != null ? _ref2 : el.mozMatchesSelector) != null ? _ref1 : el.oMatchesSelector;
+ return matches.call(el, sel);
+ };
+
+ parseShorthand = function(obj, props) {
+ var i, out, prop, vals, _i, _len;
+ if (obj == null) {
+ return obj;
+ } else if (typeof obj === 'object') {
+ return obj;
+ } else {
+ vals = obj.split(' ');
+ if (vals.length > props.length) {
+ vals[0] = vals.slice(0, +(vals.length - props.length) + 1 || 9e9).join(' ');
+ vals.splice(1, vals.length - props.length);
+ }
+ out = {};
+ for (i = _i = 0, _len = props.length; _i < _len; i = ++_i) {
+ prop = props[i];
+ out[prop] = vals[i];
+ }
+ return out;
+ }
+ };
+
+ Step = (function(_super) {
+ __extends(Step, _super);
+
+ function Step(tour, options) {
+ this.tour = tour;
+ this.destroy = __bind(this.destroy, this);
+ this.scrollTo = __bind(this.scrollTo, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.isOpen = __bind(this.isOpen, this);
+ this.hide = __bind(this.hide, this);
+ this.show = __bind(this.show, this);
+ this.setOptions(options);
+ this;
+ }
+
+ Step.prototype.setOptions = function(options) {
+ var event, handler, _base, _ref1;
+ this.options = options != null ? options : {};
+ this.destroy();
+ this.id = this.options.id || this.id || ("step-" + (uniqueId()));
+ if (this.options.when) {
+ _ref1 = this.options.when;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ this.on(event, handler, this);
+ }
+ }
+ return (_base = this.options).buttons != null ? (_base = this.options).buttons : _base.buttons = [
+ {
+ text: 'Next',
+ action: this.tour.next
+ }
+ ];
+ };
+
+ Step.prototype.getTour = function() {
+ return this.tour;
+ };
+
+ Step.prototype.bindAdvance = function() {
+ var event, handler, selector, _ref1,
+ _this = this;
+ _ref1 = parseShorthand(this.options.advanceOn, ['selector', 'event']), event = _ref1.event, selector = _ref1.selector;
+ handler = function(e) {
+ if (!_this.isOpen()) {
+ return;
+ }
+ if (selector != null) {
+ if (matchesSelector(e.target, selector)) {
+ return _this.tour.next();
+ }
+ } else {
+ if (_this.el && e.target === _this.el) {
+ return _this.tour.next();
+ }
+ }
+ };
+ document.body.addEventListener(event, handler);
+ return this.on('destroy', function() {
+ return document.body.removeEventListener(event, handler);
+ });
+ };
+
+ Step.prototype.getAttachTo = function() {
+ var opts;
+ opts = parseShorthand(this.options.attachTo, ['element', 'on']);
+ if (opts == null) {
+ opts = {};
+ }
+ if (typeof opts.element === 'string') {
+ opts.element = document.querySelector(opts.element);
+ if (opts.element == null) {
+ throw new Error("Shepherd step's attachTo was not found in the page");
+ }
+ }
+ return opts;
+ };
+
+ Step.prototype.setupTether = function() {
+ var attachment, opts, tetherOpts;
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("Using the attachment feature of Shepherd requires the Tether library");
+ }
+ opts = this.getAttachTo();
+ attachment = ATTACHMENT[opts.on || 'right'];
+ if (opts.element == null) {
+ opts.element = 'viewport';
+ attachment = 'middle center';
+ }
+ tetherOpts = {
+ classPrefix: 'shepherd',
+ element: this.el,
+ constraints: [
+ {
+ to: 'window',
+ pin: true,
+ attachment: 'together'
+ }
+ ],
+ target: opts.element,
+ offset: opts.offset || '0 0',
+ attachment: attachment
+ };
+ return this.tether = new Tether(extend(tetherOpts, this.options.tetherOptions));
+ };
+
+ Step.prototype.show = function() {
+ var _this = this;
+ if (this.el == null) {
+ this.render();
+ }
+ addClass(this.el, 'shepherd-open');
+ this.setupTether();
+ if (this.options.scrollTo) {
+ setTimeout(function() {
+ return _this.scrollTo();
+ });
+ }
+ return this.trigger('show');
+ };
+
+ Step.prototype.hide = function() {
+ var _ref1;
+ removeClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ this.tether = null;
+ return this.trigger('hide');
+ };
+
+ Step.prototype.isOpen = function() {
+ return hasClass(this.el, 'shepherd-open');
+ };
+
+ Step.prototype.cancel = function() {
+ this.hide();
+ return this.trigger('cancel');
+ };
+
+ Step.prototype.complete = function() {
+ this.hide();
+ return this.trigger('complete');
+ };
+
+ Step.prototype.scrollTo = function() {
+ var element;
+ element = this.getAttachTo().element;
+ return element != null ? element.scrollIntoView() : void 0;
+ };
+
+ Step.prototype.destroy = function() {
+ var _ref1;
+ if (this.el != null) {
+ document.body.removeChild(this.el);
+ delete this.el;
+ }
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ this.tether = null;
+ return this.trigger('destroy');
+ };
+
+ Step.prototype.render = function() {
+ var button, buttons, cfg, content, footer, header, paragraph, paragraphs, text, _i, _j, _len, _len1, _ref1, _ref2, _ref3;
+ if (this.el != null) {
+ this.destroy();
+ }
+ this.el = createFromHTML("");
+ content = document.createElement('div');
+ content.className = 'shepherd-content';
+ this.el.appendChild(content);
+ if (this.options.title != null) {
+ header = document.createElement('header');
+ header.innerHTML = "" + this.options.title + "
";
+ this.el.className += ' shepherd-has-title';
+ content.appendChild(header);
+ }
+ if (this.options.text != null) {
+ text = createFromHTML("");
+ paragraphs = this.options.text;
+ if (typeof paragraphs === 'string') {
+ paragraphs = [paragraphs];
+ }
+ for (_i = 0, _len = paragraphs.length; _i < _len; _i++) {
+ paragraph = paragraphs[_i];
+ text.innerHTML += "" + paragraph + "
";
+ }
+ content.appendChild(text);
+ }
+ footer = document.createElement('footer');
+ if (this.options.buttons) {
+ buttons = createFromHTML("");
+ _ref2 = this.options.buttons;
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
+ cfg = _ref2[_j];
+ button = createFromHTML("" + cfg.text + "");
+ buttons.appendChild(button);
+ this.bindButtonEvents(cfg, button.querySelector('a'));
+ }
+ footer.appendChild(buttons);
+ }
+ content.appendChild(footer);
+ document.body.appendChild(this.el);
+ this.setupTether();
+ if (this.options.advanceOn) {
+ return this.bindAdvance();
+ }
+ };
+
+ Step.prototype.bindButtonEvents = function(cfg, el) {
+ var event, handler, page, _ref1,
+ _this = this;
+ if (cfg.events == null) {
+ cfg.events = {};
+ }
+ if (cfg.action != null) {
+ cfg.events.click = cfg.action;
+ }
+ _ref1 = cfg.events;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ if (typeof handler === 'string') {
+ page = handler;
+ handler = function() {
+ return _this.tour.show(page);
+ };
+ }
+ el.addEventListener(event, handler);
+ }
+ return this.on('destroy', function() {
+ var _ref2, _results;
+ _ref2 = cfg.events;
+ _results = [];
+ for (event in _ref2) {
+ handler = _ref2[event];
+ _results.push(el.removeEventListener(event, handler));
+ }
+ return _results;
+ });
+ };
+
+ return Step;
+
+ })(Evented);
+
+ Tour = (function(_super) {
+ __extends(Tour, _super);
+
+ function Tour(options) {
+ var event, _i, _len, _ref1, _ref2,
+ _this = this;
+ this.options = options != null ? options : {};
+ this.hide = __bind(this.hide, this);
+ this.cancel = __bind(this.cancel, this);
+ this.back = __bind(this.back, this);
+ this.next = __bind(this.next, this);
+ this.steps = (_ref1 = this.options.steps) != null ? _ref1 : [];
+ _ref2 = ['complete', 'cancel', 'hide', 'start', 'show'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ event = _ref2[_i];
+ this.on(event, function(opts) {
+ if (opts == null) {
+ opts = {};
+ }
+ opts.tour = _this;
+ return Shepherd.trigger(event, opts);
+ });
+ }
+ this;
+ }
+
+ Tour.prototype.addStep = function(name, step) {
+ var _ref1;
+ if (step == null) {
+ step = name;
+ }
+ if (!(step instanceof Step)) {
+ if ((_ref1 = typeof name) === 'string' || _ref1 === 'number') {
+ step.id = name.toString();
+ }
+ step = extend({}, this.options.defaults, step);
+ step = new Step(this, step);
+ } else {
+ step.tour = this;
+ }
+ this.steps.push(step);
+ return step;
+ };
+
+ Tour.prototype.getById = function(id) {
+ var step, _i, _len, _ref1;
+ _ref1 = this.steps;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ step = _ref1[_i];
+ if (step.id === id) {
+ return step;
+ }
+ }
+ };
+
+ Tour.prototype.getCurrentStep = function() {
+ return this.currentStep;
+ };
+
+ Tour.prototype.next = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ if (index === this.steps.length - 1) {
+ this.hide(index);
+ this.trigger('complete');
+ return this.done();
+ } else {
+ return this.show(index + 1);
+ }
+ };
+
+ Tour.prototype.back = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ return this.show(index - 1);
+ };
+
+ Tour.prototype.cancel = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.cancel();
+ }
+ this.trigger('cancel');
+ return this.done();
+ };
+
+ Tour.prototype.hide = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('hide');
+ return this.done();
+ };
+
+ Tour.prototype.done = function() {
+ return Shepherd.activeTour = null;
+ };
+
+ Tour.prototype.show = function(key) {
+ var next;
+ if (key == null) {
+ key = 0;
+ }
+ if (this.currentStep) {
+ this.currentStep.hide();
+ }
+ Shepherd.activeTour = this;
+ if (typeof key === 'string') {
+ next = this.getById(key);
+ } else {
+ next = this.steps[key];
+ }
+ if (next) {
+ this.trigger('show', {
+ step: next,
+ previous: this.currentStep
+ });
+ this.currentStep = next;
+ return next.show();
+ }
+ };
+
+ Tour.prototype.start = function() {
+ this.trigger('start');
+ this.currentStep = null;
+ return this.next();
+ };
+
+ return Tour;
+
+ })(Evented);
+
+ Shepherd = new Evented;
+
+ extend(Shepherd, {
+ Tour: Tour,
+ Step: Step,
+ Evented: Evented
+ });
+
+ window.Shepherd = Shepherd;
+
+}).call(this);
diff --git a/ajax/libs/shepherd/0.4.6/shepherd.min.js b/ajax/libs/shepherd/0.4.6/shepherd.min.js
new file mode 100644
index 000000000..5c1317fc4
--- /dev/null
+++ b/ajax/libs/shepherd/0.4.6/shepherd.min.js
@@ -0,0 +1,2 @@
+/*! shepherd 0.4.5 */
+!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e(require,exports,module):t.Tether=e()}(this,function(){return function(){var t,e,o,i,n,s,r,h,l,a,p,u,f,d,c,g,m,v={}.hasOwnProperty,b=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1},y=[].slice;null==this.Tether&&(this.Tether={modules:[]}),p=function(t){var e,o,i,n,s;if(o=getComputedStyle(t).position,"fixed"===o)return t;for(i=void 0,e=t;e=e.parentNode;){try{n=getComputedStyle(e)}catch(r){}if(null==n)return e;if(/(auto|scroll)/.test(n.overflow+n["overflow-y"]+n["overflow-x"])&&("absolute"!==o||"relative"===(s=n.position)||"absolute"===s||"fixed"===s))return e}return document.body},c=function(){var t;return t=0,function(){return t++}}(),m={},l=function(t){var e,i,s,r,h;if(s=t._tetherZeroElement,null==s&&(s=t.createElement("div"),s.setAttribute("data-tether-id",c()),n(s.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(s),t._tetherZeroElement=s),e=s.getAttribute("data-tether-id"),null==m[e]){m[e]={},h=s.getBoundingClientRect();for(i in h)r=h[i],m[e][i]=r;o(function(){return m[e]=void 0})}return m[e]},f=null,r=function(t){var e,o,i,n,s,r,h;t===document?(o=document,t=document.documentElement):o=t.ownerDocument,i=o.documentElement,e={},h=t.getBoundingClientRect();for(n in h)r=h[n],e[n]=r;return s=l(o),e.top-=s.top,e.left-=s.left,null==e.width&&(e.width=document.body.scrollWidth-e.left-e.right),null==e.height&&(e.height=document.body.scrollHeight-e.top-e.bottom),e.top=e.top-i.clientTop,e.left=e.left-i.clientLeft,e.right=o.body.clientWidth-e.width-e.left,e.bottom=o.body.clientHeight-e.height-e.top,e},h=function(t){return t.offsetParent||document.documentElement},a=function(){var t,e,o,i,s;return t=document.createElement("div"),t.style.width="100%",t.style.height="200px",e=document.createElement("div"),n(e.style,{position:"absolute",top:0,left:0,pointerEvents:"none",visibility:"hidden",width:"200px",height:"150px",overflow:"hidden"}),e.appendChild(t),document.body.appendChild(e),i=t.offsetWidth,e.style.overflow="scroll",s=t.offsetWidth,i===s&&(s=e.clientWidth),document.body.removeChild(e),o=i-s,{width:o,height:o}},n=function(t){var e,o,i,n,s,r,h;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),h=e.slice(1),s=0,r=h.length;r>s;s++)if(i=h[s])for(o in i)v.call(i,o)&&(n=i[o],t[o]=n);return t},d=function(t,e){var o,i,n,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],i=0,n=s.length;n>i;i++)o=s[i],o.trim()&&r.push(t.classList.remove(o));return r}return t.className=t.className.replace(new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi")," ")},e=function(t,e){var o,i,n,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],i=0,n=s.length;n>i;i++)o=s[i],o.trim()&&r.push(t.classList.add(o));return r}return d(t,e),t.className+=" "+e},u=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},g=function(t,o,i){var n,s,r,h,l,a;for(s=0,h=i.length;h>s;s++)n=i[s],b.call(o,n)<0&&u(t,n)&&d(t,n);for(a=[],r=0,l=o.length;l>r;r++)n=o[r],a.push(u(t,n)?void 0:e(t,n));return a},i=[],o=function(t){return i.push(t)},s=function(){var t,e;for(e=[];t=i.pop();)e.push(t());return e},t=function(){function t(){}return t.prototype.on=function(t,e,o,i){var n;return null==i&&(i=!1),null==this.bindings&&(this.bindings={}),null==(n=this.bindings)[t]&&(n[t]=[]),this.bindings[t].push({handler:e,ctx:o,once:i})},t.prototype.once=function(t,e,o){return this.on(t,e,o,!0)},t.prototype.off=function(t,e){var o,i,n;if(null!=(null!=(i=this.bindings)?i[t]:void 0)){if(null==e)return delete this.bindings[t];for(o=0,n=[];o=e&&e>=t-o},x=function(){var t,e,o,i,n;for(t=document.createElement("div"),n=["transform","webkitTransform","OTransform","MozTransform","msTransform"],o=0,i=n.length;i>o;o++)if(e=n[o],void 0!==t.style[e])return e}(),O=[],C=function(){var t,e,o;for(e=0,o=O.length;o>e;e++)t=O[e],t.position(!1);return p()},v=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance?"function"==typeof performance.now?performance.now():void 0:void 0)?t:+new Date},function(){var t,e,o,i,n,s,r,h,l;for(e=null,o=null,i=null,n=function(){if(null!=o&&o>16)return o=Math.min(o-16,250),void(i=setTimeout(n,250));if(!(null!=e&&v()-e<10))return null!=i&&(clearTimeout(i),i=null),e=v(),C(),o=v()-e},h=["resize","scroll","touchmove"],l=[],s=0,r=h.length;r>s;s++)t=h[s],l.push(window.addEventListener(t,n));return l}(),t={center:"center",left:"right",right:"left"},e={middle:"middle",top:"bottom",bottom:"top"},o={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},h=function(o,i){var n,s;return n=o.left,s=o.top,"auto"===n&&(n=t[i.left]),"auto"===s&&(s=e[i.top]),{left:n,top:s}},r=function(t){var e,i;return{left:null!=(e=o[t.left])?e:t.left,top:null!=(i=o[t.top])?i:t.top}},s=function(){var t,e,o,i,n,s,r;for(e=1<=arguments.length?B.call(arguments,0):[],o={top:0,left:0},n=0,s=e.length;s>n;n++)r=e[n],i=r.top,t=r.left,"string"==typeof i&&(i=parseFloat(i,10)),"string"==typeof t&&(t=parseFloat(t,10)),o.top+=i,o.left+=t;return o},b=function(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t},y=w=function(t){var e,o,i;return i=t.split(" "),o=i[0],e=i[1],{top:o,left:e}},A=function(){function t(t){this.position=W(this.position,this);var e,o,n,s,r;for(O.push(this),this.history=[],this.setOptions(t,!1),s=i.modules,o=0,n=s.length;n>o;o++)e=s[o],null!=(r=e.initialize)&&r.call(this);this.position()}return t.modules=[],t.prototype.getClass=function(t){var e,o;return(null!=(e=this.options.classes)?e[t]:void 0)?this.options.classes[t]:(null!=(o=this.options.classes)?o[t]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+t:t:""},t.prototype.setOptions=function(t,e){var o,i,s,r,h,l;for(this.options=t,null==e&&(e=!0),o={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=a(o,this.options),h=this.options,this.element=h.element,this.target=h.target,this.targetModifier=h.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),l=["element","target"],s=0,r=l.length;r>s;s++){if(i=l[s],null==this[i])throw new Error("Tether Error: Both element and target must be defined");null!=this[i].jquery?this[i]=this[i][0]:"string"==typeof this[i]&&(this[i]=document.querySelector(this[i]))}if(n(this.element,this.getClass("element")),n(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=y(this.options.targetAttachment),this.attachment=y(this.options.attachment),this.offset=w(this.options.offset),this.targetOffset=w(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent="scroll-handle"===this.targetModifier?this.target:g(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,o,i,n,s,r,h,l;if(null==this.targetModifier)return u(this.target);switch(this.targetModifier){case"visible":return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:(t=u(this.target),n={height:t.height,width:t.width,top:t.top,left:t.left},n.height=Math.min(n.height,t.height-(pageYOffset-t.top)),n.height=Math.min(n.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),n.height=Math.min(innerHeight,n.height),n.height-=2,n.width=Math.min(n.width,t.width-(pageXOffset-t.left)),n.width=Math.min(n.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),n.width=Math.min(innerWidth,n.width),n.width-=2,n.topl.clientWidth||"scroll"===[h.overflow,h.overflowX]||this.target!==document.body,s=0,o&&(s=15),i=t.height-parseFloat(h.borderTopWidth)-parseFloat(h.borderBottomWidth)-s,n={width:15,height:.975*i*(i/l.scrollHeight),left:t.left+t.width-parseFloat(h.borderLeftWidth)-15},e=0,408>i&&this.target===document.body&&(e=-11e-5*Math.pow(i,2)-.00727*i+22.58),this.target!==document.body&&(n.height=Math.max(n.height,24)),r=this.target.scrollTop/(l.scrollHeight-i),n.top=r*(i-n.height-e)+t.top+parseFloat(h.borderTopWidth),this.target===document.body&&(n.height=Math.max(n.height,24)),n}},t.prototype.clearCache=function(){return this._cache={}},t.prototype.cache=function(t,e){return null==this._cache&&(this._cache={}),null==this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},t.prototype.enable=function(t){return null==t&&(t=!0),n(this.target,this.getClass("enabled")),n(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t?this.position():void 0},t.prototype.disable=function(){return T(this.target,this.getClass("enabled")),T(this.element,this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},t.prototype.destroy=function(){var t,e,o,i,n;for(this.disable(),n=[],t=o=0,i=O.length;i>o;t=++o){if(e=O[t],e===this){O.splice(t,1);break}n.push(void 0)}return n},t.prototype.updateAttachClasses=function(t,e){var o,i,n,s,r,h,a,p,u,f=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),s=["left","top","bottom","right","middle","center"],(null!=(u=this._addAttachClasses)?u.length:void 0)&&this._addAttachClasses.splice(0,this._addAttachClasses.length),o=null!=this._addAttachClasses?this._addAttachClasses:this._addAttachClasses=[],t.top&&o.push(""+this.getClass("element-attached")+"-"+t.top),t.left&&o.push(""+this.getClass("element-attached")+"-"+t.left),e.top&&o.push(""+this.getClass("target-attached")+"-"+e.top),e.left&&o.push(""+this.getClass("target-attached")+"-"+e.left),i=[],r=0,a=s.length;a>r;r++)n=s[r],i.push(""+this.getClass("element-attached")+"-"+n);for(h=0,p=s.length;p>h;h++)n=s[h],i.push(""+this.getClass("target-attached")+"-"+n);return l(function(){return null!=f._addAttachClasses?(S(f.element,f._addAttachClasses,i),S(f.target,f._addAttachClasses,i),f._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,o,n,l,a,d,g,m,v,y,w,C,T,O,x,S,E,A,M,B,W,L,_,P,z,H,F,Y,N,X,j,k,q,U,I,R=this;if(null==t&&(t=!0),this.enabled){for(this.clearCache(),B=h(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,B),e=this.cache("element-bounds",function(){return u(R.element)}),z=e.width,n=e.height,0===z&&0===n&&null!=this.lastSize?(X=this.lastSize,z=X.width,n=X.height):this.lastSize={width:z,height:n},_=L=this.cache("target-bounds",function(){return R.getTargetBounds()}),v=b(r(this.attachment),{width:z,height:n}),W=b(r(B),_),a=b(this.offset,{width:z,height:n}),d=b(this.targetOffset,_),v=s(v,a),W=s(W,d),l=L.left+W.left-v.left,P=L.top+W.top-v.top,j=i.modules,H=0,Y=j.length;Y>H;H++)if(g=j[H],x=g.position.call(this,{left:l,top:P,targetAttachment:B,targetPos:L,attachment:this.attachment,elementPos:e,offset:v,targetOffset:W,manualOffset:a,manualTargetOffset:d,scrollbarSize:A}),null!=x&&"object"==typeof x){if(x===!1)return!1;P=x.top,l=x.left}if(m={page:{top:P,left:l},viewport:{top:P-pageYOffset,bottom:pageYOffset-P-n+innerHeight,left:l-pageXOffset,right:pageXOffset-l-z+innerWidth}},document.body.scrollWidth>window.innerWidth&&(A=this.cache("scrollbar-size",c),m.viewport.bottom-=A.height),document.body.scrollHeight>window.innerHeight&&(A=this.cache("scrollbar-size",c),m.viewport.right-=A.width),(""!==(k=document.body.style.position)&&"static"!==k||""!==(q=document.body.parentElement.style.position)&&"static"!==q)&&(m.page.bottom=document.body.scrollHeight-P-n,m.page.right=document.body.scrollWidth-l-z),(null!=(U=this.options.optimizations)?U.moveElement:void 0)!==!1&&null==this.targetModifier){for(w=this.cache("target-offsetparent",function(){return f(R.target)}),O=this.cache("target-offsetparent-bounds",function(){return u(w)}),T=getComputedStyle(w),o=getComputedStyle(this.element),C=O,y={},I=["Top","Left","Bottom","Right"],F=0,N=I.length;N>F;F++)M=I[F],y[M.toLowerCase()]=parseFloat(T["border"+M+"Width"]);O.right=document.body.scrollWidth-O.left-C.width+y.right,O.bottom=document.body.scrollHeight-O.top-C.height+y.bottom,m.page.top>=O.top+y.top&&m.page.bottom>=O.bottom&&m.page.left>=O.left+y.left&&m.page.right>=O.right&&(E=w.scrollTop,S=w.scrollLeft,m.offset={top:m.page.top-O.top+E-y.top,left:m.page.left-O.left+S-y.left})}return this.move(m),this.history.unshift(m),this.history.length>3&&this.history.pop(),t&&p(),!0}},t.prototype.move=function(t){var e,o,i,n,s,r,h,p,u,d,c,g,m,v,b,y,w,C=this;if(null!=this.element.parentNode){p={};for(d in t){p[d]={};for(n in t[d]){for(i=!1,y=this.history,v=0,b=y.length;b>v;v++)if(h=y[v],!E(null!=(w=h[d])?w[n]:void 0,t[d][n])){i=!0;break}i||(p[d][n]=!0)}}e={top:"",left:"",right:"",bottom:""},u=function(t,o){var i,n,s;return(null!=(s=C.options.optimizations)?s.gpu:void 0)===!1?(t.top?e.top=""+o.top+"px":e.bottom=""+o.bottom+"px",t.left?e.left=""+o.left+"px":e.right=""+o.right+"px"):(t.top?(e.top=0,n=o.top):(e.bottom=0,n=-o.bottom),t.left?(e.left=0,i=o.left):(e.right=0,i=-o.right),e[x]="translateX("+Math.round(i)+"px) translateY("+Math.round(n)+"px)","msTransform"!==x?e[x]+=" translateZ(0)":void 0)},s=!1,(p.page.top||p.page.bottom)&&(p.page.left||p.page.right)?(e.position="absolute",u(p.page,t.page)):(p.viewport.top||p.viewport.bottom)&&(p.viewport.left||p.viewport.right)?(e.position="fixed",u(p.viewport,t.viewport)):null!=p.offset&&p.offset.top&&p.offset.left?(e.position="absolute",r=this.cache("target-offsetparent",function(){return f(C.target)}),f(this.element)!==r&&l(function(){return C.element.parentNode.removeChild(C.element),r.appendChild(C.element)}),u(p.offset,t.offset),s=!0):(e.position="absolute",u({top:!0,left:!0},t.page)),s||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),m={},g=!1;for(n in e)c=e[n],o=this.element.style[n],""===o||""===c||"top"!==n&&"left"!==n&&"bottom"!==n&&"right"!==n||(o=parseFloat(o),c=parseFloat(c)),o!==c&&(g=!0,m[n]=e[n]);return g?l(function(){return a(C.element.style,m)}):void 0}},t}(),i.position=C,this.Tether=a(A,i)}.call(this),function(){var t,e,o,i,n,s,r,h,l,a,p=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1};a=this.Tether.Utils,r=a.getOuterSize,s=a.getBounds,h=a.getSize,i=a.extend,l=a.updateClasses,o=a.defer,e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},t=["left","top","right","bottom"],n=function(e,o){var i,n,r,h,l,a,p;if("scrollParent"===o?o=e.scrollParent:"window"===o&&(o=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),o===document&&(o=o.documentElement),null!=o.nodeType)for(n=h=s(o),l=getComputedStyle(o),o=[n.left,n.top,h.width+n.left,h.height+n.top],i=a=0,p=t.length;p>a;i=++a)r=t[i],r=r[0].toUpperCase()+r.substr(1),"Top"===r||"Left"===r?o[i]+=parseFloat(l["border"+r+"Width"]):o[i]-=parseFloat(l["border"+r+"Width"]);return o},this.Tether.modules.push({position:function(e){var r,h,a,u,f,d,c,g,m,v,b,y,w,C,T,O,x,S,E,A,M,B,W,L,_,P,z,H,F,Y,N,X,j,k,q,U,I,R,D,Z,$,V,G,J,K,Q,te,ee=this;if(P=e.top,b=e.left,M=e.targetAttachment,!this.options.constraints)return!0;for(S=function(e){var o,i,n,s;for(ee.removeClass(e),s=[],i=0,n=t.length;n>i;i++)o=t[i],s.push(ee.removeClass(""+e+"-"+o));return s},Z=this.cache("element-bounds",function(){return s(ee.element)}),v=Z.height,z=Z.width,0===z&&0===v&&null!=this.lastSize&&($=this.lastSize,z=$.width,v=$.height),W=this.cache("target-bounds",function(){return ee.getTargetBounds()}),B=W.height,L=W.width,A={},m={},h=[this.getClass("pinned"),this.getClass("out-of-bounds")],V=this.options.constraints,H=0,X=V.length;X>H;H++)g=V[H],g.outOfBoundsClass&&h.push(g.outOfBoundsClass),g.pinnedClass&&h.push(g.pinnedClass);for(F=0,j=h.length;j>F;F++)for(c=h[F],G=["left","top","right","bottom"],Y=0,k=G.length;k>Y;Y++)E=G[Y],h.push(""+c+"-"+E);for(r=[],A=i({},M),m=i({},this.attachment),J=this.options.constraints,N=0,q=J.length;q>N;N++){if(g=J[N],_=g.to,a=g.attachment,T=g.pin,null==a&&(a=""),p.call(a," ")>=0?(K=a.split(" "),d=K[0],f=K[1]):f=d=a,u=n(this,_),("target"===d||"both"===d)&&(Pu[3]&&"bottom"===A.top&&(P-=B,A.top="top")),"together"===d&&(Pu[3]&&"bottom"===A.top&&("top"===m.top?(P-=B,A.top="top",P-=v,m.top="bottom"):"bottom"===m.top&&(P-=B,A.top="top",P+=v,m.top="top")),"middle"===A.top&&(P+v>u[3]&&"top"===m.top?(P-=v,m.top="bottom"):Pu[2]&&"right"===A.left&&(b-=L,A.left="left")),"together"===f&&(bu[2]&&"right"===A.left?"left"===m.left?(b-=L,A.left="left",b-=z,m.left="right"):"right"===m.left&&(b-=L,A.left="left",b+=z,m.left="left"):"center"===A.left&&(b+z>u[2]&&"left"===m.left?(b-=z,m.left="right"):bu[3]&&"top"===m.top&&(P-=v,m.top="bottom")),("element"===f||"both"===f)&&(bu[2]&&"left"===m.left&&(b-=z,m.left="right")),"string"==typeof T?T=function(){var t,e,o,i;for(o=T.split(","),i=[],e=0,t=o.length;t>e;e++)C=o[e],i.push(C.trim());return i}():T===!0&&(T=["top","left","right","bottom"]),T||(T=[]),O=[],y=[],P=0?(P=u[1],O.push("top")):y.push("top")),P+v>u[3]&&(p.call(T,"bottom")>=0?(P=u[3]-v,O.push("bottom")):y.push("bottom")),b=0?(b=u[0],O.push("left")):y.push("left")),b+z>u[2]&&(p.call(T,"right")>=0?(b=u[2]-z,O.push("right")):y.push("right")),O.length)for(x=null!=(Q=this.options.pinnedClass)?Q:this.getClass("pinned"),r.push(x),R=0,U=O.length;U>R;R++)E=O[R],r.push(""+x+"-"+E);if(y.length)for(w=null!=(te=this.options.outOfBoundsClass)?te:this.getClass("out-of-bounds"),r.push(w),D=0,I=y.length;I>D;D++)E=y[D],r.push(""+w+"-"+E);(p.call(O,"left")>=0||p.call(O,"right")>=0)&&(m.left=A.left=!1),(p.call(O,"top")>=0||p.call(O,"bottom")>=0)&&(m.top=A.top=!1),(A.top!==M.top||A.left!==M.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,A)}return o(function(){return l(ee.target,r,h),l(ee.element,r,h)}),{top:P,left:b}}})}.call(this),function(){var t,e,o,i;i=this.Tether.Utils,e=i.getBounds,o=i.updateClasses,t=i.defer,this.Tether.modules.push({position:function(i){var n,s,r,h,l,a,p,u,f,d,c,g,m,v,b,y,w,C,T,O,x,S,E,A,M,B=this;if(c=i.top,a=i.left,x=this.cache("element-bounds",function(){return e(B.element)}),l=x.height,g=x.width,d=this.getTargetBounds(),h=c+l,p=a+g,n=[],c<=d.bottom&&h>=d.top)for(S=["left","right"],m=0,w=S.length;w>m;m++)u=S[m],((E=d[u])===a||E===p)&&n.push(u);if(a<=d.right&&p>=d.left)for(A=["top","bottom"],v=0,C=A.length;C>v;v++)u=A[v],((M=d[u])===c||M===h)&&n.push(u);for(r=[],s=[],f=["left","top","right","bottom"],r.push(this.getClass("abutted")),b=0,T=f.length;T>b;b++)u=f[b],r.push(""+this.getClass("abutted")+"-"+u);for(n.length&&s.push(this.getClass("abutted")),y=0,O=n.length;O>y;y++)u=n[y],s.push(""+this.getClass("abutted")+"-"+u);return t(function(){return o(B.target,s,r),o(B.element,s,r)}),!0}})}.call(this),function(){this.Tether.modules.push({position:function(t){var e,o,i,n,s,r,h;return r=t.top,e=t.left,this.options.shift?(o=function(t){return"function"==typeof t?t.call(this,{top:r,left:e}):t},i=o(this.options.shift),"string"==typeof i?(i=i.split(" "),i[1]||(i[1]=i[0]),s=i[0],n=i[1],s=parseFloat(s,10),n=parseFloat(n,10)):(h=[i.top,i.left],s=h[0],n=h[1]),r+=s,e+=n,{top:r,left:e}):void 0}})}.call(this),this.Tether}),function(){var t,e,o,i,n,s,r,h,l,a,p,u,f,d,c,g=function(t,e){return function(){return t.apply(e,arguments)}},m={}.hasOwnProperty,v=function(t,e){function o(){this.constructor=t}for(var i in e)m.call(e,i)&&(t[i]=e[i]);return o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype,t};c=Tether.Utils,h=c.extend,f=c.removeClass,s=c.addClass,a=c.hasClass,e=c.Evented,l=c.getBounds,d=c.uniqueId,t={top:"top center",left:"middle right",right:"middle left",bottom:"bottom center"},r=function(t){var e;return e=document.createElement("div"),e.innerHTML=t,e.children[0]},p=function(t,e){var o,i,n,s,r;return o=null!=(i=null!=(n=null!=(s=null!=(r=t.matches)?r:t.matchesSelector)?s:t.webkitMatchesSelector)?n:t.mozMatchesSelector)?i:t.oMatchesSelector,o.call(t,e)},u=function(t,e){var o,i,n,s,r,h;if(null==t)return t;if("object"==typeof t)return t;for(s=t.split(" "),s.length>e.length&&(s[0]=s.slice(0,+(s.length-e.length)+1||9e9).join(" "),s.splice(1,s.length-e.length)),i={},o=r=0,h=e.length;h>r;o=++r)n=e[o],i[n]=s[o];return i},i=function(e){function o(t,e){this.tour=t,this.destroy=g(this.destroy,this),this.scrollTo=g(this.scrollTo,this),this.complete=g(this.complete,this),this.cancel=g(this.cancel,this),this.isOpen=g(this.isOpen,this),this.hide=g(this.hide,this),this.show=g(this.show,this),this.setOptions(e)}return v(o,e),o.prototype.setOptions=function(t){var e,o,i,n;if(this.options=null!=t?t:{},this.destroy(),this.id=this.options.id||this.id||"step-"+d(),this.options.when){n=this.options.when;for(e in n)o=n[e],this.on(e,o,this)}return null!=(i=this.options).buttons?(i=this.options).buttons:i.buttons=[{text:"Next",action:this.tour.next}]},o.prototype.getTour=function(){return this.tour},o.prototype.bindAdvance=function(){var t,e,o,i,n=this;return i=u(this.options.advanceOn,["selector","event"]),t=i.event,o=i.selector,e=function(t){if(n.isOpen())if(null!=o){if(p(t.target,o))return n.tour.next()}else if(n.el&&t.target===n.el)return n.tour.next()},document.body.addEventListener(t,e),this.on("destroy",function(){return document.body.removeEventListener(t,e)})},o.prototype.getAttachTo=function(){var t;if(t=u(this.options.attachTo,["element","on"]),null==t&&(t={}),"string"==typeof t.element&&(t.element=document.querySelector(t.element),null==t.element))throw new Error("Shepherd step's attachTo was not found in the page");return t},o.prototype.setupTether=function(){var e,o,i;if("undefined"==typeof Tether||null===Tether)throw new Error("Using the attachment feature of Shepherd requires the Tether library");return o=this.getAttachTo(),e=t[o.on||"right"],null==o.element&&(o.element="viewport",e="middle center"),i={classPrefix:"shepherd",element:this.el,constraints:[{to:"window",pin:!0,attachment:"together"}],target:o.element,offset:o.offset||"0 0",attachment:e},this.tether=new Tether(h(i,this.options.tetherOptions))},o.prototype.show=function(){var t=this;return null==this.el&&this.render(),s(this.el,"shepherd-open"),this.setupTether(),this.options.scrollTo&&setTimeout(function(){return t.scrollTo()}),this.trigger("show")},o.prototype.hide=function(){var t;return f(this.el,"shepherd-open"),null!=(t=this.tether)&&t.destroy(),this.tether=null,this.trigger("hide")},o.prototype.isOpen=function(){return a(this.el,"shepherd-open")},o.prototype.cancel=function(){return this.hide(),this.trigger("cancel")},o.prototype.complete=function(){return this.hide(),this.trigger("complete")},o.prototype.scrollTo=function(){var t;return t=this.getAttachTo().element,null!=t?t.scrollIntoView():void 0},o.prototype.destroy=function(){var t;return null!=this.el&&(document.body.removeChild(this.el),delete this.el),null!=(t=this.tether)&&t.destroy(),this.tether=null,this.trigger("destroy")},o.prototype.render=function(){var t,e,o,i,n,s,h,l,a,p,u,f,d,c,g,m;if(null!=this.el&&this.destroy(),this.el=r(""),i=document.createElement("div"),i.className="shepherd-content",this.el.appendChild(i),null!=this.options.title&&(s=document.createElement("header"),s.innerHTML=""+this.options.title+"
",this.el.className+=" shepherd-has-title",i.appendChild(s)),null!=this.options.text){for(a=r(""),l=this.options.text,"string"==typeof l&&(l=[l]),p=0,f=l.length;f>p;p++)h=l[p],a.innerHTML+=""+h+"
";i.appendChild(a)}if(n=document.createElement("footer"),this.options.buttons){for(e=r(""),g=this.options.buttons,u=0,d=g.length;d>u;u++)o=g[u],t=r(""+o.text+""),e.appendChild(t),this.bindButtonEvents(o,t.querySelector("a"));n.appendChild(e)}return i.appendChild(n),document.body.appendChild(this.el),this.setupTether(),this.options.advanceOn?this.bindAdvance():void 0},o.prototype.bindButtonEvents=function(t,e){var o,i,n,s,r=this;null==t.events&&(t.events={}),null!=t.action&&(t.events.click=t.action),s=t.events;for(o in s)i=s[o],"string"==typeof i&&(n=i,i=function(){return r.tour.show(n)}),e.addEventListener(o,i);return this.on("destroy",function(){var n,s;n=t.events,s=[];for(o in n)i=n[o],s.push(e.removeEventListener(o,i));return s})},o}(e),n=function(t){function e(t){var e,i,n,s,r,h=this;for(this.options=null!=t?t:{},this.hide=g(this.hide,this),this.cancel=g(this.cancel,this),this.back=g(this.back,this),this.next=g(this.next,this),this.steps=null!=(s=this.options.steps)?s:[],r=["complete","cancel","hide","start","show"],i=0,n=r.length;n>i;i++)e=r[i],this.on(e,function(t){return null==t&&(t={}),t.tour=h,o.trigger(e,t)})}return v(e,t),e.prototype.addStep=function(t,e){var o;return null==e&&(e=t),e instanceof i?e.tour=this:(("string"==(o=typeof t)||"number"===o)&&(e.id=t.toString()),e=h({},this.options.defaults,e),e=new i(this,e)),this.steps.push(e),e},e.prototype.getById=function(t){var e,o,i,n;for(n=this.steps,o=0,i=n.length;i>o;o++)if(e=n[o],e.id===t)return e},e.prototype.getCurrentStep=function(){return this.currentStep},e.prototype.next=function(){var t;return t=this.steps.indexOf(this.currentStep),t===this.steps.length-1?(this.hide(t),this.trigger("complete"),this.done()):this.show(t+1)},e.prototype.back=function(){var t;return t=this.steps.indexOf(this.currentStep),this.show(t-1)},e.prototype.cancel=function(){var t;return null!=(t=this.currentStep)&&t.cancel(),this.trigger("cancel"),this.done()},e.prototype.hide=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("hide"),this.done()},e.prototype.done=function(){return o.activeTour=null},e.prototype.show=function(t){var e;return null==t&&(t=0),this.currentStep&&this.currentStep.hide(),o.activeTour=this,e="string"==typeof t?this.getById(t):this.steps[t],e?(this.trigger("show",{step:e,previous:this.currentStep}),this.currentStep=e,e.show()):void 0},e.prototype.start=function(){return this.trigger("start"),this.currentStep=null,this.next()},e}(e),o=new e,h(o,{Tour:n,Step:i,Evented:e}),window.Shepherd=o}.call(this);
\ No newline at end of file
diff --git a/ajax/libs/shepherd/0.4.7/shepherd.js b/ajax/libs/shepherd/0.4.7/shepherd.js
new file mode 100644
index 000000000..4cc0f31fd
--- /dev/null
+++ b/ajax/libs/shepherd/0.4.7/shepherd.js
@@ -0,0 +1,1886 @@
+/*! shepherd 0.4.7 */
+/*! tether 0.6.5 */
+
+
+(function(root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(factory);
+ } else if (typeof exports === 'object') {
+ module.exports = factory(require,exports,module);
+ } else {
+ root.Tether = factory();
+ }
+}(this, function(require,exports,module) {
+
+(function() {
+ var Evented, addClass, defer, deferred, extend, flush, getBounds, getOffsetParent, getOrigin, getScrollBarSize, getScrollParent, hasClass, node, removeClass, uniqueId, updateClasses, zeroPosCache,
+ __hasProp = {}.hasOwnProperty,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
+ __slice = [].slice;
+
+ if (this.Tether == null) {
+ this.Tether = {
+ modules: []
+ };
+ }
+
+ getScrollParent = function(el) {
+ var parent, position, scrollParent, style, _ref;
+ position = getComputedStyle(el).position;
+ if (position === 'fixed') {
+ return el;
+ }
+ scrollParent = void 0;
+ parent = el;
+ while (parent = parent.parentNode) {
+ try {
+ style = getComputedStyle(parent);
+ } catch (_error) {}
+ if (style == null) {
+ return parent;
+ }
+ if (/(auto|scroll)/.test(style['overflow'] + style['overflow-y'] + style['overflow-x'])) {
+ if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) {
+ return parent;
+ }
+ }
+ }
+ return document.body;
+ };
+
+ uniqueId = (function() {
+ var id;
+ id = 0;
+ return function() {
+ return id++;
+ };
+ })();
+
+ zeroPosCache = {};
+
+ getOrigin = function(doc) {
+ var id, k, node, v, _ref;
+ node = doc._tetherZeroElement;
+ if (node == null) {
+ node = doc.createElement('div');
+ node.setAttribute('data-tether-id', uniqueId());
+ extend(node.style, {
+ top: 0,
+ left: 0,
+ position: 'absolute'
+ });
+ doc.body.appendChild(node);
+ doc._tetherZeroElement = node;
+ }
+ id = node.getAttribute('data-tether-id');
+ if (zeroPosCache[id] == null) {
+ zeroPosCache[id] = {};
+ _ref = node.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ zeroPosCache[id][k] = v;
+ }
+ defer(function() {
+ return zeroPosCache[id] = void 0;
+ });
+ }
+ return zeroPosCache[id];
+ };
+
+ node = null;
+
+ getBounds = function(el) {
+ var box, doc, docEl, k, origin, v, _ref;
+ if (el === document) {
+ doc = document;
+ el = document.documentElement;
+ } else {
+ doc = el.ownerDocument;
+ }
+ docEl = doc.documentElement;
+ box = {};
+ _ref = el.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ box[k] = v;
+ }
+ origin = getOrigin(doc);
+ box.top -= origin.top;
+ box.left -= origin.left;
+ if (box.width == null) {
+ box.width = document.body.scrollWidth - box.left - box.right;
+ }
+ if (box.height == null) {
+ box.height = document.body.scrollHeight - box.top - box.bottom;
+ }
+ box.top = box.top - docEl.clientTop;
+ box.left = box.left - docEl.clientLeft;
+ box.right = doc.body.clientWidth - box.width - box.left;
+ box.bottom = doc.body.clientHeight - box.height - box.top;
+ return box;
+ };
+
+ getOffsetParent = function(el) {
+ return el.offsetParent || document.documentElement;
+ };
+
+ getScrollBarSize = function() {
+ var inner, outer, width, widthContained, widthScroll;
+ inner = document.createElement('div');
+ inner.style.width = '100%';
+ inner.style.height = '200px';
+ outer = document.createElement('div');
+ extend(outer.style, {
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ pointerEvents: 'none',
+ visibility: 'hidden',
+ width: '200px',
+ height: '150px',
+ overflow: 'hidden'
+ });
+ outer.appendChild(inner);
+ document.body.appendChild(outer);
+ widthContained = inner.offsetWidth;
+ outer.style.overflow = 'scroll';
+ widthScroll = inner.offsetWidth;
+ if (widthContained === widthScroll) {
+ widthScroll = outer.clientWidth;
+ }
+ document.body.removeChild(outer);
+ width = widthContained - widthScroll;
+ return {
+ width: width,
+ height: width
+ };
+ };
+
+ extend = function(out) {
+ var args, key, obj, val, _i, _len, _ref;
+ if (out == null) {
+ out = {};
+ }
+ args = [];
+ Array.prototype.push.apply(args, arguments);
+ _ref = args.slice(1);
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ obj = _ref[_i];
+ if (obj) {
+ for (key in obj) {
+ if (!__hasProp.call(obj, key)) continue;
+ val = obj[key];
+ out[key] = val;
+ }
+ }
+ }
+ return out;
+ };
+
+ removeClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ if (cls.trim()) {
+ _results.push(el.classList.remove(cls));
+ }
+ }
+ return _results;
+ } else {
+ return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' ');
+ }
+ };
+
+ addClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ if (cls.trim()) {
+ _results.push(el.classList.add(cls));
+ }
+ }
+ return _results;
+ } else {
+ removeClass(el, name);
+ return el.className += " " + name;
+ }
+ };
+
+ hasClass = function(el, name) {
+ if (el.classList != null) {
+ return el.classList.contains(name);
+ } else {
+ return new RegExp("(^| )" + name + "( |$)", 'gi').test(el.className);
+ }
+ };
+
+ updateClasses = function(el, add, all) {
+ var cls, _i, _j, _len, _len1, _results;
+ for (_i = 0, _len = all.length; _i < _len; _i++) {
+ cls = all[_i];
+ if (__indexOf.call(add, cls) < 0) {
+ if (hasClass(el, cls)) {
+ removeClass(el, cls);
+ }
+ }
+ }
+ _results = [];
+ for (_j = 0, _len1 = add.length; _j < _len1; _j++) {
+ cls = add[_j];
+ if (!hasClass(el, cls)) {
+ _results.push(addClass(el, cls));
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ deferred = [];
+
+ defer = function(fn) {
+ return deferred.push(fn);
+ };
+
+ flush = function() {
+ var fn, _results;
+ _results = [];
+ while (fn = deferred.pop()) {
+ _results.push(fn());
+ }
+ return _results;
+ };
+
+ Evented = (function() {
+ function Evented() {}
+
+ Evented.prototype.on = function(event, handler, ctx, once) {
+ var _base;
+ if (once == null) {
+ once = false;
+ }
+ if (this.bindings == null) {
+ this.bindings = {};
+ }
+ if ((_base = this.bindings)[event] == null) {
+ _base[event] = [];
+ }
+ return this.bindings[event].push({
+ handler: handler,
+ ctx: ctx,
+ once: once
+ });
+ };
+
+ Evented.prototype.once = function(event, handler, ctx) {
+ return this.on(event, handler, ctx, true);
+ };
+
+ Evented.prototype.off = function(event, handler) {
+ var i, _ref, _results;
+ if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
+ return;
+ }
+ if (handler == null) {
+ return delete this.bindings[event];
+ } else {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ if (this.bindings[event][i].handler === handler) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ Evented.prototype.trigger = function() {
+ var args, ctx, event, handler, i, once, _ref, _ref1, _results;
+ event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+ if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
+ handler.apply(ctx != null ? ctx : this, args);
+ if (once) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ return Evented;
+
+ })();
+
+ this.Tether.Utils = {
+ getScrollParent: getScrollParent,
+ getBounds: getBounds,
+ getOffsetParent: getOffsetParent,
+ extend: extend,
+ addClass: addClass,
+ removeClass: removeClass,
+ hasClass: hasClass,
+ updateClasses: updateClasses,
+ defer: defer,
+ flush: flush,
+ uniqueId: uniqueId,
+ Evented: Evented,
+ getScrollBarSize: getScrollBarSize
+ };
+
+}).call(this);
+
+(function() {
+ var MIRROR_LR, MIRROR_TB, OFFSET_MAP, Tether, addClass, addOffset, attachmentToOffset, autoToFixedAttachment, defer, extend, flush, getBounds, getOffsetParent, getOuterSize, getScrollBarSize, getScrollParent, getSize, now, offsetToPx, parseAttachment, parseOffset, position, removeClass, tethers, transformKey, updateClasses, within, _Tether, _ref,
+ __slice = [].slice,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+
+ if (this.Tether == null) {
+ throw new Error("You must include the utils.js file before tether.js");
+ }
+
+ Tether = this.Tether;
+
+ _ref = Tether.Utils, getScrollParent = _ref.getScrollParent, getSize = _ref.getSize, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getOffsetParent = _ref.getOffsetParent, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, updateClasses = _ref.updateClasses, defer = _ref.defer, flush = _ref.flush, getScrollBarSize = _ref.getScrollBarSize;
+
+ within = function(a, b, diff) {
+ if (diff == null) {
+ diff = 1;
+ }
+ return (a + diff >= b && b >= a - diff);
+ };
+
+ transformKey = (function() {
+ var el, key, _i, _len, _ref1;
+ el = document.createElement('div');
+ _ref1 = ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ key = _ref1[_i];
+ if (el.style[key] !== void 0) {
+ return key;
+ }
+ }
+ })();
+
+ tethers = [];
+
+ position = function() {
+ var tether, _i, _len;
+ for (_i = 0, _len = tethers.length; _i < _len; _i++) {
+ tether = tethers[_i];
+ tether.position(false);
+ }
+ return flush();
+ };
+
+ now = function() {
+ var _ref1;
+ return (_ref1 = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref1 : +(new Date);
+ };
+
+ (function() {
+ var event, lastCall, lastDuration, pendingTimeout, tick, _i, _len, _ref1, _results;
+ lastCall = null;
+ lastDuration = null;
+ pendingTimeout = null;
+ tick = function() {
+ if ((lastDuration != null) && lastDuration > 16) {
+ lastDuration = Math.min(lastDuration - 16, 250);
+ pendingTimeout = setTimeout(tick, 250);
+ return;
+ }
+ if ((lastCall != null) && (now() - lastCall) < 10) {
+ return;
+ }
+ if (pendingTimeout != null) {
+ clearTimeout(pendingTimeout);
+ pendingTimeout = null;
+ }
+ lastCall = now();
+ position();
+ return lastDuration = now() - lastCall;
+ };
+ _ref1 = ['resize', 'scroll', 'touchmove'];
+ _results = [];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ event = _ref1[_i];
+ _results.push(window.addEventListener(event, tick));
+ }
+ return _results;
+ })();
+
+ MIRROR_LR = {
+ center: 'center',
+ left: 'right',
+ right: 'left'
+ };
+
+ MIRROR_TB = {
+ middle: 'middle',
+ top: 'bottom',
+ bottom: 'top'
+ };
+
+ OFFSET_MAP = {
+ top: 0,
+ left: 0,
+ middle: '50%',
+ center: '50%',
+ bottom: '100%',
+ right: '100%'
+ };
+
+ autoToFixedAttachment = function(attachment, relativeToAttachment) {
+ var left, top;
+ left = attachment.left, top = attachment.top;
+ if (left === 'auto') {
+ left = MIRROR_LR[relativeToAttachment.left];
+ }
+ if (top === 'auto') {
+ top = MIRROR_TB[relativeToAttachment.top];
+ }
+ return {
+ left: left,
+ top: top
+ };
+ };
+
+ attachmentToOffset = function(attachment) {
+ var _ref1, _ref2;
+ return {
+ left: (_ref1 = OFFSET_MAP[attachment.left]) != null ? _ref1 : attachment.left,
+ top: (_ref2 = OFFSET_MAP[attachment.top]) != null ? _ref2 : attachment.top
+ };
+ };
+
+ addOffset = function() {
+ var left, offsets, out, top, _i, _len, _ref1;
+ offsets = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ out = {
+ top: 0,
+ left: 0
+ };
+ for (_i = 0, _len = offsets.length; _i < _len; _i++) {
+ _ref1 = offsets[_i], top = _ref1.top, left = _ref1.left;
+ if (typeof top === 'string') {
+ top = parseFloat(top, 10);
+ }
+ if (typeof left === 'string') {
+ left = parseFloat(left, 10);
+ }
+ out.top += top;
+ out.left += left;
+ }
+ return out;
+ };
+
+ offsetToPx = function(offset, size) {
+ if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
+ offset.left = parseFloat(offset.left, 10) / 100 * size.width;
+ }
+ if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
+ offset.top = parseFloat(offset.top, 10) / 100 * size.height;
+ }
+ return offset;
+ };
+
+ parseAttachment = parseOffset = function(value) {
+ var left, top, _ref1;
+ _ref1 = value.split(' '), top = _ref1[0], left = _ref1[1];
+ return {
+ top: top,
+ left: left
+ };
+ };
+
+ _Tether = (function() {
+ _Tether.modules = [];
+
+ function _Tether(options) {
+ this.position = __bind(this.position, this);
+ var module, _i, _len, _ref1, _ref2;
+ tethers.push(this);
+ this.history = [];
+ this.setOptions(options, false);
+ _ref1 = Tether.modules;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ module = _ref1[_i];
+ if ((_ref2 = module.initialize) != null) {
+ _ref2.call(this);
+ }
+ }
+ this.position();
+ }
+
+ _Tether.prototype.getClass = function(key) {
+ var _ref1, _ref2;
+ if ((_ref1 = this.options.classes) != null ? _ref1[key] : void 0) {
+ return this.options.classes[key];
+ } else if (((_ref2 = this.options.classes) != null ? _ref2[key] : void 0) !== false) {
+ if (this.options.classPrefix) {
+ return "" + this.options.classPrefix + "-" + key;
+ } else {
+ return key;
+ }
+ } else {
+ return '';
+ }
+ };
+
+ _Tether.prototype.setOptions = function(options, position) {
+ var defaults, key, _i, _len, _ref1, _ref2;
+ this.options = options;
+ if (position == null) {
+ position = true;
+ }
+ defaults = {
+ offset: '0 0',
+ targetOffset: '0 0',
+ targetAttachment: 'auto auto',
+ classPrefix: 'tether'
+ };
+ this.options = extend(defaults, this.options);
+ _ref1 = this.options, this.element = _ref1.element, this.target = _ref1.target, this.targetModifier = _ref1.targetModifier;
+ if (this.target === 'viewport') {
+ this.target = document.body;
+ this.targetModifier = 'visible';
+ } else if (this.target === 'scroll-handle') {
+ this.target = document.body;
+ this.targetModifier = 'scroll-handle';
+ }
+ _ref2 = ['element', 'target'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ key = _ref2[_i];
+ if (this[key] == null) {
+ throw new Error("Tether Error: Both element and target must be defined");
+ }
+ if (this[key].jquery != null) {
+ this[key] = this[key][0];
+ } else if (typeof this[key] === 'string') {
+ this[key] = document.querySelector(this[key]);
+ }
+ }
+ addClass(this.element, this.getClass('element'));
+ addClass(this.target, this.getClass('target'));
+ if (!this.options.attachment) {
+ throw new Error("Tether Error: You must provide an attachment");
+ }
+ this.targetAttachment = parseAttachment(this.options.targetAttachment);
+ this.attachment = parseAttachment(this.options.attachment);
+ this.offset = parseOffset(this.options.offset);
+ this.targetOffset = parseOffset(this.options.targetOffset);
+ if (this.scrollParent != null) {
+ this.disable();
+ }
+ if (this.targetModifier === 'scroll-handle') {
+ this.scrollParent = this.target;
+ } else {
+ this.scrollParent = getScrollParent(this.target);
+ }
+ if (this.options.enabled !== false) {
+ return this.enable(position);
+ }
+ };
+
+ _Tether.prototype.getTargetBounds = function() {
+ var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target;
+ if (this.targetModifier != null) {
+ switch (this.targetModifier) {
+ case 'visible':
+ if (this.target === document.body) {
+ return {
+ top: pageYOffset,
+ left: pageXOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(this.target);
+ out = {
+ height: bounds.height,
+ width: bounds.width,
+ top: bounds.top,
+ left: bounds.left
+ };
+ out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
+ out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight)));
+ out.height = Math.min(innerHeight, out.height);
+ out.height -= 2;
+ out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
+ out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth)));
+ out.width = Math.min(innerWidth, out.width);
+ out.width -= 2;
+ if (out.top < pageYOffset) {
+ out.top = pageYOffset;
+ }
+ if (out.left < pageXOffset) {
+ out.left = pageXOffset;
+ }
+ return out;
+ }
+ break;
+ case 'scroll-handle':
+ target = this.target;
+ if (target === document.body) {
+ target = document.documentElement;
+ bounds = {
+ left: pageXOffset,
+ top: pageYOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(target);
+ }
+ style = getComputedStyle(target);
+ hasBottomScroll = target.scrollWidth > target.clientWidth || 'scroll' === [style.overflow, style.overflowX] || this.target !== document.body;
+ scrollBottom = 0;
+ if (hasBottomScroll) {
+ scrollBottom = 15;
+ }
+ height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
+ out = {
+ width: 15,
+ height: height * 0.975 * (height / target.scrollHeight),
+ left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
+ };
+ fitAdj = 0;
+ if (height < 408 && this.target === document.body) {
+ fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
+ }
+ if (this.target !== document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ scrollPercentage = this.target.scrollTop / (target.scrollHeight - height);
+ out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
+ if (this.target === document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ return out;
+ }
+ } else {
+ return getBounds(this.target);
+ }
+ };
+
+ _Tether.prototype.clearCache = function() {
+ return this._cache = {};
+ };
+
+ _Tether.prototype.cache = function(k, getter) {
+ if (this._cache == null) {
+ this._cache = {};
+ }
+ if (this._cache[k] == null) {
+ this._cache[k] = getter.call(this);
+ }
+ return this._cache[k];
+ };
+
+ _Tether.prototype.enable = function(position) {
+ if (position == null) {
+ position = true;
+ }
+ addClass(this.target, this.getClass('enabled'));
+ addClass(this.element, this.getClass('enabled'));
+ this.enabled = true;
+ if (this.scrollParent !== document) {
+ this.scrollParent.addEventListener('scroll', this.position);
+ }
+ if (position) {
+ return this.position();
+ }
+ };
+
+ _Tether.prototype.disable = function() {
+ removeClass(this.target, this.getClass('enabled'));
+ removeClass(this.element, this.getClass('enabled'));
+ this.enabled = false;
+ if (this.scrollParent != null) {
+ return this.scrollParent.removeEventListener('scroll', this.position);
+ }
+ };
+
+ _Tether.prototype.destroy = function() {
+ var i, tether, _i, _len, _results;
+ this.disable();
+ _results = [];
+ for (i = _i = 0, _len = tethers.length; _i < _len; i = ++_i) {
+ tether = tethers[i];
+ if (tether === this) {
+ tethers.splice(i, 1);
+ break;
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ _Tether.prototype.updateAttachClasses = function(elementAttach, targetAttach) {
+ var add, all, side, sides, _i, _j, _len, _len1, _ref1,
+ _this = this;
+ if (elementAttach == null) {
+ elementAttach = this.attachment;
+ }
+ if (targetAttach == null) {
+ targetAttach = this.targetAttachment;
+ }
+ sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
+ if ((_ref1 = this._addAttachClasses) != null ? _ref1.length : void 0) {
+ this._addAttachClasses.splice(0, this._addAttachClasses.length);
+ }
+ add = this._addAttachClasses != null ? this._addAttachClasses : this._addAttachClasses = [];
+ if (elementAttach.top) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.top);
+ }
+ if (elementAttach.left) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.left);
+ }
+ if (targetAttach.top) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.top);
+ }
+ if (targetAttach.left) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.left);
+ }
+ all = [];
+ for (_i = 0, _len = sides.length; _i < _len; _i++) {
+ side = sides[_i];
+ all.push("" + (this.getClass('element-attached')) + "-" + side);
+ }
+ for (_j = 0, _len1 = sides.length; _j < _len1; _j++) {
+ side = sides[_j];
+ all.push("" + (this.getClass('target-attached')) + "-" + side);
+ }
+ return defer(function() {
+ if (_this._addAttachClasses == null) {
+ return;
+ }
+ updateClasses(_this.element, _this._addAttachClasses, all);
+ updateClasses(_this.target, _this._addAttachClasses, all);
+ return _this._addAttachClasses = void 0;
+ });
+ };
+
+ _Tether.prototype.position = function(flushChanges) {
+ var elementPos, elementStyle, height, left, manualOffset, manualTargetOffset, module, next, offset, offsetBorder, offsetParent, offsetParentSize, offsetParentStyle, offsetPosition, ret, scrollLeft, scrollTop, scrollbarSize, side, targetAttachment, targetOffset, targetPos, targetSize, top, width, _i, _j, _len, _len1, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6,
+ _this = this;
+ if (flushChanges == null) {
+ flushChanges = true;
+ }
+ if (!this.enabled) {
+ return;
+ }
+ this.clearCache();
+ targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
+ this.updateAttachClasses(this.attachment, targetAttachment);
+ elementPos = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ });
+ width = elementPos.width, height = elementPos.height;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref1 = this.lastSize, width = _ref1.width, height = _ref1.height;
+ } else {
+ this.lastSize = {
+ width: width,
+ height: height
+ };
+ }
+ targetSize = targetPos = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ offset = offsetToPx(attachmentToOffset(this.attachment), {
+ width: width,
+ height: height
+ });
+ targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
+ manualOffset = offsetToPx(this.offset, {
+ width: width,
+ height: height
+ });
+ manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
+ offset = addOffset(offset, manualOffset);
+ targetOffset = addOffset(targetOffset, manualTargetOffset);
+ left = targetPos.left + targetOffset.left - offset.left;
+ top = targetPos.top + targetOffset.top - offset.top;
+ _ref2 = Tether.modules;
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ module = _ref2[_i];
+ ret = module.position.call(this, {
+ left: left,
+ top: top,
+ targetAttachment: targetAttachment,
+ targetPos: targetPos,
+ attachment: this.attachment,
+ elementPos: elementPos,
+ offset: offset,
+ targetOffset: targetOffset,
+ manualOffset: manualOffset,
+ manualTargetOffset: manualTargetOffset,
+ scrollbarSize: scrollbarSize
+ });
+ if ((ret == null) || typeof ret !== 'object') {
+ continue;
+ } else if (ret === false) {
+ return false;
+ } else {
+ top = ret.top, left = ret.left;
+ }
+ }
+ next = {
+ page: {
+ top: top,
+ left: left
+ },
+ viewport: {
+ top: top - pageYOffset,
+ bottom: pageYOffset - top - height + innerHeight,
+ left: left - pageXOffset,
+ right: pageXOffset - left - width + innerWidth
+ }
+ };
+ if (document.body.scrollWidth > window.innerWidth) {
+ scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
+ next.viewport.bottom -= scrollbarSize.height;
+ }
+ if (document.body.scrollHeight > window.innerHeight) {
+ scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
+ next.viewport.right -= scrollbarSize.width;
+ }
+ if (((_ref3 = document.body.style.position) !== '' && _ref3 !== 'static') || ((_ref4 = document.body.parentElement.style.position) !== '' && _ref4 !== 'static')) {
+ next.page.bottom = document.body.scrollHeight - top - height;
+ next.page.right = document.body.scrollWidth - left - width;
+ }
+ if (((_ref5 = this.options.optimizations) != null ? _ref5.moveElement : void 0) !== false && (this.targetModifier == null)) {
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ offsetPosition = this.cache('target-offsetparent-bounds', function() {
+ return getBounds(offsetParent);
+ });
+ offsetParentStyle = getComputedStyle(offsetParent);
+ elementStyle = getComputedStyle(this.element);
+ offsetParentSize = offsetPosition;
+ offsetBorder = {};
+ _ref6 = ['Top', 'Left', 'Bottom', 'Right'];
+ for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
+ side = _ref6[_j];
+ offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle["border" + side + "Width"]);
+ }
+ offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
+ offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
+ if (next.page.top >= (offsetPosition.top + offsetBorder.top) && next.page.bottom >= offsetPosition.bottom) {
+ if (next.page.left >= (offsetPosition.left + offsetBorder.left) && next.page.right >= offsetPosition.right) {
+ scrollTop = offsetParent.scrollTop;
+ scrollLeft = offsetParent.scrollLeft;
+ next.offset = {
+ top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
+ left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
+ };
+ }
+ }
+ }
+ this.move(next);
+ this.history.unshift(next);
+ if (this.history.length > 3) {
+ this.history.pop();
+ }
+ if (flushChanges) {
+ flush();
+ }
+ return true;
+ };
+
+ _Tether.prototype.move = function(position) {
+ var css, elVal, found, key, moved, offsetParent, point, same, transcribe, type, val, write, writeCSS, _i, _len, _ref1, _ref2,
+ _this = this;
+ if (this.element.parentNode == null) {
+ return;
+ }
+ same = {};
+ for (type in position) {
+ same[type] = {};
+ for (key in position[type]) {
+ found = false;
+ _ref1 = this.history;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ point = _ref1[_i];
+ if (!within((_ref2 = point[type]) != null ? _ref2[key] : void 0, position[type][key])) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ same[type][key] = true;
+ }
+ }
+ }
+ css = {
+ top: '',
+ left: '',
+ right: '',
+ bottom: ''
+ };
+ transcribe = function(same, pos) {
+ var xPos, yPos, _ref3;
+ if (((_ref3 = _this.options.optimizations) != null ? _ref3.gpu : void 0) !== false) {
+ if (same.top) {
+ css.top = 0;
+ yPos = pos.top;
+ } else {
+ css.bottom = 0;
+ yPos = -pos.bottom;
+ }
+ if (same.left) {
+ css.left = 0;
+ xPos = pos.left;
+ } else {
+ css.right = 0;
+ xPos = -pos.right;
+ }
+ css[transformKey] = "translateX(" + (Math.round(xPos)) + "px) translateY(" + (Math.round(yPos)) + "px)";
+ if (transformKey !== 'msTransform') {
+ return css[transformKey] += " translateZ(0)";
+ }
+ } else {
+ if (same.top) {
+ css.top = "" + pos.top + "px";
+ } else {
+ css.bottom = "" + pos.bottom + "px";
+ }
+ if (same.left) {
+ return css.left = "" + pos.left + "px";
+ } else {
+ return css.right = "" + pos.right + "px";
+ }
+ }
+ };
+ moved = false;
+ if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
+ css.position = 'absolute';
+ transcribe(same.page, position.page);
+ } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
+ css.position = 'fixed';
+ transcribe(same.viewport, position.viewport);
+ } else if ((same.offset != null) && same.offset.top && same.offset.left) {
+ css.position = 'absolute';
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ if (getOffsetParent(this.element) !== offsetParent) {
+ defer(function() {
+ _this.element.parentNode.removeChild(_this.element);
+ return offsetParent.appendChild(_this.element);
+ });
+ }
+ transcribe(same.offset, position.offset);
+ moved = true;
+ } else {
+ css.position = 'absolute';
+ transcribe({
+ top: true,
+ left: true
+ }, position.page);
+ }
+ if (!moved && this.element.parentNode.tagName !== 'BODY') {
+ this.element.parentNode.removeChild(this.element);
+ document.body.appendChild(this.element);
+ }
+ writeCSS = {};
+ write = false;
+ for (key in css) {
+ val = css[key];
+ elVal = this.element.style[key];
+ if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) {
+ elVal = parseFloat(elVal);
+ val = parseFloat(val);
+ }
+ if (elVal !== val) {
+ write = true;
+ writeCSS[key] = css[key];
+ }
+ }
+ if (write) {
+ return defer(function() {
+ return extend(_this.element.style, writeCSS);
+ });
+ }
+ };
+
+ return _Tether;
+
+ })();
+
+ Tether.position = position;
+
+ this.Tether = extend(_Tether, Tether);
+
+}).call(this);
+
+(function() {
+ var BOUNDS_FORMAT, MIRROR_ATTACH, defer, extend, getBoundingRect, getBounds, getOuterSize, getSize, updateClasses, _ref,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+
+ _ref = this.Tether.Utils, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getSize = _ref.getSize, extend = _ref.extend, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ MIRROR_ATTACH = {
+ left: 'right',
+ right: 'left',
+ top: 'bottom',
+ bottom: 'top',
+ middle: 'middle'
+ };
+
+ BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
+
+ getBoundingRect = function(tether, to) {
+ var i, pos, side, size, style, _i, _len;
+ if (to === 'scrollParent') {
+ to = tether.scrollParent;
+ } else if (to === 'window') {
+ to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
+ }
+ if (to === document) {
+ to = to.documentElement;
+ }
+ if (to.nodeType != null) {
+ pos = size = getBounds(to);
+ style = getComputedStyle(to);
+ to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
+ for (i = _i = 0, _len = BOUNDS_FORMAT.length; _i < _len; i = ++_i) {
+ side = BOUNDS_FORMAT[i];
+ side = side[0].toUpperCase() + side.substr(1);
+ if (side === 'Top' || side === 'Left') {
+ to[i] += parseFloat(style["border" + side + "Width"]);
+ } else {
+ to[i] -= parseFloat(style["border" + side + "Width"]);
+ }
+ }
+ }
+ return to;
+ };
+
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var addClasses, allClasses, attachment, bounds, changeAttachX, changeAttachY, cls, constraint, eAttachment, height, left, oob, oobClass, p, pin, pinned, pinnedClass, removeClass, side, tAttachment, targetAttachment, targetHeight, targetSize, targetWidth, to, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8,
+ _this = this;
+ top = _arg.top, left = _arg.left, targetAttachment = _arg.targetAttachment;
+ if (!this.options.constraints) {
+ return true;
+ }
+ removeClass = function(prefix) {
+ var side, _i, _len, _results;
+ _this.removeClass(prefix);
+ _results = [];
+ for (_i = 0, _len = BOUNDS_FORMAT.length; _i < _len; _i++) {
+ side = BOUNDS_FORMAT[_i];
+ _results.push(_this.removeClass("" + prefix + "-" + side));
+ }
+ return _results;
+ };
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref2 = this.lastSize, width = _ref2.width, height = _ref2.height;
+ }
+ targetSize = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ targetHeight = targetSize.height;
+ targetWidth = targetSize.width;
+ tAttachment = {};
+ eAttachment = {};
+ allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
+ _ref3 = this.options.constraints;
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ constraint = _ref3[_i];
+ if (constraint.outOfBoundsClass) {
+ allClasses.push(constraint.outOfBoundsClass);
+ }
+ if (constraint.pinnedClass) {
+ allClasses.push(constraint.pinnedClass);
+ }
+ }
+ for (_j = 0, _len1 = allClasses.length; _j < _len1; _j++) {
+ cls = allClasses[_j];
+ _ref4 = ['left', 'top', 'right', 'bottom'];
+ for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
+ side = _ref4[_k];
+ allClasses.push("" + cls + "-" + side);
+ }
+ }
+ addClasses = [];
+ tAttachment = extend({}, targetAttachment);
+ eAttachment = extend({}, this.attachment);
+ _ref5 = this.options.constraints;
+ for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) {
+ constraint = _ref5[_l];
+ to = constraint.to, attachment = constraint.attachment, pin = constraint.pin;
+ if (attachment == null) {
+ attachment = '';
+ }
+ if (__indexOf.call(attachment, ' ') >= 0) {
+ _ref6 = attachment.split(' '), changeAttachY = _ref6[0], changeAttachX = _ref6[1];
+ } else {
+ changeAttachX = changeAttachY = attachment;
+ }
+ bounds = getBoundingRect(this, to);
+ if (changeAttachY === 'target' || changeAttachY === 'both') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ }
+ }
+ if (changeAttachY === 'together') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ if (eAttachment.top === 'bottom') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top += height;
+ eAttachment.top = 'top';
+ } else if (eAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ if (eAttachment.top === 'top') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (eAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ if (tAttachment.top === 'middle') {
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ }
+ if (changeAttachX === 'target' || changeAttachX === 'both') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ }
+ if (left + width > bounds[2] && tAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ }
+ }
+ if (changeAttachX === 'together') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ if (eAttachment.left === 'right') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left += width;
+ eAttachment.left = 'left';
+ } else if (eAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ } else if (left + width > bounds[2] && tAttachment.left === 'right') {
+ if (eAttachment.left === 'left') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (eAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left += width;
+ eAttachment.left = 'left';
+ }
+ } else if (tAttachment.left === 'center') {
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ }
+ }
+ if (changeAttachY === 'element' || changeAttachY === 'both') {
+ if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (changeAttachX === 'element' || changeAttachX === 'both') {
+ if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ }
+ if (typeof pin === 'string') {
+ pin = (function() {
+ var _len4, _m, _ref7, _results;
+ _ref7 = pin.split(',');
+ _results = [];
+ for (_m = 0, _len4 = _ref7.length; _m < _len4; _m++) {
+ p = _ref7[_m];
+ _results.push(p.trim());
+ }
+ return _results;
+ })();
+ } else if (pin === true) {
+ pin = ['top', 'left', 'right', 'bottom'];
+ }
+ pin || (pin = []);
+ pinned = [];
+ oob = [];
+ if (top < bounds[1]) {
+ if (__indexOf.call(pin, 'top') >= 0) {
+ top = bounds[1];
+ pinned.push('top');
+ } else {
+ oob.push('top');
+ }
+ }
+ if (top + height > bounds[3]) {
+ if (__indexOf.call(pin, 'bottom') >= 0) {
+ top = bounds[3] - height;
+ pinned.push('bottom');
+ } else {
+ oob.push('bottom');
+ }
+ }
+ if (left < bounds[0]) {
+ if (__indexOf.call(pin, 'left') >= 0) {
+ left = bounds[0];
+ pinned.push('left');
+ } else {
+ oob.push('left');
+ }
+ }
+ if (left + width > bounds[2]) {
+ if (__indexOf.call(pin, 'right') >= 0) {
+ left = bounds[2] - width;
+ pinned.push('right');
+ } else {
+ oob.push('right');
+ }
+ }
+ if (pinned.length) {
+ pinnedClass = (_ref7 = this.options.pinnedClass) != null ? _ref7 : this.getClass('pinned');
+ addClasses.push(pinnedClass);
+ for (_m = 0, _len4 = pinned.length; _m < _len4; _m++) {
+ side = pinned[_m];
+ addClasses.push("" + pinnedClass + "-" + side);
+ }
+ }
+ if (oob.length) {
+ oobClass = (_ref8 = this.options.outOfBoundsClass) != null ? _ref8 : this.getClass('out-of-bounds');
+ addClasses.push(oobClass);
+ for (_n = 0, _len5 = oob.length; _n < _len5; _n++) {
+ side = oob[_n];
+ addClasses.push("" + oobClass + "-" + side);
+ }
+ }
+ if (__indexOf.call(pinned, 'left') >= 0 || __indexOf.call(pinned, 'right') >= 0) {
+ eAttachment.left = tAttachment.left = false;
+ }
+ if (__indexOf.call(pinned, 'top') >= 0 || __indexOf.call(pinned, 'bottom') >= 0) {
+ eAttachment.top = tAttachment.top = false;
+ }
+ if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== this.attachment.top || eAttachment.left !== this.attachment.left) {
+ this.updateAttachClasses(eAttachment, tAttachment);
+ }
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+(function() {
+ var defer, getBounds, updateClasses, _ref;
+
+ _ref = this.Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5,
+ _this = this;
+ top = _arg.top, left = _arg.left;
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ targetPos = this.getTargetBounds();
+ bottom = top + height;
+ right = left + width;
+ abutted = [];
+ if (top <= targetPos.bottom && bottom >= targetPos.top) {
+ _ref2 = ['left', 'right'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ side = _ref2[_i];
+ if ((_ref3 = targetPos[side]) === left || _ref3 === right) {
+ abutted.push(side);
+ }
+ }
+ }
+ if (left <= targetPos.right && right >= targetPos.left) {
+ _ref4 = ['top', 'bottom'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) {
+ abutted.push(side);
+ }
+ }
+ }
+ allClasses = [];
+ addClasses = [];
+ sides = ['left', 'top', 'right', 'bottom'];
+ allClasses.push(this.getClass('abutted'));
+ for (_k = 0, _len2 = sides.length; _k < _len2; _k++) {
+ side = sides[_k];
+ allClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ if (abutted.length) {
+ addClasses.push(this.getClass('abutted'));
+ }
+ for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) {
+ side = abutted[_l];
+ addClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return true;
+ }
+ });
+
+}).call(this);
+
+(function() {
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var left, result, shift, shiftLeft, shiftTop, top, _ref;
+ top = _arg.top, left = _arg.left;
+ if (!this.options.shift) {
+ return;
+ }
+ result = function(val) {
+ if (typeof val === 'function') {
+ return val.call(this, {
+ top: top,
+ left: left
+ });
+ } else {
+ return val;
+ }
+ };
+ shift = result(this.options.shift);
+ if (typeof shift === 'string') {
+ shift = shift.split(' ');
+ shift[1] || (shift[1] = shift[0]);
+ shiftTop = shift[0], shiftLeft = shift[1];
+ shiftTop = parseFloat(shiftTop, 10);
+ shiftLeft = parseFloat(shiftLeft, 10);
+ } else {
+ _ref = [shift.top, shift.left], shiftTop = _ref[0], shiftLeft = _ref[1];
+ }
+ top += shiftTop;
+ left += shiftLeft;
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+return this.Tether;
+
+}));
+
+(function() {
+ var ATTACHMENT, Evented, Shepherd, Step, Tour, addClass, createFromHTML, extend, getBounds, hasClass, matchesSelector, parseShorthand, removeClass, uniqueId, _ref,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ _ref = Tether.Utils, extend = _ref.extend, removeClass = _ref.removeClass, addClass = _ref.addClass, hasClass = _ref.hasClass, Evented = _ref.Evented, getBounds = _ref.getBounds, uniqueId = _ref.uniqueId;
+
+ ATTACHMENT = {
+ 'top': 'top center',
+ 'left': 'middle right',
+ 'right': 'middle left',
+ 'bottom': 'bottom center'
+ };
+
+ createFromHTML = function(html) {
+ var el;
+ el = document.createElement('div');
+ el.innerHTML = html;
+ return el.children[0];
+ };
+
+ matchesSelector = function(el, sel) {
+ var matches, _ref1, _ref2, _ref3, _ref4;
+ matches = (_ref1 = (_ref2 = (_ref3 = (_ref4 = el.matches) != null ? _ref4 : el.matchesSelector) != null ? _ref3 : el.webkitMatchesSelector) != null ? _ref2 : el.mozMatchesSelector) != null ? _ref1 : el.oMatchesSelector;
+ return matches.call(el, sel);
+ };
+
+ parseShorthand = function(obj, props) {
+ var i, out, prop, vals, _i, _len;
+ if (obj == null) {
+ return obj;
+ } else if (typeof obj === 'object') {
+ return obj;
+ } else {
+ vals = obj.split(' ');
+ if (vals.length > props.length) {
+ vals[0] = vals.slice(0, +(vals.length - props.length) + 1 || 9e9).join(' ');
+ vals.splice(1, vals.length - props.length);
+ }
+ out = {};
+ for (i = _i = 0, _len = props.length; _i < _len; i = ++_i) {
+ prop = props[i];
+ out[prop] = vals[i];
+ }
+ return out;
+ }
+ };
+
+ Step = (function(_super) {
+ __extends(Step, _super);
+
+ function Step(tour, options) {
+ this.tour = tour;
+ this.destroy = __bind(this.destroy, this);
+ this.scrollTo = __bind(this.scrollTo, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.isOpen = __bind(this.isOpen, this);
+ this.hide = __bind(this.hide, this);
+ this.show = __bind(this.show, this);
+ this.setOptions(options);
+ this;
+ }
+
+ Step.prototype.setOptions = function(options) {
+ var event, handler, _base, _ref1;
+ this.options = options != null ? options : {};
+ this.destroy();
+ this.id = this.options.id || this.id || ("step-" + (uniqueId()));
+ if (this.options.when) {
+ _ref1 = this.options.when;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ this.on(event, handler, this);
+ }
+ }
+ return (_base = this.options).buttons != null ? (_base = this.options).buttons : _base.buttons = [
+ {
+ text: 'Next',
+ action: this.tour.next
+ }
+ ];
+ };
+
+ Step.prototype.getTour = function() {
+ return this.tour;
+ };
+
+ Step.prototype.bindAdvance = function() {
+ var event, handler, selector, _ref1,
+ _this = this;
+ _ref1 = parseShorthand(this.options.advanceOn, ['selector', 'event']), event = _ref1.event, selector = _ref1.selector;
+ handler = function(e) {
+ if (!_this.isOpen()) {
+ return;
+ }
+ if (selector != null) {
+ if (matchesSelector(e.target, selector)) {
+ return _this.tour.next();
+ }
+ } else {
+ if (_this.el && e.target === _this.el) {
+ return _this.tour.next();
+ }
+ }
+ };
+ document.body.addEventListener(event, handler);
+ return this.on('destroy', function() {
+ return document.body.removeEventListener(event, handler);
+ });
+ };
+
+ Step.prototype.getAttachTo = function() {
+ var opts;
+ opts = parseShorthand(this.options.attachTo, ['element', 'on']);
+ if (opts == null) {
+ opts = {};
+ }
+ if (typeof opts.element === 'string') {
+ opts.element = document.querySelector(opts.element);
+ if (opts.element == null) {
+ throw new Error("Shepherd step's attachTo was not found in the page");
+ }
+ }
+ return opts;
+ };
+
+ Step.prototype.setupTether = function() {
+ var attachment, opts, tetherOpts;
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("Using the attachment feature of Shepherd requires the Tether library");
+ }
+ opts = this.getAttachTo();
+ attachment = ATTACHMENT[opts.on || 'right'];
+ if (opts.element == null) {
+ opts.element = 'viewport';
+ attachment = 'middle center';
+ }
+ tetherOpts = {
+ classPrefix: 'shepherd',
+ element: this.el,
+ constraints: [
+ {
+ to: 'window',
+ pin: true,
+ attachment: 'together'
+ }
+ ],
+ target: opts.element,
+ offset: opts.offset || '0 0',
+ attachment: attachment
+ };
+ return this.tether = new Tether(extend(tetherOpts, this.options.tetherOptions));
+ };
+
+ Step.prototype.show = function() {
+ var _this = this;
+ if (this.el == null) {
+ this.render();
+ }
+ addClass(this.el, 'shepherd-open');
+ this.setupTether();
+ if (this.options.scrollTo) {
+ setTimeout(function() {
+ return _this.scrollTo();
+ });
+ }
+ return this.trigger('show');
+ };
+
+ Step.prototype.hide = function() {
+ var _ref1;
+ removeClass(this.el, 'shepherd-open');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ this.tether = null;
+ return this.trigger('hide');
+ };
+
+ Step.prototype.isOpen = function() {
+ return hasClass(this.el, 'shepherd-open');
+ };
+
+ Step.prototype.cancel = function() {
+ this.hide();
+ return this.trigger('cancel');
+ };
+
+ Step.prototype.complete = function() {
+ this.hide();
+ return this.trigger('complete');
+ };
+
+ Step.prototype.scrollTo = function() {
+ var element;
+ element = this.getAttachTo().element;
+ return element != null ? element.scrollIntoView() : void 0;
+ };
+
+ Step.prototype.destroy = function() {
+ var _ref1;
+ if (this.el != null) {
+ document.body.removeChild(this.el);
+ delete this.el;
+ }
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ this.tether = null;
+ return this.trigger('destroy');
+ };
+
+ Step.prototype.render = function() {
+ var button, buttons, cfg, content, footer, header, paragraph, paragraphs, text, _i, _j, _len, _len1, _ref1, _ref2, _ref3;
+ if (this.el != null) {
+ this.destroy();
+ }
+ this.el = createFromHTML("");
+ content = document.createElement('div');
+ content.className = 'shepherd-content';
+ this.el.appendChild(content);
+ if (this.options.title != null) {
+ header = document.createElement('header');
+ header.innerHTML = "" + this.options.title + "
";
+ this.el.className += ' shepherd-has-title';
+ content.appendChild(header);
+ }
+ if (this.options.text != null) {
+ text = createFromHTML("");
+ paragraphs = this.options.text;
+ if (typeof paragraphs === 'string') {
+ paragraphs = [paragraphs];
+ }
+ for (_i = 0, _len = paragraphs.length; _i < _len; _i++) {
+ paragraph = paragraphs[_i];
+ text.innerHTML += "" + paragraph + "
";
+ }
+ content.appendChild(text);
+ }
+ footer = document.createElement('footer');
+ if (this.options.buttons) {
+ buttons = createFromHTML("");
+ _ref2 = this.options.buttons;
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
+ cfg = _ref2[_j];
+ button = createFromHTML("" + cfg.text + "");
+ buttons.appendChild(button);
+ this.bindButtonEvents(cfg, button.querySelector('a'));
+ }
+ footer.appendChild(buttons);
+ }
+ content.appendChild(footer);
+ document.body.appendChild(this.el);
+ this.setupTether();
+ if (this.options.advanceOn) {
+ return this.bindAdvance();
+ }
+ };
+
+ Step.prototype.bindButtonEvents = function(cfg, el) {
+ var event, handler, page, _ref1,
+ _this = this;
+ if (cfg.events == null) {
+ cfg.events = {};
+ }
+ if (cfg.action != null) {
+ cfg.events.click = cfg.action;
+ }
+ _ref1 = cfg.events;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ if (typeof handler === 'string') {
+ page = handler;
+ handler = function() {
+ return _this.tour.show(page);
+ };
+ }
+ el.addEventListener(event, handler);
+ }
+ return this.on('destroy', function() {
+ var _ref2, _results;
+ _ref2 = cfg.events;
+ _results = [];
+ for (event in _ref2) {
+ handler = _ref2[event];
+ _results.push(el.removeEventListener(event, handler));
+ }
+ return _results;
+ });
+ };
+
+ return Step;
+
+ })(Evented);
+
+ Tour = (function(_super) {
+ __extends(Tour, _super);
+
+ function Tour(options) {
+ var event, _i, _len, _ref1, _ref2,
+ _this = this;
+ this.options = options != null ? options : {};
+ this.hide = __bind(this.hide, this);
+ this.cancel = __bind(this.cancel, this);
+ this.back = __bind(this.back, this);
+ this.next = __bind(this.next, this);
+ this.steps = (_ref1 = this.options.steps) != null ? _ref1 : [];
+ _ref2 = ['complete', 'cancel', 'hide', 'start', 'show'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ event = _ref2[_i];
+ this.on(event, function(opts) {
+ if (opts == null) {
+ opts = {};
+ }
+ opts.tour = _this;
+ return Shepherd.trigger(event, opts);
+ });
+ }
+ this;
+ }
+
+ Tour.prototype.addStep = function(name, step) {
+ var _ref1;
+ if (step == null) {
+ step = name;
+ }
+ if (!(step instanceof Step)) {
+ if ((_ref1 = typeof name) === 'string' || _ref1 === 'number') {
+ step.id = name.toString();
+ }
+ step = extend({}, this.options.defaults, step);
+ step = new Step(this, step);
+ } else {
+ step.tour = this;
+ }
+ this.steps.push(step);
+ return step;
+ };
+
+ Tour.prototype.getById = function(id) {
+ var step, _i, _len, _ref1;
+ _ref1 = this.steps;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ step = _ref1[_i];
+ if (step.id === id) {
+ return step;
+ }
+ }
+ };
+
+ Tour.prototype.getCurrentStep = function() {
+ return this.currentStep;
+ };
+
+ Tour.prototype.next = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ if (index === this.steps.length - 1) {
+ this.hide(index);
+ this.trigger('complete');
+ return this.done();
+ } else {
+ return this.show(index + 1);
+ }
+ };
+
+ Tour.prototype.back = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ return this.show(index - 1);
+ };
+
+ Tour.prototype.cancel = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.cancel();
+ }
+ this.trigger('cancel');
+ return this.done();
+ };
+
+ Tour.prototype.hide = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('hide');
+ return this.done();
+ };
+
+ Tour.prototype.done = function() {
+ return Shepherd.activeTour = null;
+ };
+
+ Tour.prototype.show = function(key) {
+ var next;
+ if (key == null) {
+ key = 0;
+ }
+ if (this.currentStep) {
+ this.currentStep.hide();
+ }
+ Shepherd.activeTour = this;
+ if (typeof key === 'string') {
+ next = this.getById(key);
+ } else {
+ next = this.steps[key];
+ }
+ if (next) {
+ this.trigger('show', {
+ step: next,
+ previous: this.currentStep
+ });
+ this.currentStep = next;
+ return next.show();
+ }
+ };
+
+ Tour.prototype.start = function() {
+ this.trigger('start');
+ this.currentStep = null;
+ return this.next();
+ };
+
+ return Tour;
+
+ })(Evented);
+
+ Shepherd = new Evented;
+
+ extend(Shepherd, {
+ Tour: Tour,
+ Step: Step,
+ Evented: Evented
+ });
+
+ window.Shepherd = Shepherd;
+
+}).call(this);
diff --git a/ajax/libs/shepherd/0.4.7/shepherd.min.js b/ajax/libs/shepherd/0.4.7/shepherd.min.js
new file mode 100644
index 000000000..0bbd94182
--- /dev/null
+++ b/ajax/libs/shepherd/0.4.7/shepherd.min.js
@@ -0,0 +1,2 @@
+/*! shepherd 0.4.7 */
+!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e(require,exports,module):t.Tether=e()}(this,function(){return function(){var t,e,o,i,n,s,r,h,l,a,p,u,f,d,c,g,m,v={}.hasOwnProperty,b=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1},y=[].slice;null==this.Tether&&(this.Tether={modules:[]}),p=function(t){var e,o,i,n,s;if(o=getComputedStyle(t).position,"fixed"===o)return t;for(i=void 0,e=t;e=e.parentNode;){try{n=getComputedStyle(e)}catch(r){}if(null==n)return e;if(/(auto|scroll)/.test(n.overflow+n["overflow-y"]+n["overflow-x"])&&("absolute"!==o||"relative"===(s=n.position)||"absolute"===s||"fixed"===s))return e}return document.body},c=function(){var t;return t=0,function(){return t++}}(),m={},l=function(t){var e,i,s,r,h;if(s=t._tetherZeroElement,null==s&&(s=t.createElement("div"),s.setAttribute("data-tether-id",c()),n(s.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(s),t._tetherZeroElement=s),e=s.getAttribute("data-tether-id"),null==m[e]){m[e]={},h=s.getBoundingClientRect();for(i in h)r=h[i],m[e][i]=r;o(function(){return m[e]=void 0})}return m[e]},f=null,r=function(t){var e,o,i,n,s,r,h;t===document?(o=document,t=document.documentElement):o=t.ownerDocument,i=o.documentElement,e={},h=t.getBoundingClientRect();for(n in h)r=h[n],e[n]=r;return s=l(o),e.top-=s.top,e.left-=s.left,null==e.width&&(e.width=document.body.scrollWidth-e.left-e.right),null==e.height&&(e.height=document.body.scrollHeight-e.top-e.bottom),e.top=e.top-i.clientTop,e.left=e.left-i.clientLeft,e.right=o.body.clientWidth-e.width-e.left,e.bottom=o.body.clientHeight-e.height-e.top,e},h=function(t){return t.offsetParent||document.documentElement},a=function(){var t,e,o,i,s;return t=document.createElement("div"),t.style.width="100%",t.style.height="200px",e=document.createElement("div"),n(e.style,{position:"absolute",top:0,left:0,pointerEvents:"none",visibility:"hidden",width:"200px",height:"150px",overflow:"hidden"}),e.appendChild(t),document.body.appendChild(e),i=t.offsetWidth,e.style.overflow="scroll",s=t.offsetWidth,i===s&&(s=e.clientWidth),document.body.removeChild(e),o=i-s,{width:o,height:o}},n=function(t){var e,o,i,n,s,r,h;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),h=e.slice(1),s=0,r=h.length;r>s;s++)if(i=h[s])for(o in i)v.call(i,o)&&(n=i[o],t[o]=n);return t},d=function(t,e){var o,i,n,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],i=0,n=s.length;n>i;i++)o=s[i],o.trim()&&r.push(t.classList.remove(o));return r}return t.className=t.className.replace(new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi")," ")},e=function(t,e){var o,i,n,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],i=0,n=s.length;n>i;i++)o=s[i],o.trim()&&r.push(t.classList.add(o));return r}return d(t,e),t.className+=" "+e},u=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},g=function(t,o,i){var n,s,r,h,l,a;for(s=0,h=i.length;h>s;s++)n=i[s],b.call(o,n)<0&&u(t,n)&&d(t,n);for(a=[],r=0,l=o.length;l>r;r++)n=o[r],a.push(u(t,n)?void 0:e(t,n));return a},i=[],o=function(t){return i.push(t)},s=function(){var t,e;for(e=[];t=i.pop();)e.push(t());return e},t=function(){function t(){}return t.prototype.on=function(t,e,o,i){var n;return null==i&&(i=!1),null==this.bindings&&(this.bindings={}),null==(n=this.bindings)[t]&&(n[t]=[]),this.bindings[t].push({handler:e,ctx:o,once:i})},t.prototype.once=function(t,e,o){return this.on(t,e,o,!0)},t.prototype.off=function(t,e){var o,i,n;if(null!=(null!=(i=this.bindings)?i[t]:void 0)){if(null==e)return delete this.bindings[t];for(o=0,n=[];o=e&&e>=t-o},x=function(){var t,e,o,i,n;for(t=document.createElement("div"),n=["transform","webkitTransform","OTransform","MozTransform","msTransform"],o=0,i=n.length;i>o;o++)if(e=n[o],void 0!==t.style[e])return e}(),O=[],C=function(){var t,e,o;for(e=0,o=O.length;o>e;e++)t=O[e],t.position(!1);return p()},v=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance.now():void 0)?t:+new Date},function(){var t,e,o,i,n,s,r,h,l;for(e=null,o=null,i=null,n=function(){if(null!=o&&o>16)return o=Math.min(o-16,250),void(i=setTimeout(n,250));if(!(null!=e&&v()-e<10))return null!=i&&(clearTimeout(i),i=null),e=v(),C(),o=v()-e},h=["resize","scroll","touchmove"],l=[],s=0,r=h.length;r>s;s++)t=h[s],l.push(window.addEventListener(t,n));return l}(),t={center:"center",left:"right",right:"left"},e={middle:"middle",top:"bottom",bottom:"top"},o={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},h=function(o,i){var n,s;return n=o.left,s=o.top,"auto"===n&&(n=t[i.left]),"auto"===s&&(s=e[i.top]),{left:n,top:s}},r=function(t){var e,i;return{left:null!=(e=o[t.left])?e:t.left,top:null!=(i=o[t.top])?i:t.top}},s=function(){var t,e,o,i,n,s,r;for(e=1<=arguments.length?B.call(arguments,0):[],o={top:0,left:0},n=0,s=e.length;s>n;n++)r=e[n],i=r.top,t=r.left,"string"==typeof i&&(i=parseFloat(i,10)),"string"==typeof t&&(t=parseFloat(t,10)),o.top+=i,o.left+=t;return o},b=function(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t},y=w=function(t){var e,o,i;return i=t.split(" "),o=i[0],e=i[1],{top:o,left:e}},A=function(){function t(t){this.position=W(this.position,this);var e,o,n,s,r;for(O.push(this),this.history=[],this.setOptions(t,!1),s=i.modules,o=0,n=s.length;n>o;o++)e=s[o],null!=(r=e.initialize)&&r.call(this);this.position()}return t.modules=[],t.prototype.getClass=function(t){var e,o;return(null!=(e=this.options.classes)?e[t]:void 0)?this.options.classes[t]:(null!=(o=this.options.classes)?o[t]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+t:t:""},t.prototype.setOptions=function(t,e){var o,i,s,r,h,l;for(this.options=t,null==e&&(e=!0),o={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=a(o,this.options),h=this.options,this.element=h.element,this.target=h.target,this.targetModifier=h.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),l=["element","target"],s=0,r=l.length;r>s;s++){if(i=l[s],null==this[i])throw new Error("Tether Error: Both element and target must be defined");null!=this[i].jquery?this[i]=this[i][0]:"string"==typeof this[i]&&(this[i]=document.querySelector(this[i]))}if(n(this.element,this.getClass("element")),n(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=y(this.options.targetAttachment),this.attachment=y(this.options.attachment),this.offset=w(this.options.offset),this.targetOffset=w(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent="scroll-handle"===this.targetModifier?this.target:g(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,o,i,n,s,r,h,l;if(null==this.targetModifier)return u(this.target);switch(this.targetModifier){case"visible":return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:(t=u(this.target),n={height:t.height,width:t.width,top:t.top,left:t.left},n.height=Math.min(n.height,t.height-(pageYOffset-t.top)),n.height=Math.min(n.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),n.height=Math.min(innerHeight,n.height),n.height-=2,n.width=Math.min(n.width,t.width-(pageXOffset-t.left)),n.width=Math.min(n.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),n.width=Math.min(innerWidth,n.width),n.width-=2,n.topl.clientWidth||"scroll"===[h.overflow,h.overflowX]||this.target!==document.body,s=0,o&&(s=15),i=t.height-parseFloat(h.borderTopWidth)-parseFloat(h.borderBottomWidth)-s,n={width:15,height:.975*i*(i/l.scrollHeight),left:t.left+t.width-parseFloat(h.borderLeftWidth)-15},e=0,408>i&&this.target===document.body&&(e=-11e-5*Math.pow(i,2)-.00727*i+22.58),this.target!==document.body&&(n.height=Math.max(n.height,24)),r=this.target.scrollTop/(l.scrollHeight-i),n.top=r*(i-n.height-e)+t.top+parseFloat(h.borderTopWidth),this.target===document.body&&(n.height=Math.max(n.height,24)),n}},t.prototype.clearCache=function(){return this._cache={}},t.prototype.cache=function(t,e){return null==this._cache&&(this._cache={}),null==this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},t.prototype.enable=function(t){return null==t&&(t=!0),n(this.target,this.getClass("enabled")),n(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t?this.position():void 0},t.prototype.disable=function(){return T(this.target,this.getClass("enabled")),T(this.element,this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},t.prototype.destroy=function(){var t,e,o,i,n;for(this.disable(),n=[],t=o=0,i=O.length;i>o;t=++o){if(e=O[t],e===this){O.splice(t,1);break}n.push(void 0)}return n},t.prototype.updateAttachClasses=function(t,e){var o,i,n,s,r,h,a,p,u,f=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),s=["left","top","bottom","right","middle","center"],(null!=(u=this._addAttachClasses)?u.length:void 0)&&this._addAttachClasses.splice(0,this._addAttachClasses.length),o=null!=this._addAttachClasses?this._addAttachClasses:this._addAttachClasses=[],t.top&&o.push(""+this.getClass("element-attached")+"-"+t.top),t.left&&o.push(""+this.getClass("element-attached")+"-"+t.left),e.top&&o.push(""+this.getClass("target-attached")+"-"+e.top),e.left&&o.push(""+this.getClass("target-attached")+"-"+e.left),i=[],r=0,a=s.length;a>r;r++)n=s[r],i.push(""+this.getClass("element-attached")+"-"+n);for(h=0,p=s.length;p>h;h++)n=s[h],i.push(""+this.getClass("target-attached")+"-"+n);return l(function(){return null!=f._addAttachClasses?(S(f.element,f._addAttachClasses,i),S(f.target,f._addAttachClasses,i),f._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,o,n,l,a,d,g,m,v,y,w,C,T,O,x,S,E,A,M,B,W,L,_,P,z,H,F,Y,N,X,j,k,q,U,I,R=this;if(null==t&&(t=!0),this.enabled){for(this.clearCache(),B=h(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,B),e=this.cache("element-bounds",function(){return u(R.element)}),z=e.width,n=e.height,0===z&&0===n&&null!=this.lastSize?(X=this.lastSize,z=X.width,n=X.height):this.lastSize={width:z,height:n},_=L=this.cache("target-bounds",function(){return R.getTargetBounds()}),v=b(r(this.attachment),{width:z,height:n}),W=b(r(B),_),a=b(this.offset,{width:z,height:n}),d=b(this.targetOffset,_),v=s(v,a),W=s(W,d),l=L.left+W.left-v.left,P=L.top+W.top-v.top,j=i.modules,H=0,Y=j.length;Y>H;H++)if(g=j[H],x=g.position.call(this,{left:l,top:P,targetAttachment:B,targetPos:L,attachment:this.attachment,elementPos:e,offset:v,targetOffset:W,manualOffset:a,manualTargetOffset:d,scrollbarSize:A}),null!=x&&"object"==typeof x){if(x===!1)return!1;P=x.top,l=x.left}if(m={page:{top:P,left:l},viewport:{top:P-pageYOffset,bottom:pageYOffset-P-n+innerHeight,left:l-pageXOffset,right:pageXOffset-l-z+innerWidth}},document.body.scrollWidth>window.innerWidth&&(A=this.cache("scrollbar-size",c),m.viewport.bottom-=A.height),document.body.scrollHeight>window.innerHeight&&(A=this.cache("scrollbar-size",c),m.viewport.right-=A.width),(""!==(k=document.body.style.position)&&"static"!==k||""!==(q=document.body.parentElement.style.position)&&"static"!==q)&&(m.page.bottom=document.body.scrollHeight-P-n,m.page.right=document.body.scrollWidth-l-z),(null!=(U=this.options.optimizations)?U.moveElement:void 0)!==!1&&null==this.targetModifier){for(w=this.cache("target-offsetparent",function(){return f(R.target)}),O=this.cache("target-offsetparent-bounds",function(){return u(w)}),T=getComputedStyle(w),o=getComputedStyle(this.element),C=O,y={},I=["Top","Left","Bottom","Right"],F=0,N=I.length;N>F;F++)M=I[F],y[M.toLowerCase()]=parseFloat(T["border"+M+"Width"]);O.right=document.body.scrollWidth-O.left-C.width+y.right,O.bottom=document.body.scrollHeight-O.top-C.height+y.bottom,m.page.top>=O.top+y.top&&m.page.bottom>=O.bottom&&m.page.left>=O.left+y.left&&m.page.right>=O.right&&(E=w.scrollTop,S=w.scrollLeft,m.offset={top:m.page.top-O.top+E-y.top,left:m.page.left-O.left+S-y.left})}return this.move(m),this.history.unshift(m),this.history.length>3&&this.history.pop(),t&&p(),!0}},t.prototype.move=function(t){var e,o,i,n,s,r,h,p,u,d,c,g,m,v,b,y,w,C=this;if(null!=this.element.parentNode){p={};for(d in t){p[d]={};for(n in t[d]){for(i=!1,y=this.history,v=0,b=y.length;b>v;v++)if(h=y[v],!E(null!=(w=h[d])?w[n]:void 0,t[d][n])){i=!0;break}i||(p[d][n]=!0)}}e={top:"",left:"",right:"",bottom:""},u=function(t,o){var i,n,s;return(null!=(s=C.options.optimizations)?s.gpu:void 0)===!1?(t.top?e.top=""+o.top+"px":e.bottom=""+o.bottom+"px",t.left?e.left=""+o.left+"px":e.right=""+o.right+"px"):(t.top?(e.top=0,n=o.top):(e.bottom=0,n=-o.bottom),t.left?(e.left=0,i=o.left):(e.right=0,i=-o.right),e[x]="translateX("+Math.round(i)+"px) translateY("+Math.round(n)+"px)","msTransform"!==x?e[x]+=" translateZ(0)":void 0)},s=!1,(p.page.top||p.page.bottom)&&(p.page.left||p.page.right)?(e.position="absolute",u(p.page,t.page)):(p.viewport.top||p.viewport.bottom)&&(p.viewport.left||p.viewport.right)?(e.position="fixed",u(p.viewport,t.viewport)):null!=p.offset&&p.offset.top&&p.offset.left?(e.position="absolute",r=this.cache("target-offsetparent",function(){return f(C.target)}),f(this.element)!==r&&l(function(){return C.element.parentNode.removeChild(C.element),r.appendChild(C.element)}),u(p.offset,t.offset),s=!0):(e.position="absolute",u({top:!0,left:!0},t.page)),s||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),m={},g=!1;for(n in e)c=e[n],o=this.element.style[n],""===o||""===c||"top"!==n&&"left"!==n&&"bottom"!==n&&"right"!==n||(o=parseFloat(o),c=parseFloat(c)),o!==c&&(g=!0,m[n]=e[n]);return g?l(function(){return a(C.element.style,m)}):void 0}},t}(),i.position=C,this.Tether=a(A,i)}.call(this),function(){var t,e,o,i,n,s,r,h,l,a,p=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1};a=this.Tether.Utils,r=a.getOuterSize,s=a.getBounds,h=a.getSize,i=a.extend,l=a.updateClasses,o=a.defer,e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},t=["left","top","right","bottom"],n=function(e,o){var i,n,r,h,l,a,p;if("scrollParent"===o?o=e.scrollParent:"window"===o&&(o=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),o===document&&(o=o.documentElement),null!=o.nodeType)for(n=h=s(o),l=getComputedStyle(o),o=[n.left,n.top,h.width+n.left,h.height+n.top],i=a=0,p=t.length;p>a;i=++a)r=t[i],r=r[0].toUpperCase()+r.substr(1),"Top"===r||"Left"===r?o[i]+=parseFloat(l["border"+r+"Width"]):o[i]-=parseFloat(l["border"+r+"Width"]);return o},this.Tether.modules.push({position:function(e){var r,h,a,u,f,d,c,g,m,v,b,y,w,C,T,O,x,S,E,A,M,B,W,L,_,P,z,H,F,Y,N,X,j,k,q,U,I,R,D,Z,$,V,G,J,K,Q,te,ee=this;if(P=e.top,b=e.left,M=e.targetAttachment,!this.options.constraints)return!0;for(S=function(e){var o,i,n,s;for(ee.removeClass(e),s=[],i=0,n=t.length;n>i;i++)o=t[i],s.push(ee.removeClass(""+e+"-"+o));return s},Z=this.cache("element-bounds",function(){return s(ee.element)}),v=Z.height,z=Z.width,0===z&&0===v&&null!=this.lastSize&&($=this.lastSize,z=$.width,v=$.height),W=this.cache("target-bounds",function(){return ee.getTargetBounds()}),B=W.height,L=W.width,A={},m={},h=[this.getClass("pinned"),this.getClass("out-of-bounds")],V=this.options.constraints,H=0,X=V.length;X>H;H++)g=V[H],g.outOfBoundsClass&&h.push(g.outOfBoundsClass),g.pinnedClass&&h.push(g.pinnedClass);for(F=0,j=h.length;j>F;F++)for(c=h[F],G=["left","top","right","bottom"],Y=0,k=G.length;k>Y;Y++)E=G[Y],h.push(""+c+"-"+E);for(r=[],A=i({},M),m=i({},this.attachment),J=this.options.constraints,N=0,q=J.length;q>N;N++){if(g=J[N],_=g.to,a=g.attachment,T=g.pin,null==a&&(a=""),p.call(a," ")>=0?(K=a.split(" "),d=K[0],f=K[1]):f=d=a,u=n(this,_),("target"===d||"both"===d)&&(Pu[3]&&"bottom"===A.top&&(P-=B,A.top="top")),"together"===d&&(Pu[3]&&"bottom"===A.top&&("top"===m.top?(P-=B,A.top="top",P-=v,m.top="bottom"):"bottom"===m.top&&(P-=B,A.top="top",P+=v,m.top="top")),"middle"===A.top&&(P+v>u[3]&&"top"===m.top?(P-=v,m.top="bottom"):Pu[2]&&"right"===A.left&&(b-=L,A.left="left")),"together"===f&&(bu[2]&&"right"===A.left?"left"===m.left?(b-=L,A.left="left",b-=z,m.left="right"):"right"===m.left&&(b-=L,A.left="left",b+=z,m.left="left"):"center"===A.left&&(b+z>u[2]&&"left"===m.left?(b-=z,m.left="right"):bu[3]&&"top"===m.top&&(P-=v,m.top="bottom")),("element"===f||"both"===f)&&(bu[2]&&"left"===m.left&&(b-=z,m.left="right")),"string"==typeof T?T=function(){var t,e,o,i;for(o=T.split(","),i=[],e=0,t=o.length;t>e;e++)C=o[e],i.push(C.trim());return i}():T===!0&&(T=["top","left","right","bottom"]),T||(T=[]),O=[],y=[],P=0?(P=u[1],O.push("top")):y.push("top")),P+v>u[3]&&(p.call(T,"bottom")>=0?(P=u[3]-v,O.push("bottom")):y.push("bottom")),b=0?(b=u[0],O.push("left")):y.push("left")),b+z>u[2]&&(p.call(T,"right")>=0?(b=u[2]-z,O.push("right")):y.push("right")),O.length)for(x=null!=(Q=this.options.pinnedClass)?Q:this.getClass("pinned"),r.push(x),R=0,U=O.length;U>R;R++)E=O[R],r.push(""+x+"-"+E);if(y.length)for(w=null!=(te=this.options.outOfBoundsClass)?te:this.getClass("out-of-bounds"),r.push(w),D=0,I=y.length;I>D;D++)E=y[D],r.push(""+w+"-"+E);(p.call(O,"left")>=0||p.call(O,"right")>=0)&&(m.left=A.left=!1),(p.call(O,"top")>=0||p.call(O,"bottom")>=0)&&(m.top=A.top=!1),(A.top!==M.top||A.left!==M.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,A)}return o(function(){return l(ee.target,r,h),l(ee.element,r,h)}),{top:P,left:b}}})}.call(this),function(){var t,e,o,i;i=this.Tether.Utils,e=i.getBounds,o=i.updateClasses,t=i.defer,this.Tether.modules.push({position:function(i){var n,s,r,h,l,a,p,u,f,d,c,g,m,v,b,y,w,C,T,O,x,S,E,A,M,B=this;if(c=i.top,a=i.left,x=this.cache("element-bounds",function(){return e(B.element)}),l=x.height,g=x.width,d=this.getTargetBounds(),h=c+l,p=a+g,n=[],c<=d.bottom&&h>=d.top)for(S=["left","right"],m=0,w=S.length;w>m;m++)u=S[m],((E=d[u])===a||E===p)&&n.push(u);if(a<=d.right&&p>=d.left)for(A=["top","bottom"],v=0,C=A.length;C>v;v++)u=A[v],((M=d[u])===c||M===h)&&n.push(u);for(r=[],s=[],f=["left","top","right","bottom"],r.push(this.getClass("abutted")),b=0,T=f.length;T>b;b++)u=f[b],r.push(""+this.getClass("abutted")+"-"+u);for(n.length&&s.push(this.getClass("abutted")),y=0,O=n.length;O>y;y++)u=n[y],s.push(""+this.getClass("abutted")+"-"+u);return t(function(){return o(B.target,s,r),o(B.element,s,r)}),!0}})}.call(this),function(){this.Tether.modules.push({position:function(t){var e,o,i,n,s,r,h;return r=t.top,e=t.left,this.options.shift?(o=function(t){return"function"==typeof t?t.call(this,{top:r,left:e}):t},i=o(this.options.shift),"string"==typeof i?(i=i.split(" "),i[1]||(i[1]=i[0]),s=i[0],n=i[1],s=parseFloat(s,10),n=parseFloat(n,10)):(h=[i.top,i.left],s=h[0],n=h[1]),r+=s,e+=n,{top:r,left:e}):void 0}})}.call(this),this.Tether}),function(){var t,e,o,i,n,s,r,h,l,a,p,u,f,d,c,g=function(t,e){return function(){return t.apply(e,arguments)}},m={}.hasOwnProperty,v=function(t,e){function o(){this.constructor=t}for(var i in e)m.call(e,i)&&(t[i]=e[i]);return o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype,t};c=Tether.Utils,h=c.extend,f=c.removeClass,s=c.addClass,a=c.hasClass,e=c.Evented,l=c.getBounds,d=c.uniqueId,t={top:"top center",left:"middle right",right:"middle left",bottom:"bottom center"},r=function(t){var e;return e=document.createElement("div"),e.innerHTML=t,e.children[0]},p=function(t,e){var o,i,n,s,r;return o=null!=(i=null!=(n=null!=(s=null!=(r=t.matches)?r:t.matchesSelector)?s:t.webkitMatchesSelector)?n:t.mozMatchesSelector)?i:t.oMatchesSelector,o.call(t,e)},u=function(t,e){var o,i,n,s,r,h;if(null==t)return t;if("object"==typeof t)return t;for(s=t.split(" "),s.length>e.length&&(s[0]=s.slice(0,+(s.length-e.length)+1||9e9).join(" "),s.splice(1,s.length-e.length)),i={},o=r=0,h=e.length;h>r;o=++r)n=e[o],i[n]=s[o];return i},i=function(e){function o(t,e){this.tour=t,this.destroy=g(this.destroy,this),this.scrollTo=g(this.scrollTo,this),this.complete=g(this.complete,this),this.cancel=g(this.cancel,this),this.isOpen=g(this.isOpen,this),this.hide=g(this.hide,this),this.show=g(this.show,this),this.setOptions(e)}return v(o,e),o.prototype.setOptions=function(t){var e,o,i,n;if(this.options=null!=t?t:{},this.destroy(),this.id=this.options.id||this.id||"step-"+d(),this.options.when){n=this.options.when;for(e in n)o=n[e],this.on(e,o,this)}return null!=(i=this.options).buttons?(i=this.options).buttons:i.buttons=[{text:"Next",action:this.tour.next}]},o.prototype.getTour=function(){return this.tour},o.prototype.bindAdvance=function(){var t,e,o,i,n=this;return i=u(this.options.advanceOn,["selector","event"]),t=i.event,o=i.selector,e=function(t){if(n.isOpen())if(null!=o){if(p(t.target,o))return n.tour.next()}else if(n.el&&t.target===n.el)return n.tour.next()},document.body.addEventListener(t,e),this.on("destroy",function(){return document.body.removeEventListener(t,e)})},o.prototype.getAttachTo=function(){var t;if(t=u(this.options.attachTo,["element","on"]),null==t&&(t={}),"string"==typeof t.element&&(t.element=document.querySelector(t.element),null==t.element))throw new Error("Shepherd step's attachTo was not found in the page");return t},o.prototype.setupTether=function(){var e,o,i;if("undefined"==typeof Tether||null===Tether)throw new Error("Using the attachment feature of Shepherd requires the Tether library");return o=this.getAttachTo(),e=t[o.on||"right"],null==o.element&&(o.element="viewport",e="middle center"),i={classPrefix:"shepherd",element:this.el,constraints:[{to:"window",pin:!0,attachment:"together"}],target:o.element,offset:o.offset||"0 0",attachment:e},this.tether=new Tether(h(i,this.options.tetherOptions))},o.prototype.show=function(){var t=this;return null==this.el&&this.render(),s(this.el,"shepherd-open"),this.setupTether(),this.options.scrollTo&&setTimeout(function(){return t.scrollTo()}),this.trigger("show")},o.prototype.hide=function(){var t;return f(this.el,"shepherd-open"),null!=(t=this.tether)&&t.destroy(),this.tether=null,this.trigger("hide")},o.prototype.isOpen=function(){return a(this.el,"shepherd-open")},o.prototype.cancel=function(){return this.hide(),this.trigger("cancel")},o.prototype.complete=function(){return this.hide(),this.trigger("complete")},o.prototype.scrollTo=function(){var t;return t=this.getAttachTo().element,null!=t?t.scrollIntoView():void 0},o.prototype.destroy=function(){var t;return null!=this.el&&(document.body.removeChild(this.el),delete this.el),null!=(t=this.tether)&&t.destroy(),this.tether=null,this.trigger("destroy")},o.prototype.render=function(){var t,e,o,i,n,s,h,l,a,p,u,f,d,c,g,m;if(null!=this.el&&this.destroy(),this.el=r(""),i=document.createElement("div"),i.className="shepherd-content",this.el.appendChild(i),null!=this.options.title&&(s=document.createElement("header"),s.innerHTML=""+this.options.title+"
",this.el.className+=" shepherd-has-title",i.appendChild(s)),null!=this.options.text){for(a=r(""),l=this.options.text,"string"==typeof l&&(l=[l]),p=0,f=l.length;f>p;p++)h=l[p],a.innerHTML+=""+h+"
";i.appendChild(a)}if(n=document.createElement("footer"),this.options.buttons){for(e=r(""),g=this.options.buttons,u=0,d=g.length;d>u;u++)o=g[u],t=r(""+o.text+""),e.appendChild(t),this.bindButtonEvents(o,t.querySelector("a"));n.appendChild(e)}return i.appendChild(n),document.body.appendChild(this.el),this.setupTether(),this.options.advanceOn?this.bindAdvance():void 0},o.prototype.bindButtonEvents=function(t,e){var o,i,n,s,r=this;null==t.events&&(t.events={}),null!=t.action&&(t.events.click=t.action),s=t.events;for(o in s)i=s[o],"string"==typeof i&&(n=i,i=function(){return r.tour.show(n)}),e.addEventListener(o,i);return this.on("destroy",function(){var n,s;n=t.events,s=[];for(o in n)i=n[o],s.push(e.removeEventListener(o,i));return s})},o}(e),n=function(t){function e(t){var e,i,n,s,r,h=this;for(this.options=null!=t?t:{},this.hide=g(this.hide,this),this.cancel=g(this.cancel,this),this.back=g(this.back,this),this.next=g(this.next,this),this.steps=null!=(s=this.options.steps)?s:[],r=["complete","cancel","hide","start","show"],i=0,n=r.length;n>i;i++)e=r[i],this.on(e,function(t){return null==t&&(t={}),t.tour=h,o.trigger(e,t)})}return v(e,t),e.prototype.addStep=function(t,e){var o;return null==e&&(e=t),e instanceof i?e.tour=this:(("string"==(o=typeof t)||"number"===o)&&(e.id=t.toString()),e=h({},this.options.defaults,e),e=new i(this,e)),this.steps.push(e),e},e.prototype.getById=function(t){var e,o,i,n;for(n=this.steps,o=0,i=n.length;i>o;o++)if(e=n[o],e.id===t)return e},e.prototype.getCurrentStep=function(){return this.currentStep},e.prototype.next=function(){var t;return t=this.steps.indexOf(this.currentStep),t===this.steps.length-1?(this.hide(t),this.trigger("complete"),this.done()):this.show(t+1)},e.prototype.back=function(){var t;return t=this.steps.indexOf(this.currentStep),this.show(t-1)},e.prototype.cancel=function(){var t;return null!=(t=this.currentStep)&&t.cancel(),this.trigger("cancel"),this.done()},e.prototype.hide=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("hide"),this.done()},e.prototype.done=function(){return o.activeTour=null},e.prototype.show=function(t){var e;return null==t&&(t=0),this.currentStep&&this.currentStep.hide(),o.activeTour=this,e="string"==typeof t?this.getById(t):this.steps[t],e?(this.trigger("show",{step:e,previous:this.currentStep}),this.currentStep=e,e.show()):void 0},e.prototype.start=function(){return this.trigger("start"),this.currentStep=null,this.next()},e}(e),o=new e,h(o,{Tour:n,Step:i,Evented:e}),window.Shepherd=o}.call(this);
\ No newline at end of file
diff --git a/ajax/libs/shepherd/0.5.0/shepherd.js b/ajax/libs/shepherd/0.5.0/shepherd.js
new file mode 100644
index 000000000..4988c60dd
--- /dev/null
+++ b/ajax/libs/shepherd/0.5.0/shepherd.js
@@ -0,0 +1,1921 @@
+/*! shepherd 0.5.0 */
+/*! tether 0.6.5 */
+
+
+(function(root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(factory);
+ } else if (typeof exports === 'object') {
+ module.exports = factory(require,exports,module);
+ } else {
+ root.Tether = factory();
+ }
+}(this, function(require,exports,module) {
+
+(function() {
+ var Evented, addClass, defer, deferred, extend, flush, getBounds, getOffsetParent, getOrigin, getScrollBarSize, getScrollParent, hasClass, node, removeClass, uniqueId, updateClasses, zeroPosCache,
+ __hasProp = {}.hasOwnProperty,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
+ __slice = [].slice;
+
+ if (this.Tether == null) {
+ this.Tether = {
+ modules: []
+ };
+ }
+
+ getScrollParent = function(el) {
+ var parent, position, scrollParent, style, _ref;
+ position = getComputedStyle(el).position;
+ if (position === 'fixed') {
+ return el;
+ }
+ scrollParent = void 0;
+ parent = el;
+ while (parent = parent.parentNode) {
+ try {
+ style = getComputedStyle(parent);
+ } catch (_error) {}
+ if (style == null) {
+ return parent;
+ }
+ if (/(auto|scroll)/.test(style['overflow'] + style['overflow-y'] + style['overflow-x'])) {
+ if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) {
+ return parent;
+ }
+ }
+ }
+ return document.body;
+ };
+
+ uniqueId = (function() {
+ var id;
+ id = 0;
+ return function() {
+ return id++;
+ };
+ })();
+
+ zeroPosCache = {};
+
+ getOrigin = function(doc) {
+ var id, k, node, v, _ref;
+ node = doc._tetherZeroElement;
+ if (node == null) {
+ node = doc.createElement('div');
+ node.setAttribute('data-tether-id', uniqueId());
+ extend(node.style, {
+ top: 0,
+ left: 0,
+ position: 'absolute'
+ });
+ doc.body.appendChild(node);
+ doc._tetherZeroElement = node;
+ }
+ id = node.getAttribute('data-tether-id');
+ if (zeroPosCache[id] == null) {
+ zeroPosCache[id] = {};
+ _ref = node.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ zeroPosCache[id][k] = v;
+ }
+ defer(function() {
+ return zeroPosCache[id] = void 0;
+ });
+ }
+ return zeroPosCache[id];
+ };
+
+ node = null;
+
+ getBounds = function(el) {
+ var box, doc, docEl, k, origin, v, _ref;
+ if (el === document) {
+ doc = document;
+ el = document.documentElement;
+ } else {
+ doc = el.ownerDocument;
+ }
+ docEl = doc.documentElement;
+ box = {};
+ _ref = el.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ box[k] = v;
+ }
+ origin = getOrigin(doc);
+ box.top -= origin.top;
+ box.left -= origin.left;
+ if (box.width == null) {
+ box.width = document.body.scrollWidth - box.left - box.right;
+ }
+ if (box.height == null) {
+ box.height = document.body.scrollHeight - box.top - box.bottom;
+ }
+ box.top = box.top - docEl.clientTop;
+ box.left = box.left - docEl.clientLeft;
+ box.right = doc.body.clientWidth - box.width - box.left;
+ box.bottom = doc.body.clientHeight - box.height - box.top;
+ return box;
+ };
+
+ getOffsetParent = function(el) {
+ return el.offsetParent || document.documentElement;
+ };
+
+ getScrollBarSize = function() {
+ var inner, outer, width, widthContained, widthScroll;
+ inner = document.createElement('div');
+ inner.style.width = '100%';
+ inner.style.height = '200px';
+ outer = document.createElement('div');
+ extend(outer.style, {
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ pointerEvents: 'none',
+ visibility: 'hidden',
+ width: '200px',
+ height: '150px',
+ overflow: 'hidden'
+ });
+ outer.appendChild(inner);
+ document.body.appendChild(outer);
+ widthContained = inner.offsetWidth;
+ outer.style.overflow = 'scroll';
+ widthScroll = inner.offsetWidth;
+ if (widthContained === widthScroll) {
+ widthScroll = outer.clientWidth;
+ }
+ document.body.removeChild(outer);
+ width = widthContained - widthScroll;
+ return {
+ width: width,
+ height: width
+ };
+ };
+
+ extend = function(out) {
+ var args, key, obj, val, _i, _len, _ref;
+ if (out == null) {
+ out = {};
+ }
+ args = [];
+ Array.prototype.push.apply(args, arguments);
+ _ref = args.slice(1);
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ obj = _ref[_i];
+ if (obj) {
+ for (key in obj) {
+ if (!__hasProp.call(obj, key)) continue;
+ val = obj[key];
+ out[key] = val;
+ }
+ }
+ }
+ return out;
+ };
+
+ removeClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ if (cls.trim()) {
+ _results.push(el.classList.remove(cls));
+ }
+ }
+ return _results;
+ } else {
+ return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' ');
+ }
+ };
+
+ addClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ if (cls.trim()) {
+ _results.push(el.classList.add(cls));
+ }
+ }
+ return _results;
+ } else {
+ removeClass(el, name);
+ return el.className += " " + name;
+ }
+ };
+
+ hasClass = function(el, name) {
+ if (el.classList != null) {
+ return el.classList.contains(name);
+ } else {
+ return new RegExp("(^| )" + name + "( |$)", 'gi').test(el.className);
+ }
+ };
+
+ updateClasses = function(el, add, all) {
+ var cls, _i, _j, _len, _len1, _results;
+ for (_i = 0, _len = all.length; _i < _len; _i++) {
+ cls = all[_i];
+ if (__indexOf.call(add, cls) < 0) {
+ if (hasClass(el, cls)) {
+ removeClass(el, cls);
+ }
+ }
+ }
+ _results = [];
+ for (_j = 0, _len1 = add.length; _j < _len1; _j++) {
+ cls = add[_j];
+ if (!hasClass(el, cls)) {
+ _results.push(addClass(el, cls));
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ deferred = [];
+
+ defer = function(fn) {
+ return deferred.push(fn);
+ };
+
+ flush = function() {
+ var fn, _results;
+ _results = [];
+ while (fn = deferred.pop()) {
+ _results.push(fn());
+ }
+ return _results;
+ };
+
+ Evented = (function() {
+ function Evented() {}
+
+ Evented.prototype.on = function(event, handler, ctx, once) {
+ var _base;
+ if (once == null) {
+ once = false;
+ }
+ if (this.bindings == null) {
+ this.bindings = {};
+ }
+ if ((_base = this.bindings)[event] == null) {
+ _base[event] = [];
+ }
+ return this.bindings[event].push({
+ handler: handler,
+ ctx: ctx,
+ once: once
+ });
+ };
+
+ Evented.prototype.once = function(event, handler, ctx) {
+ return this.on(event, handler, ctx, true);
+ };
+
+ Evented.prototype.off = function(event, handler) {
+ var i, _ref, _results;
+ if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
+ return;
+ }
+ if (handler == null) {
+ return delete this.bindings[event];
+ } else {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ if (this.bindings[event][i].handler === handler) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ Evented.prototype.trigger = function() {
+ var args, ctx, event, handler, i, once, _ref, _ref1, _results;
+ event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+ if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
+ handler.apply(ctx != null ? ctx : this, args);
+ if (once) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ return Evented;
+
+ })();
+
+ this.Tether.Utils = {
+ getScrollParent: getScrollParent,
+ getBounds: getBounds,
+ getOffsetParent: getOffsetParent,
+ extend: extend,
+ addClass: addClass,
+ removeClass: removeClass,
+ hasClass: hasClass,
+ updateClasses: updateClasses,
+ defer: defer,
+ flush: flush,
+ uniqueId: uniqueId,
+ Evented: Evented,
+ getScrollBarSize: getScrollBarSize
+ };
+
+}).call(this);
+
+(function() {
+ var MIRROR_LR, MIRROR_TB, OFFSET_MAP, Tether, addClass, addOffset, attachmentToOffset, autoToFixedAttachment, defer, extend, flush, getBounds, getOffsetParent, getOuterSize, getScrollBarSize, getScrollParent, getSize, now, offsetToPx, parseAttachment, parseOffset, position, removeClass, tethers, transformKey, updateClasses, within, _Tether, _ref,
+ __slice = [].slice,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+
+ if (this.Tether == null) {
+ throw new Error("You must include the utils.js file before tether.js");
+ }
+
+ Tether = this.Tether;
+
+ _ref = Tether.Utils, getScrollParent = _ref.getScrollParent, getSize = _ref.getSize, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getOffsetParent = _ref.getOffsetParent, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, updateClasses = _ref.updateClasses, defer = _ref.defer, flush = _ref.flush, getScrollBarSize = _ref.getScrollBarSize;
+
+ within = function(a, b, diff) {
+ if (diff == null) {
+ diff = 1;
+ }
+ return (a + diff >= b && b >= a - diff);
+ };
+
+ transformKey = (function() {
+ var el, key, _i, _len, _ref1;
+ el = document.createElement('div');
+ _ref1 = ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ key = _ref1[_i];
+ if (el.style[key] !== void 0) {
+ return key;
+ }
+ }
+ })();
+
+ tethers = [];
+
+ position = function() {
+ var tether, _i, _len;
+ for (_i = 0, _len = tethers.length; _i < _len; _i++) {
+ tether = tethers[_i];
+ tether.position(false);
+ }
+ return flush();
+ };
+
+ now = function() {
+ var _ref1;
+ return (_ref1 = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref1 : +(new Date);
+ };
+
+ (function() {
+ var event, lastCall, lastDuration, pendingTimeout, tick, _i, _len, _ref1, _results;
+ lastCall = null;
+ lastDuration = null;
+ pendingTimeout = null;
+ tick = function() {
+ if ((lastDuration != null) && lastDuration > 16) {
+ lastDuration = Math.min(lastDuration - 16, 250);
+ pendingTimeout = setTimeout(tick, 250);
+ return;
+ }
+ if ((lastCall != null) && (now() - lastCall) < 10) {
+ return;
+ }
+ if (pendingTimeout != null) {
+ clearTimeout(pendingTimeout);
+ pendingTimeout = null;
+ }
+ lastCall = now();
+ position();
+ return lastDuration = now() - lastCall;
+ };
+ _ref1 = ['resize', 'scroll', 'touchmove'];
+ _results = [];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ event = _ref1[_i];
+ _results.push(window.addEventListener(event, tick));
+ }
+ return _results;
+ })();
+
+ MIRROR_LR = {
+ center: 'center',
+ left: 'right',
+ right: 'left'
+ };
+
+ MIRROR_TB = {
+ middle: 'middle',
+ top: 'bottom',
+ bottom: 'top'
+ };
+
+ OFFSET_MAP = {
+ top: 0,
+ left: 0,
+ middle: '50%',
+ center: '50%',
+ bottom: '100%',
+ right: '100%'
+ };
+
+ autoToFixedAttachment = function(attachment, relativeToAttachment) {
+ var left, top;
+ left = attachment.left, top = attachment.top;
+ if (left === 'auto') {
+ left = MIRROR_LR[relativeToAttachment.left];
+ }
+ if (top === 'auto') {
+ top = MIRROR_TB[relativeToAttachment.top];
+ }
+ return {
+ left: left,
+ top: top
+ };
+ };
+
+ attachmentToOffset = function(attachment) {
+ var _ref1, _ref2;
+ return {
+ left: (_ref1 = OFFSET_MAP[attachment.left]) != null ? _ref1 : attachment.left,
+ top: (_ref2 = OFFSET_MAP[attachment.top]) != null ? _ref2 : attachment.top
+ };
+ };
+
+ addOffset = function() {
+ var left, offsets, out, top, _i, _len, _ref1;
+ offsets = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ out = {
+ top: 0,
+ left: 0
+ };
+ for (_i = 0, _len = offsets.length; _i < _len; _i++) {
+ _ref1 = offsets[_i], top = _ref1.top, left = _ref1.left;
+ if (typeof top === 'string') {
+ top = parseFloat(top, 10);
+ }
+ if (typeof left === 'string') {
+ left = parseFloat(left, 10);
+ }
+ out.top += top;
+ out.left += left;
+ }
+ return out;
+ };
+
+ offsetToPx = function(offset, size) {
+ if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
+ offset.left = parseFloat(offset.left, 10) / 100 * size.width;
+ }
+ if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
+ offset.top = parseFloat(offset.top, 10) / 100 * size.height;
+ }
+ return offset;
+ };
+
+ parseAttachment = parseOffset = function(value) {
+ var left, top, _ref1;
+ _ref1 = value.split(' '), top = _ref1[0], left = _ref1[1];
+ return {
+ top: top,
+ left: left
+ };
+ };
+
+ _Tether = (function() {
+ _Tether.modules = [];
+
+ function _Tether(options) {
+ this.position = __bind(this.position, this);
+ var module, _i, _len, _ref1, _ref2;
+ tethers.push(this);
+ this.history = [];
+ this.setOptions(options, false);
+ _ref1 = Tether.modules;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ module = _ref1[_i];
+ if ((_ref2 = module.initialize) != null) {
+ _ref2.call(this);
+ }
+ }
+ this.position();
+ }
+
+ _Tether.prototype.getClass = function(key) {
+ var _ref1, _ref2;
+ if ((_ref1 = this.options.classes) != null ? _ref1[key] : void 0) {
+ return this.options.classes[key];
+ } else if (((_ref2 = this.options.classes) != null ? _ref2[key] : void 0) !== false) {
+ if (this.options.classPrefix) {
+ return "" + this.options.classPrefix + "-" + key;
+ } else {
+ return key;
+ }
+ } else {
+ return '';
+ }
+ };
+
+ _Tether.prototype.setOptions = function(options, position) {
+ var defaults, key, _i, _len, _ref1, _ref2;
+ this.options = options;
+ if (position == null) {
+ position = true;
+ }
+ defaults = {
+ offset: '0 0',
+ targetOffset: '0 0',
+ targetAttachment: 'auto auto',
+ classPrefix: 'tether'
+ };
+ this.options = extend(defaults, this.options);
+ _ref1 = this.options, this.element = _ref1.element, this.target = _ref1.target, this.targetModifier = _ref1.targetModifier;
+ if (this.target === 'viewport') {
+ this.target = document.body;
+ this.targetModifier = 'visible';
+ } else if (this.target === 'scroll-handle') {
+ this.target = document.body;
+ this.targetModifier = 'scroll-handle';
+ }
+ _ref2 = ['element', 'target'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ key = _ref2[_i];
+ if (this[key] == null) {
+ throw new Error("Tether Error: Both element and target must be defined");
+ }
+ if (this[key].jquery != null) {
+ this[key] = this[key][0];
+ } else if (typeof this[key] === 'string') {
+ this[key] = document.querySelector(this[key]);
+ }
+ }
+ addClass(this.element, this.getClass('element'));
+ addClass(this.target, this.getClass('target'));
+ if (!this.options.attachment) {
+ throw new Error("Tether Error: You must provide an attachment");
+ }
+ this.targetAttachment = parseAttachment(this.options.targetAttachment);
+ this.attachment = parseAttachment(this.options.attachment);
+ this.offset = parseOffset(this.options.offset);
+ this.targetOffset = parseOffset(this.options.targetOffset);
+ if (this.scrollParent != null) {
+ this.disable();
+ }
+ if (this.targetModifier === 'scroll-handle') {
+ this.scrollParent = this.target;
+ } else {
+ this.scrollParent = getScrollParent(this.target);
+ }
+ if (this.options.enabled !== false) {
+ return this.enable(position);
+ }
+ };
+
+ _Tether.prototype.getTargetBounds = function() {
+ var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target;
+ if (this.targetModifier != null) {
+ switch (this.targetModifier) {
+ case 'visible':
+ if (this.target === document.body) {
+ return {
+ top: pageYOffset,
+ left: pageXOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(this.target);
+ out = {
+ height: bounds.height,
+ width: bounds.width,
+ top: bounds.top,
+ left: bounds.left
+ };
+ out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
+ out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight)));
+ out.height = Math.min(innerHeight, out.height);
+ out.height -= 2;
+ out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
+ out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth)));
+ out.width = Math.min(innerWidth, out.width);
+ out.width -= 2;
+ if (out.top < pageYOffset) {
+ out.top = pageYOffset;
+ }
+ if (out.left < pageXOffset) {
+ out.left = pageXOffset;
+ }
+ return out;
+ }
+ break;
+ case 'scroll-handle':
+ target = this.target;
+ if (target === document.body) {
+ target = document.documentElement;
+ bounds = {
+ left: pageXOffset,
+ top: pageYOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(target);
+ }
+ style = getComputedStyle(target);
+ hasBottomScroll = target.scrollWidth > target.clientWidth || 'scroll' === [style.overflow, style.overflowX] || this.target !== document.body;
+ scrollBottom = 0;
+ if (hasBottomScroll) {
+ scrollBottom = 15;
+ }
+ height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
+ out = {
+ width: 15,
+ height: height * 0.975 * (height / target.scrollHeight),
+ left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
+ };
+ fitAdj = 0;
+ if (height < 408 && this.target === document.body) {
+ fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
+ }
+ if (this.target !== document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ scrollPercentage = this.target.scrollTop / (target.scrollHeight - height);
+ out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
+ if (this.target === document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ return out;
+ }
+ } else {
+ return getBounds(this.target);
+ }
+ };
+
+ _Tether.prototype.clearCache = function() {
+ return this._cache = {};
+ };
+
+ _Tether.prototype.cache = function(k, getter) {
+ if (this._cache == null) {
+ this._cache = {};
+ }
+ if (this._cache[k] == null) {
+ this._cache[k] = getter.call(this);
+ }
+ return this._cache[k];
+ };
+
+ _Tether.prototype.enable = function(position) {
+ if (position == null) {
+ position = true;
+ }
+ addClass(this.target, this.getClass('enabled'));
+ addClass(this.element, this.getClass('enabled'));
+ this.enabled = true;
+ if (this.scrollParent !== document) {
+ this.scrollParent.addEventListener('scroll', this.position);
+ }
+ if (position) {
+ return this.position();
+ }
+ };
+
+ _Tether.prototype.disable = function() {
+ removeClass(this.target, this.getClass('enabled'));
+ removeClass(this.element, this.getClass('enabled'));
+ this.enabled = false;
+ if (this.scrollParent != null) {
+ return this.scrollParent.removeEventListener('scroll', this.position);
+ }
+ };
+
+ _Tether.prototype.destroy = function() {
+ var i, tether, _i, _len, _results;
+ this.disable();
+ _results = [];
+ for (i = _i = 0, _len = tethers.length; _i < _len; i = ++_i) {
+ tether = tethers[i];
+ if (tether === this) {
+ tethers.splice(i, 1);
+ break;
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ _Tether.prototype.updateAttachClasses = function(elementAttach, targetAttach) {
+ var add, all, side, sides, _i, _j, _len, _len1, _ref1,
+ _this = this;
+ if (elementAttach == null) {
+ elementAttach = this.attachment;
+ }
+ if (targetAttach == null) {
+ targetAttach = this.targetAttachment;
+ }
+ sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
+ if ((_ref1 = this._addAttachClasses) != null ? _ref1.length : void 0) {
+ this._addAttachClasses.splice(0, this._addAttachClasses.length);
+ }
+ add = this._addAttachClasses != null ? this._addAttachClasses : this._addAttachClasses = [];
+ if (elementAttach.top) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.top);
+ }
+ if (elementAttach.left) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.left);
+ }
+ if (targetAttach.top) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.top);
+ }
+ if (targetAttach.left) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.left);
+ }
+ all = [];
+ for (_i = 0, _len = sides.length; _i < _len; _i++) {
+ side = sides[_i];
+ all.push("" + (this.getClass('element-attached')) + "-" + side);
+ }
+ for (_j = 0, _len1 = sides.length; _j < _len1; _j++) {
+ side = sides[_j];
+ all.push("" + (this.getClass('target-attached')) + "-" + side);
+ }
+ return defer(function() {
+ if (_this._addAttachClasses == null) {
+ return;
+ }
+ updateClasses(_this.element, _this._addAttachClasses, all);
+ updateClasses(_this.target, _this._addAttachClasses, all);
+ return _this._addAttachClasses = void 0;
+ });
+ };
+
+ _Tether.prototype.position = function(flushChanges) {
+ var elementPos, elementStyle, height, left, manualOffset, manualTargetOffset, module, next, offset, offsetBorder, offsetParent, offsetParentSize, offsetParentStyle, offsetPosition, ret, scrollLeft, scrollTop, scrollbarSize, side, targetAttachment, targetOffset, targetPos, targetSize, top, width, _i, _j, _len, _len1, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6,
+ _this = this;
+ if (flushChanges == null) {
+ flushChanges = true;
+ }
+ if (!this.enabled) {
+ return;
+ }
+ this.clearCache();
+ targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
+ this.updateAttachClasses(this.attachment, targetAttachment);
+ elementPos = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ });
+ width = elementPos.width, height = elementPos.height;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref1 = this.lastSize, width = _ref1.width, height = _ref1.height;
+ } else {
+ this.lastSize = {
+ width: width,
+ height: height
+ };
+ }
+ targetSize = targetPos = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ offset = offsetToPx(attachmentToOffset(this.attachment), {
+ width: width,
+ height: height
+ });
+ targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
+ manualOffset = offsetToPx(this.offset, {
+ width: width,
+ height: height
+ });
+ manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
+ offset = addOffset(offset, manualOffset);
+ targetOffset = addOffset(targetOffset, manualTargetOffset);
+ left = targetPos.left + targetOffset.left - offset.left;
+ top = targetPos.top + targetOffset.top - offset.top;
+ _ref2 = Tether.modules;
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ module = _ref2[_i];
+ ret = module.position.call(this, {
+ left: left,
+ top: top,
+ targetAttachment: targetAttachment,
+ targetPos: targetPos,
+ attachment: this.attachment,
+ elementPos: elementPos,
+ offset: offset,
+ targetOffset: targetOffset,
+ manualOffset: manualOffset,
+ manualTargetOffset: manualTargetOffset,
+ scrollbarSize: scrollbarSize
+ });
+ if ((ret == null) || typeof ret !== 'object') {
+ continue;
+ } else if (ret === false) {
+ return false;
+ } else {
+ top = ret.top, left = ret.left;
+ }
+ }
+ next = {
+ page: {
+ top: top,
+ left: left
+ },
+ viewport: {
+ top: top - pageYOffset,
+ bottom: pageYOffset - top - height + innerHeight,
+ left: left - pageXOffset,
+ right: pageXOffset - left - width + innerWidth
+ }
+ };
+ if (document.body.scrollWidth > window.innerWidth) {
+ scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
+ next.viewport.bottom -= scrollbarSize.height;
+ }
+ if (document.body.scrollHeight > window.innerHeight) {
+ scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
+ next.viewport.right -= scrollbarSize.width;
+ }
+ if (((_ref3 = document.body.style.position) !== '' && _ref3 !== 'static') || ((_ref4 = document.body.parentElement.style.position) !== '' && _ref4 !== 'static')) {
+ next.page.bottom = document.body.scrollHeight - top - height;
+ next.page.right = document.body.scrollWidth - left - width;
+ }
+ if (((_ref5 = this.options.optimizations) != null ? _ref5.moveElement : void 0) !== false && (this.targetModifier == null)) {
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ offsetPosition = this.cache('target-offsetparent-bounds', function() {
+ return getBounds(offsetParent);
+ });
+ offsetParentStyle = getComputedStyle(offsetParent);
+ elementStyle = getComputedStyle(this.element);
+ offsetParentSize = offsetPosition;
+ offsetBorder = {};
+ _ref6 = ['Top', 'Left', 'Bottom', 'Right'];
+ for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
+ side = _ref6[_j];
+ offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle["border" + side + "Width"]);
+ }
+ offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
+ offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
+ if (next.page.top >= (offsetPosition.top + offsetBorder.top) && next.page.bottom >= offsetPosition.bottom) {
+ if (next.page.left >= (offsetPosition.left + offsetBorder.left) && next.page.right >= offsetPosition.right) {
+ scrollTop = offsetParent.scrollTop;
+ scrollLeft = offsetParent.scrollLeft;
+ next.offset = {
+ top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
+ left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
+ };
+ }
+ }
+ }
+ this.move(next);
+ this.history.unshift(next);
+ if (this.history.length > 3) {
+ this.history.pop();
+ }
+ if (flushChanges) {
+ flush();
+ }
+ return true;
+ };
+
+ _Tether.prototype.move = function(position) {
+ var css, elVal, found, key, moved, offsetParent, point, same, transcribe, type, val, write, writeCSS, _i, _len, _ref1, _ref2,
+ _this = this;
+ if (this.element.parentNode == null) {
+ return;
+ }
+ same = {};
+ for (type in position) {
+ same[type] = {};
+ for (key in position[type]) {
+ found = false;
+ _ref1 = this.history;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ point = _ref1[_i];
+ if (!within((_ref2 = point[type]) != null ? _ref2[key] : void 0, position[type][key])) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ same[type][key] = true;
+ }
+ }
+ }
+ css = {
+ top: '',
+ left: '',
+ right: '',
+ bottom: ''
+ };
+ transcribe = function(same, pos) {
+ var xPos, yPos, _ref3;
+ if (((_ref3 = _this.options.optimizations) != null ? _ref3.gpu : void 0) !== false) {
+ if (same.top) {
+ css.top = 0;
+ yPos = pos.top;
+ } else {
+ css.bottom = 0;
+ yPos = -pos.bottom;
+ }
+ if (same.left) {
+ css.left = 0;
+ xPos = pos.left;
+ } else {
+ css.right = 0;
+ xPos = -pos.right;
+ }
+ css[transformKey] = "translateX(" + (Math.round(xPos)) + "px) translateY(" + (Math.round(yPos)) + "px)";
+ if (transformKey !== 'msTransform') {
+ return css[transformKey] += " translateZ(0)";
+ }
+ } else {
+ if (same.top) {
+ css.top = "" + pos.top + "px";
+ } else {
+ css.bottom = "" + pos.bottom + "px";
+ }
+ if (same.left) {
+ return css.left = "" + pos.left + "px";
+ } else {
+ return css.right = "" + pos.right + "px";
+ }
+ }
+ };
+ moved = false;
+ if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
+ css.position = 'absolute';
+ transcribe(same.page, position.page);
+ } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
+ css.position = 'fixed';
+ transcribe(same.viewport, position.viewport);
+ } else if ((same.offset != null) && same.offset.top && same.offset.left) {
+ css.position = 'absolute';
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ if (getOffsetParent(this.element) !== offsetParent) {
+ defer(function() {
+ _this.element.parentNode.removeChild(_this.element);
+ return offsetParent.appendChild(_this.element);
+ });
+ }
+ transcribe(same.offset, position.offset);
+ moved = true;
+ } else {
+ css.position = 'absolute';
+ transcribe({
+ top: true,
+ left: true
+ }, position.page);
+ }
+ if (!moved && this.element.parentNode.tagName !== 'BODY') {
+ this.element.parentNode.removeChild(this.element);
+ document.body.appendChild(this.element);
+ }
+ writeCSS = {};
+ write = false;
+ for (key in css) {
+ val = css[key];
+ elVal = this.element.style[key];
+ if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) {
+ elVal = parseFloat(elVal);
+ val = parseFloat(val);
+ }
+ if (elVal !== val) {
+ write = true;
+ writeCSS[key] = css[key];
+ }
+ }
+ if (write) {
+ return defer(function() {
+ return extend(_this.element.style, writeCSS);
+ });
+ }
+ };
+
+ return _Tether;
+
+ })();
+
+ Tether.position = position;
+
+ this.Tether = extend(_Tether, Tether);
+
+}).call(this);
+
+(function() {
+ var BOUNDS_FORMAT, MIRROR_ATTACH, defer, extend, getBoundingRect, getBounds, getOuterSize, getSize, updateClasses, _ref,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+
+ _ref = this.Tether.Utils, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getSize = _ref.getSize, extend = _ref.extend, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ MIRROR_ATTACH = {
+ left: 'right',
+ right: 'left',
+ top: 'bottom',
+ bottom: 'top',
+ middle: 'middle'
+ };
+
+ BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
+
+ getBoundingRect = function(tether, to) {
+ var i, pos, side, size, style, _i, _len;
+ if (to === 'scrollParent') {
+ to = tether.scrollParent;
+ } else if (to === 'window') {
+ to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
+ }
+ if (to === document) {
+ to = to.documentElement;
+ }
+ if (to.nodeType != null) {
+ pos = size = getBounds(to);
+ style = getComputedStyle(to);
+ to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
+ for (i = _i = 0, _len = BOUNDS_FORMAT.length; _i < _len; i = ++_i) {
+ side = BOUNDS_FORMAT[i];
+ side = side[0].toUpperCase() + side.substr(1);
+ if (side === 'Top' || side === 'Left') {
+ to[i] += parseFloat(style["border" + side + "Width"]);
+ } else {
+ to[i] -= parseFloat(style["border" + side + "Width"]);
+ }
+ }
+ }
+ return to;
+ };
+
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var addClasses, allClasses, attachment, bounds, changeAttachX, changeAttachY, cls, constraint, eAttachment, height, left, oob, oobClass, p, pin, pinned, pinnedClass, removeClass, side, tAttachment, targetAttachment, targetHeight, targetSize, targetWidth, to, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8,
+ _this = this;
+ top = _arg.top, left = _arg.left, targetAttachment = _arg.targetAttachment;
+ if (!this.options.constraints) {
+ return true;
+ }
+ removeClass = function(prefix) {
+ var side, _i, _len, _results;
+ _this.removeClass(prefix);
+ _results = [];
+ for (_i = 0, _len = BOUNDS_FORMAT.length; _i < _len; _i++) {
+ side = BOUNDS_FORMAT[_i];
+ _results.push(_this.removeClass("" + prefix + "-" + side));
+ }
+ return _results;
+ };
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref2 = this.lastSize, width = _ref2.width, height = _ref2.height;
+ }
+ targetSize = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ targetHeight = targetSize.height;
+ targetWidth = targetSize.width;
+ tAttachment = {};
+ eAttachment = {};
+ allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
+ _ref3 = this.options.constraints;
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ constraint = _ref3[_i];
+ if (constraint.outOfBoundsClass) {
+ allClasses.push(constraint.outOfBoundsClass);
+ }
+ if (constraint.pinnedClass) {
+ allClasses.push(constraint.pinnedClass);
+ }
+ }
+ for (_j = 0, _len1 = allClasses.length; _j < _len1; _j++) {
+ cls = allClasses[_j];
+ _ref4 = ['left', 'top', 'right', 'bottom'];
+ for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
+ side = _ref4[_k];
+ allClasses.push("" + cls + "-" + side);
+ }
+ }
+ addClasses = [];
+ tAttachment = extend({}, targetAttachment);
+ eAttachment = extend({}, this.attachment);
+ _ref5 = this.options.constraints;
+ for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) {
+ constraint = _ref5[_l];
+ to = constraint.to, attachment = constraint.attachment, pin = constraint.pin;
+ if (attachment == null) {
+ attachment = '';
+ }
+ if (__indexOf.call(attachment, ' ') >= 0) {
+ _ref6 = attachment.split(' '), changeAttachY = _ref6[0], changeAttachX = _ref6[1];
+ } else {
+ changeAttachX = changeAttachY = attachment;
+ }
+ bounds = getBoundingRect(this, to);
+ if (changeAttachY === 'target' || changeAttachY === 'both') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ }
+ }
+ if (changeAttachY === 'together') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ if (eAttachment.top === 'bottom') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top += height;
+ eAttachment.top = 'top';
+ } else if (eAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ if (eAttachment.top === 'top') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (eAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ if (tAttachment.top === 'middle') {
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ }
+ if (changeAttachX === 'target' || changeAttachX === 'both') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ }
+ if (left + width > bounds[2] && tAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ }
+ }
+ if (changeAttachX === 'together') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ if (eAttachment.left === 'right') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left += width;
+ eAttachment.left = 'left';
+ } else if (eAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ } else if (left + width > bounds[2] && tAttachment.left === 'right') {
+ if (eAttachment.left === 'left') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (eAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left += width;
+ eAttachment.left = 'left';
+ }
+ } else if (tAttachment.left === 'center') {
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ }
+ }
+ if (changeAttachY === 'element' || changeAttachY === 'both') {
+ if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (changeAttachX === 'element' || changeAttachX === 'both') {
+ if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ }
+ if (typeof pin === 'string') {
+ pin = (function() {
+ var _len4, _m, _ref7, _results;
+ _ref7 = pin.split(',');
+ _results = [];
+ for (_m = 0, _len4 = _ref7.length; _m < _len4; _m++) {
+ p = _ref7[_m];
+ _results.push(p.trim());
+ }
+ return _results;
+ })();
+ } else if (pin === true) {
+ pin = ['top', 'left', 'right', 'bottom'];
+ }
+ pin || (pin = []);
+ pinned = [];
+ oob = [];
+ if (top < bounds[1]) {
+ if (__indexOf.call(pin, 'top') >= 0) {
+ top = bounds[1];
+ pinned.push('top');
+ } else {
+ oob.push('top');
+ }
+ }
+ if (top + height > bounds[3]) {
+ if (__indexOf.call(pin, 'bottom') >= 0) {
+ top = bounds[3] - height;
+ pinned.push('bottom');
+ } else {
+ oob.push('bottom');
+ }
+ }
+ if (left < bounds[0]) {
+ if (__indexOf.call(pin, 'left') >= 0) {
+ left = bounds[0];
+ pinned.push('left');
+ } else {
+ oob.push('left');
+ }
+ }
+ if (left + width > bounds[2]) {
+ if (__indexOf.call(pin, 'right') >= 0) {
+ left = bounds[2] - width;
+ pinned.push('right');
+ } else {
+ oob.push('right');
+ }
+ }
+ if (pinned.length) {
+ pinnedClass = (_ref7 = this.options.pinnedClass) != null ? _ref7 : this.getClass('pinned');
+ addClasses.push(pinnedClass);
+ for (_m = 0, _len4 = pinned.length; _m < _len4; _m++) {
+ side = pinned[_m];
+ addClasses.push("" + pinnedClass + "-" + side);
+ }
+ }
+ if (oob.length) {
+ oobClass = (_ref8 = this.options.outOfBoundsClass) != null ? _ref8 : this.getClass('out-of-bounds');
+ addClasses.push(oobClass);
+ for (_n = 0, _len5 = oob.length; _n < _len5; _n++) {
+ side = oob[_n];
+ addClasses.push("" + oobClass + "-" + side);
+ }
+ }
+ if (__indexOf.call(pinned, 'left') >= 0 || __indexOf.call(pinned, 'right') >= 0) {
+ eAttachment.left = tAttachment.left = false;
+ }
+ if (__indexOf.call(pinned, 'top') >= 0 || __indexOf.call(pinned, 'bottom') >= 0) {
+ eAttachment.top = tAttachment.top = false;
+ }
+ if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== this.attachment.top || eAttachment.left !== this.attachment.left) {
+ this.updateAttachClasses(eAttachment, tAttachment);
+ }
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+(function() {
+ var defer, getBounds, updateClasses, _ref;
+
+ _ref = this.Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5,
+ _this = this;
+ top = _arg.top, left = _arg.left;
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ targetPos = this.getTargetBounds();
+ bottom = top + height;
+ right = left + width;
+ abutted = [];
+ if (top <= targetPos.bottom && bottom >= targetPos.top) {
+ _ref2 = ['left', 'right'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ side = _ref2[_i];
+ if ((_ref3 = targetPos[side]) === left || _ref3 === right) {
+ abutted.push(side);
+ }
+ }
+ }
+ if (left <= targetPos.right && right >= targetPos.left) {
+ _ref4 = ['top', 'bottom'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) {
+ abutted.push(side);
+ }
+ }
+ }
+ allClasses = [];
+ addClasses = [];
+ sides = ['left', 'top', 'right', 'bottom'];
+ allClasses.push(this.getClass('abutted'));
+ for (_k = 0, _len2 = sides.length; _k < _len2; _k++) {
+ side = sides[_k];
+ allClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ if (abutted.length) {
+ addClasses.push(this.getClass('abutted'));
+ }
+ for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) {
+ side = abutted[_l];
+ addClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return true;
+ }
+ });
+
+}).call(this);
+
+(function() {
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var left, result, shift, shiftLeft, shiftTop, top, _ref;
+ top = _arg.top, left = _arg.left;
+ if (!this.options.shift) {
+ return;
+ }
+ result = function(val) {
+ if (typeof val === 'function') {
+ return val.call(this, {
+ top: top,
+ left: left
+ });
+ } else {
+ return val;
+ }
+ };
+ shift = result(this.options.shift);
+ if (typeof shift === 'string') {
+ shift = shift.split(' ');
+ shift[1] || (shift[1] = shift[0]);
+ shiftTop = shift[0], shiftLeft = shift[1];
+ shiftTop = parseFloat(shiftTop, 10);
+ shiftLeft = parseFloat(shiftLeft, 10);
+ } else {
+ _ref = [shift.top, shift.left], shiftTop = _ref[0], shiftLeft = _ref[1];
+ }
+ top += shiftTop;
+ left += shiftLeft;
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+return this.Tether;
+
+}));
+
+(function() {
+ var ATTACHMENT, Evented, Shepherd, Step, Tour, addClass, createFromHTML, extend, getBounds, hasClass, matchesSelector, parseShorthand, removeClass, uniqueId, _ref,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ _ref = Tether.Utils, extend = _ref.extend, removeClass = _ref.removeClass, addClass = _ref.addClass, hasClass = _ref.hasClass, Evented = _ref.Evented, getBounds = _ref.getBounds, uniqueId = _ref.uniqueId;
+
+ Shepherd = new Evented;
+
+ ATTACHMENT = {
+ 'top': 'bottom center',
+ 'left': 'middle right',
+ 'right': 'middle left',
+ 'bottom': 'top center'
+ };
+
+ createFromHTML = function(html) {
+ var el;
+ el = document.createElement('div');
+ el.innerHTML = html;
+ return el.children[0];
+ };
+
+ matchesSelector = function(el, sel) {
+ var matches, _ref1, _ref2, _ref3, _ref4;
+ matches = (_ref1 = (_ref2 = (_ref3 = (_ref4 = el.matches) != null ? _ref4 : el.matchesSelector) != null ? _ref3 : el.webkitMatchesSelector) != null ? _ref2 : el.mozMatchesSelector) != null ? _ref1 : el.oMatchesSelector;
+ return matches.call(el, sel);
+ };
+
+ parseShorthand = function(obj, props) {
+ var i, out, prop, vals, _i, _len;
+ if (obj == null) {
+ return obj;
+ } else if (typeof obj === 'object') {
+ return obj;
+ } else {
+ vals = obj.split(' ');
+ if (vals.length > props.length) {
+ vals[0] = vals.slice(0, +(vals.length - props.length) + 1 || 9e9).join(' ');
+ vals.splice(1, vals.length - props.length);
+ }
+ out = {};
+ for (i = _i = 0, _len = props.length; _i < _len; i = ++_i) {
+ prop = props[i];
+ out[prop] = vals[i];
+ }
+ return out;
+ }
+ };
+
+ Step = (function(_super) {
+ __extends(Step, _super);
+
+ function Step(tour, options) {
+ this.tour = tour;
+ this.destroy = __bind(this.destroy, this);
+ this.scrollTo = __bind(this.scrollTo, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.isOpen = __bind(this.isOpen, this);
+ this.hide = __bind(this.hide, this);
+ this.show = __bind(this.show, this);
+ this.setOptions(options);
+ this;
+ }
+
+ Step.prototype.setOptions = function(options) {
+ var event, handler, _base, _ref1;
+ this.options = options != null ? options : {};
+ this.destroy();
+ this.id = this.options.id || this.id || ("step-" + (uniqueId()));
+ if (this.options.when) {
+ _ref1 = this.options.when;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ this.on(event, handler, this);
+ }
+ }
+ return (_base = this.options).buttons != null ? (_base = this.options).buttons : _base.buttons = [
+ {
+ text: 'Next',
+ action: this.tour.next
+ }
+ ];
+ };
+
+ Step.prototype.getTour = function() {
+ return this.tour;
+ };
+
+ Step.prototype.bindAdvance = function() {
+ var event, handler, selector, _ref1,
+ _this = this;
+ _ref1 = parseShorthand(this.options.advanceOn, ['selector', 'event']), event = _ref1.event, selector = _ref1.selector;
+ handler = function(e) {
+ if (!_this.isOpen()) {
+ return;
+ }
+ if (selector != null) {
+ if (matchesSelector(e.target, selector)) {
+ return _this.tour.next();
+ }
+ } else {
+ if (_this.el && e.target === _this.el) {
+ return _this.tour.next();
+ }
+ }
+ };
+ document.body.addEventListener(event, handler);
+ return this.on('destroy', function() {
+ return document.body.removeEventListener(event, handler);
+ });
+ };
+
+ Step.prototype.getAttachTo = function() {
+ var opts;
+ opts = parseShorthand(this.options.attachTo, ['element', 'on']);
+ if (opts == null) {
+ opts = {};
+ }
+ if (typeof opts.element === 'string') {
+ opts.element = document.querySelector(opts.element);
+ if (opts.element == null) {
+ throw new Error("Shepherd step's attachTo was not found in the page");
+ }
+ }
+ return opts;
+ };
+
+ Step.prototype.setupTether = function() {
+ var attachment, opts, tetherOpts;
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("Using the attachment feature of Shepherd requires the Tether library");
+ }
+ opts = this.getAttachTo();
+ attachment = ATTACHMENT[opts.on || 'right'];
+ if (opts.element == null) {
+ opts.element = 'viewport';
+ attachment = 'middle center';
+ }
+ tetherOpts = {
+ classPrefix: 'shepherd',
+ element: this.el,
+ constraints: [
+ {
+ to: 'window',
+ pin: true,
+ attachment: 'together'
+ }
+ ],
+ target: opts.element,
+ offset: opts.offset || '0 0',
+ attachment: attachment
+ };
+ return this.tether = new Tether(extend(tetherOpts, this.options.tetherOptions));
+ };
+
+ Step.prototype.show = function() {
+ var _this = this;
+ if (this.el == null) {
+ this.render();
+ }
+ addClass(this.el, 'shepherd-open');
+ document.body.setAttribute('data-shepherd-step', this.id);
+ this.setupTether();
+ if (this.options.scrollTo) {
+ setTimeout(function() {
+ return _this.scrollTo();
+ });
+ }
+ return this.trigger('show');
+ };
+
+ Step.prototype.hide = function() {
+ var _ref1;
+ removeClass(this.el, 'shepherd-open');
+ document.body.removeAttribute('data-shepherd-step');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ this.tether = null;
+ return this.trigger('hide');
+ };
+
+ Step.prototype.isOpen = function() {
+ return hasClass(this.el, 'shepherd-open');
+ };
+
+ Step.prototype.cancel = function() {
+ this.tour.cancel();
+ return this.trigger('cancel');
+ };
+
+ Step.prototype.complete = function() {
+ this.tour.complete();
+ return this.trigger('complete');
+ };
+
+ Step.prototype.scrollTo = function() {
+ var element;
+ element = this.getAttachTo().element;
+ return element != null ? element.scrollIntoView() : void 0;
+ };
+
+ Step.prototype.destroy = function() {
+ var _ref1;
+ if (this.el != null) {
+ document.body.removeChild(this.el);
+ delete this.el;
+ }
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ this.tether = null;
+ return this.trigger('destroy');
+ };
+
+ Step.prototype.render = function() {
+ var button, buttons, cfg, content, footer, header, link, paragraph, paragraphs, text, _i, _j, _len, _len1, _ref1, _ref2, _ref3;
+ if (this.el != null) {
+ this.destroy();
+ }
+ this.el = createFromHTML("");
+ content = document.createElement('div');
+ content.className = 'shepherd-content';
+ this.el.appendChild(content);
+ header = document.createElement('header');
+ content.appendChild(header);
+ if (this.options.title != null) {
+ header.innerHTML += "" + this.options.title + "
";
+ this.el.className += ' shepherd-has-title';
+ }
+ if (this.options.showCancelLink) {
+ link = createFromHTML("✕");
+ header.appendChild(link);
+ this.el.className += ' shepherd-has-cancel-link';
+ this.bindCancelLink(link);
+ }
+ if (this.options.text != null) {
+ text = createFromHTML("");
+ paragraphs = this.options.text;
+ if (typeof paragraphs === 'string') {
+ paragraphs = [paragraphs];
+ }
+ for (_i = 0, _len = paragraphs.length; _i < _len; _i++) {
+ paragraph = paragraphs[_i];
+ text.innerHTML += "" + paragraph + "
";
+ }
+ content.appendChild(text);
+ }
+ footer = document.createElement('footer');
+ if (this.options.buttons) {
+ buttons = createFromHTML("");
+ _ref2 = this.options.buttons;
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
+ cfg = _ref2[_j];
+ button = createFromHTML("" + cfg.text + "");
+ buttons.appendChild(button);
+ this.bindButtonEvents(cfg, button.querySelector('a'));
+ }
+ footer.appendChild(buttons);
+ }
+ content.appendChild(footer);
+ document.body.appendChild(this.el);
+ this.setupTether();
+ if (this.options.advanceOn) {
+ return this.bindAdvance();
+ }
+ };
+
+ Step.prototype.bindCancelLink = function(link) {
+ var _this = this;
+ return link.addEventListener('click', function(e) {
+ e.preventDefault();
+ return _this.cancel();
+ });
+ };
+
+ Step.prototype.bindButtonEvents = function(cfg, el) {
+ var event, handler, page, _ref1,
+ _this = this;
+ if (cfg.events == null) {
+ cfg.events = {};
+ }
+ if (cfg.action != null) {
+ cfg.events.click = cfg.action;
+ }
+ _ref1 = cfg.events;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ if (typeof handler === 'string') {
+ page = handler;
+ handler = function() {
+ return _this.tour.show(page);
+ };
+ }
+ el.addEventListener(event, handler);
+ }
+ return this.on('destroy', function() {
+ var _ref2, _results;
+ _ref2 = cfg.events;
+ _results = [];
+ for (event in _ref2) {
+ handler = _ref2[event];
+ _results.push(el.removeEventListener(event, handler));
+ }
+ return _results;
+ });
+ };
+
+ return Step;
+
+ })(Evented);
+
+ Tour = (function(_super) {
+ __extends(Tour, _super);
+
+ function Tour(options) {
+ var event, _i, _len, _ref1, _ref2,
+ _this = this;
+ this.options = options != null ? options : {};
+ this.hide = __bind(this.hide, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.back = __bind(this.back, this);
+ this.next = __bind(this.next, this);
+ this.steps = (_ref1 = this.options.steps) != null ? _ref1 : [];
+ _ref2 = ['complete', 'cancel', 'hide', 'start', 'show', 'active', 'inactive'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ event = _ref2[_i];
+ this.on(event, function(opts) {
+ if (opts == null) {
+ opts = {};
+ }
+ opts.tour = _this;
+ return Shepherd.trigger(event, opts);
+ });
+ }
+ this;
+ }
+
+ Tour.prototype.addStep = function(name, step) {
+ var _ref1;
+ if (step == null) {
+ step = name;
+ }
+ if (!(step instanceof Step)) {
+ if ((_ref1 = typeof name) === 'string' || _ref1 === 'number') {
+ step.id = name.toString();
+ }
+ step = extend({}, this.options.defaults, step);
+ step = new Step(this, step);
+ } else {
+ step.tour = this;
+ }
+ this.steps.push(step);
+ return step;
+ };
+
+ Tour.prototype.getById = function(id) {
+ var step, _i, _len, _ref1;
+ _ref1 = this.steps;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ step = _ref1[_i];
+ if (step.id === id) {
+ return step;
+ }
+ }
+ };
+
+ Tour.prototype.getCurrentStep = function() {
+ return this.currentStep;
+ };
+
+ Tour.prototype.next = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ if (index === this.steps.length - 1) {
+ this.hide(index);
+ this.trigger('complete');
+ return this.done();
+ } else {
+ return this.show(index + 1);
+ }
+ };
+
+ Tour.prototype.back = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ return this.show(index - 1);
+ };
+
+ Tour.prototype.cancel = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('cancel');
+ return this.done();
+ };
+
+ Tour.prototype.complete = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('complete');
+ return this.done();
+ };
+
+ Tour.prototype.hide = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('hide');
+ return this.done();
+ };
+
+ Tour.prototype.done = function() {
+ Shepherd.activeTour = null;
+ removeClass(document.body, 'shepherd-active');
+ return this.trigger('inactive', {
+ tour: this
+ });
+ };
+
+ Tour.prototype.show = function(key) {
+ var next;
+ if (key == null) {
+ key = 0;
+ }
+ if (this.currentStep) {
+ this.currentStep.hide();
+ } else {
+ addClass(document.body, 'shepherd-active');
+ this.trigger('active', {
+ tour: this
+ });
+ }
+ Shepherd.activeTour = this;
+ if (typeof key === 'string') {
+ next = this.getById(key);
+ } else {
+ next = this.steps[key];
+ }
+ if (next) {
+ this.trigger('show', {
+ step: next,
+ previous: this.currentStep
+ });
+ this.currentStep = next;
+ return next.show();
+ }
+ };
+
+ Tour.prototype.start = function() {
+ this.trigger('start');
+ this.currentStep = null;
+ return this.next();
+ };
+
+ return Tour;
+
+ })(Evented);
+
+ extend(Shepherd, {
+ Tour: Tour,
+ Step: Step,
+ Evented: Evented
+ });
+
+ window.Shepherd = Shepherd;
+
+}).call(this);
diff --git a/ajax/libs/shepherd/0.5.0/shepherd.min.js b/ajax/libs/shepherd/0.5.0/shepherd.min.js
new file mode 100644
index 000000000..221e881cc
--- /dev/null
+++ b/ajax/libs/shepherd/0.5.0/shepherd.min.js
@@ -0,0 +1,2 @@
+/*! shepherd 0.5.0 */
+!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e(require,exports,module):t.Tether=e()}(this,function(){return function(){var t,e,i,o,n,s,r,h,l,a,p,u,f,c,d,g,m,v={}.hasOwnProperty,b=[].indexOf||function(t){for(var e=0,i=this.length;i>e;e++)if(e in this&&this[e]===t)return e;return-1},y=[].slice;null==this.Tether&&(this.Tether={modules:[]}),p=function(t){var e,i,o,n,s;if(i=getComputedStyle(t).position,"fixed"===i)return t;for(o=void 0,e=t;e=e.parentNode;){try{n=getComputedStyle(e)}catch(r){}if(null==n)return e;if(/(auto|scroll)/.test(n.overflow+n["overflow-y"]+n["overflow-x"])&&("absolute"!==i||"relative"===(s=n.position)||"absolute"===s||"fixed"===s))return e}return document.body},d=function(){var t;return t=0,function(){return t++}}(),m={},l=function(t){var e,o,s,r,h;if(s=t._tetherZeroElement,null==s&&(s=t.createElement("div"),s.setAttribute("data-tether-id",d()),n(s.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(s),t._tetherZeroElement=s),e=s.getAttribute("data-tether-id"),null==m[e]){m[e]={},h=s.getBoundingClientRect();for(o in h)r=h[o],m[e][o]=r;i(function(){return m[e]=void 0})}return m[e]},f=null,r=function(t){var e,i,o,n,s,r,h;t===document?(i=document,t=document.documentElement):i=t.ownerDocument,o=i.documentElement,e={},h=t.getBoundingClientRect();for(n in h)r=h[n],e[n]=r;return s=l(i),e.top-=s.top,e.left-=s.left,null==e.width&&(e.width=document.body.scrollWidth-e.left-e.right),null==e.height&&(e.height=document.body.scrollHeight-e.top-e.bottom),e.top=e.top-o.clientTop,e.left=e.left-o.clientLeft,e.right=i.body.clientWidth-e.width-e.left,e.bottom=i.body.clientHeight-e.height-e.top,e},h=function(t){return t.offsetParent||document.documentElement},a=function(){var t,e,i,o,s;return t=document.createElement("div"),t.style.width="100%",t.style.height="200px",e=document.createElement("div"),n(e.style,{position:"absolute",top:0,left:0,pointerEvents:"none",visibility:"hidden",width:"200px",height:"150px",overflow:"hidden"}),e.appendChild(t),document.body.appendChild(e),o=t.offsetWidth,e.style.overflow="scroll",s=t.offsetWidth,o===s&&(s=e.clientWidth),document.body.removeChild(e),i=o-s,{width:i,height:i}},n=function(t){var e,i,o,n,s,r,h;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),h=e.slice(1),s=0,r=h.length;r>s;s++)if(o=h[s])for(i in o)v.call(o,i)&&(n=o[i],t[i]=n);return t},c=function(t,e){var i,o,n,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],o=0,n=s.length;n>o;o++)i=s[o],i.trim()&&r.push(t.classList.remove(i));return r}return t.className=t.className.replace(new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi")," ")},e=function(t,e){var i,o,n,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],o=0,n=s.length;n>o;o++)i=s[o],i.trim()&&r.push(t.classList.add(i));return r}return c(t,e),t.className+=" "+e},u=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},g=function(t,i,o){var n,s,r,h,l,a;for(s=0,h=o.length;h>s;s++)n=o[s],b.call(i,n)<0&&u(t,n)&&c(t,n);for(a=[],r=0,l=i.length;l>r;r++)n=i[r],a.push(u(t,n)?void 0:e(t,n));return a},o=[],i=function(t){return o.push(t)},s=function(){var t,e;for(e=[];t=o.pop();)e.push(t());return e},t=function(){function t(){}return t.prototype.on=function(t,e,i,o){var n;return null==o&&(o=!1),null==this.bindings&&(this.bindings={}),null==(n=this.bindings)[t]&&(n[t]=[]),this.bindings[t].push({handler:e,ctx:i,once:o})},t.prototype.once=function(t,e,i){return this.on(t,e,i,!0)},t.prototype.off=function(t,e){var i,o,n;if(null!=(null!=(o=this.bindings)?o[t]:void 0)){if(null==e)return delete this.bindings[t];for(i=0,n=[];i=e&&e>=t-i},x=function(){var t,e,i,o,n;for(t=document.createElement("div"),n=["transform","webkitTransform","OTransform","MozTransform","msTransform"],i=0,o=n.length;o>i;i++)if(e=n[i],void 0!==t.style[e])return e}(),O=[],C=function(){var t,e,i;for(e=0,i=O.length;i>e;e++)t=O[e],t.position(!1);return p()},v=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance?"function"==typeof performance.now?performance.now():void 0:void 0)?t:+new Date},function(){var t,e,i,o,n,s,r,h,l;for(e=null,i=null,o=null,n=function(){if(null!=i&&i>16)return i=Math.min(i-16,250),void(o=setTimeout(n,250));if(!(null!=e&&v()-e<10))return null!=o&&(clearTimeout(o),o=null),e=v(),C(),i=v()-e},h=["resize","scroll","touchmove"],l=[],s=0,r=h.length;r>s;s++)t=h[s],l.push(window.addEventListener(t,n));return l}(),t={center:"center",left:"right",right:"left"},e={middle:"middle",top:"bottom",bottom:"top"},i={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},h=function(i,o){var n,s;return n=i.left,s=i.top,"auto"===n&&(n=t[o.left]),"auto"===s&&(s=e[o.top]),{left:n,top:s}},r=function(t){var e,o;return{left:null!=(e=i[t.left])?e:t.left,top:null!=(o=i[t.top])?o:t.top}},s=function(){var t,e,i,o,n,s,r;for(e=1<=arguments.length?L.call(arguments,0):[],i={top:0,left:0},n=0,s=e.length;s>n;n++)r=e[n],o=r.top,t=r.left,"string"==typeof o&&(o=parseFloat(o,10)),"string"==typeof t&&(t=parseFloat(t,10)),i.top+=o,i.left+=t;return i},b=function(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t},y=w=function(t){var e,i,o;return o=t.split(" "),i=o[0],e=o[1],{top:i,left:e}},A=function(){function t(t){this.position=B(this.position,this);var e,i,n,s,r;for(O.push(this),this.history=[],this.setOptions(t,!1),s=o.modules,i=0,n=s.length;n>i;i++)e=s[i],null!=(r=e.initialize)&&r.call(this);this.position()}return t.modules=[],t.prototype.getClass=function(t){var e,i;return(null!=(e=this.options.classes)?e[t]:void 0)?this.options.classes[t]:(null!=(i=this.options.classes)?i[t]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+t:t:""},t.prototype.setOptions=function(t,e){var i,o,s,r,h,l;for(this.options=t,null==e&&(e=!0),i={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=a(i,this.options),h=this.options,this.element=h.element,this.target=h.target,this.targetModifier=h.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),l=["element","target"],s=0,r=l.length;r>s;s++){if(o=l[s],null==this[o])throw new Error("Tether Error: Both element and target must be defined");null!=this[o].jquery?this[o]=this[o][0]:"string"==typeof this[o]&&(this[o]=document.querySelector(this[o]))}if(n(this.element,this.getClass("element")),n(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=y(this.options.targetAttachment),this.attachment=y(this.options.attachment),this.offset=w(this.options.offset),this.targetOffset=w(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent="scroll-handle"===this.targetModifier?this.target:g(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,i,o,n,s,r,h,l;if(null==this.targetModifier)return u(this.target);switch(this.targetModifier){case"visible":return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:(t=u(this.target),n={height:t.height,width:t.width,top:t.top,left:t.left},n.height=Math.min(n.height,t.height-(pageYOffset-t.top)),n.height=Math.min(n.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),n.height=Math.min(innerHeight,n.height),n.height-=2,n.width=Math.min(n.width,t.width-(pageXOffset-t.left)),n.width=Math.min(n.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),n.width=Math.min(innerWidth,n.width),n.width-=2,n.topl.clientWidth||"scroll"===[h.overflow,h.overflowX]||this.target!==document.body,s=0,i&&(s=15),o=t.height-parseFloat(h.borderTopWidth)-parseFloat(h.borderBottomWidth)-s,n={width:15,height:.975*o*(o/l.scrollHeight),left:t.left+t.width-parseFloat(h.borderLeftWidth)-15},e=0,408>o&&this.target===document.body&&(e=-11e-5*Math.pow(o,2)-.00727*o+22.58),this.target!==document.body&&(n.height=Math.max(n.height,24)),r=this.target.scrollTop/(l.scrollHeight-o),n.top=r*(o-n.height-e)+t.top+parseFloat(h.borderTopWidth),this.target===document.body&&(n.height=Math.max(n.height,24)),n}},t.prototype.clearCache=function(){return this._cache={}},t.prototype.cache=function(t,e){return null==this._cache&&(this._cache={}),null==this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},t.prototype.enable=function(t){return null==t&&(t=!0),n(this.target,this.getClass("enabled")),n(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t?this.position():void 0},t.prototype.disable=function(){return T(this.target,this.getClass("enabled")),T(this.element,this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},t.prototype.destroy=function(){var t,e,i,o,n;for(this.disable(),n=[],t=i=0,o=O.length;o>i;t=++i){if(e=O[t],e===this){O.splice(t,1);break}n.push(void 0)}return n},t.prototype.updateAttachClasses=function(t,e){var i,o,n,s,r,h,a,p,u,f=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),s=["left","top","bottom","right","middle","center"],(null!=(u=this._addAttachClasses)?u.length:void 0)&&this._addAttachClasses.splice(0,this._addAttachClasses.length),i=null!=this._addAttachClasses?this._addAttachClasses:this._addAttachClasses=[],t.top&&i.push(""+this.getClass("element-attached")+"-"+t.top),t.left&&i.push(""+this.getClass("element-attached")+"-"+t.left),e.top&&i.push(""+this.getClass("target-attached")+"-"+e.top),e.left&&i.push(""+this.getClass("target-attached")+"-"+e.left),o=[],r=0,a=s.length;a>r;r++)n=s[r],o.push(""+this.getClass("element-attached")+"-"+n);for(h=0,p=s.length;p>h;h++)n=s[h],o.push(""+this.getClass("target-attached")+"-"+n);return l(function(){return null!=f._addAttachClasses?(S(f.element,f._addAttachClasses,o),S(f.target,f._addAttachClasses,o),f._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,i,n,l,a,c,g,m,v,y,w,C,T,O,x,S,E,A,M,L,B,W,_,P,z,H,F,k,N,Y,X,j,q,U,I,R=this;if(null==t&&(t=!0),this.enabled){for(this.clearCache(),L=h(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,L),e=this.cache("element-bounds",function(){return u(R.element)}),z=e.width,n=e.height,0===z&&0===n&&null!=this.lastSize?(Y=this.lastSize,z=Y.width,n=Y.height):this.lastSize={width:z,height:n},_=W=this.cache("target-bounds",function(){return R.getTargetBounds()}),v=b(r(this.attachment),{width:z,height:n}),B=b(r(L),_),a=b(this.offset,{width:z,height:n}),c=b(this.targetOffset,_),v=s(v,a),B=s(B,c),l=W.left+B.left-v.left,P=W.top+B.top-v.top,X=o.modules,H=0,k=X.length;k>H;H++)if(g=X[H],x=g.position.call(this,{left:l,top:P,targetAttachment:L,targetPos:W,attachment:this.attachment,elementPos:e,offset:v,targetOffset:B,manualOffset:a,manualTargetOffset:c,scrollbarSize:A}),null!=x&&"object"==typeof x){if(x===!1)return!1;P=x.top,l=x.left}if(m={page:{top:P,left:l},viewport:{top:P-pageYOffset,bottom:pageYOffset-P-n+innerHeight,left:l-pageXOffset,right:pageXOffset-l-z+innerWidth}},document.body.scrollWidth>window.innerWidth&&(A=this.cache("scrollbar-size",d),m.viewport.bottom-=A.height),document.body.scrollHeight>window.innerHeight&&(A=this.cache("scrollbar-size",d),m.viewport.right-=A.width),(""!==(j=document.body.style.position)&&"static"!==j||""!==(q=document.body.parentElement.style.position)&&"static"!==q)&&(m.page.bottom=document.body.scrollHeight-P-n,m.page.right=document.body.scrollWidth-l-z),(null!=(U=this.options.optimizations)?U.moveElement:void 0)!==!1&&null==this.targetModifier){for(w=this.cache("target-offsetparent",function(){return f(R.target)}),O=this.cache("target-offsetparent-bounds",function(){return u(w)}),T=getComputedStyle(w),i=getComputedStyle(this.element),C=O,y={},I=["Top","Left","Bottom","Right"],F=0,N=I.length;N>F;F++)M=I[F],y[M.toLowerCase()]=parseFloat(T["border"+M+"Width"]);O.right=document.body.scrollWidth-O.left-C.width+y.right,O.bottom=document.body.scrollHeight-O.top-C.height+y.bottom,m.page.top>=O.top+y.top&&m.page.bottom>=O.bottom&&m.page.left>=O.left+y.left&&m.page.right>=O.right&&(E=w.scrollTop,S=w.scrollLeft,m.offset={top:m.page.top-O.top+E-y.top,left:m.page.left-O.left+S-y.left})}return this.move(m),this.history.unshift(m),this.history.length>3&&this.history.pop(),t&&p(),!0}},t.prototype.move=function(t){var e,i,o,n,s,r,h,p,u,c,d,g,m,v,b,y,w,C=this;if(null!=this.element.parentNode){p={};for(c in t){p[c]={};for(n in t[c]){for(o=!1,y=this.history,v=0,b=y.length;b>v;v++)if(h=y[v],!E(null!=(w=h[c])?w[n]:void 0,t[c][n])){o=!0;break}o||(p[c][n]=!0)}}e={top:"",left:"",right:"",bottom:""},u=function(t,i){var o,n,s;return(null!=(s=C.options.optimizations)?s.gpu:void 0)===!1?(t.top?e.top=""+i.top+"px":e.bottom=""+i.bottom+"px",t.left?e.left=""+i.left+"px":e.right=""+i.right+"px"):(t.top?(e.top=0,n=i.top):(e.bottom=0,n=-i.bottom),t.left?(e.left=0,o=i.left):(e.right=0,o=-i.right),e[x]="translateX("+Math.round(o)+"px) translateY("+Math.round(n)+"px)","msTransform"!==x?e[x]+=" translateZ(0)":void 0)},s=!1,(p.page.top||p.page.bottom)&&(p.page.left||p.page.right)?(e.position="absolute",u(p.page,t.page)):(p.viewport.top||p.viewport.bottom)&&(p.viewport.left||p.viewport.right)?(e.position="fixed",u(p.viewport,t.viewport)):null!=p.offset&&p.offset.top&&p.offset.left?(e.position="absolute",r=this.cache("target-offsetparent",function(){return f(C.target)}),f(this.element)!==r&&l(function(){return C.element.parentNode.removeChild(C.element),r.appendChild(C.element)}),u(p.offset,t.offset),s=!0):(e.position="absolute",u({top:!0,left:!0},t.page)),s||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),m={},g=!1;for(n in e)d=e[n],i=this.element.style[n],""===i||""===d||"top"!==n&&"left"!==n&&"bottom"!==n&&"right"!==n||(i=parseFloat(i),d=parseFloat(d)),i!==d&&(g=!0,m[n]=e[n]);return g?l(function(){return a(C.element.style,m)}):void 0}},t}(),o.position=C,this.Tether=a(A,o)}.call(this),function(){var t,e,i,o,n,s,r,h,l,a,p=[].indexOf||function(t){for(var e=0,i=this.length;i>e;e++)if(e in this&&this[e]===t)return e;return-1};a=this.Tether.Utils,r=a.getOuterSize,s=a.getBounds,h=a.getSize,o=a.extend,l=a.updateClasses,i=a.defer,e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},t=["left","top","right","bottom"],n=function(e,i){var o,n,r,h,l,a,p;if("scrollParent"===i?i=e.scrollParent:"window"===i&&(i=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),i===document&&(i=i.documentElement),null!=i.nodeType)for(n=h=s(i),l=getComputedStyle(i),i=[n.left,n.top,h.width+n.left,h.height+n.top],o=a=0,p=t.length;p>a;o=++a)r=t[o],r=r[0].toUpperCase()+r.substr(1),"Top"===r||"Left"===r?i[o]+=parseFloat(l["border"+r+"Width"]):i[o]-=parseFloat(l["border"+r+"Width"]);return i},this.Tether.modules.push({position:function(e){var r,h,a,u,f,c,d,g,m,v,b,y,w,C,T,O,x,S,E,A,M,L,B,W,_,P,z,H,F,k,N,Y,X,j,q,U,I,R,D,Z,$,V,G,J,K,Q,te,ee=this;if(P=e.top,b=e.left,M=e.targetAttachment,!this.options.constraints)return!0;for(S=function(e){var i,o,n,s;for(ee.removeClass(e),s=[],o=0,n=t.length;n>o;o++)i=t[o],s.push(ee.removeClass(""+e+"-"+i));return s},Z=this.cache("element-bounds",function(){return s(ee.element)}),v=Z.height,z=Z.width,0===z&&0===v&&null!=this.lastSize&&($=this.lastSize,z=$.width,v=$.height),B=this.cache("target-bounds",function(){return ee.getTargetBounds()}),L=B.height,W=B.width,A={},m={},h=[this.getClass("pinned"),this.getClass("out-of-bounds")],V=this.options.constraints,H=0,Y=V.length;Y>H;H++)g=V[H],g.outOfBoundsClass&&h.push(g.outOfBoundsClass),g.pinnedClass&&h.push(g.pinnedClass);for(F=0,X=h.length;X>F;F++)for(d=h[F],G=["left","top","right","bottom"],k=0,j=G.length;j>k;k++)E=G[k],h.push(""+d+"-"+E);for(r=[],A=o({},M),m=o({},this.attachment),J=this.options.constraints,N=0,q=J.length;q>N;N++){if(g=J[N],_=g.to,a=g.attachment,T=g.pin,null==a&&(a=""),p.call(a," ")>=0?(K=a.split(" "),c=K[0],f=K[1]):f=c=a,u=n(this,_),("target"===c||"both"===c)&&(Pu[3]&&"bottom"===A.top&&(P-=L,A.top="top")),"together"===c&&(Pu[3]&&"bottom"===A.top&&("top"===m.top?(P-=L,A.top="top",P-=v,m.top="bottom"):"bottom"===m.top&&(P-=L,A.top="top",P+=v,m.top="top")),"middle"===A.top&&(P+v>u[3]&&"top"===m.top?(P-=v,m.top="bottom"):Pu[2]&&"right"===A.left&&(b-=W,A.left="left")),"together"===f&&(bu[2]&&"right"===A.left?"left"===m.left?(b-=W,A.left="left",b-=z,m.left="right"):"right"===m.left&&(b-=W,A.left="left",b+=z,m.left="left"):"center"===A.left&&(b+z>u[2]&&"left"===m.left?(b-=z,m.left="right"):bu[3]&&"top"===m.top&&(P-=v,m.top="bottom")),("element"===f||"both"===f)&&(bu[2]&&"left"===m.left&&(b-=z,m.left="right")),"string"==typeof T?T=function(){var t,e,i,o;for(i=T.split(","),o=[],e=0,t=i.length;t>e;e++)C=i[e],o.push(C.trim());return o}():T===!0&&(T=["top","left","right","bottom"]),T||(T=[]),O=[],y=[],P=0?(P=u[1],O.push("top")):y.push("top")),P+v>u[3]&&(p.call(T,"bottom")>=0?(P=u[3]-v,O.push("bottom")):y.push("bottom")),b=0?(b=u[0],O.push("left")):y.push("left")),b+z>u[2]&&(p.call(T,"right")>=0?(b=u[2]-z,O.push("right")):y.push("right")),O.length)for(x=null!=(Q=this.options.pinnedClass)?Q:this.getClass("pinned"),r.push(x),R=0,U=O.length;U>R;R++)E=O[R],r.push(""+x+"-"+E);if(y.length)for(w=null!=(te=this.options.outOfBoundsClass)?te:this.getClass("out-of-bounds"),r.push(w),D=0,I=y.length;I>D;D++)E=y[D],r.push(""+w+"-"+E);(p.call(O,"left")>=0||p.call(O,"right")>=0)&&(m.left=A.left=!1),(p.call(O,"top")>=0||p.call(O,"bottom")>=0)&&(m.top=A.top=!1),(A.top!==M.top||A.left!==M.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,A)}return i(function(){return l(ee.target,r,h),l(ee.element,r,h)}),{top:P,left:b}}})}.call(this),function(){var t,e,i,o;o=this.Tether.Utils,e=o.getBounds,i=o.updateClasses,t=o.defer,this.Tether.modules.push({position:function(o){var n,s,r,h,l,a,p,u,f,c,d,g,m,v,b,y,w,C,T,O,x,S,E,A,M,L=this;if(d=o.top,a=o.left,x=this.cache("element-bounds",function(){return e(L.element)}),l=x.height,g=x.width,c=this.getTargetBounds(),h=d+l,p=a+g,n=[],d<=c.bottom&&h>=c.top)for(S=["left","right"],m=0,w=S.length;w>m;m++)u=S[m],((E=c[u])===a||E===p)&&n.push(u);if(a<=c.right&&p>=c.left)for(A=["top","bottom"],v=0,C=A.length;C>v;v++)u=A[v],((M=c[u])===d||M===h)&&n.push(u);for(r=[],s=[],f=["left","top","right","bottom"],r.push(this.getClass("abutted")),b=0,T=f.length;T>b;b++)u=f[b],r.push(""+this.getClass("abutted")+"-"+u);for(n.length&&s.push(this.getClass("abutted")),y=0,O=n.length;O>y;y++)u=n[y],s.push(""+this.getClass("abutted")+"-"+u);return t(function(){return i(L.target,s,r),i(L.element,s,r)}),!0}})}.call(this),function(){this.Tether.modules.push({position:function(t){var e,i,o,n,s,r,h;return r=t.top,e=t.left,this.options.shift?(i=function(t){return"function"==typeof t?t.call(this,{top:r,left:e}):t},o=i(this.options.shift),"string"==typeof o?(o=o.split(" "),o[1]||(o[1]=o[0]),s=o[0],n=o[1],s=parseFloat(s,10),n=parseFloat(n,10)):(h=[o.top,o.left],s=h[0],n=h[1]),r+=s,e+=n,{top:r,left:e}):void 0}})}.call(this),this.Tether}),function(){var t,e,i,o,n,s,r,h,l,a,p,u,f,c,d,g=function(t,e){return function(){return t.apply(e,arguments)}},m={}.hasOwnProperty,v=function(t,e){function i(){this.constructor=t}for(var o in e)m.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t};d=Tether.Utils,h=d.extend,f=d.removeClass,s=d.addClass,a=d.hasClass,e=d.Evented,l=d.getBounds,c=d.uniqueId,i=new e,t={top:"bottom center",left:"middle right",right:"middle left",bottom:"top center"},r=function(t){var e;return e=document.createElement("div"),e.innerHTML=t,e.children[0]},p=function(t,e){var i,o,n,s,r;return i=null!=(o=null!=(n=null!=(s=null!=(r=t.matches)?r:t.matchesSelector)?s:t.webkitMatchesSelector)?n:t.mozMatchesSelector)?o:t.oMatchesSelector,i.call(t,e)},u=function(t,e){var i,o,n,s,r,h;if(null==t)return t;if("object"==typeof t)return t;for(s=t.split(" "),s.length>e.length&&(s[0]=s.slice(0,+(s.length-e.length)+1||9e9).join(" "),s.splice(1,s.length-e.length)),o={},i=r=0,h=e.length;h>r;i=++r)n=e[i],o[n]=s[i];return o},o=function(e){function i(t,e){this.tour=t,this.destroy=g(this.destroy,this),this.scrollTo=g(this.scrollTo,this),this.complete=g(this.complete,this),this.cancel=g(this.cancel,this),this.isOpen=g(this.isOpen,this),this.hide=g(this.hide,this),this.show=g(this.show,this),this.setOptions(e)}return v(i,e),i.prototype.setOptions=function(t){var e,i,o,n;if(this.options=null!=t?t:{},this.destroy(),this.id=this.options.id||this.id||"step-"+c(),this.options.when){n=this.options.when;for(e in n)i=n[e],this.on(e,i,this)}return null!=(o=this.options).buttons?(o=this.options).buttons:o.buttons=[{text:"Next",action:this.tour.next}]},i.prototype.getTour=function(){return this.tour},i.prototype.bindAdvance=function(){var t,e,i,o,n=this;return o=u(this.options.advanceOn,["selector","event"]),t=o.event,i=o.selector,e=function(t){if(n.isOpen())if(null!=i){if(p(t.target,i))return n.tour.next()}else if(n.el&&t.target===n.el)return n.tour.next()},document.body.addEventListener(t,e),this.on("destroy",function(){return document.body.removeEventListener(t,e)})},i.prototype.getAttachTo=function(){var t;if(t=u(this.options.attachTo,["element","on"]),null==t&&(t={}),"string"==typeof t.element&&(t.element=document.querySelector(t.element),null==t.element))throw new Error("Shepherd step's attachTo was not found in the page");return t},i.prototype.setupTether=function(){var e,i,o;if("undefined"==typeof Tether||null===Tether)throw new Error("Using the attachment feature of Shepherd requires the Tether library");return i=this.getAttachTo(),e=t[i.on||"right"],null==i.element&&(i.element="viewport",e="middle center"),o={classPrefix:"shepherd",element:this.el,constraints:[{to:"window",pin:!0,attachment:"together"}],target:i.element,offset:i.offset||"0 0",attachment:e},this.tether=new Tether(h(o,this.options.tetherOptions))},i.prototype.show=function(){var t=this;return null==this.el&&this.render(),s(this.el,"shepherd-open"),document.body.setAttribute("data-shepherd-step",this.id),this.setupTether(),this.options.scrollTo&&setTimeout(function(){return t.scrollTo()}),this.trigger("show")},i.prototype.hide=function(){var t;return f(this.el,"shepherd-open"),document.body.removeAttribute("data-shepherd-step"),null!=(t=this.tether)&&t.destroy(),this.tether=null,this.trigger("hide")},i.prototype.isOpen=function(){return a(this.el,"shepherd-open")},i.prototype.cancel=function(){return this.tour.cancel(),this.trigger("cancel")},i.prototype.complete=function(){return this.tour.complete(),this.trigger("complete")},i.prototype.scrollTo=function(){var t;return t=this.getAttachTo().element,null!=t?t.scrollIntoView():void 0},i.prototype.destroy=function(){var t;return null!=this.el&&(document.body.removeChild(this.el),delete this.el),null!=(t=this.tether)&&t.destroy(),this.tether=null,this.trigger("destroy")},i.prototype.render=function(){var t,e,i,o,n,s,h,l,a,p,u,f,c,d,g,m,v;if(null!=this.el&&this.destroy(),this.el=r(""),o=document.createElement("div"),o.className="shepherd-content",this.el.appendChild(o),s=document.createElement("header"),o.appendChild(s),null!=this.options.title&&(s.innerHTML+=""+this.options.title+"
",this.el.className+=" shepherd-has-title"),this.options.showCancelLink&&(h=r("✕"),s.appendChild(h),this.el.className+=" shepherd-has-cancel-link",this.bindCancelLink(h)),null!=this.options.text){for(p=r(""),a=this.options.text,"string"==typeof a&&(a=[a]),u=0,c=a.length;c>u;u++)l=a[u],p.innerHTML+=""+l+"
";o.appendChild(p)}if(n=document.createElement("footer"),this.options.buttons){for(e=r(""),m=this.options.buttons,f=0,d=m.length;d>f;f++)i=m[f],t=r(""+i.text+""),e.appendChild(t),this.bindButtonEvents(i,t.querySelector("a"));n.appendChild(e)}return o.appendChild(n),document.body.appendChild(this.el),this.setupTether(),this.options.advanceOn?this.bindAdvance():void 0},i.prototype.bindCancelLink=function(t){var e=this;return t.addEventListener("click",function(t){return t.preventDefault(),e.cancel()})},i.prototype.bindButtonEvents=function(t,e){var i,o,n,s,r=this;null==t.events&&(t.events={}),null!=t.action&&(t.events.click=t.action),s=t.events;for(i in s)o=s[i],"string"==typeof o&&(n=o,o=function(){return r.tour.show(n)}),e.addEventListener(i,o);return this.on("destroy",function(){var n,s;n=t.events,s=[];for(i in n)o=n[i],s.push(e.removeEventListener(i,o));return s})},i}(e),n=function(t){function e(t){var e,o,n,s,r,h=this;for(this.options=null!=t?t:{},this.hide=g(this.hide,this),this.complete=g(this.complete,this),this.cancel=g(this.cancel,this),this.back=g(this.back,this),this.next=g(this.next,this),this.steps=null!=(s=this.options.steps)?s:[],r=["complete","cancel","hide","start","show","active","inactive"],o=0,n=r.length;n>o;o++)e=r[o],this.on(e,function(t){return null==t&&(t={}),t.tour=h,i.trigger(e,t)})}return v(e,t),e.prototype.addStep=function(t,e){var i;return null==e&&(e=t),e instanceof o?e.tour=this:(("string"==(i=typeof t)||"number"===i)&&(e.id=t.toString()),e=h({},this.options.defaults,e),e=new o(this,e)),this.steps.push(e),e},e.prototype.getById=function(t){var e,i,o,n;for(n=this.steps,i=0,o=n.length;o>i;i++)if(e=n[i],e.id===t)return e},e.prototype.getCurrentStep=function(){return this.currentStep},e.prototype.next=function(){var t;return t=this.steps.indexOf(this.currentStep),t===this.steps.length-1?(this.hide(t),this.trigger("complete"),this.done()):this.show(t+1)},e.prototype.back=function(){var t;return t=this.steps.indexOf(this.currentStep),this.show(t-1)},e.prototype.cancel=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("cancel"),this.done()},e.prototype.complete=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("complete"),this.done()},e.prototype.hide=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("hide"),this.done()},e.prototype.done=function(){return i.activeTour=null,f(document.body,"shepherd-active"),this.trigger("inactive",{tour:this})},e.prototype.show=function(t){var e;return null==t&&(t=0),this.currentStep?this.currentStep.hide():(s(document.body,"shepherd-active"),this.trigger("active",{tour:this})),i.activeTour=this,e="string"==typeof t?this.getById(t):this.steps[t],e?(this.trigger("show",{step:e,previous:this.currentStep}),this.currentStep=e,e.show()):void 0},e.prototype.start=function(){return this.trigger("start"),this.currentStep=null,this.next()},e}(e),h(i,{Tour:n,Step:o,Evented:e}),window.Shepherd=i}.call(this);
\ No newline at end of file
diff --git a/ajax/libs/shepherd/0.5.1/shepherd.js b/ajax/libs/shepherd/0.5.1/shepherd.js
new file mode 100644
index 000000000..c8cc25192
--- /dev/null
+++ b/ajax/libs/shepherd/0.5.1/shepherd.js
@@ -0,0 +1,1924 @@
+/*! shepherd 0.5.1 */
+/*! tether 0.6.5 */
+
+
+(function(root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(factory);
+ } else if (typeof exports === 'object') {
+ module.exports = factory(require,exports,module);
+ } else {
+ root.Tether = factory();
+ }
+}(this, function(require,exports,module) {
+
+(function() {
+ var Evented, addClass, defer, deferred, extend, flush, getBounds, getOffsetParent, getOrigin, getScrollBarSize, getScrollParent, hasClass, node, removeClass, uniqueId, updateClasses, zeroPosCache,
+ __hasProp = {}.hasOwnProperty,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
+ __slice = [].slice;
+
+ if (this.Tether == null) {
+ this.Tether = {
+ modules: []
+ };
+ }
+
+ getScrollParent = function(el) {
+ var parent, position, scrollParent, style, _ref;
+ position = getComputedStyle(el).position;
+ if (position === 'fixed') {
+ return el;
+ }
+ scrollParent = void 0;
+ parent = el;
+ while (parent = parent.parentNode) {
+ try {
+ style = getComputedStyle(parent);
+ } catch (_error) {}
+ if (style == null) {
+ return parent;
+ }
+ if (/(auto|scroll)/.test(style['overflow'] + style['overflow-y'] + style['overflow-x'])) {
+ if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) {
+ return parent;
+ }
+ }
+ }
+ return document.body;
+ };
+
+ uniqueId = (function() {
+ var id;
+ id = 0;
+ return function() {
+ return id++;
+ };
+ })();
+
+ zeroPosCache = {};
+
+ getOrigin = function(doc) {
+ var id, k, node, v, _ref;
+ node = doc._tetherZeroElement;
+ if (node == null) {
+ node = doc.createElement('div');
+ node.setAttribute('data-tether-id', uniqueId());
+ extend(node.style, {
+ top: 0,
+ left: 0,
+ position: 'absolute'
+ });
+ doc.body.appendChild(node);
+ doc._tetherZeroElement = node;
+ }
+ id = node.getAttribute('data-tether-id');
+ if (zeroPosCache[id] == null) {
+ zeroPosCache[id] = {};
+ _ref = node.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ zeroPosCache[id][k] = v;
+ }
+ defer(function() {
+ return zeroPosCache[id] = void 0;
+ });
+ }
+ return zeroPosCache[id];
+ };
+
+ node = null;
+
+ getBounds = function(el) {
+ var box, doc, docEl, k, origin, v, _ref;
+ if (el === document) {
+ doc = document;
+ el = document.documentElement;
+ } else {
+ doc = el.ownerDocument;
+ }
+ docEl = doc.documentElement;
+ box = {};
+ _ref = el.getBoundingClientRect();
+ for (k in _ref) {
+ v = _ref[k];
+ box[k] = v;
+ }
+ origin = getOrigin(doc);
+ box.top -= origin.top;
+ box.left -= origin.left;
+ if (box.width == null) {
+ box.width = document.body.scrollWidth - box.left - box.right;
+ }
+ if (box.height == null) {
+ box.height = document.body.scrollHeight - box.top - box.bottom;
+ }
+ box.top = box.top - docEl.clientTop;
+ box.left = box.left - docEl.clientLeft;
+ box.right = doc.body.clientWidth - box.width - box.left;
+ box.bottom = doc.body.clientHeight - box.height - box.top;
+ return box;
+ };
+
+ getOffsetParent = function(el) {
+ return el.offsetParent || document.documentElement;
+ };
+
+ getScrollBarSize = function() {
+ var inner, outer, width, widthContained, widthScroll;
+ inner = document.createElement('div');
+ inner.style.width = '100%';
+ inner.style.height = '200px';
+ outer = document.createElement('div');
+ extend(outer.style, {
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ pointerEvents: 'none',
+ visibility: 'hidden',
+ width: '200px',
+ height: '150px',
+ overflow: 'hidden'
+ });
+ outer.appendChild(inner);
+ document.body.appendChild(outer);
+ widthContained = inner.offsetWidth;
+ outer.style.overflow = 'scroll';
+ widthScroll = inner.offsetWidth;
+ if (widthContained === widthScroll) {
+ widthScroll = outer.clientWidth;
+ }
+ document.body.removeChild(outer);
+ width = widthContained - widthScroll;
+ return {
+ width: width,
+ height: width
+ };
+ };
+
+ extend = function(out) {
+ var args, key, obj, val, _i, _len, _ref;
+ if (out == null) {
+ out = {};
+ }
+ args = [];
+ Array.prototype.push.apply(args, arguments);
+ _ref = args.slice(1);
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ obj = _ref[_i];
+ if (obj) {
+ for (key in obj) {
+ if (!__hasProp.call(obj, key)) continue;
+ val = obj[key];
+ out[key] = val;
+ }
+ }
+ }
+ return out;
+ };
+
+ removeClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ if (cls.trim()) {
+ _results.push(el.classList.remove(cls));
+ }
+ }
+ return _results;
+ } else {
+ return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' ');
+ }
+ };
+
+ addClass = function(el, name) {
+ var cls, _i, _len, _ref, _results;
+ if (el.classList != null) {
+ _ref = name.split(' ');
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ cls = _ref[_i];
+ if (cls.trim()) {
+ _results.push(el.classList.add(cls));
+ }
+ }
+ return _results;
+ } else {
+ removeClass(el, name);
+ return el.className += " " + name;
+ }
+ };
+
+ hasClass = function(el, name) {
+ if (el.classList != null) {
+ return el.classList.contains(name);
+ } else {
+ return new RegExp("(^| )" + name + "( |$)", 'gi').test(el.className);
+ }
+ };
+
+ updateClasses = function(el, add, all) {
+ var cls, _i, _j, _len, _len1, _results;
+ for (_i = 0, _len = all.length; _i < _len; _i++) {
+ cls = all[_i];
+ if (__indexOf.call(add, cls) < 0) {
+ if (hasClass(el, cls)) {
+ removeClass(el, cls);
+ }
+ }
+ }
+ _results = [];
+ for (_j = 0, _len1 = add.length; _j < _len1; _j++) {
+ cls = add[_j];
+ if (!hasClass(el, cls)) {
+ _results.push(addClass(el, cls));
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ deferred = [];
+
+ defer = function(fn) {
+ return deferred.push(fn);
+ };
+
+ flush = function() {
+ var fn, _results;
+ _results = [];
+ while (fn = deferred.pop()) {
+ _results.push(fn());
+ }
+ return _results;
+ };
+
+ Evented = (function() {
+ function Evented() {}
+
+ Evented.prototype.on = function(event, handler, ctx, once) {
+ var _base;
+ if (once == null) {
+ once = false;
+ }
+ if (this.bindings == null) {
+ this.bindings = {};
+ }
+ if ((_base = this.bindings)[event] == null) {
+ _base[event] = [];
+ }
+ return this.bindings[event].push({
+ handler: handler,
+ ctx: ctx,
+ once: once
+ });
+ };
+
+ Evented.prototype.once = function(event, handler, ctx) {
+ return this.on(event, handler, ctx, true);
+ };
+
+ Evented.prototype.off = function(event, handler) {
+ var i, _ref, _results;
+ if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) {
+ return;
+ }
+ if (handler == null) {
+ return delete this.bindings[event];
+ } else {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ if (this.bindings[event][i].handler === handler) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ Evented.prototype.trigger = function() {
+ var args, ctx, event, handler, i, once, _ref, _ref1, _results;
+ event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+ if ((_ref = this.bindings) != null ? _ref[event] : void 0) {
+ i = 0;
+ _results = [];
+ while (i < this.bindings[event].length) {
+ _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once;
+ handler.apply(ctx != null ? ctx : this, args);
+ if (once) {
+ _results.push(this.bindings[event].splice(i, 1));
+ } else {
+ _results.push(i++);
+ }
+ }
+ return _results;
+ }
+ };
+
+ return Evented;
+
+ })();
+
+ this.Tether.Utils = {
+ getScrollParent: getScrollParent,
+ getBounds: getBounds,
+ getOffsetParent: getOffsetParent,
+ extend: extend,
+ addClass: addClass,
+ removeClass: removeClass,
+ hasClass: hasClass,
+ updateClasses: updateClasses,
+ defer: defer,
+ flush: flush,
+ uniqueId: uniqueId,
+ Evented: Evented,
+ getScrollBarSize: getScrollBarSize
+ };
+
+}).call(this);
+
+(function() {
+ var MIRROR_LR, MIRROR_TB, OFFSET_MAP, Tether, addClass, addOffset, attachmentToOffset, autoToFixedAttachment, defer, extend, flush, getBounds, getOffsetParent, getOuterSize, getScrollBarSize, getScrollParent, getSize, now, offsetToPx, parseAttachment, parseOffset, position, removeClass, tethers, transformKey, updateClasses, within, _Tether, _ref,
+ __slice = [].slice,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+
+ if (this.Tether == null) {
+ throw new Error("You must include the utils.js file before tether.js");
+ }
+
+ Tether = this.Tether;
+
+ _ref = Tether.Utils, getScrollParent = _ref.getScrollParent, getSize = _ref.getSize, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getOffsetParent = _ref.getOffsetParent, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, updateClasses = _ref.updateClasses, defer = _ref.defer, flush = _ref.flush, getScrollBarSize = _ref.getScrollBarSize;
+
+ within = function(a, b, diff) {
+ if (diff == null) {
+ diff = 1;
+ }
+ return (a + diff >= b && b >= a - diff);
+ };
+
+ transformKey = (function() {
+ var el, key, _i, _len, _ref1;
+ el = document.createElement('div');
+ _ref1 = ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform'];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ key = _ref1[_i];
+ if (el.style[key] !== void 0) {
+ return key;
+ }
+ }
+ })();
+
+ tethers = [];
+
+ position = function() {
+ var tether, _i, _len;
+ for (_i = 0, _len = tethers.length; _i < _len; _i++) {
+ tether = tethers[_i];
+ tether.position(false);
+ }
+ return flush();
+ };
+
+ now = function() {
+ var _ref1;
+ return (_ref1 = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref1 : +(new Date);
+ };
+
+ (function() {
+ var event, lastCall, lastDuration, pendingTimeout, tick, _i, _len, _ref1, _results;
+ lastCall = null;
+ lastDuration = null;
+ pendingTimeout = null;
+ tick = function() {
+ if ((lastDuration != null) && lastDuration > 16) {
+ lastDuration = Math.min(lastDuration - 16, 250);
+ pendingTimeout = setTimeout(tick, 250);
+ return;
+ }
+ if ((lastCall != null) && (now() - lastCall) < 10) {
+ return;
+ }
+ if (pendingTimeout != null) {
+ clearTimeout(pendingTimeout);
+ pendingTimeout = null;
+ }
+ lastCall = now();
+ position();
+ return lastDuration = now() - lastCall;
+ };
+ _ref1 = ['resize', 'scroll', 'touchmove'];
+ _results = [];
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ event = _ref1[_i];
+ _results.push(window.addEventListener(event, tick));
+ }
+ return _results;
+ })();
+
+ MIRROR_LR = {
+ center: 'center',
+ left: 'right',
+ right: 'left'
+ };
+
+ MIRROR_TB = {
+ middle: 'middle',
+ top: 'bottom',
+ bottom: 'top'
+ };
+
+ OFFSET_MAP = {
+ top: 0,
+ left: 0,
+ middle: '50%',
+ center: '50%',
+ bottom: '100%',
+ right: '100%'
+ };
+
+ autoToFixedAttachment = function(attachment, relativeToAttachment) {
+ var left, top;
+ left = attachment.left, top = attachment.top;
+ if (left === 'auto') {
+ left = MIRROR_LR[relativeToAttachment.left];
+ }
+ if (top === 'auto') {
+ top = MIRROR_TB[relativeToAttachment.top];
+ }
+ return {
+ left: left,
+ top: top
+ };
+ };
+
+ attachmentToOffset = function(attachment) {
+ var _ref1, _ref2;
+ return {
+ left: (_ref1 = OFFSET_MAP[attachment.left]) != null ? _ref1 : attachment.left,
+ top: (_ref2 = OFFSET_MAP[attachment.top]) != null ? _ref2 : attachment.top
+ };
+ };
+
+ addOffset = function() {
+ var left, offsets, out, top, _i, _len, _ref1;
+ offsets = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ out = {
+ top: 0,
+ left: 0
+ };
+ for (_i = 0, _len = offsets.length; _i < _len; _i++) {
+ _ref1 = offsets[_i], top = _ref1.top, left = _ref1.left;
+ if (typeof top === 'string') {
+ top = parseFloat(top, 10);
+ }
+ if (typeof left === 'string') {
+ left = parseFloat(left, 10);
+ }
+ out.top += top;
+ out.left += left;
+ }
+ return out;
+ };
+
+ offsetToPx = function(offset, size) {
+ if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) {
+ offset.left = parseFloat(offset.left, 10) / 100 * size.width;
+ }
+ if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) {
+ offset.top = parseFloat(offset.top, 10) / 100 * size.height;
+ }
+ return offset;
+ };
+
+ parseAttachment = parseOffset = function(value) {
+ var left, top, _ref1;
+ _ref1 = value.split(' '), top = _ref1[0], left = _ref1[1];
+ return {
+ top: top,
+ left: left
+ };
+ };
+
+ _Tether = (function() {
+ _Tether.modules = [];
+
+ function _Tether(options) {
+ this.position = __bind(this.position, this);
+ var module, _i, _len, _ref1, _ref2;
+ tethers.push(this);
+ this.history = [];
+ this.setOptions(options, false);
+ _ref1 = Tether.modules;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ module = _ref1[_i];
+ if ((_ref2 = module.initialize) != null) {
+ _ref2.call(this);
+ }
+ }
+ this.position();
+ }
+
+ _Tether.prototype.getClass = function(key) {
+ var _ref1, _ref2;
+ if ((_ref1 = this.options.classes) != null ? _ref1[key] : void 0) {
+ return this.options.classes[key];
+ } else if (((_ref2 = this.options.classes) != null ? _ref2[key] : void 0) !== false) {
+ if (this.options.classPrefix) {
+ return "" + this.options.classPrefix + "-" + key;
+ } else {
+ return key;
+ }
+ } else {
+ return '';
+ }
+ };
+
+ _Tether.prototype.setOptions = function(options, position) {
+ var defaults, key, _i, _len, _ref1, _ref2;
+ this.options = options;
+ if (position == null) {
+ position = true;
+ }
+ defaults = {
+ offset: '0 0',
+ targetOffset: '0 0',
+ targetAttachment: 'auto auto',
+ classPrefix: 'tether'
+ };
+ this.options = extend(defaults, this.options);
+ _ref1 = this.options, this.element = _ref1.element, this.target = _ref1.target, this.targetModifier = _ref1.targetModifier;
+ if (this.target === 'viewport') {
+ this.target = document.body;
+ this.targetModifier = 'visible';
+ } else if (this.target === 'scroll-handle') {
+ this.target = document.body;
+ this.targetModifier = 'scroll-handle';
+ }
+ _ref2 = ['element', 'target'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ key = _ref2[_i];
+ if (this[key] == null) {
+ throw new Error("Tether Error: Both element and target must be defined");
+ }
+ if (this[key].jquery != null) {
+ this[key] = this[key][0];
+ } else if (typeof this[key] === 'string') {
+ this[key] = document.querySelector(this[key]);
+ }
+ }
+ addClass(this.element, this.getClass('element'));
+ addClass(this.target, this.getClass('target'));
+ if (!this.options.attachment) {
+ throw new Error("Tether Error: You must provide an attachment");
+ }
+ this.targetAttachment = parseAttachment(this.options.targetAttachment);
+ this.attachment = parseAttachment(this.options.attachment);
+ this.offset = parseOffset(this.options.offset);
+ this.targetOffset = parseOffset(this.options.targetOffset);
+ if (this.scrollParent != null) {
+ this.disable();
+ }
+ if (this.targetModifier === 'scroll-handle') {
+ this.scrollParent = this.target;
+ } else {
+ this.scrollParent = getScrollParent(this.target);
+ }
+ if (this.options.enabled !== false) {
+ return this.enable(position);
+ }
+ };
+
+ _Tether.prototype.getTargetBounds = function() {
+ var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target;
+ if (this.targetModifier != null) {
+ switch (this.targetModifier) {
+ case 'visible':
+ if (this.target === document.body) {
+ return {
+ top: pageYOffset,
+ left: pageXOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(this.target);
+ out = {
+ height: bounds.height,
+ width: bounds.width,
+ top: bounds.top,
+ left: bounds.left
+ };
+ out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
+ out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight)));
+ out.height = Math.min(innerHeight, out.height);
+ out.height -= 2;
+ out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
+ out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth)));
+ out.width = Math.min(innerWidth, out.width);
+ out.width -= 2;
+ if (out.top < pageYOffset) {
+ out.top = pageYOffset;
+ }
+ if (out.left < pageXOffset) {
+ out.left = pageXOffset;
+ }
+ return out;
+ }
+ break;
+ case 'scroll-handle':
+ target = this.target;
+ if (target === document.body) {
+ target = document.documentElement;
+ bounds = {
+ left: pageXOffset,
+ top: pageYOffset,
+ height: innerHeight,
+ width: innerWidth
+ };
+ } else {
+ bounds = getBounds(target);
+ }
+ style = getComputedStyle(target);
+ hasBottomScroll = target.scrollWidth > target.clientWidth || 'scroll' === [style.overflow, style.overflowX] || this.target !== document.body;
+ scrollBottom = 0;
+ if (hasBottomScroll) {
+ scrollBottom = 15;
+ }
+ height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom;
+ out = {
+ width: 15,
+ height: height * 0.975 * (height / target.scrollHeight),
+ left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15
+ };
+ fitAdj = 0;
+ if (height < 408 && this.target === document.body) {
+ fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58;
+ }
+ if (this.target !== document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ scrollPercentage = this.target.scrollTop / (target.scrollHeight - height);
+ out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth);
+ if (this.target === document.body) {
+ out.height = Math.max(out.height, 24);
+ }
+ return out;
+ }
+ } else {
+ return getBounds(this.target);
+ }
+ };
+
+ _Tether.prototype.clearCache = function() {
+ return this._cache = {};
+ };
+
+ _Tether.prototype.cache = function(k, getter) {
+ if (this._cache == null) {
+ this._cache = {};
+ }
+ if (this._cache[k] == null) {
+ this._cache[k] = getter.call(this);
+ }
+ return this._cache[k];
+ };
+
+ _Tether.prototype.enable = function(position) {
+ if (position == null) {
+ position = true;
+ }
+ addClass(this.target, this.getClass('enabled'));
+ addClass(this.element, this.getClass('enabled'));
+ this.enabled = true;
+ if (this.scrollParent !== document) {
+ this.scrollParent.addEventListener('scroll', this.position);
+ }
+ if (position) {
+ return this.position();
+ }
+ };
+
+ _Tether.prototype.disable = function() {
+ removeClass(this.target, this.getClass('enabled'));
+ removeClass(this.element, this.getClass('enabled'));
+ this.enabled = false;
+ if (this.scrollParent != null) {
+ return this.scrollParent.removeEventListener('scroll', this.position);
+ }
+ };
+
+ _Tether.prototype.destroy = function() {
+ var i, tether, _i, _len, _results;
+ this.disable();
+ _results = [];
+ for (i = _i = 0, _len = tethers.length; _i < _len; i = ++_i) {
+ tether = tethers[i];
+ if (tether === this) {
+ tethers.splice(i, 1);
+ break;
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ };
+
+ _Tether.prototype.updateAttachClasses = function(elementAttach, targetAttach) {
+ var add, all, side, sides, _i, _j, _len, _len1, _ref1,
+ _this = this;
+ if (elementAttach == null) {
+ elementAttach = this.attachment;
+ }
+ if (targetAttach == null) {
+ targetAttach = this.targetAttachment;
+ }
+ sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'];
+ if ((_ref1 = this._addAttachClasses) != null ? _ref1.length : void 0) {
+ this._addAttachClasses.splice(0, this._addAttachClasses.length);
+ }
+ add = this._addAttachClasses != null ? this._addAttachClasses : this._addAttachClasses = [];
+ if (elementAttach.top) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.top);
+ }
+ if (elementAttach.left) {
+ add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.left);
+ }
+ if (targetAttach.top) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.top);
+ }
+ if (targetAttach.left) {
+ add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.left);
+ }
+ all = [];
+ for (_i = 0, _len = sides.length; _i < _len; _i++) {
+ side = sides[_i];
+ all.push("" + (this.getClass('element-attached')) + "-" + side);
+ }
+ for (_j = 0, _len1 = sides.length; _j < _len1; _j++) {
+ side = sides[_j];
+ all.push("" + (this.getClass('target-attached')) + "-" + side);
+ }
+ return defer(function() {
+ if (_this._addAttachClasses == null) {
+ return;
+ }
+ updateClasses(_this.element, _this._addAttachClasses, all);
+ updateClasses(_this.target, _this._addAttachClasses, all);
+ return _this._addAttachClasses = void 0;
+ });
+ };
+
+ _Tether.prototype.position = function(flushChanges) {
+ var elementPos, elementStyle, height, left, manualOffset, manualTargetOffset, module, next, offset, offsetBorder, offsetParent, offsetParentSize, offsetParentStyle, offsetPosition, ret, scrollLeft, scrollTop, scrollbarSize, side, targetAttachment, targetOffset, targetPos, targetSize, top, width, _i, _j, _len, _len1, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6,
+ _this = this;
+ if (flushChanges == null) {
+ flushChanges = true;
+ }
+ if (!this.enabled) {
+ return;
+ }
+ this.clearCache();
+ targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment);
+ this.updateAttachClasses(this.attachment, targetAttachment);
+ elementPos = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ });
+ width = elementPos.width, height = elementPos.height;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref1 = this.lastSize, width = _ref1.width, height = _ref1.height;
+ } else {
+ this.lastSize = {
+ width: width,
+ height: height
+ };
+ }
+ targetSize = targetPos = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ offset = offsetToPx(attachmentToOffset(this.attachment), {
+ width: width,
+ height: height
+ });
+ targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize);
+ manualOffset = offsetToPx(this.offset, {
+ width: width,
+ height: height
+ });
+ manualTargetOffset = offsetToPx(this.targetOffset, targetSize);
+ offset = addOffset(offset, manualOffset);
+ targetOffset = addOffset(targetOffset, manualTargetOffset);
+ left = targetPos.left + targetOffset.left - offset.left;
+ top = targetPos.top + targetOffset.top - offset.top;
+ _ref2 = Tether.modules;
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ module = _ref2[_i];
+ ret = module.position.call(this, {
+ left: left,
+ top: top,
+ targetAttachment: targetAttachment,
+ targetPos: targetPos,
+ attachment: this.attachment,
+ elementPos: elementPos,
+ offset: offset,
+ targetOffset: targetOffset,
+ manualOffset: manualOffset,
+ manualTargetOffset: manualTargetOffset,
+ scrollbarSize: scrollbarSize
+ });
+ if ((ret == null) || typeof ret !== 'object') {
+ continue;
+ } else if (ret === false) {
+ return false;
+ } else {
+ top = ret.top, left = ret.left;
+ }
+ }
+ next = {
+ page: {
+ top: top,
+ left: left
+ },
+ viewport: {
+ top: top - pageYOffset,
+ bottom: pageYOffset - top - height + innerHeight,
+ left: left - pageXOffset,
+ right: pageXOffset - left - width + innerWidth
+ }
+ };
+ if (document.body.scrollWidth > window.innerWidth) {
+ scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
+ next.viewport.bottom -= scrollbarSize.height;
+ }
+ if (document.body.scrollHeight > window.innerHeight) {
+ scrollbarSize = this.cache('scrollbar-size', getScrollBarSize);
+ next.viewport.right -= scrollbarSize.width;
+ }
+ if (((_ref3 = document.body.style.position) !== '' && _ref3 !== 'static') || ((_ref4 = document.body.parentElement.style.position) !== '' && _ref4 !== 'static')) {
+ next.page.bottom = document.body.scrollHeight - top - height;
+ next.page.right = document.body.scrollWidth - left - width;
+ }
+ if (((_ref5 = this.options.optimizations) != null ? _ref5.moveElement : void 0) !== false && (this.targetModifier == null)) {
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ offsetPosition = this.cache('target-offsetparent-bounds', function() {
+ return getBounds(offsetParent);
+ });
+ offsetParentStyle = getComputedStyle(offsetParent);
+ elementStyle = getComputedStyle(this.element);
+ offsetParentSize = offsetPosition;
+ offsetBorder = {};
+ _ref6 = ['Top', 'Left', 'Bottom', 'Right'];
+ for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
+ side = _ref6[_j];
+ offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle["border" + side + "Width"]);
+ }
+ offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right;
+ offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom;
+ if (next.page.top >= (offsetPosition.top + offsetBorder.top) && next.page.bottom >= offsetPosition.bottom) {
+ if (next.page.left >= (offsetPosition.left + offsetBorder.left) && next.page.right >= offsetPosition.right) {
+ scrollTop = offsetParent.scrollTop;
+ scrollLeft = offsetParent.scrollLeft;
+ next.offset = {
+ top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top,
+ left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left
+ };
+ }
+ }
+ }
+ this.move(next);
+ this.history.unshift(next);
+ if (this.history.length > 3) {
+ this.history.pop();
+ }
+ if (flushChanges) {
+ flush();
+ }
+ return true;
+ };
+
+ _Tether.prototype.move = function(position) {
+ var css, elVal, found, key, moved, offsetParent, point, same, transcribe, type, val, write, writeCSS, _i, _len, _ref1, _ref2,
+ _this = this;
+ if (this.element.parentNode == null) {
+ return;
+ }
+ same = {};
+ for (type in position) {
+ same[type] = {};
+ for (key in position[type]) {
+ found = false;
+ _ref1 = this.history;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ point = _ref1[_i];
+ if (!within((_ref2 = point[type]) != null ? _ref2[key] : void 0, position[type][key])) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ same[type][key] = true;
+ }
+ }
+ }
+ css = {
+ top: '',
+ left: '',
+ right: '',
+ bottom: ''
+ };
+ transcribe = function(same, pos) {
+ var xPos, yPos, _ref3;
+ if (((_ref3 = _this.options.optimizations) != null ? _ref3.gpu : void 0) !== false) {
+ if (same.top) {
+ css.top = 0;
+ yPos = pos.top;
+ } else {
+ css.bottom = 0;
+ yPos = -pos.bottom;
+ }
+ if (same.left) {
+ css.left = 0;
+ xPos = pos.left;
+ } else {
+ css.right = 0;
+ xPos = -pos.right;
+ }
+ css[transformKey] = "translateX(" + (Math.round(xPos)) + "px) translateY(" + (Math.round(yPos)) + "px)";
+ if (transformKey !== 'msTransform') {
+ return css[transformKey] += " translateZ(0)";
+ }
+ } else {
+ if (same.top) {
+ css.top = "" + pos.top + "px";
+ } else {
+ css.bottom = "" + pos.bottom + "px";
+ }
+ if (same.left) {
+ return css.left = "" + pos.left + "px";
+ } else {
+ return css.right = "" + pos.right + "px";
+ }
+ }
+ };
+ moved = false;
+ if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) {
+ css.position = 'absolute';
+ transcribe(same.page, position.page);
+ } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) {
+ css.position = 'fixed';
+ transcribe(same.viewport, position.viewport);
+ } else if ((same.offset != null) && same.offset.top && same.offset.left) {
+ css.position = 'absolute';
+ offsetParent = this.cache('target-offsetparent', function() {
+ return getOffsetParent(_this.target);
+ });
+ if (getOffsetParent(this.element) !== offsetParent) {
+ defer(function() {
+ _this.element.parentNode.removeChild(_this.element);
+ return offsetParent.appendChild(_this.element);
+ });
+ }
+ transcribe(same.offset, position.offset);
+ moved = true;
+ } else {
+ css.position = 'absolute';
+ transcribe({
+ top: true,
+ left: true
+ }, position.page);
+ }
+ if (!moved && this.element.parentNode.tagName !== 'BODY') {
+ this.element.parentNode.removeChild(this.element);
+ document.body.appendChild(this.element);
+ }
+ writeCSS = {};
+ write = false;
+ for (key in css) {
+ val = css[key];
+ elVal = this.element.style[key];
+ if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) {
+ elVal = parseFloat(elVal);
+ val = parseFloat(val);
+ }
+ if (elVal !== val) {
+ write = true;
+ writeCSS[key] = css[key];
+ }
+ }
+ if (write) {
+ return defer(function() {
+ return extend(_this.element.style, writeCSS);
+ });
+ }
+ };
+
+ return _Tether;
+
+ })();
+
+ Tether.position = position;
+
+ this.Tether = extend(_Tether, Tether);
+
+}).call(this);
+
+(function() {
+ var BOUNDS_FORMAT, MIRROR_ATTACH, defer, extend, getBoundingRect, getBounds, getOuterSize, getSize, updateClasses, _ref,
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+
+ _ref = this.Tether.Utils, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getSize = _ref.getSize, extend = _ref.extend, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ MIRROR_ATTACH = {
+ left: 'right',
+ right: 'left',
+ top: 'bottom',
+ bottom: 'top',
+ middle: 'middle'
+ };
+
+ BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'];
+
+ getBoundingRect = function(tether, to) {
+ var i, pos, side, size, style, _i, _len;
+ if (to === 'scrollParent') {
+ to = tether.scrollParent;
+ } else if (to === 'window') {
+ to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset];
+ }
+ if (to === document) {
+ to = to.documentElement;
+ }
+ if (to.nodeType != null) {
+ pos = size = getBounds(to);
+ style = getComputedStyle(to);
+ to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top];
+ for (i = _i = 0, _len = BOUNDS_FORMAT.length; _i < _len; i = ++_i) {
+ side = BOUNDS_FORMAT[i];
+ side = side[0].toUpperCase() + side.substr(1);
+ if (side === 'Top' || side === 'Left') {
+ to[i] += parseFloat(style["border" + side + "Width"]);
+ } else {
+ to[i] -= parseFloat(style["border" + side + "Width"]);
+ }
+ }
+ }
+ return to;
+ };
+
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var addClasses, allClasses, attachment, bounds, changeAttachX, changeAttachY, cls, constraint, eAttachment, height, left, oob, oobClass, p, pin, pinned, pinnedClass, removeClass, side, tAttachment, targetAttachment, targetHeight, targetSize, targetWidth, to, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8,
+ _this = this;
+ top = _arg.top, left = _arg.left, targetAttachment = _arg.targetAttachment;
+ if (!this.options.constraints) {
+ return true;
+ }
+ removeClass = function(prefix) {
+ var side, _i, _len, _results;
+ _this.removeClass(prefix);
+ _results = [];
+ for (_i = 0, _len = BOUNDS_FORMAT.length; _i < _len; _i++) {
+ side = BOUNDS_FORMAT[_i];
+ _results.push(_this.removeClass("" + prefix + "-" + side));
+ }
+ return _results;
+ };
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ if (width === 0 && height === 0 && (this.lastSize != null)) {
+ _ref2 = this.lastSize, width = _ref2.width, height = _ref2.height;
+ }
+ targetSize = this.cache('target-bounds', function() {
+ return _this.getTargetBounds();
+ });
+ targetHeight = targetSize.height;
+ targetWidth = targetSize.width;
+ tAttachment = {};
+ eAttachment = {};
+ allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')];
+ _ref3 = this.options.constraints;
+ for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
+ constraint = _ref3[_i];
+ if (constraint.outOfBoundsClass) {
+ allClasses.push(constraint.outOfBoundsClass);
+ }
+ if (constraint.pinnedClass) {
+ allClasses.push(constraint.pinnedClass);
+ }
+ }
+ for (_j = 0, _len1 = allClasses.length; _j < _len1; _j++) {
+ cls = allClasses[_j];
+ _ref4 = ['left', 'top', 'right', 'bottom'];
+ for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
+ side = _ref4[_k];
+ allClasses.push("" + cls + "-" + side);
+ }
+ }
+ addClasses = [];
+ tAttachment = extend({}, targetAttachment);
+ eAttachment = extend({}, this.attachment);
+ _ref5 = this.options.constraints;
+ for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) {
+ constraint = _ref5[_l];
+ to = constraint.to, attachment = constraint.attachment, pin = constraint.pin;
+ if (attachment == null) {
+ attachment = '';
+ }
+ if (__indexOf.call(attachment, ' ') >= 0) {
+ _ref6 = attachment.split(' '), changeAttachY = _ref6[0], changeAttachX = _ref6[1];
+ } else {
+ changeAttachX = changeAttachY = attachment;
+ }
+ bounds = getBoundingRect(this, to);
+ if (changeAttachY === 'target' || changeAttachY === 'both') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ }
+ }
+ if (changeAttachY === 'together') {
+ if (top < bounds[1] && tAttachment.top === 'top') {
+ if (eAttachment.top === 'bottom') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top += height;
+ eAttachment.top = 'top';
+ } else if (eAttachment.top === 'top') {
+ top += targetHeight;
+ tAttachment.top = 'bottom';
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (top + height > bounds[3] && tAttachment.top === 'bottom') {
+ if (eAttachment.top === 'top') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (eAttachment.top === 'bottom') {
+ top -= targetHeight;
+ tAttachment.top = 'top';
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ if (tAttachment.top === 'middle') {
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ } else if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ }
+ }
+ if (changeAttachX === 'target' || changeAttachX === 'both') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ }
+ if (left + width > bounds[2] && tAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ }
+ }
+ if (changeAttachX === 'together') {
+ if (left < bounds[0] && tAttachment.left === 'left') {
+ if (eAttachment.left === 'right') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left += width;
+ eAttachment.left = 'left';
+ } else if (eAttachment.left === 'left') {
+ left += targetWidth;
+ tAttachment.left = 'right';
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ } else if (left + width > bounds[2] && tAttachment.left === 'right') {
+ if (eAttachment.left === 'left') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (eAttachment.left === 'right') {
+ left -= targetWidth;
+ tAttachment.left = 'left';
+ left += width;
+ eAttachment.left = 'left';
+ }
+ } else if (tAttachment.left === 'center') {
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ } else if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ }
+ }
+ if (changeAttachY === 'element' || changeAttachY === 'both') {
+ if (top < bounds[1] && eAttachment.top === 'bottom') {
+ top += height;
+ eAttachment.top = 'top';
+ }
+ if (top + height > bounds[3] && eAttachment.top === 'top') {
+ top -= height;
+ eAttachment.top = 'bottom';
+ }
+ }
+ if (changeAttachX === 'element' || changeAttachX === 'both') {
+ if (left < bounds[0] && eAttachment.left === 'right') {
+ left += width;
+ eAttachment.left = 'left';
+ }
+ if (left + width > bounds[2] && eAttachment.left === 'left') {
+ left -= width;
+ eAttachment.left = 'right';
+ }
+ }
+ if (typeof pin === 'string') {
+ pin = (function() {
+ var _len4, _m, _ref7, _results;
+ _ref7 = pin.split(',');
+ _results = [];
+ for (_m = 0, _len4 = _ref7.length; _m < _len4; _m++) {
+ p = _ref7[_m];
+ _results.push(p.trim());
+ }
+ return _results;
+ })();
+ } else if (pin === true) {
+ pin = ['top', 'left', 'right', 'bottom'];
+ }
+ pin || (pin = []);
+ pinned = [];
+ oob = [];
+ if (top < bounds[1]) {
+ if (__indexOf.call(pin, 'top') >= 0) {
+ top = bounds[1];
+ pinned.push('top');
+ } else {
+ oob.push('top');
+ }
+ }
+ if (top + height > bounds[3]) {
+ if (__indexOf.call(pin, 'bottom') >= 0) {
+ top = bounds[3] - height;
+ pinned.push('bottom');
+ } else {
+ oob.push('bottom');
+ }
+ }
+ if (left < bounds[0]) {
+ if (__indexOf.call(pin, 'left') >= 0) {
+ left = bounds[0];
+ pinned.push('left');
+ } else {
+ oob.push('left');
+ }
+ }
+ if (left + width > bounds[2]) {
+ if (__indexOf.call(pin, 'right') >= 0) {
+ left = bounds[2] - width;
+ pinned.push('right');
+ } else {
+ oob.push('right');
+ }
+ }
+ if (pinned.length) {
+ pinnedClass = (_ref7 = this.options.pinnedClass) != null ? _ref7 : this.getClass('pinned');
+ addClasses.push(pinnedClass);
+ for (_m = 0, _len4 = pinned.length; _m < _len4; _m++) {
+ side = pinned[_m];
+ addClasses.push("" + pinnedClass + "-" + side);
+ }
+ }
+ if (oob.length) {
+ oobClass = (_ref8 = this.options.outOfBoundsClass) != null ? _ref8 : this.getClass('out-of-bounds');
+ addClasses.push(oobClass);
+ for (_n = 0, _len5 = oob.length; _n < _len5; _n++) {
+ side = oob[_n];
+ addClasses.push("" + oobClass + "-" + side);
+ }
+ }
+ if (__indexOf.call(pinned, 'left') >= 0 || __indexOf.call(pinned, 'right') >= 0) {
+ eAttachment.left = tAttachment.left = false;
+ }
+ if (__indexOf.call(pinned, 'top') >= 0 || __indexOf.call(pinned, 'bottom') >= 0) {
+ eAttachment.top = tAttachment.top = false;
+ }
+ if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== this.attachment.top || eAttachment.left !== this.attachment.left) {
+ this.updateAttachClasses(eAttachment, tAttachment);
+ }
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+(function() {
+ var defer, getBounds, updateClasses, _ref;
+
+ _ref = this.Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer;
+
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5,
+ _this = this;
+ top = _arg.top, left = _arg.left;
+ _ref1 = this.cache('element-bounds', function() {
+ return getBounds(_this.element);
+ }), height = _ref1.height, width = _ref1.width;
+ targetPos = this.getTargetBounds();
+ bottom = top + height;
+ right = left + width;
+ abutted = [];
+ if (top <= targetPos.bottom && bottom >= targetPos.top) {
+ _ref2 = ['left', 'right'];
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ side = _ref2[_i];
+ if ((_ref3 = targetPos[side]) === left || _ref3 === right) {
+ abutted.push(side);
+ }
+ }
+ }
+ if (left <= targetPos.right && right >= targetPos.left) {
+ _ref4 = ['top', 'bottom'];
+ for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+ side = _ref4[_j];
+ if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) {
+ abutted.push(side);
+ }
+ }
+ }
+ allClasses = [];
+ addClasses = [];
+ sides = ['left', 'top', 'right', 'bottom'];
+ allClasses.push(this.getClass('abutted'));
+ for (_k = 0, _len2 = sides.length; _k < _len2; _k++) {
+ side = sides[_k];
+ allClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ if (abutted.length) {
+ addClasses.push(this.getClass('abutted'));
+ }
+ for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) {
+ side = abutted[_l];
+ addClasses.push("" + (this.getClass('abutted')) + "-" + side);
+ }
+ defer(function() {
+ updateClasses(_this.target, addClasses, allClasses);
+ return updateClasses(_this.element, addClasses, allClasses);
+ });
+ return true;
+ }
+ });
+
+}).call(this);
+
+(function() {
+ this.Tether.modules.push({
+ position: function(_arg) {
+ var left, result, shift, shiftLeft, shiftTop, top, _ref;
+ top = _arg.top, left = _arg.left;
+ if (!this.options.shift) {
+ return;
+ }
+ result = function(val) {
+ if (typeof val === 'function') {
+ return val.call(this, {
+ top: top,
+ left: left
+ });
+ } else {
+ return val;
+ }
+ };
+ shift = result(this.options.shift);
+ if (typeof shift === 'string') {
+ shift = shift.split(' ');
+ shift[1] || (shift[1] = shift[0]);
+ shiftTop = shift[0], shiftLeft = shift[1];
+ shiftTop = parseFloat(shiftTop, 10);
+ shiftLeft = parseFloat(shiftLeft, 10);
+ } else {
+ _ref = [shift.top, shift.left], shiftTop = _ref[0], shiftLeft = _ref[1];
+ }
+ top += shiftTop;
+ left += shiftLeft;
+ return {
+ top: top,
+ left: left
+ };
+ }
+ });
+
+}).call(this);
+
+return this.Tether;
+
+}));
+
+(function() {
+ var ATTACHMENT, Evented, Shepherd, Step, Tour, addClass, createFromHTML, extend, getBounds, hasClass, matchesSelector, parseShorthand, removeClass, uniqueId, _ref,
+ __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ _ref = Tether.Utils, extend = _ref.extend, removeClass = _ref.removeClass, addClass = _ref.addClass, hasClass = _ref.hasClass, Evented = _ref.Evented, getBounds = _ref.getBounds, uniqueId = _ref.uniqueId;
+
+ Shepherd = new Evented;
+
+ ATTACHMENT = {
+ 'top': 'bottom center',
+ 'left': 'middle right',
+ 'right': 'middle left',
+ 'bottom': 'top center'
+ };
+
+ createFromHTML = function(html) {
+ var el;
+ el = document.createElement('div');
+ el.innerHTML = html;
+ return el.children[0];
+ };
+
+ matchesSelector = function(el, sel) {
+ var matches, _ref1, _ref2, _ref3, _ref4;
+ matches = (_ref1 = (_ref2 = (_ref3 = (_ref4 = el.matches) != null ? _ref4 : el.matchesSelector) != null ? _ref3 : el.webkitMatchesSelector) != null ? _ref2 : el.mozMatchesSelector) != null ? _ref1 : el.oMatchesSelector;
+ return matches.call(el, sel);
+ };
+
+ parseShorthand = function(obj, props) {
+ var i, out, prop, vals, _i, _len;
+ if (obj == null) {
+ return obj;
+ } else if (typeof obj === 'object') {
+ return obj;
+ } else {
+ vals = obj.split(' ');
+ if (vals.length > props.length) {
+ vals[0] = vals.slice(0, +(vals.length - props.length) + 1 || 9e9).join(' ');
+ vals.splice(1, vals.length - props.length);
+ }
+ out = {};
+ for (i = _i = 0, _len = props.length; _i < _len; i = ++_i) {
+ prop = props[i];
+ out[prop] = vals[i];
+ }
+ return out;
+ }
+ };
+
+ Step = (function(_super) {
+ __extends(Step, _super);
+
+ function Step(tour, options) {
+ this.tour = tour;
+ this.destroy = __bind(this.destroy, this);
+ this.scrollTo = __bind(this.scrollTo, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.isOpen = __bind(this.isOpen, this);
+ this.hide = __bind(this.hide, this);
+ this.show = __bind(this.show, this);
+ this.setOptions(options);
+ this;
+ }
+
+ Step.prototype.setOptions = function(options) {
+ var event, handler, _base, _ref1;
+ this.options = options != null ? options : {};
+ this.destroy();
+ this.id = this.options.id || this.id || ("step-" + (uniqueId()));
+ if (this.options.when) {
+ _ref1 = this.options.when;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ this.on(event, handler, this);
+ }
+ }
+ return (_base = this.options).buttons != null ? (_base = this.options).buttons : _base.buttons = [
+ {
+ text: 'Next',
+ action: this.tour.next
+ }
+ ];
+ };
+
+ Step.prototype.getTour = function() {
+ return this.tour;
+ };
+
+ Step.prototype.bindAdvance = function() {
+ var event, handler, selector, _ref1,
+ _this = this;
+ _ref1 = parseShorthand(this.options.advanceOn, ['selector', 'event']), event = _ref1.event, selector = _ref1.selector;
+ handler = function(e) {
+ if (!_this.isOpen()) {
+ return;
+ }
+ if (selector != null) {
+ if (matchesSelector(e.target, selector)) {
+ return _this.tour.next();
+ }
+ } else {
+ if (_this.el && e.target === _this.el) {
+ return _this.tour.next();
+ }
+ }
+ };
+ document.body.addEventListener(event, handler);
+ return this.on('destroy', function() {
+ return document.body.removeEventListener(event, handler);
+ });
+ };
+
+ Step.prototype.getAttachTo = function() {
+ var opts;
+ opts = parseShorthand(this.options.attachTo, ['element', 'on']);
+ if (opts == null) {
+ opts = {};
+ }
+ if (typeof opts.element === 'string') {
+ opts.element = document.querySelector(opts.element);
+ if (opts.element == null) {
+ throw new Error("Shepherd step's attachTo was not found in the page");
+ }
+ }
+ return opts;
+ };
+
+ Step.prototype.setupTether = function() {
+ var attachment, opts, tetherOpts;
+ if (typeof Tether === "undefined" || Tether === null) {
+ throw new Error("Using the attachment feature of Shepherd requires the Tether library");
+ }
+ opts = this.getAttachTo();
+ attachment = ATTACHMENT[opts.on || 'right'];
+ if (opts.element == null) {
+ opts.element = 'viewport';
+ attachment = 'middle center';
+ }
+ tetherOpts = {
+ classPrefix: 'shepherd',
+ element: this.el,
+ constraints: [
+ {
+ to: 'window',
+ pin: true,
+ attachment: 'together'
+ }
+ ],
+ target: opts.element,
+ offset: opts.offset || '0 0',
+ attachment: attachment
+ };
+ return this.tether = new Tether(extend(tetherOpts, this.options.tetherOptions));
+ };
+
+ Step.prototype.show = function() {
+ var _this = this;
+ if (this.el == null) {
+ this.render();
+ }
+ addClass(this.el, 'shepherd-open');
+ document.body.setAttribute('data-shepherd-step', this.id);
+ this.setupTether();
+ if (this.options.scrollTo) {
+ setTimeout(function() {
+ return _this.scrollTo();
+ });
+ }
+ return this.trigger('show');
+ };
+
+ Step.prototype.hide = function() {
+ var _ref1;
+ removeClass(this.el, 'shepherd-open');
+ document.body.removeAttribute('data-shepherd-step');
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ this.tether = null;
+ return this.trigger('hide');
+ };
+
+ Step.prototype.isOpen = function() {
+ return hasClass(this.el, 'shepherd-open');
+ };
+
+ Step.prototype.cancel = function() {
+ this.tour.cancel();
+ return this.trigger('cancel');
+ };
+
+ Step.prototype.complete = function() {
+ this.tour.complete();
+ return this.trigger('complete');
+ };
+
+ Step.prototype.scrollTo = function() {
+ var element;
+ element = this.getAttachTo().element;
+ return element != null ? element.scrollIntoView() : void 0;
+ };
+
+ Step.prototype.destroy = function() {
+ var _ref1;
+ if (this.el != null) {
+ document.body.removeChild(this.el);
+ delete this.el;
+ }
+ if ((_ref1 = this.tether) != null) {
+ _ref1.destroy();
+ }
+ this.tether = null;
+ return this.trigger('destroy');
+ };
+
+ Step.prototype.render = function() {
+ var button, buttons, cfg, content, footer, header, link, paragraph, paragraphs, text, _i, _j, _len, _len1, _ref1, _ref2, _ref3;
+ if (this.el != null) {
+ this.destroy();
+ }
+ this.el = createFromHTML("");
+ content = document.createElement('div');
+ content.className = 'shepherd-content';
+ this.el.appendChild(content);
+ header = document.createElement('header');
+ content.appendChild(header);
+ if (this.options.title != null) {
+ header.innerHTML += "" + this.options.title + "
";
+ this.el.className += ' shepherd-has-title';
+ }
+ if (this.options.showCancelLink) {
+ link = createFromHTML("✕");
+ header.appendChild(link);
+ this.el.className += ' shepherd-has-cancel-link';
+ this.bindCancelLink(link);
+ }
+ if (this.options.text != null) {
+ text = createFromHTML("");
+ paragraphs = this.options.text;
+ if (typeof paragraphs === 'string') {
+ paragraphs = [paragraphs];
+ }
+ for (_i = 0, _len = paragraphs.length; _i < _len; _i++) {
+ paragraph = paragraphs[_i];
+ text.innerHTML += "" + paragraph + "
";
+ }
+ content.appendChild(text);
+ }
+ footer = document.createElement('footer');
+ if (this.options.buttons) {
+ buttons = createFromHTML("");
+ _ref2 = this.options.buttons;
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
+ cfg = _ref2[_j];
+ button = createFromHTML("" + cfg.text + "");
+ buttons.appendChild(button);
+ this.bindButtonEvents(cfg, button.querySelector('a'));
+ }
+ footer.appendChild(buttons);
+ }
+ content.appendChild(footer);
+ document.body.appendChild(this.el);
+ this.setupTether();
+ if (this.options.advanceOn) {
+ return this.bindAdvance();
+ }
+ };
+
+ Step.prototype.bindCancelLink = function(link) {
+ var _this = this;
+ return link.addEventListener('click', function(e) {
+ e.preventDefault();
+ return _this.cancel();
+ });
+ };
+
+ Step.prototype.bindButtonEvents = function(cfg, el) {
+ var event, handler, page, _ref1,
+ _this = this;
+ if (cfg.events == null) {
+ cfg.events = {};
+ }
+ if (cfg.action != null) {
+ cfg.events.click = cfg.action;
+ }
+ _ref1 = cfg.events;
+ for (event in _ref1) {
+ handler = _ref1[event];
+ if (typeof handler === 'string') {
+ page = handler;
+ handler = function() {
+ return _this.tour.show(page);
+ };
+ }
+ el.addEventListener(event, handler);
+ }
+ return this.on('destroy', function() {
+ var _ref2, _results;
+ _ref2 = cfg.events;
+ _results = [];
+ for (event in _ref2) {
+ handler = _ref2[event];
+ _results.push(el.removeEventListener(event, handler));
+ }
+ return _results;
+ });
+ };
+
+ return Step;
+
+ })(Evented);
+
+ Tour = (function(_super) {
+ __extends(Tour, _super);
+
+ function Tour(options) {
+ var event, _fn, _i, _len, _ref1, _ref2,
+ _this = this;
+ this.options = options != null ? options : {};
+ this.hide = __bind(this.hide, this);
+ this.complete = __bind(this.complete, this);
+ this.cancel = __bind(this.cancel, this);
+ this.back = __bind(this.back, this);
+ this.next = __bind(this.next, this);
+ this.steps = (_ref1 = this.options.steps) != null ? _ref1 : [];
+ _ref2 = ['complete', 'cancel', 'hide', 'start', 'show', 'active', 'inactive'];
+ _fn = function(event) {
+ return _this.on(event, function(opts) {
+ if (opts == null) {
+ opts = {};
+ }
+ opts.tour = _this;
+ return Shepherd.trigger(event, opts);
+ });
+ };
+ for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+ event = _ref2[_i];
+ _fn(event);
+ }
+ this;
+ }
+
+ Tour.prototype.addStep = function(name, step) {
+ var _ref1;
+ if (step == null) {
+ step = name;
+ }
+ if (!(step instanceof Step)) {
+ if ((_ref1 = typeof name) === 'string' || _ref1 === 'number') {
+ step.id = name.toString();
+ }
+ step = extend({}, this.options.defaults, step);
+ step = new Step(this, step);
+ } else {
+ step.tour = this;
+ }
+ this.steps.push(step);
+ return step;
+ };
+
+ Tour.prototype.getById = function(id) {
+ var step, _i, _len, _ref1;
+ _ref1 = this.steps;
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ step = _ref1[_i];
+ if (step.id === id) {
+ return step;
+ }
+ }
+ };
+
+ Tour.prototype.getCurrentStep = function() {
+ return this.currentStep;
+ };
+
+ Tour.prototype.next = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ if (index === this.steps.length - 1) {
+ this.hide(index);
+ this.trigger('complete');
+ return this.done();
+ } else {
+ return this.show(index + 1);
+ }
+ };
+
+ Tour.prototype.back = function() {
+ var index;
+ index = this.steps.indexOf(this.currentStep);
+ return this.show(index - 1);
+ };
+
+ Tour.prototype.cancel = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('cancel');
+ return this.done();
+ };
+
+ Tour.prototype.complete = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('complete');
+ return this.done();
+ };
+
+ Tour.prototype.hide = function() {
+ var _ref1;
+ if ((_ref1 = this.currentStep) != null) {
+ _ref1.hide();
+ }
+ this.trigger('hide');
+ return this.done();
+ };
+
+ Tour.prototype.done = function() {
+ Shepherd.activeTour = null;
+ removeClass(document.body, 'shepherd-active');
+ return this.trigger('inactive', {
+ tour: this
+ });
+ };
+
+ Tour.prototype.show = function(key) {
+ var next;
+ if (key == null) {
+ key = 0;
+ }
+ if (this.currentStep) {
+ this.currentStep.hide();
+ } else {
+ addClass(document.body, 'shepherd-active');
+ this.trigger('active', {
+ tour: this
+ });
+ }
+ Shepherd.activeTour = this;
+ if (typeof key === 'string') {
+ next = this.getById(key);
+ } else {
+ next = this.steps[key];
+ }
+ if (next) {
+ this.trigger('show', {
+ step: next,
+ previous: this.currentStep
+ });
+ this.currentStep = next;
+ return next.show();
+ }
+ };
+
+ Tour.prototype.start = function() {
+ this.trigger('start');
+ this.currentStep = null;
+ return this.next();
+ };
+
+ return Tour;
+
+ })(Evented);
+
+ extend(Shepherd, {
+ Tour: Tour,
+ Step: Step,
+ Evented: Evented
+ });
+
+ window.Shepherd = Shepherd;
+
+}).call(this);
diff --git a/ajax/libs/shepherd/0.5.1/shepherd.min.js b/ajax/libs/shepherd/0.5.1/shepherd.min.js
new file mode 100644
index 000000000..9cc1315b8
--- /dev/null
+++ b/ajax/libs/shepherd/0.5.1/shepherd.min.js
@@ -0,0 +1,2 @@
+/*! shepherd 0.5.1 */
+!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e(require,exports,module):t.Tether=e()}(this,function(){return function(){var t,e,i,o,n,s,r,h,l,a,p,u,f,c,d,g,m,v={}.hasOwnProperty,b=[].indexOf||function(t){for(var e=0,i=this.length;i>e;e++)if(e in this&&this[e]===t)return e;return-1},y=[].slice;null==this.Tether&&(this.Tether={modules:[]}),p=function(t){var e,i,o,n,s;if(i=getComputedStyle(t).position,"fixed"===i)return t;for(o=void 0,e=t;e=e.parentNode;){try{n=getComputedStyle(e)}catch(r){}if(null==n)return e;if(/(auto|scroll)/.test(n.overflow+n["overflow-y"]+n["overflow-x"])&&("absolute"!==i||"relative"===(s=n.position)||"absolute"===s||"fixed"===s))return e}return document.body},d=function(){var t;return t=0,function(){return t++}}(),m={},l=function(t){var e,o,s,r,h;if(s=t._tetherZeroElement,null==s&&(s=t.createElement("div"),s.setAttribute("data-tether-id",d()),n(s.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(s),t._tetherZeroElement=s),e=s.getAttribute("data-tether-id"),null==m[e]){m[e]={},h=s.getBoundingClientRect();for(o in h)r=h[o],m[e][o]=r;i(function(){return m[e]=void 0})}return m[e]},f=null,r=function(t){var e,i,o,n,s,r,h;t===document?(i=document,t=document.documentElement):i=t.ownerDocument,o=i.documentElement,e={},h=t.getBoundingClientRect();for(n in h)r=h[n],e[n]=r;return s=l(i),e.top-=s.top,e.left-=s.left,null==e.width&&(e.width=document.body.scrollWidth-e.left-e.right),null==e.height&&(e.height=document.body.scrollHeight-e.top-e.bottom),e.top=e.top-o.clientTop,e.left=e.left-o.clientLeft,e.right=i.body.clientWidth-e.width-e.left,e.bottom=i.body.clientHeight-e.height-e.top,e},h=function(t){return t.offsetParent||document.documentElement},a=function(){var t,e,i,o,s;return t=document.createElement("div"),t.style.width="100%",t.style.height="200px",e=document.createElement("div"),n(e.style,{position:"absolute",top:0,left:0,pointerEvents:"none",visibility:"hidden",width:"200px",height:"150px",overflow:"hidden"}),e.appendChild(t),document.body.appendChild(e),o=t.offsetWidth,e.style.overflow="scroll",s=t.offsetWidth,o===s&&(s=e.clientWidth),document.body.removeChild(e),i=o-s,{width:i,height:i}},n=function(t){var e,i,o,n,s,r,h;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),h=e.slice(1),s=0,r=h.length;r>s;s++)if(o=h[s])for(i in o)v.call(o,i)&&(n=o[i],t[i]=n);return t},c=function(t,e){var i,o,n,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],o=0,n=s.length;n>o;o++)i=s[o],i.trim()&&r.push(t.classList.remove(i));return r}return t.className=t.className.replace(new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi")," ")},e=function(t,e){var i,o,n,s,r;if(null!=t.classList){for(s=e.split(" "),r=[],o=0,n=s.length;n>o;o++)i=s[o],i.trim()&&r.push(t.classList.add(i));return r}return c(t,e),t.className+=" "+e},u=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},g=function(t,i,o){var n,s,r,h,l,a;for(s=0,h=o.length;h>s;s++)n=o[s],b.call(i,n)<0&&u(t,n)&&c(t,n);for(a=[],r=0,l=i.length;l>r;r++)n=i[r],a.push(u(t,n)?void 0:e(t,n));return a},o=[],i=function(t){return o.push(t)},s=function(){var t,e;for(e=[];t=o.pop();)e.push(t());return e},t=function(){function t(){}return t.prototype.on=function(t,e,i,o){var n;return null==o&&(o=!1),null==this.bindings&&(this.bindings={}),null==(n=this.bindings)[t]&&(n[t]=[]),this.bindings[t].push({handler:e,ctx:i,once:o})},t.prototype.once=function(t,e,i){return this.on(t,e,i,!0)},t.prototype.off=function(t,e){var i,o,n;if(null!=(null!=(o=this.bindings)?o[t]:void 0)){if(null==e)return delete this.bindings[t];for(i=0,n=[];i=e&&e>=t-i},x=function(){var t,e,i,o,n;for(t=document.createElement("div"),n=["transform","webkitTransform","OTransform","MozTransform","msTransform"],i=0,o=n.length;o>i;i++)if(e=n[i],void 0!==t.style[e])return e}(),O=[],C=function(){var t,e,i;for(e=0,i=O.length;i>e;e++)t=O[e],t.position(!1);return p()},v=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance?"function"==typeof performance.now?performance.now():void 0:void 0)?t:+new Date},function(){var t,e,i,o,n,s,r,h,l;for(e=null,i=null,o=null,n=function(){if(null!=i&&i>16)return i=Math.min(i-16,250),void(o=setTimeout(n,250));if(!(null!=e&&v()-e<10))return null!=o&&(clearTimeout(o),o=null),e=v(),C(),i=v()-e},h=["resize","scroll","touchmove"],l=[],s=0,r=h.length;r>s;s++)t=h[s],l.push(window.addEventListener(t,n));return l}(),t={center:"center",left:"right",right:"left"},e={middle:"middle",top:"bottom",bottom:"top"},i={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},h=function(i,o){var n,s;return n=i.left,s=i.top,"auto"===n&&(n=t[o.left]),"auto"===s&&(s=e[o.top]),{left:n,top:s}},r=function(t){var e,o;return{left:null!=(e=i[t.left])?e:t.left,top:null!=(o=i[t.top])?o:t.top}},s=function(){var t,e,i,o,n,s,r;for(e=1<=arguments.length?L.call(arguments,0):[],i={top:0,left:0},n=0,s=e.length;s>n;n++)r=e[n],o=r.top,t=r.left,"string"==typeof o&&(o=parseFloat(o,10)),"string"==typeof t&&(t=parseFloat(t,10)),i.top+=o,i.left+=t;return i},b=function(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t},y=w=function(t){var e,i,o;return o=t.split(" "),i=o[0],e=o[1],{top:i,left:e}},A=function(){function t(t){this.position=B(this.position,this);var e,i,n,s,r;for(O.push(this),this.history=[],this.setOptions(t,!1),s=o.modules,i=0,n=s.length;n>i;i++)e=s[i],null!=(r=e.initialize)&&r.call(this);this.position()}return t.modules=[],t.prototype.getClass=function(t){var e,i;return(null!=(e=this.options.classes)?e[t]:void 0)?this.options.classes[t]:(null!=(i=this.options.classes)?i[t]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+t:t:""},t.prototype.setOptions=function(t,e){var i,o,s,r,h,l;for(this.options=t,null==e&&(e=!0),i={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=a(i,this.options),h=this.options,this.element=h.element,this.target=h.target,this.targetModifier=h.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),l=["element","target"],s=0,r=l.length;r>s;s++){if(o=l[s],null==this[o])throw new Error("Tether Error: Both element and target must be defined");null!=this[o].jquery?this[o]=this[o][0]:"string"==typeof this[o]&&(this[o]=document.querySelector(this[o]))}if(n(this.element,this.getClass("element")),n(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=y(this.options.targetAttachment),this.attachment=y(this.options.attachment),this.offset=w(this.options.offset),this.targetOffset=w(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent="scroll-handle"===this.targetModifier?this.target:g(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,i,o,n,s,r,h,l;if(null==this.targetModifier)return u(this.target);switch(this.targetModifier){case"visible":return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:(t=u(this.target),n={height:t.height,width:t.width,top:t.top,left:t.left},n.height=Math.min(n.height,t.height-(pageYOffset-t.top)),n.height=Math.min(n.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),n.height=Math.min(innerHeight,n.height),n.height-=2,n.width=Math.min(n.width,t.width-(pageXOffset-t.left)),n.width=Math.min(n.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),n.width=Math.min(innerWidth,n.width),n.width-=2,n.topl.clientWidth||"scroll"===[h.overflow,h.overflowX]||this.target!==document.body,s=0,i&&(s=15),o=t.height-parseFloat(h.borderTopWidth)-parseFloat(h.borderBottomWidth)-s,n={width:15,height:.975*o*(o/l.scrollHeight),left:t.left+t.width-parseFloat(h.borderLeftWidth)-15},e=0,408>o&&this.target===document.body&&(e=-11e-5*Math.pow(o,2)-.00727*o+22.58),this.target!==document.body&&(n.height=Math.max(n.height,24)),r=this.target.scrollTop/(l.scrollHeight-o),n.top=r*(o-n.height-e)+t.top+parseFloat(h.borderTopWidth),this.target===document.body&&(n.height=Math.max(n.height,24)),n}},t.prototype.clearCache=function(){return this._cache={}},t.prototype.cache=function(t,e){return null==this._cache&&(this._cache={}),null==this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},t.prototype.enable=function(t){return null==t&&(t=!0),n(this.target,this.getClass("enabled")),n(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t?this.position():void 0},t.prototype.disable=function(){return T(this.target,this.getClass("enabled")),T(this.element,this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},t.prototype.destroy=function(){var t,e,i,o,n;for(this.disable(),n=[],t=i=0,o=O.length;o>i;t=++i){if(e=O[t],e===this){O.splice(t,1);break}n.push(void 0)}return n},t.prototype.updateAttachClasses=function(t,e){var i,o,n,s,r,h,a,p,u,f=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),s=["left","top","bottom","right","middle","center"],(null!=(u=this._addAttachClasses)?u.length:void 0)&&this._addAttachClasses.splice(0,this._addAttachClasses.length),i=null!=this._addAttachClasses?this._addAttachClasses:this._addAttachClasses=[],t.top&&i.push(""+this.getClass("element-attached")+"-"+t.top),t.left&&i.push(""+this.getClass("element-attached")+"-"+t.left),e.top&&i.push(""+this.getClass("target-attached")+"-"+e.top),e.left&&i.push(""+this.getClass("target-attached")+"-"+e.left),o=[],r=0,a=s.length;a>r;r++)n=s[r],o.push(""+this.getClass("element-attached")+"-"+n);for(h=0,p=s.length;p>h;h++)n=s[h],o.push(""+this.getClass("target-attached")+"-"+n);return l(function(){return null!=f._addAttachClasses?(S(f.element,f._addAttachClasses,o),S(f.target,f._addAttachClasses,o),f._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,i,n,l,a,c,g,m,v,y,w,C,T,O,x,S,E,A,M,L,B,W,_,P,z,H,F,k,N,Y,X,j,q,U,I,R=this;if(null==t&&(t=!0),this.enabled){for(this.clearCache(),L=h(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,L),e=this.cache("element-bounds",function(){return u(R.element)}),z=e.width,n=e.height,0===z&&0===n&&null!=this.lastSize?(Y=this.lastSize,z=Y.width,n=Y.height):this.lastSize={width:z,height:n},_=W=this.cache("target-bounds",function(){return R.getTargetBounds()}),v=b(r(this.attachment),{width:z,height:n}),B=b(r(L),_),a=b(this.offset,{width:z,height:n}),c=b(this.targetOffset,_),v=s(v,a),B=s(B,c),l=W.left+B.left-v.left,P=W.top+B.top-v.top,X=o.modules,H=0,k=X.length;k>H;H++)if(g=X[H],x=g.position.call(this,{left:l,top:P,targetAttachment:L,targetPos:W,attachment:this.attachment,elementPos:e,offset:v,targetOffset:B,manualOffset:a,manualTargetOffset:c,scrollbarSize:A}),null!=x&&"object"==typeof x){if(x===!1)return!1;P=x.top,l=x.left}if(m={page:{top:P,left:l},viewport:{top:P-pageYOffset,bottom:pageYOffset-P-n+innerHeight,left:l-pageXOffset,right:pageXOffset-l-z+innerWidth}},document.body.scrollWidth>window.innerWidth&&(A=this.cache("scrollbar-size",d),m.viewport.bottom-=A.height),document.body.scrollHeight>window.innerHeight&&(A=this.cache("scrollbar-size",d),m.viewport.right-=A.width),(""!==(j=document.body.style.position)&&"static"!==j||""!==(q=document.body.parentElement.style.position)&&"static"!==q)&&(m.page.bottom=document.body.scrollHeight-P-n,m.page.right=document.body.scrollWidth-l-z),(null!=(U=this.options.optimizations)?U.moveElement:void 0)!==!1&&null==this.targetModifier){for(w=this.cache("target-offsetparent",function(){return f(R.target)}),O=this.cache("target-offsetparent-bounds",function(){return u(w)}),T=getComputedStyle(w),i=getComputedStyle(this.element),C=O,y={},I=["Top","Left","Bottom","Right"],F=0,N=I.length;N>F;F++)M=I[F],y[M.toLowerCase()]=parseFloat(T["border"+M+"Width"]);O.right=document.body.scrollWidth-O.left-C.width+y.right,O.bottom=document.body.scrollHeight-O.top-C.height+y.bottom,m.page.top>=O.top+y.top&&m.page.bottom>=O.bottom&&m.page.left>=O.left+y.left&&m.page.right>=O.right&&(E=w.scrollTop,S=w.scrollLeft,m.offset={top:m.page.top-O.top+E-y.top,left:m.page.left-O.left+S-y.left})}return this.move(m),this.history.unshift(m),this.history.length>3&&this.history.pop(),t&&p(),!0}},t.prototype.move=function(t){var e,i,o,n,s,r,h,p,u,c,d,g,m,v,b,y,w,C=this;if(null!=this.element.parentNode){p={};for(c in t){p[c]={};for(n in t[c]){for(o=!1,y=this.history,v=0,b=y.length;b>v;v++)if(h=y[v],!E(null!=(w=h[c])?w[n]:void 0,t[c][n])){o=!0;break}o||(p[c][n]=!0)}}e={top:"",left:"",right:"",bottom:""},u=function(t,i){var o,n,s;return(null!=(s=C.options.optimizations)?s.gpu:void 0)===!1?(t.top?e.top=""+i.top+"px":e.bottom=""+i.bottom+"px",t.left?e.left=""+i.left+"px":e.right=""+i.right+"px"):(t.top?(e.top=0,n=i.top):(e.bottom=0,n=-i.bottom),t.left?(e.left=0,o=i.left):(e.right=0,o=-i.right),e[x]="translateX("+Math.round(o)+"px) translateY("+Math.round(n)+"px)","msTransform"!==x?e[x]+=" translateZ(0)":void 0)},s=!1,(p.page.top||p.page.bottom)&&(p.page.left||p.page.right)?(e.position="absolute",u(p.page,t.page)):(p.viewport.top||p.viewport.bottom)&&(p.viewport.left||p.viewport.right)?(e.position="fixed",u(p.viewport,t.viewport)):null!=p.offset&&p.offset.top&&p.offset.left?(e.position="absolute",r=this.cache("target-offsetparent",function(){return f(C.target)}),f(this.element)!==r&&l(function(){return C.element.parentNode.removeChild(C.element),r.appendChild(C.element)}),u(p.offset,t.offset),s=!0):(e.position="absolute",u({top:!0,left:!0},t.page)),s||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),m={},g=!1;for(n in e)d=e[n],i=this.element.style[n],""===i||""===d||"top"!==n&&"left"!==n&&"bottom"!==n&&"right"!==n||(i=parseFloat(i),d=parseFloat(d)),i!==d&&(g=!0,m[n]=e[n]);return g?l(function(){return a(C.element.style,m)}):void 0}},t}(),o.position=C,this.Tether=a(A,o)}.call(this),function(){var t,e,i,o,n,s,r,h,l,a,p=[].indexOf||function(t){for(var e=0,i=this.length;i>e;e++)if(e in this&&this[e]===t)return e;return-1};a=this.Tether.Utils,r=a.getOuterSize,s=a.getBounds,h=a.getSize,o=a.extend,l=a.updateClasses,i=a.defer,e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},t=["left","top","right","bottom"],n=function(e,i){var o,n,r,h,l,a,p;if("scrollParent"===i?i=e.scrollParent:"window"===i&&(i=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),i===document&&(i=i.documentElement),null!=i.nodeType)for(n=h=s(i),l=getComputedStyle(i),i=[n.left,n.top,h.width+n.left,h.height+n.top],o=a=0,p=t.length;p>a;o=++a)r=t[o],r=r[0].toUpperCase()+r.substr(1),"Top"===r||"Left"===r?i[o]+=parseFloat(l["border"+r+"Width"]):i[o]-=parseFloat(l["border"+r+"Width"]);return i},this.Tether.modules.push({position:function(e){var r,h,a,u,f,c,d,g,m,v,b,y,w,C,T,O,x,S,E,A,M,L,B,W,_,P,z,H,F,k,N,Y,X,j,q,U,I,R,D,Z,$,V,G,J,K,Q,te,ee=this;if(P=e.top,b=e.left,M=e.targetAttachment,!this.options.constraints)return!0;for(S=function(e){var i,o,n,s;for(ee.removeClass(e),s=[],o=0,n=t.length;n>o;o++)i=t[o],s.push(ee.removeClass(""+e+"-"+i));return s},Z=this.cache("element-bounds",function(){return s(ee.element)}),v=Z.height,z=Z.width,0===z&&0===v&&null!=this.lastSize&&($=this.lastSize,z=$.width,v=$.height),B=this.cache("target-bounds",function(){return ee.getTargetBounds()}),L=B.height,W=B.width,A={},m={},h=[this.getClass("pinned"),this.getClass("out-of-bounds")],V=this.options.constraints,H=0,Y=V.length;Y>H;H++)g=V[H],g.outOfBoundsClass&&h.push(g.outOfBoundsClass),g.pinnedClass&&h.push(g.pinnedClass);for(F=0,X=h.length;X>F;F++)for(d=h[F],G=["left","top","right","bottom"],k=0,j=G.length;j>k;k++)E=G[k],h.push(""+d+"-"+E);for(r=[],A=o({},M),m=o({},this.attachment),J=this.options.constraints,N=0,q=J.length;q>N;N++){if(g=J[N],_=g.to,a=g.attachment,T=g.pin,null==a&&(a=""),p.call(a," ")>=0?(K=a.split(" "),c=K[0],f=K[1]):f=c=a,u=n(this,_),("target"===c||"both"===c)&&(Pu[3]&&"bottom"===A.top&&(P-=L,A.top="top")),"together"===c&&(Pu[3]&&"bottom"===A.top&&("top"===m.top?(P-=L,A.top="top",P-=v,m.top="bottom"):"bottom"===m.top&&(P-=L,A.top="top",P+=v,m.top="top")),"middle"===A.top&&(P+v>u[3]&&"top"===m.top?(P-=v,m.top="bottom"):Pu[2]&&"right"===A.left&&(b-=W,A.left="left")),"together"===f&&(bu[2]&&"right"===A.left?"left"===m.left?(b-=W,A.left="left",b-=z,m.left="right"):"right"===m.left&&(b-=W,A.left="left",b+=z,m.left="left"):"center"===A.left&&(b+z>u[2]&&"left"===m.left?(b-=z,m.left="right"):bu[3]&&"top"===m.top&&(P-=v,m.top="bottom")),("element"===f||"both"===f)&&(bu[2]&&"left"===m.left&&(b-=z,m.left="right")),"string"==typeof T?T=function(){var t,e,i,o;for(i=T.split(","),o=[],e=0,t=i.length;t>e;e++)C=i[e],o.push(C.trim());return o}():T===!0&&(T=["top","left","right","bottom"]),T||(T=[]),O=[],y=[],P=0?(P=u[1],O.push("top")):y.push("top")),P+v>u[3]&&(p.call(T,"bottom")>=0?(P=u[3]-v,O.push("bottom")):y.push("bottom")),b=0?(b=u[0],O.push("left")):y.push("left")),b+z>u[2]&&(p.call(T,"right")>=0?(b=u[2]-z,O.push("right")):y.push("right")),O.length)for(x=null!=(Q=this.options.pinnedClass)?Q:this.getClass("pinned"),r.push(x),R=0,U=O.length;U>R;R++)E=O[R],r.push(""+x+"-"+E);if(y.length)for(w=null!=(te=this.options.outOfBoundsClass)?te:this.getClass("out-of-bounds"),r.push(w),D=0,I=y.length;I>D;D++)E=y[D],r.push(""+w+"-"+E);(p.call(O,"left")>=0||p.call(O,"right")>=0)&&(m.left=A.left=!1),(p.call(O,"top")>=0||p.call(O,"bottom")>=0)&&(m.top=A.top=!1),(A.top!==M.top||A.left!==M.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,A)}return i(function(){return l(ee.target,r,h),l(ee.element,r,h)}),{top:P,left:b}}})}.call(this),function(){var t,e,i,o;o=this.Tether.Utils,e=o.getBounds,i=o.updateClasses,t=o.defer,this.Tether.modules.push({position:function(o){var n,s,r,h,l,a,p,u,f,c,d,g,m,v,b,y,w,C,T,O,x,S,E,A,M,L=this;if(d=o.top,a=o.left,x=this.cache("element-bounds",function(){return e(L.element)}),l=x.height,g=x.width,c=this.getTargetBounds(),h=d+l,p=a+g,n=[],d<=c.bottom&&h>=c.top)for(S=["left","right"],m=0,w=S.length;w>m;m++)u=S[m],((E=c[u])===a||E===p)&&n.push(u);if(a<=c.right&&p>=c.left)for(A=["top","bottom"],v=0,C=A.length;C>v;v++)u=A[v],((M=c[u])===d||M===h)&&n.push(u);for(r=[],s=[],f=["left","top","right","bottom"],r.push(this.getClass("abutted")),b=0,T=f.length;T>b;b++)u=f[b],r.push(""+this.getClass("abutted")+"-"+u);for(n.length&&s.push(this.getClass("abutted")),y=0,O=n.length;O>y;y++)u=n[y],s.push(""+this.getClass("abutted")+"-"+u);return t(function(){return i(L.target,s,r),i(L.element,s,r)}),!0}})}.call(this),function(){this.Tether.modules.push({position:function(t){var e,i,o,n,s,r,h;return r=t.top,e=t.left,this.options.shift?(i=function(t){return"function"==typeof t?t.call(this,{top:r,left:e}):t},o=i(this.options.shift),"string"==typeof o?(o=o.split(" "),o[1]||(o[1]=o[0]),s=o[0],n=o[1],s=parseFloat(s,10),n=parseFloat(n,10)):(h=[o.top,o.left],s=h[0],n=h[1]),r+=s,e+=n,{top:r,left:e}):void 0}})}.call(this),this.Tether}),function(){var t,e,i,o,n,s,r,h,l,a,p,u,f,c,d,g=function(t,e){return function(){return t.apply(e,arguments)}},m={}.hasOwnProperty,v=function(t,e){function i(){this.constructor=t}for(var o in e)m.call(e,o)&&(t[o]=e[o]);return i.prototype=e.prototype,t.prototype=new i,t.__super__=e.prototype,t};d=Tether.Utils,h=d.extend,f=d.removeClass,s=d.addClass,a=d.hasClass,e=d.Evented,l=d.getBounds,c=d.uniqueId,i=new e,t={top:"bottom center",left:"middle right",right:"middle left",bottom:"top center"},r=function(t){var e;return e=document.createElement("div"),e.innerHTML=t,e.children[0]},p=function(t,e){var i,o,n,s,r;return i=null!=(o=null!=(n=null!=(s=null!=(r=t.matches)?r:t.matchesSelector)?s:t.webkitMatchesSelector)?n:t.mozMatchesSelector)?o:t.oMatchesSelector,i.call(t,e)},u=function(t,e){var i,o,n,s,r,h;if(null==t)return t;if("object"==typeof t)return t;for(s=t.split(" "),s.length>e.length&&(s[0]=s.slice(0,+(s.length-e.length)+1||9e9).join(" "),s.splice(1,s.length-e.length)),o={},i=r=0,h=e.length;h>r;i=++r)n=e[i],o[n]=s[i];return o},o=function(e){function i(t,e){this.tour=t,this.destroy=g(this.destroy,this),this.scrollTo=g(this.scrollTo,this),this.complete=g(this.complete,this),this.cancel=g(this.cancel,this),this.isOpen=g(this.isOpen,this),this.hide=g(this.hide,this),this.show=g(this.show,this),this.setOptions(e)}return v(i,e),i.prototype.setOptions=function(t){var e,i,o,n;if(this.options=null!=t?t:{},this.destroy(),this.id=this.options.id||this.id||"step-"+c(),this.options.when){n=this.options.when;for(e in n)i=n[e],this.on(e,i,this)}return null!=(o=this.options).buttons?(o=this.options).buttons:o.buttons=[{text:"Next",action:this.tour.next}]},i.prototype.getTour=function(){return this.tour},i.prototype.bindAdvance=function(){var t,e,i,o,n=this;return o=u(this.options.advanceOn,["selector","event"]),t=o.event,i=o.selector,e=function(t){if(n.isOpen())if(null!=i){if(p(t.target,i))return n.tour.next()}else if(n.el&&t.target===n.el)return n.tour.next()},document.body.addEventListener(t,e),this.on("destroy",function(){return document.body.removeEventListener(t,e)})},i.prototype.getAttachTo=function(){var t;if(t=u(this.options.attachTo,["element","on"]),null==t&&(t={}),"string"==typeof t.element&&(t.element=document.querySelector(t.element),null==t.element))throw new Error("Shepherd step's attachTo was not found in the page");return t},i.prototype.setupTether=function(){var e,i,o;if("undefined"==typeof Tether||null===Tether)throw new Error("Using the attachment feature of Shepherd requires the Tether library");return i=this.getAttachTo(),e=t[i.on||"right"],null==i.element&&(i.element="viewport",e="middle center"),o={classPrefix:"shepherd",element:this.el,constraints:[{to:"window",pin:!0,attachment:"together"}],target:i.element,offset:i.offset||"0 0",attachment:e},this.tether=new Tether(h(o,this.options.tetherOptions))},i.prototype.show=function(){var t=this;return null==this.el&&this.render(),s(this.el,"shepherd-open"),document.body.setAttribute("data-shepherd-step",this.id),this.setupTether(),this.options.scrollTo&&setTimeout(function(){return t.scrollTo()}),this.trigger("show")},i.prototype.hide=function(){var t;return f(this.el,"shepherd-open"),document.body.removeAttribute("data-shepherd-step"),null!=(t=this.tether)&&t.destroy(),this.tether=null,this.trigger("hide")},i.prototype.isOpen=function(){return a(this.el,"shepherd-open")},i.prototype.cancel=function(){return this.tour.cancel(),this.trigger("cancel")},i.prototype.complete=function(){return this.tour.complete(),this.trigger("complete")},i.prototype.scrollTo=function(){var t;return t=this.getAttachTo().element,null!=t?t.scrollIntoView():void 0},i.prototype.destroy=function(){var t;return null!=this.el&&(document.body.removeChild(this.el),delete this.el),null!=(t=this.tether)&&t.destroy(),this.tether=null,this.trigger("destroy")},i.prototype.render=function(){var t,e,i,o,n,s,h,l,a,p,u,f,c,d,g,m,v;if(null!=this.el&&this.destroy(),this.el=r(""),o=document.createElement("div"),o.className="shepherd-content",this.el.appendChild(o),s=document.createElement("header"),o.appendChild(s),null!=this.options.title&&(s.innerHTML+=""+this.options.title+"
",this.el.className+=" shepherd-has-title"),this.options.showCancelLink&&(h=r("✕"),s.appendChild(h),this.el.className+=" shepherd-has-cancel-link",this.bindCancelLink(h)),null!=this.options.text){for(p=r(""),a=this.options.text,"string"==typeof a&&(a=[a]),u=0,c=a.length;c>u;u++)l=a[u],p.innerHTML+=""+l+"
";o.appendChild(p)}if(n=document.createElement("footer"),this.options.buttons){for(e=r(""),m=this.options.buttons,f=0,d=m.length;d>f;f++)i=m[f],t=r(""+i.text+""),e.appendChild(t),this.bindButtonEvents(i,t.querySelector("a"));n.appendChild(e)}return o.appendChild(n),document.body.appendChild(this.el),this.setupTether(),this.options.advanceOn?this.bindAdvance():void 0},i.prototype.bindCancelLink=function(t){var e=this;return t.addEventListener("click",function(t){return t.preventDefault(),e.cancel()})},i.prototype.bindButtonEvents=function(t,e){var i,o,n,s,r=this;null==t.events&&(t.events={}),null!=t.action&&(t.events.click=t.action),s=t.events;for(i in s)o=s[i],"string"==typeof o&&(n=o,o=function(){return r.tour.show(n)}),e.addEventListener(i,o);return this.on("destroy",function(){var n,s;n=t.events,s=[];for(i in n)o=n[i],s.push(e.removeEventListener(i,o));return s})},i}(e),n=function(t){function e(t){var e,o,n,s,r,h,l=this;for(this.options=null!=t?t:{},this.hide=g(this.hide,this),this.complete=g(this.complete,this),this.cancel=g(this.cancel,this),this.back=g(this.back,this),this.next=g(this.next,this),this.steps=null!=(r=this.options.steps)?r:[],h=["complete","cancel","hide","start","show","active","inactive"],o=function(t){return l.on(t,function(e){return null==e&&(e={}),e.tour=l,i.trigger(t,e)})},n=0,s=h.length;s>n;n++)e=h[n],o(e)}return v(e,t),e.prototype.addStep=function(t,e){var i;return null==e&&(e=t),e instanceof o?e.tour=this:(("string"==(i=typeof t)||"number"===i)&&(e.id=t.toString()),e=h({},this.options.defaults,e),e=new o(this,e)),this.steps.push(e),e},e.prototype.getById=function(t){var e,i,o,n;for(n=this.steps,i=0,o=n.length;o>i;i++)if(e=n[i],e.id===t)return e},e.prototype.getCurrentStep=function(){return this.currentStep},e.prototype.next=function(){var t;return t=this.steps.indexOf(this.currentStep),t===this.steps.length-1?(this.hide(t),this.trigger("complete"),this.done()):this.show(t+1)},e.prototype.back=function(){var t;return t=this.steps.indexOf(this.currentStep),this.show(t-1)},e.prototype.cancel=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("cancel"),this.done()},e.prototype.complete=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("complete"),this.done()},e.prototype.hide=function(){var t;return null!=(t=this.currentStep)&&t.hide(),this.trigger("hide"),this.done()},e.prototype.done=function(){return i.activeTour=null,f(document.body,"shepherd-active"),this.trigger("inactive",{tour:this})},e.prototype.show=function(t){var e;return null==t&&(t=0),this.currentStep?this.currentStep.hide():(s(document.body,"shepherd-active"),this.trigger("active",{tour:this})),i.activeTour=this,e="string"==typeof t?this.getById(t):this.steps[t],e?(this.trigger("show",{step:e,previous:this.currentStep}),this.currentStep=e,e.show()):void 0},e.prototype.start=function(){return this.trigger("start"),this.currentStep=null,this.next()},e}(e),h(i,{Tour:n,Step:o,Evented:e}),window.Shepherd=i}.call(this);
\ No newline at end of file
diff --git a/ajax/libs/shepherd/package.json b/ajax/libs/shepherd/package.json
index 3c63ea5ed..2e158e73d 100644
--- a/ajax/libs/shepherd/package.json
+++ b/ajax/libs/shepherd/package.json
@@ -1,6 +1,7 @@
{
"name": "shepherd",
"version": "0.5.1",
+ "filename": "shepherd.min.js",
"description": "Guide your users through a tour of your app.",
"authors": [
"Adam Schwartz ",