auspice
Version:
Web app for visualizing pathogen evolution
2 lines • 496 kB
JavaScript
/*! For license information please see auspice.chunk.mainComponent.bundle.d7e23fce8147e4085be0.js.LICENSE.txt */
(self.webpackChunkauspice=self.webpackChunkauspice||[]).push([[29],{75941(e,t,n){"use strict";n.d(t,{A:()=>f});var r=n(40378),o=n.n(r),i=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function a(e){var t={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(o()[n[1]]||"/"===e.charAt(e.length-2))&&(t.voidElement=!0),t.name.startsWith("!--"))){var r=e.indexOf("--\x3e");return{type:"comment",comment:-1!==r?e.slice(4,r):""}}for(var a=new RegExp(i),l=null;null!==(l=a.exec(e));)if(l[0].trim())if(l[1]){var s=l[1].trim(),c=[s,""];s.indexOf("=")>-1&&(c=s.split("=")),t.attrs[c[0]]=c[1],a.lastIndex--}else l[2]&&(t.attrs[l[2]]=l[3].trim().substring(1,l[3].length-1));return t}var l=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,s=/^\s*$/,c=Object.create(null);function u(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(u,"")+"</"+t.name+">";case"comment":return e+"\x3c!--"+t.comment+"--\x3e"}}var p={parse:function(e,t){t||(t={}),t.components||(t.components=c);var n,r=[],o=[],i=-1,u=!1;if(0!==e.indexOf("<")){var p=e.indexOf("<");r.push({type:"text",content:-1===p?e:e.substring(0,p)})}return e.replace(l,function(l,c){if(u){if(l!=="</"+n.name+">")return;u=!1}var p,f="/"!==l.charAt(1),d=l.startsWith("\x3c!--"),h=c+l.length,m=e.charAt(h);if(d){var y=a(l);return i<0?(r.push(y),r):((p=o[i]).children.push(y),r)}if(f&&(i++,"tag"===(n=a(l)).type&&t.components[n.name]&&(n.type="component",u=!0),n.voidElement||u||!m||"<"===m||n.children.push({type:"text",content:e.slice(h,e.indexOf("<",h))}),0===i&&r.push(n),(p=o[i-1])&&p.children.push(n),o[i]=n),(!f||n.voidElement)&&(i>-1&&(n.voidElement||n.name===l.slice(2,-1))&&(i--,n=-1===i?r:o[i]),!u&&"<"!==m&&m)){p=-1===i?r:o[i].children;var v=e.indexOf("<",h),g=e.slice(h,-1===v?void 0:v);s.test(g)&&(g=" "),(v>-1&&i+p.length>=0||" "!==g)&&p.push({type:"text",content:g})}}),r},stringify:function(e){return e.reduce(function(e,t){return e+u("",t)},"")}};const f=p},67016(e,t){var n,r;function o(e){return o="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},o(e)}n=function e(){"use strict";var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{},n=!t.document&&!!t.postMessage,r=n&&/blob:/i.test((t.location||{}).protocol),i={},a=0,l={parse:function(n,r){var o=(r=r||{}).dynamicTyping||!1;if(x(o)&&(r.dynamicTypingFunction=o,o={}),r.dynamicTyping=o,r.transform=!!x(r.transform)&&r.transform,r.worker&&l.WORKERS_SUPPORTED){var s=function(){if(!l.WORKERS_SUPPORTED)return!1;var n,r,o=(n=t.URL||t.webkitURL||null,r=e.toString(),l.BLOB_URL||(l.BLOB_URL=n.createObjectURL(new Blob(["(",r,")();"],{type:"text/javascript"})))),s=new t.Worker(o);return s.onmessage=v,s.id=a++,i[s.id]=s}();return s.userStep=r.step,s.userChunk=r.chunk,s.userComplete=r.complete,s.userError=r.error,r.step=x(r.step),r.chunk=x(r.chunk),r.complete=x(r.complete),r.error=x(r.error),delete r.worker,void s.postMessage({input:n,config:r,workerId:s.id})}var c=null;return l.NODE_STREAM_INPUT,"string"==typeof n?c=r.download?new u(r):new f(r):!0===n.readable&&x(n.read)&&x(n.on)?c=new d(r):(t.File&&n instanceof File||n instanceof Object)&&(c=new p(r)),c.stream(n)},unparse:function(e,t){var n=!1,r=!0,i=",",a="\r\n",s='"',c=s+s,u=!1,p=null,f=!1;!function(){if("object"==o(t)){if("string"!=typeof t.delimiter||l.BAD_DELIMITERS.filter(function(e){return-1!==t.delimiter.indexOf(e)}).length||(i=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(n=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(u=t.skipEmptyLines),"string"==typeof t.newline&&(a=t.newline),"string"==typeof t.quoteChar&&(s=t.quoteChar),"boolean"==typeof t.header&&(r=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");p=t.columns}void 0!==t.escapeChar&&(c=t.escapeChar+s),"boolean"==typeof t.escapeFormulae&&(f=t.escapeFormulae)}}();var d=new RegExp(m(s),"g");if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return h(null,e,u);if("object"==o(e[0]))return h(p||Object.keys(e[0]),e,u)}else if("object"==o(e))return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==o(e.data[0])?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==o(e.data[0])||(e.data=[e.data])),h(e.fields||[],e.data||[],u);throw new Error("Unable to serialize unrecognized input");function h(e,t,n){var o="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var l=Array.isArray(e)&&0<e.length,s=!Array.isArray(t[0]);if(l&&r){for(var c=0;c<e.length;c++)0<c&&(o+=i),o+=y(e[c],c);0<t.length&&(o+=a)}for(var u=0;u<t.length;u++){var p=l?e.length:t[u].length,f=!1,d=l?0===Object.keys(t[u]).length:0===t[u].length;if(n&&!l&&(f="greedy"===n?""===t[u].join("").trim():1===t[u].length&&0===t[u][0].length),"greedy"===n&&l){for(var h=[],m=0;m<p;m++){var v=s?e[m]:m;h.push(t[u][v])}f=""===h.join("").trim()}if(!f){for(var g=0;g<p;g++){0<g&&!d&&(o+=i);var b=l&&s?e[g]:g;o+=y(t[u][b],g)}u<t.length-1&&(!n||0<p&&!d)&&(o+=a)}}return o}function y(e,t){if(null==e)return"";if(e.constructor===Date)return JSON.stringify(e).slice(1,25);!0===f&&"string"==typeof e&&null!==e.match(/^[=+\-@].*$/)&&(e="'"+e);var r=e.toString().replace(d,c),o="boolean"==typeof n&&n||"function"==typeof n&&n(e,t)||Array.isArray(n)&&n[t]||function(e,t){for(var n=0;n<t.length;n++)if(-1<e.indexOf(t[n]))return!0;return!1}(r,l.BAD_DELIMITERS)||-1<r.indexOf(i)||" "===r.charAt(0)||" "===r.charAt(r.length-1);return o?s+r+s:r}}};if(l.RECORD_SEP=String.fromCharCode(30),l.UNIT_SEP=String.fromCharCode(31),l.BYTE_ORDER_MARK="\ufeff",l.BAD_DELIMITERS=["\r","\n",'"',l.BYTE_ORDER_MARK],l.WORKERS_SUPPORTED=!n&&!!t.Worker,l.NODE_STREAM_INPUT=1,l.LocalChunkSize=10485760,l.RemoteChunkSize=5242880,l.DefaultDelimiter=",",l.Parser=y,l.ParserHandle=h,l.NetworkStreamer=u,l.FileStreamer=p,l.StringStreamer=f,l.ReadableStreamStreamer=d,t.jQuery){var s=t.jQuery;s.fn.parse=function(e){var n=e.config||{},r=[];return this.each(function(e){if("INPUT"!==s(this).prop("tagName").toUpperCase()||"file"!==s(this).attr("type").toLowerCase()||!t.FileReader||!this.files||0===this.files.length)return!0;for(var o=0;o<this.files.length;o++)r.push({file:this.files[o],inputElem:this,instanceConfig:s.extend({},n)})}),i(),this;function i(){if(0!==r.length){var t,n,i,c=r[0];if(x(e.before)){var u=e.before(c.file,c.inputElem);if("object"==o(u)){if("abort"===u.action)return t=c.file,n=c.inputElem,i=u.reason,void(x(e.error)&&e.error({name:"AbortError"},t,n,i));if("skip"===u.action)return void a();"object"==o(u.config)&&(c.instanceConfig=s.extend(c.instanceConfig,u.config))}else if("skip"===u)return void a()}var p=c.instanceConfig.complete;c.instanceConfig.complete=function(e){x(p)&&p(e,c.file,c.inputElem),a()},l.parse(c.file,c.instanceConfig)}else x(e.complete)&&e.complete()}function a(){r.splice(0,1),i()}}}function c(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=w(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new h(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,n){if(this.isFirstChunk&&x(this._config.beforeFirstChunk)){var o=this._config.beforeFirstChunk(e);void 0!==o&&(e=o)}this.isFirstChunk=!1,this._halted=!1;var i=this._partialLine+e;this._partialLine="";var a=this._handle.parse(i,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var s=a.meta.cursor;this._finished||(this._partialLine=i.substring(s-this._baseIndex),this._baseIndex=s),a&&a.data&&(this._rowCount+=a.data.length);var c=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(r)t.postMessage({results:a,workerId:l.WORKER_ID,finished:c});else if(x(this._config.chunk)&&!n){if(this._config.chunk(a,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);a=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(a.data),this._completeResults.errors=this._completeResults.errors.concat(a.errors),this._completeResults.meta=a.meta),this._completed||!c||!x(this._config.complete)||a&&a.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),c||a&&a.meta.paused||this._nextChunk(),a}this._halted=!0},this._sendError=function(e){x(this._config.error)?this._config.error(e):r&&this._config.error&&t.postMessage({workerId:l.WORKER_ID,error:e,finished:!1})}}function u(e){var t;(e=e||{}).chunkSize||(e.chunkSize=l.RemoteChunkSize),c.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=S(this._chunkLoaded,this),t.onerror=S(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var r in e)t.setRequestHeader(r,e[r])}if(this._config.chunkSize){var o=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+o)}try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:t.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(e){var t=e.getResponseHeader("Content-Range");return null===t?-1:parseInt(t.substring(t.lastIndexOf("/")+1))}(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){var n=t.statusText||e;this._sendError(new Error(n))}}function p(e){var t,n;(e=e||{}).chunkSize||(e.chunkSize=l.LocalChunkSize),c.call(this,e);var r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=S(this._chunkLoaded,this),t.onerror=S(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input;if(this._config.chunkSize){var o=Math.min(this._start+this._config.chunkSize,this._input.size);e=n.call(e,this._start,o)}var i=t.readAsText(e,this._config.encoding);r||this._chunkLoaded({target:{result:i}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function f(e){var t;c.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e,n=this._config.chunkSize;return n?(e=t.substring(0,n),t=t.substring(n)):(e=t,t=""),this._finished=!t,this.parseChunk(e)}}}function d(e){c.call(this,e=e||{});var t=[],n=!0,r=!1;this.pause=function(){c.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){c.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):n=!0},this._streamData=S(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),n&&(n=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=S(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=S(function(){this._streamCleanUp(),r=!0,this._streamData("")},this),this._streamCleanUp=S(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function h(e){var t,n,r,o=Math.pow(2,53),i=-o,a=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,s=/^(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))$/,c=this,u=0,p=0,f=!1,d=!1,h=[],v={data:[],errors:[],meta:{}};if(x(e.step)){var g=e.step;e.step=function(t){if(v=t,E())S();else{if(S(),0===v.data.length)return;u+=t.data.length,e.preview&&u>e.preview?n.abort():(v.data=v.data[0],g(v,c))}}}function b(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function S(){if(v&&r&&(C("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+l.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines)for(var t=0;t<v.data.length;t++)b(v.data[t])&&v.data.splice(t--,1);return E()&&function(){if(v)if(Array.isArray(v.data[0])){for(var t=0;E()&&t<v.data.length;t++)v.data[t].forEach(n);v.data.splice(0,1)}else v.data.forEach(n);function n(t,n){x(e.transformHeader)&&(t=e.transformHeader(t,n)),h.push(t)}}(),function(){if(!v||!e.header&&!e.dynamicTyping&&!e.transform)return v;function t(t,n){var r,o=e.header?{}:[];for(r=0;r<t.length;r++){var i=r,a=t[r];e.header&&(i=r>=h.length?"__parsed_extra":h[r]),e.transform&&(a=e.transform(a,i)),a=O(i,a),"__parsed_extra"===i?(o[i]=o[i]||[],o[i].push(a)):o[i]=a}return e.header&&(r>h.length?C("FieldMismatch","TooManyFields","Too many fields: expected "+h.length+" fields but parsed "+r,p+n):r<h.length&&C("FieldMismatch","TooFewFields","Too few fields: expected "+h.length+" fields but parsed "+r,p+n)),o}var n=1;return!v.data.length||Array.isArray(v.data[0])?(v.data=v.data.map(t),n=v.data.length):v.data=t(v.data,0),e.header&&v.meta&&(v.meta.fields=h),p+=n,v}()}function E(){return e.header&&0===h.length}function O(t,n){return r=t,e.dynamicTypingFunction&&void 0===e.dynamicTyping[r]&&(e.dynamicTyping[r]=e.dynamicTypingFunction(r)),!0===(e.dynamicTyping[r]||e.dynamicTyping)?"true"===n||"TRUE"===n||"false"!==n&&"FALSE"!==n&&(function(e){if(a.test(e)){var t=parseFloat(e);if(i<t&&t<o)return!0}return!1}(n)?parseFloat(n):s.test(n)?new Date(n):""===n?null:n):n;var r}function C(e,t,n,r){var o={type:e,code:t,message:n};void 0!==r&&(o.row=r),v.errors.push(o)}this.parse=function(o,i,a){var s=e.quoteChar||'"';if(e.newline||(e.newline=function(e,t){e=e.substring(0,1048576);var n=new RegExp(m(t)+"([^]*?)"+m(t),"gm"),r=(e=e.replace(n,"")).split("\r"),o=e.split("\n"),i=1<o.length&&o[0].length<r[0].length;if(1===r.length||i)return"\n";for(var a=0,l=0;l<r.length;l++)"\n"===r[l][0]&&a++;return a>=r.length/2?"\r\n":"\r"}(o,s)),r=!1,e.delimiter)x(e.delimiter)&&(e.delimiter=e.delimiter(o),v.meta.delimiter=e.delimiter);else{var c=function(t,n,r,o,i){var a,s,c,u;i=i||[",","\t","|",";",l.RECORD_SEP,l.UNIT_SEP];for(var p=0;p<i.length;p++){var f=i[p],d=0,h=0,m=0;c=void 0;for(var v=new y({comments:o,delimiter:f,newline:n,preview:10}).parse(t),g=0;g<v.data.length;g++)if(r&&b(v.data[g]))m++;else{var w=v.data[g].length;h+=w,void 0!==c?0<w&&(d+=Math.abs(w-c),c=w):c=w}0<v.data.length&&(h/=v.data.length-m),(void 0===s||d<=s)&&(void 0===u||u<h)&&1.99<h&&(s=d,a=f,u=h)}return{successful:!!(e.delimiter=a),bestDelimiter:a}}(o,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);c.successful?e.delimiter=c.bestDelimiter:(r=!0,e.delimiter=l.DefaultDelimiter),v.meta.delimiter=e.delimiter}var u=w(e);return e.preview&&e.header&&u.preview++,t=o,n=new y(u),v=n.parse(t,i,a),S(),f?{meta:{paused:!0}}:v||{meta:{paused:!1}}},this.paused=function(){return f},this.pause=function(){f=!0,n.abort(),t=x(e.chunk)?"":t.substring(n.getCharIndex())},this.resume=function(){c.streamer._halted?(f=!1,c.streamer.parseChunk(t,!0)):setTimeout(c.resume,3)},this.aborted=function(){return d},this.abort=function(){d=!0,n.abort(),v.meta.aborted=!0,x(e.complete)&&e.complete(v),t=""}}function m(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function y(e){var t,n=(e=e||{}).delimiter,r=e.newline,o=e.comments,i=e.step,a=e.preview,s=e.fastMode,c=t=void 0===e.quoteChar?'"':e.quoteChar;if(void 0!==e.escapeChar&&(c=e.escapeChar),("string"!=typeof n||-1<l.BAD_DELIMITERS.indexOf(n))&&(n=","),o===n)throw new Error("Comment character same as delimiter");!0===o?o="#":("string"!=typeof o||-1<l.BAD_DELIMITERS.indexOf(o))&&(o=!1),"\n"!==r&&"\r"!==r&&"\r\n"!==r&&(r="\n");var u=0,p=!1;this.parse=function(e,l,f){if("string"!=typeof e)throw new Error("Input must be a string");var d=e.length,h=n.length,y=r.length,v=o.length,g=x(i),b=[],w=[],S=[],E=u=0;if(!e)return D();if(s||!1!==s&&-1===e.indexOf(t)){for(var O=e.split(r),C=0;C<O.length;C++){if(S=O[C],u+=S.length,C!==O.length-1)u+=r.length;else if(f)return D();if(!o||S.substring(0,v)!==o){if(g){if(b=[],I(S.split(n)),L(),p)return D()}else I(S.split(n));if(a&&a<=C)return b=b.slice(0,a),D(!0)}}return D()}for(var T=e.indexOf(n,u),_=e.indexOf(r,u),k=new RegExp(m(c)+m(t),"g"),j=e.indexOf(t,u);;)if(e[u]!==t)if(o&&0===S.length&&e.substring(u,u+v)===o){if(-1===_)return D();u=_+y,_=e.indexOf(r,u),T=e.indexOf(n,u)}else if(-1!==T&&(T<_||-1===_))S.push(e.substring(u,T)),u=T+h,T=e.indexOf(n,u);else{if(-1===_)break;if(S.push(e.substring(u,_)),N(_+y),g&&(L(),p))return D();if(a&&b.length>=a)return D(!0)}else for(j=u,u++;;){if(-1===(j=e.indexOf(t,j+1)))return f||w.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:b.length,index:u}),R();if(j===d-1)return R(e.substring(u,j).replace(k,t));if(t!==c||e[j+1]!==c){if(t===c||0===j||e[j-1]!==c){-1!==T&&T<j+1&&(T=e.indexOf(n,j+1)),-1!==_&&_<j+1&&(_=e.indexOf(r,j+1));var P=M(-1===_?T:Math.min(T,_));if(e[j+1+P]===n){S.push(e.substring(u,j).replace(k,t)),e[u=j+1+P+h]!==t&&(j=e.indexOf(t,u)),T=e.indexOf(n,u),_=e.indexOf(r,u);break}var A=M(_);if(e.substring(j+1+A,j+1+A+y)===r){if(S.push(e.substring(u,j).replace(k,t)),N(j+1+A+y),T=e.indexOf(n,u),j=e.indexOf(t,u),g&&(L(),p))return D();if(a&&b.length>=a)return D(!0);break}w.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:b.length,index:u}),j++}}else j++}return R();function I(e){b.push(e),E=u}function M(t){var n=0;if(-1!==t){var r=e.substring(j+1,t);r&&""===r.trim()&&(n=r.length)}return n}function R(t){return f||(void 0===t&&(t=e.substring(u)),S.push(t),u=d,I(S),g&&L()),D()}function N(t){u=t,I(S),S=[],_=e.indexOf(r,u)}function D(e){return{data:b,errors:w,meta:{delimiter:n,linebreak:r,aborted:p,truncated:!!e,cursor:E+(l||0)}}}function L(){i(D()),b=[],w=[]}},this.abort=function(){p=!0},this.getCharIndex=function(){return u}}function v(e){var t=e.data,n=i[t.workerId],r=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var o={abort:function(){r=!0,g(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:b,resume:b};if(x(n.userStep)){for(var a=0;a<t.results.data.length&&(n.userStep({data:t.results.data[a],errors:t.results.errors,meta:t.results.meta},o),!r);a++);delete t.results}else x(n.userChunk)&&(n.userChunk(t.results,o,t.file),delete t.results)}t.finished&&!r&&g(t.workerId,t.results)}function g(e,t){var n=i[e];x(n.userComplete)&&n.userComplete(t),n.terminate(),delete i[e]}function b(){throw new Error("Not implemented.")}function w(e){if("object"!=o(e)||null===e)return e;var t=Array.isArray(e)?[]:{};for(var n in e)t[n]=w(e[n]);return t}function S(e,t){return function(){e.apply(t,arguments)}}function x(e){return"function"==typeof e}return r&&(t.onmessage=function(e){var n=e.data;if(void 0===l.WORKER_ID&&n&&(l.WORKER_ID=n.workerId),"string"==typeof n.input)t.postMessage({workerId:l.WORKER_ID,results:l.parse(n.input,n.config),finished:!0});else if(t.File&&n.input instanceof File||n.input instanceof Object){var r=l.parse(n.input,n.config);r&&t.postMessage({workerId:l.WORKER_ID,results:r,finished:!0})}}),(u.prototype=Object.create(c.prototype)).constructor=u,(p.prototype=Object.create(c.prototype)).constructor=p,(f.prototype=Object.create(f.prototype)).constructor=f,(d.prototype=Object.create(c.prototype)).constructor=d,l},void 0===(r=n.apply(t,[]))||(e.exports=r)},75805(e,t,n){var r,o,i,a;function l(e){return l="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},l(e)}e=n.nmd(e),a=function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==l(e)&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t,n){e.exports=n(2)()},function(t,n){t.exports=e},function(e,t,n){"use strict";var r=n(3);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,a){if(a!==r){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";n.r(t);var r=n(1),o=n.n(r),i=n(0),a=n.n(i),s=function(e){return 0!==e};function c(e){return(c="function"==typeof Symbol&&"symbol"==l(Symbol.iterator)?function(e){return l(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":l(e)})(e)}function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(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(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&&p(e,t)}(r,e);var t,n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=d(e);if(t){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){return!t||"object"!==c(t)&&"function"!=typeof t?f(e):t}(this,n)}}(r);function r(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),h(f(t=n.call(this,e)),"continueOpenCollapsible",function(){var e=f(t).innerRef;t.setState({height:e.scrollHeight,transition:"height ".concat(t.props.transitionTime,"ms ").concat(t.props.easing),isClosed:!1,hasBeenOpened:!0,inTransition:s(e.scrollHeight),shouldOpenOnNextCycle:!1})}),h(f(t),"handleTriggerClick",function(e){t.props.triggerDisabled||t.state.inTransition||(e.preventDefault(),t.props.handleTriggerClick?t.props.handleTriggerClick(t.props.accordionPosition):!0===t.state.isClosed?(t.openCollapsible(),t.props.onOpening(),t.props.onTriggerOpening()):(t.closeCollapsible(),t.props.onClosing(),t.props.onTriggerClosing()))}),h(f(t),"handleTransitionEnd",function(e){e.target===t.innerRef&&(t.state.isClosed?(t.setState({inTransition:!1}),t.props.onClose()):(t.setState({height:"auto",overflow:t.props.overflowWhenOpen,inTransition:!1}),t.props.onOpen()))}),h(f(t),"setInnerRef",function(e){return t.innerRef=e}),t.timeout=void 0,t.contentId="collapsible-content-".concat(Date.now()),t.triggerId=e.triggerElementProps.id||"collapsible-trigger-".concat(Date.now()),e.open?t.state={isClosed:!1,shouldSwitchAutoOnNextCycle:!1,height:"auto",transition:"none",hasBeenOpened:!0,overflow:e.overflowWhenOpen,inTransition:!1}:t.state={isClosed:!0,shouldSwitchAutoOnNextCycle:!1,height:0,transition:"height ".concat(e.transitionTime,"ms ").concat(e.easing),hasBeenOpened:!1,overflow:"hidden",inTransition:!1},t}return(t=[{key:"componentDidUpdate",value:function(e,t){var n=this;this.state.shouldOpenOnNextCycle&&this.continueOpenCollapsible(),"auto"!==t.height&&0!==t.height||!0!==this.state.shouldSwitchAutoOnNextCycle||(window.clearTimeout(this.timeout),this.timeout=window.setTimeout(function(){n.setState({height:0,overflow:"hidden",isClosed:!0,shouldSwitchAutoOnNextCycle:!1})},50)),e.open!==this.props.open&&(!0===this.props.open?(this.openCollapsible(),this.props.onOpening()):(this.closeCollapsible(),this.props.onClosing()))}},{key:"componentWillUnmount",value:function(){window.clearTimeout(this.timeout)}},{key:"closeCollapsible",value:function(){var e=this.innerRef;this.setState({shouldSwitchAutoOnNextCycle:!0,height:e.scrollHeight,transition:"height ".concat(this.props.transitionCloseTime?this.props.transitionCloseTime:this.props.transitionTime,"ms ").concat(this.props.easing),inTransition:s(e.scrollHeight)})}},{key:"openCollapsible",value:function(){this.setState({inTransition:s(this.innerRef.scrollHeight),shouldOpenOnNextCycle:!0})}},{key:"renderNonClickableTriggerElement",value:function(){return this.props.triggerSibling&&"string"==typeof this.props.triggerSibling?o.a.createElement("span",{className:"".concat(this.props.classParentString,"__trigger-sibling")},this.props.triggerSibling):this.props.triggerSibling&&"function"==typeof this.props.triggerSibling?this.props.triggerSibling():this.props.triggerSibling?o.a.createElement(this.props.triggerSibling,null):null}},{key:"render",value:function(){var e=this,t={height:this.state.height,WebkitTransition:this.state.transition,msTransition:this.state.transition,transition:this.state.transition,overflow:this.state.overflow},n=this.state.isClosed?"is-closed":"is-open",r=this.props.triggerDisabled?"is-disabled":"",i=!1===this.state.isClosed&&void 0!==this.props.triggerWhenOpen?this.props.triggerWhenOpen:this.props.trigger,a=this.props.contentContainerTagName,l=this.props.triggerTagName,s=this.props.lazyRender&&!this.state.hasBeenOpened&&this.state.isClosed&&!this.state.inTransition?null:this.props.children,c=this.props,p=c.classParentString,f=c.contentOuterClassName,d=c.contentInnerClassName,h="".concat(p,"__trigger ").concat(n," ").concat(r," ").concat(this.state.isClosed?this.props.triggerClassName:this.props.triggerOpenedClassName),m="".concat(p," ").concat(this.state.isClosed?this.props.className:this.props.openedClassName),y="".concat(p,"__contentOuter ").concat(f),v="".concat(p,"__contentInner ").concat(d);return o.a.createElement(a,u({className:m.trim()},this.props.containerElementProps),o.a.createElement(l,u({id:this.triggerId,className:h.trim(),onClick:this.handleTriggerClick,style:this.props.triggerStyle&&this.props.triggerStyle,onKeyPress:function(t){var n=t.key;(" "===n&&"button"!==e.props.triggerTagName.toLowerCase()||"Enter"===n)&&e.handleTriggerClick(t)},tabIndex:this.props.tabIndex&&this.props.tabIndex,"aria-expanded":!this.state.isClosed,"aria-disabled":this.props.triggerDisabled,"aria-controls":this.contentId,role:"button"},this.props.triggerElementProps),i),this.renderNonClickableTriggerElement(),o.a.createElement("div",{id:this.contentId,className:y.trim(),style:t,onTransitionEnd:this.handleTransitionEnd,ref:this.setInnerRef,hidden:this.props.contentHiddenWhenClosed&&this.state.isClosed&&!this.state.inTransition,role:"region","aria-labelledby":this.triggerId},o.a.createElement("div",{className:v.trim()},s)))}}])&&function(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)}}(r.prototype,t),r}(r.Component);m.propTypes={transitionTime:a.a.number,transitionCloseTime:a.a.number,triggerTagName:a.a.string,easing:a.a.string,open:a.a.bool,containerElementProps:a.a.object,triggerElementProps:a.a.object,classParentString:a.a.string,className:a.a.string,openedClassName:a.a.string,triggerStyle:a.a.object,triggerClassName:a.a.string,triggerOpenedClassName:a.a.string,contentOuterClassName:a.a.string,contentInnerClassName:a.a.string,accordionPosition:a.a.oneOfType([a.a.string,a.a.number]),handleTriggerClick:a.a.func,onOpen:a.a.func,onClose:a.a.func,onOpening:a.a.func,onClosing:a.a.func,onTriggerOpening:a.a.func,onTriggerClosing:a.a.func,trigger:a.a.oneOfType([a.a.string,a.a.element]),triggerWhenOpen:a.a.oneOfType([a.a.string,a.a.element]),triggerDisabled:a.a.bool,lazyRender:a.a.bool,overflowWhenOpen:a.a.oneOf(["hidden","visible","auto","scroll","inherit","initial","unset"]),contentHiddenWhenClosed:a.a.bool,triggerSibling:a.a.oneOfType([a.a.element,a.a.func]),tabIndex:a.a.number,contentContainerTagName:a.a.string,children:a.a.oneOfType([a.a.string,a.a.element])},m.defaultProps={transitionTime:400,transitionCloseTime:null,triggerTagName:"span",easing:"linear",open:!1,classParentString:"Collapsible",triggerDisabled:!1,lazyRender:!1,overflowWhenOpen:"hidden",contentHiddenWhenClosed:!1,openedClassName:"",triggerStyle:null,triggerClassName:"",triggerOpenedClassName:"",contentOuterClassName:"",contentInnerClassName:"",className:"",triggerSibling:null,onOpen:function(){},onClose:function(){},onOpening:function(){},onClosing:function(){},onTriggerOpening:function(){},onTriggerClosing:function(){},tabIndex:null,contentContainerTagName:"div",triggerElementProps:{}},t.default=m}])},"object"==l(t)&&"object"==l(e)?e.exports=a(n(78281)):(o=[n(78281)],void 0===(i="function"==typeof(r=a)?r.apply(t,o):r)||(e.exports=i))},40378(e){e.exports={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}},8791(e,t,n){"use strict";n.d(t,{Ay:()=>E,DC:()=>_,gd:()=>O});var r=n(78281),o=n(49633),i=n(98807),a=n(28355),l=n(51914),s=n.n(l),c=n(41930),u=n(51924),p=n(60516),f=n(5300);function d(e){return d="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},d(e)}function h(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(e)||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.")}()}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||y(e,t)||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 y(e,t){if(e){if("string"==typeof e)return v(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function g(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 b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?g(Object(n),!0).forEach(function(t){w(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function w(e,t,n){return(t=function(e){var t=function(e){if("object"!=d(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=d(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==d(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e){return e.map(function(e,t){return b(b({},e),{},{id:t})})}function x(e){return e.map(function(e){return delete e.id,e})}function E(e){var t=e.dismissModal,n=(0,i.B)().t,a=(0,o.wA)(),l=(0,o.d4)(function(e){return e.metadata});if(!l.loaded)throw new Error("[INTERNAL ERROR] metadata state not loaded");var c=l.legendPlacements,d=m((0,r.useState)(S(l.maintainers||[])),2),h=d[0],y=d[1],v=m((0,r.useState)(S(l.dataProvenance||[])),2),g=v[0],b=v[1],w=(0,r.useRef)(null);return(0,r.useEffect)(function(){return s().bind("enter",function(){var e;null===(e=w.current)||void 0===e||e.requestSubmit()}),s().bind("escape",function(){t()}),function(){s().unbind("enter"),s().unbind("escape")}},[t]),r.createElement(f.EJ,{ref:w,onSubmit:function(e){e.preventDefault();var n=Object.fromEntries(Object.keys(c).map(function(t){return[t,(n=e.target["".concat(t,"Legend")].value,r=m(n.split(" "),2),o=r[0],i=r[1],function(e){switch(e){case"top":case"bottom":return;default:throw new Error("Invalid vertical string ".concat(e))}}(o),function(e){switch(e){case"left":case"right":return;default:throw new Error("Invalid horizontal string ".concat(e))}}(i),{vertical:o,horizontal:i})];var n,r,o,i}));a((0,u.D)({edited:!0,title:e.currentTarget.datasetTitle.value,updated:e.currentTarget.updated.value,buildUrl:e.currentTarget.buildUrl.value,buildAvatar:e.currentTarget.avatarUrl.value.trim()||void 0,warning:e.currentTarget.warning.value.trim()||void 0,description:e.currentTarget.description.value,maintainers:x(h),dataProvenance:x(g),legendPlacements:n},!0,!1)),t()}},r.createElement("div",{className:"row"},r.createElement("div",{className:"col-sm-6"},r.createElement("div",{className:"row"},r.createElement("div",{className:"col-lg-6"},r.createElement("label",null,n("Dataset title"),":",r.createElement("br",null),r.createElement("input",{name:"datasetTitle",type:"text",defaultValue:l.title||""}))),r.createElement("div",{className:"col-lg-6"},r.createElement("label",null,n("Date updated"),":",r.createElement("br",null),r.createElement("input",{name:"updated",type:"date",defaultValue:l.updated||""})))),r.createElement("div",{className:"row"},r.createElement("div",{className:"col-lg-6"},r.createElement("label",null,n("Build URL"),":",r.createElement("br",null),r.createElement("input",{name:"buildUrl",type:"url",defaultValue:l.buildUrl||""}))),r.createElement("div",{className:"col-lg-6"},r.createElement("label",null,n("Avatar URL"),":",r.createElement("br",null),r.createElement("input",{name:"avatarUrl",type:"url",defaultValue:l.buildAvatar||""})))),r.createElement(C,{name:"maintainers",data:h,setData:y}),r.createElement(C,{name:"data provenances",data:g,setData:b})),r.createElement("div",{className:"col-sm-6"},r.createElement("label",null,n("Warning"),":",r.createElement("br",null),r.createElement("textarea",{name:"warning",defaultValue:l.warning||""})),r.createElement("label",null,n("Description"),":",r.createElement("br",null),r.createElement("textarea",{rows:10,name:"description",defaultValue:l.description||""})),r.createElement(T,{defaultPlacements:l.legendPlacements}))),r.createElement(p.A,{justifyContent:"center"},r.createElement("button",{type:"submit",style:{margin:10}},n("Apply changes")),r.createElement("button",{type:"button",style:{margin:10},onClick:t},n("Discard changes"))))}var O={container:function(e){return e.backgroundColor="rgba(0, 0, 0, .30)",e},panel:function(e,t){return e.width=t.width-100,e.maxWidth=e.width,e.height=t.height-200,e.maxHeight=e.height,e.padding="2em",e.color="#1f2328",e.backgroundColor="#ffffff",e}};function C(e){var t=e.name,n=e.data,o=e.setData,l=(0,i.B)().t,s=(0,r.useRef)(n.length);function c(e){o(h(n).map(function(t){return t.id===e.id?e:t}))}return r.createElement(r.Fragment,null,r.createElement("div",{className:"row"},r.createElement("div",{className:"col-xs-12 underlined"},l(t),":")),n.map(function(e){return r.createElement(p.A,{key:e.id},r.createElement("div",{className:"col-xs-6"},r.createElement("label",null,l("Name"),":",r.createElement("br",null),r.createElement("input",{required:!0,type:"text",value:e.name,onChange:function(t){return c(b(b({},e),{},{name:t.currentTarget.value}))}}))),r.createElement("div",{className:"col-xs-5"},r.createElement("label",null,l("URL"),":",r.createElement("br",null),r.createElement("input",{type:"url",value:e.url,onChange:function(t){return c(b(b({},e),{},{url:t.currentTarget.value}))}}))),r.createElement("div",{className:"col-xs-1"},r.createElement("button",{type:"button",onClick:function(){return t=e.id,void o(h(n).filter(function(e){return e.id!==t}));var t}},r.createElement(a.RCe,null))))}),r.createElement(p.A,null,r.createElement("button",{type:"button",onClick:function(){var e={id:s.current,name:"",url:""};s.current++,o([].concat(h(n),[e]))}},l("Add ".concat(t)))))}function T(e){var t=e.defaultPlacements,n=(0,i.B)().t,o=["top left","top right","bottom left","bottom right"],a=Object.fromEntries(Object.entries(t).map(function(e){var t,n=m(e,2);return[n[0],(t=n[1],"".concat(t.vertical," ").concat(t.horizontal))]}));return r.createElement(r.Fragment,null,r.createElement("div",{className:"underlined"},n("Legend placement")),r.createElement(p.A,{justifyContent:"space-around"},Object.keys(a).map(function(e){return r.createElement("div",{key:e},n("".concat(e," panel")),o.map(function(t){return r.createElement(p.A,{key:t,justifyContent:"flex-start",alignContent:"center",style:{margin:"0.25em 1em"}},r.createElement("input",{id:"".concat(e,"-").concat(t),name:"".concat(e,"Legend"),type:"radio",value:t,defaultChecked:a[e]===t}),r.createElement("label",{htmlFor:"".concat(e,"-").concat(t)},n(t)))}))})))}function _(){return!(!(0,c.Q)("enableDatasetEditor")||!(0,c.u)("enableDatasetEditor"))}},5300(e,t,n){"use strict";n.d(t,{EJ:()=>i,qF:()=>a});var r=n(77313),o=r.Ay.form.withConfig({displayName:"styles__Form",componentId:"sc-10gz0g0-0"})(["height:100%;width:100%;display:flex;flex-direction:column;justify-content:space-evenly;align-items:stretch;*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}*:before,*:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}button{display:inline-flex;justify-content:center;align-items:center;padding:0.3em;}"]),i=(0,r.Ay)(o).withConfig({displayName:"styles__DatasetEditorForm",componentId:"sc-10gz0g0-1"})(["input:not([type=radio]){margin-bottom:1em;width:100%;}input[type=radio]{margin-right:0.2em;}textarea{margin-bottom:1em;width:100%;resize:vertical;min-height:1.5em;max-height:50em;}.underlined{margin-bottom:1em;text-decoration:underline;}.radio{width:100%;display:inline-flex;align-items:center;margin:0.25em 1em;}"]),a=(0,r.Ay)(o).withConfig({displayName:"styles__ColorByEditorForm",componentId:"sc-10gz0g0-2"})(['input[type="color"]{width:25px;height:25px;margin-right:1em;padding:0;border:3px solid;}input[type="color"]::-moz-color-swatch{border:none;}input[type="color"]::-webkit-color-swatch-wrapper{padding:0;border-radius:0;}input[type="color"]::-webkit-color-swatch{border:none;}'])},22796(e,t,n){"use strict";n.d(t,{P:()=>w,u:()=>g});var r=n(78281),o=n(49633),i=n(98807),a=n(77313),l=n(98598),s=n(40952),c=n(4124),u=n(69138),p=n(85053),f=n(93681),d=(0,a.SL)(l.bg),h=(0,a.SL)(l.wC),m=(0,a.SL)(l.W8),y=(0,a.SL)(l.jG),v=25,g=function(e){var t,n,a,l,c=e.relevantPublications,g=(0,o.d4)(function(e){return e}),S=(0,o.wA)(),x=(0,i.B)().t,E=g.metadata.mainTreeNumTips,O=(0,f.gY)(g.tree.nodes,g.tree.visibility),C=O!==E,T=w(),_="num_date"===g.controls.distanceMeasure,k=(null===(t=g.entropy)||void 0===t?void 0:t.selectedCds)===s.Sc?"nucleotide":"codon";return r.createElement(r.Fragment,null,r.createElement("div",{style:{fontWeight:500,marginTop:"0px",marginBottom:"20px"}},"Downloaded data represents the currently displayed view. By zooming the tree, changing the branch-length metric, applying filters etc, the downloaded data will change accordingly.",r.createElement("p",null),"NOTE: We do not support downloads of multiple subtrees, which are usually created with the date range filter or genotype filters. Downloading multiple subtrees will result in an empty Newick tree!",r.createElement("p",null),C?"Currently ".concat(O,"/").concat(E," tips are displayed and will be downloaded."):"Currently the entire dataset (".concat(E," tips) will be downloaded.")),g.metadata.sharing.dataset_json&&r.createElement(b,{name:"Auspice (Nextstrain) JSON",description:"The main Auspice dataset JSON with the current view as the display default.",icon:r.createElement(y,{width:v,selected:!0}),onClick:function(){return u.hO(S,g,T)}}),g.metadata.sharing.trees&&r.createElement(r.Fragment,null,r.createElement(b,{name:"".concat(_?"TimeTree":"Tree"," (Newick)"),description:"Phylogenetic tree in Newick format with branch lengths in units of ".concat(_?"years":"divergence","."),icon:r.createElement(d,{width:v,selected:!0}),onClick:function(){return u.D4({isNewick:!0,dispatch:S,filePrefix:T,tree:g.tree,temporal:_})}}),r.createElement(b,{name:"".concat(_?"TimeTree":"Tree"," (Nexus)"),description:"Phylogeny in Nexus format with branch lengths in units of ".concat(_?"years":"divergence",". Colorings are included as annotations."),icon:r.createElement(d,{width:v,selected:!0}),onClick:function(){return u.D4({dispatch:S,filePrefix:T,tree:g.tree,colorings:g.metadata.colorings,colorBy:g.controls.colorBy,temporal:_})}})),g.metadata.sharing.gisaid_acknowledgments&&r.createElement(b,{name:"Acknowledgments (TSV)",description:"Per-sample acknowledgments (n = ".concat(O,")."),icon:r.createElement(m,{width:v,selected:!0}),onClick:function(){return u.AS(S,T,g.tree.nodes,g.tree.visibility)}}),g.metadata.sharing.metadata_tsv&&r.createElement(b,{name:"Metadata (TSV)",description:"Per-sample metadata (n = ".concat(O,")."),icon:r.createElement(m,{width:v,selected:!0}),onClick:function(){return u.tO(S,T,g.tree.nodes,g.tree.visibility)}}),g.metadata.sharing.authors&&u.Gh(g.tree)&&r.createElement(b,{name:"Author Metadata (TSV)",description:"Metadata for ".concat(O," samples grouped by their ").concat((n=g.tree.nodes,a=g.tree.visibility,l=new Set(n.filter(function(e,t){return a[t]===s.uU&&e.shell.inView}).map(function(e){return(0,p.tg)(e)}).filter(function(e){return e&&e.value}).map(function(e){return e.value})),l.size)," authors."),icon:r.createElement(m,{width:v,selected:!0}),onClick:function(){return u.Rj(S,T,g.tree)}}),g.metadata.sharing.entropy&&g.entropy.loaded&&r.createElement(b,{name:"Genetic diversity data (TSV)",description:"The data behind the diversity panel showing ".concat(g.entropy.showCounts?"a count of changes across the tree":"normalised shannon entropy"," per ").concat(k,"."),icon:r.createElement(m,{width:v,selected:!0}),onClick:function(){return u.xz(S,T,g.entropy)}}),g.metadata.sharing.screenshot&&r.createElement(b,{name:"Screenshot (SVG)",description:"Screenshot of the current nextstrain display in SVG format; CC-BY licensed.",icon:r.createElement(h,{width:v,selected:!0}),onClick:function(){return u.t4(S,x,g.metadata,g.tree.nodes,g.tree.visibility,w(),g.controls.panelsToDisplay,g.controls.panelLayout.panelLayout,c)}}))};function b(e){var t=e.name,n=e.description,o=e.icon,i=e.onClick,a=Object.assign({},c.u0,{backgroundColor:"rgba(0,0,0,0)",paddingLeft:"10px",color:"white",minWidth:"300px",textAlign:"left"});return r.createElement("div",{key:t,onClick:i,style:{cursor:"pointer"}},o,r.createElement("button",{style:a,name:t},t),r.createElement("div",{style:{display:"inline-block",height:"30px",verticalAlign:"top",paddingTop:"6px"}},r.createElement("label",{style:{fontStyle:"italic",fontSize:"14px",color:"lightgray"},htmlFor:t},n)))}function w(){return"nextstrain_"+window.location.pathname.replace(/^\//,"").replace(/:/g,"-").replace(/\//g,"_")}},57900(e,t,n){"use strict";n.d(t,{A:()=>w,M:()=>g});var r,o=n(78281),i=n(49633),a=n(69646),l=n(4124),s=n(17904),c=n(43153),u=n(22796);function p(e){return p="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},p(e)}function f(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,d(r.key),r)}}function d(e){var t=function(e){if("object"!=p(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==p(t)?t:t+""}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function m(e){var t=y();return function(){var n,r=v(e);if(t){var o=v(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==p(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(y=function(){return!!e})()}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}var g={nextstrain:{author:"Hadfield et al",title:"Nextstrain: real-time tracking of pathogen evolution",year:"2018",journal:"Bioinformatics",href:"https://doi.org/10.1093/bioinformatics/bty407"},treetime:{author:"Sagulenko et al",title:"TreeTime: Maximum-likelihood phylodynamic analysis",journal:"Virus Evolution",year:"2017",href:"https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5758920/"},titers:{author:"Neher et al",titleJournalYear:"Prediction, dynamics, and visualization of antigenic phenotypes of seasonal influenza viruses",journal:"PNAS",year:"2016",href:"http://www.pnas.org/content/113/12/E1701.abstract"}},b=(0,i.Ng)(function(e){return{colorBy:e.controls.colorBy,metadata:e.metadata,nodes:e.tree.nodes,visibility:e.tree.visibility}})(r=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}(i,e);var t,n,r=m(i);function i(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),r.apply(this,arguments)}return t=i,n=[{key:"getRelevantPublications",value:function(){var e=[g.nextstrain,g.treetime];return-1!==["cTiter","rb","ep","ne"].indexOf(this.props.colorBy)&&e.push(g.titers),e}},{key:"formatPublications",value:function(e){return o.createElement("span",null,o.createElement("ul",null,e.map(function(e){return o.createElement("li",{key:e.href},o.createElement("a",{href:e.href,target:"_blank",rel:"noreferrer noopener"},e.author,", ",e.title,", ",o.createElement("i",null,e.journal)," (",e.year,")"))})))}},{key:"render",value:function(){var e=this.props,t=e.t,n=e.metadata,r=this.getRelevantPublications();return o.createElement(o.Fragment,null,o.createElement("div",{style:l.vS.modalSubheading},n.title," (",t("last updated")," ",n.updated,")"),o.createElement("div",null,(0,c.jL)({mainTreeNumTips:this.props.metadata.mainTreeNumTips,nodes:this.props.nodes,visibility:this.props.visibility,t:this.props.t})),o.createElement("div",{style:l.vS.break})," "+t("A full list of sequence authors is available via the TSV files below"),o.createElement("div",{style:l.vS.break}),o.createElement("div",{style:l.vS.modalSubheading},t("Data usage policy")),t("Data usage part 1")+" "+t("Data usage part 2"),o.createElement("div",{style:l.vS.modalSubheading},t("Please cite the authors who contributed genomic data (where relevant), as well as")+":"),this.formatPublications(r),o.createElement("div",{style:l.vS.modalSubheading},t("Download data"),":"),o.createElement("div",{style:{display:"block",justifyContent:"space-around",marginLeft:"25px",width:"100%"}},o.createElement("div",{style:{width:"100%"}},o.createElement(u.u,{relevantPublications:r}))),n.description&&o.createElement(o.Fragment,null,o.createElement("div",{style:l.vS.modalSubheading},t("Dataset description"),":"),o.createElement(s.w,{md:n.description})))}}],n&&f(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(o.Component))||r;const w=(0,a.C)()(b)},69138(e,t,n){"use strict";n.d(t,{t4:()=>B,AS:()=>A,Gh:()=>k,hO:()=>F,Rj:()=>j,xz:()=>z,D4:()=>R,tO:()=>P});var r=n(67016),o=n(479),i=n(89270),a=n(85053),l=n(61373),s=n(40952),c=n(43153),u=n(21143),p=n(18544),f=n(4941);function d(e){return d="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},d(e)}function h(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 m(e,t,n){return(t=function(e){var t=function(e){if("object"!=d(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=d(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==d(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e){var t=(e.nodes[0].children||[]).map(function e(t){var n,r={};return t.name&&(r.name=t.name),t.node_attrs&&(r.node_attrs=t.node_attrs),t.branch_attrs&&(r.branch_attrs=t.branch_attrs),null!==(n=t.children)&&void 0!==n&&n.length&&(r.children=t.children.map(e)),r});return 1===t.length?t[0]:t}function v(e){return v="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},v(e)}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||w(e,t)||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 b(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=w(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},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 i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function w(e,t){if(e){if("string"==typeof e)return S(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function x(e,t,n){return(t=function(e){var t=function(e){if("object"!=v(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=v(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==v(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var E=function(e){return Object.prototype.hasOwnProperty.call(e,"paper_url")&&!e.paper_url.endsWith("/")&&"?"!==e.paper_url},O=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){return""},o=t?function(e){return(0,a.hu)(e,"num_date")}:a.Ue,i=e.nodes[e.idxOfFilteredRoot||e.idxOfInViewRootNode],l=function t(i,a){if(!i.shell.inView||e.visibility[i.arrayIdx]!==s.uU)return"";if(i.hasChildren){var l=i.children.map(function(e){return t(e,o(i))});return"(".concat(l.filter(function(e){return!!e}).join(","),")")+"".concat(n?i.name:"").concat(r(i),":").concat(o(i)-a)}return"".concat(i.name).concat(r(i),":").concat(o(i)-a)}(i,o(i));if(!l)throw new p.Vz;return l+";"},C="text/tab-separated-values;charset=utf-8;",T=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return(0,r.unparse)(e,{quotes:!1,quoteChar:'"',escapeChar:'"',delimiter:"\t",header:!0,newline:"\n",skipEmptyLines:!0,columns:t})},_=function(e,t,n){var r=new Blob([n],{type:t}),o=document.createElement("a"),i=URL.createObjectURL(r);o.setAttribute("href",i),o.setAttribute("download",e),o.style.visibility="hidden",document.body.appendChild(o),o.click(),document.body.removeChild(o)},k=function(e){for(var t=0;t<e.nodes.length;t++)if((0,a.tg)(e.nodes[t]))return!0;return!1},j=function(e,t,n){var r="n (strains)",i="unknown",l={};n.nodes.filter(function(e,t){return n.visibility[t]===s.uU&&e.shell.inView}).filter(function(e){return!e.hasChildren}).forEach(function(e){var t,n=(0,a.tg)(e);n&&(l[n.value]?(l[n.value][r]+=1,l[n.value].strains.push(e.name)):l[n.value]=(x(t={Author:n.value,"publication title":n.title||i,journal:n.journal||i,"publication URL":E(n)?n.paper_url:i},r,1),x(t,"strains",[e.name]),t))});var c=["Author",r,"publication title","journal","publication URL","strains"],u=t+"_authors.tsv";_(u,C,T(Object.values(l),c)),e((0,o.W7)({message:"Author metadata exported",details:u}))},P=function(e,t,n,r){var i,c={},u=["strain"],p=b(n.entries());try{var f=function(){var e=g(i.value,2),t=e[0],n=e[1];if(n.hasChildren)return"continue";if(r[t]!==s.uU||!n.shell.inView)return"continue";if(c[n.name]={strain:n.name},!n.node_attrs)return"continue";var o=(0,a.hu)(n,"num_date");if(o){var p="date";I(u,null,p);var f=(0,a.hu)(n,"num_date",{confidence:!0});f&&f[0]!==f[1]?c[n.name][p]="".concat((0,l.bq)(o)," (").concat((0,l.bq)(f[0])," - ").concat((0,l.bq)(f[1]),")"):c[n.name][p]=(0,l.bq)(o)}var d,h=["author","div","num_date","vaccine","accession"],m=b(Object.keys(n.node_attrs).filter(function(e){return!h.includes(e)}));try{for(m.s();!(d=m.n()).done;){var y=d.value,v=(0,a.hu)(n,y);if(void 0!==v){I(u,null,y),"string"==typeof v?c[n.name][y]=v:"number"==typeof v&&(c[n.name][y]=parseFloat(v).toFixed(2));var w=(0,a.cl)(n,y);w&&(I(u,y,M(y)),c[n.name][M(y)]=w)}}}catch(e){m.e(e)}finally{m.f()}var S=(0,a.tg)(n);if(S){var x="author";I(u,null,x),c[n.name][x]=S.value,E(S)&&(I(u,x,M(x)),c[n.name][M(x)]=S.paper_url)}var O=(0,a.Qw)(n);if(O&&O.selection_date){var C="vaccine_selection_date";I(u,null,C),c[n.name][C]=O.selection_date}var T=(0,a.L$)(n);if(T.accession){var _="accession";I(u,null,_),c[n.name][_]=T.accession,T.url&&(I(u,_,M(_)),c[n.name][M(_)]=T.url)}};for(p.s();!(i=p.n()).done;)f()}catch(e){p.e(e)}finally{p.f()}var d="".concat(t,"_metadata.tsv");_(d,C,T(Object.values(c),u)),e((0,o.W7)({message:"Metadata exported to ".concat(d)}))},A=function(e,t,n,r){var i,l={},c=["strain"],u=b(n.entries());try{for(u.s();!(i=u.n()).done;){var p=g(i.value,2),f=p[0],d=p[1];if(!d.hasChildren&&r[f]===s.uU&&d.shell.inView&&(l[d.name]={strain:d.name},d.node_attrs)){for(var h=0,m=["gisaid_epi_isl","genbank_accession","originating_lab","submitting_lab"];h<m.length;h++){var y=m[h],v=(0,a.hu)(d,y);v&&(I(c,null,y),l[d.name][y]=v)}var w=(0,a.tg)(d);if(w){var S="author";I(c,null,S),l[d.name][S]=w.value,E(w)&&(I(c,S,M(S)),l[d.name][M(S)]=w.paper_url)}}}}catch(e){u.e(e)}finally{u.f()}var x="".concat(t,"_acknowledgements.tsv");_(x,C,T(Object.values(l),c)),e((0,o.W7)({message:"Acknowledgments exported to ".concat(x)}))};function I(e,t,n){if(!e.includes(n))if(null!==t){var r=e.indexOf(t);-1!==r?e.splice(r+1,0,n):console.warn("Element ".concat(t," not present in provided array"))}else e.push(n)}function M(e){return"".concat(e,"__url")}var R=function(e){var t=e.dispatch,n=e.filePrefix,r=e.tree,i=e.isNewick,l=e.temporal,s=e.colorings,c=e.colorBy;try{var f="".concat(n,"_").concat(l?"timetree":"tree",".").concat(i?"nwk":"nexus"),d=i?O(r,l):function(e,t,n,r){var o,i;return["#nexus","begin trees;"," tree one = "+O(e,r,!0,(o=function(e){return String(e).replace(/[[\]{}=,]/g,"").replace(/[\u0250-\ue007]/g,"")},i=(0,u.Sv)(n)?o(n.replace(/,/g,"/")):void 0,function(e){var n=[];if(Object.keys(t).forEach(function(t){if(!t.includes("_lab")&&!t.includes("author")){var r=(0,a.hu)(e,t);if(r){n.push("".concat(o(t),"=").concat(o(r)));var i=(0,a.hu)(e,t,{confidence:!0});Array.isArray(i)&&2===i.length&&n.push("".concat(o(t),"_CI={").concat(i.map(function(e){return o(e)}).join(","),"}"))}}}),i&&n.push("".concat(i,"=").concat(o(e.currentGt.replace(/\s/g,"")))),r){var l=(0,a.Ue)(e);void 0!==l&&n.push("div=".concat(l))}return n.length?"[&".concat(n.join(","),"]"):""})),"end;"].join("\n")}(r,s,c,l);_(f,"text/plain;charset=utf-8;",d),t((0,o.W7)({message:"".concat(l?"TimeTree":"Tree"," written to ").concat(f)}))}catch(e){console.error(e);var h={message:"Error saving tree!"};e instanceof p.Vz&&(h.details="An empty tree was created. If you have selected genomes, note that we do not support downloads of multiple subtrees."),t((0,o.Ul)(h))}},N=function(e){var t=e.match(/^(<.+?>)(.+)<\/.+?>$/);if(t){var n=t[1].match(/width.+?([0-9.]+).+height.+?([0-9.]+)/);if(n){var r=t[1].match(/viewBox="([0-9-]+)\s([0-9-]+)\s([0-9-]+)\s([0-9-]+)"/);return{x:0,y:0,viewbox:r?r.slice(1):void 0,width:parseFloat(n[1]),height:parseFloat(n[2]),inner:t[2]}}}},D=function(e,t,n){var r='<svg id="'.concat(t,'" width="').concat(n.width,'" height="').concat(n.height,'" x="').concat(n.x,'" y="').concat(n.y,'">');e.push(r),e.push(n.inner),e.push("</svg>")},L=function(e,t,n,r,a,l){var s=[],c={tree:void 0,map:void 0,entropy:void 0,frequencies:void 0};if(-1!==n.indexOf("tree")){try{c.tree=N((new XMLSerializer).serializeToString(document.getElementById("MainTree"))),c.treeLegend=N((new XMLSerializer).serializeToString(document.getElementById("TreeLegendContainer")))}catch(e){c.tree=void 0,s.push("tree"),console.error("Tree SVG save error:",e)}if(c.tree&&document.getElementById("SecondTree"))try{c.secondTree=N((new XMLSerializer).serializeToString(document.getElementById("SecondTree"))),document.getElementById("Tangle")&&(c.tangle=N((new XMLSerializer).serializeToString(document.getElementById("Tangle"))))}catch(e){s.push("second tree / tanglegram"),console.error("Second Tree / tanglegram SVG save error:",e)}}if(-1!==n.indexOf("measurements"))try{c.measurements=N((new XMLSerializer).serializeToString(document.getElementById("d3MeasurementsSVG"))),c.measurementsXAxis=N((new XMLSerializer).serializeToString(document.getElementById("d3MeasurementsXAxisSVG")));var u=document.getElementById("measurementsSVGContainer");c.measurements.width=u.clientWidth,c.measurementsXAxis.width=u.clientWidth}catch(e){c.measurements=void 0,s.push("measurements"),console.error("Measurements SVG save error:",e)}if(-1!==n.indexOf("entropy"))try{c.entropy=N((new XMLSerializer).serializeToString(document.getElementById("d3entropyParent")))}catch(e){c.entropy=void 0,s.push("entropy"),console.error("Entropy SVG save error:",e)}if(-1!==n.indexOf("frequencies"))try{c.frequencies=N((new XMLSerializer).serializeToString(document.getElementById("d3frequenciesSVG")))}catch(e){c.frequencies=void 0,s.push("frequencies"),console.error("Frequencies SVG save error:",e)}-1!==n.indexOf("map")&&l&&(c.map={x:0,y:0,viewbox:void 0,width:parseFloat(l.mapDimensions.x),height:parseFloat(l.mapDimensions.y),inner:l.mapSvg});var p=[],f=function(e,t,n){var r=50,o=0,a=0;for(var l in e.secondTree&&(e.secondTree.x=i.qG+e.tree.width,e.tree.width+=i.qG+e.secondTree.width),e.measurements?(e.tree?(o=Math.max(e.tree.width,e.measurements.width),a=e.tree.height+r+e.measurements.height,e.measurements.y=e.tree.height+r):(o=e.measurements.width,a=e.measurements.height),e.measurementsXAxis.y=a,a+=e.measurementsXAxis.height,e.map&&(o=Math.max(o,e.map.width),e.map.y=a+r,a+=r+e.map.height)):e.tree&&e.map?"grid"===t?(o=e.tree.width+r+e.map.width,a=Math.max(e.tree.height,e.map.height),e.map.x=e.tree.width+r):(o=Math.max(e.tree.width,e.map.width),a=e.tree.height+r+e.map.height,e.map.y=e.tree.height+r):e.tree?(o=e.tree.width,a=e.tree.height):e.map&&(o=e.map.width,a=e.map.height),e.entropy&&(o<e.entropy.width?o=e.entropy.width:e.entropy.x=(o-e.entropy.width)/2,a?(e.entropy.y=a+r,a+=r+e.entropy.height):a=e.entropy.height),e.frequencies&&(o<e.frequencies.width?o=e.frequencies.width:e.frequencies.x=(o-e.frequencies.width)/2,a?(e.frequencies.y=a+r,a+=r+e.frequencies.height):a=e.frequencies.height),e)e[l]&&(e[l].x+=r,e[l].y+=r);a+=100;var s=36*n+20;return{width:o+=100,height:a+=s,padding:r,textY:a-s,textHeight:s}}(c,r,a.length);for(var d in p.push('<svg xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" width="'.concat(f.width,'" height="').concat(f.height,'">')),c)c[d]&&D(p,d,c[d]);p.push('<foreignObject x="'.concat(f.padding,'" y="').concat(f.height-f.textHeight,'" height="').concat(f.textHeight,'" width="').concat(f.width-2*f.padding,'">')),a.forEach(function(e){p.push('<p xmlns="http://www.w3.org/1999/xhtml" style="font-family:lato,sans-serif;">'),p.push(e),p.push("</p>")}),p.push("</foreignObject>"),p.push("</svg>"),_(t+".svg","image/svg+xml;charset=utf-8",p.join("\n")),s.length?e((0,o.Ul)({message:"Vector image saved",details:"Saved to ".concat(t,".svg, however there were errors with ").concat(s.join(", "))})):e((0,o.W7)({message:"Vector image saved",details:t+".svg"}))},B=function(e,t,n,r,o,i,a,l,s){var u=[];u.push(n.title),u.push("Last updated ".concat(n.updated));var p=window.location.href.replace(/&/g,"&");u.push('Downloaded from <a href="'.concat(p,'">').concat(p,"</a> on ").concat((new Date).toLocaleString())),u.push((0,c.jL)({mainTreeNumTips:n.mainTreeNumTips,nodes:r,visibility:o,t})),u.push(""),u.push("".concat(t("Data usage part 1"),' A full list of sequence authors is available via <a href="https://nextstrain.org">nextstrain.org</a>.')),u.push("Visualizations are licensed under CC-BY."),u.push("Relevant publications:"),s.forEach(function(e){u.push('<a href="'.concat(e.href,'">').concat(e.author,", ").concat(e.title,", ").concat(e.journal," (").concat(e.year,")</a>"))}),-1!==a.indexOf("map")?window.L.getMapSvg(L.bind(void 0,e,i,a,l,u)):L(e,i,a,l,u,void 0)},z=function(e,t,n){var r={base:"x",gene:"prot",position:"codon",events:"y",entropy:"y"},i=n.selectedCds===s.Sc?["base"]:["gene","position"];i.push(n.showCounts?"events":"entropy");var a=n.bars.map(function(e){return Object.fromEntries(i.map(function(t){return[t,e[r[t]]]}))}),l="".concat(t,"_diversity.tsv");_(l,C,T(a,i)),e((0,o.W7)({message:"Diversity data exported to ".concat(l)}))};function F(e,t,n){var r=n+".json";"nextstrain_.json"===r&&(r=t.metadata.title?"nextstrain_"+t.metadata.title.trim().slice(0,25).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")+".json":"nextstrain.json");var i=function(e){var t=e();if(!t.metadata.loaded)throw new Error("[INTERNAL ERROR] metadata state not loaded");var n=function(e){if(e.rootSequence)return e.rootSequence}(t.metadata),r=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach(function(t){m(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({version:"v2",meta:(0,f.KD)(t),tree:y(t.tree)},n&&{root_sequence:n});return r}(function(){return t});_(r,"application/json",JSON.stringify(i)),e((0,o.W7)({message:"Saving main dataset JSON as '".concat(r,"'")})),t.treeToo.loaded&&e((0,o.Ul)({message:"Download functionality only supports the main (LHS) tree at the moment"}))}},40769(e,t,n){"use strict";n.d(t,{Ay:()=>k,VF:()=>P,YM:()=>T,cc:()=>j});var r,o=n(78281),i=n(49633),a=n(77313),l=n(69646),s=n(28355),c=n(4124),u=n(99438),p=n(60516),f=n(60251),d=n(57900),h=n(41930),m=n(62617);function y(e){return y="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},y(e)}function v(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,g(r.key),r)}}function g(e){var t=function(e){if("object"!=y(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==y(t)?t:t+""}function b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}function w(e){var t=S();return function(){var n,r=x(e);if(t){var o=x(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==y(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function S(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(S=function(){return!!e})()}function x(e){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},x(e)}var E=n(40436),O=(0,o.lazy)(function(){return n.e(418).then(n.bind(n,95418))}),C=o.createElement("span",{style:{marginLeft:10,marginRight:10}},"•"),T=a.Ay.div.withConfig({displayName:"fine-print__FinePrintStyles",componentId:"sc-129vvgi-0"})(["margin-left:30px;padding-bottom:30px;font-family:",";font-size:15px;font-weight:300;color:rgb(136,136,136);line-height:1.4;.line{margin-top:20px;margin-bottom:20px;border-bottom:1px solid #CCC;}.finePrint{font-size:14px;}.logoContainer{padding:1px 1px;margin-right:5px;width:24px;cursor:pointer;}.logo{margin-left:1px;margin-right:1px;margin-top:1px;margin-bottom:3px;}"],c.sf),_=(0,i.Ng)(function(e){return{tree:e.tree,metadata:e.metadata,browserDimensions:e.browserDimensions.browserDimensions}})(r=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}(i,e);var t,n,r=w(i);function i(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),r.apply(this,arguments)}return t=i,n=[{key:"shouldComponentUpdate",value:function(e){return this.props.browserDimensions!==e.browserDimensions}},{key:"getUpdated",value:function(){var e=this.props.t;return this.props.metadata.updated?o.createElement("span",null,e("Data updated")," ",this.props.metadata.updated):null}},{key:"downloadDataButton",value:function(){var e=this,t=this.props.t;return o.createElement("button",{style:Object.assign({},c.u0,{backgroundColor:"rgba(0,0,0,0)",color:c.ib,margin:0,padding:0}),onClick:function(){e.props.dispatch({type:u.vN,modal:"download"})}},o.createElement(s.WCW,null),o.createElement("span",{style:{position:"relative",paddingLeft:"3px"}}," "+t("Download data")))}},{key:"linkOutButton",value:function(){var e=this,t=this.props.t;return o.createElement("button",{style:Object.assign({},c.u0,{backgroundColor:"rgba(0,0,0,0)",color:c.ib,margin:0,padding:0}),onClick:function(){e.props.dispatch({type:u.vN,modal:"linkOut"})}},o.createElement(s.P_O,null),o.createElement("span",{style:{position:"relative",paddingLeft:"3px"}}," "+t("View in other platforms")))}},{key:"render",value:function(){if(!this.props.metadata||!this.props.tree.nodes)return null;var e=this.props.width-30;return o.createElement(T,null,o.createElement("div",{style:{width:e}},o.createElement(p.A,{className:"finePrint",wrap:"wrap"},this.getUpdated(),C,this.downloadDataButton(),(0,m.f)()&&o.createElement(o.Fragment,null,C,this.linkOutButton()),C,o.createElement("a",{href:"https://docs.nextstrain.org/projects/auspice/page/releases/changelog.html",target:"_blank",rel:"noreferrer noopener"},"Auspice v"+f.version)),o.createElement("div",{style:{height:"5px"}}),P(),j()))}}],n&&v(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(o.Component))||r;const k=(0,l.C)()(_);function j(){return o.createElement(p.A,{className:"finePrint"},o.createElement("a",{className:"logoContainer",href:"https://nextstrain.org"},o.createElement("img",{alt:"nextstrain.org",className:"logo",width:"24px",src:E})),"Powered by Nextstrain (",o.createElement("a",{href:d.M.nextstrain.href,target:"_blank",rel:"noopener noreferrer"},d.M.nextstrain.author," ",o.createElement("i",null,d.M.nextstrain.journal)),")")}function P(){var e=(0,h.Q)("finePrint")?(0,h.u)("finePrint"):null;return e?o.createElement(o.Suspense,{fallback:o.createElement(o.Fragment,null)},o.createElement(p.A,{className:"finePrint"},o.createElement(O,{mdstring:e,placeholder:"This dataset contained a fine print message to be displayed here, however it wasn't correctly formatted."}))):null}},60516(e,t,n){"use strict";n.d(t,{A:()=>v});var r=n(78281),o=n(43979),i=n.n(o);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},a(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 s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(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,m(r.key),r)}}function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}function p(e){var t=f();return function(){var n,r=d(e);if(t){var o=d(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},d(e)}function h(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e){var t=function(e){if("object"!=a(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}var y=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}(i,e);var t,n,o=p(i);function i(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),o.apply(this,arguments)}return t=i,(n=[{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 r.createElement("div",{id:this.props.id,onClick:this.props.clickHandler,style:s(s({},e.base),e.style)},this.props.children)}}])&&c(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Component);h(y,"propTypes",{direction:i().oneOf(["row","rowReverse","column","columnReverse"]),wrap:i().oneOf(["nowrap","wrap","wrap-reverse"]),justifyContent:i().oneOf(["flex-start","flex-end","center","space-between","space-around"]),alignItems:i().oneOf(["flex-start","flex-end","center","baseline","stretch"]),alignContent:i().oneOf(["flex-start","flex-end","center","space-between","space-around","stretch"]),grow:i().number,shrink:i().number,basis:i().string,order:i().number,alignSelf:i().oneOf(["auto","flex-start","flex-end","center","baseline","stretch"]),children:i().node.isRequired,clickHandler:i().func}),h(y,"defaultProps",{direction:"row",wrap:"nowrap",justifyContent:"center",alignItems:"center",alignContent:"stretch",grow:0,shrink:1,basis:"auto",alignSelf:"auto",order:0,style:{},clickHandler:function(){}});const v=y},17904(e,t,n){"use strict";n.d(t,{A:()=>A,w:()=>T});var r,o=n(78281),i=n(49633),a=n(77313),l=n(75805),s=n.n(l),c=n(69646),u=n(28355),p=n(4124),f=n(60516),d=n(87473),h=n(40952),m=n(73924);function y(e){return y="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},y(e)}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function g(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,b(r.key),r)}}function b(e){var t=function(e){if("object"!=y(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==y(t)?t:t+""}function w(e,t){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},w(e,t)}function S(e){var t=x();return function(){var n,r=E(e);if(t){var o=E(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==y(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function x(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(x=function(){return!!e})()}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}var O=(0,o.lazy)(function(){return n.e(418).then(n.bind(n,95418))}),C=a.Ay.div.withConfig({displayName:"footer__FooterStyles",componentId:"sc-n42vt4-0"})(["margin-left:30px;padding-bottom:0px;font-family:",";font-size:15px;font-weight:300;color:rgb(136,136,136);line-height:1.4;p{font-weight:300;}ol{font-weight:300;}ul{font-weight:300;}h1{font-weight:700;font-size:2.50em;margin:0.2em 0;}h2{font-weight:600;font-size:2.15em;margin:0.2em 0;}h3{font-weight:500;font-size:1.70em;margin:0.2em 0;}h4{font-weight:500;font-size:1.25em;margin:0.1em 0;}h5{font-weight:500;font-size:1.0em;margin:0.1em 0;}h6{font-weight:500;font-size:0.85em;margin:0.1em 0;}pre{padding:16px;overflow:auto;font-size:85%;line-height:1.45;background-color:#f6f8fa;border-radius:3px;}pre code{padding:0;margin:0;overflow:visible;font-size:100%;line-height:inherit;word-wrap:normal;background-color:initial;border:0;}p code{padding:.2em .4em;margin:0;font-size:85%;background-color:rgba(27,31,35,.05);border-radius:3px;}.line{margin-top:15px;margin-bottom:15px;border-bottom:1px solid #CCC;}.acknowledgments{margin-top:10px;}.filterList{margin-top:10px;line-height:1.0;}.imageContainer{display:flex;justify-content:center;align-items:center;flex-wrap:wrap;}img{margin-left:30px;margin-right:30px;margin-top:2px;margin-bottom:2px;}table{font-weight:300;margin-bottom:1rem;th,td{text-align:left;padding:0.45rem;vertical-align:top;border-top:1px solid #dee2e6;}thead th{vertical-align:bottom;border-bottom:2px solid #dee2e6;}tbody + tbody{border-top:2px solid #dee2e6;}}"],p.sf);function T(e){var t=e.md;return t?o.createElement(o.Suspense,{fallback:o.createElement("div",null)},o.createElement(O,{className:"acknowledgments",mdstring:t,placeholder:"Error: The dataset's description wasn't correctly formatted as a markdown string"})):o.createElement("div",null,h.dW)}var _=a.Ay.div.withConfig({displayName:"footer__TitleContainer",componentId:"sc-n42vt4-1"})(["display:flex;justify-content:space-between;margin:0px;padding:0px;"]),k=a.Ay.span.withConfig({displayName:"footer__IconContainer",componentId:"sc-n42vt4-2"})(["font-size:22px;font-weight:500;"]),j=function(e){var t=e.name,n=e.isExpanded,r=void 0!==n&&n;return o.createElement(_,null,t,o.createElement(k,null,r?o.createElement(u.Odn,null):o.createElement(u.BNo,null)))},P=(0,i.Ng)(function(e){return{tree:e.tree,totalStateCounts:e.tree.totalStateCounts,metadata:e.metadata,browserDimensions:e.browserDimensions.browserDimensions,activeFilters:e.controls.filters,filtersInFooter:e.controls.filtersInFooter}})(r=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&w(e,t)}(i,e);var t,n,r=S(i);function i(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),r.apply(this,arguments)}return t=i,n=[{key:"shouldComponentUpdate",value:function(e){if(this.props.tree.version!==e.tree.version||this.props.browserDimensions!==e.browserDimensions)return!0;if(Object.keys(this.props.activeFilters)!==Object.keys(e.activeFilters))return!0;if(Object.keys(this.props.activeFilters).length>0){var t,n=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},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 i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}(this.props.activeFilters);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(this.props.activeFilters[r]!==e.activeFilters[r])return!0}}catch(e){n.e(e)}finally{n.f()}}return!1}},{key:"displayFilter",value:function(e){var t,n,r=this,i=this.props.t,a=this.props.totalStateCounts[e];if(!a)return null;var l,c,u,p=this.props.metadata.colorings[e]?this.props.metadata.colorings[e].title:e,y=(this.props.activeFilters[e]||[]).filter(function(e){return e.active}).map(function(e){return e.value}),v=o.createElement("div",null,i("Filter by {{filterTitle}}",{filterTitle:p})+" (n=".concat(a.size,")"),null!==(t=this.props.activeFilters)&&void 0!==t&&null!==(n=t[e])&&void 0!==n&&n.length?(l=this.props.dispatch,c=[e],u=i("Clear {{filterName}} filter",{filterName:e}),o.createElement(m.PJ,{active:!0,extraStyles:{float:"right",margin:"0px 4px"},onClick:function(){c.forEach(function(e){return l((0,d.$h)("set",e,[]))})}},u)):null);return o.createElement("div",null,o.createElement(s(),{triggerWhenOpen:o.createElement(j,{name:v,isExpanded:!0}),trigger:o.createElement(j,{name:v}),triggerStyle:{cursor:"pointer",textDecoration:"none"},transitionTime:100},o.createElement("div",{className:"filterList"},o.createElement(f.A,{wrap:"wrap",justifyContent:"flex-start",alignItems:"center"},Array.from(a.keys()).filter(function(e){return(0,h.QF)(e)}).sort().map(function(t){return o.createElement(m.PJ,{key:t,active:-1!==y.indexOf(t),onClick:function(){return function(e,t,n,r){var o=-1===(t[n]||[]).map(function(e){return e.value}).indexOf(r)?"add":"remove";e((0,d.$h)(o,n,[r]))}(r.props.dispatch,r.props.activeFilters,e,t)}},o.createElement("span",null,"".concat(t," (").concat(a.get(t),")")))})))))}},{key:"render",value:function(){var e=this;if(!this.props.metadata||!this.props.tree.nodes)return null;var t=this.props.width-30;return o.createElement(C,null,o.createElement("div",{style:{width:t}},o.createElement("div",{className:"line"}),o.createElement(T,{md:this.props.metadata.description}),o.createElement("div",{className:"line"}),this.props.filtersInFooter.map(function(t){return o.createElement("div",{key:t},e.displayFilter(t),o.createElement("div",{className:"line"}))})))}}],n&&g(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(o.Component))||r;const A=(0,c.C)()(P)},98598(e,t,n){"use strict";n.d(t,{W8:()=>c,Xl:()=>a,bg:()=>o,bu:()=>s,jG:()=>f,vA:()=>p,wC:()=>u,yf:()=>l,zD:()=>i});var r=n(78281),o=function(e){var t=e.theme,n=e.selected,o=e.width,i=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:o,height:o+5},r.createElement("g",{transform:"translate(0,2)"},r.createElement("svg",{width:o,height:o,viewBox:"16 19 27 22"},r.createElement("g",{id:"Group",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",transform:"translate(17.000000, 20.000000)"},r.createElement("polyline",{id:"Path-3",stroke:i,points:"2.94117647 12.8571429 2.94117647 18.6083984 17.8459616 18.6083984 17.8459616 16.0260882 24.870031 16.0260882"}),r.createElement("polyline",{id:"Path-4",stroke:i,points:"17.8500004 18.5714286 17.8500004 20 25.0119374 20"}),r.createElement("polyline",{id:"Path-5",stroke:i,points:"2.94117647 12.8571429 3.00303284 7.21191058 10.2360102 7.11220045 10.4159559 2.99881623 17.1561911 2.93803403 17.1561911 0 24.313534 0"}),r.createElement("polyline",{id:"Path-6",stroke:i,points:"17.1599998 2.85714286 17.1599998 4.28571429 24.512941 4.28571429"}),r.createElement("path",{d:"M0,12.8571429 L2.94117647,12.8571429",id:"Path-6",stroke:i}),r.createElement("polyline",{id:"Path-7",stroke:i,points:"10.2941176 7.14285714 10.2941176 11.4285714 24.5454676 11.4285714"})))))},i=function(e){var t=e.theme,n=e.selected,o=e.width,i=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:o,height:o+5},r.createElement("g",{transform:"translate(0,4)"},r.createElement("svg",{width:o,height:o,viewBox:"0 0 30 30 "},r.createElement("g",{id:"Group",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",transform:"translate(17.000000, 20.000000)"},r.createElement("polyline",{id:"Path-3",stroke:i,points:"-15 5 -15 -25 "}),r.createElement("polyline",{id:"Path-4",stroke:i,points:"-15 5 25 5"}),r.createElement("polyline",{id:"Path-5",stroke:i,points:"-12 3 20 -25 "}),r.createElement("circle",{id:"c-1",stroke:i,cx:"-8",cy:"0",r:"2"}),r.createElement("circle",{id:"c-2",stroke:i,cx:"4",cy:"-10",r:"2"}),r.createElement("circle",{id:"c-3",stroke:i,cx:"4",cy:"-15",r:"2"}),r.createElement("circle",{id:"c-4",stroke:i,cx:"-4",cy:"-5",r:"2"}),r.createElement("circle",{id:"c-5",stroke:i,cx:"-2",cy:"-11",r:"2"})))))},a=function(e){var t=e.theme,n=e.selected,o=e.width,i=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:o,height:o+5},r.createElement("g",{transform:"translate(0,4)"},r.createElement("svg",{width:o,height:o,viewBox:"0 0 30 30 "},r.createElement("g",{id:"Group",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",transform:"translate(17.000000, 20.000000)"},r.createElement("polyline",{id:"Path-3",stroke:i,points:"-15 5 -15 -25 "}),r.createElement("polyline",{id:"Path-4",stroke:i,points:"-15 5 25 5"}),r.createElement("circle",{id:"c-1",stroke:i,cx:"-8",cy:"0",r:"2"}),r.createElement("circle",{id:"c-2",stroke:i,cx:"3",cy:"0",r:"2"}),r.createElement("circle",{id:"c-3",stroke:i,cx:"8",cy:"-5",r:"2"}),r.createElement("circle",{id:"c-4",stroke:i,cx:"-4",cy:"-15",r:"2"}),r.createElement("circle",{id:"c-5",stroke:i,cx:"1",cy:"-11",r:"2"})))))},l=function(e){var t=e.theme,n=e.selected,o=e.width,i=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:o,height:o+5},r.createElement("g",{transform:"translate(0,0)"},r.createElement("svg",{width:o,height:o,viewBox:"14 14 25 26"},r.createElement("g",{id:"Group",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",transform:"translate(15.000000, 15.000000)"},r.createElement("path",{d:"M15,15 L17.6450195,15",id:"Path-12",stroke:i}),r.createElement("path",{d:"M15.229248,22.5795898 L15.229248,18.2854004 C15.229248,18.2854004 17.8465223,17.6291504 17.8508301,15.0574951 C17.8551378,12.4858398 15.2944336,11.9138184 15.2944336,11.9138184 L15.229248,7.53540039",id:"Path-13",stroke:i}),r.createElement("path",{d:"M7.63037109,6.10498047 L10.230957,9.08325195 C10.230957,9.08325195 12.25,7.08233714 15.126709,7.04162598 C18.003418,7.00091481 20.5390625,8.91748047 20.5390625,8.91748047 L22.9765625,5.60839844",id:"Path-14",stroke:i}),r.createElement("path",{d:"M0.15942005,4.99135298 L2.76065146,7.96962446 C2.76065146,7.96962446 4.78019556,5.96870965 7.65761856,5.92799848 C10.5350415,5.88728732 13.0713154,7.80385298 13.0713154,7.80385298 L15.5094204,4.49477094",id:"Path-14",stroke:i,transform:"translate(7.834420, 6.232198) rotate(-34.000000) translate(-7.834420, -6.232198) "}),r.createElement("path",{d:"M7.5,21.496582 L10.1005859,24.4748535 C10.1005859,24.4748535 12.1196289,22.4739387 14.9963379,22.4332275 C17.8730469,22.3925164 20.4086914,24.309082 20.4086914,24.309082 L22.8461914,21",id:"Path-14",stroke:i,transform:"translate(15.173096, 22.737427) scale(1, -1) translate(-15.173096, -22.737427) "})))))},s=function(e){var t=e.theme,n=e.selected,o=e.width,i=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:o,height:o+5},r.createElement("g",{transform:"translate(0,2)"},r.createElement("svg",{width:o,height:o,viewBox:"106 49 150 118"},r.createElement("polyline",{id:"Path-2",stroke:i,strokeWidth:"4",fill:"none",points:"108 77 125.182237 87.8599894 133.381156 119.402591 111.867082 144.368016"}),r.createElement("path",{d:"M125.2,87.5 L137.624777,70",id:"Path-3",stroke:i,strokeWidth:"4",fill:"none"}),r.createElement("polyline",{id:"Path-4",stroke:i,strokeWidth:"4",fill:"none",points:"133 119.331781 192.127357 119.400002 215.445998 80.3916603 203.946476 51.4000015"}),r.createElement("path",{d:"M215.5,80.5 L253.378522,73",id:"Path-5",stroke:i,strokeWidth:"4",fill:"none"}),r.createElement("path",{d:"M192,119.2 L229.854937,164.55391",id:"Path-6",stroke:i,strokeWidth:"4",fill:"none"}))))},c=function(e){var t=e.theme,n=e.selected,o=e.width,i=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:o,height:o+5},r.createElement("g",{transform:"translate(0,7)"},r.createElement("svg",{width:o,height:o,viewBox:"0 0 30 30 "},r.createElement("g",{id:"Group",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},r.createElement("line",{stroke:i,x1:"3.3",y1:"3.8",x2:"27.7",y2:"3.8"}),r.createElement("line",{stroke:i,x1:"3.3",y1:"9.2",x2:"27.7",y2:"9.2"}),r.createElement("line",{stroke:i,x1:"3.3",y1:"14.5",x2:"27.7",y2:"14.5"}),r.createElement("line",{stroke:i,x1:"3.3",y1:"19.9",x2:"27.7",y2:"19.9"}),r.createElement("line",{stroke:i,x1:"3.3",y1:"25.2",x2:"27.7",y2:"25.2"})))))},u=function(e){var t=e.theme,n=e.selected,o=e.width,i=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:o,height:o+5},r.createElement("g",{transform:"translate(0,6)"},r.createElement("svg",{width:o,height:o,viewBox:"0 0 30 30 "},r.createElement("g",{id:"Group",stroke:"none",strokeWidth:"1",fillRule:"evenodd"},r.createElement("rect",{fill:"none",stroke:i,x:"1",y:"1",width:"14",height:"17"}),r.createElement("rect",{fill:"none",stroke:i,x:"15",y:"1",width:"14",height:"17"}),r.createElement("rect",{fill:"none",stroke:i,x:"1",y:"18",width:"28",height:"8"})))))},p=function(e){var t=e.theme,n=e.selected,o=e.width,i=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:o,height:o+5},r.createElement("g",{transform:"translate(0,6)"},r.createElement("svg",{width:o,height:o,viewBox:"0 0 30 30 "},r.createElement("g",{id:"Group",stroke:"none",strokeWidth:"1",fillRule:"evenodd"},r.createElement("rect",{fill:"none",stroke:i,x:"1",y:"1",width:"7",height:"25"}),r.createElement("rect",{fill:"none",stroke:i,x:"8",y:"1",width:"20",height:"25"})))))},f=function(e){var t=e.theme,n=e.selected,o=e.width,i=n?t.selectedColor:t.unselectedColor;return r.createElement("svg",{width:o,height:o+5},r.createElement("g",{transform:"translate(0,7)"},r.createElement("svg",{width:o,height:o,viewBox:"0 0 30 30 "},r.createElement("g",{id:"Group",stroke:"none",strokeWidth:"3",fill:"none",fillRule:"evenodd"},r.createElement("path",{stroke:i,d:"M 11 3 L 1 15 L 11 27"}),r.createElement("path",{stroke:i,d:"M 19 3 L 29 15 L 19 27"})))))}},43153(e,t,n){"use strict";n.d(t,{aX:()=>l,jL:()=>c,l5:()=>s});var r=n(61373),o=n(40952),i=n(93681),a={country:"countries",authors:"authors"},l=function(e,t){return 1===t?"authors"===e&&(e="author"):(e in a&&(e=a[e]),"s"!==e.slice(-1).toLowerCase()&&(e+="s")),e.replace(/_/g," ")},s=function(e){var t="number"==typeof e?(0,r.bq)(e):e,n=t.split("-");return 3===n.length?"".concat(o.US[n[1]]," ").concat(n[0]):t},c=function(e){var t=e.nodes,n=e.visibility,r=e.mainTreeNumTips,o=e.branchLengthsToDisplay,a=e.t,l=(0,i.gY)(t,n),c=(0,i.iE)(t,n),u="";return(u+="divOnly"!==o&&l>0?a("Showing {{x}} of {{y}} genomes sampled between {{from}} and {{to}}",{x:l,y:r,from:s(c[0]),to:s(c[1])}):a("Showing {{x}} of {{y}} genomes",{x:l,y:r}))+"."}},73924(e,t,n){"use strict";n.d(t,{PJ:()=>w,k8:()=>b,m_:()=>g});var r=n(78281),o=n(77313),i=n(28355),a=n(532);function l(e){return l="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},l(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 c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return(t=function(e){var t=function(e){if("object"!=l(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=l(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==l(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var p=o.Ay.div.withConfig({displayName:"filterBadge__BaseContainer",componentId:"sc-f9gznr-0"})(["color:#5097BA;cursor:pointer;font-weight:300;padding:0px 2px 0px 2px;"]),f=(0,o.Ay)(p).withConfig({displayName:"filterBadge__TextContainer",componentId:"sc-f9gznr-1"})(["display:inline-block;cursor:help;margin:0px 0px 0px 2px;"]),d=o.Ay.div.withConfig({displayName:"filterBadge__IconContainer",componentId:"sc-f9gznr-2"})(["cursor:pointer;color:#5097BA;border-width:0px 0px 0px 1px;border-style:solid;border-color:#BDD8E5;*/ min-width:20px;padding:0px 1px 0px 5px;display:inline-block;text-align:center;&:hover,&:focus{& > svg{color:#0071e6;}}& > svg{transform:translate(-2px,2px);}"]),h=(0,o.Ay)(p).withConfig({displayName:"filterBadge__UnselectedFilterTextContainer",componentId:"sc-f9gznr-3"})(["margin:1px 2px 1px 2px;padding:0px 2px 0px 2px;&:hover{text-decoration:underline;}"]),m=(0,o.Ay)(p).withConfig({displayName:"filterBadge__SelectedFilterTextContainer",componentId:"sc-f9gznr-4"})(["background-color:#E9F2F6;border-radius:2px;border:1px solid #BDD8E5;border-width:1;border-radius:2px;margin:0px 2px 0px 0px;&:hover{text-decoration:none;}"]),y=o.Ay.div.withConfig({displayName:"filterBadge__BadgeContainer",componentId:"sc-f9gznr-5"})(["background-color:#E9F2F6;",";display:inline-block;font-size:14px;border-radius:2px;border-width:1px;border-style:solid;border-color:#BDD8E5;"],function(e){return e.striped?"background: repeating-linear-gradient(135deg, #E9F2F6, #E9F2F6 5px, #FFFFFF 5px, #FFFFFF 10px);":""}),v=(0,o.Ay)(a.A).withConfig({displayName:"filterBadge__StyledTooltip",componentId:"sc-f9gznr-6"})(["max-width:30vh;font-weight:400;white-space:normal;line-height:1.2;padding:4px !important;& > br{margin-bottom:10px;}"]),g=function(e){var t=e.id,n=e.children;return r.createElement(v,{place:"bottom",type:"dark",effect:"solid",delayShow:300,id:t},n)},b=function(e){var t=e.remove,n=e.canMakeInactive,o=e.active,a=e.activate,l=e.inactivate,s=e.children,c=e.id,u=e.onHoverMessage,p=void 0===u?"The visible data is being filtered by this":u;return r.createElement(y,{striped:n&&!o},r.createElement(f,{active:!n||o,"data-tip":!0,"data-for":c},s),r.createElement(g,{id:c},n&&!o?"This filter is currently inactive":p),n&&r.createElement(d,{onClick:o?l:a,role:"button",tabIndex:0,"data-tip":!0,"data-for":c+"active"},o?r.createElement(i.$_Y,null):r.createElement(i.QJN,null),r.createElement(g,{id:c+"active"},o?"Inactivate this filter":"Re-activate this filter")),r.createElement(d,{onClick:t,role:"button",tabIndex:0},r.createElement(i.qbC,{"data-tip":!0,"data-for":c+"remove"}),r.createElement(g,{id:c+"remove"},"Remove this filter")))},w=function(e){var t=e.onClick,n=e.extraStyles,o=void 0===n?{}:n,i=e.active,a=e.children,l=i?m:h;return r.createElement("div",{style:c({display:"inline-block"},o)},r.createElement(l,{onClick:t},a))}},36944(e,t,n){"use strict";n.r(t),n.d(t,{default:()=>tp});var r=n(78281),o=n(43979),i=n.n(o),a=n(49633),l=n(77313),s=n(28355),c=n(4124);const u=function(e){var t=e.sidebarOpen,n=e.mobileDisplay,o=e.handler,i={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?c.Uq:c.Ae,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},l=r.createElement(s.QCr,null);return t&&!n?l=r.createElement(s._Jj,null):t||n?t&&n?l=r.createElement(s.QCr,null):!t&&n&&(l=r.createElement(s.QCN,null)):l=r.createElement(s.X6T,null),r.createElement("div",{style:i,onClick:o},r.createElement("div",{style:a},l))};var p,f=n(69646),d=n(26225),h=n(29847);function m(e){return m="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},m(e)}function y(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,v(r.key),r)}}function v(e){var t=function(e){if("object"!=m(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=m(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==m(t)?t:t+""}function g(e,t){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},g(e,t)}function b(e){var t=w();return function(){var n,r=S(e);if(t){var o=S(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==m(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function w(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(w=function(){return!!e})()}function S(e){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},S(e)}var x=(0,a.Ng)(function(e){return{metadata:e.metadata}})(p=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g(e,t)}(a,e);var t,o,i=b(a);function a(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),i.apply(this,arguments)}return t=a,o=[{key:"render",value:function(){var e=this.props.t;return r.createElement(r.Fragment,null,function(e,t){var n=t.buildAvatar,o=t.buildUrl;if("string"==typeof n)return r.createElement(E,{alt:"avatar",width:"28",src:n});if("string"==typeof o){var i=o.match(/(https?:\/\/)?(www\.)?github.com\/([^/]+)/);if(i)return r.createElement(E,{alt:"avatar",width:"28",src:"https://github.com/".concat(i[3],".png?size=200")})}return null}(0,this.props.metadata),function(e,t){if(Object.prototype.hasOwnProperty.call(t,"buildUrl")){var n=t.buildUrl;if("string"==typeof n&&(n.startsWith("https://")||n.startsWith("http://")||n.startsWith("www.")))return r.createElement("span",null,r.createElement(h.x,{i18nKey:"Built with <Link>{{text}}</Link>",values:{text:n.replace(/^(http[s]?:\/\/)/,"").replace(/^www\./,"").replace(/^github.com\//,"")},components:{Link:r.createElement(C,{url:n})}}),". ")}return null}(0,this.props.metadata),function(e,t){var n;return Object.prototype.hasOwnProperty.call(t,"maintainers")&&(n=t.maintainers,Array.isArray(n)&&n.length)?r.createElement("span",null,e("Maintained by")+" ",n.map(function(e,t){return r.createElement(r.Fragment,{key:e.name},e.url?r.createElement(C,{url:e.url},e.name):e.name,t===n.length-1?"":t===n.length-2?" and ":", ")}),". "):null}(e,this.props.metadata),function(e,t){return t.updated?r.createElement("span",null,"".concat(e("Data updated")," ").concat(t.updated,". ")):null}(e,this.props.metadata),function(e,t){if(!Array.isArray(t.dataProvenance))return null;var o,i=t.dataProvenance.filter(function(e){return"object"===m(e)}).filter(function(e){return Object.prototype.hasOwnProperty.call(e,"name")}).map(function(e){if("GISAID"===e.name.toUpperCase())return r.createElement(C,{url:"https://www.gisaid.org",key:e.name},r.createElement("img",{src:n(93397),alt:"gisaid-logo",width:"65"}));var t=function(e){try{return new URL(e).href}catch(e){return!1}}(e.url);return t?r.createElement(C,{url:t,key:e.name},e.name):e.name});return i.length?r.createElement("span",null,e("Enabled by data from")+" ",(o=i).length<2?o:Array.from({length:2*o.length-1}).map(function(e,t){return t%2==0?o[t/2]:t===2*o.length-3?" and ":", "}),"."):null}(e,this.props.metadata))}}],o&&y(t.prototype,o),Object.defineProperty(t,"prototype",{writable:!1}),a}(r.Component))||p,E=l.Ay.img.withConfig({displayName:"byline__AvatarImg",componentId:"sc-wamdqn-0"})(["margin-right:5px;margin-bottom:2px;"]),O=l.Ay.a.withConfig({displayName:"byline__BylineLink",componentId:"sc-wamdqn-1"})(["font-family:",";font-size:15;font-weight:500;"],c.PT);function C(e){var t=e.url,n=e.children;return r.createElement(O,{rel:"noopener noreferrer",href:t,target:"_blank"},n)}const T=(0,f.C)()(x);function _(e){return _="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)}var k;function j(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,P(r.key),r)}}function P(e){var t=function(e){if("object"!=_(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_(t)?t:t+""}function A(e,t){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},A(e,t)}function I(e){var t=M();return function(){var n,r=R(e);if(t){var o=R(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==_(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function M(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(M=function(){return!!e})()}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var N=(0,r.lazy)(function(){return n.e(418).then(n.bind(n,95418))}),D=l.Ay.div.withConfig({displayName:"warning__WarningContainer",componentId:"sc-1wydbe2-0"})(["background-color:#FFF1D1;display:flex;align-items:stretch;"]),L=l.Ay.div.withConfig({displayName:"warning__WarningIconContainer",componentId:"sc-1wydbe2-1"})(["background-color:#FFC641;padding:0 7px;display:flex;align-items:center;"]),B=l.Ay.div.withConfig({displayName:"warning__WarningIcon",componentId:"sc-1wydbe2-2"})(["padding-top:3px;color:white;font-size:24px;"]),z=l.Ay.div.withConfig({displayName:"warning__WarningText",componentId:"sc-1wydbe2-3"})(["padding:0 7px;font-size:15px;"]),F=(0,a.Ng)(function(e){return{warning:e.metadata.warning}})(k=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&A(e,t)}(i,e);var t,n,o=I(i);function i(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),o.apply(this,arguments)}return t=i,n=[{key:"render",value:function(){var e=this.props.warning;return void 0===e?null:r.createElement(r.Suspense,{fallback:null},r.createElement(D,null,r.createElement(L,null,r.createElement(B,null,r.createElement(s.BS8,null))),r.createElement(z,null,r.createElement(N,{mdstring:e,placeholder:"This dataset contained a warning message to be displayed here, however it wasn't correctly formatted."}))))}}],n&&j(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Component))||k;const W=(0,f.C)()(F);var V,H=n(43153),G=n(87473),U=n(86068),q=n(40952),K=n(73924),$=n(93681);function X(e){return X="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},X(e)}function Y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||J(e,t)||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 Q(e){return function(e){if(Array.isArray(e))return Z(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||J(e)||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.")}()}function J(e,t){if(e){if("string"==typeof e)return Z(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Z(e,t):void 0}}function Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ee(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,te(r.key),r)}}function te(e){var t=function(e){if("object"!=X(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=X(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==X(t)?t:t+""}function ne(e,t){return ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ne(e,t)}function re(e){var t=oe();return function(){var n,r=ie(e);if(t){var o=ie(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==X(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function oe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(oe=function(){return!!e})()}function ie(e){return ie=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ie(e)}var ae=function(e){var t=e.id;return r.createElement("span",{style:{fontSize:"2rem",fontWeight:300,padding:"0px 4px 0px 2px",cursor:"help"},"data-tip":!0,"data-for":t},"∩",r.createElement(K.m_,{id:t},"Groups of filters are combined by intersection"))},le=function(){return r.createElement("span",{style:{fontSize:"1.5rem",padding:"0px 3px 0px 2px"}},"∪")},se=r.createElement("span",{style:{fontSize:"2rem",fontWeight:300,padding:"0px 0px 0px 2px"}},"{"),ce=r.createElement("span",{style:{fontSize:"2rem",fontWeight:300,padding:"0px 2px"}},"}"),ue=r.createElement("span",{style:{fontSize:"1.8rem",fontWeight:300,padding:"0px 2px"}},"{"),pe=r.createElement("span",{style:{fontSize:"1.8rem",fontWeight:300,padding:"0px 2px"}},"}"),fe=(0,a.Ng)(function(e){var t,n;return{browserDimensions:e.browserDimensions.browserDimensions,filters:e.controls.filters,animationPlayPauseButton:e.controls.animationPlayPauseButton,metadata:e.metadata,nodes:e.tree.nodes,totalStateCounts:e.tree.totalStateCounts,totalStateCountsSecondTree:null===(t=e.treeToo)||void 0===t?void 0:t.totalStateCounts,visibility:e.tree.visibility,dateMin:e.controls.dateMin,dateMax:e.controls.dateMax,absoluteDateMin:e.controls.absoluteDateMin,absoluteDateMax:e.controls.absoluteDateMax,branchLengthsToDisplay:e.controls.branchLengthsToDisplay,measurementsFilters:e.controls.measurementsFilters,measurementsFields:null===(n=e.measurements.collectionToDisplay)||void 0===n?void 0:n.fields}})(V=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ne(e,t)}(i,e);var t,n,o=re(i);function i(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),o.call(this,e)}return t=i,n=[{key:"createIndividualBadge",value:function(e){var t=this,n=e.filterName,o=e.item,i=e.label,a=e.onHoverMessage;return r.createElement(K.k8,{key:o.value,id:String(o.value),remove:function(){t.props.dispatch((0,G.$h)("remove",n,[o.value]))},canMakeInactive:!0,onHoverMessage:a,active:o.active,activate:function(){t.props.dispatch((0,G.$h)("add",n,[o.value]))},inactivate:function(){t.props.dispatch((0,G.$h)("inactivate",n,[o.value]))}},i)}},{key:"createFilterBadgesForTime",value:function(){var e=this;return[r.createElement(K.k8,{key:"timefilter",id:"timefilter",onHoverMessage:"Filtering to data sampled in this date range",remove:function(){return e.props.dispatch((0,G.hZ)({newMin:e.props.absoluteDateMin,newMax:e.props.absoluteDateMax}))}},"".concat((0,H.l5)(this.props.dateMin)," to ").concat((0,H.l5)(this.props.dateMax)))]}},{key:"createFilterBadges",value:function(e){var t=this,n=e===q.Uf?"sample":e,r=this.props.filters[e].length,o=1===r?"Filtering data to this ".concat(n):"Filtering data to these ".concat(r," ").concat((0,H.aX)(n));return this.props.filters[e].sort(function(e,t){return e.value<t.value?-1:e.value>t.value?1:0}).map(function(n){var r="".concat(n.value);if(e!==q.Uf){var i,a,l=null!==(i=null===(a=t.props.totalStateCounts[e])||void 0===a?void 0:a.get(n.value))&&void 0!==i?i:0;if(t.props.totalStateCountsSecondTree&&Reflect.ownKeys(t.props.totalStateCountsSecondTree).length){var s,c,u=null!==(s=null===(c=t.props.totalStateCountsSecondTree[e])||void 0===c?void 0:c.get(n.value))&&void 0!==s?s:0;r+=" (L: ".concat(l,", R: ").concat(u,")")}else r+=" (".concat(l,")")}return t.createIndividualBadge({filterName:e,item:n,label:r,onHoverMessage:o})})}},{key:"createFilterBadgesForGenotype",value:function(){var e=this,t=this.props.filters[q.IW],n=new Set(t.filter(function(e){return e.active}).map(function(e){return e.value}));return(0,$.oE)(t.map(function(e){return e.value})).map(function(t){var r="nuc"===t[0];if(1===t[2].size){var o=Q(t[2])[0],i=r?"Filtering to sequences with nucleotide ".concat(o," at base ").concat(t[1]):"Filtering to sequences with ".concat((0,q.fn)(o)," at codon ").concat(t[1]," in ").concat(t[0]),a="".concat(t[0]," ").concat(t[1]).concat(o),l={active:n.has(a),value:a};return e.createIndividualBadge({filterName:q.IW,item:l,label:l.value,onHoverMessage:i})}var s=Q(t[2]),c=s.map(function(e){return"".concat(t[0]," ").concat(t[1]).concat(e)}),u=s.filter(function(e,t){return n.has(c[t])}),p=function(e){return e.length>1?"".concat(e.slice(0,-1).join(", ")," or ").concat(e[e.length-1]):e[0]},f=r?"Filtering to sequences with nucleotides ".concat(p(u)," at position ").concat(t[1]):"Filtering to sequences with ".concat(p(u.map(function(e){return(0,q.fn)(e)}))," at codon ").concat(t[1]," in ").concat(t[0]);return s.map(function(r){var o="".concat(t[0]," ").concat(t[1]).concat(r),i={active:n.has(o),value:o};return e.createIndividualBadge({filterName:q.IW,item:i,label:i.value,onHoverMessage:f})})})}},{key:"render",value:function(){var e=this,t=this.props.t,n=[];return Reflect.ownKeys(this.props.filters).filter(function(t){return e.props.filters[t].length>0}).forEach(function(t){t===q.Uf?n.push({name:"sample",badges:e.createFilterBadges(q.Uf)}):t===q.IW?n.push({name:"genotype",badges:e.createFilterBadgesForGenotype()}):n.push({name:t,badges:e.createFilterBadges(t)})}),this.props.dateMin===this.props.absoluteDateMin&&this.props.dateMax===this.props.absoluteDateMax||n.push({name:"temporal",badges:this.createFilterBadgesForTime()}),n.length||Object.keys(this.props.measurementsFilters).length?r.createElement(r.Fragment,null,n.length>0&&r.createElement(r.Fragment,null,t("Filtered to")+" ",n.map(function(e,t){var n=e.badges.length>1,o=0!==t;return r.createElement("span",{style:{fontSize:"2rem",padding:"0px 2px"},key:e.name},o&&r.createElement(ae,{id:"intersect"+t}),n&&se," ",e.badges.map(function(t,n){return Array.isArray(t)?r.createElement("span",{key:t.map(function(e){return e.props.id}).join("")},ue,t.map(function(e,n){return r.createElement("span",{key:e.props.id},e,n!==t.length-1&&r.createElement(le,null))}),pe,n!==e.badges.length-1&&", "):r.createElement("span",{key:t.props.id},t,n!==e.badges.length-1&&", ")}),n&&ce)}),". "),Object.keys(this.props.measurementsFilters).length>0&&void 0!==this.props.measurementsFields&&r.createElement(r.Fragment,null,r.createElement("br",null),t("Measurements filtered to")+" ",Object.entries(this.props.measurementsFilters).map(function(t,n){var o=Y(t,2),i=o[0],a=o[1],l=e.props.measurementsFields.get(i).title;return r.createElement("span",{key:i},se,"".concat(l,": "),Q(a).map(function(t,n){var o=Y(t,2),s=o[0],c=o[1].active;return r.createElement("span",{key:s,style:{fontSize:"2rem",padding:"0px 2px"}},r.createElement(K.k8,{active:c,canMakeInactive:!0,id:String(s),remove:function(){return e.props.dispatch((0,U.Lg)(i,s))},activate:function(){return e.props.dispatch((0,U.Z1)(i,s,!0))},inactivate:function(){return e.props.dispatch((0,U.Z1)(i,s,!1))},onHoverMessage:"Filtering measurements to this ".concat(l)},s),n<a.size-1&&",")}),ce,n<Object.keys(e.props.measurementsFilters).length-1&&r.createElement(ae,null))}))):null}}],n&&ee(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Component))||V;const de=(0,f.C)()(fe);var he=n(98807),me=n(69138),ye=n(22796),ve=l.Ay.div.withConfig({displayName:"editedBanner__Banner",componentId:"sc-1xs4n-0"})(["height:20px;padding:10px;display:flex;justify-content:center;align-items:center;background:#ff8533;color:white;font-size:20px;button{background:inherit;color:inherit;border:none;text-decoration:underline;}"]);function ge(){var e=(0,he.B)().t,t=(0,a.wA)(),n=(0,a.d4)(function(e){return e});if(!n.metadata.loaded)throw new Error("[INTERNAL ERROR] metadata state not loaded");return r.createElement(ve,null,e("This dataset has been edited"),n.metadata.sharing.dataset_json&&r.createElement(r.Fragment,null,r.createElement("button",{onClick:function(){var e=(0,ye.P)();(0,me.hO)(t,n,e)}},e("Click to download")),e("the modified JSON.")))}var be=n(532),we=n(99438),Se=l.Ay.button.withConfig({displayName:"editButton__Button",componentId:"sc-o70bp8-0"})(["float:right;display:inline-flex;justify-content:center;align-items:center;margin:0.1em;padding:0.1em;width:1em;height:1em;"]);function xe(){var e=(0,he.B)().t,t=(0,a.wA)(),n="EditButton";return r.createElement(r.Fragment,null,r.createElement(Se,{"data-tip":!0,"data-for":n,onClick:function(){t({type:we.vN,modal:"datasetEditor"})}},r.createElement(s.Mbp,null)),r.createElement(be.A,{place:"bottom",type:"dark",effect:"solid",id:n},r.createElement(r.Fragment,null,e("Edit dataset"))))}var Ee,Oe=n(8791);function Ce(e){return Ce="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},Ce(e)}function Te(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 _e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Te(Object(n),!0).forEach(function(t){ke(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Te(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ke(e,t,n){return(t=Pe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function je(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,Pe(r.key),r)}}function Pe(e){var t=function(e){if("object"!=Ce(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ce(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ce(t)?t:t+""}function Ae(e,t){return Ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ae(e,t)}function Ie(e){var t=Me();return function(){var n,r=Re(e);if(t){var o=Re(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==Ce(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Me(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Me=function(){return!!e})()}function Re(e){return Re=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Re(e)}var Ne=(0,a.Ng)(function(e){return{browserWidth:e.browserDimensions.browserDimensions.width,animationPlayPauseButton:e.controls.animationPlayPauseButton,metadata:e.metadata,nodes:e.tree.nodes,branchLengthsToDisplay:e.controls.branchLengthsToDisplay,visibility:e.tree.visibility,mobileDisplay:e.general.mobileDisplay}})(Ee=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ae(e,t)}(i,e);var t,n,o=Ie(i);function i(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),o.call(this,e)}return t=i,n=[{key:"render",value:function(){var e=this.props.t;if(!this.props.metadata||!this.props.nodes||!this.props.visibility)return null;var t,n,o,i=(t=this.props.width,o=28,(n=this.props.browserWidth)<1e3&&(o=27),n<800&&(o=26),n<600&&(o=25),n<400&&(o=24),{base:{width:t+34,display:"inline-block",maxWidth:t,marginTop:0},title:{fontFamily:c.SW,fontSize:o,marginLeft:0,marginTop:0,marginBottom:5,fontWeight:500,color:c.KD,letterSpacing:"-0.5px",lineHeight:1.2},n:{fontFamily:c.PT,fontSize:14,marginLeft:2,marginTop:5,marginBottom:5,fontWeight:500,color:c.ib,lineHeight:1.4},byline:{fontFamily:c.PT,fontSize:15,marginLeft:2,marginTop:5,marginBottom:5,fontWeight:500,color:"#555",lineHeight:1.4,verticalAlign:"middle"}}),a="Pause"===this.props.animationPlayPauseButton,l=!a;return r.createElement(d.A,{center:!0,infocard:!0},r.createElement("div",{style:i.base},(0,Oe.DC)()&&!this.props.mobileDisplay&&this.props.metadata.edited&&r.createElement(ge,null),r.createElement("div",{width:this.props.width,style:i.title},(0,Oe.DC)()&&!this.props.mobileDisplay&&r.createElement(xe,null),this.props.metadata.title||""),r.createElement("div",{width:this.props.width,style:i.byline},r.createElement(T,null)),r.createElement("div",{width:this.props.width},r.createElement(W,null)),r.createElement("div",{width:this.props.width,style:i.n},a?e("Animation in progress")+". ":null,l&&r.createElement(r.Fragment,null,(0,H.jL)(_e(_e({},this.props),{},{mainTreeNumTips:this.props.metadata.mainTreeNumTips})),r.createElement(de,null)))))}}],n&&je(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Component))||Ee;const De=(0,f.C)()(Ne);var Le=n(89270);const Be=(0,a.Ng)(function(e){if(!e.metadata.loaded)throw new Error("[INTERNAL ERROR] Tree component instantiated before metadata loaded=true");return{tree:e.tree,treeToo:e.treeToo,selectedNode:e.controls.selectedNode,dateMinNumeric:e.controls.dateMinNumeric,dateMaxNumeric:e.controls.dateMaxNumeric,filters:e.controls.filters,quickdraw:e.controls.quickdraw,colorBy:e.controls.colorBy,colorByConfidence:e.controls.colorByConfidence,layout:e.controls.layout,legendPlacement:e.metadata.legendPlacements.tree,scatterVariables:e.controls.scatterVariables,temporalConfidence:e.controls.temporalConfidence,distanceMeasure:e.controls.distanceMeasure,explodeAttr:e.controls.explodeAttr,focus:e.controls.focus,colorScale:e.controls.colorScale,colorings:e.metadata.colorings,genomeMap:e.entropy.genomeMap,showTreeToo:e.controls.showTreeToo,showTangle:e.controls.showTangle,showStreamTrees:e.controls.showStreamTrees,panelsToDisplay:e.controls.panelsToDisplay,selectedBranchLabel:e.controls.selectedBranchLabel,canRenderBranchLabels:e.controls.canRenderBranchLabels,showAllBranchLabels:e.controls.showAllBranchLabels,tipLabelKey:e.controls.tipLabelKey,narrativeMode:e.narrative.display,animationPlayPauseButton:e.controls.animationPlayPauseButton,showOnlyPanels:e.controls.showOnlyPanels,performanceFlags:e.controls.performanceFlags}})(Le.Ay);var ze=n(17904),Fe=n(40769),We=n(51914),Ve=n.n(We),He=n(97805),Ge=n(57900),Ue=n(62617),qe=n(95401),Ke=n(84596),$e=n(22137);function Xe(e){return Xe="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},Xe(e)}function Ye(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,Qe(r.key),r)}}function Qe(e){var t=function(e){if("object"!=Xe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Xe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Xe(t)?t:t+""}function Je(e,t){return Je=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Je(e,t)}function Ze(e){var t=et();return function(){var n,r=tt(e);if(t){var o=tt(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==Xe(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function et(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(et=function(){return!!e})()}function tt(e){return tt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},tt(e)}function nt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var rt=l.Ay.div.withConfig({displayName:"choose-dataset__DatasetSelectContainer",componentId:"sc-v04nsa-0"})(["cursor:pointer;padding-top:20px;&:hover ","{color:",";}"],$e.Dg,function(e){return e.theme.selectedColor}),ot=(0,l.Ay)($e.Dg).withConfig({displayName:"choose-dataset__DatasetName",componentId:"sc-v04nsa-1"})(["font-size:16px;"]),it=l.Ay.div.withConfig({displayName:"choose-dataset__ChangeDatasetRow",componentId:"sc-v04nsa-2"})(["padding-top:5px;"]),at=(0,l.Ay)($e.Dg).withConfig({displayName:"choose-dataset__ChangeDatasetLabel",componentId:"sc-v04nsa-3"})(["display:flex;align-items:center;gap:6px;"]),lt=(0,l.Ay)(s.KSO).withConfig({displayName:"choose-dataset__SearchIcon",componentId:"sc-v04nsa-4"})(["position:relative;top:1px;"]);function st(){var e,t=window.location.pathname.replace(/^\//,"").replace(/\/$/,"").split(":")[0].split("/"),n=t.at(-1);if(n&&n.includes("@")){var r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return nt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nt(e,t):void 0}}(e,t)||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.")}()}(n.split("@"),2),o=r[0],i=r[1];t[t.length-1]=o,e=i}return{parts:t,snapshot:e}}var ct="sidebar-dataset-change",ut=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Je(e,t)}(i,e);var t,n,o=Ze(i);function i(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),o.apply(this,arguments)}return t=i,(n=[{key:"render",value:function(){var e,t,n=this;if(null===(e=this.props.available)||void 0===e||null===(t=e.datasets)||void 0===t||!t.length)return null;var o=st();return r.createElement(rt,{id:"dataset-select",role:"button",tabIndex:0,"aria-label":"Change dataset",onClick:function(){n.props.dispatch({type:we.vN,modal:"datasetSelector"})}},r.createElement(ot,null,o.parts.join(" / ")+(o.snapshot?" @ ".concat(o.snapshot):"")),r.createElement(it,{id:ct},r.createElement(at,null,r.createElement(lt,null),this.props.t("sidebar:change dataset"))))}}])&&Ye(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Component);const pt=(0,f.C)()((0,a.Ng)(function(e){return{available:e.controls.available}})(ut));function ft(e){return ft="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},ft(e)}function dt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=vt(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},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 i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function ht(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 mt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ht(Object(n),!0).forEach(function(t){Ct(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ht(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function yt(e){return function(e){if(Array.isArray(e))return gt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||vt(e)||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.")}()}function vt(e,t){if(e){if("string"==typeof e)return gt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gt(e,t):void 0}}function gt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function bt(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,Tt(r.key),r)}}function wt(e,t){return wt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},wt(e,t)}function St(e){var t=Et();return function(){var n,r=Ot(e);if(t){var o=Ot(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==ft(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return xt(e)}(this,n)}}function xt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Et(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Et=function(){return!!e})()}function Ot(e){return Ot=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ot(e)}function Ct(e,t,n){return(t=Tt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tt(e){var t=function(e){if("object"!=ft(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ft(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ft(t)?t:t+""}var _t=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&wt(e,t)}(i,e);var t,n,o=St(i);function i(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),Ct(xt(t=o.call(this,e)),"handleKeyDown",function(e){"Enter"===e.key&&(e.preventDefault(),e.stopPropagation(),t.changeDataset())}),Ct(xt(t),"changeDataset",function(){var e,n=window.NEXTSTRAIN;n&&n.animationTickReference&&(clearInterval(n.animationTickReference),n.animationTickReference=null,t.props.dispatch({type:we.x$,data:"Play"})),t.props.dispatch((0,qe.yd)({path:(e=t.state.proposedDataset,e.parts.join("/")+(e.snapshot?"@".concat(e.snapshot):""))}))}),Ct(xt(t),"updateProposedParts",function(e,n){for(var r={parts:[].concat(yt(t.state.proposedDataset.parts.slice(0,e)),[n]),snapshot:t.state.proposedDataset.snapshot},o=t.options(r.parts);o.length>0;){var i=o.map(function(e){return e.value}),a=t.state.currentDataset.parts[r.parts.length];i.includes(a)?r.parts.push(a):r.parts.push(i[0]),o=t.options(r.parts)}var l=r.parts.join("/");t.props.snapshotDatasets.has(l)?t.state.snapshotInput&&At(t.state.snapshotInput)&&(r.snapshot=t.state.snapshotInput):r.snapshot=void 0,t.setState({proposedDataset:r})}),Ct(xt(t),"updateProposedSnapshot",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;t.setState({proposedDataset:{parts:t.state.proposedDataset.parts,snapshot:e||void 0}})}),Ct(xt(t),"snapshotsAvailable",function(){var e=t.state.proposedDataset.parts.join("/");return t.props.snapshotDatasets.has(e)}),Ct(xt(t),"options",function(e){var n,r=mt({},t.props.available.dataset),o=dt(e);try{for(o.s();!(n=o.n()).done;){var i=r[n.value];if("object"!==ft(i))return[];r=mt({},i)}}catch(e){o.e(e)}finally{o.f()}var a=Array.from(Object.keys(r));return a.map(function(e){return{value:e,label:1===a.length?"".concat(e," (only available option)"):e}})}),Ct(xt(t),"renderLevel",function(e,n){var o=t.options(t.state.proposedDataset.parts.slice(0,n)),i={paddingLeft:"0px",paddingTop:"10px"};return 0===o.length?r.createElement("div",{style:i},"Unexpected error!"):r.createElement("div",{key:n,style:i},r.createElement(Ke.A,{menuPortalTarget:document.body,menuPosition:"fixed",styles:{menuPortal:function(e){return mt(mt({},e),{},{zIndex:9999})},option:function(e){return mt(mt({},e),{},{fontSize:"14px"})},control:function(e){return mt(mt({},e),{},{backgroundColor:1===o.length?"#e0e0e0":e.backgroundColor,width:"500px",maxWidth:"90%"})}},options:o,isClearable:!1,isSearchable:!0,isMulti:!1,isDisabled:1===o.length,value:o.filter(function(t){return t.value===e}),onChange:function(e){return t.updateProposedParts(n,e.value)}}))}),Ct(xt(t),"renderDatasetName",function(e,t){var n=e.parts.flatMap(function(n,o){var i=t&&t.parts[o]!==n?{color:"orange"}:{};return[r.createElement(jt,{style:i,key:n},n),o+1===e.parts.length?null:r.createElement("span",{key:n+"slash"}," / ")]});if(e.snapshot){n.push(r.createElement("span",{key:"snapshot-symbol"}," @ "));var o=t&&t.snapshot!==e.snapshot?{color:"orange"}:{};n.push(r.createElement(jt,{style:o,key:"snapshot-value"},e.snapshot))}return n}),Ct(xt(t),"renderSnapshot",function(){var e=t.state.snapshotInput,n=""!==e&&!At(e);return r.createElement("div",{style:{paddingLeft:"0px",paddingTop:"10px"}},r.createElement("div",{style:{position:"relative",maxWidth:"300px",width:"90%"}},r.createElement("input",{type:"text",placeholder:"(optional) YYYY-MM-DD snapshot",style:mt(mt({},{width:"100%",padding:"8px",paddingRight:"32px",fontSize:"14px",border:"1px solid hsl(0, 0%, 80%)",borderRadius:"4px",backgroundColor:"white",outline:"none",boxSizing:"border-box"}),{},{color:n?"red":void 0}),value:e,onChange:function(e){var n=e.target.value;t.setState({snapshotInput:n}),(""===n||At(n))&&t.updateProposedSnapshot(n||void 0)},onFocus:function(e){e.target.style.borderColor="hsl(0, 0%, 70%)"},onBlur:function(e){e.target.style.borderColor="hsl(0, 0%, 80%)"}}),e&&r.createElement("span",{style:{position:"absolute",right:"8px",top:"50%",transform:"translateY(-50%)",cursor:"pointer",color:"hsl(0, 0%, 60%)",display:"flex",alignItems:"center"},onClick:function(){t.setState({snapshotInput:""}),t.updateProposedSnapshot("")}},r.createElement(s._Hm,{size:16}))))});var n=st();return t.state={currentDataset:n,proposedDataset:mt({},n),snapshotInput:n.snapshot||"",loadButtonHovered:!1},t}return t=i,(n=[{key:"renderDatasetLoader",value:function(){var e=this;return r.createElement("button",{style:{marginTop:"10px",background:this.state.loadButtonHovered?"#f1f1f1":"#fafafa",border:"1px solid #888",borderRadius:"5px",padding:5,cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",fontSize:"14px",maxWidth:"90%"},onClick:this.changeDataset,onMouseEnter:function(){return e.setState({loadButtonHovered:!0})},onMouseLeave:function(){return e.setState({loadButtonHovered:!1})}},r.createElement(s.gSK,{color:"#888"}),"LOAD PROPOSED DATASET (or press enter)")}},{key:"render",value:function(){return r.createElement("div",{onKeyDownCapture:this.handleKeyDown},"Select a new dataset by changing the hierarchical selectors below",r.createElement("p",null),r.createElement("span",{style:{display:"inline-block",width:120}},"Current dataset:"),this.renderDatasetName(this.state.currentDataset),r.createElement("br",null),r.createElement("span",{style:{display:"inline-block",width:120}},"Proposed dataset:"),this.renderDatasetName(this.state.proposedDataset,this.state.currentDataset),this.state.proposedDataset.parts.map(this.renderLevel),this.snapshotsAvailable()&&this.renderSnapshot(),this.renderDatasetLoader(),r.createElement("br",null),r.createElement("h3",null,"How does this work?"),"Changing intermediate levels of the selected dataset results in a new set of possible options for lower levels in the hierarchy;\n if possible we'll use the previous value for new levels but this may not be possible. ","You can compare the current dataset against the proposed one above the selectors, with differences shown in orange. ","Changing intermediate levels of the selected dataset results in a new set of possible options for lower levels in the hierarchy.",r.createElement("br",null),"The full complement of datasets all available datasets are available here, you may need to ",r.createElement("a",{href:"/"},"go back to the main page")," to access other resources.")}}])&&bt(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Component);const kt=(0,f.C)()((0,a.Ng)(function(e){return t=e.controls.available,o={},i=new Set,a=function(e){var t,n={},r=dt(e);try{for(r.s();!(t=r.n()).done;){var o=t.value;o.snapshots&&i.add(o.request);for(var a=o.request.split("/"),l=n,s=0;s<a.length;s++){var c=a[s];if(s===a.length-1)l[c]=!0;else{!0!==l[c]&&l[c]||(l[c]={});var u=l[c];"object"===ft(u)&&(l=u)}}}}catch(e){r.e(e)}finally{r.f()}return n},null!=t&&null!==(n=t.datasets)&&void 0!==n&&n.length&&(o.dataset=a(t.datasets)),null!=t&&null!==(r=t.narratives)&&void 0!==r&&r.length&&(o.narrative=a(t.narratives)),{available:o,snapshotDatasets:i};var t,n,r,o,i,a})(_t));function jt(e){var t=e.style,n=void 0===t?{}:t,o=e.children;return r.createElement("span",{style:mt(mt({},n),{},{fontWeight:700})},o)}var Pt={container:function(e){return e.backgroundColor="rgba(0, 0, 0, .30)",e.display=void 0,e},panel:function(e,t){var n,r=null===(n=document.querySelector("#".concat(ct)))||void 0===n?void 0:n.getBoundingClientRect(),o=t.width<500+2*((null==r?void 0:r.left)||0);return e.left=o?5:null==r?void 0:r.left,e.top=null==r?void 0:r.top,e.padding="2%",e.color="#1f2328",e.backgroundColor="#ffffff",o?(e.width=t.width-10,e.maxWidth=e.width):(e.minWidth=500,e.width=.5*t.width),e}};function At(e){if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;var t=e.split("-").map(function(e){return parseInt(e,10)});return!(0===t[1]||t[1]>12||0===t[2]||t[2]>31)}var It=n(60516),Mt=n(51924),Rt=n(57758),Nt=n(5300);function Dt(e){return Dt="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},Dt(e)}function Lt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Bt(e,t,n){return(t=function(e){var t=function(e){if("object"!=Dt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Dt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Dt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zt(e){var t=e.dismissModal,n=(0,he.B)().t,o=(0,a.wA)(),i=(0,a.d4)(function(e){return e.controls.colorScale}),l=(0,a.d4)(function(e){if(!e.metadata.loaded)throw new Error("[INTERNAL ERROR] metadata state not loaded");return e.metadata.colorings[i.colorBy]}),s=(0,r.useRef)(null);return(0,r.useEffect)(function(){return Ve().bind("enter",function(){var e;null===(e=s.current)||void 0===e||e.requestSubmit()}),Ve().bind("escape",function(){t()}),function(){Ve().unbind("enter"),Ve().unbind("escape")}},[t]),r.createElement(Nt.qF,{ref:s,onSubmit:function(e){e.preventDefault();var n=i.legendValues.map(function(t){return[t,e.target[t].dataset.color]}),r={edited:!0,attributes:Bt({},i.colorBy,{key:i.colorBy,name:null==l?void 0:l.title,scaleType:null==l?void 0:l.type,strains:{},colors:n})};o((0,Mt.D)(r,!0,!1)),t()}},r.createElement("h2",null,n("Edit colors for")," ",i.colorBy),r.createElement(Vt,{legendValues:i.legendValues,scale:i.scale}),r.createElement(It.A,{justifyContent:"center"},r.createElement("button",{type:"submit",style:{margin:10}},n("Apply changes")),r.createElement("button",{type:"button",style:{margin:10},onClick:t},n("Discard changes"))))}var Ft,Wt={container:function(e){return e.backgroundColor="rgba(0, 0, 0, .30)",e},panel:function(e){return e.padding="2em",e.color="#1f2328",e.backgroundColor="#ffffff",e}};function Vt(e){var t=e.legendValues,n=e.scale,o=Math.ceil(t.length/2),i=t.slice(0,o),a=t.slice(o);function l(e){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Lt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lt(e,t):void 0}}(e,t)||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.")}()}((0,r.useState)((0,Rt.Uh)(n(e))),2),o=t[0],i=t[1],a=(0,Rt.GQ)(o),l="color-".concat(e);return r.createElement("div",{key:e,className:"row",style:{margin:"5px"}},r.createElement("div",{className:"col-xs-12"},r.createElement(It.A,{justifyContent:"flex-start",alignContent:"center"},r.createElement("input",{name:e,id:l,type:"color",style:{borderColor:a},value:o,"data-color":a,onChange:function(e){return i(e.target.value)}}),r.createElement("label",{htmlFor:l},e))))}return r.createElement("div",{className:"row"},r.createElement("div",{className:"col-xs-6"},i.map(function(e){return l(e)})),r.createElement("div",{className:"col-xs-6"},a.map(function(e){return l(e)})))}function Ht(e){return Ht="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},Ht(e)}function Gt(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 Ut(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gt(Object(n),!0).forEach(function(t){qt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qt(e,t,n){return(t=$t(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kt(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,$t(r.key),r)}}function $t(e){var t=function(e){if("object"!=Ht(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ht(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ht(t)?t:t+""}function Xt(e,t){return Xt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Xt(e,t)}function Yt(e){var t=Jt();return function(){var n,r=Zt(e);if(t){var o=Zt(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==Ht(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Qt(e)}(this,n)}}function Qt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Jt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Jt=function(){return!!e})()}function Zt(e){return Zt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Zt(e)}var en=(0,a.Ng)(function(e){return{browserDimensions:e.browserDimensions.browserDimensions,modal:e.controls.modal}})(Ft=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Xt(e,t)}(i,e);var t,n,o=Yt(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=o.call(this,e)).dismissModal=t.dismissModal.bind(Qt(t)),t}return t=i,n=[{key:"componentDidMount",value:function(){var e=this;Ve().bind("d",function(){e.props.dispatch({type:we.vN,modal:e.props.modal?null:"download"})})}},{key:"componentWillUnmount",value:function(){Ve().unbind("d")}},{key:"dismissModal",value:function(){this.props.dispatch({type:we.vN,modal:null})}},{key:"styles",value:function(){var e=Ut({container:function(e){return e},panel:function(e){return e},dismissMsg:function(e){return e}},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),t=e.container(Ut({},c.vS.modalContainer),this.props.broswerDimensions),n=e.dismissMsg(Ut({},c.vS.topRightMessage),this.props.broswerDimensions),r=Ut({},c.vS.panel);return r.width=.66*this.props.browserDimensions.width,r.maxWidth=r.width,r.maxHeight=.66*this.props.browserDimensions.height,r.fontSize=14,r.lineHeight=1.4,{container:t,panel:e.panel(Ut({},r),this.props.browserDimensions),dismissMsg:n}}},{key:"render",value:function(){var e,t=this.props.t,n=null,o=!0;switch(this.props.modal){case"download":n=Ge.A,e=this.styles();break;case"linkOut":n=Ue.Y,e=this.styles();break;case"datasetSelector":n=kt,e=this.styles(Pt);break;case"datasetEditor":n=Oe.Ay,e=this.styles(Oe.gd),o=!1;break;case"colorByEditor":n=zt,e=this.styles(Wt),o=!1;break;default:return null}return r.createElement("div",{style:e.container,onClick:o&&this.dismissModal},r.createElement("div",{style:e.panel,onClick:function(e){return(0,He.C6)(e)}},o&&r.createElement("p",{style:e.dismissMsg},"(",t("click outside this box to return to the app"),")"),r.createElement(n,{dismissModal:this.dismissModal})))}}],n&&Kt(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Component))||Ft;const tn=(0,f.C)()(en);var nn,rn,on=n(49901),an=n(479),ln=["text/csv","text/tab-separated-values","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],sn=function(e){return ln.includes(e.type)||function(e){return""===e.type&&e.name.endsWith(".tsv")}(e)||function(e){return"application/vnd.ms-excel"===e.type&&e.name.endsWith(".csv")}(e)},cn=function(e){return"application/json"===e.type||e.name.endsWith(".json")},un=n(58143);function pn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=dn(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},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 i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function fn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||dn(e,t)||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 dn(e,t){if(e){if("string"==typeof e)return hn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hn(e,t):void 0}}function hn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function mn(e,t,n,r,o,i,a){try{var l=e[i](a),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(r,o)}function yn(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){mn(i,r,o,a,l,"next",e)}function l(e){mn(i,r,o,a,l,"throw",e)}a(void 0)})}}function vn(e,t){return gn.apply(this,arguments)}function gn(){return(gn=yn(regeneratorRuntime.mark(function e(t,n){var r,o,i,a,l,s,c,u,p,f,d;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Sn(t);case 2:return r=e.sent,o=r.fileName,i=r.csvString,e.next=7,bn(i);case 7:if(a=e.sent,l=a.errors,s=a.data,c=a.meta,!l.length){e.next=13;break}throw new Error(l.map(function(e){return e.message}).join(", "));case 13:if(u=En(c.fields),p=u.colorings,f=u.header,Cn(p,f,s,n),0!==p.length){e.next=17;break}throw new Error("No valid columns");case 17:if(0!==(p=p.filter(function(e){return Object.keys(e.strains).length})).length){e.next=20;break}throw new Error("No matching nodes found in tree");case 20:return On(p,o),d=f.latLongKeys?_n(s,p,f,"".concat(o,"_geo")):[],e.abrupt("return",{attributes:Object.fromEntries(p.map(function(e){return[e.attrName,{key:e.attrName,name:e.attrName,scaleType:e.scaleType,strains:e.strains,colors:e.colors}]})),geographic:d});case 23:case"end":return e.stop()}},e)}))).apply(this,arguments)}function bn(e){return wn.apply(this,arguments)}function wn(){return(wn=yn(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(nn){e.next=4;break}return e.next=3,Promise.resolve().then(n.t.bind(n,67016,23));case 3:nn=e.sent.default;case 4:return e.abrupt("return",new Promise(function(e,n){nn.parse(t,{header:!0,complete:function(t){e(t)},error:function(e){n(e)},encoding:"UTF-8",comments:"#",delimiter:",",skipEmptyLines:!0,dynamicTyping:!1})}));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Sn(e){return xn.apply(this,arguments)}function xn(){return xn=yn(regeneratorRuntime.mark(function e(t){var r,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.name,o=new FileReader,e.abrupt("return",new Promise(function(e,i){o.onload=function(){var t=yn(regeneratorRuntime.mark(function t(a){var l,s,c;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,rn){t.next=5;break}return t.next=4,n.e(737).then(n.t.bind(n,69737,23));case 4:rn=t.sent.default;case 5:l=rn.read(o.result,{type:"binary",raw:!0}),s=l.Sheets[l.SheetNames[0]],c=rn.utils.sheet_to_csv(s),e({fileName:r,csvString:c}),t.next=14;break;case 11:t.prev=11,t.t0=t.catch(0),i(t.t0);case 14:case"end":return t.stop()}},t,null,[[0,11]])}));return function(e){return t.apply(this,arguments)}}(),o.onerror=i,o.readAsBinaryString(t)}));case 3:case"end":return e.stop()}},e)})),xn.apply(this,arguments)}function En(e){var t=e[0],n=new Set(["name","div","vaccine","labels","hidden","mutations","url","authors","accession","traits","children"]);n.add("num_date").add("year").add("month").add("date");var r=new Set(["__latitude","__longitude","latitude","longitude"]),o=new Set,i=e.slice(1).map(function(e){if(n.has(e))return o.add(e),null;if(r.has(e)||""===e)return null;var t=e;if(e.includes("__")){var i=fn(e.split("__"),2),a=i[0],l=i[1];if(["shape","colour","color"].includes(l))return null;"autocolour"===l&&(t=a)}return{attrName:t,colors:[],fieldName:e,colorScaleFieldName:void 0,scaleType:"categorical",strains:{}}}).filter(function(e){return!!e}).map(function(t){return e.includes("".concat(t.attrName,"__colour"))?t.colorScaleFieldName="".concat(t.attrName,"__colour"):e.includes("".concat(t.attrName,"__color"))&&(t.colorScaleFieldName="".concat(t.attrName,"__color")),t}),a=e.includes("latitude")&&e.includes("longitude")?{latitude:"latitude",longitude:"longitude"}:e.includes("__latitude")&&e.includes("__longitude")?{latitude:"__latitude",longitude:"__longitude"}:void 0;return{colorings:i,header:{fields:e,strainKey:t,latLongKeys:a,ignoredFields:o}}}function On(e,t){e.push({attrName:t,scaleType:"boolean",strains:Object.fromEntries(e.flatMap(function(e){return Array.from(Object.keys(e.strains))}).map(function(e){return[e,{value:"Strains in ".concat(t)}]})),colors:[],colorScaleFieldName:void 0})}function Cn(e,t,n,r){var o,i=pn(e);try{for(i.s();!(o=i.n()).done;){var a=o.value;if(a.fieldName){var l={},s=a.fieldName;if(!t.ignoredFields.has(s)&&s!==t.strainKey){var c,u=pn(n);try{for(u.s();!(c=u.n()).done;){var p=c.value,f=p[t.strainKey];if(r.has(f)){var d=p[s];if(d&&(a.strains[f]={value:d},a.colorScaleFieldName)){var h=p[a.colorScaleFieldName];h&&(l[d]||(l[d]=[]),l[d].push(h))}}}}catch(e){u.e(e)}finally{u.f()}var m=Object.entries(l).map(function(e){var t=fn(e,2);return[t[0],Tn(t[1])]}).filter(function(e){return null!==e[1]});m.length&&(a.colors=m)}}else console.error("[internal error] fieldName not set")}}catch(e){i.e(e)}finally{i.f()}}function Tn(e){if(0===e.length)return null;var t=e.filter(function(e){return e.match(/^#[A-Fa-f0-9]{3}([A-Fa-f0-9]{3})?$/)});if(t.length!==e.length){var n=Array.from(new Set(e).difference(new Set(t)));console.warn("Validation of color hexes dropped these invalid values: ".concat(n.join(", ")))}if(0===t.length)return null;if(1===t.length)return e[0];var r=0,o=0,i=0;t.forEach(function(e){var t=(0,un.Qh)(e);r+=t.r,o+=t.g,i+=t.b});var a=t.length;return(0,un.Qh)(r/a,o/a,i/a).toString()}function _n(e,t,n,r){var o,i=[n.latLongKeys.latitude,n.latLongKeys.longitude],a=i[0],l=i[1],s=new Map,c=0,u=pn(e);try{for(u.s();!(o=u.n()).done;){var p=o.value,f=p[n.strainKey],d=[Number(p[a]),Number(p[l])],h=d[0],m=d[1];if(!(isNaN(h)||isNaN(m)||h>90||h<-90||m>180||m<-180)){var y=String(p[a])+String(p[l]);if(!s.has(y)){var v="deme_".concat(c++);s.set(y,{deme:v,latitude:h,longitude:m,strains:new Set})}s.get(y).strains.add(f)}}}catch(e){u.e(e)}finally{u.f()}var g,b={key:r,demes:{}},w={attrName:r,scaleType:"categorical",strains:{},colors:[],colorScaleFieldName:void 0},S=pn(s.values());try{for(S.s();!(g=S.n()).done;){var x=g.value,E=x.deme,O=x.latitude,C=x.longitude,T=x.strains;b.demes[E]={latitude:O,longitude:C};var _,k=pn(T);try{for(k.s();!(_=k.n()).done;){var j=_.value;w.strains[j]={value:E}}}catch(e){k.e(e)}finally{k.f()}}}catch(e){S.e(e)}finally{S.f()}return t.push(w),[b]}function kn(e){return kn="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},kn(e)}function jn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Pn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pn(e,t):void 0}}(e,t)||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 Pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function An(e,t,n,r,o,i,a){try{var l=e[i](a),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(r,o)}function In(e,t){return Mn.apply(this,arguments)}function Mn(){var e;return e=regeneratorRuntime.mark(function e(t,n){var r,o,i,a,l,s,c,u,p,f,d,h,m,y,v,g,b;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.text();case 2:if(r=e.sent,e.prev=3,"object"===kn(o=JSON.parse(r))&&null!==o&&!Array.isArray(o)){e.next=7;break}throw new Error("".concat(t.name," is not a JSON object "));case 7:if("nodes"in o&&"object"===kn(o.nodes)&&null!==o.nodes&&!Array.isArray(o.nodes)){e.next=9;break}throw new Error("".concat(t.name,' does not have a valid "nodes" key'));case 9:e.next=14;break;case 11:throw e.prev=11,e.t0=e.catch(3),new Error("Failed to parse ".concat(t.name," as JSON: ").concat(e.t0 instanceof Error?e.t0.message:String(e.t0)));case 14:i={},a=o.nodes,l={},s=0,c=Object.entries(a);case 18:if(!(s<c.length)){e.next=45;break}if(u=jn(c[s],2),p=u[0],f=u[1],n.has(p)){e.next=22;break}return e.abrupt("continue",42);case 22:if("object"===kn(f)&&null!==f&&!Array.isArray(f)){e.next=24;break}return e.abrupt("continue",42);case 24:d=0,h=Object.entries(f);case 25:if(!(d<h.length)){e.next=42;break}if(m=jn(h[d],2),y=m[0],v=m[1],!y.endsWith("_confidence")&&!y.endsWith("_entropy")){e.next=29;break}return e.abrupt("continue",39);case 29:if("string"==typeof v||"number"==typeof v||"boolean"==typeof v){e.next=31;break}return e.abrupt("continue",39);case 31:Object.hasOwn(i,y)||(i[y]=new Set),i[y].add(kn(v)),l[y]||(l[y]={key:y,name:y,scaleType:"categorical",strains:{}}),l[y].strains[p]={value:v},(g=f["".concat(y,"_confidence")])&&("string"==typeof v?"object"!==kn(g)||null===g||Array.isArray(g)||Object.values(g).every(function(e){return"number"==typeof e})&&(l[y].strains[p].confidence=g):"number"==typeof v&&Array.isArray(g)&&2===g.length&&g.every(function(e){return"number"==typeof e})&&(l[y].strains[p].confidence=g)),"number"==typeof(b=f["".concat(y,"_entropy")])&&(l[y].strains[p].entropy=b);case 39:d++,e.next=25;break;case 42:s++,e.next=18;break;case 45:return l=Object.fromEntries(Object.entries(l).map(function(e){var t=jn(e,2),n=t[0];return Rn(n,t[1],i[n])}).filter(function(e){return!!e})),e.abrupt("return",{attributes:l});case 47:case"end":return e.stop()}},e,null,[[3,11]])}),Mn=function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){An(i,r,o,a,l,"next",e)}function l(e){An(i,r,o,a,l,"throw",e)}a(void 0)})},Mn.apply(this,arguments)}function Rn(e,t,n){if(n.size>1){console.warn("Added coloring '".concat(t.name,"' has mixed data types - some information may be dropped. Please fix the JSON."));for(var r=0,o=Object.entries(t.strains);r<o.length;r++){var i=jn(o[r],2),a=i[0],l=i[1];t.strains[a]={value:String(l.value)}}}if(1===n.size&&n.has("number")?t.scaleType="continuous":1===n.size&&n.has("boolean")&&(t.scaleType="boolean"),Object.keys(t.strains).length)return[e,t]}function Nn(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Dn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dn(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},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 i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function Dn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ln(e,t,n,r,o,i,a){try{var l=e[i](a),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(r,o)}function Bn(e,t){var n=new Set(e.nodes.map(function(e){return e.name}));return Array.isArray(t.nodes)&&t.nodes.forEach(function(e){return n.add(e.name)}),n}var zn,Fn=n(13287),Wn=n(61373);function Vn(e){return Vn="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},Vn(e)}function Hn(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,Gn(r.key),r)}}function Gn(e){var t=function(e){if("object"!=Vn(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Vn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Vn(t)?t:t+""}function Un(e,t){return Un=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Un(e,t)}function qn(e){var t=Kn();return function(){var n,r=$n(e);if(t){var o=$n(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==Vn(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Kn(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Kn=function(){return!!e})()}function $n(e){return $n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},$n(e)}n(66565);var Xn=(0,a.Ng)(function(e){return{animationPlayPauseButton:e.controls.animationPlayPauseButton,absoluteDateMaxNumeric:e.controls.absoluteDateMaxNumeric,absoluteDateMinNumeric:e.controls.absoluteDateMinNumeric,dateMinNumeric:e.controls.dateMinNumeric,dateMaxNumeric:e.controls.dateMaxNumeric,mapAnimationCumulative:e.controls.mapAnimationCumulative,mapAnimationShouldLoop:e.controls.mapAnimationShouldLoop,mapAnimationDurationInMilliseconds:e.controls.mapAnimationDurationInMilliseconds}})(zn=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Un(e,t)}(o,e);var t,n,r=qn(o);function o(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),r.call(this,e)}return t=o,(n=[{key:"componentDidMount",value:function(){this.maybeAnimate()}},{key:"componentDidUpdate",value:function(){this.maybeAnimate()}},{key:"render",value:function(){return null}},{key:"maybeAnimate",value:function(){var e=this;if("Pause"===this.props.animationPlayPauseButton&&!window.NEXTSTRAIN.animationTickReference){var t=this.props.absoluteDateMaxNumeric-this.props.absoluteDateMinNumeric,n=q.WE*t/this.props.mapAnimationDurationInMilliseconds,r=q.tF*t;this.props.dateMaxNumeric-this.props.dateMinNumeric<1.3*r?window.NEXTSTRAIN.animationStartPoint&&window.NEXTSTRAIN.animationEndPoint||(window.NEXTSTRAIN.animationStartPoint=this.props.dateMinNumeric,window.NEXTSTRAIN.animationEndPoint=this.props.absoluteDateMaxNumeric):(window.NEXTSTRAIN.animationStartPoint=this.props.dateMinNumeric,window.NEXTSTRAIN.animationEndPoint=this.props.dateMaxNumeric);var o=this.props.dateMinNumeric,i=o+r;this.props.dispatch({type:we.R3}),window.NEXTSTRAIN.animationTickReference=setInterval(function(){if("Play"===e.props.animationPlayPauseButton)return clearInterval(window.NEXTSTRAIN.animationTickReference),void(window.NEXTSTRAIN.animationTickReference=null);e.props.dispatch((0,G.hZ)({newMin:(0,Wn.bq)(o),newMax:(0,Wn.bq)(i),quickdraw:!0})),e.props.mapAnimationCumulative||(o+=n),(i+=n)>=window.NEXTSTRAIN.animationEndPoint&&(e.props.mapAnimationShouldLoop?(o=window.NEXTSTRAIN.animationStartPoint,i=o+r):(clearInterval(window.NEXTSTRAIN.animationTickReference),window.NEXTSTRAIN.animationTickReference=null,e.props.dispatch({type:we.x$,data:"Play"}),e.props.dispatch((0,G.hZ)({newMin:(0,Wn.bq)(window.NEXTSTRAIN.animationStartPoint),newMax:(0,Wn.bq)(window.NEXTSTRAIN.animationEndPoint),quickdraw:!1})),window.NEXTSTRAIN.animationStartPoint=void 0,window.NEXTSTRAIN.animationEndPoint=void 0))},q.WE)}}}])&&Hn(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),o}(r.Component))||zn;const Yn=Xn;var Qn=n(4379);function Jn(e){return Jn="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},Jn(e)}function Zn(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 er(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zn(Object(n),!0).forEach(function(t){tr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function tr(e,t,n){return(t=function(e){var t=function(e){if("object"!=Jn(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Jn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Jn(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var nr=l.Ay.div.withConfig({displayName:"styles__NarrativeStyles",componentId:"sc-19vjmtz-0"})(["top:",";font-weight:300;font-size:14px;line-height:1.3;@media (max-width:1080px){font-size:13px;line-height:1.1;}p,h1,h2,h3,h4,li,table{color:",";}table,th,td{border:1px solid;}td,th{padding:3px;}h1{font-weight:700;font-size:2em;margin-bottom:30px;@media (max-width:1080px){font-size:1.8em;margin-bottom:10px;}}h2{font-weight:500;font-size:1.8em;@media (max-width:1080px){font-size:1.6em;}}h3{font-weight:500;font-size:1.6em;@media (max-width:1080px){font-size:1.4em;}}h4{font-weight:500;font-size:1.4em;@media (max-width:1080px){font-size:1.2em;}}div p{text-align:justify;margin:10px 0px;font-weight:inherit;line-height:inherit;}li{margin:10px 0px 10px 0px;font-weight:inherit;line-height:inherit;}table{width:100%;}strong{font-weight:500;background-color:inherit;font-size:inherit;line-height:inherit;}img{display:block;margin-left:auto;margin-right:auto;width:90%;padding:15px 0px 15px 0px;}figcaption{font-style:italic;font-size:0.9em;text-align:center;margin-bottom:15px;}#NarrativeBlock_0{margin-top:15px;}#NarrativeBlock_0 h3{font-weight:inherit;font-size:1.2em;}#NarrativeBlock_0 h4{text-align:justify;font-size:inherit;margin:0;margin-bottom:30px;font-weight:inherit;font-style:italic;line-height:inherit;}#NarrativeBlock_0 .explanation{text-align:justify;font-size:inherit;color:",";margin:0;margin-bottom:30px;font-weight:inherit;font-style:italic;line-height:inherit;}#NarrativeBlock_0 sup{font-size:65%;vertical-align:super;}"],function(e){return e.narrativeNavBarHeight+"px"},function(e){return e.theme.unselectedColor},function(e){return e.theme.selectedColor}),rr=l.Ay.div.withConfig({displayName:"styles__OpacityFade",componentId:"sc-19vjmtz-1"})(["z-index:200;position:absolute;background-image:",";width:100%;height:30px;",";",";"],function(e){return"linear-gradient(to ".concat(e.position,", rgba(255, 255, 255, 0), ").concat(e.theme.background,")")},function(e){return"top"===e.position&&"top: ".concat(e.topHeight,"px")},function(e){return"bottom"===e.position&&"bottom: 0px;"}),or={color:"#5097BA",textDecoration:"none",cursor:"pointer",fontFamily:'"Lato", "Helvetica Neue", "Helvetica", "sans-serif"',fontWeight:"400",fontSize:"1.8em"},ir=l.Ay.div.withConfig({displayName:"styles__ProgressBar",componentId:"sc-19vjmtz-2"})(["width:100%;background-color:inherit;box-shadow:0px -3px 3px -3px rgba(0,0,0,0.2) inset;display:flex;flex-direction:row;justify-content:space-evenly;align-items:center;"]),ar=l.Ay.div.withConfig({displayName:"styles__ProgressButton",componentId:"sc-19vjmtz-3"})(["background:#74a9cf;border-radius:50%;cursor:pointer;transition:transform .1s;align-self:center;margin:auto;&:hover{transform:scale(3);}"]),lr=(0,l.AH)(["width:100%;color:white;font-size:24px;font-weight:500;cursor:pointer;display:flex;align-items:center;justify-content:center;"]),sr=l.Ay.div.withConfig({displayName:"styles__EndOfNarrative",componentId:"sc-19vjmtz-4"})(["text-align:center;display:grid;grid-template-rows:1fr;grid-row-gap:10px;"]),cr=l.Ay.nav.withConfig({displayName:"styles__MobileBannerTop",componentId:"sc-19vjmtz-5"})([""," top:0;height:","px;background-color:#E67F2C;"],lr,function(e){return e.height}),ur=l.Ay.nav.withConfig({displayName:"styles__MobileBannerBottom",componentId:"sc-19vjmtz-6"})([""," bottom:0;height:","px;background-color:#65B0A4;"],lr,function(e){return e.height}),pr=l.Ay.div.withConfig({displayName:"styles__MobileContentContainer",componentId:"sc-19vjmtz-7"})(["min-height:","px;max-height:","px;overflow-y:scroll;color:",";background-color:",";font-weight:300;font-size:14px;line-height:1.3;"],function(e){return e.height},function(e){return e.height},function(e){return e.theme.unselectedColor},function(e){return e.theme.background}),fr=n(15031),dr=n.n(fr),hr=n(4836),mr=n.n(hr),yr=n(64398),vr=n.n(yr);function gr(e){return gr="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},gr(e)}function br(e){return function(e){if(Array.isArray(e))return wr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return wr(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wr(e,t):void 0}}(e)||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.")}()}function wr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Sr(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,kr(r.key),r)}}function xr(e,t){return xr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},xr(e,t)}function Er(e){var t=Cr();return function(){var n,r=Tr(e);if(t){var o=Tr(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==gr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Or(e)}(this,n)}}function Or(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Cr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Cr=function(){return!!e})()}function Tr(e){return Tr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Tr(e)}function _r(e,t,n){return(t=kr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kr(e){var t=function(e){if("object"!=gr(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=gr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==gr(t)?t:t+""}var jr,Pr=Symbol(),Ar=Symbol(),Ir=Symbol(),Mr=Symbol(),Rr=Symbol(),Nr=Symbol(),Dr=Symbol(),Lr=Symbol(),Br=Symbol(),zr=200,Fr=25,Wr=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xr(e,t)}(i,e);var t,n,o=Er(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),_r(Or(t=o.call(this,e)),"componentDidMount",function(){window.addEventListener("resize",t[Nr]),document.ontouchmove=function(e){e.preventDefault()},t._pageContainer.addEventListener("wheel",t[Ir]),t._pageContainer.addEventListener("touchmove",t[Mr]),t._pageContainer.addEventListener("keydown",t[Rr]);var e=[];mr()(t.props.children[t.state.componentIndex])?e.push(r.createElement("div",{ref:function(e){return t["container_"+t.state.componentIndex]=e},style:{height:"calc(100% - 20px)",width:"100%",paddingBottom:"20px"}},t.props.children)):e.push(r.createElement("div",{key:t.state.componentIndex,ref:function(e){return t["container_"+t.state.componentIndex]=e},style:{height:"calc(100% - 20px)",width:"100%",paddingBottom:"20px"}},t.props.children[t.state.componentIndex])),t[Dr](e)}),_r(Or(t),"componentWillUnmount",function(){window.removeEventListener("resize",t[Nr]),t._pageContainer.removeEventListener("wheel",t[Ir]),t._pageContainer.removeEventListener("touchmove",t[Mr]),t._pageContainer.removeEventListener("keydown",t[Rr])}),_r(Or(t),"goToPage",function(e){var n=t.props,o=n.pageOnChange,i=n.children,a=t.state.componentIndex,l=br(t.state.componentsToRender);if(!dr()(a,e))if(mr()(t["container_"+e])||t[Ar]){if(!t[Ar]&&!mr()(i[e])){for(var s=function(e){l.push(r.createElement("div",{key:e,ref:function(n){return t["container_"+e]=n},style:{height:"calc(100% - 20px)",width:"100%",paddingBottom:"20px"}},i[e]))},c=l.length;c<=e;c++)s(c);mr()(i[e+1])||l.push(r.createElement("div",{key:e+1,ref:function(n){return t["container_"+(e+1)]=n},style:{height:"calc(100% - 20px)",width:"100%",paddingBottom:"20px"}},i[e+1])),t[Ar]=!0,t.setState({componentsToRender:l},function(){t._pageContainer.style.transform="translate3d(0, ".concat(-100*e,"%, 0)"),o&&o(e+1),setTimeout(function(){t.setState({componentIndex:e},function(){t[Ar]=!1,t[Pr]=null})},t.props.animationTimer+zr)})}}else t[Ar]=!0,t._pageContainer.style.transform="translate3d(0, ".concat(-100*e,"%, 0)"),o&&o(e+1),mr()(t["container_"+(e+1)])&&!mr()(i[e+1])&&l.push(r.createElement("div",{key:e+1,ref:function(n){return t["container_"+(e+1)]=n},style:{height:"calc(100% - 20px)",width:"100%",paddingBottom:"20px"}},i[e+1])),setTimeout(function(){t.setState({componentIndex:e,componentsToRender:l},function(){t[Ar]=!1,t[Pr]=null})},t.props.animationTimer+zr)}),t.state={componentIndex:0,componentsToRender:[]},t[Pr]=null,t[Ar]=!1,t[Ir]=function(e){e.deltaY<0?t[Lr](-e.deltaY):t[Br](e.deltaY)},t[Mr]=function(e){vr()(t[Pr])?t[Pr]=e.touches[0].clientY:e.touches[0].clientY>t[Pr]?t[Lr](Fr):t[Br](Fr)},t[Rr]=function(e){dr()(e.keyCode,38)&&t[Lr](Fr),dr()(e.keyCode,40)&&t[Br](Fr)},t[Nr]=function(){t.forceUpdate()},t[Dr]=function(e){var n=[];mr()(e)||(n=br(e)),(n=[].concat(br(n),br(t.state.componentsToRender)))[t.state.componentIndex+1]||mr()(t.props.children[t.state.componentIndex+1])||n.push(r.createElement("div",{key:t.state.componentIndex+1,ref:function(e){return t["container_"+(t.state.componentIndex+1)]=e},style:{height:"100%",width:"100%",overflow:"hidden"}},t.props.children[t.state.componentIndex+1])),t.setState({componentsToRender:br(n)})},t[Lr]=function(e){mr()(t["container_"+(t.state.componentIndex-1)])||t[Ar]?t.props.scrollUnavailable&&t.props.scrollUnavailable():0===t["container_"+t.state.componentIndex].getElementsByTagName("div")[0].scrollTop&&e>=Fr&&(t[Ar]=!0,t._pageContainer.style.transform="translate3d(0, ".concat(-100*(t.state.componentIndex-1),"%, 0)"),t.props.pageOnChange&&t.props.pageOnChange(t.state.componentIndex),setTimeout(function(){t.setState(function(e){return{componentIndex:e.componentIndex-1}},function(){t[Ar]=!1,t[Pr]=null})},t.props.animationTimer+zr))},t[Br]=function(e){if(mr()(t["container_"+(t.state.componentIndex+1)])||t[Ar])t.props.scrollUnavailable&&t.props.scrollUnavailable();else{var n=t["container_"+t.state.componentIndex].getElementsByTagName("div")[0];n.scrollTop===n.scrollHeight-n.clientHeight&&e>=Fr&&(t[Ar]=!0,t._pageContainer.style.transform="translate3d(0, ".concat(-100*(t.state.componentIndex+1),"%, 0)"),t.props.pageOnChange&&t.props.pageOnChange(t.state.componentIndex+2),setTimeout(function(){t.setState(function(e){return{componentIndex:e.componentIndex+1}},function(){t[Ar]=!1,t[Pr]=null,t[Dr]()})},t.props.animationTimer+zr))}},t}return t=i,(n=[{key:"render",value:function(){var e=this,t=this.props,n=t.animationTimer,o=t.transitionTimingFunction,i=t.containerHeight;return t.containerWidth,r.createElement("div",{id:"PageScroller",style:{height:i,width:"inherit",overflow:"hidden",padding:"0px 0px 0px 0px"}},r.createElement("div",{ref:function(t){return e._pageContainer=t},tabIndex:0,style:{height:"100%",width:"100%",transition:"transform ".concat(n,"ms ").concat(o)}},this.state.componentsToRender))}}])&&Sr(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Component);function Vr(e){return Vr="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},Vr(e)}function Hr(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 Gr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hr(Object(n),!0).forEach(function(t){Ur(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ur(e,t,n){return(t=Kr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qr(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,Kr(r.key),r)}}function Kr(e){var t=function(e){if("object"!=Vr(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Vr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Vr(t)?t:t+""}function $r(e,t){return $r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},$r(e,t)}function Xr(e){var t=Yr();return function(){var n,r=Qr(e);if(t){var o=Qr(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==Vr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Yr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Yr=function(){return!!e})()}function Qr(e){return Qr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Qr(e)}_r(Wr,"propTypes",{animationTimer:i().number,transitionTimingFunction:i().string,pageOnChange:i().func,scrollUnavailable:i().func,containerHeight:i().number,containerWidth:i().number}),_r(Wr,"defaultProps",{animationTimer:1e3,transitionTimingFunction:"ease-in-out",containerHeight:window.innerHeight,containerWidth:window.innerWidth});var Jr=(0,a.Ng)(function(e){return{loaded:e.narrative.loaded,blocks:e.narrative.blocks,currentInFocusBlockIdx:e.narrative.blockIdx}})(jr=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&$r(e,t)}(i,e);var t,n,o=Xr(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=o.call(this,e)).goToSlide=function(e){var n=e-1;t.props.dispatch((0,qe.yd)(eo(t.props.blocks,t.props.currentInFocusBlockIdx,n)))},t.goToNextSlide=function(){t.props.currentInFocusBlockIdx!==t.props.blocks.length-1&&t.reactPageScroller.goToPage(t.props.currentInFocusBlockIdx+1)},t.goToPreviousSlide=function(){0!==t.props.currentInFocusBlockIdx&&t.reactPageScroller.goToPage(t.props.currentInFocusBlockIdx-1)},t}return t=i,(n=[{key:"componentDidMount",value:function(){window.twttr&&window.twttr.ready&&window.twttr.widgets.load(),0!==this.props.currentInFocusBlockIdx&&this.reactPageScroller.goToPage(this.props.currentInFocusBlockIdx),Ve().bind(["left","up"],this.goToPreviousSlide),Ve().bind(["right","down"],this.goToNextSlide)}},{key:"renderChevron",value:function(e){var t={zIndex:200,position:"absolute",cursor:"pointer",left:"".concat(this.props.width/2-15,"px"),fontSize:"".concat(30,"px"),height:"".concat(30,"px")};e&&(t.top=q.iY+25),t.bottom=e?0:"5px";var n=e?r.createElement(s.Ucs,null):r.createElement(s.Vr3,null);return r.createElement("div",{id:"hand".concat(e?"Up":"Down"),style:t,onClick:e?this.goToPreviousSlide:this.goToNextSlide},n)}},{key:"renderProgress",value:function(){var e=this;return r.createElement(ir,{style:{height:"".concat(25,"px")},role:"navigation"},this.props.blocks.map(function(t,n){var o=e.props.currentInFocusBlockIdx===n?"14px":"6px";return r.createElement(ar,{key:n,style:{width:o,height:o},onClick:function(){return e.reactPageScroller.goToPage(n)}})}))}},{key:"renderBlocks",value:function(){var e=this;return this.props.blocks.map(function(t,n){if(t.isEndOfNarrativeSlide)return r.createElement(sr,{key:"EON",id:"EndOfNarrative"},r.createElement("h1",null,"END OF NARRATIVE"),r.createElement("a",{style:Gr({},or),onClick:function(){return e.reactPageScroller.goToPage(0)}},"Scroll back to the beginning"),r.createElement("br",null),r.createElement("a",{style:Gr({},or),onClick:function(){return e.props.dispatch({type:we.IZ,narrativeOn:!1})}},"Leave the narrative & explore the data yourself"));var o=0===n?'\n <p class="explanation">\n Explore the narrative by scrolling on the left panel, or click "explore the data yourself" in the top right to interact with the data.\n </p>\n'+t.__html:t.__html;return r.createElement("div",{dir:"auto",id:"NarrativeBlock_".concat(n),key:n,style:{padding:"10px 20px",height:"inherit",overflowX:"hidden",overflowY:"auto"},dangerouslySetInnerHTML:{__html:o}})})}},{key:"render",value:function(){var e=this;return this.props.loaded?r.createElement(nr,{id:"NarrativeContainer",narrativeNavBarHeight:q.iY},this.renderProgress(),r.createElement(rr,{position:"top",topHeight:q.iY+25}),r.createElement(rr,{position:"bottom"}),0!==this.props.currentInFocusBlockIdx?this.renderChevron(!0):null,this.props.currentInFocusBlockIdx!==this.props.blocks.length-1?this.renderChevron(!1):null,r.createElement(Wr,{ref:function(t){e.reactPageScroller=t},containerHeight:this.props.height-25,pageOnChange:this.goToSlide},this.renderBlocks())):null}},{key:"componentWillUnmount",value:function(){Ve().unbind(["left","right","up","down"])}}])&&qr(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Component))||jr;const Zr=Jr;function eo(e,t,n){var r={query:{n},push:!0};return e[t].dataset!==e[n].dataset&&(r.path=e[n].dataset,r.changeDatasetOnly=!0),r}var to,no,ro=n(2122),oo=n(38624),io=n.n(oo),ao=n(68087),lo=n(21143);function so(e){return so="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},so(e)}function co(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 uo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?co(Object(n),!0).forEach(function(t){go(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):co(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function po(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,bo(r.key),r)}}function fo(e,t){return fo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},fo(e,t)}function ho(e){var t=yo();return function(){var n,r=vo(e);if(t){var o=vo(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==so(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return mo(e)}(this,n)}}function mo(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function yo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(yo=function(){return!!e})()}function vo(e){return vo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},vo(e)}function go(e,t,n){return(t=bo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bo(e){var t=function(e){if("object"!=so(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=so(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==so(t)?t:t+""}var wo=(0,a.Ng)(function(e){return{colorBy:e.controls.colorBy,colorings:e.metadata.colorings,genomeMap:e.entropy.genomeMap}})((no=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&fo(e,t)}(i,e);var t,n,o=ho(i);function i(e){var t;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),go(mo(t=o.call(this,e)),"dispatchColorByGenotype",io()(function(e){t.dispatchColorBy(e,"genotype")},400)),t.BLANK_STATE={colorBySelected:"",geneSelected:"",positionSelected:""},(0,lo.Sv)(e.colorBy)){var n=(0,lo.kh)(e.colorBy);n&&(t.state=t.newState({colorBySelected:"gt",geneSelected:n.gene,positionSelected:n.positions.join(",")}))}else t.state=t.newState({colorBySelected:e.colorBy});return t}return t=i,n=[{key:"replaceState",value:function(e){var t=this;this.setState(function(n,r){return t.newState(e)})}},{key:"newState",value:function(e){return uo(uo({},this.BLANK_STATE),e)}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){if(this.props.colorBy!==e.colorBy)if((0,lo.Sv)(e.colorBy)){var t=(0,lo.kh)(e.colorBy);t&&this.replaceState({colorBySelected:"gt",geneSelected:t.gene,positionSelected:t.positions.join(",")})}else this.replaceState({colorBySelected:e.colorBy})}},{key:"componentDidUpdate",value:function(){var e=this.state.colorBySelected;if("gt"===e){var t=this.state,n=t.geneSelected,r=t.positionSelected;if(n&&r){var o=(0,lo.KC)({gene:n,positions:(0,lo.rr)(r,(0,lo.TT)(this.props.genomeMap,n))});o&&o!==this.props.colorBy&&this.dispatchColorByGenotype(o)}}else this.dispatchColorBy(e)}},{key:"shouldComponentUpdate",value:function(e,t){return this.state.colorBySelected!==t.colorBySelected||this.state.geneSelected!==t.geneSelected||this.state.positionSelected!==t.positionSelected||this.props.colorings!==e.colorings}},{key:"dispatchColorBy",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;(0,on.H2)("color-by-".concat(t)),this.props.dispatch((0,ao.p)(e))}},{key:"getGtGeneOptions",value:function(){var e,t;if(null===(e=this.props.genomeMap)||void 0===e||!e.length)return[];var n=!0===(null===(t=this.props.genomeMap)||void 0===t?void 0:t[0].proteinOnly)?[]:[{value:q.Sc,label:"nucleotide"}];return this.props.genomeMap[0].genes.forEach(function(e){e.cds.forEach(function(e){n.push({value:e.name,label:e.name})})}),n}},{key:"gtGeneSelect",value:function(){var e=this,t=this.getGtGeneOptions();return r.createElement(Ke.A,{name:"selectGenotype",id:"selectGenotype",placeholder:"gene…",value:t.filter(function(t){return t.value===e.state.geneSelected}),options:t,isClearable:!1,isSearchable:!0,isMulti:!1,onChange:function(t){e.setState({geneSelected:t.value})}})}},{key:"gtPositionInput",value:function(){var e=this,t=this.state.geneSelected,n=t?"".concat(t," position (1–").concat((0,lo.TT)(this.props.genomeMap,t),")…"):"position…";return r.createElement("input",{type:"text",style:c.H$,placeholder:n,value:this.state.positionSelected,onChange:function(t){e.setState({positionSelected:t.target.value})}})}},{key:"isNormalInteger",value:function(e){var t=Math.floor(Number(e));return String(t)===e&&t>=0}},{key:"getStyles",value:function(){return{base:{width:q.zR,marginBottom:0,fontSize:14}}}},{key:"render",value:function(){var e=this,t=this.getStyles(),n=Object.keys(this.props.colorings).map(function(t){return{value:t,label:e.props.colorings[t].title}});return r.createElement("div",{style:t.base,id:"selectColorBy"},r.createElement(Ke.A,{name:"selectColorBy",value:n.filter(function(t){return t.value===e.state.colorBySelected}),options:n,isClearable:!1,isSearchable:!0,isMulti:!1,onChange:function(t){e.replaceState({colorBySelected:t.value})}}),"gt"===this.state.colorBySelected?r.createElement("div",null,this.gtGeneSelect(),this.gtPositionInput()):null)}}],n&&po(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Component),go(no,"propTypes",{colorBy:i().string.isRequired,colorings:i().object.isRequired,dispatch:i().func.isRequired,genomeMap:i().array}),to=no))||to,So=r.createElement(r.Fragment,null,"Change the metadata field which the visualisation is coloured by.",r.createElement("br",null),"The phylogeny, map and frequencies panel (if available) will all be coloured in a consistent fashion.");const xo=wo;var Eo=n(6429),Oo=n.n(Eo),Co=n(25714),To=n.n(Co),_o=n(33606),ko=n.n(_o);function jo(e){return jo="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},jo(e)}function Po(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 Ao(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Po(Object(n),!0).forEach(function(t){Io(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Po(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Io(e,t,n){return(t=function(e){var t=function(e){if("object"!=jo(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=jo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==jo(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Mo={base:{position:"relative",borderRadius:6},horizontalSlider:{width:"100%",height:12},verticalSlider:{maxHeight:500,width:12,border:"1px solid grey"},handle:{fontSize:"0.9em",textAlign:"center",backgroundColor:"#FAFAFA",color:"white",border:"1px solid #555",cursor:"pointer",height:12,width:12,borderRadius:12,top:-4},bar:{position:"relative",backgroundColor:"rgb(200,200,200)",borderRadius:2},unselectedBar:{backgroundColor:"#777",height:1,top:2},selectedBar:{backgroundColor:"#CCC",height:6}};function Ro(e){return e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.cancelBubble=!0,e.returnValue=!1,!1}function No(e){return null==e?[]:Array.isArray(e)?e:[e]}function Do(e){return null!=e&&1===e.length?e[0]:e}var Lo=Oo()({displayName:"Slider",propTypes:{min:i().number,max:i().number,step:i().number,minDistance:i().number,defaultValue:i().oneOfType([i().number,i().arrayOf(i().number)]),value:i().oneOfType([i().number,i().arrayOf(i().number)]),orientation:i().oneOf(["horizontal","vertical"]),className:i().string,handleClassName:i().string,handleActiveClassName:i().string,withBars:i().bool,barClassName:i().string,pearling:i().bool,disabled:i().bool,snapDragDisabled:i().bool,invert:i().bool,onBeforeChange:i().func,onChange:i().func,onAfterChange:i().func,onSliderClick:i().func},getDefaultProps:function(){return{min:0,max:100,step:1e-5,minDistance:0,defaultValue:0,orientation:"horizontal",className:"slider",handleClassName:"handle",handleActiveClassName:"active",barClassName:"bar",withBars:!1,pearling:!1,disabled:!1,snapDragDisabled:!1,invert:!1}},getInitialState:function(){var e=this._or(No(this.props.value),No(this.props.defaultValue));this.tempArray=e.slice();for(var t=[],n=0;n<e.length;n++)e[n]=this._trimAlignValue(e[n],this.props),t.push(n);return{index:-1,upperBound:208,sliderLength:220,handleSize:12,sliderStart:20,value:e,zIndices:t}},UNSAFE_componentWillReceiveProps:function(e){var t=this._or(No(e.value),this.state.value);this.tempArray=t.slice();for(var n=[],r=0;r<t.length;r++)n[r]=this._trimAlignValue(t[r],e);this.setState({value:n})},_or:function(e,t){var n=r.Children.count(this.props.children);switch(n){case 0:return e.length>0?e:t;case e.length:return e;case t.length:return t;default:return e.length===n&&t.length===n||console.warn(this.constructor.displayName+": Number of values does not match number of children."),function(e,t,n){for(var r=(t-e)/(n-1),o=[],i=0;i<n;i++)o.push(e+r*i);return o}(this.props.min,this.props.max,n)}},getValue:function(){return Do(this.state.value)},_calcOffset:function(e){return(e-this.props.min)/(this.props.max-this.props.min)*this.state.upperBound},_calcValue:function(e){return e/this.state.upperBound*(this.props.max-this.props.min)+this.props.min},_buildHandleStyle:function(e,t){var n={position:"absolute",willChange:this.state.index>=0?this._posMinKey():""};return n[this._posMinKey()]=e+"px",n},_getClosestIndex:function(e){for(var t=Number.MAX_VALUE,n=-1,r=this.state.value,o=r.length,i=0;i<o;i++){var a=this._calcOffset(r[i]),l=Math.abs(e-a);l<t&&(t=l,n=i)}return n},_calcOffsetFromPosition:function(e){var t=e-this.state.sliderStart;return this.props.invert&&(t=this.state.sliderLength-t),t-this.state.handleSize/2},_forceValueFromPosition:function(e,t){var n=this._calcOffsetFromPosition(e),r=this._getClosestIndex(n),o=this._trimAlignValue(this._calcValue(n)),i=this.state.value.slice();i[r]=o;for(var a=0;a<i.length-1;a+=1)if(i[a+1]-i[a]<this.props.minDistance)return;this.setState({value:i},t.bind(this,r))},_getMousePosition:function(e){return[e["page"+this._axisKey()],e["page"+this._orthogonalAxisKey()]]},_getTouchPosition:function(e){var t=e.touches[0];return[t["page"+this._axisKey()],t["page"+this._orthogonalAxisKey()]]},_getMouseEventMap:function(){return{mousemove:this._onMouseMove,mouseup:this._onMouseUp}},_getTouchEventMap:function(){return{touchmove:this._onTouchMove,touchend:this._onTouchEnd}},_createOnMouseDown:function(e){return function(t){if(!this.props.disabled){var n=this._getMousePosition(t);this._start(e,n[0]),this._addHandlers(this._getMouseEventMap()),Ro(t)}}.bind(this)},_createOnTouchStart:function(e){return function(t){if(!(this.props.disabled||t.touches.length>1)){var n=this._getTouchPosition(t);this.startPosition=n,this.isScrolling=void 0,this._start(e,n[0]),this._addHandlers(this._getTouchEventMap()),function(e){e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0}(t)}}.bind(this)},_addHandlers:function(e){for(var t in e)document.addEventListener(t,e[t],!1)},_removeHandlers:function(e){for(var t in e)document.removeEventListener(t,e[t],!1)},_start:function(e,t){document.activeElement&&document.activeElement!==document.body&&document.activeElement.blur(),this.hasMoved=!1,this._fireChangeEvent("onBeforeChange");var n=this.state.zIndices;n.splice(n.indexOf(e),1),n.push(e),this.setState({startValue:this.state.value[e],startPosition:t,index:e,zIndices:n})},_onMouseUp:function(){this._onEnd(this._getMouseEventMap())},_onTouchEnd:function(){this._onEnd(this._getTouchEventMap())},_onEnd:function(e){this._removeHandlers(e),this.setState({index:-1},this._fireChangeEvent.bind(this,"onAfterChange"))},_onMouseMove:function(e){var t=this._getMousePosition(e);this._move(t[0])},_onTouchMove:function(e){if(!(e.touches.length>1)){var t=this._getTouchPosition(e);if(void 0===this.isScrolling){var n=t[0]-this.startPosition[0],r=t[1]-this.startPosition[1];this.isScrolling=Math.abs(r)>Math.abs(n)}this.isScrolling?this.setState({index:-1}):(Ro(e),this._move(t[0]))}},_move:function(e){this.hasMoved=!0;var t=this.props,n=this.state,r=n.index,o=n.value,i=o.length,a=o[r],l=e-n.startPosition;t.invert&&(l*=-1);var s=l/(n.sliderLength-n.handleSize)*(t.max-t.min),c=this._trimAlignValue(n.startValue+s),u=t.minDistance;if(!t.pearling){if(r>0){var p=o[r-1];c<p+u&&(c=p+u)}if(r<i-1){var f=o[r+1];c>f-u&&(c=f-u)}}o[r]=c,t.pearling&&i>1&&(c>a?(this._pushSucceeding(o,u,r),this._trimSucceeding(i,o,u,t.max)):c<a&&(this._pushPreceding(o,u,r),this._trimPreceding(i,o,u,t.min))),c!==a&&this.setState({value:o},this._fireChangeEvent.bind(this,"onChange"))},_pushSucceeding:function(e,t,n){var r,o;for(o=e[r=n]+t;null!=e[r+1]&&o>e[r+1];o=e[++r]+t)e[r+1]=this._alignValue(o)},_trimSucceeding:function(e,t,n,r){for(var o=0;o<e;o++){var i=r-o*n;t[e-1-o]>i&&(t[e-1-o]=i)}},_pushPreceding:function(e,t,n){var r,o;for(o=e[r=n]-t;null!=e[r-1]&&o<e[r-1];o=e[--r]-t)e[r-1]=this._alignValue(o)},_trimPreceding:function(e,t,n,r){for(var o=0;o<e;o++){var i=r+o*n;t[o]<i&&(t[o]=i)}},_axisKey:function(){var e=this.props.orientation;return"horizontal"===e?"X":"vertical"===e?"Y":"X"},_orthogonalAxisKey:function(){var e=this.props.orientation;return"horizontal"===e?"Y":"vertical"===e?"X":"Y"},_posMinKey:function(){var e=this.props.orientation;return"horizontal"===e?this.props.invert?"right":"left":"vertical"===e?this.props.invert?"bottom":"top":this.props.invert?"right":"left"},_posMaxKey:function(){var e=this.props.orientation;return"horizontal"===e?this.props.invert?"left":"right":"vertical"===e?this.props.invert?"top":"bottom":this.props.invert?"left":"right"},_sizeKey:function(){var e=this.props.orientation;return"horizontal"===e?"clientWidth":"vertical"===e?"clientHeight":"clientWidth"},_trimAlignValue:function(e,t){return this._alignValue(this._trimValue(e,t),t)},_trimValue:function(e,t){return e<=(t=t||this.props).min&&(e=t.min),e>=t.max&&(e=t.max),e},_alignValue:function(e,t){var n=(e-(t=t||this.props).min)%t.step,r=e-n;return 2*Math.abs(n)>=t.step&&(r+=n>0?t.step:-t.step),parseFloat(r.toFixed(5))},_renderHandle:function(e,t){var n=this.props.handleClassName+" "+this.props.handleClassName+"-"+t+" "+(this.state.index===t?this.props.handleActiveClassName:"");return r.createElement("div",{ref:"handle"+t,key:"handle"+t,className:n,style:Ao(Ao({},Mo.handle),e),onMouseDown:this._createOnMouseDown(t),onTouchStart:this._createOnTouchStart(t)})},_renderHandles:function(e){for(var t=e.length,n=this.tempArray,r=0;r<t;r++)n[r]=this._buildHandleStyle(e[r],r);for(var o=this.tempArray,i=0;i<t;i++)o[i]=this._renderHandle(n[i],i);return o},_buildBarStyle:function(e,t){var n={position:"absolute",willChange:this.state.index>=0?this._posMinKey()+","+this._posMaxKey():""};return n[this._posMinKey()]=e,n[this._posMaxKey()]=t,n},_renderBar:function(e,t,n){var o=this.props.barClassName+" "+this.props.barClassName+"-"+e,i=this._buildBarStyle(t,this.state.upperBound-n);return i=0===e&&!ko()(this.props.defaultValue)||1===e&&ko()(this.props.defaultValue)?To()({},i,Mo.selectedBar):To()({},i,Mo.unselectedBar),r.createElement("div",{key:"bar"+e,ref:"bar"+e,className:o,style:Ao(Ao({},Mo.bar),i)})},_renderBars:function(e){var t=[],n=e.length-1;t.push(this._renderBar(0,0,e[0]));for(var r=0;r<n;r++)t.push(this._renderBar(r+1,e[r],e[r+1]));return t.push(this._renderBar(n+1,e[n],this.state.upperBound)),t},_onSliderMouseDown:function(e){var t=this;if(!this.props.disabled){if(this.hasMoved=!1,!this.props.snapDragDisabled){var n=this._getMousePosition(e);this._forceValueFromPosition(n[0],function(e){t._fireChangeEvent("onChange"),t._start(e,n[0]),t._addHandlers(t._getMouseEventMap())})}Ro(e)}},_onSliderClick:function(e){if(!this.props.disabled&&this.props.onSliderClick&&!this.hasMoved){var t=this._getMousePosition(e),n=this._trimAlignValue(this._calcValue(this._calcOffsetFromPosition(t[0])));this.props.onSliderClick(n)}},_fireChangeEvent:function(e){this.props[e]&&this.props[e](Do(this.state.value))},render:function(){for(var e=this.tempArray,t=this.state.value,n=this.state.value.length,o=0;o<n;o++)e[o]=this._calcOffset(t[o],o);var i="vertical"===this.props.orientation?Mo.verticalSlider:Mo.horizontalSlider;return r.createElement("div",{ref:"slider",style:Ao(Ao({},Mo.base),i),onMouseDown:this._onSliderMouseDown,onClick:this._onSliderClick},this.props.withBars?this._renderBars(e):null,this._renderHandles(e))}});const Bo=Lo;var zo=n(33219),Fo=n(46459);function Wo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Vo=l.Ay.div.withConfig({displayName:"date-label__FloatDiv",componentId:"sc-g74a89-0"})(["float:",";"],function(e){return e.right?"right":"left"}),Ho=l.Ay.span.withConfig({displayName:"date-label__TextSpan",componentId:"sc-g74a89-1"})(["font-family:",";font-size:12px;font-weight:400;color:",";"],function(e){return e.theme["font-family"]},function(e){return e.theme.color}),Go=(0,l.Ay)(Ho).withConfig({displayName:"date-label__TextSpanClickable",componentId:"sc-g74a89-2"})(["cursor:pointer;"]),Uo=(0,l.Ay)(Ho).withConfig({displayName:"date-label__IconSpan",componentId:"sc-g74a89-3"})(["font-size:16px;margin:0 3px;vertical-align:middle;"]),qo=function(e){var t=e.value,n=e.minDate,o=e.maxDate,i=e.onChange,a=e.right,l=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Wo(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wo(e,t):void 0}}(e,t)||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.")}()}(r.useState(!1),2),s=l[0],c=l[1],u=(0,r.useCallback)(function(e){c(!1),i(e)},[c,i]),p=(0,r.useCallback)(function(e){"Enter"===e.key&&u(e.target.value)},[u]),f=(0,r.useCallback)(function(e){u(e.target.value)},[u]);if(s){var d=r.createElement("input",{type:"date",defaultValue:t,min:n,max:o,onKeyUp:p,onBlur:f}),h=r.createElement(Uo,{onClick:function(){return c(!1)}},r.createElement(Fo.Bc_,null));return a?r.createElement(r.Fragment,null,d,h):r.createElement(r.Fragment,null,h,d)}var m=r.createElement(Go,{onClick:function(){return c(!0)}},t),y=r.createElement(Uo,{onClick:function(){return c(!0)}},r.createElement(zo.Hvs,null));return a?r.createElement(r.Fragment,null,m,y):r.createElement(r.Fragment,null,y,m)};const Ko=function(e){var t,n=e.value,o=e.minDate,i=e.maxDate,a=e.onChange,l=e.right;return t=+n==+n?r.createElement(Ho,null,n):r.createElement(qo,{value:n,minDate:o,maxDate:i,onChange:a,right:l}),r.createElement(Vo,{right:l},t)};function $o(e){return $o="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},$o(e)}var Xo;function Yo(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,Qo(r.key),r)}}function Qo(e){var t=function(e){if("object"!=$o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=$o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==$o(t)?t:t+""}function Jo(e,t){return Jo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Jo(e,t)}function Zo(e){var t=ti();return function(){var n,r=ni(e);if(t){var o=ni(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==$o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return ei(e)}(this,n)}}function ei(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ti(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ti=function(){return!!e})()}function ni(e){return ni=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ni(e)}var ri=(0,a.Ng)(function(e){return{branchLengthsToDisplay:e.controls.branchLengthsToDisplay,dateMin:e.controls.dateMin,dateMax:e.controls.dateMax,dateMinNumeric:e.controls.dateMinNumeric,dateMaxNumeric:e.controls.dateMaxNumeric,absoluteDateMin:e.controls.absoluteDateMin,absoluteDateMax:e.controls.absoluteDateMax,absoluteDateMinNumeric:e.controls.absoluteDateMinNumeric,absoluteDateMaxNumeric:e.controls.absoluteDateMaxNumeric}})(Xo=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Jo(e,t)}(i,e);var t,n,o=Zo(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=o.call(this,e)).state={lastSliderUpdateTime:Date.now()},t.updateFromSliderNotDebounced=t.updateFromSlider.bind(ei(t),!1),t.updateFromSliderDebounced=t.updateFromSlider.bind(ei(t),!0),t.updateMinFromDatePicker=t.updateMinFromDatePicker.bind(ei(t)),t.updateMaxFromDatePicker=t.updateMaxFromDatePicker.bind(ei(t)),t}return t=i,n=[{key:"maybeClearMapAnimationInterval",value:function(){window.NEXTSTRAIN&&window.NEXTSTRAIN.animationTickReference&&(clearInterval(window.NEXTSTRAIN.animationTickReference),window.NEXTSTRAIN.animationTickReference=null,this.props.dispatch({type:we.x$,data:"Play"}))}},{key:"updateFromSlider",value:function(e,t){if(this.maybeClearMapAnimationInterval(),e){var n=Date.now();if(n<this.state.lastSliderUpdateTime+100)return null;this.setState({lastSliderUpdateTime:n})}var r={min:(0,Wn.bq)(t[0]),max:(0,Wn.bq)(t[1])};return this.props.dateMin!==r.min&&this.props.dateMax===r.max?this.props.dispatch((0,G.hZ)({newMin:r.min,quickdraw:e})):this.props.dateMin===r.min&&this.props.dateMax!==r.max?this.props.dispatch((0,G.hZ)({newMax:r.max,quickdraw:e})):this.props.dateMin!==r.min&&this.props.dateMax!==r.max?this.props.dispatch((0,G.hZ)({newMin:r.min,newMax:r.max,quickdraw:e})):!1===e&&this.props.dispatch((0,G.hZ)({quickdraw:e})),null}},{key:"updateMinFromDatePicker",value:function(e){this.props.dispatch((0,G.hZ)({newMin:e}))}},{key:"updateMaxFromDatePicker",value:function(e){this.props.dispatch((0,G.hZ)({newMax:e}))}},{key:"render",value:function(){return"divOnly"===this.props.branchLengthsToDisplay?null:r.createElement("div",null,r.createElement("div",{style:{width:q.zR}},r.createElement(Bo,{min:this.props.absoluteDateMinNumeric,max:this.props.absoluteDateMaxNumeric,defaultValue:[this.props.absoluteDateMinNumeric,this.props.absoluteDateMaxNumeric],value:[this.props.dateMinNumeric,this.props.dateMaxNumeric],onChange:this.updateFromSliderDebounced,onAfterChange:this.updateFromSliderNotDebounced,minDistance:q.B8*(this.props.absoluteDateMaxNumeric-this.props.absoluteDateMinNumeric),pearling:!0,withBars:!0})),r.createElement("div",{style:{height:5}}),r.createElement("div",{style:{width:q.zR}},r.createElement(Ko,{value:this.props.dateMin,minDate:this.props.absoluteDateMin,maxDate:this.props.dateMax,onChange:this.updateMinFromDatePicker}),r.createElement(Ko,{right:!0,value:this.props.dateMax,minDate:this.props.dateMin,maxDate:this.props.absoluteDateMax,onChange:this.updateMaxFromDatePicker})))}}],n&&Yo(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Component))||Xo,oi=r.createElement(r.Fragment,null,"Use this slider to filter the data based on the sample date. This may include inferred dates for ancestral nodes in the tree, and thus the date range here can be wider than the sample collection range.");const ii=ri;function ai(e){return ai="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},ai(e)}var li;function si(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,ci(r.key),r)}}function ci(e){var t=function(e){if("object"!=ai(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ai(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ai(t)?t:t+""}function ui(e,t){return ui=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ui(e,t)}function pi(e){var t=fi();return function(){var n,r=di(e);if(t){var o=di(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==ai(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function fi(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(fi=function(){return!!e})()}function di(e){return di=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},di(e)}var hi=(0,a.Ng)(function(e){return{absoluteDateMin:e.controls.absoluteDateMin,absoluteDateMax:e.controls.absoluteDateMax,animationPlayPauseButton:e.controls.animationPlayPauseButton,branchLengthsToDisplay:e.controls.branchLengthsToDisplay}})(li=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ui(e,t)}(i,e);var t,n,o=pi(i);function i(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),o.apply(this,arguments)}return t=i,(n=[{key:"getPlayPauseButton",value:function(){var e=this;return r.createElement($e.VH,{onClick:function(){"Play"===e.props.animationPlayPauseButton?e.props.dispatch({type:we.x$,data:"Pause"}):e.props.dispatch({type:we.x$,data:"Play"})}},r.createElement("span",null,"Play"===this.props.animationPlayPauseButton?r.createElement(s.gSK,{color:"#888"}):r.createElement(s.kwt,{color:"#888"})," "+this.props.t("Play"===this.props.animationPlayPauseButton?"Play":"Pause")))}},{key:"getResetButton",value:function(){var e=this;return r.createElement($e.VH,{onClick:function(){e.props.dispatch({type:we.x$,data:"Play"}),e.props.dispatch((0,G.hZ)({newMin:e.props.absoluteDateMin,newMax:e.props.absoluteDateMax,quickdraw:!1}))}},r.createElement("span",null,r.createElement(s.EEI,{color:"#888"})," "+this.props.t("Reset")))}},{key:"render",value:function(){return"divOnly"===this.props.branchLengthsToDisplay?null:r.createElement("div",{style:{marginBottom:0}},r.createElement(It.A,{justifyContent:"space-between"},this.getPlayPauseButton(),this.getResetButton()))}}])&&si(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Component))||li;const mi=(0,f.C)()(hi);function yi(e){return yi="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},yi(e)}var vi;function gi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return bi(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bi(e,t):void 0}}(e,t)||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 bi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function wi(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,Si(r.key),r)}}function Si(e){var t=function(e){if("object"!=yi(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=yi(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==yi(t)?t:t+""}function xi(e,t){return xi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},xi(e,t)}function Ei(e){var t=Oi();return function(){var n,r=Ci(e);if(t){var o=Ci(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==yi(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Oi(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Oi=function(){return!!e})()}function Ci(e){return Ci=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ci(e)}var Ti=(0,a.Ng)(function(e){return{selected:e.controls.explodeAttr,available:e.metadata.colorings,showThisUI:!e.controls.showTreeToo,mobileDisplay:e.general.mobileDisplay,showStreamTrees:e.controls.showStreamTrees}})(vi=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xi(e,t)}(i,e);var t,n,o=Ei(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=o.call(this,e)).change=function(e){t.props.dispatch((0,G.uN)(e.value))},t}return t=i,n=[{key:"gatherAttrs",value:function(){var e=Object.entries(this.props.available).filter(function(e){var t=gi(e,2);return t[0],"continuous"!==t[1].type}).filter(function(e){return"gt"!==gi(e,1)[0]}).map(function(e){var t=gi(e,2),n=t[0];return{value:n,label:t[1].title||n}});return this.props.selected&&e.unshift({value:void 0,label:"None"}),e}},{key:"render",value:function(){var e=this;if(!this.props.showThisUI)return null;if(this.props.showStreamTrees)return null;var t=this.props,n=t.t,o=t.tooltip,i=this.gatherAttrs();return r.createElement("div",{style:{paddingTop:10}},r.createElement($e.KG,{"data-tip":!0,"data-for":"explode_tree"},r.createElement("span",null,n("sidebar:Explode Tree By")),o&&!this.props.mobileDisplay&&r.createElement(r.Fragment,null,r.createElement($e.Pz,{"data-tip":!0,"data-for":"select-explode"},r.createElement(s.__w,null)),r.createElement($e.FS,{place:"bottom",type:"dark",effect:"solid",id:"select-explode"},o))),r.createElement("div",{style:{width:q.zR,fontSize:14}},r.createElement(Ke.A,{value:i.filter(function(t){return t.value===e.props.selected}),options:i,isClearable:!1,isSearchable:!1,isMulti:!1,onChange:this.change})))}}],n&&wi(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Component))||vi;const _i=(0,f.C)()(Ti);var ki=n(89804),ji=l.Ay.div.withConfig({displayName:"toggle__ToggleContainer",componentId:"sc-1r21f6e-0"})(["height:21px;position:relative;"]),Pi=l.Ay.label.withConfig({displayName:"toggle__ToggleBackground",componentId:"sc-1r21f6e-1"})(["position:relative;display:inline-block;width:35px;height:21px;input{display:none;}input:checked{background-color:",";}"],function(e){return e.theme.unselectedColor}),Ai=(0,l.Ay)($e.Dg).withConfig({displayName:"toggle__ToggleSubtitle",componentId:"sc-1r21f6e-2"})(["margin-left:40px;margin-top:4px;width:200px;"]),Ii=l.Ay.span.withConfig({displayName:"toggle__ExperimentalIcon",componentId:"sc-1r21f6e-3"})(["color:",";font-size:10px;position:absolute;left:-12px;top:6px;"],function(e){return e.theme.color}),Mi=l.Ay.div.withConfig({displayName:"toggle__Slider",componentId:"sc-1r21f6e-4"})(["&{position:absolute;cursor:",";top:0;left:0;right:0;bottom:0;background-color:",';-webkit-transition:.4s;transition:.4s;border-radius:12px;}&:before{position:absolute;content:"";height:15px;width:15px;left:4px;bottom:3px;background-color:#FFF;-webkit-transition:.4s;transition:.4s;border-radius:50%;}input:checked + &:before{-webkit-transform:translateX(13px);-ms-transform:translateX(13px);transform:translateX(13px);}'],function(e){return e.disabled?"not-allowed;":"pointer"},function(e){return e.theme.alternateBackground}),Ri=l.Ay.input.withConfig({displayName:"toggle__Input",componentId:"sc-1r21f6e-5"})(['&{margin-left:"40px"}&:checked + ',"{background-color:",";}&:focus{box-shadow:0 0 1px #2196F3;}"],Mi,function(e){return e.theme.selectedColor});const Ni=function(e){var t=e.display,n=e.isExperimental,o=void 0!==n&&n,i=e.on,a=e.callback,l=e.label,s=e.style,c=void 0===s?{}:s,u=e.disabled,p=void 0!==u&&u;return t?r.createElement(ji,{style:c},o&&r.createElement(Ii,null,r.createElement(ki.UGw,null)),r.createElement(Pi,null,r.createElement(Ri,{type:"checkbox",checked:i,onChange:p?function(){}:a}),r.createElement(Mi,{disabled:p}),""===l?null:r.createElement(Ai,null,l))):null};function Di(e){return Di="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},Di(e)}var Li;function Bi(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,zi(r.key),r)}}function zi(e){var t=function(e){if("object"!=Di(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Di(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Di(t)?t:t+""}function Fi(e,t){return Fi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Fi(e,t)}function Wi(e){var t=Vi();return function(){var n,r=Hi(e);if(t){var o=Hi(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==Di(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Vi(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Vi=function(){return!!e})()}function Hi(e){return Hi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Hi(e)}var Gi=(0,a.Ng)(function(e){var t,n;return{selected:e.controls.selectedBranchLabel,showAll:e.controls.showAllBranchLabels,available:Array.from(new Set(e.tree.availableBranchLabels).union(new Set(null!==(t=null===(n=e.treeToo)||void 0===n?void 0:n.availableBranchLabels)&&void 0!==t?t:[]))),canRenderBranchLabels:e.controls.canRenderBranchLabels}})(Li=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Fi(e,t)}(i,e);var t,n,o=Wi(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=o.call(this,e)).change=function(e){t.props.dispatch({type:we.HS,value:e.value})},t}return t=i,n=[{key:"render",value:function(){var e=this;if(!this.props.canRenderBranchLabels)return null;var t=this.props.t,n=this.props.available.map(function(e){return{value:e,label:e}});return r.createElement("div",{style:{paddingTop:5}},r.createElement($e.Dg,null,t("sidebar:Branch Labels")),r.createElement("div",{style:{width:q.zR,fontSize:14}},r.createElement(Ke.A,{value:n.filter(function(t){return t.value===e.props.selected}),options:n,isClearable:!1,isSearchable:!1,isMulti:!1,onChange:this.change})),"none"!==this.props.selected&&r.createElement(Ni,{display:!0,on:this.props.showAll,callback:function(){return e.props.dispatch({type:we.Yg,value:!e.props.showAll})},label:t("sidebar:Show all labels"),style:{paddingBottom:"5px",paddingTop:"10px"}}))}}],n&&Bi(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Component))||Li;const Ui=(0,f.C)()(Gi);var qi=n(98598),Ki=n(46796),$i=n(5843),Xi=n(77887);function Yi(){return function(e,t){var n=t(),r=n.controls,o=n.tree,i=!r.showStreamTrees;if(!1!==i)if(null!==r.streamTreeBranchLabel&&0!==Object.keys(o.streams).length){var a=o.nodes[o.idxOfInViewRootNode];if(a&&a.inStream&&!a.streamName){var l=(0,Xi.lF)(a);return e((0,G.nj)({root:[l.arrayIdx,void 0]})),void window.setTimeout(function(){return e(Yi())},500)}(0,$i.b8)(o.streams,o.nodes,o.visibility,r.distanceMeasure,r.colorScale),e({type:we.zw,showStreamTrees:i})}else e(Qi(r.availableStreamLabelKeys[0]));else e({type:we.zw,showStreamTrees:i})}}function Qi(e){return function(t,n){var r=n(),o=r.controls,i=r.tree;if((0,$i.vN)(i.nodes[i.idxOfInViewRootNode],e))t((0,an.Ul)({message:"Cannot switch streams to ".concat(e," as the subtree we're viewing would be inside a stream")}));else{var a=(0,$i.JW)(i.nodes[0],e);(0,$i.b8)(a,i.nodes,i.visibility,o.distanceMeasure,o.colorScale),t({type:we.Dh,streams:a,streamTreeBranchLabel:e})}}}function Ji(e){return Ji="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},Ji(e)}function Zi(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 ea(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zi(Object(n),!0).forEach(function(t){ta(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ta(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ji(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ji(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ji(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var na,ra,oa=function(e){var t=e.layout,n=e.showBranches,r=e.showRegression,o=e.x,i=e.xLabel,a=e.y,l=e.yLabel;return function(e,s){if(!window.NEXTSTRAIN||!window.NEXTSTRAIN.animationTickReference){var c=s(),u=c.controls,p=c.tree,f=c.metadata;if(u.showStreamTrees&&e(Yi()),"rect"!==t&&"unrooted"!==t&&"radial"!==t){var d="clock"===t||"scatter"===t?(0,Ki.YD)(u,f,p,"clock"===t):u.scatterVariables;o&&i&&(d=ea(ea({},d),(0,Ki.b8)({x:o,xLabel:i},"x",u,p,f))),a&&l&&(d=ea(ea({},d),(0,Ki.b8)({y:a,yLabel:l},"y",u,p,f))),void 0!==n&&(d.showBranches=n),void 0!==r&&(d.showRegression=r),"scatter"!==t||d.xContinuous&&d.yContinuous||(d.showRegression=!1),e({type:we.cv,layout:t||u.layout,scatterVariables:ea({},d),canRenderBranchLabels:d.showBranches})}else e({type:we.cv,layout:t,scatterVariables:u.scatterVariables,canRenderBranchLabels:!0})}}};function ia(e){return ia="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},ia(e)}function aa(){return aa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},aa.apply(null,arguments)}function la(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,fa(r.key),r)}}function sa(e,t){return sa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},sa(e,t)}function ca(e){var t=ua();return function(){var n,r=pa(e);if(t){var o=pa(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==ia(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function ua(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ua=function(){return!!e})()}function pa(e){return pa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},pa(e)}function fa(e){var t=function(e){if("object"!=ia(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ia(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ia(t)?t:t+""}var da,ha,ma,ya=(0,l.SL)(qi.bg),va=(0,l.SL)(qi.yf),ga=(0,l.SL)(qi.bu),ba=(0,l.SL)(qi.zD),wa=(0,l.SL)(qi.Xl),Sa=l.Ay.div.withConfig({displayName:"choose-layout__RowContainer",componentId:"sc-16x4jtt-0"})(["padding:0px 5px 1px 5px;"]),xa=l.Ay.div.withConfig({displayName:"choose-layout__ScatterVariableContainer",componentId:"sc-16x4jtt-1"})(["display:flex;flex-direction:row;align-content:stretch;flex-wrap:nowrap;height:100%;order:0;flex-grow:0;flex-shrink:1;flex-basis:auto;align-self:auto;padding:","px 0px 2px 15px;"],function(e){return e.padAbove?"2":"0"}),Ea=l.Ay.div.withConfig({displayName:"choose-layout__ScatterAxisName",componentId:"sc-16x4jtt-2"})(["display:flex;flex-direction:column;justify-content:center;min-width:18px;font-size:14px;font-weight:400;font-family:",";color:",";"],function(e){return e.theme["font-family"]},function(e){return e.theme.color}),Oa=l.Ay.div.withConfig({displayName:"choose-layout__ScatterSelectContainer",componentId:"sc-16x4jtt-3"})(["width:","px;font-size:12px;"],q.zR-18),Ca=(0,a.Ng)(function(e){return{layout:e.controls.layout,scatterVariables:e.controls.scatterVariables,colorings:e.metadata.colorings,colorBy:e.controls.colorBy,showTreeToo:e.controls.showTreeToo,streamTreesToggledOn:e.controls.showStreamTrees,branchLengthsToDisplay:e.controls.branchLengthsToDisplay}})((ra=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&sa(e,t)}(i,e);var t,n,o=ca(i);function i(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),o.apply(this,arguments)}return t=i,n=[{key:"renderScatterplotAxesSelector",value:function(){var e=this,t=(0,Ki.TK)(this.props.colorings,this.props.colorBy),n=t.filter(function(t){return t.value===e.props.scatterVariables.x})[0],o=t.filter(function(t){return t.value===e.props.scatterVariables.y})[0],i={options:t,isClearable:!1,isSearchable:!1,isMulti:!1};return r.createElement(r.Fragment,null,r.createElement(xa,null,r.createElement(Ea,null,"x"),r.createElement(Oa,null,r.createElement(Ke.A,aa({},i,{value:t.filter(function(e){return e.value===n.value}),onChange:function(t){return e.props.dispatch(oa({x:t.value,xLabel:t.label}))}})))),r.createElement(xa,null,r.createElement(Ea,null,"y"),r.createElement(Oa,null,r.createElement(Ke.A,aa({},i,{value:t.filter(function(e){return e.value===o.value}),onChange:function(t){return e.props.dispatch(oa({y:t.value,yLabel:t.label}))}})))))}},{key:"renderBranchToggle",value:function(){var e=this;return r.createElement(xa,{padAbove:!0},r.createElement(Ni,{display:!0,on:this.props.scatterVariables.showBranches,callback:function(){return e.props.dispatch(oa({showBranches:!e.props.scatterVariables.showBranches}))},label:"Show branches"}))}},{key:"renderRegressionToggle",value:function(){var e=this;return"scatter"!==this.props.layout||this.props.scatterVariables.xContinuous&&this.props.scatterVariables.yContinuous?r.createElement(xa,{padAbove:!0},r.createElement(Ni,{display:!0,on:this.props.scatterVariables.showRegression,callback:function(){return e.props.dispatch(oa({showRegression:!e.props.scatterVariables.showRegression}))},label:"Show regression"})):null}},{key:"render",value:function(){var e=this,t=this.props.t;if(this.props.showTreeToo)return null;var n=this.props.layout;return r.createElement("div",{style:{marginBottom:15}},r.createElement($e.Dg,null,t("sidebar:Layout")),r.createElement(Sa,null,r.createElement("div",{style:this.props.streamTreesToggledOn?{opacity:.5}:{}},r.createElement(ya,{width:25,selected:"rect"===n}),r.createElement($e.VH,{selected:"rect"===n,onClick:function(){return e.props.dispatch(oa({layout:"rect"}))},disabled:this.props.streamTreesToggledOn},t("sidebar:rectangular")))),r.createElement(Sa,null,r.createElement("div",{style:this.props.streamTreesToggledOn?{opacity:.5}:{}},r.createElement(va,{width:25,selected:"radial"===n}),r.createElement($e.VH,{selected:"radial"===n,onClick:function(){return e.props.dispatch(oa({layout:"radial"}))},disabled:this.props.streamTreesToggledOn},t("sidebar:radial")))),r.createElement(Sa,null,r.createElement("div",{style:this.props.streamTreesToggledOn?{opacity:.5}:{}},r.createElement(ga,{width:25,selected:"unrooted"===n}),r.createElement($e.VH,{selected:"unrooted"===n,onClick:function(){return e.props.dispatch(oa({layout:"unrooted"}))},disabled:this.props.streamTreesToggledOn},t("sidebar:unrooted")))),"divAndDate"===this.props.branchLengthsToDisplay?r.createElement(Sa,null,r.createElement("div",{style:this.props.streamTreesToggledOn?{opacity:.5}:{}},r.createElement(ba,{width:25,selected:"clock"===n}),r.createElement($e.VH,{selected:"clock"===n,onClick:function(){return e.props.dispatch(oa({layout:"clock"}))},disabled:this.props.streamTreesToggledOn},t("sidebar:clock"))),"clock"===n&&this.renderBranchToggle(),"clock"===n&&this.renderRegressionToggle()):null,r.createElement(Sa,null,r.createElement("div",{style:this.props.streamTreesToggledOn?{opacity:.5}:{}},r.createElement(wa,{width:25,selected:"scatter"===n}),r.createElement($e.VH,{selected:"scatter"===n,onClick:function(){return e.props.dispatch(oa({layout:"scatter"}))},disabled:this.props.streamTreesToggledOn},t("sidebar:scatter"))),"scatter"===n&&this.renderScatterplotAxesSelector(),"scatter"===n&&this.renderBranchToggle(),"scatter"===n&&this.renderRegressionToggle()))}}],n&&la(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Component),da=ra,ha="propTypes",ma={layout:i().string.isRequired,dispatch:i().func.isRequired},(ha=fa(ha))in da?Object.defineProperty(da,ha,{value:ma,enumerable:!0,configurable:!0,writable:!0}):da[ha]=ma,na=ra))||na;const Ta=(0,f.C)()(Ca);var _a,ka=n(2527);function ja(e){return ja="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},ja(e)}function Pa(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Aa(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,Ia(r.key),r)}}function Ia(e){var t=function(e){if("object"!=ja(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ja(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ja(t)?t:t+""}function Ma(e,t){return Ma=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ma(e,t)}function Ra(e){var t=Na();return function(){var n,r=Da(e);if(t){var o=Da(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==ja(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Na(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Na=function(){return!!e})()}function Da(e){return Da=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Da(e)}var La=(0,a.Ng)(function(e){return{available:e.controls.available,showStreamTrees:e.controls.showStreamTrees,treeName:e.tree.name,showTreeToo:e.controls.showTreeToo}})(_a=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ma(e,t)}(n,e);var t=Ra(n);function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t.apply(this,arguments)}return function(e,t){t&&Aa(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(n,[{key:"render",value:function(){var e=this,t=this.props.t;if(!this.props.available||!this.props.available.datasets)return null;var n=window.location.pathname.replace(/^\//,"").replace(/\/$/,"").split(":")[0],o=function(e){return function(e){if(Array.isArray(e))return Pa(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Pa(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pa(e,t):void 0}}(e)||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.")}()}(new Set(this.props.available.datasets.filter(function(e){return e.request===n}).flatMap(function(e){return e.secondTreeOptions}).filter(function(e){return!!e})));if(!o.length)return null;if(this.props.showStreamTrees)return null;this.props.showTreeToo&&o.unshift("REMOVE");var i=o.map(function(e){return{value:e,label:e}});return r.createElement("div",null,r.createElement($e.Dg,{spaceAbove:!0},t("sidebar:Second Tree")),r.createElement("div",{key:"treetooselect",style:{width:q.zR,fontSize:14}},r.createElement(Ke.A,{name:"selectTreeToo",id:"selectTreeToo",value:i.filter(function(t){return t.value===e.props.showTreeToo}),options:i,isClearable:!1,isSearchable:!1,isMulti:!1,onChange:function(t){"REMOVE"===t.value?e.props.dispatch({type:we.pL}):e.props.dispatch((0,ka.Tf)(t.value,n))}})))}}]),n}(r.Component))||_a;const Ba=(0,f.C)()(La);var za,Fa=n(21457);function Wa(e){return Wa="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},Wa(e)}function Va(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,Ha(r.key),r)}}function Ha(e){var t=function(e){if("object"!=Wa(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Wa(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Wa(t)?t:t+""}function Ga(e,t){return Ga=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ga(e,t)}function Ua(e){var t=qa();return function(){var n,r=Ka(e);if(t){var o=Ka(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==Wa(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function qa(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(qa=function(){return!!e})()}function Ka(e){return Ka=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ka(e)}var $a=(0,a.Ng)(function(e){return{distanceMeasure:e.controls.distanceMeasure,layout:e.controls.layout,showTreeToo:e.controls.showTreeToo,branchLengthsToDisplay:e.controls.branchLengthsToDisplay,streamTreesToggledOn:e.controls.showStreamTrees,temporalConfidence:e.controls.temporalConfidence}})(za=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ga(e,t)}(n,e);var t=Ua(n);function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t.apply(this,arguments)}return function(e,t){t&&Va(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(n,[{key:"render",value:function(){var e=this,t=this.props.t;if("divAndDate"!==this.props.branchLengthsToDisplay)return null;if("scatter"===this.props.layout||"clock"===this.props.layout)return null;var n=this.props.streamTreesToggledOn,o=t(n?"sidebar:Confidence intervals disabled":"sidebar:Show confidence intervals");return r.createElement("div",{style:{marginBottom:0}},r.createElement($e.Dg,null,t("sidebar:Branch Length")),r.createElement($e.VH,{selected:"num_date"===this.props.distanceMeasure,onClick:function(){(0,on.H2)("tree-metric-temporal"),e.props.dispatch((0,G.k8)("num_date"))}},t("sidebar:time")),r.createElement("span",{style:{paddingRight:"12px"}}),r.createElement($e.VH,{selected:"div"===this.props.distanceMeasure,onClick:function(){(0,on.H2)("tree-metric-temporal"),e.props.dispatch((0,G.k8)("div"))}},t("sidebar:divergence")),this.props.showTreeToo?null:r.createElement("div",{style:{marginBottom:8}},r.createElement(Ni,{display:this.props.temporalConfidence.display,on:this.props.temporalConfidence.on,disabled:n,callback:function(){return e.props.dispatch((0,G.Zd)())},label:o})))}}]),n}(r.Component))||za;const Xa=(0,f.C)()($a);function Ya(e){return Ya="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},Ya(e)}var Qa;function Ja(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,Za(r.key),r)}}function Za(e){var t=function(e){if("object"!=Ya(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ya(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ya(t)?t:t+""}function el(e,t){return el=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},el(e,t)}function tl(e){var t=nl();return function(){var n,r=rl(e);if(t){var o=rl(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==Ya(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function nl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(nl=function(){return!!e})()}function rl(e){return rl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},rl(e)}var ol=l.Ay.span.withConfig({displayName:"panel-layout__ButtonText",componentId:"sc-12zrah-0"})(["margin:5px;position:relative;left:4px;top:-6px;"]),il=(0,l.SL)(qi.vA),al=(0,l.SL)(qi.wC),ll=(0,a.Ng)(function(e){return{panelLayout:e.controls.panelLayout}})(Qa=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&el(e,t)}(n,e);var t=tl(n);function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t.apply(this,arguments)}return function(e,t){t&&Ja(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(n,[{key:"render",value:function(){var e=this,t=this.props.t;return r.createElement("div",{style:{marginTop:0,marginBottom:10}},r.createElement($e.VH,{selected:"full"===this.props.panelLayout,onClick:function(){(0,on.H2)("change-layout-full"),e.props.dispatch({type:we.n_,data:"full"})}},r.createElement(il,{width:22,selected:"full"===this.props.panelLayout}),r.createElement(ol,null,t("sidebar:full"))),r.createElement($e.VH,{selected:"grid"===this.props.panelLayout,onClick:function(){(0,on.H2)("change-layout-grid"),e.props.dispatch({type:we.n_,data:"grid"})}},r.createElement(al,{width:22,selected:"grid"===this.props.panelLayout}),r.createElement(ol,null,t("sidebar:grid"))))}}]),n}(r.Component))||Qa;const sl=(0,f.C)()(ll);function cl(e){return cl="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},cl(e)}var ul;function pl(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,fl(r.key),r)}}function fl(e){var t=function(e){if("object"!=cl(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=cl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==cl(t)?t:t+""}function dl(e,t){return dl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},dl(e,t)}function hl(e){var t=ml();return function(){var n,r=yl(e);if(t){var o=yl(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==cl(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function ml(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ml=function(){return!!e})()}function yl(e){return yl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},yl(e)}var vl=(0,a.Ng)(function(e){return{metadata:e.metadata,geoResolution:e.controls.geoResolution}})(ul=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&dl(e,t)}(n,e);var t=hl(n);function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t.apply(this,arguments)}return function(e,t){t&&pl(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(n,[{key:"getGeoResolutionOptions",value:function(){return this.props.metadata.loaded?this.props.metadata.geoResolutions.map(function(e){return{value:e.key,label:e.title||e.key}}):[]}},{key:"changeGeoResolution",value:function(e){(0,on.H2)("change-geo-resolution"),this.props.dispatch({type:we.wK,data:e})}},{key:"render",value:function(){var e=this,t=this.props.t,n=this.getGeoResolutionOptions();return r.createElement(r.Fragment,null,r.createElement($e.Dg,{spaceAbove:!0},t("sidebar:Geographic resolution")),r.createElement("div",{style:{marginBottom:10,width:q.zR,fontSize:14}},r.createElement(Ke.A,{name:"selectGeoResolution",id:"selectGeoResolution",value:n.filter(function(t){return t.value===e.props.geoResolution}),options:n,isClearable:!1,isSearchable:!1,isMulti:!1,onChange:function(t){e.changeGeoResolution(t.value)}})))}}]),n}(r.Component))||ul;const gl=(0,f.C)()(vl);function bl(e){return bl="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},bl(e)}var wl;function Sl(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,xl(r.key),r)}}function xl(e){var t=function(e){if("object"!=bl(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=bl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==bl(t)?t:t+""}function El(e,t){return El=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},El(e,t)}function Ol(e){var t=Cl();return function(){var n,r=Tl(e);if(t){var o=Tl(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==bl(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Cl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Cl=function(){return!!e})()}function Tl(e){return Tl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Tl(e)}var _l=(0,a.Ng)(function(e){return{showTransmissionLines:e.controls.showTransmissionLines}})(wl=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&El(e,t)}(n,e);var t=Ol(n);function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t.apply(this,arguments)}return function(e,t){t&&Sl(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(n,[{key:"render",value:function(){var e=this,t=this.props.t;return r.createElement("div",{style:{marginBottom:10,width:q.zR,fontSize:14}},r.createElement(Ni,{display:!0,on:this.props.showTransmissionLines,callback:function(){e.props.dispatch({type:we.G3,data:!e.props.showTransmissionLines})},label:t("sidebar:Show transmission lines")}))}}]),n}(r.Component))||wl;const kl=(0,f.C)()(_l);var jl,Pl=n(99899);function Al(e){return Al="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},Al(e)}function Il(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,Ml(r.key),r)}}function Ml(e){var t=function(e){if("object"!=Al(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Al(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Al(t)?t:t+""}function Rl(e,t){return Rl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Rl(e,t)}function Nl(e){var t=Dl();return function(){var n,r=Ll(e);if(t){var o=Ll(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==Al(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Dl(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Dl=function(){return!!e})()}function Ll(e){return Ll=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ll(e)}var Bl=(0,a.Ng)(function(e){return{controls:e.controls,frequencies:e.frequencies,tree:e.tree}})(jl=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Rl(e,t)}(n,e);var t=Nl(n);function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t.apply(this,arguments)}return function(e,t){t&&Il(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(n,[{key:"render",value:function(){var e=this,t=this.props.t;return this.props.frequencies.loaded&&this.props.tree.loaded&&(0,Pl.cm)(this.props.frequencies.data,this.props.frequencies.pivots,this.props.tree.nodes,this.props.tree.visibility)?r.createElement("div",{style:{marginBottom:10,width:q.zR,fontSize:14}},r.createElement(Ni,{display:!0,on:this.props.controls.normalizeFrequencies,callback:function(){var t=!e.props.controls.normalizeFrequencies,n=(0,Pl.nA)(e.props.frequencies.data,e.props.frequencies.pivots,e.props.tree.nodes,e.props.tree.visibility,e.props.controls.colorScale,e.props.controls.colorBy,t);e.props.dispatch({type:we.BV,matrix:n,normalizeFrequencies:t})},label:t("sidebar:Normalize frequencies")})):r.createElement($e.Dg,null,"(Frequencies cannot be normalized)")}}]),n}(r.Component))||jl;const zl=(0,f.C)()(Bl);function Fl(e){return Fl="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},Fl(e)}var Wl;function Vl(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,Hl(r.key),r)}}function Hl(e){var t=function(e){if("object"!=Fl(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Fl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Fl(t)?t:t+""}function Gl(e,t){return Gl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Gl(e,t)}function Ul(e){var t=ql();return function(){var n,r=Kl(e);if(t){var o=Kl(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==Fl(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function ql(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ql=function(){return!!e})()}function Kl(e){return Kl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Kl(e)}var $l=(0,a.Ng)(function(e){return{branchLengthsToDisplay:e.controls.branchLengthsToDisplay,mapAnimationStartDate:e.controls.mapAnimationStartDate,mapAnimationDurationInMilliseconds:e.controls.mapAnimationDurationInMilliseconds,mapAnimationCumulative:e.controls.mapAnimationCumulative,mapAnimationShouldLoop:e.controls.mapAnimationShouldLoop}})(Wl=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Gl(e,t)}(n,e);var t=Ul(n);function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t.apply(this,arguments)}return function(e,t){t&&Vl(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(n,[{key:"handleChangeAnimationTimeClicked",value:function(e){var t=this;return function(){var n;window.NEXTSTRAIN&&window.NEXTSTRAIN.animationTickReference||((0,on.H2)("change-animation-time"),"slow"===e?n=6e4:"medium"===e?n=3e4:"fast"===e?n=15e3:console.warn("Odd... controls/map-animation.js tried to set an animation speed we don't offer..."),t.props.dispatch({type:we.AT,data:n}))}}},{key:"render",value:function(){var e=this,t=this.props.t;return"divOnly"===this.props.branchLengthsToDisplay?null:r.createElement("div",{id:"mapAnimationControls"},r.createElement($e.Dg,{spaceAbove:!0},t("sidebar:Animation Speed")),r.createElement($e.VH,{selected:6e4===this.props.mapAnimationDurationInMilliseconds,onClick:this.handleChangeAnimationTimeClicked("slow")},t("sidebar:Slow")),r.createElement($e.VH,{selected:3e4===this.props.mapAnimationDurationInMilliseconds,onClick:this.handleChangeAnimationTimeClicked("medium")},t("sidebar:Medium")),r.createElement($e.VH,{selected:15e3===this.props.mapAnimationDurationInMilliseconds,onClick:this.handleChangeAnimationTimeClicked("fast")},t("sidebar:Fast")),r.createElement("div",{style:{marginBottom:5}}),r.createElement(Ni,{display:!0,on:this.props.mapAnimationShouldLoop,callback:function(){e.props.dispatch({type:we.jM,data:!e.props.mapAnimationShouldLoop})},label:t("sidebar:Loop animation")}),r.createElement("br",null),r.createElement(Ni,{display:!0,on:this.props.mapAnimationCumulative,callback:function(){(0,on.H2)("change-animation-cumulative"),e.props.dispatch({type:we.QW,data:!e.props.mapAnimationCumulative})},label:t("sidebar:Animate cumulative history")}))}}]),n}(r.Component))||Wl;const Xl=(0,f.C)()($l);var Yl=n(34713),Ql=function(e){var t=e.title,n=e.tooltip,o=void 0===n?void 0:n,i=(0,a.d4)(function(e){return e.general.mobileDisplay});return r.createElement($e.I6,null,r.createElement($e.gY,null,t),o&&!i&&r.createElement(r.Fragment,null,r.createElement($e.ee,{"data-tip":!0,"data-for":t,onClick:function(e){return e.stopPropagation()}},r.createElement(s.__w,null)),r.createElement($e.FS,{place:"bottom",type:"dark",effect:"solid",id:t},o)))},Jl=l.Ay.span.withConfig({displayName:"panelChevron__Container",componentId:"sc-e8i5tk-0"})(["padding-right:6px;color:",";"],function(e){return e.theme.color}),Zl=function(e){var t=e.show?r.createElement(s.Vr3,null):r.createElement(s.X6T,null);return r.createElement(Jl,null,t)},es=function(e){var t=e.panel,n=e.title,o=e.tooltip,i=e.panelIsVisible,a=e.hasOptions,l=e.optionsAreVisible,s=e.setOptionsAreVisible,c=(0,Yl.j)();return r.createElement($e.B3,a?{onClick:function(){s(!l)},style:{cursor:"pointer"}}:{},r.createElement("span",null,a&&r.createElement(Zl,{show:l}),r.createElement(Ql,{title:n,tooltip:o})),r.createElement("span",{onClick:function(e){return e.stopPropagation()}},r.createElement(Ni,{display:!0,on:i,callback:function(){c((0,Fn.pO)(t))},label:""})))};function ts(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ns,rs=function(e){var t=e.panel,n=e.title,o=e.tooltip,i=e.options,l=void 0===i?void 0:i,s=(0,a.d4)(function(e){return e.controls.panelsToDisplay}).includes(t),c=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ts(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ts(e,t):void 0}}(e,t)||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.")}()}(r.useState(s),2),u=c[0],p=c[1];return r.useEffect(function(){p(s)},[s]),r.createElement($e.$o,null,r.createElement(es,{panel:t,title:n,tooltip:o,panelIsVisible:s,hasOptions:void 0!==l,optionsAreVisible:u,setOptionsAreVisible:p}),u&&l)};function os(){var e=(0,a.d4)(function(e){return e.controls.focus}),t=(0,a.d4)(function(e){return e.controls.layout}),n=(0,a.d4)(function(e){return e.controls.showStreamTrees}),o=(0,Yl.j)(),i=(0,a.d4)(function(e){return e.general.mobileDisplay}),l=(0,he.B)().t,c=!new Set(["rect","radial"]).has(t)||n,u=l(c?"sidebar:Focus on selected unavailable":"sidebar:Focus on selected"),p=r.createElement("div",{style:{display:"flex",alignItems:"center"}},r.createElement("span",{style:{marginRight:"5px"}},u),!i&&r.createElement(r.Fragment,null,r.createElement($e.Pz,{style:{display:"inline-flex"},"data-tip":!0,"data-for":"toggle-focus"},r.createElement(s.__w,null)),r.createElement($e.FS,{place:"bottom",type:"dark",effect:"solid",id:"toggle-focus"},"When focusing on selected nodes, nodes that do not match the filter will occupy less vertical space on the tree. Only applicable to rectangular and radial layouts.")));return r.createElement(Ni,{display:!0,on:"selected"===e&&!c,disabled:c,callback:function(){var t;o((t="selected"===e?null:"selected",function(e,n){t||e({type:we.q_,focus:t});var r=n(),o=r.tree,i=r.treeToo;e({type:we.q_,focus:t,focusNodes:(0,G.lY)(o.nodes,o.visibility),focusNodesTreeToo:i.nodes?(0,G.lY)(i.nodes,i.visibility):void 0})}))},label:p,style:{marginBottom:8}})}function is(e){return is="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},is(e)}function as(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,ls(r.key),r)}}function ls(e){var t=function(e){if("object"!=is(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=is(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==is(t)?t:t+""}function ss(e,t){return ss=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ss(e,t)}function cs(e){var t=us();return function(){var n,r=ps(e);if(t){var o=ps(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==is(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function us(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(us=function(){return!!e})()}function ps(e){return ps=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ps(e)}var fs=(0,a.Ng)(function(e){return{showTreeToo:e.controls.showTreeToo,showTangle:e.controls.showTangle}})(ns=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ss(e,t)}(n,e);var t=cs(n);function n(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t.apply(this,arguments)}return function(e,t){t&&as(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(n,[{key:"render",value:function(){var e=this;return this.props.showTreeToo?r.createElement(Ni,{display:!0,on:this.props.showTangle,callback:function(){return e.props.dispatch({type:we.JA})},label:"Show Tanglegram",style:{paddingTop:"10px"}}):null}}]),n}(r.Component))||ns;const ds=fs;function hs(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ms=function(){var e=(0,a.d4)(function(e){return e.controls.showStreamTrees}),t=(0,a.d4)(function(e){return e.controls.streamTreeBranchLabel}),n=(0,a.d4)(function(e){return e.controls.showTreeToo}),o=(0,a.d4)(function(e){return e.controls.focus}),i=(0,a.d4)(function(e){return"rect"===e.controls.layout}),l=(0,a.d4)(function(e){return!!e.controls.explodeAttr}),s=(0,a.d4)(function(e){return e.controls.availableStreamLabelKeys}),c=(0,Yl.j)(),u=(0,he.B)().t;if(!s.length)return null;var p=[];n&&p.push("Two trees are being displayed"),o&&p.push("'Focus on selected' is on"),i||p.push("Tree layout is not rectangular"),l&&p.push("Viewing exploded tree");var f=function(e){return function(e){if(Array.isArray(e))return hs(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return hs(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hs(e,t):void 0}}(e)||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.")}()}(s.map(function(e){return{value:e,label:e}}));return r.createElement("div",null,r.createElement("div",{style:{marginBottom:8}},r.createElement(Ni,{display:!0,isExperimental:!0,on:e,disabled:p.length>0,callback:function(){return c(Yi())},label:r.createElement(ys,{t:u,toggleOn:e,unavailable:p})})),e&&r.createElement("div",{style:{paddingTop:0,paddingBottom:20}},r.createElement($e.KG,{"data-tip":!0,"data-for":"select-stream-branch-label"},r.createElement("span",{style:{position:"relative"}},u("sidebar:Stream-tree branch label"))),r.createElement("div",{style:{width:q.zR,fontSize:14}},r.createElement(Ke.A,{value:f.filter(function(e){return e.value===t}),options:f,isClearable:!1,isSearchable:!1,isMulti:!1,onChange:function(e){return c(Qi(e.value))}}))))};function ys(e){var t=e.t,n=e.toggleOn,o=e.unavailable;return r.createElement("div",{style:{display:"flex",alignItems:"center"}},r.createElement("span",{style:{marginRight:"5px"}},o.length?t("sidebar:Streamtrees unavailable"):t("sidebar:Show streamtrees")),r.createElement($e.Pz,{style:{display:"inline-flex"},"data-tip":!0,"data-for":"toggle-stream-trees"},r.createElement(s.__w,null)),r.createElement($e.FS,{place:"bottom",type:"dark",effect:"solid",id:"toggle-stream-trees"},r.createElement(r.Fragment,null,"This functionality is experimental and should be treated with caution!",r.createElement("p",null),"Stream trees allow parts of the tree to be summarised by a stream-graph, similar to the frequencies panel. This can be helpful to understand the broader dynamics within this part of the tree as well as allowing Auspice to display larger trees with improved performance.",r.createElement("p",null),o.length?r.createElement(r.Fragment,null,"Stream trees are currently unavailable because:",r.createElement("ul",null,o.map(function(e){return r.createElement("li",{key:e},e)}))):"Branch labels within a tree are used to partition the tree into discrete streams.\n ".concat(n?"The dropdown immediately below allows you to change this label.":"Toggle on stream trees to show a dropdown of available branch labels."))))}var vs,gs=n(4331);function bs(e){return bs="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},bs(e)}function ws(e,t,n,r,o,i,a){try{var l=e[i](a),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(r,o)}function Ss(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){ws(i,r,o,a,l,"next",e)}function l(e){ws(i,r,o,a,l,"throw",e)}a(void 0)})}}function xs(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,Es(r.key),r)}}function Es(e){var t=function(e){if("object"!=bs(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=bs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==bs(t)?t:t+""}function Os(e,t){return Os=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Os(e,t)}function Cs(e){var t=Ts();return function(){var n,r=_s(e);if(t){var o=_s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==bs(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Ts(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ts=function(){return!!e})()}function _s(e){return _s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_s(e)}var ks=(0,a.Ng)(function(e){return{metadata:e.metadata,language:e.general.language}})(vs=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Os(e,t)}(l,e);var t,o,i,a=Cs(l);function l(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l),a.apply(this,arguments)}return function(e,t){t&&xs(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(l,[{key:"ensureLanguageResources",value:(i=Ss(regeneratorRuntime.mark(function e(t){var r,o,i,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=0,o=["language","sidebar","translation"];case 1:if(!(r<o.length)){e.next=17;break}if(i=o[r],gs.A.hasResourceBundle(t,i)){e.next=14;break}return e.prev=4,e.next=7,n(90594)("./".concat(t,"/").concat(i,".json"));case 7:a=e.sent,gs.A.addResourceBundle(t,i,a.default),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),console.error("Language ".concat(t," not found!"));case 14:r++,e.next=1;break;case 17:case"end":return e.stop()}},e,null,[[4,11]])})),function(e){return i.apply(this,arguments)})},{key:"UNSAFE_componentWillMount",value:(o=Ss(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.props.language&&"en"!==this.props.language){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.ensureLanguageResources(this.props.language);case 4:gs.A.changeLanguage(this.props.language);case 5:case"end":return e.stop()}},e,this)})),function(){return o.apply(this,arguments)})},{key:"getlanguageOptions",value:function(){return[{value:"de",label:"Deutsch"},{value:"en",label:"English"},{value:"zh",label:"中文"},{value:"es",label:"Español"},{value:"ru",label:"Русский"},{value:"lt",label:"Lietuvių"},{value:"pt",label:"Português"},{value:"fr",label:"Français"},{value:"tr",label:"Türkçe"},{value:"ja",label:"日本語"},{value:"ar",label:"العربية"},{value:"it",label:"Italiano"},{value:"pl",label:"Polski"}]}},{key:"changeLanguage",value:(t=Ss(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&t!==this.props.language){e.next=2;break}return e.abrupt("return");case 2:return(0,on.H2)("change-language"),e.next=5,this.ensureLanguageResources(t);case 5:gs.A.changeLanguage(t),this.props.dispatch({type:we.mi,data:t});case 7:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"render",value:function(){var e=this,t=this.getlanguageOptions();return r.createElement("div",{style:{paddingBottom:100,width:q.zR,fontSize:14}},r.createElement(Ke.A,{name:"selectLanguage",id:"selectLanguage",value:t.filter(function(t){return t.value===e.props.language}),options:t,isClearable:!1,isSearchable:!1,isMulti:!1,onChange:function(t){e.changeLanguage(t.value)}}))}}]),l}(r.Component))||vs;const js=ks;var Ps=n(54532),As=n(85053),Is=n(63063),Ms=n(85408),Rs=n(91358),Ns=n(23005),Ds=n(44987),Ls=n(87354),Bs=n(60736),zs=n(2362);function Fs(e){return Fs="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},Fs(e)}function Ws(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"===Fs(e))if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Ws(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Vs(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Ws(e))&&(r&&(r+=" "),r+=t);return r}function Hs(e){var t=e.cellCount,n=e.cellSize,r=e.computeMetadataCallback,o=e.computeMetadataCallbackProps,i=e.nextCellsCount,a=e.nextCellSize,l=e.nextScrollToIndex,s=e.scrollToIndex,c=e.updateScrollOffsetForScrollToIndex;t===i&&("number"!=typeof n&&"number"!=typeof a||n===a)||(r(o),s>=0&&s===l&&c())}Object.defineProperty(Vs,"name",{value:"default",configurable:!0});var Gs=n(53466),Us=function(){function e(t){var n=t.cellCount,r=t.cellSizeGetter,o=t.estimatedCellSize;(0,Ms.A)(this,e),(0,zs.A)(this,"_cellSizeAndPositionData",{}),(0,zs.A)(this,"_lastMeasuredIndex",-1),(0,zs.A)(this,"_lastBatchedIndex",-1),(0,zs.A)(this,"_cellCount",void 0),(0,zs.A)(this,"_cellSizeGetter",void 0),(0,zs.A)(this,"_estimatedCellSize",void 0),this._cellSizeGetter=r,this._cellCount=n,this._estimatedCellSize=o}return(0,Rs.A)(e,[{key:"areOffsetsAdjusted",value:function(){return!1}},{key:"configure",value:function(e){var t=e.cellCount,n=e.estimatedCellSize,r=e.cellSizeGetter;this._cellCount=t,this._estimatedCellSize=n,this._cellSizeGetter=r}},{key:"getCellCount",value:function(){return this._cellCount}},{key:"getEstimatedCellSize",value:function(){return this._estimatedCellSize}},{key:"getLastMeasuredIndex",value:function(){return this._lastMeasuredIndex}},{key:"getOffsetAdjustment",value:function(){return 0}},{key:"getSizeAndPositionOfCell",value:function(e){if(e<0||e>=this._cellCount)throw Error("Requested index ".concat(e," is outside of range 0..").concat(this._cellCount));if(e>this._lastMeasuredIndex)for(var t=this.getSizeAndPositionOfLastMeasuredCell(),n=t.offset+t.size,r=this._lastMeasuredIndex+1;r<=e;r++){var o=this._cellSizeGetter({index:r});if(void 0===o||isNaN(o))throw Error("Invalid size returned for cell ".concat(r," of value ").concat(o));null===o?(this._cellSizeAndPositionData[r]={offset:n,size:0},this._lastBatchedIndex=e):(this._cellSizeAndPositionData[r]={offset:n,size:o},n+=o,this._lastMeasuredIndex=e)}return this._cellSizeAndPositionData[e]}},{key:"getSizeAndPositionOfLastMeasuredCell",value:function(){return this._lastMeasuredIndex>=0?this._cellSizeAndPositionData[this._lastMeasuredIndex]:{offset:0,size:0}}},{key:"getTotalSize",value:function(){var e=this.getSizeAndPositionOfLastMeasuredCell();return e.offset+e.size+(this._cellCount-this._lastMeasuredIndex-1)*this._estimatedCellSize}},{key:"getUpdatedOffsetForIndex",value:function(e){var t=e.align,n=void 0===t?"auto":t,r=e.containerSize,o=e.currentOffset,i=e.targetIndex;if(r<=0)return 0;var a,l=this.getSizeAndPositionOfCell(i),s=l.offset,c=s-r+l.size;switch(n){case"start":a=s;break;case"end":a=c;break;case"center":a=s-(r-l.size)/2;break;default:a=Math.max(c,Math.min(s,o))}var u=this.getTotalSize();return Math.max(0,Math.min(u-r,a))}},{key:"getVisibleCellRange",value:function(e){var t=e.containerSize,n=e.offset;if(0===this.getTotalSize())return{};var r=n+t,o=this._findNearestCell(n),i=this.getSizeAndPositionOfCell(o);n=i.offset+i.size;for(var a=o;n<r&&a<this._cellCount-1;)a++,n+=this.getSizeAndPositionOfCell(a).size;return{start:o,stop:a}}},{key:"resetCell",value:function(e){this._lastMeasuredIndex=Math.min(this._lastMeasuredIndex,e-1)}},{key:"_binarySearch",value:function(e,t,n){for(;t<=e;){var r=t+Math.floor((e-t)/2),o=this.getSizeAndPositionOfCell(r).offset;if(o===n)return r;o<n?t=r+1:o>n&&(e=r-1)}return t>0?t-1:0}},{key:"_exponentialSearch",value:function(e,t){for(var n=1;e<this._cellCount&&this.getSizeAndPositionOfCell(e).offset<t;)e+=n,n*=2;return this._binarySearch(Math.min(e,this._cellCount-1),Math.floor(e/2),t)}},{key:"_findNearestCell",value:function(e){if(isNaN(e))throw Error("Invalid offset ".concat(e," specified"));e=Math.max(0,e);var t=this.getSizeAndPositionOfLastMeasuredCell(),n=Math.max(0,this._lastMeasuredIndex);return t.offset>=e?this._binarySearch(n,0,e):this._exponentialSearch(n,e)}}]),e}(),qs=function(){function e(t){var n=t.maxScrollSize,r=void 0===n?"undefined"!=typeof window&&window.chrome?16777100:15e5:n,o=(0,Gs.A)(t,["maxScrollSize"]);(0,Ms.A)(this,e),(0,zs.A)(this,"_cellSizeAndPositionManager",void 0),(0,zs.A)(this,"_maxScrollSize",void 0),this._cellSizeAndPositionManager=new Us(o),this._maxScrollSize=r}return(0,Rs.A)(e,[{key:"areOffsetsAdjusted",value:function(){return this._cellSizeAndPositionManager.getTotalSize()>this._maxScrollSize}},{key:"configure",value:function(e){this._cellSizeAndPositionManager.configure(e)}},{key:"getCellCount",value:function(){return this._cellSizeAndPositionManager.getCellCount()}},{key:"getEstimatedCellSize",value:function(){return this._cellSizeAndPositionManager.getEstimatedCellSize()}},{key:"getLastMeasuredIndex",value:function(){return this._cellSizeAndPositionManager.getLastMeasuredIndex()}},{key:"getOffsetAdjustment",value:function(e){var t=e.containerSize,n=e.offset,r=this._cellSizeAndPositionManager.getTotalSize(),o=this.getTotalSize(),i=this._getOffsetPercentage({containerSize:t,offset:n,totalSize:o});return Math.round(i*(o-r))}},{key:"getSizeAndPositionOfCell",value:function(e){return this._cellSizeAndPositionManager.getSizeAndPositionOfCell(e)}},{key:"getSizeAndPositionOfLastMeasuredCell",value:function(){return this._cellSizeAndPositionManager.getSizeAndPositionOfLastMeasuredCell()}},{key:"getTotalSize",value:function(){return Math.min(this._maxScrollSize,this._cellSizeAndPositionManager.getTotalSize())}},{key:"getUpdatedOffsetForIndex",value:function(e){var t=e.align,n=void 0===t?"auto":t,r=e.containerSize,o=e.currentOffset,i=e.targetIndex;o=this._safeOffsetToOffset({containerSize:r,offset:o});var a=this._cellSizeAndPositionManager.getUpdatedOffsetForIndex({align:n,containerSize:r,currentOffset:o,targetIndex:i});return this._offsetToSafeOffset({containerSize:r,offset:a})}},{key:"getVisibleCellRange",value:function(e){var t=e.containerSize,n=e.offset;return n=this._safeOffsetToOffset({containerSize:t,offset:n}),this._cellSizeAndPositionManager.getVisibleCellRange({containerSize:t,offset:n})}},{key:"resetCell",value:function(e){this._cellSizeAndPositionManager.resetCell(e)}},{key:"_getOffsetPercentage",value:function(e){var t=e.containerSize,n=e.offset,r=e.totalSize;return r<=t?0:n/(r-t)}},{key:"_offsetToSafeOffset",value:function(e){var t=e.containerSize,n=e.offset,r=this._cellSizeAndPositionManager.getTotalSize(),o=this.getTotalSize();if(r===o)return n;var i=this._getOffsetPercentage({containerSize:t,offset:n,totalSize:r});return Math.round(i*(o-t))}},{key:"_safeOffsetToOffset",value:function(e){var t=e.containerSize,n=e.offset,r=this._cellSizeAndPositionManager.getTotalSize(),o=this.getTotalSize();if(r===o)return n;var i=this._getOffsetPercentage({containerSize:t,offset:n,totalSize:o});return Math.round(i*(r-t))}}]),e}();function Ks(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t={};return function(n){var r=n.callback,o=n.indices,i=Object.keys(o),a=!e||i.every(function(e){var t=o[e];return Array.isArray(t)?t.length>0:t>=0}),l=i.length!==Object.keys(t).length||i.some(function(e){var n=t[e],r=o[e];return Array.isArray(r)?n.join(",")!==r.join(","):n!==r});t=o,a&&l&&r(o)}}function $s(e){var t=e.cellSize,n=e.cellSizeAndPositionManager,r=e.previousCellsCount,o=e.previousCellSize,i=e.previousScrollToAlignment,a=e.previousScrollToIndex,l=e.previousSize,s=e.scrollOffset,c=e.scrollToAlignment,u=e.scrollToIndex,p=e.size,f=e.sizeJustIncreasedFromZero,d=e.updateScrollIndexCallback,h=n.getCellCount(),m=u>=0&&u<h;m&&(p!==l||f||!o||"number"==typeof t&&t!==o||c!==i||u!==a)?d(u):!m&&h>0&&(p<l||h<r)&&s>n.getTotalSize()-p&&d(h-1)}const Xs=!("undefined"==typeof window||!window.document||!window.document.createElement);var Ys,Qs;function Js(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=e&&this.setState(e)}function Zs(e){this.setState(function(t){var n=this.constructor.getDerivedStateFromProps(e,t);return null!=n?n:null}.bind(this))}function ec(e,t){try{var n=this.props,r=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}Js.__suppressDeprecationWarning=!0,Zs.__suppressDeprecationWarning=!0,ec.__suppressDeprecationWarning=!0;var tc,nc,rc=(Qs="undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).requestAnimationFrame||Qs.webkitRequestAnimationFrame||Qs.mozRequestAnimationFrame||Qs.oRequestAnimationFrame||Qs.msRequestAnimationFrame||function(e){return Qs.setTimeout(e,1e3/60)},oc=Qs.cancelAnimationFrame||Qs.webkitCancelAnimationFrame||Qs.mozCancelAnimationFrame||Qs.oCancelAnimationFrame||Qs.msCancelAnimationFrame||function(e){Qs.clearTimeout(e)},ic=rc,ac=oc,lc=function(e){return ac(e.id)};function sc(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 cc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sc(n,!0).forEach(function(t){(0,zs.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sc(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var uc="requested",pc=(nc=tc=function(e){function t(e){var n;(0,Ms.A)(this,t),n=(0,Ns.A)(this,(0,Ds.A)(t).call(this,e)),(0,zs.A)((0,Ls.A)(n),"_onGridRenderedMemoizer",Ks()),(0,zs.A)((0,Ls.A)(n),"_onScrollMemoizer",Ks(!1)),(0,zs.A)((0,Ls.A)(n),"_deferredInvalidateColumnIndex",null),(0,zs.A)((0,Ls.A)(n),"_deferredInvalidateRowIndex",null),(0,zs.A)((0,Ls.A)(n),"_recomputeScrollLeftFlag",!1),(0,zs.A)((0,Ls.A)(n),"_recomputeScrollTopFlag",!1),(0,zs.A)((0,Ls.A)(n),"_horizontalScrollBarSize",0),(0,zs.A)((0,Ls.A)(n),"_verticalScrollBarSize",0),(0,zs.A)((0,Ls.A)(n),"_scrollbarPresenceChanged",!1),(0,zs.A)((0,Ls.A)(n),"_scrollingContainer",void 0),(0,zs.A)((0,Ls.A)(n),"_childrenToDisplay",void 0),(0,zs.A)((0,Ls.A)(n),"_columnStartIndex",void 0),(0,zs.A)((0,Ls.A)(n),"_columnStopIndex",void 0),(0,zs.A)((0,Ls.A)(n),"_rowStartIndex",void 0),(0,zs.A)((0,Ls.A)(n),"_rowStopIndex",void 0),(0,zs.A)((0,Ls.A)(n),"_renderedColumnStartIndex",0),(0,zs.A)((0,Ls.A)(n),"_renderedColumnStopIndex",0),(0,zs.A)((0,Ls.A)(n),"_renderedRowStartIndex",0),(0,zs.A)((0,Ls.A)(n),"_renderedRowStopIndex",0),(0,zs.A)((0,Ls.A)(n),"_initialScrollTop",void 0),(0,zs.A)((0,Ls.A)(n),"_initialScrollLeft",void 0),(0,zs.A)((0,Ls.A)(n),"_disablePointerEventsTimeoutId",void 0),(0,zs.A)((0,Ls.A)(n),"_styleCache",{}),(0,zs.A)((0,Ls.A)(n),"_cellCache",{}),(0,zs.A)((0,Ls.A)(n),"_debounceScrollEndedCallback",function(){n._disablePointerEventsTimeoutId=null,n.setState({isScrolling:!1,needToResetStyleCache:!1})}),(0,zs.A)((0,Ls.A)(n),"_invokeOnGridRenderedHelper",function(){var e=n.props.onSectionRendered;n._onGridRenderedMemoizer({callback:e,indices:{columnOverscanStartIndex:n._columnStartIndex,columnOverscanStopIndex:n._columnStopIndex,columnStartIndex:n._renderedColumnStartIndex,columnStopIndex:n._renderedColumnStopIndex,rowOverscanStartIndex:n._rowStartIndex,rowOverscanStopIndex:n._rowStopIndex,rowStartIndex:n._renderedRowStartIndex,rowStopIndex:n._renderedRowStopIndex}})}),(0,zs.A)((0,Ls.A)(n),"_setScrollingContainerRef",function(e){n._scrollingContainer=e}),(0,zs.A)((0,Ls.A)(n),"_onScroll",function(e){e.target===n._scrollingContainer&&n.handleScrollEvent(e.target)});var r=new qs({cellCount:e.columnCount,cellSizeGetter:function(n){return t._wrapSizeGetter(e.columnWidth)(n)},estimatedCellSize:t._getEstimatedColumnSize(e)}),o=new qs({cellCount:e.rowCount,cellSizeGetter:function(n){return t._wrapSizeGetter(e.rowHeight)(n)},estimatedCellSize:t._getEstimatedRowSize(e)});return n.state={instanceProps:{columnSizeAndPositionManager:r,rowSizeAndPositionManager:o,prevColumnWidth:e.columnWidth,prevRowHeight:e.rowHeight,prevColumnCount:e.columnCount,prevRowCount:e.rowCount,prevIsScrolling:!0===e.isScrolling,prevScrollToColumn:e.scrollToColumn,prevScrollToRow:e.scrollToRow,scrollbarSize:0,scrollbarSizeMeasured:!1},isScrolling:!1,scrollDirectionHorizontal:1,scrollDirectionVertical:1,scrollLeft:0,scrollTop:0,scrollPositionChangeReason:null,needToResetStyleCache:!1},e.scrollToRow>0&&(n._initialScrollTop=n._getCalculatedScrollTop(e,n.state)),e.scrollToColumn>0&&(n._initialScrollLeft=n._getCalculatedScrollLeft(e,n.state)),n}return(0,Bs.A)(t,e),(0,Rs.A)(t,[{key:"getOffsetForCell",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.alignment,n=void 0===t?this.props.scrollToAlignment:t,r=e.columnIndex,o=void 0===r?this.props.scrollToColumn:r,i=e.rowIndex,a=void 0===i?this.props.scrollToRow:i,l=cc({},this.props,{scrollToAlignment:n,scrollToColumn:o,scrollToRow:a});return{scrollLeft:this._getCalculatedScrollLeft(l),scrollTop:this._getCalculatedScrollTop(l)}}},{key:"getTotalRowsHeight",value:function(){return this.state.instanceProps.rowSizeAndPositionManager.getTotalSize()}},{key:"getTotalColumnsWidth",value:function(){return this.state.instanceProps.columnSizeAndPositionManager.getTotalSize()}},{key:"handleScrollEvent",value:function(e){var t=e.scrollLeft,n=void 0===t?0:t,r=e.scrollTop,o=void 0===r?0:r;if(!(o<0)){this._debounceScrollEnded();var i=this.props,a=i.autoHeight,l=i.autoWidth,s=i.height,c=i.width,u=this.state.instanceProps,p=u.scrollbarSize,f=u.rowSizeAndPositionManager.getTotalSize(),d=u.columnSizeAndPositionManager.getTotalSize(),h=Math.min(Math.max(0,d-c+p),n),m=Math.min(Math.max(0,f-s+p),o);if(this.state.scrollLeft!==h||this.state.scrollTop!==m){var y={isScrolling:!0,scrollDirectionHorizontal:h!==this.state.scrollLeft?h>this.state.scrollLeft?1:-1:this.state.scrollDirectionHorizontal,scrollDirectionVertical:m!==this.state.scrollTop?m>this.state.scrollTop?1:-1:this.state.scrollDirectionVertical,scrollPositionChangeReason:"observed"};a||(y.scrollTop=m),l||(y.scrollLeft=h),y.needToResetStyleCache=!1,this.setState(y)}this._invokeOnScrollMemoizer({scrollLeft:h,scrollTop:m,totalColumnsWidth:d,totalRowsHeight:f})}}},{key:"invalidateCellSizeAfterRender",value:function(e){var t=e.columnIndex,n=e.rowIndex;this._deferredInvalidateColumnIndex="number"==typeof this._deferredInvalidateColumnIndex?Math.min(this._deferredInvalidateColumnIndex,t):t,this._deferredInvalidateRowIndex="number"==typeof this._deferredInvalidateRowIndex?Math.min(this._deferredInvalidateRowIndex,n):n}},{key:"measureAllCells",value:function(){var e=this.props,t=e.columnCount,n=e.rowCount,r=this.state.instanceProps;r.columnSizeAndPositionManager.getSizeAndPositionOfCell(t-1),r.rowSizeAndPositionManager.getSizeAndPositionOfCell(n-1)}},{key:"recomputeGridSize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.columnIndex,n=void 0===t?0:t,r=e.rowIndex,o=void 0===r?0:r,i=this.props,a=i.scrollToColumn,l=i.scrollToRow,s=this.state.instanceProps;s.columnSizeAndPositionManager.resetCell(n),s.rowSizeAndPositionManager.resetCell(o),this._recomputeScrollLeftFlag=a>=0&&(1===this.state.scrollDirectionHorizontal?n<=a:n>=a),this._recomputeScrollTopFlag=l>=0&&(1===this.state.scrollDirectionVertical?o<=l:o>=l),this._styleCache={},this._cellCache={},this.forceUpdate()}},{key:"scrollToCell",value:function(e){var t=e.columnIndex,n=e.rowIndex,r=this.props.columnCount,o=this.props;r>1&&void 0!==t&&this._updateScrollLeftForScrollToColumn(cc({},o,{scrollToColumn:t})),void 0!==n&&this._updateScrollTopForScrollToRow(cc({},o,{scrollToRow:n}))}},{key:"componentDidMount",value:function(){var e=this.props,n=e.getScrollbarSize,r=e.height,o=e.scrollLeft,i=e.scrollToColumn,a=e.scrollTop,l=e.scrollToRow,s=e.width,c=this.state.instanceProps;if(this._initialScrollTop=0,this._initialScrollLeft=0,this._handleInvalidatedGridSize(),c.scrollbarSizeMeasured||this.setState(function(e){var t=cc({},e,{needToResetStyleCache:!1});return t.instanceProps.scrollbarSize=n(),t.instanceProps.scrollbarSizeMeasured=!0,t}),"number"==typeof o&&o>=0||"number"==typeof a&&a>=0){var u=t._getScrollToPositionStateUpdate({prevState:this.state,scrollLeft:o,scrollTop:a});u&&(u.needToResetStyleCache=!1,this.setState(u))}this._scrollingContainer&&(this._scrollingContainer.scrollLeft!==this.state.scrollLeft&&(this._scrollingContainer.scrollLeft=this.state.scrollLeft),this._scrollingContainer.scrollTop!==this.state.scrollTop&&(this._scrollingContainer.scrollTop=this.state.scrollTop));var p=r>0&&s>0;i>=0&&p&&this._updateScrollLeftForScrollToColumn(),l>=0&&p&&this._updateScrollTopForScrollToRow(),this._invokeOnGridRenderedHelper(),this._invokeOnScrollMemoizer({scrollLeft:o||0,scrollTop:a||0,totalColumnsWidth:c.columnSizeAndPositionManager.getTotalSize(),totalRowsHeight:c.rowSizeAndPositionManager.getTotalSize()}),this._maybeCallOnScrollbarPresenceChange()}},{key:"componentDidUpdate",value:function(e,t){var n=this,r=this.props,o=r.autoHeight,i=r.autoWidth,a=r.columnCount,l=r.height,s=r.rowCount,c=r.scrollToAlignment,u=r.scrollToColumn,p=r.scrollToRow,f=r.width,d=this.state,h=d.scrollLeft,m=d.scrollPositionChangeReason,y=d.scrollTop,v=d.instanceProps;this._handleInvalidatedGridSize();var g=a>0&&0===e.columnCount||s>0&&0===e.rowCount;m===uc&&(!i&&h>=0&&(h!==this._scrollingContainer.scrollLeft||g)&&(this._scrollingContainer.scrollLeft=h),!o&&y>=0&&(y!==this._scrollingContainer.scrollTop||g)&&(this._scrollingContainer.scrollTop=y));var b=(0===e.width||0===e.height)&&l>0&&f>0;if(this._recomputeScrollLeftFlag?(this._recomputeScrollLeftFlag=!1,this._updateScrollLeftForScrollToColumn(this.props)):$s({cellSizeAndPositionManager:v.columnSizeAndPositionManager,previousCellsCount:e.columnCount,previousCellSize:e.columnWidth,previousScrollToAlignment:e.scrollToAlignment,previousScrollToIndex:e.scrollToColumn,previousSize:e.width,scrollOffset:h,scrollToAlignment:c,scrollToIndex:u,size:f,sizeJustIncreasedFromZero:b,updateScrollIndexCallback:function(){return n._updateScrollLeftForScrollToColumn(n.props)}}),this._recomputeScrollTopFlag?(this._recomputeScrollTopFlag=!1,this._updateScrollTopForScrollToRow(this.props)):$s({cellSizeAndPositionManager:v.rowSizeAndPositionManager,previousCellsCount:e.rowCount,previousCellSize:e.rowHeight,previousScrollToAlignment:e.scrollToAlignment,previousScrollToIndex:e.scrollToRow,previousSize:e.height,scrollOffset:y,scrollToAlignment:c,scrollToIndex:p,size:l,sizeJustIncreasedFromZero:b,updateScrollIndexCallback:function(){return n._updateScrollTopForScrollToRow(n.props)}}),this._invokeOnGridRenderedHelper(),h!==t.scrollLeft||y!==t.scrollTop){var w=v.rowSizeAndPositionManager.getTotalSize(),S=v.columnSizeAndPositionManager.getTotalSize();this._invokeOnScrollMemoizer({scrollLeft:h,scrollTop:y,totalColumnsWidth:S,totalRowsHeight:w})}this._maybeCallOnScrollbarPresenceChange()}},{key:"componentWillUnmount",value:function(){this._disablePointerEventsTimeoutId&&lc(this._disablePointerEventsTimeoutId)}},{key:"render",value:function(){var e=this.props,t=e.autoContainerWidth,n=e.autoHeight,o=e.autoWidth,i=e.className,a=e.containerProps,l=e.containerRole,s=e.containerStyle,c=e.height,u=e.id,p=e.noContentRenderer,f=e.role,d=e.style,h=e.tabIndex,m=e.width,y=this.state,v=y.instanceProps,g=y.needToResetStyleCache,b=this._isScrolling(),w={boxSizing:"border-box",direction:"ltr",height:n?"auto":c,position:"relative",width:o?"auto":m,WebkitOverflowScrolling:"touch",willChange:"transform"};g&&(this._styleCache={}),this.state.isScrolling||this._resetStyleCache(),this._calculateChildrenToRender(this.props,this.state);var S=v.columnSizeAndPositionManager.getTotalSize(),x=v.rowSizeAndPositionManager.getTotalSize(),E=x>c?v.scrollbarSize:0,O=S>m?v.scrollbarSize:0;O===this._horizontalScrollBarSize&&E===this._verticalScrollBarSize||(this._horizontalScrollBarSize=O,this._verticalScrollBarSize=E,this._scrollbarPresenceChanged=!0),w.overflowX=S+E<=m?"hidden":"auto",w.overflowY=x+O<=c?"hidden":"auto";var C=this._childrenToDisplay,T=0===C.length&&c>0&&m>0;return r.createElement("div",(0,Is.A)({ref:this._setScrollingContainerRef},a,{"aria-label":this.props["aria-label"],"aria-readonly":this.props["aria-readonly"],className:Vs("ReactVirtualized__Grid",i),id:u,onScroll:this._onScroll,role:f,style:cc({},w,{},d),tabIndex:h}),C.length>0&&r.createElement("div",{className:"ReactVirtualized__Grid__innerScrollContainer",role:l,style:cc({width:t?"auto":S,height:x,maxWidth:S,maxHeight:x,overflow:"hidden",pointerEvents:b?"none":"",position:"relative"},s)},C),T&&p())}},{key:"_calculateChildrenToRender",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state,n=e.cellRenderer,r=e.cellRangeRenderer,o=e.columnCount,i=e.deferredMeasurementCache,a=e.height,l=e.overscanColumnCount,s=e.overscanIndicesGetter,c=e.overscanRowCount,u=e.rowCount,p=e.width,f=e.isScrollingOptOut,d=t.scrollDirectionHorizontal,h=t.scrollDirectionVertical,m=t.instanceProps,y=this._initialScrollTop>0?this._initialScrollTop:t.scrollTop,v=this._initialScrollLeft>0?this._initialScrollLeft:t.scrollLeft,g=this._isScrolling(e,t);if(this._childrenToDisplay=[],a>0&&p>0){var b=m.columnSizeAndPositionManager.getVisibleCellRange({containerSize:p,offset:v}),w=m.rowSizeAndPositionManager.getVisibleCellRange({containerSize:a,offset:y}),S=m.columnSizeAndPositionManager.getOffsetAdjustment({containerSize:p,offset:v}),x=m.rowSizeAndPositionManager.getOffsetAdjustment({containerSize:a,offset:y});this._renderedColumnStartIndex=b.start,this._renderedColumnStopIndex=b.stop,this._renderedRowStartIndex=w.start,this._renderedRowStopIndex=w.stop;var E=s({direction:"horizontal",cellCount:o,overscanCellsCount:l,scrollDirection:d,startIndex:"number"==typeof b.start?b.start:0,stopIndex:"number"==typeof b.stop?b.stop:-1}),O=s({direction:"vertical",cellCount:u,overscanCellsCount:c,scrollDirection:h,startIndex:"number"==typeof w.start?w.start:0,stopIndex:"number"==typeof w.stop?w.stop:-1}),C=E.overscanStartIndex,T=E.overscanStopIndex,_=O.overscanStartIndex,k=O.overscanStopIndex;if(i){if(!i.hasFixedHeight())for(var j=_;j<=k;j++)if(!i.has(j,0)){C=0,T=o-1;break}if(!i.hasFixedWidth())for(var P=C;P<=T;P++)if(!i.has(0,P)){_=0,k=u-1;break}}this._childrenToDisplay=r({cellCache:this._cellCache,cellRenderer:n,columnSizeAndPositionManager:m.columnSizeAndPositionManager,columnStartIndex:C,columnStopIndex:T,deferredMeasurementCache:i,horizontalOffsetAdjustment:S,isScrolling:g,isScrollingOptOut:f,parent:this,rowSizeAndPositionManager:m.rowSizeAndPositionManager,rowStartIndex:_,rowStopIndex:k,scrollLeft:v,scrollTop:y,styleCache:this._styleCache,verticalOffsetAdjustment:x,visibleColumnIndices:b,visibleRowIndices:w}),this._columnStartIndex=C,this._columnStopIndex=T,this._rowStartIndex=_,this._rowStopIndex=k}}},{key:"_debounceScrollEnded",value:function(){var e=this.props.scrollingResetTimeInterval;this._disablePointerEventsTimeoutId&&lc(this._disablePointerEventsTimeoutId),this._disablePointerEventsTimeoutId=function(e,t){var n;Promise.resolve().then(function(){n=Date.now()});var r={id:ic(function o(){Date.now()-n>=t?e.call():r.id=ic(o)})};return r}(this._debounceScrollEndedCallback,e)}},{key:"_handleInvalidatedGridSize",value:function(){if("number"==typeof this._deferredInvalidateColumnIndex&&"number"==typeof this._deferredInvalidateRowIndex){var e=this._deferredInvalidateColumnIndex,t=this._deferredInvalidateRowIndex;this._deferredInvalidateColumnIndex=null,this._deferredInvalidateRowIndex=null,this.recomputeGridSize({columnIndex:e,rowIndex:t})}}},{key:"_invokeOnScrollMemoizer",value:function(e){var t=this,n=e.scrollLeft,r=e.scrollTop,o=e.totalColumnsWidth,i=e.totalRowsHeight;this._onScrollMemoizer({callback:function(e){var n=e.scrollLeft,r=e.scrollTop,a=t.props,l=a.height;(0,a.onScroll)({clientHeight:l,clientWidth:a.width,scrollHeight:i,scrollLeft:n,scrollTop:r,scrollWidth:o})},indices:{scrollLeft:n,scrollTop:r}})}},{key:"_isScrolling",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state;return Object.hasOwnProperty.call(e,"isScrolling")?Boolean(e.isScrolling):Boolean(t.isScrolling)}},{key:"_maybeCallOnScrollbarPresenceChange",value:function(){if(this._scrollbarPresenceChanged){var e=this.props.onScrollbarPresenceChange;this._scrollbarPresenceChanged=!1,e({horizontal:this._horizontalScrollBarSize>0,size:this.state.instanceProps.scrollbarSize,vertical:this._verticalScrollBarSize>0})}}},{key:"scrollToPosition",value:function(e){var n=e.scrollLeft,r=e.scrollTop,o=t._getScrollToPositionStateUpdate({prevState:this.state,scrollLeft:n,scrollTop:r});o&&(o.needToResetStyleCache=!1,this.setState(o))}},{key:"_getCalculatedScrollLeft",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state;return t._getCalculatedScrollLeft(e,n)}},{key:"_updateScrollLeftForScrollToColumn",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state,r=t._getScrollLeftForScrollToColumnStateUpdate(e,n);r&&(r.needToResetStyleCache=!1,this.setState(r))}},{key:"_getCalculatedScrollTop",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state;return t._getCalculatedScrollTop(e,n)}},{key:"_resetStyleCache",value:function(){var e=this._styleCache,t=this._cellCache,n=this.props.isScrollingOptOut;this._cellCache={},this._styleCache={};for(var r=this._rowStartIndex;r<=this._rowStopIndex;r++)for(var o=this._columnStartIndex;o<=this._columnStopIndex;o++){var i="".concat(r,"-").concat(o);this._styleCache[i]=e[i],n&&(this._cellCache[i]=t[i])}}},{key:"_updateScrollTopForScrollToRow",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.state,r=t._getScrollTopForScrollToRowStateUpdate(e,n);r&&(r.needToResetStyleCache=!1,this.setState(r))}}],[{key:"getDerivedStateFromProps",value:function(e,n){var r={};0===e.columnCount&&0!==n.scrollLeft||0===e.rowCount&&0!==n.scrollTop?(r.scrollLeft=0,r.scrollTop=0):(e.scrollLeft!==n.scrollLeft&&e.scrollToColumn<0||e.scrollTop!==n.scrollTop&&e.scrollToRow<0)&&Object.assign(r,t._getScrollToPositionStateUpdate({prevState:n,scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}));var o,i,a=n.instanceProps;return r.needToResetStyleCache=!1,e.columnWidth===a.prevColumnWidth&&e.rowHeight===a.prevRowHeight||(r.needToResetStyleCache=!0),a.columnSizeAndPositionManager.configure({cellCount:e.columnCount,estimatedCellSize:t._getEstimatedColumnSize(e),cellSizeGetter:t._wrapSizeGetter(e.columnWidth)}),a.rowSizeAndPositionManager.configure({cellCount:e.rowCount,estimatedCellSize:t._getEstimatedRowSize(e),cellSizeGetter:t._wrapSizeGetter(e.rowHeight)}),0!==a.prevColumnCount&&0!==a.prevRowCount||(a.prevColumnCount=0,a.prevRowCount=0),e.autoHeight&&!1===e.isScrolling&&!0===a.prevIsScrolling&&Object.assign(r,{isScrolling:!1}),Hs({cellCount:a.prevColumnCount,cellSize:"number"==typeof a.prevColumnWidth?a.prevColumnWidth:null,computeMetadataCallback:function(){return a.columnSizeAndPositionManager.resetCell(0)},computeMetadataCallbackProps:e,nextCellsCount:e.columnCount,nextCellSize:"number"==typeof e.columnWidth?e.columnWidth:null,nextScrollToIndex:e.scrollToColumn,scrollToIndex:a.prevScrollToColumn,updateScrollOffsetForScrollToIndex:function(){o=t._getScrollLeftForScrollToColumnStateUpdate(e,n)}}),Hs({cellCount:a.prevRowCount,cellSize:"number"==typeof a.prevRowHeight?a.prevRowHeight:null,computeMetadataCallback:function(){return a.rowSizeAndPositionManager.resetCell(0)},computeMetadataCallbackProps:e,nextCellsCount:e.rowCount,nextCellSize:"number"==typeof e.rowHeight?e.rowHeight:null,nextScrollToIndex:e.scrollToRow,scrollToIndex:a.prevScrollToRow,updateScrollOffsetForScrollToIndex:function(){i=t._getScrollTopForScrollToRowStateUpdate(e,n)}}),a.prevColumnCount=e.columnCount,a.prevColumnWidth=e.columnWidth,a.prevIsScrolling=!0===e.isScrolling,a.prevRowCount=e.rowCount,a.prevRowHeight=e.rowHeight,a.prevScrollToColumn=e.scrollToColumn,a.prevScrollToRow=e.scrollToRow,a.scrollbarSize=e.getScrollbarSize(),void 0===a.scrollbarSize?(a.scrollbarSizeMeasured=!1,a.scrollbarSize=0):a.scrollbarSizeMeasured=!0,r.instanceProps=a,cc({},r,{},o,{},i)}},{key:"_getEstimatedColumnSize",value:function(e){return"number"==typeof e.columnWidth?e.columnWidth:e.estimatedColumnSize}},{key:"_getEstimatedRowSize",value:function(e){return"number"==typeof e.rowHeight?e.rowHeight:e.estimatedRowSize}},{key:"_getScrollToPositionStateUpdate",value:function(e){var t=e.prevState,n=e.scrollLeft,r=e.scrollTop,o={scrollPositionChangeReason:uc};return"number"==typeof n&&n>=0&&(o.scrollDirectionHorizontal=n>t.scrollLeft?1:-1,o.scrollLeft=n),"number"==typeof r&&r>=0&&(o.scrollDirectionVertical=r>t.scrollTop?1:-1,o.scrollTop=r),"number"==typeof n&&n>=0&&n!==t.scrollLeft||"number"==typeof r&&r>=0&&r!==t.scrollTop?o:{}}},{key:"_wrapSizeGetter",value:function(e){return"function"==typeof e?e:function(){return e}}},{key:"_getCalculatedScrollLeft",value:function(e,t){var n=e.columnCount,r=e.height,o=e.scrollToAlignment,i=e.scrollToColumn,a=e.width,l=t.scrollLeft,s=t.instanceProps;if(n>0){var c=n-1,u=i<0?c:Math.min(c,i),p=s.rowSizeAndPositionManager.getTotalSize(),f=s.scrollbarSizeMeasured&&p>r?s.scrollbarSize:0;return s.columnSizeAndPositionManager.getUpdatedOffsetForIndex({align:o,containerSize:a-f,currentOffset:l,targetIndex:u})}return 0}},{key:"_getScrollLeftForScrollToColumnStateUpdate",value:function(e,n){var r=n.scrollLeft,o=t._getCalculatedScrollLeft(e,n);return"number"==typeof o&&o>=0&&r!==o?t._getScrollToPositionStateUpdate({prevState:n,scrollLeft:o,scrollTop:-1}):{}}},{key:"_getCalculatedScrollTop",value:function(e,t){var n=e.height,r=e.rowCount,o=e.scrollToAlignment,i=e.scrollToRow,a=e.width,l=t.scrollTop,s=t.instanceProps;if(r>0){var c=r-1,u=i<0?c:Math.min(c,i),p=s.columnSizeAndPositionManager.getTotalSize(),f=s.scrollbarSizeMeasured&&p>a?s.scrollbarSize:0;return s.rowSizeAndPositionManager.getUpdatedOffsetForIndex({align:o,containerSize:n-f,currentOffset:l,targetIndex:u})}return 0}},{key:"_getScrollTopForScrollToRowStateUpdate",value:function(e,n){var r=n.scrollTop,o=t._getCalculatedScrollTop(e,n);return"number"==typeof o&&o>=0&&r!==o?t._getScrollToPositionStateUpdate({prevState:n,scrollLeft:-1,scrollTop:o}):{}}}]),t}(r.PureComponent),(0,zs.A)(tc,"propTypes",null),nc);(0,zs.A)(pc,"defaultProps",{"aria-label":"grid","aria-readonly":!0,autoContainerWidth:!1,autoHeight:!1,autoWidth:!1,cellRangeRenderer:function(e){for(var t=e.cellCache,n=e.cellRenderer,r=e.columnSizeAndPositionManager,o=e.columnStartIndex,i=e.columnStopIndex,a=e.deferredMeasurementCache,l=e.horizontalOffsetAdjustment,s=e.isScrolling,c=e.isScrollingOptOut,u=e.parent,p=e.rowSizeAndPositionManager,f=e.rowStartIndex,d=e.rowStopIndex,h=e.styleCache,m=e.verticalOffsetAdjustment,y=e.visibleColumnIndices,v=e.visibleRowIndices,g=[],b=r.areOffsetsAdjusted()||p.areOffsetsAdjusted(),w=!s&&!b,S=f;S<=d;S++)for(var x=p.getSizeAndPositionOfCell(S),E=o;E<=i;E++){var O=r.getSizeAndPositionOfCell(E),C=E>=y.start&&E<=y.stop&&S>=v.start&&S<=v.stop,T="".concat(S,"-").concat(E),_=void 0;w&&h[T]?_=h[T]:a&&!a.has(S,E)?_={height:"auto",left:0,position:"absolute",top:0,width:"auto"}:(_={height:x.size,left:O.offset+l,position:"absolute",top:x.offset+m,width:O.size},h[T]=_);var k={columnIndex:E,isScrolling:s,isVisible:C,key:T,parent:u,rowIndex:S,style:_},j=void 0;!c&&!s||l||m?j=n(k):(t[T]||(t[T]=n(k)),j=t[T]),null!=j&&!1!==j&&g.push(j)}return g},containerRole:"rowgroup",containerStyle:{},estimatedColumnSize:100,estimatedRowSize:30,getScrollbarSize:function(e){if((!Ys&&0!==Ys||e)&&Xs){var t=document.createElement("div");t.style.position="absolute",t.style.top="-9999px",t.style.width="50px",t.style.height="50px",t.style.overflow="scroll",document.body.appendChild(t),Ys=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Ys},noContentRenderer:function(){return null},onScroll:function(){},onScrollbarPresenceChange:function(){},onSectionRendered:function(){},overscanColumnCount:0,overscanIndicesGetter:function(e){var t=e.cellCount,n=e.overscanCellsCount,r=e.scrollDirection,o=e.startIndex,i=e.stopIndex;return 1===r?{overscanStartIndex:Math.max(0,o),overscanStopIndex:Math.min(t-1,i+n)}:{overscanStartIndex:Math.max(0,o-n),overscanStopIndex:Math.min(t-1,i)}},overscanRowCount:10,role:"grid",scrollingResetTimeInterval:150,scrollToAlignment:"auto",scrollToColumn:-1,scrollToRow:-1,style:{},tabIndex:0,isScrollingOptOut:!1}),function(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof e.getDerivedStateFromProps&&"function"!=typeof t.getSnapshotBeforeUpdate)return e;var n=null,r=null,o=null;if("function"==typeof t.componentWillMount?n="componentWillMount":"function"==typeof t.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof t.componentWillReceiveProps?r="componentWillReceiveProps":"function"==typeof t.UNSAFE_componentWillReceiveProps&&(r="UNSAFE_componentWillReceiveProps"),"function"==typeof t.componentWillUpdate?o="componentWillUpdate":"function"==typeof t.UNSAFE_componentWillUpdate&&(o="UNSAFE_componentWillUpdate"),null!==n||null!==r||null!==o){var i=e.displayName||e.name,a="function"==typeof e.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+i+" uses "+a+" but also contains the following legacy lifecycles:"+(null!==n?"\n "+n:"")+(null!==r?"\n "+r:"")+(null!==o?"\n "+o:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"==typeof e.getDerivedStateFromProps&&(t.componentWillMount=Js,t.componentWillReceiveProps=Zs),"function"==typeof t.getSnapshotBeforeUpdate){if("function"!=typeof t.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=ec;var l=t.componentDidUpdate;t.componentDidUpdate=function(e,t,n){var r=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;l.call(this,e,t,r)}}}(pc);const fc=pc;var dc,hc,mc=(hc=dc=function(e){function t(){var e,n;(0,Ms.A)(this,t);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return n=(0,Ns.A)(this,(e=(0,Ds.A)(t)).call.apply(e,[this].concat(o))),(0,zs.A)((0,Ls.A)(n),"Grid",void 0),(0,zs.A)((0,Ls.A)(n),"_cellRenderer",function(e){var t=e.parent,r=e.rowIndex,o=e.style,i=e.isScrolling,a=e.isVisible,l=e.key,s=n.props.rowRenderer,c=Object.getOwnPropertyDescriptor(o,"width");return c&&c.writable&&(o.width="100%"),s({index:r,style:o,isScrolling:i,isVisible:a,key:l,parent:t})}),(0,zs.A)((0,Ls.A)(n),"_setRef",function(e){n.Grid=e}),(0,zs.A)((0,Ls.A)(n),"_onScroll",function(e){var t=e.clientHeight,r=e.scrollHeight,o=e.scrollTop;(0,n.props.onScroll)({clientHeight:t,scrollHeight:r,scrollTop:o})}),(0,zs.A)((0,Ls.A)(n),"_onSectionRendered",function(e){var t=e.rowOverscanStartIndex,r=e.rowOverscanStopIndex,o=e.rowStartIndex,i=e.rowStopIndex;(0,n.props.onRowsRendered)({overscanStartIndex:t,overscanStopIndex:r,startIndex:o,stopIndex:i})}),n}return(0,Bs.A)(t,e),(0,Rs.A)(t,[{key:"forceUpdateGrid",value:function(){this.Grid&&this.Grid.forceUpdate()}},{key:"getOffsetForRow",value:function(e){var t=e.alignment,n=e.index;return this.Grid?this.Grid.getOffsetForCell({alignment:t,rowIndex:n,columnIndex:0}).scrollTop:0}},{key:"invalidateCellSizeAfterRender",value:function(e){var t=e.columnIndex,n=e.rowIndex;this.Grid&&this.Grid.invalidateCellSizeAfterRender({rowIndex:n,columnIndex:t})}},{key:"measureAllRows",value:function(){this.Grid&&this.Grid.measureAllCells()}},{key:"recomputeGridSize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.columnIndex,n=void 0===t?0:t,r=e.rowIndex,o=void 0===r?0:r;this.Grid&&this.Grid.recomputeGridSize({rowIndex:o,columnIndex:n})}},{key:"recomputeRowHeights",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.recomputeGridSize({rowIndex:e,columnIndex:0})}},{key:"scrollToPosition",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.scrollToPosition({scrollTop:e})}},{key:"scrollToRow",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.Grid&&this.Grid.scrollToCell({columnIndex:0,rowIndex:e})}},{key:"render",value:function(){var e=this.props,t=e.className,n=e.noRowsRenderer,o=e.scrollToIndex,i=e.width,a=Vs("ReactVirtualized__List",t);return r.createElement(fc,(0,Is.A)({},this.props,{autoContainerWidth:!0,cellRenderer:this._cellRenderer,className:a,columnWidth:i,columnCount:1,noContentRenderer:n,onScroll:this._onScroll,onSectionRendered:this._onSectionRendered,ref:this._setRef,scrollToRow:o}))}}]),t}(r.PureComponent),(0,zs.A)(dc,"propTypes",null),hc);(0,zs.A)(mc,"defaultProps",{autoHeight:!1,estimatedRowSize:30,onScroll:function(){},noRowsRenderer:function(){return null},onRowsRendered:function(){},overscanIndicesGetter:function(e){var t=e.cellCount,n=e.overscanCellsCount,r=e.scrollDirection,o=e.startIndex,i=e.stopIndex;return n=Math.max(1,n),1===r?{overscanStartIndex:Math.max(0,o-1),overscanStopIndex:Math.min(t-1,i+n)}:{overscanStartIndex:Math.max(0,o-n),overscanStopIndex:Math.min(t-1,i+1)}},overscanRowCount:10,scrollToAlignment:"auto",scrollToIndex:-1,style:{}});var yc,vc,gc=n(83370),bc=(vc=yc=function(e){function t(){var e,n;(0,Ms.A)(this,t);for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return n=(0,Ns.A)(this,(e=(0,Ds.A)(t)).call.apply(e,[this].concat(o))),(0,zs.A)((0,Ls.A)(n),"_child",void 0),(0,zs.A)((0,Ls.A)(n),"_measure",function(){var e=n.props,t=e.cache,r=e.columnIndex,o=void 0===r?0:r,i=e.parent,a=e.rowIndex,l=void 0===a?n.props.index||0:a,s=n._getCellMeasurements(),c=s.height,u=s.width;c===t.getHeight(l,o)&&u===t.getWidth(l,o)||(t.set(l,o,u,c),i&&"function"==typeof i.recomputeGridSize&&i.recomputeGridSize({columnIndex:o,rowIndex:l}))}),(0,zs.A)((0,Ls.A)(n),"_registerChild",function(e){!e||e instanceof Element||console.warn("CellMeasurer registerChild expects to be passed Element or null"),n._child=e,e&&n._maybeMeasureCell()}),n}return(0,Bs.A)(t,e),(0,Rs.A)(t,[{key:"componentDidMount",value:function(){this._maybeMeasureCell()}},{key:"componentDidUpdate",value:function(){this._maybeMeasureCell()}},{key:"render",value:function(){var e=this.props.children;return"function"==typeof e?e({measure:this._measure,registerChild:this._registerChild}):e}},{key:"_getCellMeasurements",value:function(){var e=this.props.cache,t=this._child||(0,gc.findDOMNode)(this);if(t&&t.ownerDocument&&t.ownerDocument.defaultView&&t instanceof t.ownerDocument.defaultView.HTMLElement){var n=t.style.width,r=t.style.height;e.hasFixedWidth()||(t.style.width="auto"),e.hasFixedHeight()||(t.style.height="auto");var o=Math.ceil(t.offsetHeight),i=Math.ceil(t.offsetWidth);return n&&(t.style.width=n),r&&(t.style.height=r),{height:o,width:i}}return{height:0,width:0}}},{key:"_maybeMeasureCell",value:function(){var e=this.props,t=e.cache,n=e.columnIndex,r=void 0===n?0:n,o=e.parent,i=e.rowIndex,a=void 0===i?this.props.index||0:i;if(!t.has(a,r)){var l=this._getCellMeasurements(),s=l.height,c=l.width;t.set(a,r,c,s),o&&"function"==typeof o.invalidateCellSizeAfterRender&&o.invalidateCellSizeAfterRender({columnIndex:r,rowIndex:a})}}}]),t}(r.PureComponent),(0,zs.A)(yc,"propTypes",null),vc);(0,zs.A)(bc,"__internalCellMeasurerFlag",!1);var wc=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,Ms.A)(this,e),(0,zs.A)(this,"_cellHeightCache",{}),(0,zs.A)(this,"_cellWidthCache",{}),(0,zs.A)(this,"_columnWidthCache",{}),(0,zs.A)(this,"_rowHeightCache",{}),(0,zs.A)(this,"_defaultHeight",void 0),(0,zs.A)(this,"_defaultWidth",void 0),(0,zs.A)(this,"_minHeight",void 0),(0,zs.A)(this,"_minWidth",void 0),(0,zs.A)(this,"_keyMapper",void 0),(0,zs.A)(this,"_hasFixedHeight",void 0),(0,zs.A)(this,"_hasFixedWidth",void 0),(0,zs.A)(this,"_columnCount",0),(0,zs.A)(this,"_rowCount",0),(0,zs.A)(this,"columnWidth",function(e){var n=e.index,r=t._keyMapper(0,n);return void 0!==t._columnWidthCache[r]?t._columnWidthCache[r]:t._defaultWidth}),(0,zs.A)(this,"rowHeight",function(e){var n=e.index,r=t._keyMapper(n,0);return void 0!==t._rowHeightCache[r]?t._rowHeightCache[r]:t._defaultHeight});var r=n.defaultHeight,o=n.defaultWidth,i=n.fixedHeight,a=n.fixedWidth,l=n.keyMapper,s=n.minHeight,c=n.minWidth;this._hasFixedHeight=!0===i,this._hasFixedWidth=!0===a,this._minHeight=s||0,this._minWidth=c||0,this._keyMapper=l||Sc,this._defaultHeight=Math.max(this._minHeight,"number"==typeof r?r:30),this._defaultWidth=Math.max(this._minWidth,"number"==typeof o?o:100)}return(0,Rs.A)(e,[{key:"clear",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._keyMapper(e,t);delete this._cellHeightCache[n],delete this._cellWidthCache[n],this._updateCachedColumnAndRowSizes(e,t)}},{key:"clearAll",value:function(){this._cellHeightCache={},this._cellWidthCache={},this._columnWidthCache={},this._rowHeightCache={},this._rowCount=0,this._columnCount=0}},{key:"hasFixedHeight",value:function(){return this._hasFixedHeight}},{key:"hasFixedWidth",value:function(){return this._hasFixedWidth}},{key:"getHeight",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(this._hasFixedHeight)return this._defaultHeight;var n=this._keyMapper(e,t);return void 0!==this._cellHeightCache[n]?Math.max(this._minHeight,this._cellHeightCache[n]):this._defaultHeight}},{key:"getWidth",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(this._hasFixedWidth)return this._defaultWidth;var n=this._keyMapper(e,t);return void 0!==this._cellWidthCache[n]?Math.max(this._minWidth,this._cellWidthCache[n]):this._defaultWidth}},{key:"has",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this._keyMapper(e,t);return void 0!==this._cellHeightCache[n]}},{key:"set",value:function(e,t,n,r){var o=this._keyMapper(e,t);t>=this._columnCount&&(this._columnCount=t+1),e>=this._rowCount&&(this._rowCount=e+1),this._cellHeightCache[o]=r,this._cellWidthCache[o]=n,this._updateCachedColumnAndRowSizes(e,t)}},{key:"_updateCachedColumnAndRowSizes",value:function(e,t){if(!this._hasFixedWidth){for(var n=0,r=0;r<this._rowCount;r++)n=Math.max(n,this.getWidth(r,t));var o=this._keyMapper(0,t);this._columnWidthCache[o]=n}if(!this._hasFixedHeight){for(var i=0,a=0;a<this._columnCount;a++)i=Math.max(i,this.getHeight(e,a));var l=this._keyMapper(e,0);this._rowHeightCache[l]=i}}},{key:"defaultHeight",get:function(){return this._defaultHeight}},{key:"defaultWidth",get:function(){return this._defaultWidth}}]),e}();function Sc(e,t){return"".concat(e,"-").concat(t)}const xc=function(e){var t,n,o=e.children,i=e.maxHeight,a=e.focusedOption,l=(0,r.useRef)(null),s=(0,r.useRef)(null),c=(0,r.useRef)(new wc({fixedWidth:!0,defaultHeight:40}));if(o instanceof Array){var u=o.findIndex(function(e){return dr()(a,e.props.data)});u>=0&&(t=u)}return(0,r.useLayoutEffect)(function(){var e=o instanceof Array?function(e){return e.map(function(e){return e.key})}(o):o;dr()(s.current,e)||(c.current.clearAll(),l.current.recomputeRowHeights(),s.current=e)},[o]),r.createElement(mc,{ref:l,height:(n=Object.values(c.current._rowHeightCache).reduce(function(e,t){return e+t},0),0===n?i:Math.min(i,n)),deferredMeasurementCache:c.current,rowHeight:c.current.rowHeight,rowRenderer:function(e){var t=e.index,n=e.key,i=e.parent,a=e.style;return r.createElement(bc,{cache:c.current,columnIndex:0,key:n,parent:i,rowIndex:t},r.createElement("div",{style:a},o instanceof Array?o[t]:o))},rowCount:o.length||1,width:q.zR,scrollToIndex:t})};function Ec(e){return Ec="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},Ec(e)}var Oc;function Cc(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=_c(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},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 i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function Tc(e){return function(e){if(Array.isArray(e))return kc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_c(e)||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.")}()}function _c(e,t){if(e){if("string"==typeof e)return kc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kc(e,t):void 0}}function kc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function jc(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,Dc(r.key),r)}}function Pc(e,t){return Pc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Pc(e,t)}function Ac(e){var t=Mc();return function(){var n,r=Rc(e);if(t){var o=Rc(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==Ec(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Ic(e)}(this,n)}}function Ic(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mc(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Mc=function(){return!!e})()}function Rc(e){return Rc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Rc(e)}function Nc(e,t,n){return(t=Dc(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dc(e){var t=function(e){if("object"!=Ec(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ec(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ec(t)?t:t+""}var Lc=(0,a.Ng)(function(e){var t,n,r,o;return{activeFilters:e.controls.filters,colorings:e.metadata.colorings,totalStateCounts:e.tree.totalStateCounts,canFilterByGenotype:!!e.entropy.genomeMap,nodes:e.tree.nodes,nodesSecondTree:null===(t=e.treeToo)||void 0===t?void 0:t.nodes,totalStateCountsSecondTree:null===(n=e.treeToo)||void 0===n?void 0:n.totalStateCounts,measurementsFieldsMap:null===(r=e.measurements.collectionToDisplay)||void 0===r?void 0:r.fields,measurementsFiltersMap:null===(o=e.measurements.collectionToDisplay)||void 0===o?void 0:o.filters,measurementsFilters:e.controls.measurementsFilters}})(Oc=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Pc(e,t)}(n,e);var t=Ac(n);function n(e){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),Nc(Ic(r=t.call(this,e)),"makeOptions",function(){var e,t=[],n=Object.keys(r.props.colorings||{}),o=[].concat(Tc(Object.keys(r.props.totalStateCounts)),Tc(Object.keys(r.props.totalStateCountsSecondTree))),i=Cc([].concat(Tc(n.filter(function(e){return o.includes(e)})),Tc(o.filter(function(e){return!n.includes(e)}))));try{for(i.s();!(e=i.n()).done;){var a,l,s,c=e.value,u=new Set([].concat(Tc((null===(a=r.props.totalStateCounts[c])||void 0===a?void 0:a.keys())||[]),Tc((null===(l=r.props.totalStateCountsSecondTree)||void 0===l||null===(s=l[c])||void 0===s?void 0:s.keys())||[])));r.props.totalStateCounts[c];var p,f=r.getFilterTitle(c),d=new Set((r.props.activeFilters[c]||[]).filter(function(e){return e.active}).map(function(e){return e.value})),h=Cc(Array.from(u).sort());try{for(h.s();!(p=h.n()).done;){var m=p.value;d.has(m)||t.push({label:"".concat(f," → ").concat(m),value:[c,m]})}}catch(e){h.e(e)}finally{h.f()}}}catch(e){i.e(e)}finally{i.f()}if(r.props.canFilterByGenotype){var y=(0,As.M5)(r.props.nodes),v=r.props.nodesSecondTree?(0,As.M5)(r.props.nodesSecondTree).difference(y):new Set;Array.from(y).concat(Array.from(v)).sort().forEach(function(e){t.push({label:"genotype ".concat(e),value:[q.IW,e]})})}var g=r.props.nodes.filter(function(e){return!e.hasChildren}).map(function(e){return e.name});if(g.forEach(function(e){t.push({label:"sample → ".concat(e),value:[q.Uf,e]})}),r.props.nodesSecondTree){var b=new Set(g);r.props.nodesSecondTree.filter(function(e){return!e.hasChildren&&!b.has(e.name)}).forEach(function(e){t.push({label:"sample → ".concat(e.name),value:[q.Uf,e.name]})})}return r.props.measurementsOn&&r.props.measurementsFiltersMap&&r.props.measurementsFieldsMap&&r.props.measurementsFiltersMap.forEach(function(e,n){var o=e.values,i=r.props.measurementsFieldsMap.get(n).title;o.forEach(function(e){t.push({_type:"measurements",label:"(M) ".concat(i," → ").concat(e),value:[n,e]})})}),t}),Nc(Ic(r),"selectionMade",function(e){return"measurements"===e._type?r.props.dispatch((0,U.Z1)(e.value[0],e.value[1],!0)):r.props.dispatch((0,G.$h)("add",e.value[0],[e.value[1]]))}),Nc(Ic(r),"summariseFilters",function(){return Reflect.ownKeys(r.props.activeFilters).filter(function(e){return r.props.activeFilters[e].length>0}).map(function(e){var t=r.props.activeFilters[e].filter(function(e){return e.active}).length;return{filterName:e,displayName:Fc(t,r.getFilterTitle(e)),anyFiltersActive:function(){return r.props.activeFilters[e].filter(function(e){return e.active}).length>0},remove:function(){r.props.dispatch((0,G.$h)("set",e,[]))},activate:function(){r.props.dispatch((0,G.$h)("add",e,r.props.activeFilters[e].map(function(e){return e.value})))},inactivate:function(){r.props.dispatch((0,G.$h)("inactivate",e,r.props.activeFilters[e].map(function(e){return e.value})))}}})}),Nc(Ic(r),"summariseMeasurementsFilters",function(){return void 0===r.props.measurementsFieldsMap?[]:Object.entries(r.props.measurementsFilters).map(function(e){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||_c(e,t)||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.")}()}(e,2),n=t[0],o=t[1],i=Array.from(o.values()).reduce(function(e,t){return t.active?e+1:e},0);return{field:n,activeFiltersCount:i,badgeTitle:"".concat(i," x ").concat(r.props.measurementsFieldsMap.get(n).title)}})}),r}return function(e,t){t&&jc(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(n,[{key:"getStyles",value:function(){return{base:{width:q.zR,marginBottom:0,fontSize:14}}}},{key:"getFilterTitle",value:function(e){return this.props.colorings&&this.props.colorings[e]&&this.props.colorings[e].title||e}},{key:"render",value:function(){var e=this,t=this.makeOptions(),n=io()(function(e,n){return n(t)},200),o=this.getStyles(),i=this.summariseFilters(),a=this.summariseMeasurementsFilters(),l=String(Object.keys(this.props.totalStateCounts).join(","));return r.createElement("div",{style:o.base,key:l},r.createElement(Ps.A,{name:"filterQueryBox",placeholder:"Type filter query here...",value:null,defaultOptions:!0,loadOptions:n,filterOption:function(e,t){return t.toLowerCase().split(" ").every(function(t){return e.label.toLowerCase().includes(t)})},isClearable:!1,isSearchable:!0,isMulti:!1,components:{DropdownIndicator:null,MenuList:xc},onChange:this.selectionMade,styles:Ke.M}),i.length?r.createElement(r.Fragment,null,r.createElement($e.Dg,{spaceAbove:!0},"Currently selected filter categories:"),i.map(function(e){return r.createElement("div",{style:{display:"inline-block",margin:"2px"},key:e.displayName},r.createElement(K.k8,{active:e.anyFiltersActive(),canMakeInactive:!0,id:e.displayName,remove:e.remove,activate:e.activate,inactivate:e.inactivate,onHoverMessage:"Data is currently filtered by ".concat(e.displayName)},e.displayName))})):null,a.length?r.createElement(r.Fragment,null,r.createElement($e.Dg,{spaceAbove:!0},"Currently selected measurements filters:"),a.map(function(t){var n=t.field,o=t.activeFiltersCount,i=t.badgeTitle;return r.createElement("div",{style:{display:"inline-block",margin:"2px"},key:i},r.createElement(K.k8,{active:o>0,canMakeInactive:!0,id:i,remove:function(){return e.props.dispatch((0,U.xB)(n))},activate:function(){return e.props.dispatch((0,U.BH)(n,!0))},inactivate:function(){return e.props.dispatch((0,U.BH)(n,!1))},onHoverMessage:"Measurements are currently filtered by ".concat(i)},i))})):null)}}]),n}(r.Component))||Oc,Bc=r.createElement(r.Fragment,null,"Use this box to filter the displayed data based upon filtering criteria.\n For instance, start typing a country's name to filter the data accordingly.",r.createElement("br",null),"Data is filtered by forming a union of selected values within each category, and then taking the intersection between categories (if more than one category is selected).",r.createElement("br",null),"Scroll to the bottom of the main page (under the data visualisation) to see an expanded display of filters and available values.",r.createElement("br",null),'Filter options prefixed with "(M)" are filters specific to the Measurements panel. They will have no effect on the phylogeny tree or other panels.');const zc=Lc;function Fc(e,t){return t===q.Uf?"".concat(e," x samples"):t===q.IW?"".concat(e," x genotypes"):"".concat(e," x ").concat(t)}var Wc=r.createElement(r.Fragment,null,"This panel displays the evolutionary relationships among samples, illustrating their genetic relatedness and inferred ancestry.",r.createElement("br",null),"The exact options available depend on the dataset and specific analysis performed.",r.createElement("br",null),"If ",r.createElement("em",null,"Branch Length")," is available, you can choose to display the tree branches in terms of (nucleotide) divergence or (inferred) time. It is often helpful to toggle on ",r.createElement("em",null,"confidence intervals")," to gauge the uncertainty in the reconstruction of internal node dates."),Vc=r.createElement(r.Fragment,null,"This panel displays the geographical distribution of samples.",r.createElement("br",null),"The ",r.createElement("em",null,"geographic resolution")," chooses the metadata values which define where samples are placed on the map. This can be the same as the selected ",r.createElement("em",null,"color-by")," but is often not!"),Hc=r.createElement(r.Fragment,null,"Change various options relating to how the animation proceeds."),Gc=r.createElement(r.Fragment,null,"Control whether to show the tree and the map side-by-side (",r.createElement("em",null,"grid"),") or expanded (",r.createElement("em",null,"full"),")."),Uc=r.createElement(r.Fragment,null,"This panel displays the observed diversity across the current genome or a selected CDS. All options are in the panel itself."),qc=r.createElement(r.Fragment,null,"This panel displays the prevalence of a characteristic over time, determined by the ",r.createElement("em",null,"color-by"),".",r.createElement("br",null),r.createElement("em",null,"Normalize frequencies")," controls whether the vertical axis represents the entire dataset or only the samples currently visible (e.g. due to filtering). This option is not available when data is limited to prevent numerical issues."),Kc=r.createElement(r.Fragment,null,"This panel displays multidimensional data such as serological experimental results that are linked to samples in the tree.",r.createElement("br",null),"Change collection of measurements and various display options for the collection."),$c=r.createElement(r.Fragment,null,"Exploding a tree by trait X means that for each branch where the trait changes value, we will prune off the branch and create a separate (sub)tree. It works best when the trait doesn't change value too frequently."),Xc=(r.Fragment,function(e){var t=e.title,n=e.tooltip,o=void 0===n?void 0:n;return r.createElement($e.B3,null,r.createElement(Ql,{title:t,tooltip:o}))});function Yc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}const Qc=function(){var e=(0,Yl.j)(),t=(0,a.d4)(function(e){return e.measurements.collectionToDisplay}),n=(0,a.d4)(function(e){return e.measurements.collections.map(function(e){return{value:e.key,label:e.title||e.key}})},dr()),o=(0,a.d4)(function(e){return e.controls.measurementsGroupBy}),i=(0,a.d4)(function(e){return e.controls.measurementsDisplay}),l=(0,a.d4)(function(e){return e.controls.measurementsShowOverallMean}),s=(0,a.d4)(function(e){return e.controls.measurementsShowThreshold}),c=[];return t.groupings&&(c=function(e){return function(e){if(Array.isArray(e))return Yc(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Yc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yc(e,t):void 0}}(e)||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.")}()}(t.groupings.keys()).map(function(e){return{value:e,label:t.fields.get(e).title}})),r.createElement("div",{id:"measurementsControls"},r.createElement($e.Dg,null,"Collections"),r.createElement("div",{style:{marginBottom:10,width:q.zR,fontSize:14}},r.createElement(Ke.A,{name:"measurementsCollections",id:"measurementsCollections",value:n.filter(function(e){return e.value===t.key}),options:n,isClearable:!1,isSearchable:!1,isMulti:!1,onChange:function(t){e((0,U.Gc)(t.value))}})),r.createElement($e.Dg,null,"Group By"),r.createElement("div",{style:{marginBottom:10,width:q.zR,fontSize:14}},r.createElement(Ke.A,{name:"measurementsGroupings",id:"measurementsGroupings",value:c.filter(function(e){return e.value===o}),options:c,isClearable:!1,isSearchable:!1,isMulti:!1,onChange:function(t){e((0,U.y$)(t.value))}})),r.createElement($e.Dg,null,"Measurements Display"),r.createElement($e.VH,{selected:"mean"===i,onClick:function(){e((0,U.ad)("mean"))}},"Mean ± SD"),r.createElement($e.VH,{selected:"raw"===i,onClick:function(){e((0,U.ad)("raw"))}},"Raw"),r.createElement(Ni,{style:{padding:"10px 0px"},display:!0,on:l,label:"Show overall mean ± SD",callback:function(){return e((0,U.l3)())}}),r.createElement(Ni,{display:Array.isArray(t.thresholds)&&t.thresholds.some(function(e){return"number"==typeof e}),on:s,label:"Show measurement threshold(s)",callback:function(){return e((0,U.q8)())}}))},Jc=function(){var e=(0,he.B)().t,t=(0,a.d4)(function(e){return e.controls.panelsAvailable}),n=(0,a.d4)(function(e){return e.controls.panelsToDisplay}),o=(0,a.d4)(function(e){return e.controls.showTreeToo}),i=(0,a.d4)(function(e){return e.controls.canTogglePanelLayout}),l=(0,a.d4)(function(e){return e.controls.branchLengthsToDisplay});return r.createElement($e._d,null,r.createElement(pt,null),"divOnly"!==l&&r.createElement(r.Fragment,null,r.createElement(Xc,{title:e("sidebar:Date Range"),tooltip:oi}),r.createElement(ii,null),r.createElement(mi,null)),r.createElement(Xc,{title:e("sidebar:Color By"),tooltip:So}),r.createElement(xo,null),r.createElement(Xc,{title:e("sidebar:Filter Data"),tooltip:Bc}),r.createElement(zc,{measurementsOn:n.includes("measurements")}),r.createElement("span",{style:{paddingTop:"10px"}}),t.includes("tree")&&r.createElement(rs,{panel:"tree",title:e("sidebar:Tree"),tooltip:Wc,options:r.createElement(r.Fragment,null,r.createElement(Ta,null),r.createElement(Xa,null),r.createElement(os,null),r.createElement(ms,null),r.createElement(Ui,null),r.createElement(Fa.A,null),r.createElement(Ba,null),r.createElement(_i,{tooltip:$c}),r.createElement(ds,null))}),t.includes("measurements")&&r.createElement(rs,{panel:"measurements",title:e("sidebar:Measurements"),tooltip:Kc,options:r.createElement(Qc,null)}),t.includes("map")&&!o&&r.createElement(rs,{panel:"map",title:e("sidebar:Map"),tooltip:Vc,options:r.createElement(r.Fragment,null,r.createElement(gl,null),r.createElement(kl,null))}),t.includes("entropy")&&r.createElement(rs,{panel:"entropy",title:e("sidebar:Entropy"),tooltip:Uc}),t.includes("frequencies")&&r.createElement(rs,{panel:"frequencies",title:e("sidebar:Frequency"),tooltip:qc,options:r.createElement(zl,null)}),"divOnly"!==l&&r.createElement("span",{style:{marginTop:"10px"}},r.createElement(Xc,{title:e("sidebar:Animation Options"),tooltip:Hc}),r.createElement(Xl,null)),i&&r.createElement(r.Fragment,null,r.createElement("span",{style:{paddingTop:"10px"}}),r.createElement(Xc,{title:e("sidebar:Display"),tooltip:Gc}),r.createElement(sl,null)),r.createElement("span",{style:{paddingTop:"10px"}}),r.createElement(Xc,{title:e("sidebar:Language")}),r.createElement(js,null))};var Zc=n(41930);function eu(e){return eu="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},eu(e)}function tu(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 nu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tu(Object(n),!0).forEach(function(t){ru(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ru(e,t,n){return(t=function(e){var t=function(e){if("object"!=eu(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=eu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==eu(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ou=l.Ay.div.withConfig({displayName:"styles__PanelsContainer",componentId:"sc-18umnzu-0"})(["position:absolute;top:0;bottom:0;right:0;transition:left 0.3s ease-out;background-color:#fff;height:",";width:",";overflow-x:hidden;overflow-y:auto;left:",";"],function(e){return e.height+"px"},function(e){return e.width+"px"},function(e){return e.left+"px"}),iu=l.Ay.div.withConfig({displayName:"styles__SidebarContainer",componentId:"sc-18umnzu-1"})(["position:absolute;top:0;bottom:0;right:0;transition:left 0.3s ease-out;left:",";background-color:",";height:",";width:",";max-width:",";overflow-y:auto;overflow-x:hidden;box-shadow:-3px 0px 3px -3px "," inset;font-family:",";"],function(e){return e.left+"px"},function(e){return e.theme.background},function(e){return e.height+"px"},function(e){return e.width+"px"},function(e){return e.width+"px"},function(e){return e.theme.sidebarBoxShadow},function(e){return e.theme["font-family"]}),au={};(0,Zc.Q)("sidebarTheme")&&(au=(0,Zc.u)("sidebarTheme"),Object.prototype.hasOwnProperty.call(au,"unselectedBackground")&&(au.alternateBackground=au.unselectedBackground));var lu=nu(nu({},{background:"#30353F",color:"#D3D3D3","font-family":"Lato, Helvetica Neue, Helvetica, sans-serif",sidebarBoxShadow:"rgba(255, 255, 255, 1)",selectedColor:"#5DA8A3",unselectedColor:"#BBB",alternateBackground:"#888"}),au),su=function(e){var t=e.width,n=e.height,o=e.displayNarrative,i=e.narrativeTitle,s=e.navBarHandler,c=(0,a.d4)(function(e){return e.controls.sidebarOpen});return r.createElement(l.NP,{theme:lu},r.createElement(iu,{left:c?0:-1*t,width:t,height:n},r.createElement(ro.A,{sidebar:!0,toggleHandler:s,narrativeTitle:!!o&&i,width:t}),o?r.createElement(Zr,{height:n-q.iY,width:t}):r.createElement(Jc,null)))},cu=n(50085),uu=n(41916),pu=n(55894),fu=(0,r.lazy)(function(){return n.e(418).then(n.bind(n,95418))}),du=l.Ay.div.withConfig({displayName:"MainDisplayMarkdown__Container",componentId:"sc-5tw4mo-0"})(["margin:",";font-family:",";font-weight:300;color:",";line-height:1.4;width:","px;font-size:14px;line-height:1.4;@media (max-width:1080px){line-height:1.2;}h1{font-weight:700;font-size:2em;margin:0.3em 0;}h2{font-weight:600;font-size:1.8em;margin:0.3em 0;}h3{font-weight:500;font-size:1.6em;margin:0.3em 0;}h4{font-weight:500;font-size:1.4em;margin:0.2em 0;}h5{font-weight:500;font-size:1.2em;margin:0.2em 0;}h6{font-weight:500;font-size:1.2em;margin:0.2em 0;}pre{padding:16px;overflow:auto;font-size:85%;line-height:1.45;background-color:#f6f8fa;border-radius:3px;}.line{margin-top:20px;margin-bottom:20px;border-bottom:1px solid #CCC;}.imageContainer{display:flex;justify-content:center;align-items:center;flex-wrap:wrap;}img{margin-left:30px;margin-right:30px;margin-top:2px;margin-bottom:2px;max-width:100%;}table,th,td{border:1px solid;}td,th{padding:3px;}"],function(e){return e.mobile?"10px 5% 5% 5%":"50px 30px 30px 30px"},c.sf,function(e){return e.theme.unselectedColor},function(e){return e.width-30});const hu=(0,a.Ng)(function(e){return{narrativeBlock:e.narrative.blocks[e.narrative.blockIdx]}})(function(e){var t=e.narrativeBlock,n=e.width,o=e.mobile;return r.createElement(du,{width:n,mobile:o},r.createElement(r.Suspense,null,r.createElement(fu,{dir:"auto",mdstring:t.mainDisplayMarkdown,placeholder:"Narrative content should be displayed here, however it wasn't correctly formatted."})))});function mu(e){return mu="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},mu(e)}var yu;function vu(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 gu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vu(Object(n),!0).forEach(function(t){Cu(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function bu(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,Tu(r.key),r)}}function wu(e,t){return wu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},wu(e,t)}function Su(e){var t=Eu();return function(){var n,r=Ou(e);if(t){var o=Ou(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==mu(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return xu(e)}(this,n)}}function xu(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Eu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Eu=function(){return!!e})()}function Ou(e){return Ou=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ou(e)}function Cu(e,t,n){return(t=Tu(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tu(e){var t=function(e){if("object"!=mu(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=mu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==mu(t)?t:t+""}var _u=(0,r.lazy)(function(){return Promise.all([n.e(165),n.e(652)]).then(n.bind(n,37588))}),ku=(0,a.Ng)(function(e){return{loaded:e.narrative.loaded,blocks:e.narrative.blocks,currentInFocusBlockIdx:e.narrative.blockIdx,panelsToDisplay:e.controls.panelsToDisplay,treeName:e.tree.name}})(yu=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&wu(e,t)}(n,e);var t=Su(n);function n(e){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),Cu(xu(o=t.call(this,e)),"NextButton",function(e){return r.createElement(ur,{height:o.state.bannerHeight,onClick:o.goToNextPage},e.children)}),Cu(xu(o),"PreviousButton",function(e){return r.createElement(cr,{height:o.state.bannerHeight,onClick:o.goToPreviousPage},e.children)}),o.state={bannerHeight:50,contentHeight:window.innerHeight-100},o.goToNextPage=function(){o.props.currentInFocusBlockIdx+1!==o.props.blocks.length&&o._goToPage(o.props.currentInFocusBlockIdx+1)},o.goToPreviousPage=function(){0!==o.props.currentInFocusBlockIdx&&o._goToPage(o.props.currentInFocusBlockIdx-1)},o._goToPage=function(e){o.props.dispatch((0,qe.yd)(eo(o.props.blocks,o.props.currentInFocusBlockIdx,e))),document.getElementById("progress-bar").scrollIntoView()},o}return function(e,t){t&&bu(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(n,[{key:"pageNarrativeContent",value:function(){if(this.props.blocks[this.props.currentInFocusBlockIdx].mainDisplayMarkdown)return null;var e=this.props.blocks[this.props.currentInFocusBlockIdx].__html;return 0===this.props.currentInFocusBlockIdx&&(e='\n <p class="explanation">\n Narratives are interleaved sections of text and associated Nextstrain visualisations of the genomic data.\n Click the coloured arrows at the top & bottom of each page to move through this narrative.\n Within each page, you can scroll through the text to see visualisations of the genomic data.\n </p>\n'+e),r.createElement("div",{id:"NarrativeBlock_".concat(this.props.currentInFocusBlockIdx),style:{padding:"10px 20px",height:"inherit",overflow:"hidden"},dangerouslySetInnerHTML:{__html:e}})}},{key:"renderMainMarkdown",value:function(){return this.props.panelsToDisplay.includes("MainDisplayMarkdown")?r.createElement(hu,{width:window.innerWidth,mobile:!0}):null}},{key:"renderVizCards",value:function(e){if(this.props.blocks[this.props.currentInFocusBlockIdx].mainDisplayMarkdown)return null;if(0===this.props.currentInFocusBlockIdx)return null;var t=window.innerWidth-50;return r.createElement(r.Fragment,null,this.props.panelsToDisplay.includes("tree")?r.createElement(Be,{width:t,height:e,key:this.props.treeName}):null,this.props.panelsToDisplay.includes("map")?r.createElement(r.Suspense,{fallback:null},r.createElement(_u,{width:t,height:e,justGotNewDatasetRenderNewMap:!1,key:this.props.treeName+"_map"})):null)}},{key:"renderEndOfNarrative",value:function(){var e=this;return r.createElement(r.Fragment,null,r.createElement(this.PreviousButton,null,"Previous"),r.createElement(pr,{height:this.state.contentHeight+this.state.bannerHeight},this.renderProgress(),r.createElement(sr,null,r.createElement("h1",null,"End of Narrative"),r.createElement("a",{style:gu({},or),onClick:function(){return e._goToPage(0)}},"Jump to the beginning"),r.createElement("br",null),r.createElement("a",{style:gu({},or),onClick:function(){return e.props.dispatch({type:we.IZ,narrativeOn:!1})}},"Leave the narrative & explore the data yourself"))))}},{key:"renderStartOfNarrative",value:function(){return r.createElement(r.Fragment,null,r.createElement(pr,{height:this.state.contentHeight+this.state.bannerHeight},this.renderProgress(),this.pageNarrativeContent(),this.renderVizCards(this.state.contentHeight),this.renderMainMarkdown()),r.createElement(this.NextButton,null,"Next"))}},{key:"renderMiddleOfNarrative",value:function(){return r.createElement(r.Fragment,null,r.createElement(this.PreviousButton,{"aria-labelledby":"nav1"},"Previous"),r.createElement(pr,{height:this.state.contentHeight},this.renderProgress(),this.pageNarrativeContent(),this.renderVizCards(this.state.contentHeight),this.renderMainMarkdown()),r.createElement(this.NextButton,{"aria-labelledby":"nav2"},"Next"))}},{key:"renderProgress",value:function(){var e=this;return r.createElement(ir,{id:"progress-bar",style:{height:"".concat(25,"px")}},this.props.blocks.map(function(t,n){var o=e.props.currentInFocusBlockIdx===n?"14px":"6px";return r.createElement(ar,{key:n,style:{width:o,height:o},onClick:function(){return e._goToPage(n)}})}))}},{key:"render",value:function(){return 0===this.props.currentInFocusBlockIdx?this.renderStartOfNarrative():this.props.currentInFocusBlockIdx!==this.props.blocks.length-1?this.renderMiddleOfNarrative():this.renderEndOfNarrative()}}]),n}(r.Component))||yu;const ju=ku;function Pu(e){return Pu="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},Pu(e)}function Au(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,Iu(r.key),r)}}function Iu(e){var t=function(e){if("object"!=Pu(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Pu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Pu(t)?t:t+""}function Mu(e,t){return Mu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Mu(e,t)}function Ru(e){var t=Nu();return function(){var n,r=Du(e);if(t){var o=Du(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==Pu(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function Nu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Nu=function(){return!!e})()}function Du(e){return Du=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Du(e)}var Lu=l.Ay.div.withConfig({displayName:"panelErrorBoundary__Background",componentId:"sc-1jt7nzz-0"})(["background:repeating-linear-gradient( 45deg,transparent,transparent 20px,#f4d2ff 20px,#f4d2ff 21px );margin:10px 10px;padding:10px 10px;border:1px solid #f4d2ff;display:inline-block;position:relative;"]),Bu=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Mu(e,t)}(n,e);var t=Ru(n);function n(e){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(r=t.call(this,e)).state={hasError:!1,errorMessage:""},r}return function(e,t,n){t&&Au(e.prototype,t),n&&Au(e,n),Object.defineProperty(e,"prototype",{writable:!1})}(n,[{key:"componentDidCatch",value:function(e,t){console.error(e),console.error(t)}},{key:"render",value:function(){return this.state.hasError?r.createElement(Lu,{style:{width:this.props.width,height:this.props.height}},r.createElement("h1",{style:{fontSize:"3rem"}},"Error! Something's gone wrong within the ".concat(this.props.name," panel")),r.createElement("p",{style:{fontSize:"1.8rem"}},'Error message: "'.concat(this.state.errorMessage,'"')),r.createElement("p",{style:{fontSize:"1.8rem"}},"Please consider making a bug report either on ",r.createElement("a",{href:"https://github.com/nextstrain/auspice/issues/new",target:"_blank",rel:"noreferrer noopener"},"GitHub")," or via ",r.createElement("a",{href:"mailto:hello@nextstrain.org",target:"_blank",rel:"noreferrer noopener"},"email"),". (The more information you can include the better - things such as steps to reproduce the bug, your browser version, the version of Auspice etc are incredibly helpful.)"),r.createElement("p",{style:{fontSize:"1.8rem"}},"In the meantime you could try refreshing the page which may fix things in the short term.")):this.props.children}}],[{key:"getDerivedStateFromError",value:function(e){return{hasError:!0,errorMessage:e instanceof Error?e.message:"Unknown error (thrown value was not an instance of Error)"}}}]),n}(r.Component);const zu=Bu;function Fu(e){return Fu="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},Fu(e)}var Wu,Vu;function Hu(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,Xu(r.key),r)}}function Gu(e,t){return Gu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Gu(e,t)}function Uu(e){var t=Ku();return function(){var n,r=$u(e);if(t){var o=$u(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==Fu(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return qu(e)}(this,n)}}function qu(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ku(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ku=function(){return!!e})()}function $u(e){return $u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},$u(e)}function Xu(e){var t=function(e){if("object"!=Fu(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Fu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Fu(t)?t:t+""}var Yu=(0,r.lazy)(function(){return Promise.all([n.e(165),n.e(631)]).then(n.bind(n,62631))}),Qu=(0,r.lazy)(function(){return Promise.all([n.e(165),n.e(54)]).then(n.bind(n,44054))}),Ju=(0,r.lazy)(function(){return Promise.all([n.e(165),n.e(833)]).then(n.bind(n,10897))}),Zu=(0,r.lazy)(function(){return Promise.all([n.e(165),n.e(652)]).then(n.bind(n,37588))}),ep=(0,a.Ng)(function(e){return{panelsToDisplay:e.controls.panelsToDisplay,panelLayout:e.controls.panelLayout,displayNarrative:e.narrative.display,narrativeIsLoaded:e.narrative.loaded,narrativeTitle:e.narrative.title,browserDimensions:e.browserDimensions.browserDimensions,frequenciesLoaded:e.frequencies.loaded,metadataLoaded:e.metadata.loaded,treeLoaded:e.tree.loaded,sidebarOpen:e.controls.sidebarOpen,showOnlyPanels:e.controls.showOnlyPanels,treeName:e.tree.name,secondTreeName:e.controls.showTreeToo,modalOpen:!!e.controls.modal,mobileDisplay:e.general.mobileDisplay}})((Vu=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Gu(e,t)}(n,e);var t=Uu(n);function n(e){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(r=t.call(this,e)).state={showSpinner:!(r.props.metadataLoaded&&r.props.treeLoaded)},(0,on.aG)(),r.toggleSidebar=r.toggleSidebar.bind(qu(r)),r.eventListenerForFilesDropped=function(e){return e.preventDefault(),r.props.dispatch((t=e.dataTransfer.files,function(){var e,n=(e=regeneratorRuntime.mark(function e(n,r){var o,i,a,l,s,c,u,p,f;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:o=r(),i=o.tree,a=o.treeToo,l=Bn(i,a),s=Nn(t),e.prev=3,s.s();case 5:if((c=s.n()).done){e.next=37;break}if(u=c.value,e.prev=7,p=void 0,!sn(u)){e.next=15;break}return e.next=12,vn(u,l);case 12:p=e.sent,e.next=23;break;case 15:if(!cn(u)){e.next=21;break}return e.next=18,In(u,l);case 18:p=e.sent,e.next=23;break;case 21:return n((0,an.A2)({message:"Parsing of '".concat(u.name,"' failed"),details:"Unhandled file type"})),e.abrupt("continue",35);case 23:if((f=n((0,Mt.D)(p)))!==Mt.q){e.next=28;break}n((0,an.v0)({message:"Adding metadata from ".concat(u.name),details:"n = ".concat(Object.keys(p.attributes).length," fields(s)")})),e.next=29;break;case 28:throw Error(f);case 29:e.next=35;break;case 31:e.prev=31,e.t0=e.catch(7),console.error(e.t0),n((0,an.A2)({message:"Parsing of '".concat(u.name,"' failed"),details:e.t0 instanceof Error?e.t0.message:String(e.t0)}));case 35:e.next=5;break;case 37:e.next=42;break;case 39:e.prev=39,e.t1=e.catch(3),s.e(e.t1);case 42:return e.prev=42,s.f(),e.finish(42);case 45:case"end":return e.stop()}},e,null,[[3,39,42,45],[7,31]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){Ln(i,r,o,a,l,"next",e)}function l(e){Ln(i,r,o,a,l,"throw",e)}a(void 0)})});return function(e,t){return n.apply(this,arguments)}}()));var t},r.eventListenerForFilesDragged=function(e){e.preventDefault()},r}return function(e,t){t&&Hu(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(n,[{key:"UNSAFE_componentWillReceiveProps",value:function(e){this.state.showSpinner&&e.metadataLoaded&&e.treeLoaded&&this.setState({showSpinner:!1})}},{key:"componentDidMount",value:function(){document.addEventListener("dragover",this.eventListenerForFilesDragged,!1),document.addEventListener("drop",this.eventListenerForFilesDropped,!1)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("dragover",this.eventListenerForFilesDragged),document.removeEventListener("drop",this.eventListenerForFilesDropped)}},{key:"toggleSidebar",value:function(){this.props.dispatch({type:we.o8,value:!this.props.sidebarOpen}),this.props.modalOpen&&this.props.dispatch({type:we.vN,modal:null})}},{key:"inGrid",value:function(){return"grid"===this.props.panelLayout}},{key:"shouldShowMeasurementsLegend",value:function(){return!this.props.panelsToDisplay.includes("tree")||!this.inGrid()}},{key:"shouldMapBeInGrid",value:function(){var e=(0,Fn.u$)(this.props.panelsToDisplay)%2==0;return this.inGrid()&&e}},{key:"shouldShowMapLegend",value:function(){return!this.shouldMapBeInGrid()}},{key:"render",value:function(){var e=this;if(this.state.showSpinner)return r.createElement(pu.Y,null);if(this.props.mobileDisplay&&this.props.displayNarrative)return r.createElement(r.Fragment,null,r.createElement(Yn,null),r.createElement(l.NP,{theme:lu},r.createElement(ju,null)));var t,n,o=(0,cu.m)(this.props.browserDimensions,this.props.displayNarrative,this.props.sidebarOpen,this.props.mobileDisplay),i=o.availableWidth,a=o.availableHeight,s=o.sidebarWidth,p=o.overlayStyles,f=function(){e.props.dispatch({type:we.o8,value:!1})},d=(0,cu.j)(this.props.panelsToDisplay,this.props.displayNarrative,i,a),h=d.full,m=d.grid,y=d.chartEntropy,v=d.chartFrequencies,g="".concat(this.props.treeName).concat(this.props.secondTreeName?":".concat(this.props.secondTreeName):"");return r.createElement("span",null,r.createElement(Yn,null),r.createElement(uu.A,{showNothing:!0},r.createElement(l.NP,{theme:lu},r.createElement(tn,null))),r.createElement(u,{sidebarOpen:this.props.sidebarOpen,mobileDisplay:this.props.mobileDisplay,handler:this.toggleSidebar}),r.createElement(su,{width:s,height:a,displayNarrative:this.props.displayNarrative,narrativeTitle:this.props.narrativeTitle,navBarHandler:this.toggleSidebar}),r.createElement(ou,{width:i,height:a,left:this.props.sidebarOpen?s:0},this.props.narrativeIsLoaded&&!this.props.panelsToDisplay.includes("MainDisplayMarkdown")?(t=this.props.dispatch,n=this.props.displayNarrative,r.createElement("button",{style:er(er({},c.cH),{},{fontSize:14,backgroundColor:"inherit",zIndex:100,position:"fixed",right:5,top:-1,cursor:"pointer",color:c.KD}),onClick:function(){return t({type:we.IZ,narrativeOn:!n})}},n?"explore the data yourself":"return to the narrative")):null,this.props.displayNarrative||this.props.showOnlyPanels?null:r.createElement(De,{width:(0,Qn.u)(i,1)}),this.props.panelsToDisplay.includes("tree")?r.createElement(zu,{width:this.inGrid()?m.width:h.width,height:this.inGrid()?m.height:h.height,name:"tree"},r.createElement(Be,{width:this.inGrid()?m.width:h.width,height:this.inGrid()?m.height:h.height,key:g})):null,this.props.panelsToDisplay.includes("measurements")?r.createElement(r.Suspense,{fallback:r.createElement(pu.q,{width:this.inGrid()?m.width:h.width,height:this.inGrid()?m.height:h.height,key:g+"_measurements_spinner"})},r.createElement(zu,{width:this.inGrid()?m.width:h.width,height:this.inGrid()?m.height:h.height,name:"measurements"},r.createElement(Ju,{width:this.inGrid()?m.width:h.width,height:this.inGrid()?m.height:h.height,key:g+"_measurements",showLegend:this.shouldShowMeasurementsLegend()}))):null,this.props.panelsToDisplay.includes("map")?r.createElement(r.Suspense,{fallback:r.createElement(pu.q,{width:this.inGrid()?m.width:h.width,height:this.inGrid()?m.height:h.height,key:g+"_map_spinner"})},r.createElement(zu,{width:this.shouldMapBeInGrid()?m.width:h.width,height:this.shouldMapBeInGrid()?m.height:h.height,name:"map"},r.createElement(Zu,{width:this.shouldMapBeInGrid()?m.width:h.width,height:this.shouldMapBeInGrid()?m.height:h.height,key:g+"_map",justGotNewDatasetRenderNewMap:!1,legend:this.shouldShowMapLegend()}))):null,this.props.panelsToDisplay.includes("entropy")?r.createElement(r.Suspense,{fallback:null},r.createElement(zu,{width:y.width,height:y.height,name:"entropy"},r.createElement(Yu,{width:y.width,height:y.height,key:g+"_entropy"}))):null,this.props.panelsToDisplay.includes("frequencies")&&this.props.frequenciesLoaded?r.createElement(r.Suspense,{fallback:null},r.createElement(zu,{width:v.width,height:v.height,name:"frequencies"},r.createElement(Qu,{width:v.width,height:v.height,key:g+"_frequencies"}))):null,this.props.displayNarrative||this.props.showOnlyPanels?null:r.createElement(ze.A,{width:(0,Qn.u)(i,1)}),this.props.displayNarrative||this.props.showOnlyPanels?null:r.createElement(Fe.Ay,{width:(0,Qn.u)(i,1)}),this.props.displayNarrative&&this.props.panelsToDisplay.includes("MainDisplayMarkdown")?r.createElement(hu,{width:(0,Qn.u)(i,1)}):null),this.props.mobileDisplay?r.createElement("div",{style:p,onClick:f,onTouchStart:f}):null)}}]),n}(r.Component),function(e,t,n){(t=Xu(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(Vu,"propTypes",{dispatch:i().func.isRequired}),Wu=Vu))||Wu;const tp=ep},50085(e,t,n){"use strict";n.d(t,{j:()=>i,m:()=>a});var r=n(4379),o=n(40952),i=function(e,t,n,o){var i=.36,a=.88,l=.64;if(t){var s=!0+e.includes("entropy")+e.includes("frequencies")-1;0===s?(a=1,l=1):1===s?(a=.7,l=.7,i=.3):(a=.5,l=.5,i=.25)}return{full:(0,r.I)({horizontal:1,vertical:a,availableWidth:n,availableHeight:o}),grid:(0,r.I)({horizontal:.5,vertical:l,availableWidth:n,availableHeight:o}),chartFrequencies:(0,r.I)({horizontal:1,vertical:i,availableWidth:n,availableHeight:o,minHeight:200}),chartEntropy:(0,r.I)({horizontal:1,vertical:i,availableWidth:n,availableHeight:o,minHeight:300})}},a=function(e,t,n,r){var i,a=e.width,l=e.height,s=(i=a,t?i>1500?500:i>1e3?400:310:o.zR+o.wP),c=n?s:0;return r||(a-=c),{overlayStyles:{position:"absolute",top:0,bottom:0,right:0,display:"block",width:a,height:l,left:n?c:0,opacity:n?1:0,visibility:n?"visible":"hidden",zIndex:8e3,backgroundColor:"rgba(0,0,0,0.5)",cursor:"pointer",overflow:"scroll",transition:n?"visibility 0s ease-out, left 0.3s ease-out, opacity 0.3s ease-out":"left 0.3s ease-out, opacity 0.3s ease-out, visibility 0s ease-out 0.3s"},availableWidth:a,availableHeight:l,sidebarWidth:s}}},62617(e,t,n){"use strict";n.d(t,{Y:()=>g,f:()=>b});var r=n(78281),o=n(77313),i=n(49633),a=n(4124),l=n(41930),s=n(21143);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var u=o.Ay.a.withConfig({displayName:"LinkOutModalContents__ButtonText",componentId:"sc-9zdqjf-0"})(["border:1px solid ",";border-radius:4px;cursor:pointer;padding:4px 7px;margin-right:10px;font-family:",";background-color:rgba(0,0,0,0);color:white !important;font-weight:400;text-decoration:none !important;font-size:16px;flex-shrink:0;&:hover{background-color:",";}"],a.Ty,a.sf,function(e){return e.theme.selectedColor}),p=o.Ay.span.withConfig({displayName:"LinkOutModalContents__InactiveButton",componentId:"sc-9zdqjf-1"})(["border:1px solid ",";border-radius:4px;cursor:auto;padding:4px 7px;margin-right:10px;font-family:",";background-color:rgba(0,0,0,0);color:white;font-weight:400;text-decoration:line-through !important;font-size:16px;flex-shrink:0;"],a.Ty,a.sf),f=o.Ay.span.withConfig({displayName:"LinkOutModalContents__ButtonDescription",componentId:"sc-9zdqjf-2"})(["display:inline-block;font-style:italic;font-size:14px;color:white;"]),d=o.Ay.div.withConfig({displayName:"LinkOutModalContents__ButtonContainer",componentId:"sc-9zdqjf-3"})(["margin-top:10px;margin-bottom:10px;display:flex;flex-wrap:nowrap;align-items:center;"]);function h(){return{pathname:window.location.pathname,origin:window.location.origin}}function m(){var e,t,n,o="taxonium.org",a=h(),l=a.pathname,m=a.origin,y=(0,i.d4)(function(e){return e.controls}),v=y.distanceMeasure,g=y.colorBy,b=y.showTreeToo,w=(0,i.d4)(function(e){return e.metadata}).originalVersion;return b?e="tanglegrams aren't supported":"v1"===w&&(e="v1 datasets aren't supported"),e?r.createElement(d,{key:o},r.createElement(p,null,o),r.createElement(f,null,"The current dataset isn't viewable in Taxonium as ".concat(e,"."))):r.createElement(d,{key:o},r.createElement(u,{href:(t={treeUrl:"".concat(m).concat(l),treeType:"nextstrain",ladderizeTree:"false",xType:"num_date"===v?"x_time":"x_dist"},n=function(){if((0,s.Sv)(g)){var e=['"genotype"'],t=(0,s.kh)(g);return!t||t.positions.length>1?null:(e.push('"pos":'.concat(t.positions[0])),t.aa&&e.push('"gene":"'.concat(t.gene,'"')),'{"field":'.concat(e.join(","),"}"))}return'{"field":"meta_'.concat(g,'"}')}(),n&&(t.color=n),"".concat("https://taxonium.org","?").concat(Object.entries(t).map(function(e){var t,n,r=(n=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(t,n)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(t,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.")}()),o=r[0],i=r[1];return"".concat(o,"=").concat(encodeURIComponent(i))}).join("&"))),target:"_blank",rel:"noreferrer noopener"},o),r.createElement(f,null,"Visualise this dataset in Taxonium (",r.createElement("a",{href:"https://docs.taxonium.org/en/latest/",target:"_blank",rel:"noreferrer noopener"},"learn more"),")."))}function y(){var e,t="microbetrace.cdc.gov",n=h(),o=n.pathname,a=n.origin,l=(0,i.d4)(function(e){return e.controls}).showTreeToo,s=(0,i.d4)(function(e){return e.metadata}).originalVersion;return l?e="tanglegrams aren't supported":"v1"===s&&(e="v1 datasets aren't supported"),e?r.createElement(d,{key:t},r.createElement(p,null,t),r.createElement(f,null,"The current dataset isn't viewable in MicrobeTrace as ".concat(e,"."))):r.createElement(d,{key:t},r.createElement(u,{href:"".concat("https://microbetrace.cdc.gov/MicrobeTrace","?url=").concat(encodeURIComponent("".concat(a).concat(o))),target:"_blank",rel:"noreferrer noopener"},t),r.createElement(f,null,"View this data in MicrobeTrace (",r.createElement("a",{href:"https://github.com/CDCgov/MicrobeTrace/wiki",target:"_blank",rel:"noreferrer noopener"},"learn more"),")."))}function v(){var e,t="nextclade",n=h(),o=n.pathname,a=n.origin,l=(0,i.d4)(function(e){return e.controls}).showTreeToo,s=(0,i.d4)(function(e){return e.metadata}),c=s.mainTreeNumTips,m=s.originalVersion,y=s.rootSequence,v=c>4e3;if(l?e="tanglegrams aren't supported":"v1"===m?e="v1 datasets aren't supported":y||(e="this dataset doesn't have a root-sequence (either within the main JSON or as a sidecar JSON)"),e)return r.createElement(d,{key:t},r.createElement(p,null,t),r.createElement(f,null,"The current tree isn't usable as a Nextclade dataset as ".concat(e,".")));var g="https://clades.nextstrain.org?dataset-json-url=".concat(encodeURIComponent("".concat(a).concat(o)));return r.createElement(d,{key:t},r.createElement(u,{href:g,target:"_blank",rel:"noreferrer noopener"},t),r.createElement(f,null,"Use this tree as a nextclade reference dataset which allows you to add new sequences (via drag-and-drop) and see them placed on the tree.\n Note that manually curated datasets may be better suited to your use case, see ",r.createElement("a",{href:"https://clades.nextstrain.org",target:"_blank",rel:"noreferrer noopener"},"clades.nextstrain.org")," for all reference datasets or read the ",r.createElement("a",{href:"https://docs.nextstrain.org/projects/nextclade/en/stable/user/nextclade-web/index.html",target:"_blank",rel:"noreferrer noopener"},"Nextclade Web documentation")," for more details.",v&&r.createElement("span",null," Note that large trees such as this may not work in Nextclade!")))}var g=function(){return r.createElement(r.Fragment,null,r.createElement("div",{style:a.vS.modalSubheading},"View this dataset on other platforms:"),r.createElement("div",{style:a.vS.break}),r.createElement("p",null,"Clicking on the following links will take you to an external site which will attempt to load the underlying data JSON which you are currently viewing. These sites are not part of Nextstrain and as such are not under our control, but we highly encourage interoperability across platforms like these."),r.createElement("div",{style:{paddingTop:"10px"}}),r.createElement(v,null),r.createElement(m,null),r.createElement(y,null))},b=function(){return!(!(0,l.Q)("linkOutModal")||!(0,l.u)("linkOutModal")||("localhost"===window.location.hostname&&console.warn("Link-out modal requested but you are running on localhost so the links will not work"),0))}},2122(e,t,n){"use strict";n.d(t,{A:()=>y});var r=n(78281),o=n(77313),i=n(40952),a=n(28355);const l=function(e){var t=e.navHeight,n=e.navWidth,o=e.display,i=e.onClick,l={position:"fixed",left:n?n-12:-12,visibility:o?"visible":"hidden",width:o?12:0,top:t/2-8,backgroundColor:"inherit",boxShadow:"none",cursor:"pointer",borderRadius:"0px",fontSize:12,color:"#444",textAlign:"center",verticalAlign:"middle"};return r.createElement("div",{style:l,onClick:i},r.createElement(a._Jj,null))};var s=n(68299),c=o.Ay.div.withConfig({displayName:"content__AuspiceNavBarContainer",componentId:"sc-jg0fvy-0"})(["display:flex;flex-direction:row;align-items:center;justify-content:center;height:100%;"]),u=o.Ay.a.withConfig({displayName:"content__Title",componentId:"sc-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=o.Ay.a.withConfig({displayName:"content__LogoLink",componentId:"sc-jg0fvy-2"})(["padding:5px 5px;width:50px;cursor:pointer;"]),f=o.Ay.div.withConfig({displayName:"content__NarrativeTitle",componentId:"sc-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}),d=n(41930),h=o.Ay.div.withConfig({displayName:"navBar__NavBarContainer",componentId:"sc-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?i.iY:i.NL}),m=(0,d.Q)("navbarComponent")?(0,d.u)("navbarComponent"):function(e){var t=e.narrativeTitle,n=e.sidebar,o=e.width;return n?r.createElement(c,null,r.createElement("div",{style:{flex:1}}),r.createElement(p,{href:"/"},r.createElement("img",{alt:"splashPage",width:"40px",src:s})),r.createElement("div",{style:{flex:1}}),function(e,t){return e?r.createElement(f,{width:t,href:"/"},e):r.createElement(u,{href:"/"},"auspice")}(t,o),r.createElement("div",{style:{flex:1}})):null};const y=function(e){var t=e.sidebar,n=e.toggleHandler,o=e.narrativeTitle,a=e.width,s=t&&!o;return r.createElement(h,null,r.createElement(m,{narrativeTitle:o,sidebar:t,width:a}),r.createElement(l,{navHeight:i.NL,navWidth:a,display:s,onClick:n}))}},20088(e,t,n){"use strict";n.d(t,{W:()=>v,q:()=>A});var r=n(78281),o=n(49633),i=n(77313),a=n(28355),l=n(85053),s=n(21143),c=n(40952),u=n(48617),p=n(68087),f=n(87473),d=n(22137);function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var m=i.Ay.button.withConfig({displayName:"MutationTable__Button",componentId:"sc-1qenp7x-0"})(["border:0px;background-color:inherit;cursor:pointer;outline:0;text-decoration:underline;font-size:16px;padding:0px 0px;"]),y=function(e,t){var n=[parseInt(e.slice(1,-1),10),parseInt(t.slice(1,-1),10)];return n[0]<n[1]?-1:1},v=function(e){var t=[];return e.sort(y).forEach(function(e,n){var r=parseInt(e.slice(1,-1),10);0===n||r!==t[t.length-1].end+1?t.push({start:r,end:r,count:1,char:e.slice(-1)}):(t[t.length-1].end=r,t[t.length-1].count+=1)}),t},g=i.Ay.p.withConfig({displayName:"MutationTable__Heading",componentId:"sc-1qenp7x-1"})(["margin-top:12px;margin-bottom:4px;"]),b=i.Ay.span.withConfig({displayName:"MutationTable__SubHeading",componentId:"sc-1qenp7x-2"})(["padding-right:8px;"]),w=i.Ay.span.withConfig({displayName:"MutationTable__MutationList",componentId:"sc-1qenp7x-3"})([""]),S=i.Ay.p.withConfig({displayName:"MutationTable__MutationLine",componentId:"sc-1qenp7x-4"})(["margin:0px 0px 4px 0px;font-weight:300;font-size:16px;"]),x=i.Ay.td.withConfig({displayName:"MutationTable__TableFirstColumn",componentId:"sc-1qenp7x-5"})(["font-weight:500;white-space:nowrap;vertical-align:baseline;"]),E=(0,o.Ng)(function(e){return{genomeMap:e.entropy.genomeMap,currentColorBy:e.controls.colorBy,gtFilters:e.controls.filters[c.IW]||[]}})(function(e){var t=e.gene,n=e.mutation,o=e.currentColorBy,i=e.gtFilters,a=e.genomeMap,l=e.dispatch;return r.createElement(m,{onClick:function(e){var r=(0,u.dz)(n),d=r.pos,h=r.to;if(e.metaKey){var m="".concat(t," ").concat(d).concat(h);if(e.shiftKey){var y=new Set(i.filter(function(e){return e.active}).map(function(e){return e.value})).has(m);l((0,f.$h)(y?"inactivate":"add",c.IW,[m]))}else l((0,f.$h)("focus",c.IW,[m]))}else if(e.shiftKey){var v=(0,s.dN)({gene:t,position:d,currentColorBy:o,genomeMap:a});l((0,p.p)(v))}else{var g=(0,s.KC)({gene:t,positions:[d]});l((0,p.p)(g))}}},n)}),O=function(e){var t,n=e.gene,o=e.name,i=e.muts,a=e.displayAsIntervals,l=e.isNuc,s=[];if(a){var c=v(i);t="".concat(o," (").concat(c.length," regions, ").concat(i.length).concat(l?"bp":" codons","):"),s=c.map(function(e){return 1===e.count?"".concat(e.start):"".concat(e.start,"..").concat(e.end," (").concat(e.count," ").concat(l?"bp":"codons",")")})}else t="".concat(o," (").concat(i.length,"):"),s=i.sort(y).map(function(e){return r.createElement(E,{key:e,gene:n,mutation:e})});return r.createElement(S,null,r.createElement(b,{key:o},t),r.createElement(w,null,s.reduce(function(e,t,n){return e.push(t),n<s.length-1&&e.push(", "),e},[])))},C={unique:"Unique",changes:"Changes",homoplasies:"Homoplasies",reversionsToRoot:"Reversions to root",undeletions:"Undeletions",gaps:"Gaps",ns:"Ns "},T=i.Ay.span.withConfig({displayName:"MutationTable__InfoContainer",componentId:"sc-1qenp7x-6"})(["padding-left:10px;cursor:help;color:#888;"]),_=i.Ay.span.withConfig({displayName:"MutationTable__Bold",componentId:"sc-1qenp7x-7"})(["font-weight:900;"]);function k(){return r.createElement(r.Fragment,null,r.createElement(_,null,"Click")," on the mutation to change the color-by to that position."," ",r.createElement(_,null,"Shift+click")," to add/remove mutations from the existing color-by selection, where possible."," ",r.createElement(_,null,"Command+click / Windows+click")," to filter to nodes with that mutated state (holding shift will amend the existing filters).")}var j=r.createElement("div",null,"A summary of mutations inferred to have occurred on this branch."," ",r.createElement(k,null),r.createElement("p",null),"Mutations are grouped into one of the following (mutually exclusive) categories, with the first matching category used:",r.createElement("ol",null,r.createElement("li",null,"Undeletions: a change from a '-' character to a base; beware that these are often bioinformatics artifacts"),r.createElement("li",null,"Gaps: A change to a '-' character, indicating a missing base; these can indicate deletions but sometimes areas of no coverage are filled with gaps"),r.createElement("li",null,"Ns: Typically due to lack of sequence coverage or ambiguity at this position (Nucleotides only)"),r.createElement("li",null,"Homoplasies: a mutation that has also been observed elsewhere on the tree"),r.createElement("li",null,"Unique: Mutations which are only observed on this branch")),"Reversions to Root is an additional category which highlights those mutations which return the state to that of the root. Mutations in this category will also appear one of the five categories listed above.",r.createElement("p",null),"Gaps and Ns are grouped into intervals, as they frequently occur in succession. Click below to copy all changes to clipboard to see the full list."),P=r.createElement("div",null,"A summary of sequence changes between the root and the selected tip."," ",r.createElement(k,null),r.createElement("p",null),"Changes are grouped into one of the following (mutually exclusive) categories, with the first matching category used:",r.createElement("ol",null,r.createElement("li",null,"Gaps: A change to a '-' character, indicating a missing base; these can indicate deletions but sometimes areas of no coverage are filled with gaps"),r.createElement("li",null,"Ns: Typically due to lack of sequence coverage or ambiguity at this position (Nucleotides only)"),r.createElement("li",null,"Reversions to root: The tip state is the same as the root state, however this has changed and been reverted along the way"),r.createElement("li",null,"Changes: The tip state differs from the root state")),"Gaps and Ns are grouped into intervals, as they frequently occur in succession. Click below to copy all changes to clipboard to see the full list."),A=function(e){var t=e.node,n=e.geneSortFn,o=e.isTip,i=e.observedMutations,s=o?(0,l.hc)(t):(0,l.l_)(t,i);return 0===Object.keys(s).length?r.createElement(g,null,o?"No sequence changes observed":"No mutations observed on branch"):r.createElement(r.Fragment,null,r.createElement(g,null,o?"Sequence changes observed (from root)":"Mutations observed on branch",r.createElement(T,{"data-tip":!0,"data-for":"seqChangesInfo"},r.createElement(a.__w,null))),r.createElement(d.FS,{place:"bottom",type:"light",effect:"solid",id:"seqChangesInfo",maxWidth:"50vh"},o?P:j),r.createElement("table",null,r.createElement("tbody",null,Object.keys(s).sort(n).map(function(e){return function(e,t){return 0===Object.values(t).filter(function(e){return e.length}).length?null:r.createElement("tr",{key:e},r.createElement(x,null,"nuc"===e?"Nt":e),r.createElement("td",null,Object.entries(C).map(function(n){var o,i,a=(i=2,function(e){if(Array.isArray(e))return e}(o=n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(o,i)||function(e,t){if(e){if("string"==typeof e)return h(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}(o,i)||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.")}()),l=a[0],s=a[1];return l in t&&t[l].length?r.createElement(O,{gene:e,key:s,name:s,muts:t[l],displayAsIntervals:"gaps"===l||"ns"===l||"undeletions"===l,isNuc:"nuc"===e}):null})))}(e,s[e])}),r.createElement("tr",null,r.createElement("td",null),r.createElement("td",null,r.createElement(m,{onClick:function(){navigator.clipboard.writeText(function(e,t){return Object.keys(e).sort(t).map(function(t){return Object.keys(C).filter(function(n){return n in e[t]&&e[t][n].length}).map(function(n){return"".concat(t,"\t").concat(n,"\t").concat(e[t][n].sort(y).join(", "))})}).flat().join("\n")}(s,n))}},"Click to copy all ".concat(o?"changes":"mutations"," to clipboard as TSV")))))))}},97805(e,t,n){"use strict";n.d(t,{Ay:()=>E,C6:()=>h});var r=n(78281),o=n(40952),i=n(4124),a=n(61373),l=n(85053),s=n(20088),c=n(89270),u=n(38596);function p(e){return p="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},p(e)}function f(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 d(e,t,n){return(t=function(e){var t=function(e){if("object"!=p(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==p(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=function(e){e||(e=window.event),e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation()},m=function(e,t,n){return r.createElement("tr",{key:e},r.createElement("th",{style:i.vS.item},e),r.createElement("td",{style:i.vS.item},n?r.createElement("a",{href:n,target:"_blank",rel:"noopener noreferrer"},t):t))},y=function(e){var t=e.url,n=e.title,o=e.value;return r.createElement("tr",null,r.createElement("th",{style:i.vS.item},n),r.createElement("td",{style:i.vS.item},r.createElement("a",{href:t,target:"_blank",rel:"noopener noreferrer"},o)))},v=function(e){var t=e.node,n=(0,l.hu)(t,"gisaid_epi_isl"),i=(0,l.hu)(t,"genbank_accession"),a=null,s=null;if((0,o.QF)(n))if(new RegExp("EPI_ISL_[0-9]{5,}").test(n)){var c=n.split("_")[2];a="https://www.epicov.org/acknowledgement/"+c.slice(-4,-2)+"/"+c.slice(-2)+"/"+n+".json"}else a="https://gisaid.org";if((0,o.QF)(i)&&(s="https://www.ncbi.nlm.nih.gov/nuccore/"+i),(0,o.QF)(n)&&(0,o.QF)(i))return r.createElement(r.Fragment,null,r.createElement(y,{title:"GISAID EPI ISL",value:n,url:a}),r.createElement(y,{title:"Genbank accession",value:i,url:s}));if((0,o.QF)(n))return r.createElement(y,{title:"GISAID EPI ISL",value:n,url:a});if((0,o.QF)(i))return r.createElement(y,{title:"Genbank accession",value:i,url:s});var u=(0,l.L$)(t),p=u.accession,f=u.url;return p&&f?r.createElement(y,{url:f,value:p,title:"Accession"}):p?m("Accession",p):f?r.createElement(y,{title:"Strain URL",url:f,value:"click here"}):null},g=function(e){var t=e.node,n=e.t,o=(0,l.Qw)(t);if(!o)return null;var i=[];return o.selection_date&&i.push(r.createElement("tr",{key:"seldate"},r.createElement("th",null,n("Vaccine selected")),r.createElement("td",null,o.selection_date))),o.start_date&&i.push(r.createElement("tr",{key:"startdate"},r.createElement("th",null,n("Vaccine start date")),r.createElement("td",null,o.start_date))),o.end_date&&i.push(r.createElement("tr",{key:"enddate"},r.createElement("th",null,n("Vaccine end date")),r.createElement("td",null,o.end_date))),o.serum&&i.push(r.createElement("tr",{key:"serum"},r.createElement("th",null,n("Serum strain")),r.createElement("td",null))),i},b=function(e){var t=e.node,n=e.t,r=(0,l.tg)(t);if(!r)return null;var o=[];return o.push(m(n("Authors"),r.value)),r.title&&"?"!==r.title&&(r.paper_url&&"?"!==r.paper_url?o.push(m(n("Title"),r.title,r.paper_url)):o.push(m(n("Title"),r.title))),r.journal&&"?"!==r.journal&&o.push(m(n("Journal"),r.journal)),1===o.length?o[0]:o},w=function(e){var t=e.children;return r.createElement("p",{style:i.vS.modalHeading},t)},S=function(e){var t=e.isTerminal,n=e.node,o=e.t,i=(0,u.h)(n,t),a=i.date,l=i.dateRange,s=i.inferred,c=i.ambiguousDate;if(!a)return null;var p=t?s?"Inferred collection date":"Collection date":"Inferred date";return r.createElement(r.Fragment,null,m(o(p),a),s&&l&&m(o("Date Confidence Interval"),"(".concat(l.join(", "),")")),c&&m(o("Provided date"),c))},x=function(e){var t,n=e.node,i=e.trait,s=e.colorings,c=e.isTerminal,u=(0,l.hu)(n,i),p=(0,l.hu)(n,i,{confidence:!0}),f="temporal"===(null===(t=s[i])||void 0===t?void 0:t.type);if("number"!=typeof u||f||Number.isInteger(u)||(u=Number.parseFloat(u).toPrecision(3)),!(0,o.QF)(u))return null;p&&u in p&&(!c||p[u]<.99)&&(u="".concat(u," (").concat((100*p[u]).toFixed(0),"%)"));var d=s&&s[i]&&s[i].title?s[i].title:i;f&&"number"==typeof u&&(u=(0,a.bq)(u));var h=(0,l.cl)(n,i);return h?r.createElement(y,{title:d,url:h,value:u}):m(d,u)};const E=function(e){var t,n=e.selectedNode,a=e.nodesLhsTree,l=e.nodesRhsTree,p=e.clearSelectedNode,y=e.colorings,E=e.observedMutations,O=e.geneSortFn,C=e.tipLabelKey,T=e.t;if((0,r.useEffect)(function(){if(n)return document.addEventListener("keyup",e),function(){document.removeEventListener("keyup",e)};function e(e){"Escape"===e.key&&p(n)}},[n,p]),!n)return null;var _=null===(t=n.treeId===c.V9?a:l)||void 0===t?void 0:t[n.idx];if(!_)return console.error("Internal error retrieving selected node"),null;var k=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},i.vS.panel);k.maxHeight="70%";var j=!_.hasChildren,P=!n.isBranch,A=C!==o.Uf||!j;return r.createElement("div",{style:i.vS.modalContainer,onClick:function(){return p(n)}},r.createElement("div",{className:"panel",style:k,onClick:function(e){return h(e)}},r.createElement(w,null,(0,u.E)(T,_,C,!P)),r.createElement("table",null,r.createElement("tbody",null,!j&&m(T("Number of terminal tips"),_.fullTipCount),A&&m(T("Node name"),_.name),P&&r.createElement(g,{node:_,t:T}),r.createElement(S,{isTerminal:j,node:_,t:T}),P&&r.createElement(b,{node:_,t:T}),function(e){if(!e.node_attrs)return[];var t=["author","div","num_date","gisaid_epi_isl","genbank_accession","accession","url"];return Object.keys(e.node_attrs).filter(function(e){return!t.includes(e)})}(_).map(function(e){return r.createElement(x,{node:_,trait:e,colorings:y,key:e,isTerminal:j})}),P&&r.createElement(v,{node:_}),m("",""))),r.createElement(s.q,{node:_,geneSortFn:O,isTip:P,observedMutations:E}),r.createElement("p",{style:i.vS.comment},T("Click outside this box to go back to the tree"))))}},38596(e,t,n){"use strict";n.d(t,{E:()=>i,h:()=>a});var r=n(85053),o=n(61373);function i(e,t,n,i){var a=(0,r.hu)(t,n);"num_date"===n&&a&&(a=(0,o.bq)(a));var l=!t.hasChildren;return i?l?a?e("Branch leading to {{tipLabel}}",{tipLabel:a}):e("Terminal branch"):e("Internal branch"):a}function a(e,t){var n,i,a=(0,r.hu)(e,"num_date");if(!a)return{};var l=(0,r.hu)(e,"num_date",{confidence:!0});t?Object.hasOwn(e.node_attrs.num_date,"inferred")?(n=e.node_attrs.num_date.inferred,i=(0,r.hu)(e,"num_date",{raw:!0})):n=l&&l[0]!==l[1]:n=!0;var s=l?[(0,o.bq)(l[0]),(0,o.bq)(l[1])]:void 0;return{date:(0,o.bq)(a),dateRange:s,inferred:n,ambiguousDate:i}}},5699(e,t,n){"use strict";n.d(t,{A:()=>P,d:()=>g});var r=n(78281),o=n(4124),i=n(61373),a=n(57758),l=n(21143),s=n(85053),c=n(40952),u=n(77887),p=n(20088),f=n(38596),d=n(82833);function h(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=y(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},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 i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||y(e,t)||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 y(e,t){if(e){if("string"==typeof e)return v(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var g=function(e){var t=e.name,n=e.value,o=e.padBelow,i=void 0!==o&&o;return r.createElement("div",{style:{paddingBottom:i?"15px":"10px"},key:t},r.createElement("span",{style:{fontWeight:"500"}},t+" "),n||0===n?Array.isArray(n)?n.map(function(e){return r.createElement("div",{key:e,style:{fontWeight:"300",marginLeft:"0em"}},e)}):r.createElement("span",{style:{fontWeight:"300"}},n):null)},b=function(e){var t=e.node,n=e.t,o=e.isTerminal,i=[],a=(0,s.Ue)(t);a&&i.push(r.createElement(g,{name:n("Divergence")+":",value:(0,u.C2)(a),key:"div"}));var l=(0,f.h)(t,o),c=l.date,p=l.dateRange,d=l.inferred,h=l.ambiguousDate;if(c){var m=d?"Inferred Date":"Date";i.push(r.createElement(g,{name:n(m)+":",value:c,key:"date"})),d&&p&&i.push(r.createElement(g,{name:n("Date Confidence Interval")+":",value:"(".concat(p.join(", "),")"),key:"dateConf"})),h&&i.push(r.createElement(g,{name:n("Provided Date")+":",value:h,key:"date"}))}return i},w=function(e){var t=e.node,n=e.colorBy,o=e.colorByConfidence,u=e.colorScale,p=e.colorings;if("num_date"===n)return null;if((0,l.Sv)(n)){var f=(0,l.kh)(n),d=f.aa?"Amino Acid at ".concat(f.gene," site ").concat(f.positions.join(", "),":"):"Nucleotide at pos ".concat(f.positions.join(", "),":");return r.createElement(g,{name:d,value:(0,a.RQ)(t,u)})}if("author"===n){var h=(0,s.tg)(t);return h?r.createElement(r.Fragment,null,h.title?r.createElement(g,{name:"Title:",value:h.title}):null,h.journal?r.createElement(g,{name:"Journal:",value:h.journal}):null):null}var m=p&&p[n]&&p[n].title?p[n].title:n,y=(0,s.hu)(t,n);if("temporal"===u.scaleType&&"number"==typeof y)return r.createElement(g,{name:"".concat(m,":"),value:(0,i.bq)(y)});var v=function(){return(0,c.QF)(y)?r.createElement(g,{name:"".concat(m,":"),value:y}):null};if(!0===o){var b=(0,s.hu)(t,n,{confidence:!0});if(!b)return console.error("couldn't find confidence vals for ",n),null;if(!t.hasChildren&&1===Object.keys(b).length&&Object.values(b)[0]>.99)return v();var w=Object.keys(b).filter(function(e){return(0,c.QF)(e)}).sort(function(e,t){return b[e]>b[t]?-1:1}).slice(0,4).map(function(e){return"".concat(e," (").concat((100*b[e]).toFixed(0),"%)")});return w.length?r.createElement(g,{name:"".concat(m," (confidence):"),value:w}):null}return v()},S=function(e){var t=e.node,n=e.t,o=(0,s.hc)(t);if(!o.nuc)return null;var i={changes:0,gaps:0,reversionsToRoot:0,ns:0},a={changes:0,gaps:0,reversionsToRoot:0};Object.keys(o).forEach(function(e){Object.entries(o[e]).forEach(function(t){var n=m(t,2),r=n[0],o=n[1];"nuc"===e?i[r]+=o.length:a[r]+=o.length})});var l="".concat(i.changes).concat(i.reversionsToRoot?" + ".concat(i.reversionsToRoot," reversions to root"):"");l+="".concat(i.gaps?" + ".concat(i.gaps," gaps"):"").concat(i.nt?" + ".concat(i.nt," Ns"):"");var c="".concat(a.changes).concat(a.reversionsToRoot?" + ".concat(a.reversionsToRoot," reversions to root"):"");return c+="".concat(a.gaps?" + ".concat(a.gaps," gaps"):""),[r.createElement(g,{name:n("Nucleotide changes")+":",value:l,key:"nuc"}),r.createElement(g,{name:n("Amino Acid changes")+":",value:c,key:"aa"})]},x=function(e){var t=e.node,n=e.geneSortFn,o=e.observedMutations,i=e.proteinOnly,a=e.t;if(!t.branch_attrs||!t.branch_attrs.mutations)return null;var l=[],c=t.branch_attrs.mutations,u=(0,s.l_)(t,o),f=function(e,t){return e.slice(0,Math.min(t,e.length)).join(", ")+(e.length>t?" + ".concat(e.length-t," more"):"")};if(i);else if(u.nuc){if(u.nuc.unique.length&&l.push(r.createElement(g,{name:"Unique Nucleotide mutations:",value:f(u.nuc.unique,5),key:"nuc_unique"})),u.nuc.homoplasies.length&&l.push(r.createElement(g,{name:"Homoplasic mutations:",value:f(u.nuc.homoplasies,5),key:"nuc_homoplasies"})),u.nuc.reversionsToRoot.length&&l.push(r.createElement(g,{name:"Reversions to Root:",value:u.nuc.reversionsToRoot.length,key:"nuc_rtr"})),u.nuc.gaps.length){var d="".concat((0,p.W)(u.nuc.gaps).length," regions, ").concat(u.nuc.gaps.length,"bp.");l.push(r.createElement(g,{name:"Gaps:",value:d,key:"nuc_gaps"}))}if(u.nuc.undeletions.length){var m="".concat((0,p.W)(u.nuc.undeletions).length," regions, ").concat(u.nuc.undeletions.length,"bp.");l.push(r.createElement(g,{name:"Undeletions:",value:m,key:"nuc_undeletions"}))}if(u.nuc.ns.length){var y="".concat((0,p.W)(u.nuc.ns).length," regions, ").concat(u.nuc.ns.length,"bp.");l.push(r.createElement(g,{name:"Ns:",value:y,key:"nuc_ns"}))}}else l.push(r.createElement(g,{name:a("No nucleotide mutations"),value:"",key:"nuc"}));var v,b=Object.keys(c).sort(n).filter(function(e){return"nuc"!==e}),w={},S=!1,x=h(b);try{for(x.s();!(v=x.n()).done;){var E=v.value,O=c[E].filter(function(e){return!e.endsWith("X")});O.length&&(w[E]=O,S=!0)}}catch(e){x.e(e)}finally{x.f()}if(S){var C=[];Object.keys(w).forEach(function(e,t){if(t<7){var n=e+": "+w[e].slice(0,Math.min(3,w[e].length)).join(", ");w[e].length>3&&(n+=" + "+a("{{x}} more",{x:w[e].length-3})),C.push(n)}else 7===t&&C.push("(".concat(a("protein mutations truncated"),")"))}),l.push(r.createElement(g,{name:a("AA mutations")+":",value:C,key:"aa"}))}else c.nuc&&c.nuc.length&&l.push(r.createElement(g,{name:a("No amino acid mutations"),key:"aa"}));return l},E=function(e){var t=e.node,n=e.t,o=e.tipLabelKey,i=m(1===t.fullTipCount?[(0,f.E)(n,t,o,!0),""]:[n("Number of descendants")+":",t.fullTipCount],2),a=i[0],l=i[1];return r.createElement(g,{name:a,value:l,padBelow:!0})},O=function(e){var t=e.node,n=e.t,o=(0,s.Qw)(t);if(!o)return null;var i=[];return o.selection_date&&i.push(r.createElement(g,{name:n("Vaccine selected")+":",value:o.selection_date,key:"seldate"})),o.start_date&&i.push(r.createElement(g,{name:n("Vaccine start date")+":",value:o.start_date,key:"startdate"})),o.end_date&&i.push(r.createElement(g,{name:n("Vaccine end date")+":",value:o.end_date,key:"enddate"})),o.serum&&i.push(r.createElement(g,{name:n("Serum strain"),key:"serum"})),i},C=function(e){var t=e.node,n=[],o=(0,s.tg)(t);o&&n.push(r.createElement(g,{name:"Author:",value:o.value,key:"author"}));var i=(0,s.hu)(t,"gisaid_epi_isl");if((0,c.QF)(i)){var a=i.split("_")[2];n.push(r.createElement(g,{name:"GISAID EPI ISL:",value:a,key:"gisaid_epi_isl"}))}return n},T=function(e){var t,n,i,a=e.node,l=e.panelDims,s=e.children,c=e.xy,u=void 0===c?void 0:c;if(i=l.width<420?200:l.width<460?220:l.width<500?240:l.width<540?260:280,u){var p=m(u,2);t=p[0],n=p[1]}else t=-1===a.shell.that.params.orientation[0]?l.width/2+l.spaceBetweenTrees+a.shell.xTip:a.shell.xTip,n=a.shell.yTip;var f={container:{position:"absolute",width:i,padding:"10px",borderRadius:10,zIndex:1e3,pointerEvents:"none",fontFamily:o.vS.panel.fontFamily,fontSize:14,lineHeight:1,fontWeight:o.vS.panel.fontWeight,color:o.vS.panel.color,backgroundColor:o.vS.panel.backgroundColor,wordWrap:"break-word",wordBreak:"break-word"}};return t<.5*l.width?f.container.left=t+10:f.container.right=l.width-t+10,n<.55*l.height?f.container.top=n+40:f.container.bottom=l.height-n+10,r.createElement("div",{style:f.container},r.createElement("div",{className:"tooltip",style:o.vS.tooltip},s))},_=function(e){var t=e.children;return r.createElement("div",{style:o.vS.comment},t)};function k(e){var t=e.node,n=e.streamDetails,i=e.colorBy,a=(0,u.bP)(t),l=t.shell.that.streams[d.d0],s=t.streamNodeCounts,p=s.total===s.visible?"".concat(s.total," (all visible)"):"".concat(s.visible,"/").concat(s.total),f=t.streamCategories[n.categoryIndex].name,h=t.streamCategories.filter(function(e){return e.name===f}).at(0).nodes,m=h.filter(function(e){return t.shell.that.nodes[e].visibility===c.uU}).length,y=m===h.length?"".concat(m," (all visible)"):"".concat(m,"/").concat(h.length);return r.createElement(r.Fragment,null,r.createElement("div",{style:o.vS.tooltipHeading},"Streamtree for ".concat(l," ").concat(t.streamName)),r.createElement(g,{name:"Visible tips (entire streamtree):",value:p}),r.createElement("div",{style:o.vS.tooltipHeading},"Ripple (".concat(i,"): ").concat(null!=f?f:"(missing data)")),r.createElement(g,{name:"Visible tips (this category):",value:y}),r.createElement("div",{style:{paddingTop:"5px"}},a===t.arrayIdx?"Click to zoom out":"Click to zoom into stream"))}function j(e){for(var t=e.node,n=e.lineType,i=t.shell.that.streams,a=0,l=function(e){if(Array.isArray(e))return v(e)}(p=i[t.streamName].streamChildren)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(p)||y(p)||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.")}();l.length;){a++;var s,c=h(i[l.pop()].streamChildren);try{for(c.s();!(s=c.n()).done;){var u=s.value;l.push(u)}}catch(e){c.e(e)}finally{c.f()}}var p,f=t.fullTipCount===t.tipCount?"".concat(t.tipCount," tips (all visible)"):"".concat(t.tipCount," visible tips (out of ").concat(t.fullTipCount,")"),d=t.streamNodeCounts,m=d.total===d.visible?"".concat(d.total," tips (all visible)"):"".concat(d.visible," visible tips (out of ").concat(d.total,")"),b="joiner"===n?"Connection to stream: ".concat(t.streamName):"Stream: ".concat(t.streamName);return r.createElement(r.Fragment,null,r.createElement("div",{style:o.vS.tooltipHeading},b),r.createElement(g,{name:"Stream ".concat(t.streamName," comprises"),value:m}),a>0?r.createElement(r.Fragment,null,r.createElement(g,{name:"Further streams originate from this one",value:"(n=".concat(a,")")}),r.createElement(g,{name:"All streams (together) summarise",value:f})):r.createElement(g,{name:"No further streams originate from this one",value:""}))}const P=function(e){var t=e.selectedNode,n=e.colorBy,i=e.colorByConfidence,a=e.colorScale,l=e.panelDims,s=e.colorings,p=e.geneSortFn,d=e.observedMutations,h=e.tipLabelKey,m=e.proteinOnly,y=e.t;if(!t)return null;var v=t.node.n,P=(0,u.bP)(v);return t.streamDetails?r.createElement(T,{node:v,panelDims:l,xy:[t.streamDetails.x,t.streamDetails.y]},t.isBranch?r.createElement(j,{node:v,lineType:["joiner","backbone"][t.streamDetails.categoryIndex]}):r.createElement(k,{node:v,streamDetails:t.streamDetails,colorBy:n})):r.createElement(T,{node:v,panelDims:l},!1===t.isBranch?r.createElement(r.Fragment,null,r.createElement("div",{style:o.vS.tooltipHeading},(0,f.E)(y,v,h,!1)),h!==c.Uf&&r.createElement(g,{name:"Node name:",value:v.name}),r.createElement(O,{node:v,t:y}),r.createElement(S,{node:v,t:y}),r.createElement(b,{node:v,t:y,isTerminal:!0}),r.createElement(w,{node:v,colorBy:n,colorByConfidence:i,colorScale:a,colorings:s}),r.createElement(C,{node:v}),r.createElement(_,null,y("Click on tip to display more info"))):r.createElement(r.Fragment,null,r.createElement(E,{node:v,t:y,tipLabelKey:h}),r.createElement(x,{node:v,geneSortFn:p,observedMutations:d,proteinOnly:m,t:y}),r.createElement(b,{node:v,t:y,isTerminal:!1}),r.createElement(w,{node:v,colorBy:n,colorByConfidence:i,colorScale:a,colorings:s}),r.createElement(_,null,P===v.arrayIdx?y("Click to zoom out to parent clade"):y("Click to zoom into clade")),r.createElement(_,null,y("Shift + Click to display more info"))))}},80755(e,t,n){"use strict";n.d(t,{A:()=>k});var r=n(78281),o=n(49633),i=n(58143),a=n(87473),l=n(4124);const s=function(e){var t=e.dispatch,n=e.transform,o=e.clipId,i=e.legendRectSize,s=e.legendSpacing,c=e.rectStroke,u=e.rectFill,p=e.label,f=e.tooltip,d=e.value,h=e.handleOnClick;return r.createElement("g",{transform:n,onMouseEnter:function(){t((0,a.UW)({selectedLegendItem:d}))},onMouseLeave:function(){t((0,a.UW)())},onClick:function(e){return h(e)}},r.createElement("rect",{style:{strokeWidth:2},width:i,height:i,fill:u,stroke:c},r.createElement("title",null,f)),r.createElement("text",{x:i+s+5,y:i-s,style:{fontSize:12,fill:l.KD,fontFamily:l.sf},clipPath:o?"url(#".concat(o,")"):void 0},r.createElement("title",null,f),p))};var c,u=n(40952),p=n(57758),f=n(92827),d=n(61373),h=n(99438),m=n(479),y=n(21143),v=n(8791);function g(e){return g="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},g(e)}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function w(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,S(r.key),r)}}function S(e){var t=function(e){if("object"!=g(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=g(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==g(t)?t:t+""}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function E(e){var t=C();return function(){var n,r=T(e);if(t){var o=T(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==g(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return O(e)}(this,n)}}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(C=function(){return!!e})()}function T(e){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},T(e)}function _(e,t){if(!e.continuous)return t;var n=e.legendBounds[t],r="num_date"===e.colorBy;return"Bounds: ".concat((0,f.n6)(n,r))}const k=(0,o.Ng)(function(e){return{colorBy:e.controls.colorBy,colorings:e.metadata.colorings,colorScale:e.controls.colorScale,legendOpen:e.controls.legendOpen}})(c=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}(a,e);var t,n,o=E(a);function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=o.call(this,e)).handleLegendItemOnClick=t.handleLegendItemOnClick.bind(O(t)),t}return t=a,n=[{key:"showLegend",value:function(){return void 0!==this.props.legendOpen?this.props.legendOpen:!(this.props.width<600||this.props.colorScale.visibleLegendValues.length>32)}},{key:"getSVGHeight",value:function(){if(!this.showLegend())return 18;var e=this.props.colorScale.visibleLegendValues.length;return 19*Math.ceil(e/2)+4+20||100}},{key:"getSVGWidth",value:function(){return this.showLegend()?290:this.getTitleWidth()+20}},{key:"getTransformationForLegendItem",value:function(e,t){var n=Math.floor(t/e),r=t%e*19;return"translate(".concat(145*n+10,",").concat(r,")")}},{key:"getTitleWidth",value:function(){return 15+5.3*(0,p.De)(this.props.colorings,this.props.colorBy).length}},{key:"toggleLegend",value:function(){this.props.dispatch({type:h.v,value:!this.props.legendOpen})}},{key:"legendTitle",value:function(){return r.createElement("g",{id:"Title"},r.createElement("rect",{width:this.getTitleWidth(),height:"12",fill:"rgba(255,255,255,.85)"}),r.createElement("text",{x:this.getTitleOffset(),y:10,style:{fontSize:12,fill:l.KD,fontFamily:l.PT,backgroundColor:"#fff"}},(0,p.De)(this.props.colorings,this.props.colorBy)))}},{key:"legendChevron",value:function(){var e=this.showLegend()?-180:0,t=this.getArrowOffset();return r.createElement("g",{id:"Chevron",transform:"translate(".concat(t,",0)")},r.createElement("svg",{width:"12",height:"12",viewBox:"0 0 1792 1792"},r.createElement("rect",{width:"1792",height:"1792",fill:"rgba(255,255,255,.85)"}),r.createElement("path",{fill:l.KD,style:{transform:"rotate(".concat(e,"deg)"),transformOrigin:"50% 50%",transition:"".concat(u.WW,"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(this.props.colorScale.legendLabels&&this.props.colorScale.legendLabels.has(e))return this.props.colorScale.legendLabels.get(e);if("num_date"===this.props.colorBy||"temporal"===this.props.colorScale.scaleType){var t=this.props.colorScale.visibleLegendValues;if(t[t.length-1]-t[0]>10&&t[t.length-1]-parseInt(e,10)>=10)return parseInt(e,10);var n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e,t)||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.")}()}((0,d.bq)(e).split("-"),3),r=n[0],o=n[1];return n[2],"".concat(u.US[o]," ").concat(r)}return e}},{key:"handleLegendItemOnClick",value:function(e){(0,v.DC)()&&e.shiftKey&&((0,y.Sv)(this.props.colorBy)?this.props.dispatch((0,m.Ul)({message:"Genotype color editing is not currently supported",autoClose:!0})):this.props.dispatch({type:h.vN,modal:"colorByEditor"}))}},{key:"legendItems",value:function(){var e=this,t=this.props.colorScale.visibleLegendValues,n=Math.ceil(t.length/2),o=t.filter(function(e){return void 0!==e}).map(function(t,o){return r.createElement(s,{dispatch:e.props.dispatch,legendRectSize:15,legendSpacing:4,rectFill:(0,p.rQ)(e.props.colorScale.scale(t)),rectStroke:(0,i.Qh)(e.props.colorScale.scale(t)).toString(),transform:e.getTransformationForLegendItem(n,o),key:e.props.colorScale.colorBy+t+o,value:t,label:e.styleLabelText(t),index:o,tooltip:_(e.props.colorScale,t),clipId:o<n?"legendFirstColumnClip":void 0,handleOnClick:e.handleLegendItemOnClick})});return r.createElement("g",{id:"ItemsContainer"},r.createElement("rect",{width:this.getSVGWidth(),height:this.getSVGHeight(),fill:"rgba(255,255,255,.85)"}),r.createElement("clipPath",{id:"legendFirstColumnClip"},r.createElement("rect",{x:"0",y:"0",width:140,height:this.getSVGHeight(),fill:"rgb(150, 154, 223)"})),r.createElement("g",{id:"Items",transform:"translate(0,20)"},o))}},{key:"getContainerStyles",value:function(){var e={position:"absolute",borderRadius:4,zIndex:1e3,userSelect:"none"},t=this.props.legendPlacement,n=t.vertical,r=t.horizontal;return e[n]=26,e[r]=5,e}},{key:"getArrowOffset",value:function(){return"right"===this.props.legendPlacement.horizontal?this.getSVGWidth()-20:this.getTitleWidth()}},{key:"getTitleOffset",value:function(){return"right"===this.props.legendPlacement.horizontal?this.getSVGWidth()-this.getTitleWidth()-15:5}},{key:"render",value:function(){var e=this;return this.props.colorScale?r.createElement("svg",{id:"TreeLegendContainer",width:this.getSVGWidth(),height:this.getSVGHeight(),style:this.getContainerStyles()},this.legendItems(),r.createElement("g",{id:"TitleAndChevron",onClick:function(){return e.toggleLegend()},style:{cursor:"pointer",textAlign:"right"}},this.legendTitle(),this.legendChevron())):null}}],n&&w(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),a}(r.Component))||c},58026(e,t,n){"use strict";n.d(t,{Hg:()=>h,Jz:()=>y,ho:()=>f,s1:()=>v,yU:()=>m});var r=n(48800),o=n(28158),i=n(71595),a=n(32172),l=(n(66565),n(40952)),s=n(77887),c=n(61373);function u(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}(e)||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.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var f=function(){"majorGrid"in this.groups&&this.groups.majorGrid.selectAll("*").style("visibility","hidden"),"minorGrid"in this.groups&&this.groups.minorGrid.selectAll("*").style("visibility","hidden"),"gridText"in this.groups&&this.groups.gridText.selectAll("*").style("visibility","hidden"),"axisText"in this.groups&&this.groups.axisText.selectAll("*").style("visibility","hidden")},d=function(e,t,n,r,o){for(var i=[],a=[],l=function(e,t){var n=Math.floor(Math.log10(e)),r=Math.pow(10,n);e/r<2?r/=5:e/r<5&&(r/=2);var o=t;return 5!==r&&10!==r||(o=5),{majorStep:r,minorStep:r/o}}(t-e,r),s=l.majorStep,c=l.minorStep,u=Math.floor(e/s)*s,p="radial"===n?e:u,f=t,d=0;d<=(t-u)/s+3;d++){var h=u+s*d;i.push({position:h,name:h.toFixed(Math.max(0,-Math.floor(Math.log10(s)))),visibility:h<p||h>f?"hidden":"visible",axis:o});for(var m=h+c;m<h+s&&m<t;m+=c)a.push({position:m,visibility:m<p||m>f+c?"hidden":"visible",axis:o})}return{majorGridPoints:i,minorGridPoints:a}},h=function(e,t,n,r){for(var o=[],i=[],a=function(e,t){var n={unit:"DAY",n:1},r={unit:"DAY",n:0},o=t<1e3?130:180,i=e/Math.floor(t/o),a={CENTURY:{t:100,max:void 0},DECADE:{t:10,max:5},FIVEYEAR:{t:5,max:1},YEAR:{t:1,max:3},MONTH:{t:1/12,max:6},WEEK:{t:1/52,max:1},DAY:{t:1/365,max:3}},l=Object.keys(a);n.unit="DAY";for(var s=0;s<l.length-1;s++)if(i>a[l[s]].t){n.unit=l[s];break}n.n=Math.floor(i/a[n.unit].t)||1,a[n.unit].max&&n.n>a[n.unit].max&&(n.unit=l[l.indexOf(n.unit)-1],n.n=Math.floor(i/a[n.unit].t)||1),n.n>1||"DAY"===n.unit?r.unit=n.unit:r.unit=l[l.indexOf(n.unit)+1];var c=n.n*a[n.unit].t;return r.n=Math.ceil(a[r.unit].t/c),{majorStep:n,minorStep:r}}(t-e,Math.abs(n)),l=a.majorStep,s=a.minorStep,u=(0,c.My)(l.unit,(0,c.As)(t)),p=(0,c.IS)(l.unit,(0,c.As)(e));p<u;){o.push({date:p,position:(0,c.rT)((0,c.$T)(p)),name:(0,c.CC)(l.unit,p),visibility:"visible",axis:r});for(var f=0;f<l.n;f++)p=(0,c.My)(l.unit,p)}return s.n&&o.forEach(function(e,t){p=(0,c.My)(s.unit,e.date);for(var n=0;n<s.n-1;n++)p=(0,c.My)(s.unit,p);for(var a=t===o.length-1?u:o[t+1].date;p<a;){i.push({position:(0,c.rT)((0,c.$T)(p)),visibility:"visible",axis:r});for(var l=0;l<s.n;l++)p=(0,c.My)(s.unit,p)}}),{majorGridPoints:o,minorGridPoints:i}},m=function(){var e,t,n=this.layout;if(e=this.groups,t=this.svg,"temporalWindow"in e||(e.temporalWindow=t.append("g").attr("id","temporalWindow"),e.temporalWindowStart=e.temporalWindow.append("rect").attr("class","temporalWindowStart"),e.temporalWindowEnd=e.temporalWindow.append("rect").attr("class","temporalWindowEnd")),"majorGrid"in e||(e.majorGrid=t.append("g").attr("id","majorGrid").attr("clip-path","url(#treeClip)")),"minorGrid"in e||(e.minorGrid=t.append("g").attr("id","minorGrid").attr("clip-path","url(#treeClip)")),"gridText"in e||(e.gridText=t.append("g").attr("id","gridText")),"axisText"in e||(e.axisText=t.append("g").attr("id","axisText")),"unrooted"!==n){var i,a,l,c=(0,o.A)(this.yScale.domain()),p=(0,r.A)(this.yScale.domain()),f="radial"===n?this.nodes[0].depth:this.xScale.domain()[0],m="radial"===n?f+(0,r.A)([this.xScale.domain()[1],this.yScale.domain()[1],-this.xScale.domain()[0],-this.yScale.domain()[0]]):this.xScale.domain()[1],y=this.xScale.range()[1]-this.xScale.range()[0],v="scatter"===this.layout&&"num_date"===this.scatterVariables.x||"clock"===this.layout||"scatter"!==this.layout&&"num_date"===this.distance?h(f,m,y,"x"):"scatter"!==this.layout||this.scatterVariables.xContinuous?d(f,m,n,this.params.minorTicks,"x"):{majorGridPoints:this.xScale.domain().map(function(e){return{name:e,visibility:"visible",axis:"x",position:e}}),minorGridPoints:[]},g=v.majorGridPoints,b=v.minorGridPoints,w=function(e,t,n){return function(r){var o="";if("x"===r.axis){if("rect"===n||"clock"===n||"scatter"===n){var i=e(r.position);o="M"+i.toString()+" "+t.range()[1].toString()+" L "+i.toString()+" "+t.range()[0].toString()}else if("radial"===n){var a=r.position-f,l=e(Math.max(a,0));o="M "+l.toString()+" "+t(0).toString()+" A "+(l-e(0)).toString()+" "+(t(r.position)-t(f)).toString()+" 0 1 0 "+l.toString()+" "+(t(0)+.001).toString()}}else if("y"===r.axis){var s=t(r.position);o="M".concat(e(f)+20," ").concat(s," L ").concat(e(m)," ").concat(s)}return o}};if("clock"===this.layout||"scatter"===this.layout)if("scatter"===this.layout&&"num_date"===this.scatterVariables.y){var S=this.yScale.range()[1]-this.yScale.range()[0],x=h(c,p,S,"y");g.push.apply(g,u(x.majorGridPoints))}else if("scatter"!==this.layout||this.scatterVariables.yContinuous){var E=d(c,p,n,1,"y");g.push.apply(g,u(E.majorGridPoints))}else g.push.apply(g,u(this.yScale.domain().map(function(e){return{name:e,visibility:"visible",axis:"y",position:e}})));this.groups.majorGrid.selectAll("*").remove(),this.groups.majorGrid.selectAll(".majorGrid").data(g).enter().append("path").attr("d",w(this.xScale,this.yScale,n)).attr("class","majorGrid").style("fill","none").style("visibility",function(e){return e.visibility}).style("stroke",this.params.majorGridStroke).style("stroke-width",this.params.majorGridWidth),this.groups.minorGrid.selectAll("*").remove(),this.svg.selectAll(".minorGrid").remove(),this.groups.minorGrid.selectAll(".minorGrid").data(b).enter().append("path").attr("d",w(this.xScale,this.yScale,n)).attr("class","minorGrid").style("fill","none").style("visibility",function(e){return e.visibility}).style("stroke",this.params.minorGridStroke).style("stroke-width",this.params.minorGridWidth),this.groups.gridText.selectAll("*").remove(),this.svg.selectAll(".gridText").remove(),this.groups.gridText.selectAll(".gridText").data(g).enter().append("text").text(function(e){return e.name}).attr("class","gridText").style("font-size",this.params.tickLabelSize).style("font-family",this.params.fontFamily).style("fill",this.params.tickLabelFill).style("text-anchor",(i=n,function(e){return"x"===e.axis?"radial"===i?"end":"middle":"start"})).style("visibility",function(e){return e.visibility}).attr("x",function(e,t){return function(n){return"x"===n.axis?e("radial"===t?0:n.position):e.range()[0]-15}}(this.xScale,n)).attr("y",function(e,t){return function(n){if("x"===n.axis){var r=n.position-f;return"radial"===t?e(Math.max(r,0))-5:e.range()[1]+18}return e(n.position)}}(this.yScale,n)),this.groups.axisText.selectAll("*").remove(),this.svg.selectAll(".axisText").remove(),"clock"===n?(l="Date",a=(0,s.Qh)(this.yScale)?"Divergence":"Mutations"):"scatter"===n?("div"===(l=this.scatterVariables.xLabel)&&(l=(0,s.Qh)(this.xScale)?"Divergence":"Mutations"),"div"===(a=this.scatterVariables.yLabel)&&(a=(0,s.Qh)(this.yScale)?"Divergence":"Mutations")):"rect"===n&&(l="num_date"===this.distance?"Date":(0,s.Qh)(this.xScale)?"Divergence":"Mutations"),l&&this.groups.axisText.append("text").text(l).attr("class","gridText").style("font-size",this.params.tickLabelSize).style("font-family",this.params.fontFamily).style("fill",this.params.tickLabelFill).style("text-anchor","middle").attr("x",Math.abs(this.xScale.range()[1]-this.xScale.range()[0])/2).attr("y",parseInt(this.svg.attr("height"),10)-1),a&&this.groups.axisText.append("text").text(a).attr("class","gridText").style("font-size",this.params.tickLabelSize).style("font-family",this.params.fontFamily).style("fill",this.params.tickLabelFill).style("text-anchor","middle").attr("transform","translate(10,"+this.yScale.range()[1]/2+") rotate(-90)"),this.grid=!0}},y=function(){this.groups.temporalWindowStart.attr("opacity",0),this.groups.temporalWindowEnd.attr("opacity",0)},v=((0,i.kY)("temporalWindowTransition").duration(l.$J).ease(a.s),function(){if("rect"!==this.layout||"num_date"!==this.distance||this.focus)this.hideTemporalSlice();else{var e=[this.xScale(this.dateRange[0]),this.xScale(this.dateRange[1])],t=this.yScale.range()[1],n="#EEE",r=-1===this.params.orientation[0],o=this.xScale(this.nodes[0].x),i=r?this.xScale.range()[0]:this.xScale.range()[1];if(i+=this.margins.left+this.margins.right,Math.abs(e[0]-o)>30){var a=e[0],l=0;r&&(a=i-e[0],l=e[0]);var s="1"===this.groups.temporalWindowStart.attr("opacity");this.groups.temporalWindowStart.attr("opacity",1).attr("height",t).attr("transform","translate(".concat(l,",0)")).attr("fill",n),s?this.groups.temporalWindowStart.transition("temporalWindowTransition").attr("width",a):this.groups.temporalWindowStart.attr("width",a)}else this.groups.temporalWindowStart.attr("opacity",0);var c=e[1],u=i-this.margins.right-e[1],p="translate(".concat(i-this.margins.right,",0) scale(-1,1)");if(r&&(c=this.margins.right,u=e[1]-this.margins.right,p="translate(".concat(c,",0)")),u>30){var f="1"===this.groups.temporalWindowEnd.attr("opacity");this.groups.temporalWindowEnd.attr("opacity",1).attr("height",t).attr("fill",n).attr("transform",p),f?this.groups.temporalWindowEnd.transition("temporalWindowTransition").attr("width",u):this.groups.temporalWindowEnd.attr("width",u)}else this.groups.temporalWindowEnd.attr("opacity",0)}})},89270(e,t,n){"use strict";n.d(t,{Ay:()=>Qe,V9:()=>Xe,qG:()=>$e});var r=n(78281),o=n(69646),i=n(87473),a=n(26225),l=n(80755),s=n(4124),c=n(46039),u=n(77887),p=function(e){return 1===e["stroke-width"]?0:e["stroke-width"]>6?e["stroke-width"]+6:2*e["stroke-width"]},f=(n(66565),n(40952)),d=n(53657),h=n(57758),m=n(59773),y=n(54229);function v(e){return v="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},v(e)}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||b(e,t)||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 b(e,t){if(e){if("string"==typeof e)return w(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(e,t):void 0}}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}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 x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?S(Object(n),!0).forEach(function(t){E(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function E(e,t,n){return(t=function(e){var t=function(e){if("object"!=v(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=v(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==v(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var O=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"},C=function(e,t){return e.branchStroke},T=function(e,t,n){if(e){var r=e.that.svg.select("#"+(0,u.ug)("branchT",e.n.name));r.empty()||r.style("stroke",n);var o=e.that.svg.select("#"+(0,u.ug)("branchS",e.n.name));o.empty()||o.style("stroke",n)}},_=n(13957),k=n(61373),j=n(85053),P=function(e){return"aa"===e?"10px":"14px"},A=function(e){return"aa"===e?"500":"700"},I=function(e,t,n,r){return function(n){return n.visibility!==f.uU?"hidden":t||n.n.tipCount>.03*r?"visible":"aa"===e||n.n.name!==n.n.parent.name&&"__ROOT"!==n.n.parent.name?"hidden":"visible"}},M=function(e){return"num_date"===e?function(e){return(0,k.CC)("DAY",(0,k.As)((0,j.hu)(e.n,"num_date")))}:function(t){return(0,j.hu)(t.n,e)}};function R(e){return function(e){if(Array.isArray(e))return N(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return N(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?N(e,t):void 0}}(e)||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.")}()}function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var D={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===f.uU?"visible":"hidden"}},".conf":{stroke:function(e){return e.branchStroke},"stroke-width":p},".branch":{"stroke-width":function(e){return e["stroke-width"]+"px"},stroke:function(e){return C(e)},cursor:function(e){return e.visibility===f.uU?"pointer":"default"},visibility:O}}};function L(e,t){return function(n){D.attrs[e]&&R(t).filter(function(t){return D.attrs[e][t]}).forEach(function(t){n.attr(t,D.attrs[e][t])}),D.styles[e]&&R(t).filter(function(t){return D.styles[e][t]}).forEach(function(t){n.style(t,D.styles[e][t])})}}var B=function(e,t,n,r){e.selectAll(t).filter(function(e){return e.update}).transition().duration(r).call(n),r||(0,c.O2)()},z=n(51682),F=n(82833);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},W(e)}function V(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(e,t)||G(e,t)||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 H(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=G(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},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 i,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw i}}}}function G(e,t){if(e){if("string"==typeof e)return U(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?U(e,t):void 0}}function U(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function q(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 K(e,t,n){return(t=function(e){var t=function(e){if("object"!=W(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=W(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==W(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $=function e(t,n){var r=t.depth-t.pDepth;t.x=t.px+r*Math.cos(t.tau+.5*t.w),t.y=t.py+r*Math.sin(t.tau+.5*t.w);var o=t.tau;if(t.n.hasChildren)for(var i=0;i<t.n.children.length;i++){var a=t.n.children[i].shell;a.w=2*Math.PI*J(a.n)/n,a.tau=o,o+=a.w,a.px=t.x,a.py=t.y,e(a,n)}};function X(e,t){return t.step()>50?t.padding(.5):e.length<=4?t.padding(.4):e.length<=6?t.padding(.3):e.length<=10?t.padding(.2):t.padding(.1)}function Y(e,t,n){var r=t.step();if(!(t.step()<=50)){for(var o=[],i=100;i--;)o.push((Math.random()-.5)*r*.5);var a=["".concat(e,"Base"),"".concat(e,"Tip"),o.length],l=a[0],s=a[1],c=a[2],p=0;!function e(t){if(t[l]=(0,u.k9)(t.n).shell[s],t[s]+=o[p++],p>=c&&(p=0),t.n.hasChildren){var n,r=H(t.n.children);try{for(r.s();!(n=r.n()).done;)e(n.value.shell)}catch(e){r.e(e)}finally{r.f()}}}(n[0])}}function Q(e,t){var n=0;if(t.length<e.tipLabelBreakL1){var r=e.tipLabelFontSizeL1;t.length<e.tipLabelBreakL2&&(r=e.tipLabelFontSizeL2),t.length<e.tipLabelBreakL3&&(r=e.tipLabelFontSizeL3),t.forEach(function(e){n<e.n.name.length&&(n=.65*e.n.name.length*r)})}return n}function J(e){return e.tipCount+.15*(e.fullTipCount-e.tipCount)}var Z=n(58026),ee=function(e,t,n){var r=this;this.grid=!1,this.attributes=["r","cx","cy","id","class","d"],this.params={regressionStroke:s.KD,regressionWidth:6,majorGridStroke:"#DDD",majorGridWidth:2,minorGridStroke:"#EEE",minorGridWidth:1,tickLabelSize:12,tickLabelFill:s.KD,minorTicks:4,orientation:[1,1],showGrid:!0,showStreamTrees:!1,fillSelected:"#A73",radiusSelected:5,branchStroke:"#AAA",branchStrokeWidth:2,tipStroke:"#AAA",tipFill:"#CCC",tipStrokeWidth:1,tipRadius:4,fontFamily:s.sf,branchLabelKey:!1,branchLabelFont:s.sf,branchLabelFill:"#777",branchLabelFontWeight:500,branchLabelPadX:8,branchLabelPadY:5,tipLabels:!0,tipLabelFont:s.sf,tipLabelFill:"#555",tipLabelPadX:8,tipLabelPadY:2,mapToScreenDebounceTime:500,tipLabelFontSizeL1:8,tipLabelFontSizeL2:10,tipLabelFontSizeL3:12,tipLabelBreakL1:75,tipLabelBreakL2:50,tipLabelBreakL3:25},this.groups={},this.id=t,this.nodes=e.map(function(e){var t={that:r,n:e,x:0,y:0,inView:void 0===e.inView||e.inView};return e.shell=t,t}),this.zoomNode=this.nodes[n],this.strainToNode={},this.nodes.forEach(function(e){r.strainToNode[e.n.name]=e})};ee.prototype.change=function(e){var t,n,r=e.changeColorBy,o=void 0!==r&&r,i=e.changeVisibility,a=void 0!==i&&i,l=e.changeTipRadii,s=void 0!==l&&l,c=e.changeBranchThickness,p=void 0!==c&&c,f=e.showConfidences,d=void 0!==f&&f,h=e.removeConfidences,m=void 0!==h&&h,y=e.zoomIntoClade,v=void 0!==y&&y,g=e.svgHasChangedDimensions,b=void 0!==g&&g,w=e.animationInProgress,S=void 0!==w&&w,x=e.changeNodeOrder,E=void 0!==x&&x,O=e.focusChange,C=void 0!==O&&O,T=e.newDistance,_=void 0===T?void 0:T,k=e.newLayout,j=void 0===k?void 0:k,P=e.updateLayout,A=void 0===P?void 0:P,I=e.newBranchLabellingKey,R=void 0===I?void 0:I,N=e.showAllBranchLabels,D=void 0===N?void 0:N,L=e.newTipLabelKey,B=void 0===L?void 0:L,z=e.streamDefinitionChange,F=void 0===z?void 0:z,W=e.branchStroke,V=void 0===W?void 0:W,H=e.tipStroke,G=void 0===H?void 0:H,U=e.fill,q=void 0===U?void 0:U,K=e.visibility,$=void 0===K?void 0:K,X=e.tipRadii,Y=void 0===X?void 0:X,Q=e.hoveredLegendSwatch,J=void 0===Q?void 0:Q,Z=e.branchThickness,ee=void 0===Z?void 0:Z,te=e.scatterVariables,ne=void 0===te?void 0:te,re=e.performanceFlags,oe=void 0===re?void 0:re,ie=e.newMeasurementsColorGrouping,ae=void 0===ie?void 0:ie,le=new Set,se={},ce=new Set,ue=j,pe=500;if((Date.now()-this.timeLastRenderRequested<1e3||!0===oe.get("skipTreeAnimation"))&&(pe=0),o&&(le.add(".branch").add(".tip").add(".conf"),ce.add("stroke").add("fill"),se.branchStroke=V,se.tipStroke=G,se.fill=q),a&&(le.add(".tip").add(".tipLabel").add(".branchLabel"),ce.add("visibility").add("cursor"),se.visibility=$),s&&(le.add(".tip"),ce.add("r"),se.r=Y,this.params.showStreamTrees&&this.highlightStreamtreeRipples(J)),p&&(le.add(".branch").add(".conf"),ce.add("stroke-width"),se["stroke-width"]=ee),(_||j||A||v||b||E||a)&&(le.add(".tip").add(".branch.S").add(".branch.T").add(".branch"),le.add(".vaccineCross").add(".vaccineDottedLine").add(".conf"),le.add(".branchLabel").add(".tipLabel"),le.add(".grid").add(".regression"),ce.add("cx").add("cy").add("d").add("opacity").add("visibility")),d&&(this.params.confidence=!0),void 0!==D&&(this.params.showAllBranchLabels=D,le.add(".branchLabel")),B&&(this.callbacks.tipLabel=M(B),le.add(".tipLabel")),t=this.nodes,n=se,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)}}),o&&(this.updateColorBy(),this.measurementsColorGrouping=ae),a&&this.regression&&(le.add(".regression"),this.calculateRegression()),v&&(this.nodes.forEach(function(e){e.inView=!1,e.update=!0}),this.zoomNode=v.n.hasChildren?v:v.n.parent.shell,(0,u.zF)(this.zoomNode,function(e){e.inView=!0})),(b||E||a)&&this.nodes.forEach(function(e){e.update=!0}),_||A||E||F?(0,u.PX)({nodes:this.nodes,focus:this.focus,streams:this.params.showStreamTrees&&this.streams}):this.params.showStreamTrees&&(o||a)&&(0,u.qO)(this.nodes,this.streams),(_||A)&&this.setDistance(_),(_||j||A||E||F)&&this.setLayout(j||this.layout,ne),ce.has("stroke-width")||_||j||E||A||v||b||F||a||d?this.mapToScreen():this.params.showStreamTrees&&(o||a)&&this.mapStreamsToScreen(),C&&("selected"===this.focus?this.hideTemporalSlice():this.showTemporalSlice()),F){for(var fe=0,de=["branchLabels","branchTee","branchStem","tips","tipLabels","vaccines"];fe<de.length;fe++){var he,me,ye,ve=de[fe];null===(he=this.groups)||void 0===he||null===(me=he[ve])||void 0===me||null===(ye=me.selectAll("*"))||void 0===ye||ye.remove()}this.addGrid(),this.drawBranches(),this.updateTipLabels(),this.drawTips(),this.drawBranchLabels(this.params.branchLabelKey),this.vaccines&&this.drawVaccines(),this.regression&&this.drawRegression(),this.confidencesInSVG&&this.removeConfidence(),this.drawStreams()}else{var ge={removeConfidences:m,showConfidences:d,newBranchLabellingKey:R};ge.timeSliceHasPotentiallyChanged=a||void 0!==_,ge.hideTipLabels=S||"none"===B,ue?this.modifySVGInStages(le,ce,pe,1e3,ge):this.modifySVG(le,ce,pe,ge),(this.params.showStreamTrees||o)&&this.drawStreams()}this.timeLastRenderRequested=Date.now()},ee.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 l=e.has(".branch");l&&a.splice(a.indexOf(".branch"),1),[".S",".T"].forEach(function(r,a){e.has(".branch".concat(r))&&(o=l?function(e){L(".branch",t)(e),e.attr("d",function(e){return e.branch[a]})}:function(e){e.attr("d",function(e){return e.branch[a]})},B(i.svg,".branch".concat(r),o,n))})}a.forEach(function(r){e.has(r)&&(o=L(r,t),B(i.svg,r,o,n))}),r.hideTipLabels?this.removeTipLabels():e.has(".tipLabel")&&this.updateTipLabels(),e.has(".grid")&&(this.grid&&"unrooted"!==this.layout?this.addGrid():this.hideGrid()),e.has(".regression")&&(this.removeRegression(),this.regression&&this.drawRegression()),r.removeConfidences&&this.confidencesInSVG?this.removeConfidence():r.showConfidences&&!this.confidencesInSVG?this.drawConfidence():e.has(".conf")&&this.confidencesInSVG&&((0,_.ef)(!0,this.distance,this.layout)?(o=L(".conf",t),B(this.svg,".conf",o,n)):this.removeConfidence()),r.timeSliceHasPotentiallyChanged&&this.showTemporalSlice(),r.newBranchLabellingKey?(this.removeBranchLabels(),"none"!==r.newBranchLabellingKey&&this.drawBranchLabels(r.newBranchLabellingKey)):e.has(".branchLabel")&&this.updateBranchLabels(n),this.measurementsColorGrouping?this.drawMeasurementsColoringCrosshair():this.removeMeasurementsColoringCrosshair()},ee.prototype.modifySVGInStages=function(e,t,n,r,o){var i=this;e.delete(".tip"),this.hideGrid();var a=0,l=function(){i.drawBranches(),i.params.showGrid&&i.addGrid(),i.svg.selectAll(".tip").remove(),i.updateTipLabels(),i.drawTips(),i.vaccines&&i.drawVaccines(),i.measurementsColorGrouping&&i.drawMeasurementsColoringCrosshair(),i.showTemporalSlice(),i.regression&&i.drawRegression(),e.has(".branchLabel")&&i.drawBranchLabels(o.newBranchLabellingKey||i.params.branchLabelKey)};this.confidencesInSVG=!1,this.svg.selectAll(R(e).join(", ")).transition().duration(n).style("opacity",0).remove().on("start",function(){return a++}).on("end",function(){if(! --a){i.setClipMask();var e=L(".tip",t);B(i.svg,".tip",e,r),setTimeout(l,r)}}),this.hideTemporalSlice(),this.removeMeasurementsColoringCrosshair(),n||(0,c.O2)()},ee.prototype.render=function(e){var t=this,n=e.svg,r=e.layout,o=e.distance,i=e.focus,a=e.parameters,l=e.callbacks,s=e.branchThickness,c=e.visibility,p=e.drawConfidence,f=e.vaccines,d=e.branchStroke,h=e.tipStroke,m=e.tipFill,y=e.tipRadii,v=e.dateRange,g=e.scatterVariables,b=e.measurementsColorGrouping,w=e.streams,S=e.focusNodes;this.svg=n,this.params=x(x({},this.params),a),this.callbacks=l,this.vaccines=f?f.map(function(e){return e.shell}):void 0,this.measurementsColorGrouping=b,this.dateRange=v,this.streams=w,this.focus=i,this.focusNodes=S,this.nodes.forEach(function(e,n){e.branchStroke=d[n],e.tipStroke=h[n],e.fill=m[n],e.visibility=c[n],e["stroke-width"]=s[n],e.r=y?y[n]:t.params.tipRadius}),(0,u.PX)({nodes:this.nodes,focus:this.focus,streams:this.params.showStreamTrees&&w}),this.setDistance(o),this.setLayout(r,g),this.mapToScreen(),this.setClipMask(),this.params.showGrid&&(this.addGrid(),this.focus||this.showTemporalSlice()),this.drawBranches(),this.updateTipLabels(),this.drawTips(),this.drawStreams(),this.params.branchLabelKey&&this.drawBranchLabels(this.params.branchLabelKey),this.vaccines&&this.drawVaccines(),this.measurementsColorGrouping&&this.drawMeasurementsColoringCrosshair(),this.regression&&this.drawRegression(),this.confidencesInSVG=!1,p&&this.drawConfidence(),this.timeLastRenderRequested=Date.now()},ee.prototype.clearSVG=function(){this.svg.selectAll("*").remove()},ee.prototype.setClipMask=function(){var e=g(this.yScale.range(),2),t=e[0],n=e[1],r=g(this.xScale.range(),2),o=r[0],i=r[1];if(parseInt(o,10)>parseInt(i,10)){var a=[i,o];o=a[0],i=a[1]}var l=o-5,s=i-o+20,c=t-15,u=n-t+20;this.groups.clipPath?this.groups.clipPath.select("rect").attr("x",l).attr("y",c).attr("width",s).attr("height",u):(this.groups.clipPath=this.svg.append("g").attr("id","clipGroup"),this.groups.clipPath.append("clipPath").attr("id","treeClip").append("rect").attr("x",l).attr("y",c).attr("width",s).attr("height",u))},ee.prototype.drawTips=function(){var e=this.params;"tips"in this.groups||(this.groups.tips=this.svg.append("g").attr("id","tips").attr("clip-path","url(#treeClip)"));var t=(this.params.showStreamTrees?this.nodes.filter(function(e){return!e.n.inStream}):this.nodes).filter(function(e){return!e.n.hasChildren});this.groups.tips.selectAll(".tip").data(t).enter().append("circle").attr("class","tip").attr("id",function(e){return(0,u.ug)("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===f.uU?"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")},ee.prototype.drawBranches=function(){var e=this.params,t=(this.params.showStreamTrees?this.nodes.filter(function(e){return!e.n.inStream}):this.nodes).filter(function(e){return void 0!==e.displayOrder});"branchTee"in this.groups||(this.groups.branchTee=this.svg.append("g").attr("id","branchTee").attr("clip-path","url(#treeClip)")),"clock"===this.layout||"scatter"===this.layout||"unrooted"===this.layout?this.groups.branchTee.selectAll("*").remove():this.groups.branchTee.selectAll(".branch").data(t.filter(function(e){return e.n.hasChildren})).enter().append("path").attr("class","branch T").attr("id",function(e){return(0,u.ug)("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("visibility",O).style("fill","none").style("pointer-events","auto").on("mouseover",this.callbacks.onBranchHover).on("mouseout",this.callbacks.onBranchLeave).on("click",this.callbacks.onBranchClick),this.groups.branchGradientDefs||(this.groups.branchGradientDefs=this.svg.append("defs")),this.groups.branchGradientDefs.selectAll("*").remove(),this.updateColorBy(),"branchStem"in this.groups||(this.groups.branchStem=this.svg.append("g").attr("id","branchStem").attr("clip-path","url(#treeClip)")),this.groups.branchStem.selectAll(".branch").data(t).enter().append("path").attr("class","branch S").attr("id",function(e){return(0,u.ug)("branchS",e.n.name)}).attr("d",function(e){return e.branch[0]}).style("stroke",function(t){return t.branchStroke?C(t):e.branchStroke}).style("stroke-linecap","round").style("stroke-width",function(t){return t["stroke-width"]||e.branchStrokeWidth}).style("visibility",O).style("cursor",function(e){return e.visibility===f.uU?"pointer":"default"}).style("pointer-events","auto").on("mouseover",this.callbacks.onBranchHover).on("mouseout",this.callbacks.onBranchLeave).on("click",this.callbacks.onBranchClick)},ee.prototype.drawVaccines=function(){var e=this.vaccines||[];this.params.showStreamTrees&&(e=e.filter(function(e){return!e.n.inStream})),e.length&&("vaccines"in this.groups||(this.groups.vaccines=this.svg.append("g").attr("id","vaccines")),this.groups.vaccines.selectAll(".vaccineCross").data(e).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))},ee.prototype.drawMeasurementsColoringCrosshair=function(){var e=this;"measurementsColoringCrosshair"in this.groups?this.removeMeasurementsColoringCrosshair():this.groups.measurementsColoringCrosshair=this.svg.append("g").attr("id","measurementsColoringCrosshairId");var t=this.nodes.filter(function(t){return!t.n.hasChildren&&t.n.name===e.measurementsColorGrouping});1===t.length?this.groups.measurementsColoringCrosshair.selectAll(".crosshair").data(t).enter().append("svg").attr("stroke","currentColor").attr("fill","currentColor").attr("strokeWidth","0").attr("viewBox","0 0 256 256").attr("height",function(e){return 5*e.r}).attr("width",function(e){return 5*e.r}).attr("x",function(e){return e.xTip-5*e.r/2}).attr("y",function(e){return e.yTip-5*e.r/2}).style("cursor","pointer").style("pointer-events","auto").on("mouseover",this.callbacks.onTipHover).on("mouseout",this.callbacks.onTipLeave).on("click",this.callbacks.onTipClick).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"):0===t.length?console.warn("Measurements coloring group ".concat(this.measurementsColorGrouping," doesn't match any tip names")):console.warn("Measurements coloring group ".concat(this.measurementsColorGrouping," matches multiple tips"))},ee.prototype.removeMeasurementsColoringCrosshair=function(){"measurementsColoringCrosshair"in this.groups&&this.groups.measurementsColoringCrosshair.selectAll("*").remove()},ee.prototype.drawRegression=function(){if(void 0!==this.regression.slope){var e,t,n,r=this.yScale(this.regression.intercept+this.xScale.domain()[0]*this.regression.slope),o=this.yScale(this.regression.intercept+this.xScale.domain()[1]*this.regression.slope),i="M "+this.xScale.range()[0].toString()+" "+r.toString()+" L "+this.xScale.range()[1].toString()+" "+o.toString();"regression"in this.groups||(this.groups.regression=this.svg.append("g").attr("id","regression").attr("clip-path","url(#treeClip)")),this.groups.regression.append("path").attr("d",i).attr("class","regression").style("fill","none").style("visibility","visible").style("stroke",this.params.regressionStroke).style("stroke-width",this.params.regressionWidth),this.groups.regression.append("text").text((e=this.regression,t=this.layout,n=this.yScale,"clock"===t?(0,u.Qh)(n)?"rate estimate: ".concat(e.slope.toExponential(2)," subs per site per year"):"rate estimate: ".concat((0,u.C2)(e.slope)," subs per year"):"intercept = ".concat(e.intercept.toPrecision(3),", slope = ").concat(e.slope.toPrecision(3),", R^2 = ").concat(e.r2.toPrecision(3)))).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)}},ee.prototype.removeRegression=function(){"regression"in this.groups&&this.groups.regression.selectAll("*").remove()},ee.prototype.updateColorBy=function(){},ee.prototype.drawStreams=function(){var e=this,t=this.params.showStreamTrees?Object.keys(this.streams).reverse():[];if(t.length&&!("streams"in this.groups)?(this.groups.streams=this.svg.append("g").attr("id","streams"),this.groups.streamsLabels=this.svg.append("g").attr("id","stream-labels")):!t.length&&"streams"in this.groups&&(this.groups.streams.selectAll("*").remove(),this.groups.streamsLabels.selectAll("*").remove(),delete this.groups.streams,delete this.groups.streamsLabels),t.length){this.groups.streams.selectAll(".streamGroup").data(t,function(e){return String(e)}).join(function(e){var t=e.append("g").attr("id",function(e){return"stream".concat(e)}).attr("class","streamGroup");return t.append("g").attr("class","connector"),t.append("g").attr("class","ripples"),t},void 0,function(e){return e.call(function(e){return e.transition("500").style("opacity",0).remove()})});var n,r=(0,y.A)().x(function(e){return e.x}).y0(function(e){return e.y0}).y1(function(e){return e.y1}),o=function(t,n){if(0===t.n.streamNodeCounts.visible)return"";var r=e.yScale(t.displayOrder);if("backbone"===n){var o=t.streamRipples.at(0).at(0).x,i=t.streamRipples.at(0).at(-1).x;return"M".concat(o,",").concat(r,"H").concat(i)}if("hidden"===O(t))return"";var a=t.streamRipples[0][0].x,l=e.streams[t.n.streamName].parentStreamName;if(l){var s=t.xBase,c=e.yScale(e.nodes[e.streams[l].startNode].displayOrder);return"M".concat(s,",").concat(c,"L").concat(s,",").concat(r,"L").concat(a,",").concat(r)}return"M".concat(t.xBase,",").concat(r,"H").concat(a)},i=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=b(e))){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}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 o,i=!0,a=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(a)throw o}}}}(t);try{var a=function(){var t=n.value,i=e.nodes[e.streams[t].startNode],a=e.callbacks;e.groups.streams.select("#".concat(CSS.escape("stream".concat(t)))).select(".connector").selectAll(".connectorPath").data([i,i],function(e,t){return 0===t?"joiner":"backbone"}).join(function(t){return t.append("path").attr("class","connectorPath").attr("d",function(e,t){return o(e,0===t?"joiner":"backbone")}).attr("stroke-width",e.params.branchStrokeWidth).style("stroke",function(t,n){return 0===n?t.branchStroke:e.params.branchStroke}).attr("fill","None").style("cursor","pointer").style("pointer-events","auto").on("mouseover",function(e,t,n){a.onStreamHover(i,t,Array.from(n),!0)}).on("mouseout",function(e,t,n){a.onStreamLeave(i,t,Array.from(n),!0)}).on("click",a.onBranchClick)},function(t){return t.call(function(t){return t.transition("500").attr("d",function(e,t){return o(e,0===t?"joiner":"backbone")}).style("stroke",function(t,n){return 0===n?t.branchStroke:e.params.branchStroke}).attr("stroke-width",e.params.branchStrokeWidth)})},function(e){return e.remove()}),e.groups.streams.select("#".concat(CSS.escape("stream".concat(t)))).select(".ripples").selectAll(".ripple").data(i.streamRipples,function(e){return String(e.key)}).join(function(t){return t.append("path").attr("class","ripple").attr("d",function(e){return r(e)}).attr("fill",function(e,t){return i.n.streamCategories[t].color}).on("mouseover",function(t,n,r){e.callbacks.onStreamHover(i,n,Array.from(r),!1)}).on("mouseout",function(t,n,r){e.callbacks.onStreamLeave(i,n,Array.from(r),!1)}).style("cursor","pointer").style("pointer-events","auto").on("click",function(){return e.callbacks.onBranchClick(i)})},function(e){return e.call(function(e){return e.transition("500").attr("d",function(e){return r(e)})})},function(e){return e.remove()})};for(i.s();!(n=i.n()).done;)a()}catch(e){i.e(e)}finally{i.f()}var l=t.map(function(t){var n=e.nodes[e.streams[t].startNode];if(0===n.n.streamNodeCounts.visible)return null;var r,o=e.zoomNode.n.name===n.n.name?"start":"middle",i=(r=n,r.streamRipples[0].reduce(function(e,t,n){var o=g(e,2),i=o[0],a=o[1],l=r.streamRipples.at(-1)[n].y1-t.y0;return 0===n?[0,l]:l>a?[n,l]:[i,a]},[void 0,void 0]))[1],a=Math.floor(Math.max(10,Math.min(i/2,24))),l=10===a?"hidden":"visible";return{phyloNode:n,streamName:t,x:n.streamRipples.at(0).at(0).x,y:e.yScale(n.displayOrder),textAnchor:o,fontSize:a,visibility:l}}).filter(function(e){return!!e});this.groups.streamsLabels.selectAll(".labelText").data(l,function(e){return String(e.streamName)}).join(function(e){return e.append("text").attr("class","labelText").attr("id",function(e){return"label".concat(e.streamName)}).attr("x",function(e){return e.x}).attr("y",function(e){return e.y}).attr("text-anchor",function(e){return e.textAnchor}).attr("dominant-baseline","ideographic").attr("font-size",function(e){return e.fontSize}).attr("visibility",function(e){return e.visibility}).text(function(e){return e.phyloNode.n.streamName}).style("pointer-events","none")},function(e){return e.call(function(e){return e.attr("x",function(e){return e.x}).attr("y",function(e){return e.y}).attr("text-anchor",function(e){return e.textAnchor}).attr("visibility",function(e){return e.visibility}).attr("font-size",function(e){return e.fontSize})})},function(e){return e.remove()})}},ee.prototype.highlightStreamtreeRipples=function(e){var t,n=null===(t=this.groups)||void 0===t?void 0:t.streams;if(!n)return null;if(!1!==e){var r=e+"_";n.selectAll(".ripple").each(function(e){e.key.startsWith(r)||(0,m.A)(this).style("opacity",.3)})}else n.selectAll(".ripple").style("opacity",1)},ee.prototype.setDistance=function(e){this.nodes.forEach(function(e){e.update=!0}),e&&(this.distance=e),["div","num_date"].includes(this.distance)||(console.error("Tree distance measure not set or invalid. Using `div`."),this.distance="div"),"div"===this.distance?this.nodes.forEach(function(e){e.depth=(0,j.Ue)(e.n),e.pDepth=(0,j.Ue)((0,u.k9)(e.n)),e.conf=[e.depth,e.depth]}):this.nodes.forEach(function(e){e.depth=(0,j.hu)(e.n,"num_date"),e.pDepth=(0,j.hu)((0,u.k9)(e.n),"num_date"),e.conf=(0,j.hu)(e.n,"num_date",{confidence:!0})||[e.depth,e.depth]}),this.vaccines&&this.vaccines.forEach(function(e){e.crossDepth=e.depth})},ee.prototype.setLayout=function(e,t){void 0!==e&&e===this.layout||this.nodes.forEach(function(e){e.update=!0}),this.layout=void 0===e?"rect":e,this.regression=void 0,t&&(this.scatterVariables=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q(Object(n),!0).forEach(function(t){K(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},t)),"clock"===this.layout&&(this.scatterVariables.x="num_date",this.scatterVariables.y="div"),"rect"===this.layout?this.rectangularLayout():"clock"===this.layout||"scatter"===this.layout?this.scatterplotLayout():"radial"===this.layout?this.radialLayout():"unrooted"===this.layout&&this.unrootedLayout()},ee.prototype.rectangularLayout=function(){this.nodes.forEach(function(e){e.y=e.displayOrder,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})},ee.prototype.scatterplotLayout=function(){if(this.scatterVariables){var e,t="displayOrder"===this.scatterVariables.x||"displayOrder"===this.scatterVariables.y?(0,u.tK)(this.nodes):void 0,n=H(this.nodes);try{for(n.s();!(e=n.n()).done;){var r=e.value;if("div"===this.scatterVariables.x)r.x=(0,j.Ue)(r.n),r.px=(0,j.Ue)((0,u.k9)(r.n));else if("gt"===this.scatterVariables.x)r.x=r.n.currentGt,r.px=(0,u.k9)(r.n).currentGt;else if("displayOrder"===this.scatterVariables.x){var o=V(t(r),2);r.x=o[0],r.px=o[1]}else if(r.x=(0,j.hu)(r.n,this.scatterVariables.x),r.px=(0,j.hu)((0,u.k9)(r.n),this.scatterVariables.x),this.scatterVariables.xTemporal){var i=[(0,h.DK)(r.x),(0,h.DK)(r.px)];r.x=i[0],r.px=i[1]}if("div"===this.scatterVariables.y)r.y=(0,j.Ue)(r.n),r.py=(0,j.Ue)((0,u.k9)(r.n));else if("gt"===this.scatterVariables.y)r.y=r.n.currentGt,r.py=(0,u.k9)(r.n).currentGt;else if("displayOrder"===this.scatterVariables.y){var a=V(t(r),2);r.y=a[0],r.py=a[1]}else if(r.y=(0,j.hu)(r.n,this.scatterVariables.y),r.py=(0,j.hu)((0,u.k9)(r.n),this.scatterVariables.y),this.scatterVariables.yTemporal){var l=[(0,h.DK)(r.y),(0,h.DK)(r.py)];r.y=l[0],r.py=l[1]}}}catch(e){n.e(e)}finally{n.f()}this.vaccines&&this.vaccines.forEach(function(e){e.xCross=e.x,e.yCross=e.y}),this.scatterVariables.showRegression&&this.calculateRegression()}else console.error("Scatterplot called without variables")},ee.prototype.unrootedLayout=function(){var e=J(this.nodes[0].n),t=1.5*Math.PI,n=this.nodes[0].n.children;this.nodes.forEach(function(e){e.x=void 0,e.y=void 0,e.px=void 0,e.py=void 0});for(var r=0;r<n.length;r++){var o=n[r].shell;if(o.w=2*Math.PI*J(o.n)/e,o.w>0){var i=o.depth-this.nodes[0].depth;o.px=i*Math.cos(t+.5*o.w),o.py=i*Math.sin(t+.5*o.w),o.tau=t,$(o,e),t+=o.w}}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)}),this.nodes.forEach(function(e){delete e.tau,delete e.w})},ee.prototype.radialLayout=function(){var e,t=this,n=Math.max.apply(Math,function(e){if(Array.isArray(e))return U(e)}(e=this.nodes.map(function(e){return e.displayOrder}).filter(function(e){return e}))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||G(e)||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.")}()),r=this.nodes[0].depth;this.nodes.forEach(function(e){var t=1.9*Math.PI*e.displayOrderRange[0]/n,o=1.9*Math.PI*e.displayOrderRange[1]/n;e.angle=1.9*Math.PI*e.displayOrder/n,e.y=(e.depth-r)*Math.cos(e.angle),e.x=(e.depth-r)*Math.sin(e.angle),e.py=e.y*(e.pDepth-r)/(e.depth-r+1e-15),e.px=e.x*(e.pDepth-r)/(e.depth-r+1e-15),e.yCBarStart=(e.depth-r)*Math.cos(t),e.xCBarStart=(e.depth-r)*Math.sin(t),e.yCBarEnd=(e.depth-r)*Math.cos(o),e.xCBarEnd=(e.depth-r)*Math.sin(o),e.smallBigArc=Math.abs(o-t)>1*Math.PI}),this.vaccines&&this.vaccines.forEach(function(e){"div"===t.distance?(e.xCross=e.x,e.yCross=e.y):(e.xCross=(e.crossDepth-r)*Math.sin(e.angle),e.yCross=(e.crossDepth-r)*Math.cos(e.angle))})},ee.prototype.setScales=function(){"scatter"!==this.layout||this.scatterVariables.xContinuous?this.xScale=(0,z.m4)():this.xScale=(0,z.hq)().round(!1).align(.5).padding(.5),"scatter"!==this.layout||this.scatterVariables.yContinuous?this.yScale=(0,z.m4)():this.yScale=(0,z.hq)().round(!1).align(.5).padding(.5);var e=parseInt(this.svg.attr("width"),10),t=parseInt(this.svg.attr("height"),10);if("radial"===this.layout||"unrooted"===this.layout){var n=e-this.margins.left-this.margins.right,r=t-this.margins.bottom-this.margins.top,o=Math.min(n,r),i=n-o,a=r-o;this.xScale.range([.5*i+this.margins.left,e-.5*i-this.margins.right]),this.yScale.range([.5*a+this.margins.top,t-.5*a-this.margins.bottom])}else this.params.orientation[0]>0?this.xScale.range([this.margins.left,e-this.margins.right]):this.xScale.range([e-this.margins.right,this.margins.left]),this.params.orientation[1]>0?this.yScale.range([this.margins.top,t-this.margins.bottom]):this.yScale.range([t-this.margins.bottom,this.margins.top])},ee.prototype.mapToScreen=function(){var e,t=this,n=this.nodes.filter(function(e){return!e.n.hasChildren}).filter(function(e){return e.inView});this.margins={left:"scatter"===this.layout||"clock"===this.layout?40:5,right:5+Q(this.params,n),top:"radial"===this.layout?10:15,bottom:35},this.setScales(),this.setClipMask();var r,o,i,a,l="selected"===this.focus&&("rect"===this.layout||"radial"===this.layout),s=this.focusNodes;if(e=l&&s?s.nodes.map(function(e){return t.nodes[e]}).filter(function(e){return void 0!==e.y&&void 0!==e.x}):this.nodes.filter(function(e){return e.inView&&void 0!==e.y&&void 0!==e.x}),"scatter"===this.layout&&!1===this.scatterVariables.showBranches&&(e=e.filter(function(e){return!e.n.hasChildren})),"scatter"!==this.layout||this.scatterVariables.xContinuous){var c=1e6,p=-1e5;e.forEach(function(e){e.x<c&&(c=e.x),e.x>p&&(p=e.x)}),c!==p||this.params.showStreamTrees&&e[0].n.streamName||(c-=.005,p+=.005);var f=1e-8;(i=p-c)<f&&(p=f-c,i=f),"rect"===this.layout&&0!==this.zoomNode.n.arrayIdx&&(c-=(p-c)/20),r=[c,p]}else{var d=new Set(e.map(function(e){return e.x}));X(r=this.scatterVariables.xDomain.filter(function(e){return d.has(e)}),this.xScale)}if("scatter"!==this.layout||this.scatterVariables.yContinuous){var h=1e6,m=-1e5;if(e.forEach(function(e){e.y<h&&(h=e.y),e.y>m&&(m=e.y)}),n.length<30){var y=.05*(m-h);h-=y,m+=y}a=m-h,o=[h,m]}else{var v=new Set(e.map(function(e){return e.y}));X(o=this.scatterVariables.yDomain.filter(function(e){return v.has(e)}),this.yScale)}if("radial"===this.layout||"unrooted"===this.layout){var g=Math.max(a,i),b=i>a?.5*(i-a):0,w=i<a?.5*(a-i):0;r=[r[0]-w,r[0]+g-w],o=[o[0]-b,o[0]+g-b]}if("clock"!==this.layout&&"scatter"!==this.layout||o.reverse(),this.params.showStreamTrees)for(var S=0,x=Object.values(this.streams);S<x.length;S++){var E=x[S],O=this.nodes[E.startNode];if(O.inView){var C=O.n.streamPivots;C.at(0)<r[0]&&(r[0]=C.at(0)),C.at(-1)>r[1]&&(r[1]=C.at(-1)),O.displayOrderRange[0]<o[0]&&(o[0]=O.displayOrderRange[0]),O.displayOrderRange[1]>o[1]&&(o[1]=O.displayOrderRange[1])}}this.xScale.domain(r),this.yScale.domain(o);var T=this.yScale.range()[1]+100,_=this.xScale.range()[0]-100;if(this.nodes.forEach(function(e){e.xTip=t.xScale(e.x),e.yTip=t.yScale(e.y),e.xBase=t.xScale(e.px),e.yBase=t.yScale(e.py),e.rot=180*Math.atan2(e.yTip-e.yBase,e.xTip-e.xBase)/Math.PI}),"scatter"===this.layout&&(this.scatterVariables.yContinuous||Y("y",this.yScale,this.nodes),this.scatterVariables.xContinuous||Y("x",this.xScale,this.nodes),this.nodes.forEach(function(e){isNaN(e.xTip)&&(e.xTip=_),isNaN(e.yTip)&&(e.yTip=T),isNaN(e.xBase)&&(e.xBase=_),isNaN(e.yBase)&&(e.yBase=T)})),this.vaccines&&this.vaccines.forEach(function(e){var n=t.xScale(e.xCross),r=t.yScale(e.yCross);e.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)}),"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("clock"===this.layout||"scatter"===this.layout)this.scatterVariables.showBranches?this.nodes.forEach(function(e){e.branch=e.xBase===_||e.xTip===_||e.yBase===T||e.yTip===T?["",""]:[" M "+e.xBase.toString()+","+e.yBase.toString()+" L "+e.xTip.toString()+","+e.yTip.toString(),""]}):this.nodes.forEach(function(e){e.branch=["",""]});else if("rect"===this.layout)this.nodes.forEach(function(e){var n=.5*((0,u.k9)(e.n).shell["stroke-width"]-e["stroke-width"])||0,r=[t.yScale(e.displayOrderRange[0]),t.yScale(e.displayOrderRange[1])];e.branch=[" M ".concat(e.xBase-n,",").concat(e.yBase," L ").concat(e.xTip,",").concat(e.yTip+.01)," M ".concat(e.xTip,",").concat(r[0]," L ").concat(e.xTip,",").concat(r[1])],t.params.confidence&&(e.confLine=" M ".concat(t.xScale(e.conf[0]),",").concat(e.yBase," L ").concat(t.xScale(e.conf[1]),",").concat(e.yTip))});else if("radial"===this.layout){var k=this.nodes[0].depth,j=this.nodes.map(function(e){return.5*((0,u.k9)(e.n).shell["stroke-width"]-e["stroke-width"])||0});this.nodes.forEach(function(e,n){e.branch=[" M "+(e.xBase-j[n]*Math.sin(e.angle)).toString()+" "+(e.yBase-j[n]*Math.cos(e.angle)).toString()+" L "+e.xTip.toString()+" "+e.yTip.toString(),""],e.n.hasChildren&&(e.branch[1]=" M "+t.xScale(e.xCBarStart).toString()+" "+t.yScale(e.yCBarStart).toString()+" A "+(t.xScale(e.depth)-t.xScale(k)).toString()+" "+(t.yScale(e.depth)-t.yScale(k)).toString()+" 0 "+(e.smallBigArc?"1 ":"0 ")+" 1 "+t.xScale(e.xCBarEnd).toString()+","+t.yScale(e.yCBarEnd).toString())})}this.params.showStreamTrees&&this.mapStreamsToScreen()},ee.prototype.mapStreamsToScreen=function(){for(var e=this,t=function(){var t=r[n],o=e.nodes[t.startNode];o.streamRipples=o.rippleDisplayOrders.map(function(t,n){return Object.assign([],t.map(function(t,n){var r=V(t,2),i=r[0],a=r[1];return{x:e.xScale(o.n.streamPivots[n]),y0:e.yScale(i),y1:e.yScale(a)}}),{key:o.n.streamCategories[n].name+"_"+e.streams[F.vv]})})},n=0,r=Object.values(this.streams);n<r.length;n++)t()},ee.prototype.calculateRegression=function(){"clock"===this.layout?this.regression=function(e){var t=e.filter(function(e){return!e.n.hasChildren&&e.visibility===f.uU}),n=t.length;if(0===n)return{slope:void 0,intercept:void 0,r2:void 0};var r=e[0].x,o=(0,d.A)(t.map(function(e){return e.y*(e.x-r)}))/n/((0,d.A)(t.map(function(e){return(e.x-r)*(e.x-r)}))/n);return{slope:o,intercept:-r*o,r2:void 0}}(this.nodes):this.regression=function(e){var t=e.filter(function(e){return!e.n.hasChildren&&void 0!==e.x&&void 0!==e.y&&e.visibility===f.uU}),n=t.length;if(0===n)return{slope:void 0,intercept:void 0,r2:void 0};var r=(0,d.A)(t.map(function(e){return e.x}))/n,o=(0,d.A)(t.map(function(e){return e.y}))/n,i=(0,d.A)(t.map(function(e){return(e.x-r)*(e.y-o)}))/(0,d.A)(t.map(function(e){return Math.pow(e.x-r,2)})),a=o-i*r,l=1-(0,d.A)(t.map(function(e){return Math.pow(e.y-(a+i*e.x),2)}))/(0,d.A)(t.map(function(e){return Math.pow(e.y-o,2)}));return{slope:i,intercept:a,r2:l}}(this.nodes)},ee.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())},ee.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)})},ee.prototype.drawSingleCI=function(e,t){e.append("path").attr("class","conf").attr("id",function(e){return(0,u.ug)("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",p).style("pointer-events","none")},ee.prototype.drawBranchLabels=function(e){var t=this;this.params.branchLabelKey=e;var n=P(e),r=A(e),o=I(e,this.params.showAllBranchLabels,this.layout,this.zoomNode.n.tipCount);"branchLabels"in this.groups||(this.groups.branchLabels=this.svg.append("g").attr("id","branchLabels").attr("clip-path","url(#treeClip)"));var i=(this.params.showStreamTrees?this.nodes.filter(function(e){return!e.n.inStream}):this.nodes).filter(function(t){return t.n.branch_attrs&&t.n.branch_attrs.labels&&t.n.branch_attrs.labels[e]});this.groups.branchLabels.selectAll(".branchLabel").data(i).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).style("pointer-events","none").text(function(t){return t.n.branch_attrs.labels[e]})},ee.prototype.removeBranchLabels=function(){this.params.branchLabelKey=void 0,"branchLabels"in this.groups&&this.groups.branchLabels.selectAll("*").remove()},ee.prototype.updateBranchLabels=function(e){var t=this;if(this.groups.branchLabels){var n=I(this.params.branchLabelKey,this.params.showAllBranchLabels,this.layout,this.zoomNode.n.tipCount),r=P(this.params.branchLabelKey),o=A(this.params.branchLabelKey);this.groups.branchLabels.selectAll(".branchLabel").transition().duration(e).attr("x",function(e){return e.xTip-5}).attr("y",function(e){return e.yTip-t.params.branchLabelPadY}).style("visibility",n).style("font-weight",o).style("font-size",r),e||(0,c.O2)()}},ee.prototype.updateTipLabels=function(e){var t=this;"tipLabels"in this.groups?this.groups.tipLabels.selectAll("*").remove():this.groups.tipLabels=this.svg.append("g").attr("id","tipLabels");var n=this.callbacks.tipLabel,r=this.params.tipLabelPadX,o=this.params.tipLabelPadY,i=(this.params.showStreamTrees?this.nodes.filter(function(e){return!e.n.inStream}):this.nodes).filter(function(e){return!e.n.hasChildren}).filter(function(e){return e.inView}),a=i.filter(function(e){return e.visibility===f.uU});if(a.length<this.params.tipLabelBreakL1){var l=this.params.tipLabelFontSizeL1;i.length<this.params.tipLabelBreakL3?l=this.params.tipLabelFontSizeL3:i.length<this.params.tipLabelBreakL2&&(l=this.params.tipLabelFontSizeL2),window.setTimeout(function(){t.groups.tipLabels.selectAll(".tipLabel").data(a).enter().append("text").attr("x",function(e){return e.xTip+r}).attr("y",function(e){return e.yTip+o}).text(function(e){return n(e)}).attr("class","tipLabel").style("font-size",l.toString()+"px").style("pointer-events","none").style("visibility",function(e){return e.visibility===f.uU?"visible":"hidden"})},e)}},ee.prototype.removeTipLabels=function(){"tipLabels"in this.groups&&this.groups.tipLabels.selectAll("*").remove()},ee.prototype.hideGrid=Z.ho,ee.prototype.addGrid=Z.yU,ee.prototype.showTemporalSlice=Z.s1,ee.prototype.hideTemporalSlice=Z.Jz;const te=ee;var ne=n(5699),re=n(97805),oe=n(86068),ie=function(e,t,n,r){var o={},i={},a=e?n.tree:n.treeToo,l=e?r.tree:r.treeToo,s=a.idxOfInViewRootNode!==l.idxOfInViewRootNode,c=n.dateMinNumeric!==r.dateMinNumeric||n.dateMaxNumeric!==r.dateMaxNumeric,u=n.filters!==r.filters;if(t.dateRange=[r.dateMinNumeric,r.dateMaxNumeric],n.focus!==r.focus&&(t.focus=r.focus,o.focusChange=!0),t.focusNodes=l.focusNodes,!l.nodeColorsVersion||a.nodeColorsVersion===l.nodeColorsVersion&&r.colorByConfidence===n.colorByConfidence||(o.changeColorBy=!0,o.branchStroke=(0,h.zY)(l,!0,r.colorByConfidence,r.colorBy),o.tipStroke=(0,h.zY)(l,!1,r.colorByConfidence,r.colorBy),o.fill=o.tipStroke.map(h.rQ),o.newMeasurementsColorGrouping=(0,oe.DM)(r.colorBy)?(0,oe.fN)(r.colorBy):void 0),l.visibilityVersion&&a.visibilityVersion!==l.visibilityVersion&&(o.changeVisibility=!0,o.visibility=l.visibility),l.tipRadiiVersion&&a.tipRadiiVersion!==l.tipRadiiVersion&&(o.changeTipRadii=!0,o.tipRadii=l.tipRadii,o.hoveredLegendSwatch=l.hoveredLegendSwatch),a.branchThicknessVersion!==l.branchThicknessVersion&&(o.changeBranchThickness=!0,o.branchThickness=l.branchThickness),n.distanceMeasure!==r.distanceMeasure&&(o.newDistance=r.distanceMeasure),n.explodeAttr!==r.explodeAttr&&(o.changeNodeOrder=!0),t.streams=r.tree.streams,t.params.showStreamTrees=r.showStreamTrees,n.showStreamTrees===r.showStreamTrees&&n.tree.streams===r.tree.streams||(o.streamDefinitionChange=!0),(n.focus!==r.focus||"selected"===n.focus&&"selected"===r.focus&&(s||c||u))&&(o.updateLayout=!0),!0===n.canRenderBranchLabels&&!1===r.canRenderBranchLabels?o.newBranchLabellingKey="none":(!1===n.canRenderBranchLabels&&!0===r.canRenderBranchLabels||n.selectedBranchLabel!==r.selectedBranchLabel||!1===n.scatterVariables.showBranches&&!0===r.scatterVariables.showBranches)&&(o.newBranchLabellingKey=r.selectedBranchLabel),n.showAllBranchLabels!==r.showAllBranchLabels&&(o.showAllBranchLabels=r.showAllBranchLabels),n.tipLabelKey!==r.tipLabelKey&&(o.newTipLabelKey=r.tipLabelKey),!0===n.temporalConfidence.display&&!1===r.temporalConfidence.display||!0===n.temporalConfidence.on&&!1===r.temporalConfidence.on?o.removeConfidences=!0:!0===r.temporalConfidence.display&&!1===n.temporalConfidence.on&&!0===r.temporalConfidence.on&&(o.showConfidences=!0),"scatter"!==r.layout&&"clock"!==r.layout||n.scatterVariables===r.scatterVariables||(o.updateLayout=!0,o.scatterVariables=r.scatterVariables),n.layout!==r.layout&&(o.newLayout=r.layout),s){var p=t.nodes[l.idxOfInViewRootNode];o.zoomIntoClade=p,"unrooted"===r.layout&&(o.updateLayout=!0)}n.width===r.width&&n.height===r.height||(o.svgHasChangedDimensions=!0),e&&n.showTreeToo!==r.showTreeToo&&(o.svgHasChangedDimensions=!0);var f=Object.keys(o).length>0;return f&&(o.animationInProgress="Pause"===r.animationPlayPauseButton,o.performanceFlags=r.performanceFlags,t.change(o)),{newState:!!Object.keys(i).length&&i,change:f}},ae=n(97195),le=n(99438),se=function(e){e.visibility===f.uU&&((1===e.that.params.orientation[0]?this.state.tree:this.state.treeToo).svg.select("#"+(0,u.ug)("tip",e.n.name)).attr("r",function(e){return e.r+4}),this.setState({hoveredNode:{node:e,isBranch:!1}}))},ce=function(e){e.visibility===f.uU&&(this.props.narrativeMode||(this.props.dispatch({type:le.S$,name:e.n.name,idx:e.n.arrayIdx,isBranch:!1,treeId:e.that.id}),this.props.dispatch((0,i.$h)("add",f.Uf,[e.n.name]))))},ue=function(e){if(e.visibility===f.uU){if(function(e){e&&T(e,(0,h._5)(e.n.parent.shell.branchStroke),(0,h._5)(e.branchStroke))}(e),this.props.temporalConfidence.exists&&this.props.temporalConfidence.display&&!this.props.temporalConfidence.on){var t=1===e.that.params.orientation[0]?this.state.tree:this.state.treeToo;"confidenceIntervals"in t.groups||(t.groups.confidenceIntervals=t.svg.append("g").attr("id","confidenceIntervals")),t.groups.confidenceIntervals.selectAll(".conf").data([e]).enter().call(function(e){return t.drawSingleCI(e,.5)})}this.setState({hoveredNode:{node:e,isBranch:!0}})}},pe=function(e){if(e.visibility===f.uU&&!this.props.narrativeMode)if(window.event instanceof PointerEvent&&window.event.shiftKey)this.props.dispatch({type:le.S$,name:e.n.name,idx:e.n.arrayIdx,isBranch:!0,treeId:e.that.id});else{var t=1===e.that.params.orientation[0],n=(0,u.bP)(e.n)===e.n.arrayIdx;if(n&&this.props.showStreamTrees){var r=this.props.tree.streams[e.n.streamName].parentStreamName;if(r){var o=this.props.tree.streams[r].startNode;return this.props.dispatch((0,i.nj)({root:[o,void 0]}))}}var a=n?(0,u.T$)(e.n,this.props.distanceMeasure,t?this.props.tree.observedMutations:this.props.treeToo.observedMutations).arrayIdx:e.n.arrayIdx,l=t?[a,void 0]:[void 0,a];this.props.dispatch((0,i.nj)({root:l}))}},fe=function(e){(function(e){e&&T(e,e.n.parent.shell.branchStroke,e.branchStroke)})(e),this.props.temporalConfidence.exists&&this.props.temporalConfidence.display&&!this.props.temporalConfidence.on&&(1===e.that.params.orientation[0]?this.state.tree:this.state.treeToo).removeConfidence(),this.setState({hoveredNode:null})},de=function(e){var t=1===e.that.params.orientation[0]?this.state.tree:this.state.treeToo;this.state.hoveredNode&&t.svg.select("#"+(0,u.ug)("tip",e.n.name)).attr("r",function(e){return e.r}),this.setState({hoveredNode:null})},he=function(e){e.isBranch||(e.existingFilterState?"inactive"===e.existingFilterState&&this.props.dispatch((0,i.$h)("inactivate",f.Uf,[e.name])):this.props.dispatch((0,i.$h)("remove",f.Uf,[e.name]))),this.props.dispatch({type:le.j_})};function me(e,t,n,r){var o,i;r?(0,m.A)(n[0]).style("stroke",(0,h._5)(e.branchStroke)):n.forEach(function(n,r){r===t?(0,m.A)(n).attr("fill",(0,h._5)(e.n.streamCategories[t].color)):(0,m.A)(n).style("opacity",.3)});var a=ve(e);"hidden"===(null===(o=a.data())||void 0===o||null===(i=o.at(0))||void 0===i?void 0:i.visibility)&&(a.attr("visibility","visible"),a.attr("font-size",16)),this.setState({hoveredNode:{node:e,isBranch:r,streamDetails:{x:ae.f0.layerX,y:ae.f0.layerY,categoryIndex:t}}})}function ye(e,t,n,r){var o,i;r?(0,m.A)(n[0]).style("stroke",e.branchStroke):n.forEach(function(n,r){r===t?(0,m.A)(n).attr("fill",e.n.streamCategories[t].color):(0,m.A)(n).style("opacity",1)});var a=ve(e);"hidden"===(null===(o=a.data())||void 0===o||null===(i=o.at(0))||void 0===i?void 0:i.visibility)&&a.attr("visibility","hidden"),this.setState({hoveredNode:null})}function ve(e){return e.that.groups.streamsLabels.select("#".concat(CSS.escape("label".concat(e.n.streamName))))}n(71595);var ge=function(e,t,n,r){var o=t?e.domRefs.mainTree:e.domRefs.secondTree,i=t?r.tree:r.treeToo;if(i.loaded){var a=r.canRenderBranchLabels;Object.prototype.hasOwnProperty.call(r.scatterVariables,"showBranches")&&!1===r.scatterVariables.showBranches&&(a=!1);var l=(0,h.zY)(i,!1,r.colorByConfidence,r.colorBy);n.render({svg:(0,m.A)(o),layout:r.layout,distance:r.distanceMeasure,focus:r.focus,parameters:{grid:!0,confidence:r.temporalConfidence.display,branchLabelKey:a&&r.selectedBranchLabel,showAllBranchLabels:r.showAllBranchLabels,orientation:t?[1,1]:[-1,1],tipLabels:!0,showTipLabels:!0,showStreamTrees:r.showStreamTrees},callbacks:{onTipHover:se.bind(e),onTipClick:ce.bind(e),onBranchHover:ue.bind(e),onBranchClick:pe.bind(e),onBranchLeave:fe.bind(e),onTipLeave:de.bind(e),onStreamHover:me.bind(e),onStreamLeave:ye.bind(e),tipLabel:M(r.tipLabelKey)},branchThickness:i.branchThickness,visibility:i.visibility,drawConfidence:r.temporalConfidence.on,vaccines:i.vaccines,branchStroke:(0,h.zY)(i,!0,r.colorByConfidence,r.colorBy),tipStroke:l,tipFill:l.map(h.rQ),tipRadii:i.tipRadii,dateRange:[r.dateMinNumeric,r.dateMaxNumeric],scatterVariables:r.scatterVariables,measurementsColorGrouping:(0,oe.DM)(r.colorBy)?(0,oe.fN)(r.colorBy):void 0,streams:r.tree.streams,focusNodes:i.focusNodes})}else console.warn("can't run renderTree (not loaded)")};function be(e){return be="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},be(e)}function we(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 Se(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?we(Object(n),!0).forEach(function(t){xe(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):we(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function xe(e,t,n){return(t=Oe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ee(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,Oe(r.key),r)}}function Oe(e){var t=function(e){if("object"!=be(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=be(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==be(t)?t:t+""}function Ce(e,t){return Ce=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ce(e,t)}function Te(e){var t=_e();return function(){var n,r=ke(e);if(t){var o=ke(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==be(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function _e(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_e=function(){return!!e})()}function ke(e){return ke=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ke(e)}const je=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ce(e,t)}(i,e);var t,n,o=Te(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=o.call(this,e)).state={left:0,top:31,lookup:void 0,drawn:!1},t.timeout=!1,t}return t=i,(n=[{key:"shouldComponentUpdate",value:function(e){return this.props.width!==e.width||this.props.height!==e.height||this.props.leftTreeName!==e.leftTreeName||this.props.rightTreeName!==e.rightTreeName}},{key:"drawLines",value:function(e){e||(e=this.props);var t=e.lookup.length>750?.25:e.lookup.length>100?.5:1;(0,m.A)(this.d3ref).selectAll("*").remove();var n=function(e){return function(t){var n=e.leftNodes[t[0]].shell,r=e.rightNodes[t[1]].shell;return"M ".concat(n.xTip,",").concat(n.yTip," H ").concat(e.width/2-e.spaceBetweenTrees/2," L ").concat(e.width/2+e.spaceBetweenTrees/2,",").concat(r.yTip," H ").concat(e.width/2+e.spaceBetweenTrees/2+r.xTip)}}(e);(0,m.A)(this.d3ref).selectAll(".tangleLine").data(e.lookup).enter().append("path").attr("class","tangleLine").attr("d",n).attr("stroke-width",t).attr("stroke",function(t){return e.colors[t[0]]}).attr("fill","none")}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){!this.state.drawn&&e.rightNodes[0].shell&&(this.drawLines(e),this.setState({drawn:!0}))}},{key:"componentDidMount",value:function(){!this.state.drawn&&this.props.rightNodes[0].shell&&(this.drawLines(this.props),this.setState({drawn:!0}))}},{key:"componentDidUpdate",value:function(e){this.props.width===e.width&&this.props.height===e.height||(this.timeout?window.clearTimeout(this.timeout):(0,m.A)(this.d3ref).selectAll(".tangleLine").remove(),this.timeout=window.setTimeout(this.drawLines.bind(this),1e3))}},{key:"render",value:function(){var e=this,t={position:"absolute",top:25,zIndex:100,fontSize:16,color:"#000",fontWeight:500},n=[this.props.width/2-this.props.spaceBetweenTrees/2,this.props.width/2+this.props.spaceBetweenTrees/2];return r.createElement("div",{id:"TangleContainer"},r.createElement("div",{id:"MainTreeTitle",style:Se(Se({},t),{},{left:n[0],transform:"translateX(-100%)"})},this.props.leftTreeName),r.createElement("div",{id:"SecondTreeTitle",style:Se(Se({},t),{},{left:n[1]})},this.props.rightTreeName),r.createElement("div",{id:"TangleSvgContainer",style:{position:"absolute",left:this.state.left,top:this.state.top,zIndex:100,pointerEvents:"none"}},r.createElement("svg",{id:"Tangle",style:{cursor:"default",width:this.props.width,height:this.props.height},ref:function(t){e.d3ref=t}})))}}])&&Ee(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Component);var Pe=n(41916),Ae=function(e,t){for(var n=0,r=0,o=0,i=0,a=0,l=0,s=0;s<t.nodes.length;s++){var c=t.nodes[s];if(!c.n.children&&e.strainToNode[c.n.name]){var u=e.strainToNode[c.n.name].displayOrder,p=c.displayOrder;n++,r+=u,o+=p,i+=Math.pow(u,2),a+=Math.pow(p,2),l+=u*p}}return i/=n,a/=n,((l/=n)-(r/=n)*(o/=n))/Math.sqrt((i-Math.pow(r,2))*(a-Math.pow(o,2)))},Ie=n(28355);function Me(e){return Me="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},Me(e)}function Re(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 Ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Re(Object(n),!0).forEach(function(t){De(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Re(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function De(e,t,n){return(t=function(e){var t=function(e){if("object"!=Me(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Me(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Me(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Le(e){if(e.narrativeMode)return null;var t="selected"===e.focus,n=e.mainTree?e.tree:e.treeToo,o=!t,a=!!n.idxOfFilteredRoot&&n.idxOfInViewRootNode!==n.idxOfFilteredRoot,l=0!==n.idxOfInViewRootNode,c={zIndex:100,position:"absolute",right:e.offsetPx,top:0},p=Ne(Ne({},s.cH),{},{zIndex:100,display:"inline-block",marginLeft:"4px"}),f=Ne(Ne({},p),{},{cursor:"pointer",color:s.KD,pointerEvents:"auto"}),d=Ne(Ne({},p),{},{cursor:"auto",color:s.i,pointerEvents:"none"});return r.createElement("div",{style:c},r.createElement("button",{style:l?f:d,onClick:function(){var t;if(0!==n.idxOfInViewRootNode){var r=n.nodes[n.idxOfInViewRootNode];t=e.mainTree&&e.showStreamTrees&&r.inStream&&n.streams[r.streamName].parentStreamName?(0,u.lF)(r).arrayIdx:(0,u.T$)(r,e.distanceMeasure,n.observedMutations).arrayIdx}e.dispatch((0,i.nj)({root:e.mainTree?[t,void 0]:[void 0,t]}))}},r.createElement(Ie.oHA,null)),o&&r.createElement("button",{style:a?f:d,onClick:function(){e.dispatch((0,i.nj)({root:e.mainTree?[n.idxOfFilteredRoot,void 0]:[void 0,n.idxOfFilteredRoot]}))}},e.t("Zoom to Selected")),r.createElement("button",{style:l?f:d,onClick:function(){var t=e.mainTree?[0,void 0]:[void 0,0];e.dispatch((0,i.nj)({root:t}))}},t?e.t("Show All Selected"):e.t("Zoom to Root")))}function Be(e){return Be="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},Be(e)}function ze(){return ze=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ze.apply(null,arguments)}function Fe(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,Ke(r.key),r)}}function We(e,t){return We=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},We(e,t)}function Ve(e){var t=Ge();return function(){var n,r=Ue(e);if(t){var o=Ue(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==Be(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return He(e)}(this,n)}}function He(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ge(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Ge=function(){return!!e})()}function Ue(e){return Ue=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ue(e)}function qe(e,t,n){return(t=Ke(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ke(e){var t=function(e){if("object"!=Be(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Be(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Be(t)?t:t+""}var $e=100,Xe="LEFT",Ye=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&We(e,t)}(s,e);var t,n,o=Ve(s);function s(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),qe(He(t=o.call(this,e)),"domRefs",void 0),qe(He(t),"tangleRef",void 0),qe(He(t),"clearSelectedNode",void 0),qe(He(t),"redrawTree",function(){t.props.dispatch((0,i.nj)({root:[0,0]}))}),t.domRefs={mainTree:null,secondTree:null},t.tangleRef=void 0,t.state={hoveredNode:null,tree:null,treeToo:null},t.clearSelectedNode=he.bind(He(t)),t}return t=s,n=[{key:"setUpAndRenderTreeToo",value:function(e,t){var n,r;t.treeToo=new te(e.treeToo.nodes,"RIGHT",e.treeToo.idxOfInViewRootNode),f.eh&&(n=t.tree,r=t.treeToo,function(e,t){for(var n=Ae(e,t),r=0;r<t.nodes.length;r++){var o=t.nodes[r],i=o.n;if(i.children){for(var a=i,l=function(){var e=a.children[0];a.children.forEach(function(t){t.shell.displayOrder<e.shell.displayOrder&&(e=t)}),a=e};a.hasChildren;)l();var s=a.shell.displayOrder-1;i.children.reverse(),(0,u.cr)(o,s);var c=Ae(e,t);n>c?(i.children.reverse(),(0,u.cr)(o,s)):n=c}}}(n,r),(0,u.PX)({nodes:r.nodes,focus:null,streams:!1})),ge(this,!1,t.treeToo,e)}},{key:"componentDidMount",value:function(){if(this.props.tree.loaded){var e={};e.tree=new te(this.props.tree.nodes,Xe,this.props.tree.idxOfInViewRootNode),ge(this,!0,e.tree,this.props),this.props.showTreeToo&&this.setUpAndRenderTreeToo(this.props,e),e.geneSortFn=(0,j.Xs)(this.props.genomeMap),this.setState(e)}}},{key:"componentDidUpdate",value:function(e){var t={},n=!1,r=ie(!0,this.state.tree,e,this.props),o=r.newState,i=r.change;o&&(t=o),e.showTreeToo!==this.props.showTreeToo?this.props.showTreeToo?(this.state.treeToo&&this.state.treeToo.clearSVG(),t.tree=this.state.tree,this.setUpAndRenderTreeToo(this.props,t),this.tangleRef&&this.tangleRef.drawLines()):t.treeToo=null:this.state.treeToo&&(n=ie(!1,this.state.treeToo,e,this.props).change),this.tangleRef&&(i||n)&&this.tangleRef.drawLines(),Object.keys(t).length&&this.setState(t)}},{key:"renderTreeDiv",value:function(e){var t=this,n=e.width,o=e.height,i=e.mainTree;return r.createElement("svg",{id:"d3treeParent",style:{pointerEvents:"auto",cursor:"default",userSelect:"none"},width:n,height:o},r.createElement("g",null,r.createElement("g",null,r.createElement("g",null,r.createElement("g",null,r.createElement("g",{id:i?"MainTree":"SecondTree",width:n,height:o,ref:function(e){i?t.domRefs.mainTree=e:t.domRefs.secondTree=e}}))))))}},{key:"render",value:function(){var e,t,n=this,o=this.props.t,i=this.props.showTreeToo?(this.props.width-$e)/2:this.props.width;return r.createElement(a.A,{center:!0,infocard:this.props.showOnlyPanels,title:o("Phylogeny"),tallTitle:!!this.props.showTreeToo},r.createElement(Pe.A,null,r.createElement(l.A,{legendPlacement:this.props.legendPlacement,width:this.props.width})),r.createElement(ne.A,{selectedNode:this.state.hoveredNode,colorBy:this.props.colorBy,colorByConfidence:this.props.colorByConfidence,colorScale:this.props.colorScale,colorings:this.props.colorings,geneSortFn:this.state.geneSortFn,observedMutations:this.props.tree.observedMutations,panelDims:{width:this.props.width,height:this.props.height,spaceBetweenTrees:$e},tipLabelKey:this.props.tipLabelKey,proteinOnly:!0===(null===(e=this.props.genomeMap)||void 0===e?void 0:e[0].proteinOnly),t:o}),r.createElement(re.Ay,{clearSelectedNode:this.clearSelectedNode,selectedNode:this.props.selectedNode,nodesLhsTree:this.props.tree.nodes,nodesRhsTree:null===(t=this.props.treeToo)||void 0===t?void 0:t.nodes,observedMutations:this.props.tree.observedMutations,colorings:this.props.colorings,geneSortFn:this.state.geneSortFn,tipLabelKey:this.props.tipLabelKey,t:o}),this.props.showTangle&&this.state.tree&&this.state.treeToo?r.createElement(je,{ref:function(e){n.tangleRef=e},width:this.props.width,height:this.props.height,lookup:this.props.treeToo.tangleTipLookup,leftNodes:this.props.tree.nodes,rightNodes:this.props.treeToo.nodes,colors:this.props.tree.nodeColors,cVersion:this.props.tree.nodeColorsVersion,vVersion:this.props.tree.visibilityVersion,metric:this.props.distanceMeasure,spaceBetweenTrees:$e,leftTreeName:this.props.tree.name,rightTreeName:this.props.showTreeToo}):null,this.renderTreeDiv({width:i,height:this.props.height,mainTree:!0}),this.props.showTreeToo?r.createElement("div",{id:"treeSpacer",style:{width:$e}}):null,this.props.showTreeToo?this.renderTreeDiv({width:i,height:this.props.height,mainTree:!1}):null,r.createElement(Le,ze({},this.props,{mainTree:!0,offsetPx:this.props.showTreeToo?i+$e+5:5})),this.props.showTreeToo&&r.createElement(Le,ze({},this.props,{mainTree:!1,offsetPx:5})))}}],n&&Fe(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),s}(r.Component);const Qe=(0,o.C)()(Ye)},34713(e,t,n){"use strict";n.d(t,{j:()=>r});var r=n(49633).wA},4379(e,t,n){"use strict";n.d(t,{I:()=>o,u:()=>r});var r=function(e,t){return t*(e-(1===t?40:100))},o=function(e){var t=e.horizontal,n=e.vertical,r=e.availableWidth,o=e.availableHeight,i=e.minHeight,a=void 0===i?void 0:i,l=e.maxAspectRatio,s=void 0===l?void 0:l,c=t*(r-(1===t?40:100)),u=n*o-52;return s&&u>s*c&&(u=s*c),a&&u<a&&(u=a),{width:c,height:u}}},41916(e,t,n){"use strict";n.d(t,{A:()=>p});var r=n(78281);function o(e){return o="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},o(e)}function i(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,a(r.key),r)}}function a(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}function s(e){var t=c();return function(){var n,r=u(e);if(t){var i=u(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"==o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}const p=function(e){!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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(c,e);var t,n,o,a=s(c);function c(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),(t=a.call(this,e)).state={hasError:!1},t}return t=c,o=[{key:"getDerivedStateFromError",value:function(){return{hasError:!0}}}],(n=[{key:"componentDidCatch",value:function(e,t){console.error(e),console.error(t)}},{key:"render",value:function(){return this.state.hasError?this.props.showNothing?null:r.createElement("h1",null,"Something went wrong."):this.props.children}}])&&i(t.prototype,n),o&&i(t,o),Object.defineProperty(t,"prototype",{writable:!1}),c}(r.Component)},90594(e,t,n){var r={"./ar/language.json":62981,"./ar/sidebar.json":58381,"./ar/translation.json":19962,"./de/language.json":50429,"./de/sidebar.json":14853,"./de/translation.json":97778,"./en/language.json":74965,"./en/sidebar.json":76189,"./en/translation.json":44362,"./es/language.json":70744,"./es/sidebar.json":13658,"./es/translation.json":76089,"./fr/language.json":86912,"./fr/sidebar.json":61218,"./fr/translation.json":9633,"./it/language.json":29675,"./it/sidebar.json":1239,"./it/translation.json":61708,"./ja/language.json":29183,"./ja/sidebar.json":93075,"./ja/translation.json":63784,"./lt/language.json":33484,"./lt/sidebar.json":8185,"./lt/translation.json":19845,"./pl/language.json":99592,"./pl/sidebar.json":69322,"./pl/translation.json":87561,"./pt/language.json":25536,"./pt/sidebar.json":57442,"./pt/translation.json":50177,"./ru/language.json":63899,"./ru/sidebar.json":64999,"./ru/translation.json":36252,"./tr/language.json":29954,"./tr/sidebar.json":50512,"./tr/translation.json":47431,"./zh/language.json":43710,"./zh/sidebar.json":41748,"./zh/translation.json":57307};function o(e){return i(e).then(e=>n.t(e,19))}function i(e){return n.e(148).then(()=>{if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]})}o.keys=()=>Object.keys(r),o.resolve=i,o.id=90594,e.exports=o},40436(e,t,n){"use strict";e.exports=n.p+"c9984902e51d6ba5445b.png"},93397(e,t,n){"use strict";e.exports=n.p+"fc937feae2803a928972.png"},68299(e,t,n){"use strict";e.exports=n.p+"1730310c32752e095ee7.svg"}}]);