!function(a,b,c,d){a.fn.popup=function(e){var f,g=a(this),h=a(c),i=a("body"),j=g.selector||"",k=(new Date).getTime(),l=[],m=arguments[0],n="string"==typeof m,o=[].slice.call(arguments,1);return g.each(function(){var c,g=a.isPlainObject(e)?a.extend(!0,{},a.fn.popup.settings,e):a.extend({},a.fn.popup.settings),p=g.selector,q=g.className,r=g.error,s=g.metadata,t=g.namespace,u="."+g.namespace,v="module-"+t,w=a(this),x=g.target?a(g.target):w,y=a(b),z=g.inline?x.offsetParent():y,A=g.inline?x.next(g.selector.popup):y.children(g.selector.popup).last(),B=0,C=this,D=w.data(v);c={initialize:function(){c.debug("Initializing module",w),"click"==g.on?w.on("click",c.toggle):w.on(c.get.startEvent()+u,c.event.start).on(c.get.endEvent()+u,c.event.end),g.target&&c.debug("Target set to element",x),y.on("resize"+u,c.event.resize),c.instantiate()},instantiate:function(){c.verbose("Storing instance of module",c),D=c,w.data(v,D)},refresh:function(){g.inline?(A=x.next(p.popup),z=x.offsetParent()):(console.log("found by refresh"),A=y.children(p.popup).last())},destroy:function(){c.debug("Destroying previous module"),y.off(u),A.remove(),w.off(u).removeData(v)},event:{start:function(){c.timer=setTimeout(function(){c.is.hidden()&&c.show()},g.delay)},end:function(){clearTimeout(c.timer),c.is.visible()&&c.hide()},resize:function(){c.is.visible()&&c.set.position()}},create:function(){c.debug("Creating pop-up html");var b=w.data(s.html)||g.html,d=w.data(s.variation)||g.variation,e=w.data(s.title)||g.title,f=w.data(s.content)||w.attr("title")||g.content;b||f||e?(b||(b=g.template({title:e,content:f})),A=a("
").addClass(q.popup).addClass(d).html(b),g.inline?(c.verbose("Inserting popup element inline",A),A.insertAfter(w)):(c.verbose("Appending popup element to body",A),A.appendTo(i)),a.proxy(g.onCreate,A)()):c.error(r.content)},toggle:function(){c.debug("Toggling pop-up"),c.is.hidden()?(c.hideAll(),c.show()):c.hide()},show:function(){c.debug("Showing pop-up",g.transition),c.exists()||c.create(),c.set.position(),w.addClass(q.visible),g.transition&&a.fn.transition!==d?A.transition(g.transition+" in",g.duration,c.bind.close):A.stop().fadeIn(g.duration,g.easing,c.bind.close),a.proxy(g.onShow,A)()},hide:function(){w.removeClass(q.visible),c.unbind.close(),c.is.visible()&&(c.debug("Hiding pop-up"),g.transition&&a.fn.transition!==d?A.transition(g.transition+" out",g.duration,c.reset):A.stop().fadeOut(g.duration,g.easing,c.reset)),a.proxy(g.onHide,A)()},hideAll:function(){a(p.popup).filter(":visible").popup("hide")},hideGracefully:function(b){0===a(b.target).closest(p.popup).size()&&c.hide()},exists:function(){return g.inline?0!==A.size():A.parent(i).size()},remove:function(){c.debug("Removing popup"),A.remove()},get:{startEvent:function(){return"hover"==g.on?"mouseenter":"focus"==g.on?"focus":void 0},endEvent:function(){return"hover"==g.on?"mouseleave":"focus"==g.on?"blur":void 0},offstagePosition:function(){var d={top:a(b).scrollTop(),bottom:a(b).scrollTop()+a(b).height(),left:0,right:a(b).width()},e={width:A.width(),height:A.outerHeight(),position:A.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}},set:{position:function(d,e){var f,h,i=(a(b).width(),a(b).height(),x.outerWidth()),j=x.outerHeight(),k=A.width(),l=A.outerHeight(),m=z.outerWidth(),n=z.outerHeight(),o=g.distanceAway,p=g.inline?x.position():x.offset();switch(d=d||w.data(s.position)||g.position,e=e||w.data(s.offset)||g.offset,g.inline&&("left center"==d||"right center"==d?(e+=parseInt(b.getComputedStyle(C).getPropertyValue("margin-top"),10),o+=-parseInt(b.getComputedStyle(C).getPropertyValue("margin-left"),10)):(e+=parseInt(b.getComputedStyle(C).getPropertyValue("margin-left"),10),o+=parseInt(b.getComputedStyle(C).getPropertyValue("margin-top"),10))),c.debug("Calculating offset for position",d),d){case"top left":f={bottom:n-p.top+o,right:m-p.left-e,top:"auto",left:"auto"};break;case"top center":f={bottom:n-p.top+o,left:p.left+i/2-k/2+e,top:"auto",right:"auto"};break;case"top right":f={top:"auto",bottom:n-p.top+o,left:p.left+i+e,right:"auto"};break;case"left center":f={top:p.top+j/2-l/2+e,right:m-p.left+o,left:"auto",bottom:"auto"};break;case"right center":f={top:p.top+j/2-l/2+e,left:p.left+i+o,bottom:"auto",right:"auto"};break;case"bottom left":f={top:p.top+j+o,right:m-p.left-e,left:"auto",bottom:"auto"};break;case"bottom center":f={top:p.top+j+o,left:p.left+i/2-k/2+e,bottom:"auto",right:"auto"};break;case"bottom right":f={top:p.top+j+o,left:p.left+i+e,bottom:"auto",right:"auto"}}return A.css(f).removeClass(q.position).addClass(d),h=c.get.offstagePosition(),h?(c.debug("Element is outside boundaries",h),B0&&(console.groupCollapsed(b),console.table?console.table(l):a.each(l,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),l=[]}},invoke:function(b,e,g){var h,i,j;return e=e||o,g=C||g,"string"==typeof b&&D!==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(D[f])&&e!=h)D=D[f];else{if(!a.isPlainObject(D[g])||e==h)return D[f]!==d?(i=D[f],!1):D[g]!==d?(i=D[g],!1):(c.error(r.method),!1);D=D[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}},n?(D===d&&c.initialize(),c.invoke(m)):(D!==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",target:!1,closable:!0,position:"top center",delay:150,inline:!1,preserve:!1,duration:250,easing:"easeOutQuint",transition:"scale",distanceAway:0,offset: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:{content:"content",html:"html",offset:"offset",position:"position",title:"title",variation:"variation"},className:{loading:"loading",popup:"ui popup",position:"top left center bottom right",visible:"visible"},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);