@datagrok/peptides 1.23.18 → 1.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- var peptides_test;(()=>{var t={3981:(t,e,n)=>{"use strict";var i;n.d(e,{o:()=>i}),function(t){t.BASE="HELM_BASE",t.SUGAR="HELM_SUGAR",t.LINKER="HELM_LINKER",t.AA="HELM_AA",t.CHEM="HELM_CHEM",t.BLOB="HELM_BLOB",t.NUCLEOTIDE="HELM_NUCLETIDE"}(i||(i={}))},8223:(t,e,n)=>{"use strict";n.d(e,{pj:()=>g,uL:()=>p});var i,o,r,s,a,l,u,c=n(6082),d=n(4328);n(8774),function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan String",t.Onehot="One-Hot"}(i||(i={})),function(t){t.Euclidean="Euclidean",t.Manhattan="Manhattan",t.Cosine="Vector Cosine"}(o||(o={})),function(t){t.Tanimoto="Tanimoto",t.Dice="Dice",t.Asymmetric="Asymmetric",t.BraunBlanquet="Braun-Blanquet",t.Cosine="Cosine",t.Kulczynski="Kulczynski",t.McConnaughey="Mc-Connaughey",t.RogotGoldberg="Rogot-Goldberg",t.Russel="Russel",t.Sokal="Sokal",t.Hamming="Hamming",t.Euclidean="Euclidean BitArray"}(r||(r={})),function(t){t.TanimotoIntArray="TanimotoIntArray"}(s||(s={})),function(t){t.Vector="Vector",t.String="String",t.BitArray="BitArray",t.MacroMolecule="MacroMolecule",t.Number="Number",t.IntArray="IntArray",t.NumberArray="NumberArray"}(a||(a={})),function(t){t.Difference="Difference"}(l||(l={})),function(t){t.CommonItems="Common Items"}(u||(u={}));var f=n(1199);r.Tanimoto,r.Dice,r.Asymmetric,r.BraunBlanquet,r.Cosine,r.Kulczynski,r.McConnaughey,r.RogotGoldberg,r.Russel,r.Sokal,r.Hamming,r.Euclidean,r.Tanimoto,r.Dice,r.Asymmetric,r.BraunBlanquet,r.Cosine,r.Kulczynski,r.McConnaughey,r.RogotGoldberg,r.Russel,r.Sokal,r.Hamming,r.Euclidean,r.Tanimoto,r.Dice,r.Cosine,r.Tanimoto,r.Asymmetric,r.Cosine,r.Sokal,f.Z.HAMMING,f.Z.LEVENSHTEIN,f.Z.MONOMER_CHEMICAL_DISTANCE,f.Z.NEEDLEMANN_WUNSCH,new RegExp("[rd]\\((\\w)\\)p?","g");var h=n(3077),m=n(439);async function g(){const t=c.Func.find({package:"Bio",name:"getMonomerLibHelper"});if(0===t.length)throw new Error('Package "Bio" must be installed for MonomerLibHelper.');return(await t[0].prepare().call()).getOutputParamValue()}async function p(t,e,n){t instanceof c.Column&&(t=(0,h.R)(t,n).columns.toList());const i=(await g()).getMonomerLib(),o=new Array(t.length),r=t[0].length,s=new Float32Array(r);for(let n=0;n<t.length;++n){const a=n<e.length?e.getCanonical(n):m._S,l=i.getMonomer("PEPTIDE",a)?.smiles??"",u=t[n],f=u.getRawData(),h=u.categories,g=h.indexOf("");if(o[n]={categories:h,data:f,emptyIndex:g},void 0===a)continue;const p=c.Column.fromStrings("smiles",h.map((t=>i.getMonomer("PEPTIDE",t)?.smiles??""))),v=(c.DataFrame.fromColumns([p]),await d.chem.getSimilarities(p,l)),y=v?v.getRawData():null;for(let t=0;t<r;++t){const e=f[t];a!==m._S&&e!==g?s[t]+=y[e]:a===m._S&&e===g&&(s[t]+=1)}}for(let n=0;n<s.length;++n){let i=s[n]/e.length;for(let r=0;r<t.length;++r){const t=o[r];if(r>=e.length&&t.data[n]!==t.emptyIndex||t.data[n]===t.emptyIndex&&r<e.length){i=c.FLOAT_NULL;break}}s[n]=i}return c.Column.fromFloat32Array("Similarity",s)}},439:(t,e,n)=>{"use strict";n.d(e,{B5:()=>a,Hi:()=>i,YI:()=>o,_S:()=>c,b9:()=>d,gp:()=>r,ot:()=>f,q7:()=>u});var i,o,r,s=n(2738);!function(t){t.FASTA="fasta",t.SEPARATOR="separator",t.HELM="helm",t.CUSTOM="custom"}(i||(i={})),function(t){t.DNA="DNA",t.RNA="RNA",t.PT="PT",t.UN="UN"}(o||(o={})),function(t){t.aligned="aligned",t.alphabet="alphabet",t.alphabetSize=".alphabetSize",t.alphabetIsMultichar=".alphabetIsMultichar",t.separator="separator",t.isHelmCompatible=".isHelmCompatible",t.positionNames=".positionNames",t.positionLabels=".positionLabels",t.regions=".regions",t.positionShift=".positionShift",t.selectedPosition=".selectedPosition"}(r||(r={}));const a=/(?:\[([A-Za-z0-9_\-,()]+)\])|([A-Za-z\-])/g,l=new class{constructor(){this.fasta={peptide:new Set(["G","L","Y","S","E","Q","D","N","F","A","K","R","H","C","V","P","W","I","M","T"]),dna:new Set(["A","C","G","T"]),rna:new Set(["A","C","G","U"])}}},u=[new s.a(o.PT,l.fasta.peptide,.5),new s.a(o.DNA,l.fasta.dna,.55),new s.a(o.RNA,l.fasta.rna,.55)],c="",d={[i.FASTA]:"-",[i.SEPARATOR]:"",[i.HELM]:"*"},f=" , "},2003:(t,e,n)=>{"use strict";n.d(e,{Hi:()=>i.Hi,SM:()=>o.SM,YI:()=>i.YI,gp:()=>i.gp,ot:()=>i.ot,zS:()=>o.zS});var i=n(439),o=n(7194)},4025:(t,e,n)=>{"use strict";n.d(e,{j:()=>o});var i=n(6082);n(439),n(7194);const o=new class{constructor(){this.seqHandler="seq-handler",this.notationProvider="seq-handler.notation-provider"}};i.SemanticValue},2738:(t,e,n)=>{"use strict";n.d(e,{X:()=>o,a:()=>i});class i{constructor(t,e,n){this.name=t,this.alphabet=e,this.cutoff=n}}class o extends i{constructor(t,e,n){super(t.name,t.alphabet,t.cutoff),this.freq=e,this.similarity=n}}},7194:(t,e,n)=>{"use strict";n.d(e,{Mu:()=>A,zS:()=>x,SM:()=>_,qp:()=>E});var i=n(6082),o=n(144),r=n.n(o);class s extends Float32Array{}function a(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n]*t[n];return Math.sqrt(e)}var l=n(2738),u=n(439);class c{static makePalette(t,e=!1,n=c){const i={};return t.forEach((t=>{const n=t[0],o=t[1];n.forEach(((t,n)=>{i[t]=this.colourPalette[o][e?0:n]}))})),new n(i)}constructor(t){this._palette=t}get(t,e){return this._palette[t]}}c.undefinedColor="rgb(100,100,100)",c.colourPalette={orange:["rgb(255,187,120)","rgb(245,167,100)","rgb(235,137,70)","rgb(205, 111, 71)"],all_green:["rgb(44,160,44)","rgb(74,160,74)","rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)","rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],all_blue:["rgb(31,119,180)","rgb(23,190,207)","rgb(122, 102, 189)","rgb(158,218,229)","rgb(141, 124, 217)","rgb(31, 120, 150)"],magenta:["rgb(162,106,192)","rgb(197,165,224)","rgb(208,113,218)"],red:["rgb(214,39,40)","rgb(255,152,150)"],st_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(31,119,180)"],dark_blue:["rgb(31,119,180)","rgb(31, 120, 150)"],light_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(108, 218, 229)","rgb(23,190,227)"],lilac_blue:["rgb(124,102,211)","rgb(149,134,217)","rgb(97, 81, 150)"],dark_green:["rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)"],green:["rgb(44,160,44)","rgb(74,160,74)"],light_green:["rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],st_green:["rgb(44,160,44)","rgb(152,223,138)","rgb(39, 174, 96)","rgb(74,160,74)"],pink:["rgb(247,182,210)"],brown:["rgb(140,86,75)","rgb(102, 62, 54)"],gray:["rgb(127,127,127)","rgb(199,199,199)","rgb(196,156,148)","rgb(222, 222, 180)"],yellow:["rgb(188,189,34)"],white:["rgb(230,230,230)"]};class d extends c{static get Lesk(){return void 0===this.lesk&&(this.lesk=this.makePalette([[["G","A","S","T"],"orange"],[["C","V","I","L","P","F","Y","M","W"],"all_green"],[["N","Q","H"],"magenta"],[["D","E"],"red"],[["K","R"],"all_blue"]],!1,d)),this.lesk}static get GrokGroups(){return void 0===this.grokGroups&&(this.grokGroups=this.makePalette([[["C","U"],"yellow"],[["G","P"],"red"],[["A","V","I","L","M","F","Y","W"],"all_green"],[["R","H","K"],"light_blue"],[["D","E"],"dark_blue"],[["S","T","N","Q"],"orange"]],!1,d)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new d({D:"#E60A0A",E:"#E60A0A",C:"#E6E600",M:"#E6E600",K:"#145AFF",R:"#145AFF",S:"#FA9600",T:"#FA9600",F:"#3232AA",Y:"#3232AA",N:"#00DCDC",Q:"#00DCDC",G:"#EBEBEB",L:"#0F820F",V:"#0F820F",I:"#0F820F",A:"#C8C8C8",W:"#B45AB4",H:"#8282D2",P:"#DC9682",others:"#BEA06E"})),this.rasMol}get(t){const e=t in d.aaSynonyms?d.aaSynonyms[t]:t;return super.get(e)}}d.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class f{static getPalette(t="grok"){switch(t){case"grok":return d.GrokGroups;case"lesk":return d.Lesk;default:throw new Error(`ChemPalette: scheme \`${t}\` does not exist`)}}static getInnerOuter(t){let e=0,n="",i="";for(const o of t)"("==o?e++:")"==o?e--:e?n+=o:i+=o;return isNaN(parseInt(n))?[i,n]:[i,""]}static getColorAAPivot(t="",e="grok"){const n=this.getPalette(e);let[i,o]=this.getInnerOuter(t);if(i=i.length>6?`${i.slice(0,3)}...`:i,o=o.length>6?`${o.slice(0,3)}...`:o,1==t.length||"("==t[1]){const e=t[0]?.toUpperCase();return e in n?[n.get(e),e,o,1]:[this.undefinedColor,i,o,1]}if("d"==t[0]&&t[1]in n&&(2==t.length||"("==t[2])){const e=t[1]?.toUpperCase();return e in n?[n.get(e),e,o,2]:[this.undefinedColor,i,o,2]}if(t.substring(0,3)in this.AAFullNames&&(3==t.length||"("==t[3])){const e=this.AAFullNames[t.substring(0,3)];return e in n?[n.get(e),e,o,3]:[this.undefinedColor,i,o,3]}if(t[0]?.toLowerCase()==t[0]&&t.substring(1,3)in this.AAFullNames&&(4==t.length||"("==t[4])){const e=this.AAFullNames[t.substring(1,3)];return e in n?[n.get(e),e,o,4]:[this.undefinedColor,i,o,4]}return[this.undefinedColor,i,o,0]}}f.SemType="Aminoacids",f.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",f.undefinedColor="rgb(100,100,100)",f.Names={G:"Glycine",L:"Leucine",Y:"Tyrosine",S:"Serine",E:"Glutamic acid",Q:"Glutamine",D:"Aspartic acid",N:"Asparagine",F:"Phenylalanine",A:"Alanine",K:"Lysine",R:"Arginine",H:"Histidine",C:"Cysteine",V:"Valine",P:"Proline",W:"Tryptophan",I:"Isoleucine",M:"Methionine",T:"Threonine"},f.AASmiles={G:"NCC(=O)O",L:"N[C@H](CC(C)C)C(=O)O",Y:"NC(CC1=CC=C(O)C=C1)C(=O)O",S:"NC(CO)C(=O)O",E:"N[C@@H](CCC(O)=O)C(=O)O",Q:"N[C@@H](CCC(N)=O)C(=O)O",D:"N[C@@H](CC(O)=O)C(=O)O",N:"N[C@@H](CC(N)=O)C(=O)O",F:"NC(CC1=CC=CC=C1)C(=O)O",A:"N[C@H](C)C(=O)O",K:"NC(CCCCN)C(=O)O",R:"N[C@H](CCCNC(=N)C)C(=O)O",H:"NC(CC1=CN=C[N]1)C(=O)O",C:"N[C@@H](CS)C(=O)O",V:"NC(C(C)C)C(=O)O",P:"N(CCC1)C1C(=O)O",W:"N[C@@H](Cc1c2ccccc2n([H])c1)C(=O)O",I:"N[C@H]([C@H](C)CC)C(=O)O",M:"NC(CCSC)C(=O)O",T:"NC(C(O)C)C(=O)O"},f.AASmilesTruncated={G:"*C*",L:"CC(C)C[C@H](*)*",Y:"C1=CC(=CC=C1CC(*)*)O",S:"OCC(*)C*",E:"*[C@@H](CCC(O)=O)*",Q:"*N[C@@H](CCC(N)=O)*",D:"*[C@@H](CC(O)=O)*",N:"*[C@@H](CC(N)=O)*",F:"C1=CC=C(C=C1)CC(*)*",A:"C[C@H](*)*",K:"C(CCN)CC(*)*",R:"*[C@H](CCCNC(=N)C)*",H:"C1=C(NC=N1)CC(*)*",C:"C([C@@H](*)*)S",V:"CC(C)C(*)*",P:"C1CCN(*)C1*",W:"*[C@@H](Cc1c2ccccc2n([H])c1)*",I:"CC[C@H](C)[C@H](*)*",M:"CSCCC(*)*",T:"CC(O)C(*)*"},f.AAFullNames={Ala:"A",Arg:"R",Asn:"N",Asp:"D",Cys:"C",Gln:"Q",Glu:"E",Gly:"G",His:"H",Ile:"I",Leu:"L",Lys:"K",Met:"M",Phe:"F",Pro:"P",Ser:"S",Thr:"T",Trp:"W",Tyr:"Y",Val:"V"};class h extends c{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new h({A:"green",C:"blue",G:"black",T:"red",U:"red",others:"gray"})),this.chromatogram}}class m{}m.SemType="Nucleotides",m.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",m.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"};var g=n(8223);function p(t,e=!0){if(null==t)return"rgb(100,100,100)";const n=i.Color.fromHtml(t);if(e){const t=i.Color.g(n),e=i.Color.r(n),o=i.Color.b(n),r=Math.sqrt(Math.pow(0-e,2)+Math.pow(0-t,2)+Math.pow(0-o,2));if(r>210)return`rgb(${e/r*210},${t/r*210},${o/r*210})`}return i.Color.toRgb(n)}class v{static hashCode(t){let e=0;if(0===t.length)return e;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return e}}class y{}class C extends y{get(t,e){return"#666666"}}class w extends y{static get palette(){return w._pallete||(w._pallete=w.buildPalette()),w._pallete}static buildPalette(){return(0,g.pj)().then((t=>{t.awaitLoaded(1/0).then((()=>{const e=t.getMonomerLib();e.onChanged.subscribe((()=>{w.customMonomerColors={},w.polymerTypes=e.getPolymerTypes();for(const t of this.polymerTypes){const n=e.getMonomerSymbolsByType(t);for(const i of n){const n=e.getMonomer(t,i);n?.meta?.colors?.default?.background&&(this.customMonomerColors[i]||(this.customMonomerColors[i]={}),this.customMonomerColors[i][t]=p(n.meta.colors.default.background))}}}))}))})),[].concat(...Object.values(c.colourPalette))}get(t,e){const n=w.palette.length,i=w.customMonomerColors[t],o=e??"PEPTIDE";if(i&&i[o])return i[o];const r=v.hashCode(t)%n;return p(w.palette[r])}}w._pallete=null,w.customMonomerColors={},w.polymerTypes=[];class b extends c{static get Gray(){return void 0===this.gray&&(this.gray=new C),this.gray}static get Color(){return void 0===this.color&&(this.color=new w),this.color}}class A{get length(){return this.mList.length}isGap(t){return this.getOriginal(t)===this.gapOriginalMonomer}getCanonical(t){if(this.length<=t)throw new Error("Index out of bounds");const e=this.mList[t];return e!==this.gapOriginalMonomer?e:u._S}getOriginal(t){if(this.length<=t)throw new Error("Index out of bounds");return this.mList[t]}getCanonicalRegion(t,e){const n=Math.min(Math.max(0,t),this.length),i=Math.max(Math.min(this.length,e),0)-n,o=this.gapOriginalMonomer;return new Array(i).fill(null).map(((t,e)=>{const i=this.mList[e+n];return i===o?u._S:i}))}getOriginalRegion(t,e){const n=Math.min(Math.max(0,t),this.length),i=Math.max(Math.min(this.length,e),0);return new Array(i-n).fill(null).map(((t,e)=>this.mList[e+n]))}get gapOriginal(){return this.gapOriginalMonomer}constructor(t,e){this.mList=t,this.gapOriginalMonomer=e}}const S=t=>{const e=r()(t.toString().matchAll(u.B5)).map((t=>t[2]??t[1])).toArray();return new A(e,u.b9[u.Hi.FASTA])},E=t=>{const e=t.split("$")[0].split("|"),n=r()(e.map((t=>(t.match(/(?<=\{).+(?=})/)?.[0]?.split(".")??[]).map((t=>{return(e=t).startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e;var e}))))).flatten().toArray();return new A(n,u.b9[u.Hi.HELM])},T=/([^\W_]+)/g;function x(t,e){if(t.length<=e)return t;const n=t.match(T),i=t.length>e||(n?.length??0)>1,o=n?.[0]??" ";return i?o.substring(0,e-1)+"…":o}function N(t,e,n="-"){const i=e.map((e=>{const i=function(t,e,n="-"){const i=new Set([...new Set(Object.keys(t)),...e]);i.delete(n);const o=[],r=[];for(const n of i)o.push(n in t?t[n]:0),r.push(e.has(n)?1:0);const l=new s(o),u=new s(r);return function(t,e){if(t.length!=e.length)throw new Error("The dimensionality of the vectors must match");let n=0;for(let i=0;i<t.length;i++)n+=t[i]*e[i];return n}(l,u)/(a(l)*a(u))}(t,e.alphabet,n);return new l.X(e,t,i)}));let o;const r=Math.max(...i.map((t=>t.similarity>t.cutoff?t.similarity:-1)));return o=r>0?i.find((t=>t.similarity===r)).name:u.YI.UN,o}function _(t,e,n=5){let o;if(t.semType==i.SEMTYPE.MACROMOLECULE)o=e.getSeqHandler(t).alphabet;else{const e=function(t,e,n){const i=t.categories;return function(t,e){const n={};let i=!0,o=null;for(const r of t)if(null==o?o=r.length:r.length!==o&&(i=!1),r.length>=e)for(let t=0;t<r.length;++t){const e=r.getCanonical(t);e in n||(n[e]=0),n[e]+=1}return{freq:n,sameLength:i}}(r().enumerate(t.getRawData()).map((([t,e])=>n(i[t]))),e)}(t,n,S);o=N(e.freq,u.q7)}return function(t){switch(t){case u.YI.PT:return d.GrokGroups;case u.YI.DNA:case u.YI.RNA:return h.Chromatogram;default:return b.Color}}(o)}},3077:(t,e,n)=>{"use strict";n.d(e,{R:()=>o});var i=n(6082);function o(t,e){const n=t=>{const e=s.columns.addNewString((t+1).toString());return o.push(e),e},o=[],r=t.length,s=i.DataFrame.create(r),a=e.getSeqHandler(t);for(let t=0;t<r;++t){const e=a.getSplitted(t);for(let i=0;i<e.length;++i){const r=e.getCanonical(i);((o[i]??null)||n(i)).set(t,r,!1)}}return s}},4326:(t,e,n)=>{"use strict";n.d(e,{P4:()=>s,fH:()=>o});var i,o,r,s,a,l,u=n(6082);!function(t){t.tooltipWebLogo=".tooltipWebLogo"}(i||(i={})),function(t){t.Entropy="Entropy",t.full="100%"}(o||(o={})),function(t){t.TOP="top",t.MIDDLE="middle",t.BOTTOM="bottom"}(r||(r={})),function(t){t.LEFT="left",t.CENTER="center",t.RIGHT="right"}(s||(s={})),function(t){t.AUTO="auto",t.ON="on",t.OFF="off"}(a||(a={})),function(t){t.Filtered="Filtered",t.Selected="Selected"}(l||(l={})),new class{constructor(){this.sequenceColumnName=null,this.valueAggrType=u.AGG.TOTAL_COUNT,this.valueColumnName="Activity",this.startPositionName=null,this.endPositionName=null,this.skipEmptySequences=!0,this.skipEmptyPositions=!1,this.shrinkEmptyTail=!0,this.backgroundColor=4294967295,this.positionHeight=o.Entropy,this.positionWidth=20,this.verticalAlignment=r.MIDDLE,this.horizontalAlignment=s.CENTER,this.fixWidth=!1,this.fitArea=!0,this.minHeight=25,this.maxHeight=300,this.maxMonomerLetters=5,this.showPositionLabels=!0,this.positionMarginState=a.AUTO,this.positionMargin=0,this.filterSource=l.Filtered}}},5540:(t,e,n)=>{"use strict";t=n.hmd(t);var i,o=(i="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t={}){var e,n,o=void 0!==t?t:{};o.ready=new Promise((function(t,i){e=t,n=i}));var r,s=Object.assign({},o),a="object"==typeof window,l="function"==typeof importScripts,u=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(a||l)&&(l?u=self.location.href:"undefined"!=typeof document&&document.currentScript&&(u=document.currentScript.src),i&&(u=i),u=0!==u.indexOf("blob:")?u.substr(0,u.replace(/[?#].*/,"").lastIndexOf("/")+1):"",l&&(r=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)})),o.print||console.log.bind(console);var c,d,f=o.printErr||console.warn.bind(console);Object.assign(o,s),s=null,o.arguments&&o.arguments,o.thisProgram&&o.thisProgram,o.quit&&o.quit,o.wasmBinary&&(c=o.wasmBinary),o.noExitRuntime,"object"!=typeof WebAssembly&&E("no native wasm support detected");var h,m,g,p=!1;function v(){var t=d.buffer;o.HEAP8=h=new Int8Array(t),o.HEAP16=new Int16Array(t),o.HEAP32=new Int32Array(t),o.HEAPU8=m=new Uint8Array(t),o.HEAPU16=new Uint16Array(t),o.HEAPU32=g=new Uint32Array(t),o.HEAPF32=new Float32Array(t),o.HEAPF64=new Float64Array(t)}var y=[],C=[],w=[],b=0,A=null,S=null;function E(t){o.onAbort&&o.onAbort(t),f(t="Aborted("+t+")"),p=!0,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw n(e),e}var T,x;function N(t){return t.startsWith("data:application/octet-stream;base64,")}function _(t){try{if(t==T&&c)return new Uint8Array(c);if(r)return r(t);throw"both async and sync fetching of the wasm failed"}catch(t){E(t)}}function M(t,e,n){return function(t){return c||!a&&!l||"function"!=typeof fetch?Promise.resolve().then((function(){return _(t)})):fetch(t,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+t+"'";return e.arrayBuffer()})).catch((function(){return _(t)}))}(t).then((function(t){return WebAssembly.instantiate(t,e)})).then((function(t){return t})).then(n,(function(t){f("failed to asynchronously prepare wasm: "+t),E(t)}))}function O(t){for(;t.length>0;)t.shift()(o)}function I(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){g[this.ptr+4>>2]=t},this.get_type=function(){return g[this.ptr+4>>2]},this.set_destructor=function(t){g[this.ptr+8>>2]=t},this.get_destructor=function(){return g[this.ptr+8>>2]},this.set_caught=function(t){t=t?1:0,h[this.ptr+12|0]=t},this.get_caught=function(){return 0!=h[this.ptr+12|0]},this.set_rethrown=function(t){t=t?1:0,h[this.ptr+13|0]=t},this.get_rethrown=function(){return 0!=h[this.ptr+13|0]},this.init=function(t,e){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(e)},this.set_adjusted_ptr=function(t){g[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return g[this.ptr+16>>2]},this.get_exception_ptr=function(){if(H(this.get_type()))return g[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}function L(t){var e=d.buffer;try{return d.grow(t-e.byteLength+65535>>>16),v(),1}catch(t){}}function P(t){return o["_"+t]}N(T="wasmDbscan.wasm")||(x=T,T=o.locateFile?o.locateFile(x,u):u+x);var R="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function k(t,e,n,i,o){var r={string:t=>{var e=0;return null!=t&&0!==t&&(e=function(t){var e=function(t){for(var e=0,n=0;n<t.length;++n){var i=t.charCodeAt(n);i<=127?e++:i<=2047?e+=2:i>=55296&&i<=57343?(e+=4,++n):e+=3}return e}(t)+1,n=U(e);return function(t,e,n){!function(t,e,n,i){if(!(i>0))return 0;for(var o=n+i-1,r=0;r<t.length;++r){var s=t.charCodeAt(r);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&t.charCodeAt(++r)),s<=127){if(n>=o)break;e[n++]=s}else if(s<=2047){if(n+1>=o)break;e[n++]=192|s>>6,e[n++]=128|63&s}else if(s<=65535){if(n+2>=o)break;e[n++]=224|s>>12,e[n++]=128|s>>6&63,e[n++]=128|63&s}else{if(n+3>=o)break;e[n++]=240|s>>18,e[n++]=128|s>>12&63,e[n++]=128|s>>6&63,e[n++]=128|63&s}}e[n]=0}(t,m,e,n)}(t,n,e),n}(t)),e},array:t=>{var e,n,i=U(t.length);return e=t,n=i,h.set(e,n),i}},s=P(t),a=[],l=0;if(i)for(var u=0;u<i.length;u++){var c=r[n[u]];c?(0===l&&(l=F()),a[u]=c(i[u])):a[u]=i[u]}var d=s.apply(null,a);return function(t){return 0!==l&&G(l),function(t){return"string"===e?(n=t)?function(t,e,n){for(var i=e+n,o=e;t[o]&&!(o>=i);)++o;if(o-e>16&&t.buffer&&R)return R.decode(t.subarray(e,o));for(var r="";e<o;){var s=t[e++];if(128&s){var a=63&t[e++];if(192!=(224&s)){var l=63&t[e++];if((s=224==(240&s)?(15&s)<<12|a<<6|l:(7&s)<<18|a<<12|l<<6|63&t[e++])<65536)r+=String.fromCharCode(s);else{var u=s-65536;r+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else r+=String.fromCharCode((31&s)<<6|a)}else r+=String.fromCharCode(s)}return r}(m,n,i):"":"boolean"===e?Boolean(t):t;var n,i}(t)}(d)}var V,D={__cxa_throw:function(t,e,n){throw new I(t).init(e,n),t},abort:function(){E("")},emscripten_memcpy_big:function(t,e,n){m.copyWithin(t,e,e+n)},emscripten_resize_heap:function(t){var e,n=m.length,i=2147483648;if((t>>>=0)>i)return!1;for(var o=1;o<=4;o*=2){var r=n*(1+.2/o);if(r=Math.min(r,t+100663296),L(Math.min(i,(e=Math.max(t,r))+(65536-e%65536)%65536)))return!0}return!1}},F=(function(){var t,e,i,r,s={env:D,wasi_snapshot_preview1:D};function a(t,e){var n,i=t.exports;return o.asm=i,d=o.asm.memory,v(),o.asm.__indirect_function_table,n=o.asm.__wasm_call_ctors,C.unshift(n),function(t){if(b--,o.monitorRunDependencies&&o.monitorRunDependencies(b),0==b&&(null!==A&&(clearInterval(A),A=null),S)){var e=S;S=null,e()}}(),i}if(b++,o.monitorRunDependencies&&o.monitorRunDependencies(b),o.instantiateWasm)try{return o.instantiateWasm(s,a)}catch(t){f("Module.instantiateWasm callback failed with error: "+t),n(t)}(t=c,e=T,i=s,r=function(t){a(t.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||N(e)||"function"!=typeof fetch?M(e,i,r):fetch(e,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,i).then(r,(function(t){return f("wasm streaming compile failed: "+t),f("falling back to ArrayBuffer instantiation"),M(e,i,r)}))}))).catch(n)}(),o._dbscan=function(){return(o._dbscan=o.asm.dbscan).apply(null,arguments)},o._malloc=function(){return(o._malloc=o.asm.malloc).apply(null,arguments)},o._free=function(){return(o._free=o.asm.free).apply(null,arguments)},function(){return(F=o.asm.stackSave).apply(null,arguments)}),G=function(){return(G=o.asm.stackRestore).apply(null,arguments)},U=function(){return(U=o.asm.stackAlloc).apply(null,arguments)},H=function(){return(H=o.asm.__cxa_is_pointer_type).apply(null,arguments)};function q(){function t(){V||(V=!0,o.calledRun=!0,p||(O(C),e(o),o.onRuntimeInitialized&&o.onRuntimeInitialized(),function(){if(o.postRun)for("function"==typeof o.postRun&&(o.postRun=[o.postRun]);o.postRun.length;)t=o.postRun.shift(),w.unshift(t);var t;O(w)}()))}b>0||(function(){if(o.preRun)for("function"==typeof o.preRun&&(o.preRun=[o.preRun]);o.preRun.length;)t=o.preRun.shift(),y.unshift(t);var t;O(y)}(),b>0||(o.setStatus?(o.setStatus("Running..."),setTimeout((function(){setTimeout((function(){o.setStatus("")}),1),t()}),1)):t()))}if(o.ccall=k,o.cwrap=function(t,e,n,i){var o=!n||n.every((t=>"number"===t||"boolean"===t));return"string"!==e&&o&&!i?P(t):function(){return k(t,e,n,arguments)}},S=function t(){V||q(),V||(S=t)},o.preInit)for("function"==typeof o.preInit&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();return q(),t.ready});"object"==typeof exports?t.exports=o:"function"==typeof define&&n.amdO?define([],(function(){return o})):"object"==typeof exports&&(exports.exportCppDbscanLib=o)},4329:(t,e,n)=>{"use strict";n.d(e,{_:()=>r});var i=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};let o=null;function r(){return i(this,void 0,void 0,(function*(){if(!navigator.gpu)return console.error("WebGPU is not supported in this browser"),null;if(!o&&(o=yield navigator.gpu.requestAdapter(),null==o))return null;let t=null;return"info"in o&&(t=o.info),t?s(t.description,s(t.vendor,"No GPU description available")):"No GPU description available"}))}function s(t,e){return t&&""!=t?t:e}},1199:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});new Uint32Array(65536);var i;!function(t){t.HAMMING="Hamming",t.LEVENSHTEIN="Levenshtein",t.NEEDLEMANN_WUNSCH="Needlemann-Wunsch",t.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance"}(i||(i={})),i.HAMMING,i.LEVENSHTEIN,i.NEEDLEMANN_WUNSCH,i.MONOMER_CHEMICAL_DISTANCE},8774:(t,e,n)=>{"use strict";n.d(e,{A:()=>i});class i{constructor(t,e=!1){if(this._length=0,this._version=0,this._updateLevel=0,this._selectedCount=0,this._selectedCountVersion=-1,this._selectedIndexesVersion=-1,this._versionedName="",this._versionedNameVersion=-1,this.SHRINK_THRESHOLD=256,"number"==typeof t){const n=t,o=i._createBuffer(n);if(e)for(let t=0;t<o.length;t++)o[t]=-1;this._data=o,this._length=n}else{if(!(t instanceof Uint32Array))throw new Error("Invalid constructor");this._data=t,this._length=e}}getRawData(){return this._data}assureGoez(t,e){if(t<0)throw new Error(`${e} should be greater than zero`)}assureInRange(t,e,n,i){if(t<e||t>n)throw new Error(`Argument ${i} (${t}) out of range (${e}, ${n})`)}copy(t,e,n){for(let i=0;i<n;i++)e[i]=t[i]}copyFrom(t){if(this._length!=t._length)throw new Error(`Lengths differ (${this._length} != ${t._length})`);this.copy(t._data,this._data,this.lengthInInts),this._version++}get length(){return this._length}get buffer(){return this._data}set buffer(t){this._data=t,this._version++}get version(){return this._version}set version(t){this._version=t}incrementVersion(t=!0){this._version++}get lengthInInts(){return Math.floor((this._length+31)/32)}get versionedName(){return this._version==this._versionedNameVersion?this._versionedName:""}set versionedName(t){this._versionedName=t,this._versionedNameVersion=this._version}get self(){return this}setLength(t){if(t<0)throw new Error("should be >= 0");if(t==this._length)return;const e=Math.floor((t+31)/32);if(e>this._data.length||e+this.SHRINK_THRESHOLD<this._data.length){const t=new Uint32Array(e);this.copy(this._data,t,e>this._data.length?this._data.length:e),this._data=t}t>this._length&&(this._length%32>0&&(this._data[this.lengthInInts-1]&=(1<<(this._length%32&31))-1),this._data.fill(0,this.lengthInInts,e)),this._length=t,this._version++}static fromAnd(t,e){if(t._length!=e._length)throw new Error(`Lengths differ (${t._length} != ${e._length})`);const n=new i(t._length);n._length=t._length,n._data=i._createBuffer(n._length),n._version=0;const o=t.lengthInInts;for(let i=0;i<o;i++)n._data[i]=t._data[i]&e._data[i];return n}static _createBuffer(t){return new Uint32Array(Math.floor((t+31)/32))}static fromValues(t){const e=new i(t.length);e._version=0;for(let n=0;n<e._length;n++)t[n]&&(e._data[Math.floor(n/32)]|=1<<(n%32&31));return e}static fromSeq(t,e){const n=new i(t);for(let i=0;i<t;++i)n.setBit(i,e(i));return n._version=0,n}static fromString(t){return i.fromSeq(t.length,(e=>"1"==t.charAt(e)))}static fromUint32Array(t,e){const n=new i(t);return n._data=e,n}static fromBytes(t){const e=t.length,n=new i(8*e);n._data=new Uint32Array(Math.floor((e+3)/4)),n._length=8*e;let o=0,r=0;for(;e-r>=4;)n._data[o++]=255&t[r]|(255&t[r+1])<<8|(255&t[r+2])<<16|(255&t[r+3])<<24,r+=4;return e-r==3&&(n._data[o]=(255&t[r+2])<<16),e-r==2&&(n._data[o]|=(255&t[r+1])<<8),e-r==1&&(n._data[o]|=255&t[r]),n._version=0,n}toString(){return`${this._length} bits, ${this.countBits(!0)} set`}equals(t){if(this==t)return!0;if(null==t)return!1;if(this._length!=t._length)return!1;if(0==this._length)return!0;for(let e=0;e<this._data.length-1;e++)if(this._data[e]!=t._data[e])return!1;for(let e=8*(this._data.length-1);e<this._length;e++)if(this.getBit(e)!=t.getBit(e))return!1;return!0}clone(){const t=new i(0,!1);return t._data=Uint32Array.from(this._data),t._length=this._length,t._version=this._version,t}init(t,e){this.setAll(!1,!1);for(let e=0;e<this._length;e++)t(e)&&(this._data[Math.floor(e/32)]|=1<<(e%32&31));return this.incrementVersion(e),this}invert(t=!0){for(let t=0;t<this._data.length;t++)this._data[t]^=-1;this.incrementVersion(t)}setAll(t,e=!1){const n=t?-1:0,i=this.lengthInInts;for(let t=0;t<i;t++)this._data[t]=n;this.incrementVersion(e)}setIndexes(t,e=!0,n=!0,i=!0){n&&this.setAll(!e,!1);for(const n of t)this.setFast(n,e);this.incrementVersion(i)}everyIndex(t,e=!0){for(const n of t)if(this.getBit(n)!=e)return!1;return!0}anyIndex(t,e=!0){for(const n of t)if(this.getBit(n)==e)return!0;return!1}setWhere(t,e=!0,n=!0,i=!0,o=!0){if(n&&o&&this.setAll(!e,!1),o)for(let n=0;n<this._length;n++)t(n)&&this.setFast(n,e);else for(let n=0;n<this._length;n++)this.setFast(n,t(n)?e:!e);this.incrementVersion(i)}getRange(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let i=t;i<e;++i)n.push(this.getBit(i));return i.fromValues(n)}getRangeAsList(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let i=t;i<e;++i)n.push(this.getBit(i));return n}setRange(t,e,n,i=!0){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length-1,"to");const o=Math.min(t,e),r=Math.max(t,e);if(n)for(let t=o;t<=r;t++)this.setTrue(t);else for(let t=o;t<=r;t++)this.setFalse(t);return this.incrementVersion(i),this}setRandom(t,e,n=!0){if(t<0||t>this._length)throw new Error("n must be >= 0 && <= Count");t>this._length/2&&this.setRandom(this._length-t,!e),this.setAll(!e);for(let n=0;n<t;){const t=Math.floor(Math.random()*this._length);this.getBit(t)!=e&&(this.setFast(t,e),n++)}this.incrementVersion(n)}and(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]&=t._data[e];return this.incrementVersion(e),this}andNot(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");const n=this.lengthInInts;for(let e=0;e<n;e++)this._data[e]&=~t._data[e];return this.incrementVersion(e),this}notAnd(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]=~this._data[e]&t._data[e];return this.incrementVersion(e),this}not(t=!0){for(let t=0,e=this.lengthInInts;t<e;t++)this._data[t]=~this._data[t];return this.incrementVersion(t),this}or(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]|=t._data[e];return this.incrementVersion(e),this}xor(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]^=t._data[e];return this.incrementVersion(e),this}insertAt(t,e,n=!1){if(this.assureInRange(t,0,this._length,"pos"),0==e)return;const i=this._length;this.setLength(this._length+e);for(let n=i-1;n>=t;n--)this.setBit(n+e,this.getBit(n));for(let i=t;i<t+e;i++)this.setBit(i,n)}removeAt(t,e=1){if(e<0)throw new Error("n cannot be negative");if(this.assureInRange(t,0,this._length-e,"pos"),this.contains(!0))for(let n=t;n<this._length-e;n++)this.setBit(n,this.getBit(n+e));this.setLength(this._length-e)}removeByMask(t,e=!0){if(this._length!=t.length)throw new Error("length != mask.length");if(t==this)this.setLength(t.countBits(!e)),this.setAll(!e);else{let n=0;for(let i=-1;-1!=(i=t.findNext(i,!e));)this.setFast(n++,this.getBit(i));this._length=n,this._version++}return this}getBit(t){return!!(this._data[Math.floor(t/32)]&1<<(31&t))}setBit(t,e,n=!0){this.setFast(t,e),this._version++}setFast(t,e){e?this._data[Math.floor(t/32)]|=1<<(31&t):this._data[Math.floor(t/32)]&=~(1<<(31&t))}setTrue(t){this._data[Math.floor(t/32)]|=1<<(31&t)}setFalse(t){this._data[Math.floor(t/32)]&=~(1<<(31&t))}trueCount(){return this.countBits(!0)}falseCount(){return this.countBits(!1)}countBits(t){if(0==this._length)return 0;if(this._selectedCountVersion!=this._version){this._selectedCount=0;const t=this.lengthInInts;let e=0;for(;e<t-1;e++)for(let t=this._data[e];0!=t;t>>>=8)this._selectedCount+=i._onBitCount[255&t];let n=this._data[e];const o=31&this._length;for(0!=o&&(n&=~(4294967295<<o));0!=n;n>>>=8)this._selectedCount+=i._onBitCount[255&n];this._selectedCountVersion=this._version}return t?this._selectedCount:this._length-this._selectedCount}countWhere(t){let e=0;if(this.trueCount()==this._length)for(let n=0;n<this._length;n++)e+=t(n)?1:0;else for(let n=-1;-1!=(n=this.findNext(n,!0));)e+=t(n)?1:0;return e}andWithCountBits(t,e){if(0==this._length)return 0;let n=0;const o=this.lengthInInts;let r=0;for(;r<o-1;r++)for(let e=this._data[r]&t._data[r];0!=e;e>>>=8)n+=i._onBitCount[255&e];let s=this._data[r]&t._data[r];const a=31&this._length;for(0!=a&&(s&=~(4294967295<<a));0!=s;s>>>=8)n+=i._onBitCount[255&s];return e?n:this._length-n}clear(){this.setLength(0)}contains(t){return this.findNext(-1,t)>=0}get allTrue(){return this.countBits(!0)==this._length}get allFalse(){return this.countBits(!1)==this._length}get anyTrue(){return this.countBits(!0)>0}get anyFalse(){return this.countBits(!1)>0}findNext(t,e=!0){if(this.assureInRange(t,-1,this._length,"index"),t>=this._length-1)return-1;let n=31&(t=t<0?0:t+1);const o=this.lengthInInts;for(let r=Math.floor(t/32);r<o;r++){let o=e?this._data[r]:~this._data[r];if(0!=n)o&=4294967295<<n&4294967295,n=0;else if(!e&&-4294967296==o)continue;for(let e=0;0!=o;e+=8,o>>>=8){const n=i._firstOnBit[255&o];if(n>=0)return(t=n+32*r+e)>=this._length?-1:t}}return-1}findPrev(t,e=!0){if(0==t)return-1;this.assureInRange(t,-1,this._length,"index");let n=1+(t=t<0?this._length-1:t-1)&31;for(let o=Math.floor(t/32);o>=0;o--){let t=e?this._data[o]:~this._data[o];0!=n&&(t&=~(4294967295<<n),n=0);for(let e=24;0!=t;e-=8,t<<=8){const n=i._lastOnBit[t>>>24];if(n>=0)return n+32*o+e}}return-1}}i._onBitCount=Int8Array.from([0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8]),i._firstOnBit=Int8Array.from([-1,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0]),i._lastOnBit=Int8Array.from([-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7])},8070:(t,e,n)=>{"use strict";n.d(e,{Pl:()=>V,bk:()=>$,gM:()=>k,L1:()=>R,cb:()=>Y,E3:()=>L,Wj:()=>P,Xb:()=>F,N$:()=>G,t6:()=>I,PE:()=>M,rd:()=>O,Bl:()=>z,CN:()=>C});var i=n(4328),o=n(6082);n(9982);const r=o.DataFrame.fromCsv('countries,fasta,smiles,molregno,LON,Zip Code,Street Address Line 1,ImageUrl,user_id,error_message,xray,flag,magnitude,CS-id,pdb_id,accel_a,time_offset,chart,fit,Questions,empty_number,empty_string\nBelgium,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C(=O)OCCCc1cccnc1)c2cccc(c2)C(=O)c3ccccc3,1480014,36.276729583740234,995042300,14016 ROUTE 31W,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,1,1,1QBS,1,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.497360340644872, 1.7058694986686864, 5.278052678195135, 0.16000320889028383],""points"":[{""x"":0.10000000149011612,""y"":2.374499797821045},{""x"":0.6000000238418579,""y"":2.6242473125457764},{""x"":1.100000023841858,""y"":2.367267608642578},{""x"":1.600000023841858,""y"":2.6723148822784424},{""x"":2.0999999046325684,""y"":2.6537344455718994},{""x"":2.5999999046325684,""y"":2.3651671409606934},{""x"":3.0999999046325684,""y"":2.5654284954071045},{""x"":3.5999999046325684,""y"":2.4160959720611572},{""x"":4.099999904632568,""y"":2.286726713180542},{""x"":4.599999904632568,""y"":2.5100042819976807},{""x"":5.099999904632568,""y"":1.6676985025405884},{""x"":5.599999904632568,""y"":0.680136501789093},{""x"":6.099999904632568,""y"":0.3391543924808502},{""x"":6.599999904632568,""y"":0.09038983285427094},{""x"":7.099999904632568,""y"":0.19802775979042053}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[7.525235855508179, 1.3186911876809984, 5.335672608564294, 0.7860743343958098],""points"":[{""x"":0.10000000149011612,""y"":7.988070487976074},{""x"":0.6000000238418579,""y"":7.018453121185303},{""x"":1.100000023841858,""y"":8.115279197692871},{""x"":1.600000023841858,""y"":7.486658096313477},{""x"":2.0999999046325684,""y"":7.396438121795654},{""x"":2.5999999046325684,""y"":7.477052211761475},{""x"":3.0999999046325684,""y"":6.913095474243164},{""x"":3.5999999046325684,""y"":8.01385498046875},{""x"":4.099999904632568,""y"":6.985900402069092},{""x"":4.599999904632568,""y"":6.970335960388184},{""x"":5.099999904632568,""y"":5.448817253112793},{""x"":5.599999904632568,""y"":2.5534818172454834},{""x"":6.099999904632568,""y"":1.893947958946228},{""x"":6.599999904632568,""y"":0.6340042352676392},{""x"":7.099999904632568,""y"":0.8403874039649963}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,100,abc\nBurundi,MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW,COc1ccc2cc(ccc2c1)C(C)C(=O)Oc3ccc(C)cc3OC,1480015,36.276729583740234,995073444,80 STATE HIGHWAY 310,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,2,2,1ZP8,2,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.431460753103398, 2.1691498799246745, 5.266445597102774, 0.7825762827017926],""points"":[{""x"":0.10000000149011612,""y"":4.751083850860596},{""x"":0.6000000238418579,""y"":4.203000068664551},{""x"":1.100000023841858,""y"":4.415858745574951},{""x"":1.600000023841858,""y"":4.68414306640625},{""x"":2.0999999046325684,""y"":4.198400974273682},{""x"":2.5999999046325684,""y"":4.179222106933594},{""x"":3.0999999046325684,""y"":4.638473987579346},{""x"":3.5999999046325684,""y"":4.708553314208984},{""x"":4.099999904632568,""y"":4.291589260101318},{""x"":4.599999904632568,""y"":4.038082599639893},{""x"":5.099999904632568,""y"":3.4349939823150635},{""x"":5.599999904632568,""y"":1.2194708585739136},{""x"":6.099999904632568,""y"":1.1920831203460693},{""x"":6.599999904632568,""y"":0.5352635979652405},{""x"":7.099999904632568,""y"":0.3346920311450958}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.339458017970126, -1.0734184310171178, 4.746332950550934, 0.2482416857595658],""points"":[{""x"":0.10000000149011612,""y"":0.2139337658882141},{""x"":0.6000000238418579,""y"":0.4269562065601349},{""x"":1.100000023841858,""y"":0.2441573292016983},{""x"":1.600000023841858,""y"":0.146635964512825},{""x"":2.0999999046325684,""y"":0.08818462491035461},{""x"":2.5999999046325684,""y"":0.2560656666755676},{""x"":3.0999999046325684,""y"":0.42434045672416687},{""x"":3.5999999046325684,""y"":0.37111231684684753},{""x"":4.099999904632568,""y"":0.5581737160682678},{""x"":4.599999904632568,""y"":1.183590054512024},{""x"":5.099999904632568,""y"":1.5629843473434448},{""x"":5.599999904632568,""y"":2.3211288452148438},{""x"":6.099999904632568,""y"":2.229961633682251},{""x"":6.599999904632568,""y"":2.2560226917266846},{""x"":7.099999904632568,""y"":2.2142398357391357}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCameroon,MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL,COc1ccc2cc(ccc2c1)C(C)C(=O)OCCCc3cccnc3,1480016,36.26095962524414,995153596,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,3,3,2BDJ,3,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.6760652578642325, 0.9046956320756703, 5.651408971856738, 0.07738846012184185],""points"":[{""x"":0.10000000149011612,""y"":4.32425594329834},{""x"":0.6000000238418579,""y"":4.668442249298096},{""x"":1.100000023841858,""y"":4.379785060882568},{""x"":1.600000023841858,""y"":5.0345139503479},{""x"":2.0999999046325684,""y"":4.878653526306152},{""x"":2.5999999046325684,""y"":4.3451313972473145},{""x"":3.0999999046325684,""y"":4.336992263793945},{""x"":3.5999999046325684,""y"":5.037430286407471},{""x"":4.099999904632568,""y"":5.0092692375183105},{""x"":4.599999904632568,""y"":4.151902675628662},{""x"":5.099999904632568,""y"":3.4066951274871826},{""x"":5.599999904632568,""y"":2.3732759952545166},{""x"":6.099999904632568,""y"":1.673728108406067},{""x"":6.599999904632568,""y"":0.48574790358543396},{""x"":7.099999904632568,""y"":0.2783052325248718}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.938395863010111, -1.4658480661392117, 5.462702751996584, 0.3473139023615039],""points"":[{""x"":0.10000000149011612,""y"":0.4941710829734802},{""x"":0.6000000238418579,""y"":0.15323974192142487},{""x"":1.100000023841858,""y"":0.46373432874679565},{""x"":1.600000023841858,""y"":0.3370431363582611},{""x"":2.0999999046325684,""y"":0.5179030299186707},{""x"":2.5999999046325684,""y"":0.27899765968322754},{""x"":3.0999999046325684,""y"":0.22075064480304718},{""x"":3.5999999046325684,""y"":0.5789918899536133},{""x"":4.099999904632568,""y"":0.21169911324977875},{""x"":4.599999904632568,""y"":0.27857646346092224},{""x"":5.099999904632568,""y"":1.0906332731246948},{""x"":5.599999904632568,""y"":1.8520300388336182},{""x"":6.099999904632568,""y"":2.7177059650421143},{""x"":6.599999904632568,""y"":2.8680918216705322},{""x"":7.099999904632568,""y"":3.2413077354431152}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCanada,MMELVLKTIIGPIVVGVVLRIVDKWLNKDK,CC(C(=O)NCCS)c1cccc(c1)C(=O)c2ccccc2,1480017,36.26095962524414,99515,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,4,4,1IAN,4,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[0.8597390975430008, 1.0957625732481946, 5.260537067987958, 0.07974187998177736],""points"":[{""x"":0.10000000149011612,""y"":0.8190152645111084},{""x"":0.6000000238418579,""y"":0.8421689867973328},{""x"":1.100000023841858,""y"":0.8740922212600708},{""x"":1.600000023841858,""y"":0.8924275040626526},{""x"":2.0999999046325684,""y"":0.8249067664146423},{""x"":2.5999999046325684,""y"":0.9327669143676758},{""x"":3.0999999046325684,""y"":0.8522974252700806},{""x"":3.5999999046325684,""y"":0.8174492716789246},{""x"":4.099999904632568,""y"":0.8394647240638733},{""x"":4.599999904632568,""y"":0.7139387726783752},{""x"":5.099999904632568,""y"":0.5561167597770691},{""x"":5.599999904632568,""y"":0.3276226818561554},{""x"":6.099999904632568,""y"":0.12479474395513535},{""x"":6.599999904632568,""y"":0.13006797432899475},{""x"":7.099999904632568,""y"":0.059702079743146896}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.760930219582546, 1.6591793293833013, 4.667155929720851, 0.7858109544121652],""points"":[{""x"":0.10000000149011612,""y"":6.156993389129639},{""x"":0.6000000238418579,""y"":5.236701965332031},{""x"":1.100000023841858,""y"":6.010560512542725},{""x"":1.600000023841858,""y"":5.495512962341309},{""x"":2.0999999046325684,""y"":6.087770462036133},{""x"":2.5999999046325684,""y"":5.79986572265625},{""x"":3.0999999046325684,""y"":5.597546577453613},{""x"":3.5999999046325684,""y"":5.520902156829834},{""x"":4.099999904632568,""y"":5.360654354095459},{""x"":4.599999904632568,""y"":3.5539746284484863},{""x"":5.099999904632568,""y"":1.577236294746399},{""x"":5.599999904632568,""y"":1.0001264810562134},{""x"":6.099999904632568,""y"":0.9305797815322876},{""x"":6.599999904632568,""y"":0.6033638715744019},{""x"":7.099999904632568,""y"":0.4203685522079468}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nColombia,MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN,FC(F)(F)c1ccc(OC2CCNCC2)cc1,1480029,36.3309440612793,995152050,1 COURT HOUSE SQUARE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,5,5,4UJ1,5,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[6.4995088314153655, 2.4270351004539914, 5.178659535348579, 0.625653346241577],""points"":[{""x"":0.10000000149011612,""y"":6.496231555938721},{""x"":0.6000000238418579,""y"":6.42543363571167},{""x"":1.100000023841858,""y"":7.040063858032227},{""x"":1.600000023841858,""y"":6.1115403175354},{""x"":2.0999999046325684,""y"":6.680728435516357},{""x"":2.5999999046325684,""y"":6.406774520874023},{""x"":3.0999999046325684,""y"":6.611269474029541},{""x"":3.5999999046325684,""y"":5.889094352722168},{""x"":4.099999904632568,""y"":6.75344705581665},{""x"":4.599999904632568,""y"":6.361435890197754},{""x"":5.099999904632568,""y"":4.1666975021362305},{""x"":5.599999904632568,""y"":1.172118902206421},{""x"":6.099999904632568,""y"":0.801048994064331},{""x"":6.599999904632568,""y"":0.4640021026134491},{""x"":7.099999904632568,""y"":0.0010357667924836278}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[1.4734381347446401, 1.1649805188074196, 4.82958608866421, 0.09500545496710007],""points"":[{""x"":0.10000000149011612,""y"":1.5279096364974976},{""x"":0.6000000238418579,""y"":1.3559974431991577},{""x"":1.100000023841858,""y"":1.5246378183364868},{""x"":1.600000023841858,""y"":1.5567657947540283},{""x"":2.0999999046325684,""y"":1.4114240407943726},{""x"":2.5999999046325684,""y"":1.4045010805130005},{""x"":3.0999999046325684,""y"":1.4769829511642456},{""x"":3.5999999046325684,""y"":1.4875500202178955},{""x"":4.099999904632568,""y"":1.2991987466812134},{""x"":4.599999904632568,""y"":0.922961413860321},{""x"":5.099999904632568,""y"":0.6520044803619385},{""x"":5.599999904632568,""y"":0.15350978076457977},{""x"":6.099999904632568,""y"":0.1078903079032898},{""x"":6.599999904632568,""y"":0.17276449501514435},{""x"":7.099999904632568,""y"":0.14066608250141144}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCosta Rica,MKSTKEEIQTIKTLLKDSRTAKYHKRLQIVL,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCCc3ccccc3,1480018,36.3309440612793,995084218,4041 SOUTHWESTERN BLVD,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,6,6,2BPW,6,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.4833641843311227, -1.8945978742090062, 4.671127708092568, 0.24159861311815153],""points"":[{""x"":0.10000000149011612,""y"":0.0969524160027504},{""x"":0.6000000238418579,""y"":0.028483040630817413},{""x"":1.100000023841858,""y"":0.22087176144123077},{""x"":1.600000023841858,""y"":0.0068915546871721745},{""x"":2.0999999046325684,""y"":0.4305879771709442},{""x"":2.5999999046325684,""y"":0.44774115085601807},{""x"":3.0999999046325684,""y"":0.45346319675445557},{""x"":3.5999999046325684,""y"":0.2370593100786209},{""x"":4.099999904632568,""y"":0.4657953977584839},{""x"":4.599999904632568,""y"":1.155200719833374},{""x"":5.099999904632568,""y"":2.2294070720672607},{""x"":5.599999904632568,""y"":2.4311530590057373},{""x"":6.099999904632568,""y"":2.33846116065979},{""x"":6.599999904632568,""y"":2.608201026916504},{""x"":7.099999904632568,""y"":2.8136143684387207}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.224573521642033, 1.4454033924198528, 5.6014197746076535, 0.2823216054197577],""points"":[{""x"":0.10000000149011612,""y"":4.95027494430542},{""x"":0.6000000238418579,""y"":5.1754679679870605},{""x"":1.100000023841858,""y"":5.276752948760986},{""x"":1.600000023841858,""y"":5.589294910430908},{""x"":2.0999999046325684,""y"":5.616994857788086},{""x"":2.5999999046325684,""y"":5.120813846588135},{""x"":3.0999999046325684,""y"":5.340766906738281},{""x"":3.5999999046325684,""y"":4.876471042633057},{""x"":4.099999904632568,""y"":4.94999361038208},{""x"":4.599999904632568,""y"":5.162564754486084},{""x"":5.099999904632568,""y"":4.399557590484619},{""x"":5.599999904632568,""y"":2.7977969646453857},{""x"":6.099999904632568,""y"":1.0229872465133667},{""x"":6.599999904632568,""y"":0.48275601863861084},{""x"":7.099999904632568,""y"":0.10408931970596313}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCuba,MHAILRYFIRRLFYHIFYKIYSLISKKHQSLPSDVRQF,COc1ccc2c(c1)c(CC(=O)N3CCCC3C(=O)Oc4ccc(C)cc4OC)c(C)n2C(=O)c5ccc(Cl)cc5,1480019,36.33115768432617,995081928,1227 US HIGHWAY 11,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,7,7,1QBS,7,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.320838679713925, -1.2421619987316728, 4.831325425225256, 0.3236011098403072],""points"":[{""x"":0.10000000149011612,""y"":0.3727470338344574},{""x"":0.6000000238418579,""y"":0.12365014106035233},{""x"":1.100000023841858,""y"":0.48422467708587646},{""x"":1.600000023841858,""y"":0.2264465093612671},{""x"":2.0999999046325684,""y"":0.16821794211864471},{""x"":2.5999999046325684,""y"":0.3879014551639557},{""x"":3.0999999046325684,""y"":0.5470244884490967},{""x"":3.5999999046325684,""y"":0.3419053554534912},{""x"":4.099999904632568,""y"":0.7655120491981506},{""x"":4.599999904632568,""y"":1.2346516847610474},{""x"":5.099999904632568,""y"":2.453336715698242},{""x"":5.599999904632568,""y"":2.9565491676330566},{""x"":6.099999904632568,""y"":3.335299491882324},{""x"":6.599999904632568,""y"":3.240290880203247},{""x"":7.099999904632568,""y"":3.1107218265533447}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.6401853521511094, 1.26211588875013, 5.399028074402744, 0.5089580830068091],""points"":[{""x"":0.10000000149011612,""y"":3.8585598468780518},{""x"":0.6000000238418579,""y"":3.6077206134796143},{""x"":1.100000023841858,""y"":3.855252265930176},{""x"":1.600000023841858,""y"":3.619039297103882},{""x"":2.0999999046325684,""y"":3.839388370513916},{""x"":2.5999999046325684,""y"":3.335283041000366},{""x"":3.0999999046325684,""y"":3.571141481399536},{""x"":3.5999999046325684,""y"":3.4155046939849854},{""x"":4.099999904632568,""y"":3.7316646575927734},{""x"":4.599999904632568,""y"":3.0680155754089355},{""x"":5.099999904632568,""y"":2.891066551208496},{""x"":5.599999904632568,""y"":1.6022753715515137},{""x"":6.099999904632568,""y"":0.7652576565742493},{""x"":6.599999904632568,""y"":0.6875326037406921},{""x"":7.099999904632568,""y"":0.5828871726989746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nItaly,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO[N+](=O)[O-],1480020,36.33115768432617,99502,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,8,8,1ZP8,8,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.293592105923809, 1.3781586549141835, 5.1025898038676605, 0.03493851245291291],""points"":[{""x"":0.10000000149011612,""y"":2.1287283897399902},{""x"":0.6000000238418579,""y"":2.267972230911255},{""x"":1.100000023841858,""y"":2.398442506790161},{""x"":1.600000023841858,""y"":2.5130622386932373},{""x"":2.0999999046325684,""y"":2.3255116939544678},{""x"":2.5999999046325684,""y"":2.127340793609619},{""x"":3.0999999046325684,""y"":2.47259783744812},{""x"":3.5999999046325684,""y"":2.131181478500366},{""x"":4.099999904632568,""y"":2.090421438217163},{""x"":4.599999904632568,""y"":2.02299165725708},{""x"":5.099999904632568,""y"":1.1105059385299683},{""x"":5.599999904632568,""y"":0.4494485855102539},{""x"":6.099999904632568,""y"":0.1375635862350464},{""x"":6.599999904632568,""y"":0.036351121962070465},{""x"":7.099999904632568,""y"":0.1619771122932434}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.953125499439879, 1.2528620255306528, 5.187637440149802, 0.3110348753260886],""points"":[{""x"":0.10000000149011612,""y"":5.6585283279418945},{""x"":0.6000000238418579,""y"":5.911152362823486},{""x"":1.100000023841858,""y"":5.924920082092285},{""x"":1.600000023841858,""y"":5.8469438552856445},{""x"":2.0999999046325684,""y"":5.929472923278809},{""x"":2.5999999046325684,""y"":6.190037727355957},{""x"":3.0999999046325684,""y"":6.236179828643799},{""x"":3.5999999046325684,""y"":6.141019344329834},{""x"":4.099999904632568,""y"":5.295210838317871},{""x"":4.599999904632568,""y"":5.265801906585693},{""x"":5.099999904632568,""y"":3.3722851276397705},{""x"":5.599999904632568,""y"":1.8299226760864258},{""x"":6.099999904632568,""y"":0.32690900564193726},{""x"":6.599999904632568,""y"":0.6274543404579163},{""x"":7.099999904632568,""y"":0.8441857099533081}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nRwanda,MPNSEPASLLELFNSIATQGELVRSLKAGNASK,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO,1480021,36.33137130737305,995037247,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,9,2BDJ,9,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.8209972202654474, 1.3779216716448506, 5.299882228439686, 0.06040645519069608],""points"":[{""x"":0.10000000149011612,""y"":3.7821109294891357},{""x"":0.6000000238418579,""y"":3.542433023452759},{""x"":1.100000023841858,""y"":3.7008674144744873},{""x"":1.600000023841858,""y"":3.717301607131958},{""x"":2.0999999046325684,""y"":4.024452209472656},{""x"":2.5999999046325684,""y"":4.013899326324463},{""x"":3.0999999046325684,""y"":3.945094347000122},{""x"":3.5999999046325684,""y"":3.866621971130371},{""x"":4.099999904632568,""y"":3.7461626529693604},{""x"":4.599999904632568,""y"":3.3454740047454834},{""x"":5.099999904632568,""y"":2.61944317817688},{""x"":5.599999904632568,""y"":0.999405026435852},{""x"":6.099999904632568,""y"":0.46259793639183044},{""x"":6.599999904632568,""y"":0.054134611040353775},{""x"":7.099999904632568,""y"":0.05711187422275543}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.6318079657726035, 1.8495493770000595, 5.391793312471116, 0.17060707587348442],""points"":[{""x"":0.10000000149011612,""y"":5.458079814910889},{""x"":0.6000000238418579,""y"":5.554427146911621},{""x"":1.100000023841858,""y"":5.799983024597168},{""x"":1.600000023841858,""y"":5.364140033721924},{""x"":2.0999999046325684,""y"":5.864485740661621},{""x"":2.5999999046325684,""y"":5.4509806632995605},{""x"":3.0999999046325684,""y"":5.702574729919434},{""x"":3.5999999046325684,""y"":5.7314534187316895},{""x"":4.099999904632568,""y"":5.5123443603515625},{""x"":4.599999904632568,""y"":5.724395751953125},{""x"":5.099999904632568,""y"":4.354506969451904},{""x"":5.599999904632568,""y"":1.7307666540145874},{""x"":6.099999904632568,""y"":0.6305936574935913},{""x"":6.599999904632568,""y"":0.035183437168598175},{""x"":7.099999904632568,""y"":0.7575169205665588}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nSwitzerland,IRVVGRYLIEVWKAAGMDMDKVLFLWSSDEI,CN1CCC(CC1)Oc2ccc(cc2)C(F)(F)F,1480028,36.33137130737305,99504,92-11 179TH PLACE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,10,1IAN,10,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[1.1190255865097471, 2.3163895161544437, 5.4968866182279195, 0.2035204047289052],""points"":[{""x"":0.10000000149011612,""y"":1.1057683229446411},{""x"":0.6000000238418579,""y"":1.1019697189331055},{""x"":1.100000023841858,""y"":1.0818607807159424},{""x"":1.600000023841858,""y"":1.062997817993164},{""x"":2.0999999046325684,""y"":1.046447515487671},{""x"":2.5999999046325684,""y"":1.1217249631881714},{""x"":3.0999999046325684,""y"":1.2166996002197266},{""x"":3.5999999046325684,""y"":1.215477705001831},{""x"":4.099999904632568,""y"":1.0581893920898438},{""x"":4.599999904632568,""y"":1.1747995615005493},{""x"":5.099999904632568,""y"":1.0181127786636353},{""x"":5.599999904632568,""y"":0.5344523191452026},{""x"":6.099999904632568,""y"":0.2569526433944702},{""x"":6.599999904632568,""y"":0.1912207305431366},{""x"":7.099999904632568,""y"":0.15060538053512573}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.1038581025805785, 2.0032224204185245, 5.087602825989163, 0.13277988512492753],""points"":[{""x"":0.10000000149011612,""y"":3.0498509407043457},{""x"":0.6000000238418579,""y"":2.805217742919922},{""x"":1.100000023841858,""y"":3.3415253162384033},{""x"":1.600000023841858,""y"":3.0549843311309814},{""x"":2.0999999046325684,""y"":3.250074863433838},{""x"":2.5999999046325684,""y"":3.0432586669921875},{""x"":3.0999999046325684,""y"":3.265852451324463},{""x"":3.5999999046325684,""y"":2.9475724697113037},{""x"":4.099999904632568,""y"":3.1929898262023926},{""x"":4.599999904632568,""y"":2.7460060119628906},{""x"":5.099999904632568,""y"":1.6175861358642578},{""x"":5.599999904632568,""y"":0.3006608486175537},{""x"":6.099999904632568,""y"":0.3444803059101105},{""x"":6.599999904632568,""y"":0.015537971630692482},{""x"":7.099999904632568,""y"":0.5527358055114746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\n,,,,,,,,,,,,,,,,,,,,,');r.columns.add(o.Column.fromList(o.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var s=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function a(t,e,n,o,r,a,l,u,c=!0){return s(this,void 0,void 0,(function*(){let d=null;if(yield O(o,(n=>s(this,void 0,void 0,(function*(){let n=null;for(const i of t.viewers)i.type===e&&(n=i);if(!n)throw Error("Viewer hasn't been added");if(yield Promise.resolve(),a&&(yield a(n)),r){const e=null!=u?u:{};e.tv=t,e.viewer=n,d=yield r(e,c)}yield M(i.events.onViewerClosed,(()=>{L(n.subs.some((t=>!t.closed)),!1)}),(()=>n.close()),3e3)}))),(()=>s(this,void 0,void 0,(function*(){l?t.loadLayout(l):yield function(t,e,n){return s(this,void 0,void 0,(function*(){let i;return n?(i=yield t.dataFrame.plot.fromType(e),t.dockManager.dock(i)):i=t.addViewer(e),i}))}(t,e,n)}))),6e4,"TEST_EVENT_ASYNC"),d)return d}))}function l(t,e=!0){return s(this,void 0,void 0,(function*(){const n=t.tv.dataFrame,i=n.clone();Array.from(n.row(0).cells).forEach((t=>t.value=null));const o=n.rowCount<20?Math.floor(n.rowCount/2):10;n.rows.select((t=>t.idx>=0&&t.idx<o)),e&&(yield Y(50));for(let t=o;t<2*o;t++)n.filter.set(t,!1);e&&(yield Y(50)),n.currentRowIdx=1,n.columns.names().slice(0,Math.ceil(n.columns.length/2)).forEach((t=>n.columns.remove(t))),e&&(yield Y(100)),t.tv.dataFrame=i,yield Y(50)}))}function u(t,e=!0){return s(this,void 0,void 0,(function*(){const e=t.tv.dataFrame;setTimeout((()=>e.filter.set(0,!e.filter.get(0))),0)}))}function c(t,e=!0){return s(this,void 0,void 0,(function*(){let e,n;try{e=t.viewer.getOptions(!0).look}catch(t){throw new Error("Viewer's .getOptions() error.",{cause:t})}try{n=t.viewer.getProperties()}catch(t){throw new Error("Viewer's .getProperties() error.",{cause:t})}const i={};return Object.keys(e).filter((t=>"boolean"==typeof e[t])).forEach((t=>i[t]=!e[t])),n.filter((t=>null!==t.choices)).forEach((t=>i[t.name]=t.choices.find((n=>n!==e[t.name])))),t.viewer.setOptions(i),yield Y(300),{layout:t.tv.saveLayout(),savedProps:t.viewer.getOptions().look}}))}function d(t,e=!0){return s(this,void 0,void 0,(function*(){L(JSON.stringify(t.viewer.getOptions().look),JSON.stringify(t.savedProps))}))}var f=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const h=3e4,m=108e5,g=console.log.bind(console),p=console.info.bind(console),v=console.warn.bind(console),y=console.error.bind(console),C={},w="Auto Tests",b="Demo",A="Detectors",S="Core",E={};let T;var x;!function(t){t.notNull=function(t,e){if(null==t)throw new Error(`${null==e?"Value":e} not defined`)}}(x||(x={}));class N{constructor(t,e){this.catchUnhandled=!0,this.report=!1,void 0!==t&&(this.catchUnhandled=t),void 0!==e&&(this.report=e)}}class _{constructor(t,e,n,i){var r;this.category=t,this.name=e,null!=i||(i={}),null!==(r=i.timeout)&&void 0!==r||(i.timeout=h),this.options=i,this.test=()=>f(this,void 0,void 0,(function*(){return new Promise(((t,e)=>f(this,void 0,void 0,(function*(){var i;let r="";try{o.Test.isInDebug;let t=yield n();try{r=null!==(i=null==t?void 0:t.toString())&&void 0!==i?i:""}catch(t){r="Can't convert test's result to string",console.error(`Can't convert test's result to string in the ${this.category}:${this.name} test`)}}catch(t){e(t)}t(r)}))))}))}}function M(t,e,n,i=0,o="timeout"){return f(this,void 0,void 0,(function*(){return new Promise(((r,s)=>{const a=t.subscribe((t=>{try{e(t),r("OK")}catch(t){s(t)}finally{a.unsubscribe(),clearTimeout(l)}})),l=setTimeout((()=>{a.unsubscribe(),s(o)}),i);n()}))}))}function O(t,e,n,i=0,o="timeout"){return f(this,void 0,void 0,(function*(){return new Promise(((r,s)=>{const a=t.subscribe((t=>{e(t).then((()=>{r("OK")})).catch((t=>{s(t)})).finally((()=>{a.unsubscribe(),clearTimeout(l)}))})),l=setTimeout((()=>{a.unsubscribe(),s(o)}),i);n()}))}))}function I(t,e,n){null==C[T]&&(C[T]={}),null==C[T].tests&&(C[T].tests=[]),C[T].tests.push(new _(T,t,e,n))}function L(t,e=!0,n){if(n=n?`${n}, `:"",t!==e)throw new Error(`${n}Expected "${e}", got "${t}"`)}function P(t,e,n=.001,i){if(t===Number.POSITIVE_INFINITY&&e===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY&&e===Number.NEGATIVE_INFINITY||t===Number.NaN&&e===Number.NaN||isNaN(t)&&isNaN(e))return;const o=Math.abs(t-e)<n;if(L(o,!0,`${null!=i?i:""} (tolerance = ${n})`),!o)throw new Error(`Expected ${e}, got ${t} (tolerance = ${n})`)}function R(t,e,n){var i;T=t,e(),C[T]&&(C[T].clear=null===(i=null==n?void 0:n.clear)||void 0===i||i,C[T].timeout=null==n?void 0:n.timeout,C[T].benchmarks=null==n?void 0:n.benchmarks,C[T].stressTests=null==n?void 0:n.stressTests,C[T].owner=null==n?void 0:n.owner)}function k(t){null==C[T]&&(C[T]={}),C[T].before=t}function V(t){null==C[T]&&(C[T]={}),C[T].after=t}function D(t,e){return t.replace(new RegExp(e.name,"gi"),e.nqName)}function F(t,e){var n,s,a,l,u,c,d,g,p,v;return f(this,void 0,void 0,(function*(){const y=t.id;if(E[y])return;const T=e?e.tests:C;if("DevTools"===t.name||e&&"DevTools"===e._package.name)for(const t of window.dartTests){const e=t.name.split(/\s*\|\s*!/g);let i=null!==(n=e.pop())&&void 0!==n?n:t.name,o=e.length?S+": "+e.join(": "):S,r=i.split(" | ");i=r[r.length-1],r.unshift(o),r.pop(),o=r.join(": "),void 0===T[o]&&(T[o]={tests:[],clear:!0}),T[o].tests.push(new _(o,i,t.test,{isAggregated:!1,timeout:null!==(a=null===(s=t.options)||void 0===s?void 0:s.timeout)&&void 0!==a?a:h,skipReason:null===(l=t.options)||void 0===l?void 0:l.skipReason,owner:null===(u=t.options)||void 0===u?void 0:u.owner,benchmark:null!==(d=null===(c=t.options)||void 0===c?void 0:c.benchmark)&&void 0!==d&&d}))}const x=[],N=[],M=[],O=yield i.dapi.functions.filter(`package.id = "${y}"`).list(),I=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)|timeout:\s*(\d+)/g);for(const e of O){const n=e.options.test,s=e.options.demoPath;if(n&&Array.isArray(n)&&n.length)for(let t=0;t<n.length;t++){const r=n[t].matchAll(I),s={};Array.from(r).forEach((t=>{t[0].startsWith("skip")?s.skip=t[1]:t[0].startsWith("wait")?s.wait=parseInt(t[2]):t[0].startsWith("cat")?s.cat=t[3]:t[0].startsWith("timeout")&&(s.timeout=parseInt(t[4]))}));const a=new _(null!==(g=s.cat)&&void 0!==g?g:w,1===n.length?e.name:`${e.name} ${t+1}`,(()=>f(this,void 0,void 0,(function*(){const o=yield i.functions.eval(D(n[t],e));if(s.wait&&(yield Y(s.wait)),"boolean"==typeof o&&!o)throw`Failed: ${n[t]}, expected true, got ${o}`}))),{skipReason:s.skip,timeout:o.Test.isInBenchmark?null!==(p=s.benchmarkTimeout)&&void 0!==p?p:m:null!==(v=s.timeout)&&void 0!==v?v:h});if(s.cat){const t=s.cat;void 0===T[t]&&(T[t]={tests:[],clear:!0}),T[t].tests||(T[t].tests=[]),T[t].tests.push(a)}else x.push(a)}if(s){const t=e.options.demoWait?parseInt(e.options.demoWait):void 0,n=new _(b,e.friendlyName,(()=>f(this,void 0,void 0,(function*(){yield Y(300),i.shell.clearLastError(),yield e.apply(),yield Y(t||2e3);const n=yield i.shell.lastError;if(n)throw new Error(n)}))),{skipReason:e.options.demoSkip});N.push(n)}if(e.hasTag("semTypeDetector")){let n=r;e.options.testData&&(n=yield i.data.files.openTable(`System:AppData/${t.nqName}/${e.options.testData}`));const o=new _(A,e.friendlyName,(()=>f(this,void 0,void 0,(function*(){const i=[];console.log(`System:AppData/${t.nqName}/${e.options.testData}`);for(const t of n.clone().columns){const n=yield e.apply([t]);i.push(n||t.semType)}const o=i.filter((t=>t));L(o.length,1),e.options.testDataColumnName&&L(o[0],e.options.testDataColumnName)}))),{skipReason:e.options.skipTest});M.push(o)}}E[y]=!0,x.length>0&&(T[w]={tests:x,clear:!0}),N.length>0&&(T[b]={tests:N,clear:!0}),M.length>0&&(T[A]={tests:M,clear:!1})}))}function G(t){var e,n,r,s,a,l;return f(this,void 0,void 0,(function*(){console.log("--------------------");const u=null===(n=null===(e=i.functions.getCurrentCall())||void 0===e?void 0:e.func)||void 0===n?void 0:n.package,c=(null!==(s=(null!==(r=null==u?void 0:u.packageOwner)&&void 0!==r?r:"").match(new RegExp("[^<]*<([^>]*)>")))&&void 0!==s?s:["",""])[1];yield F(u);const d=[];console.log("Running tests"),console.log(t),null!=t||(t={}),null!==(a=(l=t).testContext)&&void 0!==a||(l.testContext=new N),i.shell.clearLastError();const w=function(){const t=[];return console.log=(...e)=>{t.push(...e),g(...e)},console.info=(...e)=>{t.push(...e),p(...e)},console.warn=(...e)=>{t.push(...e),v(...e)},console.error=(...e)=>{t.push(...e),y(...e)},t}();yield function(t,e){var n,r,s,a,l,h,m;return f(this,void 0,void 0,(function*(){try{for(const[i,c]of Object.entries(t)){if((null==e?void 0:e.category)&&!i.toLowerCase().startsWith(null==e?void 0:e.category.toLowerCase())||(null===(n=e.exclude)||void 0===n?void 0:n.some((t=>i.startsWith(t)))))continue;g(`Started ${i} category`);const t=null===(r=c.tests)||void 0===r?void 0:r.every((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.skipReason}));t||(c.beforeStatus=yield b(c.before,null!==(s=e.category)&&void 0!==s?s:""));let p,v=null!==(a=c.tests)&&void 0!==a?a:[];e.stressTest&&(v=v.filter((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.stressTest})),v=B(v)),(null!==(h=null===(l=e.tags)||void 0===l?void 0:l.length)&&void 0!==h?h:0)>0&&(v=v.filter((t=>{var n,i;return null===(i=null===(n=t.options)||void 0===n?void 0:n.tags)||void 0===i?void 0:i.some((t=>{var n;return(null!==(n=null==e?void 0:e.tags)&&void 0!==n?n:[]).includes(t)}))}))),c.beforeStatus?(p=Array.from(v.map((t=>({date:(new Date).toISOString(),category:i,name:t.name,success:!1,result:"before() failed",ms:0,skipped:!1,logs:"",owner:null==u?void 0:u.packageOwner,package:u.name,widgetsDifference:0,flaking:o.Test.isReproducing})))),p.forEach((t=>f(this,void 0,void 0,(function*(){return U("package",t)}))))):p=yield A(c,e);const y=p.filter((t=>"skipped"!=t.result));t||(c.afterStatus=yield b(c.after,null!==(m=e.category)&&void 0!==m?m:"")),c.afterStatus&&y.push({date:(new Date).toISOString(),category:i,name:"after",success:!1,result:c.afterStatus,ms:0,skipped:!1,logs:"",owner:null==u?void 0:u.packageOwner,package:u.name,widgetsDifference:0,flaking:o.Test.isReproducing}),c.beforeStatus&&y.push({date:(new Date).toISOString(),category:i,name:"before",success:!1,result:c.beforeStatus,ms:0,skipped:!1,logs:"",owner:null==u?void 0:u.packageOwner,package:u.name,widgetsDifference:0,flaking:o.Test.isReproducing}),d.push(...y)}}finally{console.log=g,console.info=p,console.warn=v,console.error=y}if(e.testContext.catchUnhandled&&!o.Test.isInBenchmark){yield Y(1e3);const t=yield i.shell.lastError,e={logs:"",date:(new Date).toISOString(),category:"Unhandled exceptions",name:"Exception",result:null!=t?t:"",success:!t,ms:0,skipped:!1,owner:null!=c?c:"",package:u.name,widgetsDifference:0};d.push(Object.assign(Object.assign({},e),{flaking:o.Test.isReproducing&&!t})),e.package=u.name,yield U("package",e)}}))}(C,t);for(let t of d)t.result=t.result.toString().replace(/"/g,"'"),null!=t.logs&&(t.logs=t.logs.toString().replace(/"/g,"'"));return d;function b(t,e){return f(this,void 0,void 0,(function*(){let n;try{void 0!==t&&(yield W((()=>f(this,void 0,void 0,(function*(){yield t()}))),1e5,`before ${e}: timeout error`))}catch(t){n=yield H(t)}return n}))}function A(t,e){var n,r,s,a,l,d,g,p,v,y,C,b,A,E,T,x,N,_;return f(this,void 0,void 0,(function*(){let f=null!==(n=t.tests)&&void 0!==n?n:[];const M=[],O=S();if(t.clear)for(let n=0;n<f.length;n++){f[n].options&&void 0===(null===(r=f[n].options)||void 0===r?void 0:r.benchmark)&&(f[n].options||(f[n].options={}),f[n].options.benchmark=null!==(s=t.benchmarks)&&void 0!==s&&s);let b=f[n];if(e.test&&e.test.toLowerCase()!==b.name.toLowerCase())continue;(null==b?void 0:b.options)&&(b.options.owner=null!==(g=null!==(d=null!==(l=null===(a=f[n].options)||void 0===a?void 0:a.owner)&&void 0!==l?l:null==t?void 0:t.owner)&&void 0!==d?d:c)&&void 0!==g?g:"");let A=yield q(b,null==e?void 0:e.test,w,o.Test.isInBenchmark?null!==(v=null===(p=f[n].options)||void 0===p?void 0:p.benchmarkTimeout)&&void 0!==v?v:m:null!==(C=null===(y=f[n].options)||void 0===y?void 0:y.timeout)&&void 0!==C?C:h,u.name,e.verbose);A&&M.push(Object.assign(Object.assign({},A),{widgetsDifference:S()-O})),i.shell.closeAll(),o.Balloon.closeAll()}else for(let n=0;n<f.length;n++){let i=f[n];if(e.test&&e.test.toLowerCase()!==i.name.toLowerCase())continue;(null==i?void 0:i.options)&&(i.options.owner=null!==(T=null!==(E=null!==(A=null===(b=f[n].options)||void 0===b?void 0:b.owner)&&void 0!==A?A:null==t?void 0:t.owner)&&void 0!==E?E:c)&&void 0!==T?T:"");let r=yield q(i,null==e?void 0:e.test,w,o.Test.isInBenchmark?null!==(N=null===(x=f[n].options)||void 0===x?void 0:x.benchmarkTimeout)&&void 0!==N?N:m:null===(_=f[n].options)||void 0===_?void 0:_.timeout,u.name,e.verbose);r&&M.push(Object.assign(Object.assign({},r),{widgetsDifference:S()-O}))}return M}))}function S(){var t;let e=-1;try{e=o.Widget.getAll().length}catch(e){console.warn(null!==(t=e.message)&&void 0!==t?t:e)}return e}}))}function U(t,e){return f(this,void 0,void 0,(function*(){null!=i.shell.reportTest?yield i.shell.reportTest(t,e):yield fetch(`${i.dapi.root}/log/tests/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(e)})}))}function H(t){return f(this,void 0,void 0,(function*(){return`${t.toString()}\n${t.stack?yield o.Logger.translateStackTrace(t.stack):""}`}))}function q(t,e,n,r,s,a){var l,u,c,d,m,p,v,C,w,b,A,S,E,T;return f(this,void 0,void 0,(function*(){let f;n.length=0;const x=null!=e&&t.name.toLowerCase()!==e.toLowerCase();let N=(null===(l=t.options)||void 0===l?void 0:l.skipReason)||x,_=x?"skipped":null===(u=t.options)||void 0===u?void 0:u.skipReason;if(console.log(I.name,N),o.Test.isInBenchmark&&!(null===(c=t.options)||void 0===c?void 0:c.benchmark))return void g(`SKIPPED: ${t.category} ${t.name} doesnt available in benchmark mode`);N||g(`Started ${t.category} ${t.name}`);const M=Date.now(),O=new Date(M).toISOString();try{if(N)f={name:t.name,owner:null!==(m=null===(d=t.options)||void 0===d?void 0:d.owner)&&void 0!==m?m:"",category:t.category,logs:"",date:O,success:!0,result:_,ms:0,skipped:!0,package:null!=s?s:"",flaking:o.Test.isReproducing};else{let e=null!=r?r:h;o.Test.isProfiling&&console.profile(`${t.category}: ${t.name}`),f={name:t.name,owner:null!==(v=null===(p=t.options)||void 0===p?void 0:p.owner)&&void 0!==v?v:"",category:t.category,logs:"",date:O,success:!0,result:null!==(C=yield W(t.test,e))&&void 0!==C?C:"OK",ms:0,skipped:!1,package:null!=s?s:"",flaking:o.Test.isReproducing},o.Test.isProfiling&&(console.profileEnd(`${t.category}: ${t.name}`),i.shell.info(`Profiling of ${t.category}: ${t.name} finished \n Please ensure that you have opened DevTools (F12) / Performance panel before test starts.`))}}catch(e){y(e),f={name:t.name,owner:null!==(b=null===(w=t.options)||void 0===w?void 0:w.owner)&&void 0!==b?b:"",category:t.category,logs:"",date:O,success:!1,result:yield H(e),ms:0,skipped:!1,package:null!=s?s:"",flaking:!1}}if((null===(A=t.options)||void 0===A?void 0:A.isAggregated)&&f.result.constructor===o.DataFrame){const t=f.result.col("success");if(t&&(f.success=t.stats.sum===t.length),!a){const t=f.result;t.columns.remove("stack"),t.rows.removeWhere((t=>t.get("success"))),f.result=t}f.result=f.result.toCsv()}if(f.logs=n.join("\n"),f.ms=Date.now()-M,N||g(`Finished ${t.category} ${t.name} for ${f.ms} ms`),f.category=t.category,f.name=t.name,f.owner=null!==(E=null===(S=t.options)||void 0===S?void 0:S.owner)&&void 0!==E?E:"",!x){let e={success:f.success,result:f.result,ms:f.ms,date:f.date,skipped:f.skipped,category:t.category,name:t.name,logs:f.logs,owner:f.owner,flaking:o.Test.isReproducing&&f.success,package:f.package};if(f.result.constructor==Object){const t=Object.keys(f.result).reduce(((t,e)=>Object.assign(Object.assign({},t),{["result."+e]:f.result[e]})),{});e=Object.assign(Object.assign({},e),t)}e.result instanceof o.DataFrame&&(e.result=JSON.stringify(null===(T=e.result)||void 0===T?void 0:T.toJson())||""),yield U("package",e)}return f}))}function B(t){const e=t.slice();return e.sort((()=>Math.random()-.5)),e}function Y(t){return f(this,void 0,void 0,(function*(){yield new Promise((e=>setTimeout(e,t)))}))}function $(t,e="Timeout exceeded",n=500,i=50){return f(this,void 0,void 0,(function*(){return new Promise(((o,r)=>{setTimeout((()=>{clearInterval(s),r(new Error(e))}),n);const s=setInterval((()=>{t()&&(clearInterval(s),o(null))}),i)}))}))}function W(t,e,n="EXECUTION TIMEOUT"){return f(this,void 0,void 0,(function*(){let i=null;const o=new Promise(((t,o)=>{i=setTimeout((()=>{o(n)}),e)}));try{return yield Promise.race([t(),o])}finally{i&&clearTimeout(i)}}))}const j=o.DataFrame.fromColumns([o.Column.fromStrings("col",["val1","val2","val3"])]);function z(t,e,n){var o;return f(this,void 0,void 0,(function*(){const r=null!==(o=null==n?void 0:n.packageName)&&void 0!==o?o:"";(null==n?void 0:n.detectSemanticTypes)&&(yield i.data.detectSemanticTypes(e));const s=i.shell.addTableView(e);try{yield a(s,t,r,i.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,r,i.events.onViewerAdded,void 0,n.awaitViewer)),(null==n?void 0:n.readOnly)||(yield a(s,t,r,i.events.onViewerAdded,l),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,r,i.events.onViewerAdded,l,n.awaitViewer)));let e=null;e=yield a(s,t,r,i.events.onViewerAdded,c),(null==n?void 0:n.awaitViewer)&&(e=yield a(s,t,r,i.events.onViewerAdded,c,n.awaitViewer)),yield a(s,t,r,i.events.onViewLayoutApplied,d,void 0,null==e?void 0:e.layout,{savedProps:null==e?void 0:e.savedProps}),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,r,i.events.onViewLayoutApplied,d,n.awaitViewer,null==e?void 0:e.layout,{savedProps:null==e?void 0:e.savedProps})),!1!==(null==n?void 0:n.arbitraryDfTest)&&(s.dataFrame=j,yield Y(50),yield a(s,t,r,i.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,r,i.events.onViewerAdded,void 0,n.awaitViewer))),yield a(s,t,r,i.events.onViewerAdded,u),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,r,i.events.onViewerAdded,u,n.awaitViewer))}finally{}}))}},7233:t=>{!function(){"use strict";var e=document,n=window,i=e.documentElement,o=e.createElement.bind(e),r=o("div"),s=o("table"),a=o("tbody"),l=o("tr"),u=Array.isArray,c=Array.prototype,d=c.concat,f=c.filter,h=c.indexOf,m=c.map,g=c.push,p=c.slice,v=c.some,y=c.splice,C=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,w=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,b=/<.+>/,A=/^\w+$/;function S(t,e){var n,i=!!(n=e)&&11===n.nodeType;return t&&(i||M(e)||O(e))?!i&&w.test(t)?e.getElementsByClassName(t.slice(1).replace(/\\/g,"")):!i&&A.test(t)?e.getElementsByTagName(t):e.querySelectorAll(t):[]}var E=function(){function t(t,i){if(t){if(N(t))return t;var o=t;if(L(t)){var r=i||e;if(!(o=C.test(t)&&M(r)?r.getElementById(t.slice(1).replace(/\\/g,"")):b.test(t)?X(t):N(r)?r.find(t):L(r)?x(r).find(t):S(t,r)))return}else if(I(t))return this.ready(t);(o.nodeType||o===n)&&(o=[o]),this.length=o.length;for(var s=0,a=this.length;s<a;s++)this[s]=o[s]}}return t.prototype.init=function(e,n){return new t(e,n)},t}(),T=E.prototype,x=T.init;function N(t){return t instanceof E}function _(t){return!!t&&t===t.window}function M(t){return!!t&&9===t.nodeType}function O(t){return!!t&&1===t.nodeType}function I(t){return"function"==typeof t}function L(t){return"string"==typeof t}function P(t){return void 0===t}function R(t){return null===t}function k(t){return!isNaN(parseFloat(t))&&isFinite(t)}function V(t){if("object"!=typeof t||null===t)return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function D(t,e,n){if(n){for(var i=t.length;i--;)if(!1===e.call(t[i],i,t[i]))return t}else if(V(t))for(var o=Object.keys(t),r=(i=0,o.length);i<r;i++){var s=o[i];if(!1===e.call(t[s],s,t[s]))return t}else for(i=0,r=t.length;i<r;i++)if(!1===e.call(t[i],i,t[i]))return t;return t}function F(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="boolean"==typeof t[0]&&t.shift(),i=t.shift(),o=t.length;if(!i)return{};if(!o)return F(n,x,i);for(var r=0;r<o;r++){var s=t[r];for(var a in s)n&&(u(s[a])||V(s[a]))?(i[a]&&i[a].constructor===s[a].constructor||(i[a]=new s[a].constructor),F(n,i[a],s[a])):i[a]=s[a]}return i}x.fn=x.prototype=T,T.length=0,T.splice=y,"function"==typeof Symbol&&(T[Symbol.iterator]=c[Symbol.iterator]),x.isWindow=_,x.isFunction=I,x.isArray=u,x.isNumeric=k,x.isPlainObject=V,x.each=D,T.each=function(t){return D(this,t)},T.empty=function(){return this.each((function(t,e){for(;e.firstChild;)e.removeChild(e.firstChild)}))},x.extend=F,T.extend=function(t){return F(T,t)};var G=/\S+/g;function U(t){return L(t)&&t.match(G)||[]}function H(t,e,i){if(O(t)){var o=n.getComputedStyle(t,null);return i?o.getPropertyValue(e)||void 0:o[e]||t.style[e]}}function q(t,e){return parseInt(H(t,e),10)||0}function B(t,e){return q(t,"border".concat(e?"Left":"Top","Width"))+q(t,"padding".concat(e?"Left":"Top"))+q(t,"padding".concat(e?"Right":"Bottom"))+q(t,"border".concat(e?"Right":"Bottom","Width"))}T.toggleClass=function(t,e){var n=U(t),i=!P(e);return this.each((function(t,o){O(o)&&D(n,(function(t,n){i?e?o.classList.add(n):o.classList.remove(n):o.classList.toggle(n)}))}))},T.addClass=function(t){return this.toggleClass(t,!0)},T.removeAttr=function(t){var e=U(t);return this.each((function(t,n){O(n)&&D(e,(function(t,e){n.removeAttribute(e)}))}))},T.attr=function(t,e){if(t){if(L(t)){if(arguments.length<2){if(!this[0]||!O(this[0]))return;var n=this[0].getAttribute(t);return R(n)?void 0:n}return P(e)?this:R(e)?this.removeAttr(t):this.each((function(n,i){O(i)&&i.setAttribute(t,e)}))}for(var i in t)this.attr(i,t[i]);return this}},T.removeClass=function(t){return arguments.length?this.toggleClass(t,!1):this.attr("class","")},T.hasClass=function(t){return!!t&&v.call(this,(function(e){return O(e)&&e.classList.contains(t)}))},T.get=function(t){return P(t)?p.call(this):this[(t=Number(t))<0?t+this.length:t]},T.eq=function(t){return x(this.get(t))},T.first=function(){return this.eq(0)},T.last=function(){return this.eq(-1)},T.text=function(t){return P(t)?this.get().map((function(t){return O(t)||(e=t)&&3===e.nodeType?t.textContent:"";var e})).join(""):this.each((function(e,n){O(n)&&(n.textContent=t)}))};var Y={};function $(t){return"none"===H(t,"display")}function W(t,e){var n=t&&(t.matches||t.webkitMatchesSelector||t.msMatchesSelector);return!!n&&!!e&&n.call(t,e)}function j(t){return L(t)?function(e,n){return W(n,t)}:I(t)?t:N(t)?function(e,n){return t.is(n)}:t?function(e,n){return n===t}:function(){return!1}}function z(t,e){return e?t.filter(e):t}T.filter=function(t){var e=j(t);return x(f.call(this,(function(t,n){return e.call(t,n,t)})))},T.detach=function(t){return z(this,t).each((function(t,e){e.parentNode&&e.parentNode.removeChild(e)})),this};var K=/^\s*<(\w+)[^>]*>/,Q=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,Z={"*":r,tr:a,td:l,th:l,thead:s,tbody:s,tfoot:s};function X(t){if(!L(t))return[];if(Q.test(t))return[o(RegExp.$1)];var e=K.test(t)&&RegExp.$1,n=Z[e]||Z["*"];return n.innerHTML=t,x(n.childNodes).detach().get()}function J(t,e,n,i){for(var o=[],r=I(e),s=i&&j(i),a=0,l=t.length;a<l;a++)if(r){var u=e(t[a]);u.length&&g.apply(o,u)}else for(var c=t[a][e];!(null==c||i&&s(-1,c));)o.push(c),c=n?c[e]:null;return o}function tt(t){return t.multiple&&t.options?J(f.call(t.options,(function(t){return t.selected&&!t.disabled&&!t.parentNode.disabled})),"value"):t.value||""}function et(t){return t.length>1?f.call(t,(function(t,e,n){return h.call(n,t)===e})):t}x.parseHTML=X,T.has=function(t){var e=L(t)?function(e,n){return S(t,n).length}:function(e,n){return n.contains(t)};return this.filter(e)},T.not=function(t){var e=j(t);return this.filter((function(n,i){return(!L(t)||O(i))&&!e.call(i,n,i)}))},T.val=function(t){return arguments.length?this.each((function(e,n){var i=n.multiple&&n.options;if(i||Lt.test(n.type)){var o=u(t)?m.call(t,String):R(t)?[]:[String(t)];i?D(n.options,(function(t,e){e.selected=o.indexOf(e.value)>=0}),!0):n.checked=o.indexOf(n.value)>=0}else n.value=P(t)||R(t)?"":t})):this[0]&&tt(this[0])},T.is=function(t){var e=j(t);return v.call(this,(function(t,n){return e.call(t,n,t)}))},x.guid=1,x.unique=et,T.add=function(t,e){return x(et(this.get().concat(x(t,e).get())))},T.children=function(t){return z(x(et(J(this,(function(t){return t.children})))),t)},T.parent=function(t){return z(x(et(J(this,"parentNode"))),t)},T.index=function(t){var e=t?x(t)[0]:this[0],n=t?this:x(e).parent().children();return h.call(n,e)},T.closest=function(t){var e=this.filter(t);if(e.length)return e;var n=this.parent();return n.length?n.closest(t):e},T.siblings=function(t){return z(x(et(J(this,(function(t){return x(t).parent().children().not(t)})))),t)},T.find=function(t){return x(et(J(this,(function(e){return S(t,e)}))))};var nt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,it=/^$|^module$|\/(java|ecma)script/i,ot=["type","src","nonce","noModule"];function rt(t,e,n,r,s,a,l,u){return D(t,(function(t,a){D(x(a),(function(t,a){D(x(e),(function(e,l){var u=n?l:a,c=n?t:e;!function(t,e,n,r,s){r?t.insertBefore(e,n?t.firstChild:null):"HTML"===t.nodeName?t.parentNode.replaceChild(e,t):t.parentNode.insertBefore(e,n?t:t.nextSibling),s&&function(t,e){var n=x(t);n.filter("script").add(n.find("script")).each((function(t,n){if(it.test(n.type)&&i.contains(n)){var r=o("script");r.text=n.textContent.replace(nt,""),D(ot,(function(t,e){n[e]&&(r[e]=n[e])})),e.head.insertBefore(r,null),e.head.removeChild(r)}}))}(e,t.ownerDocument)}(n?a:l,c?u.cloneNode(!0):u,r,s,!c)}),u)}),l)}),a),e}T.after=function(){return rt(arguments,this,!1,!1,!1,!0,!0)},T.append=function(){return rt(arguments,this,!1,!1,!0)},T.html=function(t){if(!arguments.length)return this[0]&&this[0].innerHTML;if(P(t))return this;var e=/<script[\s>]/.test(t);return this.each((function(n,i){O(i)&&(e?x(i).empty().append(t):i.innerHTML=t)}))},T.appendTo=function(t){return rt(arguments,this,!0,!1,!0)},T.wrapInner=function(t){return this.each((function(e,n){var i=x(n),o=i.contents();o.length?o.wrapAll(t):i.append(t)}))},T.before=function(){return rt(arguments,this,!1,!0)},T.wrapAll=function(t){for(var e=x(t),n=e[0];n.children.length;)n=n.firstElementChild;return this.first().before(e),this.appendTo(n)},T.wrap=function(t){return this.each((function(e,n){var i=x(t)[0];x(n).wrapAll(e?i.cloneNode(!0):i)}))},T.insertAfter=function(t){return rt(arguments,this,!0,!1,!1,!1,!1,!0)},T.insertBefore=function(t){return rt(arguments,this,!0,!0)},T.prepend=function(){return rt(arguments,this,!1,!0,!0,!0,!0)},T.prependTo=function(t){return rt(arguments,this,!0,!0,!0,!1,!1,!0)},T.contents=function(){return x(et(J(this,(function(t){return"IFRAME"===t.tagName?[t.contentDocument]:"TEMPLATE"===t.tagName?t.content.childNodes:t.childNodes}))))},T.next=function(t,e,n){return z(x(et(J(this,"nextElementSibling",e,n))),t)},T.nextAll=function(t){return this.next(t,!0)},T.nextUntil=function(t,e){return this.next(e,!0,t)},T.parents=function(t,e){return z(x(et(J(this,"parentElement",!0,e))),t)},T.parentsUntil=function(t,e){return this.parents(e,t)},T.prev=function(t,e,n){return z(x(et(J(this,"previousElementSibling",e,n))),t)},T.prevAll=function(t){return this.prev(t,!0)},T.prevUntil=function(t,e){return this.prev(e,!0,t)},T.map=function(t){return x(d.apply([],m.call(this,(function(e,n){return t.call(e,n,e)}))))},T.clone=function(){return this.map((function(t,e){return e.cloneNode(!0)}))},T.offsetParent=function(){return this.map((function(t,e){for(var n=e.offsetParent;n&&"static"===H(n,"position");)n=n.offsetParent;return n||i}))},T.slice=function(t,e){return x(p.call(this,t,e))};var st=/-([a-z])/g;function at(t){return t.replace(st,(function(t,e){return e.toUpperCase()}))}T.ready=function(t){var n=function(){return setTimeout(t,0,x)};return"loading"!==e.readyState?n():e.addEventListener("DOMContentLoaded",n),this},T.unwrap=function(){return this.parent().each((function(t,e){if("BODY"!==e.tagName){var n=x(e);n.replaceWith(n.children())}})),this},T.offset=function(){var t=this[0];if(t){var e=t.getBoundingClientRect();return{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}}},T.position=function(){var t=this[0];if(t){var e="fixed"===H(t,"position"),n=e?t.getBoundingClientRect():this.offset();if(!e){for(var i=t.ownerDocument,o=t.offsetParent||i.documentElement;(o===i.body||o===i.documentElement)&&"static"===H(o,"position");)o=o.parentNode;if(o!==t&&O(o)){var r=x(o).offset();n.top-=r.top+q(o,"borderTopWidth"),n.left-=r.left+q(o,"borderLeftWidth")}}return{top:n.top-q(t,"marginTop"),left:n.left-q(t,"marginLeft")}}};var lt={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};T.prop=function(t,e){if(t){if(L(t))return t=lt[t]||t,arguments.length<2?this[0]&&this[0][t]:this.each((function(n,i){i[t]=e}));for(var n in t)this.prop(n,t[n]);return this}},T.removeProp=function(t){return this.each((function(e,n){delete n[lt[t]||t]}))};var ut=/^--/;function ct(t){return ut.test(t)}var dt={},ft=r.style,ht=["webkit","moz","ms"],mt={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function gt(t,e,n){return void 0===n&&(n=ct(t)),n||mt[t]||!k(e)?e:"".concat(e,"px")}function pt(t,e){try{return t(e)}catch(t){return e}}T.css=function(t,e){if(L(t)){var n=ct(t);return t=function(t,e){if(void 0===e&&(e=ct(t)),e)return t;if(!dt[t]){var n=at(t),i="".concat(n[0].toUpperCase()).concat(n.slice(1));D("".concat(n," ").concat(ht.join("".concat(i," "))).concat(i).split(" "),(function(e,n){if(n in ft)return dt[t]=n,!1}))}return dt[t]}(t,n),arguments.length<2?this[0]&&H(this[0],t,n):t?(e=gt(t,e,n),this.each((function(i,o){O(o)&&(n?o.style.setProperty(t,e):o.style[t]=e)}))):this}for(var i in t)this.css(i,t[i]);return this};var vt=/^\s+|\s+$/;function yt(t,e){var n=t.dataset[e]||t.dataset[at(e)];return vt.test(n)?n:pt(JSON.parse,n)}function Ct(t,e){var n=t.documentElement;return Math.max(t.body["scroll".concat(e)],n["scroll".concat(e)],t.body["offset".concat(e)],n["offset".concat(e)],n["client".concat(e)])}T.data=function(t,e){if(!t){if(!this[0])return;var n={};for(var i in this[0].dataset)n[i]=yt(this[0],i);return n}if(L(t))return arguments.length<2?this[0]&&yt(this[0],t):P(e)?this:this.each((function(n,i){!function(t,e,n){n=pt(JSON.stringify,n),t.dataset[at(e)]=n}(i,t,e)}));for(var i in t)this.data(i,t[i]);return this},D([!0,!1],(function(t,e){D(["Width","Height"],(function(t,n){var i="".concat(e?"outer":"inner").concat(n);T[i]=function(i){if(this[0])return _(this[0])?e?this[0]["inner".concat(n)]:this[0].document.documentElement["client".concat(n)]:M(this[0])?Ct(this[0],n):this[0]["".concat(e?"offset":"client").concat(n)]+(i&&e?q(this[0],"margin".concat(t?"Top":"Left"))+q(this[0],"margin".concat(t?"Bottom":"Right")):0)}}))})),D(["Width","Height"],(function(t,e){var n=e.toLowerCase();T[n]=function(i){if(!this[0])return P(i)?void 0:this;if(!arguments.length)return _(this[0])?this[0].document.documentElement["client".concat(e)]:M(this[0])?Ct(this[0],e):this[0].getBoundingClientRect()[n]-B(this[0],!t);var o=parseInt(i,10);return this.each((function(e,i){if(O(i)){var r=H(i,"boxSizing");i.style[n]=gt(n,o+("border-box"===r?B(i,!t):0))}}))}}));var wt="___cd";T.toggle=function(t){return this.each((function(n,i){if(O(i)){var r=$(i);(P(t)?r:t)?(i.style.display=i[wt]||"",$(i)&&(i.style.display=function(t){if(Y[t])return Y[t];var n=o(t);e.body.insertBefore(n,null);var i=H(n,"display");return e.body.removeChild(n),Y[t]="none"!==i?i:"block"}(i.tagName))):r||(i[wt]=H(i,"display"),i.style.display="none")}}))},T.hide=function(){return this.toggle(!1)},T.show=function(){return this.toggle(!0)};var bt="___ce",At={focus:"focusin",blur:"focusout"},St={mouseenter:"mouseover",mouseleave:"mouseout"},Et=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;function Tt(t){return St[t]||At[t]||t}function xt(t){var e=t.split(".");return[e[0],e.slice(1).sort()]}function Nt(t){return t[bt]=t[bt]||{}}function _t(t,e){return!e||!v.call(e,(function(e){return t.indexOf(e)<0}))}function Mt(t,e,n,i,o){var r=Nt(t);if(e)r[e]&&(r[e]=r[e].filter((function(r){var s=r[0],a=r[1],l=r[2];if(o&&l.guid!==o.guid||!_t(s,n)||i&&i!==a)return!0;t.removeEventListener(e,l)})));else for(e in r)Mt(t,e,n,i,o)}T.trigger=function(t,n){if(L(t)){var i=xt(t),o=i[0],r=i[1],s=Tt(o);if(!s)return this;var a=Et.test(s)?"MouseEvents":"HTMLEvents";(t=e.createEvent(a)).initEvent(s,!0,!0),t.namespace=r.join("."),t.___ot=o}t.___td=n;var l=t.___ot in At;return this.each((function(e,n){l&&I(n[t.___ot])&&(n["___i".concat(t.type)]=!0,n[t.___ot](),n["___i".concat(t.type)]=!1),n.dispatchEvent(t)}))},T.off=function(t,e,n){var i=this;if(P(t))this.each((function(t,e){(O(e)||M(e)||_(e))&&Mt(e)}));else if(L(t))I(e)&&(n=e,e=""),D(U(t),(function(t,o){var r=xt(o),s=r[0],a=r[1],l=Tt(s);i.each((function(t,i){(O(i)||M(i)||_(i))&&Mt(i,l,a,e,n)}))}));else for(var o in t)this.off(o,t[o]);return this},T.remove=function(t){return z(this,t).detach().off(),this},T.replaceWith=function(t){return this.before(t).remove()},T.replaceAll=function(t){return x(t).replaceWith(this),this},T.on=function(t,e,n,i,o){var r=this;if(!L(t)){for(var s in t)this.on(s,e,n,t[s],o);return this}return L(e)||(P(e)||R(e)?e="":P(n)?(n=e,e=""):(i=n,n=e,e="")),I(i)||(i=n,n=void 0),i?(D(U(t),(function(t,s){var a=xt(s),l=a[0],u=a[1],c=Tt(l),d=l in St,f=l in At;c&&r.each((function(t,r){if(O(r)||M(r)||_(r)){var s=function(t){if(t.target["___i".concat(t.type)])return t.stopImmediatePropagation();if((!t.namespace||_t(u,t.namespace.split(".")))&&(e||!(f&&(t.target!==r||t.___ot===c)||d&&t.relatedTarget&&r.contains(t.relatedTarget)))){var a=r;if(e){for(var l=t.target;!W(l,e);){if(l===r)return;if(!(l=l.parentNode))return}a=l}Object.defineProperty(t,"currentTarget",{configurable:!0,get:function(){return a}}),Object.defineProperty(t,"delegateTarget",{configurable:!0,get:function(){return r}}),Object.defineProperty(t,"data",{configurable:!0,get:function(){return n}});var h=i.call(a,t,t.___td);o&&Mt(r,c,u,e,s),!1===h&&(t.preventDefault(),t.stopPropagation())}};s.guid=i.guid=i.guid||x.guid++,function(t,e,n,i,o){var r=Nt(t);r[e]=r[e]||[],r[e].push([n,i,o]),t.addEventListener(e,o)}(r,c,u,e,s)}}))})),this):this},T.one=function(t,e,n,i){return this.on(t,e,n,i,!0)};var Ot=/\r?\n/g,It=/file|reset|submit|button|image/i,Lt=/radio|checkbox/i;T.serialize=function(){var t="";return this.each((function(e,n){D(n.elements||[n],(function(e,n){if(!(n.disabled||!n.name||"FIELDSET"===n.tagName||It.test(n.type)||Lt.test(n.type)&&!n.checked)){var i=tt(n);P(i)||D(u(i)?i:[i],(function(e,i){t+=function(t,e){return"&".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(e.replace(Ot,"\r\n")))}(n.name,i)}))}}))})),t.slice(1)},t.exports=x}()},6677:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(1354),o=n.n(i),r=n(6314),s=n.n(r)()(o());s.push([t.id,".ui-app-header {\n\n}\n\n.ui-app-header-icon {\n width: 150px;\n height: 150px;\n margin-right: 20px;\n}\n\n.u2-panel {\n gap: 10px;\n}","",{version:3,sources:["webpack://./node_modules/@datagrok-libraries/utils/src/u2.css"],names:[],mappings:"AAAA;;AAEA;;AAEA;IACI,YAAY;IACZ,aAAa;IACb,kBAAkB;AACtB;;AAEA;IACI,SAAS;AACb",sourcesContent:[".ui-app-header {\n\n}\n\n.ui-app-header-icon {\n width: 150px;\n height: 150px;\n margin-right: 20px;\n}\n\n.u2-panel {\n gap: 10px;\n}"],sourceRoot:""}]);const a=s},365:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(1354),o=n.n(i),r=n(6314),s=n.n(r)()(o());s.push([t.id,".pep-textarea-box {\n position: relative;\n}\n\n.pep-textarea-box:hover .pep-snippet-editor-icon {\n visibility: visible;\n}\n\n.pep-snippet-editor-icon {\n position: absolute;\n top: 5px;\n visibility: hidden;\n margin: 5px;\n z-index: 1;\n}\n\n.pep-reset-icon {\n right: 10px;\n}\n\n.pep-snippet-editor-icon i {\n font-size: 13px;\n}\n\n.pep-snippet-editor-icon:hover {\n background-color: var(--steel-1);\n border-radius: 2px;\n}\n\n.pep-snippet-inline-icon i {\n font-size: 13px;\n}\n\n.pep-textinput {\n height: 50px;\n overflow: hidden;\n}\n\n#pep-hist-host #center {\n height: 131px;\n}\n\n#pep-hist-host > #root {\n height: unset;\n width: 100%;\n}\n\n#pep-viewer-title {\n height: 23px;\n font-size: 1.2rem;\n font-family: 'Roboto', 'Roboto Local', sans-serif;\n color: #4D5261;\n text-align: center;\n width: 100%;\n align-self: end;\n}\n\n.pep-help-icon {\n position: absolute;\n left: 5px;\n top: 1px;\n}\n","",{version:3,sources:["webpack://./src/styles.css"],names:[],mappings:"AAAA;EACE,kBAAkB;AACpB;;AAEA;EACE,mBAAmB;AACrB;;AAEA;EACE,kBAAkB;EAClB,QAAQ;EACR,kBAAkB;EAClB,WAAW;EACX,UAAU;AACZ;;AAEA;EACE,WAAW;AACb;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,gCAAgC;EAChC,kBAAkB;AACpB;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,YAAY;EACZ,gBAAgB;AAClB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,aAAa;EACb,WAAW;AACb;;AAEA;EACE,YAAY;EACZ,iBAAiB;EACjB,iDAAiD;EACjD,cAAc;EACd,kBAAkB;EAClB,WAAW;EACX,eAAe;AACjB;;AAEA;EACE,kBAAkB;EAClB,SAAS;EACT,QAAQ;AACV",sourcesContent:[".pep-textarea-box {\n position: relative;\n}\n\n.pep-textarea-box:hover .pep-snippet-editor-icon {\n visibility: visible;\n}\n\n.pep-snippet-editor-icon {\n position: absolute;\n top: 5px;\n visibility: hidden;\n margin: 5px;\n z-index: 1;\n}\n\n.pep-reset-icon {\n right: 10px;\n}\n\n.pep-snippet-editor-icon i {\n font-size: 13px;\n}\n\n.pep-snippet-editor-icon:hover {\n background-color: var(--steel-1);\n border-radius: 2px;\n}\n\n.pep-snippet-inline-icon i {\n font-size: 13px;\n}\n\n.pep-textinput {\n height: 50px;\n overflow: hidden;\n}\n\n#pep-hist-host #center {\n height: 131px;\n}\n\n#pep-hist-host > #root {\n height: unset;\n width: 100%;\n}\n\n#pep-viewer-title {\n height: 23px;\n font-size: 1.2rem;\n font-family: 'Roboto', 'Roboto Local', sans-serif;\n color: #4D5261;\n text-align: center;\n width: 100%;\n align-self: end;\n}\n\n.pep-help-icon {\n position: absolute;\n left: 5px;\n top: 1px;\n}\n"],sourceRoot:""}]);const a=s},6314:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,i,o,r){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(s[l]=!0)}for(var u=0;u<t.length;u++){var c=[].concat(t[u]);i&&s[c[0]]||(void 0!==r&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=r),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),e.push(c))}},e}},1354:t=>{"use strict";t.exports=function(t){var e=t[1],n=t[3];if(!n)return e;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),o="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),r="/*# ".concat(o," */");return[e].concat([r]).join("\n")}return[e].join("\n")}},9982:function(t,e,n){var i;!function(e,o){var r={};!function(t){"use strict";t.__esModule=!0,t.digestLength=32,t.blockSize=64;var e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(t,n,i,o,r){for(var s,a,l,u,c,d,f,h,m,g,p,v,y;r>=64;){for(s=n[0],a=n[1],l=n[2],u=n[3],c=n[4],d=n[5],f=n[6],h=n[7],g=0;g<16;g++)p=o+4*g,t[g]=(255&i[p])<<24|(255&i[p+1])<<16|(255&i[p+2])<<8|255&i[p+3];for(g=16;g<64;g++)v=((m=t[g-2])>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,y=((m=t[g-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>3,t[g]=(v+t[g-7]|0)+(y+t[g-16]|0);for(g=0;g<64;g++)v=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&d^~c&f)|0)+(h+(e[g]+t[g]|0)|0)|0,y=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&a^s&l^a&l)|0,h=f,f=d,d=c,c=u+v|0,u=l,l=a,a=s,s=v+y|0;n[0]+=s,n[1]+=a,n[2]+=l,n[3]+=u,n[4]+=c,n[5]+=d,n[6]+=f,n[7]+=h,o+=64,r-=64}return o}var i=function(){function e(){this.digestLength=t.digestLength,this.blockSize=t.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return e.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},e.prototype.clean=function(){for(var t=0;t<this.buffer.length;t++)this.buffer[t]=0;for(t=0;t<this.temp.length;t++)this.temp[t]=0;this.reset()},e.prototype.update=function(t,e){if(void 0===e&&(e=t.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var i=0;if(this.bytesHashed+=e,this.bufferLength>0){for(;this.bufferLength<64&&e>0;)this.buffer[this.bufferLength++]=t[i++],e--;64===this.bufferLength&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(e>=64&&(i=n(this.temp,this.state,t,i,e),e%=64);e>0;)this.buffer[this.bufferLength++]=t[i++],e--;return this},e.prototype.finish=function(t){if(!this.finished){var e=this.bytesHashed,i=this.bufferLength,o=e/536870912|0,r=e<<3,s=e%64<56?64:128;this.buffer[i]=128;for(var a=i+1;a<s-8;a++)this.buffer[a]=0;this.buffer[s-8]=o>>>24&255,this.buffer[s-7]=o>>>16&255,this.buffer[s-6]=o>>>8&255,this.buffer[s-5]=o>>>0&255,this.buffer[s-4]=r>>>24&255,this.buffer[s-3]=r>>>16&255,this.buffer[s-2]=r>>>8&255,this.buffer[s-1]=r>>>0&255,n(this.temp,this.state,this.buffer,0,s),this.finished=!0}for(a=0;a<8;a++)t[4*a+0]=this.state[a]>>>24&255,t[4*a+1]=this.state[a]>>>16&255,t[4*a+2]=this.state[a]>>>8&255,t[4*a+3]=this.state[a]>>>0&255;return this},e.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},e.prototype._saveState=function(t){for(var e=0;e<this.state.length;e++)t[e]=this.state[e]},e.prototype._restoreState=function(t,e){for(var n=0;n<this.state.length;n++)this.state[n]=t[n];this.bytesHashed=e,this.finished=!1,this.bufferLength=0},e}();t.Hash=i;var o=function(){function t(t){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var e=new Uint8Array(this.blockSize);if(t.length>this.blockSize)(new i).update(t).finish(e).clean();else for(var n=0;n<t.length;n++)e[n]=t[n];for(n=0;n<e.length;n++)e[n]^=54;for(this.inner.update(e),n=0;n<e.length;n++)e[n]^=106;for(this.outer.update(e),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate),n=0;n<e.length;n++)e[n]=0}return t.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},t.prototype.clean=function(){for(var t=0;t<this.istate.length;t++)this.ostate[t]=this.istate[t]=0;this.inner.clean(),this.outer.clean()},t.prototype.update=function(t){return this.inner.update(t),this},t.prototype.finish=function(t){return this.outer.finished?this.outer.finish(t):(this.inner.finish(t),this.outer.update(t,this.digestLength).finish(t)),this},t.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},t}();function r(t){var e=(new i).update(t),n=e.digest();return e.clean(),n}function s(t,e){var n=new o(t).update(e),i=n.digest();return n.clean(),i}function a(t,e,n,i){var o=i[0];if(0===o)throw new Error("hkdf: cannot expand more");e.reset(),o>1&&e.update(t),n&&e.update(n),e.update(i),e.finish(t),i[0]++}t.HMAC=o,t.hash=r,t.default=r,t.hmac=s;var l=new Uint8Array(t.digestLength);t.hkdf=function(t,e,n,i){void 0===e&&(e=l),void 0===i&&(i=32);for(var r=new Uint8Array([1]),u=s(e,t),c=new o(u),d=new Uint8Array(c.digestLength),f=d.length,h=new Uint8Array(i),m=0;m<i;m++)f===d.length&&(a(d,c,n,r),f=0),h[m]=d[f++];return c.clean(),d.fill(0),r.fill(0),h},t.pbkdf2=function(t,e,n,i){for(var r=new o(t),s=r.digestLength,a=new Uint8Array(4),l=new Uint8Array(s),u=new Uint8Array(s),c=new Uint8Array(i),d=0;d*s<i;d++){var f=d+1;a[0]=f>>>24&255,a[1]=f>>>16&255,a[2]=f>>>8&255,a[3]=f>>>0&255,r.reset(),r.update(e),r.update(a),r.finish(u);for(var h=0;h<s;h++)l[h]=u[h];for(h=2;h<=n;h++){r.reset(),r.update(u).finish(u);for(var m=0;m<s;m++)l[m]^=u[m]}for(h=0;h<s&&d*s+h<i;h++)c[d*s+h]=l[h]}for(d=0;d<s;d++)l[d]=u[d]=0;for(d=0;d<4;d++)a[d]=0;return r.clean(),c}}(r);var s=r.default;for(var a in r)s[a]=r[a];"object"==typeof t.exports?t.exports=s:void 0===(i=function(){return s}.call(r,n,r,t))||(t.exports=i)}()},6572:function(t){var e;t.exports=(e=function(t,e){var n=Array.prototype.concat,i=Array.prototype.slice,o=Object.prototype.toString;function r(e,n){var i=e>n?e:n;return t.pow(10,17-~~(t.log(i>0?i:-i)*t.LOG10E))}var s=Array.isArray||function(t){return"[object Array]"===o.call(t)};function a(t){return"[object Function]"===o.call(t)}function l(t){return"number"==typeof t&&t-t==0}function u(){return new u._init(arguments)}function c(){return 0}function d(){return 1}function f(t,e){return t===e?1:0}u.fn=u.prototype,u._init=function(t){if(s(t[0]))if(s(t[0][0])){a(t[1])&&(t[0]=u.map(t[0],t[1]));for(var e=0;e<t[0].length;e++)this[e]=t[0][e];this.length=t[0].length}else this[0]=a(t[1])?u.map(t[0],t[1]):t[0],this.length=1;else if(l(t[0]))this[0]=u.seq.apply(null,t),this.length=1;else{if(t[0]instanceof u)return u(t[0].toArray());this[0]=[],this.length=1}return this},u._init.prototype=u.prototype,u._init.constructor=u,u.utils={calcRdx:r,isArray:s,isFunction:a,isNumber:l,toVector:function(t){return n.apply([],t)}},u._random_fn=t.random,u.setRandom=function(t){if("function"!=typeof t)throw new TypeError("fn is not a function");u._random_fn=t},u.extend=function(t){var e,n;if(1===arguments.length){for(n in t)u[n]=t[n];return this}for(e=1;e<arguments.length;e++)for(n in arguments[e])t[n]=arguments[e][n];return t},u.rows=function(t){return t.length||1},u.cols=function(t){return t[0].length||1},u.dimensions=function(t){return{rows:u.rows(t),cols:u.cols(t)}},u.row=function(t,e){return s(e)?e.map((function(e){return u.row(t,e)})):t[e]},u.rowa=function(t,e){return u.row(t,e)},u.col=function(t,e){if(s(e)){var n=u.arange(t.length).map((function(){return new Array(e.length)}));return e.forEach((function(e,i){u.arange(t.length).forEach((function(o){n[o][i]=t[o][e]}))})),n}for(var i=new Array(t.length),o=0;o<t.length;o++)i[o]=[t[o][e]];return i},u.cola=function(t,e){return u.col(t,e).map((function(t){return t[0]}))},u.diag=function(t){for(var e=u.rows(t),n=new Array(e),i=0;i<e;i++)n[i]=[t[i][i]];return n},u.antidiag=function(t){for(var e=u.rows(t)-1,n=new Array(e),i=0;e>=0;e--,i++)n[i]=[t[i][e]];return n},u.transpose=function(t){var e,n,i,o,r,a=[];for(s(t[0])||(t=[t]),n=t.length,i=t[0].length,r=0;r<i;r++){for(e=new Array(n),o=0;o<n;o++)e[o]=t[o][r];a.push(e)}return 1===a.length?a[0]:a},u.map=function(t,e,n){var i,o,r,a,l;for(s(t[0])||(t=[t]),o=t.length,r=t[0].length,a=n?t:new Array(o),i=0;i<o;i++)for(a[i]||(a[i]=new Array(r)),l=0;l<r;l++)a[i][l]=e(t[i][l],i,l);return 1===a.length?a[0]:a},u.cumreduce=function(t,e,n){var i,o,r,a,l;for(s(t[0])||(t=[t]),o=t.length,r=t[0].length,a=n?t:new Array(o),i=0;i<o;i++)for(a[i]||(a[i]=new Array(r)),r>0&&(a[i][0]=t[i][0]),l=1;l<r;l++)a[i][l]=e(a[i][l-1],t[i][l]);return 1===a.length?a[0]:a},u.alter=function(t,e){return u.map(t,e,!0)},u.create=function(t,e,n){var i,o,r=new Array(t);for(a(e)&&(n=e,e=t),i=0;i<t;i++)for(r[i]=new Array(e),o=0;o<e;o++)r[i][o]=n(i,o);return r},u.zeros=function(t,e){return l(e)||(e=t),u.create(t,e,c)},u.ones=function(t,e){return l(e)||(e=t),u.create(t,e,d)},u.rand=function(t,e){return l(e)||(e=t),u.create(t,e,u._random_fn)},u.identity=function(t,e){return l(e)||(e=t),u.create(t,e,f)},u.symmetric=function(t){var e,n,i=t.length;if(t.length!==t[0].length)return!1;for(e=0;e<i;e++)for(n=0;n<i;n++)if(t[n][e]!==t[e][n])return!1;return!0},u.clear=function(t){return u.alter(t,c)},u.seq=function(t,e,n,i){a(i)||(i=!1);var o,s=[],l=r(t,e),u=(e*l-t*l)/((n-1)*l),c=t;for(o=0;c<=e&&o<n;c=(t*l+u*l*++o)/l)s.push(i?i(c,o):c);return s},u.arange=function(t,n,i){var o,r=[];if(i=i||1,n===e&&(n=t,t=0),t===n||0===i)return[];if(t<n&&i<0)return[];if(t>n&&i>0)return[];if(i>0)for(o=t;o<n;o+=i)r.push(o);else for(o=t;o>n;o+=i)r.push(o);return r},u.slice=function(){function t(t,n,i,o){var r,s=[],a=t.length;if(n===e&&i===e&&o===e)return u.copy(t);if(o=o||1,(n=(n=n||0)>=0?n:a+n)===(i=(i=i||t.length)>=0?i:a+i)||0===o)return[];if(n<i&&o<0)return[];if(n>i&&o>0)return[];if(o>0)for(r=n;r<i;r+=o)s.push(t[r]);else for(r=n;r>i;r+=o)s.push(t[r]);return s}return function(e,n){var i,o;return l((n=n||{}).row)?l(n.col)?e[n.row][n.col]:t(u.rowa(e,n.row),(i=n.col||{}).start,i.end,i.step):l(n.col)?t(u.cola(e,n.col),(o=n.row||{}).start,o.end,o.step):(o=n.row||{},i=n.col||{},t(e,o.start,o.end,o.step).map((function(e){return t(e,i.start,i.end,i.step)})))}}(),u.sliceAssign=function(n,i,o){var r,s;if(l(i.row)){if(l(i.col))return n[i.row][i.col]=o;i.col=i.col||{},i.col.start=i.col.start||0,i.col.end=i.col.end||n[0].length,i.col.step=i.col.step||1,r=u.arange(i.col.start,t.min(n.length,i.col.end),i.col.step);var a=i.row;return r.forEach((function(t,e){n[a][t]=o[e]})),n}if(l(i.col)){i.row=i.row||{},i.row.start=i.row.start||0,i.row.end=i.row.end||n.length,i.row.step=i.row.step||1,s=u.arange(i.row.start,t.min(n[0].length,i.row.end),i.row.step);var c=i.col;return s.forEach((function(t,e){n[t][c]=o[e]})),n}return o[0].length===e&&(o=[o]),i.row.start=i.row.start||0,i.row.end=i.row.end||n.length,i.row.step=i.row.step||1,i.col.start=i.col.start||0,i.col.end=i.col.end||n[0].length,i.col.step=i.col.step||1,s=u.arange(i.row.start,t.min(n.length,i.row.end),i.row.step),r=u.arange(i.col.start,t.min(n[0].length,i.col.end),i.col.step),s.forEach((function(t,e){r.forEach((function(i,r){n[t][i]=o[e][r]}))})),n},u.diagonal=function(t){var e=u.zeros(t.length,t.length);return t.forEach((function(t,n){e[n][n]=t})),e},u.copy=function(t){return t.map((function(t){return l(t)?t:t.map((function(t){return t}))}))};var h=u.prototype;return h.length=0,h.push=Array.prototype.push,h.sort=Array.prototype.sort,h.splice=Array.prototype.splice,h.slice=Array.prototype.slice,h.toArray=function(){return this.length>1?i.call(this):i.call(this)[0]},h.map=function(t,e){return u(u.map(this,t,e))},h.cumreduce=function(t,e){return u(u.cumreduce(this,t,e))},h.alter=function(t){return u.alter(this,t),this},function(t){for(var e=0;e<t.length;e++)!function(t){h[t]=function(e){var n,i=this;return e?(setTimeout((function(){e.call(i,h[t].call(i))})),this):(n=u[t](this),s(n)?u(n):n)}}(t[e])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){h[t]=function(e,n){var i=this;return n?(setTimeout((function(){n.call(i,h[t].call(i,e))})),this):u(u[t](this,e))}}(t[e])}("row col".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){h[t]=function(){return u(u[t].apply(null,arguments))}}(t[e])}("create zeros ones rand identity".split(" ")),u}(Math),function(t,e){var n=t.utils.isFunction;function i(t,e){return t-e}function o(t,n,i){return e.max(n,e.min(t,i))}t.sum=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n];return e},t.sumsqrd=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n]*t[n];return e},t.sumsqerr=function(e){for(var n,i=t.mean(e),o=0,r=e.length;--r>=0;)o+=(n=e[r]-i)*n;return o},t.sumrow=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n];return e},t.product=function(t){for(var e=1,n=t.length;--n>=0;)e*=t[n];return e},t.min=function(t){for(var e=t[0],n=0;++n<t.length;)t[n]<e&&(e=t[n]);return e},t.max=function(t){for(var e=t[0],n=0;++n<t.length;)t[n]>e&&(e=t[n]);return e},t.unique=function(t){for(var e={},n=[],i=0;i<t.length;i++)e[t[i]]||(e[t[i]]=!0,n.push(t[i]));return n},t.mean=function(e){return t.sum(e)/e.length},t.meansqerr=function(e){return t.sumsqerr(e)/e.length},t.geomean=function(n){var i=n.map(e.log),o=t.mean(i);return e.exp(o)},t.median=function(t){var e=t.length,n=t.slice().sort(i);return 1&e?n[e/2|0]:(n[e/2-1]+n[e/2])/2},t.cumsum=function(e){return t.cumreduce(e,(function(t,e){return t+e}))},t.cumprod=function(e){return t.cumreduce(e,(function(t,e){return t*e}))},t.diff=function(t){var e,n=[],i=t.length;for(e=1;e<i;e++)n.push(t[e]-t[e-1]);return n},t.rank=function(t){var e,n=[],o={};for(e=0;e<t.length;e++)o[l=t[e]]?o[l]++:(o[l]=1,n.push(l));var r=n.sort(i),s={},a=1;for(e=0;e<r.length;e++){var l,u=o[l=r[e]],c=(a+(a+u-1))/2;s[l]=c,a+=u}return t.map((function(t){return s[t]}))},t.mode=function(t){var e,n=t.length,o=t.slice().sort(i),r=1,s=0,a=0,l=[];for(e=0;e<n;e++)o[e]===o[e+1]?r++:(r>s?(l=[o[e]],s=r,a=0):r===s&&(l.push(o[e]),a++),r=1);return 0===a?l[0]:l},t.range=function(e){return t.max(e)-t.min(e)},t.variance=function(e,n){return t.sumsqerr(e)/(e.length-(n?1:0))},t.pooledvariance=function(e){return e.reduce((function(e,n){return e+t.sumsqerr(n)}),0)/(e.reduce((function(t,e){return t+e.length}),0)-e.length)},t.deviation=function(e){for(var n=t.mean(e),i=e.length,o=new Array(i),r=0;r<i;r++)o[r]=e[r]-n;return o},t.stdev=function(n,i){return e.sqrt(t.variance(n,i))},t.pooledstdev=function(n){return e.sqrt(t.pooledvariance(n))},t.meandev=function(n){for(var i=t.mean(n),o=[],r=n.length-1;r>=0;r--)o.push(e.abs(n[r]-i));return t.mean(o)},t.meddev=function(n){for(var i=t.median(n),o=[],r=n.length-1;r>=0;r--)o.push(e.abs(n[r]-i));return t.median(o)},t.coeffvar=function(e){return t.stdev(e)/t.mean(e)},t.quartiles=function(t){var n=t.length,o=t.slice().sort(i);return[o[e.round(n/4)-1],o[e.round(n/2)-1],o[e.round(3*n/4)-1]]},t.quantiles=function(t,n,r,s){var a,l,u,c,d,f=t.slice().sort(i),h=[n.length],m=t.length;for(void 0===r&&(r=3/8),void 0===s&&(s=3/8),a=0;a<n.length;a++)u=m*(l=n[a])+(r+l*(1-r-s)),c=e.floor(o(u,1,m-1)),d=o(u-c,0,1),h[a]=(1-d)*f[c-1]+d*f[c];return h},t.percentile=function(t,e,n){var o=t.slice().sort(i),r=e*(o.length+(n?1:-1))+(n?0:1),s=parseInt(r),a=r-s;return s+1<o.length?o[s-1]+a*(o[s]-o[s-1]):o[s-1]},t.percentileOfScore=function(t,e,n){var i,o,r=0,s=t.length,a=!1;for("strict"===n&&(a=!0),o=0;o<s;o++)i=t[o],(a&&i<e||!a&&i<=e)&&r++;return r/s},t.histogram=function(n,i){i=i||4;var o,r=t.min(n),s=(t.max(n)-r)/i,a=n.length,l=[];for(o=0;o<i;o++)l[o]=0;for(o=0;o<a;o++)l[e.min(e.floor((n[o]-r)/s),i-1)]+=1;return l},t.covariance=function(e,n){var i,o=t.mean(e),r=t.mean(n),s=e.length,a=new Array(s);for(i=0;i<s;i++)a[i]=(e[i]-o)*(n[i]-r);return t.sum(a)/(s-1)},t.corrcoeff=function(e,n){return t.covariance(e,n)/t.stdev(e,1)/t.stdev(n,1)},t.spearmancoeff=function(e,n){return e=t.rank(e),n=t.rank(n),t.corrcoeff(e,n)},t.stanMoment=function(n,i){for(var o=t.mean(n),r=t.stdev(n),s=n.length,a=0,l=0;l<s;l++)a+=e.pow((n[l]-o)/r,i);return a/n.length},t.skewness=function(e){return t.stanMoment(e,3)},t.kurtosis=function(e){return t.stanMoment(e,4)-3};var r=t.prototype;!function(e){for(var i=0;i<e.length;i++)!function(e){r[e]=function(i,o){var s=[],a=0,l=this;if(n(i)&&(o=i,i=!1),o)return setTimeout((function(){o.call(l,r[e].call(l,i))})),this;if(this.length>1){for(l=!0===i?this:this.transpose();a<l.length;a++)s[a]=t[e](l[a]);return s}return t[e](this[0],i)}}(e[i])}("cumsum cumprod".split(" ")),function(e){for(var i=0;i<e.length;i++)!function(e){r[e]=function(i,o){var s=[],a=0,l=this;if(n(i)&&(o=i,i=!1),o)return setTimeout((function(){o.call(l,r[e].call(l,i))})),this;if(this.length>1){for("sumrow"!==e&&(l=!0===i?this:this.transpose());a<l.length;a++)s[a]=t[e](l[a]);return!0===i?t[e](t.utils.toVector(s)):s}return t[e](this[0],i)}}(e[i])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(e){for(var i=0;i<e.length;i++)!function(e){r[e]=function(){var i,o=[],s=0,a=this,l=Array.prototype.slice.call(arguments);if(n(l[l.length-1])){i=l[l.length-1];var u=l.slice(0,l.length-1);return setTimeout((function(){i.call(a,r[e].apply(a,u))})),this}i=void 0;var c=function(n){return t[e].apply(a,[n].concat(l))};if(this.length>1){for(a=a.transpose();s<a.length;s++)o[s]=c(a[s]);return o}return c(this[0])}}(e[i])}("quantiles percentileOfScore".split(" "))}(e,Math),function(t,e){t.gammaln=function(t){var n,i,o,r=0,s=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],a=1.000000000190015;for(o=(i=n=t)+5.5,o-=(n+.5)*e.log(o);r<6;r++)a+=s[r]/++i;return e.log(2.5066282746310007*a/n)-o},t.loggam=function(t){var n,i,o,r,s,a,l,u=[.08333333333333333,-.002777777777777778,.0007936507936507937,-.0005952380952380952,.0008417508417508418,-.001917526917526918,.00641025641025641,-.02955065359477124,.1796443723688307,-1.3924322169059];if(n=t,l=0,1==t||2==t)return 0;for(t<=7&&(n=t+(l=e.floor(7-t))),i=1/(n*n),o=2*e.PI,s=u[9],a=8;a>=0;a--)s*=i,s+=u[a];if(r=s/n+.5*e.log(o)+(n-.5)*e.log(n)-n,t<=7)for(a=1;a<=l;a++)r-=e.log(n-1),n-=1;return r},t.gammafn=function(t){var n,i,o,r,s=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],a=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],l=!1,u=0,c=0,d=0,f=t;if(t>171.6243769536076)return 1/0;if(f<=0){if(!(r=f%1+36e-17))return 1/0;l=(1&f?-1:1)*e.PI/e.sin(e.PI*r),f=1-f}for(o=f,i=f<1?f++:(f-=u=(0|f)-1)-1,n=0;n<8;++n)d=(d+s[n])*i,c=c*i+a[n];if(r=d/c+1,o<f)r/=o;else if(o>f)for(n=0;n<u;++n)r*=f,f++;return l&&(r=l/r),r},t.gammap=function(e,n){return t.lowRegGamma(e,n)*t.gammafn(e)},t.lowRegGamma=function(n,i){var o,r=t.gammaln(n),s=n,a=1/n,l=a,u=i+1-n,c=1/1e-30,d=1/u,f=d,h=1,m=-~(8.5*e.log(n>=1?n:1/n)+.4*n+17);if(i<0||n<=0)return NaN;if(i<n+1){for(;h<=m;h++)a+=l*=i/++s;return a*e.exp(-i+n*e.log(i)-r)}for(;h<=m;h++)f*=(d=1/(d=(o=-h*(h-n))*d+(u+=2)))*(c=u+o/c);return 1-f*e.exp(-i+n*e.log(i)-r)},t.factorialln=function(e){return e<0?NaN:t.gammaln(e+1)},t.factorial=function(e){return e<0?NaN:t.gammafn(e+1)},t.combination=function(n,i){return n>170||i>170?e.exp(t.combinationln(n,i)):t.factorial(n)/t.factorial(i)/t.factorial(n-i)},t.combinationln=function(e,n){return t.factorialln(e)-t.factorialln(n)-t.factorialln(e-n)},t.permutation=function(e,n){return t.factorial(e)/t.factorial(e-n)},t.betafn=function(n,i){if(!(n<=0||i<=0))return n+i>170?e.exp(t.betaln(n,i)):t.gammafn(n)*t.gammafn(i)/t.gammafn(n+i)},t.betaln=function(e,n){return t.gammaln(e)+t.gammaln(n)-t.gammaln(e+n)},t.betacf=function(t,n,i){var o,r,s,a,l=1e-30,u=1,c=n+i,d=n+1,f=n-1,h=1,m=1-c*t/d;for(e.abs(m)<l&&(m=l),a=m=1/m;u<=100&&(m=1+(r=u*(i-u)*t/((f+(o=2*u))*(n+o)))*m,e.abs(m)<l&&(m=l),h=1+r/h,e.abs(h)<l&&(h=l),a*=(m=1/m)*h,m=1+(r=-(n+u)*(c+u)*t/((n+o)*(d+o)))*m,e.abs(m)<l&&(m=l),h=1+r/h,e.abs(h)<l&&(h=l),a*=s=(m=1/m)*h,!(e.abs(s-1)<3e-7));u++);return a},t.gammapinv=function(n,i){var o,r,s,a,l,u,c=0,d=i-1,f=t.gammaln(i);if(n>=1)return e.max(100,i+100*e.sqrt(i));if(n<=0)return 0;for(i>1?(l=e.log(d),u=e.exp(d*(l-1)-f),a=n<.5?n:1-n,o=(2.30753+.27061*(r=e.sqrt(-2*e.log(a))))/(1+r*(.99229+.04481*r))-r,n<.5&&(o=-o),o=e.max(.001,i*e.pow(1-1/(9*i)-o/(3*e.sqrt(i)),3))):o=n<(r=1-i*(.253+.12*i))?e.pow(n/r,1/i):1-e.log(1-(n-r)/(1-r));c<12;c++){if(o<=0)return 0;if((o-=r=(s=(t.lowRegGamma(i,o)-n)/(r=i>1?u*e.exp(-(o-d)+d*(e.log(o)-l)):e.exp(-o+d*e.log(o)-f)))/(1-.5*e.min(1,s*((i-1)/o-1))))<=0&&(o=.5*(o+r)),e.abs(r)<1e-8*o)break}return o},t.erf=function(t){var n,i,o,r,s=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],a=s.length-1,l=!1,u=0,c=0;for(t<0&&(t=-t,l=!0),i=4*(n=2/(2+t))-2;a>0;a--)o=u,u=i*u-c+s[a],c=o;return r=n*e.exp(-t*t+.5*(s[0]+i*u)-c),l?r-1:1-r},t.erfc=function(e){return 1-t.erf(e)},t.erfcinv=function(n){var i,o,r,s,a=0;if(n>=2)return-100;if(n<=0)return 100;for(s=n<1?n:2-n,i=-.70711*((2.30753+.27061*(r=e.sqrt(-2*e.log(s/2))))/(1+r*(.99229+.04481*r))-r);a<2;a++)i+=(o=t.erfc(i)-s)/(1.1283791670955126*e.exp(-i*i)-i*o);return n<1?i:-i},t.ibetainv=function(n,i,o){var r,s,a,l,u,c,d,f,h,m,g=i-1,p=o-1,v=0;if(n<=0)return 0;if(n>=1)return 1;for(i>=1&&o>=1?(a=n<.5?n:1-n,c=(2.30753+.27061*(l=e.sqrt(-2*e.log(a))))/(1+l*(.99229+.04481*l))-l,n<.5&&(c=-c),d=(c*c-3)/6,f=2/(1/(2*i-1)+1/(2*o-1)),h=c*e.sqrt(d+f)/f-(1/(2*o-1)-1/(2*i-1))*(d+5/6-2/(3*f)),c=i/(i+o*e.exp(2*h))):(r=e.log(i/(i+o)),s=e.log(o/(i+o)),c=n<(l=e.exp(i*r)/i)/(h=l+(u=e.exp(o*s)/o))?e.pow(i*h*n,1/i):1-e.pow(o*h*(1-n),1/o)),m=-t.gammaln(i)-t.gammaln(o)+t.gammaln(i+o);v<10;v++){if(0===c||1===c)return c;if((c-=l=(u=(t.ibeta(c,i,o)-n)/(l=e.exp(g*e.log(c)+p*e.log(1-c)+m)))/(1-.5*e.min(1,u*(g/c-p/(1-c)))))<=0&&(c=.5*(c+l)),c>=1&&(c=.5*(c+l+1)),e.abs(l)<1e-8*c&&v>0)break}return c},t.ibeta=function(n,i,o){var r=0===n||1===n?0:e.exp(t.gammaln(i+o)-t.gammaln(i)-t.gammaln(o)+i*e.log(n)+o*e.log(1-n));return!(n<0||n>1)&&(n<(i+1)/(i+o+2)?r*t.betacf(n,i,o)/i:1-r*t.betacf(1-n,o,i)/o)},t.randn=function(n,i){var o,r,s,a,l;if(i||(i=n),n)return t.create(n,i,(function(){return t.randn()}));do{o=t._random_fn(),r=1.7156*(t._random_fn()-.5),l=(s=o-.449871)*s+(a=e.abs(r)+.386595)*(.196*a-.25472*s)}while(l>.27597&&(l>.27846||r*r>-4*e.log(o)*o*o));return r/o},t.randg=function(n,i,o){var r,s,a,l,u,c,d=n;if(o||(o=i),n||(n=1),i)return(c=t.zeros(i,o)).alter((function(){return t.randg(n)})),c;n<1&&(n+=1),r=n-1/3,s=1/e.sqrt(9*r);do{do{l=1+s*(u=t.randn())}while(l<=0);l*=l*l,a=t._random_fn()}while(a>1-.331*e.pow(u,4)&&e.log(a)>.5*u*u+r*(1-l+e.log(l)));if(n==d)return r*l;do{a=t._random_fn()}while(0===a);return e.pow(a,1/d)*r*l},function(e){for(var n=0;n<e.length;n++)!function(e){t.fn[e]=function(){return t(t.map(this,(function(n){return t[e](n)})))}}(e[n])}("gammaln gammafn factorial factorialln".split(" ")),function(e){for(var n=0;n<e.length;n++)!function(e){t.fn[e]=function(){return t(t[e].apply(null,arguments))}}(e[n])}("randn".split(" "))}(e,Math),function(t,e){function n(t,n,i,o){for(var r,s=0,a=1,l=1,u=1,c=0,d=0;e.abs((l-d)/l)>o;)d=l,a=u+(r=-(n+c)*(n+i+c)*t/(n+2*c)/(n+2*c+1))*a,l=(s=l+r*s)+(r=(c+=1)*(i-c)*t/(n+2*c-1)/(n+2*c))*l,s/=u=a+r*u,a/=u,l/=u,u=1;return l/n}function i(n,i,o){var r=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],s=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],a=.5*n;if(a>=8)return 1;var l,u=2*t.normal.cdf(a,0,1,1,0)-1;u=u>=e.exp(-50/o)?e.pow(u,o):0;for(var c=a,d=(8-a)/(l=n>3?2:3),f=c+d,h=0,m=o-1,g=1;g<=l;g++){for(var p=0,v=.5*(f+c),y=.5*(f-c),C=1;C<=12;C++){var w,b=v+y*(6<C?r[(w=12-C+1)-1]:-r[(w=C)-1]),A=b*b;if(A>60)break;var S=2*t.normal.cdf(b,0,1,1,0)*.5-2*t.normal.cdf(b,n,1,1,0)*.5;S>=e.exp(-30/m)&&(p+=S=s[w-1]*e.exp(-.5*A)*e.pow(S,m))}h+=p*=2*y*o/e.sqrt(2*e.PI),c=f,f+=d}return(u+=h)<=e.exp(-30/i)?0:(u=e.pow(u,i))>=1?1:u}!function(e){for(var n=0;n<e.length;n++)!function(e){t[e]=function t(e,n,i){return this instanceof t?(this._a=e,this._b=n,this._c=i,this):new t(e,n,i)},t.fn[e]=function(n,i,o){var r=t[e](n,i,o);return r.data=this,r},t[e].prototype.sample=function(n){var i=this._a,o=this._b,r=this._c;return n?t.alter(n,(function(){return t[e].sample(i,o,r)})):t[e].sample(i,o,r)},function(n){for(var i=0;i<n.length;i++)!function(n){t[e].prototype[n]=function(i){var o=this._a,r=this._b,s=this._c;return i||0===i||(i=this.data),"number"!=typeof i?t.fn.map.call(i,(function(i){return t[e][n](i,o,r,s)})):t[e][n](i,o,r,s)}}(n[i])}("pdf cdf inv".split(" ")),function(n){for(var i=0;i<n.length;i++)!function(n){t[e].prototype[n]=function(){return t[e][n](this._a,this._b,this._c)}}(n[i])}("mean median mode variance".split(" "))}(e[n])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),t.extend(t.beta,{pdf:function(n,i,o){return n>1||n<0?0:1==i&&1==o?1:i<512&&o<512?e.pow(n,i-1)*e.pow(1-n,o-1)/t.betafn(i,o):e.exp((i-1)*e.log(n)+(o-1)*e.log(1-n)-t.betaln(i,o))},cdf:function(e,n,i){return e>1||e<0?1*(e>1):t.ibeta(e,n,i)},inv:function(e,n,i){return t.ibetainv(e,n,i)},mean:function(t,e){return t/(t+e)},median:function(e,n){return t.ibetainv(.5,e,n)},mode:function(t,e){return(t-1)/(t+e-2)},sample:function(e,n){var i=t.randg(e);return i/(i+t.randg(n))},variance:function(t,n){return t*n/(e.pow(t+n,2)*(t+n+1))}}),t.extend(t.centralF,{pdf:function(n,i,o){var r;return n<0?0:i<=2?0===n&&i<2?1/0:0===n&&2===i?1:1/t.betafn(i/2,o/2)*e.pow(i/o,i/2)*e.pow(n,i/2-1)*e.pow(1+i/o*n,-(i+o)/2):(r=i*n/(o+n*i),i*(o/(o+n*i))/2*t.binomial.pdf((i-2)/2,(i+o-2)/2,r))},cdf:function(e,n,i){return e<0?0:t.ibeta(n*e/(n*e+i),n/2,i/2)},inv:function(e,n,i){return i/(n*(1/t.ibetainv(e,n/2,i/2)-1))},mean:function(t,e){return e>2?e/(e-2):void 0},mode:function(t,e){return t>2?e*(t-2)/(t*(e+2)):void 0},sample:function(e,n){return 2*t.randg(e/2)/e/(2*t.randg(n/2)/n)},variance:function(t,e){if(!(e<=4))return 2*e*e*(t+e-2)/(t*(e-2)*(e-2)*(e-4))}}),t.extend(t.cauchy,{pdf:function(t,n,i){return i<0?0:i/(e.pow(t-n,2)+e.pow(i,2))/e.PI},cdf:function(t,n,i){return e.atan((t-n)/i)/e.PI+.5},inv:function(t,n,i){return n+i*e.tan(e.PI*(t-.5))},median:function(t){return t},mode:function(t){return t},sample:function(n,i){return t.randn()*e.sqrt(1/(2*t.randg(.5)))*i+n}}),t.extend(t.chisquare,{pdf:function(n,i){return n<0?0:0===n&&2===i?.5:e.exp((i/2-1)*e.log(n)-n/2-i/2*e.log(2)-t.gammaln(i/2))},cdf:function(e,n){return e<0?0:t.lowRegGamma(n/2,e/2)},inv:function(e,n){return 2*t.gammapinv(e,.5*n)},mean:function(t){return t},median:function(t){return t*e.pow(1-2/(9*t),3)},mode:function(t){return t-2>0?t-2:0},sample:function(e){return 2*t.randg(e/2)},variance:function(t){return 2*t}}),t.extend(t.exponential,{pdf:function(t,n){return t<0?0:n*e.exp(-n*t)},cdf:function(t,n){return t<0?0:1-e.exp(-n*t)},inv:function(t,n){return-e.log(1-t)/n},mean:function(t){return 1/t},median:function(t){return 1/t*e.log(2)},mode:function(){return 0},sample:function(n){return-1/n*e.log(t._random_fn())},variance:function(t){return e.pow(t,-2)}}),t.extend(t.gamma,{pdf:function(n,i,o){return n<0?0:0===n&&1===i?1/o:e.exp((i-1)*e.log(n)-n/o-t.gammaln(i)-i*e.log(o))},cdf:function(e,n,i){return e<0?0:t.lowRegGamma(n,e/i)},inv:function(e,n,i){return t.gammapinv(e,n)*i},mean:function(t,e){return t*e},mode:function(t,e){if(t>1)return(t-1)*e},sample:function(e,n){return t.randg(e)*n},variance:function(t,e){return t*e*e}}),t.extend(t.invgamma,{pdf:function(n,i,o){return n<=0?0:e.exp(-(i+1)*e.log(n)-o/n-t.gammaln(i)+i*e.log(o))},cdf:function(e,n,i){return e<=0?0:1-t.lowRegGamma(n,i/e)},inv:function(e,n,i){return i/t.gammapinv(1-e,n)},mean:function(t,e){return t>1?e/(t-1):void 0},mode:function(t,e){return e/(t+1)},sample:function(e,n){return n/t.randg(e)},variance:function(t,e){if(!(t<=2))return e*e/((t-1)*(t-1)*(t-2))}}),t.extend(t.kumaraswamy,{pdf:function(t,n,i){return 0===t&&1===n?i:1===t&&1===i?n:e.exp(e.log(n)+e.log(i)+(n-1)*e.log(t)+(i-1)*e.log(1-e.pow(t,n)))},cdf:function(t,n,i){return t<0?0:t>1?1:1-e.pow(1-e.pow(t,n),i)},inv:function(t,n,i){return e.pow(1-e.pow(1-t,1/i),1/n)},mean:function(e,n){return n*t.gammafn(1+1/e)*t.gammafn(n)/t.gammafn(1+1/e+n)},median:function(t,n){return e.pow(1-e.pow(2,-1/n),1/t)},mode:function(t,n){if(t>=1&&n>=1&&1!==t&&1!==n)return e.pow((t-1)/(t*n-1),1/t)},variance:function(){throw new Error("variance not yet implemented")}}),t.extend(t.lognormal,{pdf:function(t,n,i){return t<=0?0:e.exp(-e.log(t)-.5*e.log(2*e.PI)-e.log(i)-e.pow(e.log(t)-n,2)/(2*i*i))},cdf:function(n,i,o){return n<0?0:.5+.5*t.erf((e.log(n)-i)/e.sqrt(2*o*o))},inv:function(n,i,o){return e.exp(-1.4142135623730951*o*t.erfcinv(2*n)+i)},mean:function(t,n){return e.exp(t+n*n/2)},median:function(t){return e.exp(t)},mode:function(t,n){return e.exp(t-n*n)},sample:function(n,i){return e.exp(t.randn()*i+n)},variance:function(t,n){return(e.exp(n*n)-1)*e.exp(2*t+n*n)}}),t.extend(t.noncentralt,{pdf:function(n,i,o){return e.abs(o)<1e-14?t.studentt.pdf(n,i):e.abs(n)<1e-14?e.exp(t.gammaln((i+1)/2)-o*o/2-.5*e.log(e.PI*i)-t.gammaln(i/2)):i/n*(t.noncentralt.cdf(n*e.sqrt(1+2/i),i+2,o)-t.noncentralt.cdf(n,i,o))},cdf:function(n,i,o){var r=1e-14;if(e.abs(o)<r)return t.studentt.cdf(n,i);var s=!1;n<0&&(s=!0,o=-o);for(var a=t.normal.cdf(-o,0,1),l=r+1,u=l,c=n*n/(n*n+i),d=0,f=e.exp(-o*o/2),h=e.exp(-o*o/2-.5*e.log(2)-t.gammaln(1.5))*o;d<200||u>r||l>r;)u=l,d>0&&(f*=o*o/(2*d),h*=o*o/(2*(d+.5))),a+=.5*(l=f*t.beta.cdf(c,d+.5,i/2)+h*t.beta.cdf(c,d+1,i/2)),d++;return s?1-a:a}}),t.extend(t.normal,{pdf:function(t,n,i){return e.exp(-.5*e.log(2*e.PI)-e.log(i)-e.pow(t-n,2)/(2*i*i))},cdf:function(n,i,o){return.5*(1+t.erf((n-i)/e.sqrt(2*o*o)))},inv:function(e,n,i){return-1.4142135623730951*i*t.erfcinv(2*e)+n},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},sample:function(e,n){return t.randn()*n+e},variance:function(t,e){return e*e}}),t.extend(t.pareto,{pdf:function(t,n,i){return t<n?0:i*e.pow(n,i)/e.pow(t,i+1)},cdf:function(t,n,i){return t<n?0:1-e.pow(n/t,i)},inv:function(t,n,i){return n/e.pow(1-t,1/i)},mean:function(t,n){if(!(n<=1))return n*e.pow(t,n)/(n-1)},median:function(t,n){return t*(n*e.SQRT2)},mode:function(t){return t},variance:function(t,n){if(!(n<=2))return t*t*n/(e.pow(n-1,2)*(n-2))}}),t.extend(t.studentt,{pdf:function(n,i){return i=i>1e100?1e100:i,1/(e.sqrt(i)*t.betafn(.5,i/2))*e.pow(1+n*n/i,-(i+1)/2)},cdf:function(n,i){var o=i/2;return t.ibeta((n+e.sqrt(n*n+i))/(2*e.sqrt(n*n+i)),o,o)},inv:function(n,i){var o=t.ibetainv(2*e.min(n,1-n),.5*i,.5);return o=e.sqrt(i*(1-o)/o),n>.5?o:-o},mean:function(t){return t>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(n){return t.randn()*e.sqrt(n/(2*t.randg(n/2)))},variance:function(t){return t>2?t/(t-2):t>1?1/0:void 0}}),t.extend(t.weibull,{pdf:function(t,n,i){return t<0||n<0||i<0?0:i/n*e.pow(t/n,i-1)*e.exp(-e.pow(t/n,i))},cdf:function(t,n,i){return t<0?0:1-e.exp(-e.pow(t/n,i))},inv:function(t,n,i){return n*e.pow(-e.log(1-t),1/i)},mean:function(e,n){return e*t.gammafn(1+1/n)},median:function(t,n){return t*e.pow(e.log(2),1/n)},mode:function(t,n){return n<=1?0:t*e.pow((n-1)/n,1/n)},sample:function(n,i){return n*e.pow(-e.log(t._random_fn()),1/i)},variance:function(n,i){return n*n*t.gammafn(1+2/i)-e.pow(t.weibull.mean(n,i),2)}}),t.extend(t.uniform,{pdf:function(t,e,n){return t<e||t>n?0:1/(n-e)},cdf:function(t,e,n){return t<e?0:t<n?(t-e)/(n-e):1},inv:function(t,e,n){return e+t*(n-e)},mean:function(t,e){return.5*(t+e)},median:function(e,n){return t.mean(e,n)},mode:function(){throw new Error("mode is not yet implemented")},sample:function(e,n){return e/2+n/2+(n/2-e/2)*(2*t._random_fn()-1)},variance:function(t,n){return e.pow(n-t,2)/12}}),t.extend(t.binomial,{pdf:function(n,i,o){return 0===o||1===o?i*o===n?1:0:t.combination(i,n)*e.pow(o,n)*e.pow(1-o,i-n)},cdf:function(i,o,r){var s,a=1e-10;if(i<0)return 0;if(i>=o)return 1;if(r<0||r>1||o<=0)return NaN;var l=r,u=(i=e.floor(i))+1,c=o-i,d=u+c,f=e.exp(t.gammaln(d)-t.gammaln(c)-t.gammaln(u)+u*e.log(l)+c*e.log(1-l));return s=l<(u+1)/(d+2)?f*n(l,u,c,a):1-f*n(1-l,c,u,a),e.round(1/a*(1-s))/(1/a)}}),t.extend(t.negbin,{pdf:function(n,i,o){return n===n>>>0&&(n<0?0:t.combination(n+i-1,i-1)*e.pow(1-o,n)*e.pow(o,i))},cdf:function(e,n,i){var o=0,r=0;if(e<0)return 0;for(;r<=e;r++)o+=t.negbin.pdf(r,n,i);return o}}),t.extend(t.hypgeom,{pdf:function(n,i,o,r){if(n!=n|0)return!1;if(n<0||n<o-(i-r))return 0;if(n>r||n>o)return 0;if(2*o>i)return 2*r>i?t.hypgeom.pdf(i-o-r+n,i,i-o,i-r):t.hypgeom.pdf(r-n,i,i-o,r);if(2*r>i)return t.hypgeom.pdf(o-n,i,o,i-r);if(o<r)return t.hypgeom.pdf(n,i,r,o);for(var s=1,a=0,l=0;l<n;l++){for(;s>1&&a<r;)s*=1-o/(i-a),a++;s*=(r-l)*(o-l)/((l+1)*(i-o-r+l+1))}for(;a<r;a++)s*=1-o/(i-a);return e.min(1,e.max(0,s))},cdf:function(n,i,o,r){if(n<0||n<o-(i-r))return 0;if(n>=r||n>=o)return 1;if(2*o>i)return 2*r>i?t.hypgeom.cdf(i-o-r+n,i,i-o,i-r):1-t.hypgeom.cdf(r-n-1,i,i-o,r);if(2*r>i)return 1-t.hypgeom.cdf(o-n-1,i,o,i-r);if(o<r)return t.hypgeom.cdf(n,i,r,o);for(var s=1,a=1,l=0,u=0;u<n;u++){for(;s>1&&l<r;){var c=1-o/(i-l);a*=c,s*=c,l++}s+=a*=(r-u)*(o-u)/((u+1)*(i-o-r+u+1))}for(;l<r;l++)s*=1-o/(i-l);return e.min(1,e.max(0,s))}}),t.extend(t.poisson,{pdf:function(n,i){return i<0||n%1!=0||n<0?0:e.pow(i,n)*e.exp(-i)/t.factorial(n)},cdf:function(e,n){var i=[],o=0;if(e<0)return 0;for(;o<=e;o++)i.push(t.poisson.pdf(o,n));return t.sum(i)},mean:function(t){return t},variance:function(t){return t},sampleSmall:function(n){var i=1,o=0,r=e.exp(-n);do{o++,i*=t._random_fn()}while(i>r);return o-1},sampleLarge:function(n){var i,o,r,s,a,l,u,c,d,f,h=n;for(s=e.sqrt(h),a=e.log(h),l=.02483*(u=.931+2.53*s)-.059,c=1.1239+1.1328/(u-3.4),d=.9277-3.6224/(u-2);;){if(o=e.random()-.5,r=e.random(),f=.5-e.abs(o),i=e.floor((2*l/f+u)*o+h+.43),f>=.07&&r<=d)return i;if(!(i<0||f<.013&&r>f)&&e.log(r)+e.log(c)-e.log(l/(f*f)+u)<=i*a-h-t.loggam(i+1))return i}},sample:function(t){return t<10?this.sampleSmall(t):this.sampleLarge(t)}}),t.extend(t.triangular,{pdf:function(t,e,n,i){return n<=e||i<e||i>n?NaN:t<e||t>n?0:t<i?2*(t-e)/((n-e)*(i-e)):t===i?2/(n-e):2*(n-t)/((n-e)*(n-i))},cdf:function(t,n,i,o){return i<=n||o<n||o>i?NaN:t<=n?0:t>=i?1:t<=o?e.pow(t-n,2)/((i-n)*(o-n)):1-e.pow(i-t,2)/((i-n)*(i-o))},inv:function(t,n,i,o){return i<=n||o<n||o>i?NaN:t<=(o-n)/(i-n)?n+(i-n)*e.sqrt(t*((o-n)/(i-n))):n+(i-n)*(1-e.sqrt((1-t)*(1-(o-n)/(i-n))))},mean:function(t,e,n){return(t+e+n)/3},median:function(t,n,i){return i<=(t+n)/2?n-e.sqrt((n-t)*(n-i))/e.sqrt(2):i>(t+n)/2?t+e.sqrt((n-t)*(i-t))/e.sqrt(2):void 0},mode:function(t,e,n){return n},sample:function(n,i,o){var r=t._random_fn();return r<(o-n)/(i-n)?n+e.sqrt(r*(i-n)*(o-n)):i-e.sqrt((1-r)*(i-n)*(i-o))},variance:function(t,e,n){return(t*t+e*e+n*n-t*e-t*n-e*n)/18}}),t.extend(t.arcsine,{pdf:function(t,n,i){return i<=n?NaN:t<=n||t>=i?0:2/e.PI*e.pow(e.pow(i-n,2)-e.pow(2*t-n-i,2),-.5)},cdf:function(t,n,i){return t<n?0:t<i?2/e.PI*e.asin(e.sqrt((t-n)/(i-n))):1},inv:function(t,n,i){return n+(.5-.5*e.cos(e.PI*t))*(i-n)},mean:function(t,e){return e<=t?NaN:(t+e)/2},median:function(t,e){return e<=t?NaN:(t+e)/2},mode:function(){throw new Error("mode is not yet implemented")},sample:function(n,i){return(n+i)/2+(i-n)/2*e.sin(2*e.PI*t.uniform.sample(0,1))},variance:function(t,n){return n<=t?NaN:e.pow(n-t,2)/8}}),t.extend(t.laplace,{pdf:function(t,n,i){return i<=0?0:e.exp(-e.abs(t-n)/i)/(2*i)},cdf:function(t,n,i){return i<=0?0:t<n?.5*e.exp((t-n)/i):1-.5*e.exp(-(t-n)/i)},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},variance:function(t,e){return 2*e*e},sample:function(n,i){var o,r=t._random_fn()-.5;return n-i*((o=r)/e.abs(o))*e.log(1-2*e.abs(r))}}),t.extend(t.tukey,{cdf:function(n,o,r){var s=o,a=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],l=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(n<=0)return 0;if(r<2||s<2)return NaN;if(!Number.isFinite(n))return 1;if(r>25e3)return i(n,1,s);var u,c=.5*r,d=c*e.log(r)-r*e.log(2)-t.gammaln(c),f=c-1,h=.25*r;u=r<=100?1:r<=800?.5:r<=5e3?.25:.125,d+=e.log(u);for(var m=0,g=1;g<=50;g++){for(var p=0,v=(2*g-1)*u,y=1;y<=16;y++){var C,w;8<y?(C=y-8-1,w=d+f*e.log(v+a[C]*u)-(a[C]*u+v)*h):(C=y-1,w=d+f*e.log(v-a[C]*u)+(a[C]*u-v)*h),w>=-30&&(p+=i(8<y?n*e.sqrt(.5*(a[C]*u+v)):n*e.sqrt(.5*(-a[C]*u+v)),1,s)*l[C]*e.exp(w))}if(g*u>=1&&p<=1e-14)break;m+=p}if(p>1e-14)throw new Error("tukey.cdf failed to converge");return m>1&&(m=1),m},inv:function(n,i,o){if(o<2||i<2)return NaN;if(n<0||n>1)return NaN;if(0===n)return 0;if(1===n)return 1/0;var r,s=function(t,n,i){var o=.5-.5*t,r=e.sqrt(e.log(1/(o*o))),s=r+((((-453642210148e-16*r-.204231210125)*r-.342242088547)*r-1)*r+.322232421088)/((((.0038560700634*r+.10353775285)*r+.531103462366)*r+.588581570495)*r+.099348462606);i<120&&(s+=(s*s*s+s)/i/4);var a=.8832-.2368*s;return i<120&&(a+=-1.214/i+1.208*s/i),s*(a*e.log(n-1)+1.4142)}(n,i,o),a=t.tukey.cdf(s,i,o)-n;r=a>0?e.max(0,s-1):s+1;for(var l,u=t.tukey.cdf(r,i,o)-n,c=1;c<50;c++)if(l=r-u*(r-s)/(u-a),a=u,s=r,l<0&&(l=0,u=-n),u=t.tukey.cdf(l,i,o)-n,r=l,e.abs(r-s)<1e-4)return l;throw new Error("tukey.inv failed to converge")}})}(e,Math),function(t,e){var n,i,o=Array.prototype.push,r=t.utils.isArray;function s(e){return r(e)||e instanceof t}t.extend({add:function(e,n){return s(n)?(s(n[0])||(n=[n]),t.map(e,(function(t,e,i){return t+n[e][i]}))):t.map(e,(function(t){return t+n}))},subtract:function(e,n){return s(n)?(s(n[0])||(n=[n]),t.map(e,(function(t,e,i){return t-n[e][i]||0}))):t.map(e,(function(t){return t-n}))},divide:function(e,n){return s(n)?(s(n[0])||(n=[n]),t.multiply(e,t.inv(n))):t.map(e,(function(t){return t/n}))},multiply:function(e,n){var i,o,r,a,l,u,c,d;if(void 0===e.length&&void 0===n.length)return e*n;if(l=e.length,u=e[0].length,c=t.zeros(l,r=s(n)?n[0].length:u),d=0,s(n)){for(;d<r;d++)for(i=0;i<l;i++){for(a=0,o=0;o<u;o++)a+=e[i][o]*n[o][d];c[i][d]=a}return 1===l&&1===d?c[0][0]:c}return t.map(e,(function(t){return t*n}))},outer:function(e,n){return t.multiply(e.map((function(t){return[t]})),[n])},dot:function(e,n){s(e[0])||(e=[e]),s(n[0])||(n=[n]);for(var i,o,r=1===e[0].length&&1!==e.length?t.transpose(e):e,a=1===n[0].length&&1!==n.length?t.transpose(n):n,l=[],u=0,c=r.length,d=r[0].length;u<c;u++){for(l[u]=[],i=0,o=0;o<d;o++)i+=r[u][o]*a[u][o];l[u]=i}return 1===l.length?l[0]:l},pow:function(n,i){return t.map(n,(function(t){return e.pow(t,i)}))},exp:function(n){return t.map(n,(function(t){return e.exp(t)}))},log:function(n){return t.map(n,(function(t){return e.log(t)}))},abs:function(n){return t.map(n,(function(t){return e.abs(t)}))},norm:function(t,n){var i=0,o=0;for(isNaN(n)&&(n=2),s(t[0])&&(t=t[0]);o<t.length;o++)i+=e.pow(e.abs(t[o]),n);return e.pow(i,1/n)},angle:function(n,i){return e.acos(t.dot(n,i)/(t.norm(n)*t.norm(i)))},aug:function(t,e){var n,i=[];for(n=0;n<t.length;n++)i.push(t[n].slice());for(n=0;n<i.length;n++)o.apply(i[n],e[n]);return i},inv:function(e){for(var n,i=e.length,o=e[0].length,r=t.identity(i,o),s=t.gauss_jordan(e,r),a=[],l=0;l<i;l++)for(a[l]=[],n=o;n<s[0].length;n++)a[l][n-o]=s[l][n];return a},det:function t(e){if(2===e.length)return e[0][0]*e[1][1]-e[0][1]*e[1][0];for(var n=0,i=0;i<e.length;i++){for(var o=[],r=1;r<e.length;r++){o[r-1]=[];for(var s=0;s<e.length;s++)s<i?o[r-1][s]=e[r][s]:s>i&&(o[r-1][s-1]=e[r][s])}var a=i%2?-1:1;n+=t(o)*e[0][i]*a}return n},gauss_elimination:function(n,i){var o,r,s,a,l=0,u=0,c=n.length,d=n[0].length,f=1,h=0,m=[];for(o=(n=t.aug(n,i))[0].length,l=0;l<c;l++){for(r=n[l][l],u=l,a=l+1;a<d;a++)r<e.abs(n[a][l])&&(r=n[a][l],u=a);if(u!=l)for(a=0;a<o;a++)s=n[l][a],n[l][a]=n[u][a],n[u][a]=s;for(u=l+1;u<c;u++)for(f=n[u][l]/n[l][l],a=l;a<o;a++)n[u][a]=n[u][a]-f*n[l][a]}for(l=c-1;l>=0;l--){for(h=0,u=l+1;u<=c-1;u++)h+=m[u]*n[l][u];m[l]=(n[l][o-1]-h)/n[l][l]}return m},gauss_jordan:function(n,i){var o,r,s,a=t.aug(n,i),l=a.length,u=a[0].length,c=0;for(r=0;r<l;r++){var d=r;for(s=r+1;s<l;s++)e.abs(a[s][r])>e.abs(a[d][r])&&(d=s);var f=a[r];for(a[r]=a[d],a[d]=f,s=r+1;s<l;s++)for(c=a[s][r]/a[r][r],o=r;o<u;o++)a[s][o]-=a[r][o]*c}for(r=l-1;r>=0;r--){for(c=a[r][r],s=0;s<r;s++)for(o=u-1;o>r-1;o--)a[s][o]-=a[r][o]*a[s][r]/c;for(a[r][r]/=c,o=l;o<u;o++)a[r][o]/=c}return a},triaUpSolve:function(e,n){var i,o=e[0].length,r=t.zeros(1,o)[0],s=!1;return null!=n[0].length&&(n=n.map((function(t){return t[0]})),s=!0),t.arange(o-1,-1,-1).forEach((function(s){i=t.arange(s+1,o).map((function(t){return r[t]*e[s][t]})),r[s]=(n[s]-t.sum(i))/e[s][s]})),s?r.map((function(t){return[t]})):r},triaLowSolve:function(e,n){var i,o=e[0].length,r=t.zeros(1,o)[0],s=!1;return null!=n[0].length&&(n=n.map((function(t){return t[0]})),s=!0),t.arange(o).forEach((function(o){i=t.arange(o).map((function(t){return e[o][t]*r[t]})),r[o]=(n[o]-t.sum(i))/e[o][o]})),s?r.map((function(t){return[t]})):r},lu:function(e){var n,i=e.length,o=t.identity(i),r=t.zeros(e.length,e[0].length);return t.arange(i).forEach((function(t){r[0][t]=e[0][t]})),t.arange(1,i).forEach((function(s){t.arange(s).forEach((function(i){n=t.arange(i).map((function(t){return o[s][t]*r[t][i]})),o[s][i]=(e[s][i]-t.sum(n))/r[i][i]})),t.arange(s,i).forEach((function(i){n=t.arange(s).map((function(t){return o[s][t]*r[t][i]})),r[s][i]=e[n.length][i]-t.sum(n)}))})),[o,r]},cholesky:function(n){var i,o=n.length,r=t.zeros(n.length,n[0].length);return t.arange(o).forEach((function(s){i=t.arange(s).map((function(t){return e.pow(r[s][t],2)})),r[s][s]=e.sqrt(n[s][s]-t.sum(i)),t.arange(s+1,o).forEach((function(e){i=t.arange(s).map((function(t){return r[s][t]*r[e][t]})),r[e][s]=(n[s][e]-t.sum(i))/r[s][s]}))})),r},gauss_jacobi:function(n,i,o,r){for(var s,a,l,u,c=0,d=0,f=n.length,h=[],m=[],g=[];c<f;c++)for(h[c]=[],m[c]=[],g[c]=[],d=0;d<f;d++)c>d?(h[c][d]=n[c][d],m[c][d]=g[c][d]=0):c<d?(m[c][d]=n[c][d],h[c][d]=g[c][d]=0):(g[c][d]=n[c][d],h[c][d]=m[c][d]=0);for(l=t.multiply(t.multiply(t.inv(g),t.add(h,m)),-1),a=t.multiply(t.inv(g),i),s=o,u=t.add(t.multiply(l,o),a),c=2;e.abs(t.norm(t.subtract(u,s)))>r;)s=u,u=t.add(t.multiply(l,s),a),c++;return u},gauss_seidel:function(n,i,o,r){for(var s,a,l,u,c,d=0,f=n.length,h=[],m=[],g=[];d<f;d++)for(h[d]=[],m[d]=[],g[d]=[],s=0;s<f;s++)d>s?(h[d][s]=n[d][s],m[d][s]=g[d][s]=0):d<s?(m[d][s]=n[d][s],h[d][s]=g[d][s]=0):(g[d][s]=n[d][s],h[d][s]=m[d][s]=0);for(u=t.multiply(t.multiply(t.inv(t.add(g,h)),m),-1),l=t.multiply(t.inv(t.add(g,h)),i),a=o,c=t.add(t.multiply(u,o),l),d=2;e.abs(t.norm(t.subtract(c,a)))>r;)a=c,c=t.add(t.multiply(u,a),l),d+=1;return c},SOR:function(n,i,o,r,s){for(var a,l,u,c,d,f=0,h=n.length,m=[],g=[],p=[];f<h;f++)for(m[f]=[],g[f]=[],p[f]=[],a=0;a<h;a++)f>a?(m[f][a]=n[f][a],g[f][a]=p[f][a]=0):f<a?(g[f][a]=n[f][a],m[f][a]=p[f][a]=0):(p[f][a]=n[f][a],m[f][a]=g[f][a]=0);for(c=t.multiply(t.inv(t.add(p,t.multiply(m,s))),t.subtract(t.multiply(p,1-s),t.multiply(g,s))),u=t.multiply(t.multiply(t.inv(t.add(p,t.multiply(m,s))),i),s),l=o,d=t.add(t.multiply(c,o),u),f=2;e.abs(t.norm(t.subtract(d,l)))>r;)l=d,d=t.add(t.multiply(c,l),u),f++;return d},householder:function(n){for(var i,o,r,s,a=n.length,l=n[0].length,u=0,c=[],d=[];u<a-1;u++){for(i=0,s=u+1;s<l;s++)i+=n[s][u]*n[s][u];for(i=(n[u+1][u]>0?-1:1)*e.sqrt(i),o=e.sqrt((i*i-n[u+1][u]*i)/2),(c=t.zeros(a,1))[u+1][0]=(n[u+1][u]-i)/(2*o),r=u+2;r<a;r++)c[r][0]=n[r][u]/(2*o);d=t.subtract(t.identity(a,l),t.multiply(t.multiply(c,t.transpose(c)),2)),n=t.multiply(d,t.multiply(n,d))}return n},QR:(n=t.sum,i=t.arange,function(o){var r,s,a,l=o.length,u=o[0].length,c=t.zeros(u,u);for(o=t.copy(o),s=0;s<u;s++){for(c[s][s]=e.sqrt(n(i(l).map((function(t){return o[t][s]*o[t][s]})))),r=0;r<l;r++)o[r][s]=o[r][s]/c[s][s];for(a=s+1;a<u;a++)for(c[s][a]=n(i(l).map((function(t){return o[t][s]*o[t][a]}))),r=0;r<l;r++)o[r][a]=o[r][a]-o[r][s]*c[s][a]}return[o,c]}),lstsq:function(e,n){var i=!1;void 0===n[0].length&&(n=n.map((function(t){return[t]})),i=!0);var o=t.QR(e),r=o[0],s=o[1],a=e[0].length,l=t.slice(r,{col:{end:a}}),u=function(e){var n=(e=t.copy(e)).length,i=t.identity(n);return t.arange(n-1,-1,-1).forEach((function(n){t.sliceAssign(i,{row:n},t.divide(t.slice(i,{row:n}),e[n][n])),t.sliceAssign(e,{row:n},t.divide(t.slice(e,{row:n}),e[n][n])),t.arange(n).forEach((function(o){var r=t.multiply(e[o][n],-1),s=t.slice(e,{row:o}),a=t.multiply(t.slice(e,{row:n}),r);t.sliceAssign(e,{row:o},t.add(s,a));var l=t.slice(i,{row:o}),u=t.multiply(t.slice(i,{row:n}),r);t.sliceAssign(i,{row:o},t.add(l,u))}))})),i}(t.slice(s,{row:{end:a}})),c=t.transpose(l);void 0===c[0].length&&(c=[c]);var d=t.multiply(t.multiply(u,c),n);return void 0===d.length&&(d=[[d]]),i?d.map((function(t){return t[0]})):d},jacobi:function(n){for(var i,o,r,s,a,l,u,c=1,d=n.length,f=t.identity(d,d),h=[];1===c;){for(a=n[0][1],r=0,s=1,i=0;i<d;i++)for(o=0;o<d;o++)i!=o&&a<e.abs(n[i][o])&&(a=e.abs(n[i][o]),r=i,s=o);for(l=n[r][r]===n[s][s]?n[r][s]>0?e.PI/4:-e.PI/4:e.atan(2*n[r][s]/(n[r][r]-n[s][s]))/2,(u=t.identity(d,d))[r][r]=e.cos(l),u[r][s]=-e.sin(l),u[s][r]=e.sin(l),u[s][s]=e.cos(l),f=t.multiply(f,u),n=t.multiply(t.multiply(t.inv(u),n),u),c=0,i=1;i<d;i++)for(o=1;o<d;o++)i!=o&&e.abs(n[i][o])>.001&&(c=1)}for(i=0;i<d;i++)h.push(n[i][i]);return[f,h]},rungekutta:function(t,e,n,i,o,r){var s,a,l;if(2===r)for(;i<=n;)o+=((s=e*t(i,o))+(a=e*t(i+e,o+s)))/2,i+=e;if(4===r)for(;i<=n;)o+=((s=e*t(i,o))+2*(a=e*t(i+e/2,o+s/2))+2*(l=e*t(i+e/2,o+a/2))+e*t(i+e,o+l))/6,i+=e;return o},romberg:function(t,n,i,o){for(var r,s,a,l,u,c=0,d=(i-n)/2,f=[],h=[],m=[];c<o/2;){for(u=t(n),a=n,l=0;a<=i;a+=d,l++)f[l]=a;for(r=f.length,a=1;a<r-1;a++)u+=(a%2!=0?4:2)*t(f[a]);u=d/3*(u+t(i)),m[c]=u,d/=2,c++}for(s=m.length,r=1;1!==s;){for(a=0;a<s-1;a++)h[a]=(e.pow(4,r)*m[a+1]-m[a])/(e.pow(4,r)-1);s=h.length,m=h,h=[],r++}return m},richardson:function(t,n,i,o){function r(t,e){for(var n,i=0,o=t.length;i<o;i++)t[i]===e&&(n=i);return n}for(var s,a,l,u,c,d=e.abs(i-t[r(t,i)+1]),f=0,h=[],m=[];o>=d;)s=r(t,i+o),a=r(t,i),h[f]=(n[s]-2*n[a]+n[2*a-s])/(o*o),o/=2,f++;for(u=h.length,l=1;1!=u;){for(c=0;c<u-1;c++)m[c]=(e.pow(4,l)*h[c+1]-h[c])/(e.pow(4,l)-1);u=m.length,h=m,m=[],l++}return h},simpson:function(t,e,n,i){for(var o,r=(n-e)/i,s=t(e),a=[],l=e,u=0,c=1;l<=n;l+=r,u++)a[u]=l;for(o=a.length;c<o-1;c++)s+=(c%2!=0?4:2)*t(a[c]);return r/3*(s+t(n))},hermite:function(t,e,n,i){for(var o,r=t.length,s=0,a=0,l=[],u=[],c=[],d=[];a<r;a++){for(l[a]=1,o=0;o<r;o++)a!=o&&(l[a]*=(i-t[o])/(t[a]-t[o]));for(u[a]=0,o=0;o<r;o++)a!=o&&(u[a]+=1/(t[a]-t[o]));c[a]=(1-2*(i-t[a])*u[a])*(l[a]*l[a]),d[a]=(i-t[a])*(l[a]*l[a]),s+=c[a]*e[a]+d[a]*n[a]}return s},lagrange:function(t,e,n){for(var i,o,r=0,s=0,a=t.length;s<a;s++){for(o=e[s],i=0;i<a;i++)s!=i&&(o*=(n-t[i])/(t[s]-t[i]));r+=o}return r},cubic_spline:function(e,n,i){for(var o,r,s=e.length,a=0,l=[],u=[],c=[],d=[],f=[],h=[];a<s-1;a++)d[a]=e[a+1]-e[a];for(c[0]=0,a=1;a<s-1;a++)c[a]=3/d[a]*(n[a+1]-n[a])-3/d[a-1]*(n[a]-n[a-1]);for(a=1;a<s-1;a++)l[a]=[],u[a]=[],l[a][a-1]=d[a-1],l[a][a]=2*(d[a-1]+d[a]),l[a][a+1]=d[a],u[a][0]=c[a];for(r=t.multiply(t.inv(l),u),o=0;o<s-1;o++)f[o]=(n[o+1]-n[o])/d[o]-d[o]*(r[o+1][0]+2*r[o][0])/3,h[o]=(r[o+1][0]-r[o][0])/(3*d[o]);for(o=0;o<s&&!(e[o]>i);o++);return n[o-=1]+(i-e[o])*f[o]+t.sq(i-e[o])*r[o]+(i-e[o])*t.sq(i-e[o])*h[o]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(e){var n,i,o,r,s,a=e.length,l=e[0].length,u=0,c=[],d=[],f=[],h=[],m=[],g=[],p=[];for(u=0;u<a;u++)c[u]=t.sum(e[u])/l;for(u=0;u<l;u++)for(m[u]=[],n=0;n<a;n++)m[u][n]=e[n][u]-c[n];for(m=t.transpose(m),u=0;u<a;u++)for(g[u]=[],n=0;n<a;n++)g[u][n]=t.dot([m[u]],[m[n]])/(l-1);for(s=(o=t.jacobi(g))[0],d=o[1],p=t.transpose(s),u=0;u<d.length;u++)for(n=u;n<d.length;n++)d[u]<d[n]&&(i=d[u],d[u]=d[n],d[n]=i,f=p[u],p[u]=p[n],p[n]=f);for(r=t.transpose(m),u=0;u<a;u++)for(h[u]=[],n=0;n<r.length;n++)h[u][n]=t.dot([p[u]],[r[n]]);return[e,d,p,h]}}),function(e){for(var n=0;n<e.length;n++)!function(e){t.fn[e]=function(n,i){var o=this;return i?(setTimeout((function(){i.call(o,t.fn[e].call(o,n))}),15),this):"number"==typeof t[e](this,n)?t[e](this,n):t(t[e](this,n))}}(e[n])}("add divide multiply subtract dot pow exp log abs norm angle".split(" "))}(e,Math),function(t,e){var n=[].slice,i=t.utils.isNumber,o=t.utils.isArray;function r(t,n,i,o){if(t>1||i>1||t<=0||i<=0)throw new Error("Proportions should be greater than 0 and less than 1");var r=(t*n+i*o)/(n+o);return(t-i)/e.sqrt(r*(1-r)*(1/n+1/o))}t.extend({zscore:function(){var e=n.call(arguments);return i(e[1])?(e[0]-e[1])/e[2]:(e[0]-t.mean(e[1]))/t.stdev(e[1],e[2])},ztest:function(){var i,r=n.call(arguments);return o(r[1])?(i=t.zscore(r[0],r[1],r[3]),1===r[2]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1)):r.length>2?(i=t.zscore(r[0],r[1],r[2]),1===r[3]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1)):(i=r[0],1===r[1]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1))}}),t.extend(t.fn,{zscore:function(t,e){return(t-this.mean())/this.stdev(e)},ztest:function(n,i,o){var r=e.abs(this.zscore(n,o));return 1===i?t.normal.cdf(-r,0,1):2*t.normal.cdf(-r,0,1)}}),t.extend({tscore:function(){var i=n.call(arguments);return 4===i.length?(i[0]-i[1])/(i[2]/e.sqrt(i[3])):(i[0]-t.mean(i[1]))/(t.stdev(i[1],!0)/e.sqrt(i[1].length))},ttest:function(){var o,r=n.call(arguments);return 5===r.length?(o=e.abs(t.tscore(r[0],r[1],r[2],r[3])),1===r[4]?t.studentt.cdf(-o,r[3]-1):2*t.studentt.cdf(-o,r[3]-1)):i(r[1])?(o=e.abs(r[0]),1==r[2]?t.studentt.cdf(-o,r[1]-1):2*t.studentt.cdf(-o,r[1]-1)):(o=e.abs(t.tscore(r[0],r[1])),1==r[2]?t.studentt.cdf(-o,r[1].length-1):2*t.studentt.cdf(-o,r[1].length-1))}}),t.extend(t.fn,{tscore:function(t){return(t-this.mean())/(this.stdev(!0)/e.sqrt(this.cols()))},ttest:function(n,i){return 1===i?1-t.studentt.cdf(e.abs(this.tscore(n)),this.cols()-1):2*t.studentt.cdf(-e.abs(this.tscore(n)),this.cols()-1)}}),t.extend({anovafscore:function(){var i,o,r,s,a,l,u,c,d=n.call(arguments);if(1===d.length){for(a=new Array(d[0].length),u=0;u<d[0].length;u++)a[u]=d[0][u];d=a}for(o=new Array,u=0;u<d.length;u++)o=o.concat(d[u]);for(r=t.mean(o),i=0,u=0;u<d.length;u++)i+=d[u].length*e.pow(t.mean(d[u])-r,2);for(i/=d.length-1,l=0,u=0;u<d.length;u++)for(s=t.mean(d[u]),c=0;c<d[u].length;c++)l+=e.pow(d[u][c]-s,2);return i/(l/(o.length-d.length))},anovaftest:function(){var e,o,r,s,a=n.call(arguments);if(i(a[0]))return 1-t.centralF.cdf(a[0],a[1],a[2]);var l=t.anovafscore(a);for(e=a.length-1,r=0,s=0;s<a.length;s++)r+=a[s].length;return o=r-e-1,1-t.centralF.cdf(l,e,o)},ftest:function(e,n,i){return 1-t.centralF.cdf(e,n,i)}}),t.extend(t.fn,{anovafscore:function(){return t.anovafscore(this.toArray())},anovaftes:function(){var e,n=0;for(e=0;e<this.length;e++)n+=this[e].length;return t.ftest(this.anovafscore(),this.length-1,n-this.length)}}),t.extend({qscore:function(){var o,r,s,a,l,u=n.call(arguments);return i(u[0])?(o=u[0],r=u[1],s=u[2],a=u[3],l=u[4]):(o=t.mean(u[0]),r=t.mean(u[1]),s=u[0].length,a=u[1].length,l=u[2]),e.abs(o-r)/(l*e.sqrt((1/s+1/a)/2))},qtest:function(){var e,i=n.call(arguments);3===i.length?(e=i[0],i=i.slice(1)):7===i.length?(e=t.qscore(i[0],i[1],i[2],i[3],i[4]),i=i.slice(5)):(e=t.qscore(i[0],i[1],i[2]),i=i.slice(3));var o=i[0],r=i[1];return 1-t.tukey.cdf(e,r,o-r)},tukeyhsd:function(e){for(var n=t.pooledstdev(e),i=e.map((function(e){return t.mean(e)})),o=e.reduce((function(t,e){return t+e.length}),0),r=[],s=0;s<e.length;++s)for(var a=s+1;a<e.length;++a){var l=t.qtest(i[s],i[a],e[s].length,e[a].length,n,o,e.length);r.push([[s,a],l])}return r}}),t.extend({normalci:function(){var i,o=n.call(arguments),r=new Array(2);return i=4===o.length?e.abs(t.normal.inv(o[1]/2,0,1)*o[2]/e.sqrt(o[3])):e.abs(t.normal.inv(o[1]/2,0,1)*t.stdev(o[2])/e.sqrt(o[2].length)),r[0]=o[0]-i,r[1]=o[0]+i,r},tci:function(){var i,o=n.call(arguments),r=new Array(2);return i=4===o.length?e.abs(t.studentt.inv(o[1]/2,o[3]-1)*o[2]/e.sqrt(o[3])):e.abs(t.studentt.inv(o[1]/2,o[2].length-1)*t.stdev(o[2],!0)/e.sqrt(o[2].length)),r[0]=o[0]-i,r[1]=o[0]+i,r},significant:function(t,e){return t<e}}),t.extend(t.fn,{normalci:function(e,n){return t.normalci(e,n,this.toArray())},tci:function(e,n){return t.tci(e,n,this.toArray())}}),t.extend(t.fn,{oneSidedDifferenceOfProportions:function(e,n,i,o){var s=r(e,n,i,o);return t.ztest(s,1)},twoSidedDifferenceOfProportions:function(e,n,i,o){var s=r(e,n,i,o);return t.ztest(s,2)}})}(e,Math),e.models=function(){function t(t,n){var i=t.length,o=n[0].length-1,r=i-o-1,s=e.lstsq(n,t),a=e.multiply(n,s.map((function(t){return[t]}))).map((function(t){return t[0]})),l=e.subtract(t,a),u=e.mean(t),c=e.sum(a.map((function(t){return Math.pow(t-u,2)}))),d=e.sum(t.map((function(t,e){return Math.pow(t-a[e],2)}))),f=c+d;return{exog:n,endog:t,nobs:i,df_model:o,df_resid:r,coef:s,predict:a,resid:l,ybar:u,SST:f,SSE:c,SSR:d,R2:c/f}}function n(n){var i,o,r=(i=n.exog,o=i[0].length,e.arange(o).map((function(n){var r=e.arange(o).filter((function(t){return t!==n}));return t(e.col(i,n).map((function(t){return t[0]})),e.col(i,r))}))),s=Math.sqrt(n.SSR/n.df_resid),a=r.map((function(t){var e=t.SST,n=t.R2;return s/Math.sqrt(e*(1-n))})),l=n.coef.map((function(t,e){return(t-0)/a[e]})),u=l.map((function(t){var i=e.studentt.cdf(t,n.df_resid);return 2*(i>.5?1-i:i)})),c=e.studentt.inv(.975,n.df_resid),d=n.coef.map((function(t,e){var n=c*a[e];return[t-n,t+n]}));return{se:a,t:l,p:u,sigmaHat:s,interval95:d}}return{ols:function(i,o){var r=t(i,o),s=n(r),a=function(t){var n,i,o,r=t.R2/t.df_model/((1-t.R2)/t.df_resid);return{F_statistic:r,pvalue:1-(n=r,i=t.df_model,o=t.df_resid,e.beta.cdf(n/(o/i+n),i/2,o/2))}}(r),l=1-(1-r.R2)*((r.nobs-1)/r.df_resid);return r.t=s,r.f=a,r.adjust_R2=l,r}}}(),e.extend({buildxmatrix:function(){for(var t=new Array(arguments.length),n=0;n<arguments.length;n++)t[n]=[1].concat(arguments[n]);return e(t)},builddxmatrix:function(){for(var t=new Array(arguments[0].length),n=0;n<arguments[0].length;n++)t[n]=[1].concat(arguments[0][n]);return e(t)},buildjxmatrix:function(t){for(var n=new Array(t.length),i=0;i<t.length;i++)n[i]=t[i];return e.builddxmatrix(n)},buildymatrix:function(t){return e(t).transpose()},buildjymatrix:function(t){return t.transpose()},matrixmult:function(t,n){var i,o,r,s,a;if(t.cols()==n.rows()){if(n.rows()>1){for(s=[],i=0;i<t.rows();i++)for(s[i]=[],o=0;o<n.cols();o++){for(a=0,r=0;r<t.cols();r++)a+=t.toArray()[i][r]*n.toArray()[r][o];s[i][o]=a}return e(s)}for(s=[],i=0;i<t.rows();i++)for(s[i]=[],o=0;o<n.cols();o++){for(a=0,r=0;r<t.cols();r++)a+=t.toArray()[i][r]*n.toArray()[o];s[i][o]=a}return e(s)}},regress:function(t,n){var i=e.xtranspxinv(t),o=t.transpose(),r=e.matrixmult(e(i),o);return e.matrixmult(r,n)},regresst:function(t,n,i){var o=e.regress(t,n),r={anova:{}},s=e.jMatYBar(t,o);r.yBar=s;var a=n.mean();r.anova.residuals=e.residuals(n,s),r.anova.ssr=e.ssr(s,a),r.anova.msr=r.anova.ssr/(t[0].length-1),r.anova.sse=e.sse(n,s),r.anova.mse=r.anova.sse/(n.length-(t[0].length-1)-1),r.anova.sst=e.sst(n,a),r.anova.mst=r.anova.sst/(n.length-1),r.anova.r2=1-r.anova.sse/r.anova.sst,r.anova.r2<0&&(r.anova.r2=0),r.anova.fratio=r.anova.msr/r.anova.mse,r.anova.pvalue=e.anovaftest(r.anova.fratio,t[0].length-1,n.length-(t[0].length-1)-1),r.anova.rmse=Math.sqrt(r.anova.mse),r.anova.r2adj=1-r.anova.mse/r.anova.mst,r.anova.r2adj<0&&(r.anova.r2adj=0),r.stats=new Array(t[0].length);for(var l,u,c,d=e.xtranspxinv(t),f=0;f<o.length;f++)l=Math.sqrt(r.anova.mse*Math.abs(d[f][f])),u=Math.abs(o[f]/l),c=e.ttest(u,n.length-t[0].length-1,i),r.stats[f]=[o[f],l,u,c];return r.regress=o,r},xtranspx:function(t){return e.matrixmult(t.transpose(),t)},xtranspxinv:function(t){var n=e.matrixmult(t.transpose(),t);return e.inv(n)},jMatYBar:function(t,n){var i=e.matrixmult(t,n);return new e(i)},residuals:function(t,n){return e.matrixsubtract(t,n)},ssr:function(t,e){for(var n=0,i=0;i<t.length;i++)n+=Math.pow(t[i]-e,2);return n},sse:function(t,e){for(var n=0,i=0;i<t.length;i++)n+=Math.pow(t[i]-e[i],2);return n},sst:function(t,e){for(var n=0,i=0;i<t.length;i++)n+=Math.pow(t[i]-e,2);return n},matrixsubtract:function(t,n){for(var i=new Array(t.length),o=0;o<t.length;o++){i[o]=new Array(t[o].length);for(var r=0;r<t[o].length;r++)i[o][r]=t[o][r]-n[o][r]}return e(i)}}),e.jStat=e,e)},4788:(t,e,n)=>{"use strict";var i=n(5072),o=n.n(i),r=n(7825),s=n.n(r),a=n(7659),l=n.n(a),u=n(5056),c=n.n(u),d=n(540),f=n.n(d),h=n(1113),m=n.n(h),g=n(365),p={};p.styleTagTransform=m(),p.setAttributes=c(),p.insert=l().bind(null,"head"),p.domAPI=s(),p.insertStyleElement=f(),o()(g.A,p),g.A&&g.A.locals&&g.A.locals},5072:t=>{"use strict";var e=[];function n(t){for(var n=-1,i=0;i<e.length;i++)if(e[i].identifier===t){n=i;break}return n}function i(t,i){for(var r={},s=[],a=0;a<t.length;a++){var l=t[a],u=i.base?l[0]+i.base:l[0],c=r[u]||0,d="".concat(u," ").concat(c);r[u]=c+1;var f=n(d),h={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==f)e[f].references++,e[f].updater(h);else{var m=o(h,i);i.byIndex=a,e.splice(a,0,{identifier:d,updater:m,references:1})}s.push(d)}return s}function o(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,o){var r=i(t=t||[],o=o||{});return function(t){t=t||[];for(var s=0;s<r.length;s++){var a=n(r[s]);e[a].references--}for(var l=i(t,o),u=0;u<r.length;u++){var c=n(r[u]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}r=l}}},7659:t=>{"use strict";var e={};t.exports=function(t,n){var i=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},5056:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},7825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,o&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},1113:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},768:(t,e,n)=>{"use strict";n.d(e,{i:()=>q,q:()=>G});var i,o=n(7389),r=n(4328),s=n(6082),a=n(2003),l=n(8223),u=n(3077),c=n(439);async function d(t,e,n,o,r){const a=(0,u.R)(e,r),d=r.getSeqHandler(e).getNewColumnFromList("ref",[n]),f=r.getSeqHandler(d).getSplitted(0),h=o===i.IDENTITY?function(t,e){const n=e.columns.length,i=new Array(n),o=new Array(n),r=new Array(n);for(let s=0;s<n;++s){const n=e.columns.byIndex(s);i[s]=n.getRawData(),o[s]=n.categories.indexOf("");const a=s<t.length?t.getOriginal(s):c._S;r[s]=n.categories.indexOf(a)}const a=s.Column.float("Identity",e.rowCount),l=a.getRawData();for(let n=0;n<e.rowCount;++n){l[n]=0;for(let e=0;e<t.length;++e)(i[e]?i[e][n]:0)===r[e]&&++l[n];l[n]/=t.length}return a}(f,a):o===i.SIMILARITY?await async function(t,e,n){const i=e.columns.toList();return await(0,l.uL)(i,t,n)}(f,a,r):null;if(null===h)throw new Error(`In bio library: Unknown sequence scoring method: ${o}`);return h.name=t.columns.getUnusedName(h.name),t.columns.add(h),h}!function(t){t.IDENTITY="identity",t.SIMILARITY="similarity"}(i||(i={}));var f,h=n(8774),m=n(144),g=n.n(m),p=n(7233),v=n.n(p),y=n(4139),C=n(115),w=n(8608),b=n(3541),A=n(3163),S=n(7923),E=n(7654),T=n(5480),x=n(5429),N=n(9995),_=n(3657),M=n(4025);!function(t){t.UMAP="UMAP",t.T_SNE="t-SNE"}(f||(f={}));n(5540);var O,I,L,P,R,k,V,D,F=n(4329);(I=O||(O={})).EUCLIDEAN="EUCLIDEAN",I.MANHATTAN="MANHATTAN",O.EUCLIDEAN,O.MANHATTAN,(P=L||(L={})).HAMMING="Hamming",P.EUCLIDEAN="Euclidean",P.VECTOR_COSINE="Vector Cosine",P.MANHATTAN="Manhattan",P.TANIMOTO="Tanimoto",P.LEVENSTEIN="Levenshtein",P.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",P.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",P.SOKAL="Sokal",P.COSINE="Cosine",P.ASYMMETRIC="Asymmetric",P.Difference="Difference",P.OneHot="One-Hot",L.HAMMING,L.EUCLIDEAN,L.MANHATTAN,L.VECTOR_COSINE,L.TANIMOTO,L.LEVENSTEIN,L.NEEDLEMAN_WUNSCH,L.MONOMER_CHEMICAL_DISTANCE,L.SOKAL,L.COSINE,L.ASYMMETRIC,L.Difference,L.OneHot,L.HAMMING,L.EUCLIDEAN,L.MANHATTAN,L.TANIMOTO,L.SOKAL,L.COSINE,L.ASYMMETRIC,L.LEVENSTEIN,L.NEEDLEMAN_WUNSCH,L.MONOMER_CHEMICAL_DISTANCE,L.Difference,L.OneHot,L.VECTOR_COSINE,new Set([L.HAMMING,L.LEVENSTEIN,L.NEEDLEMAN_WUNSCH,L.MONOMER_CHEMICAL_DISTANCE,L.OneHot]),new Set([L.HAMMING,L.EUCLIDEAN,L.MANHATTAN,L.MONOMER_CHEMICAL_DISTANCE,L.LEVENSTEIN,L.NEEDLEMAN_WUNSCH,L.TANIMOTO,L.COSINE,L.VECTOR_COSINE,L.SOKAL,L.ASYMMETRIC,L.OneHot,L.Difference]),new Set([L.EUCLIDEAN,L.MANHATTAN,L.OneHot,L.Difference,L.VECTOR_COSINE]),new Set([L.EUCLIDEAN,L.MANHATTAN,L.Difference,L.VECTOR_COSINE]),new Set([L.EUCLIDEAN,L.MANHATTAN,L.Difference]),new Set([L.TANIMOTO,L.COSINE,L.SOKAL,L.ASYMMETRIC]),function(t){t.ADD="ADD",t.SUB="SUB",t.MULT="MULT"}(R||(R={})),function(t){t.SQUARE="SQUARE",t.INVERSE="INVERSE",t.TRANSPOSE="TRANSPOSE",t.NORM="NORM",t.COLUMN_NORM="COLUMN_NORM"}(k||(k={})),function(t){t.SCALARMULT="SCALARMULT",t.SCALARADD="SCALARADD",t.SCALARPOW="SCALARPOW"}(V||(V={})),Object.prototype.toString,function(t){t.EUCLIDEAN="EUCLIDEAN",t.MANHATTAN="MANHATTAN"}(D||(D={}));var G,U=n(726),H=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};!function(t){t.SEQUENCE_VARIABILITY_MAP="Sequence Variability Map",t.MOST_POTENT_RESIDUES="Most Potent Residues",t.LOGO_SUMMARY_TABLE="Logo Summary Table",t.DENDROGRAM="Dendrogram",t.CLUSTER_MAX_ACTIVITY="Active peptide selection",t.MCL="MCL"}(G||(G={}));class q{constructor(t){this.isBitsetChangedInitialized=!1,this.isUserChangedSelection=!0,this._dm=null,this.isInitialized=!1,this.isRibbonSet=!1,this.webLogoSelectedMonomers={},this.webLogoBounds={},this.cachedWebLogoTooltip={bar:"",tooltip:null},this._layoutEventInitialized=!1,this.subs=[],this.isHighlighting=!1,this.controlFire=!1,this.accordionSource=null,this._sequenceSpaceViewer=null,this._mclViewer=null,this._monomerPositionStats=null,this._settings=null,this._sequenceSpaceCols=[],this._mclCols=[],this._webLogoSelection=null,this.df=t}get monomerPositionStats(){var t;if(null!==this._monomerPositionStats)return this._monomerPositionStats;const e=this.getScaledActivityColumn();return null===this.positionColumns||null===e?null:(null!==(t=this._monomerPositionStats)&&void 0!==t||(this._monomerPositionStats=(0,_.Ej)(e,this.df.filter,this.positionColumns)),this._monomerPositionStats)}get analysisView(){var t,e,n;return void 0===this._analysisView&&(this._analysisView=this.id?g()(r.shell.tableViews).find((({dataFrame:t})=>(null==t?void 0:t.getTag(s.TAGS.ID))===this.id)):void 0,!this._analysisView&&(null===(t=r.shell.v)||void 0===t?void 0:t.preview)instanceof s.TableView&&(null===(n=null===(e=r.shell.v)||void 0===e?void 0:e.preview)||void 0===n?void 0:n.dataFrame)===this.df&&(this._analysisView=r.shell.v.preview),this._analysisView||(this._analysisView=r.shell.addTableView(this.df))),"1"===this.df.getTag(y.gp.MULTIPLE_VIEWS)||this._layoutEventInitialized||(0,w.Lv)()||(r.shell.v=this._analysisView),this._analysisView.grid.invalidate(),this._analysisView}get settings(){var t,e;const n=this.df.getTag(y.gp.SETTINGS);return n?(null!==(t=this._settings)&&void 0!==t||(this._settings=JSON.parse(n)),!(null===(e=this._settings)||void 0===e?void 0:e.mclSettings)||this._settings.mclSettings.webGPUDescriptionPromise instanceof Promise||(this._settings.mclSettings.webGPUDescriptionPromise=(0,F._)()),this._settings):null}set settings(t){var e,n,i;const o=Object.entries(t),r=Object.assign({},null!==(n=null===(e=this.settings)||void 0===e?void 0:e.sequenceSpaceParams)&&void 0!==n?n:{}),s=new Set;for(const[t,e]of o)switch(this.settings[t]=e,t){case"activityColumnName":case"activityScaling":s.add("activity"),s.add("stats");break;case"showDendrogram":s.add("dendrogram");break;case"showClusterMaxActivity":s.add("clusterMaxActivity");break;case"showSequenceSpace":s.add("showSequenceSpace");break;case"showLogoSummaryTable":s.add("logoSummaryTable");break;case"showMonomerPosition":s.add("monomerPosition");break;case"showMostPotentResidues":s.add("mostPotentResidues");break;case"columns":s.add("columns");break;case"sequenceSpaceParams":s.add("sequenceSpaceParams");break;case"mclSettings":s.add("mclSettings")}if(this.df.setTag("settings",JSON.stringify(this._settings)),this.isInitialized){if(s.has("sequenceSpaceParams")){const t=this.settings.sequenceSpaceParams;Object.entries(t).some((([t,e])=>r[t]!==e&&"epsilon"!==t&&"minPts"!==t&&"clusterEmbeddings"!==t))||(s.delete("sequenceSpaceParams"),this.settings.sequenceSpaceParams.clusterEmbeddings&&s.add("clusterParams"))}s.has("sequenceSpaceParams")&&s.delete("clusterParams");for(const t of s)switch(t){case"activity":this.createScaledCol();break;case"stats":this.webLogoSelection=(0,w.ZR)(this.positionColumns),this.webLogoBounds={},this.cachedWebLogoTooltip={bar:"",tooltip:null},this._monomerPositionStats=null;break;case"dendrogram":this.settings.showDendrogram?this.addDendrogram():this.closeViewer(G.DENDROGRAM);break;case"clusterMaxActivity":this.settings.showClusterMaxActivity?this.addClusterMaxActivityViewer():this.closeViewer(G.CLUSTER_MAX_ACTIVITY);break;case"logoSummaryTable":this.settings.showLogoSummaryTable?this.addLogoSummaryTable():this.closeViewer(G.LOGO_SUMMARY_TABLE);break;case"monomerPosition":this.settings.showMonomerPosition?this.addMonomerPosition():this.closeViewer(G.SEQUENCE_VARIABILITY_MAP);break;case"mostPotentResidues":this.settings.showMostPotentResidues?this.addMostPotentResidues():this.closeViewer(G.MOST_POTENT_RESIDUES);break;case"columns":const t=this.findViewer(G.LOGO_SUMMARY_TABLE);t._viewerGrid=null,t._logoSummaryTable=null,t.render();const e=this.findViewer(G.MOST_POTENT_RESIDUES);e._viewerGrid=null,e.render();break;case"sequenceSpaceParams":case"showSequenceSpace":this.settings.showSequenceSpace&&this.addSequenceSpace({clusterEmbeddings:null===(i=this.settings.sequenceSpaceParams)||void 0===i?void 0:i.clusterEmbeddings});break;case"clusterParams":this.clusterEmbeddings();break;case"mclSettings":this.addMCLClusters()}}}get webLogoSelection(){var t;const e=this.df.getTag(`${y.YX.WL}${y.gp.INVARIANT_MAP_SELECTION}`);return null!==(t=this._webLogoSelection)&&void 0!==t||(this._webLogoSelection=null===e&&null!==this.positionColumns?(0,w.ZR)(this.positionColumns):JSON.parse(null!=e?e:"{}")),this._webLogoSelection}set webLogoSelection(t){this._webLogoSelection=t,this.df.setTag(`${y.YX.WL}${y.gp.INVARIANT_MAP_SELECTION}`,JSON.stringify(t)),this.fireBitsetChanged(null),this.analysisView.grid.invalidate()}get positionColumns(){const t=g()(this.df.columns.byTags({[y.gp.POSITION_COL]:"true"})).toArray();return 0===t.length?null:t}get id(){return this.df.getTag(s.TAGS.ID)}get alphabet(){return this.df.getCol(this.settings.sequenceColumnName).getTag(a.gp.alphabet)}static getInstance(t){if(t.columns.contains(y.$2.ACTIVITY_SCALED)&&!t.columns.contains(y.$2.ACTIVITY)&&(t.getCol(y.$2.ACTIVITY_SCALED).name=y.$2.ACTIVITY),!t.temp[q.modelName]){const e=t.temp[q.modelName]=new q(t),n=e.settings;n&&e.init(n);let i=!0;e.subs.push(s.debounce(t.onSelectionChanged,10).subscribe((n=>{var o,r,s;if(i||t.selection.anyTrue||!e._analysisView||!document.contains(e._analysisView.root)||e._analysisView.dataFrame!==t)return void(i=!(null===(o=null==t?void 0:t.selection)||void 0===o?void 0:o.anyTrue));e.positionColumns&&(e.webLogoSelection=(0,w.ZR)(e.positionColumns));const a=e.findViewer(G.SEQUENCE_VARIABILITY_MAP);if(null!=a){const t=null!==(r=e.positionColumns)&&void 0!==r?r:a.positionColumns;t&&(a.invariantMapSelection=(0,w.ZR)(t),a.mutationCliffsSelection=(0,w.ZR)(t))}const l=e.findViewer(G.MOST_POTENT_RESIDUES);if(null!=l){const t=null!==(s=e.positionColumns)&&void 0!==s?s:l.positionColumns;t&&(l.mutationCliffsSelection=(0,w.ZR)(t),l.invariantMapSelection=(0,w.ZR)(t))}const u=e.findViewer(G.LOGO_SUMMARY_TABLE);null!=u&&(u.initClusterSelection({notify:!0}),u.render()),i=!0})))}return t.temp[q.modelName]}modifyWebLogoSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.webLogoSelection=(0,w.vW)(this.webLogoSelection,t,e):this._webLogoSelection=(0,w.vW)(this.webLogoSelection,t,e)}getVisibleSelection(){return this.df.selection.clone().and(this.df.filter)}createAccordion(){var t,e,n,i,r,l,u,c,d,f;const h=null===(t=this.df)||void 0===t?void 0:t.temp[q.modelName];if(!h)return null;const m=o.accordion("Peptides analysis panel");m.root.style.width="100%";const g=h.getVisibleSelection(),p=h.df.filter.anyFalse?` among ${h.df.filter.trueCount} filtered`:"",y=t=>{const e=[];for(const[n,i]of Object.entries(t))for(const t of i)e.push(`${n}:${t}`);return e.join(", ")},C=h.findViewer(G.LOGO_SUMMARY_TABLE),x=[],N=(null===C?[]:(null!==(n=null===(e=C.clusterSelection)||void 0===e?void 0:e[T.W.ORIGINAL])&&void 0!==n?n:[]).concat(null!==(r=null===(i=C.clusterSelection)||void 0===i?void 0:i[T.W.CUSTOM])&&void 0!==r?r:[])).join(", "),O=t=>{const e=o.divText(t);return e.innerHTML=t,e};0!==N.length&&x.push(O(`<b>Logo Summary Table</b> clusters: ${N}`));const I=h.findViewer(G.SEQUENCE_VARIABILITY_MAP),L=y(null!==(l=null==I?void 0:I.invariantMapSelection)&&void 0!==l?l:{}),P=y(null!==(u=null==I?void 0:I.mutationCliffsSelection)&&void 0!==u?u:{});0!==L.length&&x.push(O(`<b>Invariant map</b>: ${L}`)),0!==P.length&&x.push(O(`<b>Mutation cliffs</b>: ${P}`));const R=h.findViewer(G.MOST_POTENT_RESIDUES),k=y(null!==(c=null==R?void 0:R.invariantMapSelection)&&void 0!==c?c:{});0!==k.length&&x.push(O(`<b>Most potent residues</b>: ${k}`));const V=y(h.webLogoSelection);0!==V.length&&x.push(O(`<b>WebLogo</b>: ${V}`)),0!==x.length&&x.unshift(o.h1("Selection Sources"));const D=o.div(o.divV(x));m.addTitle(o.divV([o.h1(`${g.trueCount} selected rows${p}`),D],"css-gap-small")),g.anyTrue&&m.addPane("Actions",(()=>{try{const t=o.label("New view");if(v()(t).addClass("d4-link-action"),t.onclick=()=>h.createNewView(),t.onmouseover=t=>o.tooltip.show("Creates a new view from current selection",t.clientX+5,t.clientY+5),null===C)return o.divV([t]);const e=o.label("New cluster");v()(e).addClass("d4-link-action"),e.onclick=()=>{if(null===C)throw new Error("Logo summary table viewer is not found");C.clusterFromSelection()},e.onmouseover=t=>o.tooltip.show("Creates a new cluster from selection",t.clientX+5,t.clientY+5);const n=o.label("Remove cluster");return v()(n).addClass("d4-link-action"),n.onclick=()=>{const t=h.findViewer(G.LOGO_SUMMARY_TABLE);if(null===t)throw new Error("Logo summary table viewer is not found");t.removeCluster()},n.onmouseover=t=>o.tooltip.show("Removes currently selected custom cluster",t.clientX+5,t.clientY+5),n.style.visibility=0===C.clusterSelection[T.W.CUSTOM].length?"hidden":"visible",o.divV([t,e,n])}catch(t){const e=o.divText("Error in Actions");return o.tooltip.bind(e,String(t)),e}}),!0);let F=h.settings;const H=[I,R,C].filter((t=>null!==t&&(t.type!==this.accordionSource||(F=t,!1))));if(null===F)throw new Error("PeptidesError: Model is the source of accordion but is not initialized");F!==h.settings&&H.push(h.settings);const B=H.filter((t=>null!==t&&(0,w.$s)(F,t)&&(t!==h.settings||h.isInitialized)));B.push(F);const Y=s.BitSet.create(h.df.rowCount);for(const t of B){const e=t===this.settings?(0,w.KT)(this.webLogoSelection,this.monomerPositionStats):t instanceof T.s?(0,w.KT)(t.clusterSelection,t.clusterStats):t instanceof b.xN?(0,w.KT)(t.mutationCliffsSelection,(0,w.qI)(null!==(d=t.mutationCliffs)&&void 0!==d?d:new Map,h.df.rowCount)):null;if(null!==e&&Y.or(e),t instanceof b.J){const e=(0,w.KT)(t.invariantMapSelection,t.monomerPositionStats);null!==e&&Y.or(e)}}const $=F;F===h.settings||$ instanceof T.s||null==$.mutationCliffs||m.addPane("Mutation Cliffs pairs",(()=>(0,S.F)(h.df,{mutationCliffs:$.mutationCliffs,mutationCliffsSelection:$.mutationCliffsSelection,gridColumns:h.analysisView.grid.columns,sequenceColumnName:$.sequenceColumnName,positionColumns:$.positionColumns,activityCol:$.getScaledActivityColumn()}).root),!0);const W=F===h.settings,j=W?this.webLogoSelection:F instanceof b.J?F.invariantMapSelection:{},z=F instanceof T.s?F.clusterSelection:null!==(f=null==C?void 0:C.clusterSelection)&&void 0!==f?f:{};m.addPane("Distribution",(()=>{var t;try{return(0,E.HV)(h.df,{peptideSelection:Y,columns:W?null!==(t=h.settings.columns)&&void 0!==t?t:{}:F.getAggregationColumns(),activityCol:W?h.getScaledActivityColumn():F.getScaledActivityColumn(),monomerPositionSelection:j,clusterSelection:z,clusterColName:null==C?void 0:C.clustersColumnName})}catch(t){const e=o.divText("Error in Distribution");return o.tooltip.bind(e,String(t)),e}}),!0);const K=(t,e)=>{if(null==t||null==e)return!1;for(const[n,i]of Object.entries(t))if(i!==e[n])return!1;return!0};return m.addPane("Selection",(()=>{var t;try{return function(t,e){var n,i,r;if(0===e.tableSelection.trueCount)return o.divText("No compounds selected");const a=s.DataFrame.create(t.rowCount);a.name="Selected compounds",a.filter.copyFrom(e.tableSelection);let l=null;for(let t=1;t<e.gridColumns.length;t++){const o=e.gridColumns.byIndex(t);if(!o.visible)continue;const r=o.column;if(r.type===s.COLUMN_TYPE.BOOL)continue;null===l&&o.grid&&(null===(n=o.grid.sortByColumns)||void 0===n?void 0:n.length)>0&&(null===(i=o.grid.sortTypes)||void 0===i?void 0:i.length)===o.grid.sortByColumns.length&&(l={cols:o.grid.sortByColumns,types:o.grid.sortTypes});let u=null,c=null;try{u=r.getRawData(),c=r.categories}catch(t){}const d=u&&c?r.isNumerical?t=>u[t]:t=>c[u[t]]:t=>r.get(t),f=t=>r.isNone(t)?null:d(t),h=r.name===e.activityColumn.name?a.columns.addNewFloat(o.name).init((t=>f(t))):a.columns.addNewVirtual(o.name,(t=>f(t)),r.type);for(const[t,e]of r.tags)h.setTag(t,e)}const u=a.plot.grid();u.props.showRowHeader=!1,u.root.style.maxWidth="100%",s.debounce(o.onSizeChanged(u.root),50).subscribe((t=>{var e;const n=u.root.parentElement;(null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.classList.contains("panel-content"))&&(u.root.style.height="calc(100% - 20px)",u.root.style.width="calc(100% - 20px)",u.root.style.position="absolute",u.root.style.right="10px",u.root.style.top="10px")})),(0,w.zz)(u);const c=o.box(u.root);c.style.marginLeft="0px",setTimeout((()=>{null!==l&&u.sort(l.cols,l.types);for(let t=1;t<e.gridColumns.length;t++){const n=e.gridColumns.byIndex(t);n.visible&&u.col(n.name)&&(u.col(n.name).width=n.width)}}),500);const d=(0,_.Ej)(e.activityColumn,a.filter,e.positionColumns,{isFiltered:a.filter.anyTrue||a.filter.anyFalse}),f={isSelectionTable:!0,cachedWebLogoTooltip:()=>({bar:"",tooltip:null}),webLogoBounds:()=>({}),colorPalette:()=>e.colorPalette},h={x:0,y:0,monomerPosition:{},mpStats:d};return e.isAnalysis&&(0,A.FZ)(u,d,e.positionColumns,e.activityColumn,f,h),(null!==(r=t.columns.bySemTypeAll(s.SEMTYPE.MACROMOLECULE))&&void 0!==r?r:[]).forEach((t=>{a.col(t.name)&&(a.col(t.name).temp[M.j.notationProvider]=t.temp[M.j.notationProvider])})),c}(h.df,{positionColumns:W?h.positionColumns:F.positionColumns,columns:W?null!==(t=h.settings.columns)&&void 0!==t?t:{}:F.getAggregationColumns(),activityColumn:W?h.getScaledActivityColumn():F.getScaledActivityColumn(),gridColumns:h.analysisView.grid.columns,colorPalette:(0,a.SM)(h.df.getCol(W?h.settings.sequenceColumnName:F.sequenceColumnName),U.Z.getSeqHelper()),tableSelection:h.getCombinedSelection(),isAnalysis:null!==h.settings&&(W||K(h.settings.columns,F.getAggregationColumns()))})}catch(t){const e=o.divText("Error in Selection");return o.tooltip.bind(e,String(t)),e}}),!0),m}getScaledActivityColumn(t=!1){const e=this.df.col(y.$2.ACTIVITY);return t&&null!==e?s.DataFrame.fromColumns([e]).clone(this.df.filter).getCol(e.name):e}updateGrid(){this.joinDataFrames(),this.createScaledCol(),this.webLogoBounds={};const t={selectionCallback:(t,e)=>this.modifyWebLogoSelection(t,e),unhighlightCallback:()=>this.unhighlight(),colorPalette:()=>(0,a.SM)(this.df.getCol(this.settings.sequenceColumnName),U.Z.getSeqHelper()),webLogoBounds:()=>this.webLogoBounds,cachedWebLogoTooltip:()=>this.cachedWebLogoTooltip,highlightCallback:(t,e,n)=>{(0,w.dl)(t,e,n),this.isHighlighting=!0},isSelectionTable:!1,headerSelectedMonomers:()=>this.webLogoSelectedMonomers};if(null===this.monomerPositionStats||null===this.positionColumns)throw new Error("PeptidesError: Could not updage grid: monomerPositionStats or positionColumns are null");A.FZ(this.analysisView.grid,this.monomerPositionStats,this.positionColumns,this.getScaledActivityColumn(),t),this._layoutEventInitialized||(r.events.onViewLayoutApplied.subscribe((t=>{t.view.id===this.analysisView.id&&this.updateGrid()})),this._layoutEventInitialized=!0),this.setTooltips(),this.setBitsetCallback(),this.setGridProperties()}joinDataFrames(){const t=this.df.name,e=this.df.columns,n=(0,u.R)(this.df.getCol(this.settings.sequenceColumnName),U.Z.getSeqHelper()),i=n.columns.names();if(i.every((t=>e.contains(t))))i.forEach((t=>{this.df.col(t).setTag(y.gp.ANALYSIS_COL,"true"),this.df.col(t).setTag(y.gp.POSITION_COL,"true"),A.rI(this.df.col(t),this.alphabet)}));else for(const t of i){let i=this.df.col(t);const o=n.getCol(t);null!==i&&e.remove(t);const r=o.categories,s=o.getRawData();i=e.addNew(o.name,o.type).init((t=>r[s[t]])),i.setTag(y.gp.ANALYSIS_COL,"true"),i.setTag(y.gp.POSITION_COL,"true"),A.rI(i,this.alphabet)}this.df.name=t}createScaledCol(){const t=this.analysisView.grid,e=(0,w.Y1)(this.df.getCol(this.settings.activityColumnName),this.settings.activityScaling);this.df.columns.replace(y.$2.ACTIVITY,e),t.columns.setOrder([e.name])}unhighlight(){this.isHighlighting&&(this.df.rows.highlight(null),this.isHighlighting=!1)}setTooltips(){this.analysisView.grid.onCellTooltip(((t,e,n)=>{var i,o;return!(!t.isColHeader||(null===(i=t.tableColumn)||void 0===i?void 0:i.semType)!==y.uF.MONOMER)||!(!t.isTableCell||(null===(o=t.tableColumn)||void 0===o?void 0:o.semType)!==y.uF.MONOMER)}))}getCombinedSelection(){var t,e,n,i,o,r,a,l;const u=new h.A(this.df.rowCount,!1),c=(t,e)=>{for(const[n,i]of Object.entries(t))for(const t of i){const i=null==e?void 0:e[n];if(void 0===i)continue;const o=i[t];void 0!==o&&u.or(o.mask)}};c(this.webLogoSelection,this.monomerPositionStats);const d=this.findViewer(G.SEQUENCE_VARIABILITY_MAP);c(null!==(t=null==d?void 0:d.invariantMapSelection)&&void 0!==t?t:{},null!==(e=null==d?void 0:d.monomerPositionStats)&&void 0!==e?e:null),((t,e)=>{var n,i;for(const[o,r]of Object.entries(t))for(const t of r){const r=null!==(i=null===(n=null==e?void 0:e.get(t))||void 0===n?void 0:n.get(o))&&void 0!==i?i:null;if(null!==r)for(const[t,e]of r.entries()){u.setTrue(t);for(const t of e)u.setTrue(t)}}})(null!==(n=null==d?void 0:d.mutationCliffsSelection)&&void 0!==n?n:{},null!==(i=null==d?void 0:d.mutationCliffs)&&void 0!==i?i:null);const f=this.findViewer(G.MOST_POTENT_RESIDUES);c(null!==(o=null==f?void 0:f.invariantMapSelection)&&void 0!==o?o:{},null!==(r=null==f?void 0:f.monomerPositionStats)&&void 0!==r?r:null);const m=this.findViewer(G.LOGO_SUMMARY_TABLE);for(const t of Object.keys(null!==(a=null==m?void 0:m.clusterSelection)&&void 0!==a?a:{}))for(const e of null!==(l=m.clusterSelection[t])&&void 0!==l?l:[]){const n=m.clusterStats[t][e];u.or(n.mask)}return s.BitSet.fromBytes(u.buffer.buffer,u.length)}setBitsetCallback(){if(this.isBitsetChangedInitialized)return;const t=this.df.selection,e=this.df.filter;let n=null;const i=()=>{try{null!=n&&(clearTimeout(n),n=null);const t=this.createAccordion();if(null===t)return;r.shell.o=t.root,n=setTimeout((()=>{r.shell.o!=t.root&&(r.shell.o=t.root)}),1500)}catch(t){console.error(t)}};t.onChanged.subscribe((()=>{if(this.controlFire)this.controlFire=!1;else try{this.isUserChangedSelection||t.copyFrom(this.getCombinedSelection(),!1)}catch(t){N._package.logger.debug("Peptides: Error on selection changed"),N._package.logger.debug(t)}finally{i()}})),e.onChanged.subscribe((()=>{var t,e;try{if(this.controlFire)return void(this.controlFire=!1);const n=this.findViewer(G.LOGO_SUMMARY_TABLE);null!==n&&void 0!==n.model&&(n._logoSummaryTable=null!==(t=n.createLogoSummaryTable())&&void 0!==t?t:n._logoSummaryTable,n._viewerGrid=null!==(e=n.createLogoSummaryTableGrid())&&void 0!==e?e:n._viewerGrid,n.render())}catch(t){N._package.logger.debug("Peptides: Error on filter changed"),N._package.logger.debug(t)}finally{i()}})),this.isBitsetChangedInitialized=!0}fireBitsetChanged(t,e=!1){this.accordionSource=t,this.isBitsetChangedInitialized||this.setBitsetCallback(),this.isUserChangedSelection=!1,this.df.selection.fireChanged(),e&&this.df.filter.fireChanged(),this.controlFire=!0,this.df.selection.fireChanged(),e&&this.df.filter.fireChanged(),this.isUserChangedSelection=!0,this.webLogoSelectedMonomers=(0,w.qx)(this.df)}setGridProperties(t){var e,n,i,o;const r=this.analysisView.grid,s=r.props;s.allowColSelection=null!==(e=null==t?void 0:t.allowColSelection)&&void 0!==e&&e,s.allowEdit=null!==(n=null==t?void 0:t.allowEdit)&&void 0!==n&&n,s.showReadOnlyNotifications=null!==(i=null==t?void 0:t.showReadOnlyNotifications)&&void 0!==i&&i,s.showCurrentRowIndicator=null!==(o=null==t?void 0:t.showCurrentRowIndicator)&&void 0!==o&&o;const l=this.positionColumns;if(null===l)throw new Error("PeptidesError: Could not set grid properties: positionColumns are null");let u=10;const c=r.canvas.getContext("2d");if(null===c)throw new Error("PeptidesError: Could not set grid properties: canvas context is null");for(const t of l){const e=(0,a.zS)(t.categories.reduce(((t,e)=>t.length>e.length?t:e)),6),n=Math.ceil(c.measureText(e).width);u=Math.max(u,n)}const d=l.map((t=>t.name));for(let t=1;t<this.analysisView.grid.columns.length;++t){const e=this.analysisView.grid.columns.byIndex(t);if(null===e)throw new Error(`PeptidesError: Could not get analysis view: grid column with index '${t}' is null`);if(null===e.column)throw new Error(`PeptidesError: Could not get analysis view: grid column with index '${t}' has null column`);e.visible=d.includes(e.column.name)||e.column.name===y.$2.ACTIVITY}setTimeout((()=>{for(const t of l){const e=r.col(t.name);if(null===e)throw new Error(`PeptidesError: Could not set column width: grid column '${t.name}' is null`);e.width=u+15}}),100)}closeViewer(t){const e=this.findViewer(t);null==e||e.detach(),null==e||e.close()}findViewerNode(t){for(const e of this.analysisView.dockManager.rootNode.children)if(e.container.containerElement.innerHTML.includes(t))return e;return null}addDendrogram(){return H(this,void 0,void 0,(function*(){const t=s.TaskBarProgressIndicator.create("Calculating distance matrix...");try{const t=s.Func.find({package:"Dendrogram",name:"hierarchicalClustering"})[0];if(!t||4!==t.inputs.length)throw new Error("Correct dendrogram function is not found");yield t.apply({df:this.df,colNameList:[this.settings.sequenceColumnName],distance:"euclidean",linkage:"complete"})}catch(t){N._package.logger.error(t)}finally{t.close()}}))}init(t){if(!this.isInitialized){if(this.settings=t,this.isInitialized=!0,!this.isRibbonSet&&"1"!==this.df.getTag(y.gp.MULTIPLE_VIEWS)){const t=o.iconFA("wrench",(()=>(0,x.OH)(this)),"Peptides analysis settings");this.analysisView.setRibbonPanels([[t]],!1),this.isRibbonSet=!0,this.updateGrid()}this.subs.push(r.events.onAccordionConstructed.subscribe((t=>{if(!(r.shell.o instanceof s.SemanticValue||r.shell.o instanceof s.Column&&this.df.columns.toList().includes(r.shell.o)))return;const e=t.getPane("Actions"),n=v()(e.root).find(".d4-flex-col"),a=o.label("Calculate identity");a.classList.add("d4-link-action"),o.tooltip.bind(a,"Adds a column with fractions of matching monomers against sequence in the current row"),a.onclick=()=>{const t=this.df.getCol(this.settings.sequenceColumnName);d(this.df,t,t.get(this.df.currentRowIdx),i.IDENTITY,U.Z.getSeqHelper()).then((e=>e.setTag(y.gp.IDENTITY_TEMPLATE,t.get(this.df.currentRowIdx)))).catch((t=>N._package.logger.debug(t)))},n.append(o.span([a],"d4-markdown-row"));const l=o.label("Calculate similarity");l.classList.add("d4-link-action"),o.tooltip.bind(l,"Adds a column with sequence similarity scores against sequence in the current row"),l.onclick=()=>{const t=this.df.getCol(this.settings.sequenceColumnName);d(this.df,t,t.get(this.df.currentRowIdx),i.SIMILARITY,U.Z.getSeqHelper()).then((e=>e.setTag(y.gp.SIMILARITY_TEMPLATE,t.get(this.df.currentRowIdx)))).catch((t=>N._package.logger.debug(t)))},n.append(o.span([l],"d4-markdown-row"))}))),this.subs.push(r.events.onViewRemoved.subscribe((t=>{t.id===this.analysisView.id&&this.subs.forEach((t=>t.unsubscribe())),r.log.debug(`Peptides: view ${t.name} removed`)}))),this.subs.push(r.events.onTableRemoved.subscribe((t=>{t.id===this.df.id&&this.subs.forEach((t=>t.unsubscribe())),r.log.debug(`Peptides: table ${t.name} removed`)}))),this.subs.push(r.events.onProjectClosed.subscribe((t=>{t.id===r.shell.project.id&&this.subs.forEach((t=>t.unsubscribe())),r.log.debug(`Peptides: project ${t.name} closed`)}))),this.fireBitsetChanged(null,!0),this.analysisView.grid.invalidate()}}findViewer(t){return g()(this.analysisView.viewers).find((e=>e.type===t))||null}addLogoSummaryTable(t){return H(this,void 0,void 0,(function*(){null!=t||(t={sequenceColumnName:this.settings.sequenceColumnName,clustersColumnName:g()(this.df.columns.categorical).next().value,activityColumnName:this.settings.activityColumnName,activityScaling:this.settings.activityScaling});const e=yield this.df.plot.fromType(G.LOGO_SUMMARY_TABLE,t);(0,w.Lv)()&&this.analysisView.addViewer(e),this.analysisView.dockManager.dock(e,s.DOCK_TYPE.RIGHT,null,G.LOGO_SUMMARY_TABLE),e.viewerGrid.invalidate()}))}addClusterMaxActivityViewer(t){return H(this,void 0,void 0,(function*(){var e,n,i,o,r,a,l,u,c;const d=null!==(o=null!==(n=null===(e=this._mclCols)||void 0===e?void 0:e.find((t=>t.toLowerCase().startsWith("cluster (mcl)"))))&&void 0!==n?n:null===(i=this.findViewer(G.LOGO_SUMMARY_TABLE))||void 0===i?void 0:i.clustersColumnName)&&void 0!==o?o:null===(r=this._sequenceSpaceCols)||void 0===r?void 0:r.find((t=>t.toLowerCase().startsWith("cluster")));null!=t||(t={activityColumnName:this.settings.activityColumnName,clusterColumnName:null!=d?d:null===(a=g()(this.df.columns.categorical).next().value)||void 0===a?void 0:a.name,activityTarget:y.wf.HIGH,connectivityColumnName:null!==(u=null!==(l=this._mclCols.find((t=>t.toLowerCase().startsWith("connectivity"))))&&void 0!==l?l:this.df.columns.names().find((t=>{var e;return t.toLowerCase().includes("connectivity")&&(null===(e=this.df.col(t))||void 0===e?void 0:e.isNumerical)})))&&void 0!==u?u:"",clusterSizeThreshold:20,activityThreshold:1e3});const f=yield this.df.plot.fromType(G.CLUSTER_MAX_ACTIVITY,t),h=null!==(c=this.findViewerNode(G.LOGO_SUMMARY_TABLE))&&void 0!==c?c:null;this.analysisView.dockManager.dock(f,h?s.DOCK_TYPE.DOWN:s.DOCK_TYPE.RIGHT,h,G.CLUSTER_MAX_ACTIVITY)}))}addMonomerPosition(t){return H(this,void 0,void 0,(function*(){null!=t||(t={maxMutations:1,activityScaling:this.settings.activityScaling,activityColumnName:this.settings.activityColumnName,sequenceColumnName:this.settings.sequenceColumnName,minActivityDelta:0,activityTarget:y.wf.HIGH});const e=yield this.df.plot.fromType(G.SEQUENCE_VARIABILITY_MAP,t);(0,w.Lv)()&&this.analysisView.addViewer(e);const n=this.findViewer(G.MOST_POTENT_RESIDUES),i=this.analysisView.dockManager,[o,r,a]=null===n?[s.DOCK_TYPE.DOWN,null,void 0]:[s.DOCK_TYPE.LEFT,this.findViewerNode(G.MOST_POTENT_RESIDUES),.7];i.dock(e,o,r,G.SEQUENCE_VARIABILITY_MAP,a)}))}addMostPotentResidues(t){return H(this,void 0,void 0,(function*(){null!=t||(t={activityScaling:this.settings.activityScaling,activityColumnName:this.settings.activityColumnName,sequenceColumnName:this.settings.sequenceColumnName,minActivityDelta:0,maxMutations:1,activityTarget:y.wf.HIGH});const e=yield this.df.plot.fromType(G.MOST_POTENT_RESIDUES,t);(0,w.Lv)()&&this.analysisView.addViewer(e);const n=this.findViewer(G.SEQUENCE_VARIABILITY_MAP),i=this.analysisView.dockManager,[o,r,a]=null===n?[s.DOCK_TYPE.DOWN,null,void 0]:[s.DOCK_TYPE.RIGHT,this.findViewerNode(G.SEQUENCE_VARIABILITY_MAP),.3];i.dock(e,o,r,G.MOST_POTENT_RESIDUES,a)}))}createNewView(){const t=this.getVisibleSelection(),e=this.df.clone(t);for(const[t,n]of e.tags)e.setTag(t,t===y.gp.SETTINGS?n:"");e.name="Peptides Multiple Views",e.setTag(y.gp.MULTIPLE_VIEWS,"1");const n=r.shell.addTableView(e),i=this.findViewer(G.LOGO_SUMMARY_TABLE);return null!=i&&n.addViewer(G.LOGO_SUMMARY_TABLE,{[`sequence${y.To}`]:i.sequenceColumnName,[`activity${y.To}`]:i.activityColumnName,activityScaling:i.activityScaling,webLogoMode:i.webLogoMode,membersRatioThreshold:i.membersRatioThreshold,[`clusters${y.To}`]:i.clustersColumnName}),e.getTag(s.TAGS.ID)}clusterEmbeddings(){return H(this,void 0,void 0,(function*(){var t,e;if(!this._sequenceSpaceCols||0===this._sequenceSpaceCols.length)return void r.shell.warning("Embeddings columns are not initialized");const i=this._sequenceSpaceCols.filter((t=>t.toLowerCase().startsWith("embed_")));if(2!==i.length)return void r.shell.warning(`Found ${i.length} embeddings columns, expected 2`);const o=this._sequenceSpaceCols.filter((t=>t.toLowerCase().startsWith("cluster")));o.length>0&&this.df.columns.remove(o[0]);const s=this.df.getCol(i[0]).getRawData(),a=this.df.getCol(i[1]).getRawData(),l=null!==(t=this.settings.sequenceSpaceParams.epsilon)&&void 0!==t?t:.01,u=null!==(e=this.settings.sequenceSpaceParams.minPts)&&void 0!==e?e:4,c=yield function(t,e,i,o){return r=this,s=void 0,l=function*(){return new Promise((function(r,s){const a=new Worker(new URL(n.p+n.u(682),n.b));a.postMessage({embedX:t,embedY:e,minPts:o,epsilon:i}),a.onmessage=({data:{error:t,clusters:e}})=>{a.terminate(),t?s(t):r(e)}}))},new((a=void 0)||(a=Promise))((function(t,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function i(t){try{o(l.throw(t))}catch(t){e(t)}}function o(e){var o;e.done?t(e.value):(o=e.value,o instanceof a?o:new a((function(t){t(o)}))).then(n,i)}o((l=l.apply(r,s||[])).next())}));var r,s,a,l}(s,a,l,u),d=this.df.columns.getUnusedName("Cluster (DBSCAN)"),f=this.df.columns.addNewString(d);f.init((t=>c[t].toString())),null!==this._sequenceSpaceViewer&&(this._sequenceSpaceViewer.props.colorColumnName=f.name),this._sequenceSpaceCols=[i[0],i[1],f.name];const h=this.analysisView.grid.col(f.name);h&&(h.visible=!1)}))}addMCLClusters(){return H(this,void 0,void 0,(function*(){var t,e,n,i,o;if(null!==this._mclViewer)try{null===(t=this._mclViewer)||void 0===t||t.detach(),null===(e=this._mclViewer)||void 0===e||e.close()}catch(t){}0!==this._mclCols.length&&this._mclCols.forEach((t=>this.df.columns.remove(t))),this._mclCols=[];const a=this.df.getCol(this.settings.sequenceColumnName);null!==(n=(o=this.settings).mclSettings)&&void 0!==n||(o.mclSettings=new C.av);const l=this.settings.mclSettings;let u=0;const c=this.df.onColumnsAdded.subscribe((t=>{for(const e of t.columns)if((e.name.toLowerCase().startsWith("embed")||e.name.toLowerCase().startsWith("cluster")||e.name.toLowerCase().startsWith("connectivity"))&&e.name.toLowerCase().includes("mcl")){const t=this.analysisView.grid.col(e.name);if(null==t||this._mclCols.includes(e.name))continue;t.visible=!1,this._mclCols.push(e.name),u++}5===u&&c.unsubscribe()})),d=r.events.onViewerAdded.subscribe((t=>{try{const e=t.args.viewer;if(e.type===s.VIEWER.SCATTER_PLOT){if(this._sequenceSpaceViewer&&this.analysisView.dockManager.findNode(this._sequenceSpaceViewer.root)){const t=this.analysisView.dockManager.findNode(this._sequenceSpaceViewer.root);setTimeout((()=>{this.analysisView.dockManager.dock(e,s.DOCK_TYPE.FILL,t)}))}d.unsubscribe()}}catch(t){console.error(t)}})),f=JSON.stringify({cols:[a].map((t=>t.name)),metrics:[l.distanceF],weights:[1],aggregationMethod:D.MANHATTAN,preprocessingFuncs:["macromoleculePreprocessingFunction"],preprocessingFuncArgs:[{gapOpen:l.gapOpen,gapExtend:l.gapExtend,fingerprintType:l.fingerprintType}],threshold:l.threshold,maxIterations:l.maxIterations,useWebGPU:l.useWebGPU,inflate:l.inflation,minClusterSize:l.minClusterSize}),h=null!==(i=this.analysisView)&&void 0!==i?i:r.shell.getTableView(this.df.name);if(h){const t=s.Func.find({package:"EDA",name:"markovClusteringViewer"})[0];if(!t)throw new Error("Markov clustering function is not found");yield t.apply(),h.addViewer(G.MCL,{mclProps:f}),yield s.delay(500),this._mclViewer=this.findViewer(G.MCL),yield this._mclViewer.initPromise;const e=this.findViewer(G.LOGO_SUMMARY_TABLE);e&&(e._clusterStats=null,e._clusterSelection=null,e._viewerGrid=null,e._logoSummaryTable=null,e.render())}}))}addSequenceSpace(){return H(this,arguments,void 0,(function*(t={}){var e,n,i,o;if(null!==this._sequenceSpaceViewer)try{null===(e=this._sequenceSpaceViewer)||void 0===e||e.detach(),null===(n=this._sequenceSpaceViewer)||void 0===n||n.close()}catch(t){}0!==this._sequenceSpaceCols.length&&this._sequenceSpaceCols.forEach((t=>this.df.columns.remove(t))),this._sequenceSpaceCols=[];let l=this.df.getCol(this.settings.sequenceColumnName);const u=U.Z.getSeqHelper().getSeqHandler(l);if(u.isHelm())try{r.shell.warning("Column is in HELM notation. Sequences space will linearize sequences from position 0 prior to analysis");const t=u.convert(a.Hi.SEPARATOR,"/"),e=this.df.columns.getUnusedName(`Separator(${l.name})`);t.name=e,this.df.columns.add(t,!0),this.analysisView.grid.col(e).visible=!1,l=t}catch(t){return r.shell.error("Error on converting HELM notation to linear notation"),void r.shell.error(t)}const c=!t.clusterCol&&!!t.clusterEmbeddings,d=null!==(o=null===(i=this.settings)||void 0===i?void 0:i.sequenceSpaceParams)&&void 0!==o?o:new C.GI(c);d.clusterEmbeddings=c;const h={table:this.df,molecules:l,methodName:f.UMAP,similarityMetric:d.distanceF,plotEmbeddings:!0,options:{bypassLargeDataWarning:!0,dbScanEpsilon:d.epsilon,dbScanMinPts:d.minPts,randomSeed:"1",preprocessingFuncArgs:{gapOpen:d.gapOpen,gapExtend:d.gapExtend,fingerprintType:d.fingerprintType}},clusterEmbeddings:d.clusterEmbeddings};let m=0;const g=d.clusterEmbeddings?3:2,p=this.df.onColumnsAdded.subscribe((t=>{for(const e of t.columns)if(e.name.toLowerCase().startsWith("embed_")||d.clusterEmbeddings&&e.name.toLowerCase().startsWith("cluster")){const t=this.analysisView.grid.col(e.name);if(null==t||this._sequenceSpaceCols.includes(e.name))continue;t.visible=!1,this._sequenceSpaceCols.push(e.name),m++}m===g&&p.unsubscribe()})),v=r.events.onViewerAdded.subscribe((t=>{try{const e=t.args.viewer;if(e.type===s.VIEWER.SCATTER_PLOT){if(this._mclViewer&&this.analysisView.dockManager.findNode(this._mclViewer.root)){const t=this.analysisView.dockManager.findNode(this._mclViewer.root);setTimeout((()=>{this.analysisView.dockManager.dock(e,s.DOCK_TYPE.FILL,t)}))}v.unsubscribe()}}catch(t){console.error(t)}})),y=yield r.functions.call("Bio:sequenceSpaceTopMenu",h);v.unsubscribe(),y instanceof s.ScatterPlotViewer&&(d.clusterEmbeddings||t.clusterCol||(y.props.colorColumnName=this.getScaledActivityColumn().name),y.props.showXSelector=!1,y.props.showYSelector=!1,t.clusterCol&&(y.props.colorColumnName=t.clusterCol.name),this._sequenceSpaceViewer=y,y.onContextMenu.subscribe((t=>{try{t.item("Modify Sequence space parameters",(()=>{(0,x.OH)(this)}))}catch(t){}})))}))}}q.modelName="peptidesModel"},9995:(t,e,n)=>{"use strict";n.d(e,{_package:()=>W,getTreeHelperInstance:()=>j});var i=n(4328),o=n(7389),r=n(6082),s=n(5082),a=n(7233),l=n.n(a),u=(n(4788),n(768)),c=n(726),d=n(3541),f=n(5480);n(3981);class h{constructor(t){this.monomerLib=t}getCappedRotatedMonomer(t,e){const n=this.monomerLib.getMonomer(t,e);return n?n.molfile:null}}var m=n(4139),g=n(8608),p=n(2003),v=n(8070),y=n(115),C=n(5072),w=n.n(C),b=n(7825),A=n.n(b),S=n(7659),E=n.n(S),T=n(5056),x=n.n(T),N=n(540),_=n.n(N),M=n(1113),O=n.n(M),I=n(6677),L={};L.styleTagTransform=O(),L.setAttributes=x(),L.insert=E().bind(null,"head"),L.domAPI=A(),L.insertStyleElement=_(),w()(I.A,L),I.A&&I.A.locals&&I.A.locals;var P;!function(t){let e,n;!function(t){t.vert=function(t){return o.divV(t.map((t=>o.render(t))),{classes:"u2-panel"})},t.horz=function(t){return o.divH(t.map((t=>o.render(t))),{classes:"u2-panel"})}}(e=t.panels||(t.panels={})),t.appHeader=function(t){const n=o.iconImage("",t.iconPath);return l()(n).addClass("ui-app-header-icon").css("margin-right","20px"),e.horz([n,e.vert([o.markdown(t.description),t.learnMoreUrl?o.link("Learn more",t.learnMoreUrl):null])])},function(t){t.runAsync=function(t,e){return n=this,r=void 0,a=function*(){o.setUpdateIndicator(t,!0);try{return yield e()}catch(t){i.log.error(t)}finally{o.setUpdateIndicator(t,!1)}},new((s=void 0)||(s=Promise))((function(t,e){function i(t){try{l(a.next(t))}catch(t){e(t)}}function o(t){try{l(a.throw(t))}catch(t){e(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof s?n:new s((function(t){t(n)}))).then(i,o)}l((a=a.apply(n,r||[])).next())}));var n,r,s,a}}(n=t.tools||(t.tools={}))}(P||(P={}));var R=n(144),k=n.n(R);const V=rxjs.operators;class D extends r.JsViewer{get scViewer(){return this._scViewer||(this._scViewer=this.createSCViewer()),this._scViewer}constructor(){super(),this._titleHost=o.divText(u.q.CLUSTER_MAX_ACTIVITY,{id:"pep-viewer-title",style:{marginRight:"auto"}}),this._selsectIcon=o.div(),this.activityTarget=m.wf.HIGH,this.viewerError="",this.renderTimeout=null,this.renderDebounceTime=500,this.scFilterQuery=`\${${D.maxActivityInClusterColName}} == 1`,this.selectionSubscription=null,this.linesDrawSubscription=null,this.clusterColumnName=this.column("cluster",{nullable:!1}),this.activityColumnName=this.column("activity",{nullable:!1}),this.colorColumnName=this.column("color",{nullable:!0,defaultValue:null}),this.activityTarget=this.string("activityTarget",m.wf.HIGH,{choices:[m.wf.HIGH,m.wf.LOW]}),this.clusterSizeThreshold=this.int("clusterSizeThreshold",20),this.activityThreshold=this.int("activityThreshold",1e3),this.connectivityColumnName=this.column("connectivity",{nullable:!0})}get model(){return u.i.getInstance(this.dataFrame)}createSCViewer(){var t;const e={showXAxis:!0,showYAxis:!0,showXSelector:!1,showYSelector:!1,showColorSelector:!1,xAxisType:r.AxisType.logarithmic,yAxisType:r.AxisType.logarithmic,invertYAxis:this.activityTarget===m.wf.LOW,xColumnName:D.clusterSizeColName,markerType:"circle",markerDefaultSize:10,showSizeSelector:!1};if(null==this.clusterColumnName||null==this.activityColumnName||!this.dataFrame.columns.contains(this.clusterColumnName)||!this.dataFrame.columns.contains(this.activityColumnName))return this.viewerError="Please set valid cluster and activity columns",null;const n=this.dataFrame.columns.byName(this.activityColumnName),i=this.dataFrame.columns.byName(this.clusterColumnName),s=null!=this.connectivityColumnName?this.dataFrame.columns.byName(this.connectivityColumnName):null;if(![r.COLUMN_TYPE.FLOAT,r.COLUMN_TYPE.INT,r.COLUMN_TYPE.BIG_INT,r.COLUMN_TYPE.QNUM].includes(n.type))return this.viewerError="Activity column should be numeric",null;const a=this.dataFrame.columns.getOrCreate(D.clusterSizeColName,r.TYPE.INT),l={};for(let e=0;e<this.dataFrame.rowCount;e++){const n=i.get(e);null!=n&&"-1"!=n&&(l[n]=(null!==(t=l[n])&&void 0!==t?t:0)+1)}a.init((t=>{var e;return i.isNone(t)?null:null!==(e=l[i.get(t)])&&void 0!==e?e:null})),n.stats.min<=0&&(e.yAxisType=r.AxisType.linear);const u={},c={};for(let t=0;t<this.dataFrame.rowCount;t++){const e=i.get(t);if(null==e||i.isNone(t)||n.isNone(t))continue;const o=n.get(t),r=u[e];if((null==r||null==r||o>n.get(r)&&this.activityTarget===m.wf.HIGH||o<n.get(r)&&this.activityTarget===m.wf.LOW)&&(u[e]=t),s){const n=s.get(t),i=c[e];(null==i||null==i||n>s.get(i))&&(c[e]=t)}}const d=this.dataFrame.columns.getOrCreate(D.maxActivityInClusterColName,r.COLUMN_TYPE.INT);d.init((t=>i.isNone(t)?0:t===u[i.get(t)]?1:0)),this.dataFrame.columns.getOrCreate(D.maxConnectivityInClusterColName,r.COLUMN_TYPE.INT).init((t=>i.isNone(t)?0:t===c[i.get(t)]?1:0)),this.dataFrame.columns.getOrCreate(D.synSelectionColName,r.TYPE.STRING).init((t=>{if(i.isNone(t))return null;let e=null;return t===u[i.get(t)]&&(e=D.maxActivityLabel),s&&t===c[i.get(t)]&&(e=e?`${e}, ${D.maxConnectivityLabel}`:D.maxConnectivityLabel),e})),e.xColumnName=D.clusterSizeColName,e.yColumnName=this.activityColumnName,e.filter=this.scFilterQuery,this.viewerError="";const f=r.Viewer.scatterPlot(this.dataFrame,e);this.selectionSubscription&&this.selectionSubscription.unsubscribe(),this.selectionSubscription=f.onDataEvent.pipe((0,V.filter)((t=>"d4-select"==t.type))).subscribe((t=>{var e,n;const o=null!==(n=null===(e=t.bitset)||void 0===e?void 0:e.getSelectedIndexes())&&void 0!==n?n:[],s=this.dataFrame.selection,a=r.BitSet.create(this.dataFrame.rowCount,(t=>1==d.get(t)));a.and(s);for(let t=0;t<o.length;t++){const e=o[t],n=i.get(e);i.isNone(e)||(a.set(e,!0),null!=c[n]&&a.set(c[n],!0))}a.fireChanged();const l=a.getSelectedIndexes();for(const t of l){const e=i.get(t);null!=e&&null!=c[e]&&a.set(c[e],!0)}setTimeout((()=>{this.dataFrame.selection.copyFrom(a,!0),setTimeout((()=>{this.model&&this.model.createAccordion()}),200)}),200)}));const h=()=>{const t=r.BitSet.create(this.dataFrame.rowCount);Object.entries(u).forEach((([e,i])=>{var o;if(null==e||null==i)return;const r=parseInt(e),s=n.get(i),a=null!==(o=l[r])&&void 0!==o?o:l[e];s<this.activityThreshold&&a<this.clusterSizeThreshold||(t.set(i,!0,!1),null!=c[r]&&t.set(c[r],!0,!1))})),t.fireChanged(),this.dataFrame.selection.copyFrom(t,!0)};return this._selsectIcon=o.iconSvg("select-all",(()=>{h()}),"Select 3 Active quadrants"),this._selsectIcon.style.cursor="pointer",this._selsectIcon.style.marginRight="5px",h(),this.linesDrawSubscription&&this.linesDrawSubscription.unsubscribe(),this.linesDrawSubscription=f.onBeforeDrawScene.subscribe((()=>{const t=f.getInfo().canvas.getContext("2d"),e=f.viewport,n=f.worldToScreen(e.x,this.activityThreshold),i=f.worldToScreen(this.clusterSizeThreshold,e.y),o=f.worldToScreen(e.x+e.width,this.activityThreshold),r=f.worldToScreen(this.clusterSizeThreshold,e.y+e.height);t.beginPath(),t.strokeStyle="rgb(0,0,0)",t.lineWidth=1,t.moveTo(n.x,n.y),t.lineTo(o.x,o.y),t.moveTo(i.x,i.y),t.lineTo(r.x,r.y),t.stroke(),t.closePath()})),f}onTableAttached(){var t,e,n,i,o,r,s,a,l,u,c,d;super.onTableAttached();const f=null!==(e=null===(t=this.dataFrame)||void 0===t?void 0:t.col(m.$2.ACTIVITY))&&void 0!==e?e:null===(i=k()(null===(n=this.dataFrame)||void 0===n?void 0:n.columns.numerical).next())||void 0===i?void 0:i.value;null!=f&&(null===(o=this.getProperty(`activity${m.To}`))||void 0===o||o.set(this,f.name));const h=null===(s=k()(null===(r=this.dataFrame)||void 0===r?void 0:r.columns.categorical).next())||void 0===s?void 0:s.value;null!=h&&(null===(a=this.getProperty(`cluster${m.To}`))||void 0===a||a.set(this,h.name));const g=null===(u=k()(null===(l=this.dataFrame)||void 0===l?void 0:l.columns.numerical).next())||void 0===u?void 0:u.value;null!=g&&(null===(c=this.getProperty(`connectivity${m.To}`))||void 0===c||c.set(this,g.name)),this.render(),null===(d=this.dataFrame)||void 0===d||d.onDataChanged.subscribe((()=>{this.render()}))}render(){this.renderTimeout&&clearTimeout(this.renderTimeout),this.renderTimeout=setTimeout((()=>{var t,e;if(!this.dataFrame)return;l()(this.root).empty();const n=this.scViewer;if(null==n)return void this.root.appendChild(o.divText(null!==(t=this.viewerError)&&void 0!==t?t:"Error creating scatter plot"));const i=o.div("Cluster Size",{style:{alignSelf:"center",color:"var(--grey-6)",marginBottom:"5px"}}),r=o.div(this.activityTarget===m.wf.HIGH?"Maximum Activity":"Minimum Activity",{style:{color:"var(--grey-6)",alignSelf:"center",textOrientation:"mixed",writingMode:"tb",transform:"rotate(180deg)",marginLeft:"5px"}});n.props.colorColumnName=null!==(e=this.colorColumnName)&&void 0!==e?e:null,this.root.appendChild(o.divH([r,o.divV([o.divH([this._titleHost,this._selsectIcon],{style:{alignSelf:"center",lineHeight:"normal",width:"100%"}}),n.root,i],{style:{flexGrow:"1"}})])),n.root.style.width="100%",setTimeout((()=>{n.props.filter=this.scFilterQuery,n.invalidateCanvas()}),100)}),this.renderDebounceTime)}onPropertyChanged(t){super.onPropertyChanged(t),(null==t?void 0:t.name)!==`color${m.To}`&&(this._scViewer=null),this.render()}}D.clusterSizeColName="~cluster.size",D.maxActivityInClusterColName="~max.activity.for.cluster",D.maxConnectivityInClusterColName="~max.connectivity.for.cluster",D.synSelectionColName="Syn Selection",D.maxActivityLabel="Max Activity",D.maxConnectivityLabel="Max Connectivity";var F=n(3163);class G extends r.JsViewer{constructor(){super(),this.leftMotifLength=0,this.rightMotifLength=0,this.showPositionInfo=!0,this.position=this.int("position",1,{nullable:!1,showSlider:!1,min:1}),this.sequenceColumnName=this.column("sequence",{semType:r.SEMTYPE.MACROMOLECULE,nullable:!1}),this.valueColumnName=this.column("value",{columnTypeFilter:"numerical",nullable:!1}),this.leftMotifLength=this.int("leftMotifLength",0,{nullable:!1,min:0,max:10}),this.rightMotifLength=this.int("rightMotifLength",0,{nullable:!1,min:0,max:10}),this.showPositionInfo=this.bool("showPositionInfo",!0,{nullable:!1,defaultValue:!0,description:"Show position and overhangs info in the viewer header"}),i.events.onContextMenu.subscribe((t=>{var e;t.causedBy&&t.causedBy.target&&(null===(e=this._boxPlotViewer)||void 0===e?void 0:e.root.contains(t.causedBy.target))&&(t.causedBy.preventDefault(),t.causedBy.stopPropagation(),t.causedBy.stopImmediatePropagation())}))}getPositionFromColumn(){var t;const e=this.dataFrame.col(this.sequenceColumnName);if(null==e)return 1;const n=null!==(t=e.getTag(p.gp.selectedPosition))&&void 0!==t?t:"1",i=parseInt(n);return Number.isNaN(i)?1:Math.max(1,i)}onTableAttached(){if(super.onTableAttached(),null==this.dataFrame.columns.bySemType(r.SEMTYPE.MACROMOLECULE))throw i.shell.error("No sequence column found"),new Error("No sequence column found");const t=this.dataFrame.columns.getUnusedName("~sequence_position_monomers");this._positionColumn=this.dataFrame.columns.addNewString(t),this._positionColumn.semType="Monomer",this._positionColumn.setTag("cell.renderer","Monomer"),this.getProperty("sequenceColumnName").set(this,this.dataFrame.columns.bySemType(r.SEMTYPE.MACROMOLECULE).name),this.getProperty("valueColumnName").set(this,k()(this.dataFrame.columns.numerical).next().value.name),this.getProperty("position").set(this,this.getPositionFromColumn()),this.subs.push(r.debounce(this.dataFrame.onMetadataChanged,200).subscribe((t=>{const e=this.getPositionFromColumn();this.position!==e&&this.getProperty("position").set(this,e)})))}render(){var t,e,n,i;const s=(null!==(t=this.position)&&void 0!==t?t:-1)-1;if(null==this.dataFrame||!this.sequenceColumnName||s<0||!this._positionColumn||!this.valueColumnName)return;l()(this.root).empty(),null===(e=this._boxPlotViewer)||void 0===e||e.detach();const a=c.Z.getSeqHelper(),u=this.dataFrame.col(this.sequenceColumnName),d=a.getSeqHandler(u),f=Math.min(Math.max(null!==(n=this.leftMotifLength)&&void 0!==n?n:0,0),10),h=Math.min(Math.max(null!==(i=this.rightMotifLength)&&void 0!==i?i:0,0),10),m=Math.max(0,s-f),g=h+s,v=Array.from({length:g-m+1}).fill("").map(((t,e)=>d.getMonomersAtPosition(m+e,!0)));this._positionColumn.init((t=>v.map((e=>e[t])).join(p.ot))),this._boxPlotViewer=this.dataFrame.plot.box({categoryColumnNames:[this._positionColumn.name],plotStyle:"violin",valueColumnName:this.valueColumnName,colorColumnName:this._positionColumn.name,showColorSelector:!1,showSizeSelector:!1,showCategorySelector:!1,legendVisibility:r.VisibilityMode.Never,markerColorColumnName:this._positionColumn.name,title:"Sequence Position Statistics",autoLayout:!1,labelOrientation:"Vert"});const y=o.input.int("Left Overhang",{value:f,min:0,max:10,step:1,showSlider:!1,showPlusMinus:!0,onValueChanged:t=>{this.getProperty("leftMotifLength").set(this,y.value)},tooltipText:"Left overhang motif length from the selected position"}),C=o.input.int("Right Overhang",{value:h,min:0,max:10,step:1,showSlider:!1,showPlusMinus:!0,onValueChanged:t=>{this.getProperty("rightMotifLength").set(this,C.value)},tooltipText:"Right overhang motif length from the selected position"}),w=o.divH([y.root,o.h2(`${this.sequenceColumnName}: Position ${this.position}`),C.root],{style:{alignItems:"center",justifyContent:"space-around",width:"100%"}});this.showPositionInfo&&(this.root.appendChild(w),y.input.style.width="20px",C.input.style.width="20px"),this._boxPlotViewer.props.statistics=["min","max","avg","med","count"],this._boxPlotViewer.root.style.width="100%",this._boxPlotViewer.root.style.height="100%",this.root.appendChild(this._boxPlotViewer.root),this._boxPlotViewer.sub(this._boxPlotViewer.onPropertyValueChanged.subscribe((t=>{var e,n,i,o;if((null===(n=null===(e=this._boxPlotViewer)||void 0===e?void 0:e.props)||void 0===n?void 0:n.valueColumnName)&&(null===(o=null===(i=this._boxPlotViewer)||void 0===i?void 0:i.props)||void 0===o?void 0:o.valueColumnName)!==this.valueColumnName){const t=this._boxPlotViewer.props.valueColumnName;setTimeout((()=>this.getProperty("valueColumnName").set(this,t)),10)}})))}onPropertyChanged(t){null!=this.dataFrame&&this.sequenceColumnName&&this.render()}}var U=function(t,e,n,i){var o,r=arguments.length,s=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(r<3?o(s):r>3?o(e,n,s):o(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},q=function(t,e){return function(n,i){e(n,i,t)}},B=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};let Y,$=null;i.decorators||(i.decorators={}),["func","init","param","panel","editor","demo","app","appTreeBrowser","fileHandler","fileExporter","model","viewer","filter","cellRenderer","autostart","dashboard","folderViewer","semTypeDetector","packageSettingsEditor","functionAnalysis","converter","fileViewer","model","treeBrowser","polyfill"].forEach((t=>{i.decorators[t]||(i.decorators[t]=function(t){return function(t,e,n){}})}));const W=new r.Package;function j(){return Y}function z(t){return B(this,void 0,void 0,(function*(){const e=r.TaskBarProgressIndicator.create("Loading Peptides"),n=W.webRoot+"files/"+t,o=yield i.data.loadTable(n);o.name="Peptides",i.shell.addTableView(o).name="PeptidesView",i.shell.windows.showProperties=!0,e.close()}))}class K{static initPeptides(){return B(this,void 0,void 0,(function*(){try{null!=$||($=new h(yield i.functions.call("Bio:getBioLib"))),null!=Y||(Y=yield async function(){const t="Dendrogram",e=r.Func.find({package:t,name:"getTreeHelper"});if(0===e.length)throw new Error(`Package "${t}" must be installed for TreeHelper.`);return(await e[0].prepare().call()).getOutputParamValue()}()),yield c.Z.loadComponents()}catch(t){i.log.error(t)}}))}static Peptides(){const t=P.appHeader({iconPath:W.getIconUrl(),learnMoreUrl:"https://github.com/datagrok-ai/public/blob/master/help/domains/bio/peptides.md",description:"- Automatically recognizes peptides in your data\n- Invariant map and mutation cliffs\n- Logo plots to explore sequence composition\n- Hierarchical clustering\n- Sequence space to analyze clustering and activity cliffs\n- Finds statistically significant changes in activity for monomer/positions\n"}),e=i.shell.windows;e.showToolbox=!1,e.showHelp=!1,e.showProperties=!1;const n=r.View.create();return n.name="Peptides",o.appendAll(n.root,[t,o.divH([o.button("Simple demo",(()=>z("aligned.csv")),""),o.button("Complex demo",(()=>z("aligned_2.csv")),""),o.button("HELM demo",(()=>z("aligned_3.csv")),"")])]),n}static peptidesDialog(){var t;if(!i.shell.t||!(null===(t=i.shell.t.columns.bySemType("Macromolecule"))||void 0===t?void 0:t.length))return i.shell.warning("SAR Analysis requires an active table with Macromolecule column"),null;if(!r.Utils.firstOrNull(i.shell.t.columns.numerical))return i.shell.warning("SAR Analysis requires an active table with at least one numerical column for activity"),null;const e=(0,s.v)(i.shell.t),n=o.dialog("Analyze Peptides").add(e.host).onOK((()=>B(this,void 0,void 0,(function*(){e.callback()||n.show()}))));return n.show()}static testInitFunctionPeptides(t){return B(this,void 0,void 0,(function*(){i.shell.info("Test init function for Peptides package"),i.shell.info("Viewer name: "+t.dataFrame.name),yield new Promise((t=>setTimeout(t,1e3)))}))}static peptidesPanel(t){if(!t.dataFrame||!r.Utils.firstOrNull(t.dataFrame.columns.numerical))return new r.Widget(o.divText("SAR Analysis requires an active table with at least one numerical column for activity"));const e=(0,s.v)(t.dataFrame,t);return new r.Widget(e.host)}static monomerPosition(){return new d.J}static mostPotentResidues(){return new d.UJ}static logoSummaryTable(){return new f.s}static sequencePositionStatistics(){return new G}static clusterMaxActivity(){return new D}static manualAlignment(t){const e=i.shell.t,n=null==e?void 0:e.temp[u.i.modelName];return n?function(t,e){const n=o.input.textArea("",{value:t.get(e.currentRowIdx)});l()(n.root).addClass("pep-textinput");const s=o.button("Apply",(()=>{return o=this,r=void 0,a=function*(){const o=c.Z.getSeqHelper().getSeqHandler(t),r=n.value,s=o.splitter(r),a=e.currentRowIdx;t.set(a,r);for(let t=0;t<s.length;t++){const n=s.getCanonical(t);null!==e.col(t.toString())&&e.set(t.toString(),a,n)}const l=i.shell.o;i.shell.o=null,u.i.getInstance(e).updateGrid(),setTimeout((()=>{i.shell.o=l}),100)},new((s=void 0)||(s=Promise))((function(t,e){function n(t){try{l(a.next(t))}catch(t){e(t)}}function i(t){try{l(a.throw(t))}catch(t){e(t)}}function l(e){var o;e.done?t(e.value):(o=e.value,o instanceof s?o:new s((function(t){t(o)}))).then(n,i)}l((a=a.apply(o,r||[])).next())}));var o,r,s,a}),"Apply changes"),a=o.button(o.iconFA("redo"),(()=>n.value=t.get(e.currentRowIdx)),"Reset");return l()(a).addClass("pep-snippet-editor-icon pep-reset-icon"),new r.Widget(o.divV([a,n.root,s],"pep-textarea-box"))}(e.getCol(n.settings.sequenceColumnName),e):new r.Widget(o.divText("Manual alignment works with peptides analysis"))}static macromoleculeSarFastaDemo(){return B(this,void 0,void 0,(function*(){return yield function(){return t=this,e=void 0,o=function*(){i.shell.windows.showContextPanel=!0;const t=r.DataFrame.fromCsv(yield W.files.readAsText("aligned.csv"));t.name="Simple peptides",t.id||(t.id=`Simple-peptides-analysis-table-id-${Math.random()}-${Date.now()}`);const e=i.shell.addTableView(t);yield(0,v.cb)(50);const n=e.grid;yield new Promise((t=>{var e;let i=null;const o=null===(e=null==n?void 0:n.onAfterDrawContent)||void 0===e?void 0:e.subscribe((()=>{i&&clearTimeout(i),o.unsubscribe(),t(void 0)}));i=setTimeout((()=>{o.unsubscribe(),t(void 0)}),3e3)}));const o=t.getCol("IC50"),a=t.getCol("AlignedSequence");a.semType=r.SEMTYPE.MACROMOLECULE,a.setTag(m.gp.ALPHABET,p.YI.PT),a.meta.units=p.Hi.FASTA,a.setTag(p.gp.aligned,"SEQ.MSA");const l=(0,g.Y1)(o,m.rg.MINUS_LG),u=new y.av;u.threshold=94,yield(0,s.n)(o,a,null,t,l,m.rg.MINUS_LG,{addMCL:!0,useEmbeddingsClusters:!0,mclSettings:u})},new((n=void 0)||(n=Promise))((function(i,r){function s(t){try{l(o.next(t))}catch(t){r(t)}}function a(t){try{l(o.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((o=o.apply(t,e||[])).next())}));var t,e,n,o}()}))}static lstPiechartCellRenderer(){return new F.DX}}U([i.decorators.init(),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",Promise)],K,"initPeptides",null),U([i.decorators.func(),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",r.View)],K,"Peptides",null),U([i.decorators.func({"top-menu":"Bio | Analyze | SAR...",name:"Bio Peptides",outputs:[]}),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",Object)],K,"peptidesDialog",null),U([i.decorators.func(),q(0,i.decorators.param({type:"viewer"})),H("design:type",Function),H("design:paramtypes",[r.Viewer]),H("design:returntype",Promise)],K,"testInitFunctionPeptides",null),U([i.decorators.panel({tags:["widgets"],name:"Peptides"}),q(0,i.decorators.param({options:{semType:"Macromolecule"}})),H("design:type",Function),H("design:paramtypes",[r.Column]),H("design:returntype",r.Widget)],K,"peptidesPanel",null),U([i.decorators.func({meta:{icon:"files/icons/peptide-sar-viewer.svg"},tags:["viewer"],name:"Sequence Variability Map",description:"Peptides Sequence Variability Map Viewer",outputs:[{type:"viewer",name:"result"}]}),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",d.J)],K,"monomerPosition",null),U([i.decorators.func({meta:{icon:"files/icons/peptide-sar-vertical-viewer.svg"},tags:["viewer"],name:"Most Potent Residues",description:"Peptides Most Potent Residues Viewer",outputs:[{type:"viewer",name:"result"}]}),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",d.UJ)],K,"mostPotentResidues",null),U([i.decorators.func({meta:{icon:"files/icons/logo-summary-viewer.svg"},tags:["viewer"],name:"Logo Summary Table",outputs:[{type:"viewer",name:"result"}]}),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",f.s)],K,"logoSummaryTable",null),U([i.decorators.func({meta:{icon:"files/icons/sequence-statistics-viewer.svg"},tags:["viewer"],name:"Sequence Position Statistics",outputs:[{type:"viewer",name:"result"}]}),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",r.Viewer)],K,"sequencePositionStatistics",null),U([i.decorators.func({tags:["viewer"],name:"Active peptide selection",outputs:[{type:"viewer",name:"result"}]}),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",D)],K,"clusterMaxActivity",null),U([i.decorators.panel({tags:["widgets"],name:"Manual Alignment"}),q(0,i.decorators.param({options:{semType:"Monomer"}})),H("design:type",Function),H("design:paramtypes",[String]),H("design:returntype",r.Widget)],K,"manualAlignment",null),U([i.decorators.func({meta:{demoPath:"Bioinformatics | Peptide SAR",demoSkip:"GROK-14320"},name:"Peptide SAR",description:"Peptide SAR Analysis demo on peptide sequences in FASTA format"}),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",Promise)],K,"macromoleculeSarFastaDemo",null),U([i.decorators.func({meta:{cellType:"lst-pie-chart",gridChart:"true"},tags:["cellRenderer"],name:"LST Pie Chart",outputs:[{type:"grid_cell_renderer",name:"result"}]}),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",F.DX)],K,"lstPiechartCellRenderer",null)},726:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var i=n(8223),o=n(6082),r=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class s{static getMonomerLib(){if(!this._monomerLibHelper)throw new Error("MonomerLib is not initialized");return this._monomerLibHelper.getMonomerLib()}static getSeqHelper(){if(!this._secHelper)throw new Error("SeqHelper is not initialized");return this._secHelper}static loadSeqHelper(){return r(this,void 0,void 0,(function*(){var t;null!==(t=this._secHelper)&&void 0!==t||(this._secHelper=yield async function(){const t=o.Func.find({package:"Bio",name:"getSeqHelper"});if(0===t.length)throw new Error("Package 'Bio' must be installed for SeqHelper.");return(await t[0].prepare().call()).getOutputParamValue()}())}))}static loadComponents(){return r(this,void 0,void 0,(function*(){yield this.loadSeqHelper(),yield this.loadMonomerLib()}))}static loadMonomerLib(){return r(this,void 0,void 0,(function*(){var t;null!==(t=this._monomerLibHelper)&&void 0!==t||(this._monomerLibHelper=yield(0,i.pj)()),yield this._monomerLibHelper.awaitLoaded()}))}}},3657:(t,e,n)=>{"use strict";n.d(e,{Lw:()=>d,eW:()=>m,Ej:()=>f,uz:()=>c});var i=n(6082),o=n(4139);class r{constructor(){const t=navigator.hardwareConcurrency;this._workerCount=Math.max(t-2,1),this._workers=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(216),n.b))))}calc(t,e){return n=this,i=arguments,r=function*(t,e,n={}){var i,o,r;const s=new Map;try{const a=null!==(o=null===(i=n.targetCol)||void 0===i?void 0:i.cat.indexOf(n.currentTarget))&&void 0!==o?o:-1,l=t.length,u=new Array(this._workerCount),c=l*(l-1)/2;this._workerCount=Math.min(this._workerCount,c);const d=c/this._workerCount;e.forEach((t=>{var e;t.cat=null===(e=t.cat)||void 0===e?void 0:e.slice()})),(null===(r=n.targetCol)||void 0===r?void 0:r.cat)&&(n.targetCol.cat=n.targetCol.cat.slice());for(let i=0;i<this._workerCount;i++)u[i]=new Promise(((o,r)=>{const s=Math.floor(i*d),l=i===this._workerCount-1?c:Math.floor((i+1)*d);this._workers[i].postMessage({startIdx:s,endIdx:l,activityArray:t,monomerInfoArray:e,settings:n,currentTargetIdx:a}),this._workers[i].onmessage=({data:{pos:t,seq1Idxs:e,seq2Idxs:n,error:s}})=>{var a;s?(null===(a=this._workers[i])||void 0===a||a.terminate(),r(s)):(this._workers[i].terminate(),o({pos:t,seq1Idxs:e,seq2Idxs:n}))}}));const f=yield Promise.all(u),h=new Map;e.forEach(((t,e)=>{h.set(t.name,e)})),f.filter(Boolean).forEach((t=>{for(let n=0;n<t.pos.length;n++){const i=h.get(t.pos[n]),o=e[i].rawData[t.seq1Idxs[n]],r=e[i].cat[o],a=e[i].rawData[t.seq2Idxs[n]],l=e[i].cat[a];s.has(r)||s.set(r,new Map),s.has(l)||s.set(l,new Map);const u=s.get(r),c=s.get(l);u.has(t.pos[n])||u.set(t.pos[n],new Map),c.has(t.pos[n])||c.set(t.pos[n],new Map);const d=u.get(t.pos[n]),f=c.get(t.pos[n]);d.has(t.seq1Idxs[n])||d.set(t.seq1Idxs[n],[]),f.has(t.seq2Idxs[n])||f.set(t.seq2Idxs[n],[]);const m=d.get(t.seq1Idxs[n]),g=f.get(t.seq2Idxs[n]);m.push(t.seq2Idxs[n]),g.push(t.seq1Idxs[n])}}))}catch(t){this.terminate(),console.error(t)}return s},new((o=void 0)||(o=Promise))((function(t,e){function s(t){try{l(r.next(t))}catch(t){e(t)}}function a(t){try{l(r.throw(t))}catch(t){e(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(s,a)}l((r=r.apply(n,i||[])).next())}));var n,i,o,r}terminate(){var t;null===(t=this._workers)||void 0===t||t.forEach((t=>{try{null==t||t.terminate()}catch(t){console.error(t)}}))}}var s=n(5480),a=n(8774),l=n(5070),u=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function c(t,e){return u(this,arguments,void 0,(function*(t,e,n={}){var i,s;if(0===e.length)throw new Error(`PepAlgorithmError: Couldn't find any column of semType '${o.uF.MONOMER}'`);null!==(i=n.minActivityDelta)&&void 0!==i||(n.minActivityDelta=0),null!==(s=n.maxMutations)&&void 0!==s||(n.maxMutations=1);const a=new r,l=yield a.calc(t,e,n);return a.terminate(),l}))}function d(t,e){const n=new Map;let i=999999,o=-999999,r=2,s=2;for(const u of t.keys()){const c=new Map;n.set(u,c);const d=t.get(u);for(const t of d.keys()){const n=d.get(t),u=new a.A(e.length,!1);if(0===n.size)continue;for(const t of n.keys())u.setFast(t,!0),n.get(t).forEach((t=>u.setFast(t,!0)));const f=(0,l.GT)(e,u);i=Math.min(i,f.meanDifference),o=Math.max(o,f.meanDifference),r=Math.min(r,f.count),s=Math.max(s,f.count),c.set(t,f)}}return{stats:n,minDiff:i,maxDiff:o,minCount:r,maxCount:s}}function f(t,e,n,o={}){var r,s,u,c,d,f;null!==(r=o.isFiltered)&&void 0!==r||(o.isFiltered=!1);const m={general:{}};let g=t.getRawData(),p=t.length;if(null!==(s=o.columns)&&void 0!==s||(o.columns=n.map((t=>t.name))),o.isFiltered){p=e.trueCount;const t=new Float64Array(p),r=e.getSelectedIndexes();for(let e=0;e<p;++e)t[e]=g[r[e]];g=t,n=i.DataFrame.fromColumns(n).clone(e,o.columns).columns.toList(),o.target&&(o.target.col=o.target.col.clone(e)),o.aggValue&&(o.aggValue.col=o.aggValue.col.clone(e))}const v=null===(c=null===(u=o.target)||void 0===u?void 0:u.col)||void 0===c?void 0:c.getRawData(),y=null===(d=o.target)||void 0===d?void 0:d.col.categories,C=(null===(f=o.target)||void 0===f?void 0:f.cat)?null==y?void 0:y.indexOf(o.target.cat):-1;for(const t of n){if(!o.columns.includes(t.name))continue;const e=t.getRawData(),n=t.categories,i={general:{}};for(let t=0;t<n.length;++t){const r=n[t];if(""===r)continue;const s=new Array(p).fill(!1);for(let n=0;n<p;++n)e[n]!==t||v&&-1!==C&&v[n]!==C||(s[n]=!0);const u=a.A.fromValues(s);if(u.allFalse)continue;const c=(0,l.GT)(g,u,o.aggValue);i[r]=c,h(i.general,c)}m[t.name]=i,h(m.general,null,i.general)}return m}function h(t,e=null,n=null){var i,o,r,s,a,l,u,c,d,f,h,m,g,p,v,y,C;if(null===e&&null===n)throw new Error("MonomerPositionStatsError: either stats or summaryStats must be present");const w=null!==(i=null==e?void 0:e.count)&&void 0!==i?i:n.maxCount;null!==(o=t.maxCount)&&void 0!==o||(t.maxCount=w),t.maxCount<w&&(t.maxCount=w);const b=null!==(r=null==e?void 0:e.count)&&void 0!==r?r:n.minCount;null!==(s=t.minCount)&&void 0!==s||(t.minCount=b),t.minCount>b&&(t.minCount=b);const A=null!==(a=null==e?void 0:e.meanDifference)&&void 0!==a?a:n.maxMeanDifference;null!==(l=t.maxMeanDifference)&&void 0!==l||(t.maxMeanDifference=A),t.maxMeanDifference<A&&(t.maxMeanDifference=A);const S=null!==(u=null==e?void 0:e.meanDifference)&&void 0!==u?u:n.minMeanDifference;if(null!==(c=t.minMeanDifference)&&void 0!==c||(t.minMeanDifference=S),t.minMeanDifference>S&&(t.minMeanDifference=S),!isNaN(null!==(d=null==e?void 0:e.pValue)&&void 0!==d?d:NaN)){const i=null!==(f=null==e?void 0:e.pValue)&&void 0!==f?f:n.maxPValue;null!==(h=t.maxPValue)&&void 0!==h||(t.maxPValue=i),t.maxPValue<i&&(t.maxPValue=i);const o=null!==(m=null==e?void 0:e.pValue)&&void 0!==m?m:n.minPValue;null!==(g=t.minPValue)&&void 0!==g||(t.minPValue=o),t.minPValue>o&&(t.minPValue=o)}const E=null!==(p=null==e?void 0:e.ratio)&&void 0!==p?p:n.maxRatio;null!==(v=t.maxRatio)&&void 0!==v||(t.maxRatio=E),t.maxRatio<E&&(t.maxRatio=E);const T=null!==(y=null==e?void 0:e.ratio)&&void 0!==y?y:n.minRatio;null!==(C=t.minRatio)&&void 0!==C||(t.minRatio=T),t.minRatio>T&&(t.minRatio=T)}function m(t,e,n,i){const o=t.rowCount,r=t.getCol(e),u=r.getRawData(),c=r.categories,d=Array.from({length:c.length},(()=>new a.A(o,!1)));for(let t=0;t<o;++t)d[u[t]].setTrue(t);const f=n.map((t=>a.A.fromUint32Array(o,t.getRawData()))),h=n.map((t=>t.name)),m=i.getRawData(),g={},p={};for(const t of Object.values(s.W)){const e=t===s.W.ORIGINAL?d:f,n=t===s.W.ORIGINAL?c:h,o=t===s.W.ORIGINAL?g:p;for(let t=0;t<e.length;++t){const r=e[t];o[n[t]]=r.allTrue||r.allFalse?{count:r.length,meanDifference:0,ratio:1,pValue:null,mask:r,mean:i.stats.avg}:(0,l.GT)(m,r)}}const v={};return v[s.W.ORIGINAL]=g,v[s.W.CUSTOM]=p,v}},3163:(t,e,n)=>{"use strict";n.d(e,{DX:()=>S,X5:()=>v,rW:()=>w,k8:()=>b,Yd:()=>C,rI:()=>y,FZ:()=>A});var i=n(7389),o=n(6082),r=n(4139),s=n(2003),a=n(3657);const l=rxjs;var u=n(912),c=n(5480),d=n(3541);n(7194);var f,h,m;!function(t){t.maxMonomerLength=".mm.cellRenderer.maxMonomerLength"}(f||(f={})),function(t){t.applyToBackground=".m.cellRenderer.applyToBackground"}(h||(h={})),function(t){t.MSA="MSA",t.classic="classic"}(m||(m={})),new class{constructor(){this.color="rgb(100,100,100)",this.pivot=0,this.left=!1,this.transparencyRate=0,this.separator="",this.last=!1,this.drawStyle=m.classic,this.maxWord=[],this.wordIdx=0,this.gridCell=null,this.referenceSequence=null,this.maxLengthOfMonomer=null,this.monomerTextSizeMap={},this.logger=void 0,this.selectedPosition=void 0,this.isMultiLineContext=!1,this.lineNumber=0}};var g=n(726),p=n(3981);function v(t,e){t.strokeStyle=o.Color.toHtml(o.Color.selectedRows),t.lineWidth=3,t.strokeRect(e.x+1,e.y+1,e.width-1,e.height-1)}function y(t,e,n){t.semType=r.uF.MONOMER,t.setTag(o.TAGS.CELL_RENDERER,r.uF.MONOMER),t.setTag(r.gp.ALPHABET,e),n&&t.setTag(h.applyToBackground,"true")}function C(t,e,n,i,r){var s,a,l,u,c,f,h,m,g,p,y,C;const w=r.width/2,b=Math.ceil(r.x+1+w),A=Math.ceil(r.y+1+r.height/2),S=Math.min(.9*w/2,.9*r.height/2);if(i instanceof d.UJ){const r=i.monomerPositionStats[n],s=r[e].pValue,a=r[e].meanDifference,l=1-r.general.maxPValue,u=1-r.general.minPValue,c=Math.min(l,u),d=l-c,f=u-c,h=Math.max(d,f),m=null===s?0:1-s-c,g=a>=0?m:-m,p=o.Color.toHtml(null===s?o.Color.lightLightGray:o.Color.scaleColor(g,-h,h,255)),v=Math.max(Math.abs(i.monomerPositionStats.general.minMeanDifference),i.monomerPositionStats.general.maxMeanDifference),y=Math.abs(a)/v,C=Math.floor(S*y);t.beginPath(),t.fillStyle=p,t.arc(b-w/2,A,C<3||null===s?3:C,0,2*Math.PI,!0),t.closePath(),t.fill()}else if(i instanceof d.J&&i.mutationCliffs&&i.cliffStats){const r=i.cliffStats.maxCount,u=i.cliffStats.minDiff,c=i.cliffStats.maxDiff,d=null===(l=null===(a=null===(s=i.cliffStats)||void 0===s?void 0:s.stats)||void 0===a?void 0:a.get(e))||void 0===l?void 0:l.get(n);if(d){const e=d.count,n=d.meanDifference,i=Math.floor(Math.abs(e/Math.max(r,2))*S),s=Math.max(Math.abs(u),Math.abs(c)),a=o.Color.toHtml(null===n?o.Color.lightLightGray:o.Color.scaleColor(n,-s,s,255));t.beginPath(),t.fillStyle=a,t.arc(b-w/2,A,i<3||0==e?3:i,0,2*Math.PI,!0),t.closePath(),t.fill()}}if(t.textBaseline="middle",t.textAlign="end",t.fillStyle="#606060",t.font="13px Roboto, Roboto Local, sans-serif",t.shadowBlur=5,t.shadowColor=o.Color.toHtml(o.Color.white),i instanceof d.J){let o=0;const r=null!==(h=null===(f=null===(c=null===(u=i.mutationCliffs)||void 0===u?void 0:u.get(e))||void 0===c?void 0:c.get(n))||void 0===f?void 0:f.entries())&&void 0!==h?h:null;if(null!==r)for(const[t,e]of r)o+=null!==(m=e.length)&&void 0!==m?m:0;0!==o&&t.fillText(o.toString(),b+w-5,A,w-5)}else if(i instanceof d.UJ){const o=null!==(g=i.monomerPositionStats)&&void 0!==g?g:null===(p=null==i?void 0:i.model)||void 0===p?void 0:p.monomerPositionStats,r=null===(C=null===(y=null==o?void 0:o[n])||void 0===y?void 0:y[e])||void 0===C?void 0:C.count;r&&t.fillText(r.toString(),b+w-5,A,w-5)}if(i instanceof d.J){const o=i.mutationCliffsSelection[n];o&&o.includes(e)&&v(t,r)}else if(i instanceof d.UJ){const o=i.invariantMapSelection[n];o&&o.includes(e)&&v(t,r)}}function w(t,e,n,i,r,s,a){a=o.Color.fromHtml(o.Color.toHtml(function(t,e){return(16777215&t|255<<24)>>>0}(a)));let l=r.toFixed(2);l.endsWith(".00")&&(l=r.toFixed(0)),l.endsWith("0")&&l.includes(".")&&(l=r.toFixed(1));const u=Math.min(13,Math.floor(s.width/40/l.length*6*13));t.fillStyle=o.Color.toHtml(a),t.fillRect(s.x,s.y,s.width,s.height),t.font=`${u}px Roboto, Roboto Local, sans-serif`,t.textAlign="center",t.textBaseline="middle",t.fillStyle=o.Color.toHtml(o.Color.getContrastColor(a)),t.fillText(l,s.x+s.width/2,s.y+s.height/2,s.width);const c=i[n];c&&c.includes(e)&&v(t,s)}function b(t,e,n,i){t.font="13px Roboto, Roboto Local, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillStyle="#000",t.fillText(e.toString(),i.x+i.width/2,i.y+i.height/2,i.width),(n[c.W.CUSTOM].includes(e)||n[c.W.ORIGINAL].includes(e))&&v(t,i)}function A(t,e,n,c,d,f={x:0,y:0,mpStats:{},monomerPosition:{}}){var h;if(null!==(h=d.isSelectionTable)&&void 0!==h||(d.isSelectionTable=!1),0==Object.keys(f.mpStats).length&&(f.mpStats=e),d.isSelectionTable&&(!d.webLogoBounds||!d.cachedWebLogoTooltip))throw new Error("Peptides: Cannot set WebLogo renderer for selection table without `headerSelectedMonomers`, `webLogoBounds` and `cachedWebLogoTooltip` options.");const m=t.dataFrame;t.setOptions({colHeaderHeight:130});t.onCellRender.subscribe((t=>(t=>{var i,l,u,f;if(!(null===(i=t.cell)||void 0===i?void 0:i.isColHeader))return;const h=t.g,v=t.bounds,y=t.cell.tableColumn;h.save();try{if(h.beginPath(),h.clearRect(v.x,v.y,v.width,v.height),h.rect(v.x,v.y,v.width,v.height),h.clip(),(null==y?void 0:y.semType)===r.uF.MONOMER){let i;if(m.filter.anyFalse){null!==(l=(f=m).jsOnlyTemp)&&void 0!==l||(f.jsOnlyTemp={});const t=null!==(u=m.jsOnlyTemp[r.gp.M_P_STATS_CACHE])&&void 0!==u?u:{},e=null==t?void 0:t[y.name];if(t&&e&&e.filterLength===m.filter.length&&e.filterVersion===m.filter.version)i=e.stats[y.name];else{const e=(0,a.Ej)(c,m.filter,n,{isFiltered:!0,columns:[y.name]});i=e[y.name],t[y.name]={filterVersion:m.filter.version,stats:e,filterLength:m.selection.length}}m.jsOnlyTemp[r.gp.M_P_STATS_CACHE]=t}else i=d.isSelectionTable?(0,a.Ej)(c,m.filter,n,{isFiltered:!0,columns:[y.name]})[y.name]:e[y.name];if(!i)return;const C=Object.keys(i).sort(((t,e)=>""===t||"-"===t?1:""===e||"-"===e?-1:0)).filter((t=>"general"!==t));d.webLogoBounds()[y.name]=function(t,e,n,i,r,a,l,u={},c={}){var d,f,h,m,v,y,C,w,b;const A=window.devicePixelRatio;null!==(d=c.symbolStyle)&&void 0!==d||(c.symbolStyle="16px Roboto, Roboto Local, sans-serif"),null!==(f=c.upperLetterHeight)&&void 0!==f||(c.upperLetterHeight=12.2),null!==(h=c.upperLetterAscent)&&void 0!==h||(c.upperLetterAscent=.25),null!==(m=c.marginVertical)&&void 0!==m||(c.marginVertical=1),null!==(v=c.marginHorizontal)&&void 0!==v||(c.marginHorizontal=1),null!==(y=c.selectionWidth)&&void 0!==y||(c.selectionWidth=2),null!==(C=c.textHeight)&&void 0!==C||(c.textHeight=13),null!==(w=c.headerStyle)&&void 0!==w||(c.headerStyle=`bold ${c.textHeight*A}px Roboto, Roboto Local, sans-serif`);const S=(r.length-1)*c.upperLetterAscent;let E=(e.y+c.marginVertical)*A;const T=(e.height-2*c.marginVertical-S-1.25*c.textHeight)*A,x=(e.x+c.marginHorizontal)*A,N=Math.max(c.selectionWidth*A,.05*e.width*A),_=2*c.marginHorizontal+c.selectionWidth,M=(e.width-(_+c.marginHorizontal))*A,O=(e.x+_)*A,I=g.Z.getMonomerLib(),L={};for(const e of r){const i=T*(n[e].count/a),r=T*((null!==(b=u[e])&&void 0!==b?b:0)/a);if(L[e]=new o.Rect(O/A,E/A,M/A,i/A),t.resetTransform(),"-"!==e&&""!==e){const n=(0,s.zS)(e,5),a=t.measureText(n);r>0&&(t.lineWidth=N,t.line(x,E,x,E+r,o.Color.rowSelection));const l=I.getMonomerTextColor(p.o.AA,e);t.fillStyle=l,t.textAlign="left",t.textBaseline="top",t.font=c.symbolStyle;const u=M/a.width,d=i/c.upperLetterHeight;t.setTransform(u,0,0,d,O,E),t.fillText(n,0,0,a.width)}E+=i+c.upperLetterAscent*A}return t.resetTransform(),t.fillStyle=o.Color.toHtml(o.Color.black),t.textAlign="center",t.textBaseline="top",t.font=c.headerStyle,t.fillText(i,(e.x+e.width/2)*A,(e.y+e.height-c.textHeight)*A),L}(h,v,i,y.name,C,m.filter.trueCount,d.colorPalette(),d.headerSelectedMonomers?d.headerSelectedMonomers()[y.name]:{}),t.preventDefault()}}catch(t){console.warn(`PeptidesHeaderLogoError: couldn't render WebLogo for column \`${y.name}\`. See original error below.`),console.warn(t)}finally{h.restore()}})(t)));const v=n=>{var o;const s=t.hitTest(n.offsetX,n.offsetY);if((null==s?void 0:s.isColHeader)&&(null===(o=s.tableColumn)||void 0===o?void 0:o.semType)===r.uF.MONOMER){const t=function(t,e,n){const i=n[t.tableColumn.name];if(!i)return null;for(const[n,o]of Object.entries(i)){const i=e.offsetX>=o.x&&e.offsetX<=o.x+o.width,r=e.offsetY>=o.y&&e.offsetY<=o.y+o.height;if(i&&r)return{monomerOrCluster:n,positionOrClusterType:t.tableColumn.name}}return null}(s,n,d.webLogoBounds());if(null===t)return void(d.isSelectionTable||null==d.unhighlightCallback||d.unhighlightCallback());f.monomerPosition=t,function(t,e,n,o,r,s){if("click"!==t.type||r.isSelectionTable||null==r.selectionCallback){const a=`${e.positionOrClusterType} = ${e.monomerOrCluster}`;r.cachedWebLogoTooltip().bar===a?i.tooltip.show(r.cachedWebLogoTooltip().tooltip,t.clientX,t.clientY):(r.cachedWebLogoTooltip().bar=a,s.x=t.clientX,s.y=t.clientY,s.monomerPosition=e,r.cachedWebLogoTooltip().tooltip=(0,u.Y)(n,o,[],s))}else r.selectionCallback(e,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey})}(n,t,m,c,d,f),d.isSelectionTable||null==d.highlightCallback||d.highlightCallback(t,m,e)}else null!=d.unhighlightCallback&&d.unhighlightCallback()};l.fromEvent(t.overlay,"mousemove").subscribe((t=>v(t))),l.fromEvent(t.overlay,"click").subscribe((t=>v(t))),l.fromEvent(t.overlay,"mouseleave").subscribe((()=>{null!=d.unhighlightCallback&&d.unhighlightCallback()}))}class S extends o.GridCellRenderer{constructor(){super(...arguments),this.colorCacheKey="lst-pie-chart-color-cache",this.HoverTempKey="lst-pie-chart-hovered-sector",this.hoverSeparator=",,,,,"}get name(){return"LST Pie Chart"}get cellType(){return"lst-pie-chart"}get defaultWidth(){return 80}get defaultHeight(){return 80}categoryNumberCache(t){return t.temp[this.colorCacheKey]||(t.temp[this.colorCacheKey]={}),t.temp[this.colorCacheKey]}getPrevHoveredSector(t){return t.temp[this.HoverTempKey]}onMouseMove(t,e){const n=this.getPrevHoveredSector(t.cell.column),o=()=>{t.cell.column.temp[this.HoverTempKey]=null,i.tooltip.hide(),null!==n&&t.grid.invalidate()},r=t.cell.value;if(!r)return void o();const s=e.offsetX-t.bounds.midX,a=e.offsetY-t.bounds.midY,l=Math.sqrt(s*s+a*a),u=Math.atan2(a,s),c=u<0?u+2*Math.PI:u;if(l>Math.min(t.bounds.width,t.bounds.height)/2-2)return void o();let d;try{d=JSON.parse(r)}catch(e){return void o()}const f=new Float64Array(Object.keys(d).length+1),h=Object.values(d).reduce(((t,e)=>t+e),0);f[Object.keys(d).length]=2*Math.PI;let m=0,g=0;for(const t of Object.values(d))f[g++]=m,m+=2*Math.PI*t/h;let p=-1;for(let t=0;t<f.length-1;t++)if(c>=f[t]&&c<f[t+1]){p=t;break}if(-1===p)return void o();const v=Object.keys(d)[p],y=d[v],C=(y/h*100).toFixed(2);i.tooltip.show(i.h1(`${v}: ${y} (${C}%)`),e.x+16,e.y+16);const w=t.cell.rowIndex.toString()+this.hoverSeparator+v;t.cell.column.temp[this.HoverTempKey]=w,n!==w&&t.grid.invalidate()}render(t,e,n,i,r,s,a){const l=s.cell.dataFrame,u=new o.Rect(e,n,i,r).fitSquare().inflate(-2,-2);if(i<5||r<5||!l)return;const c=s.cell.value;if(t.clearRect(e,n,i,r),!c)return;let d;try{d=JSON.parse(c)}catch(t){return}const f=Object.values(d).reduce(((t,e)=>t+e),0);let h=0;const m=Object.fromEntries(Object.keys(d).map((t=>[t,255]))),g=s.cell.column.temp[this.HoverTempKey];if(g&&2===g.split(this.hoverSeparator).length){const[t,e]=g.split(this.hoverSeparator);if(t===s.cell.rowIndex.toString()){for(const[t,e]of Object.entries(d))m[t]=100;m[e]=255}}const p=Math.min(i,r)/2.2;for(const[e,n]of Object.entries(d)){const i=2*Math.PI*n/f;t.beginPath(),t.moveTo(u.midX,u.midY),t.arc(u.midX,u.midY,p,h,h+i),h+=i;const r=this.categoryNumberCache(s.cell.column);r[e]||(r[e]=Object.keys(r).length,s.cell.column.temp[this.colorCacheKey]=r),t.fillStyle=o.Color.toHtml(o.Color.setAlpha(o.Color.getCategoricalColor(r[e]),m[e])),t.fill(),t.strokeStyle=o.Color.toRgb(o.Color.lightGray),t.stroke();const a=e;t.fillStyle=o.Color.toRgb(o.Color.white),t.font="9px Arial";const l=t.measureText(a).width,c=h-i/2;for(let e=.8;e>=.4;e-=.05){const n=p*e,o=u.midX+Math.cos(c)*n,r=u.midY+Math.sin(c)*n;if([[o-l/2-2,r],[o+l/2+2,r]].every((t=>{const e=Math.sqrt(Math.pow(t[0]-u.midX,2)+Math.pow(t[1]-u.midY,2)),n=Math.atan2(t[1]-u.midY,t[0]-u.midX),o=n<0?n+2*Math.PI:n;return e<p-2&&o>h-i&&o<h}))){t.fillText(a,o,r);break}}}}}},4139:(t,e,n)=>{"use strict";n.d(e,{$2:()=>i,To:()=>l,V5:()=>f,YX:()=>d,gp:()=>r,i6:()=>o,rg:()=>u,uF:()=>s,wf:()=>c,zW:()=>h});var i,o,r,s,a=n(6082);!function(t){t.SPLIT_COL="~split",t.ACTIVITY="Activity",t.ACTIVITY_SCALED="Scaled activity",t.MONOMER="AAR",t.POSITION="Pos",t.P_VALUE="pValue",t.MEAN_DIFFERENCE="Mean difference",t.COUNT="Count",t.RATIO="Ratio",t.MEAN="Mean"}(i||(i={})),function(t){t.MEMBERS="Members",t.WEB_LOGO="WebLogo",t.DISTRIBUTION="Distribution",t.MEAN_DIFFERENCE="Mean difference",t.P_VALUE="P-Value",t.RATIO="Ratio",t.CLUSTER="Cluster"}(o||(o={})),function(t){t.MONOMER="monomer",t.POSITION="pos",t.SEPARATOR="separator",t.SELECTION="selection",t.MUTATION_CLIFFS_SELECTION="mutationCliffsSelection",t.ALPHABET="alphabet",t.FILTER="filter",t.INVARIANT_MAP_SELECTION="invariantMapSelection",t.SAR_MODE="sarMode",t.CLUSTER_SELECTION="clusterSelection",t.VISIBLE="visible",t.SETTINGS="settings",t.CUSTOM_CLUSTER="customCluster",t.MONOMER_POSITION_MODE="monomerPositionMode",t.MULTIPLE_VIEWS="isMultipleViews",t.IDENTITY_TEMPLATE="Identity template",t.SIMILARITY_TEMPLATE="Similarity template",t.ANALYSIS_COL="isAnalysisCol",t.POSITION_COL="isPositionCol",t.M_P_STATS_CACHE=".MPStatsCache",t.INVARIANT_MAP_COLOR_CACHE=".InvariantMapColorCache",t.INVARIANT_MAP_COLOR_MAX_CACHE=".InvariantMapColorMaxCache",t.INVARIANT_MAP_COLOR_MIN_CACHE=".InvariantMapColorMinCache"}(r||(r={})),function(t){t.MONOMER="Monomer",t.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference"}(s||(s={}));const l="ColumnName";var u,c,d;!function(t){t.NONE="none",t.LG="lg",t.MINUS_LG="-lg"}(u||(u={})),function(t){t.HIGH="High",t.LOW="Low"}(c||(c={})),function(t){t.LST="lst-",t.MP="mp-",t.MPR="mpr-",t.WL="wl-"}(d||(d={}));const f=Object.values(a.AGG).filter((t=>![a.AGG.FIRST,a.AGG.KEY,a.AGG.PIVOT,a.AGG.SELECTED_ROWS_COUNT].includes(t))),h={[a.AGG.TOTAL_COUNT]:"totalCount",[a.AGG.VALUE_COUNT]:"valueCount",[a.AGG.UNIQUE_COUNT]:"uniqueCount",[a.AGG.MISSING_VALUE_COUNT]:"missingValueCount",[a.AGG.MIN]:"min",[a.AGG.MAX]:"max",[a.AGG.SUM]:"sum",[a.AGG.MED]:"med",[a.AGG.AVG]:"avg",[a.AGG.STDEV]:"stdev",[a.AGG.VARIANCE]:"variance",[a.AGG.SKEW]:"skew",[a.AGG.KURT]:"kurt",[a.AGG.Q1]:"q1",[a.AGG.Q2]:"q2",[a.AGG.Q3]:"q3"}},8608:(t,e,n)=>{"use strict";n.d(e,{$s:()=>x,AN:()=>i,AY:()=>f,B2:()=>M,BE:()=>C,CD:()=>b,F2:()=>p,FZ:()=>v,KT:()=>T,Lv:()=>I,Y1:()=>h,ZR:()=>E,dl:()=>S,eY:()=>g,qI:()=>N,qx:()=>m,sg:()=>O,vW:()=>A,vY:()=>w,zm:()=>_,zz:()=>y});var i,o=n(7389),r=n(6082),s=n(4328),a=n(4139),l=n(8774),u=n(144),c=n.n(u),d=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function f(t){var e;return null!==(e=t.getTag(a.gp.SEPARATOR))&&void 0!==e?e:""}function h(t,e=a.rg.NONE){let n=t=>t;switch(e){case a.rg.NONE:break;case a.rg.LG:n=t=>Math.log10(t);break;case a.rg.MINUS_LG:n=t=>-Math.log10(t);break;default:throw new Error(`ScalingError: method \`${e}\` is not available.`)}const i=t.getRawData(),o=r.Column.float(a.$2.ACTIVITY,t.length).init((t=>{const e=i[t];return e===r.FLOAT_NULL||e===r.INT_NULL?e:n(e)}));return o.setTag(a.gp.ANALYSIS_COL,"true"),o.setTag(r.TAGS.FORMULA,e),o}function m(t){var e,n,i,o;const r=t.columns.bySemTypeAll(a.uF.MONOMER),s={},l=t.filter.clone().and(t.selection).getSelectedIndexes();for(const t of l)for(const a of r){const r=a.get(t);r&&(null!==(e=s[i=a.name])&&void 0!==e||(s[i]={}),null!==(n=(o=s[a.name])[r])&&void 0!==n||(o[r]=0),s[a.name][r]+=1)}return s}function g(t){return{name:t.name,cat:t.categories,rawData:t.getRawData()}}function p(t,e,n={}){var s;const l=t.dataFrame.getCol(a.$2.SPLIT_COL),u=[],c=l.categories,d=l.getRawData();for(let t=0;t<c.length;++t){if(!Object.values(i).includes(c[t]))continue;const e=r.Color.toHtml(l.meta.colors.getColor(d.indexOf(t))),a=o.label(null!==(s=n[c[t]])&&void 0!==s?s:c[t],{style:{color:e}});u.push(a)}const f=o.divV([o.divV(u),t.root,o.tableFromMap(e)]);return t.root.style.maxHeight="75px",f}function v(t,e,n){var o,s;const l=null!==(o=null==n?void 0:n.clone().xor(e).anyTrue)&&void 0!==o&&o,u=t.length,c=t.getRawData(),d=new Float32Array(u+e.trueCount+(l&&null!==(s=null==n?void 0:n.trueCount)&&void 0!==s?s:0)),f=new Array(d.length);for(let t=0,o=0,r=0;t<u;++t){const s=e.get(t);d[t]=c[t],f[t]=s?i.SELECTION:i.ALL,s&&(d[u+o]=c[t],f[u+o]=i.ALL,++o),l&&(null==n?void 0:n.get(t))&&(d[u+e.trueCount+r]=c[t],f[u+e.trueCount+r]=i.PEPTIDES_SELECTION,++r)}const h=r.Column.fromStrings(a.$2.SPLIT_COL,f),m=[i.ALL,i.SELECTION];return l&&m.push(i.PEPTIDES_SELECTION),h.setCategoryOrder(m),h.meta.colors.setCategorical(),r.DataFrame.fromColumns([r.Column.fromFloat32Array(a.$2.ACTIVITY,d),h])}function y(t){const e=o.iconFA("expand-alt",(()=>{const e=t.dataFrame.plot.grid();w(e,!1),e.root.style.height="100%";const n=o.dialog(t.dataFrame.name);n.add(e.root),n.showModal(!0),e.invalidate()}));t.root.appendChild(e),e.style.position="absolute",e.style.right="0px",e.style.top="0px",e.style.visibility="hidden",t.root.addEventListener("mouseenter",(t=>{e.style.visibility="visible"})),t.root.addEventListener("mouseleave",(t=>{e.style.visibility="hidden"}))}function C(t,e,n,i){const r=o.iconFA("expand-alt",(()=>{const e=i(),n=o.dialog(t);n.add(e),n.show({resizable:!0,modal:!0,width:window.innerWidth-60,x:30,y:30,height:window.innerHeight-60})}),"Expand to full screen");r.style.marginLeft="auto",r.style.marginRight="15px",n.addEventListener("mouseenter",(()=>{r.style.visibility="visible"})),n.addEventListener("mouseleave",(()=>{r.style.visibility="hidden"})),e.appendChild(r)}function w(t,e=!0){t.props.allowEdit=!1,t.props.showReadOnlyNotifications=!1,t.props.allowRowSelection=!1,t.props.allowBlockSelection=!1,t.props.allowColSelection=!1,t.props.showRowHeader=!1,t.props.showCurrentRowIndicator=!1,t.root.style.width="100%",t.root.style.maxWidth="100%",e&&t.autoSize(1e3,175,0,0,!0)}function b(t){for(const e of Object.values(t))if(0!==e.length)return!1;return!0}function A(t,e,n){const i=t[e.positionOrClusterType],o=i.indexOf(e.monomerOrCluster);if(n.shiftPressed&&n.ctrlPressed)-1!==o&&i.splice(o,1);else if(n.ctrlPressed)-1===o?i.push(e.monomerOrCluster):i.splice(o,1);else if(n.shiftPressed)-1===o&&i.push(e.monomerOrCluster);else{const n=Object.keys(t);t={};for(const i of n)t[i]=[],i===e.positionOrClusterType&&t[i].push(e.monomerOrCluster)}return t}function S(t,e,n){if(!e)return;const i=new l.A(e.rowCount);if(t.positionOrClusterType===a.$2.MONOMER){const e=Object.values(n);for(const n of e){const e=n[t.monomerOrCluster];void 0!==e&&i.or(e.mask)}}else{const e=n[t.positionOrClusterType];if(void 0!==e){const n=e[t.monomerOrCluster];void 0!==n&&i.or(n.mask)}}e.rows.highlight((t=>i.getBit(t)))}function E(t){const e={};for(const n of t)e[n.name]=[];return e}function T(t,e){let n=null;const i=Object.entries(t);for(const[t,o]of i){const i=e[t];for(const t of o){const e=i[t];e&&(null!=n||(n=new l.A(e.mask.length,!1)),n.or(e.mask))}}return null!=n?r.BitSet.fromBytes(n.buffer.buffer,n.length):null}function x(t,e){return t.sequenceColumnName===e.sequenceColumnName&&t.activityColumnName===e.activityColumnName&&t.activityScaling===e.activityScaling}function N(t,e){var n;const i={};for(const[o,r]of t)for(const[t,s]of r){null!==(n=i[t])&&void 0!==n||(i[t]={});const r=new l.A(e,!1);for(const[t,e]of s){r.setTrue(t);for(const t of e)r.setTrue(t)}i[t][o]={mask:r}}return i}function _(t,e,n,i){const o=Object.entries(n),r=i?Object.entries(i).filter((t=>!e.includes(t[0])||n[t[0]]!==t[1])):[];return o.concat(r).filter((e=>t.columns.contains(e[0])&&t.col(e[0]).matches("numerical")))}function M(t,e=2){return t.columns.bySemTypeAll(r.SEMTYPE.MACROMOLECULE).length>0&&c()(t.columns.numerical).toArray().length>0&&t.rowCount>=e}function O(t,e=500){let n;return(...i)=>d(this,void 0,void 0,(function*(){return new Promise((o=>{clearTimeout(n),n=setTimeout((()=>o(t(...i))),e)}))}))}function I(){return"isInDemo"in s.shell&&!!s.shell.isInDemo}!function(t){t.SELECTION="Selection",t.ALL="All",t.PEPTIDES_SELECTION="Peptides selection"}(i||(i={}))},5070:(t,e,n)=>{"use strict";n.d(e,{hX:()=>s,I_:()=>u,m2:()=>c,lh:()=>l,GT:()=>a,J1:()=>d});var i=n(6082),o=n(6572),r=n(4139);const s=(t,e)=>`${t}(${e})`;function a(t,e,n){var r;if(t.length!==e.length&&t.some(((t,n)=>n>=e.length&&0!==t)))throw new Error("PeptidesError: Data and bit array have different lengths");const s=new Float32Array(e.trueCount()),a=new Float32Array(e.falseCount());let l;if(n)try{l=null===(r=i.DataFrame.fromColumns([n.col]).clone(i.BitSet.fromBytes(e.buffer.buffer,e.length)).col(n.col.name))||void 0===r?void 0:r.aggregate(n.type)}catch(t){console.error(t)}let u=0,c=0;for(let n=0;n<e.length;++n)e.getBit(n)?s[u++]=t[n]:a[c++]=t[n];const d=s.reduce(((t,e)=>t+e),0)/Math.max(s.length,1);if(s.length<2||a.length<2){const t=a.reduce(((t,e)=>t+e),0)/Math.max(a.length,1);return{count:s.length,pValue:null,mean:d,meanDifference:d-t,ratio:s.length/e.length,mask:e,aggValue:l}}const f=function(t,e,n=!1,i=!1){if(t.length<=1||e.length<=1)throw new Error(`StatisticsError: Wrong sample size; expected at least 2, got ${Math.min(t.length,e.length)})`);const r=o.mean(t),s=o.mean(e),a=o.variance(t),l=o.variance(e),u=t.length,c=e.length;let d,f,h;if(n){const t=a/u,e=l/c,n=(r-s)/Math.sqrt(t+e);f=o.normal.pdf(n,0,1),d=1-f,h=2*(f<d?f:d)}else if(i){const t=u+c-2,e=(a*(u-1)+l*(c-1))/t,n=Math.sqrt(u*c/(u+c))*(r-s)/e;d=1-o.studentt.cdf(n,t),f=o.studentt.cdf(n,t),h=2*(f<d?f:d)}else{const t=a/u,e=l/c,n=(r-s)/Math.sqrt(t+e),i=Math.pow(t+e,2)/(Math.pow(t,2)/(u-1)+Math.pow(e,2)/(c-1));f=o.studentt.cdf(n,i),d=1-f,h=2*(f<d?f:d)}return{"p-value":h,"Mean difference":r-s,"p-value more":d,"p-value less":f}}(s,a),h=f["Mean difference"];return{count:s.length,pValue:f[h>=0?"p-value more":"p-value less"],mean:d,meanDifference:h,ratio:s.length/e.length,mask:e,aggValue:l}}function l(t,e,n){const o=r.zW[e],s=i.Stats.fromColumn(t,n);if(!(o in s))throw new Error(`Aggregation type ${o} is not supported`);return s[o]}function u(t,e,n={}){var i,o;null!==(i=n.filterDf)&&void 0!==i||(n.filterDf=!1),null!==(o=n.fractionDigits)&&void 0!==o||(n.fractionDigits=3);const r=n.filterDf&&t.filter.anyFalse?t.clone(t.filter):t,a={};for(const[t,i]of e){const e=s(i,t),o=l(r.getCol(t),i,n.mask);a[e]=o.toFixed(n.fractionDigits)}return a}function c(t,e,n,i){var o;null!==(o=i.fractionDigits)&&void 0!==o||(i.fractionDigits=3);const r={};for(const[o,a]of n){const n=s(a,o),l=t.get(n,e);r[n]=l.toFixed(i.fractionDigits)}return r}function d(t,e,n){var o;const r=t.col(e.substring(5,e.length-1));if(!r||!r.matches("categorical"))return"{}";null!=n||(n=i.BitSet.create(t.rowCount,(()=>!0)));const s=r.getRawData(),a=new Map;for(let t=-1;-1!==(t=n.findNext(t,!0));)a.set(s[t],(null!==(o=a.get(s[t]))&&void 0!==o?o:0)+1);const l={};for(const[t,e]of a)l[r.categories[t]]=e;return JSON.stringify(l)}},912:(t,e,n)=>{"use strict";n.d(e,{D:()=>u,Y:()=>c});var i=n(7389),o=n(6082),r=n(4139),s=n(7654),a=n(8608),l=n(5070);function u(t,e,n,i){var o,s,a;return null!==(o=i.fromViewer)&&void 0!==o||(i.fromViewer=!1),null!==(s=i.isMutationCliffs)&&void 0!==s||(i.isMutationCliffs=!1),null!==(a=i.isMostPotentResidues)&&void 0!==a||(i.isMostPotentResidues=!1),i.monomerPosition.positionOrClusterType!==r.$2.MONOMER&&c(t,e,n,i),!0}function c(t,e,n,r){var u,c,d,f,h,m,g,p,v;if(null!==(u=r.fromViewer)&&void 0!==u||(r.fromViewer=!1),null!==(c=r.isMutationCliffs)&&void 0!==c||(r.isMutationCliffs=!1),null!==(d=r.isMostPotentResidues)&&void 0!==d||(r.isMostPotentResidues=!1),null!==(f=r.additionalStats)&&void 0!==f||(r.additionalStats={}),r.cliffStats&&r.isMutationCliffs){const u=null===(p=null===(g=r.cliffStats)||void 0===g?void 0:g.get(r.monomerPosition.monomerOrCluster))||void 0===p?void 0:p.get(r.monomerPosition.positionOrClusterType);if(!u)return null;const c=o.BitSet.fromBytes(u.mask.buffer.buffer,e.length),d=(0,s.M1)((0,a.FZ)(e,c),!0),f=(0,s.QD)(u,{countName:"Unique count"});r.fromViewer&&(f["Mean difference"]=`${f["Mean difference"]} (Color)`,f["Unique count"]&&(f["Unique count"]=`${f["Unique count"]} (Size)`));const h=null!==(v=r.aggrColValues)&&void 0!==v?v:(0,l.I_)(t,n,{mask:c}),m=Object.assign(Object.assign(Object.assign({},r.additionalStats),f),h),y=(0,a.F2)(d,m);return i.tooltip.show(y,r.x,r.y),y}{const u=r.mpStats[r.monomerPosition.positionOrClusterType][r.monomerPosition.monomerOrCluster];if(!(null==u?void 0:u.count))return null;const c=o.BitSet.fromBytes(u.mask.buffer.buffer,e.length),d=(0,s.M1)((0,a.FZ)(e,c),!0),f=(0,s.QD)(u);r.fromViewer&&(f["Mean difference"]=`${f["Mean difference"]}${r.isMostPotentResidues?" (size)":""}`,f["p-value"]&&(f["p-value"]=`${f["p-value"]}${r.isMostPotentResidues?" (color)":""}`));const g=null!==(h=r.aggrColValues)&&void 0!==h?h:(0,l.I_)(t,n,{mask:c}),p=Object.assign(Object.assign(Object.assign({},r.additionalStats),f),g);for(const[t,e]of Object.entries(null!==(m=r.postfixes)&&void 0!==m?m:{}))p[t]&&(p[t]=`${p[t]}${e}`);const v=(0,a.F2)(d,p);return i.tooltip.show(v,r.x,r.y),v}}},115:(t,e,n)=>{"use strict";n.d(e,{GI:()=>a,Ku:()=>r,av:()=>s});var i=n(1199),o=n(4329);const r="WebGPU is not supported on this device";class s{constructor(){this.maxIterations=16,this.inflation=1.4,this.threshold=70,this.distanceF=i.Z.NEEDLEMANN_WUNSCH,this.gapOpen=1.5,this.gapExtend=.2,this.fingerprintType="Morgan",this.useWebGPU=!1,this.minClusterSize=5,this.webGPUDescription=r,this.webGPUDescriptionPromise=(0,o._)().then((t=>{t&&(this.webGPUDescription=t)}))}}class a{constructor(t){this.distanceF=i.Z.NEEDLEMANN_WUNSCH,this.gapOpen=1.5,this.gapExtend=.2,this.clusterEmbeddings=!0,this.epsilon=.01,this.minPts=4,this.fingerprintType="Morgan",this.clusterEmbeddings=!!t}}},5480:(t,e,n)=>{"use strict";n.d(e,{W:()=>S,s:()=>T});var i=n(7389),o=n(4328),r=n(6082),s=n(7233),a=n.n(s),l=n(768),u=n(4139),c=n(3163),d=n(4326),f=n(5070),h=n(144),m=n.n(h),g=n(7654),p=n(8608),v=n(8774),y=n(9995),C=n(3657),w=n(3077),b=n(726);const A=(t,e)=>`${t}(${e})`;var S,E;!function(t){t.ORIGINAL="original",t.CUSTOM="custom"}(S||(S={})),function(t){t.GENERAL="General",t.STYLE="WebLogo",t.AGGREGATION="Aggregation"}(E||(E={}));class T extends r.JsViewer{constructor(){super(),this._titleHost=i.divText(l.q.LOGO_SUMMARY_TABLE,{id:"pep-viewer-title"}),this.bitsets=[],this.keyPress=!1,this.currentRowIndex=null,this._scaledActivityColumn=null,this._webLogoCacheGeneration=0,this._viewerGrid=null,this._clusterStats=null,this._clusterSelection=null,this._logoSummaryTable=null,this._positionColumns=null,this.sequenceColumnName=this.column("sequence",{category:E.GENERAL,nullable:!1}),this.clustersColumnName=this.column("clusters",{category:E.GENERAL,nullable:!1,columnTypeFilter:r.TYPE.CATEGORICAL}),this.activityColumnName=this.column("activity",{category:E.GENERAL,nullable:!1,columnTypeFilter:r.TYPE.NUMERICAL}),this.activityScaling=this.string("activityScaling",u.rg.NONE,{category:E.GENERAL,choices:Object.values(u.rg)}),this.webLogoMode=this.string("webLogoMode",d.fH.Entropy,{choices:[d.fH.full,d.fH.Entropy],category:E.STYLE}),this.membersRatioThreshold=this.float("membersRatioThreshold",.1,{min:0,max:1,category:E.STYLE});const t=[r.AGG.KEY,r.AGG.PIVOT,r.AGG.MISSING_VALUE_COUNT,r.AGG.SKEW,r.AGG.KURT,r.AGG.SELECTED_ROWS_COUNT],e=Object.values(r.AGG).filter((e=>!t.includes(e)));this.webLogoAggregationType=this.string("webLogoAggregationType",r.AGG.TOTAL_COUNT,{category:E.STYLE,choices:e,description:"Aggregation method for WebLogo position heights"}),this.webLogoAggregationColumnName=this.column("webLogoAggregationColumnName",{defaultValue:null,category:E.STYLE,nullable:!0,columnTypeFilter:r.TYPE.NUMERICAL,description:`Column with values to aggregate for WebLogo position heights.\n Used if aggregation type is not '${r.AGG.TOTAL_COUNT}'.`}),this.columns=this.columnList("columns",[],{category:E.AGGREGATION}),this.aggregation=this.string("aggregation",r.AGG.AVG,{category:E.AGGREGATION,choices:u.V5})}get model(){return l.i.getInstance(this.dataFrame)}get viewerGrid(){var t;return null!==(t=this._viewerGrid)&&void 0!==t||(this._viewerGrid=this.createLogoSummaryTableGrid()),this._viewerGrid}get clusterStats(){var t;return null!==(t=this._clusterStats)&&void 0!==t||(this._clusterStats=(0,C.eW)(this.dataFrame,this.clustersColumnName,this.customClusters.toArray(),this.getScaledActivityColumn())),this._clusterStats}get clusterSelection(){var t;const e=this.dataFrame.getTag(u.gp.CLUSTER_SELECTION);return null!==(t=this._clusterSelection)&&void 0!==t||(this._clusterSelection=null===e?this.initClusterSelection({notify:!1}):JSON.parse(e)),this._clusterSelection}set clusterSelection(t){this._clusterSelection=t,this.dataFrame.setTag(u.gp.CLUSTER_SELECTION,JSON.stringify(t)),this.model.fireBitsetChanged(l.q.LOGO_SUMMARY_TABLE),this.model.analysisView.grid.invalidate()}get logoSummaryTable(){var t;return null!==(t=this._logoSummaryTable)&&void 0!==t||(this._logoSummaryTable=this.createLogoSummaryTable()),this._logoSummaryTable}set logoSummaryTable(t){this._logoSummaryTable=t}get positionColumns(){var t,e,n,i;if(null!=this._positionColumns)return this._positionColumns;const o=t=>{const e=this.model.findViewer(t);return this.sequenceColumnName===(null==e?void 0:e.sequenceColumnName)?e._positionColumns:null};return null!=this.model.positionColumns&&this.sequenceColumnName===(null===(t=this.model.settings)||void 0===t?void 0:t.sequenceColumnName)&&(this._positionColumns=this.model.positionColumns),null!==(e=this._positionColumns)&&void 0!==e||(this._positionColumns=null!==(i=null!==(n=o(l.q.SEQUENCE_VARIABILITY_MAP))&&void 0!==n?n:o(l.q.MOST_POTENT_RESIDUES))&&void 0!==i?i:(0,w.R)(this.dataFrame.getCol(this.sequenceColumnName),b.Z.getSeqHelper()).columns.toList()),this._positionColumns}get isClusterSelectionEmpty(){return 0===this.clusterSelection[S.ORIGINAL].length+this.clusterSelection[S.CUSTOM].length}get customClusters(){const t={};return t[u.gp.CUSTOM_CLUSTER]="1",m()(this.dataFrame.columns.byTags(t))}getScaledActivityColumn(t=!1){var e,n,i;return(null===(e=this.model.settings)||void 0===e?void 0:e.activityColumnName)===this.activityColumnName&&(null===(n=this.model.settings)||void 0===n?void 0:n.activityScaling)===this.activityScaling&&(this._scaledActivityColumn=this.model.getScaledActivityColumn(t)),null!==(i=this._scaledActivityColumn)&&void 0!==i||(this._scaledActivityColumn=(0,p.Y1)(this.dataFrame.getCol(this.activityColumnName),this.activityScaling)),t?r.DataFrame.fromColumns([this._scaledActivityColumn]).clone(this.dataFrame.rowCount===this._scaledActivityColumn.length?this.dataFrame.filter:null).getCol(this._scaledActivityColumn.name):this._scaledActivityColumn}getAggregationColumns(){return Object.fromEntries(this.columns.map((t=>[t,this.aggregation])).filter((([t,e])=>this.model.df.columns.contains(t)&&this.model.df.col(t).matches("numerical"))))}onTableAttached(){var t,e,n,i;if(super.onTableAttached(),(0,p.B2)(this.dataFrame)){const o=m()(this.dataFrame.columns.numerical).next().value.name;null===(t=this.getProperty(`sequence${u.To}`))||void 0===t||t.set(this,this.dataFrame.columns.bySemType(r.SEMTYPE.MACROMOLECULE).name),null===(e=this.getProperty(`activity${u.To}`))||void 0===e||e.set(this,o),null===(n=this.getProperty("webLogoAggregationColumnName"))||void 0===n||n.set(this,o),null===(i=this.getProperty(`clusters${u.To}`))||void 0===i||i.set(this,m()(this.dataFrame.columns.categorical).next().value.name)}else{const t="PeptidesError: dataframe is missing Macromolecule or numeric columns";o.log.error(t),o.shell.warning(t)}this.render()}detach(){this.subs.forEach((t=>t.unsubscribe()))}render(){if(a()(this.root).empty(),null==this.clustersColumnName||null==this.sequenceColumnName||null==this.activityColumnName)return void this.root.appendChild(i.divText("Please, select a sequence, cluster and activity columns in the viewer properties"));if(!this.logoSummaryTable.filter.anyTrue){const t=i.divText("No clusters to satisfy the threshold. Please, lower the threshold in viewer proeperties to include clusters");return void this.root.appendChild(i.divV([this._titleHost,t]))}const t=i.iconFA("expand-alt",(()=>{const t=i.dialog("Logo Summary Table");t.add(this.viewerGrid.root),t.onCancel((()=>this.render())),t.showModal(!0),this.viewerGrid.invalidate()}),"Show Logo Summary Table in full screen");a()(t).addClass("pep-help-icon"),this.viewerGrid.root.style.width="auto",this.viewerGrid.root.style.height="auto",this.viewerGrid.root.style.overflow="hidden",this.root.appendChild(i.divV([i.divH([this._titleHost,t],{style:{alignSelf:"center",lineHeight:"normal"}}),this.viewerGrid.root])),this.viewerGrid.invalidate()}onPropertyChanged(t){super.onPropertyChanged(t);let e=!1;switch(t.name){case"membersRatioThreshold":this.logoSummaryTable.filter.anyTrue||(e=!0),this.updateFilter();break;case`sequence${u.To}`:this._viewerGrid=null,this._logoSummaryTable=null,e=!0;break;case`clusters${u.To}`:this._clusterStats=null,this._clusterSelection=null,this._viewerGrid=null,this._logoSummaryTable=null,e=!0;break;case`activity${u.To}`:this.webLogoAggregationColumnName=this.activityColumnName;case"activityScaling":case`webLogoAggregationColumnName${u.To}`:case"webLogoAggregationType":this._webLogoCacheGeneration++,this._scaledActivityColumn=null,this._viewerGrid=null,this._clusterStats=null,this._logoSummaryTable=null,e=!0;break;case"columns":case"aggregation":this._viewerGrid=null,this._logoSummaryTable=null,e=!0;break;case"webLogoMode":this.viewerGrid.invalidate()}e&&this.render()}initClusterSelection(t={}){var e;null!==(e=t.notify)&&void 0!==e||(t.notify=!0);const n={};return n[S.ORIGINAL]=[],n[S.CUSTOM]=[],t.notify?this.clusterSelection=n:this._clusterSelection=n,this.clusterSelection}getTotalViewerAggColumns(){var t,e;const n=this.getAggregationColumns();return(0,p.zm)(this.model.df,this.columns,n,null===(e=null===(t=this.model)||void 0===t?void 0:t.settings)||void 0===e?void 0:e.columns)}getStringAggregatedColumns(){return this.columns.filter((t=>this.model.df.columns.contains(t)&&this.model.df.col(t).matches("categorical"))).map((t=>`dist(${t})`))}getNeededDfClone(){var t,e;const n=[this.clustersColumnName,this.sequenceColumnName,this.activityColumnName,...(null!==(t=this.getTotalViewerAggColumns())&&void 0!==t?t:[]).map((([t,e])=>t)),...(null!==(e=this.getStringAggregatedColumns())&&void 0!==e?e:[]).map((t=>t.substring(5,t.length-1)))];this.webLogoAggregationColumnName&&n.push(this.webLogoAggregationColumnName);const i=Array.from(new Set(n)).filter((t=>this.dataFrame.columns.contains(t)));return this.dataFrame.clone(this.dataFrame.filter,i)}createLogoSummaryTable(){var t,e,n;const i=this.clustersColumnName,o=this.dataFrame.filter.anyFalse,s=o?this.getNeededDfClone():this.dataFrame,a=s.columns,l=s.rowCount,c=this.getScaledActivityColumn(o).getRawData(),d=s.getCol(i),h=d.getRawData(),g=d.categories,p={};p[u.gp.CUSTOM_CLUSTER]="1";const y=m()(a.byTags(p)).filter((t=>t.max>0)).toArray(),C=r.DataFrame.create(y.length),w=C.columns,b=w.addNewString(u.i6.CLUSTER),E=w.addNewInt(u.i6.MEMBERS).getRawData(),T=w.addNewString(u.i6.WEB_LOGO),x=w.addNewString(u.i6.DISTRIBUTION),N=w.addNewFloat(u.i6.MEAN_DIFFERENCE).getRawData(),_=w.addNewFloat(u.i6.P_VALUE).getRawData(),M=w.addNewFloat(u.i6.RATIO).getRawData();let O=s.groupBy([i]);const I=this.getTotalViewerAggColumns(),L=this.getStringAggregatedColumns(),P=L.map((t=>w.addNewString(t))),R=I.map((([t,e])=>A(e,t))),k=new Array(R.length+L.length),V=I.map((([t,e])=>[s.getCol(t),e]));for(let t=0;t<I.length;++t){const[e,n]=I[t];O=O.add(n,e,R[t]);const i=w.addNewFloat(R[t]);k[t]=i.getRawData()}const D=new Array(y.length);for(let e=0;e<y.length;++e){const n=y[e];b.set(e,n.name);const i=v.A.fromUint32Array(l,n.getRawData());if(i.allFalse)continue;const a=r.BitSet.fromBytes(i.buffer.buffer,l),u=o?(0,f.GT)(c,i):this.clusterStats[S.CUSTOM][n.name];E[e]=u.count,D[e]=a,N[e]=u.meanDifference,_[e]=null!==(t=u.pValue)&&void 0!==t?t:r.FLOAT_NULL,M[e]=u.ratio;for(let t=0;t<R.length;++t){const[n,i]=V[t];k[t][e]=(0,f.lh)(n,i,a)}for(let t=R.length;t<k.length;++t){const n=L[t-R.length];P[t-R.length].set(e,(0,f.J1)(s,n,a))}}T.setTag(r.TAGS.CELL_RENDERER,"html"),x.setTag(r.TAGS.CELL_RENDERER,"html");const F=O.aggregate(),G=F.rowCount,U=F.columns;let H=F.getCol(i);H.name=u.i6.CLUSTER,H.type!==r.COLUMN_TYPE.STRING&&(F.columns.replace(H,H.convertTo(r.COLUMN_TYPE.STRING)),H=F.getCol(H.name));const q=H.categories,B=U.addNewInt(u.i6.MEMBERS).getRawData(),Y=U.addNewString(u.i6.WEB_LOGO),$=U.addNewString(u.i6.DISTRIBUTION),W=U.addNewFloat(u.i6.MEAN_DIFFERENCE).getRawData(),j=U.addNewFloat(u.i6.P_VALUE).getRawData(),z=U.addNewFloat(u.i6.RATIO).getRawData(),K=L.map((t=>U.addNewString(t))),Q=new Array(G),Z=Array.from({length:G},(()=>new v.A(l,!1)));for(let t=0;t<l;++t){const n=g[h[t]];null===(e=Z[q.indexOf(n)])||void 0===e||e.setTrue(t)}for(let t=0;t<G;++t){const e=Z[t];if(e.allFalse)continue;const i=r.BitSet.fromBytes(e.buffer.buffer,l),a=o?(0,f.GT)(c,e):this.clusterStats[S.ORIGINAL][q[t]];for(let e=0;e<L.length;++e){const n=L[e];K[e].set(t,(0,f.J1)(s,n,i))}B[t]=a.count,Q[t]=i,W[t]=a.meanDifference,j[t]=null!==(n=a.pValue)&&void 0!==n?n:r.FLOAT_NULL,z[t]=a.ratio}Y.setTag(r.TAGS.CELL_RENDERER,"html"),$.setTag(r.TAGS.CELL_RENDERER,"html");const X=F.append(C);return this.bitsets=Q.concat(D),L.forEach((t=>X.col(t).semType="lst-pie-chart")),X}createLogoSummaryTableGrid(){const t=this.dataFrame.filter.anyFalse,e=t?this.getNeededDfClone():this.dataFrame,n=this.getTotalViewerAggColumns().map((([t,e])=>A(e,t))),i=this.logoSummaryTable.plot.grid();i.sort([u.i6.MEMBERS],[!1]),this.updateFilter(),i.col(u.i6.CLUSTER).visible=!0,i.columns.setOrder([u.i6.CLUSTER,u.i6.MEMBERS,u.i6.WEB_LOGO,...this.getStringAggregatedColumns(),u.i6.DISTRIBUTION,u.i6.MEAN_DIFFERENCE,u.i6.P_VALUE,u.i6.RATIO,...n]),i.columns.rowHeader.visible=!1,i.props.rowHeight=55;const o=new r.LruCache,s=new Map;let f=null;const h=new r.LruCache,m=this.positionColumns.length,g=i.columns.byName(u.i6.WEB_LOGO);g.cellType="html",g.width=350;const v=this.getScaledActivityColumn(t),y=e.getCol(this.sequenceColumnName);i.onCellRender.subscribe((t=>{var e,n,l;const g=t.cell,C=g.tableRowIndex;if(!g.isTableCell||null==C||-1===C)return;const w=t.g,b=t.bounds;w.save(),w.beginPath(),w.rect(b.x,b.y,b.width,b.height),w.clip();try{const A=Math.max(g.bounds.height-2,0),S=this.bitsets[C];if((null===(e=g.tableColumn)||void 0===e?void 0:e.name)===u.i6.CLUSTER)c.k8(w,g.cell.value,this.clusterSelection,b),t.preventDefault();else if((null===(n=g.tableColumn)||void 0===n?void 0:n.name)===u.i6.WEB_LOGO){const e=`${C}_${this.webLogoAggregationColumnName||"count"}_${this.webLogoAggregationType}_${this._webLogoCacheGeneration}`,n=o.get(e);if(!0===s.get(e))return void t.preventDefault();const l=Math.floor((g.bounds.width-2-4*(m-1))/m);if(void 0!==n){const e=n.getProperties();for(const t of e)"positionHeight"===t.name&&t.get(n)!==this.webLogoMode?t.set(n,this.webLogoMode):"positionWidth"===t.name&&t.get(n)!==l?t.set(n,l):"minHeight"===t.name&&t.get(n)!==A&&t.set(n,A);a()(n.root).css("height",`${A}px`).children().first().css("overflow-y","hidden !important"),n.root.style.height=`${A}px`,g.element=n.root,t.preventDefault()}else{const n=[y];if(this.webLogoAggregationType!==r.AGG.TOTAL_COUNT&&this.webLogoAggregationColumnName){const t=this.dataFrame.columns.byName(this.webLogoAggregationColumnName);t&&n.push(t)}const a=r.DataFrame.fromColumns(n);a.filter.copyFrom(S),s.set(e,!0),a.plot.fromType("WebLogo",{valueColumnName:this.webLogoAggregationColumnName,valueAggrType:this.webLogoAggregationType,positionHeight:this.webLogoMode,horizontalAlignment:d.P4.LEFT,maxHeight:1e3,minHeight:A,positionWidth:l,showPositionLabels:!1}).then((t=>{o.set(e,t),s.delete(e),f&&clearTimeout(f),f=setTimeout((()=>i.invalidate()),200)})),t.preventDefault()}}else if((null===(l=g.tableColumn)||void 0===l?void 0:l.name)===u.i6.DISTRIBUTION){let e=h.get(C);void 0===e&&(e=(0,p.FZ)(v,S).plot.histogram({filteringEnabled:!1,valueColumnName:v.name,splitColumnName:u.$2.SPLIT_COL,legendVisibility:"Never",showXAxis:!1,showColumnSelector:!1,showRangeSlider:!1,showBinSelector:!1,backColor:r.Color.toHtml(r.Color.white),xAxisHeight:1,showSplitSelector:!1}),e.root.style.width="auto",h.set(C,e)),e.root.style.height=`${A}px`,g.element=e.root,t.preventDefault()}}finally{w.restore()}})),i.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),r.debounce(i.onCurrentCellChanged,500).subscribe((t=>{var e;if(!t.isTableCell||-1===t.gridRow)return this.initClusterSelection({notify:!1}),this.model.fireBitsetChanged(l.q.LOGO_SUMMARY_TABLE),void i.invalidate();try{if(!this.keyPress||(null===(e=t.tableColumn)||void 0===e?void 0:e.name)!==u.i6.CLUSTER)return;null!==this.currentRowIndex&&-1!==this.currentRowIndex&&this.modifyClusterSelection(this.getCluster(i.cell(u.i6.CLUSTER,this.currentRowIndex)),{shiftPressed:!0,ctrlPressed:!0},!1),this.modifyClusterSelection(this.getCluster(t),{shiftPressed:!0,ctrlPressed:!1}),i.invalidate()}finally{this.keyPress=!1,this.currentRowIndex=t.gridRow}})),i.root.addEventListener("keydown",(t=>{if(this.keyPress=t.key.startsWith("Arrow"),!this.keyPress){if("Escape"===t.key||"KeyA"===t.code&&t.shiftKey&&t.ctrlKey)this.initClusterSelection({notify:!1});else if("KeyA"===t.code&&t.ctrlKey)for(let t=0;t<this.logoSummaryTable.rowCount;++t)this.modifyClusterSelection(this.getCluster(i.cell(u.i6.CLUSTER,t)),{shiftPressed:!0,ctrlPressed:!1},!1);this.model.fireBitsetChanged(l.q.LOGO_SUMMARY_TABLE),i.invalidate()}})),i.root.addEventListener("click",(t=>{var e;const n=i.hitTest(t.offsetX,t.offsetY);if(!n||!n.isTableCell||(null===(e=n.tableColumn)||void 0===e?void 0:e.name)!==u.i6.CLUSTER)return;const o=this.getCluster(n);this.modifyClusterSelection(o,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey}),i.invalidate()})),i.onCellTooltip(((t,e,n)=>{var i;if(!t.isTableCell)return this.model.unhighlight(),!0;const o=this.getCluster(t);return this.highlightCluster(o),(null===(i=t.tableColumn)||void 0===i?void 0:i.name)===u.i6.CLUSTER&&this.showTooltip(o,e,n),!0}));const C=i.props;return C.allowEdit=!1,C.allowRowSelection=!1,C.allowBlockSelection=!1,C.allowColSelection=!1,C.showCurrentRowIndicator=!1,C.showReadOnlyNotifications=!1,i}highlightCluster(t){const e=this.clusterStats[t.positionOrClusterType][t.monomerOrCluster].mask;this.dataFrame.rows.highlight((t=>e.getBit(t))),this.model.isHighlighting=!0}getCluster(t){const e=this.logoSummaryTable.get(u.i6.CLUSTER,t.tableRowIndex);return{positionOrClusterType:this.dataFrame.getCol(this.clustersColumnName).categories.includes(e)?S.ORIGINAL:S.CUSTOM,monomerOrCluster:e}}updateFilter(){const t=this.logoSummaryTable.getCol(u.i6.MEMBERS),e=this.logoSummaryTable.getCol(u.i6.CLUSTER),n=e.getRawData(),i=e.categories,o=i.indexOf("-1"),r=t.getRawData();let s=0;r.forEach(((t,e)=>{"-1"!==i[n[e]]&&(s=Math.max(s,r[e]))}));const a=Math.ceil(s*this.membersRatioThreshold);this.logoSummaryTable.filter.init((t=>r[t]>a&&(-1===o||"-1"!==i[n[t]])))}clusterFromSelection(){const t=this.model.getVisibleSelection(),e=this.logoSummaryTable.columns,n=e.length,i=new Array(e.length),o=this.getScaledActivityColumn(),r=v.A.fromString(t.toBinaryString()),s=(0,f.GT)(o.getRawData(),r);this.bitsets.push(t.clone());const a=this.dataFrame.columns.getUnusedName("New Cluster"),l={},c={},d=this.getTotalViewerAggColumns(),h=this.getStringAggregatedColumns();for(const[e,n]of d){const i=A(n,e),o=this.dataFrame.getCol(e);l[i]=(0,f.lh)(o,n,t)}for(const e of h)c[e]=(0,f.J1)(this.dataFrame,e,t);for(let o=0;o<n;++o){const n=e.byIndex(o);i[o]=n.name===u.i6.CLUSTER?a:n.name===u.i6.MEMBERS?t.trueCount:n.name===u.i6.WEB_LOGO||n.name===u.i6.DISTRIBUTION?null:n.name===u.i6.MEAN_DIFFERENCE?s.meanDifference:n.name===u.i6.P_VALUE?s.pValue:n.name===u.i6.RATIO?s.ratio:n.name in l?l[n.name]:n.name in c?c[n.name]:void 0,void 0===i[o]&&y._package.logger.warning(`PeptidesLSTWarn: value for column ${n.name} is undefined`)}this.logoSummaryTable.rows.addNew(i),this.clusterStats[S.CUSTOM][a]=s,this.addNewCluster(a)}removeCluster(){const t=this.clusterSelection[S.CUSTOM];if(0===t.length)return void o.shell.warning("No custom clusters selected to be removed");const e=this.logoSummaryTable.rows,n=this.logoSummaryTable.getCol(u.i6.CLUSTER),i=n.categories,r=this.dataFrame.columns;for(const n of t){t.splice(t.indexOf(n),1),r.remove(n),delete this.clusterStats[S.CUSTOM][n];const o=i.indexOf(n);e.removeAt(o),this.bitsets.splice(o,1)}n.compact(),this.clusterSelection[S.CUSTOM]=t,this.render()}addNewCluster(t){const e=r.Column.fromBitSet(t,this.model.getVisibleSelection());e.setTag(u.gp.CUSTOM_CLUSTER,"1"),e.setTag(u.gp.ANALYSIS_COL,"true"),this.dataFrame.columns.add(e),this.model.analysisView.grid.col(e.name).visible=!1}modifyClusterSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.clusterSelection=(0,p.vW)(this.clusterSelection,t,e):this._clusterSelection=(0,p.vW)(this.clusterSelection,t,e)}showTooltip(t,e,n){const o=this.dataFrame.filter,s=o.anyFalse?this.getNeededDfClone():this.dataFrame,a=s.rowCount,l=new v.A(a,!1),u=this.getScaledActivityColumn(o.anyFalse),c=u.getRawData();if(t.positionOrClusterType===S.ORIGINAL){const e=s.getCol(this.clustersColumnName),n=e.getRawData(),i=e.categories.indexOf(t.monomerOrCluster);for(let t=0;t<a;++t)n[t]===i&&l.setTrue(t);l.incrementVersion()}else{const e=s.getCol(t.monomerOrCluster);l.buffer=e.getRawData()}const d=o.anyFalse?(0,f.GT)(c,l):this.clusterStats[t.positionOrClusterType][t.monomerOrCluster];if(!d.count)return null;const h=r.BitSet.fromBytes(l.buffer.buffer,a),m=(0,p.FZ)(u,h),y=(0,g.M1)(m,!0),C=(0,g.QD)(d),w=(0,f.I_)(this.dataFrame,this.getTotalViewerAggColumns(),{filterDf:!0,mask:h}),b=Object.assign(Object.assign({},C),w),A=(0,p.F2)(y,b);return i.tooltip.show(A,e,n),A}createWebLogoDf(t,e){const n=r.DataFrame.fromColumns([t]);return n.filter.copyFrom(e),n}}},3541:(t,e,n)=>{"use strict";n.d(e,{J:()=>_,UJ:()=>M,ds:()=>i,xN:()=>N});var i,o,r,s,a=n(4328),l=n(7389),u=n(6082),c=n(7233),d=n.n(c),f=n(4139),h=n(3163),m=n(768),g=n(144),p=n.n(g),v=n(5070),y=n(912),C=n(3657),w=n(8608),b=n(3077),A=n(439),S=n(2003),E=n(8223),T=n(726),x=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};!function(t){t.MUTATION_CLIFFS="Mutation Cliffs",t.INVARIANT_MAP="Invariant Map"}(i||(i={})),function(t){t.SEQUENCE="sequence",t.ACTIVITY="activity",t.ACTIVITY_SCALING="activityScaling",t.TARGET="target",t.TARGET_CATEGORY="targetCategory",t.MIN_ACTIVITY_DELTA="minActivityDelta",t.MAX_MUTATIONS="maxMutations",t.COLUMNS="columns",t.AGGREGATION="aggregation",t.ACTIVITY_TARGET="activityTarget",t.VALUE_INVARIANT_MAP="value",t.AGGREGATION_INVARIANT_MAP_VALUE="valueAggregation"}(o||(o={})),function(t){t.COLOR="color",t.COLOR_AGGREGATION="colorAggregation",t.CUSTOM_COLOR_RANGE="customColorRange",t.MIN_COLOR_VALUE="minColorValue",t.MAX_COLOR_VALUE="maxColorValue",t.LOWER_BOUND_COLOR="lowerBoundColor",t.MIDDLE_COLOR="middleColor",t.UPPER_BOUND_COLOR="upperBoundColor",t.LOG_SCALE_COLOR="logScaleColor",t.SHOW_FILTER_CONTROLS="showFilterControls"}(r||(r={})),function(t){t.GENERAL="General",t.INVARIANT_MAP="Invariant Map",t.MUTATION_CLIFFS="Mutation Cliffs",t.AGGREGATION="Aggregation"}(s||(s={}));class N extends u.JsViewer{constructor(){super(),this.keyPressed=!1,this._scaledActivityColumn=null,this.doRender=!0,this._viewerGrid=null,this._positionColumns=null,this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._invariantMapSelection=null,this._mutationCliffsSelection=null,this._monomerMetaColumns=new Set,this.sequenceColumnName=this.column(o.SEQUENCE,{category:s.GENERAL,semType:u.SEMTYPE.MACROMOLECULE,nullable:!1}),this.activityColumnName=this.column(o.ACTIVITY,{category:s.GENERAL,nullable:!1}),this.activityScaling=this.string(o.ACTIVITY_SCALING,f.rg.NONE,{category:s.GENERAL,choices:Object.values(f.rg),nullable:!1}),this.activityTarget=this.string(o.ACTIVITY_TARGET,f.wf.HIGH,{category:s.GENERAL,choices:Object.values(f.wf),nullable:!1}),this.targetColumnName=this.column(o.TARGET,{category:s.GENERAL,nullable:!0,columnTypeFilter:"categorical",userEditable:!0}),this.minActivityDelta=this.float(o.MIN_ACTIVITY_DELTA,0,{category:s.MUTATION_CLIFFS,min:0,max:100}),this.maxMutations=this.int(o.MAX_MUTATIONS,1,{category:s.MUTATION_CLIFFS,min:1,max:20}),this.columns=this.columnList(o.COLUMNS,[],{category:s.AGGREGATION}),this.aggregation=this.string(o.AGGREGATION,u.AGG.AVG,{category:s.AGGREGATION,choices:f.V5}),this.valueColumnName=this.column(o.VALUE_INVARIANT_MAP,{category:s.INVARIANT_MAP,userEditable:!0,nullable:!1,columnTypeFilter:"numerical"}),this.valueAggregation=this.string(o.AGGREGATION_INVARIANT_MAP_VALUE,u.AGG.TOTAL_COUNT,{category:s.INVARIANT_MAP,choices:f.V5,userEditable:!0,nullable:!1}),this.mutationCliffsDebouncer=(0,w.sg)(((t,e,n)=>x(this,void 0,void 0,(function*(){return yield(0,C.uz)(t,e,n)})))),this.targetCategoryInput=l.input.choice("Category",{value:null,items:[],nullable:!0,onValueChanged:()=>{var t;this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._invariantMapSelection=null,this.doRender=!1,this._monomerPositionStats=null,null===(t=this.positionColumns)||void 0===t||t.forEach((t=>{t.temp[f.gp.INVARIANT_MAP_COLOR_CACHE]=null})),this.sequenceColumnName&&this.activityColumnName&&this.calculateMutationCliffs().then((t=>{this.mutationCliffs=t.cliffs,this.cliffStats=t.cliffStats})),this.viewerGrid.invalidate()}}),this.targetCategoryInput.root.style.display="none",this.targetCategoryInput.root.style.maxWidth="50%",this.targetCategoryInput.root.style.marginLeft="8px"}get viewerGrid(){var t;return null!==(t=this._viewerGrid)&&void 0!==t||(this._viewerGrid=this.createViewerGrid()),this._viewerGrid}render(){}get alphabet(){var t;return null!==(t=this.dataFrame.getCol(this.sequenceColumnName).getTag(A.gp.alphabet))&&void 0!==t?t:S.YI.UN}get model(){return m.i.getInstance(this.dataFrame)}get positionColumns(){var t,e,n;if(null!=this._positionColumns)return this._positionColumns;const i=t=>{const e=this.model.findViewer(t);return this.sequenceColumnName===(null==e?void 0:e.sequenceColumnName)?e._positionColumns:null};return null!=this.model.positionColumns&&this.sequenceColumnName===(null===(t=this.model.settings)||void 0===t?void 0:t.sequenceColumnName)?this._positionColumns=this.model.positionColumns:this instanceof _?this._positionColumns=i(m.q.MOST_POTENT_RESIDUES):this instanceof M&&(this._positionColumns=i(m.q.SEQUENCE_VARIABILITY_MAP)),null!==(e=this._positionColumns)&&void 0!==e||(this._positionColumns=null!==(n=i(m.q.LOGO_SUMMARY_TABLE))&&void 0!==n?n:(0,b.R)(this.dataFrame.getCol(this.sequenceColumnName),T.Z.getSeqHelper()).columns.toList()),this._positionColumns}get monomerPositionStats(){var t;if(null!=this._monomerPositionStats)return this._monomerPositionStats;const e=t=>{var e,n,i;return!(this.sequenceColumnName!==(null==t?void 0:t.sequenceColumnName)||this.activityColumnName!==(null==t?void 0:t.activityColumnName)||this.activityScaling!==(null==t?void 0:t.activityScaling)||!(t instanceof N&&this.targetColumnName==(null==t?void 0:t.targetColumnName)&&(null===(e=this.targetCategoryInput)||void 0===e?void 0:e.value)===(null===(n=null==t?void 0:t.targetCategoryInput)||void 0===n?void 0:n.value))&&(t instanceof N||null!=this.targetColumnName&&null!=(null===(i=this.targetCategoryInput)||void 0===i?void 0:i.value))||!(t instanceof N&&this.valueColumnName==(null==t?void 0:t.valueColumnName)&&this.valueAggregation==(null==t?void 0:t.valueAggregation))&&(t instanceof N||this.valueColumnName&&this.valueAggregation&&this.valueAggregation!=u.AGG.VALUE_COUNT&&this.valueAggregation!=u.AGG.TOTAL_COUNT))},n=t=>{const n=this.model.findViewer(t);return e(n)?n._monomerPositionStats:null};null!==this.model.monomerPositionStats&&e(this.model.settings)?this._monomerPositionStats=this.model.monomerPositionStats:this instanceof _?this._monomerPositionStats=n(m.q.MOST_POTENT_RESIDUES):this instanceof M&&(this._monomerPositionStats=n(m.q.SEQUENCE_VARIABILITY_MAP));const i=this.targetColumnName?this.dataFrame.col(this.targetColumnName):null,o=this.targetCategoryInput.value,r=this.dataFrame.col(this.valueColumnName),s=this.valueAggregation;return null!==(t=this._monomerPositionStats)&&void 0!==t||(this._monomerPositionStats=(0,C.Ej)(this.getScaledActivityColumn(),this.dataFrame.filter,this.positionColumns,{target:i&&o?{col:i,cat:o}:void 0,aggValue:s&&r?{col:r,type:s}:void 0})),this._monomerPositionStats}get mutationCliffs(){if(null!=this._mutationCliffs)return this._mutationCliffs;const t=t=>{const e=this.model.findViewer(t);return i=e,(n=this).sequenceColumnName===(null==i?void 0:i.sequenceColumnName)&&n.activityColumnName===i.activityColumnName&&n.activityScaling===i.activityScaling&&n.targetColumnName===(null==i?void 0:i.targetColumnName)&&(null===(o=n.targetCategoryInput)||void 0===o?void 0:o.value)===(null===(r=null==i?void 0:i.targetCategoryInput)||void 0===r?void 0:r.value)&&n.minActivityDelta===(null==i?void 0:i.minActivityDelta)&&n.maxMutations===(null==i?void 0:i.maxMutations)?e._mutationCliffs:null;var n,i,o,r};return this instanceof _?this._mutationCliffs=t(m.q.MOST_POTENT_RESIDUES):this instanceof M&&(this._mutationCliffs=t(m.q.SEQUENCE_VARIABILITY_MAP)),this._mutationCliffs}set mutationCliffs(t){this._mutationCliffs=t,this.viewerGrid.invalidate()}get cliffStats(){if(!this._mutationCliffStats&&this.mutationCliffs&&this.activityColumnName&&this.sequenceColumnName&&this.dataFrame.col(this.activityColumnName)){const t=this.dataFrame.col(this.activityColumnName).getRawData();this._mutationCliffStats=(0,C.Lw)(this.mutationCliffs,t)}return this._mutationCliffStats}set cliffStats(t){this._mutationCliffStats=t,this.viewerGrid.invalidate}get mutationCliffsSelection(){var t;const e=this instanceof _?f.YX.MP:f.YX.MPR,n=this.dataFrame.getTag(`${e}${f.gp.MUTATION_CLIFFS_SELECTION}`);return null!==(t=this._mutationCliffsSelection)&&void 0!==t||(this._mutationCliffsSelection=null===n?(0,w.ZR)(this.positionColumns):JSON.parse(n)),this._mutationCliffsSelection}set mutationCliffsSelection(t){this._mutationCliffsSelection=t;const e=this instanceof _?f.YX.MP:f.YX.MPR;this.dataFrame.setTag(`${e}${f.gp.MUTATION_CLIFFS_SELECTION}`,JSON.stringify(t)),this.model.fireBitsetChanged(this instanceof _?m.q.SEQUENCE_VARIABILITY_MAP:m.q.MOST_POTENT_RESIDUES);const n=this.model.findViewer(m.q.SEQUENCE_VARIABILITY_MAP);null==n||n.viewerGrid.invalidate();const i=this.model.findViewer(m.q.MOST_POTENT_RESIDUES);null==i||i.viewerGrid.invalidate(),this.model.analysisView.grid.invalidate()}getScaledActivityColumn(t=!1){var e,n,i;return(null===(e=this.model.settings)||void 0===e?void 0:e.activityColumnName)===this.activityColumnName&&(null===(n=this.model.settings)||void 0===n?void 0:n.activityScaling)===this.activityScaling&&(this._scaledActivityColumn=this.model.getScaledActivityColumn(t)),null!==(i=this._scaledActivityColumn)&&void 0!==i||(this._scaledActivityColumn=(0,w.Y1)(this.dataFrame.getCol(this.activityColumnName),this.activityScaling)),t?u.DataFrame.fromColumns([this._scaledActivityColumn]).clone(this.dataFrame.filter).getCol(this._scaledActivityColumn.name):this._scaledActivityColumn}modifyMutationCliffsSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.mutationCliffsSelection=(0,w.vW)(this.mutationCliffsSelection,t,e):this._mutationCliffsSelection=(0,w.vW)(this.mutationCliffsSelection,t,e)}modifyInvariantMapSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.invariantMapSelection=(0,w.vW)(this.invariantMapSelection,t,e):this._invariantMapSelection=(0,w.vW)(this.invariantMapSelection,t,e)}get invariantMapSelection(){var t;const e=this.dataFrame.getTag(`${f.YX.MP}${f.gp.INVARIANT_MAP_SELECTION}`);return null!==(t=this._invariantMapSelection)&&void 0!==t||(this._invariantMapSelection=null===e?(0,w.ZR)(this.positionColumns):JSON.parse(e)),this._invariantMapSelection}set invariantMapSelection(t){this._invariantMapSelection=t,this.dataFrame.setTag(`${f.YX.MP}${f.gp.INVARIANT_MAP_SELECTION}`,JSON.stringify(t)),this.model.fireBitsetChanged(m.q.SEQUENCE_VARIABILITY_MAP),this.model.analysisView.grid.invalidate()}resetTargetCategoryValue(){var t;const e=this.targetColumnName,n=e?this.dataFrame.col(e):null;this.targetCategoryInput.items=null!==(t=null==n?void 0:n.categories)&&void 0!==t?t:[],this.targetCategoryInput.value=null,this.targetCategoryInput.root.style.display=e?"flex":"none"}onPropertyChanged(t){switch(super.onPropertyChanged(t),this.doRender=!0,t.name){case`${o.SEQUENCE}${f.To}`:this._positionColumns=null,this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._viewerGrid=null;break;case`${o.ACTIVITY}${f.To}`:case o.ACTIVITY_SCALING:this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._viewerGrid=null,this._scaledActivityColumn=null;break;case`${o.VALUE_INVARIANT_MAP}${f.To}`:case o.AGGREGATION_INVARIANT_MAP_VALUE:this._monomerPositionStats=null,this._viewerGrid=null,this._invariantMapSelection=null;break;case o.MIN_ACTIVITY_DELTA:case o.MAX_MUTATIONS:this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this.doRender=!1;break;case o.COLUMNS:case o.AGGREGATION:this instanceof M&&(this._viewerGrid=null);break;case o.ACTIVITY_TARGET:(this instanceof M||this instanceof _)&&(this._viewerGrid=null)}null===this._mutationCliffs&&this.sequenceColumnName&&this.activityColumnName&&this.dataFrame&&this.calculateMutationCliffs().then((t=>{this.mutationCliffs=t.cliffs,this.cliffStats=t.cliffStats})),t.name===`${o.TARGET}${f.To}`&&this.targetColumnInput&&(this.targetColumnInput.value=this.targetColumnName?this.dataFrame.col(this.targetColumnName):null,this.resetTargetCategoryValue())}getAggregationColumns(){return Object.fromEntries(this.columns.map((t=>[t,this.aggregation])).filter((([t,e])=>this.model.df.columns.contains(t)&&this.model.df.col(t).matches("numerical"))))}getTotalViewerAggColumns(){var t,e;const n=this.getAggregationColumns();return(0,w.zm)(this.model.df,this.columns,n,null===(e=null===(t=this.model)||void 0===t?void 0:t.settings)||void 0===e?void 0:e.columns)}createViewerGrid(){throw new Error("Not implemented")}detach(){this.subs.forEach((t=>t.unsubscribe()))}onTableAttached(){var t,e,n;if(super.onTableAttached(),(0,w.B2)(this.dataFrame))null===(t=this.getProperty(`${o.SEQUENCE}${f.To}`))||void 0===t||t.set(this,this.dataFrame.columns.bySemType(u.SEMTYPE.MACROMOLECULE).name),null===(e=this.getProperty(`${o.ACTIVITY}${f.To}`))||void 0===e||e.set(this,p()(this.dataFrame.columns.numerical).next().value.name),null===(n=this.getProperty(`${o.VALUE_INVARIANT_MAP}${f.To}`))||void 0===n||n.set(this,p()(this.dataFrame.columns.numerical).next().value.name),null===this.mutationCliffs&&this.sequenceColumnName&&this.activityColumnName&&this.calculateMutationCliffs().then((t=>{this.mutationCliffs=t.cliffs,this.cliffStats=t.cliffStats})),this.subs.push(a.events.onContextMenu.subscribe((t=>{if(!(t&&t.causedBy&&t.args&&t.args.menu&&t.causedBy.target&&t.causedBy.target instanceof HTMLElement&&this.root.contains(t.causedBy.target)))return;const e=t.args.menu;(0,E.pj)().then((t=>{const n=t.getMonomerLib(),i=n.getMonomerSymbolsByType("PEPTIDE").map((t=>n.getMonomer("PEPTIDE",t))).filter(Boolean).map((t=>{var e;return null!==(e=t.meta)&&void 0!==e?e:{}})),o=new Set;i.forEach((t=>Object.keys(t).forEach((t=>o.add(t))))),o.delete("colors"),e.group("Monomer Meta").items(Array.from(o),(t=>{this._monomerMetaColumns.has(t)?this._monomerMetaColumns.delete(t):this._monomerMetaColumns.add(t),this._viewerGrid=null,this.render()}),{isChecked:t=>this._monomerMetaColumns.has(t)})}))})));else{const t="PeptidesError: dataframe is missing Macromolecule or numeric columns";a.log.error(t),a.shell.warning(t)}}calculateMutationCliffs(){return x(this,void 0,void 0,(function*(){const t=this.dataFrame.getCol(this.activityColumnName),e=this.positionColumns.map(w.eY),n=this.targetColumnName?(0,w.eY)(this.dataFrame.getCol(this.targetColumnName)):null,i={maxMutations:this.maxMutations,minActivityDelta:this.minActivityDelta,targetCol:n,currentTarget:this.targetCategoryInput.value},o=t.getRawData(),r=yield this.mutationCliffsDebouncer(o,e,i);return{cliffs:r,cliffStats:(0,C.Lw)(r,o)}}))}}class _ extends N{constructor(){super(),this.currentGridCell=null,this.customColorRange=!1,this.minColorValue=0,this.maxColorValue=0,this.logScaleColor=!1,this.showFilterControls=!0,this.colorColumnName=this.column(r.COLOR,{category:s.INVARIANT_MAP,nullable:!1,columnTypeFilter:"numerical"}),this.colorAggregation=this.string(r.COLOR_AGGREGATION,u.AGG.AVG,{category:s.INVARIANT_MAP,choices:f.V5}),this.lowerBoundColor=this.int(r.LOWER_BOUND_COLOR,4278190335,{category:s.INVARIANT_MAP,editor:"color"}),this.middleColor=this.int(r.MIDDLE_COLOR,4294967295,{category:s.INVARIANT_MAP,editor:"color"}),this.upperBoundColor=this.int(r.UPPER_BOUND_COLOR,4294901760,{category:s.INVARIANT_MAP,editor:"color"}),this.logScaleColor=this.bool(r.LOG_SCALE_COLOR,!1,{category:s.INVARIANT_MAP}),this.customColorRange=this.bool(r.CUSTOM_COLOR_RANGE,!1,{category:s.INVARIANT_MAP}),this.minColorValue=this.float(r.MIN_COLOR_VALUE,0,{category:s.INVARIANT_MAP}),this.maxColorValue=this.float(r.MAX_COLOR_VALUE,0,{category:s.INVARIANT_MAP}),this.showFilterControls=this.bool(r.SHOW_FILTER_CONTROLS,!0,{category:s.GENERAL,description:"Show monomer search and target controls"}),this.monomerSearchInput=l.input.string("Search",{value:"",nullable:!0,placeholder:"Search monomer",tooltipText:"Search for monomer by symbol. For multiple monomers use comma as a separator.",onValueChanged:()=>{var t,e,n;const i=()=>{var t,e,n;return null===(n=null===(e=null===(t=this._viewerGrid)||void 0===t?void 0:t.dataFrame)||void 0===e?void 0:e.filter)||void 0===n?void 0:n.setAll(!0)},o=null!==(n=null===(e=null===(t=this.monomerSearchInput.value)||void 0===t?void 0:t.trim())||void 0===e?void 0:e.toLowerCase())&&void 0!==n?n:"";if(!o||null==this._viewerGrid||null==this._viewerGrid.dataFrame)return void i();const r=this._viewerGrid.dataFrame.col(f.$2.MONOMER);if(null==r)return void i();const s=o.split(",").map((t=>t.trim())).filter((t=>!!t)),a=r.toList();this._viewerGrid.dataFrame.filter.init((t=>s.some((e=>a[t].toLowerCase().includes(e)))))}})}get name(){return m.q.SEQUENCE_VARIABILITY_MAP}get mode(){var t;return null!==(t=this.dataFrame.getTag(f.gp.MONOMER_POSITION_MODE))&&void 0!==t?t:i.MUTATION_CLIFFS}set mode(t){this.dataFrame.setTag(f.gp.MONOMER_POSITION_MODE,t),this.viewerGrid.invalidate()}onTableAttached(){var t;if(super.onTableAttached(),(0,w.B2)(this.dataFrame))null===(t=this.getProperty(`${r.COLOR}${f.To}`))||void 0===t||t.set(this,this.activityColumnName),this.targetColumnInput=l.input.column("Target",{value:void 0,nullable:!0,table:this.dataFrame,filter:t=>t.isCategorical,onValueChanged:t=>{var e,n;const i=this.getProperty(`${o.TARGET}${f.To}`);i&&i.get(this)!=(null!==(e=null==t?void 0:t.name)&&void 0!==e?e:null)&&(null==i||i.set(this,null!==(n=null==t?void 0:t.name)&&void 0!==n?n:null))}});else{const t="PeptidesError: dataframe is missing Macromolecule or numeric columns";a.log.error(t),a.shell.warning(t)}this.render()}onPropertyChanged(t){var e;super.onPropertyChanged(t),t.name===o.SEQUENCE&&(this._invariantMapSelection=null),null===(e=this.positionColumns)||void 0===e||e.forEach((t=>{t.temp[f.gp.INVARIANT_MAP_COLOR_CACHE]=null})),this.doRender?this.render():this.viewerGrid.invalidate()}createMonomerPositionDf(){const t=new Set,e=this.positionColumns;for(const n of e){const e=n.categories;for(const n of e)""!==n&&t.add(n)}const n=Array.from(t),i=u.Column.fromStrings(f.$2.MONOMER,n),o=u.DataFrame.fromColumns([i]),r=(0,E.pj)().then((t=>{const e=t.getMonomerLib();return e?n.map((t=>{var n,i;return null!==(i=null===(n=e.getMonomer("PEPTIDE",t))||void 0===n?void 0:n.meta)&&void 0!==i?i:{}})):n.map((t=>({})))}));this._monomerMetaColumns.forEach((t=>{const e=o.columns.addNewString(t);r.then((n=>{e.init((e=>{var i,o;return null!==(o=null===(i=n[e][t])||void 0===i?void 0:i.toString())&&void 0!==o?o:""}))}))})),o.name="SAR";for(const t of e)o.columns.addNewBool(t.name);return o}cacheInvariantMapColors(){if(this.colorColumnName&&this.dataFrame.col(this.colorColumnName)){const t=this.dataFrame.getCol(this.colorColumnName).getRawData();let e=9999999,n=-9999999;const i=this.targetColumnName?this.dataFrame.col(this.targetColumnName):null,o=null==i?void 0:i.getRawData(),r=this.targetCategoryInput.value,s=null==r?null:null==i?void 0:i.categories.indexOf(r);for(const i of this.positionColumns){i.temp[f.gp.INVARIANT_MAP_COLOR_CACHE]={};const r=i.temp[f.gp.INVARIANT_MAP_COLOR_CACHE],a=i.name,l=i.getRawData(),c=i.categories;if(!this.monomerPositionStats[a])continue;const d=this.monomerPositionStats[a];for(const a of Object.keys(d)){if("general"===a)continue;const d=[];for(let t=0;t<i.length;++t){const e=c[l[t]]===a,n=!o||null==s||-1==s||o[t]===s;e&&n&&d.push(t)}const f=u.Column.float("color",d.length).init((e=>t[d[e]])).aggregate(this.colorAggregation);r[a]=f,e=Math.min(e,f),n=Math.max(n,f)}i.temp[f.gp.INVARIANT_MAP_COLOR_CACHE]=r}const a=this.customColorRange&&null!=this.minColorValue&&null!=this.maxColorValue;let l=a?this.minColorValue:e,c=a?this.maxColorValue:n;const d=this.logScaleColor&&l>1e-30&&c>1e-30&&e>1e-30&&n>1e-30;d&&(l=Math.log(l),c=Math.log(c));for(const t of this.positionColumns){const i=t.temp[f.gp.INVARIANT_MAP_COLOR_CACHE];if(i){for(const t of Object.keys(i))this.activityTarget===f.wf.LOW&&(i[t]=c-i[t]+l),i[t]=u.Color.scaleColor(d?Math.log(i[t]):i[t],l,c,void 0,[this.lowerBoundColor,this.middleColor,this.upperBoundColor]);t.temp[f.gp.INVARIANT_MAP_COLOR_CACHE]=i,t.temp[f.gp.INVARIANT_MAP_COLOR_MIN_CACHE]=e,t.temp[f.gp.INVARIANT_MAP_COLOR_MAX_CACHE]=n}}}}createViewerGrid(){const t=this.createMonomerPositionDf(),e=t.plot.grid();e.sort([f.$2.MONOMER]);const n=this.positionColumns.map((t=>t.name));e.columns.setOrder([f.$2.MONOMER,...this._monomerMetaColumns,...n]);const o=t.getCol(f.$2.MONOMER);h.rI(o,this.alphabet,!0),this.cacheInvariantMapColors(),e.onCellRender.subscribe((t=>O(t,this,this.mode===i.INVARIANT_MAP,this.dataFrame.getCol(this.colorColumnName),this.colorAggregation))),e.onCellTooltip(((t,e,n)=>{var o,r,s,a,l;if(!t.isTableCell||!(null===(o=null==t?void 0:t.cell.column)||void 0===o?void 0:o.name)||this._monomerMetaColumns.has(t.cell.column.name))return this.model.unhighlight(),!0;const c=this.getMonomerPosition(t);(0,w.dl)(c,this.dataFrame,this.monomerPositionStats),this.model.isHighlighting=!0;const d=this.getTotalViewerAggColumns(),f={},h={};if(this.mode===i.INVARIANT_MAP)this.colorColumnName&&this.colorAggregation&&this.colorColumnName!==this.valueColumnName?(d.unshift([this.colorColumnName,this.colorAggregation]),f[`${this.colorAggregation}(${this.colorColumnName})`]=" (color)"):this.colorColumnName&&this.colorAggregation&&this.colorColumnName===this.valueColumnName&&(f["Mean activity"]=" (color)"),this.valueColumnName&&this.valueAggregation&&this.valueAggregation!==u.AGG.VALUE_COUNT&&this.valueAggregation!==u.AGG.TOTAL_COUNT&&d.unshift([this.valueColumnName,this.valueAggregation]);else{const t=null===(s=null===(r=this.mutationCliffs)||void 0===r?void 0:r.get(c.monomerOrCluster))||void 0===s?void 0:s.get(c.positionOrClusterType);if(t){let e=0;for(const n of t.values())e+=n.length;h["Pairs count"]=e.toString()}}return(0,y.D)(this.model.df,this.getScaledActivityColumn(),d,{fromViewer:!0,isMutationCliffs:this.mode===i.MUTATION_CLIFFS,monomerPosition:c,x:e,y:n,mpStats:this.monomerPositionStats,cliffStats:null!==(l=null===(a=this.cliffStats)||void 0===a?void 0:a.stats)&&void 0!==l?l:void 0,postfixes:f,additionalStats:h})})),e.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),u.debounce(e.onCurrentCellChanged,500).subscribe((t=>{var n,o,r,s,a,l,c,d,f;try{if(!t||!t.dart||!(null===(o=null===(n=null==t?void 0:t.cell)||void 0===n?void 0:n.column)||void 0===o?void 0:o.name)||this._monomerMetaColumns.has(t.cell.column.name))return;if(-1===t.gridRow&&(this.mode===i.INVARIANT_MAP?this._invariantMapSelection=(0,w.ZR)(this.positionColumns):this._mutationCliffsSelection=(0,w.ZR)(this.positionColumns),this.model.fireBitsetChanged(m.q.SEQUENCE_VARIABILITY_MAP),e.invalidate()),!this.keyPressed)return;if(null!==this.currentGridCell){const t=this.getMonomerPosition(this.currentGridCell);this.mode===i.INVARIANT_MAP?this.modifyInvariantMapSelection(t,{shiftPressed:!0,ctrlPressed:!0},!1):(null===(a=null===(s=null===(r=this.mutationCliffs)||void 0===r?void 0:r.get(t.monomerOrCluster))||void 0===s?void 0:s.get(t.positionOrClusterType))||void 0===a?void 0:a.size)&&this.modifyMutationCliffsSelection(t,{shiftPressed:!0,ctrlPressed:!0},!1)}const u=this.getMonomerPosition(t);this.mode===i.INVARIANT_MAP?this.modifyInvariantMapSelection(u,{shiftPressed:!0,ctrlPressed:!1},!0):(null===(d=null===(c=null===(l=this.mutationCliffs)||void 0===l?void 0:l.get(u.monomerOrCluster))||void 0===c?void 0:c.get(u.positionOrClusterType))||void 0===d?void 0:d.size)&&this.modifyMutationCliffsSelection(u,{shiftPressed:!0,ctrlPressed:!1},!0),e.invalidate(),setTimeout((()=>null==e?void 0:e.invalidate()),300)}finally{this.keyPressed=!1,(null===(f=t.tableColumn)||void 0===f?void 0:f.name)&&t.grid?this.currentGridCell=u.GridCell.fromColumnRow(t.grid,t.tableColumn.name,t.gridRow):this.currentGridCell=null}})),e.root.addEventListener("keydown",(t=>{if(this.keyPressed=t.key.startsWith("Arrow"),!this.keyPressed){if("Escape"===t.key||"KeyA"===t.code&&t.ctrlKey&&t.shiftKey)this.mode===i.INVARIANT_MAP?this._invariantMapSelection=(0,w.ZR)(this.positionColumns):this._mutationCliffsSelection=(0,w.ZR)(this.positionColumns);else{if("KeyA"!==t.code||!t.ctrlKey)return;{const t=Object.keys(this.monomerPositionStats).filter((t=>"general"!==t));for(const e of t){const t=Object.keys(this.monomerPositionStats[e]).filter((t=>"general"!==t));for(const n of t){const t={monomerOrCluster:n,positionOrClusterType:e};this.mode===i.INVARIANT_MAP?this.modifyInvariantMapSelection(t,{shiftPressed:!0,ctrlPressed:!1},!1):this.modifyMutationCliffsSelection(t,{shiftPressed:!0,ctrlPressed:!1},!1)}}}}this.model.fireBitsetChanged(m.q.SEQUENCE_VARIABILITY_MAP),e.invalidate()}})),e.root.addEventListener("click",(n=>{var o,r,s,a,l;const u=e.hitTest(n.offsetX,n.offsetY);if(!(null==u?void 0:u.isTableCell)||(null===(o=null==u?void 0:u.tableColumn)||void 0===o?void 0:o.name)===f.$2.MONOMER||(null===(r=null==u?void 0:u.tableColumn)||void 0===r?void 0:r.name)&&this._monomerMetaColumns.has(u.tableColumn.name))return;const c=this.getMonomerPosition(u);this.mode===i.INVARIANT_MAP?(this.modifyInvariantMapSelection(c,{shiftPressed:n.shiftKey,ctrlPressed:n.ctrlKey}),(0,w.CD)(this.invariantMapSelection)&&(t.currentRowIdx=-1)):(null===(l=null===(a=null===(s=this.mutationCliffs)||void 0===s?void 0:s.get(c.monomerOrCluster))||void 0===a?void 0:a.get(c.positionOrClusterType))||void 0===l?void 0:l.size)&&this.modifyMutationCliffsSelection(c,{shiftPressed:n.shiftKey,ctrlPressed:n.ctrlKey}),e.invalidate()})),I(e);const r=e.onAfterDrawContent.subscribe((()=>{const t=e.col(f.$2.MONOMER);if(40!==t.width){t.width=40;for(const t of n)e.col(t).width=40}else r.unsubscribe()}));return e}getMonomerPosition(t){return{monomerOrCluster:t.cell.dataFrame.get(f.$2.MONOMER,t.tableRowIndex),positionOrClusterType:t.tableColumn.name}}render(){var t,e,n;if(d()(this.root).empty(),!this.activityColumnName||!this.sequenceColumnName)return void this.root.appendChild(l.divText("Please, select a sequence and activity columns in the viewer properties"));const o=this.getProperty(r.COLOR);o&&(o.choices=p()(a.shell.t.columns.numerical).toArray().map((t=>t.name)),o.get(this)===f.$2.ACTIVITY_SCALED&&o.set(this,f.$2.ACTIVITY)),d()(this.root).empty();let s=l.divText(m.q.MOST_POTENT_RESIDUES,{id:"pep-viewer-title"});if(this.name===m.q.SEQUENCE_VARIABILITY_MAP){const t=l.input.bool(i.MUTATION_CLIFFS,{value:this.mode===i.MUTATION_CLIFFS});t.root.addEventListener("click",(()=>{e.value=!1,t.value=!0,this.mode=i.MUTATION_CLIFFS})),t.setTooltip("Statistically significant changes in activity");const e=l.input.bool(i.INVARIANT_MAP,{value:this.mode===i.INVARIANT_MAP});e.root.addEventListener("click",(()=>{t.value=!1,e.value=!0,this.mode=i.INVARIANT_MAP})),e.setTooltip("Number of sequences having monomer-position");const n=t=>{d()(t.root).find(".ui-input-editor").css("margin","0px").attr("type","radio"),d()(t.root).find(".ui-input-description").css("padding","0px").css("padding-right","16px"),d()(t.captionLabel).addClass("ui-label-right")};n(t),n(e),s=l.divH([t.root,e.root],{id:"pep-viewer-title"}),d()(s).css("width","auto").css("align-self","center")}const u=this.viewerGrid.root;u.style.width="auto";const c=l.iconFA("expand-alt",(()=>{const t=l.dialog();t.add(l.divV([s,u],{style:{height:"100%"}})),t.onCancel((()=>this.render())),t.showModal(!0),this.viewerGrid.invalidate()}),"Show Sequence Variability Map Table in full screen");d()(c).addClass("pep-help-icon"),this.targetColumnInput&&(this.targetColumnInput.root.style.maxWidth="50%"),this.monomerSearchInput.root.style.marginRight="8px";const h=l.divH([this.monomerSearchInput.root,null!==(e=null===(t=this.targetColumnInput)||void 0===t?void 0:t.root)&&void 0!==e?e:l.div(),this.targetCategoryInput.root],{style:{alignSelf:"center",justifyContent:"center",width:"100%",flexWrap:"wrap"}});h.style.display=this.showFilterControls?"flex":"none";const g=l.divH([c,s,h],{style:{alignSelf:"center",lineHeight:"normal",flexDirection:"column",width:"100%"}});this.root.appendChild(l.divV([g,u])),null===(n=this.viewerGrid)||void 0===n||n.invalidate(),this.monomerSearchInput.fireChanged()}}class M extends N{constructor(){super(),this.currentGridRowIdx=null}get name(){return m.q.MOST_POTENT_RESIDUES}onTableAttached(){super.onTableAttached(),this.render()}onPropertyChanged(t){super.onPropertyChanged(t),this.doRender&&this.render()}createMostPotentResiduesDf(){var t;const e=Object.entries(this.monomerPositionStats),n=new Array(e.length-1),i=new Array(n.length),o=new Array(n.length),r=new Array(n.length),s=new Array(n.length),a=new Array(n.length),l=new Array(n.length),c=this.getTotalViewerAggColumns(),d=c.map((([t,e])=>(0,v.hX)(e,t))),h=new Array(d.length);d.forEach(((t,e)=>h[e]=new Array(n.length)));let m=0;for(const[g,p]of e){const e=p.general;if(!e)continue;if(1===Object.entries(p).length)continue;const y=[];for(const[n,i]of Object.entries(p))"general"!==n&&(i.count>1&&(null==i.pValue||(null!==(t=i.pValue)&&void 0!==t?t:1)<=.05)&&y.push([n,i]),i.pValue===e.minPValue&&y.push([n,i]));let C=null;0===y.length&&(C=Object.entries(p).find((([t,e])=>"general"!=t)));for(const[t,e]of y)(null===C||this.activityTarget===f.wf.HIGH&&C[1].meanDifference<e.meanDifference||this.activityTarget===f.wf.LOW&&C[1].meanDifference>e.meanDifference)&&(C=[t,e]);if(null===C)continue;n[m]=parseInt(g),i[m]=C[0],o[m]=C[1].meanDifference,r[m]=C[1].pValue,s[m]=C[1].count,a[m]=C[1].ratio,l[m]=C[1].mean;const w=this.monomerPositionStats[g][C[0]],b=u.BitSet.fromBytes(w.mask.buffer.buffer,this.model.df.col(this.activityColumnName).length);for(let t=0;t<d.length;t++){const[e,n]=c[t];h[t][m]=(0,v.lh)(this.model.df.getCol(e),n,b)}++m}n.length=m,i.length=m,o.length=m,r.length=m,s.length=m,a.length=m,l.length=m;const g=u.DataFrame.create(m),p=g.columns;return p.add(u.Column.fromList(u.TYPE.INT,f.$2.POSITION,n)),p.add(u.Column.fromList(u.TYPE.STRING,f.$2.MONOMER,i)),p.add(u.Column.fromList(u.TYPE.FLOAT,f.$2.MEAN_DIFFERENCE,o)),p.add(u.Column.fromList(u.TYPE.FLOAT,f.$2.MEAN,l)),p.add(u.Column.fromList(u.TYPE.FLOAT,f.$2.P_VALUE,r)),p.add(u.Column.fromList(u.TYPE.INT,f.$2.COUNT,s)),p.add(u.Column.fromList(u.TYPE.FLOAT,f.$2.RATIO,a)),d.forEach(((t,e)=>p.add(u.Column.fromList(u.TYPE.FLOAT,t,h[e])))),g}createViewerGrid(){const t=this.createMostPotentResiduesDf(),e=t.plot.grid();e.sort([f.$2.POSITION]);const n=e.col(f.$2.P_VALUE);n.format="#.000",n.name="P-value";const i=t.getCol(f.$2.MONOMER);h.rI(i,this.alphabet,!0),e.onCellRender.subscribe((t=>O(t,this,!1))),e.onCellTooltip(((t,e,n)=>{var i,o;if(!t.isTableCell)return this.model.unhighlight(),!0;const r=this.getMonomerPosition(t);if((0,w.dl)(r,this.dataFrame,this.monomerPositionStats),this.model.isHighlighting=!0,(null===(i=t.tableColumn)||void 0===i?void 0:i.name)===f.$2.MONOMER)r.positionOrClusterType=f.$2.MONOMER;else if((null===(o=t.tableColumn)||void 0===o?void 0:o.name)!==f.$2.MEAN_DIFFERENCE)return!1;const s=this.getTotalViewerAggColumns(),a=null==t.tableRowIndex?void 0:(0,v.m2)(t.grid.dataFrame,t.tableRowIndex,s,{});return(0,y.D)(this.model.df,this.getScaledActivityColumn(),s,{fromViewer:!0,isMostPotentResidues:!0,monomerPosition:r,x:e,y:n,mpStats:this.monomerPositionStats,aggrColValues:a})})),u.debounce(e.onCurrentCellChanged,500).subscribe((n=>{var i,o,r;try{if(-1===n.gridRow)return this._mutationCliffsSelection=(0,w.ZR)(this.positionColumns),this._invariantMapSelection=(0,w.ZR)(this.positionColumns),this.model.fireBitsetChanged(m.q.MOST_POTENT_RESIDUES),void e.invalidate();if(this.keyPressed&&t.currentCol.name!==f.$2.MEAN_DIFFERENCE||!this.keyPressed)return;const s=this.getMonomerPosition(n);if(null!==this.currentGridRowIdx){const t=this.getMonomerPosition(e.cell("Diff",this.currentGridRowIdx));this.modifyInvariantMapSelection(t,{shiftPressed:!0,ctrlPressed:!0},!1)}(null===(r=null===(o=null===(i=this.mutationCliffs)||void 0===i?void 0:i.get(s.monomerOrCluster))||void 0===o?void 0:o.get(s.positionOrClusterType))||void 0===r?void 0:r.size)&&this.modifyInvariantMapSelection(s,{shiftPressed:!0,ctrlPressed:!1}),e.invalidate()}finally{this.keyPressed=!1,this.currentGridRowIdx=n.gridRow}})),e.root.addEventListener("keydown",(n=>{if(this.keyPressed=n.key.startsWith("Arrow"),!this.keyPressed){if("Escape"===n.key||"KeyA"===n.code&&n.ctrlKey&&n.shiftKey)this._mutationCliffsSelection=(0,w.ZR)(this.positionColumns);else{if("KeyA"!==n.code||!n.ctrlKey)return;for(let n=0;n<t.rowCount;++n){const t=this.getMonomerPosition(e.cell("Diff",n));this.modifyInvariantMapSelection(t,{shiftPressed:!0,ctrlPressed:!1},!1)}}this.model.fireBitsetChanged(m.q.MOST_POTENT_RESIDUES),e.invalidate()}})),e.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),e.root.addEventListener("click",(t=>{var n,i,o;const r=e.hitTest(t.offsetX,t.offsetY);if(!(null==r?void 0:r.isTableCell)||r.tableColumn.name!==f.$2.MEAN_DIFFERENCE)return;const s=this.getMonomerPosition(r);(null===(o=null===(i=null===(n=this.monomerPositionStats)||void 0===n?void 0:n[s.positionOrClusterType])||void 0===i?void 0:i[s.monomerOrCluster])||void 0===o?void 0:o.count)&&(this.modifyInvariantMapSelection(s,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey}),e.invalidate())})),I(e);const o=e.col(f.$2.MEAN_DIFFERENCE);o.name="Diff";const r=e.onAfterDrawContent.subscribe((()=>{const t=e.col(f.$2.MONOMER);if(40===t.width)return o.width=40,void r.unsubscribe();t.width=40,o.width=40}));return e}getMonomerPosition(t){return{monomerOrCluster:t.cell.dataFrame.get(f.$2.MONOMER,t.tableRowIndex),positionOrClusterType:`${t.cell.dataFrame.get(f.$2.POSITION,t.tableRowIndex)}`}}render(){var t;if(d()(this.root).empty(),!this.activityColumnName||!this.sequenceColumnName)return void this.root.appendChild(l.divText("Please, select a sequence and activity columns in the viewer properties"));const e=l.divText(m.q.MOST_POTENT_RESIDUES,{id:"pep-viewer-title"}),n=this.viewerGrid.root;n.style.width="auto";const i=l.divH([e],{style:{alignSelf:"center",lineHeight:"normal"}});this.root.appendChild(l.divV([i,n])),null===(t=this.viewerGrid)||void 0===t||t.invalidate()}}function O(t,e,n,i,o){var r,s,a,l,c;const d=[...e.positionColumns.map((t=>t.name)),f.$2.MEAN_DIFFERENCE],m=t.g,g=t.bounds;m.save(),m.beginPath(),m.rect(g.x,g.y,g.width,g.height),m.clip();const p=t.cell;if(p.isRowHeader&&p.gridColumn.visible)return p.gridColumn.visible=!1,t.preventDefault(),void m.restore();const v=null===(r=p.tableColumn)||void 0===r?void 0:r.name,y=p.tableRowIndex;if(!p.isTableCell||-1===d.indexOf(v))return void m.restore();const C=p.grid.table,w=C.get(f.$2.MONOMER,y),b=v!==f.$2.MEAN_DIFFERENCE?v:C.get(f.$2.POSITION,y).toFixed(),A=e.monomerPositionStats[b];if(!A[w])return t.preventDefault(),void m.restore();if(n){const t=null!==(s=A[w].aggValue)&&void 0!==s?s:A[w].count,n=e.positionColumns.find((t=>t.name===b)),i=null!==(a=n.temp[f.gp.INVARIANT_MAP_COLOR_CACHE])&&void 0!==a?a:{};let o=u.Color.white;null!=i[w]?o=i[w]:e instanceof _&&(e.cacheInvariantMapColors(),o=null!==(c=(null!==(l=n.temp[f.gp.INVARIANT_MAP_COLOR_CACHE])&&void 0!==l?l:{})[w])&&void 0!==c?c:u.Color.white),h.rW(m,w,b,e.invariantMapSelection,t,g,o)}else h.Yd(m,w,b,e,g);t.preventDefault(),m.restore()}function I(t){const e=t.props;e.allowEdit=!1,e.allowRowSelection=!1,e.allowBlockSelection=!1,e.allowColSelection=!1,e.showRowHeader=!1,e.showCurrentRowIndicator=!1,e.showReadOnlyNotifications=!1,e.rowHeight=20}},7654:(t,e,n)=>{"use strict";n.d(e,{HV:()=>g,M1:()=>p,QD:()=>v});var i,o=n(7389),r=n(6082),s=n(7233),a=n.n(s),l=n(4139),u=n(5070),c=n(8608),d=n(5480),f=n(8774);!function(t){t.SEPARATE_MONOMERS="separateMonomers",t.SEPARATE_POSITIONS="separatePositions",t.SEPARATE_CLUSTERS="separateClusters"}(i||(i={}));const h="general",m=t=>t===h?"General":t.substring(8);function g(t,e){if(!t.selection.anyTrue)return o.divText("No distribution");const n=()=>{const n=[C(h,t,e)];for(const o of Object.values(i))"true"!==t.getTag(o)||o===i.SEPARATE_CLUSTERS&&!e.clusterColName||n.push(C(o,t,e));return 1===n.length?n[0]:o.div(n)},r=o.div(n()),s=Object.values(i),l=new Array(s.length);for(let u=0;u<s.length;u++){const c=s[u].substring(8);l[u]=o.input.bool(c,{value:"true"===t.getTag(s[u]),onValueChanged:e=>{t.setTag(s[u],`${e}`),a()(r).empty(),r.append(n())}}),a()(l[u].captionLabel).addClass("ui-label-right").css("text-align","left"),a()(l[u].root).find(".ui-input-editor").css("margin","0px"),a()(l[u].root).find(".ui-input-description").css("margin","0px"),l[u].setTooltip(`Show distribution for each ${c}`),c===i.SEPARATE_CLUSTERS?l[u].enabled=!(!e.clusterColName||!e.clusterSelection[d.W.ORIGINAL]):c!==i.SEPARATE_MONOMERS&&c!==i.SEPARATE_POSITIONS||(l[u].enabled=0!==Object.entries(e.monomerPositionSelection).length)}const u=o.form(l,{style:{flexDirection:"row"}});return o.divV([u,r])}function p(t,e=!1){const n=t.plot.histogram({filteringEnabled:!1,valueColumnName:l.$2.ACTIVITY,splitColumnName:l.$2.SPLIT_COL,legendVisibility:"Never",showXAxis:!0,showColumnSelector:!1,showRangeSlider:!1,showBinSelector:!1,backColor:e?"#fdffe5":"#fffff"});return n.root.style.width="auto",n}function v(t,e={}){var n,i;null!==(n=e.fractionDigits)&&void 0!==n||(e.fractionDigits=3);const o={[null!==(i=null==e?void 0:e.countName)&&void 0!==i?i:"Count"]:`${t.count} (${(100*t.ratio).toFixed(e.fractionDigits)}%)`,"Mean difference":t.meanDifference.toFixed(e.fractionDigits),"Mean activity":t.mean.toFixed(e.fractionDigits)};return null!=t.pValue&&(o["p-value"]=t.pValue<.01?"<0.01":t.pValue.toFixed(e.fractionDigits)),o}function y(t,e,n,i={}){const o=p((0,c.FZ)(n.activityCol,t.selection,n.peptideSelection)),s=(0,u.I_)(t,Object.entries(n.columns),{filterDf:!0,mask:r.BitSet.fromBytes(e.mask.buffer.buffer,e.mask.length)}),l=v(e),d=Object.assign(Object.assign({},l),s),f=(0,c.F2)(o,d,i);return a()(f).addClass("d4-flex-col"),f}function C(t,e,n){let r=o.divText("No distribution");switch(t){case h:const t=f.A.fromSeq(e.selection.length,(t=>e.selection.get(t))),s=e.selection.anyTrue&&e.selection.anyFalse?(0,u.GT)(n.activityCol.getRawData(),t):{count:n.activityCol.length,pValue:null,meanDifference:0,ratio:1,mask:t,mean:n.activityCol.stats.avg};r=y(e,s,n);break;case i.SEPARATE_CLUSTERS:r=function(t,e,n){const i=t.rowCount,r=[],s=e.activityCol.getRawData(),a=t.getCol(e.clusterColName),l=a.categories,h=a.getRawData(),m=n[d.W.ORIGINAL].map((t=>l.indexOf(t))),g=new Array(m.length).fill(new f.A(i));for(let t=0;t<i;t++){const e=h[t],n=m.indexOf(e);-1!==n&&g[n].setTrue(t)}for(let n=0;n<m.length;n++){const i=m[n],o=(0,u.GT)(s,g[n]);r.push(y(t,o,e,{[c.AN.SELECTION]:l[i]}))}const p=n[d.W.CUSTOM];for(const n of p){const o=t.getCol(n),a=f.A.fromUint32Array(i,o.getRawData()),l=(0,u.GT)(s,a);r.push(y(t,l,e,{[c.AN.SELECTION]:n}))}return o.div(r,"d4-flex-wrap")}(e,n,n.clusterSelection);break;case i.SEPARATE_MONOMERS:const a=function(t){const e={},n=Object.keys(t);for(const i of n)for(const n of t[i])e.hasOwnProperty(n)?e[n].includes(i)||e[n].push(i):e[n]=[i];return e}(n.monomerPositionSelection);r=function(t,e,n){var i,r,s;const a=Object.keys(n),l=t.rowCount,d=[],h=[],m=[],g=[],p=e.activityCol.getRawData();for(const o of a){const a=n[o],v=new f.A(l);for(let e=0;e<a.length;e++){const n=a[e];null!==(i=h[e])&&void 0!==i||(h[e]=t.getCol(n)),null!==(r=m[e])&&void 0!==r||(m[e]=h[e].categories),null!==(s=g[e])&&void 0!==s||(g[e]=h[e].getRawData());const u=m[e].indexOf(o);for(let t=0;t<l;t++)g[e][t]===u&&v.setTrue(t)}const C=(0,u.GT)(p,v);d.push(y(t,C,e,{[c.AN.SELECTION]:o}))}return o.div(d,"d4-flex-wrap")}(e,n,a);break;case i.SEPARATE_POSITIONS:r=function(t,e,n){var i,r,s;const a=Object.keys(n),l=t.rowCount,d=[],h=e.activityCol.getRawData(),m=[],g=[],p=[];for(let o=0;o<a.length;o++){const v=a[o],C=n[v];if(0===C.length)continue;null!==(i=m[o])&&void 0!==i||(m[o]=t.getCol(v)),null!==(r=g[o])&&void 0!==r||(g[o]=m[o].categories),null!==(s=p[o])&&void 0!==s||(p[o]=m[o].getRawData());const w=new f.A(t.rowCount);for(let t=0;t<C.length;t++){const e=C[t],n=g[o].indexOf(e);for(let t=0;t<l;t++)p[o][t]===n&&w.setTrue(t)}const b=(0,u.GT)(h,w);d.push(y(t,b,e,{[c.AN.SELECTION]:v}))}return o.div(d,"d4-flex-wrap")}(e,n,n.monomerPositionSelection)}return o.divV([o.h1(m(t)),r])}},7923:(t,e,n)=>{"use strict";n.d(e,{F:()=>u});var i=n(7389),o=n(6082),r=n(4139),s=n(8608),a=n(3163),l=n(4025);function u(t,e,n=!0){const r=c(t,e);if(!r)return new o.Widget(i.label("No mutations table generated"));const{pairsGrid:a,uniqueSequencesGrid:l,aminoToInput:u}=r,d=[a,l],f=i.divV([u.root,...d.map((t=>t.root))],{style:{width:"100%"}});return n&&(0,s.BE)("Mutation Cliffs pairs",u.root,f,(()=>{const n=c(t,e),o=i.splitH([i.divV([n.aminoToInput.root,n.pairsGrid.root],{style:{marginRight:"10px"}}),i.divV([n.uniqueSequencesGrid.root],{style:{marginLeft:"10px"}})],{style:{width:"100%",height:"100%"}},!0);return setTimeout((()=>{var t,i;if(document.contains(o)){const r=o.offsetWidth,s=null===(t=n.pairsGrid.canvas)||void 0===t?void 0:t.parentElement;n.pairsGrid.props.showRowHeader=!0,n.uniqueSequencesGrid.props.showRowHeader=!0;const a=null===(i=n.uniqueSequencesGrid.canvas)||void 0===i?void 0:i.parentElement;if(s&&a&&(s.style.height="100%",a.style.height="calc(100% - 20px)",a.style.marginTop="20px",r>400)){const t=Math.max(.33*r,200),i=n.pairsGrid.columns.byName("Mutation");i&&(i.width=t);const o=n.uniqueSequencesGrid.columns.byName(e.sequenceColumnName);o&&(o.width=t)}}}),500),o})),new o.Widget(f)}function c(t,e){var n,u;const c=t.filter.getSelectedIndexes(),d=Object.keys(e.mutationCliffsSelection);if(!d.length||null===e.mutationCliffs)return null;const f=[],h=[],m=[],g=[],p=[],v=[],y=t.getCol(e.sequenceColumnName),C=y.categories,w=y.getRawData(),b=e.activityCol.getRawData(),A=new Map,S=o.BitSet.create(t.rowCount),E={},T=Object.fromEntries(e.positionColumns.map((t=>[t.name,t])));for(const t of d){const i=T[t],o=i.categories,r=i.getRawData();for(const i of e.mutationCliffsSelection[t]){const s=null===(n=e.mutationCliffs.get(i))||void 0===n?void 0:n.get(t);if(void 0!==s)for(const[t,n]of s.entries()){if(!c.includes(t))continue;E[t]||(E[t]=Object.keys(E).length+1);const i=E[t],s=null!==(u=A.get(t))&&void 0!==u?u:[],a=C[w[t]],l=b[t],d=e.activityCol.isNone(t)?null:l;for(const l of n){if(s.includes(l)||!c.includes(l))continue;A.has(l)||A.set(l,[]);const n=C[w[l]],u=e.activityCol.isNone(l)?null:b[l],y=null==d||null==u?null:d-u;A.get(l).push(t),f.push(`${a}#${n}`),g.push(`${i}`),h.push(y),m.push(o[r[l]]),p.push(t),v.push(l),S.set(t,!0),S.set(l,!0)}}}}if(0===f.length)return null;const x=o.Column.fromStrings("Mutation",f),N=o.Column.fromList("double","Delta",h),_=o.Column.fromStrings("Group",g),M=o.Column.fromStrings("~to",m),O=o.Column.fromList(o.COLUMN_TYPE.INT,"~toIdx",v),I=o.Column.fromList(o.COLUMN_TYPE.INT,"~fromIdx",p),L=o.DataFrame.fromColumns([x,N,_,M,O,I]);L.name="Mutation Cliff pairs";const P=i.input.string("Mutated to:",{value:"",onValueChanged:t=>{const e=t;""!==e?L.filter.init((t=>M.get(t)===e)):L.filter.setAll(!0)}});P.setTooltip("Filter the rows by the monomer that the mutation was substituted to");const R=L.plot.grid();(0,s.vY)(R,!0),x.semType=r.uF.MACROMOLECULE_DIFFERENCE,x.tags[r.gp.SEPARATOR]=(0,s.AY)(y),x.tags[o.TAGS.UNITS]=y.tags[o.TAGS.UNITS],x.tags[o.TAGS.CELL_RENDERER]="MacromoleculeDifference",x.temp[l.j.notationProvider]=y.temp[l.j.notationProvider];let k=!1,V=null;const D=[];R.onCurrentCellChanged.subscribe((t=>{try{if(!t||!t.dart)return D.length=0,void $();const e=t.tableRowIndex;if(!k)return;if(null===e)return D.length=0,void $();null!==V&&D.splice(D.indexOf(V),1),D.includes(e)||(D.push(e),R.invalidate()),$()}finally{k=!1,V=t&&t.dart?t.tableRowIndex:null}})),R.root.addEventListener("keydown",(t=>{k=t.key.startsWith("Arrow")})),R.root.addEventListener("click",(t=>{const e=R.hitTest(t.offsetX,t.offsetY);if(!e||null===e.tableRowIndex)return;const n=e.tableRowIndex;if(t.shiftKey){const t=D.indexOf(n);-1===t?D.push(n):D.splice(t,1)}else D.length=0,D.push(n);$(),R.invalidate(),Y.invalidate()})),R.onCellPrepare((t=>{var e,n,i,r;if((null==t?void 0:t.isTableCell)&&"delta"==(null===(n=null===(e=null==t?void 0:t.gridColumn)||void 0===e?void 0:e.name)||void 0===n?void 0:n.toLowerCase())&&(null==(null===(i=null==t?void 0:t.cell)||void 0===i?void 0:i.value)||(null===(r=null==t?void 0:t.cell)||void 0===r?void 0:r.value)==o.FLOAT_NULL))try{t.customText="N/A"}catch(t){}})),R.onCellRender.subscribe((t=>{var e;(null===(e=t.cell.tableColumn)||void 0===e?void 0:e.name)===x.name&&D.includes(t.cell.tableRowIndex)&&(0,a.X5)(t.g,t.bounds)}));const F=e.gridColumns.length,G=[];for(let t=1;t<F;t++){const n=e.gridColumns.byIndex(t);((null==n?void 0:n.name)===e.sequenceColumnName||!0===(null==n?void 0:n.visible)&&!Object.hasOwn(T,n.name))&&G.push(n.name)}const U=t.clone(S,G);U.name="Unique sequences that form Mutation Cliffs pairs";const H=U.columns.addNewInt("~seqIdx"),q=H.getRawData();U.col(e.sequenceColumnName)&&(U.col(e.sequenceColumnName).temp[l.j.notationProvider]=y.temp[l.j.notationProvider]);const B=S.getSelectedIndexes();H.init((t=>B[t]));const Y=U.plot.grid();function $(){const t=[];for(const e of D)t.push(I.get(e)),t.push(O.get(e));U.filter.init((e=>0===D.length||t.includes(q[e])),!0),R.invalidate(),Y.invalidate()}return(0,s.vY)(Y,!0),Y.props.rowHeight=20,R.root.style.width="100% !important",Y.root.style.width="100% !important",setTimeout((()=>{R.autoSize(window.innerWidth,250,void 0,void 0,!1),Y.autoSize(window.innerWidth,250,void 0,void 0,!1),R.root.style.removeProperty("width"),R.root.style.setProperty("width","100%"),Y.root.style.removeProperty("width"),Y.root.style.setProperty("width","100%"),R.root.style.minHeight="70px",Y.root.style.minHeight="100px",R.root.style.height="unset",Y.root.style.height="unset"}),200),{pairsGrid:R,uniqueSequencesGrid:Y,aminoToInput:P}}},5082:(t,e,n)=>{"use strict";n.d(e,{n:()=>p,v:()=>g});var i=n(4328),o=n(7389),r=n(6082),s=(n(4788),n(4139)),a=n(115),l=n(768),u=n(7233),c=n.n(u),d=n(8608),f=n(1199),h=n(5429),m=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function g(t,e){const n=new a.av,l=o.div();let u=null;if(void 0===e){const e=r.Utils.firstOrNull(t.columns.toList().filter((t=>t.semType===r.SEMTYPE.MACROMOLECULE)));if(null===e)throw new Error("Peptides Error: table doesn't contain sequence columns");0!==e.stats.missingValueCount&&i.shell.info("Sequences column contains missing values. They will be ignored during analysis"),u=o.input.column("Sequence",{table:t,value:e,onValueChanged:e=>{c()(l).empty().append(o.wait((()=>m(this,void 0,void 0,(function*(){const n=yield t.plot.fromType("WebLogo",{sequenceColumnName:e.name});return n.root.style.setProperty("height","130px"),n.root}))))),0!==e.stats.missingValueCount&&i.shell.info("Sequences column contains missing values. They will be ignored during analysis")},filter:t=>t.semType===r.SEMTYPE.MACROMOLECULE,nullable:!1}),u.setTooltip("Macromolecule column in FASTA, HELM or separated format")}let g,v=r.Func.find({package:"Bio",name:"webLogoViewer"});if(0===v.length)return{host:o.label("Bio package is missing or out of date. Please install the latest version."),callback:()=>m(this,void 0,void 0,(function*(){return!1}))};if(v=r.Func.find({package:"Bio",name:"getBioLib"}),0===v.length)return{host:o.label("Bio package is missing or out of date. Please install the latest version."),callback:()=>m(this,void 0,void 0,(function*(){return!1}))};const y=t.col("activity")||t.col("IC50")||r.Utils.firstOrNull(t.columns.numerical),C=o.div([],{id:"pep-hist-host"}),w=o.input.choice("Scaling",{value:s.rg.NONE,items:Object.values(s.rg),onValueChanged:t=>m(this,void 0,void 0,(function*(){var e;g=(0,d.Y1)(A.value,t);const n=r.DataFrame.fromColumns([g]).plot.histogram({filteringEnabled:!1,valueColumnName:s.$2.ACTIVITY,legendVisibility:"Never",showXAxis:!0,showColumnSelector:!1,showRangeSlider:!1,showBinSelector:!1});null===(e=C.lastChild)||void 0===e||e.remove(),C.appendChild(n.root)}))});w.setTooltip("Activity column transformation method");const b=()=>{var t;w.enabled=null!==(t=A.value)&&void 0!==t&&t&&A.value.stats.min>0,w.value=s.rg.NONE,0!==A.value.stats.missingValueCount&&i.shell.info("Activity column contains missing values. They will be ignored during analysis")},A=o.input.column("Activity",{table:t,value:y,nullable:!1,onValueChanged:b,filter:t=>t.type===r.TYPE.INT||t.type===r.TYPE.FLOAT||t.type===r.TYPE.QNUM});A.setTooltip("Numerical activity column");const S=o.input.column("Clusters",{table:t,onValueChanged:t=>{t&&(E.value=!1,E.fireChanged())}});S.setTooltip("Optional. Clusters column is used to create Logo Summary Table"),S.nullable=!0;const E=o.input.bool("Generate clusters",{value:!0,onValueChanged:t=>{t&&(S.value=null,S.fireChanged())}});E.setTooltip("Generate clusters column based on MCL embeddings for Logo Summary Table"),A.fireChanged(),w.fireChanged(),E.fireChanged();const T=[A,w,S,E];null!==u&&T.splice(0,0,u);const x=o.input.float(h.t_.THRESHOLD,{value:n.threshold,nullable:!1,onValueChanged:t=>n.threshold=null!=t?t:n.threshold});x.setTooltip("Threshold for similarity between two sequences to create edges");const N=o.input.float(h.t_.INFLATION,{value:n.inflation,nullable:!1,onValueChanged:t=>n.inflation=null!=t?t:n.inflation});N.setTooltip("Inflation value for MCL algorithm");const _=o.input.int(h.t_.MAX_ITERATIONS,{value:n.maxIterations,nullable:!1,onValueChanged:t=>n.maxIterations=null!=t?t:n.maxIterations});_.setTooltip("Maximum iterations for MCL algorithm");const M=o.input.bool(h.t_.USE_WEBGPU,{value:n.useWebGPU,onValueChanged:t=>n.useWebGPU=t});M.enabled=!1,n.webGPUDescriptionPromise.then((()=>{n.webGPUDescription!==a.Ku?(M.setTooltip(`Use WebGPU for MCL algorithm (${n.webGPUDescription})`),M.enabled=!0):(M.setTooltip(a.Ku),M.enabled=!1,M.value=!1)}));const O=o.input.int(h.t_.MIN_CLUSTER_SIZE,{value:n.minClusterSize,nullable:!1,onValueChanged:t=>n.minClusterSize=null!=t?t:n.minClusterSize});O.setTooltip("Minimum cluster size for MCL algorithm");const I=o.input.choice(h.t_.DISTANCE_FUNCTION,{value:n.distanceF,items:[f.Z.NEEDLEMANN_WUNSCH,f.Z.MONOMER_CHEMICAL_DISTANCE,f.Z.HAMMING,f.Z.LEVENSHTEIN],nullable:!1,onValueChanged:t=>n.distanceF=t}),L=o.input.float(h.t_.GAP_OPEN,{value:n.gapOpen,onValueChanged:t=>n.gapOpen=null!=t?t:n.gapOpen}),P=o.input.float(h.t_.GAP_EXTEND,{value:n.gapExtend,onValueChanged:t=>n.gapExtend=null!=t?t:n.gapExtend}),R=[x,N,_,O,I,o.input.choice(h.t_.FINGERPRINT_TYPE,{value:n.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],nullable:!1,onValueChanged:t=>n.fingerprintType=t}),L,P,M],k=o.form(R);k.style.display="none";const V=o.icons.settings((()=>{k.style.display="none"===k.style.display?"flex":"none",k.classList.remove("ui-form-condensed")}),"Adjust clustering parameters");V.style.fontSize="16px",E.root.appendChild(V);const D=t.filter.onChanged.subscribe((()=>b())),F=()=>m(this,void 0,void 0,(function*(){var i,o;const r=null!=e?e:u.value;return D.unsubscribe(),!!r&&null!==(yield p(A.value,r,S.value,t,g,null!==(i=w.value)&&void 0!==i?i:s.rg.NONE,{addSequenceSpace:!1,addMCL:!0,useEmbeddingsClusters:null!==(o=E.value)&&void 0!==o&&o,mclSettings:n}))}));let G="auto";const U=[o.divV(T)];if(c()(U[0]).find("label").css("width","unset"),void 0!==e){const t=o.button("Launch SAR",F,"");t.style.alignSelf="center",U.push(t),G="215px"}return c()(l).empty().append(o.wait((()=>m(this,void 0,void 0,(function*(){var n;const i=yield t.plot.fromType("WebLogo",{sequenceColumnName:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:u.value.name});return i.root.style.setProperty("height","130px"),i.root}))))),{host:o.divV([l,o.splitH([o.splitV(U),C],{style:{height:G,minWidth:"500px",maxWidth:"600px"}}),k]),callback:F}}function p(t,e,n,o,u,c){return m(this,arguments,void 0,(function*(t,e,n,o,u,c,d={}){var f,h,m,g,p;let v=null;if(t.type!==r.COLUMN_TYPE.FLOAT&&t.type!==r.COLUMN_TYPE.INT&&t.type!==r.COLUMN_TYPE.QNUM)return i.shell.error("The activity column must be of numeric type!"),v;const y=r.TaskBarProgressIndicator.create("Loading SAR...");o.tags.delete&&o.tags.delete(".script");const C=o.columns,w=o.col(u.name);w&&(w.name=C.getUnusedName(w.name));const b=u.getRawData();o.columns.addNew(u.name,u.type).init((t=>b[t])),C.setOrder([u.name,e.name,...C.names().filter((t=>t!==e.name&&t!==u.name))]);const A={sequenceColumnName:e.name,activityColumnName:t.name,activityScaling:c,columns:{},showDendrogram:!1,showSequenceSpace:!1,sequenceSpaceParams:new a.GI(!!d.useEmbeddingsClusters&&!n),mclSettings:null!==(f=d.mclSettings)&&void 0!==f?f:new a.av};if(n){const t=o.getCol(n.name);t.type!==r.COLUMN_TYPE.STRING&&C.replace(t,t.convertTo(r.COLUMN_TYPE.STRING))}if(o.setTag(s.gp.SETTINGS,JSON.stringify(A)),v=l.i.getInstance(o),v.init(A),n){const i={clustersColumnName:n.name,sequenceColumnName:e.name,activityScaling:c,activityColumnName:t.name};yield v.addLogoSummaryTable(i)}if(yield v.addMonomerPosition(),yield v.addMostPotentResidues(),null!==(h=d.addSequenceSpace)&&void 0!==h&&h){if(yield v.addSequenceSpace({clusterCol:n,clusterEmbeddings:d.useEmbeddingsClusters}),!n&&null!==(m=d.useEmbeddingsClusters)&&void 0!==m&&m){const n=v._sequenceSpaceCols.find((t=>{var e;return v.df.col(t)&&(null===(e=v.df.col(t))||void 0===e?void 0:e.type)===r.COLUMN_TYPE.STRING}));if(n){const i={clustersColumnName:n,sequenceColumnName:e.name,activityScaling:c,activityColumnName:t.name};yield v.addLogoSummaryTable(i),setTimeout((()=>{var t,e;v&&(null===(t=null==v?void 0:v.findViewer(l.q.LOGO_SUMMARY_TABLE))||void 0===t?void 0:t.render)&&(null===(e=null==v?void 0:v.findViewer(l.q.LOGO_SUMMARY_TABLE))||void 0===e||e.render())}),100)}}}else if(null!==(g=d.addMCL)&&void 0!==g&&g&&(yield v.addMCLClusters(),!n&&null!==(p=d.useEmbeddingsClusters)&&void 0!==p&&p)){const n=v._mclCols.find((t=>(null==v?void 0:v.df.col(t))&&t.toLowerCase().startsWith("cluster")&&!t.toLowerCase().includes("size")));if(n){const i={clustersColumnName:n,sequenceColumnName:e.name,activityScaling:c,activityColumnName:t.name};yield v.addLogoSummaryTable(i),setTimeout((()=>{var t,e;v&&(null===(t=null==v?void 0:v.findViewer(l.q.LOGO_SUMMARY_TABLE))||void 0===t?void 0:t.render)&&(null===(e=null==v?void 0:v.findViewer(l.q.LOGO_SUMMARY_TABLE))||void 0===e||e.render())}),100)}}const S=v.df.plot.grid({rowSource:r.RowSet.Selected,selectedRowsColor:r.Color.fromHtml("#ffffff"),title:"Selection"}),E=null==v?void 0:v.findViewerNode(l.q.LOGO_SUMMARY_TABLE);return E&&v.analysisView.dockManager.dock(S,r.DOCK_TYPE.DOWN,E,"Selection",.4),y.close(),v}))}},5429:(t,e,n)=>{"use strict";n.d(e,{Av:()=>b,OH:()=>A,OO:()=>i,t_:()=>l});var i,o,r,s,a,l,u=n(7389),c=n(4328),d=n(6082),f=n(115),h=n(4139),m=n(768),g=n(7233),p=n.n(g),v=n(144),y=n.n(v),C=n(9995),w=n(1199);!function(t){t.GENERAL="General",t.VIEWERS="Viewers",t.COLUMNS="Columns",t.SEQUENCE_SPACE="Sequence space",t.MCL="MCL"}(i||(i={})),function(t){t.ACTIVITY="Activity",t.ACTIVITY_SCALING="Activity scaling"}(o||(o={})),function(t){t.DENDROGRAM="Dendrogram"}(r||(r={})),function(t){t.IS_INCLUDED="",t.AGGREGATION="Aggregation"}(s||(s={})),function(t){t.DISTANCE_FUNCTION="Distance Function",t.GAP_OPEN="Gap Open Penalty",t.GAP_EXTEND="Gap Extend Penalty",t.CLUSTER_EMBEDDINGS="Cluster Embeddings",t.EPSILON="Epsilon",t.MIN_PTS="Minimum Points",t.FINGERPRINT_TYPE="Fingerprint Type"}(a||(a={})),function(t){t.DISTANCE_FUNCTION="Distance Function",t.GAP_OPEN="Gap Open Penalty",t.GAP_EXTEND="Gap Extend Penalty",t.FINGERPRINT_TYPE="Fingerprint Type",t.THRESHOLD="Similarity Threshold",t.INFLATION="Inflation Factor",t.MAX_ITERATIONS="Max Iterations",t.USE_WEBGPU="Use WebGPU",t.MIN_CLUSTER_SIZE="Min Cluster Size"}(l||(l={}));const b={[i.GENERAL]:o,[i.VIEWERS]:r,[i.COLUMNS]:s,[i.SEQUENCE_SPACE]:a,[i.MCL]:l};function A(t){var e,n,r,g,v,b,A,S,E,T;null==t.settings&&c.log.error("PeptidesError: Settings are not initialized");const x=u.accordion(),N=t.settings,_=null!==(e=null==N?void 0:N.activityScaling)&&void 0!==e?e:h.rg.NONE,M=null!==(n=null==N?void 0:N.columns)&&void 0!==n?n:{},O={},I={},L=null!==(r=null==N?void 0:N.sequenceSpaceParams)&&void 0!==r?r:new f.GI,P=null!==(g=null==N?void 0:N.mclSettings)&&void 0!==g?g:new f.av,R=u.input.column(o.ACTIVITY,{table:t.df,value:t.df.getCol(t.settings.activityColumnName),onValueChanged:t=>{O.activityColumnName=t.name},filter:t=>(t.type===d.TYPE.FLOAT||t.type===d.TYPE.INT)&&t.name!==h.$2.ACTIVITY&&0===t.stats.missingValueCount});R.setTooltip("Numeric activity column");const k=u.input.choice(o.ACTIVITY_SCALING,{value:_,items:Object.values(h.rg),onValueChanged:t=>O.activityScaling=t});k.setTooltip("Activity column transformation method"),x.addPane(i.GENERAL,(()=>u.inputs([R,k])),!0),I[i.GENERAL]=[R,k];const V=y()(t.analysisView.viewers).some((t=>t.type===m.q.DENDROGRAM)),D=u.input.bool(m.q.DENDROGRAM,{value:null!=V&&V,onValueChanged:t=>O.showDendrogram=t}),F=u.input.bool(m.q.CLUSTER_MAX_ACTIVITY,{value:!!(null==N?void 0:N.showClusterMaxActivity),onValueChanged:t=>{O.showClusterMaxActivity=null!=t?t:void 0}}),G=u.input.bool("Sequence space",{value:!!(null==N?void 0:N.showSequenceSpace),onValueChanged:t=>{O.showSequenceSpace=null!=t?t:void 0,t?(ht.root.style.display="flex",(null==N?void 0:N.showSequenceSpace)||(O.sequenceSpaceParams=L)):(ht.root.style.display="none",delete O.sequenceSpaceParams),O.showSequenceSpace===(null==N?void 0:N.showSequenceSpace)&&delete O.showSequenceSpace}});F.setTooltip("Show cluster max activity viewer"),D.setTooltip("Show dendrogram viewer"),D.enabled=null!==(0,C.getTreeHelperInstance)(),x.addPane(i.VIEWERS,(()=>u.inputs([D,G,F])),!0),I[i.VIEWERS]=[D,G,F];const U=[],H=[];for(const e of t.df.columns.numerical){const t=e.name;if(t===N.activityColumnName||t===h.$2.ACTIVITY)continue;const n=u.input.bool(s.IS_INCLUDED,{value:void 0!==M[t],onValueChanged:e=>{var n;null!==(n=O.columns)&&void 0!==n||(O.columns={}),e?O.columns[t]=i.value:(delete O.columns[t],Object.keys(O.columns).length===Object.keys(M).length&&delete O.columns)}});n.setTooltip("Include aggregated column value in tooltips, Logo Summary Table and Distribution panel");const i=u.input.choice(s.AGGREGATION,{value:null!==(v=M[t])&&void 0!==v?v:d.AGG.AVG,items:Object.values(d.STATS),onValueChanged:i=>{var o;null!==(o=O.columns)&&void 0!==o||(O.columns={}),n.value?O.columns[t]=i:(delete O.columns[e.name],Object.keys(O.columns).length===Object.keys(M).length&&delete O.columns)}});i.setTooltip("Aggregation method"),p()(i.root).find("label").css("width","auto");const o=u.inputsRow(e.name,[n,i]);H.push(n,i),p()(o).find("div.ui-div").css("display","inline-flex"),U.push(o)}0!==U.length&&(x.addPane(i.COLUMNS,(()=>u.divV(U)),!1),I[i.COLUMNS]=H);const q={};function B(t,e){if(X(),null==e||""===e)return;q[t]=e;let n=!0;for(const[t,e]of Object.entries(q))if(e!==L[t]){n=!1;break}n?delete O.sequenceSpaceParams:O.sequenceSpaceParams=Object.assign(Object.assign({},L),q)}function Y(t,e){t.forEach((t=>{t.root.style.display=e?"flex":"none"}))}const $=u.input.choice(a.DISTANCE_FUNCTION,{value:L.distanceF,items:[w.Z.NEEDLEMANN_WUNSCH,w.Z.HAMMING,w.Z.LEVENSHTEIN,w.Z.MONOMER_CHEMICAL_DISTANCE],onValueChanged:t=>B("distanceF",t)});$.setTooltip("Distance function for sequences");const W=u.input.float(a.GAP_OPEN,{value:L.gapOpen,onValueChanged:t=>B("gapOpen",t)}),j=u.input.float(a.GAP_EXTEND,{value:L.gapExtend,onValueChanged:t=>B("gapExtend",t)}),z=u.input.bool(a.CLUSTER_EMBEDDINGS,{value:null!==(b=L.clusterEmbeddings)&&void 0!==b&&b,onValueChanged:t=>B("clusterEmbeddings",t)});z.setTooltip("Cluster embeddings using DBSCAN algorithm");const K=u.input.float(a.EPSILON,{value:L.epsilon,onValueChanged:t=>B("epsilon",t)});K.setTooltip("Epsilon parameter for DBSCAN. Minimum distance between two points to be considered as a cluster");const Q=u.input.int(a.MIN_PTS,{value:L.minPts,onValueChanged:t=>B("minPts",t)});Q.setTooltip("Minimum number of points in a cluster");const Z=u.input.choice(a.FINGERPRINT_TYPE,{value:L.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],onValueChanged:t=>B("fingerprintType",t)});function X(){Y([W,j],$.value===w.Z.NEEDLEMANN_WUNSCH),Y([K,Q],!0===z.value),Y([Z],$.value===w.Z.MONOMER_CHEMICAL_DISTANCE||$.value===w.Z.NEEDLEMANN_WUNSCH)}X();const J={};function tt(t,e){if(et(),null==e||""===e)return;J[t]=e;let n=!0;for(const[t,e]of Object.entries(J))if(e!==P[t]){n=!1;break}n?delete O.mclSettings:O.mclSettings=Object.assign(Object.assign({},P),J)}function et(){Y([it,ot],nt.value===w.Z.NEEDLEMANN_WUNSCH),Y([rt],nt.value===w.Z.MONOMER_CHEMICAL_DISTANCE||nt.value===w.Z.NEEDLEMANN_WUNSCH)}const nt=u.input.choice(l.DISTANCE_FUNCTION,{value:P.distanceF,items:[w.Z.NEEDLEMANN_WUNSCH,w.Z.MONOMER_CHEMICAL_DISTANCE,w.Z.HAMMING,w.Z.LEVENSHTEIN],onValueChanged:t=>tt("distanceF",t)}),it=u.input.float(l.GAP_OPEN,{value:P.gapOpen,onValueChanged:t=>tt("gapOpen",t)}),ot=u.input.float(l.GAP_EXTEND,{value:P.gapExtend,onValueChanged:t=>tt("gapExtend",t)}),rt=u.input.choice(l.FINGERPRINT_TYPE,{value:P.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],onValueChanged:t=>tt("fingerprintType",t)}),st=u.input.int(l.THRESHOLD,{value:null!==(A=P.threshold)&&void 0!==A?A:80,onValueChanged:t=>tt("threshold",t)}),at=u.input.int(l.MAX_ITERATIONS,{value:null!==(S=P.maxIterations)&&void 0!==S?S:5,onValueChanged:t=>tt("maxIterations",t)}),lt=u.input.float(l.INFLATION,{value:null!==(E=P.inflation)&&void 0!==E?E:1.4,onValueChanged:t=>{tt("inflation",t)}}),ut=u.input.bool(l.USE_WEBGPU,{value:P.useWebGPU,onValueChanged:t=>tt("useWebGPU",t)});ut.enabled=!1,P.webGPUDescriptionPromise.then((()=>{P.webGPUDescription!==f.Ku?(ut.setTooltip(`Use WebGPU for MCL algorithm (${P.webGPUDescription})`),ut.enabled=!0):(ut.setTooltip(f.Ku),ut.enabled=!1,ut.value=!1)}));const ct=u.input.int(l.MIN_CLUSTER_SIZE,{value:null!==(T=P.minClusterSize)&&void 0!==T?T:5,onValueChanged:t=>tt("minClusterSize",t)});et();const dt=[st,nt,rt,it,ot,lt,at,ct,ut];x.addPane(i.MCL,(()=>u.inputs(dt)),!0),I[i.MCL]=dt;const ft=[$,Z,W,j,z,K,Q],ht=x.addPane(i.SEQUENCE_SPACE,(()=>u.inputs(ft)),!0);I[i.SEQUENCE_SPACE]=ft,G.fireChanged();const mt=u.dialog("Peptides settings").add(x);return mt.root.style.width="400px",mt.onOK((()=>{t.settings=O})),mt.show(),{dialog:mt,accordion:x,inputs:I}}},144:function(t){var e;e=function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={exports:{},id:i,loaded:!1};return t[i].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e,n){"use strict";var i=n(1).default,o=n(39).default,r=n(52).default,s=n(40).default,a=n(54).default,l=n(80).default,u=n(84).default,c=n(65).default,d=t.exports=function(t){if(!m(t))throw new Error("wu: `"+t+"` is not iterable!");return new f(t)};function f(t){var e=g(t);this.next=e.next.bind(e)}d.prototype=f.prototype,d.prototype[r]=function(){return this};var h={},m=function(t){return t&&"function"==typeof t[r]},g=function(t){if(m(t))return s(t);throw new TypeError("Not iterable: "+t)},p=function(t,e){e.prototype=f.prototype,d[t]=e},v=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?e.length:arguments[2];return e.prototype=f.prototype,f.prototype[t]=e,n+=1,void(d[t]=d.curryable((function(){for(var e,n=arguments.length,i=Array(n),o=0;o<n;o++)i[o]=arguments[o];var r=i.pop();return(e=d(r))[t].apply(e,i)}),n))},y=function(t){return function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return d(t.call.apply(t,[this].concat(n)))}},C=function(t,e){return p(t,y(e))},w=function(t,e,n){return v(t,y(e),n)};p("curryable",(function(t){var e=arguments.length<=1||void 0===arguments[1]?t.length:arguments[1];return function n(){for(var o=arguments.length,r=Array(o),s=0;s<o;s++)r[s]=arguments[s];return r.length>=e?t.apply(this,r):function(t,e){return function(){for(var n=arguments.length,o=Array(n),r=0;r<n;r++)o[r]=arguments[r];return t.call.apply(t,[this].concat(i(e),o))}}(n,r)}})),C("entries",a.mark((function t(e){var n,i,o,r,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,o=void 0,t.prev=3,r=s(l(e));case 5:if(n=(u=r.next()).done){t.next=12;break}return c=u.value,t.next=9,[c,e[c]];case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),i=!0,o=t.t0;case 18:t.prev=18,t.prev=19,!n&&r.return&&r.return();case 21:if(t.prev=21,!i){t.next=24;break}throw o;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),C("keys",a.mark((function t(e){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(l(e),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),C("values",a.mark((function t(e){var n,i,o,r,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,o=void 0,t.prev=3,r=s(l(e));case 5:if(n=(u=r.next()).done){t.next=12;break}return c=u.value,t.next=9,e[c];case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),i=!0,o=t.t0;case 18:t.prev=18,t.prev=19,!n&&r.return&&r.return();case 21:if(t.prev=21,!i){t.next=24;break}throw o;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("cycle",a.mark((function t(){var e,n,i,o,r,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],n=!0,i=!1,o=void 0,t.prev=4,r=s(this);case 6:if(n=(l=r.next()).done){t.next=14;break}return u=l.value,t.next=10,u;case 10:e.push(u);case 11:n=!0,t.next=6;break;case 14:t.next=20;break;case 16:t.prev=16,t.t0=t.catch(4),i=!0,o=t.t0;case 20:t.prev=20,t.prev=21,!n&&r.return&&r.return();case 23:if(t.prev=23,!i){t.next=26;break}throw o;case 26:return t.finish(23);case 27:return t.finish(20);case 28:if(!e){t.next=32;break}return t.delegateYield(e,"t1",30);case 30:t.next=28;break;case 32:case"end":return t.stop()}}),t,this,[[4,16,20,28],[21,,23,27]])}))),C("count",a.mark((function t(){var e,n=arguments.length<=0||void 0===arguments[0]?0:arguments[0],i=arguments.length<=1||void 0===arguments[1]?1:arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=n;case 1:return t.next=4,e;case 4:e+=i,t.next=1;break;case 7:case"end":return t.stop()}}),t,this)}))),C("repeat",a.mark((function t(e){var n,i=arguments.length<=1||void 0===arguments[1]?1/0:arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i!==1/0){t.next=8;break}case 1:return t.next=4,e;case 4:t.next=1;break;case 6:t.next=15;break;case 8:n=0;case 9:if(!(n<i)){t.next=15;break}return t.next=12,e;case 12:n++,t.next=9;break;case 15:case"end":return t.stop()}}),t,this)}))),C("chain",a.mark((function t(){var e,n,i,o,r,l,u,c,d,f=arguments;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(e=!0,n=!1,i=void 0,t.prev=3,o=f.length,r=Array(o),l=0;l<o;l++)r[l]=f[l];u=s(r);case 6:if(e=(c=u.next()).done){t.next=12;break}return d=c.value,t.delegateYield(d,"t0",9);case 9:e=!0,t.next=6;break;case 12:t.next=18;break;case 14:t.prev=14,t.t1=t.catch(3),n=!0,i=t.t1;case 18:t.prev=18,t.prev=19,!e&&u.return&&u.return();case 21:if(t.prev=21,!n){t.next=24;break}throw i;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("chunk",a.mark((function t(){var e,n,i,o,r,l,u,c,d=arguments.length<=0||void 0===arguments[0]?2:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],n=0,i=!0,o=!1,r=void 0,t.prev=5,l=s(this);case 7:if(i=(u=l.next()).done){t.next=18;break}if(c=u.value,e[n++]=c,n!==d){t.next=15;break}return t.next=13,e;case 13:e=[],n=0;case 15:i=!0,t.next=7;break;case 18:t.next=24;break;case 20:t.prev=20,t.t0=t.catch(5),o=!0,r=t.t0;case 24:t.prev=24,t.prev=25,!i&&l.return&&l.return();case 27:if(t.prev=27,!o){t.next=30;break}throw r;case 30:return t.finish(27);case 31:return t.finish(24);case 32:if(!n){t.next=35;break}return t.next=35,e;case 35:case"end":return t.stop()}}),t,this,[[5,20,24,32],[25,,27,31]])})),1),w("concatMap",a.mark((function t(e){var n,i,o,r,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,o=void 0,t.prev=3,r=s(this);case 5:if(n=(l=r.next()).done){t.next=11;break}return u=l.value,t.delegateYield(e(u),"t0",8);case 8:n=!0,t.next=5;break;case 11:t.next=17;break;case 13:t.prev=13,t.t1=t.catch(3),i=!0,o=t.t1;case 17:t.prev=17,t.prev=18,!n&&r.return&&r.return();case 20:if(t.prev=20,!i){t.next=23;break}throw o;case 23:return t.finish(20);case 24:return t.finish(17);case 25:case"end":return t.stop()}}),t,this,[[3,13,17,25],[18,,20,24]])}))),w("drop",a.mark((function t(e){var n,i,o,r,l,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=0,i=!0,o=!1,r=void 0,t.prev=4,l=s(this);case 6:if(i=(u=l.next()).done){t.next=16;break}if(c=u.value,!(n++<e)){t.next=10;break}return t.abrupt("continue",13);case 10:return t.next=12,c;case 12:return t.abrupt("break",16);case 13:i=!0,t.next=6;break;case 16:t.next=22;break;case 18:t.prev=18,t.t0=t.catch(4),o=!0,r=t.t0;case 22:t.prev=22,t.prev=23,!i&&l.return&&l.return();case 25:if(t.prev=25,!o){t.next=28;break}throw r;case 28:return t.finish(25);case 29:return t.finish(22);case 30:return t.delegateYield(this,"t1",31);case 31:case"end":return t.stop()}}),t,this,[[4,18,22,30],[23,,25,29]])}))),w("dropWhile",a.mark((function t(){var e,n,i,o,r,l,u=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,o=s(this);case 5:if(e=(r=o.next()).done){t.next=15;break}if(l=r.value,!u(l)){t.next=9;break}return t.abrupt("continue",12);case 9:return t.next=11,l;case 11:return t.abrupt("break",15);case 12:e=!0,t.next=5;break;case 15:t.next=21;break;case 17:t.prev=17,t.t0=t.catch(3),n=!0,i=t.t0;case 21:t.prev=21,t.prev=22,!e&&o.return&&o.return();case 24:if(t.prev=24,!n){t.next=27;break}throw i;case 27:return t.finish(24);case 28:return t.finish(21);case 29:return t.delegateYield(this,"t1",30);case 30:case"end":return t.stop()}}),t,this,[[3,17,21,29],[22,,24,28]])})),1),w("enumerate",a.mark((function t(){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(b([this,d.count()]),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),w("filter",a.mark((function t(){var e,n,i,o,r,l,u=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,o=s(this);case 5:if(e=(r=o.next()).done){t.next=13;break}if(l=r.value,!u(l)){t.next=10;break}return t.next=10,l;case 10:e=!0,t.next=5;break;case 13:t.next=19;break;case 15:t.prev=15,t.t0=t.catch(3),n=!0,i=t.t0;case 19:t.prev=19,t.prev=20,!e&&o.return&&o.return();case 22:if(t.prev=22,!n){t.next=25;break}throw i;case 25:return t.finish(22);case 26:return t.finish(19);case 27:case"end":return t.stop()}}),t,this,[[3,15,19,27],[20,,22,26]])})),1),w("flatten",a.mark((function t(){var e,n,i,o,r,l,u=!(arguments.length<=0||void 0===arguments[0])&&arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,o=s(this);case 5:if(e=(r=o.next()).done){t.next=16;break}if("string"==typeof(l=r.value)||!m(l)){t.next=11;break}return t.delegateYield(u?l:d(l).flatten(),"t0",9);case 9:t.next=13;break;case 11:return t.next=13,l;case 13:e=!0,t.next=5;break;case 16:t.next=22;break;case 18:t.prev=18,t.t1=t.catch(3),n=!0,i=t.t1;case 22:t.prev=22,t.prev=23,!e&&o.return&&o.return();case 25:if(t.prev=25,!n){t.next=28;break}throw i;case 28:return t.finish(25);case 29:return t.finish(22);case 30:case"end":return t.stop()}}),t,this,[[3,18,22,30],[23,,25,29]])})),1),w("invoke",a.mark((function t(e){var n,i,o,r,l,u,c,d,f,h=arguments;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n=!0,i=!1,o=void 0,t.prev=3,r=h.length,l=Array(r>1?r-1:0),u=1;u<r;u++)l[u-1]=h[u];c=s(this);case 6:if(n=(d=c.next()).done){t.next=13;break}return f=d.value,t.next=10,f[e].apply(f,l);case 10:n=!0,t.next=6;break;case 13:t.next=19;break;case 15:t.prev=15,t.t0=t.catch(3),i=!0,o=t.t0;case 19:t.prev=19,t.prev=20,!n&&c.return&&c.return();case 22:if(t.prev=22,!i){t.next=25;break}throw o;case 25:return t.finish(22);case 26:return t.finish(19);case 27:case"end":return t.stop()}}),t,this,[[3,15,19,27],[20,,22,26]])}))),w("map",a.mark((function t(e){var n,i,o,r,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,o=void 0,t.prev=3,r=s(this);case 5:if(n=(l=r.next()).done){t.next=12;break}return u=l.value,t.next=9,e(u);case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),i=!0,o=t.t0;case 18:t.prev=18,t.prev=19,!n&&r.return&&r.return();case 21:if(t.prev=21,!i){t.next=24;break}throw o;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("pluck",a.mark((function t(e){var n,i,o,r,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,o=void 0,t.prev=3,r=s(this);case 5:if(n=(l=r.next()).done){t.next=12;break}return u=l.value,t.next=9,u[e];case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),i=!0,o=t.t0;case 18:t.prev=18,t.prev=19,!n&&r.return&&r.return();case 21:if(t.prev=21,!i){t.next=24;break}throw o;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("reductions",a.mark((function t(e){var n,i,o,r,l,u,c,d,f,h,m,g,p=arguments.length<=1||void 0===arguments[1]?void 0:arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==(n=p)){t.next=28;break}i=!0,o=!1,r=void 0,t.prev=5,l=s(this);case 7:if(i=(u=l.next()).done){t.next=14;break}return c=u.value,n=c,t.abrupt("break",14);case 11:i=!0,t.next=7;break;case 14:t.next=20;break;case 16:t.prev=16,t.t0=t.catch(5),o=!0,r=t.t0;case 20:t.prev=20,t.prev=21,!i&&l.return&&l.return();case 23:if(t.prev=23,!o){t.next=26;break}throw r;case 26:return t.finish(23);case 27:return t.finish(20);case 28:return t.next=30,n;case 30:d=!0,f=!1,h=void 0,t.prev=33,m=s(this);case 35:if(d=(g=m.next()).done){t.next=42;break}return c=g.value,t.next=39,n=e(n,c);case 39:d=!0,t.next=35;break;case 42:t.next=48;break;case 44:t.prev=44,t.t1=t.catch(33),f=!0,h=t.t1;case 48:t.prev=48,t.prev=49,!d&&m.return&&m.return();case 51:if(t.prev=51,!f){t.next=54;break}throw h;case 54:return t.finish(51);case 55:return t.finish(48);case 56:return t.abrupt("return",n);case 57:case"end":return t.stop()}}),t,this,[[5,16,20,28],[21,,23,27],[33,44,48,56],[49,,51,55]])})),2),w("reject",a.mark((function t(){var e,n,i,o,r,l,u=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,o=s(this);case 5:if(e=(r=o.next()).done){t.next=13;break}if(l=r.value,u(l)){t.next=10;break}return t.next=10,l;case 10:e=!0,t.next=5;break;case 13:t.next=19;break;case 15:t.prev=15,t.t0=t.catch(3),n=!0,i=t.t0;case 19:t.prev=19,t.prev=20,!e&&o.return&&o.return();case 22:if(t.prev=22,!n){t.next=25;break}throw i;case 25:return t.finish(22);case 26:return t.finish(19);case 27:case"end":return t.stop()}}),t,this,[[3,15,19,27],[20,,22,26]])})),1),w("slice",a.mark((function t(){var e,n,i,r,l,u,c,d,f=arguments.length<=0||void 0===arguments[0]?0:arguments[0],h=arguments.length<=1||void 0===arguments[1]?1/0:arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(h<f)){t.next=2;break}throw new RangeError("parameter `stop` (= "+h+") must be >= `start` (= "+f+")");case 2:e=!0,n=!1,i=void 0,t.prev=5,r=s(this.enumerate());case 7:if(e=(l=r.next()).done){t.next=20;break}if(u=o(l.value,2),c=u[0],!((d=u[1])<f)){t.next=13;break}return t.abrupt("continue",17);case 13:if(!(d>=h)){t.next=15;break}return t.abrupt("break",20);case 15:return t.next=17,c;case 17:e=!0,t.next=7;break;case 20:t.next=26;break;case 22:t.prev=22,t.t0=t.catch(5),n=!0,i=t.t0;case 26:t.prev=26,t.prev=27,!e&&r.return&&r.return();case 29:if(t.prev=29,!n){t.next=32;break}throw i;case 32:return t.finish(29);case 33:return t.finish(26);case 34:case"end":return t.stop()}}),t,this,[[5,22,26,34],[27,,29,33]])})),2),w("spreadMap",a.mark((function t(e){var n,o,r,l,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,o=!1,r=void 0,t.prev=3,l=s(this);case 5:if(n=(u=l.next()).done){t.next=12;break}return c=u.value,t.next=9,e.apply(void 0,i(c));case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),o=!0,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&l.return&&l.return();case 21:if(t.prev=21,!o){t.next=24;break}throw r;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("take",a.mark((function t(e){var n,i,o,r,l,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e<1)){t.next=2;break}return t.abrupt("return");case 2:n=0,i=!0,o=!1,r=void 0,t.prev=6,l=s(this);case 8:if(i=(u=l.next()).done){t.next=17;break}return c=u.value,t.next=12,c;case 12:if(!(++n>=e)){t.next=14;break}return t.abrupt("break",17);case 14:i=!0,t.next=8;break;case 17:t.next=23;break;case 19:t.prev=19,t.t0=t.catch(6),o=!0,r=t.t0;case 23:t.prev=23,t.prev=24,!i&&l.return&&l.return();case 26:if(t.prev=26,!o){t.next=29;break}throw r;case 29:return t.finish(26);case 30:return t.finish(23);case 31:case"end":return t.stop()}}),t,this,[[6,19,23,31],[24,,26,30]])}))),w("takeWhile",a.mark((function t(){var e,n,i,o,r,l,u=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,o=s(this);case 5:if(e=(r=o.next()).done){t.next=14;break}if(l=r.value,u(l)){t.next=9;break}return t.abrupt("break",14);case 9:return t.next=11,l;case 11:e=!0,t.next=5;break;case 14:t.next=20;break;case 16:t.prev=16,t.t0=t.catch(3),n=!0,i=t.t0;case 20:t.prev=20,t.prev=21,!e&&o.return&&o.return();case 23:if(t.prev=23,!n){t.next=26;break}throw i;case 26:return t.finish(23);case 27:return t.finish(20);case 28:case"end":return t.stop()}}),t,this,[[3,16,20,28],[21,,23,27]])})),1),w("tap",a.mark((function t(){var e,n,i,o,r,l,u=arguments.length<=0||void 0===arguments[0]?console.log.bind(console):arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,o=s(this);case 5:if(e=(r=o.next()).done){t.next=13;break}return l=r.value,u(l),t.next=10,l;case 10:e=!0,t.next=5;break;case 13:t.next=19;break;case 15:t.prev=15,t.t0=t.catch(3),n=!0,i=t.t0;case 19:t.prev=19,t.prev=20,!e&&o.return&&o.return();case 22:if(t.prev=22,!n){t.next=25;break}throw i;case 25:return t.finish(22);case 26:return t.finish(19);case 27:case"end":return t.stop()}}),t,this,[[3,15,19,27],[20,,22,26]])})),1),w("unique",a.mark((function t(){var e,n,i,o,r,l,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=new u,n=!0,i=!1,o=void 0,t.prev=4,r=s(this);case 6:if(n=(l=r.next()).done){t.next=15;break}if(c=l.value,e.has(c)){t.next=12;break}return t.next=11,c;case 11:e.add(c);case 12:n=!0,t.next=6;break;case 15:t.next=21;break;case 17:t.prev=17,t.t0=t.catch(4),i=!0,o=t.t0;case 21:t.prev=21,t.prev=22,!n&&r.return&&r.return();case 24:if(t.prev=24,!i){t.next=27;break}throw o;case 27:return t.finish(24);case 28:return t.finish(21);case 29:e.clear();case 30:case"end":return t.stop()}}),t,this,[[4,17,21,29],[22,,24,28]])})));var b=y(a.mark((function t(e){var n,i,o,r,l,u,c,d,f,h,m,p,v,y=!(arguments.length<=1||void 0===arguments[1])&&arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.length){t.next=2;break}return t.abrupt("return");case 2:n=e.map(g),i=e.length,o=0,r=!1;case 6:if(r){t.next=44;break}l=[],u=!0,c=!1,d=void 0,t.prev=11,f=s(n);case 13:if(u=(h=f.next()).done){t.next=26;break}if(m=h.value,p=m.next(),v=p.value,!p.done){t.next=22;break}if(y){t.next=21;break}return t.abrupt("return");case 21:++o==i&&(r=!0);case 22:void 0===v?l.length++:l.push(v);case 23:u=!0,t.next=13;break;case 26:t.next=32;break;case 28:t.prev=28,t.t0=t.catch(11),c=!0,d=t.t0;case 32:t.prev=32,t.prev=33,!u&&f.return&&f.return();case 35:if(t.prev=35,!c){t.next=38;break}throw d;case 38:return t.finish(35);case 39:return t.finish(32);case 40:return t.next=42,l;case 42:t.next=6;break;case 44:case"end":return t.stop()}}),t,this,[[11,28,32,40],[33,,35,39]])})));C("zip",a.mark((function t(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(b(n),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),C("zipLongest",a.mark((function t(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(b(n,!0),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),C("zipWith",a.mark((function t(e){for(var n=arguments.length,i=Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(b(i).spreadMap(e),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),d.MAX_BLOCK=15,d.TIMEOUT=1,v("asyncEach",(function(t){var e=arguments.length<=1||void 0===arguments[1]?d.MAX_BLOCK:arguments[1],n=arguments.length<=2||void 0===arguments[2]?d.TIMEOUT:arguments[2],i=g(this);return new c((function(o,r){!function a(){var l=Date.now(),u=!0,c=!1,d=void 0;try{for(var f,h=s(i);!(u=(f=h.next()).done);u=!0){var m=f.value;try{t(m)}catch(t){return void r(t)}if(Date.now()-l>e)return void setTimeout(a,n)}}catch(t){c=!0,d=t}finally{try{!u&&h.return&&h.return()}finally{if(c)throw d}}o()}()}))}),3),v("every",(function(){var t=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0],e=!0,n=!1,i=void 0;try{for(var o,r=s(this);!(e=(o=r.next()).done);e=!0)if(!t(o.value))return!1}catch(t){n=!0,i=t}finally{try{!e&&r.return&&r.return()}finally{if(n)throw i}}return!0}),1),v("find",(function(t){var e=!0,n=!1,i=void 0;try{for(var o,r=s(this);!(e=(o=r.next()).done);e=!0){var a=o.value;if(t(a))return a}}catch(t){n=!0,i=t}finally{try{!e&&r.return&&r.return()}finally{if(n)throw i}}})),v("forEach",(function(t){var e=!0,n=!1,i=void 0;try{for(var o,r=s(this);!(e=(o=r.next()).done);e=!0)t(o.value)}catch(t){n=!0,i=t}finally{try{!e&&r.return&&r.return()}finally{if(n)throw i}}})),v("has",(function(t){return this.some((function(e){return e===t}))})),v("reduce",(function(t){var e=arguments.length<=1||void 0===arguments[1]?void 0:arguments[1];if(void 0===e){var n=!0,i=!1,o=void 0;try{for(var r,a=s(this);!(n=(r=a.next()).done);n=!0){e=r.value;break}}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}}var l=!0,u=!1,c=void 0;try{for(var d,f=s(this);!(l=(d=f.next()).done);l=!0)e=t(e,d.value)}catch(t){u=!0,c=t}finally{try{!l&&f.return&&f.return()}finally{if(u)throw c}}return e}),2),v("some",(function(){var t=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0],e=!0,n=!1,i=void 0;try{for(var o,r=s(this);!(e=(o=r.next()).done);e=!0)if(t(o.value))return!0}catch(t){n=!0,i=t}finally{try{!e&&r.return&&r.return()}finally{if(n)throw i}}return!1}),1),v("toArray",(function(){return[].concat(i(this))}));var A=y(a.mark((function t(e,n){var i,o,r,s,l;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=n.items,o=0;case 2:if(o!==i.length){t.next=14;break}if(r=e.next(),s=r.done,l=r.value,!s){t.next=10;break}return n.returned===h&&(n.returned=l),t.abrupt("break",25);case 10:return t.next=12,i[o++]=l;case 12:t.next=23;break;case 14:if(o!==n.tail){t.next=21;break}return l=i[o],500===o?(i=n.items=i.slice(o),o=0,n.tail=0):(i[o]=void 0,n.tail=++o),t.next=19,l;case 19:t.next=23;break;case 21:return t.next=23,i[o++];case 23:t.next=2;break;case 25:return n.tail===o&&(i.length=0),t.abrupt("return",n.returned);case 27:case"end":return t.stop()}}),t,this)})));A.prototype=f.prototype,v("tee",(function(){for(var t=arguments.length<=0||void 0===arguments[0]?2:arguments[0],e=new Array(t),n={tail:0,items:[],returned:h};t--;)e[t]=A(this,n);return e}),1),v("unzip",(function(){var t=arguments.length<=0||void 0===arguments[0]?2:arguments[0];return this.tee(t).map((function(t,e){return t.pluck(e)}))}),1),d.tang={clan:36}},function(t,e,n){"use strict";var i=n(2).default;e.default=function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return i(t)},e.__esModule=!0},function(t,e,n){t.exports={default:n(3),__esModule:!0}},function(t,e,n){n(4),n(26),t.exports=n(12).Array.from},function(t,e,n){"use strict";var i=n(5)(!0);n(8)(String,"String",(function(t){this._t=String(t),this._i=0}),(function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=i(e,n),this._i+=t.length,{value:t,done:!1})}))},function(t,e,n){var i=n(6),o=n(7);t.exports=function(t){return function(e,n){var r,s,a=String(o(e)),l=i(n),u=a.length;return l<0||l>=u?t?"":void 0:(r=a.charCodeAt(l))<55296||r>56319||l+1===u||(s=a.charCodeAt(l+1))<56320||s>57343?t?a.charAt(l):r:t?a.slice(l,l+2):s-56320+(r-55296<<10)+65536}}},function(t,e){var n=Math.ceil,i=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?i:n)(t)}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){"use strict";var i=n(9),o=n(10),r=n(13),s=n(14),a=n(19),l=n(20)("iterator"),u=n(23),c=!([].keys&&"next"in[].keys()),d="@@iterator",f="keys",h="values",m=function(){return this};t.exports=function(t,e,g,p,v,y,C){n(24)(g,e,p);var w,b,A=function(t){switch(t){case f:case h:return function(){return new g(this,t)}}return function(){return new g(this,t)}},S=e+" Iterator",E=t.prototype,T=E[l]||E[d]||v&&E[v],x=T||A(v);if(T){var N=n(15).getProto(x.call(new t));n(25)(N,S,!0),!i&&a(E,d)&&s(N,l,m)}if(i&&!C||s(E,l,x),u[e]=x,u[S]=m,v)if(w={keys:y?x:A(f),values:v==h?x:A(h),entries:v!=h?x:A("entries")},C)for(b in w)b in E||r(E,b,w[b]);else o(o.P+o.F*c,e,w)}},function(t,e){t.exports=!0},function(t,e,n){var i=n(11),o=n(12),r="prototype",s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e,n){var l,u,c,d,f=t&a.G,h=t&a.P,m=f?i:t&a.S?i[e]:(i[e]||{})[r],g=f?o:o[e]||(o[e]={});for(l in f&&(n=e),n)(u=!(t&a.F)&&m&&l in m)&&l in g||(c=u?m[l]:n[l],f&&"function"!=typeof m[l]?d=n[l]:t&a.B&&u?d=s(c,i):t&a.W&&m[l]==c?function(t){(d=function(e){return this instanceof t?new t(e):t(e)})[r]=t[r]}(c):d=h&&"function"==typeof c?s(Function.call,c):c,g[l]=d,h&&((g[r]||(g[r]={}))[l]=c))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,t.exports=a},function(t,e){var n="undefined",i=t.exports=typeof window!=n&&window.Math==Math?window:typeof self!=n&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},function(t,e){var n=t.exports={version:"1.2.0"};"number"==typeof __e&&(__e=n)},function(t,e,n){t.exports=n(14)},function(t,e,n){var i=n(15),o=n(16);t.exports=n(17)?function(t,e,n){return i.setDesc(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e){var n=Object;t.exports={create:n.create,getProto:n.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:n.getOwnPropertyDescriptor,setDesc:n.defineProperty,setDescs:n.defineProperties,getKeys:n.keys,getNames:n.getOwnPropertyNames,getSymbols:n.getOwnPropertySymbols,each:[].forEach}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){t.exports=!n(18)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var i=n(21)("wks"),o=n(11).Symbol;t.exports=function(t){return i[t]||(i[t]=o&&o[t]||(o||n(22))("Symbol."+t))}},function(t,e,n){var i=n(11),o="__core-js_shared__",r=i[o]||(i[o]={});t.exports=function(t){return r[t]||(r[t]={})}},function(t,e){var n=0,i=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+i).toString(36))}},function(t,e){t.exports={}},function(t,e,n){"use strict";var i=n(15),o={};n(14)(o,n(20)("iterator"),(function(){return this})),t.exports=function(t,e,r){t.prototype=i.create(o,{next:n(16)(1,r)}),n(25)(t,e+" Iterator")}},function(t,e,n){var i=n(19),o=n(14),r=n(20)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,r)&&o(t,r,e)}},function(t,e,n){"use strict";var i=n(27),o=n(10),r=n(29),s=n(30),a=n(33),l=n(34),u=n(35);o(o.S+o.F*!n(38)((function(t){Array.from(t)})),"Array",{from:function(t){var e,n,o,c,d=r(t),f="function"==typeof this?this:Array,h=arguments[1],m=void 0!==h,g=0,p=u(d);if(m&&(h=i(h,arguments[2],2)),null==p||f==Array&&a(p))for(n=new f(e=l(d.length));e>g;g++)n[g]=m?h(d[g],g):d[g];else for(c=p.call(d),n=new f;!(o=c.next()).done;g++)n[g]=m?s(c,h,[o.value,g],!0):o.value;return n.length=g,n}})},function(t,e,n){var i=n(28);t.exports=function(t,e,n){if(i(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,o){return t.call(e,n,i,o)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var i=n(7);t.exports=function(t){return Object(i(t))}},function(t,e,n){var i=n(31);t.exports=function(t,e,n,o){try{return o?e(i(n)[0],n[1]):e(n)}catch(e){var r=t.return;throw void 0!==r&&i(r.call(t)),e}}},function(t,e,n){var i=n(32);t.exports=function(t){if(!i(t))throw TypeError(t+" is not an object!");return t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){var i=n(23),o=n(20)("iterator");t.exports=function(t){return(i.Array||Array.prototype[o])===t}},function(t,e,n){var i=n(6),o=Math.min;t.exports=function(t){return t>0?o(i(t),9007199254740991):0}},function(t,e,n){var i=n(36),o=n(20)("iterator"),r=n(23);t.exports=n(12).getIteratorMethod=function(t){if(null!=t)return t[o]||t["@@iterator"]||r[i(t)]}},function(t,e,n){var i=n(37),o=n(20)("toStringTag"),r="Arguments"==i(function(){return arguments}());t.exports=function(t){var e,n,s;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=(e=Object(t))[o])?n:r?i(e):"Object"==(s=i(e))&&"function"==typeof e.callee?"Arguments":s}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var i=n(20)("iterator"),o=!1;try{var r=[7][i]();r.return=function(){o=!0},Array.from(r,(function(){throw 2}))}catch(t){}t.exports=function(t){if(!o)return!1;var e=!1;try{var n=[7],r=n[i]();r.next=function(){e=!0},n[i]=function(){return r},t(n)}catch(t){}return e}},function(t,e,n){"use strict";var i=n(40).default,o=n(49).default;e.default=function(t,e){if(Array.isArray(t))return t;if(o(Object(t)))return function(t,e){var n=[],o=!0,r=!1,s=void 0;try{for(var a,l=i(t);!(o=(a=l.next()).done)&&(n.push(a.value),!e||n.length!==e);o=!0);}catch(t){r=!0,s=t}finally{try{!o&&l.return&&l.return()}finally{if(r)throw s}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},e.__esModule=!0},function(t,e,n){t.exports={default:n(41),__esModule:!0}},function(t,e,n){n(42),n(4),t.exports=n(48)},function(t,e,n){n(43);var i=n(23);i.NodeList=i.HTMLCollection=i.Array},function(t,e,n){"use strict";var i=n(44),o=n(45),r=n(23),s=n(46);n(8)(Array,"Array",(function(t,e){this._t=s(t),this._i=0,this._k=e}),(function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,o(1)):o(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])}),"values"),r.Arguments=r.Array,i("keys"),i("values"),i("entries")},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){var i=n(47),o=n(7);t.exports=function(t){return i(o(t))}},function(t,e,n){var i=n(37);t.exports=0 in Object("z")?Object:function(t){return"String"==i(t)?t.split(""):Object(t)}},function(t,e,n){var i=n(31),o=n(35);t.exports=n(12).getIterator=function(t){var e=o(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return i(e.call(t))}},function(t,e,n){t.exports={default:n(50),__esModule:!0}},function(t,e,n){n(42),n(4),t.exports=n(51)},function(t,e,n){var i=n(36),o=n(20)("iterator"),r=n(23);t.exports=n(12).isIterable=function(t){var e=Object(t);return o in e||"@@iterator"in e||r.hasOwnProperty(i(e))}},function(t,e,n){t.exports={default:n(53),__esModule:!0}},function(t,e,n){n(4),n(42),t.exports=n(20)("iterator")},function(t,e,n){(function(e){var i="object"==typeof e?e:"object"==typeof window?window:"object"==typeof self?self:this,o=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,r=o&&i.regeneratorRuntime;if(i.regeneratorRuntime=void 0,t.exports=n(55),o)i.regeneratorRuntime=r;else try{delete i.regeneratorRuntime}catch(t){i.regeneratorRuntime=void 0}t.exports={default:t.exports,__esModule:!0}}).call(e,function(){return this}())},function(t,e,n){(function(e,i){"use strict";var o=n(57).default,r=n(52).default,s=n(63).default,a=n(65).default;!function(e){var n,l=Object.prototype.hasOwnProperty,u="function"==typeof o&&r||"@@iterator",c="object"==typeof t,d=e.regeneratorRuntime;if(d)c&&(t.exports=d);else{(d=e.regeneratorRuntime=c?t.exports:{}).wrap=y;var f="suspendedStart",h="suspendedYield",m="executing",g="completed",p={},v=A.prototype=w.prototype;b.prototype=v.constructor=A,A.constructor=b,b.displayName="GeneratorFunction",d.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},d.mark=function(t){return t.__proto__=A,t.prototype=s(v),t},d.awrap=function(t){return new E(t)},S(T.prototype),d.async=function(t,e,n,i){var o=new T(y(t,e,n,i));return d.isGeneratorFunction(e)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},S(v),v[u]=function(){return this},v.toString=function(){return"[object Generator]"},d.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var i=e.pop();if(i in t)return n.value=i,n.done=!1,n}return n.done=!0,n}},d.values=M,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=n,this.done=!1,this.delegate=null,this.tryEntries.forEach(N),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,i){return r.type="throw",r.arg=t,e.next=n,!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=l.call(o,"catchLoc"),a=l.call(o,"finallyLoc");if(s&&a){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&l.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=t,r.arg=e,o?this.next=o.finallyLoc:this.complete(r),p},complete:function(t,e){if("throw"===t.type)throw t.arg;"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=t.arg,this.next="end"):"normal"===t.type&&e&&(this.next=e)},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),N(n),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var o=i.arg;N(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:M(t),resultName:e,nextLoc:n},p}}}function y(t,e,i,o){var r=s((e||w).prototype);return r._invoke=function(t,e,i){var o=f;return function(r,s){if(o===m)throw new Error("Generator is already running");if(o===g){if("throw"===r)throw s;return O()}for(;;){var a=i.delegate;if(a){if("return"===r||"throw"===r&&a.iterator[r]===n){i.delegate=null;var l=a.iterator.return;if(l&&"throw"===(u=C(l,a.iterator,s)).type){r="throw",s=u.arg;continue}if("return"===r)continue}var u;if("throw"===(u=C(a.iterator[r],a.iterator,s)).type){i.delegate=null,r="throw",s=u.arg;continue}if(r="next",s=n,!(c=u.arg).done)return o=h,c;i[a.resultName]=c.value,i.next=a.nextLoc,i.delegate=null}if("next"===r)i.sent=o===h?s:n;else if("throw"===r){if(o===f)throw o=g,s;i.dispatchException(s)&&(r="next",s=n)}else"return"===r&&i.abrupt("return",s);if(o=m,"normal"===(u=C(t,e,i)).type){o=i.done?g:h;var c={value:u.arg,done:i.done};if(u.arg!==p)return c;i.delegate&&"next"===r&&(s=n)}else"throw"===u.type&&(o=g,r="throw",s=u.arg)}}}(t,i||null,new _(o||[])),r}function C(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function w(){}function b(){}function A(){}function S(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function E(t){this.arg=t}function T(t){function e(e,n){var i=t[e](n),s=i.value;return s instanceof E?a.resolve(s.arg).then(o,r):a.resolve(s).then((function(t){return i.value=t,i}))}"object"==typeof i&&i.domain&&(e=i.domain.bind(e));var n,o=e.bind(t,"next"),r=e.bind(t,"throw");e.bind(t,"return"),this._invoke=function(t,i){var o=n?n.then((function(){return e(t,i)})):new a((function(n){n(e(t,i))}));return n=o.catch((function(t){})),o}}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function M(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i<t.length;)if(l.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=n,e.done=!0,e};return o.next=o}}return{next:O}}function O(){return{value:n,done:!0}}}("object"==typeof e?e:"object"==typeof window?window:"object"==typeof self?self:void 0)}).call(e,function(){return this}(),n(56))},function(t,e){var n,i=t.exports={},o=[],r=!1,s=-1;function a(){r=!1,n.length?o=n.concat(o):s=-1,o.length&&l()}function l(){if(!r){var t=setTimeout(a);r=!0;for(var e=o.length;e;){for(n=o,o=[];++s<e;)n&&n[s].run();s=-1,e=o.length}n=null,r=!1,clearTimeout(t)}}function u(t,e){this.fun=t,this.array=e}function c(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];o.push(new u(t,e)),1!==o.length||r||setTimeout(l,0)},u.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=c,i.addListener=c,i.once=c,i.off=c,i.removeListener=c,i.removeAllListeners=c,i.emit=c,i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){t.exports={default:n(58),__esModule:!0}},function(t,e,n){n(59),t.exports=n(12).Symbol},function(t,e,n){"use strict";var i=n(15),o=n(11),r=n(19),s=n(17),a=n(10),l=n(13),u=n(18),c=n(21),d=n(25),f=n(22),h=n(20),m=n(60),g=n(61),p=n(62),v=n(32),y=n(31),C=n(46),w=n(16),b=i.getDesc,A=i.setDesc,S=i.create,E=g.get,T=o.Symbol,x=!1,N=h("_hidden"),_=i.isEnum,M=c("symbol-registry"),O=c("symbols"),I="function"==typeof T,L=Object.prototype,P=s&&u((function(){return 7!=S(A({},"a",{get:function(){return A(this,"a",{value:7}).a}})).a}))?function(t,e,n){var i=b(L,e);i&&delete L[e],A(t,e,n),i&&t!==L&&A(L,e,i)}:A,R=function(t){var e=O[t]=S(T.prototype);return e._k=t,s&&x&&P(L,t,{configurable:!0,set:function(e){r(this,N)&&r(this[N],t)&&(this[N][t]=!1),P(this,t,w(1,e))}}),e},k=function(t,e,n){return n&&r(O,e)?(n.enumerable?(r(t,N)&&t[N][e]&&(t[N][e]=!1),n=S(n,{enumerable:w(0,!1)})):(r(t,N)||A(t,N,w(1,{})),t[N][e]=!0),P(t,e,n)):A(t,e,n)},V=function(t,e){y(t);for(var n,i=p(e=C(e)),o=0,r=i.length;r>o;)k(t,n=i[o++],e[n]);return t},D=function(t,e){return void 0===e?S(t):V(S(t),e)},F=function(t){var e=_.call(this,t);return!(e||!r(this,t)||!r(O,t)||r(this,N)&&this[N][t])||e},G=function(t,e){var n=b(t=C(t),e);return!n||!r(O,e)||r(t,N)&&t[N][e]||(n.enumerable=!0),n},U=function(t){for(var e,n=E(C(t)),i=[],o=0;n.length>o;)r(O,e=n[o++])||e==N||i.push(e);return i},H=function(t){for(var e,n=E(C(t)),i=[],o=0;n.length>o;)r(O,e=n[o++])&&i.push(O[e]);return i};I||(T=function(){if(this instanceof T)throw TypeError("Symbol is not a constructor");return R(f(arguments[0]))},l(T.prototype,"toString",(function(){return this._k})),i.create=D,i.isEnum=F,i.getDesc=G,i.setDesc=k,i.setDescs=V,i.getNames=g.get=U,i.getSymbols=H,s&&!n(9)&&l(L,"propertyIsEnumerable",F,!0)),I&&!u((function(){return"[null]"!=JSON.stringify([T()])}))||l(T.prototype,"toJSON",(function(){if(I&&v(this))return this}));var q={for:function(t){return r(M,t+="")?M[t]:M[t]=T(t)},keyFor:function(t){return m(M,t)},useSetter:function(){x=!0},useSimple:function(){x=!1}};i.each.call("hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),(function(t){var e=h(t);q[t]=I?e:R(e)})),x=!0,a(a.G+a.W,{Symbol:T}),a(a.S,"Symbol",q),a(a.S+a.F*!I,"Object",{create:D,defineProperty:k,defineProperties:V,getOwnPropertyDescriptor:G,getOwnPropertyNames:U,getOwnPropertySymbols:H}),d(T,"Symbol"),d(Math,"Math",!0),d(o.JSON,"JSON",!0)},function(t,e,n){var i=n(15),o=n(46);t.exports=function(t,e){for(var n,r=o(t),s=i.getKeys(r),a=s.length,l=0;a>l;)if(r[n=s[l++]]===e)return n}},function(t,e,n){var i={}.toString,o=n(46),r=n(15).getNames,s="object"==typeof window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.get=function(t){return s&&"[object Window]"==i.call(t)?function(t){try{return r(t)}catch(t){return s.slice()}}(t):r(o(t))}},function(t,e,n){var i=n(15);t.exports=function(t){var e=i.getKeys(t),n=i.getSymbols;if(n)for(var o,r=n(t),s=i.isEnum,a=0;r.length>a;)s.call(t,o=r[a++])&&e.push(o);return e}},function(t,e,n){t.exports={default:n(64),__esModule:!0}},function(t,e,n){var i=n(15);t.exports=function(t,e){return i.create(t,e)}},function(t,e,n){t.exports={default:n(66),__esModule:!0}},function(t,e,n){n(67),n(4),n(42),n(68),t.exports=n(12).Promise},function(t,e){},function(t,e,n){"use strict";var i,o=n(15),r=n(9),s=n(11),a=n(27),l=n(36),u=n(10),c=n(32),d=n(31),f=n(28),h=n(69),m=n(70),g=n(71).set,p=n(72),v=n(73),y=n(20)("species"),C=n(22)("record"),w=n(74),b="Promise",A=s.process,S="process"==l(A),E=s[b],T=function(t){var e=new E((function(){}));return t&&(e.constructor=Object),E.resolve(e)===e},x=function(){var t=!1;function e(t){var n=new E(t);return g(n,e.prototype),n}try{if(t=E&&E.resolve&&T(),g(e,E),e.prototype=o.create(E.prototype,{constructor:{value:e}}),e.resolve(5).then((function(){}))instanceof e||(t=!1),t&&n(17)){var i=!1;E.resolve(o.setDesc({},"then",{get:function(){i=!0}})),t=i}}catch(e){t=!1}return t}(),N=function(t){var e=d(t)[y];return null!=e?e:t},_=function(t){var e;return!(!c(t)||"function"!=typeof(e=t.then))&&e},M=function(t,e){if(!t.n){t.n=!0;var n=t.c;w((function(){for(var i=t.v,o=1==t.s,r=0,a=function(e){var n,r,s=o?e.ok:e.fail;try{s?(o||(t.h=!0),(n=!0===s?i:s(i))===e.P?e.rej(TypeError("Promise-chain cycle")):(r=_(n))?r.call(n,e.res,e.rej):e.res(n)):e.rej(i)}catch(t){e.rej(t)}};n.length>r;)a(n[r++]);n.length=0,t.n=!1,e&&setTimeout((function(){var e,n,o=t.p;O(o)&&(S?A.emit("unhandledRejection",i,o):(e=s.onunhandledrejection)?e({promise:o,reason:i}):(n=s.console)&&n.error&&n.error("Unhandled promise rejection",i)),t.a=void 0}),1)}))}},O=function(t){var e,n=t[C],i=n.a||n.c,o=0;if(n.h)return!1;for(;i.length>o;)if((e=i[o++]).fail||!O(e.P))return!1;return!0},I=function(t){var e=this;e.d||(e.d=!0,(e=e.r||e).v=t,e.s=2,e.a=e.c.slice(),M(e,!0))},L=function(t){var e,n=this;if(!n.d){n.d=!0,n=n.r||n;try{(e=_(t))?w((function(){var i={r:n,d:!1};try{e.call(t,a(L,i,1),a(I,i,1))}catch(t){I.call(i,t)}})):(n.v=t,n.s=1,M(n,!1))}catch(t){I.call({r:n,d:!1},t)}}};x||(E=function(t){f(t);var e={p:h(this,E,b),c:[],a:void 0,s:0,d:!1,v:void 0,h:!1,n:!1};this[C]=e;try{t(a(L,e,1),a(I,e,1))}catch(t){I.call(e,t)}},n(79)(E.prototype,{then:function(t,e){var n=d(d(this).constructor)[y],i={ok:"function"!=typeof t||t,fail:"function"==typeof e&&e},o=i.P=new(null!=n?n:E)((function(t,e){i.res=t,i.rej=e}));f(i.res),f(i.rej);var r=this[C];return r.c.push(i),r.a&&r.a.push(i),r.s&&M(r,!1),o},catch:function(t){return this.then(void 0,t)}})),u(u.G+u.W+u.F*!x,{Promise:E}),n(25)(E,b),v(E),v(i=n(12)[b]),u(u.S+u.F*!x,b,{reject:function(t){return new this((function(e,n){n(t)}))}}),u(u.S+u.F*(!x||T(!0)),b,{resolve:function(t){return c(n=t)&&(x?"Promise"==l(n):C in n)&&(e=t.constructor,r&&e===E&&this===i||p(e,this))?t:new this((function(e){e(t)}));var e,n}}),u(u.S+u.F*!(x&&n(38)((function(t){E.all(t).catch((function(){}))}))),b,{all:function(t){var e=N(this),n=[];return new e((function(i,r){m(t,!1,n.push,n);var s=n.length,a=Array(s);s?o.each.call(n,(function(t,n){e.resolve(t).then((function(t){a[n]=t,--s||i(a)}),r)})):i(a)}))},race:function(t){var e=N(this);return new e((function(n,i){m(t,!1,(function(t){e.resolve(t).then(n,i)}))}))}})},function(t,e){t.exports=function(t,e,n){if(!(t instanceof e))throw TypeError(n+": use the 'new' operator!");return t}},function(t,e,n){var i=n(27),o=n(30),r=n(33),s=n(31),a=n(34),l=n(35);t.exports=function(t,e,n,u){var c,d,f,h=l(t),m=i(n,u,e?2:1),g=0;if("function"!=typeof h)throw TypeError(t+" is not iterable!");if(r(h))for(c=a(t.length);c>g;g++)e?m(s(d=t[g])[0],d[1]):m(t[g]);else for(f=h.call(t);!(d=f.next()).done;)o(f,m,d.value,e)}},function(t,e,n){var i=n(15).getDesc,o=n(32),r=n(31),s=function(t,e){if(r(t),!o(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,o){try{(o=n(27)(Function.call,i(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,n){return s(t,n),e?t.__proto__=n:o(t,n),t}}({},!1):void 0),check:s}},function(t,e){t.exports=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}},function(t,e,n){"use strict";var i=n(15),o=n(20)("species");t.exports=function(t){n(17)&&!(o in t)&&i.setDesc(t,o,{configurable:!0,get:function(){return this}})}},function(t,e,n){var i,o,r,s=n(11),a=n(75).set,l=s.MutationObserver||s.WebKitMutationObserver,u=s.process,c="process"==n(37)(u),d=function(){var t,e;for(c&&(t=u.domain)&&(u.domain=null,t.exit());i;)(e=i.domain)&&e.enter(),i.fn.call(),e&&e.exit(),i=i.next;o=void 0,t&&t.enter()};if(c)r=function(){u.nextTick(d)};else if(l){var f=1,h=document.createTextNode("");new l(d).observe(h,{characterData:!0}),r=function(){h.data=f=-f}}else r=function(){a.call(s,d)};t.exports=function(t){var e={fn:t,next:void 0,domain:c&&u.domain};o&&(o.next=e),i||(i=e,r()),o=e}},function(t,e,n){"use strict";var i,o,r,s=n(27),a=n(76),l=n(77),u=n(78),c=n(11),d=c.process,f=c.setImmediate,h=c.clearImmediate,m=c.MessageChannel,g=0,p={},v="onreadystatechange",y=function(){var t=+this;if(p.hasOwnProperty(t)){var e=p[t];delete p[t],e()}},C=function(t){y.call(t.data)};f&&h||(f=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return p[++g]=function(){a("function"==typeof t?t:Function(t),e)},i(g),g},h=function(t){delete p[t]},"process"==n(37)(d)?i=function(t){d.nextTick(s(y,t,1))}:m?(r=(o=new m).port2,o.port1.onmessage=C,i=s(r.postMessage,r,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScript?(i=function(t){c.postMessage(t+"","*")},c.addEventListener("message",C,!1)):i=v in u("script")?function(t){l.appendChild(u("script"))[v]=function(){l.removeChild(this),y.call(t)}}:function(t){setTimeout(s(y,t,1),0)}),t.exports={set:f,clear:h}},function(t,e){t.exports=function(t,e,n){var i=void 0===n;switch(e.length){case 0:return i?t():t.call(n);case 1:return i?t(e[0]):t.call(n,e[0]);case 2:return i?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return i?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return i?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},function(t,e,n){t.exports=n(11).document&&document.documentElement},function(t,e,n){var i=n(32),o=n(11).document,r=i(o)&&i(o.createElement);t.exports=function(t){return r?o.createElement(t):{}}},function(t,e,n){var i=n(13);t.exports=function(t,e){for(var n in e)i(t,n,e[n]);return t}},function(t,e,n){t.exports={default:n(81),__esModule:!0}},function(t,e,n){n(82),t.exports=n(12).Object.keys},function(t,e,n){var i=n(29);n(83)("keys",(function(t){return function(e){return t(i(e))}}))},function(t,e,n){t.exports=function(t,e){var i=n(10),o=(n(12).Object||{})[t]||Object[t],r={};r[t]=e(o),i(i.S+i.F*n(18)((function(){o(1)})),"Object",r)}},function(t,e,n){t.exports={default:n(85),__esModule:!0}},function(t,e,n){n(67),n(4),n(42),n(86),n(89),t.exports=n(12).Set},function(t,e,n){"use strict";var i=n(87);n(88)("Set",(function(t){return function(){return t(this,arguments[0])}}),{add:function(t){return i.def(this,t=0===t?0:t,t)}},i)},function(t,e,n){"use strict";var i=n(15),o=n(14),r=n(27),s=n(73),a=n(69),l=n(7),u=n(70),c=n(45),d=n(22)("id"),f=n(19),h=n(32),m=Object.isExtensible||h,g=n(17),p=g?"_s":"size",v=0,y=function(t,e){if(!h(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!f(t,d)){if(!m(t))return"F";if(!e)return"E";o(t,d,++v)}return"O"+t[d]},C=function(t,e){var n,i=y(e);if("F"!==i)return t._i[i];for(n=t._f;n;n=n.n)if(n.k==e)return n};t.exports={getConstructor:function(t,e,o,s){var c=t((function(t,n){a(t,c,e),t._i=i.create(null),t._f=void 0,t._l=void 0,t[p]=0,null!=n&&u(n,o,t[s],t)}));return n(79)(c.prototype,{clear:function(){for(var t=this,e=t._i,n=t._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete e[n.i];t._f=t._l=void 0,t[p]=0},delete:function(t){var e=this,n=C(e,t);if(n){var i=n.n,o=n.p;delete e._i[n.i],n.r=!0,o&&(o.n=i),i&&(i.p=o),e._f==n&&(e._f=i),e._l==n&&(e._l=o),e[p]--}return!!n},forEach:function(t){for(var e,n=r(t,arguments[1],3);e=e?e.n:this._f;)for(n(e.v,e.k,this);e&&e.r;)e=e.p},has:function(t){return!!C(this,t)}}),g&&i.setDesc(c.prototype,"size",{get:function(){return l(this[p])}}),c},def:function(t,e,n){var i,o,r=C(t,e);return r?r.v=n:(t._l=r={i:o=y(e,!0),k:e,v:n,p:i=t._l,n:void 0,r:!1},t._f||(t._f=r),i&&(i.n=r),t[p]++,"F"!==o&&(t._i[o]=r)),t},getEntry:C,setStrong:function(t,e,i){n(8)(t,e,(function(t,e){this._t=t,this._k=e,this._l=void 0}),(function(){for(var t=this,e=t._k,n=t._l;n&&n.r;)n=n.p;return t._t&&(t._l=n=n?n.n:t._t._f)?c(0,"keys"==e?n.k:"values"==e?n.v:[n.k,n.v]):(t._t=void 0,c(1))}),i?"entries":"values",!i,!0),s(t),s(n(12)[e])}}},function(t,e,n){"use strict";var i=n(15),o=n(10),r=n(14),s=n(70),a=n(69);t.exports=function(t,e,l,u,c,d){var f=n(11)[t],h=f,m=c?"set":"add",g=h&&h.prototype,p={};return n(17)&&"function"==typeof h&&(d||g.forEach&&!n(18)((function(){(new h).entries().next()})))?(h=e((function(e,n){a(e,h,t),e._c=new f,null!=n&&s(n,c,e[m],e)})),i.each.call("add,clear,delete,forEach,get,has,set,keys,values,entries".split(","),(function(t){var e="add"==t||"set"==t;!(t in g)||d&&"clear"==t||r(h.prototype,t,(function(n,i){var o=this._c[t](0===n?0:n,i);return e?this:o}))})),"size"in g&&i.setDesc(h.prototype,"size",{get:function(){return this._c.size}})):(h=u.getConstructor(e,t,c,m),n(79)(h.prototype,l)),n(25)(h,t),p[t]=h,o(o.G+o.W+o.F,p),d||u.setStrong(h,t,c),h}},function(t,e,n){var i=n(10);i(i.P,"Set",{toJSON:n(90)("Set")})},function(t,e,n){var i=n(70),o=n(36);t.exports=function(t){return function(){if(o(this)!=t)throw TypeError(t+"#toJSON isn't generic");var e=[];return i(this,!1,e.push,e),e}}}])},t.exports=e()},6082:t=>{"use strict";t.exports=DG},4328:t=>{"use strict";t.exports=grok},7389:t=>{"use strict";t.exports=ui}},e={};function n(i){var o=e[i];if(void 0!==o)return o.exports;var r=e[i]={id:i,loaded:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}n.m=t,n.amdO={},n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.u=t=>t+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.hmd=t=>((t=Object.create(t)).children||(t.children=[]),Object.defineProperty(t,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+t.id)}}),t),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;n.g.importScripts&&(t=n.g.location+"");var e=n.g.document;if(!t&&e&&(e.currentScript&&"SCRIPT"===e.currentScript.tagName.toUpperCase()&&(t=e.currentScript.src),!t)){var i=e.getElementsByTagName("script");if(i.length)for(var o=i.length-1;o>-1&&(!t||!/^http(s?):/.test(t));)t=i[o--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=t})(),n.b=document.baseURI||self.location.href,n.nc=void 0;var i={};(()=>{"use strict";n.r(i),n.d(i,{_package:()=>P,initAutoTests:()=>k,test:()=>R,tests:()=>e.CN});var t=n(6082),e=n(8070),o=n(4328),r=n(5082),s=n(768),a=n(4139),l=n(8608),u=n(2003),c=n(726),d=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Core",(()=>{const n="AlignedSequence";(0,e.gM)((()=>d(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents()}))));let i=null;(0,e.t6)("Start analysis: simple",(()=>d(void 0,void 0,void 0,(function*(){const o=t.DataFrame.fromCsv(yield P.files.readAsText("aligned.csv")),c=o.getCol("IC50"),d=o.getCol(n);d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(a.gp.ALPHABET,u.YI.PT),d.setTag(t.TAGS.UNITS,u.Hi.FASTA),d.setTag(u.gp.aligned,"SEQ.MSA");const f=(0,l.Y1)(c,a.rg.MINUS_LG);i=yield(0,r.n)(c,d,null,o,f,a.rg.MINUS_LG),(0,e.E3)(i instanceof s.i,!0,"Model is null"),i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP).mutationCliffsSelection={11:["D"]},yield(0,e.cb)(3e3)})))),(0,e.t6)("Start analysis: сomplex",(()=>d(void 0,void 0,void 0,(function*(){const n=t.DataFrame.fromCsv(yield P.files.readAsText("aligned_2.csv")),o=n.getCol("Activity"),c=n.getCol("MSA");c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(a.gp.ALPHABET,u.YI.UN),c.setTag(t.TAGS.UNITS,u.Hi.SEPARATOR),c.setTag(u.gp.aligned,"SEQ.MSA"),c.setTag(a.gp.SEPARATOR,"/");const d=(0,l.Y1)(o,a.rg.MINUS_LG);i=yield(0,r.n)(o,c,null,n,d,a.rg.MINUS_LG),(0,e.E3)(i instanceof s.i,!0,"Model is null"),i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP).mutationCliffsSelection={13:["-"]},yield(0,e.cb)(3e3)})))),(0,e.t6)("Save and load project",(()=>d(void 0,void 0,void 0,(function*(){const s=t.DataFrame.fromCsv(yield P.files.readAsText("aligned.csv")),c=s.getCol("IC50"),d=s.getCol(n);d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(a.gp.ALPHABET,u.YI.PT),d.setTag(t.TAGS.UNITS,u.Hi.FASTA),d.setTag(u.gp.aligned,"SEQ.MSA");const f=(0,l.Y1)(c,a.rg.MINUS_LG);i=yield(0,r.n)(c,d,null,s,f,a.rg.MINUS_LG);let h=o.shell.getTableView("Peptides analysis");const m=h.dataFrame,g=h.saveLayout(),p=m.getTableInfo(),v=t.Project.create();v.name="Peptides project unique test",v.addChild(p),v.addChild(g);const y=yield o.dapi.layouts.save(g);yield o.dapi.tables.uploadDataFrame(m);const C=yield o.dapi.tables.save(p),w=yield o.dapi.projects.save(v);h.close(),yield(0,e.bk)((()=>void 0===o.shell.tableView("Peptides analysis")),"Table never closed",3e3),yield w.open(),h=o.shell.getTableView("Peptides analysis"),yield o.dapi.layouts.delete(y),yield o.dapi.tables.delete(C),yield o.dapi.projects.delete(w)}))),{skipReason:"ViewLayout should become ViewInfo in 1.18."})}),{clear:!0});var f=n(3657),h=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const m=[5,50,100,200];function g(e){return h(this,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return;const n=(yield P.files.readBinaryDataFrames(`tests/${e}k.d42`))[0],i=n.getCol("activity").getRawData(),o=[];let r=1;for(;null!==n.col(r.toString());){const t=n.getCol(r.toString());o.push({name:t.name,rawData:t.getRawData(),cat:t.categories}),++r}yield t.timeAsync("Mutation Cliffs",(()=>h(this,void 0,void 0,(function*(){return yield(0,f.uz)(i,o)}))))}))}(0,e.L1)("Benchmarks: Mutation Cliffs",(()=>{(0,e.gM)((()=>h(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents()}))));for(const t of m)(0,e.t6)(`${t}k sequences`,(()=>h(void 0,void 0,void 0,(function*(){return yield g(t)}))),{timeout:3e5})}),{benchmarks:!0}),(0,e.L1)("Benchmarks: Cluster stats",(()=>{(0,e.gM)((()=>h(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents()}))));for(const n of m)(0,e.t6)(`${n}k sequences`,(()=>h(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return null;const e=(yield P.files.readBinaryDataFrames(`tests/${n}k.d42`))[0],i=(0,l.Y1)(e.getCol("activity"),a.rg.NONE);e.columns.names().map((t=>t.toLowerCase())).includes(i.name.toLowerCase())&&e.columns.remove(i.name),e.columns.add(i),t.time(`Cluster stats benchmark - ${n}k`,(()=>(0,f.eW)(e,"cluster",[],i)))}))),{timeout:1e5})}),{benchmarks:!0}),(0,e.L1)("Benchmarks: Monomer-Position stats",(()=>{(0,e.gM)((()=>h(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents()}))));for(const n of m)(0,e.t6)(`${n}k sequences`,(()=>h(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return null;const e=(yield P.files.readBinaryDataFrames(`tests/${n}k.d42`))[0],i=[];let o=1;for(;null!==e.col(o.toString());)i.push(e.getCol(o.toString())),++o;const r=(0,l.Y1)(e.getCol("activity"),a.rg.NONE);e.columns.names().map((t=>t.toLowerCase())).includes(r.name.toLowerCase())&&e.columns.remove(r.name),e.columns.add(r),t.time(`Monomer-Position stats benchmark - ${n}k`,(()=>(0,f.Ej)(r,t.BitSet.create(0),i)))}))),{timeout:1e5})}),{benchmarks:!0}),(0,e.L1)("Benchmarks: Analysis start",(()=>{(0,e.gM)((()=>h(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents()}))));for(const n of m)(0,e.t6)(`${n}k sequences`,(()=>h(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return;const e=(yield P.files.readBinaryDataFrames(`tests/${n}k.d42`))[0],i=e.getCol("activity"),s=(0,l.Y1)(i,a.rg.NONE),c=e.getCol("cluster"),d=e.getCol("sequence");d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,n===m[0]?u.Hi.HELM:u.Hi.FASTA),yield t.timeAsync("Analysis start",(()=>h(void 0,void 0,void 0,(function*(){const t=yield(0,r.n)(i,d,c,e,s,a.rg.NONE);t&&o.shell.closeTable(t.df)}))))}))),{timeout:1e5})}),{benchmarks:!0});var p,v=n(3541),y=n(5480),C=n(4326);!function(t){t.SEQUENCE="sequence",t.ACTIVITY="activity",t.CLUSTER="cluster"}(p||(p={}));var w=n(912),b=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Viewers: Basic",(()=>{let n;(0,e.gM)((()=>b(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents(),n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),yield(0,e.cb)(500)}))));const i=t.Func.find({package:"Peptides",tags:["viewer"]}).map((t=>t.friendlyName));for(const t of i)(0,e.t6)(t,(()=>b(void 0,void 0,void 0,(function*(){yield(0,e.Bl)(t,n.clone(),{detectSemanticTypes:!0,arbitraryDfTest:!1,readOnly:!0}),yield(0,e.cb)(1e3)}))))})),(0,e.L1)("Viewers: Monomer-Position",(()=>{let n,i,o,c,d,f,h;(0,e.gM)((()=>b(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),o=n.getCol(p.ACTIVITY),c=n.getCol(p.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),f=(0,l.Y1)(o,a.rg.NONE),d=n.getCol(p.CLUSTER);const m=yield(0,r.n)(o,c,d,n,f,a.rg.NONE);if(null===m)throw new Error("Model is null");i=m,h=i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP),yield(0,e.cb)(500)})))),(0,e.Pl)((()=>b(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Tooltip",(()=>b(void 0,void 0,void 0,(function*(){const t=h.viewerGrid.cell("9",6),n=h.getMonomerPosition(t);(0,e.E3)((0,w.D)(i.df,o,Object.entries(i.settings.columns),{monomerPosition:n,x:0,y:0,mpStats:i.monomerPositionStats}),!0,"Tooltip is not shown for grid cell at column '9', row 6")})))),(0,e.t6)("Modes",(()=>b(void 0,void 0,void 0,(function*(){if(null===h)throw new Error("Monomer-Position viewer doesn't exist");(0,e.E3)(h.mode,v.ds.MUTATION_CLIFFS,`Default Monomer-Position mode is not ${v.ds.MUTATION_CLIFFS}`),h.mode=v.ds.INVARIANT_MAP,(0,e.E3)(h.mode,v.ds.INVARIANT_MAP,`Monomer-Position mode is not ${v.ds.INVARIANT_MAP} after switching`),h.mode=v.ds.MUTATION_CLIFFS,(0,e.E3)(h.mode,v.ds.MUTATION_CLIFFS,`Monomer-Position mode is not ${v.ds.MUTATION_CLIFFS} after switching`)}))))}),{clear:!1}),(0,e.L1)("Viewers: Most Potent Residues",(()=>{let n,i,o,c,d,f,h;(0,e.gM)((()=>b(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),o=n.getCol(p.ACTIVITY),c=n.getCol(p.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),f=(0,l.Y1)(o,a.rg.NONE),d=n.getCol(p.CLUSTER);const m=yield(0,r.n)(o,c,d,n,f,a.rg.NONE);if(null===m)throw new Error("Model is null");i=m,h=i.findViewer(s.q.MOST_POTENT_RESIDUES),yield(0,e.cb)(500)})))),(0,e.Pl)((()=>b(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Tooltip",(()=>b(void 0,void 0,void 0,(function*(){const t="Diff",n=h.viewerGrid.cell(t,6),r=h.getMonomerPosition(n);(0,e.E3)((0,w.D)(i.df,o,Object.entries(i.settings.columns),{monomerPosition:r,x:0,y:0,mpStats:i.monomerPositionStats}),!0,`Tooltip is not shown for grid cell at column '${t}', row 6`)}))))})),(0,e.L1)("Viewers: Logo Summary Table",(()=>{let n,i,o,c,d,f,h;(0,e.gM)((()=>b(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),o=n.getCol(p.ACTIVITY),c=n.getCol(p.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),f=(0,l.Y1)(o,a.rg.NONE),d=n.getCol(p.CLUSTER);const m=yield(0,r.n)(o,c,d,n,f,a.rg.NONE);if(null===m)throw new Error("Model is null");i=m,h=i.findViewer(s.q.LOGO_SUMMARY_TABLE),yield(0,e.cb)(500)})))),(0,e.Pl)((()=>b(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Properties",(()=>b(void 0,void 0,void 0,(function*(){h.getProperty("webLogoMode").set(h,C.fH.full),(0,e.E3)(h.webLogoMode,C.fH.full,`Web Logo Mode property is not changed to ${C.fH.full}, got ${h.webLogoMode} instead`),h.getProperty("membersRatioThreshold").set(h,0),(0,e.E3)(h.membersRatioThreshold,0,`Members Ratio Threshold property is not changed to 0, got ${h.membersRatioThreshold} instead`),(0,e.E3)(h.viewerGrid.table.filter.anyTrue,!0,`Expected to filter out all rows, but ${h.viewerGrid.table.filter.trueCount} rows are left unfiltered`)})))),(0,e.t6)("Tooltip",(()=>b(void 0,void 0,void 0,(function*(){const t=h.showTooltip({monomerOrCluster:"0",positionOrClusterType:y.W.ORIGINAL},0,0);(0,e.E3)(null!==t,!0,"Tooltip is not shown for cluster '0'")}))))}),{clear:!1});var A=n(5429),S=n(7654),E=n(7923),T=n(144),x=n.n(T),N=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Widgets: Settings",(()=>{let n,i,o,s,d,f;(0,e.gM)((()=>N(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents(),n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),o=n.getCol(p.ACTIVITY),s=n.getCol(p.SEQUENCE),s.semType=t.SEMTYPE.MACROMOLECULE,s.setTag(t.TAGS.UNITS,u.Hi.HELM),f=(0,l.Y1)(o,a.rg.NONE),d=n.getCol(p.CLUSTER);const h=yield(0,r.n)(o,s,d,n,f,a.rg.NONE);if(null===h)throw new Error("Model is null");i=h,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>N(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("UI",(()=>N(void 0,void 0,void 0,(function*(){const t=(0,A.OH)(i),n=t.accordion.panes.map((t=>t.name));(0,e.E3)(n.length,5,`Expected 5 panes, got ${t.accordion.panes.length}`);for(const t of Object.values(A.OO))(0,e.E3)(n.includes(t),!0,`Pane ${t} is missing`);for(const n of Object.values(A.OO)){const i=t.inputs[n].map((t=>t.caption));for(const t of Object.values(A.Av[n]))(0,e.E3)(i.includes(t),!0,`Input ${t} is missing from ${n}`)}}))))})),(0,e.L1)("Widgets: Distribution panel",(()=>{let n,i,o,d,f,h;(0,e.gM)((()=>N(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents(),n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),o=n.getCol(p.ACTIVITY),d=n.getCol(p.SEQUENCE),d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,u.Hi.HELM),h=(0,l.Y1)(o,a.rg.NONE),f=n.getCol(p.CLUSTER);const s=yield(0,r.n)(o,d,f,n,h,a.rg.NONE);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>N(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("UI",(()=>N(void 0,void 0,void 0,(function*(){i.df.selection.set(0,!0),yield(0,e.cb)(1e3);const n=i.findViewer(s.q.LOGO_SUMMARY_TABLE);(0,S.HV)(i.df,{peptideSelection:t.BitSet.create(i.df.rowCount),columns:i.settings.columns,activityCol:h,clusterSelection:n.clusterSelection,clusterColName:f.name,monomerPositionSelection:i.webLogoSelection})}))))})),(0,e.L1)("Widgets: Mutation cliffs",(()=>{let n,i,o,d,f,h;(0,e.gM)((()=>N(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents(),n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),o=n.getCol(p.ACTIVITY),d=n.getCol(p.SEQUENCE),d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,u.Hi.HELM),h=(0,l.Y1)(o,a.rg.NONE),f=n.getCol(p.CLUSTER);const s=yield(0,r.n)(o,d,f,n,h,a.rg.NONE);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>N(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("UI",(()=>N(void 0,void 0,void 0,(function*(){var t;const n=i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP);n.keyPressed=!0,n._viewerGrid.dataFrame.currentCell=null===(t=n._viewerGrid)||void 0===t?void 0:t.dataFrame.cell(0,"1"),yield(0,e.cb)(1e3),(0,E.F)(i.df,{mutationCliffs:n.mutationCliffs,mutationCliffsSelection:n.mutationCliffsSelection,gridColumns:i.analysisView.grid.columns,sequenceColumnName:n.sequenceColumnName,positionColumns:n.positionColumns,activityCol:h})}))))})),(0,e.L1)("Widgets: Actions",(()=>{let n,i,d,f,h,m;(0,e.gM)((()=>N(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents(),n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),yield n.meta.detectSemanticTypes(),d=n.getCol(p.ACTIVITY),f=n.getCol(p.SEQUENCE),f.semType=t.SEMTYPE.MACROMOLECULE,f.setTag(t.TAGS.UNITS,u.Hi.HELM),m=(0,l.Y1)(d,a.rg.NONE),h=n.getCol(p.CLUSTER);const o=yield(0,r.n)(d,f,h,n,m,a.rg.NONE);if(null===o)throw new Error("Model is null");i=o,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>N(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("New view",(()=>N(void 0,void 0,void 0,(function*(){const n=i.df.filter;n.setAll(!1,!1),n.set(0,!0,!1),n.set(1,!0,!1);const r=i.df.selection;r.set(0,!0,!1),r.set(1,!0,!1);const l=i.createNewView(),u=o.shell.t;(0,e.E3)(u.getTag(a.gp.MULTIPLE_VIEWS),"1","Current table is expected to have multiple views tag"),(0,e.E3)(u.getTag(t.TAGS.ID),l,"Current table is expected to have the same UUID as new view"),(0,e.E3)(u.rowCount,2,"Current table is expected to have 2 rows"),yield(0,e.cb)(500);const c=u.temp[s.i.modelName].findViewer(s.q.LOGO_SUMMARY_TABLE);(0,e.E3)(null!==c,!0,"New view is expected to have Logo Summary Table viewer attached")})))),(0,e.t6)("Custom clusters",(()=>N(void 0,void 0,void 0,(function*(){const t=i.df.filter;t.setAll(!1,!1),t.set(0,!0,!1),t.set(1,!0,!1),i.df.selection.set(0,!0,!1);const n=i.findViewer(s.q.LOGO_SUMMARY_TABLE);if(null===n)throw new Error("Logo summary table viewer is not found");(0,e.E3)(x()(n.customClusters).toArray().length,0,"Expected to have 0 custom clusters before creating one"),n.clusterFromSelection();const o=x()(n.customClusters).toArray();(0,e.E3)(o.length,1,"Expected to have 1 custom cluster");const r=o[0].name;(0,e.E3)(null!==i.df.col(r),!0,"Expected to have custom cluster column in the table"),(0,e.E3)(-1!==n.viewerGrid.table.getCol(a.i6.CLUSTER).categories.indexOf(r),!0,"Expected to have custom cluster in the Logo Summary Table"),n.modifyClusterSelection({monomerOrCluster:r,positionOrClusterType:y.W.CUSTOM}),n.removeCluster(),(0,e.E3)(x()(n.customClusters).toArray().length,0,"Expected to have 0 custom clusters after removing one"),(0,e.E3)(null===i.df.col(r),!0,"Expected to have no custom cluster column in the table"),(0,e.E3)(-1===n.viewerGrid.table.getCol(a.i6.CLUSTER).categories.indexOf(r),!0,"Expected to have no custom cluster in the Logo Summary Table")}))))}),{clear:!1});var _=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Table view",(()=>{let n,i,o,d,f,h;const m="none",g={monomerOrCluster:"Aze",positionOrClusterType:"10",mcCount:3,imCount:1},v={monomerOrCluster:"meI",positionOrClusterType:"1",mcCount:2,imCount:10},C={monomerOrCluster:"0",positionOrClusterType:y.W.ORIGINAL,count:3},w={monomerOrCluster:"1",positionOrClusterType:y.W.ORIGINAL,count:3};(0,e.gM)((()=>_(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents(),n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),o=n.getCol(p.ACTIVITY),d=n.getCol(p.SEQUENCE),d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,u.Hi.HELM),h=(0,l.Y1)(o,m),f=n.getCol(p.CLUSTER);const s=yield(0,r.n)(o,d,f,n,h,m);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>_(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Visible columns",(()=>_(void 0,void 0,void 0,(function*(){const t=i.analysisView.grid.columns,n=i.positionColumns.map((t=>t.name));for(let i=1;i<t.length;i++){const o=t.byIndex(i),r=o.column.name,s=n.includes(r)||r===a.$2.ACTIVITY;(0,e.E3)(o.visible,s,`Column ${r} is visible === ${o.visible} but should be ${s}`)}})))),(0,e.t6)("Mutation Cliffs selection",(()=>_(void 0,void 0,void 0,(function*(){const t=i.df.selection,n=i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP);yield(0,e.bk)((()=>null!==n.mutationCliffs),"mutation cliffs haven't been generated",2e3);for(const[t,i]of Object.entries(n.mutationCliffsSelection))(0,e.E3)(i.length,0,`Selection is not empty for position ${t} after initialization`);n.modifyMutationCliffsSelection(g),(0,e.E3)(n.mutationCliffsSelection[g.positionOrClusterType].includes(g.monomerOrCluster),!0,`Monomer ${g.monomerOrCluster} is not selected at position ${g.positionOrClusterType}`),(0,e.E3)(t.trueCount,g.mcCount,`Selection count is not equal to ${g.mcCount} for monomer ${g.monomerOrCluster} at position ${g.positionOrClusterType}`),n.modifyMutationCliffsSelection(v,{shiftPressed:!0,ctrlPressed:!1}),(0,e.E3)(n.mutationCliffsSelection[v.positionOrClusterType].includes(v.monomerOrCluster),!0,`Monomer ${v.monomerOrCluster} is not selected at position ${v.positionOrClusterType}`),(0,e.E3)(t.trueCount,v.mcCount+g.mcCount,`Selection count is not equal to ${v.mcCount+g.mcCount} for monomer ${v.monomerOrCluster} at position ${v.positionOrClusterType}`),n.modifyMutationCliffsSelection(v,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(n.mutationCliffsSelection[v.positionOrClusterType].includes(v.monomerOrCluster),!1,`Monomer ${v.monomerOrCluster} is still selected at position ${v.positionOrClusterType} after deselection`),(0,e.E3)(t.trueCount,g.mcCount,`Selection count is not equal to ${g.mcCount} for monomer ${g.monomerOrCluster} at position ${g.positionOrClusterType}`),n.mutationCliffsSelection=(0,l.ZR)(n.positionColumns);for(const[t,i]of Object.entries(n.mutationCliffsSelection))(0,e.E3)(i.length,0,`Selection is not empty for position ${t} after clearing monomer-position selection`);(0,e.E3)(t.trueCount,0,"Selection count is not equal to 0 after clearing monomer-position selection");const o=i.findViewer(s.q.LOGO_SUMMARY_TABLE);(0,e.E3)(null!==o,!0,"Couldn't find Logo Summary Table viewer"),o.modifyClusterSelection(C),(0,e.E3)(o.clusterSelection[C.positionOrClusterType].includes(C.monomerOrCluster),!0,`Cluster ${C.monomerOrCluster} is not selected`),(0,e.E3)(t.trueCount,C.count,`Selection count is not equal to ${C.count} for cluster ${C.monomerOrCluster}`),o.modifyClusterSelection(w,{shiftPressed:!0,ctrlPressed:!1}),(0,e.E3)(o.clusterSelection[w.positionOrClusterType].includes(w.monomerOrCluster),!0,`Cluster ${w.monomerOrCluster} is not selected`),(0,e.E3)(t.trueCount,C.count+w.count,`Selection count is not equal to ${C.count+w.count} for cluster ${C.monomerOrCluster} and cluster \n ${w.monomerOrCluster}`),o.modifyClusterSelection(C,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(o.clusterSelection[C.positionOrClusterType].includes(C.monomerOrCluster),!1,`Cluster ${C.monomerOrCluster} is still selected after deselection`),(0,e.E3)(t.trueCount,w.count,`Selection count is not equal to ${w.count} for cluster ${w.monomerOrCluster} after deselection of cluster ${C.monomerOrCluster}`),o.initClusterSelection(),(0,e.E3)(o.isClusterSelectionEmpty,!0,"Selection is not empty after clearing cluster selection"),(0,e.E3)(t.trueCount,0,"Selection count is not equal to 0 after clearing cluster selection")})))),(0,e.t6)("Invariant Map selection",(()=>_(void 0,void 0,void 0,(function*(){const t=i.df.selection;for(const[t,n]of Object.entries(i.webLogoSelection))(0,e.E3)(n.length,0,`Filter is not empty for position ${t} after initialization`);i.modifyWebLogoSelection(v),(0,e.E3)(i.webLogoSelection[v.positionOrClusterType].includes(v.monomerOrCluster),!0,`Monomer ${v.monomerOrCluster} is not filtered at position ${v.positionOrClusterType}`),(0,e.E3)(t.trueCount,v.imCount,`Filter count is not equal to ${v.imCount} for monomer ${v.monomerOrCluster} at position ${v.positionOrClusterType}`),i.modifyWebLogoSelection(g,{shiftPressed:!0,ctrlPressed:!1}),(0,e.E3)(i.webLogoSelection[g.positionOrClusterType].includes(g.monomerOrCluster),!0,`Monomer ${g.monomerOrCluster} is not filtered at position ${g.positionOrClusterType}`),(0,e.E3)(t.trueCount,v.imCount,`Filter count is not equal to ${v.imCount} for monomer ${g.monomerOrCluster} at position ${g.positionOrClusterType}`),i.modifyWebLogoSelection(v,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(i.webLogoSelection[v.positionOrClusterType].includes(v.monomerOrCluster),!1,`Monomer ${v.monomerOrCluster} is still filtered at position \n ${v.positionOrClusterType} after deselection`),(0,e.E3)(t.trueCount,g.imCount,`Filter count is not equal to ${g.imCount} for monomer ${g.monomerOrCluster} at position ${g.positionOrClusterType} after deselection of monomer ${v.monomerOrCluster} at position ${v.positionOrClusterType}`),(0,e.E3)(null!==i.positionColumns,!0,"Position columns are not initialized"),i.webLogoSelection=(0,l.ZR)(i.positionColumns),(0,e.E3)(t.trueCount,0,"Filter count is not equal to 0 after clearing monomer-position filter");for(const[t,n]of Object.entries(i.webLogoSelection))(0,e.E3)(n.length,0,`Filter is not empty for position ${t} after clearing monomer-position filter`)}))))}),{clear:!1});var M=n(5070),O=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Model: Settings",(()=>{let n,i,o,d,f,h;(0,e.gM)((()=>O(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents(),n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),n.name="HELM_small",o=n.getCol(p.ACTIVITY),d=n.getCol(p.SEQUENCE),d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,u.Hi.HELM),h=(0,l.Y1)(o,a.rg.NONE),f=n.getCol(p.CLUSTER);const s=yield(0,r.n)(o,d,f,n,h,a.rg.NONE);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>O(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Activity scaling",(()=>O(void 0,void 0,void 0,(function*(){var t;const n=(t,e)=>`Activity mismatch at row ${t} for scaling method '${e}'`,r=1e-4,s=i.df.getCol(null===(t=i.settings)||void 0===t?void 0:t.activityColumnName).getRawData(),u=i.df.getCol(a.$2.ACTIVITY),c=i.df.rowCount;let d=u.getRawData();for(let t=0;t<c;t++)(0,e.Wj)(d[t],s[t],r,n(t,a.rg.NONE));d=(0,l.Y1)(o,a.rg.LG).getRawData();for(let t=0;t<c;t++)(0,e.Wj)(d[t],Math.log10(s[t]),r,n(t,a.rg.LG));d=(0,l.Y1)(o,a.rg.MINUS_LG).getRawData();for(let t=0;t<c;t++)(0,e.Wj)(d[t],-Math.log10(s[t]),r,n(t,a.rg.MINUS_LG));d=h.getRawData();for(let t=0;t<c;t++)(0,e.Wj)(d[t],s[t],r,n(t,a.rg.NONE))})))),(0,e.t6)("Mutation Cliffs",(()=>O(void 0,void 0,void 0,(function*(){const t=i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP);(0,e.E3)(t.maxMutations,1,`Max mutations mismatch: expected 1, actual ${t.maxMutations}`),(0,e.E3)(t.minActivityDelta,0,`Min activity delta mismatch: expected 0, actual ${t.minActivityDelta}`),t.maxMutations=2,t.minActivityDelta=.5,(0,e.E3)(t.maxMutations,2,`Max mutations mismatch: expected 2, actual ${t.maxMutations}`),(0,e.E3)(t.minActivityDelta,.5,`Min activity delta mismatch: expected 0.5, actual ${t.minActivityDelta}`)})))),(0,e.t6)("Include columns",(()=>O(void 0,void 0,void 0,(function*(){var n,o;const r="rank",a={[r]:t.AGG.AVG};i.settings={columns:a};const l=i.findViewer(s.q.LOGO_SUMMARY_TABLE),u=(0,M.hX)(t.AGG.AVG,r);(0,e.E3)(null!==l.viewerGrid.col(u),!0,`Expected to include column '${r}' in ${s.q.LOGO_SUMMARY_TABLE} but it is absent`),i.settings={columns:{}},(0,e.E3)(Object.keys(null===(n=i.settings)||void 0===n?void 0:n.columns).length,0,`Expected to remove all column aggregations but columns {${Object.keys(null===(o=i.settings)||void 0===o?void 0:o.columns).join(" & ")}} are still included`),(0,e.E3)(null===l.viewerGrid.col(u),!0,`Expected to remove column '${r}' from ${s.q.LOGO_SUMMARY_TABLE} but it is still present`)})))),(0,e.t6)("Dendrogram",(()=>O(void 0,void 0,void 0,(function*(){var t,n;i.settings={showDendrogram:!0},(0,e.E3)(null===(t=i.settings)||void 0===t?void 0:t.showDendrogram,!0,"Dendrogram is disabled after enabling"),yield(0,e.bk)((()=>null!==i.findViewer(s.q.DENDROGRAM)),"Dendrogram is not present in the view after 5s delay",5e3),i.settings={showDendrogram:!1},(0,e.E3)(null===(n=i.settings)||void 0===n?void 0:n.showDendrogram,!1,"Dendrogram is enabled after disabling"),(0,e.E3)(null===i.findViewer(s.q.DENDROGRAM),!0,"Dendrogram is present in the view after disabling")}))),{skipReason:"Need to find a way to replace _package variable to call for Bio function with tests"})}),{clear:!1});var I=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Algorithms",(()=>{let n,i,o,r;(0,e.gM)((()=>I(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents(),n=t.Column.fromList("int","test",[1,2,5]).getRawData(),i=[t.Column.fromList("string","1","AAA".split("")),t.Column.fromList("string","2","BCC".split("")),t.Column.fromList("string","3","CCD".split(""))].map((t=>({name:t.name,rawData:t.getRawData(),cat:t.categories}))),r=(0,l.eY)(t.Column.fromList("string","target",["1","2","2"])),o={maxMutations:1,minActivityDelta:2}})))),(0,e.t6)("MutationCliffs",(()=>I(void 0,void 0,void 0,(function*(){let t=yield(0,f.uz)(n,i,o);(0,e.E3)(t.has("C"),!0,"MutationCliffsInfo should have key 'C'"),(0,e.E3)(t.has("D"),!0,"MutationCliffsInfo should have key 'D'"),(0,e.E3)(t.has("A"),!1,"MutationCliffsInfo should not have key 'A'");const s=t.get("C"),a=t.get("D");(0,e.E3)(s.has("3"),!0,"MutationCliffsInfo['C'] should have key '3'"),(0,e.E3)(a.has("3"),!0,"MutationCliffsInfo['D'] should have key '3'");const l=s.get("3"),u=a.get("3");(0,e.E3)(l.has(1),!0,"MutationCliffsInfo['C']['3'] should have key 1"),(0,e.E3)(u.has(2),!0,"MutationCliffsInfo['D']['3'] should have key 2");const c=l.get(1),d=u.get(2);(0,e.E3)(c[0],2,"MutationCliffsInfo['C']['3'][1] should have value 2"),(0,e.E3)(d[0],1,"MutationCliffsInfo['D']['3'][2] should have value 1"),o.targetCol=r,o.currentTarget="1",t=yield(0,f.uz)(n,i,o),(0,e.E3)(t.size,0,"MutationCliffsInfo should be empty for target '1'")}))))}));var L=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const P=new t.Package;function R(n,i,o){return L(this,void 0,void 0,(function*(){(null==o?void 0:o.catchUnhandled)&&(o.catchUnhandled=!1);const r=yield(0,e.N$)({category:n,test:i,testContext:o});return t.DataFrame.fromObjects(r)}))}function k(){return L(this,void 0,void 0,(function*(){yield(0,e.Xb)(P,P.getModule("package-test.js"))}))}})(),peptides_test=i})();
1
+ var peptides_test;(()=>{var t={3981:(t,e,n)=>{"use strict";var i;n.d(e,{o:()=>i}),function(t){t.BASE="HELM_BASE",t.SUGAR="HELM_SUGAR",t.LINKER="HELM_LINKER",t.AA="HELM_AA",t.CHEM="HELM_CHEM",t.BLOB="HELM_BLOB",t.NUCLEOTIDE="HELM_NUCLETIDE"}(i||(i={}))},4971:(t,e,n)=>{"use strict";n.d(e,{pj:()=>o});var i=n(6082);async function o(){const t=i.Func.find({package:"Bio",name:"getMonomerLibHelper"});if(0===t.length)throw new Error('Package "Bio" must be installed for MonomerLibHelper.');return(await t[0].prepare().call()).getOutputParamValue()}},439:(t,e,n)=>{"use strict";n.d(e,{B5:()=>a,Hi:()=>i,YI:()=>o,_S:()=>c,b9:()=>d,gp:()=>r,ot:()=>f,q7:()=>u});var i,o,r,s=n(2738);!function(t){t.FASTA="fasta",t.SEPARATOR="separator",t.HELM="helm",t.CUSTOM="custom",t.BILN="biln"}(i||(i={})),function(t){t.DNA="DNA",t.RNA="RNA",t.PT="PT",t.UN="UN"}(o||(o={})),function(t){t.aligned="aligned",t.alphabet="alphabet",t.alphabetSize=".alphabetSize",t.alphabetIsMultichar=".alphabetIsMultichar",t.separator="separator",t.isHelmCompatible=".isHelmCompatible",t.positionNames=".positionNames",t.positionLabels=".positionLabels",t.regions=".regions",t.positionShift=".positionShift",t.selectedPosition=".selectedPosition",t.polymerTypeColumnName=".polymerTypeColumnName"}(r||(r={}));const a=/(?:\[([A-Za-z0-9_\-,()]+)\])|([A-Za-z\-])/g,l=new class{constructor(){this.fasta={peptide:new Set(["G","L","Y","S","E","Q","D","N","F","A","K","R","H","C","V","P","W","I","M","T"]),dna:new Set(["A","C","G","T"]),rna:new Set(["A","C","G","U"])}}},u=[new s.a(o.PT,l.fasta.peptide,.5),new s.a(o.DNA,l.fasta.dna,.55),new s.a(o.RNA,l.fasta.rna,.55)],c="",d={[i.FASTA]:"-",[i.SEPARATOR]:"",[i.HELM]:"*",[i.BILN]:""},f=" , "},2003:(t,e,n)=>{"use strict";n.d(e,{Hi:()=>i.Hi,SM:()=>o.SM,YI:()=>i.YI,gp:()=>i.gp,ot:()=>i.ot,zS:()=>o.zS});var i=n(439),o=n(7194)},4025:(t,e,n)=>{"use strict";n.d(e,{j:()=>o});var i=n(6082);n(439),n(7194);const o=new class{constructor(){this.seqHandler="seq-handler",this.notationProvider="seq-handler.notation-provider"}};i.SemanticValue},2738:(t,e,n)=>{"use strict";n.d(e,{X:()=>o,a:()=>i});class i{constructor(t,e,n){this.name=t,this.alphabet=e,this.cutoff=n}}class o extends i{constructor(t,e,n){super(t.name,t.alphabet,t.cutoff),this.freq=e,this.similarity=n}}},7194:(t,e,n)=>{"use strict";n.d(e,{Mu:()=>b,zS:()=>N,SM:()=>M,qp:()=>T});var i=n(6082),o=n(144),r=n.n(o);class s extends Float32Array{}function a(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n]*t[n];return Math.sqrt(e)}var l=n(2738),u=n(439);class c{static makePalette(t,e=!1,n=c){const i={};return t.forEach((t=>{const n=t[0],o=t[1];n.forEach(((t,n)=>{i[t]=this.colourPalette[o][e?0:n]}))})),new n(i)}constructor(t){this._palette=t}get(t,e){return this._palette[t]}}c.undefinedColor="rgb(100,100,100)",c.colourPalette={orange:["rgb(255,187,120)","rgb(245,167,100)","rgb(235,137,70)","rgb(205, 111, 71)"],all_green:["rgb(44,160,44)","rgb(74,160,74)","rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)","rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],all_blue:["rgb(31,119,180)","rgb(23,190,207)","rgb(122, 102, 189)","rgb(158,218,229)","rgb(141, 124, 217)","rgb(31, 120, 150)"],magenta:["rgb(162,106,192)","rgb(197,165,224)","rgb(208,113,218)"],red:["rgb(214,39,40)","rgb(255,152,150)"],st_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(31,119,180)"],dark_blue:["rgb(31,119,180)","rgb(31, 120, 150)"],light_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(108, 218, 229)","rgb(23,190,227)"],lilac_blue:["rgb(124,102,211)","rgb(149,134,217)","rgb(97, 81, 150)"],dark_green:["rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)"],green:["rgb(44,160,44)","rgb(74,160,74)"],light_green:["rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],st_green:["rgb(44,160,44)","rgb(152,223,138)","rgb(39, 174, 96)","rgb(74,160,74)"],pink:["rgb(247,182,210)"],brown:["rgb(140,86,75)","rgb(102, 62, 54)"],gray:["rgb(127,127,127)","rgb(199,199,199)","rgb(196,156,148)","rgb(222, 222, 180)"],yellow:["rgb(188,189,34)"],white:["rgb(230,230,230)"]};class d extends c{static get Lesk(){return void 0===this.lesk&&(this.lesk=this.makePalette([[["G","A","S","T"],"orange"],[["C","V","I","L","P","F","Y","M","W"],"all_green"],[["N","Q","H"],"magenta"],[["D","E"],"red"],[["K","R"],"all_blue"]],!1,d)),this.lesk}static get GrokGroups(){return void 0===this.grokGroups&&(this.grokGroups=this.makePalette([[["C","U"],"yellow"],[["G","P"],"red"],[["A","V","I","L","M","F","Y","W"],"all_green"],[["R","H","K"],"light_blue"],[["D","E"],"dark_blue"],[["S","T","N","Q"],"orange"]],!1,d)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new d({D:"#E60A0A",E:"#E60A0A",C:"#E6E600",M:"#E6E600",K:"#145AFF",R:"#145AFF",S:"#FA9600",T:"#FA9600",F:"#3232AA",Y:"#3232AA",N:"#00DCDC",Q:"#00DCDC",G:"#EBEBEB",L:"#0F820F",V:"#0F820F",I:"#0F820F",A:"#C8C8C8",W:"#B45AB4",H:"#8282D2",P:"#DC9682",others:"#BEA06E"})),this.rasMol}get(t){const e=t in d.aaSynonyms?d.aaSynonyms[t]:t;return super.get(e)}}d.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class f{static getPalette(t="grok"){switch(t){case"grok":return d.GrokGroups;case"lesk":return d.Lesk;default:throw new Error(`ChemPalette: scheme \`${t}\` does not exist`)}}static getInnerOuter(t){let e=0,n="",i="";for(const o of t)"("==o?e++:")"==o?e--:e?n+=o:i+=o;return isNaN(parseInt(n))?[i,n]:[i,""]}static getColorAAPivot(t="",e="grok"){const n=this.getPalette(e);let[i,o]=this.getInnerOuter(t);if(i=i.length>6?`${i.slice(0,3)}...`:i,o=o.length>6?`${o.slice(0,3)}...`:o,1==t.length||"("==t[1]){const e=t[0]?.toUpperCase();return e in n?[n.get(e),e,o,1]:[this.undefinedColor,i,o,1]}if("d"==t[0]&&t[1]in n&&(2==t.length||"("==t[2])){const e=t[1]?.toUpperCase();return e in n?[n.get(e),e,o,2]:[this.undefinedColor,i,o,2]}if(t.substring(0,3)in this.AAFullNames&&(3==t.length||"("==t[3])){const e=this.AAFullNames[t.substring(0,3)];return e in n?[n.get(e),e,o,3]:[this.undefinedColor,i,o,3]}if(t[0]?.toLowerCase()==t[0]&&t.substring(1,3)in this.AAFullNames&&(4==t.length||"("==t[4])){const e=this.AAFullNames[t.substring(1,3)];return e in n?[n.get(e),e,o,4]:[this.undefinedColor,i,o,4]}return[this.undefinedColor,i,o,0]}}f.SemType="Aminoacids",f.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",f.undefinedColor="rgb(100,100,100)",f.Names={G:"Glycine",L:"Leucine",Y:"Tyrosine",S:"Serine",E:"Glutamic acid",Q:"Glutamine",D:"Aspartic acid",N:"Asparagine",F:"Phenylalanine",A:"Alanine",K:"Lysine",R:"Arginine",H:"Histidine",C:"Cysteine",V:"Valine",P:"Proline",W:"Tryptophan",I:"Isoleucine",M:"Methionine",T:"Threonine"},f.AASmiles={G:"NCC(=O)O",L:"N[C@H](CC(C)C)C(=O)O",Y:"NC(CC1=CC=C(O)C=C1)C(=O)O",S:"NC(CO)C(=O)O",E:"N[C@@H](CCC(O)=O)C(=O)O",Q:"N[C@@H](CCC(N)=O)C(=O)O",D:"N[C@@H](CC(O)=O)C(=O)O",N:"N[C@@H](CC(N)=O)C(=O)O",F:"NC(CC1=CC=CC=C1)C(=O)O",A:"N[C@H](C)C(=O)O",K:"NC(CCCCN)C(=O)O",R:"N[C@H](CCCNC(=N)C)C(=O)O",H:"NC(CC1=CN=C[N]1)C(=O)O",C:"N[C@@H](CS)C(=O)O",V:"NC(C(C)C)C(=O)O",P:"N(CCC1)C1C(=O)O",W:"N[C@@H](Cc1c2ccccc2n([H])c1)C(=O)O",I:"N[C@H]([C@H](C)CC)C(=O)O",M:"NC(CCSC)C(=O)O",T:"NC(C(O)C)C(=O)O"},f.AASmilesTruncated={G:"*C*",L:"CC(C)C[C@H](*)*",Y:"C1=CC(=CC=C1CC(*)*)O",S:"OCC(*)C*",E:"*[C@@H](CCC(O)=O)*",Q:"*N[C@@H](CCC(N)=O)*",D:"*[C@@H](CC(O)=O)*",N:"*[C@@H](CC(N)=O)*",F:"C1=CC=C(C=C1)CC(*)*",A:"C[C@H](*)*",K:"C(CCN)CC(*)*",R:"*[C@H](CCCNC(=N)C)*",H:"C1=C(NC=N1)CC(*)*",C:"C([C@@H](*)*)S",V:"CC(C)C(*)*",P:"C1CCN(*)C1*",W:"*[C@@H](Cc1c2ccccc2n([H])c1)*",I:"CC[C@H](C)[C@H](*)*",M:"CSCCC(*)*",T:"CC(O)C(*)*"},f.AAFullNames={Ala:"A",Arg:"R",Asn:"N",Asp:"D",Cys:"C",Gln:"Q",Glu:"E",Gly:"G",His:"H",Ile:"I",Leu:"L",Lys:"K",Met:"M",Phe:"F",Pro:"P",Ser:"S",Thr:"T",Trp:"W",Tyr:"Y",Val:"V"};class h extends c{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new h({A:"green",C:"blue",G:"black",T:"red",U:"red",others:"gray"})),this.chromatogram}}class m{}m.SemType="Nucleotides",m.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",m.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"};var g=n(4971);function p(t,e=!0){if(null==t)return"rgb(100,100,100)";const n=i.Color.fromHtml(t);if(e){const t=i.Color.g(n),e=i.Color.r(n),o=i.Color.b(n),r=Math.sqrt(Math.pow(0-e,2)+Math.pow(0-t,2)+Math.pow(0-o,2));if(r>210)return`rgb(${e/r*210},${t/r*210},${o/r*210})`}return i.Color.toRgb(n)}class v{static hashCode(t){let e=0;if(0===t.length)return e;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return e}}class y{}class C extends y{get(t,e){return"#666666"}}class w extends y{static get palette(){return w._pallete||(w._pallete=w.buildPalette()),w._pallete}static buildPalette(){return(0,g.pj)().then((t=>{t.awaitLoaded(1/0).then((()=>{const e=t.getMonomerLib();e.onChanged.subscribe((()=>{w.customMonomerColors={},w.polymerTypes=e.getPolymerTypes();for(const t of this.polymerTypes){const n=e.getMonomerSymbolsByType(t);for(const i of n){const n=e.getMonomer(t,i);n?.meta?.colors?.default?.background&&(this.customMonomerColors[i]||(this.customMonomerColors[i]={}),this.customMonomerColors[i][t]=p(n.meta.colors.default.background))}}}))}))})),[].concat(...Object.values(c.colourPalette))}get(t,e){const n=w.palette.length,i=w.customMonomerColors[t],o=e??"PEPTIDE";if(i&&i[o])return i[o];const r=v.hashCode(t)%n;return p(w.palette[r])}}w._pallete=null,w.customMonomerColors={},w.polymerTypes=[];class A extends c{static get Gray(){return void 0===this.gray&&(this.gray=new C),this.gray}static get Color(){return void 0===this.color&&(this.color=new w),this.color}}n(3981);class b{get length(){return this.mList.length}get graphInfo(){}isGap(t){return this.getOriginal(t)===this.gapOriginalMonomer}getCanonical(t){if(this.length<=t)throw new Error("Index out of bounds");const e=this.mList[t];return e!==this.gapOriginalMonomer?e:u._S}getOriginal(t){if(this.length<=t)throw new Error("Index out of bounds");return this.mList[t]}getCanonicalRegion(t,e){const n=Math.min(Math.max(0,t),this.length),i=Math.max(Math.min(this.length,e),0)-n,o=this.gapOriginalMonomer;return new Array(i).fill(null).map(((t,e)=>{const i=this.mList[e+n];return i===o?u._S:i}))}getOriginalRegion(t,e){const n=Math.min(Math.max(0,t),this.length),i=Math.max(Math.min(this.length,e),0);return new Array(i-n).fill(null).map(((t,e)=>this.mList[e+n]))}get gapOriginal(){return this.gapOriginalMonomer}constructor(t,e){this.mList=t,this.gapOriginalMonomer=e}}class S extends b{constructor(t,e,n,i){super(t.flat(),i),this.mListSeparated=t,this.connections=e,this._graphInfo=void 0,this.polymerTypes=t.map(((t,e)=>new Array(t.length).fill(n[e]))).flat()}get graphInfo(){return this._graphInfo??(this._graphInfo=this.parseConnections()),this._graphInfo}parseConnections(){const t={connections:[],disjointSeqStarts:[],polymerTypes:this.polymerTypes};if((this.connections?.length??0)>0){let e=0;for(let n=0;n<this.mListSeparated.length;++n)t.disjointSeqStarts.push(e),e+=this.mListSeparated[n].length;const n=(this.connections??"").split("|").filter((t=>(t?.length??0)>0)),i=/^(PEPTIDE|RNA|BLOB|CHEM)\d{1,2}$/,o=/^\d{1,2}:R\d{1}-\d{1,2}:R\d{1}$/;for(const e of n){const n=e.split(",");if(3!==n.length||!o.test(n[2])||!i.test(n[0])||!i.test(n[1]))continue;const r=parseInt(n[0].replace(/^(PEPTIDE|RNA|BLOB|CHEM)/,""))-1,s=parseInt(n[1].replace(/^(PEPTIDE|RNA|BLOB|CHEM)/,""))-1,a=n[0].replace(/\d{1,2}$/,""),l=n[1].replace(/\d{1,2}$/,"");if(r<0||r>=this.mListSeparated.length||s<0||s>=this.mListSeparated.length)continue;const u=n[2].split("-");if(2!==u.length)continue;const c=u[0].split(":"),d=u[1].split(":");if(2!==c.length||2!==d.length)continue;const f=parseInt(c[0])-1,h=parseInt(d[0])-1;f<0||f>=this.mListSeparated[r].length||h<0||h>=this.mListSeparated[s].length||t.connections.push({seq1Type:a,seq2Type:l,seqIndex1:r,seqIndex2:s,monomerIndex1:f,monomerIndex2:h,rGroup1:parseInt(c[1].substring(1)),rGroup2:parseInt(d[1].substring(1))})}}return t}}const E=t=>{const e=r()(t.toString().matchAll(u.B5)).map((t=>t[2]??t[1])).toArray();return new b(e,u.b9[u.Hi.FASTA])},T=t=>{const e=t.split("$"),n=e[0].split("|"),i=n.map((t=>(t.match(/(?<=\{).+(?=})/)?.[0]?.split(".")??[]).map((t=>{return(e=t).startsWith("[")&&e.endsWith("]")?e.slice(1,-1):e;var e})))),o=n.map((t=>t.replace(/\d{1,2}\{.+\}/,"")));return new S(i,e[1]??"",o,u.b9[u.Hi.HELM])},x=/([^\W_]+)/g;function N(t,e){if(t.length<=e)return t;const n=t.match(x),i=t.length>e||(n?.length??0)>1,o=n?.[0]??" ";return i?o.substring(0,e-1)+"…":o}function _(t,e,n="-"){const i=e.map((e=>{const i=function(t,e,n="-"){const i=new Set([...new Set(Object.keys(t)),...e]);i.delete(n);const o=[],r=[];for(const n of i)o.push(n in t?t[n]:0),r.push(e.has(n)?1:0);const l=new s(o),u=new s(r);return function(t,e){if(t.length!=e.length)throw new Error("The dimensionality of the vectors must match");let n=0;for(let i=0;i<t.length;i++)n+=t[i]*e[i];return n}(l,u)/(a(l)*a(u))}(t,e.alphabet,n);return new l.X(e,t,i)}));let o;const r=Math.max(...i.map((t=>t.similarity>t.cutoff?t.similarity:-1)));return o=r>0?i.find((t=>t.similarity===r)).name:u.YI.UN,o}function M(t,e,n=5){let o;if(t.semType==i.SEMTYPE.MACROMOLECULE)o=e.getSeqHandler(t).alphabet;else{const e=function(t,e,n){const i=t.categories;return function(t,e){const n={};let i=!0,o=null;for(const r of t)if(null==o?o=r.length:r.length!==o&&(i=!1),r.length>=e)for(let t=0;t<r.length;++t){const e=r.getCanonical(t);e in n||(n[e]=0),n[e]+=1}return{freq:n,sameLength:i}}(r().enumerate(t.getRawData()).map((([t,e])=>n(i[t]))),e)}(t,n,E);o=_(e.freq,u.q7)}return function(t){switch(t){case u.YI.PT:return d.GrokGroups;case u.YI.DNA:case u.YI.RNA:return h.Chromatogram;default:return A.Color}}(o)}},3077:(t,e,n)=>{"use strict";n.d(e,{R:()=>o});var i=n(6082);function o(t,e){const n=t=>{const e=s.columns.addNewString((t+1).toString());return o.push(e),e},o=[],r=t.length,s=i.DataFrame.create(r),a=e.getSeqHandler(t);for(let t=0;t<r;++t){const e=a.getSplitted(t);for(let i=0;i<e.length;++i){const r=e.getCanonical(i);((o[i]??null)||n(i)).set(t,r,!1)}}return s}},4326:(t,e,n)=>{"use strict";n.d(e,{P4:()=>s,fH:()=>o});var i,o,r,s,a,l,u=n(6082);!function(t){t.tooltipWebLogo=".tooltipWebLogo"}(i||(i={})),function(t){t.Entropy="Entropy",t.full="100%"}(o||(o={})),function(t){t.TOP="top",t.MIDDLE="middle",t.BOTTOM="bottom"}(r||(r={})),function(t){t.LEFT="left",t.CENTER="center",t.RIGHT="right"}(s||(s={})),function(t){t.AUTO="auto",t.ON="on",t.OFF="off"}(a||(a={})),function(t){t.Filtered="Filtered",t.Selected="Selected"}(l||(l={})),new class{constructor(){this.sequenceColumnName=null,this.valueAggrType=u.AGG.TOTAL_COUNT,this.valueColumnName="Activity",this.startPositionName=null,this.endPositionName=null,this.skipEmptySequences=!0,this.skipEmptyPositions=!1,this.shrinkEmptyTail=!0,this.backgroundColor=4294967295,this.positionHeight=o.Entropy,this.positionWidth=20,this.verticalAlignment=r.MIDDLE,this.horizontalAlignment=s.CENTER,this.fixWidth=!1,this.fitArea=!0,this.minHeight=25,this.maxHeight=300,this.maxMonomerLetters=5,this.showPositionLabels=!0,this.positionMarginState=a.AUTO,this.positionMargin=0,this.filterSource=l.Filtered}}},5540:(t,e,n)=>{"use strict";t=n.hmd(t);var i,o=(i="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t={}){var e,n,o=void 0!==t?t:{};o.ready=new Promise((function(t,i){e=t,n=i}));var r,s=Object.assign({},o),a="object"==typeof window,l="function"==typeof importScripts,u=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(a||l)&&(l?u=self.location.href:"undefined"!=typeof document&&document.currentScript&&(u=document.currentScript.src),i&&(u=i),u=0!==u.indexOf("blob:")?u.substr(0,u.replace(/[?#].*/,"").lastIndexOf("/")+1):"",l&&(r=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)})),o.print||console.log.bind(console);var c,d,f=o.printErr||console.warn.bind(console);Object.assign(o,s),s=null,o.arguments&&o.arguments,o.thisProgram&&o.thisProgram,o.quit&&o.quit,o.wasmBinary&&(c=o.wasmBinary),o.noExitRuntime,"object"!=typeof WebAssembly&&E("no native wasm support detected");var h,m,g,p=!1;function v(){var t=d.buffer;o.HEAP8=h=new Int8Array(t),o.HEAP16=new Int16Array(t),o.HEAP32=new Int32Array(t),o.HEAPU8=m=new Uint8Array(t),o.HEAPU16=new Uint16Array(t),o.HEAPU32=g=new Uint32Array(t),o.HEAPF32=new Float32Array(t),o.HEAPF64=new Float64Array(t)}var y=[],C=[],w=[],A=0,b=null,S=null;function E(t){o.onAbort&&o.onAbort(t),f(t="Aborted("+t+")"),p=!0,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw n(e),e}var T,x;function N(t){return t.startsWith("data:application/octet-stream;base64,")}function _(t){try{if(t==T&&c)return new Uint8Array(c);if(r)return r(t);throw"both async and sync fetching of the wasm failed"}catch(t){E(t)}}function M(t,e,n){return function(t){return c||!a&&!l||"function"!=typeof fetch?Promise.resolve().then((function(){return _(t)})):fetch(t,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+t+"'";return e.arrayBuffer()})).catch((function(){return _(t)}))}(t).then((function(t){return WebAssembly.instantiate(t,e)})).then((function(t){return t})).then(n,(function(t){f("failed to asynchronously prepare wasm: "+t),E(t)}))}function O(t){for(;t.length>0;)t.shift()(o)}function I(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){g[this.ptr+4>>2]=t},this.get_type=function(){return g[this.ptr+4>>2]},this.set_destructor=function(t){g[this.ptr+8>>2]=t},this.get_destructor=function(){return g[this.ptr+8>>2]},this.set_caught=function(t){t=t?1:0,h[this.ptr+12|0]=t},this.get_caught=function(){return 0!=h[this.ptr+12|0]},this.set_rethrown=function(t){t=t?1:0,h[this.ptr+13|0]=t},this.get_rethrown=function(){return 0!=h[this.ptr+13|0]},this.init=function(t,e){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(e)},this.set_adjusted_ptr=function(t){g[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return g[this.ptr+16>>2]},this.get_exception_ptr=function(){if(H(this.get_type()))return g[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}function L(t){var e=d.buffer;try{return d.grow(t-e.byteLength+65535>>>16),v(),1}catch(t){}}function P(t){return o["_"+t]}N(T="wasmDbscan.wasm")||(x=T,T=o.locateFile?o.locateFile(x,u):u+x);var R="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function k(t,e,n,i,o){var r={string:t=>{var e=0;return null!=t&&0!==t&&(e=function(t){var e=function(t){for(var e=0,n=0;n<t.length;++n){var i=t.charCodeAt(n);i<=127?e++:i<=2047?e+=2:i>=55296&&i<=57343?(e+=4,++n):e+=3}return e}(t)+1,n=U(e);return function(t,e,n){!function(t,e,n,i){if(!(i>0))return 0;for(var o=n+i-1,r=0;r<t.length;++r){var s=t.charCodeAt(r);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&t.charCodeAt(++r)),s<=127){if(n>=o)break;e[n++]=s}else if(s<=2047){if(n+1>=o)break;e[n++]=192|s>>6,e[n++]=128|63&s}else if(s<=65535){if(n+2>=o)break;e[n++]=224|s>>12,e[n++]=128|s>>6&63,e[n++]=128|63&s}else{if(n+3>=o)break;e[n++]=240|s>>18,e[n++]=128|s>>12&63,e[n++]=128|s>>6&63,e[n++]=128|63&s}}e[n]=0}(t,m,e,n)}(t,n,e),n}(t)),e},array:t=>{var e,n,i=U(t.length);return e=t,n=i,h.set(e,n),i}},s=P(t),a=[],l=0;if(i)for(var u=0;u<i.length;u++){var c=r[n[u]];c?(0===l&&(l=F()),a[u]=c(i[u])):a[u]=i[u]}var d=s.apply(null,a);return function(t){return 0!==l&&G(l),function(t){return"string"===e?(n=t)?function(t,e,n){for(var i=e+n,o=e;t[o]&&!(o>=i);)++o;if(o-e>16&&t.buffer&&R)return R.decode(t.subarray(e,o));for(var r="";e<o;){var s=t[e++];if(128&s){var a=63&t[e++];if(192!=(224&s)){var l=63&t[e++];if((s=224==(240&s)?(15&s)<<12|a<<6|l:(7&s)<<18|a<<12|l<<6|63&t[e++])<65536)r+=String.fromCharCode(s);else{var u=s-65536;r+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else r+=String.fromCharCode((31&s)<<6|a)}else r+=String.fromCharCode(s)}return r}(m,n,i):"":"boolean"===e?Boolean(t):t;var n,i}(t)}(d)}var V,D={__cxa_throw:function(t,e,n){throw new I(t).init(e,n),t},abort:function(){E("")},emscripten_memcpy_big:function(t,e,n){m.copyWithin(t,e,e+n)},emscripten_resize_heap:function(t){var e,n=m.length,i=2147483648;if((t>>>=0)>i)return!1;for(var o=1;o<=4;o*=2){var r=n*(1+.2/o);if(r=Math.min(r,t+100663296),L(Math.min(i,(e=Math.max(t,r))+(65536-e%65536)%65536)))return!0}return!1}},F=(function(){var t,e,i,r,s={env:D,wasi_snapshot_preview1:D};function a(t,e){var n,i=t.exports;return o.asm=i,d=o.asm.memory,v(),o.asm.__indirect_function_table,n=o.asm.__wasm_call_ctors,C.unshift(n),function(t){if(A--,o.monitorRunDependencies&&o.monitorRunDependencies(A),0==A&&(null!==b&&(clearInterval(b),b=null),S)){var e=S;S=null,e()}}(),i}if(A++,o.monitorRunDependencies&&o.monitorRunDependencies(A),o.instantiateWasm)try{return o.instantiateWasm(s,a)}catch(t){f("Module.instantiateWasm callback failed with error: "+t),n(t)}(t=c,e=T,i=s,r=function(t){a(t.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||N(e)||"function"!=typeof fetch?M(e,i,r):fetch(e,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,i).then(r,(function(t){return f("wasm streaming compile failed: "+t),f("falling back to ArrayBuffer instantiation"),M(e,i,r)}))}))).catch(n)}(),o._dbscan=function(){return(o._dbscan=o.asm.dbscan).apply(null,arguments)},o._malloc=function(){return(o._malloc=o.asm.malloc).apply(null,arguments)},o._free=function(){return(o._free=o.asm.free).apply(null,arguments)},function(){return(F=o.asm.stackSave).apply(null,arguments)}),G=function(){return(G=o.asm.stackRestore).apply(null,arguments)},U=function(){return(U=o.asm.stackAlloc).apply(null,arguments)},H=function(){return(H=o.asm.__cxa_is_pointer_type).apply(null,arguments)};function q(){function t(){V||(V=!0,o.calledRun=!0,p||(O(C),e(o),o.onRuntimeInitialized&&o.onRuntimeInitialized(),function(){if(o.postRun)for("function"==typeof o.postRun&&(o.postRun=[o.postRun]);o.postRun.length;)t=o.postRun.shift(),w.unshift(t);var t;O(w)}()))}A>0||(function(){if(o.preRun)for("function"==typeof o.preRun&&(o.preRun=[o.preRun]);o.preRun.length;)t=o.preRun.shift(),y.unshift(t);var t;O(y)}(),A>0||(o.setStatus?(o.setStatus("Running..."),setTimeout((function(){setTimeout((function(){o.setStatus("")}),1),t()}),1)):t()))}if(o.ccall=k,o.cwrap=function(t,e,n,i){var o=!n||n.every((t=>"number"===t||"boolean"===t));return"string"!==e&&o&&!i?P(t):function(){return k(t,e,n,arguments)}},S=function t(){V||q(),V||(S=t)},o.preInit)for("function"==typeof o.preInit&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();return q(),t.ready});"object"==typeof exports?t.exports=o:"function"==typeof define&&n.amdO?define([],(function(){return o})):"object"==typeof exports&&(exports.exportCppDbscanLib=o)},4329:(t,e,n)=>{"use strict";n.d(e,{_:()=>r});var i=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};let o=null;function r(){return i(this,void 0,void 0,(function*(){if(!navigator.gpu)return console.error("WebGPU is not supported in this browser"),null;if(!o&&(o=yield navigator.gpu.requestAdapter(),null==o))return null;let t=null;return"info"in o&&(t=o.info),t?s(t.description,s(t.vendor,"No GPU description available")):"No GPU description available"}))}function s(t,e){return t&&""!=t?t:e}},1199:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});new Uint32Array(65536);var i;!function(t){t.HAMMING="Hamming",t.LEVENSHTEIN="Levenshtein",t.NEEDLEMANN_WUNSCH="Needlemann-Wunsch",t.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance"}(i||(i={})),i.HAMMING,i.LEVENSHTEIN,i.NEEDLEMANN_WUNSCH,i.MONOMER_CHEMICAL_DISTANCE},8774:(t,e,n)=>{"use strict";n.d(e,{A:()=>i});class i{constructor(t,e=!1){if(this._length=0,this._version=0,this._updateLevel=0,this._selectedCount=0,this._selectedCountVersion=-1,this._selectedIndexesVersion=-1,this._versionedName="",this._versionedNameVersion=-1,this.SHRINK_THRESHOLD=256,"number"==typeof t){const n=t,o=i._createBuffer(n);if(e)for(let t=0;t<o.length;t++)o[t]=-1;this._data=o,this._length=n}else{if(!(t instanceof Uint32Array))throw new Error("Invalid constructor");this._data=t,this._length=e}}getRawData(){return this._data}assureGoez(t,e){if(t<0)throw new Error(`${e} should be greater than zero`)}assureInRange(t,e,n,i){if(t<e||t>n)throw new Error(`Argument ${i} (${t}) out of range (${e}, ${n})`)}copy(t,e,n){for(let i=0;i<n;i++)e[i]=t[i]}copyFrom(t){if(this._length!=t._length)throw new Error(`Lengths differ (${this._length} != ${t._length})`);this.copy(t._data,this._data,this.lengthInInts),this._version++}get length(){return this._length}get buffer(){return this._data}set buffer(t){this._data=t,this._version++}get version(){return this._version}set version(t){this._version=t}incrementVersion(t=!0){this._version++}get lengthInInts(){return Math.floor((this._length+31)/32)}get versionedName(){return this._version==this._versionedNameVersion?this._versionedName:""}set versionedName(t){this._versionedName=t,this._versionedNameVersion=this._version}get self(){return this}setLength(t){if(t<0)throw new Error("should be >= 0");if(t==this._length)return;const e=Math.floor((t+31)/32);if(e>this._data.length||e+this.SHRINK_THRESHOLD<this._data.length){const t=new Uint32Array(e);this.copy(this._data,t,e>this._data.length?this._data.length:e),this._data=t}t>this._length&&(this._length%32>0&&(this._data[this.lengthInInts-1]&=(1<<(this._length%32&31))-1),this._data.fill(0,this.lengthInInts,e)),this._length=t,this._version++}static fromAnd(t,e){if(t._length!=e._length)throw new Error(`Lengths differ (${t._length} != ${e._length})`);const n=new i(t._length);n._length=t._length,n._data=i._createBuffer(n._length),n._version=0;const o=t.lengthInInts;for(let i=0;i<o;i++)n._data[i]=t._data[i]&e._data[i];return n}static _createBuffer(t){return new Uint32Array(Math.floor((t+31)/32))}static fromValues(t){const e=new i(t.length);e._version=0;for(let n=0;n<e._length;n++)t[n]&&(e._data[Math.floor(n/32)]|=1<<(n%32&31));return e}static fromSeq(t,e){const n=new i(t);for(let i=0;i<t;++i)n.setBit(i,e(i));return n._version=0,n}static fromString(t){return i.fromSeq(t.length,(e=>"1"==t.charAt(e)))}static fromUint32Array(t,e){const n=new i(t);return n._data=e,n}static fromBytes(t){const e=t.length,n=new i(8*e);n._data=new Uint32Array(Math.floor((e+3)/4)),n._length=8*e;let o=0,r=0;for(;e-r>=4;)n._data[o++]=255&t[r]|(255&t[r+1])<<8|(255&t[r+2])<<16|(255&t[r+3])<<24,r+=4;return e-r==3&&(n._data[o]=(255&t[r+2])<<16),e-r==2&&(n._data[o]|=(255&t[r+1])<<8),e-r==1&&(n._data[o]|=255&t[r]),n._version=0,n}toString(){return`${this._length} bits, ${this.countBits(!0)} set`}equals(t){if(this==t)return!0;if(null==t)return!1;if(this._length!=t._length)return!1;if(0==this._length)return!0;for(let e=0;e<this._data.length-1;e++)if(this._data[e]!=t._data[e])return!1;for(let e=8*(this._data.length-1);e<this._length;e++)if(this.getBit(e)!=t.getBit(e))return!1;return!0}clone(){const t=new i(0,!1);return t._data=Uint32Array.from(this._data),t._length=this._length,t._version=this._version,t}init(t,e){this.setAll(!1,!1);for(let e=0;e<this._length;e++)t(e)&&(this._data[Math.floor(e/32)]|=1<<(e%32&31));return this.incrementVersion(e),this}invert(t=!0){for(let t=0;t<this._data.length;t++)this._data[t]^=-1;this.incrementVersion(t)}setAll(t,e=!1){const n=t?-1:0,i=this.lengthInInts;for(let t=0;t<i;t++)this._data[t]=n;this.incrementVersion(e)}setIndexes(t,e=!0,n=!0,i=!0){n&&this.setAll(!e,!1);for(const n of t)this.setFast(n,e);this.incrementVersion(i)}everyIndex(t,e=!0){for(const n of t)if(this.getBit(n)!=e)return!1;return!0}anyIndex(t,e=!0){for(const n of t)if(this.getBit(n)==e)return!0;return!1}setWhere(t,e=!0,n=!0,i=!0,o=!0){if(n&&o&&this.setAll(!e,!1),o)for(let n=0;n<this._length;n++)t(n)&&this.setFast(n,e);else for(let n=0;n<this._length;n++)this.setFast(n,t(n)?e:!e);this.incrementVersion(i)}getRange(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let i=t;i<e;++i)n.push(this.getBit(i));return i.fromValues(n)}getRangeAsList(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let i=t;i<e;++i)n.push(this.getBit(i));return n}setRange(t,e,n,i=!0){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length-1,"to");const o=Math.min(t,e),r=Math.max(t,e);if(n)for(let t=o;t<=r;t++)this.setTrue(t);else for(let t=o;t<=r;t++)this.setFalse(t);return this.incrementVersion(i),this}setRandom(t,e,n=!0){if(t<0||t>this._length)throw new Error("n must be >= 0 && <= Count");t>this._length/2&&this.setRandom(this._length-t,!e),this.setAll(!e);for(let n=0;n<t;){const t=Math.floor(Math.random()*this._length);this.getBit(t)!=e&&(this.setFast(t,e),n++)}this.incrementVersion(n)}and(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]&=t._data[e];return this.incrementVersion(e),this}andNot(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");const n=this.lengthInInts;for(let e=0;e<n;e++)this._data[e]&=~t._data[e];return this.incrementVersion(e),this}notAnd(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]=~this._data[e]&t._data[e];return this.incrementVersion(e),this}not(t=!0){for(let t=0,e=this.lengthInInts;t<e;t++)this._data[t]=~this._data[t];return this.incrementVersion(t),this}or(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]|=t._data[e];return this.incrementVersion(e),this}xor(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]^=t._data[e];return this.incrementVersion(e),this}insertAt(t,e,n=!1){if(this.assureInRange(t,0,this._length,"pos"),0==e)return;const i=this._length;this.setLength(this._length+e);for(let n=i-1;n>=t;n--)this.setBit(n+e,this.getBit(n));for(let i=t;i<t+e;i++)this.setBit(i,n)}removeAt(t,e=1){if(e<0)throw new Error("n cannot be negative");if(this.assureInRange(t,0,this._length-e,"pos"),this.contains(!0))for(let n=t;n<this._length-e;n++)this.setBit(n,this.getBit(n+e));this.setLength(this._length-e)}removeByMask(t,e=!0){if(this._length!=t.length)throw new Error("length != mask.length");if(t==this)this.setLength(t.countBits(!e)),this.setAll(!e);else{let n=0;for(let i=-1;-1!=(i=t.findNext(i,!e));)this.setFast(n++,this.getBit(i));this._length=n,this._version++}return this}getBit(t){return!!(this._data[Math.floor(t/32)]&1<<(31&t))}setBit(t,e,n=!0){this.setFast(t,e),this._version++}setFast(t,e){e?this._data[Math.floor(t/32)]|=1<<(31&t):this._data[Math.floor(t/32)]&=~(1<<(31&t))}setTrue(t){this._data[Math.floor(t/32)]|=1<<(31&t)}setFalse(t){this._data[Math.floor(t/32)]&=~(1<<(31&t))}trueCount(){return this.countBits(!0)}falseCount(){return this.countBits(!1)}countBits(t){if(0==this._length)return 0;if(this._selectedCountVersion!=this._version){this._selectedCount=0;const t=this.lengthInInts;let e=0;for(;e<t-1;e++)for(let t=this._data[e];0!=t;t>>>=8)this._selectedCount+=i._onBitCount[255&t];let n=this._data[e];const o=31&this._length;for(0!=o&&(n&=~(4294967295<<o));0!=n;n>>>=8)this._selectedCount+=i._onBitCount[255&n];this._selectedCountVersion=this._version}return t?this._selectedCount:this._length-this._selectedCount}countWhere(t){let e=0;if(this.trueCount()==this._length)for(let n=0;n<this._length;n++)e+=t(n)?1:0;else for(let n=-1;-1!=(n=this.findNext(n,!0));)e+=t(n)?1:0;return e}andWithCountBits(t,e){if(0==this._length)return 0;let n=0;const o=this.lengthInInts;let r=0;for(;r<o-1;r++)for(let e=this._data[r]&t._data[r];0!=e;e>>>=8)n+=i._onBitCount[255&e];let s=this._data[r]&t._data[r];const a=31&this._length;for(0!=a&&(s&=~(4294967295<<a));0!=s;s>>>=8)n+=i._onBitCount[255&s];return e?n:this._length-n}clear(){this.setLength(0)}contains(t){return this.findNext(-1,t)>=0}get allTrue(){return this.countBits(!0)==this._length}get allFalse(){return this.countBits(!1)==this._length}get anyTrue(){return this.countBits(!0)>0}get anyFalse(){return this.countBits(!1)>0}findNext(t,e=!0){if(this.assureInRange(t,-1,this._length,"index"),t>=this._length-1)return-1;let n=31&(t=t<0?0:t+1);const o=this.lengthInInts;for(let r=Math.floor(t/32);r<o;r++){let o=e?this._data[r]:~this._data[r];if(0!=n)o&=4294967295<<n&4294967295,n=0;else if(!e&&-4294967296==o)continue;for(let e=0;0!=o;e+=8,o>>>=8){const n=i._firstOnBit[255&o];if(n>=0)return(t=n+32*r+e)>=this._length?-1:t}}return-1}findPrev(t,e=!0){if(0==t)return-1;this.assureInRange(t,-1,this._length,"index");let n=1+(t=t<0?this._length-1:t-1)&31;for(let o=Math.floor(t/32);o>=0;o--){let t=e?this._data[o]:~this._data[o];0!=n&&(t&=~(4294967295<<n),n=0);for(let e=24;0!=t;e-=8,t<<=8){const n=i._lastOnBit[t>>>24];if(n>=0)return n+32*o+e}}return-1}}i._onBitCount=Int8Array.from([0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8]),i._firstOnBit=Int8Array.from([-1,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0]),i._lastOnBit=Int8Array.from([-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7])},8070:(t,e,n)=>{"use strict";n.d(e,{Pl:()=>V,bk:()=>$,gM:()=>k,L1:()=>R,cb:()=>Y,E3:()=>L,Wj:()=>P,Xb:()=>F,N$:()=>G,t6:()=>I,PE:()=>M,rd:()=>O,Bl:()=>z,CN:()=>C});var i=n(4328),o=n(6082);n(9982);const r=o.DataFrame.fromCsv('countries,fasta,smiles,molregno,LON,Zip Code,Street Address Line 1,ImageUrl,user_id,error_message,xray,flag,magnitude,CS-id,pdb_id,accel_a,time_offset,chart,fit,Questions,empty_number,empty_string\nBelgium,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C(=O)OCCCc1cccnc1)c2cccc(c2)C(=O)c3ccccc3,1480014,36.276729583740234,995042300,14016 ROUTE 31W,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,1,1,1QBS,1,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.497360340644872, 1.7058694986686864, 5.278052678195135, 0.16000320889028383],""points"":[{""x"":0.10000000149011612,""y"":2.374499797821045},{""x"":0.6000000238418579,""y"":2.6242473125457764},{""x"":1.100000023841858,""y"":2.367267608642578},{""x"":1.600000023841858,""y"":2.6723148822784424},{""x"":2.0999999046325684,""y"":2.6537344455718994},{""x"":2.5999999046325684,""y"":2.3651671409606934},{""x"":3.0999999046325684,""y"":2.5654284954071045},{""x"":3.5999999046325684,""y"":2.4160959720611572},{""x"":4.099999904632568,""y"":2.286726713180542},{""x"":4.599999904632568,""y"":2.5100042819976807},{""x"":5.099999904632568,""y"":1.6676985025405884},{""x"":5.599999904632568,""y"":0.680136501789093},{""x"":6.099999904632568,""y"":0.3391543924808502},{""x"":6.599999904632568,""y"":0.09038983285427094},{""x"":7.099999904632568,""y"":0.19802775979042053}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[7.525235855508179, 1.3186911876809984, 5.335672608564294, 0.7860743343958098],""points"":[{""x"":0.10000000149011612,""y"":7.988070487976074},{""x"":0.6000000238418579,""y"":7.018453121185303},{""x"":1.100000023841858,""y"":8.115279197692871},{""x"":1.600000023841858,""y"":7.486658096313477},{""x"":2.0999999046325684,""y"":7.396438121795654},{""x"":2.5999999046325684,""y"":7.477052211761475},{""x"":3.0999999046325684,""y"":6.913095474243164},{""x"":3.5999999046325684,""y"":8.01385498046875},{""x"":4.099999904632568,""y"":6.985900402069092},{""x"":4.599999904632568,""y"":6.970335960388184},{""x"":5.099999904632568,""y"":5.448817253112793},{""x"":5.599999904632568,""y"":2.5534818172454834},{""x"":6.099999904632568,""y"":1.893947958946228},{""x"":6.599999904632568,""y"":0.6340042352676392},{""x"":7.099999904632568,""y"":0.8403874039649963}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,100,abc\nBurundi,MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW,COc1ccc2cc(ccc2c1)C(C)C(=O)Oc3ccc(C)cc3OC,1480015,36.276729583740234,995073444,80 STATE HIGHWAY 310,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,2,2,1ZP8,2,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.431460753103398, 2.1691498799246745, 5.266445597102774, 0.7825762827017926],""points"":[{""x"":0.10000000149011612,""y"":4.751083850860596},{""x"":0.6000000238418579,""y"":4.203000068664551},{""x"":1.100000023841858,""y"":4.415858745574951},{""x"":1.600000023841858,""y"":4.68414306640625},{""x"":2.0999999046325684,""y"":4.198400974273682},{""x"":2.5999999046325684,""y"":4.179222106933594},{""x"":3.0999999046325684,""y"":4.638473987579346},{""x"":3.5999999046325684,""y"":4.708553314208984},{""x"":4.099999904632568,""y"":4.291589260101318},{""x"":4.599999904632568,""y"":4.038082599639893},{""x"":5.099999904632568,""y"":3.4349939823150635},{""x"":5.599999904632568,""y"":1.2194708585739136},{""x"":6.099999904632568,""y"":1.1920831203460693},{""x"":6.599999904632568,""y"":0.5352635979652405},{""x"":7.099999904632568,""y"":0.3346920311450958}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.339458017970126, -1.0734184310171178, 4.746332950550934, 0.2482416857595658],""points"":[{""x"":0.10000000149011612,""y"":0.2139337658882141},{""x"":0.6000000238418579,""y"":0.4269562065601349},{""x"":1.100000023841858,""y"":0.2441573292016983},{""x"":1.600000023841858,""y"":0.146635964512825},{""x"":2.0999999046325684,""y"":0.08818462491035461},{""x"":2.5999999046325684,""y"":0.2560656666755676},{""x"":3.0999999046325684,""y"":0.42434045672416687},{""x"":3.5999999046325684,""y"":0.37111231684684753},{""x"":4.099999904632568,""y"":0.5581737160682678},{""x"":4.599999904632568,""y"":1.183590054512024},{""x"":5.099999904632568,""y"":1.5629843473434448},{""x"":5.599999904632568,""y"":2.3211288452148438},{""x"":6.099999904632568,""y"":2.229961633682251},{""x"":6.599999904632568,""y"":2.2560226917266846},{""x"":7.099999904632568,""y"":2.2142398357391357}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCameroon,MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL,COc1ccc2cc(ccc2c1)C(C)C(=O)OCCCc3cccnc3,1480016,36.26095962524414,995153596,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,3,3,2BDJ,3,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.6760652578642325, 0.9046956320756703, 5.651408971856738, 0.07738846012184185],""points"":[{""x"":0.10000000149011612,""y"":4.32425594329834},{""x"":0.6000000238418579,""y"":4.668442249298096},{""x"":1.100000023841858,""y"":4.379785060882568},{""x"":1.600000023841858,""y"":5.0345139503479},{""x"":2.0999999046325684,""y"":4.878653526306152},{""x"":2.5999999046325684,""y"":4.3451313972473145},{""x"":3.0999999046325684,""y"":4.336992263793945},{""x"":3.5999999046325684,""y"":5.037430286407471},{""x"":4.099999904632568,""y"":5.0092692375183105},{""x"":4.599999904632568,""y"":4.151902675628662},{""x"":5.099999904632568,""y"":3.4066951274871826},{""x"":5.599999904632568,""y"":2.3732759952545166},{""x"":6.099999904632568,""y"":1.673728108406067},{""x"":6.599999904632568,""y"":0.48574790358543396},{""x"":7.099999904632568,""y"":0.2783052325248718}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.938395863010111, -1.4658480661392117, 5.462702751996584, 0.3473139023615039],""points"":[{""x"":0.10000000149011612,""y"":0.4941710829734802},{""x"":0.6000000238418579,""y"":0.15323974192142487},{""x"":1.100000023841858,""y"":0.46373432874679565},{""x"":1.600000023841858,""y"":0.3370431363582611},{""x"":2.0999999046325684,""y"":0.5179030299186707},{""x"":2.5999999046325684,""y"":0.27899765968322754},{""x"":3.0999999046325684,""y"":0.22075064480304718},{""x"":3.5999999046325684,""y"":0.5789918899536133},{""x"":4.099999904632568,""y"":0.21169911324977875},{""x"":4.599999904632568,""y"":0.27857646346092224},{""x"":5.099999904632568,""y"":1.0906332731246948},{""x"":5.599999904632568,""y"":1.8520300388336182},{""x"":6.099999904632568,""y"":2.7177059650421143},{""x"":6.599999904632568,""y"":2.8680918216705322},{""x"":7.099999904632568,""y"":3.2413077354431152}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCanada,MMELVLKTIIGPIVVGVVLRIVDKWLNKDK,CC(C(=O)NCCS)c1cccc(c1)C(=O)c2ccccc2,1480017,36.26095962524414,99515,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,4,4,1IAN,4,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[0.8597390975430008, 1.0957625732481946, 5.260537067987958, 0.07974187998177736],""points"":[{""x"":0.10000000149011612,""y"":0.8190152645111084},{""x"":0.6000000238418579,""y"":0.8421689867973328},{""x"":1.100000023841858,""y"":0.8740922212600708},{""x"":1.600000023841858,""y"":0.8924275040626526},{""x"":2.0999999046325684,""y"":0.8249067664146423},{""x"":2.5999999046325684,""y"":0.9327669143676758},{""x"":3.0999999046325684,""y"":0.8522974252700806},{""x"":3.5999999046325684,""y"":0.8174492716789246},{""x"":4.099999904632568,""y"":0.8394647240638733},{""x"":4.599999904632568,""y"":0.7139387726783752},{""x"":5.099999904632568,""y"":0.5561167597770691},{""x"":5.599999904632568,""y"":0.3276226818561554},{""x"":6.099999904632568,""y"":0.12479474395513535},{""x"":6.599999904632568,""y"":0.13006797432899475},{""x"":7.099999904632568,""y"":0.059702079743146896}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.760930219582546, 1.6591793293833013, 4.667155929720851, 0.7858109544121652],""points"":[{""x"":0.10000000149011612,""y"":6.156993389129639},{""x"":0.6000000238418579,""y"":5.236701965332031},{""x"":1.100000023841858,""y"":6.010560512542725},{""x"":1.600000023841858,""y"":5.495512962341309},{""x"":2.0999999046325684,""y"":6.087770462036133},{""x"":2.5999999046325684,""y"":5.79986572265625},{""x"":3.0999999046325684,""y"":5.597546577453613},{""x"":3.5999999046325684,""y"":5.520902156829834},{""x"":4.099999904632568,""y"":5.360654354095459},{""x"":4.599999904632568,""y"":3.5539746284484863},{""x"":5.099999904632568,""y"":1.577236294746399},{""x"":5.599999904632568,""y"":1.0001264810562134},{""x"":6.099999904632568,""y"":0.9305797815322876},{""x"":6.599999904632568,""y"":0.6033638715744019},{""x"":7.099999904632568,""y"":0.4203685522079468}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nColombia,MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN,FC(F)(F)c1ccc(OC2CCNCC2)cc1,1480029,36.3309440612793,995152050,1 COURT HOUSE SQUARE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,5,5,4UJ1,5,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[6.4995088314153655, 2.4270351004539914, 5.178659535348579, 0.625653346241577],""points"":[{""x"":0.10000000149011612,""y"":6.496231555938721},{""x"":0.6000000238418579,""y"":6.42543363571167},{""x"":1.100000023841858,""y"":7.040063858032227},{""x"":1.600000023841858,""y"":6.1115403175354},{""x"":2.0999999046325684,""y"":6.680728435516357},{""x"":2.5999999046325684,""y"":6.406774520874023},{""x"":3.0999999046325684,""y"":6.611269474029541},{""x"":3.5999999046325684,""y"":5.889094352722168},{""x"":4.099999904632568,""y"":6.75344705581665},{""x"":4.599999904632568,""y"":6.361435890197754},{""x"":5.099999904632568,""y"":4.1666975021362305},{""x"":5.599999904632568,""y"":1.172118902206421},{""x"":6.099999904632568,""y"":0.801048994064331},{""x"":6.599999904632568,""y"":0.4640021026134491},{""x"":7.099999904632568,""y"":0.0010357667924836278}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[1.4734381347446401, 1.1649805188074196, 4.82958608866421, 0.09500545496710007],""points"":[{""x"":0.10000000149011612,""y"":1.5279096364974976},{""x"":0.6000000238418579,""y"":1.3559974431991577},{""x"":1.100000023841858,""y"":1.5246378183364868},{""x"":1.600000023841858,""y"":1.5567657947540283},{""x"":2.0999999046325684,""y"":1.4114240407943726},{""x"":2.5999999046325684,""y"":1.4045010805130005},{""x"":3.0999999046325684,""y"":1.4769829511642456},{""x"":3.5999999046325684,""y"":1.4875500202178955},{""x"":4.099999904632568,""y"":1.2991987466812134},{""x"":4.599999904632568,""y"":0.922961413860321},{""x"":5.099999904632568,""y"":0.6520044803619385},{""x"":5.599999904632568,""y"":0.15350978076457977},{""x"":6.099999904632568,""y"":0.1078903079032898},{""x"":6.599999904632568,""y"":0.17276449501514435},{""x"":7.099999904632568,""y"":0.14066608250141144}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCosta Rica,MKSTKEEIQTIKTLLKDSRTAKYHKRLQIVL,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCCc3ccccc3,1480018,36.3309440612793,995084218,4041 SOUTHWESTERN BLVD,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,6,6,2BPW,6,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.4833641843311227, -1.8945978742090062, 4.671127708092568, 0.24159861311815153],""points"":[{""x"":0.10000000149011612,""y"":0.0969524160027504},{""x"":0.6000000238418579,""y"":0.028483040630817413},{""x"":1.100000023841858,""y"":0.22087176144123077},{""x"":1.600000023841858,""y"":0.0068915546871721745},{""x"":2.0999999046325684,""y"":0.4305879771709442},{""x"":2.5999999046325684,""y"":0.44774115085601807},{""x"":3.0999999046325684,""y"":0.45346319675445557},{""x"":3.5999999046325684,""y"":0.2370593100786209},{""x"":4.099999904632568,""y"":0.4657953977584839},{""x"":4.599999904632568,""y"":1.155200719833374},{""x"":5.099999904632568,""y"":2.2294070720672607},{""x"":5.599999904632568,""y"":2.4311530590057373},{""x"":6.099999904632568,""y"":2.33846116065979},{""x"":6.599999904632568,""y"":2.608201026916504},{""x"":7.099999904632568,""y"":2.8136143684387207}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.224573521642033, 1.4454033924198528, 5.6014197746076535, 0.2823216054197577],""points"":[{""x"":0.10000000149011612,""y"":4.95027494430542},{""x"":0.6000000238418579,""y"":5.1754679679870605},{""x"":1.100000023841858,""y"":5.276752948760986},{""x"":1.600000023841858,""y"":5.589294910430908},{""x"":2.0999999046325684,""y"":5.616994857788086},{""x"":2.5999999046325684,""y"":5.120813846588135},{""x"":3.0999999046325684,""y"":5.340766906738281},{""x"":3.5999999046325684,""y"":4.876471042633057},{""x"":4.099999904632568,""y"":4.94999361038208},{""x"":4.599999904632568,""y"":5.162564754486084},{""x"":5.099999904632568,""y"":4.399557590484619},{""x"":5.599999904632568,""y"":2.7977969646453857},{""x"":6.099999904632568,""y"":1.0229872465133667},{""x"":6.599999904632568,""y"":0.48275601863861084},{""x"":7.099999904632568,""y"":0.10408931970596313}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCuba,MHAILRYFIRRLFYHIFYKIYSLISKKHQSLPSDVRQF,COc1ccc2c(c1)c(CC(=O)N3CCCC3C(=O)Oc4ccc(C)cc4OC)c(C)n2C(=O)c5ccc(Cl)cc5,1480019,36.33115768432617,995081928,1227 US HIGHWAY 11,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,7,7,1QBS,7,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.320838679713925, -1.2421619987316728, 4.831325425225256, 0.3236011098403072],""points"":[{""x"":0.10000000149011612,""y"":0.3727470338344574},{""x"":0.6000000238418579,""y"":0.12365014106035233},{""x"":1.100000023841858,""y"":0.48422467708587646},{""x"":1.600000023841858,""y"":0.2264465093612671},{""x"":2.0999999046325684,""y"":0.16821794211864471},{""x"":2.5999999046325684,""y"":0.3879014551639557},{""x"":3.0999999046325684,""y"":0.5470244884490967},{""x"":3.5999999046325684,""y"":0.3419053554534912},{""x"":4.099999904632568,""y"":0.7655120491981506},{""x"":4.599999904632568,""y"":1.2346516847610474},{""x"":5.099999904632568,""y"":2.453336715698242},{""x"":5.599999904632568,""y"":2.9565491676330566},{""x"":6.099999904632568,""y"":3.335299491882324},{""x"":6.599999904632568,""y"":3.240290880203247},{""x"":7.099999904632568,""y"":3.1107218265533447}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.6401853521511094, 1.26211588875013, 5.399028074402744, 0.5089580830068091],""points"":[{""x"":0.10000000149011612,""y"":3.8585598468780518},{""x"":0.6000000238418579,""y"":3.6077206134796143},{""x"":1.100000023841858,""y"":3.855252265930176},{""x"":1.600000023841858,""y"":3.619039297103882},{""x"":2.0999999046325684,""y"":3.839388370513916},{""x"":2.5999999046325684,""y"":3.335283041000366},{""x"":3.0999999046325684,""y"":3.571141481399536},{""x"":3.5999999046325684,""y"":3.4155046939849854},{""x"":4.099999904632568,""y"":3.7316646575927734},{""x"":4.599999904632568,""y"":3.0680155754089355},{""x"":5.099999904632568,""y"":2.891066551208496},{""x"":5.599999904632568,""y"":1.6022753715515137},{""x"":6.099999904632568,""y"":0.7652576565742493},{""x"":6.599999904632568,""y"":0.6875326037406921},{""x"":7.099999904632568,""y"":0.5828871726989746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nItaly,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO[N+](=O)[O-],1480020,36.33115768432617,99502,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,8,8,1ZP8,8,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.293592105923809, 1.3781586549141835, 5.1025898038676605, 0.03493851245291291],""points"":[{""x"":0.10000000149011612,""y"":2.1287283897399902},{""x"":0.6000000238418579,""y"":2.267972230911255},{""x"":1.100000023841858,""y"":2.398442506790161},{""x"":1.600000023841858,""y"":2.5130622386932373},{""x"":2.0999999046325684,""y"":2.3255116939544678},{""x"":2.5999999046325684,""y"":2.127340793609619},{""x"":3.0999999046325684,""y"":2.47259783744812},{""x"":3.5999999046325684,""y"":2.131181478500366},{""x"":4.099999904632568,""y"":2.090421438217163},{""x"":4.599999904632568,""y"":2.02299165725708},{""x"":5.099999904632568,""y"":1.1105059385299683},{""x"":5.599999904632568,""y"":0.4494485855102539},{""x"":6.099999904632568,""y"":0.1375635862350464},{""x"":6.599999904632568,""y"":0.036351121962070465},{""x"":7.099999904632568,""y"":0.1619771122932434}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.953125499439879, 1.2528620255306528, 5.187637440149802, 0.3110348753260886],""points"":[{""x"":0.10000000149011612,""y"":5.6585283279418945},{""x"":0.6000000238418579,""y"":5.911152362823486},{""x"":1.100000023841858,""y"":5.924920082092285},{""x"":1.600000023841858,""y"":5.8469438552856445},{""x"":2.0999999046325684,""y"":5.929472923278809},{""x"":2.5999999046325684,""y"":6.190037727355957},{""x"":3.0999999046325684,""y"":6.236179828643799},{""x"":3.5999999046325684,""y"":6.141019344329834},{""x"":4.099999904632568,""y"":5.295210838317871},{""x"":4.599999904632568,""y"":5.265801906585693},{""x"":5.099999904632568,""y"":3.3722851276397705},{""x"":5.599999904632568,""y"":1.8299226760864258},{""x"":6.099999904632568,""y"":0.32690900564193726},{""x"":6.599999904632568,""y"":0.6274543404579163},{""x"":7.099999904632568,""y"":0.8441857099533081}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nRwanda,MPNSEPASLLELFNSIATQGELVRSLKAGNASK,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO,1480021,36.33137130737305,995037247,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,9,2BDJ,9,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.8209972202654474, 1.3779216716448506, 5.299882228439686, 0.06040645519069608],""points"":[{""x"":0.10000000149011612,""y"":3.7821109294891357},{""x"":0.6000000238418579,""y"":3.542433023452759},{""x"":1.100000023841858,""y"":3.7008674144744873},{""x"":1.600000023841858,""y"":3.717301607131958},{""x"":2.0999999046325684,""y"":4.024452209472656},{""x"":2.5999999046325684,""y"":4.013899326324463},{""x"":3.0999999046325684,""y"":3.945094347000122},{""x"":3.5999999046325684,""y"":3.866621971130371},{""x"":4.099999904632568,""y"":3.7461626529693604},{""x"":4.599999904632568,""y"":3.3454740047454834},{""x"":5.099999904632568,""y"":2.61944317817688},{""x"":5.599999904632568,""y"":0.999405026435852},{""x"":6.099999904632568,""y"":0.46259793639183044},{""x"":6.599999904632568,""y"":0.054134611040353775},{""x"":7.099999904632568,""y"":0.05711187422275543}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.6318079657726035, 1.8495493770000595, 5.391793312471116, 0.17060707587348442],""points"":[{""x"":0.10000000149011612,""y"":5.458079814910889},{""x"":0.6000000238418579,""y"":5.554427146911621},{""x"":1.100000023841858,""y"":5.799983024597168},{""x"":1.600000023841858,""y"":5.364140033721924},{""x"":2.0999999046325684,""y"":5.864485740661621},{""x"":2.5999999046325684,""y"":5.4509806632995605},{""x"":3.0999999046325684,""y"":5.702574729919434},{""x"":3.5999999046325684,""y"":5.7314534187316895},{""x"":4.099999904632568,""y"":5.5123443603515625},{""x"":4.599999904632568,""y"":5.724395751953125},{""x"":5.099999904632568,""y"":4.354506969451904},{""x"":5.599999904632568,""y"":1.7307666540145874},{""x"":6.099999904632568,""y"":0.6305936574935913},{""x"":6.599999904632568,""y"":0.035183437168598175},{""x"":7.099999904632568,""y"":0.7575169205665588}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nSwitzerland,IRVVGRYLIEVWKAAGMDMDKVLFLWSSDEI,CN1CCC(CC1)Oc2ccc(cc2)C(F)(F)F,1480028,36.33137130737305,99504,92-11 179TH PLACE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,10,1IAN,10,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[1.1190255865097471, 2.3163895161544437, 5.4968866182279195, 0.2035204047289052],""points"":[{""x"":0.10000000149011612,""y"":1.1057683229446411},{""x"":0.6000000238418579,""y"":1.1019697189331055},{""x"":1.100000023841858,""y"":1.0818607807159424},{""x"":1.600000023841858,""y"":1.062997817993164},{""x"":2.0999999046325684,""y"":1.046447515487671},{""x"":2.5999999046325684,""y"":1.1217249631881714},{""x"":3.0999999046325684,""y"":1.2166996002197266},{""x"":3.5999999046325684,""y"":1.215477705001831},{""x"":4.099999904632568,""y"":1.0581893920898438},{""x"":4.599999904632568,""y"":1.1747995615005493},{""x"":5.099999904632568,""y"":1.0181127786636353},{""x"":5.599999904632568,""y"":0.5344523191452026},{""x"":6.099999904632568,""y"":0.2569526433944702},{""x"":6.599999904632568,""y"":0.1912207305431366},{""x"":7.099999904632568,""y"":0.15060538053512573}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.1038581025805785, 2.0032224204185245, 5.087602825989163, 0.13277988512492753],""points"":[{""x"":0.10000000149011612,""y"":3.0498509407043457},{""x"":0.6000000238418579,""y"":2.805217742919922},{""x"":1.100000023841858,""y"":3.3415253162384033},{""x"":1.600000023841858,""y"":3.0549843311309814},{""x"":2.0999999046325684,""y"":3.250074863433838},{""x"":2.5999999046325684,""y"":3.0432586669921875},{""x"":3.0999999046325684,""y"":3.265852451324463},{""x"":3.5999999046325684,""y"":2.9475724697113037},{""x"":4.099999904632568,""y"":3.1929898262023926},{""x"":4.599999904632568,""y"":2.7460060119628906},{""x"":5.099999904632568,""y"":1.6175861358642578},{""x"":5.599999904632568,""y"":0.3006608486175537},{""x"":6.099999904632568,""y"":0.3444803059101105},{""x"":6.599999904632568,""y"":0.015537971630692482},{""x"":7.099999904632568,""y"":0.5527358055114746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\n,,,,,,,,,,,,,,,,,,,,,');r.columns.add(o.Column.fromList(o.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var s=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function a(t,e,n,o,r,a,l,u,c=!0){return s(this,void 0,void 0,(function*(){let d=null;if(yield O(o,(n=>s(this,void 0,void 0,(function*(){let n=null;for(const i of t.viewers)i.type===e&&(n=i);if(!n)throw Error("Viewer hasn't been added");if(yield Promise.resolve(),a&&(yield a(n)),r){const e=null!=u?u:{};e.tv=t,e.viewer=n,d=yield r(e,c)}yield M(i.events.onViewerClosed,(()=>{L(n.subs.some((t=>!t.closed)),!1)}),(()=>n.close()),3e3)}))),(()=>s(this,void 0,void 0,(function*(){l?t.loadLayout(l):yield function(t,e,n){return s(this,void 0,void 0,(function*(){let i;return n?(i=yield t.dataFrame.plot.fromType(e),t.dockManager.dock(i)):i=t.addViewer(e),i}))}(t,e,n)}))),6e4,"TEST_EVENT_ASYNC"),d)return d}))}function l(t,e=!0){return s(this,void 0,void 0,(function*(){const n=t.tv.dataFrame,i=n.clone();Array.from(n.row(0).cells).forEach((t=>t.value=null));const o=n.rowCount<20?Math.floor(n.rowCount/2):10;n.rows.select((t=>t.idx>=0&&t.idx<o)),e&&(yield Y(50));for(let t=o;t<2*o;t++)n.filter.set(t,!1);e&&(yield Y(50)),n.currentRowIdx=1,n.columns.names().slice(0,Math.ceil(n.columns.length/2)).forEach((t=>n.columns.remove(t))),e&&(yield Y(100)),t.tv.dataFrame=i,yield Y(50)}))}function u(t,e=!0){return s(this,void 0,void 0,(function*(){const e=t.tv.dataFrame;setTimeout((()=>e.filter.set(0,!e.filter.get(0))),0)}))}function c(t,e=!0){return s(this,void 0,void 0,(function*(){let e,n;try{e=t.viewer.getOptions(!0).look}catch(t){throw new Error("Viewer's .getOptions() error.",{cause:t})}try{n=t.viewer.getProperties()}catch(t){throw new Error("Viewer's .getProperties() error.",{cause:t})}const i={};return Object.keys(e).filter((t=>"boolean"==typeof e[t])).forEach((t=>i[t]=!e[t])),n.filter((t=>null!==t.choices)).forEach((t=>i[t.name]=t.choices.find((n=>n!==e[t.name])))),t.viewer.setOptions(i),yield Y(300),{layout:t.tv.saveLayout(),savedProps:t.viewer.getOptions().look}}))}function d(t,e=!0){return s(this,void 0,void 0,(function*(){L(JSON.stringify(t.viewer.getOptions().look),JSON.stringify(t.savedProps))}))}var f=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const h=3e4,m=108e5,g=console.log.bind(console),p=console.info.bind(console),v=console.warn.bind(console),y=console.error.bind(console),C={},w="Auto Tests",A="Demo",b="Detectors",S="Core",E={};let T;var x;!function(t){t.notNull=function(t,e){if(null==t)throw new Error(`${null==e?"Value":e} not defined`)}}(x||(x={}));class N{constructor(t,e){this.catchUnhandled=!0,this.report=!1,void 0!==t&&(this.catchUnhandled=t),void 0!==e&&(this.report=e)}}class _{constructor(t,e,n,i){var r;this.category=t,this.name=e,null!=i||(i={}),null!==(r=i.timeout)&&void 0!==r||(i.timeout=h),this.options=i,this.test=()=>f(this,void 0,void 0,(function*(){return new Promise(((t,e)=>f(this,void 0,void 0,(function*(){var i;let r="";try{o.Test.isInDebug;let t=yield n();try{r=null!==(i=null==t?void 0:t.toString())&&void 0!==i?i:""}catch(t){r="Can't convert test's result to string",console.error(`Can't convert test's result to string in the ${this.category}:${this.name} test`)}}catch(t){e(t)}t(r)}))))}))}}function M(t,e,n,i=0,o="timeout"){return f(this,void 0,void 0,(function*(){return new Promise(((r,s)=>{const a=t.subscribe((t=>{try{e(t),r("OK")}catch(t){s(t)}finally{a.unsubscribe(),clearTimeout(l)}})),l=setTimeout((()=>{a.unsubscribe(),s(o)}),i);n()}))}))}function O(t,e,n,i=0,o="timeout"){return f(this,void 0,void 0,(function*(){return new Promise(((r,s)=>{const a=t.subscribe((t=>{e(t).then((()=>{r("OK")})).catch((t=>{s(t)})).finally((()=>{a.unsubscribe(),clearTimeout(l)}))})),l=setTimeout((()=>{a.unsubscribe(),s(o)}),i);n()}))}))}function I(t,e,n){null==C[T]&&(C[T]={}),null==C[T].tests&&(C[T].tests=[]),C[T].tests.push(new _(T,t,e,n))}function L(t,e=!0,n){if(n=n?`${n}, `:"",t!==e)throw new Error(`${n}Expected "${e}", got "${t}"`)}function P(t,e,n=.001,i){if(t===Number.POSITIVE_INFINITY&&e===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY&&e===Number.NEGATIVE_INFINITY||t===Number.NaN&&e===Number.NaN||isNaN(t)&&isNaN(e))return;const o=Math.abs(t-e)<n;if(L(o,!0,`${null!=i?i:""} (tolerance = ${n})`),!o)throw new Error(`Expected ${e}, got ${t} (tolerance = ${n})`)}function R(t,e,n){var i;T=t,e(),C[T]&&(C[T].clear=null===(i=null==n?void 0:n.clear)||void 0===i||i,C[T].timeout=null==n?void 0:n.timeout,C[T].benchmarks=null==n?void 0:n.benchmarks,C[T].stressTests=null==n?void 0:n.stressTests,C[T].owner=null==n?void 0:n.owner)}function k(t){null==C[T]&&(C[T]={}),C[T].before=t}function V(t){null==C[T]&&(C[T]={}),C[T].after=t}function D(t,e){return t.replace(new RegExp(e.name,"gi"),e.nqName)}function F(t,e){var n,s,a,l,u,c,d,g,p,v;return f(this,void 0,void 0,(function*(){const y=t.id;if(E[y])return;const T=e?e.tests:C;if("DevTools"===t.name||e&&"DevTools"===e._package.name)for(const t of window.dartTests){const e=t.name.split(/\s*\|\s*!/g);let i=null!==(n=e.pop())&&void 0!==n?n:t.name,o=e.length?S+": "+e.join(": "):S,r=i.split(" | ");i=r[r.length-1],r.unshift(o),r.pop(),o=r.join(": "),void 0===T[o]&&(T[o]={tests:[],clear:!0}),T[o].tests.push(new _(o,i,t.test,{isAggregated:!1,timeout:null!==(a=null===(s=t.options)||void 0===s?void 0:s.timeout)&&void 0!==a?a:h,skipReason:null===(l=t.options)||void 0===l?void 0:l.skipReason,owner:null===(u=t.options)||void 0===u?void 0:u.owner,benchmark:null!==(d=null===(c=t.options)||void 0===c?void 0:c.benchmark)&&void 0!==d&&d}))}const x=[],N=[],M=[],O=yield i.dapi.functions.filter(`package.id = "${y}"`).list(),I=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)|timeout:\s*(\d+)/g);for(const e of O){const n=e.options.test,s=e.options.demoPath;if(n&&Array.isArray(n)&&n.length)for(let t=0;t<n.length;t++){const r=n[t].matchAll(I),s={};Array.from(r).forEach((t=>{t[0].startsWith("skip")?s.skip=t[1]:t[0].startsWith("wait")?s.wait=parseInt(t[2]):t[0].startsWith("cat")?s.cat=t[3]:t[0].startsWith("timeout")&&(s.timeout=parseInt(t[4]))}));const a=new _(null!==(g=s.cat)&&void 0!==g?g:w,1===n.length?e.name:`${e.name} ${t+1}`,(()=>f(this,void 0,void 0,(function*(){const o=yield i.functions.eval(D(n[t],e));if(s.wait&&(yield Y(s.wait)),"boolean"==typeof o&&!o)throw`Failed: ${n[t]}, expected true, got ${o}`}))),{skipReason:s.skip,timeout:o.Test.isInBenchmark?null!==(p=s.benchmarkTimeout)&&void 0!==p?p:m:null!==(v=s.timeout)&&void 0!==v?v:h});if(s.cat){const t=s.cat;void 0===T[t]&&(T[t]={tests:[],clear:!0}),T[t].tests||(T[t].tests=[]),T[t].tests.push(a)}else x.push(a)}if(s){const t=e.options.demoWait?parseInt(e.options.demoWait):void 0,n=new _(A,e.friendlyName,(()=>f(this,void 0,void 0,(function*(){yield Y(300),i.shell.clearLastError(),yield e.apply(),yield Y(t||2e3);const n=yield i.shell.lastError;if(n)throw new Error(n)}))),{skipReason:e.options.demoSkip});N.push(n)}if(e.hasTag("semTypeDetector")){let n=r;e.options.testData&&(n=yield i.data.files.openTable(`System:AppData/${t.nqName}/${e.options.testData}`));const o=new _(b,e.friendlyName,(()=>f(this,void 0,void 0,(function*(){const i=[];console.log(`System:AppData/${t.nqName}/${e.options.testData}`);for(const t of n.clone().columns){const n=yield e.apply([t]);i.push(n||t.semType)}const o=i.filter((t=>t));L(o.length,1),e.options.testDataColumnName&&L(o[0],e.options.testDataColumnName)}))),{skipReason:e.options.skipTest});M.push(o)}}E[y]=!0,x.length>0&&(T[w]={tests:x,clear:!0}),N.length>0&&(T[A]={tests:N,clear:!0}),M.length>0&&(T[b]={tests:M,clear:!1})}))}function G(t){var e,n,r,s,a,l;return f(this,void 0,void 0,(function*(){console.log("--------------------");const u=null===(n=null===(e=i.functions.getCurrentCall())||void 0===e?void 0:e.func)||void 0===n?void 0:n.package,c=(null!==(s=(null!==(r=null==u?void 0:u.packageOwner)&&void 0!==r?r:"").match(new RegExp("[^<]*<([^>]*)>")))&&void 0!==s?s:["",""])[1];yield F(u);const d=[];console.log("Running tests"),console.log(t),null!=t||(t={}),null!==(a=(l=t).testContext)&&void 0!==a||(l.testContext=new N),i.shell.clearLastError();const w=function(){const t=[];return console.log=(...e)=>{t.push(...e),g(...e)},console.info=(...e)=>{t.push(...e),p(...e)},console.warn=(...e)=>{t.push(...e),v(...e)},console.error=(...e)=>{t.push(...e),y(...e)},t}();yield function(t,e){var n,r,s,a,l,h,m;return f(this,void 0,void 0,(function*(){try{for(const[i,c]of Object.entries(t)){if(!(null==e?void 0:e.category)||(null===(n=e.exclude)||void 0===n?void 0:n.some((t=>i.startsWith(t)))))continue;if((!i.toLowerCase().startsWith(`${null==e?void 0:e.category.toLowerCase().trim()} :`)||e.test)&&i.toLowerCase().trim()!==(null==e?void 0:e.category.toLowerCase().trim()))continue;g(`Started ${i} category`);const t=null===(r=c.tests)||void 0===r?void 0:r.every((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.skipReason}));t||(c.beforeStatus=yield A(c.before,null!==(s=e.category)&&void 0!==s?s:""));let p,v=null!==(a=c.tests)&&void 0!==a?a:[];e.stressTest&&(v=v.filter((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.stressTest})),v=B(v)),(null!==(h=null===(l=e.tags)||void 0===l?void 0:l.length)&&void 0!==h?h:0)>0&&(v=v.filter((t=>{var n,i;return null===(i=null===(n=t.options)||void 0===n?void 0:n.tags)||void 0===i?void 0:i.some((t=>{var n;return(null!==(n=null==e?void 0:e.tags)&&void 0!==n?n:[]).includes(t)}))}))),c.beforeStatus?(p=Array.from(v.map((t=>({date:(new Date).toISOString(),category:i,name:t.name,success:!1,result:"before() failed",ms:0,skipped:!1,logs:"",owner:null==u?void 0:u.packageOwner,package:u.name,widgetsDifference:0,flaking:o.Test.isReproducing})))),p.forEach((t=>f(this,void 0,void 0,(function*(){return U("package",t)}))))):p=yield b(c,e);const y=p.filter((t=>"skipped"!=t.result));t||(c.afterStatus=yield A(c.after,null!==(m=e.category)&&void 0!==m?m:"")),c.afterStatus&&y.push({date:(new Date).toISOString(),category:i,name:"after",success:!1,result:c.afterStatus,ms:0,skipped:!1,logs:"",owner:null==u?void 0:u.packageOwner,package:u.name,widgetsDifference:0,flaking:o.Test.isReproducing}),c.beforeStatus&&y.push({date:(new Date).toISOString(),category:i,name:"before",success:!1,result:c.beforeStatus,ms:0,skipped:!1,logs:"",owner:null==u?void 0:u.packageOwner,package:u.name,widgetsDifference:0,flaking:o.Test.isReproducing}),d.push(...y)}}finally{console.log=g,console.info=p,console.warn=v,console.error=y}if(e.testContext.catchUnhandled&&!o.Test.isInBenchmark){yield Y(1e3);const t=yield i.shell.lastError,e={logs:"",date:(new Date).toISOString(),category:"Unhandled exceptions",name:"Exception",result:null!=t?t:"",success:!t,ms:0,skipped:!1,owner:null!=c?c:"",package:u.name,widgetsDifference:0};d.push(Object.assign(Object.assign({},e),{flaking:o.Test.isReproducing&&!t})),e.package=u.name,yield U("package",e)}}))}(C,t);for(let t of d)t.result=t.result.toString().replace(/"/g,"'"),null!=t.logs&&(t.logs=t.logs.toString().replace(/"/g,"'"));return d;function A(t,e){return f(this,void 0,void 0,(function*(){let n;try{void 0!==t&&(yield j((()=>f(this,void 0,void 0,(function*(){yield t()}))),1e5,`before ${e}: timeout error`))}catch(t){n=yield H(t)}return n}))}function b(t,e){var n,r,s,a,l,d,g,p,v,y,C,A,b,E,T,x,N,_;return f(this,void 0,void 0,(function*(){let f=null!==(n=t.tests)&&void 0!==n?n:[];const M=[],O=S();if(t.clear)for(let n=0;n<f.length;n++){f[n].options&&void 0===(null===(r=f[n].options)||void 0===r?void 0:r.benchmark)&&(f[n].options||(f[n].options={}),f[n].options.benchmark=null!==(s=t.benchmarks)&&void 0!==s&&s);let A=f[n];if(e.test&&e.test.toLowerCase()!==A.name.toLowerCase())continue;(null==A?void 0:A.options)&&(A.options.owner=null!==(g=null!==(d=null!==(l=null===(a=f[n].options)||void 0===a?void 0:a.owner)&&void 0!==l?l:null==t?void 0:t.owner)&&void 0!==d?d:c)&&void 0!==g?g:"");let b=yield q(A,null==e?void 0:e.test,w,o.Test.isInBenchmark?null!==(v=null===(p=f[n].options)||void 0===p?void 0:p.benchmarkTimeout)&&void 0!==v?v:m:null!==(C=null===(y=f[n].options)||void 0===y?void 0:y.timeout)&&void 0!==C?C:h,u.name,e.verbose);b&&M.push(Object.assign(Object.assign({},b),{widgetsDifference:S()-O})),i.shell.closeAll(),o.Balloon.closeAll()}else for(let n=0;n<f.length;n++){let i=f[n];if(e.test&&e.test.toLowerCase()!==i.name.toLowerCase())continue;(null==i?void 0:i.options)&&(i.options.owner=null!==(T=null!==(E=null!==(b=null===(A=f[n].options)||void 0===A?void 0:A.owner)&&void 0!==b?b:null==t?void 0:t.owner)&&void 0!==E?E:c)&&void 0!==T?T:"");let r=yield q(i,null==e?void 0:e.test,w,o.Test.isInBenchmark?null!==(N=null===(x=f[n].options)||void 0===x?void 0:x.benchmarkTimeout)&&void 0!==N?N:m:null===(_=f[n].options)||void 0===_?void 0:_.timeout,u.name,e.verbose);r&&M.push(Object.assign(Object.assign({},r),{widgetsDifference:S()-O}))}return M}))}function S(){var t;let e=-1;try{e=o.Widget.getAll().length}catch(e){console.warn(null!==(t=e.message)&&void 0!==t?t:e)}return e}}))}function U(t,e){return f(this,void 0,void 0,(function*(){null!=i.shell.reportTest?yield i.shell.reportTest(t,e):yield fetch(`${i.dapi.root}/log/tests/${t}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(e)})}))}function H(t){return f(this,void 0,void 0,(function*(){return`${t.toString()}\n${t.stack?yield o.Logger.translateStackTrace(t.stack):""}`}))}function q(t,e,n,r,s,a){var l,u,c,d,m,p,v,C,w,A,b,S,E,T;return f(this,void 0,void 0,(function*(){let f;n.length=0;const x=null!=e&&t.name.toLowerCase()!==e.toLowerCase();let N=(null===(l=t.options)||void 0===l?void 0:l.skipReason)||x,_=x?"skipped":null===(u=t.options)||void 0===u?void 0:u.skipReason;if(console.log(I.name,N),o.Test.isInBenchmark&&!(null===(c=t.options)||void 0===c?void 0:c.benchmark))return void g(`SKIPPED: ${t.category} ${t.name} doesnt available in benchmark mode`);N||g(`Started ${t.category} ${t.name}`);const M=Date.now(),O=new Date(M).toISOString();try{if(N)f={name:t.name,owner:null!==(m=null===(d=t.options)||void 0===d?void 0:d.owner)&&void 0!==m?m:"",category:t.category,logs:"",date:O,success:!0,result:_,ms:0,skipped:!0,package:null!=s?s:"",flaking:o.Test.isReproducing};else{let e=null!=r?r:h;o.Test.isProfiling&&console.profile(`${t.category}: ${t.name}`),f={name:t.name,owner:null!==(v=null===(p=t.options)||void 0===p?void 0:p.owner)&&void 0!==v?v:"",category:t.category,logs:"",date:O,success:!0,result:null!==(C=(yield j(t.test,e)).toString())&&void 0!==C?C:"OK",ms:0,skipped:!1,package:null!=s?s:"",flaking:o.Test.isReproducing},o.Test.isProfiling&&(console.profileEnd(`${t.category}: ${t.name}`),i.shell.info(`Profiling of ${t.category}: ${t.name} finished \n Please ensure that you have opened DevTools (F12) / Performance panel before test starts.`))}}catch(e){y(e),f={name:t.name,owner:null!==(A=null===(w=t.options)||void 0===w?void 0:w.owner)&&void 0!==A?A:"",category:t.category,logs:"",date:O,success:!1,result:yield H(e),ms:0,skipped:!1,package:null!=s?s:"",flaking:!1}}if((null===(b=t.options)||void 0===b?void 0:b.isAggregated)&&f.result.constructor===o.DataFrame){const t=f.result.col("success");if(t&&(f.success=t.stats.sum===t.length),!a){const t=f.result;t.columns.remove("stack"),t.rows.removeWhere((t=>t.get("success"))),f.result=t}f.result=f.result.toCsv()}if(f.logs=n.join("\n"),f.ms=Date.now()-M,N||g(`Finished ${t.category} ${t.name} for ${f.ms} ms`),f.category=t.category,f.name=t.name,f.owner=null!==(E=null===(S=t.options)||void 0===S?void 0:S.owner)&&void 0!==E?E:"",!x){let e={success:f.success,result:f.result,ms:f.ms,date:f.date,skipped:f.skipped,category:t.category,name:t.name,logs:f.logs,owner:f.owner,flaking:o.Test.isReproducing&&f.success,package:f.package};if(f.result.constructor==Object){const t=Object.keys(f.result).reduce(((t,e)=>Object.assign(Object.assign({},t),{["result."+e]:f.result[e]})),{});e=Object.assign(Object.assign({},e),t)}e.result instanceof o.DataFrame&&(e.result=JSON.stringify(null===(T=e.result)||void 0===T?void 0:T.toJson())||""),yield U("package",e)}return f}))}function B(t){const e=t.slice();return e.sort((()=>Math.random()-.5)),e}function Y(t){return f(this,void 0,void 0,(function*(){yield new Promise((e=>setTimeout(e,t)))}))}function $(t,e="Timeout exceeded",n=500,i=50){return f(this,void 0,void 0,(function*(){return new Promise(((o,r)=>{setTimeout((()=>{clearInterval(s),r(new Error(e))}),n);const s=setInterval((()=>{t()&&(clearInterval(s),o(null))}),i)}))}))}function j(t,e,n="EXECUTION TIMEOUT"){return f(this,void 0,void 0,(function*(){let i=null;const o=new Promise(((t,o)=>{i=setTimeout((()=>{o(n)}),e)}));try{return yield Promise.race([t(),o])}finally{i&&clearTimeout(i)}}))}const W=o.DataFrame.fromColumns([o.Column.fromStrings("col",["val1","val2","val3"])]);function z(t,e,n){var o;return f(this,void 0,void 0,(function*(){const r=null!==(o=null==n?void 0:n.packageName)&&void 0!==o?o:"";(null==n?void 0:n.detectSemanticTypes)&&(yield i.data.detectSemanticTypes(e));const s=i.shell.addTableView(e);try{yield a(s,t,r,i.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,r,i.events.onViewerAdded,void 0,n.awaitViewer)),(null==n?void 0:n.readOnly)||(yield a(s,t,r,i.events.onViewerAdded,l),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,r,i.events.onViewerAdded,l,n.awaitViewer)));let e=null;e=yield a(s,t,r,i.events.onViewerAdded,c),(null==n?void 0:n.awaitViewer)&&(e=yield a(s,t,r,i.events.onViewerAdded,c,n.awaitViewer)),yield a(s,t,r,i.events.onViewLayoutApplied,d,void 0,null==e?void 0:e.layout,{savedProps:null==e?void 0:e.savedProps}),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,r,i.events.onViewLayoutApplied,d,n.awaitViewer,null==e?void 0:e.layout,{savedProps:null==e?void 0:e.savedProps})),!1!==(null==n?void 0:n.arbitraryDfTest)&&(s.dataFrame=W,yield Y(50),yield a(s,t,r,i.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,r,i.events.onViewerAdded,void 0,n.awaitViewer))),yield a(s,t,r,i.events.onViewerAdded,u),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,r,i.events.onViewerAdded,u,n.awaitViewer))}finally{}}))}},7233:t=>{!function(){"use strict";var e=document,n=window,i=e.documentElement,o=e.createElement.bind(e),r=o("div"),s=o("table"),a=o("tbody"),l=o("tr"),u=Array.isArray,c=Array.prototype,d=c.concat,f=c.filter,h=c.indexOf,m=c.map,g=c.push,p=c.slice,v=c.some,y=c.splice,C=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,w=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,A=/<.+>/,b=/^\w+$/;function S(t,e){var n,i=!!(n=e)&&11===n.nodeType;return t&&(i||M(e)||O(e))?!i&&w.test(t)?e.getElementsByClassName(t.slice(1).replace(/\\/g,"")):!i&&b.test(t)?e.getElementsByTagName(t):e.querySelectorAll(t):[]}var E=function(){function t(t,i){if(t){if(N(t))return t;var o=t;if(L(t)){var r=i||e;if(!(o=C.test(t)&&M(r)?r.getElementById(t.slice(1).replace(/\\/g,"")):A.test(t)?X(t):N(r)?r.find(t):L(r)?x(r).find(t):S(t,r)))return}else if(I(t))return this.ready(t);(o.nodeType||o===n)&&(o=[o]),this.length=o.length;for(var s=0,a=this.length;s<a;s++)this[s]=o[s]}}return t.prototype.init=function(e,n){return new t(e,n)},t}(),T=E.prototype,x=T.init;function N(t){return t instanceof E}function _(t){return!!t&&t===t.window}function M(t){return!!t&&9===t.nodeType}function O(t){return!!t&&1===t.nodeType}function I(t){return"function"==typeof t}function L(t){return"string"==typeof t}function P(t){return void 0===t}function R(t){return null===t}function k(t){return!isNaN(parseFloat(t))&&isFinite(t)}function V(t){if("object"!=typeof t||null===t)return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function D(t,e,n){if(n){for(var i=t.length;i--;)if(!1===e.call(t[i],i,t[i]))return t}else if(V(t))for(var o=Object.keys(t),r=(i=0,o.length);i<r;i++){var s=o[i];if(!1===e.call(t[s],s,t[s]))return t}else for(i=0,r=t.length;i<r;i++)if(!1===e.call(t[i],i,t[i]))return t;return t}function F(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="boolean"==typeof t[0]&&t.shift(),i=t.shift(),o=t.length;if(!i)return{};if(!o)return F(n,x,i);for(var r=0;r<o;r++){var s=t[r];for(var a in s)n&&(u(s[a])||V(s[a]))?(i[a]&&i[a].constructor===s[a].constructor||(i[a]=new s[a].constructor),F(n,i[a],s[a])):i[a]=s[a]}return i}x.fn=x.prototype=T,T.length=0,T.splice=y,"function"==typeof Symbol&&(T[Symbol.iterator]=c[Symbol.iterator]),x.isWindow=_,x.isFunction=I,x.isArray=u,x.isNumeric=k,x.isPlainObject=V,x.each=D,T.each=function(t){return D(this,t)},T.empty=function(){return this.each((function(t,e){for(;e.firstChild;)e.removeChild(e.firstChild)}))},x.extend=F,T.extend=function(t){return F(T,t)};var G=/\S+/g;function U(t){return L(t)&&t.match(G)||[]}function H(t,e,i){if(O(t)){var o=n.getComputedStyle(t,null);return i?o.getPropertyValue(e)||void 0:o[e]||t.style[e]}}function q(t,e){return parseInt(H(t,e),10)||0}function B(t,e){return q(t,"border".concat(e?"Left":"Top","Width"))+q(t,"padding".concat(e?"Left":"Top"))+q(t,"padding".concat(e?"Right":"Bottom"))+q(t,"border".concat(e?"Right":"Bottom","Width"))}T.toggleClass=function(t,e){var n=U(t),i=!P(e);return this.each((function(t,o){O(o)&&D(n,(function(t,n){i?e?o.classList.add(n):o.classList.remove(n):o.classList.toggle(n)}))}))},T.addClass=function(t){return this.toggleClass(t,!0)},T.removeAttr=function(t){var e=U(t);return this.each((function(t,n){O(n)&&D(e,(function(t,e){n.removeAttribute(e)}))}))},T.attr=function(t,e){if(t){if(L(t)){if(arguments.length<2){if(!this[0]||!O(this[0]))return;var n=this[0].getAttribute(t);return R(n)?void 0:n}return P(e)?this:R(e)?this.removeAttr(t):this.each((function(n,i){O(i)&&i.setAttribute(t,e)}))}for(var i in t)this.attr(i,t[i]);return this}},T.removeClass=function(t){return arguments.length?this.toggleClass(t,!1):this.attr("class","")},T.hasClass=function(t){return!!t&&v.call(this,(function(e){return O(e)&&e.classList.contains(t)}))},T.get=function(t){return P(t)?p.call(this):this[(t=Number(t))<0?t+this.length:t]},T.eq=function(t){return x(this.get(t))},T.first=function(){return this.eq(0)},T.last=function(){return this.eq(-1)},T.text=function(t){return P(t)?this.get().map((function(t){return O(t)||(e=t)&&3===e.nodeType?t.textContent:"";var e})).join(""):this.each((function(e,n){O(n)&&(n.textContent=t)}))};var Y={};function $(t){return"none"===H(t,"display")}function j(t,e){var n=t&&(t.matches||t.webkitMatchesSelector||t.msMatchesSelector);return!!n&&!!e&&n.call(t,e)}function W(t){return L(t)?function(e,n){return j(n,t)}:I(t)?t:N(t)?function(e,n){return t.is(n)}:t?function(e,n){return n===t}:function(){return!1}}function z(t,e){return e?t.filter(e):t}T.filter=function(t){var e=W(t);return x(f.call(this,(function(t,n){return e.call(t,n,t)})))},T.detach=function(t){return z(this,t).each((function(t,e){e.parentNode&&e.parentNode.removeChild(e)})),this};var K=/^\s*<(\w+)[^>]*>/,Q=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,Z={"*":r,tr:a,td:l,th:l,thead:s,tbody:s,tfoot:s};function X(t){if(!L(t))return[];if(Q.test(t))return[o(RegExp.$1)];var e=K.test(t)&&RegExp.$1,n=Z[e]||Z["*"];return n.innerHTML=t,x(n.childNodes).detach().get()}function J(t,e,n,i){for(var o=[],r=I(e),s=i&&W(i),a=0,l=t.length;a<l;a++)if(r){var u=e(t[a]);u.length&&g.apply(o,u)}else for(var c=t[a][e];!(null==c||i&&s(-1,c));)o.push(c),c=n?c[e]:null;return o}function tt(t){return t.multiple&&t.options?J(f.call(t.options,(function(t){return t.selected&&!t.disabled&&!t.parentNode.disabled})),"value"):t.value||""}function et(t){return t.length>1?f.call(t,(function(t,e,n){return h.call(n,t)===e})):t}x.parseHTML=X,T.has=function(t){var e=L(t)?function(e,n){return S(t,n).length}:function(e,n){return n.contains(t)};return this.filter(e)},T.not=function(t){var e=W(t);return this.filter((function(n,i){return(!L(t)||O(i))&&!e.call(i,n,i)}))},T.val=function(t){return arguments.length?this.each((function(e,n){var i=n.multiple&&n.options;if(i||Lt.test(n.type)){var o=u(t)?m.call(t,String):R(t)?[]:[String(t)];i?D(n.options,(function(t,e){e.selected=o.indexOf(e.value)>=0}),!0):n.checked=o.indexOf(n.value)>=0}else n.value=P(t)||R(t)?"":t})):this[0]&&tt(this[0])},T.is=function(t){var e=W(t);return v.call(this,(function(t,n){return e.call(t,n,t)}))},x.guid=1,x.unique=et,T.add=function(t,e){return x(et(this.get().concat(x(t,e).get())))},T.children=function(t){return z(x(et(J(this,(function(t){return t.children})))),t)},T.parent=function(t){return z(x(et(J(this,"parentNode"))),t)},T.index=function(t){var e=t?x(t)[0]:this[0],n=t?this:x(e).parent().children();return h.call(n,e)},T.closest=function(t){var e=this.filter(t);if(e.length)return e;var n=this.parent();return n.length?n.closest(t):e},T.siblings=function(t){return z(x(et(J(this,(function(t){return x(t).parent().children().not(t)})))),t)},T.find=function(t){return x(et(J(this,(function(e){return S(t,e)}))))};var nt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,it=/^$|^module$|\/(java|ecma)script/i,ot=["type","src","nonce","noModule"];function rt(t,e,n,r,s,a,l,u){return D(t,(function(t,a){D(x(a),(function(t,a){D(x(e),(function(e,l){var u=n?l:a,c=n?t:e;!function(t,e,n,r,s){r?t.insertBefore(e,n?t.firstChild:null):"HTML"===t.nodeName?t.parentNode.replaceChild(e,t):t.parentNode.insertBefore(e,n?t:t.nextSibling),s&&function(t,e){var n=x(t);n.filter("script").add(n.find("script")).each((function(t,n){if(it.test(n.type)&&i.contains(n)){var r=o("script");r.text=n.textContent.replace(nt,""),D(ot,(function(t,e){n[e]&&(r[e]=n[e])})),e.head.insertBefore(r,null),e.head.removeChild(r)}}))}(e,t.ownerDocument)}(n?a:l,c?u.cloneNode(!0):u,r,s,!c)}),u)}),l)}),a),e}T.after=function(){return rt(arguments,this,!1,!1,!1,!0,!0)},T.append=function(){return rt(arguments,this,!1,!1,!0)},T.html=function(t){if(!arguments.length)return this[0]&&this[0].innerHTML;if(P(t))return this;var e=/<script[\s>]/.test(t);return this.each((function(n,i){O(i)&&(e?x(i).empty().append(t):i.innerHTML=t)}))},T.appendTo=function(t){return rt(arguments,this,!0,!1,!0)},T.wrapInner=function(t){return this.each((function(e,n){var i=x(n),o=i.contents();o.length?o.wrapAll(t):i.append(t)}))},T.before=function(){return rt(arguments,this,!1,!0)},T.wrapAll=function(t){for(var e=x(t),n=e[0];n.children.length;)n=n.firstElementChild;return this.first().before(e),this.appendTo(n)},T.wrap=function(t){return this.each((function(e,n){var i=x(t)[0];x(n).wrapAll(e?i.cloneNode(!0):i)}))},T.insertAfter=function(t){return rt(arguments,this,!0,!1,!1,!1,!1,!0)},T.insertBefore=function(t){return rt(arguments,this,!0,!0)},T.prepend=function(){return rt(arguments,this,!1,!0,!0,!0,!0)},T.prependTo=function(t){return rt(arguments,this,!0,!0,!0,!1,!1,!0)},T.contents=function(){return x(et(J(this,(function(t){return"IFRAME"===t.tagName?[t.contentDocument]:"TEMPLATE"===t.tagName?t.content.childNodes:t.childNodes}))))},T.next=function(t,e,n){return z(x(et(J(this,"nextElementSibling",e,n))),t)},T.nextAll=function(t){return this.next(t,!0)},T.nextUntil=function(t,e){return this.next(e,!0,t)},T.parents=function(t,e){return z(x(et(J(this,"parentElement",!0,e))),t)},T.parentsUntil=function(t,e){return this.parents(e,t)},T.prev=function(t,e,n){return z(x(et(J(this,"previousElementSibling",e,n))),t)},T.prevAll=function(t){return this.prev(t,!0)},T.prevUntil=function(t,e){return this.prev(e,!0,t)},T.map=function(t){return x(d.apply([],m.call(this,(function(e,n){return t.call(e,n,e)}))))},T.clone=function(){return this.map((function(t,e){return e.cloneNode(!0)}))},T.offsetParent=function(){return this.map((function(t,e){for(var n=e.offsetParent;n&&"static"===H(n,"position");)n=n.offsetParent;return n||i}))},T.slice=function(t,e){return x(p.call(this,t,e))};var st=/-([a-z])/g;function at(t){return t.replace(st,(function(t,e){return e.toUpperCase()}))}T.ready=function(t){var n=function(){return setTimeout(t,0,x)};return"loading"!==e.readyState?n():e.addEventListener("DOMContentLoaded",n),this},T.unwrap=function(){return this.parent().each((function(t,e){if("BODY"!==e.tagName){var n=x(e);n.replaceWith(n.children())}})),this},T.offset=function(){var t=this[0];if(t){var e=t.getBoundingClientRect();return{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}}},T.position=function(){var t=this[0];if(t){var e="fixed"===H(t,"position"),n=e?t.getBoundingClientRect():this.offset();if(!e){for(var i=t.ownerDocument,o=t.offsetParent||i.documentElement;(o===i.body||o===i.documentElement)&&"static"===H(o,"position");)o=o.parentNode;if(o!==t&&O(o)){var r=x(o).offset();n.top-=r.top+q(o,"borderTopWidth"),n.left-=r.left+q(o,"borderLeftWidth")}}return{top:n.top-q(t,"marginTop"),left:n.left-q(t,"marginLeft")}}};var lt={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};T.prop=function(t,e){if(t){if(L(t))return t=lt[t]||t,arguments.length<2?this[0]&&this[0][t]:this.each((function(n,i){i[t]=e}));for(var n in t)this.prop(n,t[n]);return this}},T.removeProp=function(t){return this.each((function(e,n){delete n[lt[t]||t]}))};var ut=/^--/;function ct(t){return ut.test(t)}var dt={},ft=r.style,ht=["webkit","moz","ms"],mt={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function gt(t,e,n){return void 0===n&&(n=ct(t)),n||mt[t]||!k(e)?e:"".concat(e,"px")}function pt(t,e){try{return t(e)}catch(t){return e}}T.css=function(t,e){if(L(t)){var n=ct(t);return t=function(t,e){if(void 0===e&&(e=ct(t)),e)return t;if(!dt[t]){var n=at(t),i="".concat(n[0].toUpperCase()).concat(n.slice(1));D("".concat(n," ").concat(ht.join("".concat(i," "))).concat(i).split(" "),(function(e,n){if(n in ft)return dt[t]=n,!1}))}return dt[t]}(t,n),arguments.length<2?this[0]&&H(this[0],t,n):t?(e=gt(t,e,n),this.each((function(i,o){O(o)&&(n?o.style.setProperty(t,e):o.style[t]=e)}))):this}for(var i in t)this.css(i,t[i]);return this};var vt=/^\s+|\s+$/;function yt(t,e){var n=t.dataset[e]||t.dataset[at(e)];return vt.test(n)?n:pt(JSON.parse,n)}function Ct(t,e){var n=t.documentElement;return Math.max(t.body["scroll".concat(e)],n["scroll".concat(e)],t.body["offset".concat(e)],n["offset".concat(e)],n["client".concat(e)])}T.data=function(t,e){if(!t){if(!this[0])return;var n={};for(var i in this[0].dataset)n[i]=yt(this[0],i);return n}if(L(t))return arguments.length<2?this[0]&&yt(this[0],t):P(e)?this:this.each((function(n,i){!function(t,e,n){n=pt(JSON.stringify,n),t.dataset[at(e)]=n}(i,t,e)}));for(var i in t)this.data(i,t[i]);return this},D([!0,!1],(function(t,e){D(["Width","Height"],(function(t,n){var i="".concat(e?"outer":"inner").concat(n);T[i]=function(i){if(this[0])return _(this[0])?e?this[0]["inner".concat(n)]:this[0].document.documentElement["client".concat(n)]:M(this[0])?Ct(this[0],n):this[0]["".concat(e?"offset":"client").concat(n)]+(i&&e?q(this[0],"margin".concat(t?"Top":"Left"))+q(this[0],"margin".concat(t?"Bottom":"Right")):0)}}))})),D(["Width","Height"],(function(t,e){var n=e.toLowerCase();T[n]=function(i){if(!this[0])return P(i)?void 0:this;if(!arguments.length)return _(this[0])?this[0].document.documentElement["client".concat(e)]:M(this[0])?Ct(this[0],e):this[0].getBoundingClientRect()[n]-B(this[0],!t);var o=parseInt(i,10);return this.each((function(e,i){if(O(i)){var r=H(i,"boxSizing");i.style[n]=gt(n,o+("border-box"===r?B(i,!t):0))}}))}}));var wt="___cd";T.toggle=function(t){return this.each((function(n,i){if(O(i)){var r=$(i);(P(t)?r:t)?(i.style.display=i[wt]||"",$(i)&&(i.style.display=function(t){if(Y[t])return Y[t];var n=o(t);e.body.insertBefore(n,null);var i=H(n,"display");return e.body.removeChild(n),Y[t]="none"!==i?i:"block"}(i.tagName))):r||(i[wt]=H(i,"display"),i.style.display="none")}}))},T.hide=function(){return this.toggle(!1)},T.show=function(){return this.toggle(!0)};var At="___ce",bt={focus:"focusin",blur:"focusout"},St={mouseenter:"mouseover",mouseleave:"mouseout"},Et=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;function Tt(t){return St[t]||bt[t]||t}function xt(t){var e=t.split(".");return[e[0],e.slice(1).sort()]}function Nt(t){return t[At]=t[At]||{}}function _t(t,e){return!e||!v.call(e,(function(e){return t.indexOf(e)<0}))}function Mt(t,e,n,i,o){var r=Nt(t);if(e)r[e]&&(r[e]=r[e].filter((function(r){var s=r[0],a=r[1],l=r[2];if(o&&l.guid!==o.guid||!_t(s,n)||i&&i!==a)return!0;t.removeEventListener(e,l)})));else for(e in r)Mt(t,e,n,i,o)}T.trigger=function(t,n){if(L(t)){var i=xt(t),o=i[0],r=i[1],s=Tt(o);if(!s)return this;var a=Et.test(s)?"MouseEvents":"HTMLEvents";(t=e.createEvent(a)).initEvent(s,!0,!0),t.namespace=r.join("."),t.___ot=o}t.___td=n;var l=t.___ot in bt;return this.each((function(e,n){l&&I(n[t.___ot])&&(n["___i".concat(t.type)]=!0,n[t.___ot](),n["___i".concat(t.type)]=!1),n.dispatchEvent(t)}))},T.off=function(t,e,n){var i=this;if(P(t))this.each((function(t,e){(O(e)||M(e)||_(e))&&Mt(e)}));else if(L(t))I(e)&&(n=e,e=""),D(U(t),(function(t,o){var r=xt(o),s=r[0],a=r[1],l=Tt(s);i.each((function(t,i){(O(i)||M(i)||_(i))&&Mt(i,l,a,e,n)}))}));else for(var o in t)this.off(o,t[o]);return this},T.remove=function(t){return z(this,t).detach().off(),this},T.replaceWith=function(t){return this.before(t).remove()},T.replaceAll=function(t){return x(t).replaceWith(this),this},T.on=function(t,e,n,i,o){var r=this;if(!L(t)){for(var s in t)this.on(s,e,n,t[s],o);return this}return L(e)||(P(e)||R(e)?e="":P(n)?(n=e,e=""):(i=n,n=e,e="")),I(i)||(i=n,n=void 0),i?(D(U(t),(function(t,s){var a=xt(s),l=a[0],u=a[1],c=Tt(l),d=l in St,f=l in bt;c&&r.each((function(t,r){if(O(r)||M(r)||_(r)){var s=function(t){if(t.target["___i".concat(t.type)])return t.stopImmediatePropagation();if((!t.namespace||_t(u,t.namespace.split(".")))&&(e||!(f&&(t.target!==r||t.___ot===c)||d&&t.relatedTarget&&r.contains(t.relatedTarget)))){var a=r;if(e){for(var l=t.target;!j(l,e);){if(l===r)return;if(!(l=l.parentNode))return}a=l}Object.defineProperty(t,"currentTarget",{configurable:!0,get:function(){return a}}),Object.defineProperty(t,"delegateTarget",{configurable:!0,get:function(){return r}}),Object.defineProperty(t,"data",{configurable:!0,get:function(){return n}});var h=i.call(a,t,t.___td);o&&Mt(r,c,u,e,s),!1===h&&(t.preventDefault(),t.stopPropagation())}};s.guid=i.guid=i.guid||x.guid++,function(t,e,n,i,o){var r=Nt(t);r[e]=r[e]||[],r[e].push([n,i,o]),t.addEventListener(e,o)}(r,c,u,e,s)}}))})),this):this},T.one=function(t,e,n,i){return this.on(t,e,n,i,!0)};var Ot=/\r?\n/g,It=/file|reset|submit|button|image/i,Lt=/radio|checkbox/i;T.serialize=function(){var t="";return this.each((function(e,n){D(n.elements||[n],(function(e,n){if(!(n.disabled||!n.name||"FIELDSET"===n.tagName||It.test(n.type)||Lt.test(n.type)&&!n.checked)){var i=tt(n);P(i)||D(u(i)?i:[i],(function(e,i){t+=function(t,e){return"&".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(e.replace(Ot,"\r\n")))}(n.name,i)}))}}))})),t.slice(1)},t.exports=x}()},6677:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(1354),o=n.n(i),r=n(6314),s=n.n(r)()(o());s.push([t.id,".ui-app-header {\n\n}\n\n.ui-app-header-icon {\n width: 150px;\n height: 150px;\n margin-right: 20px;\n}\n\n.u2-panel {\n gap: 10px;\n}\n\n.u2-app-header-bottom-line {\n border-bottom: solid 1px lightgrey;\n}\n\n.u2-app-header-with-name {\n gap: 60px;\n}\n\n.u2-app-header-with-name .ui-app-header-icon{\n width: 90px;\n height: 90px;\n}\n\n.u2-app-header-app-name-and-slogan-div {\n gap: 10px;\n margin-top: 10px;\n}\n\n.u2-app-header-app-name-div {\n font-size: 20px;\n font-weight: bold;\n}\n\n.u2-app-header-description {\n margin-top: 10px;\n margin-bottom: 10px;\n}","",{version:3,sources:["webpack://./node_modules/@datagrok-libraries/utils/src/u2.css"],names:[],mappings:"AAAA;;AAEA;;AAEA;IACI,YAAY;IACZ,aAAa;IACb,kBAAkB;AACtB;;AAEA;IACI,SAAS;AACb;;AAEA;IACI,kCAAkC;AACtC;;AAEA;IACI,SAAS;AACb;;AAEA;IACI,WAAW;IACX,YAAY;AAChB;;AAEA;IACI,SAAS;IACT,gBAAgB;AACpB;;AAEA;IACI,eAAe;IACf,iBAAiB;AACrB;;AAEA;IACI,gBAAgB;IAChB,mBAAmB;AACvB",sourcesContent:[".ui-app-header {\n\n}\n\n.ui-app-header-icon {\n width: 150px;\n height: 150px;\n margin-right: 20px;\n}\n\n.u2-panel {\n gap: 10px;\n}\n\n.u2-app-header-bottom-line {\n border-bottom: solid 1px lightgrey;\n}\n\n.u2-app-header-with-name {\n gap: 60px;\n}\n\n.u2-app-header-with-name .ui-app-header-icon{\n width: 90px;\n height: 90px;\n}\n\n.u2-app-header-app-name-and-slogan-div {\n gap: 10px;\n margin-top: 10px;\n}\n\n.u2-app-header-app-name-div {\n font-size: 20px;\n font-weight: bold;\n}\n\n.u2-app-header-description {\n margin-top: 10px;\n margin-bottom: 10px;\n}"],sourceRoot:""}]);const a=s},365:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(1354),o=n.n(i),r=n(6314),s=n.n(r)()(o());s.push([t.id,".pep-textarea-box {\n position: relative;\n}\n\n.pep-textarea-box:hover .pep-snippet-editor-icon {\n visibility: visible;\n}\n\n.pep-snippet-editor-icon {\n position: absolute;\n top: 5px;\n visibility: hidden;\n margin: 5px;\n z-index: 1;\n}\n\n.pep-reset-icon {\n right: 10px;\n}\n\n.pep-snippet-editor-icon i {\n font-size: 13px;\n}\n\n.pep-snippet-editor-icon:hover {\n background-color: var(--steel-1);\n border-radius: 2px;\n}\n\n.pep-snippet-inline-icon i {\n font-size: 13px;\n}\n\n.pep-textinput {\n height: 50px;\n overflow: hidden;\n}\n\n#pep-hist-host #center {\n height: 131px;\n}\n\n#pep-hist-host > #root {\n height: unset;\n width: 100%;\n}\n\n#pep-viewer-title {\n height: 23px;\n font-size: 1.2rem;\n font-family: 'Roboto', 'Roboto Local', sans-serif;\n color: #4D5261;\n text-align: center;\n width: 100%;\n align-self: end;\n}\n\n.pep-help-icon {\n position: absolute;\n left: 5px;\n top: 1px;\n}\n","",{version:3,sources:["webpack://./src/styles.css"],names:[],mappings:"AAAA;EACE,kBAAkB;AACpB;;AAEA;EACE,mBAAmB;AACrB;;AAEA;EACE,kBAAkB;EAClB,QAAQ;EACR,kBAAkB;EAClB,WAAW;EACX,UAAU;AACZ;;AAEA;EACE,WAAW;AACb;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,gCAAgC;EAChC,kBAAkB;AACpB;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,YAAY;EACZ,gBAAgB;AAClB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,aAAa;EACb,WAAW;AACb;;AAEA;EACE,YAAY;EACZ,iBAAiB;EACjB,iDAAiD;EACjD,cAAc;EACd,kBAAkB;EAClB,WAAW;EACX,eAAe;AACjB;;AAEA;EACE,kBAAkB;EAClB,SAAS;EACT,QAAQ;AACV",sourcesContent:[".pep-textarea-box {\n position: relative;\n}\n\n.pep-textarea-box:hover .pep-snippet-editor-icon {\n visibility: visible;\n}\n\n.pep-snippet-editor-icon {\n position: absolute;\n top: 5px;\n visibility: hidden;\n margin: 5px;\n z-index: 1;\n}\n\n.pep-reset-icon {\n right: 10px;\n}\n\n.pep-snippet-editor-icon i {\n font-size: 13px;\n}\n\n.pep-snippet-editor-icon:hover {\n background-color: var(--steel-1);\n border-radius: 2px;\n}\n\n.pep-snippet-inline-icon i {\n font-size: 13px;\n}\n\n.pep-textinput {\n height: 50px;\n overflow: hidden;\n}\n\n#pep-hist-host #center {\n height: 131px;\n}\n\n#pep-hist-host > #root {\n height: unset;\n width: 100%;\n}\n\n#pep-viewer-title {\n height: 23px;\n font-size: 1.2rem;\n font-family: 'Roboto', 'Roboto Local', sans-serif;\n color: #4D5261;\n text-align: center;\n width: 100%;\n align-self: end;\n}\n\n.pep-help-icon {\n position: absolute;\n left: 5px;\n top: 1px;\n}\n"],sourceRoot:""}]);const a=s},6314:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,i,o,r){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(s[l]=!0)}for(var u=0;u<t.length;u++){var c=[].concat(t[u]);i&&s[c[0]]||(void 0!==r&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=r),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),e.push(c))}},e}},1354:t=>{"use strict";t.exports=function(t){var e=t[1],n=t[3];if(!n)return e;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),o="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),r="/*# ".concat(o," */");return[e].concat([r]).join("\n")}return[e].join("\n")}},9982:function(t,e,n){var i;!function(e,o){var r={};!function(t){"use strict";t.__esModule=!0,t.digestLength=32,t.blockSize=64;var e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(t,n,i,o,r){for(var s,a,l,u,c,d,f,h,m,g,p,v,y;r>=64;){for(s=n[0],a=n[1],l=n[2],u=n[3],c=n[4],d=n[5],f=n[6],h=n[7],g=0;g<16;g++)p=o+4*g,t[g]=(255&i[p])<<24|(255&i[p+1])<<16|(255&i[p+2])<<8|255&i[p+3];for(g=16;g<64;g++)v=((m=t[g-2])>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,y=((m=t[g-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>3,t[g]=(v+t[g-7]|0)+(y+t[g-16]|0);for(g=0;g<64;g++)v=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&d^~c&f)|0)+(h+(e[g]+t[g]|0)|0)|0,y=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&a^s&l^a&l)|0,h=f,f=d,d=c,c=u+v|0,u=l,l=a,a=s,s=v+y|0;n[0]+=s,n[1]+=a,n[2]+=l,n[3]+=u,n[4]+=c,n[5]+=d,n[6]+=f,n[7]+=h,o+=64,r-=64}return o}var i=function(){function e(){this.digestLength=t.digestLength,this.blockSize=t.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return e.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},e.prototype.clean=function(){for(var t=0;t<this.buffer.length;t++)this.buffer[t]=0;for(t=0;t<this.temp.length;t++)this.temp[t]=0;this.reset()},e.prototype.update=function(t,e){if(void 0===e&&(e=t.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var i=0;if(this.bytesHashed+=e,this.bufferLength>0){for(;this.bufferLength<64&&e>0;)this.buffer[this.bufferLength++]=t[i++],e--;64===this.bufferLength&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(e>=64&&(i=n(this.temp,this.state,t,i,e),e%=64);e>0;)this.buffer[this.bufferLength++]=t[i++],e--;return this},e.prototype.finish=function(t){if(!this.finished){var e=this.bytesHashed,i=this.bufferLength,o=e/536870912|0,r=e<<3,s=e%64<56?64:128;this.buffer[i]=128;for(var a=i+1;a<s-8;a++)this.buffer[a]=0;this.buffer[s-8]=o>>>24&255,this.buffer[s-7]=o>>>16&255,this.buffer[s-6]=o>>>8&255,this.buffer[s-5]=o>>>0&255,this.buffer[s-4]=r>>>24&255,this.buffer[s-3]=r>>>16&255,this.buffer[s-2]=r>>>8&255,this.buffer[s-1]=r>>>0&255,n(this.temp,this.state,this.buffer,0,s),this.finished=!0}for(a=0;a<8;a++)t[4*a+0]=this.state[a]>>>24&255,t[4*a+1]=this.state[a]>>>16&255,t[4*a+2]=this.state[a]>>>8&255,t[4*a+3]=this.state[a]>>>0&255;return this},e.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},e.prototype._saveState=function(t){for(var e=0;e<this.state.length;e++)t[e]=this.state[e]},e.prototype._restoreState=function(t,e){for(var n=0;n<this.state.length;n++)this.state[n]=t[n];this.bytesHashed=e,this.finished=!1,this.bufferLength=0},e}();t.Hash=i;var o=function(){function t(t){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var e=new Uint8Array(this.blockSize);if(t.length>this.blockSize)(new i).update(t).finish(e).clean();else for(var n=0;n<t.length;n++)e[n]=t[n];for(n=0;n<e.length;n++)e[n]^=54;for(this.inner.update(e),n=0;n<e.length;n++)e[n]^=106;for(this.outer.update(e),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate),n=0;n<e.length;n++)e[n]=0}return t.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},t.prototype.clean=function(){for(var t=0;t<this.istate.length;t++)this.ostate[t]=this.istate[t]=0;this.inner.clean(),this.outer.clean()},t.prototype.update=function(t){return this.inner.update(t),this},t.prototype.finish=function(t){return this.outer.finished?this.outer.finish(t):(this.inner.finish(t),this.outer.update(t,this.digestLength).finish(t)),this},t.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},t}();function r(t){var e=(new i).update(t),n=e.digest();return e.clean(),n}function s(t,e){var n=new o(t).update(e),i=n.digest();return n.clean(),i}function a(t,e,n,i){var o=i[0];if(0===o)throw new Error("hkdf: cannot expand more");e.reset(),o>1&&e.update(t),n&&e.update(n),e.update(i),e.finish(t),i[0]++}t.HMAC=o,t.hash=r,t.default=r,t.hmac=s;var l=new Uint8Array(t.digestLength);t.hkdf=function(t,e,n,i){void 0===e&&(e=l),void 0===i&&(i=32);for(var r=new Uint8Array([1]),u=s(e,t),c=new o(u),d=new Uint8Array(c.digestLength),f=d.length,h=new Uint8Array(i),m=0;m<i;m++)f===d.length&&(a(d,c,n,r),f=0),h[m]=d[f++];return c.clean(),d.fill(0),r.fill(0),h},t.pbkdf2=function(t,e,n,i){for(var r=new o(t),s=r.digestLength,a=new Uint8Array(4),l=new Uint8Array(s),u=new Uint8Array(s),c=new Uint8Array(i),d=0;d*s<i;d++){var f=d+1;a[0]=f>>>24&255,a[1]=f>>>16&255,a[2]=f>>>8&255,a[3]=f>>>0&255,r.reset(),r.update(e),r.update(a),r.finish(u);for(var h=0;h<s;h++)l[h]=u[h];for(h=2;h<=n;h++){r.reset(),r.update(u).finish(u);for(var m=0;m<s;m++)l[m]^=u[m]}for(h=0;h<s&&d*s+h<i;h++)c[d*s+h]=l[h]}for(d=0;d<s;d++)l[d]=u[d]=0;for(d=0;d<4;d++)a[d]=0;return r.clean(),c}}(r);var s=r.default;for(var a in r)s[a]=r[a];"object"==typeof t.exports?t.exports=s:void 0===(i=function(){return s}.call(r,n,r,t))||(t.exports=i)}()},6572:function(t){var e;t.exports=(e=function(t,e){var n=Array.prototype.concat,i=Array.prototype.slice,o=Object.prototype.toString;function r(e,n){var i=e>n?e:n;return t.pow(10,17-~~(t.log(i>0?i:-i)*t.LOG10E))}var s=Array.isArray||function(t){return"[object Array]"===o.call(t)};function a(t){return"[object Function]"===o.call(t)}function l(t){return"number"==typeof t&&t-t==0}function u(){return new u._init(arguments)}function c(){return 0}function d(){return 1}function f(t,e){return t===e?1:0}u.fn=u.prototype,u._init=function(t){if(s(t[0]))if(s(t[0][0])){a(t[1])&&(t[0]=u.map(t[0],t[1]));for(var e=0;e<t[0].length;e++)this[e]=t[0][e];this.length=t[0].length}else this[0]=a(t[1])?u.map(t[0],t[1]):t[0],this.length=1;else if(l(t[0]))this[0]=u.seq.apply(null,t),this.length=1;else{if(t[0]instanceof u)return u(t[0].toArray());this[0]=[],this.length=1}return this},u._init.prototype=u.prototype,u._init.constructor=u,u.utils={calcRdx:r,isArray:s,isFunction:a,isNumber:l,toVector:function(t){return n.apply([],t)}},u._random_fn=t.random,u.setRandom=function(t){if("function"!=typeof t)throw new TypeError("fn is not a function");u._random_fn=t},u.extend=function(t){var e,n;if(1===arguments.length){for(n in t)u[n]=t[n];return this}for(e=1;e<arguments.length;e++)for(n in arguments[e])t[n]=arguments[e][n];return t},u.rows=function(t){return t.length||1},u.cols=function(t){return t[0].length||1},u.dimensions=function(t){return{rows:u.rows(t),cols:u.cols(t)}},u.row=function(t,e){return s(e)?e.map((function(e){return u.row(t,e)})):t[e]},u.rowa=function(t,e){return u.row(t,e)},u.col=function(t,e){if(s(e)){var n=u.arange(t.length).map((function(){return new Array(e.length)}));return e.forEach((function(e,i){u.arange(t.length).forEach((function(o){n[o][i]=t[o][e]}))})),n}for(var i=new Array(t.length),o=0;o<t.length;o++)i[o]=[t[o][e]];return i},u.cola=function(t,e){return u.col(t,e).map((function(t){return t[0]}))},u.diag=function(t){for(var e=u.rows(t),n=new Array(e),i=0;i<e;i++)n[i]=[t[i][i]];return n},u.antidiag=function(t){for(var e=u.rows(t)-1,n=new Array(e),i=0;e>=0;e--,i++)n[i]=[t[i][e]];return n},u.transpose=function(t){var e,n,i,o,r,a=[];for(s(t[0])||(t=[t]),n=t.length,i=t[0].length,r=0;r<i;r++){for(e=new Array(n),o=0;o<n;o++)e[o]=t[o][r];a.push(e)}return 1===a.length?a[0]:a},u.map=function(t,e,n){var i,o,r,a,l;for(s(t[0])||(t=[t]),o=t.length,r=t[0].length,a=n?t:new Array(o),i=0;i<o;i++)for(a[i]||(a[i]=new Array(r)),l=0;l<r;l++)a[i][l]=e(t[i][l],i,l);return 1===a.length?a[0]:a},u.cumreduce=function(t,e,n){var i,o,r,a,l;for(s(t[0])||(t=[t]),o=t.length,r=t[0].length,a=n?t:new Array(o),i=0;i<o;i++)for(a[i]||(a[i]=new Array(r)),r>0&&(a[i][0]=t[i][0]),l=1;l<r;l++)a[i][l]=e(a[i][l-1],t[i][l]);return 1===a.length?a[0]:a},u.alter=function(t,e){return u.map(t,e,!0)},u.create=function(t,e,n){var i,o,r=new Array(t);for(a(e)&&(n=e,e=t),i=0;i<t;i++)for(r[i]=new Array(e),o=0;o<e;o++)r[i][o]=n(i,o);return r},u.zeros=function(t,e){return l(e)||(e=t),u.create(t,e,c)},u.ones=function(t,e){return l(e)||(e=t),u.create(t,e,d)},u.rand=function(t,e){return l(e)||(e=t),u.create(t,e,u._random_fn)},u.identity=function(t,e){return l(e)||(e=t),u.create(t,e,f)},u.symmetric=function(t){var e,n,i=t.length;if(t.length!==t[0].length)return!1;for(e=0;e<i;e++)for(n=0;n<i;n++)if(t[n][e]!==t[e][n])return!1;return!0},u.clear=function(t){return u.alter(t,c)},u.seq=function(t,e,n,i){a(i)||(i=!1);var o,s=[],l=r(t,e),u=(e*l-t*l)/((n-1)*l),c=t;for(o=0;c<=e&&o<n;c=(t*l+u*l*++o)/l)s.push(i?i(c,o):c);return s},u.arange=function(t,n,i){var o,r=[];if(i=i||1,n===e&&(n=t,t=0),t===n||0===i)return[];if(t<n&&i<0)return[];if(t>n&&i>0)return[];if(i>0)for(o=t;o<n;o+=i)r.push(o);else for(o=t;o>n;o+=i)r.push(o);return r},u.slice=function(){function t(t,n,i,o){var r,s=[],a=t.length;if(n===e&&i===e&&o===e)return u.copy(t);if(o=o||1,(n=(n=n||0)>=0?n:a+n)===(i=(i=i||t.length)>=0?i:a+i)||0===o)return[];if(n<i&&o<0)return[];if(n>i&&o>0)return[];if(o>0)for(r=n;r<i;r+=o)s.push(t[r]);else for(r=n;r>i;r+=o)s.push(t[r]);return s}return function(e,n){var i,o;return l((n=n||{}).row)?l(n.col)?e[n.row][n.col]:t(u.rowa(e,n.row),(i=n.col||{}).start,i.end,i.step):l(n.col)?t(u.cola(e,n.col),(o=n.row||{}).start,o.end,o.step):(o=n.row||{},i=n.col||{},t(e,o.start,o.end,o.step).map((function(e){return t(e,i.start,i.end,i.step)})))}}(),u.sliceAssign=function(n,i,o){var r,s;if(l(i.row)){if(l(i.col))return n[i.row][i.col]=o;i.col=i.col||{},i.col.start=i.col.start||0,i.col.end=i.col.end||n[0].length,i.col.step=i.col.step||1,r=u.arange(i.col.start,t.min(n.length,i.col.end),i.col.step);var a=i.row;return r.forEach((function(t,e){n[a][t]=o[e]})),n}if(l(i.col)){i.row=i.row||{},i.row.start=i.row.start||0,i.row.end=i.row.end||n.length,i.row.step=i.row.step||1,s=u.arange(i.row.start,t.min(n[0].length,i.row.end),i.row.step);var c=i.col;return s.forEach((function(t,e){n[t][c]=o[e]})),n}return o[0].length===e&&(o=[o]),i.row.start=i.row.start||0,i.row.end=i.row.end||n.length,i.row.step=i.row.step||1,i.col.start=i.col.start||0,i.col.end=i.col.end||n[0].length,i.col.step=i.col.step||1,s=u.arange(i.row.start,t.min(n.length,i.row.end),i.row.step),r=u.arange(i.col.start,t.min(n[0].length,i.col.end),i.col.step),s.forEach((function(t,e){r.forEach((function(i,r){n[t][i]=o[e][r]}))})),n},u.diagonal=function(t){var e=u.zeros(t.length,t.length);return t.forEach((function(t,n){e[n][n]=t})),e},u.copy=function(t){return t.map((function(t){return l(t)?t:t.map((function(t){return t}))}))};var h=u.prototype;return h.length=0,h.push=Array.prototype.push,h.sort=Array.prototype.sort,h.splice=Array.prototype.splice,h.slice=Array.prototype.slice,h.toArray=function(){return this.length>1?i.call(this):i.call(this)[0]},h.map=function(t,e){return u(u.map(this,t,e))},h.cumreduce=function(t,e){return u(u.cumreduce(this,t,e))},h.alter=function(t){return u.alter(this,t),this},function(t){for(var e=0;e<t.length;e++)!function(t){h[t]=function(e){var n,i=this;return e?(setTimeout((function(){e.call(i,h[t].call(i))})),this):(n=u[t](this),s(n)?u(n):n)}}(t[e])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){h[t]=function(e,n){var i=this;return n?(setTimeout((function(){n.call(i,h[t].call(i,e))})),this):u(u[t](this,e))}}(t[e])}("row col".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){h[t]=function(){return u(u[t].apply(null,arguments))}}(t[e])}("create zeros ones rand identity".split(" ")),u}(Math),function(t,e){var n=t.utils.isFunction;function i(t,e){return t-e}function o(t,n,i){return e.max(n,e.min(t,i))}t.sum=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n];return e},t.sumsqrd=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n]*t[n];return e},t.sumsqerr=function(e){for(var n,i=t.mean(e),o=0,r=e.length;--r>=0;)o+=(n=e[r]-i)*n;return o},t.sumrow=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n];return e},t.product=function(t){for(var e=1,n=t.length;--n>=0;)e*=t[n];return e},t.min=function(t){for(var e=t[0],n=0;++n<t.length;)t[n]<e&&(e=t[n]);return e},t.max=function(t){for(var e=t[0],n=0;++n<t.length;)t[n]>e&&(e=t[n]);return e},t.unique=function(t){for(var e={},n=[],i=0;i<t.length;i++)e[t[i]]||(e[t[i]]=!0,n.push(t[i]));return n},t.mean=function(e){return t.sum(e)/e.length},t.meansqerr=function(e){return t.sumsqerr(e)/e.length},t.geomean=function(n){var i=n.map(e.log),o=t.mean(i);return e.exp(o)},t.median=function(t){var e=t.length,n=t.slice().sort(i);return 1&e?n[e/2|0]:(n[e/2-1]+n[e/2])/2},t.cumsum=function(e){return t.cumreduce(e,(function(t,e){return t+e}))},t.cumprod=function(e){return t.cumreduce(e,(function(t,e){return t*e}))},t.diff=function(t){var e,n=[],i=t.length;for(e=1;e<i;e++)n.push(t[e]-t[e-1]);return n},t.rank=function(t){var e,n=[],o={};for(e=0;e<t.length;e++)o[l=t[e]]?o[l]++:(o[l]=1,n.push(l));var r=n.sort(i),s={},a=1;for(e=0;e<r.length;e++){var l,u=o[l=r[e]],c=(a+(a+u-1))/2;s[l]=c,a+=u}return t.map((function(t){return s[t]}))},t.mode=function(t){var e,n=t.length,o=t.slice().sort(i),r=1,s=0,a=0,l=[];for(e=0;e<n;e++)o[e]===o[e+1]?r++:(r>s?(l=[o[e]],s=r,a=0):r===s&&(l.push(o[e]),a++),r=1);return 0===a?l[0]:l},t.range=function(e){return t.max(e)-t.min(e)},t.variance=function(e,n){return t.sumsqerr(e)/(e.length-(n?1:0))},t.pooledvariance=function(e){return e.reduce((function(e,n){return e+t.sumsqerr(n)}),0)/(e.reduce((function(t,e){return t+e.length}),0)-e.length)},t.deviation=function(e){for(var n=t.mean(e),i=e.length,o=new Array(i),r=0;r<i;r++)o[r]=e[r]-n;return o},t.stdev=function(n,i){return e.sqrt(t.variance(n,i))},t.pooledstdev=function(n){return e.sqrt(t.pooledvariance(n))},t.meandev=function(n){for(var i=t.mean(n),o=[],r=n.length-1;r>=0;r--)o.push(e.abs(n[r]-i));return t.mean(o)},t.meddev=function(n){for(var i=t.median(n),o=[],r=n.length-1;r>=0;r--)o.push(e.abs(n[r]-i));return t.median(o)},t.coeffvar=function(e){return t.stdev(e)/t.mean(e)},t.quartiles=function(t){var n=t.length,o=t.slice().sort(i);return[o[e.round(n/4)-1],o[e.round(n/2)-1],o[e.round(3*n/4)-1]]},t.quantiles=function(t,n,r,s){var a,l,u,c,d,f=t.slice().sort(i),h=[n.length],m=t.length;for(void 0===r&&(r=3/8),void 0===s&&(s=3/8),a=0;a<n.length;a++)u=m*(l=n[a])+(r+l*(1-r-s)),c=e.floor(o(u,1,m-1)),d=o(u-c,0,1),h[a]=(1-d)*f[c-1]+d*f[c];return h},t.percentile=function(t,e,n){var o=t.slice().sort(i),r=e*(o.length+(n?1:-1))+(n?0:1),s=parseInt(r),a=r-s;return s+1<o.length?o[s-1]+a*(o[s]-o[s-1]):o[s-1]},t.percentileOfScore=function(t,e,n){var i,o,r=0,s=t.length,a=!1;for("strict"===n&&(a=!0),o=0;o<s;o++)i=t[o],(a&&i<e||!a&&i<=e)&&r++;return r/s},t.histogram=function(n,i){i=i||4;var o,r=t.min(n),s=(t.max(n)-r)/i,a=n.length,l=[];for(o=0;o<i;o++)l[o]=0;for(o=0;o<a;o++)l[e.min(e.floor((n[o]-r)/s),i-1)]+=1;return l},t.covariance=function(e,n){var i,o=t.mean(e),r=t.mean(n),s=e.length,a=new Array(s);for(i=0;i<s;i++)a[i]=(e[i]-o)*(n[i]-r);return t.sum(a)/(s-1)},t.corrcoeff=function(e,n){return t.covariance(e,n)/t.stdev(e,1)/t.stdev(n,1)},t.spearmancoeff=function(e,n){return e=t.rank(e),n=t.rank(n),t.corrcoeff(e,n)},t.stanMoment=function(n,i){for(var o=t.mean(n),r=t.stdev(n),s=n.length,a=0,l=0;l<s;l++)a+=e.pow((n[l]-o)/r,i);return a/n.length},t.skewness=function(e){return t.stanMoment(e,3)},t.kurtosis=function(e){return t.stanMoment(e,4)-3};var r=t.prototype;!function(e){for(var i=0;i<e.length;i++)!function(e){r[e]=function(i,o){var s=[],a=0,l=this;if(n(i)&&(o=i,i=!1),o)return setTimeout((function(){o.call(l,r[e].call(l,i))})),this;if(this.length>1){for(l=!0===i?this:this.transpose();a<l.length;a++)s[a]=t[e](l[a]);return s}return t[e](this[0],i)}}(e[i])}("cumsum cumprod".split(" ")),function(e){for(var i=0;i<e.length;i++)!function(e){r[e]=function(i,o){var s=[],a=0,l=this;if(n(i)&&(o=i,i=!1),o)return setTimeout((function(){o.call(l,r[e].call(l,i))})),this;if(this.length>1){for("sumrow"!==e&&(l=!0===i?this:this.transpose());a<l.length;a++)s[a]=t[e](l[a]);return!0===i?t[e](t.utils.toVector(s)):s}return t[e](this[0],i)}}(e[i])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(e){for(var i=0;i<e.length;i++)!function(e){r[e]=function(){var i,o=[],s=0,a=this,l=Array.prototype.slice.call(arguments);if(n(l[l.length-1])){i=l[l.length-1];var u=l.slice(0,l.length-1);return setTimeout((function(){i.call(a,r[e].apply(a,u))})),this}i=void 0;var c=function(n){return t[e].apply(a,[n].concat(l))};if(this.length>1){for(a=a.transpose();s<a.length;s++)o[s]=c(a[s]);return o}return c(this[0])}}(e[i])}("quantiles percentileOfScore".split(" "))}(e,Math),function(t,e){t.gammaln=function(t){var n,i,o,r=0,s=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],a=1.000000000190015;for(o=(i=n=t)+5.5,o-=(n+.5)*e.log(o);r<6;r++)a+=s[r]/++i;return e.log(2.5066282746310007*a/n)-o},t.loggam=function(t){var n,i,o,r,s,a,l,u=[.08333333333333333,-.002777777777777778,.0007936507936507937,-.0005952380952380952,.0008417508417508418,-.001917526917526918,.00641025641025641,-.02955065359477124,.1796443723688307,-1.3924322169059];if(n=t,l=0,1==t||2==t)return 0;for(t<=7&&(n=t+(l=e.floor(7-t))),i=1/(n*n),o=2*e.PI,s=u[9],a=8;a>=0;a--)s*=i,s+=u[a];if(r=s/n+.5*e.log(o)+(n-.5)*e.log(n)-n,t<=7)for(a=1;a<=l;a++)r-=e.log(n-1),n-=1;return r},t.gammafn=function(t){var n,i,o,r,s=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],a=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],l=!1,u=0,c=0,d=0,f=t;if(t>171.6243769536076)return 1/0;if(f<=0){if(!(r=f%1+36e-17))return 1/0;l=(1&f?-1:1)*e.PI/e.sin(e.PI*r),f=1-f}for(o=f,i=f<1?f++:(f-=u=(0|f)-1)-1,n=0;n<8;++n)d=(d+s[n])*i,c=c*i+a[n];if(r=d/c+1,o<f)r/=o;else if(o>f)for(n=0;n<u;++n)r*=f,f++;return l&&(r=l/r),r},t.gammap=function(e,n){return t.lowRegGamma(e,n)*t.gammafn(e)},t.lowRegGamma=function(n,i){var o,r=t.gammaln(n),s=n,a=1/n,l=a,u=i+1-n,c=1/1e-30,d=1/u,f=d,h=1,m=-~(8.5*e.log(n>=1?n:1/n)+.4*n+17);if(i<0||n<=0)return NaN;if(i<n+1){for(;h<=m;h++)a+=l*=i/++s;return a*e.exp(-i+n*e.log(i)-r)}for(;h<=m;h++)f*=(d=1/(d=(o=-h*(h-n))*d+(u+=2)))*(c=u+o/c);return 1-f*e.exp(-i+n*e.log(i)-r)},t.factorialln=function(e){return e<0?NaN:t.gammaln(e+1)},t.factorial=function(e){return e<0?NaN:t.gammafn(e+1)},t.combination=function(n,i){return n>170||i>170?e.exp(t.combinationln(n,i)):t.factorial(n)/t.factorial(i)/t.factorial(n-i)},t.combinationln=function(e,n){return t.factorialln(e)-t.factorialln(n)-t.factorialln(e-n)},t.permutation=function(e,n){return t.factorial(e)/t.factorial(e-n)},t.betafn=function(n,i){if(!(n<=0||i<=0))return n+i>170?e.exp(t.betaln(n,i)):t.gammafn(n)*t.gammafn(i)/t.gammafn(n+i)},t.betaln=function(e,n){return t.gammaln(e)+t.gammaln(n)-t.gammaln(e+n)},t.betacf=function(t,n,i){var o,r,s,a,l=1e-30,u=1,c=n+i,d=n+1,f=n-1,h=1,m=1-c*t/d;for(e.abs(m)<l&&(m=l),a=m=1/m;u<=100&&(m=1+(r=u*(i-u)*t/((f+(o=2*u))*(n+o)))*m,e.abs(m)<l&&(m=l),h=1+r/h,e.abs(h)<l&&(h=l),a*=(m=1/m)*h,m=1+(r=-(n+u)*(c+u)*t/((n+o)*(d+o)))*m,e.abs(m)<l&&(m=l),h=1+r/h,e.abs(h)<l&&(h=l),a*=s=(m=1/m)*h,!(e.abs(s-1)<3e-7));u++);return a},t.gammapinv=function(n,i){var o,r,s,a,l,u,c=0,d=i-1,f=t.gammaln(i);if(n>=1)return e.max(100,i+100*e.sqrt(i));if(n<=0)return 0;for(i>1?(l=e.log(d),u=e.exp(d*(l-1)-f),a=n<.5?n:1-n,o=(2.30753+.27061*(r=e.sqrt(-2*e.log(a))))/(1+r*(.99229+.04481*r))-r,n<.5&&(o=-o),o=e.max(.001,i*e.pow(1-1/(9*i)-o/(3*e.sqrt(i)),3))):o=n<(r=1-i*(.253+.12*i))?e.pow(n/r,1/i):1-e.log(1-(n-r)/(1-r));c<12;c++){if(o<=0)return 0;if((o-=r=(s=(t.lowRegGamma(i,o)-n)/(r=i>1?u*e.exp(-(o-d)+d*(e.log(o)-l)):e.exp(-o+d*e.log(o)-f)))/(1-.5*e.min(1,s*((i-1)/o-1))))<=0&&(o=.5*(o+r)),e.abs(r)<1e-8*o)break}return o},t.erf=function(t){var n,i,o,r,s=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],a=s.length-1,l=!1,u=0,c=0;for(t<0&&(t=-t,l=!0),i=4*(n=2/(2+t))-2;a>0;a--)o=u,u=i*u-c+s[a],c=o;return r=n*e.exp(-t*t+.5*(s[0]+i*u)-c),l?r-1:1-r},t.erfc=function(e){return 1-t.erf(e)},t.erfcinv=function(n){var i,o,r,s,a=0;if(n>=2)return-100;if(n<=0)return 100;for(s=n<1?n:2-n,i=-.70711*((2.30753+.27061*(r=e.sqrt(-2*e.log(s/2))))/(1+r*(.99229+.04481*r))-r);a<2;a++)i+=(o=t.erfc(i)-s)/(1.1283791670955126*e.exp(-i*i)-i*o);return n<1?i:-i},t.ibetainv=function(n,i,o){var r,s,a,l,u,c,d,f,h,m,g=i-1,p=o-1,v=0;if(n<=0)return 0;if(n>=1)return 1;for(i>=1&&o>=1?(a=n<.5?n:1-n,c=(2.30753+.27061*(l=e.sqrt(-2*e.log(a))))/(1+l*(.99229+.04481*l))-l,n<.5&&(c=-c),d=(c*c-3)/6,f=2/(1/(2*i-1)+1/(2*o-1)),h=c*e.sqrt(d+f)/f-(1/(2*o-1)-1/(2*i-1))*(d+5/6-2/(3*f)),c=i/(i+o*e.exp(2*h))):(r=e.log(i/(i+o)),s=e.log(o/(i+o)),c=n<(l=e.exp(i*r)/i)/(h=l+(u=e.exp(o*s)/o))?e.pow(i*h*n,1/i):1-e.pow(o*h*(1-n),1/o)),m=-t.gammaln(i)-t.gammaln(o)+t.gammaln(i+o);v<10;v++){if(0===c||1===c)return c;if((c-=l=(u=(t.ibeta(c,i,o)-n)/(l=e.exp(g*e.log(c)+p*e.log(1-c)+m)))/(1-.5*e.min(1,u*(g/c-p/(1-c)))))<=0&&(c=.5*(c+l)),c>=1&&(c=.5*(c+l+1)),e.abs(l)<1e-8*c&&v>0)break}return c},t.ibeta=function(n,i,o){var r=0===n||1===n?0:e.exp(t.gammaln(i+o)-t.gammaln(i)-t.gammaln(o)+i*e.log(n)+o*e.log(1-n));return!(n<0||n>1)&&(n<(i+1)/(i+o+2)?r*t.betacf(n,i,o)/i:1-r*t.betacf(1-n,o,i)/o)},t.randn=function(n,i){var o,r,s,a,l;if(i||(i=n),n)return t.create(n,i,(function(){return t.randn()}));do{o=t._random_fn(),r=1.7156*(t._random_fn()-.5),l=(s=o-.449871)*s+(a=e.abs(r)+.386595)*(.196*a-.25472*s)}while(l>.27597&&(l>.27846||r*r>-4*e.log(o)*o*o));return r/o},t.randg=function(n,i,o){var r,s,a,l,u,c,d=n;if(o||(o=i),n||(n=1),i)return(c=t.zeros(i,o)).alter((function(){return t.randg(n)})),c;n<1&&(n+=1),r=n-1/3,s=1/e.sqrt(9*r);do{do{l=1+s*(u=t.randn())}while(l<=0);l*=l*l,a=t._random_fn()}while(a>1-.331*e.pow(u,4)&&e.log(a)>.5*u*u+r*(1-l+e.log(l)));if(n==d)return r*l;do{a=t._random_fn()}while(0===a);return e.pow(a,1/d)*r*l},function(e){for(var n=0;n<e.length;n++)!function(e){t.fn[e]=function(){return t(t.map(this,(function(n){return t[e](n)})))}}(e[n])}("gammaln gammafn factorial factorialln".split(" ")),function(e){for(var n=0;n<e.length;n++)!function(e){t.fn[e]=function(){return t(t[e].apply(null,arguments))}}(e[n])}("randn".split(" "))}(e,Math),function(t,e){function n(t,n,i,o){for(var r,s=0,a=1,l=1,u=1,c=0,d=0;e.abs((l-d)/l)>o;)d=l,a=u+(r=-(n+c)*(n+i+c)*t/(n+2*c)/(n+2*c+1))*a,l=(s=l+r*s)+(r=(c+=1)*(i-c)*t/(n+2*c-1)/(n+2*c))*l,s/=u=a+r*u,a/=u,l/=u,u=1;return l/n}function i(n,i,o){var r=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],s=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],a=.5*n;if(a>=8)return 1;var l,u=2*t.normal.cdf(a,0,1,1,0)-1;u=u>=e.exp(-50/o)?e.pow(u,o):0;for(var c=a,d=(8-a)/(l=n>3?2:3),f=c+d,h=0,m=o-1,g=1;g<=l;g++){for(var p=0,v=.5*(f+c),y=.5*(f-c),C=1;C<=12;C++){var w,A=v+y*(6<C?r[(w=12-C+1)-1]:-r[(w=C)-1]),b=A*A;if(b>60)break;var S=2*t.normal.cdf(A,0,1,1,0)*.5-2*t.normal.cdf(A,n,1,1,0)*.5;S>=e.exp(-30/m)&&(p+=S=s[w-1]*e.exp(-.5*b)*e.pow(S,m))}h+=p*=2*y*o/e.sqrt(2*e.PI),c=f,f+=d}return(u+=h)<=e.exp(-30/i)?0:(u=e.pow(u,i))>=1?1:u}!function(e){for(var n=0;n<e.length;n++)!function(e){t[e]=function t(e,n,i){return this instanceof t?(this._a=e,this._b=n,this._c=i,this):new t(e,n,i)},t.fn[e]=function(n,i,o){var r=t[e](n,i,o);return r.data=this,r},t[e].prototype.sample=function(n){var i=this._a,o=this._b,r=this._c;return n?t.alter(n,(function(){return t[e].sample(i,o,r)})):t[e].sample(i,o,r)},function(n){for(var i=0;i<n.length;i++)!function(n){t[e].prototype[n]=function(i){var o=this._a,r=this._b,s=this._c;return i||0===i||(i=this.data),"number"!=typeof i?t.fn.map.call(i,(function(i){return t[e][n](i,o,r,s)})):t[e][n](i,o,r,s)}}(n[i])}("pdf cdf inv".split(" ")),function(n){for(var i=0;i<n.length;i++)!function(n){t[e].prototype[n]=function(){return t[e][n](this._a,this._b,this._c)}}(n[i])}("mean median mode variance".split(" "))}(e[n])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),t.extend(t.beta,{pdf:function(n,i,o){return n>1||n<0?0:1==i&&1==o?1:i<512&&o<512?e.pow(n,i-1)*e.pow(1-n,o-1)/t.betafn(i,o):e.exp((i-1)*e.log(n)+(o-1)*e.log(1-n)-t.betaln(i,o))},cdf:function(e,n,i){return e>1||e<0?1*(e>1):t.ibeta(e,n,i)},inv:function(e,n,i){return t.ibetainv(e,n,i)},mean:function(t,e){return t/(t+e)},median:function(e,n){return t.ibetainv(.5,e,n)},mode:function(t,e){return(t-1)/(t+e-2)},sample:function(e,n){var i=t.randg(e);return i/(i+t.randg(n))},variance:function(t,n){return t*n/(e.pow(t+n,2)*(t+n+1))}}),t.extend(t.centralF,{pdf:function(n,i,o){var r;return n<0?0:i<=2?0===n&&i<2?1/0:0===n&&2===i?1:1/t.betafn(i/2,o/2)*e.pow(i/o,i/2)*e.pow(n,i/2-1)*e.pow(1+i/o*n,-(i+o)/2):(r=i*n/(o+n*i),i*(o/(o+n*i))/2*t.binomial.pdf((i-2)/2,(i+o-2)/2,r))},cdf:function(e,n,i){return e<0?0:t.ibeta(n*e/(n*e+i),n/2,i/2)},inv:function(e,n,i){return i/(n*(1/t.ibetainv(e,n/2,i/2)-1))},mean:function(t,e){return e>2?e/(e-2):void 0},mode:function(t,e){return t>2?e*(t-2)/(t*(e+2)):void 0},sample:function(e,n){return 2*t.randg(e/2)/e/(2*t.randg(n/2)/n)},variance:function(t,e){if(!(e<=4))return 2*e*e*(t+e-2)/(t*(e-2)*(e-2)*(e-4))}}),t.extend(t.cauchy,{pdf:function(t,n,i){return i<0?0:i/(e.pow(t-n,2)+e.pow(i,2))/e.PI},cdf:function(t,n,i){return e.atan((t-n)/i)/e.PI+.5},inv:function(t,n,i){return n+i*e.tan(e.PI*(t-.5))},median:function(t){return t},mode:function(t){return t},sample:function(n,i){return t.randn()*e.sqrt(1/(2*t.randg(.5)))*i+n}}),t.extend(t.chisquare,{pdf:function(n,i){return n<0?0:0===n&&2===i?.5:e.exp((i/2-1)*e.log(n)-n/2-i/2*e.log(2)-t.gammaln(i/2))},cdf:function(e,n){return e<0?0:t.lowRegGamma(n/2,e/2)},inv:function(e,n){return 2*t.gammapinv(e,.5*n)},mean:function(t){return t},median:function(t){return t*e.pow(1-2/(9*t),3)},mode:function(t){return t-2>0?t-2:0},sample:function(e){return 2*t.randg(e/2)},variance:function(t){return 2*t}}),t.extend(t.exponential,{pdf:function(t,n){return t<0?0:n*e.exp(-n*t)},cdf:function(t,n){return t<0?0:1-e.exp(-n*t)},inv:function(t,n){return-e.log(1-t)/n},mean:function(t){return 1/t},median:function(t){return 1/t*e.log(2)},mode:function(){return 0},sample:function(n){return-1/n*e.log(t._random_fn())},variance:function(t){return e.pow(t,-2)}}),t.extend(t.gamma,{pdf:function(n,i,o){return n<0?0:0===n&&1===i?1/o:e.exp((i-1)*e.log(n)-n/o-t.gammaln(i)-i*e.log(o))},cdf:function(e,n,i){return e<0?0:t.lowRegGamma(n,e/i)},inv:function(e,n,i){return t.gammapinv(e,n)*i},mean:function(t,e){return t*e},mode:function(t,e){if(t>1)return(t-1)*e},sample:function(e,n){return t.randg(e)*n},variance:function(t,e){return t*e*e}}),t.extend(t.invgamma,{pdf:function(n,i,o){return n<=0?0:e.exp(-(i+1)*e.log(n)-o/n-t.gammaln(i)+i*e.log(o))},cdf:function(e,n,i){return e<=0?0:1-t.lowRegGamma(n,i/e)},inv:function(e,n,i){return i/t.gammapinv(1-e,n)},mean:function(t,e){return t>1?e/(t-1):void 0},mode:function(t,e){return e/(t+1)},sample:function(e,n){return n/t.randg(e)},variance:function(t,e){if(!(t<=2))return e*e/((t-1)*(t-1)*(t-2))}}),t.extend(t.kumaraswamy,{pdf:function(t,n,i){return 0===t&&1===n?i:1===t&&1===i?n:e.exp(e.log(n)+e.log(i)+(n-1)*e.log(t)+(i-1)*e.log(1-e.pow(t,n)))},cdf:function(t,n,i){return t<0?0:t>1?1:1-e.pow(1-e.pow(t,n),i)},inv:function(t,n,i){return e.pow(1-e.pow(1-t,1/i),1/n)},mean:function(e,n){return n*t.gammafn(1+1/e)*t.gammafn(n)/t.gammafn(1+1/e+n)},median:function(t,n){return e.pow(1-e.pow(2,-1/n),1/t)},mode:function(t,n){if(t>=1&&n>=1&&1!==t&&1!==n)return e.pow((t-1)/(t*n-1),1/t)},variance:function(){throw new Error("variance not yet implemented")}}),t.extend(t.lognormal,{pdf:function(t,n,i){return t<=0?0:e.exp(-e.log(t)-.5*e.log(2*e.PI)-e.log(i)-e.pow(e.log(t)-n,2)/(2*i*i))},cdf:function(n,i,o){return n<0?0:.5+.5*t.erf((e.log(n)-i)/e.sqrt(2*o*o))},inv:function(n,i,o){return e.exp(-1.4142135623730951*o*t.erfcinv(2*n)+i)},mean:function(t,n){return e.exp(t+n*n/2)},median:function(t){return e.exp(t)},mode:function(t,n){return e.exp(t-n*n)},sample:function(n,i){return e.exp(t.randn()*i+n)},variance:function(t,n){return(e.exp(n*n)-1)*e.exp(2*t+n*n)}}),t.extend(t.noncentralt,{pdf:function(n,i,o){return e.abs(o)<1e-14?t.studentt.pdf(n,i):e.abs(n)<1e-14?e.exp(t.gammaln((i+1)/2)-o*o/2-.5*e.log(e.PI*i)-t.gammaln(i/2)):i/n*(t.noncentralt.cdf(n*e.sqrt(1+2/i),i+2,o)-t.noncentralt.cdf(n,i,o))},cdf:function(n,i,o){var r=1e-14;if(e.abs(o)<r)return t.studentt.cdf(n,i);var s=!1;n<0&&(s=!0,o=-o);for(var a=t.normal.cdf(-o,0,1),l=r+1,u=l,c=n*n/(n*n+i),d=0,f=e.exp(-o*o/2),h=e.exp(-o*o/2-.5*e.log(2)-t.gammaln(1.5))*o;d<200||u>r||l>r;)u=l,d>0&&(f*=o*o/(2*d),h*=o*o/(2*(d+.5))),a+=.5*(l=f*t.beta.cdf(c,d+.5,i/2)+h*t.beta.cdf(c,d+1,i/2)),d++;return s?1-a:a}}),t.extend(t.normal,{pdf:function(t,n,i){return e.exp(-.5*e.log(2*e.PI)-e.log(i)-e.pow(t-n,2)/(2*i*i))},cdf:function(n,i,o){return.5*(1+t.erf((n-i)/e.sqrt(2*o*o)))},inv:function(e,n,i){return-1.4142135623730951*i*t.erfcinv(2*e)+n},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},sample:function(e,n){return t.randn()*n+e},variance:function(t,e){return e*e}}),t.extend(t.pareto,{pdf:function(t,n,i){return t<n?0:i*e.pow(n,i)/e.pow(t,i+1)},cdf:function(t,n,i){return t<n?0:1-e.pow(n/t,i)},inv:function(t,n,i){return n/e.pow(1-t,1/i)},mean:function(t,n){if(!(n<=1))return n*e.pow(t,n)/(n-1)},median:function(t,n){return t*(n*e.SQRT2)},mode:function(t){return t},variance:function(t,n){if(!(n<=2))return t*t*n/(e.pow(n-1,2)*(n-2))}}),t.extend(t.studentt,{pdf:function(n,i){return i=i>1e100?1e100:i,1/(e.sqrt(i)*t.betafn(.5,i/2))*e.pow(1+n*n/i,-(i+1)/2)},cdf:function(n,i){var o=i/2;return t.ibeta((n+e.sqrt(n*n+i))/(2*e.sqrt(n*n+i)),o,o)},inv:function(n,i){var o=t.ibetainv(2*e.min(n,1-n),.5*i,.5);return o=e.sqrt(i*(1-o)/o),n>.5?o:-o},mean:function(t){return t>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(n){return t.randn()*e.sqrt(n/(2*t.randg(n/2)))},variance:function(t){return t>2?t/(t-2):t>1?1/0:void 0}}),t.extend(t.weibull,{pdf:function(t,n,i){return t<0||n<0||i<0?0:i/n*e.pow(t/n,i-1)*e.exp(-e.pow(t/n,i))},cdf:function(t,n,i){return t<0?0:1-e.exp(-e.pow(t/n,i))},inv:function(t,n,i){return n*e.pow(-e.log(1-t),1/i)},mean:function(e,n){return e*t.gammafn(1+1/n)},median:function(t,n){return t*e.pow(e.log(2),1/n)},mode:function(t,n){return n<=1?0:t*e.pow((n-1)/n,1/n)},sample:function(n,i){return n*e.pow(-e.log(t._random_fn()),1/i)},variance:function(n,i){return n*n*t.gammafn(1+2/i)-e.pow(t.weibull.mean(n,i),2)}}),t.extend(t.uniform,{pdf:function(t,e,n){return t<e||t>n?0:1/(n-e)},cdf:function(t,e,n){return t<e?0:t<n?(t-e)/(n-e):1},inv:function(t,e,n){return e+t*(n-e)},mean:function(t,e){return.5*(t+e)},median:function(e,n){return t.mean(e,n)},mode:function(){throw new Error("mode is not yet implemented")},sample:function(e,n){return e/2+n/2+(n/2-e/2)*(2*t._random_fn()-1)},variance:function(t,n){return e.pow(n-t,2)/12}}),t.extend(t.binomial,{pdf:function(n,i,o){return 0===o||1===o?i*o===n?1:0:t.combination(i,n)*e.pow(o,n)*e.pow(1-o,i-n)},cdf:function(i,o,r){var s,a=1e-10;if(i<0)return 0;if(i>=o)return 1;if(r<0||r>1||o<=0)return NaN;var l=r,u=(i=e.floor(i))+1,c=o-i,d=u+c,f=e.exp(t.gammaln(d)-t.gammaln(c)-t.gammaln(u)+u*e.log(l)+c*e.log(1-l));return s=l<(u+1)/(d+2)?f*n(l,u,c,a):1-f*n(1-l,c,u,a),e.round(1/a*(1-s))/(1/a)}}),t.extend(t.negbin,{pdf:function(n,i,o){return n===n>>>0&&(n<0?0:t.combination(n+i-1,i-1)*e.pow(1-o,n)*e.pow(o,i))},cdf:function(e,n,i){var o=0,r=0;if(e<0)return 0;for(;r<=e;r++)o+=t.negbin.pdf(r,n,i);return o}}),t.extend(t.hypgeom,{pdf:function(n,i,o,r){if(n!=n|0)return!1;if(n<0||n<o-(i-r))return 0;if(n>r||n>o)return 0;if(2*o>i)return 2*r>i?t.hypgeom.pdf(i-o-r+n,i,i-o,i-r):t.hypgeom.pdf(r-n,i,i-o,r);if(2*r>i)return t.hypgeom.pdf(o-n,i,o,i-r);if(o<r)return t.hypgeom.pdf(n,i,r,o);for(var s=1,a=0,l=0;l<n;l++){for(;s>1&&a<r;)s*=1-o/(i-a),a++;s*=(r-l)*(o-l)/((l+1)*(i-o-r+l+1))}for(;a<r;a++)s*=1-o/(i-a);return e.min(1,e.max(0,s))},cdf:function(n,i,o,r){if(n<0||n<o-(i-r))return 0;if(n>=r||n>=o)return 1;if(2*o>i)return 2*r>i?t.hypgeom.cdf(i-o-r+n,i,i-o,i-r):1-t.hypgeom.cdf(r-n-1,i,i-o,r);if(2*r>i)return 1-t.hypgeom.cdf(o-n-1,i,o,i-r);if(o<r)return t.hypgeom.cdf(n,i,r,o);for(var s=1,a=1,l=0,u=0;u<n;u++){for(;s>1&&l<r;){var c=1-o/(i-l);a*=c,s*=c,l++}s+=a*=(r-u)*(o-u)/((u+1)*(i-o-r+u+1))}for(;l<r;l++)s*=1-o/(i-l);return e.min(1,e.max(0,s))}}),t.extend(t.poisson,{pdf:function(n,i){return i<0||n%1!=0||n<0?0:e.pow(i,n)*e.exp(-i)/t.factorial(n)},cdf:function(e,n){var i=[],o=0;if(e<0)return 0;for(;o<=e;o++)i.push(t.poisson.pdf(o,n));return t.sum(i)},mean:function(t){return t},variance:function(t){return t},sampleSmall:function(n){var i=1,o=0,r=e.exp(-n);do{o++,i*=t._random_fn()}while(i>r);return o-1},sampleLarge:function(n){var i,o,r,s,a,l,u,c,d,f,h=n;for(s=e.sqrt(h),a=e.log(h),l=.02483*(u=.931+2.53*s)-.059,c=1.1239+1.1328/(u-3.4),d=.9277-3.6224/(u-2);;){if(o=e.random()-.5,r=e.random(),f=.5-e.abs(o),i=e.floor((2*l/f+u)*o+h+.43),f>=.07&&r<=d)return i;if(!(i<0||f<.013&&r>f)&&e.log(r)+e.log(c)-e.log(l/(f*f)+u)<=i*a-h-t.loggam(i+1))return i}},sample:function(t){return t<10?this.sampleSmall(t):this.sampleLarge(t)}}),t.extend(t.triangular,{pdf:function(t,e,n,i){return n<=e||i<e||i>n?NaN:t<e||t>n?0:t<i?2*(t-e)/((n-e)*(i-e)):t===i?2/(n-e):2*(n-t)/((n-e)*(n-i))},cdf:function(t,n,i,o){return i<=n||o<n||o>i?NaN:t<=n?0:t>=i?1:t<=o?e.pow(t-n,2)/((i-n)*(o-n)):1-e.pow(i-t,2)/((i-n)*(i-o))},inv:function(t,n,i,o){return i<=n||o<n||o>i?NaN:t<=(o-n)/(i-n)?n+(i-n)*e.sqrt(t*((o-n)/(i-n))):n+(i-n)*(1-e.sqrt((1-t)*(1-(o-n)/(i-n))))},mean:function(t,e,n){return(t+e+n)/3},median:function(t,n,i){return i<=(t+n)/2?n-e.sqrt((n-t)*(n-i))/e.sqrt(2):i>(t+n)/2?t+e.sqrt((n-t)*(i-t))/e.sqrt(2):void 0},mode:function(t,e,n){return n},sample:function(n,i,o){var r=t._random_fn();return r<(o-n)/(i-n)?n+e.sqrt(r*(i-n)*(o-n)):i-e.sqrt((1-r)*(i-n)*(i-o))},variance:function(t,e,n){return(t*t+e*e+n*n-t*e-t*n-e*n)/18}}),t.extend(t.arcsine,{pdf:function(t,n,i){return i<=n?NaN:t<=n||t>=i?0:2/e.PI*e.pow(e.pow(i-n,2)-e.pow(2*t-n-i,2),-.5)},cdf:function(t,n,i){return t<n?0:t<i?2/e.PI*e.asin(e.sqrt((t-n)/(i-n))):1},inv:function(t,n,i){return n+(.5-.5*e.cos(e.PI*t))*(i-n)},mean:function(t,e){return e<=t?NaN:(t+e)/2},median:function(t,e){return e<=t?NaN:(t+e)/2},mode:function(){throw new Error("mode is not yet implemented")},sample:function(n,i){return(n+i)/2+(i-n)/2*e.sin(2*e.PI*t.uniform.sample(0,1))},variance:function(t,n){return n<=t?NaN:e.pow(n-t,2)/8}}),t.extend(t.laplace,{pdf:function(t,n,i){return i<=0?0:e.exp(-e.abs(t-n)/i)/(2*i)},cdf:function(t,n,i){return i<=0?0:t<n?.5*e.exp((t-n)/i):1-.5*e.exp(-(t-n)/i)},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},variance:function(t,e){return 2*e*e},sample:function(n,i){var o,r=t._random_fn()-.5;return n-i*((o=r)/e.abs(o))*e.log(1-2*e.abs(r))}}),t.extend(t.tukey,{cdf:function(n,o,r){var s=o,a=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],l=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(n<=0)return 0;if(r<2||s<2)return NaN;if(!Number.isFinite(n))return 1;if(r>25e3)return i(n,1,s);var u,c=.5*r,d=c*e.log(r)-r*e.log(2)-t.gammaln(c),f=c-1,h=.25*r;u=r<=100?1:r<=800?.5:r<=5e3?.25:.125,d+=e.log(u);for(var m=0,g=1;g<=50;g++){for(var p=0,v=(2*g-1)*u,y=1;y<=16;y++){var C,w;8<y?(C=y-8-1,w=d+f*e.log(v+a[C]*u)-(a[C]*u+v)*h):(C=y-1,w=d+f*e.log(v-a[C]*u)+(a[C]*u-v)*h),w>=-30&&(p+=i(8<y?n*e.sqrt(.5*(a[C]*u+v)):n*e.sqrt(.5*(-a[C]*u+v)),1,s)*l[C]*e.exp(w))}if(g*u>=1&&p<=1e-14)break;m+=p}if(p>1e-14)throw new Error("tukey.cdf failed to converge");return m>1&&(m=1),m},inv:function(n,i,o){if(o<2||i<2)return NaN;if(n<0||n>1)return NaN;if(0===n)return 0;if(1===n)return 1/0;var r,s=function(t,n,i){var o=.5-.5*t,r=e.sqrt(e.log(1/(o*o))),s=r+((((-453642210148e-16*r-.204231210125)*r-.342242088547)*r-1)*r+.322232421088)/((((.0038560700634*r+.10353775285)*r+.531103462366)*r+.588581570495)*r+.099348462606);i<120&&(s+=(s*s*s+s)/i/4);var a=.8832-.2368*s;return i<120&&(a+=-1.214/i+1.208*s/i),s*(a*e.log(n-1)+1.4142)}(n,i,o),a=t.tukey.cdf(s,i,o)-n;r=a>0?e.max(0,s-1):s+1;for(var l,u=t.tukey.cdf(r,i,o)-n,c=1;c<50;c++)if(l=r-u*(r-s)/(u-a),a=u,s=r,l<0&&(l=0,u=-n),u=t.tukey.cdf(l,i,o)-n,r=l,e.abs(r-s)<1e-4)return l;throw new Error("tukey.inv failed to converge")}})}(e,Math),function(t,e){var n,i,o=Array.prototype.push,r=t.utils.isArray;function s(e){return r(e)||e instanceof t}t.extend({add:function(e,n){return s(n)?(s(n[0])||(n=[n]),t.map(e,(function(t,e,i){return t+n[e][i]}))):t.map(e,(function(t){return t+n}))},subtract:function(e,n){return s(n)?(s(n[0])||(n=[n]),t.map(e,(function(t,e,i){return t-n[e][i]||0}))):t.map(e,(function(t){return t-n}))},divide:function(e,n){return s(n)?(s(n[0])||(n=[n]),t.multiply(e,t.inv(n))):t.map(e,(function(t){return t/n}))},multiply:function(e,n){var i,o,r,a,l,u,c,d;if(void 0===e.length&&void 0===n.length)return e*n;if(l=e.length,u=e[0].length,c=t.zeros(l,r=s(n)?n[0].length:u),d=0,s(n)){for(;d<r;d++)for(i=0;i<l;i++){for(a=0,o=0;o<u;o++)a+=e[i][o]*n[o][d];c[i][d]=a}return 1===l&&1===d?c[0][0]:c}return t.map(e,(function(t){return t*n}))},outer:function(e,n){return t.multiply(e.map((function(t){return[t]})),[n])},dot:function(e,n){s(e[0])||(e=[e]),s(n[0])||(n=[n]);for(var i,o,r=1===e[0].length&&1!==e.length?t.transpose(e):e,a=1===n[0].length&&1!==n.length?t.transpose(n):n,l=[],u=0,c=r.length,d=r[0].length;u<c;u++){for(l[u]=[],i=0,o=0;o<d;o++)i+=r[u][o]*a[u][o];l[u]=i}return 1===l.length?l[0]:l},pow:function(n,i){return t.map(n,(function(t){return e.pow(t,i)}))},exp:function(n){return t.map(n,(function(t){return e.exp(t)}))},log:function(n){return t.map(n,(function(t){return e.log(t)}))},abs:function(n){return t.map(n,(function(t){return e.abs(t)}))},norm:function(t,n){var i=0,o=0;for(isNaN(n)&&(n=2),s(t[0])&&(t=t[0]);o<t.length;o++)i+=e.pow(e.abs(t[o]),n);return e.pow(i,1/n)},angle:function(n,i){return e.acos(t.dot(n,i)/(t.norm(n)*t.norm(i)))},aug:function(t,e){var n,i=[];for(n=0;n<t.length;n++)i.push(t[n].slice());for(n=0;n<i.length;n++)o.apply(i[n],e[n]);return i},inv:function(e){for(var n,i=e.length,o=e[0].length,r=t.identity(i,o),s=t.gauss_jordan(e,r),a=[],l=0;l<i;l++)for(a[l]=[],n=o;n<s[0].length;n++)a[l][n-o]=s[l][n];return a},det:function t(e){if(2===e.length)return e[0][0]*e[1][1]-e[0][1]*e[1][0];for(var n=0,i=0;i<e.length;i++){for(var o=[],r=1;r<e.length;r++){o[r-1]=[];for(var s=0;s<e.length;s++)s<i?o[r-1][s]=e[r][s]:s>i&&(o[r-1][s-1]=e[r][s])}var a=i%2?-1:1;n+=t(o)*e[0][i]*a}return n},gauss_elimination:function(n,i){var o,r,s,a,l=0,u=0,c=n.length,d=n[0].length,f=1,h=0,m=[];for(o=(n=t.aug(n,i))[0].length,l=0;l<c;l++){for(r=n[l][l],u=l,a=l+1;a<d;a++)r<e.abs(n[a][l])&&(r=n[a][l],u=a);if(u!=l)for(a=0;a<o;a++)s=n[l][a],n[l][a]=n[u][a],n[u][a]=s;for(u=l+1;u<c;u++)for(f=n[u][l]/n[l][l],a=l;a<o;a++)n[u][a]=n[u][a]-f*n[l][a]}for(l=c-1;l>=0;l--){for(h=0,u=l+1;u<=c-1;u++)h+=m[u]*n[l][u];m[l]=(n[l][o-1]-h)/n[l][l]}return m},gauss_jordan:function(n,i){var o,r,s,a=t.aug(n,i),l=a.length,u=a[0].length,c=0;for(r=0;r<l;r++){var d=r;for(s=r+1;s<l;s++)e.abs(a[s][r])>e.abs(a[d][r])&&(d=s);var f=a[r];for(a[r]=a[d],a[d]=f,s=r+1;s<l;s++)for(c=a[s][r]/a[r][r],o=r;o<u;o++)a[s][o]-=a[r][o]*c}for(r=l-1;r>=0;r--){for(c=a[r][r],s=0;s<r;s++)for(o=u-1;o>r-1;o--)a[s][o]-=a[r][o]*a[s][r]/c;for(a[r][r]/=c,o=l;o<u;o++)a[r][o]/=c}return a},triaUpSolve:function(e,n){var i,o=e[0].length,r=t.zeros(1,o)[0],s=!1;return null!=n[0].length&&(n=n.map((function(t){return t[0]})),s=!0),t.arange(o-1,-1,-1).forEach((function(s){i=t.arange(s+1,o).map((function(t){return r[t]*e[s][t]})),r[s]=(n[s]-t.sum(i))/e[s][s]})),s?r.map((function(t){return[t]})):r},triaLowSolve:function(e,n){var i,o=e[0].length,r=t.zeros(1,o)[0],s=!1;return null!=n[0].length&&(n=n.map((function(t){return t[0]})),s=!0),t.arange(o).forEach((function(o){i=t.arange(o).map((function(t){return e[o][t]*r[t]})),r[o]=(n[o]-t.sum(i))/e[o][o]})),s?r.map((function(t){return[t]})):r},lu:function(e){var n,i=e.length,o=t.identity(i),r=t.zeros(e.length,e[0].length);return t.arange(i).forEach((function(t){r[0][t]=e[0][t]})),t.arange(1,i).forEach((function(s){t.arange(s).forEach((function(i){n=t.arange(i).map((function(t){return o[s][t]*r[t][i]})),o[s][i]=(e[s][i]-t.sum(n))/r[i][i]})),t.arange(s,i).forEach((function(i){n=t.arange(s).map((function(t){return o[s][t]*r[t][i]})),r[s][i]=e[n.length][i]-t.sum(n)}))})),[o,r]},cholesky:function(n){var i,o=n.length,r=t.zeros(n.length,n[0].length);return t.arange(o).forEach((function(s){i=t.arange(s).map((function(t){return e.pow(r[s][t],2)})),r[s][s]=e.sqrt(n[s][s]-t.sum(i)),t.arange(s+1,o).forEach((function(e){i=t.arange(s).map((function(t){return r[s][t]*r[e][t]})),r[e][s]=(n[s][e]-t.sum(i))/r[s][s]}))})),r},gauss_jacobi:function(n,i,o,r){for(var s,a,l,u,c=0,d=0,f=n.length,h=[],m=[],g=[];c<f;c++)for(h[c]=[],m[c]=[],g[c]=[],d=0;d<f;d++)c>d?(h[c][d]=n[c][d],m[c][d]=g[c][d]=0):c<d?(m[c][d]=n[c][d],h[c][d]=g[c][d]=0):(g[c][d]=n[c][d],h[c][d]=m[c][d]=0);for(l=t.multiply(t.multiply(t.inv(g),t.add(h,m)),-1),a=t.multiply(t.inv(g),i),s=o,u=t.add(t.multiply(l,o),a),c=2;e.abs(t.norm(t.subtract(u,s)))>r;)s=u,u=t.add(t.multiply(l,s),a),c++;return u},gauss_seidel:function(n,i,o,r){for(var s,a,l,u,c,d=0,f=n.length,h=[],m=[],g=[];d<f;d++)for(h[d]=[],m[d]=[],g[d]=[],s=0;s<f;s++)d>s?(h[d][s]=n[d][s],m[d][s]=g[d][s]=0):d<s?(m[d][s]=n[d][s],h[d][s]=g[d][s]=0):(g[d][s]=n[d][s],h[d][s]=m[d][s]=0);for(u=t.multiply(t.multiply(t.inv(t.add(g,h)),m),-1),l=t.multiply(t.inv(t.add(g,h)),i),a=o,c=t.add(t.multiply(u,o),l),d=2;e.abs(t.norm(t.subtract(c,a)))>r;)a=c,c=t.add(t.multiply(u,a),l),d+=1;return c},SOR:function(n,i,o,r,s){for(var a,l,u,c,d,f=0,h=n.length,m=[],g=[],p=[];f<h;f++)for(m[f]=[],g[f]=[],p[f]=[],a=0;a<h;a++)f>a?(m[f][a]=n[f][a],g[f][a]=p[f][a]=0):f<a?(g[f][a]=n[f][a],m[f][a]=p[f][a]=0):(p[f][a]=n[f][a],m[f][a]=g[f][a]=0);for(c=t.multiply(t.inv(t.add(p,t.multiply(m,s))),t.subtract(t.multiply(p,1-s),t.multiply(g,s))),u=t.multiply(t.multiply(t.inv(t.add(p,t.multiply(m,s))),i),s),l=o,d=t.add(t.multiply(c,o),u),f=2;e.abs(t.norm(t.subtract(d,l)))>r;)l=d,d=t.add(t.multiply(c,l),u),f++;return d},householder:function(n){for(var i,o,r,s,a=n.length,l=n[0].length,u=0,c=[],d=[];u<a-1;u++){for(i=0,s=u+1;s<l;s++)i+=n[s][u]*n[s][u];for(i=(n[u+1][u]>0?-1:1)*e.sqrt(i),o=e.sqrt((i*i-n[u+1][u]*i)/2),(c=t.zeros(a,1))[u+1][0]=(n[u+1][u]-i)/(2*o),r=u+2;r<a;r++)c[r][0]=n[r][u]/(2*o);d=t.subtract(t.identity(a,l),t.multiply(t.multiply(c,t.transpose(c)),2)),n=t.multiply(d,t.multiply(n,d))}return n},QR:(n=t.sum,i=t.arange,function(o){var r,s,a,l=o.length,u=o[0].length,c=t.zeros(u,u);for(o=t.copy(o),s=0;s<u;s++){for(c[s][s]=e.sqrt(n(i(l).map((function(t){return o[t][s]*o[t][s]})))),r=0;r<l;r++)o[r][s]=o[r][s]/c[s][s];for(a=s+1;a<u;a++)for(c[s][a]=n(i(l).map((function(t){return o[t][s]*o[t][a]}))),r=0;r<l;r++)o[r][a]=o[r][a]-o[r][s]*c[s][a]}return[o,c]}),lstsq:function(e,n){var i=!1;void 0===n[0].length&&(n=n.map((function(t){return[t]})),i=!0);var o=t.QR(e),r=o[0],s=o[1],a=e[0].length,l=t.slice(r,{col:{end:a}}),u=function(e){var n=(e=t.copy(e)).length,i=t.identity(n);return t.arange(n-1,-1,-1).forEach((function(n){t.sliceAssign(i,{row:n},t.divide(t.slice(i,{row:n}),e[n][n])),t.sliceAssign(e,{row:n},t.divide(t.slice(e,{row:n}),e[n][n])),t.arange(n).forEach((function(o){var r=t.multiply(e[o][n],-1),s=t.slice(e,{row:o}),a=t.multiply(t.slice(e,{row:n}),r);t.sliceAssign(e,{row:o},t.add(s,a));var l=t.slice(i,{row:o}),u=t.multiply(t.slice(i,{row:n}),r);t.sliceAssign(i,{row:o},t.add(l,u))}))})),i}(t.slice(s,{row:{end:a}})),c=t.transpose(l);void 0===c[0].length&&(c=[c]);var d=t.multiply(t.multiply(u,c),n);return void 0===d.length&&(d=[[d]]),i?d.map((function(t){return t[0]})):d},jacobi:function(n){for(var i,o,r,s,a,l,u,c=1,d=n.length,f=t.identity(d,d),h=[];1===c;){for(a=n[0][1],r=0,s=1,i=0;i<d;i++)for(o=0;o<d;o++)i!=o&&a<e.abs(n[i][o])&&(a=e.abs(n[i][o]),r=i,s=o);for(l=n[r][r]===n[s][s]?n[r][s]>0?e.PI/4:-e.PI/4:e.atan(2*n[r][s]/(n[r][r]-n[s][s]))/2,(u=t.identity(d,d))[r][r]=e.cos(l),u[r][s]=-e.sin(l),u[s][r]=e.sin(l),u[s][s]=e.cos(l),f=t.multiply(f,u),n=t.multiply(t.multiply(t.inv(u),n),u),c=0,i=1;i<d;i++)for(o=1;o<d;o++)i!=o&&e.abs(n[i][o])>.001&&(c=1)}for(i=0;i<d;i++)h.push(n[i][i]);return[f,h]},rungekutta:function(t,e,n,i,o,r){var s,a,l;if(2===r)for(;i<=n;)o+=((s=e*t(i,o))+(a=e*t(i+e,o+s)))/2,i+=e;if(4===r)for(;i<=n;)o+=((s=e*t(i,o))+2*(a=e*t(i+e/2,o+s/2))+2*(l=e*t(i+e/2,o+a/2))+e*t(i+e,o+l))/6,i+=e;return o},romberg:function(t,n,i,o){for(var r,s,a,l,u,c=0,d=(i-n)/2,f=[],h=[],m=[];c<o/2;){for(u=t(n),a=n,l=0;a<=i;a+=d,l++)f[l]=a;for(r=f.length,a=1;a<r-1;a++)u+=(a%2!=0?4:2)*t(f[a]);u=d/3*(u+t(i)),m[c]=u,d/=2,c++}for(s=m.length,r=1;1!==s;){for(a=0;a<s-1;a++)h[a]=(e.pow(4,r)*m[a+1]-m[a])/(e.pow(4,r)-1);s=h.length,m=h,h=[],r++}return m},richardson:function(t,n,i,o){function r(t,e){for(var n,i=0,o=t.length;i<o;i++)t[i]===e&&(n=i);return n}for(var s,a,l,u,c,d=e.abs(i-t[r(t,i)+1]),f=0,h=[],m=[];o>=d;)s=r(t,i+o),a=r(t,i),h[f]=(n[s]-2*n[a]+n[2*a-s])/(o*o),o/=2,f++;for(u=h.length,l=1;1!=u;){for(c=0;c<u-1;c++)m[c]=(e.pow(4,l)*h[c+1]-h[c])/(e.pow(4,l)-1);u=m.length,h=m,m=[],l++}return h},simpson:function(t,e,n,i){for(var o,r=(n-e)/i,s=t(e),a=[],l=e,u=0,c=1;l<=n;l+=r,u++)a[u]=l;for(o=a.length;c<o-1;c++)s+=(c%2!=0?4:2)*t(a[c]);return r/3*(s+t(n))},hermite:function(t,e,n,i){for(var o,r=t.length,s=0,a=0,l=[],u=[],c=[],d=[];a<r;a++){for(l[a]=1,o=0;o<r;o++)a!=o&&(l[a]*=(i-t[o])/(t[a]-t[o]));for(u[a]=0,o=0;o<r;o++)a!=o&&(u[a]+=1/(t[a]-t[o]));c[a]=(1-2*(i-t[a])*u[a])*(l[a]*l[a]),d[a]=(i-t[a])*(l[a]*l[a]),s+=c[a]*e[a]+d[a]*n[a]}return s},lagrange:function(t,e,n){for(var i,o,r=0,s=0,a=t.length;s<a;s++){for(o=e[s],i=0;i<a;i++)s!=i&&(o*=(n-t[i])/(t[s]-t[i]));r+=o}return r},cubic_spline:function(e,n,i){for(var o,r,s=e.length,a=0,l=[],u=[],c=[],d=[],f=[],h=[];a<s-1;a++)d[a]=e[a+1]-e[a];for(c[0]=0,a=1;a<s-1;a++)c[a]=3/d[a]*(n[a+1]-n[a])-3/d[a-1]*(n[a]-n[a-1]);for(a=1;a<s-1;a++)l[a]=[],u[a]=[],l[a][a-1]=d[a-1],l[a][a]=2*(d[a-1]+d[a]),l[a][a+1]=d[a],u[a][0]=c[a];for(r=t.multiply(t.inv(l),u),o=0;o<s-1;o++)f[o]=(n[o+1]-n[o])/d[o]-d[o]*(r[o+1][0]+2*r[o][0])/3,h[o]=(r[o+1][0]-r[o][0])/(3*d[o]);for(o=0;o<s&&!(e[o]>i);o++);return n[o-=1]+(i-e[o])*f[o]+t.sq(i-e[o])*r[o]+(i-e[o])*t.sq(i-e[o])*h[o]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(e){var n,i,o,r,s,a=e.length,l=e[0].length,u=0,c=[],d=[],f=[],h=[],m=[],g=[],p=[];for(u=0;u<a;u++)c[u]=t.sum(e[u])/l;for(u=0;u<l;u++)for(m[u]=[],n=0;n<a;n++)m[u][n]=e[n][u]-c[n];for(m=t.transpose(m),u=0;u<a;u++)for(g[u]=[],n=0;n<a;n++)g[u][n]=t.dot([m[u]],[m[n]])/(l-1);for(s=(o=t.jacobi(g))[0],d=o[1],p=t.transpose(s),u=0;u<d.length;u++)for(n=u;n<d.length;n++)d[u]<d[n]&&(i=d[u],d[u]=d[n],d[n]=i,f=p[u],p[u]=p[n],p[n]=f);for(r=t.transpose(m),u=0;u<a;u++)for(h[u]=[],n=0;n<r.length;n++)h[u][n]=t.dot([p[u]],[r[n]]);return[e,d,p,h]}}),function(e){for(var n=0;n<e.length;n++)!function(e){t.fn[e]=function(n,i){var o=this;return i?(setTimeout((function(){i.call(o,t.fn[e].call(o,n))}),15),this):"number"==typeof t[e](this,n)?t[e](this,n):t(t[e](this,n))}}(e[n])}("add divide multiply subtract dot pow exp log abs norm angle".split(" "))}(e,Math),function(t,e){var n=[].slice,i=t.utils.isNumber,o=t.utils.isArray;function r(t,n,i,o){if(t>1||i>1||t<=0||i<=0)throw new Error("Proportions should be greater than 0 and less than 1");var r=(t*n+i*o)/(n+o);return(t-i)/e.sqrt(r*(1-r)*(1/n+1/o))}t.extend({zscore:function(){var e=n.call(arguments);return i(e[1])?(e[0]-e[1])/e[2]:(e[0]-t.mean(e[1]))/t.stdev(e[1],e[2])},ztest:function(){var i,r=n.call(arguments);return o(r[1])?(i=t.zscore(r[0],r[1],r[3]),1===r[2]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1)):r.length>2?(i=t.zscore(r[0],r[1],r[2]),1===r[3]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1)):(i=r[0],1===r[1]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1))}}),t.extend(t.fn,{zscore:function(t,e){return(t-this.mean())/this.stdev(e)},ztest:function(n,i,o){var r=e.abs(this.zscore(n,o));return 1===i?t.normal.cdf(-r,0,1):2*t.normal.cdf(-r,0,1)}}),t.extend({tscore:function(){var i=n.call(arguments);return 4===i.length?(i[0]-i[1])/(i[2]/e.sqrt(i[3])):(i[0]-t.mean(i[1]))/(t.stdev(i[1],!0)/e.sqrt(i[1].length))},ttest:function(){var o,r=n.call(arguments);return 5===r.length?(o=e.abs(t.tscore(r[0],r[1],r[2],r[3])),1===r[4]?t.studentt.cdf(-o,r[3]-1):2*t.studentt.cdf(-o,r[3]-1)):i(r[1])?(o=e.abs(r[0]),1==r[2]?t.studentt.cdf(-o,r[1]-1):2*t.studentt.cdf(-o,r[1]-1)):(o=e.abs(t.tscore(r[0],r[1])),1==r[2]?t.studentt.cdf(-o,r[1].length-1):2*t.studentt.cdf(-o,r[1].length-1))}}),t.extend(t.fn,{tscore:function(t){return(t-this.mean())/(this.stdev(!0)/e.sqrt(this.cols()))},ttest:function(n,i){return 1===i?1-t.studentt.cdf(e.abs(this.tscore(n)),this.cols()-1):2*t.studentt.cdf(-e.abs(this.tscore(n)),this.cols()-1)}}),t.extend({anovafscore:function(){var i,o,r,s,a,l,u,c,d=n.call(arguments);if(1===d.length){for(a=new Array(d[0].length),u=0;u<d[0].length;u++)a[u]=d[0][u];d=a}for(o=new Array,u=0;u<d.length;u++)o=o.concat(d[u]);for(r=t.mean(o),i=0,u=0;u<d.length;u++)i+=d[u].length*e.pow(t.mean(d[u])-r,2);for(i/=d.length-1,l=0,u=0;u<d.length;u++)for(s=t.mean(d[u]),c=0;c<d[u].length;c++)l+=e.pow(d[u][c]-s,2);return i/(l/(o.length-d.length))},anovaftest:function(){var e,o,r,s,a=n.call(arguments);if(i(a[0]))return 1-t.centralF.cdf(a[0],a[1],a[2]);var l=t.anovafscore(a);for(e=a.length-1,r=0,s=0;s<a.length;s++)r+=a[s].length;return o=r-e-1,1-t.centralF.cdf(l,e,o)},ftest:function(e,n,i){return 1-t.centralF.cdf(e,n,i)}}),t.extend(t.fn,{anovafscore:function(){return t.anovafscore(this.toArray())},anovaftes:function(){var e,n=0;for(e=0;e<this.length;e++)n+=this[e].length;return t.ftest(this.anovafscore(),this.length-1,n-this.length)}}),t.extend({qscore:function(){var o,r,s,a,l,u=n.call(arguments);return i(u[0])?(o=u[0],r=u[1],s=u[2],a=u[3],l=u[4]):(o=t.mean(u[0]),r=t.mean(u[1]),s=u[0].length,a=u[1].length,l=u[2]),e.abs(o-r)/(l*e.sqrt((1/s+1/a)/2))},qtest:function(){var e,i=n.call(arguments);3===i.length?(e=i[0],i=i.slice(1)):7===i.length?(e=t.qscore(i[0],i[1],i[2],i[3],i[4]),i=i.slice(5)):(e=t.qscore(i[0],i[1],i[2]),i=i.slice(3));var o=i[0],r=i[1];return 1-t.tukey.cdf(e,r,o-r)},tukeyhsd:function(e){for(var n=t.pooledstdev(e),i=e.map((function(e){return t.mean(e)})),o=e.reduce((function(t,e){return t+e.length}),0),r=[],s=0;s<e.length;++s)for(var a=s+1;a<e.length;++a){var l=t.qtest(i[s],i[a],e[s].length,e[a].length,n,o,e.length);r.push([[s,a],l])}return r}}),t.extend({normalci:function(){var i,o=n.call(arguments),r=new Array(2);return i=4===o.length?e.abs(t.normal.inv(o[1]/2,0,1)*o[2]/e.sqrt(o[3])):e.abs(t.normal.inv(o[1]/2,0,1)*t.stdev(o[2])/e.sqrt(o[2].length)),r[0]=o[0]-i,r[1]=o[0]+i,r},tci:function(){var i,o=n.call(arguments),r=new Array(2);return i=4===o.length?e.abs(t.studentt.inv(o[1]/2,o[3]-1)*o[2]/e.sqrt(o[3])):e.abs(t.studentt.inv(o[1]/2,o[2].length-1)*t.stdev(o[2],!0)/e.sqrt(o[2].length)),r[0]=o[0]-i,r[1]=o[0]+i,r},significant:function(t,e){return t<e}}),t.extend(t.fn,{normalci:function(e,n){return t.normalci(e,n,this.toArray())},tci:function(e,n){return t.tci(e,n,this.toArray())}}),t.extend(t.fn,{oneSidedDifferenceOfProportions:function(e,n,i,o){var s=r(e,n,i,o);return t.ztest(s,1)},twoSidedDifferenceOfProportions:function(e,n,i,o){var s=r(e,n,i,o);return t.ztest(s,2)}})}(e,Math),e.models=function(){function t(t,n){var i=t.length,o=n[0].length-1,r=i-o-1,s=e.lstsq(n,t),a=e.multiply(n,s.map((function(t){return[t]}))).map((function(t){return t[0]})),l=e.subtract(t,a),u=e.mean(t),c=e.sum(a.map((function(t){return Math.pow(t-u,2)}))),d=e.sum(t.map((function(t,e){return Math.pow(t-a[e],2)}))),f=c+d;return{exog:n,endog:t,nobs:i,df_model:o,df_resid:r,coef:s,predict:a,resid:l,ybar:u,SST:f,SSE:c,SSR:d,R2:c/f}}function n(n){var i,o,r=(i=n.exog,o=i[0].length,e.arange(o).map((function(n){var r=e.arange(o).filter((function(t){return t!==n}));return t(e.col(i,n).map((function(t){return t[0]})),e.col(i,r))}))),s=Math.sqrt(n.SSR/n.df_resid),a=r.map((function(t){var e=t.SST,n=t.R2;return s/Math.sqrt(e*(1-n))})),l=n.coef.map((function(t,e){return(t-0)/a[e]})),u=l.map((function(t){var i=e.studentt.cdf(t,n.df_resid);return 2*(i>.5?1-i:i)})),c=e.studentt.inv(.975,n.df_resid),d=n.coef.map((function(t,e){var n=c*a[e];return[t-n,t+n]}));return{se:a,t:l,p:u,sigmaHat:s,interval95:d}}return{ols:function(i,o){var r=t(i,o),s=n(r),a=function(t){var n,i,o,r=t.R2/t.df_model/((1-t.R2)/t.df_resid);return{F_statistic:r,pvalue:1-(n=r,i=t.df_model,o=t.df_resid,e.beta.cdf(n/(o/i+n),i/2,o/2))}}(r),l=1-(1-r.R2)*((r.nobs-1)/r.df_resid);return r.t=s,r.f=a,r.adjust_R2=l,r}}}(),e.extend({buildxmatrix:function(){for(var t=new Array(arguments.length),n=0;n<arguments.length;n++)t[n]=[1].concat(arguments[n]);return e(t)},builddxmatrix:function(){for(var t=new Array(arguments[0].length),n=0;n<arguments[0].length;n++)t[n]=[1].concat(arguments[0][n]);return e(t)},buildjxmatrix:function(t){for(var n=new Array(t.length),i=0;i<t.length;i++)n[i]=t[i];return e.builddxmatrix(n)},buildymatrix:function(t){return e(t).transpose()},buildjymatrix:function(t){return t.transpose()},matrixmult:function(t,n){var i,o,r,s,a;if(t.cols()==n.rows()){if(n.rows()>1){for(s=[],i=0;i<t.rows();i++)for(s[i]=[],o=0;o<n.cols();o++){for(a=0,r=0;r<t.cols();r++)a+=t.toArray()[i][r]*n.toArray()[r][o];s[i][o]=a}return e(s)}for(s=[],i=0;i<t.rows();i++)for(s[i]=[],o=0;o<n.cols();o++){for(a=0,r=0;r<t.cols();r++)a+=t.toArray()[i][r]*n.toArray()[o];s[i][o]=a}return e(s)}},regress:function(t,n){var i=e.xtranspxinv(t),o=t.transpose(),r=e.matrixmult(e(i),o);return e.matrixmult(r,n)},regresst:function(t,n,i){var o=e.regress(t,n),r={anova:{}},s=e.jMatYBar(t,o);r.yBar=s;var a=n.mean();r.anova.residuals=e.residuals(n,s),r.anova.ssr=e.ssr(s,a),r.anova.msr=r.anova.ssr/(t[0].length-1),r.anova.sse=e.sse(n,s),r.anova.mse=r.anova.sse/(n.length-(t[0].length-1)-1),r.anova.sst=e.sst(n,a),r.anova.mst=r.anova.sst/(n.length-1),r.anova.r2=1-r.anova.sse/r.anova.sst,r.anova.r2<0&&(r.anova.r2=0),r.anova.fratio=r.anova.msr/r.anova.mse,r.anova.pvalue=e.anovaftest(r.anova.fratio,t[0].length-1,n.length-(t[0].length-1)-1),r.anova.rmse=Math.sqrt(r.anova.mse),r.anova.r2adj=1-r.anova.mse/r.anova.mst,r.anova.r2adj<0&&(r.anova.r2adj=0),r.stats=new Array(t[0].length);for(var l,u,c,d=e.xtranspxinv(t),f=0;f<o.length;f++)l=Math.sqrt(r.anova.mse*Math.abs(d[f][f])),u=Math.abs(o[f]/l),c=e.ttest(u,n.length-t[0].length-1,i),r.stats[f]=[o[f],l,u,c];return r.regress=o,r},xtranspx:function(t){return e.matrixmult(t.transpose(),t)},xtranspxinv:function(t){var n=e.matrixmult(t.transpose(),t);return e.inv(n)},jMatYBar:function(t,n){var i=e.matrixmult(t,n);return new e(i)},residuals:function(t,n){return e.matrixsubtract(t,n)},ssr:function(t,e){for(var n=0,i=0;i<t.length;i++)n+=Math.pow(t[i]-e,2);return n},sse:function(t,e){for(var n=0,i=0;i<t.length;i++)n+=Math.pow(t[i]-e[i],2);return n},sst:function(t,e){for(var n=0,i=0;i<t.length;i++)n+=Math.pow(t[i]-e,2);return n},matrixsubtract:function(t,n){for(var i=new Array(t.length),o=0;o<t.length;o++){i[o]=new Array(t[o].length);for(var r=0;r<t[o].length;r++)i[o][r]=t[o][r]-n[o][r]}return e(i)}}),e.jStat=e,e)},4788:(t,e,n)=>{"use strict";var i=n(5072),o=n.n(i),r=n(7825),s=n.n(r),a=n(7659),l=n.n(a),u=n(5056),c=n.n(u),d=n(540),f=n.n(d),h=n(1113),m=n.n(h),g=n(365),p={};p.styleTagTransform=m(),p.setAttributes=c(),p.insert=l().bind(null,"head"),p.domAPI=s(),p.insertStyleElement=f(),o()(g.A,p),g.A&&g.A.locals&&g.A.locals},5072:t=>{"use strict";var e=[];function n(t){for(var n=-1,i=0;i<e.length;i++)if(e[i].identifier===t){n=i;break}return n}function i(t,i){for(var r={},s=[],a=0;a<t.length;a++){var l=t[a],u=i.base?l[0]+i.base:l[0],c=r[u]||0,d="".concat(u," ").concat(c);r[u]=c+1;var f=n(d),h={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==f)e[f].references++,e[f].updater(h);else{var m=o(h,i);i.byIndex=a,e.splice(a,0,{identifier:d,updater:m,references:1})}s.push(d)}return s}function o(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,o){var r=i(t=t||[],o=o||{});return function(t){t=t||[];for(var s=0;s<r.length;s++){var a=n(r[s]);e[a].references--}for(var l=i(t,o),u=0;u<r.length;u++){var c=n(r[u]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}r=l}}},7659:t=>{"use strict";var e={};t.exports=function(t,n){var i=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},5056:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},7825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,o&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},1113:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},9499:(t,e,n)=>{"use strict";n.d(e,{i:()=>Q,q:()=>W});var i,o,r,s,a,l,u,c=n(7389),d=n(4328),f=n(6082),h=n(2003),m=n(8774);!function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan String",t.Onehot="One-Hot"}(i||(i={})),function(t){t.Euclidean="Euclidean",t.Manhattan="Manhattan",t.Cosine="Vector Cosine"}(o||(o={})),function(t){t.Tanimoto="Tanimoto",t.Dice="Dice",t.Asymmetric="Asymmetric",t.BraunBlanquet="Braun-Blanquet",t.Cosine="Cosine",t.Kulczynski="Kulczynski",t.McConnaughey="Mc-Connaughey",t.RogotGoldberg="Rogot-Goldberg",t.Russel="Russel",t.Sokal="Sokal",t.Hamming="Hamming",t.Euclidean="Euclidean BitArray"}(r||(r={})),function(t){t.TanimotoIntArray="TanimotoIntArray"}(s||(s={})),function(t){t.Vector="Vector",t.String="String",t.BitArray="BitArray",t.MacroMolecule="MacroMolecule",t.Number="Number",t.IntArray="IntArray",t.NumberArray="NumberArray"}(a||(a={})),function(t){t.Difference="Difference"}(l||(l={})),function(t){t.CommonItems="Common Items"}(u||(u={}));var g=n(1199);r.Tanimoto,r.Dice,r.Asymmetric,r.BraunBlanquet,r.Cosine,r.Kulczynski,r.McConnaughey,r.RogotGoldberg,r.Russel,r.Sokal,r.Hamming,r.Euclidean,r.Tanimoto,r.Dice,r.Asymmetric,r.BraunBlanquet,r.Cosine,r.Kulczynski,r.McConnaughey,r.RogotGoldberg,r.Russel,r.Sokal,r.Hamming,r.Euclidean,r.Tanimoto,r.Dice,r.Cosine,r.Tanimoto,r.Asymmetric,r.Cosine,r.Sokal,g.Z.HAMMING,g.Z.LEVENSHTEIN,g.Z.MONOMER_CHEMICAL_DISTANCE,g.Z.NEEDLEMANN_WUNSCH,new RegExp("[rd]\\((\\w)\\)p?","g");var p,v=n(3077),y=n(439),C=n(4971);async function w(t,e,n,i,o){const r=(0,v.R)(e,o),s=o.getSeqHandler(e).getNewColumnFromList("ref",[n]),a=o.getSeqHandler(s).getSplitted(0),l=i===p.IDENTITY?function(t,e){const n=e.columns.length,i=new Array(n),o=new Array(n),r=new Array(n);for(let s=0;s<n;++s){const n=e.columns.byIndex(s);i[s]=n.getRawData(),o[s]=n.categories.indexOf("");const a=s<t.length?t.getOriginal(s):y._S;r[s]=n.categories.indexOf(a)}const s=f.Column.float("Identity",e.rowCount),a=s.getRawData();for(let n=0;n<e.rowCount;++n){a[n]=0;for(let e=0;e<t.length;++e)(i[e]?i[e][n]:0)===r[e]&&++a[n];a[n]/=t.length}return s}(a,r):i===p.SIMILARITY?await async function(t,e,n){const i=e.columns.toList(),o=await async function(t,e,n){t instanceof f.Column&&(t=(0,v.R)(t,n).columns.toList());const i=(await(0,C.pj)()).getMonomerLib(),o=new Array(t.length),r=t[0].length,s=new Float32Array(r);for(let n=0;n<t.length;++n){const a=n<e.length?e.getCanonical(n):y._S,l=i.getMonomer("PEPTIDE",a)?.smiles??"",u=t[n],c=u.getRawData(),h=u.categories,m=h.indexOf("");if(o[n]={categories:h,data:c,emptyIndex:m},void 0===a)continue;const g=f.Column.fromStrings("smiles",h.map((t=>i.getMonomer("PEPTIDE",t)?.smiles??""))),p=(f.DataFrame.fromColumns([g]),await d.chem.getSimilarities(g,l)),v=p?p.getRawData():null;for(let t=0;t<r;++t){const e=c[t];a!==y._S&&e!==m?s[t]+=v[e]:a===y._S&&e===m&&(s[t]+=1)}}for(let n=0;n<s.length;++n){let i=s[n]/e.length;for(let r=0;r<t.length;++r){const t=o[r];if(r>=e.length&&t.data[n]!==t.emptyIndex||t.data[n]===t.emptyIndex&&r<e.length){i=f.FLOAT_NULL;break}}s[n]=i}return f.Column.fromFloat32Array("Similarity",s)}(i,t,n);return o}(a,r,o):null;if(null===l)throw new Error(`In bio library: Unknown sequence scoring method: ${i}`);return l.name=t.columns.getUnusedName(l.name),t.columns.add(l),l}!function(t){t.IDENTITY="identity",t.SIMILARITY="similarity"}(p||(p={}));var A,b=n(144),S=n.n(b),E=n(7233),T=n.n(E),x=n(4139),N=n(115),_=n(8608),M=n(3541),O=n(3163),I=n(7923),L=n(7654),P=n(5480),R=n(5429),k=n(9995),V=n(3657),D=n(4025);!function(t){t.UMAP="UMAP",t.T_SNE="t-SNE"}(A||(A={}));n(5540);var F,G,U,H,q,B,Y,$,j=n(4329);(G=F||(F={})).EUCLIDEAN="EUCLIDEAN",G.MANHATTAN="MANHATTAN",F.EUCLIDEAN,F.MANHATTAN,(H=U||(U={})).HAMMING="Hamming",H.EUCLIDEAN="Euclidean",H.VECTOR_COSINE="Vector Cosine",H.MANHATTAN="Manhattan",H.TANIMOTO="Tanimoto",H.LEVENSTEIN="Levenshtein",H.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",H.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",H.SOKAL="Sokal",H.COSINE="Cosine",H.ASYMMETRIC="Asymmetric",H.Difference="Difference",H.OneHot="One-Hot",U.HAMMING,U.EUCLIDEAN,U.MANHATTAN,U.VECTOR_COSINE,U.TANIMOTO,U.LEVENSTEIN,U.NEEDLEMAN_WUNSCH,U.MONOMER_CHEMICAL_DISTANCE,U.SOKAL,U.COSINE,U.ASYMMETRIC,U.Difference,U.OneHot,U.HAMMING,U.EUCLIDEAN,U.MANHATTAN,U.TANIMOTO,U.SOKAL,U.COSINE,U.ASYMMETRIC,U.LEVENSTEIN,U.NEEDLEMAN_WUNSCH,U.MONOMER_CHEMICAL_DISTANCE,U.Difference,U.OneHot,U.VECTOR_COSINE,new Set([U.HAMMING,U.LEVENSTEIN,U.NEEDLEMAN_WUNSCH,U.MONOMER_CHEMICAL_DISTANCE,U.OneHot]),new Set([U.HAMMING,U.EUCLIDEAN,U.MANHATTAN,U.MONOMER_CHEMICAL_DISTANCE,U.LEVENSTEIN,U.NEEDLEMAN_WUNSCH,U.TANIMOTO,U.COSINE,U.VECTOR_COSINE,U.SOKAL,U.ASYMMETRIC,U.OneHot,U.Difference]),new Set([U.EUCLIDEAN,U.MANHATTAN,U.OneHot,U.Difference,U.VECTOR_COSINE]),new Set([U.EUCLIDEAN,U.MANHATTAN,U.Difference,U.VECTOR_COSINE]),new Set([U.EUCLIDEAN,U.MANHATTAN,U.Difference]),new Set([U.TANIMOTO,U.COSINE,U.SOKAL,U.ASYMMETRIC]),function(t){t.ADD="ADD",t.SUB="SUB",t.MULT="MULT"}(q||(q={})),function(t){t.SQUARE="SQUARE",t.INVERSE="INVERSE",t.TRANSPOSE="TRANSPOSE",t.NORM="NORM",t.COLUMN_NORM="COLUMN_NORM"}(B||(B={})),function(t){t.SCALARMULT="SCALARMULT",t.SCALARADD="SCALARADD",t.SCALARPOW="SCALARPOW"}(Y||(Y={})),Object.prototype.toString,function(t){t.EUCLIDEAN="EUCLIDEAN",t.MANHATTAN="MANHATTAN"}($||($={}));var W,z=n(726),K=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};!function(t){t.SEQUENCE_VARIABILITY_MAP="Sequence Variability Map",t.MOST_POTENT_RESIDUES="Most Potent Residues",t.LOGO_SUMMARY_TABLE="Logo Summary Table",t.DENDROGRAM="Dendrogram",t.CLUSTER_MAX_ACTIVITY="Active peptide selection",t.MCL="MCL"}(W||(W={}));class Q{constructor(t){this.isBitsetChangedInitialized=!1,this.isUserChangedSelection=!0,this._dm=null,this.isInitialized=!1,this.isRibbonSet=!1,this.webLogoSelectedMonomers={},this.webLogoBounds={},this.cachedWebLogoTooltip={bar:"",tooltip:null},this._layoutEventInitialized=!1,this.subs=[],this.isHighlighting=!1,this.controlFire=!1,this.accordionSource=null,this._sequenceSpaceViewer=null,this._mclViewer=null,this._monomerPositionStats=null,this._settings=null,this._sequenceSpaceCols=[],this._mclCols=[],this._webLogoSelection=null,this.df=t}get monomerPositionStats(){var t;if(null!==this._monomerPositionStats)return this._monomerPositionStats;const e=this.getScaledActivityColumn();return null===this.positionColumns||null===e?null:(null!==(t=this._monomerPositionStats)&&void 0!==t||(this._monomerPositionStats=(0,V.Ej)(e,this.df.filter,this.positionColumns)),this._monomerPositionStats)}get analysisView(){var t,e,n;return void 0===this._analysisView&&(this._analysisView=this.id?S()(d.shell.tableViews).find((({dataFrame:t})=>(null==t?void 0:t.getTag(f.TAGS.ID))===this.id)):void 0,!this._analysisView&&(null===(t=d.shell.v)||void 0===t?void 0:t.preview)instanceof f.TableView&&(null===(n=null===(e=d.shell.v)||void 0===e?void 0:e.preview)||void 0===n?void 0:n.dataFrame)===this.df&&(this._analysisView=d.shell.v.preview),this._analysisView||(this._analysisView=d.shell.addTableView(this.df))),"1"===this.df.getTag(x.gp.MULTIPLE_VIEWS)||this._layoutEventInitialized||(0,_.Lv)()||(d.shell.v=this._analysisView),this._analysisView.grid.invalidate(),this._analysisView}get settings(){var t,e;const n=this.df.getTag(x.gp.SETTINGS);return n?(null!==(t=this._settings)&&void 0!==t||(this._settings=JSON.parse(n)),!(null===(e=this._settings)||void 0===e?void 0:e.mclSettings)||this._settings.mclSettings.webGPUDescriptionPromise instanceof Promise||(this._settings.mclSettings.webGPUDescriptionPromise=(0,j._)()),this._settings):null}set settings(t){var e,n,i;const o=Object.entries(t),r=Object.assign({},null!==(n=null===(e=this.settings)||void 0===e?void 0:e.sequenceSpaceParams)&&void 0!==n?n:{}),s=new Set;for(const[t,e]of o)switch(this.settings[t]=e,t){case"activityColumnName":case"activityScaling":s.add("activity"),s.add("stats");break;case"showDendrogram":s.add("dendrogram");break;case"showClusterMaxActivity":s.add("clusterMaxActivity");break;case"showSequenceSpace":s.add("showSequenceSpace");break;case"showLogoSummaryTable":s.add("logoSummaryTable");break;case"showMonomerPosition":s.add("monomerPosition");break;case"showMostPotentResidues":s.add("mostPotentResidues");break;case"columns":s.add("columns");break;case"sequenceSpaceParams":s.add("sequenceSpaceParams");break;case"mclSettings":s.add("mclSettings")}if(this.df.setTag("settings",JSON.stringify(this._settings)),this.isInitialized){if(s.has("sequenceSpaceParams")){const t=this.settings.sequenceSpaceParams;Object.entries(t).some((([t,e])=>r[t]!==e&&"epsilon"!==t&&"minPts"!==t&&"clusterEmbeddings"!==t))||(s.delete("sequenceSpaceParams"),this.settings.sequenceSpaceParams.clusterEmbeddings&&s.add("clusterParams"))}s.has("sequenceSpaceParams")&&s.delete("clusterParams");for(const t of s)switch(t){case"activity":this.createScaledCol();break;case"stats":this.webLogoSelection=(0,_.ZR)(this.positionColumns),this.webLogoBounds={},this.cachedWebLogoTooltip={bar:"",tooltip:null},this._monomerPositionStats=null;break;case"dendrogram":this.settings.showDendrogram?this.addDendrogram():this.closeViewer(W.DENDROGRAM);break;case"clusterMaxActivity":this.settings.showClusterMaxActivity?this.addClusterMaxActivityViewer():this.closeViewer(W.CLUSTER_MAX_ACTIVITY);break;case"logoSummaryTable":this.settings.showLogoSummaryTable?this.addLogoSummaryTable():this.closeViewer(W.LOGO_SUMMARY_TABLE);break;case"monomerPosition":this.settings.showMonomerPosition?this.addMonomerPosition():this.closeViewer(W.SEQUENCE_VARIABILITY_MAP);break;case"mostPotentResidues":this.settings.showMostPotentResidues?this.addMostPotentResidues():this.closeViewer(W.MOST_POTENT_RESIDUES);break;case"columns":const t=this.findViewer(W.LOGO_SUMMARY_TABLE);t._viewerGrid=null,t._logoSummaryTable=null,t.render();const e=this.findViewer(W.MOST_POTENT_RESIDUES);e._viewerGrid=null,e.render();break;case"sequenceSpaceParams":case"showSequenceSpace":this.settings.showSequenceSpace&&this.addSequenceSpace({clusterEmbeddings:null===(i=this.settings.sequenceSpaceParams)||void 0===i?void 0:i.clusterEmbeddings});break;case"clusterParams":this.clusterEmbeddings();break;case"mclSettings":this.addMCLClusters()}}}get webLogoSelection(){var t;const e=this.df.getTag(`${x.YX.WL}${x.gp.INVARIANT_MAP_SELECTION}`);return null!==(t=this._webLogoSelection)&&void 0!==t||(this._webLogoSelection=null===e&&null!==this.positionColumns?(0,_.ZR)(this.positionColumns):JSON.parse(null!=e?e:"{}")),this._webLogoSelection}set webLogoSelection(t){this._webLogoSelection=t,this.df.setTag(`${x.YX.WL}${x.gp.INVARIANT_MAP_SELECTION}`,JSON.stringify(t)),this.fireBitsetChanged(null),this.analysisView.grid.invalidate()}get positionColumns(){const t=S()(this.df.columns.byTags({[x.gp.POSITION_COL]:"true"})).toArray();return 0===t.length?null:t}get id(){return this.df.getTag(f.TAGS.ID)}get alphabet(){return this.df.getCol(this.settings.sequenceColumnName).getTag(h.gp.alphabet)}static getInstance(t){if(t.columns.contains(x.$2.ACTIVITY_SCALED)&&!t.columns.contains(x.$2.ACTIVITY)&&(t.getCol(x.$2.ACTIVITY_SCALED).name=x.$2.ACTIVITY),!t.temp[Q.modelName]){const e=t.temp[Q.modelName]=new Q(t),n=e.settings;n&&e.init(n);let i=!0;e.subs.push(f.debounce(t.onSelectionChanged,10).subscribe((n=>{var o,r,s;if(i||t.selection.anyTrue||!e._analysisView||!document.contains(e._analysisView.root)||e._analysisView.dataFrame!==t)return void(i=!(null===(o=null==t?void 0:t.selection)||void 0===o?void 0:o.anyTrue));e.positionColumns&&(e.webLogoSelection=(0,_.ZR)(e.positionColumns));const a=e.findViewer(W.SEQUENCE_VARIABILITY_MAP);if(null!=a){const t=null!==(r=e.positionColumns)&&void 0!==r?r:a.positionColumns;t&&(a.invariantMapSelection=(0,_.ZR)(t),a.mutationCliffsSelection=(0,_.ZR)(t))}const l=e.findViewer(W.MOST_POTENT_RESIDUES);if(null!=l){const t=null!==(s=e.positionColumns)&&void 0!==s?s:l.positionColumns;t&&(l.mutationCliffsSelection=(0,_.ZR)(t),l.invariantMapSelection=(0,_.ZR)(t))}const u=e.findViewer(W.LOGO_SUMMARY_TABLE);null!=u&&(u.initClusterSelection({notify:!0}),u.render()),i=!0})))}return t.temp[Q.modelName]}modifyWebLogoSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.webLogoSelection=(0,_.vW)(this.webLogoSelection,t,e):this._webLogoSelection=(0,_.vW)(this.webLogoSelection,t,e)}getVisibleSelection(){return this.df.selection.clone().and(this.df.filter)}createAccordion(){var t,e,n,i,o,r,s,a,l,u;const d=null===(t=this.df)||void 0===t?void 0:t.temp[Q.modelName];if(!d)return null;const m=c.accordion("Peptides analysis panel");m.root.style.width="100%";const g=d.getVisibleSelection(),p=d.df.filter.anyFalse?` among ${d.df.filter.trueCount} filtered`:"",v=t=>{const e=[];for(const[n,i]of Object.entries(t))for(const t of i)e.push(`${n}:${t}`);return e.join(", ")},y=d.findViewer(W.LOGO_SUMMARY_TABLE),C=[],w=(null===y?[]:(null!==(n=null===(e=y.clusterSelection)||void 0===e?void 0:e[P.W.ORIGINAL])&&void 0!==n?n:[]).concat(null!==(o=null===(i=y.clusterSelection)||void 0===i?void 0:i[P.W.CUSTOM])&&void 0!==o?o:[])).join(", "),A=t=>{const e=c.divText(t);return e.innerHTML=t,e};0!==w.length&&C.push(A(`<b>Logo Summary Table</b> clusters: ${w}`));const b=d.findViewer(W.SEQUENCE_VARIABILITY_MAP),S=v(null!==(r=null==b?void 0:b.invariantMapSelection)&&void 0!==r?r:{}),E=v(null!==(s=null==b?void 0:b.mutationCliffsSelection)&&void 0!==s?s:{});0!==S.length&&C.push(A(`<b>Invariant map</b>: ${S}`)),0!==E.length&&C.push(A(`<b>Mutation cliffs</b>: ${E}`));const x=d.findViewer(W.MOST_POTENT_RESIDUES),N=v(null!==(a=null==x?void 0:x.invariantMapSelection)&&void 0!==a?a:{});0!==N.length&&C.push(A(`<b>Most potent residues</b>: ${N}`));const R=v(d.webLogoSelection);0!==R.length&&C.push(A(`<b>WebLogo</b>: ${R}`)),0!==C.length&&C.unshift(c.h1("Selection Sources"));const k=c.div(c.divV(C));m.addTitle(c.divV([c.h1(`${g.trueCount} selected rows${p}`),k],"css-gap-small")),g.anyTrue&&m.addPane("Actions",(()=>{try{const t=c.label("New view");if(T()(t).addClass("d4-link-action"),t.onclick=()=>d.createNewView(),t.onmouseover=t=>c.tooltip.show("Creates a new view from current selection",t.clientX+5,t.clientY+5),null===y)return c.divV([t]);const e=c.label("New cluster");T()(e).addClass("d4-link-action"),e.onclick=()=>{if(null===y)throw new Error("Logo summary table viewer is not found");y.clusterFromSelection()},e.onmouseover=t=>c.tooltip.show("Creates a new cluster from selection",t.clientX+5,t.clientY+5);const n=c.label("Remove cluster");return T()(n).addClass("d4-link-action"),n.onclick=()=>{const t=d.findViewer(W.LOGO_SUMMARY_TABLE);if(null===t)throw new Error("Logo summary table viewer is not found");t.removeCluster()},n.onmouseover=t=>c.tooltip.show("Removes currently selected custom cluster",t.clientX+5,t.clientY+5),n.style.visibility=0===y.clusterSelection[P.W.CUSTOM].length?"hidden":"visible",c.divV([t,e,n])}catch(t){const e=c.divText("Error in Actions");return c.tooltip.bind(e,String(t)),e}}),!0);let F=d.settings;const G=[b,x,y].filter((t=>null!==t&&(t.type!==this.accordionSource||(F=t,!1))));if(null===F)throw new Error("PeptidesError: Model is the source of accordion but is not initialized");F!==d.settings&&G.push(d.settings);const U=G.filter((t=>null!==t&&(0,_.$s)(F,t)&&(t!==d.settings||d.isInitialized)));U.push(F);const H=f.BitSet.create(d.df.rowCount);for(const t of U){const e=t===this.settings?(0,_.KT)(this.webLogoSelection,this.monomerPositionStats):t instanceof P.s?(0,_.KT)(t.clusterSelection,t.clusterStats):t instanceof M.xN?(0,_.KT)(t.mutationCliffsSelection,(0,_.qI)(null!==(l=t.mutationCliffs)&&void 0!==l?l:new Map,d.df.rowCount)):null;if(null!==e&&H.or(e),t instanceof M.J){const e=(0,_.KT)(t.invariantMapSelection,t.monomerPositionStats);null!==e&&H.or(e)}}const q=F;F===d.settings||q instanceof P.s||null==q.mutationCliffs||m.addPane("Mutation Cliffs pairs",(()=>(0,I.F)(d.df,{mutationCliffs:q.mutationCliffs,mutationCliffsSelection:q.mutationCliffsSelection,gridColumns:d.analysisView.grid.columns,sequenceColumnName:q.sequenceColumnName,positionColumns:q.positionColumns,activityCol:q.getScaledActivityColumn()}).root),!0);const B=F===d.settings,Y=B?this.webLogoSelection:F instanceof M.J?F.invariantMapSelection:{},$=F instanceof P.s?F.clusterSelection:null!==(u=null==y?void 0:y.clusterSelection)&&void 0!==u?u:{};m.addPane("Distribution",(()=>{var t;try{return(0,L.HV)(d.df,{peptideSelection:H,columns:B?null!==(t=d.settings.columns)&&void 0!==t?t:{}:F.getAggregationColumns(),activityCol:B?d.getScaledActivityColumn():F.getScaledActivityColumn(),monomerPositionSelection:Y,clusterSelection:$,clusterColName:null==y?void 0:y.clustersColumnName})}catch(t){const e=c.divText("Error in Distribution");return c.tooltip.bind(e,String(t)),e}}),!0);const j=(t,e)=>{if(null==t||null==e)return!1;for(const[n,i]of Object.entries(t))if(i!==e[n])return!1;return!0};return m.addPane("Selection",(()=>{var t;try{return function(t,e){var n,i,o;if(0===e.tableSelection.trueCount)return c.divText("No compounds selected");const r=f.DataFrame.create(t.rowCount);r.name="Selected compounds",r.filter.copyFrom(e.tableSelection);let s=null;for(let t=1;t<e.gridColumns.length;t++){const o=e.gridColumns.byIndex(t);if(!o.visible)continue;const a=o.column;if(a.type===f.COLUMN_TYPE.BOOL)continue;null===s&&o.grid&&(null===(n=o.grid.sortByColumns)||void 0===n?void 0:n.length)>0&&(null===(i=o.grid.sortTypes)||void 0===i?void 0:i.length)===o.grid.sortByColumns.length&&(s={cols:o.grid.sortByColumns,types:o.grid.sortTypes});let l=null,u=null;try{l=a.getRawData(),u=a.categories}catch(t){}const c=l&&u?a.isNumerical?t=>l[t]:t=>u[l[t]]:t=>a.get(t),d=t=>a.isNone(t)?null:c(t),h=a.name===e.activityColumn.name?r.columns.addNewFloat(o.name).init((t=>d(t))):r.columns.addNewVirtual(o.name,(t=>d(t)),a.type);for(const[t,e]of a.tags)h.setTag(t,e)}const a=r.plot.grid();a.props.showRowHeader=!1,a.root.style.maxWidth="100%",f.debounce(c.onSizeChanged(a.root),50).subscribe((t=>{var e;const n=a.root.parentElement;(null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.classList.contains("panel-content"))&&(a.root.style.height="calc(100% - 20px)",a.root.style.width="calc(100% - 20px)",a.root.style.position="absolute",a.root.style.right="10px",a.root.style.top="10px")})),(0,_.zz)(a);const l=c.box(a.root);l.style.marginLeft="0px",setTimeout((()=>{null!==s&&a.sort(s.cols,s.types);for(let t=1;t<e.gridColumns.length;t++){const n=e.gridColumns.byIndex(t);n.visible&&a.col(n.name)&&(a.col(n.name).width=n.width)}}),500);const u=(0,V.Ej)(e.activityColumn,r.filter,e.positionColumns,{isFiltered:r.filter.anyTrue||r.filter.anyFalse}),d={isSelectionTable:!0,cachedWebLogoTooltip:()=>({bar:"",tooltip:null}),webLogoBounds:()=>({}),colorPalette:()=>e.colorPalette},h={x:0,y:0,monomerPosition:{},mpStats:u};return e.isAnalysis&&(0,O.FZ)(a,u,e.positionColumns,e.activityColumn,d,h),(null!==(o=t.columns.bySemTypeAll(f.SEMTYPE.MACROMOLECULE))&&void 0!==o?o:[]).forEach((t=>{r.col(t.name)&&(r.col(t.name).temp[D.j.notationProvider]=t.temp[D.j.notationProvider])})),l}(d.df,{positionColumns:B?d.positionColumns:F.positionColumns,columns:B?null!==(t=d.settings.columns)&&void 0!==t?t:{}:F.getAggregationColumns(),activityColumn:B?d.getScaledActivityColumn():F.getScaledActivityColumn(),gridColumns:d.analysisView.grid.columns,colorPalette:(0,h.SM)(d.df.getCol(B?d.settings.sequenceColumnName:F.sequenceColumnName),z.Z.getSeqHelper()),tableSelection:d.getCombinedSelection(),isAnalysis:null!==d.settings&&(B||j(d.settings.columns,F.getAggregationColumns()))})}catch(t){const e=c.divText("Error in Selection");return c.tooltip.bind(e,String(t)),e}}),!0),m}getScaledActivityColumn(t=!1){const e=this.df.col(x.$2.ACTIVITY);return t&&null!==e?f.DataFrame.fromColumns([e]).clone(this.df.filter).getCol(e.name):e}updateGrid(){this.joinDataFrames(),this.createScaledCol(),this.webLogoBounds={};const t={selectionCallback:(t,e)=>this.modifyWebLogoSelection(t,e),unhighlightCallback:()=>this.unhighlight(),colorPalette:()=>(0,h.SM)(this.df.getCol(this.settings.sequenceColumnName),z.Z.getSeqHelper()),webLogoBounds:()=>this.webLogoBounds,cachedWebLogoTooltip:()=>this.cachedWebLogoTooltip,highlightCallback:(t,e,n)=>{(0,_.dl)(t,e,n),this.isHighlighting=!0},isSelectionTable:!1,headerSelectedMonomers:()=>this.webLogoSelectedMonomers};if(null===this.monomerPositionStats||null===this.positionColumns)throw new Error("PeptidesError: Could not updage grid: monomerPositionStats or positionColumns are null");O.FZ(this.analysisView.grid,this.monomerPositionStats,this.positionColumns,this.getScaledActivityColumn(),t),this._layoutEventInitialized||(d.events.onViewLayoutApplied.subscribe((t=>{t.view.id===this.analysisView.id&&this.updateGrid()})),this._layoutEventInitialized=!0),this.setTooltips(),this.setBitsetCallback(),this.setGridProperties()}joinDataFrames(){const t=this.df.name,e=this.df.columns,n=(0,v.R)(this.df.getCol(this.settings.sequenceColumnName),z.Z.getSeqHelper()),i=n.columns.names();if(i.every((t=>e.contains(t))))i.forEach((t=>{this.df.col(t).setTag(x.gp.ANALYSIS_COL,"true"),this.df.col(t).setTag(x.gp.POSITION_COL,"true"),O.rI(this.df.col(t),this.alphabet)}));else for(const t of i){let i=this.df.col(t);const o=n.getCol(t);null!==i&&e.remove(t);const r=o.categories,s=o.getRawData();i=e.addNew(o.name,o.type).init((t=>r[s[t]])),i.setTag(x.gp.ANALYSIS_COL,"true"),i.setTag(x.gp.POSITION_COL,"true"),O.rI(i,this.alphabet)}this.df.name=t}createScaledCol(){const t=this.analysisView.grid,e=(0,_.Y1)(this.df.getCol(this.settings.activityColumnName),this.settings.activityScaling);this.df.columns.replace(x.$2.ACTIVITY,e),t.columns.setOrder([e.name])}unhighlight(){this.isHighlighting&&(this.df.rows.highlight(null),this.isHighlighting=!1)}setTooltips(){this.analysisView.grid.onCellTooltip(((t,e,n)=>{var i,o;return!(!t.isColHeader||(null===(i=t.tableColumn)||void 0===i?void 0:i.semType)!==x.uF.MONOMER)||!(!t.isTableCell||(null===(o=t.tableColumn)||void 0===o?void 0:o.semType)!==x.uF.MONOMER)}))}getCombinedSelection(){var t,e,n,i,o,r,s,a;const l=new m.A(this.df.rowCount,!1),u=(t,e)=>{for(const[n,i]of Object.entries(t))for(const t of i){const i=null==e?void 0:e[n];if(void 0===i)continue;const o=i[t];void 0!==o&&l.or(o.mask)}};u(this.webLogoSelection,this.monomerPositionStats);const c=this.findViewer(W.SEQUENCE_VARIABILITY_MAP);u(null!==(t=null==c?void 0:c.invariantMapSelection)&&void 0!==t?t:{},null!==(e=null==c?void 0:c.monomerPositionStats)&&void 0!==e?e:null),((t,e)=>{var n,i;for(const[o,r]of Object.entries(t))for(const t of r){const r=null!==(i=null===(n=null==e?void 0:e.get(t))||void 0===n?void 0:n.get(o))&&void 0!==i?i:null;if(null!==r)for(const[t,e]of r.entries()){l.setTrue(t);for(const t of e)l.setTrue(t)}}})(null!==(n=null==c?void 0:c.mutationCliffsSelection)&&void 0!==n?n:{},null!==(i=null==c?void 0:c.mutationCliffs)&&void 0!==i?i:null);const d=this.findViewer(W.MOST_POTENT_RESIDUES);u(null!==(o=null==d?void 0:d.invariantMapSelection)&&void 0!==o?o:{},null!==(r=null==d?void 0:d.monomerPositionStats)&&void 0!==r?r:null);const h=this.findViewer(W.LOGO_SUMMARY_TABLE);for(const t of Object.keys(null!==(s=null==h?void 0:h.clusterSelection)&&void 0!==s?s:{}))for(const e of null!==(a=h.clusterSelection[t])&&void 0!==a?a:[]){const n=h.clusterStats[t][e];l.or(n.mask)}return f.BitSet.fromBytes(l.buffer.buffer,l.length)}setBitsetCallback(){if(this.isBitsetChangedInitialized)return;const t=this.df.selection,e=this.df.filter;let n=null;const i=()=>{try{null!=n&&(clearTimeout(n),n=null);const t=this.createAccordion();if(null===t)return;d.shell.o=t.root,n=setTimeout((()=>{d.shell.o!=t.root&&(d.shell.o=t.root)}),1500)}catch(t){console.error(t)}};t.onChanged.subscribe((()=>{if(this.controlFire)this.controlFire=!1;else try{this.isUserChangedSelection||t.copyFrom(this.getCombinedSelection(),!1)}catch(t){k._package.logger.debug("Peptides: Error on selection changed"),k._package.logger.debug(t)}finally{i()}})),e.onChanged.subscribe((()=>{var t,e;try{if(this.controlFire)return void(this.controlFire=!1);const n=this.findViewer(W.LOGO_SUMMARY_TABLE);null!==n&&void 0!==n.model&&(n._logoSummaryTable=null!==(t=n.createLogoSummaryTable())&&void 0!==t?t:n._logoSummaryTable,n._viewerGrid=null!==(e=n.createLogoSummaryTableGrid())&&void 0!==e?e:n._viewerGrid,n.render())}catch(t){k._package.logger.debug("Peptides: Error on filter changed"),k._package.logger.debug(t)}finally{i()}})),this.isBitsetChangedInitialized=!0}fireBitsetChanged(t,e=!1){this.accordionSource=t,this.isBitsetChangedInitialized||this.setBitsetCallback(),this.isUserChangedSelection=!1,this.df.selection.fireChanged(),e&&this.df.filter.fireChanged(),this.controlFire=!0,this.df.selection.fireChanged(),e&&this.df.filter.fireChanged(),this.isUserChangedSelection=!0,this.webLogoSelectedMonomers=(0,_.qx)(this.df)}setGridProperties(t){var e,n,i,o;const r=this.analysisView.grid,s=r.props;s.allowColSelection=null!==(e=null==t?void 0:t.allowColSelection)&&void 0!==e&&e,s.allowEdit=null!==(n=null==t?void 0:t.allowEdit)&&void 0!==n&&n,s.showReadOnlyNotifications=null!==(i=null==t?void 0:t.showReadOnlyNotifications)&&void 0!==i&&i,s.showCurrentRowIndicator=null!==(o=null==t?void 0:t.showCurrentRowIndicator)&&void 0!==o&&o;const a=this.positionColumns;if(null===a)throw new Error("PeptidesError: Could not set grid properties: positionColumns are null");let l=10;const u=r.canvas.getContext("2d");if(null===u)throw new Error("PeptidesError: Could not set grid properties: canvas context is null");for(const t of a){const e=(0,h.zS)(t.categories.reduce(((t,e)=>t.length>e.length?t:e)),6),n=Math.ceil(u.measureText(e).width);l=Math.max(l,n)}const c=a.map((t=>t.name));for(let t=1;t<this.analysisView.grid.columns.length;++t){const e=this.analysisView.grid.columns.byIndex(t);if(null===e)throw new Error(`PeptidesError: Could not get analysis view: grid column with index '${t}' is null`);if(null===e.column)throw new Error(`PeptidesError: Could not get analysis view: grid column with index '${t}' has null column`);e.visible=c.includes(e.column.name)||e.column.name===x.$2.ACTIVITY}setTimeout((()=>{for(const t of a){const e=r.col(t.name);if(null===e)throw new Error(`PeptidesError: Could not set column width: grid column '${t.name}' is null`);e.width=l+15}}),100)}closeViewer(t){const e=this.findViewer(t);null==e||e.detach(),null==e||e.close()}findViewerNode(t){for(const e of this.analysisView.dockManager.rootNode.children)if(e.container.containerElement.innerHTML.includes(t))return e;return null}addDendrogram(){return K(this,void 0,void 0,(function*(){const t=f.TaskBarProgressIndicator.create("Calculating distance matrix...");try{const t=f.Func.find({package:"Dendrogram",name:"hierarchicalClustering"})[0];if(!t||4!==t.inputs.length)throw new Error("Correct dendrogram function is not found");yield t.apply({df:this.df,colNameList:[this.settings.sequenceColumnName],distance:"euclidean",linkage:"complete"})}catch(t){k._package.logger.error(t)}finally{t.close()}}))}init(t){if(!this.isInitialized){if(this.settings=t,this.isInitialized=!0,!this.isRibbonSet&&"1"!==this.df.getTag(x.gp.MULTIPLE_VIEWS)){const t=c.iconFA("wrench",(()=>(0,R.OH)(this)),"Peptides analysis settings");this.analysisView.setRibbonPanels([[t]],!1),this.isRibbonSet=!0,this.updateGrid()}this.subs.push(d.events.onAccordionConstructed.subscribe((t=>{if(!(d.shell.o instanceof f.SemanticValue||d.shell.o instanceof f.Column&&this.df.columns.toList().includes(d.shell.o)))return;const e=t.getPane("Actions"),n=T()(e.root).find(".d4-flex-col"),i=c.label("Calculate identity");i.classList.add("d4-link-action"),c.tooltip.bind(i,"Adds a column with fractions of matching monomers against sequence in the current row"),i.onclick=()=>{const t=this.df.getCol(this.settings.sequenceColumnName);w(this.df,t,t.get(this.df.currentRowIdx),p.IDENTITY,z.Z.getSeqHelper()).then((e=>e.setTag(x.gp.IDENTITY_TEMPLATE,t.get(this.df.currentRowIdx)))).catch((t=>k._package.logger.debug(t)))},n.append(c.span([i],"d4-markdown-row"));const o=c.label("Calculate similarity");o.classList.add("d4-link-action"),c.tooltip.bind(o,"Adds a column with sequence similarity scores against sequence in the current row"),o.onclick=()=>{const t=this.df.getCol(this.settings.sequenceColumnName);w(this.df,t,t.get(this.df.currentRowIdx),p.SIMILARITY,z.Z.getSeqHelper()).then((e=>e.setTag(x.gp.SIMILARITY_TEMPLATE,t.get(this.df.currentRowIdx)))).catch((t=>k._package.logger.debug(t)))},n.append(c.span([o],"d4-markdown-row"))}))),this.subs.push(d.events.onViewRemoved.subscribe((t=>{t.id===this.analysisView.id&&this.subs.forEach((t=>t.unsubscribe())),d.log.debug(`Peptides: view ${t.name} removed`)}))),this.subs.push(d.events.onTableRemoved.subscribe((t=>{t.id===this.df.id&&this.subs.forEach((t=>t.unsubscribe())),d.log.debug(`Peptides: table ${t.name} removed`)}))),this.subs.push(d.events.onProjectClosed.subscribe((t=>{t.id===d.shell.project.id&&this.subs.forEach((t=>t.unsubscribe())),d.log.debug(`Peptides: project ${t.name} closed`)}))),this.fireBitsetChanged(null,!0),this.analysisView.grid.invalidate()}}findViewer(t){return S()(this.analysisView.viewers).find((e=>e.type===t))||null}addLogoSummaryTable(t){return K(this,void 0,void 0,(function*(){null!=t||(t={sequenceColumnName:this.settings.sequenceColumnName,clustersColumnName:S()(this.df.columns.categorical).next().value,activityColumnName:this.settings.activityColumnName,activityScaling:this.settings.activityScaling});const e=yield this.df.plot.fromType(W.LOGO_SUMMARY_TABLE,t);(0,_.Lv)()&&this.analysisView.addViewer(e),this.analysisView.dockManager.dock(e,f.DOCK_TYPE.RIGHT,null,W.LOGO_SUMMARY_TABLE),e.viewerGrid.invalidate()}))}addClusterMaxActivityViewer(t){return K(this,void 0,void 0,(function*(){var e,n,i,o,r,s,a,l,u;const c=null!==(o=null!==(n=null===(e=this._mclCols)||void 0===e?void 0:e.find((t=>t.toLowerCase().startsWith("cluster (mcl)"))))&&void 0!==n?n:null===(i=this.findViewer(W.LOGO_SUMMARY_TABLE))||void 0===i?void 0:i.clustersColumnName)&&void 0!==o?o:null===(r=this._sequenceSpaceCols)||void 0===r?void 0:r.find((t=>t.toLowerCase().startsWith("cluster")));null!=t||(t={activityColumnName:this.settings.activityColumnName,clusterColumnName:null!=c?c:null===(s=S()(this.df.columns.categorical).next().value)||void 0===s?void 0:s.name,activityTarget:x.wf.HIGH,connectivityColumnName:null!==(l=null!==(a=this._mclCols.find((t=>t.toLowerCase().startsWith("connectivity"))))&&void 0!==a?a:this.df.columns.names().find((t=>{var e;return t.toLowerCase().includes("connectivity")&&(null===(e=this.df.col(t))||void 0===e?void 0:e.isNumerical)})))&&void 0!==l?l:"",clusterSizeThreshold:20,activityThreshold:1e3});const d=yield this.df.plot.fromType(W.CLUSTER_MAX_ACTIVITY,t),h=null!==(u=this.findViewerNode(W.LOGO_SUMMARY_TABLE))&&void 0!==u?u:null;this.analysisView.dockManager.dock(d,h?f.DOCK_TYPE.DOWN:f.DOCK_TYPE.RIGHT,h,W.CLUSTER_MAX_ACTIVITY)}))}addMonomerPosition(t){return K(this,void 0,void 0,(function*(){null!=t||(t={maxMutations:1,activityScaling:this.settings.activityScaling,activityColumnName:this.settings.activityColumnName,sequenceColumnName:this.settings.sequenceColumnName,minActivityDelta:0,activityTarget:x.wf.HIGH});const e=yield this.df.plot.fromType(W.SEQUENCE_VARIABILITY_MAP,t);(0,_.Lv)()&&this.analysisView.addViewer(e);const n=this.findViewer(W.MOST_POTENT_RESIDUES),i=this.analysisView.dockManager,[o,r,s]=null===n?[f.DOCK_TYPE.DOWN,null,void 0]:[f.DOCK_TYPE.LEFT,this.findViewerNode(W.MOST_POTENT_RESIDUES),.7];i.dock(e,o,r,W.SEQUENCE_VARIABILITY_MAP,s)}))}addMostPotentResidues(t){return K(this,void 0,void 0,(function*(){null!=t||(t={activityScaling:this.settings.activityScaling,activityColumnName:this.settings.activityColumnName,sequenceColumnName:this.settings.sequenceColumnName,minActivityDelta:0,maxMutations:1,activityTarget:x.wf.HIGH});const e=yield this.df.plot.fromType(W.MOST_POTENT_RESIDUES,t);(0,_.Lv)()&&this.analysisView.addViewer(e);const n=this.findViewer(W.SEQUENCE_VARIABILITY_MAP),i=this.analysisView.dockManager,[o,r,s]=null===n?[f.DOCK_TYPE.DOWN,null,void 0]:[f.DOCK_TYPE.RIGHT,this.findViewerNode(W.SEQUENCE_VARIABILITY_MAP),.3];i.dock(e,o,r,W.MOST_POTENT_RESIDUES,s)}))}createNewView(){const t=this.getVisibleSelection(),e=this.df.clone(t);for(const[t,n]of e.tags)e.setTag(t,t===x.gp.SETTINGS?n:"");e.name="Peptides Multiple Views",e.setTag(x.gp.MULTIPLE_VIEWS,"1");const n=d.shell.addTableView(e),i=this.findViewer(W.LOGO_SUMMARY_TABLE);return null!=i&&n.addViewer(W.LOGO_SUMMARY_TABLE,{[`sequence${x.To}`]:i.sequenceColumnName,[`activity${x.To}`]:i.activityColumnName,activityScaling:i.activityScaling,webLogoMode:i.webLogoMode,membersRatioThreshold:i.membersRatioThreshold,[`clusters${x.To}`]:i.clustersColumnName}),e.getTag(f.TAGS.ID)}clusterEmbeddings(){return K(this,void 0,void 0,(function*(){var t,e;if(!this._sequenceSpaceCols||0===this._sequenceSpaceCols.length)return void d.shell.warning("Embeddings columns are not initialized");const i=this._sequenceSpaceCols.filter((t=>t.toLowerCase().startsWith("embed_")));if(2!==i.length)return void d.shell.warning(`Found ${i.length} embeddings columns, expected 2`);const o=this._sequenceSpaceCols.filter((t=>t.toLowerCase().startsWith("cluster")));o.length>0&&this.df.columns.remove(o[0]);const r=this.df.getCol(i[0]).getRawData(),s=this.df.getCol(i[1]).getRawData(),a=null!==(t=this.settings.sequenceSpaceParams.epsilon)&&void 0!==t?t:.01,l=null!==(e=this.settings.sequenceSpaceParams.minPts)&&void 0!==e?e:4,u=yield function(t,e,i,o){return r=this,s=void 0,l=function*(){return new Promise((function(r,s){const a=new Worker(new URL(n.p+n.u(682),n.b));a.postMessage({embedX:t,embedY:e,minPts:o,epsilon:i}),a.onmessage=({data:{error:t,clusters:e}})=>{a.terminate(),t?s(t):r(e)}}))},new((a=void 0)||(a=Promise))((function(t,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function i(t){try{o(l.throw(t))}catch(t){e(t)}}function o(e){var o;e.done?t(e.value):(o=e.value,o instanceof a?o:new a((function(t){t(o)}))).then(n,i)}o((l=l.apply(r,s||[])).next())}));var r,s,a,l}(r,s,a,l),c=this.df.columns.getUnusedName("Cluster (DBSCAN)"),f=this.df.columns.addNewString(c);f.init((t=>u[t].toString())),null!==this._sequenceSpaceViewer&&(this._sequenceSpaceViewer.props.colorColumnName=f.name),this._sequenceSpaceCols=[i[0],i[1],f.name];const h=this.analysisView.grid.col(f.name);h&&(h.visible=!1)}))}addMCLClusters(){return K(this,void 0,void 0,(function*(){var t,e,n,i,o;if(null!==this._mclViewer)try{null===(t=this._mclViewer)||void 0===t||t.detach(),null===(e=this._mclViewer)||void 0===e||e.close()}catch(t){}0!==this._mclCols.length&&this._mclCols.forEach((t=>this.df.columns.remove(t))),this._mclCols=[];const r=this.df.getCol(this.settings.sequenceColumnName);null!==(n=(o=this.settings).mclSettings)&&void 0!==n||(o.mclSettings=new N.av);const s=this.settings.mclSettings;let a=0;const l=this.df.onColumnsAdded.subscribe((t=>{for(const e of t.columns)if((e.name.toLowerCase().startsWith("embed")||e.name.toLowerCase().startsWith("cluster")||e.name.toLowerCase().startsWith("connectivity"))&&e.name.toLowerCase().includes("mcl")){const t=this.analysisView.grid.col(e.name);if(null==t||this._mclCols.includes(e.name))continue;t.visible=!1,this._mclCols.push(e.name),a++}5===a&&l.unsubscribe()})),u=d.events.onViewerAdded.subscribe((t=>{try{const e=t.args.viewer;if(e.type===f.VIEWER.SCATTER_PLOT){if(this._sequenceSpaceViewer&&this.analysisView.dockManager.findNode(this._sequenceSpaceViewer.root)){const t=this.analysisView.dockManager.findNode(this._sequenceSpaceViewer.root);setTimeout((()=>{this.analysisView.dockManager.dock(e,f.DOCK_TYPE.FILL,t)}))}u.unsubscribe()}}catch(t){console.error(t)}})),c=JSON.stringify({cols:[r].map((t=>t.name)),metrics:[s.distanceF],weights:[1],aggregationMethod:$.MANHATTAN,preprocessingFuncs:["macromoleculePreprocessingFunction"],preprocessingFuncArgs:[{gapOpen:s.gapOpen,gapExtend:s.gapExtend,fingerprintType:s.fingerprintType}],threshold:s.threshold,maxIterations:s.maxIterations,useWebGPU:s.useWebGPU,inflate:s.inflation,minClusterSize:s.minClusterSize}),h=null!==(i=this.analysisView)&&void 0!==i?i:d.shell.getTableView(this.df.name);if(h){const t=f.Func.find({package:"EDA",name:"markovClusteringViewer"})[0];if(!t)throw new Error("Markov clustering function is not found");yield t.apply(),h.addViewer(W.MCL,{mclProps:c}),yield f.delay(500),this._mclViewer=this.findViewer(W.MCL),yield this._mclViewer.initPromise;const e=this.findViewer(W.LOGO_SUMMARY_TABLE);e&&(e._clusterStats=null,e._clusterSelection=null,e._viewerGrid=null,e._logoSummaryTable=null,e.render())}}))}addSequenceSpace(){return K(this,arguments,void 0,(function*(t={}){var e,n,i,o;if(null!==this._sequenceSpaceViewer)try{null===(e=this._sequenceSpaceViewer)||void 0===e||e.detach(),null===(n=this._sequenceSpaceViewer)||void 0===n||n.close()}catch(t){}0!==this._sequenceSpaceCols.length&&this._sequenceSpaceCols.forEach((t=>this.df.columns.remove(t))),this._sequenceSpaceCols=[];let r=this.df.getCol(this.settings.sequenceColumnName);const s=z.Z.getSeqHelper().getSeqHandler(r);if(s.isHelm())try{d.shell.warning("Column is in HELM notation. Sequences space will linearize sequences from position 0 prior to analysis");const t=s.convert(h.Hi.SEPARATOR,"/"),e=this.df.columns.getUnusedName(`Separator(${r.name})`);t.name=e,this.df.columns.add(t,!0),this.analysisView.grid.col(e).visible=!1,r=t}catch(t){return d.shell.error("Error on converting HELM notation to linear notation"),void d.shell.error(t)}const a=!t.clusterCol&&!!t.clusterEmbeddings,l=null!==(o=null===(i=this.settings)||void 0===i?void 0:i.sequenceSpaceParams)&&void 0!==o?o:new N.GI(a);l.clusterEmbeddings=a;const u={table:this.df,molecules:r,methodName:A.UMAP,similarityMetric:l.distanceF,plotEmbeddings:!0,options:{bypassLargeDataWarning:!0,dbScanEpsilon:l.epsilon,dbScanMinPts:l.minPts,randomSeed:"1",preprocessingFuncArgs:{gapOpen:l.gapOpen,gapExtend:l.gapExtend,fingerprintType:l.fingerprintType}},clusterEmbeddings:l.clusterEmbeddings};let c=0;const m=l.clusterEmbeddings?3:2,g=this.df.onColumnsAdded.subscribe((t=>{for(const e of t.columns)if(e.name.toLowerCase().startsWith("embed_")||l.clusterEmbeddings&&e.name.toLowerCase().startsWith("cluster")){const t=this.analysisView.grid.col(e.name);if(null==t||this._sequenceSpaceCols.includes(e.name))continue;t.visible=!1,this._sequenceSpaceCols.push(e.name),c++}c===m&&g.unsubscribe()})),p=d.events.onViewerAdded.subscribe((t=>{try{const e=t.args.viewer;if(e.type===f.VIEWER.SCATTER_PLOT){if(this._mclViewer&&this.analysisView.dockManager.findNode(this._mclViewer.root)){const t=this.analysisView.dockManager.findNode(this._mclViewer.root);setTimeout((()=>{this.analysisView.dockManager.dock(e,f.DOCK_TYPE.FILL,t)}))}p.unsubscribe()}}catch(t){console.error(t)}})),v=yield d.functions.call("Bio:sequenceSpaceTopMenu",u);p.unsubscribe(),v instanceof f.ScatterPlotViewer&&(l.clusterEmbeddings||t.clusterCol||(v.props.colorColumnName=this.getScaledActivityColumn().name),v.props.showXSelector=!1,v.props.showYSelector=!1,t.clusterCol&&(v.props.colorColumnName=t.clusterCol.name),this._sequenceSpaceViewer=v,v.onContextMenu.subscribe((t=>{try{t.item("Modify Sequence space parameters",(()=>{(0,R.OH)(this)}))}catch(t){}})))}))}}Q.modelName="peptidesModel"},9995:(t,e,n)=>{"use strict";n.d(e,{_package:()=>j,getTreeHelperInstance:()=>W});var i=n(4328),o=n(7389),r=n(6082),s=n(5082),a=n(7233),l=n.n(a),u=(n(4788),n(9499)),c=n(726),d=n(3541),f=n(5480);n(3981);class h{constructor(t){this.monomerLib=t}getCappedRotatedMonomer(t,e){const n=this.monomerLib.getMonomer(t,e);return n?n.molfile:null}}var m=n(4139),g=n(8608),p=n(2003),v=n(8070),y=n(115),C=n(5072),w=n.n(C),A=n(7825),b=n.n(A),S=n(7659),E=n.n(S),T=n(5056),x=n.n(T),N=n(540),_=n.n(N),M=n(1113),O=n.n(M),I=n(6677),L={};L.styleTagTransform=O(),L.setAttributes=x(),L.insert=E().bind(null,"head"),L.domAPI=b(),L.insertStyleElement=_(),w()(I.A,L),I.A&&I.A.locals&&I.A.locals;var P;!function(t){let e,n;!function(t){t.vert=function(t){return o.divV(t.map((t=>o.render(t))),{classes:"u2-panel"})},t.horz=function(t){return o.divH(t.map((t=>o.render(t))),{classes:"u2-panel"})}}(e=t.panels||(t.panels={})),t.appHeader=function(t){const n=o.iconImage("",t.iconPath);l()(n).addClass("ui-app-header-icon").css("margin-right","20px");const i=e.horz([]);if(t.appTitle){i.classList.add("u2-app-header-with-name");const e=o.divV([o.divText(t.appTitle,"u2-app-header-app-name-div")],"u2-app-header-app-name-and-slogan-div");t.appSubTitle&&e.append(o.divText(t.appSubTitle));const r=o.div(n);i.append(o.divH([r,e]))}else i.append(n);const r=e.vert([o.markdown(t.description),t.learnMoreUrl?o.link("Learn more",t.learnMoreUrl,void 0,{style:{marginLeft:"15px"}}):null]);return r.classList.add("u2-app-header-description"),i.append(r),t.bottomLine&&i.classList.add("u2-app-header-bottom-line"),i},function(t){t.runAsync=function(t,e){return n=this,r=void 0,a=function*(){o.setUpdateIndicator(t,!0);try{return yield e()}catch(t){i.log.error(t)}finally{o.setUpdateIndicator(t,!1)}},new((s=void 0)||(s=Promise))((function(t,e){function i(t){try{l(a.next(t))}catch(t){e(t)}}function o(t){try{l(a.throw(t))}catch(t){e(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof s?n:new s((function(t){t(n)}))).then(i,o)}l((a=a.apply(n,r||[])).next())}));var n,r,s,a}}(n=t.tools||(t.tools={}))}(P||(P={}));var R=n(144),k=n.n(R);const V=rxjs.operators;class D extends r.JsViewer{get scViewer(){return this._scViewer||(this._scViewer=this.createSCViewer()),this._scViewer}constructor(){super(),this._titleHost=o.divText(u.q.CLUSTER_MAX_ACTIVITY,{id:"pep-viewer-title",style:{marginRight:"auto"}}),this._selsectIcon=o.div(),this.activityTarget=m.wf.HIGH,this.viewerError="",this.renderTimeout=null,this.renderDebounceTime=500,this.scFilterQuery=`\${${D.maxActivityInClusterColName}} == 1`,this.selectionSubscription=null,this.linesDrawSubscription=null,this.clusterColumnName=this.column("cluster",{nullable:!1}),this.activityColumnName=this.column("activity",{nullable:!1}),this.colorColumnName=this.column("color",{nullable:!0,defaultValue:null}),this.activityTarget=this.string("activityTarget",m.wf.HIGH,{choices:[m.wf.HIGH,m.wf.LOW]}),this.clusterSizeThreshold=this.int("clusterSizeThreshold",20),this.activityThreshold=this.float("activityThreshold",1e3,{step:.1}),this.connectivityColumnName=this.column("connectivity",{nullable:!0})}get model(){return u.i.getInstance(this.dataFrame)}createSCViewer(){var t;const e={showXAxis:!0,showYAxis:!0,showXSelector:!1,showYSelector:!1,showColorSelector:!1,xAxisType:r.AxisType.logarithmic,yAxisType:r.AxisType.logarithmic,invertYAxis:this.activityTarget===m.wf.LOW,xColumnName:D.clusterSizeColName,markerType:"circle",markerDefaultSize:10,showSizeSelector:!1};if(null==this.clusterColumnName||null==this.activityColumnName||!this.dataFrame.columns.contains(this.clusterColumnName)||!this.dataFrame.columns.contains(this.activityColumnName))return this.viewerError="Please set valid cluster and activity columns",null;const n=this.dataFrame.columns.byName(this.activityColumnName),i=this.dataFrame.columns.byName(this.clusterColumnName),s=null!=this.connectivityColumnName?this.dataFrame.columns.byName(this.connectivityColumnName):null;if(![r.COLUMN_TYPE.FLOAT,r.COLUMN_TYPE.INT,r.COLUMN_TYPE.BIG_INT,r.COLUMN_TYPE.QNUM].includes(n.type))return this.viewerError="Activity column should be numeric",null;const a=this.dataFrame.columns.getOrCreate(D.clusterSizeColName,r.TYPE.INT),l={};for(let e=0;e<this.dataFrame.rowCount;e++){const n=i.get(e);null!=n&&"-1"!=n&&(l[n]=(null!==(t=l[n])&&void 0!==t?t:0)+1)}a.init((t=>{var e;return i.isNone(t)?null:null!==(e=l[i.get(t)])&&void 0!==e?e:null})),n.stats.min<=0&&(e.yAxisType=r.AxisType.linear);const u={},c={};for(let t=0;t<this.dataFrame.rowCount;t++){const e=i.get(t);if(null==e||i.isNone(t)||n.isNone(t))continue;const o=n.get(t),r=u[e];if((null==r||null==r||o>n.get(r)&&this.activityTarget===m.wf.HIGH||o<n.get(r)&&this.activityTarget===m.wf.LOW)&&(u[e]=t),s){const n=s.get(t),i=c[e];(null==i||null==i||n>s.get(i))&&(c[e]=t)}}const d=this.dataFrame.columns.getOrCreate(D.maxActivityInClusterColName,r.COLUMN_TYPE.INT);d.init((t=>i.isNone(t)?0:t===u[i.get(t)]?1:0)),this.dataFrame.columns.getOrCreate(D.maxConnectivityInClusterColName,r.COLUMN_TYPE.INT).init((t=>i.isNone(t)?0:t===c[i.get(t)]?1:0)),this.dataFrame.columns.getOrCreate(D.synSelectionColName,r.TYPE.STRING).init((t=>{if(i.isNone(t))return null;let e=null;return t===u[i.get(t)]&&(e=D.maxActivityLabel),s&&t===c[i.get(t)]&&(e=e?`${e}, ${D.maxConnectivityLabel}`:D.maxConnectivityLabel),e})),e.xColumnName=D.clusterSizeColName,e.yColumnName=this.activityColumnName,e.filter=this.scFilterQuery,this.viewerError="";const f=r.Viewer.scatterPlot(this.dataFrame,e);this.selectionSubscription&&this.selectionSubscription.unsubscribe(),this.selectionSubscription=f.onDataEvent.pipe((0,V.filter)((t=>"d4-select"==t.type))).subscribe((t=>{var e,n;const o=null!==(n=null===(e=t.bitset)||void 0===e?void 0:e.getSelectedIndexes())&&void 0!==n?n:[],s=this.dataFrame.selection,a=r.BitSet.create(this.dataFrame.rowCount,(t=>1==d.get(t)));a.and(s);for(let t=0;t<o.length;t++){const e=o[t],n=i.get(e);i.isNone(e)||(a.set(e,!0),null!=c[n]&&a.set(c[n],!0))}a.fireChanged();const l=a.getSelectedIndexes();for(const t of l){const e=i.get(t);null!=e&&null!=c[e]&&a.set(c[e],!0)}setTimeout((()=>{this.dataFrame.selection.copyFrom(a,!0),setTimeout((()=>{this.model&&this.model.createAccordion()}),200)}),200)}));const h=()=>{const t=r.BitSet.create(this.dataFrame.rowCount);Object.entries(u).forEach((([e,i])=>{var o;if(null==e||null==i)return;const r=parseInt(e),s=n.get(i),a=null!==(o=l[r])&&void 0!==o?o:l[e];s<this.activityThreshold&&a<this.clusterSizeThreshold||(t.set(i,!0,!1),null!=c[r]&&t.set(c[r],!0,!1))})),t.fireChanged(),this.dataFrame.selection.copyFrom(t,!0)};return this._selsectIcon=o.iconSvg("select-all",(()=>{h()}),"Select 3 Active quadrants"),this._selsectIcon.style.cursor="pointer",this._selsectIcon.style.marginRight="5px",h(),this.linesDrawSubscription&&this.linesDrawSubscription.unsubscribe(),this.linesDrawSubscription=f.onBeforeDrawScene.subscribe((()=>{const t=f.getInfo().canvas.getContext("2d"),e=f.viewport,n=f.worldToScreen(e.x,this.activityThreshold),i=f.worldToScreen(this.clusterSizeThreshold,e.y),o=f.worldToScreen(e.x+e.width,this.activityThreshold),r=f.worldToScreen(this.clusterSizeThreshold,e.y+e.height);t.beginPath(),t.strokeStyle="rgb(0,0,0)",t.lineWidth=1,t.moveTo(n.x,n.y),t.lineTo(o.x,o.y),t.moveTo(i.x,i.y),t.lineTo(r.x,r.y),t.stroke(),t.closePath()})),f}onTableAttached(){var t,e,n,i,o,r,s,a,l,u,c,d;super.onTableAttached();const f=null!==(e=null===(t=this.dataFrame)||void 0===t?void 0:t.col(m.$2.ACTIVITY))&&void 0!==e?e:null===(i=k()(null===(n=this.dataFrame)||void 0===n?void 0:n.columns.numerical).next())||void 0===i?void 0:i.value;null!=f&&(null===(o=this.getProperty(`activity${m.To}`))||void 0===o||o.set(this,f.name));const h=null===(s=k()(null===(r=this.dataFrame)||void 0===r?void 0:r.columns.categorical).next())||void 0===s?void 0:s.value;null!=h&&(null===(a=this.getProperty(`cluster${m.To}`))||void 0===a||a.set(this,h.name));const g=null===(u=k()(null===(l=this.dataFrame)||void 0===l?void 0:l.columns.numerical).next())||void 0===u?void 0:u.value;null!=g&&(null===(c=this.getProperty(`connectivity${m.To}`))||void 0===c||c.set(this,g.name)),this.render(),null===(d=this.dataFrame)||void 0===d||d.onDataChanged.subscribe((()=>{this.render()}))}render(){this.renderTimeout&&clearTimeout(this.renderTimeout),this.renderTimeout=setTimeout((()=>{var t,e;if(!this.dataFrame)return;l()(this.root).empty();const n=this.scViewer;if(null==n)return void this.root.appendChild(o.divText(null!==(t=this.viewerError)&&void 0!==t?t:"Error creating scatter plot"));const i=o.div("Cluster Size",{style:{alignSelf:"center",color:"var(--grey-6)",marginBottom:"5px"}}),r=o.div(this.activityTarget===m.wf.HIGH?"Maximum Activity":"Minimum Activity",{style:{color:"var(--grey-6)",alignSelf:"center",textOrientation:"mixed",writingMode:"tb",transform:"rotate(180deg)",marginLeft:"5px"}});n.props.colorColumnName=null!==(e=this.colorColumnName)&&void 0!==e?e:null,this.root.appendChild(o.divH([r,o.divV([o.divH([this._titleHost,this._selsectIcon],{style:{alignSelf:"center",lineHeight:"normal",width:"100%"}}),n.root,i],{style:{flexGrow:"1"}})])),n.root.style.width="100%",setTimeout((()=>{n.props.filter=this.scFilterQuery,n.invalidateCanvas()}),100)}),this.renderDebounceTime)}onPropertyChanged(t){super.onPropertyChanged(t),(null==t?void 0:t.name)!==`color${m.To}`&&(this._scViewer=null),this.render()}}D.clusterSizeColName="~cluster.size",D.maxActivityInClusterColName="~max.activity.for.cluster",D.maxConnectivityInClusterColName="~max.connectivity.for.cluster",D.synSelectionColName="Syn Selection",D.maxActivityLabel="Max Activity",D.maxConnectivityLabel="Max Connectivity";var F=n(3163);class G extends r.JsViewer{constructor(){super(),this.leftMotifLength=0,this.rightMotifLength=0,this.showPositionInfo=!0,this.position=this.int("position",1,{nullable:!1,showSlider:!1,min:1}),this.sequenceColumnName=this.column("sequence",{semType:r.SEMTYPE.MACROMOLECULE,nullable:!1}),this.valueColumnName=this.column("value",{columnTypeFilter:"numerical",nullable:!1}),this.leftMotifLength=this.int("leftMotifLength",0,{nullable:!1,min:0,max:10}),this.rightMotifLength=this.int("rightMotifLength",0,{nullable:!1,min:0,max:10}),this.showPositionInfo=this.bool("showPositionInfo",!0,{nullable:!1,defaultValue:!0,description:"Show position and overhangs info in the viewer header"}),i.events.onContextMenu.subscribe((t=>{var e;t.causedBy&&t.causedBy.target&&(null===(e=this._boxPlotViewer)||void 0===e?void 0:e.root.contains(t.causedBy.target))&&(t.causedBy.preventDefault(),t.causedBy.stopPropagation(),t.causedBy.stopImmediatePropagation())}))}getPositionFromColumn(){var t;const e=this.dataFrame.col(this.sequenceColumnName);if(null==e)return 1;const n=null!==(t=e.getTag(p.gp.selectedPosition))&&void 0!==t?t:"1",i=parseInt(n);return Number.isNaN(i)?1:Math.max(1,i)}onTableAttached(){if(super.onTableAttached(),null==this.dataFrame.columns.bySemType(r.SEMTYPE.MACROMOLECULE))throw i.shell.error("No sequence column found"),new Error("No sequence column found");const t=this.dataFrame.columns.getUnusedName("~sequence_position_monomers");this._positionColumn=this.dataFrame.columns.addNewString(t),this._positionColumn.semType="Monomer",this._positionColumn.setTag("cell.renderer","Monomer"),this.getProperty("sequenceColumnName").set(this,this.dataFrame.columns.bySemType(r.SEMTYPE.MACROMOLECULE).name),this.getProperty("valueColumnName").set(this,k()(this.dataFrame.columns.numerical).next().value.name),this.getProperty("position").set(this,this.getPositionFromColumn()),this.subs.push(r.debounce(this.dataFrame.onMetadataChanged,200).subscribe((t=>{const e=this.getPositionFromColumn();this.position!==e&&this.getProperty("position").set(this,e)})))}render(){var t,e,n,i;const s=(null!==(t=this.position)&&void 0!==t?t:-1)-1;if(null==this.dataFrame||!this.sequenceColumnName||s<0||!this._positionColumn||!this.valueColumnName)return;l()(this.root).empty(),null===(e=this._boxPlotViewer)||void 0===e||e.detach();const a=c.Z.getSeqHelper(),u=this.dataFrame.col(this.sequenceColumnName),d=a.getSeqHandler(u),f=Math.min(Math.max(null!==(n=this.leftMotifLength)&&void 0!==n?n:0,0),10),h=Math.min(Math.max(null!==(i=this.rightMotifLength)&&void 0!==i?i:0,0),10),m=Math.max(0,s-f),g=h+s,v=Array.from({length:g-m+1}).fill("").map(((t,e)=>d.getMonomersAtPosition(m+e,!0)));this._positionColumn.init((t=>v.map((e=>e[t])).join(p.ot))),this._boxPlotViewer=this.dataFrame.plot.box({categoryColumnNames:[this._positionColumn.name],plotStyle:"violin",valueColumnName:this.valueColumnName,colorColumnName:this._positionColumn.name,showColorSelector:!1,showSizeSelector:!1,showCategorySelector:!1,legendVisibility:r.VisibilityMode.Never,markerColorColumnName:this._positionColumn.name,title:"Sequence Position Statistics",autoLayout:!1,labelOrientation:"Vert"});const y=o.input.int("Left Overhang",{value:f,min:0,max:10,step:1,showSlider:!1,showPlusMinus:!0,onValueChanged:t=>{this.getProperty("leftMotifLength").set(this,y.value)},tooltipText:"Left overhang motif length from the selected position"}),C=o.input.int("Right Overhang",{value:h,min:0,max:10,step:1,showSlider:!1,showPlusMinus:!0,onValueChanged:t=>{this.getProperty("rightMotifLength").set(this,C.value)},tooltipText:"Right overhang motif length from the selected position"}),w=o.divH([y.root,o.h2(`${this.sequenceColumnName}: Position ${this.position}`),C.root],{style:{alignItems:"center",justifyContent:"space-around",width:"100%"}});this.showPositionInfo&&(this.root.appendChild(w),y.input.style.width="20px",C.input.style.width="20px"),this._boxPlotViewer.props.statistics=["min","max","avg","med","count"],this._boxPlotViewer.root.style.width="100%",this._boxPlotViewer.root.style.height="100%",this.root.appendChild(this._boxPlotViewer.root),this._boxPlotViewer.sub(this._boxPlotViewer.onPropertyValueChanged.subscribe((t=>{var e,n,i,o;if((null===(n=null===(e=this._boxPlotViewer)||void 0===e?void 0:e.props)||void 0===n?void 0:n.valueColumnName)&&(null===(o=null===(i=this._boxPlotViewer)||void 0===i?void 0:i.props)||void 0===o?void 0:o.valueColumnName)!==this.valueColumnName){const t=this._boxPlotViewer.props.valueColumnName;setTimeout((()=>this.getProperty("valueColumnName").set(this,t)),10)}})))}onPropertyChanged(t){null!=this.dataFrame&&this.sequenceColumnName&&this.render()}}var U=function(t,e,n,i){var o,r=arguments.length,s=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(r<3?o(s):r>3?o(e,n,s):o(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},H=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},q=function(t,e){return function(n,i){e(n,i,t)}},B=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};let Y,$=null;const j=new r.Package;function W(){return Y}function z(t){return B(this,void 0,void 0,(function*(){const e=r.TaskBarProgressIndicator.create("Loading Peptides"),n=j.webRoot+"files/"+t,o=yield i.data.loadTable(n);o.name="Peptides",i.shell.addTableView(o).name="PeptidesView",i.shell.windows.showProperties=!0,e.close()}))}i.decorators||(i.decorators={}),["func","init","param","panel","editor","demo","app","appTreeBrowser","fileHandler","fileExporter","model","viewer","filter","cellRenderer","autostart","dashboard","folderViewer","semTypeDetector","packageSettingsEditor","functionAnalysis","converter","fileViewer","model","treeBrowser","polyfill"].forEach((t=>{i.decorators[t]||(i.decorators[t]=function(t){return function(t,e,n){}})}));class K{static initPeptides(){return B(this,void 0,void 0,(function*(){try{null!=$||($=new h(yield i.functions.call("Bio:getBioLib"))),null!=Y||(Y=yield async function(){const t="Dendrogram",e=r.Func.find({package:t,name:"getTreeHelper"});if(0===e.length)throw new Error(`Package "${t}" must be installed for TreeHelper.`);return(await e[0].prepare().call()).getOutputParamValue()}()),yield c.Z.loadComponents()}catch(t){i.log.error(t)}}))}static Peptides(){const t=P.appHeader({iconPath:j.getIconUrl(),learnMoreUrl:"https://github.com/datagrok-ai/public/blob/master/help/domains/bio/peptides.md",description:"- Automatically recognizes peptides in your data\n- Invariant map and mutation cliffs\n- Logo plots to explore sequence composition\n- Hierarchical clustering\n- Sequence space to analyze clustering and activity cliffs\n- Finds statistically significant changes in activity for monomer/positions\n"}),e=i.shell.windows;e.showToolbox=!1,e.showHelp=!1,e.showProperties=!1;const n=r.View.create();return n.name="Peptides",o.appendAll(n.root,[t,o.divH([o.button("Simple demo",(()=>z("aligned.csv")),""),o.button("Complex demo",(()=>z("aligned_2.csv")),""),o.button("HELM demo",(()=>z("aligned_3.csv")),"")])]),n}static peptidesDialog(){var t;if(!i.shell.t||!(null===(t=i.shell.t.columns.bySemType("Macromolecule"))||void 0===t?void 0:t.length))return i.shell.warning("SAR Analysis requires an active table with Macromolecule column"),null;if(!r.Utils.firstOrNull(i.shell.t.columns.numerical))return i.shell.warning("SAR Analysis requires an active table with at least one numerical column for activity"),null;const e=(0,s.v)(i.shell.t),n=o.dialog("Analyze Peptides").add(e.host).onOK((()=>B(this,void 0,void 0,(function*(){e.callback()||n.show()}))));return n.show()}static testInitFunctionPeptides(t){return B(this,void 0,void 0,(function*(){i.shell.info("Test init function for Peptides package"),i.shell.info("Viewer name: "+t.dataFrame.name),yield new Promise((t=>setTimeout(t,1e3)))}))}static peptidesPanel(t){if(!t.dataFrame||!r.Utils.firstOrNull(t.dataFrame.columns.numerical))return new r.Widget(o.divText("SAR Analysis requires an active table with at least one numerical column for activity"));const e=(0,s.v)(t.dataFrame,t);return new r.Widget(e.host)}static monomerPosition(){return new d.J}static mostPotentResidues(){return new d.UJ}static logoSummaryTable(){return new f.s}static sequencePositionStatistics(){return new G}static clusterMaxActivity(){return new D}static manualAlignment(t){const e=i.shell.t,n=null==e?void 0:e.temp[u.i.modelName];return n?function(t,e){const n=o.input.textArea("",{value:t.get(e.currentRowIdx)});l()(n.root).addClass("pep-textinput");const s=o.button("Apply",(()=>{return o=this,r=void 0,a=function*(){const o=c.Z.getSeqHelper().getSeqHandler(t),r=n.value,s=o.splitter(r),a=e.currentRowIdx;t.set(a,r);for(let t=0;t<s.length;t++){const n=s.getCanonical(t);null!==e.col(t.toString())&&e.set(t.toString(),a,n)}const l=i.shell.o;i.shell.o=null,u.i.getInstance(e).updateGrid(),setTimeout((()=>{i.shell.o=l}),100)},new((s=void 0)||(s=Promise))((function(t,e){function n(t){try{l(a.next(t))}catch(t){e(t)}}function i(t){try{l(a.throw(t))}catch(t){e(t)}}function l(e){var o;e.done?t(e.value):(o=e.value,o instanceof s?o:new s((function(t){t(o)}))).then(n,i)}l((a=a.apply(o,r||[])).next())}));var o,r,s,a}),"Apply changes"),a=o.button(o.iconFA("redo"),(()=>n.value=t.get(e.currentRowIdx)),"Reset");return l()(a).addClass("pep-snippet-editor-icon pep-reset-icon"),new r.Widget(o.divV([a,n.root,s],"pep-textarea-box"))}(e.getCol(n.settings.sequenceColumnName),e):new r.Widget(o.divText("Manual alignment works with peptides analysis"))}static macromoleculeSarFastaDemo(){return B(this,void 0,void 0,(function*(){return yield function(){return t=this,e=void 0,o=function*(){i.shell.windows.showContextPanel=!0;const t=r.DataFrame.fromCsv(yield j.files.readAsText("aligned.csv"));t.name="Simple peptides",t.id||(t.id=`Simple-peptides-analysis-table-id-${Math.random()}-${Date.now()}`);const e=i.shell.addTableView(t);yield(0,v.cb)(50);const n=e.grid;yield new Promise((t=>{var e;let i=null;const o=null===(e=null==n?void 0:n.onAfterDrawContent)||void 0===e?void 0:e.subscribe((()=>{i&&clearTimeout(i),o.unsubscribe(),t(void 0)}));i=setTimeout((()=>{o.unsubscribe(),t(void 0)}),3e3)}));const o=t.getCol("IC50"),a=t.getCol("AlignedSequence");a.semType=r.SEMTYPE.MACROMOLECULE,a.setTag(m.gp.ALPHABET,p.YI.PT),a.meta.units=p.Hi.FASTA,a.setTag(p.gp.aligned,"SEQ.MSA");const l=(0,g.Y1)(o,m.rg.MINUS_LG),u=new y.av;u.threshold=94,yield(0,s.n)(o,a,null,t,l,m.rg.MINUS_LG,{addMCL:!0,useEmbeddingsClusters:!0,mclSettings:u})},new((n=void 0)||(n=Promise))((function(i,r){function s(t){try{l(o.next(t))}catch(t){r(t)}}function a(t){try{l(o.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((o=o.apply(t,e||[])).next())}));var t,e,n,o}()}))}static lstPiechartCellRenderer(){return new F.DX}}U([i.decorators.init(),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",Promise)],K,"initPeptides",null),U([i.decorators.func(),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",r.View)],K,"Peptides",null),U([i.decorators.func({"top-menu":"Bio | Analyze | SAR...",name:"Bio Peptides",outputs:[]}),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",Object)],K,"peptidesDialog",null),U([i.decorators.func(),q(0,i.decorators.param({type:"viewer"})),H("design:type",Function),H("design:paramtypes",[r.Viewer]),H("design:returntype",Promise)],K,"testInitFunctionPeptides",null),U([i.decorators.panel({tags:["widgets"],name:"Peptides"}),q(0,i.decorators.param({options:{semType:"Macromolecule"}})),H("design:type",Function),H("design:paramtypes",[r.Column]),H("design:returntype",r.Widget)],K,"peptidesPanel",null),U([i.decorators.func({meta:{icon:"files/icons/peptide-sar-viewer.svg"},tags:["viewer"],name:"Sequence Variability Map",description:"Peptides Sequence Variability Map Viewer",outputs:[{type:"viewer",name:"result"}]}),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",r.Viewer)],K,"monomerPosition",null),U([i.decorators.func({meta:{icon:"files/icons/peptide-sar-vertical-viewer.svg"},tags:["viewer"],name:"Most Potent Residues",description:"Peptides Most Potent Residues Viewer",outputs:[{type:"viewer",name:"result"}]}),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",r.Viewer)],K,"mostPotentResidues",null),U([i.decorators.func({meta:{icon:"files/icons/logo-summary-viewer.svg"},tags:["viewer"],name:"Logo Summary Table",outputs:[{type:"viewer",name:"result"}]}),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",r.Viewer)],K,"logoSummaryTable",null),U([i.decorators.func({meta:{icon:"files/icons/sequence-statistics-viewer.svg"},tags:["viewer"],name:"Sequence Position Statistics",outputs:[{type:"viewer",name:"result"}]}),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",r.Viewer)],K,"sequencePositionStatistics",null),U([i.decorators.func({tags:["viewer"],name:"Active peptide selection",outputs:[{type:"viewer",name:"result"}]}),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",r.Viewer)],K,"clusterMaxActivity",null),U([i.decorators.panel({tags:["widgets"],name:"Manual Alignment"}),q(0,i.decorators.param({options:{semType:"Monomer"}})),H("design:type",Function),H("design:paramtypes",[String]),H("design:returntype",r.Widget)],K,"manualAlignment",null),U([i.decorators.func({meta:{demoPath:"Bioinformatics | Peptide SAR",isDemoDashboard:"true"},name:"Peptide SAR",description:"Peptide SAR Analysis demo on peptide sequences in FASTA format"}),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",Promise)],K,"macromoleculeSarFastaDemo",null),U([i.decorators.func({meta:{cellType:"lst-pie-chart",gridChart:"true"},tags:["cellRenderer"],name:"LST Pie Chart",outputs:[{type:"grid_cell_renderer",name:"result"}]}),H("design:type",Function),H("design:paramtypes",[]),H("design:returntype",r.GridCellRenderer)],K,"lstPiechartCellRenderer",null)},726:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var i=n(4971),o=n(6082),r=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};class s{static getMonomerLib(){if(!this._monomerLibHelper)throw new Error("MonomerLib is not initialized");return this._monomerLibHelper.getMonomerLib()}static getSeqHelper(){if(!this._secHelper)throw new Error("SeqHelper is not initialized");return this._secHelper}static loadSeqHelper(){return r(this,void 0,void 0,(function*(){var t;null!==(t=this._secHelper)&&void 0!==t||(this._secHelper=yield async function(){const t=o.Func.find({package:"Bio",name:"getSeqHelper"});if(0===t.length)throw new Error("Package 'Bio' must be installed for SeqHelper.");return(await t[0].prepare().call()).getOutputParamValue()}())}))}static loadComponents(){return r(this,void 0,void 0,(function*(){yield this.loadSeqHelper(),yield this.loadMonomerLib()}))}static loadMonomerLib(){return r(this,void 0,void 0,(function*(){var t;null!==(t=this._monomerLibHelper)&&void 0!==t||(this._monomerLibHelper=yield(0,i.pj)()),yield this._monomerLibHelper.awaitLoaded()}))}}},3657:(t,e,n)=>{"use strict";n.d(e,{Lw:()=>d,eW:()=>m,Ej:()=>f,uz:()=>c});var i=n(6082),o=n(4139);class r{constructor(){const t=navigator.hardwareConcurrency;this._workerCount=Math.max(t-2,1),this._workers=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(216),n.b))))}calc(t,e){return n=this,i=arguments,r=function*(t,e,n={}){var i,o,r;const s=new Map;try{const a=null!==(o=null===(i=n.targetCol)||void 0===i?void 0:i.cat.indexOf(n.currentTarget))&&void 0!==o?o:-1,l=t.length,u=new Array(this._workerCount),c=l*(l-1)/2;this._workerCount=Math.min(this._workerCount,c);const d=c/this._workerCount;e.forEach((t=>{var e;t.cat=null===(e=t.cat)||void 0===e?void 0:e.slice()})),(null===(r=n.targetCol)||void 0===r?void 0:r.cat)&&(n.targetCol.cat=n.targetCol.cat.slice());for(let i=0;i<this._workerCount;i++)u[i]=new Promise(((o,r)=>{const s=Math.floor(i*d),l=i===this._workerCount-1?c:Math.floor((i+1)*d);this._workers[i].postMessage({startIdx:s,endIdx:l,activityArray:t,monomerInfoArray:e,settings:n,currentTargetIdx:a}),this._workers[i].onmessage=({data:{pos:t,seq1Idxs:e,seq2Idxs:n,error:s}})=>{var a;s?(null===(a=this._workers[i])||void 0===a||a.terminate(),r(s)):(this._workers[i].terminate(),o({pos:t,seq1Idxs:e,seq2Idxs:n}))}}));const f=yield Promise.all(u),h=new Map;e.forEach(((t,e)=>{h.set(t.name,e)})),f.filter(Boolean).forEach((t=>{for(let n=0;n<t.pos.length;n++){const i=h.get(t.pos[n]),o=e[i].rawData[t.seq1Idxs[n]],r=e[i].cat[o],a=e[i].rawData[t.seq2Idxs[n]],l=e[i].cat[a];s.has(r)||s.set(r,new Map),s.has(l)||s.set(l,new Map);const u=s.get(r),c=s.get(l);u.has(t.pos[n])||u.set(t.pos[n],new Map),c.has(t.pos[n])||c.set(t.pos[n],new Map);const d=u.get(t.pos[n]),f=c.get(t.pos[n]);d.has(t.seq1Idxs[n])||d.set(t.seq1Idxs[n],[]),f.has(t.seq2Idxs[n])||f.set(t.seq2Idxs[n],[]);const m=d.get(t.seq1Idxs[n]),g=f.get(t.seq2Idxs[n]);m.push(t.seq2Idxs[n]),g.push(t.seq1Idxs[n])}}))}catch(t){this.terminate(),console.error(t)}return s},new((o=void 0)||(o=Promise))((function(t,e){function s(t){try{l(r.next(t))}catch(t){e(t)}}function a(t){try{l(r.throw(t))}catch(t){e(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(s,a)}l((r=r.apply(n,i||[])).next())}));var n,i,o,r}terminate(){var t;null===(t=this._workers)||void 0===t||t.forEach((t=>{try{null==t||t.terminate()}catch(t){console.error(t)}}))}}var s=n(5480),a=n(8774),l=n(5070),u=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function c(t,e){return u(this,arguments,void 0,(function*(t,e,n={}){var i,s;if(0===e.length)throw new Error(`PepAlgorithmError: Couldn't find any column of semType '${o.uF.MONOMER}'`);null!==(i=n.minActivityDelta)&&void 0!==i||(n.minActivityDelta=0),null!==(s=n.maxMutations)&&void 0!==s||(n.maxMutations=1);const a=new r,l=yield a.calc(t,e,n);return a.terminate(),l}))}function d(t,e){const n=new Map;let i=999999,o=-999999,r=2,s=2;for(const u of t.keys()){const c=new Map;n.set(u,c);const d=t.get(u);for(const t of d.keys()){const n=d.get(t),u=new a.A(e.length,!1);if(0===n.size)continue;for(const t of n.keys())u.setFast(t,!0),n.get(t).forEach((t=>u.setFast(t,!0)));const f=(0,l.GT)(e,u);i=Math.min(i,f.meanDifference),o=Math.max(o,f.meanDifference),r=Math.min(r,f.count),s=Math.max(s,f.count),c.set(t,f)}}return{stats:n,minDiff:i,maxDiff:o,minCount:r,maxCount:s}}function f(t,e,n,o={}){var r,s,u,c,d,f;null!==(r=o.isFiltered)&&void 0!==r||(o.isFiltered=!1);const m={general:{}};let g=t.getRawData(),p=t.length;if(null!==(s=o.columns)&&void 0!==s||(o.columns=n.map((t=>t.name))),o.isFiltered){p=e.trueCount;const t=new Float64Array(p),r=e.getSelectedIndexes();for(let e=0;e<p;++e)t[e]=g[r[e]];g=t,n=i.DataFrame.fromColumns(n).clone(e,o.columns).columns.toList(),o.target&&(o.target.col=o.target.col.clone(e)),o.aggValue&&(o.aggValue.col=o.aggValue.col.clone(e))}const v=null===(c=null===(u=o.target)||void 0===u?void 0:u.col)||void 0===c?void 0:c.getRawData(),y=null===(d=o.target)||void 0===d?void 0:d.col.categories,C=(null===(f=o.target)||void 0===f?void 0:f.cat)?null==y?void 0:y.indexOf(o.target.cat):-1;for(const t of n){if(!o.columns.includes(t.name))continue;const e=t.getRawData(),n=t.categories,i={general:{}};for(let t=0;t<n.length;++t){const r=n[t];if(""===r)continue;const s=new Array(p).fill(!1);for(let n=0;n<p;++n)e[n]!==t||v&&-1!==C&&v[n]!==C||(s[n]=!0);const u=a.A.fromValues(s);if(u.allFalse)continue;const c=(0,l.GT)(g,u,o.aggValue);i[r]=c,h(i.general,c)}m[t.name]=i,h(m.general,null,i.general)}return m}function h(t,e=null,n=null){var i,o,r,s,a,l,u,c,d,f,h,m,g,p,v,y,C;if(null===e&&null===n)throw new Error("MonomerPositionStatsError: either stats or summaryStats must be present");const w=null!==(i=null==e?void 0:e.count)&&void 0!==i?i:n.maxCount;null!==(o=t.maxCount)&&void 0!==o||(t.maxCount=w),t.maxCount<w&&(t.maxCount=w);const A=null!==(r=null==e?void 0:e.count)&&void 0!==r?r:n.minCount;null!==(s=t.minCount)&&void 0!==s||(t.minCount=A),t.minCount>A&&(t.minCount=A);const b=null!==(a=null==e?void 0:e.meanDifference)&&void 0!==a?a:n.maxMeanDifference;null!==(l=t.maxMeanDifference)&&void 0!==l||(t.maxMeanDifference=b),t.maxMeanDifference<b&&(t.maxMeanDifference=b);const S=null!==(u=null==e?void 0:e.meanDifference)&&void 0!==u?u:n.minMeanDifference;if(null!==(c=t.minMeanDifference)&&void 0!==c||(t.minMeanDifference=S),t.minMeanDifference>S&&(t.minMeanDifference=S),!isNaN(null!==(d=null==e?void 0:e.pValue)&&void 0!==d?d:NaN)){const i=null!==(f=null==e?void 0:e.pValue)&&void 0!==f?f:n.maxPValue;null!==(h=t.maxPValue)&&void 0!==h||(t.maxPValue=i),t.maxPValue<i&&(t.maxPValue=i);const o=null!==(m=null==e?void 0:e.pValue)&&void 0!==m?m:n.minPValue;null!==(g=t.minPValue)&&void 0!==g||(t.minPValue=o),t.minPValue>o&&(t.minPValue=o)}const E=null!==(p=null==e?void 0:e.ratio)&&void 0!==p?p:n.maxRatio;null!==(v=t.maxRatio)&&void 0!==v||(t.maxRatio=E),t.maxRatio<E&&(t.maxRatio=E);const T=null!==(y=null==e?void 0:e.ratio)&&void 0!==y?y:n.minRatio;null!==(C=t.minRatio)&&void 0!==C||(t.minRatio=T),t.minRatio>T&&(t.minRatio=T)}function m(t,e,n,i){const o=t.rowCount,r=t.getCol(e),u=r.getRawData(),c=r.categories,d=Array.from({length:c.length},(()=>new a.A(o,!1)));for(let t=0;t<o;++t)d[u[t]].setTrue(t);const f=n.map((t=>a.A.fromUint32Array(o,t.getRawData()))),h=n.map((t=>t.name)),m=i.getRawData(),g={},p={};for(const t of Object.values(s.W)){const e=t===s.W.ORIGINAL?d:f,n=t===s.W.ORIGINAL?c:h,o=t===s.W.ORIGINAL?g:p;for(let t=0;t<e.length;++t){const r=e[t];o[n[t]]=r.allTrue||r.allFalse?{count:r.length,meanDifference:0,ratio:1,pValue:null,mask:r,mean:i.stats.avg}:(0,l.GT)(m,r)}}const v={};return v[s.W.ORIGINAL]=g,v[s.W.CUSTOM]=p,v}},3163:(t,e,n)=>{"use strict";n.d(e,{DX:()=>S,X5:()=>v,rW:()=>w,k8:()=>A,Yd:()=>C,rI:()=>y,FZ:()=>b});var i=n(7389),o=n(6082),r=n(4139),s=n(2003),a=n(3657);const l=rxjs;var u=n(912),c=n(5480),d=n(3541);n(7194);var f,h,m;!function(t){t.maxMonomerLength=".mm.cellRenderer.maxMonomerLength"}(f||(f={})),function(t){t.applyToBackground=".m.cellRenderer.applyToBackground"}(h||(h={})),function(t){t.MSA="MSA",t.classic="classic"}(m||(m={})),new class{constructor(){this.color="rgb(100,100,100)",this.pivot=0,this.left=!1,this.transparencyRate=0,this.separator="",this.last=!1,this.drawStyle=m.classic,this.maxWord=[],this.wordIdx=0,this.gridCell=null,this.referenceSequence=null,this.maxLengthOfMonomer=null,this.monomerTextSizeMap={},this.logger=void 0,this.selectedPosition=void 0,this.isMultiLineContext=!1,this.lineNumber=0}};var g=n(726),p=n(3981);function v(t,e){t.strokeStyle=o.Color.toHtml(o.Color.selectedRows),t.lineWidth=3,t.strokeRect(e.x+1,e.y+1,e.width-1,e.height-1)}function y(t,e,n){t.semType=r.uF.MONOMER,t.setTag(o.TAGS.CELL_RENDERER,r.uF.MONOMER),t.setTag(r.gp.ALPHABET,e),n&&t.setTag(h.applyToBackground,"true")}function C(t,e,n,i,r){var s,a,l,u,c,f,h,m,g,p,y,C;const w=r.width/2,A=Math.ceil(r.x+1+w),b=Math.ceil(r.y+1+r.height/2),S=Math.min(.9*w/2,.9*r.height/2);if(i instanceof d.UJ){const r=i.monomerPositionStats[n],s=r[e].pValue,a=r[e].meanDifference,l=1-r.general.maxPValue,u=1-r.general.minPValue,c=Math.min(l,u),d=l-c,f=u-c,h=Math.max(d,f),m=null===s?0:1-s-c,g=a>=0?m:-m,p=o.Color.toHtml(null===s?o.Color.lightLightGray:o.Color.scaleColor(g,-h,h,255)),v=Math.max(Math.abs(i.monomerPositionStats.general.minMeanDifference),i.monomerPositionStats.general.maxMeanDifference),y=Math.abs(a)/v,C=Math.floor(S*y);t.beginPath(),t.fillStyle=p,t.arc(A-w/2,b,C<3||null===s?3:C,0,2*Math.PI,!0),t.closePath(),t.fill()}else if(i instanceof d.J&&i.mutationCliffs&&i.cliffStats){const r=i.cliffStats.maxCount,u=i.cliffStats.minDiff,c=i.cliffStats.maxDiff,d=null===(l=null===(a=null===(s=i.cliffStats)||void 0===s?void 0:s.stats)||void 0===a?void 0:a.get(e))||void 0===l?void 0:l.get(n);if(d){const e=d.count,n=d.meanDifference,i=Math.floor(Math.abs(e/Math.max(r,2))*S),s=Math.max(Math.abs(u),Math.abs(c)),a=o.Color.toHtml(null===n?o.Color.lightLightGray:o.Color.scaleColor(n,-s,s,255));t.beginPath(),t.fillStyle=a,t.arc(A-w/2,b,i<3||0==e?3:i,0,2*Math.PI,!0),t.closePath(),t.fill()}}if(t.textBaseline="middle",t.textAlign="end",t.fillStyle="#606060",t.font="13px Roboto, Roboto Local, sans-serif",t.shadowBlur=5,t.shadowColor=o.Color.toHtml(o.Color.white),i instanceof d.J){let o=0;const r=null!==(h=null===(f=null===(c=null===(u=i.mutationCliffs)||void 0===u?void 0:u.get(e))||void 0===c?void 0:c.get(n))||void 0===f?void 0:f.entries())&&void 0!==h?h:null;if(null!==r)for(const[t,e]of r)o+=null!==(m=e.length)&&void 0!==m?m:0;0!==o&&t.fillText(o.toString(),A+w-5,b,w-5)}else if(i instanceof d.UJ){const o=null!==(g=i.monomerPositionStats)&&void 0!==g?g:null===(p=null==i?void 0:i.model)||void 0===p?void 0:p.monomerPositionStats,r=null===(C=null===(y=null==o?void 0:o[n])||void 0===y?void 0:y[e])||void 0===C?void 0:C.count;r&&t.fillText(r.toString(),A+w-5,b,w-5)}if(i instanceof d.J){const o=i.mutationCliffsSelection[n];o&&o.includes(e)&&v(t,r)}else if(i instanceof d.UJ){const o=i.invariantMapSelection[n];o&&o.includes(e)&&v(t,r)}}function w(t,e,n,i,r,s,a){a=o.Color.fromHtml(o.Color.toHtml(function(t,e){return(16777215&t|255<<24)>>>0}(a)));let l=r.toFixed(2);l.endsWith(".00")&&(l=r.toFixed(0)),l.endsWith("0")&&l.includes(".")&&(l=r.toFixed(1));const u=Math.min(13,Math.floor(s.width/40/l.length*6*13));t.fillStyle=o.Color.toHtml(a),t.fillRect(s.x,s.y,s.width,s.height),t.font=`${u}px Roboto, Roboto Local, sans-serif`,t.textAlign="center",t.textBaseline="middle",t.fillStyle=o.Color.toHtml(o.Color.getContrastColor(a)),t.fillText(l,s.x+s.width/2,s.y+s.height/2,s.width);const c=i[n];c&&c.includes(e)&&v(t,s)}function A(t,e,n,i){t.font="13px Roboto, Roboto Local, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillStyle="#000",t.fillText(e.toString(),i.x+i.width/2,i.y+i.height/2,i.width),(n[c.W.CUSTOM].includes(e)||n[c.W.ORIGINAL].includes(e))&&v(t,i)}function b(t,e,n,c,d,f={x:0,y:0,mpStats:{},monomerPosition:{}}){var h;if(null!==(h=d.isSelectionTable)&&void 0!==h||(d.isSelectionTable=!1),0==Object.keys(f.mpStats).length&&(f.mpStats=e),d.isSelectionTable&&(!d.webLogoBounds||!d.cachedWebLogoTooltip))throw new Error("Peptides: Cannot set WebLogo renderer for selection table without `headerSelectedMonomers`, `webLogoBounds` and `cachedWebLogoTooltip` options.");const m=t.dataFrame;t.setOptions({colHeaderHeight:130});t.onCellRender.subscribe((t=>(t=>{var i,l,u,f;if(!(null===(i=t.cell)||void 0===i?void 0:i.isColHeader))return;const h=t.g,v=t.bounds,y=t.cell.tableColumn;h.save();try{if(h.beginPath(),h.clearRect(v.x,v.y,v.width,v.height),h.rect(v.x,v.y,v.width,v.height),h.clip(),(null==y?void 0:y.semType)===r.uF.MONOMER){let i;if(m.filter.anyFalse){null!==(l=(f=m).jsOnlyTemp)&&void 0!==l||(f.jsOnlyTemp={});const t=null!==(u=m.jsOnlyTemp[r.gp.M_P_STATS_CACHE])&&void 0!==u?u:{},e=null==t?void 0:t[y.name];if(t&&e&&e.filterLength===m.filter.length&&e.filterVersion===m.filter.version)i=e.stats[y.name];else{const e=(0,a.Ej)(c,m.filter,n,{isFiltered:!0,columns:[y.name]});i=e[y.name],t[y.name]={filterVersion:m.filter.version,stats:e,filterLength:m.selection.length}}m.jsOnlyTemp[r.gp.M_P_STATS_CACHE]=t}else i=d.isSelectionTable?(0,a.Ej)(c,m.filter,n,{isFiltered:!0,columns:[y.name]})[y.name]:e[y.name];if(!i)return;const C=Object.keys(i).sort(((t,e)=>""===t||"-"===t?1:""===e||"-"===e?-1:0)).filter((t=>"general"!==t));d.webLogoBounds()[y.name]=function(t,e,n,i,r,a,l,u={},c={}){var d,f,h,m,v,y,C,w,A;const b=window.devicePixelRatio;null!==(d=c.symbolStyle)&&void 0!==d||(c.symbolStyle="16px Roboto, Roboto Local, sans-serif"),null!==(f=c.upperLetterHeight)&&void 0!==f||(c.upperLetterHeight=12.2),null!==(h=c.upperLetterAscent)&&void 0!==h||(c.upperLetterAscent=.25),null!==(m=c.marginVertical)&&void 0!==m||(c.marginVertical=1),null!==(v=c.marginHorizontal)&&void 0!==v||(c.marginHorizontal=1),null!==(y=c.selectionWidth)&&void 0!==y||(c.selectionWidth=2),null!==(C=c.textHeight)&&void 0!==C||(c.textHeight=13),null!==(w=c.headerStyle)&&void 0!==w||(c.headerStyle=`bold ${c.textHeight*b}px Roboto, Roboto Local, sans-serif`);const S=(r.length-1)*c.upperLetterAscent;let E=(e.y+c.marginVertical)*b;const T=(e.height-2*c.marginVertical-S-1.25*c.textHeight)*b,x=(e.x+c.marginHorizontal)*b,N=Math.max(c.selectionWidth*b,.05*e.width*b),_=2*c.marginHorizontal+c.selectionWidth,M=(e.width-(_+c.marginHorizontal))*b,O=(e.x+_)*b,I=g.Z.getMonomerLib(),L={};for(const e of r){const i=T*(n[e].count/a),r=T*((null!==(A=u[e])&&void 0!==A?A:0)/a);if(L[e]=new o.Rect(O/b,E/b,M/b,i/b),t.resetTransform(),"-"!==e&&""!==e){const n=(0,s.zS)(e,5),a=t.measureText(n);r>0&&(t.lineWidth=N,t.line(x,E,x,E+r,o.Color.rowSelection));const l=I.getMonomerTextColor(p.o.AA,e);t.fillStyle=l,t.textAlign="left",t.textBaseline="top",t.font=c.symbolStyle;const u=M/a.width,d=i/c.upperLetterHeight;t.setTransform(u,0,0,d,O,E),t.fillText(n,0,0,a.width)}E+=i+c.upperLetterAscent*b}return t.resetTransform(),t.fillStyle=o.Color.toHtml(o.Color.black),t.textAlign="center",t.textBaseline="top",t.font=c.headerStyle,t.fillText(i,(e.x+e.width/2)*b,(e.y+e.height-c.textHeight)*b),L}(h,v,i,y.name,C,m.filter.trueCount,d.colorPalette(),d.headerSelectedMonomers?d.headerSelectedMonomers()[y.name]:{}),t.preventDefault()}}catch(t){console.warn(`PeptidesHeaderLogoError: couldn't render WebLogo for column \`${y.name}\`. See original error below.`),console.warn(t)}finally{h.restore()}})(t)));const v=n=>{var o;const s=t.hitTest(n.offsetX,n.offsetY);if((null==s?void 0:s.isColHeader)&&(null===(o=s.tableColumn)||void 0===o?void 0:o.semType)===r.uF.MONOMER){const t=function(t,e,n){const i=n[t.tableColumn.name];if(!i)return null;for(const[n,o]of Object.entries(i)){const i=e.offsetX>=o.x&&e.offsetX<=o.x+o.width,r=e.offsetY>=o.y&&e.offsetY<=o.y+o.height;if(i&&r)return{monomerOrCluster:n,positionOrClusterType:t.tableColumn.name}}return null}(s,n,d.webLogoBounds());if(null===t)return void(d.isSelectionTable||null==d.unhighlightCallback||d.unhighlightCallback());f.monomerPosition=t,function(t,e,n,o,r,s){if("click"!==t.type||r.isSelectionTable||null==r.selectionCallback){const a=`${e.positionOrClusterType} = ${e.monomerOrCluster}`;r.cachedWebLogoTooltip().bar===a?i.tooltip.show(r.cachedWebLogoTooltip().tooltip,t.clientX,t.clientY):(r.cachedWebLogoTooltip().bar=a,s.x=t.clientX,s.y=t.clientY,s.monomerPosition=e,r.cachedWebLogoTooltip().tooltip=(0,u.Y)(n,o,[],s))}else r.selectionCallback(e,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey})}(n,t,m,c,d,f),d.isSelectionTable||null==d.highlightCallback||d.highlightCallback(t,m,e)}else null!=d.unhighlightCallback&&d.unhighlightCallback()};l.fromEvent(t.overlay,"mousemove").subscribe((t=>v(t))),l.fromEvent(t.overlay,"click").subscribe((t=>v(t))),l.fromEvent(t.overlay,"mouseleave").subscribe((()=>{null!=d.unhighlightCallback&&d.unhighlightCallback()}))}class S extends o.GridCellRenderer{constructor(){super(...arguments),this.colorCacheKey="lst-pie-chart-color-cache",this.HoverTempKey="lst-pie-chart-hovered-sector",this.hoverSeparator=",,,,,"}get name(){return"LST Pie Chart"}get cellType(){return"lst-pie-chart"}get defaultWidth(){return 80}get defaultHeight(){return 80}categoryNumberCache(t){return t.temp[this.colorCacheKey]||(t.temp[this.colorCacheKey]={}),t.temp[this.colorCacheKey]}getPrevHoveredSector(t){return t.temp[this.HoverTempKey]}onMouseMove(t,e){const n=this.getPrevHoveredSector(t.cell.column),o=()=>{t.cell.column.temp[this.HoverTempKey]=null,i.tooltip.hide(),null!==n&&t.grid.invalidate()},r=t.cell.value;if(!r)return void o();const s=e.offsetX-t.bounds.midX,a=e.offsetY-t.bounds.midY,l=Math.sqrt(s*s+a*a),u=Math.atan2(a,s),c=u<0?u+2*Math.PI:u;if(l>Math.min(t.bounds.width,t.bounds.height)/2-2)return void o();let d;try{d=JSON.parse(r)}catch(e){return void o()}const f=new Float64Array(Object.keys(d).length+1),h=Object.values(d).reduce(((t,e)=>t+e),0);f[Object.keys(d).length]=2*Math.PI;let m=0,g=0;for(const t of Object.values(d))f[g++]=m,m+=2*Math.PI*t/h;let p=-1;for(let t=0;t<f.length-1;t++)if(c>=f[t]&&c<f[t+1]){p=t;break}if(-1===p)return void o();const v=Object.keys(d)[p],y=d[v],C=(y/h*100).toFixed(2);i.tooltip.show(i.h1(`${v}: ${y} (${C}%)`),e.x+16,e.y+16);const w=t.cell.rowIndex.toString()+this.hoverSeparator+v;t.cell.column.temp[this.HoverTempKey]=w,n!==w&&t.grid.invalidate()}render(t,e,n,i,r,s,a){const l=s.cell.dataFrame,u=new o.Rect(e,n,i,r).fitSquare().inflate(-2,-2);if(i<5||r<5||!l)return;const c=s.cell.value;if(t.clearRect(e,n,i,r),!c)return;let d;try{d=JSON.parse(c)}catch(t){return}const f=Object.values(d).reduce(((t,e)=>t+e),0);let h=0;const m=Object.fromEntries(Object.keys(d).map((t=>[t,255]))),g=s.cell.column.temp[this.HoverTempKey];if(g&&2===g.split(this.hoverSeparator).length){const[t,e]=g.split(this.hoverSeparator);if(t===s.cell.rowIndex.toString()){for(const[t,e]of Object.entries(d))m[t]=100;m[e]=255}}const p=Math.min(i,r)/2.2;for(const[e,n]of Object.entries(d)){const i=2*Math.PI*n/f;t.beginPath(),t.moveTo(u.midX,u.midY),t.arc(u.midX,u.midY,p,h,h+i),h+=i;const r=this.categoryNumberCache(s.cell.column);r[e]||(r[e]=Object.keys(r).length,s.cell.column.temp[this.colorCacheKey]=r),t.fillStyle=o.Color.toHtml(o.Color.setAlpha(o.Color.getCategoricalColor(r[e]),m[e])),t.fill(),t.strokeStyle=o.Color.toRgb(o.Color.lightGray),t.stroke();const a=e;t.fillStyle=o.Color.toRgb(o.Color.white),t.font="9px Arial";const l=t.measureText(a).width,c=h-i/2;for(let e=.8;e>=.4;e-=.05){const n=p*e,o=u.midX+Math.cos(c)*n,r=u.midY+Math.sin(c)*n;if([[o-l/2-2,r],[o+l/2+2,r]].every((t=>{const e=Math.sqrt(Math.pow(t[0]-u.midX,2)+Math.pow(t[1]-u.midY,2)),n=Math.atan2(t[1]-u.midY,t[0]-u.midX),o=n<0?n+2*Math.PI:n;return e<p-2&&o>h-i&&o<h}))){t.fillText(a,o,r);break}}}}}},4139:(t,e,n)=>{"use strict";n.d(e,{$2:()=>i,To:()=>l,V5:()=>f,YX:()=>d,gp:()=>r,i6:()=>o,rg:()=>u,uF:()=>s,wf:()=>c,zW:()=>h});var i,o,r,s,a=n(6082);!function(t){t.SPLIT_COL="~split",t.ACTIVITY="Activity",t.ACTIVITY_SCALED="Scaled activity",t.MONOMER="AAR",t.POSITION="Pos",t.P_VALUE="pValue",t.MEAN_DIFFERENCE="Mean difference",t.COUNT="Count",t.RATIO="Ratio",t.MEAN="Mean"}(i||(i={})),function(t){t.MEMBERS="Members",t.WEB_LOGO="WebLogo",t.DISTRIBUTION="Distribution",t.MEAN_DIFFERENCE="Mean difference",t.P_VALUE="P-Value",t.RATIO="Ratio",t.CLUSTER="Cluster"}(o||(o={})),function(t){t.MONOMER="monomer",t.POSITION="pos",t.SEPARATOR="separator",t.SELECTION="selection",t.MUTATION_CLIFFS_SELECTION="mutationCliffsSelection",t.ALPHABET="alphabet",t.FILTER="filter",t.INVARIANT_MAP_SELECTION="invariantMapSelection",t.SAR_MODE="sarMode",t.CLUSTER_SELECTION="clusterSelection",t.VISIBLE="visible",t.SETTINGS="settings",t.CUSTOM_CLUSTER="customCluster",t.MONOMER_POSITION_MODE="monomerPositionMode",t.MULTIPLE_VIEWS="isMultipleViews",t.IDENTITY_TEMPLATE="Identity template",t.SIMILARITY_TEMPLATE="Similarity template",t.ANALYSIS_COL="isAnalysisCol",t.POSITION_COL="isPositionCol",t.M_P_STATS_CACHE=".MPStatsCache",t.INVARIANT_MAP_COLOR_CACHE=".InvariantMapColorCache",t.INVARIANT_MAP_COLOR_MAX_CACHE=".InvariantMapColorMaxCache",t.INVARIANT_MAP_COLOR_MIN_CACHE=".InvariantMapColorMinCache"}(r||(r={})),function(t){t.MONOMER="Monomer",t.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference"}(s||(s={}));const l="ColumnName";var u,c,d;!function(t){t.NONE="none",t.LG="lg",t.MINUS_LG="-lg"}(u||(u={})),function(t){t.HIGH="High",t.LOW="Low"}(c||(c={})),function(t){t.LST="lst-",t.MP="mp-",t.MPR="mpr-",t.WL="wl-"}(d||(d={}));const f=Object.values(a.AGG).filter((t=>![a.AGG.FIRST,a.AGG.KEY,a.AGG.PIVOT,a.AGG.SELECTED_ROWS_COUNT].includes(t))),h={[a.AGG.TOTAL_COUNT]:"totalCount",[a.AGG.VALUE_COUNT]:"valueCount",[a.AGG.UNIQUE_COUNT]:"uniqueCount",[a.AGG.MISSING_VALUE_COUNT]:"missingValueCount",[a.AGG.MIN]:"min",[a.AGG.MAX]:"max",[a.AGG.SUM]:"sum",[a.AGG.MED]:"med",[a.AGG.AVG]:"avg",[a.AGG.STDEV]:"stdev",[a.AGG.VARIANCE]:"variance",[a.AGG.SKEW]:"skew",[a.AGG.KURT]:"kurt",[a.AGG.Q1]:"q1",[a.AGG.Q2]:"q2",[a.AGG.Q3]:"q3"}},8608:(t,e,n)=>{"use strict";n.d(e,{$s:()=>x,AN:()=>i,AY:()=>f,B2:()=>M,BE:()=>C,CD:()=>A,F2:()=>p,FZ:()=>v,KT:()=>T,Lv:()=>I,Y1:()=>h,ZR:()=>E,dl:()=>S,eY:()=>g,qI:()=>N,qx:()=>m,sg:()=>O,vW:()=>b,vY:()=>w,zm:()=>_,zz:()=>y});var i,o=n(7389),r=n(6082),s=n(4328),a=n(4139),l=n(8774),u=n(144),c=n.n(u),d=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function f(t){var e;return null!==(e=t.getTag(a.gp.SEPARATOR))&&void 0!==e?e:""}function h(t,e=a.rg.NONE){let n=t=>t;switch(e){case a.rg.NONE:break;case a.rg.LG:n=t=>Math.log10(t);break;case a.rg.MINUS_LG:n=t=>-Math.log10(t);break;default:throw new Error(`ScalingError: method \`${e}\` is not available.`)}const i=t.getRawData(),o=r.Column.float(a.$2.ACTIVITY,t.length).init((t=>{const e=i[t];return e===r.FLOAT_NULL||e===r.INT_NULL?e:n(e)}));return o.setTag(a.gp.ANALYSIS_COL,"true"),o.setTag(r.TAGS.FORMULA,e),o}function m(t){var e,n,i,o;const r=t.columns.bySemTypeAll(a.uF.MONOMER),s={},l=t.filter.clone().and(t.selection).getSelectedIndexes();for(const t of l)for(const a of r){const r=a.get(t);r&&(null!==(e=s[i=a.name])&&void 0!==e||(s[i]={}),null!==(n=(o=s[a.name])[r])&&void 0!==n||(o[r]=0),s[a.name][r]+=1)}return s}function g(t){return{name:t.name,cat:t.categories,rawData:t.getRawData()}}function p(t,e,n={}){var s;const l=t.dataFrame.getCol(a.$2.SPLIT_COL),u=[],c=l.categories,d=l.getRawData();for(let t=0;t<c.length;++t){if(!Object.values(i).includes(c[t]))continue;const e=r.Color.toHtml(l.meta.colors.getColor(d.indexOf(t))),a=o.label(null!==(s=n[c[t]])&&void 0!==s?s:c[t],{style:{color:e}});u.push(a)}const f=o.divV([o.divV(u),t.root,o.tableFromMap(e)]);return t.root.style.maxHeight="75px",f}function v(t,e,n){var o,s;const l=null!==(o=null==n?void 0:n.clone().xor(e).anyTrue)&&void 0!==o&&o,u=t.length,c=t.getRawData(),d=new Float32Array(u+e.trueCount+(l&&null!==(s=null==n?void 0:n.trueCount)&&void 0!==s?s:0)),f=new Array(d.length);for(let t=0,o=0,r=0;t<u;++t){const s=e.get(t);d[t]=c[t],f[t]=s?i.SELECTION:i.ALL,s&&(d[u+o]=c[t],f[u+o]=i.ALL,++o),l&&(null==n?void 0:n.get(t))&&(d[u+e.trueCount+r]=c[t],f[u+e.trueCount+r]=i.PEPTIDES_SELECTION,++r)}const h=r.Column.fromStrings(a.$2.SPLIT_COL,f),m=[i.ALL,i.SELECTION];return l&&m.push(i.PEPTIDES_SELECTION),h.setCategoryOrder(m),h.meta.colors.setCategorical(),r.DataFrame.fromColumns([r.Column.fromFloat32Array(a.$2.ACTIVITY,d),h])}function y(t){const e=o.iconFA("expand-alt",(()=>{const e=t.dataFrame.plot.grid();w(e,!1),e.root.style.height="100%";const n=o.dialog(t.dataFrame.name);n.add(e.root),n.showModal(!0),e.invalidate()}));t.root.appendChild(e),e.style.position="absolute",e.style.right="0px",e.style.top="0px",e.style.visibility="hidden",t.root.addEventListener("mouseenter",(t=>{e.style.visibility="visible"})),t.root.addEventListener("mouseleave",(t=>{e.style.visibility="hidden"}))}function C(t,e,n,i){const r=o.iconFA("expand-alt",(()=>{const e=i(),n=o.dialog(t);n.add(e),n.show({resizable:!0,modal:!0,width:window.innerWidth-60,x:30,y:30,height:window.innerHeight-60})}),"Expand to full screen");r.style.marginLeft="auto",r.style.marginRight="15px",n.addEventListener("mouseenter",(()=>{r.style.visibility="visible"})),n.addEventListener("mouseleave",(()=>{r.style.visibility="hidden"})),e.appendChild(r)}function w(t,e=!0){t.props.allowEdit=!1,t.props.showReadOnlyNotifications=!1,t.props.allowRowSelection=!1,t.props.allowBlockSelection=!1,t.props.allowColSelection=!1,t.props.showRowHeader=!1,t.props.showCurrentRowIndicator=!1,t.root.style.width="100%",t.root.style.maxWidth="100%",e&&t.autoSize(1e3,175,0,0,!0)}function A(t){for(const e of Object.values(t))if(0!==e.length)return!1;return!0}function b(t,e,n){const i=t[e.positionOrClusterType],o=i.indexOf(e.monomerOrCluster);if(n.shiftPressed&&n.ctrlPressed)-1!==o&&i.splice(o,1);else if(n.ctrlPressed)-1===o?i.push(e.monomerOrCluster):i.splice(o,1);else if(n.shiftPressed)-1===o&&i.push(e.monomerOrCluster);else{const n=Object.keys(t);t={};for(const i of n)t[i]=[],i===e.positionOrClusterType&&t[i].push(e.monomerOrCluster)}return t}function S(t,e,n){if(!e)return;const i=new l.A(e.rowCount);if(t.positionOrClusterType===a.$2.MONOMER){const e=Object.values(n);for(const n of e){const e=n[t.monomerOrCluster];void 0!==e&&i.or(e.mask)}}else{const e=n[t.positionOrClusterType];if(void 0!==e){const n=e[t.monomerOrCluster];void 0!==n&&i.or(n.mask)}}e.rows.highlight((t=>i.getBit(t)))}function E(t){const e={};for(const n of t)e[n.name]=[];return e}function T(t,e){let n=null;const i=Object.entries(t);for(const[t,o]of i){const i=e[t];for(const t of o){const e=i[t];e&&(null!=n||(n=new l.A(e.mask.length,!1)),n.or(e.mask))}}return null!=n?r.BitSet.fromBytes(n.buffer.buffer,n.length):null}function x(t,e){return t.sequenceColumnName===e.sequenceColumnName&&t.activityColumnName===e.activityColumnName&&t.activityScaling===e.activityScaling}function N(t,e){var n;const i={};for(const[o,r]of t)for(const[t,s]of r){null!==(n=i[t])&&void 0!==n||(i[t]={});const r=new l.A(e,!1);for(const[t,e]of s){r.setTrue(t);for(const t of e)r.setTrue(t)}i[t][o]={mask:r}}return i}function _(t,e,n,i){const o=Object.entries(n),r=i?Object.entries(i).filter((t=>!e.includes(t[0])||n[t[0]]!==t[1])):[];return o.concat(r).filter((e=>t.columns.contains(e[0])&&t.col(e[0]).matches("numerical")))}function M(t,e=2){return t.columns.bySemTypeAll(r.SEMTYPE.MACROMOLECULE).length>0&&c()(t.columns.numerical).toArray().length>0&&t.rowCount>=e}function O(t,e=500){let n;return(...i)=>d(this,void 0,void 0,(function*(){return new Promise((o=>{clearTimeout(n),n=setTimeout((()=>o(t(...i))),e)}))}))}function I(){return"isInDemo"in s.shell&&!!s.shell.isInDemo}!function(t){t.SELECTION="Selection",t.ALL="All",t.PEPTIDES_SELECTION="Peptides selection"}(i||(i={}))},5070:(t,e,n)=>{"use strict";n.d(e,{hX:()=>s,I_:()=>u,m2:()=>c,lh:()=>l,GT:()=>a,J1:()=>d});var i=n(6082),o=n(6572),r=n(4139);const s=(t,e)=>`${t}(${e})`;function a(t,e,n){var r;if(t.length!==e.length&&t.some(((t,n)=>n>=e.length&&0!==t)))throw new Error("PeptidesError: Data and bit array have different lengths");const s=new Float32Array(e.trueCount()),a=new Float32Array(e.falseCount());let l;if(n)try{l=null===(r=i.DataFrame.fromColumns([n.col]).clone(i.BitSet.fromBytes(e.buffer.buffer,e.length)).col(n.col.name))||void 0===r?void 0:r.aggregate(n.type)}catch(t){console.error(t)}let u=0,c=0;for(let n=0;n<e.length;++n)e.getBit(n)?s[u++]=t[n]:a[c++]=t[n];const d=s.reduce(((t,e)=>t+e),0)/Math.max(s.length,1);if(s.length<2||a.length<2){const t=a.reduce(((t,e)=>t+e),0)/Math.max(a.length,1);return{count:s.length,pValue:null,mean:d,meanDifference:d-t,ratio:s.length/e.length,mask:e,aggValue:l}}const f=function(t,e,n=!1,i=!1){if(t.length<=1||e.length<=1)throw new Error(`StatisticsError: Wrong sample size; expected at least 2, got ${Math.min(t.length,e.length)})`);const r=o.mean(t),s=o.mean(e),a=o.variance(t),l=o.variance(e),u=t.length,c=e.length;let d,f,h;if(n){const t=a/u,e=l/c,n=(r-s)/Math.sqrt(t+e);f=o.normal.pdf(n,0,1),d=1-f,h=2*(f<d?f:d)}else if(i){const t=u+c-2,e=(a*(u-1)+l*(c-1))/t,n=Math.sqrt(u*c/(u+c))*(r-s)/e;d=1-o.studentt.cdf(n,t),f=o.studentt.cdf(n,t),h=2*(f<d?f:d)}else{const t=a/u,e=l/c,n=(r-s)/Math.sqrt(t+e),i=Math.pow(t+e,2)/(Math.pow(t,2)/(u-1)+Math.pow(e,2)/(c-1));f=o.studentt.cdf(n,i),d=1-f,h=2*(f<d?f:d)}return{"p-value":h,"Mean difference":r-s,"p-value more":d,"p-value less":f}}(s,a),h=f["Mean difference"];return{count:s.length,pValue:f[h>=0?"p-value more":"p-value less"],mean:d,meanDifference:h,ratio:s.length/e.length,mask:e,aggValue:l}}function l(t,e,n){const o=r.zW[e],s=i.Stats.fromColumn(t,n);if(!(o in s))throw new Error(`Aggregation type ${o} is not supported`);return s[o]}function u(t,e,n={}){var i,o;null!==(i=n.filterDf)&&void 0!==i||(n.filterDf=!1),null!==(o=n.fractionDigits)&&void 0!==o||(n.fractionDigits=3);const r=n.filterDf&&t.filter.anyFalse?t.clone(t.filter):t,a={};for(const[t,i]of e){const e=s(i,t),o=l(r.getCol(t),i,n.mask);a[e]=o.toFixed(n.fractionDigits)}return a}function c(t,e,n,i){var o;null!==(o=i.fractionDigits)&&void 0!==o||(i.fractionDigits=3);const r={};for(const[o,a]of n){const n=s(a,o),l=t.get(n,e);r[n]=l.toFixed(i.fractionDigits)}return r}function d(t,e,n){var o;const r=t.col(e.substring(5,e.length-1));if(!r||!r.matches("categorical"))return"{}";null!=n||(n=i.BitSet.create(t.rowCount,(()=>!0)));const s=r.getRawData(),a=new Map;for(let t=-1;-1!==(t=n.findNext(t,!0));)a.set(s[t],(null!==(o=a.get(s[t]))&&void 0!==o?o:0)+1);const l={};for(const[t,e]of a)l[r.categories[t]]=e;return JSON.stringify(l)}},912:(t,e,n)=>{"use strict";n.d(e,{D:()=>u,Y:()=>c});var i=n(7389),o=n(6082),r=n(4139),s=n(7654),a=n(8608),l=n(5070);function u(t,e,n,i){var o,s,a;return null!==(o=i.fromViewer)&&void 0!==o||(i.fromViewer=!1),null!==(s=i.isMutationCliffs)&&void 0!==s||(i.isMutationCliffs=!1),null!==(a=i.isMostPotentResidues)&&void 0!==a||(i.isMostPotentResidues=!1),i.monomerPosition.positionOrClusterType!==r.$2.MONOMER&&c(t,e,n,i),!0}function c(t,e,n,r){var u,c,d,f,h,m,g,p,v;if(null!==(u=r.fromViewer)&&void 0!==u||(r.fromViewer=!1),null!==(c=r.isMutationCliffs)&&void 0!==c||(r.isMutationCliffs=!1),null!==(d=r.isMostPotentResidues)&&void 0!==d||(r.isMostPotentResidues=!1),null!==(f=r.additionalStats)&&void 0!==f||(r.additionalStats={}),r.cliffStats&&r.isMutationCliffs){const u=null===(p=null===(g=r.cliffStats)||void 0===g?void 0:g.get(r.monomerPosition.monomerOrCluster))||void 0===p?void 0:p.get(r.monomerPosition.positionOrClusterType);if(!u)return null;const c=o.BitSet.fromBytes(u.mask.buffer.buffer,e.length),d=(0,s.M1)((0,a.FZ)(e,c),!0),f=(0,s.QD)(u,{countName:"Unique count"});r.fromViewer&&(f["Mean difference"]=`${f["Mean difference"]} (Color)`,f["Unique count"]&&(f["Unique count"]=`${f["Unique count"]} (Size)`));const h=null!==(v=r.aggrColValues)&&void 0!==v?v:(0,l.I_)(t,n,{mask:c}),m=Object.assign(Object.assign(Object.assign({},r.additionalStats),f),h),y=(0,a.F2)(d,m);return i.tooltip.show(y,r.x,r.y),y}{const u=r.mpStats[r.monomerPosition.positionOrClusterType][r.monomerPosition.monomerOrCluster];if(!(null==u?void 0:u.count))return null;const c=o.BitSet.fromBytes(u.mask.buffer.buffer,e.length),d=(0,s.M1)((0,a.FZ)(e,c),!0),f=(0,s.QD)(u);r.fromViewer&&(f["Mean difference"]=`${f["Mean difference"]}${r.isMostPotentResidues?" (size)":""}`,f["p-value"]&&(f["p-value"]=`${f["p-value"]}${r.isMostPotentResidues?" (color)":""}`));const g=null!==(h=r.aggrColValues)&&void 0!==h?h:(0,l.I_)(t,n,{mask:c}),p=Object.assign(Object.assign(Object.assign({},r.additionalStats),f),g);for(const[t,e]of Object.entries(null!==(m=r.postfixes)&&void 0!==m?m:{}))p[t]&&(p[t]=`${p[t]}${e}`);const v=(0,a.F2)(d,p);return i.tooltip.show(v,r.x,r.y),v}}},115:(t,e,n)=>{"use strict";n.d(e,{GI:()=>a,Ku:()=>r,av:()=>s});var i=n(1199),o=n(4329);const r="WebGPU is not supported on this device";class s{constructor(){this.maxIterations=16,this.inflation=1.4,this.threshold=70,this.distanceF=i.Z.NEEDLEMANN_WUNSCH,this.gapOpen=1.5,this.gapExtend=.2,this.fingerprintType="Morgan",this.useWebGPU=!1,this.minClusterSize=5,this.webGPUDescription=r,this.webGPUDescriptionPromise=(0,o._)().then((t=>{t&&(this.webGPUDescription=t)}))}}class a{constructor(t){this.distanceF=i.Z.NEEDLEMANN_WUNSCH,this.gapOpen=1.5,this.gapExtend=.2,this.clusterEmbeddings=!0,this.epsilon=.01,this.minPts=4,this.fingerprintType="Morgan",this.clusterEmbeddings=!!t}}},5480:(t,e,n)=>{"use strict";n.d(e,{W:()=>S,s:()=>T});var i=n(7389),o=n(4328),r=n(6082),s=n(7233),a=n.n(s),l=n(9499),u=n(4139),c=n(3163),d=n(4326),f=n(5070),h=n(144),m=n.n(h),g=n(7654),p=n(8608),v=n(8774),y=n(9995),C=n(3657),w=n(3077),A=n(726);const b=(t,e)=>`${t}(${e})`;var S,E;!function(t){t.ORIGINAL="original",t.CUSTOM="custom"}(S||(S={})),function(t){t.GENERAL="General",t.STYLE="WebLogo",t.AGGREGATION="Aggregation"}(E||(E={}));class T extends r.JsViewer{constructor(){super(),this._titleHost=i.divText(l.q.LOGO_SUMMARY_TABLE,{id:"pep-viewer-title"}),this.bitsets=[],this.keyPress=!1,this.currentRowIndex=null,this._scaledActivityColumn=null,this._webLogoCacheGeneration=0,this._viewerGrid=null,this._clusterStats=null,this._clusterSelection=null,this._logoSummaryTable=null,this._positionColumns=null,this.sequenceColumnName=this.column("sequence",{category:E.GENERAL,nullable:!1}),this.clustersColumnName=this.column("clusters",{category:E.GENERAL,nullable:!1,columnTypeFilter:r.TYPE.CATEGORICAL}),this.activityColumnName=this.column("activity",{category:E.GENERAL,nullable:!1,columnTypeFilter:r.TYPE.NUMERICAL}),this.activityScaling=this.string("activityScaling",u.rg.NONE,{category:E.GENERAL,choices:Object.values(u.rg)}),this.webLogoMode=this.string("webLogoMode",d.fH.Entropy,{choices:[d.fH.full,d.fH.Entropy],category:E.STYLE}),this.membersRatioThreshold=this.float("membersRatioThreshold",.1,{min:0,max:1,category:E.STYLE});const t=[r.AGG.KEY,r.AGG.PIVOT,r.AGG.MISSING_VALUE_COUNT,r.AGG.SKEW,r.AGG.KURT,r.AGG.SELECTED_ROWS_COUNT],e=Object.values(r.AGG).filter((e=>!t.includes(e)));this.webLogoAggregationType=this.string("webLogoAggregationType",r.AGG.TOTAL_COUNT,{category:E.STYLE,choices:e,description:"Aggregation method for WebLogo position heights"}),this.webLogoAggregationColumnName=this.column("webLogoAggregationColumnName",{defaultValue:null,category:E.STYLE,nullable:!0,columnTypeFilter:r.TYPE.NUMERICAL,description:`Column with values to aggregate for WebLogo position heights.\n Used if aggregation type is not '${r.AGG.TOTAL_COUNT}'.`}),this.columns=this.columnList("columns",[],{category:E.AGGREGATION}),this.aggregation=this.string("aggregation",r.AGG.AVG,{category:E.AGGREGATION,choices:u.V5})}get model(){return l.i.getInstance(this.dataFrame)}get viewerGrid(){var t;return null!==(t=this._viewerGrid)&&void 0!==t||(this._viewerGrid=this.createLogoSummaryTableGrid()),this._viewerGrid}get clusterStats(){var t;return null!==(t=this._clusterStats)&&void 0!==t||(this._clusterStats=(0,C.eW)(this.dataFrame,this.clustersColumnName,this.customClusters.toArray(),this.getScaledActivityColumn())),this._clusterStats}get clusterSelection(){var t;const e=this.dataFrame.getTag(u.gp.CLUSTER_SELECTION);return null!==(t=this._clusterSelection)&&void 0!==t||(this._clusterSelection=null===e?this.initClusterSelection({notify:!1}):JSON.parse(e)),this._clusterSelection}set clusterSelection(t){this._clusterSelection=t,this.dataFrame.setTag(u.gp.CLUSTER_SELECTION,JSON.stringify(t)),this.model.fireBitsetChanged(l.q.LOGO_SUMMARY_TABLE),this.model.analysisView.grid.invalidate()}get logoSummaryTable(){var t;return null!==(t=this._logoSummaryTable)&&void 0!==t||(this._logoSummaryTable=this.createLogoSummaryTable()),this._logoSummaryTable}set logoSummaryTable(t){this._logoSummaryTable=t}get positionColumns(){var t,e,n,i;if(null!=this._positionColumns)return this._positionColumns;const o=t=>{const e=this.model.findViewer(t);return this.sequenceColumnName===(null==e?void 0:e.sequenceColumnName)?e._positionColumns:null};return null!=this.model.positionColumns&&this.sequenceColumnName===(null===(t=this.model.settings)||void 0===t?void 0:t.sequenceColumnName)&&(this._positionColumns=this.model.positionColumns),null!==(e=this._positionColumns)&&void 0!==e||(this._positionColumns=null!==(i=null!==(n=o(l.q.SEQUENCE_VARIABILITY_MAP))&&void 0!==n?n:o(l.q.MOST_POTENT_RESIDUES))&&void 0!==i?i:(0,w.R)(this.dataFrame.getCol(this.sequenceColumnName),A.Z.getSeqHelper()).columns.toList()),this._positionColumns}get isClusterSelectionEmpty(){return 0===this.clusterSelection[S.ORIGINAL].length+this.clusterSelection[S.CUSTOM].length}get customClusters(){const t={};return t[u.gp.CUSTOM_CLUSTER]="1",m()(this.dataFrame.columns.byTags(t))}getScaledActivityColumn(t=!1){var e,n,i;return(null===(e=this.model.settings)||void 0===e?void 0:e.activityColumnName)===this.activityColumnName&&(null===(n=this.model.settings)||void 0===n?void 0:n.activityScaling)===this.activityScaling&&(this._scaledActivityColumn=this.model.getScaledActivityColumn(t)),null!==(i=this._scaledActivityColumn)&&void 0!==i||(this._scaledActivityColumn=(0,p.Y1)(this.dataFrame.getCol(this.activityColumnName),this.activityScaling)),t?r.DataFrame.fromColumns([this._scaledActivityColumn]).clone(this.dataFrame.rowCount===this._scaledActivityColumn.length?this.dataFrame.filter:null).getCol(this._scaledActivityColumn.name):this._scaledActivityColumn}getAggregationColumns(){return Object.fromEntries(this.columns.map((t=>[t,this.aggregation])).filter((([t,e])=>this.model.df.columns.contains(t)&&this.model.df.col(t).matches("numerical"))))}onTableAttached(){var t,e,n,i;if(super.onTableAttached(),(0,p.B2)(this.dataFrame)){const o=m()(this.dataFrame.columns.numerical).next().value.name;null===(t=this.getProperty(`sequence${u.To}`))||void 0===t||t.set(this,this.dataFrame.columns.bySemType(r.SEMTYPE.MACROMOLECULE).name),null===(e=this.getProperty(`activity${u.To}`))||void 0===e||e.set(this,o),null===(n=this.getProperty("webLogoAggregationColumnName"))||void 0===n||n.set(this,o),null===(i=this.getProperty(`clusters${u.To}`))||void 0===i||i.set(this,m()(this.dataFrame.columns.categorical).next().value.name)}else{const t="PeptidesError: dataframe is missing Macromolecule or numeric columns";o.log.error(t),o.shell.warning(t)}this.render()}detach(){this.subs.forEach((t=>t.unsubscribe()))}render(){if(a()(this.root).empty(),null==this.clustersColumnName||null==this.sequenceColumnName||null==this.activityColumnName)return void this.root.appendChild(i.divText("Please, select a sequence, cluster and activity columns in the viewer properties"));if(!this.logoSummaryTable.filter.anyTrue){const t=i.divText("No clusters to satisfy the threshold. Please, lower the threshold in viewer proeperties to include clusters");return void this.root.appendChild(i.divV([this._titleHost,t]))}const t=i.iconFA("expand-alt",(()=>{const t=i.dialog("Logo Summary Table");t.add(this.viewerGrid.root),t.onCancel((()=>this.render())),t.showModal(!0),this.viewerGrid.invalidate()}),"Show Logo Summary Table in full screen");a()(t).addClass("pep-help-icon"),this.viewerGrid.root.style.width="auto",this.viewerGrid.root.style.height="auto",this.viewerGrid.root.style.overflow="hidden",this.root.appendChild(i.divV([i.divH([this._titleHost,t],{style:{alignSelf:"center",lineHeight:"normal"}}),this.viewerGrid.root])),this.viewerGrid.invalidate()}onPropertyChanged(t){super.onPropertyChanged(t);let e=!1;switch(t.name){case"membersRatioThreshold":this.logoSummaryTable.filter.anyTrue||(e=!0),this.updateFilter();break;case`sequence${u.To}`:this._viewerGrid=null,this._logoSummaryTable=null,e=!0;break;case`clusters${u.To}`:this._clusterStats=null,this._clusterSelection=null,this._viewerGrid=null,this._logoSummaryTable=null,e=!0;break;case`activity${u.To}`:this.webLogoAggregationColumnName=this.activityColumnName;case"activityScaling":case`webLogoAggregationColumnName${u.To}`:case"webLogoAggregationType":this._webLogoCacheGeneration++,this._scaledActivityColumn=null,this._viewerGrid=null,this._clusterStats=null,this._logoSummaryTable=null,e=!0;break;case"columns":case"aggregation":this._viewerGrid=null,this._logoSummaryTable=null,e=!0;break;case"webLogoMode":this.viewerGrid.invalidate()}e&&this.render()}initClusterSelection(t={}){var e;null!==(e=t.notify)&&void 0!==e||(t.notify=!0);const n={};return n[S.ORIGINAL]=[],n[S.CUSTOM]=[],t.notify?this.clusterSelection=n:this._clusterSelection=n,this.clusterSelection}getTotalViewerAggColumns(){var t,e;const n=this.getAggregationColumns();return(0,p.zm)(this.model.df,this.columns,n,null===(e=null===(t=this.model)||void 0===t?void 0:t.settings)||void 0===e?void 0:e.columns)}getStringAggregatedColumns(){return this.columns.filter((t=>this.model.df.columns.contains(t)&&this.model.df.col(t).matches("categorical"))).map((t=>`dist(${t})`))}getNeededDfClone(){var t,e;const n=[this.clustersColumnName,this.sequenceColumnName,this.activityColumnName,...(null!==(t=this.getTotalViewerAggColumns())&&void 0!==t?t:[]).map((([t,e])=>t)),...(null!==(e=this.getStringAggregatedColumns())&&void 0!==e?e:[]).map((t=>t.substring(5,t.length-1)))];this.webLogoAggregationColumnName&&n.push(this.webLogoAggregationColumnName);const i=Array.from(new Set(n)).filter((t=>this.dataFrame.columns.contains(t)));return this.dataFrame.clone(this.dataFrame.filter,i)}createLogoSummaryTable(){var t,e,n;const i=this.clustersColumnName,o=this.dataFrame.filter.anyFalse,s=o?this.getNeededDfClone():this.dataFrame,a=s.columns,l=s.rowCount,c=this.getScaledActivityColumn(o).getRawData(),d=s.getCol(i),h=d.getRawData(),g=d.categories,p={};p[u.gp.CUSTOM_CLUSTER]="1";const y=m()(a.byTags(p)).filter((t=>t.max>0)).toArray(),C=r.DataFrame.create(y.length),w=C.columns,A=w.addNewString(u.i6.CLUSTER),E=w.addNewInt(u.i6.MEMBERS).getRawData(),T=w.addNewString(u.i6.WEB_LOGO),x=w.addNewString(u.i6.DISTRIBUTION),N=w.addNewFloat(u.i6.MEAN_DIFFERENCE).getRawData(),_=w.addNewFloat(u.i6.P_VALUE).getRawData(),M=w.addNewFloat(u.i6.RATIO).getRawData();let O=s.groupBy([i]);const I=this.getTotalViewerAggColumns(),L=this.getStringAggregatedColumns(),P=L.map((t=>w.addNewString(t))),R=I.map((([t,e])=>b(e,t))),k=new Array(R.length+L.length),V=I.map((([t,e])=>[s.getCol(t),e]));for(let t=0;t<I.length;++t){const[e,n]=I[t];O=O.add(n,e,R[t]);const i=w.addNewFloat(R[t]);k[t]=i.getRawData()}const D=new Array(y.length);for(let e=0;e<y.length;++e){const n=y[e];A.set(e,n.name);const i=v.A.fromUint32Array(l,n.getRawData());if(i.allFalse)continue;const a=r.BitSet.fromBytes(i.buffer.buffer,l),u=o?(0,f.GT)(c,i):this.clusterStats[S.CUSTOM][n.name];E[e]=u.count,D[e]=a,N[e]=u.meanDifference,_[e]=null!==(t=u.pValue)&&void 0!==t?t:r.FLOAT_NULL,M[e]=u.ratio;for(let t=0;t<R.length;++t){const[n,i]=V[t];k[t][e]=(0,f.lh)(n,i,a)}for(let t=R.length;t<k.length;++t){const n=L[t-R.length];P[t-R.length].set(e,(0,f.J1)(s,n,a))}}T.setTag(r.TAGS.CELL_RENDERER,"html"),x.setTag(r.TAGS.CELL_RENDERER,"html");const F=O.aggregate(),G=F.rowCount,U=F.columns;let H=F.getCol(i);H.name=u.i6.CLUSTER,H.type!==r.COLUMN_TYPE.STRING&&(F.columns.replace(H,H.convertTo(r.COLUMN_TYPE.STRING)),H=F.getCol(H.name));const q=H.categories,B=U.addNewInt(u.i6.MEMBERS).getRawData(),Y=U.addNewString(u.i6.WEB_LOGO),$=U.addNewString(u.i6.DISTRIBUTION),j=U.addNewFloat(u.i6.MEAN_DIFFERENCE).getRawData(),W=U.addNewFloat(u.i6.P_VALUE).getRawData(),z=U.addNewFloat(u.i6.RATIO).getRawData(),K=L.map((t=>U.addNewString(t))),Q=new Array(G),Z=Array.from({length:G},(()=>new v.A(l,!1)));for(let t=0;t<l;++t){const n=g[h[t]];null===(e=Z[q.indexOf(n)])||void 0===e||e.setTrue(t)}for(let t=0;t<G;++t){const e=Z[t];if(e.allFalse)continue;const i=r.BitSet.fromBytes(e.buffer.buffer,l),a=o?(0,f.GT)(c,e):this.clusterStats[S.ORIGINAL][q[t]];for(let e=0;e<L.length;++e){const n=L[e];K[e].set(t,(0,f.J1)(s,n,i))}B[t]=a.count,Q[t]=i,j[t]=a.meanDifference,W[t]=null!==(n=a.pValue)&&void 0!==n?n:r.FLOAT_NULL,z[t]=a.ratio}Y.setTag(r.TAGS.CELL_RENDERER,"html"),$.setTag(r.TAGS.CELL_RENDERER,"html");const X=F.append(C);return this.bitsets=Q.concat(D),L.forEach((t=>X.col(t).semType="lst-pie-chart")),X}createLogoSummaryTableGrid(){const t=this.dataFrame.filter.anyFalse,e=t?this.getNeededDfClone():this.dataFrame,n=this.getTotalViewerAggColumns().map((([t,e])=>b(e,t))),i=this.logoSummaryTable.plot.grid();i.sort([u.i6.MEMBERS],[!1]),this.updateFilter(),i.col(u.i6.CLUSTER).visible=!0,i.columns.setOrder([u.i6.CLUSTER,u.i6.MEMBERS,u.i6.WEB_LOGO,...this.getStringAggregatedColumns(),u.i6.DISTRIBUTION,u.i6.MEAN_DIFFERENCE,u.i6.P_VALUE,u.i6.RATIO,...n]),i.columns.rowHeader.visible=!1,i.props.rowHeight=55;const o=new r.LruCache,s=new Map;let f=null;const h=new r.LruCache,m=this.positionColumns.length,g=i.columns.byName(u.i6.WEB_LOGO);g.cellType="html",g.width=350;const v=this.getScaledActivityColumn(t),y=e.getCol(this.sequenceColumnName);i.onCellRender.subscribe((t=>{var e,n,l;const g=t.cell,C=g.tableRowIndex;if(!g.isTableCell||null==C||-1===C)return;const w=t.g,A=t.bounds;w.save(),w.beginPath(),w.rect(A.x,A.y,A.width,A.height),w.clip();try{const b=Math.max(g.bounds.height-2,0),S=this.bitsets[C];if((null===(e=g.tableColumn)||void 0===e?void 0:e.name)===u.i6.CLUSTER)c.k8(w,g.cell.value,this.clusterSelection,A),t.preventDefault();else if((null===(n=g.tableColumn)||void 0===n?void 0:n.name)===u.i6.WEB_LOGO){const e=`${C}_${this.webLogoAggregationColumnName||"count"}_${this.webLogoAggregationType}_${this._webLogoCacheGeneration}`,n=o.get(e);if(!0===s.get(e))return void t.preventDefault();const l=Math.floor((g.bounds.width-2-4*(m-1))/m);if(void 0!==n){const e=n.getProperties();for(const t of e)"positionHeight"===t.name&&t.get(n)!==this.webLogoMode?t.set(n,this.webLogoMode):"positionWidth"===t.name&&t.get(n)!==l?t.set(n,l):"minHeight"===t.name&&t.get(n)!==b&&t.set(n,b);a()(n.root).css("height",`${b}px`).children().first().css("overflow-y","hidden !important"),n.root.style.height=`${b}px`,g.element=n.root,t.preventDefault()}else{const n=[y];if(this.webLogoAggregationType!==r.AGG.TOTAL_COUNT&&this.webLogoAggregationColumnName){const t=this.dataFrame.columns.byName(this.webLogoAggregationColumnName);t&&n.push(t)}const a=r.DataFrame.fromColumns(n);a.filter.copyFrom(S),s.set(e,!0),a.plot.fromType("WebLogo",{valueColumnName:this.webLogoAggregationColumnName,valueAggrType:this.webLogoAggregationType,positionHeight:this.webLogoMode,horizontalAlignment:d.P4.LEFT,maxHeight:1e3,minHeight:b,positionWidth:l,showPositionLabels:!1}).then((t=>{o.set(e,t),s.delete(e),f&&clearTimeout(f),f=setTimeout((()=>i.invalidate()),200)})),t.preventDefault()}}else if((null===(l=g.tableColumn)||void 0===l?void 0:l.name)===u.i6.DISTRIBUTION){let e=h.get(C);void 0===e&&(e=(0,p.FZ)(v,S).plot.histogram({filteringEnabled:!1,valueColumnName:v.name,splitColumnName:u.$2.SPLIT_COL,legendVisibility:"Never",showXAxis:!1,showColumnSelector:!1,showRangeSlider:!1,showBinSelector:!1,backColor:r.Color.toHtml(r.Color.white),xAxisHeight:1,showSplitSelector:!1}),e.root.style.width="auto",h.set(C,e)),e.root.style.height=`${b}px`,g.element=e.root,t.preventDefault()}}finally{w.restore()}})),i.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),r.debounce(i.onCurrentCellChanged,500).subscribe((t=>{var e;if(!t.isTableCell||-1===t.gridRow)return this.initClusterSelection({notify:!1}),this.model.fireBitsetChanged(l.q.LOGO_SUMMARY_TABLE),void i.invalidate();try{if(!this.keyPress||(null===(e=t.tableColumn)||void 0===e?void 0:e.name)!==u.i6.CLUSTER)return;null!==this.currentRowIndex&&-1!==this.currentRowIndex&&this.modifyClusterSelection(this.getCluster(i.cell(u.i6.CLUSTER,this.currentRowIndex)),{shiftPressed:!0,ctrlPressed:!0},!1),this.modifyClusterSelection(this.getCluster(t),{shiftPressed:!0,ctrlPressed:!1}),i.invalidate()}finally{this.keyPress=!1,this.currentRowIndex=t.gridRow}})),i.root.addEventListener("keydown",(t=>{if(this.keyPress=t.key.startsWith("Arrow"),!this.keyPress){if("Escape"===t.key||"KeyA"===t.code&&t.shiftKey&&t.ctrlKey)this.initClusterSelection({notify:!1});else if("KeyA"===t.code&&t.ctrlKey)for(let t=0;t<this.logoSummaryTable.rowCount;++t)this.modifyClusterSelection(this.getCluster(i.cell(u.i6.CLUSTER,t)),{shiftPressed:!0,ctrlPressed:!1},!1);this.model.fireBitsetChanged(l.q.LOGO_SUMMARY_TABLE),i.invalidate()}})),i.root.addEventListener("click",(t=>{var e;const n=i.hitTest(t.offsetX,t.offsetY);if(!n||!n.isTableCell||(null===(e=n.tableColumn)||void 0===e?void 0:e.name)!==u.i6.CLUSTER)return;const o=this.getCluster(n);this.modifyClusterSelection(o,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey}),i.invalidate()})),i.onCellTooltip(((t,e,n)=>{var i;if(!t.isTableCell)return this.model.unhighlight(),!0;const o=this.getCluster(t);return this.highlightCluster(o),(null===(i=t.tableColumn)||void 0===i?void 0:i.name)===u.i6.CLUSTER&&this.showTooltip(o,e,n),!0}));const C=i.props;return C.allowEdit=!1,C.allowRowSelection=!1,C.allowBlockSelection=!1,C.allowColSelection=!1,C.showCurrentRowIndicator=!1,C.showReadOnlyNotifications=!1,i}highlightCluster(t){const e=this.clusterStats[t.positionOrClusterType][t.monomerOrCluster].mask;this.dataFrame.rows.highlight((t=>e.getBit(t))),this.model.isHighlighting=!0}getCluster(t){const e=this.logoSummaryTable.get(u.i6.CLUSTER,t.tableRowIndex);return{positionOrClusterType:this.dataFrame.getCol(this.clustersColumnName).categories.includes(e)?S.ORIGINAL:S.CUSTOM,monomerOrCluster:e}}updateFilter(){const t=this.logoSummaryTable.getCol(u.i6.MEMBERS),e=this.logoSummaryTable.getCol(u.i6.CLUSTER),n=e.getRawData(),i=e.categories,o=i.indexOf("-1"),r=t.getRawData();let s=0;r.forEach(((t,e)=>{"-1"!==i[n[e]]&&(s=Math.max(s,r[e]))}));const a=Math.ceil(s*this.membersRatioThreshold);this.logoSummaryTable.filter.init((t=>r[t]>a&&(-1===o||"-1"!==i[n[t]])))}clusterFromSelection(){const t=this.model.getVisibleSelection(),e=this.logoSummaryTable.columns,n=e.length,i=new Array(e.length),o=this.getScaledActivityColumn(),r=v.A.fromString(t.toBinaryString()),s=(0,f.GT)(o.getRawData(),r);this.bitsets.push(t.clone());const a=this.dataFrame.columns.getUnusedName("New Cluster"),l={},c={},d=this.getTotalViewerAggColumns(),h=this.getStringAggregatedColumns();for(const[e,n]of d){const i=b(n,e),o=this.dataFrame.getCol(e);l[i]=(0,f.lh)(o,n,t)}for(const e of h)c[e]=(0,f.J1)(this.dataFrame,e,t);for(let o=0;o<n;++o){const n=e.byIndex(o);i[o]=n.name===u.i6.CLUSTER?a:n.name===u.i6.MEMBERS?t.trueCount:n.name===u.i6.WEB_LOGO||n.name===u.i6.DISTRIBUTION?null:n.name===u.i6.MEAN_DIFFERENCE?s.meanDifference:n.name===u.i6.P_VALUE?s.pValue:n.name===u.i6.RATIO?s.ratio:n.name in l?l[n.name]:n.name in c?c[n.name]:void 0,void 0===i[o]&&y._package.logger.warning(`PeptidesLSTWarn: value for column ${n.name} is undefined`)}this.logoSummaryTable.rows.addNew(i),this.clusterStats[S.CUSTOM][a]=s,this.addNewCluster(a)}removeCluster(){const t=this.clusterSelection[S.CUSTOM];if(0===t.length)return void o.shell.warning("No custom clusters selected to be removed");const e=this.logoSummaryTable.rows,n=this.logoSummaryTable.getCol(u.i6.CLUSTER),i=n.categories,r=this.dataFrame.columns;for(const n of t){t.splice(t.indexOf(n),1),r.remove(n),delete this.clusterStats[S.CUSTOM][n];const o=i.indexOf(n);e.removeAt(o),this.bitsets.splice(o,1)}n.compact(),this.clusterSelection[S.CUSTOM]=t,this.render()}addNewCluster(t){const e=r.Column.fromBitSet(t,this.model.getVisibleSelection());e.setTag(u.gp.CUSTOM_CLUSTER,"1"),e.setTag(u.gp.ANALYSIS_COL,"true"),this.dataFrame.columns.add(e),this.model.analysisView.grid.col(e.name).visible=!1}modifyClusterSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.clusterSelection=(0,p.vW)(this.clusterSelection,t,e):this._clusterSelection=(0,p.vW)(this.clusterSelection,t,e)}showTooltip(t,e,n){const o=this.dataFrame.filter,s=o.anyFalse?this.getNeededDfClone():this.dataFrame,a=s.rowCount,l=new v.A(a,!1),u=this.getScaledActivityColumn(o.anyFalse),c=u.getRawData();if(t.positionOrClusterType===S.ORIGINAL){const e=s.getCol(this.clustersColumnName),n=e.getRawData(),i=e.categories.indexOf(t.monomerOrCluster);for(let t=0;t<a;++t)n[t]===i&&l.setTrue(t);l.incrementVersion()}else{const e=s.getCol(t.monomerOrCluster);l.buffer=e.getRawData()}const d=o.anyFalse?(0,f.GT)(c,l):this.clusterStats[t.positionOrClusterType][t.monomerOrCluster];if(!d.count)return null;const h=r.BitSet.fromBytes(l.buffer.buffer,a),m=(0,p.FZ)(u,h),y=(0,g.M1)(m,!0),C=(0,g.QD)(d),w=(0,f.I_)(this.dataFrame,this.getTotalViewerAggColumns(),{filterDf:!0,mask:h}),A=Object.assign(Object.assign({},C),w),b=(0,p.F2)(y,A);return i.tooltip.show(b,e,n),b}createWebLogoDf(t,e){const n=r.DataFrame.fromColumns([t]);return n.filter.copyFrom(e),n}}},3541:(t,e,n)=>{"use strict";n.d(e,{J:()=>_,UJ:()=>M,ds:()=>i,xN:()=>N});var i,o,r,s,a=n(4328),l=n(7389),u=n(6082),c=n(7233),d=n.n(c),f=n(4139),h=n(3163),m=n(9499),g=n(144),p=n.n(g),v=n(5070),y=n(912),C=n(3657),w=n(8608),A=n(3077),b=n(439),S=n(2003),E=n(4971),T=n(726),x=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};!function(t){t.MUTATION_CLIFFS="Mutation Cliffs",t.INVARIANT_MAP="Invariant Map"}(i||(i={})),function(t){t.SEQUENCE="sequence",t.ACTIVITY="activity",t.ACTIVITY_SCALING="activityScaling",t.TARGET="target",t.TARGET_CATEGORY="targetCategory",t.MIN_ACTIVITY_DELTA="minActivityDelta",t.MAX_MUTATIONS="maxMutations",t.COLUMNS="columns",t.AGGREGATION="aggregation",t.ACTIVITY_TARGET="activityTarget",t.VALUE_INVARIANT_MAP="value",t.AGGREGATION_INVARIANT_MAP_VALUE="valueAggregation"}(o||(o={})),function(t){t.COLOR="color",t.COLOR_AGGREGATION="colorAggregation",t.CUSTOM_COLOR_RANGE="customColorRange",t.MIN_COLOR_VALUE="minColorValue",t.MAX_COLOR_VALUE="maxColorValue",t.LOWER_BOUND_COLOR="lowerBoundColor",t.MIDDLE_COLOR="middleColor",t.UPPER_BOUND_COLOR="upperBoundColor",t.LOG_SCALE_COLOR="logScaleColor",t.SHOW_FILTER_CONTROLS="showFilterControls"}(r||(r={})),function(t){t.GENERAL="General",t.INVARIANT_MAP="Invariant Map",t.MUTATION_CLIFFS="Mutation Cliffs",t.AGGREGATION="Aggregation"}(s||(s={}));class N extends u.JsViewer{constructor(){super(),this.keyPressed=!1,this._scaledActivityColumn=null,this.doRender=!0,this._viewerGrid=null,this._positionColumns=null,this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._invariantMapSelection=null,this._mutationCliffsSelection=null,this._monomerMetaColumns=new Set,this.sequenceColumnName=this.column(o.SEQUENCE,{category:s.GENERAL,semType:u.SEMTYPE.MACROMOLECULE,nullable:!1}),this.activityColumnName=this.column(o.ACTIVITY,{category:s.GENERAL,nullable:!1}),this.activityScaling=this.string(o.ACTIVITY_SCALING,f.rg.NONE,{category:s.GENERAL,choices:Object.values(f.rg),nullable:!1}),this.activityTarget=this.string(o.ACTIVITY_TARGET,f.wf.HIGH,{category:s.GENERAL,choices:Object.values(f.wf),nullable:!1}),this.targetColumnName=this.column(o.TARGET,{category:s.GENERAL,nullable:!0,columnTypeFilter:"categorical",userEditable:!0}),this.minActivityDelta=this.float(o.MIN_ACTIVITY_DELTA,0,{category:s.MUTATION_CLIFFS,min:0,max:100}),this.maxMutations=this.int(o.MAX_MUTATIONS,1,{category:s.MUTATION_CLIFFS,min:1,max:20}),this.columns=this.columnList(o.COLUMNS,[],{category:s.AGGREGATION}),this.aggregation=this.string(o.AGGREGATION,u.AGG.AVG,{category:s.AGGREGATION,choices:f.V5}),this.valueColumnName=this.column(o.VALUE_INVARIANT_MAP,{category:s.INVARIANT_MAP,userEditable:!0,nullable:!1,columnTypeFilter:"numerical"}),this.valueAggregation=this.string(o.AGGREGATION_INVARIANT_MAP_VALUE,u.AGG.TOTAL_COUNT,{category:s.INVARIANT_MAP,choices:f.V5,userEditable:!0,nullable:!1}),this.mutationCliffsDebouncer=(0,w.sg)(((t,e,n)=>x(this,void 0,void 0,(function*(){return yield(0,C.uz)(t,e,n)})))),this.targetCategoryInput=l.input.choice("Category",{value:null,items:[],nullable:!0,onValueChanged:()=>{var t;this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._invariantMapSelection=null,this.doRender=!1,this._monomerPositionStats=null,null===(t=this.positionColumns)||void 0===t||t.forEach((t=>{t.temp[f.gp.INVARIANT_MAP_COLOR_CACHE]=null})),this.sequenceColumnName&&this.activityColumnName&&this.calculateMutationCliffs().then((t=>{this.mutationCliffs=t.cliffs,this.cliffStats=t.cliffStats})),this.viewerGrid.invalidate()}}),this.targetCategoryInput.root.style.display="none",this.targetCategoryInput.root.style.maxWidth="50%",this.targetCategoryInput.root.style.marginLeft="8px"}get viewerGrid(){var t;return null!==(t=this._viewerGrid)&&void 0!==t||(this._viewerGrid=this.createViewerGrid()),this._viewerGrid}render(){}get alphabet(){var t;return null!==(t=this.dataFrame.getCol(this.sequenceColumnName).getTag(b.gp.alphabet))&&void 0!==t?t:S.YI.UN}get model(){return m.i.getInstance(this.dataFrame)}get positionColumns(){var t,e,n;if(null!=this._positionColumns)return this._positionColumns;const i=t=>{const e=this.model.findViewer(t);return this.sequenceColumnName===(null==e?void 0:e.sequenceColumnName)?e._positionColumns:null};return null!=this.model.positionColumns&&this.sequenceColumnName===(null===(t=this.model.settings)||void 0===t?void 0:t.sequenceColumnName)?this._positionColumns=this.model.positionColumns:this instanceof _?this._positionColumns=i(m.q.MOST_POTENT_RESIDUES):this instanceof M&&(this._positionColumns=i(m.q.SEQUENCE_VARIABILITY_MAP)),null!==(e=this._positionColumns)&&void 0!==e||(this._positionColumns=null!==(n=i(m.q.LOGO_SUMMARY_TABLE))&&void 0!==n?n:(0,A.R)(this.dataFrame.getCol(this.sequenceColumnName),T.Z.getSeqHelper()).columns.toList()),this._positionColumns}get monomerPositionStats(){var t;if(null!=this._monomerPositionStats)return this._monomerPositionStats;const e=t=>{var e,n,i;return!(this.sequenceColumnName!==(null==t?void 0:t.sequenceColumnName)||this.activityColumnName!==(null==t?void 0:t.activityColumnName)||this.activityScaling!==(null==t?void 0:t.activityScaling)||!(t instanceof N&&this.targetColumnName==(null==t?void 0:t.targetColumnName)&&(null===(e=this.targetCategoryInput)||void 0===e?void 0:e.value)===(null===(n=null==t?void 0:t.targetCategoryInput)||void 0===n?void 0:n.value))&&(t instanceof N||null!=this.targetColumnName&&null!=(null===(i=this.targetCategoryInput)||void 0===i?void 0:i.value))||!(t instanceof N&&this.valueColumnName==(null==t?void 0:t.valueColumnName)&&this.valueAggregation==(null==t?void 0:t.valueAggregation))&&(t instanceof N||this.valueColumnName&&this.valueAggregation&&this.valueAggregation!=u.AGG.VALUE_COUNT&&this.valueAggregation!=u.AGG.TOTAL_COUNT))},n=t=>{const n=this.model.findViewer(t);return e(n)?n._monomerPositionStats:null};null!==this.model.monomerPositionStats&&e(this.model.settings)?this._monomerPositionStats=this.model.monomerPositionStats:this instanceof _?this._monomerPositionStats=n(m.q.MOST_POTENT_RESIDUES):this instanceof M&&(this._monomerPositionStats=n(m.q.SEQUENCE_VARIABILITY_MAP));const i=this.targetColumnName?this.dataFrame.col(this.targetColumnName):null,o=this.targetCategoryInput.value,r=this.dataFrame.col(this.valueColumnName),s=this.valueAggregation;return null!==(t=this._monomerPositionStats)&&void 0!==t||(this._monomerPositionStats=(0,C.Ej)(this.getScaledActivityColumn(),this.dataFrame.filter,this.positionColumns,{target:i&&o?{col:i,cat:o}:void 0,aggValue:s&&r?{col:r,type:s}:void 0})),this._monomerPositionStats}get mutationCliffs(){if(null!=this._mutationCliffs)return this._mutationCliffs;const t=t=>{const e=this.model.findViewer(t);return i=e,(n=this).sequenceColumnName===(null==i?void 0:i.sequenceColumnName)&&n.activityColumnName===i.activityColumnName&&n.activityScaling===i.activityScaling&&n.targetColumnName===(null==i?void 0:i.targetColumnName)&&(null===(o=n.targetCategoryInput)||void 0===o?void 0:o.value)===(null===(r=null==i?void 0:i.targetCategoryInput)||void 0===r?void 0:r.value)&&n.minActivityDelta===(null==i?void 0:i.minActivityDelta)&&n.maxMutations===(null==i?void 0:i.maxMutations)?e._mutationCliffs:null;var n,i,o,r};return this instanceof _?this._mutationCliffs=t(m.q.MOST_POTENT_RESIDUES):this instanceof M&&(this._mutationCliffs=t(m.q.SEQUENCE_VARIABILITY_MAP)),this._mutationCliffs}set mutationCliffs(t){this._mutationCliffs=t,this.viewerGrid.invalidate()}get cliffStats(){if(!this._mutationCliffStats&&this.mutationCliffs&&this.activityColumnName&&this.sequenceColumnName&&this.dataFrame.col(this.activityColumnName)){const t=this.dataFrame.col(this.activityColumnName).getRawData();this._mutationCliffStats=(0,C.Lw)(this.mutationCliffs,t)}return this._mutationCliffStats}set cliffStats(t){this._mutationCliffStats=t,this.viewerGrid.invalidate}get mutationCliffsSelection(){var t;const e=this instanceof _?f.YX.MP:f.YX.MPR,n=this.dataFrame.getTag(`${e}${f.gp.MUTATION_CLIFFS_SELECTION}`);return null!==(t=this._mutationCliffsSelection)&&void 0!==t||(this._mutationCliffsSelection=null===n?(0,w.ZR)(this.positionColumns):JSON.parse(n)),this._mutationCliffsSelection}set mutationCliffsSelection(t){this._mutationCliffsSelection=t;const e=this instanceof _?f.YX.MP:f.YX.MPR;this.dataFrame.setTag(`${e}${f.gp.MUTATION_CLIFFS_SELECTION}`,JSON.stringify(t)),this.model.fireBitsetChanged(this instanceof _?m.q.SEQUENCE_VARIABILITY_MAP:m.q.MOST_POTENT_RESIDUES);const n=this.model.findViewer(m.q.SEQUENCE_VARIABILITY_MAP);null==n||n.viewerGrid.invalidate();const i=this.model.findViewer(m.q.MOST_POTENT_RESIDUES);null==i||i.viewerGrid.invalidate(),this.model.analysisView.grid.invalidate()}getScaledActivityColumn(t=!1){var e,n,i;return(null===(e=this.model.settings)||void 0===e?void 0:e.activityColumnName)===this.activityColumnName&&(null===(n=this.model.settings)||void 0===n?void 0:n.activityScaling)===this.activityScaling&&(this._scaledActivityColumn=this.model.getScaledActivityColumn(t)),null!==(i=this._scaledActivityColumn)&&void 0!==i||(this._scaledActivityColumn=(0,w.Y1)(this.dataFrame.getCol(this.activityColumnName),this.activityScaling)),t?u.DataFrame.fromColumns([this._scaledActivityColumn]).clone(this.dataFrame.filter).getCol(this._scaledActivityColumn.name):this._scaledActivityColumn}modifyMutationCliffsSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.mutationCliffsSelection=(0,w.vW)(this.mutationCliffsSelection,t,e):this._mutationCliffsSelection=(0,w.vW)(this.mutationCliffsSelection,t,e)}modifyInvariantMapSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.invariantMapSelection=(0,w.vW)(this.invariantMapSelection,t,e):this._invariantMapSelection=(0,w.vW)(this.invariantMapSelection,t,e)}get invariantMapSelection(){var t;const e=this.dataFrame.getTag(`${f.YX.MP}${f.gp.INVARIANT_MAP_SELECTION}`);return null!==(t=this._invariantMapSelection)&&void 0!==t||(this._invariantMapSelection=null===e?(0,w.ZR)(this.positionColumns):JSON.parse(e)),this._invariantMapSelection}set invariantMapSelection(t){this._invariantMapSelection=t,this.dataFrame.setTag(`${f.YX.MP}${f.gp.INVARIANT_MAP_SELECTION}`,JSON.stringify(t)),this.model.fireBitsetChanged(m.q.SEQUENCE_VARIABILITY_MAP),this.model.analysisView.grid.invalidate()}resetTargetCategoryValue(){var t;const e=this.targetColumnName,n=e?this.dataFrame.col(e):null;this.targetCategoryInput.items=null!==(t=null==n?void 0:n.categories)&&void 0!==t?t:[],this.targetCategoryInput.value=null,this.targetCategoryInput.root.style.display=e?"flex":"none"}onPropertyChanged(t){switch(super.onPropertyChanged(t),this.doRender=!0,t.name){case`${o.SEQUENCE}${f.To}`:this._positionColumns=null,this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._viewerGrid=null;break;case`${o.ACTIVITY}${f.To}`:case o.ACTIVITY_SCALING:this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._viewerGrid=null,this._scaledActivityColumn=null;break;case`${o.VALUE_INVARIANT_MAP}${f.To}`:case o.AGGREGATION_INVARIANT_MAP_VALUE:this._monomerPositionStats=null,this._viewerGrid=null,this._invariantMapSelection=null;break;case o.MIN_ACTIVITY_DELTA:case o.MAX_MUTATIONS:this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this.doRender=!1;break;case o.COLUMNS:case o.AGGREGATION:this instanceof M&&(this._viewerGrid=null);break;case o.ACTIVITY_TARGET:(this instanceof M||this instanceof _)&&(this._viewerGrid=null)}null===this._mutationCliffs&&this.sequenceColumnName&&this.activityColumnName&&this.dataFrame&&this.calculateMutationCliffs().then((t=>{this.mutationCliffs=t.cliffs,this.cliffStats=t.cliffStats})),t.name===`${o.TARGET}${f.To}`&&this.targetColumnInput&&(this.targetColumnInput.value=this.targetColumnName?this.dataFrame.col(this.targetColumnName):null,this.resetTargetCategoryValue())}getAggregationColumns(){return Object.fromEntries(this.columns.map((t=>[t,this.aggregation])).filter((([t,e])=>this.model.df.columns.contains(t)&&this.model.df.col(t).matches("numerical"))))}getTotalViewerAggColumns(){var t,e;const n=this.getAggregationColumns();return(0,w.zm)(this.model.df,this.columns,n,null===(e=null===(t=this.model)||void 0===t?void 0:t.settings)||void 0===e?void 0:e.columns)}createViewerGrid(){throw new Error("Not implemented")}detach(){this.subs.forEach((t=>t.unsubscribe()))}onTableAttached(){var t,e,n;if(super.onTableAttached(),(0,w.B2)(this.dataFrame))null===(t=this.getProperty(`${o.SEQUENCE}${f.To}`))||void 0===t||t.set(this,this.dataFrame.columns.bySemType(u.SEMTYPE.MACROMOLECULE).name),null===(e=this.getProperty(`${o.ACTIVITY}${f.To}`))||void 0===e||e.set(this,p()(this.dataFrame.columns.numerical).next().value.name),null===(n=this.getProperty(`${o.VALUE_INVARIANT_MAP}${f.To}`))||void 0===n||n.set(this,p()(this.dataFrame.columns.numerical).next().value.name),null===this.mutationCliffs&&this.sequenceColumnName&&this.activityColumnName&&this.calculateMutationCliffs().then((t=>{this.mutationCliffs=t.cliffs,this.cliffStats=t.cliffStats})),this.subs.push(a.events.onContextMenu.subscribe((t=>{if(!(t&&t.causedBy&&t.args&&t.args.menu&&t.causedBy.target&&t.causedBy.target instanceof HTMLElement&&this.root.contains(t.causedBy.target)))return;const e=t.args.menu;(0,E.pj)().then((t=>{const n=t.getMonomerLib(),i=n.getMonomerSymbolsByType("PEPTIDE").map((t=>n.getMonomer("PEPTIDE",t))).filter(Boolean).map((t=>{var e;return null!==(e=t.meta)&&void 0!==e?e:{}})),o=new Set;i.forEach((t=>Object.keys(t).forEach((t=>o.add(t))))),o.delete("colors"),e.group("Monomer Meta").items(Array.from(o),(t=>{this._monomerMetaColumns.has(t)?this._monomerMetaColumns.delete(t):this._monomerMetaColumns.add(t),this._viewerGrid=null,this.render()}),{isChecked:t=>this._monomerMetaColumns.has(t)})}))})));else{const t="PeptidesError: dataframe is missing Macromolecule or numeric columns";a.log.error(t),a.shell.warning(t)}}calculateMutationCliffs(){return x(this,void 0,void 0,(function*(){const t=this.dataFrame.getCol(this.activityColumnName),e=this.positionColumns.map(w.eY),n=this.targetColumnName?(0,w.eY)(this.dataFrame.getCol(this.targetColumnName)):null,i={maxMutations:this.maxMutations,minActivityDelta:this.minActivityDelta,targetCol:n,currentTarget:this.targetCategoryInput.value},o=t.getRawData(),r=yield this.mutationCliffsDebouncer(o,e,i);return{cliffs:r,cliffStats:(0,C.Lw)(r,o)}}))}}class _ extends N{constructor(){super(),this.currentGridCell=null,this.customColorRange=!1,this.minColorValue=0,this.maxColorValue=0,this.logScaleColor=!1,this.showFilterControls=!0,this.colorColumnName=this.column(r.COLOR,{category:s.INVARIANT_MAP,nullable:!1,columnTypeFilter:"numerical"}),this.colorAggregation=this.string(r.COLOR_AGGREGATION,u.AGG.AVG,{category:s.INVARIANT_MAP,choices:f.V5}),this.lowerBoundColor=this.int(r.LOWER_BOUND_COLOR,4278190335,{category:s.INVARIANT_MAP,editor:"color"}),this.middleColor=this.int(r.MIDDLE_COLOR,4294967295,{category:s.INVARIANT_MAP,editor:"color"}),this.upperBoundColor=this.int(r.UPPER_BOUND_COLOR,4294901760,{category:s.INVARIANT_MAP,editor:"color"}),this.logScaleColor=this.bool(r.LOG_SCALE_COLOR,!1,{category:s.INVARIANT_MAP}),this.customColorRange=this.bool(r.CUSTOM_COLOR_RANGE,!1,{category:s.INVARIANT_MAP}),this.minColorValue=this.float(r.MIN_COLOR_VALUE,0,{category:s.INVARIANT_MAP}),this.maxColorValue=this.float(r.MAX_COLOR_VALUE,0,{category:s.INVARIANT_MAP}),this.showFilterControls=this.bool(r.SHOW_FILTER_CONTROLS,!0,{category:s.GENERAL,description:"Show monomer search and target controls"}),this.monomerSearchInput=l.input.string("Search",{value:"",nullable:!0,placeholder:"Search monomer",tooltipText:"Search for monomer by symbol. For multiple monomers use comma as a separator.",onValueChanged:()=>{var t,e,n;const i=()=>{var t,e,n;return null===(n=null===(e=null===(t=this._viewerGrid)||void 0===t?void 0:t.dataFrame)||void 0===e?void 0:e.filter)||void 0===n?void 0:n.setAll(!0)},o=null!==(n=null===(e=null===(t=this.monomerSearchInput.value)||void 0===t?void 0:t.trim())||void 0===e?void 0:e.toLowerCase())&&void 0!==n?n:"";if(!o||null==this._viewerGrid||null==this._viewerGrid.dataFrame)return void i();const r=this._viewerGrid.dataFrame.col(f.$2.MONOMER);if(null==r)return void i();const s=o.split(",").map((t=>t.trim())).filter((t=>!!t)),a=r.toList();this._viewerGrid.dataFrame.filter.init((t=>s.some((e=>a[t].toLowerCase().includes(e)))))}})}get name(){return m.q.SEQUENCE_VARIABILITY_MAP}get mode(){var t;return null!==(t=this.dataFrame.getTag(f.gp.MONOMER_POSITION_MODE))&&void 0!==t?t:i.MUTATION_CLIFFS}set mode(t){this.dataFrame.setTag(f.gp.MONOMER_POSITION_MODE,t),this.viewerGrid.invalidate()}onTableAttached(){var t;if(super.onTableAttached(),(0,w.B2)(this.dataFrame))null===(t=this.getProperty(`${r.COLOR}${f.To}`))||void 0===t||t.set(this,this.activityColumnName),this.targetColumnInput=l.input.column("Target",{value:void 0,nullable:!0,table:this.dataFrame,filter:t=>t.isCategorical,onValueChanged:t=>{var e,n;const i=this.getProperty(`${o.TARGET}${f.To}`);i&&i.get(this)!=(null!==(e=null==t?void 0:t.name)&&void 0!==e?e:null)&&(null==i||i.set(this,null!==(n=null==t?void 0:t.name)&&void 0!==n?n:null))}});else{const t="PeptidesError: dataframe is missing Macromolecule or numeric columns";a.log.error(t),a.shell.warning(t)}this.render()}onPropertyChanged(t){var e;super.onPropertyChanged(t),t.name===o.SEQUENCE&&(this._invariantMapSelection=null),null===(e=this.positionColumns)||void 0===e||e.forEach((t=>{t.temp[f.gp.INVARIANT_MAP_COLOR_CACHE]=null})),this.doRender?this.render():this.viewerGrid.invalidate()}createMonomerPositionDf(){const t=new Set,e=this.positionColumns;for(const n of e){const e=n.categories;for(const n of e)""!==n&&t.add(n)}const n=Array.from(t),i=u.Column.fromStrings(f.$2.MONOMER,n),o=u.DataFrame.fromColumns([i]),r=(0,E.pj)().then((t=>{const e=t.getMonomerLib();return e?n.map((t=>{var n,i;return null!==(i=null===(n=e.getMonomer("PEPTIDE",t))||void 0===n?void 0:n.meta)&&void 0!==i?i:{}})):n.map((t=>({})))}));this._monomerMetaColumns.forEach((t=>{const e=o.columns.addNewString(t);r.then((n=>{e.init((e=>{var i,o;return null!==(o=null===(i=n[e][t])||void 0===i?void 0:i.toString())&&void 0!==o?o:""}))}))})),o.name="SAR";for(const t of e)o.columns.addNewBool(t.name);return o}cacheInvariantMapColors(){if(this.colorColumnName&&this.dataFrame.col(this.colorColumnName)){const t=this.dataFrame.getCol(this.colorColumnName).getRawData();let e=9999999,n=-9999999;const i=this.targetColumnName?this.dataFrame.col(this.targetColumnName):null,o=null==i?void 0:i.getRawData(),r=this.targetCategoryInput.value,s=null==r?null:null==i?void 0:i.categories.indexOf(r);for(const i of this.positionColumns){i.temp[f.gp.INVARIANT_MAP_COLOR_CACHE]={};const r=i.temp[f.gp.INVARIANT_MAP_COLOR_CACHE],a=i.name,l=i.getRawData(),c=i.categories;if(!this.monomerPositionStats[a])continue;const d=this.monomerPositionStats[a];for(const a of Object.keys(d)){if("general"===a)continue;const d=[];for(let t=0;t<i.length;++t){const e=c[l[t]]===a,n=!o||null==s||-1==s||o[t]===s;e&&n&&d.push(t)}const f=u.Column.float("color",d.length).init((e=>t[d[e]])).aggregate(this.colorAggregation);r[a]=f,e=Math.min(e,f),n=Math.max(n,f)}i.temp[f.gp.INVARIANT_MAP_COLOR_CACHE]=r}const a=this.customColorRange&&null!=this.minColorValue&&null!=this.maxColorValue;let l=a?this.minColorValue:e,c=a?this.maxColorValue:n;const d=this.logScaleColor&&l>1e-30&&c>1e-30&&e>1e-30&&n>1e-30;d&&(l=Math.log(l),c=Math.log(c));for(const t of this.positionColumns){const i=t.temp[f.gp.INVARIANT_MAP_COLOR_CACHE];if(i){for(const t of Object.keys(i))this.activityTarget===f.wf.LOW&&(i[t]=c-i[t]+l),i[t]=u.Color.scaleColor(d?Math.log(i[t]):i[t],l,c,void 0,[this.lowerBoundColor,this.middleColor,this.upperBoundColor]);t.temp[f.gp.INVARIANT_MAP_COLOR_CACHE]=i,t.temp[f.gp.INVARIANT_MAP_COLOR_MIN_CACHE]=e,t.temp[f.gp.INVARIANT_MAP_COLOR_MAX_CACHE]=n}}}}createViewerGrid(){const t=this.createMonomerPositionDf(),e=t.plot.grid();e.sort([f.$2.MONOMER]);const n=this.positionColumns.map((t=>t.name));e.columns.setOrder([f.$2.MONOMER,...this._monomerMetaColumns,...n]);const o=t.getCol(f.$2.MONOMER);h.rI(o,this.alphabet,!0),this.cacheInvariantMapColors(),e.onCellRender.subscribe((t=>O(t,this,this.mode===i.INVARIANT_MAP,this.dataFrame.getCol(this.colorColumnName),this.colorAggregation))),e.onCellTooltip(((t,e,n)=>{var o,r,s,a,l;if(!t.isTableCell||!(null===(o=null==t?void 0:t.cell.column)||void 0===o?void 0:o.name)||this._monomerMetaColumns.has(t.cell.column.name))return this.model.unhighlight(),!0;const c=this.getMonomerPosition(t);(0,w.dl)(c,this.dataFrame,this.monomerPositionStats),this.model.isHighlighting=!0;const d=this.getTotalViewerAggColumns(),f={},h={};if(this.mode===i.INVARIANT_MAP)this.colorColumnName&&this.colorAggregation&&this.colorColumnName!==this.valueColumnName?(d.unshift([this.colorColumnName,this.colorAggregation]),f[`${this.colorAggregation}(${this.colorColumnName})`]=" (color)"):this.colorColumnName&&this.colorAggregation&&this.colorColumnName===this.valueColumnName&&(f["Mean activity"]=" (color)"),this.valueColumnName&&this.valueAggregation&&this.valueAggregation!==u.AGG.VALUE_COUNT&&this.valueAggregation!==u.AGG.TOTAL_COUNT&&d.unshift([this.valueColumnName,this.valueAggregation]);else{const t=null===(s=null===(r=this.mutationCliffs)||void 0===r?void 0:r.get(c.monomerOrCluster))||void 0===s?void 0:s.get(c.positionOrClusterType);if(t){let e=0;for(const n of t.values())e+=n.length;h["Pairs count"]=e.toString()}}return(0,y.D)(this.model.df,this.getScaledActivityColumn(),d,{fromViewer:!0,isMutationCliffs:this.mode===i.MUTATION_CLIFFS,monomerPosition:c,x:e,y:n,mpStats:this.monomerPositionStats,cliffStats:null!==(l=null===(a=this.cliffStats)||void 0===a?void 0:a.stats)&&void 0!==l?l:void 0,postfixes:f,additionalStats:h})})),e.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),u.debounce(e.onCurrentCellChanged,500).subscribe((t=>{var n,o,r,s,a,l,c,d,f;try{if(!t||!t.dart||!(null===(o=null===(n=null==t?void 0:t.cell)||void 0===n?void 0:n.column)||void 0===o?void 0:o.name)||this._monomerMetaColumns.has(t.cell.column.name))return;if(-1===t.gridRow&&(this.mode===i.INVARIANT_MAP?this._invariantMapSelection=(0,w.ZR)(this.positionColumns):this._mutationCliffsSelection=(0,w.ZR)(this.positionColumns),this.model.fireBitsetChanged(m.q.SEQUENCE_VARIABILITY_MAP),e.invalidate()),!this.keyPressed)return;if(null!==this.currentGridCell){const t=this.getMonomerPosition(this.currentGridCell);this.mode===i.INVARIANT_MAP?this.modifyInvariantMapSelection(t,{shiftPressed:!0,ctrlPressed:!0},!1):(null===(a=null===(s=null===(r=this.mutationCliffs)||void 0===r?void 0:r.get(t.monomerOrCluster))||void 0===s?void 0:s.get(t.positionOrClusterType))||void 0===a?void 0:a.size)&&this.modifyMutationCliffsSelection(t,{shiftPressed:!0,ctrlPressed:!0},!1)}const u=this.getMonomerPosition(t);this.mode===i.INVARIANT_MAP?this.modifyInvariantMapSelection(u,{shiftPressed:!0,ctrlPressed:!1},!0):(null===(d=null===(c=null===(l=this.mutationCliffs)||void 0===l?void 0:l.get(u.monomerOrCluster))||void 0===c?void 0:c.get(u.positionOrClusterType))||void 0===d?void 0:d.size)&&this.modifyMutationCliffsSelection(u,{shiftPressed:!0,ctrlPressed:!1},!0),e.invalidate(),setTimeout((()=>null==e?void 0:e.invalidate()),300)}finally{this.keyPressed=!1,(null===(f=t.tableColumn)||void 0===f?void 0:f.name)&&t.grid?this.currentGridCell=u.GridCell.fromColumnRow(t.grid,t.tableColumn.name,t.gridRow):this.currentGridCell=null}})),e.root.addEventListener("keydown",(t=>{if(this.keyPressed=t.key.startsWith("Arrow"),!this.keyPressed){if("Escape"===t.key||"KeyA"===t.code&&t.ctrlKey&&t.shiftKey)this.mode===i.INVARIANT_MAP?this._invariantMapSelection=(0,w.ZR)(this.positionColumns):this._mutationCliffsSelection=(0,w.ZR)(this.positionColumns);else{if("KeyA"!==t.code||!t.ctrlKey)return;{const t=Object.keys(this.monomerPositionStats).filter((t=>"general"!==t));for(const e of t){const t=Object.keys(this.monomerPositionStats[e]).filter((t=>"general"!==t));for(const n of t){const t={monomerOrCluster:n,positionOrClusterType:e};this.mode===i.INVARIANT_MAP?this.modifyInvariantMapSelection(t,{shiftPressed:!0,ctrlPressed:!1},!1):this.modifyMutationCliffsSelection(t,{shiftPressed:!0,ctrlPressed:!1},!1)}}}}this.model.fireBitsetChanged(m.q.SEQUENCE_VARIABILITY_MAP),e.invalidate()}})),e.root.addEventListener("click",(n=>{var o,r,s,a,l;const u=e.hitTest(n.offsetX,n.offsetY);if(!(null==u?void 0:u.isTableCell)||(null===(o=null==u?void 0:u.tableColumn)||void 0===o?void 0:o.name)===f.$2.MONOMER||(null===(r=null==u?void 0:u.tableColumn)||void 0===r?void 0:r.name)&&this._monomerMetaColumns.has(u.tableColumn.name))return;const c=this.getMonomerPosition(u);this.mode===i.INVARIANT_MAP?(this.modifyInvariantMapSelection(c,{shiftPressed:n.shiftKey,ctrlPressed:n.ctrlKey}),(0,w.CD)(this.invariantMapSelection)&&(t.currentRowIdx=-1)):(null===(l=null===(a=null===(s=this.mutationCliffs)||void 0===s?void 0:s.get(c.monomerOrCluster))||void 0===a?void 0:a.get(c.positionOrClusterType))||void 0===l?void 0:l.size)&&this.modifyMutationCliffsSelection(c,{shiftPressed:n.shiftKey,ctrlPressed:n.ctrlKey}),e.invalidate()})),I(e);const r=e.onAfterDrawContent.subscribe((()=>{const t=e.col(f.$2.MONOMER);if(40!==t.width){t.width=40;for(const t of n)e.col(t).width=40}else r.unsubscribe()}));return e}getMonomerPosition(t){return{monomerOrCluster:t.cell.dataFrame.get(f.$2.MONOMER,t.tableRowIndex),positionOrClusterType:t.tableColumn.name}}render(){var t,e,n;if(d()(this.root).empty(),!this.activityColumnName||!this.sequenceColumnName)return void this.root.appendChild(l.divText("Please, select a sequence and activity columns in the viewer properties"));const o=this.getProperty(r.COLOR);o&&(o.choices=p()(a.shell.t.columns.numerical).toArray().map((t=>t.name)),o.get(this)===f.$2.ACTIVITY_SCALED&&o.set(this,f.$2.ACTIVITY)),d()(this.root).empty();let s=l.divText(m.q.MOST_POTENT_RESIDUES,{id:"pep-viewer-title"});if(this.name===m.q.SEQUENCE_VARIABILITY_MAP){const t=l.input.bool(i.MUTATION_CLIFFS,{value:this.mode===i.MUTATION_CLIFFS});t.root.addEventListener("click",(()=>{e.value=!1,t.value=!0,this.mode=i.MUTATION_CLIFFS})),t.setTooltip("Statistically significant changes in activity");const e=l.input.bool(i.INVARIANT_MAP,{value:this.mode===i.INVARIANT_MAP});e.root.addEventListener("click",(()=>{t.value=!1,e.value=!0,this.mode=i.INVARIANT_MAP})),e.setTooltip("Number of sequences having monomer-position");const n=t=>{d()(t.root).find(".ui-input-editor").css("margin","0px").attr("type","radio"),d()(t.root).find(".ui-input-description").css("padding","0px").css("padding-right","16px"),d()(t.captionLabel).addClass("ui-label-right")};n(t),n(e),s=l.divH([t.root,e.root],{id:"pep-viewer-title"}),d()(s).css("width","auto").css("align-self","center")}const u=this.viewerGrid.root;u.style.width="auto";const c=l.iconFA("expand-alt",(()=>{const t=l.dialog();t.add(l.divV([s,u],{style:{height:"100%"}})),t.onCancel((()=>this.render())),t.showModal(!0),this.viewerGrid.invalidate()}),"Show Sequence Variability Map Table in full screen");d()(c).addClass("pep-help-icon"),this.targetColumnInput&&(this.targetColumnInput.root.style.maxWidth="50%"),this.monomerSearchInput.root.style.marginRight="8px";const h=l.divH([this.monomerSearchInput.input,null!==(e=null===(t=this.targetColumnInput)||void 0===t?void 0:t.root)&&void 0!==e?e:l.div(),this.targetCategoryInput.root],{style:{alignSelf:"center",justifyContent:"center",width:"100%",flexWrap:"wrap"}});h.style.display=this.showFilterControls?"flex":"none";const g=l.divH([c,s,h],{style:{alignSelf:"center",lineHeight:"normal",flexDirection:"column",width:"100%"}});this.root.appendChild(l.divV([g,u])),null===(n=this.viewerGrid)||void 0===n||n.invalidate(),this.monomerSearchInput.fireChanged()}}class M extends N{constructor(){super(),this.currentGridRowIdx=null}get name(){return m.q.MOST_POTENT_RESIDUES}onTableAttached(){super.onTableAttached(),this.render()}onPropertyChanged(t){super.onPropertyChanged(t),this.doRender&&this.render()}createMostPotentResiduesDf(){var t;const e=Object.entries(this.monomerPositionStats),n=new Array(e.length-1),i=new Array(n.length),o=new Array(n.length),r=new Array(n.length),s=new Array(n.length),a=new Array(n.length),l=new Array(n.length),c=this.getTotalViewerAggColumns(),d=c.map((([t,e])=>(0,v.hX)(e,t))),h=new Array(d.length);d.forEach(((t,e)=>h[e]=new Array(n.length)));let m=0;for(const[g,p]of e){const e=p.general;if(!e)continue;if(1===Object.entries(p).length)continue;const y=[];for(const[n,i]of Object.entries(p))"general"!==n&&(i.count>1&&(null==i.pValue||(null!==(t=i.pValue)&&void 0!==t?t:1)<=.05)&&y.push([n,i]),i.pValue===e.minPValue&&y.push([n,i]));let C=null;0===y.length&&(C=Object.entries(p).find((([t,e])=>"general"!=t)));for(const[t,e]of y)(null===C||this.activityTarget===f.wf.HIGH&&C[1].meanDifference<e.meanDifference||this.activityTarget===f.wf.LOW&&C[1].meanDifference>e.meanDifference)&&(C=[t,e]);if(null===C)continue;n[m]=parseInt(g),i[m]=C[0],o[m]=C[1].meanDifference,r[m]=C[1].pValue,s[m]=C[1].count,a[m]=C[1].ratio,l[m]=C[1].mean;const w=this.monomerPositionStats[g][C[0]],A=u.BitSet.fromBytes(w.mask.buffer.buffer,this.model.df.col(this.activityColumnName).length);for(let t=0;t<d.length;t++){const[e,n]=c[t];h[t][m]=(0,v.lh)(this.model.df.getCol(e),n,A)}++m}n.length=m,i.length=m,o.length=m,r.length=m,s.length=m,a.length=m,l.length=m;const g=u.DataFrame.create(m),p=g.columns;return p.add(u.Column.fromList(u.TYPE.INT,f.$2.POSITION,n)),p.add(u.Column.fromList(u.TYPE.STRING,f.$2.MONOMER,i)),p.add(u.Column.fromList(u.TYPE.FLOAT,f.$2.MEAN_DIFFERENCE,o)),p.add(u.Column.fromList(u.TYPE.FLOAT,f.$2.MEAN,l)),p.add(u.Column.fromList(u.TYPE.FLOAT,f.$2.P_VALUE,r)),p.add(u.Column.fromList(u.TYPE.INT,f.$2.COUNT,s)),p.add(u.Column.fromList(u.TYPE.FLOAT,f.$2.RATIO,a)),d.forEach(((t,e)=>p.add(u.Column.fromList(u.TYPE.FLOAT,t,h[e])))),g}createViewerGrid(){const t=this.createMostPotentResiduesDf(),e=t.plot.grid();e.sort([f.$2.POSITION]);const n=e.col(f.$2.P_VALUE);n.format="#.000",n.name="P-value";const i=t.getCol(f.$2.MONOMER);h.rI(i,this.alphabet,!0),e.onCellRender.subscribe((t=>O(t,this,!1))),e.onCellTooltip(((t,e,n)=>{var i,o;if(!t.isTableCell)return this.model.unhighlight(),!0;const r=this.getMonomerPosition(t);if((0,w.dl)(r,this.dataFrame,this.monomerPositionStats),this.model.isHighlighting=!0,(null===(i=t.tableColumn)||void 0===i?void 0:i.name)===f.$2.MONOMER)r.positionOrClusterType=f.$2.MONOMER;else if((null===(o=t.tableColumn)||void 0===o?void 0:o.name)!==f.$2.MEAN_DIFFERENCE)return!1;const s=this.getTotalViewerAggColumns(),a=null==t.tableRowIndex?void 0:(0,v.m2)(t.grid.dataFrame,t.tableRowIndex,s,{});return(0,y.D)(this.model.df,this.getScaledActivityColumn(),s,{fromViewer:!0,isMostPotentResidues:!0,monomerPosition:r,x:e,y:n,mpStats:this.monomerPositionStats,aggrColValues:a})})),u.debounce(e.onCurrentCellChanged,500).subscribe((n=>{var i,o,r;try{if(-1===n.gridRow)return this._mutationCliffsSelection=(0,w.ZR)(this.positionColumns),this._invariantMapSelection=(0,w.ZR)(this.positionColumns),this.model.fireBitsetChanged(m.q.MOST_POTENT_RESIDUES),void e.invalidate();if(this.keyPressed&&t.currentCol.name!==f.$2.MEAN_DIFFERENCE||!this.keyPressed)return;const s=this.getMonomerPosition(n);if(null!==this.currentGridRowIdx){const t=this.getMonomerPosition(e.cell("Diff",this.currentGridRowIdx));this.modifyInvariantMapSelection(t,{shiftPressed:!0,ctrlPressed:!0},!1)}(null===(r=null===(o=null===(i=this.mutationCliffs)||void 0===i?void 0:i.get(s.monomerOrCluster))||void 0===o?void 0:o.get(s.positionOrClusterType))||void 0===r?void 0:r.size)&&this.modifyInvariantMapSelection(s,{shiftPressed:!0,ctrlPressed:!1}),e.invalidate()}finally{this.keyPressed=!1,this.currentGridRowIdx=n.gridRow}})),e.root.addEventListener("keydown",(n=>{if(this.keyPressed=n.key.startsWith("Arrow"),!this.keyPressed){if("Escape"===n.key||"KeyA"===n.code&&n.ctrlKey&&n.shiftKey)this._mutationCliffsSelection=(0,w.ZR)(this.positionColumns);else{if("KeyA"!==n.code||!n.ctrlKey)return;for(let n=0;n<t.rowCount;++n){const t=this.getMonomerPosition(e.cell("Diff",n));this.modifyInvariantMapSelection(t,{shiftPressed:!0,ctrlPressed:!1},!1)}}this.model.fireBitsetChanged(m.q.MOST_POTENT_RESIDUES),e.invalidate()}})),e.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),e.root.addEventListener("click",(t=>{var n,i,o;const r=e.hitTest(t.offsetX,t.offsetY);if(!(null==r?void 0:r.isTableCell)||r.tableColumn.name!==f.$2.MEAN_DIFFERENCE)return;const s=this.getMonomerPosition(r);(null===(o=null===(i=null===(n=this.monomerPositionStats)||void 0===n?void 0:n[s.positionOrClusterType])||void 0===i?void 0:i[s.monomerOrCluster])||void 0===o?void 0:o.count)&&(this.modifyInvariantMapSelection(s,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey}),e.invalidate())})),I(e);const o=e.col(f.$2.MEAN_DIFFERENCE);o.name="Diff";const r=e.onAfterDrawContent.subscribe((()=>{const t=e.col(f.$2.MONOMER);if(40===t.width)return o.width=40,void r.unsubscribe();t.width=40,o.width=40}));return e}getMonomerPosition(t){return{monomerOrCluster:t.cell.dataFrame.get(f.$2.MONOMER,t.tableRowIndex),positionOrClusterType:`${t.cell.dataFrame.get(f.$2.POSITION,t.tableRowIndex)}`}}render(){var t;if(d()(this.root).empty(),!this.activityColumnName||!this.sequenceColumnName)return void this.root.appendChild(l.divText("Please, select a sequence and activity columns in the viewer properties"));const e=l.divText(m.q.MOST_POTENT_RESIDUES,{id:"pep-viewer-title"}),n=this.viewerGrid.root;n.style.width="auto";const i=l.divH([e],{style:{alignSelf:"center",lineHeight:"normal"}});this.root.appendChild(l.divV([i,n])),null===(t=this.viewerGrid)||void 0===t||t.invalidate()}}function O(t,e,n,i,o){var r,s,a,l,c;const d=[...e.positionColumns.map((t=>t.name)),f.$2.MEAN_DIFFERENCE],m=t.g,g=t.bounds;m.save(),m.beginPath(),m.rect(g.x,g.y,g.width,g.height),m.clip();const p=t.cell;if(p.isRowHeader&&p.gridColumn.visible)return p.gridColumn.visible=!1,t.preventDefault(),void m.restore();const v=null===(r=p.tableColumn)||void 0===r?void 0:r.name,y=p.tableRowIndex;if(!p.isTableCell||-1===d.indexOf(v))return void m.restore();const C=p.grid.table,w=C.get(f.$2.MONOMER,y),A=v!==f.$2.MEAN_DIFFERENCE?v:C.get(f.$2.POSITION,y).toFixed(),b=e.monomerPositionStats[A];if(!b[w])return t.preventDefault(),void m.restore();if(n){const t=null!==(s=b[w].aggValue)&&void 0!==s?s:b[w].count,n=e.positionColumns.find((t=>t.name===A)),i=null!==(a=n.temp[f.gp.INVARIANT_MAP_COLOR_CACHE])&&void 0!==a?a:{};let o=u.Color.white;null!=i[w]?o=i[w]:e instanceof _&&(e.cacheInvariantMapColors(),o=null!==(c=(null!==(l=n.temp[f.gp.INVARIANT_MAP_COLOR_CACHE])&&void 0!==l?l:{})[w])&&void 0!==c?c:u.Color.white),h.rW(m,w,A,e.invariantMapSelection,t,g,o)}else h.Yd(m,w,A,e,g);t.preventDefault(),m.restore()}function I(t){const e=t.props;e.allowEdit=!1,e.allowRowSelection=!1,e.allowBlockSelection=!1,e.allowColSelection=!1,e.showRowHeader=!1,e.showCurrentRowIndicator=!1,e.showReadOnlyNotifications=!1,e.rowHeight=20}},7654:(t,e,n)=>{"use strict";n.d(e,{HV:()=>g,M1:()=>p,QD:()=>v});var i,o=n(7389),r=n(6082),s=n(7233),a=n.n(s),l=n(4139),u=n(5070),c=n(8608),d=n(5480),f=n(8774);!function(t){t.SEPARATE_MONOMERS="separateMonomers",t.SEPARATE_POSITIONS="separatePositions",t.SEPARATE_CLUSTERS="separateClusters"}(i||(i={}));const h="general",m=t=>t===h?"General":t.substring(8);function g(t,e){if(!t.selection.anyTrue)return o.divText("No distribution");const n=()=>{const n=[C(h,t,e)];for(const o of Object.values(i))"true"!==t.getTag(o)||o===i.SEPARATE_CLUSTERS&&!e.clusterColName||n.push(C(o,t,e));return 1===n.length?n[0]:o.div(n)},r=o.div(n()),s=Object.values(i),l=new Array(s.length);for(let u=0;u<s.length;u++){const c=s[u].substring(8);l[u]=o.input.bool(c,{value:"true"===t.getTag(s[u]),onValueChanged:e=>{t.setTag(s[u],`${e}`),a()(r).empty(),r.append(n())}}),a()(l[u].captionLabel).addClass("ui-label-right").css("text-align","left"),a()(l[u].root).find(".ui-input-editor").css("margin","0px"),a()(l[u].root).find(".ui-input-description").css("margin","0px"),l[u].setTooltip(`Show distribution for each ${c}`),c===i.SEPARATE_CLUSTERS?l[u].enabled=!(!e.clusterColName||!e.clusterSelection[d.W.ORIGINAL]):c!==i.SEPARATE_MONOMERS&&c!==i.SEPARATE_POSITIONS||(l[u].enabled=0!==Object.entries(e.monomerPositionSelection).length)}const u=o.form(l,{style:{flexDirection:"row"}});return o.divV([u,r])}function p(t,e=!1){const n=t.plot.histogram({filteringEnabled:!1,valueColumnName:l.$2.ACTIVITY,splitColumnName:l.$2.SPLIT_COL,legendVisibility:"Never",showXAxis:!0,showColumnSelector:!1,showRangeSlider:!1,showBinSelector:!1,backColor:e?"#fdffe5":"#fffff"});return n.root.style.width="auto",n}function v(t,e={}){var n,i;null!==(n=e.fractionDigits)&&void 0!==n||(e.fractionDigits=3);const o={[null!==(i=null==e?void 0:e.countName)&&void 0!==i?i:"Count"]:`${t.count} (${(100*t.ratio).toFixed(e.fractionDigits)}%)`,"Mean difference":t.meanDifference.toFixed(e.fractionDigits),"Mean activity":t.mean.toFixed(e.fractionDigits)};return null!=t.pValue&&(o["p-value"]=t.pValue<.01?"<0.01":t.pValue.toFixed(e.fractionDigits)),o}function y(t,e,n,i={}){const o=p((0,c.FZ)(n.activityCol,t.selection,n.peptideSelection)),s=(0,u.I_)(t,Object.entries(n.columns),{filterDf:!0,mask:r.BitSet.fromBytes(e.mask.buffer.buffer,e.mask.length)}),l=v(e),d=Object.assign(Object.assign({},l),s),f=(0,c.F2)(o,d,i);return a()(f).addClass("d4-flex-col"),f}function C(t,e,n){let r=o.divText("No distribution");switch(t){case h:const t=f.A.fromSeq(e.selection.length,(t=>e.selection.get(t))),s=e.selection.anyTrue&&e.selection.anyFalse?(0,u.GT)(n.activityCol.getRawData(),t):{count:n.activityCol.length,pValue:null,meanDifference:0,ratio:1,mask:t,mean:n.activityCol.stats.avg};r=y(e,s,n);break;case i.SEPARATE_CLUSTERS:r=function(t,e,n){const i=t.rowCount,r=[],s=e.activityCol.getRawData(),a=t.getCol(e.clusterColName),l=a.categories,h=a.getRawData(),m=n[d.W.ORIGINAL].map((t=>l.indexOf(t))),g=new Array(m.length).fill(new f.A(i));for(let t=0;t<i;t++){const e=h[t],n=m.indexOf(e);-1!==n&&g[n].setTrue(t)}for(let n=0;n<m.length;n++){const i=m[n],o=(0,u.GT)(s,g[n]);r.push(y(t,o,e,{[c.AN.SELECTION]:l[i]}))}const p=n[d.W.CUSTOM];for(const n of p){const o=t.getCol(n),a=f.A.fromUint32Array(i,o.getRawData()),l=(0,u.GT)(s,a);r.push(y(t,l,e,{[c.AN.SELECTION]:n}))}return o.div(r,"d4-flex-wrap")}(e,n,n.clusterSelection);break;case i.SEPARATE_MONOMERS:const a=function(t){const e={},n=Object.keys(t);for(const i of n)for(const n of t[i])e.hasOwnProperty(n)?e[n].includes(i)||e[n].push(i):e[n]=[i];return e}(n.monomerPositionSelection);r=function(t,e,n){var i,r,s;const a=Object.keys(n),l=t.rowCount,d=[],h=[],m=[],g=[],p=e.activityCol.getRawData();for(const o of a){const a=n[o],v=new f.A(l);for(let e=0;e<a.length;e++){const n=a[e];null!==(i=h[e])&&void 0!==i||(h[e]=t.getCol(n)),null!==(r=m[e])&&void 0!==r||(m[e]=h[e].categories),null!==(s=g[e])&&void 0!==s||(g[e]=h[e].getRawData());const u=m[e].indexOf(o);for(let t=0;t<l;t++)g[e][t]===u&&v.setTrue(t)}const C=(0,u.GT)(p,v);d.push(y(t,C,e,{[c.AN.SELECTION]:o}))}return o.div(d,"d4-flex-wrap")}(e,n,a);break;case i.SEPARATE_POSITIONS:r=function(t,e,n){var i,r,s;const a=Object.keys(n),l=t.rowCount,d=[],h=e.activityCol.getRawData(),m=[],g=[],p=[];for(let o=0;o<a.length;o++){const v=a[o],C=n[v];if(0===C.length)continue;null!==(i=m[o])&&void 0!==i||(m[o]=t.getCol(v)),null!==(r=g[o])&&void 0!==r||(g[o]=m[o].categories),null!==(s=p[o])&&void 0!==s||(p[o]=m[o].getRawData());const w=new f.A(t.rowCount);for(let t=0;t<C.length;t++){const e=C[t],n=g[o].indexOf(e);for(let t=0;t<l;t++)p[o][t]===n&&w.setTrue(t)}const A=(0,u.GT)(h,w);d.push(y(t,A,e,{[c.AN.SELECTION]:v}))}return o.div(d,"d4-flex-wrap")}(e,n,n.monomerPositionSelection)}return o.divV([o.h1(m(t)),r])}},7923:(t,e,n)=>{"use strict";n.d(e,{F:()=>u});var i=n(7389),o=n(6082),r=n(4139),s=n(8608),a=n(3163),l=n(4025);function u(t,e,n=!0){const r=c(t,e);if(!r)return new o.Widget(i.label("No mutations table generated"));const{pairsGrid:a,uniqueSequencesGrid:l,aminoToInput:u}=r,d=[a,l],f=i.divV([u.root,...d.map((t=>t.root))],{style:{width:"100%"}});return n&&(0,s.BE)("Mutation Cliffs pairs",u.root,f,(()=>{const n=c(t,e),o=i.splitH([i.divV([n.aminoToInput.root,n.pairsGrid.root],{style:{marginRight:"10px"}}),i.divV([n.uniqueSequencesGrid.root],{style:{marginLeft:"10px"}})],{style:{width:"100%",height:"100%"}},!0);return setTimeout((()=>{var t,i;if(document.contains(o)){const r=o.offsetWidth,s=null===(t=n.pairsGrid.canvas)||void 0===t?void 0:t.parentElement;n.pairsGrid.props.showRowHeader=!0,n.uniqueSequencesGrid.props.showRowHeader=!0;const a=null===(i=n.uniqueSequencesGrid.canvas)||void 0===i?void 0:i.parentElement;if(s&&a&&(s.style.height="100%",a.style.height="calc(100% - 20px)",a.style.marginTop="20px",r>400)){const t=Math.max(.33*r,200),i=n.pairsGrid.columns.byName("Mutation");i&&(i.width=t);const o=n.uniqueSequencesGrid.columns.byName(e.sequenceColumnName);o&&(o.width=t)}}}),500),o})),new o.Widget(f)}function c(t,e){var n,u;const c=t.filter.getSelectedIndexes(),d=Object.keys(e.mutationCliffsSelection);if(!d.length||null===e.mutationCliffs)return null;const f=[],h=[],m=[],g=[],p=[],v=[],y=t.getCol(e.sequenceColumnName),C=y.categories,w=y.getRawData(),A=e.activityCol.getRawData(),b=new Map,S=o.BitSet.create(t.rowCount),E={},T=Object.fromEntries(e.positionColumns.map((t=>[t.name,t])));for(const t of d){const i=T[t],o=i.categories,r=i.getRawData();for(const i of e.mutationCliffsSelection[t]){const s=null===(n=e.mutationCliffs.get(i))||void 0===n?void 0:n.get(t);if(void 0!==s)for(const[t,n]of s.entries()){if(!c.includes(t))continue;E[t]||(E[t]=Object.keys(E).length+1);const i=E[t],s=null!==(u=b.get(t))&&void 0!==u?u:[],a=C[w[t]],l=A[t],d=e.activityCol.isNone(t)?null:l;for(const l of n){if(s.includes(l)||!c.includes(l))continue;b.has(l)||b.set(l,[]);const n=C[w[l]],u=e.activityCol.isNone(l)?null:A[l],y=null==d||null==u?null:d-u;b.get(l).push(t),f.push(`${a}#${n}`),g.push(`${i}`),h.push(y),m.push(o[r[l]]),p.push(t),v.push(l),S.set(t,!0),S.set(l,!0)}}}}if(0===f.length)return null;const x=o.Column.fromStrings("Mutation",f),N=o.Column.fromList("double","Delta",h),_=o.Column.fromStrings("Group",g),M=o.Column.fromStrings("~to",m),O=o.Column.fromList(o.COLUMN_TYPE.INT,"~toIdx",v),I=o.Column.fromList(o.COLUMN_TYPE.INT,"~fromIdx",p),L=o.DataFrame.fromColumns([x,N,_,M,O,I]);L.name="Mutation Cliff pairs";const P=i.input.string("Mutated to:",{value:"",onValueChanged:t=>{const e=t;""!==e?L.filter.init((t=>M.get(t)===e)):L.filter.setAll(!0)}});P.setTooltip("Filter the rows by the monomer that the mutation was substituted to");const R=L.plot.grid();(0,s.vY)(R,!0),x.semType=r.uF.MACROMOLECULE_DIFFERENCE,x.tags[r.gp.SEPARATOR]=(0,s.AY)(y),x.tags[o.TAGS.UNITS]=y.tags[o.TAGS.UNITS],x.tags[o.TAGS.CELL_RENDERER]="MacromoleculeDifference",x.temp[l.j.notationProvider]=y.temp[l.j.notationProvider];let k=!1,V=null;const D=[];R.onCurrentCellChanged.subscribe((t=>{try{if(!t||!t.dart)return D.length=0,void $();const e=t.tableRowIndex;if(!k)return;if(null===e)return D.length=0,void $();null!==V&&D.splice(D.indexOf(V),1),D.includes(e)||(D.push(e),R.invalidate()),$()}finally{k=!1,V=t&&t.dart?t.tableRowIndex:null}})),R.root.addEventListener("keydown",(t=>{k=t.key.startsWith("Arrow")})),R.root.addEventListener("click",(t=>{const e=R.hitTest(t.offsetX,t.offsetY);if(!e||null===e.tableRowIndex)return;const n=e.tableRowIndex;if(t.shiftKey){const t=D.indexOf(n);-1===t?D.push(n):D.splice(t,1)}else D.length=0,D.push(n);$(),R.invalidate(),Y.invalidate()})),R.onCellPrepare((t=>{var e,n,i,r;if((null==t?void 0:t.isTableCell)&&"delta"==(null===(n=null===(e=null==t?void 0:t.gridColumn)||void 0===e?void 0:e.name)||void 0===n?void 0:n.toLowerCase())&&(null==(null===(i=null==t?void 0:t.cell)||void 0===i?void 0:i.value)||(null===(r=null==t?void 0:t.cell)||void 0===r?void 0:r.value)==o.FLOAT_NULL))try{t.customText="N/A"}catch(t){}})),R.onCellRender.subscribe((t=>{var e;(null===(e=t.cell.tableColumn)||void 0===e?void 0:e.name)===x.name&&D.includes(t.cell.tableRowIndex)&&(0,a.X5)(t.g,t.bounds)}));const F=e.gridColumns.length,G=[];for(let t=1;t<F;t++){const n=e.gridColumns.byIndex(t);((null==n?void 0:n.name)===e.sequenceColumnName||!0===(null==n?void 0:n.visible)&&!Object.hasOwn(T,n.name))&&G.push(n.name)}const U=t.clone(S,G);U.name="Unique sequences that form Mutation Cliffs pairs";const H=U.columns.addNewInt("~seqIdx"),q=H.getRawData();U.col(e.sequenceColumnName)&&(U.col(e.sequenceColumnName).temp[l.j.notationProvider]=y.temp[l.j.notationProvider]);const B=S.getSelectedIndexes();H.init((t=>B[t]));const Y=U.plot.grid();function $(){const t=[];for(const e of D)t.push(I.get(e)),t.push(O.get(e));U.filter.init((e=>0===D.length||t.includes(q[e])),!0),R.invalidate(),Y.invalidate()}return(0,s.vY)(Y,!0),Y.props.rowHeight=20,R.root.style.width="100% !important",Y.root.style.width="100% !important",setTimeout((()=>{R.autoSize(window.innerWidth,250,void 0,void 0,!1),Y.autoSize(window.innerWidth,250,void 0,void 0,!1),R.root.style.removeProperty("width"),R.root.style.setProperty("width","100%"),Y.root.style.removeProperty("width"),Y.root.style.setProperty("width","100%"),R.root.style.minHeight="70px",Y.root.style.minHeight="100px",R.root.style.height="unset",Y.root.style.height="unset"}),200),{pairsGrid:R,uniqueSequencesGrid:Y,aminoToInput:P}}},5082:(t,e,n)=>{"use strict";n.d(e,{n:()=>p,v:()=>g});var i=n(4328),o=n(7389),r=n(6082),s=n(4139),a=n(115),l=n(9499),u=n(7233),c=n.n(u),d=n(8608),f=n(1199),h=n(5429),m=(n(4788),function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))});function g(t,e){const n=new a.av,l=o.div();let u=null;if(void 0===e){const e=r.Utils.firstOrNull(t.columns.toList().filter((t=>t.semType===r.SEMTYPE.MACROMOLECULE)));if(null===e)throw new Error("Peptides Error: table doesn't contain sequence columns");0!==e.stats.missingValueCount&&i.shell.info("Sequences column contains missing values. They will be ignored during analysis"),u=o.input.column("Sequence",{table:t,value:e,onValueChanged:e=>{c()(l).empty().append(o.wait((()=>m(this,void 0,void 0,(function*(){const n=yield t.plot.fromType("WebLogo",{sequenceColumnName:e.name});return n.root.style.setProperty("height","130px"),n.root}))))),0!==e.stats.missingValueCount&&i.shell.info("Sequences column contains missing values. They will be ignored during analysis")},filter:t=>t.semType===r.SEMTYPE.MACROMOLECULE,nullable:!1}),u.setTooltip("Macromolecule column in FASTA, HELM or separated format")}let g,v=r.Func.find({package:"Bio",name:"webLogoViewer"});if(0===v.length)return{host:o.label("Bio package is missing or out of date. Please install the latest version."),callback:()=>m(this,void 0,void 0,(function*(){return!1}))};if(v=r.Func.find({package:"Bio",name:"getBioLib"}),0===v.length)return{host:o.label("Bio package is missing or out of date. Please install the latest version."),callback:()=>m(this,void 0,void 0,(function*(){return!1}))};const y=t.col("activity")||t.col("IC50")||r.Utils.firstOrNull(t.columns.numerical),C=o.div([],{id:"pep-hist-host"}),w=o.input.choice("Scaling",{value:s.rg.NONE,items:Object.values(s.rg),onValueChanged:t=>m(this,void 0,void 0,(function*(){var e;g=(0,d.Y1)(b.value,t);const n=r.DataFrame.fromColumns([g]).plot.histogram({filteringEnabled:!1,valueColumnName:s.$2.ACTIVITY,legendVisibility:"Never",showXAxis:!0,showColumnSelector:!1,showRangeSlider:!1,showBinSelector:!1});null===(e=C.lastChild)||void 0===e||e.remove(),C.appendChild(n.root)}))});w.setTooltip("Activity column transformation method");const A=()=>{var t;w.enabled=null!==(t=b.value)&&void 0!==t&&t&&b.value.stats.min>0,w.value=s.rg.NONE,0!==b.value.stats.missingValueCount&&i.shell.info("Activity column contains missing values. They will be ignored during analysis")},b=o.input.column("Activity",{table:t,value:y,nullable:!1,onValueChanged:A,filter:t=>t.type===r.TYPE.INT||t.type===r.TYPE.FLOAT||t.type===r.TYPE.QNUM});b.setTooltip("Numerical activity column");const S=o.input.column("Clusters",{table:t,onValueChanged:t=>{t&&(E.value=!1,E.fireChanged())}});S.setTooltip("Optional. Clusters column is used to create Logo Summary Table"),S.nullable=!0;const E=o.input.bool("Generate clusters",{value:!0,onValueChanged:t=>{t&&(S.value=null,S.fireChanged())}});E.setTooltip("Generate clusters column based on MCL embeddings for Logo Summary Table"),b.fireChanged(),w.fireChanged(),E.fireChanged();const T=[b,w,S,E];null!==u&&T.splice(0,0,u);const x=o.input.float(h.t_.THRESHOLD,{value:n.threshold,nullable:!1,onValueChanged:t=>n.threshold=null!=t?t:n.threshold});x.setTooltip("Threshold for similarity between two sequences to create edges");const N=o.input.float(h.t_.INFLATION,{value:n.inflation,nullable:!1,onValueChanged:t=>n.inflation=null!=t?t:n.inflation});N.setTooltip("Inflation value for MCL algorithm");const _=o.input.int(h.t_.MAX_ITERATIONS,{value:n.maxIterations,nullable:!1,onValueChanged:t=>n.maxIterations=null!=t?t:n.maxIterations});_.setTooltip("Maximum iterations for MCL algorithm");const M=o.input.bool(h.t_.USE_WEBGPU,{value:n.useWebGPU,onValueChanged:t=>n.useWebGPU=t});M.enabled=!1,n.webGPUDescriptionPromise.then((()=>{n.webGPUDescription!==a.Ku?(M.setTooltip(`Use WebGPU for MCL algorithm (${n.webGPUDescription})`),M.enabled=!0):(M.setTooltip(a.Ku),M.enabled=!1,M.value=!1)}));const O=o.input.int(h.t_.MIN_CLUSTER_SIZE,{value:n.minClusterSize,nullable:!1,onValueChanged:t=>n.minClusterSize=null!=t?t:n.minClusterSize});O.setTooltip("Minimum cluster size for MCL algorithm");const I=o.input.choice(h.t_.DISTANCE_FUNCTION,{value:n.distanceF,items:[f.Z.NEEDLEMANN_WUNSCH,f.Z.MONOMER_CHEMICAL_DISTANCE,f.Z.HAMMING,f.Z.LEVENSHTEIN],nullable:!1,onValueChanged:t=>n.distanceF=t}),L=o.input.float(h.t_.GAP_OPEN,{value:n.gapOpen,onValueChanged:t=>n.gapOpen=null!=t?t:n.gapOpen}),P=o.input.float(h.t_.GAP_EXTEND,{value:n.gapExtend,onValueChanged:t=>n.gapExtend=null!=t?t:n.gapExtend}),R=[x,N,_,O,I,o.input.choice(h.t_.FINGERPRINT_TYPE,{value:n.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],nullable:!1,onValueChanged:t=>n.fingerprintType=t}),L,P,M],k=o.form(R);k.style.display="none";const V=o.icons.settings((()=>{k.style.display="none"===k.style.display?"flex":"none",k.classList.remove("ui-form-condensed")}),"Adjust clustering parameters");V.style.fontSize="16px",E.root.appendChild(V);const D=t.filter.onChanged.subscribe((()=>A())),F=()=>m(this,void 0,void 0,(function*(){var i,o;const r=null!=e?e:u.value;return D.unsubscribe(),!!r&&null!==(yield p(b.value,r,S.value,t,g,null!==(i=w.value)&&void 0!==i?i:s.rg.NONE,{addSequenceSpace:!1,addMCL:!0,useEmbeddingsClusters:null!==(o=E.value)&&void 0!==o&&o,mclSettings:n}))}));let G="auto";const U=[o.divV(T)];if(c()(U[0]).find("label").css("width","unset"),void 0!==e){const t=o.button("Launch SAR",F,"");t.style.alignSelf="center",U.push(t),G="215px"}return c()(l).empty().append(o.wait((()=>m(this,void 0,void 0,(function*(){var n;const i=yield t.plot.fromType("WebLogo",{sequenceColumnName:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:u.value.name});return i.root.style.setProperty("height","130px"),i.root}))))),{host:o.divV([l,o.splitH([o.splitV(U),C],{style:{height:G,minWidth:"500px",maxWidth:"600px"}}),k]),callback:F}}function p(t,e,n,o,u,c){return m(this,arguments,void 0,(function*(t,e,n,o,u,c,d={}){var f,h,m,g,p;let v=null;if(t.type!==r.COLUMN_TYPE.FLOAT&&t.type!==r.COLUMN_TYPE.INT&&t.type!==r.COLUMN_TYPE.QNUM)return i.shell.error("The activity column must be of numeric type!"),v;const y=r.TaskBarProgressIndicator.create("Loading SAR...");o.tags.delete&&o.tags.delete(".script");const C=o.columns,w=o.col(u.name);w&&(w.name=C.getUnusedName(w.name));const A=u.getRawData();o.columns.addNew(u.name,u.type).init((t=>A[t])),C.setOrder([u.name,e.name,...C.names().filter((t=>t!==e.name&&t!==u.name))]);const b={sequenceColumnName:e.name,activityColumnName:t.name,activityScaling:c,columns:{},showDendrogram:!1,showSequenceSpace:!1,sequenceSpaceParams:new a.GI(!!d.useEmbeddingsClusters&&!n),mclSettings:null!==(f=d.mclSettings)&&void 0!==f?f:new a.av};if(n){const t=o.getCol(n.name);t.type!==r.COLUMN_TYPE.STRING&&C.replace(t,t.convertTo(r.COLUMN_TYPE.STRING))}if(o.setTag(s.gp.SETTINGS,JSON.stringify(b)),v=l.i.getInstance(o),v.init(b),n){const i={clustersColumnName:n.name,sequenceColumnName:e.name,activityScaling:c,activityColumnName:t.name};yield v.addLogoSummaryTable(i)}if(yield v.addMonomerPosition(),yield v.addMostPotentResidues(),null!==(h=d.addSequenceSpace)&&void 0!==h&&h){if(yield v.addSequenceSpace({clusterCol:n,clusterEmbeddings:d.useEmbeddingsClusters}),!n&&null!==(m=d.useEmbeddingsClusters)&&void 0!==m&&m){const n=v._sequenceSpaceCols.find((t=>{var e;return v.df.col(t)&&(null===(e=v.df.col(t))||void 0===e?void 0:e.type)===r.COLUMN_TYPE.STRING}));if(n){const i={clustersColumnName:n,sequenceColumnName:e.name,activityScaling:c,activityColumnName:t.name};yield v.addLogoSummaryTable(i),setTimeout((()=>{var t,e;v&&(null===(t=null==v?void 0:v.findViewer(l.q.LOGO_SUMMARY_TABLE))||void 0===t?void 0:t.render)&&(null===(e=null==v?void 0:v.findViewer(l.q.LOGO_SUMMARY_TABLE))||void 0===e||e.render())}),100)}}}else if(null!==(g=d.addMCL)&&void 0!==g&&g&&(yield v.addMCLClusters(),!n&&null!==(p=d.useEmbeddingsClusters)&&void 0!==p&&p)){const n=v._mclCols.find((t=>(null==v?void 0:v.df.col(t))&&t.toLowerCase().startsWith("cluster")&&!t.toLowerCase().includes("size")));if(n){const i={clustersColumnName:n,sequenceColumnName:e.name,activityScaling:c,activityColumnName:t.name};yield v.addLogoSummaryTable(i),setTimeout((()=>{var t,e;v&&(null===(t=null==v?void 0:v.findViewer(l.q.LOGO_SUMMARY_TABLE))||void 0===t?void 0:t.render)&&(null===(e=null==v?void 0:v.findViewer(l.q.LOGO_SUMMARY_TABLE))||void 0===e||e.render())}),100)}}const S=v.df.plot.grid({rowSource:r.RowSet.Selected,selectedRowsColor:r.Color.fromHtml("#ffffff"),title:"Selection"}),E=null==v?void 0:v.findViewerNode(l.q.LOGO_SUMMARY_TABLE);return E&&v.analysisView.dockManager.dock(S,r.DOCK_TYPE.DOWN,E,"Selection",.4),y.close(),v}))}},5429:(t,e,n)=>{"use strict";n.d(e,{Av:()=>A,OH:()=>b,OO:()=>i,t_:()=>l});var i,o,r,s,a,l,u=n(7389),c=n(4328),d=n(6082),f=n(115),h=n(4139),m=n(9499),g=n(7233),p=n.n(g),v=n(144),y=n.n(v),C=n(9995),w=n(1199);!function(t){t.GENERAL="General",t.VIEWERS="Viewers",t.COLUMNS="Columns",t.SEQUENCE_SPACE="Sequence space",t.MCL="MCL"}(i||(i={})),function(t){t.ACTIVITY="Activity",t.ACTIVITY_SCALING="Activity scaling"}(o||(o={})),function(t){t.DENDROGRAM="Dendrogram"}(r||(r={})),function(t){t.IS_INCLUDED="",t.AGGREGATION="Aggregation"}(s||(s={})),function(t){t.DISTANCE_FUNCTION="Distance Function",t.GAP_OPEN="Gap Open Penalty",t.GAP_EXTEND="Gap Extend Penalty",t.CLUSTER_EMBEDDINGS="Cluster Embeddings",t.EPSILON="Epsilon",t.MIN_PTS="Minimum Points",t.FINGERPRINT_TYPE="Fingerprint Type"}(a||(a={})),function(t){t.DISTANCE_FUNCTION="Distance Function",t.GAP_OPEN="Gap Open Penalty",t.GAP_EXTEND="Gap Extend Penalty",t.FINGERPRINT_TYPE="Fingerprint Type",t.THRESHOLD="Similarity Threshold",t.INFLATION="Inflation Factor",t.MAX_ITERATIONS="Max Iterations",t.USE_WEBGPU="Use WebGPU",t.MIN_CLUSTER_SIZE="Min Cluster Size"}(l||(l={}));const A={[i.GENERAL]:o,[i.VIEWERS]:r,[i.COLUMNS]:s,[i.SEQUENCE_SPACE]:a,[i.MCL]:l};function b(t){var e,n,r,g,v,A,b,S,E,T;null==t.settings&&c.log.error("PeptidesError: Settings are not initialized");const x=u.accordion(),N=t.settings,_=null!==(e=null==N?void 0:N.activityScaling)&&void 0!==e?e:h.rg.NONE,M=null!==(n=null==N?void 0:N.columns)&&void 0!==n?n:{},O={},I={},L=null!==(r=null==N?void 0:N.sequenceSpaceParams)&&void 0!==r?r:new f.GI,P=null!==(g=null==N?void 0:N.mclSettings)&&void 0!==g?g:new f.av,R=u.input.column(o.ACTIVITY,{table:t.df,value:t.df.getCol(t.settings.activityColumnName),onValueChanged:t=>{O.activityColumnName=t.name},filter:t=>(t.type===d.TYPE.FLOAT||t.type===d.TYPE.INT)&&t.name!==h.$2.ACTIVITY&&0===t.stats.missingValueCount});R.setTooltip("Numeric activity column");const k=u.input.choice(o.ACTIVITY_SCALING,{value:_,items:Object.values(h.rg),onValueChanged:t=>O.activityScaling=t});k.setTooltip("Activity column transformation method"),x.addPane(i.GENERAL,(()=>u.inputs([R,k])),!0),I[i.GENERAL]=[R,k];const V=y()(t.analysisView.viewers).some((t=>t.type===m.q.DENDROGRAM)),D=u.input.bool(m.q.DENDROGRAM,{value:null!=V&&V,onValueChanged:t=>O.showDendrogram=t}),F=u.input.bool(m.q.CLUSTER_MAX_ACTIVITY,{value:!!(null==N?void 0:N.showClusterMaxActivity),onValueChanged:t=>{O.showClusterMaxActivity=null!=t?t:void 0}}),G=u.input.bool("Sequence space",{value:!!(null==N?void 0:N.showSequenceSpace),onValueChanged:t=>{O.showSequenceSpace=null!=t?t:void 0,t?(ht.root.style.display="flex",(null==N?void 0:N.showSequenceSpace)||(O.sequenceSpaceParams=L)):(ht.root.style.display="none",delete O.sequenceSpaceParams),O.showSequenceSpace===(null==N?void 0:N.showSequenceSpace)&&delete O.showSequenceSpace}});F.setTooltip("Show cluster max activity viewer"),D.setTooltip("Show dendrogram viewer"),D.enabled=null!==(0,C.getTreeHelperInstance)(),x.addPane(i.VIEWERS,(()=>u.inputs([D,G,F])),!0),I[i.VIEWERS]=[D,G,F];const U=[],H=[];for(const e of t.df.columns.numerical){const t=e.name;if(t===N.activityColumnName||t===h.$2.ACTIVITY)continue;const n=u.input.bool(s.IS_INCLUDED,{value:void 0!==M[t],onValueChanged:e=>{var n;null!==(n=O.columns)&&void 0!==n||(O.columns={}),e?O.columns[t]=i.value:(delete O.columns[t],Object.keys(O.columns).length===Object.keys(M).length&&delete O.columns)}});n.setTooltip("Include aggregated column value in tooltips, Logo Summary Table and Distribution panel");const i=u.input.choice(s.AGGREGATION,{value:null!==(v=M[t])&&void 0!==v?v:d.AGG.AVG,items:Object.values(d.STATS),onValueChanged:i=>{var o;null!==(o=O.columns)&&void 0!==o||(O.columns={}),n.value?O.columns[t]=i:(delete O.columns[e.name],Object.keys(O.columns).length===Object.keys(M).length&&delete O.columns)}});i.setTooltip("Aggregation method"),p()(i.root).find("label").css("width","auto");const o=u.inputsRow(e.name,[n,i]);H.push(n,i),p()(o).find("div.ui-div").css("display","inline-flex"),U.push(o)}0!==U.length&&(x.addPane(i.COLUMNS,(()=>u.divV(U)),!1),I[i.COLUMNS]=H);const q={};function B(t,e){if(X(),null==e||""===e)return;q[t]=e;let n=!0;for(const[t,e]of Object.entries(q))if(e!==L[t]){n=!1;break}n?delete O.sequenceSpaceParams:O.sequenceSpaceParams=Object.assign(Object.assign({},L),q)}function Y(t,e){t.forEach((t=>{t.root.style.display=e?"flex":"none"}))}const $=u.input.choice(a.DISTANCE_FUNCTION,{value:L.distanceF,items:[w.Z.NEEDLEMANN_WUNSCH,w.Z.HAMMING,w.Z.LEVENSHTEIN,w.Z.MONOMER_CHEMICAL_DISTANCE],onValueChanged:t=>B("distanceF",t)});$.setTooltip("Distance function for sequences");const j=u.input.float(a.GAP_OPEN,{value:L.gapOpen,onValueChanged:t=>B("gapOpen",t)}),W=u.input.float(a.GAP_EXTEND,{value:L.gapExtend,onValueChanged:t=>B("gapExtend",t)}),z=u.input.bool(a.CLUSTER_EMBEDDINGS,{value:null!==(A=L.clusterEmbeddings)&&void 0!==A&&A,onValueChanged:t=>B("clusterEmbeddings",t)});z.setTooltip("Cluster embeddings using DBSCAN algorithm");const K=u.input.float(a.EPSILON,{value:L.epsilon,onValueChanged:t=>B("epsilon",t)});K.setTooltip("Epsilon parameter for DBSCAN. Minimum distance between two points to be considered as a cluster");const Q=u.input.int(a.MIN_PTS,{value:L.minPts,onValueChanged:t=>B("minPts",t)});Q.setTooltip("Minimum number of points in a cluster");const Z=u.input.choice(a.FINGERPRINT_TYPE,{value:L.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],onValueChanged:t=>B("fingerprintType",t)});function X(){Y([j,W],$.value===w.Z.NEEDLEMANN_WUNSCH),Y([K,Q],!0===z.value),Y([Z],$.value===w.Z.MONOMER_CHEMICAL_DISTANCE||$.value===w.Z.NEEDLEMANN_WUNSCH)}X();const J={};function tt(t,e){if(et(),null==e||""===e)return;J[t]=e;let n=!0;for(const[t,e]of Object.entries(J))if(e!==P[t]){n=!1;break}n?delete O.mclSettings:O.mclSettings=Object.assign(Object.assign({},P),J)}function et(){Y([it,ot],nt.value===w.Z.NEEDLEMANN_WUNSCH),Y([rt],nt.value===w.Z.MONOMER_CHEMICAL_DISTANCE||nt.value===w.Z.NEEDLEMANN_WUNSCH)}const nt=u.input.choice(l.DISTANCE_FUNCTION,{value:P.distanceF,items:[w.Z.NEEDLEMANN_WUNSCH,w.Z.MONOMER_CHEMICAL_DISTANCE,w.Z.HAMMING,w.Z.LEVENSHTEIN],onValueChanged:t=>tt("distanceF",t)}),it=u.input.float(l.GAP_OPEN,{value:P.gapOpen,onValueChanged:t=>tt("gapOpen",t)}),ot=u.input.float(l.GAP_EXTEND,{value:P.gapExtend,onValueChanged:t=>tt("gapExtend",t)}),rt=u.input.choice(l.FINGERPRINT_TYPE,{value:P.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],onValueChanged:t=>tt("fingerprintType",t)}),st=u.input.int(l.THRESHOLD,{value:null!==(b=P.threshold)&&void 0!==b?b:80,onValueChanged:t=>tt("threshold",t)}),at=u.input.int(l.MAX_ITERATIONS,{value:null!==(S=P.maxIterations)&&void 0!==S?S:5,onValueChanged:t=>tt("maxIterations",t)}),lt=u.input.float(l.INFLATION,{value:null!==(E=P.inflation)&&void 0!==E?E:1.4,onValueChanged:t=>{tt("inflation",t)}}),ut=u.input.bool(l.USE_WEBGPU,{value:P.useWebGPU,onValueChanged:t=>tt("useWebGPU",t)});ut.enabled=!1,P.webGPUDescriptionPromise.then((()=>{P.webGPUDescription!==f.Ku?(ut.setTooltip(`Use WebGPU for MCL algorithm (${P.webGPUDescription})`),ut.enabled=!0):(ut.setTooltip(f.Ku),ut.enabled=!1,ut.value=!1)}));const ct=u.input.int(l.MIN_CLUSTER_SIZE,{value:null!==(T=P.minClusterSize)&&void 0!==T?T:5,onValueChanged:t=>tt("minClusterSize",t)});et();const dt=[st,nt,rt,it,ot,lt,at,ct,ut];x.addPane(i.MCL,(()=>u.inputs(dt)),!0),I[i.MCL]=dt;const ft=[$,Z,j,W,z,K,Q],ht=x.addPane(i.SEQUENCE_SPACE,(()=>u.inputs(ft)),!0);I[i.SEQUENCE_SPACE]=ft,G.fireChanged();const mt=u.dialog("Peptides settings").add(x);return mt.root.style.width="400px",mt.onOK((()=>{t.settings=O})),mt.show(),{dialog:mt,accordion:x,inputs:I}}},144:function(t){var e;e=function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={exports:{},id:i,loaded:!1};return t[i].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e,n){"use strict";var i=n(1).default,o=n(39).default,r=n(52).default,s=n(40).default,a=n(54).default,l=n(80).default,u=n(84).default,c=n(65).default,d=t.exports=function(t){if(!m(t))throw new Error("wu: `"+t+"` is not iterable!");return new f(t)};function f(t){var e=g(t);this.next=e.next.bind(e)}d.prototype=f.prototype,d.prototype[r]=function(){return this};var h={},m=function(t){return t&&"function"==typeof t[r]},g=function(t){if(m(t))return s(t);throw new TypeError("Not iterable: "+t)},p=function(t,e){e.prototype=f.prototype,d[t]=e},v=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?e.length:arguments[2];return e.prototype=f.prototype,f.prototype[t]=e,n+=1,void(d[t]=d.curryable((function(){for(var e,n=arguments.length,i=Array(n),o=0;o<n;o++)i[o]=arguments[o];var r=i.pop();return(e=d(r))[t].apply(e,i)}),n))},y=function(t){return function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return d(t.call.apply(t,[this].concat(n)))}},C=function(t,e){return p(t,y(e))},w=function(t,e,n){return v(t,y(e),n)};p("curryable",(function(t){var e=arguments.length<=1||void 0===arguments[1]?t.length:arguments[1];return function n(){for(var o=arguments.length,r=Array(o),s=0;s<o;s++)r[s]=arguments[s];return r.length>=e?t.apply(this,r):function(t,e){return function(){for(var n=arguments.length,o=Array(n),r=0;r<n;r++)o[r]=arguments[r];return t.call.apply(t,[this].concat(i(e),o))}}(n,r)}})),C("entries",a.mark((function t(e){var n,i,o,r,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,o=void 0,t.prev=3,r=s(l(e));case 5:if(n=(u=r.next()).done){t.next=12;break}return c=u.value,t.next=9,[c,e[c]];case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),i=!0,o=t.t0;case 18:t.prev=18,t.prev=19,!n&&r.return&&r.return();case 21:if(t.prev=21,!i){t.next=24;break}throw o;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),C("keys",a.mark((function t(e){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(l(e),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),C("values",a.mark((function t(e){var n,i,o,r,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,o=void 0,t.prev=3,r=s(l(e));case 5:if(n=(u=r.next()).done){t.next=12;break}return c=u.value,t.next=9,e[c];case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),i=!0,o=t.t0;case 18:t.prev=18,t.prev=19,!n&&r.return&&r.return();case 21:if(t.prev=21,!i){t.next=24;break}throw o;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("cycle",a.mark((function t(){var e,n,i,o,r,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],n=!0,i=!1,o=void 0,t.prev=4,r=s(this);case 6:if(n=(l=r.next()).done){t.next=14;break}return u=l.value,t.next=10,u;case 10:e.push(u);case 11:n=!0,t.next=6;break;case 14:t.next=20;break;case 16:t.prev=16,t.t0=t.catch(4),i=!0,o=t.t0;case 20:t.prev=20,t.prev=21,!n&&r.return&&r.return();case 23:if(t.prev=23,!i){t.next=26;break}throw o;case 26:return t.finish(23);case 27:return t.finish(20);case 28:if(!e){t.next=32;break}return t.delegateYield(e,"t1",30);case 30:t.next=28;break;case 32:case"end":return t.stop()}}),t,this,[[4,16,20,28],[21,,23,27]])}))),C("count",a.mark((function t(){var e,n=arguments.length<=0||void 0===arguments[0]?0:arguments[0],i=arguments.length<=1||void 0===arguments[1]?1:arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=n;case 1:return t.next=4,e;case 4:e+=i,t.next=1;break;case 7:case"end":return t.stop()}}),t,this)}))),C("repeat",a.mark((function t(e){var n,i=arguments.length<=1||void 0===arguments[1]?1/0:arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i!==1/0){t.next=8;break}case 1:return t.next=4,e;case 4:t.next=1;break;case 6:t.next=15;break;case 8:n=0;case 9:if(!(n<i)){t.next=15;break}return t.next=12,e;case 12:n++,t.next=9;break;case 15:case"end":return t.stop()}}),t,this)}))),C("chain",a.mark((function t(){var e,n,i,o,r,l,u,c,d,f=arguments;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(e=!0,n=!1,i=void 0,t.prev=3,o=f.length,r=Array(o),l=0;l<o;l++)r[l]=f[l];u=s(r);case 6:if(e=(c=u.next()).done){t.next=12;break}return d=c.value,t.delegateYield(d,"t0",9);case 9:e=!0,t.next=6;break;case 12:t.next=18;break;case 14:t.prev=14,t.t1=t.catch(3),n=!0,i=t.t1;case 18:t.prev=18,t.prev=19,!e&&u.return&&u.return();case 21:if(t.prev=21,!n){t.next=24;break}throw i;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("chunk",a.mark((function t(){var e,n,i,o,r,l,u,c,d=arguments.length<=0||void 0===arguments[0]?2:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],n=0,i=!0,o=!1,r=void 0,t.prev=5,l=s(this);case 7:if(i=(u=l.next()).done){t.next=18;break}if(c=u.value,e[n++]=c,n!==d){t.next=15;break}return t.next=13,e;case 13:e=[],n=0;case 15:i=!0,t.next=7;break;case 18:t.next=24;break;case 20:t.prev=20,t.t0=t.catch(5),o=!0,r=t.t0;case 24:t.prev=24,t.prev=25,!i&&l.return&&l.return();case 27:if(t.prev=27,!o){t.next=30;break}throw r;case 30:return t.finish(27);case 31:return t.finish(24);case 32:if(!n){t.next=35;break}return t.next=35,e;case 35:case"end":return t.stop()}}),t,this,[[5,20,24,32],[25,,27,31]])})),1),w("concatMap",a.mark((function t(e){var n,i,o,r,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,o=void 0,t.prev=3,r=s(this);case 5:if(n=(l=r.next()).done){t.next=11;break}return u=l.value,t.delegateYield(e(u),"t0",8);case 8:n=!0,t.next=5;break;case 11:t.next=17;break;case 13:t.prev=13,t.t1=t.catch(3),i=!0,o=t.t1;case 17:t.prev=17,t.prev=18,!n&&r.return&&r.return();case 20:if(t.prev=20,!i){t.next=23;break}throw o;case 23:return t.finish(20);case 24:return t.finish(17);case 25:case"end":return t.stop()}}),t,this,[[3,13,17,25],[18,,20,24]])}))),w("drop",a.mark((function t(e){var n,i,o,r,l,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=0,i=!0,o=!1,r=void 0,t.prev=4,l=s(this);case 6:if(i=(u=l.next()).done){t.next=16;break}if(c=u.value,!(n++<e)){t.next=10;break}return t.abrupt("continue",13);case 10:return t.next=12,c;case 12:return t.abrupt("break",16);case 13:i=!0,t.next=6;break;case 16:t.next=22;break;case 18:t.prev=18,t.t0=t.catch(4),o=!0,r=t.t0;case 22:t.prev=22,t.prev=23,!i&&l.return&&l.return();case 25:if(t.prev=25,!o){t.next=28;break}throw r;case 28:return t.finish(25);case 29:return t.finish(22);case 30:return t.delegateYield(this,"t1",31);case 31:case"end":return t.stop()}}),t,this,[[4,18,22,30],[23,,25,29]])}))),w("dropWhile",a.mark((function t(){var e,n,i,o,r,l,u=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,o=s(this);case 5:if(e=(r=o.next()).done){t.next=15;break}if(l=r.value,!u(l)){t.next=9;break}return t.abrupt("continue",12);case 9:return t.next=11,l;case 11:return t.abrupt("break",15);case 12:e=!0,t.next=5;break;case 15:t.next=21;break;case 17:t.prev=17,t.t0=t.catch(3),n=!0,i=t.t0;case 21:t.prev=21,t.prev=22,!e&&o.return&&o.return();case 24:if(t.prev=24,!n){t.next=27;break}throw i;case 27:return t.finish(24);case 28:return t.finish(21);case 29:return t.delegateYield(this,"t1",30);case 30:case"end":return t.stop()}}),t,this,[[3,17,21,29],[22,,24,28]])})),1),w("enumerate",a.mark((function t(){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(A([this,d.count()]),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),w("filter",a.mark((function t(){var e,n,i,o,r,l,u=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,o=s(this);case 5:if(e=(r=o.next()).done){t.next=13;break}if(l=r.value,!u(l)){t.next=10;break}return t.next=10,l;case 10:e=!0,t.next=5;break;case 13:t.next=19;break;case 15:t.prev=15,t.t0=t.catch(3),n=!0,i=t.t0;case 19:t.prev=19,t.prev=20,!e&&o.return&&o.return();case 22:if(t.prev=22,!n){t.next=25;break}throw i;case 25:return t.finish(22);case 26:return t.finish(19);case 27:case"end":return t.stop()}}),t,this,[[3,15,19,27],[20,,22,26]])})),1),w("flatten",a.mark((function t(){var e,n,i,o,r,l,u=!(arguments.length<=0||void 0===arguments[0])&&arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,o=s(this);case 5:if(e=(r=o.next()).done){t.next=16;break}if("string"==typeof(l=r.value)||!m(l)){t.next=11;break}return t.delegateYield(u?l:d(l).flatten(),"t0",9);case 9:t.next=13;break;case 11:return t.next=13,l;case 13:e=!0,t.next=5;break;case 16:t.next=22;break;case 18:t.prev=18,t.t1=t.catch(3),n=!0,i=t.t1;case 22:t.prev=22,t.prev=23,!e&&o.return&&o.return();case 25:if(t.prev=25,!n){t.next=28;break}throw i;case 28:return t.finish(25);case 29:return t.finish(22);case 30:case"end":return t.stop()}}),t,this,[[3,18,22,30],[23,,25,29]])})),1),w("invoke",a.mark((function t(e){var n,i,o,r,l,u,c,d,f,h=arguments;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n=!0,i=!1,o=void 0,t.prev=3,r=h.length,l=Array(r>1?r-1:0),u=1;u<r;u++)l[u-1]=h[u];c=s(this);case 6:if(n=(d=c.next()).done){t.next=13;break}return f=d.value,t.next=10,f[e].apply(f,l);case 10:n=!0,t.next=6;break;case 13:t.next=19;break;case 15:t.prev=15,t.t0=t.catch(3),i=!0,o=t.t0;case 19:t.prev=19,t.prev=20,!n&&c.return&&c.return();case 22:if(t.prev=22,!i){t.next=25;break}throw o;case 25:return t.finish(22);case 26:return t.finish(19);case 27:case"end":return t.stop()}}),t,this,[[3,15,19,27],[20,,22,26]])}))),w("map",a.mark((function t(e){var n,i,o,r,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,o=void 0,t.prev=3,r=s(this);case 5:if(n=(l=r.next()).done){t.next=12;break}return u=l.value,t.next=9,e(u);case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),i=!0,o=t.t0;case 18:t.prev=18,t.prev=19,!n&&r.return&&r.return();case 21:if(t.prev=21,!i){t.next=24;break}throw o;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("pluck",a.mark((function t(e){var n,i,o,r,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,o=void 0,t.prev=3,r=s(this);case 5:if(n=(l=r.next()).done){t.next=12;break}return u=l.value,t.next=9,u[e];case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),i=!0,o=t.t0;case 18:t.prev=18,t.prev=19,!n&&r.return&&r.return();case 21:if(t.prev=21,!i){t.next=24;break}throw o;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("reductions",a.mark((function t(e){var n,i,o,r,l,u,c,d,f,h,m,g,p=arguments.length<=1||void 0===arguments[1]?void 0:arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==(n=p)){t.next=28;break}i=!0,o=!1,r=void 0,t.prev=5,l=s(this);case 7:if(i=(u=l.next()).done){t.next=14;break}return c=u.value,n=c,t.abrupt("break",14);case 11:i=!0,t.next=7;break;case 14:t.next=20;break;case 16:t.prev=16,t.t0=t.catch(5),o=!0,r=t.t0;case 20:t.prev=20,t.prev=21,!i&&l.return&&l.return();case 23:if(t.prev=23,!o){t.next=26;break}throw r;case 26:return t.finish(23);case 27:return t.finish(20);case 28:return t.next=30,n;case 30:d=!0,f=!1,h=void 0,t.prev=33,m=s(this);case 35:if(d=(g=m.next()).done){t.next=42;break}return c=g.value,t.next=39,n=e(n,c);case 39:d=!0,t.next=35;break;case 42:t.next=48;break;case 44:t.prev=44,t.t1=t.catch(33),f=!0,h=t.t1;case 48:t.prev=48,t.prev=49,!d&&m.return&&m.return();case 51:if(t.prev=51,!f){t.next=54;break}throw h;case 54:return t.finish(51);case 55:return t.finish(48);case 56:return t.abrupt("return",n);case 57:case"end":return t.stop()}}),t,this,[[5,16,20,28],[21,,23,27],[33,44,48,56],[49,,51,55]])})),2),w("reject",a.mark((function t(){var e,n,i,o,r,l,u=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,o=s(this);case 5:if(e=(r=o.next()).done){t.next=13;break}if(l=r.value,u(l)){t.next=10;break}return t.next=10,l;case 10:e=!0,t.next=5;break;case 13:t.next=19;break;case 15:t.prev=15,t.t0=t.catch(3),n=!0,i=t.t0;case 19:t.prev=19,t.prev=20,!e&&o.return&&o.return();case 22:if(t.prev=22,!n){t.next=25;break}throw i;case 25:return t.finish(22);case 26:return t.finish(19);case 27:case"end":return t.stop()}}),t,this,[[3,15,19,27],[20,,22,26]])})),1),w("slice",a.mark((function t(){var e,n,i,r,l,u,c,d,f=arguments.length<=0||void 0===arguments[0]?0:arguments[0],h=arguments.length<=1||void 0===arguments[1]?1/0:arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(h<f)){t.next=2;break}throw new RangeError("parameter `stop` (= "+h+") must be >= `start` (= "+f+")");case 2:e=!0,n=!1,i=void 0,t.prev=5,r=s(this.enumerate());case 7:if(e=(l=r.next()).done){t.next=20;break}if(u=o(l.value,2),c=u[0],!((d=u[1])<f)){t.next=13;break}return t.abrupt("continue",17);case 13:if(!(d>=h)){t.next=15;break}return t.abrupt("break",20);case 15:return t.next=17,c;case 17:e=!0,t.next=7;break;case 20:t.next=26;break;case 22:t.prev=22,t.t0=t.catch(5),n=!0,i=t.t0;case 26:t.prev=26,t.prev=27,!e&&r.return&&r.return();case 29:if(t.prev=29,!n){t.next=32;break}throw i;case 32:return t.finish(29);case 33:return t.finish(26);case 34:case"end":return t.stop()}}),t,this,[[5,22,26,34],[27,,29,33]])})),2),w("spreadMap",a.mark((function t(e){var n,o,r,l,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,o=!1,r=void 0,t.prev=3,l=s(this);case 5:if(n=(u=l.next()).done){t.next=12;break}return c=u.value,t.next=9,e.apply(void 0,i(c));case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),o=!0,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&l.return&&l.return();case 21:if(t.prev=21,!o){t.next=24;break}throw r;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("take",a.mark((function t(e){var n,i,o,r,l,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e<1)){t.next=2;break}return t.abrupt("return");case 2:n=0,i=!0,o=!1,r=void 0,t.prev=6,l=s(this);case 8:if(i=(u=l.next()).done){t.next=17;break}return c=u.value,t.next=12,c;case 12:if(!(++n>=e)){t.next=14;break}return t.abrupt("break",17);case 14:i=!0,t.next=8;break;case 17:t.next=23;break;case 19:t.prev=19,t.t0=t.catch(6),o=!0,r=t.t0;case 23:t.prev=23,t.prev=24,!i&&l.return&&l.return();case 26:if(t.prev=26,!o){t.next=29;break}throw r;case 29:return t.finish(26);case 30:return t.finish(23);case 31:case"end":return t.stop()}}),t,this,[[6,19,23,31],[24,,26,30]])}))),w("takeWhile",a.mark((function t(){var e,n,i,o,r,l,u=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,o=s(this);case 5:if(e=(r=o.next()).done){t.next=14;break}if(l=r.value,u(l)){t.next=9;break}return t.abrupt("break",14);case 9:return t.next=11,l;case 11:e=!0,t.next=5;break;case 14:t.next=20;break;case 16:t.prev=16,t.t0=t.catch(3),n=!0,i=t.t0;case 20:t.prev=20,t.prev=21,!e&&o.return&&o.return();case 23:if(t.prev=23,!n){t.next=26;break}throw i;case 26:return t.finish(23);case 27:return t.finish(20);case 28:case"end":return t.stop()}}),t,this,[[3,16,20,28],[21,,23,27]])})),1),w("tap",a.mark((function t(){var e,n,i,o,r,l,u=arguments.length<=0||void 0===arguments[0]?console.log.bind(console):arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,o=s(this);case 5:if(e=(r=o.next()).done){t.next=13;break}return l=r.value,u(l),t.next=10,l;case 10:e=!0,t.next=5;break;case 13:t.next=19;break;case 15:t.prev=15,t.t0=t.catch(3),n=!0,i=t.t0;case 19:t.prev=19,t.prev=20,!e&&o.return&&o.return();case 22:if(t.prev=22,!n){t.next=25;break}throw i;case 25:return t.finish(22);case 26:return t.finish(19);case 27:case"end":return t.stop()}}),t,this,[[3,15,19,27],[20,,22,26]])})),1),w("unique",a.mark((function t(){var e,n,i,o,r,l,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=new u,n=!0,i=!1,o=void 0,t.prev=4,r=s(this);case 6:if(n=(l=r.next()).done){t.next=15;break}if(c=l.value,e.has(c)){t.next=12;break}return t.next=11,c;case 11:e.add(c);case 12:n=!0,t.next=6;break;case 15:t.next=21;break;case 17:t.prev=17,t.t0=t.catch(4),i=!0,o=t.t0;case 21:t.prev=21,t.prev=22,!n&&r.return&&r.return();case 24:if(t.prev=24,!i){t.next=27;break}throw o;case 27:return t.finish(24);case 28:return t.finish(21);case 29:e.clear();case 30:case"end":return t.stop()}}),t,this,[[4,17,21,29],[22,,24,28]])})));var A=y(a.mark((function t(e){var n,i,o,r,l,u,c,d,f,h,m,p,v,y=!(arguments.length<=1||void 0===arguments[1])&&arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.length){t.next=2;break}return t.abrupt("return");case 2:n=e.map(g),i=e.length,o=0,r=!1;case 6:if(r){t.next=44;break}l=[],u=!0,c=!1,d=void 0,t.prev=11,f=s(n);case 13:if(u=(h=f.next()).done){t.next=26;break}if(m=h.value,p=m.next(),v=p.value,!p.done){t.next=22;break}if(y){t.next=21;break}return t.abrupt("return");case 21:++o==i&&(r=!0);case 22:void 0===v?l.length++:l.push(v);case 23:u=!0,t.next=13;break;case 26:t.next=32;break;case 28:t.prev=28,t.t0=t.catch(11),c=!0,d=t.t0;case 32:t.prev=32,t.prev=33,!u&&f.return&&f.return();case 35:if(t.prev=35,!c){t.next=38;break}throw d;case 38:return t.finish(35);case 39:return t.finish(32);case 40:return t.next=42,l;case 42:t.next=6;break;case 44:case"end":return t.stop()}}),t,this,[[11,28,32,40],[33,,35,39]])})));C("zip",a.mark((function t(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(A(n),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),C("zipLongest",a.mark((function t(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(A(n,!0),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),C("zipWith",a.mark((function t(e){for(var n=arguments.length,i=Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(A(i).spreadMap(e),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),d.MAX_BLOCK=15,d.TIMEOUT=1,v("asyncEach",(function(t){var e=arguments.length<=1||void 0===arguments[1]?d.MAX_BLOCK:arguments[1],n=arguments.length<=2||void 0===arguments[2]?d.TIMEOUT:arguments[2],i=g(this);return new c((function(o,r){!function a(){var l=Date.now(),u=!0,c=!1,d=void 0;try{for(var f,h=s(i);!(u=(f=h.next()).done);u=!0){var m=f.value;try{t(m)}catch(t){return void r(t)}if(Date.now()-l>e)return void setTimeout(a,n)}}catch(t){c=!0,d=t}finally{try{!u&&h.return&&h.return()}finally{if(c)throw d}}o()}()}))}),3),v("every",(function(){var t=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0],e=!0,n=!1,i=void 0;try{for(var o,r=s(this);!(e=(o=r.next()).done);e=!0)if(!t(o.value))return!1}catch(t){n=!0,i=t}finally{try{!e&&r.return&&r.return()}finally{if(n)throw i}}return!0}),1),v("find",(function(t){var e=!0,n=!1,i=void 0;try{for(var o,r=s(this);!(e=(o=r.next()).done);e=!0){var a=o.value;if(t(a))return a}}catch(t){n=!0,i=t}finally{try{!e&&r.return&&r.return()}finally{if(n)throw i}}})),v("forEach",(function(t){var e=!0,n=!1,i=void 0;try{for(var o,r=s(this);!(e=(o=r.next()).done);e=!0)t(o.value)}catch(t){n=!0,i=t}finally{try{!e&&r.return&&r.return()}finally{if(n)throw i}}})),v("has",(function(t){return this.some((function(e){return e===t}))})),v("reduce",(function(t){var e=arguments.length<=1||void 0===arguments[1]?void 0:arguments[1];if(void 0===e){var n=!0,i=!1,o=void 0;try{for(var r,a=s(this);!(n=(r=a.next()).done);n=!0){e=r.value;break}}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}}var l=!0,u=!1,c=void 0;try{for(var d,f=s(this);!(l=(d=f.next()).done);l=!0)e=t(e,d.value)}catch(t){u=!0,c=t}finally{try{!l&&f.return&&f.return()}finally{if(u)throw c}}return e}),2),v("some",(function(){var t=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0],e=!0,n=!1,i=void 0;try{for(var o,r=s(this);!(e=(o=r.next()).done);e=!0)if(t(o.value))return!0}catch(t){n=!0,i=t}finally{try{!e&&r.return&&r.return()}finally{if(n)throw i}}return!1}),1),v("toArray",(function(){return[].concat(i(this))}));var b=y(a.mark((function t(e,n){var i,o,r,s,l;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=n.items,o=0;case 2:if(o!==i.length){t.next=14;break}if(r=e.next(),s=r.done,l=r.value,!s){t.next=10;break}return n.returned===h&&(n.returned=l),t.abrupt("break",25);case 10:return t.next=12,i[o++]=l;case 12:t.next=23;break;case 14:if(o!==n.tail){t.next=21;break}return l=i[o],500===o?(i=n.items=i.slice(o),o=0,n.tail=0):(i[o]=void 0,n.tail=++o),t.next=19,l;case 19:t.next=23;break;case 21:return t.next=23,i[o++];case 23:t.next=2;break;case 25:return n.tail===o&&(i.length=0),t.abrupt("return",n.returned);case 27:case"end":return t.stop()}}),t,this)})));b.prototype=f.prototype,v("tee",(function(){for(var t=arguments.length<=0||void 0===arguments[0]?2:arguments[0],e=new Array(t),n={tail:0,items:[],returned:h};t--;)e[t]=b(this,n);return e}),1),v("unzip",(function(){var t=arguments.length<=0||void 0===arguments[0]?2:arguments[0];return this.tee(t).map((function(t,e){return t.pluck(e)}))}),1),d.tang={clan:36}},function(t,e,n){"use strict";var i=n(2).default;e.default=function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return i(t)},e.__esModule=!0},function(t,e,n){t.exports={default:n(3),__esModule:!0}},function(t,e,n){n(4),n(26),t.exports=n(12).Array.from},function(t,e,n){"use strict";var i=n(5)(!0);n(8)(String,"String",(function(t){this._t=String(t),this._i=0}),(function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=i(e,n),this._i+=t.length,{value:t,done:!1})}))},function(t,e,n){var i=n(6),o=n(7);t.exports=function(t){return function(e,n){var r,s,a=String(o(e)),l=i(n),u=a.length;return l<0||l>=u?t?"":void 0:(r=a.charCodeAt(l))<55296||r>56319||l+1===u||(s=a.charCodeAt(l+1))<56320||s>57343?t?a.charAt(l):r:t?a.slice(l,l+2):s-56320+(r-55296<<10)+65536}}},function(t,e){var n=Math.ceil,i=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?i:n)(t)}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){"use strict";var i=n(9),o=n(10),r=n(13),s=n(14),a=n(19),l=n(20)("iterator"),u=n(23),c=!([].keys&&"next"in[].keys()),d="@@iterator",f="keys",h="values",m=function(){return this};t.exports=function(t,e,g,p,v,y,C){n(24)(g,e,p);var w,A,b=function(t){switch(t){case f:case h:return function(){return new g(this,t)}}return function(){return new g(this,t)}},S=e+" Iterator",E=t.prototype,T=E[l]||E[d]||v&&E[v],x=T||b(v);if(T){var N=n(15).getProto(x.call(new t));n(25)(N,S,!0),!i&&a(E,d)&&s(N,l,m)}if(i&&!C||s(E,l,x),u[e]=x,u[S]=m,v)if(w={keys:y?x:b(f),values:v==h?x:b(h),entries:v!=h?x:b("entries")},C)for(A in w)A in E||r(E,A,w[A]);else o(o.P+o.F*c,e,w)}},function(t,e){t.exports=!0},function(t,e,n){var i=n(11),o=n(12),r="prototype",s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e,n){var l,u,c,d,f=t&a.G,h=t&a.P,m=f?i:t&a.S?i[e]:(i[e]||{})[r],g=f?o:o[e]||(o[e]={});for(l in f&&(n=e),n)(u=!(t&a.F)&&m&&l in m)&&l in g||(c=u?m[l]:n[l],f&&"function"!=typeof m[l]?d=n[l]:t&a.B&&u?d=s(c,i):t&a.W&&m[l]==c?function(t){(d=function(e){return this instanceof t?new t(e):t(e)})[r]=t[r]}(c):d=h&&"function"==typeof c?s(Function.call,c):c,g[l]=d,h&&((g[r]||(g[r]={}))[l]=c))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,t.exports=a},function(t,e){var n="undefined",i=t.exports=typeof window!=n&&window.Math==Math?window:typeof self!=n&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},function(t,e){var n=t.exports={version:"1.2.0"};"number"==typeof __e&&(__e=n)},function(t,e,n){t.exports=n(14)},function(t,e,n){var i=n(15),o=n(16);t.exports=n(17)?function(t,e,n){return i.setDesc(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e){var n=Object;t.exports={create:n.create,getProto:n.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:n.getOwnPropertyDescriptor,setDesc:n.defineProperty,setDescs:n.defineProperties,getKeys:n.keys,getNames:n.getOwnPropertyNames,getSymbols:n.getOwnPropertySymbols,each:[].forEach}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){t.exports=!n(18)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var i=n(21)("wks"),o=n(11).Symbol;t.exports=function(t){return i[t]||(i[t]=o&&o[t]||(o||n(22))("Symbol."+t))}},function(t,e,n){var i=n(11),o="__core-js_shared__",r=i[o]||(i[o]={});t.exports=function(t){return r[t]||(r[t]={})}},function(t,e){var n=0,i=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+i).toString(36))}},function(t,e){t.exports={}},function(t,e,n){"use strict";var i=n(15),o={};n(14)(o,n(20)("iterator"),(function(){return this})),t.exports=function(t,e,r){t.prototype=i.create(o,{next:n(16)(1,r)}),n(25)(t,e+" Iterator")}},function(t,e,n){var i=n(19),o=n(14),r=n(20)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,r)&&o(t,r,e)}},function(t,e,n){"use strict";var i=n(27),o=n(10),r=n(29),s=n(30),a=n(33),l=n(34),u=n(35);o(o.S+o.F*!n(38)((function(t){Array.from(t)})),"Array",{from:function(t){var e,n,o,c,d=r(t),f="function"==typeof this?this:Array,h=arguments[1],m=void 0!==h,g=0,p=u(d);if(m&&(h=i(h,arguments[2],2)),null==p||f==Array&&a(p))for(n=new f(e=l(d.length));e>g;g++)n[g]=m?h(d[g],g):d[g];else for(c=p.call(d),n=new f;!(o=c.next()).done;g++)n[g]=m?s(c,h,[o.value,g],!0):o.value;return n.length=g,n}})},function(t,e,n){var i=n(28);t.exports=function(t,e,n){if(i(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,o){return t.call(e,n,i,o)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var i=n(7);t.exports=function(t){return Object(i(t))}},function(t,e,n){var i=n(31);t.exports=function(t,e,n,o){try{return o?e(i(n)[0],n[1]):e(n)}catch(e){var r=t.return;throw void 0!==r&&i(r.call(t)),e}}},function(t,e,n){var i=n(32);t.exports=function(t){if(!i(t))throw TypeError(t+" is not an object!");return t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){var i=n(23),o=n(20)("iterator");t.exports=function(t){return(i.Array||Array.prototype[o])===t}},function(t,e,n){var i=n(6),o=Math.min;t.exports=function(t){return t>0?o(i(t),9007199254740991):0}},function(t,e,n){var i=n(36),o=n(20)("iterator"),r=n(23);t.exports=n(12).getIteratorMethod=function(t){if(null!=t)return t[o]||t["@@iterator"]||r[i(t)]}},function(t,e,n){var i=n(37),o=n(20)("toStringTag"),r="Arguments"==i(function(){return arguments}());t.exports=function(t){var e,n,s;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=(e=Object(t))[o])?n:r?i(e):"Object"==(s=i(e))&&"function"==typeof e.callee?"Arguments":s}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var i=n(20)("iterator"),o=!1;try{var r=[7][i]();r.return=function(){o=!0},Array.from(r,(function(){throw 2}))}catch(t){}t.exports=function(t){if(!o)return!1;var e=!1;try{var n=[7],r=n[i]();r.next=function(){e=!0},n[i]=function(){return r},t(n)}catch(t){}return e}},function(t,e,n){"use strict";var i=n(40).default,o=n(49).default;e.default=function(t,e){if(Array.isArray(t))return t;if(o(Object(t)))return function(t,e){var n=[],o=!0,r=!1,s=void 0;try{for(var a,l=i(t);!(o=(a=l.next()).done)&&(n.push(a.value),!e||n.length!==e);o=!0);}catch(t){r=!0,s=t}finally{try{!o&&l.return&&l.return()}finally{if(r)throw s}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},e.__esModule=!0},function(t,e,n){t.exports={default:n(41),__esModule:!0}},function(t,e,n){n(42),n(4),t.exports=n(48)},function(t,e,n){n(43);var i=n(23);i.NodeList=i.HTMLCollection=i.Array},function(t,e,n){"use strict";var i=n(44),o=n(45),r=n(23),s=n(46);n(8)(Array,"Array",(function(t,e){this._t=s(t),this._i=0,this._k=e}),(function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,o(1)):o(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])}),"values"),r.Arguments=r.Array,i("keys"),i("values"),i("entries")},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){var i=n(47),o=n(7);t.exports=function(t){return i(o(t))}},function(t,e,n){var i=n(37);t.exports=0 in Object("z")?Object:function(t){return"String"==i(t)?t.split(""):Object(t)}},function(t,e,n){var i=n(31),o=n(35);t.exports=n(12).getIterator=function(t){var e=o(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return i(e.call(t))}},function(t,e,n){t.exports={default:n(50),__esModule:!0}},function(t,e,n){n(42),n(4),t.exports=n(51)},function(t,e,n){var i=n(36),o=n(20)("iterator"),r=n(23);t.exports=n(12).isIterable=function(t){var e=Object(t);return o in e||"@@iterator"in e||r.hasOwnProperty(i(e))}},function(t,e,n){t.exports={default:n(53),__esModule:!0}},function(t,e,n){n(4),n(42),t.exports=n(20)("iterator")},function(t,e,n){(function(e){var i="object"==typeof e?e:"object"==typeof window?window:"object"==typeof self?self:this,o=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,r=o&&i.regeneratorRuntime;if(i.regeneratorRuntime=void 0,t.exports=n(55),o)i.regeneratorRuntime=r;else try{delete i.regeneratorRuntime}catch(t){i.regeneratorRuntime=void 0}t.exports={default:t.exports,__esModule:!0}}).call(e,function(){return this}())},function(t,e,n){(function(e,i){"use strict";var o=n(57).default,r=n(52).default,s=n(63).default,a=n(65).default;!function(e){var n,l=Object.prototype.hasOwnProperty,u="function"==typeof o&&r||"@@iterator",c="object"==typeof t,d=e.regeneratorRuntime;if(d)c&&(t.exports=d);else{(d=e.regeneratorRuntime=c?t.exports:{}).wrap=y;var f="suspendedStart",h="suspendedYield",m="executing",g="completed",p={},v=b.prototype=w.prototype;A.prototype=v.constructor=b,b.constructor=A,A.displayName="GeneratorFunction",d.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===A||"GeneratorFunction"===(e.displayName||e.name))},d.mark=function(t){return t.__proto__=b,t.prototype=s(v),t},d.awrap=function(t){return new E(t)},S(T.prototype),d.async=function(t,e,n,i){var o=new T(y(t,e,n,i));return d.isGeneratorFunction(e)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},S(v),v[u]=function(){return this},v.toString=function(){return"[object Generator]"},d.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var i=e.pop();if(i in t)return n.value=i,n.done=!1,n}return n.done=!0,n}},d.values=M,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=n,this.done=!1,this.delegate=null,this.tryEntries.forEach(N),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,i){return r.type="throw",r.arg=t,e.next=n,!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=l.call(o,"catchLoc"),a=l.call(o,"finallyLoc");if(s&&a){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&l.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=t,r.arg=e,o?this.next=o.finallyLoc:this.complete(r),p},complete:function(t,e){if("throw"===t.type)throw t.arg;"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=t.arg,this.next="end"):"normal"===t.type&&e&&(this.next=e)},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),N(n),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var o=i.arg;N(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:M(t),resultName:e,nextLoc:n},p}}}function y(t,e,i,o){var r=s((e||w).prototype);return r._invoke=function(t,e,i){var o=f;return function(r,s){if(o===m)throw new Error("Generator is already running");if(o===g){if("throw"===r)throw s;return O()}for(;;){var a=i.delegate;if(a){if("return"===r||"throw"===r&&a.iterator[r]===n){i.delegate=null;var l=a.iterator.return;if(l&&"throw"===(u=C(l,a.iterator,s)).type){r="throw",s=u.arg;continue}if("return"===r)continue}var u;if("throw"===(u=C(a.iterator[r],a.iterator,s)).type){i.delegate=null,r="throw",s=u.arg;continue}if(r="next",s=n,!(c=u.arg).done)return o=h,c;i[a.resultName]=c.value,i.next=a.nextLoc,i.delegate=null}if("next"===r)i.sent=o===h?s:n;else if("throw"===r){if(o===f)throw o=g,s;i.dispatchException(s)&&(r="next",s=n)}else"return"===r&&i.abrupt("return",s);if(o=m,"normal"===(u=C(t,e,i)).type){o=i.done?g:h;var c={value:u.arg,done:i.done};if(u.arg!==p)return c;i.delegate&&"next"===r&&(s=n)}else"throw"===u.type&&(o=g,r="throw",s=u.arg)}}}(t,i||null,new _(o||[])),r}function C(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function w(){}function A(){}function b(){}function S(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function E(t){this.arg=t}function T(t){function e(e,n){var i=t[e](n),s=i.value;return s instanceof E?a.resolve(s.arg).then(o,r):a.resolve(s).then((function(t){return i.value=t,i}))}"object"==typeof i&&i.domain&&(e=i.domain.bind(e));var n,o=e.bind(t,"next"),r=e.bind(t,"throw");e.bind(t,"return"),this._invoke=function(t,i){var o=n?n.then((function(){return e(t,i)})):new a((function(n){n(e(t,i))}));return n=o.catch((function(t){})),o}}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function M(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i<t.length;)if(l.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=n,e.done=!0,e};return o.next=o}}return{next:O}}function O(){return{value:n,done:!0}}}("object"==typeof e?e:"object"==typeof window?window:"object"==typeof self?self:void 0)}).call(e,function(){return this}(),n(56))},function(t,e){var n,i=t.exports={},o=[],r=!1,s=-1;function a(){r=!1,n.length?o=n.concat(o):s=-1,o.length&&l()}function l(){if(!r){var t=setTimeout(a);r=!0;for(var e=o.length;e;){for(n=o,o=[];++s<e;)n&&n[s].run();s=-1,e=o.length}n=null,r=!1,clearTimeout(t)}}function u(t,e){this.fun=t,this.array=e}function c(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];o.push(new u(t,e)),1!==o.length||r||setTimeout(l,0)},u.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=c,i.addListener=c,i.once=c,i.off=c,i.removeListener=c,i.removeAllListeners=c,i.emit=c,i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){t.exports={default:n(58),__esModule:!0}},function(t,e,n){n(59),t.exports=n(12).Symbol},function(t,e,n){"use strict";var i=n(15),o=n(11),r=n(19),s=n(17),a=n(10),l=n(13),u=n(18),c=n(21),d=n(25),f=n(22),h=n(20),m=n(60),g=n(61),p=n(62),v=n(32),y=n(31),C=n(46),w=n(16),A=i.getDesc,b=i.setDesc,S=i.create,E=g.get,T=o.Symbol,x=!1,N=h("_hidden"),_=i.isEnum,M=c("symbol-registry"),O=c("symbols"),I="function"==typeof T,L=Object.prototype,P=s&&u((function(){return 7!=S(b({},"a",{get:function(){return b(this,"a",{value:7}).a}})).a}))?function(t,e,n){var i=A(L,e);i&&delete L[e],b(t,e,n),i&&t!==L&&b(L,e,i)}:b,R=function(t){var e=O[t]=S(T.prototype);return e._k=t,s&&x&&P(L,t,{configurable:!0,set:function(e){r(this,N)&&r(this[N],t)&&(this[N][t]=!1),P(this,t,w(1,e))}}),e},k=function(t,e,n){return n&&r(O,e)?(n.enumerable?(r(t,N)&&t[N][e]&&(t[N][e]=!1),n=S(n,{enumerable:w(0,!1)})):(r(t,N)||b(t,N,w(1,{})),t[N][e]=!0),P(t,e,n)):b(t,e,n)},V=function(t,e){y(t);for(var n,i=p(e=C(e)),o=0,r=i.length;r>o;)k(t,n=i[o++],e[n]);return t},D=function(t,e){return void 0===e?S(t):V(S(t),e)},F=function(t){var e=_.call(this,t);return!(e||!r(this,t)||!r(O,t)||r(this,N)&&this[N][t])||e},G=function(t,e){var n=A(t=C(t),e);return!n||!r(O,e)||r(t,N)&&t[N][e]||(n.enumerable=!0),n},U=function(t){for(var e,n=E(C(t)),i=[],o=0;n.length>o;)r(O,e=n[o++])||e==N||i.push(e);return i},H=function(t){for(var e,n=E(C(t)),i=[],o=0;n.length>o;)r(O,e=n[o++])&&i.push(O[e]);return i};I||(T=function(){if(this instanceof T)throw TypeError("Symbol is not a constructor");return R(f(arguments[0]))},l(T.prototype,"toString",(function(){return this._k})),i.create=D,i.isEnum=F,i.getDesc=G,i.setDesc=k,i.setDescs=V,i.getNames=g.get=U,i.getSymbols=H,s&&!n(9)&&l(L,"propertyIsEnumerable",F,!0)),I&&!u((function(){return"[null]"!=JSON.stringify([T()])}))||l(T.prototype,"toJSON",(function(){if(I&&v(this))return this}));var q={for:function(t){return r(M,t+="")?M[t]:M[t]=T(t)},keyFor:function(t){return m(M,t)},useSetter:function(){x=!0},useSimple:function(){x=!1}};i.each.call("hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),(function(t){var e=h(t);q[t]=I?e:R(e)})),x=!0,a(a.G+a.W,{Symbol:T}),a(a.S,"Symbol",q),a(a.S+a.F*!I,"Object",{create:D,defineProperty:k,defineProperties:V,getOwnPropertyDescriptor:G,getOwnPropertyNames:U,getOwnPropertySymbols:H}),d(T,"Symbol"),d(Math,"Math",!0),d(o.JSON,"JSON",!0)},function(t,e,n){var i=n(15),o=n(46);t.exports=function(t,e){for(var n,r=o(t),s=i.getKeys(r),a=s.length,l=0;a>l;)if(r[n=s[l++]]===e)return n}},function(t,e,n){var i={}.toString,o=n(46),r=n(15).getNames,s="object"==typeof window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.get=function(t){return s&&"[object Window]"==i.call(t)?function(t){try{return r(t)}catch(t){return s.slice()}}(t):r(o(t))}},function(t,e,n){var i=n(15);t.exports=function(t){var e=i.getKeys(t),n=i.getSymbols;if(n)for(var o,r=n(t),s=i.isEnum,a=0;r.length>a;)s.call(t,o=r[a++])&&e.push(o);return e}},function(t,e,n){t.exports={default:n(64),__esModule:!0}},function(t,e,n){var i=n(15);t.exports=function(t,e){return i.create(t,e)}},function(t,e,n){t.exports={default:n(66),__esModule:!0}},function(t,e,n){n(67),n(4),n(42),n(68),t.exports=n(12).Promise},function(t,e){},function(t,e,n){"use strict";var i,o=n(15),r=n(9),s=n(11),a=n(27),l=n(36),u=n(10),c=n(32),d=n(31),f=n(28),h=n(69),m=n(70),g=n(71).set,p=n(72),v=n(73),y=n(20)("species"),C=n(22)("record"),w=n(74),A="Promise",b=s.process,S="process"==l(b),E=s[A],T=function(t){var e=new E((function(){}));return t&&(e.constructor=Object),E.resolve(e)===e},x=function(){var t=!1;function e(t){var n=new E(t);return g(n,e.prototype),n}try{if(t=E&&E.resolve&&T(),g(e,E),e.prototype=o.create(E.prototype,{constructor:{value:e}}),e.resolve(5).then((function(){}))instanceof e||(t=!1),t&&n(17)){var i=!1;E.resolve(o.setDesc({},"then",{get:function(){i=!0}})),t=i}}catch(e){t=!1}return t}(),N=function(t){var e=d(t)[y];return null!=e?e:t},_=function(t){var e;return!(!c(t)||"function"!=typeof(e=t.then))&&e},M=function(t,e){if(!t.n){t.n=!0;var n=t.c;w((function(){for(var i=t.v,o=1==t.s,r=0,a=function(e){var n,r,s=o?e.ok:e.fail;try{s?(o||(t.h=!0),(n=!0===s?i:s(i))===e.P?e.rej(TypeError("Promise-chain cycle")):(r=_(n))?r.call(n,e.res,e.rej):e.res(n)):e.rej(i)}catch(t){e.rej(t)}};n.length>r;)a(n[r++]);n.length=0,t.n=!1,e&&setTimeout((function(){var e,n,o=t.p;O(o)&&(S?b.emit("unhandledRejection",i,o):(e=s.onunhandledrejection)?e({promise:o,reason:i}):(n=s.console)&&n.error&&n.error("Unhandled promise rejection",i)),t.a=void 0}),1)}))}},O=function(t){var e,n=t[C],i=n.a||n.c,o=0;if(n.h)return!1;for(;i.length>o;)if((e=i[o++]).fail||!O(e.P))return!1;return!0},I=function(t){var e=this;e.d||(e.d=!0,(e=e.r||e).v=t,e.s=2,e.a=e.c.slice(),M(e,!0))},L=function(t){var e,n=this;if(!n.d){n.d=!0,n=n.r||n;try{(e=_(t))?w((function(){var i={r:n,d:!1};try{e.call(t,a(L,i,1),a(I,i,1))}catch(t){I.call(i,t)}})):(n.v=t,n.s=1,M(n,!1))}catch(t){I.call({r:n,d:!1},t)}}};x||(E=function(t){f(t);var e={p:h(this,E,A),c:[],a:void 0,s:0,d:!1,v:void 0,h:!1,n:!1};this[C]=e;try{t(a(L,e,1),a(I,e,1))}catch(t){I.call(e,t)}},n(79)(E.prototype,{then:function(t,e){var n=d(d(this).constructor)[y],i={ok:"function"!=typeof t||t,fail:"function"==typeof e&&e},o=i.P=new(null!=n?n:E)((function(t,e){i.res=t,i.rej=e}));f(i.res),f(i.rej);var r=this[C];return r.c.push(i),r.a&&r.a.push(i),r.s&&M(r,!1),o},catch:function(t){return this.then(void 0,t)}})),u(u.G+u.W+u.F*!x,{Promise:E}),n(25)(E,A),v(E),v(i=n(12)[A]),u(u.S+u.F*!x,A,{reject:function(t){return new this((function(e,n){n(t)}))}}),u(u.S+u.F*(!x||T(!0)),A,{resolve:function(t){return c(n=t)&&(x?"Promise"==l(n):C in n)&&(e=t.constructor,r&&e===E&&this===i||p(e,this))?t:new this((function(e){e(t)}));var e,n}}),u(u.S+u.F*!(x&&n(38)((function(t){E.all(t).catch((function(){}))}))),A,{all:function(t){var e=N(this),n=[];return new e((function(i,r){m(t,!1,n.push,n);var s=n.length,a=Array(s);s?o.each.call(n,(function(t,n){e.resolve(t).then((function(t){a[n]=t,--s||i(a)}),r)})):i(a)}))},race:function(t){var e=N(this);return new e((function(n,i){m(t,!1,(function(t){e.resolve(t).then(n,i)}))}))}})},function(t,e){t.exports=function(t,e,n){if(!(t instanceof e))throw TypeError(n+": use the 'new' operator!");return t}},function(t,e,n){var i=n(27),o=n(30),r=n(33),s=n(31),a=n(34),l=n(35);t.exports=function(t,e,n,u){var c,d,f,h=l(t),m=i(n,u,e?2:1),g=0;if("function"!=typeof h)throw TypeError(t+" is not iterable!");if(r(h))for(c=a(t.length);c>g;g++)e?m(s(d=t[g])[0],d[1]):m(t[g]);else for(f=h.call(t);!(d=f.next()).done;)o(f,m,d.value,e)}},function(t,e,n){var i=n(15).getDesc,o=n(32),r=n(31),s=function(t,e){if(r(t),!o(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,o){try{(o=n(27)(Function.call,i(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,n){return s(t,n),e?t.__proto__=n:o(t,n),t}}({},!1):void 0),check:s}},function(t,e){t.exports=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}},function(t,e,n){"use strict";var i=n(15),o=n(20)("species");t.exports=function(t){n(17)&&!(o in t)&&i.setDesc(t,o,{configurable:!0,get:function(){return this}})}},function(t,e,n){var i,o,r,s=n(11),a=n(75).set,l=s.MutationObserver||s.WebKitMutationObserver,u=s.process,c="process"==n(37)(u),d=function(){var t,e;for(c&&(t=u.domain)&&(u.domain=null,t.exit());i;)(e=i.domain)&&e.enter(),i.fn.call(),e&&e.exit(),i=i.next;o=void 0,t&&t.enter()};if(c)r=function(){u.nextTick(d)};else if(l){var f=1,h=document.createTextNode("");new l(d).observe(h,{characterData:!0}),r=function(){h.data=f=-f}}else r=function(){a.call(s,d)};t.exports=function(t){var e={fn:t,next:void 0,domain:c&&u.domain};o&&(o.next=e),i||(i=e,r()),o=e}},function(t,e,n){"use strict";var i,o,r,s=n(27),a=n(76),l=n(77),u=n(78),c=n(11),d=c.process,f=c.setImmediate,h=c.clearImmediate,m=c.MessageChannel,g=0,p={},v="onreadystatechange",y=function(){var t=+this;if(p.hasOwnProperty(t)){var e=p[t];delete p[t],e()}},C=function(t){y.call(t.data)};f&&h||(f=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return p[++g]=function(){a("function"==typeof t?t:Function(t),e)},i(g),g},h=function(t){delete p[t]},"process"==n(37)(d)?i=function(t){d.nextTick(s(y,t,1))}:m?(r=(o=new m).port2,o.port1.onmessage=C,i=s(r.postMessage,r,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScript?(i=function(t){c.postMessage(t+"","*")},c.addEventListener("message",C,!1)):i=v in u("script")?function(t){l.appendChild(u("script"))[v]=function(){l.removeChild(this),y.call(t)}}:function(t){setTimeout(s(y,t,1),0)}),t.exports={set:f,clear:h}},function(t,e){t.exports=function(t,e,n){var i=void 0===n;switch(e.length){case 0:return i?t():t.call(n);case 1:return i?t(e[0]):t.call(n,e[0]);case 2:return i?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return i?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return i?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},function(t,e,n){t.exports=n(11).document&&document.documentElement},function(t,e,n){var i=n(32),o=n(11).document,r=i(o)&&i(o.createElement);t.exports=function(t){return r?o.createElement(t):{}}},function(t,e,n){var i=n(13);t.exports=function(t,e){for(var n in e)i(t,n,e[n]);return t}},function(t,e,n){t.exports={default:n(81),__esModule:!0}},function(t,e,n){n(82),t.exports=n(12).Object.keys},function(t,e,n){var i=n(29);n(83)("keys",(function(t){return function(e){return t(i(e))}}))},function(t,e,n){t.exports=function(t,e){var i=n(10),o=(n(12).Object||{})[t]||Object[t],r={};r[t]=e(o),i(i.S+i.F*n(18)((function(){o(1)})),"Object",r)}},function(t,e,n){t.exports={default:n(85),__esModule:!0}},function(t,e,n){n(67),n(4),n(42),n(86),n(89),t.exports=n(12).Set},function(t,e,n){"use strict";var i=n(87);n(88)("Set",(function(t){return function(){return t(this,arguments[0])}}),{add:function(t){return i.def(this,t=0===t?0:t,t)}},i)},function(t,e,n){"use strict";var i=n(15),o=n(14),r=n(27),s=n(73),a=n(69),l=n(7),u=n(70),c=n(45),d=n(22)("id"),f=n(19),h=n(32),m=Object.isExtensible||h,g=n(17),p=g?"_s":"size",v=0,y=function(t,e){if(!h(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!f(t,d)){if(!m(t))return"F";if(!e)return"E";o(t,d,++v)}return"O"+t[d]},C=function(t,e){var n,i=y(e);if("F"!==i)return t._i[i];for(n=t._f;n;n=n.n)if(n.k==e)return n};t.exports={getConstructor:function(t,e,o,s){var c=t((function(t,n){a(t,c,e),t._i=i.create(null),t._f=void 0,t._l=void 0,t[p]=0,null!=n&&u(n,o,t[s],t)}));return n(79)(c.prototype,{clear:function(){for(var t=this,e=t._i,n=t._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete e[n.i];t._f=t._l=void 0,t[p]=0},delete:function(t){var e=this,n=C(e,t);if(n){var i=n.n,o=n.p;delete e._i[n.i],n.r=!0,o&&(o.n=i),i&&(i.p=o),e._f==n&&(e._f=i),e._l==n&&(e._l=o),e[p]--}return!!n},forEach:function(t){for(var e,n=r(t,arguments[1],3);e=e?e.n:this._f;)for(n(e.v,e.k,this);e&&e.r;)e=e.p},has:function(t){return!!C(this,t)}}),g&&i.setDesc(c.prototype,"size",{get:function(){return l(this[p])}}),c},def:function(t,e,n){var i,o,r=C(t,e);return r?r.v=n:(t._l=r={i:o=y(e,!0),k:e,v:n,p:i=t._l,n:void 0,r:!1},t._f||(t._f=r),i&&(i.n=r),t[p]++,"F"!==o&&(t._i[o]=r)),t},getEntry:C,setStrong:function(t,e,i){n(8)(t,e,(function(t,e){this._t=t,this._k=e,this._l=void 0}),(function(){for(var t=this,e=t._k,n=t._l;n&&n.r;)n=n.p;return t._t&&(t._l=n=n?n.n:t._t._f)?c(0,"keys"==e?n.k:"values"==e?n.v:[n.k,n.v]):(t._t=void 0,c(1))}),i?"entries":"values",!i,!0),s(t),s(n(12)[e])}}},function(t,e,n){"use strict";var i=n(15),o=n(10),r=n(14),s=n(70),a=n(69);t.exports=function(t,e,l,u,c,d){var f=n(11)[t],h=f,m=c?"set":"add",g=h&&h.prototype,p={};return n(17)&&"function"==typeof h&&(d||g.forEach&&!n(18)((function(){(new h).entries().next()})))?(h=e((function(e,n){a(e,h,t),e._c=new f,null!=n&&s(n,c,e[m],e)})),i.each.call("add,clear,delete,forEach,get,has,set,keys,values,entries".split(","),(function(t){var e="add"==t||"set"==t;!(t in g)||d&&"clear"==t||r(h.prototype,t,(function(n,i){var o=this._c[t](0===n?0:n,i);return e?this:o}))})),"size"in g&&i.setDesc(h.prototype,"size",{get:function(){return this._c.size}})):(h=u.getConstructor(e,t,c,m),n(79)(h.prototype,l)),n(25)(h,t),p[t]=h,o(o.G+o.W+o.F,p),d||u.setStrong(h,t,c),h}},function(t,e,n){var i=n(10);i(i.P,"Set",{toJSON:n(90)("Set")})},function(t,e,n){var i=n(70),o=n(36);t.exports=function(t){return function(){if(o(this)!=t)throw TypeError(t+"#toJSON isn't generic");var e=[];return i(this,!1,e.push,e),e}}}])},t.exports=e()},6082:t=>{"use strict";t.exports=DG},4328:t=>{"use strict";t.exports=grok},7389:t=>{"use strict";t.exports=ui}},e={};function n(i){var o=e[i];if(void 0!==o)return o.exports;var r=e[i]={id:i,loaded:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}n.m=t,n.amdO={},n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.u=t=>t+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.hmd=t=>((t=Object.create(t)).children||(t.children=[]),Object.defineProperty(t,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+t.id)}}),t),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;n.g.importScripts&&(t=n.g.location+"");var e=n.g.document;if(!t&&e&&(e.currentScript&&"SCRIPT"===e.currentScript.tagName.toUpperCase()&&(t=e.currentScript.src),!t)){var i=e.getElementsByTagName("script");if(i.length)for(var o=i.length-1;o>-1&&(!t||!/^http(s?):/.test(t));)t=i[o--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=t})(),n.b=document.baseURI||self.location.href,n.nc=void 0;var i={};(()=>{"use strict";n.r(i),n.d(i,{_package:()=>P,initAutoTests:()=>k,test:()=>R,tests:()=>e.CN});var t=n(6082),e=n(8070),o=n(4328),r=n(5082),s=n(9499),a=n(4139),l=n(8608),u=n(2003),c=n(726),d=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Core",(()=>{const n="AlignedSequence";(0,e.gM)((()=>d(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents()}))));let i=null;(0,e.t6)("Start analysis: simple",(()=>d(void 0,void 0,void 0,(function*(){const o=t.DataFrame.fromCsv(yield P.files.readAsText("aligned.csv")),c=o.getCol("IC50"),d=o.getCol(n);d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(a.gp.ALPHABET,u.YI.PT),d.setTag(t.TAGS.UNITS,u.Hi.FASTA),d.setTag(u.gp.aligned,"SEQ.MSA");const f=(0,l.Y1)(c,a.rg.MINUS_LG);i=yield(0,r.n)(c,d,null,o,f,a.rg.MINUS_LG),(0,e.E3)(i instanceof s.i,!0,"Model is null"),i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP).mutationCliffsSelection={11:["D"]},yield(0,e.cb)(3e3)})))),(0,e.t6)("Start analysis: сomplex",(()=>d(void 0,void 0,void 0,(function*(){const n=t.DataFrame.fromCsv(yield P.files.readAsText("aligned_2.csv")),o=n.getCol("Activity"),c=n.getCol("MSA");c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(a.gp.ALPHABET,u.YI.UN),c.setTag(t.TAGS.UNITS,u.Hi.SEPARATOR),c.setTag(u.gp.aligned,"SEQ.MSA"),c.setTag(a.gp.SEPARATOR,"/");const d=(0,l.Y1)(o,a.rg.MINUS_LG);i=yield(0,r.n)(o,c,null,n,d,a.rg.MINUS_LG),(0,e.E3)(i instanceof s.i,!0,"Model is null"),i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP).mutationCliffsSelection={13:["-"]},yield(0,e.cb)(3e3)})))),(0,e.t6)("Save and load project",(()=>d(void 0,void 0,void 0,(function*(){const s=t.DataFrame.fromCsv(yield P.files.readAsText("aligned.csv")),c=s.getCol("IC50"),d=s.getCol(n);d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(a.gp.ALPHABET,u.YI.PT),d.setTag(t.TAGS.UNITS,u.Hi.FASTA),d.setTag(u.gp.aligned,"SEQ.MSA");const f=(0,l.Y1)(c,a.rg.MINUS_LG);i=yield(0,r.n)(c,d,null,s,f,a.rg.MINUS_LG);let h=o.shell.getTableView("Peptides analysis");const m=h.dataFrame,g=h.saveLayout(),p=m.getTableInfo(),v=t.Project.create();v.name="Peptides project unique test",v.addChild(p),v.addChild(g);const y=yield o.dapi.layouts.save(g);yield o.dapi.tables.uploadDataFrame(m);const C=yield o.dapi.tables.save(p),w=yield o.dapi.projects.save(v);h.close(),yield(0,e.bk)((()=>void 0===o.shell.tableView("Peptides analysis")),"Table never closed",3e3),yield w.open(),h=o.shell.getTableView("Peptides analysis"),yield o.dapi.layouts.delete(y),yield o.dapi.tables.delete(C),yield o.dapi.projects.delete(w)}))),{skipReason:"ViewLayout should become ViewInfo in 1.18."})}),{clear:!0});var f=n(3657),h=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const m=[5,50,100,200];function g(e){return h(this,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return;const n=(yield P.files.readBinaryDataFrames(`tests/${e}k.d42`))[0],i=n.getCol("activity").getRawData(),o=[];let r=1;for(;null!==n.col(r.toString());){const t=n.getCol(r.toString());o.push({name:t.name,rawData:t.getRawData(),cat:t.categories}),++r}yield t.timeAsync("Mutation Cliffs",(()=>h(this,void 0,void 0,(function*(){return yield(0,f.uz)(i,o)}))))}))}(0,e.L1)("Benchmarks: Mutation Cliffs",(()=>{(0,e.gM)((()=>h(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents()}))));for(const t of m)(0,e.t6)(`${t}k sequences`,(()=>h(void 0,void 0,void 0,(function*(){return yield g(t)}))),{timeout:3e5})}),{benchmarks:!0}),(0,e.L1)("Benchmarks: Cluster stats",(()=>{(0,e.gM)((()=>h(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents()}))));for(const n of m)(0,e.t6)(`${n}k sequences`,(()=>h(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return null;const e=(yield P.files.readBinaryDataFrames(`tests/${n}k.d42`))[0],i=(0,l.Y1)(e.getCol("activity"),a.rg.NONE);e.columns.names().map((t=>t.toLowerCase())).includes(i.name.toLowerCase())&&e.columns.remove(i.name),e.columns.add(i),t.time(`Cluster stats benchmark - ${n}k`,(()=>(0,f.eW)(e,"cluster",[],i)))}))),{timeout:1e5})}),{benchmarks:!0}),(0,e.L1)("Benchmarks: Monomer-Position stats",(()=>{(0,e.gM)((()=>h(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents()}))));for(const n of m)(0,e.t6)(`${n}k sequences`,(()=>h(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return null;const e=(yield P.files.readBinaryDataFrames(`tests/${n}k.d42`))[0],i=[];let o=1;for(;null!==e.col(o.toString());)i.push(e.getCol(o.toString())),++o;const r=(0,l.Y1)(e.getCol("activity"),a.rg.NONE);e.columns.names().map((t=>t.toLowerCase())).includes(r.name.toLowerCase())&&e.columns.remove(r.name),e.columns.add(r),t.time(`Monomer-Position stats benchmark - ${n}k`,(()=>(0,f.Ej)(r,t.BitSet.create(0),i)))}))),{timeout:1e5})}),{benchmarks:!0}),(0,e.L1)("Benchmarks: Analysis start",(()=>{(0,e.gM)((()=>h(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents()}))));for(const n of m)(0,e.t6)(`${n}k sequences`,(()=>h(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return;const e=(yield P.files.readBinaryDataFrames(`tests/${n}k.d42`))[0],i=e.getCol("activity"),s=(0,l.Y1)(i,a.rg.NONE),c=e.getCol("cluster"),d=e.getCol("sequence");d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,n===m[0]?u.Hi.HELM:u.Hi.FASTA),yield t.timeAsync("Analysis start",(()=>h(void 0,void 0,void 0,(function*(){const t=yield(0,r.n)(i,d,c,e,s,a.rg.NONE);t&&o.shell.closeTable(t.df)}))))}))),{timeout:1e5})}),{benchmarks:!0});var p,v=n(3541),y=n(5480),C=n(4326);!function(t){t.SEQUENCE="sequence",t.ACTIVITY="activity",t.CLUSTER="cluster"}(p||(p={}));var w=n(912),A=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Viewers: Basic",(()=>{let n;(0,e.gM)((()=>A(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents(),n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),yield(0,e.cb)(500)}))));const i=t.Func.find({package:"Peptides",tags:["viewer"]}).map((t=>t.friendlyName));for(const t of i)(0,e.t6)(t,(()=>A(void 0,void 0,void 0,(function*(){yield(0,e.Bl)(t,n.clone(),{detectSemanticTypes:!0,arbitraryDfTest:!1,readOnly:!0}),yield(0,e.cb)(1e3)}))))})),(0,e.L1)("Viewers: Monomer-Position",(()=>{let n,i,o,c,d,f,h;(0,e.gM)((()=>A(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),o=n.getCol(p.ACTIVITY),c=n.getCol(p.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),f=(0,l.Y1)(o,a.rg.NONE),d=n.getCol(p.CLUSTER);const m=yield(0,r.n)(o,c,d,n,f,a.rg.NONE);if(null===m)throw new Error("Model is null");i=m,h=i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP),yield(0,e.cb)(500)})))),(0,e.Pl)((()=>A(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Tooltip",(()=>A(void 0,void 0,void 0,(function*(){const t=h.viewerGrid.cell("9",6),n=h.getMonomerPosition(t);(0,e.E3)((0,w.D)(i.df,o,Object.entries(i.settings.columns),{monomerPosition:n,x:0,y:0,mpStats:i.monomerPositionStats}),!0,"Tooltip is not shown for grid cell at column '9', row 6")})))),(0,e.t6)("Modes",(()=>A(void 0,void 0,void 0,(function*(){if(null===h)throw new Error("Monomer-Position viewer doesn't exist");(0,e.E3)(h.mode,v.ds.MUTATION_CLIFFS,`Default Monomer-Position mode is not ${v.ds.MUTATION_CLIFFS}`),h.mode=v.ds.INVARIANT_MAP,(0,e.E3)(h.mode,v.ds.INVARIANT_MAP,`Monomer-Position mode is not ${v.ds.INVARIANT_MAP} after switching`),h.mode=v.ds.MUTATION_CLIFFS,(0,e.E3)(h.mode,v.ds.MUTATION_CLIFFS,`Monomer-Position mode is not ${v.ds.MUTATION_CLIFFS} after switching`)}))))}),{clear:!1}),(0,e.L1)("Viewers: Most Potent Residues",(()=>{let n,i,o,c,d,f,h;(0,e.gM)((()=>A(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),o=n.getCol(p.ACTIVITY),c=n.getCol(p.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),f=(0,l.Y1)(o,a.rg.NONE),d=n.getCol(p.CLUSTER);const m=yield(0,r.n)(o,c,d,n,f,a.rg.NONE);if(null===m)throw new Error("Model is null");i=m,h=i.findViewer(s.q.MOST_POTENT_RESIDUES),yield(0,e.cb)(500)})))),(0,e.Pl)((()=>A(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Tooltip",(()=>A(void 0,void 0,void 0,(function*(){const t="Diff",n=h.viewerGrid.cell(t,6),r=h.getMonomerPosition(n);(0,e.E3)((0,w.D)(i.df,o,Object.entries(i.settings.columns),{monomerPosition:r,x:0,y:0,mpStats:i.monomerPositionStats}),!0,`Tooltip is not shown for grid cell at column '${t}', row 6`)}))))})),(0,e.L1)("Viewers: Logo Summary Table",(()=>{let n,i,o,c,d,f,h;(0,e.gM)((()=>A(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),o=n.getCol(p.ACTIVITY),c=n.getCol(p.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),f=(0,l.Y1)(o,a.rg.NONE),d=n.getCol(p.CLUSTER);const m=yield(0,r.n)(o,c,d,n,f,a.rg.NONE);if(null===m)throw new Error("Model is null");i=m,h=i.findViewer(s.q.LOGO_SUMMARY_TABLE),yield(0,e.cb)(500)})))),(0,e.Pl)((()=>A(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Properties",(()=>A(void 0,void 0,void 0,(function*(){h.getProperty("webLogoMode").set(h,C.fH.full),(0,e.E3)(h.webLogoMode,C.fH.full,`Web Logo Mode property is not changed to ${C.fH.full}, got ${h.webLogoMode} instead`),h.getProperty("membersRatioThreshold").set(h,0),(0,e.E3)(h.membersRatioThreshold,0,`Members Ratio Threshold property is not changed to 0, got ${h.membersRatioThreshold} instead`),(0,e.E3)(h.viewerGrid.table.filter.anyTrue,!0,`Expected to filter out all rows, but ${h.viewerGrid.table.filter.trueCount} rows are left unfiltered`)})))),(0,e.t6)("Tooltip",(()=>A(void 0,void 0,void 0,(function*(){const t=h.showTooltip({monomerOrCluster:"0",positionOrClusterType:y.W.ORIGINAL},0,0);(0,e.E3)(null!==t,!0,"Tooltip is not shown for cluster '0'")}))))}),{clear:!1});var b=n(5429),S=n(7654),E=n(7923),T=n(144),x=n.n(T),N=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Widgets: Settings",(()=>{let n,i,o,s,d,f;(0,e.gM)((()=>N(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents(),n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),o=n.getCol(p.ACTIVITY),s=n.getCol(p.SEQUENCE),s.semType=t.SEMTYPE.MACROMOLECULE,s.setTag(t.TAGS.UNITS,u.Hi.HELM),f=(0,l.Y1)(o,a.rg.NONE),d=n.getCol(p.CLUSTER);const h=yield(0,r.n)(o,s,d,n,f,a.rg.NONE);if(null===h)throw new Error("Model is null");i=h,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>N(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("UI",(()=>N(void 0,void 0,void 0,(function*(){const t=(0,b.OH)(i),n=t.accordion.panes.map((t=>t.name));(0,e.E3)(n.length,5,`Expected 5 panes, got ${t.accordion.panes.length}`);for(const t of Object.values(b.OO))(0,e.E3)(n.includes(t),!0,`Pane ${t} is missing`);for(const n of Object.values(b.OO)){const i=t.inputs[n].map((t=>t.caption));for(const t of Object.values(b.Av[n]))(0,e.E3)(i.includes(t),!0,`Input ${t} is missing from ${n}`)}}))))})),(0,e.L1)("Widgets: Distribution panel",(()=>{let n,i,o,d,f,h;(0,e.gM)((()=>N(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents(),n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),o=n.getCol(p.ACTIVITY),d=n.getCol(p.SEQUENCE),d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,u.Hi.HELM),h=(0,l.Y1)(o,a.rg.NONE),f=n.getCol(p.CLUSTER);const s=yield(0,r.n)(o,d,f,n,h,a.rg.NONE);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>N(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("UI",(()=>N(void 0,void 0,void 0,(function*(){i.df.selection.set(0,!0),yield(0,e.cb)(1e3);const n=i.findViewer(s.q.LOGO_SUMMARY_TABLE);(0,S.HV)(i.df,{peptideSelection:t.BitSet.create(i.df.rowCount),columns:i.settings.columns,activityCol:h,clusterSelection:n.clusterSelection,clusterColName:f.name,monomerPositionSelection:i.webLogoSelection})}))))})),(0,e.L1)("Widgets: Mutation cliffs",(()=>{let n,i,o,d,f,h;(0,e.gM)((()=>N(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents(),n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),o=n.getCol(p.ACTIVITY),d=n.getCol(p.SEQUENCE),d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,u.Hi.HELM),h=(0,l.Y1)(o,a.rg.NONE),f=n.getCol(p.CLUSTER);const s=yield(0,r.n)(o,d,f,n,h,a.rg.NONE);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>N(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("UI",(()=>N(void 0,void 0,void 0,(function*(){var t;const n=i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP);n.keyPressed=!0,n._viewerGrid.dataFrame.currentCell=null===(t=n._viewerGrid)||void 0===t?void 0:t.dataFrame.cell(0,"1"),yield(0,e.cb)(1e3),(0,E.F)(i.df,{mutationCliffs:n.mutationCliffs,mutationCliffsSelection:n.mutationCliffsSelection,gridColumns:i.analysisView.grid.columns,sequenceColumnName:n.sequenceColumnName,positionColumns:n.positionColumns,activityCol:h})}))))})),(0,e.L1)("Widgets: Actions",(()=>{let n,i,d,f,h,m;(0,e.gM)((()=>N(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents(),n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),yield n.meta.detectSemanticTypes(),d=n.getCol(p.ACTIVITY),f=n.getCol(p.SEQUENCE),f.semType=t.SEMTYPE.MACROMOLECULE,f.setTag(t.TAGS.UNITS,u.Hi.HELM),m=(0,l.Y1)(d,a.rg.NONE),h=n.getCol(p.CLUSTER);const o=yield(0,r.n)(d,f,h,n,m,a.rg.NONE);if(null===o)throw new Error("Model is null");i=o,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>N(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("New view",(()=>N(void 0,void 0,void 0,(function*(){const n=i.df.filter;n.setAll(!1,!1),n.set(0,!0,!1),n.set(1,!0,!1);const r=i.df.selection;r.set(0,!0,!1),r.set(1,!0,!1);const l=i.createNewView(),u=o.shell.t;(0,e.E3)(u.getTag(a.gp.MULTIPLE_VIEWS),"1","Current table is expected to have multiple views tag"),(0,e.E3)(u.getTag(t.TAGS.ID),l,"Current table is expected to have the same UUID as new view"),(0,e.E3)(u.rowCount,2,"Current table is expected to have 2 rows"),yield(0,e.cb)(500);const c=u.temp[s.i.modelName].findViewer(s.q.LOGO_SUMMARY_TABLE);(0,e.E3)(null!==c,!0,"New view is expected to have Logo Summary Table viewer attached")})))),(0,e.t6)("Custom clusters",(()=>N(void 0,void 0,void 0,(function*(){const t=i.df.filter;t.setAll(!1,!1),t.set(0,!0,!1),t.set(1,!0,!1),i.df.selection.set(0,!0,!1);const n=i.findViewer(s.q.LOGO_SUMMARY_TABLE);if(null===n)throw new Error("Logo summary table viewer is not found");(0,e.E3)(x()(n.customClusters).toArray().length,0,"Expected to have 0 custom clusters before creating one"),n.clusterFromSelection();const o=x()(n.customClusters).toArray();(0,e.E3)(o.length,1,"Expected to have 1 custom cluster");const r=o[0].name;(0,e.E3)(null!==i.df.col(r),!0,"Expected to have custom cluster column in the table"),(0,e.E3)(-1!==n.viewerGrid.table.getCol(a.i6.CLUSTER).categories.indexOf(r),!0,"Expected to have custom cluster in the Logo Summary Table"),n.modifyClusterSelection({monomerOrCluster:r,positionOrClusterType:y.W.CUSTOM}),n.removeCluster(),(0,e.E3)(x()(n.customClusters).toArray().length,0,"Expected to have 0 custom clusters after removing one"),(0,e.E3)(null===i.df.col(r),!0,"Expected to have no custom cluster column in the table"),(0,e.E3)(-1===n.viewerGrid.table.getCol(a.i6.CLUSTER).categories.indexOf(r),!0,"Expected to have no custom cluster in the Logo Summary Table")}))))}),{clear:!1});var _=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Table view",(()=>{let n,i,o,d,f,h;const m="none",g={monomerOrCluster:"Aze",positionOrClusterType:"10",mcCount:3,imCount:1},v={monomerOrCluster:"meI",positionOrClusterType:"1",mcCount:2,imCount:10},C={monomerOrCluster:"0",positionOrClusterType:y.W.ORIGINAL,count:3},w={monomerOrCluster:"1",positionOrClusterType:y.W.ORIGINAL,count:3};(0,e.gM)((()=>_(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents(),n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),o=n.getCol(p.ACTIVITY),d=n.getCol(p.SEQUENCE),d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,u.Hi.HELM),h=(0,l.Y1)(o,m),f=n.getCol(p.CLUSTER);const s=yield(0,r.n)(o,d,f,n,h,m);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>_(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Visible columns",(()=>_(void 0,void 0,void 0,(function*(){const t=i.analysisView.grid.columns,n=i.positionColumns.map((t=>t.name));for(let i=1;i<t.length;i++){const o=t.byIndex(i),r=o.column.name,s=n.includes(r)||r===a.$2.ACTIVITY;(0,e.E3)(o.visible,s,`Column ${r} is visible === ${o.visible} but should be ${s}`)}})))),(0,e.t6)("Mutation Cliffs selection",(()=>_(void 0,void 0,void 0,(function*(){const t=i.df.selection,n=i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP);yield(0,e.bk)((()=>null!==n.mutationCliffs),"mutation cliffs haven't been generated",2e3);for(const[t,i]of Object.entries(n.mutationCliffsSelection))(0,e.E3)(i.length,0,`Selection is not empty for position ${t} after initialization`);n.modifyMutationCliffsSelection(g),(0,e.E3)(n.mutationCliffsSelection[g.positionOrClusterType].includes(g.monomerOrCluster),!0,`Monomer ${g.monomerOrCluster} is not selected at position ${g.positionOrClusterType}`),(0,e.E3)(t.trueCount,g.mcCount,`Selection count is not equal to ${g.mcCount} for monomer ${g.monomerOrCluster} at position ${g.positionOrClusterType}`),n.modifyMutationCliffsSelection(v,{shiftPressed:!0,ctrlPressed:!1}),(0,e.E3)(n.mutationCliffsSelection[v.positionOrClusterType].includes(v.monomerOrCluster),!0,`Monomer ${v.monomerOrCluster} is not selected at position ${v.positionOrClusterType}`),(0,e.E3)(t.trueCount,v.mcCount+g.mcCount,`Selection count is not equal to ${v.mcCount+g.mcCount} for monomer ${v.monomerOrCluster} at position ${v.positionOrClusterType}`),n.modifyMutationCliffsSelection(v,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(n.mutationCliffsSelection[v.positionOrClusterType].includes(v.monomerOrCluster),!1,`Monomer ${v.monomerOrCluster} is still selected at position ${v.positionOrClusterType} after deselection`),(0,e.E3)(t.trueCount,g.mcCount,`Selection count is not equal to ${g.mcCount} for monomer ${g.monomerOrCluster} at position ${g.positionOrClusterType}`),n.mutationCliffsSelection=(0,l.ZR)(n.positionColumns);for(const[t,i]of Object.entries(n.mutationCliffsSelection))(0,e.E3)(i.length,0,`Selection is not empty for position ${t} after clearing monomer-position selection`);(0,e.E3)(t.trueCount,0,"Selection count is not equal to 0 after clearing monomer-position selection");const o=i.findViewer(s.q.LOGO_SUMMARY_TABLE);(0,e.E3)(null!==o,!0,"Couldn't find Logo Summary Table viewer"),o.modifyClusterSelection(C),(0,e.E3)(o.clusterSelection[C.positionOrClusterType].includes(C.monomerOrCluster),!0,`Cluster ${C.monomerOrCluster} is not selected`),(0,e.E3)(t.trueCount,C.count,`Selection count is not equal to ${C.count} for cluster ${C.monomerOrCluster}`),o.modifyClusterSelection(w,{shiftPressed:!0,ctrlPressed:!1}),(0,e.E3)(o.clusterSelection[w.positionOrClusterType].includes(w.monomerOrCluster),!0,`Cluster ${w.monomerOrCluster} is not selected`),(0,e.E3)(t.trueCount,C.count+w.count,`Selection count is not equal to ${C.count+w.count} for cluster ${C.monomerOrCluster} and cluster \n ${w.monomerOrCluster}`),o.modifyClusterSelection(C,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(o.clusterSelection[C.positionOrClusterType].includes(C.monomerOrCluster),!1,`Cluster ${C.monomerOrCluster} is still selected after deselection`),(0,e.E3)(t.trueCount,w.count,`Selection count is not equal to ${w.count} for cluster ${w.monomerOrCluster} after deselection of cluster ${C.monomerOrCluster}`),o.initClusterSelection(),(0,e.E3)(o.isClusterSelectionEmpty,!0,"Selection is not empty after clearing cluster selection"),(0,e.E3)(t.trueCount,0,"Selection count is not equal to 0 after clearing cluster selection")})))),(0,e.t6)("Invariant Map selection",(()=>_(void 0,void 0,void 0,(function*(){const t=i.df.selection;for(const[t,n]of Object.entries(i.webLogoSelection))(0,e.E3)(n.length,0,`Filter is not empty for position ${t} after initialization`);i.modifyWebLogoSelection(v),(0,e.E3)(i.webLogoSelection[v.positionOrClusterType].includes(v.monomerOrCluster),!0,`Monomer ${v.monomerOrCluster} is not filtered at position ${v.positionOrClusterType}`),(0,e.E3)(t.trueCount,v.imCount,`Filter count is not equal to ${v.imCount} for monomer ${v.monomerOrCluster} at position ${v.positionOrClusterType}`),i.modifyWebLogoSelection(g,{shiftPressed:!0,ctrlPressed:!1}),(0,e.E3)(i.webLogoSelection[g.positionOrClusterType].includes(g.monomerOrCluster),!0,`Monomer ${g.monomerOrCluster} is not filtered at position ${g.positionOrClusterType}`),(0,e.E3)(t.trueCount,v.imCount,`Filter count is not equal to ${v.imCount} for monomer ${g.monomerOrCluster} at position ${g.positionOrClusterType}`),i.modifyWebLogoSelection(v,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(i.webLogoSelection[v.positionOrClusterType].includes(v.monomerOrCluster),!1,`Monomer ${v.monomerOrCluster} is still filtered at position \n ${v.positionOrClusterType} after deselection`),(0,e.E3)(t.trueCount,g.imCount,`Filter count is not equal to ${g.imCount} for monomer ${g.monomerOrCluster} at position ${g.positionOrClusterType} after deselection of monomer ${v.monomerOrCluster} at position ${v.positionOrClusterType}`),(0,e.E3)(null!==i.positionColumns,!0,"Position columns are not initialized"),i.webLogoSelection=(0,l.ZR)(i.positionColumns),(0,e.E3)(t.trueCount,0,"Filter count is not equal to 0 after clearing monomer-position filter");for(const[t,n]of Object.entries(i.webLogoSelection))(0,e.E3)(n.length,0,`Filter is not empty for position ${t} after clearing monomer-position filter`)}))))}),{clear:!1});var M=n(5070),O=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Model: Settings",(()=>{let n,i,o,d,f,h;(0,e.gM)((()=>O(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents(),n=t.DataFrame.fromCsv(yield P.files.readAsText("tests/HELM_small.csv")),n.name="HELM_small",o=n.getCol(p.ACTIVITY),d=n.getCol(p.SEQUENCE),d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,u.Hi.HELM),h=(0,l.Y1)(o,a.rg.NONE),f=n.getCol(p.CLUSTER);const s=yield(0,r.n)(o,d,f,n,h,a.rg.NONE);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>O(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Activity scaling",(()=>O(void 0,void 0,void 0,(function*(){var t;const n=(t,e)=>`Activity mismatch at row ${t} for scaling method '${e}'`,r=1e-4,s=i.df.getCol(null===(t=i.settings)||void 0===t?void 0:t.activityColumnName).getRawData(),u=i.df.getCol(a.$2.ACTIVITY),c=i.df.rowCount;let d=u.getRawData();for(let t=0;t<c;t++)(0,e.Wj)(d[t],s[t],r,n(t,a.rg.NONE));d=(0,l.Y1)(o,a.rg.LG).getRawData();for(let t=0;t<c;t++)(0,e.Wj)(d[t],Math.log10(s[t]),r,n(t,a.rg.LG));d=(0,l.Y1)(o,a.rg.MINUS_LG).getRawData();for(let t=0;t<c;t++)(0,e.Wj)(d[t],-Math.log10(s[t]),r,n(t,a.rg.MINUS_LG));d=h.getRawData();for(let t=0;t<c;t++)(0,e.Wj)(d[t],s[t],r,n(t,a.rg.NONE))})))),(0,e.t6)("Mutation Cliffs",(()=>O(void 0,void 0,void 0,(function*(){const t=i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP);(0,e.E3)(t.maxMutations,1,`Max mutations mismatch: expected 1, actual ${t.maxMutations}`),(0,e.E3)(t.minActivityDelta,0,`Min activity delta mismatch: expected 0, actual ${t.minActivityDelta}`),t.maxMutations=2,t.minActivityDelta=.5,(0,e.E3)(t.maxMutations,2,`Max mutations mismatch: expected 2, actual ${t.maxMutations}`),(0,e.E3)(t.minActivityDelta,.5,`Min activity delta mismatch: expected 0.5, actual ${t.minActivityDelta}`)})))),(0,e.t6)("Include columns",(()=>O(void 0,void 0,void 0,(function*(){var n,o;const r="rank",a={[r]:t.AGG.AVG};i.settings={columns:a};const l=i.findViewer(s.q.LOGO_SUMMARY_TABLE),u=(0,M.hX)(t.AGG.AVG,r);(0,e.E3)(null!==l.viewerGrid.col(u),!0,`Expected to include column '${r}' in ${s.q.LOGO_SUMMARY_TABLE} but it is absent`),i.settings={columns:{}},(0,e.E3)(Object.keys(null===(n=i.settings)||void 0===n?void 0:n.columns).length,0,`Expected to remove all column aggregations but columns {${Object.keys(null===(o=i.settings)||void 0===o?void 0:o.columns).join(" & ")}} are still included`),(0,e.E3)(null===l.viewerGrid.col(u),!0,`Expected to remove column '${r}' from ${s.q.LOGO_SUMMARY_TABLE} but it is still present`)})))),(0,e.t6)("Dendrogram",(()=>O(void 0,void 0,void 0,(function*(){var t,n;i.settings={showDendrogram:!0},(0,e.E3)(null===(t=i.settings)||void 0===t?void 0:t.showDendrogram,!0,"Dendrogram is disabled after enabling"),yield(0,e.bk)((()=>null!==i.findViewer(s.q.DENDROGRAM)),"Dendrogram is not present in the view after 5s delay",5e3),i.settings={showDendrogram:!1},(0,e.E3)(null===(n=i.settings)||void 0===n?void 0:n.showDendrogram,!1,"Dendrogram is enabled after disabling"),(0,e.E3)(null===i.findViewer(s.q.DENDROGRAM),!0,"Dendrogram is present in the view after disabling")}))),{skipReason:"Need to find a way to replace _package variable to call for Bio function with tests"})}),{clear:!1});var I=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Algorithms",(()=>{let n,i,o,r;(0,e.gM)((()=>I(void 0,void 0,void 0,(function*(){yield c.Z.loadComponents(),n=t.Column.fromList("int","test",[1,2,5]).getRawData(),i=[t.Column.fromList("string","1","AAA".split("")),t.Column.fromList("string","2","BCC".split("")),t.Column.fromList("string","3","CCD".split(""))].map((t=>({name:t.name,rawData:t.getRawData(),cat:t.categories}))),r=(0,l.eY)(t.Column.fromList("string","target",["1","2","2"])),o={maxMutations:1,minActivityDelta:2}})))),(0,e.t6)("MutationCliffs",(()=>I(void 0,void 0,void 0,(function*(){let t=yield(0,f.uz)(n,i,o);(0,e.E3)(t.has("C"),!0,"MutationCliffsInfo should have key 'C'"),(0,e.E3)(t.has("D"),!0,"MutationCliffsInfo should have key 'D'"),(0,e.E3)(t.has("A"),!1,"MutationCliffsInfo should not have key 'A'");const s=t.get("C"),a=t.get("D");(0,e.E3)(s.has("3"),!0,"MutationCliffsInfo['C'] should have key '3'"),(0,e.E3)(a.has("3"),!0,"MutationCliffsInfo['D'] should have key '3'");const l=s.get("3"),u=a.get("3");(0,e.E3)(l.has(1),!0,"MutationCliffsInfo['C']['3'] should have key 1"),(0,e.E3)(u.has(2),!0,"MutationCliffsInfo['D']['3'] should have key 2");const c=l.get(1),d=u.get(2);(0,e.E3)(c[0],2,"MutationCliffsInfo['C']['3'][1] should have value 2"),(0,e.E3)(d[0],1,"MutationCliffsInfo['D']['3'][2] should have value 1"),o.targetCol=r,o.currentTarget="1",t=yield(0,f.uz)(n,i,o),(0,e.E3)(t.size,0,"MutationCliffsInfo should be empty for target '1'")}))))}));var L=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const P=new t.Package;function R(n,i,o){return L(this,void 0,void 0,(function*(){(null==o?void 0:o.catchUnhandled)&&(o.catchUnhandled=!1);const r=yield(0,e.N$)({category:n,test:i,testContext:o});return t.DataFrame.fromObjects(r)}))}function k(){return L(this,void 0,void 0,(function*(){yield(0,e.Xb)(P,P.getModule("package-test.js"))}))}})(),peptides_test=i})();
2
2
  //# sourceMappingURL=package-test.js.map