UNPKG

auspice

Version:

Web app for visualizing pathogen evolution

1 lines 25.3 kB
"use strict";(self.webpackChunkauspice=self.webpackChunkauspice||[]).push([[61],{38342:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){if(t){if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function l(){return l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}},l.apply(this,arguments)}function u(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function c(t){var e="function"==typeof Map?new Map:void 0;return c=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return s(t,arguments,y(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,t)},c(t)}function s(t,e,r){return s=f()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&d(o,r.prototype),o},s.apply(null,arguments)}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t,e){return d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},d(t,e)}function y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},y(t)}r.d(e,{L:()=>p});var p=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&d(t,e)}(m,t);var e,r,a,c,s,p=(e=m,r=f(),function(){var t,o=y(e);if(r){var a=y(this).constructor;t=Reflect.construct(o,arguments,a)}else t=o.apply(this,arguments);return function(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return u(t)}(this,t)});function m(t){var e,r,n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,m),e=p.call(this),Object.defineProperties(u(e),{_intern:{value:new Map},_key:{value:a}}),null!=t){var i,l=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=o(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,a=function(){};return{s:a,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,l=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return l=t.done,t},e:function(t){u=!0,i=t},f:function(){try{l||null==r.return||r.return()}finally{if(u)throw i}}}}(t);try{for(l.s();!(i=l.n()).done;){var c=(r=i.value,n=2,function(t){if(Array.isArray(t))return t}(r)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a=[],i=!0,l=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(a.push(n.value),!e||a.length!==e);i=!0);}catch(t){l=!0,o=t}finally{try{i||null==r.return||r.return()}finally{if(l)throw o}}return a}}(r,n)||o(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=c[0],f=c[1];e.set(s,f)}}catch(t){l.e(t)}finally{l.f()}}return e}return a=m,(c=[{key:"get",value:function(t){return l(y(m.prototype),"get",this).call(this,h(this,t))}},{key:"has",value:function(t){return l(y(m.prototype),"has",this).call(this,h(this,t))}},{key:"set",value:function(t,e){return l(y(m.prototype),"set",this).call(this,function(t,e){var r=t._intern,n=(0,t._key)(e);return r.has(n)?r.get(n):(r.set(n,e),e)}(this,t),e)}},{key:"delete",value:function(t){return l(y(m.prototype),"delete",this).call(this,function(t,e){var r=t._intern,n=(0,t._key)(e);return r.has(n)&&(e=r.get(e),r.delete(n)),e}(this,t))}}])&&i(a.prototype,c),s&&i(a,s),m}(c(Map));function h(t,e){var r=t._intern,n=(0,t._key)(e);return r.has(n)?r.get(n):e}function v(t){return null!==t&&"object"===n(t)?t.valueOf():t}},27679:(t,e,r)=>{r.r(e),r.d(e,{default:()=>K});var n=r(98665),o=r.n(n),a=r(40590),i=r.n(a),l=r(82684),u=r(4667),c=r(70570),s=r(9045),f=r(4699),d=r(14303),y=r(18466),p=r(87899),h=r(14866),v=r(14179),m=r(87040);function g(t,e){if(t){if("string"==typeof t)return b(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(t,e):void 0}}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}const w=function(t){var e=t.hoverData;if(null===e)return null;var r=e.hoverTitle,n=e.mouseX,o=e.mouseY,a=e.containerId,i=e.data,u={position:"absolute",minWidth:200,padding:"5px",borderRadius:10,zIndex:1e3,pointerEvents:"none",fontFamily:v.fu.panel.fontFamily,fontSize:14,lineHeight:1,fontWeight:v.fu.panel.fontWeight,color:v.fu.panel.color,backgroundColor:v.fu.panel.backgroundColor,wordWrap:"break-word",wordBreak:"break-word"},c=document.getElementById(a),s=c.getBoundingClientRect();u.maxWidth=.5*s.width;var f,d=o-s.top+c.scrollTop,y=n-s.left;return y<.5*s.width?u.left=y+5:u.right=s.width-y+5,d-c.scrollTop<.5*s.height?u.top=d+5:u.bottom=s.height-d+5,l.createElement("div",{style:u},l.createElement("div",{className:"tooltip",style:v.fu.tooltip},l.createElement("div",{style:v.fu.tooltipHeading},r),(f=i.entries(),function(t){if(Array.isArray(t))return b(t)}(f)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(f)||g(f)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(t){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a=[],i=!0,l=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(a.push(n.value),!e||a.length!==e);i=!0);}catch(t){l=!0,o=t}finally{try{i||null==r.return||r.return()}finally{if(l)throw o}}return a}}(t,e)||g(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t,2),r=e[0],n=e[1];return l.createElement(m.m,{key:r,name:"".concat(r,":"),value:n})}))))};var x=r(28839),A=r(19541),S=r(63320),k=r(23859),M=r(59352),O=r(86491),C=r(1326),E=r(89007),B=r(33683),j=r(4697);function P(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a=[],i=!0,l=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(a.push(n.value),!e||a.length!==e);i=!0);}catch(t){l=!0,o=t}finally{try{i||null==r.return||r.return()}finally{if(l)throw o}}return a}}(t,e)||R(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(t,e){if(t){if("string"==typeof t)return H(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?H(t,e):void 0}}function H(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Z={yMin:0,yMax:100,leftPadding:180,rightPadding:30,topPadding:20,xAxisHeight:50,subplotHeight:100,subplotPadding:10,circleRadius:3,circleHoverRadius:5,circleStrokeWidth:1,circleFillOpacity:.5,circleStrokeOpacity:.75,thresholdStrokeWidth:2,thresholdStroke:"#DDD",subplotFill:"#adb1b3",subplotFillOpacity:"0.15",diamondSize:50,standardDeviationStroke:3,overallMeanColor:"#000",yAxisTickSize:6,yAxisColorByLineHeight:9,yAxisColorByLineStrokeWidth:4};Z.overallMeanYValue=Z.subplotHeight/2;var I={xAxis:"measurementXAxis",yAxis:"measurementYAxis",groupingValue:"measurementGroupingValue",yAxisColorByLabel:"measurementYAxisColorByLabel",threshold:"measurementThreshold",subplot:"measurementSubplot",subplotBackground:"measurementSubplotBackground",rawMeasurements:"rawMeasurements",rawMeasurementsGroup:"rawMeasurementsGroup",overallMean:"measurementsOverallMean",colorMean:"measurementsColorMean",mean:"mean",standardDeviation:"standardDeviation"},T="measurementsSVGContainer",V=function(t){return"meaurement_".concat(t[c.$s])},_=function(t){return"measurement_subplot_".concat(t)},D=function(t,e,r,n,o,a){var i={colorByAttr:n.attribute,mean:(0,S.Z)(t),standardDeviation:(0,k.Z)(t)},l=e.append("g").attr("class",r).attr("display","none").selectAll("meanAndStandardDeviation").data([i]).enter();l.append("path").attr("class",I.mean).attr("transform",(function(t){return"translate(".concat(o(t.mean),", ").concat(a,")")})).attr("d",(0,B.Z)().type(j.Z).size(Z.diamondSize)).attr("fill",n.color),void 0!==i.standardDeviation&&l.append("line").attr("class",I.standardDeviation).attr("x1",(function(t){return o(t.mean-t.standardDeviation)})).attr("x2",(function(t){return o(t.mean+t.standardDeviation)})).attr("y1",a).attr("y2",a).attr("stroke-width",Z.standardDeviationStroke).attr("stroke",n.color)},L=function(t,e,r){var n=r?null:"none";(0,C.Z)(t).selectAll(".".concat(I[e])).attr("display",n)},F="measurementsColorGroupingCrosshair",Y=function(t){(0,C.Z)(t).select("#".concat(F)).remove()},G=r(59305),W=r(6461),z=r(63463);function X(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a=[],i=!0,l=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(a.push(n.value),!e||a.length!==e);i=!0);}catch(t){l=!0,o=t}finally{try{i||null==r.return||r.return()}finally{if(l)throw o}}return a}}(t,e)||U(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function U(t,e){if(t){if("string"==typeof t)return $(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$(t,e):void 0}}function $(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function N(t){var e=(0,l.useRef)();return i()(t,e.current)||(e.current=t),e.current}var J=function(t){var e=t.height,r=t.width,n=t.showLegend,a=t.setPanelTitle,y=(0,u.I0)(),p=(0,u.v9)((function(t){return function(t){var e=t.tree,r=t.controls.colorScale;return e.nodes.reduce((function(t,n,o){var a=t.treeStrainVisibility,i=t.treeStrainColors;if(!n.hasChildren){a[n.name]=e.visibility[o];var l=(0,s.BG)(n,r);if(r.continuous){var u=r.visibleLegendValues.find((function(t){return(0,f.k)(t,n,r)}));void 0!==u&&(l=u)}i[n.name]={attribute:l,color:e.nodeColors[o]}}return t}),{treeStrainVisibility:{},treeStrainColors:{}})}(t)}),i()),v=p.treeStrainVisibility,m=p.treeStrainColors,g=(0,u.v9)((function(t){return t.controls.colorScale.legendValues.map(String)}),i()),b=(0,u.v9)((function(t){return t.metadata.colorings})),S=(0,u.v9)((function(t){return t.controls.colorBy})),k=(0,u.v9)((function(t){return t.controls.defaults.colorBy})),B=(0,u.v9)((function(t){return t.controls.measurementsColorGrouping})),j=(0,u.v9)((function(t){return t.controls.measurementsGroupBy})),H=(0,u.v9)((function(t){return t.controls.measurementsFilters})),J=(0,u.v9)((function(t){return t.controls.measurementsDisplay})),K=(0,u.v9)((function(t){return t.controls.measurementsShowOverallMean})),q=(0,u.v9)((function(t){return t.controls.measurementsShowThreshold})),Q=(0,u.v9)((function(t){return t.measurements.collectionToDisplay}),i()),tt=Q.title,et=Q.x_axis_label,rt=Q.thresholds,nt=Q.fields,ot=Q.measurements,at=Q.groupings,it=(0,l.useRef)(null),lt=(0,l.useRef)(null),ut=(0,l.useRef)(null),ct=X((0,l.useState)(null),2),st=ct[0],ft=ct[1],dt=function(t,e,r){var n=(0,W.YG)(r);return{activeFilters:n,filteredMeasurements:t.filter((function(t){return e[t.strain]===c.m7&&(0,W.KC)(t,n)}))}}(ot,v,H),yt=dt.activeFilters,pt=dt.filteredMeasurements,ht=at.get(j).values,vt=ht;yt[j]&&yt[j].length&&(vt=yt[j]);var mt=function(t,e,r){return o()((0,A.Xx)(t,(function(t){return t[e]})),(function(t){var e=P(t,1)[0];return r.indexOf(e)}),"asc")}(pt,j,vt),gt=(0,l.useMemo)((function(){return function(t,e){var r,n,o,a,i,l,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1;return(0,O.BY)().domain((r=(0,x.Z)(e,(function(t){return t.value})),n=u,o=P(r,2),a=o[0],i=o[1],l=(i-a)*n/2,[a-l,i+l])).range([Z.leftPadding,t-Z.rightPadding]).nice()}(r,pt)}),[r,pt].map(N)),bt=N({containerHeight:e,xScale:gt,yScale:(0,l.useMemo)((function(){return t=Z.yMin-2*Z.circleRadius,e=Z.yMax+2*Z.circleRadius,(0,O.BY)().domain([t,e]).range([Z.subplotHeight,0]).nice();var t,e}),[]),x_axis_label:et,thresholds:rt,groupingOrderedValues:ht,groupedMeasurements:mt}),wt=(0,l.useCallback)((function(t,e,r){var n,a,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,l=null;if(null!==t){var u=null!==i?"Color by ".concat((0,s.Jp)(b,S)," : ").concat(i):null,c=new Map;if((0,G.Xr)(t)){var f=Object.keys(t).filter((function(t){return nt.has(t)})),d=function(t){if(Array.isArray(t))return $(t)}(a=nt.keys())||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(a)||U(a)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();o()(f,(function(t){return d.indexOf(t)})).forEach((function(e){c.set(nt.get(e).title,t[e])}))}else"number"!=typeof(n=t).mean||"number"!=typeof n.standardDeviation&&void 0!==n.standardDeviation?(console.error('"Unknown data type for hover panel: '.concat(JSON.stringify(t))),Object.entries(t).forEach((function(t){var e=X(t,2),r=e[0],n=e[1];return c.set(r,n)}))):(c.set("mean",t.mean.toFixed(2)),c.set("standard deviation",t.standardDeviation?t.standardDeviation.toFixed(2):"N/A"));l={hoverTitle:u,mouseX:e,mouseY:r,containerId:T,data:c}}ft(l)}),[nt,b,S]),xt=(0,l.useRef)((0,W.o6)(S)?k:S);(0,l.useEffect)((function(){(0,W.o6)(S)||(xt.current=S)}),[S]);var At=(0,l.useCallback)((function(t){t===B&&(0,W.o6)(S)?t===B&&(0,W.o6)(S)&&y((0,z.j)(xt.current)):y((0,W.cS)(t))}),[y,B,S]);(0,l.useEffect)((function(){a("".concat(tt||"Measurements"," (grouped by ").concat(nt.get(j).title,")"))}),[a,tt,nt,j]),(0,l.useEffect)((function(){var t,e;it.current.scrollTop=0,t=lt.current,e=ut.current,(0,C.Z)(t).attr("height",null).selectAll("*").remove(),(0,C.Z)(e).selectAll("*").remove(),function(t,e,r,n){var o=r.containerHeight,a=r.xScale,i=r.yScale,l=r.x_axis_label,u=r.thresholds,c=r.groupingOrderedValues,s=r.groupedMeasurements;if(!s||0!==s.length){var f=Z.subplotHeight*s.length+Z.topPadding,d=(0,C.Z)(t).attr("height",f).append("g").append("g").append("g").append("g");if(function(t,e,r,n,o){var a=(0,C.Z)(t),i=Math.min(e-Z.xAxisHeight,r);a.style("top","".concat(i,"px")),a.append("rect").attr("x",0).attr("y",0).attr("height","100%").attr("width","100%").attr("fill","white").attr("fill-opacity",1);var l=a.node().getBoundingClientRect().width;a.append("g").attr("class",I.xAxis).call((0,M.LL)(n)).call((function(t){return t.attr("font-family",null)})).append("text").attr("x",Z.leftPadding+(l-Z.leftPadding-Z.rightPadding)/2).attr("y",2*Z.xAxisHeight/3).attr("text-anchor","middle").attr("fill","currentColor").text(o)}(e,o,f,a,l),Array.isArray(u)){var y,p=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=R(t))){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){l=!0,a=t},f:function(){try{i||null==r.return||r.return()}finally{if(l)throw a}}}}(u);try{for(p.s();!(y=p.n()).done;){var h=y.value;if("number"==typeof h){var v=a(h);d.append("line").attr("class",I.threshold).attr("x1",v).attr("x2",v).attr("y1",Z.topPadding).attr("y2",f).attr("stroke-width",Z.thresholdStrokeWidth).attr("stroke",Z.thresholdStroke).attr("display","none")}}}catch(t){p.e(t)}finally{p.f()}}var m=Z.topPadding;s.forEach((function(t,e){var r=P(t,2),o=r[0],l=r[1],u=d.append("svg").attr("class",I.subplot).attr("id",_(c.indexOf(o))).attr("width","100%").attr("height",Z.subplotHeight).attr("y",m);m+=Z.subplotHeight,u.append("rect").attr("class",I.subplotBackground).attr("x",0).attr("y",0).attr("height","100%").attr("width","100%").attr("fill",e%2?Z.subplotFill:"none").attr("fill-opacity",Z.subplotFillOpacity),u.append("g").attr("class",I.yAxis).attr("transform","translate(".concat(Z.leftPadding,", 0)")).attr("cursor","pointer").call((0,M.y4)(i).tickValues([i((Z.yMax-Z.yMin)/2)]).tickSize(Z.yAxisTickSize).tickFormat(o)).call((function(t){t.selectAll(".tick").append("title").text("Click to color by an average of all measurement values per test strain in this group"),t.attr("font-family",null),t.selectAll("text").attr("class",I.groupingValue).attr("transform",(function(t,e,r){var n=(0,C.Z)(r[e]).node().getBoundingClientRect().width,o=Z.leftPadding-2*Z.yAxisTickSize;return n>o?"scale(".concat(o/n,")"):null}))})).on("click",(function(){return n(o)})),u.append("g").attr("class",I.rawMeasurementsGroup).attr("display","none").selectAll("dot").data(l).enter().append("circle").attr("class",I.rawMeasurements).attr("id",(function(t){return V(t)})).attr("cx",(function(t){return a(t.value)})).attr("r",Z.circleRadius).attr("fill-opacity",Z.circleFillOpacity).attr("stroke-opacity",Z.circleStrokeOpacity).on("mouseover.radius",(function(t,e,r){(0,C.Z)(r[e]).transition().duration("100").attr("r",Z.circleHoverRadius)})).on("mouseout.radius",(function(t,e,r){(0,C.Z)(r[e]).transition().duration("200").attr("r",Z.circleRadius)})),D(l.map((function(t){return t.value})),u,I.overallMean,{attribute:null,color:Z.overallMeanColor},a,Z.overallMeanYValue)}))}}(lt.current,ut.current,bt,At)}),[bt,At]),(0,l.useEffect)((function(){!function(t,e){var r=(0,C.Z)(t);r.selectAll(".".concat(I.yAxisColorByLabel)).remove(),r.selectAll(".".concat(I.yAxis)).select(".tick").each((function(t,r,n){var o=(0,C.Z)(n[r]),a=o.select(".".concat(I.groupingValue)).text(),i=e[a];if(i){var l=o.node().getBoundingClientRect().width;o.append("line").attr("class",I.yAxisColorByLabel).attr("x1",-Z.yAxisTickSize).attr("x2",-l).attr("y1",Z.yAxisColorByLineHeight).attr("y2",Z.yAxisColorByLineHeight).attr("stroke-width",Z.yAxisColorByLineStrokeWidth).attr("stroke",i.color),o.append("text").attr("class",I.yAxisColorByLabel).attr("x",-.5*l).attr("dy",2*Z.yAxisColorByLineHeight+Z.yAxisColorByLineStrokeWidth).attr("text-anchor","middle").attr("fill","currentColor").text("(".concat(i.attribute,")"))}}))}(lt.current,m),function(t,e){(0,C.Z)(t).selectAll(".".concat(I.rawMeasurements)).style("stroke",(function(t){return e[t.strain].color})).style("stroke-width",Z.circleStrokeWidth).style("fill",(function(t){return(0,s.m6)(e[t.strain].color)}))}(lt.current,m),function(t,e,r,n){var o=e.groupedMeasurements,a=(0,C.Z)(t);o.forEach((function(t){var e=P(t,2),o=(e[0],e[1]),i={};o.forEach((function(t){var e=r[t.strain].attribute;i[e]=i[e]||[],i[e].push(V(t))}));var l=2*(Object.keys(i).length-1)*Z.circleRadius,u=Z.subplotHeight-2*Z.subplotPadding-l,c=Z.subplotPadding;Object.keys(i).sort((function(t,e){return n.indexOf(t)-n.indexOf(e)})).forEach((function(t){var e=i[t],r=e.length/o.length,n=c+r*u;e.forEach((function(t){var e=Math.random()*(n-c)+c;a.select("#".concat(t)).attr("cy",e)})),c=n+2*Z.circleRadius}))}))}(lt.current,bt,m,g),function(t,e,r,n){var a=e.xScale,i=e.groupingOrderedValues,l=e.groupedMeasurements,u=(0,C.Z)(t);u.selectAll(".".concat(I.colorMean)).remove(),l.forEach((function(t){var e=P(t,2),l=e[0],c=e[1],s={};c.forEach((function(t){var e=r[t.strain],n=e.attribute,o=e.color;s[n]=s[n]||{color:null,values:[]},s[n].values.push(t.value),s[n].color||(s[n].color=o)}));var f=u.select("#".concat(_(i.indexOf(l)))),d=Object.keys(s).length,y=(Z.subplotHeight-4*Z.subplotPadding)/(d-1),p=Z.subplotPadding;o()(Object.keys(s),(function(t){return n.indexOf(t)}),"asc").forEach((function(t){var e=s[t],r=e.color,n=e.values;D(n,f,I.colorMean,{attribute:t,color:r},a,p),(p+=y)>Z.overallMeanYValue-Z.subplotPadding&&p<Z.overallMeanYValue+Z.subplotPadding&&(p=Z.overallMeanYValue+Z.subplotPadding)}))}))}(lt.current,bt,m,g),function(t,e,r){(0,C.Z)(t).selectAll(".".concat(I.rawMeasurements,",.").concat(I.mean,",.").concat(I.standardDeviation)).on("mouseover.hoverPanel",(function(t,n,o){var a,i=E.B.clientX,l=E.B.clientY,u=o[n].getAttribute("class")===I.rawMeasurements?"measurement":"mean",c=t.colorByAttr;"measurement"===u&&(c=(null===(a=r[t.strain])||void 0===a?void 0:a.attribute)||"undefined"),e(t,i,l,c)})).on("mouseout.hoverPanel",(function(){return e(null)}))}(lt.current,wt,m)}),[bt,m,g,wt]),(0,l.useEffect)((function(){!function(t,e){var r=(0,C.Z)(t),n={raw:I.rawMeasurementsGroup,mean:I.colorMean};Object.entries(n).forEach((function(t){var n=P(t,2),o=n[0],a=n[1];r.selectAll(".".concat(a)).attr("display",e===o?null:"none")}))}(lt.current,J)}),[bt,m,g,wt,J]),(0,l.useEffect)((function(){L(lt.current,"overallMean",K)}),[bt,K]),(0,l.useEffect)((function(){L(lt.current,"threshold",q)}),[bt,q]),(0,l.useEffect)((function(){var t,e;(0,W.o6)(S)?(t=lt.current,e=B,Y(t),(0,C.Z)(t).selectAll(".".concat(I.yAxis)).select(".tick").each((function(t,r,n){var o=(0,C.Z)(n[r]),a=o.select(".".concat(I.groupingValue)).text();if(e===a){var i=o.node().getBoundingClientRect().width;o.append("svg").attr("id",F).attr("stroke","currentColor").attr("fill","currentColor").attr("strokeWidth","0").attr("viewBox","0 0 256 256").attr("height",2*Z.yAxisColorByLineHeight).attr("width",2*Z.yAxisColorByLineHeight).attr("x",-i-2*Z.yAxisColorByLineHeight).attr("y",-Z.yAxisColorByLineHeight).append("path").attr("d","M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm12,191.13V184a12,12,0,0,0-24,0v27.13A84.18,84.18,0,0,1,44.87,140H72a12,12,0,0,0,0-24H44.87A84.18,84.18,0,0,1,116,44.87V72a12,12,0,0,0,24,0V44.87A84.18,84.18,0,0,1,211.13,116H184a12,12,0,0,0,0,24h27.13A84.18,84.18,0,0,1,140,211.13Z")}}))):Y(lt.current)}),[bt,S,B]);var St=function(){return{width:"100%",height:Z.xAxisHeight,position:"sticky",zIndex:99}};return l.createElement(l.Fragment,null,n&&l.createElement(d.Z,null,l.createElement(h.Z,{right:!0,width:r})),l.createElement("div",{id:T,ref:it,style:{overflowY:"auto",position:"relative",height:e,width:r}},st&&l.createElement(w,{hoverData:st}),l.createElement("svg",{id:"d3MeasurementsXAxisSVG",ref:ut,style:St()}),l.createElement("svg",{id:"d3MeasurementsSVG",ref:lt,style:{width:"100%",position:"relative",bottom:"".concat(St().height,"px")}})))};const K=function(t){var e=t.height,r=t.width,n=t.showLegend,o=(0,u.v9)((function(t){return t.measurements.loaded})),a=(0,u.v9)((function(t){return t.measurements.error})),i=(0,u.v9)((function(t){return t.controls.showOnlyPanels})),c=X((0,l.useState)("Measurements"),2),s=c[0],f=c[1];return l.createElement(p.Z,{infocard:i,title:s,titleStyles:{width:r,display:"block",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}},o?l.createElement(J,{height:e,width:r,showLegend:n,setPanelTitle:f}):l.createElement(y.Z,{style:{height:e,width:r},direction:"column",justifyContent:"center"},l.createElement("p",{style:{textAlign:"center"}},a||"Failed to fetch/load measurements due to unknown error")))}}}]);