forked from HubSpot/drop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drop.min.js
2 lines (2 loc) · 24.3 KB
/
drop.min.js
1
2
/*! drop 0.4.0 */
(function(){var t,e,o,n,i,s,r,l,h,a,p,f,u,d,c,g,m={}.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},v=[].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},d=function(){var t;return t=0,function(){return t++}}(),g={},h=function(t){var e,n,s,r,l;if(s=t._tetherZeroElement,null==s&&(s=t.createElement("div"),s.setAttribute("data-tether-id",d()),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]={},l=s.getBoundingClientRect();for(n in l)r=l[n],g[e][n]=r;o(function(){return g[e]=void 0})}return g[e]},f=null,r=function(t){var e,o,n,i,s,r,l;t===document?(o=document,t=document.documentElement):o=t.ownerDocument,n=o.documentElement,e={},l=t.getBoundingClientRect();for(i in l)r=l[i],e[i]=r;return s=h(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},l=function(t){return t.offsetParent||document.documentElement},i=function(t){var e,o,n,i,s,r,l;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),l=e.slice(1),s=0,r=l.length;r>s;s++)if(n=l[s])for(o in n)m.call(n,o)&&(i=n[o],t[o]=i);return t},u=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 u(t,e),t.className+=" "+e},p=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},c=function(t,o,n){var i,s,r,l,h,a;for(s=0,l=n.length;l>s;s++)i=n[s],b.call(o,i)<0&&p(t,i)&&u(t,i);for(a=[],r=0,h=o.length;h>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<this.bindings[t].length;)i.push(this.bindings[t][o].handler===e?this.bindings[t].splice(o,1):o++);return i}},t.prototype.trigger=function(){var t,e,o,n,i,s,r,l,h;if(o=arguments[0],t=2<=arguments.length?v.call(arguments,1):[],null!=(r=this.bindings)?r[o]:void 0){for(i=0,h=[];i<this.bindings[o].length;)l=this.bindings[o][i],n=l.handler,e=l.ctx,s=l.once,n.apply(null!=e?e:this,t),h.push(s?this.bindings[o].splice(i,1):i++);return h}},t}(),Tether.Utils={getScrollParent:a,getBounds:r,getOffsetParent:l,extend:i,addClass:e,removeClass:u,hasClass:p,updateClasses:c,defer:o,flush:s,uniqueId:d,Evented:t}}).call(this),function(){var t,e,o,n,i,s,r,l,h,a,p,f,u,d,c,g,m,b,v,y,w,C,O,T,x,P,E,L=[].slice,A=function(t,e){return function(){return t.apply(e,arguments)}};if("undefined"==typeof Tether||null===Tether)throw new Error("You must include the utils.js file before tether.js");E=Tether.Utils,d=E.getScrollParent,c=E.getSize,u=E.getOuterSize,p=E.getBounds,f=E.getOffsetParent,h=E.extend,n=E.addClass,w=E.removeClass,T=E.updateClasses,l=E.defer,a=E.flush,x=function(t,e,o){return null==o&&(o=1),t+o>=e&&e>=t-o},O=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,l,h;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},l=["resize","scroll","touchmove"],h=[],s=0,r=l.length;r>s;s++)t=l[s],h.push(window.addEventListener(t,i));return h}(),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?L.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},b=v=function(t){var e,o,n;return n=t.split(" "),o=n[0],e=n[1],{top:o,left:e}},P=function(){function t(t){this.position=A(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,l,a;for(this.options=t,null==e&&(e=!0),o={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=h(o,this.options),l=this.options,this.element=l.element,this.target=l.target,this.targetModifier=l.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=b(this.options.targetAttachment),this.attachment=b(this.options.attachment),this.offset=v(this.options.offset),this.targetOffset=v(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent="scroll-handle"===this.targetModifier?this.target:d(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,o,n,i,s,r,l,h;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.top<pageYOffset&&(i.top=pageYOffset),i.left<pageXOffset&&(i.left=pageXOffset),i);case"scroll-handle":return h=this.target,h===document.body?(h=document.documentElement,t={left:pageXOffset,top:pageYOffset,height:innerHeight,width:innerWidth}):t=p(h),l=getComputedStyle(h),o=h.scrollWidth>h.clientWidth||"scroll"===[l.overflow,l.overflowX]||this.target!==document.body,s=0,o&&(s=15),n=t.height-parseFloat(l.borderTopWidth)-parseFloat(l.borderBottomWidth)-s,i={width:15,height:.975*n*(n/h.scrollHeight),left:t.left+t.width-parseFloat(l.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=this.target.scrollTop/(h.scrollHeight-n),i.top=r*(n-i.height-e)+t.top+parseFloat(l.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,h,a,p,f,u=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),s=["left","top","bottom","right","middle","center"],(null!=(f=this._addAttachClasses)?f.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(h=0,p=s.length;p>h;h++)i=s[h],n.push(""+this.getClass("target-attached")+"-"+i);return l(function(){return null!=u._addAttachClasses?(T(u.element,u._addAttachClasses,n),T(u.target,u._addAttachClasses,n),u._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,o,n,l,h,u,d,c,g,b,v,y,w,C,O,T,x,P,E,L,A,M,_,B,W,S,F,Y,z,H,X,N,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,n=e.height,0===B&&0===n&&null!=this.lastSize?(z=this.lastSize,B=z.width,n=z.height):this.lastSize={width:B,height:n},M=A=this.cache("target-bounds",function(){return j.getTargetBounds()}),g=m(s(this.attachment),{width:B,height:n}),L=m(s(E),M),h=m(this.offset,{width:B,height:n}),u=m(this.targetOffset,M),g=i(g,h),L=i(L,u),l=A.left+L.left-g.left,_=A.top+L.top-g.top,H=Tether.modules,W=0,F=H.length;F>W;W++)if(d=H[W],O=d.position.call(this,{left:l,top:_,targetAttachment:E,targetPos:A,elementPos:e,offset:g,targetOffset:L,manualOffset:h,manualTargetOffset:u}),null!=O&&"object"==typeof O){if(O===!1)return!1;_=O.top,l=O.left}if(c={page:{top:_,bottom:document.body.scrollHeight-_-n,left:l,right:document.body.scrollWidth-l-B},viewport:{top:_-pageYOffset,bottom:pageYOffset-_-n+innerHeight,left:l-pageXOffset,right:pageXOffset-l-B+innerWidth}},(null!=(X=this.options.optimizations)?X.moveElement:void 0)!==!1&&null==this.targetModifier){for(v=this.cache("target-offsetparent",function(){return f(j.target)}),C=this.cache("target-offsetparent-bounds",function(){return p(v)}),w=getComputedStyle(v),o=getComputedStyle(this.element),y=C,b={},N=["Top","Left","Bottom","Right"],S=0,Y=N.length;Y>S;S++)P=N[S],b[P.toLowerCase()]=parseFloat(w["border"+P+"Width"]);C.right=document.body.scrollWidth-C.left-y.width+b.right,C.bottom=document.body.scrollHeight-C.top-y.height+b.bottom,c.page.top>=C.top+b.top&&c.page.bottom>=C.bottom&&c.page.left>=C.left+b.left&&c.page.right>=C.right&&(x=v.scrollTop,T=v.scrollLeft,c.offset={top:c.page.top-C.top+x-b.top,left:c.page.left-C.left+T-b.left})}return this.move(c),this.history.unshift(c),this.history.length>3&&this.history.pop(),t&&a(),!0}},t.prototype.move=function(t){var e,o,n,i,s,r,a,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(i in t[d]){for(n=!1,y=this.history,b=0,v=y.length;v>b;b++)if(a=y[b],!x(null!=(w=a[d])?w[i]:void 0,t[d][i])){n=!0;break}n||(p[d][i]=!0)}}e={top:"",left:"",right:"",bottom:""},u=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[O]="translateX("+Math.round(n)+"px) translateY("+Math.round(i)+"px)","msTransform"!==O?e[O]+=" 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(i in e)c=e[i],o=this.element.style[i],""===o||""===c||"top"!==i&&"left"!==i&&"bottom"!==i&&"right"!==i||(o=parseFloat(o),c=parseFloat(c)),o!==c&&(g=!0,m[i]=e[i]);return g?l(function(){return h(C.element.style,m)}):void 0}},t}(),Tether.position=y,window.Tether=h(P,Tether)}.call(this),function(){var t,e,o,n,i,s,r,l,h,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,l=a.getSize,n=a.extend,h=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,l,h,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=l=s(o),h=getComputedStyle(o),o=[i.left,i.top,l.width+i.left,l.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(h["border"+r+"Width"]):o[n]-=parseFloat(h["border"+r+"Width"]);return o},Tether.modules.push({position:function(e){var r,l,a,f,u,d,c,g,m,b,v,y,w,C,O,T,x,P,E,L,A,M,_,B,W,S,F,Y,z,H,X,N,j,D,k,U,R,q,Z,$,I,G,J,K,Q,V,te,ee=this;if(S=e.top,v=e.left,A=e.targetAttachment,!this.options.constraints)return!0;for(P=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},$=this.cache("element-bounds",function(){return s(ee.element)}),b=$.height,F=$.width,0===F&&0===b&&null!=this.lastSize&&(I=this.lastSize,F=I.width,b=I.height),_=this.cache("target-bounds",function(){return ee.getTargetBounds()}),M=_.height,B=_.width,L={},m={},l=[this.getClass("pinned"),this.getClass("out-of-bounds")],G=this.options.constraints,Y=0,N=G.length;N>Y;Y++)g=G[Y],g.outOfBoundsClass&&l.push(g.outOfBoundsClass),g.pinnedClass&&l.push(g.pinnedClass);for(z=0,j=l.length;j>z;z++)for(c=l[z],J=["left","top","right","bottom"],H=0,D=J.length;D>H;H++)E=J[H],l.push(""+c+"-"+E);for(r=[],L=n({},A),m=n({},this.attachment),K=this.options.constraints,X=0,k=K.length;k>X;X++){if(g=K[X],W=g.to,a=g.attachment,O=g.pin,null==a&&(a=""),p.call(a," ")>=0?(Q=a.split(" "),d=Q[0],u=Q[1]):u=d=a,f=i(this,W),("target"===d||"both"===d)&&(S<f[1]&&"top"===L.top&&(S+=M,L.top="bottom"),S+b>f[3]&&"bottom"===L.top&&(S-=M,L.top="top")),"together"===d&&(S<f[1]&&"top"===L.top&&("bottom"===m.top?(S+=M,L.top="bottom",S+=b,m.top="top"):"top"===m.top&&(S+=M,L.top="bottom",S-=b,m.top="bottom")),S+b>f[3]&&"bottom"===L.top&&("top"===m.top?(S-=M,L.top="top",S-=b,m.top="bottom"):"bottom"===m.top&&(S-=M,L.top="top",S+=b,m.top="top"))),("target"===u||"both"===u)&&(v<f[0]&&"left"===L.left&&(v+=B,L.left="right"),v+F>f[2]&&"right"===L.left&&(v-=B,L.left="left")),"together"===u&&(v<f[0]&&"left"===L.left?"right"===m.left?(v+=B,L.left="right",v+=F,m.left="left"):"left"===m.left&&(v+=B,L.left="right",v-=F,m.left="right"):v+F>f[2]&&"right"===L.left&&("left"===m.left?(v-=B,L.left="left",v-=F,m.left="right"):"right"===m.left&&(v-=B,L.left="left",v+=F,m.left="left"))),("element"===d||"both"===d)&&(S<f[1]&&"bottom"===m.top&&(S+=b,m.top="top"),S+b>f[3]&&"top"===m.top&&(S-=b,m.top="bottom")),("element"===u||"both"===u)&&(v<f[0]&&"right"===m.left&&(v+=F,m.left="left"),v+F>f[2]&&"left"===m.left&&(v-=F,m.left="right")),"string"==typeof O?O=function(){var t,e,o,n;for(o=O.split(","),n=[],e=0,t=o.length;t>e;e++)C=o[e],n.push(C.trim());return n}():O===!0&&(O=["top","left","right","bottom"]),O||(O=[]),T=[],y=[],S<f[1]&&(p.call(O,"top")>=0?(S=f[1],T.push("top")):y.push("top")),S+b>f[3]&&(p.call(O,"bottom")>=0?(S=f[3]-b,T.push("bottom")):y.push("bottom")),v<f[0]&&(p.call(O,"left")>=0?(v=f[0],T.push("left")):y.push("left")),v+F>f[2]&&(p.call(O,"right")>=0?(v=f[2]-F,T.push("right")):y.push("right")),T.length)for(x=null!=(V=this.options.pinnedClass)?V:this.getClass("pinned"),r.push(x),q=0,U=T.length;U>q;q++)E=T[q],r.push(""+x+"-"+E);if(y.length)for(w=null!=(te=this.options.outOfBoundsClass)?te:this.getClass("out-of-bounds"),r.push(w),Z=0,R=y.length;R>Z;Z++)E=y[Z],r.push(""+w+"-"+E);(p.call(T,"left")>=0||p.call(T,"right")>=0)&&(m.left=L.left=!1),(p.call(T,"top")>=0||p.call(T,"bottom")>=0)&&(m.top=L.top=!1),(L.top!==A.top||L.left!==A.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,L)}return o(function(){return h(ee.target,r,l),h(ee.element,r,l)}),{top:S,left:v}}})}.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,l,h,a,p,f,u,d,c,g,m,b,v,y,w,C,O,T,x,P,E,L,A,M=this;if(c=n.top,a=n.left,x=this.cache("element-bounds",function(){return e(M.element)}),h=x.height,g=x.width,d=this.getTargetBounds(),l=c+h,p=a+g,i=[],c<=d.bottom&&l>=d.top)for(P=["left","right"],m=0,w=P.length;w>m;m++)f=P[m],((E=d[f])===a||E===p)&&i.push(f);if(a<=d.right&&p>=d.left)for(L=["top","bottom"],b=0,C=L.length;C>b;b++)f=L[b],((A=d[f])===c||A===l)&&i.push(f);for(r=[],s=[],u=["left","top","right","bottom"],r.push(this.getClass("abutted")),v=0,O=u.length;O>v;v++)f=u[v],r.push(""+this.getClass("abutted")+"-"+f);for(i.length&&s.push(this.getClass("abutted")),y=0,T=i.length;T>y;y++)f=i[y],s.push(""+this.getClass("abutted")+"-"+f);return t(function(){return o(M.target,s,r),o(M.element,s,r)}),!0}})}.call(this),function(){Tether.modules.push({position:function(t){var e,o,n,i,s,r,l;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)):(l=[n.top,n.left],s=l[0],i=l[1]),r+=s,e+=i,{top:r,left:e}):void 0}})}.call(this),function(){var t,e,o,n,i,s,r,l,h,a,p,f,u={}.hasOwnProperty,d=function(t,e){function o(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype,t},c=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1};f=Tether.Utils,r=f.extend,o=f.addClass,h=f.removeClass,l=f.hasClass,t=f.Evented,p="ontouchstart"in document.documentElement,i=["click"],p&&i.push("touchstart"),a=function(t){var e,o,n,i;return n=t.split(" "),e=n[0],o=n[1],("left"===e||"right"===e)&&(i=[o,e],e=i[0],o=i[1]),[e,o].join(" ")},e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle",center:"center"},n={},s=function(p){var f,u,g,m;return null==p&&(p={}),g=function(){return function(t,e,o){o.prototype=t.prototype;var n=new o,i=t.apply(n,e);return Object(i)===i?i:n}(f,arguments,function(){})},r(g,{createContext:s,drops:[],defaults:{}}),u={classPrefix:"drop",defaults:{position:"bottom left",openOn:"click",constrainToScrollParent:!0,constrainToWindow:!0,classes:"",tetherOptions:{}}},r(g,u,p),r(g.defaults,u.defaults,p.defaults),null==n[m=g.classPrefix]&&(n[m]=[]),g.updateBodyClasses=function(){var t,e,i,s,r;for(t=!1,r=n[g.classPrefix],i=0,s=r.length;s>i;i++)if(e=r[i],e.isOpened()){t=!0;break}return t?o(document.body,""+g.classPrefix+"-open"):h(document.body,""+g.classPrefix+"-open")},f=function(t){function s(t){if(this.options=t,this.options=r({},g.defaults,this.options),this.target=this.options.target,null==this.target)throw new Error("Drop Error: You must provide a target.");this.options.classes&&o(this.target,this.options.classes),g.drops.push(this),n[g.classPrefix].push(this),this.setupElements(),this.setupEvents(),this.setupTether()}return d(s,t),s.prototype.setupElements=function(){return this.drop=document.createElement("div"),o(this.drop,g.classPrefix),this.options.classes&&o(this.drop,this.options.classes),this.dropContent=document.createElement("div"),o(this.dropContent,""+g.classPrefix+"-content"),"object"==typeof this.options.content?this.dropContent.appendChild(this.options.content):this.dropContent.innerHTML=this.options.content,this.drop.appendChild(this.dropContent)},s.prototype.setupTether=function(){var t,o;return o=this.options.position.split(" "),o[0]=e[o[0]],o=o.join(" "),t=[],t.push(this.options.constrainToScrollParent?{to:"scrollParent",pin:"top, bottom",attachment:"together none"}:{to:"scrollParent"}),t.push(this.options.constrainToWindow!==!1?{to:"window",pin:!0,attachment:"together"}:{to:"window"}),p={element:this.drop,target:this.target,attachment:a(o),targetAttachment:a(this.options.position),classPrefix:g.classPrefix,offset:"0 0",targetOffset:"0 0",enabled:!1,constraints:t},this.options.tether!==!1?this.tether=new Tether(r({},p,this.options.tether)):void 0},s.prototype.setupEvents=function(){var t,e,o,n,s,r,l,h,a,p,f=this;if(this.options.openOn){if(o=this.options.openOn.split(" "),c.call(o,"click")>=0||c.call(o,"hover")>=0)for(s=function(t){return f.toggle(),t.preventDefault()},e=function(t){return!f.isOpened()||t.target===f.drop||f.drop.contains(t.target)||t.target===f.target||f.target.contains(t.target)?void 0:f.close()},a=0,p=i.length;p>a;a++)t=i[a],this.target.addEventListener(t,s),document.addEventListener(t,e);return c.call(o,"hover")>=0?(n=!1,h=function(){return n=!0,f.open()},l=null,r=function(){return n=!1,null!=l&&clearTimeout(l),l=setTimeout(function(){return n||f.close(),l=null},50)},this.target.addEventListener("mouseover",h),this.drop.addEventListener("mouseover",h),this.target.addEventListener("mouseout",r),this.drop.addEventListener("mouseout",r)):void 0}},s.prototype.isOpened=function(){return l(this.drop,""+g.classPrefix+"-open")},s.prototype.toggle=function(){return this.isOpened()?this.close():this.open()},s.prototype.open=function(){var t,e=this;return this.drop.parentNode||document.body.appendChild(this.drop),null!=(t=this.tether)&&t.enable(),o(this.drop,""+g.classPrefix+"-open"),o(this.drop,""+g.classPrefix+"-open-transitionend"),setTimeout(function(){return o(e.drop,""+g.classPrefix+"-after-open")}),this.tether.position(),this.trigger("open"),g.updateBodyClasses()},s.prototype.close=function(){var t,e=this;return h(this.drop,""+g.classPrefix+"-open"),h(this.drop,""+g.classPrefix+"-after-open"),this.drop.addEventListener("transitionend",function(){return l(e.drop,""+g.classPrefix+"-open")?void 0:h(e.drop,""+g.classPrefix+"-open-transitionend")}),this.trigger("close"),null!=(t=this.tether)&&t.disable(),g.updateBodyClasses()},s}(t),g},window.Drop=s(),document.addEventListener("DOMContentLoaded",function(){return Drop.updateBodyClasses()})}.call(this);