1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7578b90f-2d51-4dca-9f5f-417e940ad1d7",e._sentryDebugIdIdentifier="sentry-dbid-7578b90f-2d51-4dca-9f5f-417e940ad1d7")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4578],{15532:function(e,n,t){"use strict";let r;t.d(n,{Z:function(){return a}});var s,o=t(36559),i=t.n(o),l=t(34155),a=i()({formatters:{level:(e,n)=>({level:e}),bindings:e=>({})},level:null!==(s=l.env.LOGGER_LEVEL)&&void 0!==s?s:"silent",timestamp:i().stdTimeFunctions.isoTime,transport:r})},60517:function(e,n,t){"use strict";var r=t(85893),s=(t(67294),t(45697)),o=t.n(s),i=t(14104);function l(e){return(0,r.jsxs)("div",{children:[!!e.message&&(0,r.jsx)(i.Z,{color:"textSecondary",variant:e.variant,children:e.message}),!1]})}t(63644),o().shape({message:o().node,stack:o().string}),l.propTypes={error:o().shape({message:o().string,stack:o().string}),message:o().node,variant:o().string},l.defaultProps={message:"Sorry, something went wrong. Please try again later",variant:"h5"},n.Z=l},71570:function(e,n,t){"use strict";var r=t(85893);t(67294);var s=t(45697),o=t.n(s),i=t(79334),l=t(14104),a=t(47432),u=t.n(a);function c(e){return(0,r.jsxs)(i.Z,{className:u().root,children:[!!e.title&&(0,r.jsx)(l.Z,{component:"h1",variant:"h4",children:e.title}),!!e.subtitle&&(0,r.jsx)(l.Z,{component:"h1",variant:"h5",children:e.subt
1itle}),e.children]})}c.propTypes={title:o().string,subtitle:o().string,children:o().node},n.Z=c},64985:function(e,n,t){"use strict";var r=t(85893);t(67294);var s=t(45697),o=t.n(s),i=t(36118),l=t(19529),a=t.n(l);function u(e){return(0,r.jsxs)("a",{href:e.href,rel:"noopener noreferrer",target:"_blank",className:e.className,title:e.title,children:[e.children,(0,r.jsx)(i.Z,{fontSize:"inherit",className:a().icon})]})}u.propTypes={children:o().node.isRequired,className:o().string,title:o().string,href:o().string.isRequired},n.Z=u},98384:function(e,n,t){"use strict";var r=t(85893);t(67294);var s=t(9008),o=t.n(s);n.Z=function(e){let{pageTitle:n}=e;return(0,r.jsx)(o(),{children:(0,r.jsx)("title",{children:n&&""!==n?"Pathogenwatch | ".concat(n):"Pathogenwatch"})})}},91190:function(e,n,t){"use strict";var r=t(85893);t(67294);var s=t(42741),o=t.n(s);n.Z=function(){return(0,r.jsx)("span",{className:o().root})}},33971:function(e,n,t){"use strict";var r=t(85893);t(67294);var s=t(45697),o=t.n(s),i=t(74333),l=t(40645),a=t(82580);function u(e){let n=(0,i.Z)();return(0,r.jsx)(l.Z,{open:e.isLoading,sx:{zIndex:n.zIndex.modal},children:(0,r.jsx)(a.Z,{size:60,color:"secondary"})})}u.propTypes={isLoading:o().bool},n.Z=u},72594:function(e,n,t){"use strict";t.d(n,{Z:function(){return c}});var r=t(85893),s=t(67294),o=t(45697),i=t.n(o),l=t(79334),a=t(19088);function u(e){let n="clipboard"in navigator,{id:t}=e,o=s.useMemo(()=>(0,r.jsxs)(s.Fragment,{children:[(0,r.jsx)(l.Z,{children:"Novel ST"})," ",(0,r.jsx)(l.Z,{children:t})," ",(0,r.jsx)(l.Z,{children:n?"(Click to copy)":""})]}),[t,n]),[i,u]=s.useState(!1),[c,d]=s.useState(o);if(s.useEffect(()=>{if(!i)return;let e=setTimeout(()=>d(o));return()=>clearTimeout(e)},[i,o]),!n)return null;if(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return 40===e.length}(e.id)){var h;return(0,r.jsx)(a.Z,{title:c,onClose:()=>{u(!1)},onOpen:()=>{u(!0)},onClick:n=>{n.stopPropagation(),n.preventDefault(),navigator.clipboard.writeText(e.id).then(()=>{d("Copied to clipboard!")}).catch(e=>{console.error(e),d("Failed to copy to clipboard.")})},style:{cursor:"help"},slotProps:{popper:{style:{textAlign:"center"}}},children:(h=e.id,"*".concat(h.substring(0,4)))})}return(0,r.jsx)("span",{className:"wgsa-mlst-st",children:e.id})}u.propTypes={id:i().string};var c=u},82324:function(e,n,t){"use strict";var r=t(85893);t(67294);var s=t(45697),o=t.n(s),i=t(14104),l=t(45075),a=t(52276),u=t.n(a);let c={icon:(0,r.jsx)(l.Z,{})};function d(e){let n={...c,...e};return(0,r.jsxs)("div",{className:u().root,children:[(0,r.jsx)("div",{className:u().icon,children:n.icon}),(0,r.jsxs)(i.Z,{variant:"h5",color:"textSecondary",children:[n.message,n.children]})]})}d.propTypes={icon:o().node,message:o().node,children:o().node},n.Z=d},68488:function(e,n,t){"use strict";t.d(n,{Z:function(){return j}});var r=t(85893),s=t(67294),o=t(45697),i=t.n(o),l=t(5152),a=t.n(l),u=t(83840),c=t(4298),d=t.n(c),h=t(79334);let p={0:"#673c90",1:"#b199c7"};p[-1]="#9eb8c0";let g={0:"#9a6fc3",1:"#e3dbeb"};g[-1]="#dae4e7";var f=t(35562),m=t.n(f);let v={iterationsPerRender:100,worker:!0,barnesHutOptimize:!1},x={edgeColor:"default",labelColor:"node",labelThreshold:0,hideEdgesOnMove:!0},b=a()(()=>Promise.all([t.e(7141),t.e(9511),t.e(1923)]).then(t.bind(t,1923)),{loadableGenerated:{webpack:()=>[1923]},ssr:!1});function y(e){var n;let{isDisplayChart:t,isShowLabel:o,clusters:i,startLayout:l,stopLayout:a}=e,{nodes:c,genomeIdx:f,edges:y}=i||{},[j,C]=s.useState(!1),[Z,_]=s.useState({}),[k,R]=s.useState(!1),[E,S]=s.useState(!1),T=s.useMemo(()=>Math.min(Math.max(1e3,((null==y?void 0:y.length)||0)/5),1e4),[null==y?void 0:y.length]),L=s.useMemo(()=>{var n;let t={};for(let r of(null===(n=e.clusters)||void 0===n?void 0:n.genomes)||[])t[r.id]=r.uuid;return t},[null===(n=e.clusters)||void 0===n?void 0:n.genomes]),w=s.useMemo(()=>t?function(e,n,t,r,s){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[],i=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},l=Object.keys(n),a=(null==l?void 0:l.length)||0;if(0===a)return{nodes:[],edges:[]};let u=Object.values(n),c=function(e){if(e)return e.map(e=>0===e.ids.length?"Unnamed":1===e.ids.length?e.label:2===e.ids.length?"".concat(e.label," and one other"):"".concat(e.label," and ").concat(e.ids.length-1," others"))}(u);if(1===a||!(null==r?void 0:r.length)){let e=l[0];return{nodes:[{label:c[0],_label:c[0],color:p[0],genomeIds:n[e].ids,id:e,size:1,style:{colour:p[0],shape:"circle"},zIndex:0,x:0,y:0}],edges:[]}}let d=function(e,n){if(!(null==n?void 0:n.length))return;let t=[],r=0;for(let e=0;r<n.length;e++){let s={neighbours:[],explored:!1,degrees:3};t.push(s);for(let o=0;o<e;o++){let e=t[o];n[r]&&(s.neighbours.push(e),e.neighbours.push(s)),r+=1}}let s=[t[e]];for(let e=0;e<3;e++){let n=[];for(let t of s)t.explored||(n=[...n,...t.neighbours],t.degrees=e,t.explored=!0);s=n}return t.map(e=>e.degrees)}(t,r),h=d?d.map(e=>p[e]||p[-1]):[p[0]],f=function(e){let n=e.map(e=>e.length**.3),t=Math.min(...n),r=Math.max(...n)-t;return 0===r?n.map(()=>.5):n.map(e=>.5+(e-t)/r)}(u.map(e=>e.ids)),m=function(e){if(!e)return;let n=[];for(let t=1;t<e.length;t++)for(let r=0;r<t;r++){let s=Math.min(e[t],e[r]);n.push(s)}return n}(d),v=d?d.map(e=>g[e]||g[-1]):void 0;
1return function(e){let{coordinates:n,degrees:t,edgeColors:r,edgeDegrees:s,edgesMatrix:o,genomeIdx:i,isShowLabel:l,labels:a,nodeColors:u,nodeData:c,numberOfNodes:d,sizes:h,sts:p,selection:g,idToUuid:f}=e,m=[],v=[],x=0;for(let e=0;e<d;e++){let b=l&&e===i,y=p[e];m.push(function(e){let{coordinates:n,degrees:t,i:r,id:s,labels:o,nodeColors:i,nodeData:l,numberOfNodes:a,showLabel:u,sizes:c,selection:d,idToUuid:h}=e,p=new Set(d);return{label:u?o[r]:void 0,color:u?i[r]:void 0,hoverLabel:u?void 0:o[r],id:s,genomeIds:l[s].ids,size:c[r],style:{colour:i[r],shape:"circle"},zIndex:t[r],x:s in n?n[s].x:Math.cos(2*r*Math.PI/a),y:s in n?n[s].y:Math.sin(2*r*Math.PI/a),isHighlighted:l[s].ids.some(e=>p.has(h[e]))}}({coordinates:n,degrees:t,i:e,id:y,labels:a,nodeColors:u,nodeData:c,numberOfNodes:d,showLabel:b,sizes:h,selection:g,idToUuid:f}));for(let n=0;n<e;n++)o[x]&&v.push(function(e){let{edgeColors:n,edgeDegrees:t,i:r,idx:s,j:o,sts:i}=e;return{id:"e".concat(s),source:i[o],target:i[r],style:{colour:n[s]},zIndex:t[s]}}({edgeColors:r,edgeDegrees:s,i:e,idx:x,j:n,sts:p})),x+=1}return m.sort((e,n)=>n.zIndex-e.zIndex),v.sort((e,n)=>n.zIndex-e.zIndex),{nodes:m,edges:v}}({coordinates:s,degrees:d,edgeColors:v,edgeDegrees:m,edgesMatrix:r,genomeIdx:t,isShowLabel:e,labels:c,nodeColors:h,nodeData:n,numberOfNodes:a,sizes:f,sts:l,selection:o,idToUuid:i})}(o,c,f,y,Z,e.selection,L):null,[y,f,t,o,Z,c,e.selection,L]),N=s.useCallback(()=>{C(e=>!e)},[C]),O=s.useCallback(()=>{_({}),l()},[_,l]),q=s.useCallback(e=>{_(e),a()},[_,a]);(0,s.useEffect)(()=>{let e;return E||(e=setInterval(()=>{window.sigma&&(R(!0),clearInterval(e))},100)),()=>e&&clearInterval(e)},[R,E]);let A={opacity:e.isShowLabel?1:.3},I=e.isDisplayChart&&E;return(0,r.jsxs)(h.Z,{className:(0,u.Z)([m().root,e.className]),children:[!!e.chartMessage&&(0,r.jsx)(h.Z,{position:"absolute",children:e.chartMessage}),(0,r.jsx)(d(),{src:"//cdnjs.cloudflare.com/ajax/libs/sigma.js/1.2.1/sigma.min.js"}),k&&(0,r.jsx)(d(),{src:"//cdnjs.cloudflare.com/ajax/libs/sigma.js/1.2.1/plugins/sigma.layout.forceAtlas2.min.js",onReady:()=>S(!0)}),I&&(0,r.jsx)(b,{controlsVisible:j,graph:w,layoutDuration:T,layoutSettings:v,onLayoutChange:q,onLayoutStart:O,onShuffleNodes:e.onShuffleNodes,recomputeLayout:e.isRecomputeLayout,settings:x,style:A,toggleControls:N})]})}y.propTypes={chartMessage:i().node,className:i().string,clusters:i().shape({nodes:i().object,edges:i().array,genomeIdx:i().number,threshold:i().number,thresholds:i().array,isStale:i().bool}),isDisplayChart:i().bool,isRecomputeLayout:i().bool,isShowLabel:i().bool,onShuffleNodes:i().func.isRequired,startLayout:i().func.isRequired,stopLayout:i().func.isRequired,selection:i().array};var j=y},14500:function(e,n,t){"use strict";t.d(n,{Z:function(){return eI}});var r=t(85893),s=t(67294),o=t(45697),i=t.n(o),l=t(49770),a=t(58340),u=t(41762),c=t(67965),d=t(17082),h=t(44749),p=t(53529),g=t(39085),f=t(58400),m=t(14104),v=t(16829),x=t(79334),b=t(39915),y=t.n(b);function j(e){return(0,r.jsx)(p.Z,{className:y()["top-bar"],onClick:e=>e.stopPropagation(),children:(0,r.jsxs)(f.Z,{variant:"dense",className:y().toolbar,children:[(0,r.jsx)(x.Z,{className:y()["top-bar-item"],children:e.prependComponents}),(0,r.jsx)(x.Z,{className:y()["top-bar-item"],children:(0,r.jsx)(m.Z,{className:y().heading,component:"h2",children:e.heading})}),(0,r.jsx)(x.Z,{className:y()["top-bar-item"],children:(0,r.jsx)(g.Z,{"aria-label":"close",color:"inherit",edge:"start",onClick:e.handleClose,title:"Close",children:(0,r.jsx)(v.Z,{})})})]})})}j.propTypes={prependComponents:i().node,handleClose:i().func.isRequired,heading:i().node.isRequired};let C=s.forwardRef((e,n)=>(0,r.jsx)(h.Z,{ref:n,...e}));function Z(e){return(0,r.jsx)(d.Z,{className:y().content,children:e.children})}function _(e){let n=()=>{e.onClose()};return(0,r.jsxs)(c.Z,{className:y().root,fullScreen:!0,onClick:n,onClose:n,open:e.isOpen,scroll:"paper",TransitionComponent:C,children:[(0,r.jsx)(j,{heading:e.heading,handleClose:n,prependComponents:e.prependTopBar}),e.children]})}C.displayName="ModalTransition",Z.propTypes={children:i().node},_.Content=Z,_.propTypes={children:i().node,heading:i().node.isRequired,isOpen:i().bool.isRequired,onClose:i().func.isRequired,prependTopBar:i().node};var k=t(27471),R=t(14918),E=t(58963),S=t(51373),T=t(29743),L=t.n(T);function w(e){return(0,r.jsx)(R.ZP,{className:L()["side-nav-item"],disablePadding:!0,children:(0,r.jsx)(E.Z,{onClick:e.handleClick,children:(0,r.jsx)(S.Z,{primary:e.linkText})})})}function N(e){return(0,r.jsx)("nav",{"aria-label":"Jump to section",className:L()["side-nav"],onClick:e=>{e.stopPropagation()},children:(0,r.jsx)(k.Z,{children:e.sections.map((n,t)=>(0,r.jsx)(w,{handleClick:()=>(t?e.itemRefs.current[n]:e.topRef.current).scrollIntoView({behavior:"smooth"}),linkText:n},n))})})}function O(e){let n=(0,s.useRef)();return(0,r.jsx)(_,{heading:e.heading,isOpen:e.isOpen,onClose:e.onClose,children:(0,r.jsxs)(_.Content,{children:[(0,r.jsx)(N,{itemRefs:e.itemRefs,sections:e.sections,topRef:n}),(0,r.jsx)(u.Z,{className:L().document,component:"aside",onClick:e=>{e.stopPropagation()},ref:n,children:e.children})]})})}w.propTypes={linkText:i().string.isRequired,handleClick:i().func.isRequired},N.propTypes={itemRefs:i().shape({current:i().array}
1),sections:i().arrayOf(i().string).isRequired,topRef:i().object.isRequired},O.propTypes={children:i().node,isOpen:i().bool.isRequired,itemRefs:i().shape({current:i().array}),onClose:i().func.isRequired,sections:i().arrayOf(i().string.isRequired).isRequired,heading:i().node.isRequired};var q=t(60517);function A(e){return(0,r.jsx)(c.Z,{onClose:e.onClose,open:e.isOpen,children:(0,r.jsx)(x.Z,{padding:5,children:(0,r.jsx)(q.Z,{error:e.error,message:e.message})})})}A.propTypes={onClose:i().func.isRequired,isOpen:i().bool.isRequired,message:i().node,error:i().shape({message:i().string,stack:i().string})};var I=t(33971),M=t(89065),P=t(64985),D=t(33299),U=t(9665),z=t(44334),F=t(95591),B=t(30092),G=t(18257),W=t(50778),H=t(68488),V=t(99598),Y=t(96939),X=t(91190);function K(e){return e.statusMessage?(0,r.jsxs)(m.Z,{variant:"body2",children:[e.statusMessage,(0,r.jsx)(X.Z,{})]}):e.isComplete?(0,r.jsxs)(m.Z,{variant:"body2",children:["Cluster of"," ",e.genomeCount," ","at threshold of"," ",e.currentThreshold]}):void 0}K.propTypes={statusMessage:i().string,currentThreshold:i().number,genomeCount:i().number,isComplete:i().bool};var Q=t(61682),J=t(99495),$=t.n(J);function ee(e){return(0,r.jsx)(x.Z,{children:(0,r.jsxs)(x.Z,{className:$().actions,children:[e.isClusterEnabled&&"authenticated"===e.sessionStatus&&(0,r.jsx)(B.Z,{onClick:e.handleRecluster,variant:"outlined",children:"Re-Cluster"}),e.isClusterEnabled&&"unauthenticated"===e.sessionStatus&&(0,r.jsx)(B.Z,{variant:"text",onClick:()=>(0,D.signIn)(void 0,{callbackUrl:window.location}),children:"sign in to recluster"}),(0,r.jsx)(Q.C,{href:"/clustering/".concat(e.genomeUuid,"?threshold=").concat(e.threshold),children:(0,r.jsx)(B.Z,{variant:"contained",children:"View Cluster"})})]})})}ee.propTypes={isClusterEnabled:i().bool,genomeUuid:i().string.isRequired,handleRecluster:i().func.isRequired,threshold:i().number.isRequired,sessionStatus:i().string};var en=t(30084),et=t.n(en);function er(e){return(0,r.jsx)(x.Z,{ref:e.setRef||null,className:et().root,children:e.children})}er.propTypes={children:i().node.isRequired,setRef:i().func.isRequired};var es=t(57686),eo=t.n(es);function ei(e){return e.message?(0,r.jsx)(x.Z,{className:eo().root,children:(0,r.jsxs)(m.Z,{variant:"h6",children:[e.message,(0,r.jsx)(X.Z,{})]})}):null}ei.propTypes={message:i().string};var el=t(27673),ea=t.n(el);function eu(e){return(0,r.jsxs)(x.Z,{className:ea().root,children:[(0,r.jsx)(m.Z,{variant:"h6",align:"left",children:e.children}),!e.nextSteps&&(0,r.jsx)(m.Z,{variant:"h6",align:"left",children:"Please try again later"}),e.nextSteps&&(0,r.jsx)(x.Z,{marginTop:2,children:e.nextSteps})]})}eu.propTypes={children:i().node.isRequired,nextSteps:i().bool},eu.defaultProps={nextSteps:null};let ec={initial:"initial",clustering:"clustering",updating:"updating",clusteringError:"clusteringError",reclustering:"reclustering",reclusteringError:"reclusteringError",completedLayout:"completedLayout",runningLayout:"runningLayout",computeLayout:"computeLayout",shuffleLayout:"shuffleLayout",unclustered:"unclustered",unsupported:"unsupported"},ed={[ec.initial]:"Checking status",[ec.clustering]:"Checking status",[ec.reclustering]:"Clustering genomes"},eh={[ec.updating]:"Fetching cluster",[ec.runningLayout]:"Rendering cluster",[ec.computeLayout]:"Rendering cluster",[ec.shuffleLayout]:"Rendering cluster"},ep=[ec.completedLayout,ec.clusteringError,ec.reclusteringError],eg=[ec.completedLayout,ec.runningLayout,ec.computeLayout],ef=(e,n,t)=>e?"/api/genomes/cluster/details?id=".concat(n).concat(void 0!==t?"&threshold=".concat(t):""):null;function em(e){var n;let{genomeUuid:t}=e,o=(0,D.useSession)(),[i,l]=(0,s.useState)(ec.initial),[u,c]=(0,s.useState)(),[d,h]=(0,s.use
1State)(),{isIntersecting:p}=(0,U.Z)(d),[g,f]=(0,s.useState)(!1),[v,b]=(0,s.useState)(null),{data:y,error:j,isLoading:C,isValidating:Z,mutate:_}=(0,F.ZP)(ef(g,t,u),a.Z,{keepPreviousData:!0,revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1,onSuccess:()=>{b(null)}}),{error:k,isMutating:R,trigger:E}=(0,z.Z)("/api/genomes/cluster/recluster",a.C,{onSuccess:e=>{"READY"===e.status?(l(ec.clustering),_()):e.submission?(b(e.submission),l(ec.reclustering)):l(ec.reclusteringError)}});(0,s.useEffect)(()=>{p&&!g&&f(!0)},[p,g]),(0,s.useEffect)(()=>{j||i===ec.clusteringError||(null==y?void 0:y.status)==="FAILED"?l(ec.clusteringError):k?l(ec.reclusteringError||i===ec.reclusteringError):C&&(null==y?void 0:y.status)!=="READY"&&(null==y?void 0:y.status)!=="STALE"?l(ec.clustering):Z&&((null==y?void 0:y.status)==="READY"||(null==y?void 0:y.status)==="STALE")?l(ec.updating):Z?l(ec.reclustering):R||v?l(ec.reclustering):i!==ec.reclustering&&(null==y?void 0:y.status)==="UNCLUSTERED"?l(ec.unclustered):i!==ec.reclustering&&(null==y?void 0:y.status)==="UNSUPPORTED"?l(ec.unsupported):!eg.includes(i)&&y&&l(ec.computeLayout)},[y,j,t,C,Z,R,i,E,k,v,l]);let S=(0,s.useCallback)(async e=>{"SUBMITTED"===e?l(ec.reclustering):"COMPLETED"===e?(l(ec.clustering),_()):("FAILED"===e||"ERRORED"===e)&&(console.error("submission failed with id ".concat(v)),l(ec.reclusteringError))},[_,v,l]),T=(0,s.useCallback)(async e=>{if(v&&e.id!==v){console.info({currentId:v,receievedId:e.id},"Received event relates to different cluster");return}v&&await S(e.status)},[v,S]);(0,G.Z)("private-channel-pw-genome-".concat(t),"submission-event",T),(0,W.Z)(v||null,S);let L=(0,s.useCallback)(()=>{l(ec.runningLayout)},[l]),w=(0,s.useCallback)(()=>{l(ec.completedLayout)},[l]),N=(0,s.useCallback)(async()=>{l(ec.reclustering),await E({id:t})},[t,l,E]),O=(0,s.useCallback)(()=>{l(ec.shuffleLayout)},[l]),q=async e=>{c(()=>e),l(ec.updating)};if(j)return(0,r.jsx)(er,{children:(0,r.jsx)(eu,{children:"We're sorry, something went wrong fetching the cluster."})});if(k)return(0,r.jsx)(er,{children:(0,r.jsx)(eu,{children:"We're sorry, something went wrong reclustering"})});if(i===ec.unclustered)return(0,r.jsx)(er,{children:(0,r.jsx)(eu,{nextSteps:(0,r.jsxs)(s.Fragment,{children:["authenticated"===o.status&&(0,r.jsx)(B.Z,{variant:"contained",onClick:N,children:"Run clustering"}),"unauthenticated"===o.status&&(0,r.jsxs)(x.Z,{textAlign:"center",children:[(0,r.jsx)(m.Z,{mb:2,children:"You need to sign in to run clustering"}),(0,r.jsx)(V.Z,{})]})]}),children:"Clusters have not been calculated for this genome"})});if(i===ec.unsupported)return(0,r.jsx)(er,{children:(0,r.jsx)(eu,{children:"We're sorry, clusteing is not available for this organism"})});let A=null!=u?u:null==y?void 0:y.threshold;return(0,r.jsxs)(er,{setRef:h,children:[(0,r.jsx)(ei,{message:ed[i]}),(0,r.jsx)(H.Z,{chartMessage:(0,r.jsx)(K,{statusMessage:eh[i],clusters:y,currentThreshold:A,genomeCount:null==y?void 0:y.thresholds[A],isComplete:i===ec.completedLayout}),clusters:y,isDisplayChart:eg.includes(i),isRecomputeLayout:i===ec.computeLayout||i===ec.shuffleNodes,isShowLabel:i===ec.completedLayout,onShuffleNodes:O,startLayout:L,stopLayout:w}),!ed[i]&&(null==y?void 0:null===(n=y.thresholds)||void 0===n?void 0:n.length)&&(0,r.jsx)(Y.Z,{threshold:A,thresholds:null==y?void 0:y.thresholds,updateThreshold:q,isClickable:ep.includes(i)}),!ed[i]&&(0,r.jsx)(ee,{genomeUuid:e.genomeUuid,handleRecluster:N,isClusterEnabled:(null==y?void 0:y.status)==="STALE",sessionStatus:o.status,threshold:A})]})}em.propTypes={genomeUuid:i().string};var ev=t(72594),ex=t(55247),eb=t.n(ex);function ey(e){var n;return e&&"object"==typeof e?(null===(n=e.properties)||void 0===n?void 0:n.dataIsHiddenLive)?null:e.children?{...e,children:e.children.map(ey).filter(Boolean)}:e:e}function ej(e){let{genomeUuid:n}=e,t=s.useCallback(()=>(0,r.jsx)(em,{genomeUuid:n}),[n]),o=s.useCallback(e=>{let{children:n}=e;return(0,r.jsx)(ev.Z,{id:n})},[]),i={a:P.Z,clustering:t,st:o},l=e.reportAST.map(ey).filter(Boolean).map(e=>(0,M.v)(e,{Fragment:r.Fragment,jsx:r.jsx,jsxs:r.jsxs,components:i}));return(0,r.jsx)("div",{className:eb().root,children:s.Children.map(l,n=>s.cloneElement(n,{ref:t=>{let r=n.props["data-label"];n.props["data-label"]&&(e.itemRefs.current[r]=t)}}))})}ej.propTypes={genomeUuid:i().string,reportAST:i().array.isRequired,itemRefs:i().shape({current:i().array})};var eC=t(33729),eZ=t.n(eC),e_=t(64407),ek=t(53539),eR=t(54115),eE=t(27228),eS=t(44442),eT=t(43786),eL=t(23260),ew=t(55311);function eN(e){let[n,t]=s.useState(null),o=(0,eS.Z)(),i=e=>{var n;null==e||null===(n=e.stopPropagation)||void 0===n||n.call(e),t(null)};return(0,r.jsxs)(s.Fragment,{children:[(0,r.jsx)(B.Z,{variant:"outlined",color:"inherit",size:"small",startIcon:(0,r.jsx)(e_.Z,{}),onClick:e=>{e.stopPropagation(),t(e.currentTarget)},children:"Download"}),(0,r.jsxs)(ek.Z,{anchorEl:n,open:!!n,slotProps:{paper:{sx:{minWidth:null==n?void 0:n.offsetWidth}}},onClose:i,onClick:e=>e.stopPropagation(),children:[o.includes(eE.Z.DOWNLOAD_GENOME_FASTA)&&(0,r.jsx)(eR.Z,{component:"a",href:"/api/genomes/download/".concat(e.genomeUuid),target:"_blank",rel:"noreferrer",onClick:i,children:"FASTA"}),(0,r.jsx)(eR.Z,{component:"a",href:"/api/genomes/pdf/".concat(e.genomeUuid),target:"_blank",rel:"noreferrer",onClick:i,children:"PDF"}),(0,r.jsx)(eR.Z,{onClick:n=>{n.stopPropagation(),eZ()(function(e){if(!e)return"";let n=(0,eT.C)({type:"root",children:e});return(0,eL.x)(n,{extensions:[(0,ew.E)()]})}(e.genomeReport.reportAST),"".concat(e.genomeReport.name,".md"),"text/markdown"),i(n)},children:"Markdown"})]})]})}eN.propTypes={genomeReport:i().object.isRequired,genomeUuid:i().string.isRequired};var eO=t(84844),eq=t.n(eO);function eA(e){let[n,t]=s.useState(!1);s.useEffect(()=>{t(!0)},[]);let{data:o,error:i,isLoading:u}=(0,l.Z)("/api/genomes/report?id=".concat(e.genomeUuid),a.Z),c=s.useRef([]);return n?i?(0,r.jsx)(A,{isOpen:!0,onClose:e.onClose,error:i,message:"Sorry, there was a problem loading this genome. Please try again later"}):u?(0,r.jsx)(I.Z,{isLoading:!0}):o.reportAST.length?(0,r.jsx)(O,{isOpen:!!e.genomeUuid,isLoading:!0,itemRefs:c,onClose:e.onClose,sections:o.reportAST.map(e=>
1e.properties.dataLabel).filter(Boolean),heading:(0,r.jsxs)(s.Fragment,{children:[(0,r.jsxs)("div",{className:eq().title,children:["Genome report: \xa0",o.name]}),(0,r.jsx)(eN,{genomeReport:o,genomeUuid:e.genomeUuid})]}),children:(0,r.jsx)("div",{className:eq().report,children:(0,r.jsx)(ej,{reportAST:o.reportAST,itemRefs:c,genomeUuid:e.genomeUuid})})}):(0,r.jsx)(A,{isOpen:!0,onClose:e.onClose,message:(0,r.jsxs)(s.Fragment,{children:[(0,r.jsx)("div",{children:"Sorry, this report isn't ready yet."}),(0,r.jsx)("div",{children:"Please check back later"})]})}):null}eA.propTypes={genomeUuid:i().string.isRequired,onClose:i().func.isRequired};var eI=eA},8768:function(e,n,t){"use strict";t.d(n,{Z:function(){return o}});var r=t(67294),s=()=>{let[e,n]=(0,r.useState)(()=>window.location.hash),t=(0,r.useCallback)(()=>{n(window.location.hash)},[]);(0,r.useEffect)(()=>(window.addEventListener("hashchange",t),()=>{window.removeEventListener("hashchange",t)}),[t]);let s=(0,r.useCallback)(n=>{n!==e&&(window.location.hash=n)},[e]);return[e,s]},o=()=>{let[e,n]=s(),[t,r=""]=e.split("#"),[o,i]=r.split("&genomeId=");return[i,e=>n("".concat(o,"&genomeId=").concat(e)),()=>n(o)]}},99598:function(e,n,t){"use strict";var r=t(85893);t(67294);var s=t(33299),o=t(30092);n.Z=function(){return(0,r.jsx)(o.Z,{variant:"contained",onClick:()=>(0,s.signIn)(void 0,{callbackUrl:window.location}),children:"Sign in"})}},96939:function(e,n,t){"use strict";t.d(n,{Z:function(){return C}});var r=t(85893),s=t(67294),o=t(45697),i=t.n(o),l=t(83840),a=t(81636),u=t(45085),c=t(79334),d=t(28586),h=t(14104),p=t(23148),g=t(26495),f=t(1022);function m(e){let{backgroundColors:n,hoverBackgroundColors:t,labelCallback:o,labels:i,onClick:l,values:a}=e,[u,c]=(0,f.Z)(),d=(0,s.useMemo)(()=>({labels:i,datasets:[{data:a,label:"",backgroundColor:n,hoverBackgroundColor:t}]}),[n,t,i,a]),h=(0,s.useMemo)(()=>({responsive:!0,maintainAspectRatio:!1,animation:!0,interaction:{mode:"nearest",intersect:!0},scales:{x:{barPercentage:1,categoryPercentage:.9,padding:1,position:"bottom",beginAtZero:!0,grid:{display:!0,drawTicks:!0,drawOnChartArea:!1,offset:!0},ticks:{autoSkip:!1,callback:(e,n)=>n%5==0||0===n||n===a.length-1?e:""}},y:{min:0,max:a[a.length-1],type:"logarithmic",ticks:{beginAtZero:!0,display:!1},grid:{display:!1,drawTicks:!1}}},plugins:{legend:{display:!1},tooltip:{enabled:!!o,displayColors:!1,mode:"nearest",intersect:!0,callbacks:{title:()=>null,label:o||null}},datalabels:{display:!1}},onClick:(e,n)=>{if(n.length>0){let t=n[0].index;l(e,{label:i[t],value:a[t]})}}}),[a,i,l,o]),p=(0,s.useMemo)(()=>"".concat(u,"x").concat(c),[u,c]);return(0,r.jsx)(g.$Q,{style:{cursor:"pointer"},data:d,options:h},p)}p.kL.register(p.vn,p.ZL,p.uw,p.WV,p.od,p.u),m.propTypes={backgroundColors:i().array.isRequired,hoverBackgroundColors:i().array.isRequired,labelCallback:i().func.isRequired,labels:i().array.isRequired,onClick:i().func.isRequired,values:i().array.isRequired};let v={disabled:"#ccc",active:"#b199c7",hover:"#673c90"};var x=t(59556),b=t.n(x);let y=e=>"Cluster of ".concat(e.formattedValue," at threshold of ").concat(e.label);function j(e){let{threshold:n,thresholds:t,updateThreshold:o,isClickable:i}
1=e,[p,g]=(0,s.useState)(null),[f,x]=(0,s.useState)(null),j=(0,s.useCallback)((e,n)=>{let{label:r}=n;i&&(t[r]>a.Z.thresholdLimit?(g(()=>e.native.target),x("This cluster is too large to display, please select a lower threshold.")):o(r))},[i,o,t]),C=e.thresholds.map((e,n)=>n),Z=(0,s.useMemo)(()=>(function(e,n,t){let r={backgroundColor:[],hoverBackgroundColor:[]};return e.forEach(e=>{if(t[e]>a.Z.thresholdLimit)r.backgroundColor.push(v.disabled),r.hoverBackgroundColor.push(v.disabled);else{let t=e===n?v.hover:v.active;r.backgroundColor.push(t),r.hoverBackgroundColor.push(v.hover)}}),r})(C,n,t),[C,n,t]);if(!e.thresholds)return null;let _=!!p,k=()=>{g(null)};return(0,r.jsxs)(c.Z,{className:(0,l.Z)({[b().disabled]:!i}),children:[(0,r.jsx)(h.Z,{color:"textSecondary",variant:"body2",marginY:1,visibility:i?"visible":"hidden",children:e.message||"Pick a threshold by clicking on the chart below"}),(0,r.jsx)(c.Z,{height:"".concat(e.height||110,"px"),children:(0,r.jsx)(m,{width:584,height:e.height||110,labels:C,values:e.thresholds,onClick:j,labelCallback:y,backgroundColors:Z.backgroundColor,hoverBackgroundColors:Z.hoverBackgroundColor})}),(0,r.jsx)(d.ZP,{id:_?"cluster-limit-popover":void 0,open:_,anchorEl:p,onClose:k,anchorOrigin:{vertical:"center",horizontal:"center"},transformOrigin:{vertical:"center",horizontal:"center"},children:(0,r.jsx)(u.Z,{severity:"info",onClose:k,children:(0,r.jsx)(h.Z,{variant:"body2",children:f})})})]})}j.propTypes={isClickable:i().bool.isRequired,threshold:i().number.isRequired,thresholds:i().array.isRequired,updateThreshold:i().func.isRequired,message:i().string,height:i().number};var C=j},27228:function(e,n){"use strict";n.Z={COLLECTION_DOWNLOADS:"COLLECTION_DOWNLOADS",CONTEXT_GENOME_CLUSTERING:"CONTEXT_GENOME_CLUSTERING",DOWNLOAD_GENOME_FASTA:"DOWNLOAD_GENOME_FASTA",SHARE_COLLECTIONS:"SHARE_COLLECTIONS",UPLOAD_GENOMES:"UPLOAD_GENOMES"}},58340:function(e,n,t){"use strict";t.d(n,{C:function(){return o}});var r=t(15532);
1async function s(e,n){let t=await fetch(e,n);if(r.Z.debug({url:e,args:n},"fetching data"),!t.ok){let e=Error("An error occurred while fetching the data.");throw e.statusCode=t.status,e.statusMessage=t.statusText,e.url=t.url,r.Z.error(e),e}return t.json()}async function o(e,n){let{arg:t}=n;return s(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}n.Z=s},50778:function(e,n,t){"use strict";t.d(n,{Z:function(){return i}});var r=t(67294),s=t(95591),o=t(58340);function i(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{data:i}=(0,s.ZP)(e?"/api/submissions/status?id=".concat(e):null,o.Z,t);return(0,r.useEffect)(()=>{i&&n&&n(i)},[n,i]),i}},44442:function(e,n,t){"use strict";var r=t(33299);n.Z=function(e){let{data:n,status:t}=(0,r.useSession)({required:e});return{isLoading:"loading"===t,isSignedIn:"authenticated"===t,isSignedOut:"unauthenticated"===t,user:null==n?void 0:n.user,organisation:null==n?void 0:n.organisation,permissions:null==n?void 0:n.permissions,signIn:e=>{null==e||e.preventDefault(),(0,r.signIn)(void 0,{callbackUrl:window.location})},includes:e=>{var t;return(null==n?void 0:null===(t=n.permissions)||void 0===t?void 0:t[e])===!0},excludes:e=>{var t;return(null==n?void 0:null===(t=n.permissions)||void 0===t?void 0:t[e])===!1}}}},1022:function(e,n,t){"use strict";t.d(n,{Z:function(){return o}});var r=t(38824),s=t(67294);function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500,[n,t]=(0,s.useState)(()=>[window.innerWidth,window.innerHeight]),o=(0,s.useCallback)(()=>(0,r.Z)(()=>t([window.innerWidth,window.innerHeight]),e)(),[t,e]);return(0,s.useEffect)(()=>(window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o)}),[o]),(0,s.useEffect)(()=>{o()},[o]),n}},18257:function(e,n,t){"use strict";let r;t.d(n,{Z:function(){return c}});var s=t(67294),o=t(33299),i=t(86606),l=t.n(i),a=t(81636),u=t(34155);l().logToConsole=u.env.PUSHER_LOGGER;var c=function(e,n,t){let{status:i}=(0,o.useSession)();(0,s.useEffect)(()=>{let s;let o=(r||(r=new(l())(a.Z.pusherAppKey,{cluster:a.Z.pusherCluster,authEndpoint:"/api/pusher/auth"})),r);return e&&"authenticated"===i&&(s=o.subscribe(e)).bind(n,t),()=>{null==s||s.unbind(n),o.unsubscribe(e)}},[e,t,n,i])}},63644:function(e){e.exports={"error-message":"display-error_error-message__AqiXB","error-stack":"display-error_error-stack__gsmqb"}},29743:function(e){e.exports={root:"document-viewer_root__kgp0n","side-nav":"document-viewer_side-nav__aKpuQ","side-nav-item":"document-viewer_side-nav-item__PHrEn",document:"document-viewer_document__qAY8R"}},47432:function(e){e.exports={root:"error-page_root__MnLVu"}},19529:function(e){e.exports={icon:"external-link_icon__zj5ft"}},42741:function(e){e.exports={root:"loading-ellipsis_root__XfmFb",loading:"loading-ellipsis_loading__lbyvB"}},39915:function(e){e.exports={root:"modal_root__efr5d",toolbar:"modal_toolbar__Vxcaj","top-bar":"modal_top-bar__s9Rj1","top-bar-item":"modal_top-bar-item__v4GSO",heading:"modal_heading__yhEk4",content:"modal_content__7Q993"}},52276:function(e){e.exports={root:"ui-empty-state_root__DL9wQ",icon:"ui-empty-state_icon__xK3LF"}},35562:function(e){e.exports={root:"cluster-chart_root__XnH3F"}},57686:function(e){e.exports={root:"cluster-status_root__q9brl"}},99495:function(e){e.exports={actions:"clustering-actions_actions__DAWou"}},30084:function(e){e.exports={root:"clustering-container_root__qgJW0"}},27673:function(e){e.exports={root:"error-state_root__R81d3"}},55247:function(e){e.exports={root:"report-builder_root__b_dgz"}},84844:function(e){e.exports={report:"genome-report_report__ddz7e",section:"genome-report_section__MC_T8",title:"genome-report_title__CKCB9"}},59556:function(e){e.exports={disabled:"threshold-chart_disabled__3TOqZ"}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.