!function(t){"function"==typeof define&&define.amd?define(["jquery","./core"],t):t(jQuery,Formstone)}(function(h,$){"use strict";function e(t){j();var e=t.data;e.left=t.pageX,e.top=t.pageY,function(t){j();var e="";e+='
',e+='
',e+=t.formatter.call(t.$el,t),e+='',e+="
",L={$tooltip:h(e+="
"),$el:t.$el},$.$body.append(L.$tooltip);var o=L.$tooltip.find(w.content),i=L.$tooltip.find(w.caret),n=t.$el.offset(),r=t.$el.outerHeight(),l=t.$el.outerWidth(),c=0,s=0,a=0,f=0,d=!1,u=!1,p=i.outerHeight(!0),m=i.outerWidth(!0),g=o.outerHeight(!0),e=o.outerWidth(!0);"right"===t.direction||"left"===t.direction?(u=(g-p)/2,f=-g/2,"right"===t.direction?a=t.margin:"left"===t.direction&&(a=-(e+t.margin))):(d=(e-m)/2,a=-e/2,"bottom"===t.direction?f=t.margin:"top"===t.direction&&(f=-(g+t.margin)));o.css({top:f,left:a}),i.css({top:u,left:d}),t.follow?t.$el.on(H.mouseMove,t,b):(t.match?"right"===t.direction||"left"===t.direction?(s=t.top,"right"===t.direction?c=n.left+l:"left"===t.direction&&(c=n.left)):(c=t.left,"bottom"===t.direction?s=n.top+r:"top"===t.direction&&(s=n.top)):"right"===t.direction||"left"===t.direction?(s=n.top+r/2,"right"===t.direction?c=n.left+l:"left"===t.direction&&(c=n.left)):(c=n.left+l/2,"bottom"===t.direction?s=n.top+r:"top"===t.direction&&(s=n.top)),y(c,s));t.timer=W.startTimer(t.timer,t.delay,function(){L.$tooltip.addClass(C.visible)}),t.$el.one(H.mouseLeave,t,v)}(e)}function v(t){t=t.data;W.clearTimer(t.timer),j()}function b(t){y(t.pageX,t.pageY)}function y(t,e){L&&L.$tooltip.css({left:t,top:e})}function j(){L&&(L.$el.off([H.mouseMove,H.mouseLeave].join(" ")),L.$tooltip.remove(),L=null)}var t=$.Plugin("tooltip",{widget:!0,defaults:{customClass:"",delay:0,direction:"top",follow:!1,formatter:function(t){return this.data("title")},margin:15,match:!1,theme:"fs-light"},classes:["content","caret","visible","top","bottom","right","left"],methods:{_construct:function(t){this.on(H.mouseEnter,t,e)},_destruct:function(t){j(),this.off(H.namespace)}}}),w=t.classes,C=w.raw,H=t.events,W=t.functions,L=null});