metamaps--metamaps/public/assets/application-360c6083a16b5cd18ed968ac99bcab71.js

31 lines
546 KiB
JavaScript
Raw Normal View History

/*!
* jQuery JavaScript Library v1.8.1
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: Thu Aug 30 2012 17:17:22 GMT-0400 (Eastern Daylight Time)
*/
function BestInPlaceEditor(e){this.element=e,this.initOptions(),this.bindForm(),this.initNil(),jQuery(this.activator).bind("click",{editor:this},this.clickHandler)}function openAnalyze(){analyzeOpen=!0,findOpen&&closeFind(),organizeOpen&&closeOrganize(),$("#sideOptionFind").css("z-index","8"),$("#sideOptionAnalyze, #closeAnalyze").css("z-index","10"),$("#sideOptionOrganize").css("z-index","8"),$("#sideOptionAnalyze").animate({width:"100px",height:"76px"},100),$("#closeAnalyze").css("display","block"),$("#sideOptionAnalyze").css("cursor","default");var e=Object.keys(Mconsole.graph.nodes).length,t=0;Mconsole.graph.eachNode(function(e){e.eachAdjacency(function(){t++})}),t/=2,$(".analysis").html("<p>"+e+" topics</p><p>"+t+" synapses</p>")}function closeAnalyze(){analyzeOpen=!1,$("#closeAnalyze").css("display","none"),$("#sideOptionAnalyze").css("cursor","pointer"),$("#sideOptionAnalyze").animate({width:"64px",height:"32px"},100)}function switchVisible(e,t){categoryVisible[e]==1?hideCategory(e,t):categoryVisible[e]==0&&showCategory(e,t)}function hideCategory(e,t){t==null&&(t=500),Mconsole.graph.eachNode(function(t){t.getData("metacode")==e&&(t.setData("alpha",.4,"end"),t.eachAdjacency(function(e){e.setData("alpha",.4,"end")}))}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:t})}function showCategory(e,t){t==null&&(t=500),Mconsole.graph.eachNode(function(t){t.getData("metacode")==e&&(t.setData("alpha",1,"end"),t.eachAdjacency(function(e){e.setData("alpha",1,"end")}))}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:t})}function hideAll(e){e==null&&(e=500),Mconsole.graph.eachNode(function(e){!e.getData("greenCircle")&&!e.getData("whiteCircle")&&(e.setData("alpha",.4,"end"),e.eachAdjacency(function(e){e.setData("alpha",.4,"end")}))}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:e})}function showAll(e){e==null&&(e=500),Mconsole.graph.eachNode(function(e){e.setData("alpha",1,"end"),e.eachAdjacency(function(e){e.setData("alpha",1,"end")})}),Mconsole.fx.animate({modes:["node-property:alpha","edge-property:alpha"],duration:e})}function onCanvasSearch(e,t,n){e=name.toLowerCase(),Mconsole.graph.eachNode(function(r){nodeName=r.name.toLowerCase(),name!=null?nodeName.indexOf(e)!==-1&&e!=""?r.setData("whiteCircle",!0):r.setData("whiteCircle",!1):t!=null?r.getData("inmaps").indexOf(parseInt(t))!==-1?r.setData("whiteCircle",!0):r.setData("whiteCircle",!1):n!=null&&(r.getData("userid").toString()==n?r.setData("whiteCircle",!0):r.setData("whiteCircle",!1)),Mconsole.plot()})}function clearCanvas(){Mconsole.graph.eachNode(function(e){Mconsole.graph.removeNode(e.id),Mconsole.labels.disposeLabel(e.id),delete Mconsole.labels.labels[""+e.id]}),Mconsole.plot()}function clearCanvasExceptRoot(){var e=new Array;Mconsole.graph.eachNode(function(t){e.push(t.id)});var t=Mconsole.graph.nodes[Mconsole.root];e.forEach(function(e,n){e!=t.id&&(Mconsole.graph.removeNode(e),Mconsole.labels.hideLabel(e),$("#topic_"+e+"_label").hide())}),fetchRelatives(t)}function clearFoundData(){Mconsole.graph.eachNode(function(e){e.getData("greenCircle")===!0&&(Mconsole.graph.removeNode(e.id),Mconsole.labels.hideLabel(e.id),$("#topic_"+e.id+"_label").hide())}),Mconsole.plot()}function openFind(){findOpen=!0,analyzeOpen&&closeAnalyze(),organizeOpen&&closeOrganize(),$("#sideOptionFind, #closeFind").css("z-index","10"),$("#sideOptionAnalyze").css("z-index","9"),$("#sideOptionOrganize").css("z-index","8"),firstVal=$('#sideOptionFind option[value="name"]').attr("selected"),secondVal=$('#sideOptionFind option[value="metacode"]').attr("selected"),thirdVal=$('#sideOptionFind option[value="map (by name)"]').attr("selected"),fourthVal=$('#sideOptionFind option[value="mapper (by name)"]').attr("selected"),firstVal==="selected"||thirdVal==="selected"||fourthVal==="selected"?$("#sideOptionFind").animate({width:"305px",height:"76px"},100,function(){$("#topic_by_name_input").focus()}):secondVal==="selected"?$("#sideOptionFind").animate({width:"380px",height:"463px"},100,function(){}):th
,"pointer"),$("#sideOptionOrganize").animate({width:"75px",height:"32px"},100)}function authorizeToEdit(e){return!userid||e.data.$permission!="commons"&&e.data.$userid!=userid?!1:!0}function mk_permission(e){if(e.getData("permission")=="commons")return"co";if(e.getData("permission")=="public")return"pu";if(e.getData("permission")=="private")return"pr"}function centerOn(e){if(!Mconsole.busy){var t=Mconsole.graph.getNode(e);$("h1.index").html("Viewing Topic: "+t.name),window.history.pushState(t.name,"Metamaps","/topics/"+t.id),Mconsole.onClick(t.id,{hideLabels:!1,duration:1e3,onComplete:function(){fetchRelatives(t)}})}}function editEdge(e,t){if(authorizeToEdit(e)){var n=$("#edit_synapse").css("left"),r=$("#edit_synapse").css("top");$("#edit_synapse").remove(),deselectEdge(e);var i=document.createElement("div");i.setAttribute("id","edit_synapse"),i.className="permission canEdit",$(".main .wrapper").append(i),populateEditEdgeForm(e),$("#edit_synapse").css("position","absolute"),t?($("#edit_synapse").css("left",t.clientX),$("#edit_synapse").css("top",t.clientY)):($("#edit_synapse").css("left",n),$("#edit_synapse").css("top",r)),$("#edit_synapse").show(),MetamapsModel.edgecardInUse=e.data.$id}else!authorizeToEdit(e)&&userid&&alert("You don't have the permissions to edit this synapse.")}function populateEditEdgeForm(e){add_perms_form(e),add_direction_form(e),add_name_form(e)}function add_name_form(e){var t='<span class="gray">Click to add description.</span>';$("#edit_synapse").append('<div id="edit_synapse_name"></div>'),$("#edit_synapse_name").attr("class","best_in_place best_in_place_desc"),$("#edit_synapse_name").attr("data-object","synapse"),$("#edit_synapse_name").attr("data-attribute","desc"),$("#edit_synapse_name").attr("data-type","input"),$("#edit_synapse_name").attr("data-nil",t),$("#edit_synapse_name").attr("data-url","/synapses/"+e.getData("id")),$("#edit_synapse_name").html(e.getData("desc")),$("#edit_synapse_name").html().trim()==""&&$("#edit_synapse_name").html(t),$("#edit_synapse_name").bind("ajax:success",function(){var n=$(this).html();n==t?e.setData("desc",""):e.setData("desc",n),selectEdge(e),Mconsole.plot()})}function add_perms_form(e){$("#edit_synapse").append('<div class="mapPerm"></div>'),$("#edit_synapse .mapPerm").html(mk_permission(e)),userid==e.getData("userid")&&($("#edit_synapse").append('<div class="permActivator" />'),$("#edit_synapse .permActivator").append('<div class="editSettings" />'),$("#edit_synapse .editSettings").append("<span>Permissions:</span>"),$("#edit_synapse .editSettings").append('<span class="click-to-edit" />'),$("#edit_synapse .click-to-edit").attr("title","Click to Edit"),$("#edit_synapse .click-to-edit").append(best_in_place_perms(e)),$("#edit_synapse .editSettings").append('<div class="clearfloat" />'),$("#edit_synapse").find(".best_in_place_permission").bind("ajax:success",function(){var e=$(this).html();switch(e){case"commons":$("#edit_synapse .mapPerm").html("co");break;case"public":$("#edit_synapse .mapPerm").html("pu");break;case"private":$("#edit_synapse .mapPerm").html("pr")}}),$("#edit_synapse .permActivator").bind("mouseover",function(){clearTimeout(MetamapsModel.edgePermTimer2),that=this,MetamapsModel.edgePermTimer1=setTimeout(function(){MetamapsModel.edgePermSliding||(MetamapsModel.edgePermSliding=!0,$(that).animate({width:"203px",height:"37px"},300,function(){MetamapsModel.edgePermSliding=!1}))},300)}),$("#edit_synapse .permActivator").bind("mouseout",function(){clearTimeout(MetamapsModel.edgePermTimer1),that=this,MetamapsModel.edgePermTimer2=setTimeout(function(){MetamapsModel.edgePermSliding||(MetamapsModel.edgePermSliding=!0,$(that).animate({height:"16px",width:"16px"},300,function(){MetamapsModel.edgePermSliding=!1}))},800)}))}function add_direction_form(e){$("#edit_synapse").append('<input type="checkbox" id="edit_synapse_left">'),$("#edit_synapse").append('<label class="left">&lt;</label>'),$("#edit_synapse").append('<input type="checkbox" id="edit_synapse_right">'),$("#edit_synapse").append('<label class="right">&gt;</label>');if(e.nodeFrom.pos.x<e.node
).enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="<div></div>",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||++v.uuid:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i<s;i++)delete r[t[i]];if(!(n?B:v.isEmptyObject)(r))return}}if(!n){delete u[a].data;if(!B(u[a]))return}o?v.cleanData([e],!0):v.support.deleteExpando||u!=u.window?delete u[a]:u[a]=null},_data:function(e,t,n){return v.data(e,t,n,
e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:V?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(z,""),e[3]=(e[4]||e[5]||"").replace(z,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||Y.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&Y.error(e[0]),e},PSEUDO:function(e,t,n){var r,i;if(W.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(r=e[4])B.test(r)&&(i=nt(r,t,n,!0))&&(i=r.indexOf(")",r.length-i)-r.length)&&(r=r.slice(0,i),e[0]=e[0].slice(0,i)),e[2]=r;return e.slice(0,3)}},filter:{ID:i?function(e){return e=e.replace(z,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace(z,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace(z,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=x[d][e];return t||(t=x(e,new RegExp("(^|"+C+")"+e+"("+C+"|$)"))),function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")}},ATTR:function(e,t,n){return t?function(r){var i=Y.attr(r,e),s=i+"";if(i==null)return t==="!=";switch(t){case"=":return s===n;case"!=":return s!==n;case"^=":return n&&s.indexOf(n)===0;case"*=":return n&&s.indexOf(n)>-1;case"$=":return n&&s.substr(s.length-n.length)===n;case"~=":return(" "+s+" ").indexOf(n)>-1;case"|=":return s===n||s.substr(0,n.length+1)===n+"-"}}:function(t){return Y.attr(t,e)!=null}},CHILD:function(e,t,n,r){if(e==="nth"){var i=y++;return function(e){var t,s,o=0,u=e;if(n===1&&r===0)return!0;t=e.parentNode;if(t&&(t[d]!==i||!e.sizset)){for(u=t.firstChild;u;u=u.nextSibling)if(u.nodeType===1){u.sizset=++o;if(u===e)break}t[d]=i}return s=e.sizset-r,n===0?s===0:s%n===0&&s/n>=0}}return function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t,n,r){var i,o=s.pseudos[e]||s.pseudos[e.toLowerCase()];return o||Y.error("unsupported pseudo: "+e),o[d]?o(t,n,r):o.length>1?(i=[e,e,"",t],function(e){return o(e,0,i)}):o}},pseudos:{not:E(function(e,t,n){var r=f(e.replace(D,"$1"),t,n);return function(e){return!r(e)}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!s.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},contains:E(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),has:E(function(e){return function(t){return Y(e,t).length>0}}),header:function(e){return R.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:Z("radio"),checkbox:Z("checkbox"),file:Z("file"),password:Z("password"),image:Z("image"),submit:et("submit"),reset:e
(c.xml=h);try{c.text=a.responseText}catch(e){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i,s=this.createTween(e,t),o=zn.exec(t),u=s.cur(),a=+u||0,f=1;if(o){n=+o[2],r=o[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&a){a=v.css(s.elem,e,!0)||n||1;do i=f=f||".5",a/=f,v.style(s.elem,e,a+r),f=s.cur()/u;while(f!==1&&f!==i)}s.unit=r,s.start=a,s.end=o[1]?a+(o[1]+1)*n:n}return s}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],Vn[n]=Vn[n]||[],Vn[n].unshift(t)},prefilter:function(e,t){t?Xn.unshift(e):Xn.push(e)}}),v.Tween=Yn,Yn.prototype={constructor:Yn,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(v.cssNumber[n]?"":"px")},cur:function(){var e=Yn.propHooks[this.prop];return e&&e.get?e.get(this):Yn.propHooks._default.get(this)},run:function(e){var t,n=Yn.propHooks[this.prop];return this.options.duration?this.pos=t=v.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Yn.propHooks._default.set(this),this}},Yn.prototype.init.prototype=Yn.prototype,Yn.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=v.css(e.elem,e.prop,!1,""),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){v.fx.step[e.prop]?v.fx.step[e.prop](e):e.elem.style&&(e.elem.style[v.cssProps[e.prop]]!=null||v.cssHooks[e.prop])?v.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Yn.propHooks.scrollTop=Yn.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},v.each(["toggle","show","hide"],function(e,t){var n=v.fn[t];v.fn[t]=function(r,i,s){return r==null||typeof r=="boolean"||!e&&v.isFunction(r)&&v.isFunction(i)?n.apply(this,arguments):this.animate(Zn(t,!0),r,i,s)}}),v.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Gt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=v.isEmptyObject(e),s=v.speed(t,n,r),o=function(){var t=Kn(this,v.extend({},e),s);i&&t.stop(!0)};return i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=e!=null&&e+"queueHooks",s=v.timers,o=v._data(this);if(n)o[n]&&o[n].stop&&i(o[n]);else for(n in o)o[n]&&o[n].stop&&Wn.test(n)&&i(o[n]);for(n=s.length;n--;)s[n].elem===this&&(e==null||s[n].queue===e)&&(s[n].anim.stop(r),t=!1,s.splice(n,1));(t||!r)&&v.dequeue(this,e)})}}),v.each({slideDown:Zn("show"),slideUp:Zn("hide"),slideToggle:Zn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){v.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),v.speed=function(e,t,n){var r=e&&typeof e=="object"?v.extend({},e):{complete:n||!n&&t||v.isFunction(e)&&e,duration:e,easing:n&&t||t&&!v.isFunction(t)&&t};r.duration=v.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in v.fx.speeds?v.fx.speeds[r.duration]:v.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){v.isFunction(r.old)&&r.old.call(this),r.queue&&v.dequeue(this,r.queue)},r},v.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},v.timers=[],v.fx=Yn.prototype.init,v.fx.tick=function(){var e,t=v.timers,n=0;for(;n<t.length;n++)e=t[n],!e()&&t[n]===e&&t.splice(n--,1);t.length||v.fx.stop()},v.fx.timer=functio
,' color="',r,'" />')}function z(t,n,r,i){var s=t.fillStyle,u=t.arcScaleX_,a=t.arcScaleY_,f=i.x-r.x,l=i.y-r.y;if(s instanceof $){var c=0,h={x:0,y:0},p=0,d=1;if(s.type_=="gradient"){var v=s.x0_/u,m=s.y0_/a,g=s.x1_/u,y=s.y1_/a,b=W(t,v,m),w=W(t,g,y),E=w.x-b.x,S=w.y-b.y;c=Math.atan2(E,S)*180/Math.PI,c<0&&(c+=360),c<1e-6&&(c=0)}else{var b=W(t,s.x0_,s.y0_);h={x:(b.x-r.x)/f,y:(b.y-r.y)/l},f/=u*o,l/=a*o;var x=e.max(f,l);p=2*s.r0_/x,d=2*s.r1_/x-p}var T=s.colors_;T.sort(function(e,t){return e.offset-t.offset});var N=T.length,C=T[0].color,k=T[N-1].color,L=T[0].alpha*t.globalAlpha,A=T[N-1].alpha*t.globalAlpha,O=[];for(var _=0;_<N;_++){var D=T[_];O.push(D.offset*d+p+" "+D.color)}n.push('<g_vml_:fill type="',s.type_,'"',' method="none" focus="100%"',' color="',C,'"',' color2="',k,'"',' colors="',O.join(","),'"',' opacity="',A,'"',' g_o_:opacity2="',L,'"',' angle="',c,'"',' focusposition="',h.x,",",h.y,'" />')}else if(s instanceof J){if(f&&l){var P=-r.x,H=-r.y;n.push("<g_vml_:fill",' position="',P/f*u*u,",",H/l*a*a,'"',' type="tile"',' src="',s.src_,'" />')}}else{var B=M(t.fillStyle),j=B.color,F=B.alpha*t.globalAlpha;n.push('<g_vml_:fill color="',j,'" opacity="',F,'" />')}}function W(e,t,n){var r=e.m_;return{x:o*(t*r[0][0]+n*r[1][0]+r[2][0])-u,y:o*(t*r[0][1]+n*r[1][1]+r[2][1])-u}}function X(e){return isFinite(e[0][0])&&isFinite(e[0][1])&&isFinite(e[1][0])&&isFinite(e[1][1])&&isFinite(e[2][0])&&isFinite(e[2][1])}function V(e,t,n){if(!X(t))return;e.m_=t;if(n){var r=t[0][0]*t[1][1]-t[0][1]*t[1][0];e.lineScale_=s(i(r))}}function $(e){this.type_=e,this.x0_=0,this.y0_=0,this.r0_=0,this.x1_=0,this.y1_=0,this.r1_=0,this.colors_=[]}function J(e,t){Q(e);switch(t){case"repeat":case null:case"":this.repetition_="repeat";break;case"repeat-x":case"repeat-y":case"no-repeat":this.repetition_=t;break;default:K("SYNTAX_ERR")}this.src_=e.src,this.width_=e.width,this.height_=e.height}function K(e){throw new G(e)}function Q(e){(!e||e.nodeType!=1||e.tagName!="IMG")&&K("TYPE_MISMATCH_ERR"),e.readyState!="complete"&&K("INVALID_STATE_ERR")}function G(e){this.code=this[e],this.message=e+": DOM Exception "+this.code}var e=Math,t=e.round,n=e.sin,r=e.cos,i=e.abs,s=e.sqrt,o=10,u=o/2,a=+navigator.userAgent.match(/MSIE ([\d.]+)?/)[1],l=Array.prototype.slice;d(document);var v={init:function(e){var t=e||document;t.createElement("canvas"),t.attachEvent("onreadystatechange",c(this.init_,this,t))},init_:function(e){var t=e.getElementsByTagName("canvas");for(var n=0;n<t.length;n++)this.initElement(t[n])},initElement:function(e){if(!e.getContext){e.getContext=f,d(e.ownerDocument),e.innerHTML="",e.attachEvent("onpropertychange",m),e.attachEvent("onresize",g);var t=e.attributes;t.width&&t.width.specified?e.style.width=t.width.nodeValue+"px":e.width=e.clientWidth,t.height&&t.height.specified?e.style.height=t.height.nodeValue+"px":e.height=e.clientHeight}return e}};v.init();var y=[];for(var b=0;b<16;b++)for(var w=0;w<16;w++)y[b*16+w]=b.toString(16)+w.toString(16);var T={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",grey:"#808080",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:
();var r=new t({initialize:function(e){this.setOptions(e)},setOptions:function(t){var r={duration:2500,fps:40,transition:n.Quart.easeInOut,compute:e.empty,complete:e.empty,link:"ignore"};return this.opt=e.merge(r,t||{}),this},step:function(){var t=e.time(),n=this.opt;if(t<this.time+n.duration){var r=n.transition((t-this.time)/n.duration);n.compute(r)}else this.timer=clearInterval(this.timer),n.compute(1),n.complete()},start:function(){return this.check()?(this.time=0,this.startTimer(),this):this},startTimer:function(){var t=this,n=this.opt.fps;return this.timer?!1:(this.time=e.time()-this.time,this.timer=setInterval(function(){t.step()},Math.round(1e3/n)),!0)},pause:function(){return this.stopTimer(),this},resume:function(){return this.startTimer(),this},stopTimer:function(){return this.timer?(this.time=e.time()-this.time,this.timer=clearInterval(this.timer),!0):!1},check:function(){return this.timer?this.opt.link=="cancel"?(this.stopTimer(),!0):!1:!0}}),i=function(){var t=arguments;for(var n=0,r=t.length,s={};n<r;n++){var o=i[t[n]];o.$extend?e.extend(s,o):s[t[n]]=o}return s};i.AreaChart={$extend:!0,animate:!0,labelOffset:3,type:"stacked",Tips:{enable:!1,onShow:e.empty,onHide:e.empty},Events:{enable:!1,onClick:e.empty},selectOnHover:!0,showAggregates:!0,showLabels:!0,filterOnClick:!1,restoreOnRightClick:!1},i.Margin={$extend:!1,top:0,left:0,right:0,bottom:0},i.Canvas={$extend:!0,injectInto:"id",width:!1,height:!1,useCanvas:!1,withLabels:!0,background:!1},i.Tree={$extend:!0,orientation:"left",subtreeOffset:8,siblingOffset:5,indent:10,multitree:!1,align:"center"},i.Node={$extend:!1,overridable:!1,type:"circle",color:"#ccb",alpha:1,dim:3,height:20,width:90,autoHeight:!1,autoWidth:!1,lineWidth:1,transform:!0,align:"center",angularWidth:1,span:1,CanvasStyles:{}},i.Edge={$extend:!1,overridable:!1,type:"line",color:"#ccb",lineWidth:1,dim:15,alpha:1,epsilon:7,CanvasStyles:{}},i.Fx={$extend:!0,fps:40,duration:2500,transition:$jit.Trans.Quart.easeInOut,clearCanvas:!0},i.Label={$extend:!1,overridable:!1,type:"HTML",style:" ",size:10,family:"sans-serif",textAlign:"center",textBaseline:"alphabetic",color:"#fff"},i.Tips={$extend:!1,enable:!1,type:"auto",offsetX:20,offsetY:20,force:!1,onShow:e.empty,onHide:e.empty},i.NodeStyles={$extend:!1,enable:!1,type:"auto",stylesHover:!1,stylesClick:!1},i.Events={$extend:!1,enable:!1,enableForEdges:!1,type:"auto",onClick:e.empty,onRightClick:e.empty,onMouseMove:e.empty,onMouseEnter:e.empty,onMouseLeave:e.empty,onDragStart:e.empty,onDragMove:e.empty,onDragCancel:e.empty,onDragEnd:e.empty,onTouchStart:e.empty,onTouchMove:e.empty,onTouchEnd:e.empty,onMouseWheel:e.empty},i.Navigation={$extend:!1,enable:!1,type:"auto",panning:!1,zooming:!1},i.Controller={$extend:!0,onBeforeCompute:e.empty,onAfterCompute:e.empty,onCreateLabel:e.empty,onPlaceLabel:e.empty,onComplete:e.empty,onBeforePlotLine:e.empty,onAfterPlotLine:e.empty,onBeforePlotNode:e.empty,onAfterPlotNode:e.empty,request:!1};var s={initialize:function(e,t){this.viz=t,this.canvas=t.canvas,this.config=t.config[e],this.nodeTypes=t.fx.nodeTypes;var n=this.config.type;this.dom=n=="auto"?t.config.Label.type!="Native":n!="Native",this.labelContainer=this.dom&&t.labels.getLabelContainer(),this.isEnabled()&&this.initializePost()},initializePost:e.empty,setAsProperty:e.lambda(!1),isEnabled:function(){return this.config.enable},isLabel:function(t,n){t=e.event.get(t,n);var r=this.labelContainer,i=t.target||t.srcElement;return i&&i.parentNode==r?i:!1}},o={onMouseUp:e.empty,onMouseDown:e.empty,onMouseMove:e.empty,onMouseOver:e.empty,onMouseOut:e.empty,onMouseWheel:e.empty,onTouchStart:e.empty,onTouchMove:e.empty,onTouchEnd:e.empty,onTouchCancel:e.empty},u=new t({initialize:function(e){this.viz=e,this.canvas=e.canvas,this.node=!1,this.edge=!1,this.registeredObjects=[],this.attachEvents()},attachEvents:function(){var t=this.canvas.getElement(),n=this;t.oncontextmenu=e.lambda(!1),e.addEvents(t,{mouseup:function(t,r){var i=e.event.get(t,r);n.handleEvent("MouseUp",t,r,n.makeEventObject(t,r),e.event.isRightClick(i))},mousedown:function(t,r){var i=e.event.get(t,r);n.
.nodeTo.id);for(var r in e.data||{})n.data[r]=e.data[r]}});if(t){var n=i.graph.getNode(e.id);for(var r in e.data||{})n.data[r]=e.data[r]}}),i.graph.eachNode(function(e){e.eachAdjacency(function(e){u.getAdjacence(e.nodeFrom.id,e.nodeTo.id)||i.graph.removeAdjacence(e.nodeFrom.id,e.nodeTo.id)}),u.hasNode(e.id)||i.graph.removeNode(e.id)});break;case"replot":i.labels.clearLabels(!0),this.morph(t,{type:"nothing"}),i.refresh(!0),i.refresh(!0);break;case"fade:seq":case"fade":case"fade:con":that=this,u=i.construct(t);var a=r&&"node-property"in r&&e.map(e.splat(r["node-property"]),function(e){return"$"+e});i.graph.eachNode(function(t){var n=u.getNode(t.id);if(!n)t.setData("alpha",1),t.setData("alpha",1,"start"),t.setData("alpha",0,"end"),t.ignore=!0;else{var r=n.data;for(var i in r)a&&e.indexOf(a,i)>-1?t.endData[i]=r[i]:t.data[i]=r[i]}}),i.graph.eachNode(function(e){if(e.ignore)return;e.eachAdjacency(function(e){if(e.nodeFrom.ignore||e.nodeTo.ignore)return;var t=u.getNode(e.nodeFrom.id),n=u.getNode(e.nodeTo.id);if(!t.adjacentTo(n)){var e=i.graph.getAdjacence(t.id,n.id);f=!0,e.setData("alpha",1),e.setData("alpha",1,"start"),e.setData("alpha",0,"end")}})});var f=this.preprocessSum(u),c=f?["node-property:alpha","edge-property:alpha"]:["node-property:alpha"];c[0]=c[0]+(r&&"node-property"in r?":"+e.splat(r["node-property"]).join(":"):""),c[1]=(c[1]||"edge-property:alpha")+(r&&"edge-property"in r?":"+e.splat(r["edge-property"]).join(":"):""),r&&"label-property"in r&&c.push("label-property:"+e.splat(r["label-property"]).join(":")),i.reposition(),i.graph.eachNode(function(e){e.id!=o&&e.pos.getp().equals(l.KER)&&(e.pos.set(e.endPos),e.startPos.set(e.endPos))}),i.fx.animate(e.merge(s,{modes:["polar"].concat(c),onComplete:function(){i.graph.eachNode(function(e){e.ignore&&i.graph.removeNode(e.id)}),i.graph.eachNode(function(e){e.eachAdjacency(function(e){e.ignore&&i.graph.removeAdjacence(e.nodeFrom.id,e.nodeTo.id)})}),s.onComplete()}}));break;default:}},contract:function(t,n){var r=this.viz;if(t.collapsed||!t.anySubnode(e.lambda(!0)))return;n=e.merge(this.options,r.config,n||{},{modes:["node-property:alpha:span","linear"]}),t.collapsed=!0,function i(e){e.eachSubnode(function(e){e.ignore=!0,e.setData("alpha",0,n.type=="animate"?"end":"current"),i(e)})}(t),n.type=="animate"?(r.compute("end"),r.rotated&&r.rotate(r.rotated,"none",{property:"end"}),function s(e){e.eachSubnode(function(e){e.setPos(t.getPos("end"),"end"),s(e)})}(t),r.fx.animate(n)):n.type=="replot"&&r.refresh()},expand:function(t,n){if(!("collapsed"in t))return;var r=this.viz;n=e.merge(this.options,r.config,n||{},{modes:["node-property:alpha:span","linear"]}),delete t.collapsed,function i(e){e.eachSubnode(function(e){delete e.ignore,e.setData("alpha",1,n.type=="animate"?"end":"current"),i(e)})}(t),n.type=="animate"?(r.compute("end"),r.rotated&&r.rotate(r.rotated,"none",{property:"end"}),r.fx.animate(n)):n.type=="replot"&&r.refresh()},preprocessSum:function(e){var t=this.viz;e.eachNode(function(e){if(!t.graph.hasNode(e.id)){t.graph.addNode(e);var n=t.graph.getNode(e.id);n.setData("alpha",0),n.setData("alpha",0,"start"),n.setData("alpha",1,"end")}});var n=!1;return e.eachNode(function(e){e.eachAdjacency(function(e){var r=t.graph.getNode(e.nodeFrom.id),i=t.graph.getNode(e.nodeTo.id);if(!r.adjacentTo(i)){var e=t.graph.addAdjacence(r,i,e.data);r.startAlpha==r.endAlpha&&i.startAlpha==i.endAlpha&&(n=!0,e.setData("alpha",0),e.setData("alpha",0,"start"),e.setData("alpha",1,"end"))}})}),n}};var m={none:{render:e.empty,contains:e.lambda(!1)},circle:{render:function(e,t,n,r){var i=r.getCtx();i.beginPath(),i.arc(t.x,t.y,n,0,Math.PI*2,!0),i.closePath(),i[e]()},contains:function(e,t,n){var r=e.x-t.x,i=e.y-t.y,s=r*r+i*i;return s<=n*n}},ellipse:{render:function(e,t,n,r,i){var s=i.getCtx();r/=2,n/=2,s.save(),s.scale(n/r,r/n),s.beginPath(),s.arc(t.x*(r/n),t.y*(n/r),r,0,Math.PI*2,!0),s.closePath(),s[e](),s.restore()},contains:function(e,t,n,r){n/=2,r/=2;var i=(n+r)/2,s=e.x-t.x,o=e.y-t.y,u=s*s+o*o;return u<=i*i}},square:{render:function(e,t,n,r){r.getCtx()[e+"Rect"](t.x-n,t.y-n,2*n,2*n)},contains:funct
.orientation;if(t.multitree){var r=e.nodeFrom,i=e.nodeTo;n="$orn"in r.data&&r.data.$orn||"$orn"in i.data&&i.data.$orn}return n}}),$jit.ST.Label={},$jit.ST.Label.Native=new t({Implements:d.Label.Native,renderLabel:function(e,t,n){var r=e.getCtx(),i=t.pos.getc(!0);r.fillText(t.name,i.x,i.y)}}),$jit.ST.Label.DOM=new t({Implements:d.Label.DOM,placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz.config,s=i.Node,o=this.viz.canvas,u=t.getData("width"),a=t.getData("height"),f=o.getSize(),l,c,h=o.translateOffsetX,p=o.translateOffsetY,d=o.scaleOffsetX,v=o.scaleOffsetY,m=r.x*d+h,g=r.y*v+p;if(s.align=="center")l={x:Math.round(m-u/2+f.width/2),y:Math.round(g-a/2+f.height/2)};else if(s.align=="left")c=i.orientation,c=="bottom"||c=="top"?l={x:Math.round(m-u/2+f.width/2),y:Math.round(g+f.height/2)}:l={x:Math.round(m+f.width/2),y:Math.round(g-a/2+f.height/2)};else{if(s.align!="right")throw"align: not implemented";c=i.orientation,c=="bottom"||c=="top"?l={x:Math.round(m-u/2+f.width/2),y:Math.round(g-a+f.height/2)}:l={x:Math.round(m-u+f.width/2),y:Math.round(g-a/2+f.height/2)}}var y=e.style;y.left=l.x+"px",y.top=l.y+"px",y.display=this.fitsInCanvas(l,o)?"":"none",n.onPlaceLabel(e,t)}}),$jit.ST.Label.SVG=new t({Implements:[$jit.ST.Label.DOM,d.Label.SVG],initialize:function(e){this.viz=e}}),$jit.ST.Label.HTML=new t({Implements:[$jit.ST.Label.DOM,d.Label.HTML],initialize:function(e){this.viz=e}}),$jit.ST.Plot.NodeTypes=new t({none:{render:e.empty,contains:e.lambda(!1)},circle:{render:function(e,t){var n=e.getData("dim"),r=this.getAlignedPos(e.pos.getc(!0),n,n),i=n/2;this.nodeHelper.circle.render("fill",{x:r.x+i,y:r.y+i},i,t)},contains:function(e,t){var n=e.getData("dim"),r=this.getAlignedPos(e.pos.getc(!0),n,n),i=n/2;this.nodeHelper.circle.contains({x:r.x+i,y:r.y+i},i)}},square:{render:function(e,t){var n=e.getData("dim"),r=n/2,i=this.getAlignedPos(e.pos.getc(!0),n,n);this.nodeHelper.square.render("fill",{x:i.x+r,y:i.y+r},r,t)},contains:function(e,t){var n=e.getData("dim"),r=this.getAlignedPos(e.pos.getc(!0),n,n),i=n/2;this.nodeHelper.square.contains({x:r.x+i,y:r.y+i},i)}},ellipse:{render:function(e,t){var n=e.getData("width"),r=e.getData("height"),i=this.getAlignedPos(e.pos.getc(!0),n,r);this.nodeHelper.ellipse.render("fill",{x:i.x+n/2,y:i.y+r/2},n,r,t)},contains:function(e,t){var n=e.getData("width"),r=e.getData("height"),i=this.getAlignedPos(e.pos.getc(!0),n,r);this.nodeHelper.ellipse.contains({x:i.x+n/2,y:i.y+r/2},n,r,canvas)}},rectangle:{render:function(e,t){var n=e.getData("width"),r=e.getData("height"),i=this.getAlignedPos(e.pos.getc(!0),n,r);this.nodeHelper.rectangle.render("fill",{x:i.x+n/2,y:i.y+r/2},n,r,t)},contains:function(e,t){var n=e.getData("width"),r=e.getData("height"),i=this.getAlignedPos(e.pos.getc(!0),n,r);this.nodeHelper.rectangle.contains({x:i.x+n/2,y:i.y+r/2},n,r,canvas)}}}),$jit.ST.Plot.EdgeTypes=new t({none:e.empty,line:{render:function(e,t){var n=this.getOrientation(e),r=e.nodeFrom,i=e.nodeTo,s=r._depth<i._depth,o=this.viz.geom.getEdge(s?r:i,"begin",n),u=this.viz.geom.getEdge(s?i:r,"end",n);this.edgeHelper.line.render(o,u,t)},contains:function(e,t){var n=this.getOrientation(e),r=e.nodeFrom,i=e.nodeTo,s=r._depth<i._depth,o=this.viz.geom.getEdge(s?r:i,"begin",n),u=this.viz.geom.getEdge(s?i:r,"end",n);return this.edgeHelper.line.contains(o,u,t,this.edge.epsilon)}},arrow:{render:function(e,t){var n=this.getOrientation(e),r=e.nodeFrom,i=e.nodeTo,s=e.getData("dim"),o=this.viz.geom.getEdge(r,"begin",n),u=this.viz.geom.getEdge(i,"end",n),a=e.data.$direction,f=a&&a.length>1&&a[0]!=r.id;this.edgeHelper.arrow.render(o,u,s,f,t)},contains:function(e,t){var n=this.getOrientation(e),r=e.nodeFrom,i=e.nodeTo,s=r._depth<i._depth,o=this.viz.geom.getEdge(s?r:i,"begin",n),u=this.viz.geom.getEdge(s?i:r,"end",n);return this.edgeHelper.arrow.contains(o,u,t,this.edge.epsilon)}},"quadratic:begin":{render:function(e,t){var n=this.getOrientation(e),r=e.nodeFrom,i=e.nodeTo,s=r._depth<i._depth,o=this.viz.geom.getEdge(s?r:i,"begin",n),u=this.viz.geom.getEdge(s?i:r,"end",n),a=e.getData("dim"),f=t.getCtx();f.beginPath(),f.moveTo(o.x,o.y);swit
(0,0,t.getPos().rho,0,0,t.getPos().rho+s),u=e.hexToRgb(t.getData("color")),a=[];e.each(u,function(e){a.push(parseInt(e*.5,10))});var f=e.rgbToHex(a);o.addColorStop(0,f),o.addColorStop(1,t.getData("color")),r.fillStyle=o,this.nodeTypes.multipie.render.call(this,t,n)},contains:function(e,t){return this.nodeTypes.multipie.contains.call(this,e,t)}},"gradient-pie":{render:function(t,n){var r=n.getCtx(),i=r.createRadialGradient(0,0,0,0,0,t.getPos().rho),s=e.hexToRgb(t.getData("color")),o=[];e.each(s,function(e){o.push(parseInt(e*.5,10))});var u=e.rgbToHex(o);i.addColorStop(1,u),i.addColorStop(0,t.getData("color")),r.fillStyle=i,this.nodeTypes.pie.render.call(this,t,n)},contains:function(e,t){return this.nodeTypes.pie.contains.call(this,e,t)}}}),n.Plot.EdgeTypes=new t({none:e.empty,line:{render:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);this.edgeHelper.line.render(n,r,t)},contains:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);return this.edgeHelper.line.contains(n,r,t,this.edge.epsilon)}},arrow:{render:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0),i=e.getData("dim"),s=e.data.$direction,o=s&&s.length>1&&s[0]!=e.nodeFrom.id;this.edgeHelper.arrow.render(n,r,i,o,t)},contains:function(e,t){var n=e.nodeFrom.pos.getc(!0),r=e.nodeTo.pos.getc(!0);return this.edgeHelper.arrow.contains(n,r,t,this.edge.epsilon)}},hyperline:{render:function(e,t){var n=e.nodeFrom.pos.getc(),r=e.nodeTo.pos.getc(),i=Math.max(n.norm(),r.norm());this.edgeHelper.hyperline.render(n.$scale(1/i),r.$scale(1/i),i,t)},contains:e.lambda(!1)}})}($jit.Sunburst),$jit.Sunburst.Plot.NodeTypes.implement({"piechart-stacked":{render:function(t,n){var r=t.pos.getp(!0),i=t.getData("dimArray"),s=t.getData("valueArray"),o=t.getData("colorArray"),u=o.length,a=t.getData("stringArray"),f=t.getData("span")/2,c=t.pos.theta,h=c-f,p=c+f,d=new l,v=n.getCtx(),m={},g=t.getData("gradient"),y=t.getData("border"),b=t.getData("config"),w=b.showLabels,E=b.resizeLabels,S=b.Label,x=b.sliceOffset*Math.cos((h+p)/2),T=b.sliceOffset*Math.sin((h+p)/2);if(o&&i&&a){for(var N=0,C=i.length,k=0,L=0;N<C;N++){var A=i[N],O=o[N%u];if(A<=0)continue;v.fillStyle=v.strokeStyle=O;if(g&&A){var M=v.createRadialGradient(x,T,k+b.sliceOffset,x,T,k+A+b.sliceOffset),_=e.hexToRgb(O),D=e.map(_,function(e){return e*.8>>0}),P=e.rgbToHex(D);M.addColorStop(0,O),M.addColorStop(.5,O),M.addColorStop(1,P),v.fillStyle=M}d.rho=k+b.sliceOffset,d.theta=h;var H=d.getc(!0);d.theta=p;var B=d.getc(!0);d.rho+=A;var j=d.getc(!0);d.theta=h;var F=d.getc(!0);v.beginPath(),v.arc(x,T,k+.01,h,p,!1),v.arc(x,T,k+A+.01,p,h,!0),v.fill(),y&&y.name==a[N]&&(m.acum=k,m.dimValue=i[N],m.begin=h,m.end=p),k+=A||0,L+=s[N]||0}if(y){v.save(),v.globalCompositeOperation="source-over",v.lineWidth=2,v.strokeStyle=y.color;var I=h<p?1:-1;v.beginPath(),v.arc(x,T,m.acum+.01+1,m.begin,m.end,!1),v.arc(x,T,m.acum+m.dimValue+.01-1,m.end,m.begin,!0),v.closePath(),v.stroke(),v.restore()}if(w&&S.type=="Native"){v.save(),v.fillStyle=v.strokeStyle=S.color;var q=E?t.getData("normalizedDim"):1,R=S.size*q>>0;R=R<+E?+E:R,v.font=S.style+" "+R+"px "+S.family,v.textBaseline="middle",v.textAlign="center",d.rho=k+b.labelOffset+b.sliceOffset,d.theta=t.pos.theta;var U=d.getc(!0);v.fillText(t.name,U.x,U.y),v.restore()}}},contains:function(e,t){if(this.nodeTypes.none.anglecontains.call(this,e,t)){var n=Math.sqrt(t.x*t.x+t.y*t.y),r=this.config.levelDistance,i=e._depth,s=e.getData("config");if(n<=r*i+s.sliceOffset){var o=e.getData("dimArray");for(var u=0,a=o.length,f=s.sliceOffset;u<a;u++){var l=o[u];if(n>=f&&n<=f+l)return{name:e.getData("stringArray")[u],color:e.getData("colorArray")[u],value:e.getData("valueArray")[u],label:e.name};f+=l}}return!1}return!1}}}),$jit.PieChart=new t({sb:null,colors:["#416D9C","#70A35E","#EBB056","#C74243","#83548B","#909291","#557EAA"],selected:{},busy:!1,initialize:function(t){this.controller=this.config=e.merge(i("Canvas","PieChart","Label"),{Label:{type:"Native"}},t),this.initializeViz()},initializeViz:function(){var e=this.config,t=this,n=e.type.split(":")[0],r=new $jit.Sunburst({injectInto:
.leaf(t)&&!this.config.titleHeight&&(e.style.display="none"),n.onPlaceLabel(e,t)}}),E.Label.HTML=new t({Implements:d.Label.HTML,initialize:function(e){this.viz=e,this.leaf=e.leaf,this.config=e.config},placeLabel:function(e,t,n){var r=t.pos.getc(!0),i=this.viz.canvas,s=i.translateOffsetX,o=i.translateOffsetY,u=i.scaleOffsetX,a=i.scaleOffsetY,f=i.getSize(),l={x:Math.round(r.x*u+s+f.width/2),y:Math.round(r.y*a+o+f.height/2)},c=e.style;c.left=l.x+"px",c.top=l.y+"px",c.width=t.getData("width")*u+"px",c.height=t.getData("height")*a+"px",c.zIndex=t._depth*100,c.display="",!this.leaf(t)&&!this.config.titleHeight&&(e.style.display="none"),n.onPlaceLabel(e,t)}}),E.Plot.NodeTypes=new t({none:{render:e.empty},rectangle:{render:function(t,n,r){var i=this.viz.leaf(t),s=this.config,o=s.offset,u=s.titleHeight,a=t.pos.getc(!0),f=t.getData("width"),l=t.getData("height"),c=t.getData("border"),h=n.getCtx(),p=a.x+o/2,d=a.y+o/2;if(f<=o||l<=o)return;if(i){if(s.cushion){var v=h.createRadialGradient(p+(f-o)/2,d+(l-o)/2,1,p+(f-o)/2,d+(l-o)/2,f<l?l:f),m=t.getData("color"),g=e.rgbToHex(e.map(e.hexToRgb(m),function(e){return e*.2>>0}));v.addColorStop(0,m),v.addColorStop(1,g),h.fillStyle=v}h.fillRect(p,d,f-o,l-o),c&&(h.save(),h.strokeStyle=c,h.strokeRect(p,d,f-o,l-o),h.restore())}else u>0&&(h.fillRect(a.x+o/2,a.y+o/2,f-o,u-o),c&&(h.save(),h.strokeStyle=c,h.strokeRect(a.x+o/2,a.y+o/2,f-o,l-o),h.restore()))},contains:function(e,t){if(this.viz.clickedNode&&!e.isDescendantOf(this.viz.clickedNode.id)||e.ignore)return!1;var n=e.pos.getc(!0),r=e.getData("width"),i=this.viz.leaf(e),s=i?e.getData("height"):this.config.titleHeight;return this.nodeHelper.rectangle.contains({x:n.x+r/2,y:n.y+s/2},t,r,s)}}}),E.Plot.EdgeTypes=new t({none:e.empty}),E.SliceAndDice=new t({Implements:[y,a,E.Base,b.TM.SliceAndDice]}),E.Squarified=new t({Implements:[y,a,E.Base,b.TM.Squarified]}),E.Strip=new t({Implements:[y,a,E.Base,b.TM.Strip]}),$jit.RGraph=new t({Implements:[y,a,b.Radial],initialize:function(t){var n=$jit.RGraph,r={interpolation:"linear",levelDistance:100};this.controller=this.config=e.merge(i("Canvas","Node","Edge","Fx","Controller","Tips","NodeStyles","Events","Navigation","Label"),r,t);var s=this.config;s.useCanvas?(this.canvas=s.useCanvas,this.config.labelContainer=this.canvas.id+"-label"):(s.background&&(s.background=e.merge({type:"Circles"},s.background)),this.canvas=new f(this,s),this.config.labelContainer=(typeof s.injectInto=="string"?s.injectInto:s.injectInto.id)+"-label"),this.graphOptions={complex:!1,Node:{selected:!1,exist:!0,drawn:!0}},this.graph=new d(this.graphOptions,this.config.Node,this.config.Edge),this.labels=new n.Label[s.Label.type](this),this.fx=new n.Plot(this,n),this.op=new n.Op(this),this.json=null,this.root=null,this.busy=!1,this.parent=!1,this.initializeExtras()},createLevelDistanceFunc:function(){var e=this.config.levelDistance;return function(t){return(t._depth+1)*e}},refresh:function(){this.compute(),this.plot()},reposition:function(){this.compute("end")},plot:function(){this.fx.plot()},getNodeAndParentAngle:function(e){var t=!1,n=this.graph.getNode(e),r=n.getParents(),i=r.length>0?r[0]:!1;if(i){var s=i.pos.getc(),o=n.pos.getc(),u=s.add(o.scale(-1));t=Math.atan2(u.y,u.x),t<0&&(t+=2*Math.PI)}return{parent:i,theta:t}},tagChildren:function(e,t){if(e.angleSpan){var n=[];e.eachAdjacency(function(e){n.push(e.nodeTo)},"ignore");var r=n.length;for(var i=0;i<r&&t!=n[i].id;i++);for(var s=(i+1)%r,o=0;t!=n[s].id;s=(s+1)%r)n[s].dist=o++}},onClick:function(t,n){if(this.root!=t&&!this.busy){this.busy=!0,this.root=t,that=this,this.controller.onBeforeCompute(this.graph.getNode(t));var r=this.getNodeAndParentAngle(t);this.tagChildren(r.parent,t),this.parent=r.parent,this.compute("end");var i=r.theta-r.parent.endPos.theta;this.graph.eachNode(function(e){e.endPos.set(e.endPos.getp().add(c(i,0)))});var s=this.config.interpolation;n=e.merge({onComplete:e.empty},n||{}),this.fx.animate(e.merge({hideLabels:!0,modes:[s]},n,{onComplete:function(){that.busy=!1,n.onComplete()}}))}}}),$jit.RGraph.$extend=!0,function(n){n.Op=new t({Implements:d.Op}),n.Plot=new t({Imp
),this.toggleStylesOnClick(e,!0),e.selected=!0,delete e.hovered,this.hoveredNode=!1)},onMouseMove:function(e,t,n){this.down&&(this.move=!0);if(this.dom&&this.isLabel(e,t))return;var r=this.nodeStylesOnHover;if(!r)return;if(!this.dom){if(this.hoveredNode){var i=this.types[this.hoveredNode.getData("type")],s=i&&i.contains&&i.contains.call(this.fx,this.hoveredNode,n.getPos());if(s)return}var o=n.getNode();if(!this.hoveredNode&&!o)return;if(o.hovered)return;o&&!o.selected?(this.fx.nodeFxAnimation.stopTimer(),this.viz.graph.eachNode(function(e){if(e.hovered&&!e.selected){for(var t in r)e.setData(t,e.styles["$"+t],"end");delete e.hovered}}),o.hovered=!0,this.hoveredNode=o,this.toggleStylesOnHover(o,!0)):this.hoveredNode&&!this.hoveredNode.selected&&(this.fx.nodeFxAnimation.stopTimer(),this.toggleStylesOnHover(this.hoveredNode,!1),delete this.hoveredNode.hovered,this.hoveredNode=!1)}}}),a.Classes.Navigation=new t({Implements:[s,o],initializePost:function(){this.pos=!1,this.pressed=!1},onMouseWheel:function(t,n,r){if(!this.config.zooming)return;if(t.target.id!="infovis-canvas")return;e.event.stop(e.event.get(t,n));var i=this.config.zooming/1e3,s=1+r*i;s>1?5>=this.canvas.scaleOffsetX&&this.canvas.scale(s,s):s<1&&this.canvas.scaleOffsetX>=.2&&this.canvas.scale(s,s)},onMouseDown:function(e,t,n){if(!this.config.panning)return;if(this.config.panning=="avoid nodes"&&n.getNode()||n.getEdge())return;this.pressed=!0,!MetamapsModel.boxStartCoordinates&&e.shiftKey&&(MetamapsModel.boxStartCoordinates=n.getPos()),MetamapsModel.didPan=!1,this.pos=n.getPos();var r=this.canvas,i=r.translateOffsetX,s=r.translateOffsetY,o=r.scaleOffsetX,u=r.scaleOffsetY;this.pos.x*=o,this.pos.x+=i,this.pos.y*=u,this.pos.y+=s},onMouseMove:function(e,t,n){if(!this.config.panning)return;if(!this.pressed)return;if(this.config.panning=="avoid nodes"&&n.getNode())return;if(!MetamapsModel.boxStartCoordinates&&e.shiftKey){Mconsole.busy=!0,MetamapsModel.boxStartCoordinates=n.getPos();return}if(MetamapsModel.boxStartCoordinates&&e.shiftKey){Mconsole.busy=!0,drawSelectBox(n,e);return}if(e.target.id!="infovis-canvas"){this.pressed=!1;return}MetamapsModel.didPan=!0;var r=this.pos,i=n.getPos(),s=this.canvas,o=s.translateOffsetX,u=s.translateOffsetY,a=s.scaleOffsetX,f=s.scaleOffsetY;i.x*=a,i.y*=f,i.x+=o,i.y+=u;var l=i.x-r.x,c=i.y-r.y;this.pos=i,this.canvas.translate(l*1/a,c*1/f)},onMouseUp:function(e,t,n,r){if(!this.config.panning)return;this.pressed=!1}});var f;(function(){function i(t,n){var i=document.createElement(t);for(var s in n)typeof n[s]=="object"?e.extend(i[s],n[s]):i[s]=n[s];return t=="canvas"&&!r&&G_vmlCanvasManager&&(i=G_vmlCanvasManager.initElement(document.body.appendChild(i))),i}var n=typeof HTMLCanvasElement,r=n=="object"||n=="function";$jit.Canvas=f=new t({canvases:[],pos:!1,element:!1,labelContainer:!1,translateOffsetX:0,translateOffsetY:0,scaleOffsetX:1,scaleOffsetY:1,initialize:function(t,n){this.viz=t,this.opt=n;var r=e.type(n.injectInto)=="string"?n.injectInto:n.injectInto.id,s=r+"-label",o=e(r),u=n.width||o.offsetWidth,a=n.height||o.offsetHeight;this.id=r;var l={injectInto:r,width:u,height:a};this.element=i("div",{id:r+"-canvaswidget",style:{position:"relative",width:u+"px",height:a+"px"}}),this.labelContainer=this.createLabelContainer(n.Label.type,s,l),this.canvases.push(new f.Base({config:e.extend({idSuffix:"-canvas"},l),plot:function(e){t.fx.plot()},resize:function(){t.refresh()}}));var c=n.background;if(c){var h=new f.Background[c.type](t,e.extend(c,l));this.canvases.push(new f.Base(h))}var p=this.canvases.length;while(p--)this.element.appendChild(this.canvases[p].canvas),p>0&&this.canvases[p].plot();this.element.appendChild(this.labelContainer),o.appendChild(this.element);var d=null,v=this;e.addEvent(window,"scroll",function(){clearTimeout(d),d=setTimeout(function(){v.getPos(!0)},500)})},getCtx:function(e){return this.canvases[e||0].getCtx()},getConfig:function(){return this.opt},getElement:function(){return this.element},getSize:function(e){return this.canvases[e||0].getSize()},resize:function(e,t){this.getPos(!0),this.translateOffsetX=this.trans
(n,!1)),u.restore(),n.visited=!l})},plotTree:function(e,t,n){var r=this,i=this.viz,s=i.canvas,o=this.config,u=s.getCtx(),a=e.getData("alpha");e.eachSubnode(function(i){if(t.plotSubtree(e,i)&&i.exist&&i.drawn){var o=e.getAdjacency(i.id);!n&&t.onBeforePlotLine(o),u.globalAlpha=Math.min(a,i.getData("alpha")),r.plotLine(o,s,n),!n&&t.onAfterPlotLine(o),r.plotTree(i,t,n)}}),e.drawn?(!n&&t.onBeforePlotNode(e),this.plotNode(e,s,n),!n&&t.onAfterPlotNode(e),!t.hideLabels&&t.withLabels&&a>=.95?this.labels.plotLabel(s,e,t):this.labels.hideLabel(e,!1)):this.labels.hideLabel(e,!0)},plotNode:function(e,t,n){var r=e.getData("type"),i=this.node.CanvasStyles;if(r!="none"){var s=e.getData("lineWidth"),o=e.getData("color"),u=e.getData("alpha"),a=t.getCtx();a.lineWidth=s,a.fillStyle=a.strokeStyle=o,a.globalAlpha=u;for(var f in i)a[f]=e.getCanvasStyle(f);this.nodeTypes[r].render.call(this,e,t,n)}},plotLine:function(e,t,n){var r=e.getData("type"),i=this.edge.CanvasStyles;if(r!="none"){var s=e.getData("lineWidth"),o=e.getData("color"),u=t.getCtx();u.lineWidth=s,u.fillStyle=u.strokeStyle=o;for(var a in i)u[a]=e.getCanvasStyle(a);this.edgeTypes[r].render.call(this,e,t,n)}}},d.Label={},d.Label.Native=new t({plotLabel:function(e,t,n){function s(e,t){var n="",r=e;while(r.length>t){var i=r.substring(0,t),s=i.lastIndexOf(" "),o=i.lastIndexOf("\n");o!=-1&&(s=o),s==-1&&(s=t),n+=i.substring(0,s)+"\n",r=r.substring(s+1)}return n+r}var r=e.getCtx(),i=t.pos.getc(!0);r.font=t.getLabelData("style")+" "+t.getLabelData("size")+"px "+t.getLabelData("family"),r.textAlign=t.getLabelData("textAlign"),r.textBaseline=t.getLabelData("textBaseline");var o=s(t.name,30).split("\n");r.fillStyle="rgba(255, 255, 255, 0.7)";var u=25*o.length,a,f=[];for(a=0;a<o.length;++a)f.push(r.measureText(o[a]).width);var l=Math.max.apply(null,f)+8,c=i.x-l/2,h=i.y+t.getData("height")+5,p=3;r.beginPath(),r.moveTo(c+p,h),r.lineTo(c+l-p,h),r.quadraticCurveTo(c+l,h,c+l,h+p),r.lineTo(c+l,h+u-p),r.quadraticCurveTo(c+l,h+u,c+l-p,h+u),r.lineTo(c+p,h+u),r.quadraticCurveTo(c,h+u,c,h+u-p),r.lineTo(c,h+p),r.quadraticCurveTo(c,h,c+p,h),r.closePath(),r.stroke(),r.fill(),r.fillStyle=r.strokeStyle=t.getLabelData("color"),this.renderLabel(e,t,n)},renderLabel:function(e,t,n){function s(e,t){var n="",r=e;while(r.length>t){var i=r.substring(0,t),s=i.lastIndexOf(" "),o=i.lastIndexOf("\n");o!=-1&&(s=o),s==-1&&(s=t),n+=i.substring(0,s)+"\n",r=r.substring(s+1)}return n+r}var r=e.getCtx(),i=t.pos.getc(!0),o=s(t.name,30).split("\n"),u;for(u=0;u<o.length;++u)r.fillText(o[u],i.x,i.y+t.getData("height")+5+25*u)},hideLabel:e.empty,hideLabels:e.empty}),d.Label.DOM=new t({labelsHidden:!1,labelContainer:!1,labels:{},getLabelContainer:function(){return this.labelContainer?this.labelContainer:this.labelContainer=document.getElementById(this.viz.config.labelContainer)},getLabel:function(e){return e in this.labels&&this.labels[e]!=null?this.labels[e]:this.labels[e]=document.getElementById(e)},hideLabels:function(e){var t=this.getLabelContainer();e?t.style.display="none":t.style.display="",this.labelsHidden=e},clearLabels:function(e){for(var t in this.labels)if(e||!this.viz.graph.hasNode(t))this.disposeLabel(t),delete this.labels[t]},disposeLabel:function(e){var t=this.getLabel(e);t&&t.parentNode&&t.parentNode.removeChild(t)},hideLabel:function(t,n){t=e.splat(t);var r=n?"":"none",i,s=this;e.each(t,function(e){var t=s.getLabel(e.id);t&&(t.style.display=r)})},fitsInCanvas:function(e,t){var n=t.getSize();return e.x>=n.width||e.x<0||e.y>=n.height||e.y<0?!1:!0}}),d.Label.HTML=new t({Implements:d.Label.DOM,plotLabel:function(e,t,n){var r=t.id,i=this.getLabel(r);if(!i&&!(i=document.getElementById(r))){i=document.createElement("div");var s=this.getLabelContainer();i.id=r,i.className="node",i.style.position="absolute",n.onCreateLabel(i,t),s.appendChild(i),this.labels[t.id]=i}this.placeLabel(i,t,n)}}),d.Label.SVG=new t({Implements:d.Label.DOM,plotLabel:function(e,t,n){var r=t.id,i=this.getLabel(r);if(!i&&!(i=document.getElementById(r))){var s="http://www.w3.org/2000/svg";i=document.createElementNS(s,"svg:text");var o=document.createEl
n,this.text.substring(i,s),o)}return a},lv:function(e,t,n){var r=t[t.length-1],i=e.call(r);if(typeof i=="function"){i=a(i.call(r));if(this.c&&~i.indexOf("{{"))return this.c.compile(i,this.options).render(r,n)}return a(i)}};var n=/&/g,r=/</g,i=/>/g,s=/\'/g,o=/\"/g,u=/[&<>\"\']/,l=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(e){function u(e){e.n.substr(e.n.length-1)==="}"&&(e.n=e.n.substring(0,e.n.length-1))}function a(e){return e.trim?e.trim():e.replace(/^\s*|\s*$/g,"")}function f(e,t,n){if(t.charAt(n)!=e.charAt(0))return!1;for(var r=1,i=e.length;r<i;r++)if(t.charAt(n+r)!=e.charAt(r))return!1;return!0}function l(e,t,n,r){var i=[],s=null,o=null;while(e.length>0){o=e.shift();if(o.tag=="#"||o.tag=="^"||c(o,r))n.push(o),o.nodes=l(e,o.tag,n,r),i.push(o);else{if(o.tag=="/"){if(n.length===0)throw new Error("Closing tag without opener: /"+o.n);s=n.pop();if(o.n!=s.n&&!h(o.n,s.n,r))throw new Error("Nesting error: "+s.n+" vs. "+o.n);return s.end=o.i,i}i.push(o)}}if(n.length>0)throw new Error("missing closing tag: "+n.pop().n);return i}function c(e,t){for(var n=0,r=t.length;n<r;n++)if(t[n].o==e.n)return e.tag="#",!0}function h(e,t,n){for(var r=0,i=n.length;r<i;r++)if(n[r].c==e&&n[r].o==t)return!0}function p(e){return e.replace(s,"\\\\").replace(n,'\\"').replace(r,"\\n").replace(i,"\\r")}function d(e){return~e.indexOf(".")?"d":"f"}function v(e){var t="";for(var n=0,r=e.length;n<r;n++){var i=e[n].tag;i=="#"?t+=m(e[n].nodes,e[n].n,d(e[n].n),e[n].i,e[n].end,e[n].otag+" "+e[n].ctag):i=="^"?t+=g(e[n].nodes,e[n].n,d(e[n].n)):i=="<"||i==">"?t+=y(e[n]):i=="{"||i=="&"?t+=b(e[n].n,d(e[n].n)):i=="\n"?t+=E('"\\n"'+(e.length-1==n?"":" + i")):i=="_v"?t+=w(e[n].n,d(e[n].n)):i===undefined&&(t+=E('"'+p(e[n])+'"'))}return t}function m(e,t,n,r,i,s){return"if(_.s(_."+n+'("'+p(t)+'",c,p,1),'+"c,p,0,"+r+","+i+',"'+s+'")){'+"_.rs(c,p,"+"function(c,p,_){"+v(e)+"});c.pop();}"}function g(e,t,n){return"if(!_.s(_."+n+'("'+p(t)+'",c,p,1),c,p,1,0,0,"")){'+v(e)+"};"}function y(e){return'_.b(_.rp("'+p(e.n)+'",c,p,"'+(e.indent||"")+'"));'}function b(e,t){return"_.b(_.t(_."+t+'("'+p(e)+'",c,p,0)));'}function w(e,t){return"_.b(_.v(_."+t+'("'+p(e)+'",c,p,0)));'}function E(e){return"_.b("+e+");"}var t=/\S/,n=/\"/g,r=/\n/g,i=/\r/g,s=/\\/g,o={"#":1,"^":2,"/":3,"!":4,">":5,"<":6,"=":7,_v:8,"{":9,"&":10};e.scan=function(n,r){function S(){v.length>0&&(m.push(new String(v)),v="")}function x(){var e=!0;for(var n=b;n<m.length;n++){e=m[n].tag&&o[m[n].tag]<o._v||!m[n].tag&&m[n].match(t)===null;if(!e)return!1}return e}function T(e,t){S();if(e&&x())for(var n=b,r;n<m.length;n++)m[n].tag||((r=m[n+1])&&r.tag==">"&&(r.indent=m[n].toString()),m.splice(n,1));else t||m.push({tag:"\n"});g=!1,b=m.length}function N(e,t){var n="="+E,r=e.indexOf(n,t),i=a(e.substring(e.indexOf("=",t)+1,r)).split(" ");return w=i[0],E=i[1],r+n.length-1}var i=n.length,s=0,l=1,c=2,h=s,p=null,d=null,v="",m=[],g=!1,y=0,b=0,w="{{",E="}}";r&&(r=r.split(" "),w=r[0],E=r[1]);for(y=0;y<i;y++)h==s?f(w,n,y)?(--y,S(),h=l):n.charAt(y)=="\n"?T(g):v+=n.charAt(y):h==l?(y+=w.length-1,d=o[n.charAt(y+1)],p=d?n.charAt(y+1):"_v",p=="="?(y=N(n,y),h=s):(d&&y++,h=c),g=y):f(E,n,y)?(m.push({tag:p,n:a(v),otag:w,ctag:E,i:p=="/"?g-E.length:y+w.length}),v="",y+=E.length-1,h=s,p=="{"&&(E=="}}"?y++:u(m[m.length-1]))):v+=n.charAt(y);return T(g,!0),m},e.generate=function(t,n,r){var i='var _=this;_.b(i=i||"");'+v(t)+"return _.fl();";return r.asString?"function(c,p,i){"+i+";}":new e.Template(new Function("c","p","i",i),n,e,r)},e.parse=function(e,t,n){return n=n||{},l(e,"",[],n.sectionTags||[])},e.cache={},e.compile=function(e,t){t=t||{};var n=e+"||"+!!t.asString,r=this.cache[n];return r?r:(r=this.generate(this.parse(this.scan(e,t.delimiters),e,t),e,t),this.cache[n]=r)}}(typeof exports!="undefined"?exports:Hogan),function(){}.call(this),function(){}.call(this),function(){window.app.addTopicToMap=function(e){var t,n;return Mconsole.graph.addNode(e),n=Mconsole.graph.getNode(e.id),n.setData("dim",1,"start"),n.setData("dim",25,"end"),t=new $jit.Complex,t.x=n.
,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),r._trigger("fromSortable",t),r.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,n){var r=e("body"),i=e(this).data("draggable").options;r.css("cursor")&&(i._cursor=r.css("cursor")),r.css("cursor",i.cursor)},stop:function(t,n){var r=e(this).data("draggable").options;r._cursor&&e("body").css("cursor",r._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,n){var r=e(n.helper),i=e(this).data("draggable").options;r.css("opacity")&&(i._opacity=r.css("opacity")),r.css("opacity",i.opacity)},stop:function(t,n){var r=e(this).data("draggable").options;r._opacity&&e(n.helper).css("opacity",r._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(t,n){var r=e(this).data("draggable");r.scrollParent[0]!=document&&r.scrollParent[0].tagName!="HTML"&&(r.overflowOffset=r.scrollParent.offset())},drag:function(t,n){var r=e(this).data("draggable"),i=r.options,s=!1;if(r.scrollParent[0]!=document&&r.scrollParent[0].tagName!="HTML"){if(!i.axis||i.axis!="x")r.overflowOffset.top+r.scrollParent[0].offsetHeight-t.pageY<i.scrollSensitivity?r.scrollParent[0].scrollTop=s=r.scrollParent[0].scrollTop+i.scrollSpeed:t.pageY-r.overflowOffset.top<i.scrollSensitivity&&(r.scrollParent[0].scrollTop=s=r.scrollParent[0].scrollTop-i.scrollSpeed);if(!i.axis||i.axis!="y")r.overflowOffset.left+r.scrollParent[0].offsetWidth-t.pageX<i.scrollSensitivity?r.scrollParent[0].scrollLeft=s=r.scrollParent[0].scrollLeft+i.scrollSpeed:t.pageX-r.overflowOffset.left<i.scrollSensitivity&&(r.scrollParent[0].scrollLeft=s=r.scrollParent[0].scrollLeft-i.scrollSpeed)}else{if(!i.axis||i.axis!="x")t.pageY-e(document).scrollTop()<i.scrollSensitivity?s=e(document).scrollTop(e(document).scrollTop()-i.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<i.scrollSensitivity&&(s=e(document).scrollTop(e(document).scrollTop()+i.scrollSpeed));if(!i.axis||i.axis!="y")t.pageX-e(document).scrollLeft()<i.scrollSensitivity?s=e(document).scrollLeft(e(document).scrollLeft()-i.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<i.scrollSensitivity&&(s=e(document).scrollLeft(e(document).scrollLeft()+i.scrollSpeed))}s!==!1&&e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(r,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,n){var r=e(this).data("draggable"),i=r.options;r.snapElements=[],e(i.snap.constructor!=String?i.snap.items||":data(draggable)":i.snap).each(function(){var t=e(this),n=t.offset();this!=r.element[0]&&r.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:n.top,left:n.left})})},drag:function(t,n){var r=e(this).data("draggable"),i=r.options,s=i.snapTolerance,o=n.offset.left,u=o+r.helperProportions.width,f=n.offset.top,l=f+r.helperProportions.height;for(var c=r.snapElements.length-1;c>=0;c--){var h=r.snapElements[c].left,p=h+r.snapElements[c].width,d=r.snapElements[c].top,v=d+r.snapElements[c].height;if(!(h-s<o&&o<p+s&&d-s<f&&f<v+s||h-s<o&&o<p+s&&d-s<l&&l<v+s||h-s<u&&u<p+s&&d-s<f&&f<v+s||h-s<u&&u<p+s&&d-s<l&&l<v+s)){r.snapElements[c].snapping&&r.options.snap.release&&r.options.snap.release.call(r.element,t,e.extend(r._uiHash(),{snapItem:r.snapElements[c].item})),r.snapElements[c].snapping=!1;continue}if(i.snapMode!="inner"){var m=Math.abs(d-l)<=s,g=Math.abs(v-f)<=s,y=Math.abs(h-u)<=s,b=Math.abs(p-o)<=s;m&&(n.position.top=r._convertPositionTo("relative",{top:d-r.helperProportions.height,left:0}).top-r.margins.top),g&&(n.position.top=r._convertPositionTo("relative",{top:v,left:0}).top-r.margins.top),y&&(n.position.left=r._convertPositionTo("relative",{top:0,left:h-r.helperProportions.width}).left-r.margins.left),b&&(n.position.left=r._convertPositionTo("relative",{top:0,left:p}).left-r.margins.left)}var w=m||g||y||b;if(i.snapMode!="outer"){var m=Math.abs(d-f)<=s,g=Math.abs(v-l)<=s,y=Math.ab
e:t,s=e.length>t.length?t:e;for(var o=0,u=s.length;o<u;o++)~n.indexOf(i,s[o])&&r.push(s[o]);return r},n.indexOf=function(e,t,n){for(var r=e.length,n=n<0?n+r<0?0:n+r:n||0;n<r&&e[n]!==t;n++);return r<=n?-1:n},n.toArray=function(e){var t=[];for(var n=0,r=e.length;n<r;n++)t.push(e[n]);return t},n.ua={},n.ua.hasCORS="undefined"!=typeof XMLHttpRequest&&function(){try{var e=new XMLHttpRequest}catch(t){return!1}return e.withCredentials!=undefined}(),n.ua.webkit="undefined"!=typeof navigator&&/webkit/i.test(navigator.userAgent),n.ua.iDevice="undefined"!=typeof navigator&&/iPad|iPhone|iPod/i.test(navigator.userAgent)}("undefined"!=typeof io?io:module.exports,this),function(e,t){function n(){}e.EventEmitter=n,n.prototype.on=function(e,n){return this.$events||(this.$events={}),this.$events[e]?t.util.isArray(this.$events[e])?this.$events[e].push(n):this.$events[e]=[this.$events[e],n]:this.$events[e]=n,this},n.prototype.addListener=n.prototype.on,n.prototype.once=function(e,t){function r(){n.removeListener(e,r),t.apply(this,arguments)}var n=this;return r.listener=t,this.on(e,r),this},n.prototype.removeListener=function(e,n){if(this.$events&&this.$events[e]){var r=this.$events[e];if(t.util.isArray(r)){var i=-1;for(var s=0,o=r.length;s<o;s++)if(r[s]===n||r[s].listener&&r[s].listener===n){i=s;break}if(i<0)return this;r.splice(i,1),r.length||delete this.$events[e]}else(r===n||r.listener&&r.listener===n)&&delete this.$events[e]}return this},n.prototype.removeAllListeners=function(e){return e===undefined?(this.$events={},this):(this.$events&&this.$events[e]&&(this.$events[e]=null),this)},n.prototype.listeners=function(e){return this.$events||(this.$events={}),this.$events[e]||(this.$events[e]=[]),t.util.isArray(this.$events[e])||(this.$events[e]=[this.$events[e]]),this.$events[e]},n.prototype.emit=function(e){if(!this.$events)return!1;var n=this.$events[e];if(!n)return!1;var r=Array.prototype.slice.call(arguments,1);if("function"==typeof n)n.apply(this,r);else{if(!t.util.isArray(n))return!1;var i=n.slice();for(var s=0,o=i.length;s<o;s++)i[s].apply(this,r)}return!0}}("undefined"!=typeof io?io:module.exports,"undefined"!=typeof io?io:module.parent.exports),function(exports,nativeJSON){"use strict";function f(e){return e<10?"0"+e:e}function date(e,t){return isFinite(e.valueOf())?e.getUTCFullYear()+"-"+f(e.getUTCMonth()+1)+"-"+f(e.getUTCDate())+"T"+f(e.getUTCHours())+":"+f(e.getUTCMinutes())+":"+f(e.getUTCSeconds())+"Z":null}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return typeof t=="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,i,s,o=gap,u,a=t[e];a instanceof Date&&(a=date(e)),typeof rep=="function"&&(a=rep.call(t,e,a));switch(typeof a){case"string":return quote(a);case"number":return isFinite(a)?String(a):"null";case"boolean":case"null":return String(a);case"object":if(!a)return"null";gap+=indent,u=[];if(Object.prototype.toString.apply(a)==="[object Array]"){s=a.length;for(n=0;n<s;n+=1)u[n]=str(n,a)||"null";return i=u.length===0?"[]":gap?"[\n"+gap+u.join(",\n"+gap)+"\n"+o+"]":"["+u.join(",")+"]",gap=o,i}if(rep&&typeof rep=="object"){s=rep.length;for(n=0;n<s;n+=1)typeof rep[n]=="string"&&(r=rep[n],i=str(r,a),i&&u.push(quote(r)+(gap?": ":":")+i))}else for(r in a)Object.prototype.hasOwnProperty.call(a,r)&&(i=str(r,a),i&&u.push(quote(r)+(gap?": ":":")+i));return i=u.length===0?"{}":gap?"{\n"+gap+u.join(",\n"+gap)+"\n"+o+"}":"{"+u.join(",")+"}",gap=o,i}}if(nativeJSON&&nativeJSON.parse)return exports.JSON={parse:nativeJSON.parse,stringify:nativeJSON.stringify};var JSON=exports.JSON={},cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;JSON.stringify=function(e,t,n){var r;gap="",indent="";if(typeof n=="number")for(r=0;r<n;r+=1)indent
.__addTask(function(){WebSocket.__flash.loadManualPolicyFile(e)})},WebSocket.__initialize=function(){if(WebSocket.__flash)return;WebSocket.__swfLocation&&(window.WEB_SOCKET_SWF_LOCATION=WebSocket.__swfLocation);if(!window.WEB_SOCKET_SWF_LOCATION){e.error("[WebSocket] set WEB_SOCKET_SWF_LOCATION to location of WebSocketMain.swf");return}var t=document.createElement("div");t.id="webSocketContainer",t.style.position="absolute",WebSocket.__isFlashLite()?(t.style.left="0px",t.style.top="0px"):(t.style.left="-100px",t.style.top="-100px");var n=document.createElement("div");n.id="webSocketFlash",t.appendChild(n),document.body.appendChild(t),swfobject.embedSWF(WEB_SOCKET_SWF_LOCATION,"webSocketFlash","1","1","10.0.0",null,null,{hasPriority:!0,swliveconnect:!0,allowScriptAccess:"always"},null,function(t){t.success||e.error("[WebSocket] swfobject.embedSWF failed")})},WebSocket.__onFlashInitialized=function(){setTimeout(function(){WebSocket.__flash=document.getElementById("webSocketFlash"),WebSocket.__flash.setCallerUrl(location.href),WebSocket.__flash.setDebug(!!window.WEB_SOCKET_DEBUG);for(var e=0;e<WebSocket.__tasks.length;++e)WebSocket.__tasks[e]();WebSocket.__tasks=[]},0)},WebSocket.__onFlashEvent=function(){return setTimeout(function(){try{var t=WebSocket.__flash.receiveEvents();for(var n=0;n<t.length;++n)WebSocket.__instances[t[n].webSocketId].__handleEvent(t[n])}catch(r){e.error(r)}},0),!0},WebSocket.__log=function(t){e.log(decodeURIComponent(t))},WebSocket.__error=function(t){e.error(decodeURIComponent(t))},WebSocket.__addTask=function(e){WebSocket.__flash?e():WebSocket.__tasks.push(e)},WebSocket.__isFlashLite=function(){if(!window.navigator||!window.navigator.mimeTypes)return!1;var e=window.navigator.mimeTypes["application/x-shockwave-flash"];return!e||!e.enabledPlugin||!e.enabledPlugin.filename?!1:e.enabledPlugin.filename.match(/flashlite/i)?!0:!1},window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION||(window.addEventListener?window.addEventListener("load",function(){WebSocket.__initialize()},!1):window.attachEvent("onload",function(){WebSocket.__initialize()}))})(),function(e,t,n){function r(e){if(!e)return;t.Transport.apply(this,arguments),this.sendBuffer=[]}function i(){}e.XHR=r,t.util.inherit(r,t.Transport),r.prototype.open=function(){return this.socket.setBuffer(!1),this.onOpen(),this.get(),this.setCloseTimeout(),this},r.prototype.payload=function(e){var n=[];for(var r=0,i=e.length;r<i;r++)n.push(t.parser.encodePacket(e[r]));this.send(t.parser.encodePayload(n))},r.prototype.send=function(e){return this.post(e),this},r.prototype.post=function(e){function r(){this.readyState==4&&(this.onreadystatechange=i,t.posting=!1,this.status==200?t.socket.setBuffer(!1):t.onClose())}function s(){this.onload=i,t.socket.setBuffer(!1)}var t=this;this.socket.setBuffer(!0),this.sendXHR=this.request("POST"),n.XDomainRequest&&this.sendXHR instanceof XDomainRequest?this.sendXHR.onload=this.sendXHR.onerror=s:this.sendXHR.onreadystatechange=r,this.sendXHR.send(e)},r.prototype.close=function(){return this.onClose(),this},r.prototype.request=function(e){var n=t.util.request(this.socket.isXDomain()),r=t.util.query(this.socket.options.query,"t="+ +(new Date));n.open(e||"GET",this.prepareUrl()+r,!0);if(e=="POST")try{n.setRequestHeader?n.setRequestHeader("Content-type","text/plain;charset=UTF-8"):n.contentType="text/plain"}catch(i){}return n},r.prototype.scheme=function(){return this.socket.options.secure?"https":"http"},r.check=function(e,r){try{var i=t.util.request(r),s=n.XDomainRequest&&i instanceof XDomainRequest,o=e&&e.options&&e.options.secure?"https:":"http:",u=n.location&&o!=n.location.protocol;if(i&&(!s||!u))return!0}catch(a){}return!1},r.xdomainCheck=function(e){return r.check(e,!0)}}("undefined"!=typeof io?io.Transport:module.exports,"undefined"!=typeof io?io:module.parent.exports,this),function(e,t){function n(e){t.Transport.XHR.apply(this,arguments)}e.htmlfile=n,t.util.inherit(n,t.Transport.XHR),n.prototype.name="htmlfile",n.prototype.get=function(){this.doc=new(window[["Active"].concat("Object").join("X")])("htmlfile"),this.doc.open(),thi
){i(800)}),$(".sidebarSearch").click(function(e){e.stopPropagation()}),$("body").click(function(e){i(0)}),$("body").bind("keyup",function(t){switch(t.which){case 83:t.shiftKey&&!e&&r();break;default:}}),$(".sidebarSearchField").typeahead([{name:"topics",template:$(".topicTemplate").html(),remote:{url:"/search/topics?term=%QUERY"},engine:Hogan,header:'<h3 class="search-header">Topics</h3>'},{name:"maps",template:$(".mapTemplate").html(),remote:{url:"/search/maps?term=%QUERY"},engine:Hogan,header:'<h3 class="search-header">Maps</h3>'},{name:"mappers",template:$(".mapperTemplate").html(),remote:{url:"/search/mappers?term=%QUERY"},engine:Hogan,header:'<h3 class="search-header">Mappers</h3>'}])}function n(){var e=!1,t=!1,n,r=function(){n=setTimeout(function(){t||(t=!0,$(".sidebarAccountIcon").css("background-color","rgba(0,0,0,0.7)"),$(".sidebarAccountBox").fadeOut(200,function(){t=!1,e=!1}))},300)},i=function(){clearTimeout(n),t||(t=!0,$(".sidebarAccountIcon").css("background-color","rgba(0,0,0,0.9)"),$(".sidebarAccountBox").fadeIn(200,function(){t=!1,e=!0}))};$(".sidebarAccount").hover(i,r)}e(),t(),n(),$("#new_topic, #new_synapse").bind("contextmenu",function(e){return!1}),$("#topic_name").typeahead([{name:"topic_autocomplete",template:'<p>{{value}}</p><div class="type">{{type}}</div><img width="20" height="20" src="{{typeImageURL}}" alt="{{type}}" title="{{type}}"/>',remote:{url:"/topics/autocomplete_topic?term=%QUERY"},engine:Hogan}]),$("#topic_name").bind("typeahead:selected",function(e,t,n){$("#topic_grabTopic").val(t.id),$(".new_topic").submit(),e.preventDefault(),e.stopPropagation()}),$(".new_topic, .new_synapse").bind("submit",function(e,t){e.preventDefault()}),$(".scroll").mCustomScrollbar(),$(".notice.metamaps").delay(1e4).fadeOut("fast"),$(".alert.metamaps").delay(1e4).fadeOut("fast"),addHoverForSettings(),$(".best_in_place_metacode").bind("ajax:success",function(){var e=$(this).html();$(this).parents(".CardOnGraph").find("img.icon").attr("alt",e),$(this).parents(".CardOnGraph").find("img.icon").attr("src",imgArray[e].src)}),$(".best_in_place_desc").bind("ajax:success",function(){$(this).parents(".CardOnGraph").find(".scroll").mCustomScrollbar("update")}),$(".best_in_place_link").bind("ajax:success",function(){var e=$(this).html();$(this).parents(".CardOnGraph").find(".go-link").attr("href",e)}),$(".addMap").click(function(e){createNewMap()}),$("body").bind("keyup",function(e){switch(e.which){case 13:enterKeyHandler();break;case 27:escKeyHandler();break;default:}})});