@datagrok/bio 2.4.31 → 2.4.39

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.
Files changed (99) hide show
  1. package/.eslintrc.json +6 -8
  2. package/README.md +22 -7
  3. package/detectors.js +21 -12
  4. package/dist/1.js +2 -0
  5. package/dist/1.js.map +1 -0
  6. package/dist/18.js +2 -0
  7. package/dist/18.js.map +1 -0
  8. package/dist/190.js +2 -0
  9. package/dist/190.js.map +1 -0
  10. package/dist/452.js +2 -0
  11. package/dist/452.js.map +1 -0
  12. package/dist/729.js +2 -0
  13. package/dist/729.js.map +1 -0
  14. package/dist/package-test.js +1 -1
  15. package/dist/package-test.js.map +1 -1
  16. package/dist/package.js +1 -1
  17. package/dist/package.js.map +1 -1
  18. package/files/libraries/broken-lib.sdf +136 -0
  19. package/files/libraries/group1/mock-lib-3.json +74 -0
  20. package/files/libraries/mock-lib-2.json +48 -0
  21. package/files/tests/100_3_clustests.csv +100 -0
  22. package/files/tests/100_3_clustests_empty_vals.csv +100 -0
  23. package/files/tests/peptides_motif-with-random_10000.csv +9998 -0
  24. package/package.json +4 -4
  25. package/scripts/sequence_generator.py +164 -48
  26. package/src/analysis/sequence-activity-cliffs.ts +7 -9
  27. package/src/analysis/sequence-diversity-viewer.ts +8 -3
  28. package/src/analysis/sequence-search-base-viewer.ts +4 -3
  29. package/src/analysis/sequence-similarity-viewer.ts +13 -7
  30. package/src/analysis/sequence-space.ts +15 -12
  31. package/src/analysis/workers/mm-distance-array-service.ts +48 -0
  32. package/src/analysis/workers/mm-distance-array-worker.ts +29 -0
  33. package/src/analysis/workers/mm-distance-worker-creator.ts +6 -9
  34. package/src/apps/web-logo-app.ts +34 -0
  35. package/src/calculations/monomerLevelMols.ts +10 -12
  36. package/src/demo/bio01-similarity-diversity.ts +4 -5
  37. package/src/demo/bio01a-hierarchical-clustering-and-sequence-space.ts +6 -7
  38. package/src/demo/bio01b-hierarchical-clustering-and-activity-cliffs.ts +7 -8
  39. package/src/demo/bio03-atomic-level.ts +1 -4
  40. package/src/demo/bio05-helm-msa-sequence-space.ts +6 -4
  41. package/src/demo/utils.ts +3 -4
  42. package/src/package-test.ts +1 -2
  43. package/src/package.ts +135 -82
  44. package/src/seq_align.ts +482 -483
  45. package/src/substructure-search/substructure-search.ts +3 -3
  46. package/src/tests/Palettes-test.ts +1 -1
  47. package/src/tests/WebLogo-positions-test.ts +12 -35
  48. package/src/tests/_first-tests.ts +1 -1
  49. package/src/tests/activity-cliffs-tests.ts +10 -7
  50. package/src/tests/activity-cliffs-utils.ts +6 -5
  51. package/src/tests/bio-tests.ts +20 -25
  52. package/src/tests/checkInputColumn-tests.ts +5 -11
  53. package/src/tests/converters-test.ts +19 -37
  54. package/src/tests/detectors-benchmark-tests.ts +35 -37
  55. package/src/tests/detectors-tests.ts +29 -34
  56. package/src/tests/detectors-weak-and-likely-tests.ts +11 -21
  57. package/src/tests/fasta-export-tests.ts +3 -3
  58. package/src/tests/fasta-handler-test.ts +2 -3
  59. package/src/tests/lib-tests.ts +2 -4
  60. package/src/tests/mm-distance-tests.ts +25 -17
  61. package/src/tests/monomer-libraries-tests.ts +1 -1
  62. package/src/tests/msa-tests.ts +12 -9
  63. package/src/tests/pepsea-tests.ts +6 -3
  64. package/src/tests/renderers-test.ts +13 -11
  65. package/src/tests/sequence-space-test.ts +10 -8
  66. package/src/tests/sequence-space-utils.ts +6 -4
  67. package/src/tests/similarity-diversity-tests.ts +47 -61
  68. package/src/tests/splitters-test.ts +14 -20
  69. package/src/tests/to-atomic-level-tests.ts +9 -17
  70. package/src/tests/units-handler-splitted-tests.ts +106 -0
  71. package/src/tests/units-handler-tests.ts +22 -26
  72. package/src/tests/utils/sequences-generators.ts +6 -2
  73. package/src/tests/utils.ts +10 -4
  74. package/src/tests/viewers.ts +1 -1
  75. package/src/utils/atomic-works.ts +49 -57
  76. package/src/utils/cell-renderer.ts +25 -8
  77. package/src/utils/check-input-column.ts +19 -4
  78. package/src/utils/constants.ts +3 -3
  79. package/src/utils/convert.ts +56 -23
  80. package/src/utils/monomer-lib.ts +83 -64
  81. package/src/utils/multiple-sequence-alignment-ui.ts +24 -21
  82. package/src/utils/multiple-sequence-alignment.ts +2 -2
  83. package/src/utils/pepsea.ts +17 -7
  84. package/src/utils/save-as-fasta.ts +11 -4
  85. package/src/utils/ui-utils.ts +1 -1
  86. package/src/viewers/vd-regions-viewer.ts +21 -22
  87. package/src/viewers/web-logo-viewer.ts +189 -154
  88. package/src/widgets/bio-substructure-filter.ts +9 -6
  89. package/src/widgets/representations.ts +11 -12
  90. package/tsconfig.json +1 -1
  91. package/dist/258.js +0 -2
  92. package/dist/258.js.map +0 -1
  93. package/dist/457.js +0 -2
  94. package/dist/457.js.map +0 -1
  95. package/dist/562.js +0 -2
  96. package/dist/562.js.map +0 -1
  97. package/dist/925.js +0 -2
  98. package/dist/925.js.map +0 -1
  99. package/src/analysis/workers/mm-distance-worker.ts +0 -16
package/dist/package.js CHANGED
@@ -1,2 +1,2 @@
1
- var bio;(()=>{var t={8867:(t,e,n)=>{"use strict";n.d(e,{OW:()=>i});class i extends Float32Array{}},7997:(t,e,n)=>{"use strict";function i(t=!1,e="Assertion error."){if(!t)throw new Error(e)}function s(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n]*t[n];return Math.sqrt(e)}function o(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}n.d(e,{$G:()=>s,MA:()=>o,hu:()=>i}),n(8867)},2012:(t,e,n)=>{"use strict";n.d(e,{f:()=>s});var i=n(9976);class s extends i.B{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,s)),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,s)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new s({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 s.aaSynonyms?s.aaSynonyms[t]:t;return super.get(e)}}s.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class o{static getPalette(t="grok"){switch(t){case"grok":return s.GrokGroups;case"lesk":return s.Lesk;default:throw new Error(`ChemPalette: scheme \`${t}\` does not exist`)}}static getInnerOuter(t){let e=0,n="",i="";for(const s of t)"("==s?e++:")"==s?e--:e?n+=s:i+=s;return isNaN(parseInt(n))?[i,n]:[i,""]}static getColorAAPivot(t="",e="grok"){var n,i,s;const o=this.getPalette(e);let[r,a]=this.getInnerOuter(t);if(r=r.length>6?`${r.slice(0,3)}...`:r,a=a.length>6?`${a.slice(0,3)}...`:a,1==t.length||"("==t[1]){const e=null===(n=t[0])||void 0===n?void 0:n.toUpperCase();return e in o?[o.get(e),e,a,1]:[this.undefinedColor,r,a,1]}if("d"==t[0]&&t[1]in o&&(2==t.length||"("==t[2])){const e=null===(i=t[1])||void 0===i?void 0:i.toUpperCase();return e in o?[o.get(e),e,a,2]:[this.undefinedColor,r,a,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 o?[o.get(e),e,a,3]:[this.undefinedColor,r,a,3]}if((null===(s=t[0])||void 0===s?void 0:s.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 o?[o.get(e),e,a,4]:[this.undefinedColor,r,a,4]}return[this.undefinedColor,r,a,0]}}o.SemType="Aminoacids",o.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",o.undefinedColor="rgb(100,100,100)",o.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"},o.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"},o.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(*)*"},o.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"}},7228:(t,e,n)=>{"use strict";n.d(e,{DC:()=>r,JN:()=>l,Xk:()=>a});var i=n(976),s=(n(4469),n(1047)),o=(n(585),function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))});const r=["symbol","name","molfile","rgroups","polymerType","monomerType"];function a(t){const e=[];for(let n=0;n<t.rowCount;n++){const i={};Object.keys(s.K4).forEach((e=>{if("symbol"===e){const o=t.get(s.K4[e],n);i[e]="."===o?t.get(s.At,n):o}else if("rgroups"===e){const o=t.get(s.K4[e],n).split("\n"),r=[];o.forEach((t=>{const e={},n=t.substring(t.lastIndexOf("]")+1),i=t.match(/\[R(\d+)\]/)[1];e.capGroupSmiles="H"===n?`[*:${i}][H]`:`O[*:${i}]`,e.alternateId="H"===n?`R${i}-H`:`R${i}-OH`,e.capGroupName="H"===n?"H":"OH",e.label=`R${i}`,r.push(e)})),i[e]=r}else s.K4[e]&&(i[e]=t.get(s.K4[e],n))})),e.push(i)}return e}function l(){return o(this,void 0,void 0,(function*(){const t=i.Func.find({package:"Bio",name:"getMonomerLibHelper"});if(0===t.length)throw new Error('Package "Bio" must be installer for MonomerLibraryHelper.');return(yield t[0].prepare().call()).getOutputParamValue()}))}},1731:(t,e,n)=>{"use strict";n.d(e,{i0:()=>P});var i=n(4469),s=n(976),o=n(1047),r=n(585),a=n(7767);function l(t){var e;return"string"==typeof t||t instanceof String?t:("object"==typeof t||t instanceof Object)&&"$thrownJsError"in t?l(t.$thrownJsError):t instanceof Error?null!==(e=t.stack)&&void 0!==e?e:t.message:t.toString()}var h=n(499),c=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};const u=8,d="M RGP",f="A ",m=14,p=7,g="\nDatagrok macromolecule handler\n\n",v=" 0 0 0 0 0 0 999 V3000\n",y="M V30 BEGIN CTAB\n",b="M V30 END CTAB\n",w="M V30 COUNTS ",C=" 0 0 0\n",S="M V30 BEGIN ATOM\n",M="M V30 END ATOM\n",x="M V30 BEGIN BOND\n",T="M V30 END BOND\n",N=" CFG=",E="M V30 ",A="M END",I=1e4,L="d",k="r",R="p",_="O",G="H";function P(t,e,n){return c(this,void 0,void 0,(function*(){if(0===s.Func.find({package:"Chem",name:"getRdKitModule"}).length)return{col:null,warnings:['Transformation to atomic level requires the package "Chem" installed.']};if(e.semType!==s.SEMTYPE.MACROMOLECULE)return{col:null,warnings:[`Only the ${s.SEMTYPE.MACROMOLECULE} columns can be converted to atomic level, the chosen column has semType '${e.semType}'`]};let u=e;new h.C(e).isHelm()&&(u=new a.L(e).convert("separator","."),u.name=e.name);const d=new h.C(u).alphabet;let f;if("PT"===d||"UN"===d)f="PEPTIDE";else{if("RNA"!==d&&"DNA"!==d)return{col:null,warnings:[`Unexpected column's '${u.name}' alphabet '${d}'.`]};f="RNA"}const m=function(t){const e=t.length,n=new Array(e),i=t.getTag(s.TAGS.UNITS),o=t.getTag("separator"),a=(0,r.vU)(i,o);for(let i=0;i<e;++i){const e=t.get(i);n[i]=e?a(e).filter((t=>""!==t)):[]}return n}(u),p=yield function(t,e,n,s){return c(this,void 0,void 0,(function*(){const r=function(t,e,n){const i=new Map;for(const s of t.getTypes())for(const r of t.getMonomerNamesByType(s)){const a=t.getMonomer(s,r);if(a.polymerType===e&&("RNA"===e&&("Branch"===a.monomerType||"DNA"===n&&a.symbol===L||"RNA"===n&&a.symbol===k||a.symbol===R)||"PEPTIDE"===e&&"Branch"!==a.monomerType)){const t={};o.rx.forEach((e=>{t[e]=a[e]})),i.set(a.symbol,t)}}return i}(e,n,s),a=new Map,h=yield i.functions.call("Chem:getRdKitModule"),c={value:null};if("RNA"===n){const t="RNA"===s?[k,R]:[L,R];for(const e of t)O(a,e,r,h,n,c)}for(let e=0;e<t.length;++e){const i=t[e];for(const t of i)if(""!==t)try{O(a,t,r,h,n,c)}catch(e){const n=l(e);throw console.error(`bio lib: getMonomersDictFromLib() sym='${t}', error:\n`+n),new Error(`Сan't get monomer '${t}' from library: ${n}`)}}return a}))}(m,n,f,d),g=u.length,v=new Array(g),y=new Array(0);for(let t=0;t<g;++t)try{const e=m[t];v[t]=X(e,p,d,f,0)}catch(e){const n=`Cannot get molfile of row #${t}: ${e instanceof Error?e.message:e.toString()}.`;y.push(n)}if(y.length>.05*g)throw new Error("Too many errors getting molfiles.");const b=`molfile(${u.name})`,w=t.columns.getUnusedName(b),C=s.Column.fromStrings(w,v);return C.semType=s.SEMTYPE.MOLECULE,C.setTag(s.TAGS.UNITS,s.UNITS.Molecule.MOLBLOCK),{col:C,warnings:y}}))}function O(t,e,n,i,s,o){if(!t.has(e)){const r=function(t,e,n,i,s){if(e.has(t)){const o=e.get(t),r=function(t){const e=[];for(const n of t){let t=n.capGroupSmiles;t||(t=n.capGroupSMILES),t=t.replace(/(\[|\]|\*|:|\d)/g,""),e.push(t)}return e}(o.rgroups),a=function(t){const e=new Map;let n=t.indexOf(f,0),i=n;for(;-1!==n;){i=t.indexOf("\n",n);const s=parseInt(t.substring(n,i).replace(/^A\s+/,""));n=t.indexOf("R",i),i=t.indexOf("\n",n);const o=parseInt(t.substring(n,i).replace(/^R/,""));e.set(s,o),n=t.indexOf(f,i)}for(n=t.indexOf(d,0),i=t.indexOf("\n",n);-1!==n;){n+=u,i=t.indexOf("\n",n);const s=t.substring(n,i).replaceAll(/\s+/g," ").split(" ").map((t=>parseInt(t))).slice(1);for(let t=0;t<s.length;t+=2){if(e.has(s[t])&&e.get(s[t])!==s[t+1])throw new Error(`r-group index ${s[t]} has already been added with a different value`);e.set(s[t],s[t+1])}n=t.indexOf(d,i)}return e}(o.molfile),l=function(t,e){const n=e.get_mol(t),i=n.get_v3Kmolblock();return n.delete(),i}(function(t){let e=t.indexOf(f,0);-1===e&&(e=t.indexOf(d));const n=t.indexOf(A,e);return t.substring(0,e)+t.substring(n)}(o.molfile),n),h=function(t){let e=(t=t.replaceAll("\r","")).indexOf(w)+m,n=t.indexOf(" ",e+1);const i=parseInt(t.substring(e,n));return e=n+1,n=t.indexOf(" ",e+1),{atomCount:i,bondCount:parseInt(t.substring(e,n))}}(l),c=function(t,e){const n=new Array(e),i=new Float32Array(e),s=new Float32Array(e),o=new Array(e);let r=t.indexOf(S);r=t.indexOf("\n",r);let a=r;for(let l=0;l<e;l++){r=t.indexOf(E,r)+p,a=t.indexOf(" ",r),r=a+1,a=t.indexOf(" ",r),n[l]=t.substring(r,a);const e=new Array(2);for(let n=0;n<2;++n)r=a+1,a=t.indexOf(" ",r),e[n]=parseFloat(t.substring(r,a));i[l]=e[0],s[l]=e[1],r=a,a=t.indexOf("\n",r)+1,o[l]=t.slice(r,a),r=a}return{atomTypes:n,x:i,y:s,kwargs:o}}(l,h.atomCount),g=function(t,e){const n=new Uint32Array(e),i=new Array(e),s=new Map,o=new Map;let r=t.indexOf(x);r=t.indexOf("\n",r);let a=r;for(let l=0;l<e;++l){const e=new Array(3);r=t.indexOf(E,a)+p,a=t.indexOf(" ",r);for(let n=0;n<3;++n)r=a+1,a=Math.min(t.indexOf("\n",r),t.indexOf(" ",r)),e[n]=parseInt(t.slice(r,a));n[l]=e[0],i[l]=e.slice(1);const h=t.indexOf("\n",r);let c=t.slice(a,h),u=c.indexOf(N);if(-1!==u){u=c.indexOf("=",u)+1;let t=c.indexOf(" ",u);-1===t&&(t=c.length);const e=parseInt(c.slice(u,t));s.set(l,e);const n=N+e.toString();c=c.replace(n,"")}c||o.set(l,c)}return{bondTypes:n,atomPairs:i,bondConfiguration:s,kwargs:o}}(l,h.bondCount),v={atoms:c,bonds:g,meta:F(c,g,r,a)};return"PEPTIDE"===i?function(t){const e=t.meta.terminalNodes[0]-1,n=t.meta.rNodes[0]-1,i=t.atoms.x,s=t.atoms.y;z(t,-i[e],-s[e]);const o=D(i[n],s[n]);B(t.atoms,-o),i[t.meta.rNodes[1]-1]<0&&function(t){Y(t,!1)}(t);const r=function(t){const e=function(t){var e;const n=new Map;for(const i of t.bonds.atomPairs)for(let t=0;t<2;t++){const s=i[t],o=i[(t+1)%2];n.has(s)?null===(e=n.get(s))||void 0===e||e.push(o):n.set(s,new Array(1).fill(o))}return n}(t);let n=0,i=0;for(;0===n;){const s=e.get(t.meta.terminalNodes[1])[i];t.atoms.atomTypes[s-1]===_&&s!==t.meta.rNodes[1]&&(n=s),i++}return n}(t);!function(t,e){t.atoms.y[t.meta.rNodes[1]-1]<0&&t.atoms.y[e-1]<0&&(function(t){Y(t,!0)}(t),B(t.atoms,-function(t,e){return D(t,e)+Math.PI/2}(t.atoms.x[t.meta.terminalNodes[1]-1],t.atoms.y[t.meta.terminalNodes[1]-1])))}(t,r),function(t,e){const n=t.atoms.x;n[t.meta.rNodes[1]-1]>n[e-1]&&function(t,e,n){const i=e-1,s=n-1,o=t.atoms.x,r=t.atoms.y,a=o[i],l=r[i];o[i]=o[s],r[i]=r[s],o[s]=a,r[s]=l}(t,e,t.meta.rNodes[1])}(t,r)}(v):t===k||t===L?function(t,e){const n=t.atoms.x,i=t.atoms.y;let s=t.meta.terminalNodes[0]-1;const o=t.meta.rNodes[1]-1;z(t,-n[s],-i[s]);const r=D(n[o],i[o]);B(t.atoms,3*Math.PI/2-r),e.value=function(t){const e=t.atoms.x,n=t.atoms.y,i=t.meta.rNodes[2]-1,s=t.meta.terminalNodes[2]-1,o=e[i]-e[s],r=n[i]-n[s];return Math.atan(r/o)+Math.PI/2}(t),s=t.meta.terminalNodes[0]-1,z(t,-n[s],-i[s])}(v,s):t===R?function(t){const e=t.meta.terminalNodes[0]-1,n=t.meta.rNodes[0]-1,i=t.atoms.x,s=t.atoms.y;z(t,-i[e],-s[e]);const o=D(i[n],s[n]);B(t.atoms,Math.PI/2-o)}(v):function(t,e){const n=t.atoms.x,i=t.atoms.y,s=t.meta.terminalNodes[0]-1,o=t.meta.rNodes[0]-1;z(t,-n[s],-i[s]);const r=D(n[o],i[o]),a=e.value;if(!a)throw new Error("The value of sugarBranchToOYAngle is null");B(t.atoms,Math.PI-r+a);const l=function(t,e){return et(Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)))}({x:n[t.meta.rNodes[0]-1],y:i[t.meta.rNodes[0]-1]},{x:n[t.meta.terminalNodes[0]-1],y:i[t.meta.terminalNodes[0]-1]});if(1!=l)for(let t=0;t<n.length;++t)n[t]=et(n[t]/l),i[t]=et(i[t]/l)}(v,s),function(t,e,n){"PEPTIDE"===t?(V(e,t),Z(e,e.meta.rNodes[1])):n===k||n===L?(Z(e,e.meta.rNodes[1]),e.meta.rNodes[1]=e.meta.terminalNodes[1],W(e.bonds,e.meta),V(e,t),Z(e,e.meta.rNodes[1]),Z(e,e.meta.rNodes[0]),Z(e,e.meta.rNodes[2])):n===R&&(e.meta.terminalNodes[0]=e.meta.rNodes[0],z(e,-e.atoms.x[e.meta.terminalNodes[0]-1],-e.atoms.y[e.meta.terminalNodes[0]-1]),V(e,t),Z(e,e.meta.rNodes[1]))}(i,v,t),function(t){let e=0;for(;e<t.atoms.atomTypes.length;)t.atoms.atomTypes[e]===G&&(Z(t,e+1),--e),++e}(v),v}return null}(e,n,i,s,o);if(!r)throw new Error(`Monomer with symbol '${e}' is absent the monomer library`);t.set(e,r)}}function F(t,e,n,i){const s={backboneShift:null,branchShift:null,terminalNodes:[],rNodes:[]};return void 0!==n&&void 0!==i?(function(t,e,n){for(const[i,s]of n)t.atomTypes[i-1]=e[s-1]}(t,n,i),function(t,e){e.rNodes=Array.from(t.keys());for(let n=0;n<e.rNodes.length;n++)for(const i of[1,2])if(t.get(e.rNodes[n])===i){const t=e.rNodes[i-1];e.rNodes[i-1]=e.rNodes[n],e.rNodes[n]=t}}(i,s)):s.rNodes=[0,t.x.length],W(e,s),s}function W(t,e){const n=e.rNodes;e.terminalNodes=new Array(n.length).fill(0);const i=e.terminalNodes,s=t.atomPairs;let o=0,r=0;for(;o<s.length&&r<i.length;){for(let t=0;t<i.length;++t)for(let e=0;e<2;++e)s[o][e]===n[t]&&(i[t]=s[o][(e+1)%2],n.length,++r);++o}}function V(t,e){t.meta.rNodes.length>1&&(t.meta.backboneShift=H(t,t.meta.rNodes[1]-1,t.meta.terminalNodes[0]-1)),"RNA"===e&&t.meta.rNodes.length>2&&(t.meta.branchShift=H(t,t.meta.rNodes[2]-1,t.meta.terminalNodes[0]-1))}function H(t,e,n){return[et(t.atoms.x[e]-t.atoms.x[n]),et(t.atoms.y[e]-t.atoms.y[n])]}function Z(t,e){if(void 0!==e){const n=e-1,i=t.atoms,s=t.bonds,o=t.meta;i.atomTypes.splice(n,1),i.x=U(Float32Array,i.x,n,1),i.y=U(Float32Array,i.y,n,1),i.kwargs.splice(n,1);for(let t=0;t<o.terminalNodes.length;++t)o.terminalNodes[t]>e?--o.terminalNodes[t]:o.terminalNodes[t]===e&&(o.terminalNodes[t]=-1);for(let t=0;t<o.rNodes.length;++t)o.rNodes[t]>e?--o.rNodes[t]:o.rNodes[t]===e&&(o.rNodes[t]=-1);let r=0;for(;r<s.atomPairs.length;){const t=s.atomPairs[r][0],n=s.atomPairs[r][1];t===e||n===e?(s.atomPairs.splice(r,1),s.bondTypes=U(Uint32Array,s.bondTypes,r,1),s.bondConfiguration.has(r)&&s.bondConfiguration.delete(r),s.kwargs.has(r)&&s.kwargs.delete(r),--r):(s.atomPairs[r][0]=t>e?t-1:t,s.atomPairs[r][1]=n>e?n-1:n),++r}let a=Array.from(s.bondConfiguration.keys());a.forEach((t=>{if(s.bondConfiguration.has(t)&&t>n){const e=s.bondConfiguration.get(t);s.bondConfiguration.delete(t),s.bondConfiguration.set(t-1,e)}})),a=Array.from(s.kwargs.keys()),a.forEach((t=>{if(s.kwargs.has(t)&&t>n){const e=s.kwargs.get(t);s.kwargs.delete(t),s.kwargs.set(t-1,e)}}))}}function U(t,e,n,i){const s=new t(e.length-i);let o=0,r=0;for(;o<e.length;)o===n&&(o+=i),s[r]=e[o],++r,++o;return s}function D(t,e){let n;if(0===t)n=e>0?0:Math.PI;else if(0===e)n=t>0?-Math.PI/2:Math.PI/2;else{const i=e/t,s=Math.atan(i);n=t<0?Math.PI/2+s:-Math.PI/2+s}return n}function B(t,e){if(0!==e){const n=t.x,i=t.y,s=Math.cos(e),o=Math.sin(e);for(let t=0;t<n.length;++t){const e=n[t];n[t]=et(e*s-i[t]*o),i[t]=et(e*o+i[t]*s)}}}function Y(t,e){if(e){const e=t.atoms.y;for(let t=0;t<e.length;t++)e[t]=-e[t]}else{const e=t.atoms.x;for(let t=0;t<e.length;t++)e[t]=-e[t]}const n=t.bonds.bondConfiguration;for(const[t,e]of n){const i=1===e?3:1;n.set(t,i)}}function z(t,e,n){const i=t.atoms.x,s=t.atoms.y;for(let t=0;t<i.length;++t)i[t]=et(i[t]+e),void 0!==n&&(s[t]=et(s[t]+n))}function X(t,e,n,i,s){if(0===t.length)return"";const o=0===s?tt:nt,{atomCount:r,bondCount:a}=o(t,e,n,i,s),l=new Array(r),h=new Array(a);let c,u=null,d=null;0===s?"PEPTIDE"===i?c=q:(c=$,u="DNA"===n?e.get(L):e.get(k),d=e.get(R)):c=K;const f={i:0,nodeShift:0,bondShift:0,backbonePositionShift:new Array(2).fill(0),branchPositionShift:new Array(2).fill(0),backboneAttachNode:0,branchAttachNode:0,flipFactor:1},m={sugar:u,phosphate:d,seqLength:t.length,atomCount:r,bondCount:a};for(f.i=0;f.i<m.seqLength;++f.i)c(e.get(t[f.i]),l,h,f,m);!function(t,e,n,i,s){if(0===s){const s=n.nodeShift+1;t[i.atomCount]=E+s+" "+_+" "+et(n.backbonePositionShift[0])+" "+n.flipFactor*et(n.backbonePositionShift[1])+" 0.000000 0\n";const o=n.backboneAttachNode,r=s;e[i.bondCount]=E+n.bondShift+" 1 "+o+" "+r+"\n"}}(l,h,f,m,s);let p="";return p+=g,p+=v,p+=y,p+=w+r+" "+a+C,p+=S,p+=l.join(""),p+=M,p+=x,p+=h.join(""),p+=T,p+=b,p+=A,p}function q(t,e,n,i){i.flipFactor=Math.pow(-1,i.i%2),j(t,e,n,i)}function K(t,e,n,i){J(t,e,n,i)}function j(t,e,n,i){!function(t,e,n){for(let i=0;i<t.atoms.atomTypes.length;++i){const s=n.nodeShift+i+1;e[n.nodeShift+i]=E+s+" "+t.atoms.atomTypes[i]+" "+et(n.backbonePositionShift[0]+t.atoms.x[i])+" "+et(n.backbonePositionShift[1]+n.flipFactor*t.atoms.y[i])+" "+t.atoms.kwargs[i]}}(t,e,i),Q(t,n,i),function(t,e,n){if(0!==n.backboneAttachNode){const i=n.bondShift,s=n.backboneAttachNode,o=t.meta.terminalNodes[0]+n.nodeShift;e[n.bondShift-1]=E+i+" 1 "+s+" "+o+"\n"}}(t,n,i),null!==t.meta.branchShift&&t.meta.terminalNodes.length>2&&function(t,e){e.branchAttachNode=e.nodeShift+t.meta.terminalNodes[2];for(let n=0;n<2;++n)e.branchPositionShift[n]=e.backbonePositionShift[n]+t.meta.branchShift[n]}(t,i),function(t,e){e.backboneAttachNode=e.nodeShift+t.meta.terminalNodes[1],e.bondShift+=t.bonds.atomPairs.length+1,e.nodeShift+=t.atoms.atomTypes.length,e.backbonePositionShift[0]+=t.meta.backboneShift[0],e.backbonePositionShift[1]+=e.flipFactor*t.meta.backboneShift[1]}(t,i)}function $(t,e,n,i,s){if(0===i.i)j(s.sugar,e,n,i);else for(const t of[s.phosphate,s.sugar])j(t,e,n,i);J(t,e,n,i)}function J(t,e,n,i){!function(t,e,n){for(let i=0;i<t.atoms.atomTypes.length;++i){const s=n.nodeShift+i+1;e[n.nodeShift+i]=E+s+" "+t.atoms.atomTypes[i]+" "+et(n.branchPositionShift[0]+t.atoms.x[i])+" "+et(n.branchPositionShift[1]+n.flipFactor*t.atoms.y[i])+" "+t.atoms.kwargs[i]}}(t,e,i),Q(t,n,i),function(t,e,n){const i=n.bondShift,s=n.branchAttachNode,o=t.meta.terminalNodes[0]+n.nodeShift;e[i-1]=E+i+" 1 "+s+" "+o+"\n"}(t,n,i);const s=i.bondShift,o=i.branchAttachNode,r=t.meta.terminalNodes[0]+i.nodeShift;n[s-1]=E+s+" 1 "+o+" "+r+"\n",i.bondShift+=t.bonds.atomPairs.length+1,i.nodeShift+=t.atoms.atomTypes.length}function Q(t,e,n){for(let i=0;i<t.bonds.atomPairs.length;++i){const s=n.bondShift+i+1,o=t.bonds.atomPairs[i][0]+n.nodeShift,r=t.bonds.atomPairs[i][1]+n.nodeShift;let a="";if(t.bonds.bondConfiguration.has(i)){let e=t.bonds.bondConfiguration.get(i);n.flipFactor<0&&(e=1===e?3:1),a=" CFG="+e}const l=t.bonds.kwargs.has(i)?" "+t.bonds.kwargs.get(i):"";e[n.bondShift+i]=E+s+" "+t.bonds.bondTypes[i]+" "+o+" "+r+a+l+"\n"}}function tt(t,e,n,i,s){let o=0,r=0;for(const n of t){if(""===n)continue;const t=e.get(n);o+=t.atoms.x.length,r+=t.bonds.bondTypes.length}if(0===s)if("PEPTIDE"===i)o+=1,r+=t.length;else{const i="DNA"===n?e.get(L):e.get(k),s=e.get(R);o+=(t.length-1)*s.atoms.x.length,o+=t.length*i.atoms.x.length,o+=1,r+=(t.length-1)*s.bonds.bondTypes.length,r+=t.length*i.bonds.bondTypes.length,r-=1,r+=3*t.length}return{atomCount:o,bondCount:r}}function et(t){return Math.round(I*t)/I}function nt(t,e,n,i){let s=0,o=0;for(const n of t){const t=e.get(n);s+=t.atoms.x.length,o+=t.bonds.bondTypes.length}if("PEPTIDE"===i)s+=1,o+=t.length;else{const i="DNA"===n?e.get(L):e.get(k),r=e.get(R);s+=t.length*(r.atoms.x.length+i.atoms.x.length),s+=1,o+=t.length*(r.bonds.bondTypes.length+i.bonds.bondTypes.length),o+=3*t.length}return{atomCount:s,bondCount:o}}},6137:(t,e,n)=>{"use strict";n.d(e,{J:()=>s});var i=n(9976);class s extends i.B{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new s({A:"green",C:"blue",G:"black",T:"red",U:"red",others:"gray"})),this.chromatogram}}class o{}o.SemType="Nucleotides",o.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",o.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"}},9976:(t,e,n)=>{"use strict";n.d(e,{B:()=>i});class i{static makePalette(t,e=!1,n=i){const s={};return t.forEach((t=>{const n=t[0],i=t[1];n.forEach(((t,n)=>{s[t]=this.colourPalette[i][e?0:n]}))})),new n(s)}constructor(t){this._palette=t}get(t){return this._palette[t]}}i.undefinedColor="rgb(100,100,100)",i.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)"]}},6535:(t,e,n)=>{"use strict";n.d(e,{H:()=>i});class i{get data(){return this._data}get size(){return this._size}constructor(t,e){if(null==e){if(null==t)throw new Error("Arguments error: data or size is required.");if(this._data=t,this._size=(1+Math.sqrt(1+8*this._data.length))/2,this._size!=Math.floor(this._size))throw new Error(`Invalid data length ${this._data.length} leads to non integer size ${this._size}`)}else{this._size=e;const n=e*(e-1)/2;if(t){if(t.length!=n)throw new Error(`Invalid data length. Observations size ${e} requires data length ${n}.`);this._data=t}else this._data=new Float32Array(n)}}_linearizeIJ(t,e){if(!(t<e))throw new Error("i must be less than j");return this._size*t+e-Math.floor((t+2)*(t+1)/2)}get(t,e){return t==e?0:t<e?this._data[this._linearizeIJ(t,e)]:this._data[this._linearizeIJ(e,t)]}set(t,e,n){this._data[this._linearizeIJ(t,e)]=n}static calc(t,e){const n=t.length,s=new i(void 0,n);for(let i=0;i<n;i++)for(let o=i+1;o<n;o++)s.set(i,o,e(t[i],t[o]));return s}square(){for(let t=0;t<this._data.length;t++)this._data[t]=Math.pow(this._data[t],2)}add(t){if(this._size!==t._size)throw new Error(`Matrices must have the same size. This size: ${this._size}, other size: ${t._size}`);for(let e=0;e<this._data.length;e++)this._data[e]+=t._data[e]}sqrt(){for(let t=0;t<this._data.length;t++)this._data[t]=Math.sqrt(this._data[t])}normalize(){let t=this._data[0],e=this._data[0];for(let n=0;n<this._data.length;n++)this._data[n]<t&&(t=this._data[n]),this._data[n]>e&&(e=this._data[n]);const n=e-t;for(let i=0;i<this._data.length;i++)this._data[i]=0===n?this._data[i]-t:(this._data[i]-t)/(e-t)}}},7331:(t,e,n)=>{"use strict";n.d(e,{UE:()=>h});var i=n(976),s=n(9976);class o{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 r{}class a extends r{get(t){return"#666666"}}class l extends r{static buildPalette(){return[].concat(...Object.values(s.B.colourPalette))}get(t){const e=o.hashCode(t)%l.palette.length;return function(t){if(null==t)return"rgb(100,100,100)";const e=i.Color.fromHtml(t),n=i.Color.g(e),s=i.Color.r(e),o=i.Color.b(e),r=Math.sqrt(Math.pow(0-s,2)+Math.pow(0-n,2)+Math.pow(0-o,2));return r>210?`rgb(${s/r*210},${n/r*210},${o/r*210})`:i.Color.toRgb(e)}(l.palette[e])}}l.palette=l.buildPalette();class h extends s.B{static get Gray(){return void 0===this.gray&&(this.gray=new a),this.gray}static get Color(){return void 0===this.color&&(this.color=new l),this.color}}},1047:(t,e,n)=>{"use strict";n.d(e,{At:()=>s,K4:()=>o,rx:()=>i});const i=["symbol","molfile","rgroups","name"],s="MonomerName",o={monomerType:null,smiles:null,name:"MonomerName",author:null,molfile:"molecule",naturalAnalog:"MonomerNaturalAnalogCode",rgroups:"MonomerCaps",createDate:null,id:null,polymerType:"MonomerType",symbol:"MonomerCode"}},5226:(t,e,n)=>{"use strict";n.d(e,{i:()=>o});var i=n(976),s=n(499);class o{get descriptionsArray(){return this._descriptionsArray}get sequencesArray(){return this._sequencesArray}parseMacromolecule(t,e){return this._fileContent.slice(t,e).split(/\s/).join("")}parseColumns(){const t=/^>(.*)$/gm;let e,n=0;for(;e=t.exec(this._fileContent);){const i=this._fileContent.substring(e.index+1,t.lastIndex);this._descriptionsArray.push(i),0!==n&&this._sequencesArray.push(this.parseMacromolecule(n,e.index)),n=t.lastIndex+1}this._sequencesArray.push(this.parseMacromolecule(n,-1))}importFasta(){const t=i.Column.fromStrings("description",this.descriptionsArray),e=i.Column.fromStrings("sequence",this.sequencesArray);return e.semType=i.SEMTYPE.MACROMOLECULE,e.setTag(i.TAGS.UNITS,"fasta"),s.C.setUnitsToFastaColumn(e),[i.DataFrame.fromColumns([t,e])]}constructor(t){this._descriptionsArray=[],this._sequencesArray=[],this._fileContent=t,this.parseColumns()}}},1821:(t,e,n)=>{"use strict";n.d(e,{BM:()=>s,XS:()=>r});var i=n(6286);const s=/\[(\w+)\]|(\w)|(-)/g,o=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"])}}},r=[new i.L("PT",o.fasta.peptide,.5),new i.L("DNA",o.fasta.dna,.55),new i.L("RNA",o.fasta.rna,.55)]},8447:(t,e,n)=>{"use strict";n.d(e,{GU:()=>i.GU,dQ:()=>i.dQ,fy:()=>i.fy,gP:()=>i.gP,kB:()=>i.kB,py:()=>i.py,up:()=>i.up,vU:()=>i.vU});var i=n(585)},6286:(t,e,n)=>{"use strict";n.d(e,{L:()=>i,d:()=>s});class i{constructor(t,e,n){this.name=t,this.alphabet=e,this.cutoff=n}}class s extends i{constructor(t,e,n){super(t.name,t.alphabet,t.cutoff),this.freq=e,this.similarity=n}}},585:(t,e,n)=>{"use strict";n.d(e,{Ar:()=>g,GU:()=>M,Mj:()=>C,dQ:()=>T,fy:()=>m,gP:()=>b,kB:()=>p,py:()=>N,up:()=>E,vU:()=>w,w4:()=>x});var i=n(976),s=n(6414),o=n.n(s),r=n(6286),a=n(1821),l=n(499),h=n(8867),c=n(7997),u=n(2012),d=n(6137),f=n(7331);function m(t,e,n){const i={};let s=!0,o=null;for(const r of t.categories){const t=n(r);if(null==o?o=t.length:t.length!==o&&(s=!1),t.length>=e)for(const e of t)e in i||(i[e]=0),i[e]+=1}return{freq:i,sameLength:s}}function p(t){return o()(t.toString().matchAll(a.BM)).map((t=>{const e=t[0];return e.length>1?t[1]:e})).toArray()}function g(t,e=undefined){return n=>n.split(t,e)}const v=/(PEPTIDE1|DNA1|RNA1)\{([^}]+)}/g,y=/\[([^\[\]]+)]/g;function b(t){v.lastIndex=0;const e=v.exec(t.toString()),n=e?e[2]:null;return(n?n.split("."):[]).map((t=>{y.lastIndex=0;const e=y.exec(t);return e&&e.length>=2?e[1]:t}))}function w(t,e,n=undefined){if(t.toLowerCase().startsWith("fasta"))return p;if(t.toLowerCase().startsWith("separator"))return g(e,n);if(t.toLowerCase().startsWith("helm"))return b;throw new Error(`Unexpected units ${t} .`)}function C(t){if(t.semType!==i.SEMTYPE.MACROMOLECULE)throw new Error(`Get splitter for semType "${i.SEMTYPE.MACROMOLECULE}" only.`);return w(t.getTag(i.TAGS.UNITS),t.getTag("separator"))}const S=/(\w+)/g;function M(t,e){var n,i;const s=t.match(S),o=t.length>e||(null!==(n=null==s?void 0:s.length)&&void 0!==n?n:0)>1,r=null!==(i=null==s?void 0:s[0])&&void 0!==i?i:" ";return o?r.substring(0,e)+"…":r}function x(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 s=[],o=[];for(const n of i)s.push(n in t?t[n]:0),o.push(e.has(n)?1:0);const r=new h.OW(s),a=new h.OW(o);return(0,c.MA)(r,a)/((0,c.$G)(r)*(0,c.$G)(a))}(t,e.alphabet,n);return new r.d(e,t,i)}));let s;const o=Math.max(...i.map((t=>t.similarity>t.cutoff?t.similarity:-1)));return s=o>0?i.find((t=>t.similarity===o)).name:"UN",s}function T(t,e=5){let n;return n=t.semType==i.SEMTYPE.MACROMOLECULE?new l.C(t).alphabet:x(m(t,e,p).freq,a.XS),N(n)}function N(t){switch(t){case"PT":return u.f.GrokGroups;case"DNA":case"RNA":return d.J.Chromatogram;default:return f.UE.Color}}function E(t){var e;const n=t.columns.bySemTypeAll(i.SEMTYPE.MACROMOLECULE);let s=null!==(e=n.find((t=>{const e=t.getTag(i.TAGS.UNITS);return!!e&&-1!==e.indexOf("MSA")})))&&void 0!==e?e:null;return!s&&n.length>0&&(s=n[0]),s}},7767:(t,e,n)=>{"use strict";n.d(e,{L:()=>r});var i=n(976),s=n(499),o=n(585);class r extends s.C{get splitter(){return null===this._splitter&&(this._splitter=(0,o.Mj)(this.column)),this._splitter}toFasta(t){return"fasta"===t}toSeparator(t){return"separator"===t}toHelm(t){return"helm"===t}convertFastaToSeparator(t,e=null){null===e&&(e=this.defaultGapSymbol);const n=this.getNewColumn("separator",t);return n.init((n=>{const i=this.column.get(n),o=this.splitter(i);for(let t=0;t<o.length;t++)o[t]===e&&(o[t]=s.C._defaultGapSymbolsDict.SEPARATOR);return o.join(t)})),n.setTag(i.TAGS.UNITS,"separator"),n}getHelmWrappers(){const t=this.isDna()?"DNA1{":this.isRna()||this.isHelmCompatible()?"RNA1{":this.isPeptide()?"PEPTIDE1{":"Unknown";if("Unknown"===t)throw new Error("Neither peptide, nor nucleotide");return[t,this.isDna()?"D(":this.isRna()?"R(":"",this.isDna()||this.isRna()?")P":"","}$$$$"]}convertToHelmHelper(t,e,n,i,o,r){return`${n}${this.splitter(t).map((t=>t===e?s.C._defaultGapSymbolsDict.HELM:`${i}${t}${o}`)).join(".")}${r}`}convertStringToHelm(t,e=null){null===e&&(e=this.defaultGapSymbol);const[n,i,s,o]=this.getHelmWrappers();return this.convertToHelmHelper(t,e,n,i,s,o)}convertToHelm(t=null){null===t&&(t=this.defaultGapSymbol);const[e,n,s,o]=this.getHelmWrappers(),r=this.getNewColumn("helm");return r.init((i=>{const r=this.column.get(i);return this.convertToHelmHelper(r,t,e,n,s,o)})),r.setTag(i.TAGS.UNITS,"helm"),r}convertSeparatorToFasta(t=null){null===t&&(t=s.C._defaultGapSymbolsDict.FASTA);const e=this.getNewColumn("fasta");return e.init((e=>{const n=this.column.get(e),i=this.splitter(n),s=[];for(let e=0;e<i.length;e++){const n=i[e];if(0===n.length)s.push(t);else if(n.length>1){const t="["+n+"]";s.push(t)}else s.push(n)}return s.join("")})),e.setTag(i.TAGS.UNITS,"fasta"),e}convertHelmToFastaSeparator(t,e,n,i){i||(i=this.toFasta(e)?s.C._defaultGapSymbolsDict.FASTA:s.C._defaultGapSymbolsDict.SEPARATOR),n||(n=this.toFasta(e)?"":this.separator);const o=/(R\(|D\(|\)|P)/g,r=t.startsWith("DNA")||t.startsWith("RNA"),a=this.splitter(t),l=[];for(let t=0;t<a.length;t++){let n=a[t];if(r&&(n=n.replace(o,"")),n===s.C._defaultGapSymbolsDict.HELM)l.push(i);else if(this.toFasta(e)&&n.length>1){const t="["+n+"]";l.push(t)}else l.push(n)}return l.join(n)}convertHelm(t,e,n){const i=this.getNewColumn(t,e);i.init((i=>{const s=this.column.get(i);return this.convertHelmToFastaSeparator(s,t,e,n)}));const s=(0,o.Mj)(i),r=(0,o.fy)(i,5,s).sameLength?"SEQ.MSA":"SEQ";return i.setTag("aligned",r),i}convertHelmToSeparator(){return this.getNewColumn("separator")}convert(t,e=null){if(this.notation===t)throw new Error("tgt notation is invalid");if(this.toSeparator(t)&&null===e)throw new Error("tgt separator is not specified");if(this.isFasta()&&this.toSeparator(t)&&null!==e)return this.convertFastaToSeparator(e);if((this.isFasta()||this.isSeparator())&&this.toHelm(t))return this.convertToHelm();if(this.isSeparator()&&this.toFasta(t))return this.convertSeparatorToFasta();if(this.isHelm()&&this.toFasta(t))return this.convertHelm(t);if(this.isHelm()&&this.toSeparator(t))return this.convertHelm(t,e);throw new Error(`Not supported conversion from source notation '${this.notation}' to target notation '${t}'.`)}constructor(t){super(t),this._splitter=null}}},499:(t,e,n)=>{"use strict";n.d(e,{C:()=>l});var i=n(976),s=n(1821),o=n(585),r=n(489),a=n(7228);class l{static setUnitsToFastaColumn(t){if(t.semType!==i.SEMTYPE.MACROMOLECULE||"fasta"!==t.getTag(i.TAGS.UNITS))throw new Error(`The column of notation 'fasta' must be '${i.SEMTYPE.MACROMOLECULE}'.`);t.setTag(i.TAGS.UNITS,"fasta"),l.setTags(t,o.kB)}static setUnitsToSeparatorColumn(t,e){if(t.semType!==i.SEMTYPE.MACROMOLECULE||"separator"!==t.getTag(i.TAGS.UNITS))throw new Error(`The column of notation 'separator' must be '${i.SEMTYPE.MACROMOLECULE}'.`);if(!e)throw new Error("The column of notation 'separator' must have the separator tag.");t.setTag(i.TAGS.UNITS,"separator"),t.setTag("separator",e),l.setTags(t,(0,o.Ar)(e))}static setUnitsToHelmColumn(t){if(t.semType!==i.SEMTYPE.MACROMOLECULE)throw new Error(`The column of notation 'helm' must be '${i.SEMTYPE.MACROMOLECULE}'`);t.setTag(i.TAGS.UNITS,"helm"),l.setTags(t,o.gP)}static setTags(t,e){const n=t.getTag(i.TAGS.UNITS),r=(0,o.fy)(t,5,e);if(Object.keys(r.freq).some((t=>t.length>1)),["fasta","separator"].includes(n)){if(0===Object.keys(r.freq).length)throw new Error("Alphabet is empty");const e=r.sameLength?"SEQ.MSA":"SEQ";t.setTag("aligned",e);const n=(0,o.w4)(r.freq,s.XS);if(t.setTag("alphabet",n),"UN"===n){const e=Object.keys(r.freq).length,n=Object.keys(r.freq).some((t=>t.length>1));t.setTag(".alphabetSize",e.toString()),t.setTag(".alphabetIsMultichar",n?"true":"false")}}}get units(){return this._units}get column(){return this._column}get notation(){return this._notation}get defaultGapSymbol(){return this._defaultGapSymbol}get separator(){var t;const e=null!==(t=this.column.getTag("separator"))&&void 0!==t?t:void 0;if("separator"===this.notation&&void 0===e)throw new Error(`Separator is mandatory for column '${this.column.name}' of notation '${this.notation}'.`);return e}get aligned(){const t=this.column.getTag("aligned");if(!t&&(this.isFasta()||this.isSeparator()))throw new Error("Tag aligned not set");return t}get alphabet(){const t=this.column.getTag("alphabet");if(!t&&(this.isFasta()||this.isSeparator()))throw new Error("Tag alphabet not set");return t}get helmCompatible(){return this.column.getTag(".isHelmCompatible")}getAlphabetSize(){if("helm"==this.notation||"UN"==this.alphabet){const t=this.column.getTag(".alphabetSize");let e;if(t)e=parseInt(t);else{const t=(0,o.Mj)(this.column),n=(0,o.fy)(this.column,1,t);e=Object.keys(n.freq).length}return e}switch(this.alphabet){case"PT":return 20;case"DNA":case"RNA":return 4;case"NT":return console.warn("Unexpected alphabet 'NT'."),4;default:throw new Error(`Unexpected alphabet '${this.alphabet}'.`)}}getAlphabetIsMultichar(){return"helm"===this.notation||"UN"===this.alphabet&&"true"===this.column.getTag(".alphabetIsMultichar")}isFasta(){return"fasta"===this.notation}isSeparator(){return"separator"===this.notation}isHelm(){return"helm"===this.notation}isRna(){return"RNA"===this.alphabet}isDna(){return"DNA"===this.alphabet}isPeptide(){return"PT"===this.alphabet}isMsa(){return!!this.aligned&&this.aligned.toUpperCase().includes("MSA")}isHelmCompatible(){return"true"===this.helmCompatible}getNotation(){if(this.units.toLowerCase().startsWith("fasta"))return"fasta";if(this.units.toLowerCase().startsWith("separator"))return"separator";if(this.units.toLowerCase().startsWith("helm"))return"helm";throw new Error(`Column '${this.column.name}' has unexpected notation '${this.units}'.`)}getNewColumn(t,e){const n=this.column,s=n.length,o=t.toLowerCase()+"("+n.name+")",r=n.dataFrame.columns.getUnusedName(o),a=i.Column.fromList("string",r,new Array(s).fill(""));if(a.semType=i.SEMTYPE.MACROMOLECULE,a.setTag(i.TAGS.UNITS,t),"separator"===t){if(!e)throw new Error("Notation 'separator' requires separator value.");a.setTag("separator",e)}a.setTag(i.TAGS.CELL_RENDERER,"Macromolecule");const l=n.getTag("aligned");l&&a.setTag("aligned",l);const h=n.getTag("alphabet");h&&a.setTag("alphabet",h);let c=n.getTag(".alphabetSize");c&&a.setTag(".alphabetSize",c);const u=n.getTag(".alphabetIsMultichar");return void 0!==u&&a.setTag(".alphabetIsMultichar",u),"helm"==t&&(c=this.getAlphabetSize().toString(),a.setTag(".alphabetSize",c)),a}static getNewColumn(t){const e=new l(t),n=e.notation;return e.getNewColumn(n)}static unitsStringIsValid(t){return t=t.toLowerCase(),["fasta","separator","helm"].some((e=>t.startsWith(e.toLowerCase())))}static getNewColumnFromParams(t,e,n){if(!l.unitsStringIsValid(n))throw new Error("Invalid format of 'units' parameter");const s=i.Column.fromList("string",e,new Array(t).fill(""));return s.semType=i.SEMTYPE.MACROMOLECULE,s.setTag(i.TAGS.UNITS,n),s}getDistanceFunctionName(){if(!this.isFasta())throw new Error("Only FASTA notation is supported");if(this.isMsa())return r.U.HAMMING;switch(this.alphabet){case"DNA":case"RNA":default:return r.U.LEVENSHTEIN;case"PT":return r.U.NEEDLEMANN_WUNSCH}}getDistanceFunction(){return r.o[this.getDistanceFunctionName()]()}checkHelmCompatibility(){return t=this,e=void 0,i=function*(){if(this.column.tags.has(".isHelmCompatible"))return"true"===this.column.getTag(".isHelmCompatible");const t=(yield(0,a.JN)()).getBioLib().getMonomerNamesByType("PEPTIDE".toString()),e=new Set(t),n=(0,o.Ar)(this.separator);for(const t of this.column.categories){const i=n(t);for(const t of i)if(!e.has(t))return this.column.setTag(".isHelmCompatible","false"),!1}return this.column.setTag(".isHelmCompatible","true"),!0},new((n=void 0)||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}));var t,e,n,i}constructor(t){this._column=t;const e=this._column.getTag(i.TAGS.UNITS);if(null==e)throw new Error("Units are not specified in column");if(this._units=e,this._notation=this.getNotation(),this._defaultGapSymbol=this.isFasta()?l._defaultGapSymbolsDict.FASTA:this.isHelm()?l._defaultGapSymbolsDict.HELM:l._defaultGapSymbolsDict.SEPARATOR,!this.column.tags.has("aligned")||!this.column.tags.has("alphabet")||!this.column.tags.has(".alphabetIsMultichar")&&!this.isHelm()&&"UN"===this.alphabet)if(this.isFasta())l.setUnitsToFastaColumn(this.column);else if(this.isSeparator()){const e=t.getTag("separator");l.setUnitsToSeparatorColumn(this.column,e)}else{if(!this.isHelm())throw new Error(`Unexpected units '${this.column.getTag(i.TAGS.UNITS)}'.`);l.setUnitsToHelmColumn(this.column)}if(!this.column.tags.has(".alphabetIsMultichar"))if(this.isHelm())this.column.setTag(".alphabetIsMultichar","true");else if(["UN"].includes(this.alphabet))throw new Error(`For column '${this.column.name}' of alphabet '${this.alphabet}' tag '.alphabetIsMultichar' is mandatory.`)}}l._defaultGapSymbolsDict={HELM:"*",SEPARATOR:"",FASTA:"-"}},9298:(t,e,n)=>{"use strict";var i,s,o,r,a;n.d(e,{CI:()=>h,Ct:()=>a,DX:()=>c,ES:()=>i,dE:()=>r,iD:()=>o,vS:()=>l,vw:()=>s}),function(t){t.Entropy="Entropy",t.full="100%"}(i||(i={})),function(t){t.TOP="top",t.MIDDLE="middle",t.BOTTOM="bottom"}(s||(s={})),function(t){t.LEFT="left",t.CENTER="center",t.RIGHT="right"}(o||(o={})),function(t){t.AUTO="auto",t.ON="on",t.OFF="off"}(r||(r={})),function(t){t.Filtered="Filtered",t.Selected="Selected"}(a||(a={}));const l=new class{constructor(){this.sequenceColumnName=null,this.startPositionName=null,this.endPositionName=null,this.skipEmptySequences=!0,this.skipEmptyPositions=!1,this.shrinkEmptyTail=!0,this.backgroundColor=4294967295,this.positionHeight=i.full,this.positionWidth=16,this.verticalAlignment=s.MIDDLE,this.horizontalAlignment=o.CENTER,this.fixWidth=!1,this.fitArea=!0,this.minHeight=50,this.maxHeight=100,this.positionMarginState=r.AUTO,this.positionMargin=0,this.filterSource=a.Filtered}},h=", ";var c;!function(t){t.positionNames=".positionNames"}(c||(c={}))},5697:(t,e,n)=>{"use strict";n.d(e,{Dz:()=>p,KR:()=>r,MI:()=>v,NB:()=>u,Om:()=>y,Rt:()=>o,UX:()=>c,WI:()=>h,Zd:()=>l,_h:()=>a,aW:()=>f,fX:()=>g,kg:()=>s,s:()=>d,yU:()=>m});var i=n(1040);i.gk.Tanimoto,i.gk.Dice,i.gk.Asymmetric,i.gk.BraunBlanquet,i.gk.Cosine,i.gk.Kulczynski,i.gk.McConnaughey,i.gk.RogotGoldberg,i.gk.Russel,i.gk.Sokal,i.gk.Hamming,i.gk.Euclidean,i.gk.Tanimoto,i.gk.Dice,i.gk.Asymmetric,i.gk.BraunBlanquet,i.gk.Cosine,i.gk.Kulczynski,i.gk.McConnaughey,i.gk.RogotGoldberg,i.gk.Russel,i.gk.Sokal,i.gk.Hamming,i.gk.Euclidean;const s=[i.gk.Tanimoto,i.gk.Dice,i.gk.Cosine],o=[i.gk.Tanimoto,i.gk.Asymmetric,i.gk.Cosine,i.gk.Sokal];function r(t,e){return b(function(t,e){const n=t.trueCount()+e.trueCount();if(0==n)return 1;const i=t.andWithCountBits(e,!0);return i/(n-i)}(t,e))}function a(t,e){return b(function(t,e){const n=t.trueCount()+e.trueCount();return 0==n?0:2*t.andWithCountBits(e,!0)/n}(t,e))}function l(t,e){return b(function(t,e){const n=t.trueCount()*e.trueCount();return 0==n?0:t.andWithCountBits(e,!0)/Math.sqrt(n)}(t,e))}function h(t,e){return Math.sqrt(t.trueCount()+e.trueCount()-2*t.andWithCountBits(e,!0))}function c(t,e){return t.trueCount()+e.trueCount()-2*t.andWithCountBits(e,!0)}function u(t,e){return b(function(t,e){const n=t.trueCount()+e.trueCount(),i=t.andWithCountBits(e,!0);return i/(2*n-3*i)}(t,e))}function d(t,e){return b(function(t,e){const n=t.trueCount()+e.trueCount(),i=t.trueCount()*e.trueCount();return 0==i?0:t.andWithCountBits(e,!0)*n/(2*i)}(t,e))}function f(t,e){return b(function(t,e){const n=t.trueCount()+e.trueCount(),i=t.trueCount()*e.trueCount();return 0==i?0:(t.andWithCountBits(e,!0)*n-i)/i}(t,e))}function m(t,e){return b(function(t,e){const n=Math.min(t.trueCount(),e.trueCount());return 0==n?0:t.andWithCountBits(e,!0)/n}(t,e))}function p(t,e){return b(function(t,e){const n=Math.max(t.trueCount(),e.trueCount());return 0==n?0:t.andWithCountBits(e,!0)/n}(t,e))}function g(t,e){return b(function(t,e){return 0==t.length?0:t.andWithCountBits(e,!0)/t.length}(t,e))}function v(t,e){return b(function(t,e){const n=t.andWithCountBits(e,!0),i=t.countBits(!0)+e.countBits(!0),s=t.length,o=s-i+n;return n==s||o==s?1:n/i+o/(2*s-i)}(t,e))}function y(t){return 1/(1+t)}function b(t){return 1/t-1}},779:(t,e,n)=>{"use strict";function i(){return(t,e)=>{let n=0;t.length!==e.length&&(n=Math.abs(t.length-e.length));let i=0;for(let n=0;n<Math.min(t.length,e.length);n++)t[n]!==e[n]&&i++;return i+n}}n.d(e,{j:()=>i})},489:(t,e,n)=>{"use strict";n.d(e,{U:()=>i.U,o:()=>i.o});var i=n(5540)},458:(t,e,n)=>{"use strict";n.d(e,{r:()=>s});var i=n(1811);function s(){return(t,e)=>(0,i.T)(t,e)}},5540:(t,e,n)=>{"use strict";n.d(e,{U:()=>i,o:()=>a});var i,s=n(779),o=n(458),r=n(6683);!function(t){t.HAMMING="Hamming",t.LEVENSHTEIN="Levenshtein",t.NEEDLEMANN_WUNSCH="Needlemann-Wunsch"}(i||(i={}));const a={[i.HAMMING]:s.j,[i.LEVENSHTEIN]:o.r,[i.NEEDLEMANN_WUNSCH]:r.n}},6683:(t,e,n)=>{"use strict";n.d(e,{n:()=>s});const i={gapOpen:8,gapExtend:2,scoringMatrix:[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0,-4],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1,-4],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1,-4],[-2,-2,1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1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1,-4],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1,-4],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1,-4],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1,-4],[-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,1]],alphabetIndexes:{A:0,R:1,N:2,D:3,C:4,Q:5,E:6,G:7,H:8,I:9,L:10,K:11,M:12,F:13,P:14,S:15,T:16,W:17,Y:18,V:19,B:20,Z:21,X:22,"*":23}};function s(t){return(e,n)=>{const{gapOpen:s,gapExtend:o,scoringMatrix:r,alphabetIndexes:a}=Object.assign(Object.assign({},i),t),l=[new Array(e.length+1).fill(0),new Array(e.length+1).fill(0)],h=new Array(e.length+1).fill(!1),c=new Array(e.length+1).fill(!1);let u=0,d=1;for(let t=1;t<e.length+1;t++)l[0][t]=-s-(t-1)*o;for(let t=1;t<n.length+1;t++){l[d][0]=-s-(t-1)*o;for(let i=1;i<e.length+1;i++){const f=l[u][i-1]+r[a[e[i-1]]][a[n[t-1]]],m=l[u][i]-(h[i]?o:s),p=l[d][i-1]-(c[i-1]?o:s);l[d][i]=Math.max(f,p,m),l[d][i]===f?(h[i]=!1,c[i]=!1):l[d][i]===p?(h[i]=!1,c[i]=!0):(h[i]=!0,c[i]=!1)}u=d,d=(d+1)%2}return-l[u][e.length]}}},116:(t,e,n)=>{"use strict";var i;n.d(e,{AL:()=>i,aP:()=>o,bD:()=>s}),n(4221),n(7659),n(3659),n(850),n(9006),n(7861),n(9657),function(t){t.UMAP="UMAP",t.T_SNE="t-SNE"}(i||(i={}));class s{constructor(){this.learningRate={uiName:"Learinig rate",value:1,tooltip:"The initial learning rate for the embedding optimization"},this.nComponents={uiName:"Components",value:2,tooltip:"The number of components (dimensions) to project the data to"},this.nEpochs={uiName:"Epochs",value:0,tooltip:"The number of epochs to optimize embeddings via SGD. Computed automatically if set to 0"},this.nNeighbors={uiName:"Neighbors",value:15,tooltip:"The number of nearest neighbors to construct the fuzzy manifold"},this.spread={uiName:"Spread",value:1,tooltip:"The effective scale of embedded points, used with min distance to control the clumped/dispersed nature of the embedding"},this.minDist={uiName:"Min distance",value:.1,tooltip:"The effective minimum distance between embedded points, used with spread to control the clumped/dispersed nature of the embedding"}}}class o{constructor(){this.epsilon={uiName:"Epsilon",value:10,tooltip:"Epsilon is learning rate"},this.perplexity={uiName:"Perplexity",value:30,tooltip:"Roughly how many neighbors each point influences"},this.dim={uiName:"Dimensionality",value:2,tooltip:"Dimensionality of the embedding"}}}},9006:(t,e,n)=>{"use strict";n.d(e,{Ek:()=>r,a1:()=>o,nR:()=>a});var i=n(850),s=n(4588);class o{constructor(t){var e,n,s,o,r,a,l;this.steps=null!==(e=null==t?void 0:t.steps)&&void 0!==e?e:0,this.cycles=null!==(n=null==t?void 0:t.cycles)&&void 0!==n?n:1e6,this.cutoff=null!==(s=null==t?void 0:t.cutoff)&&void 0!==s?s:0,this.lambda=null!==(o=null==t?void 0:t.lambda)&&void 0!==o?o:2,this.dlambda=null!==(r=null==t?void 0:t.dlambda)&&void 0!==r?r:.01,this.lambda2=this.lambda/2,this.dlambda2=this.dlambda/2,this.epsilon=null!==(a=null==t?void 0:t.epsilon)&&void 0!==a?a:1e-10,this.distanceFunction=null!==(l=null==t?void 0:t.distance)&&void 0!==l?l:i.dP,this.distance=[]}initDistance(t){this.distance=(0,i.H3)(t,this.distanceFunction)}calcDistance(t,e,n){return this.distance[e][n]}embed(t){const e=t.length,n=(0,i.kO)(e,o.dimension,40);let r=this.lambda2;0==this.steps&&(this.steps=t.length-1),this.initDistance(t);for(let o=0;o<this.cycles;++o){for(let o=0;o<this.steps;++o){const o=(0,s.I)(e);let a=(0,s.I)(e);for(;o==a;)a=(0,s.I)(e);const l=n[o],h=n[a],c=this.calcDistance(t,o,a),u=(0,i.dP)(l,h);if(0==this.cutoff||c<=this.cutoff||u<c){const t=r*(c-u)/(u+this.epsilon),e=(0,i.On)(l,h,-1);n[o]=(0,i.On)(l,e,t),n[a]=(0,i.On)(h,e,-t)}}if(r-=this.dlambda2,r<=0)break}return n}}o.dimension=2;class r extends o{embed(t){const e=t.length,n=(0,i.kO)(e,r.dimension,40);let o=this.lambda;this.initDistance(t);for(let r=0;r<this.cycles;++r){const r=(0,s.I)(e),a=n[r];for(let s=0;s<e;++s){if(r==s)continue;const e=n[s],l=this.calcDistance(t,r,s),h=(0,i.dP)(a,e);if(0==this.cutoff||l<=this.cutoff||h<l){const t=o*(l-h)/(h+this.epsilon),r=(0,i.On)(a,e,-1);n[s]=(0,i.On)(e,r,-t)}}if(o-=this.dlambda,o<=0)break}return n}}class a extends o{constructor(t){var e,n,i,s,o;super(t),this.cycles=null!==(e=null==t?void 0:t.cycles)&&void 0!==e?e:1e3,this.steps=null!==(n=null==t?void 0:t.steps)&&void 0!==n?n:1e5,this.radiusPercent=null!==(i=null==t?void 0:t.radiusPercent)&&void 0!==i?i:1,this.maxDistance=null!==(s=null==t?void 0:t.maxDistance)&&void 0!==s?s:null,this.maxDistanceSteps=null!==(o=null==t?void 0:t.maxDistanceSteps)&&void 0!==o?o:null}embed(t){const e=t.length,n=(0,i.kO)(e,a.dimension,40);if(this.initDistance(t),null==this.maxDistanceSteps&&(this.maxDistanceSteps=e*Math.floor((e-1)/2)),null==this.maxDistance){this.maxDistance=-1e37;for(let n=0;n<this.maxDistanceSteps;n++){const n=(0,s.I)(e);let i=(0,s.I)(e);for(;n==i;)i=(0,s.I)(e);const o=this.calcDistance(t,n,i);o>this.maxDistance&&(this.maxDistance=o)}}let o=this.lambda;const r=0==this.radiusPercent?this.maxDistance:this.maxDistance*this.radiusPercent;for(let a=0;a<this.cycles;++a){for(let a=0;a<this.steps;++a){const a=(0,s.I)(e);let l=(0,s.I)(e);for(;a==l;)l=(0,s.I)(e);const h=n[a],c=n[l],u=this.calcDistance(t,a,l),d=(0,i.dP)(h,c);if(u<=r||d<u){const t=.5*o*(u-d)/(d+this.epsilon),e=(0,i.On)(h,c,-1);n[a]=(0,i.On)(h,e,t),n[l]=(0,i.On)(c,e,-t)}}if(o-=(this.lambda-this.dlambda)/(this.cycles-1),o<this.dlambda)break}return n}}},1040:(t,e,n)=>{"use strict";var i,s,o,r;n.d(e,{CF:()=>s,Qe:()=>r,W:()=>i,gk:()=>o}),function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan"}(i||(i={})),function(t){t.Euclidean="Euclidean"}(s||(s={})),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.Vector="Vector",t.String="String",t.BitArray="BitArray",t.MacroMolecule="MacroMolecule"}(r||(r={}))},7861:(t,e,n)=>{"use strict";var i=n(1811),s=n(3979),o=n(5697),r=n(850),a=n(489),l=n(1040);const h={[l.CF.Euclidean]:r.dP},c={[l.W.Levenshtein]:i.T,[l.W.JaroWinkler]:s.H$,[l.W.Manhattan]:function(t,e){if(t.length!==e.length)return 1;{let n=0;for(let i=1;i<t.length;i++)n+=t[i]==e[i]?0:1;return n/t.length}}},u={[l.gk.Tanimoto]:o.KR,[l.gk.Dice]:o._h,[l.gk.Asymmetric]:o.yU,[l.gk.BraunBlanquet]:o.Dz,[l.gk.Cosine]:o.Zd,[l.gk.Kulczynski]:o.s,[l.gk.McConnaughey]:o.aW,[l.gk.RogotGoldberg]:o.MI,[l.gk.Russel]:o.fX,[l.gk.Sokal]:o.NB,[l.gk.Hamming]:o.UX,[l.gk.Euclidean]:o.WI},d={[l.Qe.Vector]:{[l.CF.Euclidean]:h[l.CF.Euclidean]},[l.Qe.String]:{[l.W.Levenshtein]:c[l.W.Levenshtein],[l.W.JaroWinkler]:c[l.W.JaroWinkler],[l.W.Manhattan]:c[l.W.Manhattan]},[l.Qe.BitArray]:{[l.gk.Tanimoto]:u[l.gk.Tanimoto],[l.gk.Dice]:u[l.gk.Dice],[l.gk.Asymmetric]:u[l.gk.Asymmetric],[l.gk.BraunBlanquet]:u[l.gk.BraunBlanquet],[l.gk.Cosine]:u[l.gk.Cosine],[l.gk.Kulczynski]:u[l.gk.Kulczynski],[l.gk.McConnaughey]:u[l.gk.McConnaughey],[l.gk.RogotGoldberg]:u[l.gk.RogotGoldberg],[l.gk.Russel]:u[l.gk.Russel],[l.gk.Sokal]:u[l.gk.Sokal]},[l.Qe.MacroMolecule]:{[a.U.HAMMING]:a.o[a.U.HAMMING],[a.U.LEVENSHTEIN]:a.o[a.U.LEVENSHTEIN],[a.U.NEEDLEMANN_WUNSCH]:a.o[a.U.NEEDLEMANN_WUNSCH]}};Object.keys(d).reduce(((t,e)=>{for(const n of Object.keys(d[e]))t[n]=e;return t}),{})},9657:(t,e,n)=>{"use strict";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,s=i._createBuffer(n);if(e)for(let t=0;t<s.length;t++)s[t]=-1;this._data=s,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 s=t.lengthInInts;for(let i=0;i<s;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 s=0,o=0;for(;e-o>=4;)n._data[s++]=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[s]=(255&t[o+2])<<16),e-o==2&&(n._data[s]|=(255&t[o+1])<<8),e-o==1&&(n._data[s]|=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,s=!0){if(n&&s&&this.setAll(!e,!1),s)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 s=Math.min(t,e),o=Math.max(t,e);if(n)for(let t=s;t<=o;t++)this.setTrue(t);else for(let t=s;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 0!=(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 s=31&this._length;for(0!=s&&(n&=~(4294967295<<s));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 s=this.lengthInInts;let o=0;for(;o<s-1;o++)for(let e=this._data[o]&t._data[o];0!=e;e>>>=8)n+=i._onBitCount[255&e];let r=this._data[o]&t._data[o];const a=31&this._length;for(0!=a&&(r&=~(4294967295<<a));0!=r;r>>>=8)n+=i._onBitCount[255&r];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 s=this.lengthInInts;for(let o=Math.floor(t/32);o<s;o++){let s=e?this._data[o]:~this._data[o];if(0!=n)s&=4294967295<<n&4294967295,n=0;else if(!e&&-4294967296==s)continue;for(let e=0;0!=s;e+=8,s>>>=8){const n=i._firstOnBit[255&s];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 s=Math.floor(t/32);s>=0;s--){let t=e?this._data[s]:~this._data[s];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*s+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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{"use strict";n.d(e,{L:()=>s});var i=n(4588);function s(t,e,n){function s(t,e){let n=null,i=null;for(const s of t){const t=e(s);(null==i||t>i)&&(n=s,i=t)}return n}const o=[(0,i.I)(t-1)],r=new Set;for(let e=0;e<t;++e)o.includes(e)||r.add(e);for(;o.length<e;){const t=s(r.values(),(t=>Math.min.apply(Math,o.map((function(e,i){return n(t,e)})))));null!=t&&(o.push(t),r.delete(t))}return o}},1061:(t,e,n)=>{"use strict";n.d(e,{gw:()=>o}),n(4469),n(976);var i,s=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};function o(t){return s(this,void 0,void 0,(function*(){yield new Promise((e=>setTimeout(e,t)))}))}!function(t){t.notNull=function(t,e){if(null==t)throw new Error(`${null==e?"Value":e} not defined`)}}(i||(i={}))},3659:(t,e,n)=>{"use strict";n.d(e,{OW:()=>i});class i extends Float32Array{}},850:(t,e,n)=>{"use strict";n.d(e,{Fv:()=>d,H3:()=>c,On:()=>a,bO:()=>u,dP:()=>h,hu:()=>o,kO:()=>l});var i=n(3659),s=n(4588);function o(t=!1,e="Assertion error."){if(!t)throw new Error(e)}function r(t,e,n=0){return new Array(t).fill(n).map((()=>new i.OW(e).fill(n)))}function a(t,e,n=1){const s=t.length;o(s==e.length,"Vector lengths do not match.");const r=new i.OW(s);for(let i=0;i<t.length;++i)r[i]=t[i]+n*e[i];return r}function l(t,e,n=1){const i=r(t,e);for(let o=0;o<t;++o)for(let t=0;t<e;++t)i[o][t]=(0,s.t)(n);return i}function h(t,e){const n=function(t){let e=0;for(let n=0;n<t.length;++n)e+=t[n];return e}(function(t){const e=t.length,n=new i.OW(e);for(let e=0;e<t.length;++e)n[e]=t[e]*t[e];return n}(a(t,e,-1)));return Math.sqrt(n)}function c(t,e){const n=t.length,i=r(n,n,0);for(let s=0;s<n;++s)for(let o=s+1;o<n;++o){const n=null==t[s]||null==t[o]?0:e(t[s],t[o]);i[s][o]=i[o][s]=n}return i}function u(t,e){const n=t.length,i=r(n,n,0);let s=Number.MIN_VALUE,o=Number.MAX_VALUE;for(let r=0;r<n;++r)for(let a=r;a<n;++a){const n=null==t[r]||null==t[a]||r===a?0:e(t[r],t[a]);i[r][a]=i[a][r]=n,n>s&&(s=n),n<o&&(o=n)}for(let t=0;t<n;++t)for(let e=t+1;e<n;++e)i[t][e]=i[e][t]=(i[t][e]-o)/(s-o);return i}function d(t){let e=0,n=0;for(let n=0;n<t.length;++n)e+=t[n];e/=t.length;for(let i=0;i<t.length;++i)n+=(t[i]-e)*(t[i]-e);n=Math.sqrt(n/t.length);for(let i=0;i<t.length;++i)t[i]=(t[i]-e)/n;return t}},7659:(t,e,n)=>{"use strict";e.Z=void 0;var i=n(6215);Object.defineProperty(e,"Z",{enumerable:!0,get:function(){return i.TSNE}})},6215:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TSNE=void 0,e.TSNE=class{constructor(t){this.returnV=!1,this.vValue=0,this.iter=0,t=t||{},this.perplexity=this.getopt(t,"perplexity",30),this.dim=this.getopt(t,"dim",2),this.epsilon=this.getopt(t,"epsilon",10)}assert(t,e){if(!t)throw e||"Assertion failed"}getopt(t,e,n){return t.hasOwnProperty(e)?t[e]:n}gaussRandom(){if(this.returnV)return this.returnV=!1,this.vValue;const t=2*Math.random()-1,e=2*Math.random()-1,n=t*t+e*e;if(0===n||n>1)return this.gaussRandom();const i=Math.sqrt(-2*Math.log(n)/n);return this.vValue=e*i,this.returnV=!0,t*i}randn(t,e){return t+this.gaussRandom()*e}zeros(t){if(void 0===t||isNaN(t))return[];if("undefined"==typeof ArrayBuffer){const e=new Array(t);for(let n=0;n<t;n++)e[n]=0;return e}return new Float64Array(t)}randn2d(t,e,n){const i=void 0!==n,s=[];for(let o=0;o<t;o++){const t=[];for(let s=0;s<e;s++)i?t.push(n):t.push(this.randn(0,1e-4));s.push(t)}return s}L2(t,e){const n=t.length;let i=0;for(let s=0;s<n;s++){const n=t[s],o=e[s];i+=(n-o)*(n-o)}return i}xtod(t){const e=t.length,n=this.zeros(e*e);for(let i=0;i<e;i++)for(let s=i+1;s<e;s++){const o=this.L2(t[i],t[s]);n[i*e+s]=o,n[s*e+i]=o}return n}d2p(t,e,n){const i=Math.sqrt(t.length),s=Math.floor(i);this.assert(s===i,"D should have square number of elements.");const o=Math.log(e),r=this.zeros(s*s),a=this.zeros(s);for(let e=0;e<s;e++){let i=-1/0,l=1/0,h=1,c=!1;const u=50;let d=0;for(;!c;){let r=0;for(let n=0;n<s;n++){let i=Math.exp(-t[e*s+n]*h);e===n&&(i=0),a[n]=i,r+=i}let f=0;for(let t=0;t<s;t++){let e;e=0===r?0:a[t]/r,a[t]=e,e>1e-7&&(f-=e*Math.log(e))}f>o?(i=h,l===1/0?h*=2:h=(h+l)/2):(l=h,i===-1/0?h/=2:h=(h+i)/2),d++,Math.abs(f-o)<n&&(c=!0),d>=u&&(c=!0)}for(let t=0;t<s;t++)r[e*s+t]=a[t]}const l=this.zeros(s*s),h=2*s;for(let t=0;t<s;t++)for(let e=0;e<s;e++)l[t*s+e]=Math.max((r[t*s+e]+r[e*s+t])/h,1e-100);return l}sign(t){return t>0?1:t<0?-1:0}initDataRaw(t){const e=t.length,n=t[0].length;this.assert(e>0," X is empty? You must have some data!"),this.assert(n>0," X[0] is empty? Where is the data?");const i=this.xtod(t);this.P=this.d2p(i,this.perplexity,1e-4),this.N=e,this.initSolution()}initDataDist(t){const e=t.length;this.assert(e>0," X is empty? You must have some data!");const n=this.zeros(e*e);for(let i=0;i<e;i++)for(let s=i+1;s<e;s++){const o=t[i][s];n[i*e+s]=o,n[s*e+i]=o}this.P=this.d2p(n,this.perplexity,1e-4),this.N=e,this.initSolution()}initSolution(){this.Y=this.randn2d(this.N,this.dim),this.gains=this.randn2d(this.N,this.dim,1),this.ystep=this.randn2d(this.N,this.dim,0),this.iter=0}getSolution(){return this.Y}step(){this.iter+=1;const t=this.N,e=this.costGrad(this.Y),n=e.cost,i=e.grad,s=this.zeros(this.dim);for(let e=0;e<t;e++)for(let t=0;t<this.dim;t++){const n=i[e][t],o=this.ystep[e][t],r=this.gains[e][t];let a=this.sign(n)===this.sign(o)?.8*r:r+.2;a<.01&&(a=.01),this.gains[e][t]=a;const l=(this.iter<250?.5:.8)*o-this.epsilon*a*i[e][t];this.ystep[e][t]=l,this.Y[e][t]+=l,s[t]+=this.Y[e][t]}for(let e=0;e<t;e++)for(let n=0;n<this.dim;n++)this.Y[e][n]-=s[n]/t;return n}debugGrad(){const t=this.N,e=this.costGrad(this.Y),n=(e.cost,e.grad),i=1e-5;for(let e=0;e<t;e++)for(let t=0;t<this.dim;t++){const s=this.Y[e][t];this.Y[e][t]=s+i;const o=this.costGrad(this.Y);this.Y[e][t]=s-i;const r=this.costGrad(this.Y),a=n[e][t],l=(o.cost-r.cost)/(2*i);console.log(e+","+t+": gradcheck analytic: "+a+" vs. numerical: "+l),this.Y[e][t]=s}}costGrad(t){const e=this.N,n=this.dim,i=this.P,s=this.iter<100?4:1,o=this.zeros(e*e);let r=0;for(let i=0;i<e;i++)for(let s=i+1;s<e;s++){let a=0;for(let e=0;e<n;e++){const n=t[i][e]-t[s][e];a+=n*n}const l=1/(1+a);o[i*e+s]=l,o[s*e+i]=l,r+=2*l}const a=e*e,l=this.zeros(a);for(let t=0;t<a;t++)l[t]=Math.max(o[t]/r,1e-100);let h=0;const c=[];for(let r=0;r<e;r++){const a=new Array(n);for(let t=0;t<n;t++)a[t]=0;for(let c=0;c<e;c++){h+=-i[r*e+c]*Math.log(l[r*e+c]);const u=4*(s*i[r*e+c]-l[r*e+c])*o[r*e+c];for(let e=0;e<n;e++)a[e]+=u*(t[r][e]-t[c][e])}c.push(a)}return{cost:h,grad:c}}}},9564:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(7537),s=n.n(i),o=n(3645),r=n.n(o)()(s());r.push([t.id,".kalign-version {\n margin-bottom: 0;\n text-align: end;\n font-size: 12px;\n opacity: 0.8;\n}","",{version:3,sources:["webpack://./css/msa.css"],names:[],mappings:"AAAA;IACI,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,YAAY;AAChB",sourcesContent:[".kalign-version {\n margin-bottom: 0;\n text-align: end;\n font-size: 12px;\n opacity: 0.8;\n}"],sourceRoot:""}]);const a=r},9414:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(7537),s=n.n(i),o=n(3645),r=n.n(o)()(s());r.push([t.id,".scatter_plot_link {\n position: absolute!important;\n right: 10px;\n}\n\n.cliffs_grid {\n top: 10px;\n}\n\n.show_only_cliffs {\n top: 30px;\n}\n\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings {\n font-size: 18px;\n position: absolute;\n height: 28px;\n}\n","",{version:3,sources:["webpack://./node_modules/@datagrok-libraries/ml/css/styles.css"],names:[],mappings:"AAAA;IACI,4BAA4B;IAC5B,WAAW;AACf;;AAEA;IACI,SAAS;AACb;;AAEA;IACI,SAAS;AACb;;AAEA;IACI,eAAe;IACf,kBAAkB;IAClB,YAAY;AAChB",sourcesContent:[".scatter_plot_link {\n position: absolute!important;\n right: 10px;\n}\n\n.cliffs_grid {\n top: 10px;\n}\n\n.show_only_cliffs {\n top: 30px;\n}\n\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings {\n font-size: 18px;\n position: absolute;\n height: 28px;\n}\n"],sourceRoot:""}]);const a=r},3645: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,s,o){"string"==typeof t&&(t=[[null,t,void 0]]);var r={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(r[l]=!0)}for(var h=0;h<t.length;h++){var c=[].concat(t[h]);i&&r[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),s&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=s):c[4]="".concat(s)),e.push(c))}},e}},7537: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)))),s="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),o="/*# ".concat(s," */");return[e].concat([o]).join("\n")}return[e].join("\n")}},9133:function(t,e,n){var i;!function(e,s){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,s,o){for(var r,a,l,h,c,u,d,f,m,p,g,v,y;o>=64;){for(r=n[0],a=n[1],l=n[2],h=n[3],c=n[4],u=n[5],d=n[6],f=n[7],p=0;p<16;p++)g=s+4*p,t[p]=(255&i[g])<<24|(255&i[g+1])<<16|(255&i[g+2])<<8|255&i[g+3];for(p=16;p<64;p++)v=((m=t[p-2])>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,y=((m=t[p-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>3,t[p]=(v+t[p-7]|0)+(y+t[p-16]|0);for(p=0;p<64;p++)v=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&u^~c&d)|0)+(f+(e[p]+t[p]|0)|0)|0,y=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&a^r&l^a&l)|0,f=d,d=u,u=c,c=h+v|0,h=l,l=a,a=r,r=v+y|0;n[0]+=r,n[1]+=a,n[2]+=l,n[3]+=h,n[4]+=c,n[5]+=u,n[6]+=d,n[7]+=f,s+=64,o-=64}return s}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,s=e/536870912|0,o=e<<3,r=e%64<56?64:128;this.buffer[i]=128;for(var a=i+1;a<r-8;a++)this.buffer[a]=0;this.buffer[r-8]=s>>>24&255,this.buffer[r-7]=s>>>16&255,this.buffer[r-6]=s>>>8&255,this.buffer[r-5]=s>>>0&255,this.buffer[r-4]=o>>>24&255,this.buffer[r-3]=o>>>16&255,this.buffer[r-2]=o>>>8&255,this.buffer[r-1]=o>>>0&255,n(this.temp,this.state,this.buffer,0,r),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 s=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 r(t,e){var n=new s(t).update(e),i=n.digest();return n.clean(),i}function a(t,e,n,i){var s=i[0];if(0===s)throw new Error("hkdf: cannot expand more");e.reset(),s>1&&e.update(t),n&&e.update(n),e.update(i),e.finish(t),i[0]++}t.HMAC=s,t.hash=o,t.default=o,t.hmac=r;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]),h=r(e,t),c=new s(h),u=new Uint8Array(c.digestLength),d=u.length,f=new Uint8Array(i),m=0;m<i;m++)d===u.length&&(a(u,c,n,o),d=0),f[m]=u[d++];return c.clean(),u.fill(0),o.fill(0),f},t.pbkdf2=function(t,e,n,i){for(var o=new s(t),r=o.digestLength,a=new Uint8Array(4),l=new Uint8Array(r),h=new Uint8Array(r),c=new Uint8Array(i),u=0;u*r<i;u++){var d=u+1;a[0]=d>>>24&255,a[1]=d>>>16&255,a[2]=d>>>8&255,a[3]=d>>>0&255,o.reset(),o.update(e),o.update(a),o.finish(h);for(var f=0;f<r;f++)l[f]=h[f];for(f=2;f<=n;f++){o.reset(),o.update(h).finish(h);for(var m=0;m<r;m++)l[m]^=h[m]}for(f=0;f<r&&u*r+f<i;f++)c[u*r+f]=l[f]}for(u=0;u<r;u++)l[u]=h[u]=0;for(u=0;u<4;u++)a[u]=0;return o.clean(),c}}(o);var r=o.default;for(var a in o)r[a]=o[a];"object"==typeof t.exports?t.exports=r:void 0===(i=function(){return r}.call(o,n,o,t))||(t.exports=i)}()},1811:(t,e,n)=>{"use strict";n.d(e,{T:()=>s});const i=new Uint32Array(65536),s=(t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return 0===e.length?t.length:t.length<=32?((t,e)=>{const n=t.length,s=e.length,o=1<<n-1;let r=-1,a=0,l=n,h=n;for(;h--;)i[t.charCodeAt(h)]|=1<<h;for(h=0;h<s;h++){let t=i[e.charCodeAt(h)];const n=t|a;t|=(t&r)+r^r,a|=~(t|r),r&=t,a&o&&l++,r&o&&l--,a=a<<1|1,r=r<<1|~(n|a),a&=n}for(h=n;h--;)i[t.charCodeAt(h)]=0;return l})(t,e):((t,e)=>{const n=e.length,s=t.length,o=[],r=[],a=Math.ceil(n/32),l=Math.ceil(s/32);for(let t=0;t<a;t++)r[t]=-1,o[t]=0;let h=0;for(;h<l-1;h++){let a=0,l=-1;const c=32*h,u=Math.min(32,s)+c;for(let e=c;e<u;e++)i[t.charCodeAt(e)]|=1<<e;for(let t=0;t<n;t++){const n=i[e.charCodeAt(t)],s=r[t/32|0]>>>t&1,h=o[t/32|0]>>>t&1,c=n|a,u=((n|h)&l)+l^l|n|h;let d=a|~(u|l),f=l&u;d>>>31^s&&(r[t/32|0]^=1<<t),f>>>31^h&&(o[t/32|0]^=1<<t),d=d<<1|s,f=f<<1|h,l=f|~(c|d),a=d&c}for(let e=c;e<u;e++)i[t.charCodeAt(e)]=0}let c=0,u=-1;const d=32*h,f=Math.min(32,s-d)+d;for(let e=d;e<f;e++)i[t.charCodeAt(e)]|=1<<e;let m=s;for(let t=0;t<n;t++){const n=i[e.charCodeAt(t)],a=r[t/32|0]>>>t&1,l=o[t/32|0]>>>t&1,h=n|c,d=((n|l)&u)+u^u|n|l;let f=c|~(d|u),p=u&d;m+=f>>>s-1&1,m-=p>>>s-1&1,f>>>31^a&&(r[t/32|0]^=1<<t),p>>>31^l&&(o[t/32|0]^=1<<t),f=f<<1|a,p=p<<1|l,u=p|~(h|f),c=f&h}for(let e=d;e<f;e++)i[t.charCodeAt(e)]=0;return m})(t,e)}},3979:(t,e)=>{"use strict";e.H$=void 0,e.H$=function(t,e,n){var i=function(t,e,n){if(0===t.length||0===e.length)return 0;if(n&&!n.caseSensitive&&(t=t.toUpperCase(),e=e.toUpperCase()),t===e)return 1;for(var i=0,s=t.length,o=e.length,r=Math.floor(Math.max(s,o)/2)-1,a=new Array(s),l=new Array(o),h=0;h<s;h++)for(var c=Math.max(0,h-r);c<=Math.min(o,h+r+1);c++)if(!a[h]&&!l[c]&&t[h]===e[c]){++i,a[h]=l[c]=!0;break}if(0===i)return 0;var u=0,d=0;for(h=0;h<s;h++)if(a[h]){for(;!l[d];)d++;t.charAt(h)!==e.charAt(d++)&&u++}return(i/s+i/o+(i-(u/=2))/i)/3}(t,e,n),s=0;if(i>.7){for(var o=Math.min(t.length,e.length),r=0;t[r]===e[r]&&r<4&&r<o;)++s,r++;i+=.1*s*(1-i)}return i}},9251:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>P});const i=Object.prototype.toString;function s(t){return i.call(t).endsWith("Array]")}function o(t,e,n){let i=0;const s=n(e);for(let e=0;e<t.x.length;e++)i+=Math.abs(t.y[e]-s(t.x[e]));return i}const r=Object.prototype.toString;function a(t){return r.call(t).endsWith("Array]")}const l=Object.prototype.toString;function h(t){return l.call(t).endsWith("Array]")}const c=Object.prototype.toString;const u=Object.prototype.toString;function d(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!h(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==n.output){if(!h(n.output))throw new TypeError("output option must be an array if specified");e=n.output}else e=new Array(t.length);var i=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e=t,!u.call(e).endsWith("Array]"))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var i=n.fromIndex,s=void 0===i?0:i,o=n.toIndex,r=void 0===o?t.length:o;if(s<0||s>=t.length||!Number.isInteger(s))throw new Error("fromIndex must be a positive integer smaller than length");if(r<=s||r>t.length||!Number.isInteger(r))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[s],l=s+1;l<r;l++)t[l]<a&&(a=t[l]);return a}(t),s=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e=t,!c.call(e).endsWith("Array]"))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var i=n.fromIndex,s=void 0===i?0:i,o=n.toIndex,r=void 0===o?t.length:o;if(s<0||s>=t.length||!Number.isInteger(s))throw new Error("fromIndex must be a positive integer smaller than length");if(r<=s||r>t.length||!Number.isInteger(r))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[s],l=s+1;l<r;l++)t[l]>a&&(a=t[l]);return a}(t);if(i===s)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var o=n.min,r=void 0===o?n.autoMinMax?i:0:o,a=n.max,l=void 0===a?n.autoMinMax?s:1:a;if(r>=l)throw new RangeError("min option must be smaller than max option");for(var d=(l-r)/(s-i),f=0;f<t.length;f++)e[f]=(t[f]-i)*d+r;return e}const f=" ".repeat(2),m=" ".repeat(4);function p(t,e={}){const{maxRows:n=15,maxColumns:i=10,maxNumSize:s=8,padMinus:o="auto"}=e;return`${t.constructor.name} {\n${f}[\n${m}${function(t,e,n,i,s){const{rows:o,columns:r}=t,a=Math.min(o,e),l=Math.min(r,n),h=[];if("auto"===s){s=!1;t:for(let e=0;e<a;e++)for(let n=0;n<l;n++)if(t.get(e,n)<0){s=!0;break t}}for(let e=0;e<a;e++){let n=[];for(let o=0;o<l;o++)n.push(g(t.get(e,o),i,s));h.push(`${n.join(" ")}`)}return l!==r&&(h[h.length-1]+=` ... ${r-n} more columns`),a!==o&&h.push(`... ${o-e} more rows`),h.join(`\n${m}`)}(t,n,i,s,o)}\n${f}]\n${f}rows: ${t.rows}\n${f}columns: ${t.columns}\n}`}function g(t,e,n){return(t>=0&&n?` ${v(t,e-1)}`:v(t,e)).padEnd(e)}function v(t,e){let n=t.toString();if(n.length<=e)return n;let i=t.toFixed(e);if(i.length>e&&(i=t.toFixed(Math.max(0,e-(i.length-e)))),i.length<=e&&!i.startsWith("0.000")&&!i.startsWith("-0.000"))return i;let s=t.toExponential(e);return s.length>e&&(s=t.toExponential(Math.max(0,e-(s.length-e)))),s.slice(0)}function y(t,e,n){let i=n?t.rows:t.rows-1;if(e<0||e>i)throw new RangeError("Row index out of range")}function b(t,e,n){let i=n?t.columns:t.columns-1;if(e<0||e>i)throw new RangeError("Column index out of range")}function w(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function C(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function S(t,e,n,i,s){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(x("startRow",e),x("endRow",n),x("startColumn",i),x("endColumn",s),e>n||i>s||e<0||e>=t.rows||n<0||n>=t.rows||i<0||i>=t.columns||s<0||s>=t.columns)throw new RangeError("Submatrix indices are out of range")}function M(t,e=0){let n=[];for(let i=0;i<t;i++)n.push(e);return n}function x(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function T(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class N{static from1DArray(t,e,n){if(t*e!==n.length)throw new RangeError("data length does not match given dimensions");let i=new A(t,e);for(let s=0;s<t;s++)for(let t=0;t<e;t++)i.set(s,t,n[s*e+t]);return i}static rowVector(t){let e=new A(1,t.length);for(let n=0;n<t.length;n++)e.set(0,n,t[n]);return e}static columnVector(t){let e=new A(t.length,1);for(let n=0;n<t.length;n++)e.set(n,0,t[n]);return e}static zeros(t,e){return new A(t,e)}static ones(t,e){return new A(t,e).fill(1)}static rand(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{random:i=Math.random}=n;let s=new A(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)s.set(n,t,i());return s}static randInt(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{min:i=0,max:s=1e3,random:o=Math.random}=n;if(!Number.isInteger(i))throw new TypeError("min must be an integer");if(!Number.isInteger(s))throw new TypeError("max must be an integer");if(i>=s)throw new RangeError("min must be smaller than max");let r=s-i,a=new A(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++){let e=i+Math.round(o()*r);a.set(n,t,e)}return a}static eye(t,e,n){void 0===e&&(e=t),void 0===n&&(n=1);let i=Math.min(t,e),s=this.zeros(t,e);for(let t=0;t<i;t++)s.set(t,t,n);return s}static diag(t,e,n){let i=t.length;void 0===e&&(e=i),void 0===n&&(n=e);let s=Math.min(i,e,n),o=this.zeros(e,n);for(let e=0;e<s;e++)o.set(e,e,t[e]);return o}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,i=t.columns,s=new A(n,i);for(let o=0;o<n;o++)for(let n=0;n<i;n++)s.set(o,n,Math.min(t.get(o,n),e.get(o,n)));return s}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,i=t.columns,s=new this(n,i);for(let o=0;o<n;o++)for(let n=0;n<i;n++)s.set(o,n,Math.max(t.get(o,n),e.get(o,n)));return s}static checkMatrix(t){return N.isMatrix(t)?t:new A(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.call(this,e,n);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let n=0;n<this.columns;n++)t[e].push(this.get(e,n))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isEchelonForm(){let t=0,e=0,n=-1,i=!0,s=!1;for(;t<this.rows&&i;){for(e=0,s=!1;e<this.columns&&!1===s;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(s=!0,n=e):(i=!1,s=!0);t++}return i}isReducedEchelonForm(){let t=0,e=0,n=-1,i=!0,s=!1;for(;t<this.rows&&i;){for(e=0,s=!1;e<this.columns&&!1===s;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(s=!0,n=e):(i=!1,s=!0);for(let n=e+1;n<this.rows;n++)0!==this.get(t,n)&&(i=!1);t++}return i}echelonForm(){let t=this.clone(),e=0,n=0;for(;e<t.rows&&n<t.columns;){let i=e;for(let s=e;s<t.rows;s++)t.get(s,n)>t.get(i,n)&&(i=s);if(0===t.get(i,n))n++;else{t.swapRows(e,i);let s=t.get(e,n);for(let i=n;i<t.columns;i++)t.set(e,i,t.get(e,i)/s);for(let i=e+1;i<t.rows;i++){let s=t.get(i,n)/t.get(e,n);t.set(i,n,0);for(let o=n+1;o<t.columns;o++)t.set(i,o,t.get(i,o)-t.get(e,o)*s)}e++,n++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,n=t.rows,i=n-1;for(;i>=0;)if(0===t.maxRow(i))i--;else{let s=0,o=!1;for(;s<n&&!1===o;)1===t.get(i,s)?o=!0:s++;for(let n=0;n<i;n++){let o=t.get(n,s);for(let r=s;r<e;r++){let e=t.get(n,r)-o*t.get(i,r);t.set(n,r,e)}}i--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:n=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");let i=new A(this.rows*e,this.columns*n);for(let t=0;t<e;t++)for(let e=0;e<n;e++)i.setSubMatrix(this,this.rows*t,this.columns*e);return i}fill(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,t);return this}neg(){return this.mulS(-1)}getRow(t){y(this,t);let e=[];for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}getRowVector(t){return A.rowVector(this.getRow(t))}setRow(t,e){y(this,t),e=w(this,e);for(let n=0;n<this.columns;n++)this.set(t,n,e[n]);return this}swapRows(t,e){y(this,t),y(this,e);for(let n=0;n<this.columns;n++){let i=this.get(t,n);this.set(t,n,this.get(e,n)),this.set(e,n,i)}return this}getColumn(t){b(this,t);let e=[];for(let n=0;n<this.rows;n++)e.push(this.get(n,t));return e}getColumnVector(t){return A.columnVector(this.getColumn(t))}setColumn(t,e){b(this,t),e=C(this,e);for(let n=0;n<this.rows;n++)this.set(n,t,e[n]);return this}swapColumns(t,e){b(this,t),b(this,e);for(let n=0;n<this.rows;n++){let i=this.get(n,t);this.set(n,t,this.get(n,e)),this.set(n,e,i)}return this}addRowVector(t){t=w(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[n]);return this}subRowVector(t){t=w(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[n]);return this}mulRowVector(t){t=w(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[n]);return this}divRowVector(t){t=w(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[n]);return this}addColumnVector(t){t=C(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[e]);return this}subColumnVector(t){t=C(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[e]);return this}mulColumnVector(t){t=C(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[e]);return this}divColumnVector(t){t=C(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[e]);return this}mulRow(t,e){y(this,t);for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e);return this}mulColumn(t,e){b(this,t);for(let n=0;n<this.rows;n++)this.set(n,t,this.get(n,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t[e]&&(t[e]=this.get(e,n));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t[n]&&(t[n]=this.get(e,n));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){T(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>t&&(t=this.get(n,i),e[0]=n,e[1]=i);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t[e]&&(t[e]=this.get(e,n));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t[n]&&(t[n]=this.get(e,n));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){T(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)<t&&(t=this.get(n,i),e[0]=n,e[1]=i);return e}maxRow(t){if(y(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}maxRowIndex(t){y(this,t),T(this);let e=this.get(t,0),n=[t,0];for(let i=1;i<this.columns;i++)this.get(t,i)>e&&(e=this.get(t,i),n[1]=i);return n}minRow(t){if(y(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}minRowIndex(t){y(this,t),T(this);let e=this.get(t,0),n=[t,0];for(let i=1;i<this.columns;i++)this.get(t,i)<e&&(e=this.get(t,i),n[1]=i);return n}maxColumn(t){if(b(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t));return e}maxColumnIndex(t){b(this,t),T(this);let e=this.get(0,t),n=[0,t];for(let i=1;i<this.rows;i++)this.get(i,t)>e&&(e=this.get(i,t),n[0]=i);return n}minColumn(t){if(b(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t));return e}minColumnIndex(t){b(this,t),T(this);let e=this.get(0,t),n=[0,t];for(let i=1;i<this.rows;i++)this.get(i,t)<e&&(e=this.get(i,t),n[0]=i);return n}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let n=0;n<t;n++)e.push(this.get(n,n));return e}norm(t="frobenius"){let e=0;if("max"===t)return this.max();if("frobenius"===t){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e+=this.get(t,n)*this.get(t,n);return Math.sqrt(e)}throw new RangeError(`unknown norm type: ${t}`)}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t+=this.get(e,n),this.set(e,n,t);return this}dot(t){N.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let n=0;for(let i=0;i<e.length;i++)n+=e[i]*t[i];return n}mmul(t){t=A.checkMatrix(t);let e=this.rows,n=this.columns,i=t.columns,s=new A(e,i),o=new Float64Array(n);for(let r=0;r<i;r++){for(let e=0;e<n;e++)o[e]=t.get(e,r);for(let t=0;t<e;t++){let e=0;for(let i=0;i<n;i++)e+=this.get(t,i)*o[i];s.set(t,r,e)}}return s}strassen2x2(t){t=A.checkMatrix(t);let e=new A(2,2);const n=this.get(0,0),i=t.get(0,0),s=this.get(0,1),o=t.get(0,1),r=this.get(1,0),a=t.get(1,0),l=this.get(1,1),h=t.get(1,1),c=(n+l)*(i+h),u=(r+l)*i,d=n*(o-h),f=l*(a-i),m=(n+s)*h,p=c+f-m+(s-l)*(a+h),g=d+m,v=u+f,y=c-u+d+(r-n)*(i+o);return e.set(0,0,p),e.set(0,1,g),e.set(1,0,v),e.set(1,1,y),e}strassen3x3(t){t=A.checkMatrix(t);let e=new A(3,3);const n=this.get(0,0),i=this.get(0,1),s=this.get(0,2),o=this.get(1,0),r=this.get(1,1),a=this.get(1,2),l=this.get(2,0),h=this.get(2,1),c=this.get(2,2),u=t.get(0,0),d=t.get(0,1),f=t.get(0,2),m=t.get(1,0),p=t.get(1,1),g=t.get(1,2),v=t.get(2,0),y=t.get(2,1),b=t.get(2,2),w=(n-o)*(-d+p),C=(-n+o+r)*(u-d+p),S=(o+r)*(-u+d),M=n*u,x=(-n+l+h)*(u-f+g),T=(-n+l)*(f-g),N=(l+h)*(-u+f),E=(-s+h+c)*(p+v-y),I=(s-c)*(p-y),L=s*v,k=(h+c)*(-v+y),R=(-s+r+a)*(g+v-b),_=(s-a)*(g-b),G=(r+a)*(-v+b),P=M+L+i*m,O=(n+i+s-o-r-h-c)*p+C+S+M+E+L+k,F=M+x+N+(n+i+s-r-a-l-h)*g+L+R+G,W=w+r*(-u+d+m-p-g-v+b)+C+M+L+R+_,V=w+C+S+M+a*y,H=L+R+_+G+o*f,Z=M+x+T+h*(-u+f+m-p-g-v+y)+E+I+L,U=E+I+L+k+l*d,D=M+x+T+N+c*b;return e.set(0,0,P),e.set(0,1,O),e.set(0,2,F),e.set(1,0,W),e.set(1,1,V),e.set(1,2,H),e.set(2,0,Z),e.set(2,1,U),e.set(2,2,D),e}mmulStrassen(t){t=A.checkMatrix(t);let e=this.clone(),n=e.rows,i=e.columns,s=t.rows,o=t.columns;function r(t,e,n){let i=t.rows,s=t.columns;if(i===e&&s===n)return t;{let i=N.zeros(e,n);return i=i.setSubMatrix(t,0,0),i}}i!==s&&console.warn(`Multiplying ${n} x ${i} and ${s} x ${o} matrix: dimensions do not match.`);let a=Math.max(n,s),l=Math.max(i,o);return e=r(e,a,l),function t(e,n,i,s){if(i<=512||s<=512)return e.mmul(n);i%2==1&&s%2==1?(e=r(e,i+1,s+1),n=r(n,i+1,s+1)):i%2==1?(e=r(e,i+1,s),n=r(n,i+1,s)):s%2==1&&(e=r(e,i,s+1),n=r(n,i,s+1));let o=parseInt(e.rows/2,10),a=parseInt(e.columns/2,10),l=e.subMatrix(0,o-1,0,a-1),h=n.subMatrix(0,o-1,0,a-1),c=e.subMatrix(0,o-1,a,e.columns-1),u=n.subMatrix(0,o-1,a,n.columns-1),d=e.subMatrix(o,e.rows-1,0,a-1),f=n.subMatrix(o,n.rows-1,0,a-1),m=e.subMatrix(o,e.rows-1,a,e.columns-1),p=n.subMatrix(o,n.rows-1,a,n.columns-1),g=t(N.add(l,m),N.add(h,p),o,a),v=t(N.add(d,m),h,o,a),y=t(l,N.sub(u,p),o,a),b=t(m,N.sub(f,h),o,a),w=t(N.add(l,c),p,o,a),C=t(N.sub(d,l),N.add(h,u),o,a),S=t(N.sub(c,m),N.add(f,p),o,a),M=N.add(g,b);M.sub(w),M.add(S);let x=N.add(y,w),T=N.add(v,b),E=N.sub(g,v);E.add(y),E.add(C);let A=N.zeros(2*M.rows,2*M.columns);return A=A.setSubMatrix(M,0,0),A=A.setSubMatrix(x,M.rows,0),A=A.setSubMatrix(T,0,M.columns),A=A.setSubMatrix(E,M.rows,M.columns),A.subMatrix(0,i-1,0,s-1)}(e,t=r(t,a,l),a,l)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let i=new A(this.rows,this.columns);for(let t=0;t<this.rows;t++){const s=this.getRow(t);s.length>0&&d(s,{min:e,max:n,output:s}),i.setRow(t,s)}return i}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let i=new A(this.rows,this.columns);for(let t=0;t<this.columns;t++){const s=this.getColumn(t);s.length&&d(s,{min:e,max:n,output:s}),i.setColumn(t,s)}return i}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let n=0;n<t;n++){let t=this.get(e,n),i=this.get(e,this.columns-1-n);this.set(e,n,i),this.set(e,this.columns-1-n,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let n=0;n<t;n++){let t=this.get(n,e),i=this.get(this.rows-1-n,e);this.set(n,e,i),this.set(this.rows-1-n,e,t)}return this}kroneckerProduct(t){t=A.checkMatrix(t);let e=this.rows,n=this.columns,i=t.rows,s=t.columns,o=new A(e*i,n*s);for(let r=0;r<e;r++)for(let e=0;e<n;e++)for(let n=0;n<i;n++)for(let a=0;a<s;a++)o.set(i*r+n,s*e+a,this.get(r,e)*t.get(n,a));return o}kroneckerSum(t){if(t=A.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,n=t.rows,i=this.kroneckerProduct(A.eye(n,n)),s=A.eye(e,e).kroneckerProduct(t);return i.add(s)}transpose(){let t=new A(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(n,e,this.get(e,n));return t}sortRows(t=E){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=E){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,n,i){S(this,t,e,n,i);let s=new A(e-t+1,i-n+1);for(let o=t;o<=e;o++)for(let e=n;e<=i;e++)s.set(o-t,e-n,this.get(o,e));return s}subMatrixRow(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.columns-1),e>n||e<0||e>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let i=new A(t.length,n-e+1);for(let s=0;s<t.length;s++)for(let o=e;o<=n;o++){if(t[s]<0||t[s]>=this.rows)throw new RangeError(`Row index out of range: ${t[s]}`);i.set(s,o-e,this.get(t[s],o))}return i}subMatrixColumn(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.rows-1),e>n||e<0||e>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let i=new A(n-e+1,t.length);for(let s=0;s<t.length;s++)for(let o=e;o<=n;o++){if(t[s]<0||t[s]>=this.columns)throw new RangeError(`Column index out of range: ${t[s]}`);i.set(o-e,s,this.get(o,t[s]))}return i}setSubMatrix(t,e,n){if((t=A.checkMatrix(t)).isEmpty())return this;S(this,e,e+t.rows-1,n,n+t.columns-1);for(let i=0;i<t.rows;i++)for(let s=0;s<t.columns;s++)this.set(e+i,n+s,t.get(i,s));return this}selection(t,e){!function(t,e){if(!a(e))throw new TypeError("row indices must be an array");for(let n=0;n<e.length;n++)if(e[n]<0||e[n]>=t.rows)throw new RangeError("row indices are out of range")}(this,t),function(t,e){if(!a(e))throw new TypeError("column indices must be an array");for(let n=0;n<e.length;n++)if(e[n]<0||e[n]>=t.columns)throw new RangeError("column indices are out of range")}(this,e);let n=new A(t.length,e.length);for(let i=0;i<t.length;i++){let s=t[i];for(let t=0;t<e.length;t++){let o=e[t];n.set(i,t,this.get(s,o))}}return n}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let n=0;n<t;n++)e+=this.get(n,n);return e}clone(){let t=new A(this.rows,this.columns);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(e,n,this.get(e,n));return t}sum(t){switch(t){case"row":return function(t){let e=M(t.rows);for(let n=0;n<t.rows;++n)for(let i=0;i<t.columns;++i)e[n]+=t.get(n,i);return e}(this);case"column":return function(t){let e=M(t.columns);for(let n=0;n<t.rows;++n)for(let i=0;i<t.columns;++i)e[i]+=t.get(n,i);return e}(this);case void 0:return function(t){let e=0;for(let n=0;n<t.rows;n++)for(let i=0;i<t.columns;i++)e+=t.get(n,i);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=M(t.rows,1);for(let n=0;n<t.rows;++n)for(let i=0;i<t.columns;++i)e[n]*=t.get(n,i);return e}(this);case"column":return function(t){let e=M(t.columns,1);for(let n=0;n<t.rows;++n)for(let i=0;i<t.columns;++i)e[i]*=t.get(n,i);return e}(this);case void 0:return function(t){let e=1;for(let n=0;n<t.rows;n++)for(let i=0;i<t.columns;i++)e*=t.get(n,i);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:n=!0,mean:i=this.mean(t)}=e;if("boolean"!=typeof n)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!a(i))throw new TypeError("mean must be an array");return function(t,e,n){const i=t.rows,s=t.columns,o=[];for(let r=0;r<i;r++){let i=0,a=0,l=0;for(let e=0;e<s;e++)l=t.get(r,e)-n[r],i+=l,a+=l*l;e?o.push((a-i*i/s)/(s-1)):o.push((a-i*i/s)/s)}return o}(this,n,i);case"column":if(!a(i))throw new TypeError("mean must be an array");return function(t,e,n){const i=t.rows,s=t.columns,o=[];for(let r=0;r<s;r++){let s=0,a=0,l=0;for(let e=0;e<i;e++)l=t.get(e,r)-n[r],s+=l,a+=l*l;e?o.push((a-s*s/i)/(i-1)):o.push((a-s*s/i)/i)}return o}(this,n,i);case void 0:if("number"!=typeof i)throw new TypeError("mean must be a number");return function(t,e,n){const i=t.rows,s=t.columns,o=i*s;let r=0,a=0,l=0;for(let e=0;e<i;e++)for(let i=0;i<s;i++)l=t.get(e,i)-n,r+=l,a+=l*l;return e?(a-r*r/o)/(o-1):(a-r*r/o)/o}(this,n,i);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const n=this.variance(t,e);if(void 0===t)return Math.sqrt(n);for(let t=0;t<n.length;t++)n[t]=Math.sqrt(n[t]);return n}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:n=this.mean(t)}=e;switch(t){case"row":if(!a(n))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let i=0;i<t.columns;i++)t.set(n,i,t.get(n,i)-e[n])}(this,n),this;case"column":if(!a(n))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let i=0;i<t.columns;i++)t.set(n,i,t.get(n,i)-e[i])}(this,n),this;case void 0:if("number"!=typeof n)throw new TypeError("center must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let i=0;i<t.columns;i++)t.set(n,i,t.get(n,i)-e)}(this,n),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let n=e.scale;switch(t){case"row":if(void 0===n)n=function(t){const e=[];for(let n=0;n<t.rows;n++){let i=0;for(let e=0;e<t.columns;e++)i+=Math.pow(t.get(n,e),2)/(t.columns-1);e.push(Math.sqrt(i))}return e}(this);else if(!a(n))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let i=0;i<t.columns;i++)t.set(n,i,t.get(n,i)/e[n])}(this,n),this;case"column":if(void 0===n)n=function(t){const e=[];for(let n=0;n<t.columns;n++){let i=0;for(let e=0;e<t.rows;e++)i+=Math.pow(t.get(e,n),2)/(t.rows-1);e.push(Math.sqrt(i))}return e}(this);else if(!a(n))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let i=0;i<t.columns;i++)t.set(n,i,t.get(n,i)/e[i])}(this,n),this;case void 0:if(void 0===n)n=function(t){const e=t.size-1;let n=0;for(let i=0;i<t.columns;i++)for(let s=0;s<t.rows;s++)n+=Math.pow(t.get(s,i),2)/e;return Math.sqrt(n)}(this);else if("number"!=typeof n)throw new TypeError("scale must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let i=0;i<t.columns;i++)t.set(n,i,t.get(n,i)/e)}(this,n),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return p(this,t)}}function E(t,e){return t-e}N.prototype.klass="Matrix","undefined"!=typeof Symbol&&(N.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return p(this)}),N.random=N.rand,N.randomInt=N.randInt,N.diagonal=N.diag,N.prototype.diagonal=N.prototype.diag,N.identity=N.eye,N.prototype.negate=N.prototype.neg,N.prototype.tensorProduct=N.prototype.kroneckerProduct;class A extends N{constructor(t,e){if(super(),A.isMatrix(t))return t.clone();if(Number.isInteger(t)&&t>=0){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let n=0;n<t;n++)this.data.push(new Float64Array(e))}else{if(!a(t))throw new TypeError("First argument must be a positive number or an array");{const n=t;if("number"!=typeof(e=(t=n.length)?n[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let i=0;i<t;i++){if(n[i].length!==e)throw new RangeError("Inconsistent array dimensions");if(!n[i].every((t=>"number"==typeof t)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(n[i]))}}}this.rows=t,this.columns=e}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}removeRow(t){return y(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),y(this,t,!0),e=Float64Array.from(w(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){b(this,t);for(let e=0;e<this.rows;e++){const n=new Float64Array(this.columns-1);for(let i=0;i<t;i++)n[i]=this.data[e][i];for(let i=t+1;i<this.columns;i++)n[i-1]=this.data[e][i];this.data[e]=n}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),b(this,t,!0),e=C(this,e);for(let n=0;n<this.rows;n++){const i=new Float64Array(this.columns+1);let s=0;for(;s<t;s++)i[s]=this.data[n][s];for(i[s++]=e[n];s<this.columns+1;s++)i[s]=this.data[n][s-1];this.data[n]=i}return this.columns+=1,this}}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t.get(e,n));return this},t.add=function(t,n){return new e(t).add(n)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t.get(e,n));return this},t.sub=function(t,n){return new e(t).sub(n)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t.get(e,n));return this},t.mul=function(t,n){return new e(t).mul(n)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t.get(e,n));return this},t.div=function(t,n){return new e(t).div(n)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t.get(e,n));return this},t.mod=function(t,n){return new e(t).mod(n)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t.get(e,n));return this},t.and=function(t,n){return new e(t).and(n)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t.get(e,n));return this},t.or=function(t,n){return new e(t).or(n)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t.get(e,n));return this},t.xor=function(t,n){return new e(t).xor(n)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t.get(e,n));return this},t.leftShift=function(t,n){return new e(t).leftShift(n)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t.get(e,n));return this},t.signPropagatingRightShift=function(t,n){return new e(t).signPropagatingRightShift(n)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t.get(e,n));return this},t.rightShift=function(t,n){return new e(t).rightShift(n)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,n){return new e(t).pow(n)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,Math.pow(this.get(e,n),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,Math.pow(this.get(e,n),t.get(e,n)));return this}}(N,A);class I extends N{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}}class L{constructor(t){let e,n,i,s,o,r,a,l,h,c=(t=I.checkMatrix(t)).clone(),u=c.rows,d=c.columns,f=new Float64Array(u),m=1;for(e=0;e<u;e++)f[e]=e;for(l=new Float64Array(u),n=0;n<d;n++){for(e=0;e<u;e++)l[e]=c.get(e,n);for(e=0;e<u;e++){for(h=Math.min(e,n),o=0,i=0;i<h;i++)o+=c.get(e,i)*l[i];l[e]-=o,c.set(e,n,l[e])}for(s=n,e=n+1;e<u;e++)Math.abs(l[e])>Math.abs(l[s])&&(s=e);if(s!==n){for(i=0;i<d;i++)r=c.get(s,i),c.set(s,i,c.get(n,i)),c.set(n,i,r);a=f[s],f[s]=f[n],f[n]=a,m=-m}if(n<u&&0!==c.get(n,n))for(e=n+1;e<u;e++)c.set(e,n,c.get(e,n)/c.get(n,n))}this.LU=c,this.pivotVector=f,this.pivotSign=m}isSingular(){let t=this.LU,e=t.columns;for(let n=0;n<e;n++)if(0===t.get(n,n))return!0;return!1}solve(t){t=A.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let n,i,s,o=t.columns,r=t.subMatrixRow(this.pivotVector,0,o-1),a=e.columns;for(s=0;s<a;s++)for(n=s+1;n<a;n++)for(i=0;i<o;i++)r.set(n,i,r.get(n,i)-r.get(s,i)*e.get(n,s));for(s=a-1;s>=0;s--){for(i=0;i<o;i++)r.set(s,i,r.get(s,i)/e.get(s,s));for(n=0;n<s;n++)for(i=0;i<o;i++)r.set(n,i,r.get(n,i)-r.get(s,i)*e.get(n,s))}return r}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,n=t.columns;for(let i=0;i<n;i++)e*=t.get(i,i);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,i=new A(e,n);for(let s=0;s<e;s++)for(let e=0;e<n;e++)s>e?i.set(s,e,t.get(s,e)):s===e?i.set(s,e,1):i.set(s,e,0);return i}get upperTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,i=new A(e,n);for(let s=0;s<e;s++)for(let e=0;e<n;e++)s<=e?i.set(s,e,t.get(s,e)):i.set(s,e,0);return i}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function k(t,e){let n=0;return Math.abs(t)>Math.abs(e)?(n=e/t,Math.abs(t)*Math.sqrt(1+n*n)):0!==e?(n=t/e,Math.abs(e)*Math.sqrt(1+n*n)):0}class R{constructor(t){let e,n,i,s,o=(t=I.checkMatrix(t)).clone(),r=t.rows,a=t.columns,l=new Float64Array(a);for(i=0;i<a;i++){let t=0;for(e=i;e<r;e++)t=k(t,o.get(e,i));if(0!==t){for(o.get(i,i)<0&&(t=-t),e=i;e<r;e++)o.set(e,i,o.get(e,i)/t);for(o.set(i,i,o.get(i,i)+1),n=i+1;n<a;n++){for(s=0,e=i;e<r;e++)s+=o.get(e,i)*o.get(e,n);for(s=-s/o.get(i,i),e=i;e<r;e++)o.set(e,n,o.get(e,n)+s*o.get(e,i))}}l[i]=-t}this.QR=o,this.Rdiag=l}solve(t){t=A.checkMatrix(t);let e=this.QR,n=e.rows;if(t.rows!==n)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let i,s,o,r,a=t.columns,l=t.clone(),h=e.columns;for(o=0;o<h;o++)for(s=0;s<a;s++){for(r=0,i=o;i<n;i++)r+=e.get(i,o)*l.get(i,s);for(r=-r/e.get(o,o),i=o;i<n;i++)l.set(i,s,l.get(i,s)+r*e.get(i,o))}for(o=h-1;o>=0;o--){for(s=0;s<a;s++)l.set(o,s,l.get(o,s)/this.Rdiag[o]);for(i=0;i<o;i++)for(s=0;s<a;s++)l.set(i,s,l.get(i,s)-l.get(o,s)*e.get(i,o))}return l.subMatrix(0,h-1,0,a-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(0===this.Rdiag[e])return!1;return!0}get upperTriangularMatrix(){let t,e,n=this.QR,i=n.columns,s=new A(i,i);for(t=0;t<i;t++)for(e=0;e<i;e++)t<e?s.set(t,e,n.get(t,e)):t===e?s.set(t,e,this.Rdiag[t]):s.set(t,e,0);return s}get orthogonalMatrix(){let t,e,n,i,s=this.QR,o=s.rows,r=s.columns,a=new A(o,r);for(n=r-1;n>=0;n--){for(t=0;t<o;t++)a.set(t,n,0);for(a.set(n,n,1),e=n;e<r;e++)if(0!==s.get(n,n)){for(i=0,t=n;t<o;t++)i+=s.get(t,n)*a.get(t,e);for(i=-i/s.get(n,n),t=n;t<o;t++)a.set(t,e,a.get(t,e)+i*s.get(t,n))}}return a}}class _{constructor(t,e={}){if((t=I.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let n=t.rows,i=t.columns;const{computeLeftSingularVectors:s=!0,computeRightSingularVectors:o=!0,autoTranspose:r=!1}=e;let a,l=Boolean(s),h=Boolean(o),c=!1;if(n<i)if(r){a=t.transpose(),n=a.rows,i=a.columns,c=!0;let e=l;l=h,h=e}else a=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else a=t.clone();let u=Math.min(n,i),d=Math.min(n+1,i),f=new Float64Array(d),m=new A(n,u),p=new A(i,i),g=new Float64Array(i),v=new Float64Array(n),y=new Float64Array(d);for(let t=0;t<d;t++)y[t]=t;let b=Math.min(n-1,i),w=Math.max(0,Math.min(i-2,n)),C=Math.max(b,w);for(let t=0;t<C;t++){if(t<b){f[t]=0;for(let e=t;e<n;e++)f[t]=k(f[t],a.get(e,t));if(0!==f[t]){a.get(t,t)<0&&(f[t]=-f[t]);for(let e=t;e<n;e++)a.set(e,t,a.get(e,t)/f[t]);a.set(t,t,a.get(t,t)+1)}f[t]=-f[t]}for(let e=t+1;e<i;e++){if(t<b&&0!==f[t]){let i=0;for(let s=t;s<n;s++)i+=a.get(s,t)*a.get(s,e);i=-i/a.get(t,t);for(let s=t;s<n;s++)a.set(s,e,a.get(s,e)+i*a.get(s,t))}g[e]=a.get(t,e)}if(l&&t<b)for(let e=t;e<n;e++)m.set(e,t,a.get(e,t));if(t<w){g[t]=0;for(let e=t+1;e<i;e++)g[t]=k(g[t],g[e]);if(0!==g[t]){g[t+1]<0&&(g[t]=0-g[t]);for(let e=t+1;e<i;e++)g[e]/=g[t];g[t+1]+=1}if(g[t]=-g[t],t+1<n&&0!==g[t]){for(let e=t+1;e<n;e++)v[e]=0;for(let e=t+1;e<n;e++)for(let n=t+1;n<i;n++)v[e]+=g[n]*a.get(e,n);for(let e=t+1;e<i;e++){let i=-g[e]/g[t+1];for(let s=t+1;s<n;s++)a.set(s,e,a.get(s,e)+i*v[s])}}if(h)for(let e=t+1;e<i;e++)p.set(e,t,g[e])}}let S=Math.min(i,n+1);if(b<i&&(f[b]=a.get(b,b)),n<S&&(f[S-1]=0),w+1<S&&(g[w]=a.get(w,S-1)),g[S-1]=0,l){for(let t=b;t<u;t++){for(let e=0;e<n;e++)m.set(e,t,0);m.set(t,t,1)}for(let t=b-1;t>=0;t--)if(0!==f[t]){for(let e=t+1;e<u;e++){let i=0;for(let s=t;s<n;s++)i+=m.get(s,t)*m.get(s,e);i=-i/m.get(t,t);for(let s=t;s<n;s++)m.set(s,e,m.get(s,e)+i*m.get(s,t))}for(let e=t;e<n;e++)m.set(e,t,-m.get(e,t));m.set(t,t,1+m.get(t,t));for(let e=0;e<t-1;e++)m.set(e,t,0)}else{for(let e=0;e<n;e++)m.set(e,t,0);m.set(t,t,1)}}if(h)for(let t=i-1;t>=0;t--){if(t<w&&0!==g[t])for(let e=t+1;e<i;e++){let n=0;for(let s=t+1;s<i;s++)n+=p.get(s,t)*p.get(s,e);n=-n/p.get(t+1,t);for(let s=t+1;s<i;s++)p.set(s,e,p.get(s,e)+n*p.get(s,t))}for(let e=0;e<i;e++)p.set(e,t,0);p.set(t,t,1)}let M=S-1,x=0,T=Number.EPSILON;for(;S>0;){let t,e;for(t=S-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+T*Math.abs(f[t]+Math.abs(f[t+1]));if(Math.abs(g[t])<=e||Number.isNaN(g[t])){g[t]=0;break}}if(t===S-2)e=4;else{let n;for(n=S-1;n>=t&&n!==t;n--){let e=(n!==S?Math.abs(g[n]):0)+(n!==t+1?Math.abs(g[n-1]):0);if(Math.abs(f[n])<=T*e){f[n]=0;break}}n===t?e=3:n===S-1?e=1:(e=2,t=n)}switch(t++,e){case 1:{let e=g[S-2];g[S-2]=0;for(let n=S-2;n>=t;n--){let s=k(f[n],e),o=f[n]/s,r=e/s;if(f[n]=s,n!==t&&(e=-r*g[n-1],g[n-1]=o*g[n-1]),h)for(let t=0;t<i;t++)s=o*p.get(t,n)+r*p.get(t,S-1),p.set(t,S-1,-r*p.get(t,n)+o*p.get(t,S-1)),p.set(t,n,s)}break}case 2:{let e=g[t-1];g[t-1]=0;for(let i=t;i<S;i++){let s=k(f[i],e),o=f[i]/s,r=e/s;if(f[i]=s,e=-r*g[i],g[i]=o*g[i],l)for(let e=0;e<n;e++)s=o*m.get(e,i)+r*m.get(e,t-1),m.set(e,t-1,-r*m.get(e,i)+o*m.get(e,t-1)),m.set(e,i,s)}break}case 3:{const e=Math.max(Math.abs(f[S-1]),Math.abs(f[S-2]),Math.abs(g[S-2]),Math.abs(f[t]),Math.abs(g[t])),s=f[S-1]/e,o=f[S-2]/e,r=g[S-2]/e,a=f[t]/e,c=g[t]/e,u=((o+s)*(o-s)+r*r)/2,d=s*r*(s*r);let v=0;0===u&&0===d||(v=u<0?0-Math.sqrt(u*u+d):Math.sqrt(u*u+d),v=d/(u+v));let y=(a+s)*(a-s)+v,b=a*c;for(let e=t;e<S-1;e++){let s=k(y,b);0===s&&(s=Number.MIN_VALUE);let o=y/s,r=b/s;if(e!==t&&(g[e-1]=s),y=o*f[e]+r*g[e],g[e]=o*g[e]-r*f[e],b=r*f[e+1],f[e+1]=o*f[e+1],h)for(let t=0;t<i;t++)s=o*p.get(t,e)+r*p.get(t,e+1),p.set(t,e+1,-r*p.get(t,e)+o*p.get(t,e+1)),p.set(t,e,s);if(s=k(y,b),0===s&&(s=Number.MIN_VALUE),o=y/s,r=b/s,f[e]=s,y=o*g[e]+r*f[e+1],f[e+1]=-r*g[e]+o*f[e+1],b=r*g[e+1],g[e+1]=o*g[e+1],l&&e<n-1)for(let t=0;t<n;t++)s=o*m.get(t,e)+r*m.get(t,e+1),m.set(t,e+1,-r*m.get(t,e)+o*m.get(t,e+1)),m.set(t,e,s)}g[S-2]=y,x+=1;break}case 4:if(f[t]<=0&&(f[t]=f[t]<0?-f[t]:0,h))for(let e=0;e<=M;e++)p.set(e,t,-p.get(e,t));for(;t<M&&!(f[t]>=f[t+1]);){let e=f[t];if(f[t]=f[t+1],f[t+1]=e,h&&t<i-1)for(let n=0;n<i;n++)e=p.get(n,t+1),p.set(n,t+1,p.get(n,t)),p.set(n,t,e);if(l&&t<n-1)for(let i=0;i<n;i++)e=m.get(i,t+1),m.set(i,t+1,m.get(i,t)),m.set(i,t,e);t++}x=0,S--}}if(c){let t=p;p=m,m=t}this.m=n,this.n=i,this.s=f,this.U=m,this.V=p}solve(t){let e=t,n=this.threshold,i=this.s.length,s=A.zeros(i,i);for(let t=0;t<i;t++)Math.abs(this.s[t])<=n?s.set(t,t,0):s.set(t,t,1/this.s[t]);let o=this.U,r=this.rightSingularVectors,a=r.mmul(s),l=r.rows,h=o.rows,c=A.zeros(l,h);for(let t=0;t<l;t++)for(let e=0;e<h;e++){let n=0;for(let s=0;s<i;s++)n+=a.get(t,s)*o.get(e,s);c.set(t,e,n)}return c.mmul(e)}solveForDiagonal(t){return this.solve(A.diag(t))}inverse(){let t=this.V,e=this.threshold,n=t.rows,i=t.columns,s=new A(n,this.s.length);for(let o=0;o<n;o++)for(let n=0;n<i;n++)Math.abs(this.s[n])>e&&s.set(o,n,t.get(o,n)/this.s[n]);let o=this.U,r=o.rows,a=o.columns,l=new A(n,r);for(let t=0;t<n;t++)for(let e=0;e<r;e++){let n=0;for(let i=0;i<a;i++)n+=s.get(t,i)*o.get(e,i);l.set(t,e,n)}return l}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,n=this.s;for(let i=0,s=n.length;i<s;i++)n[i]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return A.diag(this.s)}}function G(t,e,n,i,s){let o=n*i*i,r=A.eye(e.length,e.length,o);const a=s(e);let l=new Float64Array(t.x.length);for(let e=0;e<t.x.length;e++)l[e]=a(t.x[e]);let h=function(t,e,n,i,s){const o=n.length,r=t.x.length;let a=new Array(o);for(let l=0;l<o;l++){a[l]=new Array(r);let o=n.slice();o[l]+=i;let h=s(o);for(let n=0;n<r;n++)a[l][n]=e[n]-h(t.x[n])}return new A(a)}(t,l,e,i,s),c=function(t,e){const n=t.x.length;let i=new Array(n);for(let s=0;s<n;s++)i[s]=[t.y[s]-e[s]];return new A(i)}(t,l),u=function(t,e=!1){return t=I.checkMatrix(t),e?new _(t).inverse():function(t,e,n=!1){return t=I.checkMatrix(t),e=I.checkMatrix(e),n?new _(t).solve(e):t.isSquare()?new L(t).solve(e):new R(t).solve(e)}(t,A.eye(t.rows))}(r.add(h.mmul(h.transpose())));return(e=(e=new A([e])).sub(u.mmul(h).mmul(c).mul(i).transpose())).to1DArray()}function P(t,e,n={}){let{maxIterations:i=100,gradientDifference:r=.1,damping:a=0,errorTolerance:l=.01,minValues:h,maxValues:c,initialValues:u}=n;if(a<=0)throw new Error("The damping option must be a positive number");if(!t.x||!t.y)throw new Error("The data parameter must have x and y elements");if(!s(t.x)||t.x.length<2||!s(t.y)||t.y.length<2)throw new Error("The data parameter elements must be an array with more than 2 points");if(t.x.length!==t.y.length)throw new Error("The data parameter elements must have the same size");let d=u||new Array(e.length).fill(1),f=d.length;if(c=c||new Array(f).fill(Number.MAX_SAFE_INTEGER),h=h||new Array(f).fill(Number.MIN_SAFE_INTEGER),c.length!==h.length)throw new Error("minValues and maxValues must be the same size");if(!s(d))throw new Error("initialValues must be an array");let m,p=o(t,d,e),g=p<=l;for(m=0;m<i&&!g;m++){d=G(t,d,a,r,e);for(let t=0;t<f;t++)d[t]=Math.min(Math.max(h[t],d[t]),c[t]);if(p=o(t,d,e),isNaN(p))break;g=p<=l}return{parameterValues:d,parameterError:p,iterations:m}}},3379: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={},r=[],a=0;a<t.length;a++){var l=t[a],h=i.base?l[0]+i.base:l[0],c=o[h]||0,u="".concat(h," ").concat(c);o[h]=c+1;var d=n(u),f={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)e[d].references++,e[d].updater(f);else{var m=s(f,i);i.byIndex=a,e.splice(a,0,{identifier:u,updater:m,references:1})}r.push(u)}return r}function s(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,s){var o=i(t=t||[],s=s||{});return function(t){t=t||[];for(var r=0;r<o.length;r++){var a=n(o[r]);e[a].references--}for(var l=i(t,s),h=0;h<o.length;h++){var c=n(o[h]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}o=l}}},569: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)}},9216:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},3565:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},7795: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 s=void 0!==n.layer;s&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,s&&(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)}}}},4589: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))}}},7241:(t,e,n)=>{"use strict";n.d(e,{D:()=>h});var i=n(4469),s=n(976),o=n(3477),r=n(8447),a=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};const l=31;function h(t,e=!1,n){return a(this,void 0,void 0,(function*(){const a=t.tags.separator,h=t.tags[s.TAGS.UNITS],u=(0,r.vU)(h,a);let d;null!=n||(n=new Map);const f="helm"===h?(0,o.getHelmMonomers)(t):Object.keys((0,r.fy)(t,0,u).freq).filter((t=>""!==t));for(let t=0;t<f.length;t++)n.has(f[t])||n.set(f[t],`${n.size+1}`);if("helm"===h)d=yield i.functions.call("HELM:getMolFiles",{col:t}),d=function(t,e,n=!1){const i=new Array(t.length);for(let s=0;s<t.length;s++){let o=0,r=0,a="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";const h=t.get(s);o=h.indexOf("\n",o)+1,o=h.indexOf("\n",o)+1,o=h.indexOf("\n",o)+1;const c=parseInt(h.substring(o,o+3)),u=parseInt(h.substring(o+3,o+6));a+=`M V30 COUNTS ${c} ${u} 0 0 0\n`,a+="M V30 BEGIN ATOM\n";for(let t=0;t<c;t++){o=h.indexOf("\n",o)+1+l,r=h.indexOf(" ",o);const i=h.substring(o,r);a+=n?`M V30 ${t+1} R${e.get(i)} 0.000 0.000 0 0\n`:`M V30 ${t+1} At 0.000 0.000 0 0 MASS=${e.get(i)}\n`}a+="M V30 END ATOM\n",a+="M V30 BEGIN BOND\n";for(let t=0;t<u;t++){o=h.indexOf("\n",o)+1;const e=parseInt(h.substring(o,o+3).trim()),n=parseInt(h.substring(o+3,o+6).trim());a+=`M V30 ${t+1} ${parseInt(h.substring(o+6,o+9).trim())} ${e} ${n}\n`}a+="M V30 END BOND\n",a+="M V30 END CTAB\n",a+="M END",i[s]=a}return i}(d,n,e);else{d=new Array(t.length);for(let i=0;i<t.length;i++){const s=c(u(t.get(i)).filter((t=>""!==t)),n,e);d[i]=s}}return s.Column.fromStrings("monomericMols",d)}))}function c(t,e,n=!1){let i="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";i+=`M V30 COUNTS ${t.length} ${t.length?t.length-1:0} 0 0 0\n`,i+="M V30 BEGIN ATOM\n";for(let s=0;s<t.length;s++)i+=n?`M V30 ${s+1} R${e.get(t[s])} 0.000 0.000 0 0\n`:`M V30 ${s+1} At 0.000 0.000 0 0 MASS=${e.get(t[s])}\n`;i+="M V30 END ATOM\n",i+="M V30 BEGIN BOND\n";for(let e=0;e<t.length-1;e++)i+=`M V30 ${e+1} 1 ${e+1} ${e+2}\n`;return i+="M V30 END BOND\n",i+="M V30 END CTAB\n",i+="M END",i}},3477:(t,e,n)=>{"use strict";n.r(e),n.d(e,{SeqActivityCliffsEditor:()=>Pe,SeqPaletteCustom:()=>Se,SequenceSpaceEditor:()=>Fe,_package:()=>be,activityCliffs:()=>Oe,alignSequences:()=>Ze,bioSubstructureFilter:()=>nn,bioSubstructureSearch:()=>tn,compositionAnalysis:()=>Ue,convertDialog:()=>Ye,demoBioActivityCliffs:()=>rn,demoBioAtomicLevel:()=>an,demoBioHelmMsaSequenceSpace:()=>ln,demoBioSequenceSpace:()=>on,demoBioSimilarityDiversity:()=>sn,diversitySearchTopMenu:()=>Qe,diversitySearchViewer:()=>Je,fastaSequenceCellRenderer:()=>Ae,getBioLib:()=>Te,getHelmMonomers:()=>Ke,getMonomerLibHelper:()=>we,hydrophobPalette:()=>Ce,importFasta:()=>Be,initBio:()=>Me,libraryPanel:()=>Ee,macroMolColumnPropertyPanel:()=>Ie,macromoleculeDifferenceCellRenderer:()=>ke,manageFiles:()=>Ne,monomerCellRenderer:()=>ze,multipleSequenceAlignmentDialog:()=>He,saveAsFasta:()=>en,sdfToJsonLib:()=>De,separatorSequenceCellRenderer:()=>Le,sequenceAlignment:()=>Re,sequenceSpaceTopMenu:()=>We,sequenceTooltip:()=>xe,similaritySearchTopMenu:()=>$e,similaritySearchViewer:()=>je,splitToMonomers:()=>qe,testDetectMacromolecule:()=>Xe,toAtomicLevel:()=>Ve,vdRegionViewer:()=>Ge,webLogoViewer:()=>_e});var i=n(4469),s=n(3870),o=n(976),r=n(585);const a=r.GU;var l;!function(t){t.MSA="MSA",t.classic="classic"}(l||(l={}));const h=(t,e,n,i,s,o,r="rgb(100,100,100)",h=0,c=!1,u=1,d="",f=!1,m=l.classic,p={},g=0,v=null,y=[],b=null)=>{var w,C,S;s.textAlign="start";let M=o.substring(0),x=f?"":d;m===l.MSA&&(x="");let T=!0,N=!0,E="difference";null!=v&&null!=v.cell.column&&(T=null===(w=v.cell.column.temp["color-code"])||void 0===w||w,N=null===(C=v.cell.column.temp["compare-with-current"])||void 0===C||C,E=null!==(S=v.cell.column.temp["highlight-difference"])&&void 0!==S?S:"difference");const A=y[g];N&&y.length>0&&"difference"===E&&(u=M==A?.3:u),N&&y.length>0&&"equal"===E&&(u=M!=A?.3:u),null!=b&&(M=a(M,b));let I=s.measureText(M+x),L=s.measureText(M).width,k=s.measureText(M).width;const R=i/2-(I.fontBoundingBoxAscent+I.fontBoundingBoxDescent)/2+1;function _(n,i){const o=T?r:"rgb(0,0,0)";s.fillStyle=o,s.globalAlpha=u,m===l.classic&&(s.fillText(M,t+n,e+R),s.fillStyle="#808080",s.fillText(x,t+i,e+R)),m===l.MSA&&(s.fillStyle=o,s.fillText(M,t+n+(p[g]-k)/2,e+R))}if(I=I.width,m===l.MSA&&(L=p[g],I=p[g]),c||I>n)return _(5,5+L),t+L+s.measureText(x).width;{const e=(n-I)/2;return _(e,e+L),t+e+L}};var c=n(3553),u=n(8447),d=n(7331);const f="rgb(100,100,100)",m=u.GU;function p(t,e,n,i){return t?Math.min(t.canvas.width-n,i):e.canvas.width-n}function g(t){const e=!t.some(((e,n)=>e.length>1&&0!=n&&n!=t.length-1)),n=[],i=e?"":" ";return t.forEach(((e,s)=>{s<t.length&&(e+=`${e?"":"-"}${i}`),n.push(e)})),[n,e]}class v extends o.GridCellRenderer{get name(){return"sequence"}get cellType(){return"sequence"}get defaultHeight(){return 30}get defaultWidth(){return 230}onClick(t,e){t.cell.column.temp["current-word"]=t.cell.value,t.grid.invalidate()}onMouseMove(t,e){var n,i,o;if("SEQ.MSA"!==t.cell.column.getTag("aligned"))return;const r=t.cell.column.temp,a=r["bio-sum-maxLengthWords"],l=r["bio-maxIndex"],h=e.offsetX-t.gridColumn.left+(t.gridColumn.left-t.bounds.x);let c=0,d=l,f=!1;a[l+1]=h+1;let m=0;if(h>a[0])for(;!f;)m=Math.floor((d+c)/2),h>=a[m]&&h<=a[m+1]?(c=m,f=!0):h<a[m]?d=m-1:h>a[m+1]&&(c=m+1),c==d&&(f=!0);c=h>=a[c]?c+1:c;const p=null!==(n=t.cell.column.getTag("separator"))&&void 0!==n?n:"",g=(0,u.vU)("separator",p)(t.cell.value);(null!==(o=null===(i=g[c])||void 0===i?void 0:i.length)&&void 0!==o?o:0)>0?s.tooltip.show(s.div(g[c]),e.x+16,e.y+16):s.tooltip.hide()}render(t,e,n,i,s,r,a){var c;const d=-1!==r.gridRow?r.grid:null,g=r.cell,v=r.cell.column.getTag("alphabet");i=p(d,t,e,i),t.save(),t.beginPath(),t.rect(e,n,i,s),t.clip(),t.font="12px monospace",t.textBaseline="top";const y=r.cell.column.getTag(o.TAGS.UNITS),b=r.cell.column.getTag("aligned"),w=(0,u.py)(v),C=null!==(c=r.cell.column.getTag("separator"))&&void 0!==c?c:"",S=i/5,M=(0,u.vU)(y,C,S),x=r.cell.column.temp,T=x["reference-sequence"],N=x["current-word"],E=x["monomer-width"],A=M(null!=T&&""!=T?T:null!=N?N:"");let I=5,L=0,k=8;"short"===(null!=E?E:"short")&&(I=12,k=1);let R={};if(r.cell.column.getTag(".calculatedCellRender")!==S.toString()){let t=0;for(;t<Math.min(r.cell.column.length,100);)M(r.cell.column.get(t)).forEach(((t,e)=>{var n;const i=7*m(t,k).length+I;i>(null!==(n=R[e])&&void 0!==n?n:0)&&(R[e]=i),e>L&&(L=e)})),t+=1;const e=21;for(let t=0;t<=L;t++){R[t]<e&&(R[t]=e);const n={};n[0]=R[0];for(let t=1;t<=L;t++)n[t]=n[t-1]+R[t];x["bio-sum-maxLengthWords"]=n,x["bio-maxIndex"]=L,x["bio-maxLengthWords"]=R,r.cell.column.setTag(".calculatedCellRender",S.toString())}}else R=x["bio-maxLengthWords"];const _=M(g.value);let G=e,P=f,O=l.classic;b&&b.includes("MSA")&&"separator"==y&&(O=l.MSA),_.every(((e,o)=>{P=w.get(e),t.fillStyle=f;const a=o===_.length-1;return G=h(G,n,i,s,t,e,P,0,!0,1,C,a,O,R,o,r,A,k),50<=i})),t.restore()}}class y extends o.GridCellRenderer{get name(){return c.Of.MONOMER}get cellType(){return c.Of.MONOMER}get defaultHeight(){return 15}get defaultWidth(){return 30}render(t,e,n,i,s,o,r){t.font="12px monospace",t.textBaseline="middle",t.textAlign="center";const a=(0,u.py)(o.cell.column.getTag("alphabet")),l=o.cell.value;if(!l)return;const h=a.get(l);t.fillStyle=h,t.fillText((0,u.GU)(l,3),e+i/2,n+s/2,i)}}class b extends o.GridCellRenderer{get name(){return"MacromoleculeDifferenceCR"}get cellType(){return c.Of.MACROMOLECULE_DIFFERENCE}get defaultHeight(){return 30}get defaultWidth(){return 230}render(t,e,n,i,s,r,a){var l;const h=r.grid,c=null!==(l=r.cell.value)&&void 0!==l?l:"",d=r.tableColumn.tags.separator,f=r.tableColumn.tags[o.TAGS.UNITS];i=p(h,t,e,i);const[m,g]=c.split("#"),v=(0,u.vU)(f,d);w(t,e,n,i,s,v(m),v(g),f)}}function w(t,e,n,i,s,o,r,a,l,c){if(o.length!==r.length){const t=function(t,e){let n=0,i=0;const s=t.length>e.length?t:e;let o=t.length>e.length?e:t;for(let t=0;t<o.length;t++)s[t]===o[t]&&n++;const r=s.length-o.length;for(let t=s.length-1;t>r;t--)s[t]===o[t-r]&&i++;const a=new Array(Math.abs(t.length-e.length)).fill("");function l(t){return n>i?t.concat(a):a.concat(t)}return t.length>e.length?e=l(e):t=l(t),{subParts1:t,subParts2:e}}(o,r);o=t.subParts1,r=t.subParts2}const f=t.measureText(g(o).join("")),m=t.measureText(g(r).join("")),p=Math.max(f.width,m.width);l&&(i=p+4*o.length,t.canvas.width=p+4*o.length);let v=Math.max(e,e+(i-(p+4*o.length))/2);const y=Math.max(n,n+(s-28)/2);t.save(),t.beginPath(),t.rect(e,n,l?p+4*o.length:i,s),t.clip(),t.font="12px monospace",t.textBaseline="top";let b=d.UE.Color;"HELM"!=a&&(b=(0,u.py)(a.substring(a.length-2)));for(let e=0;e<o.length;e++){const n=o[e],a=r[e],l=b.get(n);if(n!=a){const o=b.get(a),r=h(v,y-7,i,s,t,n,l,0,!0),u=h(v,y+7,i,s,t,a,o,0,!0);v=Math.max(u,r),c&&(c[e]=C(n,a,l,o,y,7,s))}else v=h(v,y,i,s,t,n,l,0,!0,.5);v+=4}t.restore()}function C(t,e,n,i,s,o,r){const a=document.createElement("canvas"),l=a.getContext("2d");l.font="12px monospace";const c=l.measureText(g([t]).join("")).width,u=l.measureText(g([e]).join("")).width,d=Math.max(c,u);return a.height=r,a.width=d+4,l.font="12px monospace",l.textBaseline="top",h(0,s-o,d,r,l,t,n,0,!0),h(0,s+o,d,r,l,e,i,0,!0),a}var S,M=n(701),x=n(2121),T=n(9298);!function(t){t.Unknown="unknown",t.FR="framework",t.CDR="cdr"}(S||(S={})),new class{constructor(){this.regionTypes=[S.CDR],this.chains=["Heavy","Light"],this.skipEmptyPositions=!1,this.positionWidth=16,this.positionHeight=T.ES.Entropy}};var N=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};const E=S;class A extends o.JsViewer{constructor(){super(),this.viewed=!1,this.regionsFg=null,this.regionsRoot=null,this.isOpened=!1,this.panelNode=null,this.regions=[],this.viewPromise=Promise.resolve(),this.host=null,this.filterSourceInput=null,this.mainLayout=null,this.logos=[],this.viewSubs=[],this.regionTypes=this.stringList("regionTypes",[E.CDR],{choices:Object.values(E).filter((t=>t!=E.Unknown))}),this.chains=this.stringList("chains",["Heavy","Light"],{choices:["Heavy","Light"]}),this.skipEmptyPositions=this.bool("skipEmptyPositions",!1),this.positionWidth=this.float("positionWidth",16),this.positionHeight=this.string("positionHeight",T.ES.Entropy,{choices:Object.keys(T.ES)})}init(){return N(this,void 0,void 0,(function*(){this.subs.push(s.onSizeChanged(this.root).subscribe(this.rootOnSizeChanged.bind(this))),this.subs.push(M.fromEvent(this.root,"mousemove").subscribe(this.rootOnMouseMove.bind(this)))}))}onTableAttached(){const t=Object.create(null,{onTableAttached:{get:()=>super.onTableAttached}});return N(this,void 0,void 0,(function*(){const e=t.onTableAttached.bind(this);this.viewPromise=this.viewPromise.then((()=>N(this,void 0,void 0,(function*(){e(),this.viewed||(yield this.buildView("onTableAttached"),this.viewed=!0)}))))}))}onPropertyChanged(t){if(super.onPropertyChanged(t),t)switch(t&&t.name,t.name){case"skipEmptyPositions":case"positionWidth":case"positionHeight":this.setData(this.dataFrame,this.regions)}else console.warn("Bio: VdRegionsViewer.onPropertyChanged() property is null")}setData(t,e){console.debug("Bio: VdRegionsViewer.setData()"),this.viewPromise=this.viewPromise.then((()=>N(this,void 0,void 0,(function*(){this.viewed&&(yield this.destroyView("setData"),this.viewed=!1)})))),this.regions=e,this.dataFrame=t,this.viewPromise=this.viewPromise.then((()=>N(this,void 0,void 0,(function*(){this.viewed||(yield this.buildView("setData"),this.viewed=!0)}))))}detach(){const t=super.detach.bind(this);this.viewPromise=this.viewPromise.then((()=>N(this,void 0,void 0,(function*(){this.viewed&&(yield this.destroyView("detach"),this.viewed=!1),t()}))))}destroyView(t){return N(this,void 0,void 0,(function*(){console.debug(`Bio: VdRegionsViewer.destroyView( mainLayout = ${this.mainLayout?"value":"none"} ), purpose = '${t}'`),this.filterSourceInput&&s.empty(this.filterSourceInput.root),null!=this.mainLayout&&(this.mainLayout.remove(),this.host.remove(),this.host=null,this.mainLayout=null);for(const t of this.viewSubs)t.unsubscribe()}))}buildView(t){return N(this,void 0,void 0,(function*(){console.debug(`Bio: VdRegionsViewer.buildView() begin, purpose = '${t}'`);const e=this.regions.filter((t=>this.regionTypes.includes(t.type))),n=Array.from(new Set(e.map((t=>t.order)))).sort();this.logos=[];for(let t=0;t<n.length;t++){const i={};for(const s of this.chains){const o=e.find((e=>e.order==n[t]&&e.chain==s));i[s]=yield this.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:o.sequenceColumnName,startPositionName:o.positionStartName,endPositionName:o.positionEndName,fixWidth:!0,skipEmptyPositions:this.skipEmptyPositions,positionWidth:this.positionWidth,positionHeight:this.positionHeight})}this.logos[t]=i}this.mainLayout=s.table(this.chains,(t=>[...n.length>0?[s.div(t,{style:{transform:"rotate(-90deg)",font:"12px Roboto, Roboto Local, sans-serif",textAlign:"center",width:"16px",marginTop:"24px",marginLeft:"6px"}})]:[],...[...Array(n.length).keys()].map((e=>{const n=this.logos[e][t];return n.root.style.height="100%",s.div([n.root],{style:{marginTop:"4px",marginBottom:"4px"}})}))]),["",...[...Array(n.length).keys()].map((t=>e.find((e=>e.order==n[t]&&e.chain==this.chains[0])).name||"Name"))]),this.mainLayout.className="mlb-vd-regions-viewer-table2",this.filterSourceInput=s.boolInput("",!1,this.filterSourceInputOnValueChanged.bind(this)),this.filterSourceInput.root.style.position="absolute",this.filterSourceInput.root.style.left="10px",this.filterSourceInput.root.style.top="-3px",s.tooltip.bind(this.filterSourceInput.root,"Check to filter sequences for selected VRs"),Math.ceil(255*Math.random()).toString(16),this.host=s.div([this.mainLayout,this.filterSourceInput.root],{}),this.root.appendChild(this.host),this.root.style.overflowX="auto",this.calcSize(),console.debug("Bio: VdRegionsViewer.buildView() end")}))}calcSize(){const t=(this.root.clientHeight-54)/this.chains.length,e=Math.min(t,Math.max(...this.logos.map((t=>Math.max(...Object.values(t).map((t=>t.maxHeight)))))));for(let t=0;t<this.logos.length;t++)for(let n=0;n<this.chains.length;n++){const i=this.chains[n];this.logos[t][i].root.style.height=`${e}px`}}rootOnSizeChanged(t){this.calcSize()}rootOnMouseMove(t){}filterSourceInputOnValueChanged(){const t=1==this.filterSourceInput.value?T.Ct.Selected:T.Ct.Filtered;for(let e=0;e<this.logos.length;e++)for(let n=0;n<this.chains.length;n++){const i=this.chains[n];this.logos[e][i].setOptions({[x.bo.filterSource]:t})}}}var I=n(9017),L=n(850),k=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};function R(t,e,i,s){return k(this,void 0,void 0,(function*(){const o=yield function(t,e,i){return new Promise((function(s,o){const r=new Worker(new URL(n.p+n.u(457),n.b));r.postMessage({columnData:t.data,method:e,measure:t.metric,options:i}),r.onmessage=({data:{error:t,distance:e,embedding:n}})=>{t?o(t):s({distance:e,embedding:n})}}))}({data:t,metric:i},e,s);return o.embedding=o.embedding.map((t=>(0,L.Fv)(t))),o}))}var _=n(7983),G=n(499),P=n(7767),O=n(489),F=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};function W(t){return F(this,void 0,void 0,(function*(){const e=new P.L(t.seqCol);if(e.isFasta()||e.isSeparator()&&e.alphabet&&"UN"!==e.alphabet){let n=O.U.LEVENSHTEIN,i=t.seqCol.toList();if(e.isSeparator()){const t=e.convert("fasta");i=t.toList(),n=new G.C(t).getDistanceFunctionName()}else n=e.getDistanceFunctionName();const s=yield R(i,t.methodName,n,t.options),r=t.embedAxesNames.map(((t,e)=>o.Column.fromFloat32Array(t,s.embedding[e])));return{distance:s.distance,coordinates:new o.ColumnList(r)}}return yield function(t){return F(this,void 0,void 0,(function*(){return t.seqCol.version!==t.seqCol.temp["last-invalidated-version"]&&(yield(0,_.HV)(t.seqCol,!1)),yield i.functions.call("Chem:getChemSpaceEmbeddings",{col:t.seqCol.temp["monomeric-mols"],methodName:t.methodName,similarityMetric:t.similarityMetric,xAxis:t.embedAxesNames[0],yAxis:t.embedAxesNames[1],options:t.options})}))}(t)}))}function V(t){const e=["Embed_X","Embed_Y"],n=t.columns.names().filter((t=>t.includes(e[0]))).length+1;return e.map((t=>`${t}_${n}`))}var H=n(5697),Z=n(3379),U=n.n(Z),D=n(7795),B=n.n(D),Y=n(569),z=n.n(Y),X=n(3565),q=n.n(X),K=n(9216),j=n.n(K),$=n(4589),J=n.n($),Q=n(9414),tt={};tt.styleTagTransform=J(),tt.setAttributes=q(),tt.insert=z().bind(null,"head"),tt.domAPI=B(),tt.insertStyleElement=j(),U()(Q.Z,tt),Q.Z&&Q.Z.locals&&Q.Z.locals;var et=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};let nt=0;const it="cliffsDf",st=new M.Subject,ot="act_diff",rt="sali",at="sim",lt="line_index",ht=["1_seq","2_seq"],ct="filterCliffs";function ut(t,e,n){const i=e.getBoundingClientRect(),s=t.clientX-i.left,o=t.clientY-i.top;let r=null,a=0;for(const t of n){const e=Math.abs(Math.hypot(t.a[0]-s,t.a[1]-o)+Math.hypot(t.b[0]-s,t.b[1]-o)-Math.hypot(t.a[0]-t.b[0],t.a[1]-t.b[1]));(!a&&e<2||e<a)&&(a=e,r=t)}return r}var dt=n(1040),ft=(n(7861),function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))});function mt(t,e,n,s,r){return ft(this,void 0,void 0,(function*(){e.version!==e.temp["last-invalidated-version"]&&(yield(0,_.HV)(e,!1));const n=o.DataFrame.create(e.length);return n.columns.addNewString(s).init((t=>e.temp["monomeric-mols"].get(t))),yield i.functions.call("Chem:getChemSimilaritiesMatrix",{dim:t,col:e.temp["monomeric-mols"],df:n,colName:s,simArr:r})}))}function pt(t){const e=s.divH([]),n=s.divV([s.divText(t.seqCol.name),s.divText(t.activityCol.name)]);return n.style.fontWeight="bold",n.style.display="flex",n.style.justifyContent="space-between",e.append(n),t.line.mols.forEach(((n,i)=>{const o=s.divText(t.activityCol.get(n).toFixed(2));o.style.display="flex",o.style.justifyContent="left",o.style.paddingLeft="30px",e.append(s.divV([s.divText(t.seqCol.get(n)),o]))})),e}function gt(t){const e=s.div();e.append(s.divText(t.seqCol.name,{style:{fontWeight:"bold"}}));const n=new Array(2),i=new Array(2);t.line.mols.forEach(((e,s)=>{n[s]=t.seqCol.get(e),i[s]=t.activityCol.get(e)}));const r={},a=t.seqCol.getTag(o.TAGS.UNITS),l=t.seqCol.getTag("separator"),h=(0,u.vU)(a,l),c=yt(h(n[0]),h(n[1]),a,r);return e.append(s.div(c,{style:{width:"300px",overflow:"scroll"}})),e.append(bt(r)),e.append(vt("Activity delta",Math.abs(i[0]-i[1]))),e.append(vt("Cliff",t.sali)),e}function vt(t,e){return s.divH([s.divText(`${t}: `,{style:{fontWeight:"bold",paddingRight:"5px"}}),s.divText(e.toFixed(2))],{style:{paddingTop:"10px"}})}function yt(t,e,n,i){const s=document.createElement("canvas"),o=s.getContext("2d");return s.height=30,w(o,0,0,0,30,t,e,n,!0,i),s}function bt(t){const e=s.div();if(Object.keys(t).length>0){const n=s.divV([]);n.append(s.divH([s.divText("Pos",{style:{fontWeight:"bold",width:"30px",borderBottom:"1px solid"}}),s.divText("Difference",{style:{fontWeight:"bold",borderBottom:"1px solid"}})]));for(const e of Object.keys(t))t[e].style.borderBottom="1px solid lightgray",n.append(s.divH([s.divText((parseInt(e)+1).toString(),{style:{width:"30px",borderBottom:"1px solid lightgray"}}),t[e]]));e.append(n)}return e}function wt(t,e){const n=o.Column.string("seq_diff",t.rowCount).init((n=>`${t.get(e[0],n)}#${t.get(e[1],n)}`));n.semType="MacromoleculeDifference",n.setTag(o.TAGS.UNITS,t.col(e[0]).getTag(o.TAGS.UNITS)),n.setTag("separator",t.col(e[0]).getTag("separator")),t.columns.add(n);const i=t.plot.grid();return i.col(e[0]).visible=!1,i.col(e[1]).visible=!1,i}var Ct=n(4004),St=n(7228),Mt=n(1731),xt=n(5226);n(9133);var Tt=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};class Nt extends o.JsViewer{constructor(t){super(),this.name="",this.metricsProperties=["distanceMetric","fingerprint"],this.fingerprintChoices=["Morgan","Pattern"],this.initialized=!1,this.tags=[o.TAGS.UNITS,"aligned","separator","alphabet"],this.fingerprint=this.string("fingerprint",this.fingerprintChoices[0],{choices:this.fingerprintChoices}),this.limit=this.int("limit",10),this.distanceMetric=this.string("distanceMetric",H.kg[0],{choices:H.kg}),this.moleculeColumnName=this.string("moleculeColumnName"),this.name=t}init(){this.initialized=!0}detach(){this.subs.forEach((t=>t.unsubscribe()))}onTableAttached(){var t;return Tt(this,void 0,void 0,(function*(){if(this.init(),this.dataFrame){this.subs.push(o.debounce(this.dataFrame.onRowsRemoved,50).subscribe((t=>Tt(this,void 0,void 0,(function*(){return yield this.render()})))));const e="diversity"!==this.name;this.subs.push(o.debounce(this.dataFrame.onCurrentRowChanged,50).subscribe((t=>Tt(this,void 0,void 0,(function*(){return yield this.render(e)}))))),this.subs.push(o.debounce(this.dataFrame.selection.onChanged,50).subscribe((t=>Tt(this,void 0,void 0,(function*(){return yield this.render(!1)}))))),this.subs.push(o.debounce(s.onSizeChanged(this.root),50).subscribe((t=>Tt(this,void 0,void 0,(function*(){return yield this.render(!1)}))))),this.moleculeColumn=this.dataFrame.columns.bySemType(o.SEMTYPE.MACROMOLECULE),this.moleculeColumnName=null===(t=this.moleculeColumn)||void 0===t?void 0:t.name,this.getProperty("limit").fromOptions({min:1,max:this.dataFrame.rowCount})}yield this.render()}))}onPropertyChanged(t){if(super.onPropertyChanged(t),this.initialized){if("moleculeColumnName"===t.name){const e=this.dataFrame.col(t.get(this));e.semType===o.SEMTYPE.MACROMOLECULE&&(this.moleculeColumn=e)}this.render()}}render(t=!0){return Tt(this,void 0,void 0,(function*(){}))}beforeRender(){return!(!this.initialized||this.dataFrame&&this.moleculeColumnName&&this.dataFrame.col(this.moleculeColumnName).semType!==o.SEMTYPE.MACROMOLECULE&&(i.shell.error(`${this.moleculeColumnName} is not Macromolecule type`),1))}}var Et=n(7241),At=n(4293),It=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};function Lt(t){return It(this,void 0,void 0,(function*(){const e=t.toList(),i=new Worker(new URL(n.p+n.u(925),n.b));if(t.semType!==o.SEMTYPE.MACROMOLECULE)throw new Error("Column has to be of macromolecule type");const s=new G.C(t).getDistanceFunctionName();return i.postMessage({values:e,fnName:s}),new Promise(((t,e)=>{i.onmessage=({data:{error:n,distanceMatrixData:s}})=>{i.terminate(),n?e(n):t(s)}}))}))}function kt(t){return(e,n)=>{const i=(e,n)=>t*e+n-Math.floor((e+2)*(e+1)/2);return e<=n?i(e,n):i(n,e)}}var Rt=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};class _t extends Nt{constructor(){super("similarity"),this.sketchedMolecule="",this.curIdx=0,this.molCol=null,this.idxs=null,this.scores=null,this.gridSelect=!1,this.targetMoleculeIdx=0,this.computeCompleted=new M.Subject,this.distanceMatrixComputed=!1,this.cutoff=this.float("cutoff",.01,{min:0,max:1}),this.hotSearch=this.bool("hotSearch",!0),this.similarColumnLabel=this.string("similarColumnLabel",null)}init(){this.hotSearch=!0,this.initialized=!0}render(t=!0){var e;return Rt(this,void 0,void 0,(function*(){if(this.beforeRender()&&this.moleculeColumn&&(this.curIdx=-1==this.dataFrame.currentRowIdx?0:this.dataFrame.currentRowIdx,t&&!this.gridSelect)){this.targetMoleculeIdx=-1==this.dataFrame.currentRowIdx?0:this.dataFrame.currentRowIdx;const t=new G.C(this.moleculeColumn);yield t.isFasta()?this.computeByMM():this.computeByChem();const n=null!=this.similarColumnLabel?this.similarColumnLabel:`similar (${this.moleculeColumnName})`;this.molCol=o.Column.string(n,this.idxs.length).init((t=>{var e,n;return null===(e=this.moleculeColumn)||void 0===e?void 0:e.get(null===(n=this.idxs)||void 0===n?void 0:n.get(t))})),this.molCol.semType=o.SEMTYPE.MACROMOLECULE,this.tags.forEach((t=>this.molCol.setTag(t,this.moleculeColumn.getTag(t))));const s=o.DataFrame.fromColumns([this.idxs,this.molCol,this.scores]);s.onCurrentRowChanged.subscribe((t=>{this.dataFrame.currentRowIdx=s.col("indexes").get(s.currentRowIdx),setTimeout((()=>{this.createPropertyPanel(s)}),1e3),this.gridSelect=!0}));const r=s.plot.grid();r.col("indexes").visible=!1;const a=null===(e=this.idxs)||void 0===e?void 0:e.getRawData().findIndex((t=>t==this.targetMoleculeIdx));r.cell("score",a).cell.value=null,i.shell.v.grid.root.addEventListener("click",(t=>{this.gridSelect=!1})),(0,At.Y)(this.root,r.root),this.computeCompleted.next(!0)}}))}computeByChem(){return Rt(this,void 0,void 0,(function*(){const t=yield(0,Et.D)(this.moleculeColumn),e=(o.DataFrame.fromColumns([t]),yield i.functions.call("Chem:callChemSimilaritySearch",{df:this.dataFrame,col:t,molecule:t.get(this.targetMoleculeIdx),metricName:this.distanceMetric,limit:this.limit,minScore:this.cutoff,fingerprint:this.fingerprint}));this.idxs=e.getCol("indexes"),this.scores=e.getCol("score")}))}computeByMM(){return Rt(this,void 0,void 0,(function*(){this.distanceMatrixComputed||(this.mmDistanceMatrix=yield Lt(this.moleculeColumn),this.distanceMatrixComputed=!0);const t=this.moleculeColumn.length,e=kt(t),n=Array(t).fill(0).map(((t,n)=>({idx:n,score:n===this.targetMoleculeIdx?1:1-this.mmDistanceMatrix[e(this.targetMoleculeIdx,n)]})));n.sort(((t,e)=>e.score-t.score));const i=Math.min(this.limit,t),s=n.slice(0,i);this.idxs=o.Column.int("indexes",i).init((t=>s[t].idx)),this.scores=o.Column.float("score",i).init((t=>s[t].score))}))}createPropertyPanel(t){var e;const n=s.div(),r={},a=null===(e=this.molCol)||void 0===e?void 0:e.name,l=t.col(a).getTag(o.TAGS.UNITS),h=t.col(a).getTag("separator"),c=(0,u.vU)(l,h),d=c(this.moleculeColumn.get(this.targetMoleculeIdx)),f=c(t.get(a,t.currentRowIdx)),m=yt(d,f,l,r);n.append(s.div(m,{style:{width:"300px",overflow:"scroll"}})),d.length!==f.length&&n.append(s.divV([s.divText("Different sequence length:",{style:{fontWeight:"bold"}}),s.divText(`target: ${d.length} monomers`),s.divText(`selected: ${f.length} monomers`)],{style:{paddingBottom:"10px"}})),n.append(bt(r));const p=s.accordion(),g=s.element("i");g.className="grok-icon svg-icon svg-view-layout",p.addTitle(s.span([g,s.label("Similarity search")])),p.addPane("Differences",(()=>n),!0),i.shell.o=p.root}}var Gt=n(8518),Pt=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};class Ot extends Nt{constructor(){super("diversity"),this.renderMolIds=null,this.columnNames=[],this.computeCompleted=new M.Subject,this.diverseColumnLabel=this.string("diverseColumnLabel",null)}render(t=!0){return Pt(this,void 0,void 0,(function*(){if(this.beforeRender()&&this.dataFrame&&t&&this.moleculeColumn){const t=new G.C(this.moleculeColumn);yield t.isFasta()?this.computeByMM():this.computeByChem();const e=null!=this.diverseColumnLabel?this.diverseColumnLabel:`diverse (${this.moleculeColumnName})`,n=o.Column.string(e,this.renderMolIds.length).init((t=>{var e;return null===(e=this.moleculeColumn)||void 0===e?void 0:e.get(this.renderMolIds[t])}));n.semType=o.SEMTYPE.MACROMOLECULE,this.tags.forEach((t=>n.setTag(t,this.moleculeColumn.getTag(t))));const i=o.DataFrame.fromColumns([n]);(0,At.Y)(this.root,i.plot.grid().root),this.computeCompleted.next(!0)}}))}computeByChem(){return Pt(this,void 0,void 0,(function*(){const t=yield(0,Et.D)(this.moleculeColumn);o.DataFrame.fromColumns([t]),this.renderMolIds=yield i.functions.call("Chem:callChemDiversitySearch",{col:t,metricName:this.distanceMetric,limit:this.limit,fingerprint:this.fingerprint})}))}computeByMM(){return Pt(this,void 0,void 0,(function*(){const t=yield Lt(this.moleculeColumn),e=this.moleculeColumn.length,n=kt(e);this.renderMolIds=(0,Gt.L)(e,Math.min(e,this.limit),((e,i)=>t[n(e,i)]))}))}}var Ft=n(9943),Wt=n(4413),Vt=n(1061),Ht=n(1345),Zt=n(116);const Ut={[o.SEMTYPE.MOLECULE]:"Molecules",[o.SEMTYPE.MACROMOLECULE]:"Sequences"};class Dt{get algorithmOptions(){const t=this.methodsParams[this.methodInput.value],e={};return Object.keys(t).forEach((n=>{null!=t[n].value&&(e[n]=t[n].value)})),e}constructor(t){this.methodSettingsDiv=s.inputs([]),this.methodsParams={[Zt.AL.UMAP]:new Zt.bD,[Zt.AL.T_SNE]:new Zt.aP},this.tableInput=s.tableInput("Table",i.shell.tv.dataFrame,void 0,(()=>{this.onTableInputChanged(t)})),this.molColInput=s.columnInput(Ut[t],this.tableInput.value,this.tableInput.value.columns.bySemType(t)),this.molColInputRoot=this.molColInput.root,this.methodInput=s.choiceInput("Method",Zt.AL.UMAP,[Zt.AL.UMAP,Zt.AL.T_SNE],(()=>{e&&this.createAlgorithmSettingsDiv(this.methodSettingsDiv,this.methodsParams[this.methodInput.value])})),this.methodSettingsIcon=s.icons.settings((()=>{e=!e,e?this.createAlgorithmSettingsDiv(this.methodSettingsDiv,this.methodsParams[this.methodInput.value]):s.empty(this.methodSettingsDiv)}),"Modify methods parameters"),this.methodInput.root.classList.add("ml-dim-reduction-settings-input"),this.methodInput.root.prepend(this.methodSettingsIcon),this.methodSettingsDiv=s.inputs([]);let e=!1;this.similarityMetricInput=s.choiceInput("Similarity",dt.gk.Tanimoto,H.Rt)}createAlgorithmSettingsDiv(t,e){return s.empty(t),Object.keys(e).forEach((n=>{const i=e[n],o=s.floatInput(i.uiName,i.value,(()=>{i.value=o.value}));s.tooltip.bind(o.root,i.tooltip),t.append(o.root)})),t}onTableInputChanged(t){this.molColInput=s.columnInput(Ut[t],this.tableInput.value,this.tableInput.value.columns.bySemType(t)),s.empty(this.molColInputRoot),Array.from(this.molColInput.root.children).forEach((t=>this.molColInputRoot.append(t)))}}class Bt extends Dt{get funcParams(){return{table:this.tableInput.value,molecules:this.molColInput.value,methodName:this.methodInput.value,similarityMetric:this.similarityMetricInput.value,plotEmbeddings:this.plotEmbeddingsInput.value,options:this.algorithmOptions}}get paramsUI(){return this.funcParamsDiv}constructor(t){super(t),this.plotEmbeddingsInput=s.boolInput("Plot Embeddings",!0),this.funcParamsDiv=s.inputs([this.tableInput,this.molColInput,this.methodInput,this.methodSettingsDiv,this.similarityMetricInput,this.plotEmbeddingsInput],{style:{minWidth:"320px"}})}}class Yt extends Dt{get funcParams(){return{table:this.tableInput.value,molecules:this.molColInput.value,activities:this.tableInput.value.col(this.activitiesDataframe?this.activitiesInput.value.name:""),similarity:this.similarityInput.value,methodName:this.methodInput.value,similarityMetric:this.similarityMetricInput.value,options:this.algorithmOptions}}get paramsUI(){return this.funcParamsDiv}constructor(t){super(t);const e=Array.from(this.tableInput.value.columns.numerical);this.activitiesDataframe=e.length?o.DataFrame.fromColumns(e):"",this.activitiesInput=s.columnInput("Activities",this.activitiesDataframe,this.activitiesDataframe?this.activitiesDataframe.columns.byIndex(0):""),this.activitiesInputRoot=this.activitiesInput.root,this.similarityInput=s.intInput("Similarity cutoff",80),s.tooltip.bind(this.similarityInput.root,"Pairs of similar (cutoff is used) molecules with high difference in activity are considered 'cliffs'"),this.funcParamsDiv=s.inputs([this.tableInput,this.molColInput,this.activitiesInput,this.similarityInput,this.methodInput,this.methodSettingsDiv,this.similarityMetricInput],{style:{minWidth:"320px"}})}onTableInputChanged(t){super.onTableInputChanged(t),s.empty(this.activitiesInputRoot);const e=Array.from(this.tableInput.value.columns.numerical);this.activitiesDataframe=e.length?o.DataFrame.fromColumns(e):"",this.activitiesInput=s.columnInput("Activities",this.activitiesDataframe,this.activitiesDataframe?this.activitiesDataframe.columns.byIndex(0):""),Array.from(this.activitiesInput.root.children).forEach((t=>this.activitiesInputRoot.append(t)))}}var zt=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};class Xt{constructor(t,e,n=!1,i){var o;this.name="",this.description="",this._isAutomatic=!1,this._autoStartFirstStep=!1,this._currentStep=0,this._isStopped=!1,this._isCancelled=!1,this._isStepProcessed=!1,this._root=s.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._steps=[],this._mainHeader=s.panel([],"tutorials-main-header"),this._header=s.h2(""),this._headerDiv=s.divH([],"tutorials-root-header"),this._stopStartBtn=s.button(s.iconFA("pause"),(()=>this._changeStopState()),"Play / pause"),this._restartBtn=s.button(s.iconFA("redo"),(()=>this._restartScript()),"Restart"),this._nextStepBtn=s.button(s.iconFA("play"),(()=>{this._isStepProcessed||this._nextStep()}),"Next step"),this._activity=s.panel([],"tutorials-root-description"),this._progressDiv=s.divV([],"tutorials-root-progress"),this._progress=s.element("progress"),this._progressSteps=s.divText(""),this._closeBtn=s.button(s.iconFA("chevron-left"),(()=>this._closeDock()),"Back to demo"),this.name=t,this.description=e,this._isAutomatic=n,this._autoStartFirstStep=null!==(o=null==i?void 0:i.autoStartFirstStep)&&void 0!==o&&o,this._progress.max=0,this._progress.value=1,Xt.currentObject=this}get steps(){return this._steps}get stepNumber(){return this._steps.length}_addHeader(){this._createHeaderDiv(),this._createProgressDiv(),this._mainHeader.append(this._headerDiv,this._progressDiv)}_createHeaderDiv(){this._header.innerText=this.name,this._headerDiv.append(this._closeBtn),this._headerDiv.append(this._header),this._nextStepBtn.firstChild.className="grok-icon fas fa-play",this._headerDiv.append(this._isAutomatic?this._stopStartBtn:this._nextStepBtn)}_createProgressDiv(){this._progress.max=this.stepNumber,this._progressDiv.append(this._progress),this._progressSteps=s.divText(`Step: ${this._progress.value} of ${this.stepNumber}`),this._progressDiv.append(this._progressSteps)}_addDescription(){var t;this._activity.append(s.div(this.description,"tutorials-root-description"));for(let e=0;e<this.stepNumber;e++){let n=s.iconFA("clock");this._isAutomatic||0===e&&(n=s.iconFA("play",(()=>this._nextStep()),"Next step"),n.className="grok-icon fas fa-play");const i=s.div(this._steps[e].name,"grok-tutorial-entry-instruction"),o=s.div(null===(t=this._steps[e].options)||void 0===t?void 0:t.description,"grok-tutorial-step-description hidden"),r=s.divH([n,i],"grok-tutorial-entry");this._activity.append(r,o)}}_initRoot(){var t,e,n;i.shell.windows.showContextPanel=!0,i.shell.windows.showHelp=!1;const s=Array.from(i.shell.dockManager.rootNode.children)[0];this._node=i.shell.dockManager.dock(this._root,o.DOCK_TYPE.FILL,s,""),(null===(e=null===(t=s.parent.container.containerElement.firstElementChild)||void 0===t?void 0:t.lastElementChild)||void 0===e?void 0:e.classList.contains("tab-handle-list-container"))&&(null===(n=s.parent.container.containerElement.firstElementChild)||void 0===n||n.lastElementChild.remove()),this._node.container.containerElement.classList.add("tutorials-demo-script-container"),this._addHeader(),this._root.append(this._mainHeader),this._addDescription(),this._root.append(this._activity)}_nextStep(){var t,e;return zt(this,void 0,void 0,(function*(){this._isStepProcessed=!0,this._isAutomatic||(this._nextStepBtn.classList.add("disabled"),this._nextStepBtn.firstChild.classList.add("fa-disabled"));const n=this._activity.getElementsByClassName("grok-tutorial-entry")[this._currentStep],i=this._activity.getElementsByClassName("grok-icon")[this._currentStep],o=this._activity.getElementsByClassName("grok-tutorial-step-description")[this._currentStep];i.className="grok-icon far fa-spinner-third fa-spin",o.classList.remove("hidden"),o.classList.add("visible");const r=n,a=(null===(t=this._steps[this._currentStep].options)||void 0===t?void 0:t.delay)?null===(e=this._steps[this._currentStep].options)||void 0===e?void 0:e.delay:2e3;yield this._steps[this._currentStep].func(),this._scrollTo(this._root,r.offsetTop-this._mainHeader.offsetHeight),yield this._countdown(n,i,a),yield(0,Vt.gw)(a);const l=s.iconFA("check");if(i.replaceWith(l),l.className="grok-icon far fa-check",this._progress.value++,this._progressSteps.innerText=`Step: ${this._progress.value} of ${this.stepNumber}`,this._currentStep++,this._isStepProcessed=!1,this._currentStep!==this.stepNumber){if(!this._isAutomatic){const t=this._activity.getElementsByClassName("grok-icon")[this._currentStep],e=s.iconFA("play",(()=>this._nextStep()),"Next step");e.className="grok-icon fas fa-play",t.replaceWith(e),this._nextStepBtn.classList.remove("disabled"),this._nextStepBtn.firstChild.classList.remove("fa-disabled")}}else this._isAutomatic?this._stopStartBtn.replaceWith(this._restartBtn):this._nextStepBtn.replaceWith(this._restartBtn)}))}_startScript(){return zt(this,void 0,void 0,(function*(){for(let t=this._currentStep;t<this.stepNumber&&!this._isStopped&&!this._isCancelled;t++)yield this._nextStep()}))}_scrollTo(t,e){t.focus(),t.scrollTop=e}_countdown(t,e,n){return zt(this,void 0,void 0,(function*(){const i=s.div([],"demo-script-countdown");e.classList.add("hidden");let o=n/1e3;const r=this._createSVGIndicator(o);i.append(r),t.prepend(i);const a=setInterval((()=>{o--,0===o&&(clearInterval(a),i.remove(),e.classList.remove("hidden"),e.classList.add("visible"))}),1e3)}))}_createSVGIndicator(t){const e=document.createElementNS("http://www.w3.org/2000/svg","svg"),n=document.createElementNS("http://www.w3.org/2000/svg","circle");return n.setAttributeNS(null,"cx","7"),n.setAttributeNS(null,"cy","7"),n.setAttributeNS(null,"r","6"),n.setAttributeNS(null,"style",`animation: countdown ${t}s linear infinite forwards`),e.append(n),e}_changeStopState(){const t=this._stopStartBtn.getElementsByClassName("grok-icon");t[0].className="grok-icon fas fa-play",this._isStopped=!this._isStopped,this._isStopped||(t[0].className="grok-icon fal fa-pause",this._isStepProcessed||this._startScript())}_restartScript(){i.shell.dockManager.close(this._node),i.shell.closeAll(),this._clearRoot(),this._setInitParams(),this.start()}_clearRoot(){this._root=s.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._mainHeader=s.panel([],"tutorials-main-header"),this._header=s.h2(""),this._headerDiv=s.divH([],"tutorials-root-header"),this._activity=s.panel([],"tutorials-root-description"),this._progressDiv=s.divV([],"tutorials-root-progress"),this._progress=s.element("progress"),this._progressSteps=s.divText(""),this._progress.max=0,this._progress.value=1}_setInitParams(){this._currentStep=0,this._isStopped=!1,this._isCancelled=!1,this._stopStartBtn.getElementsByClassName("grok-icon")[0].className="grok-icon fal fa-pause",this._nextStepBtn.classList.remove("disabled")}_closeDock(){i.shell.dockManager.close(this._node),this.cancelScript()}cancelScript(){this._isCancelled=!0,Xt.currentObject=null}step(t,e,n){return this._steps[this.steps.length]={name:t,func:e,options:n},this}start(){return zt(this,void 0,void 0,(function*(){this._initRoot(),i.shell.newView(this.name),this._isAutomatic?this._startScript():this._autoStartFirstStep&&(yield this._nextStep())}))}}Xt.currentObject=null;var qt,Kt=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};function jt(t){const e=t instanceof Error?t.message:t.toString(),n=t instanceof Error?t.stack:void 0;i.shell.error(e),be.logger.error(t.message,void 0,n)}!function(t){t.X="Embed_X",t.Y="Embed_Y"}(qt||(qt={}));var $t=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};const Jt="data/sample_FASTA_PT_activity.csv";var Qt=n(1811),te=n(6535),ee=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};function ne(){return ee(this,void 0,void 0,(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(yield e[0].prepare().call()).getOutputParamValue()}))}var ie=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};function se(){return ie(this,void 0,void 0,(function*(){return yield i.functions.call("Dendrogram:getDendrogramService",{})}))}var oe=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};const re="data/sample_FASTA_PT_activity.csv",ae="sequence";var le=n(3336),he=n.n(le),ce=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};const ue="data/sample_FASTA_PT_activity.csv";var de=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))},fe=n(8341),me=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};const pe="samples/sample_HELM.csv";var ge=n(2568),ve=n(525),ye=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};const be=new o.Package;function we(){return Ht.NT.instance}let Ce=null;class Se{constructor(t){this._palette=t}get(t){return this._palette[t]}}function Me(){return ye(this,void 0,void 0,(function*(){yield Ht.NT.instance.loadLibraries();const t=Ht.NT.instance.getBioLib(),e=[],n=[],s=yield i.functions.call("Chem:getRdKitModule"),o=t.getMonomerMolsByType("PEPTIDE");Object.keys(o).forEach((t=>{e.push(t);const i=o[t].replaceAll("#R","O "),r=s.get_mol(i),a=JSON.parse(r.get_descriptors()).CrippenClogP;n.push(a),null==r||r.delete()}));const r=n.reduce(((t,e)=>t+e),0)/n.length||0,a={};for(let t=0;t<e.length;t++)a[e[t]]=n[t]<r?"#4682B4":"#DC143C";Ce=new Se(a)}))}function xe(t){return ye(this,void 0,void 0,(function*(){const e=i.shell.tv,n=yield e.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:t.name,backgroundColor:4294836197,fitArea:!1,positionHeight:"Entropy",fixWidth:!0});return n.root.style.height="50px",n}))}function Te(){return Ht.NT.instance.getBioLib()}function Ne(){return ye(this,void 0,void 0,(function*(){const t=s.dialog({title:"Manage files"}).add(s.fileBrowser({path:"System:AppData/Bio/libraries"}).root).addButton("OK",(()=>t.close())).show()}))}function Ee(t){return ye(this,void 0,void 0,(function*(){const t=s.button("Manage",Ne),e=s.div(),n=yield(0,Ht.P4)();new Set(Object.keys(yield i.dapi.userDataStorage.get(Ht.RV,!0)));let r=Promise.resolve();for(const t of n){const n=yield(0,Ht.nW)(),o=s.boolInput(t,!n.exclude.includes(t),(()=>{r=r.then((()=>ye(this,void 0,void 0,(function*(){1==o.value?n.exclude=n.exclude.filter((e=>e!=t)):n.exclude.includes(t)||n.exclude.push(t),yield(0,Ht.QD)(n),yield Ht.NT.instance.loadLibraries(!0),i.shell.info("Monomer library user settings saved.")}))))}));e.append(o.root)}return new o.Widget(s.splitV([e,s.divV([t])]))}))}function Ae(){return new v}function Ie(t){return function(t){const e=Array.from(t.dataFrame.columns).filter((t=>t.semType===o.SEMTYPE.MOLECULE)).map((t=>t.name));new Set(e).delete(t.name);const n=s.choiceInput("Monomer width",null!=(null==t?void 0:t.temp["monomer-width"])?t.temp["monomer-width"]:"short",["short","long"],(e=>{t.temp["monomer-width"]=e,t.setTag(".calculatedCellRender","0"),t.dataFrame.fireValuesChanged()}));n.setTooltip("In short mode, only the first character should be visible, followed by .. if there are more characters");const i=s.boolInput("Color code",null==(null==t?void 0:t.temp["color-code"])||t.temp["color-code"],(e=>{t.temp["color-code"]=e,t.dataFrame.fireValuesChanged()}));i.setTooltip("Color code");const r=s.stringInput("Reference sequence",null!=(null==t?void 0:t.temp["reference-sequence"])?null==t?void 0:t.temp["reference-sequence"]:"",(e=>{t.temp["reference-sequence"]=e,t.dataFrame.fireValuesChanged()}));r.setTooltip("Reference sequence is not empty, then the sequence will be render \nas a difference from the reference sequence");const a=s.boolInput("Compare with current",null==(null==t?void 0:t.temp["compare-with-current"])||t.temp["compare-with-current"],(e=>{t.temp["compare-with-current"]=e,t.dataFrame.fireValuesChanged()}));a.setTooltip('When on, all sequences get rendered in the "diff" mode');const l=s.inputs([n,i,r,a]);return new o.Widget(l)}(t)}function Le(){return new v}function ke(){return new b}function Re(t,e,n,i,s){const o=new I.k(i,s,n,e);return"Local alignment"==t?o.smithWaterman():o.needlemanWunch()}function _e(){return new x.OZ}function Ge(){return new A}function Pe(t){const e=new Yt(o.SEMTYPE.MACROMOLECULE);s.dialog({title:"Activity Cliffs"}).add(e.paramsUI).onOK((()=>ye(this,void 0,void 0,(function*(){t.func.prepare(e.funcParams).call(!0)})))).show()}function Oe(t,e,r,a,l,h){return ye(this,void 0,void 0,(function*(){if(!(0,ge.n)(e,"Activity Cliffs"))return;const c=V(t),u={units:e.getTag(o.TAGS.UNITS),aligned:e.getTag("aligned"),separator:e.getTag("separator"),alphabet:e.getTag("alphabet")},d=new P.L(e);let f=dt.gk.Tanimoto,m=e;return(d.isFasta()||d.isSeparator()&&d.alphabet&&"UN"!==d.alphabet)&&(d.isFasta()?f=d.getDistanceFunctionName():(m=d.convert("fasta"),f=new G.C(m).getDistanceFunctionName(),u.units="fasta")),yield function(t,e,r,a,l,h,c,u,d,f,m,p,g,v,y,b,w,C){return et(this,void 0,void 0,(function*(){nt++;const S=c/100,M=null!=r?r:e;let x=!1,T=!1;const N={};let E,A;const I={seqCol:M,methodName:d,similarityMetric:u,embedAxesNames:a,options:w},{distance:L,coordinates:k}=yield p(I);for(const e of k)t.columns.add(e);let R=L;var _,G;Object.values(O.U).map((t=>t.toString())).includes(u)&&!L&&(R=yield(_=e,G=u,new Promise((function(t,e){const i=new Worker(new URL(n.p+n.u(258),n.b));i.postMessage({values:_.toList(),fnName:G,options:void 0}),i.onmessage=({data:{distanceMatrixData:n,error:s}})=>{s?e(s):t(n),i.terminate()}}))));const P=yield function(t,e,n,i){return et(this,void 0,void 0,(function*(){const s=t.categories,r=t.getRawData(),a=o.Column.string("seq",t.length).init((t=>s[r[t]])),l=o.DataFrame.fromColumns([a]),h=t.length;let c=Array(h-1);return n?function(t,e,n){for(let i=0;i<t-1;++i){const s=new Float32Array(t-i-1).fill(0);for(let n=i+1;n<t;++n)s[n-i-1]=e[i][n]===o.FLOAT_NULL?0:(0,H.Om)(e[i][n]);n[i]=o.Column.fromFloat32Array("similarity",s)}}(h,e,c):c=yield i(h,t,l,"seq",c),c}))}(M,R,!!R,g),F=function(t,e,n){const i=[],s=[],o=[],r=[],a=new Set;for(let l=0;l!=t.length;++l)for(let h=0;h!=t.length-l;++h){const c=t[l]?t[l].get(h):0;if(c>=e){o.push(l),r.push(l+h+1),a.add(l),a.add(l+h+1),i.push(c);const t=Math.abs(n.get(l)-n.get(l+h+1));s.push(1!=c?t/(1-c):1/0)}}return{simVals:i,saliVals:s,n1:o,n2:r,cliffsMolIds:a}}(P,S,h),W=function(t,e,n,i,s,r){const a=new Array(t).fill(0);for(let t=0;t!=n.length;++t)e[t]!=1/0&&(r.get(n[t])>r.get(i[t])?a[n[t]]+=e[t]:a[i[t]]+=e[t]);return o.Column.fromList("double",`sali_${s[0].substring(s[0].lastIndexOf("_"))}`,a)}(M.length,F.saliVals,F.n1,F.n2,a,h);t.columns.add(W);const V=function(t,e){const n="containsCliff",i=t.columns.names().filter((t=>t.includes(n))).length+1,s=`${n}_${i}`;return o.Column.bool(s,t.rowCount).init((t=>e.has(t)))}(t,F.cliffsMolIds);t.columns.add(V);const Z=function(t){const e=t.filter((t=>t!==1/0)),n=Math.min(...e);return{max:Math.max(...e),min:n}}(F.saliVals),U=.8/(Z.max-Z.min),D=i.shell.getTableView(t.name);D.grid.columns.byName(V.name).visible=!1;const B=D.addViewer(o.VIEWER.SCATTER_PLOT,{xColumnName:a[0],yColumnName:a[1],size:W.name,color:h.name,showXSelector:!1,showYSelector:!1,showSizeSelector:!1,showColorSelector:!1,markerMinSize:5,markerMaxSize:25,title:l}),Y=B.getInfo().canvas,z=function(t,e,n,i,s){const r=new Array(t.n1.length).fill(null);for(let e=0;e<t.n1.length;e++){const n=t.n1[e],i=t.n2[e];r[e]={id:e,mols:[n,i],selected:!1,a:[],b:[]}}const a=o.DataFrame.create(r.length);return ht.forEach(((t,n)=>{a.columns.addNewString(t).init((t=>e.get(r[t].mols[n]))),function(t,e){Object.keys(e).forEach((n=>{t.tags[n]=e[n]}))}(a.col(t),s),a.col(t).semType=i})),a.columns.addNewFloat(ot).init((t=>Math.abs(n.get(r[t].mols[0])-n.get(r[t].mols[1])))),a.columns.addNewInt(lt).init((t=>t)),a.columns.addNewFloat(rt).init((e=>t.saliVals[e])),a.columns.addNewFloat(at).init((e=>t.simVals[e])),a.name=`${it}${nt}`,{lines:r,linesDf:a}}(F,e,h,f,m),X=b?b(z.linesDf,ht).sort([rt],[!1]):z.linesDf.plot.grid().sort([rt],[!1]);t.temp[".cliffsDfGrid"]=X;const q=s.button(`${z.linesDf.rowCount} cliffs`,(()=>{D.dockManager.dock(X,"down",null,"Activity cliffs",null!=C?C:.2)}));q.classList.add("scatter_plot_link","cliffs_grid"),B.root.append(q);const K=s.switchInput("Show only cliffs",!1,(()=>{K.value?(B.dataFrame.setTag(ct,V.name),t.rows.match({[V.name]:!0}).filter(),st.next(V.name)):(B.dataFrame.setTag(ct,""),t.filter.setAll(!0,!0),st.next(""))}));K.root.classList.add("scatter_plot_link","show_only_cliffs"),B.root.append(K.root),st.subscribe((t=>{K.enabled=""===t||t===V.name}));const j=i.events.onViewerClosed.subscribe((t=>{t.args.viewer===B&&(D.dockManager.close(X.root),j.unsubscribe(),D.subs=D.subs.filter((t=>t!==j)))}));return D.subs.push(j),z.linesDf.onCurrentCellChanged.subscribe((()=>{x=!0;const n=z.linesDf.currentCol&&z.linesDf.currentCol.name===ht[1]?1:0,o=-1!==z.linesDf.currentRowIdx?z.lines[z.linesDf.currentRowIdx]:null;B.dataFrame.currentRowIdx=o?o.mols[n]:-1,B.dataFrame.filter.set(0,!z.lines[0].selected),B.dataFrame.filter.set(0,z.lines[0].selected),o&&setTimeout((()=>{!function(t,e,n,o,r,a,l,h){const c=e.getPane("Cliff Details");s.empty(c.root);const u=h({cashedData:n,line:o,df:t,seqCol:r,activityCol:a,sali:l});c.root.append(u),setTimeout((()=>{i.shell.o=e.root}),500)}(t,E,N,o,e,h,z.linesDf.get(rt,o.id),y);const n=B.dataFrame.getSortedOrder(D.grid.sortByColumns,D.grid.sortTypes);D.grid.scrollToCell(e.name,n.indexOf(B.dataFrame.currentRowIdx))}),1e3)})),z.linesDf.onSelectionChanged.subscribe((e=>{if(!1===z.linesDf.selection.anyTrue)z.lines.forEach((t=>{t.selected=!1}));else if(-1!==z.linesDf.mouseOverRowIdx){const t=z.lines[z.linesDf.mouseOverRowIdx];t.selected=!t.selected}setTimeout((()=>{const e=o.BitSet.create(t.rowCount);z.lines.forEach((t=>{t.selected&&t.mols.forEach((n=>{e.set(n,t.selected,!0)}))})),t.selection.copyFrom(e),D.grid.invalidate()}),300)})),t.onSelectionChanged.subscribe((e=>{T?T=!1:!1===t.selection.anyTrue&&"number"==typeof e&&(z.lines.forEach((t=>{t.selected=!1})),X.dataFrame.selection.setAll(!1,!1),X.invalidate())})),Y.addEventListener("mousemove",(function(i){clearTimeout(A),A=n.g.setTimeout((function(){const n=ut(i,Y,z.lines);n&&-1===t.mouseOverRowIdx&&s.tooltip.show(v({cashedData:N,line:n,df:t,seqCol:e,activityCol:h}),i.clientX,i.clientY)}),500)})),Y.addEventListener("mousedown",(function(e){T=!0;const n=ut(e,Y,z.lines);if(n&&-1===t.mouseOverRowIdx){e.ctrlKey?(n.selected=!n.selected,z.linesDf.selection.set(n.id,n.selected)):z.linesDf.currentRowIdx!==n.id&&(z.linesDf.currentRowIdx=n.id,t.currentRowIdx=n.mols[0],t.filter.set(0,!z.lines[0].selected),t.filter.set(0,z.lines[0].selected));const i=z.linesDf.getSortedOrder(X.sortByColumns,X.sortTypes);X.scrollToCell(ht[0],i.indexOf(n.id))}})),B.onEvent("d4-before-draw-scene").subscribe((e=>{const n=function(t,e,n,i,s,o,r){const a=i.lines,l=t.getInfo().canvas.getContext("2d"),h=t.dataFrame.columns.byName(e),c=t.dataFrame.columns.byName(n);for(let e=0;e<a.length;e++){const n=t.worldToScreen(h.get(a[e].mols[0]),c.get(a[e].mols[0])),u=t.worldToScreen(h.get(a[e].mols[1]),c.get(a[e].mols[1]));a[e].a=[n.x,n.y],a[e].b=[u.x,u.y];const d=new Path2D;d.moveTo(a[e].a[0],a[e].a[1]);const f=a[e].selected?"255,255,0":"0,128,0",m=s[e]===1/0?1:.2+(s[e]-r)*o;l.strokeStyle=`rgba(${f},${m})`,l.lineWidth=a[e].id===i.linesDf.currentRowIdx?3:1,d.lineTo(a[e].b[0],a[e].b[1]),l.stroke(d)}return a}(B,a[0],a[1],z,F.saliVals,U,Z.min);if(x){const t=n[z.linesDf.currentRowIdx];setTimeout((()=>{const{zoomLeft:e,zoomRight:n,zoomTop:i,zoomBottom:s}=function(t,e,n,i,s,o){const r=Math.abs(n-s),a=Math.abs(i-o),l=t/r,h=e/a,c=Math.min(l,h),u=t/c*5,d=e/c*5,f=(n<s?n:s)+r/2-u/2,m=(i>o?i:o)-a/2+d/2;return{zoomLeft:f,zoomRight:f+u,zoomTop:m,zoomBottom:m-d}}(B.viewport.width,B.viewport.height,B.dataFrame.get(a[0],t.mols[0]),B.dataFrame.get(a[1],t.mols[0]),B.dataFrame.get(a[0],t.mols[1]),B.dataFrame.get(a[1],t.mols[1]));B.zoom(e,i,n,s)}),300),x=!1}K.value?t.rows.match({[V.name]:!0}).filter():!0===K.enabled&&t.filter.setAll(!0,!1)})),B.addProperty("similarityLimit","double",S),E=function(){const t=s.accordion(),e=s.element("i");return e.className="grok-icon svg-icon svg-view-layout",t.addTitle(s.span([e,s.label("Activity cliffs")])),t.addPane("Cliff Details",(()=>s.divText("Cliff has not been selected")),!0),i.shell.o=t.root,t}(),B}))}(t,m,null,c,"Activity cliffs",r,a,f,l,o.SEMTYPE.MACROMOLECULE,u,W,mt,pt,gt,wt,h)}))}function Fe(t){const e=new Bt(o.SEMTYPE.MACROMOLECULE);s.dialog({title:"Sequence Space"}).add(e.paramsUI).onOK((()=>ye(this,void 0,void 0,(function*(){t.func.prepare(e.funcParams).call(!0)})))).show()}function We(t,e,n,s=dt.gk.Tanimoto,r,a){return ye(this,void 0,void 0,(function*(){if(yield(0,Vt.gw)(10),!(0,ge.n)(e,"Sequence space"))return;const l=V(t),h=o.DataFrame.fromColumns([e]).clone(),c=function(t,e){const n=e.categories.map(((t,e)=>t?null:e)).filter((t=>null!==t)),i=[...e.getRawData()],s=[];let o=0;for(let e=0;e<t.rowCount;e++)n.includes(i[e])&&(t.rows.removeAt(e-o),s.push(e),o+=1);return s}(h,e),u={seqCol:h.col(e.name),methodName:n,similarityMetric:s,embedAxesNames:l,options:a},d=(yield W(u)).coordinates;for(const e of d){const n=e.toList();c.forEach((t=>n.splice(t,0,null))),t.columns.add(o.Column.float(e.name,t.rowCount).init((t=>n[t])))}return r?i.shell.tableView(t.name).scatterPlot({x:l[0],y:l[1],title:"Sequence space"}):void 0}))}function Ve(t,e){return ye(this,void 0,void 0,(function*(){if(0===o.Func.find({package:"Chem",name:"getRdKitModule"}).length)return void i.shell.warning('Transformation to atomic level requires package "Chem" installed.');if(!(0,ge.n)(e,"To Atomic Level"))return;const n=(yield we()).getBioLib(),r=yield(0,Mt.i0)(t,e,n);null!==r.col&&(t.columns.add(r.col,!0),yield i.data.detectSemanticTypes(t)),r.warnings&&r.warnings.length>0&&i.shell.warning(s.list(r.warnings))}))}function He(){(0,ve.K)()}function Ze(t=null,e=null){return ye(this,void 0,void 0,(function*(){return(0,ve.K)({col:t,clustersCol:e})}))}function Ue(){return ye(this,void 0,void 0,(function*(){const t=i.shell.tv,e=t.dataFrame.columns.toList().filter((t=>t.semType==o.SEMTYPE.MACROMOLECULE&&(new G.C(t),!0))),n=e=>ye(this,void 0,void 0,(function*(){if(!(0,ge.n)(e,"Composition"))return;const n=t.addViewer("WebLogo",{sequenceColumnName:e.name});i.shell.tv.dockManager.dock(n,o.DOCK_TYPE.DOWN,null,"Composition analysis",.25)}));let r=null;if(0!=e.length){if(e.length>1){const t=e.map((t=>t.name)),i=e.find((t=>new G.C(t).isMsa())),o=s.choiceInput("Column",i?i.name:t[0],t);s.dialog({title:"Composition Analysis",helpUrl:"/help/domains/bio/macromolecules.md#composition-analysis"}).add(s.div([o])).onOK((()=>ye(this,void 0,void 0,(function*(){var t;const i=null!==(t=e.find((t=>t.name==o.value)))&&void 0!==t?t:null;i&&(yield n(i))})))).show()}else r=e[0];r&&(yield n(r))}else i.shell.error("Current table does not contain sequences")}))}function De(t){return ye(this,void 0,void 0,(function*(){(0,St.Xk)(t)}))}function Be(t){return new xt.i(t).importFasta()}function Ye(){const t=(0,At.m)();(0,Ct.O)(t)}function ze(){return new y}function Xe(t){return ye(this,void 0,void 0,(function*(){const e=o.TaskBarProgressIndicator.create("Test detectMacromolecule..."),n=(yield i.dapi.files.list(t,!0,"")).filter((t=>t.fileName.endsWith(".csv")));let s=0;const r=[];for(const a of n)try{const e=yield i.dapi.files.readAsText(t+a.fullPath),n=o.DataFrame.fromCsv(e);for(const t of n.columns)(yield i.functions.call("Bio:detectMacromolecule",{col:t}))===o.SEMTYPE.MACROMOLECULE&&r.push({file:a.path,result:"detected",column:t.name,message:`units: ${t.getTag(o.TAGS.UNITS)}`})}catch(t){r.push({file:a.path,result:"error",column:null,message:t instanceof Error?t.message:t.toString()})}finally{s+=1,e.update(100*s/n.length,`Test ${a.fileName}`)}i.shell.info("Test Demo:Files for detectMacromolecule finished."),e.close();const a=o.DataFrame.fromObjects(r);return a.name=`datasets_detectMacromolecule_${t}`,a}))}function qe(){const t=(0,At.m)(),e=function(t){const e=(0,r.Mj)(t),n=t=>{const e=a.columns.addNewString((t+1).toString());return i.push(e),e},i=[],s=t.length,a=o.DataFrame.create(s);for(let o=0;o<s;++o){const s=t.get(o);null!=s&&e(s).forEach(((t,e)=>{var s;((null!==(s=i[e])&&void 0!==s?s:null)||n(e)).set(o,t||"-",!1)}))}return a}(t),n=t.dataFrame;for(const i of e.columns){const e=n.columns.add(i);e.semType=c.Of.MONOMER,e.setTag(o.TAGS.CELL_RENDERER,c.Of.MONOMER),e.setTag("alphabet",t.getTag("alphabet"))}i.shell.tv.grid.invalidate()}function Ke(t){const e=(0,u.fy)(t,1,u.gP);return Object.keys(e.freq)}function je(){return new _t}function $e(){const t=i.shell.v,e=t.addViewer("Sequence Similarity Search");t.dockManager.dock(e,"down")}function Je(){return new Ot}function Qe(){const t=i.shell.v,e=t.addViewer("Sequence Diversity Search");t.dockManager.dock(e,"down")}function tn(){const t=(0,At.m)();(0,_.gQ)(t)}function en(){(0,Ft.C2)()}function nn(){return new Wt.ST}function sn(){return ye(this,void 0,void 0,(function*(){yield function(){return $t(this,void 0,void 0,(function*(){let t,e;try{const n=new Xt("Similarity, Diversity","Sequence similarity tracking and evaluation dataset diversity");yield n.step("Load DNA sequences",(()=>$t(this,void 0,void 0,(function*(){i.shell.windows.showContextPanel=!1,i.shell.windows.showProperties=!1,e=yield be.files.readCsv(Jt),t=i.shell.addTableView(e),t.grid.columns.byName("cluster").visible=!1,t.grid.columns.byName("sequence_id").visible=!1,t.grid.columns.byName("sequence").width=300,t.grid.columns.byName("activity").visible=!1,t.grid.columns.byName("is_cliff").visible=!1}))),{description:"Load dataset with macromolecules of 'fasta' notation, 'DNA' alphabet.",delay:2e3}).step("Find the most similar sequences to the current one",(()=>$t(this,void 0,void 0,(function*(){const n=yield e.plot.fromType("Sequence Similarity Search",{moleculeColumnName:"sequence",similarColumnLabel:"Similar to current"});t.dockManager.dock(n,o.DOCK_TYPE.RIGHT,null,"Similarity search",.35)}))),{description:"Add 'Sequence Similarity Search' viewer.",delay:2e3}).step("Explore most diverse sequences in a dataset",(()=>$t(this,void 0,void 0,(function*(){const n=yield e.plot.fromType("Sequence Diversity Search",{moleculeColumnName:"sequence",diverseColumnLabel:"Top diverse sequences of all data"});t.dockManager.dock(n,o.DOCK_TYPE.DOWN,null,"Diversity search",.27)}))),{description:"Add 'Sequence Deversity Search' viewer.",delay:2e3}).step("Choose another sequence for similarity search",(()=>$t(this,void 0,void 0,(function*(){e.currentRowIdx=3}))),{description:"Handling current row changed of data frame showing update of similar sequences.",delay:2e3}).step("One more sequence for similarity search",(()=>$t(this,void 0,void 0,(function*(){e.currentRowIdx=7}))),{description:"Just one more sequence to search similar ones.",delay:2e3}).start()}catch(t){jt(t)}}))}()}))}function on(){return ye(this,void 0,void 0,(function*(){yield function(){return oe(this,void 0,void 0,(function*(){let t,e,n,s,r;try{const a=new Xt("Sequence Space","Exploring sequence space of Macromolecules, comparison with hierarchical clustering results");yield a.step("Load DNA sequences",(()=>oe(this,void 0,void 0,(function*(){[s,t,e]=yield Promise.all([be.files.readCsv(re),ne(),se()]),n=i.shell.addTableView(s),n.grid.props.rowHeight=22,n.grid.columns.byName("cluster").visible=!1,n.grid.columns.byName("sequence").width=200,n.grid.columns.byName("is_cliff").visible=!1,i.shell.windows.showContextPanel=!1,i.shell.windows.showProperties=!1}))),{description:"Load dataset with macromolecules of 'fasta' notation, 'DNA' alphabet.",delay:2e3}).step("Build sequence space",(()=>oe(this,void 0,void 0,(function*(){r=yield function(t,e,n,i){return Kt(this,void 0,void 0,(function*(){let i;{const t=Object.values(qt);for(let n=0;n<t.length;n++){const i=t[n];if(!e.col(i)){const s=n==t.length-1;e.columns.add(o.Column.float(i,e.rowCount),s)}}if(e.rowCount>=1){const i=e.getCol(n).toList(),s=Date.now();be.logger.debug("Bio: demoBio01aUI(), calc reduceDimensionality start...");const o=yield R(i,"UMAP",dt.W.Levenshtein,{}),r=Date.now();be.logger.debug(`Bio: demoBio01aUI(), calc reduceDimensionality ET: ${(r-s)/1e3} s`);for(let n=0;n<t.length;n++){const i=t[n],s=e.getCol(i),r=o.embedding[n];s.init((t=>r[t]))}const a=Date.now();be.logger.debug(`MLB: MlbVrSpaceBrowser.buildView(), postprocess reduceDimensionality ET: ${(a-r)/1e3} s`)}i=yield e.plot.fromType(o.VIEWER.SCATTER_PLOT,{xColumnName:qt.X,yColumnName:qt.Y,lassoTool:!0})}return t.dockManager.dock(i,o.DOCK_TYPE.RIGHT,null,"Sequence Space",.35),i}))}(n,s,ae)}))),{description:"Reduce sequence space dimensionality to display on 2D representation.",delay:2e3}).step("Cluster sequences",(()=>oe(this,void 0,void 0,(function*(){const i=s.getCol(ae).toList(),o=te.H.calc(i,((t,e)=>Qt.T(t,e)/((t.length+e.length)/2))),r=yield t.hierarchicalClusteringByDistance(o,"ward");e.injectTreeForGrid(n.grid,r,void 0,150,void 0)}))),{description:"Perform hierarchical clustering to reveal relationships between sequences.",delay:2e3}).step("Select a sequence",(()=>oe(this,void 0,void 0,(function*(){s.selection.init((t=>[15].includes(t)))}))),{description:"Handling selection of data frame row reflecting on linked viewers.",delay:2e3}).step("Select a bunch of sequences",(()=>oe(this,void 0,void 0,(function*(){const t=s.getCol("sequence_id");s.selection.init((e=>["c0_seq120","c0_seq105","c0_seq121","c0_seq93"].includes(t.get(e)))),s.currentRowIdx=27}))),{description:"Selecting a group of rows from a data frame to show their similarity and proximity to each other on a viewer..",delay:2e3}).start()}catch(t){jt(t)}}))}()}))}function rn(){return ye(this,void 0,void 0,(function*(){yield function(){return ce(this,void 0,void 0,(function*(){let t,e,n,s,r;const a=Zt.AL.UMAP;try{const l=new Xt("Activity Cliffs","Activity Cliffs analysis on Macromolecules data");yield l.step("Load DNA sequences",(()=>ce(this,void 0,void 0,(function*(){i.shell.windows.showContextPanel=!1,i.shell.windows.showProperties=!1,[n,t,e]=yield Promise.all([be.files.readCsv(ue),ne(),se()]),s=i.shell.addTableView(n),s.grid.props.rowHeight=22,s.grid.columns.byName("cluster").visible=!1,s.grid.columns.byName("sequence").width=300,s.grid.columns.byName("is_cliff").visible=!1}))),{description:"Load dataset with macromolecules of 'fasta' notation, 'DNA' alphabet.",delay:2e3}).step("Find activity cliffs",(()=>ce(this,void 0,void 0,(function*(){r=yield Oe(n,n.getCol("Sequence"),n.getCol("Activity"),80,a),s.dockManager.dock(r,o.DOCK_TYPE.RIGHT,null,"Activity Cliffs",.35),he()(r.root).find("button.scatter_plot_link,cliffs_grid").get()[0].click()}))),{description:"Reveal similar sequences with a cliff of activity.",delay:2e3}).step("Cluster sequences",(()=>ce(this,void 0,void 0,(function*(){const i=n.getCol("sequence").toList(),o=te.H.calc(i,((t,e)=>Qt.T(t,e)/((t.length+e.length)/2))),r=yield t.hierarchicalClusteringByDistance(o,"ward");e.injectTreeForGrid(s.grid,r,void 0,150,void 0),s.grid.columns.byName("Activity").scrollIntoView()}))),{description:"Perform hierarchical clustering to reveal relationships between sequences.",delay:2e3}).step("Browse the cliff",(()=>ce(this,void 0,void 0,(function*(){const t=r.dataFrame.temp[".cliffsDfGrid"];t.dataFrame.rowCount>0&&(t.dataFrame.currentRowIdx=0)}))),{description:"Zoom in to explore selected activity cliff details.",delay:2e3}).start()}catch(t){jt(t)}}))}()}))}function an(){return ye(this,void 0,void 0,(function*(){yield function(){return de(this,void 0,void 0,(function*(){const t="HELM";let e,n,r;try{yield new Xt("Atomic Level","Atomic level structure of Macromolecules").step("Loading Macromolecules notation 'Helm'",(()=>de(this,void 0,void 0,(function*(){i.shell.windows.showContextPanel=!1,i.shell.windows.showProperties=!1,e=yield be.files.readCsv("samples/sample_HELM.csv"),n=i.shell.addTableView(e);for(let e=0;e<n.grid.columns.length;e++){const i=n.grid.columns.byIndex(e);[t,"Activity"].includes(i.name)||(i.visible=!1)}}))),{description:"Load dataset with macromolecules of 'fasta' notation, 'PT' alphabet (protein, aminoacids).",delay:2e3}).step("To atomic level",(()=>de(this,void 0,void 0,(function*(){const n=e.getCol(t);yield Ve(e,n)}))),{description:"Get atomic level structures of Macromolecules.",delay:2e3}).step("Sketcher",(()=>de(this,void 0,void 0,(function*(){const n=`molfile(${t})`;e.currentCell=e.cell(1,n);const i=e.currentCell.value,a=new o.chem.Sketcher(o.chem.SKETCHER_MODE.INPLACE);a.setMolFile(i),r=s.dialog().add(a).show(),yield(0,Vt.gw)(3e3),r.close()}))),{description:"Display atomic level structure within a sketcher.",delay:2e3}).start()}catch(t){jt(t)}}))}()}))}function ln(){return ye(this,void 0,void 0,(function*(){yield function(){return me(this,void 0,void 0,(function*(){let t,e,n,s,r,a;const l="msa(HELM)",h=Zt.AL.UMAP;try{const c=new Xt("Helm, MSA, Sequence Space","MSA and composition analysis on Helm data");yield c.step("Load peptides with non-natural aminoacids in 'HELM' notation",(()=>me(this,void 0,void 0,(function*(){t=i.shell.addTableView(e=yield be.files.readCsv(pe)),i.shell.windows.showContextPanel=!1,i.shell.windows.showProperties=!1}))),{description:"Load dataset with macromolecules of 'Helm' notation.",delay:2e3}).step("Align peptides with non-natural aminoacids with PepSeA",(()=>me(this,void 0,void 0,(function*(){n=e.getCol("HELM");const t=fe.J[0];s=yield(0,fe.f)(n,l,t,1.53,0,void 0),e.columns.add(s),yield i.data.detectSemanticTypes(e)}))),{description:"Multiple sequence alignment (MSA) performed with PepSeA tool operating on non-natural aminoacids as well.",delay:2e3}).step("Build sequence space",(()=>me(this,void 0,void 0,(function*(){a=yield We(e,s,h,O.U.LEVENSHTEIN,!0),t.dockManager.dock(a,o.DOCK_TYPE.RIGHT,null,"Sequence Space",.35)}))),{description:"Reduce sequence space dimensionality to display on 2D representation.",delay:2e3}).step("Analyse sequence composition",(()=>me(this,void 0,void 0,(function*(){r=yield e.plot.fromType("WebLogo",{sequenceColumnName:l,positionWidth:40,maxHeight:50}),t.dockManager.dock(r,o.DOCK_TYPE.DOWN,null,"Composition analysis",.2)}))),{description:"Composition analysis allows to reveal functional features of sequences like motifs, or variable loops.",delay:2e3}).start()}catch(t){jt(t)}}))}()}))}},9017:(t,e,n)=>{"use strict";n.d(e,{k:()=>o});class i{constructor(){this.value=0,this.parentI=0,this.parentJ=0}}class s{constructor(t,e,n){this.seq1=t,this.seq2=e,this.score=n}}class o{fillNeedleman(){for(let t=0;t<=this.len1;t++)this.dpGrid[t][0].value=-t*this.gap,this.dpGrid[t][0].parentI=t-1,this.dpGrid[t][0].parentJ=0;for(let t=1;t<=this.len2;t++)this.dpGrid[0][t].value=-t*this.gap,this.dpGrid[0][t].parentI=0,this.dpGrid[0][t].parentJ=t-1}fillOne(t,e){this.dpGrid[t][e].value=Math.max(this.dpGrid[t-1][e-1].value+this.scores[t-1][e-1],Math.max(this.dpGrid[t-1][e].value-this.gap,this.dpGrid[t][e-1].value-this.gap)),this.dpGrid[t][e].value==this.dpGrid[t-1][e-1].value+this.scores[t-1][e-1]?(this.dpGrid[t][e].parentI=t-1,this.dpGrid[t][e].parentJ=e-1):this.dpGrid[t][e].value==this.dpGrid[t-1][e].value-this.gap?(this.dpGrid[t][e].parentI=t-1,this.dpGrid[t][e].parentJ=e):(this.dpGrid[t][e].parentI=t,this.dpGrid[t][e].parentJ=e-1)}gridFromName(t){switch(t){case"BLOSUM45":this.alignGrid=this.BLOSUM45,this.connections=this.CONBLO,this.step=1;break;case"BLOSUM50":this.alignGrid=this.BLOSUM50,this.connections=this.CONBLO,this.step=1;break;case"BLOSUM62":this.alignGrid=this.BLOSUM62,this.connections=this.CONBLO,this.step=1;break;case"BLOSUM80":this.alignGrid=this.BLOSUM80,this.connections=this.CONBLO,this.step=1;break;case"BLOSUM90":this.alignGrid=this.BLOSUM90,this.connections=this.CONBLO,this.step=1;break;case"PAM30":this.alignGrid=this.PAM30,this.connections=this.CONBLO,this.step=1;break;case"PAM70":this.alignGrid=this.PAM70,this.connections=this.CONBLO,this.step=1;break;case"PAM250":this.alignGrid=this.PAM250,this.connections=this.CONBLO,this.step=1;break;case"NUCLEOTIDES":this.alignGrid=this.NUCLEOTIDES,this.connections=this.CONNUCL,this.step=1;break;case"TRANS":this.alignGrid=this.TRANS,this.connections=this.CONNUCL,this.step=1;break;case"SCHNEIDER":this.alignGrid=this.SCHNEIDER,this.connections=this.CONSCHN,this.step=3}this.fillScores()}constructResult(t,e){let n="",i="",o="",r=this.dpGrid[t][e].value;for(let t=0;t<this.step;t++)o+="|";for(;t>0||e>0;){this.dpGrid[t][e].parentI==t?(n=o+n,i=this.seq2.substr((e-1)*this.step,this.step)+i):this.dpGrid[t][e].parentJ==e?(i=o+i,n=this.seq1.substr((t-1)*this.step,this.step)+n):(n=t-1>=0?this.seq1.substr((t-1)*this.step,this.step)+n:o+n,i=e-1>=0?this.seq2.substr((e-1)*this.step,this.step)+i:o+i);let s=t;t=this.dpGrid[t][e].parentI,e=this.dpGrid[s][e].parentJ}return new s(n,i,r)}fillScores(){this.scores=[];for(let t=0;t<this.len1;t++){this.scores.push([]);for(let e=0;e<this.len2;e++)this.scores[t].push(this.alignGrid[this.connections[this.seq1.substr(t*this.step,this.step)]][this.connections[this.seq2.substr(e*this.step,this.step)]])}}typeRec(){if(/[ATGC]*/.test(this.seq1)&&/[ATGC]*/.test(this.seq2))return"NUCLEOTIDES";if(/[ARNDCQEGHILKMFPSTWYVBZX*]*/.test(this.seq1)&&/[ARNDCQEGHILKMFPSTWYVBZX*]*/.test(this.seq2))return"BLOSUM62";throw Error("Can't recognize sequence type")}needlemanWunch(){this.dpGrid=[];for(let t=0;t<this.len1+1;t++){let t=[];for(let e=0;e<this.len2+1;e++)t.push(new i);this.dpGrid.push(t)}this.fillNeedleman();for(let t=1;t<=this.len1;t++)for(let e=1;e<=this.len2;e++)this.fillOne(t,e);return this.constructResult(this.len1,this.len2)}smithWaterman(){this.dpGrid=[];for(let t=0;t<this.len1+1;t++){let t=[];for(let e=0;e<this.len2+1;e++)t.push(new i);this.dpGrid.push(t)}let t=0,e=0,n=0;for(let i=1;i<=this.len1;i++)for(let s=1;s<=this.len2;s++)this.fillOne(i,s),this.dpGrid[i][s].value<=0?(this.dpGrid[i][s].value=0,this.dpGrid[i][s].parentI=0,this.dpGrid[i][s].parentJ=0):0==this.dpGrid[this.dpGrid[i][s].parentI][this.dpGrid[i][s].parentJ].value&&(this.dpGrid[i][s].parentI=0,this.dpGrid[i][s].parentJ=0),this.dpGrid[i][s].value>t&&(t=this.dpGrid[i][s].value,e=i,n=s);return this.constructResult(e,n)}setSequences(t,e){this.seq1=t,this.seq2=e,this.len1=this.seq1.length/this.step,this.len2=this.seq2.length/this.step,this.fillScores()}setGap(t){this.gap=t}setMethod(t=""){"AUTO"==t&&(t=this.typeRec()),this.gridFromName(t)}constructor(t,e,n,i=""){this.seq1="",this.seq2="",this.gap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-.2,-8.2,-2.3,-6.8,-8.9,-11.1,-9.4,-10.9,-8.9,-11.7,-10,-9.9,-12.1,-15.2,-14.3,-14.4,11.1,2.9,9.2,3.5,-3,-7,-4.3,-6.2,-2.2,-6.6,-3.7,-5.7,-6,-10.4,-8.6,-9.5,-50,-15.5,-50,-13.9,-7.8,-10.5,-8.7,-9.6,-50,-16.5,-17.1,-14.8,-12.1,-18.9,-12.4,-17.4],[-8.5,.8,-9.1,-.7,-10.1,-7.5,-9.1,-8.2,-11.4,-3.1,-11.8,-4.4,-15.5,-14.3,-14.8,-15.4,-6.6,-4.7,-7.1,-5.8,-12.5,-10.3,-11,-12.2,-13.4,-10.6,-12.5,-11.8,-17.4,-15.1,-17.7,-15.7,2.9,12.5,3.1,10.3,-7.7,-5.2,-6.2,-7.3,-5.4,-1.7,-5.4,-3.7,-11.6,-9.1,-13,-10.8,-50,-10.3,-50,-11.2,-9.8,-8.3,-9.1,-9.7,-50,-12.7,-20.6,-13.1,-16,-16.6,-17,-18.4],[-5,-6.4,-3.4,-5.6,-7.5,-9.3,-7.1,-8.8,-8.8,-7.4,-6.9,-6.9,-11.4,-15.2,-9.7,-13.7,-1.8,-7.8,-.8,-7.2,-9.4,-10.6,-8.7,-11.2,-10,-10.1,-7.8,-10.5,-13.2,-14.6,-13,-14.5,9.2,3.1,10.8,3,-4.5,-6.7,-2.7,-6.7,-5,-6.8,-2.5,-6.7,-7.5,-10.4,-7.4,-10.2,-50,-15.5,-50,-14.2,-8.9,-10.2,-8.5,-10,-50,-15.6,-15.3,-15.5,-13,-18.8,-12.6,-18.3],[-8.1,-1.1,-8.9,1.4,-8.6,-9.2,-9.4,-6.8,-11,-4.9,-11.5,-2.6,-13.7,-16.8,-14.5,-12.6,-6,-6.7,-7.2,-4.2,-11.6,-11.9,-11.2,-10.9,-13.1,-12.2,-12.5,-10.3,-16.8,-17.2,-17.8,-14.6,3.5,10.3,3,12.4,-6.9,-7.5,-6.8,-4.9,-5.4,-4.2,-5.4,-1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8,-9.4,-7.2,-9.3,-13.3,-12.8,-10.9,-12.6,-1.8,-2.9,-.8,-2.9,-8.6,-13,-7.4,-12.4,-.4,-2.3,1.3,-2,-8.1,-9.3,-5.4,-8.4,10,8.6,11.4,8.9,-50,-13.7,-50,-13.2,-6.1,-8.1,-5.5,-7.5,-50,-11.3,-12.7,-10.1,-1.6,-7.8,-.3,-7.2],[-11.4,-10,-12.7,-8.2,-3.1,-3.1,-2.8,-.9,-11.7,-7.3,-12.1,-5.8,3.6,3.6,-1.1,5.8,-9.4,-11.9,-10.7,-10,-8.5,-8.8,-8.2,-6.5,-13.9,-13,-12.9,-10.9,-3.1,-2.3,-3.2,-.2,-9.5,-10.8,-10.2,-8.2,-1.1,-1.3,-.8,1.2,-8.6,-7.8,-7.8,-5,9,9.5,8.9,12,-50,-13,-50,-10.3,-6.2,-7,-7.1,-5.4,-50,-9.3,-14,-8.2,-2.4,-6.3,-2.4,-3.9],[-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,33.3,-50,30.6,-50,-50,-50,-50,-50,29.2,-50,-50,-50,-50,-50,-50,-50],[-14.8,-6.2,-14.9,-7.6,-14.6,-11.6,-13,-12.2,-14,-9,-14.1,-10.1,-13.6,-11.2,-12.4,-12.5,-8.1,2.2,-8.7,.4,-15.3,-11.3,-13.2,-13.3,-11.9,-7.2,-11.8,-7.9,-10.7,-7.4,-10.8,-8.9,-15.5,-10.3,-15.5,-12.5,-14.5,-12.1,-11.9,-12.8,-18.3,-12.7,-16.4,-14.7,-14.2,-10.4,-13.7,-13,-50,15.1,-50,13.3,-9.9,-5.8,-8.9,-7.6,-50,-1.5,-7.8,-3,-8.1,3.6,-9.4,2],[-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,30.6,-50,35.2,-50,-50,-50,-50,-50,28.5,-50,-50,-50,-50,-50,-50,-50],[-13.8,-7.5,-14.4,-5.1,-12.6,-11.6,-11.5,-10.1,-13.2,-9.7,-12.7,-7.4,-11.9,-11.9,-11.5,-10.2,-7.2,.9,-8.6,2.6,-14.1,-12.8,-13.3,-11,-9.7,-8.4,-11.2,-5.3,-9.3,-8.7,-9.9,-7.1,-13.9,-11.2,-14.2,-8.9,-12.9,-12.6,-12.6,-10.9,-15.4,-13.8,-14.8,-11.4,-12.8,-11.6,-13.2,-10.3,-50,13.3,-50,15.2,-8.6,-7,-8.4,-4.8,-50,-3,-7.1,-.1,-7.3,2.3,-8.7,3.9],[-7.3,-6.3,-8.9,-5.5,2.9,.2,1.5,1.2,-8.5,-2.3,-10,-1.7,-5.6,-10.5,-5.5,-9.6,-4.3,-7.9,-6.1,-7.2,2.3,-.6,.5,-0,-8.9,-11,-9.4,-9.3,-4.6,-9.4,-7.3,-8.1,-7.8,-9.8,-8.9,-9.2,2.8,.1,1.2,.8,-5.9,-6.8,-5.9,-6.3,-4.1,-7.2,-6.1,-6.2,-50,-9.9,-50,-8.6,12.5,9.4,11,9.8,-50,-4.8,-8.7,-3.5,-0,-8.6,-2.1,-7],[-10.1,-4.3,-10.8,-5.8,.1,2.3,.7,.6,-10.4,-.2,-10.8,-2,-8.8,-9.2,-8,-9.7,-6.8,-5.9,-7.5,-7,-1.4,2.2,-.9,-.4,-10.8,-7.7,-9.8,-8.8,-8.9,-7.3,-9.6,-9.1,-10.5,-8.3,-10.2,-10,-0,2.5,.7,.5,-7.5,-5.1,-7.1,-6.7,-7.4,-5.7,-8.1,-7,-50,-5.8,-50,-7,9.4,12.7,10.1,10,-50,-1.5,-11.3,-3.3,-5.4,-4.2,-5.6,-6.8],[-8.4,-6.2,-8.9,-5.9,1.8,.4,2.7,1.2,-9.1,-1.2,-8.8,-1.5,-7.2,-10.5,-4.9,-9.6,-5.7,-7.4,-5.5,-7.4,.3,-.3,1.8,-.4,-9,-8.7,-7.3,-8.9,-5.9,-9.4,-6.4,-8.7,-8.7,-9.1,-8.5,-9.4,1.4,.7,3.5,.7,-6.6,-5.3,-4.7,-5.8,-5.7,-7.5,-5.5,-7.1,-50,-8.9,-50,-8.4,11,10.1,13.2,10.2,-50,-4.2,-6.1,-3.6,-3.5,-8.4,-1.2,-6.8],[-9.1,-5.4,-10.4,-4.2,1,.5,.6,2.4,-9.6,-1.5,-10.5,-.5,-8.9,-10.5,-7.2,-8.3,-6.3,-6.9,-7.7,-5.1,-.5,.1,-.6,2.3,-11.1,-10.2,-10.5,-7,-8.3,-9.4,-9.4,-6.6,-9.6,-9.7,-10,-7.9,.7,.6,.8,2.3,-7.1,-6.5,-7.2,-5,-6.5,-7.4,-7.5,-5.4,-50,-7.6,-50,-4.8,9.8,10,10.2,12.1,-50,-3.1,-11.4,-.7,-4.6,-6.6,-4.9,-3.9],[-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,29.2,-50,28.5,-50,-50,-50,-50,-50,33.3,-50,-50,-50,-50,-50,-50,-50],[-13,-7,-13.1,-8.3,-9.2,-6.5,-8.9,-7.6,-9.8,-.7,-9.2,-2.1,-12.4,-10.3,-12.4,-11.6,-9.5,-4.6,-10.4,-5.7,-13.6,-10.1,-11.4,-10.9,-6.5,-1.5,-6.2,-3.6,-12.8,-8,-12.3,-9.7,-16.5,-12.7,-15.6,-14.3,-8.7,-6,-7.1,-7.5,-9.5,-4.1,-8.4,-6.1,-11,-8.6,-11.3,-9.3,-50,-1.5,-50,-3,-4.8,-1.5,-4.2,-3.1,-50,16.4,-5.1,14.2,-10.1,-4.3,-10,-5.4],[-13.5,-16.3,-11.8,-15.5,-13.6,-15.3,-12.1,-16.1,-7.7,-13.3,-4.2,-12.6,-14.1,-16.2,-10.3,-15.4,-9.6,-11.6,-7.7,-9.8,-14.3,-17.5,-11.1,-17.2,-5.3,-7.1,-2.2,-7.1,-9.6,-11.9,-8.7,-11.4,-17.1,-20.6,-15.3,-19.9,-14.1,-14.8,-12.4,-16.5,-11.7,-12.8,-6.4,-13.4,-14.3,-15.7,-12.7,-14,-50,-7.8,-50,-7.1,-8.7,-11.3,-6.1,-11.4,-50,-5.1,18.6,-4.8,-8.6,-8.1,-4.5,-7.3],[-12.4,-8.2,-13,-5.9,-7.7,-7.8,-7.4,-5.8,-8.8,-2,-9.3,-.4,-11.6,-11.3,-11.6,-9.4,-8.9,-5.6,-10,-3.2,-11.5,-11.1,-10.5,-8.3,-6.3,-4.9,-6.7,-1.2,-10.6,-9.7,-11.3,-8,-14.8,-13.1,-15.5,-11.4,-7.5,-7.5,-7.1,-5.9,-8.4,-5.8,-8.1,-3.6,-9.9,-9.7,-10.1,-8.2,-50,-3,-50,-.1,-3.5,-3.3,-3.6,-.7,-50,14.2,-4.8,16.4,-8.9,-5.8,-8.9,-3.4],[-10.7,-13.2,-12.4,-11.6,-4.8,-8.4,-6.1,-7.2,-10.3,-11.8,-11,-11.6,2.8,-1.7,.7,-1.1,-6.2,-9.7,-7.3,-8.4,-5.3,-8.6,-6.1,-8.3,-10.5,-11.2,-9.8,-10.2,9.5,6.5,7.6,6.8,-12.1,-16,-13,-16.2,-5.2,-8.6,-7.1,-7.8,-12.5,-14.4,-12.1,-13,1.4,-3,-1.6,-2.4,-50,-8.1,-50,-7.3,-0,-5.4,-3.5,-4.6,-50,-10.1,-8.6,-8.9,13.2,-.9,9.7,-.3],[-18.1,-12.3,-19.4,-14.2,-12.2,-9.5,-11.5,-10.8,-17.9,-11.9,-18.2,-13.9,-6.4,-3.7,-6.8,-5.4,-12.8,-5.9,-13.6,-7.4,-13.7,-9.9,-12.9,-12.7,-16.2,-11.6,-15.2,-12.7,-3.2,.5,-3.3,-1.8,-18.9,-16.6,-18.8,-19.2,-12.5,-9.4,-10.6,-11.1,-17.3,-14.1,-16.2,-16,-7.9,-3.7,-7.8,-6.3,-50,3.6,-50,2.3,-8.6,-4.2,-8.4,-6.6,-50,-4.3,-8.1,-5.8,-.9,14.2,-1.8,11.6],[-11.8,-13.1,-11.5,-12,-6.2,-8.3,-5.4,-7.4,-11.8,-12.3,-11.1,-11.4,.5,-2.5,2.4,-1.6,-6.8,-9.9,-6.4,-8.9,-6.1,-8.6,-5,-7.8,-10.4,-11.6,-8.5,-9.9,8.2,6.4,8.7,6.9,-12.4,-17,-12.6,-15.8,-6.5,-8.5,-5,-7.8,-13.2,-13.6,-10.3,-13.7,-.7,-3.2,-.3,-2.4,-50,-9.4,-50,-8.7,-2.1,-5.6,-1.2,-4.9,-50,-10,-4.5,-8.9,9.7,-1.8,11.3,-.9],[-17.2,-13.3,-17.8,-11.6,-11,-11.1,-10.4,-9,-16,-12.7,-16.1,-11.1,-5.2,-5.4,-6,-3.3,-11.8,-7.3,-13.3,-5.9,-12.7,-11.9,-11.9,-9.3,-15.2,-15,-14.9,-11,-2.8,-1.8,-2.9,.4,-17.4,-18.4,-18.3,-15.9,-10.7,-11.2,-10.6,-9,-15.4,-14.8,-15.8,-13.3,-6.8,-5.9,-7.2,-3.9,-50,2,-50,3.9,-7,-6.8,-6.8,-3.9,-50,-5.4,-7.3,-3.4,-.3,11.6,-.9,14.1]],this.TRANS=[[5,0,0,4],[0,5,4,0],[0,4,5,0],[4,0,0,5]],this.CONBLO={A:0,R:1,N:2,D:3,C:4,Q:5,E:6,G:7,H:8,I:9,L:10,K:11,M:12,F:13,P:14,S:15,T:16,W:17,Y:18,V:19,B:20,Z:21,X:22,"*":23},this.CONNUCL={A:0,T:1,C:2,G:3},this.CONSCHN={AAA:0,AAC:1,AAG:2,AAT:3,ACA:4,ACC:5,ACG:6,ACT:7,AGA:8,AGC:9,AGG:10,AGT:11,ATA:12,ATC:13,ATG:14,ATT:15,CAA:16,CAC:17,CAG:18,CAT:19,CCA:20,CCC:21,CCG:22,CCT:23,CGA:24,CGC:25,CGG:26,CGT:27,CTA:28,CTC:29,CTG:30,CTT:31,GAA:32,GAC:33,GAG:34,GAT:35,GCA:36,GCC:37,GCG:38,GCT:39,GGA:40,GGC:41,GGG:42,GGT:43,GTA:44,GTC:45,GTG:46,GTT:47,TAA:48,TAC:49,TAG:50,TAT:51,TCA:52,TCC:53,TCG:54,TCT:55,TGA:56,TGC:57,TGG:58,TGT:59,TTA:60,TTC:61,TTG:62,TTT:63},this.setMethod(i),this.setSequences(t,e),this.setGap(n)}}},7983:(t,e,n)=>{"use strict";n.d(e,{HV:()=>m,QF:()=>f,gQ:()=>u,pf:()=>d});var i=n(4469),s=n(3870),o=n(976),r=n(7241),a=n(4293),l=n(1061),h=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};const c="substr_helm";function u(t){const e=t.getTag(o.TAGS.UNITS),n=t.getTag("separator"),r=s.textInput("Substructure",""),l=s.link("Edit helm",(()=>h(this,void 0,void 0,(function*(){(0,a.Y)(g,m.root),yield s.tools.waitForElementInDom(m.root),setTimeout((()=>{m.cell(c,0).element.children[0].dispatchEvent(new KeyboardEvent("keydown",{key:"Enter"}))}),100)})))),u=o.DataFrame.create(1);u.columns.addNewString(c).init((t=>"")),u.col(c).semType=t.semType,u.col(c).setTag(o.TAGS.UNITS,"helm");const m=u.plot.grid(),p=s.textInput("Separator",n),g=s.div(),v="helm"===e?s.divV([l]):"separator"===e?s.inputs([r,p]):s.inputs([r]);(0,a.Y)(g,v),s.dialog("Substructure Search").add(s.divV([s.divText(`Notation: ${e}`),g])).onOK((()=>h(this,void 0,void 0,(function*(){let s="helm"===e?u.get(c,0):r.value;"separator"===e&&p.value!==n&&""!==p.value&&(s=s.replaceAll(p.value,n));const a=`Matches: ${s}`;if(t.dataFrame.columns.names().filter((t=>t.toLocaleLowerCase()===a.toLocaleLowerCase())).length>0)i.shell.warning(`Search ${s} is already performed`);else{let n;n="helm"===e?yield f(s,t):d(s,t),t.dataFrame.columns.add(o.Column.fromBitSet(a,n))}})))).show()}function d(t,e,n){const i=n?function(t,e){const n=`${e}`.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),i=t.charAt(0)===e,s=t.charAt(t.length-1)===e,o=t.replace(new RegExp(`^${n}|${n}$`,"g"),"");return i?s?`${n}${o}${n}`:`${n}${o}${n}|${n}${o}$`:s?`^${o}${n}|${n}${o}${n}`:`^${o}${n}|${n}${o}${n}|${n}${o}$`}(t,n):t,s=o.BitSet.create(e.length);for(let n=0;n<e.length;n++){const o=e.get(n);(o.match(i)||o===t)&&s.set(n,!0,!1)}return s}function f(t,e){return h(this,void 0,void 0,(function*(){e.version!==e.temp["last-invalidated-version"]&&(yield m(e,!0));const n=o.Column.string("helm",1).init((e=>t));n.setTag(o.TAGS.UNITS,"helm");const s=yield(0,r.D)(n,!0,e.temp["monomers-dict"]);return(yield i.functions.call("Chem:searchSubstructure",{molStringsColumn:e.temp["monomeric-mols"],molString:s.get(0),molBlockFailover:""})).get(0)}))}function m(t,e){return h(this,void 0,void 0,(function*(){const n=o.TaskBarProgressIndicator.create(`Invalidating molfiles for ${t.name}`);yield(0,l.gw)(10);const i=new Map,s=yield(0,r.D)(t,e,i);t.temp["monomeric-mols"]=s,t.temp["monomers-dict"]=i,t.temp["last-invalidated-version"]=t.version,n.close()}))}},2568:(t,e,n)=>{"use strict";n.d(e,{n:()=>r});var i=n(4469),s=n(976),o=n(499);function r(t,e,n=[],r=[],a=!0){const[l,h]=function(t,e,n=[],r=[]){let a=!0,l="";const h=new o.C(t);if(t.semType!==s.SEMTYPE.MACROMOLECULE)i.shell.warning(e+" analysis is allowed for Macromolecules semantic type"),a=!1;else{const t=h.notation;if(n.length>0&&!n.some((e=>t.toUpperCase()==e.toUpperCase())))l=`${e} + ' analysis is allowed for Macromolecules with notation ${0==n.length?"any notation":`notation${n.length>1?"s":""} ${n.map((t=>`"${t}"`)).join(", ")} `}.`,a=!1;else if(!h.isHelm()){const t=h.alphabet;r.length>0&&!r.some((e=>t.toUpperCase()==e.toUpperCase()))&&(l=`${e} + ' analysis is allowed for Macromolecules with alphabet ${0==r.length?"any alphabet":`alphabet${r.length>1?"s":""} ${r.map((t=>`"${t}"`)).join(", ")}.`}.`,a=!1)}}return[a,l]}(t,e,n,r);return a&&!l&&i.shell.warning(h),l}},3553:(t,e,n)=>{"use strict";n.d(e,{Of:()=>o,WY:()=>h,jB:()=>c,rs:()=>a});var i,s,o,r,a,l=n(8341);!function(t){t.SPLIT_COL="~split",t.ACTIVITY="~activity",t.ACTIVITY_SCALED="activity_scaled",t.ALIGNED_SEQUENCE="~aligned_sequence",t.AMINO_ACID_RESIDUE="AAR",t.POSITION="Pos",t.P_VALUE="pValue",t.MEAN_DIFFERENCE="Mean difference"}(i||(i={})),function(t){t.AAR="AAR",t.POSITION="Pos",t.SELECTION="selection"}(s||(s={})),function(t){t.MONOMER="Monomer",t.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference",t.ACTIVITY="activity",t.ACTIVITY_SCALED="activityScaled"}(o||(o={})),function(t){t.CELL_CHANGING="isCellChanging"}(r||(r={})),function(t){t.SEPARATOR="."}(a||(a={}));const h="3.3.1",c={pepsea:{gapOpen:1.53,gapExtend:0,method:l.J[0]},kalign:{gapOpen:null,gapExtend:null,terminalGap:null}}},4004:(t,e,n)=>{"use strict";n.d(e,{O:()=>u});var i=n(3870),s=n(4469),o=n(3336),r=n.n(o),a=n(7767),l=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};let h=null,c=[];function u(t){const e=new a.L(t).notation,n=["-",".","/"],o=["fasta","separator","helm"].filter((t=>t!==e)),u=i.choiceInput("Convert to",o[0],o),d=i.choiceInput("Separator",n[0],n),f=()=>{"separator"!==u.value?r()(d.root).hide():r()(d.root).show()};f(),u.onChanged((()=>{f()})),null==h&&(h=i.dialog("Convert Sequence Notation").add(i.div([i.divText("Current notation: "+e,{style:{"text-align":"center","font-weight":"bold","font-size":"14px",padding:"5px"}}),u.root,d.root])).onOK((()=>l(this,void 0,void 0,(function*(){const e=u.value,n=d.value;yield function(t,e,n){return l(this,void 0,void 0,(function*(){const i=new a.L(t).convert(e,n);t.dataFrame.columns.add(i);const o=yield s.functions.call("Bio:detectMacromolecule",{col:i});return o&&(i.semType=o),yield s.data.detectSemanticTypes(t.dataFrame),i}))}(t,e,n)})))).show({x:350,y:100}),c.push(h.onClose.subscribe((t=>{c.forEach((t=>{t.unsubscribe()})),c=[],h=null}))))}},1345:(t,e,n)=>{"use strict";n.d(e,{NT:()=>m,P4:()=>c,QD:()=>d,RV:()=>l,nW:()=>u});var i=n(976),s=n(4469),o=n(701),r=n(7228),a=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};const l="Libraries",h="System:AppData/Bio/libraries/";function c(){return a(this,void 0,void 0,(function*(){return(yield s.dapi.files.list(`${h}`,!1,"")).map((t=>t.fileName))}))}function u(){return a(this,void 0,void 0,(function*(){const t=yield s.dapi.userDataStorage.getValue(l,"Settings",!0),e=t?JSON.parse(t):{exclude:[]};return e.exclude=e.exclude instanceof Array?e.exclude:[],e}))}function d(t){return a(this,void 0,void 0,(function*(){yield s.dapi.userDataStorage.postValue(l,"Settings",JSON.stringify(t),!0)}))}class f{constructor(t){this._monomers={},this._onChanged=new o.Subject,this._monomers=t}getMonomer(t,e){return t in this._monomers&&e in this._monomers[t]?this._monomers[t][e]:null}getTypes(){return Object.keys(this._monomers)}getMonomerMolsByType(t){const e={};return Object.keys(this._monomers[t]).forEach((n=>{e[n]=this._monomers[t][n].molfile})),e}getMonomerNamesByType(t){return Object.keys(this._monomers[t])}get onChanged(){return this._onChanged}_updateInt(t){const e=t.getTypes(),n=this.getTypes();e.forEach((e=>{n.includes(e)||(this._monomers[e]={}),t.getMonomerNamesByType(e).forEach((n=>{this._monomers[e][n]=t.getMonomer(e,n)}))}))}update(t){this._updateInt(t),this._onChanged.next()}updateLibs(t,e=!1){e&&(this._monomers={});for(const e of t)this._updateInt(e);this._onChanged.next()}clear(){this._monomers={},this._onChanged.next()}}class m{constructor(){this._monomerLib=new f({}),this.loadLibrariesPromise=Promise.resolve()}getBioLib(){return this._monomerLib}loadLibraries(t=!1){return a(this,void 0,void 0,(function*(){return this.loadLibrariesPromise=this.loadLibrariesPromise.then((()=>a(this,void 0,void 0,(function*(){const[e,n]=yield Promise.all([c(),u()]),i=yield Promise.all(e.filter((t=>!n.exclude.includes(t))).map((t=>this.readLibrary(h,t))));this._monomerLib.updateLibs(i,t)}))))}))}readLibrary(t,e){return a(this,void 0,void 0,(function*(){let n,o,a=[];const l=new i.FileSource(t);if(e.endsWith(".sdf"))1===i.Func.find({package:"Chem",name:"importSdf"}).length?(n=yield l.readAsBytes(e),o=yield s.functions.call("Chem:importSdf",{bytes:n}),a=(0,r.Xk)(o[0])):s.shell.warning("Chem package is not installed");else{const t=yield l.readAsText(e);a=JSON.parse(t)}const h={},c=[];return a.forEach((t=>{const e={symbol:t.symbol,name:t.name,naturalAnalog:t.naturalAnalog,molfile:t.molfile,rgroups:t.rgroups,polymerType:t.polymerType,monomerType:t.monomerType,data:{}};Object.keys(t).forEach((n=>{r.DC.includes(n)||(e.data[n]=t[n])})),c.includes(t.polymerType)||(h[t.polymerType]={},c.push(t.polymerType)),h[t.polymerType][t.symbol]=e})),new f(h)}))}static get instance(){return m._instance||(m._instance=new m),m._instance}}m._instance=null},525:(t,e,n)=>{"use strict";n.d(e,{K:()=>A});var i=n(4469),s=n(976),o=n(3870),r=n(6098),a=n(8341),l=n(2568),h=n(7767),c=n(3477),u=n(3553),d=n(3379),f=n.n(d),m=n(7795),p=n.n(m),g=n(569),v=n.n(g),y=n(3565),b=n.n(y),w=n(9216),C=n.n(w),S=n(4589),M=n.n(S),x=n(9564),T={};T.styleTagTransform=M(),T.setAttributes=b(),T.insert=v().bind(null,"head"),T.domAPI=p(),T.insertStyleElement=C(),f()(x.Z,T),x.Z&&x.Z.locals&&x.Z.locals;var N=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};class E extends Error{constructor(t,e){super(t,e)}}function A(t={}){return N(this,void 0,void 0,(function*(){return new Promise(((e,n)=>N(this,void 0,void 0,(function*(){var r,l,h,c,d,f,m,p,g,v,y,b,w;null!==(r=t.clustersCol)&&void 0!==r||(t.clustersCol=null),null!==(l=t.pepsea)&&void 0!==l||(t.pepsea={}),null!==(h=(y=t.pepsea).method)&&void 0!==h||(y.method=u.jB.pepsea.method),null!==(c=(b=t.pepsea).gapOpen)&&void 0!==c||(b.gapOpen=u.jB.pepsea.gapOpen),null!==(d=(w=t.pepsea).gapExtend)&&void 0!==d||(w.gapExtend=u.jB.pepsea.gapExtend);const C=null!==(m=null===(f=t.col)||void 0===f?void 0:f.dataFrame)&&void 0!==m?m:i.shell.t,S=null!==(p=t.col)&&void 0!==p?p:C.columns.bySemType(s.SEMTYPE.MACROMOLECULE);if(null==S){const t="MSAError: dataset doesn't conain any Macromolecule column";i.shell.warning(t),n(new E(t))}const M=o.choiceInput("Method",t.pepsea.method,a.J);M.setTooltip("Alignment method");const x=o.floatInput("Terminal gap",null!==(v=null===(g=null==t?void 0:t.kalign)||void 0===g?void 0:g.terminalGap)&&void 0!==v?v:null);x.setTooltip("Penalty for opening a gap at the beginning or end of the sequence");const T=o.p(`Kalign version: ${u.WY}`,"kalign-version"),A=o.floatInput("Gap open",t.pepsea.gapOpen);A.setTooltip("Gap opening penalty at group-to-group alignment");const k=o.floatInput("Gap extend",t.pepsea.gapExtend);k.setTooltip("Gap extension penalty to skip the alignment");const R=[M.root.style],_=[x.root.style,T.style];let G;const P=o.columnInput("Sequence",C,S,(()=>N(this,void 0,void 0,(function*(){G=yield L(P.value,C,R,_,M,O,A,k,x)}))));P.setTooltip("Sequences column to use for alignment");const O=o.columnInput("Clusters",C,t.clustersCol);if(O.nullable=!0,P.fireChanged(),t.col)return G=yield L(t.col,C,R,_,M,O,A,k,x),void(yield I(P,C,G,e,n));o.dialog("MSA").add(P).add(O).add(M).add(A).add(k).add(x).add(T).onOK((()=>N(this,void 0,void 0,(function*(){yield I(P,C,G,e,n)})))).show()}))))}))}function I(t,e,n,o,r){return N(this,void 0,void 0,(function*(){let a=null;const l=s.TaskBarProgressIndicator.create("Analyze for MSA ...");try{if(t.fireChanged(),t.value.semType!==s.SEMTYPE.MACROMOLECULE)throw new Error("Chosen column has to be of Macromolecule semantic type");if(void 0===n)throw new Error("Invalid column format");if(a=yield n(),null==a)return i.shell.warning("Wrong column format");e.columns.add(a),yield i.data.detectSemanticTypes(e),o(a)}catch(t){const e=t instanceof Error?t.message:t.toString();i.shell.error(e),r(t)}finally{l.close()}}))}function L(t,e,n,o,d,f,m,p,g){return N(this,void 0,void 0,(function*(){try{if(t.semType!==s.SEMTYPE.MACROMOLECULE)return;const i=e.columns.getUnusedName(`msa(${t.name})`);if((0,l.n)(t,t.name,["fasta","separator"],["DNA","RNA","PT"],!1)){k(n,o,"kalign"),m.value=null,p.value=null,g.value=null;const e=new h.L(t),s=e.isFasta()?t:e.convert("fasta");return()=>N(this,void 0,void 0,(function*(){return yield(0,r.U)(s,!1,i,f.value)}))}if((0,l.n)(t,t.name,["helm"],[],!1))return k(n,o,"pepsea"),m.value=u.jB.pepsea.gapOpen,p.value=u.jB.pepsea.gapExtend,()=>N(this,void 0,void 0,(function*(){return yield(0,a.f)(t,i,d.value,m.value,p.value,f.value)}));if((0,l.n)(t,t.name,["separator"],["UN"],!1)){const e=new h.L(t);if(!(yield e.checkHelmCompatibility()))return;const s=e.convert("helm");return k(n,o,"pepsea"),m.value=u.jB.pepsea.gapOpen,p.value=u.jB.pepsea.gapExtend,()=>N(this,void 0,void 0,(function*(){return yield(0,a.f)(s,i,d.value,m.value,p.value,f.value)}))}return void k(n,o,"kalign")}catch(t){const e=t instanceof Error?t.message:t.toString();i.shell.error(e),c._package.logger.error(e)}}))}function k(t,e,n){if("kalign"===n){for(const e of t)e.display="none";for(const t of e)t.removeProperty("display")}else{for(const t of e)t.display="none";for(const e of t)e.removeProperty("display")}}},6098:(t,e,n)=>{"use strict";n.d(e,{U:()=>P});var i=n(976),s=n(5226);const o=Symbol("Comlink.proxy"),r=Symbol("Comlink.endpoint"),a=Symbol("Comlink.releaseProxy"),l=Symbol("Comlink.thrown"),h=t=>"object"==typeof t&&null!==t||"function"==typeof t,c=new Map([["proxy",{canHandle:t=>h(t)&&t[o],serialize(t){const{port1:e,port2:n}=new MessageChannel;return u(t,e),[n,[n]]},deserialize:t=>(t.start(),f(t))}],["throw",{canHandle:t=>h(t)&&l in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}}]]);function u(t,e=self){e.addEventListener("message",(function n(i){if(!i||!i.data)return;const{id:s,type:r,path:a}=Object.assign({path:[]},i.data),h=(i.data.argumentList||[]).map(w);let c;try{const e=a.slice(0,-1).reduce(((t,e)=>t[e]),t),n=a.reduce(((t,e)=>t[e]),t);switch(r){case"GET":c=n;break;case"SET":e[a.slice(-1)[0]]=w(i.data.value),c=!0;break;case"APPLY":c=n.apply(e,h);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[o]:!0})}(new n(...h));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;u(t,n),c=function(t,e){return y.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(t){c={value:t,[l]:0}}Promise.resolve(c).catch((t=>({value:t,[l]:0}))).then((t=>{const[i,o]=b(t);e.postMessage(Object.assign(Object.assign({},i),{id:s}),o),"RELEASE"===r&&(e.removeEventListener("message",n),d(e))}))})),e.start&&e.start()}function d(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function f(t,e){return p(t,[],e)}function m(t){if(t)throw new Error("Proxy has been released and is not useable")}function p(t,e=[],n=function(){}){let i=!1;const s=new Proxy(n,{get(n,o){if(m(i),o===a)return()=>C(t,{type:"RELEASE",path:e.map((t=>t.toString()))}).then((()=>{d(t),i=!0}));if("then"===o){if(0===e.length)return{then:()=>s};const n=C(t,{type:"GET",path:e.map((t=>t.toString()))}).then(w);return n.then.bind(n)}return p(t,[...e,o])},set(n,s,o){m(i);const[r,a]=b(o);return C(t,{type:"SET",path:[...e,s].map((t=>t.toString())),value:r},a).then(w)},apply(n,s,o){m(i);const a=e[e.length-1];if(a===r)return C(t,{type:"ENDPOINT"}).then(w);if("bind"===a)return p(t,e.slice(0,-1));const[l,h]=v(o);return C(t,{type:"APPLY",path:e.map((t=>t.toString())),argumentList:l},h).then(w)},construct(n,s){m(i);const[o,r]=v(s);return C(t,{type:"CONSTRUCT",path:e.map((t=>t.toString())),argumentList:o},r).then(w)}});return s}function g(t){return Array.prototype.concat.apply([],t)}function v(t){const e=t.map(b);return[e.map((t=>t[0])),g(e.map((t=>t[1])))]}const y=new WeakMap;function b(t){for(const[e,n]of c)if(n.canHandle(t)){const[i,s]=n.serialize(t);return[{type:"HANDLER",name:e,value:i},s]}return[{type:"RAW",value:t},y.get(t)||[]]}function w(t){switch(t.type){case"HANDLER":return c.get(t.name).deserialize(t.value);case"RAW":return t.value}}function C(t,e,n){return new Promise((i=>{const s=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");t.addEventListener("message",(function e(n){!n.data||!n.data.id||n.data.id!==s||(t.removeEventListener("message",e),i(n.data))})),t.start&&t.start(),t.postMessage(Object.assign({id:s},e),n)}))}const S="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0ICQ9U3ltYm9sKCJDb21saW5rLnByb3h5IiksQT1TeW1ib2woIkNvbWxpbmsuZW5kcG9pbnQiKSxSPVN5bWJvbCgiQ29tbGluay5yZWxlYXNlUHJveHkiKSx5PVN5bWJvbCgiQ29tbGluay50aHJvd24iKSxfPWU9PnR5cGVvZiBlPT0ib2JqZWN0IiYmZSE9PW51bGx8fHR5cGVvZiBlPT0iZnVuY3Rpb24iLEw9e2NhbkhhbmRsZTplPT5fKGUpJiZlWyRdLHNlcmlhbGl6ZShlKXtjb25zdHtwb3J0MTpyLHBvcnQyOml9PW5ldyBNZXNzYWdlQ2hhbm5lbDtyZXR1cm4gdyhlLHIpLFtpLFtpXV19LGRlc2VyaWFsaXplKGUpe3JldHVybiBlLnN0YXJ0KCksQyhlKX19LE89e2NhbkhhbmRsZTplPT5fKGUpJiZ5IGluIGUsc2VyaWFsaXplKHt2YWx1ZTplfSl7bGV0IHI7cmV0dXJuIGUgaW5zdGFuY2VvZiBFcnJvcj9yPXtpc0Vycm9yOiEwLHZhbHVlOnttZXNzYWdlOmUubWVzc2FnZSxuYW1lOmUubmFtZSxzdGFjazplLnN0YWNrfX06cj17aXNFcnJvcjohMSx2YWx1ZTplfSxbcixbXV19LGRlc2VyaWFsaXplKGUpe3Rocm93IG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H0gZmlsZXN5c3RlbSBhdCAke299YCksZS5ta2RpcihvKSxlLm1vdW50KHQuYmFzZS5tb2R1bGUuUFJPWFlGUyx7cm9vdDpzLGZzOml9LG8pKX19LF9maWxlb3AoZSxyKXt0Ll9sb2coYFJ1bm5pbmcgJHtlfSAke3J9YCk7Y29uc3QgaT10LmZzLmFuYWx5emVQYXRoKHIpO2lmKCFpLmV4aXN0cylyZXR1cm4gdC5fbG9nKGBGaWxlICR7cn0gbm90IGZvdW5kLmApLCExO3N3aXRjaChlKXtjYXNlImNhdCI6cmV0dXJuIHQuZnMucmVhZEZpbGUocix7ZW5jb2Rpbmc6InV0ZjgifSk7Y2FzZSJscyI6cmV0dXJuIHQuZnMuaXNGaWxlKGkub2JqZWN0Lm1vZGUpP3QuZnMuc3RhdChyKTp0LmZzLnJlYWRkaXIocik7Y2FzZSJkb3dubG9hZCI6Y29uc3Qgcz1uZXcgQmxvYihbdGhpcy5jYXQocildKTtyZXR1cm4gVVJMLmNyZWF0ZU9iamVjdFVSTChzKX1yZXR1cm4hMX0sX2xvZyhlKXtpZighdC5jb25maWcuZGVidWcpcmV0dXJuO2xldCByPVsuLi5hcmd1bWVudHNdO3Iuc2hpZnQoKSxjb25zb2xlLmxvZyhgJWNbV2ViV29ya2VyXSVjICR7ZX1gLCJmb250LXdlaWdodDpib2xkIiwiIiwuLi5yKX19O3codCl9KSgpOwo=",M=typeof window<"u"&&window.Blob&&new Blob([atob(S)],{type:"text/javascript;charset=utf-8"});function x(){const t=M&&(window.URL||window.webkitURL).createObjectURL(M);try{return t?new Worker(t):new Worker("data:application/javascript;base64,"+S)}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}const T={urlCDN:"https://biowasm.com/cdn/v3",urlCDNStg:"https://stg.biowasm.com/cdn/v3",dirShared:"/shared",dirMounted:"/mnt",dirData:"/data",printInterleaved:!0,callback:null,debug:!1,env:"prd"};class N{constructor(t,e={}){if(null==t)throw"Expecting array of tools as input to Aioli constructor.";return Array.isArray(t)||(t=[t]),e=Object.assign({},T,e),t=t.map(this._parseTool),"stg"===e.env&&(e.urlCDN=e.urlCDNStg),this.tools=t,this.config=e,null!=this.config.callback&&(this.callback=this.config.callback),delete this.config.callback,this.init()}async init(){const t=new x;this.callback&&(t.onmessage=t=>{"biowasm"===t.data.type&&this.callback(t.data.value)});const e=f(t);return e.tools=this.tools,e.config=this.config,await e.init(),e}_parseTool(t){if("string"!=typeof t)return t;const e=t.split("/");if(2!=e.length&&3!=e.length)throw"Expecting '<tool>/<version>' or '<tool>/<program>/<version>'";return{tool:e[0],program:3==e.length?e[1]:e[0],version:e[e.length-1]}}}var E=n(7997);class A{static getAvailableScales(){return Object.entries(this.scales).map((([t,e])=>t))}static getScale(t){return(0,E.hu)(!(void 0===this.scales[t]),`Scale '${t}' was not found.`),this.scales[t]}}A.scales={WimleyWhite:{"-":0,A:.17,C:-.24,D:-.07,E:-.01,F:-1.13,G:.01,H:.17,I:-.31,K:.99,L:-.56,M:-.23,N:.42,P:.45,Q:.58,R:.81,S:.13,T:.14,V:.07,W:-1.85,Y:-.94},categorial:{"-":0,A:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,K:9,L:10,M:11,N:12,P:13,Q:14,R:15,S:16,T:17,V:18,W:19,Y:20}};class I{constructor(t="categorial"){this.aa2num=A.getScale(t),this.num2aa={},Object.entries(this.aa2num).forEach((([t,e])=>this.num2aa[e]=t))}static _truncateSequence(t){let e=0,n=t.length;const i=["NH2","COOH"];if(t.startsWith(i[0])){const n=i[0].length;(0,E.hu)("-"==t[n],`Wrong sequence format: ${i[0]} without following '-' in '${t}'.`),e=n}if(t.endsWith(i[1])){const e=i[1].length+1;(0,E.hu)("-"==t[n-e],`Wrong sequence format: ${i[1]} without '-' precending in '${t}'.`),n-=e}return t.substring(e,n)}static _dropDefises(t){return t.replace(/(-)([^-]+)/g,"$2")}static clean(t){return I._dropDefises(I._truncateSequence(t))}encode(t){const e=t.length,n=new Array(e).fill(0);for(let i=0;i<e;++i){const e=t[i];(0,E.hu)(e in this.aa2num,`Unknown char '${e}' found in sequence '${t}'`),n[i]=this.encodeLettter(e)}return n}encodeLettter(t){return this.aa2num[t]}decode(t){let e="";for(let n=0;n<t.length;++n){const i=t[n];(0,E.hu)(i in this.num2aa,`Unknown code '${i}' found in vector '${t}'`),e+=this.num2aa[i]}return e}}var L=n(3553),k=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};const R="input.fa",_="result.fasta";function G(t){return t.reduce(((t,e,n)=>t+`>sample${n+1}\n${e}\n`),"")}function P(t,e=!1,n="",o=null,r,a,l){var h,c;return k(this,void 0,void 0,(function*(){let u=t.toList();e&&(u=u.map((t=>I.clean(t).replace(/\-/g,""))));const d=t.length;null!=o||(o=i.Column.string("Clusters",d).init("0")),o.type!=i.COLUMN_TYPE.STRING&&(o=o.convertTo(i.TYPE.STRING)),o.compact();const f=o.categories,m=o.getRawData(),p=new Array(f.length),g=new Array(f.length);for(let t=0;t<d;++t){const e=m[t];(null!==(h=p[e])&&void 0!==h?h:p[e]=[]).push(u[t]),(null!==(c=g[e])&&void 0!==c?c:g[e]=[]).push(t)}const v=yield new N(["base/1.0.0",{tool:"kalign",version:L.WY,reinit:!0}]),y=i.Column.string(n,d);for(let t=0;t<f.length;++t){const e=G(p[t]);yield v.fs.writeFile(R,e);const n=`${void 0!==r?` --gpo ${r}`:""}${void 0!==a?` --gpe ${a}`:""}${void 0!==l?` --tgpe ${l}`:""}`,i=yield v.exec(`kalign ${R} -f fasta -o ${_}${n}`);console.warn(i);const o=yield v.cat(_);if(!o)throw new Error("kalign output no result");const h=new s.i(o).sequencesArray,c=g[t];for(let t=0;t<h.length;++t)y.set(c[t],h[t])}const b=t.getTag(i.TAGS.UNITS),w=t.getTag("alphabet");return y.setTag(i.TAGS.UNITS,b),y.setTag("aligned","SEQ.MSA"),y.setTag("alphabet",w),y.semType=i.SEMTYPE.MACROMOLECULE,y}))}},8341:(t,e,n)=>{"use strict";n.d(e,{J:()=>a,f:()=>h});var i=n(4469),s=n(976),o=n(3553),r=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};const a=["mafft --auto","mafft","linsi","ginsi","einsi","fftns","fftnsi","nwns","nwnsi"],l=["AlignedSeq","AlignedSubpeptide","HELM","ID","PolymerID"];function h(t,e,n="ginsi",a=1.53,h=0,u=null){var d;return r(this,void 0,void 0,(function*(){const r=t.length;null!=u||(u=s.Column.int("Clusters",r).init(0)),u.type!=s.COLUMN_TYPE.STRING&&(u=u.convertTo(s.TYPE.STRING));const f=u.categories,m=new Array(f.length);for(let e=0;e<r;++e){const n=u.get(e);if(""===n)continue;const i=f.indexOf(n),s=t.get(e);s&&(null!==(d=m[i])&&void 0!==d?d:m[i]=[]).push({ID:e.toString(),HELM:s})}const p=yield(void 0!==i.dapi.docker?i.dapi.docker.dockerContainers:i.dapi.dockerfiles).filter("bio").first(),g=new Array(r);for(const t of m){const e=(yield c(p.id,t,n,a,h)).Alignment;for(const t of e)g[parseInt(t.ID)]=Object.entries(t).filter((t=>!l.includes(t[0]))).map((t=>"-"!==t[1]?t[1]:"")).join(o.rs.SEPARATOR)}const v=s.Column.fromStrings(e,g);return v.setTag(s.TAGS.UNITS,"separator"),v.setTag("separator",o.rs.SEPARATOR),v.setTag("aligned","SEQ.MSA"),v.setTag("alphabet","UN"),v.setTag(".alphabetIsMultichar","true"),v.semType=s.SEMTYPE.MACROMOLECULE,v}))}function c(t,e,n,s,o){return r(this,void 0,void 0,(function*(){const r={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)},a=`/align?method=${n}&gap_open=${s}&gap_extend=${o}`,l=yield(void 0!==i.dapi.docker?i.dapi.docker.dockerContainers:i.dapi.dockerfiles).request(t,a,r);return JSON.parse(null!=l?l:"{}")}))}},9943:(t,e,n)=>{"use strict";n.d(e,{C2:()=>u});var i=n(976),s=n(3870),o=n(4469),r=n(6414),a=n.n(r),l=n(8447),h=n(499);const c=60;function u(){const t=o.shell.tv.grid,e=a().count(0).take(t.columns.length).map((e=>t.columns.byIndex(e))).filter((t=>!!t.column&&t.column.semType!==i.SEMTYPE.MACROMOLECULE)).toArray(),n=e.find((t=>-1!==t.name.toLowerCase().indexOf("id"))),r=n?[n.name]:[],u=s.multiChoiceInput("Seq id columns",r,e.map((t=>t.name))),f=a().count(0).take(t.columns.length).map((e=>t.columns.byIndex(e))).filter((t=>{const e=t.column;return!(!e||e.semType!==i.SEMTYPE.MACROMOLECULE)&&new h.C(e).isFasta()})).toArray(),m=f.length>0?f[0].name:[],p=s.choiceInput("Seq column",m,f.map((t=>t.name))),g=s.intInput("FASTA line width",c);s.dialog({title:"Save as FASTA"}).add(s.inputs([u,p,g])).onOK((()=>{var e;const n=u.value?u.value.map((e=>t.columns.byName(e).column)):[],i=p.value?t.columns.byName(p.value).column:null,s=null!==(e=g.value)&&void 0!==e?e:c;i||o.shell.warning("Seq column is mandatory to save as FASTA.");const r=function(t,e,n=c,i="\n"){const s=l.kB,o=[];for(let r=0;r<e.length;r++){const a=t.map((t=>t.get(r).toString())).join("|"),l=d(e.get(r),s,n);o.push(`>${a}${i}`);for(const t of l)o.push(`${t}${i}`)}return"".concat(...o)}(n,i,s),a=document.createElement("a");a.setAttribute("href",`data:text/plain;charset=utf-8,${encodeURIComponent(r)}`),a.setAttribute("download",`${t.dataFrame.name}.fasta`),a.click()})).show()}function d(t,e,n=c){const i=e(t);let s=0;const o=i.length,r=[];for(;s<o;){const t=i.slice(s,s+n),e=t.map((t=>t.length>1?`[${t}]`:t)).join("");r.push(e),s+=t.length}return r}},4293:(t,e,n)=>{"use strict";n.d(e,{Y:()=>r,m:()=>o});var i=n(4469),s=n(976);function o(){const t=i.shell.t.columns.bySemType(s.SEMTYPE.MACROMOLECULE);if(null!==t)return t;i.shell.error("Current table does not contain macromolecules")}function r(t,e){t.innerHTML="",t.append(e)}},2121:(t,e,n)=>{"use strict";n.d(e,{bo:()=>m,OZ:()=>y});var i=n(4469),s=n(3870),o=n(976),r=n(6414),a=n.n(r),l=n(701),h=n(499),c=n(8447),u=n(9298);function d(t){var e;return"string"==typeof t||t instanceof String?t:("object"==typeof t||t instanceof Object)&&"$thrownJsError"in t?d(t.$thrownJsError):t instanceof Error?null!==(e=t.stack)&&void 0!==e?e:t.message:t.toString()}var f,m;HTMLCanvasElement.prototype.getCursorPosition=function(t,e){const n=this.getBoundingClientRect();return new o.Point((t.clientX-n.left)*e,(t.clientY-n.top)*e)},o.Rect.prototype.contains=function(t,e){return this.left<=t&&t<=this.right&&this.top<=e&&e<=this.bottom};class p{constructor(t=0,e=new o.Rect(0,0,0,0)){this.count=t,this.bounds=e}}class g{constructor(t,e,n={},i=0,s=0){this.pos=t,this.name=e,this.freq=n,this.rowCount=i,this.sumForHeightCalc=s}}!function(t){t.STYLE="Style",t.BEHAVIOR="Behavior",t.LAYOUT="Layout",t.DATA="Data"}(f||(f={})),function(t){t.sequenceColumnName="sequenceColumnName",t.startPositionName="startPositionName",t.endPositionName="endPositionName",t.skipEmptySequences="skipEmptySequences",t.skipEmptyPositions="skipEmptyPositions",t.shrinkEmptyTail="shrinkEmptyTail",t.backgroundColor="backgroundColor",t.positionHeight="positionHeight",t.positionWidth="positionWidth",t.verticalAlignment="verticalAlignment",t.horizontalAlignment="horizontalAlignment",t.fixWidth="fixWidth",t.fitArea="fitArea",t.minHeight="minHeight",t.maxHeight="maxHeight",t.positionMarginState="positionMarginState",t.positionMargin="positionMargin",t.filterSource="filterSource"}(m||(m={}));const v=u.vS;class y extends o.JsViewer{get filter(){let t;switch(this.filterSource){case u.Ct.Filtered:t=this.dataFrame.filter;break;case u.Ct.Selected:t=this.dataFrame.selection}return t}get Length(){return this.skipEmptyPositions?this.positions.length:this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0}get positionWidthWithMargin(){return this._positionWidth+this.positionMarginValue}get positionMarginValue(){var t;return"auto"===this.positionMarginState&&!0===(null===(t=this.unitsHandler)||void 0===t?void 0:t.getAlphabetIsMultichar())||"enable"===this.positionMarginState?this.positionMargin:0}get countOfRenderPositions(){if(null==this.host)return 0;const t=window.devicePixelRatio;return t>1?this.canvasWidthWithRatio/this.positionWidthWithMargin:this.canvas.width/(this.positionWidthWithMargin*t)}get canvasWidthWithRatio(){return this.canvas.width*window.devicePixelRatio}get firstVisibleIndex(){return this.visibleSlider?Math.floor(this.slider.min):0}constructor(){super(),this.viewerId=-1,this.initialized=!1,this.cp=null,this.axisHeight=12,this.seqCol=null,this.splitter=null,this.positions=[],this.rowsMasked=0,this.rowsNull=0,this.visibleSlider=!1,this.allowResize=!0,this.turnOfResizeForOneSetValue=!1,this.backgroundColor=4294967295,this.positionMargin=0,this.positionNames=[],this.startPosition=-1,this.endPosition=-1,this.viewSubs=[],this.viewerId=y.viewerCount,y.viewerCount+=1,this.textBaseline="top",this.unitsHandler=null,this.sequenceColumnName=this.string(m.sequenceColumnName,v.sequenceColumnName,{category:f.DATA}),this.startPositionName=this.string(m.startPositionName,v.startPositionName,{category:f.DATA}),this.endPositionName=this.string(m.endPositionName,v.endPositionName,{category:f.DATA}),this.skipEmptySequences=this.bool(m.skipEmptySequences,v.skipEmptySequences,{category:f.DATA}),this.skipEmptyPositions=this.bool(m.skipEmptyPositions,v.skipEmptyPositions,{category:f.DATA}),this.shrinkEmptyTail=this.bool(m.shrinkEmptyTail,v.shrinkEmptyTail,{category:f.DATA}),this.backgroundColor=this.int(m.backgroundColor,v.backgroundColor,{category:f.STYLE}),this.positionHeight=this.string(m.positionHeight,v.positionHeight,{category:f.STYLE,choices:Object.values(u.ES)}),this._positionWidth=this.positionWidth=this.float(m.positionWidth,v.positionWidth,{category:f.STYLE}),this.verticalAlignment=this.string(m.verticalAlignment,v.verticalAlignment,{category:f.LAYOUT,choices:Object.values(u.vw)}),this.horizontalAlignment=this.string(m.horizontalAlignment,v.horizontalAlignment,{category:f.LAYOUT,choices:Object.values(u.iD)}),this.fixWidth=this.bool(m.fixWidth,v.fixWidth,{category:f.LAYOUT}),this.fitArea=this.bool(m.fitArea,v.fitArea,{category:f.LAYOUT}),this.minHeight=this.float(m.minHeight,v.minHeight,{category:f.LAYOUT}),this.maxHeight=this.float(m.maxHeight,v.maxHeight,{category:f.LAYOUT}),this.positionMarginState=this.string(m.positionMarginState,v.positionMarginState,{category:f.LAYOUT,choices:Object.values(u.dE)});let t=0;"auto"===this.positionMarginState&&(t=4),this.positionMargin=this.int(m.positionMargin,t,{category:f.LAYOUT,min:0,max:16}),this.filterSource=this.string(m.filterSource,v.filterSource,{category:f.BEHAVIOR,choices:Object.values(u.Ct)}),this.slider=s.rangeSlider(0,100,0,20,!1,{style:"barbell"}),this.canvas=s.canvas(),this.canvas.style.width="100%"}init(){this.initialized?console.error("Bio: WebLogoViewer.init() second initialization!"):(this.initialized=!0,this.helpUrl="/help/visualize/viewers/web-logo.md",this.msgHost=s.div("No message"),this.msgHost.style.display="none",this.canvas=s.canvas(),this.canvas.style.width="100%",this.slider.root.style.position="absolute",this.slider.root.style.zIndex="999",this.slider.root.style.display="none",this.slider.root.style.height="0.7em",this.visibleSlider=!1,this.subs.push(this.slider.onValuesChanged.subscribe(this.sliderOnValuesChanged.bind(this))),this.host=s.div([this.msgHost,this.canvas]),this.host.style.justifyContent="center",this.host.style.alignItems="center",this.host.style.position="relative",this.host.style.setProperty("overflow","hidden","important"),this.subs.push(l.fromEvent(this.canvas,"mousemove").subscribe(this.canvasOnMouseMove.bind(this))),this.subs.push(l.fromEvent(this.canvas,"mousedown").subscribe(this.canvasOnMouseDown.bind(this))),this.subs.push(l.fromEvent(this.canvas,"wheel").subscribe(this.canvasOnWheel.bind(this))),this.subs.push(s.onSizeChanged(this.root).subscribe(this.rootOnSizeChanged.bind(this))),this.root.append(this.host),this.root.append(this.slider.root),this._calculate(window.devicePixelRatio),this.updateSlider(),this.render(!0))}rootOnSizeChanged(){this._calculate(window.devicePixelRatio),this.updateSlider(),this.render(!0)}updateSeqCol(){if(this.dataFrame)if(this.seqCol=this.sequenceColumnName?this.dataFrame.col(this.sequenceColumnName):null,null==this.seqCol&&(this.seqCol=(0,c.up)(this.dataFrame),this.sequenceColumnName=this.seqCol?this.seqCol.name:null),this.seqCol){const t=this.seqCol.getTag(o.TAGS.UNITS),e=this.seqCol.getTag("separator");this.splitter=(0,c.vU)(t,e),this.unitsHandler=new h.C(this.seqCol),this.updatePositions(),this.cp=(0,c.dQ)(this.seqCol)}else this.splitter=null,this.positionNames=[],this.startPosition=-1,this.endPosition=-1,this.cp=null;this.render()}updatePositions(){if(!this.seqCol)return;let t;if(this.shrinkEmptyTail){const e=this.dataFrame.filter.getSelectedIndexes();t=Array.from(new Set(Array.from(Array(e.length).keys()).map((t=>this.seqCol.get(e[t])))))}else t=this.seqCol.categories;const e=t.length>0?Math.max(...t.map((t=>null!==t?this.splitter(t).length:0))):0,n=this.seqCol.getTag(u.DX.positionNames);this.positionNames=n?n.split(u.CI).map((t=>t.trim())):[...Array(e).keys()].map((t=>`${t+1}`)),this.startPosition=this.startPositionName&&this.positionNames&&this.positionNames.includes(this.startPositionName)?this.positionNames.indexOf(this.startPositionName):0,this.endPosition=this.endPositionName&&this.positionNames&&this.positionNames.includes(this.endPositionName)?this.positionNames.indexOf(this.endPositionName):e-1}get widthArea(){return this.Length*this.positionWidth/window.devicePixelRatio}get heightArea(){return Math.min(this.maxHeight,Math.max(this.minHeight,this.root.clientHeight))}get xScale(){return this.widthArea>0?(this.root.clientWidth-this.Length*this.positionMarginValue)/this.widthArea:0}get yScale(){return this.root.clientHeight/this.heightArea}checkIsHideSlider(){let t=!0;const e=Math.min(this.xScale,this.yScale);return(e==this.xScale||e<=1)&&this.fitArea&&(t=!1),this.fixWidth||Math.ceil(this.canvas.width/this.positionWidthWithMargin)>=this.Length||t}setSliderVisibility(t){t?(this.slider.root.style.display="inherit",this.visibleSlider=!0):(this.slider.root.style.display="none",this.visibleSlider=!1)}updateSlider(){if(this.checkIsHideSlider()?this.setSliderVisibility(!1):this.setSliderVisibility(!0),null!=this.slider&&null!=this.canvas){const t=Math.max(0,Math.floor(this.slider.min+this.canvas.width/this.positionWidthWithMargin)-this.Length);let e=Math.floor(this.slider.min-t),n=Math.floor(this.slider.min-t)+Math.floor(this.canvas.width/this.positionWidthWithMargin);this.checkIsHideSlider()&&(e=0,n=Math.max(e,this.Length-1)),this.turnOfResizeForOneSetValue=!0,this.slider.setValues(0,this.Length,e,n)}}onPropertyChanged(t){switch(super.onPropertyChanged(t),t.name){case m.sequenceColumnName:case m.startPositionName:case m.endPositionName:case m.filterSource:this.updateSeqCol();break;case m.positionWidth:this._positionWidth=this.positionWidth,this.updateSlider();break;case m.fixWidth:case m.fitArea:case m.positionMargin:this.updateSlider();break;case m.shrinkEmptyTail:case m.skipEmptyPositions:this.updatePositions()}this.render(!0)}onTableAttached(){super.onTableAttached();const t=this.dataFrame?"data":"null";console.debug(`Bio: WebLogoViewer<${this.viewerId}>.onTableAttached( dataFrame = ${t} ) start`),this.updateSeqCol(),void 0!==this.dataFrame&&(this.viewSubs.push(this.dataFrame.filter.onChanged.subscribe(this.dataFrameFilterOnChanged.bind(this))),this.viewSubs.push(this.dataFrame.selection.onChanged.subscribe(this.dataFrameSelectionOnChanged.bind(this)))),this.init(),console.debug(`Bio: WebLogoViewer<${this.viewerId}>.onTableAttached() end`)}detach(){const t=Object.create(null,{detach:{get:()=>super.detach}});return e=this,n=void 0,s=function*(){const e=this.dataFrame?"data":"null";console.debug(`Bio: WebLogoViewer<${this.viewerId}>.onTableAttached( dataFrame = ${e} ) start`),t.detach.call(this),this.viewSubs.forEach((t=>t.unsubscribe())),this.host.remove(),this.msgHost=void 0,this.host=void 0,this.initialized=!1,console.debug(`Bio: WebLogoViewer<${this.viewerId}>.onTableAttached() end`)},new((i=void 0)||(i=Promise))((function(t,o){function r(t){try{l(s.next(t))}catch(t){o(t)}}function a(t){try{l(s.throw(t))}catch(t){o(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i((function(t){t(n)}))).then(r,a)}l((s=s.apply(e,n||[])).next())}));var e,n,i,s}getMonomer(t){const e=t.x+this.firstVisibleIndex*this.positionWidthWithMargin,n=Math.floor(t.x/this.positionWidthWithMargin+this.firstVisibleIndex),i=this.positions[n];if(null==i)return[n,null,null];const s=Object.keys(i.freq).find((n=>i.freq[n].bounds.contains(e,t.y)));return void 0===s?[n,null,null]:[n,s,i.freq[s]]}_nullSequence(t="X"){return this.skipEmptySequences?"":new Array(this.Length).fill(t).join("")}removeWhere(t,e){const n=t.length;let i=0;for(let s=0;s<n;s++)e(t[s])||(t[i]=t[s],i++);return t.length=i,t}_removeEmptyPositions(){this.skipEmptyPositions&&this.removeWhere(this.positions,(t=>{var e;return(null===(e=null==t?void 0:t.freq["-"])||void 0===e?void 0:e.count)===t.rowCount}))}_calculate(t){if(!this.host||!this.seqCol||!this.dataFrame)return;this.unitsHandler=new h.C(this.seqCol),this.calcSize();const e=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.positions=new Array(e);for(let t=0;t<this.Length;t++){const e=this.positionNames[this.startPosition+t];this.positions[t]=new g(this.startPosition+t,e)}const n=this.filter.getSelectedIndexes();this.rowsMasked=n.length,this.rowsNull=0;for(const t of n){let e=this.seqCol.get(t);e||(e=this._nullSequence(),++this.rowsNull);const n=this.splitter(e);for(let t=0;t<this.Length;t++){const e=this.positions[t].freq,i=n[this.startPosition+t]||"-";i in e||(e[i]=new p),e[i].count++}}for(let t=0;t<this.Length;t++){this.positions[t].rowCount=0;for(const e in this.positions[t].freq)this.positions[t].rowCount+=this.positions[t].freq[e].count;if(this.positionHeight==u.ES.Entropy){this.positions[t].sumForHeightCalc=0;for(const e in this.positions[t].freq){const n=this.positions[t].freq[e].count/this.positions[t].rowCount;this.positions[t].sumForHeightCalc+=-n*Math.log2(n)}}}this._removeEmptyPositions();const s=this.canvas.height-this.axisHeight*t;for(let e=0;e<this.Length;e++){const n=this.positions[e].freq,r=this.positions[e].rowCount,a=this.getAlphabetSize();this.positionHeight==u.ES.Entropy&&null==a&&i.shell.error("WebLogo: alphabet is undefined.");const l=Math.log2(a),h=this.positionHeight==u.ES.Entropy?s*(l-this.positions[e].sumForHeightCalc)/l:s;let c=this.axisHeight*t+(s-h-1);const d=Object.entries(n).sort(((t,e)=>"-"!==t[0]&&"-"!==e[0]?e[1].count-t[1].count:"-"===t[0]&&"-"===e[0]?0:"-"===t[0]?-1:1));for(const t of d){const n=t[1],i=h*n.count/r;n.bounds=new o.Rect(e*this.positionWidthWithMargin,c,this._positionWidth,i),c+=i}}}render(t=!0){var e;if(this.msgHost&&(this.seqCol&&!this.cp?(this.msgHost.innerText=`Unknown palette (column semType: '${this.seqCol.semType}').`,this.msgHost.style.display=""):this.msgHost.style.display="none"),!this.seqCol||!this.dataFrame||!this.cp||-1===this.startPosition||-1===this.endPosition||null==this.host||null==this.slider)return;const n=this.canvas.getContext("2d");if(!n)return;this.slider.root.style.width=`${this.host.clientWidth}px`;const i=window.devicePixelRatio;t&&this._calculate(i),n.resetTransform(),n.fillStyle=o.Color.toHtml(this.backgroundColor),n.fillRect(0,0,this.canvas.width,this.canvas.height),n.textBaseline=this.textBaseline;const s=this.countOfRenderPositions+1,r=this.visibleSlider?Math.floor(this.slider.min):0,a=Math.min(this.Length,r+s),l=10*i;n.resetTransform(),n.fillStyle="black",n.textAlign="center",n.font=`${l.toFixed(1)}px Roboto, Roboto Local, sans-serif`;const h=Math.max(...this.positions.map((t=>n.measureText(t.name).width))),u=h<this._positionWidth-2?1:(this._positionWidth-2)/h;for(let t=this.firstVisibleIndex;t<a;t++){const e=this.positions[t];n.resetTransform(),n.setTransform(u,0,0,1,t*this.positionWidthWithMargin+this._positionWidth/2-this.positionWidthWithMargin*r,0),n.fillText(e.name,0,0)}for(let t=this.firstVisibleIndex;t<a;t++)for(const[i,s]of Object.entries(this.positions[t].freq))if("-"!==i){const t=(0,c.GU)(i,5),o=s.bounds,r=o.left-this.positionWidthWithMargin*this.firstVisibleIndex;n.resetTransform(),n.strokeStyle="lightgray",n.lineWidth=1,n.rect(r,o.top,o.width,o.height),n.fillStyle=null!==(e=this.cp.get(i))&&void 0!==e?e:this.cp.get("other"),n.textAlign="left",n.font="16px Roboto, Roboto Local, sans-serif";const a=n.measureText(t);n.setTransform(o.width/a.width,0,0,o.height/12.2,r,o.top),n.fillText(t,0,-.25)}}calcSize(){if(!this.host)return;const t=window.devicePixelRatio;let e=this.widthArea,n=this.heightArea;if(this.fitArea&&!this.visibleSlider){const t=Math.max(1,Math.min(this.xScale,this.yScale));e*=t,n*=t,this._positionWidth=this.positionWidth*t}e=this.Length*this.positionWidthWithMargin/t,this.canvas.width=this.root.clientWidth*t,this.canvas.style.width=`${this.root.clientWidth}px`,this.host.style.setProperty("height",`${n}px`);const i=this.host.clientHeight;if(this.canvas.height=i*t,this.fixWidth)this.root.style.width=this.host.style.width=`${e}px`,this.root.style.height=`${n}px`,this.root.style.overflow="hidden",this.host.style.setProperty("overflow-y","hidden","important");else{this.root.style.width=this.host.style.width="100%",this.host.style.overflowX="auto!important",this.host.style.setProperty("text-align",this.horizontalAlignment);const t=this.visibleSlider?10:0;let s=0;switch(this.verticalAlignment){case"top":s=0;break;case"middle":s=Math.max(0,(this.root.clientHeight-n)/2);break;case"bottom":s=Math.max(0,this.root.clientHeight-n-t)}let o=0;switch(this.horizontalAlignment){case"left":o=0;break;case"center":o=Math.max(0,(this.root.clientWidth-e)/2);break;case"right":o=Math.max(0,this.root.clientWidth-e)}this.host.style.setProperty("margin-top",`${s}px`,"important"),this.host.style.setProperty("margin-left",`${o}px`,"important"),null!=this.slider&&this.slider.root.style.setProperty("margin-top",`${s+i}px`,"important"),this.root.clientHeight<=n?(this.host.style.setProperty("height",`${this.root.clientHeight}px`),this.host.style.setProperty("overflow-y",null)):this.host.style.setProperty("overflow-y","hidden","important")}}getAlphabetSize(){var t,e;return null!==(e=null===(t=this.unitsHandler)||void 0===t?void 0:t.getAlphabetSize())&&void 0!==e?e:0}sliderOnValuesChanged(t){if(null!=this.host)try{if(this.allowResize&&!this.turnOfResizeForOneSetValue&&this.visibleSlider){const t=Math.ceil(this.slider.max-this.slider.min),e=this.canvas.width/t-this.positionMarginValue;this.positionWidth=e,this._positionWidth=e}this.turnOfResizeForOneSetValue=!1,this.render(!0)}catch(t){const e=d(t);console.error("Bio: WebLogoViewer.sliderOnValuesChanged() error:\n"+e)}}dataFrameFilterOnChanged(t){console.debug("Bio: WebLogoViewer.dataFrameFilterChanged()");try{this.updatePositions(),this.render()}catch(t){const e=d(t);console.error("Bio: WebLogoViewer.dataFrameFilterOnChanged() error:\n"+e)}}dataFrameSelectionOnChanged(t){console.debug("Bio: WebLogoViewer.dataFrameSelectionOnChanged()");try{this.render()}catch(t){const e=d(t);console.error("Bio: WebLogoViewer.dataFrameSelectionOnChanged() error:\n"+e)}}canvasOnMouseMove(t){try{const e=t,n=window.devicePixelRatio,i=this.canvas.getCursorPosition(e,n),[o,r]=this.getMonomer(i);if(this.dataFrame&&this.seqCol&&this.splitter&&r){const t=this.positions[o],n=function(t,e,n,i,s,o){return a().count(0).take(t.rowCount).filter((t=>n.get(t))).map((t=>{const n=e.get(t),s=n?i(n):[],r=o.pos;return r<s.length?s[r]:null})).toArray().filter((t=>t==s)).reduce(((t,e)=>t+1),0)}(this.dataFrame,this.seqCol,this.filter,this.splitter,r,t),i=s.div([s.div(`${r}`),s.div(`${n} rows`)]);s.tooltip.show(i,e.x+16,e.y+16)}else s.tooltip.hide()}catch(t){const e=d(t);console.error("Bio: WebLogoViewer.canvasOnMouseMove() error:\n"+e)}}canvasOnMouseDown(t){try{const e=t,n=window.devicePixelRatio,[i,s]=this.getMonomer(this.canvas.getCursorPosition(e,n));if(this.dataFrame&&this.seqCol&&this.splitter&&s){const t=this.positions[i],e=o.BitSet.create(this.dataFrame.selection.length,(e=>function(t,e,n,i,s,o,r){if(!n.getSelectedIndexes().includes(i))return!1;const a=e.get(i),l=a?s(a)[r.pos]:null;return l===o||""===l&&"-"===o}(this.dataFrame,this.seqCol,this.filter,e,this.splitter,s,t)));this.dataFrame.selection.init((t=>e.get(t)))}}catch(t){const e=d(t);console.error("Bio: WebLogoViewer.canvasOnMouseDown() error:\n"+e)}}canvasOnWheel(t){try{if(!this.visibleSlider)return;const e=t.deltaY/100*Math.max(Math.floor(this.countOfRenderPositions/2),1);this.slider.scrollBy(this.slider.min+e)}catch(t){const e=d(t);console.error("Bio: WebLogoViewer.canvasOnWheel() error:\n"+e)}}}y.residuesSet="nucleotides",y.viewerCount=-1},4413:(t,e,n)=>{"use strict";n.d(e,{ST:()=>m});var i=n(3870),s=n(976),o=n(4469),r=n(6414),a=n.n(r),l=n(7983),h=n(701),c=n(4293),u=n(1061);const d=rxjs.operators;var f=function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,a)}l((i=i.apply(t,e||[])).next())}))};class m extends s.Filter{get calculating(){return"initial"==this.loader.style.display}set calculating(t){this.loader.style.display=t?"initial":"none"}get filterSummary(){return this.bioFilter.substructure}get isFiltering(){return super.isFiltering&&""!==this.bioFilter.substructure}get isReadyToApplyFilter(){return!this.calculating&&null!=this.bitset}get _debounceTime(){if(null==this.column)return 1e3;const t=this.column.length;return t<500?0:t>1e4?1e3:Math.floor((t-500)/9500*1e3)}constructor(){super(),this.bioFilter=null,this.bitset=null,this.loader=i.loader(),this.notation=void 0,this.root=i.divV([]),this.calculating=!1}attach(t){var e,n,i,o,r;super.attach(t),this.column=t.columns.bySemType(s.SEMTYPE.MACROMOLECULE),null!==(e=this.columnName)&&void 0!==e||(this.columnName=null===(n=this.column)||void 0===n?void 0:n.name),null!==(i=this.notation)&&void 0!==i||(this.notation=null===(o=this.column)||void 0===o?void 0:o.getTag(s.TAGS.UNITS)),this.bioFilter="fasta"===this.notation?new g:"separator"===this.notation?new v(this.column.getTag("separator")):new y,this.root.appendChild(this.bioFilter.filterPanel),this.root.appendChild(this.loader),null===(r=this.onBioFilterChangedSubs)||void 0===r||r.unsubscribe();let a=this.bioFilter.onChanged;a=a.pipe((0,d.debounceTime)(this._debounceTime)),this.onBioFilterChangedSubs=a.subscribe((t=>f(this,void 0,void 0,(function*(){return yield this._onInputChanged()}))))}detach(){super.detach()}applyFilter(){var t;this.bitset&&!this.isDetached&&(null===(t=this.dataFrame)||void 0===t||t.filter.and(this.bitset))}saveState(){var t;const e=super.saveState();return e.bioSubstructure=null===(t=this.bioFilter)||void 0===t?void 0:t.substructure,e}applyState(t){super.applyState(t),t.bioSubstructure&&(this.bioFilter.substructure=t.bioSubstructure);const e=this;t.bioSubstructure&&setTimeout((function(){e._onInputChanged()}),1e3)}_onInputChanged(){var t,e,n;return f(this,void 0,void 0,(function*(){if(this.isFiltering){if(a()(this.dataFrame.rows.filters).has(`${this.columnName}: ${this.filterSummary}`))return;this.calculating=!0;try{this.bitset=yield null===(e=this.bioFilter)||void 0===e?void 0:e.substrucrureSearch(this.column),this.calculating=!1,null===(n=this.dataFrame)||void 0===n||n.rows.requestFilter()}finally{this.calculating=!1}}else this.bitset=null,null===(t=this.dataFrame)||void 0===t||t.rows.requestFilter()}))}}class p{constructor(){this.onChanged=new h.Subject}get filterPanel(){return new HTMLElement}get substructure(){return""}set substructure(t){}substrucrureSearch(t){return f(this,void 0,void 0,(function*(){return null}))}}class g extends p{constructor(){super(),this.substructureInput=i.stringInput("","",(()=>{this.onChanged.next()}),{placeholder:"Substructure"})}get filterPanel(){return this.substructureInput.root}get substructure(){return this.substructureInput.value}set substructure(t){this.substructureInput.value=t}substrucrureSearch(t){return f(this,void 0,void 0,(function*(){return yield(0,l.pf)(this.substructure,t)}))}}class v extends g{constructor(t){super(),this.colSeparator="",this.separatorInput=i.stringInput("","",(()=>{this.onChanged.next()}),{placeholder:"Separator"}),this.colSeparator=t,this.separatorInput.value=t}get filterPanel(){return i.divV([this.substructureInput.root,this.separatorInput.root])}get substructure(){return this.separatorInput.value&&this.separatorInput.value!==this.colSeparator?this.substructureInput.value.replaceAll(this.separatorInput.value,this.colSeparator):this.substructureInput.value}set substructure(t){this.substructureInput.value=t}substrucrureSearch(t){return f(this,void 0,void 0,(function*(){return yield(0,l.pf)(this.substructure,t,this.colSeparator)}))}}class y extends p{constructor(){super(),this._filterPanel=i.div("",{style:{cursor:"pointer"}}),this.helmSubstructure="",this.init()}init(){return f(this,void 0,void 0,(function*(){this.helmEditor=yield o.functions.call("HELM:helmWebEditor"),yield i.tools.waitForElementInDom(this._filterPanel),this.updateFilterPanel(),this._filterPanel.addEventListener("click",(t=>{const{editorDiv:e,webEditor:n}=this.helmEditor.createWebEditor(this.helmSubstructure);i.dialog({showHeader:!1,showFooter:!0}).add(e).onOK((()=>{const t=n.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.helmSubstructure=t,this.updateFilterPanel(this.substructure),setTimeout((()=>{this.onChanged.next()}),10)})).show({modal:!0,fullScreen:!0})})),i.onSizeChanged(this._filterPanel).subscribe((t=>{const e=this.helmEditor.webEditor.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.updateFilterPanel(e)}))}))}get filterPanel(){return this._filterPanel}get substructure(){return this.helmSubstructure}set substructure(t){this.helmEditor.editor.setHelm(t)}updateFilterPanel(t){const e=this._filterPanel.parentElement.clientWidth<100?100:this._filterPanel.parentElement.clientWidth,n=e/2;if(t)(0,c.Y)(this._filterPanel,this.helmEditor.host),this.helmEditor.editor.setHelm(t),this.helmEditor.resizeEditor(e,n);else{const t=i.divText("Click to edit","helm-substructure-filter");(0,c.Y)(this._filterPanel,t)}}substrucrureSearch(t){return f(this,void 0,void 0,(function*(){i.setUpdateIndicator(this._filterPanel,!0),yield(0,u.gw)(10);const e=yield(0,l.QF)(this.substructure,t);return i.setUpdateIndicator(this._filterPanel,!1),e}))}}},9378:function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var s=i(n(4517));function o(t,e){var n=function(n){return s.empty(t).map((function(){return s.filled(e,n)}))},i=[];return i.push(n(-1)),i.push(n(1/0)),i.push(n(0)),i}function r(t,e,n,i,s){e=Math.floor(e);var o=t[0][e],r=t[1][e];if(t[2][e],n>=r[0])return 0;for(var l=0;l<o.length;l++)if(i===o[l])return 0;return a(t,e,n,i,s)}function a(t,e,n,i,s){var o=t[0][e],r=t[1][e],a=t[2][e];if(n>=r[0])return 0;r[0]=n,o[0]=i,a[0]=s;for(var l=0,h=0;;){var c=2*l+1,u=c+1,d=t[0][0].length;if(c>=d)break;if(u>=d){if(!(r[c]>n))break;h=c}else if(r[c]>=r[u]){if(!(n<r[c]))break;h=c}else{if(!(n<r[u]))break;h=u}r[l]=r[h],o[l]=o[h],a[l]=a[h],l=h}return r[l]=n,o[l]=i,a[l]=s,1}function l(t,e,n,i){for(;2*i+1<n;){var s=2*i+1,o=s+1,r=i;if(t[r]<t[s]&&(r=s),o<n&&t[r]<t[o]&&(r=o),r===i)break;var a=t[i];t[i]=t[r],t[r]=a;var l=e[i];e[i]=e[r],e[r]=l,i=r}}e.makeHeap=o,e.rejectionSample=function(t,e,n){for(var i=s.zeros(t),o=0;o<t;o++){for(var r=!0,a=0;r;){a=s.tauRandInt(e,n);for(var l=!1,h=0;h<o;h++)if(a===i[h]){l=!0;break}l||(r=!1)}i[o]=a}return i},e.heapPush=r,e.uncheckedHeapPush=a,e.buildCandidates=function(t,e,n,i,a){for(var l=o(e,i),h=0;h<e;h++)for(var c=0;c<n;c++)if(!(t[0][h][c]<0)){var u=t[0][h][c],d=t[2][h][c],f=s.tauRand(a);r(l,h,f,u,d),r(l,u,f,h,d),t[2][h][c]=0}return l},e.deheapSort=function(t){for(var e=t[0],n=t[1],i=0;i<e.length;i++)for(var s=e[i],o=n[i],r=0;r<s.length-1;r++){var a=s.length-r-1,h=o.length-r-1,c=s[0];s[0]=s[a],s[a]=c;var u=o[0];o[0]=o[h],o[h]=u,l(o,s,h,0)}return{indices:e,weights:n}},e.smallestFlagged=function(t,e){for(var n=t[0][e],i=t[1][e],s=t[2][e],o=1/0,r=-1,a=0;a>n.length;a++)1===s[a]&&i[a]<o&&(o=i[a],r=a);return r>=0?(s[r]=0,Math.floor(n[r])):-1}},4221:(t,e,n)=>{"use strict";var i=n(4364);e.u=i.UMAP},5686:function(t,e,n){"use strict";var i,s=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,s,o=n.call(t),r=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)r.push(i.value)}catch(t){s={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(s)throw s.error}}return r},o=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}},r=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var a=r(n(4517)),l=function(){function t(t,e,n,i){if(this.entries=new Map,this.nRows=0,this.nCols=0,t.length!==e.length||t.length!==n.length)throw new Error("rows, cols and values arrays must all have the same length");this.nRows=i[0],this.nCols=i[1];for(var s=0;s<n.length;s++){var o=t[s],r=e[s];this.checkDims(o,r);var a=this.makeKey(o,r);this.entries.set(a,{value:n[s],row:o,col:r})}}return t.prototype.makeKey=function(t,e){return t+":"+e},t.prototype.checkDims=function(t,e){if(!(t<this.nRows&&e<this.nCols))throw new Error("row and/or col specified outside of matrix dimensions")},t.prototype.set=function(t,e,n){this.checkDims(t,e);var i=this.makeKey(t,e);this.entries.has(i)?this.entries.get(i).value=n:this.entries.set(i,{value:n,row:t,col:e})},t.prototype.get=function(t,e,n){void 0===n&&(n=0),this.checkDims(t,e);var i=this.makeKey(t,e);return this.entries.has(i)?this.entries.get(i).value:n},t.prototype.getAll=function(t){void 0===t&&(t=!0);var e=[];return this.entries.forEach((function(t){e.push(t)})),t&&e.sort((function(t,e){return t.row===e.row?t.col-e.col:t.row-e.row})),e},t.prototype.getDims=function(){return[this.nRows,this.nCols]},t.prototype.getRows=function(){return Array.from(this.entries,(function(t){var e=s(t,2);return e[0],e[1].row}))},t.prototype.getCols=function(){return Array.from(this.entries,(function(t){var e=s(t,2);return e[0],e[1].col}))},t.prototype.getValues=function(){return Array.from(this.entries,(function(t){var e=s(t,2);return e[0],e[1].value}))},t.prototype.forEach=function(t){this.entries.forEach((function(e){return t(e.value,e.row,e.col)}))},t.prototype.map=function(e){var n=[];this.entries.forEach((function(t){n.push(e(t.value,t.row,t.col))}));var i=[this.nRows,this.nCols];return new t(this.getRows(),this.getCols(),n,i)},t.prototype.toArray=function(){var t=this,e=a.empty(this.nRows).map((function(){return a.zeros(t.nCols)}));return this.entries.forEach((function(t){e[t.row][t.col]=t.value})),e},t}();e.SparseMatrix=l,e.transpose=function(t){var e=[],n=[],i=[];t.forEach((function(t,s,o){e.push(s),n.push(o),i.push(t)}));var s=[t.nCols,t.nRows];return new l(n,e,i,s)},e.identity=function(t){for(var e=s(t,1)[0],n=new l([],[],[],t),i=0;i<e;i++)n.set(i,i,1);return n},e.pairwiseMultiply=function(t,e){return c(t,e,(function(t,e){return t*e}))},e.add=function(t,e){return c(t,e,(function(t,e){return t+e}))},e.subtract=function(t,e){return c(t,e,(function(t,e){return t-e}))},e.maximum=function(t,e){return c(t,e,(function(t,e){return t>e?t:e}))},e.multiplyScalar=function(t,e){return t.map((function(t){return t*e}))},e.eliminateZeros=function(t){for(var e=new Set,n=t.getValues(),i=t.getRows(),s=t.getCols(),o=0;o<n.length;o++)0===n[o]&&e.add(o);var r=function(t,n){return!e.has(n)},a=n.filter(r),h=i.filter(r),c=s.filter(r);return new l(h,c,a,t.getDims())},e.normalize=function(t,e){var n,i;void 0===e&&(e="l2");var s=h[e],r=new Map;t.forEach((function(t,e,n){var i=r.get(e)||[];i.push(n),r.set(e,i)}));var a=new l([],[],[],t.getDims()),c=function(e){for(var n=r.get(e).sort(),i=n.map((function(n){return t.get(e,n)})),o=s(i),l=0;l<o.length;l++)a.set(e,n[l],o[l])};try{for(var u=o(r.keys()),d=u.next();!d.done;d=u.next())c(d.value)}catch(t){n={error:t}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}return a};var h=((i={}).max=function(t){for(var e=-1/0,n=0;n<t.length;n++)e=t[n]>e?t[n]:e;return t.map((function(t){return t/e}))},i.l1=function(t){for(var e=0,n=0;n<t.length;n++)e+=t[n];return t.map((function(t){return t/e}))},i.l2=function(t){for(var e=0,n=0;n<t.length;n++)e+=Math.pow(t[n],2);return t.map((function(t){return Math.sqrt(Math.pow(t,2)/e)}))},i);function c(t,e,n){for(var i=new Set,s=[],o=[],r=[],a=function(i,a){s.push(i),o.push(a);var l=n(t.get(i,a),e.get(i,a));r.push(l)},h=t.getValues(),c=t.getRows(),u=t.getCols(),d=0;d<h.length;d++){var f=(v=c[d])+":"+(y=u[d]);i.add(f),a(v,y)}var m=e.getValues(),p=e.getRows(),g=e.getCols();for(d=0;d<m.length;d++){var v,y;f=(v=p[d])+":"+(y=g[d]),i.has(f)||a(v,y)}var b=[t.nRows,t.nCols];return new l(s,o,r,b)}e.getCSR=function(t){var e=[];t.forEach((function(t,n,i){e.push({value:t,row:n,col:i})})),e.sort((function(t,e){return t.row===e.row?t.col-e.col:t.row-e.row}));for(var n=[],i=[],s=[],o=-1,r=0;r<e.length;r++){var a=e[r],l=a.row,h=a.col,c=a.value;l!==o&&(o=l,s.push(r)),n.push(h),i.push(c)}return{indices:n,values:i,indptr:s}}},760:function(t,e,n){"use strict";var i=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}},s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var o=s(n(9378)),r=s(n(5686)),a=s(n(2320)),l=s(n(4517));e.makeNNDescent=function(t,e){return function(n,i,s,r,a,h,c,u){void 0===r&&(r=10),void 0===a&&(a=50),void 0===h&&(h=.001),void 0===c&&(c=.5),void 0===u&&(u=!0);for(var d=n.length,f=o.makeHeap(n.length,s),m=0;m<n.length;m++)for(var p=o.rejectionSample(s,n.length,e),g=0;g<p.length;g++){var v=t(n[m],n[p[g]]);o.heapPush(f,m,v,p[g],1),o.heapPush(f,p[g],v,m,1)}if(u)for(var y=0;y<i.length;y++)for(m=0;m<i[y].length&&!(i[y][m]<0);m++)for(g=m+1;g<i[y].length&&!(i[y][g]<0);g++)v=t(n[i[y][m]],n[i[y][g]]),o.heapPush(f,i[y][m],v,i[y][g],1),o.heapPush(f,i[y][g],v,i[y][m],1);for(y=0;y<r;y++){var b=o.buildCandidates(f,d,s,a,e),w=0;for(m=0;m<d;m++)for(g=0;g<a;g++){var C=Math.floor(b[0][m][g]);if(!(C<0||l.tauRand(e)<c))for(var S=0;S<a;S++){var M=Math.floor(b[0][m][S]),x=b[2][m][g],T=b[2][m][S];M<0||!x&&!T||(v=t(n[C],n[M]),w+=o.heapPush(f,C,v,M,1),w+=o.heapPush(f,M,v,C,1))}}if(w<=h*s*n.length)break}return o.deheapSort(f)}},e.makeInitializations=function(t){return{initFromRandom:function(e,n,i,s,r){for(var a=0;a<i.length;a++)for(var h=l.rejectionSample(e,n.length,r),c=0;c<h.length;c++)if(!(h[c]<0)){var u=t(n[h[c]],i[a]);o.heapPush(s,a,u,h[c],1)}},initFromTree:function(e,n,i,s,r){for(var l=0;l<i.length;l++)for(var h=a.searchFlatTree(i[l],e,r),c=0;c<h.length;c++){if(h[c]<0)return;var u=t(n[h[c]],i[l]);o.heapPush(s,l,u,h[c],1)}}}},e.makeInitializedNNSearch=function(t){return function(e,n,s,a){for(var l,h,c=r.getCSR(n),u=c.indices,d=c.indptr,f=0;f<a.length;f++)for(var m=new Set(s[0][f]);;){var p=o.smallestFlagged(s,f);if(-1===p)break;var g=u.slice(d[p],d[p+1]);try{for(var v=i(g),y=v.next();!y.done;y=v.next()){var b=y.value;if(b!==p&&-1!==b&&!m.has(b)){var w=t(e[b],a[f]);o.uncheckedHeapPush(s,f,w,b,1),m.add(b)}}}catch(t){l={error:t}}finally{try{y&&!y.done&&(h=v.return)&&h.call(v)}finally{if(l)throw l.error}}}return s}},e.initializeSearch=function(t,e,n,s,r,a,l){var h,c,u=o.makeHeap(n.length,s);if(r(s,e,n,u,l),t)try{for(var d=i(t),f=d.next();!f.done;f=d.next())a(f.value,e,n,u,l)}catch(t){h={error:t}}finally{try{f&&!f.done&&(c=d.return)&&c.call(d)}finally{if(h)throw h.error}}return u}},2320:function(t,e,n){"use strict";var i=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,s,o=n.call(t),r=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)r.push(i.value)}catch(t){s={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(s)throw s.error}}return r},s=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(i(arguments[e]));return t},o=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}},r=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var a=r(n(4517)),l=function(t,e,n,i){this.hyperplanes=t,this.offsets=e,this.children=n,this.indices=i};function h(t,e,n,i,s){if(void 0===n&&(n=30),e.length>n){var o=function(t,e,n){var i=t[0].length,s=a.tauRandInt(e.length,n),o=a.tauRandInt(e.length,n);o=(o+=s===o?1:0)%e.length;for(var r=e[s],l=e[o],h=0,c=a.zeros(i),u=0;u<c.length;u++)c[u]=t[r][u]-t[l][u],h-=c[u]*(t[r][u]+t[l][u])/2;var d=0,f=0,m=a.zeros(e.length);for(u=0;u<e.length;u++){for(var p=h,g=0;g<i;g++)p+=c[g]*t[e[u]][g];0===p?(m[u]=a.tauRandInt(2,n),0===m[u]?d+=1:f+=1):p>0?(m[u]=0,d+=1):(m[u]=1,f+=1)}var v=a.zeros(d),y=a.zeros(f);for(d=0,f=0,u=0;u<m.length;u++)0===m[u]?(v[d]=e[u],d+=1):(y[f]=e[u],f+=1);return{indicesLeft:v,indicesRight:y,hyperplane:c,offset:h}}(t,e,s),r=o.indicesLeft,l=o.indicesRight,c=o.hyperplane,u=o.offset;return{leftChild:h(t,r,n,i+1,s),rightChild:h(t,l,n,i+1,s),isLeaf:!1,hyperplane:c,offset:u}}return{indices:e,isLeaf:!0}}function c(t,e,n,i,o,r,a){var l;if(t.isLeaf)return i[r][0]=-a,(l=o[a]).splice.apply(l,s([0,t.indices.length],t.indices)),{nodeNum:r,leafNum:a+=1};e[r]=t.hyperplane,n[r]=t.offset,i[r][0]=r+1;var h=r,u=c(t.leftChild,e,n,i,o,r+1,a);return r=u.nodeNum,a=u.leafNum,i[h][1]=r+1,{nodeNum:(u=c(t.rightChild,e,n,i,o,r+1,a)).nodeNum,leafNum:u.leafNum}}function u(t){return t.isLeaf?1:1+u(t.leftChild)+u(t.rightChild)}function d(t){return t.isLeaf?1:d(t.leftChild)+d(t.rightChild)}function f(t,e,n,i){for(var s=e,o=0;o<n.length;o++)s+=t[o]*n[o];return 0===s?a.tauRandInt(2,i):s>0?0:1}e.FlatTree=l,e.makeForest=function(t,e,n,i){var s=Math.max(10,e);return a.range(n).map((function(e,n){return function(t,e,n,i){return void 0===e&&(e=30),h(t,a.range(t.length),e,n,i)}(t,s,n,i)})).map((function(t){return function(t,e){var n=u(t),i=d(t),s=a.range(n).map((function(){return a.zeros(t.hyperplane?t.hyperplane.length:0)})),o=a.zeros(n),r=a.range(n).map((function(){return[-1,-1]})),h=a.range(i).map((function(){return a.range(e).map((function(){return-1}))}));return c(t,s,o,r,h,0,0),new l(s,o,r,h)}(t,s)}))},e.makeLeafArray=function(t){var e,n;if(t.length>0){var i=[];try{for(var r=o(t),a=r.next();!a.done;a=r.next()){var l=a.value;i.push.apply(i,s(l.indices))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return i}return[[-1]]},e.searchFlatTree=function(t,e,n){for(var i=0;e.children[i][0]>0;)i=0===f(e.hyperplanes[i],e.offsets[i],t,n)?e.children[i][0]:e.children[i][1];var s=-1*e.children[i][0];return e.indices[s]}},4364:function(t,e,n){"use strict";var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(s,o){function r(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){t.done?s(t.value):new n((function(e){e(t.value)})).then(r,a)}l((i=i.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var n,i,s,o,r={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=2&o[0]?i.return:o[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,o[1])).done)return s;switch(i=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,i=o[1],o=[0];continue;case 7:o=r.ops.pop(),r.trys.pop();continue;default:if(!((s=(s=r.trys).length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){r=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){r.label=o[1];break}if(6===o[0]&&r.label<s[1]){r.label=s[1],s=o;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(o);break}s[2]&&r.ops.pop(),r.trys.pop();continue}o=e.call(t,r)}catch(t){o=[6,t],i=0}finally{n=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},o=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,s,o=n.call(t),r=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)r.push(i.value)}catch(t){s={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(s)throw s.error}}return r},r=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(o(arguments[e]));return t},a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e},l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var h=a(n(9378)),c=a(n(5686)),u=a(n(760)),d=a(n(2320)),f=a(n(4517)),m=l(n(9251)),p=1e-5,g=.001,v=function(){function t(t){void 0===t&&(t={});var e=this;this.learningRate=1,this.localConnectivity=1,this.minDist=.1,this.nComponents=2,this.nEpochs=0,this.nNeighbors=15,this.negativeSampleRate=5,this.random=Math.random,this.repulsionStrength=1,this.setOpMixRatio=1,this.spread=1,this.transformQueueSize=4,this.targetMetric="categorical",this.targetWeight=.5,this.targetNNeighbors=this.nNeighbors,this.distanceFn=y,this.isInitialized=!1,this.rpForest=[],this.embedding=[],this.optimizationState=new b;var n=function(n){void 0!==t[n]&&(e[n]=t[n])};n("distanceFn"),n("learningRate"),n("localConnectivity"),n("minDist"),n("nComponents"),n("nEpochs"),n("nNeighbors"),n("negativeSampleRate"),n("random"),n("repulsionStrength"),n("setOpMixRatio"),n("spread"),n("transformQueueSize")}return t.prototype.fit=function(t){return this.initializeFit(t),this.optimizeLayout(),this.embedding},t.prototype.fitAsync=function(t,e){return void 0===e&&(e=function(){return!0}),i(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return this.initializeFit(t),[4,this.optimizeLayoutAsync(e)];case 1:return n.sent(),[2,this.embedding]}}))}))},t.prototype.setSupervisedProjection=function(t,e){void 0===e&&(e={}),this.Y=t,this.targetMetric=e.targetMetric||this.targetMetric,this.targetWeight=e.targetWeight||this.targetWeight,this.targetNNeighbors=e.targetNNeighbors||this.targetNNeighbors},t.prototype.setPrecomputedKNN=function(t,e){this.knnIndices=t,this.knnDistances=e},t.prototype.initializeFit=function(t){if(t.length<=this.nNeighbors)throw new Error("Not enough data points ("+t.length+") to create nNeighbors: "+this.nNeighbors+". Add more data points or adjust the configuration.");if(this.X===t&&this.isInitialized)return this.getNEpochs();if(this.X=t,!this.knnIndices&&!this.knnDistances){var e=this.nearestNeighbors(t);this.knnIndices=e.knnIndices,this.knnDistances=e.knnDistances}this.graph=this.fuzzySimplicialSet(t,this.nNeighbors,this.setOpMixRatio),this.makeSearchFns(),this.searchGraph=this.makeSearchGraph(t),this.processGraphForSupervisedProjection();var n=this.initializeSimplicialSetEmbedding(),i=n.head,s=n.tail,o=n.epochsPerSample;return this.optimizationState.head=i,this.optimizationState.tail=s,this.optimizationState.epochsPerSample=o,this.initializeOptimization(),this.prepareForOptimizationLoop(),this.isInitialized=!0,this.getNEpochs()},t.prototype.makeSearchFns=function(){var t=u.makeInitializations(this.distanceFn),e=t.initFromTree,n=t.initFromRandom;this.initFromTree=e,this.initFromRandom=n,this.search=u.makeInitializedNNSearch(this.distanceFn)},t.prototype.makeSearchGraph=function(t){for(var e=this.knnIndices,n=this.knnDistances,i=[t.length,t.length],s=new c.SparseMatrix([],[],[],i),o=0;o<e.length;o++)for(var r=e[o],a=n[o],l=0;l<r.length;l++){var h=r[l],u=a[l];u>0&&s.set(o,h,u)}var d=c.transpose(s);return c.maximum(s,d)},t.prototype.transform=function(t){var e=this,n=this.X;if(void 0===n||0===n.length)throw new Error("No data has been fit.");var i=Math.floor(this.nNeighbors*this.transformQueueSize);i=Math.min(n.length,i);var s=u.initializeSearch(this.rpForest,n,t,i,this.initFromRandom,this.initFromTree,this.random),o=this.search(n,this.searchGraph,s,t),r=h.deheapSort(o),a=r.indices,l=r.weights;a=a.map((function(t){return t.slice(0,e.nNeighbors)})),l=l.map((function(t){return t.slice(0,e.nNeighbors)}));var d=Math.max(0,this.localConnectivity-1),m=this.smoothKNNDistance(l,this.nNeighbors,d),p=m.sigmas,g=m.rhos,v=this.computeMembershipStrengths(a,l,p,g),y=v.rows,b=v.cols,w=v.vals,C=[t.length,n.length],S=new c.SparseMatrix(y,b,w,C),M=c.normalize(S,"l1"),x=c.getCSR(M),N=t.length,E=T(f.reshape2d(x.indices,N,this.nNeighbors),f.reshape2d(x.values,N,this.nNeighbors),this.embedding),A=this.nEpochs?this.nEpochs/3:S.nRows<=1e4?100:30,I=S.getValues().reduce((function(t,e){return e>t?e:t}),0);S=S.map((function(t){return t<I/A?0:t})),S=c.eliminateZeros(S);var L=this.makeEpochsPerSample(S.getValues(),A),k=S.getRows(),R=S.getCols();return this.assignOptimizationStateParameters({headEmbedding:E,tailEmbedding:this.embedding,head:k,tail:R,currentEpoch:0,nEpochs:A,nVertices:S.getDims()[1],epochsPerSample:L}),this.prepareForOptimizationLoop(),this.optimizeLayout()},t.prototype.processGraphForSupervisedProjection=function(){var t=this.Y,e=this.X;if(t){if(t.length!==e.length)throw new Error("Length of X and y must be equal");if("categorical"===this.targetMetric){var n=this.targetWeight<1?1/(1-this.targetWeight)*2.5:1e12;this.graph=this.categoricalSimplicialSetIntersection(this.graph,t,n)}}},t.prototype.step=function(){var t=this.optimizationState.currentEpoch;return t<this.getNEpochs()&&this.optimizeLayoutStep(t),this.optimizationState.currentEpoch},t.prototype.getEmbedding=function(){return this.embedding},t.prototype.nearestNeighbors=function(t){var e,n=this.distanceFn,i=this.nNeighbors,s=u.makeNNDescent(n,this.random),o=5+Math.floor(.5==(e=Math.pow(t.length,.5)/20)?0:Math.round(e)),r=Math.max(5,Math.floor(Math.round(function(t){return Math.log(t)/Math.log(2)}(t.length))));this.rpForest=d.makeForest(t,i,o,this.random);var a=s(t,d.makeLeafArray(this.rpForest),i,r);return{knnIndices:a.indices,knnDistances:a.weights}},t.prototype.fuzzySimplicialSet=function(t,e,n){void 0===n&&(n=1);var i=this,s=i.knnIndices,o=void 0===s?[]:s,r=i.knnDistances,a=void 0===r?[]:r,l=i.localConnectivity,h=this.smoothKNNDistance(a,e,l),u=h.sigmas,d=h.rhos,f=this.computeMembershipStrengths(o,a,u,d),m=f.rows,p=f.cols,g=f.vals,v=[t.length,t.length],y=new c.SparseMatrix(m,p,g,v),b=c.transpose(y),w=c.pairwiseMultiply(y,b),C=c.subtract(c.add(y,b),w),S=c.multiplyScalar(C,n),M=c.multiplyScalar(w,1-n);return c.add(S,M)},t.prototype.categoricalSimplicialSetIntersection=function(t,e,n,i){void 0===i&&(i=1);var s=M(t,e,i,n);return x(s=c.eliminateZeros(s))},t.prototype.smoothKNNDistance=function(t,e,n,i,s){void 0===n&&(n=1),void 0===i&&(i=64),void 0===s&&(s=1);for(var o=Math.log(e)/Math.log(2)*s,r=f.zeros(t.length),a=f.zeros(t.length),l=0;l<t.length;l++){var h=0,c=1/0,u=1,d=t[l],m=d.filter((function(t){return t>0}));if(m.length>=n){var v=Math.floor(n),y=n-v;v>0?(r[l]=m[v-1],y>p&&(r[l]+=y*(m[v]-m[v-1]))):r[l]=y*m[0]}else m.length>0&&(r[l]=f.max(m));for(var b=0;b<i;b++){for(var w=0,C=1;C<t[l].length;C++){var S=t[l][C]-r[l];w+=S>0?Math.exp(-S/u):1}if(Math.abs(w-o)<p)break;w>o?u=(h+(c=u))/2:(h=u,c===1/0?u*=2:u=(h+c)/2)}if(a[l]=u,r[l]>0){var M=f.mean(d);a[l]<g*M&&(a[l]=g*M)}else{var x=f.mean(t.map(f.mean));a[l]<g*x&&(a[l]=g*x)}}return{sigmas:a,rhos:r}},t.prototype.computeMembershipStrengths=function(t,e,n,i){for(var s=t.length,o=t[0].length,r=f.zeros(s*o),a=f.zeros(s*o),l=f.zeros(s*o),h=0;h<s;h++)for(var c=0;c<o;c++){var u=0;-1!==t[h][c]&&(u=t[h][c]===h?0:e[h][c]-i[h]<=0?1:Math.exp(-(e[h][c]-i[h])/n[h]),r[h*o+c]=h,a[h*o+c]=t[h][c],l[h*o+c]=u)}return{rows:r,cols:a,vals:l}},t.prototype.initializeSimplicialSetEmbedding=function(){for(var t=this,e=this.getNEpochs(),n=this.nComponents,i=this.graph.getValues(),s=0,o=0;o<i.length;o++){var r=i[o];s<i[o]&&(s=r)}var a=this.graph.map((function(t){return t<s/e?0:t}));this.embedding=f.zeros(a.nRows).map((function(){return f.zeros(n).map((function(){return 20*f.tauRand(t.random)-10}))}));var l=[],h=[],c=[],u=a.getAll();for(o=0;o<u.length;o++){var d=u[o];d.value&&(l.push(d.value),c.push(d.row),h.push(d.col))}return{head:h,tail:c,epochsPerSample:this.makeEpochsPerSample(l,e)}},t.prototype.makeEpochsPerSample=function(t,e){var n=f.filled(t.length,-1),i=f.max(t),s=t.map((function(t){return t/i*e}));return s.forEach((function(t,i){t>0&&(n[i]=e/s[i])})),n},t.prototype.assignOptimizationStateParameters=function(t){Object.assign(this.optimizationState,t)},t.prototype.prepareForOptimizationLoop=function(){var t=this,e=t.repulsionStrength,n=t.learningRate,i=t.negativeSampleRate,s=this.optimizationState,o=s.epochsPerSample,a=s.headEmbedding,l=s.tailEmbedding,h=a[0].length,c=a.length===l.length,u=o.map((function(t){return t/i})),d=r(u),f=r(o);this.assignOptimizationStateParameters({epochOfNextSample:f,epochOfNextNegativeSample:d,epochsPerNegativeSample:u,moveOther:c,initialAlpha:n,alpha:n,gamma:e,dim:h})},t.prototype.initializeOptimization=function(){var t=this.embedding,e=this.embedding,n=this.optimizationState,i=n.head,s=n.tail,o=n.epochsPerSample,r=this.getNEpochs(),a=this.graph.nCols,l=S(this.spread,this.minDist),h=l.a,c=l.b;this.assignOptimizationStateParameters({headEmbedding:t,tailEmbedding:e,head:i,tail:s,epochsPerSample:o,a:h,b:c,nEpochs:r,nVertices:a})},t.prototype.optimizeLayoutStep=function(t){for(var e=this.optimizationState,n=e.head,i=e.tail,s=e.headEmbedding,o=e.tailEmbedding,r=e.epochsPerSample,a=e.epochOfNextSample,l=e.epochOfNextNegativeSample,h=e.epochsPerNegativeSample,c=e.moveOther,u=e.initialAlpha,d=e.alpha,m=e.gamma,p=e.a,g=e.b,v=e.dim,y=e.nEpochs,b=e.nVertices,S=0;S<r.length;S++)if(!(a[S]>t)){var M=n[S],x=i[S],T=s[M],N=o[x],E=C(T,N),A=0;E>0&&(A=-2*p*g*Math.pow(E,g-1),A/=p*Math.pow(E,g)+1);for(var I=0;I<v;I++){var L=w(A*(T[I]-N[I]),4);T[I]+=L*d,c&&(N[I]+=-L*d)}a[S]+=r[S];for(var k=Math.floor((t-l[S])/h[S]),R=0;R<k;R++){var _=f.tauRandInt(b,this.random),G=o[_],P=C(T,G),O=0;if(P>0)O=2*m*g,O/=(.001+P)*(p*Math.pow(P,g)+1);else if(M===_)continue;for(I=0;I<v;I++)L=4,O>0&&(L=w(O*(T[I]-G[I]),4)),T[I]+=L*d}l[S]+=k*h[S]}return e.alpha=u*(1-t/y),e.currentEpoch+=1,s},t.prototype.optimizeLayoutAsync=function(t){var e=this;return void 0===t&&(t=function(){return!0}),new Promise((function(n,o){var r=function(){return i(e,void 0,void 0,(function(){var e,i,a,l,h,c;return s(this,(function(s){try{if(e=this.optimizationState,i=e.nEpochs,a=e.currentEpoch,this.embedding=this.optimizeLayoutStep(a),l=this.optimizationState.currentEpoch,h=!1===t(l),c=l===i,h||c)return[2,n(c)];setTimeout((function(){return r()}),0)}catch(t){o(t)}return[2]}))}))};setTimeout((function(){return r()}),0)}))},t.prototype.optimizeLayout=function(t){void 0===t&&(t=function(){return!0});for(var e=!1,n=[];!e;){var i=this.optimizationState,s=i.nEpochs,o=i.currentEpoch;n=this.optimizeLayoutStep(o);var r=this.optimizationState.currentEpoch,a=!1===t(r);e=r===s||a}return n},t.prototype.getNEpochs=function(){var t=this.graph;if(this.nEpochs>0)return this.nEpochs;var e=t.nRows;return e<=2500?500:e<=5e3?400:e<=7500?300:200},t}();function y(t,e){for(var n=0,i=0;i<t.length;i++)n+=Math.pow(t[i]-e[i],2);return Math.sqrt(n)}e.UMAP=v,e.euclidean=y,e.cosine=function(t,e){for(var n=0,i=0,s=0,o=0;o<t.length;o++)n+=t[o]*e[o],i+=Math.pow(t[o],2),s+=Math.pow(e[o],2);return 0===i&&0===s?0:0===i||0===s?1:1-n/Math.sqrt(i*s)};var b=function(){this.currentEpoch=0,this.headEmbedding=[],this.tailEmbedding=[],this.head=[],this.tail=[],this.epochsPerSample=[],this.epochOfNextSample=[],this.epochOfNextNegativeSample=[],this.epochsPerNegativeSample=[],this.moveOther=!0,this.initialAlpha=1,this.alpha=1,this.gamma=1,this.a=1.5769434603113077,this.b=.8950608779109733,this.dim=2,this.nEpochs=500,this.nVertices=0};function w(t,e){return t>e?e:t<-e?-e:t}function C(t,e){for(var n=0,i=0;i<t.length;i++)n+=Math.pow(t[i]-e[i],2);return n}function S(t,e){var n=f.linear(0,3*t,300).map((function(t){return t<e?1:t})),i=f.zeros(n.length).map((function(i,s){return n[s]>=e?Math.exp(-(n[s]-e)/t):i})),s={x:n,y:i},r=m.default(s,(function(t){var e=o(t,2),n=e[0],i=e[1];return function(t){return 1/(1+n*Math.pow(t,2*i))}}),{damping:1.5,initialValues:[.5,.5],gradientDifference:.1,maxIterations:100,errorTolerance:.01}).parameterValues,a=o(r,2);return{a:a[0],b:a[1]}}function M(t,e,n,i){return void 0===n&&(n=1),void 0===i&&(i=5),t.map((function(t,s,o){return-1===e[s]||-1===e[o]?t*Math.exp(-n):e[s]!==e[o]?t*Math.exp(-i):t}))}function x(t){t=c.normalize(t,"max");var e=c.transpose(t),n=c.pairwiseMultiply(e,t);return t=c.add(t,c.subtract(e,n)),c.eliminateZeros(t)}function T(t,e,n){for(var i=f.zeros(t.length).map((function(t){return f.zeros(n[0].length)})),s=0;s<t.length;s++)for(var o=0;o<t[0].length;o++)for(var r=0;r<n[0].length;r++){var a=t[s][o];i[s][r]+=e[s][o]*n[a][r]}return i}e.findABParams=S,e.fastIntersection=M,e.resetLocalConnectivity=x,e.initTransform=T},4517:function(t,e){"use strict";var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}};function i(t,e){return Math.floor(e()*t)}function s(t){for(var e=[],n=0;n<t;n++)e.push(void 0);return e}function o(t,e){return s(t).map((function(){return e}))}function r(t){return o(t,0)}function a(t){return t.reduce((function(t,e){return t+e}))}Object.defineProperty(e,"__esModule",{value:!0}),e.tauRandInt=i,e.tauRand=function(t){return t()},e.norm=function(t){var e,i,s=0;try{for(var o=n(t),r=o.next();!r.done;r=o.next()){var a=r.value;s+=Math.pow(a,2)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(i=o.return)&&i.call(o)}finally{if(e)throw e.error}}return Math.sqrt(s)},e.empty=s,e.range=function(t){return s(t).map((function(t,e){return e}))},e.filled=o,e.zeros=r,e.ones=function(t){return o(t,1)},e.linear=function(t,e,n){return s(n).map((function(i,s){return t+s*((e-t)/(n-1))}))},e.sum=a,e.mean=function(t){return a(t)/t.length},e.max=function(t){for(var e=0,n=0;n<t.length;n++)e=t[n]>e?t[n]:e;return e},e.max2d=function(t){for(var e=0,n=0;n<t.length;n++)for(var i=0;i<t[n].length;i++)e=t[n][i]>e?t[n][i]:e;return e},e.rejectionSample=function(t,e,n){for(var s=r(t),o=0;o<t;o++)for(var a=!0;a;){for(var l=i(e,n),h=!1,c=0;c<o;c++)if(l===s[c]){h=!0;break}h||(a=!1),s[o]=l}return s},e.reshape2d=function(t,e,n){var i=[],s=0;if(t.length!==e*n)throw new Error("Array dimensions must match input length.");for(var o=0;o<e;o++){for(var r=[],a=0;a<n;a++)r.push(t[s]),s+=1;i.push(r)}return i}},3336:t=>{"use strict";t.exports=$},976:t=>{"use strict";t.exports=DG},4469:t=>{"use strict";t.exports=grok},701:t=>{"use strict";t.exports=rxjs},3870:t=>{"use strict";t.exports=ui},6414:t=>{"use strict";t.exports=wu}},e={};function n(i){var s=e[i];if(void 0!==s)return s.exports;var o=e[i]={id:i,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.exports}n.m=t,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.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&&(t=e.currentScript.src),!t)){var i=e.getElementsByTagName("script");i.length&&(t=i[i.length-1].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(3477);bio=i})();
1
+ var bio;(()=>{var t={8867:(t,e,n)=>{"use strict";n.d(e,{OW:()=>i});class i extends Float32Array{}},7997:(t,e,n)=>{"use strict";function i(t=!1,e="Assertion error."){if(!t)throw new Error(e)}function s(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n]*t[n];return Math.sqrt(e)}function r(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}n.d(e,{$G:()=>s,MA:()=>r,hu:()=>i}),n(8867)},2012:(t,e,n)=>{"use strict";n.d(e,{f:()=>s});var i=n(9976);class s extends i.B{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,s)),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,s)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new s({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 s.aaSynonyms?s.aaSynonyms[t]:t;return super.get(e)}}s.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class r{static getPalette(t="grok"){switch(t){case"grok":return s.GrokGroups;case"lesk":return s.Lesk;default:throw new Error(`ChemPalette: scheme \`${t}\` does not exist`)}}static getInnerOuter(t){let e=0,n="",i="";for(const s of t)"("==s?e++:")"==s?e--:e?n+=s:i+=s;return isNaN(parseInt(n))?[i,n]:[i,""]}static getColorAAPivot(t="",e="grok"){var n,i,s;const r=this.getPalette(e);let[o,a]=this.getInnerOuter(t);if(o=o.length>6?`${o.slice(0,3)}...`:o,a=a.length>6?`${a.slice(0,3)}...`:a,1==t.length||"("==t[1]){const e=null===(n=t[0])||void 0===n?void 0:n.toUpperCase();return e in r?[r.get(e),e,a,1]:[this.undefinedColor,o,a,1]}if("d"==t[0]&&t[1]in r&&(2==t.length||"("==t[2])){const e=null===(i=t[1])||void 0===i?void 0:i.toUpperCase();return e in r?[r.get(e),e,a,2]:[this.undefinedColor,o,a,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 r?[r.get(e),e,a,3]:[this.undefinedColor,o,a,3]}if((null===(s=t[0])||void 0===s?void 0:s.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 r?[r.get(e),e,a,4]:[this.undefinedColor,o,a,4]}return[this.undefinedColor,o,a,0]}}r.SemType="Aminoacids",r.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",r.undefinedColor="rgb(100,100,100)",r.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"},r.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"},r.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(*)*"},r.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"}},7228:(t,e,n)=>{"use strict";n.d(e,{JN:()=>a,Xk:()=>o});var i=n(976),s=(n(4469),n(1047)),r=(n(585),function(t,e,n,i){return new(n||(n=Promise))((function(s,r){function o(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}l((i=i.apply(t,e||[])).next())}))});function o(t){const e=[];for(let n=0;n<t.rowCount;n++){const i={};Object.keys(s.K4).forEach((e=>{if("symbol"===e){const r=t.get(s.K4[e],n);i[e]="."===r?t.get(s.At,n):r}else if("rgroups"===e){const r=t.get(s.K4[e],n).split("\n"),o=[];r.forEach((t=>{const e={},n=t.substring(t.lastIndexOf("]")+1),i=t.match(/\[R(\d+)\]/)[1];e.capGroupSmiles="H"===n?`[*:${i}][H]`:`O[*:${i}]`,e.alternateId="H"===n?`R${i}-H`:`R${i}-OH`,e.capGroupName="H"===n?"H":"OH",e.label=`R${i}`,o.push(e)})),i[e]=o}else s.K4[e]&&(i[e]=t.get(s.K4[e],n))})),e.push(i)}return e}function a(){return r(this,void 0,void 0,(function*(){const t=i.Func.find({package:"Bio",name:"getMonomerLibHelper"});if(0===t.length)throw new Error('Package "Bio" must be installer for MonomerLibraryHelper.');return(yield t[0].prepare().call()).getOutputParamValue()}))}},1731:(t,e,n)=>{"use strict";n.d(e,{i0:()=>G});var i=n(4469),s=n(976),r=n(1047),o=n(585),a=n(7767);function l(t){var e;return"string"==typeof t||t instanceof String?t:("object"==typeof t||t instanceof Object)&&"$thrownJsError"in t?l(t.$thrownJsError):t instanceof Error?null!==(e=t.stack)&&void 0!==e?e:t.message:t.toString()}var h=n(499),c=function(t,e,n,i){return new(n||(n=Promise))((function(s,r){function o(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}l((i=i.apply(t,e||[])).next())}))};const u=8,m="M RGP",d="A ",f=14,p=7,g="\nDatagrok macromolecule handler\n\n",y=" 0 0 0 0 0 0 999 V3000\n",b="M V30 BEGIN CTAB\n",w="M V30 END CTAB\n",v="M V30 COUNTS ",C=" 0 0 0\n",S="M V30 BEGIN ATOM\n",M="M V30 END ATOM\n",T="M V30 BEGIN BOND\n",x="M V30 END BOND\n",E=" CFG=",N="M V30 ",A="M END",I=1e4,L="d",k="r",_="p",R="O",O="H";function G(t,e,n){return c(this,void 0,void 0,(function*(){if(0===s.Func.find({package:"Chem",name:"getRdKitModule"}).length)return{col:null,warnings:['Transformation to atomic level requires the package "Chem" installed.']};if(e.semType!==s.SEMTYPE.MACROMOLECULE)return{col:null,warnings:[`Only the ${s.SEMTYPE.MACROMOLECULE} columns can be converted to atomic level, the chosen column has semType '${e.semType}'`]};let u=e;h.C.getOrCreate(e).isHelm()&&(u=new a.L(e).convert("separator","."),u.name=e.name);const m=h.C.getOrCreate(u).alphabet;let d;if("PT"===m||"UN"===m)d="PEPTIDE";else{if("RNA"!==m&&"DNA"!==m)return{col:null,warnings:[`Unexpected column's '${u.name}' alphabet '${m}'.`]};d="RNA"}const f=function(t){const e=t.length,n=new Array(e),i=t.getTag(s.TAGS.UNITS),r=t.getTag("separator"),a=(0,o.vU)(i,r);for(let i=0;i<e;++i){const e=t.get(i);n[i]=e?a(e).filter((t=>""!==t)):[]}return n}(u),p=yield function(t,e,n,s){return c(this,void 0,void 0,(function*(){const o=function(t,e,n){const i=new Map;for(const s of t.getMonomerSymbolsByType(e)){const o=t.getMonomer(e,s);if("RNA"===e&&("Branch"===o.monomerType||"DNA"===n&&o.symbol===L||"RNA"===n&&o.symbol===k||o.symbol===_)||"PEPTIDE"===e&&"Branch"!==o.monomerType){const t={};r.rx.forEach((e=>{t[e]=o[e]})),i.set(o.symbol,t)}}return i}(e,n,s),a=new Map,h=yield i.functions.call("Chem:getRdKitModule"),c={value:null};if("RNA"===n){const t="RNA"===s?[k,_]:[L,_];for(const e of t)P(a,e,o,h,n,c)}for(let e=0;e<t.length;++e){const i=t[e];for(const t of i)if(""!==t)try{P(a,t,o,h,n,c)}catch(e){const n=l(e);throw console.error(`bio lib: getMonomersDictFromLib() sym='${t}', error:\n`+n),new Error(`Сan't get monomer '${t}' from library: ${n}`)}}return a}))}(f,n,d,m),g=u.length,y=new Array(g),b=new Array(0);for(let t=0;t<g;++t)try{const e=f[t];y[t]=X(e,p,m,d)}catch(e){const n=`Cannot get molfile of row #${t}: ${e instanceof Error?e.message:e.toString()}.`;b.push(n)}if(b.length>.05*g)throw new Error("Too many errors getting molfiles.");const w=`molfile(${u.name})`,v=t.columns.getUnusedName(w),C=s.Column.fromStrings(v,y);return C.semType=s.SEMTYPE.MOLECULE,C.setTag(s.TAGS.UNITS,s.UNITS.Molecule.MOLBLOCK),{col:C,warnings:b}}))}function P(t,e,n,i,s,r){if(!t.has(e)){const o=function(t,e,n,i,s){if(e.has(t)){const r=e.get(t),o=function(t){const e=[];for(const n of t){let t=n.capGroupSmiles;t||(t=n.capGroupSMILES),t=t.replace(/(\[|\]|\*|:|\d)/g,""),e.push(t)}return e}(r.rgroups),a=function(t){const e=new Map;let n=t.indexOf(d,0),i=n;for(;-1!==n;){i=t.indexOf("\n",n);const s=parseInt(t.substring(n,i).replace(/^A\s+/,""));n=t.indexOf("R",i),i=t.indexOf("\n",n);const r=parseInt(t.substring(n,i).replace(/^R/,""));e.set(s,r),n=t.indexOf(d,i)}for(n=t.indexOf(m,0),i=t.indexOf("\n",n);-1!==n;){n+=u,i=t.indexOf("\n",n);const s=t.substring(n,i).replaceAll(/\s+/g," ").split(" ").map((t=>parseInt(t))).slice(1);for(let t=0;t<s.length;t+=2){if(e.has(s[t])&&e.get(s[t])!==s[t+1])throw new Error(`r-group index ${s[t]} has already been added with a different value`);e.set(s[t],s[t+1])}n=t.indexOf(m,i)}return e}(r.molfile),l=function(t,e){const n=e.get_mol(t),i=n.get_v3Kmolblock();return n.delete(),i}(function(t){let e=t.indexOf(d,0);-1===e&&(e=t.indexOf(m));const n=t.indexOf(A,e);return t.substring(0,e)+t.substring(n)}(r.molfile),n),h=function(t){let e=(t=t.replaceAll("\r","")).indexOf(v)+f,n=t.indexOf(" ",e+1);const i=parseInt(t.substring(e,n));return e=n+1,n=t.indexOf(" ",e+1),{atomCount:i,bondCount:parseInt(t.substring(e,n))}}(l),c=function(t,e){const n=new Array(e),i=new Float32Array(e),s=new Float32Array(e),r=new Array(e);let o=t.indexOf(S);o=t.indexOf("\n",o);let a=o;for(let l=0;l<e;l++){o=t.indexOf(N,o)+p,a=t.indexOf(" ",o),o=a+1,a=t.indexOf(" ",o),n[l]=t.substring(o,a);const e=new Array(2);for(let n=0;n<2;++n)o=a+1,a=t.indexOf(" ",o),e[n]=parseFloat(t.substring(o,a));i[l]=e[0],s[l]=e[1],o=a,a=t.indexOf("\n",o)+1,r[l]=t.slice(o,a),o=a}return{atomTypes:n,x:i,y:s,kwargs:r}}(l,h.atomCount),g=function(t,e){const n=new Uint32Array(e),i=new Array(e),s=new Map,r=new Map;let o=t.indexOf(T);o=t.indexOf("\n",o);let a=o;for(let l=0;l<e;++l){const e=new Array(3);o=t.indexOf(N,a)+p,a=t.indexOf(" ",o);for(let n=0;n<3;++n)o=a+1,a=Math.min(t.indexOf("\n",o),t.indexOf(" ",o)),e[n]=parseInt(t.slice(o,a));n[l]=e[0],i[l]=e.slice(1);const h=t.indexOf("\n",o);let c=t.slice(a,h),u=c.indexOf(E);if(-1!==u){u=c.indexOf("=",u)+1;let t=c.indexOf(" ",u);-1===t&&(t=c.length);const e=parseInt(c.slice(u,t));s.set(l,e);const n=E+e.toString();c=c.replace(n,"")}c||r.set(l,c)}return{bondTypes:n,atomPairs:i,bondConfiguration:s,kwargs:r}}(l,h.bondCount),y={atoms:c,bonds:g,meta:F(c,g,o,a)};return"PEPTIDE"===i?function(t){const e=t.meta.terminalNodes[0]-1,n=t.meta.rNodes[0]-1,i=t.atoms.x,s=t.atoms.y;z(t,-i[e],-s[e]);const r=D(i[n],s[n]);B(t.atoms,-r),i[t.meta.rNodes[1]-1]<0&&function(t){Y(t,!1)}(t);const o=function(t){const e=function(t){var e;const n=new Map;for(const i of t.bonds.atomPairs)for(let t=0;t<2;t++){const s=i[t],r=i[(t+1)%2];n.has(s)?null===(e=n.get(s))||void 0===e||e.push(r):n.set(s,new Array(1).fill(r))}return n}(t);let n=0,i=0;for(;0===n;){const s=e.get(t.meta.terminalNodes[1])[i];t.atoms.atomTypes[s-1]===R&&s!==t.meta.rNodes[1]&&(n=s),i++}return n}(t);!function(t,e){t.atoms.y[t.meta.rNodes[1]-1]<0&&t.atoms.y[e-1]<0&&(function(t){Y(t,!0)}(t),B(t.atoms,-function(t,e){return D(t,e)+Math.PI/2}(t.atoms.x[t.meta.terminalNodes[1]-1],t.atoms.y[t.meta.terminalNodes[1]-1])))}(t,o),function(t,e){const n=t.atoms.x;n[t.meta.rNodes[1]-1]>n[e-1]&&function(t,e,n){const i=e-1,s=n-1,r=t.atoms.x,o=t.atoms.y,a=r[i],l=o[i];r[i]=r[s],o[i]=o[s],r[s]=a,o[s]=l}(t,e,t.meta.rNodes[1])}(t,o)}(y):t===k||t===L?function(t,e){const n=t.atoms.x,i=t.atoms.y;let s=t.meta.terminalNodes[0]-1;const r=t.meta.rNodes[1]-1;z(t,-n[s],-i[s]);const o=D(n[r],i[r]);B(t.atoms,3*Math.PI/2-o),e.value=function(t){const e=t.atoms.x,n=t.atoms.y,i=t.meta.rNodes[2]-1,s=t.meta.terminalNodes[2]-1,r=e[i]-e[s],o=n[i]-n[s];return Math.atan(o/r)+Math.PI/2}(t),s=t.meta.terminalNodes[0]-1,z(t,-n[s],-i[s])}(y,s):t===_?function(t){const e=t.meta.terminalNodes[0]-1,n=t.meta.rNodes[0]-1,i=t.atoms.x,s=t.atoms.y;z(t,-i[e],-s[e]);const r=D(i[n],s[n]);B(t.atoms,Math.PI/2-r)}(y):function(t,e){const n=t.atoms.x,i=t.atoms.y,s=t.meta.terminalNodes[0]-1,r=t.meta.rNodes[0]-1;z(t,-n[s],-i[s]);const o=D(n[r],i[r]),a=e.value;if(!a)throw new Error("The value of sugarBranchToOYAngle is null");B(t.atoms,Math.PI-o+a);const l=function(t,e){return Q(Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)))}({x:n[t.meta.rNodes[0]-1],y:i[t.meta.rNodes[0]-1]},{x:n[t.meta.terminalNodes[0]-1],y:i[t.meta.terminalNodes[0]-1]});if(1!=l)for(let t=0;t<n.length;++t)n[t]=Q(n[t]/l),i[t]=Q(i[t]/l)}(y,s),function(t,e,n){"PEPTIDE"===t?(V(e,t),Z(e,e.meta.rNodes[1])):n===k||n===L?(Z(e,e.meta.rNodes[1]),e.meta.rNodes[1]=e.meta.terminalNodes[1],W(e.bonds,e.meta),V(e,t),Z(e,e.meta.rNodes[1]),Z(e,e.meta.rNodes[0]),Z(e,e.meta.rNodes[2])):n===_&&(e.meta.terminalNodes[0]=e.meta.rNodes[0],z(e,-e.atoms.x[e.meta.terminalNodes[0]-1],-e.atoms.y[e.meta.terminalNodes[0]-1]),V(e,t),Z(e,e.meta.rNodes[1]))}(i,y,t),function(t){let e=0;for(;e<t.atoms.atomTypes.length;)t.atoms.atomTypes[e]===O&&(Z(t,e+1),--e),++e}(y),y}return null}(e,n,i,s,r);if(!o)throw new Error(`Monomer with symbol '${e}' is absent the monomer library`);t.set(e,o)}}function F(t,e,n,i){const s={backboneShift:null,branchShift:null,terminalNodes:[],rNodes:[]};return function(t,e,n){for(const[i,s]of n)t.atomTypes[i-1]=e[s-1]}(t,n,i),function(t,e){e.rNodes=Array.from(t.keys());for(let n=0;n<e.rNodes.length;n++)for(const i of[1,2])if(t.get(e.rNodes[n])===i){const t=e.rNodes[i-1];e.rNodes[i-1]=e.rNodes[n],e.rNodes[n]=t}}(i,s),W(e,s),s}function W(t,e){const n=e.rNodes;e.terminalNodes=new Array(n.length).fill(0);const i=e.terminalNodes,s=t.atomPairs;let r=0,o=0;for(;r<s.length&&o<i.length;){for(let t=0;t<i.length;++t)for(let e=0;e<2;++e)s[r][e]===n[t]&&(i[t]=s[r][(e+1)%2],n.length,++o);++r}}function V(t,e){t.meta.rNodes.length>1&&(t.meta.backboneShift=H(t,t.meta.rNodes[1]-1,t.meta.terminalNodes[0]-1)),"RNA"===e&&t.meta.rNodes.length>2&&(t.meta.branchShift=H(t,t.meta.rNodes[2]-1,t.meta.terminalNodes[0]-1))}function H(t,e,n){return[Q(t.atoms.x[e]-t.atoms.x[n]),Q(t.atoms.y[e]-t.atoms.y[n])]}function Z(t,e){if(void 0!==e){const n=e-1,i=t.atoms,s=t.bonds,r=t.meta;i.atomTypes.splice(n,1),i.x=U(Float32Array,i.x,n,1),i.y=U(Float32Array,i.y,n,1),i.kwargs.splice(n,1);for(let t=0;t<r.terminalNodes.length;++t)r.terminalNodes[t]>e?--r.terminalNodes[t]:r.terminalNodes[t]===e&&(r.terminalNodes[t]=-1);for(let t=0;t<r.rNodes.length;++t)r.rNodes[t]>e?--r.rNodes[t]:r.rNodes[t]===e&&(r.rNodes[t]=-1);let o=0;for(;o<s.atomPairs.length;){const t=s.atomPairs[o][0],n=s.atomPairs[o][1];t===e||n===e?(s.atomPairs.splice(o,1),s.bondTypes=U(Uint32Array,s.bondTypes,o,1),s.bondConfiguration.has(o)&&s.bondConfiguration.delete(o),s.kwargs.has(o)&&s.kwargs.delete(o),--o):(s.atomPairs[o][0]=t>e?t-1:t,s.atomPairs[o][1]=n>e?n-1:n),++o}let a=Array.from(s.bondConfiguration.keys());a.forEach((t=>{if(s.bondConfiguration.has(t)&&t>n){const e=s.bondConfiguration.get(t);s.bondConfiguration.delete(t),s.bondConfiguration.set(t-1,e)}})),a=Array.from(s.kwargs.keys()),a.forEach((t=>{if(s.kwargs.has(t)&&t>n){const e=s.kwargs.get(t);s.kwargs.delete(t),s.kwargs.set(t-1,e)}}))}}function U(t,e,n,i){const s=new t(e.length-i);let r=0,o=0;for(;r<e.length;)r===n&&(r+=i),s[o]=e[r],++o,++r;return s}function D(t,e){let n;if(0===t)n=e>0?0:Math.PI;else if(0===e)n=t>0?-Math.PI/2:Math.PI/2;else{const i=e/t,s=Math.atan(i);n=t<0?Math.PI/2+s:-Math.PI/2+s}return n}function B(t,e){if(0!==e){const n=t.x,i=t.y,s=Math.cos(e),r=Math.sin(e);for(let t=0;t<n.length;++t){const e=n[t];n[t]=Q(e*s-i[t]*r),i[t]=Q(e*r+i[t]*s)}}}function Y(t,e){if(e){const e=t.atoms.y;for(let t=0;t<e.length;t++)e[t]=-e[t]}else{const e=t.atoms.x;for(let t=0;t<e.length;t++)e[t]=-e[t]}const n=t.bonds.bondConfiguration;for(const[t,e]of n){const i=1===e?3:1;n.set(t,i)}}function z(t,e,n){const i=t.atoms.x,s=t.atoms.y;for(let t=0;t<i.length;++t)i[t]=Q(i[t]+e),void 0!==n&&(s[t]=Q(s[t]+n))}function X(t,e,n,i){if(0===t.length)return"";const s=J,{atomCount:r,bondCount:o}=s(t,e,n,i),a=new Array(r),l=new Array(o);let h,c=null,u=null;"PEPTIDE"===i?h=q:(h=j,c="DNA"===n?e.get(L):e.get(k),u=e.get(_));const m={i:0,nodeShift:0,bondShift:0,backbonePositionShift:new Array(2).fill(0),branchPositionShift:new Array(2).fill(0),backboneAttachNode:0,branchAttachNode:0,flipFactor:1},d={sugar:c,phosphate:u,seqLength:t.length,atomCount:r,bondCount:o};for(m.i=0;m.i<d.seqLength;++m.i)h(e.get(t[m.i]),a,l,m,d);!function(t,e,n,i){const s=n.nodeShift+1;t[i.atomCount]=N+s+" "+R+" "+Q(n.backbonePositionShift[0])+" "+n.flipFactor*Q(n.backbonePositionShift[1])+" 0.000000 0\n";const r=n.backboneAttachNode,o=s;e[i.bondCount]=N+n.bondShift+" 1 "+r+" "+o+"\n"}(a,l,m,d);let f="";return f+=g,f+=y,f+=b,f+=v+r+" "+o+C,f+=S,f+=a.join(""),f+=M,f+=T,f+=l.join(""),f+=x,f+=w,f+=A,f}function q(t,e,n,i){i.flipFactor=Math.pow(-1,i.i%2),K(t,e,n,i)}function K(t,e,n,i){!function(t,e,n){for(let i=0;i<t.atoms.atomTypes.length;++i){const s=n.nodeShift+i+1;e[n.nodeShift+i]=N+s+" "+t.atoms.atomTypes[i]+" "+Q(n.backbonePositionShift[0]+t.atoms.x[i])+" "+Q(n.backbonePositionShift[1]+n.flipFactor*t.atoms.y[i])+" "+t.atoms.kwargs[i]}}(t,e,i),$(t,n,i),function(t,e,n){if(0!==n.backboneAttachNode){const i=n.bondShift,s=n.backboneAttachNode,r=t.meta.terminalNodes[0]+n.nodeShift;e[n.bondShift-1]=N+i+" 1 "+s+" "+r+"\n"}}(t,n,i),null!==t.meta.branchShift&&t.meta.terminalNodes.length>2&&function(t,e){e.branchAttachNode=e.nodeShift+t.meta.terminalNodes[2];for(let n=0;n<2;++n)e.branchPositionShift[n]=e.backbonePositionShift[n]+t.meta.branchShift[n]}(t,i),function(t,e){e.backboneAttachNode=e.nodeShift+t.meta.terminalNodes[1],e.bondShift+=t.bonds.atomPairs.length+1,e.nodeShift+=t.atoms.atomTypes.length,e.backbonePositionShift[0]+=t.meta.backboneShift[0],e.backbonePositionShift[1]+=e.flipFactor*t.meta.backboneShift[1]}(t,i)}function j(t,e,n,i,s){if(0===i.i)K(s.sugar,e,n,i);else for(const t of[s.phosphate,s.sugar])K(t,e,n,i);!function(t,e,n,i){(function(t,e,n){for(let i=0;i<t.atoms.atomTypes.length;++i){const s=n.nodeShift+i+1;e[n.nodeShift+i]=N+s+" "+t.atoms.atomTypes[i]+" "+Q(n.branchPositionShift[0]+t.atoms.x[i])+" "+Q(n.branchPositionShift[1]+n.flipFactor*t.atoms.y[i])+" "+t.atoms.kwargs[i]}})(t,e,i),$(t,n,i),function(t,e,n){const i=n.bondShift,s=n.branchAttachNode,r=t.meta.terminalNodes[0]+n.nodeShift;e[i-1]=N+i+" 1 "+s+" "+r+"\n"}(t,n,i);const s=i.bondShift,r=i.branchAttachNode,o=t.meta.terminalNodes[0]+i.nodeShift;n[s-1]=N+s+" 1 "+r+" "+o+"\n",i.bondShift+=t.bonds.atomPairs.length+1,i.nodeShift+=t.atoms.atomTypes.length}(t,e,n,i)}function $(t,e,n){for(let i=0;i<t.bonds.atomPairs.length;++i){const s=n.bondShift+i+1,r=t.bonds.atomPairs[i][0]+n.nodeShift,o=t.bonds.atomPairs[i][1]+n.nodeShift;let a="";if(t.bonds.bondConfiguration.has(i)){let e=t.bonds.bondConfiguration.get(i);n.flipFactor<0&&(e=1===e?3:1),a=" CFG="+e}const l=t.bonds.kwargs.has(i)?" "+t.bonds.kwargs.get(i):"";e[n.bondShift+i]=N+s+" "+t.bonds.bondTypes[i]+" "+r+" "+o+a+l+"\n"}}function J(t,e,n,i){let s=0,r=0;for(const n of t){if(""===n)continue;const t=e.get(n);s+=t.atoms.x.length,r+=t.bonds.bondTypes.length}if("PEPTIDE"===i)s+=1,r+=t.length;else{const i="DNA"===n?e.get(L):e.get(k),o=e.get(_);s+=(t.length-1)*o.atoms.x.length,s+=t.length*i.atoms.x.length,s+=1,r+=(t.length-1)*o.bonds.bondTypes.length,r+=t.length*i.bonds.bondTypes.length,r-=1,r+=3*t.length}return{atomCount:s,bondCount:r}}function Q(t){return Math.round(I*t)/I}},6137:(t,e,n)=>{"use strict";n.d(e,{J:()=>s});var i=n(9976);class s extends i.B{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new s({A:"green",C:"blue",G:"black",T:"red",U:"red",others:"gray"})),this.chromatogram}}class r{}r.SemType="Nucleotides",r.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",r.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"}},9976:(t,e,n)=>{"use strict";n.d(e,{B:()=>i});class i{static makePalette(t,e=!1,n=i){const s={};return t.forEach((t=>{const n=t[0],i=t[1];n.forEach(((t,n)=>{s[t]=this.colourPalette[i][e?0:n]}))})),new n(s)}constructor(t){this._palette=t}get(t){return this._palette[t]}}i.undefinedColor="rgb(100,100,100)",i.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)"]}},7331:(t,e,n)=>{"use strict";n.d(e,{UE:()=>h});var i=n(976),s=n(9976);class r{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 o{}class a extends o{get(t){return"#666666"}}class l extends o{static buildPalette(){return[].concat(...Object.values(s.B.colourPalette))}get(t){const e=r.hashCode(t)%l.palette.length;return function(t){if(null==t)return"rgb(100,100,100)";const e=i.Color.fromHtml(t),n=i.Color.g(e),s=i.Color.r(e),r=i.Color.b(e),o=Math.sqrt(Math.pow(0-s,2)+Math.pow(0-n,2)+Math.pow(0-r,2));return o>210?`rgb(${s/o*210},${n/o*210},${r/o*210})`:i.Color.toRgb(e)}(l.palette[e])}}l.palette=l.buildPalette();class h extends s.B{static get Gray(){return void 0===this.gray&&(this.gray=new a),this.gray}static get Color(){return void 0===this.color&&(this.color=new l),this.color}}},1047:(t,e,n)=>{"use strict";n.d(e,{At:()=>s,K4:()=>r,rx:()=>i});const i=["symbol","molfile","rgroups","name"],s="MonomerName",r={monomerType:null,smiles:null,name:"MonomerName",author:null,molfile:"molecule",naturalAnalog:"MonomerNaturalAnalogCode",rgroups:"MonomerCaps",createDate:null,id:null,polymerType:"MonomerType",symbol:"MonomerCode"}},5226:(t,e,n)=>{"use strict";n.d(e,{i:()=>r});var i=n(976),s=n(499);class r{get descriptionsArray(){return this._descriptionsArray}get sequencesArray(){return this._sequencesArray}parseMacromolecule(t,e){return this._fileContent.slice(t,e).split(/\s/).join("")}parseColumns(){const t=/^>(.*)$/gm;let e,n=0;for(;e=t.exec(this._fileContent);){const i=this._fileContent.substring(e.index+1,t.lastIndex);this._descriptionsArray.push(i),0!==n&&this._sequencesArray.push(this.parseMacromolecule(n,e.index)),n=t.lastIndex+1}this._sequencesArray.push(this.parseMacromolecule(n,-1))}importFasta(){const t=i.Column.fromStrings("description",this.descriptionsArray),e=i.Column.fromStrings("sequence",this.sequencesArray);return e.semType=i.SEMTYPE.MACROMOLECULE,e.setTag(i.TAGS.UNITS,"fasta"),s.C.getOrCreate(e),[i.DataFrame.fromColumns([t,e])]}constructor(t){this._descriptionsArray=[],this._sequencesArray=[],this._fileContent=t,this.parseColumns()}}},1821:(t,e,n)=>{"use strict";n.d(e,{BM:()=>s,XS:()=>o});var i=n(6286);const s=/\[(\w+)\]|(\w)|(-)/g,r=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"])}}},o=[new i.L("PT",r.fasta.peptide,.5),new i.L("DNA",r.fasta.dna,.55),new i.L("RNA",r.fasta.rna,.55)]},8447:(t,e,n)=>{"use strict";n.d(e,{GU:()=>i.GU,dQ:()=>i.dQ,kB:()=>i.kB,py:()=>i.py,up:()=>i.up,vU:()=>i.vU});var i=n(585)},6286:(t,e,n)=>{"use strict";n.d(e,{L:()=>i,d:()=>s});class i{constructor(t,e,n){this.name=t,this.alphabet=e,this.cutoff=n}}class s extends i{constructor(t,e,n){super(t.name,t.alphabet,t.cutoff),this.freq=e,this.similarity=n}}},585:(t,e,n)=>{"use strict";n.d(e,{Ar:()=>p,GU:()=>S,Mj:()=>v,dQ:()=>T,kB:()=>f,py:()=>x,up:()=>E,vU:()=>w,w4:()=>M});var i=n(976),s=n(6414),r=n.n(s),o=n(6286),a=n(1821),l=n(499),h=n(8867),c=n(7997),u=n(2012),m=n(6137),d=n(7331);function f(t){return r()(t.toString().matchAll(a.BM)).map((t=>{const e=t[0];return"-"===e?"":e.length>1?t[1]:e})).toArray()}function p(t,e=undefined){return n=>n.split(t,e)}const g=/(PEPTIDE1|DNA1|RNA1)\{([^}]+)}/g,y=/\[([^\[\]]+)]/g;function b(t){g.lastIndex=0;const e=g.exec(t.toString()),n=e?e[2]:null;return(n?n.split("."):[]).map((t=>{y.lastIndex=0;const e=y.exec(t);return e&&e.length>=2?e[1]:t}))}function w(t,e,n=undefined){if(t.toLowerCase().startsWith("fasta"))return f;if(t.toLowerCase().startsWith("separator"))return p(e,n);if(t.toLowerCase().startsWith("helm"))return b;throw new Error(`Unexpected units ${t} .`)}function v(t){if(t.semType!==i.SEMTYPE.MACROMOLECULE)throw new Error(`Get splitter for semType "${i.SEMTYPE.MACROMOLECULE}" only.`);return w(t.getTag(i.TAGS.UNITS),t.getTag("separator"))}const C=/(\w+)/g;function S(t,e){var n,i;const s=t.match(C),r=t.length>e||(null!==(n=null==s?void 0:s.length)&&void 0!==n?n:0)>1,o=null!==(i=null==s?void 0:s[0])&&void 0!==i?i:" ";return r?o.substring(0,e)+"…":o}function M(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 s=[],r=[];for(const n of i)s.push(n in t?t[n]:0),r.push(e.has(n)?1:0);const o=new h.OW(s),a=new h.OW(r);return(0,c.MA)(o,a)/((0,c.$G)(o)*(0,c.$G)(a))}(t,e.alphabet,n);return new o.d(e,t,i)}));let s;const r=Math.max(...i.map((t=>t.similarity>t.cutoff?t.similarity:-1)));return s=r>0?i.find((t=>t.similarity===r)).name:"UN",s}function T(t,e=5){let n;if(t.semType==i.SEMTYPE.MACROMOLECULE)n=l.C.getOrCreate(t).alphabet;else{const i=function(t,e,n){return t.categories,function(t,e){const n={};let i=!0,s=null;for(const r of t)if(null==s?s=r.length:r.length!==s&&(i=!1),r.length>=e)for(const t of r)t in n||(n[t]=0),n[t]+=1;return{freq:n,sameLength:i}}(r()(t.getRawData()).map((e=>n(t.categories[e]))),e)}(t,e,f);n=M(i.freq,a.XS)}return x(n)}function x(t){switch(t){case"PT":return u.f.GrokGroups;case"DNA":case"RNA":return m.J.Chromatogram;default:return d.UE.Color}}function E(t){var e;const n=t.columns.bySemTypeAll(i.SEMTYPE.MACROMOLECULE);let s=null!==(e=n.find((t=>{const e=t.getTag(i.TAGS.UNITS);return!!e&&-1!==e.indexOf("MSA")})))&&void 0!==e?e:null;return!s&&n.length>0&&(s=n[0]),s}},7767:(t,e,n)=>{"use strict";n.d(e,{L:()=>o});var i=n(976),s=n(499),r=n(585);class o extends s.C{get splitter(){return null===this._splitter&&(this._splitter=(0,r.Mj)(this.column)),this._splitter}toFasta(t){return"fasta"===t}toSeparator(t){return"separator"===t}toHelm(t){return"helm"===t}convertFastaToSeparator(t,e=null){null===e&&(e=this.defaultGapSymbol);const n=this.getNewColumn("separator",t);return n.init((n=>{const i=this.column.get(n),r=this.splitter(i);for(let t=0;t<r.length;t++)r[t]===e&&(r[t]=s.C._defaultGapSymbolsDict.SEPARATOR);return r.join(t)})),n.setTag(i.TAGS.UNITS,"separator"),n}getHelmWrappers(){const t=this.isDna()?"DNA1{":this.isRna()||this.isHelmCompatible()?"RNA1{":this.isPeptide()?"PEPTIDE1{":"Unknown";if("Unknown"===t)throw new Error("Neither peptide, nor nucleotide");return[t,this.isDna()?"D(":this.isRna()?"R(":"",this.isDna()||this.isRna()?")P":"","}$$$$"]}convertToHelmHelper(t,e,n,i,r,o){return`${n}${this.splitter(t).map((t=>t&&t!==e?`${i}${t}${r}`:s.C._defaultGapSymbolsDict.HELM)).join(".")}${o}`}convertStringToHelm(t,e=null){null===e&&(e=this.defaultGapSymbol);const[n,i,s,r]=this.getHelmWrappers();return this.convertToHelmHelper(t,e,n,i,s,r)}convertToHelm(t=null){null===t&&(t=this.defaultGapSymbol);const[e,n,s,r]=this.getHelmWrappers(),o=this.getNewColumn("helm");return o.init((i=>{const o=this.column.get(i);return this.convertToHelmHelper(o,t,e,n,s,r)})),o.setTag(i.TAGS.UNITS,"helm"),o}convertSeparatorToFasta(t=null){null===t&&(t=s.C._defaultGapSymbolsDict.FASTA);const e=this.getNewColumn("fasta");return e.init((e=>{const n=this.column.get(e),i=this.splitter(n),s=[];for(let e=0;e<i.length;e++){const n=i[e];if(0===n.length)s.push(t);else if(n.length>1){const t="["+n+"]";s.push(t)}else s.push(n)}return s.join("")})),e.setTag(i.TAGS.UNITS,"fasta"),e}convertHelmToFastaSeparator(t,e,n,i){i||(i=this.toFasta(e)?s.C._defaultGapSymbolsDict.FASTA:s.C._defaultGapSymbolsDict.SEPARATOR),n||(n=this.toFasta(e)?"":this.separator);const r=/(R\(|D\(|\)|P)/g,o=t.startsWith("DNA")||t.startsWith("RNA"),a=this.splitter(t),l=[];for(let t=0;t<a.length;t++){let n=a[t];if(o&&(n=n.replace(r,"")),n===s.C._defaultGapSymbolsDict.HELM)l.push(i);else if(this.toFasta(e)&&n.length>1){const t="["+n+"]";l.push(t)}else l.push(n)}return l.join(n)}convertHelm(t,e,n){const i=this.getNewColumn(t,e);i.init((i=>{const s=this.column.get(i);return this.convertHelmToFastaSeparator(s,t,e,n)})),(0,r.Mj)(i);const s=this.stats.sameLength?"SEQ.MSA":"SEQ";return i.setTag("aligned",s),i}convertHelmToSeparator(){return this.getNewColumn("separator")}convert(t,e=null){if(this.notation===t)throw new Error("tgt notation is invalid");if(this.toSeparator(t)&&null===e)throw new Error("tgt separator is not specified");if(this.isFasta()&&this.toSeparator(t)&&null!==e)return this.convertFastaToSeparator(e);if((this.isFasta()||this.isSeparator())&&this.toHelm(t))return this.convertToHelm();if(this.isSeparator()&&this.toFasta(t))return this.convertSeparatorToFasta();if(this.isHelm()&&this.toFasta(t))return this.convertHelm(t);if(this.isHelm()&&this.toSeparator(t))return this.convertHelm(t,e);throw new Error(`Not supported conversion from source notation '${this.notation}' to target notation '${t}'.`)}constructor(t){super(t),this._splitter=null}}},499:(t,e,n)=>{"use strict";n.d(e,{C:()=>h});var i=n(976),s=n(1821),r=n(585),o=n(489),a=n(7228);const l=new class{constructor(){this.uhTemp=`units-handler.${i.SEMTYPE.MACROMOLECULE}`}};class h{static setUnitsToFastaColumn(t){if(t.column.semType!==i.SEMTYPE.MACROMOLECULE||"fasta"!==t.column.getTag(i.TAGS.UNITS))throw new Error(`The column of notation 'fasta' must be '${i.SEMTYPE.MACROMOLECULE}'.`);t.column.setTag(i.TAGS.UNITS,"fasta"),h.setTags(t)}static setUnitsToSeparatorColumn(t,e){if(t.column.semType!==i.SEMTYPE.MACROMOLECULE||"separator"!==t.column.getTag(i.TAGS.UNITS))throw new Error(`The column of notation 'separator' must be '${i.SEMTYPE.MACROMOLECULE}'.`);if(!e)throw new Error("The column of notation 'separator' must have the separator tag.");t.column.setTag(i.TAGS.UNITS,"separator"),t.column.setTag("separator",e),h.setTags(t)}static setUnitsToHelmColumn(t){if(t.column.semType!==i.SEMTYPE.MACROMOLECULE)throw new Error(`The column of notation 'helm' must be '${i.SEMTYPE.MACROMOLECULE}'`);t.column.setTag(i.TAGS.UNITS,"helm"),h.setTags(t)}static setTags(t){const e=t.column.getTag(i.TAGS.UNITS),n=t.stats;if(Object.keys(n.freq).some((t=>t.length>1)),["fasta","separator"].includes(e)){if(0===Object.keys(n.freq).length)throw new Error("Alphabet is empty");const e=n.sameLength?"SEQ.MSA":"SEQ";t.column.setTag("aligned",e);const i=(0,r.w4)(n.freq,s.XS);if(t.column.setTag("alphabet",i),"UN"===i){const e=Object.keys(n.freq).length,i=Object.keys(n.freq).some((t=>t.length>1));t.column.setTag(".alphabetSize",e.toString()),t.column.setTag(".alphabetIsMultichar",i?"true":"false")}}}get units(){return this._units}get column(){return this._column}get notation(){return this._notation}get defaultGapSymbol(){return this._defaultGapSymbol}get separator(){var t;const e=null!==(t=this.column.getTag("separator"))&&void 0!==t?t:void 0;if("separator"===this.notation&&void 0===e)throw new Error(`Separator is mandatory for column '${this.column.name}' of notation '${this.notation}'.`);return e}get aligned(){const t=this.column.getTag("aligned");if(!t&&(this.isFasta()||this.isSeparator()))throw new Error("Tag aligned not set");return t}get alphabet(){const t=this.column.getTag("alphabet");if(!t&&(this.isFasta()||this.isSeparator()))throw new Error("Tag alphabet not set");return t}get helmCompatible(){return this.column.getTag(".isHelmCompatible")}getAlphabetSize(){if("helm"==this.notation||"UN"==this.alphabet){const t=this.column.getTag(".alphabetSize");let e;if(t)e=parseInt(t);else{const t=this.stats;e=Object.keys(t.freq).length}return e}switch(this.alphabet){case"PT":return 20;case"DNA":case"RNA":return 4;case"NT":return console.warn("Unexpected alphabet 'NT'."),4;default:throw new Error(`Unexpected alphabet '${this.alphabet}'.`)}}getAlphabetIsMultichar(){return"helm"===this.notation||"UN"===this.alphabet&&"true"===this.column.getTag(".alphabetIsMultichar")}get splitted(){if(null===this._splitted){const t=this.getSplitter(),e=this._column.length;this._splitted=new Array(e);const n=this._column.getRawData(),i=this._column.categories;for(let s=0;s<e;s++){const e=i[n[s]];this._splitted[s]=t(e)}}return this._splitted}get stats(){if(null===this._stats){const t={};let e=!0,n=null;for(const i of this.splitted){null==n?n=i.length:i.length!==n&&(e=!1);for(const e of i)e in t||(t[e]=0),t[e]+=1}this._stats={freq:t,sameLength:e}}return this._stats}isFasta(){return"fasta"===this.notation}isSeparator(){return"separator"===this.notation}isHelm(){return"helm"===this.notation}isRna(){return"RNA"===this.alphabet}isDna(){return"DNA"===this.alphabet}isPeptide(){return"PT"===this.alphabet}isMsa(){return!!this.aligned&&this.aligned.toUpperCase().includes("MSA")}isHelmCompatible(){return"true"===this.helmCompatible}getNotation(){if(this.units.toLowerCase().startsWith("fasta"))return"fasta";if(this.units.toLowerCase().startsWith("separator"))return"separator";if(this.units.toLowerCase().startsWith("helm"))return"helm";throw new Error(`Column '${this.column.name}' has unexpected notation '${this.units}'.`)}getNewColumn(t,e){const n=this.column,s=n.length,r=t.toLowerCase()+"("+n.name+")",o=n.dataFrame.columns.getUnusedName(r),a=i.Column.fromList("string",o,new Array(s).fill(""));if(a.semType=i.SEMTYPE.MACROMOLECULE,a.setTag(i.TAGS.UNITS,t),"separator"===t){if(!e)throw new Error("Notation 'separator' requires separator value.");a.setTag("separator",e)}a.setTag(i.TAGS.CELL_RENDERER,"Macromolecule");const l=n.getTag("aligned");l&&a.setTag("aligned",l);const h=n.getTag("alphabet");h&&a.setTag("alphabet",h);let c=n.getTag(".alphabetSize");c&&a.setTag(".alphabetSize",c);const u=n.getTag(".alphabetIsMultichar");return void 0!==u&&a.setTag(".alphabetIsMultichar",u),"helm"==t&&(c=this.getAlphabetSize().toString(),a.setTag(".alphabetSize",c)),a}static getNewColumn(t){const e=h.getOrCreate(t),n=e.notation;return e.getNewColumn(n)}static unitsStringIsValid(t){return t=t.toLowerCase(),["fasta","separator","helm"].some((e=>t.startsWith(e.toLowerCase())))}static getNewColumnFromParams(t,e,n){if(!h.unitsStringIsValid(n))throw new Error("Invalid format of 'units' parameter");const s=i.Column.fromList("string",e,new Array(t).fill(""));return s.semType=i.SEMTYPE.MACROMOLECULE,s.setTag(i.TAGS.UNITS,n),s}getSplitter(){return(0,r.Mj)(this._column)}getDistanceFunctionName(){if(!this.isFasta())throw new Error("Only FASTA notation is supported");if(this.isMsa())return o.U.HAMMING;switch(this.alphabet){case"DNA":case"RNA":default:return o.U.LEVENSHTEIN;case"PT":return o.U.NEEDLEMANN_WUNSCH}}getDistanceFunction(){return o.o[this.getDistanceFunctionName()]()}checkHelmCompatibility(){return t=this,e=void 0,i=function*(){if(this.column.tags.has(".isHelmCompatible"))return"true"===this.column.getTag(".isHelmCompatible");const t=(yield(0,a.JN)()).getBioLib().getMonomerSymbolsByType("PEPTIDE".toString()),e=new Set(t),n=(0,r.Ar)(this.separator);for(const t of this.column.categories){const i=n(t);for(const t of i)if(!e.has(t))return this.column.setTag(".isHelmCompatible","false"),!1}return this.column.setTag(".isHelmCompatible","true"),!0},new((n=void 0)||(n=Promise))((function(s,r){function o(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}l((i=i.apply(t,e||[])).next())}));var t,e,n,i}constructor(t){this._splitted=null,this._stats=null,this._column=t;const e=this._column.getTag(i.TAGS.UNITS);if(null==e)throw new Error("Units are not specified in column");if(this._units=e,this._notation=this.getNotation(),this._defaultGapSymbol=this.isFasta()?h._defaultGapSymbolsDict.FASTA:this.isHelm()?h._defaultGapSymbolsDict.HELM:h._defaultGapSymbolsDict.SEPARATOR,!this.column.tags.has("aligned")||!this.column.tags.has("alphabet")||!this.column.tags.has(".alphabetIsMultichar")&&!this.isHelm()&&"UN"===this.alphabet)if(this.isFasta())h.setUnitsToFastaColumn(this);else if(this.isSeparator()){const e=t.getTag("separator");h.setUnitsToSeparatorColumn(this,e)}else{if(!this.isHelm())throw new Error(`Unexpected units '${this.column.getTag(i.TAGS.UNITS)}'.`);h.setUnitsToHelmColumn(this)}if(!this.column.tags.has(".alphabetIsMultichar"))if(this.isHelm())this.column.setTag(".alphabetIsMultichar","true");else if(["UN"].includes(this.alphabet))throw new Error(`For column '${this.column.name}' of alphabet '${this.alphabet}' tag '.alphabetIsMultichar' is mandatory.`)}static getOrCreate(t){return l.uhTemp in t.temp||(t.temp[l.uhTemp]=new h(t)),t.temp[l.uhTemp]}}h._defaultGapSymbolsDict={HELM:"*",SEPARATOR:"",FASTA:"-"}},9298:(t,e,n)=>{"use strict";var i,s,r,o,a;n.d(e,{CI:()=>h,Ct:()=>a,DX:()=>c,ES:()=>i,dE:()=>o,iD:()=>r,vS:()=>l,vw:()=>s}),function(t){t.Entropy="Entropy",t.full="100%"}(i||(i={})),function(t){t.TOP="top",t.MIDDLE="middle",t.BOTTOM="bottom"}(s||(s={})),function(t){t.LEFT="left",t.CENTER="center",t.RIGHT="right"}(r||(r={})),function(t){t.AUTO="auto",t.ON="on",t.OFF="off"}(o||(o={})),function(t){t.Filtered="Filtered",t.Selected="Selected"}(a||(a={}));const l=new class{constructor(){this.sequenceColumnName=null,this.startPositionName=null,this.endPositionName=null,this.skipEmptySequences=!0,this.skipEmptyPositions=!1,this.shrinkEmptyTail=!0,this.backgroundColor=4294967295,this.positionHeight=i.full,this.positionWidth=16,this.verticalAlignment=s.MIDDLE,this.horizontalAlignment=r.CENTER,this.fixWidth=!1,this.fitArea=!0,this.minHeight=50,this.maxHeight=100,this.positionMarginState=o.AUTO,this.positionMargin=0,this.filterSource=a.Filtered}},h=", ";var c;!function(t){t.positionNames=".positionNames"}(c||(c={}))},2669:(t,e,n)=>{"use strict";n.d(e,{m:()=>i});class i{constructor(t=!0,e=!0){const i=navigator.hardwareConcurrency;this._workerCount=t?Math.max(i-2,1):1,this._workers=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(18),n.b)))),this._terminateOnComplete=e}async calc(t,e,n=!0){return new Promise((async(i,s)=>{try{const s=t.length,r=new Array(this._workerCount),o=s*(s-1)/2;this._workerCount=Math.min(this._workerCount,o);const a=o/this._workerCount,l=new Float32Array(o);let h=0,c=1,u=0,m=Number.MIN_VALUE;for(let n=0;n<this._workerCount;n++){const i=Math.floor(n*a),d=n===this._workerCount-1?o:Math.floor((n+1)*a),f=h,p=c;n!==this._workerCount-1&&(h=s-2-Math.floor(Math.sqrt(-8*d+4*s*(s-1)-7)/2-.5),c=d-s*h+Math.floor((h+1)*(h+2)/2)),this._workers[n].postMessage({values:t,fnName:e,startRow:f,startCol:p,chunckSize:d-i}),r[n]=new Promise(((t,e)=>{this._workers[n].onmessage=({data:{error:s,distanceMatrixData:r,min:o,max:a}})=>{this._terminateOnComplete&&this._workers[n].terminate(),s?e(s):(l.set(r,i),o<u&&(u=o),a>m&&(m=a),t())}}))}await Promise.all(r),n&&l.forEach(((t,e)=>{l[e]=(t-u)/(m-u)})),i(l)}catch(t){s(t)}}))}terminate(){this._workers.forEach((t=>t.terminate()))}}},3914:(t,e,n)=>{"use strict";n.d(e,{H:()=>s});var i=n(6814);class s{get data(){return this._data}get size(){return this._size}constructor(t,e){if(null==e){if(null==t)throw new Error("Arguments error: data or size is required.");if(this._data=t,this._size=(1+Math.sqrt(1+8*this._data.length))/2,this._size!=Math.floor(this._size))throw new Error(`Invalid data length ${this._data.length} leads to non integer size ${this._size}`)}else{this._size=e;const n=e*(e-1)/2;if(t){if(t.length!=n)throw new Error(`Invalid data length. Observations size ${e} requires data length ${n}.`);this._data=t}else this._data=new Float32Array(n)}}_linearizeIJ(t,e){if(!(t<e))throw new Error("i must be less than j");return this._size*t+e-Math.floor((t+2)*(t+1)/2)}get(t,e){return t==e?0:t<e?this._data[this._linearizeIJ(t,e)]:this._data[this._linearizeIJ(e,t)]}set(t,e,n){this._data[this._linearizeIJ(t,e)]=n}static calc(t,e){const n=t.length,r=new s(void 0,n);for(let s=0;s<n;s++)for(let o=s+1;o<n;o++)r.set(s,o,(0,i.k)(t[s])||(0,i.k)(t[o])?1:e(t[s],t[o]));return r}square(){for(let t=0;t<this._data.length;t++)this._data[t]=this._data[t]**2}add(t){if(this._size!==t._size)throw new Error(`Matrices must have the same size. This size: ${this._size}, other size: ${t._size}`);for(let e=0;e<this._data.length;e++)this._data[e]+=t._data[e]}sqrt(){for(let t=0;t<this._data.length;t++)this._data[t]=Math.sqrt(this._data[t])}normalize(){let t=0,e=this._data[0];for(let n=0;n<this._data.length;n++)this._data[n]<t&&(t=this._data[n]),this._data[n]>e&&(e=this._data[n]);const n=e-t;for(let i=0;i<this._data.length;i++)this._data[i]=0===n?this._data[i]-t:(this._data[i]-t)/(e-t)}}},6254:(t,e,n)=>{"use strict";function i(t,e){const n=s(e);function i(t,e){const i=Number(t),s=Number(e);return n(i,s)}const r={get:(t,n,s)=>"length"===n?e:new Proxy(t,function(t){return{get:(e,n,s)=>t===n?0:e[Number(t)>Number(n)?i(n,t):i(t,n)]}}(n))};return new Proxy(t,r)}function s(t){return(e,n)=>t*e+n-Math.floor((e+2)*(e+1)/2)}n.d(e,{_:()=>i,y:()=>s})},6814:(t,e,n)=>{"use strict";n.d(e,{k:()=>i});const i=t=>null==t},5697:(t,e,n)=>{"use strict";n.d(e,{Dz:()=>p,KR:()=>o,MI:()=>y,NB:()=>u,Om:()=>b,Rt:()=>r,UX:()=>c,WI:()=>h,Zd:()=>l,_h:()=>a,aW:()=>d,bX:()=>v,fX:()=>g,kg:()=>s,s:()=>m,yU:()=>f});var i=n(1040);i.gk.Tanimoto,i.gk.Dice,i.gk.Asymmetric,i.gk.BraunBlanquet,i.gk.Cosine,i.gk.Kulczynski,i.gk.McConnaughey,i.gk.RogotGoldberg,i.gk.Russel,i.gk.Sokal,i.gk.Hamming,i.gk.Euclidean,i.gk.Tanimoto,i.gk.Dice,i.gk.Asymmetric,i.gk.BraunBlanquet,i.gk.Cosine,i.gk.Kulczynski,i.gk.McConnaughey,i.gk.RogotGoldberg,i.gk.Russel,i.gk.Sokal,i.gk.Hamming,i.gk.Euclidean;const s=[i.gk.Tanimoto,i.gk.Dice,i.gk.Cosine],r=[i.gk.Tanimoto,i.gk.Asymmetric,i.gk.Cosine,i.gk.Sokal];function o(t,e){return w(function(t,e){const n=t.trueCount()+e.trueCount();if(0==n)return 1;const i=t.andWithCountBits(e,!0);return i/(n-i)}(t,e))}function a(t,e){return w(function(t,e){const n=t.trueCount()+e.trueCount();return 0==n?0:2*t.andWithCountBits(e,!0)/n}(t,e))}function l(t,e){return w(function(t,e){const n=t.trueCount()*e.trueCount();return 0==n?0:t.andWithCountBits(e,!0)/Math.sqrt(n)}(t,e))}function h(t,e){return Math.sqrt(t.trueCount()+e.trueCount()-2*t.andWithCountBits(e,!0))}function c(t,e){return t.trueCount()+e.trueCount()-2*t.andWithCountBits(e,!0)}function u(t,e){return w(function(t,e){const n=t.trueCount()+e.trueCount(),i=t.andWithCountBits(e,!0);return i/(2*n-3*i)}(t,e))}function m(t,e){return w(function(t,e){const n=t.trueCount()+e.trueCount(),i=t.trueCount()*e.trueCount();return 0==i?0:t.andWithCountBits(e,!0)*n/(2*i)}(t,e))}function d(t,e){return w(function(t,e){const n=t.trueCount()+e.trueCount(),i=t.trueCount()*e.trueCount();return 0==i?0:(t.andWithCountBits(e,!0)*n-i)/i}(t,e))}function f(t,e){return w(function(t,e){const n=Math.min(t.trueCount(),e.trueCount());return 0==n?0:t.andWithCountBits(e,!0)/n}(t,e))}function p(t,e){return w(function(t,e){const n=Math.max(t.trueCount(),e.trueCount());return 0==n?0:t.andWithCountBits(e,!0)/n}(t,e))}function g(t,e){return w(function(t,e){return 0==t.length?0:t.andWithCountBits(e,!0)/t.length}(t,e))}function y(t,e){return w(function(t,e){const n=t.andWithCountBits(e,!0),i=t.countBits(!0)+e.countBits(!0),s=t.length,r=s-i+n;return n==s||r==s?1:n/i+r/(2*s-i)}(t,e))}function b(t){return 1/(1+t)}function w(t){return 1/t-1}function v(t,e){return Math.abs(t-e)}},779:(t,e,n)=>{"use strict";function i(){return(t,e)=>{let n=0;t.length!==e.length&&(n=Math.abs(t.length-e.length));let i=0;for(let n=0;n<Math.min(t.length,e.length);n++)t[n]!==e[n]&&i++;return i+=n,i/=Math.max(t.length,e.length),i}}n.d(e,{j:()=>i})},489:(t,e,n)=>{"use strict";n.d(e,{U:()=>i.U,o:()=>i.o});var i=n(5540)},458:(t,e,n)=>{"use strict";n.d(e,{r:()=>s});var i=n(1811);function s(){return(t,e)=>(0,i.T)(t,e)/Math.max(t.length,e.length)}},5540:(t,e,n)=>{"use strict";n.d(e,{U:()=>i,o:()=>a});var i,s=n(779),r=n(458),o=n(6683);!function(t){t.HAMMING="Hamming",t.LEVENSHTEIN="Levenshtein",t.NEEDLEMANN_WUNSCH="Needlemann-Wunsch"}(i||(i={}));const a={[i.HAMMING]:s.j,[i.LEVENSHTEIN]:r.r,[i.NEEDLEMANN_WUNSCH]:o.n}},6683:(t,e,n)=>{"use strict";n.d(e,{n:()=>s});const i={gapOpen:8,gapExtend:2,scoringMatrix:[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0,-4],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1,-4],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1,-4],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1,-4],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2,-4],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1,-4],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1,-4],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1,-4],[-1,-3,-3,-3,-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:4,Q:5,E:6,G:7,H:8,I:9,L:10,K:11,M:12,F:13,P:14,S:15,T:16,W:17,Y:18,V:19,B:20,Z:21,X:22,"*":23}};function s(t){return(e,n)=>{const{gapOpen:s,gapExtend:r,scoringMatrix:o,alphabetIndexes:a}={...i,...t},l=[new Array(e.length+1).fill(0),new Array(e.length+1).fill(0)],h=new Array(e.length+1).fill(!1),c=new Array(e.length+1).fill(!1);let u=0,m=1;for(let t=1;t<e.length+1;t++)l[0][t]=-s-(t-1)*r;for(let t=1;t<n.length+1;t++){l[m][0]=-s-(t-1)*r;for(let i=1;i<e.length+1;i++){const d=l[u][i-1]+o[a[e[i-1]]][a[n[t-1]]],f=l[u][i]-(h[i]?r:s),p=l[m][i-1]-(c[i-1]?r:s);l[m][i]=Math.max(d,p,f),l[m][i]===d?(h[i]=!1,c[i]=!1):l[m][i]===p?(h[i]=!1,c[i]=!0):(h[i]=!0,c[i]=!1)}u=m,m=(m+1)%2}const d=e.split("").map((t=>o[a[t]][a[t]])).reduce(((t,e)=>t+e),0),f=n.split("").map((t=>o[a[t]][a[t]])).reduce(((t,e)=>t+e),0),p=Math.max(d,f);return(p-l[u][e.length])/p}}},116:(t,e,n)=>{"use strict";var i;n.d(e,{AL:()=>i,aP:()=>r,bD:()=>s}),n(4221),n(7659),n(3659),n(850),n(9006),n(7861),n(9657),n(2669),n(3914),n(6254),function(t){t.UMAP="UMAP",t.T_SNE="t-SNE"}(i||(i={}));class s{constructor(){this.learningRate={uiName:"Learinig rate",value:1,tooltip:"The initial learning rate for the embedding optimization"},this.nComponents={uiName:"Components",value:2,tooltip:"The number of components (dimensions) to project the data to"},this.nEpochs={uiName:"Epochs",value:0,tooltip:"The number of epochs to optimize embeddings via SGD. Computed automatically if set to 0"},this.nNeighbors={uiName:"Neighbors",value:15,tooltip:"The number of nearest neighbors to construct the fuzzy manifold"},this.spread={uiName:"Spread",value:1,tooltip:"The effective scale of embedded points, used with min distance to control the clumped/dispersed nature of the embedding"},this.minDist={uiName:"Min distance",value:.1,tooltip:"The effective minimum distance between embedded points, used with spread to control the clumped/dispersed nature of the embedding"}}}class r{constructor(){this.epsilon={uiName:"Epsilon",value:10,tooltip:"Epsilon is learning rate"},this.perplexity={uiName:"Perplexity",value:30,tooltip:"Roughly how many neighbors each point influences"},this.dim={uiName:"Dimensionality",value:2,tooltip:"Dimensionality of the embedding"}}}},9006:(t,e,n)=>{"use strict";n.d(e,{Ek:()=>l,a1:()=>a,nR:()=>h});var i=n(850),s=n(4588),r=n(6254),o=n(2669);class a{constructor(t){this.steps=t?.steps??0,this.cycles=t?.cycles??1e6,this.cutoff=t?.cutoff??0,this.lambda=t?.lambda??2,this.dlambda=t?.dlambda??.01,this.lambda2=this.lambda/2,this.dlambda2=this.dlambda/2,this.epsilon=t?.epsilon??1e-10,this.distanceFunction=t?.distance??i.dP,this.distance=new Float32Array,this.distanceFunctionName=t?.distanceFunctionName}async initDistance(t){this.dmIndexFunct=(0,r.y)(t.length);const e=new o.m(!0,!1);this.distance=await e.calc(t,this.distanceFunctionName),e.terminate()}calcDistance(t,e,n){return this.distance[this.dmIndexFunct(e,n)]}async embed(t){const e=t.length,n=(0,i.kO)(e,a.dimension,40);let r=this.lambda2;0===this.steps&&(this.steps=t.length-1),await this.initDistance(t);for(let o=0;o<this.cycles;++o){for(let o=0;o<this.steps;++o){const o=(0,s.I)(e);let a=(0,s.I)(e);for(;o==a;)a=(0,s.I)(e);const l=n[o],h=n[a],c=this.calcDistance(t,o,a),u=(0,i.dP)(l,h);if(0==this.cutoff||c<=this.cutoff||u<c){const t=r*(c-u)/(u+this.epsilon),e=(0,i.On)(l,h,-1);n[o]=(0,i.On)(l,e,t),n[a]=(0,i.On)(h,e,-t)}}if(r-=this.dlambda2,r<=0)break}return n}}a.dimension=2;class l extends a{async embed(t){const e=t.length,n=(0,i.kO)(e,l.dimension,40);let r=this.lambda;await this.initDistance(t);for(let o=0;o<this.cycles;++o){const o=(0,s.I)(e),a=n[o];for(let s=0;s<e;++s){if(o==s)continue;const e=n[s],l=this.calcDistance(t,o,s),h=(0,i.dP)(a,e);if(0==this.cutoff||l<=this.cutoff||h<l){const t=r*(l-h)/(h+this.epsilon),o=(0,i.On)(a,e,-1);n[s]=(0,i.On)(e,o,-t)}}if(r-=this.dlambda,r<=0)break}return n}}class h extends a{constructor(t){super(t),this.cycles=t?.cycles??1e3,this.steps=t?.steps??1e5,this.radiusPercent=t?.radiusPercent??1,this.maxDistance=t?.maxDistance??null,this.maxDistanceSteps=t?.maxDistanceSteps??null}async embed(t){const e=t.length,n=(0,i.kO)(e,h.dimension,40);if(await this.initDistance(t),null===this.maxDistanceSteps&&(this.maxDistanceSteps=e*Math.floor((e-1)/2)),null===this.maxDistance){this.maxDistance=-1e37;for(let n=0;n<this.maxDistanceSteps;n++){const n=(0,s.I)(e);let i=(0,s.I)(e);for(;n==i;)i=(0,s.I)(e);const r=this.calcDistance(t,n,i);r>this.maxDistance&&(this.maxDistance=r)}}let r=this.lambda;const o=0==this.radiusPercent?this.maxDistance:this.maxDistance*this.radiusPercent;for(let a=0;a<this.cycles;++a){for(let a=0;a<this.steps;++a){const a=(0,s.I)(e);let l=(0,s.I)(e);for(;a==l;)l=(0,s.I)(e);const h=n[a],c=n[l],u=this.calcDistance(t,a,l),m=(0,i.dP)(h,c);if(u<=o||m<u){const t=.5*r*(u-m)/(m+this.epsilon),e=(0,i.On)(h,c,-1);n[a]=(0,i.On)(h,e,t),n[l]=(0,i.On)(c,e,-t)}}if(r-=(this.lambda-this.dlambda)/(this.cycles-1),r<this.dlambda)break}return n}}},1040:(t,e,n)=>{"use strict";var i,s,r,o,a;n.d(e,{CF:()=>s,Qe:()=>o,W:()=>i,Yc:()=>a,gk:()=>r}),function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan"}(i||(i={})),function(t){t.Euclidean="Euclidean"}(s||(s={})),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"}(r||(r={})),function(t){t.Vector="Vector",t.String="String",t.BitArray="BitArray",t.MacroMolecule="MacroMolecule",t.Number="Number"}(o||(o={})),function(t){t.NumericDistance="NumericDistance"}(a||(a={}))},7861:(t,e,n)=>{"use strict";var i=n(1811),s=n(3979),r=n(5697),o=n(850),a=n(489),l=n(1040);const h={[l.CF.Euclidean]:o.dP},c={[l.W.Levenshtein]:i.T,[l.W.JaroWinkler]:s.H$,[l.W.Manhattan]:function(t,e){if(t.length!==e.length)return 1;{let n=0;for(let i=1;i<t.length;i++)n+=t[i]==e[i]?0:1;return n/t.length}}},u={[l.gk.Tanimoto]:r.KR,[l.gk.Dice]:r._h,[l.gk.Asymmetric]:r.yU,[l.gk.BraunBlanquet]:r.Dz,[l.gk.Cosine]:r.Zd,[l.gk.Kulczynski]:r.s,[l.gk.McConnaughey]:r.aW,[l.gk.RogotGoldberg]:r.MI,[l.gk.Russel]:r.fX,[l.gk.Sokal]:r.NB,[l.gk.Hamming]:r.UX,[l.gk.Euclidean]:r.WI},m={[l.Yc.NumericDistance]:r.bX},d={[l.Qe.Vector]:{[l.CF.Euclidean]:h[l.CF.Euclidean]},[l.Qe.String]:{[l.W.Levenshtein]:c[l.W.Levenshtein],[l.W.JaroWinkler]:c[l.W.JaroWinkler],[l.W.Manhattan]:c[l.W.Manhattan]},[l.Qe.BitArray]:{[l.gk.Tanimoto]:u[l.gk.Tanimoto],[l.gk.Dice]:u[l.gk.Dice],[l.gk.Asymmetric]:u[l.gk.Asymmetric],[l.gk.BraunBlanquet]:u[l.gk.BraunBlanquet],[l.gk.Cosine]:u[l.gk.Cosine],[l.gk.Kulczynski]:u[l.gk.Kulczynski],[l.gk.McConnaughey]:u[l.gk.McConnaughey],[l.gk.RogotGoldberg]:u[l.gk.RogotGoldberg],[l.gk.Russel]:u[l.gk.Russel],[l.gk.Sokal]:u[l.gk.Sokal]},[l.Qe.MacroMolecule]:{[a.U.HAMMING]:a.o[a.U.HAMMING],[a.U.LEVENSHTEIN]:a.o[a.U.LEVENSHTEIN],[a.U.NEEDLEMANN_WUNSCH]:a.o[a.U.NEEDLEMANN_WUNSCH]},[l.Qe.Number]:{[l.Yc.NumericDistance]:m[l.Yc.NumericDistance]}};Object.keys(d).reduce(((t,e)=>{for(const n of Object.keys(d[e]))t[n]=e;return t}),{})},9657:(t,e,n)=>{"use strict";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,s=i._createBuffer(n);if(e)for(let t=0;t<s.length;t++)s[t]=-1;this._data=s,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 s=t.lengthInInts;for(let i=0;i<s;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 s=0,r=0;for(;e-r>=4;)n._data[s++]=255&t[r]|(255&t[r+1])<<8|(255&t[r+2])<<16|(255&t[r+3])<<24,r+=4;return e-r==3&&(n._data[s]=(255&t[r+2])<<16),e-r==2&&(n._data[s]|=(255&t[r+1])<<8),e-r==1&&(n._data[s]|=255&t[r]),n._version=0,n}toString(){return`${this._length} bits, ${this.countBits(!0)} set`}equals(t){if(this==t)return!0;if(null==t)return!1;if(this._length!=t._length)return!1;if(0==this._length)return!0;for(let e=0;e<this._data.length-1;e++)if(this._data[e]!=t._data[e])return!1;for(let e=8*(this._data.length-1);e<this._length;e++)if(this.getBit(e)!=t.getBit(e))return!1;return!0}clone(){const t=new i(0,!1);return t._data=Uint32Array.from(this._data),t._length=this._length,t._version=this._version,t}init(t,e){this.setAll(!1,!1);for(let e=0;e<this._length;e++)t(e)&&(this._data[Math.floor(e/32)]|=1<<(e%32&31));return this.incrementVersion(e),this}invert(t=!0){for(let t=0;t<this._data.length;t++)this._data[t]^=-1;this.incrementVersion(t)}setAll(t,e=!1){const n=t?-1:0,i=this.lengthInInts;for(let t=0;t<i;t++)this._data[t]=n;this.incrementVersion(e)}setIndexes(t,e=!0,n=!0,i=!0){n&&this.setAll(!e,!1);for(const n of t)this.setFast(n,e);this.incrementVersion(i)}everyIndex(t,e=!0){for(const n of t)if(this.getBit(n)!=e)return!1;return!0}anyIndex(t,e=!0){for(const n of t)if(this.getBit(n)==e)return!0;return!1}setWhere(t,e=!0,n=!0,i=!0,s=!0){if(n&&s&&this.setAll(!e,!1),s)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 s=Math.min(t,e),r=Math.max(t,e);if(n)for(let t=s;t<=r;t++)this.setTrue(t);else for(let t=s;t<=r;t++)this.setFalse(t);return this.incrementVersion(i),this}setRandom(t,e,n=!0){if(t<0||t>this._length)throw new Error("n must be >= 0 && <= Count");t>this._length/2&&this.setRandom(this._length-t,!e),this.setAll(!e);for(let n=0;n<t;){const t=Math.floor(Math.random()*this._length);this.getBit(t)!=e&&(this.setFast(t,e),n++)}this.incrementVersion(n)}and(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]&=t._data[e];return this.incrementVersion(e),this}andNot(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");const n=this.lengthInInts;for(let e=0;e<n;e++)this._data[e]&=~t._data[e];return this.incrementVersion(e),this}notAnd(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]=~this._data[e]&t._data[e];return this.incrementVersion(e),this}not(t=!0){for(let t=0,e=this.lengthInInts;t<e;t++)this._data[t]=~this._data[t];return this.incrementVersion(t),this}or(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]|=t._data[e];return this.incrementVersion(e),this}xor(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]^=t._data[e];return this.incrementVersion(e),this}insertAt(t,e,n=!1){if(this.assureInRange(t,0,this._length,"pos"),0==e)return;const i=this._length;this.setLength(this._length+e);for(let n=i-1;n>=t;n--)this.setBit(n+e,this.getBit(n));for(let i=t;i<t+e;i++)this.setBit(i,n)}removeAt(t,e=1){if(e<0)throw new Error("n cannot be negative");if(this.assureInRange(t,0,this._length-e,"pos"),this.contains(!0))for(let n=t;n<this._length-e;n++)this.setBit(n,this.getBit(n+e));this.setLength(this._length-e)}removeByMask(t,e=!0){if(this._length!=t.length)throw new Error("length != mask.length");if(t==this)this.setLength(t.countBits(!e)),this.setAll(!e);else{let n=0;for(let i=-1;-1!=(i=t.findNext(i,!e));)this.setFast(n++,this.getBit(i));this._length=n,this._version++}return this}getBit(t){return 0!=(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 s=31&this._length;for(0!=s&&(n&=~(4294967295<<s));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 s=this.lengthInInts;let r=0;for(;r<s-1;r++)for(let e=this._data[r]&t._data[r];0!=e;e>>>=8)n+=i._onBitCount[255&e];let o=this._data[r]&t._data[r];const a=31&this._length;for(0!=a&&(o&=~(4294967295<<a));0!=o;o>>>=8)n+=i._onBitCount[255&o];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 s=this.lengthInInts;for(let r=Math.floor(t/32);r<s;r++){let s=e?this._data[r]:~this._data[r];if(0!=n)s&=4294967295<<n&4294967295,n=0;else if(!e&&-4294967296==s)continue;for(let e=0;0!=s;e+=8,s>>>=8){const n=i._firstOnBit[255&s];if(n>=0)return(t=n+32*r+e)>=this._length?-1:t}}return-1}findPrev(t,e=!0){if(0==t)return-1;this.assureInRange(t,-1,this._length,"index");let n=1+(t=t<0?this._length-1:t-1)&31;for(let s=Math.floor(t/32);s>=0;s--){let t=e?this._data[s]:~this._data[s];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*s+e}}return-1}}i._onBitCount=Int8Array.from([0,1,1,2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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])},4588:(t,e,n)=>{"use strict";function i(t){return Math.random()*t}function s(t){return Math.floor(i(t))}n.d(e,{I:()=>s,t:()=>i})},8518:(t,e,n)=>{"use strict";n.d(e,{L:()=>s});var i=n(4588);function s(t,e,n){function s(t,e){let n=null,i=null;for(const s of t){const t=e(s);(null==i||t>i)&&(n=s,i=t)}return n}const r=[(0,i.I)(t-1)],o=new Set;for(let e=0;e<t;++e)r.includes(e)||o.add(e);for(;r.length<e;){const t=s(o.values(),(t=>Math.min.apply(Math,r.map((function(e,i){return n(t,e)})))));null!=t&&(r.push(t),o.delete(t))}return r}},1061:(t,e,n)=>{"use strict";n.d(e,{gw:()=>r}),n(4469),n(976);var i,s=function(t,e,n,i){return new(n||(n=Promise))((function(s,r){function o(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}l((i=i.apply(t,e||[])).next())}))};function r(t){return s(this,void 0,void 0,(function*(){yield new Promise((e=>setTimeout(e,t)))}))}!function(t){t.notNull=function(t,e){if(null==t)throw new Error(`${null==e?"Value":e} not defined`)}}(i||(i={}))},3659:(t,e,n)=>{"use strict";n.d(e,{OW:()=>i});class i extends Float32Array{}},850:(t,e,n)=>{"use strict";n.d(e,{Fv:()=>h,On:()=>o,dP:()=>l,hu:()=>r,kO:()=>a});var i=n(3659),s=n(4588);function r(t=!1,e="Assertion error."){if(!t)throw new Error(e)}function o(t,e,n=1){const s=t.length;r(s==e.length,"Vector lengths do not match.");const o=new i.OW(s);for(let i=0;i<t.length;++i)o[i]=t[i]+n*e[i];return o}function a(t,e,n=1){const r=function(t,e,n=0){return new Array(t).fill(n).map((()=>new i.OW(e).fill(n)))}(t,e);for(let i=0;i<t;++i)for(let t=0;t<e;++t)r[i][t]=(0,s.t)(n);return r}function l(t,e){const n=function(t){let e=0;for(let n=0;n<t.length;++n)e+=t[n];return e}(function(t){const e=t.length,n=new i.OW(e);for(let e=0;e<t.length;++e)n[e]=t[e]*t[e];return n}(o(t,e,-1)));return Math.sqrt(n)}function h(t){let e=0,n=0;for(let n=0;n<t.length;++n)e+=t[n];e/=t.length;for(let i=0;i<t.length;++i)n+=(t[i]-e)*(t[i]-e);n=Math.sqrt(n/t.length);for(let i=0;i<t.length;++i)t[i]=(t[i]-e)/n;return t}},7659:(t,e,n)=>{"use strict";e.Z=void 0;var i=n(6215);Object.defineProperty(e,"Z",{enumerable:!0,get:function(){return i.TSNE}})},6215:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TSNE=void 0,e.TSNE=class{constructor(t){this.returnV=!1,this.vValue=0,this.iter=0,t=t||{},this.perplexity=this.getopt(t,"perplexity",30),this.dim=this.getopt(t,"dim",2),this.epsilon=this.getopt(t,"epsilon",10)}assert(t,e){if(!t)throw e||"Assertion failed"}getopt(t,e,n){return t.hasOwnProperty(e)?t[e]:n}gaussRandom(){if(this.returnV)return this.returnV=!1,this.vValue;const t=2*Math.random()-1,e=2*Math.random()-1,n=t*t+e*e;if(0===n||n>1)return this.gaussRandom();const i=Math.sqrt(-2*Math.log(n)/n);return this.vValue=e*i,this.returnV=!0,t*i}randn(t,e){return t+this.gaussRandom()*e}zeros(t){if(void 0===t||isNaN(t))return[];if("undefined"==typeof ArrayBuffer){const e=new Array(t);for(let n=0;n<t;n++)e[n]=0;return e}return new Float64Array(t)}randn2d(t,e,n){const i=void 0!==n,s=[];for(let r=0;r<t;r++){const t=[];for(let s=0;s<e;s++)i?t.push(n):t.push(this.randn(0,1e-4));s.push(t)}return s}L2(t,e){const n=t.length;let i=0;for(let s=0;s<n;s++){const n=t[s],r=e[s];i+=(n-r)*(n-r)}return i}xtod(t){const e=t.length,n=this.zeros(e*e);for(let i=0;i<e;i++)for(let s=i+1;s<e;s++){const r=this.L2(t[i],t[s]);n[i*e+s]=r,n[s*e+i]=r}return n}d2p(t,e,n){const i=Math.sqrt(t.length),s=Math.floor(i);this.assert(s===i,"D should have square number of elements.");const r=Math.log(e),o=this.zeros(s*s),a=this.zeros(s);for(let e=0;e<s;e++){let i=-1/0,l=1/0,h=1,c=!1;const u=50;let m=0;for(;!c;){let o=0;for(let n=0;n<s;n++){let i=Math.exp(-t[e*s+n]*h);e===n&&(i=0),a[n]=i,o+=i}let d=0;for(let t=0;t<s;t++){let e;e=0===o?0:a[t]/o,a[t]=e,e>1e-7&&(d-=e*Math.log(e))}d>r?(i=h,l===1/0?h*=2:h=(h+l)/2):(l=h,i===-1/0?h/=2:h=(h+i)/2),m++,Math.abs(d-r)<n&&(c=!0),m>=u&&(c=!0)}for(let t=0;t<s;t++)o[e*s+t]=a[t]}const l=this.zeros(s*s),h=2*s;for(let t=0;t<s;t++)for(let e=0;e<s;e++)l[t*s+e]=Math.max((o[t*s+e]+o[e*s+t])/h,1e-100);return l}sign(t){return t>0?1:t<0?-1:0}initDataRaw(t){const e=t.length,n=t[0].length;this.assert(e>0," X is empty? You must have some data!"),this.assert(n>0," X[0] is empty? Where is the data?");const i=this.xtod(t);this.P=this.d2p(i,this.perplexity,1e-4),this.N=e,this.initSolution()}initDataDist(t){const e=t.length;this.assert(e>0," X is empty? You must have some data!");const n=this.zeros(e*e);for(let i=0;i<e;i++)for(let s=i+1;s<e;s++){const r=t[i][s];n[i*e+s]=r,n[s*e+i]=r}this.P=this.d2p(n,this.perplexity,1e-4),this.N=e,this.initSolution()}initSolution(){this.Y=this.randn2d(this.N,this.dim),this.gains=this.randn2d(this.N,this.dim,1),this.ystep=this.randn2d(this.N,this.dim,0),this.iter=0}getSolution(){return this.Y}step(){this.iter+=1;const t=this.N,e=this.costGrad(this.Y),n=e.cost,i=e.grad,s=this.zeros(this.dim);for(let e=0;e<t;e++)for(let t=0;t<this.dim;t++){const n=i[e][t],r=this.ystep[e][t],o=this.gains[e][t];let a=this.sign(n)===this.sign(r)?.8*o:o+.2;a<.01&&(a=.01),this.gains[e][t]=a;const l=(this.iter<250?.5:.8)*r-this.epsilon*a*i[e][t];this.ystep[e][t]=l,this.Y[e][t]+=l,s[t]+=this.Y[e][t]}for(let e=0;e<t;e++)for(let n=0;n<this.dim;n++)this.Y[e][n]-=s[n]/t;return n}debugGrad(){const t=this.N,e=this.costGrad(this.Y),n=(e.cost,e.grad),i=1e-5;for(let e=0;e<t;e++)for(let t=0;t<this.dim;t++){const s=this.Y[e][t];this.Y[e][t]=s+i;const r=this.costGrad(this.Y);this.Y[e][t]=s-i;const o=this.costGrad(this.Y),a=n[e][t],l=(r.cost-o.cost)/(2*i);console.log(e+","+t+": gradcheck analytic: "+a+" vs. numerical: "+l),this.Y[e][t]=s}}costGrad(t){const e=this.N,n=this.dim,i=this.P,s=this.iter<100?4:1,r=this.zeros(e*e);let o=0;for(let i=0;i<e;i++)for(let s=i+1;s<e;s++){let a=0;for(let e=0;e<n;e++){const n=t[i][e]-t[s][e];a+=n*n}const l=1/(1+a);r[i*e+s]=l,r[s*e+i]=l,o+=2*l}const a=e*e,l=this.zeros(a);for(let t=0;t<a;t++)l[t]=Math.max(r[t]/o,1e-100);let h=0;const c=[];for(let o=0;o<e;o++){const a=new Array(n);for(let t=0;t<n;t++)a[t]=0;for(let c=0;c<e;c++){h+=-i[o*e+c]*Math.log(l[o*e+c]);const u=4*(s*i[o*e+c]-l[o*e+c])*r[o*e+c];for(let e=0;e<n;e++)a[e]+=u*(t[o][e]-t[c][e])}c.push(a)}return{cost:h,grad:c}}}},9564:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(7537),s=n.n(i),r=n(3645),o=n.n(r)()(s());o.push([t.id,".kalign-version {\n margin-bottom: 0;\n text-align: end;\n font-size: 12px;\n opacity: 0.8;\n}","",{version:3,sources:["webpack://./css/msa.css"],names:[],mappings:"AAAA;IACI,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,YAAY;AAChB",sourcesContent:[".kalign-version {\n margin-bottom: 0;\n text-align: end;\n font-size: 12px;\n opacity: 0.8;\n}"],sourceRoot:""}]);const a=o},9414:(t,e,n)=>{"use strict";n.d(e,{Z:()=>a});var i=n(7537),s=n.n(i),r=n(3645),o=n.n(r)()(s());o.push([t.id,".scatter_plot_link {\n position: absolute!important;\n right: 10px;\n}\n\n.cliffs_grid {\n top: 10px;\n}\n\n.show_only_cliffs {\n top: 30px;\n}\n\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings {\n font-size: 18px;\n position: absolute;\n height: 28px;\n}\n","",{version:3,sources:["webpack://./node_modules/@datagrok-libraries/ml/css/styles.css"],names:[],mappings:"AAAA;IACI,4BAA4B;IAC5B,WAAW;AACf;;AAEA;IACI,SAAS;AACb;;AAEA;IACI,SAAS;AACb;;AAEA;IACI,eAAe;IACf,kBAAkB;IAClB,YAAY;AAChB",sourcesContent:[".scatter_plot_link {\n position: absolute!important;\n right: 10px;\n}\n\n.cliffs_grid {\n top: 10px;\n}\n\n.show_only_cliffs {\n top: 30px;\n}\n\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings {\n font-size: 18px;\n position: absolute;\n height: 28px;\n}\n"],sourceRoot:""}]);const a=o},3645: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,s,r){"string"==typeof t&&(t=[[null,t,void 0]]);var o={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(o[l]=!0)}for(var h=0;h<t.length;h++){var c=[].concat(t[h]);i&&o[c[0]]||(void 0!==r&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=r),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),s&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=s):c[4]="".concat(s)),e.push(c))}},e}},7537: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)))),s="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),r="/*# ".concat(s," */");return[e].concat([r]).join("\n")}return[e].join("\n")}},9133:function(t,e,n){var i;!function(e,s){var r={};!function(t){"use strict";t.__esModule=!0,t.digestLength=32,t.blockSize=64;var e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(t,n,i,s,r){for(var o,a,l,h,c,u,m,d,f,p,g,y,b;r>=64;){for(o=n[0],a=n[1],l=n[2],h=n[3],c=n[4],u=n[5],m=n[6],d=n[7],p=0;p<16;p++)g=s+4*p,t[p]=(255&i[g])<<24|(255&i[g+1])<<16|(255&i[g+2])<<8|255&i[g+3];for(p=16;p<64;p++)y=((f=t[p-2])>>>17|f<<15)^(f>>>19|f<<13)^f>>>10,b=((f=t[p-15])>>>7|f<<25)^(f>>>18|f<<14)^f>>>3,t[p]=(y+t[p-7]|0)+(b+t[p-16]|0);for(p=0;p<64;p++)y=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&u^~c&m)|0)+(d+(e[p]+t[p]|0)|0)|0,b=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&a^o&l^a&l)|0,d=m,m=u,u=c,c=h+y|0,h=l,l=a,a=o,o=y+b|0;n[0]+=o,n[1]+=a,n[2]+=l,n[3]+=h,n[4]+=c,n[5]+=u,n[6]+=m,n[7]+=d,s+=64,r-=64}return s}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,s=e/536870912|0,r=e<<3,o=e%64<56?64:128;this.buffer[i]=128;for(var a=i+1;a<o-8;a++)this.buffer[a]=0;this.buffer[o-8]=s>>>24&255,this.buffer[o-7]=s>>>16&255,this.buffer[o-6]=s>>>8&255,this.buffer[o-5]=s>>>0&255,this.buffer[o-4]=r>>>24&255,this.buffer[o-3]=r>>>16&255,this.buffer[o-2]=r>>>8&255,this.buffer[o-1]=r>>>0&255,n(this.temp,this.state,this.buffer,0,o),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 s=function(){function t(t){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var e=new Uint8Array(this.blockSize);if(t.length>this.blockSize)(new i).update(t).finish(e).clean();else for(var n=0;n<t.length;n++)e[n]=t[n];for(n=0;n<e.length;n++)e[n]^=54;for(this.inner.update(e),n=0;n<e.length;n++)e[n]^=106;for(this.outer.update(e),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate),n=0;n<e.length;n++)e[n]=0}return t.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},t.prototype.clean=function(){for(var t=0;t<this.istate.length;t++)this.ostate[t]=this.istate[t]=0;this.inner.clean(),this.outer.clean()},t.prototype.update=function(t){return this.inner.update(t),this},t.prototype.finish=function(t){return this.outer.finished?this.outer.finish(t):(this.inner.finish(t),this.outer.update(t,this.digestLength).finish(t)),this},t.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},t}();function r(t){var e=(new i).update(t),n=e.digest();return e.clean(),n}function o(t,e){var n=new s(t).update(e),i=n.digest();return n.clean(),i}function a(t,e,n,i){var s=i[0];if(0===s)throw new Error("hkdf: cannot expand more");e.reset(),s>1&&e.update(t),n&&e.update(n),e.update(i),e.finish(t),i[0]++}t.HMAC=s,t.hash=r,t.default=r,t.hmac=o;var l=new Uint8Array(t.digestLength);t.hkdf=function(t,e,n,i){void 0===e&&(e=l),void 0===i&&(i=32);for(var r=new Uint8Array([1]),h=o(e,t),c=new s(h),u=new Uint8Array(c.digestLength),m=u.length,d=new Uint8Array(i),f=0;f<i;f++)m===u.length&&(a(u,c,n,r),m=0),d[f]=u[m++];return c.clean(),u.fill(0),r.fill(0),d},t.pbkdf2=function(t,e,n,i){for(var r=new s(t),o=r.digestLength,a=new Uint8Array(4),l=new Uint8Array(o),h=new Uint8Array(o),c=new Uint8Array(i),u=0;u*o<i;u++){var m=u+1;a[0]=m>>>24&255,a[1]=m>>>16&255,a[2]=m>>>8&255,a[3]=m>>>0&255,r.reset(),r.update(e),r.update(a),r.finish(h);for(var d=0;d<o;d++)l[d]=h[d];for(d=2;d<=n;d++){r.reset(),r.update(h).finish(h);for(var f=0;f<o;f++)l[f]^=h[f]}for(d=0;d<o&&u*o+d<i;d++)c[u*o+d]=l[d]}for(u=0;u<o;u++)l[u]=h[u]=0;for(u=0;u<4;u++)a[u]=0;return r.clean(),c}}(r);var o=r.default;for(var a in r)o[a]=r[a];"object"==typeof t.exports?t.exports=o:void 0===(i=function(){return o}.call(r,n,r,t))||(t.exports=i)}()},1811:(t,e,n)=>{"use strict";n.d(e,{T:()=>s});const i=new Uint32Array(65536),s=(t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return 0===e.length?t.length:t.length<=32?((t,e)=>{const n=t.length,s=e.length,r=1<<n-1;let o=-1,a=0,l=n,h=n;for(;h--;)i[t.charCodeAt(h)]|=1<<h;for(h=0;h<s;h++){let t=i[e.charCodeAt(h)];const n=t|a;t|=(t&o)+o^o,a|=~(t|o),o&=t,a&r&&l++,o&r&&l--,a=a<<1|1,o=o<<1|~(n|a),a&=n}for(h=n;h--;)i[t.charCodeAt(h)]=0;return l})(t,e):((t,e)=>{const n=e.length,s=t.length,r=[],o=[],a=Math.ceil(n/32),l=Math.ceil(s/32);for(let t=0;t<a;t++)o[t]=-1,r[t]=0;let h=0;for(;h<l-1;h++){let a=0,l=-1;const c=32*h,u=Math.min(32,s)+c;for(let e=c;e<u;e++)i[t.charCodeAt(e)]|=1<<e;for(let t=0;t<n;t++){const n=i[e.charCodeAt(t)],s=o[t/32|0]>>>t&1,h=r[t/32|0]>>>t&1,c=n|a,u=((n|h)&l)+l^l|n|h;let m=a|~(u|l),d=l&u;m>>>31^s&&(o[t/32|0]^=1<<t),d>>>31^h&&(r[t/32|0]^=1<<t),m=m<<1|s,d=d<<1|h,l=d|~(c|m),a=m&c}for(let e=c;e<u;e++)i[t.charCodeAt(e)]=0}let c=0,u=-1;const m=32*h,d=Math.min(32,s-m)+m;for(let e=m;e<d;e++)i[t.charCodeAt(e)]|=1<<e;let f=s;for(let t=0;t<n;t++){const n=i[e.charCodeAt(t)],a=o[t/32|0]>>>t&1,l=r[t/32|0]>>>t&1,h=n|c,m=((n|l)&u)+u^u|n|l;let d=c|~(m|u),p=u&m;f+=d>>>s-1&1,f-=p>>>s-1&1,d>>>31^a&&(o[t/32|0]^=1<<t),p>>>31^l&&(r[t/32|0]^=1<<t),d=d<<1|a,p=p<<1|l,u=p|~(h|d),c=d&h}for(let e=m;e<d;e++)i[t.charCodeAt(e)]=0;return f})(t,e)}},3979:(t,e)=>{"use strict";e.H$=void 0,e.H$=function(t,e,n){var i=function(t,e,n){if(0===t.length||0===e.length)return 0;if(n&&!n.caseSensitive&&(t=t.toUpperCase(),e=e.toUpperCase()),t===e)return 1;for(var i=0,s=t.length,r=e.length,o=Math.floor(Math.max(s,r)/2)-1,a=new Array(s),l=new Array(r),h=0;h<s;h++)for(var c=Math.max(0,h-o);c<=Math.min(r,h+o+1);c++)if(!a[h]&&!l[c]&&t[h]===e[c]){++i,a[h]=l[c]=!0;break}if(0===i)return 0;var u=0,m=0;for(h=0;h<s;h++)if(a[h]){for(;!l[m];)m++;t.charAt(h)!==e.charAt(m++)&&u++}return(i/s+i/r+(i-(u/=2))/i)/3}(t,e,n),s=0;if(i>.7){for(var r=Math.min(t.length,e.length),o=0;t[o]===e[o]&&o<4&&o<r;)++s,o++;i+=.1*s*(1-i)}return i}},9251:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>G});const i=Object.prototype.toString;function s(t){return i.call(t).endsWith("Array]")}function r(t,e,n){let i=0;const s=n(e);for(let e=0;e<t.x.length;e++)i+=Math.abs(t.y[e]-s(t.x[e]));return i}const o=Object.prototype.toString;function a(t){return o.call(t).endsWith("Array]")}const l=Object.prototype.toString;function h(t){return l.call(t).endsWith("Array]")}const c=Object.prototype.toString;const u=Object.prototype.toString;function m(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!h(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==n.output){if(!h(n.output))throw new TypeError("output option must be an array if specified");e=n.output}else e=new Array(t.length);var i=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e=t,!u.call(e).endsWith("Array]"))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var i=n.fromIndex,s=void 0===i?0:i,r=n.toIndex,o=void 0===r?t.length:r;if(s<0||s>=t.length||!Number.isInteger(s))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=s||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[s],l=s+1;l<o;l++)t[l]<a&&(a=t[l]);return a}(t),s=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e=t,!c.call(e).endsWith("Array]"))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var i=n.fromIndex,s=void 0===i?0:i,r=n.toIndex,o=void 0===r?t.length:r;if(s<0||s>=t.length||!Number.isInteger(s))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=s||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[s],l=s+1;l<o;l++)t[l]>a&&(a=t[l]);return a}(t);if(i===s)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var r=n.min,o=void 0===r?n.autoMinMax?i:0:r,a=n.max,l=void 0===a?n.autoMinMax?s:1:a;if(o>=l)throw new RangeError("min option must be smaller than max option");for(var m=(l-o)/(s-i),d=0;d<t.length;d++)e[d]=(t[d]-i)*m+o;return e}const d=" ".repeat(2),f=" ".repeat(4);function p(t,e={}){const{maxRows:n=15,maxColumns:i=10,maxNumSize:s=8,padMinus:r="auto"}=e;return`${t.constructor.name} {\n${d}[\n${f}${function(t,e,n,i,s){const{rows:r,columns:o}=t,a=Math.min(r,e),l=Math.min(o,n),h=[];if("auto"===s){s=!1;t:for(let e=0;e<a;e++)for(let n=0;n<l;n++)if(t.get(e,n)<0){s=!0;break t}}for(let e=0;e<a;e++){let n=[];for(let r=0;r<l;r++)n.push(g(t.get(e,r),i,s));h.push(`${n.join(" ")}`)}return l!==o&&(h[h.length-1]+=` ... ${o-n} more columns`),a!==r&&h.push(`... ${r-e} more rows`),h.join(`\n${f}`)}(t,n,i,s,r)}\n${d}]\n${d}rows: ${t.rows}\n${d}columns: ${t.columns}\n}`}function g(t,e,n){return(t>=0&&n?` ${y(t,e-1)}`:y(t,e)).padEnd(e)}function y(t,e){let n=t.toString();if(n.length<=e)return n;let i=t.toFixed(e);if(i.length>e&&(i=t.toFixed(Math.max(0,e-(i.length-e)))),i.length<=e&&!i.startsWith("0.000")&&!i.startsWith("-0.000"))return i;let s=t.toExponential(e);return s.length>e&&(s=t.toExponential(Math.max(0,e-(s.length-e)))),s.slice(0)}function b(t,e,n){let i=n?t.rows:t.rows-1;if(e<0||e>i)throw new RangeError("Row index out of range")}function w(t,e,n){let i=n?t.columns:t.columns-1;if(e<0||e>i)throw new RangeError("Column index out of range")}function v(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function C(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function S(t,e,n,i,s){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(T("startRow",e),T("endRow",n),T("startColumn",i),T("endColumn",s),e>n||i>s||e<0||e>=t.rows||n<0||n>=t.rows||i<0||i>=t.columns||s<0||s>=t.columns)throw new RangeError("Submatrix indices are out of range")}function M(t,e=0){let n=[];for(let i=0;i<t;i++)n.push(e);return n}function T(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function x(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class E{static from1DArray(t,e,n){if(t*e!==n.length)throw new RangeError("data length does not match given dimensions");let i=new A(t,e);for(let s=0;s<t;s++)for(let t=0;t<e;t++)i.set(s,t,n[s*e+t]);return i}static rowVector(t){let e=new A(1,t.length);for(let n=0;n<t.length;n++)e.set(0,n,t[n]);return e}static columnVector(t){let e=new A(t.length,1);for(let n=0;n<t.length;n++)e.set(n,0,t[n]);return e}static zeros(t,e){return new A(t,e)}static ones(t,e){return new A(t,e).fill(1)}static rand(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{random:i=Math.random}=n;let s=new A(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)s.set(n,t,i());return s}static randInt(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{min:i=0,max:s=1e3,random:r=Math.random}=n;if(!Number.isInteger(i))throw new TypeError("min must be an integer");if(!Number.isInteger(s))throw new TypeError("max must be an integer");if(i>=s)throw new RangeError("min must be smaller than max");let o=s-i,a=new A(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++){let e=i+Math.round(r()*o);a.set(n,t,e)}return a}static eye(t,e,n){void 0===e&&(e=t),void 0===n&&(n=1);let i=Math.min(t,e),s=this.zeros(t,e);for(let t=0;t<i;t++)s.set(t,t,n);return s}static diag(t,e,n){let i=t.length;void 0===e&&(e=i),void 0===n&&(n=e);let s=Math.min(i,e,n),r=this.zeros(e,n);for(let e=0;e<s;e++)r.set(e,e,t[e]);return r}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,i=t.columns,s=new A(n,i);for(let r=0;r<n;r++)for(let n=0;n<i;n++)s.set(r,n,Math.min(t.get(r,n),e.get(r,n)));return s}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,i=t.columns,s=new this(n,i);for(let r=0;r<n;r++)for(let n=0;n<i;n++)s.set(r,n,Math.max(t.get(r,n),e.get(r,n)));return s}static checkMatrix(t){return E.isMatrix(t)?t:new A(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.call(this,e,n);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let n=0;n<this.columns;n++)t[e].push(this.get(e,n))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isEchelonForm(){let t=0,e=0,n=-1,i=!0,s=!1;for(;t<this.rows&&i;){for(e=0,s=!1;e<this.columns&&!1===s;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(s=!0,n=e):(i=!1,s=!0);t++}return i}isReducedEchelonForm(){let t=0,e=0,n=-1,i=!0,s=!1;for(;t<this.rows&&i;){for(e=0,s=!1;e<this.columns&&!1===s;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(s=!0,n=e):(i=!1,s=!0);for(let n=e+1;n<this.rows;n++)0!==this.get(t,n)&&(i=!1);t++}return i}echelonForm(){let t=this.clone(),e=0,n=0;for(;e<t.rows&&n<t.columns;){let i=e;for(let s=e;s<t.rows;s++)t.get(s,n)>t.get(i,n)&&(i=s);if(0===t.get(i,n))n++;else{t.swapRows(e,i);let s=t.get(e,n);for(let i=n;i<t.columns;i++)t.set(e,i,t.get(e,i)/s);for(let i=e+1;i<t.rows;i++){let s=t.get(i,n)/t.get(e,n);t.set(i,n,0);for(let r=n+1;r<t.columns;r++)t.set(i,r,t.get(i,r)-t.get(e,r)*s)}e++,n++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,n=t.rows,i=n-1;for(;i>=0;)if(0===t.maxRow(i))i--;else{let s=0,r=!1;for(;s<n&&!1===r;)1===t.get(i,s)?r=!0:s++;for(let n=0;n<i;n++){let r=t.get(n,s);for(let o=s;o<e;o++){let e=t.get(n,o)-r*t.get(i,o);t.set(n,o,e)}}i--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:n=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");let i=new A(this.rows*e,this.columns*n);for(let t=0;t<e;t++)for(let e=0;e<n;e++)i.setSubMatrix(this,this.rows*t,this.columns*e);return i}fill(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,t);return this}neg(){return this.mulS(-1)}getRow(t){b(this,t);let e=[];for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}getRowVector(t){return A.rowVector(this.getRow(t))}setRow(t,e){b(this,t),e=v(this,e);for(let n=0;n<this.columns;n++)this.set(t,n,e[n]);return this}swapRows(t,e){b(this,t),b(this,e);for(let n=0;n<this.columns;n++){let i=this.get(t,n);this.set(t,n,this.get(e,n)),this.set(e,n,i)}return this}getColumn(t){w(this,t);let e=[];for(let n=0;n<this.rows;n++)e.push(this.get(n,t));return e}getColumnVector(t){return A.columnVector(this.getColumn(t))}setColumn(t,e){w(this,t),e=C(this,e);for(let n=0;n<this.rows;n++)this.set(n,t,e[n]);return this}swapColumns(t,e){w(this,t),w(this,e);for(let n=0;n<this.rows;n++){let i=this.get(n,t);this.set(n,t,this.get(n,e)),this.set(n,e,i)}return this}addRowVector(t){t=v(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[n]);return this}subRowVector(t){t=v(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[n]);return this}mulRowVector(t){t=v(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[n]);return this}divRowVector(t){t=v(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[n]);return this}addColumnVector(t){t=C(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[e]);return this}subColumnVector(t){t=C(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[e]);return this}mulColumnVector(t){t=C(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[e]);return this}divColumnVector(t){t=C(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[e]);return this}mulRow(t,e){b(this,t);for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e);return this}mulColumn(t,e){w(this,t);for(let n=0;n<this.rows;n++)this.set(n,t,this.get(n,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t[e]&&(t[e]=this.get(e,n));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t[n]&&(t[n]=this.get(e,n));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){x(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>t&&(t=this.get(n,i),e[0]=n,e[1]=i);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t[e]&&(t[e]=this.get(e,n));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t[n]&&(t[n]=this.get(e,n));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){x(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)<t&&(t=this.get(n,i),e[0]=n,e[1]=i);return e}maxRow(t){if(b(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}maxRowIndex(t){b(this,t),x(this);let e=this.get(t,0),n=[t,0];for(let i=1;i<this.columns;i++)this.get(t,i)>e&&(e=this.get(t,i),n[1]=i);return n}minRow(t){if(b(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}minRowIndex(t){b(this,t),x(this);let e=this.get(t,0),n=[t,0];for(let i=1;i<this.columns;i++)this.get(t,i)<e&&(e=this.get(t,i),n[1]=i);return n}maxColumn(t){if(w(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t));return e}maxColumnIndex(t){w(this,t),x(this);let e=this.get(0,t),n=[0,t];for(let i=1;i<this.rows;i++)this.get(i,t)>e&&(e=this.get(i,t),n[0]=i);return n}minColumn(t){if(w(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t));return e}minColumnIndex(t){w(this,t),x(this);let e=this.get(0,t),n=[0,t];for(let i=1;i<this.rows;i++)this.get(i,t)<e&&(e=this.get(i,t),n[0]=i);return n}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let n=0;n<t;n++)e.push(this.get(n,n));return e}norm(t="frobenius"){let e=0;if("max"===t)return this.max();if("frobenius"===t){for(let t=0;t<this.rows;t++)for(let n=0;n<this.columns;n++)e+=this.get(t,n)*this.get(t,n);return Math.sqrt(e)}throw new RangeError(`unknown norm type: ${t}`)}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t+=this.get(e,n),this.set(e,n,t);return this}dot(t){E.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let n=0;for(let i=0;i<e.length;i++)n+=e[i]*t[i];return n}mmul(t){t=A.checkMatrix(t);let e=this.rows,n=this.columns,i=t.columns,s=new A(e,i),r=new Float64Array(n);for(let o=0;o<i;o++){for(let e=0;e<n;e++)r[e]=t.get(e,o);for(let t=0;t<e;t++){let e=0;for(let i=0;i<n;i++)e+=this.get(t,i)*r[i];s.set(t,o,e)}}return s}strassen2x2(t){t=A.checkMatrix(t);let e=new A(2,2);const n=this.get(0,0),i=t.get(0,0),s=this.get(0,1),r=t.get(0,1),o=this.get(1,0),a=t.get(1,0),l=this.get(1,1),h=t.get(1,1),c=(n+l)*(i+h),u=(o+l)*i,m=n*(r-h),d=l*(a-i),f=(n+s)*h,p=c+d-f+(s-l)*(a+h),g=m+f,y=u+d,b=c-u+m+(o-n)*(i+r);return e.set(0,0,p),e.set(0,1,g),e.set(1,0,y),e.set(1,1,b),e}strassen3x3(t){t=A.checkMatrix(t);let e=new A(3,3);const n=this.get(0,0),i=this.get(0,1),s=this.get(0,2),r=this.get(1,0),o=this.get(1,1),a=this.get(1,2),l=this.get(2,0),h=this.get(2,1),c=this.get(2,2),u=t.get(0,0),m=t.get(0,1),d=t.get(0,2),f=t.get(1,0),p=t.get(1,1),g=t.get(1,2),y=t.get(2,0),b=t.get(2,1),w=t.get(2,2),v=(n-r)*(-m+p),C=(-n+r+o)*(u-m+p),S=(r+o)*(-u+m),M=n*u,T=(-n+l+h)*(u-d+g),x=(-n+l)*(d-g),E=(l+h)*(-u+d),N=(-s+h+c)*(p+y-b),I=(s-c)*(p-b),L=s*y,k=(h+c)*(-y+b),_=(-s+o+a)*(g+y-w),R=(s-a)*(g-w),O=(o+a)*(-y+w),G=M+L+i*f,P=(n+i+s-r-o-h-c)*p+C+S+M+N+L+k,F=M+T+E+(n+i+s-o-a-l-h)*g+L+_+O,W=v+o*(-u+m+f-p-g-y+w)+C+M+L+_+R,V=v+C+S+M+a*b,H=L+_+R+O+r*d,Z=M+T+x+h*(-u+d+f-p-g-y+b)+N+I+L,U=N+I+L+k+l*m,D=M+T+x+E+c*w;return e.set(0,0,G),e.set(0,1,P),e.set(0,2,F),e.set(1,0,W),e.set(1,1,V),e.set(1,2,H),e.set(2,0,Z),e.set(2,1,U),e.set(2,2,D),e}mmulStrassen(t){t=A.checkMatrix(t);let e=this.clone(),n=e.rows,i=e.columns,s=t.rows,r=t.columns;function o(t,e,n){let i=t.rows,s=t.columns;if(i===e&&s===n)return t;{let i=E.zeros(e,n);return i=i.setSubMatrix(t,0,0),i}}i!==s&&console.warn(`Multiplying ${n} x ${i} and ${s} x ${r} matrix: dimensions do not match.`);let a=Math.max(n,s),l=Math.max(i,r);return e=o(e,a,l),function t(e,n,i,s){if(i<=512||s<=512)return e.mmul(n);i%2==1&&s%2==1?(e=o(e,i+1,s+1),n=o(n,i+1,s+1)):i%2==1?(e=o(e,i+1,s),n=o(n,i+1,s)):s%2==1&&(e=o(e,i,s+1),n=o(n,i,s+1));let r=parseInt(e.rows/2,10),a=parseInt(e.columns/2,10),l=e.subMatrix(0,r-1,0,a-1),h=n.subMatrix(0,r-1,0,a-1),c=e.subMatrix(0,r-1,a,e.columns-1),u=n.subMatrix(0,r-1,a,n.columns-1),m=e.subMatrix(r,e.rows-1,0,a-1),d=n.subMatrix(r,n.rows-1,0,a-1),f=e.subMatrix(r,e.rows-1,a,e.columns-1),p=n.subMatrix(r,n.rows-1,a,n.columns-1),g=t(E.add(l,f),E.add(h,p),r,a),y=t(E.add(m,f),h,r,a),b=t(l,E.sub(u,p),r,a),w=t(f,E.sub(d,h),r,a),v=t(E.add(l,c),p,r,a),C=t(E.sub(m,l),E.add(h,u),r,a),S=t(E.sub(c,f),E.add(d,p),r,a),M=E.add(g,w);M.sub(v),M.add(S);let T=E.add(b,v),x=E.add(y,w),N=E.sub(g,y);N.add(b),N.add(C);let A=E.zeros(2*M.rows,2*M.columns);return A=A.setSubMatrix(M,0,0),A=A.setSubMatrix(T,M.rows,0),A=A.setSubMatrix(x,0,M.columns),A=A.setSubMatrix(N,M.rows,M.columns),A.subMatrix(0,i-1,0,s-1)}(e,t=o(t,a,l),a,l)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let i=new A(this.rows,this.columns);for(let t=0;t<this.rows;t++){const s=this.getRow(t);s.length>0&&m(s,{min:e,max:n,output:s}),i.setRow(t,s)}return i}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let i=new A(this.rows,this.columns);for(let t=0;t<this.columns;t++){const s=this.getColumn(t);s.length&&m(s,{min:e,max:n,output:s}),i.setColumn(t,s)}return i}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let n=0;n<t;n++){let t=this.get(e,n),i=this.get(e,this.columns-1-n);this.set(e,n,i),this.set(e,this.columns-1-n,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let n=0;n<t;n++){let t=this.get(n,e),i=this.get(this.rows-1-n,e);this.set(n,e,i),this.set(this.rows-1-n,e,t)}return this}kroneckerProduct(t){t=A.checkMatrix(t);let e=this.rows,n=this.columns,i=t.rows,s=t.columns,r=new A(e*i,n*s);for(let o=0;o<e;o++)for(let e=0;e<n;e++)for(let n=0;n<i;n++)for(let a=0;a<s;a++)r.set(i*o+n,s*e+a,this.get(o,e)*t.get(n,a));return r}kroneckerSum(t){if(t=A.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,n=t.rows,i=this.kroneckerProduct(A.eye(n,n)),s=A.eye(e,e).kroneckerProduct(t);return i.add(s)}transpose(){let t=new A(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(n,e,this.get(e,n));return t}sortRows(t=N){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=N){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,n,i){S(this,t,e,n,i);let s=new A(e-t+1,i-n+1);for(let r=t;r<=e;r++)for(let e=n;e<=i;e++)s.set(r-t,e-n,this.get(r,e));return s}subMatrixRow(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.columns-1),e>n||e<0||e>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let i=new A(t.length,n-e+1);for(let s=0;s<t.length;s++)for(let r=e;r<=n;r++){if(t[s]<0||t[s]>=this.rows)throw new RangeError(`Row index out of range: ${t[s]}`);i.set(s,r-e,this.get(t[s],r))}return i}subMatrixColumn(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.rows-1),e>n||e<0||e>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let i=new A(n-e+1,t.length);for(let s=0;s<t.length;s++)for(let r=e;r<=n;r++){if(t[s]<0||t[s]>=this.columns)throw new RangeError(`Column index out of range: ${t[s]}`);i.set(r-e,s,this.get(r,t[s]))}return i}setSubMatrix(t,e,n){if((t=A.checkMatrix(t)).isEmpty())return this;S(this,e,e+t.rows-1,n,n+t.columns-1);for(let i=0;i<t.rows;i++)for(let s=0;s<t.columns;s++)this.set(e+i,n+s,t.get(i,s));return this}selection(t,e){!function(t,e){if(!a(e))throw new TypeError("row indices must be an array");for(let n=0;n<e.length;n++)if(e[n]<0||e[n]>=t.rows)throw new RangeError("row indices are out of range")}(this,t),function(t,e){if(!a(e))throw new TypeError("column indices must be an array");for(let n=0;n<e.length;n++)if(e[n]<0||e[n]>=t.columns)throw new RangeError("column indices are out of range")}(this,e);let n=new A(t.length,e.length);for(let i=0;i<t.length;i++){let s=t[i];for(let t=0;t<e.length;t++){let r=e[t];n.set(i,t,this.get(s,r))}}return n}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let n=0;n<t;n++)e+=this.get(n,n);return e}clone(){let t=new A(this.rows,this.columns);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(e,n,this.get(e,n));return t}sum(t){switch(t){case"row":return function(t){let e=M(t.rows);for(let n=0;n<t.rows;++n)for(let i=0;i<t.columns;++i)e[n]+=t.get(n,i);return e}(this);case"column":return function(t){let e=M(t.columns);for(let n=0;n<t.rows;++n)for(let i=0;i<t.columns;++i)e[i]+=t.get(n,i);return e}(this);case void 0:return function(t){let e=0;for(let n=0;n<t.rows;n++)for(let i=0;i<t.columns;i++)e+=t.get(n,i);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=M(t.rows,1);for(let n=0;n<t.rows;++n)for(let i=0;i<t.columns;++i)e[n]*=t.get(n,i);return e}(this);case"column":return function(t){let e=M(t.columns,1);for(let n=0;n<t.rows;++n)for(let i=0;i<t.columns;++i)e[i]*=t.get(n,i);return e}(this);case void 0:return function(t){let e=1;for(let n=0;n<t.rows;n++)for(let i=0;i<t.columns;i++)e*=t.get(n,i);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:n=!0,mean:i=this.mean(t)}=e;if("boolean"!=typeof n)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!a(i))throw new TypeError("mean must be an array");return function(t,e,n){const i=t.rows,s=t.columns,r=[];for(let o=0;o<i;o++){let i=0,a=0,l=0;for(let e=0;e<s;e++)l=t.get(o,e)-n[o],i+=l,a+=l*l;e?r.push((a-i*i/s)/(s-1)):r.push((a-i*i/s)/s)}return r}(this,n,i);case"column":if(!a(i))throw new TypeError("mean must be an array");return function(t,e,n){const i=t.rows,s=t.columns,r=[];for(let o=0;o<s;o++){let s=0,a=0,l=0;for(let e=0;e<i;e++)l=t.get(e,o)-n[o],s+=l,a+=l*l;e?r.push((a-s*s/i)/(i-1)):r.push((a-s*s/i)/i)}return r}(this,n,i);case void 0:if("number"!=typeof i)throw new TypeError("mean must be a number");return function(t,e,n){const i=t.rows,s=t.columns,r=i*s;let o=0,a=0,l=0;for(let e=0;e<i;e++)for(let i=0;i<s;i++)l=t.get(e,i)-n,o+=l,a+=l*l;return e?(a-o*o/r)/(r-1):(a-o*o/r)/r}(this,n,i);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const n=this.variance(t,e);if(void 0===t)return Math.sqrt(n);for(let t=0;t<n.length;t++)n[t]=Math.sqrt(n[t]);return n}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:n=this.mean(t)}=e;switch(t){case"row":if(!a(n))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let i=0;i<t.columns;i++)t.set(n,i,t.get(n,i)-e[n])}(this,n),this;case"column":if(!a(n))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let i=0;i<t.columns;i++)t.set(n,i,t.get(n,i)-e[i])}(this,n),this;case void 0:if("number"!=typeof n)throw new TypeError("center must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let i=0;i<t.columns;i++)t.set(n,i,t.get(n,i)-e)}(this,n),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let n=e.scale;switch(t){case"row":if(void 0===n)n=function(t){const e=[];for(let n=0;n<t.rows;n++){let i=0;for(let e=0;e<t.columns;e++)i+=Math.pow(t.get(n,e),2)/(t.columns-1);e.push(Math.sqrt(i))}return e}(this);else if(!a(n))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let i=0;i<t.columns;i++)t.set(n,i,t.get(n,i)/e[n])}(this,n),this;case"column":if(void 0===n)n=function(t){const e=[];for(let n=0;n<t.columns;n++){let i=0;for(let e=0;e<t.rows;e++)i+=Math.pow(t.get(e,n),2)/(t.rows-1);e.push(Math.sqrt(i))}return e}(this);else if(!a(n))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let i=0;i<t.columns;i++)t.set(n,i,t.get(n,i)/e[i])}(this,n),this;case void 0:if(void 0===n)n=function(t){const e=t.size-1;let n=0;for(let i=0;i<t.columns;i++)for(let s=0;s<t.rows;s++)n+=Math.pow(t.get(s,i),2)/e;return Math.sqrt(n)}(this);else if("number"!=typeof n)throw new TypeError("scale must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let i=0;i<t.columns;i++)t.set(n,i,t.get(n,i)/e)}(this,n),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return p(this,t)}}function N(t,e){return t-e}E.prototype.klass="Matrix","undefined"!=typeof Symbol&&(E.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return p(this)}),E.random=E.rand,E.randomInt=E.randInt,E.diagonal=E.diag,E.prototype.diagonal=E.prototype.diag,E.identity=E.eye,E.prototype.negate=E.prototype.neg,E.prototype.tensorProduct=E.prototype.kroneckerProduct;class A extends E{constructor(t,e){if(super(),A.isMatrix(t))return t.clone();if(Number.isInteger(t)&&t>=0){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let n=0;n<t;n++)this.data.push(new Float64Array(e))}else{if(!a(t))throw new TypeError("First argument must be a positive number or an array");{const n=t;if("number"!=typeof(e=(t=n.length)?n[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let i=0;i<t;i++){if(n[i].length!==e)throw new RangeError("Inconsistent array dimensions");if(!n[i].every((t=>"number"==typeof t)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(n[i]))}}}this.rows=t,this.columns=e}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}removeRow(t){return b(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),b(this,t,!0),e=Float64Array.from(v(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){w(this,t);for(let e=0;e<this.rows;e++){const n=new Float64Array(this.columns-1);for(let i=0;i<t;i++)n[i]=this.data[e][i];for(let i=t+1;i<this.columns;i++)n[i-1]=this.data[e][i];this.data[e]=n}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),w(this,t,!0),e=C(this,e);for(let n=0;n<this.rows;n++){const i=new Float64Array(this.columns+1);let s=0;for(;s<t;s++)i[s]=this.data[n][s];for(i[s++]=e[n];s<this.columns+1;s++)i[s]=this.data[n][s-1];this.data[n]=i}return this.columns+=1,this}}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t.get(e,n));return this},t.add=function(t,n){return new e(t).add(n)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t.get(e,n));return this},t.sub=function(t,n){return new e(t).sub(n)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t.get(e,n));return this},t.mul=function(t,n){return new e(t).mul(n)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t.get(e,n));return this},t.div=function(t,n){return new e(t).div(n)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t.get(e,n));return this},t.mod=function(t,n){return new e(t).mod(n)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t.get(e,n));return this},t.and=function(t,n){return new e(t).and(n)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t.get(e,n));return this},t.or=function(t,n){return new e(t).or(n)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t.get(e,n));return this},t.xor=function(t,n){return new e(t).xor(n)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t.get(e,n));return this},t.leftShift=function(t,n){return new e(t).leftShift(n)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t.get(e,n));return this},t.signPropagatingRightShift=function(t,n){return new e(t).signPropagatingRightShift(n)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t.get(e,n));return this},t.rightShift=function(t,n){return new e(t).rightShift(n)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,n){return new e(t).pow(n)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,Math.pow(this.get(e,n),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,Math.pow(this.get(e,n),t.get(e,n)));return this}}(E,A);class I extends E{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}}class L{constructor(t){let e,n,i,s,r,o,a,l,h,c=(t=I.checkMatrix(t)).clone(),u=c.rows,m=c.columns,d=new Float64Array(u),f=1;for(e=0;e<u;e++)d[e]=e;for(l=new Float64Array(u),n=0;n<m;n++){for(e=0;e<u;e++)l[e]=c.get(e,n);for(e=0;e<u;e++){for(h=Math.min(e,n),r=0,i=0;i<h;i++)r+=c.get(e,i)*l[i];l[e]-=r,c.set(e,n,l[e])}for(s=n,e=n+1;e<u;e++)Math.abs(l[e])>Math.abs(l[s])&&(s=e);if(s!==n){for(i=0;i<m;i++)o=c.get(s,i),c.set(s,i,c.get(n,i)),c.set(n,i,o);a=d[s],d[s]=d[n],d[n]=a,f=-f}if(n<u&&0!==c.get(n,n))for(e=n+1;e<u;e++)c.set(e,n,c.get(e,n)/c.get(n,n))}this.LU=c,this.pivotVector=d,this.pivotSign=f}isSingular(){let t=this.LU,e=t.columns;for(let n=0;n<e;n++)if(0===t.get(n,n))return!0;return!1}solve(t){t=A.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let n,i,s,r=t.columns,o=t.subMatrixRow(this.pivotVector,0,r-1),a=e.columns;for(s=0;s<a;s++)for(n=s+1;n<a;n++)for(i=0;i<r;i++)o.set(n,i,o.get(n,i)-o.get(s,i)*e.get(n,s));for(s=a-1;s>=0;s--){for(i=0;i<r;i++)o.set(s,i,o.get(s,i)/e.get(s,s));for(n=0;n<s;n++)for(i=0;i<r;i++)o.set(n,i,o.get(n,i)-o.get(s,i)*e.get(n,s))}return o}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,n=t.columns;for(let i=0;i<n;i++)e*=t.get(i,i);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,i=new A(e,n);for(let s=0;s<e;s++)for(let e=0;e<n;e++)s>e?i.set(s,e,t.get(s,e)):s===e?i.set(s,e,1):i.set(s,e,0);return i}get upperTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,i=new A(e,n);for(let s=0;s<e;s++)for(let e=0;e<n;e++)s<=e?i.set(s,e,t.get(s,e)):i.set(s,e,0);return i}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function k(t,e){let n=0;return Math.abs(t)>Math.abs(e)?(n=e/t,Math.abs(t)*Math.sqrt(1+n*n)):0!==e?(n=t/e,Math.abs(e)*Math.sqrt(1+n*n)):0}class _{constructor(t){let e,n,i,s,r=(t=I.checkMatrix(t)).clone(),o=t.rows,a=t.columns,l=new Float64Array(a);for(i=0;i<a;i++){let t=0;for(e=i;e<o;e++)t=k(t,r.get(e,i));if(0!==t){for(r.get(i,i)<0&&(t=-t),e=i;e<o;e++)r.set(e,i,r.get(e,i)/t);for(r.set(i,i,r.get(i,i)+1),n=i+1;n<a;n++){for(s=0,e=i;e<o;e++)s+=r.get(e,i)*r.get(e,n);for(s=-s/r.get(i,i),e=i;e<o;e++)r.set(e,n,r.get(e,n)+s*r.get(e,i))}}l[i]=-t}this.QR=r,this.Rdiag=l}solve(t){t=A.checkMatrix(t);let e=this.QR,n=e.rows;if(t.rows!==n)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let i,s,r,o,a=t.columns,l=t.clone(),h=e.columns;for(r=0;r<h;r++)for(s=0;s<a;s++){for(o=0,i=r;i<n;i++)o+=e.get(i,r)*l.get(i,s);for(o=-o/e.get(r,r),i=r;i<n;i++)l.set(i,s,l.get(i,s)+o*e.get(i,r))}for(r=h-1;r>=0;r--){for(s=0;s<a;s++)l.set(r,s,l.get(r,s)/this.Rdiag[r]);for(i=0;i<r;i++)for(s=0;s<a;s++)l.set(i,s,l.get(i,s)-l.get(r,s)*e.get(i,r))}return l.subMatrix(0,h-1,0,a-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(0===this.Rdiag[e])return!1;return!0}get upperTriangularMatrix(){let t,e,n=this.QR,i=n.columns,s=new A(i,i);for(t=0;t<i;t++)for(e=0;e<i;e++)t<e?s.set(t,e,n.get(t,e)):t===e?s.set(t,e,this.Rdiag[t]):s.set(t,e,0);return s}get orthogonalMatrix(){let t,e,n,i,s=this.QR,r=s.rows,o=s.columns,a=new A(r,o);for(n=o-1;n>=0;n--){for(t=0;t<r;t++)a.set(t,n,0);for(a.set(n,n,1),e=n;e<o;e++)if(0!==s.get(n,n)){for(i=0,t=n;t<r;t++)i+=s.get(t,n)*a.get(t,e);for(i=-i/s.get(n,n),t=n;t<r;t++)a.set(t,e,a.get(t,e)+i*s.get(t,n))}}return a}}class R{constructor(t,e={}){if((t=I.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let n=t.rows,i=t.columns;const{computeLeftSingularVectors:s=!0,computeRightSingularVectors:r=!0,autoTranspose:o=!1}=e;let a,l=Boolean(s),h=Boolean(r),c=!1;if(n<i)if(o){a=t.transpose(),n=a.rows,i=a.columns,c=!0;let e=l;l=h,h=e}else a=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else a=t.clone();let u=Math.min(n,i),m=Math.min(n+1,i),d=new Float64Array(m),f=new A(n,u),p=new A(i,i),g=new Float64Array(i),y=new Float64Array(n),b=new Float64Array(m);for(let t=0;t<m;t++)b[t]=t;let w=Math.min(n-1,i),v=Math.max(0,Math.min(i-2,n)),C=Math.max(w,v);for(let t=0;t<C;t++){if(t<w){d[t]=0;for(let e=t;e<n;e++)d[t]=k(d[t],a.get(e,t));if(0!==d[t]){a.get(t,t)<0&&(d[t]=-d[t]);for(let e=t;e<n;e++)a.set(e,t,a.get(e,t)/d[t]);a.set(t,t,a.get(t,t)+1)}d[t]=-d[t]}for(let e=t+1;e<i;e++){if(t<w&&0!==d[t]){let i=0;for(let s=t;s<n;s++)i+=a.get(s,t)*a.get(s,e);i=-i/a.get(t,t);for(let s=t;s<n;s++)a.set(s,e,a.get(s,e)+i*a.get(s,t))}g[e]=a.get(t,e)}if(l&&t<w)for(let e=t;e<n;e++)f.set(e,t,a.get(e,t));if(t<v){g[t]=0;for(let e=t+1;e<i;e++)g[t]=k(g[t],g[e]);if(0!==g[t]){g[t+1]<0&&(g[t]=0-g[t]);for(let e=t+1;e<i;e++)g[e]/=g[t];g[t+1]+=1}if(g[t]=-g[t],t+1<n&&0!==g[t]){for(let e=t+1;e<n;e++)y[e]=0;for(let e=t+1;e<n;e++)for(let n=t+1;n<i;n++)y[e]+=g[n]*a.get(e,n);for(let e=t+1;e<i;e++){let i=-g[e]/g[t+1];for(let s=t+1;s<n;s++)a.set(s,e,a.get(s,e)+i*y[s])}}if(h)for(let e=t+1;e<i;e++)p.set(e,t,g[e])}}let S=Math.min(i,n+1);if(w<i&&(d[w]=a.get(w,w)),n<S&&(d[S-1]=0),v+1<S&&(g[v]=a.get(v,S-1)),g[S-1]=0,l){for(let t=w;t<u;t++){for(let e=0;e<n;e++)f.set(e,t,0);f.set(t,t,1)}for(let t=w-1;t>=0;t--)if(0!==d[t]){for(let e=t+1;e<u;e++){let i=0;for(let s=t;s<n;s++)i+=f.get(s,t)*f.get(s,e);i=-i/f.get(t,t);for(let s=t;s<n;s++)f.set(s,e,f.get(s,e)+i*f.get(s,t))}for(let e=t;e<n;e++)f.set(e,t,-f.get(e,t));f.set(t,t,1+f.get(t,t));for(let e=0;e<t-1;e++)f.set(e,t,0)}else{for(let e=0;e<n;e++)f.set(e,t,0);f.set(t,t,1)}}if(h)for(let t=i-1;t>=0;t--){if(t<v&&0!==g[t])for(let e=t+1;e<i;e++){let n=0;for(let s=t+1;s<i;s++)n+=p.get(s,t)*p.get(s,e);n=-n/p.get(t+1,t);for(let s=t+1;s<i;s++)p.set(s,e,p.get(s,e)+n*p.get(s,t))}for(let e=0;e<i;e++)p.set(e,t,0);p.set(t,t,1)}let M=S-1,T=0,x=Number.EPSILON;for(;S>0;){let t,e;for(t=S-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+x*Math.abs(d[t]+Math.abs(d[t+1]));if(Math.abs(g[t])<=e||Number.isNaN(g[t])){g[t]=0;break}}if(t===S-2)e=4;else{let n;for(n=S-1;n>=t&&n!==t;n--){let e=(n!==S?Math.abs(g[n]):0)+(n!==t+1?Math.abs(g[n-1]):0);if(Math.abs(d[n])<=x*e){d[n]=0;break}}n===t?e=3:n===S-1?e=1:(e=2,t=n)}switch(t++,e){case 1:{let e=g[S-2];g[S-2]=0;for(let n=S-2;n>=t;n--){let s=k(d[n],e),r=d[n]/s,o=e/s;if(d[n]=s,n!==t&&(e=-o*g[n-1],g[n-1]=r*g[n-1]),h)for(let t=0;t<i;t++)s=r*p.get(t,n)+o*p.get(t,S-1),p.set(t,S-1,-o*p.get(t,n)+r*p.get(t,S-1)),p.set(t,n,s)}break}case 2:{let e=g[t-1];g[t-1]=0;for(let i=t;i<S;i++){let s=k(d[i],e),r=d[i]/s,o=e/s;if(d[i]=s,e=-o*g[i],g[i]=r*g[i],l)for(let e=0;e<n;e++)s=r*f.get(e,i)+o*f.get(e,t-1),f.set(e,t-1,-o*f.get(e,i)+r*f.get(e,t-1)),f.set(e,i,s)}break}case 3:{const e=Math.max(Math.abs(d[S-1]),Math.abs(d[S-2]),Math.abs(g[S-2]),Math.abs(d[t]),Math.abs(g[t])),s=d[S-1]/e,r=d[S-2]/e,o=g[S-2]/e,a=d[t]/e,c=g[t]/e,u=((r+s)*(r-s)+o*o)/2,m=s*o*(s*o);let y=0;0===u&&0===m||(y=u<0?0-Math.sqrt(u*u+m):Math.sqrt(u*u+m),y=m/(u+y));let b=(a+s)*(a-s)+y,w=a*c;for(let e=t;e<S-1;e++){let s=k(b,w);0===s&&(s=Number.MIN_VALUE);let r=b/s,o=w/s;if(e!==t&&(g[e-1]=s),b=r*d[e]+o*g[e],g[e]=r*g[e]-o*d[e],w=o*d[e+1],d[e+1]=r*d[e+1],h)for(let t=0;t<i;t++)s=r*p.get(t,e)+o*p.get(t,e+1),p.set(t,e+1,-o*p.get(t,e)+r*p.get(t,e+1)),p.set(t,e,s);if(s=k(b,w),0===s&&(s=Number.MIN_VALUE),r=b/s,o=w/s,d[e]=s,b=r*g[e]+o*d[e+1],d[e+1]=-o*g[e]+r*d[e+1],w=o*g[e+1],g[e+1]=r*g[e+1],l&&e<n-1)for(let t=0;t<n;t++)s=r*f.get(t,e)+o*f.get(t,e+1),f.set(t,e+1,-o*f.get(t,e)+r*f.get(t,e+1)),f.set(t,e,s)}g[S-2]=b,T+=1;break}case 4:if(d[t]<=0&&(d[t]=d[t]<0?-d[t]:0,h))for(let e=0;e<=M;e++)p.set(e,t,-p.get(e,t));for(;t<M&&!(d[t]>=d[t+1]);){let e=d[t];if(d[t]=d[t+1],d[t+1]=e,h&&t<i-1)for(let n=0;n<i;n++)e=p.get(n,t+1),p.set(n,t+1,p.get(n,t)),p.set(n,t,e);if(l&&t<n-1)for(let i=0;i<n;i++)e=f.get(i,t+1),f.set(i,t+1,f.get(i,t)),f.set(i,t,e);t++}T=0,S--}}if(c){let t=p;p=f,f=t}this.m=n,this.n=i,this.s=d,this.U=f,this.V=p}solve(t){let e=t,n=this.threshold,i=this.s.length,s=A.zeros(i,i);for(let t=0;t<i;t++)Math.abs(this.s[t])<=n?s.set(t,t,0):s.set(t,t,1/this.s[t]);let r=this.U,o=this.rightSingularVectors,a=o.mmul(s),l=o.rows,h=r.rows,c=A.zeros(l,h);for(let t=0;t<l;t++)for(let e=0;e<h;e++){let n=0;for(let s=0;s<i;s++)n+=a.get(t,s)*r.get(e,s);c.set(t,e,n)}return c.mmul(e)}solveForDiagonal(t){return this.solve(A.diag(t))}inverse(){let t=this.V,e=this.threshold,n=t.rows,i=t.columns,s=new A(n,this.s.length);for(let r=0;r<n;r++)for(let n=0;n<i;n++)Math.abs(this.s[n])>e&&s.set(r,n,t.get(r,n)/this.s[n]);let r=this.U,o=r.rows,a=r.columns,l=new A(n,o);for(let t=0;t<n;t++)for(let e=0;e<o;e++){let n=0;for(let i=0;i<a;i++)n+=s.get(t,i)*r.get(e,i);l.set(t,e,n)}return l}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,n=this.s;for(let i=0,s=n.length;i<s;i++)n[i]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return A.diag(this.s)}}function O(t,e,n,i,s){let r=n*i*i,o=A.eye(e.length,e.length,r);const a=s(e);let l=new Float64Array(t.x.length);for(let e=0;e<t.x.length;e++)l[e]=a(t.x[e]);let h=function(t,e,n,i,s){const r=n.length,o=t.x.length;let a=new Array(r);for(let l=0;l<r;l++){a[l]=new Array(o);let r=n.slice();r[l]+=i;let h=s(r);for(let n=0;n<o;n++)a[l][n]=e[n]-h(t.x[n])}return new A(a)}(t,l,e,i,s),c=function(t,e){const n=t.x.length;let i=new Array(n);for(let s=0;s<n;s++)i[s]=[t.y[s]-e[s]];return new A(i)}(t,l),u=function(t,e=!1){return t=I.checkMatrix(t),e?new R(t).inverse():function(t,e,n=!1){return t=I.checkMatrix(t),e=I.checkMatrix(e),n?new R(t).solve(e):t.isSquare()?new L(t).solve(e):new _(t).solve(e)}(t,A.eye(t.rows))}(o.add(h.mmul(h.transpose())));return(e=(e=new A([e])).sub(u.mmul(h).mmul(c).mul(i).transpose())).to1DArray()}function G(t,e,n={}){let{maxIterations:i=100,gradientDifference:o=.1,damping:a=0,errorTolerance:l=.01,minValues:h,maxValues:c,initialValues:u}=n;if(a<=0)throw new Error("The damping option must be a positive number");if(!t.x||!t.y)throw new Error("The data parameter must have x and y elements");if(!s(t.x)||t.x.length<2||!s(t.y)||t.y.length<2)throw new Error("The data parameter elements must be an array with more than 2 points");if(t.x.length!==t.y.length)throw new Error("The data parameter elements must have the same size");let m=u||new Array(e.length).fill(1),d=m.length;if(c=c||new Array(d).fill(Number.MAX_SAFE_INTEGER),h=h||new Array(d).fill(Number.MIN_SAFE_INTEGER),c.length!==h.length)throw new Error("minValues and maxValues must be the same size");if(!s(m))throw new Error("initialValues must be an array");let f,p=r(t,m,e),g=p<=l;for(f=0;f<i&&!g;f++){m=O(t,m,a,o,e);for(let t=0;t<d;t++)m[t]=Math.min(Math.max(h[t],m[t]),c[t]);if(p=r(t,m,e),isNaN(p))break;g=p<=l}return{parameterValues:m,parameterError:p,iterations:f}}},3379:t=>{"use strict";var e=[];function n(t){for(var n=-1,i=0;i<e.length;i++)if(e[i].identifier===t){n=i;break}return n}function i(t,i){for(var r={},o=[],a=0;a<t.length;a++){var l=t[a],h=i.base?l[0]+i.base:l[0],c=r[h]||0,u="".concat(h," ").concat(c);r[h]=c+1;var m=n(u),d={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==m)e[m].references++,e[m].updater(d);else{var f=s(d,i);i.byIndex=a,e.splice(a,0,{identifier:u,updater:f,references:1})}o.push(u)}return o}function s(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,s){var r=i(t=t||[],s=s||{});return function(t){t=t||[];for(var o=0;o<r.length;o++){var a=n(r[o]);e[a].references--}for(var l=i(t,s),h=0;h<r.length;h++){var c=n(r[h]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}r=l}}},569: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)}},9216:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},3565:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},7795: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 s=void 0!==n.layer;s&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,s&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},4589: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))}}},7241:(t,e,n)=>{"use strict";n.d(e,{D:()=>l});var i=n(4469),s=n(976),r=n(7753),o=n(499);const a=31;async function l(t,e=!1,n){const l=o.C.getOrCreate(t);let c;n??(n=new Map);const u="helm"===l.units?(0,r.getHelmMonomers)(t):Object.keys(l.stats.freq).filter((t=>""!==t));for(let t=0;t<u.length;t++)n.has(u[t])||n.set(u[t],`${n.size+1}`);if("helm"===l.units)c=await i.functions.call("HELM:getMolFiles",{col:t}),c=function(t,e,n=!1){const i=new Array(t.length);for(let s=0;s<t.length;s++){let r=0,o=0,l="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";const h=t.get(s);r=h.indexOf("\n",r)+1,r=h.indexOf("\n",r)+1,r=h.indexOf("\n",r)+1;const c=parseInt(h.substring(r,r+3)),u=parseInt(h.substring(r+3,r+6));l+=`M V30 COUNTS ${c} ${u} 0 0 0\n`,l+="M V30 BEGIN ATOM\n";for(let t=0;t<c;t++){r=h.indexOf("\n",r)+1+a,o=h.indexOf(" ",r);const i=h.substring(r,o);l+=n?`M V30 ${t+1} R${e.get(i)} 0.000 0.000 0 0\n`:`M V30 ${t+1} At 0.000 0.000 0 0 MASS=${e.get(i)}\n`}l+="M V30 END ATOM\n",l+="M V30 BEGIN BOND\n";for(let t=0;t<u;t++){r=h.indexOf("\n",r)+1;const e=parseInt(h.substring(r,r+3).trim()),n=parseInt(h.substring(r+3,r+6).trim());l+=`M V30 ${t+1} ${parseInt(h.substring(r+6,r+9).trim())} ${e} ${n}\n`}l+="M V30 END BOND\n",l+="M V30 END CTAB\n",l+="M END",i[s]=l}return i}(c,n,e);else{c=new Array(t.length);for(let i=0;i<t.length;i++){const t=h(l.splitted[i].filter((t=>""!==t)),n,e);c[i]=t}}return s.Column.fromStrings("monomericMols",c)}function h(t,e,n=!1){let i="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";i+=`M V30 COUNTS ${t.length} ${t.length?t.length-1:0} 0 0 0\n`,i+="M V30 BEGIN ATOM\n";for(let s=0;s<t.length;s++)i+=n?`M V30 ${s+1} R${e.get(t[s])} 0.000 0.000 0 0\n`:`M V30 ${s+1} At 0.000 0.000 0 0 MASS=${e.get(t[s])}\n`;i+="M V30 END ATOM\n",i+="M V30 BEGIN BOND\n";for(let e=0;e<t.length-1;e++)i+=`M V30 ${e+1} 1 ${e+1} ${e+2}\n`;return i+="M V30 END BOND\n",i+="M V30 END CTAB\n",i+="M END",i}},7753:(t,e,n)=>{"use strict";n.r(e),n.d(e,{SeqActivityCliffsEditor:()=>Se,SeqPaletteCustom:()=>he,SequenceSpaceEditor:()=>Te,_package:()=>oe,activityCliffs:()=>Me,alignSequences:()=>Ae,bioSubstructureFilter:()=>De,bioSubstructureSearch:()=>Ze,compositionAnalysis:()=>Ie,convertDialog:()=>_e,demoBioActivityCliffs:()=>Xe,demoBioAtomicLevel:()=>qe,demoBioHelmMsaSequenceSpace:()=>Ke,demoBioSequenceSpace:()=>ze,demoBioSimilarityDiversity:()=>Ye,diversitySearchTopMenu:()=>He,diversitySearchViewer:()=>Ve,fastaSequenceCellRenderer:()=>pe,getBioLib:()=>me,getHelmMonomers:()=>Pe,getMonomerLibHelper:()=>ae,hydrophobPalette:()=>le,importFasta:()=>ke,initBio:()=>ce,libraryPanel:()=>fe,macroMolColumnPropertyPanel:()=>ge,macromoleculeDifferenceCellRenderer:()=>be,manageFiles:()=>de,monomerCellRenderer:()=>Re,multipleSequenceAlignmentDialog:()=>Ne,saveAsFasta:()=>Ue,sdfToJsonLib:()=>Le,separatorSequenceCellRenderer:()=>ye,sequenceAlignment:()=>we,sequenceSpaceTopMenu:()=>xe,sequenceTooltip:()=>ue,similaritySearchTopMenu:()=>We,similaritySearchViewer:()=>Fe,splitToMonomers:()=>Ge,testDetectMacromolecule:()=>Oe,toAtomicLevel:()=>Ee,vdRegionViewer:()=>Ce,webLogoLargeApp:()=>Be,webLogoViewer:()=>ve});var i=n(4469),s=n(3870),r=n(976),o=n(585);const a=o.GU;var l;!function(t){t.MSA="MSA",t.classic="classic"}(l||(l={}));const h=(t,e,n,i,s,r,o="rgb(100,100,100)",h=0,c=!1,u=1,m="",d=!1,f=l.classic,p={},g=0,y=null,b=[],w=null)=>{var v,C,S;s.textAlign="start";let M=r.substring(0),T=d?"":m;f===l.MSA&&(T="");let x=!0,E=!0,N="difference";null!=y&&null!=y.cell.column&&(x=null===(v=y.cell.column.temp["color-code"])||void 0===v||v,E=null===(C=y.cell.column.temp["compare-with-current"])||void 0===C||C,N=null!==(S=y.cell.column.temp["highlight-difference"])&&void 0!==S?S:"difference");const A=b[g];E&&b.length>0&&"difference"===N&&(u=M==A?.3:u),E&&b.length>0&&"equal"===N&&(u=M!=A?.3:u),null!=w&&(M=a(M,w));let I=s.measureText(M+T),L=s.measureText(M).width,k=s.measureText(M).width;const _=i/2-(I.fontBoundingBoxAscent+I.fontBoundingBoxDescent)/2+1;function R(n,i){const r=x?o:"rgb(0,0,0)";s.fillStyle=r,s.globalAlpha=u,f===l.classic&&(s.fillText(M,t+n,e+_),s.fillStyle="#808080",s.fillText(T,t+i,e+_)),f===l.MSA&&(s.fillStyle=r,s.fillText(M,t+n+(p[g]-k)/2,e+_))}if(I=I.width,f===l.MSA&&(L=p[g],I=p[g]),c||I>n)return R(5,5+L),t+L+s.measureText(T).width;{const e=(n-I)/2;return R(e,e+L),t+e+L}};var c=n(3553),u=n(8447),m=n(7331);const d="rgb(100,100,100)",f=u.GU;function p(t,e,n,i){return t?Math.min(t.canvas.width-n,i):e.canvas.width-n}function g(t){const e=!t.some(((e,n)=>e.length>1&&0!=n&&n!=t.length-1)),n=[],i=e?"":" ";return t.forEach(((e,s)=>{s<t.length&&(e+=`${e?"":"-"}${i}`),n.push(e)})),[n,e]}class y extends r.GridCellRenderer{get name(){return"sequence"}get cellType(){return"sequence"}get defaultHeight(){return 30}get defaultWidth(){return 230}onClick(t,e){t.cell.column.temp["current-word"]=t.cell.value,t.grid.invalidate()}onMouseMove(t,e){if("SEQ.MSA"!==t.cell.column.getTag("aligned"))return;const n=t.cell.column.temp,i=n["bio-sum-maxLengthWords"],r=n["bio-maxIndex"],o=e.offsetX-t.gridColumn.left+(t.gridColumn.left-t.bounds.x);let a=0,l=r,h=!1;i[r+1]=o+1;let c=0;if(o>i[0])for(;!h;)c=Math.floor((l+a)/2),o>=i[c]&&o<=i[c+1]?(a=c,h=!0):o<i[c]?l=c-1:o>i[c+1]&&(a=c+1),a==l&&(h=!0);a=o>=i[a]?a+1:a;const m=t.cell.column.getTag("separator")??"",d=(0,u.vU)("separator",m)(t.cell.value);(d[a]?.length??0)>0?s.tooltip.show(s.div(d[a]),e.x+16,e.y+16):s.tooltip.hide()}render(t,e,n,i,s,o,a){const c=-1!==o.gridRow?o.grid:null,m=o.cell,g=o.cell.column.getTag("alphabet");i=p(c,t,e,i),t.save(),t.beginPath(),t.rect(e,n,i,s),t.clip(),t.font="12px monospace",t.textBaseline="top";const y=o.cell.column.getTag(r.TAGS.UNITS),b=o.cell.column.getTag("aligned"),w=(0,u.py)(g),v=o.cell.column.getTag("separator")??"",C=i/5,S=(0,u.vU)(y,v,C),M=o.cell.column.temp,T=M["reference-sequence"],x=M["current-word"],E=M["monomer-width"],N=S(null!=T&&""!=T?T:x??"");let A=5,I=0,L=8;"short"===(null!=E?E:"short")&&(A=12,L=1);let k={};if(o.cell.column.getTag(".calculatedCellRender")!==C.toString()){let t=0;for(;t<Math.min(o.cell.column.length,100);)S(o.cell.column.get(t)).forEach(((t,e)=>{const n=7*f(t,L).length+A;n>(k[e]??0)&&(k[e]=n),e>I&&(I=e)})),t+=1;const e=21;for(let t=0;t<=I;t++){k[t]<e&&(k[t]=e);const n={};n[0]=k[0];for(let t=1;t<=I;t++)n[t]=n[t-1]+k[t];M["bio-sum-maxLengthWords"]=n,M["bio-maxIndex"]=I,M["bio-maxLengthWords"]=k,o.cell.column.setTag(".calculatedCellRender",C.toString())}}else k=M["bio-maxLengthWords"];const _=S(m.value);let R=e,O=d,G=l.classic;b&&b.includes("MSA")&&"separator"==y&&(G=l.MSA),_.every(((e,r)=>{O=w.get(e),t.fillStyle=d;const a=r===_.length-1;return R=h(R,n,i,s,t,e,O,0,!0,1,v,a,G,k,r,o,N,L),50<=i})),t.restore()}}class b extends r.GridCellRenderer{constructor(){super(...arguments),this.svgMolOptions={autoCrop:!0,autoCropMargin:0,suppressChiralText:!0}}get name(){return c.Of.MONOMER}get cellType(){return c.Of.MONOMER}get defaultHeight(){return 15}get defaultWidth(){return 30}render(t,e,n,i,s,r,o){t.font="12px monospace",t.textBaseline="middle",t.textAlign="center";const a=(0,u.py)(r.cell.column.getTag("alphabet")),l=r.cell.value;if(!l)return;const h=a.get(l);t.fillStyle=h,t.fillText((0,u.GU)(l,3),e+i/2,n+s/2,i)}onMouseEnter(t,e){super.onMouseEnter(t,e)}}class w extends r.GridCellRenderer{get name(){return"MacromoleculeDifferenceCR"}get cellType(){return c.Of.MACROMOLECULE_DIFFERENCE}get defaultHeight(){return 30}get defaultWidth(){return 230}render(t,e,n,i,s,o,a){const l=o.grid,h=o.cell.value??"",c=o.tableColumn.tags.separator,m=o.tableColumn.tags[r.TAGS.UNITS];i=p(l,t,e,i);const[d,f]=h.split("#"),g=(0,u.vU)(m,c);v(t,e,n,i,s,g(d),g(f),m)}}function v(t,e,n,i,s,r,o,a,l,c){if(r.length!==o.length){const t=function(t,e){let n=0,i=0;const s=t.length>e.length?t:e,r=t.length>e.length?e:t;for(let t=0;t<r.length;t++)s[t]===r[t]&&n++;const o=s.length-r.length;for(let t=s.length-1;t>o;t--)s[t]===r[t-o]&&i++;const a=new Array(Math.abs(t.length-e.length)).fill("");function l(t){return n>i?t.concat(a):a.concat(t)}return t.length>e.length?e=l(e):t=l(t),{subParts1:t,subParts2:e}}(r,o);r=t.subParts1,o=t.subParts2}const d=t.measureText(g(r).join("")),f=t.measureText(g(o).join("")),p=Math.max(d.width,f.width);l&&(i=p+4*r.length,t.canvas.width=p+4*r.length);let y=Math.max(e,e+(i-(p+4*r.length))/2);const b=Math.max(n,n+(s-28)/2);t.save(),t.beginPath(),t.rect(e,n,l?p+4*r.length:i,s),t.clip(),t.font="12px monospace",t.textBaseline="top";let w=m.UE.Color;"HELM"!=a&&(w=(0,u.py)(a.substring(a.length-2)));for(let e=0;e<r.length;e++){const n=r[e],a=o[e],l=w.get(n);if(n!=a){const r=w.get(a),o=h(y,b-7,i,s,t,n,l,0,!0),u=h(y,b+7,i,s,t,a,r,0,!0);y=Math.max(u,o),c&&(c[e]=C(n,a,l,r,b,7,s))}else y=h(y,b,i,s,t,n,l,0,!0,.5);y+=4}t.restore()}function C(t,e,n,i,s,r,o){const a=document.createElement("canvas"),l=a.getContext("2d");l.font="12px monospace";const c=l.measureText(g([t]).join("")).width,u=l.measureText(g([e]).join("")).width,m=Math.max(c,u);return a.height=o,a.width=m+4,l.font="12px monospace",l.textBaseline="top",h(0,s-r,m,o,l,t,n,0,!0),h(0,s+r,m,o,l,e,i,0,!0),a}var S,M=n(701),T=n(2121),x=n(9298);!function(t){t.Unknown="unknown",t.FR="framework",t.CDR="cdr"}(S||(S={})),new class{constructor(){this.regionTypes=[S.CDR],this.chains=["Heavy","Light"],this.skipEmptyPositions=!1,this.positionWidth=16,this.positionHeight=x.ES.Entropy}};const E=S;class N extends r.JsViewer{constructor(){super(),this.viewed=!1,this.regionsFg=null,this.regionsRoot=null,this.isOpened=!1,this.panelNode=null,this.regions=[],this.viewPromise=Promise.resolve(),this.host=null,this.filterSourceInput=null,this.mainLayout=null,this.logos=[],this.viewSubs=[],this.regionTypes=this.stringList("regionTypes",[E.CDR],{choices:Object.values(E).filter((t=>t!=E.Unknown))}),this.chains=this.stringList("chains",["Heavy","Light"],{choices:["Heavy","Light"]}),this.skipEmptyPositions=this.bool("skipEmptyPositions",!1),this.positionWidth=this.float("positionWidth",16),this.positionHeight=this.string("positionHeight",x.ES.Entropy,{choices:Object.keys(x.ES)})}async init(){this.subs.push(s.onSizeChanged(this.root).subscribe(this.rootOnSizeChanged.bind(this))),this.subs.push(M.fromEvent(this.root,"mousemove").subscribe(this.rootOnMouseMove.bind(this)))}async onTableAttached(){const t=super.onTableAttached.bind(this);this.viewPromise=this.viewPromise.then((async()=>{t(),this.viewed||(await this.buildView("onTableAttached"),this.viewed=!0)}))}onPropertyChanged(t){if(super.onPropertyChanged(t),t)switch(t&&t.name,t.name){case"skipEmptyPositions":case"positionWidth":case"positionHeight":this.setData(this.dataFrame,this.regions)}else console.warn("Bio: VdRegionsViewer.onPropertyChanged() property is null")}setData(t,e){console.debug("Bio: VdRegionsViewer.setData()"),this.viewPromise=this.viewPromise.then((async()=>{this.viewed&&(await this.destroyView("setData"),this.viewed=!1)})),this.regions=e,this.dataFrame=t,this.viewPromise=this.viewPromise.then((async()=>{this.viewed||(await this.buildView("setData"),this.viewed=!0)}))}detach(){const t=super.detach.bind(this);this.viewPromise=this.viewPromise.then((async()=>{this.viewed&&(await this.destroyView("detach"),this.viewed=!1),t()}))}async destroyView(t){console.debug(`Bio: VdRegionsViewer.destroyView( mainLayout = ${this.mainLayout?"value":"none"} ), purpose = '${t}'`),this.filterSourceInput&&s.empty(this.filterSourceInput.root),null!=this.mainLayout&&(this.mainLayout.remove(),this.host.remove(),this.host=null,this.mainLayout=null);for(const t of this.viewSubs)t.unsubscribe()}async buildView(t){console.debug(`Bio: VdRegionsViewer.buildView() begin, purpose = '${t}'`);const e=this.regions.filter((t=>this.regionTypes.includes(t.type))),n=Array.from(new Set(e.map((t=>t.order)))).sort();this.logos=[];for(let t=0;t<n.length;t++){const i={};for(const s of this.chains){const r=e.find((e=>e.order==n[t]&&e.chain==s));i[s]=await this.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:r.sequenceColumnName,startPositionName:r.positionStartName,endPositionName:r.positionEndName,fixWidth:!0,skipEmptyPositions:this.skipEmptyPositions,positionWidth:this.positionWidth,positionHeight:this.positionHeight})}this.logos[t]=i}this.mainLayout=s.table(this.chains,(t=>[...n.length>0?[s.div(t,{style:{transform:"rotate(-90deg)",font:"12px Roboto, Roboto Local, sans-serif",textAlign:"center",width:"16px",marginTop:"24px",marginLeft:"6px"}})]:[],...[...Array(n.length).keys()].map((e=>{const n=this.logos[e][t];return n.root.style.height="100%",s.div([n.root],{style:{marginTop:"4px",marginBottom:"4px"}})}))]),["",...[...Array(n.length).keys()].map((t=>e.find((e=>e.order==n[t]&&e.chain==this.chains[0])).name||"Name"))]),this.mainLayout.className="mlb-vd-regions-viewer-table2",this.filterSourceInput=s.boolInput("",!1,this.filterSourceInputOnValueChanged.bind(this)),this.filterSourceInput.root.style.position="absolute",this.filterSourceInput.root.style.left="10px",this.filterSourceInput.root.style.top="-3px",s.tooltip.bind(this.filterSourceInput.root,"Check to filter sequences for selected VRs"),Math.ceil(255*Math.random()).toString(16),this.host=s.div([this.mainLayout,this.filterSourceInput.root],{}),this.root.appendChild(this.host),this.root.style.overflowX="auto",this.calcSize(),console.debug("Bio: VdRegionsViewer.buildView() end")}calcSize(){const t=(this.root.clientHeight-54)/this.chains.length,e=Math.min(t,Math.max(...this.logos.map((t=>Math.max(...Object.values(t).map((t=>t.maxHeight)))))));for(let t=0;t<this.logos.length;t++)for(let n=0;n<this.chains.length;n++){const i=this.chains[n];this.logos[t][i].root.style.height=`${e}px`}}rootOnSizeChanged(t){this.calcSize()}rootOnMouseMove(t){}filterSourceInputOnValueChanged(){const t=1==this.filterSourceInput.value?x.Ct.Selected:x.Ct.Filtered;for(let e=0;e<this.logos.length;e++)for(let n=0;n<this.chains.length;n++){const i=this.chains[n];this.logos[e][i].setOptions({[T.bo.filterSource]:t})}}}var A=n(9017),I=n(850);async function L(t,e,i,s,r){const o=await async function(t,e,i,s){return new Promise((function(r,o){const a=new Worker(new URL(n.p+n.u(729),n.b));a.postMessage({columnData:t.data,method:e,measure:t.metric,options:i,parallelDistanceWorkers:s}),a.onmessage=({data:{error:t,distance:e,embedding:n}})=>{t?o(t):r({distance:e,embedding:n}),setTimeout((()=>a.terminate()),0)}}))}({data:t,metric:i},e,s,r);return o.embedding=o.embedding.map((t=>(0,I.Fv)(t))),o}var k=n(7983),_=n(499),R=n(7767),O=n(489);async function G(t){const e=new R.L(t.seqCol);if(e.isFasta()||e.isSeparator()&&e.alphabet&&"UN"!==e.alphabet){let n=O.U.LEVENSHTEIN,i=t.seqCol.toList();if(e.isSeparator()){const t=e.convert("fasta");i=t.toList(),n=_.C.getOrCreate(t).getDistanceFunctionName()}else n=e.getDistanceFunctionName();for(let e=0;e<i.length;e++)i[e]=t.seqCol.isNone(e)?null:i[e];const s=await L(i,t.methodName,n,t.options,!0),o=t.embedAxesNames.map(((t,e)=>r.Column.fromFloat32Array(t,s.embedding[e])));return{distance:s.distance,coordinates:new r.ColumnList(o)}}return await async function(t){return t.seqCol.version!==t.seqCol.temp["last-invalidated-version"]&&await(0,k.HV)(t.seqCol,!1),await i.functions.call("Chem:getChemSpaceEmbeddings",{col:t.seqCol.temp["monomeric-mols"],methodName:t.methodName,similarityMetric:t.similarityMetric,xAxis:t.embedAxesNames[0],yAxis:t.embedAxesNames[1],options:t.options})}(t)}function P(t){const e=["Embed_X","Embed_Y"],n=t.columns.names().filter((t=>t.includes(e[0]))).length+1;return e.map((t=>`${t}_${n}`))}var F=n(5697),W=n(3379),V=n.n(W),H=n(7795),Z=n.n(H),U=n(569),D=n.n(U),B=n(3565),Y=n.n(B),z=n(9216),X=n.n(z),q=n(4589),K=n.n(q),j=n(9414),$={};$.styleTagTransform=K(),$.setAttributes=Y(),$.insert=D().bind(null,"head"),$.domAPI=Z(),$.insertStyleElement=X(),V()(j.Z,$),j.Z&&j.Z.locals&&j.Z.locals;var J=n(3914),Q=n(6254);let tt=0;const et="cliffsDf",nt=new M.Subject,it="act_diff",st="sali",rt="sim",ot="line_index",at=["1_seq","2_seq"],lt="filterCliffs";function ht(t,e,n){const i=e.getBoundingClientRect(),s=t.clientX-i.left,r=t.clientY-i.top;let o=null,a=0;for(const t of n){const e=Math.abs(Math.hypot(t.a[0]-s,t.a[1]-r)+Math.hypot(t.b[0]-s,t.b[1]-r)-Math.hypot(t.a[0]-t.b[0],t.a[1]-t.b[1]));(!a&&e<2||e<a)&&(a=e,o=t)}return o}var ct=n(1040);async function ut(t,e,n,s,o){e.version!==e.temp["last-invalidated-version"]&&await(0,k.HV)(e,!1);const a=r.DataFrame.create(e.length);return a.columns.addNewString(s).init((t=>e.temp["monomeric-mols"].get(t))),await i.functions.call("Chem:getChemSimilaritiesMatrix",{dim:t,col:e.temp["monomeric-mols"],df:a,colName:s,simArr:o})}function mt(t){const e=s.divH([]),n=s.divV([s.divText(t.seqCol.name),s.divText(t.activityCol.name)]);return n.style.fontWeight="bold",n.style.display="flex",n.style.justifyContent="space-between",e.append(n),t.line.mols.forEach(((n,i)=>{const r=s.divText(t.activityCol.get(n).toFixed(2));r.style.display="flex",r.style.justifyContent="left",r.style.paddingLeft="30px",e.append(s.divV([s.divText(t.seqCol.get(n)),r]))})),e}function dt(t){const e=s.div();e.append(s.divText(t.seqCol.name,{style:{fontWeight:"bold"}}));const n=new Array(2),i=new Array(2);t.line.mols.forEach(((e,s)=>{n[s]=t.seqCol.get(e),i[s]=t.activityCol.get(e)}));const o={},a=t.seqCol.getTag(r.TAGS.UNITS),l=t.seqCol.getTag("separator"),h=(0,u.vU)(a,l),c=pt(h(n[0]),h(n[1]),a,o);return e.append(s.div(c,{style:{width:"300px",overflow:"scroll"}})),e.append(gt(o)),e.append(ft("Activity delta",Math.abs(i[0]-i[1]))),e.append(ft("Cliff",t.sali)),e}function ft(t,e){return s.divH([s.divText(`${t}: `,{style:{fontWeight:"bold",paddingRight:"5px"}}),s.divText(e.toFixed(2))],{style:{paddingTop:"10px"}})}function pt(t,e,n,i){const s=document.createElement("canvas"),r=s.getContext("2d");return s.height=30,v(r,0,0,0,30,t,e,n,!0,i),s}function gt(t){const e=s.div();if(Object.keys(t).length>0){const n=s.divV([]);n.append(s.divH([s.divText("Pos",{style:{fontWeight:"bold",width:"30px",borderBottom:"1px solid"}}),s.divText("Difference",{style:{fontWeight:"bold",borderBottom:"1px solid"}})]));for(const e of Object.keys(t))t[e].style.borderBottom="1px solid lightgray",n.append(s.divH([s.divText((parseInt(e)+1).toString(),{style:{width:"30px",borderBottom:"1px solid lightgray"}}),t[e]]));e.append(n)}return e}function yt(t,e){const n=r.Column.string("seq_diff",t.rowCount).init((n=>`${t.get(e[0],n)}#${t.get(e[1],n)}`));n.semType="MacromoleculeDifference",n.setTag(r.TAGS.UNITS,t.col(e[0]).getTag(r.TAGS.UNITS)),n.setTag("separator",t.col(e[0]).getTag("separator")),t.columns.add(n);const i=t.plot.grid();return i.col(e[0]).visible=!1,i.col(e[1]).visible=!1,i}n(7861);var bt=n(4004),wt=n(7228),vt=n(1731),Ct=n(5226);n(9133);class St extends r.JsViewer{constructor(t){super(),this.name="",this.metricsProperties=["distanceMetric","fingerprint"],this.fingerprintChoices=["Morgan","Pattern"],this.initialized=!1,this.tags=[r.TAGS.UNITS,"aligned","separator","alphabet"],this.preComputeDistanceMatrix=!1,this.fingerprint=this.string("fingerprint",this.fingerprintChoices[0],{choices:this.fingerprintChoices}),this.limit=this.int("limit",10),this.distanceMetric=this.string("distanceMetric",F.kg[0],{choices:F.kg}),this.moleculeColumnName=this.string("moleculeColumnName"),this.name=t}init(){this.initialized=!0}detach(){this.subs.forEach((t=>t.unsubscribe()))}async onTableAttached(){if(this.init(),this.dataFrame){this.preComputeDistanceMatrix=this.dataFrame.rowCount<=22e3,this.subs.push(r.debounce(this.dataFrame.onRowsRemoved,50).subscribe((async t=>await this.render())));const t="diversity"!==this.name;this.subs.push(r.debounce(this.dataFrame.onCurrentRowChanged,50).subscribe((async e=>await this.render(t)))),this.subs.push(r.debounce(this.dataFrame.selection.onChanged,50).subscribe((async t=>await this.render(!1)))),this.subs.push(r.debounce(s.onSizeChanged(this.root),50).subscribe((async t=>await this.render(!1)))),this.moleculeColumn=this.dataFrame.columns.bySemType(r.SEMTYPE.MACROMOLECULE),this.moleculeColumnName=this.moleculeColumn?.name,this.getProperty("limit").fromOptions({min:1,max:this.dataFrame.rowCount})}await this.render()}onPropertyChanged(t){if(super.onPropertyChanged(t),this.initialized){if("moleculeColumnName"===t.name){const e=this.dataFrame.col(t.get(this));e.semType===r.SEMTYPE.MACROMOLECULE&&(this.moleculeColumn=e)}this.render()}}async render(t=!0){}beforeRender(){return!(!this.initialized||this.dataFrame&&this.moleculeColumnName&&this.dataFrame.col(this.moleculeColumnName).semType!==r.SEMTYPE.MACROMOLECULE&&(i.shell.error(`${this.moleculeColumnName} is not Macromolecule type`),1))}}var Mt=n(7241),Tt=n(4293),xt=n(2669);async function Et(t){const e=t.toList();if(t.semType!==r.SEMTYPE.MACROMOLECULE)throw new Error("Column has to be of macromolecule type");const n=_.C.getOrCreate(t).getDistanceFunctionName(),i=new xt.m(!0,!1),s=await i.calc(e,n);return i.terminate(),s}function Nt(t){return(e,n)=>{const i=(e,n)=>t*e+n-Math.floor((e+2)*(e+1)/2);return e<=n?i(e,n):i(n,e)}}class At extends St{constructor(){super("similarity"),this.sketchedMolecule="",this.curIdx=0,this.molCol=null,this.idxs=null,this.scores=null,this.gridSelect=!1,this.targetMoleculeIdx=0,this.computeCompleted=new M.Subject,this.distanceMatrixComputed=!1,this.cutoff=this.float("cutoff",.01,{min:0,max:1}),this.hotSearch=this.bool("hotSearch",!0),this.similarColumnLabel=this.string("similarColumnLabel",null)}init(){this.hotSearch=!0,this.initialized=!0}async render(t=!0){if(this.beforeRender()&&this.moleculeColumn&&(this.curIdx=-1==this.dataFrame.currentRowIdx?0:this.dataFrame.currentRowIdx,t&&!this.gridSelect)){this.targetMoleculeIdx=-1==this.dataFrame.currentRowIdx?0:this.dataFrame.currentRowIdx;const t=_.C.getOrCreate(this.moleculeColumn);await(t.isFasta()?this.computeByMM():this.computeByChem());const e=null!=this.similarColumnLabel?this.similarColumnLabel:`similar (${this.moleculeColumnName})`;this.molCol=r.Column.string(e,this.idxs.length).init((t=>this.moleculeColumn?.get(this.idxs?.get(t)))),this.molCol.semType=r.SEMTYPE.MACROMOLECULE,this.tags.forEach((t=>this.molCol.setTag(t,this.moleculeColumn.getTag(t))));const n=r.DataFrame.fromColumns([this.idxs,this.molCol,this.scores]);n.onCurrentRowChanged.subscribe((t=>{this.dataFrame.currentRowIdx=n.col("indexes").get(n.currentRowIdx),setTimeout((()=>{this.createPropertyPanel(n)}),1e3),this.gridSelect=!0}));const s=n.plot.grid();s.col("indexes").visible=!1;const o=this.idxs?.getRawData().findIndex((t=>t==this.targetMoleculeIdx));s.cell("score",o).cell.value=null,i.shell.v.grid.root.addEventListener("click",(t=>{this.gridSelect=!1})),(0,Tt.Y)(this.root,s.root),this.computeCompleted.next(!0)}}async computeByChem(){const t=await(0,Mt.D)(this.moleculeColumn),e=(r.DataFrame.fromColumns([t]),await i.functions.call("Chem:callChemSimilaritySearch",{df:this.dataFrame,col:t,molecule:t.get(this.targetMoleculeIdx),metricName:this.distanceMetric,limit:this.limit,minScore:this.cutoff,fingerprint:this.fingerprint}));this.idxs=e.getCol("indexes"),this.scores=e.getCol("score")}async computeByMM(){let t=new Float32Array;!this.distanceMatrixComputed&&this.preComputeDistanceMatrix?(this.mmDistanceMatrix=await Et(this.moleculeColumn),this.distanceMatrixComputed=!0):this.preComputeDistanceMatrix||(t=await async function(t,e){const i=t.toList();if(t.semType!==r.SEMTYPE.MACROMOLECULE)throw new Error("Column has to be of macromolecule type");const s=_.C.getOrCreate(t).getDistanceFunctionName(),o=Math.min(Math.max(navigator.hardwareConcurrency-2,1),i.length),a=new Array(o).fill(null).map((t=>new Worker(new URL(n.p+n.u(190),n.b)))),l=new Float32Array(i.length);let h=0,c=Number.MIN_VALUE;const u=a.map(((t,n)=>{const r=Math.floor(n*i.length/o),u=n===a.length-1?Math.floor((n+1)*i.length/o):i.length;return new Promise(((n,o)=>{t.onmessage=({data:{error:t,distanceArrayData:e,min:i,max:s}})=>{t?o(t):(h=Math.min(h,i),c=Math.max(c,s),l.set(e,r),n())},t.postMessage({fnName:s,values:i,templateIdx:e,start:r,end:u})}))}));try{await Promise.all(u),l.forEach(((t,e)=>{l[e]=(t-h)/(c-h)})),a.forEach((t=>t.terminate()))}catch(t){throw a.forEach((t=>t.terminate())),t}return l}(this.moleculeColumn,this.targetMoleculeIdx));const e=this.moleculeColumn.length,i=Nt(e),s=Array(e).fill(0).map(((e,n)=>({idx:n,score:n===this.targetMoleculeIdx?1:this.preComputeDistanceMatrix?1-this.mmDistanceMatrix[i(this.targetMoleculeIdx,n)]:1-t[n]})));s.sort(((t,e)=>e.score-t.score));const o=Math.min(this.limit,e),a=s.slice(0,o);this.idxs=r.Column.int("indexes",o).init((t=>a[t].idx)),this.scores=r.Column.float("score",o).init((t=>a[t].score))}createPropertyPanel(t){const e=s.div(),n={},o=this.molCol?.name,a=t.col(o).getTag(r.TAGS.UNITS),l=t.col(o).getTag("separator"),h=(0,u.vU)(a,l),c=h(this.moleculeColumn.get(this.targetMoleculeIdx)),m=h(t.get(o,t.currentRowIdx)),d=pt(c,m,a,n);e.append(s.div(d,{style:{width:"300px",overflow:"scroll"}})),c.length!==m.length&&e.append(s.divV([s.divText("Different sequence length:",{style:{fontWeight:"bold"}}),s.divText(`target: ${c.length} monomers`),s.divText(`selected: ${m.length} monomers`)],{style:{paddingBottom:"10px"}})),e.append(gt(n));const f=s.accordion(),p=s.element("i");p.className="grok-icon svg-icon svg-view-layout",f.addTitle(s.span([p,s.label("Similarity search")])),f.addPane("Differences",(()=>e),!0),i.shell.o=f.root}}var It=n(8518);class Lt extends St{constructor(){super("diversity"),this.renderMolIds=null,this.columnNames=[],this.computeCompleted=new M.Subject,this.diverseColumnLabel=this.string("diverseColumnLabel",null)}async render(t=!0){if(this.beforeRender()&&this.dataFrame&&t&&this.moleculeColumn){const t=_.C.getOrCreate(this.moleculeColumn);await(t.isFasta()?this.computeByMM():this.computeByChem());const e=null!=this.diverseColumnLabel?this.diverseColumnLabel:`diverse (${this.moleculeColumnName})`,n=r.Column.string(e,this.renderMolIds.length).init((t=>this.moleculeColumn?.get(this.renderMolIds[t])));n.semType=r.SEMTYPE.MACROMOLECULE,this.tags.forEach((t=>n.setTag(t,this.moleculeColumn.getTag(t))));const i=r.DataFrame.fromColumns([n]);i.onCurrentRowChanged.subscribe((t=>{this.dataFrame.currentRowIdx=this.renderMolIds[i.currentRowIdx]})),(0,Tt.Y)(this.root,i.plot.grid().root),this.computeCompleted.next(!0)}}async computeByChem(){const t=await(0,Mt.D)(this.moleculeColumn);r.DataFrame.fromColumns([t]),this.renderMolIds=await i.functions.call("Chem:callChemDiversitySearch",{col:t,metricName:this.distanceMetric,limit:this.limit,fingerprint:this.fingerprint})}async computeByMM(){const t=await Et(this.moleculeColumn),e=this.moleculeColumn.length,n=Nt(e);this.renderMolIds=(0,It.L)(e,Math.min(e,this.limit),((e,i)=>this.moleculeColumn.isNone(e)||this.moleculeColumn.isNone(i)?0:t[n(e,i)]))}}var kt=n(9943),_t=n(4413),Rt=n(1061),Ot=n(1345),Gt=n(116);const Pt={[r.SEMTYPE.MOLECULE]:"Molecules",[r.SEMTYPE.MACROMOLECULE]:"Sequences"};class Ft{get algorithmOptions(){const t=this.methodsParams[this.methodInput.value],e={};return Object.keys(t).forEach((n=>{null!=t[n].value&&(e[n]=t[n].value)})),e}constructor(t){this.methodSettingsDiv=s.inputs([]),this.methodsParams={[Gt.AL.UMAP]:new Gt.bD,[Gt.AL.T_SNE]:new Gt.aP},this.tableInput=s.tableInput("Table",i.shell.tv.dataFrame,void 0,(()=>{this.onTableInputChanged(t)})),this.molColInput=s.columnInput(Pt[t],this.tableInput.value,this.tableInput.value.columns.bySemType(t),null,{filter:t=>t.semType===r.SEMTYPE.MOLECULE}),this.molColInputRoot=this.molColInput.root,this.methodInput=s.choiceInput("Method",Gt.AL.UMAP,[Gt.AL.UMAP,Gt.AL.T_SNE],(()=>{e&&this.createAlgorithmSettingsDiv(this.methodSettingsDiv,this.methodsParams[this.methodInput.value])})),this.methodSettingsIcon=s.icons.settings((()=>{e=!e,e?this.createAlgorithmSettingsDiv(this.methodSettingsDiv,this.methodsParams[this.methodInput.value]):s.empty(this.methodSettingsDiv)}),"Modify methods parameters"),this.methodInput.root.classList.add("ml-dim-reduction-settings-input"),this.methodInput.root.prepend(this.methodSettingsIcon),this.methodSettingsDiv=s.inputs([]);let e=!1;this.similarityMetricInput=s.choiceInput("Similarity",ct.gk.Tanimoto,F.Rt)}createAlgorithmSettingsDiv(t,e){return s.empty(t),Object.keys(e).forEach((n=>{const i=e[n],r=s.floatInput(i.uiName,i.value,(()=>{i.value=r.value}));s.tooltip.bind(r.root,i.tooltip),t.append(r.root)})),t}onTableInputChanged(t){this.molColInput=s.columnInput(Pt[t],this.tableInput.value,this.tableInput.value.columns.bySemType(t)),s.empty(this.molColInputRoot),Array.from(this.molColInput.root.children).forEach((t=>this.molColInputRoot.append(t)))}}class Wt extends Ft{get funcParams(){return{table:this.tableInput.value,molecules:this.molColInput.value,methodName:this.methodInput.value,similarityMetric:this.similarityMetricInput.value,plotEmbeddings:this.plotEmbeddingsInput.value,options:this.algorithmOptions}}get paramsUI(){return this.funcParamsDiv}constructor(t){super(t),this.plotEmbeddingsInput=s.boolInput("Plot Embeddings",!0),this.funcParamsDiv=s.inputs([this.tableInput,this.molColInput,this.methodInput,this.methodSettingsDiv,this.similarityMetricInput,this.plotEmbeddingsInput],{style:{minWidth:"320px"}})}}class Vt extends Ft{get funcParams(){return{table:this.tableInput.value,molecules:this.molColInput.value,activities:this.activitiesInput.value,similarity:this.similarityInput.value,methodName:this.methodInput.value,similarityMetric:this.similarityMetricInput.value,options:this.algorithmOptions}}get paramsUI(){return this.funcParamsDiv}constructor(t){super(t),this.activitiesInput=s.columnInput("Activities",this.tableInput.value,r.Utils.firstOrNull(this.tableInput.value.columns.numerical),null,{filter:t=>t.type===r.TYPE.INT}),this.activitiesInputRoot=this.activitiesInput.root,this.similarityInput=s.intInput("Similarity cutoff",80),s.tooltip.bind(this.similarityInput.root,"Pairs of similar (cutoff is used) molecules with high difference in activity are considered 'cliffs'"),this.funcParamsDiv=s.inputs([this.tableInput,this.molColInput,this.activitiesInput,this.similarityInput,this.methodInput,this.methodSettingsDiv,this.similarityMetricInput],{style:{minWidth:"320px"}})}onTableInputChanged(t){super.onTableInputChanged(t),s.empty(this.activitiesInputRoot),this.activitiesInput=s.columnInput("Activities",this.tableInput.value,r.Utils.firstOrNull(this.tableInput.value.columns.numerical),null,{filter:t=>t.type===r.TYPE.INT}),Array.from(this.activitiesInput.root.children).forEach((t=>this.activitiesInputRoot.append(t)))}}var Ht,Zt=function(t,e,n,i){return new(n||(n=Promise))((function(s,r){function o(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}l((i=i.apply(t,e||[])).next())}))};class Ut{constructor(t,e,n=!1,i){var r;this.name="",this.description="",this._isAutomatic=!1,this._autoStartFirstStep=!1,this._currentStep=0,this._isStopped=!1,this._isCancelled=!1,this._isStepProcessed=!1,this._root=s.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._steps=[],this._mainHeader=s.panel([],"tutorials-main-header"),this._header=s.h2(""),this._headerDiv=s.divH([],"tutorials-root-header"),this._stopStartBtn=s.button(s.iconFA("pause"),(()=>this._changeStopState()),"Play / pause"),this._restartBtn=s.button(s.iconFA("redo"),(()=>this._restartScript()),"Restart"),this._nextStepBtn=s.button(s.iconFA("play"),(()=>{this._isStepProcessed||this._nextStep()}),"Next step"),this._activity=s.panel([],"tutorials-root-description"),this._progressDiv=s.divV([],"tutorials-root-progress"),this._progress=s.element("progress"),this._progressSteps=s.divText(""),this._closeBtn=s.button(s.iconFA("chevron-left"),(()=>this._closeDock()),"Back to demo"),this.name=t,this.description=e,this._isAutomatic=n,this._autoStartFirstStep=null!==(r=null==i?void 0:i.autoStartFirstStep)&&void 0!==r&&r,this._progress.max=0,this._progress.value=1,Ut.currentObject=this}get steps(){return this._steps}get stepNumber(){return this._steps.length}_addHeader(){this._createHeaderDiv(),this._createProgressDiv(),this._mainHeader.append(this._headerDiv,this._progressDiv)}_createHeaderDiv(){this._header.innerText=this.name,this._headerDiv.append(this._closeBtn),this._headerDiv.append(this._header),this._nextStepBtn.firstChild.className="grok-icon fas fa-play",this._headerDiv.append(this._isAutomatic?this._stopStartBtn:this._nextStepBtn)}_createProgressDiv(){this._progress.max=this.stepNumber,this._progressDiv.append(this._progress),this._progressSteps=s.divText(`Step: ${this._progress.value} of ${this.stepNumber}`),this._progressDiv.append(this._progressSteps)}_addDescription(){var t;this._activity.append(s.div(this.description,"tutorials-root-description"));for(let e=0;e<this.stepNumber;e++){let n=s.iconFA("clock");this._isAutomatic||0===e&&(n=s.iconFA("play",(()=>this._nextStep()),"Next step"),n.className="grok-icon fas fa-play");const i=s.div(this._steps[e].name,"grok-tutorial-entry-instruction"),r=s.div(null===(t=this._steps[e].options)||void 0===t?void 0:t.description,"grok-tutorial-step-description hidden"),o=s.divH([n,i],"grok-tutorial-entry");this._activity.append(o,r)}}_initRoot(){var t,e,n;i.shell.windows.showContextPanel=!0,i.shell.windows.showHelp=!1;const s=Array.from(i.shell.dockManager.rootNode.children)[0];this._node=i.shell.dockManager.dock(this._root,r.DOCK_TYPE.FILL,s,""),(null===(e=null===(t=s.parent.container.containerElement.firstElementChild)||void 0===t?void 0:t.lastElementChild)||void 0===e?void 0:e.classList.contains("tab-handle-list-container"))&&(null===(n=s.parent.container.containerElement.firstElementChild)||void 0===n||n.lastElementChild.remove()),this._node.container.containerElement.classList.add("tutorials-demo-script-container"),this._addHeader(),this._root.append(this._mainHeader),this._addDescription(),this._root.append(this._activity)}_nextStep(){var t,e;return Zt(this,void 0,void 0,(function*(){this._isStepProcessed=!0,this._isAutomatic||(this._nextStepBtn.classList.add("disabled"),this._nextStepBtn.firstChild.classList.add("fa-disabled"));const n=this._activity.getElementsByClassName("grok-tutorial-entry")[this._currentStep],i=this._activity.getElementsByClassName("grok-icon")[this._currentStep],r=this._activity.getElementsByClassName("grok-tutorial-step-description")[this._currentStep];i.className="grok-icon far fa-spinner-third fa-spin",r.classList.remove("hidden"),r.classList.add("visible");const o=n,a=(null===(t=this._steps[this._currentStep].options)||void 0===t?void 0:t.delay)?null===(e=this._steps[this._currentStep].options)||void 0===e?void 0:e.delay:2e3;yield this._steps[this._currentStep].func(),this._scrollTo(this._root,o.offsetTop-this._mainHeader.offsetHeight),yield this._countdown(n,i,a),yield(0,Rt.gw)(a);const l=s.iconFA("check");if(i.replaceWith(l),l.className="grok-icon far fa-check",this._progress.value++,this._progressSteps.innerText=`Step: ${this._progress.value} of ${this.stepNumber}`,this._currentStep++,this._isStepProcessed=!1,this._currentStep!==this.stepNumber){if(!this._isAutomatic){const t=this._activity.getElementsByClassName("grok-icon")[this._currentStep],e=s.iconFA("play",(()=>this._nextStep()),"Next step");e.className="grok-icon fas fa-play",t.replaceWith(e),this._nextStepBtn.classList.remove("disabled"),this._nextStepBtn.firstChild.classList.remove("fa-disabled")}}else this._isAutomatic?this._stopStartBtn.replaceWith(this._restartBtn):this._nextStepBtn.replaceWith(this._restartBtn)}))}_startScript(){return Zt(this,void 0,void 0,(function*(){for(let t=this._currentStep;t<this.stepNumber&&!this._isStopped&&!this._isCancelled;t++)yield this._nextStep()}))}_scrollTo(t,e){t.focus(),t.scrollTop=e}_countdown(t,e,n){return Zt(this,void 0,void 0,(function*(){const i=s.div([],"demo-script-countdown");e.classList.add("hidden");let r=n/1e3;const o=this._createSVGIndicator(r);i.append(o),t.prepend(i);const a=setInterval((()=>{r--,0===r&&(clearInterval(a),i.remove(),e.classList.remove("hidden"),e.classList.add("visible"))}),1e3)}))}_createSVGIndicator(t){const e=document.createElementNS("http://www.w3.org/2000/svg","svg"),n=document.createElementNS("http://www.w3.org/2000/svg","circle");return n.setAttributeNS(null,"cx","7"),n.setAttributeNS(null,"cy","7"),n.setAttributeNS(null,"r","6"),n.setAttributeNS(null,"style",`animation: countdown ${t}s linear infinite forwards`),e.append(n),e}_changeStopState(){const t=this._stopStartBtn.getElementsByClassName("grok-icon");t[0].className="grok-icon fas fa-play",this._isStopped=!this._isStopped,this._isStopped||(t[0].className="grok-icon fal fa-pause",this._isStepProcessed||this._startScript())}_restartScript(){i.shell.dockManager.close(this._node),i.shell.closeAll(),this._clearRoot(),this._setInitParams(),this.start()}_clearRoot(){this._root=s.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._mainHeader=s.panel([],"tutorials-main-header"),this._header=s.h2(""),this._headerDiv=s.divH([],"tutorials-root-header"),this._activity=s.panel([],"tutorials-root-description"),this._progressDiv=s.divV([],"tutorials-root-progress"),this._progress=s.element("progress"),this._progressSteps=s.divText(""),this._progress.max=0,this._progress.value=1}_setInitParams(){this._currentStep=0,this._isStopped=!1,this._isCancelled=!1,this._stopStartBtn.getElementsByClassName("grok-icon")[0].className="grok-icon fal fa-pause",this._nextStepBtn.classList.remove("disabled")}_closeDock(){i.shell.dockManager.close(this._node),this.cancelScript()}cancelScript(){this._isCancelled=!0,Ut.currentObject=null}step(t,e,n){return this._steps[this.steps.length]={name:t,func:e,options:n},this}start(){return Zt(this,void 0,void 0,(function*(){this._initRoot(),i.shell.newView(this.name),this._isAutomatic?this._startScript():this._autoStartFirstStep&&(yield this._nextStep())}))}}function Dt(t){const e=t instanceof Error?t.message:t.toString(),n=t instanceof Error?t.stack:void 0;i.shell.error(e),oe.logger.error(t.message,void 0,n)}Ut.currentObject=null,function(t){t.X="Embed_X",t.Y="Embed_Y"}(Ht||(Ht={}));const Bt="data/sample_FASTA_PT_activity.csv";var Yt=n(1811),zt=function(t,e,n,i){return new(n||(n=Promise))((function(s,r){function o(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}l((i=i.apply(t,e||[])).next())}))};function Xt(){return zt(this,void 0,void 0,(function*(){const t="Dendrogram",e=r.Func.find({package:t,name:"getTreeHelper"});if(0===e.length)throw new Error(`Package "${t}" must be installed for TreeHelper.`);return(yield e[0].prepare().call()).getOutputParamValue()}))}var qt=function(t,e,n,i){return new(n||(n=Promise))((function(s,r){function o(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}l((i=i.apply(t,e||[])).next())}))};function Kt(){return qt(this,void 0,void 0,(function*(){return yield i.functions.call("Dendrogram:getDendrogramService",{})}))}const jt="data/sample_FASTA_PT_activity.csv",$t="sequence";var Jt=n(3336),Qt=n.n(Jt);const te="data/sample_FASTA_PT_activity.csv";var ee=n(8341);const ne="samples/sample_HELM.csv";var ie=n(2568),se=n(525);class re{constructor(){this._funcName=""}async init(t,e){this._funcName=e,this.df=t,await this.buildView()}async buildView(){this.view=i.shell.addTableView(this.df),this.view.path=this.view.basePath=`func/${oe.name}.${this._funcName}`;const t=await this.view.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:"sequence"});this.view.dockManager.dock(t,r.DOCK_TYPE.DOWN,null,"WebLogo",.35)}}const oe=new r.Package;function ae(){return Ot.NT.instance}let le=null;class he{constructor(t){this._palette=t}get(t){return this._palette[t]}}async function ce(){await Ot.NT.instance.loadLibraries();const t=Ot.NT.instance.getBioLib(),e=[],n=[],s=await i.functions.call("Chem:getRdKitModule"),r=t.getMonomerMolsByPolymerType("PEPTIDE");Object.keys(r).forEach((t=>{e.push(t);const i=r[t].replaceAll("#R","O "),o=s.get_mol(i),a=JSON.parse(o.get_descriptors()).CrippenClogP;n.push(a),o?.delete()}));const o=n.reduce(((t,e)=>t+e),0)/n.length||0,a={};for(let t=0;t<e.length;t++)a[e[t]]=n[t]<o?"#4682B4":"#DC143C";le=new he(a)}async function ue(t){const e=i.shell.tv,n=await e.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:t.name,backgroundColor:4294836197,fitArea:!1,positionHeight:"Entropy",fixWidth:!0});return n.root.style.height="50px",n}function me(){return Ot.NT.instance.getBioLib()}async function de(){const t=s.dialog({title:"Manage files"}).add(s.fileBrowser({path:"System:AppData/Bio/libraries"}).root).addButton("OK",(()=>t.close())).show()}async function fe(t){const e=s.button("Manage",de),n=s.inputs([]),o=await(0,Ot.P4)();let a=Promise.resolve();for(const t of o){const e=await(0,Ot.nW)(),r=s.boolInput(t,!e.exclude.includes(t),(()=>{a=a.then((async()=>{1==r.value?e.exclude=e.exclude.filter((e=>e!=t)):e.exclude.includes(t)||e.exclude.push(t),await(0,Ot.QD)(e),await Ot.NT.instance.loadLibraries(!0),i.shell.info("Monomer library user settings saved.")}))}));n.append(r.root)}return new r.Widget(s.divV([n,s.div(e)]))}function pe(){return new y}function ge(t){return function(t){const e=Array.from(t.dataFrame.columns).filter((t=>t.semType===r.SEMTYPE.MOLECULE)).map((t=>t.name));new Set(e).delete(t.name);const n=s.choiceInput("Monomer width",null!=t?.temp["monomer-width"]?t.temp["monomer-width"]:"short",["short","long"],(e=>{t.temp["monomer-width"]=e,t.setTag(".calculatedCellRender","0"),t.dataFrame.fireValuesChanged()}));n.setTooltip("In short mode, only the first character should be visible, followed by .. if there are more characters");const i=s.boolInput("Color code",null==t?.temp["color-code"]||t.temp["color-code"],(e=>{t.temp["color-code"]=e,t.dataFrame.fireValuesChanged()}));i.setTooltip("Color code");const o=s.stringInput("Reference sequence",null!=t?.temp["reference-sequence"]?t?.temp["reference-sequence"]:"",(e=>{t.temp["reference-sequence"]=e,t.dataFrame.fireValuesChanged()}));o.setTooltip("Reference sequence is not empty, then the sequence will be render \nas a difference from the reference sequence");const a=s.boolInput("Compare with current",null==t?.temp["compare-with-current"]||t.temp["compare-with-current"],(e=>{t.temp["compare-with-current"]=e,t.dataFrame.fireValuesChanged()}));a.setTooltip('When on, all sequences get rendered in the "diff" mode');const l=s.inputs([n,i,o,a]);return new r.Widget(l)}(t)}function ye(){return new y}function be(){return new w}function we(t,e,n,i,s){const r=new A.k(i,s,n,e);return"Local alignment"==t?r.smithWaterman():r.needlemanWunch()}function ve(){return new T.OZ}function Ce(){return new N}function Se(t){const e=new Vt(r.SEMTYPE.MACROMOLECULE);s.dialog({title:"Activity Cliffs"}).add(e.paramsUI).onOK((async()=>{t.func.prepare(e.funcParams).call(!0)})).show()}async function Me(t,e,o,a,l,h){if(!(0,ie.n)(e,"Activity Cliffs"))return;const c=P(t),u={units:e.getTag(r.TAGS.UNITS),aligned:e.getTag("aligned"),separator:e.getTag("separator"),alphabet:e.getTag("alphabet")},m=new R.L(e);let d=ct.gk.Tanimoto,f=e;if(m.isFasta()||m.isSeparator()&&m.alphabet&&"UN"!==m.alphabet)if(m.isFasta())d=m.getDistanceFunctionName();else{f=m.convert("fasta");const t=_.C.getOrCreate(f);d=t.getDistanceFunctionName(),u.units="fasta"}const p=async()=>await async function(t,e,o,a,l,h,c,u,m,d,f,p,g,y,b,w,v,C){tt++;const S=c/100,M=o??e;let T=!1,x=!1;const E={};let N,A;const I={seqCol:M,methodName:m,similarityMetric:u,embedAxesNames:a,options:v},{distance:L,coordinates:k}=await p(I);for(const e of k)t.columns.add(e);let _=L;const R=Object.values(O.U).map((t=>t.toString())).includes(u);R&&!L&&(_=J.H.calc(e.toList(),O.o[u]()).data);const G=function(t,e,n){const i=[],s=[],r=[],o=[],a=new Set;for(let l=0;l!=t.length;++l)for(let h=0;h!=t.length-l;++h){const c=t[l]?t[l].get(h):0;if(c>=e){r.push(l),o.push(l+h+1),a.add(l),a.add(l+h+1),i.push(c);const t=Math.abs(n.get(l)-n.get(l+h+1));s.push(1!=c?t/(1-c):1/0)}}return{simVals:i,saliVals:s,n1:r,n2:o,cliffsMolIds:a}}(await async function(t,e,n,i){const s=t.categories,o=t.getRawData(),a=r.Column.string("seq",t.length).init((t=>s[o[t]])),l=r.DataFrame.fromColumns([a]),h=t.length;let c=Array(h-1);return n&&e?function(t,e,n){const i=(0,Q.y)(t);for(let s=0;s<t-1;++s){const o=new Float32Array(t-s-1).fill(0);for(let n=s+1;n<t;++n){const t=i(s,n);o[n-s-1]=e[t]===r.FLOAT_NULL?0:(0,F.Om)(e[t])}n[s]=r.Column.fromFloat32Array("similarity",o)}}(h,e,c):c=await i(h,t,l,"seq",c),c}(M,_,R,g),S,h),P=function(t,e,n,i,s,o){const a=new Array(t).fill(0);for(let t=0;t!=n.length;++t)e[t]!=1/0&&(o.get(n[t])>o.get(i[t])?a[n[t]]+=e[t]:a[i[t]]+=e[t]);return r.Column.fromList("double",`sali_${s[0].substring(s[0].lastIndexOf("_"))}`,a)}(M.length,G.saliVals,G.n1,G.n2,a,h);t.columns.add(P);const W=function(t,e){const n="containsCliff",i=t.columns.names().filter((t=>t.includes(n))).length+1,s=`${n}_${i}`;return r.Column.bool(s,t.rowCount).init((t=>e.has(t)))}(t,G.cliffsMolIds);t.columns.add(W);const V=function(t){const e=t.filter((t=>t!==1/0)),n=Math.min(...e);return{max:Math.max(...e),min:n}}(G.saliVals),H=.8/(V.max-V.min),Z=i.shell.getTableView(t.name);Z.grid.columns.byName(W.name).visible=!1;const U=Z.addViewer(r.VIEWER.SCATTER_PLOT,{xColumnName:a[0],yColumnName:a[1],size:P.name,color:h.name,showXSelector:!1,showYSelector:!1,showSizeSelector:!1,showColorSelector:!1,markerMinSize:5,markerMaxSize:25,title:l}),D=U.getInfo().canvas,B=function(t,e,n,i,s){const o=new Array(t.n1.length).fill(null);for(let e=0;e<t.n1.length;e++){const n=t.n1[e],i=t.n2[e];o[e]={id:e,mols:[n,i],selected:!1,a:[],b:[]}}const a=r.DataFrame.create(o.length);return at.forEach(((t,n)=>{a.columns.addNewString(t).init((t=>e.get(o[t].mols[n]))),function(t,e){Object.keys(e).forEach((n=>{t.tags[n]=e[n]}))}(a.col(t),s),a.col(t).semType=i})),a.columns.addNewFloat(it).init((t=>Math.abs(n.get(o[t].mols[0])-n.get(o[t].mols[1])))),a.columns.addNewInt(ot).init((t=>t)),a.columns.addNewFloat(st).init((e=>t.saliVals[e])),a.columns.addNewFloat(rt).init((e=>t.simVals[e])),a.name=`${et}${tt}`,{lines:o,linesDf:a}}(G,e,h,d,f),Y=w?w(B.linesDf,at).sort([st],[!1]):B.linesDf.plot.grid().sort([st],[!1]);t.temp[".cliffsDfGrid"]=Y;const z=s.button(`${B.linesDf.rowCount} cliffs`,(()=>{Z.dockManager.dock(Y,"down",null,"Activity cliffs",C??.2)}));z.classList.add("scatter_plot_link","cliffs_grid"),U.root.append(z);const X=s.switchInput("Show only cliffs",!1,(()=>{X.value?(U.dataFrame.setTag(lt,W.name),t.rows.match({[W.name]:!0}).filter(),nt.next(W.name)):(U.dataFrame.setTag(lt,""),t.filter.setAll(!0,!0),nt.next(""))}));X.root.classList.add("scatter_plot_link","show_only_cliffs"),U.root.append(X.root),nt.subscribe((t=>{X.enabled=""===t||t===W.name}));const q=i.events.onViewerClosed.subscribe((t=>{t.args.viewer===U&&(Z.dockManager.close(Y.root),q.unsubscribe(),Z.subs=Z.subs.filter((t=>t!==q)))}));return Z.subs.push(q),B.linesDf.onCurrentCellChanged.subscribe((()=>{T=!0;const n=B.linesDf.currentCol&&B.linesDf.currentCol.name===at[1]?1:0,r=-1!==B.linesDf.currentRowIdx?B.lines[B.linesDf.currentRowIdx]:null;U.dataFrame.currentRowIdx=r?r.mols[n]:-1,U.dataFrame.filter.set(0,!B.lines[0].selected),U.dataFrame.filter.set(0,B.lines[0].selected),r&&setTimeout((()=>{!function(t,e,n,r,o,a,l,h){const c=e.getPane("Cliff Details");s.empty(c.root);const u=h({cashedData:n,line:r,df:t,seqCol:o,activityCol:a,sali:l});c.root.append(u),setTimeout((()=>{i.shell.o=e.root}),500)}(t,N,E,r,e,h,B.linesDf.get(st,r.id),b);const n=U.dataFrame.getSortedOrder(Z.grid.sortByColumns,Z.grid.sortTypes);Z.grid.scrollToCell(e.name,n.indexOf(U.dataFrame.currentRowIdx))}),1e3)})),B.linesDf.onSelectionChanged.subscribe((e=>{if(!1===B.linesDf.selection.anyTrue)B.lines.forEach((t=>{t.selected=!1}));else if(-1!==B.linesDf.mouseOverRowIdx){const t=B.lines[B.linesDf.mouseOverRowIdx];t.selected=!t.selected}setTimeout((()=>{const e=r.BitSet.create(t.rowCount);B.lines.forEach((t=>{t.selected&&t.mols.forEach((n=>{e.set(n,t.selected,!0)}))})),t.selection.copyFrom(e),Z.grid.invalidate()}),300)})),t.onSelectionChanged.subscribe((e=>{x?x=!1:!1===t.selection.anyTrue&&"number"==typeof e&&(B.lines.forEach((t=>{t.selected=!1})),Y.dataFrame.selection.setAll(!1,!1),Y.invalidate())})),D.addEventListener("mousemove",(function(i){clearTimeout(A),A=n.g.setTimeout((function(){const n=ht(i,D,B.lines);n&&-1===t.mouseOverRowIdx&&s.tooltip.show(y({cashedData:E,line:n,df:t,seqCol:e,activityCol:h}),i.clientX,i.clientY)}),500)})),D.addEventListener("mousedown",(function(e){x=!0;const n=ht(e,D,B.lines);if(n&&-1===t.mouseOverRowIdx){e.ctrlKey?(n.selected=!n.selected,B.linesDf.selection.set(n.id,n.selected)):B.linesDf.currentRowIdx!==n.id&&(B.linesDf.currentRowIdx=n.id,t.currentRowIdx=n.mols[0],t.filter.set(0,!B.lines[0].selected),t.filter.set(0,B.lines[0].selected));const i=B.linesDf.getSortedOrder(Y.sortByColumns,Y.sortTypes);Y.scrollToCell(at[0],i.indexOf(n.id))}})),U.onEvent("d4-before-draw-scene").subscribe((e=>{const n=function(t,e,n,i,s,r,o){const a=i.lines,l=t.getInfo().canvas.getContext("2d"),h=t.dataFrame.columns.byName(e),c=t.dataFrame.columns.byName(n);for(let e=0;e<a.length;e++){const n=t.worldToScreen(h.get(a[e].mols[0]),c.get(a[e].mols[0])),u=t.worldToScreen(h.get(a[e].mols[1]),c.get(a[e].mols[1]));a[e].a=[n.x,n.y],a[e].b=[u.x,u.y];const m=new Path2D;m.moveTo(a[e].a[0],a[e].a[1]);const d=a[e].selected?"255,255,0":"0,128,0",f=s[e]===1/0?1:.2+(s[e]-o)*r;l.strokeStyle=`rgba(${d},${f})`,l.lineWidth=a[e].id===i.linesDf.currentRowIdx?3:1,m.lineTo(a[e].b[0],a[e].b[1]),l.stroke(m)}return a}(U,a[0],a[1],B,G.saliVals,H,V.min);if(T){const t=n[B.linesDf.currentRowIdx];setTimeout((()=>{const{zoomLeft:e,zoomRight:n,zoomTop:i,zoomBottom:s}=function(t,e,n,i,s,r){const o=Math.abs(n-s),a=Math.abs(i-r),l=t/o,h=e/a,c=Math.min(l,h),u=t/c*5,m=e/c*5,d=(n<s?n:s)+o/2-u/2,f=(i>r?i:r)-a/2+m/2;return{zoomLeft:d,zoomRight:d+u,zoomTop:f,zoomBottom:f-m}}(U.viewport.width,U.viewport.height,U.dataFrame.get(a[0],t.mols[0]),U.dataFrame.get(a[1],t.mols[0]),U.dataFrame.get(a[0],t.mols[1]),U.dataFrame.get(a[1],t.mols[1]));U.zoom(e,i,n,s)}),300),T=!1}X.value?t.rows.match({[W.name]:!0}).filter():!0===X.enabled&&t.filter.setAll(!0,!1)})),U.addProperty("similarityLimit","double",S),N=function(){const t=s.accordion(),e=s.element("i");return e.className="grok-icon svg-icon svg-view-layout",t.addTitle(s.span([e,s.label("Activity cliffs")])),t.addPane("Cliff Details",(()=>s.divText("Cliff has not been selected")),!0),i.shell.o=t.root,t}(),U}(t,f,null,c,"Activity cliffs",o,a,d,l,r.SEMTYPE.MACROMOLECULE,u,G,ut,mt,dt,yt,h),g=l===Gt.AL.UMAP?5e3:2e3;if(t.rowCount>2e4)i.shell.warning("Too many rows, maximum for sequence activity cliffs is 20000");else{if(!(t.rowCount>g))return await p();s.dialog().add(s.divText("Activity cliffs analysis might take several minutes.\n Do you want to continue?")).onOK((async()=>{const t=r.TaskBarProgressIndicator.create("Running sequence activity cliffs ..."),e=await p();return t.close(),e})).show()}}function Te(t){const e=new Wt(r.SEMTYPE.MACROMOLECULE);s.dialog({title:"Sequence Space"}).add(e.paramsUI).onOK((async()=>{t.func.prepare(e.funcParams).call(!0)})).show()}async function xe(t,e,n,o=ct.gk.Tanimoto,a,l){if(await(0,Rt.gw)(10),!(0,ie.n)(e,"Sequence space"))return;const h=P(t),c=r.DataFrame.fromColumns([e]).clone(),u=function(t,e){const n=e.categories.map(((t,e)=>t?null:e)).filter((t=>null!==t)),i=[...e.getRawData()],s=[];let r=0;for(let e=0;e<t.rowCount;e++)n.includes(i[e])&&(t.rows.removeAt(e-r),s.push(e),r+=1);return s}(c,e),m={seqCol:c.col(e.name),methodName:n,similarityMetric:o,embedAxesNames:h,options:l},d=n===Gt.AL.UMAP?1e5:15e3,f=n===Gt.AL.UMAP?5e3:2e3;if(t.rowCount>d)i.shell.warning(`Too many rows, maximum for sequence space is ${d}`);else{if(!(t.rowCount>f))return p(await G(m));s.dialog().add(s.divText("Sequence space analysis might take several minutes.\n Do you want to continue?")).onOK((async()=>{const t=r.TaskBarProgressIndicator.create("Running Sequence space..."),e=await G(m);return t.close(),p(e)})).show()}function p(e){const n=e.coordinates;for(const e of n){const n=e.toList();u.forEach((t=>n.splice(t,0,null))),t.columns.add(r.Column.float(e.name,t.rowCount).init((t=>n[t])))}if(a)return i.shell.tableView(t.name).scatterPlot({x:h[0],y:h[1],title:"Sequence space"})}}async function Ee(t,e){if(0===r.Func.find({package:"Chem",name:"getRdKitModule"}).length)return void i.shell.warning('Transformation to atomic level requires package "Chem" installed.');if(!(0,ie.n)(e,"To Atomic Level"))return;const n=(await ae()).getBioLib(),o=await(0,vt.i0)(t,e,n);null!==o.col&&(t.columns.add(o.col,!0),await i.data.detectSemanticTypes(t)),o.warnings&&o.warnings.length>0&&i.shell.warning(s.list(o.warnings))}function Ne(){(0,se.K)()}async function Ae(t=null,e=null){return(0,se.K)({col:t,clustersCol:e})}async function Ie(){const t=i.shell.tv,e=t.dataFrame.columns.toList().filter((t=>t.semType==r.SEMTYPE.MACROMOLECULE&&(_.C.getOrCreate(t),!0))),n=async e=>{if(!(0,ie.n)(e,"Composition"))return;const n=t.addViewer("WebLogo",{sequenceColumnName:e.name});i.shell.tv.dockManager.dock(n,r.DOCK_TYPE.DOWN,null,"Composition analysis",.25)};let o=null;if(0!=e.length){if(e.length>1){const t=e.map((t=>t.name)),i=e.find((t=>_.C.getOrCreate(t).isMsa())),r=s.choiceInput("Column",i?i.name:t[0],t);s.dialog({title:"Composition Analysis",helpUrl:"/help/domains/bio/macromolecules.md#composition-analysis"}).add(s.div([r])).onOK((async()=>{const t=e.find((t=>t.name==r.value))??null;t&&await n(t)})).show()}else o=e[0];o&&await n(o)}else i.shell.error("Current table does not contain sequences")}async function Le(t){(0,wt.Xk)(t)}function ke(t){return new Ct.i(t).importFasta()}function _e(){const t=(0,Tt.m)();(0,bt.O)(t)}function Re(){return new b}async function Oe(t){const e=r.TaskBarProgressIndicator.create("Test detectMacromolecule..."),n=(await i.dapi.files.list(t,!0,"")).filter((t=>t.fileName.endsWith(".csv")));let s=0;const o=[];for(const a of n)try{const e=await i.dapi.files.readAsText(t+a.fullPath),n=r.DataFrame.fromCsv(e);for(const t of n.columns)await i.functions.call("Bio:detectMacromolecule",{col:t})===r.SEMTYPE.MACROMOLECULE&&o.push({file:a.path,result:"detected",column:t.name,message:`units: ${t.getTag(r.TAGS.UNITS)}`})}catch(t){o.push({file:a.path,result:"error",column:null,message:t instanceof Error?t.message:t.toString()})}finally{s+=1,e.update(100*s/n.length,`Test ${a.fileName}`)}i.shell.info("Test Demo:Files for detectMacromolecule finished."),e.close();const a=r.DataFrame.fromObjects(o);return a.name=`datasets_detectMacromolecule_${t}`,a}function Ge(){const t=(0,Tt.m)(),e=function(t){const e=(0,o.Mj)(t),n=t=>{const e=a.columns.addNewString((t+1).toString());return i.push(e),e},i=[],s=t.length,a=r.DataFrame.create(s);for(let r=0;r<s;++r){const s=t.get(r);null!=s&&e(s).forEach(((t,e)=>{var s;((null!==(s=i[e])&&void 0!==s?s:null)||n(e)).set(r,t||"-",!1)}))}return a}(t),n=t.dataFrame;for(const i of e.columns){const e=n.columns.add(i);e.semType=c.Of.MONOMER,e.setTag("alphabet",t.getTag("alphabet"))}i.shell.tv.grid.invalidate()}function Pe(t){const e=_.C.getOrCreate(t).stats;return Object.keys(e.freq)}function Fe(){return new At}function We(){const t=i.shell.v,e=t.addViewer("Sequence Similarity Search");t.dockManager.dock(e,"down")}function Ve(){return new Lt}function He(){const t=i.shell.v,e=t.addViewer("Sequence Diversity Search");t.dockManager.dock(e,"down")}function Ze(){const t=(0,Tt.m)();(0,k.gQ)(t)}function Ue(){(0,kt.C2)()}function De(){return new _t.ST}async function Be(){const t=r.TaskBarProgressIndicator.create("WebLogo");try{const t=new re,e=await oe.files.readCsv("data/sample_PT_10000.csv");await i.data.detectSemanticTypes(e),await t.init(e,"webLogoLargeApp")}finally{t.close()}}async function Ye(){await async function(){let t,e;try{const n=new Ut("Similarity, Diversity","Sequence similarity tracking and evaluation dataset diversity");await n.step("Load DNA sequences",(async()=>{i.shell.windows.showContextPanel=!1,i.shell.windows.showProperties=!1,e=await oe.files.readCsv(Bt),t=i.shell.addTableView(e),t.grid.columns.byName("cluster").visible=!1,t.grid.columns.byName("sequence_id").visible=!1,t.grid.columns.byName("sequence").width=300,t.grid.columns.byName("activity").visible=!1,t.grid.columns.byName("is_cliff").visible=!1}),{description:"Load dataset with macromolecules of 'fasta' notation, 'DNA' alphabet.",delay:2e3}).step("Find the most similar sequences to the current one",(async()=>{const n=await e.plot.fromType("Sequence Similarity Search",{moleculeColumnName:"sequence",similarColumnLabel:"Similar to current"});t.dockManager.dock(n,r.DOCK_TYPE.RIGHT,null,"Similarity search",.35)}),{description:"Add 'Sequence Similarity Search' viewer.",delay:2e3}).step("Explore most diverse sequences in a dataset",(async()=>{const n=await e.plot.fromType("Sequence Diversity Search",{moleculeColumnName:"sequence",diverseColumnLabel:"Top diverse sequences of all data"});t.dockManager.dock(n,r.DOCK_TYPE.DOWN,null,"Diversity search",.27)}),{description:"Add 'Sequence Deversity Search' viewer.",delay:2e3}).step("Choose another sequence for similarity search",(async()=>{e.currentRowIdx=3}),{description:"Handling current row changed of data frame showing update of similar sequences.",delay:2e3}).step("One more sequence for similarity search",(async()=>{e.currentRowIdx=7}),{description:"Just one more sequence to search similar ones.",delay:2e3}).start()}catch(t){Dt(t)}}()}async function ze(){await async function(){let t,e,n,s,o;try{const a=new Ut("Sequence Space","Exploring sequence space of Macromolecules, comparison with hierarchical clustering results");await a.step("Load DNA sequences",(async()=>{[s,t,e]=await Promise.all([oe.files.readCsv(jt),Xt(),Kt()]),n=i.shell.addTableView(s),n.grid.props.rowHeight=22,n.grid.columns.byName("cluster").visible=!1,n.grid.columns.byName("sequence").width=200,n.grid.columns.byName("is_cliff").visible=!1,i.shell.windows.showContextPanel=!1,i.shell.windows.showProperties=!1}),{description:"Load dataset with macromolecules of 'fasta' notation, 'DNA' alphabet.",delay:2e3}).step("Build sequence space",(async()=>{o=await async function(t,e,n,i){let s;{const t=Object.values(Ht);for(let n=0;n<t.length;n++){const i=t[n];if(!e.col(i)){const s=n==t.length-1;e.columns.add(r.Column.float(i,e.rowCount),s)}}if(e.rowCount>=1){const i=e.getCol(n).toList(),s=Date.now();oe.logger.debug("Bio: demoBio01aUI(), calc reduceDimensionality start...");const r=await L(i,"UMAP",ct.W.Levenshtein,{}),o=Date.now();oe.logger.debug(`Bio: demoBio01aUI(), calc reduceDimensionality ET: ${(o-s)/1e3} s`);for(let n=0;n<t.length;n++){const i=t[n],s=e.getCol(i),o=r.embedding[n];s.init((t=>o[t]))}const a=Date.now();oe.logger.debug(`MLB: MlbVrSpaceBrowser.buildView(), postprocess reduceDimensionality ET: ${(a-o)/1e3} s`)}s=await e.plot.fromType(r.VIEWER.SCATTER_PLOT,{xColumnName:Ht.X,yColumnName:Ht.Y,lassoTool:!0})}return t.dockManager.dock(s,r.DOCK_TYPE.RIGHT,null,"Sequence Space",.35),s}(n,s,$t)}),{description:"Reduce sequence space dimensionality to display on 2D representation.",delay:2e3}).step("Cluster sequences",(async()=>{const i=s.getCol($t).toList(),r=J.H.calc(i,((t,e)=>Yt.T(t,e)/((t.length+e.length)/2))),o=await t.hierarchicalClusteringByDistance(r,"ward");e.injectTreeForGrid(n.grid,o,void 0,150,void 0)}),{description:"Perform hierarchical clustering to reveal relationships between sequences.",delay:2e3}).step("Select a sequence",(async()=>{s.selection.init((t=>[15].includes(t)))}),{description:"Handling selection of data frame row reflecting on linked viewers.",delay:2e3}).step("Select a bunch of sequences",(async()=>{const t=s.getCol("sequence_id");s.selection.init((e=>["c0_seq120","c0_seq105","c0_seq121","c0_seq93"].includes(t.get(e)))),s.currentRowIdx=27}),{description:"Selecting a group of rows from a data frame to show their similarity and proximity to each other on a viewer..",delay:2e3}).start()}catch(t){Dt(t)}}()}async function Xe(){await async function(){let t,e,n,s,o;const a=Gt.AL.UMAP;try{const l=new Ut("Activity Cliffs","Activity Cliffs analysis on Macromolecules data");await l.step("Load DNA sequences",(async()=>{i.shell.windows.showContextPanel=!1,i.shell.windows.showProperties=!1,[n,t,e]=await Promise.all([oe.files.readCsv(te),Xt(),Kt()]),s=i.shell.addTableView(n),s.grid.props.rowHeight=22,s.grid.columns.byName("cluster").visible=!1,s.grid.columns.byName("sequence").width=300,s.grid.columns.byName("is_cliff").visible=!1}),{description:"Load dataset with macromolecules of 'fasta' notation, 'DNA' alphabet.",delay:2e3}).step("Find activity cliffs",(async()=>{o=await Me(n,n.getCol("Sequence"),n.getCol("Activity"),80,a),s.dockManager.dock(o,r.DOCK_TYPE.RIGHT,null,"Activity Cliffs",.35),Qt()(o.root).find("button.scatter_plot_link,cliffs_grid").get()[0].click()}),{description:"Reveal similar sequences with a cliff of activity.",delay:2e3}).step("Cluster sequences",(async()=>{const i=n.getCol("sequence").toList(),r=J.H.calc(i,((t,e)=>Yt.T(t,e)/((t.length+e.length)/2))),o=await t.hierarchicalClusteringByDistance(r,"ward");e.injectTreeForGrid(s.grid,o,void 0,150,void 0),s.grid.columns.byName("Activity").scrollIntoView()}),{description:"Perform hierarchical clustering to reveal relationships between sequences.",delay:2e3}).step("Browse the cliff",(async()=>{const t=o.dataFrame.temp[".cliffsDfGrid"];t.dataFrame.rowCount>0&&(t.dataFrame.currentRowIdx=0)}),{description:"Zoom in to explore selected activity cliff details.",delay:2e3}).start()}catch(t){Dt(t)}}()}async function qe(){await async function(){const t="HELM";let e,n,o;try{await new Ut("Atomic Level","Atomic level structure of Macromolecules").step("Loading Macromolecules notation 'Helm'",(async()=>{i.shell.windows.showContextPanel=!1,i.shell.windows.showProperties=!1,e=await oe.files.readCsv("samples/sample_HELM.csv"),n=i.shell.addTableView(e);for(let e=0;e<n.grid.columns.length;e++){const i=n.grid.columns.byIndex(e);[t,"Activity"].includes(i.name)||(i.visible=!1)}}),{description:"Load dataset with macromolecules of 'fasta' notation, 'PT' alphabet (protein, aminoacids).",delay:2e3}).step("To atomic level",(async()=>{const n=e.getCol(t);await Ee(e,n)}),{description:"Get atomic level structures of Macromolecules.",delay:2e3}).step("Sketcher",(async()=>{const n=`molfile(${t})`;e.currentCell=e.cell(1,n);const i=e.currentCell.value,a=new r.chem.Sketcher(r.chem.SKETCHER_MODE.INPLACE);a.setMolFile(i),o=s.dialog().add(a).show(),await(0,Rt.gw)(3e3),o.close()}),{description:"Display atomic level structure within a sketcher.",delay:2e3}).start()}catch(t){Dt(t)}}()}async function Ke(){await async function(){let t,e,n,s,o,a;const l="msa(HELM)",h=Gt.AL.UMAP;try{const c=new Ut("Helm, MSA, Sequence Space","MSA and composition analysis on Helm data");await c.step("Load peptides with non-natural aminoacids in 'HELM' notation",(async()=>{t=i.shell.addTableView(e=await oe.files.readCsv(ne)),i.shell.windows.showContextPanel=!1,i.shell.windows.showProperties=!1}),{description:"Load dataset with macromolecules of 'Helm' notation.",delay:2e3}).step("Align peptides with non-natural aminoacids with PepSeA",(async()=>{n=e.getCol("HELM");const t=ee.J[0];s=await(0,ee.f)(n,l,t,1.53,0,void 0),e.columns.add(s),await i.data.detectSemanticTypes(e)}),{description:"Multiple sequence alignment (MSA) performed with PepSeA tool operating on non-natural aminoacids as well.",delay:2e3}).step("Build sequence space",(async()=>{a=await xe(e,s,h,O.U.LEVENSHTEIN,!0),t.dockManager.dock(a,r.DOCK_TYPE.RIGHT,null,"Sequence Space",.35)}),{description:"Reduce sequence space dimensionality to display on 2D representation.",delay:2e3}).step("Analyse sequence composition",(async()=>{o=await e.plot.fromType("WebLogo",{sequenceColumnName:l,positionWidth:40,maxHeight:50}),t.dockManager.dock(o,r.DOCK_TYPE.DOWN,null,"Composition analysis",.2)}),{description:"Composition analysis allows to reveal functional features of sequences like motifs, or variable loops.",delay:2e3}).start()}catch(t){Dt(t)}}()}},9017:(t,e,n)=>{"use strict";n.d(e,{k:()=>r});class i{constructor(){this.value=0,this.parentI=0,this.parentJ=0}}class s{constructor(t,e,n){this.seq1=t,this.seq2=e,this.score=n}}class r{fillNeedleman(){for(let t=0;t<=this.len1;t++)this.dpGrid[t][0].value=-t*this.gap,this.dpGrid[t][0].parentI=t-1,this.dpGrid[t][0].parentJ=0;for(let t=1;t<=this.len2;t++)this.dpGrid[0][t].value=-t*this.gap,this.dpGrid[0][t].parentI=0,this.dpGrid[0][t].parentJ=t-1}fillOne(t,e){this.dpGrid[t][e].value=Math.max(this.dpGrid[t-1][e-1].value+this.scores[t-1][e-1],Math.max(this.dpGrid[t-1][e].value-this.gap,this.dpGrid[t][e-1].value-this.gap)),this.dpGrid[t][e].value==this.dpGrid[t-1][e-1].value+this.scores[t-1][e-1]?(this.dpGrid[t][e].parentI=t-1,this.dpGrid[t][e].parentJ=e-1):this.dpGrid[t][e].value==this.dpGrid[t-1][e].value-this.gap?(this.dpGrid[t][e].parentI=t-1,this.dpGrid[t][e].parentJ=e):(this.dpGrid[t][e].parentI=t,this.dpGrid[t][e].parentJ=e-1)}gridFromName(t){switch(t){case"BLOSUM45":this.alignGrid=this.BLOSUM45,this.connections=this.CONBLO,this.step=1;break;case"BLOSUM50":this.alignGrid=this.BLOSUM50,this.connections=this.CONBLO,this.step=1;break;case"BLOSUM62":this.alignGrid=this.BLOSUM62,this.connections=this.CONBLO,this.step=1;break;case"BLOSUM80":this.alignGrid=this.BLOSUM80,this.connections=this.CONBLO,this.step=1;break;case"BLOSUM90":this.alignGrid=this.BLOSUM90,this.connections=this.CONBLO,this.step=1;break;case"PAM30":this.alignGrid=this.PAM30,this.connections=this.CONBLO,this.step=1;break;case"PAM70":this.alignGrid=this.PAM70,this.connections=this.CONBLO,this.step=1;break;case"PAM250":this.alignGrid=this.PAM250,this.connections=this.CONBLO,this.step=1;break;case"NUCLEOTIDES":this.alignGrid=this.NUCLEOTIDES,this.connections=this.CONNUCL,this.step=1;break;case"TRANS":this.alignGrid=this.TRANS,this.connections=this.CONNUCL,this.step=1;break;case"SCHNEIDER":this.alignGrid=this.SCHNEIDER,this.connections=this.CONSCHN,this.step=3}this.fillScores()}constructResult(t,e){let n="",i="",r="";const o=this.dpGrid[t][e].value;for(let t=0;t<this.step;t++)r+="|";for(;t>0||e>0;){this.dpGrid[t][e].parentI==t?(n=r+n,i=this.seq2.substr((e-1)*this.step,this.step)+i):this.dpGrid[t][e].parentJ==e?(i=r+i,n=this.seq1.substr((t-1)*this.step,this.step)+n):(n=t-1>=0?this.seq1.substr((t-1)*this.step,this.step)+n:r+n,i=e-1>=0?this.seq2.substr((e-1)*this.step,this.step)+i:r+i);const s=t;t=this.dpGrid[t][e].parentI,e=this.dpGrid[s][e].parentJ}return new s(n,i,o)}fillScores(){this.scores=[];for(let t=0;t<this.len1;t++){this.scores.push([]);for(let e=0;e<this.len2;e++)this.scores[t].push(this.alignGrid[this.connections[this.seq1.substr(t*this.step,this.step)]][this.connections[this.seq2.substr(e*this.step,this.step)]])}}typeRec(){if(/[ATGC]*/.test(this.seq1)&&/[ATGC]*/.test(this.seq2))return"NUCLEOTIDES";if(/[ARNDCQEGHILKMFPSTWYVBZX*]*/.test(this.seq1)&&/[ARNDCQEGHILKMFPSTWYVBZX*]*/.test(this.seq2))return"BLOSUM62";throw Error("Can't recognize sequence type")}needlemanWunch(){this.dpGrid=[];for(let t=0;t<this.len1+1;t++){const t=[];for(let e=0;e<this.len2+1;e++)t.push(new i);this.dpGrid.push(t)}this.fillNeedleman();for(let t=1;t<=this.len1;t++)for(let e=1;e<=this.len2;e++)this.fillOne(t,e);return this.constructResult(this.len1,this.len2)}smithWaterman(){this.dpGrid=[];for(let t=0;t<this.len1+1;t++){const t=[];for(let e=0;e<this.len2+1;e++)t.push(new i);this.dpGrid.push(t)}let t=0,e=0,n=0;for(let i=1;i<=this.len1;i++)for(let s=1;s<=this.len2;s++)this.fillOne(i,s),this.dpGrid[i][s].value<=0?(this.dpGrid[i][s].value=0,this.dpGrid[i][s].parentI=0,this.dpGrid[i][s].parentJ=0):0==this.dpGrid[this.dpGrid[i][s].parentI][this.dpGrid[i][s].parentJ].value&&(this.dpGrid[i][s].parentI=0,this.dpGrid[i][s].parentJ=0),this.dpGrid[i][s].value>t&&(t=this.dpGrid[i][s].value,e=i,n=s);return this.constructResult(e,n)}setSequences(t,e){this.seq1=t,this.seq2=e,this.len1=this.seq1.length/this.step,this.len2=this.seq2.length/this.step,this.fillScores()}setGap(t){this.gap=t}setMethod(t=""){"AUTO"==t&&(t=this.typeRec()),this.gridFromName(t)}constructor(t,e,n,i=""){this.seq1="",this.seq2="",this.gap=1,this.len1=0,this.len2=0,this.step=1,this.alignGrid=[],this.scores=[],this.dpGrid=[],this.connections={},this.BLOSUM45=[[5,-2,-1,-2,-1,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-2,-2,0,-1,-1,0,-5],[-2,7,0,-1,-3,1,0,-2,0,-3,-2,3,-1,-2,-2,-1,-1,-2,-1,-2,-1,0,-1,-5],[-1,0,6,2,-2,0,0,0,1,-2,-3,0,-2,-2,-2,1,0,-4,-2,-3,4,0,-1,-5],[-2,-1,2,7,-3,0,2,-1,0,-4,-3,0,-3,-4,-1,0,-1,-4,-2,-3,5,1,-1,-5],[-1,-3,-2,-3,12,-3,-3,-3,-3,-3,-2,-3,-2,-2,-4,-1,-1,-5,-3,-1,-2,-3,-2,-5],[-1,1,0,0,-3,6,2,-2,1,-2,-2,1,0,-4,-1,0,-1,-2,-1,-3,0,4,-1,-5],[-1,0,0,2,-3,2,6,-2,0,-3,-2,1,-2,-3,0,0,-1,-3,-2,-3,1,4,-1,-5],[0,-2,0,-1,-3,-2,-2,7,-2,-4,-3,-2,-2,-3,-2,0,-2,-2,-3,-3,-1,-2,-1,-5],[-2,0,1,0,-3,1,0,-2,10,-3,-2,-1,0,-2,-2,-1,-2,-3,2,-3,0,0,-1,-5],[-1,-3,-2,-4,-3,-2,-3,-4,-3,5,2,-3,2,0,-2,-2,-1,-2,0,3,-3,-3,-1,-5],[-1,-2,-3,-3,-2,-2,-2,-3,-2,2,5,-3,2,1,-3,-3,-1,-2,0,1,-3,-2,-1,-5],[-1,3,0,0,-3,1,1,-2,-1,-3,-3,5,-1,-3,-1,-1,-1,-2,-1,-2,0,1,-1,-5],[-1,-1,-2,-3,-2,0,-2,-2,0,2,2,-1,6,0,-2,-2,-1,-2,0,1,-2,-1,-1,-5],[-2,-2,-2,-4,-2,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-7,-8,-10,-1,1,-2,11,-4,-8,-5,-4,-13,-11,-1,-10,-5,-5,-17],[-8,-9,-9,-15,-13,-13,-14,-9,-6,-2,-3,-14,-4,9,-10,-6,-9,-4,2,-8,-10,-13,-8,-17],[-2,-4,-6,-8,-8,-3,-5,-6,-4,-8,-7,-6,-8,-10,8,-2,-4,-14,-13,-6,-7,-4,-5,-17],[0,-3,0,-4,-3,-5,-4,-2,-6,-7,-8,-4,-5,-6,-2,6,0,-5,-7,-6,-1,-5,-3,-17],[-1,-6,-2,-5,-8,-5,-6,-6,-7,-2,-7,-3,-4,-9,-4,0,7,-13,-6,-3,-3,-6,-4,-17],[-13,-2,-8,-15,-15,-13,-17,-15,-7,-14,-6,-12,-13,-4,-14,-5,-13,13,-5,-15,-10,-14,-11,-17],[-8,-10,-4,-11,-4,-12,-8,-14,-3,-6,-7,-9,-11,2,-13,-7,-6,-5,10,-7,-6,-9,-7,-17],[-2,-8,-8,-8,-6,-7,-6,-5,-6,2,-2,-9,-1,-8,-6,-6,-3,-15,-7,7,-8,-6,-5,-17],[-3,-7,6,6,-12,-3,1,-3,-1,-6,-9,-2,-10,-10,-7,-1,-3,-10,-6,-8,6,0,-5,-17],[-3,-4,-3,1,-14,6,6,-5,-1,-6,-7,-4,-5,-13,-4,-5,-6,-14,-9,-6,0,6,-5,-17],[-3,-6,-3,-5,-9,-5,-5,-5,-5,-5,-6,-5,-5,-8,-5,-3,-4,-11,-7,-5,-5,-5,-5,-17],[-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,-17,1]],this.PAM70=[[5,-4,-2,-1,-4,-2,-1,0,-4,-2,-4,-4,-3,-6,0,1,1,-9,-5,-1,-1,-1,-2,-11],[-4,8,-3,-6,-5,0,-5,-6,0,-3,-6,2,-2,-7,-2,-1,-4,0,-7,-5,-4,-2,-3,-11],[-2,-3,6,3,-7,-1,0,-1,1,-3,-5,0,-5,-6,-3,1,0,-6,-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.8,6.9,.4],[-2.6,-6.3,-4.9,-4.9,-6.4,-9.4,-7.9,-8.6,-6.3,-7.4,-8.2,-6.6,-9.7,-14.9,-11.1,-13.9,-.2,-8.2,-2.3,-6.8,-8.9,-11.1,-9.4,-10.9,-8.9,-11.7,-10,-9.9,-12.1,-15.2,-14.3,-14.4,11.1,2.9,9.2,3.5,-3,-7,-4.3,-6.2,-2.2,-6.6,-3.7,-5.7,-6,-10.4,-8.6,-9.5,-50,-15.5,-50,-13.9,-7.8,-10.5,-8.7,-9.6,-50,-16.5,-17.1,-14.8,-12.1,-18.9,-12.4,-17.4],[-8.5,.8,-9.1,-.7,-10.1,-7.5,-9.1,-8.2,-11.4,-3.1,-11.8,-4.4,-15.5,-14.3,-14.8,-15.4,-6.6,-4.7,-7.1,-5.8,-12.5,-10.3,-11,-12.2,-13.4,-10.6,-12.5,-11.8,-17.4,-15.1,-17.7,-15.7,2.9,12.5,3.1,10.3,-7.7,-5.2,-6.2,-7.3,-5.4,-1.7,-5.4,-3.7,-11.6,-9.1,-13,-10.8,-50,-10.3,-50,-11.2,-9.8,-8.3,-9.1,-9.7,-50,-12.7,-20.6,-13.1,-16,-16.6,-17,-18.4],[-5,-6.4,-3.4,-5.6,-7.5,-9.3,-7.1,-8.8,-8.8,-7.4,-6.9,-6.9,-11.4,-15.2,-9.7,-13.7,-1.8,-7.8,-.8,-7.2,-9.4,-10.6,-8.7,-11.2,-10,-10.1,-7.8,-10.5,-13.2,-14.6,-13,-14.5,9.2,3.1,10.8,3,-4.5,-6.7,-2.7,-6.7,-5,-6.8,-2.5,-6.7,-7.5,-10.4,-7.4,-10.2,-50,-15.5,-50,-14.2,-8.9,-10.2,-8.5,-10,-50,-15.6,-15.3,-15.5,-13,-18.8,-12.6,-18.3],[-8.1,-1.1,-8.9,1.4,-8.6,-9.2,-9.4,-6.8,-11,-4.9,-11.5,-2.6,-13.7,-16.8,-14.5,-12.6,-6,-6.7,-7.2,-4.2,-11.6,-11.9,-11.2,-10.9,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11.9,-10.6,-11.3,-2.6,-4.1,-1.7,-3.5,-11.4,-9.6,-9.6,-9.2,3.7,2.5,1.6,2.5,-9.6,-12.3,-9.5,-11.8,-8,-9.4,-7.2,-9.3,-13.3,-12.8,-10.9,-12.6,-1.8,-2.9,-.8,-2.9,-8.6,-13,-7.4,-12.4,-.4,-2.3,1.3,-2,-8.1,-9.3,-5.4,-8.4,10,8.6,11.4,8.9,-50,-13.7,-50,-13.2,-6.1,-8.1,-5.5,-7.5,-50,-11.3,-12.7,-10.1,-1.6,-7.8,-.3,-7.2],[-11.4,-10,-12.7,-8.2,-3.1,-3.1,-2.8,-.9,-11.7,-7.3,-12.1,-5.8,3.6,3.6,-1.1,5.8,-9.4,-11.9,-10.7,-10,-8.5,-8.8,-8.2,-6.5,-13.9,-13,-12.9,-10.9,-3.1,-2.3,-3.2,-.2,-9.5,-10.8,-10.2,-8.2,-1.1,-1.3,-.8,1.2,-8.6,-7.8,-7.8,-5,9,9.5,8.9,12,-50,-13,-50,-10.3,-6.2,-7,-7.1,-5.4,-50,-9.3,-14,-8.2,-2.4,-6.3,-2.4,-3.9],[-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,33.3,-50,30.6,-50,-50,-50,-50,-50,29.2,-50,-50,-50,-50,-50,-50,-50],[-14.8,-6.2,-14.9,-7.6,-14.6,-11.6,-13,-12.2,-14,-9,-14.1,-10.1,-13.6,-11.2,-12.4,-12.5,-8.1,2.2,-8.7,.4,-15.3,-11.3,-13.2,-13.3,-11.9,-7.2,-11.8,-7.9,-10.7,-7.4,-10.8,-8.9,-15.5,-10.3,-15.5,-12.5,-14.5,-12.1,-11.9,-12.8,-18.3,-12.7,-16.4,-14.7,-14.2,-10.4,-13.7,-13,-50,15.1,-50,13.3,-9.9,-5.8,-8.9,-7.6,-50,-1.5,-7.8,-3,-8.1,3.6,-9.4,2],[-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,30.6,-50,35.2,-50,-50,-50,-50,-50,28.5,-50,-50,-50,-50,-50,-50,-50],[-13.8,-7.5,-14.4,-5.1,-12.6,-11.6,-11.5,-10.1,-13.2,-9.7,-12.7,-7.4,-11.9,-11.9,-11.5,-10.2,-7.2,.9,-8.6,2.6,-14.1,-12.8,-13.3,-11,-9.7,-8.4,-11.2,-5.3,-9.3,-8.7,-9.9,-7.1,-13.9,-11.2,-14.2,-8.9,-12.9,-12.6,-12.6,-10.9,-15.4,-13.8,-14.8,-11.4,-12.8,-11.6,-13.2,-10.3,-50,13.3,-50,15.2,-8.6,-7,-8.4,-4.8,-50,-3,-7.1,-.1,-7.3,2.3,-8.7,3.9],[-7.3,-6.3,-8.9,-5.5,2.9,.2,1.5,1.2,-8.5,-2.3,-10,-1.7,-5.6,-10.5,-5.5,-9.6,-4.3,-7.9,-6.1,-7.2,2.3,-.6,.5,-0,-8.9,-11,-9.4,-9.3,-4.6,-9.4,-7.3,-8.1,-7.8,-9.8,-8.9,-9.2,2.8,.1,1.2,.8,-5.9,-6.8,-5.9,-6.3,-4.1,-7.2,-6.1,-6.2,-50,-9.9,-50,-8.6,12.5,9.4,11,9.8,-50,-4.8,-8.7,-3.5,-0,-8.6,-2.1,-7],[-10.1,-4.3,-10.8,-5.8,.1,2.3,.7,.6,-10.4,-.2,-10.8,-2,-8.8,-9.2,-8,-9.7,-6.8,-5.9,-7.5,-7,-1.4,2.2,-.9,-.4,-10.8,-7.7,-9.8,-8.8,-8.9,-7.3,-9.6,-9.1,-10.5,-8.3,-10.2,-10,-0,2.5,.7,.5,-7.5,-5.1,-7.1,-6.7,-7.4,-5.7,-8.1,-7,-50,-5.8,-50,-7,9.4,12.7,10.1,10,-50,-1.5,-11.3,-3.3,-5.4,-4.2,-5.6,-6.8],[-8.4,-6.2,-8.9,-5.9,1.8,.4,2.7,1.2,-9.1,-1.2,-8.8,-1.5,-7.2,-10.5,-4.9,-9.6,-5.7,-7.4,-5.5,-7.4,.3,-.3,1.8,-.4,-9,-8.7,-7.3,-8.9,-5.9,-9.4,-6.4,-8.7,-8.7,-9.1,-8.5,-9.4,1.4,.7,3.5,.7,-6.6,-5.3,-4.7,-5.8,-5.7,-7.5,-5.5,-7.1,-50,-8.9,-50,-8.4,11,10.1,13.2,10.2,-50,-4.2,-6.1,-3.6,-3.5,-8.4,-1.2,-6.8],[-9.1,-5.4,-10.4,-4.2,1,.5,.6,2.4,-9.6,-1.5,-10.5,-.5,-8.9,-10.5,-7.2,-8.3,-6.3,-6.9,-7.7,-5.1,-.5,.1,-.6,2.3,-11.1,-10.2,-10.5,-7,-8.3,-9.4,-9.4,-6.6,-9.6,-9.7,-10,-7.9,.7,.6,.8,2.3,-7.1,-6.5,-7.2,-5,-6.5,-7.4,-7.5,-5.4,-50,-7.6,-50,-4.8,9.8,10,10.2,12.1,-50,-3.1,-11.4,-.7,-4.6,-6.6,-4.9,-3.9],[-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,-50,29.2,-50,28.5,-50,-50,-50,-50,-50,33.3,-50,-50,-50,-50,-50,-50,-50],[-13,-7,-13.1,-8.3,-9.2,-6.5,-8.9,-7.6,-9.8,-.7,-9.2,-2.1,-12.4,-10.3,-12.4,-11.6,-9.5,-4.6,-10.4,-5.7,-13.6,-10.1,-11.4,-10.9,-6.5,-1.5,-6.2,-3.6,-12.8,-8,-12.3,-9.7,-16.5,-12.7,-15.6,-14.3,-8.7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-18.1,-12.3,-19.4,-14.2,-12.2,-9.5,-11.5,-10.8,-17.9,-11.9,-18.2,-13.9,-6.4,-3.7,-6.8,-5.4,-12.8,-5.9,-13.6,-7.4,-13.7,-9.9,-12.9,-12.7,-16.2,-11.6,-15.2,-12.7,-3.2,.5,-3.3,-1.8,-18.9,-16.6,-18.8,-19.2,-12.5,-9.4,-10.6,-11.1,-17.3,-14.1,-16.2,-16,-7.9,-3.7,-7.8,-6.3,-50,3.6,-50,2.3,-8.6,-4.2,-8.4,-6.6,-50,-4.3,-8.1,-5.8,-.9,14.2,-1.8,11.6],[-11.8,-13.1,-11.5,-12,-6.2,-8.3,-5.4,-7.4,-11.8,-12.3,-11.1,-11.4,.5,-2.5,2.4,-1.6,-6.8,-9.9,-6.4,-8.9,-6.1,-8.6,-5,-7.8,-10.4,-11.6,-8.5,-9.9,8.2,6.4,8.7,6.9,-12.4,-17,-12.6,-15.8,-6.5,-8.5,-5,-7.8,-13.2,-13.6,-10.3,-13.7,-.7,-3.2,-.3,-2.4,-50,-9.4,-50,-8.7,-2.1,-5.6,-1.2,-4.9,-50,-10,-4.5,-8.9,9.7,-1.8,11.3,-.9],[-17.2,-13.3,-17.8,-11.6,-11,-11.1,-10.4,-9,-16,-12.7,-16.1,-11.1,-5.2,-5.4,-6,-3.3,-11.8,-7.3,-13.3,-5.9,-12.7,-11.9,-11.9,-9.3,-15.2,-15,-14.9,-11,-2.8,-1.8,-2.9,.4,-17.4,-18.4,-18.3,-15.9,-10.7,-11.2,-10.6,-9,-15.4,-14.8,-15.8,-13.3,-6.8,-5.9,-7.2,-3.9,-50,2,-50,3.9,-7,-6.8,-6.8,-3.9,-50,-5.4,-7.3,-3.4,-.3,11.6,-.9,14.1]],this.TRANS=[[5,0,0,4],[0,5,4,0],[0,4,5,0],[4,0,0,5]],this.CONBLO={A:0,R:1,N:2,D:3,C:4,Q:5,E:6,G:7,H:8,I:9,L:10,K:11,M:12,F:13,P:14,S:15,T:16,W:17,Y:18,V:19,B:20,Z:21,X:22,"*":23},this.CONNUCL={A:0,T:1,C:2,G:3},this.CONSCHN={AAA:0,AAC:1,AAG:2,AAT:3,ACA:4,ACC:5,ACG:6,ACT:7,AGA:8,AGC:9,AGG:10,AGT:11,ATA:12,ATC:13,ATG:14,ATT:15,CAA:16,CAC:17,CAG:18,CAT:19,CCA:20,CCC:21,CCG:22,CCT:23,CGA:24,CGC:25,CGG:26,CGT:27,CTA:28,CTC:29,CTG:30,CTT:31,GAA:32,GAC:33,GAG:34,GAT:35,GCA:36,GCC:37,GCG:38,GCT:39,GGA:40,GGC:41,GGG:42,GGT:43,GTA:44,GTC:45,GTG:46,GTT:47,TAA:48,TAC:49,TAG:50,TAT:51,TCA:52,TCC:53,TCG:54,TCT:55,TGA:56,TGC:57,TGG:58,TGT:59,TTA:60,TTC:61,TTG:62,TTT:63},this.setMethod(i),this.setSequences(t,e),this.setGap(n)}}},7983:(t,e,n)=>{"use strict";n.d(e,{HV:()=>d,QF:()=>m,gQ:()=>c,pf:()=>u});var i=n(4469),s=n(3870),r=n(976),o=n(7241),a=n(4293),l=n(1061);const h="substr_helm";function c(t){const e=t.getTag(r.TAGS.UNITS),n=t.getTag("separator"),o=s.textInput("Substructure",""),l=s.link("Edit helm",(async()=>{(0,a.Y)(p,d.root),await s.tools.waitForElementInDom(d.root),setTimeout((()=>{d.cell(h,0).element.children[0].dispatchEvent(new KeyboardEvent("keydown",{key:"Enter"}))}),100)})),c=r.DataFrame.create(1);c.columns.addNewString(h).init((t=>"")),c.col(h).semType=t.semType,c.col(h).setTag(r.TAGS.UNITS,"helm");const d=c.plot.grid(),f=s.textInput("Separator",n),p=s.div(),g="helm"===e?s.divV([l]):"separator"===e?s.inputs([o,f]):s.inputs([o]);(0,a.Y)(p,g),s.dialog("Substructure Search").add(s.divV([s.divText(`Notation: ${e}`),p])).onOK((async()=>{let s="helm"===e?c.get(h,0):o.value;"separator"===e&&f.value!==n&&""!==f.value&&(s=s.replaceAll(f.value,n));const a=`Matches: ${s}`;if(t.dataFrame.columns.names().filter((t=>t.toLocaleLowerCase()===a.toLocaleLowerCase())).length>0)i.shell.warning(`Search ${s} is already performed`);else{let n;n="helm"===e?await m(s,t):u(s,t),t.dataFrame.columns.add(r.Column.fromBitSet(a,n))}})).show()}function u(t,e,n){const i=n?function(t,e){const n=`${e}`.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),i=t.charAt(0)===e,s=t.charAt(t.length-1)===e,r=t.replace(new RegExp(`^${n}|${n}$`,"g"),"");return i?s?`${n}${r}${n}`:`${n}${r}${n}|${n}${r}$`:s?`^${r}${n}|${n}${r}${n}`:`^${r}${n}|${n}${r}${n}|${n}${r}$`}(t,n):t,s=r.BitSet.create(e.length);for(let n=0;n<e.length;n++){const r=e.get(n);(r.match(i)||r===t)&&s.set(n,!0,!1)}return s}async function m(t,e){e.version!==e.temp["last-invalidated-version"]&&await d(e,!0);const n=r.Column.string("helm",1).init((e=>t));n.setTag(r.TAGS.UNITS,"helm");const s=await(0,o.D)(n,!0,e.temp["monomers-dict"]);return(await i.functions.call("Chem:searchSubstructure",{molStringsColumn:e.temp["monomeric-mols"],molString:s.get(0),molBlockFailover:""})).get(0)}async function d(t,e){const n=r.TaskBarProgressIndicator.create(`Invalidating molfiles for ${t.name}`);await(0,l.gw)(10);const i=new Map,s=await(0,o.D)(t,e,i);t.temp["monomeric-mols"]=s,t.temp["monomers-dict"]=i,t.temp["last-invalidated-version"]=t.version,n.close()}},2568:(t,e,n)=>{"use strict";n.d(e,{n:()=>o});var i=n(4469),s=n(976),r=n(499);function o(t,e,n=[],o=[],a=!0){const[l,h]=function(t,e,n=[],o=[]){let a=!0,l="";const h=r.C.getOrCreate(t);if(t.semType!==s.SEMTYPE.MACROMOLECULE)i.shell.warning(e+" analysis is allowed for Macromolecules semantic type"),a=!1;else{const t=h.notation;if(n.length>0&&!n.some((e=>t.toUpperCase()==e.toUpperCase())))l=`${e} + ' analysis is allowed for Macromolecules with notation ${0==n.length?"any notation":`notation${n.length>1?"s":""} ${n.map((t=>`"${t}"`)).join(", ")} `}.`,a=!1;else if(!h.isHelm()){const t=h.alphabet;o.length>0&&!o.some((e=>t.toUpperCase()==e.toUpperCase()))&&(l=`${e} + ' analysis is allowed for Macromolecules with alphabet ${0==o.length?"any alphabet":`alphabet${o.length>1?"s":""} ${o.map((t=>`"${t}"`)).join(", ")}.`}.`,a=!1)}}return[a,l]}(t,e,n,o);return a&&!l&&i.shell.warning(h),l}},3553:(t,e,n)=>{"use strict";n.d(e,{Of:()=>r,WY:()=>h,jB:()=>c,rs:()=>a});var i,s,r,o,a,l=n(8341);!function(t){t.SPLIT_COL="~split",t.ACTIVITY="~activity",t.ACTIVITY_SCALED="activity_scaled",t.ALIGNED_SEQUENCE="~aligned_sequence",t.AMINO_ACID_RESIDUE="AAR",t.POSITION="Pos",t.P_VALUE="pValue",t.MEAN_DIFFERENCE="Mean difference"}(i||(i={})),function(t){t.AAR="AAR",t.POSITION="Pos",t.SELECTION="selection"}(s||(s={})),function(t){t.MONOMER="Monomer",t.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference",t.ACTIVITY="activity",t.ACTIVITY_SCALED="activityScaled"}(r||(r={})),function(t){t.CELL_CHANGING="isCellChanging"}(o||(o={})),function(t){t.SEPARATOR="."}(a||(a={}));const h="3.3.1",c={pepsea:{gapOpen:1.53,gapExtend:0,method:l.J[0]},kalign:{gapOpen:-1,gapExtend:-1,terminalGap:-1}}},4004:(t,e,n)=>{"use strict";n.d(e,{O:()=>u});var i=n(976),s=n(3870),r=n(4469),o=n(3336),a=n.n(o),l=n(7767);let h=null,c=[];function u(t){let e=t??r.shell.t.columns.bySemType("Macromolecule");if(!e)throw new Error("No column with Macromolecule semantic type found");let n=new l.L(e),o=n.notation;const u=s.divText("Current notation: "+o,{style:{"text-align":"center","font-weight":"bold","font-size":"14px",padding:"5px"}}),m=["fasta","separator","helm"],d=s.columnInput("Column",r.shell.t,e,(t=>{t.semType===i.SEMTYPE.MACROMOLECULE?(e=t,n=new l.L(e),o=n.notation,u.textContent="Current notation: "+o,p=m.filter((t=>t!==o)),g=s.choiceInput("Convert to",p[0],p),b(),h?.clear(),h?.add(s.div([u,d.root,g.root,y.root]))):d.value=e})),f=["-",".","/"];let p=m.filter((t=>t!==o)),g=s.choiceInput("Convert to",p[0],p);const y=s.choiceInput("Separator",f[0],f),b=()=>{"separator"!==g.value?a()(y.root).hide():a()(y.root).show()};b(),g.onChanged((()=>{b()})),null==h&&(h=s.dialog("Convert Sequence Notation").add(s.div([u,d.root,g.root,y.root])).onOK((async()=>{const t=g.value,n=y.value;await async function(t,e,n){const i=new l.L(t).convert(e,n);t.dataFrame.columns.add(i);const s=await r.functions.call("Bio:detectMacromolecule",{col:i});return s&&(i.semType=s),await r.data.detectSemanticTypes(t.dataFrame),i}(e,t,n)})).show({x:350,y:100}),c.push(h.onClose.subscribe((t=>{c.forEach((t=>{t.unsubscribe()})),c=[],h=null}))))}},1345:(t,e,n)=>{"use strict";n.d(e,{NT:()=>f,P4:()=>c,QD:()=>m,nW:()=>u});var i=n(976),s=n(4469),r=n(701),o=n(7228),a=n(7753);const l="Libraries",h="System:AppData/Bio/libraries/";async function c(){return await Promise.all((await s.dapi.files.list(h,!0,"")).map((async t=>t.fullPath.substring(h.length))))}async function u(){const t=await s.dapi.userDataStorage.getValue(l,"Settings",!0),e=t?JSON.parse(t):{exclude:[]};return e.exclude=e.exclude instanceof Array?e.exclude:[],e}async function m(t){await s.dapi.userDataStorage.postValue(l,"Settings",JSON.stringify(t),!0)}class d{constructor(t,e){this._monomers={},this._onChanged=new r.Subject,this._monomers=t,this.error=e}getMonomer(t,e){return t in this._monomers&&e in this._monomers[t]?this._monomers[t][e]:null}getPolymerTypes(){return Object.keys(this._monomers)}getMonomerMolsByPolymerType(t){const e={};return Object.keys(this._monomers[t]).forEach((n=>{e[n]=this._monomers[t][n].molfile})),e}getMonomerSymbolsByType(t){return Object.keys(this._monomers[t])}get onChanged(){return this._onChanged}_updateInt(t){const e=t.getPolymerTypes(),n=this.getPolymerTypes();e.forEach((e=>{n.includes(e)||(this._monomers[e]={}),t.getMonomerSymbolsByType(e).forEach((n=>{this._monomers[e][n]=t.getMonomer(e,n)}))}))}update(t){this._updateInt(t),this._onChanged.next()}updateLibs(t,e=!1){e&&(this._monomers={});for(const e of t)e.error||this._updateInt(e);this._onChanged.next()}clear(){this._monomers={},this._onChanged.next()}}class f{constructor(){this._monomerLib=new d({}),this.loadLibrariesPromise=Promise.resolve()}getBioLib(){return this._monomerLib}async loadLibraries(t=!1){return this.loadLibrariesPromise=this.loadLibrariesPromise.then((async()=>{try{const[e,n]=await Promise.all([c(),u()]),i=await Promise.all(e.filter((t=>!n.exclude.includes(t))).map((t=>this.readLibrary(h,t).catch((e=>{const n=`Loading monomers from '${t}' error: ${e instanceof Error?e.message:e.toString()}`;return new d({},n)})))));this._monomerLib.updateLibs(i,t)}catch(t){const e=`Loading monomer libraries error: ${t instanceof Error?t.message:t.toString()}`;s.shell.warning(e);const n=t instanceof Error?t.stack:void 0;a._package.logger.error(e,void 0,n)}}))}async readLibrary(t,e){let n,r,a=[];const l=new i.FileSource(t);if(e.endsWith(".sdf"))1===i.Func.find({package:"Chem",name:"importSdf"}).length?(n=await l.readAsBytes(e),r=await s.functions.call("Chem:importSdf",{bytes:n}),a=(0,o.Xk)(r[0])):s.shell.warning("Chem package is not installed");else{const t=await l.readAsText(e);a=JSON.parse(t)}const h={},c=[];return a.forEach((t=>{c.includes(t.polymerType)||(h[t.polymerType]={},c.push(t.polymerType)),h[t.polymerType][t.symbol]=t})),new d(h)}static get instance(){return f._instance||(f._instance=new f),f._instance}}f._instance=null},525:(t,e,n)=>{"use strict";n.d(e,{K:()=>N});var i=n(4469),s=n(976),r=n(3870),o=n(6098),a=n(8341),l=n(2568),h=n(7767),c=n(7753),u=n(3553),m=n(3379),d=n.n(m),f=n(7795),p=n.n(f),g=n(569),y=n.n(g),b=n(3565),w=n.n(b),v=n(9216),C=n.n(v),S=n(4589),M=n.n(S),T=n(9564),x={};x.styleTagTransform=M(),x.setAttributes=w(),x.insert=y().bind(null,"head"),x.domAPI=p(),x.insertStyleElement=C(),d()(T.Z,x),T.Z&&T.Z.locals&&T.Z.locals;class E extends Error{constructor(t,e){super(t,e)}}async function N(t={}){return new Promise((async(e,n)=>{var o,l,h;t.clustersCol??(t.clustersCol=null),t.pepsea??(t.pepsea={}),(o=t.pepsea).method??(o.method=u.jB.pepsea.method),(l=t.pepsea).gapOpen??(l.gapOpen=u.jB.pepsea.gapOpen),(h=t.pepsea).gapExtend??(h.gapExtend=u.jB.pepsea.gapExtend);const c=t.col?.dataFrame??i.shell.t,m=t.col??c.columns.bySemType(s.SEMTYPE.MACROMOLECULE);if(null==m){const t="MSAError: dataset doesn't conain any Macromolecule column";i.shell.warning(t),n(new E(t))}const d=r.choiceInput("Method",t.pepsea.method,a.J);d.setTooltip("Alignment method");const f=r.floatInput("Terminal gap",t?.kalign?.terminalGap??u.jB.kalign.terminalGap);f.setTooltip("Penalty for opening a gap at the beginning or end of the sequence");const p=r.p(`Kalign version: ${u.WY}`,"kalign-version"),g=r.floatInput("Gap open",t.pepsea.gapOpen);g.setTooltip("Gap opening penalty at group-to-group alignment");const y=r.floatInput("Gap extend",t.pepsea.gapExtend);y.setTooltip("Gap extension penalty to skip the alignment");const b=[d.root.style],w=[f.root.style,p.style];let v;const C=r.columnInput("Sequence",c,m,(async()=>{v=await I(C.value,c,b,w,d,S,g,y,f)}),{filter:t=>t.semType===s.SEMTYPE.MACROMOLECULE});C.setTooltip("Sequences column to use for alignment");const S=r.columnInput("Clusters",c,t.clustersCol);if(S.nullable=!0,C.fireChanged(),t.col)return v=await I(t.col,c,b,w,d,S,g,y,f),void await A(C,c,v,e,n);r.dialog("MSA").add(C).add(S).add(d).add(g).add(y).add(f).add(p).onOK((async()=>{await A(C,c,v,e,n)})).show()}))}async function A(t,e,n,r,o){let a=null;const l=s.TaskBarProgressIndicator.create("Analyze for MSA ...");try{if(t.fireChanged(),t.value.semType!==s.SEMTYPE.MACROMOLECULE)throw new Error("Chosen column has to be of Macromolecule semantic type");if(void 0===n)throw new Error("Invalid column format");if(a=await n(),null==a)return o("PepSeA container has not started");e.columns.add(a),await i.data.detectSemanticTypes(e),r(a)}catch(t){const e=t instanceof Error?t.message:t.toString();i.shell.error(e),o(t)}finally{l.close()}}async function I(t,e,n,r,m,d,f,p,g){try{if(t.semType!==s.SEMTYPE.MACROMOLECULE)return;const i=e.columns.getUnusedName(`msa(${t.name})`);if((0,l.n)(t,t.name,["fasta","separator"],["DNA","RNA","PT"],!1)){L(n,r,"kalign"),f.value??(f.value=u.jB.kalign.gapOpen),p.value??(p.value=u.jB.kalign.gapExtend),g.value??(g.value=u.jB.kalign.terminalGap);const e=new h.L(t),s=e.isFasta()?t:e.convert("fasta");return async()=>await(0,o.U)(s,!1,i,d.value)}if((0,l.n)(t,t.name,["helm"],[],!1))return L(n,r,"pepsea"),f.value??(f.value=u.jB.pepsea.gapOpen),p.value??(p.value=u.jB.pepsea.gapExtend),async()=>await(0,a.f)(t,i,m.value,f.value,p.value,d.value);if((0,l.n)(t,t.name,["separator"],["UN"],!1)){const e=new h.L(t);if(!await e.checkHelmCompatibility())return;const s=e.convert("helm");return L(n,r,"pepsea"),f.value??(f.value=u.jB.pepsea.gapOpen),p.value??(p.value=u.jB.pepsea.gapExtend),async()=>await(0,a.f)(s,i,m.value,f.value,p.value,d.value)}return void L(n,r,"kalign")}catch(t){const e=t instanceof Error?t.message:t.toString();i.shell.error(e),c._package.logger.error(e)}}function L(t,e,n){if("kalign"===n){for(const e of t)e.display="none";for(const t of e)t.removeProperty("display")}else{for(const t of e)t.display="none";for(const e of t)e.removeProperty("display")}}},6098:(t,e,n)=>{"use strict";n.d(e,{U:()=>O});var i=n(976),s=n(5226);const r=Symbol("Comlink.proxy"),o=Symbol("Comlink.endpoint"),a=Symbol("Comlink.releaseProxy"),l=Symbol("Comlink.thrown"),h=t=>"object"==typeof t&&null!==t||"function"==typeof t,c=new Map([["proxy",{canHandle:t=>h(t)&&t[r],serialize(t){const{port1:e,port2:n}=new MessageChannel;return u(t,e),[n,[n]]},deserialize:t=>(t.start(),d(t))}],["throw",{canHandle:t=>h(t)&&l in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}}]]);function u(t,e=self){e.addEventListener("message",(function n(i){if(!i||!i.data)return;const{id:s,type:o,path:a}=Object.assign({path:[]},i.data),h=(i.data.argumentList||[]).map(v);let c;try{const e=a.slice(0,-1).reduce(((t,e)=>t[e]),t),n=a.reduce(((t,e)=>t[e]),t);switch(o){case"GET":c=n;break;case"SET":e[a.slice(-1)[0]]=v(i.data.value),c=!0;break;case"APPLY":c=n.apply(e,h);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[r]:!0})}(new n(...h));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;u(t,n),c=function(t,e){return b.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(t){c={value:t,[l]:0}}Promise.resolve(c).catch((t=>({value:t,[l]:0}))).then((t=>{const[i,r]=w(t);e.postMessage(Object.assign(Object.assign({},i),{id:s}),r),"RELEASE"===o&&(e.removeEventListener("message",n),m(e))}))})),e.start&&e.start()}function m(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function d(t,e){return p(t,[],e)}function f(t){if(t)throw new Error("Proxy has been released and is not useable")}function p(t,e=[],n=function(){}){let i=!1;const s=new Proxy(n,{get(n,r){if(f(i),r===a)return()=>C(t,{type:"RELEASE",path:e.map((t=>t.toString()))}).then((()=>{m(t),i=!0}));if("then"===r){if(0===e.length)return{then:()=>s};const n=C(t,{type:"GET",path:e.map((t=>t.toString()))}).then(v);return n.then.bind(n)}return p(t,[...e,r])},set(n,s,r){f(i);const[o,a]=w(r);return C(t,{type:"SET",path:[...e,s].map((t=>t.toString())),value:o},a).then(v)},apply(n,s,r){f(i);const a=e[e.length-1];if(a===o)return C(t,{type:"ENDPOINT"}).then(v);if("bind"===a)return p(t,e.slice(0,-1));const[l,h]=y(r);return C(t,{type:"APPLY",path:e.map((t=>t.toString())),argumentList:l},h).then(v)},construct(n,s){f(i);const[r,o]=y(s);return C(t,{type:"CONSTRUCT",path:e.map((t=>t.toString())),argumentList:r},o).then(v)}});return s}function g(t){return Array.prototype.concat.apply([],t)}function y(t){const e=t.map(w);return[e.map((t=>t[0])),g(e.map((t=>t[1])))]}const b=new WeakMap;function w(t){for(const[e,n]of c)if(n.canHandle(t)){const[i,s]=n.serialize(t);return[{type:"HANDLER",name:e,value:i},s]}return[{type:"RAW",value:t},b.get(t)||[]]}function v(t){switch(t.type){case"HANDLER":return c.get(t.name).deserialize(t.value);case"RAW":return t.value}}function C(t,e,n){return new Promise((i=>{const s=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");t.addEventListener("message",(function e(n){!n.data||!n.data.id||n.data.id!==s||(t.removeEventListener("message",e),i(n.data))})),t.start&&t.start(),t.postMessage(Object.assign({id:s},e),n)}))}const S="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0ICQ9U3ltYm9sKCJDb21saW5rLnByb3h5IiksQT1TeW1ib2woIkNvbWxpbmsuZW5kcG9pbnQiKSxSPVN5bWJvbCgiQ29tbGluay5yZWxlYXNlUHJveHkiKSx5PVN5bWJvbCgiQ29tbGluay50aHJvd24iKSxfPWU9PnR5cGVvZiBlPT0ib2JqZWN0IiYmZSE9PW51bGx8fHR5cGVvZiBlPT0iZnVuY3Rpb24iLEw9e2NhbkhhbmRsZTplPT5fKGUpJiZlWyRdLHNlcmlhbGl6ZShlKXtjb25zdHtwb3J0MTpyLHBvcnQyOml9PW5ldyBNZXNzYWdlQ2hhbm5lbDtyZXR1cm4gdyhlLHIpLFtpLFtpXV19LG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<"u"&&window.Blob&&new Blob([atob(S)],{type:"text/javascript;charset=utf-8"});function T(){const t=M&&(window.URL||window.webkitURL).createObjectURL(M);try{return t?new Worker(t):new Worker("data:application/javascript;base64,"+S)}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}const x={urlCDN:"https://biowasm.com/cdn/v3",urlCDNStg:"https://stg.biowasm.com/cdn/v3",dirShared:"/shared",dirMounted:"/mnt",dirData:"/data",printInterleaved:!0,callback:null,debug:!1,env:"prd"};class E{constructor(t,e={}){if(null==t)throw"Expecting array of tools as input to Aioli constructor.";return Array.isArray(t)||(t=[t]),e=Object.assign({},x,e),t=t.map(this._parseTool),"stg"===e.env&&(e.urlCDN=e.urlCDNStg),this.tools=t,this.config=e,null!=this.config.callback&&(this.callback=this.config.callback),delete this.config.callback,this.init()}async init(){const t=new T;this.callback&&(t.onmessage=t=>{"biowasm"===t.data.type&&this.callback(t.data.value)});const e=d(t);return e.tools=this.tools,e.config=this.config,await e.init(),e}_parseTool(t){if("string"!=typeof t)return t;const e=t.split("/");if(2!=e.length&&3!=e.length)throw"Expecting '<tool>/<version>' or '<tool>/<program>/<version>'";return{tool:e[0],program:3==e.length?e[1]:e[0],version:e[e.length-1]}}}var N=n(7997);class A{static getAvailableScales(){return Object.entries(this.scales).map((([t,e])=>t))}static getScale(t){return(0,N.hu)(!(void 0===this.scales[t]),`Scale '${t}' was not found.`),this.scales[t]}}A.scales={WimleyWhite:{"-":0,A:.17,C:-.24,D:-.07,E:-.01,F:-1.13,G:.01,H:.17,I:-.31,K:.99,L:-.56,M:-.23,N:.42,P:.45,Q:.58,R:.81,S:.13,T:.14,V:.07,W:-1.85,Y:-.94},categorial:{"-":0,A:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,K:9,L:10,M:11,N:12,P:13,Q:14,R:15,S:16,T:17,V:18,W:19,Y:20}};class I{constructor(t="categorial"){this.aa2num=A.getScale(t),this.num2aa={},Object.entries(this.aa2num).forEach((([t,e])=>this.num2aa[e]=t))}static _truncateSequence(t){let e=0,n=t.length;const i=["NH2","COOH"];if(t.startsWith(i[0])){const n=i[0].length;(0,N.hu)("-"==t[n],`Wrong sequence format: ${i[0]} without following '-' in '${t}'.`),e=n}if(t.endsWith(i[1])){const e=i[1].length+1;(0,N.hu)("-"==t[n-e],`Wrong sequence format: ${i[1]} without '-' precending in '${t}'.`),n-=e}return t.substring(e,n)}static _dropDefises(t){return t.replace(/(-)([^-]+)/g,"$2")}static clean(t){return I._dropDefises(I._truncateSequence(t))}encode(t){const e=t.length,n=new Array(e).fill(0);for(let i=0;i<e;++i){const e=t[i];(0,N.hu)(e in this.aa2num,`Unknown char '${e}' found in sequence '${t}'`),n[i]=this.encodeLettter(e)}return n}encodeLettter(t){return this.aa2num[t]}decode(t){let e="";for(let n=0;n<t.length;++n){const i=t[n];(0,N.hu)(i in this.num2aa,`Unknown code '${i}' found in vector '${t}'`),e+=this.num2aa[i]}return e}}var L=n(3553);const k="input.fa",_="result.fasta";function R(t){return t.reduce(((t,e,n)=>t+`>sample${n+1}\n${e}\n`),"")}async function O(t,e=!1,n="",r=null,o,a,l){let h=t.toList();e&&(h=h.map((t=>I.clean(t).replace(/\-/g,""))));const c=t.length;r??(r=i.Column.string("Clusters",c).init("0")),r.type!=i.COLUMN_TYPE.STRING&&(r=r.convertTo(i.TYPE.STRING)),r.compact();const u=r.categories,m=r.getRawData(),d=new Array(u.length),f=new Array(u.length);for(let t=0;t<c;++t){const e=m[t];(d[e]??(d[e]=[])).push(h[t]),(f[e]??(f[e]=[])).push(t)}const p=await new E(["base/1.0.0",{tool:"kalign",version:L.WY,reinit:!0}]),g=i.Column.string(n,c);for(let t=0;t<u.length;++t){const e=R(d[t]);await p.fs.writeFile(k,e);const n=`${void 0!==o?` --gpo ${o}`:""}${void 0!==a?` --gpe ${a}`:""}${void 0!==l?` --tgpe ${l}`:""}`,i=await p.exec(`kalign ${k} -f fasta -o ${_}${n}`);console.warn(i);const r=await p.cat(_);if(!r)throw new Error("kalign output no result");const h=new s.i(r).sequencesArray,c=f[t];for(let t=0;t<h.length;++t)g.set(c[t],h[t])}const y=t.getTag(i.TAGS.UNITS),b=t.getTag("alphabet");return g.setTag(i.TAGS.UNITS,y),g.setTag("aligned","SEQ.MSA"),g.setTag("alphabet",b),g.semType=i.SEMTYPE.MACROMOLECULE,g}},8341:(t,e,n)=>{"use strict";n.d(e,{J:()=>o,f:()=>l});var i=n(4469),s=n(976),r=n(3553);const o=["mafft --auto","mafft","linsi","ginsi","einsi","fftns","fftnsi","nwns","nwnsi"],a=["AlignedSeq","AlignedSubpeptide","HELM","ID","PolymerID"];async function l(t,e,n="ginsi",o=1.53,l=0,c=null){const u=await i.dapi.docker.dockerContainers.filter("bio").first();if("started"!==u.status&&"checking"!==u.status)return i.log.warning("PepSeA container has not started yet"),null;const m=t.length;c??(c=s.Column.int("Clusters",m).init(0)),c.type!=s.COLUMN_TYPE.STRING&&(c=c.convertTo(s.TYPE.STRING));const d=c.categories,f=new Array(d.length);for(let e=0;e<m;++e){const n=c.get(e);if(""===n)continue;const i=d.indexOf(n),s=t.get(e);s&&(f[i]??(f[i]=[])).push({ID:e.toString(),HELM:s})}const p=new Array(m);for(const t of f){const e=(await h(u.id,t,n,o,l)).Alignment;for(const t of e)p[parseInt(t.ID)]=Object.entries(t).filter((t=>!a.includes(t[0]))).map((t=>"-"!==t[1]?t[1]:"")).join(r.rs.SEPARATOR)}const g=s.Column.fromStrings(e,p);return g.setTag(s.TAGS.UNITS,"separator"),g.setTag("separator",r.rs.SEPARATOR),g.setTag("aligned","SEQ.MSA"),g.setTag("alphabet","UN"),g.setTag(".alphabetIsMultichar","true"),g.semType=s.SEMTYPE.MACROMOLECULE,g}async function h(t,e,n,s,r){const o={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)},a=`/align?method=${n}&gap_open=${s}&gap_extend=${r}`,l=await i.dapi.docker.dockerContainers.request(t,a,o);return JSON.parse(l??"{}")}},9943:(t,e,n)=>{"use strict";n.d(e,{C2:()=>u});var i=n(976),s=n(3870),r=n(4469),o=n(6414),a=n.n(o),l=n(8447),h=n(499);const c=60;function u(){const t=r.shell.tv.grid,e=a().count(0).take(t.columns.length).map((e=>t.columns.byIndex(e))).filter((t=>!!t.column&&t.column.semType!==i.SEMTYPE.MACROMOLECULE)).toArray(),n=e.find((t=>-1!==t.name.toLowerCase().indexOf("id"))),o=n?[n.name]:[],u=s.multiChoiceInput("Seq id columns",o,e.map((t=>t.name))),d=a().count(0).take(t.columns.length).map((e=>t.columns.byIndex(e))).filter((t=>{const e=t.column;return!(!e||e.semType!==i.SEMTYPE.MACROMOLECULE)&&h.C.getOrCreate(e).isFasta()})).toArray(),f=d.length>0?d[0].name:[],p=s.choiceInput("Seq column",f,d.map((t=>t.name))),g=s.intInput("FASTA line width",c);s.dialog({title:"Save as FASTA"}).add(s.inputs([u,p,g])).onOK((()=>{const e=u.value?u.value.map((e=>t.columns.byName(e).column)):[],n=p.value?t.columns.byName(p.value).column:null,i=g.value??c;n||r.shell.warning("Seq column is mandatory to save as FASTA.");const s=function(t,e,n=c,i="\n"){const s=l.kB,r=[];for(let o=0;o<e.length;o++){const a=t.map((t=>t.get(o).toString())).join("|"),l=m(e.get(o),s,n);r.push(`>${a}${i}`);for(const t of l)r.push(`${t}${i}`)}return"".concat(...r)}(e,n,i),o=document.createElement("a");o.setAttribute("href",`data:text/plain;charset=utf-8,${encodeURIComponent(s)}`),o.setAttribute("download",`${t.dataFrame.name}.fasta`),o.click()})).show()}function m(t,e,n=c){const i=e(t);let s=0;const r=i.length,o=[];for(;s<r;){const t=i.slice(s,s+n),e=t.map((t=>t.length>1?`[${t}]`:t)).join("");o.push(e),s+=t.length}return o}},4293:(t,e,n)=>{"use strict";n.d(e,{Y:()=>o,m:()=>r});var i=n(4469),s=n(976);function r(){const t=i.shell.t.columns.bySemType(s.SEMTYPE.MACROMOLECULE);if(null!==t)return t;i.shell.error("Current table does not contain macromolecules")}function o(t,e){t.innerHTML="",t.append(e)}},2121:(t,e,n)=>{"use strict";n.d(e,{bo:()=>f,OZ:()=>w});var i=n(4469),s=n(3870),r=n(976),o=n(6414),a=n.n(o),l=n(701),h=n(499),c=n(8447),u=n(9298);function m(t){var e;return"string"==typeof t||t instanceof String?t:("object"==typeof t||t instanceof Object)&&"$thrownJsError"in t?m(t.$thrownJsError):t instanceof Error?null!==(e=t.stack)&&void 0!==e?e:t.message:t.toString()}var d,f,p=n(7753);HTMLCanvasElement.prototype.getCursorPosition=function(t,e){const n=this.getBoundingClientRect();return new r.Point((t.clientX-n.left)*e,(t.clientY-n.top)*e)},r.Rect.prototype.contains=function(t,e){return this.left<=t&&t<=this.right&&this.top<=e&&e<=this.bottom};class g{constructor(t=0,e=new r.Rect(0,0,0,0)){this.count=t,this.bounds=e}}class y{constructor(t,e,n={},i=0,s=0){this.pos=t,this.name=e,this.freq=n,this.rowCount=i,this.sumForHeightCalc=s}}!function(t){t.STYLE="Style",t.BEHAVIOR="Behavior",t.LAYOUT="Layout",t.DATA="Data"}(d||(d={})),function(t){t.sequenceColumnName="sequenceColumnName",t.startPositionName="startPositionName",t.endPositionName="endPositionName",t.skipEmptySequences="skipEmptySequences",t.skipEmptyPositions="skipEmptyPositions",t.shrinkEmptyTail="shrinkEmptyTail",t.backgroundColor="backgroundColor",t.positionHeight="positionHeight",t.positionWidth="positionWidth",t.verticalAlignment="verticalAlignment",t.horizontalAlignment="horizontalAlignment",t.fixWidth="fixWidth",t.fitArea="fitArea",t.minHeight="minHeight",t.maxHeight="maxHeight",t.positionMarginState="positionMarginState",t.positionMargin="positionMargin",t.filterSource="filterSource"}(f||(f={}));const b=u.vS;class w extends r.JsViewer{get filter(){let t;switch(this.filterSource){case u.Ct.Filtered:t=this.dataFrame.filter;break;case u.Ct.Selected:t=this.dataFrame.selection}return t}get Length(){return this.skipEmptyPositions?this.positions.length:this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0}get positionWidthWithMargin(){return this._positionWidth+this.positionMarginValue}get positionMarginValue(){return"auto"===this.positionMarginState&&!0===this.unitsHandler?.getAlphabetIsMultichar()||"enable"===this.positionMarginState?this.positionMargin:0}get countOfRenderPositions(){if(null==this.host)return 0;const t=window.devicePixelRatio;return t>1?this.canvasWidthWithRatio/this.positionWidthWithMargin:this.canvas.width/(this.positionWidthWithMargin*t)}get canvasWidthWithRatio(){return this.canvas.width*window.devicePixelRatio}get firstVisibleIndex(){return this.visibleSlider?Math.floor(this.slider.min):0}constructor(){super(),this.viewed=!1,this.viewerId=-1,this.initialized=!1,this.cp=null,this.axisHeight=12,this.seqCol=null,this.positions=[],this.rowsMasked=0,this.rowsNull=0,this.visibleSlider=!1,this.allowResize=!0,this.turnOfResizeForOneSetValue=!1,this.backgroundColor=4294967295,this.positionMargin=0,this.positionNames=[],this.startPosition=-1,this.endPosition=-1,this.viewSubs=[],this.viewerId=w.viewerCount,w.viewerCount+=1,this.textBaseline="top",this.unitsHandler=null,this.sequenceColumnName=this.string(f.sequenceColumnName,b.sequenceColumnName,{category:d.DATA}),this.startPositionName=this.string(f.startPositionName,b.startPositionName,{category:d.DATA}),this.endPositionName=this.string(f.endPositionName,b.endPositionName,{category:d.DATA}),this.skipEmptySequences=this.bool(f.skipEmptySequences,b.skipEmptySequences,{category:d.DATA}),this.skipEmptyPositions=this.bool(f.skipEmptyPositions,b.skipEmptyPositions,{category:d.DATA}),this.shrinkEmptyTail=this.bool(f.shrinkEmptyTail,b.shrinkEmptyTail,{category:d.DATA}),this.backgroundColor=this.int(f.backgroundColor,b.backgroundColor,{category:d.STYLE}),this.positionHeight=this.string(f.positionHeight,b.positionHeight,{category:d.STYLE,choices:Object.values(u.ES)}),this._positionWidth=this.positionWidth=this.float(f.positionWidth,b.positionWidth,{category:d.STYLE}),this.verticalAlignment=this.string(f.verticalAlignment,b.verticalAlignment,{category:d.LAYOUT,choices:Object.values(u.vw)}),this.horizontalAlignment=this.string(f.horizontalAlignment,b.horizontalAlignment,{category:d.LAYOUT,choices:Object.values(u.iD)}),this.fixWidth=this.bool(f.fixWidth,b.fixWidth,{category:d.LAYOUT}),this.fitArea=this.bool(f.fitArea,b.fitArea,{category:d.LAYOUT}),this.minHeight=this.float(f.minHeight,b.minHeight,{category:d.LAYOUT}),this.maxHeight=this.float(f.maxHeight,b.maxHeight,{category:d.LAYOUT}),this.positionMarginState=this.string(f.positionMarginState,b.positionMarginState,{category:d.LAYOUT,choices:Object.values(u.dE)});let t=0;"auto"===this.positionMarginState&&(t=4),this.positionMargin=this.int(f.positionMargin,t,{category:d.LAYOUT,min:0,max:16}),this.filterSource=this.string(f.filterSource,b.filterSource,{category:d.BEHAVIOR,choices:Object.values(u.Ct)}),this.slider=s.rangeSlider(0,100,0,20,!1,{style:"barbell"}),this.canvas=s.canvas(),this.canvas.style.width="100%"}init(){this.initialized?p._package.logger.error("Bio: WebLogoViewer.init() second initialization!"):(this.initialized=!0,this.helpUrl="/help/visualize/viewers/web-logo.md",this.msgHost=s.div("No message"),this.msgHost.style.display="none",this.canvas=s.canvas(),this.canvas.style.width="100%",this.slider.root.style.position="absolute",this.slider.root.style.zIndex="999",this.slider.root.style.display="none",this.slider.root.style.height="0.7em",this.visibleSlider=!1,this.subs.push(this.slider.onValuesChanged.subscribe(this.sliderOnValuesChanged.bind(this))),this.host=s.div([this.msgHost,this.canvas]),this.host.style.justifyContent="center",this.host.style.alignItems="center",this.host.style.position="relative",this.host.style.setProperty("overflow","hidden","important"),this.subs.push(l.fromEvent(this.canvas,"mousemove").subscribe(this.canvasOnMouseMove.bind(this))),this.subs.push(l.fromEvent(this.canvas,"mousedown").subscribe(this.canvasOnMouseDown.bind(this))),this.subs.push(l.fromEvent(this.canvas,"wheel").subscribe(this.canvasOnWheel.bind(this))),this.subs.push(s.onSizeChanged(this.root).subscribe(this.rootOnSizeChanged.bind(this))),this.root.append(this.host),this.root.append(this.slider.root),this._calculate(window.devicePixelRatio),this.updateSlider(),this.render(!0))}setData(){this.viewed&&(this.destroyView(),this.viewed=!1),this.updateSeqCol(),this.viewed||(this.buildView(),this.viewed=!0)}destroyView(){const t=this.dataFrame?"data":"null";p._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.onTableAttached( dataFrame = ${t} ) start`),super.detach(),this.viewSubs.forEach((t=>t.unsubscribe())),this.host.remove(),this.msgHost=void 0,this.host=void 0,this.initialized=!1,p._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.destroyView() end`)}buildView(){super.onTableAttached();const t=this.dataFrame?"data":"null";p._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.onTableAttached( dataFrame = ${t} ) start`),void 0!==this.dataFrame&&(this.viewSubs.push(this.dataFrame.filter.onChanged.subscribe(this.dataFrameFilterOnChanged.bind(this))),this.viewSubs.push(this.dataFrame.selection.onChanged.subscribe(this.dataFrameSelectionOnChanged.bind(this)))),this.init(),p._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.onTableAttached() end`)}rootOnSizeChanged(){this._calculate(window.devicePixelRatio),this.updateSlider(),this.render(!0)}updateSeqCol(){if(this.dataFrame&&(this.seqCol=this.sequenceColumnName?this.dataFrame.col(this.sequenceColumnName):null,null==this.seqCol&&(this.seqCol=(0,c.up)(this.dataFrame),this.sequenceColumnName=this.seqCol?this.seqCol.name:null),this.seqCol)){try{this.seqCol.getTag(r.TAGS.UNITS),this.seqCol.getTag("separator"),this.unitsHandler=h.C.getOrCreate(this.seqCol),this.updatePositions(),this.cp=(0,c.dQ)(this.seqCol)}catch(t){this.seqCol=null,this.msgHost.innerText=`${t}`,this.msgHost.style.setProperty("display",null)}this.seqCol||(this.unitsHandler=null,this.positionNames=[],this.startPosition=-1,this.endPosition=-1,this.cp=null)}this.render()}updatePositions(){if(!this.seqCol)return;let t;if(this.shrinkEmptyTail){const e=this.dataFrame.filter.getSelectedIndexes();t=Array.from(new Set(Array.from(Array(e.length).keys()).map((t=>this.seqCol.get(e[t])))))}else t=this.seqCol.categories;const e=t.length>0?Math.max(...this.unitsHandler.splitted.map((t=>t.length))):0,n=this.seqCol.getTag(u.DX.positionNames);this.positionNames=n?n.split(u.CI).map((t=>t.trim())):[...Array(e).keys()].map((t=>`${t+1}`)),this.startPosition=this.startPositionName&&this.positionNames&&this.positionNames.includes(this.startPositionName)?this.positionNames.indexOf(this.startPositionName):0,this.endPosition=this.endPositionName&&this.positionNames&&this.positionNames.includes(this.endPositionName)?this.positionNames.indexOf(this.endPositionName):e-1}get widthArea(){return this.Length*this.positionWidth/window.devicePixelRatio}get heightArea(){return Math.min(this.maxHeight,Math.max(this.minHeight,this.root.clientHeight))}get xScale(){return this.widthArea>0?(this.root.clientWidth-this.Length*this.positionMarginValue)/this.widthArea:0}get yScale(){return this.root.clientHeight/this.heightArea}checkIsHideSlider(){let t=!0;const e=Math.min(this.xScale,this.yScale);return(e==this.xScale||e<=1)&&this.fitArea&&(t=!1),this.fixWidth||Math.ceil(this.canvas.width/this.positionWidthWithMargin)>=this.Length||t}setSliderVisibility(t){t?(this.slider.root.style.display="inherit",this.visibleSlider=!0):(this.slider.root.style.display="none",this.visibleSlider=!1)}updateSlider(){if(this.checkIsHideSlider()?this.setSliderVisibility(!1):this.setSliderVisibility(!0),null!=this.slider&&null!=this.canvas){const t=Math.max(0,Math.floor(this.slider.min+this.canvas.width/this.positionWidthWithMargin)-this.Length);let e=Math.floor(this.slider.min-t),n=Math.floor(this.slider.min-t)+Math.floor(this.canvas.width/this.positionWidthWithMargin);this.checkIsHideSlider()&&(e=0,n=Math.max(e,this.Length-1)),this.turnOfResizeForOneSetValue=!0,this.slider.setValues(0,this.Length,e,n)}}onPropertyChanged(t){switch(super.onPropertyChanged(t),t.name){case f.sequenceColumnName:case f.startPositionName:case f.endPositionName:case f.filterSource:this.updateSeqCol();break;case f.positionWidth:this._positionWidth=this.positionWidth,this.updateSlider();break;case f.fixWidth:case f.fitArea:case f.positionMargin:this.updateSlider();break;case f.shrinkEmptyTail:case f.skipEmptyPositions:this.updatePositions()}this.render(!0)}onTableAttached(){p._package.logger.debug("Bio: WebLogoViewer.onTableAttached(), "),super.onTableAttached(),this.setData()}async detach(){this.viewed&&(this.destroyView(),this.viewed=!1)}getMonomer(t){const e=t.x+this.firstVisibleIndex*this.positionWidthWithMargin,n=Math.floor(t.x/this.positionWidthWithMargin+this.firstVisibleIndex),i=this.positions[n];if(null==i)return[n,null,null];const s=Object.keys(i.freq).find((n=>i.freq[n].bounds.contains(e,t.y)));return void 0===s?[n,null,null]:[n,s,i.freq[s]]}_nullSequence(t="X"){return this.skipEmptySequences?"":new Array(this.Length).fill(t).join("")}removeWhere(t,e){const n=t.length;let i=0;for(let s=0;s<n;s++)e(t[s])||(t[i]=t[s],i++);return t.length=i,t}_removeEmptyPositions(){this.skipEmptyPositions&&this.removeWhere(this.positions,(t=>t?.freq["-"]?.count===t.rowCount))}_calculate(t){if(!this.host||!this.seqCol||!this.dataFrame)return;this.unitsHandler=h.C.getOrCreate(this.seqCol),this.calcSize();const e=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.positions=new Array(e);for(let t=0;t<this.Length;t++){const e=this.positionNames[this.startPosition+t];this.positions[t]=new y(this.startPosition+t,e)}const n=this.filter.getSelectedIndexes();this.rowsMasked=n.length;for(const t of n){const e=this.unitsHandler.splitted[t];for(let t=0;t<this.Length;t++){const n=this.positions[t].freq,i=e[this.startPosition+t]||"-";i in n||(n[i]=new g),n[i].count++}}for(let t=0;t<this.Length;t++){this.positions[t].rowCount=0;for(const e in this.positions[t].freq)this.positions[t].rowCount+=this.positions[t].freq[e].count;if(this.positionHeight==u.ES.Entropy){this.positions[t].sumForHeightCalc=0;for(const e in this.positions[t].freq){const n=this.positions[t].freq[e].count/this.positions[t].rowCount;this.positions[t].sumForHeightCalc+=-n*Math.log2(n)}}}this._removeEmptyPositions();const s=this.canvas.height-this.axisHeight*t;for(let e=0;e<this.Length;e++){const n=this.positions[e].freq,o=this.positions[e].rowCount,a=this.getAlphabetSize();this.positionHeight==u.ES.Entropy&&null==a&&i.shell.error("WebLogo: alphabet is undefined.");const l=Math.log2(a),h=this.positionHeight==u.ES.Entropy?s*(l-this.positions[e].sumForHeightCalc)/l:s;let c=this.axisHeight*t+(s-h-1);const m=Object.entries(n).sort(((t,e)=>"-"!==t[0]&&"-"!==e[0]?e[1].count-t[1].count:"-"===t[0]&&"-"===e[0]?0:"-"===t[0]?-1:1));for(const t of m){const n=t[1],i=h*n.count/o;n.bounds=new r.Rect(e*this.positionWidthWithMargin,c,this._positionWidth,i),c+=i}}}render(t=!0){if(this.msgHost&&(this.seqCol&&!this.cp?(this.msgHost.innerText=`Unknown palette (column semType: '${this.seqCol.semType}').`,this.msgHost.style.display=""):this.msgHost.style.display="none"),!this.seqCol||!this.dataFrame||!this.cp||-1===this.startPosition||-1===this.endPosition||null==this.host||null==this.slider)return;const e=this.canvas.getContext("2d");if(!e)return;this.slider.root.style.width=`${this.host.clientWidth}px`;const n=window.devicePixelRatio;t&&this._calculate(n),e.resetTransform(),e.fillStyle=r.Color.toHtml(this.backgroundColor),e.fillRect(0,0,this.canvas.width,this.canvas.height),e.textBaseline=this.textBaseline;const i=this.countOfRenderPositions+1,s=this.visibleSlider?Math.floor(this.slider.min):0,o=Math.min(this.Length,s+i),a=10*n;e.resetTransform(),e.fillStyle="black",e.textAlign="center",e.font=`${a.toFixed(1)}px Roboto, Roboto Local, sans-serif`;const l=Math.max(...this.positions.map((t=>e.measureText(t.name).width))),h=l<this._positionWidth-2?1:(this._positionWidth-2)/l;for(let t=this.firstVisibleIndex;t<o;t++){const n=this.positions[t];e.resetTransform(),e.setTransform(h,0,0,1,t*this.positionWidthWithMargin+this._positionWidth/2-this.positionWidthWithMargin*s,0),e.fillText(n.name,0,0)}for(let t=this.firstVisibleIndex;t<o;t++)for(const[n,i]of Object.entries(this.positions[t].freq))if("-"!==n){const t=(0,c.GU)(n,5),s=i.bounds,r=s.left-this.positionWidthWithMargin*this.firstVisibleIndex;e.resetTransform(),e.strokeStyle="lightgray",e.lineWidth=1,e.rect(r,s.top,s.width,s.height),e.fillStyle=this.cp.get(n)??this.cp.get("other"),e.textAlign="left",e.font="16px Roboto, Roboto Local, sans-serif";const o=e.measureText(t);e.setTransform(s.width/o.width,0,0,s.height/12.2,r,s.top),e.fillText(t,0,-.25)}}calcSize(){if(!this.host)return;const t=window.devicePixelRatio;let e=this.widthArea,n=this.heightArea;if(this.fitArea&&!this.visibleSlider){const t=Math.max(1,Math.min(this.xScale,this.yScale));e*=t,n*=t,this._positionWidth=this.positionWidth*t}e=this.Length*this.positionWidthWithMargin/t,this.canvas.width=this.root.clientWidth*t,this.canvas.style.width=`${this.root.clientWidth}px`,this.host.style.setProperty("height",`${n}px`);const i=this.host.clientHeight;if(this.canvas.height=i*t,this.fixWidth)this.root.style.width=this.host.style.width=`${e}px`,this.root.style.height=`${n}px`,this.root.style.overflow="hidden",this.host.style.setProperty("overflow-y","hidden","important");else{this.root.style.width=this.host.style.width="100%",this.host.style.overflowX="auto!important",this.host.style.setProperty("text-align",this.horizontalAlignment);const t=this.visibleSlider?10:0;let s=0;switch(this.verticalAlignment){case"top":s=0;break;case"middle":s=Math.max(0,(this.root.clientHeight-n)/2);break;case"bottom":s=Math.max(0,this.root.clientHeight-n-t)}let r=0;switch(this.horizontalAlignment){case"left":r=0;break;case"center":r=Math.max(0,(this.root.clientWidth-e)/2);break;case"right":r=Math.max(0,this.root.clientWidth-e)}this.host.style.setProperty("margin-top",`${s}px`,"important"),this.host.style.setProperty("margin-left",`${r}px`,"important"),null!=this.slider&&this.slider.root.style.setProperty("margin-top",`${s+i}px`,"important"),this.root.clientHeight<=n?(this.host.style.setProperty("height",`${this.root.clientHeight}px`),this.host.style.setProperty("overflow-y",null)):this.host.style.setProperty("overflow-y","hidden","important")}}getAlphabetSize(){return this.unitsHandler?.getAlphabetSize()??0}sliderOnValuesChanged(t){if(null!=this.host)try{if(this.allowResize&&!this.turnOfResizeForOneSetValue&&this.visibleSlider){const t=Math.ceil(this.slider.max-this.slider.min),e=this.canvas.width/t-this.positionMarginValue;this.positionWidth=e,this._positionWidth=e}this.turnOfResizeForOneSetValue=!1,this.render(!0)}catch(t){const e=m(t);p._package.logger.error("Bio: WebLogoViewer.sliderOnValuesChanged() error:\n"+e)}}dataFrameFilterOnChanged(t){p._package.logger.debug("Bio: WebLogoViewer.dataFrameFilterChanged()");try{this.updatePositions(),this.render()}catch(t){const e=m(t);p._package.logger.error("Bio: WebLogoViewer.dataFrameFilterOnChanged() error:\n"+e)}}dataFrameSelectionOnChanged(t){p._package.logger.debug("Bio: WebLogoViewer.dataFrameSelectionOnChanged()");try{this.render()}catch(t){const e=m(t);p._package.logger.error("Bio: WebLogoViewer.dataFrameSelectionOnChanged() error:\n"+e)}}canvasOnMouseMove(t){try{const e=t,n=window.devicePixelRatio,i=this.canvas.getCursorPosition(e,n),[r,o]=this.getMonomer(i);if(this.dataFrame&&this.seqCol&&o){const t=this.positions[r],n=function(t,e,n,i,s){return a().count(0).take(t.rowCount).filter((t=>n.get(t))).map((t=>{const n=e.splitted[t],i=s.pos;return i<n.length?n[i]:null})).toArray().filter((t=>t==i)).reduce(((t,e)=>t+1),0)}(this.dataFrame,this.unitsHandler,this.filter,o,t),i=s.div([s.div(`${o}`),s.div(`${n} rows`)]);s.tooltip.show(i,e.x+16,e.y+16)}else s.tooltip.hide()}catch(t){const e=m(t);p._package.logger.error("Bio: WebLogoViewer.canvasOnMouseMove() error:\n"+e)}}canvasOnMouseDown(t){try{const e=t,n=window.devicePixelRatio,[i,s]=this.getMonomer(this.canvas.getCursorPosition(e,n));if(this.dataFrame&&this.seqCol&&this.unitsHandler&&s){const t=this.positions[i],e=r.BitSet.create(this.dataFrame.selection.length,(e=>function(t,e,n,i,s,r){if(!n.getSelectedIndexes().includes(i))return!1;const o=e.splitted[i],a=r.pos<o.length?o[r.pos]:null;return a===s||""===a&&"-"===s}(this.dataFrame,this.unitsHandler,this.filter,e,s,t)));this.dataFrame.selection.init((t=>e.get(t)))}}catch(t){const e=m(t);p._package.logger.error("Bio: WebLogoViewer.canvasOnMouseDown() error:\n"+e)}}canvasOnWheel(t){try{if(!this.visibleSlider)return;const e=t.deltaY/100*Math.max(Math.floor(this.countOfRenderPositions/2),1);this.slider.scrollBy(this.slider.min+e)}catch(t){const e=m(t);p._package.logger.error("Bio: WebLogoViewer.canvasOnWheel() error:\n"+e)}}}w.residuesSet="nucleotides",w.viewerCount=-1},4413:(t,e,n)=>{"use strict";n.d(e,{ST:()=>d});var i=n(3870),s=n(976),r=n(4469),o=n(6414),a=n.n(o),l=n(7983),h=n(701),c=n(4293),u=n(1061);const m=rxjs.operators;class d extends s.Filter{get calculating(){return"initial"==this.loader.style.display}set calculating(t){this.loader.style.display=t?"initial":"none"}get filterSummary(){return this.bioFilter.substructure}get isFiltering(){return super.isFiltering&&""!==this.bioFilter.substructure}get isReadyToApplyFilter(){return!this.calculating&&null!=this.bitset}get _debounceTime(){if(null==this.column)return 1e3;const t=this.column.length;return t<500?0:t>1e4?1e3:Math.floor((t-500)/9500*1e3)}constructor(){super(),this.bioFilter=null,this.bitset=null,this.loader=i.loader(),this.notation=void 0,this.root=i.divV([]),this.calculating=!1}attach(t){super.attach(t),this.column=t.columns.bySemType(s.SEMTYPE.MACROMOLECULE),this.columnName??(this.columnName=this.column?.name),this.notation??(this.notation=this.column?.getTag(s.TAGS.UNITS)),this.bioFilter="fasta"===this.notation?new p:"separator"===this.notation?new g(this.column.getTag("separator")):new y,this.root.appendChild(this.bioFilter.filterPanel),this.root.appendChild(this.loader),this.onBioFilterChangedSubs?.unsubscribe();let e=this.bioFilter.onChanged;e=e.pipe((0,m.debounceTime)(this._debounceTime)),this.onBioFilterChangedSubs=e.subscribe((async t=>await this._onInputChanged()))}detach(){super.detach()}applyFilter(){this.bitset&&!this.isDetached&&this.dataFrame?.filter.and(this.bitset)}saveState(){const t=super.saveState();return t.bioSubstructure=this.bioFilter?.substructure,t}applyState(t){super.applyState(t),t.bioSubstructure&&(this.bioFilter.substructure=t.bioSubstructure);const e=this;t.bioSubstructure&&setTimeout((function(){e._onInputChanged()}),1e3)}async _onInputChanged(){if(this.isFiltering){if(a()(this.dataFrame.rows.filters).has(`${this.columnName}: ${this.filterSummary}`))return;this.calculating=!0;try{this.bitset=await(this.bioFilter?.substrucrureSearch(this.column)),this.calculating=!1,this.dataFrame?.rows.requestFilter()}finally{this.calculating=!1}}else this.bitset=null,this.dataFrame?.rows.requestFilter()}}class f{constructor(){this.onChanged=new h.Subject}get filterPanel(){return new HTMLElement}get substructure(){return""}set substructure(t){}async substrucrureSearch(t){return null}}class p extends f{constructor(){super(),this.substructureInput=i.stringInput("","",(()=>{this.onChanged.next()}),{placeholder:"Substructure"})}get filterPanel(){return this.substructureInput.root}get substructure(){return this.substructureInput.value}set substructure(t){this.substructureInput.value=t}async substrucrureSearch(t){return await(0,l.pf)(this.substructure,t)}}class g extends p{constructor(t){super(),this.colSeparator="",this.separatorInput=i.stringInput("","",(()=>{this.onChanged.next()}),{placeholder:"Separator"}),this.colSeparator=t,this.separatorInput.value=t}get filterPanel(){return i.divV([this.substructureInput.root,this.separatorInput.root])}get substructure(){return this.separatorInput.value&&this.separatorInput.value!==this.colSeparator?this.substructureInput.value.replaceAll(this.separatorInput.value,this.colSeparator):this.substructureInput.value}set substructure(t){this.substructureInput.value=t}async substrucrureSearch(t){return await(0,l.pf)(this.substructure,t,this.colSeparator)}}class y extends f{constructor(){super(),this._filterPanel=i.div("",{style:{cursor:"pointer"}}),this.helmSubstructure="",this.init()}async init(){this.helmEditor=await r.functions.call("HELM:helmWebEditor"),await i.tools.waitForElementInDom(this._filterPanel),this.updateFilterPanel(),this._filterPanel.addEventListener("click",(t=>{const{editorDiv:e,webEditor:n}=this.helmEditor.createWebEditor(this.helmSubstructure);i.dialog({showHeader:!1,showFooter:!0}).add(e).onOK((()=>{const t=n.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.helmSubstructure=t,this.updateFilterPanel(this.substructure),setTimeout((()=>{this.onChanged.next()}),10)})).show({modal:!0,fullScreen:!0})})),i.onSizeChanged(this._filterPanel).subscribe((t=>{const e=this.helmEditor.webEditor.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.updateFilterPanel(e)}))}get filterPanel(){return this._filterPanel}get substructure(){return this.helmSubstructure}set substructure(t){this.helmEditor.editor.setHelm(t)}updateFilterPanel(t){const e=this._filterPanel.parentElement.clientWidth<100?100:this._filterPanel.parentElement.clientWidth,n=e/2;if(t)(0,c.Y)(this._filterPanel,this.helmEditor.host),this.helmEditor.editor.setHelm(t),this.helmEditor.resizeEditor(e,n);else{const t=i.divText("Click to edit","helm-substructure-filter");(0,c.Y)(this._filterPanel,t)}}async substrucrureSearch(t){i.setUpdateIndicator(this._filterPanel,!0),await(0,u.gw)(10);const e=await(0,l.QF)(this.substructure,t);return i.setUpdateIndicator(this._filterPanel,!1),e}}},9378:function(t,e,n){"use strict";var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var s=i(n(4517));function r(t,e){var n=function(n){return s.empty(t).map((function(){return s.filled(e,n)}))},i=[];return i.push(n(-1)),i.push(n(1/0)),i.push(n(0)),i}function o(t,e,n,i,s){e=Math.floor(e);var r=t[0][e],o=t[1][e];if(t[2][e],n>=o[0])return 0;for(var l=0;l<r.length;l++)if(i===r[l])return 0;return a(t,e,n,i,s)}function a(t,e,n,i,s){var r=t[0][e],o=t[1][e],a=t[2][e];if(n>=o[0])return 0;o[0]=n,r[0]=i,a[0]=s;for(var l=0,h=0;;){var c=2*l+1,u=c+1,m=t[0][0].length;if(c>=m)break;if(u>=m){if(!(o[c]>n))break;h=c}else if(o[c]>=o[u]){if(!(n<o[c]))break;h=c}else{if(!(n<o[u]))break;h=u}o[l]=o[h],r[l]=r[h],a[l]=a[h],l=h}return o[l]=n,r[l]=i,a[l]=s,1}function l(t,e,n,i){for(;2*i+1<n;){var s=2*i+1,r=s+1,o=i;if(t[o]<t[s]&&(o=s),r<n&&t[o]<t[r]&&(o=r),o===i)break;var a=t[i];t[i]=t[o],t[o]=a;var l=e[i];e[i]=e[o],e[o]=l,i=o}}e.makeHeap=r,e.rejectionSample=function(t,e,n){for(var i=s.zeros(t),r=0;r<t;r++){for(var o=!0,a=0;o;){a=s.tauRandInt(e,n);for(var l=!1,h=0;h<r;h++)if(a===i[h]){l=!0;break}l||(o=!1)}i[r]=a}return i},e.heapPush=o,e.uncheckedHeapPush=a,e.buildCandidates=function(t,e,n,i,a){for(var l=r(e,i),h=0;h<e;h++)for(var c=0;c<n;c++)if(!(t[0][h][c]<0)){var u=t[0][h][c],m=t[2][h][c],d=s.tauRand(a);o(l,h,d,u,m),o(l,u,d,h,m),t[2][h][c]=0}return l},e.deheapSort=function(t){for(var e=t[0],n=t[1],i=0;i<e.length;i++)for(var s=e[i],r=n[i],o=0;o<s.length-1;o++){var a=s.length-o-1,h=r.length-o-1,c=s[0];s[0]=s[a],s[a]=c;var u=r[0];r[0]=r[h],r[h]=u,l(r,s,h,0)}return{indices:e,weights:n}},e.smallestFlagged=function(t,e){for(var n=t[0][e],i=t[1][e],s=t[2][e],r=1/0,o=-1,a=0;a>n.length;a++)1===s[a]&&i[a]<r&&(r=i[a],o=a);return o>=0?(s[o]=0,Math.floor(n[o])):-1}},4221:(t,e,n)=>{"use strict";var i=n(4364);e.u=i.UMAP},5686:function(t,e,n){"use strict";var i,s=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,s,r=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(t){s={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o},r=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}},o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var a=o(n(4517)),l=function(){function t(t,e,n,i){if(this.entries=new Map,this.nRows=0,this.nCols=0,t.length!==e.length||t.length!==n.length)throw new Error("rows, cols and values arrays must all have the same length");this.nRows=i[0],this.nCols=i[1];for(var s=0;s<n.length;s++){var r=t[s],o=e[s];this.checkDims(r,o);var a=this.makeKey(r,o);this.entries.set(a,{value:n[s],row:r,col:o})}}return t.prototype.makeKey=function(t,e){return t+":"+e},t.prototype.checkDims=function(t,e){if(!(t<this.nRows&&e<this.nCols))throw new Error("row and/or col specified outside of matrix dimensions")},t.prototype.set=function(t,e,n){this.checkDims(t,e);var i=this.makeKey(t,e);this.entries.has(i)?this.entries.get(i).value=n:this.entries.set(i,{value:n,row:t,col:e})},t.prototype.get=function(t,e,n){void 0===n&&(n=0),this.checkDims(t,e);var i=this.makeKey(t,e);return this.entries.has(i)?this.entries.get(i).value:n},t.prototype.getAll=function(t){void 0===t&&(t=!0);var e=[];return this.entries.forEach((function(t){e.push(t)})),t&&e.sort((function(t,e){return t.row===e.row?t.col-e.col:t.row-e.row})),e},t.prototype.getDims=function(){return[this.nRows,this.nCols]},t.prototype.getRows=function(){return Array.from(this.entries,(function(t){var e=s(t,2);return e[0],e[1].row}))},t.prototype.getCols=function(){return Array.from(this.entries,(function(t){var e=s(t,2);return e[0],e[1].col}))},t.prototype.getValues=function(){return Array.from(this.entries,(function(t){var e=s(t,2);return e[0],e[1].value}))},t.prototype.forEach=function(t){this.entries.forEach((function(e){return t(e.value,e.row,e.col)}))},t.prototype.map=function(e){var n=[];this.entries.forEach((function(t){n.push(e(t.value,t.row,t.col))}));var i=[this.nRows,this.nCols];return new t(this.getRows(),this.getCols(),n,i)},t.prototype.toArray=function(){var t=this,e=a.empty(this.nRows).map((function(){return a.zeros(t.nCols)}));return this.entries.forEach((function(t){e[t.row][t.col]=t.value})),e},t}();e.SparseMatrix=l,e.transpose=function(t){var e=[],n=[],i=[];t.forEach((function(t,s,r){e.push(s),n.push(r),i.push(t)}));var s=[t.nCols,t.nRows];return new l(n,e,i,s)},e.identity=function(t){for(var e=s(t,1)[0],n=new l([],[],[],t),i=0;i<e;i++)n.set(i,i,1);return n},e.pairwiseMultiply=function(t,e){return c(t,e,(function(t,e){return t*e}))},e.add=function(t,e){return c(t,e,(function(t,e){return t+e}))},e.subtract=function(t,e){return c(t,e,(function(t,e){return t-e}))},e.maximum=function(t,e){return c(t,e,(function(t,e){return t>e?t:e}))},e.multiplyScalar=function(t,e){return t.map((function(t){return t*e}))},e.eliminateZeros=function(t){for(var e=new Set,n=t.getValues(),i=t.getRows(),s=t.getCols(),r=0;r<n.length;r++)0===n[r]&&e.add(r);var o=function(t,n){return!e.has(n)},a=n.filter(o),h=i.filter(o),c=s.filter(o);return new l(h,c,a,t.getDims())},e.normalize=function(t,e){var n,i;void 0===e&&(e="l2");var s=h[e],o=new Map;t.forEach((function(t,e,n){var i=o.get(e)||[];i.push(n),o.set(e,i)}));var a=new l([],[],[],t.getDims()),c=function(e){for(var n=o.get(e).sort(),i=n.map((function(n){return t.get(e,n)})),r=s(i),l=0;l<r.length;l++)a.set(e,n[l],r[l])};try{for(var u=r(o.keys()),m=u.next();!m.done;m=u.next())c(m.value)}catch(t){n={error:t}}finally{try{m&&!m.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}return a};var h=((i={}).max=function(t){for(var e=-1/0,n=0;n<t.length;n++)e=t[n]>e?t[n]:e;return t.map((function(t){return t/e}))},i.l1=function(t){for(var e=0,n=0;n<t.length;n++)e+=t[n];return t.map((function(t){return t/e}))},i.l2=function(t){for(var e=0,n=0;n<t.length;n++)e+=Math.pow(t[n],2);return t.map((function(t){return Math.sqrt(Math.pow(t,2)/e)}))},i);function c(t,e,n){for(var i=new Set,s=[],r=[],o=[],a=function(i,a){s.push(i),r.push(a);var l=n(t.get(i,a),e.get(i,a));o.push(l)},h=t.getValues(),c=t.getRows(),u=t.getCols(),m=0;m<h.length;m++){var d=(y=c[m])+":"+(b=u[m]);i.add(d),a(y,b)}var f=e.getValues(),p=e.getRows(),g=e.getCols();for(m=0;m<f.length;m++){var y,b;d=(y=p[m])+":"+(b=g[m]),i.has(d)||a(y,b)}var w=[t.nRows,t.nCols];return new l(s,r,o,w)}e.getCSR=function(t){var e=[];t.forEach((function(t,n,i){e.push({value:t,row:n,col:i})})),e.sort((function(t,e){return t.row===e.row?t.col-e.col:t.row-e.row}));for(var n=[],i=[],s=[],r=-1,o=0;o<e.length;o++){var a=e[o],l=a.row,h=a.col,c=a.value;l!==r&&(r=l,s.push(o)),n.push(h),i.push(c)}return{indices:n,values:i,indptr:s}}},760:function(t,e,n){"use strict";var i=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}},s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var r=s(n(9378)),o=s(n(5686)),a=s(n(2320)),l=s(n(4517));e.makeNNDescent=function(t,e){return function(n,i,s,o,a,h,c,u){void 0===o&&(o=10),void 0===a&&(a=50),void 0===h&&(h=.001),void 0===c&&(c=.5),void 0===u&&(u=!0);for(var m=n.length,d=r.makeHeap(n.length,s),f=0;f<n.length;f++)for(var p=r.rejectionSample(s,n.length,e),g=0;g<p.length;g++){var y=t(n[f],n[p[g]]);r.heapPush(d,f,y,p[g],1),r.heapPush(d,p[g],y,f,1)}if(u)for(var b=0;b<i.length;b++)for(f=0;f<i[b].length&&!(i[b][f]<0);f++)for(g=f+1;g<i[b].length&&!(i[b][g]<0);g++)y=t(n[i[b][f]],n[i[b][g]]),r.heapPush(d,i[b][f],y,i[b][g],1),r.heapPush(d,i[b][g],y,i[b][f],1);for(b=0;b<o;b++){var w=r.buildCandidates(d,m,s,a,e),v=0;for(f=0;f<m;f++)for(g=0;g<a;g++){var C=Math.floor(w[0][f][g]);if(!(C<0||l.tauRand(e)<c))for(var S=0;S<a;S++){var M=Math.floor(w[0][f][S]),T=w[2][f][g],x=w[2][f][S];M<0||!T&&!x||(y=t(n[C],n[M]),v+=r.heapPush(d,C,y,M,1),v+=r.heapPush(d,M,y,C,1))}}if(v<=h*s*n.length)break}return r.deheapSort(d)}},e.makeInitializations=function(t){return{initFromRandom:function(e,n,i,s,o){for(var a=0;a<i.length;a++)for(var h=l.rejectionSample(e,n.length,o),c=0;c<h.length;c++)if(!(h[c]<0)){var u=t(n[h[c]],i[a]);r.heapPush(s,a,u,h[c],1)}},initFromTree:function(e,n,i,s,o){for(var l=0;l<i.length;l++)for(var h=a.searchFlatTree(i[l],e,o),c=0;c<h.length;c++){if(h[c]<0)return;var u=t(n[h[c]],i[l]);r.heapPush(s,l,u,h[c],1)}}}},e.makeInitializedNNSearch=function(t){return function(e,n,s,a){for(var l,h,c=o.getCSR(n),u=c.indices,m=c.indptr,d=0;d<a.length;d++)for(var f=new Set(s[0][d]);;){var p=r.smallestFlagged(s,d);if(-1===p)break;var g=u.slice(m[p],m[p+1]);try{for(var y=i(g),b=y.next();!b.done;b=y.next()){var w=b.value;if(w!==p&&-1!==w&&!f.has(w)){var v=t(e[w],a[d]);r.uncheckedHeapPush(s,d,v,w,1),f.add(w)}}}catch(t){l={error:t}}finally{try{b&&!b.done&&(h=y.return)&&h.call(y)}finally{if(l)throw l.error}}}return s}},e.initializeSearch=function(t,e,n,s,o,a,l){var h,c,u=r.makeHeap(n.length,s);if(o(s,e,n,u,l),t)try{for(var m=i(t),d=m.next();!d.done;d=m.next())a(d.value,e,n,u,l)}catch(t){h={error:t}}finally{try{d&&!d.done&&(c=m.return)&&c.call(m)}finally{if(h)throw h.error}}return u}},2320:function(t,e,n){"use strict";var i=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,s,r=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(t){s={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o},s=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(i(arguments[e]));return t},r=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}},o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var a=o(n(4517)),l=function(t,e,n,i){this.hyperplanes=t,this.offsets=e,this.children=n,this.indices=i};function h(t,e,n,i,s){if(void 0===n&&(n=30),e.length>n){var r=function(t,e,n){var i=t[0].length,s=a.tauRandInt(e.length,n),r=a.tauRandInt(e.length,n);r=(r+=s===r?1:0)%e.length;for(var o=e[s],l=e[r],h=0,c=a.zeros(i),u=0;u<c.length;u++)c[u]=t[o][u]-t[l][u],h-=c[u]*(t[o][u]+t[l][u])/2;var m=0,d=0,f=a.zeros(e.length);for(u=0;u<e.length;u++){for(var p=h,g=0;g<i;g++)p+=c[g]*t[e[u]][g];0===p?(f[u]=a.tauRandInt(2,n),0===f[u]?m+=1:d+=1):p>0?(f[u]=0,m+=1):(f[u]=1,d+=1)}var y=a.zeros(m),b=a.zeros(d);for(m=0,d=0,u=0;u<f.length;u++)0===f[u]?(y[m]=e[u],m+=1):(b[d]=e[u],d+=1);return{indicesLeft:y,indicesRight:b,hyperplane:c,offset:h}}(t,e,s),o=r.indicesLeft,l=r.indicesRight,c=r.hyperplane,u=r.offset;return{leftChild:h(t,o,n,i+1,s),rightChild:h(t,l,n,i+1,s),isLeaf:!1,hyperplane:c,offset:u}}return{indices:e,isLeaf:!0}}function c(t,e,n,i,r,o,a){var l;if(t.isLeaf)return i[o][0]=-a,(l=r[a]).splice.apply(l,s([0,t.indices.length],t.indices)),{nodeNum:o,leafNum:a+=1};e[o]=t.hyperplane,n[o]=t.offset,i[o][0]=o+1;var h=o,u=c(t.leftChild,e,n,i,r,o+1,a);return o=u.nodeNum,a=u.leafNum,i[h][1]=o+1,{nodeNum:(u=c(t.rightChild,e,n,i,r,o+1,a)).nodeNum,leafNum:u.leafNum}}function u(t){return t.isLeaf?1:1+u(t.leftChild)+u(t.rightChild)}function m(t){return t.isLeaf?1:m(t.leftChild)+m(t.rightChild)}function d(t,e,n,i){for(var s=e,r=0;r<n.length;r++)s+=t[r]*n[r];return 0===s?a.tauRandInt(2,i):s>0?0:1}e.FlatTree=l,e.makeForest=function(t,e,n,i){var s=Math.max(10,e);return a.range(n).map((function(e,n){return function(t,e,n,i){return void 0===e&&(e=30),h(t,a.range(t.length),e,n,i)}(t,s,n,i)})).map((function(t){return function(t,e){var n=u(t),i=m(t),s=a.range(n).map((function(){return a.zeros(t.hyperplane?t.hyperplane.length:0)})),r=a.zeros(n),o=a.range(n).map((function(){return[-1,-1]})),h=a.range(i).map((function(){return a.range(e).map((function(){return-1}))}));return c(t,s,r,o,h,0,0),new l(s,r,o,h)}(t,s)}))},e.makeLeafArray=function(t){var e,n;if(t.length>0){var i=[];try{for(var o=r(t),a=o.next();!a.done;a=o.next()){var l=a.value;i.push.apply(i,s(l.indices))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return i}return[[-1]]},e.searchFlatTree=function(t,e,n){for(var i=0;e.children[i][0]>0;)i=0===d(e.hyperplanes[i],e.offsets[i],t,n)?e.children[i][0]:e.children[i][1];var s=-1*e.children[i][0];return e.indices[s]}},4364:function(t,e,n){"use strict";var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(s,r){function o(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){t.done?s(t.value):new n((function(e){e(t.value)})).then(o,a)}l((i=i.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var n,i,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(s=2&r[0]?i.return:r[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,r[1])).done)return s;switch(i=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,i=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!((s=(s=o.trys).length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]<s[3])){o.label=r[1];break}if(6===r[0]&&o.label<s[1]){o.label=s[1],s=r;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(r);break}s[2]&&o.ops.pop(),o.trys.pop();continue}r=e.call(t,o)}catch(t){r=[6,t],i=0}finally{n=s=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,a])}}},r=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,s,r=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(t){s={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o},o=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(r(arguments[e]));return t},a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e},l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var h=a(n(9378)),c=a(n(5686)),u=a(n(760)),m=a(n(2320)),d=a(n(4517)),f=l(n(9251)),p=1e-5,g=.001,y=function(){function t(t){void 0===t&&(t={});var e=this;this.learningRate=1,this.localConnectivity=1,this.minDist=.1,this.nComponents=2,this.nEpochs=0,this.nNeighbors=15,this.negativeSampleRate=5,this.random=Math.random,this.repulsionStrength=1,this.setOpMixRatio=1,this.spread=1,this.transformQueueSize=4,this.targetMetric="categorical",this.targetWeight=.5,this.targetNNeighbors=this.nNeighbors,this.distanceFn=b,this.isInitialized=!1,this.rpForest=[],this.embedding=[],this.optimizationState=new w;var n=function(n){void 0!==t[n]&&(e[n]=t[n])};n("distanceFn"),n("learningRate"),n("localConnectivity"),n("minDist"),n("nComponents"),n("nEpochs"),n("nNeighbors"),n("negativeSampleRate"),n("random"),n("repulsionStrength"),n("setOpMixRatio"),n("spread"),n("transformQueueSize")}return t.prototype.fit=function(t){return this.initializeFit(t),this.optimizeLayout(),this.embedding},t.prototype.fitAsync=function(t,e){return void 0===e&&(e=function(){return!0}),i(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return this.initializeFit(t),[4,this.optimizeLayoutAsync(e)];case 1:return n.sent(),[2,this.embedding]}}))}))},t.prototype.setSupervisedProjection=function(t,e){void 0===e&&(e={}),this.Y=t,this.targetMetric=e.targetMetric||this.targetMetric,this.targetWeight=e.targetWeight||this.targetWeight,this.targetNNeighbors=e.targetNNeighbors||this.targetNNeighbors},t.prototype.setPrecomputedKNN=function(t,e){this.knnIndices=t,this.knnDistances=e},t.prototype.initializeFit=function(t){if(t.length<=this.nNeighbors)throw new Error("Not enough data points ("+t.length+") to create nNeighbors: "+this.nNeighbors+". Add more data points or adjust the configuration.");if(this.X===t&&this.isInitialized)return this.getNEpochs();if(this.X=t,!this.knnIndices&&!this.knnDistances){var e=this.nearestNeighbors(t);this.knnIndices=e.knnIndices,this.knnDistances=e.knnDistances}this.graph=this.fuzzySimplicialSet(t,this.nNeighbors,this.setOpMixRatio),this.makeSearchFns(),this.searchGraph=this.makeSearchGraph(t),this.processGraphForSupervisedProjection();var n=this.initializeSimplicialSetEmbedding(),i=n.head,s=n.tail,r=n.epochsPerSample;return this.optimizationState.head=i,this.optimizationState.tail=s,this.optimizationState.epochsPerSample=r,this.initializeOptimization(),this.prepareForOptimizationLoop(),this.isInitialized=!0,this.getNEpochs()},t.prototype.makeSearchFns=function(){var t=u.makeInitializations(this.distanceFn),e=t.initFromTree,n=t.initFromRandom;this.initFromTree=e,this.initFromRandom=n,this.search=u.makeInitializedNNSearch(this.distanceFn)},t.prototype.makeSearchGraph=function(t){for(var e=this.knnIndices,n=this.knnDistances,i=[t.length,t.length],s=new c.SparseMatrix([],[],[],i),r=0;r<e.length;r++)for(var o=e[r],a=n[r],l=0;l<o.length;l++){var h=o[l],u=a[l];u>0&&s.set(r,h,u)}var m=c.transpose(s);return c.maximum(s,m)},t.prototype.transform=function(t){var e=this,n=this.X;if(void 0===n||0===n.length)throw new Error("No data has been fit.");var i=Math.floor(this.nNeighbors*this.transformQueueSize);i=Math.min(n.length,i);var s=u.initializeSearch(this.rpForest,n,t,i,this.initFromRandom,this.initFromTree,this.random),r=this.search(n,this.searchGraph,s,t),o=h.deheapSort(r),a=o.indices,l=o.weights;a=a.map((function(t){return t.slice(0,e.nNeighbors)})),l=l.map((function(t){return t.slice(0,e.nNeighbors)}));var m=Math.max(0,this.localConnectivity-1),f=this.smoothKNNDistance(l,this.nNeighbors,m),p=f.sigmas,g=f.rhos,y=this.computeMembershipStrengths(a,l,p,g),b=y.rows,w=y.cols,v=y.vals,C=[t.length,n.length],S=new c.SparseMatrix(b,w,v,C),M=c.normalize(S,"l1"),T=c.getCSR(M),E=t.length,N=x(d.reshape2d(T.indices,E,this.nNeighbors),d.reshape2d(T.values,E,this.nNeighbors),this.embedding),A=this.nEpochs?this.nEpochs/3:S.nRows<=1e4?100:30,I=S.getValues().reduce((function(t,e){return e>t?e:t}),0);S=S.map((function(t){return t<I/A?0:t})),S=c.eliminateZeros(S);var L=this.makeEpochsPerSample(S.getValues(),A),k=S.getRows(),_=S.getCols();return this.assignOptimizationStateParameters({headEmbedding:N,tailEmbedding:this.embedding,head:k,tail:_,currentEpoch:0,nEpochs:A,nVertices:S.getDims()[1],epochsPerSample:L}),this.prepareForOptimizationLoop(),this.optimizeLayout()},t.prototype.processGraphForSupervisedProjection=function(){var t=this.Y,e=this.X;if(t){if(t.length!==e.length)throw new Error("Length of X and y must be equal");if("categorical"===this.targetMetric){var n=this.targetWeight<1?1/(1-this.targetWeight)*2.5:1e12;this.graph=this.categoricalSimplicialSetIntersection(this.graph,t,n)}}},t.prototype.step=function(){var t=this.optimizationState.currentEpoch;return t<this.getNEpochs()&&this.optimizeLayoutStep(t),this.optimizationState.currentEpoch},t.prototype.getEmbedding=function(){return this.embedding},t.prototype.nearestNeighbors=function(t){var e,n=this.distanceFn,i=this.nNeighbors,s=u.makeNNDescent(n,this.random),r=5+Math.floor(.5==(e=Math.pow(t.length,.5)/20)?0:Math.round(e)),o=Math.max(5,Math.floor(Math.round(function(t){return Math.log(t)/Math.log(2)}(t.length))));this.rpForest=m.makeForest(t,i,r,this.random);var a=s(t,m.makeLeafArray(this.rpForest),i,o);return{knnIndices:a.indices,knnDistances:a.weights}},t.prototype.fuzzySimplicialSet=function(t,e,n){void 0===n&&(n=1);var i=this,s=i.knnIndices,r=void 0===s?[]:s,o=i.knnDistances,a=void 0===o?[]:o,l=i.localConnectivity,h=this.smoothKNNDistance(a,e,l),u=h.sigmas,m=h.rhos,d=this.computeMembershipStrengths(r,a,u,m),f=d.rows,p=d.cols,g=d.vals,y=[t.length,t.length],b=new c.SparseMatrix(f,p,g,y),w=c.transpose(b),v=c.pairwiseMultiply(b,w),C=c.subtract(c.add(b,w),v),S=c.multiplyScalar(C,n),M=c.multiplyScalar(v,1-n);return c.add(S,M)},t.prototype.categoricalSimplicialSetIntersection=function(t,e,n,i){void 0===i&&(i=1);var s=M(t,e,i,n);return T(s=c.eliminateZeros(s))},t.prototype.smoothKNNDistance=function(t,e,n,i,s){void 0===n&&(n=1),void 0===i&&(i=64),void 0===s&&(s=1);for(var r=Math.log(e)/Math.log(2)*s,o=d.zeros(t.length),a=d.zeros(t.length),l=0;l<t.length;l++){var h=0,c=1/0,u=1,m=t[l],f=m.filter((function(t){return t>0}));if(f.length>=n){var y=Math.floor(n),b=n-y;y>0?(o[l]=f[y-1],b>p&&(o[l]+=b*(f[y]-f[y-1]))):o[l]=b*f[0]}else f.length>0&&(o[l]=d.max(f));for(var w=0;w<i;w++){for(var v=0,C=1;C<t[l].length;C++){var S=t[l][C]-o[l];v+=S>0?Math.exp(-S/u):1}if(Math.abs(v-r)<p)break;v>r?u=(h+(c=u))/2:(h=u,c===1/0?u*=2:u=(h+c)/2)}if(a[l]=u,o[l]>0){var M=d.mean(m);a[l]<g*M&&(a[l]=g*M)}else{var T=d.mean(t.map(d.mean));a[l]<g*T&&(a[l]=g*T)}}return{sigmas:a,rhos:o}},t.prototype.computeMembershipStrengths=function(t,e,n,i){for(var s=t.length,r=t[0].length,o=d.zeros(s*r),a=d.zeros(s*r),l=d.zeros(s*r),h=0;h<s;h++)for(var c=0;c<r;c++){var u=0;-1!==t[h][c]&&(u=t[h][c]===h?0:e[h][c]-i[h]<=0?1:Math.exp(-(e[h][c]-i[h])/n[h]),o[h*r+c]=h,a[h*r+c]=t[h][c],l[h*r+c]=u)}return{rows:o,cols:a,vals:l}},t.prototype.initializeSimplicialSetEmbedding=function(){for(var t=this,e=this.getNEpochs(),n=this.nComponents,i=this.graph.getValues(),s=0,r=0;r<i.length;r++){var o=i[r];s<i[r]&&(s=o)}var a=this.graph.map((function(t){return t<s/e?0:t}));this.embedding=d.zeros(a.nRows).map((function(){return d.zeros(n).map((function(){return 20*d.tauRand(t.random)-10}))}));var l=[],h=[],c=[],u=a.getAll();for(r=0;r<u.length;r++){var m=u[r];m.value&&(l.push(m.value),c.push(m.row),h.push(m.col))}return{head:h,tail:c,epochsPerSample:this.makeEpochsPerSample(l,e)}},t.prototype.makeEpochsPerSample=function(t,e){var n=d.filled(t.length,-1),i=d.max(t),s=t.map((function(t){return t/i*e}));return s.forEach((function(t,i){t>0&&(n[i]=e/s[i])})),n},t.prototype.assignOptimizationStateParameters=function(t){Object.assign(this.optimizationState,t)},t.prototype.prepareForOptimizationLoop=function(){var t=this,e=t.repulsionStrength,n=t.learningRate,i=t.negativeSampleRate,s=this.optimizationState,r=s.epochsPerSample,a=s.headEmbedding,l=s.tailEmbedding,h=a[0].length,c=a.length===l.length,u=r.map((function(t){return t/i})),m=o(u),d=o(r);this.assignOptimizationStateParameters({epochOfNextSample:d,epochOfNextNegativeSample:m,epochsPerNegativeSample:u,moveOther:c,initialAlpha:n,alpha:n,gamma:e,dim:h})},t.prototype.initializeOptimization=function(){var t=this.embedding,e=this.embedding,n=this.optimizationState,i=n.head,s=n.tail,r=n.epochsPerSample,o=this.getNEpochs(),a=this.graph.nCols,l=S(this.spread,this.minDist),h=l.a,c=l.b;this.assignOptimizationStateParameters({headEmbedding:t,tailEmbedding:e,head:i,tail:s,epochsPerSample:r,a:h,b:c,nEpochs:o,nVertices:a})},t.prototype.optimizeLayoutStep=function(t){for(var e=this.optimizationState,n=e.head,i=e.tail,s=e.headEmbedding,r=e.tailEmbedding,o=e.epochsPerSample,a=e.epochOfNextSample,l=e.epochOfNextNegativeSample,h=e.epochsPerNegativeSample,c=e.moveOther,u=e.initialAlpha,m=e.alpha,f=e.gamma,p=e.a,g=e.b,y=e.dim,b=e.nEpochs,w=e.nVertices,S=0;S<o.length;S++)if(!(a[S]>t)){var M=n[S],T=i[S],x=s[M],E=r[T],N=C(x,E),A=0;N>0&&(A=-2*p*g*Math.pow(N,g-1),A/=p*Math.pow(N,g)+1);for(var I=0;I<y;I++){var L=v(A*(x[I]-E[I]),4);x[I]+=L*m,c&&(E[I]+=-L*m)}a[S]+=o[S];for(var k=Math.floor((t-l[S])/h[S]),_=0;_<k;_++){var R=d.tauRandInt(w,this.random),O=r[R],G=C(x,O),P=0;if(G>0)P=2*f*g,P/=(.001+G)*(p*Math.pow(G,g)+1);else if(M===R)continue;for(I=0;I<y;I++)L=4,P>0&&(L=v(P*(x[I]-O[I]),4)),x[I]+=L*m}l[S]+=k*h[S]}return e.alpha=u*(1-t/b),e.currentEpoch+=1,s},t.prototype.optimizeLayoutAsync=function(t){var e=this;return void 0===t&&(t=function(){return!0}),new Promise((function(n,r){var o=function(){return i(e,void 0,void 0,(function(){var e,i,a,l,h,c;return s(this,(function(s){try{if(e=this.optimizationState,i=e.nEpochs,a=e.currentEpoch,this.embedding=this.optimizeLayoutStep(a),l=this.optimizationState.currentEpoch,h=!1===t(l),c=l===i,h||c)return[2,n(c)];setTimeout((function(){return o()}),0)}catch(t){r(t)}return[2]}))}))};setTimeout((function(){return o()}),0)}))},t.prototype.optimizeLayout=function(t){void 0===t&&(t=function(){return!0});for(var e=!1,n=[];!e;){var i=this.optimizationState,s=i.nEpochs,r=i.currentEpoch;n=this.optimizeLayoutStep(r);var o=this.optimizationState.currentEpoch,a=!1===t(o);e=o===s||a}return n},t.prototype.getNEpochs=function(){var t=this.graph;if(this.nEpochs>0)return this.nEpochs;var e=t.nRows;return e<=2500?500:e<=5e3?400:e<=7500?300:200},t}();function b(t,e){for(var n=0,i=0;i<t.length;i++)n+=Math.pow(t[i]-e[i],2);return Math.sqrt(n)}e.UMAP=y,e.euclidean=b,e.cosine=function(t,e){for(var n=0,i=0,s=0,r=0;r<t.length;r++)n+=t[r]*e[r],i+=Math.pow(t[r],2),s+=Math.pow(e[r],2);return 0===i&&0===s?0:0===i||0===s?1:1-n/Math.sqrt(i*s)};var w=function(){this.currentEpoch=0,this.headEmbedding=[],this.tailEmbedding=[],this.head=[],this.tail=[],this.epochsPerSample=[],this.epochOfNextSample=[],this.epochOfNextNegativeSample=[],this.epochsPerNegativeSample=[],this.moveOther=!0,this.initialAlpha=1,this.alpha=1,this.gamma=1,this.a=1.5769434603113077,this.b=.8950608779109733,this.dim=2,this.nEpochs=500,this.nVertices=0};function v(t,e){return t>e?e:t<-e?-e:t}function C(t,e){for(var n=0,i=0;i<t.length;i++)n+=Math.pow(t[i]-e[i],2);return n}function S(t,e){var n=d.linear(0,3*t,300).map((function(t){return t<e?1:t})),i=d.zeros(n.length).map((function(i,s){return n[s]>=e?Math.exp(-(n[s]-e)/t):i})),s={x:n,y:i},o=f.default(s,(function(t){var e=r(t,2),n=e[0],i=e[1];return function(t){return 1/(1+n*Math.pow(t,2*i))}}),{damping:1.5,initialValues:[.5,.5],gradientDifference:.1,maxIterations:100,errorTolerance:.01}).parameterValues,a=r(o,2);return{a:a[0],b:a[1]}}function M(t,e,n,i){return void 0===n&&(n=1),void 0===i&&(i=5),t.map((function(t,s,r){return-1===e[s]||-1===e[r]?t*Math.exp(-n):e[s]!==e[r]?t*Math.exp(-i):t}))}function T(t){t=c.normalize(t,"max");var e=c.transpose(t),n=c.pairwiseMultiply(e,t);return t=c.add(t,c.subtract(e,n)),c.eliminateZeros(t)}function x(t,e,n){for(var i=d.zeros(t.length).map((function(t){return d.zeros(n[0].length)})),s=0;s<t.length;s++)for(var r=0;r<t[0].length;r++)for(var o=0;o<n[0].length;o++){var a=t[s][r];i[s][o]+=e[s][r]*n[a][o]}return i}e.findABParams=S,e.fastIntersection=M,e.resetLocalConnectivity=T,e.initTransform=x},4517:function(t,e){"use strict";var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}};function i(t,e){return Math.floor(e()*t)}function s(t){for(var e=[],n=0;n<t;n++)e.push(void 0);return e}function r(t,e){return s(t).map((function(){return e}))}function o(t){return r(t,0)}function a(t){return t.reduce((function(t,e){return t+e}))}Object.defineProperty(e,"__esModule",{value:!0}),e.tauRandInt=i,e.tauRand=function(t){return t()},e.norm=function(t){var e,i,s=0;try{for(var r=n(t),o=r.next();!o.done;o=r.next()){var a=o.value;s+=Math.pow(a,2)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(e)throw e.error}}return Math.sqrt(s)},e.empty=s,e.range=function(t){return s(t).map((function(t,e){return e}))},e.filled=r,e.zeros=o,e.ones=function(t){return r(t,1)},e.linear=function(t,e,n){return s(n).map((function(i,s){return t+s*((e-t)/(n-1))}))},e.sum=a,e.mean=function(t){return a(t)/t.length},e.max=function(t){for(var e=0,n=0;n<t.length;n++)e=t[n]>e?t[n]:e;return e},e.max2d=function(t){for(var e=0,n=0;n<t.length;n++)for(var i=0;i<t[n].length;i++)e=t[n][i]>e?t[n][i]:e;return e},e.rejectionSample=function(t,e,n){for(var s=o(t),r=0;r<t;r++)for(var a=!0;a;){for(var l=i(e,n),h=!1,c=0;c<r;c++)if(l===s[c]){h=!0;break}h||(a=!1),s[r]=l}return s},e.reshape2d=function(t,e,n){var i=[],s=0;if(t.length!==e*n)throw new Error("Array dimensions must match input length.");for(var r=0;r<e;r++){for(var o=[],a=0;a<n;a++)o.push(t[s]),s+=1;i.push(o)}return i}},3336:t=>{"use strict";t.exports=$},976:t=>{"use strict";t.exports=DG},4469:t=>{"use strict";t.exports=grok},701:t=>{"use strict";t.exports=rxjs},3870:t=>{"use strict";t.exports=ui},6414:t=>{"use strict";t.exports=wu}},e={};function n(i){var s=e[i];if(void 0!==s)return s.exports;var r=e[i]={id:i,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.exports}n.m=t,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.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&&(t=e.currentScript.src),!t)){var i=e.getElementsByTagName("script");i.length&&(t=i[i.length-1].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(7753);bio=i})();
2
2
  //# sourceMappingURL=package.js.map