auspice
Version:
Web app for visualizing pathogen evolution
1 lines • 239 kB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{474:function(e,t,n){"use strict";n.d(t,"p",(function(){return o})),n.d(t,"d",(function(){return i})),n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return s})),n.d(t,"h",(function(){return l})),n.d(t,"f",(function(){return c})),n.d(t,"j",(function(){return u})),n.d(t,"c",(function(){return p})),n.d(t,"i",(function(){return d})),n.d(t,"k",(function(){return h})),n.d(t,"g",(function(){return f})),n.d(t,"o",(function(){return m})),n.d(t,"l",(function(){return y})),n.d(t,"m",(function(){return b})),n.d(t,"n",(function(){return g})),n.d(t,"e",(function(){return v}));var r=n(2),o="Lato, Helvetica Neue, Helvetica, sans-serif",i="Lato, Helvetica Neue, Helvetica, sans-serif",a="Lato, Helvetica Neue, Helvetica, sans-serif",s="#333",l="#888",c="#BBB",u="#F2F2F2",p="#89B77F",d="#E39B39",h={backgroundColor:"#FFF",fontFamily:a,width:r.controlsWidth-13,borderSpacing:0,fontSize:14,paddingLeft:"10px",border:"1px solid #ccc",height:36,appearance:"none",borderRadius:"4px",color:s,fontWeight:400,marginBottom:"3px"},f={border:"0px",backgroundColor:"inherit",marginLeft:0,marginTop:5,marginRight:10,marginBottom:5,borderRadius:2,cursor:"pointer",padding:2,fontFamily:a,color:s,fontWeight:400,textTransform:"uppercase",fontSize:14,verticalAlign:"top",outline:0},m={borderTop:"1px solid #BBB",borderLeft:"1px solid #CCC",borderRight:"1px solid #CCC",borderBottom:"1px solid #CCC",borderRadius:"0px 0px 3px 3px",paddingTop:3,paddingBottom:3,paddingLeft:6,paddingRight:6,backgroundColor:"#fff",fontWeight:400,color:s,fontFamily:a,fontSize:12,textTransform:"uppercase"},y={borderTop:"1px solid #BBB",borderLeft:"1px solid #CCC",borderRight:"1px solid #CCC",borderBottom:"1px solid #CCC",borderRadius:"0px 0px 3px 3px",paddingTop:3,paddingBottom:3,paddingLeft:6,paddingRight:6,backgroundColor:"#fff"},b={border:"none",backgroundColor:"inherit",padding:0,margin:0,cursor:"pointer",fontFamily:a,color:s,fontWeight:400,textTransform:"uppercase",fontSize:12},g={border:"none",backgroundColor:"inherit",padding:0,margin:0,cursor:"pointer",fontFamily:a,color:"#5097BA",fontWeight:400,textTransform:"uppercase",fontSize:12},v={branchInfoHeading:{fontSize:15,fontWeight:400,verticalAlign:"middle",padding:"5px"},buttonLink:{float:"right",fontFamily:a,fontSize:14,fontWeight:400,textDecoration:"none",pointerEvents:"auto",background:"none",color:"white",cursor:"pointer",textTransform:"uppercase",borderRadius:2,border:"1px solid #CCC",verticalAlign:"middle"},tooltip:{position:"relative",padding:5,color:"white",fontFamily:a,fontSize:14,lineHeight:1,fontWeight:300},modalContainer:{position:"absolute",width:"100%",height:"100%",pointerEvents:"all",top:0,left:0,zIndex:2e3,backgroundColor:"rgba(80, 80, 80, .20)",display:"flex",justifyContent:"center",alignItems:"center",wordWrap:"break-word",wordBreak:"break-word"},panel:{position:"relative",paddingLeft:30,padding:"5% 5%",borderRadius:5,backgroundColor:"rgba(55,55,55,0.9)",color:"white",fontFamily:a,fontSize:18,lineHeight:1,fontWeight:300,maxWidth:500,overflow:"scroll"},modalHeading:{fontSize:24,fontWeight:400},modalSubheading:{fontSize:20,fontWeight:400,marginTop:"20px",marginBottom:"20px"},tooltipHeading:{fontSize:18,fontWeight:400,marginBottom:"10px"},comment:{fontStyle:"italic",fontWeight:200,fontSize:14,marginTop:"10px"},topRightMessage:{fontStyle:"italic",fontWeight:200,fontSize:14,textAlign:"right",marginTop:"-20px"},list:{paddingLeft:15,listStyleType:"disc"},item:{paddingTop:4,paddingBottom:4,minWidth:120},break:{marginBottom:"10px"}}},479:function(e,t,n){"use strict";var r=n(3),o=n.n(r),i=n(474);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(n,!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e,t){return!t||"object"!==a(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var f=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),p(this,d(t).apply(this,arguments))}var n,r,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(t,e),n=t,(r=[{key:"getStyles",value:function(){return{base:{backgroundColor:"#FFFFFF",display:"inline-block",marginLeft:14,marginRight:0,marginTop:0,marginBottom:10,paddingLeft:6,paddingRight:6,paddingBottom:6,overflow:"hidden",position:"relative"},title:{fontFamily:i.d,color:i.a,fontSize:16,marginLeft:0,marginTop:0,marginBottom:8,fontWeight:500,backgroundColor:"#FFFFFF",borderTop:"thin solid #BBB",minHeight:"15px"}}}},{key:"getStylesInfoCard",value:function(){return{base:{backgroundColor:"#FFFFFF",display:"inline-block",marginLeft:14,marginRight:0,marginTop:0,marginBottom:10,paddingLeft:6,paddingRight:6,paddingBottom:6,overflow:"hidden",position:"relative"},title:{fontFamily:i.d,color:"#fff",fontSize:16,marginLeft:0,marginTop:0,marginBottom:8,fontWeight:500,backgroundColor:"#FFFFFF"}}}},{key:"render",value:function(){var e=this.props.infocard?this.getStylesInfoCard():this.getStyles();return o.a.createElement("div",{id:"".concat(this.props.title,"Card"),style:l({},e.base,{},this.props.style)},o.a.createElement("div",{id:"CardTitle",style:l({},e.title,{},this.props.titleStyles)},this.props.title),o.a.createElement("div",{id:"CardContentContainer",style:{display:"flex",justifyContent:this.props.center?"center":"flex-start"}},this.props.children))}}])&&u(n.prototype,r),a&&u(n,a),t}(o.a.Component);t.a=f},483:function(e,t,n){"use strict";var r=n(3),o=n.n(r),i=n(16),a=n.n(i);function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(n,!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e,t){return!t||"object"!==s(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var m=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),p(this,d(t).apply(this,arguments))}var n,r,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(t,e),n=t,(r=[{key:"getStyles",value:function(){return{base:{display:"flex",flexDirection:this.props.direction,flexWrap:this.props.wrap,justifyContent:this.props.justifyContent,alignItems:this.props.alignItems,alignContent:this.props.alignContent,order:this.props.order,flexGrow:this.props.grow,flexShrink:this.props.shrink,flexBasis:this.props.basis,alignSelf:this.props.alignSelf},style:this.props.style}}},{key:"render",value:function(){var e=this.getStyles();return o.a.createElement("div",{id:this.props.id,onClick:this.props.clickHandler,style:c({},e.base,{},e.style)},this.props.children)}}])&&u(n.prototype,r),i&&u(n,i),t}(o.a.Component);f(m,"propTypes",{direction:a.a.oneOf(["row","rowReverse","column","columnReverse"]),wrap:a.a.oneOf(["nowrap","wrap","wrap-reverse"]),justifyContent:a.a.oneOf(["flex-start","flex-end","center","space-between","space-around"]),alignItems:a.a.oneOf(["flex-start","flex-end","center","baseline","stretch"]),alignContent:a.a.oneOf(["flex-start","flex-end","center","space-between","space-around","stretch"]),grow:a.a.number,shrink:a.a.number,basis:a.a.string,order:a.a.number,alignSelf:a.a.oneOf(["auto","flex-start","flex-end","center","baseline","stretch"]),styleOverrides:a.a.object,children:a.a.node,clickHandler:a.a.func}),f(m,"defaultProps",{direction:"row",wrap:"nowrap",justifyContent:"center",alignItems:"center",alignContent:"stretch",grow:0,shrink:1,basis:"auto",alignSelf:"auto",order:0,style:{}}),t.a=m},492:function(e,t,n){e.exports=n.p+"1ffc23cfee00e9e13194f13f3a7ce418.svg"},496:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(34),o=n(85),i=(n(108),n(111)),a=n(87),s=n(0),l=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return function(t,n){var l=n(),c=l.controls,u=l.tree,p=l.treeToo,d=l.metadata,h=l.frequencies;if(null===u.nodes||!d.loaded)return null;var f=e||c.colorBy,m=Object(o.calcColorScale)(f,c,u,p,d),y=Object(r.calcNodeColor)(u,m),b=p.loaded?Object(r.calcNodeColor)(p,m):void 0,g=Object(r.determineColorByGenotypeMutType)(f),v=g!==c.mutType&&g;return v&&t(Object(i.a)(v)),t({type:s.D,colorBy:f,colorScale:m,nodeColors:y,nodeColorsToo:b,version:m.version}),h.loaded&&Object(a.b)(t,n),null}}},507:function(e,t,n){"use strict";var r=n(3),o=n.n(r),i=n(475),a=n(2),s=function(e){var t=e.navHeight,n=e.navWidth,r=e.display,i=e.onClick;n||(n=0);var a={position:"fixed",left:n-12,visibility:r?"visible":"hidden",width:r?12:0,top:t/2-8,backgroundColor:"inherit",boxShadow:"none",cursor:"pointer",borderRadius:"0px",fontSize:12,color:"#444",textAlign:"center",verticalAlign:"middle"};return o.a.createElement("div",{style:a,onClick:i},o.a.createElement("i",{className:"fa fa-chevron-left","aria-hidden":"true"}))},l=n(492),c=i.b.div.withConfig({displayName:"content__AuspiceNavBarContainer",componentId:"jg0fvy-0"})(["display:flex;flex-direction:row;align-items:center;justify-content:center;height:100%;"]),u=i.b.a.withConfig({displayName:"content__Title",componentId:"jg0fvy-1"})(["padding:0px;text-decoration:none;color:",";font-size:20px;font-weight:400;cursor:pointer;letter-spacing:1rem;"],(function(e){return e.theme.color})),p=i.b.a.withConfig({displayName:"content__LogoLink",componentId:"jg0fvy-2"})(["padding:5px 5px;width:50px;cursor:pointer;"]),d=i.b.div.withConfig({displayName:"content__NarrativeTitle",componentId:"jg0fvy-3"})(["white-space:nowrap;font-size:1.7rem;margin-left:auto;padding:0px 12px;float:right;color:",";max-width:","px;overflow:hidden;text-overflow:ellipsis;"],(function(e){return e.theme.color}),(function(e){return e.width-90})),h=n(22),f=i.b.div.withConfig({displayName:"navBar__NavBarContainer",componentId:"ygpsg-0"})(["left:0;max-width:960px;margin-top:auto;margin-right:auto;margin-bottom:auto;margin-left:auto;height:","px;justify-content:space-between;align-items:center;overflow:hidden;z-index:100;transition:left .3s ease-out;"],(function(e){return e.narrative?a.narrativeNavBarHeight:a.normalNavBarHeight})),m=Object(h.hasExtension)("navbarComponent")?Object(h.getExtension)("navbarComponent"):function(e){var t=e.narrativeTitle,n=e.sidebar,r=e.width;return n?o.a.createElement(c,null,o.a.createElement("div",{style:{flex:1}}),o.a.createElement(p,{href:"/"},o.a.createElement("img",{alt:"splashPage",width:"40px",src:l})),o.a.createElement("div",{style:{flex:1}}),function(e,t){return e?o.a.createElement(d,{width:t,href:"/"},e):o.a.createElement(u,{href:"/"},"auspice")}(t,r),o.a.createElement("div",{style:{flex:1}})):null};t.a=function(e){var t=e.sidebar,n=(e.mobileDisplay,e.toggleHandler),r=e.narrativeTitle,i=e.width,l=t&&!r;return o.a.createElement(f,null,o.a.createElement(m,{narrativeTitle:r,sidebar:t}),o.a.createElement(s,{navHeight:a.normalNavBarHeight,navWidth:i,display:l,onClick:n}))}},538:function(e,t){e.exports={version:"2.2.3"}},543:function(e,t,n){e.exports=n.p+"f66966ba89ed36ecbe0e4e0688cb1ef9.png"},544:function(e,t,n){e.exports=n.p+"4dc6198ec0d867620d300be40d112a10.jpg"},659:function(e,t,n){var r=n(660);"string"==typeof r&&(r=[[e.i,r,""]]);n(41)(r,{});r.locals&&(e.exports=r.locals)},660:function(e,t,n){(e.exports=n(40)(!1)).push([e.i,'.awesomplete [hidden] {\n display: none;\n}\n\n.awesomplete .visually-hidden {\n position: absolute;\n clip: rect(0, 0, 0, 0);\n}\n\n.awesomplete {\n display: inline-block;\n position: relative;\n width: 100%;\n height: 100%;\n}\n\n.awesomplete > input {\n display: block;\n}\n\n.awesomplete > ul {\n position: absolute;\n left: 0;\n z-index: 1;\n min-width: 100%;\n box-sizing: border-box;\n list-style: none;\n padding: 0;\n margin: 0;\n background: #fff;\n}\n\n.awesomplete > ul:empty {\n display: none;\n}\n\n.awesomplete > ul {\n width: 80%;\n border-radius: .3em;\n margin: .2em 0 0;\n background: hsla(0,0%,100%,.9);\n background: linear-gradient(to bottom right, white, hsla(0,0%,100%,.8));\n border: 1px solid rgba(0,0,0,.3);\n box-shadow: .05em .2em .6em rgba(0,0,0,.2);\n text-shadow: none;\n}\n\n@supports (transform: scale(0)) {\n .awesomplete > ul {\n transition: .3s cubic-bezier(.4,.2,.5,1.4);\n transform-origin: 1.43em -.43em;\n }\n\n .awesomplete > ul[hidden],\n .awesomplete > ul:empty {\n opacity: 0;\n transform: scale(0);\n display: block;\n transition-timing-function: ease;\n }\n}\n\n /* Pointer */\n .awesomplete > ul:before {\n content: "";\n position: absolute;\n top: -.43em;\n left: 1em;\n width: 0; height: 0;\n padding: .4em;\n background: white;\n border: inherit;\n border-right: 0;\n border-bottom: 0;\n -webkit-transform: rotate(45deg);\n transform: rotate(45deg);\n }\n\n .awesomplete > ul > li {\n position: relative;\n padding: .2em .5em;\n cursor: pointer;\n }\n\n .awesomplete > ul > li:hover {\n background: hsl(200, 40%, 80%);\n color: black;\n }\n\n .awesomplete > ul > li[aria-selected="true"] {\n background: hsl(205, 40%, 40%);\n color: white;\n }\n\n .awesomplete mark {\n color: rgb(80, 151, 186);\n background: white;\n }\n\n .awesomplete li:hover mark {\n background: hsl(200, 40%, 80%);\n }\n',""])},684:function(e,t,n){"use strict";n.r(t);var r,o=n(3),i=n.n(o),a=n(16),s=n.n(a),l=n(50),c=n(475),u=n(474),p=function(e){var t=e.sidebarOpen,n=e.mobileDisplay,r=e.handler,o={visibility:n?"visible":t?"hidden":"visible",width:n?60:14,height:n?60:44,position:"absolute",top:n?15:4,left:n?"auto":0,right:n?20:"auto",zIndex:9e3,backgroundColor:n?u.c:u.j,boxShadow:n?"2px 4px 10px 1px rgba(0, 0, 0, 0.15)":"0px 0px 5px 1px rgba(0, 0, 0, 0.2)",cursor:"pointer",padding:0,transition:"top 0.3s ease-out, left 0.3s ease-out, width 0.3s ease-out, height 0.3s ease-out",borderRadius:n?"45px":"0px 6px 6px 0px"},a={visibility:n?"visible":t?"hidden":"visible",position:"absolute",width:30,height:30,top:"50%",left:"50%",lineHeight:"30px",textAlign:"center",transform:"translate(-50%,-50%)",marginLeft:"auto",marginRight:"auto",verticalAlign:"middle",color:n?"#FFFFFF":"#444",fontSize:n?26:12},s="fa fa-close";return t&&!n?s="fa fa-chevron-left":t||n?t&&n?s="fa fa-close":!t&&n&&(s="fa fa-sliders"):s="fa fa-chevron-right",i.a.createElement("div",{style:o,onClick:r},i.a.createElement("div",{style:a},i.a.createElement("i",{className:s,"aria-hidden":"true"})))},d=n(479),h=n(144),f=n(19),m=n(7),y=n(2),b=n(536),g=n.n(b),v=n(537),w=n.n(v),S=n(0),O=n(483),E=n(538),x=n(495),k=n.n(x),T=n(8),j=function(e){e||(e=window.event),e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation()},C=function(e,t,n){return i.a.createElement("tr",{key:e},i.a.createElement("th",{style:u.e.item},e),i.a.createElement("td",{style:u.e.item},n?i.a.createElement("a",{href:n,target:"_blank",rel:"noopener noreferrer"},t):t))},_=function(e){return void 0!==e&&e.startsWith("https_")?e.replace("https_","https:"):void 0!==e&&e.startsWith("http_")?e.replace("http_","http:"):e},N=function(e){var t=e.node,n=Object(T.getAccessionFromNode)(t),r=Object(T.getUrlFromNode)(t);return Object(y.isValueValid)(n)&&Object(y.isValueValid)(r)?i.a.createElement("tr",null,i.a.createElement("th",{style:u.e.item},"Accession"),i.a.createElement("td",{style:u.e.item},i.a.createElement("a",{href:_(r),target:"_blank"},n))):Object(y.isValueValid)(n)?C("Accession",n):Object(y.isValueValid)(r)?i.a.createElement("tr",null,i.a.createElement("th",{style:u.e.item},"Strain URL"),i.a.createElement("td",{style:u.e.item},i.a.createElement("a",{href:_(r),target:"_blank"},i.a.createElement("em",null,"click here")))):null},P=function(e){var t=e.node,n=Object(T.getVaccineFromNode)(t);if(!n)return null;var r=[];return n.selection_date&&r.push(i.a.createElement("tr",{key:"seldate"},i.a.createElement("th",null,"Vaccine selected"),i.a.createElement("td",null,n.selection_date))),n.start_date&&r.push(i.a.createElement("tr",{key:"startdate"},i.a.createElement("th",null,"Vaccine start date"),i.a.createElement("td",null,n.start_date))),n.end_date&&r.push(i.a.createElement("tr",{key:"enddate"},i.a.createElement("th",null,"Vaccine end date"),i.a.createElement("td",null,n.end_date))),n.serum&&r.push(i.a.createElement("tr",{key:"serum"},i.a.createElement("th",null,"Serum strain"),i.a.createElement("td",null))),r},D=function(e){var t=e.node,n=Object(T.getFullAuthorInfoFromNode)(t);if(!n)return null;var r=[];return r.push(C("Authors",n.value)),n.title&&"?"!==n.title&&(n.paper_url&&"?"!==n.paper_url?r.push(C("Title",n.title,n.paper_url)):r.push(C("Title",n.title))),n.journal&&"?"!==n.journal&&r.push(C("Journal",n.journal)),1===r.length?r[0]:r},M=function(e){var t=e.children;return i.a.createElement("p",{style:u.e.modalHeading},t)},B=function(e){var t=e.node,n=Object(T.getTraitFromNode)(t,"num_date");if(!n)return null;var r=Object(T.getTraitFromNode)(t,"num_date",{confidence:!0});return n&&r&&r[0]!==r[1]?i.a.createElement(i.a.Fragment,null,C("Inferred collection date",Object(m.numericToCalendar)(n)),C("Collection date confidence","(".concat(Object(m.numericToCalendar)(r[0]),", ").concat(Object(m.numericToCalendar)(r[1]),")"))):C("Collection date",Object(m.numericToCalendar)(n))},I=function(e){var t=e.node,n=e.trait,r=e.colorings,o=Object(T.getTraitFromNode)(t,n),i=o;"number"==typeof o&&(Number.isInteger(o)||(i=Number.parseFloat(o).toPrecision(3)));var a=r&&r[n]&&r[n].title?r[n].title:n;return Object(y.isValueValid)(i)?C(a,i):null},A=function(e){var t=e.tip,n=e.goAwayCallback,r=e.colorings;if(!t)return null;var o=t.n;return i.a.createElement("div",{style:u.e.modalContainer,onClick:function(){return n(t)}},i.a.createElement("div",{className:"panel",style:u.e.panel,onClick:function(e){return j(e)}},i.a.createElement(M,null,o.name),i.a.createElement("table",null,i.a.createElement("tbody",null,i.a.createElement(P,{node:o}),i.a.createElement(B,{node:o}),i.a.createElement(D,{node:o}),function(e){if(!e.node_attrs)return[];var t=["author","div","num_date"];return Object.keys(e.node_attrs).filter((function(e){return!t.includes(e)}))}(o).map((function(e){return i.a.createElement(I,{node:o,trait:e,colorings:r,key:e})})),i.a.createElement(N,{node:o}))),i.a.createElement("p",{style:u.e.comment},"Click outside this box to go back to the tree")))},R=n(75),F=n(5),z=function(e){var t=e.dispatch,n=e.transform,r=e.legendRectSize,o=e.legendSpacing,a=e.rectStroke,s=e.rectFill,l=e.label,c=e.value;return i.a.createElement("g",{transform:n,onMouseEnter:function(){t(Object(h.e)({selectedLegendItem:c}))},onMouseLeave:function(){t(Object(h.e)())}},i.a.createElement("rect",{style:{strokeWidth:2},width:r,height:r,fill:s,stroke:a}),i.a.createElement("text",{x:r+o+5,y:r-o,style:{fontSize:12,fill:u.a,fontFamily:u.b}},l))},V=n(21);function W(e){return(W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function G(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function H(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function q(e,t){return!t||"object"!==W(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function U(e){return(U=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function X(e,t){return(X=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var K=Object(l.b)((function(e){return{colorBy:e.controls.colorBy,colorings:e.metadata.colorings,colorScale:e.controls.colorScale}}))(r=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=q(this,U(t).call(this,e))).state={legendVisible:!0},n}var n,r,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&X(e,t)}(t,e),n=t,(r=[{key:"componentWillMount",value:function(){this.updateLegendVisibility(this.props.width,this.props.colorScale)}},{key:"componentWillReceiveProps",value:function(e){this.props.width===e.width&&this.props.colorScale.version===e.colorScale.version||this.updateLegendVisibility(e.width,e.colorScale)}},{key:"updateLegendVisibility",value:function(e,t){e<600||t.legendValues.length>32?this.setState({legendVisible:!1}):this.setState({legendVisible:!0})}},{key:"getSVGHeight",value:function(){if(!this.state.legendVisible)return 18;var e=this.props.colorScale.legendValues.length;return Math.ceil(e/2)*(y.legendRectSize+y.legendSpacing)+y.legendSpacing+20||100}},{key:"getSVGWidth",value:function(){return this.state.legendVisible?290:this.getTitleWidth()+20}},{key:"getTransformationForLegendItem",value:function(e){var t=this.props.colorScale.legendValues.length,n=Math.ceil(t/2);return"translate("+(145*Math.floor(e/n)+10)+","+e%n*(y.legendRectSize+y.legendSpacing)+")"}},{key:"getTitleString",value:function(){if(Object(V.isColorByGenotype)(this.props.colorBy)){var e=Object(V.decodeColorByGenotype)(this.props.colorBy);return e.aa?"Genotype at ".concat(e.gene," site ").concat(e.positions.join(", ")):"Nucleotide at position ".concat(e.positions.join(", "))}return void 0===this.props.colorings[this.props.colorBy]?"":this.props.colorings[this.props.colorBy].title}},{key:"getTitleWidth",value:function(){return 15+5.3*this.getTitleString().length}},{key:"toggleLegend",value:function(){var e=!this.state.legendVisible;this.setState({legendVisible:e})}},{key:"legendTitle",value:function(){return i.a.createElement("g",{id:"Title"},i.a.createElement("rect",{width:this.getTitleWidth(),height:"12",fill:"rgba(255,255,255,.85)"}),i.a.createElement("text",{x:5,y:10,style:{fontSize:12,fill:u.a,fontFamily:u.d,backgroundColor:"#fff"}},this.getTitleString()))}},{key:"legendChevron",value:function(){var e=this.state.legendVisible?-180:0,t=this.getTitleWidth();return i.a.createElement("g",{id:"Chevron",transform:"translate(".concat(t,",0)")},i.a.createElement("svg",{width:"12",height:"12",viewBox:"0 0 1792 1792"},i.a.createElement("rect",{width:"1792",height:"1792",fill:"rgba(255,255,255,.85)"}),i.a.createElement("path",{fill:u.a,style:{transform:"rotate(".concat(e,"deg)"),transformOrigin:"50% 50%",transition:"".concat(y.fastTransitionDuration,"ms ease-in-out")},d:"M1683 808l-742 741q-19 19-45 19t-45-19l-742-741q-19-19-19-45.5t19-45.5l166-165q19-19 45-19t45 19l531 531 531-531q19-19 45-19t45 19l166 165q19 19 19 45.5t-19 45.5z"})))}},{key:"styleLabelText",value:function(e){if("num_date"===this.props.colorBy){var t=this.props.colorScale.legendValues;if(t[t.length-1]-t[0]>10&&t[t.length-1]-parseInt(e,10)>=10)return parseInt(e,10);var n=G(Object(m.numericToCalendar)(e).split("-"),3),r=n[0],o=n[1];return n[2],"".concat(y.months[o]," ").concat(r)}return e}},{key:"legendItems",value:function(){var e=this,t=this.props.colorScale.legendValues.filter((function(e){return void 0!==e})).map((function(t,n){return i.a.createElement(z,{dispatch:e.props.dispatch,legendRectSize:y.legendRectSize,legendSpacing:y.legendSpacing,rectFill:Object(F.f)(e.props.colorScale.scale(t)).brighter([.35]).toString(),rectStroke:Object(F.f)(e.props.colorScale.scale(t)).toString(),transform:e.getTransformationForLegendItem(n),key:t,value:t,label:e.styleLabelText(t),index:n})}));return i.a.createElement("g",{id:"ItemsContainer"},i.a.createElement("rect",{width:"290",height:this.getSVGHeight(),fill:"rgba(255,255,255,.85)"}),i.a.createElement("g",{id:"Items",transform:"translate(0,20)"},t))}},{key:"getStyles",value:function(){return{svg:{position:"absolute",left:5,top:26,borderRadius:4,zIndex:1e3}}}},{key:"render",value:function(){var e=this;if(!this.props.colorScale)return null;var t=this.getStyles();return i.a.createElement("svg",{id:"TreeLegendContainer",width:this.getSVGWidth(),height:this.getSVGHeight(),style:t.svg},this.legendItems(),i.a.createElement("g",{id:"TitleAndChevron",onClick:function(){return e.toggleLegend()},style:{cursor:"pointer"}},this.legendTitle(),this.legendChevron()))}}])&&H(n.prototype,r),o&&H(n,o),t}(i.a.Component))||r,J=n(28),Y=n(79),Z=n(493),Q=function(e){return 1===e["stroke-width"]?0:e["stroke-width"]>6?e["stroke-width"]+6:2*e["stroke-width"]},$=(n(108),function(e){var t=e.n.node_attrs&&e.n.node_attrs.hidden;return t&&("always"===t||"timetree"===t&&"num_date"===e.that.distance||"divtree"===t&&"div"===e.that.distance)?"hidden":"visible"});function ee(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var te={attrs:{".tip":{r:function(e){return e.r},cx:function(e){return e.xTip},cy:function(e){return e.yTip}},".branch":{},".vaccineCross":{d:function(e){return e.vaccineCross}},".conf":{d:function(e){return e.confLine}}},styles:{".tip":{fill:function(e){return e.fill},stroke:function(e){return e.tipStroke},visibility:function(e){return e.visibility===y.NODE_VISIBLE?"visible":"hidden"}},".conf":{stroke:function(e){return e.branchStroke},"stroke-width":Q},".branch":{stroke:function(e){return e.branchStroke},"stroke-width":function(e){return e["stroke-width"]+"px"},cursor:function(e){return e.visibility===y.NODE_VISIBLE?"pointer":"default"},visibility:$}}},ne=function(e,t){return function(n){te.attrs[e]&&ee(t).filter((function(t){return te.attrs[e][t]})).forEach((function(t){n.attr(t,te.attrs[e][t])})),te.styles[e]&&ee(t).filter((function(t){return te.styles[e][t]})).forEach((function(t){n.style(t,te.styles[e][t])}))}},re=function(e,t,n,r){e.selectAll(t).filter((function(e){return e.update})).transition().duration(r).call(n),r||Object(Z.d)()},oe=n(11),ie=function e(t,n){t.x=t.px+t.branchLength*Math.cos(t.tau+.5*t.w),t.y=t.py+t.branchLength*Math.sin(t.tau+.5*t.w);var r=t.tau;if(!t.terminal)for(var o=0;o<t.children.length;o++){var i=t.children[o];i.w=2*Math.PI*i.leafCount/n,i.tau=r,r+=i.w,i.px=t.x,i.py=t.y,e(i,n)}};function ae(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function se(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var le=function(e,t){var n=Math.floor(Math.log10(e)),r=Math.pow(10,n);return e/r<2?r/=5:e/r<5&&(r/=2),t&&r<1&&(r=10*r/12),r},ce=function(e,t){if(e>=1)return t.toFixed(Math.max(0,-Math.floor(Math.log10(e))));var n=se(Object(m.numericToCalendar)(t).split("-"),3),r=n[0],o=n[1],i=n[2];return e>=1/12?"".concat(r,"-").concat(y.months[o]):"".concat(r,"-").concat(y.months[o],"-").concat(i)},ue=function(e){return"aa"===e?"10px":"14px"},pe=function(e){return"aa"===e?"500":"700"},de=function(e,t,n){if("clade"===e)return"visible";return function(e){return e.n.tipCount>.05*n&&"rect"===t?"visible":"hidden"}},he=function(e,t){var n=this;this.grid=!1,this.attributes=["r","cx","cy","id","class","d"],this.params={regressionStroke:u.a,regressionWidth:6,majorGridStroke:"#CCC",majorGridWidth:2,minorGridStroke:"#DDD",minorGridWidth:1,tickLabelSize:12,tickLabelFill:u.a,minorTicksTimeTree:3,minorTicks:4,orientation:[1,1],margins:{left:25,right:15,top:10,bottom:30},showGrid:!0,fillSelected:"#A73",radiusSelected:5,branchStroke:"#AAA",branchStrokeWidth:2,tipStroke:"#AAA",tipFill:"#CCC",tipStrokeWidth:1,tipRadius:4,fontFamily:u.b,branchLabelKey:!1,branchLabelFont:u.b,branchLabelFill:"#777",branchLabelFontWeight:500,branchLabelPadX:8,branchLabelPadY:5,tipLabels:!0,tipLabelFont:u.b,tipLabelFill:"#555",tipLabelPadX:8,tipLabelPadY:2,mapToScreenDebounceTime:500,tipLabelFontSizeL1:8,tipLabelFontSizeL2:10,tipLabelFontSizeL3:12,tipLabelBreakL1:75,tipLabelBreakL2:50,tipLabelBreakL3:25},this.groups={},this.debugId=t,this.nodes=e.map((function(e){var t={that:n,n:e,x:0,y:0,terminal:void 0===e.children,inView:void 0===e.inView||e.inView};return e.shell=t,t})),this.numberOfTips=Object(Y.c)(this.nodes),Object(Y.e)(this.nodes),this.xScale=Object(J.a)(),this.yScale=Object(J.a)(),this.zoomNode=this.nodes[0],this.strainToNode={},this.nodes.forEach((function(e){n.strainToNode[e.n.name]=e}))};he.prototype.change=function(e){var t,n,r=e.changeColorBy,o=void 0!==r&&r,i=e.changeVisibility,a=void 0!==i&&i,s=e.changeTipRadii,l=void 0!==s&&s,c=e.changeBranchThickness,u=void 0!==c&&c,p=e.showConfidences,d=void 0!==p&&p,h=e.removeConfidences,f=void 0!==h&&h,m=e.zoomIntoClade,y=void 0!==m&&m,b=e.svgHasChangedDimensions,g=void 0!==b&&b,v=e.newDistance,w=void 0===v?void 0:v,S=e.newLayout,O=void 0===S?void 0:S,E=e.updateLayout,x=void 0===E?void 0:E,k=e.newBranchLabellingKey,T=void 0===k?void 0:k,j=e.branchStroke,C=void 0===j?void 0:j,_=e.tipStroke,N=void 0===_?void 0:_,P=e.fill,D=void 0===P?void 0:P,L=e.visibility,M=void 0===L?void 0:L,B=e.tipRadii,I=void 0===B?void 0:B,A=e.branchThickness,R=void 0===A?void 0:A,F=new Set,z={},V=new Set,W=O,G=500;Date.now()-this.timeLastRenderRequested<1e3&&(G=0),o&&(F.add(".branch").add(".tip").add(".conf"),V.add("stroke").add("fill"),z.branchStroke=C,z.tipStroke=N,z.fill=D),a&&(F.add(".tip").add(".tipLabel"),V.add("visibility").add("cursor"),z.visibility=M),l&&(F.add(".tip"),V.add("r"),z.r=I),u&&(F.add(".branch").add(".conf"),V.add("stroke-width"),z["stroke-width"]=R),(w||O||x||y||g)&&(F.add(".tip").add(".branch.S").add(".branch.T").add(".branch"),F.add(".vaccineCross").add(".vaccineDottedLine").add(".conf"),F.add(".branchLabel").add(".tipLabel"),F.add(".grid").add(".regression"),V.add("cx").add("cy").add("d").add("opacity").add("visibility")),t=this.nodes,n=z,t.forEach((function(e,t){for(var r in e.update=!1,n){var o=n[r][t];o!==e[r]&&(e[r]=o,e.update=!0)}})),y&&(this.nodes.forEach((function(e){e.inView=!1,e.update=!0})),this.zoomNode=y.terminal?y.parent:y,Object(Y.b)(this.zoomNode,(function(e){e.inView=!0}))),g&&this.nodes.forEach((function(e){e.update=!0})),w&&this.setDistance(w),(w||O||x)&&this.setLayout(O||this.layout),(V.has(["stroke-width"])||w||O||x||y||g)&&this.mapToScreen();var H={removeConfidences:f,showConfidences:d,newBranchLabellingKey:T};H.timeSliceHasPotentiallyChanged=a||w,W?this.modifySVGInStages(F,V,G,1e3):this.modifySVG(F,V,G,H),this.timeLastRenderRequested=Date.now()},he.prototype.modifySVG=function(e,t,n,r){var o,i=this,a=[".tip",".vaccineDottedLine",".vaccineCross",".branch"];if(e.has(".branch.S")||e.has(".branch.T")){var s=e.has(".branch");s&&a.splice(a.indexOf(".branch"),1);[".S",".T"].forEach((function(r,a){e.has(".branch".concat(r))&&(o=s?function(e){ne(".branch",t)(e),e.attr("d",(function(e){return e.branch[a]}))}:function(e){e.attr("d",(function(e){return e.branch[a]}))},re(i.svg,".branch".concat(r),o,n))}))}a.forEach((function(r){e.has(r)&&(o=ne(r,t),re(i.svg,r,o,n))})),e.has(".branchLabel")&&this.updateBranchLabels(n),e.has(".tipLabel")&&this.updateTipLabels(),e.has(".grid")&&(this.grid&&"unrooted"!==this.layout?this.addGrid():this.hideGrid()),e.has(".regression")&&(this.removeRegression(),"clock"===this.layout&&"num_date"===this.distance&&this.drawRegression()),r.removeConfidences&&this.confidencesInSVG?this.removeConfidence():r.showConfidences&&!this.confidencesInSVG?this.drawConfidence():e.has(".conf")&&this.confidencesInSVG&&("rect"===this.layout&&"num_date"===this.distance?(o=ne(".conf",t),re(this.svg,".conf",o,n)):this.removeConfidence()),r.timeSliceHasPotentiallyChanged&&this.addTemporalSlice(),r.newBranchLabellingKey&&(this.removeBranchLabels(),"none"!==r.newBranchLabellingKey&&this.drawBranchLabels(r.newBranchLabellingKey))},he.prototype.modifySVGInStages=function(e,t,n,r){var o=this;e.delete(".tip"),this.hideGrid();var i=0,a=function(){o.drawBranches(),o.params.showGrid&&o.addGrid(),o.svg.selectAll(".tip").remove(),o.drawTips(),o.updateTipLabels(),o.vaccines&&o.drawVaccines(),o.addTemporalSlice(),"clock"===o.layout&&"num_date"===o.distance&&o.drawRegression(),e.has(".branchLabel")&&o.drawBranchLabels(o.params.branchLabelKey)};this.confidencesInSVG=!1,this.svg.selectAll(ee(e).join(", ")).transition().duration(n).style("opacity",0).remove().on("start",(function(){return i++})).on("end",(function(){if(!--i){var e=ne(".tip",t);re(o.svg,".tip",e,r),setTimeout(a,r)}})),this.removeTemporalSlice(),n||Object(Z.d)()},he.prototype.render=function(e,t,n,r,o,i,a,s,l,c,u,p,d,h){var f=this;this.svg=e,this.params=Object.assign(this.params,r),this.callbacks=o,this.vaccines=l?l.map((function(e){return e.shell})):void 0,this.dateRange=h,this.setDistance(n),this.setLayout(t),this.mapToScreen(),this.nodes.forEach((function(e,t){e.branchStroke=c[t],e.tipStroke=u[t],e.fill=p[t],e.visibility=a[t],e["stroke-width"]=i[t],e.r=d?d[t]:f.params.tipRadius})),this.params.showGrid&&(this.addGrid(),this.addTemporalSlice()),this.drawBranches(),this.drawTips(),this.params.branchLabelKey&&this.drawBranchLabels(this.params.branchLabelKey),this.vaccines&&this.drawVaccines(),"clock"===this.layout&&"num_date"===this.distance&&this.drawRegression(),this.confidencesInSVG=!1,s&&this.drawConfidence(),this.updateTipLabels(),this.timeLastRenderRequested=Date.now()},he.prototype.clearSVG=function(){this.svg.selectAll("*").remove()},he.prototype.drawTips=function(){var e=this.params;"tips"in this.groups||(this.groups.tips=this.svg.append("g").attr("id","tips")),this.groups.tips.selectAll(".tip").data(this.nodes.filter((function(e){return e.terminal}))).enter().append("circle").attr("class","tip").attr("id",(function(e){return Object(Y.d)("tip",e.n.name)})).attr("cx",(function(e){return e.xTip})).attr("cy",(function(e){return e.yTip})).attr("r",(function(e){return e.r})).on("mouseover",this.callbacks.onTipHover).on("mouseout",this.callbacks.onTipLeave).on("click",this.callbacks.onTipClick).style("pointer-events","auto").style("visibility",(function(e){return e.visibility===y.NODE_VISIBLE?"visible":"hidden"})).style("fill",(function(t){return t.fill||e.tipFill})).style("stroke",(function(t){return t.tipStroke||e.tipStroke})).style("stroke-width",(function(){return e.tipStrokeWidth})).style("cursor","pointer")},he.prototype.drawBranches=function(){var e=this.params;"branchTee"in this.groups||(this.groups.branchTee=this.svg.append("g").attr("id","branchTee")),"clock"===this.layout||"unrooted"===this.layout?this.groups.branchTee.selectAll("*").remove():this.groups.branchTee.selectAll(".branch").data(this.nodes.filter((function(e){return!e.terminal}))).enter().append("path").attr("class","branch T").attr("id",(function(e){return Object(Y.d)("branchT",e.n.name)})).attr("d",(function(e){return e.branch[1]})).style("stroke",(function(t){return t.branchStroke||e.branchStroke})).style("stroke-width",(function(t){return t["stroke-width"]||e.branchStrokeWidth})).style("fill","none").style("pointer-events","auto"),"branchStem"in this.groups||(this.groups.branchStem=this.svg.append("g").attr("id","branchStem")),this.groups.branchStem.selectAll(".branch").data(this.nodes).enter().append("path").attr("class","branch S").attr("id",(function(e){return Object(Y.d)("branchS",e.n.name)})).attr("d",(function(e){return e.branch[0]})).style("stroke",(function(t){return t.branchStroke||e.branchStroke})).style("stroke-linecap","round").style("stroke-width",(function(e){return e["stroke-width"]+"px"||!1})).style("fill","none").style("visibility",$).style("cursor",(function(e){return e.visibility===y.NODE_VISIBLE?"pointer":"default"})).style("pointer-events","auto").on("mouseover",this.callbacks.onBranchHover).on("mouseout",this.callbacks.onBranchLeave).on("click",this.callbacks.onBranchClick)},he.prototype.drawVaccines=function(){this.vaccines&&this.vaccines.length&&("vaccines"in this.groups||(this.groups.vaccines=this.svg.append("g").attr("id","vaccines")),this.groups.vaccines.selectAll(".vaccineCross").data(this.vaccines).enter().append("path").attr("class","vaccineCross").attr("d",(function(e){return e.vaccineCross})).style("stroke","#333").style("stroke-width",2*this.params.branchStrokeWidth).style("fill","none").style("cursor","pointer").style("pointer-events","auto").on("mouseover",this.callbacks.onTipHover).on("mouseout",this.callbacks.onTipLeave).on("click",this.callbacks.onTipClick))},he.prototype.drawRegression=function(){var e=this.yScale(this.regression.intercept+this.xScale.domain()[0]*this.regression.slope),t=this.yScale(this.regression.intercept+this.xScale.domain()[1]*this.regression.slope),n="M "+this.xScale.range()[0].toString()+" "+e.toString()+" L "+this.xScale.range()[1].toString()+" "+t.toString();"clockRegression"in this.groups||(this.groups.clockRegression=this.svg.append("g").attr("id","clockRegression")),this.groups.clockRegression.append("path").attr("d",n).attr("class","regression").style("fill","none").style("visibility","visible").style("stroke",this.params.regressionStroke).style("stroke-width",this.params.regressionWidth),this.groups.clockRegression.append("text").text("rate estimate: ".concat(this.regression.slope.toExponential(2)," subs per site per year")).attr("class","regression").attr("x",this.xScale.range()[1]/2-75).attr("y",this.yScale.range()[0]+50).style("fill",this.params.regressionStroke).style("font-size",this.params.tickLabelSize+8).style("font-weight",400).style("font-family",this.params.fontFamily)},he.prototype.removeRegression=function(){"clockRegression"in this.groups&&this.groups.clockRegression.selectAll("*").remove()},he.prototype.setDistance=function(e){this.nodes.forEach((function(e){e.update=!0})),this.distance=e||"div","div"===this.distance?this.nodes.forEach((function(e){e.depth=Object(T.getDivFromNode)(e.n),e.pDepth=Object(T.getDivFromNode)(e.n.parent),e.conf=[e.depth,e.depth]})):this.nodes.forEach((function(e){e.depth=Object(T.getTraitFromNode)(e.n,"num_date"),e.pDepth=Object(T.getTraitFromNode)(e.n.parent,"num_date"),e.conf=Object(T.getTraitFromNode)(e.n,"num_date",{confidence:!0})||[e.depth,e.depth]})),this.vaccines&&this.vaccines.forEach((function(e){e.crossDepth=e.depth}))},he.prototype.setLayout=function(e){void 0!==e&&e===this.layout||this.nodes.forEach((function(e){e.update=!0})),this.layout=void 0===e?"rect":e,"rect"===this.layout?this.rectangularLayout():"clock"===this.layout?this.timeVsRootToTip():"radial"===this.layout?this.radialLayout():"unrooted"===this.layout&&this.unrootedLayout()},he.prototype.rectangularLayout=function(){this.nodes.forEach((function(e){e.y=e.n.yvalue,e.x=e.depth,e.px=e.pDepth,e.py=e.y})),this.vaccines&&this.vaccines.forEach((function(e){e.xCross=e.crossDepth,e.yCross=e.y}))},he.prototype.timeVsRootToTip=function(){this.nodes.forEach((function(e){e.y=Object(T.getDivFromNode)(e.n),e.x=Object(T.getTraitFromNode)(e.n,"num_date"),e.px=Object(T.getTraitFromNode)(e.n.parent,"num_date"),e.py=Object(T.getDivFromNode)(e.n.parent)})),this.vaccines&&this.vaccines.forEach((function(e){e.xCross=e.x,e.yCross=e.y}));var e=this.numberOfTips,t=this.nodes[0].depth,n=Object(oe.h)(this.nodes.filter((function(e){return e.terminal})).map((function(e){return e.y*(e.depth-t)})))/e/(Object(oe.h)(this.nodes.filter((function(e){return e.terminal})).map((function(e){return(e.depth-t)*(e.depth-t)})))/e),r=-t*n;this.regression={slope:n,intercept:r}},he.prototype.unrootedLayout=function(){Object(Y.a)(this.nodes[0]);var e=this.nodes[0].leafCount;this.nodes.forEach((function(e){e.branchLength=e.depth-e.pDepth})),this.nodes[0].x=0,this.nodes[0].y=0,this.nodes[0].px=0,this.nodes[0].py=0,this.nodes[0].w=2*Math.PI,this.nodes[0].tau=0;for(var t=1.5*Math.PI,n=0;n<this.nodes[0].children.length;n++)this.nodes[0].children[n].px=0,this.nodes[0].children[n].py=0,this.nodes[0].children[n].w=2*Math.PI*this.nodes[0].children[n].leafCount/e,this.nodes[0].children[n].tau=t,t+=this.nodes[0].children[n].w,ie(this.nodes[0].children[n],e);this.vaccines&&this.vaccines.forEach((function(e){var t=e.crossDepth-e.depth;e.xCross=e.px+t*Math.cos(e.tau+.5*e.w),e.yCross=e.py+t*Math.sin(e.tau+.5*e.w)}))},he.prototype.radialLayout=function(){var e=this,t=this.numberOfTips,n=this.nodes[0].depth;this.nodes.forEach((function(e){var r=1.9*Math.PI*e.yRange[0]/t,o=1.9*Math.PI*e.yRange[1]/t;e.angle=1.9*Math.PI*e.n.yvalue/t,e.y=(e.depth-n)*Math.cos(e.angle),e.x=(e.depth-n)*Math.sin(e.angle),e.py=e.y*(e.pDepth-n)/(e.depth-n+1e-15),e.px=e.x*(e.pDepth-n)/(e.depth-n+1e-15),e.yCBarStart=(e.depth-n)*Math.cos(r),e.xCBarStart=(e.depth-n)*Math.sin(r),e.yCBarEnd=(e.depth-n)*Math.cos(o),e.xCBarEnd=(e.depth-n)*Math.sin(o),e.smallBigArc=Math.abs(o-r)>1*Math.PI})),this.vaccines&&this.vaccines.forEach((function(t){"div"===e.distance?(t.xCross=t.x,t.yCross=t.y):(t.xCross=(t.crossDepth-n)*Math.sin(t.angle),t.yCross=(t.crossDepth-n)*Math.cos(t.angle))}))},he.prototype.setScales=function(e){var t=parseInt(this.svg.attr("width"),10),n=parseInt(this.svg.attr("height"),10);if("radial"===this.layout||"unrooted"===this.layout){var r=t-(e.left||0)-(e.right||0),o=n-(e.top||0)-(e.top||0),i=Object(oe.e)([r,o]),a=r-i,s=o-i;this.xScale.range([.5*a+e.left||0,t-.5*a-(e.right||0)]),this.yScale.range([.5*s+e.top||0,n-.5*s-(e.bottom||0)])}else this.params.orientation[0]>0?this.xScale.range([e.left||0,t-(e.right||0)]):this.xScale.range([t-(e.right||0),e.left||0]),this.params.orientation[1]>0?this.yScale.range([e.top||0,n-(e.bottom||0)]):this.yScale.range([n-(e.bottom||0),e.top||0])},he.prototype.mapToScreen=function(){var e=this,t={left:this.params.margins.left,right:this.params.margins.right,top:this.params.margins.top,bottom:this.params.margins.bottom},n=this.nodes.filter((function(e){return e.terminal})).filter((function(e){return e.inView}));if(n.length<this.params.tipLabelBreakL1){var r=this.params.tipLabelFontSizeL1;n.length<this.params.tipLabelBreakL2&&(r=this.params.tipLabelFontSizeL2),n.length<this.params.tipLabelBreakL3&&(r=this.params.tipLabelFontSizeL3);var o=0;n.forEach((function(e){o<e.n.name.length&&(o=.65*e.n.name.length*r)})),t.right+=o}this.setScales(t);var i=1e6,a=0,s=1e6,l=0;if(this.nodes.filter((function(e){return e.inView})).forEach((function(e){e.x>l&&(l=e.x),e.y>a&&(a=e.y),e.x<s&&(s=e.x),e.y<i&&(i=e.y)})),s===l&&(s-=.005,l+=.005),n.length<30){var c=.05*(a-i);i-=c,a+=c}if("radial"===this.layout||"unrooted"===this.layout){var u=l-s,p=a-i,d=Object(oe.d)([p,u]),h=u>p?.5*(u-p):0,f=u<p?.5*(p-u):0;this.xScale.domain([s-f,s+d-f]),this.yScale.domain([i-h,i+d-h])}else"clock"===this.layout?(this.xScale.domain([s,l]),this.yScale.domain([a,i])):(this.xScale.domain([s,l]),this.yScale.domain([i,a]));if(this.nodes.forEach((function(t){t.xTip=e.xScale(t.x),t.yTip=e.yScale(t.y),t.xBase=e.xScale(t.px),t.yBase=e.yScale(t.py)})),this.vaccines&&this.vaccines.forEach((function(t){var n=e.xScale(t.xCross),r=e.yScale(t.yCross);t.vaccineCross=" M ".concat(n-6,",").concat(r-6," L ").concat(n+6,",").concat(r+6," M ").concat(n-6,",").concat(r+6," L ").concat(n+6,",").concat(r-6)})),"clock"===this.layout||"unrooted"===this.layout)this.nodes.forEach((function(e){e.branch=[" M "+e.xBase.toString()+","+e.yBase.toString()+" L "+e.xTip.toString()+","+e.yTip.toString(),""]}));else if("rect"===this.layout)this.nodes.forEach((function(t){var n=.5*(t.parent["stroke-width"]-t["stroke-width"])||0,r=[e.yScale(t.yRange[0]),e.yScale(t.yRange[1])];t.branch=[" M ".concat(t.xBase-n,",").concat(t.yBase," L ").concat(t.xTip,",").concat(t.yTip," M ").concat(t.xTip,",").concat(r[0]," L ").concat(t.xTip,",").concat(r[1])],e.params.confidence&&(t.confLine=" M ".concat(e.xScale(t.conf[0]),",").concat(t.yBase," L ").concat(e.xScale(t.conf[1]),",").concat(t.yTip))}));else if("radial"===this.layout){var m=this.nodes[0].depth,y=this.nodes.map((function(e){return.5*(e.parent["stroke-width"]-e["stroke-width"])||0}));this.nodes.forEach((function(t){t.cBarStart=e.yScale(t.yRange[0])})),this.nodes.forEach((function(t){t.cBarEnd=e.yScale(t.yRange[1])})),this.nodes.forEach((function(t,n){t.branch=[" M "+(t.xBase-y[n]*Math.sin(t.angle)).toString()+" "+(t.yBase-y[n]*Math.cos(t.angle)).toString()+" L "+t.xTip.toString()+" "+t.yTip.toString(),""],t.terminal||(t.branch[1]=[" M "+e.xScale(t.xCBarStart).toString()+" "+e.yScale(t.yCBarStart).toString()+" A "+(e.xScale(t.depth)-e.xScale(m)).toString()+" "+(e.yScale(t.depth)-e.yScale(m)).toString()+" 0 "+(t.smallBigArc?"1 ":"0 ")+" 1 "+e.xScale(t.xCBarEnd).toString()+","+e.yScale(t.yCBarEnd).toString()])}))}},he.prototype.removeConfidence=function(e){this.confidencesInSVG=!1,"confidenceIntervals"in this.groups&&(e?this.groups.confidenceIntervals.selectAll("*").transition().duration(e).style("opacity",0).remove():this.groups.confidenceIntervals.selectAll("*").remove())},he.prototype.drawConfidence=function(e){var t=this;this.confidencesInSVG=!0,"confidenceIntervals"in this.groups||(this.groups.confidenceIntervals=this.svg.append("g").attr("id","confidenceIntervals")),e?(this.groups.confidenceIntervals.selectAll(".conf").data(this.nodes).enter().call((function(e){return t.drawSingleCI(e,0)})),this.groups.confidenceIntervals.transition().duration(e).style("opacity",.5)):this.groups.confidenceIntervals.selectAll(".conf").data(this.nodes).enter().call((function(e){return t.drawSingleCI(e,.5)}))},he.prototype.drawSingleCI=function(e,t){e.append("path").attr("class","conf").attr("id",(function(e){return Object(Y.d)("conf",e.n.name)})).attr("d",(function(e){return e.confLine})).style("stroke",(function(e){return e.branchStroke||"#888"})).style("opacity",t).style("fill","none").style("stroke-width",Q).style("pointer-events","none")},he.prototype.drawBranchLabels=function(e){var t=this;this.params.branchLabelKey=e;var n=ue(e),r=pe(e),o=de(e,this.layout,this.zoomNode.n.tipCount);"branchLabels"in this.groups||(this.groups.branchLabels=this.svg.append("g").attr("id","branchLabels")),this.groups.branchLabels.selectAll(".branchLabel").data(this.nodes.filter((function(t){return t.n.branch_attrs&&t.n.branch_attrs.labels&&t.n.branch_attrs.labels[e]}))).enter().append("text").attr("class","branchLabel").attr("x",(function(e){return e.xTip+(t.params.orientation[0]>0?-5:5)})).attr("y",(function(e){return e.yTip-t.params.branchLabelPadY})).style("text-anchor",this.params.orientation[0]>0?"end":"start").style("visibility",o).style("fill",this.params.branchLabelFill).style("font-family",this.params.branchLabelFont).style("font-weight",r).style("font-size",n).text((function(t){return t.n.branc