@datagrok/peptides 1.22.1 → 1.22.2

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.
package/dist/package.js CHANGED
@@ -1,2 +1,2 @@
1
- var peptides;(()=>{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,r,o,s,a,l,u,c=n(6082),f=n(4328);n(8774),function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan",t.Onehot="One-Hot"}(i||(i={})),function(t){t.Euclidean="Euclidean"}(r||(r={})),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"}(o||(o={})),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 h=n(1199);o.Tanimoto,o.Dice,o.Asymmetric,o.BraunBlanquet,o.Cosine,o.Kulczynski,o.McConnaughey,o.RogotGoldberg,o.Russel,o.Sokal,o.Hamming,o.Euclidean,o.Tanimoto,o.Dice,o.Asymmetric,o.BraunBlanquet,o.Cosine,o.Kulczynski,o.McConnaughey,o.RogotGoldberg,o.Russel,o.Sokal,o.Hamming,o.Euclidean,o.Tanimoto,o.Dice,o.Cosine,o.Tanimoto,o.Asymmetric,o.Cosine,o.Sokal,h.Z.HAMMING,h.Z.LEVENSHTEIN,h.Z.MONOMER_CHEMICAL_DISTANCE,h.Z.NEEDLEMANN_WUNSCH,new RegExp("[rd]\\((\\w)\\)p?","g");var d=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,d.R)(t,n).columns.toList());const i=(await g()).getMonomerLib(),r=new Array(t.length),o=t[0].length,s=new Float32Array(o);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],h=u.getRawData(),d=u.categories,g=d.indexOf("");if(r[n]={categories:d,data:h,emptyIndex:g},void 0===a)continue;const p=c.Column.fromStrings("smiles",d.map((t=>i.getMonomer("PEPTIDE",t)?.smiles??""))),v=(c.DataFrame.fromColumns([p]),await f.chem.getSimilarities(p,l)),y=v?v.getRawData():null;for(let t=0;t<o;++t){const e=h[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 o=0;o<t.length;++o){const t=r[o];if(o>=e.length&&t.data[n]!==t.emptyIndex||t.data[n]===t.emptyIndex&&o<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:()=>r,_S:()=>c,b9:()=>f,gp:()=>o,q7:()=>u});var i,r,o,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"}(r||(r={})),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"}(o||(o={}));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(r.PT,l.fasta.peptide,.5),new s.a(r.DNA,l.fasta.dna,.55),new s.a(r.RNA,l.fasta.rna,.55)],c="",f={[i.FASTA]:"-",[i.SEPARATOR]:"",[i.HELM]:"*"}},2003:(t,e,n)=>{"use strict";n.d(e,{Hi:()=>i.Hi,SM:()=>r.SM,YI:()=>i.YI,gp:()=>i.gp,zS:()=>r.zS});var i=n(439),r=n(9634)},2738:(t,e,n)=>{"use strict";n.d(e,{X:()=>r,a:()=>i});class i{constructor(t,e,n){this.name=t,this.alphabet=e,this.cutoff=n}}class r extends i{constructor(t,e,n){super(t.name,t.alphabet,t.cutoff),this.freq=e,this.similarity=n}}},9634:(t,e,n)=>{"use strict";n.d(e,{zS:()=>T,SM:()=>x});var i=n(6082),r=n(144),o=n.n(r);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],r=t[1];n.forEach(((t,n)=>{i[t]=this.colourPalette[r][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 f 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,f)),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,f)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new f({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 f.aaSynonyms?f.aaSynonyms[t]:t;return super.get(e)}}f.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class h{static getPalette(t="grok"){switch(t){case"grok":return f.GrokGroups;case"lesk":return f.Lesk;default:throw new Error(`ChemPalette: scheme \`${t}\` does not exist`)}}static getInnerOuter(t){let e=0,n="",i="";for(const r of t)"("==r?e++:")"==r?e--:e?n+=r:i+=r;return isNaN(parseInt(n))?[i,n]:[i,""]}static getColorAAPivot(t="",e="grok"){const n=this.getPalette(e);let[i,r]=this.getInnerOuter(t);if(i=i.length>6?`${i.slice(0,3)}...`:i,r=r.length>6?`${r.slice(0,3)}...`:r,1==t.length||"("==t[1]){const e=t[0]?.toUpperCase();return e in n?[n.get(e),e,r,1]:[this.undefinedColor,i,r,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,r,2]:[this.undefinedColor,i,r,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,r,3]:[this.undefinedColor,i,r,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,r,4]:[this.undefinedColor,i,r,4]}return[this.undefinedColor,i,r,0]}}h.SemType="Aminoacids",h.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",h.undefinedColor="rgb(100,100,100)",h.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"},h.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"},h.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(*)*"},h.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 d extends c{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new d({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),r=i.Color.b(n),o=Math.sqrt(Math.pow(0-e,2)+Math.pow(0-t,2)+Math.pow(0-r,2));if(o>210)return`rgb(${e/o*210},${t/o*210},${r/o*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 b extends y{static get palette(){return b._pallete||(b._pallete=b.buildPalette()),b._pallete}static buildPalette(){return(0,g.pj)().then((t=>{t.awaitLoaded(1/0).then((()=>{const e=t.getMonomerLib();e.onChanged.subscribe((()=>{b.customMonomerColors={},b.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=b.palette.length,i=b.customMonomerColors[t],r=e??"PEPTIDE";if(i&&i[r])return i[r];const o=v.hashCode(t)%n;return p(b.palette[o])}}b._pallete=null,b.customMonomerColors={},b.polymerTypes=[];class w 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 b),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]}constructor(t,e){this.mList=t,this.gapOriginalMonomer=e}}const S=t=>{const e=o()(t.toString().matchAll(u.B5)).map((t=>t[2]??t[1])).toArray();return new A(e,u.b9[u.Hi.FASTA])},E=/([^\W_]+)/g;function T(t,e){if(t.length<=e)return t;const n=t.match(E),i=t.length>e||(n?.length??0)>1,r=n?.[0]??" ";return i?r.substring(0,e-1)+"…":r}function x(t,e,n=5){let r;if(t.semType==i.SEMTYPE.MACROMOLECULE)r=e.getSeqHandler(t).alphabet;else{const e=function(t,e,n){const i=t.categories;return function(t,e){const n={};let i=!0,r=null;for(const o of t)if(null==r?r=o.length:o.length!==r&&(i=!1),o.length>=e)for(let t=0;t<o.length;++t){const e=o.getCanonical(t);e in n||(n[e]=0),n[e]+=1}return{freq:n,sameLength:i}}(o().enumerate(t.getRawData()).map((([t,e])=>n(i[t]))),e)}(t,n,S);r=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 r=[],o=[];for(const n of i)r.push(n in t?t[n]:0),o.push(e.has(n)?1:0);const l=new s(r),u=new s(o);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 r;const o=Math.max(...i.map((t=>t.similarity>t.cutoff?t.similarity:-1)));return r=o>0?i.find((t=>t.similarity===o)).name:u.YI.UN,r}(e.freq,u.q7)}return function(t){switch(t){case u.YI.PT:return f.GrokGroups;case u.YI.DNA:case u.YI.RNA:return d.Chromatogram;default:return w.Color}}(r)}},3077:(t,e,n)=>{"use strict";n.d(e,{R:()=>r});var i=n(6082);function r(t,e){const n=t=>{const e=s.columns.addNewString((t+1).toString());return r.push(e),e},r=[],o=t.length,s=i.DataFrame.create(o),a=e.getSeqHandler(t);for(let t=0;t<o;++t){const e=a.getSplitted(t);for(let i=0;i<e.length;++i){const o=e.getCanonical(i);((r[i]??null)||n(i)).set(t,o,!1)}}return s}},4326:(t,e,n)=>{"use strict";n.d(e,{P4:()=>s,fH:()=>r});var i,r,o,s,a,l,u=n(6082);!function(t){t.tooltipWebLogo=".tooltipWebLogo"}(i||(i={})),function(t){t.Entropy="Entropy",t.full="100%"}(r||(r={})),function(t){t.TOP="top",t.MIDDLE="middle",t.BOTTOM="bottom"}(o||(o={})),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=r.Entropy,this.positionWidth=16,this.verticalAlignment=o.MIDDLE,this.horizontalAlignment=s.CENTER,this.fixWidth=!1,this.fitArea=!0,this.minHeight=50,this.maxHeight=100,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,r=(i="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t={}){var e,n,r=void 0!==t?t:{};r.ready=new Promise((function(t,i){e=t,n=i}));var o,s=Object.assign({},r),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&&(o=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)})),r.print||console.log.bind(console);var c,f,h=r.printErr||console.warn.bind(console);Object.assign(r,s),s=null,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.quit&&r.quit,r.wasmBinary&&(c=r.wasmBinary),r.noExitRuntime,"object"!=typeof WebAssembly&&E("no native wasm support detected");var d,m,g,p=!1;function v(){var t=f.buffer;r.HEAP8=d=new Int8Array(t),r.HEAP16=new Int16Array(t),r.HEAP32=new Int32Array(t),r.HEAPU8=m=new Uint8Array(t),r.HEAPU16=new Uint16Array(t),r.HEAPU32=g=new Uint32Array(t),r.HEAPF32=new Float32Array(t),r.HEAPF64=new Float64Array(t)}var y=[],C=[],b=[],w=0,A=null,S=null;function E(t){r.onAbort&&r.onAbort(t),h(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 _(t){return t.startsWith("data:application/octet-stream;base64,")}function N(t){try{if(t==T&&c)return new Uint8Array(c);if(o)return o(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 N(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 N(t)}))}(t).then((function(t){return WebAssembly.instantiate(t,e)})).then((function(t){return t})).then(n,(function(t){h("failed to asynchronously prepare wasm: "+t),E(t)}))}function I(t){for(;t.length>0;)t.shift()(r)}function O(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,d[this.ptr+12|0]=t},this.get_caught=function(){return 0!=d[this.ptr+12|0]},this.set_rethrown=function(t){t=t?1:0,d[this.ptr+13|0]=t},this.get_rethrown=function(){return 0!=d[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=f.buffer;try{return f.grow(t-e.byteLength+65535>>>16),v(),1}catch(t){}}function R(t){return r["_"+t]}_(T="wasmDbscan.wasm")||(x=T,T=r.locateFile?r.locateFile(x,u):u+x);var P="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function k(t,e,n,i,r){var o={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 r=n+i-1,o=0;o<t.length;++o){var s=t.charCodeAt(o);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&t.charCodeAt(++o)),s<=127){if(n>=r)break;e[n++]=s}else if(s<=2047){if(n+1>=r)break;e[n++]=192|s>>6,e[n++]=128|63&s}else if(s<=65535){if(n+2>=r)break;e[n++]=224|s>>12,e[n++]=128|s>>6&63,e[n++]=128|63&s}else{if(n+3>=r)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,d.set(e,n),i}},s=R(t),a=[],l=0;if(i)for(var u=0;u<i.length;u++){var c=o[n[u]];c?(0===l&&(l=G()),a[u]=c(i[u])):a[u]=i[u]}var f=s.apply(null,a);return function(t){return 0!==l&&F(l),function(t){return"string"===e?(n=t)?function(t,e,n){for(var i=e+n,r=e;t[r]&&!(r>=i);)++r;if(r-e>16&&t.buffer&&P)return P.decode(t.subarray(e,r));for(var o="";e<r;){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)o+=String.fromCharCode(s);else{var u=s-65536;o+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else o+=String.fromCharCode((31&s)<<6|a)}else o+=String.fromCharCode(s)}return o}(m,n,i):"":"boolean"===e?Boolean(t):t;var n,i}(t)}(f)}var V,D={__cxa_throw:function(t,e,n){throw new O(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 r=1;r<=4;r*=2){var o=n*(1+.2/r);if(o=Math.min(o,t+100663296),L(Math.min(i,(e=Math.max(t,o))+(65536-e%65536)%65536)))return!0}return!1}},G=(function(){var t,e,i,o,s={env:D,wasi_snapshot_preview1:D};function a(t,e){var n,i=t.exports;return r.asm=i,f=r.asm.memory,v(),r.asm.__indirect_function_table,n=r.asm.__wasm_call_ctors,C.unshift(n),function(t){if(w--,r.monitorRunDependencies&&r.monitorRunDependencies(w),0==w&&(null!==A&&(clearInterval(A),A=null),S)){var e=S;S=null,e()}}(),i}if(w++,r.monitorRunDependencies&&r.monitorRunDependencies(w),r.instantiateWasm)try{return r.instantiateWasm(s,a)}catch(t){h("Module.instantiateWasm callback failed with error: "+t),n(t)}(t=c,e=T,i=s,o=function(t){a(t.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||_(e)||"function"!=typeof fetch?M(e,i,o):fetch(e,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,i).then(o,(function(t){return h("wasm streaming compile failed: "+t),h("falling back to ArrayBuffer instantiation"),M(e,i,o)}))}))).catch(n)}(),r._dbscan=function(){return(r._dbscan=r.asm.dbscan).apply(null,arguments)},r._malloc=function(){return(r._malloc=r.asm.malloc).apply(null,arguments)},r._free=function(){return(r._free=r.asm.free).apply(null,arguments)},function(){return(G=r.asm.stackSave).apply(null,arguments)}),F=function(){return(F=r.asm.stackRestore).apply(null,arguments)},U=function(){return(U=r.asm.stackAlloc).apply(null,arguments)},H=function(){return(H=r.asm.__cxa_is_pointer_type).apply(null,arguments)};function q(){function t(){V||(V=!0,r.calledRun=!0,p||(I(C),e(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),function(){if(r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;)t=r.postRun.shift(),b.unshift(t);var t;I(b)}()))}w>0||(function(){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)t=r.preRun.shift(),y.unshift(t);var t;I(y)}(),w>0||(r.setStatus?(r.setStatus("Running..."),setTimeout((function(){setTimeout((function(){r.setStatus("")}),1),t()}),1)):t()))}if(r.ccall=k,r.cwrap=function(t,e,n,i){var r=!n||n.every((t=>"number"===t||"boolean"===t));return"string"!==e&&r&&!i?R(t):function(){return k(t,e,n,arguments)}},S=function t(){V||q(),V||(S=t)},r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return q(),t.ready});"object"==typeof exports?t.exports=r:"function"==typeof define&&n.amdO?define([],(function(){return r})):"object"==typeof exports&&(exports.exportCppDbscanLib=r)},4329:(t,e,n)=>{"use strict";n.d(e,{_:()=>o});var i=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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 r=null;function o(){return i(this,void 0,void 0,(function*(){if(!navigator.gpu)return console.error("WebGPU is not supported in this browser"),null;if(!r&&(r=yield navigator.gpu.requestAdapter(),null==r))return null;let t=null;return"info"in r&&(t=r.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,r=i._createBuffer(n);if(e)for(let t=0;t<r.length;t++)r[t]=-1;this._data=r,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 r=t.lengthInInts;for(let i=0;i<r;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 r=0,o=0;for(;e-o>=4;)n._data[r++]=255&t[o]|(255&t[o+1])<<8|(255&t[o+2])<<16|(255&t[o+3])<<24,o+=4;return e-o==3&&(n._data[r]=(255&t[o+2])<<16),e-o==2&&(n._data[r]|=(255&t[o+1])<<8),e-o==1&&(n._data[r]|=255&t[o]),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,r=!0){if(n&&r&&this.setAll(!e,!1),r)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 r=Math.min(t,e),o=Math.max(t,e);if(n)for(let t=r;t<=o;t++)this.setTrue(t);else for(let t=r;t<=o;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 r=31&this._length;for(0!=r&&(n&=~(4294967295<<r));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 r=this.lengthInInts;let o=0;for(;o<r-1;o++)for(let e=this._data[o]&t._data[o];0!=e;e>>>=8)n+=i._onBitCount[255&e];let s=this._data[o]&t._data[o];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 r=this.lengthInInts;for(let o=Math.floor(t/32);o<r;o++){let r=e?this._data[o]:~this._data[o];if(0!=n)r&=4294967295<<n&4294967295,n=0;else if(!e&&-4294967296==r)continue;for(let e=0;0!=r;e+=8,r>>>=8){const n=i._firstOnBit[255&r];if(n>=0)return(t=n+32*o+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 r=Math.floor(t/32);r>=0;r--){let t=e?this._data[r]:~this._data[r];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*r+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,{cb:()=>s}),n(4328);var i=n(6082);n(9982),i.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,,,,,,,,,,,,,,,,,,,,,').columns.add(i.Column.fromList(i.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var r,o=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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 s(t){return o(this,void 0,void 0,(function*(){yield new Promise((e=>setTimeout(e,t)))}))}console.log.bind(console),console.info.bind(console),console.warn.bind(console),console.error.bind(console),function(t){t.notNull=function(t,e){if(null==t)throw new Error(`${null==e?"Value":e} not defined`)}}(r||(r={})),i.DataFrame.fromColumns([i.Column.fromStrings("col",["val1","val2","val3"])])},7233:t=>{!function(){"use strict";var e=document,n=window,i=e.documentElement,r=e.createElement.bind(e),o=r("div"),s=r("table"),a=r("tbody"),l=r("tr"),u=Array.isArray,c=Array.prototype,f=c.concat,h=c.filter,d=c.indexOf,m=c.map,g=c.push,p=c.slice,v=c.some,y=c.splice,C=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,b=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,w=/<.+>/,A=/^\w+$/;function S(t,e){var n,i=!!(n=e)&&11===n.nodeType;return t&&(i||M(e)||I(e))?!i&&b.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(_(t))return t;var r=t;if(L(t)){var o=i||e;if(!(r=C.test(t)&&M(o)?o.getElementById(t.slice(1).replace(/\\/g,"")):w.test(t)?X(t):_(o)?o.find(t):L(o)?x(o).find(t):S(t,o)))return}else if(O(t))return this.ready(t);(r.nodeType||r===n)&&(r=[r]),this.length=r.length;for(var s=0,a=this.length;s<a;s++)this[s]=r[s]}}return t.prototype.init=function(e,n){return new t(e,n)},t}(),T=E.prototype,x=T.init;function _(t){return t instanceof E}function N(t){return!!t&&t===t.window}function M(t){return!!t&&9===t.nodeType}function I(t){return!!t&&1===t.nodeType}function O(t){return"function"==typeof t}function L(t){return"string"==typeof t}function R(t){return void 0===t}function P(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 r=Object.keys(t),o=(i=0,r.length);i<o;i++){var s=r[i];if(!1===e.call(t[s],s,t[s]))return t}else for(i=0,o=t.length;i<o;i++)if(!1===e.call(t[i],i,t[i]))return t;return t}function G(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="boolean"==typeof t[0]&&t.shift(),i=t.shift(),r=t.length;if(!i)return{};if(!r)return G(n,x,i);for(var o=0;o<r;o++){var s=t[o];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),G(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=N,x.isFunction=O,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=G,T.extend=function(t){return G(T,t)};var F=/\S+/g;function U(t){return L(t)&&t.match(F)||[]}function H(t,e,i){if(I(t)){var r=n.getComputedStyle(t,null);return i?r.getPropertyValue(e)||void 0:r[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=!R(e);return this.each((function(t,r){I(r)&&D(n,(function(t,n){i?e?r.classList.add(n):r.classList.remove(n):r.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){I(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]||!I(this[0]))return;var n=this[0].getAttribute(t);return P(n)?void 0:n}return R(e)?this:P(e)?this.removeAttr(t):this.each((function(n,i){I(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 I(e)&&e.classList.contains(t)}))},T.get=function(t){return R(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 R(t)?this.get().map((function(t){return I(t)||(e=t)&&3===e.nodeType?t.textContent:"";var e})).join(""):this.each((function(e,n){I(n)&&(n.textContent=t)}))};var Y={};function W(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 $(t){return L(t)?function(e,n){return j(n,t)}:O(t)?t:_(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=$(t);return x(h.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={"*":o,tr:a,td:l,th:l,thead:s,tbody:s,tfoot:s};function X(t){if(!L(t))return[];if(Q.test(t))return[r(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 r=[],o=O(e),s=i&&$(i),a=0,l=t.length;a<l;a++)if(o){var u=e(t[a]);u.length&&g.apply(r,u)}else for(var c=t[a][e];!(null==c||i&&s(-1,c));)r.push(c),c=n?c[e]:null;return r}function tt(t){return t.multiple&&t.options?J(h.call(t.options,(function(t){return t.selected&&!t.disabled&&!t.parentNode.disabled})),"value"):t.value||""}function et(t){return t.length>1?h.call(t,(function(t,e,n){return d.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=$(t);return this.filter((function(n,i){return(!L(t)||I(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 r=u(t)?m.call(t,String):P(t)?[]:[String(t)];i?D(n.options,(function(t,e){e.selected=r.indexOf(e.value)>=0}),!0):n.checked=r.indexOf(n.value)>=0}else n.value=R(t)||P(t)?"":t})):this[0]&&tt(this[0])},T.is=function(t){var e=$(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 d.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,rt=["type","src","nonce","noModule"];function ot(t,e,n,o,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,o,s){o?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 o=r("script");o.text=n.textContent.replace(nt,""),D(rt,(function(t,e){n[e]&&(o[e]=n[e])})),e.head.insertBefore(o,null),e.head.removeChild(o)}}))}(e,t.ownerDocument)}(n?a:l,c?u.cloneNode(!0):u,o,s,!c)}),u)}),l)}),a),e}T.after=function(){return ot(arguments,this,!1,!1,!1,!0,!0)},T.append=function(){return ot(arguments,this,!1,!1,!0)},T.html=function(t){if(!arguments.length)return this[0]&&this[0].innerHTML;if(R(t))return this;var e=/<script[\s>]/.test(t);return this.each((function(n,i){I(i)&&(e?x(i).empty().append(t):i.innerHTML=t)}))},T.appendTo=function(t){return ot(arguments,this,!0,!1,!0)},T.wrapInner=function(t){return this.each((function(e,n){var i=x(n),r=i.contents();r.length?r.wrapAll(t):i.append(t)}))},T.before=function(){return ot(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 ot(arguments,this,!0,!1,!1,!1,!1,!0)},T.insertBefore=function(t){return ot(arguments,this,!0,!0)},T.prepend=function(){return ot(arguments,this,!1,!0,!0,!0,!0)},T.prependTo=function(t){return ot(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(f.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,r=t.offsetParent||i.documentElement;(r===i.body||r===i.documentElement)&&"static"===H(r,"position");)r=r.parentNode;if(r!==t&&I(r)){var o=x(r).offset();n.top-=o.top+q(r,"borderTopWidth"),n.left-=o.left+q(r,"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 ft={},ht=o.style,dt=["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(!ft[t]){var n=at(t),i="".concat(n[0].toUpperCase()).concat(n.slice(1));D("".concat(n," ").concat(dt.join("".concat(i," "))).concat(i).split(" "),(function(e,n){if(n in ht)return ft[t]=n,!1}))}return ft[t]}(t,n),arguments.length<2?this[0]&&H(this[0],t,n):t?(e=gt(t,e,n),this.each((function(i,r){I(r)&&(n?r.style.setProperty(t,e):r.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):R(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 N(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 R(i)?void 0:this;if(!arguments.length)return N(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 r=parseInt(i,10);return this.each((function(e,i){if(I(i)){var o=H(i,"boxSizing");i.style[n]=gt(n,r+("border-box"===o?B(i,!t):0))}}))}}));var bt="___cd";T.toggle=function(t){return this.each((function(n,i){if(I(i)){var o=W(i);(R(t)?o:t)?(i.style.display=i[bt]||"",W(i)&&(i.style.display=function(t){if(Y[t])return Y[t];var n=r(t);e.body.insertBefore(n,null);var i=H(n,"display");return e.body.removeChild(n),Y[t]="none"!==i?i:"block"}(i.tagName))):o||(i[bt]=H(i,"display"),i.style.display="none")}}))},T.hide=function(){return this.toggle(!1)},T.show=function(){return this.toggle(!0)};var wt="___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 _t(t){return t[wt]=t[wt]||{}}function Nt(t,e){return!e||!v.call(e,(function(e){return t.indexOf(e)<0}))}function Mt(t,e,n,i,r){var o=_t(t);if(e)o[e]&&(o[e]=o[e].filter((function(o){var s=o[0],a=o[1],l=o[2];if(r&&l.guid!==r.guid||!Nt(s,n)||i&&i!==a)return!0;t.removeEventListener(e,l)})));else for(e in o)Mt(t,e,n,i,r)}T.trigger=function(t,n){if(L(t)){var i=xt(t),r=i[0],o=i[1],s=Tt(r);if(!s)return this;var a=Et.test(s)?"MouseEvents":"HTMLEvents";(t=e.createEvent(a)).initEvent(s,!0,!0),t.namespace=o.join("."),t.___ot=r}t.___td=n;var l=t.___ot in At;return this.each((function(e,n){l&&O(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(R(t))this.each((function(t,e){(I(e)||M(e)||N(e))&&Mt(e)}));else if(L(t))O(e)&&(n=e,e=""),D(U(t),(function(t,r){var o=xt(r),s=o[0],a=o[1],l=Tt(s);i.each((function(t,i){(I(i)||M(i)||N(i))&&Mt(i,l,a,e,n)}))}));else for(var r in t)this.off(r,t[r]);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,r){var o=this;if(!L(t)){for(var s in t)this.on(s,e,n,t[s],r);return this}return L(e)||(R(e)||P(e)?e="":R(n)?(n=e,e=""):(i=n,n=e,e="")),O(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),f=l in St,h=l in At;c&&o.each((function(t,o){if(I(o)||M(o)||N(o)){var s=function(t){if(t.target["___i".concat(t.type)])return t.stopImmediatePropagation();if((!t.namespace||Nt(u,t.namespace.split(".")))&&(e||!(h&&(t.target!==o||t.___ot===c)||f&&t.relatedTarget&&o.contains(t.relatedTarget)))){var a=o;if(e){for(var l=t.target;!j(l,e);){if(l===o)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 o}}),Object.defineProperty(t,"data",{configurable:!0,get:function(){return n}});var d=i.call(a,t,t.___td);r&&Mt(o,c,u,e,s),!1===d&&(t.preventDefault(),t.stopPropagation())}};s.guid=i.guid=i.guid||x.guid++,function(t,e,n,i,r){var o=_t(t);o[e]=o[e]||[],o[e].push([n,i,r]),t.addEventListener(e,r)}(o,c,u,e,s)}}))})),this):this},T.one=function(t,e,n,i){return this.on(t,e,n,i,!0)};var It=/\r?\n/g,Ot=/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||Ot.test(n.type)||Lt.test(n.type)&&!n.checked)){var i=tt(n);R(i)||D(u(i)?i:[i],(function(e,i){t+=function(t,e){return"&".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(e.replace(It,"\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),r=n.n(i),o=n(6314),s=n.n(o)()(r());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),r=n.n(i),o=n(6314),s=n.n(o)()(r());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,r,o){"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!==o&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=o),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),r&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=r):c[4]="".concat(r)),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)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),o="/*# ".concat(r," */");return[e].concat([o]).join("\n")}return[e].join("\n")}},9982:function(t,e,n){var i;!function(e,r){var o={};!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,r,o){for(var s,a,l,u,c,f,h,d,m,g,p,v,y;o>=64;){for(s=n[0],a=n[1],l=n[2],u=n[3],c=n[4],f=n[5],h=n[6],d=n[7],g=0;g<16;g++)p=r+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&f^~c&h)|0)+(d+(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,d=h,h=f,f=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]+=f,n[6]+=h,n[7]+=d,r+=64,o-=64}return r}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,r=e/536870912|0,o=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]=r>>>24&255,this.buffer[s-7]=r>>>16&255,this.buffer[s-6]=r>>>8&255,this.buffer[s-5]=r>>>0&255,this.buffer[s-4]=o>>>24&255,this.buffer[s-3]=o>>>16&255,this.buffer[s-2]=o>>>8&255,this.buffer[s-1]=o>>>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 r=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 o(t){var e=(new i).update(t),n=e.digest();return e.clean(),n}function s(t,e){var n=new r(t).update(e),i=n.digest();return n.clean(),i}function a(t,e,n,i){var r=i[0];if(0===r)throw new Error("hkdf: cannot expand more");e.reset(),r>1&&e.update(t),n&&e.update(n),e.update(i),e.finish(t),i[0]++}t.HMAC=r,t.hash=o,t.default=o,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 o=new Uint8Array([1]),u=s(e,t),c=new r(u),f=new Uint8Array(c.digestLength),h=f.length,d=new Uint8Array(i),m=0;m<i;m++)h===f.length&&(a(f,c,n,o),h=0),d[m]=f[h++];return c.clean(),f.fill(0),o.fill(0),d},t.pbkdf2=function(t,e,n,i){for(var o=new r(t),s=o.digestLength,a=new Uint8Array(4),l=new Uint8Array(s),u=new Uint8Array(s),c=new Uint8Array(i),f=0;f*s<i;f++){var h=f+1;a[0]=h>>>24&255,a[1]=h>>>16&255,a[2]=h>>>8&255,a[3]=h>>>0&255,o.reset(),o.update(e),o.update(a),o.finish(u);for(var d=0;d<s;d++)l[d]=u[d];for(d=2;d<=n;d++){o.reset(),o.update(u).finish(u);for(var m=0;m<s;m++)l[m]^=u[m]}for(d=0;d<s&&f*s+d<i;d++)c[f*s+d]=l[d]}for(f=0;f<s;f++)l[f]=u[f]=0;for(f=0;f<4;f++)a[f]=0;return o.clean(),c}}(o);var s=o.default;for(var a in o)s[a]=o[a];"object"==typeof t.exports?t.exports=s:void 0===(i=function(){return s}.call(o,n,o,t))||(t.exports=i)}()},6572:function(t){var e;t.exports=(e=function(t,e){var n=Array.prototype.concat,i=Array.prototype.slice,r=Object.prototype.toString;function o(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]"===r.call(t)};function a(t){return"[object Function]"===r.call(t)}function l(t){return"number"==typeof t&&t-t==0}function u(){return new u._init(arguments)}function c(){return 0}function f(){return 1}function h(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:o,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(r){n[r][i]=t[r][e]}))})),n}for(var i=new Array(t.length),r=0;r<t.length;r++)i[r]=[t[r][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,r,o,a=[];for(s(t[0])||(t=[t]),n=t.length,i=t[0].length,o=0;o<i;o++){for(e=new Array(n),r=0;r<n;r++)e[r]=t[r][o];a.push(e)}return 1===a.length?a[0]:a},u.map=function(t,e,n){var i,r,o,a,l;for(s(t[0])||(t=[t]),r=t.length,o=t[0].length,a=n?t:new Array(r),i=0;i<r;i++)for(a[i]||(a[i]=new Array(o)),l=0;l<o;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,r,o,a,l;for(s(t[0])||(t=[t]),r=t.length,o=t[0].length,a=n?t:new Array(r),i=0;i<r;i++)for(a[i]||(a[i]=new Array(o)),o>0&&(a[i][0]=t[i][0]),l=1;l<o;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,r,o=new Array(t);for(a(e)&&(n=e,e=t),i=0;i<t;i++)for(o[i]=new Array(e),r=0;r<e;r++)o[i][r]=n(i,r);return o},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,f)},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,h)},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 r,s=[],l=o(t,e),u=(e*l-t*l)/((n-1)*l),c=t;for(r=0;c<=e&&r<n;c=(t*l+u*l*++r)/l)s.push(i?i(c,r):c);return s},u.arange=function(t,n,i){var r,o=[];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(r=t;r<n;r+=i)o.push(r);else for(r=t;r>n;r+=i)o.push(r);return o},u.slice=function(){function t(t,n,i,r){var o,s=[],a=t.length;if(n===e&&i===e&&r===e)return u.copy(t);if(r=r||1,(n=(n=n||0)>=0?n:a+n)===(i=(i=i||t.length)>=0?i:a+i)||0===r)return[];if(n<i&&r<0)return[];if(n>i&&r>0)return[];if(r>0)for(o=n;o<i;o+=r)s.push(t[o]);else for(o=n;o>i;o+=r)s.push(t[o]);return s}return function(e,n){var i,r;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),(r=n.row||{}).start,r.end,r.step):(r=n.row||{},i=n.col||{},t(e,r.start,r.end,r.step).map((function(e){return t(e,i.start,i.end,i.step)})))}}(),u.sliceAssign=function(n,i,r){var o,s;if(l(i.row)){if(l(i.col))return n[i.row][i.col]=r;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,o=u.arange(i.col.start,t.min(n.length,i.col.end),i.col.step);var a=i.row;return o.forEach((function(t,e){n[a][t]=r[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]=r[e]})),n}return r[0].length===e&&(r=[r]),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),o=u.arange(i.col.start,t.min(n[0].length,i.col.end),i.col.step),s.forEach((function(t,e){o.forEach((function(i,o){n[t][i]=r[e][o]}))})),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 d=u.prototype;return d.length=0,d.push=Array.prototype.push,d.sort=Array.prototype.sort,d.splice=Array.prototype.splice,d.slice=Array.prototype.slice,d.toArray=function(){return this.length>1?i.call(this):i.call(this)[0]},d.map=function(t,e){return u(u.map(this,t,e))},d.cumreduce=function(t,e){return u(u.cumreduce(this,t,e))},d.alter=function(t){return u.alter(this,t),this},function(t){for(var e=0;e<t.length;e++)!function(t){d[t]=function(e){var n,i=this;return e?(setTimeout((function(){e.call(i,d[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){d[t]=function(e,n){var i=this;return n?(setTimeout((function(){n.call(i,d[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){d[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 r(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),r=0,o=e.length;--o>=0;)r+=(n=e[o]-i)*n;return r},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),r=t.mean(i);return e.exp(r)},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=[],r={};for(e=0;e<t.length;e++)r[l=t[e]]?r[l]++:(r[l]=1,n.push(l));var o=n.sort(i),s={},a=1;for(e=0;e<o.length;e++){var l,u=r[l=o[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,r=t.slice().sort(i),o=1,s=0,a=0,l=[];for(e=0;e<n;e++)r[e]===r[e+1]?o++:(o>s?(l=[r[e]],s=o,a=0):o===s&&(l.push(r[e]),a++),o=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,r=new Array(i),o=0;o<i;o++)r[o]=e[o]-n;return r},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),r=[],o=n.length-1;o>=0;o--)r.push(e.abs(n[o]-i));return t.mean(r)},t.meddev=function(n){for(var i=t.median(n),r=[],o=n.length-1;o>=0;o--)r.push(e.abs(n[o]-i));return t.median(r)},t.coeffvar=function(e){return t.stdev(e)/t.mean(e)},t.quartiles=function(t){var n=t.length,r=t.slice().sort(i);return[r[e.round(n/4)-1],r[e.round(n/2)-1],r[e.round(3*n/4)-1]]},t.quantiles=function(t,n,o,s){var a,l,u,c,f,h=t.slice().sort(i),d=[n.length],m=t.length;for(void 0===o&&(o=3/8),void 0===s&&(s=3/8),a=0;a<n.length;a++)u=m*(l=n[a])+(o+l*(1-o-s)),c=e.floor(r(u,1,m-1)),f=r(u-c,0,1),d[a]=(1-f)*h[c-1]+f*h[c];return d},t.percentile=function(t,e,n){var r=t.slice().sort(i),o=e*(r.length+(n?1:-1))+(n?0:1),s=parseInt(o),a=o-s;return s+1<r.length?r[s-1]+a*(r[s]-r[s-1]):r[s-1]},t.percentileOfScore=function(t,e,n){var i,r,o=0,s=t.length,a=!1;for("strict"===n&&(a=!0),r=0;r<s;r++)i=t[r],(a&&i<e||!a&&i<=e)&&o++;return o/s},t.histogram=function(n,i){i=i||4;var r,o=t.min(n),s=(t.max(n)-o)/i,a=n.length,l=[];for(r=0;r<i;r++)l[r]=0;for(r=0;r<a;r++)l[e.min(e.floor((n[r]-o)/s),i-1)]+=1;return l},t.covariance=function(e,n){var i,r=t.mean(e),o=t.mean(n),s=e.length,a=new Array(s);for(i=0;i<s;i++)a[i]=(e[i]-r)*(n[i]-o);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 r=t.mean(n),o=t.stdev(n),s=n.length,a=0,l=0;l<s;l++)a+=e.pow((n[l]-r)/o,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 o=t.prototype;!function(e){for(var i=0;i<e.length;i++)!function(e){o[e]=function(i,r){var s=[],a=0,l=this;if(n(i)&&(r=i,i=!1),r)return setTimeout((function(){r.call(l,o[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){o[e]=function(i,r){var s=[],a=0,l=this;if(n(i)&&(r=i,i=!1),r)return setTimeout((function(){r.call(l,o[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){o[e]=function(){var i,r=[],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,o[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++)r[s]=c(a[s]);return r}return c(this[0])}}(e[i])}("quantiles percentileOfScore".split(" "))}(e,Math),function(t,e){t.gammaln=function(t){var n,i,r,o=0,s=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],a=1.000000000190015;for(r=(i=n=t)+5.5,r-=(n+.5)*e.log(r);o<6;o++)a+=s[o]/++i;return e.log(2.5066282746310007*a/n)-r},t.loggam=function(t){var n,i,r,o,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),r=2*e.PI,s=u[9],a=8;a>=0;a--)s*=i,s+=u[a];if(o=s/n+.5*e.log(r)+(n-.5)*e.log(n)-n,t<=7)for(a=1;a<=l;a++)o-=e.log(n-1),n-=1;return o},t.gammafn=function(t){var n,i,r,o,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,f=0,h=t;if(t>171.6243769536076)return 1/0;if(h<=0){if(!(o=h%1+36e-17))return 1/0;l=(1&h?-1:1)*e.PI/e.sin(e.PI*o),h=1-h}for(r=h,i=h<1?h++:(h-=u=(0|h)-1)-1,n=0;n<8;++n)f=(f+s[n])*i,c=c*i+a[n];if(o=f/c+1,r<h)o/=r;else if(r>h)for(n=0;n<u;++n)o*=h,h++;return l&&(o=l/o),o},t.gammap=function(e,n){return t.lowRegGamma(e,n)*t.gammafn(e)},t.lowRegGamma=function(n,i){var r,o=t.gammaln(n),s=n,a=1/n,l=a,u=i+1-n,c=1/1e-30,f=1/u,h=f,d=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(;d<=m;d++)a+=l*=i/++s;return a*e.exp(-i+n*e.log(i)-o)}for(;d<=m;d++)h*=(f=1/(f=(r=-d*(d-n))*f+(u+=2)))*(c=u+r/c);return 1-h*e.exp(-i+n*e.log(i)-o)},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 r,o,s,a,l=1e-30,u=1,c=n+i,f=n+1,h=n-1,d=1,m=1-c*t/f;for(e.abs(m)<l&&(m=l),a=m=1/m;u<=100&&(m=1+(o=u*(i-u)*t/((h+(r=2*u))*(n+r)))*m,e.abs(m)<l&&(m=l),d=1+o/d,e.abs(d)<l&&(d=l),a*=(m=1/m)*d,m=1+(o=-(n+u)*(c+u)*t/((n+r)*(f+r)))*m,e.abs(m)<l&&(m=l),d=1+o/d,e.abs(d)<l&&(d=l),a*=s=(m=1/m)*d,!(e.abs(s-1)<3e-7));u++);return a},t.gammapinv=function(n,i){var r,o,s,a,l,u,c=0,f=i-1,h=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(f),u=e.exp(f*(l-1)-h),a=n<.5?n:1-n,r=(2.30753+.27061*(o=e.sqrt(-2*e.log(a))))/(1+o*(.99229+.04481*o))-o,n<.5&&(r=-r),r=e.max(.001,i*e.pow(1-1/(9*i)-r/(3*e.sqrt(i)),3))):r=n<(o=1-i*(.253+.12*i))?e.pow(n/o,1/i):1-e.log(1-(n-o)/(1-o));c<12;c++){if(r<=0)return 0;if((r-=o=(s=(t.lowRegGamma(i,r)-n)/(o=i>1?u*e.exp(-(r-f)+f*(e.log(r)-l)):e.exp(-r+f*e.log(r)-h)))/(1-.5*e.min(1,s*((i-1)/r-1))))<=0&&(r=.5*(r+o)),e.abs(o)<1e-8*r)break}return r},t.erf=function(t){var n,i,r,o,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--)r=u,u=i*u-c+s[a],c=r;return o=n*e.exp(-t*t+.5*(s[0]+i*u)-c),l?o-1:1-o},t.erfc=function(e){return 1-t.erf(e)},t.erfcinv=function(n){var i,r,o,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*(o=e.sqrt(-2*e.log(s/2))))/(1+o*(.99229+.04481*o))-o);a<2;a++)i+=(r=t.erfc(i)-s)/(1.1283791670955126*e.exp(-i*i)-i*r);return n<1?i:-i},t.ibetainv=function(n,i,r){var o,s,a,l,u,c,f,h,d,m,g=i-1,p=r-1,v=0;if(n<=0)return 0;if(n>=1)return 1;for(i>=1&&r>=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),f=(c*c-3)/6,h=2/(1/(2*i-1)+1/(2*r-1)),d=c*e.sqrt(f+h)/h-(1/(2*r-1)-1/(2*i-1))*(f+5/6-2/(3*h)),c=i/(i+r*e.exp(2*d))):(o=e.log(i/(i+r)),s=e.log(r/(i+r)),c=n<(l=e.exp(i*o)/i)/(d=l+(u=e.exp(r*s)/r))?e.pow(i*d*n,1/i):1-e.pow(r*d*(1-n),1/r)),m=-t.gammaln(i)-t.gammaln(r)+t.gammaln(i+r);v<10;v++){if(0===c||1===c)return c;if((c-=l=(u=(t.ibeta(c,i,r)-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,r){var o=0===n||1===n?0:e.exp(t.gammaln(i+r)-t.gammaln(i)-t.gammaln(r)+i*e.log(n)+r*e.log(1-n));return!(n<0||n>1)&&(n<(i+1)/(i+r+2)?o*t.betacf(n,i,r)/i:1-o*t.betacf(1-n,r,i)/r)},t.randn=function(n,i){var r,o,s,a,l;if(i||(i=n),n)return t.create(n,i,(function(){return t.randn()}));do{r=t._random_fn(),o=1.7156*(t._random_fn()-.5),l=(s=r-.449871)*s+(a=e.abs(o)+.386595)*(.196*a-.25472*s)}while(l>.27597&&(l>.27846||o*o>-4*e.log(r)*r*r));return o/r},t.randg=function(n,i,r){var o,s,a,l,u,c,f=n;if(r||(r=i),n||(n=1),i)return(c=t.zeros(i,r)).alter((function(){return t.randg(n)})),c;n<1&&(n+=1),o=n-1/3,s=1/e.sqrt(9*o);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+o*(1-l+e.log(l)));if(n==f)return o*l;do{a=t._random_fn()}while(0===a);return e.pow(a,1/f)*o*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,r){for(var o,s=0,a=1,l=1,u=1,c=0,f=0;e.abs((l-f)/l)>r;)f=l,a=u+(o=-(n+c)*(n+i+c)*t/(n+2*c)/(n+2*c+1))*a,l=(s=l+o*s)+(o=(c+=1)*(i-c)*t/(n+2*c-1)/(n+2*c))*l,s/=u=a+o*u,a/=u,l/=u,u=1;return l/n}function i(n,i,r){var o=[.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/r)?e.pow(u,r):0;for(var c=a,f=(8-a)/(l=n>3?2:3),h=c+f,d=0,m=r-1,g=1;g<=l;g++){for(var p=0,v=.5*(h+c),y=.5*(h-c),C=1;C<=12;C++){var b,w=v+y*(6<C?o[(b=12-C+1)-1]:-o[(b=C)-1]),A=w*w;if(A>60)break;var S=2*t.normal.cdf(w,0,1,1,0)*.5-2*t.normal.cdf(w,n,1,1,0)*.5;S>=e.exp(-30/m)&&(p+=S=s[b-1]*e.exp(-.5*A)*e.pow(S,m))}d+=p*=2*y*r/e.sqrt(2*e.PI),c=h,h+=f}return(u+=d)<=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,r){var o=t[e](n,i,r);return o.data=this,o},t[e].prototype.sample=function(n){var i=this._a,r=this._b,o=this._c;return n?t.alter(n,(function(){return t[e].sample(i,r,o)})):t[e].sample(i,r,o)},function(n){for(var i=0;i<n.length;i++)!function(n){t[e].prototype[n]=function(i){var r=this._a,o=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,r,o,s)})):t[e][n](i,r,o,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,r){return n>1||n<0?0:1==i&&1==r?1:i<512&&r<512?e.pow(n,i-1)*e.pow(1-n,r-1)/t.betafn(i,r):e.exp((i-1)*e.log(n)+(r-1)*e.log(1-n)-t.betaln(i,r))},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,r){var o;return n<0?0:i<=2?0===n&&i<2?1/0:0===n&&2===i?1:1/t.betafn(i/2,r/2)*e.pow(i/r,i/2)*e.pow(n,i/2-1)*e.pow(1+i/r*n,-(i+r)/2):(o=i*n/(r+n*i),i*(r/(r+n*i))/2*t.binomial.pdf((i-2)/2,(i+r-2)/2,o))},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,r){return n<0?0:0===n&&1===i?1/r:e.exp((i-1)*e.log(n)-n/r-t.gammaln(i)-i*e.log(r))},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,r){return n<=0?0:e.exp(-(i+1)*e.log(n)-r/n-t.gammaln(i)+i*e.log(r))},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,r){return n<0?0:.5+.5*t.erf((e.log(n)-i)/e.sqrt(2*r*r))},inv:function(n,i,r){return e.exp(-1.4142135623730951*r*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,r){return e.abs(r)<1e-14?t.studentt.pdf(n,i):e.abs(n)<1e-14?e.exp(t.gammaln((i+1)/2)-r*r/2-.5*e.log(e.PI*i)-t.gammaln(i/2)):i/n*(t.noncentralt.cdf(n*e.sqrt(1+2/i),i+2,r)-t.noncentralt.cdf(n,i,r))},cdf:function(n,i,r){var o=1e-14;if(e.abs(r)<o)return t.studentt.cdf(n,i);var s=!1;n<0&&(s=!0,r=-r);for(var a=t.normal.cdf(-r,0,1),l=o+1,u=l,c=n*n/(n*n+i),f=0,h=e.exp(-r*r/2),d=e.exp(-r*r/2-.5*e.log(2)-t.gammaln(1.5))*r;f<200||u>o||l>o;)u=l,f>0&&(h*=r*r/(2*f),d*=r*r/(2*(f+.5))),a+=.5*(l=h*t.beta.cdf(c,f+.5,i/2)+d*t.beta.cdf(c,f+1,i/2)),f++;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,r){return.5*(1+t.erf((n-i)/e.sqrt(2*r*r)))},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 r=i/2;return t.ibeta((n+e.sqrt(n*n+i))/(2*e.sqrt(n*n+i)),r,r)},inv:function(n,i){var r=t.ibetainv(2*e.min(n,1-n),.5*i,.5);return r=e.sqrt(i*(1-r)/r),n>.5?r:-r},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,r){return 0===r||1===r?i*r===n?1:0:t.combination(i,n)*e.pow(r,n)*e.pow(1-r,i-n)},cdf:function(i,r,o){var s,a=1e-10;if(i<0)return 0;if(i>=r)return 1;if(o<0||o>1||r<=0)return NaN;var l=o,u=(i=e.floor(i))+1,c=r-i,f=u+c,h=e.exp(t.gammaln(f)-t.gammaln(c)-t.gammaln(u)+u*e.log(l)+c*e.log(1-l));return s=l<(u+1)/(f+2)?h*n(l,u,c,a):1-h*n(1-l,c,u,a),e.round(1/a*(1-s))/(1/a)}}),t.extend(t.negbin,{pdf:function(n,i,r){return n===n>>>0&&(n<0?0:t.combination(n+i-1,i-1)*e.pow(1-r,n)*e.pow(r,i))},cdf:function(e,n,i){var r=0,o=0;if(e<0)return 0;for(;o<=e;o++)r+=t.negbin.pdf(o,n,i);return r}}),t.extend(t.hypgeom,{pdf:function(n,i,r,o){if(n!=n|0)return!1;if(n<0||n<r-(i-o))return 0;if(n>o||n>r)return 0;if(2*r>i)return 2*o>i?t.hypgeom.pdf(i-r-o+n,i,i-r,i-o):t.hypgeom.pdf(o-n,i,i-r,o);if(2*o>i)return t.hypgeom.pdf(r-n,i,r,i-o);if(r<o)return t.hypgeom.pdf(n,i,o,r);for(var s=1,a=0,l=0;l<n;l++){for(;s>1&&a<o;)s*=1-r/(i-a),a++;s*=(o-l)*(r-l)/((l+1)*(i-r-o+l+1))}for(;a<o;a++)s*=1-r/(i-a);return e.min(1,e.max(0,s))},cdf:function(n,i,r,o){if(n<0||n<r-(i-o))return 0;if(n>=o||n>=r)return 1;if(2*r>i)return 2*o>i?t.hypgeom.cdf(i-r-o+n,i,i-r,i-o):1-t.hypgeom.cdf(o-n-1,i,i-r,o);if(2*o>i)return 1-t.hypgeom.cdf(r-n-1,i,r,i-o);if(r<o)return t.hypgeom.cdf(n,i,o,r);for(var s=1,a=1,l=0,u=0;u<n;u++){for(;s>1&&l<o;){var c=1-r/(i-l);a*=c,s*=c,l++}s+=a*=(o-u)*(r-u)/((u+1)*(i-r-o+u+1))}for(;l<o;l++)s*=1-r/(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=[],r=0;if(e<0)return 0;for(;r<=e;r++)i.push(t.poisson.pdf(r,n));return t.sum(i)},mean:function(t){return t},variance:function(t){return t},sampleSmall:function(n){var i=1,r=0,o=e.exp(-n);do{r++,i*=t._random_fn()}while(i>o);return r-1},sampleLarge:function(n){var i,r,o,s,a,l,u,c,f,h,d=n;for(s=e.sqrt(d),a=e.log(d),l=.02483*(u=.931+2.53*s)-.059,c=1.1239+1.1328/(u-3.4),f=.9277-3.6224/(u-2);;){if(r=e.random()-.5,o=e.random(),h=.5-e.abs(r),i=e.floor((2*l/h+u)*r+d+.43),h>=.07&&o<=f)return i;if(!(i<0||h<.013&&o>h)&&e.log(o)+e.log(c)-e.log(l/(h*h)+u)<=i*a-d-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,r){return i<=n||r<n||r>i?NaN:t<=n?0:t>=i?1:t<=r?e.pow(t-n,2)/((i-n)*(r-n)):1-e.pow(i-t,2)/((i-n)*(i-r))},inv:function(t,n,i,r){return i<=n||r<n||r>i?NaN:t<=(r-n)/(i-n)?n+(i-n)*e.sqrt(t*((r-n)/(i-n))):n+(i-n)*(1-e.sqrt((1-t)*(1-(r-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,r){var o=t._random_fn();return o<(r-n)/(i-n)?n+e.sqrt(o*(i-n)*(r-n)):i-e.sqrt((1-o)*(i-n)*(i-r))},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 r,o=t._random_fn()-.5;return n-i*((r=o)/e.abs(r))*e.log(1-2*e.abs(o))}}),t.extend(t.tukey,{cdf:function(n,r,o){var s=r,a=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],l=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(n<=0)return 0;if(o<2||s<2)return NaN;if(!Number.isFinite(n))return 1;if(o>25e3)return i(n,1,s);var u,c=.5*o,f=c*e.log(o)-o*e.log(2)-t.gammaln(c),h=c-1,d=.25*o;u=o<=100?1:o<=800?.5:o<=5e3?.25:.125,f+=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,b;8<y?(C=y-8-1,b=f+h*e.log(v+a[C]*u)-(a[C]*u+v)*d):(C=y-1,b=f+h*e.log(v-a[C]*u)+(a[C]*u-v)*d),b>=-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(b))}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,r){if(r<2||i<2)return NaN;if(n<0||n>1)return NaN;if(0===n)return 0;if(1===n)return 1/0;var o,s=function(t,n,i){var r=.5-.5*t,o=e.sqrt(e.log(1/(r*r))),s=o+((((-453642210148e-16*o-.204231210125)*o-.342242088547)*o-1)*o+.322232421088)/((((.0038560700634*o+.10353775285)*o+.531103462366)*o+.588581570495)*o+.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,r),a=t.tukey.cdf(s,i,r)-n;o=a>0?e.max(0,s-1):s+1;for(var l,u=t.tukey.cdf(o,i,r)-n,c=1;c<50;c++)if(l=o-u*(o-s)/(u-a),a=u,s=o,l<0&&(l=0,u=-n),u=t.tukey.cdf(l,i,r)-n,o=l,e.abs(o-s)<1e-4)return l;throw new Error("tukey.inv failed to converge")}})}(e,Math),function(t,e){var n,i,r=Array.prototype.push,o=t.utils.isArray;function s(e){return o(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,r,o,a,l,u,c,f;if(void 0===e.length&&void 0===n.length)return e*n;if(l=e.length,u=e[0].length,c=t.zeros(l,o=s(n)?n[0].length:u),f=0,s(n)){for(;f<o;f++)for(i=0;i<l;i++){for(a=0,r=0;r<u;r++)a+=e[i][r]*n[r][f];c[i][f]=a}return 1===l&&1===f?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,r,o=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=o.length,f=o[0].length;u<c;u++){for(l[u]=[],i=0,r=0;r<f;r++)i+=o[u][r]*a[u][r];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,r=0;for(isNaN(n)&&(n=2),s(t[0])&&(t=t[0]);r<t.length;r++)i+=e.pow(e.abs(t[r]),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++)r.apply(i[n],e[n]);return i},inv:function(e){for(var n,i=e.length,r=e[0].length,o=t.identity(i,r),s=t.gauss_jordan(e,o),a=[],l=0;l<i;l++)for(a[l]=[],n=r;n<s[0].length;n++)a[l][n-r]=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 r=[],o=1;o<e.length;o++){r[o-1]=[];for(var s=0;s<e.length;s++)s<i?r[o-1][s]=e[o][s]:s>i&&(r[o-1][s-1]=e[o][s])}var a=i%2?-1:1;n+=t(r)*e[0][i]*a}return n},gauss_elimination:function(n,i){var r,o,s,a,l=0,u=0,c=n.length,f=n[0].length,h=1,d=0,m=[];for(r=(n=t.aug(n,i))[0].length,l=0;l<c;l++){for(o=n[l][l],u=l,a=l+1;a<f;a++)o<e.abs(n[a][l])&&(o=n[a][l],u=a);if(u!=l)for(a=0;a<r;a++)s=n[l][a],n[l][a]=n[u][a],n[u][a]=s;for(u=l+1;u<c;u++)for(h=n[u][l]/n[l][l],a=l;a<r;a++)n[u][a]=n[u][a]-h*n[l][a]}for(l=c-1;l>=0;l--){for(d=0,u=l+1;u<=c-1;u++)d+=m[u]*n[l][u];m[l]=(n[l][r-1]-d)/n[l][l]}return m},gauss_jordan:function(n,i){var r,o,s,a=t.aug(n,i),l=a.length,u=a[0].length,c=0;for(o=0;o<l;o++){var f=o;for(s=o+1;s<l;s++)e.abs(a[s][o])>e.abs(a[f][o])&&(f=s);var h=a[o];for(a[o]=a[f],a[f]=h,s=o+1;s<l;s++)for(c=a[s][o]/a[o][o],r=o;r<u;r++)a[s][r]-=a[o][r]*c}for(o=l-1;o>=0;o--){for(c=a[o][o],s=0;s<o;s++)for(r=u-1;r>o-1;r--)a[s][r]-=a[o][r]*a[s][o]/c;for(a[o][o]/=c,r=l;r<u;r++)a[o][r]/=c}return a},triaUpSolve:function(e,n){var i,r=e[0].length,o=t.zeros(1,r)[0],s=!1;return null!=n[0].length&&(n=n.map((function(t){return t[0]})),s=!0),t.arange(r-1,-1,-1).forEach((function(s){i=t.arange(s+1,r).map((function(t){return o[t]*e[s][t]})),o[s]=(n[s]-t.sum(i))/e[s][s]})),s?o.map((function(t){return[t]})):o},triaLowSolve:function(e,n){var i,r=e[0].length,o=t.zeros(1,r)[0],s=!1;return null!=n[0].length&&(n=n.map((function(t){return t[0]})),s=!0),t.arange(r).forEach((function(r){i=t.arange(r).map((function(t){return e[r][t]*o[t]})),o[r]=(n[r]-t.sum(i))/e[r][r]})),s?o.map((function(t){return[t]})):o},lu:function(e){var n,i=e.length,r=t.identity(i),o=t.zeros(e.length,e[0].length);return t.arange(i).forEach((function(t){o[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 r[s][t]*o[t][i]})),r[s][i]=(e[s][i]-t.sum(n))/o[i][i]})),t.arange(s,i).forEach((function(i){n=t.arange(s).map((function(t){return r[s][t]*o[t][i]})),o[s][i]=e[n.length][i]-t.sum(n)}))})),[r,o]},cholesky:function(n){var i,r=n.length,o=t.zeros(n.length,n[0].length);return t.arange(r).forEach((function(s){i=t.arange(s).map((function(t){return e.pow(o[s][t],2)})),o[s][s]=e.sqrt(n[s][s]-t.sum(i)),t.arange(s+1,r).forEach((function(e){i=t.arange(s).map((function(t){return o[s][t]*o[e][t]})),o[e][s]=(n[s][e]-t.sum(i))/o[s][s]}))})),o},gauss_jacobi:function(n,i,r,o){for(var s,a,l,u,c=0,f=0,h=n.length,d=[],m=[],g=[];c<h;c++)for(d[c]=[],m[c]=[],g[c]=[],f=0;f<h;f++)c>f?(d[c][f]=n[c][f],m[c][f]=g[c][f]=0):c<f?(m[c][f]=n[c][f],d[c][f]=g[c][f]=0):(g[c][f]=n[c][f],d[c][f]=m[c][f]=0);for(l=t.multiply(t.multiply(t.inv(g),t.add(d,m)),-1),a=t.multiply(t.inv(g),i),s=r,u=t.add(t.multiply(l,r),a),c=2;e.abs(t.norm(t.subtract(u,s)))>o;)s=u,u=t.add(t.multiply(l,s),a),c++;return u},gauss_seidel:function(n,i,r,o){for(var s,a,l,u,c,f=0,h=n.length,d=[],m=[],g=[];f<h;f++)for(d[f]=[],m[f]=[],g[f]=[],s=0;s<h;s++)f>s?(d[f][s]=n[f][s],m[f][s]=g[f][s]=0):f<s?(m[f][s]=n[f][s],d[f][s]=g[f][s]=0):(g[f][s]=n[f][s],d[f][s]=m[f][s]=0);for(u=t.multiply(t.multiply(t.inv(t.add(g,d)),m),-1),l=t.multiply(t.inv(t.add(g,d)),i),a=r,c=t.add(t.multiply(u,r),l),f=2;e.abs(t.norm(t.subtract(c,a)))>o;)a=c,c=t.add(t.multiply(u,a),l),f+=1;return c},SOR:function(n,i,r,o,s){for(var a,l,u,c,f,h=0,d=n.length,m=[],g=[],p=[];h<d;h++)for(m[h]=[],g[h]=[],p[h]=[],a=0;a<d;a++)h>a?(m[h][a]=n[h][a],g[h][a]=p[h][a]=0):h<a?(g[h][a]=n[h][a],m[h][a]=p[h][a]=0):(p[h][a]=n[h][a],m[h][a]=g[h][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=r,f=t.add(t.multiply(c,r),u),h=2;e.abs(t.norm(t.subtract(f,l)))>o;)l=f,f=t.add(t.multiply(c,l),u),h++;return f},householder:function(n){for(var i,r,o,s,a=n.length,l=n[0].length,u=0,c=[],f=[];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),r=e.sqrt((i*i-n[u+1][u]*i)/2),(c=t.zeros(a,1))[u+1][0]=(n[u+1][u]-i)/(2*r),o=u+2;o<a;o++)c[o][0]=n[o][u]/(2*r);f=t.subtract(t.identity(a,l),t.multiply(t.multiply(c,t.transpose(c)),2)),n=t.multiply(f,t.multiply(n,f))}return n},QR:(n=t.sum,i=t.arange,function(r){var o,s,a,l=r.length,u=r[0].length,c=t.zeros(u,u);for(r=t.copy(r),s=0;s<u;s++){for(c[s][s]=e.sqrt(n(i(l).map((function(t){return r[t][s]*r[t][s]})))),o=0;o<l;o++)r[o][s]=r[o][s]/c[s][s];for(a=s+1;a<u;a++)for(c[s][a]=n(i(l).map((function(t){return r[t][s]*r[t][a]}))),o=0;o<l;o++)r[o][a]=r[o][a]-r[o][s]*c[s][a]}return[r,c]}),lstsq:function(e,n){var i=!1;void 0===n[0].length&&(n=n.map((function(t){return[t]})),i=!0);var r=t.QR(e),o=r[0],s=r[1],a=e[0].length,l=t.slice(o,{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(r){var o=t.multiply(e[r][n],-1),s=t.slice(e,{row:r}),a=t.multiply(t.slice(e,{row:n}),o);t.sliceAssign(e,{row:r},t.add(s,a));var l=t.slice(i,{row:r}),u=t.multiply(t.slice(i,{row:n}),o);t.sliceAssign(i,{row:r},t.add(l,u))}))})),i}(t.slice(s,{row:{end:a}})),c=t.transpose(l);void 0===c[0].length&&(c=[c]);var f=t.multiply(t.multiply(u,c),n);return void 0===f.length&&(f=[[f]]),i?f.map((function(t){return t[0]})):f},jacobi:function(n){for(var i,r,o,s,a,l,u,c=1,f=n.length,h=t.identity(f,f),d=[];1===c;){for(a=n[0][1],o=0,s=1,i=0;i<f;i++)for(r=0;r<f;r++)i!=r&&a<e.abs(n[i][r])&&(a=e.abs(n[i][r]),o=i,s=r);for(l=n[o][o]===n[s][s]?n[o][s]>0?e.PI/4:-e.PI/4:e.atan(2*n[o][s]/(n[o][o]-n[s][s]))/2,(u=t.identity(f,f))[o][o]=e.cos(l),u[o][s]=-e.sin(l),u[s][o]=e.sin(l),u[s][s]=e.cos(l),h=t.multiply(h,u),n=t.multiply(t.multiply(t.inv(u),n),u),c=0,i=1;i<f;i++)for(r=1;r<f;r++)i!=r&&e.abs(n[i][r])>.001&&(c=1)}for(i=0;i<f;i++)d.push(n[i][i]);return[h,d]},rungekutta:function(t,e,n,i,r,o){var s,a,l;if(2===o)for(;i<=n;)r+=((s=e*t(i,r))+(a=e*t(i+e,r+s)))/2,i+=e;if(4===o)for(;i<=n;)r+=((s=e*t(i,r))+2*(a=e*t(i+e/2,r+s/2))+2*(l=e*t(i+e/2,r+a/2))+e*t(i+e,r+l))/6,i+=e;return r},romberg:function(t,n,i,r){for(var o,s,a,l,u,c=0,f=(i-n)/2,h=[],d=[],m=[];c<r/2;){for(u=t(n),a=n,l=0;a<=i;a+=f,l++)h[l]=a;for(o=h.length,a=1;a<o-1;a++)u+=(a%2!=0?4:2)*t(h[a]);u=f/3*(u+t(i)),m[c]=u,f/=2,c++}for(s=m.length,o=1;1!==s;){for(a=0;a<s-1;a++)d[a]=(e.pow(4,o)*m[a+1]-m[a])/(e.pow(4,o)-1);s=d.length,m=d,d=[],o++}return m},richardson:function(t,n,i,r){function o(t,e){for(var n,i=0,r=t.length;i<r;i++)t[i]===e&&(n=i);return n}for(var s,a,l,u,c,f=e.abs(i-t[o(t,i)+1]),h=0,d=[],m=[];r>=f;)s=o(t,i+r),a=o(t,i),d[h]=(n[s]-2*n[a]+n[2*a-s])/(r*r),r/=2,h++;for(u=d.length,l=1;1!=u;){for(c=0;c<u-1;c++)m[c]=(e.pow(4,l)*d[c+1]-d[c])/(e.pow(4,l)-1);u=m.length,d=m,m=[],l++}return d},simpson:function(t,e,n,i){for(var r,o=(n-e)/i,s=t(e),a=[],l=e,u=0,c=1;l<=n;l+=o,u++)a[u]=l;for(r=a.length;c<r-1;c++)s+=(c%2!=0?4:2)*t(a[c]);return o/3*(s+t(n))},hermite:function(t,e,n,i){for(var r,o=t.length,s=0,a=0,l=[],u=[],c=[],f=[];a<o;a++){for(l[a]=1,r=0;r<o;r++)a!=r&&(l[a]*=(i-t[r])/(t[a]-t[r]));for(u[a]=0,r=0;r<o;r++)a!=r&&(u[a]+=1/(t[a]-t[r]));c[a]=(1-2*(i-t[a])*u[a])*(l[a]*l[a]),f[a]=(i-t[a])*(l[a]*l[a]),s+=c[a]*e[a]+f[a]*n[a]}return s},lagrange:function(t,e,n){for(var i,r,o=0,s=0,a=t.length;s<a;s++){for(r=e[s],i=0;i<a;i++)s!=i&&(r*=(n-t[i])/(t[s]-t[i]));o+=r}return o},cubic_spline:function(e,n,i){for(var r,o,s=e.length,a=0,l=[],u=[],c=[],f=[],h=[],d=[];a<s-1;a++)f[a]=e[a+1]-e[a];for(c[0]=0,a=1;a<s-1;a++)c[a]=3/f[a]*(n[a+1]-n[a])-3/f[a-1]*(n[a]-n[a-1]);for(a=1;a<s-1;a++)l[a]=[],u[a]=[],l[a][a-1]=f[a-1],l[a][a]=2*(f[a-1]+f[a]),l[a][a+1]=f[a],u[a][0]=c[a];for(o=t.multiply(t.inv(l),u),r=0;r<s-1;r++)h[r]=(n[r+1]-n[r])/f[r]-f[r]*(o[r+1][0]+2*o[r][0])/3,d[r]=(o[r+1][0]-o[r][0])/(3*f[r]);for(r=0;r<s&&!(e[r]>i);r++);return n[r-=1]+(i-e[r])*h[r]+t.sq(i-e[r])*o[r]+(i-e[r])*t.sq(i-e[r])*d[r]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(e){var n,i,r,o,s,a=e.length,l=e[0].length,u=0,c=[],f=[],h=[],d=[],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=(r=t.jacobi(g))[0],f=r[1],p=t.transpose(s),u=0;u<f.length;u++)for(n=u;n<f.length;n++)f[u]<f[n]&&(i=f[u],f[u]=f[n],f[n]=i,h=p[u],p[u]=p[n],p[n]=h);for(o=t.transpose(m),u=0;u<a;u++)for(d[u]=[],n=0;n<o.length;n++)d[u][n]=t.dot([p[u]],[o[n]]);return[e,f,p,d]}}),function(e){for(var n=0;n<e.length;n++)!function(e){t.fn[e]=function(n,i){var r=this;return i?(setTimeout((function(){i.call(r,t.fn[e].call(r,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,r=t.utils.isArray;function o(t,n,i,r){if(t>1||i>1||t<=0||i<=0)throw new Error("Proportions should be greater than 0 and less than 1");var o=(t*n+i*r)/(n+r);return(t-i)/e.sqrt(o*(1-o)*(1/n+1/r))}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,o=n.call(arguments);return r(o[1])?(i=t.zscore(o[0],o[1],o[3]),1===o[2]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1)):o.length>2?(i=t.zscore(o[0],o[1],o[2]),1===o[3]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1)):(i=o[0],1===o[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,r){var o=e.abs(this.zscore(n,r));return 1===i?t.normal.cdf(-o,0,1):2*t.normal.cdf(-o,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 r,o=n.call(arguments);return 5===o.length?(r=e.abs(t.tscore(o[0],o[1],o[2],o[3])),1===o[4]?t.studentt.cdf(-r,o[3]-1):2*t.studentt.cdf(-r,o[3]-1)):i(o[1])?(r=e.abs(o[0]),1==o[2]?t.studentt.cdf(-r,o[1]-1):2*t.studentt.cdf(-r,o[1]-1)):(r=e.abs(t.tscore(o[0],o[1])),1==o[2]?t.studentt.cdf(-r,o[1].length-1):2*t.studentt.cdf(-r,o[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,r,o,s,a,l,u,c,f=n.call(arguments);if(1===f.length){for(a=new Array(f[0].length),u=0;u<f[0].length;u++)a[u]=f[0][u];f=a}for(r=new Array,u=0;u<f.length;u++)r=r.concat(f[u]);for(o=t.mean(r),i=0,u=0;u<f.length;u++)i+=f[u].length*e.pow(t.mean(f[u])-o,2);for(i/=f.length-1,l=0,u=0;u<f.length;u++)for(s=t.mean(f[u]),c=0;c<f[u].length;c++)l+=e.pow(f[u][c]-s,2);return i/(l/(r.length-f.length))},anovaftest:function(){var e,r,o,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,o=0,s=0;s<a.length;s++)o+=a[s].length;return r=o-e-1,1-t.centralF.cdf(l,e,r)},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 r,o,s,a,l,u=n.call(arguments);return i(u[0])?(r=u[0],o=u[1],s=u[2],a=u[3],l=u[4]):(r=t.mean(u[0]),o=t.mean(u[1]),s=u[0].length,a=u[1].length,l=u[2]),e.abs(r-o)/(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 r=i[0],o=i[1];return 1-t.tukey.cdf(e,o,r-o)},tukeyhsd:function(e){for(var n=t.pooledstdev(e),i=e.map((function(e){return t.mean(e)})),r=e.reduce((function(t,e){return t+e.length}),0),o=[],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,r,e.length);o.push([[s,a],l])}return o}}),t.extend({normalci:function(){var i,r=n.call(arguments),o=new Array(2);return i=4===r.length?e.abs(t.normal.inv(r[1]/2,0,1)*r[2]/e.sqrt(r[3])):e.abs(t.normal.inv(r[1]/2,0,1)*t.stdev(r[2])/e.sqrt(r[2].length)),o[0]=r[0]-i,o[1]=r[0]+i,o},tci:function(){var i,r=n.call(arguments),o=new Array(2);return i=4===r.length?e.abs(t.studentt.inv(r[1]/2,r[3]-1)*r[2]/e.sqrt(r[3])):e.abs(t.studentt.inv(r[1]/2,r[2].length-1)*t.stdev(r[2],!0)/e.sqrt(r[2].length)),o[0]=r[0]-i,o[1]=r[0]+i,o},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,r){var s=o(e,n,i,r);return t.ztest(s,1)},twoSidedDifferenceOfProportions:function(e,n,i,r){var s=o(e,n,i,r);return t.ztest(s,2)}})}(e,Math),e.models=function(){function t(t,n){var i=t.length,r=n[0].length-1,o=i-r-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)}))),f=e.sum(t.map((function(t,e){return Math.pow(t-a[e],2)}))),h=c+f;return{exog:n,endog:t,nobs:i,df_model:r,df_resid:o,coef:s,predict:a,resid:l,ybar:u,SST:h,SSE:c,SSR:f,R2:c/h}}function n(n){var i,r,o=(i=n.exog,r=i[0].length,e.arange(r).map((function(n){var o=e.arange(r).filter((function(t){return t!==n}));return t(e.col(i,n).map((function(t){return t[0]})),e.col(i,o))}))),s=Math.sqrt(n.SSR/n.df_resid),a=o.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),f=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:f}}return{ols:function(i,r){var o=t(i,r),s=n(o),a=function(t){var n,i,r,o=t.R2/t.df_model/((1-t.R2)/t.df_resid);return{F_statistic:o,pvalue:1-(n=o,i=t.df_model,r=t.df_resid,e.beta.cdf(n/(r/i+n),i/2,r/2))}}(o),l=1-(1-o.R2)*((o.nobs-1)/o.df_resid);return o.t=s,o.f=a,o.adjust_R2=l,o}}}(),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,r,o,s,a;if(t.cols()==n.rows()){if(n.rows()>1){for(s=[],i=0;i<t.rows();i++)for(s[i]=[],r=0;r<n.cols();r++){for(a=0,o=0;o<t.cols();o++)a+=t.toArray()[i][o]*n.toArray()[o][r];s[i][r]=a}return e(s)}for(s=[],i=0;i<t.rows();i++)for(s[i]=[],r=0;r<n.cols();r++){for(a=0,o=0;o<t.cols();o++)a+=t.toArray()[i][o]*n.toArray()[r];s[i][r]=a}return e(s)}},regress:function(t,n){var i=e.xtranspxinv(t),r=t.transpose(),o=e.matrixmult(e(i),r);return e.matrixmult(o,n)},regresst:function(t,n,i){var r=e.regress(t,n),o={anova:{}},s=e.jMatYBar(t,r);o.yBar=s;var a=n.mean();o.anova.residuals=e.residuals(n,s),o.anova.ssr=e.ssr(s,a),o.anova.msr=o.anova.ssr/(t[0].length-1),o.anova.sse=e.sse(n,s),o.anova.mse=o.anova.sse/(n.length-(t[0].length-1)-1),o.anova.sst=e.sst(n,a),o.anova.mst=o.anova.sst/(n.length-1),o.anova.r2=1-o.anova.sse/o.anova.sst,o.anova.r2<0&&(o.anova.r2=0),o.anova.fratio=o.anova.msr/o.anova.mse,o.anova.pvalue=e.anovaftest(o.anova.fratio,t[0].length-1,n.length-(t[0].length-1)-1),o.anova.rmse=Math.sqrt(o.anova.mse),o.anova.r2adj=1-o.anova.mse/o.anova.mst,o.anova.r2adj<0&&(o.anova.r2adj=0),o.stats=new Array(t[0].length);for(var l,u,c,f=e.xtranspxinv(t),h=0;h<r.length;h++)l=Math.sqrt(o.anova.mse*Math.abs(f[h][h])),u=Math.abs(r[h]/l),c=e.ttest(u,n.length-t[0].length-1,i),o.stats[h]=[r[h],l,u,c];return o.regress=r,o},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),r=0;r<t.length;r++){i[r]=new Array(t[r].length);for(var o=0;o<t[r].length;o++)i[r][o]=t[r][o]-n[r][o]}return e(i)}}),e.jStat=e,e)},4788:(t,e,n)=>{"use strict";var i=n(5072),r=n.n(i),o=n(7825),s=n.n(o),a=n(7659),l=n.n(a),u=n(5056),c=n.n(u),f=n(540),h=n.n(f),d=n(1113),m=n.n(d),g=n(365),p={};p.styleTagTransform=m(),p.setAttributes=c(),p.insert=l().bind(null,"head"),p.domAPI=s(),p.insertStyleElement=h(),r()(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 o={},s=[],a=0;a<t.length;a++){var l=t[a],u=i.base?l[0]+i.base:l[0],c=o[u]||0,f="".concat(u," ").concat(c);o[u]=c+1;var h=n(f),d={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==h)e[h].references++,e[h].updater(d);else{var m=r(d,i);i.byIndex=a,e.splice(a,0,{identifier:f,updater:m,references:1})}s.push(f)}return s}function r(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,r){var o=i(t=t||[],r=r||{});return function(t){t=t||[];for(var s=0;s<o.length;s++){var a=n(o[s]);e[a].references--}for(var l=i(t,r),u=0;u<o.length;u++){var c=n(o[u]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}o=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 r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var o=n.sourceMap;o&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),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:()=>H,q:()=>G});var i,r=n(7389),o=n(4328),s=n(6082),a=n(2003),l=n(8223),u=n(3077),c=n(439);async function f(t,e,n,r,o){const a=(0,u.R)(e,o),f=o.getSeqHandler(e).getNewColumnFromList("ref",[n]),h=o.getSeqHandler(f).getSplitted(0),d=r===i.IDENTITY?function(t,e){const n=e.columns.length,i=new Array(n),r=new Array(n),o=new Array(n);for(let s=0;s<n;++s){const n=e.columns.byIndex(s);i[s]=n.getRawData(),r[s]=n.categories.indexOf("");const a=s<t.length?t.getOriginal(s):c._S;o[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)===o[e]&&++l[n];l[n]/=t.length}return a}(h,a):r===i.SIMILARITY?await async function(t,e,n){const i=e.columns.toList();return await(0,l.uL)(i,t,n)}(h,a,o):null;if(null===d)throw new Error(`In bio library: Unknown sequence scoring method: ${r}`);return d.name=t.columns.getUnusedName(d.name),t.columns.add(d),d}!function(t){t.IDENTITY="identity",t.SIMILARITY="similarity"}(i||(i={}));var h,d=n(8774),m=n(144),g=n.n(m),p=n(7233),v=n.n(p),y=n(4139),C=n(115),b=n(8608),w=n(3541),A=n(3163),S=n(7923),E=n(7654),T=n(5480),x=n(5429),_=n(6920),N=n(3657);!function(t){t.UMAP="UMAP",t.T_SNE="t-SNE"}(h||(h={}));n(5540);var M,I,O,L,R,P,k,V,D=n(4329);(I=M||(M={})).EUCLIDEAN="EUCLIDEAN",I.MANHATTAN="MANHATTAN",M.EUCLIDEAN,M.MANHATTAN,(L=O||(O={})).HAMMING="Hamming",L.EUCLIDEAN="Euclidean",L.MANHATTAN="Manhattan",L.TANIMOTO="Tanimoto",L.LEVENSTEIN="Levenshtein",L.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",L.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",L.SOKAL="Sokal",L.COSINE="Cosine",L.ASYMMETRIC="Asymmetric",L.Difference="Difference",L.OneHot="One-Hot",O.HAMMING,O.EUCLIDEAN,O.MANHATTAN,O.TANIMOTO,O.LEVENSTEIN,O.NEEDLEMAN_WUNSCH,O.MONOMER_CHEMICAL_DISTANCE,O.SOKAL,O.COSINE,O.ASYMMETRIC,O.Difference,O.OneHot,O.HAMMING,O.EUCLIDEAN,O.MANHATTAN,O.TANIMOTO,O.SOKAL,O.COSINE,O.ASYMMETRIC,O.LEVENSTEIN,O.NEEDLEMAN_WUNSCH,O.MONOMER_CHEMICAL_DISTANCE,O.Difference,O.OneHot,new Set([O.HAMMING,O.LEVENSTEIN,O.NEEDLEMAN_WUNSCH,O.MONOMER_CHEMICAL_DISTANCE,O.OneHot]),new Set([O.HAMMING,O.EUCLIDEAN,O.MANHATTAN,O.MONOMER_CHEMICAL_DISTANCE,O.LEVENSTEIN,O.NEEDLEMAN_WUNSCH,O.TANIMOTO,O.COSINE,O.SOKAL,O.ASYMMETRIC,O.OneHot,O.Difference]),new Set([O.EUCLIDEAN,O.MANHATTAN,O.OneHot,O.Difference]),new Set([O.EUCLIDEAN,O.MANHATTAN,O.Difference]),new Set([O.EUCLIDEAN,O.MANHATTAN,O.Difference]),new Set([O.TANIMOTO,O.COSINE,O.SOKAL,O.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"}(P||(P={})),function(t){t.SCALARMULT="SCALARMULT",t.SCALARADD="SCALARADD",t.SCALARPOW="SCALARPOW"}(k||(k={})),Object.prototype.toString,function(t){t.EUCLIDEAN="EUCLIDEAN",t.MANHATTAN="MANHATTAN"}(V||(V={}));var G,F=n(726),U=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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 H{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,N.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()(o.shell.tableViews).find((({dataFrame:t})=>(null==t?void 0:t.getTag(s.TAGS.ID))===this.id)):void 0,!this._analysisView&&(null===(t=o.shell.v)||void 0===t?void 0:t.preview)instanceof s.TableView&&(null===(n=null===(e=o.shell.v)||void 0===e?void 0:e.preview)||void 0===n?void 0:n.dataFrame)===this.df&&(this._analysisView=o.shell.v.preview),this._analysisView||(this._analysisView=o.shell.addTableView(this.df))),"1"===this.df.getTag(y.gp.MULTIPLE_VIEWS)||this._layoutEventInitialized||(0,b.Lv)()||(o.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,D._)()),this._settings):null}set settings(t){var e,n,i;const r=Object.entries(t),o=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 r)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])=>o[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,b.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,b.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[H.modelName]){const e=t.temp[H.modelName]=new H(t),n=e.settings;n&&e.init(n);let i=!0;e.subs.push(s.debounce(t.onSelectionChanged,10).subscribe((n=>{var r;if(i||t.selection.anyTrue||!e._analysisView||!document.contains(e._analysisView.root)||e._analysisView.dataFrame!==t||!e.positionColumns)return void(i=!(null===(r=null==t?void 0:t.selection)||void 0===r?void 0:r.anyTrue));e.webLogoSelection=(0,b.ZR)(e.positionColumns);const o=e.findViewer(G.SEQUENCE_VARIABILITY_MAP);null!=o&&(o.invariantMapSelection=(0,b.ZR)(e.positionColumns),o.mutationCliffsSelection=(0,b.ZR)(e.positionColumns));const s=e.findViewer(G.MOST_POTENT_RESIDUES);null!=s&&(s.mutationCliffsSelection=(0,b.ZR)(e.positionColumns),s.invariantMapSelection=(0,b.ZR)(e.positionColumns));const a=e.findViewer(G.LOGO_SUMMARY_TABLE);null!=a&&(a.initClusterSelection({notify:!0}),a.render()),i=!0})))}return t.temp[H.modelName]}modifyWebLogoSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.webLogoSelection=(0,b.vW)(this.webLogoSelection,t,e):this._webLogoSelection=(0,b.vW)(this.webLogoSelection,t,e)}getVisibleSelection(){return this.df.selection.clone().and(this.df.filter)}createAccordion(){var t,e,n,i,o,l;const u=null===(t=this.df)||void 0===t?void 0:t.temp[H.modelName];if(!u)return null;const c=r.accordion("Peptides analysis panel");c.root.style.width="100%";const f=u.getVisibleSelection(),h=u.df.filter.anyFalse?` among ${u.df.filter.trueCount} filtered`:"",d=t=>{const e=[];for(const[n,i]of Object.entries(t))for(const t of i)e.push(`${n}:${t}`);return e.join(", ")},m=u.findViewer(G.LOGO_SUMMARY_TABLE),p=[],y=(null===m?[]:m.clusterSelection[T.W.ORIGINAL].concat(m.clusterSelection[T.W.CUSTOM])).join(", "),C=t=>{const e=r.divText(t);return e.innerHTML=t,e};0!==y.length&&p.push(C(`<b>Logo Summary Table</b> clusters: ${y}`));const x=u.findViewer(G.SEQUENCE_VARIABILITY_MAP),_=d(null!==(e=null==x?void 0:x.invariantMapSelection)&&void 0!==e?e:{}),M=d(null!==(n=null==x?void 0:x.mutationCliffsSelection)&&void 0!==n?n:{});0!==_.length&&p.push(C(`<b>Invariant map</b>: ${_}`)),0!==M.length&&p.push(C(`<b>Mutation cliffs</b>: ${M}`));const I=u.findViewer(G.MOST_POTENT_RESIDUES),O=d(null!==(i=null==I?void 0:I.invariantMapSelection)&&void 0!==i?i:{});0!==O.length&&p.push(C(`<b>Most potent residues</b>: ${O}`));const L=d(u.webLogoSelection);0!==L.length&&p.push(C(`<b>WebLogo</b>: ${L}`)),0!==p.length&&p.unshift(r.h1("Selection Sources"));const R=r.div(r.divV(p));c.addTitle(r.divV([r.h1(`${f.trueCount} selected rows${h}`),R],"css-gap-small")),f.anyTrue&&c.addPane("Actions",(()=>{try{const t=r.label("New view");if(v()(t).addClass("d4-link-action"),t.onclick=()=>u.createNewView(),t.onmouseover=t=>r.tooltip.show("Creates a new view from current selection",t.clientX+5,t.clientY+5),null===m)return r.divV([t]);const e=r.label("New cluster");v()(e).addClass("d4-link-action"),e.onclick=()=>{if(null===m)throw new Error("Logo summary table viewer is not found");m.clusterFromSelection()},e.onmouseover=t=>r.tooltip.show("Creates a new cluster from selection",t.clientX+5,t.clientY+5);const n=r.label("Remove cluster");return v()(n).addClass("d4-link-action"),n.onclick=()=>{const t=u.findViewer(G.LOGO_SUMMARY_TABLE);if(null===t)throw new Error("Logo summary table viewer is not found");t.removeCluster()},n.onmouseover=t=>r.tooltip.show("Removes currently selected custom cluster",t.clientX+5,t.clientY+5),n.style.visibility=0===m.clusterSelection[T.W.CUSTOM].length?"hidden":"visible",r.divV([t,e,n])}catch(t){const e=r.divText("Error in Actions");return r.tooltip.bind(e,String(t)),e}}),!0);let P=u.settings;const k=[x,I,m].filter((t=>null!==t&&(t.type!==this.accordionSource||(P=t,!1))));if(null===P)throw new Error("PeptidesError: Model is the source of accordion but is not initialized");P!==u.settings&&k.push(u.settings);const V=k.filter((t=>null!==t&&(0,b.$s)(P,t)&&(t!==u.settings||u.isInitialized)));V.push(P);const D=s.BitSet.create(u.df.rowCount);for(const t of V){const e=t===this.settings?(0,b.KT)(this.webLogoSelection,this.monomerPositionStats):t instanceof T.s?(0,b.KT)(t.clusterSelection,t.clusterStats):t instanceof w.xN?(0,b.KT)(t.mutationCliffsSelection,(0,b.qI)(null!==(o=t.mutationCliffs)&&void 0!==o?o:new Map,u.df.rowCount)):null;if(null!==e&&D.or(e),t instanceof w.J){const e=(0,b.KT)(t.invariantMapSelection,t.monomerPositionStats);null!==e&&D.or(e)}}const U=P;P===u.settings||U instanceof T.s||null==U.mutationCliffs||c.addPane("Mutation Cliffs pairs",(()=>(0,S.F)(u.df,{mutationCliffs:U.mutationCliffs,mutationCliffsSelection:U.mutationCliffsSelection,gridColumns:u.analysisView.grid.columns,sequenceColumnName:U.sequenceColumnName,positionColumns:U.positionColumns,activityCol:U.getScaledActivityColumn()}).root),!0);const q=P===u.settings,B=q?this.webLogoSelection:P instanceof w.J?P.invariantMapSelection:{},Y=P instanceof T.s?P.clusterSelection:null!==(l=null==m?void 0:m.clusterSelection)&&void 0!==l?l:{};c.addPane("Distribution",(()=>{var t;try{return(0,E.HV)(u.df,{peptideSelection:D,columns:q?null!==(t=u.settings.columns)&&void 0!==t?t:{}:P.getAggregationColumns(),activityCol:q?u.getScaledActivityColumn():P.getScaledActivityColumn(),monomerPositionSelection:B,clusterSelection:Y,clusterColName:null==m?void 0:m.clustersColumnName})}catch(t){const e=r.divText("Error in Distribution");return r.tooltip.bind(e,String(t)),e}}),!0);const W=(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 c.addPane("Selection",(()=>{var t;try{return function(t,e){var n,i;if(0===e.tableSelection.trueCount)return r.divText("No compounds selected");const o=s.DataFrame.create(t.rowCount);o.name="Selected compounds",o.filter.copyFrom(e.tableSelection);const a=g()(t.columns.numerical);let l=null;for(let t=1;t<e.gridColumns.length;t++){const r=e.gridColumns.byIndex(t);if(!r.visible)continue;const u=r.column;if(u.type===s.COLUMN_TYPE.BOOL)continue;null===l&&r.grid&&(null===(n=r.grid.sortByColumns)||void 0===n?void 0:n.length)>0&&(null===(i=r.grid.sortTypes)||void 0===i?void 0:i.length)===r.grid.sortByColumns.length&&(l={cols:r.grid.sortByColumns,types:r.grid.sortTypes});let c=null,f=null;try{c=u.getRawData(),f=u.categories}catch(t){}const h=c&&f?a.some((t=>t.name===u.name))?t=>c[t]:t=>f[c[t]]:t=>u.get(t),d=u.name===e.activityColumn.name?o.columns.addNewFloat(r.name).init((t=>h(t))):o.columns.addNewVirtual(r.name,(t=>h(t)),u.type);for(const[t,e]of u.tags)d.setTag(t,e)}const u=o.plot.grid();u.props.showRowHeader=!1,u.root.style.maxWidth="100%",s.debounce(r.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,b.zz)(u);const c=r.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 f=(0,N.Ej)(e.activityColumn,o.filter,e.positionColumns,{isFiltered:o.filter.anyTrue||o.filter.anyFalse}),h={isSelectionTable:!0,cachedWebLogoTooltip:()=>({bar:"",tooltip:null}),webLogoBounds:()=>({}),colorPalette:()=>e.colorPalette},d={x:0,y:0,monomerPosition:{},mpStats:f};return e.isAnalysis&&(0,A.FZ)(u,f,e.positionColumns,e.activityColumn,h,d),c}(u.df,{positionColumns:q?u.positionColumns:P.positionColumns,columns:q?null!==(t=u.settings.columns)&&void 0!==t?t:{}:P.getAggregationColumns(),activityColumn:q?u.getScaledActivityColumn():P.getScaledActivityColumn(),gridColumns:u.analysisView.grid.columns,colorPalette:(0,a.SM)(u.df.getCol(q?u.settings.sequenceColumnName:P.sequenceColumnName),F.Z.getSeqHelper()),tableSelection:u.getCombinedSelection(),isAnalysis:null!==u.settings&&(q||W(u.settings.columns,P.getAggregationColumns()))})}catch(t){const e=r.divText("Error in Selection");return r.tooltip.bind(e,String(t)),e}}),!0),c}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),F.Z.getSeqHelper()),webLogoBounds:()=>this.webLogoBounds,cachedWebLogoTooltip:()=>this.cachedWebLogoTooltip,highlightCallback:(t,e,n)=>{(0,b.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||(o.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),F.Z.getSeqHelper()),i=n.columns.names();if(i.every((t=>e.contains(t))))i.forEach((t=>A.rI(this.df.col(t),this.alphabet)));else for(const t of i){let i=this.df.col(t);const r=n.getCol(t);null!==i&&e.remove(t);const o=r.categories,s=r.getRawData();i=e.addNew(r.name,r.type).init((t=>o[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,b.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,r;return!(!t.isColHeader||(null===(i=t.tableColumn)||void 0===i?void 0:i.semType)!==y.uF.MONOMER)||!(!t.isTableCell||(null===(r=t.tableColumn)||void 0===r?void 0:r.semType)!==y.uF.MONOMER)}))}getCombinedSelection(){var t,e,n,i,r,o,a,l;const u=new d.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 r=i[t];void 0!==r&&u.or(r.mask)}};c(this.webLogoSelection,this.monomerPositionStats);const f=this.findViewer(G.SEQUENCE_VARIABILITY_MAP);c(null!==(t=null==f?void 0:f.invariantMapSelection)&&void 0!==t?t:{},null!==(e=null==f?void 0:f.monomerPositionStats)&&void 0!==e?e:null),((t,e)=>{var n,i;for(const[r,o]of Object.entries(t))for(const t of o){const o=null!==(i=null===(n=null==e?void 0:e.get(t))||void 0===n?void 0:n.get(r))&&void 0!==i?i:null;if(null!==o)for(const[t,e]of o.entries()){u.setTrue(t);for(const t of e)u.setTrue(t)}}})(null!==(n=null==f?void 0:f.mutationCliffsSelection)&&void 0!==n?n:{},null!==(i=null==f?void 0:f.mutationCliffs)&&void 0!==i?i:null);const h=this.findViewer(G.MOST_POTENT_RESIDUES);c(null!==(r=null==h?void 0:h.invariantMapSelection)&&void 0!==r?r:{},null!==(o=null==h?void 0:h.monomerPositionStats)&&void 0!==o?o: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;o.shell.o=t.root,n=setTimeout((()=>{o.shell.o!=t.root&&(o.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){_._package.logger.debug("Peptides: Error on selection changed"),_._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){_._package.logger.debug("Peptides: Error on filter changed"),_._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,b.qx)(this.df)}setGridProperties(t){var e,n,i,r;const o=this.analysisView.grid,s=o.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!==(r=null==t?void 0:t.showCurrentRowIndicator)&&void 0!==r&&r;const l=this.positionColumns;if(null===l)throw new Error("PeptidesError: Could not set grid properties: positionColumns are null");let u=10;const c=o.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 f=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=f.includes(e.column.name)||e.column.name===y.$2.ACTIVITY}setTimeout((()=>{for(const t of l){const e=o.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 U(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){_._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=r.iconFA("wrench",(()=>(0,x.OH)(this)),"Peptides analysis settings");this.analysisView.setRibbonPanels([[t]],!1),this.isRibbonSet=!0,this.updateGrid()}this.subs.push(o.events.onAccordionConstructed.subscribe((t=>{if(!(o.shell.o instanceof s.SemanticValue||o.shell.o instanceof s.Column&&this.df.columns.toList().includes(o.shell.o)))return;const e=t.getPane("Actions"),n=v()(e.root).find(".d4-flex-col"),a=r.label("Calculate identity");a.classList.add("d4-link-action"),r.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);f(this.df,t,t.get(this.df.currentRowIdx),i.IDENTITY,F.Z.getSeqHelper()).then((e=>e.setTag(y.gp.IDENTITY_TEMPLATE,t.get(this.df.currentRowIdx)))).catch((t=>_._package.logger.debug(t)))},n.append(r.span([a],"d4-markdown-row"));const l=r.label("Calculate similarity");l.classList.add("d4-link-action"),r.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);f(this.df,t,t.get(this.df.currentRowIdx),i.SIMILARITY,F.Z.getSeqHelper()).then((e=>e.setTag(y.gp.SIMILARITY_TEMPLATE,t.get(this.df.currentRowIdx)))).catch((t=>_._package.logger.debug(t)))},n.append(r.span([l],"d4-markdown-row"))}))),this.subs.push(o.events.onViewRemoved.subscribe((t=>{t.id===this.analysisView.id&&this.subs.forEach((t=>t.unsubscribe())),o.log.debug(`Peptides: view ${t.name} removed`)}))),this.subs.push(o.events.onTableRemoved.subscribe((t=>{t.id===this.df.id&&this.subs.forEach((t=>t.unsubscribe())),o.log.debug(`Peptides: table ${t.name} removed`)}))),this.subs.push(o.events.onProjectClosed.subscribe((t=>{t.id===o.shell.project.id&&this.subs.forEach((t=>t.unsubscribe())),o.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 U(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,b.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 U(this,void 0,void 0,(function*(){var e,n,i,r,o,a,l,u,c;const f=null!==(r=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!==r?r:null===(o=this._sequenceSpaceCols)||void 0===o?void 0:o.find((t=>t.toLowerCase().startsWith("cluster")));null!=t||(t={activityColumnName:this.settings.activityColumnName,clusterColumnName:null!=f?f: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 h=yield this.df.plot.fromType(G.CLUSTER_MAX_ACTIVITY,t),d=null!==(c=this.findViewerNode(G.LOGO_SUMMARY_TABLE))&&void 0!==c?c:null;this.analysisView.dockManager.dock(h,d?s.DOCK_TYPE.DOWN:s.DOCK_TYPE.RIGHT,d,G.CLUSTER_MAX_ACTIVITY)}))}addMonomerPosition(t){return U(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,b.Lv)()&&this.analysisView.addViewer(e);const n=this.findViewer(G.MOST_POTENT_RESIDUES),i=this.analysisView.dockManager,[r,o,a]=null===n?[s.DOCK_TYPE.DOWN,null,void 0]:[s.DOCK_TYPE.LEFT,this.findViewerNode(G.MOST_POTENT_RESIDUES),.7];i.dock(e,r,o,G.SEQUENCE_VARIABILITY_MAP,a)}))}addMostPotentResidues(t){return U(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,b.Lv)()&&this.analysisView.addViewer(e);const n=this.findViewer(G.SEQUENCE_VARIABILITY_MAP),i=this.analysisView.dockManager,[r,o,a]=null===n?[s.DOCK_TYPE.DOWN,null,void 0]:[s.DOCK_TYPE.RIGHT,this.findViewerNode(G.SEQUENCE_VARIABILITY_MAP),.3];i.dock(e,r,o,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=o.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 U(this,void 0,void 0,(function*(){var t,e;if(!this._sequenceSpaceCols||0===this._sequenceSpaceCols.length)return void o.shell.warning("Embeddings columns are not initialized");const i=this._sequenceSpaceCols.filter((t=>t.toLowerCase().startsWith("embed_")));if(2!==i.length)return void o.shell.warning(`Found ${i.length} embeddings columns, expected 2`);const r=this._sequenceSpaceCols.filter((t=>t.toLowerCase().startsWith("cluster")));r.length>0&&this.df.columns.remove(r[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,r){return o=this,s=void 0,l=function*(){return new Promise((function(o,s){const a=new Worker(new URL(n.p+n.u(682),n.b));a.postMessage({embedX:t,embedY:e,minPts:r,epsilon:i}),a.onmessage=({data:{error:t,clusters:e}})=>{a.terminate(),t?s(t):o(e)}}))},new((a=void 0)||(a=Promise))((function(t,e){function n(t){try{r(l.next(t))}catch(t){e(t)}}function i(t){try{r(l.throw(t))}catch(t){e(t)}}function r(e){var r;e.done?t(e.value):(r=e.value,r instanceof a?r:new a((function(t){t(r)}))).then(n,i)}r((l=l.apply(o,s||[])).next())}));var o,s,a,l}(s,a,l,u),f=this.df.columns.getUnusedName("Cluster (DBSCAN)"),h=this.df.columns.addNewString(f);h.init((t=>c[t].toString())),null!==this._sequenceSpaceViewer&&(this._sequenceSpaceViewer.props.colorColumnName=h.name),this._sequenceSpaceCols=[i[0],i[1],h.name];const d=this.analysisView.grid.col(h.name);d&&(d.visible=!1)}))}addMCLClusters(){return U(this,void 0,void 0,(function*(){var t,e,n,i,r;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=(r=this.settings).mclSettings)&&void 0!==n||(r.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()})),f=o.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)}))}f.unsubscribe()}}catch(t){console.error(t)}})),h=JSON.stringify({cols:[a].map((t=>t.name)),metrics:[l.distanceF],weights:[1],aggregationMethod:V.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}),d=null!==(i=this.analysisView)&&void 0!==i?i:o.shell.getTableView(this.df.name);if(d){const t=s.Func.find({package:"EDA",name:"markovClusteringViewer"})[0];if(!t)throw new Error("Markov clustering function is not found");yield t.apply(),d.addViewer(G.MCL,{mclProps:h}),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 U(this,arguments,void 0,(function*(t={}){var e,n,i,r;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=F.Z.getSeqHelper().getSeqHandler(l);if(u.isHelm())try{o.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 o.shell.error("Error on converting HELM notation to linear notation"),void o.shell.error(t)}const c=!t.clusterCol&&!!t.clusterEmbeddings,f=null!==(r=null===(i=this.settings)||void 0===i?void 0:i.sequenceSpaceParams)&&void 0!==r?r:new C.GI(c);f.clusterEmbeddings=c;const d={table:this.df,molecules:l,methodName:h.UMAP,similarityMetric:f.distanceF,plotEmbeddings:!0,options:{bypassLargeDataWarning:!0,dbScanEpsilon:f.epsilon,dbScanMinPts:f.minPts,randomSeed:"1",preprocessingFuncArgs:{gapOpen:f.gapOpen,gapExtend:f.gapExtend,fingerprintType:f.fingerprintType}},clusterEmbeddings:f.clusterEmbeddings};let m=0;const g=f.clusterEmbeddings?3:2,p=this.df.onColumnsAdded.subscribe((t=>{for(const e of t.columns)if(e.name.toLowerCase().startsWith("embed_")||f.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=o.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 o.functions.call("Bio:sequenceSpaceTopMenu",d);v.unsubscribe(),y instanceof s.ScatterPlotViewer&&(f.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){}})))}))}}H.modelName="peptidesModel"},6920:(t,e,n)=>{"use strict";n.r(e),n.d(e,{Peptides:()=>K,_package:()=>Y,clusterMaxActivity:()=>nt,getMonomerWorksInstance:()=>W,getTreeHelperInstance:()=>j,initPeptides:()=>$,logoSummaryTable:()=>et,lstPiechartCellRenderer:()=>ot,macromoleculeSarFastaDemo:()=>rt,manualAlignment:()=>it,monomerPosition:()=>J,mostPotentResidues:()=>tt,peptidesDialog:()=>Q,peptidesPanel:()=>X,testInitFunctionPeptides:()=>Z});var i=n(4328),r=n(7389),o=n(6082),s=n(5082),a=n(7233),l=n.n(a),u=(n(4788),n(768)),c=n(726),f=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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())}))},h=n(3541),d=n(5480);n(3981);class m{constructor(t){this.monomerLib=t}getCappedRotatedMonomer(t,e){const n=this.monomerLib.getMonomer(t,e);return n?n.molfile:null}}var g=n(4139),p=n(8608),v=n(2003),y=n(8070),C=n(115),b=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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())}))},w=n(5072),A=n.n(w),S=n(7825),E=n.n(S),T=n(7659),x=n.n(T),_=n(5056),N=n.n(_),M=n(540),I=n.n(M),O=n(1113),L=n.n(O),R=n(6677),P={};P.styleTagTransform=L(),P.setAttributes=N(),P.insert=x().bind(null,"head"),P.domAPI=E(),P.insertStyleElement=I(),A()(R.A,P),R.A&&R.A.locals&&R.A.locals;var k;!function(t){let e,n;!function(t){t.vert=function(t){return r.divV(t.map((t=>r.render(t))),{classes:"u2-panel"})},t.horz=function(t){return r.divH(t.map((t=>r.render(t))),{classes:"u2-panel"})}}(e=t.panels||(t.panels={})),t.appHeader=function(t){const n=r.iconImage("",t.iconPath);return l()(n).addClass("ui-app-header-icon").css("margin-right","20px"),e.horz([n,e.vert([r.markdown(t.description),t.learnMoreUrl?r.link("Learn more",t.learnMoreUrl):null])])},function(t){t.runAsync=function(t,e){return n=this,o=void 0,a=function*(){r.setUpdateIndicator(t,!0);try{return yield e()}catch(t){i.log.error(t)}finally{r.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 r(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,r)}l((a=a.apply(n,o||[])).next())}));var n,o,s,a}}(n=t.tools||(t.tools={}))}(k||(k={}));var V=n(144),D=n.n(V);const G=rxjs.operators;class F extends o.JsViewer{get scViewer(){return this._scViewer||(this._scViewer=this.createSCViewer()),this._scViewer}constructor(){super(),this._titleHost=r.divText(u.q.CLUSTER_MAX_ACTIVITY,{id:"pep-viewer-title",style:{marginRight:"auto"}}),this._selsectIcon=r.div(),this.activityTarget=g.wf.HIGH,this.viewerError="",this.renderTimeout=null,this.renderDebounceTime=500,this.scFilterQuery=`\${${F.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",g.wf.HIGH,{choices:[g.wf.HIGH,g.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:o.AxisType.logarithmic,yAxisType:o.AxisType.logarithmic,invertYAxis:this.activityTarget===g.wf.LOW,xColumnName:F.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(![o.COLUMN_TYPE.FLOAT,o.COLUMN_TYPE.INT,o.COLUMN_TYPE.BIG_INT,o.COLUMN_TYPE.QNUM].includes(n.type))return this.viewerError="Activity column should be numeric",null;const a=this.dataFrame.columns.getOrCreate(F.clusterSizeColName,o.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=o.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 r=n.get(t),o=u[e];if((null==o||null==o||r>n.get(o)&&this.activityTarget===g.wf.HIGH||r<n.get(o)&&this.activityTarget===g.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 f=this.dataFrame.columns.getOrCreate(F.maxActivityInClusterColName,o.COLUMN_TYPE.INT);f.init((t=>i.isNone(t)?0:t===u[i.get(t)]?1:0)),this.dataFrame.columns.getOrCreate(F.maxConnectivityInClusterColName,o.COLUMN_TYPE.INT).init((t=>i.isNone(t)?0:t===c[i.get(t)]?1:0)),this.dataFrame.columns.getOrCreate(F.synSelectionColName,o.TYPE.STRING).init((t=>{if(i.isNone(t))return null;let e=null;return t===u[i.get(t)]&&(e=F.maxActivityLabel),s&&t===c[i.get(t)]&&(e=e?`${e}, ${F.maxConnectivityLabel}`:F.maxConnectivityLabel),e})),e.xColumnName=F.clusterSizeColName,e.yColumnName=this.activityColumnName,e.filter=this.scFilterQuery,this.viewerError="";const h=o.Viewer.scatterPlot(this.dataFrame,e);this.selectionSubscription&&this.selectionSubscription.unsubscribe(),this.selectionSubscription=h.onDataEvent.pipe((0,G.filter)((t=>"d4-select"==t.type))).subscribe((t=>{var e,n;const r=null!==(n=null===(e=t.bitset)||void 0===e?void 0:e.getSelectedIndexes())&&void 0!==n?n:[],s=this.dataFrame.selection,a=o.BitSet.create(this.dataFrame.rowCount,(t=>1==f.get(t)));a.and(s);for(let t=0;t<r.length;t++){const e=r[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 d=()=>{const t=o.BitSet.create(this.dataFrame.rowCount);Object.entries(u).forEach((([e,i])=>{var r;if(null==e||null==i)return;const o=parseInt(e),s=n.get(i),a=null!==(r=l[o])&&void 0!==r?r:l[e];s<this.activityThreshold&&a<this.clusterSizeThreshold||(t.set(i,!0,!1),null!=c[o]&&t.set(c[o],!0,!1))})),t.fireChanged(),this.dataFrame.selection.copyFrom(t,!0)};return this._selsectIcon=r.iconSvg("select-all",(()=>{d()}),"Select 3 Active quadrants"),this._selsectIcon.style.cursor="pointer",this._selsectIcon.style.marginRight="5px",d(),this.linesDrawSubscription&&this.linesDrawSubscription.unsubscribe(),this.linesDrawSubscription=h.onBeforeDrawScene.subscribe((()=>{const t=h.getInfo().canvas.getContext("2d"),e=h.viewport,n=h.worldToScreen(e.x,this.activityThreshold),i=h.worldToScreen(this.clusterSizeThreshold,e.y),r=h.worldToScreen(e.x+e.width,this.activityThreshold),o=h.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(r.x,r.y),t.moveTo(i.x,i.y),t.lineTo(o.x,o.y),t.stroke(),t.closePath()})),h}onTableAttached(){var t,e,n,i,r,o,s,a,l,u,c,f;super.onTableAttached();const h=null!==(e=null===(t=this.dataFrame)||void 0===t?void 0:t.col(g.$2.ACTIVITY))&&void 0!==e?e:null===(i=D()(null===(n=this.dataFrame)||void 0===n?void 0:n.columns.numerical).next())||void 0===i?void 0:i.value;null!=h&&(null===(r=this.getProperty(`activity${g.To}`))||void 0===r||r.set(this,h.name));const d=null===(s=D()(null===(o=this.dataFrame)||void 0===o?void 0:o.columns.categorical).next())||void 0===s?void 0:s.value;null!=d&&(null===(a=this.getProperty(`cluster${g.To}`))||void 0===a||a.set(this,d.name));const m=null===(u=D()(null===(l=this.dataFrame)||void 0===l?void 0:l.columns.numerical).next())||void 0===u?void 0:u.value;null!=m&&(null===(c=this.getProperty(`connectivity${g.To}`))||void 0===c||c.set(this,m.name)),this.render(),null===(f=this.dataFrame)||void 0===f||f.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(r.divText(null!==(t=this.viewerError)&&void 0!==t?t:"Error creating scatter plot"));const i=r.div("Cluster Size",{style:{alignSelf:"center",color:"var(--grey-6)",marginBottom:"5px"}}),o=r.div(this.activityTarget===g.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(r.divH([o,r.divV([r.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${g.To}`&&(this._scViewer=null),this.render()}}F.clusterSizeColName="~cluster.size",F.maxActivityInClusterColName="~max.activity.for.cluster",F.maxConnectivityInClusterColName="~max.connectivity.for.cluster",F.synSelectionColName="Syn Selection",F.maxActivityLabel="Max Activity",F.maxConnectivityLabel="Max Connectivity";var U=n(3163),H=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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 q,B=null;const Y=new o.Package;function W(){return B}function j(){return q}function $(){return H(this,void 0,void 0,(function*(){try{null!=B||(B=new m(yield i.functions.call("Bio:getBioLib"))),null!=q||(q=yield async function(){const t="Dendrogram",e=o.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)}}))}function z(t){return H(this,void 0,void 0,(function*(){const e=o.TaskBarProgressIndicator.create("Loading Peptides"),n=Y.webRoot+"files/"+t,r=yield i.data.loadTable(n);r.name="Peptides",i.shell.addTableView(r).name="PeptidesView",i.shell.windows.showProperties=!0,e.close()}))}function K(){const t=k.appHeader({iconPath:Y.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=o.View.create();return n.name="Peptides",r.appendAll(n.root,[t,r.divH([r.button("Simple demo",(()=>z("aligned.csv")),""),r.button("Complex demo",(()=>z("aligned_2.csv")),""),r.button("HELM demo",(()=>z("aligned_3.csv")),"")])]),n}function Q(){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(!o.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=r.dialog("Analyze Peptides").add(e.host).onOK((()=>H(this,void 0,void 0,(function*(){e.callback()||n.show()}))));return n.show()}function Z(t){return H(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)))}))}function X(t){if(!t.dataFrame||!o.Utils.firstOrNull(t.dataFrame.columns.numerical))return new o.Widget(r.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 o.Widget(e.host)}function J(){return new h.J}function tt(){return new h.UJ}function et(){return new d.s}function nt(){return new F}function it(t){const e=i.shell.t,n=null==e?void 0:e.temp[u.i.modelName];return n?function(t,e){const n=r.input.textArea("",{value:t.get(e.currentRowIdx)});l()(n.root).addClass("pep-textinput");const s=r.button("Apply",(()=>f(this,void 0,void 0,(function*(){const r=c.Z.getSeqHelper().getSeqHandler(t),o=n.value,s=r.splitter(o),a=e.currentRowIdx;t.set(a,o);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)}))),"Apply changes"),a=r.button(r.iconFA("redo"),(()=>n.value=t.get(e.currentRowIdx)),"Reset");return l()(a).addClass("pep-snippet-editor-icon pep-reset-icon"),new o.Widget(r.divV([a,n.root,s],"pep-textarea-box"))}(e.getCol(n.settings.sequenceColumnName),e):new o.Widget(r.divText("Manual alignment works with peptides analysis"))}function rt(){return H(this,void 0,void 0,(function*(){return yield function(){return b(this,void 0,void 0,(function*(){i.shell.windows.showContextPanel=!0;const t=o.DataFrame.fromCsv(yield Y.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,y.cb)(50);const n=e.grid;yield new Promise((t=>{var e;let i=null;const r=null===(e=null==n?void 0:n.onAfterDrawContent)||void 0===e?void 0:e.subscribe((()=>{i&&clearTimeout(i),r.unsubscribe(),t(void 0)}));i=setTimeout((()=>{r.unsubscribe(),t(void 0)}),3e3)}));const r=t.getCol("IC50"),a=t.getCol("AlignedSequence");a.semType=o.SEMTYPE.MACROMOLECULE,a.setTag(g.gp.ALPHABET,v.YI.PT),a.meta.units=v.Hi.FASTA,a.setTag(v.gp.aligned,"SEQ.MSA");const l=(0,p.Y1)(r,g.rg.MINUS_LG),u=o.Column.string("Cluster",t.rowCount).init("0"),c=yield i.functions.call("Bio:alignSequences",{sequenceCol:a,clustersCol:u}),f=new C.av;f.threshold=94,yield(0,s.n)(r,c,null,t,l,g.rg.MINUS_LG,{addMCL:!0,useEmbeddingsClusters:!0,mclSettings:f})}))}()}))}function ot(){return new U.DX}},726:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var i=n(8223),r=n(6082),o=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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 o(this,void 0,void 0,(function*(){var t;null!==(t=this._secHelper)&&void 0!==t||(this._secHelper=yield async function(){const t=r.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 o(this,void 0,void 0,(function*(){yield this.loadSeqHelper(),yield this.loadMonomerLib()}))}static loadMonomerLib(){return o(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:()=>f,eW:()=>m,Ej:()=>h,uz:()=>c});var i=n(6082),r=n(4139);class o{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,o=function*(t,e,n={}){var i,r,o;const s=new Map;try{const a=null!==(r=null===(i=n.targetCol)||void 0===i?void 0:i.cat.indexOf(n.currentTarget))&&void 0!==r?r:-1,l=t.length,u=new Array(this._workerCount),c=l*(l-1)/2;this._workerCount=Math.min(this._workerCount,c);const f=c/this._workerCount;e.forEach((t=>{var e;t.cat=null===(e=t.cat)||void 0===e?void 0:e.slice()})),(null===(o=n.targetCol)||void 0===o?void 0:o.cat)&&(n.targetCol.cat=n.targetCol.cat.slice());for(let i=0;i<this._workerCount;i++)u[i]=new Promise(((r,o)=>{const s=Math.floor(i*f),l=i===this._workerCount-1?c:Math.floor((i+1)*f);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(),o(s)):(this._workers[i].terminate(),r({pos:t,seq1Idxs:e,seq2Idxs:n}))}}));const h=yield Promise.all(u),d=new Map;e.forEach(((t,e)=>{d.set(t.name,e)})),h.filter(Boolean).forEach((t=>{for(let n=0;n<t.pos.length;n++){const i=d.get(t.pos[n]),r=e[i].rawData[t.seq1Idxs[n]],o=e[i].cat[r],a=e[i].rawData[t.seq2Idxs[n]],l=e[i].cat[a];s.has(o)||s.set(o,new Map),s.has(l)||s.set(l,new Map);const u=s.get(o),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 f=u.get(t.pos[n]),h=c.get(t.pos[n]);f.has(t.seq1Idxs[n])||f.set(t.seq1Idxs[n],[]),h.has(t.seq2Idxs[n])||h.set(t.seq2Idxs[n],[]);const m=f.get(t.seq1Idxs[n]),g=h.get(t.seq2Idxs[n]);m.push(t.seq2Idxs[n]),g.push(t.seq1Idxs[n])}}))}catch(t){this.terminate(),console.error(t)}return s},new((r=void 0)||(r=Promise))((function(t,e){function s(t){try{l(o.next(t))}catch(t){e(t)}}function a(t){try{l(o.throw(t))}catch(t){e(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(s,a)}l((o=o.apply(n,i||[])).next())}));var n,i,r,o}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(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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 '${r.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 o,l=yield a.calc(t,e,n);return a.terminate(),l}))}function f(t,e){const n=new Map;let i=999999,r=-999999,o=2,s=2;for(const u of t.keys()){const c=new Map;n.set(u,c);const f=t.get(u);for(const t of f.keys()){const n=f.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 h=(0,l.GT)(e,u);i=Math.min(i,h.meanDifference),r=Math.max(r,h.meanDifference),o=Math.min(o,h.count),s=Math.max(s,h.count),c.set(t,h)}}return{stats:n,minDiff:i,maxDiff:r,minCount:o,maxCount:s}}function h(t,e,n,r={}){var o,s,u,c,f,h;null!==(o=r.isFiltered)&&void 0!==o||(r.isFiltered=!1);const m={general:{}};let g=t.getRawData(),p=t.length;if(r.isFiltered){p=e.trueCount;const t=new Float64Array(p),o=e.getSelectedIndexes();for(let e=0;e<p;++e)t[e]=g[o[e]];g=t,n=i.DataFrame.fromColumns(n).clone(e).columns.toList(),r.target&&(r.target.col=r.target.col.clone(e)),r.aggValue&&(r.aggValue.col=r.aggValue.col.clone(e))}null!==(s=r.columns)&&void 0!==s||(r.columns=n.map((t=>t.name)));const v=null===(c=null===(u=r.target)||void 0===u?void 0:u.col)||void 0===c?void 0:c.getRawData(),y=null===(f=r.target)||void 0===f?void 0:f.col.categories,C=(null===(h=r.target)||void 0===h?void 0:h.cat)?null==y?void 0:y.indexOf(r.target.cat):-1;for(const t of n){if(!r.columns.includes(t.name))continue;const e=t.getRawData(),n=t.categories,i={general:{}};for(let t=0;t<n.length;++t){const o=n[t];if(""===o)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,r.aggValue);i[o]=c,d(i.general,c)}m[t.name]=i,d(m.general,null,i.general)}return m}function d(t,e=null,n=null){var i,r,o,s,a,l,u,c,f,h,d,m,g,p,v,y,C;if(null===e&&null===n)throw new Error("MonomerPositionStatsError: either stats or summaryStats must be present");const b=null!==(i=null==e?void 0:e.count)&&void 0!==i?i:n.maxCount;null!==(r=t.maxCount)&&void 0!==r||(t.maxCount=b),t.maxCount<b&&(t.maxCount=b);const w=null!==(o=null==e?void 0:e.count)&&void 0!==o?o:n.minCount;null!==(s=t.minCount)&&void 0!==s||(t.minCount=w),t.minCount>w&&(t.minCount=w);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!==(f=null==e?void 0:e.pValue)&&void 0!==f?f:NaN)){const i=null!==(h=null==e?void 0:e.pValue)&&void 0!==h?h:n.maxPValue;null!==(d=t.maxPValue)&&void 0!==d||(t.maxPValue=i),t.maxPValue<i&&(t.maxPValue=i);const r=null!==(m=null==e?void 0:e.pValue)&&void 0!==m?m:n.minPValue;null!==(g=t.minPValue)&&void 0!==g||(t.minPValue=r),t.minPValue>r&&(t.minPValue=r)}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 r=t.rowCount,o=t.getCol(e),u=o.getRawData(),c=o.categories,f=Array.from({length:c.length},(()=>new a.A(r,!1)));for(let t=0;t<r;++t)f[u[t]].setTrue(t);const h=n.map((t=>a.A.fromUint32Array(r,t.getRawData()))),d=n.map((t=>t.name)),m=i.getRawData(),g={},p={};for(const t of Object.values(s.W)){const e=t===s.W.ORIGINAL?f:h,n=t===s.W.ORIGINAL?c:d,r=t===s.W.ORIGINAL?g:p;for(let t=0;t<e.length;++t){const o=e[t];r[n[t]]=o.allTrue||o.allFalse?{count:o.length,meanDifference:0,ratio:1,pValue:null,mask:o,mean:i.stats.avg}:(0,l.GT)(m,o)}}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:()=>b,k8:()=>w,Yd:()=>C,rI:()=>y,FZ:()=>A});var i=n(7389),r=n(6082),o=n(4139),s=n(2003),a=n(3657);const l=rxjs;var u,c,f,h=n(912),d=n(5480),m=n(3541);n(9634),function(t){t.maxMonomerLength=".mm.cellRenderer.maxMonomerLength"}(u||(u={})),function(t){t.applyToBackground=".m.cellRenderer.applyToBackground"}(c||(c={})),function(t){t.MSA="MSA",t.classic="classic"}(f||(f={})),new class{constructor(){this.color="rgb(100,100,100)",this.pivot=0,this.left=!1,this.transparencyRate=1,this.separator="",this.last=!1,this.drawStyle=f.classic,this.maxWord=[],this.wordIdx=0,this.gridCell=null,this.referenceSequence=null,this.maxLengthOfMonomer=null,this.monomerTextSizeMap={},this.logger=void 0}};var g=n(726),p=n(3981);function v(t,e){t.strokeStyle=r.Color.toHtml(r.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=o.uF.MONOMER,t.setTag(r.TAGS.CELL_RENDERER,o.uF.MONOMER),t.setTag(o.gp.ALPHABET,e),n&&t.setTag(c.applyToBackground,"true")}function C(t,e,n,i,o){var s,a,l,u,c,f,h,d,g,p,y,C;const b=o.width/2,w=Math.ceil(o.x+1+b),A=Math.ceil(o.y+1+o.height/2),S=Math.min(.9*b/2,.9*o.height/2);if(i instanceof m.UJ){const o=i.monomerPositionStats[n],s=o[e].pValue,a=o[e].meanDifference,l=1-o.general.maxPValue,u=1-o.general.minPValue,c=Math.min(l,u),f=l-c,h=u-c,d=Math.max(f,h),m=null===s?0:1-s-c,g=a>=0?m:-m,p=r.Color.toHtml(null===s?r.Color.lightLightGray:r.Color.scaleColor(g,-d,d,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(w-b/2,A,C<3||null===s?3:C,0,2*Math.PI,!0),t.closePath(),t.fill()}else if(i instanceof m.J&&i.mutationCliffs&&i.cliffStats){const o=i.cliffStats.maxCount,u=i.cliffStats.minDiff,c=i.cliffStats.maxDiff,f=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(f){const e=f.count,n=f.meanDifference,i=Math.floor(Math.abs(e/Math.max(o,2))*S),s=Math.max(Math.abs(u),Math.abs(c)),a=r.Color.toHtml(null===n?r.Color.lightLightGray:r.Color.scaleColor(n,-s,s,255));t.beginPath(),t.fillStyle=a,t.arc(w-b/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=r.Color.toHtml(r.Color.white),i instanceof m.J){let r=0;const o=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!==o)for(const[t,e]of o)r+=null!==(d=e.length)&&void 0!==d?d:0;0!==r&&t.fillText(r.toString(),w+b-5,A,b-5)}else if(i instanceof m.UJ){const r=null!==(g=i.monomerPositionStats)&&void 0!==g?g:null===(p=null==i?void 0:i.model)||void 0===p?void 0:p.monomerPositionStats,o=null===(C=null===(y=null==r?void 0:r[n])||void 0===y?void 0:y[e])||void 0===C?void 0:C.count;o&&t.fillText(o.toString(),w+b-5,A,b-5)}if(i instanceof m.J){const r=i.mutationCliffsSelection[n];r&&r.includes(e)&&v(t,o)}else if(i instanceof m.UJ){const r=i.invariantMapSelection[n];r&&r.includes(e)&&v(t,o)}}function b(t,e,n,i,o,s,a){a=r.Color.fromHtml(r.Color.toHtml(function(t,e){return(16777215&t|255<<24)>>>0}(a)));let l=o.toFixed(2);l.endsWith(".00")&&(l=o.toFixed(0)),l.endsWith("0")&&l.includes(".")&&(l=o.toFixed(1));const u=Math.min(13,Math.floor(s.width/40/l.length*6*13));t.fillStyle=r.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=r.Color.toHtml(r.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 w(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[d.W.CUSTOM].includes(e)||n[d.W.ORIGINAL].includes(e))&&v(t,i)}function A(t,e,n,u,c,f={x:0,y:0,mpStats:{},monomerPosition:{}}){var d;if(null!==(d=c.isSelectionTable)&&void 0!==d||(c.isSelectionTable=!1),0==Object.keys(f.mpStats).length&&(f.mpStats=e),c.isSelectionTable&&(!c.webLogoBounds||!c.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;const l=t.g,f=t.bounds,h=t.cell.tableColumn;l.save();try{if(l.beginPath(),l.clearRect(f.x,f.y,f.width,f.height),l.rect(f.x,f.y,f.width,f.height),l.clip(),t.cell.isColHeader&&(null==h?void 0:h.semType)===o.uF.MONOMER){let d;if(m.filter.anyFalse){const t=null!==(i=m.temp[o.gp.M_P_STATS_CACHE])&&void 0!==i?i:{},e=null==t?void 0:t[h.name],r=m.filter.getBuffer();if(t&&e&&e.filter.length===r.length&&e.filter.every(((t,e)=>t===r[e])))d=e.stats[h.name];else{const e=(0,a.Ej)(u,m.filter,n,{isFiltered:!0,columns:[h.name]});d=e[h.name],t[h.name]={filter:m.filter.getBuffer(),stats:e,selection:m.selection.getBuffer()}}m.temp[o.gp.M_P_STATS_CACHE]=t}else d=c.isSelectionTable?(0,a.Ej)(u,m.filter,n,{isFiltered:!0,columns:[h.name]})[h.name]:e[h.name];if(!d)return;const v=Object.keys(d).sort(((t,e)=>""===t||"-"===t?1:""===e||"-"===e?-1:0)).filter((t=>"general"!==t));c.webLogoBounds()[h.name]=function(t,e,n,i,o,a,l,u={},c={}){var f,h,d,m,v,y,C,b,w;const A=window.devicePixelRatio;null!==(f=c.symbolStyle)&&void 0!==f||(c.symbolStyle="16px Roboto, Roboto Local, sans-serif"),null!==(h=c.upperLetterHeight)&&void 0!==h||(c.upperLetterHeight=12.2),null!==(d=c.upperLetterAscent)&&void 0!==d||(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!==(b=c.headerStyle)&&void 0!==b||(c.headerStyle=`bold ${c.textHeight*A}px Roboto, Roboto Local, sans-serif`);const S=(o.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,_=Math.max(c.selectionWidth*A,.05*e.width*A),N=2*c.marginHorizontal+c.selectionWidth,M=(e.width-(N+c.marginHorizontal))*A,I=(e.x+N)*A,O=g.Z.getMonomerLib(),L={};for(const e of o){const i=T*(n[e].count/a),o=T*((null!==(w=u[e])&&void 0!==w?w:0)/a);if(L[e]=new r.Rect(I/A,E/A,M/A,i/A),t.resetTransform(),"-"!==e&&""!==e){const n=(0,s.zS)(e,5),a=t.measureText(n);o>0&&(t.lineWidth=_,t.line(x,E,x,E+o,r.Color.rowSelection));const l=O.getMonomerTextColor(p.o.AA,e);t.fillStyle=l,t.textAlign="left",t.textBaseline="top",t.font=c.symbolStyle;const u=M/a.width,f=i/c.upperLetterHeight;t.setTransform(u,0,0,f,I,E),t.fillText(n,0,0,a.width)}E+=i+c.upperLetterAscent*A}return t.resetTransform(),t.fillStyle=r.Color.toHtml(r.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}(l,f,d,h.name,v,m.filter.trueCount,c.colorPalette(),c.headerSelectedMonomers?c.headerSelectedMonomers()[h.name]:{}),t.preventDefault()}}catch(t){console.warn(`PeptidesHeaderLogoError: couldn't render WebLogo for column \`${h.name}\`. See original error below.`),console.warn(t)}finally{l.restore()}})(t)));const v=n=>{var r;const s=t.hitTest(n.offsetX,n.offsetY);if((null==s?void 0:s.isColHeader)&&(null===(r=s.tableColumn)||void 0===r?void 0:r.semType)===o.uF.MONOMER){const t=function(t,e,n){const i=n[t.tableColumn.name];if(!i)return null;for(const[n,r]of Object.entries(i)){const i=e.offsetX>=r.x&&e.offsetX<=r.x+r.width,o=e.offsetY>=r.y&&e.offsetY<=r.y+r.height;if(i&&o)return{monomerOrCluster:n,positionOrClusterType:t.tableColumn.name}}return null}(s,n,c.webLogoBounds());if(null===t)return void(c.isSelectionTable||null==c.unhighlightCallback||c.unhighlightCallback());f.monomerPosition=t,function(t,e,n,r,o,s){if("click"!==t.type||o.isSelectionTable||null==o.selectionCallback){const a=`${e.positionOrClusterType} = ${e.monomerOrCluster}`;o.cachedWebLogoTooltip().bar===a?i.tooltip.show(o.cachedWebLogoTooltip().tooltip,t.clientX,t.clientY):(o.cachedWebLogoTooltip().bar=a,s.x=t.clientX,s.y=t.clientY,s.monomerPosition=e,o.cachedWebLogoTooltip().tooltip=(0,h.Y)(n,r,[],s))}else o.selectionCallback(e,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey})}(n,t,m,u,c,f),c.isSelectionTable||null==c.highlightCallback||c.highlightCallback(t,m,e)}else null!=c.unhighlightCallback&&c.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!=c.unhighlightCallback&&c.unhighlightCallback()}))}class S extends r.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),r=()=>{t.cell.column.temp[this.HoverTempKey]=null,i.tooltip.hide(),null!==n&&t.grid.invalidate()},o=t.cell.value;if(!o)return void r();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 r();let f;try{f=JSON.parse(o)}catch(e){return void r()}const h=new Float64Array(Object.keys(f).length+1),d=Object.values(f).reduce(((t,e)=>t+e),0);h[Object.keys(f).length]=2*Math.PI;let m=0,g=0;for(const t of Object.values(f))h[g++]=m,m+=2*Math.PI*t/d;let p=-1;for(let t=0;t<h.length-1;t++)if(c>=h[t]&&c<h[t+1]){p=t;break}if(-1===p)return void r();const v=Object.keys(f)[p],y=f[v],C=(y/d*100).toFixed(2);i.tooltip.show(i.h1(`${v}: ${y} (${C}%)`),e.x+16,e.y+16);const b=t.cell.rowIndex.toString()+this.hoverSeparator+v;t.cell.column.temp[this.HoverTempKey]=b,n!==b&&t.grid.invalidate()}render(t,e,n,i,o,s,a){const l=s.cell.dataFrame,u=new r.Rect(e,n,i,o).fitSquare().inflate(-2,-2);if(i<5||o<5||!l)return;const c=s.cell.value;if(t.clearRect(e,n,i,o),!c)return;let f;try{f=JSON.parse(c)}catch(t){return}const h=Object.values(f).reduce(((t,e)=>t+e),0);let d=0;const m=Object.fromEntries(Object.keys(f).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(f))m[t]=100;m[e]=255}}const p=Math.min(i,o)/2.2;for(const[e,n]of Object.entries(f)){const i=2*Math.PI*n/h;t.beginPath(),t.moveTo(u.midX,u.midY),t.arc(u.midX,u.midY,p,d,d+i),d+=i;const o=this.categoryNumberCache(s.cell.column);o[e]||(o[e]=Object.keys(o).length,s.cell.column.temp[this.colorCacheKey]=o),t.fillStyle=r.Color.toHtml(r.Color.setAlpha(r.Color.getCategoricalColor(o[e]),m[e])),t.fill(),t.strokeStyle=r.Color.toRgb(r.Color.lightGray),t.stroke();const a=e;t.fillStyle=r.Color.toRgb(r.Color.white),t.font="9px Arial";const l=t.measureText(a).width,c=d-i/2;for(let e=.8;e>=.4;e-=.05){const n=p*e,r=u.midX+Math.cos(c)*n,o=u.midY+Math.sin(c)*n;if([[r-l/2-2,o],[r+l/2+2,o]].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),r=n<0?n+2*Math.PI:n;return e<p-2&&r>d-i&&r<d}))){t.fillText(a,r,o);break}}}}}},4139:(t,e,n)=>{"use strict";n.d(e,{$2:()=>i,To:()=>l,V5:()=>h,YX:()=>f,gp:()=>o,i6:()=>r,rg:()=>u,uF:()=>s,wf:()=>c,zW:()=>d});var i,r,o,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"}(r||(r={})),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"}(o||(o={})),function(t){t.MONOMER="Monomer",t.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference"}(s||(s={}));const l="ColumnName";var u,c,f;!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-"}(f||(f={}));const h=Object.values(a.AGG).filter((t=>![a.AGG.FIRST,a.AGG.KEY,a.AGG.PIVOT,a.AGG.SELECTED_ROWS_COUNT].includes(t))),d={[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:()=>h,B2:()=>M,BE:()=>C,CD:()=>w,F2:()=>p,FZ:()=>v,KT:()=>T,Lv:()=>O,Y1:()=>d,ZR:()=>E,dl:()=>S,eY:()=>g,qI:()=>_,qx:()=>m,sg:()=>I,vW:()=>A,vY:()=>b,zm:()=>N,zz:()=>y});var i,r=n(7389),o=n(6082),s=n(4328),a=n(4139),l=n(8774),u=n(144),c=n.n(u),f=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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 h(t){var e;return null!==(e=t.getTag(a.gp.SEPARATOR))&&void 0!==e?e:""}function d(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(),r=o.Column.float(a.$2.ACTIVITY,t.length).init((t=>{const e=i[t];return e===o.FLOAT_NULL||e===o.INT_NULL?e:n(e)}));return r.setTag(a.gp.ANALYSIS_COL,"true"),r.setTag(o.TAGS.FORMULA,e),r}function m(t){var e,n,i,r;const o=t.columns.bySemTypeAll(a.uF.MONOMER),s={},l=t.filter.clone().and(t.selection).getSelectedIndexes();for(const t of l)for(const a of o){const o=a.get(t);o&&(null!==(e=s[i=a.name])&&void 0!==e||(s[i]={}),null!==(n=(r=s[a.name])[o])&&void 0!==n||(r[o]=0),s[a.name][o]+=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,f=l.getRawData();for(let t=0;t<c.length;++t){if(!Object.values(i).includes(c[t]))continue;const e=o.Color.toHtml(l.meta.colors.getColor(f.indexOf(t))),a=r.label(null!==(s=n[c[t]])&&void 0!==s?s:c[t],{style:{color:e}});u.push(a)}const h=r.divV([r.divV(u),t.root,r.tableFromMap(e)]);return t.root.style.maxHeight="75px",h}function v(t,e,n){var r,s;const l=null!==(r=null==n?void 0:n.clone().xor(e).anyTrue)&&void 0!==r&&r,u=t.length,c=t.getRawData(),f=new Float32Array(u+e.trueCount+(l&&null!==(s=null==n?void 0:n.trueCount)&&void 0!==s?s:0)),h=new Array(f.length);for(let t=0,r=0,o=0;t<u;++t){const s=e.get(t);f[t]=c[t],h[t]=s?i.SELECTION:i.ALL,s&&(f[u+r]=c[t],h[u+r]=i.ALL,++r),l&&(null==n?void 0:n.get(t))&&(f[u+e.trueCount+o]=c[t],h[u+e.trueCount+o]=i.PEPTIDES_SELECTION,++o)}const d=o.Column.fromStrings(a.$2.SPLIT_COL,h),m=[i.ALL,i.SELECTION];return l&&m.push(i.PEPTIDES_SELECTION),d.setCategoryOrder(m),d.meta.colors.setCategorical(),o.DataFrame.fromColumns([o.Column.fromFloat32Array(a.$2.ACTIVITY,f),d])}function y(t){const e=r.iconFA("expand-alt",(()=>{const e=t.dataFrame.plot.grid();b(e,!1),e.root.style.height="100%";const n=r.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 o=r.iconFA("expand-alt",(()=>{const e=i(),n=r.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");o.style.marginLeft="auto",o.style.marginRight="15px",n.addEventListener("mouseenter",(()=>{o.style.visibility="visible"})),n.addEventListener("mouseleave",(()=>{o.style.visibility="hidden"})),e.appendChild(o)}function b(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 w(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],r=i.indexOf(e.monomerOrCluster);if(n.shiftPressed&&n.ctrlPressed)-1!==r&&i.splice(r,1);else if(n.ctrlPressed)-1===r?i.push(e.monomerOrCluster):i.splice(r,1);else if(n.shiftPressed)-1===r&&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,r]of i){const i=e[t];for(const t of r){const e=i[t];e&&(null!=n||(n=new l.A(e.mask.length,!1)),n.or(e.mask))}}return null!=n?o.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 _(t,e){var n;const i={};for(const[r,o]of t)for(const[t,s]of o){null!==(n=i[t])&&void 0!==n||(i[t]={});const o=new l.A(e,!1);for(const[t,e]of s){o.setTrue(t);for(const t of e)o.setTrue(t)}i[t][r]={mask:o}}return i}function N(t,e,n,i){const r=Object.entries(n),o=i?Object.entries(i).filter((t=>!e.includes(t[0])||n[t[0]]!==t[1])):[];return r.concat(o).filter((e=>t.columns.contains(e[0])&&t.col(e[0]).matches("numerical")))}function M(t,e=2){return t.columns.bySemTypeAll(o.SEMTYPE.MACROMOLECULE).length>0&&c()(t.columns.numerical).toArray().length>0&&t.rowCount>=e}function I(t,e=500){let n;return(...i)=>f(this,void 0,void 0,(function*(){return new Promise((r=>{clearTimeout(n),n=setTimeout((()=>r(t(...i))),e)}))}))}function O(){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:()=>f});var i=n(6082),r=n(6572),o=n(4139);const s=(t,e)=>`${t}(${e})`;function a(t,e,n){var o;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===(o=i.DataFrame.fromColumns([n.col]).clone(i.BitSet.fromBytes(e.buffer.buffer,e.length)).col(n.col.name))||void 0===o?void 0:o.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 f=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:f,meanDifference:f-t,ratio:s.length/e.length,mask:e,aggValue:l}}const h=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 o=r.mean(t),s=r.mean(e),a=r.variance(t),l=r.variance(e),u=t.length,c=e.length;let f,h,d;if(n){const t=a/u,e=l/c,n=(o-s)/Math.sqrt(t+e);h=r.normal.pdf(n,0,1),f=1-h,d=2*(h<f?h:f)}else if(i){const t=u+c-2,e=(a*(u-1)+l*(c-1))/t,n=Math.sqrt(u*c/(u+c))*(o-s)/e;f=1-r.studentt.cdf(n,t),h=r.studentt.cdf(n,t),d=2*(h<f?h:f)}else{const t=a/u,e=l/c,n=(o-s)/Math.sqrt(t+e),i=Math.pow(t+e,2)/(Math.pow(t,2)/(u-1)+Math.pow(e,2)/(c-1));h=r.studentt.cdf(n,i),f=1-h,d=2*(h<f?h:f)}return{"p-value":d,"Mean difference":o-s,"p-value more":f,"p-value less":h}}(s,a),d=h["Mean difference"];return{count:s.length,pValue:h[d>=0?"p-value more":"p-value less"],mean:f,meanDifference:d,ratio:s.length/e.length,mask:e,aggValue:l}}function l(t,e,n){const r=o.zW[e],s=i.Stats.fromColumn(t,n);if(!(r in s))throw new Error(`Aggregation type ${r} is not supported`);return s[r]}function u(t,e,n={}){var i,r;null!==(i=n.filterDf)&&void 0!==i||(n.filterDf=!1),null!==(r=n.fractionDigits)&&void 0!==r||(n.fractionDigits=3);const o=n.filterDf&&t.filter.anyFalse?t.clone(t.filter):t,a={};for(const[t,i]of e){const e=s(i,t),r=l(o.getCol(t),i,n.mask);a[e]=r.toFixed(n.fractionDigits)}return a}function c(t,e,n,i){var r;null!==(r=i.fractionDigits)&&void 0!==r||(i.fractionDigits=3);const o={};for(const[r,a]of n){const n=s(a,r),l=t.get(n,e);o[n]=l.toFixed(i.fractionDigits)}return o}function f(t,e,n){var r;const o=t.col(e.substring(5,e.length-1));if(!o||!o.matches("categorical"))return"{}";null!=n||(n=i.BitSet.create(t.rowCount,(()=>!0)));const s=o.getRawData(),a=new Map;for(let t=-1;-1!==(t=n.findNext(t,!0));)a.set(s[t],(null!==(r=a.get(s[t]))&&void 0!==r?r:0)+1);const l={};for(const[t,e]of a)l[o.categories[t]]=e;return JSON.stringify(l)}},912:(t,e,n)=>{"use strict";n.d(e,{D:()=>u,Y:()=>c});var i=n(7389),r=n(6082),o=n(4139),s=n(7654),a=n(8608),l=n(5070);function u(t,e,n,i){var r,s,a;return null!==(r=i.fromViewer)&&void 0!==r||(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!==o.$2.MONOMER&&c(t,e,n,i),!0}function c(t,e,n,o){var u,c,f,h,d,m,g,p,v;if(null!==(u=o.fromViewer)&&void 0!==u||(o.fromViewer=!1),null!==(c=o.isMutationCliffs)&&void 0!==c||(o.isMutationCliffs=!1),null!==(f=o.isMostPotentResidues)&&void 0!==f||(o.isMostPotentResidues=!1),null!==(h=o.additionalStats)&&void 0!==h||(o.additionalStats={}),o.cliffStats&&o.isMutationCliffs){const u=null===(p=null===(g=o.cliffStats)||void 0===g?void 0:g.get(o.monomerPosition.monomerOrCluster))||void 0===p?void 0:p.get(o.monomerPosition.positionOrClusterType);if(!u)return null;const c=r.BitSet.fromBytes(u.mask.buffer.buffer,e.length),f=(0,s.M1)((0,a.FZ)(e,c),!0),h=(0,s.QD)(u,{countName:"Unique count"});o.fromViewer&&(h["Mean difference"]=`${h["Mean difference"]} (Color)`,h["Unique count"]&&(h["Unique count"]=`${h["Unique count"]} (Size)`));const d=null!==(v=o.aggrColValues)&&void 0!==v?v:(0,l.I_)(t,n,{mask:c}),m=Object.assign(Object.assign(Object.assign({},o.additionalStats),h),d),y=(0,a.F2)(f,m);return i.tooltip.show(y,o.x,o.y),y}{const u=o.mpStats[o.monomerPosition.positionOrClusterType][o.monomerPosition.monomerOrCluster];if(!(null==u?void 0:u.count))return null;const c=r.BitSet.fromBytes(u.mask.buffer.buffer,e.length),f=(0,s.M1)((0,a.FZ)(e,c),!0),h=(0,s.QD)(u);o.fromViewer&&(h["Mean difference"]=`${h["Mean difference"]}${o.isMostPotentResidues?" (size)":""}`,h["p-value"]&&(h["p-value"]=`${h["p-value"]}${o.isMostPotentResidues?" (color)":""}`));const g=null!==(d=o.aggrColValues)&&void 0!==d?d:(0,l.I_)(t,n,{mask:c}),p=Object.assign(Object.assign(Object.assign({},o.additionalStats),h),g);for(const[t,e]of Object.entries(null!==(m=o.postfixes)&&void 0!==m?m:{}))p[t]&&(p[t]=`${p[t]}${e}`);const v=(0,a.F2)(f,p);return i.tooltip.show(v,o.x,o.y),v}}},115:(t,e,n)=>{"use strict";n.d(e,{GI:()=>a,Ku:()=>o,av:()=>s});var i=n(1199),r=n(4329);const o="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=o,this.webGPUDescriptionPromise=(0,r._)().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),r=n(4328),o=n(6082),s=n(7233),a=n.n(s),l=n(768),u=n(4139),c=n(3163),f=n(4326),h=n(5070),d=n(144),m=n.n(d),g=n(7654),p=n(8608),v=n(8774),y=n(6920),C=n(3657),b=n(3077),w=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 o.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._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:o.TYPE.CATEGORICAL}),this.activityColumnName=this.column("activity",{category:E.GENERAL,nullable:!1,columnTypeFilter:o.TYPE.NUMERICAL}),this.activityScaling=this.string("activityScaling",u.rg.NONE,{category:E.GENERAL,choices:Object.values(u.rg)}),this.webLogoMode=this.string("webLogoMode",f.fH.Entropy,{choices:[f.fH.full,f.fH.Entropy],category:E.STYLE}),this.membersRatioThreshold=this.float("membersRatioThreshold",.1,{min:0,max:1,category:E.STYLE}),this.columns=this.columnList("columns",[],{category:E.AGGREGATION}),this.aggregation=this.string("aggregation",o.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 r=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=r(l.q.SEQUENCE_VARIABILITY_MAP))&&void 0!==n?n:r(l.q.MOST_POTENT_RESIDUES))&&void 0!==i?i:(0,b.R)(this.dataFrame.getCol(this.sequenceColumnName),w.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?o.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;if(super.onTableAttached(),(0,p.B2)(this.dataFrame))null===(t=this.getProperty(`sequence${u.To}`))||void 0===t||t.set(this,this.dataFrame.columns.bySemType(o.SEMTYPE.MACROMOLECULE).name),null===(e=this.getProperty(`activity${u.To}`))||void 0===e||e.set(this,m()(this.dataFrame.columns.numerical).next().value.name),null===(n=this.getProperty(`clusters${u.To}`))||void 0===n||n.set(this,m()(this.dataFrame.columns.categorical).next().value.name);else{const t="PeptidesError: dataframe is missing Macromolecule or numeric columns";r.log.error(t),r.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.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}`:case"activityScaling":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})`))}createLogoSummaryTable(){var t,e,n;const i=this.clustersColumnName,r=this.dataFrame.filter.anyFalse,s=r?this.dataFrame.clone(this.dataFrame.filter):this.dataFrame,a=s.columns,l=s.rowCount,c=this.getScaledActivityColumn(r).getRawData(),f=s.getCol(i),d=f.getRawData(),g=f.categories,p={};p[u.gp.CUSTOM_CLUSTER]="1";const y=m()(a.byTags(p)).filter((t=>t.max>0)).toArray(),C=o.DataFrame.create(y.length),b=C.columns,w=b.addNewString(u.i6.CLUSTER),E=b.addNewInt(u.i6.MEMBERS).getRawData(),T=b.addNewString(u.i6.WEB_LOGO),x=b.addNewString(u.i6.DISTRIBUTION),_=b.addNewFloat(u.i6.MEAN_DIFFERENCE).getRawData(),N=b.addNewFloat(u.i6.P_VALUE).getRawData(),M=b.addNewFloat(u.i6.RATIO).getRawData();let I=s.groupBy([i]);const O=this.getTotalViewerAggColumns(),L=this.getStringAggregatedColumns(),R=L.map((t=>b.addNewString(t))),P=O.map((([t,e])=>A(e,t))),k=new Array(P.length+L.length),V=O.map((([t,e])=>[s.getCol(t),e]));for(let t=0;t<O.length;++t){const[e,n]=O[t];I=I.add(n,e,P[t]);const i=b.addNewFloat(P[t]);k[t]=i.getRawData()}const D=new Array(y.length);for(let e=0;e<y.length;++e){const n=y[e];w.set(e,n.name);const i=v.A.fromUint32Array(l,n.getRawData());if(i.allFalse)continue;const a=o.BitSet.fromBytes(i.buffer.buffer,l),u=r?(0,h.GT)(c,i):this.clusterStats[S.CUSTOM][n.name];E[e]=u.count,D[e]=a,_[e]=u.meanDifference,N[e]=null!==(t=u.pValue)&&void 0!==t?t:o.FLOAT_NULL,M[e]=u.ratio;for(let t=0;t<P.length;++t){const[n,i]=V[t];k[t][e]=(0,h.lh)(n,i,a)}for(let t=P.length;t<k.length;++t){const n=L[t-P.length];R[t-P.length].set(e,(0,h.J1)(s,n,a))}}T.setTag(o.TAGS.CELL_RENDERER,"html"),x.setTag(o.TAGS.CELL_RENDERER,"html");const G=I.aggregate(),F=G.rowCount,U=G.columns;let H=G.getCol(i);H.name=u.i6.CLUSTER,H.type!==o.COLUMN_TYPE.STRING&&(G.columns.replace(H,H.convertTo(o.COLUMN_TYPE.STRING)),H=G.getCol(H.name));const q=H.categories,B=U.addNewInt(u.i6.MEMBERS).getRawData(),Y=U.addNewString(u.i6.WEB_LOGO),W=U.addNewString(u.i6.DISTRIBUTION),j=U.addNewFloat(u.i6.MEAN_DIFFERENCE).getRawData(),$=U.addNewFloat(u.i6.P_VALUE).getRawData(),z=U.addNewFloat(u.i6.RATIO).getRawData(),K=L.map((t=>U.addNewString(t))),Q=new Array(F),Z=Array.from({length:F},(()=>new v.A(l,!1)));for(let t=0;t<l;++t){const n=g[d[t]];null===(e=Z[q.indexOf(n)])||void 0===e||e.setTrue(t)}for(let t=0;t<F;++t){const e=Z[t];if(e.allFalse)continue;const i=o.BitSet.fromBytes(e.buffer.buffer,l),a=r?(0,h.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,h.J1)(s,n,i))}B[t]=a.count,Q[t]=i,j[t]=a.meanDifference,$[t]=null!==(n=a.pValue)&&void 0!==n?n:o.FLOAT_NULL,z[t]=a.ratio}Y.setTag(o.TAGS.CELL_RENDERER,"html"),W.setTag(o.TAGS.CELL_RENDERER,"html");const X=G.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.dataFrame.clone(this.dataFrame.filter):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 r=new o.LruCache,s=new Map;let h=null;const d=new o.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 b=t.g,w=t.bounds;b.save(),b.beginPath(),b.rect(w.x,w.y,w.width,w.height),b.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(b,g.cell.value,this.clusterSelection,w),t.preventDefault();else if((null===(n=g.tableColumn)||void 0===n?void 0:n.name)===u.i6.WEB_LOGO){if(!0===s.get(C))return void t.preventDefault();const e=Math.floor((g.bounds.width-2-4*(m-1))/m),n=r.get(C);if(void 0!==n){const i=n.getProperties();for(const t of i)"positionHeight"===t.name&&t.get(n)!==this.webLogoMode?t.set(n,this.webLogoMode):"positionWidth"===t.name&&t.get(n)!==e?t.set(n,e):"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=this.createWebLogoDf(y,S);s.set(C,!0),n.plot.fromType("WebLogo",{positionHeight:this.webLogoMode,horizontalAlignment:f.P4.LEFT,maxHeight:1e3,minHeight:A,positionWidth:e,showPositionLabels:!1}).then((t=>{r.set(C,t),s.delete(C),h&&clearTimeout(h),h=setTimeout((()=>i.invalidate()),200)})),t.preventDefault()}}else if((null===(l=g.tableColumn)||void 0===l?void 0:l.name)===u.i6.DISTRIBUTION){let e=d.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:o.Color.toHtml(o.Color.white),xAxisHeight:1,showSplitSelector:!1}),e.root.style.width="auto",d.set(C,e)),e.root.style.height=`${A}px`,g.element=e.root,t.preventDefault()}}finally{b.restore()}})),i.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),o.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 r=this.getCluster(n);this.modifyClusterSelection(r,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey}),i.invalidate()})),i.onCellTooltip(((t,e,n)=>{var i;if(!t.isTableCell)return this.model.unhighlight(),!0;const r=this.getCluster(t);return this.highlightCluster(r),(null===(i=t.tableColumn)||void 0===i?void 0:i.name)===u.i6.CLUSTER&&this.showTooltip(r,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,r=i.indexOf("-1"),o=t.getRawData();let s=0;o.forEach(((t,e)=>{"-1"!==i[n[e]]&&(s=Math.max(s,o[e]))}));const a=Math.ceil(s*this.membersRatioThreshold);this.logoSummaryTable.filter.init((t=>o[t]>a&&(-1===r||"-1"!==i[n[t]])))}clusterFromSelection(){const t=this.model.getVisibleSelection(),e=this.logoSummaryTable.columns,n=e.length,i=new Array(e.length),r=this.getScaledActivityColumn(),o=v.A.fromString(t.toBinaryString()),s=(0,h.GT)(r.getRawData(),o);this.bitsets.push(t.clone());const a=this.dataFrame.columns.getUnusedName("New Cluster"),l={},c={},f=this.getTotalViewerAggColumns(),d=this.getStringAggregatedColumns();for(const[e,n]of f){const i=A(n,e),r=this.dataFrame.getCol(e);l[i]=(0,h.lh)(r,n,t)}for(const e of d)c[e]=(0,h.J1)(this.dataFrame,e,t);for(let r=0;r<n;++r){const n=e.byIndex(r);i[r]=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[r]&&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 r.shell.warning("No custom clusters selected to be removed");const e=this.logoSummaryTable.rows,n=this.logoSummaryTable.getCol(u.i6.CLUSTER),i=n.categories,o=this.dataFrame.columns;for(const n of t){t.splice(t.indexOf(n),1),o.remove(n),delete this.clusterStats[S.CUSTOM][n];const r=i.indexOf(n);e.removeAt(r),this.bitsets.splice(r,1)}n.compact(),this.clusterSelection[S.CUSTOM]=t,this.render()}addNewCluster(t){const e=o.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 r=this.dataFrame.filter,s=r.anyFalse?this.dataFrame.clone(r):this.dataFrame,a=s.rowCount,l=new v.A(a,!1),u=this.getScaledActivityColumn(r.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 f=r.anyFalse?(0,h.GT)(c,l):this.clusterStats[t.positionOrClusterType][t.monomerOrCluster];if(!f.count)return null;const d=o.BitSet.fromBytes(l.buffer.buffer,a),m=(0,p.FZ)(u,d),y=(0,g.M1)(m,!0),C=(0,g.QD)(f),b=(0,h.I_)(this.dataFrame,this.getTotalViewerAggColumns(),{filterDf:!0,mask:d}),w=Object.assign(Object.assign({},C),b),A=(0,p.F2)(y,w);return i.tooltip.show(A,e,n),A}createWebLogoDf(t,e){const n=o.DataFrame.fromColumns([t]);return n.filter.copyFrom(e),n}}},3541:(t,e,n)=>{"use strict";n.d(e,{J:()=>N,UJ:()=>M,xN:()=>_});var i,r,o,s,a=n(4328),l=n(7389),u=n(6082),c=n(7233),f=n.n(c),h=n(4139),d=n(3163),m=n(768),g=n(144),p=n.n(g),v=n(5070),y=n(912),C=n(3657),b=n(8608),w=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(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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"}(r||(r={})),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"}(o||(o={})),function(t){t.GENERAL="General",t.INVARIANT_MAP="Invariant Map",t.MUTATION_CLIFFS="Mutation Cliffs",t.AGGREGATION="Aggregation"}(s||(s={}));class _ 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(r.SEQUENCE,{category:s.GENERAL,semType:u.SEMTYPE.MACROMOLECULE,nullable:!1}),this.activityColumnName=this.column(r.ACTIVITY,{category:s.GENERAL,nullable:!1}),this.activityScaling=this.string(r.ACTIVITY_SCALING,h.rg.NONE,{category:s.GENERAL,choices:Object.values(h.rg),nullable:!1}),this.activityTarget=this.string(r.ACTIVITY_TARGET,h.wf.HIGH,{category:s.GENERAL,choices:Object.values(h.wf),nullable:!1}),this.targetColumnName=this.column(r.TARGET,{category:s.GENERAL,nullable:!0,columnTypeFilter:"categorical",userEditable:!0}),this.minActivityDelta=this.float(r.MIN_ACTIVITY_DELTA,0,{category:s.MUTATION_CLIFFS,min:0,max:100}),this.maxMutations=this.int(r.MAX_MUTATIONS,1,{category:s.MUTATION_CLIFFS,min:1,max:20}),this.columns=this.columnList(r.COLUMNS,[],{category:s.AGGREGATION}),this.aggregation=this.string(r.AGGREGATION,u.AGG.AVG,{category:s.AGGREGATION,choices:h.V5}),this.valueColumnName=this.column(r.VALUE_INVARIANT_MAP,{category:s.INVARIANT_MAP,userEditable:!0,nullable:!1,columnTypeFilter:"numerical"}),this.valueAggregation=this.string(r.AGGREGATION_INVARIANT_MAP_VALUE,u.AGG.TOTAL_COUNT,{category:s.INVARIANT_MAP,choices:h.V5,userEditable:!0,nullable:!1}),this.mutationCliffsDebouncer=(0,b.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[h.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.width="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 N?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,w.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 _&&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 _||null!=this.targetColumnName&&null!=(null===(i=this.targetCategoryInput)||void 0===i?void 0:i.value))||!(t instanceof _&&this.valueColumnName==(null==t?void 0:t.valueColumnName)&&this.valueAggregation==(null==t?void 0:t.valueAggregation))&&(t instanceof _||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 N?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,r=this.targetCategoryInput.value,o=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&&r?{col:i,cat:r}:void 0,aggValue:s&&o?{col:o,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===(r=n.targetCategoryInput)||void 0===r?void 0:r.value)===(null===(o=null==i?void 0:i.targetCategoryInput)||void 0===o?void 0:o.value)&&n.minActivityDelta===(null==i?void 0:i.minActivityDelta)&&n.maxMutations===(null==i?void 0:i.maxMutations)?e._mutationCliffs:null;var n,i,r,o};return this instanceof N?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 N?h.YX.MP:h.YX.MPR,n=this.dataFrame.getTag(`${e}${h.gp.MUTATION_CLIFFS_SELECTION}`);return null!==(t=this._mutationCliffsSelection)&&void 0!==t||(this._mutationCliffsSelection=null===n?(0,b.ZR)(this.positionColumns):JSON.parse(n)),this._mutationCliffsSelection}set mutationCliffsSelection(t){this._mutationCliffsSelection=t;const e=this instanceof N?h.YX.MP:h.YX.MPR;this.dataFrame.setTag(`${e}${h.gp.MUTATION_CLIFFS_SELECTION}`,JSON.stringify(t)),this.model.fireBitsetChanged(this instanceof N?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,b.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,b.vW)(this.mutationCliffsSelection,t,e):this._mutationCliffsSelection=(0,b.vW)(this.mutationCliffsSelection,t,e)}modifyInvariantMapSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.invariantMapSelection=(0,b.vW)(this.invariantMapSelection,t,e):this._invariantMapSelection=(0,b.vW)(this.invariantMapSelection,t,e)}get invariantMapSelection(){var t;const e=this.dataFrame.getTag(`${h.YX.MP}${h.gp.INVARIANT_MAP_SELECTION}`);return null!==(t=this._invariantMapSelection)&&void 0!==t||(this._invariantMapSelection=null===e?(0,b.ZR)(this.positionColumns):JSON.parse(e)),this._invariantMapSelection}set invariantMapSelection(t){this._invariantMapSelection=t,this.dataFrame.setTag(`${h.YX.MP}${h.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`${r.SEQUENCE}${h.To}`:this._positionColumns=null,this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._viewerGrid=null;break;case`${r.ACTIVITY}${h.To}`:case r.ACTIVITY_SCALING:this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._viewerGrid=null,this._scaledActivityColumn=null;break;case`${r.VALUE_INVARIANT_MAP}${h.To}`:case r.AGGREGATION_INVARIANT_MAP_VALUE:this._monomerPositionStats=null,this._viewerGrid=null,this._invariantMapSelection=null;break;case r.MIN_ACTIVITY_DELTA:case r.MAX_MUTATIONS:this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this.doRender=!1;break;case r.COLUMNS:case r.AGGREGATION:this instanceof M&&(this._viewerGrid=null);break;case r.ACTIVITY_TARGET:(this instanceof M||this instanceof N)&&(this._viewerGrid=null)}null===this._mutationCliffs&&this.sequenceColumnName&&this.activityColumnName&&this.calculateMutationCliffs().then((t=>{this.mutationCliffs=t.cliffs,this.cliffStats=t.cliffStats})),t.name===`${r.TARGET}${h.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,b.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,b.B2)(this.dataFrame))null===(t=this.getProperty(`${r.SEQUENCE}${h.To}`))||void 0===t||t.set(this,this.dataFrame.columns.bySemType(u.SEMTYPE.MACROMOLECULE).name),null===(e=this.getProperty(`${r.ACTIVITY}${h.To}`))||void 0===e||e.set(this,p()(this.dataFrame.columns.numerical).next().value.name),null===(n=this.getProperty(`${r.VALUE_INVARIANT_MAP}${h.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:{}})),r=new Set;i.forEach((t=>Object.keys(t).forEach((t=>r.add(t))))),r.delete("colors"),e.group("Monomer Meta").items(Array.from(r),(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(b.eY),n=this.targetColumnName?(0,b.eY)(this.dataFrame.getCol(this.targetColumnName)):null,i={maxMutations:this.maxMutations,minActivityDelta:this.minActivityDelta,targetCol:n,currentTarget:this.targetCategoryInput.value},r=t.getRawData(),o=yield this.mutationCliffsDebouncer(r,e,i);return{cliffs:o,cliffStats:(0,C.Lw)(o,r)}}))}}class N extends _{constructor(){super(),this.currentGridCell=null,this.customColorRange=!1,this.minColorValue=0,this.maxColorValue=0,this.logScaleColor=!1,this.colorColumnName=this.column(o.COLOR,{category:s.INVARIANT_MAP,nullable:!1,columnTypeFilter:"numerical"}),this.colorAggregation=this.string(o.COLOR_AGGREGATION,u.AGG.AVG,{category:s.INVARIANT_MAP,choices:h.V5}),this.lowerBoundColor=this.int(o.LOWER_BOUND_COLOR,4278190335,{category:s.INVARIANT_MAP,editor:"color"}),this.middleColor=this.int(o.MIDDLE_COLOR,4294967295,{category:s.INVARIANT_MAP,editor:"color"}),this.upperBoundColor=this.int(o.UPPER_BOUND_COLOR,4294901760,{category:s.INVARIANT_MAP,editor:"color"}),this.logScaleColor=this.bool(o.LOG_SCALE_COLOR,!1,{category:s.INVARIANT_MAP}),this.customColorRange=this.bool(o.CUSTOM_COLOR_RANGE,!1,{category:s.INVARIANT_MAP}),this.minColorValue=this.float(o.MIN_COLOR_VALUE,0,{category:s.INVARIANT_MAP}),this.maxColorValue=this.float(o.MAX_COLOR_VALUE,0,{category:s.INVARIANT_MAP})}get name(){return m.q.SEQUENCE_VARIABILITY_MAP}get mode(){var t;return null!==(t=this.dataFrame.getTag(h.gp.MONOMER_POSITION_MODE))&&void 0!==t?t:i.MUTATION_CLIFFS}set mode(t){this.dataFrame.setTag(h.gp.MONOMER_POSITION_MODE,t),this.viewerGrid.invalidate()}onTableAttached(){var t;if(super.onTableAttached(),(0,b.B2)(this.dataFrame))null===(t=this.getProperty(`${o.COLOR}${h.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(`${r.TARGET}${h.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===r.SEQUENCE&&(this._invariantMapSelection=null),null===(e=this.positionColumns)||void 0===e||e.forEach((t=>{t.temp[h.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(h.$2.MONOMER,n),r=u.DataFrame.fromColumns([i]),o=(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=r.columns.addNewString(t);o.then((n=>{e.init((e=>{var i,r;return null!==(r=null===(i=n[e][t])||void 0===i?void 0:i.toString())&&void 0!==r?r:""}))}))})),r.name="SAR";for(const t of e)r.columns.addNewBool(t.name);return r}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,r=null==i?void 0:i.getRawData(),o=this.targetCategoryInput.value,s=null==o?null:null==i?void 0:i.categories.indexOf(o);for(const i of this.positionColumns){i.temp[h.gp.INVARIANT_MAP_COLOR_CACHE]={};const o=i.temp[h.gp.INVARIANT_MAP_COLOR_CACHE],a=i.name,l=i.getRawData(),c=i.categories;if(!this.monomerPositionStats[a])continue;const f=this.monomerPositionStats[a];for(const a of Object.keys(f)){if("general"===a)continue;const f=[];for(let t=0;t<i.length;++t){const e=c[l[t]]===a,n=!r||null==s||-1==s||r[t]===s;e&&n&&f.push(t)}const h=u.Column.float("color",f.length).init((e=>t[f[e]])).aggregate(this.colorAggregation);o[a]=h,e=Math.min(e,h),n=Math.max(n,h)}i.temp[h.gp.INVARIANT_MAP_COLOR_CACHE]=o}const a=this.customColorRange&&null!=this.minColorValue&&null!=this.maxColorValue;let l=a?this.minColorValue:e,c=a?this.maxColorValue:n;const f=this.logScaleColor&&l>1e-30&&c>1e-30&&e>1e-30&&n>1e-30;f&&(l=Math.log(l),c=Math.log(c));for(const t of this.positionColumns){const i=t.temp[h.gp.INVARIANT_MAP_COLOR_CACHE];if(i){for(const t of Object.keys(i))this.activityTarget===h.wf.LOW&&(i[t]=c-i[t]+l),i[t]=u.Color.scaleColor(f?Math.log(i[t]):i[t],l,c,void 0,[this.lowerBoundColor,this.middleColor,this.upperBoundColor]);t.temp[h.gp.INVARIANT_MAP_COLOR_CACHE]=i,t.temp[h.gp.INVARIANT_MAP_COLOR_MIN_CACHE]=e,t.temp[h.gp.INVARIANT_MAP_COLOR_MAX_CACHE]=n}}}}createViewerGrid(){const t=this.createMonomerPositionDf(),e=t.plot.grid();e.sort([h.$2.MONOMER]);const n=this.positionColumns.map((t=>t.name));e.columns.setOrder([h.$2.MONOMER,...this._monomerMetaColumns,...n]);const r=t.getCol(h.$2.MONOMER);d.rI(r,this.alphabet,!0),this.cacheInvariantMapColors(),e.onCellRender.subscribe((t=>I(t,this,this.mode===i.INVARIANT_MAP,this.dataFrame.getCol(this.colorColumnName),this.colorAggregation))),e.onCellTooltip(((t,e,n)=>{var r,o,s,a,l;if(!t.isTableCell||!(null===(r=null==t?void 0:t.cell.column)||void 0===r?void 0:r.name)||this._monomerMetaColumns.has(t.cell.column.name))return this.model.unhighlight(),!0;const c=this.getMonomerPosition(t);(0,b.dl)(c,this.dataFrame,this.monomerPositionStats),this.model.isHighlighting=!0;const f=this.getTotalViewerAggColumns(),h={},d={};if(this.mode===i.INVARIANT_MAP)this.colorColumnName&&this.colorAggregation&&this.colorColumnName!==this.valueColumnName?(f.unshift([this.colorColumnName,this.colorAggregation]),h[`${this.colorAggregation}(${this.colorColumnName})`]=" (color)"):this.colorColumnName&&this.colorAggregation&&this.colorColumnName===this.valueColumnName&&(h["Mean activity"]=" (color)"),this.valueColumnName&&this.valueAggregation&&this.valueAggregation!==u.AGG.VALUE_COUNT&&this.valueAggregation!==u.AGG.TOTAL_COUNT&&f.unshift([this.valueColumnName,this.valueAggregation]);else{const t=null===(s=null===(o=this.mutationCliffs)||void 0===o?void 0:o.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;d["Pairs count"]=e.toString()}}return(0,y.D)(this.model.df,this.getScaledActivityColumn(),f,{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:h,additionalStats:d})})),e.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),u.debounce(e.onCurrentCellChanged,500).subscribe((t=>{var n,r,o,s,a,l,c,f,h;try{if(!t||!t.dart||!(null===(r=null===(n=null==t?void 0:t.cell)||void 0===n?void 0:n.column)||void 0===r?void 0:r.name)||this._monomerMetaColumns.has(t.cell.column.name))return;if(-1===t.gridRow&&(this.mode===i.INVARIANT_MAP?this._invariantMapSelection=(0,b.ZR)(this.positionColumns):this._mutationCliffsSelection=(0,b.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===(o=this.mutationCliffs)||void 0===o?void 0:o.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===(f=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===f?void 0:f.size)&&this.modifyMutationCliffsSelection(u,{shiftPressed:!0,ctrlPressed:!1},!0),e.invalidate(),setTimeout((()=>null==e?void 0:e.invalidate()),300)}finally{this.keyPressed=!1,(null===(h=t.tableColumn)||void 0===h?void 0:h.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,b.ZR)(this.positionColumns):this._mutationCliffsSelection=(0,b.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 r,o,s,a,l;const u=e.hitTest(n.offsetX,n.offsetY);if(!(null==u?void 0:u.isTableCell)||(null===(r=null==u?void 0:u.tableColumn)||void 0===r?void 0:r.name)===h.$2.MONOMER||(null===(o=null==u?void 0:u.tableColumn)||void 0===o?void 0:o.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,b.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()})),O(e);const o=e.onAfterDrawContent.subscribe((()=>{const t=e.col(h.$2.MONOMER);if(40!==t.width){t.width=40;for(const t of n)e.col(t).width=40}else o.unsubscribe()}));return e}getMonomerPosition(t){return{monomerOrCluster:t.cell.dataFrame.get(h.$2.MONOMER,t.tableRowIndex),positionOrClusterType:t.tableColumn.name}}render(){var t,e,n;if(f()(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 r=this.getProperty(o.COLOR);r&&(r.choices=p()(a.shell.t.columns.numerical).toArray().map((t=>t.name)),r.get(this)===h.$2.ACTIVITY_SCALED&&r.set(this,h.$2.ACTIVITY)),f()(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=>{f()(t.root).find(".ui-input-editor").css("margin","0px").attr("type","radio"),f()(t.root).find(".ui-input-description").css("padding","0px").css("padding-right","16px"),f()(t.captionLabel).addClass("ui-label-right")};n(t),n(e),s=l.divH([t.root,e.root],{id:"pep-viewer-title"}),f()(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");f()(c).addClass("pep-help-icon"),this.targetColumnInput&&(this.targetColumnInput.root.style.width="50%");const d=l.divH([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"}}),g=l.divH([c,s,d],{style:{alignSelf:"center",lineHeight:"normal",flexDirection:"column"}});this.root.appendChild(l.divV([g,u])),null===(n=this.viewerGrid)||void 0===n||n.invalidate()}}class M extends _{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),r=new Array(n.length),o=new Array(n.length),s=new Array(n.length),a=new Array(n.length),l=new Array(n.length),c=this.getTotalViewerAggColumns(),f=c.map((([t,e])=>(0,v.hX)(e,t))),d=new Array(f.length);f.forEach(((t,e)=>d[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]));if(0===y.length)continue;let C=null;for(const[t,e]of y)(null===C||this.activityTarget===h.wf.HIGH&&C[1].meanDifference<e.meanDifference||this.activityTarget===h.wf.LOW&&C[1].meanDifference>e.meanDifference)&&(C=[t,e]);if(null===C)continue;n[m]=parseInt(g),i[m]=C[0],r[m]=C[1].meanDifference,o[m]=C[1].pValue,s[m]=C[1].count,a[m]=C[1].ratio,l[m]=C[1].mean;const b=this.monomerPositionStats[g][C[0]],w=u.BitSet.fromBytes(b.mask.buffer.buffer,this.model.df.col(this.activityColumnName).length);for(let t=0;t<f.length;t++){const[e,n]=c[t];d[t][m]=(0,v.lh)(this.model.df.getCol(e),n,w)}++m}n.length=m,i.length=m,r.length=m,o.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,h.$2.POSITION,n)),p.add(u.Column.fromList(u.TYPE.STRING,h.$2.MONOMER,i)),p.add(u.Column.fromList(u.TYPE.FLOAT,h.$2.MEAN_DIFFERENCE,r)),p.add(u.Column.fromList(u.TYPE.FLOAT,h.$2.MEAN,l)),p.add(u.Column.fromList(u.TYPE.FLOAT,h.$2.P_VALUE,o)),p.add(u.Column.fromList(u.TYPE.INT,h.$2.COUNT,s)),p.add(u.Column.fromList(u.TYPE.FLOAT,h.$2.RATIO,a)),f.forEach(((t,e)=>p.add(u.Column.fromList(u.TYPE.FLOAT,t,d[e])))),g}createViewerGrid(){const t=this.createMostPotentResiduesDf(),e=t.plot.grid();e.sort([h.$2.POSITION]);const n=e.col(h.$2.P_VALUE);n.format="#.000",n.name="P-value";const i=t.getCol(h.$2.MONOMER);d.rI(i,this.alphabet,!0),e.onCellRender.subscribe((t=>I(t,this,!1))),e.onCellTooltip(((t,e,n)=>{var i,r;if(!t.isTableCell)return this.model.unhighlight(),!0;const o=this.getMonomerPosition(t);if((0,b.dl)(o,this.dataFrame,this.monomerPositionStats),this.model.isHighlighting=!0,(null===(i=t.tableColumn)||void 0===i?void 0:i.name)===h.$2.MONOMER)o.positionOrClusterType=h.$2.MONOMER;else if((null===(r=t.tableColumn)||void 0===r?void 0:r.name)!==h.$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:o,x:e,y:n,mpStats:this.monomerPositionStats,aggrColValues:a})})),u.debounce(e.onCurrentCellChanged,500).subscribe((n=>{var i,r,o;try{if(-1===n.gridRow)return this._mutationCliffsSelection=(0,b.ZR)(this.positionColumns),this._invariantMapSelection=(0,b.ZR)(this.positionColumns),this.model.fireBitsetChanged(m.q.MOST_POTENT_RESIDUES),void e.invalidate();if(this.keyPressed&&t.currentCol.name!==h.$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===(o=null===(r=null===(i=this.mutationCliffs)||void 0===i?void 0:i.get(s.monomerOrCluster))||void 0===r?void 0:r.get(s.positionOrClusterType))||void 0===o?void 0:o.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,b.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,r;const o=e.hitTest(t.offsetX,t.offsetY);if(!(null==o?void 0:o.isTableCell)||o.tableColumn.name!==h.$2.MEAN_DIFFERENCE)return;const s=this.getMonomerPosition(o);(null===(r=null===(i=null===(n=this.monomerPositionStats)||void 0===n?void 0:n[s.positionOrClusterType])||void 0===i?void 0:i[s.monomerOrCluster])||void 0===r?void 0:r.count)&&(this.modifyInvariantMapSelection(s,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey}),e.invalidate())})),O(e);const r=e.col(h.$2.MEAN_DIFFERENCE);r.name="Diff";const o=e.onAfterDrawContent.subscribe((()=>{const t=e.col(h.$2.MONOMER);if(40===t.width)return r.width=40,void o.unsubscribe();t.width=40,r.width=40}));return e}getMonomerPosition(t){return{monomerOrCluster:t.cell.dataFrame.get(h.$2.MONOMER,t.tableRowIndex),positionOrClusterType:`${t.cell.dataFrame.get(h.$2.POSITION,t.tableRowIndex)}`}}render(){var t;if(f()(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 I(t,e,n,i,r){var o,s,a,l,c;const f=[...e.positionColumns.map((t=>t.name)),h.$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===(o=p.tableColumn)||void 0===o?void 0:o.name,y=p.tableRowIndex;if(!p.isTableCell||-1===f.indexOf(v))return void m.restore();const C=p.grid.table,b=C.get(h.$2.MONOMER,y),w=v!==h.$2.MEAN_DIFFERENCE?v:C.get(h.$2.POSITION,y).toFixed(),A=e.monomerPositionStats[w];if(!A[b])return t.preventDefault(),void m.restore();if(n){const t=null!==(s=A[b].aggValue)&&void 0!==s?s:A[b].count,n=e.positionColumns.find((t=>t.name===w)),i=null!==(a=n.temp[h.gp.INVARIANT_MAP_COLOR_CACHE])&&void 0!==a?a:{};let r=u.Color.white;null!=i[b]?r=i[b]:e instanceof N&&(e.cacheInvariantMapColors(),r=null!==(c=(null!==(l=n.temp[h.gp.INVARIANT_MAP_COLOR_CACHE])&&void 0!==l?l:{})[b])&&void 0!==c?c:u.Color.white),d.rW(m,b,w,e.invariantMapSelection,t,g,r)}else d.Yd(m,b,w,e,g);t.preventDefault(),m.restore()}function O(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,r=n(7389),o=n(6082),s=n(7233),a=n.n(s),l=n(4139),u=n(5070),c=n(8608),f=n(5480),h=n(8774);!function(t){t.SEPARATE_MONOMERS="separateMonomers",t.SEPARATE_POSITIONS="separatePositions",t.SEPARATE_CLUSTERS="separateClusters"}(i||(i={}));const d="general",m=t=>t===d?"General":t.substring(8);function g(t,e){if(!t.selection.anyTrue)return r.divText("No distribution");const n=()=>{const n=[C(d,t,e)];for(const r of Object.values(i))"true"!==t.getTag(r)||r===i.SEPARATE_CLUSTERS&&!e.clusterColName||n.push(C(r,t,e));return 1===n.length?n[0]:r.div(n)},o=r.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]=r.input.bool(c,{value:"true"===t.getTag(s[u]),onValueChanged:e=>{t.setTag(s[u],`${e}`),a()(o).empty(),o.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[f.W.ORIGINAL]):c!==i.SEPARATE_MONOMERS&&c!==i.SEPARATE_POSITIONS||(l[u].enabled=0!==Object.entries(e.monomerPositionSelection).length)}const u=r.form(l);return r.divV([u,o])}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 r={[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&&(r["p-value"]=t.pValue<.01?"<0.01":t.pValue.toFixed(e.fractionDigits)),r}function y(t,e,n,i={}){const r=p((0,c.FZ)(n.activityCol,t.selection,n.peptideSelection)),s=(0,u.I_)(t,Object.entries(n.columns),{filterDf:!0,mask:o.BitSet.fromBytes(e.mask.buffer.buffer,e.mask.length)}),l=v(e),f=Object.assign(Object.assign({},l),s),h=(0,c.F2)(r,f,i);return a()(h).addClass("d4-flex-col"),h}function C(t,e,n){let o=r.divText("No distribution");switch(t){case d:const t=h.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};o=y(e,s,n);break;case i.SEPARATE_CLUSTERS:o=function(t,e,n){const i=t.rowCount,o=[],s=e.activityCol.getRawData(),a=t.getCol(e.clusterColName),l=a.categories,d=a.getRawData(),m=n[f.W.ORIGINAL].map((t=>l.indexOf(t))),g=new Array(m.length).fill(new h.A(i));for(let t=0;t<i;t++){const e=d[t],n=m.indexOf(e);-1!==n&&g[n].setTrue(t)}for(let n=0;n<m.length;n++){const i=m[n],r=(0,u.GT)(s,g[n]);o.push(y(t,r,e,{[c.AN.SELECTION]:l[i]}))}const p=n[f.W.CUSTOM];for(const n of p){const r=t.getCol(n),a=h.A.fromUint32Array(i,r.getRawData()),l=(0,u.GT)(s,a);o.push(y(t,l,e,{[c.AN.SELECTION]:n}))}return r.div(o,"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);o=function(t,e,n){var i,o,s;const a=Object.keys(n),l=t.rowCount,f=[],d=[],m=[],g=[],p=e.activityCol.getRawData();for(const r of a){const a=n[r],v=new h.A(l);for(let e=0;e<a.length;e++){const n=a[e];null!==(i=d[e])&&void 0!==i||(d[e]=t.getCol(n)),null!==(o=m[e])&&void 0!==o||(m[e]=d[e].categories),null!==(s=g[e])&&void 0!==s||(g[e]=d[e].getRawData());const u=m[e].indexOf(r);for(let t=0;t<l;t++)g[e][t]===u&&v.setTrue(t)}const C=(0,u.GT)(p,v);f.push(y(t,C,e,{[c.AN.SELECTION]:r}))}return r.div(f,"d4-flex-wrap")}(e,n,a);break;case i.SEPARATE_POSITIONS:o=function(t,e,n){var i,o,s;const a=Object.keys(n),l=t.rowCount,f=[],d=e.activityCol.getRawData(),m=[],g=[],p=[];for(let r=0;r<a.length;r++){const v=a[r],C=n[v];if(0===C.length)continue;null!==(i=m[r])&&void 0!==i||(m[r]=t.getCol(v)),null!==(o=g[r])&&void 0!==o||(g[r]=m[r].categories),null!==(s=p[r])&&void 0!==s||(p[r]=m[r].getRawData());const b=new h.A(t.rowCount);for(let t=0;t<C.length;t++){const e=C[t],n=g[r].indexOf(e);for(let t=0;t<l;t++)p[r][t]===n&&b.setTrue(t)}const w=(0,u.GT)(d,b);f.push(y(t,w,e,{[c.AN.SELECTION]:v}))}return r.div(f,"d4-flex-wrap")}(e,n,n.monomerPositionSelection)}return r.divV([r.h1(m(t)),o])}},7923:(t,e,n)=>{"use strict";n.d(e,{F:()=>l});var i=n(7389),r=n(6082),o=n(4139),s=n(8608),a=n(3163);function l(t,e,n=!0){const o=u(t,e);if(!o)return new r.Widget(i.label("No mutations table generated"));const{pairsGrid:a,uniqueSequencesGrid:l,aminoToInput:c}=o,f=[a,l],h=i.divV([c.root,...f.map((t=>t.root))],{style:{width:"100%"}});return n&&(0,s.BE)("Mutation Cliffs pairs",c.root,h,(()=>{const n=u(t,e),r=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(r)){const o=r.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="100%",a.style.marginTop="20px",o>400)){const t=Math.max(.33*o,200),i=n.pairsGrid.columns.byName("Mutation");i&&(i.width=t);const r=n.uniqueSequencesGrid.columns.byName(e.sequenceColumnName);r&&(r.width=t)}}}),500),r})),new r.Widget(h)}function u(t,e){var n,l;const u=t.filter.getSelectedIndexes(),c=Object.keys(e.mutationCliffsSelection);if(!c.length||null===e.mutationCliffs)return null;const f=[],h=[],d=[],m=[],g=[],p=[],v=t.getCol(e.sequenceColumnName),y=v.categories,C=v.getRawData(),b=e.activityCol.getRawData(),w=new Map,A=r.BitSet.create(t.rowCount),S={},E=Object.fromEntries(e.positionColumns.map((t=>[t.name,t])));for(const t of c){const i=E[t],r=i.categories,o=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,e]of s.entries()){if(!u.includes(t))continue;S[t]||(S[t]=Object.keys(S).length+1);const n=S[t],i=null!==(l=w.get(t))&&void 0!==l?l:[],s=y[C[t]],a=b[t];for(const l of e){if(i.includes(l)||!u.includes(l))continue;w.has(l)||w.set(l,[]);const e=y[C[l]];w.get(l).push(t),f.push(`${s}#${e}`),m.push(`${n}`),h.push(a-b[l]),d.push(r[o[l]]),g.push(t),p.push(l),A.set(t,!0),A.set(l,!0)}}}}if(0===f.length)return null;const T=r.Column.fromStrings("Mutation",f),x=r.Column.fromList("double","Delta",h),_=r.Column.fromStrings("Group",m),N=r.Column.fromStrings("~to",d),M=r.Column.fromList(r.COLUMN_TYPE.INT,"~toIdx",p),I=r.Column.fromList(r.COLUMN_TYPE.INT,"~fromIdx",g),O=r.DataFrame.fromColumns([T,x,_,N,M,I]);O.name="Mutation Cliff pairs";const L=i.input.string("Mutated to:",{value:"",onValueChanged:t=>{const e=t;""!==e?O.filter.init((t=>N.get(t)===e)):O.filter.setAll(!0)}});L.setTooltip("Filter the rows by the monomer that the mutation was substituted to");const R=O.plot.grid();(0,s.vY)(R,!0),T.semType=o.uF.MACROMOLECULE_DIFFERENCE,T.tags[o.gp.SEPARATOR]=(0,s.AY)(v),T.tags[r.TAGS.UNITS]=v.tags[r.TAGS.UNITS],T.tags[r.TAGS.CELL_RENDERER]="MacromoleculeDifference";let P=!1,k=null;const V=[];R.onCurrentCellChanged.subscribe((t=>{try{if(!t||!t.dart)return V.length=0,void Y();const e=t.tableRowIndex;if(!P)return;if(null===e)return V.length=0,void Y();null!==k&&V.splice(V.indexOf(k),1),V.includes(e)||(V.push(e),R.invalidate()),Y()}finally{P=!1,k=t&&t.dart?t.tableRowIndex:null}})),R.root.addEventListener("keydown",(t=>{P=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=V.indexOf(n);-1===t?V.push(n):V.splice(t,1)}else V.length=0,V.push(n);Y(),R.invalidate(),B.invalidate()})),R.onCellRender.subscribe((t=>{var e;(null===(e=t.cell.tableColumn)||void 0===e?void 0:e.name)===T.name&&V.includes(t.cell.tableRowIndex)&&(0,a.X5)(t.g,t.bounds)}));const D=e.gridColumns.length,G=[];for(let t=1;t<D;t++){const n=e.gridColumns.byIndex(t);((null==n?void 0:n.name)===e.sequenceColumnName||!0===(null==n?void 0:n.visible)&&!Object.hasOwn(E,n.name))&&G.push(n.name)}const F=t.clone(A,G);F.name="Unique sequences that form Mutation Cliffs pairs";const U=F.columns.addNewInt("~seqIdx"),H=U.getRawData(),q=A.getSelectedIndexes();U.init((t=>q[t]));const B=F.plot.grid();function Y(){const t=[];for(const e of V)t.push(I.get(e)),t.push(M.get(e));F.filter.init((e=>0===V.length||t.includes(H[e])),!0),R.invalidate(),B.invalidate()}return(0,s.vY)(B,!0),B.props.rowHeight=20,R.root.style.width="100% !important",B.root.style.width="100% !important",setTimeout((()=>{R.autoSize(window.innerWidth,250,void 0,void 0,!1),B.autoSize(window.innerWidth,250,void 0,void 0,!1),R.root.style.removeProperty("width"),R.root.style.setProperty("width","100%"),B.root.style.removeProperty("width"),B.root.style.setProperty("width","100%"),R.root.style.minHeight="70px",B.root.style.minHeight="100px",R.root.style.height="unset",B.root.style.height="unset"}),200),{pairsGrid:R,uniqueSequencesGrid:B,aminoToInput:L}}},5082:(t,e,n)=>{"use strict";n.d(e,{n:()=>v,v:()=>p});var i=n(4328),r=n(7389),o=n(6082),s=(n(4788),n(4139)),a=n(115),l=n(768),u=n(7233),c=n.n(u),f=n(8608),h=n(2003),d=n(1199),m=n(5429),g=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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 p(t,e){const n=new a.av,l=r.div();let u=null;if(void 0===e){const e=o.Utils.firstOrNull(t.columns.toList().filter((t=>t.semType===o.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=r.input.column("Sequence",{table:t,value:e,onValueChanged:e=>{c()(l).empty().append(r.wait((()=>g(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===o.SEMTYPE.MACROMOLECULE}),u.setTooltip("Macromolecule column in FASTA, HELM or separated format")}else if("SEQ.MSA"!==e.getTag(h.gp.aligned)&&e.getTag(o.TAGS.UNITS)!==h.Hi.HELM)return{host:r.label("Peptides analysis only works with aligned sequences"),callback:()=>g(this,void 0,void 0,(function*(){return!1}))};let p,y=o.Func.find({package:"Bio",name:"webLogoViewer"});if(0===y.length)return{host:r.label("Bio package is missing or out of date. Please install the latest version."),callback:()=>g(this,void 0,void 0,(function*(){return!1}))};if(y=o.Func.find({package:"Bio",name:"getBioLib"}),0===y.length)return{host:r.label("Bio package is missing or out of date. Please install the latest version."),callback:()=>g(this,void 0,void 0,(function*(){return!1}))};const C=t.col("activity")||t.col("IC50")||o.Utils.firstOrNull(t.columns.numerical),b=r.div([],{id:"pep-hist-host"}),w=r.input.choice("Scaling",{value:s.rg.NONE,items:Object.values(s.rg),onValueChanged:t=>g(this,void 0,void 0,(function*(){var e;p=(0,f.Y1)(S.value,t);const n=o.DataFrame.fromColumns([p]).plot.histogram({filteringEnabled:!1,valueColumnName:s.$2.ACTIVITY,legendVisibility:"Never",showXAxis:!0,showColumnSelector:!1,showRangeSlider:!1,showBinSelector:!1});null===(e=b.lastChild)||void 0===e||e.remove(),b.appendChild(n.root)}))});w.setTooltip("Activity column transformation method");const A=()=>{var t;w.enabled=null!==(t=S.value)&&void 0!==t&&t&&S.value.stats.min>0,w.value=s.rg.NONE,0!==S.value.stats.missingValueCount&&i.shell.info("Activity column contains missing values. They will be ignored during analysis")},S=r.input.column("Activity",{table:t,value:C,onValueChanged:A,filter:t=>t.type===o.TYPE.INT||t.type===o.TYPE.FLOAT||t.type===o.TYPE.QNUM});S.setTooltip("Numerical activity column");const E=r.input.column("Clusters",{table:t,onValueChanged:t=>{t&&(T.value=!1,T.fireChanged())}});E.setTooltip("Optional. Clusters column is used to create Logo Summary Table"),E.nullable=!0;const T=r.input.bool("Generate clusters",{value:!0,onValueChanged:t=>{t&&(E.value=null,E.fireChanged())}});T.setTooltip("Generate clusters column based on MCL embeddings for Logo Summary Table"),S.fireChanged(),w.fireChanged(),T.fireChanged();const x=[S,w,E,T];null!==u&&x.splice(0,0,u);const _=r.input.float(m.t_.THRESHOLD,{value:n.threshold,nullable:!1,onValueChanged:t=>n.threshold=null!=t?t:n.threshold});_.setTooltip("Threshold for similarity between two sequences to create edges");const N=r.input.float(m.t_.INFLATION,{value:n.inflation,nullable:!1,onValueChanged:t=>n.inflation=null!=t?t:n.inflation});N.setTooltip("Inflation value for MCL algorithm");const M=r.input.int(m.t_.MAX_ITERATIONS,{value:n.maxIterations,nullable:!1,onValueChanged:t=>n.maxIterations=null!=t?t:n.maxIterations});M.setTooltip("Maximum iterations for MCL algorithm");const I=r.input.bool(m.t_.USE_WEBGPU,{value:n.useWebGPU,onValueChanged:t=>n.useWebGPU=t});I.enabled=!1,n.webGPUDescriptionPromise.then((()=>{n.webGPUDescription!==a.Ku?(I.setTooltip(`Use WebGPU for MCL algorithm (${n.webGPUDescription})`),I.enabled=!0):(I.setTooltip(a.Ku),I.enabled=!1,I.value=!1)}));const O=r.input.int(m.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 L=r.input.choice(m.t_.DISTANCE_FUNCTION,{value:n.distanceF,items:[d.Z.NEEDLEMANN_WUNSCH,d.Z.MONOMER_CHEMICAL_DISTANCE,d.Z.HAMMING,d.Z.LEVENSHTEIN],nullable:!1,onValueChanged:t=>n.distanceF=t}),R=r.input.float(m.t_.GAP_OPEN,{value:n.gapOpen,onValueChanged:t=>n.gapOpen=null!=t?t:n.gapOpen}),P=r.input.float(m.t_.GAP_EXTEND,{value:n.gapExtend,onValueChanged:t=>n.gapExtend=null!=t?t:n.gapExtend}),k=[_,N,M,O,L,r.input.choice(m.t_.FINGERPRINT_TYPE,{value:n.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],nullable:!1,onValueChanged:t=>n.fingerprintType=t}),R,P,I],V=r.form(k);V.style.display="none";const D=r.icons.settings((()=>{V.style.display="none"===V.style.display?"flex":"none",V.classList.remove("ui-form-condensed")}),"Adjust clustering parameters");D.style.fontSize="16px",T.root.appendChild(D);const G=t.filter.onChanged.subscribe((()=>A())),F=()=>g(this,void 0,void 0,(function*(){var i,r;const o=null!=e?e:u.value;return G.unsubscribe(),!!o&&null!==(yield v(S.value,o,E.value,t,p,null!==(i=w.value)&&void 0!==i?i:s.rg.NONE,{addSequenceSpace:!1,addMCL:!0,useEmbeddingsClusters:null!==(r=T.value)&&void 0!==r&&r,mclSettings:n}))}));let U="auto";const H=[r.divV(x)];if(c()(H[0]).find("label").css("width","unset"),void 0!==e){const t=r.button("Launch SAR",F,"");t.style.alignSelf="center",H.push(t),U="215px"}return c()(l).empty().append(r.wait((()=>g(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:r.divV([l,r.splitH([r.splitV(H),b],{style:{height:U,minWidth:"500px",maxWidth:"600px"}}),V]),callback:F}}function v(t,e,n,r,u,c){return g(this,arguments,void 0,(function*(t,e,n,r,u,c,f={}){var h,d,m,g,p;let v=null;if(t.type!==o.COLUMN_TYPE.FLOAT&&t.type!==o.COLUMN_TYPE.INT&&t.type!==o.COLUMN_TYPE.QNUM)return i.shell.error("The activity column must be of numeric type!"),v;const y=o.TaskBarProgressIndicator.create("Loading SAR...");r.tags.delete&&r.tags.delete(".script");const C=r.columns,b=r.col(u.name);b&&(b.name=C.getUnusedName(b.name));const w=u.getRawData();r.columns.addNew(u.name,u.type).init((t=>w[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(!!f.useEmbeddingsClusters&&!n),mclSettings:null!==(h=f.mclSettings)&&void 0!==h?h:new a.av};if(n){const t=r.getCol(n.name);t.type!==o.COLUMN_TYPE.STRING&&C.replace(t,t.convertTo(o.COLUMN_TYPE.STRING))}if(r.setTag(s.gp.SETTINGS,JSON.stringify(A)),v=l.i.getInstance(r),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!==(d=f.addSequenceSpace)&&void 0!==d&&d){if(yield v.addSequenceSpace({clusterCol:n,clusterEmbeddings:f.useEmbeddingsClusters}),!n&&null!==(m=f.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)===o.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=f.addMCL)&&void 0!==g&&g&&(yield v.addMCLClusters(),!n&&null!==(p=f.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)}}return y.close(),v}))}},5429:(t,e,n)=>{"use strict";n.d(e,{OH:()=>w,t_:()=>l});var i,r,o,s,a,l,u=n(7389),c=n(4328),f=n(6082),h=n(115),d=n(4139),m=n(768),g=n(7233),p=n.n(g),v=n(144),y=n.n(v),C=n(6920),b=n(1199);function w(t){var e,n,o,g,v,w,A,S,E,T;null==t.settings&&c.log.error("PeptidesError: Settings are not initialized");const x=u.accordion(),_=t.settings,N=null!==(e=null==_?void 0:_.activityScaling)&&void 0!==e?e:d.rg.NONE,M=null!==(n=null==_?void 0:_.columns)&&void 0!==n?n:{},I={},O={},L=null!==(o=null==_?void 0:_.sequenceSpaceParams)&&void 0!==o?o:new h.GI,R=null!==(g=null==_?void 0:_.mclSettings)&&void 0!==g?g:new h.av,P=u.input.column(r.ACTIVITY,{table:t.df,value:t.df.getCol(t.settings.activityColumnName),onValueChanged:t=>{I.activityColumnName=t.name},filter:t=>(t.type===f.TYPE.FLOAT||t.type===f.TYPE.INT)&&t.name!==d.$2.ACTIVITY&&0===t.stats.missingValueCount});P.setTooltip("Numeric activity column");const k=u.input.choice(r.ACTIVITY_SCALING,{value:N,items:Object.values(d.rg),onValueChanged:t=>I.activityScaling=t});k.setTooltip("Activity column transformation method"),x.addPane(i.GENERAL,(()=>u.inputs([P,k])),!0),O[i.GENERAL]=[P,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=>I.showDendrogram=t}),G=u.input.bool(m.q.CLUSTER_MAX_ACTIVITY,{value:!!(null==_?void 0:_.showClusterMaxActivity),onValueChanged:t=>{I.showClusterMaxActivity=null!=t?t:void 0}}),F=u.input.bool("Sequence space",{value:!!(null==_?void 0:_.showSequenceSpace),onValueChanged:t=>{I.showSequenceSpace=null!=t?t:void 0,t?(dt.root.style.display="flex",(null==_?void 0:_.showSequenceSpace)||(I.sequenceSpaceParams=L)):(dt.root.style.display="none",delete I.sequenceSpaceParams),I.showSequenceSpace===(null==_?void 0:_.showSequenceSpace)&&delete I.showSequenceSpace}});G.setTooltip("Show cluster max activity viewer"),D.setTooltip("Show dendrogram viewer"),D.enabled=null!==(0,C.getTreeHelperInstance)(),x.addPane(i.VIEWERS,(()=>u.inputs([D,F,G])),!0),O[i.VIEWERS]=[D,F,G];const U=[],H=[];for(const e of t.df.columns.numerical){const t=e.name;if(t===_.activityColumnName||t===d.$2.ACTIVITY)continue;const n=u.input.bool(s.IS_INCLUDED,{value:void 0!==M[t],onValueChanged:e=>{var n;null!==(n=I.columns)&&void 0!==n||(I.columns={}),e?I.columns[t]=i.value:(delete I.columns[t],Object.keys(I.columns).length===Object.keys(M).length&&delete I.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:f.AGG.AVG,items:Object.values(f.STATS),onValueChanged:i=>{var r;null!==(r=I.columns)&&void 0!==r||(I.columns={}),n.value?I.columns[t]=i:(delete I.columns[e.name],Object.keys(I.columns).length===Object.keys(M).length&&delete I.columns)}});i.setTooltip("Aggregation method"),p()(i.root).find("label").css("width","auto");const r=u.inputsRow(e.name,[n,i]);H.push(n,i),p()(r).find("div.ui-div").css("display","inline-flex"),U.push(r)}0!==U.length&&(x.addPane(i.COLUMNS,(()=>u.divV(U)),!1),O[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 I.sequenceSpaceParams:I.sequenceSpaceParams=Object.assign(Object.assign({},L),q)}function Y(t,e){t.forEach((t=>{t.root.style.display=e?"flex":"none"}))}const W=u.input.choice(a.DISTANCE_FUNCTION,{value:L.distanceF,items:[b.Z.NEEDLEMANN_WUNSCH,b.Z.HAMMING,b.Z.LEVENSHTEIN,b.Z.MONOMER_CHEMICAL_DISTANCE],onValueChanged:t=>B("distanceF",t)});W.setTooltip("Distance function for sequences");const j=u.input.float(a.GAP_OPEN,{value:L.gapOpen,onValueChanged:t=>B("gapOpen",t)}),$=u.input.float(a.GAP_EXTEND,{value:L.gapExtend,onValueChanged:t=>B("gapExtend",t)}),z=u.input.bool(a.CLUSTER_EMBEDDINGS,{value:null!==(w=L.clusterEmbeddings)&&void 0!==w&&w,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===b.Z.NEEDLEMANN_WUNSCH),Y([K,Q],!0===z.value),Y([Z],W.value===b.Z.MONOMER_CHEMICAL_DISTANCE||W.value===b.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!==R[t]){n=!1;break}n?delete I.mclSettings:I.mclSettings=Object.assign(Object.assign({},R),J)}function et(){Y([it,rt],nt.value===b.Z.NEEDLEMANN_WUNSCH),Y([ot],nt.value===b.Z.MONOMER_CHEMICAL_DISTANCE||nt.value===b.Z.NEEDLEMANN_WUNSCH)}const nt=u.input.choice(l.DISTANCE_FUNCTION,{value:R.distanceF,items:[b.Z.NEEDLEMANN_WUNSCH,b.Z.MONOMER_CHEMICAL_DISTANCE,b.Z.HAMMING,b.Z.LEVENSHTEIN],onValueChanged:t=>tt("distanceF",t)}),it=u.input.float(l.GAP_OPEN,{value:R.gapOpen,onValueChanged:t=>tt("gapOpen",t)}),rt=u.input.float(l.GAP_EXTEND,{value:R.gapExtend,onValueChanged:t=>tt("gapExtend",t)}),ot=u.input.choice(l.FINGERPRINT_TYPE,{value:R.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],onValueChanged:t=>tt("fingerprintType",t)}),st=u.input.int(l.THRESHOLD,{value:null!==(A=R.threshold)&&void 0!==A?A:80,onValueChanged:t=>tt("threshold",t)}),at=u.input.int(l.MAX_ITERATIONS,{value:null!==(S=R.maxIterations)&&void 0!==S?S:5,onValueChanged:t=>tt("maxIterations",t)}),lt=u.input.float(l.INFLATION,{value:null!==(E=R.inflation)&&void 0!==E?E:1.4,onValueChanged:t=>{tt("inflation",t)}}),ut=u.input.bool(l.USE_WEBGPU,{value:R.useWebGPU,onValueChanged:t=>tt("useWebGPU",t)});ut.enabled=!1,R.webGPUDescriptionPromise.then((()=>{R.webGPUDescription!==h.Ku?(ut.setTooltip(`Use WebGPU for MCL algorithm (${R.webGPUDescription})`),ut.enabled=!0):(ut.setTooltip(h.Ku),ut.enabled=!1,ut.value=!1)}));const ct=u.input.int(l.MIN_CLUSTER_SIZE,{value:null!==(T=R.minClusterSize)&&void 0!==T?T:5,onValueChanged:t=>tt("minClusterSize",t)});et();const ft=[st,nt,ot,it,rt,lt,at,ct,ut];x.addPane(i.MCL,(()=>u.inputs(ft)),!0),O[i.MCL]=ft;const ht=[W,Z,j,$,z,K,Q],dt=x.addPane(i.SEQUENCE_SPACE,(()=>u.inputs(ht)),!0);O[i.SEQUENCE_SPACE]=ht,F.fireChanged();const mt=u.dialog("Peptides settings").add(x);return mt.root.style.width="400px",mt.onOK((()=>{t.settings=I})),mt.show(),{dialog:mt,accordion:x,inputs:O}}!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"}(r||(r={})),function(t){t.DENDROGRAM="Dendrogram"}(o||(o={})),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={})),i.GENERAL,i.VIEWERS,i.COLUMNS,i.SEQUENCE_SPACE,i.MCL},144:function(t){var e;e=function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e,n){"use strict";var i=n(1).default,r=n(39).default,o=n(52).default,s=n(40).default,a=n(54).default,l=n(80).default,u=n(84).default,c=n(65).default,f=t.exports=function(t){if(!m(t))throw new Error("wu: `"+t+"` is not iterable!");return new h(t)};function h(t){var e=g(t);this.next=e.next.bind(e)}f.prototype=h.prototype,f.prototype[o]=function(){return this};var d={},m=function(t){return t&&"function"==typeof t[o]},g=function(t){if(m(t))return s(t);throw new TypeError("Not iterable: "+t)},p=function(t,e){e.prototype=h.prototype,f[t]=e},v=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?e.length:arguments[2];return e.prototype=h.prototype,h.prototype[t]=e,n+=1,void(f[t]=f.curryable((function(){for(var e,n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=i.pop();return(e=f(o))[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 f(t.call.apply(t,[this].concat(n)))}},C=function(t,e){return p(t,y(e))},b=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 r=arguments.length,o=Array(r),s=0;s<r;s++)o[s]=arguments[s];return o.length>=e?t.apply(this,o):function(t,e){return function(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.call.apply(t,[this].concat(i(e),r))}}(n,o)}})),C("entries",a.mark((function t(e){var n,i,r,o,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(l(e));case 5:if(n=(u=o.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,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&o.return&&o.return();case 21:if(t.prev=21,!i){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]])}))),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,r,o,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(l(e));case 5:if(n=(u=o.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,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&o.return&&o.return();case 21:if(t.prev=21,!i){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]])}))),b("cycle",a.mark((function t(){var e,n,i,r,o,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],n=!0,i=!1,r=void 0,t.prev=4,o=s(this);case 6:if(n=(l=o.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,r=t.t0;case 20:t.prev=20,t.prev=21,!n&&o.return&&o.return();case 23:if(t.prev=23,!i){t.next=26;break}throw r;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,r,o,l,u,c,f,h=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,r=h.length,o=Array(r),l=0;l<r;l++)o[l]=h[l];u=s(o);case 6:if(e=(c=u.next()).done){t.next=12;break}return f=c.value,t.delegateYield(f,"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]])}))),b("chunk",a.mark((function t(){var e,n,i,r,o,l,u,c,f=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,r=!1,o=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!==f){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),r=!0,o=t.t0;case 24:t.prev=24,t.prev=25,!i&&l.return&&l.return();case 27:if(t.prev=27,!r){t.next=30;break}throw o;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),b("concatMap",a.mark((function t(e){var n,i,r,o,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(this);case 5:if(n=(l=o.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,r=t.t1;case 17:t.prev=17,t.prev=18,!n&&o.return&&o.return();case 20:if(t.prev=20,!i){t.next=23;break}throw r;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]])}))),b("drop",a.mark((function t(e){var n,i,r,o,l,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=0,i=!0,r=!1,o=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),r=!0,o=t.t0;case 22:t.prev=22,t.prev=23,!i&&l.return&&l.return();case 25:if(t.prev=25,!r){t.next=28;break}throw o;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]])}))),b("dropWhile",a.mark((function t(){var e,n,i,r,o,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,r=s(this);case 5:if(e=(o=r.next()).done){t.next=15;break}if(l=o.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&&r.return&&r.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),b("enumerate",a.mark((function t(){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(w([this,f.count()]),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),b("filter",a.mark((function t(){var e,n,i,r,o,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,r=s(this);case 5:if(e=(o=r.next()).done){t.next=13;break}if(l=o.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&&r.return&&r.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),b("flatten",a.mark((function t(){var e,n,i,r,o,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,r=s(this);case 5:if(e=(o=r.next()).done){t.next=16;break}if("string"==typeof(l=o.value)||!m(l)){t.next=11;break}return t.delegateYield(u?l:f(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&&r.return&&r.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),b("invoke",a.mark((function t(e){var n,i,r,o,l,u,c,f,h,d=arguments;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n=!0,i=!1,r=void 0,t.prev=3,o=d.length,l=Array(o>1?o-1:0),u=1;u<o;u++)l[u-1]=d[u];c=s(this);case 6:if(n=(f=c.next()).done){t.next=13;break}return h=f.value,t.next=10,h[e].apply(h,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,r=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 r;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]])}))),b("map",a.mark((function t(e){var n,i,r,o,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(this);case 5:if(n=(l=o.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,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&o.return&&o.return();case 21:if(t.prev=21,!i){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]])}))),b("pluck",a.mark((function t(e){var n,i,r,o,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(this);case 5:if(n=(l=o.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,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&o.return&&o.return();case 21:if(t.prev=21,!i){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]])}))),b("reductions",a.mark((function t(e){var n,i,r,o,l,u,c,f,h,d,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,r=!1,o=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),r=!0,o=t.t0;case 20:t.prev=20,t.prev=21,!i&&l.return&&l.return();case 23:if(t.prev=23,!r){t.next=26;break}throw o;case 26:return t.finish(23);case 27:return t.finish(20);case 28:return t.next=30,n;case 30:f=!0,h=!1,d=void 0,t.prev=33,m=s(this);case 35:if(f=(g=m.next()).done){t.next=42;break}return c=g.value,t.next=39,n=e(n,c);case 39:f=!0,t.next=35;break;case 42:t.next=48;break;case 44:t.prev=44,t.t1=t.catch(33),h=!0,d=t.t1;case 48:t.prev=48,t.prev=49,!f&&m.return&&m.return();case 51:if(t.prev=51,!h){t.next=54;break}throw d;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),b("reject",a.mark((function t(){var e,n,i,r,o,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,r=s(this);case 5:if(e=(o=r.next()).done){t.next=13;break}if(l=o.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&&r.return&&r.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),b("slice",a.mark((function t(){var e,n,i,o,l,u,c,f,h=arguments.length<=0||void 0===arguments[0]?0:arguments[0],d=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(!(d<h)){t.next=2;break}throw new RangeError("parameter `stop` (= "+d+") must be >= `start` (= "+h+")");case 2:e=!0,n=!1,i=void 0,t.prev=5,o=s(this.enumerate());case 7:if(e=(l=o.next()).done){t.next=20;break}if(u=r(l.value,2),c=u[0],!((f=u[1])<h)){t.next=13;break}return t.abrupt("continue",17);case 13:if(!(f>=d)){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&&o.return&&o.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),b("spreadMap",a.mark((function t(e){var n,r,o,l,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,r=!1,o=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),r=!0,o=t.t0;case 18:t.prev=18,t.prev=19,!n&&l.return&&l.return();case 21:if(t.prev=21,!r){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]])}))),b("take",a.mark((function t(e){var n,i,r,o,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,r=!1,o=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),r=!0,o=t.t0;case 23:t.prev=23,t.prev=24,!i&&l.return&&l.return();case 26:if(t.prev=26,!r){t.next=29;break}throw o;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]])}))),b("takeWhile",a.mark((function t(){var e,n,i,r,o,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,r=s(this);case 5:if(e=(o=r.next()).done){t.next=14;break}if(l=o.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&&r.return&&r.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),b("tap",a.mark((function t(){var e,n,i,r,o,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,r=s(this);case 5:if(e=(o=r.next()).done){t.next=13;break}return l=o.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&&r.return&&r.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),b("unique",a.mark((function t(){var e,n,i,r,o,l,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=new u,n=!0,i=!1,r=void 0,t.prev=4,o=s(this);case 6:if(n=(l=o.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,r=t.t0;case 21:t.prev=21,t.prev=22,!n&&o.return&&o.return();case 24:if(t.prev=24,!i){t.next=27;break}throw r;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 w=y(a.mark((function t(e){var n,i,r,o,l,u,c,f,h,d,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,r=0,o=!1;case 6:if(o){t.next=44;break}l=[],u=!0,c=!1,f=void 0,t.prev=11,h=s(n);case 13:if(u=(d=h.next()).done){t.next=26;break}if(m=d.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:++r==i&&(o=!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,f=t.t0;case 32:t.prev=32,t.prev=33,!u&&h.return&&h.return();case 35:if(t.prev=35,!c){t.next=38;break}throw f;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(w(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(w(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),r=1;r<n;r++)i[r-1]=arguments[r];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(w(i).spreadMap(e),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),f.MAX_BLOCK=15,f.TIMEOUT=1,v("asyncEach",(function(t){var e=arguments.length<=1||void 0===arguments[1]?f.MAX_BLOCK:arguments[1],n=arguments.length<=2||void 0===arguments[2]?f.TIMEOUT:arguments[2],i=g(this);return new c((function(r,o){!function a(){var l=Date.now(),u=!0,c=!1,f=void 0;try{for(var h,d=s(i);!(u=(h=d.next()).done);u=!0){var m=h.value;try{t(m)}catch(t){return void o(t)}if(Date.now()-l>e)return void setTimeout(a,n)}}catch(t){c=!0,f=t}finally{try{!u&&d.return&&d.return()}finally{if(c)throw f}}r()}()}))}),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 r,o=s(this);!(e=(r=o.next()).done);e=!0)if(!t(r.value))return!1}catch(t){n=!0,i=t}finally{try{!e&&o.return&&o.return()}finally{if(n)throw i}}return!0}),1),v("find",(function(t){var e=!0,n=!1,i=void 0;try{for(var r,o=s(this);!(e=(r=o.next()).done);e=!0){var a=r.value;if(t(a))return a}}catch(t){n=!0,i=t}finally{try{!e&&o.return&&o.return()}finally{if(n)throw i}}})),v("forEach",(function(t){var e=!0,n=!1,i=void 0;try{for(var r,o=s(this);!(e=(r=o.next()).done);e=!0)t(r.value)}catch(t){n=!0,i=t}finally{try{!e&&o.return&&o.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,r=void 0;try{for(var o,a=s(this);!(n=(o=a.next()).done);n=!0){e=o.value;break}}catch(t){i=!0,r=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw r}}}var l=!0,u=!1,c=void 0;try{for(var f,h=s(this);!(l=(f=h.next()).done);l=!0)e=t(e,f.value)}catch(t){u=!0,c=t}finally{try{!l&&h.return&&h.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 r,o=s(this);!(e=(r=o.next()).done);e=!0)if(t(r.value))return!0}catch(t){n=!0,i=t}finally{try{!e&&o.return&&o.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,r,o,s,l;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=n.items,r=0;case 2:if(r!==i.length){t.next=14;break}if(o=e.next(),s=o.done,l=o.value,!s){t.next=10;break}return n.returned===d&&(n.returned=l),t.abrupt("break",25);case 10:return t.next=12,i[r++]=l;case 12:t.next=23;break;case 14:if(r!==n.tail){t.next=21;break}return l=i[r],500===r?(i=n.items=i.slice(r),r=0,n.tail=0):(i[r]=void 0,n.tail=++r),t.next=19,l;case 19:t.next=23;break;case 21:return t.next=23,i[r++];case 23:t.next=2;break;case 25:return n.tail===r&&(i.length=0),t.abrupt("return",n.returned);case 27:case"end":return t.stop()}}),t,this)})));A.prototype=h.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:d};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),f.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),r=n(7);t.exports=function(t){return function(e,n){var o,s,a=String(r(e)),l=i(n),u=a.length;return l<0||l>=u?t?"":void 0:(o=a.charCodeAt(l))<55296||o>56319||l+1===u||(s=a.charCodeAt(l+1))<56320||s>57343?t?a.charAt(l):o:t?a.slice(l,l+2):s-56320+(o-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),r=n(10),o=n(13),s=n(14),a=n(19),l=n(20)("iterator"),u=n(23),c=!([].keys&&"next"in[].keys()),f="@@iterator",h="keys",d="values",m=function(){return this};t.exports=function(t,e,g,p,v,y,C){n(24)(g,e,p);var b,w,A=function(t){switch(t){case h:case d:return function(){return new g(this,t)}}return function(){return new g(this,t)}},S=e+" Iterator",E=t.prototype,T=E[l]||E[f]||v&&E[v],x=T||A(v);if(T){var _=n(15).getProto(x.call(new t));n(25)(_,S,!0),!i&&a(E,f)&&s(_,l,m)}if(i&&!C||s(E,l,x),u[e]=x,u[S]=m,v)if(b={keys:y?x:A(h),values:v==d?x:A(d),entries:v!=d?x:A("entries")},C)for(w in b)w in E||o(E,w,b[w]);else r(r.P+r.F*c,e,b)}},function(t,e){t.exports=!0},function(t,e,n){var i=n(11),r=n(12),o="prototype",s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e,n){var l,u,c,f,h=t&a.G,d=t&a.P,m=h?i:t&a.S?i[e]:(i[e]||{})[o],g=h?r:r[e]||(r[e]={});for(l in h&&(n=e),n)(u=!(t&a.F)&&m&&l in m)&&l in g||(c=u?m[l]:n[l],h&&"function"!=typeof m[l]?f=n[l]:t&a.B&&u?f=s(c,i):t&a.W&&m[l]==c?function(t){(f=function(e){return this instanceof t?new t(e):t(e)})[o]=t[o]}(c):f=d&&"function"==typeof c?s(Function.call,c):c,g[l]=f,d&&((g[o]||(g[o]={}))[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),r=n(16);t.exports=n(17)?function(t,e,n){return i.setDesc(t,e,r(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"),r=n(11).Symbol;t.exports=function(t){return i[t]||(i[t]=r&&r[t]||(r||n(22))("Symbol."+t))}},function(t,e,n){var i=n(11),r="__core-js_shared__",o=i[r]||(i[r]={});t.exports=function(t){return o[t]||(o[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),r={};n(14)(r,n(20)("iterator"),(function(){return this})),t.exports=function(t,e,o){t.prototype=i.create(r,{next:n(16)(1,o)}),n(25)(t,e+" Iterator")}},function(t,e,n){var i=n(19),r=n(14),o=n(20)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,o)&&r(t,o,e)}},function(t,e,n){"use strict";var i=n(27),r=n(10),o=n(29),s=n(30),a=n(33),l=n(34),u=n(35);r(r.S+r.F*!n(38)((function(t){Array.from(t)})),"Array",{from:function(t){var e,n,r,c,f=o(t),h="function"==typeof this?this:Array,d=arguments[1],m=void 0!==d,g=0,p=u(f);if(m&&(d=i(d,arguments[2],2)),null==p||h==Array&&a(p))for(n=new h(e=l(f.length));e>g;g++)n[g]=m?d(f[g],g):f[g];else for(c=p.call(f),n=new h;!(r=c.next()).done;g++)n[g]=m?s(c,d,[r.value,g],!0):r.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,r){return t.call(e,n,i,r)}}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,r){try{return r?e(i(n)[0],n[1]):e(n)}catch(e){var o=t.return;throw void 0!==o&&i(o.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),r=n(20)("iterator");t.exports=function(t){return(i.Array||Array.prototype[r])===t}},function(t,e,n){var i=n(6),r=Math.min;t.exports=function(t){return t>0?r(i(t),9007199254740991):0}},function(t,e,n){var i=n(36),r=n(20)("iterator"),o=n(23);t.exports=n(12).getIteratorMethod=function(t){if(null!=t)return t[r]||t["@@iterator"]||o[i(t)]}},function(t,e,n){var i=n(37),r=n(20)("toStringTag"),o="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))[r])?n:o?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"),r=!1;try{var o=[7][i]();o.return=function(){r=!0},Array.from(o,(function(){throw 2}))}catch(t){}t.exports=function(t){if(!r)return!1;var e=!1;try{var n=[7],o=n[i]();o.next=function(){e=!0},n[i]=function(){return o},t(n)}catch(t){}return e}},function(t,e,n){"use strict";var i=n(40).default,r=n(49).default;e.default=function(t,e){if(Array.isArray(t))return t;if(r(Object(t)))return function(t,e){var n=[],r=!0,o=!1,s=void 0;try{for(var a,l=i(t);!(r=(a=l.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,s=t}finally{try{!r&&l.return&&l.return()}finally{if(o)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),r=n(45),o=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,r(1)):r(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])}),"values"),o.Arguments=o.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),r=n(7);t.exports=function(t){return i(r(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),r=n(35);t.exports=n(12).getIterator=function(t){var e=r(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),r=n(20)("iterator"),o=n(23);t.exports=n(12).isIterable=function(t){var e=Object(t);return r in e||"@@iterator"in e||o.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,r=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,o=r&&i.regeneratorRuntime;if(i.regeneratorRuntime=void 0,t.exports=n(55),r)i.regeneratorRuntime=o;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 r=n(57).default,o=n(52).default,s=n(63).default,a=n(65).default;!function(e){var n,l=Object.prototype.hasOwnProperty,u="function"==typeof r&&o||"@@iterator",c="object"==typeof t,f=e.regeneratorRuntime;if(f)c&&(t.exports=f);else{(f=e.regeneratorRuntime=c?t.exports:{}).wrap=y;var h="suspendedStart",d="suspendedYield",m="executing",g="completed",p={},v=A.prototype=b.prototype;w.prototype=v.constructor=A,A.constructor=w,w.displayName="GeneratorFunction",f.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},f.mark=function(t){return t.__proto__=A,t.prototype=s(v),t},f.awrap=function(t){return new E(t)},S(T.prototype),f.async=function(t,e,n,i){var r=new T(y(t,e,n,i));return f.isGeneratorFunction(e)?r:r.next().then((function(t){return t.done?t.value:r.next()}))},S(v),v[u]=function(){return this},v.toString=function(){return"[object Generator]"},f.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}},f.values=M,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=n,this.done=!1,this.delegate=null,this.tryEntries.forEach(_),!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 o.type="throw",o.arg=t,e.next=n,!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i],o=r.completion;if("root"===r.tryLoc)return n("end");if(r.tryLoc<=this.prev){var s=l.call(r,"catchLoc"),a=l.call(r,"finallyLoc");if(s&&a){if(this.prev<r.catchLoc)return n(r.catchLoc,!0);if(this.prev<r.finallyLoc)return n(r.finallyLoc)}else if(s){if(this.prev<r.catchLoc)return n(r.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return n(r.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 r=i;break}}r&&("break"===t||"continue"===t)&&r.tryLoc<=e&&e<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=t,o.arg=e,r?this.next=r.finallyLoc:this.complete(o),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),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 r=i.arg;_(n)}return r}}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,r){var o=s((e||b).prototype);return o._invoke=function(t,e,i){var r=h;return function(o,s){if(r===m)throw new Error("Generator is already running");if(r===g){if("throw"===o)throw s;return I()}for(;;){var a=i.delegate;if(a){if("return"===o||"throw"===o&&a.iterator[o]===n){i.delegate=null;var l=a.iterator.return;if(l&&"throw"===(u=C(l,a.iterator,s)).type){o="throw",s=u.arg;continue}if("return"===o)continue}var u;if("throw"===(u=C(a.iterator[o],a.iterator,s)).type){i.delegate=null,o="throw",s=u.arg;continue}if(o="next",s=n,!(c=u.arg).done)return r=d,c;i[a.resultName]=c.value,i.next=a.nextLoc,i.delegate=null}if("next"===o)i.sent=r===d?s:n;else if("throw"===o){if(r===h)throw r=g,s;i.dispatchException(s)&&(o="next",s=n)}else"return"===o&&i.abrupt("return",s);if(r=m,"normal"===(u=C(t,e,i)).type){r=i.done?g:d;var c={value:u.arg,done:i.done};if(u.arg!==p)return c;i.delegate&&"next"===o&&(s=n)}else"throw"===u.type&&(r=g,o="throw",s=u.arg)}}}(t,i||null,new N(r||[])),o}function C(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function b(){}function w(){}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(r,o):a.resolve(s).then((function(t){return i.value=t,i}))}"object"==typeof i&&i.domain&&(e=i.domain.bind(e));var n,r=e.bind(t,"next"),o=e.bind(t,"throw");e.bind(t,"return"),this._invoke=function(t,i){var r=n?n.then((function(){return e(t,i)})):new a((function(n){n(e(t,i))}));return n=r.catch((function(t){})),r}}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 _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(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,r=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 r.next=r}}return{next:I}}function I(){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={},r=[],o=!1,s=-1;function a(){o=!1,n.length?r=n.concat(r):s=-1,r.length&&l()}function l(){if(!o){var t=setTimeout(a);o=!0;for(var e=r.length;e;){for(n=r,r=[];++s<e;)n&&n[s].run();s=-1,e=r.length}n=null,o=!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];r.push(new u(t,e)),1!==r.length||o||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),r=n(11),o=n(19),s=n(17),a=n(10),l=n(13),u=n(18),c=n(21),f=n(25),h=n(22),d=n(20),m=n(60),g=n(61),p=n(62),v=n(32),y=n(31),C=n(46),b=n(16),w=i.getDesc,A=i.setDesc,S=i.create,E=g.get,T=r.Symbol,x=!1,_=d("_hidden"),N=i.isEnum,M=c("symbol-registry"),I=c("symbols"),O="function"==typeof T,L=Object.prototype,R=s&&u((function(){return 7!=S(A({},"a",{get:function(){return A(this,"a",{value:7}).a}})).a}))?function(t,e,n){var i=w(L,e);i&&delete L[e],A(t,e,n),i&&t!==L&&A(L,e,i)}:A,P=function(t){var e=I[t]=S(T.prototype);return e._k=t,s&&x&&R(L,t,{configurable:!0,set:function(e){o(this,_)&&o(this[_],t)&&(this[_][t]=!1),R(this,t,b(1,e))}}),e},k=function(t,e,n){return n&&o(I,e)?(n.enumerable?(o(t,_)&&t[_][e]&&(t[_][e]=!1),n=S(n,{enumerable:b(0,!1)})):(o(t,_)||A(t,_,b(1,{})),t[_][e]=!0),R(t,e,n)):A(t,e,n)},V=function(t,e){y(t);for(var n,i=p(e=C(e)),r=0,o=i.length;o>r;)k(t,n=i[r++],e[n]);return t},D=function(t,e){return void 0===e?S(t):V(S(t),e)},G=function(t){var e=N.call(this,t);return!(e||!o(this,t)||!o(I,t)||o(this,_)&&this[_][t])||e},F=function(t,e){var n=w(t=C(t),e);return!n||!o(I,e)||o(t,_)&&t[_][e]||(n.enumerable=!0),n},U=function(t){for(var e,n=E(C(t)),i=[],r=0;n.length>r;)o(I,e=n[r++])||e==_||i.push(e);return i},H=function(t){for(var e,n=E(C(t)),i=[],r=0;n.length>r;)o(I,e=n[r++])&&i.push(I[e]);return i};O||(T=function(){if(this instanceof T)throw TypeError("Symbol is not a constructor");return P(h(arguments[0]))},l(T.prototype,"toString",(function(){return this._k})),i.create=D,i.isEnum=G,i.getDesc=F,i.setDesc=k,i.setDescs=V,i.getNames=g.get=U,i.getSymbols=H,s&&!n(9)&&l(L,"propertyIsEnumerable",G,!0)),O&&!u((function(){return"[null]"!=JSON.stringify([T()])}))||l(T.prototype,"toJSON",(function(){if(O&&v(this))return this}));var q={for:function(t){return o(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=d(t);q[t]=O?e:P(e)})),x=!0,a(a.G+a.W,{Symbol:T}),a(a.S,"Symbol",q),a(a.S+a.F*!O,"Object",{create:D,defineProperty:k,defineProperties:V,getOwnPropertyDescriptor:F,getOwnPropertyNames:U,getOwnPropertySymbols:H}),f(T,"Symbol"),f(Math,"Math",!0),f(r.JSON,"JSON",!0)},function(t,e,n){var i=n(15),r=n(46);t.exports=function(t,e){for(var n,o=r(t),s=i.getKeys(o),a=s.length,l=0;a>l;)if(o[n=s[l++]]===e)return n}},function(t,e,n){var i={}.toString,r=n(46),o=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 o(t)}catch(t){return s.slice()}}(t):o(r(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 r,o=n(t),s=i.isEnum,a=0;o.length>a;)s.call(t,r=o[a++])&&e.push(r);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,r=n(15),o=n(9),s=n(11),a=n(27),l=n(36),u=n(10),c=n(32),f=n(31),h=n(28),d=n(69),m=n(70),g=n(71).set,p=n(72),v=n(73),y=n(20)("species"),C=n(22)("record"),b=n(74),w="Promise",A=s.process,S="process"==l(A),E=s[w],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=r.create(E.prototype,{constructor:{value:e}}),e.resolve(5).then((function(){}))instanceof e||(t=!1),t&&n(17)){var i=!1;E.resolve(r.setDesc({},"then",{get:function(){i=!0}})),t=i}}catch(e){t=!1}return t}(),_=function(t){var e=f(t)[y];return null!=e?e:t},N=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;b((function(){for(var i=t.v,r=1==t.s,o=0,a=function(e){var n,o,s=r?e.ok:e.fail;try{s?(r||(t.h=!0),(n=!0===s?i:s(i))===e.P?e.rej(TypeError("Promise-chain cycle")):(o=N(n))?o.call(n,e.res,e.rej):e.res(n)):e.rej(i)}catch(t){e.rej(t)}};n.length>o;)a(n[o++]);n.length=0,t.n=!1,e&&setTimeout((function(){var e,n,r=t.p;I(r)&&(S?A.emit("unhandledRejection",i,r):(e=s.onunhandledrejection)?e({promise:r,reason:i}):(n=s.console)&&n.error&&n.error("Unhandled promise rejection",i)),t.a=void 0}),1)}))}},I=function(t){var e,n=t[C],i=n.a||n.c,r=0;if(n.h)return!1;for(;i.length>r;)if((e=i[r++]).fail||!I(e.P))return!1;return!0},O=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=N(t))?b((function(){var i={r:n,d:!1};try{e.call(t,a(L,i,1),a(O,i,1))}catch(t){O.call(i,t)}})):(n.v=t,n.s=1,M(n,!1))}catch(t){O.call({r:n,d:!1},t)}}};x||(E=function(t){h(t);var e={p:d(this,E,w),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(O,e,1))}catch(t){O.call(e,t)}},n(79)(E.prototype,{then:function(t,e){var n=f(f(this).constructor)[y],i={ok:"function"!=typeof t||t,fail:"function"==typeof e&&e},r=i.P=new(null!=n?n:E)((function(t,e){i.res=t,i.rej=e}));h(i.res),h(i.rej);var o=this[C];return o.c.push(i),o.a&&o.a.push(i),o.s&&M(o,!1),r},catch:function(t){return this.then(void 0,t)}})),u(u.G+u.W+u.F*!x,{Promise:E}),n(25)(E,w),v(E),v(i=n(12)[w]),u(u.S+u.F*!x,w,{reject:function(t){return new this((function(e,n){n(t)}))}}),u(u.S+u.F*(!x||T(!0)),w,{resolve:function(t){return c(n=t)&&(x?"Promise"==l(n):C in n)&&(e=t.constructor,o&&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(){}))}))),w,{all:function(t){var e=_(this),n=[];return new e((function(i,o){m(t,!1,n.push,n);var s=n.length,a=Array(s);s?r.each.call(n,(function(t,n){e.resolve(t).then((function(t){a[n]=t,--s||i(a)}),o)})):i(a)}))},race:function(t){var e=_(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),r=n(30),o=n(33),s=n(31),a=n(34),l=n(35);t.exports=function(t,e,n,u){var c,f,h,d=l(t),m=i(n,u,e?2:1),g=0;if("function"!=typeof d)throw TypeError(t+" is not iterable!");if(o(d))for(c=a(t.length);c>g;g++)e?m(s(f=t[g])[0],f[1]):m(t[g]);else for(h=d.call(t);!(f=h.next()).done;)r(h,m,f.value,e)}},function(t,e,n){var i=n(15).getDesc,r=n(32),o=n(31),s=function(t,e){if(o(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,r){try{(r=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:r(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),r=n(20)("species");t.exports=function(t){n(17)&&!(r in t)&&i.setDesc(t,r,{configurable:!0,get:function(){return this}})}},function(t,e,n){var i,r,o,s=n(11),a=n(75).set,l=s.MutationObserver||s.WebKitMutationObserver,u=s.process,c="process"==n(37)(u),f=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;r=void 0,t&&t.enter()};if(c)o=function(){u.nextTick(f)};else if(l){var h=1,d=document.createTextNode("");new l(f).observe(d,{characterData:!0}),o=function(){d.data=h=-h}}else o=function(){a.call(s,f)};t.exports=function(t){var e={fn:t,next:void 0,domain:c&&u.domain};r&&(r.next=e),i||(i=e,o()),r=e}},function(t,e,n){"use strict";var i,r,o,s=n(27),a=n(76),l=n(77),u=n(78),c=n(11),f=c.process,h=c.setImmediate,d=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)};h&&d||(h=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},d=function(t){delete p[t]},"process"==n(37)(f)?i=function(t){f.nextTick(s(y,t,1))}:m?(o=(r=new m).port2,r.port1.onmessage=C,i=s(o.postMessage,o,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:h,clear:d}},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),r=n(11).document,o=i(r)&&i(r.createElement);t.exports=function(t){return o?r.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),r=(n(12).Object||{})[t]||Object[t],o={};o[t]=e(r),i(i.S+i.F*n(18)((function(){r(1)})),"Object",o)}},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),r=n(14),o=n(27),s=n(73),a=n(69),l=n(7),u=n(70),c=n(45),f=n(22)("id"),h=n(19),d=n(32),m=Object.isExtensible||d,g=n(17),p=g?"_s":"size",v=0,y=function(t,e){if(!d(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!h(t,f)){if(!m(t))return"F";if(!e)return"E";r(t,f,++v)}return"O"+t[f]},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,r,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,r,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,r=n.p;delete e._i[n.i],n.r=!0,r&&(r.n=i),i&&(i.p=r),e._f==n&&(e._f=i),e._l==n&&(e._l=r),e[p]--}return!!n},forEach:function(t){for(var e,n=o(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,r,o=C(t,e);return o?o.v=n:(t._l=o={i:r=y(e,!0),k:e,v:n,p:i=t._l,n:void 0,r:!1},t._f||(t._f=o),i&&(i.n=o),t[p]++,"F"!==r&&(t._i[r]=o)),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),r=n(10),o=n(14),s=n(70),a=n(69);t.exports=function(t,e,l,u,c,f){var h=n(11)[t],d=h,m=c?"set":"add",g=d&&d.prototype,p={};return n(17)&&"function"==typeof d&&(f||g.forEach&&!n(18)((function(){(new d).entries().next()})))?(d=e((function(e,n){a(e,d,t),e._c=new h,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)||f&&"clear"==t||o(d.prototype,t,(function(n,i){var r=this._c[t](0===n?0:n,i);return e?this:r}))})),"size"in g&&i.setDesc(d.prototype,"size",{get:function(){return this._c.size}})):(d=u.getConstructor(e,t,c,m),n(79)(d.prototype,l)),n(25)(d,t),p[t]=d,r(r.G+r.W+r.F,p),f||u.setStrong(d,t,c),d}},function(t,e,n){var i=n(10);i(i.P,"Set",{toJSON:n(90)("Set")})},function(t,e,n){var i=n(70),r=n(36);t.exports=function(t){return function(){if(r(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 r=e[i];if(void 0!==r)return r.exports;var o=e[i]={id:i,loaded:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.loaded=!0,o.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 r=i.length-1;r>-1&&(!t||!/^http(s?):/.test(t));)t=i[r--].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=n(6920);peptides=i})();
1
+ var peptides;(()=>{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,r,o,s,a,l,u,c=n(6082),f=n(4328);n(8774),function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan",t.Onehot="One-Hot"}(i||(i={})),function(t){t.Euclidean="Euclidean"}(r||(r={})),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"}(o||(o={})),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 h=n(1199);o.Tanimoto,o.Dice,o.Asymmetric,o.BraunBlanquet,o.Cosine,o.Kulczynski,o.McConnaughey,o.RogotGoldberg,o.Russel,o.Sokal,o.Hamming,o.Euclidean,o.Tanimoto,o.Dice,o.Asymmetric,o.BraunBlanquet,o.Cosine,o.Kulczynski,o.McConnaughey,o.RogotGoldberg,o.Russel,o.Sokal,o.Hamming,o.Euclidean,o.Tanimoto,o.Dice,o.Cosine,o.Tanimoto,o.Asymmetric,o.Cosine,o.Sokal,h.Z.HAMMING,h.Z.LEVENSHTEIN,h.Z.MONOMER_CHEMICAL_DISTANCE,h.Z.NEEDLEMANN_WUNSCH,new RegExp("[rd]\\((\\w)\\)p?","g");var d=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,d.R)(t,n).columns.toList());const i=(await g()).getMonomerLib(),r=new Array(t.length),o=t[0].length,s=new Float32Array(o);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],h=u.getRawData(),d=u.categories,g=d.indexOf("");if(r[n]={categories:d,data:h,emptyIndex:g},void 0===a)continue;const p=c.Column.fromStrings("smiles",d.map((t=>i.getMonomer("PEPTIDE",t)?.smiles??""))),v=(c.DataFrame.fromColumns([p]),await f.chem.getSimilarities(p,l)),y=v?v.getRawData():null;for(let t=0;t<o;++t){const e=h[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 o=0;o<t.length;++o){const t=r[o];if(o>=e.length&&t.data[n]!==t.emptyIndex||t.data[n]===t.emptyIndex&&o<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:()=>r,_S:()=>c,b9:()=>f,gp:()=>o,q7:()=>u});var i,r,o,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"}(r||(r={})),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"}(o||(o={}));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(r.PT,l.fasta.peptide,.5),new s.a(r.DNA,l.fasta.dna,.55),new s.a(r.RNA,l.fasta.rna,.55)],c="",f={[i.FASTA]:"-",[i.SEPARATOR]:"",[i.HELM]:"*"}},2003:(t,e,n)=>{"use strict";n.d(e,{Hi:()=>i.Hi,SM:()=>r.SM,YI:()=>i.YI,gp:()=>i.gp,zS:()=>r.zS});var i=n(439),r=n(9634)},2738:(t,e,n)=>{"use strict";n.d(e,{X:()=>r,a:()=>i});class i{constructor(t,e,n){this.name=t,this.alphabet=e,this.cutoff=n}}class r extends i{constructor(t,e,n){super(t.name,t.alphabet,t.cutoff),this.freq=e,this.similarity=n}}},9634:(t,e,n)=>{"use strict";n.d(e,{zS:()=>T,SM:()=>x});var i=n(6082),r=n(144),o=n.n(r);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],r=t[1];n.forEach(((t,n)=>{i[t]=this.colourPalette[r][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 f 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,f)),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,f)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new f({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 f.aaSynonyms?f.aaSynonyms[t]:t;return super.get(e)}}f.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class h{static getPalette(t="grok"){switch(t){case"grok":return f.GrokGroups;case"lesk":return f.Lesk;default:throw new Error(`ChemPalette: scheme \`${t}\` does not exist`)}}static getInnerOuter(t){let e=0,n="",i="";for(const r of t)"("==r?e++:")"==r?e--:e?n+=r:i+=r;return isNaN(parseInt(n))?[i,n]:[i,""]}static getColorAAPivot(t="",e="grok"){const n=this.getPalette(e);let[i,r]=this.getInnerOuter(t);if(i=i.length>6?`${i.slice(0,3)}...`:i,r=r.length>6?`${r.slice(0,3)}...`:r,1==t.length||"("==t[1]){const e=t[0]?.toUpperCase();return e in n?[n.get(e),e,r,1]:[this.undefinedColor,i,r,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,r,2]:[this.undefinedColor,i,r,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,r,3]:[this.undefinedColor,i,r,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,r,4]:[this.undefinedColor,i,r,4]}return[this.undefinedColor,i,r,0]}}h.SemType="Aminoacids",h.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",h.undefinedColor="rgb(100,100,100)",h.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"},h.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"},h.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(*)*"},h.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 d extends c{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new d({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),r=i.Color.b(n),o=Math.sqrt(Math.pow(0-e,2)+Math.pow(0-t,2)+Math.pow(0-r,2));if(o>210)return`rgb(${e/o*210},${t/o*210},${r/o*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 b extends y{static get palette(){return b._pallete||(b._pallete=b.buildPalette()),b._pallete}static buildPalette(){return(0,g.pj)().then((t=>{t.awaitLoaded(1/0).then((()=>{const e=t.getMonomerLib();e.onChanged.subscribe((()=>{b.customMonomerColors={},b.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=b.palette.length,i=b.customMonomerColors[t],r=e??"PEPTIDE";if(i&&i[r])return i[r];const o=v.hashCode(t)%n;return p(b.palette[o])}}b._pallete=null,b.customMonomerColors={},b.polymerTypes=[];class w 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 b),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]}constructor(t,e){this.mList=t,this.gapOriginalMonomer=e}}const S=t=>{const e=o()(t.toString().matchAll(u.B5)).map((t=>t[2]??t[1])).toArray();return new A(e,u.b9[u.Hi.FASTA])},E=/([^\W_]+)/g;function T(t,e){if(t.length<=e)return t;const n=t.match(E),i=t.length>e||(n?.length??0)>1,r=n?.[0]??" ";return i?r.substring(0,e-1)+"…":r}function x(t,e,n=5){let r;if(t.semType==i.SEMTYPE.MACROMOLECULE)r=e.getSeqHandler(t).alphabet;else{const e=function(t,e,n){const i=t.categories;return function(t,e){const n={};let i=!0,r=null;for(const o of t)if(null==r?r=o.length:o.length!==r&&(i=!1),o.length>=e)for(let t=0;t<o.length;++t){const e=o.getCanonical(t);e in n||(n[e]=0),n[e]+=1}return{freq:n,sameLength:i}}(o().enumerate(t.getRawData()).map((([t,e])=>n(i[t]))),e)}(t,n,S);r=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 r=[],o=[];for(const n of i)r.push(n in t?t[n]:0),o.push(e.has(n)?1:0);const l=new s(r),u=new s(o);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 r;const o=Math.max(...i.map((t=>t.similarity>t.cutoff?t.similarity:-1)));return r=o>0?i.find((t=>t.similarity===o)).name:u.YI.UN,r}(e.freq,u.q7)}return function(t){switch(t){case u.YI.PT:return f.GrokGroups;case u.YI.DNA:case u.YI.RNA:return d.Chromatogram;default:return w.Color}}(r)}},3077:(t,e,n)=>{"use strict";n.d(e,{R:()=>r});var i=n(6082);function r(t,e){const n=t=>{const e=s.columns.addNewString((t+1).toString());return r.push(e),e},r=[],o=t.length,s=i.DataFrame.create(o),a=e.getSeqHandler(t);for(let t=0;t<o;++t){const e=a.getSplitted(t);for(let i=0;i<e.length;++i){const o=e.getCanonical(i);((r[i]??null)||n(i)).set(t,o,!1)}}return s}},4326:(t,e,n)=>{"use strict";n.d(e,{P4:()=>s,fH:()=>r});var i,r,o,s,a,l,u=n(6082);!function(t){t.tooltipWebLogo=".tooltipWebLogo"}(i||(i={})),function(t){t.Entropy="Entropy",t.full="100%"}(r||(r={})),function(t){t.TOP="top",t.MIDDLE="middle",t.BOTTOM="bottom"}(o||(o={})),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=r.Entropy,this.positionWidth=16,this.verticalAlignment=o.MIDDLE,this.horizontalAlignment=s.CENTER,this.fixWidth=!1,this.fitArea=!0,this.minHeight=50,this.maxHeight=100,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,r=(i="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t={}){var e,n,r=void 0!==t?t:{};r.ready=new Promise((function(t,i){e=t,n=i}));var o,s=Object.assign({},r),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&&(o=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)})),r.print||console.log.bind(console);var c,f,h=r.printErr||console.warn.bind(console);Object.assign(r,s),s=null,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.quit&&r.quit,r.wasmBinary&&(c=r.wasmBinary),r.noExitRuntime,"object"!=typeof WebAssembly&&E("no native wasm support detected");var d,m,g,p=!1;function v(){var t=f.buffer;r.HEAP8=d=new Int8Array(t),r.HEAP16=new Int16Array(t),r.HEAP32=new Int32Array(t),r.HEAPU8=m=new Uint8Array(t),r.HEAPU16=new Uint16Array(t),r.HEAPU32=g=new Uint32Array(t),r.HEAPF32=new Float32Array(t),r.HEAPF64=new Float64Array(t)}var y=[],C=[],b=[],w=0,A=null,S=null;function E(t){r.onAbort&&r.onAbort(t),h(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 _(t){return t.startsWith("data:application/octet-stream;base64,")}function N(t){try{if(t==T&&c)return new Uint8Array(c);if(o)return o(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 N(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 N(t)}))}(t).then((function(t){return WebAssembly.instantiate(t,e)})).then((function(t){return t})).then(n,(function(t){h("failed to asynchronously prepare wasm: "+t),E(t)}))}function I(t){for(;t.length>0;)t.shift()(r)}function O(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,d[this.ptr+12|0]=t},this.get_caught=function(){return 0!=d[this.ptr+12|0]},this.set_rethrown=function(t){t=t?1:0,d[this.ptr+13|0]=t},this.get_rethrown=function(){return 0!=d[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=f.buffer;try{return f.grow(t-e.byteLength+65535>>>16),v(),1}catch(t){}}function R(t){return r["_"+t]}_(T="wasmDbscan.wasm")||(x=T,T=r.locateFile?r.locateFile(x,u):u+x);var P="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function k(t,e,n,i,r){var o={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 r=n+i-1,o=0;o<t.length;++o){var s=t.charCodeAt(o);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&t.charCodeAt(++o)),s<=127){if(n>=r)break;e[n++]=s}else if(s<=2047){if(n+1>=r)break;e[n++]=192|s>>6,e[n++]=128|63&s}else if(s<=65535){if(n+2>=r)break;e[n++]=224|s>>12,e[n++]=128|s>>6&63,e[n++]=128|63&s}else{if(n+3>=r)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,d.set(e,n),i}},s=R(t),a=[],l=0;if(i)for(var u=0;u<i.length;u++){var c=o[n[u]];c?(0===l&&(l=G()),a[u]=c(i[u])):a[u]=i[u]}var f=s.apply(null,a);return function(t){return 0!==l&&F(l),function(t){return"string"===e?(n=t)?function(t,e,n){for(var i=e+n,r=e;t[r]&&!(r>=i);)++r;if(r-e>16&&t.buffer&&P)return P.decode(t.subarray(e,r));for(var o="";e<r;){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)o+=String.fromCharCode(s);else{var u=s-65536;o+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else o+=String.fromCharCode((31&s)<<6|a)}else o+=String.fromCharCode(s)}return o}(m,n,i):"":"boolean"===e?Boolean(t):t;var n,i}(t)}(f)}var V,D={__cxa_throw:function(t,e,n){throw new O(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 r=1;r<=4;r*=2){var o=n*(1+.2/r);if(o=Math.min(o,t+100663296),L(Math.min(i,(e=Math.max(t,o))+(65536-e%65536)%65536)))return!0}return!1}},G=(function(){var t,e,i,o,s={env:D,wasi_snapshot_preview1:D};function a(t,e){var n,i=t.exports;return r.asm=i,f=r.asm.memory,v(),r.asm.__indirect_function_table,n=r.asm.__wasm_call_ctors,C.unshift(n),function(t){if(w--,r.monitorRunDependencies&&r.monitorRunDependencies(w),0==w&&(null!==A&&(clearInterval(A),A=null),S)){var e=S;S=null,e()}}(),i}if(w++,r.monitorRunDependencies&&r.monitorRunDependencies(w),r.instantiateWasm)try{return r.instantiateWasm(s,a)}catch(t){h("Module.instantiateWasm callback failed with error: "+t),n(t)}(t=c,e=T,i=s,o=function(t){a(t.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||_(e)||"function"!=typeof fetch?M(e,i,o):fetch(e,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,i).then(o,(function(t){return h("wasm streaming compile failed: "+t),h("falling back to ArrayBuffer instantiation"),M(e,i,o)}))}))).catch(n)}(),r._dbscan=function(){return(r._dbscan=r.asm.dbscan).apply(null,arguments)},r._malloc=function(){return(r._malloc=r.asm.malloc).apply(null,arguments)},r._free=function(){return(r._free=r.asm.free).apply(null,arguments)},function(){return(G=r.asm.stackSave).apply(null,arguments)}),F=function(){return(F=r.asm.stackRestore).apply(null,arguments)},U=function(){return(U=r.asm.stackAlloc).apply(null,arguments)},H=function(){return(H=r.asm.__cxa_is_pointer_type).apply(null,arguments)};function q(){function t(){V||(V=!0,r.calledRun=!0,p||(I(C),e(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),function(){if(r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;)t=r.postRun.shift(),b.unshift(t);var t;I(b)}()))}w>0||(function(){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)t=r.preRun.shift(),y.unshift(t);var t;I(y)}(),w>0||(r.setStatus?(r.setStatus("Running..."),setTimeout((function(){setTimeout((function(){r.setStatus("")}),1),t()}),1)):t()))}if(r.ccall=k,r.cwrap=function(t,e,n,i){var r=!n||n.every((t=>"number"===t||"boolean"===t));return"string"!==e&&r&&!i?R(t):function(){return k(t,e,n,arguments)}},S=function t(){V||q(),V||(S=t)},r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return q(),t.ready});"object"==typeof exports?t.exports=r:"function"==typeof define&&n.amdO?define([],(function(){return r})):"object"==typeof exports&&(exports.exportCppDbscanLib=r)},4329:(t,e,n)=>{"use strict";n.d(e,{_:()=>o});var i=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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 r=null;function o(){return i(this,void 0,void 0,(function*(){if(!navigator.gpu)return console.error("WebGPU is not supported in this browser"),null;if(!r&&(r=yield navigator.gpu.requestAdapter(),null==r))return null;let t=null;return"info"in r&&(t=r.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,r=i._createBuffer(n);if(e)for(let t=0;t<r.length;t++)r[t]=-1;this._data=r,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 r=t.lengthInInts;for(let i=0;i<r;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 r=0,o=0;for(;e-o>=4;)n._data[r++]=255&t[o]|(255&t[o+1])<<8|(255&t[o+2])<<16|(255&t[o+3])<<24,o+=4;return e-o==3&&(n._data[r]=(255&t[o+2])<<16),e-o==2&&(n._data[r]|=(255&t[o+1])<<8),e-o==1&&(n._data[r]|=255&t[o]),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,r=!0){if(n&&r&&this.setAll(!e,!1),r)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 r=Math.min(t,e),o=Math.max(t,e);if(n)for(let t=r;t<=o;t++)this.setTrue(t);else for(let t=r;t<=o;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 r=31&this._length;for(0!=r&&(n&=~(4294967295<<r));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 r=this.lengthInInts;let o=0;for(;o<r-1;o++)for(let e=this._data[o]&t._data[o];0!=e;e>>>=8)n+=i._onBitCount[255&e];let s=this._data[o]&t._data[o];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 r=this.lengthInInts;for(let o=Math.floor(t/32);o<r;o++){let r=e?this._data[o]:~this._data[o];if(0!=n)r&=4294967295<<n&4294967295,n=0;else if(!e&&-4294967296==r)continue;for(let e=0;0!=r;e+=8,r>>>=8){const n=i._firstOnBit[255&r];if(n>=0)return(t=n+32*o+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 r=Math.floor(t/32);r>=0;r--){let t=e?this._data[r]:~this._data[r];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*r+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,{cb:()=>s}),n(4328);var i=n(6082);n(9982),i.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,,,,,,,,,,,,,,,,,,,,,').columns.add(i.Column.fromList(i.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var r,o=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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 s(t){return o(this,void 0,void 0,(function*(){yield new Promise((e=>setTimeout(e,t)))}))}console.log.bind(console),console.info.bind(console),console.warn.bind(console),console.error.bind(console),function(t){t.notNull=function(t,e){if(null==t)throw new Error(`${null==e?"Value":e} not defined`)}}(r||(r={})),i.DataFrame.fromColumns([i.Column.fromStrings("col",["val1","val2","val3"])])},7233:t=>{!function(){"use strict";var e=document,n=window,i=e.documentElement,r=e.createElement.bind(e),o=r("div"),s=r("table"),a=r("tbody"),l=r("tr"),u=Array.isArray,c=Array.prototype,f=c.concat,h=c.filter,d=c.indexOf,m=c.map,g=c.push,p=c.slice,v=c.some,y=c.splice,C=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,b=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,w=/<.+>/,A=/^\w+$/;function S(t,e){var n,i=!!(n=e)&&11===n.nodeType;return t&&(i||M(e)||I(e))?!i&&b.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(_(t))return t;var r=t;if(L(t)){var o=i||e;if(!(r=C.test(t)&&M(o)?o.getElementById(t.slice(1).replace(/\\/g,"")):w.test(t)?X(t):_(o)?o.find(t):L(o)?x(o).find(t):S(t,o)))return}else if(O(t))return this.ready(t);(r.nodeType||r===n)&&(r=[r]),this.length=r.length;for(var s=0,a=this.length;s<a;s++)this[s]=r[s]}}return t.prototype.init=function(e,n){return new t(e,n)},t}(),T=E.prototype,x=T.init;function _(t){return t instanceof E}function N(t){return!!t&&t===t.window}function M(t){return!!t&&9===t.nodeType}function I(t){return!!t&&1===t.nodeType}function O(t){return"function"==typeof t}function L(t){return"string"==typeof t}function R(t){return void 0===t}function P(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 r=Object.keys(t),o=(i=0,r.length);i<o;i++){var s=r[i];if(!1===e.call(t[s],s,t[s]))return t}else for(i=0,o=t.length;i<o;i++)if(!1===e.call(t[i],i,t[i]))return t;return t}function G(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="boolean"==typeof t[0]&&t.shift(),i=t.shift(),r=t.length;if(!i)return{};if(!r)return G(n,x,i);for(var o=0;o<r;o++){var s=t[o];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),G(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=N,x.isFunction=O,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=G,T.extend=function(t){return G(T,t)};var F=/\S+/g;function U(t){return L(t)&&t.match(F)||[]}function H(t,e,i){if(I(t)){var r=n.getComputedStyle(t,null);return i?r.getPropertyValue(e)||void 0:r[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=!R(e);return this.each((function(t,r){I(r)&&D(n,(function(t,n){i?e?r.classList.add(n):r.classList.remove(n):r.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){I(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]||!I(this[0]))return;var n=this[0].getAttribute(t);return P(n)?void 0:n}return R(e)?this:P(e)?this.removeAttr(t):this.each((function(n,i){I(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 I(e)&&e.classList.contains(t)}))},T.get=function(t){return R(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 R(t)?this.get().map((function(t){return I(t)||(e=t)&&3===e.nodeType?t.textContent:"";var e})).join(""):this.each((function(e,n){I(n)&&(n.textContent=t)}))};var Y={};function W(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 $(t){return L(t)?function(e,n){return j(n,t)}:O(t)?t:_(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=$(t);return x(h.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={"*":o,tr:a,td:l,th:l,thead:s,tbody:s,tfoot:s};function X(t){if(!L(t))return[];if(Q.test(t))return[r(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 r=[],o=O(e),s=i&&$(i),a=0,l=t.length;a<l;a++)if(o){var u=e(t[a]);u.length&&g.apply(r,u)}else for(var c=t[a][e];!(null==c||i&&s(-1,c));)r.push(c),c=n?c[e]:null;return r}function tt(t){return t.multiple&&t.options?J(h.call(t.options,(function(t){return t.selected&&!t.disabled&&!t.parentNode.disabled})),"value"):t.value||""}function et(t){return t.length>1?h.call(t,(function(t,e,n){return d.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=$(t);return this.filter((function(n,i){return(!L(t)||I(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 r=u(t)?m.call(t,String):P(t)?[]:[String(t)];i?D(n.options,(function(t,e){e.selected=r.indexOf(e.value)>=0}),!0):n.checked=r.indexOf(n.value)>=0}else n.value=R(t)||P(t)?"":t})):this[0]&&tt(this[0])},T.is=function(t){var e=$(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 d.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,rt=["type","src","nonce","noModule"];function ot(t,e,n,o,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,o,s){o?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 o=r("script");o.text=n.textContent.replace(nt,""),D(rt,(function(t,e){n[e]&&(o[e]=n[e])})),e.head.insertBefore(o,null),e.head.removeChild(o)}}))}(e,t.ownerDocument)}(n?a:l,c?u.cloneNode(!0):u,o,s,!c)}),u)}),l)}),a),e}T.after=function(){return ot(arguments,this,!1,!1,!1,!0,!0)},T.append=function(){return ot(arguments,this,!1,!1,!0)},T.html=function(t){if(!arguments.length)return this[0]&&this[0].innerHTML;if(R(t))return this;var e=/<script[\s>]/.test(t);return this.each((function(n,i){I(i)&&(e?x(i).empty().append(t):i.innerHTML=t)}))},T.appendTo=function(t){return ot(arguments,this,!0,!1,!0)},T.wrapInner=function(t){return this.each((function(e,n){var i=x(n),r=i.contents();r.length?r.wrapAll(t):i.append(t)}))},T.before=function(){return ot(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 ot(arguments,this,!0,!1,!1,!1,!1,!0)},T.insertBefore=function(t){return ot(arguments,this,!0,!0)},T.prepend=function(){return ot(arguments,this,!1,!0,!0,!0,!0)},T.prependTo=function(t){return ot(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(f.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,r=t.offsetParent||i.documentElement;(r===i.body||r===i.documentElement)&&"static"===H(r,"position");)r=r.parentNode;if(r!==t&&I(r)){var o=x(r).offset();n.top-=o.top+q(r,"borderTopWidth"),n.left-=o.left+q(r,"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 ft={},ht=o.style,dt=["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(!ft[t]){var n=at(t),i="".concat(n[0].toUpperCase()).concat(n.slice(1));D("".concat(n," ").concat(dt.join("".concat(i," "))).concat(i).split(" "),(function(e,n){if(n in ht)return ft[t]=n,!1}))}return ft[t]}(t,n),arguments.length<2?this[0]&&H(this[0],t,n):t?(e=gt(t,e,n),this.each((function(i,r){I(r)&&(n?r.style.setProperty(t,e):r.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):R(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 N(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 R(i)?void 0:this;if(!arguments.length)return N(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 r=parseInt(i,10);return this.each((function(e,i){if(I(i)){var o=H(i,"boxSizing");i.style[n]=gt(n,r+("border-box"===o?B(i,!t):0))}}))}}));var bt="___cd";T.toggle=function(t){return this.each((function(n,i){if(I(i)){var o=W(i);(R(t)?o:t)?(i.style.display=i[bt]||"",W(i)&&(i.style.display=function(t){if(Y[t])return Y[t];var n=r(t);e.body.insertBefore(n,null);var i=H(n,"display");return e.body.removeChild(n),Y[t]="none"!==i?i:"block"}(i.tagName))):o||(i[bt]=H(i,"display"),i.style.display="none")}}))},T.hide=function(){return this.toggle(!1)},T.show=function(){return this.toggle(!0)};var wt="___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 _t(t){return t[wt]=t[wt]||{}}function Nt(t,e){return!e||!v.call(e,(function(e){return t.indexOf(e)<0}))}function Mt(t,e,n,i,r){var o=_t(t);if(e)o[e]&&(o[e]=o[e].filter((function(o){var s=o[0],a=o[1],l=o[2];if(r&&l.guid!==r.guid||!Nt(s,n)||i&&i!==a)return!0;t.removeEventListener(e,l)})));else for(e in o)Mt(t,e,n,i,r)}T.trigger=function(t,n){if(L(t)){var i=xt(t),r=i[0],o=i[1],s=Tt(r);if(!s)return this;var a=Et.test(s)?"MouseEvents":"HTMLEvents";(t=e.createEvent(a)).initEvent(s,!0,!0),t.namespace=o.join("."),t.___ot=r}t.___td=n;var l=t.___ot in At;return this.each((function(e,n){l&&O(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(R(t))this.each((function(t,e){(I(e)||M(e)||N(e))&&Mt(e)}));else if(L(t))O(e)&&(n=e,e=""),D(U(t),(function(t,r){var o=xt(r),s=o[0],a=o[1],l=Tt(s);i.each((function(t,i){(I(i)||M(i)||N(i))&&Mt(i,l,a,e,n)}))}));else for(var r in t)this.off(r,t[r]);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,r){var o=this;if(!L(t)){for(var s in t)this.on(s,e,n,t[s],r);return this}return L(e)||(R(e)||P(e)?e="":R(n)?(n=e,e=""):(i=n,n=e,e="")),O(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),f=l in St,h=l in At;c&&o.each((function(t,o){if(I(o)||M(o)||N(o)){var s=function(t){if(t.target["___i".concat(t.type)])return t.stopImmediatePropagation();if((!t.namespace||Nt(u,t.namespace.split(".")))&&(e||!(h&&(t.target!==o||t.___ot===c)||f&&t.relatedTarget&&o.contains(t.relatedTarget)))){var a=o;if(e){for(var l=t.target;!j(l,e);){if(l===o)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 o}}),Object.defineProperty(t,"data",{configurable:!0,get:function(){return n}});var d=i.call(a,t,t.___td);r&&Mt(o,c,u,e,s),!1===d&&(t.preventDefault(),t.stopPropagation())}};s.guid=i.guid=i.guid||x.guid++,function(t,e,n,i,r){var o=_t(t);o[e]=o[e]||[],o[e].push([n,i,r]),t.addEventListener(e,r)}(o,c,u,e,s)}}))})),this):this},T.one=function(t,e,n,i){return this.on(t,e,n,i,!0)};var It=/\r?\n/g,Ot=/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||Ot.test(n.type)||Lt.test(n.type)&&!n.checked)){var i=tt(n);R(i)||D(u(i)?i:[i],(function(e,i){t+=function(t,e){return"&".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(e.replace(It,"\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),r=n.n(i),o=n(6314),s=n.n(o)()(r());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),r=n.n(i),o=n(6314),s=n.n(o)()(r());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,r,o){"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!==o&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=o),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),r&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=r):c[4]="".concat(r)),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)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),o="/*# ".concat(r," */");return[e].concat([o]).join("\n")}return[e].join("\n")}},9982:function(t,e,n){var i;!function(e,r){var o={};!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,r,o){for(var s,a,l,u,c,f,h,d,m,g,p,v,y;o>=64;){for(s=n[0],a=n[1],l=n[2],u=n[3],c=n[4],f=n[5],h=n[6],d=n[7],g=0;g<16;g++)p=r+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&f^~c&h)|0)+(d+(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,d=h,h=f,f=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]+=f,n[6]+=h,n[7]+=d,r+=64,o-=64}return r}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,r=e/536870912|0,o=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]=r>>>24&255,this.buffer[s-7]=r>>>16&255,this.buffer[s-6]=r>>>8&255,this.buffer[s-5]=r>>>0&255,this.buffer[s-4]=o>>>24&255,this.buffer[s-3]=o>>>16&255,this.buffer[s-2]=o>>>8&255,this.buffer[s-1]=o>>>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 r=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 o(t){var e=(new i).update(t),n=e.digest();return e.clean(),n}function s(t,e){var n=new r(t).update(e),i=n.digest();return n.clean(),i}function a(t,e,n,i){var r=i[0];if(0===r)throw new Error("hkdf: cannot expand more");e.reset(),r>1&&e.update(t),n&&e.update(n),e.update(i),e.finish(t),i[0]++}t.HMAC=r,t.hash=o,t.default=o,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 o=new Uint8Array([1]),u=s(e,t),c=new r(u),f=new Uint8Array(c.digestLength),h=f.length,d=new Uint8Array(i),m=0;m<i;m++)h===f.length&&(a(f,c,n,o),h=0),d[m]=f[h++];return c.clean(),f.fill(0),o.fill(0),d},t.pbkdf2=function(t,e,n,i){for(var o=new r(t),s=o.digestLength,a=new Uint8Array(4),l=new Uint8Array(s),u=new Uint8Array(s),c=new Uint8Array(i),f=0;f*s<i;f++){var h=f+1;a[0]=h>>>24&255,a[1]=h>>>16&255,a[2]=h>>>8&255,a[3]=h>>>0&255,o.reset(),o.update(e),o.update(a),o.finish(u);for(var d=0;d<s;d++)l[d]=u[d];for(d=2;d<=n;d++){o.reset(),o.update(u).finish(u);for(var m=0;m<s;m++)l[m]^=u[m]}for(d=0;d<s&&f*s+d<i;d++)c[f*s+d]=l[d]}for(f=0;f<s;f++)l[f]=u[f]=0;for(f=0;f<4;f++)a[f]=0;return o.clean(),c}}(o);var s=o.default;for(var a in o)s[a]=o[a];"object"==typeof t.exports?t.exports=s:void 0===(i=function(){return s}.call(o,n,o,t))||(t.exports=i)}()},6572:function(t){var e;t.exports=(e=function(t,e){var n=Array.prototype.concat,i=Array.prototype.slice,r=Object.prototype.toString;function o(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]"===r.call(t)};function a(t){return"[object Function]"===r.call(t)}function l(t){return"number"==typeof t&&t-t==0}function u(){return new u._init(arguments)}function c(){return 0}function f(){return 1}function h(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:o,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(r){n[r][i]=t[r][e]}))})),n}for(var i=new Array(t.length),r=0;r<t.length;r++)i[r]=[t[r][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,r,o,a=[];for(s(t[0])||(t=[t]),n=t.length,i=t[0].length,o=0;o<i;o++){for(e=new Array(n),r=0;r<n;r++)e[r]=t[r][o];a.push(e)}return 1===a.length?a[0]:a},u.map=function(t,e,n){var i,r,o,a,l;for(s(t[0])||(t=[t]),r=t.length,o=t[0].length,a=n?t:new Array(r),i=0;i<r;i++)for(a[i]||(a[i]=new Array(o)),l=0;l<o;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,r,o,a,l;for(s(t[0])||(t=[t]),r=t.length,o=t[0].length,a=n?t:new Array(r),i=0;i<r;i++)for(a[i]||(a[i]=new Array(o)),o>0&&(a[i][0]=t[i][0]),l=1;l<o;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,r,o=new Array(t);for(a(e)&&(n=e,e=t),i=0;i<t;i++)for(o[i]=new Array(e),r=0;r<e;r++)o[i][r]=n(i,r);return o},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,f)},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,h)},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 r,s=[],l=o(t,e),u=(e*l-t*l)/((n-1)*l),c=t;for(r=0;c<=e&&r<n;c=(t*l+u*l*++r)/l)s.push(i?i(c,r):c);return s},u.arange=function(t,n,i){var r,o=[];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(r=t;r<n;r+=i)o.push(r);else for(r=t;r>n;r+=i)o.push(r);return o},u.slice=function(){function t(t,n,i,r){var o,s=[],a=t.length;if(n===e&&i===e&&r===e)return u.copy(t);if(r=r||1,(n=(n=n||0)>=0?n:a+n)===(i=(i=i||t.length)>=0?i:a+i)||0===r)return[];if(n<i&&r<0)return[];if(n>i&&r>0)return[];if(r>0)for(o=n;o<i;o+=r)s.push(t[o]);else for(o=n;o>i;o+=r)s.push(t[o]);return s}return function(e,n){var i,r;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),(r=n.row||{}).start,r.end,r.step):(r=n.row||{},i=n.col||{},t(e,r.start,r.end,r.step).map((function(e){return t(e,i.start,i.end,i.step)})))}}(),u.sliceAssign=function(n,i,r){var o,s;if(l(i.row)){if(l(i.col))return n[i.row][i.col]=r;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,o=u.arange(i.col.start,t.min(n.length,i.col.end),i.col.step);var a=i.row;return o.forEach((function(t,e){n[a][t]=r[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]=r[e]})),n}return r[0].length===e&&(r=[r]),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),o=u.arange(i.col.start,t.min(n[0].length,i.col.end),i.col.step),s.forEach((function(t,e){o.forEach((function(i,o){n[t][i]=r[e][o]}))})),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 d=u.prototype;return d.length=0,d.push=Array.prototype.push,d.sort=Array.prototype.sort,d.splice=Array.prototype.splice,d.slice=Array.prototype.slice,d.toArray=function(){return this.length>1?i.call(this):i.call(this)[0]},d.map=function(t,e){return u(u.map(this,t,e))},d.cumreduce=function(t,e){return u(u.cumreduce(this,t,e))},d.alter=function(t){return u.alter(this,t),this},function(t){for(var e=0;e<t.length;e++)!function(t){d[t]=function(e){var n,i=this;return e?(setTimeout((function(){e.call(i,d[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){d[t]=function(e,n){var i=this;return n?(setTimeout((function(){n.call(i,d[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){d[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 r(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),r=0,o=e.length;--o>=0;)r+=(n=e[o]-i)*n;return r},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),r=t.mean(i);return e.exp(r)},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=[],r={};for(e=0;e<t.length;e++)r[l=t[e]]?r[l]++:(r[l]=1,n.push(l));var o=n.sort(i),s={},a=1;for(e=0;e<o.length;e++){var l,u=r[l=o[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,r=t.slice().sort(i),o=1,s=0,a=0,l=[];for(e=0;e<n;e++)r[e]===r[e+1]?o++:(o>s?(l=[r[e]],s=o,a=0):o===s&&(l.push(r[e]),a++),o=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,r=new Array(i),o=0;o<i;o++)r[o]=e[o]-n;return r},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),r=[],o=n.length-1;o>=0;o--)r.push(e.abs(n[o]-i));return t.mean(r)},t.meddev=function(n){for(var i=t.median(n),r=[],o=n.length-1;o>=0;o--)r.push(e.abs(n[o]-i));return t.median(r)},t.coeffvar=function(e){return t.stdev(e)/t.mean(e)},t.quartiles=function(t){var n=t.length,r=t.slice().sort(i);return[r[e.round(n/4)-1],r[e.round(n/2)-1],r[e.round(3*n/4)-1]]},t.quantiles=function(t,n,o,s){var a,l,u,c,f,h=t.slice().sort(i),d=[n.length],m=t.length;for(void 0===o&&(o=3/8),void 0===s&&(s=3/8),a=0;a<n.length;a++)u=m*(l=n[a])+(o+l*(1-o-s)),c=e.floor(r(u,1,m-1)),f=r(u-c,0,1),d[a]=(1-f)*h[c-1]+f*h[c];return d},t.percentile=function(t,e,n){var r=t.slice().sort(i),o=e*(r.length+(n?1:-1))+(n?0:1),s=parseInt(o),a=o-s;return s+1<r.length?r[s-1]+a*(r[s]-r[s-1]):r[s-1]},t.percentileOfScore=function(t,e,n){var i,r,o=0,s=t.length,a=!1;for("strict"===n&&(a=!0),r=0;r<s;r++)i=t[r],(a&&i<e||!a&&i<=e)&&o++;return o/s},t.histogram=function(n,i){i=i||4;var r,o=t.min(n),s=(t.max(n)-o)/i,a=n.length,l=[];for(r=0;r<i;r++)l[r]=0;for(r=0;r<a;r++)l[e.min(e.floor((n[r]-o)/s),i-1)]+=1;return l},t.covariance=function(e,n){var i,r=t.mean(e),o=t.mean(n),s=e.length,a=new Array(s);for(i=0;i<s;i++)a[i]=(e[i]-r)*(n[i]-o);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 r=t.mean(n),o=t.stdev(n),s=n.length,a=0,l=0;l<s;l++)a+=e.pow((n[l]-r)/o,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 o=t.prototype;!function(e){for(var i=0;i<e.length;i++)!function(e){o[e]=function(i,r){var s=[],a=0,l=this;if(n(i)&&(r=i,i=!1),r)return setTimeout((function(){r.call(l,o[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){o[e]=function(i,r){var s=[],a=0,l=this;if(n(i)&&(r=i,i=!1),r)return setTimeout((function(){r.call(l,o[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){o[e]=function(){var i,r=[],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,o[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++)r[s]=c(a[s]);return r}return c(this[0])}}(e[i])}("quantiles percentileOfScore".split(" "))}(e,Math),function(t,e){t.gammaln=function(t){var n,i,r,o=0,s=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],a=1.000000000190015;for(r=(i=n=t)+5.5,r-=(n+.5)*e.log(r);o<6;o++)a+=s[o]/++i;return e.log(2.5066282746310007*a/n)-r},t.loggam=function(t){var n,i,r,o,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),r=2*e.PI,s=u[9],a=8;a>=0;a--)s*=i,s+=u[a];if(o=s/n+.5*e.log(r)+(n-.5)*e.log(n)-n,t<=7)for(a=1;a<=l;a++)o-=e.log(n-1),n-=1;return o},t.gammafn=function(t){var n,i,r,o,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,f=0,h=t;if(t>171.6243769536076)return 1/0;if(h<=0){if(!(o=h%1+36e-17))return 1/0;l=(1&h?-1:1)*e.PI/e.sin(e.PI*o),h=1-h}for(r=h,i=h<1?h++:(h-=u=(0|h)-1)-1,n=0;n<8;++n)f=(f+s[n])*i,c=c*i+a[n];if(o=f/c+1,r<h)o/=r;else if(r>h)for(n=0;n<u;++n)o*=h,h++;return l&&(o=l/o),o},t.gammap=function(e,n){return t.lowRegGamma(e,n)*t.gammafn(e)},t.lowRegGamma=function(n,i){var r,o=t.gammaln(n),s=n,a=1/n,l=a,u=i+1-n,c=1/1e-30,f=1/u,h=f,d=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(;d<=m;d++)a+=l*=i/++s;return a*e.exp(-i+n*e.log(i)-o)}for(;d<=m;d++)h*=(f=1/(f=(r=-d*(d-n))*f+(u+=2)))*(c=u+r/c);return 1-h*e.exp(-i+n*e.log(i)-o)},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 r,o,s,a,l=1e-30,u=1,c=n+i,f=n+1,h=n-1,d=1,m=1-c*t/f;for(e.abs(m)<l&&(m=l),a=m=1/m;u<=100&&(m=1+(o=u*(i-u)*t/((h+(r=2*u))*(n+r)))*m,e.abs(m)<l&&(m=l),d=1+o/d,e.abs(d)<l&&(d=l),a*=(m=1/m)*d,m=1+(o=-(n+u)*(c+u)*t/((n+r)*(f+r)))*m,e.abs(m)<l&&(m=l),d=1+o/d,e.abs(d)<l&&(d=l),a*=s=(m=1/m)*d,!(e.abs(s-1)<3e-7));u++);return a},t.gammapinv=function(n,i){var r,o,s,a,l,u,c=0,f=i-1,h=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(f),u=e.exp(f*(l-1)-h),a=n<.5?n:1-n,r=(2.30753+.27061*(o=e.sqrt(-2*e.log(a))))/(1+o*(.99229+.04481*o))-o,n<.5&&(r=-r),r=e.max(.001,i*e.pow(1-1/(9*i)-r/(3*e.sqrt(i)),3))):r=n<(o=1-i*(.253+.12*i))?e.pow(n/o,1/i):1-e.log(1-(n-o)/(1-o));c<12;c++){if(r<=0)return 0;if((r-=o=(s=(t.lowRegGamma(i,r)-n)/(o=i>1?u*e.exp(-(r-f)+f*(e.log(r)-l)):e.exp(-r+f*e.log(r)-h)))/(1-.5*e.min(1,s*((i-1)/r-1))))<=0&&(r=.5*(r+o)),e.abs(o)<1e-8*r)break}return r},t.erf=function(t){var n,i,r,o,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--)r=u,u=i*u-c+s[a],c=r;return o=n*e.exp(-t*t+.5*(s[0]+i*u)-c),l?o-1:1-o},t.erfc=function(e){return 1-t.erf(e)},t.erfcinv=function(n){var i,r,o,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*(o=e.sqrt(-2*e.log(s/2))))/(1+o*(.99229+.04481*o))-o);a<2;a++)i+=(r=t.erfc(i)-s)/(1.1283791670955126*e.exp(-i*i)-i*r);return n<1?i:-i},t.ibetainv=function(n,i,r){var o,s,a,l,u,c,f,h,d,m,g=i-1,p=r-1,v=0;if(n<=0)return 0;if(n>=1)return 1;for(i>=1&&r>=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),f=(c*c-3)/6,h=2/(1/(2*i-1)+1/(2*r-1)),d=c*e.sqrt(f+h)/h-(1/(2*r-1)-1/(2*i-1))*(f+5/6-2/(3*h)),c=i/(i+r*e.exp(2*d))):(o=e.log(i/(i+r)),s=e.log(r/(i+r)),c=n<(l=e.exp(i*o)/i)/(d=l+(u=e.exp(r*s)/r))?e.pow(i*d*n,1/i):1-e.pow(r*d*(1-n),1/r)),m=-t.gammaln(i)-t.gammaln(r)+t.gammaln(i+r);v<10;v++){if(0===c||1===c)return c;if((c-=l=(u=(t.ibeta(c,i,r)-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,r){var o=0===n||1===n?0:e.exp(t.gammaln(i+r)-t.gammaln(i)-t.gammaln(r)+i*e.log(n)+r*e.log(1-n));return!(n<0||n>1)&&(n<(i+1)/(i+r+2)?o*t.betacf(n,i,r)/i:1-o*t.betacf(1-n,r,i)/r)},t.randn=function(n,i){var r,o,s,a,l;if(i||(i=n),n)return t.create(n,i,(function(){return t.randn()}));do{r=t._random_fn(),o=1.7156*(t._random_fn()-.5),l=(s=r-.449871)*s+(a=e.abs(o)+.386595)*(.196*a-.25472*s)}while(l>.27597&&(l>.27846||o*o>-4*e.log(r)*r*r));return o/r},t.randg=function(n,i,r){var o,s,a,l,u,c,f=n;if(r||(r=i),n||(n=1),i)return(c=t.zeros(i,r)).alter((function(){return t.randg(n)})),c;n<1&&(n+=1),o=n-1/3,s=1/e.sqrt(9*o);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+o*(1-l+e.log(l)));if(n==f)return o*l;do{a=t._random_fn()}while(0===a);return e.pow(a,1/f)*o*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,r){for(var o,s=0,a=1,l=1,u=1,c=0,f=0;e.abs((l-f)/l)>r;)f=l,a=u+(o=-(n+c)*(n+i+c)*t/(n+2*c)/(n+2*c+1))*a,l=(s=l+o*s)+(o=(c+=1)*(i-c)*t/(n+2*c-1)/(n+2*c))*l,s/=u=a+o*u,a/=u,l/=u,u=1;return l/n}function i(n,i,r){var o=[.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/r)?e.pow(u,r):0;for(var c=a,f=(8-a)/(l=n>3?2:3),h=c+f,d=0,m=r-1,g=1;g<=l;g++){for(var p=0,v=.5*(h+c),y=.5*(h-c),C=1;C<=12;C++){var b,w=v+y*(6<C?o[(b=12-C+1)-1]:-o[(b=C)-1]),A=w*w;if(A>60)break;var S=2*t.normal.cdf(w,0,1,1,0)*.5-2*t.normal.cdf(w,n,1,1,0)*.5;S>=e.exp(-30/m)&&(p+=S=s[b-1]*e.exp(-.5*A)*e.pow(S,m))}d+=p*=2*y*r/e.sqrt(2*e.PI),c=h,h+=f}return(u+=d)<=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,r){var o=t[e](n,i,r);return o.data=this,o},t[e].prototype.sample=function(n){var i=this._a,r=this._b,o=this._c;return n?t.alter(n,(function(){return t[e].sample(i,r,o)})):t[e].sample(i,r,o)},function(n){for(var i=0;i<n.length;i++)!function(n){t[e].prototype[n]=function(i){var r=this._a,o=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,r,o,s)})):t[e][n](i,r,o,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,r){return n>1||n<0?0:1==i&&1==r?1:i<512&&r<512?e.pow(n,i-1)*e.pow(1-n,r-1)/t.betafn(i,r):e.exp((i-1)*e.log(n)+(r-1)*e.log(1-n)-t.betaln(i,r))},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,r){var o;return n<0?0:i<=2?0===n&&i<2?1/0:0===n&&2===i?1:1/t.betafn(i/2,r/2)*e.pow(i/r,i/2)*e.pow(n,i/2-1)*e.pow(1+i/r*n,-(i+r)/2):(o=i*n/(r+n*i),i*(r/(r+n*i))/2*t.binomial.pdf((i-2)/2,(i+r-2)/2,o))},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,r){return n<0?0:0===n&&1===i?1/r:e.exp((i-1)*e.log(n)-n/r-t.gammaln(i)-i*e.log(r))},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,r){return n<=0?0:e.exp(-(i+1)*e.log(n)-r/n-t.gammaln(i)+i*e.log(r))},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,r){return n<0?0:.5+.5*t.erf((e.log(n)-i)/e.sqrt(2*r*r))},inv:function(n,i,r){return e.exp(-1.4142135623730951*r*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,r){return e.abs(r)<1e-14?t.studentt.pdf(n,i):e.abs(n)<1e-14?e.exp(t.gammaln((i+1)/2)-r*r/2-.5*e.log(e.PI*i)-t.gammaln(i/2)):i/n*(t.noncentralt.cdf(n*e.sqrt(1+2/i),i+2,r)-t.noncentralt.cdf(n,i,r))},cdf:function(n,i,r){var o=1e-14;if(e.abs(r)<o)return t.studentt.cdf(n,i);var s=!1;n<0&&(s=!0,r=-r);for(var a=t.normal.cdf(-r,0,1),l=o+1,u=l,c=n*n/(n*n+i),f=0,h=e.exp(-r*r/2),d=e.exp(-r*r/2-.5*e.log(2)-t.gammaln(1.5))*r;f<200||u>o||l>o;)u=l,f>0&&(h*=r*r/(2*f),d*=r*r/(2*(f+.5))),a+=.5*(l=h*t.beta.cdf(c,f+.5,i/2)+d*t.beta.cdf(c,f+1,i/2)),f++;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,r){return.5*(1+t.erf((n-i)/e.sqrt(2*r*r)))},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 r=i/2;return t.ibeta((n+e.sqrt(n*n+i))/(2*e.sqrt(n*n+i)),r,r)},inv:function(n,i){var r=t.ibetainv(2*e.min(n,1-n),.5*i,.5);return r=e.sqrt(i*(1-r)/r),n>.5?r:-r},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,r){return 0===r||1===r?i*r===n?1:0:t.combination(i,n)*e.pow(r,n)*e.pow(1-r,i-n)},cdf:function(i,r,o){var s,a=1e-10;if(i<0)return 0;if(i>=r)return 1;if(o<0||o>1||r<=0)return NaN;var l=o,u=(i=e.floor(i))+1,c=r-i,f=u+c,h=e.exp(t.gammaln(f)-t.gammaln(c)-t.gammaln(u)+u*e.log(l)+c*e.log(1-l));return s=l<(u+1)/(f+2)?h*n(l,u,c,a):1-h*n(1-l,c,u,a),e.round(1/a*(1-s))/(1/a)}}),t.extend(t.negbin,{pdf:function(n,i,r){return n===n>>>0&&(n<0?0:t.combination(n+i-1,i-1)*e.pow(1-r,n)*e.pow(r,i))},cdf:function(e,n,i){var r=0,o=0;if(e<0)return 0;for(;o<=e;o++)r+=t.negbin.pdf(o,n,i);return r}}),t.extend(t.hypgeom,{pdf:function(n,i,r,o){if(n!=n|0)return!1;if(n<0||n<r-(i-o))return 0;if(n>o||n>r)return 0;if(2*r>i)return 2*o>i?t.hypgeom.pdf(i-r-o+n,i,i-r,i-o):t.hypgeom.pdf(o-n,i,i-r,o);if(2*o>i)return t.hypgeom.pdf(r-n,i,r,i-o);if(r<o)return t.hypgeom.pdf(n,i,o,r);for(var s=1,a=0,l=0;l<n;l++){for(;s>1&&a<o;)s*=1-r/(i-a),a++;s*=(o-l)*(r-l)/((l+1)*(i-r-o+l+1))}for(;a<o;a++)s*=1-r/(i-a);return e.min(1,e.max(0,s))},cdf:function(n,i,r,o){if(n<0||n<r-(i-o))return 0;if(n>=o||n>=r)return 1;if(2*r>i)return 2*o>i?t.hypgeom.cdf(i-r-o+n,i,i-r,i-o):1-t.hypgeom.cdf(o-n-1,i,i-r,o);if(2*o>i)return 1-t.hypgeom.cdf(r-n-1,i,r,i-o);if(r<o)return t.hypgeom.cdf(n,i,o,r);for(var s=1,a=1,l=0,u=0;u<n;u++){for(;s>1&&l<o;){var c=1-r/(i-l);a*=c,s*=c,l++}s+=a*=(o-u)*(r-u)/((u+1)*(i-r-o+u+1))}for(;l<o;l++)s*=1-r/(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=[],r=0;if(e<0)return 0;for(;r<=e;r++)i.push(t.poisson.pdf(r,n));return t.sum(i)},mean:function(t){return t},variance:function(t){return t},sampleSmall:function(n){var i=1,r=0,o=e.exp(-n);do{r++,i*=t._random_fn()}while(i>o);return r-1},sampleLarge:function(n){var i,r,o,s,a,l,u,c,f,h,d=n;for(s=e.sqrt(d),a=e.log(d),l=.02483*(u=.931+2.53*s)-.059,c=1.1239+1.1328/(u-3.4),f=.9277-3.6224/(u-2);;){if(r=e.random()-.5,o=e.random(),h=.5-e.abs(r),i=e.floor((2*l/h+u)*r+d+.43),h>=.07&&o<=f)return i;if(!(i<0||h<.013&&o>h)&&e.log(o)+e.log(c)-e.log(l/(h*h)+u)<=i*a-d-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,r){return i<=n||r<n||r>i?NaN:t<=n?0:t>=i?1:t<=r?e.pow(t-n,2)/((i-n)*(r-n)):1-e.pow(i-t,2)/((i-n)*(i-r))},inv:function(t,n,i,r){return i<=n||r<n||r>i?NaN:t<=(r-n)/(i-n)?n+(i-n)*e.sqrt(t*((r-n)/(i-n))):n+(i-n)*(1-e.sqrt((1-t)*(1-(r-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,r){var o=t._random_fn();return o<(r-n)/(i-n)?n+e.sqrt(o*(i-n)*(r-n)):i-e.sqrt((1-o)*(i-n)*(i-r))},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 r,o=t._random_fn()-.5;return n-i*((r=o)/e.abs(r))*e.log(1-2*e.abs(o))}}),t.extend(t.tukey,{cdf:function(n,r,o){var s=r,a=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],l=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(n<=0)return 0;if(o<2||s<2)return NaN;if(!Number.isFinite(n))return 1;if(o>25e3)return i(n,1,s);var u,c=.5*o,f=c*e.log(o)-o*e.log(2)-t.gammaln(c),h=c-1,d=.25*o;u=o<=100?1:o<=800?.5:o<=5e3?.25:.125,f+=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,b;8<y?(C=y-8-1,b=f+h*e.log(v+a[C]*u)-(a[C]*u+v)*d):(C=y-1,b=f+h*e.log(v-a[C]*u)+(a[C]*u-v)*d),b>=-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(b))}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,r){if(r<2||i<2)return NaN;if(n<0||n>1)return NaN;if(0===n)return 0;if(1===n)return 1/0;var o,s=function(t,n,i){var r=.5-.5*t,o=e.sqrt(e.log(1/(r*r))),s=o+((((-453642210148e-16*o-.204231210125)*o-.342242088547)*o-1)*o+.322232421088)/((((.0038560700634*o+.10353775285)*o+.531103462366)*o+.588581570495)*o+.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,r),a=t.tukey.cdf(s,i,r)-n;o=a>0?e.max(0,s-1):s+1;for(var l,u=t.tukey.cdf(o,i,r)-n,c=1;c<50;c++)if(l=o-u*(o-s)/(u-a),a=u,s=o,l<0&&(l=0,u=-n),u=t.tukey.cdf(l,i,r)-n,o=l,e.abs(o-s)<1e-4)return l;throw new Error("tukey.inv failed to converge")}})}(e,Math),function(t,e){var n,i,r=Array.prototype.push,o=t.utils.isArray;function s(e){return o(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,r,o,a,l,u,c,f;if(void 0===e.length&&void 0===n.length)return e*n;if(l=e.length,u=e[0].length,c=t.zeros(l,o=s(n)?n[0].length:u),f=0,s(n)){for(;f<o;f++)for(i=0;i<l;i++){for(a=0,r=0;r<u;r++)a+=e[i][r]*n[r][f];c[i][f]=a}return 1===l&&1===f?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,r,o=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=o.length,f=o[0].length;u<c;u++){for(l[u]=[],i=0,r=0;r<f;r++)i+=o[u][r]*a[u][r];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,r=0;for(isNaN(n)&&(n=2),s(t[0])&&(t=t[0]);r<t.length;r++)i+=e.pow(e.abs(t[r]),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++)r.apply(i[n],e[n]);return i},inv:function(e){for(var n,i=e.length,r=e[0].length,o=t.identity(i,r),s=t.gauss_jordan(e,o),a=[],l=0;l<i;l++)for(a[l]=[],n=r;n<s[0].length;n++)a[l][n-r]=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 r=[],o=1;o<e.length;o++){r[o-1]=[];for(var s=0;s<e.length;s++)s<i?r[o-1][s]=e[o][s]:s>i&&(r[o-1][s-1]=e[o][s])}var a=i%2?-1:1;n+=t(r)*e[0][i]*a}return n},gauss_elimination:function(n,i){var r,o,s,a,l=0,u=0,c=n.length,f=n[0].length,h=1,d=0,m=[];for(r=(n=t.aug(n,i))[0].length,l=0;l<c;l++){for(o=n[l][l],u=l,a=l+1;a<f;a++)o<e.abs(n[a][l])&&(o=n[a][l],u=a);if(u!=l)for(a=0;a<r;a++)s=n[l][a],n[l][a]=n[u][a],n[u][a]=s;for(u=l+1;u<c;u++)for(h=n[u][l]/n[l][l],a=l;a<r;a++)n[u][a]=n[u][a]-h*n[l][a]}for(l=c-1;l>=0;l--){for(d=0,u=l+1;u<=c-1;u++)d+=m[u]*n[l][u];m[l]=(n[l][r-1]-d)/n[l][l]}return m},gauss_jordan:function(n,i){var r,o,s,a=t.aug(n,i),l=a.length,u=a[0].length,c=0;for(o=0;o<l;o++){var f=o;for(s=o+1;s<l;s++)e.abs(a[s][o])>e.abs(a[f][o])&&(f=s);var h=a[o];for(a[o]=a[f],a[f]=h,s=o+1;s<l;s++)for(c=a[s][o]/a[o][o],r=o;r<u;r++)a[s][r]-=a[o][r]*c}for(o=l-1;o>=0;o--){for(c=a[o][o],s=0;s<o;s++)for(r=u-1;r>o-1;r--)a[s][r]-=a[o][r]*a[s][o]/c;for(a[o][o]/=c,r=l;r<u;r++)a[o][r]/=c}return a},triaUpSolve:function(e,n){var i,r=e[0].length,o=t.zeros(1,r)[0],s=!1;return null!=n[0].length&&(n=n.map((function(t){return t[0]})),s=!0),t.arange(r-1,-1,-1).forEach((function(s){i=t.arange(s+1,r).map((function(t){return o[t]*e[s][t]})),o[s]=(n[s]-t.sum(i))/e[s][s]})),s?o.map((function(t){return[t]})):o},triaLowSolve:function(e,n){var i,r=e[0].length,o=t.zeros(1,r)[0],s=!1;return null!=n[0].length&&(n=n.map((function(t){return t[0]})),s=!0),t.arange(r).forEach((function(r){i=t.arange(r).map((function(t){return e[r][t]*o[t]})),o[r]=(n[r]-t.sum(i))/e[r][r]})),s?o.map((function(t){return[t]})):o},lu:function(e){var n,i=e.length,r=t.identity(i),o=t.zeros(e.length,e[0].length);return t.arange(i).forEach((function(t){o[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 r[s][t]*o[t][i]})),r[s][i]=(e[s][i]-t.sum(n))/o[i][i]})),t.arange(s,i).forEach((function(i){n=t.arange(s).map((function(t){return r[s][t]*o[t][i]})),o[s][i]=e[n.length][i]-t.sum(n)}))})),[r,o]},cholesky:function(n){var i,r=n.length,o=t.zeros(n.length,n[0].length);return t.arange(r).forEach((function(s){i=t.arange(s).map((function(t){return e.pow(o[s][t],2)})),o[s][s]=e.sqrt(n[s][s]-t.sum(i)),t.arange(s+1,r).forEach((function(e){i=t.arange(s).map((function(t){return o[s][t]*o[e][t]})),o[e][s]=(n[s][e]-t.sum(i))/o[s][s]}))})),o},gauss_jacobi:function(n,i,r,o){for(var s,a,l,u,c=0,f=0,h=n.length,d=[],m=[],g=[];c<h;c++)for(d[c]=[],m[c]=[],g[c]=[],f=0;f<h;f++)c>f?(d[c][f]=n[c][f],m[c][f]=g[c][f]=0):c<f?(m[c][f]=n[c][f],d[c][f]=g[c][f]=0):(g[c][f]=n[c][f],d[c][f]=m[c][f]=0);for(l=t.multiply(t.multiply(t.inv(g),t.add(d,m)),-1),a=t.multiply(t.inv(g),i),s=r,u=t.add(t.multiply(l,r),a),c=2;e.abs(t.norm(t.subtract(u,s)))>o;)s=u,u=t.add(t.multiply(l,s),a),c++;return u},gauss_seidel:function(n,i,r,o){for(var s,a,l,u,c,f=0,h=n.length,d=[],m=[],g=[];f<h;f++)for(d[f]=[],m[f]=[],g[f]=[],s=0;s<h;s++)f>s?(d[f][s]=n[f][s],m[f][s]=g[f][s]=0):f<s?(m[f][s]=n[f][s],d[f][s]=g[f][s]=0):(g[f][s]=n[f][s],d[f][s]=m[f][s]=0);for(u=t.multiply(t.multiply(t.inv(t.add(g,d)),m),-1),l=t.multiply(t.inv(t.add(g,d)),i),a=r,c=t.add(t.multiply(u,r),l),f=2;e.abs(t.norm(t.subtract(c,a)))>o;)a=c,c=t.add(t.multiply(u,a),l),f+=1;return c},SOR:function(n,i,r,o,s){for(var a,l,u,c,f,h=0,d=n.length,m=[],g=[],p=[];h<d;h++)for(m[h]=[],g[h]=[],p[h]=[],a=0;a<d;a++)h>a?(m[h][a]=n[h][a],g[h][a]=p[h][a]=0):h<a?(g[h][a]=n[h][a],m[h][a]=p[h][a]=0):(p[h][a]=n[h][a],m[h][a]=g[h][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=r,f=t.add(t.multiply(c,r),u),h=2;e.abs(t.norm(t.subtract(f,l)))>o;)l=f,f=t.add(t.multiply(c,l),u),h++;return f},householder:function(n){for(var i,r,o,s,a=n.length,l=n[0].length,u=0,c=[],f=[];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),r=e.sqrt((i*i-n[u+1][u]*i)/2),(c=t.zeros(a,1))[u+1][0]=(n[u+1][u]-i)/(2*r),o=u+2;o<a;o++)c[o][0]=n[o][u]/(2*r);f=t.subtract(t.identity(a,l),t.multiply(t.multiply(c,t.transpose(c)),2)),n=t.multiply(f,t.multiply(n,f))}return n},QR:(n=t.sum,i=t.arange,function(r){var o,s,a,l=r.length,u=r[0].length,c=t.zeros(u,u);for(r=t.copy(r),s=0;s<u;s++){for(c[s][s]=e.sqrt(n(i(l).map((function(t){return r[t][s]*r[t][s]})))),o=0;o<l;o++)r[o][s]=r[o][s]/c[s][s];for(a=s+1;a<u;a++)for(c[s][a]=n(i(l).map((function(t){return r[t][s]*r[t][a]}))),o=0;o<l;o++)r[o][a]=r[o][a]-r[o][s]*c[s][a]}return[r,c]}),lstsq:function(e,n){var i=!1;void 0===n[0].length&&(n=n.map((function(t){return[t]})),i=!0);var r=t.QR(e),o=r[0],s=r[1],a=e[0].length,l=t.slice(o,{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(r){var o=t.multiply(e[r][n],-1),s=t.slice(e,{row:r}),a=t.multiply(t.slice(e,{row:n}),o);t.sliceAssign(e,{row:r},t.add(s,a));var l=t.slice(i,{row:r}),u=t.multiply(t.slice(i,{row:n}),o);t.sliceAssign(i,{row:r},t.add(l,u))}))})),i}(t.slice(s,{row:{end:a}})),c=t.transpose(l);void 0===c[0].length&&(c=[c]);var f=t.multiply(t.multiply(u,c),n);return void 0===f.length&&(f=[[f]]),i?f.map((function(t){return t[0]})):f},jacobi:function(n){for(var i,r,o,s,a,l,u,c=1,f=n.length,h=t.identity(f,f),d=[];1===c;){for(a=n[0][1],o=0,s=1,i=0;i<f;i++)for(r=0;r<f;r++)i!=r&&a<e.abs(n[i][r])&&(a=e.abs(n[i][r]),o=i,s=r);for(l=n[o][o]===n[s][s]?n[o][s]>0?e.PI/4:-e.PI/4:e.atan(2*n[o][s]/(n[o][o]-n[s][s]))/2,(u=t.identity(f,f))[o][o]=e.cos(l),u[o][s]=-e.sin(l),u[s][o]=e.sin(l),u[s][s]=e.cos(l),h=t.multiply(h,u),n=t.multiply(t.multiply(t.inv(u),n),u),c=0,i=1;i<f;i++)for(r=1;r<f;r++)i!=r&&e.abs(n[i][r])>.001&&(c=1)}for(i=0;i<f;i++)d.push(n[i][i]);return[h,d]},rungekutta:function(t,e,n,i,r,o){var s,a,l;if(2===o)for(;i<=n;)r+=((s=e*t(i,r))+(a=e*t(i+e,r+s)))/2,i+=e;if(4===o)for(;i<=n;)r+=((s=e*t(i,r))+2*(a=e*t(i+e/2,r+s/2))+2*(l=e*t(i+e/2,r+a/2))+e*t(i+e,r+l))/6,i+=e;return r},romberg:function(t,n,i,r){for(var o,s,a,l,u,c=0,f=(i-n)/2,h=[],d=[],m=[];c<r/2;){for(u=t(n),a=n,l=0;a<=i;a+=f,l++)h[l]=a;for(o=h.length,a=1;a<o-1;a++)u+=(a%2!=0?4:2)*t(h[a]);u=f/3*(u+t(i)),m[c]=u,f/=2,c++}for(s=m.length,o=1;1!==s;){for(a=0;a<s-1;a++)d[a]=(e.pow(4,o)*m[a+1]-m[a])/(e.pow(4,o)-1);s=d.length,m=d,d=[],o++}return m},richardson:function(t,n,i,r){function o(t,e){for(var n,i=0,r=t.length;i<r;i++)t[i]===e&&(n=i);return n}for(var s,a,l,u,c,f=e.abs(i-t[o(t,i)+1]),h=0,d=[],m=[];r>=f;)s=o(t,i+r),a=o(t,i),d[h]=(n[s]-2*n[a]+n[2*a-s])/(r*r),r/=2,h++;for(u=d.length,l=1;1!=u;){for(c=0;c<u-1;c++)m[c]=(e.pow(4,l)*d[c+1]-d[c])/(e.pow(4,l)-1);u=m.length,d=m,m=[],l++}return d},simpson:function(t,e,n,i){for(var r,o=(n-e)/i,s=t(e),a=[],l=e,u=0,c=1;l<=n;l+=o,u++)a[u]=l;for(r=a.length;c<r-1;c++)s+=(c%2!=0?4:2)*t(a[c]);return o/3*(s+t(n))},hermite:function(t,e,n,i){for(var r,o=t.length,s=0,a=0,l=[],u=[],c=[],f=[];a<o;a++){for(l[a]=1,r=0;r<o;r++)a!=r&&(l[a]*=(i-t[r])/(t[a]-t[r]));for(u[a]=0,r=0;r<o;r++)a!=r&&(u[a]+=1/(t[a]-t[r]));c[a]=(1-2*(i-t[a])*u[a])*(l[a]*l[a]),f[a]=(i-t[a])*(l[a]*l[a]),s+=c[a]*e[a]+f[a]*n[a]}return s},lagrange:function(t,e,n){for(var i,r,o=0,s=0,a=t.length;s<a;s++){for(r=e[s],i=0;i<a;i++)s!=i&&(r*=(n-t[i])/(t[s]-t[i]));o+=r}return o},cubic_spline:function(e,n,i){for(var r,o,s=e.length,a=0,l=[],u=[],c=[],f=[],h=[],d=[];a<s-1;a++)f[a]=e[a+1]-e[a];for(c[0]=0,a=1;a<s-1;a++)c[a]=3/f[a]*(n[a+1]-n[a])-3/f[a-1]*(n[a]-n[a-1]);for(a=1;a<s-1;a++)l[a]=[],u[a]=[],l[a][a-1]=f[a-1],l[a][a]=2*(f[a-1]+f[a]),l[a][a+1]=f[a],u[a][0]=c[a];for(o=t.multiply(t.inv(l),u),r=0;r<s-1;r++)h[r]=(n[r+1]-n[r])/f[r]-f[r]*(o[r+1][0]+2*o[r][0])/3,d[r]=(o[r+1][0]-o[r][0])/(3*f[r]);for(r=0;r<s&&!(e[r]>i);r++);return n[r-=1]+(i-e[r])*h[r]+t.sq(i-e[r])*o[r]+(i-e[r])*t.sq(i-e[r])*d[r]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(e){var n,i,r,o,s,a=e.length,l=e[0].length,u=0,c=[],f=[],h=[],d=[],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=(r=t.jacobi(g))[0],f=r[1],p=t.transpose(s),u=0;u<f.length;u++)for(n=u;n<f.length;n++)f[u]<f[n]&&(i=f[u],f[u]=f[n],f[n]=i,h=p[u],p[u]=p[n],p[n]=h);for(o=t.transpose(m),u=0;u<a;u++)for(d[u]=[],n=0;n<o.length;n++)d[u][n]=t.dot([p[u]],[o[n]]);return[e,f,p,d]}}),function(e){for(var n=0;n<e.length;n++)!function(e){t.fn[e]=function(n,i){var r=this;return i?(setTimeout((function(){i.call(r,t.fn[e].call(r,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,r=t.utils.isArray;function o(t,n,i,r){if(t>1||i>1||t<=0||i<=0)throw new Error("Proportions should be greater than 0 and less than 1");var o=(t*n+i*r)/(n+r);return(t-i)/e.sqrt(o*(1-o)*(1/n+1/r))}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,o=n.call(arguments);return r(o[1])?(i=t.zscore(o[0],o[1],o[3]),1===o[2]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1)):o.length>2?(i=t.zscore(o[0],o[1],o[2]),1===o[3]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1)):(i=o[0],1===o[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,r){var o=e.abs(this.zscore(n,r));return 1===i?t.normal.cdf(-o,0,1):2*t.normal.cdf(-o,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 r,o=n.call(arguments);return 5===o.length?(r=e.abs(t.tscore(o[0],o[1],o[2],o[3])),1===o[4]?t.studentt.cdf(-r,o[3]-1):2*t.studentt.cdf(-r,o[3]-1)):i(o[1])?(r=e.abs(o[0]),1==o[2]?t.studentt.cdf(-r,o[1]-1):2*t.studentt.cdf(-r,o[1]-1)):(r=e.abs(t.tscore(o[0],o[1])),1==o[2]?t.studentt.cdf(-r,o[1].length-1):2*t.studentt.cdf(-r,o[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,r,o,s,a,l,u,c,f=n.call(arguments);if(1===f.length){for(a=new Array(f[0].length),u=0;u<f[0].length;u++)a[u]=f[0][u];f=a}for(r=new Array,u=0;u<f.length;u++)r=r.concat(f[u]);for(o=t.mean(r),i=0,u=0;u<f.length;u++)i+=f[u].length*e.pow(t.mean(f[u])-o,2);for(i/=f.length-1,l=0,u=0;u<f.length;u++)for(s=t.mean(f[u]),c=0;c<f[u].length;c++)l+=e.pow(f[u][c]-s,2);return i/(l/(r.length-f.length))},anovaftest:function(){var e,r,o,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,o=0,s=0;s<a.length;s++)o+=a[s].length;return r=o-e-1,1-t.centralF.cdf(l,e,r)},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 r,o,s,a,l,u=n.call(arguments);return i(u[0])?(r=u[0],o=u[1],s=u[2],a=u[3],l=u[4]):(r=t.mean(u[0]),o=t.mean(u[1]),s=u[0].length,a=u[1].length,l=u[2]),e.abs(r-o)/(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 r=i[0],o=i[1];return 1-t.tukey.cdf(e,o,r-o)},tukeyhsd:function(e){for(var n=t.pooledstdev(e),i=e.map((function(e){return t.mean(e)})),r=e.reduce((function(t,e){return t+e.length}),0),o=[],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,r,e.length);o.push([[s,a],l])}return o}}),t.extend({normalci:function(){var i,r=n.call(arguments),o=new Array(2);return i=4===r.length?e.abs(t.normal.inv(r[1]/2,0,1)*r[2]/e.sqrt(r[3])):e.abs(t.normal.inv(r[1]/2,0,1)*t.stdev(r[2])/e.sqrt(r[2].length)),o[0]=r[0]-i,o[1]=r[0]+i,o},tci:function(){var i,r=n.call(arguments),o=new Array(2);return i=4===r.length?e.abs(t.studentt.inv(r[1]/2,r[3]-1)*r[2]/e.sqrt(r[3])):e.abs(t.studentt.inv(r[1]/2,r[2].length-1)*t.stdev(r[2],!0)/e.sqrt(r[2].length)),o[0]=r[0]-i,o[1]=r[0]+i,o},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,r){var s=o(e,n,i,r);return t.ztest(s,1)},twoSidedDifferenceOfProportions:function(e,n,i,r){var s=o(e,n,i,r);return t.ztest(s,2)}})}(e,Math),e.models=function(){function t(t,n){var i=t.length,r=n[0].length-1,o=i-r-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)}))),f=e.sum(t.map((function(t,e){return Math.pow(t-a[e],2)}))),h=c+f;return{exog:n,endog:t,nobs:i,df_model:r,df_resid:o,coef:s,predict:a,resid:l,ybar:u,SST:h,SSE:c,SSR:f,R2:c/h}}function n(n){var i,r,o=(i=n.exog,r=i[0].length,e.arange(r).map((function(n){var o=e.arange(r).filter((function(t){return t!==n}));return t(e.col(i,n).map((function(t){return t[0]})),e.col(i,o))}))),s=Math.sqrt(n.SSR/n.df_resid),a=o.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),f=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:f}}return{ols:function(i,r){var o=t(i,r),s=n(o),a=function(t){var n,i,r,o=t.R2/t.df_model/((1-t.R2)/t.df_resid);return{F_statistic:o,pvalue:1-(n=o,i=t.df_model,r=t.df_resid,e.beta.cdf(n/(r/i+n),i/2,r/2))}}(o),l=1-(1-o.R2)*((o.nobs-1)/o.df_resid);return o.t=s,o.f=a,o.adjust_R2=l,o}}}(),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,r,o,s,a;if(t.cols()==n.rows()){if(n.rows()>1){for(s=[],i=0;i<t.rows();i++)for(s[i]=[],r=0;r<n.cols();r++){for(a=0,o=0;o<t.cols();o++)a+=t.toArray()[i][o]*n.toArray()[o][r];s[i][r]=a}return e(s)}for(s=[],i=0;i<t.rows();i++)for(s[i]=[],r=0;r<n.cols();r++){for(a=0,o=0;o<t.cols();o++)a+=t.toArray()[i][o]*n.toArray()[r];s[i][r]=a}return e(s)}},regress:function(t,n){var i=e.xtranspxinv(t),r=t.transpose(),o=e.matrixmult(e(i),r);return e.matrixmult(o,n)},regresst:function(t,n,i){var r=e.regress(t,n),o={anova:{}},s=e.jMatYBar(t,r);o.yBar=s;var a=n.mean();o.anova.residuals=e.residuals(n,s),o.anova.ssr=e.ssr(s,a),o.anova.msr=o.anova.ssr/(t[0].length-1),o.anova.sse=e.sse(n,s),o.anova.mse=o.anova.sse/(n.length-(t[0].length-1)-1),o.anova.sst=e.sst(n,a),o.anova.mst=o.anova.sst/(n.length-1),o.anova.r2=1-o.anova.sse/o.anova.sst,o.anova.r2<0&&(o.anova.r2=0),o.anova.fratio=o.anova.msr/o.anova.mse,o.anova.pvalue=e.anovaftest(o.anova.fratio,t[0].length-1,n.length-(t[0].length-1)-1),o.anova.rmse=Math.sqrt(o.anova.mse),o.anova.r2adj=1-o.anova.mse/o.anova.mst,o.anova.r2adj<0&&(o.anova.r2adj=0),o.stats=new Array(t[0].length);for(var l,u,c,f=e.xtranspxinv(t),h=0;h<r.length;h++)l=Math.sqrt(o.anova.mse*Math.abs(f[h][h])),u=Math.abs(r[h]/l),c=e.ttest(u,n.length-t[0].length-1,i),o.stats[h]=[r[h],l,u,c];return o.regress=r,o},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),r=0;r<t.length;r++){i[r]=new Array(t[r].length);for(var o=0;o<t[r].length;o++)i[r][o]=t[r][o]-n[r][o]}return e(i)}}),e.jStat=e,e)},4788:(t,e,n)=>{"use strict";var i=n(5072),r=n.n(i),o=n(7825),s=n.n(o),a=n(7659),l=n.n(a),u=n(5056),c=n.n(u),f=n(540),h=n.n(f),d=n(1113),m=n.n(d),g=n(365),p={};p.styleTagTransform=m(),p.setAttributes=c(),p.insert=l().bind(null,"head"),p.domAPI=s(),p.insertStyleElement=h(),r()(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 o={},s=[],a=0;a<t.length;a++){var l=t[a],u=i.base?l[0]+i.base:l[0],c=o[u]||0,f="".concat(u," ").concat(c);o[u]=c+1;var h=n(f),d={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==h)e[h].references++,e[h].updater(d);else{var m=r(d,i);i.byIndex=a,e.splice(a,0,{identifier:f,updater:m,references:1})}s.push(f)}return s}function r(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,r){var o=i(t=t||[],r=r||{});return function(t){t=t||[];for(var s=0;s<o.length;s++){var a=n(o[s]);e[a].references--}for(var l=i(t,r),u=0;u<o.length;u++){var c=n(o[u]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}o=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 r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var o=n.sourceMap;o&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),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:()=>H,q:()=>G});var i,r=n(7389),o=n(4328),s=n(6082),a=n(2003),l=n(8223),u=n(3077),c=n(439);async function f(t,e,n,r,o){const a=(0,u.R)(e,o),f=o.getSeqHandler(e).getNewColumnFromList("ref",[n]),h=o.getSeqHandler(f).getSplitted(0),d=r===i.IDENTITY?function(t,e){const n=e.columns.length,i=new Array(n),r=new Array(n),o=new Array(n);for(let s=0;s<n;++s){const n=e.columns.byIndex(s);i[s]=n.getRawData(),r[s]=n.categories.indexOf("");const a=s<t.length?t.getOriginal(s):c._S;o[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)===o[e]&&++l[n];l[n]/=t.length}return a}(h,a):r===i.SIMILARITY?await async function(t,e,n){const i=e.columns.toList();return await(0,l.uL)(i,t,n)}(h,a,o):null;if(null===d)throw new Error(`In bio library: Unknown sequence scoring method: ${r}`);return d.name=t.columns.getUnusedName(d.name),t.columns.add(d),d}!function(t){t.IDENTITY="identity",t.SIMILARITY="similarity"}(i||(i={}));var h,d=n(8774),m=n(144),g=n.n(m),p=n(7233),v=n.n(p),y=n(4139),C=n(115),b=n(8608),w=n(3541),A=n(3163),S=n(7923),E=n(7654),T=n(5480),x=n(5429),_=n(6920),N=n(3657);!function(t){t.UMAP="UMAP",t.T_SNE="t-SNE"}(h||(h={}));n(5540);var M,I,O,L,R,P,k,V,D=n(4329);(I=M||(M={})).EUCLIDEAN="EUCLIDEAN",I.MANHATTAN="MANHATTAN",M.EUCLIDEAN,M.MANHATTAN,(L=O||(O={})).HAMMING="Hamming",L.EUCLIDEAN="Euclidean",L.MANHATTAN="Manhattan",L.TANIMOTO="Tanimoto",L.LEVENSTEIN="Levenshtein",L.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",L.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",L.SOKAL="Sokal",L.COSINE="Cosine",L.ASYMMETRIC="Asymmetric",L.Difference="Difference",L.OneHot="One-Hot",O.HAMMING,O.EUCLIDEAN,O.MANHATTAN,O.TANIMOTO,O.LEVENSTEIN,O.NEEDLEMAN_WUNSCH,O.MONOMER_CHEMICAL_DISTANCE,O.SOKAL,O.COSINE,O.ASYMMETRIC,O.Difference,O.OneHot,O.HAMMING,O.EUCLIDEAN,O.MANHATTAN,O.TANIMOTO,O.SOKAL,O.COSINE,O.ASYMMETRIC,O.LEVENSTEIN,O.NEEDLEMAN_WUNSCH,O.MONOMER_CHEMICAL_DISTANCE,O.Difference,O.OneHot,new Set([O.HAMMING,O.LEVENSTEIN,O.NEEDLEMAN_WUNSCH,O.MONOMER_CHEMICAL_DISTANCE,O.OneHot]),new Set([O.HAMMING,O.EUCLIDEAN,O.MANHATTAN,O.MONOMER_CHEMICAL_DISTANCE,O.LEVENSTEIN,O.NEEDLEMAN_WUNSCH,O.TANIMOTO,O.COSINE,O.SOKAL,O.ASYMMETRIC,O.OneHot,O.Difference]),new Set([O.EUCLIDEAN,O.MANHATTAN,O.OneHot,O.Difference]),new Set([O.EUCLIDEAN,O.MANHATTAN,O.Difference]),new Set([O.EUCLIDEAN,O.MANHATTAN,O.Difference]),new Set([O.TANIMOTO,O.COSINE,O.SOKAL,O.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"}(P||(P={})),function(t){t.SCALARMULT="SCALARMULT",t.SCALARADD="SCALARADD",t.SCALARPOW="SCALARPOW"}(k||(k={})),Object.prototype.toString,function(t){t.EUCLIDEAN="EUCLIDEAN",t.MANHATTAN="MANHATTAN"}(V||(V={}));var G,F=n(726),U=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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 H{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,N.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()(o.shell.tableViews).find((({dataFrame:t})=>(null==t?void 0:t.getTag(s.TAGS.ID))===this.id)):void 0,!this._analysisView&&(null===(t=o.shell.v)||void 0===t?void 0:t.preview)instanceof s.TableView&&(null===(n=null===(e=o.shell.v)||void 0===e?void 0:e.preview)||void 0===n?void 0:n.dataFrame)===this.df&&(this._analysisView=o.shell.v.preview),this._analysisView||(this._analysisView=o.shell.addTableView(this.df))),"1"===this.df.getTag(y.gp.MULTIPLE_VIEWS)||this._layoutEventInitialized||(0,b.Lv)()||(o.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,D._)()),this._settings):null}set settings(t){var e,n,i;const r=Object.entries(t),o=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 r)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])=>o[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,b.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,b.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[H.modelName]){const e=t.temp[H.modelName]=new H(t),n=e.settings;n&&e.init(n);let i=!0;e.subs.push(s.debounce(t.onSelectionChanged,10).subscribe((n=>{var r;if(i||t.selection.anyTrue||!e._analysisView||!document.contains(e._analysisView.root)||e._analysisView.dataFrame!==t||!e.positionColumns)return void(i=!(null===(r=null==t?void 0:t.selection)||void 0===r?void 0:r.anyTrue));e.webLogoSelection=(0,b.ZR)(e.positionColumns);const o=e.findViewer(G.SEQUENCE_VARIABILITY_MAP);null!=o&&(o.invariantMapSelection=(0,b.ZR)(e.positionColumns),o.mutationCliffsSelection=(0,b.ZR)(e.positionColumns));const s=e.findViewer(G.MOST_POTENT_RESIDUES);null!=s&&(s.mutationCliffsSelection=(0,b.ZR)(e.positionColumns),s.invariantMapSelection=(0,b.ZR)(e.positionColumns));const a=e.findViewer(G.LOGO_SUMMARY_TABLE);null!=a&&(a.initClusterSelection({notify:!0}),a.render()),i=!0})))}return t.temp[H.modelName]}modifyWebLogoSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.webLogoSelection=(0,b.vW)(this.webLogoSelection,t,e):this._webLogoSelection=(0,b.vW)(this.webLogoSelection,t,e)}getVisibleSelection(){return this.df.selection.clone().and(this.df.filter)}createAccordion(){var t,e,n,i,o,l;const u=null===(t=this.df)||void 0===t?void 0:t.temp[H.modelName];if(!u)return null;const c=r.accordion("Peptides analysis panel");c.root.style.width="100%";const f=u.getVisibleSelection(),h=u.df.filter.anyFalse?` among ${u.df.filter.trueCount} filtered`:"",d=t=>{const e=[];for(const[n,i]of Object.entries(t))for(const t of i)e.push(`${n}:${t}`);return e.join(", ")},m=u.findViewer(G.LOGO_SUMMARY_TABLE),p=[],y=(null===m?[]:m.clusterSelection[T.W.ORIGINAL].concat(m.clusterSelection[T.W.CUSTOM])).join(", "),C=t=>{const e=r.divText(t);return e.innerHTML=t,e};0!==y.length&&p.push(C(`<b>Logo Summary Table</b> clusters: ${y}`));const x=u.findViewer(G.SEQUENCE_VARIABILITY_MAP),_=d(null!==(e=null==x?void 0:x.invariantMapSelection)&&void 0!==e?e:{}),M=d(null!==(n=null==x?void 0:x.mutationCliffsSelection)&&void 0!==n?n:{});0!==_.length&&p.push(C(`<b>Invariant map</b>: ${_}`)),0!==M.length&&p.push(C(`<b>Mutation cliffs</b>: ${M}`));const I=u.findViewer(G.MOST_POTENT_RESIDUES),O=d(null!==(i=null==I?void 0:I.invariantMapSelection)&&void 0!==i?i:{});0!==O.length&&p.push(C(`<b>Most potent residues</b>: ${O}`));const L=d(u.webLogoSelection);0!==L.length&&p.push(C(`<b>WebLogo</b>: ${L}`)),0!==p.length&&p.unshift(r.h1("Selection Sources"));const R=r.div(r.divV(p));c.addTitle(r.divV([r.h1(`${f.trueCount} selected rows${h}`),R],"css-gap-small")),f.anyTrue&&c.addPane("Actions",(()=>{try{const t=r.label("New view");if(v()(t).addClass("d4-link-action"),t.onclick=()=>u.createNewView(),t.onmouseover=t=>r.tooltip.show("Creates a new view from current selection",t.clientX+5,t.clientY+5),null===m)return r.divV([t]);const e=r.label("New cluster");v()(e).addClass("d4-link-action"),e.onclick=()=>{if(null===m)throw new Error("Logo summary table viewer is not found");m.clusterFromSelection()},e.onmouseover=t=>r.tooltip.show("Creates a new cluster from selection",t.clientX+5,t.clientY+5);const n=r.label("Remove cluster");return v()(n).addClass("d4-link-action"),n.onclick=()=>{const t=u.findViewer(G.LOGO_SUMMARY_TABLE);if(null===t)throw new Error("Logo summary table viewer is not found");t.removeCluster()},n.onmouseover=t=>r.tooltip.show("Removes currently selected custom cluster",t.clientX+5,t.clientY+5),n.style.visibility=0===m.clusterSelection[T.W.CUSTOM].length?"hidden":"visible",r.divV([t,e,n])}catch(t){const e=r.divText("Error in Actions");return r.tooltip.bind(e,String(t)),e}}),!0);let P=u.settings;const k=[x,I,m].filter((t=>null!==t&&(t.type!==this.accordionSource||(P=t,!1))));if(null===P)throw new Error("PeptidesError: Model is the source of accordion but is not initialized");P!==u.settings&&k.push(u.settings);const V=k.filter((t=>null!==t&&(0,b.$s)(P,t)&&(t!==u.settings||u.isInitialized)));V.push(P);const D=s.BitSet.create(u.df.rowCount);for(const t of V){const e=t===this.settings?(0,b.KT)(this.webLogoSelection,this.monomerPositionStats):t instanceof T.s?(0,b.KT)(t.clusterSelection,t.clusterStats):t instanceof w.xN?(0,b.KT)(t.mutationCliffsSelection,(0,b.qI)(null!==(o=t.mutationCliffs)&&void 0!==o?o:new Map,u.df.rowCount)):null;if(null!==e&&D.or(e),t instanceof w.J){const e=(0,b.KT)(t.invariantMapSelection,t.monomerPositionStats);null!==e&&D.or(e)}}const U=P;P===u.settings||U instanceof T.s||null==U.mutationCliffs||c.addPane("Mutation Cliffs pairs",(()=>(0,S.F)(u.df,{mutationCliffs:U.mutationCliffs,mutationCliffsSelection:U.mutationCliffsSelection,gridColumns:u.analysisView.grid.columns,sequenceColumnName:U.sequenceColumnName,positionColumns:U.positionColumns,activityCol:U.getScaledActivityColumn()}).root),!0);const q=P===u.settings,B=q?this.webLogoSelection:P instanceof w.J?P.invariantMapSelection:{},Y=P instanceof T.s?P.clusterSelection:null!==(l=null==m?void 0:m.clusterSelection)&&void 0!==l?l:{};c.addPane("Distribution",(()=>{var t;try{return(0,E.HV)(u.df,{peptideSelection:D,columns:q?null!==(t=u.settings.columns)&&void 0!==t?t:{}:P.getAggregationColumns(),activityCol:q?u.getScaledActivityColumn():P.getScaledActivityColumn(),monomerPositionSelection:B,clusterSelection:Y,clusterColName:null==m?void 0:m.clustersColumnName})}catch(t){const e=r.divText("Error in Distribution");return r.tooltip.bind(e,String(t)),e}}),!0);const W=(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 c.addPane("Selection",(()=>{var t;try{return function(t,e){var n,i;if(0===e.tableSelection.trueCount)return r.divText("No compounds selected");const o=s.DataFrame.create(t.rowCount);o.name="Selected compounds",o.filter.copyFrom(e.tableSelection);const a=g()(t.columns.numerical);let l=null;for(let t=1;t<e.gridColumns.length;t++){const r=e.gridColumns.byIndex(t);if(!r.visible)continue;const u=r.column;if(u.type===s.COLUMN_TYPE.BOOL)continue;null===l&&r.grid&&(null===(n=r.grid.sortByColumns)||void 0===n?void 0:n.length)>0&&(null===(i=r.grid.sortTypes)||void 0===i?void 0:i.length)===r.grid.sortByColumns.length&&(l={cols:r.grid.sortByColumns,types:r.grid.sortTypes});let c=null,f=null;try{c=u.getRawData(),f=u.categories}catch(t){}const h=c&&f?a.some((t=>t.name===u.name))?t=>c[t]:t=>f[c[t]]:t=>u.get(t),d=u.name===e.activityColumn.name?o.columns.addNewFloat(r.name).init((t=>h(t))):o.columns.addNewVirtual(r.name,(t=>h(t)),u.type);for(const[t,e]of u.tags)d.setTag(t,e)}const u=o.plot.grid();u.props.showRowHeader=!1,u.root.style.maxWidth="100%",s.debounce(r.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,b.zz)(u);const c=r.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 f=(0,N.Ej)(e.activityColumn,o.filter,e.positionColumns,{isFiltered:o.filter.anyTrue||o.filter.anyFalse}),h={isSelectionTable:!0,cachedWebLogoTooltip:()=>({bar:"",tooltip:null}),webLogoBounds:()=>({}),colorPalette:()=>e.colorPalette},d={x:0,y:0,monomerPosition:{},mpStats:f};return e.isAnalysis&&(0,A.FZ)(u,f,e.positionColumns,e.activityColumn,h,d),c}(u.df,{positionColumns:q?u.positionColumns:P.positionColumns,columns:q?null!==(t=u.settings.columns)&&void 0!==t?t:{}:P.getAggregationColumns(),activityColumn:q?u.getScaledActivityColumn():P.getScaledActivityColumn(),gridColumns:u.analysisView.grid.columns,colorPalette:(0,a.SM)(u.df.getCol(q?u.settings.sequenceColumnName:P.sequenceColumnName),F.Z.getSeqHelper()),tableSelection:u.getCombinedSelection(),isAnalysis:null!==u.settings&&(q||W(u.settings.columns,P.getAggregationColumns()))})}catch(t){const e=r.divText("Error in Selection");return r.tooltip.bind(e,String(t)),e}}),!0),c}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),F.Z.getSeqHelper()),webLogoBounds:()=>this.webLogoBounds,cachedWebLogoTooltip:()=>this.cachedWebLogoTooltip,highlightCallback:(t,e,n)=>{(0,b.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||(o.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),F.Z.getSeqHelper()),i=n.columns.names();if(i.every((t=>e.contains(t))))i.forEach((t=>A.rI(this.df.col(t),this.alphabet)));else for(const t of i){let i=this.df.col(t);const r=n.getCol(t);null!==i&&e.remove(t);const o=r.categories,s=r.getRawData();i=e.addNew(r.name,r.type).init((t=>o[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,b.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,r;return!(!t.isColHeader||(null===(i=t.tableColumn)||void 0===i?void 0:i.semType)!==y.uF.MONOMER)||!(!t.isTableCell||(null===(r=t.tableColumn)||void 0===r?void 0:r.semType)!==y.uF.MONOMER)}))}getCombinedSelection(){var t,e,n,i,r,o,a,l;const u=new d.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 r=i[t];void 0!==r&&u.or(r.mask)}};c(this.webLogoSelection,this.monomerPositionStats);const f=this.findViewer(G.SEQUENCE_VARIABILITY_MAP);c(null!==(t=null==f?void 0:f.invariantMapSelection)&&void 0!==t?t:{},null!==(e=null==f?void 0:f.monomerPositionStats)&&void 0!==e?e:null),((t,e)=>{var n,i;for(const[r,o]of Object.entries(t))for(const t of o){const o=null!==(i=null===(n=null==e?void 0:e.get(t))||void 0===n?void 0:n.get(r))&&void 0!==i?i:null;if(null!==o)for(const[t,e]of o.entries()){u.setTrue(t);for(const t of e)u.setTrue(t)}}})(null!==(n=null==f?void 0:f.mutationCliffsSelection)&&void 0!==n?n:{},null!==(i=null==f?void 0:f.mutationCliffs)&&void 0!==i?i:null);const h=this.findViewer(G.MOST_POTENT_RESIDUES);c(null!==(r=null==h?void 0:h.invariantMapSelection)&&void 0!==r?r:{},null!==(o=null==h?void 0:h.monomerPositionStats)&&void 0!==o?o: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;o.shell.o=t.root,n=setTimeout((()=>{o.shell.o!=t.root&&(o.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){_._package.logger.debug("Peptides: Error on selection changed"),_._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){_._package.logger.debug("Peptides: Error on filter changed"),_._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,b.qx)(this.df)}setGridProperties(t){var e,n,i,r;const o=this.analysisView.grid,s=o.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!==(r=null==t?void 0:t.showCurrentRowIndicator)&&void 0!==r&&r;const l=this.positionColumns;if(null===l)throw new Error("PeptidesError: Could not set grid properties: positionColumns are null");let u=10;const c=o.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 f=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=f.includes(e.column.name)||e.column.name===y.$2.ACTIVITY}setTimeout((()=>{for(const t of l){const e=o.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 U(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){_._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=r.iconFA("wrench",(()=>(0,x.OH)(this)),"Peptides analysis settings");this.analysisView.setRibbonPanels([[t]],!1),this.isRibbonSet=!0,this.updateGrid()}this.subs.push(o.events.onAccordionConstructed.subscribe((t=>{if(!(o.shell.o instanceof s.SemanticValue||o.shell.o instanceof s.Column&&this.df.columns.toList().includes(o.shell.o)))return;const e=t.getPane("Actions"),n=v()(e.root).find(".d4-flex-col"),a=r.label("Calculate identity");a.classList.add("d4-link-action"),r.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);f(this.df,t,t.get(this.df.currentRowIdx),i.IDENTITY,F.Z.getSeqHelper()).then((e=>e.setTag(y.gp.IDENTITY_TEMPLATE,t.get(this.df.currentRowIdx)))).catch((t=>_._package.logger.debug(t)))},n.append(r.span([a],"d4-markdown-row"));const l=r.label("Calculate similarity");l.classList.add("d4-link-action"),r.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);f(this.df,t,t.get(this.df.currentRowIdx),i.SIMILARITY,F.Z.getSeqHelper()).then((e=>e.setTag(y.gp.SIMILARITY_TEMPLATE,t.get(this.df.currentRowIdx)))).catch((t=>_._package.logger.debug(t)))},n.append(r.span([l],"d4-markdown-row"))}))),this.subs.push(o.events.onViewRemoved.subscribe((t=>{t.id===this.analysisView.id&&this.subs.forEach((t=>t.unsubscribe())),o.log.debug(`Peptides: view ${t.name} removed`)}))),this.subs.push(o.events.onTableRemoved.subscribe((t=>{t.id===this.df.id&&this.subs.forEach((t=>t.unsubscribe())),o.log.debug(`Peptides: table ${t.name} removed`)}))),this.subs.push(o.events.onProjectClosed.subscribe((t=>{t.id===o.shell.project.id&&this.subs.forEach((t=>t.unsubscribe())),o.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 U(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,b.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 U(this,void 0,void 0,(function*(){var e,n,i,r,o,a,l,u,c;const f=null!==(r=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!==r?r:null===(o=this._sequenceSpaceCols)||void 0===o?void 0:o.find((t=>t.toLowerCase().startsWith("cluster")));null!=t||(t={activityColumnName:this.settings.activityColumnName,clusterColumnName:null!=f?f: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 h=yield this.df.plot.fromType(G.CLUSTER_MAX_ACTIVITY,t),d=null!==(c=this.findViewerNode(G.LOGO_SUMMARY_TABLE))&&void 0!==c?c:null;this.analysisView.dockManager.dock(h,d?s.DOCK_TYPE.DOWN:s.DOCK_TYPE.RIGHT,d,G.CLUSTER_MAX_ACTIVITY)}))}addMonomerPosition(t){return U(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,b.Lv)()&&this.analysisView.addViewer(e);const n=this.findViewer(G.MOST_POTENT_RESIDUES),i=this.analysisView.dockManager,[r,o,a]=null===n?[s.DOCK_TYPE.DOWN,null,void 0]:[s.DOCK_TYPE.LEFT,this.findViewerNode(G.MOST_POTENT_RESIDUES),.7];i.dock(e,r,o,G.SEQUENCE_VARIABILITY_MAP,a)}))}addMostPotentResidues(t){return U(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,b.Lv)()&&this.analysisView.addViewer(e);const n=this.findViewer(G.SEQUENCE_VARIABILITY_MAP),i=this.analysisView.dockManager,[r,o,a]=null===n?[s.DOCK_TYPE.DOWN,null,void 0]:[s.DOCK_TYPE.RIGHT,this.findViewerNode(G.SEQUENCE_VARIABILITY_MAP),.3];i.dock(e,r,o,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=o.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 U(this,void 0,void 0,(function*(){var t,e;if(!this._sequenceSpaceCols||0===this._sequenceSpaceCols.length)return void o.shell.warning("Embeddings columns are not initialized");const i=this._sequenceSpaceCols.filter((t=>t.toLowerCase().startsWith("embed_")));if(2!==i.length)return void o.shell.warning(`Found ${i.length} embeddings columns, expected 2`);const r=this._sequenceSpaceCols.filter((t=>t.toLowerCase().startsWith("cluster")));r.length>0&&this.df.columns.remove(r[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,r){return o=this,s=void 0,l=function*(){return new Promise((function(o,s){const a=new Worker(new URL(n.p+n.u(682),n.b));a.postMessage({embedX:t,embedY:e,minPts:r,epsilon:i}),a.onmessage=({data:{error:t,clusters:e}})=>{a.terminate(),t?s(t):o(e)}}))},new((a=void 0)||(a=Promise))((function(t,e){function n(t){try{r(l.next(t))}catch(t){e(t)}}function i(t){try{r(l.throw(t))}catch(t){e(t)}}function r(e){var r;e.done?t(e.value):(r=e.value,r instanceof a?r:new a((function(t){t(r)}))).then(n,i)}r((l=l.apply(o,s||[])).next())}));var o,s,a,l}(s,a,l,u),f=this.df.columns.getUnusedName("Cluster (DBSCAN)"),h=this.df.columns.addNewString(f);h.init((t=>c[t].toString())),null!==this._sequenceSpaceViewer&&(this._sequenceSpaceViewer.props.colorColumnName=h.name),this._sequenceSpaceCols=[i[0],i[1],h.name];const d=this.analysisView.grid.col(h.name);d&&(d.visible=!1)}))}addMCLClusters(){return U(this,void 0,void 0,(function*(){var t,e,n,i,r;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=(r=this.settings).mclSettings)&&void 0!==n||(r.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()})),f=o.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)}))}f.unsubscribe()}}catch(t){console.error(t)}})),h=JSON.stringify({cols:[a].map((t=>t.name)),metrics:[l.distanceF],weights:[1],aggregationMethod:V.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}),d=null!==(i=this.analysisView)&&void 0!==i?i:o.shell.getTableView(this.df.name);if(d){const t=s.Func.find({package:"EDA",name:"markovClusteringViewer"})[0];if(!t)throw new Error("Markov clustering function is not found");yield t.apply(),d.addViewer(G.MCL,{mclProps:h}),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 U(this,arguments,void 0,(function*(t={}){var e,n,i,r;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=F.Z.getSeqHelper().getSeqHandler(l);if(u.isHelm())try{o.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 o.shell.error("Error on converting HELM notation to linear notation"),void o.shell.error(t)}const c=!t.clusterCol&&!!t.clusterEmbeddings,f=null!==(r=null===(i=this.settings)||void 0===i?void 0:i.sequenceSpaceParams)&&void 0!==r?r:new C.GI(c);f.clusterEmbeddings=c;const d={table:this.df,molecules:l,methodName:h.UMAP,similarityMetric:f.distanceF,plotEmbeddings:!0,options:{bypassLargeDataWarning:!0,dbScanEpsilon:f.epsilon,dbScanMinPts:f.minPts,randomSeed:"1",preprocessingFuncArgs:{gapOpen:f.gapOpen,gapExtend:f.gapExtend,fingerprintType:f.fingerprintType}},clusterEmbeddings:f.clusterEmbeddings};let m=0;const g=f.clusterEmbeddings?3:2,p=this.df.onColumnsAdded.subscribe((t=>{for(const e of t.columns)if(e.name.toLowerCase().startsWith("embed_")||f.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=o.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 o.functions.call("Bio:sequenceSpaceTopMenu",d);v.unsubscribe(),y instanceof s.ScatterPlotViewer&&(f.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){}})))}))}}H.modelName="peptidesModel"},6920:(t,e,n)=>{"use strict";n.r(e),n.d(e,{Peptides:()=>K,_package:()=>Y,clusterMaxActivity:()=>nt,getMonomerWorksInstance:()=>W,getTreeHelperInstance:()=>j,initPeptides:()=>$,logoSummaryTable:()=>et,lstPiechartCellRenderer:()=>ot,macromoleculeSarFastaDemo:()=>rt,manualAlignment:()=>it,monomerPosition:()=>J,mostPotentResidues:()=>tt,peptidesDialog:()=>Q,peptidesPanel:()=>X,testInitFunctionPeptides:()=>Z});var i=n(4328),r=n(7389),o=n(6082),s=n(5082),a=n(7233),l=n.n(a),u=(n(4788),n(768)),c=n(726),f=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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())}))},h=n(3541),d=n(5480);n(3981);class m{constructor(t){this.monomerLib=t}getCappedRotatedMonomer(t,e){const n=this.monomerLib.getMonomer(t,e);return n?n.molfile:null}}var g=n(4139),p=n(8608),v=n(2003),y=n(8070),C=n(115),b=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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())}))},w=n(5072),A=n.n(w),S=n(7825),E=n.n(S),T=n(7659),x=n.n(T),_=n(5056),N=n.n(_),M=n(540),I=n.n(M),O=n(1113),L=n.n(O),R=n(6677),P={};P.styleTagTransform=L(),P.setAttributes=N(),P.insert=x().bind(null,"head"),P.domAPI=E(),P.insertStyleElement=I(),A()(R.A,P),R.A&&R.A.locals&&R.A.locals;var k;!function(t){let e,n;!function(t){t.vert=function(t){return r.divV(t.map((t=>r.render(t))),{classes:"u2-panel"})},t.horz=function(t){return r.divH(t.map((t=>r.render(t))),{classes:"u2-panel"})}}(e=t.panels||(t.panels={})),t.appHeader=function(t){const n=r.iconImage("",t.iconPath);return l()(n).addClass("ui-app-header-icon").css("margin-right","20px"),e.horz([n,e.vert([r.markdown(t.description),t.learnMoreUrl?r.link("Learn more",t.learnMoreUrl):null])])},function(t){t.runAsync=function(t,e){return n=this,o=void 0,a=function*(){r.setUpdateIndicator(t,!0);try{return yield e()}catch(t){i.log.error(t)}finally{r.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 r(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,r)}l((a=a.apply(n,o||[])).next())}));var n,o,s,a}}(n=t.tools||(t.tools={}))}(k||(k={}));var V=n(144),D=n.n(V);const G=rxjs.operators;class F extends o.JsViewer{get scViewer(){return this._scViewer||(this._scViewer=this.createSCViewer()),this._scViewer}constructor(){super(),this._titleHost=r.divText(u.q.CLUSTER_MAX_ACTIVITY,{id:"pep-viewer-title",style:{marginRight:"auto"}}),this._selsectIcon=r.div(),this.activityTarget=g.wf.HIGH,this.viewerError="",this.renderTimeout=null,this.renderDebounceTime=500,this.scFilterQuery=`\${${F.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",g.wf.HIGH,{choices:[g.wf.HIGH,g.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:o.AxisType.logarithmic,yAxisType:o.AxisType.logarithmic,invertYAxis:this.activityTarget===g.wf.LOW,xColumnName:F.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(![o.COLUMN_TYPE.FLOAT,o.COLUMN_TYPE.INT,o.COLUMN_TYPE.BIG_INT,o.COLUMN_TYPE.QNUM].includes(n.type))return this.viewerError="Activity column should be numeric",null;const a=this.dataFrame.columns.getOrCreate(F.clusterSizeColName,o.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=o.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 r=n.get(t),o=u[e];if((null==o||null==o||r>n.get(o)&&this.activityTarget===g.wf.HIGH||r<n.get(o)&&this.activityTarget===g.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 f=this.dataFrame.columns.getOrCreate(F.maxActivityInClusterColName,o.COLUMN_TYPE.INT);f.init((t=>i.isNone(t)?0:t===u[i.get(t)]?1:0)),this.dataFrame.columns.getOrCreate(F.maxConnectivityInClusterColName,o.COLUMN_TYPE.INT).init((t=>i.isNone(t)?0:t===c[i.get(t)]?1:0)),this.dataFrame.columns.getOrCreate(F.synSelectionColName,o.TYPE.STRING).init((t=>{if(i.isNone(t))return null;let e=null;return t===u[i.get(t)]&&(e=F.maxActivityLabel),s&&t===c[i.get(t)]&&(e=e?`${e}, ${F.maxConnectivityLabel}`:F.maxConnectivityLabel),e})),e.xColumnName=F.clusterSizeColName,e.yColumnName=this.activityColumnName,e.filter=this.scFilterQuery,this.viewerError="";const h=o.Viewer.scatterPlot(this.dataFrame,e);this.selectionSubscription&&this.selectionSubscription.unsubscribe(),this.selectionSubscription=h.onDataEvent.pipe((0,G.filter)((t=>"d4-select"==t.type))).subscribe((t=>{var e,n;const r=null!==(n=null===(e=t.bitset)||void 0===e?void 0:e.getSelectedIndexes())&&void 0!==n?n:[],s=this.dataFrame.selection,a=o.BitSet.create(this.dataFrame.rowCount,(t=>1==f.get(t)));a.and(s);for(let t=0;t<r.length;t++){const e=r[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 d=()=>{const t=o.BitSet.create(this.dataFrame.rowCount);Object.entries(u).forEach((([e,i])=>{var r;if(null==e||null==i)return;const o=parseInt(e),s=n.get(i),a=null!==(r=l[o])&&void 0!==r?r:l[e];s<this.activityThreshold&&a<this.clusterSizeThreshold||(t.set(i,!0,!1),null!=c[o]&&t.set(c[o],!0,!1))})),t.fireChanged(),this.dataFrame.selection.copyFrom(t,!0)};return this._selsectIcon=r.iconSvg("select-all",(()=>{d()}),"Select 3 Active quadrants"),this._selsectIcon.style.cursor="pointer",this._selsectIcon.style.marginRight="5px",d(),this.linesDrawSubscription&&this.linesDrawSubscription.unsubscribe(),this.linesDrawSubscription=h.onBeforeDrawScene.subscribe((()=>{const t=h.getInfo().canvas.getContext("2d"),e=h.viewport,n=h.worldToScreen(e.x,this.activityThreshold),i=h.worldToScreen(this.clusterSizeThreshold,e.y),r=h.worldToScreen(e.x+e.width,this.activityThreshold),o=h.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(r.x,r.y),t.moveTo(i.x,i.y),t.lineTo(o.x,o.y),t.stroke(),t.closePath()})),h}onTableAttached(){var t,e,n,i,r,o,s,a,l,u,c,f;super.onTableAttached();const h=null!==(e=null===(t=this.dataFrame)||void 0===t?void 0:t.col(g.$2.ACTIVITY))&&void 0!==e?e:null===(i=D()(null===(n=this.dataFrame)||void 0===n?void 0:n.columns.numerical).next())||void 0===i?void 0:i.value;null!=h&&(null===(r=this.getProperty(`activity${g.To}`))||void 0===r||r.set(this,h.name));const d=null===(s=D()(null===(o=this.dataFrame)||void 0===o?void 0:o.columns.categorical).next())||void 0===s?void 0:s.value;null!=d&&(null===(a=this.getProperty(`cluster${g.To}`))||void 0===a||a.set(this,d.name));const m=null===(u=D()(null===(l=this.dataFrame)||void 0===l?void 0:l.columns.numerical).next())||void 0===u?void 0:u.value;null!=m&&(null===(c=this.getProperty(`connectivity${g.To}`))||void 0===c||c.set(this,m.name)),this.render(),null===(f=this.dataFrame)||void 0===f||f.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(r.divText(null!==(t=this.viewerError)&&void 0!==t?t:"Error creating scatter plot"));const i=r.div("Cluster Size",{style:{alignSelf:"center",color:"var(--grey-6)",marginBottom:"5px"}}),o=r.div(this.activityTarget===g.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(r.divH([o,r.divV([r.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${g.To}`&&(this._scViewer=null),this.render()}}F.clusterSizeColName="~cluster.size",F.maxActivityInClusterColName="~max.activity.for.cluster",F.maxConnectivityInClusterColName="~max.connectivity.for.cluster",F.synSelectionColName="Syn Selection",F.maxActivityLabel="Max Activity",F.maxConnectivityLabel="Max Connectivity";var U=n(3163),H=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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 q,B=null;const Y=new o.Package;function W(){return B}function j(){return q}function $(){return H(this,void 0,void 0,(function*(){try{null!=B||(B=new m(yield i.functions.call("Bio:getBioLib"))),null!=q||(q=yield async function(){const t="Dendrogram",e=o.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)}}))}function z(t){return H(this,void 0,void 0,(function*(){const e=o.TaskBarProgressIndicator.create("Loading Peptides"),n=Y.webRoot+"files/"+t,r=yield i.data.loadTable(n);r.name="Peptides",i.shell.addTableView(r).name="PeptidesView",i.shell.windows.showProperties=!0,e.close()}))}function K(){const t=k.appHeader({iconPath:Y.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=o.View.create();return n.name="Peptides",r.appendAll(n.root,[t,r.divH([r.button("Simple demo",(()=>z("aligned.csv")),""),r.button("Complex demo",(()=>z("aligned_2.csv")),""),r.button("HELM demo",(()=>z("aligned_3.csv")),"")])]),n}function Q(){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(!o.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=r.dialog("Analyze Peptides").add(e.host).onOK((()=>H(this,void 0,void 0,(function*(){e.callback()||n.show()}))));return n.show()}function Z(t){return H(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)))}))}function X(t){if(!t.dataFrame||!o.Utils.firstOrNull(t.dataFrame.columns.numerical))return new o.Widget(r.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 o.Widget(e.host)}function J(){return new h.J}function tt(){return new h.UJ}function et(){return new d.s}function nt(){return new F}function it(t){const e=i.shell.t,n=null==e?void 0:e.temp[u.i.modelName];return n?function(t,e){const n=r.input.textArea("",{value:t.get(e.currentRowIdx)});l()(n.root).addClass("pep-textinput");const s=r.button("Apply",(()=>f(this,void 0,void 0,(function*(){const r=c.Z.getSeqHelper().getSeqHandler(t),o=n.value,s=r.splitter(o),a=e.currentRowIdx;t.set(a,o);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)}))),"Apply changes"),a=r.button(r.iconFA("redo"),(()=>n.value=t.get(e.currentRowIdx)),"Reset");return l()(a).addClass("pep-snippet-editor-icon pep-reset-icon"),new o.Widget(r.divV([a,n.root,s],"pep-textarea-box"))}(e.getCol(n.settings.sequenceColumnName),e):new o.Widget(r.divText("Manual alignment works with peptides analysis"))}function rt(){return H(this,void 0,void 0,(function*(){return yield function(){return b(this,void 0,void 0,(function*(){i.shell.windows.showContextPanel=!0;const t=o.DataFrame.fromCsv(yield Y.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,y.cb)(50);const n=e.grid;yield new Promise((t=>{var e;let i=null;const r=null===(e=null==n?void 0:n.onAfterDrawContent)||void 0===e?void 0:e.subscribe((()=>{i&&clearTimeout(i),r.unsubscribe(),t(void 0)}));i=setTimeout((()=>{r.unsubscribe(),t(void 0)}),3e3)}));const r=t.getCol("IC50"),a=t.getCol("AlignedSequence");a.semType=o.SEMTYPE.MACROMOLECULE,a.setTag(g.gp.ALPHABET,v.YI.PT),a.meta.units=v.Hi.FASTA,a.setTag(v.gp.aligned,"SEQ.MSA");const l=(0,p.Y1)(r,g.rg.MINUS_LG),u=new C.av;u.threshold=94,yield(0,s.n)(r,a,null,t,l,g.rg.MINUS_LG,{addMCL:!0,useEmbeddingsClusters:!0,mclSettings:u})}))}()}))}function ot(){return new U.DX}},726:(t,e,n)=>{"use strict";n.d(e,{Z:()=>s});var i=n(8223),r=n(6082),o=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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 o(this,void 0,void 0,(function*(){var t;null!==(t=this._secHelper)&&void 0!==t||(this._secHelper=yield async function(){const t=r.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 o(this,void 0,void 0,(function*(){yield this.loadSeqHelper(),yield this.loadMonomerLib()}))}static loadMonomerLib(){return o(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:()=>f,eW:()=>m,Ej:()=>h,uz:()=>c});var i=n(6082),r=n(4139);class o{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,o=function*(t,e,n={}){var i,r,o;const s=new Map;try{const a=null!==(r=null===(i=n.targetCol)||void 0===i?void 0:i.cat.indexOf(n.currentTarget))&&void 0!==r?r:-1,l=t.length,u=new Array(this._workerCount),c=l*(l-1)/2;this._workerCount=Math.min(this._workerCount,c);const f=c/this._workerCount;e.forEach((t=>{var e;t.cat=null===(e=t.cat)||void 0===e?void 0:e.slice()})),(null===(o=n.targetCol)||void 0===o?void 0:o.cat)&&(n.targetCol.cat=n.targetCol.cat.slice());for(let i=0;i<this._workerCount;i++)u[i]=new Promise(((r,o)=>{const s=Math.floor(i*f),l=i===this._workerCount-1?c:Math.floor((i+1)*f);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(),o(s)):(this._workers[i].terminate(),r({pos:t,seq1Idxs:e,seq2Idxs:n}))}}));const h=yield Promise.all(u),d=new Map;e.forEach(((t,e)=>{d.set(t.name,e)})),h.filter(Boolean).forEach((t=>{for(let n=0;n<t.pos.length;n++){const i=d.get(t.pos[n]),r=e[i].rawData[t.seq1Idxs[n]],o=e[i].cat[r],a=e[i].rawData[t.seq2Idxs[n]],l=e[i].cat[a];s.has(o)||s.set(o,new Map),s.has(l)||s.set(l,new Map);const u=s.get(o),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 f=u.get(t.pos[n]),h=c.get(t.pos[n]);f.has(t.seq1Idxs[n])||f.set(t.seq1Idxs[n],[]),h.has(t.seq2Idxs[n])||h.set(t.seq2Idxs[n],[]);const m=f.get(t.seq1Idxs[n]),g=h.get(t.seq2Idxs[n]);m.push(t.seq2Idxs[n]),g.push(t.seq1Idxs[n])}}))}catch(t){this.terminate(),console.error(t)}return s},new((r=void 0)||(r=Promise))((function(t,e){function s(t){try{l(o.next(t))}catch(t){e(t)}}function a(t){try{l(o.throw(t))}catch(t){e(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(s,a)}l((o=o.apply(n,i||[])).next())}));var n,i,r,o}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(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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 '${r.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 o,l=yield a.calc(t,e,n);return a.terminate(),l}))}function f(t,e){const n=new Map;let i=999999,r=-999999,o=2,s=2;for(const u of t.keys()){const c=new Map;n.set(u,c);const f=t.get(u);for(const t of f.keys()){const n=f.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 h=(0,l.GT)(e,u);i=Math.min(i,h.meanDifference),r=Math.max(r,h.meanDifference),o=Math.min(o,h.count),s=Math.max(s,h.count),c.set(t,h)}}return{stats:n,minDiff:i,maxDiff:r,minCount:o,maxCount:s}}function h(t,e,n,r={}){var o,s,u,c,f,h;null!==(o=r.isFiltered)&&void 0!==o||(r.isFiltered=!1);const m={general:{}};let g=t.getRawData(),p=t.length;if(r.isFiltered){p=e.trueCount;const t=new Float64Array(p),o=e.getSelectedIndexes();for(let e=0;e<p;++e)t[e]=g[o[e]];g=t,n=i.DataFrame.fromColumns(n).clone(e).columns.toList(),r.target&&(r.target.col=r.target.col.clone(e)),r.aggValue&&(r.aggValue.col=r.aggValue.col.clone(e))}null!==(s=r.columns)&&void 0!==s||(r.columns=n.map((t=>t.name)));const v=null===(c=null===(u=r.target)||void 0===u?void 0:u.col)||void 0===c?void 0:c.getRawData(),y=null===(f=r.target)||void 0===f?void 0:f.col.categories,C=(null===(h=r.target)||void 0===h?void 0:h.cat)?null==y?void 0:y.indexOf(r.target.cat):-1;for(const t of n){if(!r.columns.includes(t.name))continue;const e=t.getRawData(),n=t.categories,i={general:{}};for(let t=0;t<n.length;++t){const o=n[t];if(""===o)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,r.aggValue);i[o]=c,d(i.general,c)}m[t.name]=i,d(m.general,null,i.general)}return m}function d(t,e=null,n=null){var i,r,o,s,a,l,u,c,f,h,d,m,g,p,v,y,C;if(null===e&&null===n)throw new Error("MonomerPositionStatsError: either stats or summaryStats must be present");const b=null!==(i=null==e?void 0:e.count)&&void 0!==i?i:n.maxCount;null!==(r=t.maxCount)&&void 0!==r||(t.maxCount=b),t.maxCount<b&&(t.maxCount=b);const w=null!==(o=null==e?void 0:e.count)&&void 0!==o?o:n.minCount;null!==(s=t.minCount)&&void 0!==s||(t.minCount=w),t.minCount>w&&(t.minCount=w);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!==(f=null==e?void 0:e.pValue)&&void 0!==f?f:NaN)){const i=null!==(h=null==e?void 0:e.pValue)&&void 0!==h?h:n.maxPValue;null!==(d=t.maxPValue)&&void 0!==d||(t.maxPValue=i),t.maxPValue<i&&(t.maxPValue=i);const r=null!==(m=null==e?void 0:e.pValue)&&void 0!==m?m:n.minPValue;null!==(g=t.minPValue)&&void 0!==g||(t.minPValue=r),t.minPValue>r&&(t.minPValue=r)}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 r=t.rowCount,o=t.getCol(e),u=o.getRawData(),c=o.categories,f=Array.from({length:c.length},(()=>new a.A(r,!1)));for(let t=0;t<r;++t)f[u[t]].setTrue(t);const h=n.map((t=>a.A.fromUint32Array(r,t.getRawData()))),d=n.map((t=>t.name)),m=i.getRawData(),g={},p={};for(const t of Object.values(s.W)){const e=t===s.W.ORIGINAL?f:h,n=t===s.W.ORIGINAL?c:d,r=t===s.W.ORIGINAL?g:p;for(let t=0;t<e.length;++t){const o=e[t];r[n[t]]=o.allTrue||o.allFalse?{count:o.length,meanDifference:0,ratio:1,pValue:null,mask:o,mean:i.stats.avg}:(0,l.GT)(m,o)}}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:()=>b,k8:()=>w,Yd:()=>C,rI:()=>y,FZ:()=>A});var i=n(7389),r=n(6082),o=n(4139),s=n(2003),a=n(3657);const l=rxjs;var u,c,f,h=n(912),d=n(5480),m=n(3541);n(9634),function(t){t.maxMonomerLength=".mm.cellRenderer.maxMonomerLength"}(u||(u={})),function(t){t.applyToBackground=".m.cellRenderer.applyToBackground"}(c||(c={})),function(t){t.MSA="MSA",t.classic="classic"}(f||(f={})),new class{constructor(){this.color="rgb(100,100,100)",this.pivot=0,this.left=!1,this.transparencyRate=1,this.separator="",this.last=!1,this.drawStyle=f.classic,this.maxWord=[],this.wordIdx=0,this.gridCell=null,this.referenceSequence=null,this.maxLengthOfMonomer=null,this.monomerTextSizeMap={},this.logger=void 0}};var g=n(726),p=n(3981);function v(t,e){t.strokeStyle=r.Color.toHtml(r.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=o.uF.MONOMER,t.setTag(r.TAGS.CELL_RENDERER,o.uF.MONOMER),t.setTag(o.gp.ALPHABET,e),n&&t.setTag(c.applyToBackground,"true")}function C(t,e,n,i,o){var s,a,l,u,c,f,h,d,g,p,y,C;const b=o.width/2,w=Math.ceil(o.x+1+b),A=Math.ceil(o.y+1+o.height/2),S=Math.min(.9*b/2,.9*o.height/2);if(i instanceof m.UJ){const o=i.monomerPositionStats[n],s=o[e].pValue,a=o[e].meanDifference,l=1-o.general.maxPValue,u=1-o.general.minPValue,c=Math.min(l,u),f=l-c,h=u-c,d=Math.max(f,h),m=null===s?0:1-s-c,g=a>=0?m:-m,p=r.Color.toHtml(null===s?r.Color.lightLightGray:r.Color.scaleColor(g,-d,d,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(w-b/2,A,C<3||null===s?3:C,0,2*Math.PI,!0),t.closePath(),t.fill()}else if(i instanceof m.J&&i.mutationCliffs&&i.cliffStats){const o=i.cliffStats.maxCount,u=i.cliffStats.minDiff,c=i.cliffStats.maxDiff,f=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(f){const e=f.count,n=f.meanDifference,i=Math.floor(Math.abs(e/Math.max(o,2))*S),s=Math.max(Math.abs(u),Math.abs(c)),a=r.Color.toHtml(null===n?r.Color.lightLightGray:r.Color.scaleColor(n,-s,s,255));t.beginPath(),t.fillStyle=a,t.arc(w-b/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=r.Color.toHtml(r.Color.white),i instanceof m.J){let r=0;const o=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!==o)for(const[t,e]of o)r+=null!==(d=e.length)&&void 0!==d?d:0;0!==r&&t.fillText(r.toString(),w+b-5,A,b-5)}else if(i instanceof m.UJ){const r=null!==(g=i.monomerPositionStats)&&void 0!==g?g:null===(p=null==i?void 0:i.model)||void 0===p?void 0:p.monomerPositionStats,o=null===(C=null===(y=null==r?void 0:r[n])||void 0===y?void 0:y[e])||void 0===C?void 0:C.count;o&&t.fillText(o.toString(),w+b-5,A,b-5)}if(i instanceof m.J){const r=i.mutationCliffsSelection[n];r&&r.includes(e)&&v(t,o)}else if(i instanceof m.UJ){const r=i.invariantMapSelection[n];r&&r.includes(e)&&v(t,o)}}function b(t,e,n,i,o,s,a){a=r.Color.fromHtml(r.Color.toHtml(function(t,e){return(16777215&t|255<<24)>>>0}(a)));let l=o.toFixed(2);l.endsWith(".00")&&(l=o.toFixed(0)),l.endsWith("0")&&l.includes(".")&&(l=o.toFixed(1));const u=Math.min(13,Math.floor(s.width/40/l.length*6*13));t.fillStyle=r.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=r.Color.toHtml(r.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 w(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[d.W.CUSTOM].includes(e)||n[d.W.ORIGINAL].includes(e))&&v(t,i)}function A(t,e,n,u,c,f={x:0,y:0,mpStats:{},monomerPosition:{}}){var d;if(null!==(d=c.isSelectionTable)&&void 0!==d||(c.isSelectionTable=!1),0==Object.keys(f.mpStats).length&&(f.mpStats=e),c.isSelectionTable&&(!c.webLogoBounds||!c.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;const l=t.g,f=t.bounds,h=t.cell.tableColumn;l.save();try{if(l.beginPath(),l.clearRect(f.x,f.y,f.width,f.height),l.rect(f.x,f.y,f.width,f.height),l.clip(),t.cell.isColHeader&&(null==h?void 0:h.semType)===o.uF.MONOMER){let d;if(m.filter.anyFalse){const t=null!==(i=m.temp[o.gp.M_P_STATS_CACHE])&&void 0!==i?i:{},e=null==t?void 0:t[h.name],r=m.filter.getBuffer();if(t&&e&&e.filter.length===r.length&&e.filter.every(((t,e)=>t===r[e])))d=e.stats[h.name];else{const e=(0,a.Ej)(u,m.filter,n,{isFiltered:!0,columns:[h.name]});d=e[h.name],t[h.name]={filter:m.filter.getBuffer(),stats:e,selection:m.selection.getBuffer()}}m.temp[o.gp.M_P_STATS_CACHE]=t}else d=c.isSelectionTable?(0,a.Ej)(u,m.filter,n,{isFiltered:!0,columns:[h.name]})[h.name]:e[h.name];if(!d)return;const v=Object.keys(d).sort(((t,e)=>""===t||"-"===t?1:""===e||"-"===e?-1:0)).filter((t=>"general"!==t));c.webLogoBounds()[h.name]=function(t,e,n,i,o,a,l,u={},c={}){var f,h,d,m,v,y,C,b,w;const A=window.devicePixelRatio;null!==(f=c.symbolStyle)&&void 0!==f||(c.symbolStyle="16px Roboto, Roboto Local, sans-serif"),null!==(h=c.upperLetterHeight)&&void 0!==h||(c.upperLetterHeight=12.2),null!==(d=c.upperLetterAscent)&&void 0!==d||(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!==(b=c.headerStyle)&&void 0!==b||(c.headerStyle=`bold ${c.textHeight*A}px Roboto, Roboto Local, sans-serif`);const S=(o.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,_=Math.max(c.selectionWidth*A,.05*e.width*A),N=2*c.marginHorizontal+c.selectionWidth,M=(e.width-(N+c.marginHorizontal))*A,I=(e.x+N)*A,O=g.Z.getMonomerLib(),L={};for(const e of o){const i=T*(n[e].count/a),o=T*((null!==(w=u[e])&&void 0!==w?w:0)/a);if(L[e]=new r.Rect(I/A,E/A,M/A,i/A),t.resetTransform(),"-"!==e&&""!==e){const n=(0,s.zS)(e,5),a=t.measureText(n);o>0&&(t.lineWidth=_,t.line(x,E,x,E+o,r.Color.rowSelection));const l=O.getMonomerTextColor(p.o.AA,e);t.fillStyle=l,t.textAlign="left",t.textBaseline="top",t.font=c.symbolStyle;const u=M/a.width,f=i/c.upperLetterHeight;t.setTransform(u,0,0,f,I,E),t.fillText(n,0,0,a.width)}E+=i+c.upperLetterAscent*A}return t.resetTransform(),t.fillStyle=r.Color.toHtml(r.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}(l,f,d,h.name,v,m.filter.trueCount,c.colorPalette(),c.headerSelectedMonomers?c.headerSelectedMonomers()[h.name]:{}),t.preventDefault()}}catch(t){console.warn(`PeptidesHeaderLogoError: couldn't render WebLogo for column \`${h.name}\`. See original error below.`),console.warn(t)}finally{l.restore()}})(t)));const v=n=>{var r;const s=t.hitTest(n.offsetX,n.offsetY);if((null==s?void 0:s.isColHeader)&&(null===(r=s.tableColumn)||void 0===r?void 0:r.semType)===o.uF.MONOMER){const t=function(t,e,n){const i=n[t.tableColumn.name];if(!i)return null;for(const[n,r]of Object.entries(i)){const i=e.offsetX>=r.x&&e.offsetX<=r.x+r.width,o=e.offsetY>=r.y&&e.offsetY<=r.y+r.height;if(i&&o)return{monomerOrCluster:n,positionOrClusterType:t.tableColumn.name}}return null}(s,n,c.webLogoBounds());if(null===t)return void(c.isSelectionTable||null==c.unhighlightCallback||c.unhighlightCallback());f.monomerPosition=t,function(t,e,n,r,o,s){if("click"!==t.type||o.isSelectionTable||null==o.selectionCallback){const a=`${e.positionOrClusterType} = ${e.monomerOrCluster}`;o.cachedWebLogoTooltip().bar===a?i.tooltip.show(o.cachedWebLogoTooltip().tooltip,t.clientX,t.clientY):(o.cachedWebLogoTooltip().bar=a,s.x=t.clientX,s.y=t.clientY,s.monomerPosition=e,o.cachedWebLogoTooltip().tooltip=(0,h.Y)(n,r,[],s))}else o.selectionCallback(e,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey})}(n,t,m,u,c,f),c.isSelectionTable||null==c.highlightCallback||c.highlightCallback(t,m,e)}else null!=c.unhighlightCallback&&c.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!=c.unhighlightCallback&&c.unhighlightCallback()}))}class S extends r.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),r=()=>{t.cell.column.temp[this.HoverTempKey]=null,i.tooltip.hide(),null!==n&&t.grid.invalidate()},o=t.cell.value;if(!o)return void r();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 r();let f;try{f=JSON.parse(o)}catch(e){return void r()}const h=new Float64Array(Object.keys(f).length+1),d=Object.values(f).reduce(((t,e)=>t+e),0);h[Object.keys(f).length]=2*Math.PI;let m=0,g=0;for(const t of Object.values(f))h[g++]=m,m+=2*Math.PI*t/d;let p=-1;for(let t=0;t<h.length-1;t++)if(c>=h[t]&&c<h[t+1]){p=t;break}if(-1===p)return void r();const v=Object.keys(f)[p],y=f[v],C=(y/d*100).toFixed(2);i.tooltip.show(i.h1(`${v}: ${y} (${C}%)`),e.x+16,e.y+16);const b=t.cell.rowIndex.toString()+this.hoverSeparator+v;t.cell.column.temp[this.HoverTempKey]=b,n!==b&&t.grid.invalidate()}render(t,e,n,i,o,s,a){const l=s.cell.dataFrame,u=new r.Rect(e,n,i,o).fitSquare().inflate(-2,-2);if(i<5||o<5||!l)return;const c=s.cell.value;if(t.clearRect(e,n,i,o),!c)return;let f;try{f=JSON.parse(c)}catch(t){return}const h=Object.values(f).reduce(((t,e)=>t+e),0);let d=0;const m=Object.fromEntries(Object.keys(f).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(f))m[t]=100;m[e]=255}}const p=Math.min(i,o)/2.2;for(const[e,n]of Object.entries(f)){const i=2*Math.PI*n/h;t.beginPath(),t.moveTo(u.midX,u.midY),t.arc(u.midX,u.midY,p,d,d+i),d+=i;const o=this.categoryNumberCache(s.cell.column);o[e]||(o[e]=Object.keys(o).length,s.cell.column.temp[this.colorCacheKey]=o),t.fillStyle=r.Color.toHtml(r.Color.setAlpha(r.Color.getCategoricalColor(o[e]),m[e])),t.fill(),t.strokeStyle=r.Color.toRgb(r.Color.lightGray),t.stroke();const a=e;t.fillStyle=r.Color.toRgb(r.Color.white),t.font="9px Arial";const l=t.measureText(a).width,c=d-i/2;for(let e=.8;e>=.4;e-=.05){const n=p*e,r=u.midX+Math.cos(c)*n,o=u.midY+Math.sin(c)*n;if([[r-l/2-2,o],[r+l/2+2,o]].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),r=n<0?n+2*Math.PI:n;return e<p-2&&r>d-i&&r<d}))){t.fillText(a,r,o);break}}}}}},4139:(t,e,n)=>{"use strict";n.d(e,{$2:()=>i,To:()=>l,V5:()=>h,YX:()=>f,gp:()=>o,i6:()=>r,rg:()=>u,uF:()=>s,wf:()=>c,zW:()=>d});var i,r,o,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"}(r||(r={})),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"}(o||(o={})),function(t){t.MONOMER="Monomer",t.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference"}(s||(s={}));const l="ColumnName";var u,c,f;!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-"}(f||(f={}));const h=Object.values(a.AGG).filter((t=>![a.AGG.FIRST,a.AGG.KEY,a.AGG.PIVOT,a.AGG.SELECTED_ROWS_COUNT].includes(t))),d={[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:()=>h,B2:()=>M,BE:()=>C,CD:()=>w,F2:()=>p,FZ:()=>v,KT:()=>T,Lv:()=>O,Y1:()=>d,ZR:()=>E,dl:()=>S,eY:()=>g,qI:()=>_,qx:()=>m,sg:()=>I,vW:()=>A,vY:()=>b,zm:()=>N,zz:()=>y});var i,r=n(7389),o=n(6082),s=n(4328),a=n(4139),l=n(8774),u=n(144),c=n.n(u),f=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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 h(t){var e;return null!==(e=t.getTag(a.gp.SEPARATOR))&&void 0!==e?e:""}function d(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(),r=o.Column.float(a.$2.ACTIVITY,t.length).init((t=>{const e=i[t];return e===o.FLOAT_NULL||e===o.INT_NULL?e:n(e)}));return r.setTag(a.gp.ANALYSIS_COL,"true"),r.setTag(o.TAGS.FORMULA,e),r}function m(t){var e,n,i,r;const o=t.columns.bySemTypeAll(a.uF.MONOMER),s={},l=t.filter.clone().and(t.selection).getSelectedIndexes();for(const t of l)for(const a of o){const o=a.get(t);o&&(null!==(e=s[i=a.name])&&void 0!==e||(s[i]={}),null!==(n=(r=s[a.name])[o])&&void 0!==n||(r[o]=0),s[a.name][o]+=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,f=l.getRawData();for(let t=0;t<c.length;++t){if(!Object.values(i).includes(c[t]))continue;const e=o.Color.toHtml(l.meta.colors.getColor(f.indexOf(t))),a=r.label(null!==(s=n[c[t]])&&void 0!==s?s:c[t],{style:{color:e}});u.push(a)}const h=r.divV([r.divV(u),t.root,r.tableFromMap(e)]);return t.root.style.maxHeight="75px",h}function v(t,e,n){var r,s;const l=null!==(r=null==n?void 0:n.clone().xor(e).anyTrue)&&void 0!==r&&r,u=t.length,c=t.getRawData(),f=new Float32Array(u+e.trueCount+(l&&null!==(s=null==n?void 0:n.trueCount)&&void 0!==s?s:0)),h=new Array(f.length);for(let t=0,r=0,o=0;t<u;++t){const s=e.get(t);f[t]=c[t],h[t]=s?i.SELECTION:i.ALL,s&&(f[u+r]=c[t],h[u+r]=i.ALL,++r),l&&(null==n?void 0:n.get(t))&&(f[u+e.trueCount+o]=c[t],h[u+e.trueCount+o]=i.PEPTIDES_SELECTION,++o)}const d=o.Column.fromStrings(a.$2.SPLIT_COL,h),m=[i.ALL,i.SELECTION];return l&&m.push(i.PEPTIDES_SELECTION),d.setCategoryOrder(m),d.meta.colors.setCategorical(),o.DataFrame.fromColumns([o.Column.fromFloat32Array(a.$2.ACTIVITY,f),d])}function y(t){const e=r.iconFA("expand-alt",(()=>{const e=t.dataFrame.plot.grid();b(e,!1),e.root.style.height="100%";const n=r.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 o=r.iconFA("expand-alt",(()=>{const e=i(),n=r.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");o.style.marginLeft="auto",o.style.marginRight="15px",n.addEventListener("mouseenter",(()=>{o.style.visibility="visible"})),n.addEventListener("mouseleave",(()=>{o.style.visibility="hidden"})),e.appendChild(o)}function b(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 w(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],r=i.indexOf(e.monomerOrCluster);if(n.shiftPressed&&n.ctrlPressed)-1!==r&&i.splice(r,1);else if(n.ctrlPressed)-1===r?i.push(e.monomerOrCluster):i.splice(r,1);else if(n.shiftPressed)-1===r&&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,r]of i){const i=e[t];for(const t of r){const e=i[t];e&&(null!=n||(n=new l.A(e.mask.length,!1)),n.or(e.mask))}}return null!=n?o.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 _(t,e){var n;const i={};for(const[r,o]of t)for(const[t,s]of o){null!==(n=i[t])&&void 0!==n||(i[t]={});const o=new l.A(e,!1);for(const[t,e]of s){o.setTrue(t);for(const t of e)o.setTrue(t)}i[t][r]={mask:o}}return i}function N(t,e,n,i){const r=Object.entries(n),o=i?Object.entries(i).filter((t=>!e.includes(t[0])||n[t[0]]!==t[1])):[];return r.concat(o).filter((e=>t.columns.contains(e[0])&&t.col(e[0]).matches("numerical")))}function M(t,e=2){return t.columns.bySemTypeAll(o.SEMTYPE.MACROMOLECULE).length>0&&c()(t.columns.numerical).toArray().length>0&&t.rowCount>=e}function I(t,e=500){let n;return(...i)=>f(this,void 0,void 0,(function*(){return new Promise((r=>{clearTimeout(n),n=setTimeout((()=>r(t(...i))),e)}))}))}function O(){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:()=>f});var i=n(6082),r=n(6572),o=n(4139);const s=(t,e)=>`${t}(${e})`;function a(t,e,n){var o;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===(o=i.DataFrame.fromColumns([n.col]).clone(i.BitSet.fromBytes(e.buffer.buffer,e.length)).col(n.col.name))||void 0===o?void 0:o.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 f=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:f,meanDifference:f-t,ratio:s.length/e.length,mask:e,aggValue:l}}const h=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 o=r.mean(t),s=r.mean(e),a=r.variance(t),l=r.variance(e),u=t.length,c=e.length;let f,h,d;if(n){const t=a/u,e=l/c,n=(o-s)/Math.sqrt(t+e);h=r.normal.pdf(n,0,1),f=1-h,d=2*(h<f?h:f)}else if(i){const t=u+c-2,e=(a*(u-1)+l*(c-1))/t,n=Math.sqrt(u*c/(u+c))*(o-s)/e;f=1-r.studentt.cdf(n,t),h=r.studentt.cdf(n,t),d=2*(h<f?h:f)}else{const t=a/u,e=l/c,n=(o-s)/Math.sqrt(t+e),i=Math.pow(t+e,2)/(Math.pow(t,2)/(u-1)+Math.pow(e,2)/(c-1));h=r.studentt.cdf(n,i),f=1-h,d=2*(h<f?h:f)}return{"p-value":d,"Mean difference":o-s,"p-value more":f,"p-value less":h}}(s,a),d=h["Mean difference"];return{count:s.length,pValue:h[d>=0?"p-value more":"p-value less"],mean:f,meanDifference:d,ratio:s.length/e.length,mask:e,aggValue:l}}function l(t,e,n){const r=o.zW[e],s=i.Stats.fromColumn(t,n);if(!(r in s))throw new Error(`Aggregation type ${r} is not supported`);return s[r]}function u(t,e,n={}){var i,r;null!==(i=n.filterDf)&&void 0!==i||(n.filterDf=!1),null!==(r=n.fractionDigits)&&void 0!==r||(n.fractionDigits=3);const o=n.filterDf&&t.filter.anyFalse?t.clone(t.filter):t,a={};for(const[t,i]of e){const e=s(i,t),r=l(o.getCol(t),i,n.mask);a[e]=r.toFixed(n.fractionDigits)}return a}function c(t,e,n,i){var r;null!==(r=i.fractionDigits)&&void 0!==r||(i.fractionDigits=3);const o={};for(const[r,a]of n){const n=s(a,r),l=t.get(n,e);o[n]=l.toFixed(i.fractionDigits)}return o}function f(t,e,n){var r;const o=t.col(e.substring(5,e.length-1));if(!o||!o.matches("categorical"))return"{}";null!=n||(n=i.BitSet.create(t.rowCount,(()=>!0)));const s=o.getRawData(),a=new Map;for(let t=-1;-1!==(t=n.findNext(t,!0));)a.set(s[t],(null!==(r=a.get(s[t]))&&void 0!==r?r:0)+1);const l={};for(const[t,e]of a)l[o.categories[t]]=e;return JSON.stringify(l)}},912:(t,e,n)=>{"use strict";n.d(e,{D:()=>u,Y:()=>c});var i=n(7389),r=n(6082),o=n(4139),s=n(7654),a=n(8608),l=n(5070);function u(t,e,n,i){var r,s,a;return null!==(r=i.fromViewer)&&void 0!==r||(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!==o.$2.MONOMER&&c(t,e,n,i),!0}function c(t,e,n,o){var u,c,f,h,d,m,g,p,v;if(null!==(u=o.fromViewer)&&void 0!==u||(o.fromViewer=!1),null!==(c=o.isMutationCliffs)&&void 0!==c||(o.isMutationCliffs=!1),null!==(f=o.isMostPotentResidues)&&void 0!==f||(o.isMostPotentResidues=!1),null!==(h=o.additionalStats)&&void 0!==h||(o.additionalStats={}),o.cliffStats&&o.isMutationCliffs){const u=null===(p=null===(g=o.cliffStats)||void 0===g?void 0:g.get(o.monomerPosition.monomerOrCluster))||void 0===p?void 0:p.get(o.monomerPosition.positionOrClusterType);if(!u)return null;const c=r.BitSet.fromBytes(u.mask.buffer.buffer,e.length),f=(0,s.M1)((0,a.FZ)(e,c),!0),h=(0,s.QD)(u,{countName:"Unique count"});o.fromViewer&&(h["Mean difference"]=`${h["Mean difference"]} (Color)`,h["Unique count"]&&(h["Unique count"]=`${h["Unique count"]} (Size)`));const d=null!==(v=o.aggrColValues)&&void 0!==v?v:(0,l.I_)(t,n,{mask:c}),m=Object.assign(Object.assign(Object.assign({},o.additionalStats),h),d),y=(0,a.F2)(f,m);return i.tooltip.show(y,o.x,o.y),y}{const u=o.mpStats[o.monomerPosition.positionOrClusterType][o.monomerPosition.monomerOrCluster];if(!(null==u?void 0:u.count))return null;const c=r.BitSet.fromBytes(u.mask.buffer.buffer,e.length),f=(0,s.M1)((0,a.FZ)(e,c),!0),h=(0,s.QD)(u);o.fromViewer&&(h["Mean difference"]=`${h["Mean difference"]}${o.isMostPotentResidues?" (size)":""}`,h["p-value"]&&(h["p-value"]=`${h["p-value"]}${o.isMostPotentResidues?" (color)":""}`));const g=null!==(d=o.aggrColValues)&&void 0!==d?d:(0,l.I_)(t,n,{mask:c}),p=Object.assign(Object.assign(Object.assign({},o.additionalStats),h),g);for(const[t,e]of Object.entries(null!==(m=o.postfixes)&&void 0!==m?m:{}))p[t]&&(p[t]=`${p[t]}${e}`);const v=(0,a.F2)(f,p);return i.tooltip.show(v,o.x,o.y),v}}},115:(t,e,n)=>{"use strict";n.d(e,{GI:()=>a,Ku:()=>o,av:()=>s});var i=n(1199),r=n(4329);const o="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=o,this.webGPUDescriptionPromise=(0,r._)().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),r=n(4328),o=n(6082),s=n(7233),a=n.n(s),l=n(768),u=n(4139),c=n(3163),f=n(4326),h=n(5070),d=n(144),m=n.n(d),g=n(7654),p=n(8608),v=n(8774),y=n(6920),C=n(3657),b=n(3077),w=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 o.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._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:o.TYPE.CATEGORICAL}),this.activityColumnName=this.column("activity",{category:E.GENERAL,nullable:!1,columnTypeFilter:o.TYPE.NUMERICAL}),this.activityScaling=this.string("activityScaling",u.rg.NONE,{category:E.GENERAL,choices:Object.values(u.rg)}),this.webLogoMode=this.string("webLogoMode",f.fH.Entropy,{choices:[f.fH.full,f.fH.Entropy],category:E.STYLE}),this.membersRatioThreshold=this.float("membersRatioThreshold",.1,{min:0,max:1,category:E.STYLE}),this.columns=this.columnList("columns",[],{category:E.AGGREGATION}),this.aggregation=this.string("aggregation",o.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 r=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=r(l.q.SEQUENCE_VARIABILITY_MAP))&&void 0!==n?n:r(l.q.MOST_POTENT_RESIDUES))&&void 0!==i?i:(0,b.R)(this.dataFrame.getCol(this.sequenceColumnName),w.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?o.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;if(super.onTableAttached(),(0,p.B2)(this.dataFrame))null===(t=this.getProperty(`sequence${u.To}`))||void 0===t||t.set(this,this.dataFrame.columns.bySemType(o.SEMTYPE.MACROMOLECULE).name),null===(e=this.getProperty(`activity${u.To}`))||void 0===e||e.set(this,m()(this.dataFrame.columns.numerical).next().value.name),null===(n=this.getProperty(`clusters${u.To}`))||void 0===n||n.set(this,m()(this.dataFrame.columns.categorical).next().value.name);else{const t="PeptidesError: dataframe is missing Macromolecule or numeric columns";r.log.error(t),r.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.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}`:case"activityScaling":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})`))}createLogoSummaryTable(){var t,e,n;const i=this.clustersColumnName,r=this.dataFrame.filter.anyFalse,s=r?this.dataFrame.clone(this.dataFrame.filter):this.dataFrame,a=s.columns,l=s.rowCount,c=this.getScaledActivityColumn(r).getRawData(),f=s.getCol(i),d=f.getRawData(),g=f.categories,p={};p[u.gp.CUSTOM_CLUSTER]="1";const y=m()(a.byTags(p)).filter((t=>t.max>0)).toArray(),C=o.DataFrame.create(y.length),b=C.columns,w=b.addNewString(u.i6.CLUSTER),E=b.addNewInt(u.i6.MEMBERS).getRawData(),T=b.addNewString(u.i6.WEB_LOGO),x=b.addNewString(u.i6.DISTRIBUTION),_=b.addNewFloat(u.i6.MEAN_DIFFERENCE).getRawData(),N=b.addNewFloat(u.i6.P_VALUE).getRawData(),M=b.addNewFloat(u.i6.RATIO).getRawData();let I=s.groupBy([i]);const O=this.getTotalViewerAggColumns(),L=this.getStringAggregatedColumns(),R=L.map((t=>b.addNewString(t))),P=O.map((([t,e])=>A(e,t))),k=new Array(P.length+L.length),V=O.map((([t,e])=>[s.getCol(t),e]));for(let t=0;t<O.length;++t){const[e,n]=O[t];I=I.add(n,e,P[t]);const i=b.addNewFloat(P[t]);k[t]=i.getRawData()}const D=new Array(y.length);for(let e=0;e<y.length;++e){const n=y[e];w.set(e,n.name);const i=v.A.fromUint32Array(l,n.getRawData());if(i.allFalse)continue;const a=o.BitSet.fromBytes(i.buffer.buffer,l),u=r?(0,h.GT)(c,i):this.clusterStats[S.CUSTOM][n.name];E[e]=u.count,D[e]=a,_[e]=u.meanDifference,N[e]=null!==(t=u.pValue)&&void 0!==t?t:o.FLOAT_NULL,M[e]=u.ratio;for(let t=0;t<P.length;++t){const[n,i]=V[t];k[t][e]=(0,h.lh)(n,i,a)}for(let t=P.length;t<k.length;++t){const n=L[t-P.length];R[t-P.length].set(e,(0,h.J1)(s,n,a))}}T.setTag(o.TAGS.CELL_RENDERER,"html"),x.setTag(o.TAGS.CELL_RENDERER,"html");const G=I.aggregate(),F=G.rowCount,U=G.columns;let H=G.getCol(i);H.name=u.i6.CLUSTER,H.type!==o.COLUMN_TYPE.STRING&&(G.columns.replace(H,H.convertTo(o.COLUMN_TYPE.STRING)),H=G.getCol(H.name));const q=H.categories,B=U.addNewInt(u.i6.MEMBERS).getRawData(),Y=U.addNewString(u.i6.WEB_LOGO),W=U.addNewString(u.i6.DISTRIBUTION),j=U.addNewFloat(u.i6.MEAN_DIFFERENCE).getRawData(),$=U.addNewFloat(u.i6.P_VALUE).getRawData(),z=U.addNewFloat(u.i6.RATIO).getRawData(),K=L.map((t=>U.addNewString(t))),Q=new Array(F),Z=Array.from({length:F},(()=>new v.A(l,!1)));for(let t=0;t<l;++t){const n=g[d[t]];null===(e=Z[q.indexOf(n)])||void 0===e||e.setTrue(t)}for(let t=0;t<F;++t){const e=Z[t];if(e.allFalse)continue;const i=o.BitSet.fromBytes(e.buffer.buffer,l),a=r?(0,h.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,h.J1)(s,n,i))}B[t]=a.count,Q[t]=i,j[t]=a.meanDifference,$[t]=null!==(n=a.pValue)&&void 0!==n?n:o.FLOAT_NULL,z[t]=a.ratio}Y.setTag(o.TAGS.CELL_RENDERER,"html"),W.setTag(o.TAGS.CELL_RENDERER,"html");const X=G.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.dataFrame.clone(this.dataFrame.filter):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 r=new o.LruCache,s=new Map;let h=null;const d=new o.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 b=t.g,w=t.bounds;b.save(),b.beginPath(),b.rect(w.x,w.y,w.width,w.height),b.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(b,g.cell.value,this.clusterSelection,w),t.preventDefault();else if((null===(n=g.tableColumn)||void 0===n?void 0:n.name)===u.i6.WEB_LOGO){if(!0===s.get(C))return void t.preventDefault();const e=Math.floor((g.bounds.width-2-4*(m-1))/m),n=r.get(C);if(void 0!==n){const i=n.getProperties();for(const t of i)"positionHeight"===t.name&&t.get(n)!==this.webLogoMode?t.set(n,this.webLogoMode):"positionWidth"===t.name&&t.get(n)!==e?t.set(n,e):"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=this.createWebLogoDf(y,S);s.set(C,!0),n.plot.fromType("WebLogo",{positionHeight:this.webLogoMode,horizontalAlignment:f.P4.LEFT,maxHeight:1e3,minHeight:A,positionWidth:e,showPositionLabels:!1}).then((t=>{r.set(C,t),s.delete(C),h&&clearTimeout(h),h=setTimeout((()=>i.invalidate()),200)})),t.preventDefault()}}else if((null===(l=g.tableColumn)||void 0===l?void 0:l.name)===u.i6.DISTRIBUTION){let e=d.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:o.Color.toHtml(o.Color.white),xAxisHeight:1,showSplitSelector:!1}),e.root.style.width="auto",d.set(C,e)),e.root.style.height=`${A}px`,g.element=e.root,t.preventDefault()}}finally{b.restore()}})),i.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),o.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 r=this.getCluster(n);this.modifyClusterSelection(r,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey}),i.invalidate()})),i.onCellTooltip(((t,e,n)=>{var i;if(!t.isTableCell)return this.model.unhighlight(),!0;const r=this.getCluster(t);return this.highlightCluster(r),(null===(i=t.tableColumn)||void 0===i?void 0:i.name)===u.i6.CLUSTER&&this.showTooltip(r,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,r=i.indexOf("-1"),o=t.getRawData();let s=0;o.forEach(((t,e)=>{"-1"!==i[n[e]]&&(s=Math.max(s,o[e]))}));const a=Math.ceil(s*this.membersRatioThreshold);this.logoSummaryTable.filter.init((t=>o[t]>a&&(-1===r||"-1"!==i[n[t]])))}clusterFromSelection(){const t=this.model.getVisibleSelection(),e=this.logoSummaryTable.columns,n=e.length,i=new Array(e.length),r=this.getScaledActivityColumn(),o=v.A.fromString(t.toBinaryString()),s=(0,h.GT)(r.getRawData(),o);this.bitsets.push(t.clone());const a=this.dataFrame.columns.getUnusedName("New Cluster"),l={},c={},f=this.getTotalViewerAggColumns(),d=this.getStringAggregatedColumns();for(const[e,n]of f){const i=A(n,e),r=this.dataFrame.getCol(e);l[i]=(0,h.lh)(r,n,t)}for(const e of d)c[e]=(0,h.J1)(this.dataFrame,e,t);for(let r=0;r<n;++r){const n=e.byIndex(r);i[r]=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[r]&&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 r.shell.warning("No custom clusters selected to be removed");const e=this.logoSummaryTable.rows,n=this.logoSummaryTable.getCol(u.i6.CLUSTER),i=n.categories,o=this.dataFrame.columns;for(const n of t){t.splice(t.indexOf(n),1),o.remove(n),delete this.clusterStats[S.CUSTOM][n];const r=i.indexOf(n);e.removeAt(r),this.bitsets.splice(r,1)}n.compact(),this.clusterSelection[S.CUSTOM]=t,this.render()}addNewCluster(t){const e=o.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 r=this.dataFrame.filter,s=r.anyFalse?this.dataFrame.clone(r):this.dataFrame,a=s.rowCount,l=new v.A(a,!1),u=this.getScaledActivityColumn(r.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 f=r.anyFalse?(0,h.GT)(c,l):this.clusterStats[t.positionOrClusterType][t.monomerOrCluster];if(!f.count)return null;const d=o.BitSet.fromBytes(l.buffer.buffer,a),m=(0,p.FZ)(u,d),y=(0,g.M1)(m,!0),C=(0,g.QD)(f),b=(0,h.I_)(this.dataFrame,this.getTotalViewerAggColumns(),{filterDf:!0,mask:d}),w=Object.assign(Object.assign({},C),b),A=(0,p.F2)(y,w);return i.tooltip.show(A,e,n),A}createWebLogoDf(t,e){const n=o.DataFrame.fromColumns([t]);return n.filter.copyFrom(e),n}}},3541:(t,e,n)=>{"use strict";n.d(e,{J:()=>N,UJ:()=>M,xN:()=>_});var i,r,o,s,a=n(4328),l=n(7389),u=n(6082),c=n(7233),f=n.n(c),h=n(4139),d=n(3163),m=n(768),g=n(144),p=n.n(g),v=n(5070),y=n(912),C=n(3657),b=n(8608),w=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(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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"}(r||(r={})),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"}(o||(o={})),function(t){t.GENERAL="General",t.INVARIANT_MAP="Invariant Map",t.MUTATION_CLIFFS="Mutation Cliffs",t.AGGREGATION="Aggregation"}(s||(s={}));class _ 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(r.SEQUENCE,{category:s.GENERAL,semType:u.SEMTYPE.MACROMOLECULE,nullable:!1}),this.activityColumnName=this.column(r.ACTIVITY,{category:s.GENERAL,nullable:!1}),this.activityScaling=this.string(r.ACTIVITY_SCALING,h.rg.NONE,{category:s.GENERAL,choices:Object.values(h.rg),nullable:!1}),this.activityTarget=this.string(r.ACTIVITY_TARGET,h.wf.HIGH,{category:s.GENERAL,choices:Object.values(h.wf),nullable:!1}),this.targetColumnName=this.column(r.TARGET,{category:s.GENERAL,nullable:!0,columnTypeFilter:"categorical",userEditable:!0}),this.minActivityDelta=this.float(r.MIN_ACTIVITY_DELTA,0,{category:s.MUTATION_CLIFFS,min:0,max:100}),this.maxMutations=this.int(r.MAX_MUTATIONS,1,{category:s.MUTATION_CLIFFS,min:1,max:20}),this.columns=this.columnList(r.COLUMNS,[],{category:s.AGGREGATION}),this.aggregation=this.string(r.AGGREGATION,u.AGG.AVG,{category:s.AGGREGATION,choices:h.V5}),this.valueColumnName=this.column(r.VALUE_INVARIANT_MAP,{category:s.INVARIANT_MAP,userEditable:!0,nullable:!1,columnTypeFilter:"numerical"}),this.valueAggregation=this.string(r.AGGREGATION_INVARIANT_MAP_VALUE,u.AGG.TOTAL_COUNT,{category:s.INVARIANT_MAP,choices:h.V5,userEditable:!0,nullable:!1}),this.mutationCliffsDebouncer=(0,b.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[h.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.width="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 N?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,w.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 _&&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 _||null!=this.targetColumnName&&null!=(null===(i=this.targetCategoryInput)||void 0===i?void 0:i.value))||!(t instanceof _&&this.valueColumnName==(null==t?void 0:t.valueColumnName)&&this.valueAggregation==(null==t?void 0:t.valueAggregation))&&(t instanceof _||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 N?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,r=this.targetCategoryInput.value,o=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&&r?{col:i,cat:r}:void 0,aggValue:s&&o?{col:o,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===(r=n.targetCategoryInput)||void 0===r?void 0:r.value)===(null===(o=null==i?void 0:i.targetCategoryInput)||void 0===o?void 0:o.value)&&n.minActivityDelta===(null==i?void 0:i.minActivityDelta)&&n.maxMutations===(null==i?void 0:i.maxMutations)?e._mutationCliffs:null;var n,i,r,o};return this instanceof N?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 N?h.YX.MP:h.YX.MPR,n=this.dataFrame.getTag(`${e}${h.gp.MUTATION_CLIFFS_SELECTION}`);return null!==(t=this._mutationCliffsSelection)&&void 0!==t||(this._mutationCliffsSelection=null===n?(0,b.ZR)(this.positionColumns):JSON.parse(n)),this._mutationCliffsSelection}set mutationCliffsSelection(t){this._mutationCliffsSelection=t;const e=this instanceof N?h.YX.MP:h.YX.MPR;this.dataFrame.setTag(`${e}${h.gp.MUTATION_CLIFFS_SELECTION}`,JSON.stringify(t)),this.model.fireBitsetChanged(this instanceof N?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,b.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,b.vW)(this.mutationCliffsSelection,t,e):this._mutationCliffsSelection=(0,b.vW)(this.mutationCliffsSelection,t,e)}modifyInvariantMapSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.invariantMapSelection=(0,b.vW)(this.invariantMapSelection,t,e):this._invariantMapSelection=(0,b.vW)(this.invariantMapSelection,t,e)}get invariantMapSelection(){var t;const e=this.dataFrame.getTag(`${h.YX.MP}${h.gp.INVARIANT_MAP_SELECTION}`);return null!==(t=this._invariantMapSelection)&&void 0!==t||(this._invariantMapSelection=null===e?(0,b.ZR)(this.positionColumns):JSON.parse(e)),this._invariantMapSelection}set invariantMapSelection(t){this._invariantMapSelection=t,this.dataFrame.setTag(`${h.YX.MP}${h.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`${r.SEQUENCE}${h.To}`:this._positionColumns=null,this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._viewerGrid=null;break;case`${r.ACTIVITY}${h.To}`:case r.ACTIVITY_SCALING:this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._viewerGrid=null,this._scaledActivityColumn=null;break;case`${r.VALUE_INVARIANT_MAP}${h.To}`:case r.AGGREGATION_INVARIANT_MAP_VALUE:this._monomerPositionStats=null,this._viewerGrid=null,this._invariantMapSelection=null;break;case r.MIN_ACTIVITY_DELTA:case r.MAX_MUTATIONS:this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this.doRender=!1;break;case r.COLUMNS:case r.AGGREGATION:this instanceof M&&(this._viewerGrid=null);break;case r.ACTIVITY_TARGET:(this instanceof M||this instanceof N)&&(this._viewerGrid=null)}null===this._mutationCliffs&&this.sequenceColumnName&&this.activityColumnName&&this.calculateMutationCliffs().then((t=>{this.mutationCliffs=t.cliffs,this.cliffStats=t.cliffStats})),t.name===`${r.TARGET}${h.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,b.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,b.B2)(this.dataFrame))null===(t=this.getProperty(`${r.SEQUENCE}${h.To}`))||void 0===t||t.set(this,this.dataFrame.columns.bySemType(u.SEMTYPE.MACROMOLECULE).name),null===(e=this.getProperty(`${r.ACTIVITY}${h.To}`))||void 0===e||e.set(this,p()(this.dataFrame.columns.numerical).next().value.name),null===(n=this.getProperty(`${r.VALUE_INVARIANT_MAP}${h.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:{}})),r=new Set;i.forEach((t=>Object.keys(t).forEach((t=>r.add(t))))),r.delete("colors"),e.group("Monomer Meta").items(Array.from(r),(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(b.eY),n=this.targetColumnName?(0,b.eY)(this.dataFrame.getCol(this.targetColumnName)):null,i={maxMutations:this.maxMutations,minActivityDelta:this.minActivityDelta,targetCol:n,currentTarget:this.targetCategoryInput.value},r=t.getRawData(),o=yield this.mutationCliffsDebouncer(r,e,i);return{cliffs:o,cliffStats:(0,C.Lw)(o,r)}}))}}class N extends _{constructor(){super(),this.currentGridCell=null,this.customColorRange=!1,this.minColorValue=0,this.maxColorValue=0,this.logScaleColor=!1,this.colorColumnName=this.column(o.COLOR,{category:s.INVARIANT_MAP,nullable:!1,columnTypeFilter:"numerical"}),this.colorAggregation=this.string(o.COLOR_AGGREGATION,u.AGG.AVG,{category:s.INVARIANT_MAP,choices:h.V5}),this.lowerBoundColor=this.int(o.LOWER_BOUND_COLOR,4278190335,{category:s.INVARIANT_MAP,editor:"color"}),this.middleColor=this.int(o.MIDDLE_COLOR,4294967295,{category:s.INVARIANT_MAP,editor:"color"}),this.upperBoundColor=this.int(o.UPPER_BOUND_COLOR,4294901760,{category:s.INVARIANT_MAP,editor:"color"}),this.logScaleColor=this.bool(o.LOG_SCALE_COLOR,!1,{category:s.INVARIANT_MAP}),this.customColorRange=this.bool(o.CUSTOM_COLOR_RANGE,!1,{category:s.INVARIANT_MAP}),this.minColorValue=this.float(o.MIN_COLOR_VALUE,0,{category:s.INVARIANT_MAP}),this.maxColorValue=this.float(o.MAX_COLOR_VALUE,0,{category:s.INVARIANT_MAP})}get name(){return m.q.SEQUENCE_VARIABILITY_MAP}get mode(){var t;return null!==(t=this.dataFrame.getTag(h.gp.MONOMER_POSITION_MODE))&&void 0!==t?t:i.MUTATION_CLIFFS}set mode(t){this.dataFrame.setTag(h.gp.MONOMER_POSITION_MODE,t),this.viewerGrid.invalidate()}onTableAttached(){var t;if(super.onTableAttached(),(0,b.B2)(this.dataFrame))null===(t=this.getProperty(`${o.COLOR}${h.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(`${r.TARGET}${h.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===r.SEQUENCE&&(this._invariantMapSelection=null),null===(e=this.positionColumns)||void 0===e||e.forEach((t=>{t.temp[h.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(h.$2.MONOMER,n),r=u.DataFrame.fromColumns([i]),o=(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=r.columns.addNewString(t);o.then((n=>{e.init((e=>{var i,r;return null!==(r=null===(i=n[e][t])||void 0===i?void 0:i.toString())&&void 0!==r?r:""}))}))})),r.name="SAR";for(const t of e)r.columns.addNewBool(t.name);return r}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,r=null==i?void 0:i.getRawData(),o=this.targetCategoryInput.value,s=null==o?null:null==i?void 0:i.categories.indexOf(o);for(const i of this.positionColumns){i.temp[h.gp.INVARIANT_MAP_COLOR_CACHE]={};const o=i.temp[h.gp.INVARIANT_MAP_COLOR_CACHE],a=i.name,l=i.getRawData(),c=i.categories;if(!this.monomerPositionStats[a])continue;const f=this.monomerPositionStats[a];for(const a of Object.keys(f)){if("general"===a)continue;const f=[];for(let t=0;t<i.length;++t){const e=c[l[t]]===a,n=!r||null==s||-1==s||r[t]===s;e&&n&&f.push(t)}const h=u.Column.float("color",f.length).init((e=>t[f[e]])).aggregate(this.colorAggregation);o[a]=h,e=Math.min(e,h),n=Math.max(n,h)}i.temp[h.gp.INVARIANT_MAP_COLOR_CACHE]=o}const a=this.customColorRange&&null!=this.minColorValue&&null!=this.maxColorValue;let l=a?this.minColorValue:e,c=a?this.maxColorValue:n;const f=this.logScaleColor&&l>1e-30&&c>1e-30&&e>1e-30&&n>1e-30;f&&(l=Math.log(l),c=Math.log(c));for(const t of this.positionColumns){const i=t.temp[h.gp.INVARIANT_MAP_COLOR_CACHE];if(i){for(const t of Object.keys(i))this.activityTarget===h.wf.LOW&&(i[t]=c-i[t]+l),i[t]=u.Color.scaleColor(f?Math.log(i[t]):i[t],l,c,void 0,[this.lowerBoundColor,this.middleColor,this.upperBoundColor]);t.temp[h.gp.INVARIANT_MAP_COLOR_CACHE]=i,t.temp[h.gp.INVARIANT_MAP_COLOR_MIN_CACHE]=e,t.temp[h.gp.INVARIANT_MAP_COLOR_MAX_CACHE]=n}}}}createViewerGrid(){const t=this.createMonomerPositionDf(),e=t.plot.grid();e.sort([h.$2.MONOMER]);const n=this.positionColumns.map((t=>t.name));e.columns.setOrder([h.$2.MONOMER,...this._monomerMetaColumns,...n]);const r=t.getCol(h.$2.MONOMER);d.rI(r,this.alphabet,!0),this.cacheInvariantMapColors(),e.onCellRender.subscribe((t=>I(t,this,this.mode===i.INVARIANT_MAP,this.dataFrame.getCol(this.colorColumnName),this.colorAggregation))),e.onCellTooltip(((t,e,n)=>{var r,o,s,a,l;if(!t.isTableCell||!(null===(r=null==t?void 0:t.cell.column)||void 0===r?void 0:r.name)||this._monomerMetaColumns.has(t.cell.column.name))return this.model.unhighlight(),!0;const c=this.getMonomerPosition(t);(0,b.dl)(c,this.dataFrame,this.monomerPositionStats),this.model.isHighlighting=!0;const f=this.getTotalViewerAggColumns(),h={},d={};if(this.mode===i.INVARIANT_MAP)this.colorColumnName&&this.colorAggregation&&this.colorColumnName!==this.valueColumnName?(f.unshift([this.colorColumnName,this.colorAggregation]),h[`${this.colorAggregation}(${this.colorColumnName})`]=" (color)"):this.colorColumnName&&this.colorAggregation&&this.colorColumnName===this.valueColumnName&&(h["Mean activity"]=" (color)"),this.valueColumnName&&this.valueAggregation&&this.valueAggregation!==u.AGG.VALUE_COUNT&&this.valueAggregation!==u.AGG.TOTAL_COUNT&&f.unshift([this.valueColumnName,this.valueAggregation]);else{const t=null===(s=null===(o=this.mutationCliffs)||void 0===o?void 0:o.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;d["Pairs count"]=e.toString()}}return(0,y.D)(this.model.df,this.getScaledActivityColumn(),f,{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:h,additionalStats:d})})),e.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),u.debounce(e.onCurrentCellChanged,500).subscribe((t=>{var n,r,o,s,a,l,c,f,h;try{if(!t||!t.dart||!(null===(r=null===(n=null==t?void 0:t.cell)||void 0===n?void 0:n.column)||void 0===r?void 0:r.name)||this._monomerMetaColumns.has(t.cell.column.name))return;if(-1===t.gridRow&&(this.mode===i.INVARIANT_MAP?this._invariantMapSelection=(0,b.ZR)(this.positionColumns):this._mutationCliffsSelection=(0,b.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===(o=this.mutationCliffs)||void 0===o?void 0:o.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===(f=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===f?void 0:f.size)&&this.modifyMutationCliffsSelection(u,{shiftPressed:!0,ctrlPressed:!1},!0),e.invalidate(),setTimeout((()=>null==e?void 0:e.invalidate()),300)}finally{this.keyPressed=!1,(null===(h=t.tableColumn)||void 0===h?void 0:h.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,b.ZR)(this.positionColumns):this._mutationCliffsSelection=(0,b.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 r,o,s,a,l;const u=e.hitTest(n.offsetX,n.offsetY);if(!(null==u?void 0:u.isTableCell)||(null===(r=null==u?void 0:u.tableColumn)||void 0===r?void 0:r.name)===h.$2.MONOMER||(null===(o=null==u?void 0:u.tableColumn)||void 0===o?void 0:o.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,b.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()})),O(e);const o=e.onAfterDrawContent.subscribe((()=>{const t=e.col(h.$2.MONOMER);if(40!==t.width){t.width=40;for(const t of n)e.col(t).width=40}else o.unsubscribe()}));return e}getMonomerPosition(t){return{monomerOrCluster:t.cell.dataFrame.get(h.$2.MONOMER,t.tableRowIndex),positionOrClusterType:t.tableColumn.name}}render(){var t,e,n;if(f()(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 r=this.getProperty(o.COLOR);r&&(r.choices=p()(a.shell.t.columns.numerical).toArray().map((t=>t.name)),r.get(this)===h.$2.ACTIVITY_SCALED&&r.set(this,h.$2.ACTIVITY)),f()(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=>{f()(t.root).find(".ui-input-editor").css("margin","0px").attr("type","radio"),f()(t.root).find(".ui-input-description").css("padding","0px").css("padding-right","16px"),f()(t.captionLabel).addClass("ui-label-right")};n(t),n(e),s=l.divH([t.root,e.root],{id:"pep-viewer-title"}),f()(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");f()(c).addClass("pep-help-icon"),this.targetColumnInput&&(this.targetColumnInput.root.style.width="50%");const d=l.divH([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"}}),g=l.divH([c,s,d],{style:{alignSelf:"center",lineHeight:"normal",flexDirection:"column"}});this.root.appendChild(l.divV([g,u])),null===(n=this.viewerGrid)||void 0===n||n.invalidate()}}class M extends _{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),r=new Array(n.length),o=new Array(n.length),s=new Array(n.length),a=new Array(n.length),l=new Array(n.length),c=this.getTotalViewerAggColumns(),f=c.map((([t,e])=>(0,v.hX)(e,t))),d=new Array(f.length);f.forEach(((t,e)=>d[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]));if(0===y.length)continue;let C=null;for(const[t,e]of y)(null===C||this.activityTarget===h.wf.HIGH&&C[1].meanDifference<e.meanDifference||this.activityTarget===h.wf.LOW&&C[1].meanDifference>e.meanDifference)&&(C=[t,e]);if(null===C)continue;n[m]=parseInt(g),i[m]=C[0],r[m]=C[1].meanDifference,o[m]=C[1].pValue,s[m]=C[1].count,a[m]=C[1].ratio,l[m]=C[1].mean;const b=this.monomerPositionStats[g][C[0]],w=u.BitSet.fromBytes(b.mask.buffer.buffer,this.model.df.col(this.activityColumnName).length);for(let t=0;t<f.length;t++){const[e,n]=c[t];d[t][m]=(0,v.lh)(this.model.df.getCol(e),n,w)}++m}n.length=m,i.length=m,r.length=m,o.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,h.$2.POSITION,n)),p.add(u.Column.fromList(u.TYPE.STRING,h.$2.MONOMER,i)),p.add(u.Column.fromList(u.TYPE.FLOAT,h.$2.MEAN_DIFFERENCE,r)),p.add(u.Column.fromList(u.TYPE.FLOAT,h.$2.MEAN,l)),p.add(u.Column.fromList(u.TYPE.FLOAT,h.$2.P_VALUE,o)),p.add(u.Column.fromList(u.TYPE.INT,h.$2.COUNT,s)),p.add(u.Column.fromList(u.TYPE.FLOAT,h.$2.RATIO,a)),f.forEach(((t,e)=>p.add(u.Column.fromList(u.TYPE.FLOAT,t,d[e])))),g}createViewerGrid(){const t=this.createMostPotentResiduesDf(),e=t.plot.grid();e.sort([h.$2.POSITION]);const n=e.col(h.$2.P_VALUE);n.format="#.000",n.name="P-value";const i=t.getCol(h.$2.MONOMER);d.rI(i,this.alphabet,!0),e.onCellRender.subscribe((t=>I(t,this,!1))),e.onCellTooltip(((t,e,n)=>{var i,r;if(!t.isTableCell)return this.model.unhighlight(),!0;const o=this.getMonomerPosition(t);if((0,b.dl)(o,this.dataFrame,this.monomerPositionStats),this.model.isHighlighting=!0,(null===(i=t.tableColumn)||void 0===i?void 0:i.name)===h.$2.MONOMER)o.positionOrClusterType=h.$2.MONOMER;else if((null===(r=t.tableColumn)||void 0===r?void 0:r.name)!==h.$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:o,x:e,y:n,mpStats:this.monomerPositionStats,aggrColValues:a})})),u.debounce(e.onCurrentCellChanged,500).subscribe((n=>{var i,r,o;try{if(-1===n.gridRow)return this._mutationCliffsSelection=(0,b.ZR)(this.positionColumns),this._invariantMapSelection=(0,b.ZR)(this.positionColumns),this.model.fireBitsetChanged(m.q.MOST_POTENT_RESIDUES),void e.invalidate();if(this.keyPressed&&t.currentCol.name!==h.$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===(o=null===(r=null===(i=this.mutationCliffs)||void 0===i?void 0:i.get(s.monomerOrCluster))||void 0===r?void 0:r.get(s.positionOrClusterType))||void 0===o?void 0:o.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,b.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,r;const o=e.hitTest(t.offsetX,t.offsetY);if(!(null==o?void 0:o.isTableCell)||o.tableColumn.name!==h.$2.MEAN_DIFFERENCE)return;const s=this.getMonomerPosition(o);(null===(r=null===(i=null===(n=this.monomerPositionStats)||void 0===n?void 0:n[s.positionOrClusterType])||void 0===i?void 0:i[s.monomerOrCluster])||void 0===r?void 0:r.count)&&(this.modifyInvariantMapSelection(s,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey}),e.invalidate())})),O(e);const r=e.col(h.$2.MEAN_DIFFERENCE);r.name="Diff";const o=e.onAfterDrawContent.subscribe((()=>{const t=e.col(h.$2.MONOMER);if(40===t.width)return r.width=40,void o.unsubscribe();t.width=40,r.width=40}));return e}getMonomerPosition(t){return{monomerOrCluster:t.cell.dataFrame.get(h.$2.MONOMER,t.tableRowIndex),positionOrClusterType:`${t.cell.dataFrame.get(h.$2.POSITION,t.tableRowIndex)}`}}render(){var t;if(f()(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 I(t,e,n,i,r){var o,s,a,l,c;const f=[...e.positionColumns.map((t=>t.name)),h.$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===(o=p.tableColumn)||void 0===o?void 0:o.name,y=p.tableRowIndex;if(!p.isTableCell||-1===f.indexOf(v))return void m.restore();const C=p.grid.table,b=C.get(h.$2.MONOMER,y),w=v!==h.$2.MEAN_DIFFERENCE?v:C.get(h.$2.POSITION,y).toFixed(),A=e.monomerPositionStats[w];if(!A[b])return t.preventDefault(),void m.restore();if(n){const t=null!==(s=A[b].aggValue)&&void 0!==s?s:A[b].count,n=e.positionColumns.find((t=>t.name===w)),i=null!==(a=n.temp[h.gp.INVARIANT_MAP_COLOR_CACHE])&&void 0!==a?a:{};let r=u.Color.white;null!=i[b]?r=i[b]:e instanceof N&&(e.cacheInvariantMapColors(),r=null!==(c=(null!==(l=n.temp[h.gp.INVARIANT_MAP_COLOR_CACHE])&&void 0!==l?l:{})[b])&&void 0!==c?c:u.Color.white),d.rW(m,b,w,e.invariantMapSelection,t,g,r)}else d.Yd(m,b,w,e,g);t.preventDefault(),m.restore()}function O(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,r=n(7389),o=n(6082),s=n(7233),a=n.n(s),l=n(4139),u=n(5070),c=n(8608),f=n(5480),h=n(8774);!function(t){t.SEPARATE_MONOMERS="separateMonomers",t.SEPARATE_POSITIONS="separatePositions",t.SEPARATE_CLUSTERS="separateClusters"}(i||(i={}));const d="general",m=t=>t===d?"General":t.substring(8);function g(t,e){if(!t.selection.anyTrue)return r.divText("No distribution");const n=()=>{const n=[C(d,t,e)];for(const r of Object.values(i))"true"!==t.getTag(r)||r===i.SEPARATE_CLUSTERS&&!e.clusterColName||n.push(C(r,t,e));return 1===n.length?n[0]:r.div(n)},o=r.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]=r.input.bool(c,{value:"true"===t.getTag(s[u]),onValueChanged:e=>{t.setTag(s[u],`${e}`),a()(o).empty(),o.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[f.W.ORIGINAL]):c!==i.SEPARATE_MONOMERS&&c!==i.SEPARATE_POSITIONS||(l[u].enabled=0!==Object.entries(e.monomerPositionSelection).length)}const u=r.form(l,{style:{flexDirection:"row"}});return r.divV([u,o])}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 r={[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&&(r["p-value"]=t.pValue<.01?"<0.01":t.pValue.toFixed(e.fractionDigits)),r}function y(t,e,n,i={}){const r=p((0,c.FZ)(n.activityCol,t.selection,n.peptideSelection)),s=(0,u.I_)(t,Object.entries(n.columns),{filterDf:!0,mask:o.BitSet.fromBytes(e.mask.buffer.buffer,e.mask.length)}),l=v(e),f=Object.assign(Object.assign({},l),s),h=(0,c.F2)(r,f,i);return a()(h).addClass("d4-flex-col"),h}function C(t,e,n){let o=r.divText("No distribution");switch(t){case d:const t=h.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};o=y(e,s,n);break;case i.SEPARATE_CLUSTERS:o=function(t,e,n){const i=t.rowCount,o=[],s=e.activityCol.getRawData(),a=t.getCol(e.clusterColName),l=a.categories,d=a.getRawData(),m=n[f.W.ORIGINAL].map((t=>l.indexOf(t))),g=new Array(m.length).fill(new h.A(i));for(let t=0;t<i;t++){const e=d[t],n=m.indexOf(e);-1!==n&&g[n].setTrue(t)}for(let n=0;n<m.length;n++){const i=m[n],r=(0,u.GT)(s,g[n]);o.push(y(t,r,e,{[c.AN.SELECTION]:l[i]}))}const p=n[f.W.CUSTOM];for(const n of p){const r=t.getCol(n),a=h.A.fromUint32Array(i,r.getRawData()),l=(0,u.GT)(s,a);o.push(y(t,l,e,{[c.AN.SELECTION]:n}))}return r.div(o,"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);o=function(t,e,n){var i,o,s;const a=Object.keys(n),l=t.rowCount,f=[],d=[],m=[],g=[],p=e.activityCol.getRawData();for(const r of a){const a=n[r],v=new h.A(l);for(let e=0;e<a.length;e++){const n=a[e];null!==(i=d[e])&&void 0!==i||(d[e]=t.getCol(n)),null!==(o=m[e])&&void 0!==o||(m[e]=d[e].categories),null!==(s=g[e])&&void 0!==s||(g[e]=d[e].getRawData());const u=m[e].indexOf(r);for(let t=0;t<l;t++)g[e][t]===u&&v.setTrue(t)}const C=(0,u.GT)(p,v);f.push(y(t,C,e,{[c.AN.SELECTION]:r}))}return r.div(f,"d4-flex-wrap")}(e,n,a);break;case i.SEPARATE_POSITIONS:o=function(t,e,n){var i,o,s;const a=Object.keys(n),l=t.rowCount,f=[],d=e.activityCol.getRawData(),m=[],g=[],p=[];for(let r=0;r<a.length;r++){const v=a[r],C=n[v];if(0===C.length)continue;null!==(i=m[r])&&void 0!==i||(m[r]=t.getCol(v)),null!==(o=g[r])&&void 0!==o||(g[r]=m[r].categories),null!==(s=p[r])&&void 0!==s||(p[r]=m[r].getRawData());const b=new h.A(t.rowCount);for(let t=0;t<C.length;t++){const e=C[t],n=g[r].indexOf(e);for(let t=0;t<l;t++)p[r][t]===n&&b.setTrue(t)}const w=(0,u.GT)(d,b);f.push(y(t,w,e,{[c.AN.SELECTION]:v}))}return r.div(f,"d4-flex-wrap")}(e,n,n.monomerPositionSelection)}return r.divV([r.h1(m(t)),o])}},7923:(t,e,n)=>{"use strict";n.d(e,{F:()=>l});var i=n(7389),r=n(6082),o=n(4139),s=n(8608),a=n(3163);function l(t,e,n=!0){const o=u(t,e);if(!o)return new r.Widget(i.label("No mutations table generated"));const{pairsGrid:a,uniqueSequencesGrid:l,aminoToInput:c}=o,f=[a,l],h=i.divV([c.root,...f.map((t=>t.root))],{style:{width:"100%"}});return n&&(0,s.BE)("Mutation Cliffs pairs",c.root,h,(()=>{const n=u(t,e),r=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(r)){const o=r.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="100%",a.style.marginTop="20px",o>400)){const t=Math.max(.33*o,200),i=n.pairsGrid.columns.byName("Mutation");i&&(i.width=t);const r=n.uniqueSequencesGrid.columns.byName(e.sequenceColumnName);r&&(r.width=t)}}}),500),r})),new r.Widget(h)}function u(t,e){var n,l;const u=t.filter.getSelectedIndexes(),c=Object.keys(e.mutationCliffsSelection);if(!c.length||null===e.mutationCliffs)return null;const f=[],h=[],d=[],m=[],g=[],p=[],v=t.getCol(e.sequenceColumnName),y=v.categories,C=v.getRawData(),b=e.activityCol.getRawData(),w=new Map,A=r.BitSet.create(t.rowCount),S={},E=Object.fromEntries(e.positionColumns.map((t=>[t.name,t])));for(const t of c){const i=E[t],r=i.categories,o=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,e]of s.entries()){if(!u.includes(t))continue;S[t]||(S[t]=Object.keys(S).length+1);const n=S[t],i=null!==(l=w.get(t))&&void 0!==l?l:[],s=y[C[t]],a=b[t];for(const l of e){if(i.includes(l)||!u.includes(l))continue;w.has(l)||w.set(l,[]);const e=y[C[l]];w.get(l).push(t),f.push(`${s}#${e}`),m.push(`${n}`),h.push(a-b[l]),d.push(r[o[l]]),g.push(t),p.push(l),A.set(t,!0),A.set(l,!0)}}}}if(0===f.length)return null;const T=r.Column.fromStrings("Mutation",f),x=r.Column.fromList("double","Delta",h),_=r.Column.fromStrings("Group",m),N=r.Column.fromStrings("~to",d),M=r.Column.fromList(r.COLUMN_TYPE.INT,"~toIdx",p),I=r.Column.fromList(r.COLUMN_TYPE.INT,"~fromIdx",g),O=r.DataFrame.fromColumns([T,x,_,N,M,I]);O.name="Mutation Cliff pairs";const L=i.input.string("Mutated to:",{value:"",onValueChanged:t=>{const e=t;""!==e?O.filter.init((t=>N.get(t)===e)):O.filter.setAll(!0)}});L.setTooltip("Filter the rows by the monomer that the mutation was substituted to");const R=O.plot.grid();(0,s.vY)(R,!0),T.semType=o.uF.MACROMOLECULE_DIFFERENCE,T.tags[o.gp.SEPARATOR]=(0,s.AY)(v),T.tags[r.TAGS.UNITS]=v.tags[r.TAGS.UNITS],T.tags[r.TAGS.CELL_RENDERER]="MacromoleculeDifference";let P=!1,k=null;const V=[];R.onCurrentCellChanged.subscribe((t=>{try{if(!t||!t.dart)return V.length=0,void Y();const e=t.tableRowIndex;if(!P)return;if(null===e)return V.length=0,void Y();null!==k&&V.splice(V.indexOf(k),1),V.includes(e)||(V.push(e),R.invalidate()),Y()}finally{P=!1,k=t&&t.dart?t.tableRowIndex:null}})),R.root.addEventListener("keydown",(t=>{P=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=V.indexOf(n);-1===t?V.push(n):V.splice(t,1)}else V.length=0,V.push(n);Y(),R.invalidate(),B.invalidate()})),R.onCellRender.subscribe((t=>{var e;(null===(e=t.cell.tableColumn)||void 0===e?void 0:e.name)===T.name&&V.includes(t.cell.tableRowIndex)&&(0,a.X5)(t.g,t.bounds)}));const D=e.gridColumns.length,G=[];for(let t=1;t<D;t++){const n=e.gridColumns.byIndex(t);((null==n?void 0:n.name)===e.sequenceColumnName||!0===(null==n?void 0:n.visible)&&!Object.hasOwn(E,n.name))&&G.push(n.name)}const F=t.clone(A,G);F.name="Unique sequences that form Mutation Cliffs pairs";const U=F.columns.addNewInt("~seqIdx"),H=U.getRawData(),q=A.getSelectedIndexes();U.init((t=>q[t]));const B=F.plot.grid();function Y(){const t=[];for(const e of V)t.push(I.get(e)),t.push(M.get(e));F.filter.init((e=>0===V.length||t.includes(H[e])),!0),R.invalidate(),B.invalidate()}return(0,s.vY)(B,!0),B.props.rowHeight=20,R.root.style.width="100% !important",B.root.style.width="100% !important",setTimeout((()=>{R.autoSize(window.innerWidth,250,void 0,void 0,!1),B.autoSize(window.innerWidth,250,void 0,void 0,!1),R.root.style.removeProperty("width"),R.root.style.setProperty("width","100%"),B.root.style.removeProperty("width"),B.root.style.setProperty("width","100%"),R.root.style.minHeight="70px",B.root.style.minHeight="100px",R.root.style.height="unset",B.root.style.height="unset"}),200),{pairsGrid:R,uniqueSequencesGrid:B,aminoToInput:L}}},5082:(t,e,n)=>{"use strict";n.d(e,{n:()=>v,v:()=>p});var i=n(4328),r=n(7389),o=n(6082),s=(n(4788),n(4139)),a=n(115),l=n(768),u=n(7233),c=n.n(u),f=n(8608),h=n(2003),d=n(1199),m=n(5429),g=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(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 p(t,e){const n=new a.av,l=r.div();let u=null;if(void 0===e){const e=o.Utils.firstOrNull(t.columns.toList().filter((t=>t.semType===o.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=r.input.column("Sequence",{table:t,value:e,onValueChanged:e=>{c()(l).empty().append(r.wait((()=>g(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===o.SEMTYPE.MACROMOLECULE}),u.setTooltip("Macromolecule column in FASTA, HELM or separated format")}else if("SEQ.MSA"!==e.getTag(h.gp.aligned)&&e.getTag(o.TAGS.UNITS)!==h.Hi.HELM)return{host:r.label("Peptides analysis only works with aligned sequences"),callback:()=>g(this,void 0,void 0,(function*(){return!1}))};let p,y=o.Func.find({package:"Bio",name:"webLogoViewer"});if(0===y.length)return{host:r.label("Bio package is missing or out of date. Please install the latest version."),callback:()=>g(this,void 0,void 0,(function*(){return!1}))};if(y=o.Func.find({package:"Bio",name:"getBioLib"}),0===y.length)return{host:r.label("Bio package is missing or out of date. Please install the latest version."),callback:()=>g(this,void 0,void 0,(function*(){return!1}))};const C=t.col("activity")||t.col("IC50")||o.Utils.firstOrNull(t.columns.numerical),b=r.div([],{id:"pep-hist-host"}),w=r.input.choice("Scaling",{value:s.rg.NONE,items:Object.values(s.rg),onValueChanged:t=>g(this,void 0,void 0,(function*(){var e;p=(0,f.Y1)(S.value,t);const n=o.DataFrame.fromColumns([p]).plot.histogram({filteringEnabled:!1,valueColumnName:s.$2.ACTIVITY,legendVisibility:"Never",showXAxis:!0,showColumnSelector:!1,showRangeSlider:!1,showBinSelector:!1});null===(e=b.lastChild)||void 0===e||e.remove(),b.appendChild(n.root)}))});w.setTooltip("Activity column transformation method");const A=()=>{var t;w.enabled=null!==(t=S.value)&&void 0!==t&&t&&S.value.stats.min>0,w.value=s.rg.NONE,0!==S.value.stats.missingValueCount&&i.shell.info("Activity column contains missing values. They will be ignored during analysis")},S=r.input.column("Activity",{table:t,value:C,onValueChanged:A,filter:t=>t.type===o.TYPE.INT||t.type===o.TYPE.FLOAT||t.type===o.TYPE.QNUM});S.setTooltip("Numerical activity column");const E=r.input.column("Clusters",{table:t,onValueChanged:t=>{t&&(T.value=!1,T.fireChanged())}});E.setTooltip("Optional. Clusters column is used to create Logo Summary Table"),E.nullable=!0;const T=r.input.bool("Generate clusters",{value:!0,onValueChanged:t=>{t&&(E.value=null,E.fireChanged())}});T.setTooltip("Generate clusters column based on MCL embeddings for Logo Summary Table"),S.fireChanged(),w.fireChanged(),T.fireChanged();const x=[S,w,E,T];null!==u&&x.splice(0,0,u);const _=r.input.float(m.t_.THRESHOLD,{value:n.threshold,nullable:!1,onValueChanged:t=>n.threshold=null!=t?t:n.threshold});_.setTooltip("Threshold for similarity between two sequences to create edges");const N=r.input.float(m.t_.INFLATION,{value:n.inflation,nullable:!1,onValueChanged:t=>n.inflation=null!=t?t:n.inflation});N.setTooltip("Inflation value for MCL algorithm");const M=r.input.int(m.t_.MAX_ITERATIONS,{value:n.maxIterations,nullable:!1,onValueChanged:t=>n.maxIterations=null!=t?t:n.maxIterations});M.setTooltip("Maximum iterations for MCL algorithm");const I=r.input.bool(m.t_.USE_WEBGPU,{value:n.useWebGPU,onValueChanged:t=>n.useWebGPU=t});I.enabled=!1,n.webGPUDescriptionPromise.then((()=>{n.webGPUDescription!==a.Ku?(I.setTooltip(`Use WebGPU for MCL algorithm (${n.webGPUDescription})`),I.enabled=!0):(I.setTooltip(a.Ku),I.enabled=!1,I.value=!1)}));const O=r.input.int(m.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 L=r.input.choice(m.t_.DISTANCE_FUNCTION,{value:n.distanceF,items:[d.Z.NEEDLEMANN_WUNSCH,d.Z.MONOMER_CHEMICAL_DISTANCE,d.Z.HAMMING,d.Z.LEVENSHTEIN],nullable:!1,onValueChanged:t=>n.distanceF=t}),R=r.input.float(m.t_.GAP_OPEN,{value:n.gapOpen,onValueChanged:t=>n.gapOpen=null!=t?t:n.gapOpen}),P=r.input.float(m.t_.GAP_EXTEND,{value:n.gapExtend,onValueChanged:t=>n.gapExtend=null!=t?t:n.gapExtend}),k=[_,N,M,O,L,r.input.choice(m.t_.FINGERPRINT_TYPE,{value:n.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],nullable:!1,onValueChanged:t=>n.fingerprintType=t}),R,P,I],V=r.form(k);V.style.display="none";const D=r.icons.settings((()=>{V.style.display="none"===V.style.display?"flex":"none",V.classList.remove("ui-form-condensed")}),"Adjust clustering parameters");D.style.fontSize="16px",T.root.appendChild(D);const G=t.filter.onChanged.subscribe((()=>A())),F=()=>g(this,void 0,void 0,(function*(){var i,r;const o=null!=e?e:u.value;return G.unsubscribe(),!!o&&null!==(yield v(S.value,o,E.value,t,p,null!==(i=w.value)&&void 0!==i?i:s.rg.NONE,{addSequenceSpace:!1,addMCL:!0,useEmbeddingsClusters:null!==(r=T.value)&&void 0!==r&&r,mclSettings:n}))}));let U="auto";const H=[r.divV(x)];if(c()(H[0]).find("label").css("width","unset"),void 0!==e){const t=r.button("Launch SAR",F,"");t.style.alignSelf="center",H.push(t),U="215px"}return c()(l).empty().append(r.wait((()=>g(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:r.divV([l,r.splitH([r.splitV(H),b],{style:{height:U,minWidth:"500px",maxWidth:"600px"}}),V]),callback:F}}function v(t,e,n,r,u,c){return g(this,arguments,void 0,(function*(t,e,n,r,u,c,f={}){var h,d,m,g,p;let v=null;if(t.type!==o.COLUMN_TYPE.FLOAT&&t.type!==o.COLUMN_TYPE.INT&&t.type!==o.COLUMN_TYPE.QNUM)return i.shell.error("The activity column must be of numeric type!"),v;const y=o.TaskBarProgressIndicator.create("Loading SAR...");r.tags.delete&&r.tags.delete(".script");const C=r.columns,b=r.col(u.name);b&&(b.name=C.getUnusedName(b.name));const w=u.getRawData();r.columns.addNew(u.name,u.type).init((t=>w[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(!!f.useEmbeddingsClusters&&!n),mclSettings:null!==(h=f.mclSettings)&&void 0!==h?h:new a.av};if(n){const t=r.getCol(n.name);t.type!==o.COLUMN_TYPE.STRING&&C.replace(t,t.convertTo(o.COLUMN_TYPE.STRING))}if(r.setTag(s.gp.SETTINGS,JSON.stringify(A)),v=l.i.getInstance(r),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!==(d=f.addSequenceSpace)&&void 0!==d&&d){if(yield v.addSequenceSpace({clusterCol:n,clusterEmbeddings:f.useEmbeddingsClusters}),!n&&null!==(m=f.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)===o.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=f.addMCL)&&void 0!==g&&g&&(yield v.addMCLClusters(),!n&&null!==(p=f.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)}}return y.close(),v}))}},5429:(t,e,n)=>{"use strict";n.d(e,{OH:()=>w,t_:()=>l});var i,r,o,s,a,l,u=n(7389),c=n(4328),f=n(6082),h=n(115),d=n(4139),m=n(768),g=n(7233),p=n.n(g),v=n(144),y=n.n(v),C=n(6920),b=n(1199);function w(t){var e,n,o,g,v,w,A,S,E,T;null==t.settings&&c.log.error("PeptidesError: Settings are not initialized");const x=u.accordion(),_=t.settings,N=null!==(e=null==_?void 0:_.activityScaling)&&void 0!==e?e:d.rg.NONE,M=null!==(n=null==_?void 0:_.columns)&&void 0!==n?n:{},I={},O={},L=null!==(o=null==_?void 0:_.sequenceSpaceParams)&&void 0!==o?o:new h.GI,R=null!==(g=null==_?void 0:_.mclSettings)&&void 0!==g?g:new h.av,P=u.input.column(r.ACTIVITY,{table:t.df,value:t.df.getCol(t.settings.activityColumnName),onValueChanged:t=>{I.activityColumnName=t.name},filter:t=>(t.type===f.TYPE.FLOAT||t.type===f.TYPE.INT)&&t.name!==d.$2.ACTIVITY&&0===t.stats.missingValueCount});P.setTooltip("Numeric activity column");const k=u.input.choice(r.ACTIVITY_SCALING,{value:N,items:Object.values(d.rg),onValueChanged:t=>I.activityScaling=t});k.setTooltip("Activity column transformation method"),x.addPane(i.GENERAL,(()=>u.inputs([P,k])),!0),O[i.GENERAL]=[P,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=>I.showDendrogram=t}),G=u.input.bool(m.q.CLUSTER_MAX_ACTIVITY,{value:!!(null==_?void 0:_.showClusterMaxActivity),onValueChanged:t=>{I.showClusterMaxActivity=null!=t?t:void 0}}),F=u.input.bool("Sequence space",{value:!!(null==_?void 0:_.showSequenceSpace),onValueChanged:t=>{I.showSequenceSpace=null!=t?t:void 0,t?(dt.root.style.display="flex",(null==_?void 0:_.showSequenceSpace)||(I.sequenceSpaceParams=L)):(dt.root.style.display="none",delete I.sequenceSpaceParams),I.showSequenceSpace===(null==_?void 0:_.showSequenceSpace)&&delete I.showSequenceSpace}});G.setTooltip("Show cluster max activity viewer"),D.setTooltip("Show dendrogram viewer"),D.enabled=null!==(0,C.getTreeHelperInstance)(),x.addPane(i.VIEWERS,(()=>u.inputs([D,F,G])),!0),O[i.VIEWERS]=[D,F,G];const U=[],H=[];for(const e of t.df.columns.numerical){const t=e.name;if(t===_.activityColumnName||t===d.$2.ACTIVITY)continue;const n=u.input.bool(s.IS_INCLUDED,{value:void 0!==M[t],onValueChanged:e=>{var n;null!==(n=I.columns)&&void 0!==n||(I.columns={}),e?I.columns[t]=i.value:(delete I.columns[t],Object.keys(I.columns).length===Object.keys(M).length&&delete I.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:f.AGG.AVG,items:Object.values(f.STATS),onValueChanged:i=>{var r;null!==(r=I.columns)&&void 0!==r||(I.columns={}),n.value?I.columns[t]=i:(delete I.columns[e.name],Object.keys(I.columns).length===Object.keys(M).length&&delete I.columns)}});i.setTooltip("Aggregation method"),p()(i.root).find("label").css("width","auto");const r=u.inputsRow(e.name,[n,i]);H.push(n,i),p()(r).find("div.ui-div").css("display","inline-flex"),U.push(r)}0!==U.length&&(x.addPane(i.COLUMNS,(()=>u.divV(U)),!1),O[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 I.sequenceSpaceParams:I.sequenceSpaceParams=Object.assign(Object.assign({},L),q)}function Y(t,e){t.forEach((t=>{t.root.style.display=e?"flex":"none"}))}const W=u.input.choice(a.DISTANCE_FUNCTION,{value:L.distanceF,items:[b.Z.NEEDLEMANN_WUNSCH,b.Z.HAMMING,b.Z.LEVENSHTEIN,b.Z.MONOMER_CHEMICAL_DISTANCE],onValueChanged:t=>B("distanceF",t)});W.setTooltip("Distance function for sequences");const j=u.input.float(a.GAP_OPEN,{value:L.gapOpen,onValueChanged:t=>B("gapOpen",t)}),$=u.input.float(a.GAP_EXTEND,{value:L.gapExtend,onValueChanged:t=>B("gapExtend",t)}),z=u.input.bool(a.CLUSTER_EMBEDDINGS,{value:null!==(w=L.clusterEmbeddings)&&void 0!==w&&w,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===b.Z.NEEDLEMANN_WUNSCH),Y([K,Q],!0===z.value),Y([Z],W.value===b.Z.MONOMER_CHEMICAL_DISTANCE||W.value===b.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!==R[t]){n=!1;break}n?delete I.mclSettings:I.mclSettings=Object.assign(Object.assign({},R),J)}function et(){Y([it,rt],nt.value===b.Z.NEEDLEMANN_WUNSCH),Y([ot],nt.value===b.Z.MONOMER_CHEMICAL_DISTANCE||nt.value===b.Z.NEEDLEMANN_WUNSCH)}const nt=u.input.choice(l.DISTANCE_FUNCTION,{value:R.distanceF,items:[b.Z.NEEDLEMANN_WUNSCH,b.Z.MONOMER_CHEMICAL_DISTANCE,b.Z.HAMMING,b.Z.LEVENSHTEIN],onValueChanged:t=>tt("distanceF",t)}),it=u.input.float(l.GAP_OPEN,{value:R.gapOpen,onValueChanged:t=>tt("gapOpen",t)}),rt=u.input.float(l.GAP_EXTEND,{value:R.gapExtend,onValueChanged:t=>tt("gapExtend",t)}),ot=u.input.choice(l.FINGERPRINT_TYPE,{value:R.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],onValueChanged:t=>tt("fingerprintType",t)}),st=u.input.int(l.THRESHOLD,{value:null!==(A=R.threshold)&&void 0!==A?A:80,onValueChanged:t=>tt("threshold",t)}),at=u.input.int(l.MAX_ITERATIONS,{value:null!==(S=R.maxIterations)&&void 0!==S?S:5,onValueChanged:t=>tt("maxIterations",t)}),lt=u.input.float(l.INFLATION,{value:null!==(E=R.inflation)&&void 0!==E?E:1.4,onValueChanged:t=>{tt("inflation",t)}}),ut=u.input.bool(l.USE_WEBGPU,{value:R.useWebGPU,onValueChanged:t=>tt("useWebGPU",t)});ut.enabled=!1,R.webGPUDescriptionPromise.then((()=>{R.webGPUDescription!==h.Ku?(ut.setTooltip(`Use WebGPU for MCL algorithm (${R.webGPUDescription})`),ut.enabled=!0):(ut.setTooltip(h.Ku),ut.enabled=!1,ut.value=!1)}));const ct=u.input.int(l.MIN_CLUSTER_SIZE,{value:null!==(T=R.minClusterSize)&&void 0!==T?T:5,onValueChanged:t=>tt("minClusterSize",t)});et();const ft=[st,nt,ot,it,rt,lt,at,ct,ut];x.addPane(i.MCL,(()=>u.inputs(ft)),!0),O[i.MCL]=ft;const ht=[W,Z,j,$,z,K,Q],dt=x.addPane(i.SEQUENCE_SPACE,(()=>u.inputs(ht)),!0);O[i.SEQUENCE_SPACE]=ht,F.fireChanged();const mt=u.dialog("Peptides settings").add(x);return mt.root.style.width="400px",mt.onOK((()=>{t.settings=I})),mt.show(),{dialog:mt,accordion:x,inputs:O}}!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"}(r||(r={})),function(t){t.DENDROGRAM="Dendrogram"}(o||(o={})),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={})),i.GENERAL,i.VIEWERS,i.COLUMNS,i.SEQUENCE_SPACE,i.MCL},144:function(t){var e;e=function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e,n){"use strict";var i=n(1).default,r=n(39).default,o=n(52).default,s=n(40).default,a=n(54).default,l=n(80).default,u=n(84).default,c=n(65).default,f=t.exports=function(t){if(!m(t))throw new Error("wu: `"+t+"` is not iterable!");return new h(t)};function h(t){var e=g(t);this.next=e.next.bind(e)}f.prototype=h.prototype,f.prototype[o]=function(){return this};var d={},m=function(t){return t&&"function"==typeof t[o]},g=function(t){if(m(t))return s(t);throw new TypeError("Not iterable: "+t)},p=function(t,e){e.prototype=h.prototype,f[t]=e},v=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?e.length:arguments[2];return e.prototype=h.prototype,h.prototype[t]=e,n+=1,void(f[t]=f.curryable((function(){for(var e,n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=i.pop();return(e=f(o))[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 f(t.call.apply(t,[this].concat(n)))}},C=function(t,e){return p(t,y(e))},b=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 r=arguments.length,o=Array(r),s=0;s<r;s++)o[s]=arguments[s];return o.length>=e?t.apply(this,o):function(t,e){return function(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.call.apply(t,[this].concat(i(e),r))}}(n,o)}})),C("entries",a.mark((function t(e){var n,i,r,o,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(l(e));case 5:if(n=(u=o.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,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&o.return&&o.return();case 21:if(t.prev=21,!i){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]])}))),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,r,o,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(l(e));case 5:if(n=(u=o.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,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&o.return&&o.return();case 21:if(t.prev=21,!i){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]])}))),b("cycle",a.mark((function t(){var e,n,i,r,o,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],n=!0,i=!1,r=void 0,t.prev=4,o=s(this);case 6:if(n=(l=o.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,r=t.t0;case 20:t.prev=20,t.prev=21,!n&&o.return&&o.return();case 23:if(t.prev=23,!i){t.next=26;break}throw r;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,r,o,l,u,c,f,h=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,r=h.length,o=Array(r),l=0;l<r;l++)o[l]=h[l];u=s(o);case 6:if(e=(c=u.next()).done){t.next=12;break}return f=c.value,t.delegateYield(f,"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]])}))),b("chunk",a.mark((function t(){var e,n,i,r,o,l,u,c,f=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,r=!1,o=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!==f){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),r=!0,o=t.t0;case 24:t.prev=24,t.prev=25,!i&&l.return&&l.return();case 27:if(t.prev=27,!r){t.next=30;break}throw o;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),b("concatMap",a.mark((function t(e){var n,i,r,o,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(this);case 5:if(n=(l=o.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,r=t.t1;case 17:t.prev=17,t.prev=18,!n&&o.return&&o.return();case 20:if(t.prev=20,!i){t.next=23;break}throw r;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]])}))),b("drop",a.mark((function t(e){var n,i,r,o,l,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=0,i=!0,r=!1,o=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),r=!0,o=t.t0;case 22:t.prev=22,t.prev=23,!i&&l.return&&l.return();case 25:if(t.prev=25,!r){t.next=28;break}throw o;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]])}))),b("dropWhile",a.mark((function t(){var e,n,i,r,o,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,r=s(this);case 5:if(e=(o=r.next()).done){t.next=15;break}if(l=o.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&&r.return&&r.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),b("enumerate",a.mark((function t(){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(w([this,f.count()]),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),b("filter",a.mark((function t(){var e,n,i,r,o,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,r=s(this);case 5:if(e=(o=r.next()).done){t.next=13;break}if(l=o.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&&r.return&&r.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),b("flatten",a.mark((function t(){var e,n,i,r,o,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,r=s(this);case 5:if(e=(o=r.next()).done){t.next=16;break}if("string"==typeof(l=o.value)||!m(l)){t.next=11;break}return t.delegateYield(u?l:f(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&&r.return&&r.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),b("invoke",a.mark((function t(e){var n,i,r,o,l,u,c,f,h,d=arguments;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n=!0,i=!1,r=void 0,t.prev=3,o=d.length,l=Array(o>1?o-1:0),u=1;u<o;u++)l[u-1]=d[u];c=s(this);case 6:if(n=(f=c.next()).done){t.next=13;break}return h=f.value,t.next=10,h[e].apply(h,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,r=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 r;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]])}))),b("map",a.mark((function t(e){var n,i,r,o,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(this);case 5:if(n=(l=o.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,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&o.return&&o.return();case 21:if(t.prev=21,!i){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]])}))),b("pluck",a.mark((function t(e){var n,i,r,o,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(this);case 5:if(n=(l=o.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,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&o.return&&o.return();case 21:if(t.prev=21,!i){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]])}))),b("reductions",a.mark((function t(e){var n,i,r,o,l,u,c,f,h,d,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,r=!1,o=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),r=!0,o=t.t0;case 20:t.prev=20,t.prev=21,!i&&l.return&&l.return();case 23:if(t.prev=23,!r){t.next=26;break}throw o;case 26:return t.finish(23);case 27:return t.finish(20);case 28:return t.next=30,n;case 30:f=!0,h=!1,d=void 0,t.prev=33,m=s(this);case 35:if(f=(g=m.next()).done){t.next=42;break}return c=g.value,t.next=39,n=e(n,c);case 39:f=!0,t.next=35;break;case 42:t.next=48;break;case 44:t.prev=44,t.t1=t.catch(33),h=!0,d=t.t1;case 48:t.prev=48,t.prev=49,!f&&m.return&&m.return();case 51:if(t.prev=51,!h){t.next=54;break}throw d;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),b("reject",a.mark((function t(){var e,n,i,r,o,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,r=s(this);case 5:if(e=(o=r.next()).done){t.next=13;break}if(l=o.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&&r.return&&r.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),b("slice",a.mark((function t(){var e,n,i,o,l,u,c,f,h=arguments.length<=0||void 0===arguments[0]?0:arguments[0],d=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(!(d<h)){t.next=2;break}throw new RangeError("parameter `stop` (= "+d+") must be >= `start` (= "+h+")");case 2:e=!0,n=!1,i=void 0,t.prev=5,o=s(this.enumerate());case 7:if(e=(l=o.next()).done){t.next=20;break}if(u=r(l.value,2),c=u[0],!((f=u[1])<h)){t.next=13;break}return t.abrupt("continue",17);case 13:if(!(f>=d)){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&&o.return&&o.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),b("spreadMap",a.mark((function t(e){var n,r,o,l,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,r=!1,o=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),r=!0,o=t.t0;case 18:t.prev=18,t.prev=19,!n&&l.return&&l.return();case 21:if(t.prev=21,!r){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]])}))),b("take",a.mark((function t(e){var n,i,r,o,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,r=!1,o=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),r=!0,o=t.t0;case 23:t.prev=23,t.prev=24,!i&&l.return&&l.return();case 26:if(t.prev=26,!r){t.next=29;break}throw o;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]])}))),b("takeWhile",a.mark((function t(){var e,n,i,r,o,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,r=s(this);case 5:if(e=(o=r.next()).done){t.next=14;break}if(l=o.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&&r.return&&r.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),b("tap",a.mark((function t(){var e,n,i,r,o,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,r=s(this);case 5:if(e=(o=r.next()).done){t.next=13;break}return l=o.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&&r.return&&r.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),b("unique",a.mark((function t(){var e,n,i,r,o,l,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=new u,n=!0,i=!1,r=void 0,t.prev=4,o=s(this);case 6:if(n=(l=o.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,r=t.t0;case 21:t.prev=21,t.prev=22,!n&&o.return&&o.return();case 24:if(t.prev=24,!i){t.next=27;break}throw r;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 w=y(a.mark((function t(e){var n,i,r,o,l,u,c,f,h,d,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,r=0,o=!1;case 6:if(o){t.next=44;break}l=[],u=!0,c=!1,f=void 0,t.prev=11,h=s(n);case 13:if(u=(d=h.next()).done){t.next=26;break}if(m=d.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:++r==i&&(o=!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,f=t.t0;case 32:t.prev=32,t.prev=33,!u&&h.return&&h.return();case 35:if(t.prev=35,!c){t.next=38;break}throw f;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(w(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(w(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),r=1;r<n;r++)i[r-1]=arguments[r];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(w(i).spreadMap(e),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),f.MAX_BLOCK=15,f.TIMEOUT=1,v("asyncEach",(function(t){var e=arguments.length<=1||void 0===arguments[1]?f.MAX_BLOCK:arguments[1],n=arguments.length<=2||void 0===arguments[2]?f.TIMEOUT:arguments[2],i=g(this);return new c((function(r,o){!function a(){var l=Date.now(),u=!0,c=!1,f=void 0;try{for(var h,d=s(i);!(u=(h=d.next()).done);u=!0){var m=h.value;try{t(m)}catch(t){return void o(t)}if(Date.now()-l>e)return void setTimeout(a,n)}}catch(t){c=!0,f=t}finally{try{!u&&d.return&&d.return()}finally{if(c)throw f}}r()}()}))}),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 r,o=s(this);!(e=(r=o.next()).done);e=!0)if(!t(r.value))return!1}catch(t){n=!0,i=t}finally{try{!e&&o.return&&o.return()}finally{if(n)throw i}}return!0}),1),v("find",(function(t){var e=!0,n=!1,i=void 0;try{for(var r,o=s(this);!(e=(r=o.next()).done);e=!0){var a=r.value;if(t(a))return a}}catch(t){n=!0,i=t}finally{try{!e&&o.return&&o.return()}finally{if(n)throw i}}})),v("forEach",(function(t){var e=!0,n=!1,i=void 0;try{for(var r,o=s(this);!(e=(r=o.next()).done);e=!0)t(r.value)}catch(t){n=!0,i=t}finally{try{!e&&o.return&&o.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,r=void 0;try{for(var o,a=s(this);!(n=(o=a.next()).done);n=!0){e=o.value;break}}catch(t){i=!0,r=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw r}}}var l=!0,u=!1,c=void 0;try{for(var f,h=s(this);!(l=(f=h.next()).done);l=!0)e=t(e,f.value)}catch(t){u=!0,c=t}finally{try{!l&&h.return&&h.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 r,o=s(this);!(e=(r=o.next()).done);e=!0)if(t(r.value))return!0}catch(t){n=!0,i=t}finally{try{!e&&o.return&&o.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,r,o,s,l;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=n.items,r=0;case 2:if(r!==i.length){t.next=14;break}if(o=e.next(),s=o.done,l=o.value,!s){t.next=10;break}return n.returned===d&&(n.returned=l),t.abrupt("break",25);case 10:return t.next=12,i[r++]=l;case 12:t.next=23;break;case 14:if(r!==n.tail){t.next=21;break}return l=i[r],500===r?(i=n.items=i.slice(r),r=0,n.tail=0):(i[r]=void 0,n.tail=++r),t.next=19,l;case 19:t.next=23;break;case 21:return t.next=23,i[r++];case 23:t.next=2;break;case 25:return n.tail===r&&(i.length=0),t.abrupt("return",n.returned);case 27:case"end":return t.stop()}}),t,this)})));A.prototype=h.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:d};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),f.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),r=n(7);t.exports=function(t){return function(e,n){var o,s,a=String(r(e)),l=i(n),u=a.length;return l<0||l>=u?t?"":void 0:(o=a.charCodeAt(l))<55296||o>56319||l+1===u||(s=a.charCodeAt(l+1))<56320||s>57343?t?a.charAt(l):o:t?a.slice(l,l+2):s-56320+(o-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),r=n(10),o=n(13),s=n(14),a=n(19),l=n(20)("iterator"),u=n(23),c=!([].keys&&"next"in[].keys()),f="@@iterator",h="keys",d="values",m=function(){return this};t.exports=function(t,e,g,p,v,y,C){n(24)(g,e,p);var b,w,A=function(t){switch(t){case h:case d:return function(){return new g(this,t)}}return function(){return new g(this,t)}},S=e+" Iterator",E=t.prototype,T=E[l]||E[f]||v&&E[v],x=T||A(v);if(T){var _=n(15).getProto(x.call(new t));n(25)(_,S,!0),!i&&a(E,f)&&s(_,l,m)}if(i&&!C||s(E,l,x),u[e]=x,u[S]=m,v)if(b={keys:y?x:A(h),values:v==d?x:A(d),entries:v!=d?x:A("entries")},C)for(w in b)w in E||o(E,w,b[w]);else r(r.P+r.F*c,e,b)}},function(t,e){t.exports=!0},function(t,e,n){var i=n(11),r=n(12),o="prototype",s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e,n){var l,u,c,f,h=t&a.G,d=t&a.P,m=h?i:t&a.S?i[e]:(i[e]||{})[o],g=h?r:r[e]||(r[e]={});for(l in h&&(n=e),n)(u=!(t&a.F)&&m&&l in m)&&l in g||(c=u?m[l]:n[l],h&&"function"!=typeof m[l]?f=n[l]:t&a.B&&u?f=s(c,i):t&a.W&&m[l]==c?function(t){(f=function(e){return this instanceof t?new t(e):t(e)})[o]=t[o]}(c):f=d&&"function"==typeof c?s(Function.call,c):c,g[l]=f,d&&((g[o]||(g[o]={}))[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),r=n(16);t.exports=n(17)?function(t,e,n){return i.setDesc(t,e,r(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"),r=n(11).Symbol;t.exports=function(t){return i[t]||(i[t]=r&&r[t]||(r||n(22))("Symbol."+t))}},function(t,e,n){var i=n(11),r="__core-js_shared__",o=i[r]||(i[r]={});t.exports=function(t){return o[t]||(o[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),r={};n(14)(r,n(20)("iterator"),(function(){return this})),t.exports=function(t,e,o){t.prototype=i.create(r,{next:n(16)(1,o)}),n(25)(t,e+" Iterator")}},function(t,e,n){var i=n(19),r=n(14),o=n(20)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,o)&&r(t,o,e)}},function(t,e,n){"use strict";var i=n(27),r=n(10),o=n(29),s=n(30),a=n(33),l=n(34),u=n(35);r(r.S+r.F*!n(38)((function(t){Array.from(t)})),"Array",{from:function(t){var e,n,r,c,f=o(t),h="function"==typeof this?this:Array,d=arguments[1],m=void 0!==d,g=0,p=u(f);if(m&&(d=i(d,arguments[2],2)),null==p||h==Array&&a(p))for(n=new h(e=l(f.length));e>g;g++)n[g]=m?d(f[g],g):f[g];else for(c=p.call(f),n=new h;!(r=c.next()).done;g++)n[g]=m?s(c,d,[r.value,g],!0):r.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,r){return t.call(e,n,i,r)}}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,r){try{return r?e(i(n)[0],n[1]):e(n)}catch(e){var o=t.return;throw void 0!==o&&i(o.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),r=n(20)("iterator");t.exports=function(t){return(i.Array||Array.prototype[r])===t}},function(t,e,n){var i=n(6),r=Math.min;t.exports=function(t){return t>0?r(i(t),9007199254740991):0}},function(t,e,n){var i=n(36),r=n(20)("iterator"),o=n(23);t.exports=n(12).getIteratorMethod=function(t){if(null!=t)return t[r]||t["@@iterator"]||o[i(t)]}},function(t,e,n){var i=n(37),r=n(20)("toStringTag"),o="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))[r])?n:o?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"),r=!1;try{var o=[7][i]();o.return=function(){r=!0},Array.from(o,(function(){throw 2}))}catch(t){}t.exports=function(t){if(!r)return!1;var e=!1;try{var n=[7],o=n[i]();o.next=function(){e=!0},n[i]=function(){return o},t(n)}catch(t){}return e}},function(t,e,n){"use strict";var i=n(40).default,r=n(49).default;e.default=function(t,e){if(Array.isArray(t))return t;if(r(Object(t)))return function(t,e){var n=[],r=!0,o=!1,s=void 0;try{for(var a,l=i(t);!(r=(a=l.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,s=t}finally{try{!r&&l.return&&l.return()}finally{if(o)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),r=n(45),o=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,r(1)):r(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])}),"values"),o.Arguments=o.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),r=n(7);t.exports=function(t){return i(r(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),r=n(35);t.exports=n(12).getIterator=function(t){var e=r(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),r=n(20)("iterator"),o=n(23);t.exports=n(12).isIterable=function(t){var e=Object(t);return r in e||"@@iterator"in e||o.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,r=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,o=r&&i.regeneratorRuntime;if(i.regeneratorRuntime=void 0,t.exports=n(55),r)i.regeneratorRuntime=o;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 r=n(57).default,o=n(52).default,s=n(63).default,a=n(65).default;!function(e){var n,l=Object.prototype.hasOwnProperty,u="function"==typeof r&&o||"@@iterator",c="object"==typeof t,f=e.regeneratorRuntime;if(f)c&&(t.exports=f);else{(f=e.regeneratorRuntime=c?t.exports:{}).wrap=y;var h="suspendedStart",d="suspendedYield",m="executing",g="completed",p={},v=A.prototype=b.prototype;w.prototype=v.constructor=A,A.constructor=w,w.displayName="GeneratorFunction",f.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},f.mark=function(t){return t.__proto__=A,t.prototype=s(v),t},f.awrap=function(t){return new E(t)},S(T.prototype),f.async=function(t,e,n,i){var r=new T(y(t,e,n,i));return f.isGeneratorFunction(e)?r:r.next().then((function(t){return t.done?t.value:r.next()}))},S(v),v[u]=function(){return this},v.toString=function(){return"[object Generator]"},f.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}},f.values=M,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=n,this.done=!1,this.delegate=null,this.tryEntries.forEach(_),!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 o.type="throw",o.arg=t,e.next=n,!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i],o=r.completion;if("root"===r.tryLoc)return n("end");if(r.tryLoc<=this.prev){var s=l.call(r,"catchLoc"),a=l.call(r,"finallyLoc");if(s&&a){if(this.prev<r.catchLoc)return n(r.catchLoc,!0);if(this.prev<r.finallyLoc)return n(r.finallyLoc)}else if(s){if(this.prev<r.catchLoc)return n(r.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return n(r.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 r=i;break}}r&&("break"===t||"continue"===t)&&r.tryLoc<=e&&e<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=t,o.arg=e,r?this.next=r.finallyLoc:this.complete(o),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),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 r=i.arg;_(n)}return r}}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,r){var o=s((e||b).prototype);return o._invoke=function(t,e,i){var r=h;return function(o,s){if(r===m)throw new Error("Generator is already running");if(r===g){if("throw"===o)throw s;return I()}for(;;){var a=i.delegate;if(a){if("return"===o||"throw"===o&&a.iterator[o]===n){i.delegate=null;var l=a.iterator.return;if(l&&"throw"===(u=C(l,a.iterator,s)).type){o="throw",s=u.arg;continue}if("return"===o)continue}var u;if("throw"===(u=C(a.iterator[o],a.iterator,s)).type){i.delegate=null,o="throw",s=u.arg;continue}if(o="next",s=n,!(c=u.arg).done)return r=d,c;i[a.resultName]=c.value,i.next=a.nextLoc,i.delegate=null}if("next"===o)i.sent=r===d?s:n;else if("throw"===o){if(r===h)throw r=g,s;i.dispatchException(s)&&(o="next",s=n)}else"return"===o&&i.abrupt("return",s);if(r=m,"normal"===(u=C(t,e,i)).type){r=i.done?g:d;var c={value:u.arg,done:i.done};if(u.arg!==p)return c;i.delegate&&"next"===o&&(s=n)}else"throw"===u.type&&(r=g,o="throw",s=u.arg)}}}(t,i||null,new N(r||[])),o}function C(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function b(){}function w(){}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(r,o):a.resolve(s).then((function(t){return i.value=t,i}))}"object"==typeof i&&i.domain&&(e=i.domain.bind(e));var n,r=e.bind(t,"next"),o=e.bind(t,"throw");e.bind(t,"return"),this._invoke=function(t,i){var r=n?n.then((function(){return e(t,i)})):new a((function(n){n(e(t,i))}));return n=r.catch((function(t){})),r}}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 _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(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,r=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 r.next=r}}return{next:I}}function I(){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={},r=[],o=!1,s=-1;function a(){o=!1,n.length?r=n.concat(r):s=-1,r.length&&l()}function l(){if(!o){var t=setTimeout(a);o=!0;for(var e=r.length;e;){for(n=r,r=[];++s<e;)n&&n[s].run();s=-1,e=r.length}n=null,o=!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];r.push(new u(t,e)),1!==r.length||o||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),r=n(11),o=n(19),s=n(17),a=n(10),l=n(13),u=n(18),c=n(21),f=n(25),h=n(22),d=n(20),m=n(60),g=n(61),p=n(62),v=n(32),y=n(31),C=n(46),b=n(16),w=i.getDesc,A=i.setDesc,S=i.create,E=g.get,T=r.Symbol,x=!1,_=d("_hidden"),N=i.isEnum,M=c("symbol-registry"),I=c("symbols"),O="function"==typeof T,L=Object.prototype,R=s&&u((function(){return 7!=S(A({},"a",{get:function(){return A(this,"a",{value:7}).a}})).a}))?function(t,e,n){var i=w(L,e);i&&delete L[e],A(t,e,n),i&&t!==L&&A(L,e,i)}:A,P=function(t){var e=I[t]=S(T.prototype);return e._k=t,s&&x&&R(L,t,{configurable:!0,set:function(e){o(this,_)&&o(this[_],t)&&(this[_][t]=!1),R(this,t,b(1,e))}}),e},k=function(t,e,n){return n&&o(I,e)?(n.enumerable?(o(t,_)&&t[_][e]&&(t[_][e]=!1),n=S(n,{enumerable:b(0,!1)})):(o(t,_)||A(t,_,b(1,{})),t[_][e]=!0),R(t,e,n)):A(t,e,n)},V=function(t,e){y(t);for(var n,i=p(e=C(e)),r=0,o=i.length;o>r;)k(t,n=i[r++],e[n]);return t},D=function(t,e){return void 0===e?S(t):V(S(t),e)},G=function(t){var e=N.call(this,t);return!(e||!o(this,t)||!o(I,t)||o(this,_)&&this[_][t])||e},F=function(t,e){var n=w(t=C(t),e);return!n||!o(I,e)||o(t,_)&&t[_][e]||(n.enumerable=!0),n},U=function(t){for(var e,n=E(C(t)),i=[],r=0;n.length>r;)o(I,e=n[r++])||e==_||i.push(e);return i},H=function(t){for(var e,n=E(C(t)),i=[],r=0;n.length>r;)o(I,e=n[r++])&&i.push(I[e]);return i};O||(T=function(){if(this instanceof T)throw TypeError("Symbol is not a constructor");return P(h(arguments[0]))},l(T.prototype,"toString",(function(){return this._k})),i.create=D,i.isEnum=G,i.getDesc=F,i.setDesc=k,i.setDescs=V,i.getNames=g.get=U,i.getSymbols=H,s&&!n(9)&&l(L,"propertyIsEnumerable",G,!0)),O&&!u((function(){return"[null]"!=JSON.stringify([T()])}))||l(T.prototype,"toJSON",(function(){if(O&&v(this))return this}));var q={for:function(t){return o(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=d(t);q[t]=O?e:P(e)})),x=!0,a(a.G+a.W,{Symbol:T}),a(a.S,"Symbol",q),a(a.S+a.F*!O,"Object",{create:D,defineProperty:k,defineProperties:V,getOwnPropertyDescriptor:F,getOwnPropertyNames:U,getOwnPropertySymbols:H}),f(T,"Symbol"),f(Math,"Math",!0),f(r.JSON,"JSON",!0)},function(t,e,n){var i=n(15),r=n(46);t.exports=function(t,e){for(var n,o=r(t),s=i.getKeys(o),a=s.length,l=0;a>l;)if(o[n=s[l++]]===e)return n}},function(t,e,n){var i={}.toString,r=n(46),o=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 o(t)}catch(t){return s.slice()}}(t):o(r(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 r,o=n(t),s=i.isEnum,a=0;o.length>a;)s.call(t,r=o[a++])&&e.push(r);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,r=n(15),o=n(9),s=n(11),a=n(27),l=n(36),u=n(10),c=n(32),f=n(31),h=n(28),d=n(69),m=n(70),g=n(71).set,p=n(72),v=n(73),y=n(20)("species"),C=n(22)("record"),b=n(74),w="Promise",A=s.process,S="process"==l(A),E=s[w],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=r.create(E.prototype,{constructor:{value:e}}),e.resolve(5).then((function(){}))instanceof e||(t=!1),t&&n(17)){var i=!1;E.resolve(r.setDesc({},"then",{get:function(){i=!0}})),t=i}}catch(e){t=!1}return t}(),_=function(t){var e=f(t)[y];return null!=e?e:t},N=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;b((function(){for(var i=t.v,r=1==t.s,o=0,a=function(e){var n,o,s=r?e.ok:e.fail;try{s?(r||(t.h=!0),(n=!0===s?i:s(i))===e.P?e.rej(TypeError("Promise-chain cycle")):(o=N(n))?o.call(n,e.res,e.rej):e.res(n)):e.rej(i)}catch(t){e.rej(t)}};n.length>o;)a(n[o++]);n.length=0,t.n=!1,e&&setTimeout((function(){var e,n,r=t.p;I(r)&&(S?A.emit("unhandledRejection",i,r):(e=s.onunhandledrejection)?e({promise:r,reason:i}):(n=s.console)&&n.error&&n.error("Unhandled promise rejection",i)),t.a=void 0}),1)}))}},I=function(t){var e,n=t[C],i=n.a||n.c,r=0;if(n.h)return!1;for(;i.length>r;)if((e=i[r++]).fail||!I(e.P))return!1;return!0},O=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=N(t))?b((function(){var i={r:n,d:!1};try{e.call(t,a(L,i,1),a(O,i,1))}catch(t){O.call(i,t)}})):(n.v=t,n.s=1,M(n,!1))}catch(t){O.call({r:n,d:!1},t)}}};x||(E=function(t){h(t);var e={p:d(this,E,w),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(O,e,1))}catch(t){O.call(e,t)}},n(79)(E.prototype,{then:function(t,e){var n=f(f(this).constructor)[y],i={ok:"function"!=typeof t||t,fail:"function"==typeof e&&e},r=i.P=new(null!=n?n:E)((function(t,e){i.res=t,i.rej=e}));h(i.res),h(i.rej);var o=this[C];return o.c.push(i),o.a&&o.a.push(i),o.s&&M(o,!1),r},catch:function(t){return this.then(void 0,t)}})),u(u.G+u.W+u.F*!x,{Promise:E}),n(25)(E,w),v(E),v(i=n(12)[w]),u(u.S+u.F*!x,w,{reject:function(t){return new this((function(e,n){n(t)}))}}),u(u.S+u.F*(!x||T(!0)),w,{resolve:function(t){return c(n=t)&&(x?"Promise"==l(n):C in n)&&(e=t.constructor,o&&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(){}))}))),w,{all:function(t){var e=_(this),n=[];return new e((function(i,o){m(t,!1,n.push,n);var s=n.length,a=Array(s);s?r.each.call(n,(function(t,n){e.resolve(t).then((function(t){a[n]=t,--s||i(a)}),o)})):i(a)}))},race:function(t){var e=_(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),r=n(30),o=n(33),s=n(31),a=n(34),l=n(35);t.exports=function(t,e,n,u){var c,f,h,d=l(t),m=i(n,u,e?2:1),g=0;if("function"!=typeof d)throw TypeError(t+" is not iterable!");if(o(d))for(c=a(t.length);c>g;g++)e?m(s(f=t[g])[0],f[1]):m(t[g]);else for(h=d.call(t);!(f=h.next()).done;)r(h,m,f.value,e)}},function(t,e,n){var i=n(15).getDesc,r=n(32),o=n(31),s=function(t,e){if(o(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,r){try{(r=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:r(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),r=n(20)("species");t.exports=function(t){n(17)&&!(r in t)&&i.setDesc(t,r,{configurable:!0,get:function(){return this}})}},function(t,e,n){var i,r,o,s=n(11),a=n(75).set,l=s.MutationObserver||s.WebKitMutationObserver,u=s.process,c="process"==n(37)(u),f=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;r=void 0,t&&t.enter()};if(c)o=function(){u.nextTick(f)};else if(l){var h=1,d=document.createTextNode("");new l(f).observe(d,{characterData:!0}),o=function(){d.data=h=-h}}else o=function(){a.call(s,f)};t.exports=function(t){var e={fn:t,next:void 0,domain:c&&u.domain};r&&(r.next=e),i||(i=e,o()),r=e}},function(t,e,n){"use strict";var i,r,o,s=n(27),a=n(76),l=n(77),u=n(78),c=n(11),f=c.process,h=c.setImmediate,d=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)};h&&d||(h=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},d=function(t){delete p[t]},"process"==n(37)(f)?i=function(t){f.nextTick(s(y,t,1))}:m?(o=(r=new m).port2,r.port1.onmessage=C,i=s(o.postMessage,o,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:h,clear:d}},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),r=n(11).document,o=i(r)&&i(r.createElement);t.exports=function(t){return o?r.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),r=(n(12).Object||{})[t]||Object[t],o={};o[t]=e(r),i(i.S+i.F*n(18)((function(){r(1)})),"Object",o)}},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),r=n(14),o=n(27),s=n(73),a=n(69),l=n(7),u=n(70),c=n(45),f=n(22)("id"),h=n(19),d=n(32),m=Object.isExtensible||d,g=n(17),p=g?"_s":"size",v=0,y=function(t,e){if(!d(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!h(t,f)){if(!m(t))return"F";if(!e)return"E";r(t,f,++v)}return"O"+t[f]},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,r,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,r,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,r=n.p;delete e._i[n.i],n.r=!0,r&&(r.n=i),i&&(i.p=r),e._f==n&&(e._f=i),e._l==n&&(e._l=r),e[p]--}return!!n},forEach:function(t){for(var e,n=o(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,r,o=C(t,e);return o?o.v=n:(t._l=o={i:r=y(e,!0),k:e,v:n,p:i=t._l,n:void 0,r:!1},t._f||(t._f=o),i&&(i.n=o),t[p]++,"F"!==r&&(t._i[r]=o)),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),r=n(10),o=n(14),s=n(70),a=n(69);t.exports=function(t,e,l,u,c,f){var h=n(11)[t],d=h,m=c?"set":"add",g=d&&d.prototype,p={};return n(17)&&"function"==typeof d&&(f||g.forEach&&!n(18)((function(){(new d).entries().next()})))?(d=e((function(e,n){a(e,d,t),e._c=new h,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)||f&&"clear"==t||o(d.prototype,t,(function(n,i){var r=this._c[t](0===n?0:n,i);return e?this:r}))})),"size"in g&&i.setDesc(d.prototype,"size",{get:function(){return this._c.size}})):(d=u.getConstructor(e,t,c,m),n(79)(d.prototype,l)),n(25)(d,t),p[t]=d,r(r.G+r.W+r.F,p),f||u.setStrong(d,t,c),d}},function(t,e,n){var i=n(10);i(i.P,"Set",{toJSON:n(90)("Set")})},function(t,e,n){var i=n(70),r=n(36);t.exports=function(t){return function(){if(r(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 r=e[i];if(void 0!==r)return r.exports;var o=e[i]={id:i,loaded:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.loaded=!0,o.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 r=i.length-1;r>-1&&(!t||!/^http(s?):/.test(t));)t=i[r--].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=n(6920);peptides=i})();
2
2
  //# sourceMappingURL=package.js.map