!function(a,b,c,d){a.fn.popup=function(e){var f,g=a(this),h=a(c),i=g.selector||"",j=(new Date).getTime(),k=[],l=arguments[0],m="string"==typeof l,n=[].slice.call(arguments,1);return g.each(function(){var c,g=a.isPlainObject(e)?a.extend(!0,{},a.fn.popup.settings,e):a.fn.popup.settings,o=g.selector,p=g.className,q=g.error,r=g.metadata,s=g.namespace,t="."+g.namespace,u=g.namespace+"-module",v=a(this),w=a(b),x=v.offsetParent(),y=g.inline?v.next(g.selector.popup):w.children(g.selector.popup).last(),z=0,A=this,B=v.data(u);c={initialize:function(){c.debug("Initializing module",v),"hover"==g.on?v.on("mouseenter"+t,c.event.mouseenter).on("mouseleave"+t,c.event.mouseleave):v.on(g.on+""+t,c.event[g.on]),w.on("resize"+t,c.event.resize),c.instantiate()},instantiate:function(){c.verbose("Storing instance of module",c),B=c,v.data(u,B)},refresh:function(){y=g.inline?v.next(o.popup):w.children(o.popup).last(),x=v.offsetParent()},destroy:function(){c.debug("Destroying previous module"),v.off(t).removeData(u)},event:{mouseenter:function(b){var d=this;c.timer=setTimeout(function(){a.proxy(c.toggle,d)(),a(d).hasClass(p.visible)&&b.stopPropagation()},g.delay)},mouseleave:function(){clearTimeout(c.timer),v.is(":visible")&&c.hide()},click:function(b){a.proxy(c.toggle,this)(),a(this).hasClass(p.visible)&&b.stopPropagation()},resize:function(){y.is(":visible")&&c.position()}},create:function(){c.debug("Creating pop-up html");var b=v.data(r.html)||g.html,d=v.data(r.variation)||g.variation,e=v.data(r.title)||g.title,f=v.data(r.content)||v.attr("title")||g.content;b||f||e?(b||(b=g.template({title:e,content:f})),y=a("
").addClass(p.popup).addClass(d).html(b),g.inline?(c.verbose("Inserting popup element inline",y),y.insertAfter(v)):(c.verbose("Appending popup element to body",y),y.appendTo(a("body"))),a.proxy(g.onCreate,y)()):c.error(q.content)},remove:function(){c.debug("Removing popup"),y.remove()},get:{offstagePosition:function(){var d={top:a(b).scrollTop(),bottom:a(b).scrollTop()+a(b).height(),left:0,right:a(b).width()},e={width:y.width(),height:y.outerHeight(),position:y.offset()},f={},g=[];return e.position&&(f={top:e.position.topd.bottom,right:e.position.left+e.width>d.right,left:e.position.left0?g.join(" "):!1},nextPosition:function(a){switch(a){case"top left":a="bottom left";break;case"bottom left":a="top right";break;case"top right":a="bottom right";break;case"bottom right":a="top center";break;case"top center":a="bottom center";break;case"bottom center":a="right center";break;case"right center":a="left center";break;case"left center":a="top center"}return a}},toggle:function(){v=a(this),c.debug("Toggling pop-up"),c.refresh(),v.hasClass(p.visible)||("click"==g.on&&c.hideAll(),c.show())},position:function(d,e){var f,h,i=(a(b).width(),a(b).height(),v.outerWidth()),j=v.outerHeight(),k=y.width(),l=y.outerHeight(),m=g.inline?v.position():v.offset(),n=g.inline?x.outerWidth():w.outerWidth(),o=g.inline?x.outerHeight():w.outerHeight();switch(d=d||v.data(r.position)||g.position,e=e||v.data(r.arrowOffset)||g.arrowOffset,c.debug("Calculating offset for position",d),d){case"top left":f={bottom:o-m.top+g.distanceAway,right:n-m.left-i-e,top:"auto",left:"auto"};break;case"top center":f={bottom:o-m.top+g.distanceAway,left:m.left+i/2-k/2+e,top:"auto",right:"auto"};break;case"top right":f={top:"auto",bottom:o-m.top+g.distanceAway,left:m.left+e};break;case"left center":f={top:m.top+j/2-l/2,right:n-m.left+g.distanceAway-e,left:"auto",bottom:"auto"};break;case"right center":f={top:m.top+j/2-l/2,left:m.left+i+g.distanceAway+e,bottom:"auto",right:"auto"};break;case"bottom left":f={top:m.top+j+g.distanceAway,right:n-m.left-i-e,left:"auto",bottom:"auto"};break;case"bottom center":f={top:m.top+j+g.distanceAway,left:m.left+i/2-k/2+e,bottom:"auto",right:"auto"};break;case"bottom right":f={top:m.top+j+g.distanceAway,left:m.left+e,bottom:"auto",right:"auto"}}return a.extend(f,{width:y.width()+1}),y.css(f).removeClass(p.position).addClass(d),h=c.get.offstagePosition(),h?(c.debug("Element is outside boundaries ",h),z0&&(console.groupCollapsed(b),console.table?console.table(k):a.each(k,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),k=[]}},invoke:function(b,e,g){var h,i,j;return e=e||n,g=A||g,"string"==typeof b&&B!==d&&(b=b.split(/[\. ]/),h=b.length-1,a.each(b,function(e,f){var g=e!=h?f+b[e+1].charAt(0).toUpperCase()+b[e+1].slice(1):b;if(a.isPlainObject(B[f])&&e!=h)B=B[f];else{if(!a.isPlainObject(B[g])||e==h)return B[f]!==d?(i=B[f],!1):B[g]!==d?(i=B[g],!1):(c.error(q.method),!1);B=B[g]}})),a.isFunction(i)?j=i.apply(g,e):i!==d&&(j=i),a.isArray(f)?f.push(j):"string"==typeof f?f=[f,j]:j!==d&&(f=j),i}},m?(B===d&&c.initialize(),c.invoke(l)):(B!==d&&c.destroy(),c.initialize())}),f!==d?f:this},a.fn.popup.settings={name:"Popup",debug:!0,verbose:!0,performance:!0,namespace:"popup",onCreate:function(){},onShow:function(){},onHide:function(){},variation:"",content:!1,html:!1,title:!1,on:"hover",clicktoClose:!0,position:"top center",delay:150,inline:!0,duration:150,easing:"easeOutQuint",transition:"scale",distanceAway:0,arrowOffset:0,maxSearchDepth:10,error:{content:"Your popup has no content specified",method:"The method you called is not defined.",recursion:"Popup attempted to reposition element to fit, but could not find an adequate position."},metadata:{arrowOffset:"arrowOffset",content:"content",html:"html",position:"position",title:"title",variation:"variation"},className:{popup:"ui popup",visible:"visible",loading:"loading",position:"top left center bottom right"},selector:{popup:".ui.popup"},template:function(a){var b="";return typeof a!==d&&(typeof a.title!==d&&a.title&&(b+='
'+a.title+'
'),typeof a.content!==d&&a.content&&(b+='
'+a.content+"
")),b}}}(jQuery,window,document);