@datagrok/bio 2.11.34 → 2.11.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/package-test.js +3 -3
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +6 -6
- package/dist/package.js.map +1 -1
- package/package.json +1 -1
- package/src/analysis/sequence-diversity-viewer.ts +2 -2
- package/src/analysis/sequence-similarity-viewer.ts +1 -1
- package/src/package.ts +12 -0
- package/src/tests/monomer-libraries-tests.ts +8 -4
- package/src/tests/similarity-diversity-tests.ts +2 -2
- package/src/utils/convert.ts +1 -1
- package/src/utils/monomer-lib/lib-manager.ts +8 -3
- package/src/utils/monomer-lib/library-file-manager/custom-monomer-lib-handlers.ts +0 -39
- package/src/utils/monomer-lib/library-file-manager/event-manager.ts +13 -1
- package/src/utils/monomer-lib/library-file-manager/file-manager.ts +18 -9
- package/src/utils/monomer-lib/library-file-manager/file-validator.ts +1 -1
- package/src/utils/monomer-lib/library-file-manager/ui.ts +6 -1
- package/src/utils/poly-tool/csv-to-json-monomer-lib-converter.ts +40 -0
- package/src/utils/poly-tool/transformation.ts +201 -121
- package/src/utils/poly-tool/ui.ts +21 -84
- package/src/utils/poly-tool/utils.ts +7 -7
- package/src/widgets/bio-substructure-filter-helm.ts +2 -2
- package/webpack.config.js +3 -0
- package/src/utils/poly-tool/types.ts +0 -20
package/dist/package-test.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*! For license information please see package-test.js.LICENSE.txt */
|
|
2
|
-
var bio_test;(()=>{var e={2012:(e,t,s)=>{"use strict";s.d(t,{f:()=>r});var n=s(9976);class r extends n.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,r)),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,r)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new r({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(e){const t=e in r.aaSynonyms?r.aaSynonyms[e]:e;return super.get(t)}}r.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class i{static getPalette(e="grok"){switch(e){case"grok":return r.GrokGroups;case"lesk":return r.Lesk;default:throw new Error(`ChemPalette: scheme \`${e}\` does not exist`)}}static getInnerOuter(e){let t=0,s="",n="";for(const r of e)"("==r?t++:")"==r?t--:t?s+=r:n+=r;return isNaN(parseInt(s))?[n,s]:[n,""]}static getColorAAPivot(e="",t="grok"){const s=this.getPalette(t);let[n,r]=this.getInnerOuter(e);if(n=n.length>6?`${n.slice(0,3)}...`:n,r=r.length>6?`${r.slice(0,3)}...`:r,1==e.length||"("==e[1]){const t=e[0]?.toUpperCase();return t in s?[s.get(t),t,r,1]:[this.undefinedColor,n,r,1]}if("d"==e[0]&&e[1]in s&&(2==e.length||"("==e[2])){const t=e[1]?.toUpperCase();return t in s?[s.get(t),t,r,2]:[this.undefinedColor,n,r,2]}if(e.substring(0,3)in this.AAFullNames&&(3==e.length||"("==e[3])){const t=this.AAFullNames[e.substring(0,3)];return t in s?[s.get(t),t,r,3]:[this.undefinedColor,n,r,3]}if(e[0]?.toLowerCase()==e[0]&&e.substring(1,3)in this.AAFullNames&&(4==e.length||"("==e[4])){const t=this.AAFullNames[e.substring(1,3)];return t in s?[s.get(t),t,r,4]:[this.undefinedColor,n,r,4]}return[this.undefinedColor,n,r,0]}}i.SemType="Aminoacids",i.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",i.undefinedColor="rgb(100,100,100)",i.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"},i.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"},i.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(*)*"},i.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"}},6584:(e,t,s)=>{"use strict";s.d(t,{BX:()=>i,nW:()=>l,tW:()=>c,tb:()=>h});var n=s(4469);const r="Libraries",i="System:AppData/Bio/monomer-libraries/",o={explicit:["HELMCoreLibrary.json"],exclude:[]};let a=Promise.resolve();async function l(){let e;return a=a.then((async()=>{const t=await n.dapi.userDataStorage.getValue(r,"Settings",!0);e=t?JSON.parse(t):{exclude:[],explicit:[]},e.exclude=e.exclude instanceof Array?e.exclude:[],e.explicit=e.explicit instanceof Array?e.explicit:[],console.debug(`Bio: getUserLibSettings()\n${JSON.stringify(e,void 0,2)}`)})),await a,e}async function c(e){a=a.then((async()=>{console.debug(`Bio: setUserLibSettings()\n${JSON.stringify(e,void 0,2)}`),await n.dapi.userDataStorage.postValue(r,"Settings",JSON.stringify(e),!0)})),await a}async function h(){await c(o)}},7228:(e,t,s)=>{"use strict";s.d(t,{JN:()=>o,Qx:()=>a});var n=s(976),r=s(4469),i=(s(1047),s(499),s(8457));async function o(){const e=n.Func.find({package:"Bio",name:"getMonomerLibHelper"});if(0===e.length)throw new Error('Package "Bio" must be installed for MonomerLibHelper.');return(await e[0].prepare().call()).getOutputParamValue()}async function a(e,t){e instanceof n.Column&&(e=(0,i.O)(e).columns.toList());const s=(await o()).getBioLib(),a=new Array(e.length),l=e[0].length,c=new Float32Array(l);for(let i=0;i<e.length;++i){const o=t[i],h=s.getMonomer("PEPTIDE",o)?.smiles??"",u=e[i],d=u.getRawData(),m=u.categories,p=m.indexOf("");if(a[i]={categories:m,data:d,emptyIndex:p},void 0===o)continue;const f=n.Column.fromStrings("smiles",m.map((e=>s.getMonomer("PEPTIDE",e)?.smiles??""))),g=(n.DataFrame.fromColumns([f]),(await r.chem.getSimilarities(f,h)).getRawData());for(let e=0;e<l;++e){const t=d[e];c[e]+=""!==o&&t!==p?g[t]:""===o&&t===p?1:0}}for(let s=0;s<c.length;++s){let r=c[s]/t.length;for(let i=0;i<e.length;++i){const e=a[i];if(i>=t.length&&e.data[s]!==e.emptyIndex||e.data[s]===e.emptyIndex&&i<t.length){r=n.FLOAT_NULL;break}}c[s]=r}return n.Column.fromFloat32Array("Similarity",c)}s(5697)},8601:(e,t,s)=>{"use strict";s.d(t,{i0:()=>d});var n=s(4469),r=s(976),i=s(6414),o=s.n(i),a=s(1821),l=s(499);const c={V2K_RGP_SHIFT:8,V2K_RGP_LINE:"M RGP",V2K_A_LINE:"A ",V3K_COUNTS_SHIFT:14,V3K_IDX_SHIFT:7,V3K_HEADER_FIRST_LINE:"\nDatagrok macromolecule handler\n\n",V3K_HEADER_SECOND_LINE:" 0 0 0 0 0 0 999 V3000\n",V3K_BEGIN_CTAB_BLOCK:"M V30 BEGIN CTAB\n",V3K_END_CTAB_BLOCK:"M V30 END CTAB\n",V3K_BEGIN_COUNTS_LINE:"M V30 COUNTS ",V3K_COUNTS_LINE_ENDING:" 0 0 0\n",V3K_BEGIN_ATOM_BLOCK:"M V30 BEGIN ATOM\n",V3K_END_ATOM_BLOCK:"M V30 END ATOM\n",V3K_BEGIN_BOND_BLOCK:"M V30 BEGIN BOND\n",V3K_END_BOND_BLOCK:"M V30 END BOND\n",V3K_BOND_CONFIG:" CFG=",V3K_BEGIN_DATA_LINE:"M V30 ",V3K_END:"M END",PRECISION_FACTOR:1e4,DEOXYRIBOSE:"d",RIBOSE:"r",PHOSPHATE:"p",OXYGEN:"O",HYDROGEN:"H"};var h=s(1047);function u(e){return Math.round(c.PRECISION_FACTOR*e)/c.PRECISION_FACTOR}async function d(e,t,i){if(0===r.Func.find({package:"Chem",name:"getRdKitModule"}).length)return{col:null,warnings:['Transformation to atomic level requires the package "Chem" installed.']};if(t.semType!==r.SEMTYPE.MACROMOLECULE)return{col:null,warnings:[`Only the ${r.SEMTYPE.MACROMOLECULE} columns can be converted to atomic level, the chosen column has semType '${t.semType}'`]};let u=t;const d=l.Cn.getOrCreate(t);d.isHelm()&&(u=d.convert(a.r2.SEPARATOR,"."),u.name=t.name);const p=l.Cn.getOrCreate(u).alphabet;let f;if("PT"===p||"UN"===p)f="PEPTIDE";else{if("RNA"!==p&&"DNA"!==p)return{col:null,warnings:[`Unexpected column's '${u.name}' alphabet '${p}'.`]};f="RNA"}const g=function(e){const t=e.length,s=new Array(t),r=l.Cn.getOrCreate(e),i=r.getSplitter();let a=!1;for(let n=0;n<t;++n){const t=e.get(n);a||(a=""===t),s[n]=t?o()(i(t)).filter((e=>!r.isGap(e))).toArray():[]}return a&&n.shell.warning(`Some values in the "${e.name}" column are empty`),s}(u),y=await async function(e,t,s,r){const i=function(e,t,s){const n=new Map;for(const r of e.getMonomerSymbolsByType(t)){const i=e.getMonomer(t,r);if("RNA"===t&&("Branch"===i.monomerType||"DNA"===s&&i.symbol===c.DEOXYRIBOSE||"RNA"===s&&i.symbol===c.RIBOSE||i.symbol===c.PHOSPHATE)||"PEPTIDE"===t&&"Branch"!==i.monomerType){const e={};h.rx.forEach((t=>{e[t]=i[t]})),n.set(i.symbol,e)}}return n}(t,s,r),o=new Map,a=await n.functions.call("Chem:getRdKitModule"),l={value:null};if("RNA"===s){const e="RNA"===r?[c.RIBOSE,c.PHOSPHATE]:[c.DEOXYRIBOSE,c.PHOSPHATE];for(const t of e)m(o,t,i,a,s,l)}for(let t=0;t<e.length;++t){const n=e[t];for(const e of n)if(""!==e)try{m(o,e,i,a,s,l)}catch(t){const s=t instanceof Error?t.message:t.toString(),n=t instanceof Error?t.stack:void 0;throw console.error(`bio lib: getMonomersDictFromLib() sym='${e}', error:\n${s}\n${n}`),new Error(`Can't get monomer '${e}' from library: ${s}`)}}return o}(g,i,f,p),w=u.length,{molfileList:b,molfileWarningList:C}=await async function(e,t,n,r,i){const o=Math.max(navigator.hardwareConcurrency-2,1),a=new Array(o).fill(null).map((()=>new Worker(new URL(s.p+s.u(79),s.b)))),l=i/o;let c=[],h=[];const u=new Array(o);for(let s=0;s<o;s++){const c=Math.floor(s*l),h=s===o-1?i:Math.floor((s+1)*l);a[s].postMessage({monomerSequencesArray:e,monomersDict:t,alphabet:n,polymerType:r,start:c,end:h}),u[s]=new Promise((e=>{a[s].onmessage=({data:{molfileList:t,molfileWarningList:s}})=>{e({molfileList:t,molfileWarningList:s})}}))}return(await Promise.all(u)).forEach((e=>{c=c.concat(...e.molfileList),h=h.concat(...e.molfileWarningList)})),setTimeout((()=>{a.forEach((e=>{e.terminate()}))}),0),{molfileList:c,molfileWarningList:h}}(g,y,p,f,w);if(C.length>.05*w)throw new Error("Too many errors getting molfiles.");const v=`molfile(${u.name})`,T=e.columns.getUnusedName(v),A=r.Column.fromStrings(T,b);return A.semType=r.SEMTYPE.MOLECULE,A.setTag(r.TAGS.UNITS,r.UNITS.Molecule.MOLBLOCK),{col:A,warnings:C}}function m(e,t,s,n,r,i){if(!e.has(t)){const o=function(e,t,s,n,r){if(t.has(e)){const i=t.get(e),o=function(e){const t=[];for(const s of e){let e=s.capGroupSMILES;e||(e=s.capGroupSMILES),e=e.replace(/(\[|\]|\*|:|\d)/g,""),t.push(e)}return t}(i.rgroups),a=function(e){const t=new Map;let s=e.indexOf(c.V2K_A_LINE,0),n=s;for(;-1!==s;){n=e.indexOf("\n",s);const r=parseInt(e.substring(s,n).replace(/^A\s+/,""));s=e.indexOf("R",n),n=e.indexOf("\n",s);const i=parseInt(e.substring(s,n).replace(/^R/,""));t.set(r,i),s=e.indexOf(c.V2K_A_LINE,n)}for(s=e.indexOf(c.V2K_RGP_LINE,0),n=e.indexOf("\n",s);-1!==s;){s+=c.V2K_RGP_SHIFT,n=e.indexOf("\n",s);const r=e.substring(s,n).replaceAll(/\s+/g," ").split(" ").map((e=>parseInt(e))).slice(1);for(let e=0;e<r.length;e+=2){if(t.has(r[e])&&t.get(r[e])!==r[e+1])throw new Error(`r-group index ${r[e]} has already been added with a different value`);t.set(r[e],r[e+1])}s=e.indexOf(c.V2K_RGP_LINE,n)}return t}(i.molfile),l=function(e,t){const s=t.get_mol(e),n=s.get_v3Kmolblock();return s.delete(),n}(function(e){let t=e.indexOf(c.V2K_A_LINE,0);-1===t&&(t=e.indexOf(c.V2K_RGP_LINE));const s=e.indexOf(c.V3K_END,t);return e.substring(0,t)+e.substring(s)}(i.molfile),s),h=function(e){let t=(e=e.replaceAll("\r","")).indexOf(c.V3K_BEGIN_COUNTS_LINE)+c.V3K_COUNTS_SHIFT,s=e.indexOf(" ",t+1);const n=parseInt(e.substring(t,s));return t=s+1,s=e.indexOf(" ",t+1),{atomCount:n,bondCount:parseInt(e.substring(t,s))}}(l),d=function(e,t){const s=new Array(t),n=new Float32Array(t),r=new Float32Array(t),i=new Array(t);let o=e.indexOf(c.V3K_BEGIN_ATOM_BLOCK);o=e.indexOf("\n",o);let a=o;for(let l=0;l<t;l++){o=e.indexOf(c.V3K_BEGIN_DATA_LINE,o)+c.V3K_IDX_SHIFT,a=e.indexOf(" ",o),o=a+1,a=e.indexOf(" ",o),s[l]=e.substring(o,a);const t=new Array(2);for(let s=0;s<2;++s)o=a+1,a=e.indexOf(" ",o),t[s]=parseFloat(e.substring(o,a));n[l]=t[0],r[l]=t[1],o=a,a=e.indexOf("\n",o)+1,i[l]=e.slice(o,a),o=a}return{atomTypes:s,x:n,y:r,kwargs:i}}(l,h.atomCount),m=function(e,t){const s=new Uint32Array(t),n=new Array(t),r=new Map,i=new Map;let o=e.indexOf(c.V3K_BEGIN_BOND_BLOCK);o=e.indexOf("\n",o);let a=o;for(let l=0;l<t;++l){const t=new Array(3);o=e.indexOf(c.V3K_BEGIN_DATA_LINE,a)+c.V3K_IDX_SHIFT,a=e.indexOf(" ",o);for(let s=0;s<3;++s)o=a+1,a=Math.min(e.indexOf("\n",o),e.indexOf(" ",o)),t[s]=parseInt(e.slice(o,a));s[l]=t[0],n[l]=t.slice(1);const h=e.indexOf("\n",o);let u=e.slice(a,h),d=u.indexOf(c.V3K_BOND_CONFIG);if(-1!==d){d=u.indexOf("=",d)+1;let e=u.indexOf(" ",d);-1===e&&(e=u.length);const t=parseInt(u.slice(d,e));r.set(l,t);const s=c.V3K_BOND_CONFIG+t.toString();u=u.replace(s,"")}u||i.set(l,u)}return{bondTypes:s,atomPairs:n,bondConfiguration:r,kwargs:i}}(l,h.bondCount),y={atoms:d,bonds:m,meta:p(d,m,o,a)};return"PEPTIDE"===n?function(e){const t=e.meta.terminalNodes[0]-1,s=e.meta.rNodes[0]-1,n=e.atoms.x,r=e.atoms.y;A(e,-n[t],-r[t]);const i=C(n[s],r[s]);v(e.atoms,-i),n[e.meta.rNodes[1]-1]<0&&function(e){T(e,!1)}(e);const o=function(e){const t=function(e){const t=new Map;for(const s of e.bonds.atomPairs)for(let e=0;e<2;e++){const n=s[e],r=s[(e+1)%2];t.has(n)?t.get(n)?.push(r):t.set(n,new Array(1).fill(r))}return t}(e);let s=0;const n=e.atoms.atomTypes.length;let r=0;for(;0===s;){const i=t.get(e.meta.terminalNodes[1])[r];if(e.atoms.atomTypes[i-1]===c.OXYGEN&&i!==e.meta.rNodes[1]&&(s=i),r++,r>n)throw new Error(`Search for double-bonded Oxygen in ${e} has exceeded the limit of ${n}`)}return s}(e);!function(e,t){e.atoms.y[e.meta.rNodes[1]-1]<0&&e.atoms.y[t-1]<0&&(function(e){T(e,!0)}(e),v(e.atoms,-function(e,t){return C(e,t)+Math.PI/2}(e.atoms.x[e.meta.terminalNodes[1]-1],e.atoms.y[e.meta.terminalNodes[1]-1])))}(e,o),function(e,t){const s=e.atoms.x;s[e.meta.rNodes[1]-1]>s[t-1]&&function(e,t,s){const n=t-1,r=s-1,i=e.atoms.x,o=e.atoms.y,a=i[n],l=o[n];i[n]=i[r],o[n]=o[r],i[r]=a,o[r]=l}(e,t,e.meta.rNodes[1])}(e,o)}(y):e===c.RIBOSE||e===c.DEOXYRIBOSE?function(e,t){const s=e.atoms.x,n=e.atoms.y;let r=e.meta.terminalNodes[0]-1;const i=e.meta.rNodes[1]-1;A(e,-s[r],-n[r]);const o=C(s[i],n[i]);v(e.atoms,3*Math.PI/2-o),t.value=function(e){const t=e.atoms.x,s=e.atoms.y,n=e.meta.rNodes[2]-1,r=e.meta.terminalNodes[2]-1,i=t[n]-t[r],o=s[n]-s[r];return Math.atan(o/i)+Math.PI/2}(e),r=e.meta.terminalNodes[0]-1,A(e,-s[r],-n[r])}(y,r):e===c.PHOSPHATE?function(e){const t=e.meta.terminalNodes[0]-1,s=e.meta.rNodes[0]-1,n=e.atoms.x,r=e.atoms.y;A(e,-n[t],-r[t]);const i=C(n[s],r[s]);v(e.atoms,Math.PI/2-i)}(y):function(e,t){const s=e.atoms.x,n=e.atoms.y,r=e.meta.terminalNodes[0]-1,i=e.meta.rNodes[0]-1;A(e,-s[r],-n[r]);const o=C(s[i],n[i]),a=t.value;if(!a)throw new Error("The value of sugarBranchToOYAngle is null");v(e.atoms,Math.PI-o+a);const l=function(e,t){return u(Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2))}({x:s[e.meta.rNodes[0]-1],y:n[e.meta.rNodes[0]-1]},{x:s[e.meta.terminalNodes[0]-1],y:n[e.meta.terminalNodes[0]-1]});if(1!=l)for(let e=0;e<s.length;++e)s[e]=u(s[e]/l),n[e]=u(n[e]/l)}(y,r),function(e,t,s){"PEPTIDE"===e?(g(t,e),w(t,t.meta.rNodes[1])):s===c.RIBOSE||s===c.DEOXYRIBOSE?(w(t,t.meta.rNodes[1]),t.meta.rNodes[1]=t.meta.terminalNodes[1],f(t.bonds,t.meta),g(t,e),w(t,t.meta.rNodes[1]),w(t,t.meta.rNodes[0]),w(t,t.meta.rNodes[2])):s===c.PHOSPHATE&&(t.meta.terminalNodes[0]=t.meta.rNodes[0],A(t,-t.atoms.x[t.meta.terminalNodes[0]-1],-t.atoms.y[t.meta.terminalNodes[0]-1]),g(t,e),w(t,t.meta.rNodes[1]))}(n,y,e),function(e){let t=0;for(;t<e.atoms.atomTypes.length;)e.atoms.atomTypes[t]===c.HYDROGEN&&(w(e,t+1),--t),++t}(y),y}return null}(t,s,n,r,i);if(!o)throw new Error(`Monomer with symbol '${t}' is absent the monomer library`);e.set(t,o)}}function p(e,t,s,n){const r={backboneShift:null,branchShift:null,terminalNodes:[],rNodes:[]};return function(e,t,s){for(const[n,r]of s)e.atomTypes[n-1]=t[r-1]}(e,s,n),function(e,t){t.rNodes=Array.from(e.keys());for(let s=0;s<t.rNodes.length;s++)for(const n of[1,2])if(e.get(t.rNodes[s])===n){const e=t.rNodes[n-1];t.rNodes[n-1]=t.rNodes[s],t.rNodes[s]=e}}(n,r),f(t,r),r}function f(e,t){const s=t.rNodes;t.terminalNodes=new Array(s.length).fill(0);const n=t.terminalNodes,r=e.atomPairs;let i=0,o=0;for(;i<r.length&&o<n.length;){for(let e=0;e<n.length;++e)for(let t=0;t<2;++t)r[i][t]===s[e]&&(n[e]=r[i][(t+1)%2],s.length,++o);++i}}function g(e,t){e.meta.rNodes.length>1&&(e.meta.backboneShift=y(e,e.meta.rNodes[1]-1,e.meta.terminalNodes[0]-1)),"RNA"===t&&e.meta.rNodes.length>2&&(e.meta.branchShift=y(e,e.meta.rNodes[2]-1,e.meta.terminalNodes[0]-1))}function y(e,t,s){return[u(e.atoms.x[t]-e.atoms.x[s]),u(e.atoms.y[t]-e.atoms.y[s])]}function w(e,t){if(void 0!==t){const s=t-1,n=e.atoms,r=e.bonds,i=e.meta;n.atomTypes.splice(s,1),n.x=b(Float32Array,n.x,s,1),n.y=b(Float32Array,n.y,s,1),n.kwargs.splice(s,1);for(let e=0;e<i.terminalNodes.length;++e)i.terminalNodes[e]>t?--i.terminalNodes[e]:i.terminalNodes[e]===t&&(i.terminalNodes[e]=-1);for(let e=0;e<i.rNodes.length;++e)i.rNodes[e]>t?--i.rNodes[e]:i.rNodes[e]===t&&(i.rNodes[e]=-1);let o=0;for(;o<r.atomPairs.length;){const e=r.atomPairs[o][0],s=r.atomPairs[o][1];e===t||s===t?(r.atomPairs.splice(o,1),r.bondTypes=b(Uint32Array,r.bondTypes,o,1),r.bondConfiguration.has(o)&&r.bondConfiguration.delete(o),r.kwargs.has(o)&&r.kwargs.delete(o),--o):(r.atomPairs[o][0]=e>t?e-1:e,r.atomPairs[o][1]=s>t?s-1:s),++o}let a=Array.from(r.bondConfiguration.keys());a.forEach((e=>{if(r.bondConfiguration.has(e)&&e>s){const t=r.bondConfiguration.get(e);r.bondConfiguration.delete(e),r.bondConfiguration.set(e-1,t)}})),a=Array.from(r.kwargs.keys()),a.forEach((e=>{if(r.kwargs.has(e)&&e>s){const t=r.kwargs.get(e);r.kwargs.delete(e),r.kwargs.set(e-1,t)}}))}}function b(e,t,s,n){const r=new e(t.length-n);let i=0,o=0;for(;i<t.length;)i===s&&(i+=n),r[o]=t[i],++o,++i;return r}function C(e,t){let s;if(0===e)s=t>0?0:Math.PI;else if(0===t)s=e>0?-Math.PI/2:Math.PI/2;else{const n=t/e,r=Math.atan(n);s=e<0?Math.PI/2+r:-Math.PI/2+r}return s}function v(e,t){if(0!==t){const s=e.x,n=e.y,r=Math.cos(t),i=Math.sin(t);for(let e=0;e<s.length;++e){const t=s[e];s[e]=u(t*r-n[e]*i),n[e]=u(t*i+n[e]*r)}}}function T(e,t){if(t){const t=e.atoms.y;for(let e=0;e<t.length;e++)t[e]=-t[e]}else{const t=e.atoms.x;for(let e=0;e<t.length;e++)t[e]=-t[e]}const s=e.bonds.bondConfiguration;for(const[e,t]of s){const n=1===t?3:1;s.set(e,n)}}function A(e,t,s){const n=e.atoms.x,r=e.atoms.y;for(let e=0;e<n.length;++e)n[e]=u(n[e]+t),void 0!==s&&(r[e]=u(r[e]+s))}},6137:(e,t,s)=>{"use strict";s.d(t,{J:()=>r,V:()=>i});var n=s(9976);class r extends n.B{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new r({A:"green",C:"blue",G:"black",T:"red",U:"red",others:"gray"})),this.chromatogram}}class i{}i.SemType="Nucleotides",i.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",i.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"}},9976:(e,t,s)=>{"use strict";s.d(t,{B:()=>n});class n{static makePalette(e,t=!1,s=n){const r={};return e.forEach((e=>{const s=e[0],n=e[1];s.forEach(((e,s)=>{r[e]=this.colourPalette[n][t?0:s]}))})),new s(r)}constructor(e){this._palette=e}get(e){return this._palette[e]}}n.undefinedColor="rgb(100,100,100)",n.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:(e,t,s)=>{"use strict";s.d(t,{UE:()=>c,kQ:()=>o});var n=s(976),r=s(9976);class i{static hashCode(e){let t=0;if(0===e.length)return t;for(let s=0;s<e.length;s++)t=(t<<5)-t+e.charCodeAt(s),t|=0;return t}}class o{}class a extends o{get(e){return"#666666"}}class l extends o{static buildPalette(){return[].concat(...Object.values(r.B.colourPalette))}get(e){const t=i.hashCode(e)%l.palette.length;return function(e){if(null==e)return"rgb(100,100,100)";const t=n.Color.fromHtml(e),s=n.Color.g(t),r=n.Color.r(t),i=n.Color.b(t),o=Math.sqrt(Math.pow(0-r,2)+Math.pow(0-s,2)+Math.pow(0-i,2));return o>210?`rgb(${r/o*210},${s/o*210},${i/o*210})`:n.Color.toRgb(t)}(l.palette[t])}}l.palette=l.buildPalette();class c extends r.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}}},9611:(e,t,s)=>{"use strict";s.d(t,{A:()=>c});var n=s(4469),r=s(976),i=s(6414),o=s.n(i),a=s(8447);const l={DNA:"RNA",RNA:"RNA",PT:"PEPTIDE",UN:"PEPTIDE"};class c{get updated(){return this._updated}constructor(e,t,s){this.grid=e,this.col=t,this.propsProvider=s,this._monomerLengthList=null,this.separatorWidth=5,this._updated=!1,this._monomerLengthMap={},this._monomerStructureMap={},this.subs=[],this._splitter=(0,a.Mj)(this.col),this.props=this.propsProvider(),this._rowsProcessed=r.BitSet.create(this.col.length),this.grid&&(this.subs.push(t.dataFrame.onDataChanged.subscribe((()=>{try{this.props=this.propsProvider(),this._monomerLengthList=null,this._rowsProcessed=r.BitSet.create(this.col.length)}catch(e){console.error(e)}}))),this.subs.push(n.events.onViewRemoved.subscribe((e=>{try{this.grid?.view?.id===e.id&&this.destroy()}catch(e){console.error(e)}}))))}destroy(){for(const e of this.subs)e.unsubscribe()}getCellMonomerLengths(e){const t=this.props.unitsHandler.isMsa()?this.getCellMonomerLengthsForSeqMsa():this.getCellMonomerLengthsForSeq(e),s=new Array(t.length+1);s[0]=5;for(let e=1;e<s.length;e++)s[e]=s[e-1]+t[e-1];return[t,s]}getCellMonomerLengthsForSeq(e){null===this._monomerLengthList&&(this._monomerLengthList=new Array(this.col.length).fill(null),this._updated=!0);let t=this._monomerLengthList[e];if(null===t){const s=this.getSeqMonList(e);t=this._monomerLengthList[e]=new Array(s.length);for(const[e,n]of o().enumerate(s)){const s=this.props.monomerToShort(e,this.props.monomerLengthLimit),r=(this.props.unitsHandler.isSeparator()?this.separatorWidth:this.props.separatorWidth)+s.length*this.props.monomerCharWidth;t[n]=r}this._updated=!0}return t}getCellMonomerLengthsForSeqMsa(){var e;null===this._monomerLengthList&&(this._monomerLengthList=new Array(1).fill(null),this._updated=!0),(e=this._monomerLengthList)[0]??(e[0]=new Array(0));const t=this._monomerLengthList[0],{startIdx:s,endIdx:n}=(()=>{try{return this.grid&&this.grid.dart?{startIdx:Math.max(Math.floor((this.grid?.vertScroll.min??0)-10),0),endIdx:Math.min(Math.ceil((this.grid?.vertScroll.max??0)+10),this.col.length)}:{startIdx:0,endIdx:Math.min(this.col.length,10)}}catch(e){return{startIdx:0,endIdx:Math.min(this.col.length,10)}}})();for(let e=s;e<n;e++){if(this._rowsProcessed.get(e))continue;const s=this.getSeqMonList(e);s.length>t.length&&t.push(...new Array(s.length-t.length).fill(0));for(const[e,n]of o().enumerate(s)){const s=this.props.monomerToShort(e,this.props.monomerLengthLimit),r=this.props.separatorWidth+s.length*this.props.monomerCharWidth;t[n]=Math.max(t[n]??0,r)}this._updated=!0}return t}getPosition(e,t){const[s,n]=this.getCellMonomerLengths(e),r=this.col.get(e),i=o()(this._splitter(r)).toArray();if(0===i.length)return null;let a=100,l=null,c=i.length,h=!1,u=0;if(n[0]<=t&&t<n.slice(-1)[0])for(;!h;)if(u=Math.floor((c+(l??0))/2),t>=n[u]&&t<=n[u+1]?(l=u,h=!0):t<n[u]?c=u-1:t>n[u+1]&&(l=u+1),l==c&&(h=!0),--a<=0)throw new Error(`Get position for pointer x = ${t} searching has not converged on ${JSON.stringify(n)}. `);return l}getSeqMonList(e){const t=this.col.get(e);return t?o()(this._splitter(t)).toArray():[]}getMonomer(e){const t=this.props.unitsHandler.alphabet??"UN",s=l[t];return this.props.monomerLib?.getMonomer(s,e)??null}setMonomerLengthLimit(e){this.props.monomerLengthLimit=e,this._updated=!0}setSeparatorWidth(e){this.props.separatorWidth=e,this._updated=!0}isMsa(){return this.props.unitsHandler.isMsa()}}},1047:(e,t,s)=>{"use strict";s.d(t,{$3:()=>r,pU:()=>i,rx:()=>n});const n=["symbol","molfile","rgroups","name"],r="p",i=new RegExp(`[rd]\\((\\w)\\)${r}?`,"g")},7945:(e,t,s)=>{"use strict";function n(e){return"string"==typeof e||e instanceof String?e:"StateError"===e.constructor.name?e.message:"StateError"===e.constructor.name&&"$thrownJsError"in e?n(e.$thrownJsError):e instanceof Error?e.message:e.toString()}function r(e){return e instanceof Error?e.stack:"StateError"===e.constructor.name&&"$thrownJsError"in e?r(e.$thrownJsError):void 0}function i(e){return[n(e),r(e)]}s.d(t,{yf:()=>i})},5226:(e,t,s)=>{"use strict";s.d(t,{i:()=>o});var n=s(976),r=s(499),i=s(1821);class o{get descriptionsArray(){return this._descriptionsArray}get sequencesArray(){return this._sequencesArray}parseMacromolecule(e,t){return this._fileContent.slice(e,t).split(/\s/).join("")}parseColumns(){const e=/^>(.*)$/gm;let t,s=0;for(;t=e.exec(this._fileContent);){const n=this._fileContent.substring(t.index+1,e.lastIndex);this._descriptionsArray.push(n),0!==s&&this._sequencesArray.push(this.parseMacromolecule(s,t.index)),s=e.lastIndex+1}this._sequencesArray.push(this.parseMacromolecule(s,-1))}importFasta(){const e=n.Column.fromStrings("description",this.descriptionsArray),t=n.Column.fromStrings("sequence",this.sequencesArray);return t.semType=n.SEMTYPE.MACROMOLECULE,t.setTag(n.TAGS.UNITS,i.r2.FASTA),r.Cn.getOrCreate(t),[n.DataFrame.fromColumns([e,t])]}constructor(e){this._descriptionsArray=[],this._sequencesArray=[],this._fileContent=e,this.parseColumns()}}},1821:(e,t,s)=>{"use strict";s.d(t,{BM:()=>o,CI:()=>i,XS:()=>l,r2:()=>n,se:()=>a});var n,r=s(6286);!function(e){e.FASTA="fasta",e.SEPARATOR="separator",e.HELM="helm"}(n||(n={}));const i=", ",o=/(?:\[([A-Za-z0-9_\-,()]+)\])|([A-Za-z\-])/g,a=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"])}}},l=[new r.L("PT",a.fasta.peptide,.5),new r.L("DNA",a.fasta.dna,.55),new r.L("RNA",a.fasta.rna,.55)]},8447:(e,t,s)=>{"use strict";s.d(t,{CI:()=>n.CI,GU:()=>r.GU,KX:()=>r.KX,Mj:()=>r.Mj,XS:()=>n.XS,dQ:()=>r.dQ,gM:()=>r.gM,gP:()=>r.gP,kB:()=>r.kB,py:()=>r.py,r2:()=>n.r2,up:()=>r.up});var n=s(1821),r=s(8260)},6286:(e,t,s)=>{"use strict";s.d(t,{L:()=>n,d:()=>r});class n{constructor(e,t,s){this.name=e,this.alphabet=t,this.cutoff=s}}class r extends n{constructor(e,t,s){super(e.name,e.alphabet,e.cutoff),this.freq=t,this.similarity=s}}},8260:(e,t,s)=>{"use strict";s.d(t,{w4:()=>P,gM:()=>_,KX:()=>E,py:()=>x,vU:()=>v,Mj:()=>T,Ar:()=>y,jY:()=>p,GU:()=>S,dQ:()=>$,up:()=>N,kB:()=>f,FJ:()=>g,gP:()=>C});var n=s(976),r=s(6414),i=s.n(r),o=s(6286),a=s(1821),l=s(499);class c extends Float32Array{}var h=s(850),u=s(2012),d=s(6137),m=s(7331);function p(e,t,s){return e.categories,function(e,t){const s={};let n=!0,r=null;for(const i of e)if(null==r?r=i.length:i.length!==r&&(n=!1),i.length>=t)for(const e of i)e in s||(s[e]=0),s[e]+=1;return{freq:s,sameLength:n}}(i()(e.getRawData()).map((t=>s(e.categories[t]))),t)}function f(e){return i()(e.toString().matchAll(a.BM)).map((e=>e[2]??e[1])).toArray()}function g(e){return e||[]}function y(e,t=undefined){return s=>s?s.replaceAll('"-"',"").replaceAll("'-'","").split(e,t):[]}const w=/(PEPTIDE1|DNA1|RNA1)\{([^}]+)}/g,b=/\[([^\[\]]+)]/g;function C(e){w.lastIndex=0;const t=w.exec(e.toString()),s=t?t[2]:null;return(s?s.split("."):[]).map((e=>{b.lastIndex=0;const t=b.exec(e);return t&&t.length>=2?t[1]:e}))}function v(e,t,s=undefined){if(e.toLowerCase().startsWith(a.r2.FASTA))return f;if(e.toLowerCase().startsWith(a.r2.SEPARATOR))return y(t,s);if(e.toLowerCase().startsWith(a.r2.HELM))return C;throw new Error(`Unexpected units ${e} .`)}function T(e){return l.Cn.getOrCreate(e).getSplitter()}const A=/([^\W_]+)/g;function S(e,t){if(e.length<=t)return e;const s=e.match(A),n=e.length>t||(s?.length??0)>1,r=s?.[0]??" ";return n?r.substring(0,t-1)+"…":r}function _(e){switch(e){case"DNA":return a.se.fasta.dna;case"RNA":return a.se.fasta.rna;case"PT":return a.se.fasta.peptide;default:throw new Error(`Unsupported alphabet '${e}'.`)}}function E(e,t,s="-"){const n=new Set([...new Set(Object.keys(e)),...t]);n.delete(s);const r=[],i=[];for(const s of n)r.push(s in e?e[s]:0),i.push(t.has(s)?1:0);const o=new c(r),a=new c(i);return(0,h.MA)(o,a)/((0,h.$G)(o)*(0,h.$G)(a))}function P(e,t,s="-"){const n=t.map((t=>{const n=E(e,t.alphabet,s);return new o.d(t,e,n)}));let r;const i=Math.max(...n.map((e=>e.similarity>e.cutoff?e.similarity:-1)));return r=i>0?n.find((e=>e.similarity===i)).name:"UN",r}function $(e,t=5){let s;return s=e.semType==n.SEMTYPE.MACROMOLECULE?l.Cn.getOrCreate(e).alphabet:P(p(e,t,f).freq,a.XS),x(s)}function x(e){switch(e){case"PT":return u.f.GrokGroups;case"DNA":case"RNA":return d.J.Chromatogram;default:return m.UE.Color}}function N(e){const t=e.columns.bySemTypeAll(n.SEMTYPE.MACROMOLECULE);let s=t.find((e=>{const t=e.getTag(n.TAGS.UNITS);return!!t&&-1!==t.indexOf("MSA")}))??null;return!s&&t.length>0&&(s=t[0]),s}},8457:(e,t,s)=>{"use strict";s.d(t,{O:()=>a});var n=s(976),r=s(6414),i=s.n(r),o=s(8260);function a(e){const t=(0,o.Mj)(e),s=e=>{const t=l.columns.addNewString((e+1).toString());return r.push(t),t},r=[],a=e.length,l=n.DataFrame.create(a);for(let n=0;n<a;++n){const o=e.get(n);if(null==o)continue;const a=t(o);for(const[e,t]of i().enumerate(a))((r[t]??null)||s(t)).set(n,e||"-",!1)}return l}},172:(e,t,s)=>{"use strict";s.d(t,{c:()=>i});var n,r=s(7945);!function(e){e[e.error=0]="error",e[e.warning=1]="warning",e[e.info=2]="info",e[e.debug=3]="debug"}(n||(n={}));class i{constructor(e){this.logger=e,this.promise=Promise.resolve(),this.errors=[],this.syncCounter=0}sync(e,t){const s=++this.syncCounter;this.logger.debug(`${e}, SYNC syncId = ${s}, IN `),this.promise=this.promise.then((async()=>{this.logger.debug(`${e}, SYNC syncId = ${s}, START `),await t(),this.logger.debug(`${e}, SYNC syncId = ${s}, END `)})).catch((t=>{const[n,i]=(0,r.yf)(t);this.logger.error(`${e}, SYNC syncId = ${s}, ERROR:\n${n}`,void 0,i),this.errors.push(t)}))}resetErrors(){const e=this.errors;return this.errors=[],e}}},499:(e,t,s)=>{"use strict";s.d(t,{Cn:()=>m,_9:()=>d});var n=s(976),r=s(6414),i=s.n(r),o=s(8447),a=s(8260),l=s(708),c=s(7228),h=s(1047);const u=new class{constructor(){this.uh=`units-handler.${n.SEMTYPE.MACROMOLECULE}`}},d={[o.r2.FASTA]:"-",[o.r2.SEPARATOR]:"",[o.r2.HELM]:"*"};class m{static setUnitsToFastaColumn(e){if(e.column.semType!==n.SEMTYPE.MACROMOLECULE||e.column.getTag(n.TAGS.UNITS)!==o.r2.FASTA)throw new Error(`The column of notation '${o.r2.FASTA}' must be '${n.SEMTYPE.MACROMOLECULE}'.`);e.column.setTag(n.TAGS.UNITS,o.r2.FASTA),m.setTags(e)}static setUnitsToSeparatorColumn(e,t){if(e.column.semType!==n.SEMTYPE.MACROMOLECULE||e.column.getTag(n.TAGS.UNITS)!==o.r2.SEPARATOR)throw new Error(`The column of notation '${o.r2.SEPARATOR}' must be '${n.SEMTYPE.MACROMOLECULE}'.`);if(!t)throw new Error(`The column of notation '${o.r2.SEPARATOR}' must have the separator tag.`);e.column.setTag(n.TAGS.UNITS,o.r2.SEPARATOR),e.column.setTag("separator",t),m.setTags(e)}static setUnitsToHelmColumn(e){if(e.column.semType!==n.SEMTYPE.MACROMOLECULE)throw new Error(`The column of notation '${o.r2.HELM}' must be '${n.SEMTYPE.MACROMOLECULE}'`);e.column.setTag(n.TAGS.UNITS,o.r2.HELM),m.setTags(e)}static setTags(e){const t=e.column.getTag(n.TAGS.UNITS),s=e.stats;if(Object.keys(s.freq).some((e=>e.length>1)),[o.r2.FASTA,o.r2.SEPARATOR].includes(t)){if(!e.column.getTag("alphabet")&&0===Object.keys(s.freq).length)throw new Error("Alphabet is empty and not annotated.");let t=e.column.getTag("aligned");null===t&&(t=s.sameLength?"SEQ.MSA":"SEQ",e.column.setTag("aligned",t));let n=e.column.getTag("alphabet");if(null===n&&(n=(0,a.w4)(s.freq,o.XS),e.column.setTag("alphabet",n)),"UN"===n){const t=Object.keys(s.freq).length,n=Object.keys(s.freq).some((e=>e.length>1));e.column.setTag(".alphabetSize",t.toString()),e.column.setTag(".alphabetIsMultichar",n?"true":"false")}}}get column(){return this._column}get units(){return this._units}get notation(){return this._notation}get defaultGapSymbol(){return this._defaultGapSymbol}get separator(){const e=this.column.getTag("separator")??void 0;if(this.notation===o.r2.SEPARATOR&&void 0===e)throw new Error(`Separator is mandatory for column '${this.column.name}' of notation '${this.notation}'.`);return e}get aligned(){const e=this.column.getTag("aligned");if(!e&&(this.isFasta()||this.isSeparator()))throw new Error("Tag aligned not set");return e}get alphabet(){const e=this.column.getTag("alphabet");if(!e&&(this.isFasta()||this.isSeparator()))throw new Error("Tag alphabet not set");return e}get helmCompatible(){return this.column.getTag(".isHelmCompatible")}getAlphabetSize(){if(this.notation==o.r2.HELM||"UN"==this.alphabet){const e=this.column.getTag(".alphabetSize");let t;if(e)t=parseInt(e);else{const e=this.stats;t=Object.keys(e.freq).length}return t}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 this.notation===o.r2.HELM||"UN"===this.alphabet&&"true"===this.column.getTag(".alphabetIsMultichar")}get splitted(){if(null===this._splitted){const e=this.getSplitter(),t=this._column.length;this._splitted=new Array(t);const s=this._column.getRawData(),n=this._column.categories;for(let r=0;r<t;r++){const t=n[s[r]];this._splitted[r]=e(t)}}return this._splitted}get stats(){if(null===this._stats){const e={};let t=!0,s=null;for(const n of this.splitted){null==s?s=n.length:n.length!==s&&(t=!1);for(const t of n)t in e||(e[t]=0),e[t]+=1}this._stats={freq:e,sameLength:t}}return this._stats}get maxLength(){return null===this._maxLength&&(this._maxLength=0===this.splitted.length?0:Math.max(...this.splitted.map((e=>e.length)))),this._maxLength}get posList(){if(null===this._posList){const e=this.column.getTag(".positionNames");this._posList=e?e.split(o.CI).map((e=>e.trim())):i().count(1).take(this.maxLength).map((e=>e.toString())).toArray()}return this._posList}isFasta(){return this.notation===o.r2.FASTA}isSeparator(){return this.notation===o.r2.SEPARATOR}isHelm(){return this.notation===o.r2.HELM}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}isGap(e){return!e||this.units===o.r2.FASTA&&e===d[o.r2.FASTA]||this.units===o.r2.HELM&&e===d[o.r2.HELM]}getNotation(){if(this.units.toLowerCase().startsWith(o.r2.FASTA))return o.r2.FASTA;if(this.units.toLowerCase().startsWith(o.r2.SEPARATOR))return o.r2.SEPARATOR;if(this.units.toLowerCase().startsWith(o.r2.HELM))return o.r2.HELM;throw new Error(`Column '${this.column.name}' has unexpected notation '${this.units}'.`)}getHelmWrappers(){return[this.isDna()||this.isRna()||this.isHelmCompatible()?"RNA1{":"PEPTIDE1{",this.isDna()?"d(":this.isRna()?"r(":"",this.isDna()||this.isRna()?")p":"","}$$$$"]}getNewColumn(e,t,s,r){const i=this.column,a=e.toLowerCase()+"("+i.name+")",l=s??i.dataFrame.columns.getUnusedName(a),c=n.Column.fromList("string",l,r??new Array(this.column.length).fill(""));if(c.semType=n.SEMTYPE.MACROMOLECULE,c.setTag(n.TAGS.UNITS,e),e===o.r2.SEPARATOR){if(!t)throw new Error(`Notation '${o.r2.SEPARATOR}' requires separator value.`);c.setTag("separator",t)}c.setTag(n.TAGS.CELL_RENDERER,"Macromolecule");const h=i.getTag("aligned");h&&c.setTag("aligned",h);const u=i.getTag("alphabet");null!=u&&c.setTag("alphabet",u);let d=i.getTag(".alphabetSize");null!=u&&d&&c.setTag(".alphabetSize",d);const m=i.getTag(".alphabetIsMultichar");return null!=u&&void 0!==m&&c.setTag(".alphabetIsMultichar",m),e==o.r2.HELM&&(d=this.getAlphabetSize().toString(),c.setTag(".alphabetSize",d)),c}getNewColumnFromList(e,t){return this.getNewColumn(this.notation,this.separator,e,t)}static getNewColumn(e){const t=m.getOrCreate(e),s=t.notation;return t.getNewColumn(s)}static unitsStringIsValid(e){return e=e.toLowerCase(),[o.r2.FASTA,o.r2.SEPARATOR,o.r2.HELM].some((t=>e.startsWith(t.toLowerCase())))}static getNewColumnFromParams(e,t,s){if(!m.unitsStringIsValid(s))throw new Error("Invalid format of 'units' parameter");const r=n.Column.fromList("string",t,new Array(e).fill(""));return r.semType=n.SEMTYPE.MACROMOLECULE,r.setTag(n.TAGS.UNITS,s),r}getSplitter(e){if(this.units.toLowerCase().startsWith(o.r2.FASTA))return null===this.column.getTag("alphabet")||this.getAlphabetIsMultichar()?a.kB:a.FJ;if(this.units.toLowerCase().startsWith(o.r2.SEPARATOR))return(0,a.Ar)(this.separator,e);if(this.units.toLowerCase().startsWith(o.r2.HELM))return a.gP;throw new Error(`Unexpected units ${this.units} .`)}getDistanceFunctionName(){if(!this.isFasta())throw new Error("Only FASTA notation is supported");return this.isMsa()?l.U.HAMMING:(this.alphabet,l.U.LEVENSHTEIN)}getDistanceFunction(){return l.o[this.getDistanceFunctionName()]()}async checkHelmCompatibility(){if(this.column.tags.has(".isHelmCompatible"))return"true"===this.column.getTag(".isHelmCompatible");const e=(await(0,c.JN)()).getBioLib().getMonomerSymbolsByType("PEPTIDE".toString()),t=new Set(e),s=(0,a.Ar)(this.separator);for(const e of this.column.categories){const n=s(e);for(const e of n)if(!t.has(e))return this.column.setTag(".isHelmCompatible","false"),!1}return this.column.setTag(".isHelmCompatible","true"),!0}get splitter(){return null===this._splitter&&(this._splitter=(0,a.Mj)(this.column)),this._splitter}toFasta(e){return e===o.r2.FASTA}toSeparator(e){return e===o.r2.SEPARATOR}toHelm(e){return e===o.r2.HELM}convertHelmToFastaSeparator(e,t,s,n){n||(n=this.toFasta(t)?d[o.r2.FASTA]:d[o.r2.SEPARATOR]),s||(s=this.toFasta(t)?"":this.separator);const r=e.startsWith("RNA"),i=this.splitter(e),a=[];for(let e=0;e<i.length;e++){let s=i[e];if(r&&(s=s.replace(h.pU,"")),s===d[o.r2.HELM])a.push(n);else if(this.toFasta(t)&&s.length>1){const e="["+s+"]";a.push(e)}else a.push(s)}return a.join(s)}convert(e,t){const s=this.getConverter(e,t),n=this.getNewColumn(e,t);return n.init((e=>{const t=this.column.get(e);return t?s(t):t})),n}getRegion(e,t,s){const n=this.getNewColumn(this.notation,this.separator);n.name=s,Math.max(...this.splitted.map((e=>e.length)));const r=e??0,i=t??this.maxLength-1,a=this.getJoiner(),l=i-r+1;n.init((e=>{const t=this.splitted[e],s=new Array(l);for(let e=0;e<l;++e){const n=r+e;s[e]=n<t.length?t[n]:d[this.notation]}return a(s)}));const c=e=>{const t=e.split(",").map((e=>e.trim())),s=new Array(l);for(let e=0;e<l;++e){const n=r+e;s[e]=n<t.length?t[n]:"?"}return s.join(o.CI)},h=this.column.getTag(".positionNames");h&&n.setTag(".positionNames",c(h));const u=this.column.getTag(".positionLabels");return u&&n.setTag(".positionLabels",c(u)),n}getJoiner(){if(void 0===this._joiner){const e=this;if(this.notation===o.r2.FASTA)this._joiner=function(t){return p(e,t)};else if(this.notation===o.r2.SEPARATOR)this._joiner=function(t){return f(e,t,e.separator)};else{if(this.notation!==o.r2.HELM)throw new Error;{const t="DNA"===e.alphabet||"RNA"===e.alphabet;this._joiner=function(s){return g(e,s,t)}}}}return this._joiner}getConverter(e,t=undefined){if(e===o.r2.SEPARATOR&&!t)throw new Error(`Target separator is not specified for target units '${o.r2.SEPARATOR}'.`);const s=this;if(e===o.r2.FASTA)return function(e){return function(e,t){const s=e.isHelm()?y(e,t):e.getSplitter()(t);return p(e,s)}(s,e)};if(e===o.r2.HELM)return function(e){return function(e,t){const s=t.startsWith("DNA")||t.startsWith("RNA"),n=e.getSplitter()(t);return g(e,n,s)}(s,e)};if(e===o.r2.SEPARATOR)return function(e){return function(e,t,s){const n=e.isHelm()?y(e,t):e.getSplitter()(t);return f(e,n,s)}(s,e,t)};throw new Error}constructor(e){if(this._splitter=null,this._splitted=null,this._stats=null,this._maxLength=null,this._posList=null,this._joiner=void 0,e.type!==n.TYPE.STRING)throw new Error(`Unexpected column type '${e.type}', must be '${n.TYPE.STRING}'.`);this._column=e;const t=this._column.getTag(n.TAGS.UNITS);if(null==t)throw new Error("Units are not specified in column");if(this._units=t,this._notation=this.getNotation(),this._defaultGapSymbol=this.isFasta()?d[o.r2.FASTA]:this.isHelm()?d[o.r2.HELM]:d[o.r2.SEPARATOR],!this.column.tags.has("aligned")||!this.column.tags.has("alphabet")||!this.column.tags.has(".alphabetIsMultichar")&&!this.isHelm()&&"UN"===this.alphabet)if(this.isFasta())m.setUnitsToFastaColumn(this);else if(this.isSeparator()){const t=e.getTag("separator");m.setUnitsToSeparatorColumn(this,t)}else{if(!this.isHelm())throw new Error(`Unexpected units '${this.column.getTag(n.TAGS.UNITS)}'.`);m.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(e){let t=e.temp[u.uh];return t||(t=e.temp[u.uh]=new m(e)),t}}function p(e,t){const s=new Array(t.length);for(const[n,r]of i().enumerate(t)){let i=n;e.isHelm()&&(i=n.replace(h.pU,"$1")),e.isGap(i)?i=d[o.r2.FASTA]:i.length>1&&(i="["+t[r]+"]"),s[r]=i}return s.join("")}function f(e,t,s){const n=new Array(t.length);for(const[s,r]of i().enumerate(t)){let t=s;e.isGap(t)&&(t=d[o.r2.SEPARATOR]),n[r]=t}return n.map((e=>e??"")).join(s)}function g(e,t,s){const[n,r,a,l]=e.getHelmWrappers();return`${n}${i()(t).map((t=>{let n=t;return n=e.isGap(n)?d[o.r2.HELM]:s?n.replace(h.pU,"$1"):1==t.length?`${r}${t}${a}`:`${r}[${t}]${a}`,n})).toArray().join(".")}${l}`}function y(e,t){const s=e.getSplitter()(t),n=new Array(s.length),r=t.startsWith("DNA"),o=t.startsWith("RNA");for(const[e,t]of i().enumerate(s)){let s=e;(r||o)&&(s=s.replace(h.pU,"$1"),s=s===h.$3?null:s),n[t]=s}return n.filter((e=>null!==e))}},9298:(e,t,s)=>{"use strict";s.d(t,{Ct:()=>l,DX:()=>n,ES:()=>r,dE:()=>a,iD:()=>o,vS:()=>h,vw:()=>i});var n,r,i,o,a,l,c=s(976);!function(e){e.tooltipWebLogo=".tooltipWebLogo"}(n||(n={})),function(e){e.Entropy="Entropy",e.full="100%"}(r||(r={})),function(e){e.TOP="top",e.MIDDLE="middle",e.BOTTOM="bottom"}(i||(i={})),function(e){e.LEFT="left",e.CENTER="center",e.RIGHT="right"}(o||(o={})),function(e){e.AUTO="auto",e.ON="on",e.OFF="off"}(a||(a={})),function(e){e.Filtered="Filtered",e.Selected="Selected"}(l||(l={}));const h=new class{constructor(){this.sequenceColumnName=null,this.valueAggrType=c.AGG.TOTAL_COUNT,this.valueColumnName="Activity",this.startPositionName=null,this.endPositionName=null,this.skipEmptySequences=!0,this.skipEmptyPositions=!1,this.shrinkEmptyTail=!0,this.backgroundColor=4294967295,this.positionHeight=r.Entropy,this.positionWidth=16,this.verticalAlignment=i.MIDDLE,this.horizontalAlignment=o.CENTER,this.fixWidth=!1,this.fitArea=!0,this.minHeight=50,this.maxHeight=100,this.showPositionLabels=!0,this.positionMarginState=a.AUTO,this.positionMargin=0,this.filterSource=l.Filtered}}},922:(e,t,s)=>{"use strict";s.d(t,{_:()=>l});class n{constructor(e){this.init(e)}init(e){this.fileContent=e.replace(/\r/g,""),this._atomCount=void 0,this._atomTypes=void 0,this._bondCount=void 0,this._bondTypes=void 0,this.xyzAtomCoordinates=void 0,this._pairsOfBondedAtoms=void 0}get atomCount(){return void 0===this._atomCount&&this.setAtomAndBondCounts(),this._atomCount}get bondCount(){return void 0===this._bondCount&&this.setAtomAndBondCounts(),this._bondCount}get x(){var e;return null!==(e=this.xyzAtomCoordinates)&&void 0!==e||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.x}get y(){var e;return null!==(e=this.xyzAtomCoordinates)&&void 0!==e||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.y}get z(){var e;return null!==(e=this.xyzAtomCoordinates)&&void 0!==e||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.z}get atomTypes(){var e;return null!==(e=this._atomTypes)&&void 0!==e||(this._atomTypes=this.parseAtomTypes()),this._atomTypes}get pairsOfBondedAtoms(){var e;return null!==(e=this._pairsOfBondedAtoms)&&void 0!==e||(this._pairsOfBondedAtoms=this.parseBondedAtomPairs()),this._pairsOfBondedAtoms}get bondTypes(){var e;return null!==(e=this._bondTypes)&&void 0!==e||(this._bondTypes=this.parseBondTypes()),this._bondTypes}setAtomAndBondCounts(){const{atomCount:e,bondCount:t}=this.parseAtomAndBondCounts();this._atomCount=e,this._bondCount=t}getNextColumnIdx(e){for(;!this.isWhitespace(e);)++e;for(;this.isWhitespace(e);)++e;return e}shiftIdxToSpecifiedColumn(e,t){let s=e;const n=this.isWhitespace(s)?t:t-1;for(let e=0;e<n;e++)s=this.getNextColumnIdx(s);return s}parseAtomTypes(){const e=this.atomCount,t=new Array(e);let s=this.getAtomBlockIdx();for(let n=0;n<e;n++)s=this.shiftIdxToAtomType(s),t[n]=this.parseAtomType(s),s=this.getNextLineIdx(s);return t}parseAtomCoordinates(){const e=new Float32Array(this.atomCount),t=new Float32Array(this.atomCount),s=new Float32Array(this.atomCount);let n=this.getAtomBlockIdx();for(let r=0;r<this.atomCount;r++){n=this.shiftIdxToXColumn(n);for(const i of[e,t,s])i[r]=this.parseFloatValue(n),n=this.getNextColumnIdx(n);n=this.getNextLineIdx(n)}return{x:e,y:t,z:s}}parseBondedAtomPairs(){const e=new Array(this.bondCount);let t=this.getBondBlockIdx();for(let s=0;s<this.bondCount;s++){t=this.shiftIdxToBondedAtomsPair(t);const n=new Uint16Array(2);n[0]=this.parseIntValue(t),t=this.getNextColumnIdx(t),n[1]=this.parseIntValue(t),e[s]=n,t=this.getNextLineIdx(t)}return e}parseBondTypes(){const e=this.bondCount,t=new Uint16Array(e);let s=this.getBondBlockIdx();for(let n=0;n<e;n++)s=this.shiftIdxToBondType(s),t[n]=this.parseIntValue(s),s=this.getNextLineIdx(s);return t}isWhitespace(e){const t=this.fileContent[e];return" "===t||"\t"===t}getNextLineIdx(e){return"\n"!==this.fileContent[e]?this.fileContent.indexOf("\n",e)+1:e+1}parseFloatValue(e){return this.parseNumericValue(parseFloat,e)}parseIntValue(e){return this.parseNumericValue(parseInt,e)}parseNumericValue(e,t){let s=t+1;for(;!this.isWhitespace(s);)++s;return e(this.fileContent.substring(t,s))}}class r extends n{constructor(e){super(e),this.init(e)}init(e){super.init(e)}parseAtomType(e){let t=e,s=t;return this.isQuote(t)?(s=this.getNextIdenticalChar(t),t++):s=this.fileContent.indexOf(" ",s),this.fileContent.substring(t,s)}isQuote(e){const t=this.fileContent[e].charCodeAt(0);return 39===t||34===t}getNextIdenticalChar(e){const t=this.fileContent[e];return t?this.fileContent.indexOf(t,e+1):-1}isQuery(){return this.isQueryOrFragment(((e,t)=>{return 39===e||34===e||76===e&&!((s=this.fileContent.charCodeAt(t+1))>64&&s<91||s>96&&s<123);var s}))}isFragment(){return this.isQueryOrFragment((e=>82===e||42===e))}isQueryOrFragment(e){const t=this.atomCount;let s=this.getAtomBlockIdx();for(let n=0;n<t;n++){if(s=this.shiftIdxToAtomType(s),e(this.fileContent.charCodeAt(s),s))return!0;s=this.getNextLineIdx(s)}return!1}}var i;!function(e){e.HEADER="V2000",e[e.NUM_OF_HEADER_LINES=3]="NUM_OF_HEADER_LINES",e[e.NUM_OF_COUNTS_DIGITS=3]="NUM_OF_COUNTS_DIGITS",e[e.ATOM_TYPE_COL=4]="ATOM_TYPE_COL",e[e.FIRST_BONDED_ATOM_COL=1]="FIRST_BONDED_ATOM_COL",e[e.BOND_TYPE_COL=3]="BOND_TYPE_COL",e[e.RGP_SHIFT=8]="RGP_SHIFT",e.RGP_LINE="M RGP",e.A_LINE="A ",e.END="M END"}(i||(i={}));class o extends r{constructor(e){super(e)}static validate(e){return-1!==e.indexOf(i.HEADER)&&-1!==e.indexOf(i.END)}shiftIdxToAtomType(e){return this.shiftIdxToSpecifiedColumn(e,i.ATOM_TYPE_COL)}getCountsLineIdx(){let e=0;for(let t=0;t<i.NUM_OF_HEADER_LINES;++t)e=this.getNextLineIdx(e);return e}getAtomBlockIdx(){let e=this.getCountsLineIdx();return e=this.getNextLineIdx(e),e}shiftIdxToXColumn(e){return this.getNextColumnIdx(e)}shiftIdxToBondedAtomsPair(e){return this.shiftIdxToSpecifiedColumn(e,i.FIRST_BONDED_ATOM_COL)}shiftIdxToBondType(e){return this.shiftIdxToSpecifiedColumn(e,i.BOND_TYPE_COL)}getBondBlockIdx(){let e=this.getAtomBlockIdx();for(let t=0;t<this.atomCount;t++)e=this.getNextLineIdx(e);return e}parseAtomAndBondCounts(){let e=this.getCountsLineIdx(),t=e+i.NUM_OF_COUNTS_DIGITS;const s=parseInt(this.fileContent.substring(e,t));return e=t,t+=i.NUM_OF_COUNTS_DIGITS,{atomCount:s,bondCount:parseInt(this.fileContent.substring(e,t))}}}class a extends r{constructor(e){super(e),this.init(e)}shiftIdxToAtomType(e){return this.shiftIdxToSpecifiedColumn(e,4)}getCountsLineIdx(){return this.fileContent.indexOf("M V30 COUNTS ")}getAtomBlockIdx(){let e=this.fileContent.indexOf("M V30 BEGIN ATOM");return e=this.getNextLineIdx(e),e}shiftIdxToXColumn(e){let t=this.shiftIdxToAtomType(e);return this.isQuote(t)?(t=this.getNextIdenticalChar(t),t=this.getNextColumnIdx(t),t):this.shiftIdxToSpecifiedColumn(e,5)}shiftIdxToBondedAtomsPair(e){return this.shiftIdxToSpecifiedColumn(e,5)}shiftIdxToBondType(e){return this.shiftIdxToSpecifiedColumn(e,4)}getBondBlockIdx(){return this.getNextLineIdx(this.fileContent.indexOf("M V30 BEGIN BOND"))}static validate(e){return-1!==e.indexOf("V3000")&&-1!==e.indexOf("M END")}parseAtomAndBondCounts(){let e=this.fileContent.indexOf("M V30 COUNTS ")+14,t=this.fileContent.indexOf(" ",e+1);const s=parseInt(this.fileContent.substring(e,t));return e=t+1,t=this.fileContent.indexOf(" ",e+1),{atomCount:s,bondCount:parseInt(this.fileContent.substring(e,t))}}}class l{constructor(){}static getInstance(e){if(o.validate(e))return new o(e);if(a.validate(e))return new a(e);throw new Error("Malformed molfile")}}},7905:(e,t,s)=>{"use strict";e=s.hmd(e);var n,r=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e={}){var t,s,r=void 0!==e?e:{};r.ready=new Promise((function(e,n){t=e,s=n}));var i,o=Object.assign({},r),a="object"==typeof window,l="function"==typeof importScripts,c=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(a||l)&&(l?c=self.location.href:"undefined"!=typeof document&&document.currentScript&&(c=document.currentScript.src),n&&(c=n),c=0!==c.indexOf("blob:")?c.substr(0,c.replace(/[?#].*/,"").lastIndexOf("/")+1):"",l&&(i=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)})),r.print||console.log.bind(console);var h,u,d=r.printErr||console.warn.bind(console);Object.assign(r,o),o=null,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.quit&&r.quit,r.wasmBinary&&(h=r.wasmBinary),r.noExitRuntime,"object"!=typeof WebAssembly&&S("no native wasm support detected");var m,p,f,g=!1;function y(){var e=u.buffer;r.HEAP8=m=new Int8Array(e),r.HEAP16=new Int16Array(e),r.HEAP32=new Int32Array(e),r.HEAPU8=p=new Uint8Array(e),r.HEAPU16=new Uint16Array(e),r.HEAPU32=f=new Uint32Array(e),r.HEAPF32=new Float32Array(e),r.HEAPF64=new Float64Array(e)}var w=[],b=[],C=[],v=0,T=null,A=null;function S(e){r.onAbort&&r.onAbort(e),d(e="Aborted("+e+")"),g=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw s(t),t}var _,E,P="data:application/octet-stream;base64,";function $(e){return e.startsWith(P)}function x(e){try{if(e==_&&h)return new Uint8Array(h);if(i)return i(e);throw"both async and sync fetching of the wasm failed"}catch(e){S(e)}}function N(e,t,s){return function(e){return h||!a&&!l||"function"!=typeof fetch?Promise.resolve().then((function(){return x(e)})):fetch(e,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((function(){return x(e)}))}(e).then((function(e){return WebAssembly.instantiate(e,t)})).then((function(e){return e})).then(s,(function(e){d("failed to asynchronously prepare wasm: "+e),S(e)}))}function M(e){for(;e.length>0;)e.shift()(r)}function L(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){f[this.ptr+4>>2]=e},this.get_type=function(){return f[this.ptr+4>>2]},this.set_destructor=function(e){f[this.ptr+8>>2]=e},this.get_destructor=function(){return f[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,m[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=m[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,m[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=m[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){f[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return f[this.ptr+16>>2]},this.get_exception_ptr=function(){if(B(this.get_type()))return f[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}function I(e){var t=u.buffer;try{return u.grow(e-t.byteLength+65535>>>16),y(),1}catch(e){}}function R(e){return r["_"+e]}$(_="wasmDbscan.wasm")||(E=_,_=r.locateFile?r.locateFile(E,c):c+E);var O="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function k(e,t,s,n,r){var i={string:e=>{var t=0;return null!=e&&0!==e&&(t=function(e){var t=function(e){for(var t=0,s=0;s<e.length;++s){var n=e.charCodeAt(s);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++s):t+=3}return t}(e)+1,s=W(t);return function(e,t,s){!function(e,t,s,n){if(!(n>0))return 0;for(var r=s+n-1,i=0;i<e.length;++i){var o=e.charCodeAt(i);if(o>=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++i)),o<=127){if(s>=r)break;t[s++]=o}else if(o<=2047){if(s+1>=r)break;t[s++]=192|o>>6,t[s++]=128|63&o}else if(o<=65535){if(s+2>=r)break;t[s++]=224|o>>12,t[s++]=128|o>>6&63,t[s++]=128|63&o}else{if(s+3>=r)break;t[s++]=240|o>>18,t[s++]=128|o>>12&63,t[s++]=128|o>>6&63,t[s++]=128|63&o}}t[s]=0}(e,p,t,s)}(e,s,t),s}(e)),t},array:e=>{var t,s,n=W(e.length);return t=e,s=n,m.set(t,s),n}},o=R(e),a=[],l=0;if(n)for(var c=0;c<n.length;c++){var h=i[s[c]];h?(0===l&&(l=G()),a[c]=h(n[c])):a[c]=n[c]}var u=o.apply(null,a);return function(e){return 0!==l&&H(l),function(e){return"string"===t?(s=e)?function(e,t,s){for(var n=t+s,r=t;e[r]&&!(r>=n);)++r;if(r-t>16&&e.buffer&&O)return O.decode(e.subarray(t,r));for(var i="";t<r;){var o=e[t++];if(128&o){var a=63&e[t++];if(192!=(224&o)){var l=63&e[t++];if((o=224==(240&o)?(15&o)<<12|a<<6|l:(7&o)<<18|a<<12|l<<6|63&e[t++])<65536)i+=String.fromCharCode(o);else{var c=o-65536;i+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else i+=String.fromCharCode((31&o)<<6|a)}else i+=String.fromCharCode(o)}return i}(p,s,n):"":"boolean"===t?Boolean(e):e;var s,n}(e)}(u)}var F,D={__cxa_throw:function(e,t,s){throw new L(e).init(t,s),e},abort:function(){S("")},emscripten_memcpy_big:function(e,t,s){p.copyWithin(e,t,t+s)},emscripten_resize_heap:function(e){var t,s=p.length,n=2147483648;if((e>>>=0)>n)return!1;for(var r=1;r<=4;r*=2){var i=s*(1+.2/r);if(i=Math.min(i,e+100663296),I(Math.min(n,(t=Math.max(e,i))+(65536-t%65536)%65536)))return!0}return!1}},G=(function(){var e,t,n,i,o={env:D,wasi_snapshot_preview1:D};function a(e,t){var s,n=e.exports;return r.asm=n,u=r.asm.memory,y(),r.asm.__indirect_function_table,s=r.asm.__wasm_call_ctors,b.unshift(s),function(e){if(v--,r.monitorRunDependencies&&r.monitorRunDependencies(v),0==v&&(null!==T&&(clearInterval(T),T=null),A)){var t=A;A=null,t()}}(),n}if(v++,r.monitorRunDependencies&&r.monitorRunDependencies(v),r.instantiateWasm)try{return r.instantiateWasm(o,a)}catch(e){d("Module.instantiateWasm callback failed with error: "+e),s(e)}(e=h,t=_,n=o,i=function(e){a(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||$(t)||"function"!=typeof fetch?N(t,n,i):fetch(t,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,n).then(i,(function(e){return d("wasm streaming compile failed: "+e),d("falling back to ArrayBuffer instantiation"),N(t,n,i)}))}))).catch(s)}(),r._dbscan=function(){return(r._dbscan=r.asm.dbscan).apply(null,arguments)},r._malloc=function(){return(r._malloc=r.asm.malloc).apply(null,arguments)},r._free=function(){return(r._free=r.asm.free).apply(null,arguments)},function(){return(G=r.asm.stackSave).apply(null,arguments)}),H=function(){return(H=r.asm.stackRestore).apply(null,arguments)},W=function(){return(W=r.asm.stackAlloc).apply(null,arguments)},B=function(){return(B=r.asm.__cxa_is_pointer_type).apply(null,arguments)};function V(){function e(){F||(F=!0,r.calledRun=!0,g||(M(b),t(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),function(){if(r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;)e=r.postRun.shift(),C.unshift(e);var e;M(C)}()))}v>0||(function(){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)e=r.preRun.shift(),w.unshift(e);var e;M(w)}(),v>0||(r.setStatus?(r.setStatus("Running..."),setTimeout((function(){setTimeout((function(){r.setStatus("")}),1),e()}),1)):e()))}if(r.ccall=k,r.cwrap=function(e,t,s,n){var r=!s||s.every((e=>"number"===e||"boolean"===e));return"string"!==t&&r&&!n?R(e):function(){return k(e,t,s,arguments)}},A=function e(){F||V(),F||(A=e)},r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return V(),e.ready});"object"==typeof exports?e.exports=r:"function"==typeof define&&s.amdO?define([],(function(){return r})):"object"==typeof exports&&(exports.exportCppDbscanLib=r)},5697:(e,t,s)=>{"use strict";s.d(t,{Dz:()=>w,FV:()=>c,KR:()=>l,MI:()=>C,NB:()=>p,UX:()=>m,WI:()=>d,Zd:()=>u,_h:()=>h,aW:()=>g,bX:()=>T,fX:()=>b,kg:()=>o,s:()=>f,yU:()=>y});var n=s(9657),r=s(1040),i=s(708);r.gk.Tanimoto,r.gk.Dice,r.gk.Asymmetric,r.gk.BraunBlanquet,r.gk.Cosine,r.gk.Kulczynski,r.gk.McConnaughey,r.gk.RogotGoldberg,r.gk.Russel,r.gk.Sokal,r.gk.Hamming,r.gk.Euclidean,r.gk.Tanimoto,r.gk.Dice,r.gk.Asymmetric,r.gk.BraunBlanquet,r.gk.Cosine,r.gk.Kulczynski,r.gk.McConnaughey,r.gk.RogotGoldberg,r.gk.Russel,r.gk.Sokal,r.gk.Hamming,r.gk.Euclidean;const o=[r.gk.Tanimoto,r.gk.Dice,r.gk.Cosine];function a(e,t){const s=e.trueCount()+t.trueCount();if(0==s)return 1;const n=e.andWithCountBits(t,!0);return n/(s-n)}function l(e,t){return 1-a(e,t)}function c(e,t){return v(a(new n.Z(e,32*e.length),new n.Z(t,32*t.length)))}function h(e,t){return 1-function(e,t){const s=e.trueCount()+t.trueCount();return 0==s?0:2*e.andWithCountBits(t,!0)/s}(e,t)}function u(e,t){return 1-function(e,t){const s=e.trueCount()*t.trueCount();return 0==s?0:e.andWithCountBits(t,!0)/Math.sqrt(s)}(e,t)}function d(e,t){return Math.sqrt(e.trueCount()+t.trueCount()-2*e.andWithCountBits(t,!0))}function m(e,t){return e.trueCount()+t.trueCount()-2*e.andWithCountBits(t,!0)}function p(e,t){return 1-function(e,t){const s=e.trueCount()+t.trueCount(),n=e.andWithCountBits(t,!0);return n/(2*s-3*n)}(e,t)}function f(e,t){return v(function(e,t){const s=e.trueCount()+t.trueCount(),n=e.trueCount()*t.trueCount();return 0==n?0:e.andWithCountBits(t,!0)*s/(2*n)}(e,t))}function g(e,t){return v(function(e,t){const s=e.trueCount()+t.trueCount(),n=e.trueCount()*t.trueCount();return 0==n?0:(e.andWithCountBits(t,!0)*s-n)/n}(e,t))}function y(e,t){return 1-function(e,t){const s=Math.min(e.trueCount(),t.trueCount());return 0==s?0:e.andWithCountBits(t,!0)/s}(e,t)}function w(e,t){return v(function(e,t){const s=Math.max(e.trueCount(),t.trueCount());return 0==s?0:e.andWithCountBits(t,!0)/s}(e,t))}function b(e,t){return v(function(e,t){return 0==e.length?0:e.andWithCountBits(t,!0)/e.length}(e,t))}function C(e,t){return v(function(e,t){const s=e.andWithCountBits(t,!0),n=e.countBits(!0)+t.countBits(!0),r=e.length,i=r-n+s;return s==r||i==r?1:s/n+i/(2*r-n)}(e,t))}function v(e){return 0===e?3402823e32:1/e-1}function T(e){if(e&&null!=e.range&&e.range>0){const t=e.range;return(e,s)=>Math.abs(e-s)/t}return(e,t)=>Math.abs(e-t)}r.gk.Tanimoto,r.gk.Asymmetric,r.gk.Cosine,r.gk.Sokal,i.U.HAMMING,i.U.LEVENSHTEIN,i.U.MONOMER_CHEMICAL_DISTANCE,i.U.NEEDLEMANN_WUNSCH},3277:(e,t,s)=>{"use strict";s.d(t,{Ec:()=>r,sS:()=>n});const n="bypassLargeDataWarning",r="show-scatterplot-progress"},708:(e,t,s)=>{"use strict";function n(e={}){const t=function(){if(!e||!e.scoringMatrix||!e.alphabetIndexes)return(e,t)=>e===t?0:1;if(e.scoringMatrix.length!==Object.keys(e.alphabetIndexes).length)throw new Error("Scoring matrix and alphabet indexes should have the same length");const t=e.alphabetIndexes,s=e.scoringMatrix,n=Math.min(...Object.keys(t).map((e=>e.charCodeAt(0))))+1,r=new Float32Array((s.length+n)*(s.length+n));return Object.entries(t).forEach((([e,n])=>{const i=s[n];Object.entries(t).forEach((([t,n])=>{r[e.charCodeAt(0)*s.length+t.charCodeAt(0)]=i[n]}))})),(e,t)=>r[e.charCodeAt(0)*s.length+t.charCodeAt(0)]}(),s=e?.threshold??0;return(e,n)=>{let r=0;const i=e.length,o=n.length,a=Math.max(i,o)*(1-s);i!==o&&(r=Math.abs(i-o));let l=0;for(let s=0;s<Math.min(i,o);s++)if(e[s]!==n[s]&&(l+=t(e[s],n[s]),l>a))return 1;return l+=r,l/=Math.max(i,o),l}}s.d(t,{U:()=>o,o:()=>a});var r=s(1811);const i={gapOpen:1,gapExtend:.6,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,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1,-4],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1,-4],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1,-4],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1,-4],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1,-4],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2,-4],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0,-4],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0,-4],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2,-4],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-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}};var o;!function(e){e.HAMMING="Hamming",e.LEVENSHTEIN="Levenshtein",e.NEEDLEMANN_WUNSCH="Needlemann-Wunsch",e.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance"}(o||(o={}));const a={[o.HAMMING]:n,[o.LEVENSHTEIN]:function(){return(e,t)=>(0,r.T)(e,t)/Math.max(e.length,t.length)},[o.NEEDLEMANN_WUNSCH]:function(e){const t=new Uint16Array(65536),{gapOpen:s,gapExtend:n,scoringMatrix:r,alphabetIndexes:o}={...i,...e};Object.entries(o).forEach((([e,s])=>t[e.charCodeAt(0)]=s));const a=[new Float32Array(1e4),new Float32Array(1e4)];return(e,i)=>{const o=new Array(e.length+1).fill(!1),l=new Array(e.length+1).fill(!1);let c=0,h=1;for(let t=1;t<e.length+1;t++)a[0][t]=-s-(t-1)*n,a[1][t]=0;a[0][0]=0;for(let u=1;u<i.length+1;u++){a[h][0]=-s-(u-1)*n;for(let d=1;d<e.length+1;d++){const m=a[c][d-1]+r[t[e.charCodeAt(d-1)]][t[i.charCodeAt(u-1)]],p=a[c][d]-(o[d]?n:s),f=a[h][d-1]-(l[d-1]?n:s);a[h][d]=Math.max(m,f,p),a[h][d]===m?(o[d]=!1,l[d]=!1):a[h][d]===f?(o[d]=!1,l[d]=!0):(o[d]=!0,l[d]=!1)}c=h,h=(h+1)%2}const u=Math.max(e.length,i.length);return(u-a[c][e.length])/u}},[o.MONOMER_CHEMICAL_DISTANCE]:n}},4628:(e,t,s)=>{"use strict";var n;s.d(t,{A:()=>n}),function(e){e.UMAP="UMAP",e.T_SNE="t-SNE"}(n||(n={}))},1040:(e,t,s)=>{"use strict";var n,r,i,o,a,l;s.d(t,{CF:()=>r,Qe:()=>a,W:()=>n,Yc:()=>l,gd:()=>o,gk:()=>i}),function(e){e.Levenshtein="Levenshtein",e.JaroWinkler="Jaro-Winkler",e.Manhattan="Manhattan",e.Onehot="One-Hot"}(n||(n={})),function(e){e.Euclidean="Euclidean"}(r||(r={})),function(e){e.Tanimoto="Tanimoto",e.Dice="Dice",e.Asymmetric="Asymmetric",e.BraunBlanquet="Braun-Blanquet",e.Cosine="Cosine",e.Kulczynski="Kulczynski",e.McConnaughey="Mc-Connaughey",e.RogotGoldberg="Rogot-Goldberg",e.Russel="Russel",e.Sokal="Sokal",e.Hamming="Hamming",e.Euclidean="Euclidean"}(i||(i={})),function(e){e.TanimotoIntArray="TanimotoIntArray"}(o||(o={})),function(e){e.Vector="Vector",e.String="String",e.BitArray="BitArray",e.MacroMolecule="MacroMolecule",e.Number="Number",e.IntArray="IntArray"}(a||(a={})),function(e){e.Difference="Difference"}(l||(l={}))},6361:(e,t,s)=>{"use strict";s.d(t,{gk:()=>n.gk});var n=s(1040);s(7861)},7861:(e,t,s)=>{"use strict";var n=s(1811),r=s(3979),i=s(5697),o=s(850),a=s(708),l=s(1040);const c={[l.CF.Euclidean]:o.dP},h={[l.W.Levenshtein]:n.T,[l.W.JaroWinkler]:r.H$,[l.W.Manhattan]:function(e,t){if(e.length!==t.length)return 1;{let s=0;for(let n=1;n<e.length;n++)s+=e[n]==t[n]?0:1;return s/e.length}},[l.W.Onehot]:function(e,t){return e===t?0:1}},u={[l.gk.Tanimoto]:i.KR,[l.gk.Dice]:i._h,[l.gk.Asymmetric]:i.yU,[l.gk.BraunBlanquet]:i.Dz,[l.gk.Cosine]:i.Zd,[l.gk.Kulczynski]:i.s,[l.gk.McConnaughey]:i.aW,[l.gk.RogotGoldberg]:i.MI,[l.gk.Russel]:i.fX,[l.gk.Sokal]:i.NB,[l.gk.Hamming]:i.UX,[l.gk.Euclidean]:i.WI},d={[l.gd.TanimotoIntArray]:i.FV},m={[l.Yc.Difference]:i.bX},p={[l.Qe.Vector]:{[l.CF.Euclidean]:c[l.CF.Euclidean]},[l.Qe.String]:{[l.W.Levenshtein]:h[l.W.Levenshtein],[l.W.JaroWinkler]:h[l.W.JaroWinkler],[l.W.Manhattan]:h[l.W.Manhattan],[l.W.Onehot]:h[l.W.Onehot]},[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],[a.U.MONOMER_CHEMICAL_DISTANCE]:a.o[a.U.MONOMER_CHEMICAL_DISTANCE]},[l.Qe.Number]:{[l.Yc.Difference]:m[l.Yc.Difference]},[l.Qe.IntArray]:{[l.gd.TanimotoIntArray]:d[l.gd.TanimotoIntArray]}};Object.keys(p).reduce(((e,t)=>{for(const s of Object.keys(p[t]))e[s]=t;return e}),{})},9657:(e,t,s)=>{"use strict";s.d(t,{Z:()=>n});class n{constructor(e,t=!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 e){const s=e,r=n._createBuffer(s);if(t)for(let e=0;e<r.length;e++)r[e]=-1;this._data=r,this._length=s}else{if(!(e instanceof Uint32Array))throw new Error("Invalid constructor");this._data=e,this._length=t}}getRawData(){return this._data}assureGoez(e,t){if(e<0)throw new Error(`${t} should be greater than zero`)}assureInRange(e,t,s,n){if(e<t||e>s)throw new Error(`Argument ${n} (${e}) out of range (${t}, ${s})`)}copy(e,t,s){for(let n=0;n<s;n++)t[n]=e[n]}copyFrom(e){if(this._length!=e._length)throw new Error(`Lengths differ (${this._length} != ${e._length})`);this.copy(e._data,this._data,this.lengthInInts),this._version++}get length(){return this._length}get buffer(){return this._data}set buffer(e){this._data=e,this._version++}get version(){return this._version}set version(e){this._version=e}incrementVersion(e=!0){this._version++}get lengthInInts(){return Math.floor((this._length+31)/32)}get versionedName(){return this._version==this._versionedNameVersion?this._versionedName:""}set versionedName(e){this._versionedName=e,this._versionedNameVersion=this._version}get self(){return this}setLength(e){if(e<0)throw new Error("should be >= 0");if(e==this._length)return;const t=Math.floor((e+31)/32);if(t>this._data.length||t+this.SHRINK_THRESHOLD<this._data.length){const e=new Uint32Array(t);this.copy(this._data,e,t>this._data.length?this._data.length:t),this._data=e}e>this._length&&(this._length%32>0&&(this._data[this.lengthInInts-1]&=(1<<(this._length%32&31))-1),this._data.fill(0,this.lengthInInts,t)),this._length=e,this._version++}static fromAnd(e,t){if(e._length!=t._length)throw new Error(`Lengths differ (${e._length} != ${t._length})`);const s=new n(e._length);s._length=e._length,s._data=n._createBuffer(s._length),s._version=0;const r=e.lengthInInts;for(let n=0;n<r;n++)s._data[n]=e._data[n]&t._data[n];return s}static _createBuffer(e){return new Uint32Array(Math.floor((e+31)/32))}static fromValues(e){const t=new n(e.length);t._version=0;for(let s=0;s<t._length;s++)e[s]&&(t._data[Math.floor(s/32)]|=1<<(s%32&31));return t}static fromSeq(e,t){const s=new n(e);for(let n=0;n<e;++n)s.setBit(n,t(n));return s._version=0,s}static fromString(e){return n.fromSeq(e.length,(t=>"1"==e.charAt(t)))}static fromUint32Array(e,t){const s=new n(e);return s._data=t,s}static fromBytes(e){const t=e.length,s=new n(8*t);s._data=new Uint32Array(Math.floor((t+3)/4)),s._length=8*t;let r=0,i=0;for(;t-i>=4;)s._data[r++]=255&e[i]|(255&e[i+1])<<8|(255&e[i+2])<<16|(255&e[i+3])<<24,i+=4;return t-i==3&&(s._data[r]=(255&e[i+2])<<16),t-i==2&&(s._data[r]|=(255&e[i+1])<<8),t-i==1&&(s._data[r]|=255&e[i]),s._version=0,s}toString(){return`${this._length} bits, ${this.countBits(!0)} set`}equals(e){if(this==e)return!0;if(null==e)return!1;if(this._length!=e._length)return!1;if(0==this._length)return!0;for(let t=0;t<this._data.length-1;t++)if(this._data[t]!=e._data[t])return!1;for(let t=8*(this._data.length-1);t<this._length;t++)if(this.getBit(t)!=e.getBit(t))return!1;return!0}clone(){const e=new n(0,!1);return e._data=Uint32Array.from(this._data),e._length=this._length,e._version=this._version,e}init(e,t){this.setAll(!1,!1);for(let t=0;t<this._length;t++)e(t)&&(this._data[Math.floor(t/32)]|=1<<(t%32&31));return this.incrementVersion(t),this}invert(e=!0){for(let e=0;e<this._data.length;e++)this._data[e]^=-1;this.incrementVersion(e)}setAll(e,t=!1){const s=e?-1:0,n=this.lengthInInts;for(let e=0;e<n;e++)this._data[e]=s;this.incrementVersion(t)}setIndexes(e,t=!0,s=!0,n=!0){s&&this.setAll(!t,!1);for(const s of e)this.setFast(s,t);this.incrementVersion(n)}everyIndex(e,t=!0){for(const s of e)if(this.getBit(s)!=t)return!1;return!0}anyIndex(e,t=!0){for(const s of e)if(this.getBit(s)==t)return!0;return!1}setWhere(e,t=!0,s=!0,n=!0,r=!0){if(s&&r&&this.setAll(!t,!1),r)for(let s=0;s<this._length;s++)e(s)&&this.setFast(s,t);else for(let s=0;s<this._length;s++)this.setFast(s,e(s)?t:!t);this.incrementVersion(n)}getRange(e,t){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length,"to");const s=[];for(let n=e;n<t;++n)s.push(this.getBit(n));return n.fromValues(s)}getRangeAsList(e,t){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length,"to");const s=[];for(let n=e;n<t;++n)s.push(this.getBit(n));return s}setRange(e,t,s,n=!0){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length-1,"to");const r=Math.min(e,t),i=Math.max(e,t);if(s)for(let e=r;e<=i;e++)this.setTrue(e);else for(let e=r;e<=i;e++)this.setFalse(e);return this.incrementVersion(n),this}setRandom(e,t,s=!0){if(e<0||e>this._length)throw new Error("n must be >= 0 && <= Count");e>this._length/2&&this.setRandom(this._length-e,!t),this.setAll(!t);for(let s=0;s<e;){const e=Math.floor(Math.random()*this._length);this.getBit(e)!=t&&(this.setFast(e,t),s++)}this.incrementVersion(s)}and(e,t=!0){if(this._length!=e._length)throw new Error("Array lengths differ.");for(let t=0,s=this.lengthInInts;t<s;t++)this._data[t]&=e._data[t];return this.incrementVersion(t),this}andNot(e,t=!0){if(this._length!=e._length)throw new Error("Array lengths differ.");const s=this.lengthInInts;for(let t=0;t<s;t++)this._data[t]&=~e._data[t];return this.incrementVersion(t),this}notAnd(e,t=!0){if(this._length!=e._length)throw new Error("Array lengths differ.");for(let t=0,s=this.lengthInInts;t<s;t++)this._data[t]=~this._data[t]&e._data[t];return this.incrementVersion(t),this}not(e=!0){for(let e=0,t=this.lengthInInts;e<t;e++)this._data[e]=~this._data[e];return this.incrementVersion(e),this}or(e,t=!0){if(this._length!=e._length)throw new Error("Array lengths differ.");for(let t=0,s=this.lengthInInts;t<s;t++)this._data[t]|=e._data[t];return this.incrementVersion(t),this}xor(e,t=!0){if(this._length!=e._length)throw new Error("Array lengths differ.");for(let t=0,s=this.lengthInInts;t<s;t++)this._data[t]^=e._data[t];return this.incrementVersion(t),this}insertAt(e,t,s=!1){if(this.assureInRange(e,0,this._length,"pos"),0==t)return;const n=this._length;this.setLength(this._length+t);for(let s=n-1;s>=e;s--)this.setBit(s+t,this.getBit(s));for(let n=e;n<e+t;n++)this.setBit(n,s)}removeAt(e,t=1){if(t<0)throw new Error("n cannot be negative");if(this.assureInRange(e,0,this._length-t,"pos"),this.contains(!0))for(let s=e;s<this._length-t;s++)this.setBit(s,this.getBit(s+t));this.setLength(this._length-t)}removeByMask(e,t=!0){if(this._length!=e.length)throw new Error("length != mask.length");if(e==this)this.setLength(e.countBits(!t)),this.setAll(!t);else{let s=0;for(let n=-1;-1!=(n=e.findNext(n,!t));)this.setFast(s++,this.getBit(n));this._length=s,this._version++}return this}getBit(e){return 0!=(this._data[Math.floor(e/32)]&1<<(31&e))}setBit(e,t,s=!0){this.setFast(e,t),this._version++}setFast(e,t){t?this._data[Math.floor(e/32)]|=1<<(31&e):this._data[Math.floor(e/32)]&=~(1<<(31&e))}setTrue(e){this._data[Math.floor(e/32)]|=1<<(31&e)}setFalse(e){this._data[Math.floor(e/32)]&=~(1<<(31&e))}trueCount(){return this.countBits(!0)}falseCount(){return this.countBits(!1)}countBits(e){if(0==this._length)return 0;if(this._selectedCountVersion!=this._version){this._selectedCount=0;const e=this.lengthInInts;let t=0;for(;t<e-1;t++)for(let e=this._data[t];0!=e;e>>>=8)this._selectedCount+=n._onBitCount[255&e];let s=this._data[t];const r=31&this._length;for(0!=r&&(s&=~(4294967295<<r));0!=s;s>>>=8)this._selectedCount+=n._onBitCount[255&s];this._selectedCountVersion=this._version}return e?this._selectedCount:this._length-this._selectedCount}countWhere(e){let t=0;if(this.trueCount()==this._length)for(let s=0;s<this._length;s++)t+=e(s)?1:0;else for(let s=-1;-1!=(s=this.findNext(s,!0));)t+=e(s)?1:0;return t}andWithCountBits(e,t){if(0==this._length)return 0;let s=0;const r=this.lengthInInts;let i=0;for(;i<r-1;i++)for(let t=this._data[i]&e._data[i];0!=t;t>>>=8)s+=n._onBitCount[255&t];let o=this._data[i]&e._data[i];const a=31&this._length;for(0!=a&&(o&=~(4294967295<<a));0!=o;o>>>=8)s+=n._onBitCount[255&o];return t?s:this._length-s}clear(){this.setLength(0)}contains(e){return this.findNext(-1,e)>=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(e,t=!0){if(this.assureInRange(e,-1,this._length,"index"),e>=this._length-1)return-1;let s=31&(e=e<0?0:e+1);const r=this.lengthInInts;for(let i=Math.floor(e/32);i<r;i++){let r=t?this._data[i]:~this._data[i];if(0!=s)r&=4294967295<<s&4294967295,s=0;else if(!t&&-4294967296==r)continue;for(let t=0;0!=r;t+=8,r>>>=8){const s=n._firstOnBit[255&r];if(s>=0)return(e=s+32*i+t)>=this._length?-1:e}}return-1}findPrev(e,t=!0){if(0==e)return-1;this.assureInRange(e,-1,this._length,"index");let s=1+(e=e<0?this._length-1:e-1)&31;for(let r=Math.floor(e/32);r>=0;r--){let e=t?this._data[r]:~this._data[r];0!=s&&(e&=~(4294967295<<s),s=0);for(let t=24;0!=e;t-=8,e<<=8){const s=n._lastOnBit[e>>>24];if(s>=0)return s+32*r+t}}return-1}}n._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]),n._firstOnBit=Int8Array.from([-1,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0]),n._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])},8467:(e,t,s)=>{"use strict";s.d(t,{X5:()=>M,ow:()=>F,bb:()=>N,W3:()=>x,gw:()=>k,l_:()=>_,f6:()=>$,jh:()=>E,Wh:()=>P,ci:()=>I,Bu:()=>S,zg:()=>A,AB:()=>H,QK:()=>m});var n=s(4469),r=s(976);s(9133);const i=r.DataFrame.fromCsv('countries,fasta,smiles,molregno,LON,Zip Code,Street Address Line 1,ImageUrl,user_id,error_message,xray,flag,magnitude,CS-id,pdb_id,accel_a,time_offset,chart,fit,Questions,empty_number,empty_string\nBelgium,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C(=O)OCCCc1cccnc1)c2cccc(c2)C(=O)c3ccccc3,1480014,36.276729583740234,995042300,14016 ROUTE 31W,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,1,1,1QBS,1,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.497360340644872, 1.7058694986686864, 5.278052678195135, 0.16000320889028383],""points"":[{""x"":0.10000000149011612,""y"":2.374499797821045},{""x"":0.6000000238418579,""y"":2.6242473125457764},{""x"":1.100000023841858,""y"":2.367267608642578},{""x"":1.600000023841858,""y"":2.6723148822784424},{""x"":2.0999999046325684,""y"":2.6537344455718994},{""x"":2.5999999046325684,""y"":2.3651671409606934},{""x"":3.0999999046325684,""y"":2.5654284954071045},{""x"":3.5999999046325684,""y"":2.4160959720611572},{""x"":4.099999904632568,""y"":2.286726713180542},{""x"":4.599999904632568,""y"":2.5100042819976807},{""x"":5.099999904632568,""y"":1.6676985025405884},{""x"":5.599999904632568,""y"":0.680136501789093},{""x"":6.099999904632568,""y"":0.3391543924808502},{""x"":6.599999904632568,""y"":0.09038983285427094},{""x"":7.099999904632568,""y"":0.19802775979042053}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[7.525235855508179, 1.3186911876809984, 5.335672608564294, 0.7860743343958098],""points"":[{""x"":0.10000000149011612,""y"":7.988070487976074},{""x"":0.6000000238418579,""y"":7.018453121185303},{""x"":1.100000023841858,""y"":8.115279197692871},{""x"":1.600000023841858,""y"":7.486658096313477},{""x"":2.0999999046325684,""y"":7.396438121795654},{""x"":2.5999999046325684,""y"":7.477052211761475},{""x"":3.0999999046325684,""y"":6.913095474243164},{""x"":3.5999999046325684,""y"":8.01385498046875},{""x"":4.099999904632568,""y"":6.985900402069092},{""x"":4.599999904632568,""y"":6.970335960388184},{""x"":5.099999904632568,""y"":5.448817253112793},{""x"":5.599999904632568,""y"":2.5534818172454834},{""x"":6.099999904632568,""y"":1.893947958946228},{""x"":6.599999904632568,""y"":0.6340042352676392},{""x"":7.099999904632568,""y"":0.8403874039649963}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,100,abc\nBurundi,MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW,COc1ccc2cc(ccc2c1)C(C)C(=O)Oc3ccc(C)cc3OC,1480015,36.276729583740234,995073444,80 STATE HIGHWAY 310,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,2,2,1ZP8,2,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.431460753103398, 2.1691498799246745, 5.266445597102774, 0.7825762827017926],""points"":[{""x"":0.10000000149011612,""y"":4.751083850860596},{""x"":0.6000000238418579,""y"":4.203000068664551},{""x"":1.100000023841858,""y"":4.415858745574951},{""x"":1.600000023841858,""y"":4.68414306640625},{""x"":2.0999999046325684,""y"":4.198400974273682},{""x"":2.5999999046325684,""y"":4.179222106933594},{""x"":3.0999999046325684,""y"":4.638473987579346},{""x"":3.5999999046325684,""y"":4.708553314208984},{""x"":4.099999904632568,""y"":4.291589260101318},{""x"":4.599999904632568,""y"":4.038082599639893},{""x"":5.099999904632568,""y"":3.4349939823150635},{""x"":5.599999904632568,""y"":1.2194708585739136},{""x"":6.099999904632568,""y"":1.1920831203460693},{""x"":6.599999904632568,""y"":0.5352635979652405},{""x"":7.099999904632568,""y"":0.3346920311450958}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.339458017970126, -1.0734184310171178, 4.746332950550934, 0.2482416857595658],""points"":[{""x"":0.10000000149011612,""y"":0.2139337658882141},{""x"":0.6000000238418579,""y"":0.4269562065601349},{""x"":1.100000023841858,""y"":0.2441573292016983},{""x"":1.600000023841858,""y"":0.146635964512825},{""x"":2.0999999046325684,""y"":0.08818462491035461},{""x"":2.5999999046325684,""y"":0.2560656666755676},{""x"":3.0999999046325684,""y"":0.42434045672416687},{""x"":3.5999999046325684,""y"":0.37111231684684753},{""x"":4.099999904632568,""y"":0.5581737160682678},{""x"":4.599999904632568,""y"":1.183590054512024},{""x"":5.099999904632568,""y"":1.5629843473434448},{""x"":5.599999904632568,""y"":2.3211288452148438},{""x"":6.099999904632568,""y"":2.229961633682251},{""x"":6.599999904632568,""y"":2.2560226917266846},{""x"":7.099999904632568,""y"":2.2142398357391357}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCameroon,MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL,COc1ccc2cc(ccc2c1)C(C)C(=O)OCCCc3cccnc3,1480016,36.26095962524414,995153596,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,3,3,2BDJ,3,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.6760652578642325, 0.9046956320756703, 5.651408971856738, 0.07738846012184185],""points"":[{""x"":0.10000000149011612,""y"":4.32425594329834},{""x"":0.6000000238418579,""y"":4.668442249298096},{""x"":1.100000023841858,""y"":4.379785060882568},{""x"":1.600000023841858,""y"":5.0345139503479},{""x"":2.0999999046325684,""y"":4.878653526306152},{""x"":2.5999999046325684,""y"":4.3451313972473145},{""x"":3.0999999046325684,""y"":4.336992263793945},{""x"":3.5999999046325684,""y"":5.037430286407471},{""x"":4.099999904632568,""y"":5.0092692375183105},{""x"":4.599999904632568,""y"":4.151902675628662},{""x"":5.099999904632568,""y"":3.4066951274871826},{""x"":5.599999904632568,""y"":2.3732759952545166},{""x"":6.099999904632568,""y"":1.673728108406067},{""x"":6.599999904632568,""y"":0.48574790358543396},{""x"":7.099999904632568,""y"":0.2783052325248718}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.938395863010111, -1.4658480661392117, 5.462702751996584, 0.3473139023615039],""points"":[{""x"":0.10000000149011612,""y"":0.4941710829734802},{""x"":0.6000000238418579,""y"":0.15323974192142487},{""x"":1.100000023841858,""y"":0.46373432874679565},{""x"":1.600000023841858,""y"":0.3370431363582611},{""x"":2.0999999046325684,""y"":0.5179030299186707},{""x"":2.5999999046325684,""y"":0.27899765968322754},{""x"":3.0999999046325684,""y"":0.22075064480304718},{""x"":3.5999999046325684,""y"":0.5789918899536133},{""x"":4.099999904632568,""y"":0.21169911324977875},{""x"":4.599999904632568,""y"":0.27857646346092224},{""x"":5.099999904632568,""y"":1.0906332731246948},{""x"":5.599999904632568,""y"":1.8520300388336182},{""x"":6.099999904632568,""y"":2.7177059650421143},{""x"":6.599999904632568,""y"":2.8680918216705322},{""x"":7.099999904632568,""y"":3.2413077354431152}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCanada,MMELVLKTIIGPIVVGVVLRIVDKWLNKDK,CC(C(=O)NCCS)c1cccc(c1)C(=O)c2ccccc2,1480017,36.26095962524414,99515,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,4,4,1IAN,4,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[0.8597390975430008, 1.0957625732481946, 5.260537067987958, 0.07974187998177736],""points"":[{""x"":0.10000000149011612,""y"":0.8190152645111084},{""x"":0.6000000238418579,""y"":0.8421689867973328},{""x"":1.100000023841858,""y"":0.8740922212600708},{""x"":1.600000023841858,""y"":0.8924275040626526},{""x"":2.0999999046325684,""y"":0.8249067664146423},{""x"":2.5999999046325684,""y"":0.9327669143676758},{""x"":3.0999999046325684,""y"":0.8522974252700806},{""x"":3.5999999046325684,""y"":0.8174492716789246},{""x"":4.099999904632568,""y"":0.8394647240638733},{""x"":4.599999904632568,""y"":0.7139387726783752},{""x"":5.099999904632568,""y"":0.5561167597770691},{""x"":5.599999904632568,""y"":0.3276226818561554},{""x"":6.099999904632568,""y"":0.12479474395513535},{""x"":6.599999904632568,""y"":0.13006797432899475},{""x"":7.099999904632568,""y"":0.059702079743146896}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.760930219582546, 1.6591793293833013, 4.667155929720851, 0.7858109544121652],""points"":[{""x"":0.10000000149011612,""y"":6.156993389129639},{""x"":0.6000000238418579,""y"":5.236701965332031},{""x"":1.100000023841858,""y"":6.010560512542725},{""x"":1.600000023841858,""y"":5.495512962341309},{""x"":2.0999999046325684,""y"":6.087770462036133},{""x"":2.5999999046325684,""y"":5.79986572265625},{""x"":3.0999999046325684,""y"":5.597546577453613},{""x"":3.5999999046325684,""y"":5.520902156829834},{""x"":4.099999904632568,""y"":5.360654354095459},{""x"":4.599999904632568,""y"":3.5539746284484863},{""x"":5.099999904632568,""y"":1.577236294746399},{""x"":5.599999904632568,""y"":1.0001264810562134},{""x"":6.099999904632568,""y"":0.9305797815322876},{""x"":6.599999904632568,""y"":0.6033638715744019},{""x"":7.099999904632568,""y"":0.4203685522079468}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nColombia,MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN,FC(F)(F)c1ccc(OC2CCNCC2)cc1,1480029,36.3309440612793,995152050,1 COURT HOUSE SQUARE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,5,5,4UJ1,5,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[6.4995088314153655, 2.4270351004539914, 5.178659535348579, 0.625653346241577],""points"":[{""x"":0.10000000149011612,""y"":6.496231555938721},{""x"":0.6000000238418579,""y"":6.42543363571167},{""x"":1.100000023841858,""y"":7.040063858032227},{""x"":1.600000023841858,""y"":6.1115403175354},{""x"":2.0999999046325684,""y"":6.680728435516357},{""x"":2.5999999046325684,""y"":6.406774520874023},{""x"":3.0999999046325684,""y"":6.611269474029541},{""x"":3.5999999046325684,""y"":5.889094352722168},{""x"":4.099999904632568,""y"":6.75344705581665},{""x"":4.599999904632568,""y"":6.361435890197754},{""x"":5.099999904632568,""y"":4.1666975021362305},{""x"":5.599999904632568,""y"":1.172118902206421},{""x"":6.099999904632568,""y"":0.801048994064331},{""x"":6.599999904632568,""y"":0.4640021026134491},{""x"":7.099999904632568,""y"":0.0010357667924836278}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[1.4734381347446401, 1.1649805188074196, 4.82958608866421, 0.09500545496710007],""points"":[{""x"":0.10000000149011612,""y"":1.5279096364974976},{""x"":0.6000000238418579,""y"":1.3559974431991577},{""x"":1.100000023841858,""y"":1.5246378183364868},{""x"":1.600000023841858,""y"":1.5567657947540283},{""x"":2.0999999046325684,""y"":1.4114240407943726},{""x"":2.5999999046325684,""y"":1.4045010805130005},{""x"":3.0999999046325684,""y"":1.4769829511642456},{""x"":3.5999999046325684,""y"":1.4875500202178955},{""x"":4.099999904632568,""y"":1.2991987466812134},{""x"":4.599999904632568,""y"":0.922961413860321},{""x"":5.099999904632568,""y"":0.6520044803619385},{""x"":5.599999904632568,""y"":0.15350978076457977},{""x"":6.099999904632568,""y"":0.1078903079032898},{""x"":6.599999904632568,""y"":0.17276449501514435},{""x"":7.099999904632568,""y"":0.14066608250141144}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCosta Rica,MKSTKEEIQTIKTLLKDSRTAKYHKRLQIVL,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCCc3ccccc3,1480018,36.3309440612793,995084218,4041 SOUTHWESTERN BLVD,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,6,6,2BPW,6,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.4833641843311227, -1.8945978742090062, 4.671127708092568, 0.24159861311815153],""points"":[{""x"":0.10000000149011612,""y"":0.0969524160027504},{""x"":0.6000000238418579,""y"":0.028483040630817413},{""x"":1.100000023841858,""y"":0.22087176144123077},{""x"":1.600000023841858,""y"":0.0068915546871721745},{""x"":2.0999999046325684,""y"":0.4305879771709442},{""x"":2.5999999046325684,""y"":0.44774115085601807},{""x"":3.0999999046325684,""y"":0.45346319675445557},{""x"":3.5999999046325684,""y"":0.2370593100786209},{""x"":4.099999904632568,""y"":0.4657953977584839},{""x"":4.599999904632568,""y"":1.155200719833374},{""x"":5.099999904632568,""y"":2.2294070720672607},{""x"":5.599999904632568,""y"":2.4311530590057373},{""x"":6.099999904632568,""y"":2.33846116065979},{""x"":6.599999904632568,""y"":2.608201026916504},{""x"":7.099999904632568,""y"":2.8136143684387207}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.224573521642033, 1.4454033924198528, 5.6014197746076535, 0.2823216054197577],""points"":[{""x"":0.10000000149011612,""y"":4.95027494430542},{""x"":0.6000000238418579,""y"":5.1754679679870605},{""x"":1.100000023841858,""y"":5.276752948760986},{""x"":1.600000023841858,""y"":5.589294910430908},{""x"":2.0999999046325684,""y"":5.616994857788086},{""x"":2.5999999046325684,""y"":5.120813846588135},{""x"":3.0999999046325684,""y"":5.340766906738281},{""x"":3.5999999046325684,""y"":4.876471042633057},{""x"":4.099999904632568,""y"":4.94999361038208},{""x"":4.599999904632568,""y"":5.162564754486084},{""x"":5.099999904632568,""y"":4.399557590484619},{""x"":5.599999904632568,""y"":2.7977969646453857},{""x"":6.099999904632568,""y"":1.0229872465133667},{""x"":6.599999904632568,""y"":0.48275601863861084},{""x"":7.099999904632568,""y"":0.10408931970596313}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCuba,MHAILRYFIRRLFYHIFYKIYSLISKKHQSLPSDVRQF,COc1ccc2c(c1)c(CC(=O)N3CCCC3C(=O)Oc4ccc(C)cc4OC)c(C)n2C(=O)c5ccc(Cl)cc5,1480019,36.33115768432617,995081928,1227 US HIGHWAY 11,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,7,7,1QBS,7,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.320838679713925, -1.2421619987316728, 4.831325425225256, 0.3236011098403072],""points"":[{""x"":0.10000000149011612,""y"":0.3727470338344574},{""x"":0.6000000238418579,""y"":0.12365014106035233},{""x"":1.100000023841858,""y"":0.48422467708587646},{""x"":1.600000023841858,""y"":0.2264465093612671},{""x"":2.0999999046325684,""y"":0.16821794211864471},{""x"":2.5999999046325684,""y"":0.3879014551639557},{""x"":3.0999999046325684,""y"":0.5470244884490967},{""x"":3.5999999046325684,""y"":0.3419053554534912},{""x"":4.099999904632568,""y"":0.7655120491981506},{""x"":4.599999904632568,""y"":1.2346516847610474},{""x"":5.099999904632568,""y"":2.453336715698242},{""x"":5.599999904632568,""y"":2.9565491676330566},{""x"":6.099999904632568,""y"":3.335299491882324},{""x"":6.599999904632568,""y"":3.240290880203247},{""x"":7.099999904632568,""y"":3.1107218265533447}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.6401853521511094, 1.26211588875013, 5.399028074402744, 0.5089580830068091],""points"":[{""x"":0.10000000149011612,""y"":3.8585598468780518},{""x"":0.6000000238418579,""y"":3.6077206134796143},{""x"":1.100000023841858,""y"":3.855252265930176},{""x"":1.600000023841858,""y"":3.619039297103882},{""x"":2.0999999046325684,""y"":3.839388370513916},{""x"":2.5999999046325684,""y"":3.335283041000366},{""x"":3.0999999046325684,""y"":3.571141481399536},{""x"":3.5999999046325684,""y"":3.4155046939849854},{""x"":4.099999904632568,""y"":3.7316646575927734},{""x"":4.599999904632568,""y"":3.0680155754089355},{""x"":5.099999904632568,""y"":2.891066551208496},{""x"":5.599999904632568,""y"":1.6022753715515137},{""x"":6.099999904632568,""y"":0.7652576565742493},{""x"":6.599999904632568,""y"":0.6875326037406921},{""x"":7.099999904632568,""y"":0.5828871726989746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nItaly,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO[N+](=O)[O-],1480020,36.33115768432617,99502,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,8,8,1ZP8,8,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.293592105923809, 1.3781586549141835, 5.1025898038676605, 0.03493851245291291],""points"":[{""x"":0.10000000149011612,""y"":2.1287283897399902},{""x"":0.6000000238418579,""y"":2.267972230911255},{""x"":1.100000023841858,""y"":2.398442506790161},{""x"":1.600000023841858,""y"":2.5130622386932373},{""x"":2.0999999046325684,""y"":2.3255116939544678},{""x"":2.5999999046325684,""y"":2.127340793609619},{""x"":3.0999999046325684,""y"":2.47259783744812},{""x"":3.5999999046325684,""y"":2.131181478500366},{""x"":4.099999904632568,""y"":2.090421438217163},{""x"":4.599999904632568,""y"":2.02299165725708},{""x"":5.099999904632568,""y"":1.1105059385299683},{""x"":5.599999904632568,""y"":0.4494485855102539},{""x"":6.099999904632568,""y"":0.1375635862350464},{""x"":6.599999904632568,""y"":0.036351121962070465},{""x"":7.099999904632568,""y"":0.1619771122932434}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.953125499439879, 1.2528620255306528, 5.187637440149802, 0.3110348753260886],""points"":[{""x"":0.10000000149011612,""y"":5.6585283279418945},{""x"":0.6000000238418579,""y"":5.911152362823486},{""x"":1.100000023841858,""y"":5.924920082092285},{""x"":1.600000023841858,""y"":5.8469438552856445},{""x"":2.0999999046325684,""y"":5.929472923278809},{""x"":2.5999999046325684,""y"":6.190037727355957},{""x"":3.0999999046325684,""y"":6.236179828643799},{""x"":3.5999999046325684,""y"":6.141019344329834},{""x"":4.099999904632568,""y"":5.295210838317871},{""x"":4.599999904632568,""y"":5.265801906585693},{""x"":5.099999904632568,""y"":3.3722851276397705},{""x"":5.599999904632568,""y"":1.8299226760864258},{""x"":6.099999904632568,""y"":0.32690900564193726},{""x"":6.599999904632568,""y"":0.6274543404579163},{""x"":7.099999904632568,""y"":0.8441857099533081}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nRwanda,MPNSEPASLLELFNSIATQGELVRSLKAGNASK,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO,1480021,36.33137130737305,995037247,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,9,2BDJ,9,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.8209972202654474, 1.3779216716448506, 5.299882228439686, 0.06040645519069608],""points"":[{""x"":0.10000000149011612,""y"":3.7821109294891357},{""x"":0.6000000238418579,""y"":3.542433023452759},{""x"":1.100000023841858,""y"":3.7008674144744873},{""x"":1.600000023841858,""y"":3.717301607131958},{""x"":2.0999999046325684,""y"":4.024452209472656},{""x"":2.5999999046325684,""y"":4.013899326324463},{""x"":3.0999999046325684,""y"":3.945094347000122},{""x"":3.5999999046325684,""y"":3.866621971130371},{""x"":4.099999904632568,""y"":3.7461626529693604},{""x"":4.599999904632568,""y"":3.3454740047454834},{""x"":5.099999904632568,""y"":2.61944317817688},{""x"":5.599999904632568,""y"":0.999405026435852},{""x"":6.099999904632568,""y"":0.46259793639183044},{""x"":6.599999904632568,""y"":0.054134611040353775},{""x"":7.099999904632568,""y"":0.05711187422275543}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.6318079657726035, 1.8495493770000595, 5.391793312471116, 0.17060707587348442],""points"":[{""x"":0.10000000149011612,""y"":5.458079814910889},{""x"":0.6000000238418579,""y"":5.554427146911621},{""x"":1.100000023841858,""y"":5.799983024597168},{""x"":1.600000023841858,""y"":5.364140033721924},{""x"":2.0999999046325684,""y"":5.864485740661621},{""x"":2.5999999046325684,""y"":5.4509806632995605},{""x"":3.0999999046325684,""y"":5.702574729919434},{""x"":3.5999999046325684,""y"":5.7314534187316895},{""x"":4.099999904632568,""y"":5.5123443603515625},{""x"":4.599999904632568,""y"":5.724395751953125},{""x"":5.099999904632568,""y"":4.354506969451904},{""x"":5.599999904632568,""y"":1.7307666540145874},{""x"":6.099999904632568,""y"":0.6305936574935913},{""x"":6.599999904632568,""y"":0.035183437168598175},{""x"":7.099999904632568,""y"":0.7575169205665588}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nSwitzerland,IRVVGRYLIEVWKAAGMDMDKVLFLWSSDEI,CN1CCC(CC1)Oc2ccc(cc2)C(F)(F)F,1480028,36.33137130737305,99504,92-11 179TH PLACE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,10,1IAN,10,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[1.1190255865097471, 2.3163895161544437, 5.4968866182279195, 0.2035204047289052],""points"":[{""x"":0.10000000149011612,""y"":1.1057683229446411},{""x"":0.6000000238418579,""y"":1.1019697189331055},{""x"":1.100000023841858,""y"":1.0818607807159424},{""x"":1.600000023841858,""y"":1.062997817993164},{""x"":2.0999999046325684,""y"":1.046447515487671},{""x"":2.5999999046325684,""y"":1.1217249631881714},{""x"":3.0999999046325684,""y"":1.2166996002197266},{""x"":3.5999999046325684,""y"":1.215477705001831},{""x"":4.099999904632568,""y"":1.0581893920898438},{""x"":4.599999904632568,""y"":1.1747995615005493},{""x"":5.099999904632568,""y"":1.0181127786636353},{""x"":5.599999904632568,""y"":0.5344523191452026},{""x"":6.099999904632568,""y"":0.2569526433944702},{""x"":6.599999904632568,""y"":0.1912207305431366},{""x"":7.099999904632568,""y"":0.15060538053512573}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.1038581025805785, 2.0032224204185245, 5.087602825989163, 0.13277988512492753],""points"":[{""x"":0.10000000149011612,""y"":3.0498509407043457},{""x"":0.6000000238418579,""y"":2.805217742919922},{""x"":1.100000023841858,""y"":3.3415253162384033},{""x"":1.600000023841858,""y"":3.0549843311309814},{""x"":2.0999999046325684,""y"":3.250074863433838},{""x"":2.5999999046325684,""y"":3.0432586669921875},{""x"":3.0999999046325684,""y"":3.265852451324463},{""x"":3.5999999046325684,""y"":2.9475724697113037},{""x"":4.099999904632568,""y"":3.1929898262023926},{""x"":4.599999904632568,""y"":2.7460060119628906},{""x"":5.099999904632568,""y"":1.6175861358642578},{""x"":5.599999904632568,""y"":0.3006608486175537},{""x"":6.099999904632568,""y"":0.3444803059101105},{""x"":6.599999904632568,""y"":0.015537971630692482},{""x"":7.099999904632568,""y"":0.5527358055114746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\n,,,,,,,,,,,,,,,,,,,,,');i.columns.add(r.Column.fromList(r.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var o=function(e,t,s,n){return new(s||(s=Promise))((function(r,i){function o(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}l((n=n.apply(e,t||[])).next())}))};const a=3e4,l=108e5,c=console.log.bind(console),h=console.info.bind(console),u=console.warn.bind(console),d=console.error.bind(console),m={},p="Auto Tests",f="Demo",g="Detectors",y="Core",w={};let b;var C;!function(e){e.notNull=function(e,t){if(null==e)throw new Error(`${null==t?"Value":t} not defined`)}}(C||(C={}));class v{constructor(e,t){this.catchUnhandled=!0,this.report=!1,void 0!==e&&(this.catchUnhandled=e),void 0!==t&&(this.report=t)}}class T{constructor(e,t,s,n){var r;this.category=e,this.name=t,null!=n||(n={}),null!==(r=n.timeout)&&void 0!==r||(n.timeout=a),this.options=n,this.test=()=>o(this,void 0,void 0,(function*(){return new Promise(((e,t)=>o(this,void 0,void 0,(function*(){let n="";try{n=yield s()}catch(e){t(e)}e(n)}))))}))}}function A(e,t,s,n=0,r="timeout"){return o(this,void 0,void 0,(function*(){return new Promise(((i,o)=>{const a=e.subscribe((e=>{try{t(e),i("OK")}catch(e){o(e)}a.unsubscribe(),clearTimeout(l)})),l=setTimeout((()=>{a.unsubscribe(),o(r)}),n);s()}))}))}function S(e,t,s){null==m[b]&&(m[b]={}),null==m[b].tests&&(m[b].tests=[]),m[b].tests.push(new T(b,e,t,s))}function _(e,t=!0,s){if(s=s?`${s}, `:"",e!==t)throw new Error(`${s}Expected "${t}", got "${e}"`)}function E(e,t,s=.001,n){if(e===Number.POSITIVE_INFINITY&&t===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY&&t===Number.NEGATIVE_INFINITY||e===Number.NaN&&t===Number.NaN||isNaN(e)&&isNaN(t))return;const r=Math.abs(e-t)<s;if(_(r,!0,`${null!=n?n:""} (tolerance = ${s})`),!r)throw new Error(`Expected ${t}, got ${e} (tolerance = ${s})`)}function P(e,t){for(const[s,n]of Object.entries(t)){if(!e.hasOwnProperty(s))throw new Error(`Expected property "${s}" not found`);const t=e[s];if(t instanceof Array&&n instanceof Array)$(t,n);else if(t instanceof Object&&n instanceof Object)P(t,n);else if(Number.isFinite(t)&&Number.isFinite(n))E(t,n);else if(t!=n)throw new Error(`Expected (${n}) for key '${s}', got (${t})`)}}function $(e,t){const s=e.length,n=t.length;if(s!=n)throw new Error(`Arrays are of different length: actual array length is ${s} and expected array length is ${n}`);for(let n=0;n<s;n++)if(e[n]instanceof Array&&t[n]instanceof Array)$(e[n],t[n]);else if(e[n]instanceof Object&&t[n]instanceof Object)P(e[n],t[n]);else if(e[n]!=t[n])throw new Error(`Expected ${t[n]} at position ${n}, got ${e[n]}`)}function x(e,t,s){var n;b=e,t(),m[b]&&(m[b].clear=null===(n=null==s?void 0:s.clear)||void 0===n||n,m[b].timeout=null==s?void 0:s.timeout)}function N(e){null==m[b]&&(m[b]={}),m[b].before=e}function M(e){null==m[b]&&(m[b]={}),m[b].after=e}function L(e,t){return e.replace(new RegExp(t.name,"gi"),t.nqName)}function I(e){var t,s,a,l,b,C,A;return o(this,void 0,void 0,(function*(){const S=null===(s=null===(t=n.functions.getCurrentCall())||void 0===t?void 0:t.func)||void 0===s?void 0:s.package;yield function(e,t){var s;return o(this,void 0,void 0,(function*(){const t=e.id;if(w[t])return;const a=m;if(void 0!==a[p]||void 0!==a[f]||Object.keys(a).find((e=>e.startsWith(p)||e.startsWith(y))))return void(w[t]=!0);if("DevTools"===e.name){const e=r.Func.find({tags:["dartTest"]});for(const t of e){const e=t.name.split(/\s*\|\s*/g),n=null!==(s=e.pop())&&void 0!==s?s:t.name,r=e.length?y+": "+e.join(": "):y;void 0===a[r]&&(a[r]={tests:[],clear:!0}),a[r].tests.push(new T(r,n,(()=>o(this,void 0,void 0,(function*(){return yield t.apply()}))),{isAggregated:t.outputs.length>0,timeout:3e5}))}}const l=[],c=[],h=[],u=yield n.dapi.functions.filter(`package.id = "${t}"`).list(),d=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)|timeout:\s*(\d+)/g);for(const e of u){const t=e.options.test,s=e.options.demoPath;if(t&&Array.isArray(t)&&t.length)for(let s=0;s<t.length;s++){const r=t[s].matchAll(d),i={};Array.from(r).forEach((e=>{e[0].startsWith("skip")?i.skip=e[1]:e[0].startsWith("wait")?i.wait=parseInt(e[2]):e[0].startsWith("cat")?i.cat=e[3]:e[0].startsWith("timeout")&&(i.timeout=parseInt(e[4]))}));const c=new T(p,1===t.length?e.name:`${e.name} ${s+1}`,(()=>o(this,void 0,void 0,(function*(){const r=yield n.functions.eval(L(t[s],e));if(i.wait&&(yield k(i.wait)),"boolean"==typeof r&&!r)throw`Failed: ${t[s]}, expected true, got ${r}`}))),{skipReason:i.skip,timeout:i.timeout});if(i.cat){const e=p+": "+i.cat;c.category=e,void 0===a[e]&&(a[e]={tests:[],clear:!0}),a[e].tests.push(c)}else l.push(c)}if(s){const t=e.options.demoWait?parseInt(e.options.demoWait):void 0,s=new T(f,e.friendlyName,(()=>o(this,void 0,void 0,(function*(){if(n.shell.lastError="",yield e.apply(),yield k(t||2e3),n.shell.lastError)throw new Error(n.shell.lastError)}))),{skipReason:e.options.demoSkip});c.push(s)}if(e.hasTag("semTypeDetector")){const t=new T(g,e.friendlyName,(()=>o(this,void 0,void 0,(function*(){const t=[];for(const s of i.clone().columns){const n=yield e.apply([s]);t.push(n||s.semType)}_(t.filter((e=>e)).length,1)}))),{skipReason:e.options.skipTest});h.push(t)}}w[t]=!0,l.length&&(a[p]={tests:l,clear:!0}),c.length&&(a[f]={tests:c,clear:!0}),h.length&&(a[g]={tests:h,clear:!1})}))}(S);const E=[];console.log("Running tests"),null!=e||(e={}),null!==(a=(A=e).testContext)&&void 0!==a||(A.testContext=new v),n.shell.lastError="";const P=[],$=function(){const e=[];return console.log=(...t)=>{e.push(...t),c(...t)},console.info=(...t)=>{e.push(...t),h(...t)},console.warn=(...t)=>{e.push(...t),u(...t)},console.error=(...t)=>{e.push(...t),d(...t)},e}();try{for(const[t,s]of Object.entries(m)){if((null==e?void 0:e.category)&&!t.toLowerCase().startsWith(null==e?void 0:e.category.toLowerCase())||(null===(l=e.exclude)||void 0===l?void 0:l.some((e=>t.startsWith(e)))))continue;c(`Started ${t} category`),P.push(t);const i=null===(b=s.tests)||void 0===b?void 0:b.every((e=>{var t;return null===(t=e.options)||void 0===t?void 0:t.skipReason}));try{s.before&&!i&&(yield s.before())}catch(e){s.beforeStatus=R(e)}const o=null!==(C=s.tests)&&void 0!==C?C:[],a=[];if(s.clear)for(let t=0;t<o.length;t++)a.push(yield O(o[t],null==e?void 0:e.test,$,s.timeout,S.name,e.verbose)),n.shell.closeAll(),r.Balloon.closeAll();else for(let t=0;t<o.length;t++)a.push(yield O(o[t],null==e?void 0:e.test,$,s.timeout,S.name,e.verbose));const h=a.filter((e=>"skipped"!=e.result));try{s.after&&!i&&(yield s.after())}catch(e){s.afterStatus=R(e)}s.afterStatus&&h.push({category:t,name:"after",result:s.afterStatus,success:!1,ms:0,skipped:!1}),s.beforeStatus&&h.push({category:t,name:"before",result:s.beforeStatus,success:!1,ms:0,skipped:!1}),E.push(...h)}}finally{console.log=c,console.info=h,console.warn=u,console.error=d}if(e.testContext.catchUnhandled&&(yield k(1e3),n.shell.lastError.length>0&&E.push({category:"Unhandled exceptions",name:"exceptions",result:n.shell.lastError,success:!1,ms:0,skipped:!1})),!e.test&&E.length){const t=E.filter((e=>e.success)).length,s=E.filter((e=>e.skipped)).length,i=E.filter((e=>!e.success)),o=S.name;for(const e of P){const t=E.filter((t=>t.category===e)),s=t.filter((e=>!e.success)).length,r={success:0===s,passed:t.filter((e=>e.success)).length,skipped:t.filter((e=>e.skipped)).length,failed:s,type:"package",packageName:o,category:e};n.log.usage(`${o}: ${e}`,r,`category-package ${o}: ${e}`)}if(!e.category){const e={success:0===i.length,passed:t,skipped:s,failed:i.length,type:"package",packageName:o};n.log.usage(o,e,`package-package ${o}`)}if(e.testContext.report){const e=new r.Logger,n="Package @package tested: @successful successful, @skipped skipped, @failed failed tests",o={successful:t,skipped:s,failed:i.length,package:S};for(const e of i)Object.assign(o,{[`${e.category} | ${e.name}`]:e.result});e.log(n,o,"package-tested")}}return E}))}function R(e){return`${e.toString()}\n${e.stack?r.Logger.translateStackTrace(e.stack):""}`}function O(e,t,s,i,h,u){var d,m,p,f,g,y;return o(this,void 0,void 0,(function*(){let o;s.length=0;let w="package";const b=null!=t&&e.name.toLowerCase()!==t.toLowerCase(),C=(null===(d=e.options)||void 0===d?void 0:d.skipReason)||b,v=b?"skipped":null===(m=e.options)||void 0===m?void 0:m.skipReason;C||c(`Started ${e.category} ${e.name}`);const T=Date.now();try{if(C)o={success:!0,result:v,ms:0,skipped:!0};else{let t=(null===(p=e.options)||void 0===p?void 0:p.timeout)===a&&i?i:null===(f=e.options)||void 0===f?void 0:f.timeout;t=r.Test.isInBenchmark&&t===a?l:t,o={success:!0,result:null!==(g=yield D(e.test,t))&&void 0!==g?g:"OK",ms:0,skipped:!1}}}catch(e){o={success:!1,result:R(e),ms:0,skipped:!1}}if((null===(y=e.options)||void 0===y?void 0:y.isAggregated)&&o.result.constructor===r.DataFrame){const e=o.result.col("success");if(w="core",e&&(o.success=e.stats.sum===e.length),!u){const e=o.result;e.columns.remove("stack"),e.rows.removeWhere((e=>e.get("success"))),o.result=e}o.result=o.result.toCsv()}if(o.logs=s.join("\n"),o.ms=Date.now()-T,C||c(`Finished ${e.category} ${e.name} for ${o.ms} ms`),o.category=e.category,o.name=e.name,!b){let t={success:o.success,result:o.result,ms:o.ms,skipped:o.skipped,type:w,packageName:h,category:e.category,test:e.name,logs:o.logs};if(o.result.constructor==Object){const e=Object.keys(o.result).reduce(((e,t)=>Object.assign(Object.assign({},e),{["result."+t]:o.result[t]})),{});t=Object.assign(Object.assign({},t),e)}n.log.usage(`${h}: ${e.category}: ${e.name}`,t,`test-${w} ${h}: ${e.category}: ${e.name}`)}return o}))}function k(e){return o(this,void 0,void 0,(function*(){yield new Promise((t=>setTimeout(t,e)))}))}function F(e,t="Timeout exceeded",s=500,n=50){return o(this,void 0,void 0,(function*(){return new Promise(((r,i)=>{setTimeout((()=>{clearInterval(o),i(new Error(t))}),s);const o=setInterval((()=>{e()&&(clearInterval(o),r())}),n)}))}))}function D(e,t){return o(this,void 0,void 0,(function*(){let s=null;const n=new Promise(((e,n)=>{s=setTimeout((()=>{n("EXECUTION TIMEOUT")}),t)}));try{return yield Promise.race([e(),n])}finally{s&&clearTimeout(s)}}))}const G=r.DataFrame.fromColumns([r.Column.fromStrings("col",["val1","val2","val3"])]);function H(e,t,s){var i;return o(this,void 0,void 0,(function*(){const a=(e,t,s)=>o(this,void 0,void 0,(function*(){let n;return s?(n=yield e.dataFrame.plot.fromType(t),e.dockManager.dock(n)):n=e.addViewer(t),n}));(null==s?void 0:s.detectSemanticTypes)&&(yield n.data.detectSemanticTypes(t));let l=n.shell.addTableView(t);const c=`[name=viewer-${e.replace(/\s+/g,"-")} i]`,h=["div.ui-box","canvas","svg","img","input","h1","a",".d4-viewer-error"].map((e=>`${c} ${e}`)).join(", "),u=[];try{let o=yield a(l,e,null==s?void 0:s.packageName);yield F((()=>null!==document.querySelector(h)),"cannot load viewer",3e3);const d=null===(i=document.querySelector(h))||void 0===i?void 0:i.tagName;if(u.push(Array.from(l.viewers).length),!(null==s?void 0:s.readOnly)){Array.from(t.row(0).cells).forEach((e=>e.value=null));const e=t.rowCount<20?Math.floor(t.rowCount/2):10;t.rows.select((t=>t.idx>=0&&t.idx<e)),yield k(50);for(let s=e;s<2*e;s++)t.filter.set(s,!1);yield k(50),t.currentRowIdx=1;const s=t.clone();t.columns.names().slice(0,Math.ceil(t.columns.length/2)).forEach((e=>t.columns.remove(e))),yield k(100),l.dataFrame=s}let m,p;try{m=o.getOptions(!0).look}catch(e){throw new Error("Viewer's .getOptions() error.",{cause:e})}try{p=o.getProperties()}catch(e){throw new Error("Viewer's .getProperties() error.",{cause:e})}const f={};Object.keys(m).filter((e=>"boolean"==typeof m[e])).forEach((e=>f[e]=!m[e])),p.filter((e=>null!==e.choices)).forEach((e=>f[e.name]=e.choices.find((t=>t!==m[e.name])))),o.setOptions(f),yield k(300);const g=l.saveLayout(),y=o.getOptions().look;l.resetLayout(),u.push(Array.from(l.viewers).length),l.loadLayout(g);const w=`${c} ${d}`;if(yield F((()=>null!==document.querySelector(w)),"cannot load viewer from layout",3e3),u.push(Array.from(l.viewers).length),o=Array.from(l.viewers).find((e=>"Grid"!==e.type)),$(u,[2,1,2]),_(JSON.stringify(o.getOptions().look),JSON.stringify(y)),!1!==(null==s?void 0:s.arbitraryDfTest)){(null==s?void 0:s.awaitViewer)&&(yield s.awaitViewer(o)),n.shell.closeAll(),yield k(100),l=n.shell.addTableView(G);try{o=yield a(l,e,null==s?void 0:s.packageName)}catch(e){return n.shell.closeAll(),void r.Balloon.closeAll()}yield F((()=>null!==document.querySelector(h)),"cannot load viewer on arbitrary dataset",3e3)}(null==s?void 0:s.awaitViewer)&&(yield s.awaitViewer(o))}finally{}}))}},850:(e,t,s)=>{"use strict";function n(e=!1,t="Assertion error."){if(!e)throw new Error(t)}function r(e){let t=0;for(let s=0;s<e.length;s++)t+=e[s]*e[s];return Math.sqrt(t)}function i(e,t){if(e.length!=t.length)throw new Error("The dimensionality of the vectors must match");let s=0;for(let n=0;n<e.length;n++)s+=e[n]*t[n];return s}function o(e,t){let s=0;const n=e.length;if(n!==t.length)throw new Error("The dimensionality of the vectors must match");for(let r=0;r<n;++r)s+=Math.pow(e[r]-t[r],2);return Math.sqrt(s)}function a(e){const t=e.length;let s=0,n=0;for(let r=0;r<t;++r)s+=e[r],n+=Math.pow(e[r],2);const r=s/t,i=1/Math.sqrt(n/t-Math.pow(r,2));for(let s=0;s<t;++s)e[s]=(e[s]-r)*i;return e}s.d(t,{$G:()=>r,Fv:()=>a,MA:()=>i,dP:()=>o,hu:()=>n})},3351:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(1581),r=s(3487),i=s(7023),o=s(4815),a=s(4181),l=s(2141),c="errorMessage",h=new n.Name("emUsed"),u={required:"missingProperty",dependencies:"property",dependentRequired:"property"},d=/\$\{[^}]+\}/,m=/\$\{([^}]+)\}/g,p=/^""\s*\+\s*|\s*\+\s*""$/g;const f=(e,t={})=>{if(!e.opts.allErrors)throw new Error("ajv-errors: Ajv option allErrors must be true");if(e.opts.jsPropertySyntax)throw new Error("ajv-errors: ajv option jsPropertySyntax is not supported");return e.addKeyword(function(e){return{keyword:c,schemaType:["string","object"],post:!0,code(t){const{gen:s,data:f,schema:g,schemaValue:y,it:w}=t;if(!1===w.createErrors)return;const b=g,C=r.strConcat(l.default.instancePath,w.errorPath);function v(e,t){return r.and(n._`${e}.keyword !== ${c}`,n._`!${e}.${h}`,n._`${e}.instancePath === ${C}`,n._`${e}.keyword in ${t}`,n._`${e}.schemaPath.indexOf(${w.errSchemaPath}) === 0`,n._`/^\\/[^\\/]*$/.test(${e}.schemaPath.slice(${w.errSchemaPath.length}))`)}function T(e,t){const n=[];for(const s in e){const e=t[s];d.test(e)&&n.push([s,S(e)])}return s.object(...n)}function A(e){return d.test(e)?new i._Code(i.safeStringify(e).replace(m,((e,t)=>`" + JSON.stringify(${o.getData(t,w)}) + "`)).replace(p,"")):n.stringify(e)}function S(e){return n._`function(){return ${A(e)}}`}s.if(n._`${l.default.errors} > 0`,(()=>{if("object"==typeof b){const[i,o]=function(e){let t,s;for(const n in e){if("properties"===n||"items"===n)continue;const r=e[n];if("object"==typeof r){t||(t={});const e=t[n]={};for(const t in r)e[t]=[]}else s||(s={}),s[n]=[]}return[t,s]}(b);o&&function(r){const i=s.const("emErrors",n.stringify(r)),o=s.const("templates",T(r,g));s.forOf("err",l.default.vErrors,(e=>s.if(v(e,i),(()=>s.code(n._`${i}[${e}.keyword].push(${e})`).assign(n._`${e}.${h}`,!0)))));const{singleError:c}=e;if(c){const e=s.let("message",n._`""`),r=s.let("paramsErrors",n._`[]`);u((t=>{s.if(e,(()=>s.code(n._`${e} += ${"string"==typeof c?c:";"}`))),s.code(n._`${e} += ${d(t)}`),s.assign(r,n._`${r}.concat(${i}[${t}])`)})),a.reportError(t,{message:e,params:n._`{errors: ${r}}`})}else u((e=>a.reportError(t,{message:d(e),params:n._`{errors: ${i}[${e}]}`})));function u(e){s.forIn("key",i,(t=>s.if(n._`${i}[${t}].length`,(()=>e(t)))))}function d(e){return n._`${e} in ${o} ? ${o}[${e}]() : ${y}[${e}]`}}(o),i&&function(e){const r=s.const("emErrors",n.stringify(e)),i=[];for(const t in e)i.push([t,T(e[t],g[t])]);const o=s.const("templates",s.object(...i)),c=s.scopeValue("obj",{ref:u,code:n.stringify(u)}),d=s.let("emPropParams"),m=s.let("emParamsErrors");s.forOf("err",l.default.vErrors,(e=>s.if(v(e,r),(()=>{s.assign(d,n._`${c}[${e}.keyword]`),s.assign(m,n._`${r}[${e}.keyword][${e}.params[${d}]]`),s.if(m,(()=>s.code(n._`${m}.push(${e})`).assign(n._`${e}.${h}`,!0)))})))),s.forIn("key",r,(e=>s.forIn("keyProp",n._`${r}[${e}]`,(i=>{s.assign(m,n._`${r}[${e}][${i}]`),s.if(n._`${m}.length`,(()=>{const r=s.const("tmpl",n._`${o}[${e}] && ${o}[${e}][${i}]`);a.reportError(t,{message:n._`${r} ? ${r}() : ${y}[${e}][${i}]`,params:n._`{errors: ${m}}`})}))}))))}(i),function(e){const{props:i,items:o}=e;if(!i&&!o)return;const u=n._`typeof ${f} == "object"`,d=n._`Array.isArray(${f})`,m=s.let("emErrors");let p,w;const b=s.let("templates");function v(e,t){s.assign(m,n.stringify(e)),s.assign(b,T(e,t))}i&&o?(p=s.let("emChildKwd"),s.if(u),s.if(d,(()=>{v(o,g.items),s.assign(p,n.str`items`)}),(()=>{v(i,g.properties),s.assign(p,n.str`properties`)})),w=n._`[${p}]`):o?(s.if(d),v(o,g.items),w=n._`.items`):i&&(s.if(r.and(u,r.not(d))),v(i,g.properties),w=n._`.properties`),s.forOf("err",l.default.vErrors,(e=>function(e,t,i){s.if(r.and(n._`${e}.keyword !== ${c}`,n._`!${e}.${h}`,n._`${e}.instancePath.indexOf(${C}) === 0`),(()=>{const r=s.scopeValue("pattern",{ref:/^\/([^/]*)(?:\/|$)/,code:n._`new RegExp("^\\\/([^/]*)(?:\\\/|$)")`}),o=s.const("emMatches",n._`${r}.exec(${e}.instancePath.slice(${C}.length))`),a=s.const("emChild",n._`${o} && ${o}[1].replace(/~1/g, "/").replace(/~0/g, "~")`);s.if(n._`${a} !== undefined && ${a} in ${t}`,(()=>i(a)))}))}(e,m,(t=>s.code(n._`${m}[${t}].push(${e})`).assign(n._`${e}.${h}`,!0))))),s.forIn("key",m,(e=>s.if(n._`${m}[${e}].length`,(()=>{a.reportError(t,{message:n._`${e} in ${b} ? ${b}[${e}]() : ${y}${w}[${e}]`,params:n._`{errors: ${m}[${e}]}`}),s.assign(n._`${l.default.vErrors}[${l.default.errors}-1].instancePath`,n._`${C} + "/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`)})))),s.endIf()}(function({properties:e,items:t}){const s={};if(e){s.props={};for(const t in e)s.props[t]=[]}if(t){s.items={};for(let e=0;e<t.length;e++)s.items[e]=[]}return s}(b))}const i="string"==typeof b?b:b._;i&&function(e){const i=s.const("emErrs",n._`[]`);s.forOf("err",l.default.vErrors,(e=>s.if(function(e){return r.and(n._`${e}.keyword !== ${c}`,n._`!${e}.${h}`,r.or(n._`${e}.instancePath === ${C}`,r.and(n._`${e}.instancePath.indexOf(${C}) === 0`,n._`${e}.instancePath[${C}.length] === "/"`)),n._`${e}.schemaPath.indexOf(${w.errSchemaPath}) === 0`,n._`${e}.schemaPath[${w.errSchemaPath}.length] === "/"`)}(e),(()=>s.code(n._`${i}.push(${e})`).assign(n._`${e}.${h}`,!0))))),s.if(n._`${i}.length`,(()=>a.reportError(t,{message:A(e),params:n._`{errors: ${i}}`})))}(i),e.keepErrors||function(){const e=s.const("emErrs",n._`[]`);s.forOf("err",l.default.vErrors,(t=>s.if(n._`!${t}.${h}`,(()=>s.code(n._`${e}.push(${t})`))))),s.assign(l.default.vErrors,e).assign(l.default.errors,n._`${e}.length`)}()}))},metaSchema:{anyOf:[{type:"string"},{type:"object",properties:{properties:{$ref:"#/$defs/stringMap"},items:{$ref:"#/$defs/stringList"},required:{$ref:"#/$defs/stringOrMap"},dependencies:{$ref:"#/$defs/stringOrMap"}},additionalProperties:{type:"string"}}],$defs:{stringMap:{type:"object",additionalProperties:{type:"string"}},stringOrMap:{anyOf:[{type:"string"},{$ref:"#/$defs/stringMap"}]},stringList:{type:"array",items:{type:"string"}}}}}}(t))};t.default=f,e.exports=f,e.exports.default=f},5128:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const n=s(7159),r=s(7299),i=s(1240),o=s(4087),a="https://json-schema.org/draft/2020-12/schema";class l extends n.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),r.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:e,meta:t}=this.opts;t&&(o.default.call(this,e),this.refs["http://json-schema.org/schema"]=a)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}}e.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var c=s(4815);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var h=s(3487);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}});var u=s(7426);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return u.default}});var d=s(6646);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return d.default}})},1581:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const n=s(7159),r=s(3924),i=s(1240),o=s(98),a=["/properties"],l="http://json-schema.org/draft-07/schema";class c extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(o,a):o;this.addMetaSchema(e,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}e.exports=t=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var h=s(4815);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return h.KeywordCxt}});var u=s(3487);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=s(7426);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var m=s(6646);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return m.default}})},7023:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class s{}t._CodeOrName=s,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends s{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=n;class r extends s{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce(((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}function i(e,...t){const s=[e[0]];let n=0;for(;n<t.length;)l(s,t[n]),s.push(e[++n]);return new r(s)}t._Code=r,t.nil=new r(""),t._=i;const o=new r("+");function a(e,...t){const s=[h(e[0])];let n=0;for(;n<t.length;)s.push(o),l(s,t[n]),s.push(o,h(e[++n]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===o){const s=c(e[t-1],e[t+1]);if(void 0!==s){e.splice(t-1,3,s);continue}e[t++]="+"}t++}}(s),new r(s)}function l(e,t){var s;t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push("number"==typeof(s=t)||"boolean"==typeof s||null===s?s:h(Array.isArray(s)?s.join(","):s))}function c(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof n||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof n?void 0:`"${e}${t.slice(1)}`}function h(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=a,t.addCodeArg=l,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},t.stringify=function(e){return new r(h(e))},t.safeStringify=h,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new r(`.${e}`):i`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new r(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new r(e.toString())}},3487:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const n=s(7023),r=s(8490);var i=s(7023);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return i.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return i.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return i.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}});var o=s(8490);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),t.operators={GT:new n._Code(">"),GTE:new n._Code(">="),LT:new n._Code("<"),LTE:new n._Code("<="),EQ:new n._Code("==="),NEQ:new n._Code("!=="),NOT:new n._Code("!"),OR:new n._Code("||"),AND:new n._Code("&&"),ADD:new n._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends a{constructor(e,t,s){super(),this.varKind=e,this.name=t,this.rhs=s}render({es5:e,_n:t}){const s=e?r.varKinds.var:this.varKind,n=void 0===this.rhs?"":` = ${this.rhs}`;return`${s} ${this.name}${n};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=M(this.rhs,e,t)),this}get names(){return this.rhs instanceof n._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(e,t,s){super(),this.lhs=e,this.rhs=t,this.sideEffects=s}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof n.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=M(this.rhs,e,t),this}get names(){return N(this.lhs instanceof n.Name?{}:{...this.lhs.names},this.rhs)}}class h extends c{constructor(e,t,s,n){super(e,s,n),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class u extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class d extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class m extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class p extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=M(this.code,e,t),this}get names(){return this.code instanceof n._CodeOrName?this.code.names:{}}}class f extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce(((t,s)=>t+s.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const s=e[t].optimizeNodes();Array.isArray(s)?e.splice(t,1,...s):s?e[t]=s:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:s}=this;let n=s.length;for(;n--;){const r=s[n];r.optimizeNames(e,t)||(L(e,r.names),s.splice(n,1))}return s.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>x(e,t.names)),{})}}class g extends f{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class y extends f{}class w extends g{}w.kind="else";class b extends g{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new w(e):e}return t?!1===e?t instanceof b?t:t.nodes:this.nodes.length?this:new b(I(e),t instanceof b?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var s;if(this.else=null===(s=this.else)||void 0===s?void 0:s.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=M(this.condition,e,t),this}get names(){const e=super.names;return N(e,this.condition),this.else&&x(e,this.else.names),e}}b.kind="if";class C extends g{}C.kind="for";class v extends C{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=M(this.iteration,e,t),this}get names(){return x(super.names,this.iteration.names)}}class T extends C{constructor(e,t,s,n){super(),this.varKind=e,this.name=t,this.from=s,this.to=n}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:s,from:n,to:i}=this;return`for(${t} ${s}=${n}; ${s}<${i}; ${s}++)`+super.render(e)}get names(){const e=N(super.names,this.from);return N(e,this.to)}}class A extends C{constructor(e,t,s,n){super(),this.loop=e,this.varKind=t,this.name=s,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=M(this.iterable,e,t),this}get names(){return x(super.names,this.iterable.names)}}class S extends g{constructor(e,t,s){super(),this.name=e,this.args=t,this.async=s}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}S.kind="func";class _ extends f{render(e){return"return "+super.render(e)}}_.kind="return";class E extends g{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var s,n;return super.optimizeNames(e,t),null===(s=this.catch)||void 0===s||s.optimizeNames(e,t),null===(n=this.finally)||void 0===n||n.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&x(e,this.catch.names),this.finally&&x(e,this.finally.names),e}}class P extends g{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}P.kind="catch";class $ extends g{render(e){return"finally"+super.render(e)}}function x(e,t){for(const s in t)e[s]=(e[s]||0)+(t[s]||0);return e}function N(e,t){return t instanceof n._CodeOrName?x(e,t.names):e}function M(e,t,s){return e instanceof n.Name?i(e):(r=e)instanceof n._Code&&r._items.some((e=>e instanceof n.Name&&1===t[e.str]&&void 0!==s[e.str]))?new n._Code(e._items.reduce(((e,t)=>(t instanceof n.Name&&(t=i(t)),t instanceof n._Code?e.push(...t._items):e.push(t),e)),[])):e;var r;function i(e){const n=s[e.str];return void 0===n||1!==t[e.str]?e:(delete t[e.str],n)}}function L(e,t){for(const s in t)e[s]=(e[s]||0)-(t[s]||0)}function I(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:n._`!${F(e)}`}$.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new y]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const s=this._extScope.value(e,t);return(this._values[s.prefix]||(this._values[s.prefix]=new Set)).add(s),s}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,s,n){const r=this._scope.toName(t);return void 0!==s&&n&&(this._constants[r.str]=s),this._leafNode(new l(e,r,s)),r}const(e,t,s){return this._def(r.varKinds.const,e,t,s)}let(e,t,s){return this._def(r.varKinds.let,e,t,s)}var(e,t,s){return this._def(r.varKinds.var,e,t,s)}assign(e,t,s){return this._leafNode(new c(e,t,s))}add(e,s){return this._leafNode(new h(e,t.operators.ADD,s))}code(e){return"function"==typeof e?e():e!==n.nil&&this._leafNode(new p(e)),this}object(...e){const t=["{"];for(const[s,r]of e)t.length>1&&t.push(","),t.push(s),(s!==r||this.opts.es5)&&(t.push(":"),(0,n.addCodeArg)(t,r));return t.push("}"),new n._Code(t)}if(e,t,s){if(this._blockNode(new b(e)),t&&s)this.code(t).else().code(s).endIf();else if(t)this.code(t).endIf();else if(s)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new b(e))}else(){return this._elseNode(new w)}endIf(){return this._endBlockNode(b,w)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new v(e),t)}forRange(e,t,s,n,i=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const o=this._scope.toName(e);return this._for(new T(i,o,t,s),(()=>n(o)))}forOf(e,t,s,i=r.varKinds.const){const o=this._scope.toName(e);if(this.opts.es5){const e=t instanceof n.Name?t:this.var("_arr",t);return this.forRange("_i",0,n._`${e}.length`,(t=>{this.var(o,n._`${e}[${t}]`),s(o)}))}return this._for(new A("of",i,o,t),(()=>s(o)))}forIn(e,t,s,i=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,n._`Object.keys(${t})`,s);const o=this._scope.toName(e);return this._for(new A("in",i,o,t),(()=>s(o)))}endFor(){return this._endBlockNode(C)}label(e){return this._leafNode(new u(e))}break(e){return this._leafNode(new d(e))}return(e){const t=new _;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(_)}try(e,t,s){if(!t&&!s)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new E;if(this._blockNode(n),this.code(e),t){const e=this.name("e");this._currNode=n.catch=new P(e),t(e)}return s&&(this._currNode=n.finally=new $,this.code(s)),this._endBlockNode(P,$)}throw(e){return this._leafNode(new m(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const s=this._nodes.length-t;if(s<0||void 0!==e&&s!==e)throw new Error(`CodeGen: wrong number of nodes: ${s} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=n.nil,s,r){return this._blockNode(new S(e,t,s)),r&&this.code(r).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const s=this._currNode;if(s instanceof e||t&&s instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof b))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},t.not=I;const R=k(t.operators.AND);t.and=function(...e){return e.reduce(R)};const O=k(t.operators.OR);function k(e){return(t,s)=>t===n.nil?s:s===n.nil?t:n._`${F(t)} ${e} ${F(s)}`}function F(e){return e instanceof n.Name?e:n._`(${e})`}t.or=function(...e){return e.reduce(O)}},8490:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const n=s(7023);class r extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var i;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(i=t.UsedValueState||(t.UsedValueState={})),t.varKinds={const:new n.Name("const"),let:new n.Name("let"),var:new n.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof n.Name?e:this.name(e)}name(e){return new n.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,s;if((null===(s=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===s?void 0:s.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=o;class a extends n.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:s}){this.value=e,this.scopePath=n._`.${new n.Name(t)}[${s}]`}}t.ValueScopeName=a;const l=n._`\n`;t.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?l:n.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var s;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const n=this.toName(e),{prefix:r}=n,i=null!==(s=t.key)&&void 0!==s?s:t.ref;let o=this._values[r];if(o){const e=o.get(i);if(e)return e}else o=this._values[r]=new Map;o.set(i,n);const a=this._scope[r]||(this._scope[r]=[]),l=a.length;return a[l]=t.ref,n.setValue(t,{property:r,itemIndex:l}),n}getValue(e,t){const s=this._values[e];if(s)return s.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(t=>{if(void 0===t.scopePath)throw new Error(`CodeGen: name "${t}" has no value`);return n._`${e}${t.scopePath}`}))}scopeCode(e=this._values,t,s){return this._reduceValues(e,(e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,s)}_reduceValues(e,s,o={},a){let l=n.nil;for(const c in e){const h=e[c];if(!h)continue;const u=o[c]=o[c]||new Map;h.forEach((e=>{if(u.has(e))return;u.set(e,i.Started);let o=s(e);if(o){const s=this.opts.es5?t.varKinds.var:t.varKinds.const;l=n._`${l}${s} ${e} = ${o};${this.opts._n}`}else{if(!(o=null==a?void 0:a(e)))throw new r(e);l=n._`${l}${o}${this.opts._n}`}u.set(e,i.Completed)}))}return l}}},4181:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const n=s(3487),r=s(6776),i=s(2141);function o(e,t){const s=e.const("err",t);e.if(n._`${i.default.vErrors} === null`,(()=>e.assign(i.default.vErrors,n._`[${s}]`)),n._`${i.default.vErrors}.push(${s})`),e.code(n._`${i.default.errors}++`)}function a(e,t){const{gen:s,validateName:r,schemaEnv:i}=e;i.$async?s.throw(n._`new ${e.ValidationError}(${t})`):(s.assign(n._`${r}.errors`,t),s.return(!1))}t.keywordError={message:({keyword:e})=>n.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?n.str`"${e}" keyword must be ${t} ($data)`:n.str`"${e}" keyword is invalid ($data)`},t.reportError=function(e,s=t.keywordError,r,i){const{it:l}=e,{gen:h,compositeRule:u,allErrors:d}=l,m=c(e,s,r);(null!=i?i:u||d)?o(h,m):a(l,n._`[${m}]`)},t.reportExtraError=function(e,s=t.keywordError,n){const{it:r}=e,{gen:l,compositeRule:h,allErrors:u}=r;o(l,c(e,s,n)),h||u||a(r,i.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(i.default.errors,t),e.if(n._`${i.default.vErrors} !== null`,(()=>e.if(t,(()=>e.assign(n._`${i.default.vErrors}.length`,t)),(()=>e.assign(i.default.vErrors,null)))))},t.extendErrors=function({gen:e,keyword:t,schemaValue:s,data:r,errsCount:o,it:a}){if(void 0===o)throw new Error("ajv implementation error");const l=e.name("err");e.forRange("i",o,i.default.errors,(o=>{e.const(l,n._`${i.default.vErrors}[${o}]`),e.if(n._`${l}.instancePath === undefined`,(()=>e.assign(n._`${l}.instancePath`,(0,n.strConcat)(i.default.instancePath,a.errorPath)))),e.assign(n._`${l}.schemaPath`,n.str`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign(n._`${l}.schema`,s),e.assign(n._`${l}.data`,r))}))};const l={keyword:new n.Name("keyword"),schemaPath:new n.Name("schemaPath"),params:new n.Name("params"),propertyName:new n.Name("propertyName"),message:new n.Name("message"),schema:new n.Name("schema"),parentSchema:new n.Name("parentSchema")};function c(e,t,s){const{createErrors:r}=e.it;return!1===r?n._`{}`:function(e,t,s={}){const{gen:r,it:o}=e,a=[h(o,s),u(e,s)];return function(e,{params:t,message:s},r){const{keyword:o,data:a,schemaValue:c,it:h}=e,{opts:u,propertyName:d,topSchemaRef:m,schemaPath:p}=h;r.push([l.keyword,o],[l.params,"function"==typeof t?t(e):t||n._`{}`]),u.messages&&r.push([l.message,"function"==typeof s?s(e):s]),u.verbose&&r.push([l.schema,c],[l.parentSchema,n._`${m}${p}`],[i.default.data,a]),d&&r.push([l.propertyName,d])}(e,t,a),r.object(...a)}(e,t,s)}function h({errorPath:e},{instancePath:t}){const s=t?n.str`${e}${(0,r.getErrorPath)(t,r.Type.Str)}`:e;return[i.default.instancePath,(0,n.strConcat)(i.default.instancePath,s)]}function u({keyword:e,it:{errSchemaPath:t}},{schemaPath:s,parentSchema:i}){let o=i?t:n.str`${t}/${e}`;return s&&(o=n.str`${o}${(0,r.getErrorPath)(s,r.Type.Str)}`),[l.schemaPath,o]}},5173:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const n=s(3487),r=s(7426),i=s(2141),o=s(2531),a=s(6776),l=s(4815);class c{constructor(e){var t;let s;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(s=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,o.normalizeId)(null==s?void 0:s[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==s?void 0:s.$async,this.refs={}}}function h(e){const t=d.call(this,e);if(t)return t;const s=(0,o.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:a,lines:c}=this.opts.code,{ownProperties:h}=this.opts,u=new n.CodeGen(this.scope,{es5:a,lines:c,ownProperties:h});let m;e.$async&&(m=u.scopeValue("Error",{ref:r.default,code:n._`require("ajv/dist/runtime/validation_error").default`}));const p=u.scopeName("validate");e.validateName=p;const f={gen:u,allErrors:this.opts.allErrors,data:i.default.data,parentData:i.default.parentData,parentDataProperty:i.default.parentDataProperty,dataNames:[i.default.data],dataPathArr:[n.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:u.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,n.stringify)(e.schema)}:{ref:e.schema}),validateName:p,ValidationError:m,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:n.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:n._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(e),(0,l.validateFunctionCode)(f),u.optimize(this.opts.code.optimize);const t=u.toString();g=`${u.scopeRefs(i.default.scope)}return ${t}`,this.opts.code.process&&(g=this.opts.code.process(g,e));const s=new Function(`${i.default.self}`,`${i.default.scope}`,g)(this,this.scope.get());if(this.scope.value(p,{ref:s}),s.errors=null,s.schema=e.schema,s.schemaEnv=e,e.$async&&(s.$async=!0),!0===this.opts.code.source&&(s.source={validateName:p,validateCode:t,scopeValues:u._values}),this.opts.unevaluated){const{props:e,items:t}=f;s.evaluated={props:e instanceof n.Name?void 0:e,items:t instanceof n.Name?void 0:t,dynamicProps:e instanceof n.Name,dynamicItems:t instanceof n.Name},s.source&&(s.source.evaluated=(0,n.stringify)(s.evaluated))}return e.validate=s,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error("Error compiling schema, function code:",g),t}finally{this._compilations.delete(e)}}function u(e){return(0,o.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:h.call(this,e)}function d(e){for(const n of this._compilations)if(s=e,(t=n).schema===s.schema&&t.root===s.root&&t.baseId===s.baseId)return n;var t,s}function m(e,t){let s;for(;"string"==typeof(s=this.refs[t]);)t=s;return s||this.schemas[t]||p.call(this,e,t)}function p(e,t){const s=this.opts.uriResolver.parse(t),n=(0,o._getFullPath)(this.opts.uriResolver,s);let r=(0,o.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===r)return g.call(this,s,e);const i=(0,o.normalizeId)(n),a=this.refs[i]||this.schemas[i];if("string"==typeof a){const t=p.call(this,e,a);if("object"!=typeof(null==t?void 0:t.schema))return;return g.call(this,s,t)}if("object"==typeof(null==a?void 0:a.schema)){if(a.validate||h.call(this,a),i===(0,o.normalizeId)(t)){const{schema:t}=a,{schemaId:s}=this.opts,n=t[s];return n&&(r=(0,o.resolveUrl)(this.opts.uriResolver,r,n)),new c({schema:t,schemaId:s,root:e,baseId:r})}return g.call(this,s,a)}}t.SchemaEnv=c,t.compileSchema=h,t.resolveRef=function(e,t,s){var n;s=(0,o.resolveUrl)(this.opts.uriResolver,t,s);const r=e.refs[s];if(r)return r;let i=m.call(this,e,s);if(void 0===i){const r=null===(n=e.localRefs)||void 0===n?void 0:n[s],{schemaId:o}=this.opts;r&&(i=new c({schema:r,schemaId:o,root:e,baseId:t}))}return void 0!==i?e.refs[s]=u.call(this,i):void 0},t.getCompilingSchema=d,t.resolveSchema=p;const f=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function g(e,{baseId:t,schema:s,root:n}){var r;if("/"!==(null===(r=e.fragment)||void 0===r?void 0:r[0]))return;for(const n of e.fragment.slice(1).split("/")){if("boolean"==typeof s)return;const e=s[(0,a.unescapeFragment)(n)];if(void 0===e)return;const r="object"==typeof(s=e)&&s[this.opts.schemaId];!f.has(n)&&r&&(t=(0,o.resolveUrl)(this.opts.uriResolver,t,r))}let i;if("boolean"!=typeof s&&s.$ref&&!(0,a.schemaHasRulesButRef)(s,this.RULES)){const e=(0,o.resolveUrl)(this.opts.uriResolver,t,s.$ref);i=p.call(this,n,e)}const{schemaId:l}=this.opts;return i=i||new c({schema:s,schemaId:l,root:n,baseId:t}),i.schema!==i.root.schema?i:void 0}},2141:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r={data:new n.Name("data"),valCxt:new n.Name("valCxt"),instancePath:new n.Name("instancePath"),parentData:new n.Name("parentData"),parentDataProperty:new n.Name("parentDataProperty"),rootData:new n.Name("rootData"),dynamicAnchors:new n.Name("dynamicAnchors"),vErrors:new n.Name("vErrors"),errors:new n.Name("errors"),this:new n.Name("this"),self:new n.Name("self"),scope:new n.Name("scope"),json:new n.Name("json"),jsonPos:new n.Name("jsonPos"),jsonLen:new n.Name("jsonLen"),jsonPart:new n.Name("jsonPart")};t.default=r},6646:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(2531);class r extends Error{constructor(e,t,s,r){super(r||`can't resolve reference ${s} from id ${t}`),this.missingRef=(0,n.resolveUrl)(e,t,s),this.missingSchema=(0,n.normalizeId)((0,n.getFullPath)(e,this.missingRef))}}t.default=r},2531:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;const n=s(6776),r=s(4063),i=s(9461),o=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!l(e):!!t&&c(e)<=t)};const a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l(e){for(const t in e){if(a.has(t))return!0;const s=e[t];if(Array.isArray(s)&&s.some(l))return!0;if("object"==typeof s&&l(s))return!0}return!1}function c(e){let t=0;for(const s in e){if("$ref"===s)return 1/0;if(t++,!o.has(s)&&("object"==typeof e[s]&&(0,n.eachItem)(e[s],(e=>t+=c(e))),t===1/0))return 1/0}return t}function h(e,t="",s){!1!==s&&(t=m(t));const n=e.parse(t);return u(e,n)}function u(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=h,t._getFullPath=u;const d=/#\/?$/;function m(e){return e?e.replace(d,""):""}t.normalizeId=m,t.resolveUrl=function(e,t,s){return s=m(s),e.resolve(t,s)};const p=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:s,uriResolver:n}=this.opts,o=m(e[s]||t),a={"":o},l=h(n,o,!1),c={},u=new Set;return i(e,{allKeys:!0},((e,t,n,r)=>{if(void 0===r)return;const i=l+t;let o=a[r];function h(t){const s=this.opts.uriResolver.resolve;if(t=m(o?s(o,t):t),u.has(t))throw f(t);u.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?d(e,n.schema,t):t!==m(i)&&("#"===t[0]?(d(e,c[t],t),c[t]=e):this.refs[t]=i),t}function g(e){if("string"==typeof e){if(!p.test(e))throw new Error(`invalid anchor "${e}"`);h.call(this,`#${e}`)}}"string"==typeof e[s]&&(o=h.call(this,e[s])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),a[t]=o})),c;function d(e,t,s){if(void 0!==t&&!r(e,t))throw f(s)}function f(e){return new Error(`reference "${e}" resolves to more than one schema`)}}},3141:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;const s=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&s.has(e)},t.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},6776:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;const n=s(3487),r=s(7023);function i(e,t=e.schema){const{opts:s,self:n}=e;if(!s.strictSchema)return;if("boolean"==typeof t)return;const r=n.RULES.keywords;for(const s in t)r[s]||p(e,`unknown keyword: "${s}"`)}function o(e,t){if("boolean"==typeof e)return!e;for(const s in e)if(t[s])return!0;return!1}function a(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function l(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function c({mergeNames:e,mergeToName:t,mergeValues:s,resultToName:r}){return(i,o,a,l)=>{const c=void 0===a?o:a instanceof n.Name?(o instanceof n.Name?e(i,o,a):t(i,o,a),a):o instanceof n.Name?(t(i,a,o),o):s(o,a);return l!==n.Name||c instanceof n.Name?c:r(i,c)}}function h(e,t){if(!0===t)return e.var("props",!0);const s=e.var("props",n._`{}`);return void 0!==t&&u(e,s,t),s}function u(e,t,s){Object.keys(s).forEach((s=>e.assign(n._`${t}${(0,n.getProperty)(s)}`,!0)))}t.toHash=function(e){const t={};for(const s of e)t[s]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(i(e,t),!o(t,e.self.RULES.all))},t.checkUnknownRules=i,t.schemaHasRules=o,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const s in e)if("$ref"!==s&&t.all[s])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},s,r,i){if(!i){if("number"==typeof s||"boolean"==typeof s)return s;if("string"==typeof s)return n._`${s}`}return n._`${e}${t}${(0,n.getProperty)(r)}`},t.unescapeFragment=function(e){return l(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(a(e))},t.escapeJsonPointer=a,t.unescapeJsonPointer=l,t.eachItem=function(e,t){if(Array.isArray(e))for(const s of e)t(s);else t(e)},t.mergeEvaluated={props:c({mergeNames:(e,t,s)=>e.if(n._`${s} !== true && ${t} !== undefined`,(()=>{e.if(n._`${t} === true`,(()=>e.assign(s,!0)),(()=>e.assign(s,n._`${s} || {}`).code(n._`Object.assign(${s}, ${t})`)))})),mergeToName:(e,t,s)=>e.if(n._`${s} !== true`,(()=>{!0===t?e.assign(s,!0):(e.assign(s,n._`${s} || {}`),u(e,s,t))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:h}),items:c({mergeNames:(e,t,s)=>e.if(n._`${s} !== true && ${t} !== undefined`,(()=>e.assign(s,n._`${t} === true ? true : ${s} > ${t} ? ${s} : ${t}`))),mergeToName:(e,t,s)=>e.if(n._`${s} !== true`,(()=>e.assign(s,!0===t||n._`${s} > ${t} ? ${s} : ${t}`))),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=h,t.setEvaluated=u;const d={};var m;function p(e,t,s=e.opts.strictSchema){if(s){if(t=`strict mode: ${t}`,!0===s)throw new Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:d[t.code]||(d[t.code]=new r._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(m=t.Type||(t.Type={})),t.getErrorPath=function(e,t,s){if(e instanceof n.Name){const r=t===m.Num;return s?r?n._`"[" + ${e} + "]"`:n._`"['" + ${e} + "']"`:r?n._`"/" + ${e}`:n._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return s?(0,n.getProperty)(e).toString():"/"+a(e)},t.checkStrictMode=p},8876:(e,t)=>{"use strict";function s(e,t){return t.rules.some((t=>n(e,t)))}function n(e,t){var s;return void 0!==e[t.keyword]||(null===(s=t.definition.implements)||void 0===s?void 0:s.some((t=>void 0!==e[t])))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},n){const r=t.RULES.types[n];return r&&!0!==r&&s(e,r)},t.shouldUseGroup=s,t.shouldUseRule=n},5667:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const n=s(4181),r=s(3487),i=s(2141),o={message:"boolean schema is false"};function a(e,t){const{gen:s,data:r}=e,i={gen:s,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,n.reportError)(i,o,void 0,t)}t.topBoolOrEmptySchema=function(e){const{gen:t,schema:s,validateName:n}=e;!1===s?a(e,!1):"object"==typeof s&&!0===s.$async?t.return(i.default.data):(t.assign(r._`${n}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){const{gen:s,schema:n}=e;!1===n?(s.var(t,!1),a(e)):s.var(t,!0)}},453:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;const n=s(3141),r=s(8876),i=s(4181),o=s(3487),a=s(6776);var l;function c(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(n.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(l=t.DataType||(t.DataType={})),t.getSchemaTypes=function(e){const t=c(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=c,t.coerceAndCheckDataType=function(e,t){const{gen:s,data:n,opts:i}=e,a=function(e,t){return t?e.filter((e=>h.has(e)||"array"===t&&"array"===e)):[]}(t,i.coerceTypes),c=t.length>0&&!(0===a.length&&1===t.length&&(0,r.schemaHasRulesForType)(e,t[0]));if(c){const r=d(t,n,i.strictNumbers,l.Wrong);s.if(r,(()=>{a.length?function(e,t,s){const{gen:n,data:r,opts:i}=e,a=n.let("dataType",o._`typeof ${r}`),l=n.let("coerced",o._`undefined`);"array"===i.coerceTypes&&n.if(o._`${a} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,(()=>n.assign(r,o._`${r}[0]`).assign(a,o._`typeof ${r}`).if(d(t,r,i.strictNumbers),(()=>n.assign(l,r))))),n.if(o._`${l} !== undefined`);for(const e of s)(h.has(e)||"array"===e&&"array"===i.coerceTypes)&&c(e);function c(e){switch(e){case"string":return void n.elseIf(o._`${a} == "number" || ${a} == "boolean"`).assign(l,o._`"" + ${r}`).elseIf(o._`${r} === null`).assign(l,o._`""`);case"number":return void n.elseIf(o._`${a} == "boolean" || ${r} === null
|
|
2
|
+
var bio_test;(()=>{var e={2012:(e,t,s)=>{"use strict";s.d(t,{f:()=>r});var n=s(9976);class r extends n.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,r)),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,r)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new r({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(e){const t=e in r.aaSynonyms?r.aaSynonyms[e]:e;return super.get(t)}}r.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class i{static getPalette(e="grok"){switch(e){case"grok":return r.GrokGroups;case"lesk":return r.Lesk;default:throw new Error(`ChemPalette: scheme \`${e}\` does not exist`)}}static getInnerOuter(e){let t=0,s="",n="";for(const r of e)"("==r?t++:")"==r?t--:t?s+=r:n+=r;return isNaN(parseInt(s))?[n,s]:[n,""]}static getColorAAPivot(e="",t="grok"){const s=this.getPalette(t);let[n,r]=this.getInnerOuter(e);if(n=n.length>6?`${n.slice(0,3)}...`:n,r=r.length>6?`${r.slice(0,3)}...`:r,1==e.length||"("==e[1]){const t=e[0]?.toUpperCase();return t in s?[s.get(t),t,r,1]:[this.undefinedColor,n,r,1]}if("d"==e[0]&&e[1]in s&&(2==e.length||"("==e[2])){const t=e[1]?.toUpperCase();return t in s?[s.get(t),t,r,2]:[this.undefinedColor,n,r,2]}if(e.substring(0,3)in this.AAFullNames&&(3==e.length||"("==e[3])){const t=this.AAFullNames[e.substring(0,3)];return t in s?[s.get(t),t,r,3]:[this.undefinedColor,n,r,3]}if(e[0]?.toLowerCase()==e[0]&&e.substring(1,3)in this.AAFullNames&&(4==e.length||"("==e[4])){const t=this.AAFullNames[e.substring(1,3)];return t in s?[s.get(t),t,r,4]:[this.undefinedColor,n,r,4]}return[this.undefinedColor,n,r,0]}}i.SemType="Aminoacids",i.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",i.undefinedColor="rgb(100,100,100)",i.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"},i.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"},i.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(*)*"},i.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"}},6584:(e,t,s)=>{"use strict";s.d(t,{BX:()=>i,nW:()=>l,tW:()=>c,tb:()=>h});var n=s(4469);const r="Libraries",i="System:AppData/Bio/monomer-libraries/",o={explicit:["HELMCoreLibrary.json"],exclude:[]};let a=Promise.resolve();async function l(){let e;return a=a.then((async()=>{const t=await n.dapi.userDataStorage.getValue(r,"Settings",!0);e=t?JSON.parse(t):{exclude:[],explicit:[]},e.exclude=e.exclude instanceof Array?e.exclude:[],e.explicit=e.explicit instanceof Array?e.explicit:[],console.debug(`Bio: getUserLibSettings()\n${JSON.stringify(e,void 0,2)}`)})),await a,e}async function c(e){a=a.then((async()=>{console.debug(`Bio: setUserLibSettings()\n${JSON.stringify(e,void 0,2)}`),await n.dapi.userDataStorage.postValue(r,"Settings",JSON.stringify(e),!0)})),await a}async function h(){await c(o)}},7228:(e,t,s)=>{"use strict";s.d(t,{JN:()=>o,Qx:()=>a});var n=s(976),r=s(4469),i=(s(1047),s(499),s(8457));async function o(){const e=n.Func.find({package:"Bio",name:"getMonomerLibHelper"});if(0===e.length)throw new Error('Package "Bio" must be installed for MonomerLibHelper.');return(await e[0].prepare().call()).getOutputParamValue()}async function a(e,t){e instanceof n.Column&&(e=(0,i.O)(e).columns.toList());const s=(await o()).getBioLib(),a=new Array(e.length),l=e[0].length,c=new Float32Array(l);for(let i=0;i<e.length;++i){const o=t[i],h=s.getMonomer("PEPTIDE",o)?.smiles??"",u=e[i],d=u.getRawData(),m=u.categories,p=m.indexOf("");if(a[i]={categories:m,data:d,emptyIndex:p},void 0===o)continue;const f=n.Column.fromStrings("smiles",m.map((e=>s.getMonomer("PEPTIDE",e)?.smiles??""))),g=(n.DataFrame.fromColumns([f]),(await r.chem.getSimilarities(f,h)).getRawData());for(let e=0;e<l;++e){const t=d[e];c[e]+=""!==o&&t!==p?g[t]:""===o&&t===p?1:0}}for(let s=0;s<c.length;++s){let r=c[s]/t.length;for(let i=0;i<e.length;++i){const e=a[i];if(i>=t.length&&e.data[s]!==e.emptyIndex||e.data[s]===e.emptyIndex&&i<t.length){r=n.FLOAT_NULL;break}}c[s]=r}return n.Column.fromFloat32Array("Similarity",c)}s(5697)},8601:(e,t,s)=>{"use strict";s.d(t,{i0:()=>d});var n=s(4469),r=s(976),i=s(6414),o=s.n(i),a=s(1821),l=s(499);const c={V2K_RGP_SHIFT:8,V2K_RGP_LINE:"M RGP",V2K_A_LINE:"A ",V3K_COUNTS_SHIFT:14,V3K_IDX_SHIFT:7,V3K_HEADER_FIRST_LINE:"\nDatagrok macromolecule handler\n\n",V3K_HEADER_SECOND_LINE:" 0 0 0 0 0 0 999 V3000\n",V3K_BEGIN_CTAB_BLOCK:"M V30 BEGIN CTAB\n",V3K_END_CTAB_BLOCK:"M V30 END CTAB\n",V3K_BEGIN_COUNTS_LINE:"M V30 COUNTS ",V3K_COUNTS_LINE_ENDING:" 0 0 0\n",V3K_BEGIN_ATOM_BLOCK:"M V30 BEGIN ATOM\n",V3K_END_ATOM_BLOCK:"M V30 END ATOM\n",V3K_BEGIN_BOND_BLOCK:"M V30 BEGIN BOND\n",V3K_END_BOND_BLOCK:"M V30 END BOND\n",V3K_BOND_CONFIG:" CFG=",V3K_BEGIN_DATA_LINE:"M V30 ",V3K_END:"M END",PRECISION_FACTOR:1e4,DEOXYRIBOSE:"d",RIBOSE:"r",PHOSPHATE:"p",OXYGEN:"O",HYDROGEN:"H"};var h=s(1047);function u(e){return Math.round(c.PRECISION_FACTOR*e)/c.PRECISION_FACTOR}async function d(e,t,i){if(0===r.Func.find({package:"Chem",name:"getRdKitModule"}).length)return{col:null,warnings:['Transformation to atomic level requires the package "Chem" installed.']};if(t.semType!==r.SEMTYPE.MACROMOLECULE)return{col:null,warnings:[`Only the ${r.SEMTYPE.MACROMOLECULE} columns can be converted to atomic level, the chosen column has semType '${t.semType}'`]};let u=t;const d=l.Cn.getOrCreate(t);d.isHelm()&&(u=d.convert(a.r2.SEPARATOR,"."),u.name=t.name);const p=l.Cn.getOrCreate(u).alphabet;let f;if("PT"===p||"UN"===p)f="PEPTIDE";else{if("RNA"!==p&&"DNA"!==p)return{col:null,warnings:[`Unexpected column's '${u.name}' alphabet '${p}'.`]};f="RNA"}const g=function(e){const t=e.length,s=new Array(t),r=l.Cn.getOrCreate(e),i=r.getSplitter();let a=!1;for(let n=0;n<t;++n){const t=e.get(n);a||(a=""===t),s[n]=t?o()(i(t)).filter((e=>!r.isGap(e))).toArray():[]}return a&&n.shell.warning(`Some values in the "${e.name}" column are empty`),s}(u),y=await async function(e,t,s,r){const i=function(e,t,s){const n=new Map;for(const r of e.getMonomerSymbolsByType(t)){const i=e.getMonomer(t,r);if("RNA"===t&&("Branch"===i.monomerType||"DNA"===s&&i.symbol===c.DEOXYRIBOSE||"RNA"===s&&i.symbol===c.RIBOSE||i.symbol===c.PHOSPHATE)||"PEPTIDE"===t&&"Branch"!==i.monomerType){const e={};h.rx.forEach((t=>{e[t]=i[t]})),n.set(i.symbol,e)}}return n}(t,s,r),o=new Map,a=await n.functions.call("Chem:getRdKitModule"),l={value:null};if("RNA"===s){const e="RNA"===r?[c.RIBOSE,c.PHOSPHATE]:[c.DEOXYRIBOSE,c.PHOSPHATE];for(const t of e)m(o,t,i,a,s,l)}for(let t=0;t<e.length;++t){const n=e[t];for(const e of n)if(""!==e)try{m(o,e,i,a,s,l)}catch(t){const s=t instanceof Error?t.message:t.toString(),n=t instanceof Error?t.stack:void 0;throw console.error(`bio lib: getMonomersDictFromLib() sym='${e}', error:\n${s}\n${n}`),new Error(`Can't get monomer '${e}' from library: ${s}`)}}return o}(g,i,f,p),b=u.length,{molfileList:w,molfileWarningList:C}=await async function(e,t,n,r,i){const o=Math.max(navigator.hardwareConcurrency-2,1),a=new Array(o).fill(null).map((()=>new Worker(new URL(s.p+s.u(79),s.b)))),l=i/o;let c=[],h=[];const u=new Array(o);for(let s=0;s<o;s++){const c=Math.floor(s*l),h=s===o-1?i:Math.floor((s+1)*l);a[s].postMessage({monomerSequencesArray:e,monomersDict:t,alphabet:n,polymerType:r,start:c,end:h}),u[s]=new Promise((e=>{a[s].onmessage=({data:{molfileList:t,molfileWarningList:s}})=>{e({molfileList:t,molfileWarningList:s})}}))}return(await Promise.all(u)).forEach((e=>{c=c.concat(...e.molfileList),h=h.concat(...e.molfileWarningList)})),setTimeout((()=>{a.forEach((e=>{e.terminate()}))}),0),{molfileList:c,molfileWarningList:h}}(g,y,p,f,b);if(C.length>.05*b)throw new Error("Too many errors getting molfiles.");const v=`molfile(${u.name})`,T=e.columns.getUnusedName(v),A=r.Column.fromStrings(T,w);return A.semType=r.SEMTYPE.MOLECULE,A.setTag(r.TAGS.UNITS,r.UNITS.Molecule.MOLBLOCK),{col:A,warnings:C}}function m(e,t,s,n,r,i){if(!e.has(t)){const o=function(e,t,s,n,r){if(t.has(e)){const i=t.get(e),o=function(e){const t=[];for(const s of e){let e=s.capGroupSMILES;e||(e=s.capGroupSMILES),e=e.replace(/(\[|\]|\*|:|\d)/g,""),t.push(e)}return t}(i.rgroups),a=function(e){const t=new Map;let s=e.indexOf(c.V2K_A_LINE,0),n=s;for(;-1!==s;){n=e.indexOf("\n",s);const r=parseInt(e.substring(s,n).replace(/^A\s+/,""));s=e.indexOf("R",n),n=e.indexOf("\n",s);const i=parseInt(e.substring(s,n).replace(/^R/,""));t.set(r,i),s=e.indexOf(c.V2K_A_LINE,n)}for(s=e.indexOf(c.V2K_RGP_LINE,0),n=e.indexOf("\n",s);-1!==s;){s+=c.V2K_RGP_SHIFT,n=e.indexOf("\n",s);const r=e.substring(s,n).replaceAll(/\s+/g," ").split(" ").map((e=>parseInt(e))).slice(1);for(let e=0;e<r.length;e+=2){if(t.has(r[e])&&t.get(r[e])!==r[e+1])throw new Error(`r-group index ${r[e]} has already been added with a different value`);t.set(r[e],r[e+1])}s=e.indexOf(c.V2K_RGP_LINE,n)}return t}(i.molfile),l=function(e,t){const s=t.get_mol(e),n=s.get_v3Kmolblock();return s.delete(),n}(function(e){let t=e.indexOf(c.V2K_A_LINE,0);-1===t&&(t=e.indexOf(c.V2K_RGP_LINE));const s=e.indexOf(c.V3K_END,t);return e.substring(0,t)+e.substring(s)}(i.molfile),s),h=function(e){let t=(e=e.replaceAll("\r","")).indexOf(c.V3K_BEGIN_COUNTS_LINE)+c.V3K_COUNTS_SHIFT,s=e.indexOf(" ",t+1);const n=parseInt(e.substring(t,s));return t=s+1,s=e.indexOf(" ",t+1),{atomCount:n,bondCount:parseInt(e.substring(t,s))}}(l),d=function(e,t){const s=new Array(t),n=new Float32Array(t),r=new Float32Array(t),i=new Array(t);let o=e.indexOf(c.V3K_BEGIN_ATOM_BLOCK);o=e.indexOf("\n",o);let a=o;for(let l=0;l<t;l++){o=e.indexOf(c.V3K_BEGIN_DATA_LINE,o)+c.V3K_IDX_SHIFT,a=e.indexOf(" ",o),o=a+1,a=e.indexOf(" ",o),s[l]=e.substring(o,a);const t=new Array(2);for(let s=0;s<2;++s)o=a+1,a=e.indexOf(" ",o),t[s]=parseFloat(e.substring(o,a));n[l]=t[0],r[l]=t[1],o=a,a=e.indexOf("\n",o)+1,i[l]=e.slice(o,a),o=a}return{atomTypes:s,x:n,y:r,kwargs:i}}(l,h.atomCount),m=function(e,t){const s=new Uint32Array(t),n=new Array(t),r=new Map,i=new Map;let o=e.indexOf(c.V3K_BEGIN_BOND_BLOCK);o=e.indexOf("\n",o);let a=o;for(let l=0;l<t;++l){const t=new Array(3);o=e.indexOf(c.V3K_BEGIN_DATA_LINE,a)+c.V3K_IDX_SHIFT,a=e.indexOf(" ",o);for(let s=0;s<3;++s)o=a+1,a=Math.min(e.indexOf("\n",o),e.indexOf(" ",o)),t[s]=parseInt(e.slice(o,a));s[l]=t[0],n[l]=t.slice(1);const h=e.indexOf("\n",o);let u=e.slice(a,h),d=u.indexOf(c.V3K_BOND_CONFIG);if(-1!==d){d=u.indexOf("=",d)+1;let e=u.indexOf(" ",d);-1===e&&(e=u.length);const t=parseInt(u.slice(d,e));r.set(l,t);const s=c.V3K_BOND_CONFIG+t.toString();u=u.replace(s,"")}u||i.set(l,u)}return{bondTypes:s,atomPairs:n,bondConfiguration:r,kwargs:i}}(l,h.bondCount),y={atoms:d,bonds:m,meta:p(d,m,o,a)};return"PEPTIDE"===n?function(e){const t=e.meta.terminalNodes[0]-1,s=e.meta.rNodes[0]-1,n=e.atoms.x,r=e.atoms.y;A(e,-n[t],-r[t]);const i=C(n[s],r[s]);v(e.atoms,-i),n[e.meta.rNodes[1]-1]<0&&function(e){T(e,!1)}(e);const o=function(e){const t=function(e){const t=new Map;for(const s of e.bonds.atomPairs)for(let e=0;e<2;e++){const n=s[e],r=s[(e+1)%2];t.has(n)?t.get(n)?.push(r):t.set(n,new Array(1).fill(r))}return t}(e);let s=0;const n=e.atoms.atomTypes.length;let r=0;for(;0===s;){const i=t.get(e.meta.terminalNodes[1])[r];if(e.atoms.atomTypes[i-1]===c.OXYGEN&&i!==e.meta.rNodes[1]&&(s=i),r++,r>n)throw new Error(`Search for double-bonded Oxygen in ${e} has exceeded the limit of ${n}`)}return s}(e);!function(e,t){e.atoms.y[e.meta.rNodes[1]-1]<0&&e.atoms.y[t-1]<0&&(function(e){T(e,!0)}(e),v(e.atoms,-function(e,t){return C(e,t)+Math.PI/2}(e.atoms.x[e.meta.terminalNodes[1]-1],e.atoms.y[e.meta.terminalNodes[1]-1])))}(e,o),function(e,t){const s=e.atoms.x;s[e.meta.rNodes[1]-1]>s[t-1]&&function(e,t,s){const n=t-1,r=s-1,i=e.atoms.x,o=e.atoms.y,a=i[n],l=o[n];i[n]=i[r],o[n]=o[r],i[r]=a,o[r]=l}(e,t,e.meta.rNodes[1])}(e,o)}(y):e===c.RIBOSE||e===c.DEOXYRIBOSE?function(e,t){const s=e.atoms.x,n=e.atoms.y;let r=e.meta.terminalNodes[0]-1;const i=e.meta.rNodes[1]-1;A(e,-s[r],-n[r]);const o=C(s[i],n[i]);v(e.atoms,3*Math.PI/2-o),t.value=function(e){const t=e.atoms.x,s=e.atoms.y,n=e.meta.rNodes[2]-1,r=e.meta.terminalNodes[2]-1,i=t[n]-t[r],o=s[n]-s[r];return Math.atan(o/i)+Math.PI/2}(e),r=e.meta.terminalNodes[0]-1,A(e,-s[r],-n[r])}(y,r):e===c.PHOSPHATE?function(e){const t=e.meta.terminalNodes[0]-1,s=e.meta.rNodes[0]-1,n=e.atoms.x,r=e.atoms.y;A(e,-n[t],-r[t]);const i=C(n[s],r[s]);v(e.atoms,Math.PI/2-i)}(y):function(e,t){const s=e.atoms.x,n=e.atoms.y,r=e.meta.terminalNodes[0]-1,i=e.meta.rNodes[0]-1;A(e,-s[r],-n[r]);const o=C(s[i],n[i]),a=t.value;if(!a)throw new Error("The value of sugarBranchToOYAngle is null");v(e.atoms,Math.PI-o+a);const l=function(e,t){return u(Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2))}({x:s[e.meta.rNodes[0]-1],y:n[e.meta.rNodes[0]-1]},{x:s[e.meta.terminalNodes[0]-1],y:n[e.meta.terminalNodes[0]-1]});if(1!=l)for(let e=0;e<s.length;++e)s[e]=u(s[e]/l),n[e]=u(n[e]/l)}(y,r),function(e,t,s){"PEPTIDE"===e?(g(t,e),b(t,t.meta.rNodes[1])):s===c.RIBOSE||s===c.DEOXYRIBOSE?(b(t,t.meta.rNodes[1]),t.meta.rNodes[1]=t.meta.terminalNodes[1],f(t.bonds,t.meta),g(t,e),b(t,t.meta.rNodes[1]),b(t,t.meta.rNodes[0]),b(t,t.meta.rNodes[2])):s===c.PHOSPHATE&&(t.meta.terminalNodes[0]=t.meta.rNodes[0],A(t,-t.atoms.x[t.meta.terminalNodes[0]-1],-t.atoms.y[t.meta.terminalNodes[0]-1]),g(t,e),b(t,t.meta.rNodes[1]))}(n,y,e),function(e){let t=0;for(;t<e.atoms.atomTypes.length;)e.atoms.atomTypes[t]===c.HYDROGEN&&(b(e,t+1),--t),++t}(y),y}return null}(t,s,n,r,i);if(!o)throw new Error(`Monomer with symbol '${t}' is absent the monomer library`);e.set(t,o)}}function p(e,t,s,n){const r={backboneShift:null,branchShift:null,terminalNodes:[],rNodes:[]};return function(e,t,s){for(const[n,r]of s)e.atomTypes[n-1]=t[r-1]}(e,s,n),function(e,t){t.rNodes=Array.from(e.keys());for(let s=0;s<t.rNodes.length;s++)for(const n of[1,2])if(e.get(t.rNodes[s])===n){const e=t.rNodes[n-1];t.rNodes[n-1]=t.rNodes[s],t.rNodes[s]=e}}(n,r),f(t,r),r}function f(e,t){const s=t.rNodes;t.terminalNodes=new Array(s.length).fill(0);const n=t.terminalNodes,r=e.atomPairs;let i=0,o=0;for(;i<r.length&&o<n.length;){for(let e=0;e<n.length;++e)for(let t=0;t<2;++t)r[i][t]===s[e]&&(n[e]=r[i][(t+1)%2],s.length,++o);++i}}function g(e,t){e.meta.rNodes.length>1&&(e.meta.backboneShift=y(e,e.meta.rNodes[1]-1,e.meta.terminalNodes[0]-1)),"RNA"===t&&e.meta.rNodes.length>2&&(e.meta.branchShift=y(e,e.meta.rNodes[2]-1,e.meta.terminalNodes[0]-1))}function y(e,t,s){return[u(e.atoms.x[t]-e.atoms.x[s]),u(e.atoms.y[t]-e.atoms.y[s])]}function b(e,t){if(void 0!==t){const s=t-1,n=e.atoms,r=e.bonds,i=e.meta;n.atomTypes.splice(s,1),n.x=w(Float32Array,n.x,s,1),n.y=w(Float32Array,n.y,s,1),n.kwargs.splice(s,1);for(let e=0;e<i.terminalNodes.length;++e)i.terminalNodes[e]>t?--i.terminalNodes[e]:i.terminalNodes[e]===t&&(i.terminalNodes[e]=-1);for(let e=0;e<i.rNodes.length;++e)i.rNodes[e]>t?--i.rNodes[e]:i.rNodes[e]===t&&(i.rNodes[e]=-1);let o=0;for(;o<r.atomPairs.length;){const e=r.atomPairs[o][0],s=r.atomPairs[o][1];e===t||s===t?(r.atomPairs.splice(o,1),r.bondTypes=w(Uint32Array,r.bondTypes,o,1),r.bondConfiguration.has(o)&&r.bondConfiguration.delete(o),r.kwargs.has(o)&&r.kwargs.delete(o),--o):(r.atomPairs[o][0]=e>t?e-1:e,r.atomPairs[o][1]=s>t?s-1:s),++o}let a=Array.from(r.bondConfiguration.keys());a.forEach((e=>{if(r.bondConfiguration.has(e)&&e>s){const t=r.bondConfiguration.get(e);r.bondConfiguration.delete(e),r.bondConfiguration.set(e-1,t)}})),a=Array.from(r.kwargs.keys()),a.forEach((e=>{if(r.kwargs.has(e)&&e>s){const t=r.kwargs.get(e);r.kwargs.delete(e),r.kwargs.set(e-1,t)}}))}}function w(e,t,s,n){const r=new e(t.length-n);let i=0,o=0;for(;i<t.length;)i===s&&(i+=n),r[o]=t[i],++o,++i;return r}function C(e,t){let s;if(0===e)s=t>0?0:Math.PI;else if(0===t)s=e>0?-Math.PI/2:Math.PI/2;else{const n=t/e,r=Math.atan(n);s=e<0?Math.PI/2+r:-Math.PI/2+r}return s}function v(e,t){if(0!==t){const s=e.x,n=e.y,r=Math.cos(t),i=Math.sin(t);for(let e=0;e<s.length;++e){const t=s[e];s[e]=u(t*r-n[e]*i),n[e]=u(t*i+n[e]*r)}}}function T(e,t){if(t){const t=e.atoms.y;for(let e=0;e<t.length;e++)t[e]=-t[e]}else{const t=e.atoms.x;for(let e=0;e<t.length;e++)t[e]=-t[e]}const s=e.bonds.bondConfiguration;for(const[e,t]of s){const n=1===t?3:1;s.set(e,n)}}function A(e,t,s){const n=e.atoms.x,r=e.atoms.y;for(let e=0;e<n.length;++e)n[e]=u(n[e]+t),void 0!==s&&(r[e]=u(r[e]+s))}},6137:(e,t,s)=>{"use strict";s.d(t,{J:()=>r,V:()=>i});var n=s(9976);class r extends n.B{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new r({A:"green",C:"blue",G:"black",T:"red",U:"red",others:"gray"})),this.chromatogram}}class i{}i.SemType="Nucleotides",i.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",i.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"}},9976:(e,t,s)=>{"use strict";s.d(t,{B:()=>n});class n{static makePalette(e,t=!1,s=n){const r={};return e.forEach((e=>{const s=e[0],n=e[1];s.forEach(((e,s)=>{r[e]=this.colourPalette[n][t?0:s]}))})),new s(r)}constructor(e){this._palette=e}get(e){return this._palette[e]}}n.undefinedColor="rgb(100,100,100)",n.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:(e,t,s)=>{"use strict";s.d(t,{UE:()=>c,kQ:()=>o});var n=s(976),r=s(9976);class i{static hashCode(e){let t=0;if(0===e.length)return t;for(let s=0;s<e.length;s++)t=(t<<5)-t+e.charCodeAt(s),t|=0;return t}}class o{}class a extends o{get(e){return"#666666"}}class l extends o{static buildPalette(){return[].concat(...Object.values(r.B.colourPalette))}get(e){const t=i.hashCode(e)%l.palette.length;return function(e){if(null==e)return"rgb(100,100,100)";const t=n.Color.fromHtml(e),s=n.Color.g(t),r=n.Color.r(t),i=n.Color.b(t),o=Math.sqrt(Math.pow(0-r,2)+Math.pow(0-s,2)+Math.pow(0-i,2));return o>210?`rgb(${r/o*210},${s/o*210},${i/o*210})`:n.Color.toRgb(t)}(l.palette[t])}}l.palette=l.buildPalette();class c extends r.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}}},9611:(e,t,s)=>{"use strict";s.d(t,{A:()=>c});var n=s(4469),r=s(976),i=s(6414),o=s.n(i),a=s(8447);const l={DNA:"RNA",RNA:"RNA",PT:"PEPTIDE",UN:"PEPTIDE"};class c{get updated(){return this._updated}constructor(e,t,s){this.grid=e,this.col=t,this.propsProvider=s,this._monomerLengthList=null,this.separatorWidth=5,this._updated=!1,this._monomerLengthMap={},this._monomerStructureMap={},this.subs=[],this._splitter=(0,a.Mj)(this.col),this.props=this.propsProvider(),this._rowsProcessed=r.BitSet.create(this.col.length),this.grid&&(this.subs.push(t.dataFrame.onDataChanged.subscribe((()=>{try{this.props=this.propsProvider(),this._monomerLengthList=null,this._rowsProcessed=r.BitSet.create(this.col.length)}catch(e){console.error(e)}}))),this.subs.push(n.events.onViewRemoved.subscribe((e=>{try{this.grid?.view?.id===e.id&&this.destroy()}catch(e){console.error(e)}}))))}destroy(){for(const e of this.subs)e.unsubscribe()}getCellMonomerLengths(e){const t=this.props.unitsHandler.isMsa()?this.getCellMonomerLengthsForSeqMsa():this.getCellMonomerLengthsForSeq(e),s=new Array(t.length+1);s[0]=5;for(let e=1;e<s.length;e++)s[e]=s[e-1]+t[e-1];return[t,s]}getCellMonomerLengthsForSeq(e){null===this._monomerLengthList&&(this._monomerLengthList=new Array(this.col.length).fill(null),this._updated=!0);let t=this._monomerLengthList[e];if(null===t){const s=this.getSeqMonList(e);t=this._monomerLengthList[e]=new Array(s.length);for(const[e,n]of o().enumerate(s)){const s=this.props.monomerToShort(e,this.props.monomerLengthLimit),r=(this.props.unitsHandler.isSeparator()?this.separatorWidth:this.props.separatorWidth)+s.length*this.props.monomerCharWidth;t[n]=r}this._updated=!0}return t}getCellMonomerLengthsForSeqMsa(){var e;null===this._monomerLengthList&&(this._monomerLengthList=new Array(1).fill(null),this._updated=!0),(e=this._monomerLengthList)[0]??(e[0]=new Array(0));const t=this._monomerLengthList[0],{startIdx:s,endIdx:n}=(()=>{try{return this.grid&&this.grid.dart?{startIdx:Math.max(Math.floor((this.grid?.vertScroll.min??0)-10),0),endIdx:Math.min(Math.ceil((this.grid?.vertScroll.max??0)+10),this.col.length)}:{startIdx:0,endIdx:Math.min(this.col.length,10)}}catch(e){return{startIdx:0,endIdx:Math.min(this.col.length,10)}}})();for(let e=s;e<n;e++){if(this._rowsProcessed.get(e))continue;const s=this.getSeqMonList(e);s.length>t.length&&t.push(...new Array(s.length-t.length).fill(0));for(const[e,n]of o().enumerate(s)){const s=this.props.monomerToShort(e,this.props.monomerLengthLimit),r=this.props.separatorWidth+s.length*this.props.monomerCharWidth;t[n]=Math.max(t[n]??0,r)}this._updated=!0}return t}getPosition(e,t){const[s,n]=this.getCellMonomerLengths(e),r=this.col.get(e),i=o()(this._splitter(r)).toArray();if(0===i.length)return null;let a=100,l=null,c=i.length,h=!1,u=0;if(n[0]<=t&&t<n.slice(-1)[0])for(;!h;)if(u=Math.floor((c+(l??0))/2),t>=n[u]&&t<=n[u+1]?(l=u,h=!0):t<n[u]?c=u-1:t>n[u+1]&&(l=u+1),l==c&&(h=!0),--a<=0)throw new Error(`Get position for pointer x = ${t} searching has not converged on ${JSON.stringify(n)}. `);return l}getSeqMonList(e){const t=this.col.get(e);return t?o()(this._splitter(t)).toArray():[]}getMonomer(e){const t=this.props.unitsHandler.alphabet??"UN",s=l[t];return this.props.monomerLib?.getMonomer(s,e)??null}setMonomerLengthLimit(e){this.props.monomerLengthLimit=e,this._updated=!0}setSeparatorWidth(e){this.props.separatorWidth=e,this._updated=!0}isMsa(){return this.props.unitsHandler.isMsa()}}},1047:(e,t,s)=>{"use strict";s.d(t,{$3:()=>r,pU:()=>i,rx:()=>n});const n=["symbol","molfile","rgroups","name"],r="p",i=new RegExp(`[rd]\\((\\w)\\)${r}?`,"g")},7945:(e,t,s)=>{"use strict";function n(e){return"string"==typeof e||e instanceof String?e:"StateError"===e.constructor.name?e.message:"StateError"===e.constructor.name&&"$thrownJsError"in e?n(e.$thrownJsError):e instanceof Error?e.message:e.toString()}function r(e){return e instanceof Error?e.stack:"StateError"===e.constructor.name&&"$thrownJsError"in e?r(e.$thrownJsError):void 0}function i(e){return[n(e),r(e)]}s.d(t,{yf:()=>i})},5226:(e,t,s)=>{"use strict";s.d(t,{i:()=>o});var n=s(976),r=s(499),i=s(1821);class o{get descriptionsArray(){return this._descriptionsArray}get sequencesArray(){return this._sequencesArray}parseMacromolecule(e,t){return this._fileContent.slice(e,t).split(/\s/).join("")}parseColumns(){const e=/^>(.*)$/gm;let t,s=0;for(;t=e.exec(this._fileContent);){const n=this._fileContent.substring(t.index+1,e.lastIndex);this._descriptionsArray.push(n),0!==s&&this._sequencesArray.push(this.parseMacromolecule(s,t.index)),s=e.lastIndex+1}this._sequencesArray.push(this.parseMacromolecule(s,-1))}importFasta(){const e=n.Column.fromStrings("description",this.descriptionsArray),t=n.Column.fromStrings("sequence",this.sequencesArray);return t.semType=n.SEMTYPE.MACROMOLECULE,t.setTag(n.TAGS.UNITS,i.r2.FASTA),r.Cn.getOrCreate(t),[n.DataFrame.fromColumns([e,t])]}constructor(e){this._descriptionsArray=[],this._sequencesArray=[],this._fileContent=e,this.parseColumns()}}},1821:(e,t,s)=>{"use strict";s.d(t,{BM:()=>o,CI:()=>i,XS:()=>l,r2:()=>n,se:()=>a});var n,r=s(6286);!function(e){e.FASTA="fasta",e.SEPARATOR="separator",e.HELM="helm"}(n||(n={}));const i=", ",o=/(?:\[([A-Za-z0-9_\-,()]+)\])|([A-Za-z\-])/g,a=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"])}}},l=[new r.L("PT",a.fasta.peptide,.5),new r.L("DNA",a.fasta.dna,.55),new r.L("RNA",a.fasta.rna,.55)]},8447:(e,t,s)=>{"use strict";s.d(t,{CI:()=>n.CI,GU:()=>r.GU,KX:()=>r.KX,Mj:()=>r.Mj,XS:()=>n.XS,dQ:()=>r.dQ,gM:()=>r.gM,gP:()=>r.gP,kB:()=>r.kB,py:()=>r.py,r2:()=>n.r2,up:()=>r.up});var n=s(1821),r=s(8260)},6286:(e,t,s)=>{"use strict";s.d(t,{L:()=>n,d:()=>r});class n{constructor(e,t,s){this.name=e,this.alphabet=t,this.cutoff=s}}class r extends n{constructor(e,t,s){super(e.name,e.alphabet,e.cutoff),this.freq=t,this.similarity=s}}},8260:(e,t,s)=>{"use strict";s.d(t,{w4:()=>P,gM:()=>_,KX:()=>E,py:()=>x,vU:()=>v,Mj:()=>T,Ar:()=>y,jY:()=>p,GU:()=>S,dQ:()=>$,up:()=>N,kB:()=>f,FJ:()=>g,gP:()=>C});var n=s(976),r=s(6414),i=s.n(r),o=s(6286),a=s(1821),l=s(499);class c extends Float32Array{}var h=s(850),u=s(2012),d=s(6137),m=s(7331);function p(e,t,s){return e.categories,function(e,t){const s={};let n=!0,r=null;for(const i of e)if(null==r?r=i.length:i.length!==r&&(n=!1),i.length>=t)for(const e of i)e in s||(s[e]=0),s[e]+=1;return{freq:s,sameLength:n}}(i()(e.getRawData()).map((t=>s(e.categories[t]))),t)}function f(e){return i()(e.toString().matchAll(a.BM)).map((e=>e[2]??e[1])).toArray()}function g(e){return e||[]}function y(e,t=undefined){return s=>s?s.replaceAll('"-"',"").replaceAll("'-'","").split(e,t):[]}const b=/(PEPTIDE1|DNA1|RNA1)\{([^}]+)}/g,w=/\[([^\[\]]+)]/g;function C(e){b.lastIndex=0;const t=b.exec(e.toString()),s=t?t[2]:null;return(s?s.split("."):[]).map((e=>{w.lastIndex=0;const t=w.exec(e);return t&&t.length>=2?t[1]:e}))}function v(e,t,s=undefined){if(e.toLowerCase().startsWith(a.r2.FASTA))return f;if(e.toLowerCase().startsWith(a.r2.SEPARATOR))return y(t,s);if(e.toLowerCase().startsWith(a.r2.HELM))return C;throw new Error(`Unexpected units ${e} .`)}function T(e){return l.Cn.getOrCreate(e).getSplitter()}const A=/([^\W_]+)/g;function S(e,t){if(e.length<=t)return e;const s=e.match(A),n=e.length>t||(s?.length??0)>1,r=s?.[0]??" ";return n?r.substring(0,t-1)+"…":r}function _(e){switch(e){case"DNA":return a.se.fasta.dna;case"RNA":return a.se.fasta.rna;case"PT":return a.se.fasta.peptide;default:throw new Error(`Unsupported alphabet '${e}'.`)}}function E(e,t,s="-"){const n=new Set([...new Set(Object.keys(e)),...t]);n.delete(s);const r=[],i=[];for(const s of n)r.push(s in e?e[s]:0),i.push(t.has(s)?1:0);const o=new c(r),a=new c(i);return(0,h.MA)(o,a)/((0,h.$G)(o)*(0,h.$G)(a))}function P(e,t,s="-"){const n=t.map((t=>{const n=E(e,t.alphabet,s);return new o.d(t,e,n)}));let r;const i=Math.max(...n.map((e=>e.similarity>e.cutoff?e.similarity:-1)));return r=i>0?n.find((e=>e.similarity===i)).name:"UN",r}function $(e,t=5){let s;return s=e.semType==n.SEMTYPE.MACROMOLECULE?l.Cn.getOrCreate(e).alphabet:P(p(e,t,f).freq,a.XS),x(s)}function x(e){switch(e){case"PT":return u.f.GrokGroups;case"DNA":case"RNA":return d.J.Chromatogram;default:return m.UE.Color}}function N(e){const t=e.columns.bySemTypeAll(n.SEMTYPE.MACROMOLECULE);let s=t.find((e=>{const t=e.getTag(n.TAGS.UNITS);return!!t&&-1!==t.indexOf("MSA")}))??null;return!s&&t.length>0&&(s=t[0]),s}},8457:(e,t,s)=>{"use strict";s.d(t,{O:()=>a});var n=s(976),r=s(6414),i=s.n(r),o=s(8260);function a(e){const t=(0,o.Mj)(e),s=e=>{const t=l.columns.addNewString((e+1).toString());return r.push(t),t},r=[],a=e.length,l=n.DataFrame.create(a);for(let n=0;n<a;++n){const o=e.get(n);if(null==o)continue;const a=t(o);for(const[e,t]of i().enumerate(a))((r[t]??null)||s(t)).set(n,e||"-",!1)}return l}},172:(e,t,s)=>{"use strict";s.d(t,{c:()=>i});var n,r=s(7945);!function(e){e[e.error=0]="error",e[e.warning=1]="warning",e[e.info=2]="info",e[e.debug=3]="debug"}(n||(n={}));class i{constructor(e){this.logger=e,this.promise=Promise.resolve(),this.errors=[],this.syncCounter=0}sync(e,t){const s=++this.syncCounter;this.logger.debug(`${e}, SYNC syncId = ${s}, IN `),this.promise=this.promise.then((async()=>{this.logger.debug(`${e}, SYNC syncId = ${s}, START `),await t(),this.logger.debug(`${e}, SYNC syncId = ${s}, END `)})).catch((t=>{const[n,i]=(0,r.yf)(t);this.logger.error(`${e}, SYNC syncId = ${s}, ERROR:\n${n}`,void 0,i),this.errors.push(t)}))}resetErrors(){const e=this.errors;return this.errors=[],e}}},499:(e,t,s)=>{"use strict";s.d(t,{Cn:()=>m,_9:()=>d});var n=s(976),r=s(6414),i=s.n(r),o=s(8447),a=s(8260),l=s(708),c=s(7228),h=s(1047);const u=new class{constructor(){this.uh=`units-handler.${n.SEMTYPE.MACROMOLECULE}`}},d={[o.r2.FASTA]:"-",[o.r2.SEPARATOR]:"",[o.r2.HELM]:"*"};class m{static setUnitsToFastaColumn(e){if(e.column.semType!==n.SEMTYPE.MACROMOLECULE||e.column.getTag(n.TAGS.UNITS)!==o.r2.FASTA)throw new Error(`The column of notation '${o.r2.FASTA}' must be '${n.SEMTYPE.MACROMOLECULE}'.`);e.column.setTag(n.TAGS.UNITS,o.r2.FASTA),m.setTags(e)}static setUnitsToSeparatorColumn(e,t){if(e.column.semType!==n.SEMTYPE.MACROMOLECULE||e.column.getTag(n.TAGS.UNITS)!==o.r2.SEPARATOR)throw new Error(`The column of notation '${o.r2.SEPARATOR}' must be '${n.SEMTYPE.MACROMOLECULE}'.`);if(!t)throw new Error(`The column of notation '${o.r2.SEPARATOR}' must have the separator tag.`);e.column.setTag(n.TAGS.UNITS,o.r2.SEPARATOR),e.column.setTag("separator",t),m.setTags(e)}static setUnitsToHelmColumn(e){if(e.column.semType!==n.SEMTYPE.MACROMOLECULE)throw new Error(`The column of notation '${o.r2.HELM}' must be '${n.SEMTYPE.MACROMOLECULE}'`);e.column.setTag(n.TAGS.UNITS,o.r2.HELM),m.setTags(e)}static setTags(e){const t=e.column.getTag(n.TAGS.UNITS),s=e.stats;if(Object.keys(s.freq).some((e=>e.length>1)),[o.r2.FASTA,o.r2.SEPARATOR].includes(t)){if(!e.column.getTag("alphabet")&&0===Object.keys(s.freq).length)throw new Error("Alphabet is empty and not annotated.");let t=e.column.getTag("aligned");null===t&&(t=s.sameLength?"SEQ.MSA":"SEQ",e.column.setTag("aligned",t));let n=e.column.getTag("alphabet");if(null===n&&(n=(0,a.w4)(s.freq,o.XS),e.column.setTag("alphabet",n)),"UN"===n){const t=Object.keys(s.freq).length,n=Object.keys(s.freq).some((e=>e.length>1));e.column.setTag(".alphabetSize",t.toString()),e.column.setTag(".alphabetIsMultichar",n?"true":"false")}}}get column(){return this._column}get units(){return this._units}get notation(){return this._notation}get defaultGapSymbol(){return this._defaultGapSymbol}get separator(){const e=this.column.getTag("separator")??void 0;if(this.notation===o.r2.SEPARATOR&&void 0===e)throw new Error(`Separator is mandatory for column '${this.column.name}' of notation '${this.notation}'.`);return e}get aligned(){const e=this.column.getTag("aligned");if(!e&&(this.isFasta()||this.isSeparator()))throw new Error("Tag aligned not set");return e}get alphabet(){const e=this.column.getTag("alphabet");if(!e&&(this.isFasta()||this.isSeparator()))throw new Error("Tag alphabet not set");return e}get helmCompatible(){return this.column.getTag(".isHelmCompatible")}getAlphabetSize(){if(this.notation==o.r2.HELM||"UN"==this.alphabet){const e=this.column.getTag(".alphabetSize");let t;if(e)t=parseInt(e);else{const e=this.stats;t=Object.keys(e.freq).length}return t}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 this.notation===o.r2.HELM||"UN"===this.alphabet&&"true"===this.column.getTag(".alphabetIsMultichar")}get splitted(){if(null===this._splitted){const e=this.getSplitter(),t=this._column.length;this._splitted=new Array(t);const s=this._column.getRawData(),n=this._column.categories;for(let r=0;r<t;r++){const t=n[s[r]];this._splitted[r]=e(t)}}return this._splitted}get stats(){if(null===this._stats){const e={};let t=!0,s=null;for(const n of this.splitted){null==s?s=n.length:n.length!==s&&(t=!1);for(const t of n)t in e||(e[t]=0),e[t]+=1}this._stats={freq:e,sameLength:t}}return this._stats}get maxLength(){return null===this._maxLength&&(this._maxLength=0===this.splitted.length?0:Math.max(...this.splitted.map((e=>e.length)))),this._maxLength}get posList(){if(null===this._posList){const e=this.column.getTag(".positionNames");this._posList=e?e.split(o.CI).map((e=>e.trim())):i().count(1).take(this.maxLength).map((e=>e.toString())).toArray()}return this._posList}isFasta(){return this.notation===o.r2.FASTA}isSeparator(){return this.notation===o.r2.SEPARATOR}isHelm(){return this.notation===o.r2.HELM}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}isGap(e){return!e||this.units===o.r2.FASTA&&e===d[o.r2.FASTA]||this.units===o.r2.HELM&&e===d[o.r2.HELM]}getNotation(){if(this.units.toLowerCase().startsWith(o.r2.FASTA))return o.r2.FASTA;if(this.units.toLowerCase().startsWith(o.r2.SEPARATOR))return o.r2.SEPARATOR;if(this.units.toLowerCase().startsWith(o.r2.HELM))return o.r2.HELM;throw new Error(`Column '${this.column.name}' has unexpected notation '${this.units}'.`)}getHelmWrappers(){return[this.isDna()||this.isRna()||this.isHelmCompatible()?"RNA1{":"PEPTIDE1{",this.isDna()?"d(":this.isRna()?"r(":"",this.isDna()||this.isRna()?")p":"","}$$$$"]}getNewColumn(e,t,s,r){const i=this.column,a=e.toLowerCase()+"("+i.name+")",l=s??i.dataFrame.columns.getUnusedName(a),c=n.Column.fromList("string",l,r??new Array(this.column.length).fill(""));if(c.semType=n.SEMTYPE.MACROMOLECULE,c.setTag(n.TAGS.UNITS,e),e===o.r2.SEPARATOR){if(!t)throw new Error(`Notation '${o.r2.SEPARATOR}' requires separator value.`);c.setTag("separator",t)}c.setTag(n.TAGS.CELL_RENDERER,"Macromolecule");const h=i.getTag("aligned");h&&c.setTag("aligned",h);const u=i.getTag("alphabet");null!=u&&c.setTag("alphabet",u);let d=i.getTag(".alphabetSize");null!=u&&d&&c.setTag(".alphabetSize",d);const m=i.getTag(".alphabetIsMultichar");return null!=u&&void 0!==m&&c.setTag(".alphabetIsMultichar",m),e==o.r2.HELM&&(d=this.getAlphabetSize().toString(),c.setTag(".alphabetSize",d)),c}getNewColumnFromList(e,t){return this.getNewColumn(this.notation,this.separator,e,t)}static getNewColumn(e){const t=m.getOrCreate(e),s=t.notation;return t.getNewColumn(s)}static unitsStringIsValid(e){return e=e.toLowerCase(),[o.r2.FASTA,o.r2.SEPARATOR,o.r2.HELM].some((t=>e.startsWith(t.toLowerCase())))}static getNewColumnFromParams(e,t,s){if(!m.unitsStringIsValid(s))throw new Error("Invalid format of 'units' parameter");const r=n.Column.fromList("string",t,new Array(e).fill(""));return r.semType=n.SEMTYPE.MACROMOLECULE,r.setTag(n.TAGS.UNITS,s),r}getSplitter(e){if(this.units.toLowerCase().startsWith(o.r2.FASTA))return null===this.column.getTag("alphabet")||this.getAlphabetIsMultichar()?a.kB:a.FJ;if(this.units.toLowerCase().startsWith(o.r2.SEPARATOR))return(0,a.Ar)(this.separator,e);if(this.units.toLowerCase().startsWith(o.r2.HELM))return a.gP;throw new Error(`Unexpected units ${this.units} .`)}getDistanceFunctionName(){if(!this.isFasta())throw new Error("Only FASTA notation is supported");return this.isMsa()?l.U.HAMMING:(this.alphabet,l.U.LEVENSHTEIN)}getDistanceFunction(){return l.o[this.getDistanceFunctionName()]()}async checkHelmCompatibility(){if(this.column.tags.has(".isHelmCompatible"))return"true"===this.column.getTag(".isHelmCompatible");const e=(await(0,c.JN)()).getBioLib().getMonomerSymbolsByType("PEPTIDE".toString()),t=new Set(e),s=(0,a.Ar)(this.separator);for(const e of this.column.categories){const n=s(e);for(const e of n)if(!t.has(e))return this.column.setTag(".isHelmCompatible","false"),!1}return this.column.setTag(".isHelmCompatible","true"),!0}get splitter(){return null===this._splitter&&(this._splitter=(0,a.Mj)(this.column)),this._splitter}toFasta(e){return e===o.r2.FASTA}toSeparator(e){return e===o.r2.SEPARATOR}toHelm(e){return e===o.r2.HELM}convertHelmToFastaSeparator(e,t,s,n){n||(n=this.toFasta(t)?d[o.r2.FASTA]:d[o.r2.SEPARATOR]),s||(s=this.toFasta(t)?"":this.separator);const r=e.startsWith("RNA"),i=this.splitter(e),a=[];for(let e=0;e<i.length;e++){let s=i[e];if(r&&(s=s.replace(h.pU,"")),s===d[o.r2.HELM])a.push(n);else if(this.toFasta(t)&&s.length>1){const e="["+s+"]";a.push(e)}else a.push(s)}return a.join(s)}convert(e,t){const s=this.getConverter(e,t),n=this.getNewColumn(e,t);return n.init((e=>{const t=this.column.get(e);return t?s(t):t})),n}getRegion(e,t,s){const n=this.getNewColumn(this.notation,this.separator);n.name=s,Math.max(...this.splitted.map((e=>e.length)));const r=e??0,i=t??this.maxLength-1,a=this.getJoiner(),l=i-r+1;n.init((e=>{const t=this.splitted[e],s=new Array(l);for(let e=0;e<l;++e){const n=r+e;s[e]=n<t.length?t[n]:d[this.notation]}return a(s)}));const c=e=>{const t=e.split(",").map((e=>e.trim())),s=new Array(l);for(let e=0;e<l;++e){const n=r+e;s[e]=n<t.length?t[n]:"?"}return s.join(o.CI)},h=this.column.getTag(".positionNames");h&&n.setTag(".positionNames",c(h));const u=this.column.getTag(".positionLabels");return u&&n.setTag(".positionLabels",c(u)),n}getJoiner(){if(void 0===this._joiner){const e=this;if(this.notation===o.r2.FASTA)this._joiner=function(t){return p(e,t)};else if(this.notation===o.r2.SEPARATOR)this._joiner=function(t){return f(e,t,e.separator)};else{if(this.notation!==o.r2.HELM)throw new Error;{const t="DNA"===e.alphabet||"RNA"===e.alphabet;this._joiner=function(s){return g(e,s,t)}}}}return this._joiner}getConverter(e,t=undefined){if(e===o.r2.SEPARATOR&&!t)throw new Error(`Target separator is not specified for target units '${o.r2.SEPARATOR}'.`);const s=this;if(e===o.r2.FASTA)return function(e){return function(e,t){const s=e.isHelm()?y(e,t):e.getSplitter()(t);return p(e,s)}(s,e)};if(e===o.r2.HELM)return function(e){return function(e,t){const s=t.startsWith("DNA")||t.startsWith("RNA"),n=e.getSplitter()(t);return g(e,n,s)}(s,e)};if(e===o.r2.SEPARATOR)return function(e){return function(e,t,s){const n=e.isHelm()?y(e,t):e.getSplitter()(t);return f(e,n,s)}(s,e,t)};throw new Error}constructor(e){if(this._splitter=null,this._splitted=null,this._stats=null,this._maxLength=null,this._posList=null,this._joiner=void 0,e.type!==n.TYPE.STRING)throw new Error(`Unexpected column type '${e.type}', must be '${n.TYPE.STRING}'.`);this._column=e;const t=this._column.getTag(n.TAGS.UNITS);if(null==t)throw new Error("Units are not specified in column");if(this._units=t,this._notation=this.getNotation(),this._defaultGapSymbol=this.isFasta()?d[o.r2.FASTA]:this.isHelm()?d[o.r2.HELM]:d[o.r2.SEPARATOR],!this.column.tags.has("aligned")||!this.column.tags.has("alphabet")||!this.column.tags.has(".alphabetIsMultichar")&&!this.isHelm()&&"UN"===this.alphabet)if(this.isFasta())m.setUnitsToFastaColumn(this);else if(this.isSeparator()){const t=e.getTag("separator");m.setUnitsToSeparatorColumn(this,t)}else{if(!this.isHelm())throw new Error(`Unexpected units '${this.column.getTag(n.TAGS.UNITS)}'.`);m.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(e){let t=e.temp[u.uh];return t||(t=e.temp[u.uh]=new m(e)),t}}function p(e,t){const s=new Array(t.length);for(const[n,r]of i().enumerate(t)){let i=n;e.isHelm()&&(i=n.replace(h.pU,"$1")),e.isGap(i)?i=d[o.r2.FASTA]:i.length>1&&(i="["+t[r]+"]"),s[r]=i}return s.join("")}function f(e,t,s){const n=new Array(t.length);for(const[s,r]of i().enumerate(t)){let t=s;e.isGap(t)&&(t=d[o.r2.SEPARATOR]),n[r]=t}return n.map((e=>e??"")).join(s)}function g(e,t,s){const[n,r,a,l]=e.getHelmWrappers();return`${n}${i()(t).map((t=>{let n=t;return n=e.isGap(n)?d[o.r2.HELM]:s?n.replace(h.pU,"$1"):1==t.length?`${r}${t}${a}`:`${r}[${t}]${a}`,n})).toArray().join(".")}${l}`}function y(e,t){const s=e.getSplitter()(t),n=new Array(s.length),r=t.startsWith("DNA"),o=t.startsWith("RNA");for(const[e,t]of i().enumerate(s)){let s=e;(r||o)&&(s=s.replace(h.pU,"$1"),s=s===h.$3?null:s),n[t]=s}return n.filter((e=>null!==e))}},9298:(e,t,s)=>{"use strict";s.d(t,{Ct:()=>l,DX:()=>n,ES:()=>r,dE:()=>a,iD:()=>o,vS:()=>h,vw:()=>i});var n,r,i,o,a,l,c=s(976);!function(e){e.tooltipWebLogo=".tooltipWebLogo"}(n||(n={})),function(e){e.Entropy="Entropy",e.full="100%"}(r||(r={})),function(e){e.TOP="top",e.MIDDLE="middle",e.BOTTOM="bottom"}(i||(i={})),function(e){e.LEFT="left",e.CENTER="center",e.RIGHT="right"}(o||(o={})),function(e){e.AUTO="auto",e.ON="on",e.OFF="off"}(a||(a={})),function(e){e.Filtered="Filtered",e.Selected="Selected"}(l||(l={}));const h=new class{constructor(){this.sequenceColumnName=null,this.valueAggrType=c.AGG.TOTAL_COUNT,this.valueColumnName="Activity",this.startPositionName=null,this.endPositionName=null,this.skipEmptySequences=!0,this.skipEmptyPositions=!1,this.shrinkEmptyTail=!0,this.backgroundColor=4294967295,this.positionHeight=r.Entropy,this.positionWidth=16,this.verticalAlignment=i.MIDDLE,this.horizontalAlignment=o.CENTER,this.fixWidth=!1,this.fitArea=!0,this.minHeight=50,this.maxHeight=100,this.showPositionLabels=!0,this.positionMarginState=a.AUTO,this.positionMargin=0,this.filterSource=l.Filtered}}},922:(e,t,s)=>{"use strict";s.d(t,{_:()=>l});class n{constructor(e){this.init(e)}init(e){this.fileContent=e.replace(/\r/g,""),this._atomCount=void 0,this._atomTypes=void 0,this._bondCount=void 0,this._bondTypes=void 0,this.xyzAtomCoordinates=void 0,this._pairsOfBondedAtoms=void 0}get atomCount(){return void 0===this._atomCount&&this.setAtomAndBondCounts(),this._atomCount}get bondCount(){return void 0===this._bondCount&&this.setAtomAndBondCounts(),this._bondCount}get x(){var e;return null!==(e=this.xyzAtomCoordinates)&&void 0!==e||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.x}get y(){var e;return null!==(e=this.xyzAtomCoordinates)&&void 0!==e||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.y}get z(){var e;return null!==(e=this.xyzAtomCoordinates)&&void 0!==e||(this.xyzAtomCoordinates=this.parseAtomCoordinates()),this.xyzAtomCoordinates.z}get atomTypes(){var e;return null!==(e=this._atomTypes)&&void 0!==e||(this._atomTypes=this.parseAtomTypes()),this._atomTypes}get pairsOfBondedAtoms(){var e;return null!==(e=this._pairsOfBondedAtoms)&&void 0!==e||(this._pairsOfBondedAtoms=this.parseBondedAtomPairs()),this._pairsOfBondedAtoms}get bondTypes(){var e;return null!==(e=this._bondTypes)&&void 0!==e||(this._bondTypes=this.parseBondTypes()),this._bondTypes}setAtomAndBondCounts(){const{atomCount:e,bondCount:t}=this.parseAtomAndBondCounts();this._atomCount=e,this._bondCount=t}getNextColumnIdx(e){for(;!this.isWhitespace(e);)++e;for(;this.isWhitespace(e);)++e;return e}shiftIdxToSpecifiedColumn(e,t){let s=e;const n=this.isWhitespace(s)?t:t-1;for(let e=0;e<n;e++)s=this.getNextColumnIdx(s);return s}parseAtomTypes(){const e=this.atomCount,t=new Array(e);let s=this.getAtomBlockIdx();for(let n=0;n<e;n++)s=this.shiftIdxToAtomType(s),t[n]=this.parseAtomType(s),s=this.getNextLineIdx(s);return t}parseAtomCoordinates(){const e=new Float32Array(this.atomCount),t=new Float32Array(this.atomCount),s=new Float32Array(this.atomCount);let n=this.getAtomBlockIdx();for(let r=0;r<this.atomCount;r++){n=this.shiftIdxToXColumn(n);for(const i of[e,t,s])i[r]=this.parseFloatValue(n),n=this.getNextColumnIdx(n);n=this.getNextLineIdx(n)}return{x:e,y:t,z:s}}parseBondedAtomPairs(){const e=new Array(this.bondCount);let t=this.getBondBlockIdx();for(let s=0;s<this.bondCount;s++){t=this.shiftIdxToBondedAtomsPair(t);const n=new Uint16Array(2);n[0]=this.parseIntValue(t),t=this.getNextColumnIdx(t),n[1]=this.parseIntValue(t),e[s]=n,t=this.getNextLineIdx(t)}return e}parseBondTypes(){const e=this.bondCount,t=new Uint16Array(e);let s=this.getBondBlockIdx();for(let n=0;n<e;n++)s=this.shiftIdxToBondType(s),t[n]=this.parseIntValue(s),s=this.getNextLineIdx(s);return t}isWhitespace(e){const t=this.fileContent[e];return" "===t||"\t"===t}getNextLineIdx(e){return"\n"!==this.fileContent[e]?this.fileContent.indexOf("\n",e)+1:e+1}parseFloatValue(e){return this.parseNumericValue(parseFloat,e)}parseIntValue(e){return this.parseNumericValue(parseInt,e)}parseNumericValue(e,t){let s=t+1;for(;!this.isWhitespace(s);)++s;return e(this.fileContent.substring(t,s))}}class r extends n{constructor(e){super(e),this.init(e)}init(e){super.init(e)}parseAtomType(e){let t=e,s=t;return this.isQuote(t)?(s=this.getNextIdenticalChar(t),t++):s=this.fileContent.indexOf(" ",s),this.fileContent.substring(t,s)}isQuote(e){const t=this.fileContent[e].charCodeAt(0);return 39===t||34===t}getNextIdenticalChar(e){const t=this.fileContent[e];return t?this.fileContent.indexOf(t,e+1):-1}isQuery(){return this.isQueryOrFragment(((e,t)=>{return 39===e||34===e||76===e&&!((s=this.fileContent.charCodeAt(t+1))>64&&s<91||s>96&&s<123);var s}))}isFragment(){return this.isQueryOrFragment((e=>82===e||42===e))}isQueryOrFragment(e){const t=this.atomCount;let s=this.getAtomBlockIdx();for(let n=0;n<t;n++){if(s=this.shiftIdxToAtomType(s),e(this.fileContent.charCodeAt(s),s))return!0;s=this.getNextLineIdx(s)}return!1}}var i;!function(e){e.HEADER="V2000",e[e.NUM_OF_HEADER_LINES=3]="NUM_OF_HEADER_LINES",e[e.NUM_OF_COUNTS_DIGITS=3]="NUM_OF_COUNTS_DIGITS",e[e.ATOM_TYPE_COL=4]="ATOM_TYPE_COL",e[e.FIRST_BONDED_ATOM_COL=1]="FIRST_BONDED_ATOM_COL",e[e.BOND_TYPE_COL=3]="BOND_TYPE_COL",e[e.RGP_SHIFT=8]="RGP_SHIFT",e.RGP_LINE="M RGP",e.A_LINE="A ",e.END="M END"}(i||(i={}));class o extends r{constructor(e){super(e)}static validate(e){return-1!==e.indexOf(i.HEADER)&&-1!==e.indexOf(i.END)}shiftIdxToAtomType(e){return this.shiftIdxToSpecifiedColumn(e,i.ATOM_TYPE_COL)}getCountsLineIdx(){let e=0;for(let t=0;t<i.NUM_OF_HEADER_LINES;++t)e=this.getNextLineIdx(e);return e}getAtomBlockIdx(){let e=this.getCountsLineIdx();return e=this.getNextLineIdx(e),e}shiftIdxToXColumn(e){return this.getNextColumnIdx(e)}shiftIdxToBondedAtomsPair(e){return this.shiftIdxToSpecifiedColumn(e,i.FIRST_BONDED_ATOM_COL)}shiftIdxToBondType(e){return this.shiftIdxToSpecifiedColumn(e,i.BOND_TYPE_COL)}getBondBlockIdx(){let e=this.getAtomBlockIdx();for(let t=0;t<this.atomCount;t++)e=this.getNextLineIdx(e);return e}parseAtomAndBondCounts(){let e=this.getCountsLineIdx(),t=e+i.NUM_OF_COUNTS_DIGITS;const s=parseInt(this.fileContent.substring(e,t));return e=t,t+=i.NUM_OF_COUNTS_DIGITS,{atomCount:s,bondCount:parseInt(this.fileContent.substring(e,t))}}}class a extends r{constructor(e){super(e),this.init(e)}shiftIdxToAtomType(e){return this.shiftIdxToSpecifiedColumn(e,4)}getCountsLineIdx(){return this.fileContent.indexOf("M V30 COUNTS ")}getAtomBlockIdx(){let e=this.fileContent.indexOf("M V30 BEGIN ATOM");return e=this.getNextLineIdx(e),e}shiftIdxToXColumn(e){let t=this.shiftIdxToAtomType(e);return this.isQuote(t)?(t=this.getNextIdenticalChar(t),t=this.getNextColumnIdx(t),t):this.shiftIdxToSpecifiedColumn(e,5)}shiftIdxToBondedAtomsPair(e){return this.shiftIdxToSpecifiedColumn(e,5)}shiftIdxToBondType(e){return this.shiftIdxToSpecifiedColumn(e,4)}getBondBlockIdx(){return this.getNextLineIdx(this.fileContent.indexOf("M V30 BEGIN BOND"))}static validate(e){return-1!==e.indexOf("V3000")&&-1!==e.indexOf("M END")}parseAtomAndBondCounts(){let e=this.fileContent.indexOf("M V30 COUNTS ")+14,t=this.fileContent.indexOf(" ",e+1);const s=parseInt(this.fileContent.substring(e,t));return e=t+1,t=this.fileContent.indexOf(" ",e+1),{atomCount:s,bondCount:parseInt(this.fileContent.substring(e,t))}}}class l{constructor(){}static getInstance(e){if(o.validate(e))return new o(e);if(a.validate(e))return new a(e);throw new Error("Malformed molfile")}}},7905:(e,t,s)=>{"use strict";e=s.hmd(e);var n,r=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e={}){var t,s,r=void 0!==e?e:{};r.ready=new Promise((function(e,n){t=e,s=n}));var i,o=Object.assign({},r),a="object"==typeof window,l="function"==typeof importScripts,c=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(a||l)&&(l?c=self.location.href:"undefined"!=typeof document&&document.currentScript&&(c=document.currentScript.src),n&&(c=n),c=0!==c.indexOf("blob:")?c.substr(0,c.replace(/[?#].*/,"").lastIndexOf("/")+1):"",l&&(i=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)})),r.print||console.log.bind(console);var h,u,d=r.printErr||console.warn.bind(console);Object.assign(r,o),o=null,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.quit&&r.quit,r.wasmBinary&&(h=r.wasmBinary),r.noExitRuntime,"object"!=typeof WebAssembly&&S("no native wasm support detected");var m,p,f,g=!1;function y(){var e=u.buffer;r.HEAP8=m=new Int8Array(e),r.HEAP16=new Int16Array(e),r.HEAP32=new Int32Array(e),r.HEAPU8=p=new Uint8Array(e),r.HEAPU16=new Uint16Array(e),r.HEAPU32=f=new Uint32Array(e),r.HEAPF32=new Float32Array(e),r.HEAPF64=new Float64Array(e)}var b=[],w=[],C=[],v=0,T=null,A=null;function S(e){r.onAbort&&r.onAbort(e),d(e="Aborted("+e+")"),g=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw s(t),t}var _,E,P="data:application/octet-stream;base64,";function $(e){return e.startsWith(P)}function x(e){try{if(e==_&&h)return new Uint8Array(h);if(i)return i(e);throw"both async and sync fetching of the wasm failed"}catch(e){S(e)}}function N(e,t,s){return function(e){return h||!a&&!l||"function"!=typeof fetch?Promise.resolve().then((function(){return x(e)})):fetch(e,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((function(){return x(e)}))}(e).then((function(e){return WebAssembly.instantiate(e,t)})).then((function(e){return e})).then(s,(function(e){d("failed to asynchronously prepare wasm: "+e),S(e)}))}function M(e){for(;e.length>0;)e.shift()(r)}function L(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){f[this.ptr+4>>2]=e},this.get_type=function(){return f[this.ptr+4>>2]},this.set_destructor=function(e){f[this.ptr+8>>2]=e},this.get_destructor=function(){return f[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,m[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=m[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,m[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=m[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){f[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return f[this.ptr+16>>2]},this.get_exception_ptr=function(){if(B(this.get_type()))return f[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}function I(e){var t=u.buffer;try{return u.grow(e-t.byteLength+65535>>>16),y(),1}catch(e){}}function R(e){return r["_"+e]}$(_="wasmDbscan.wasm")||(E=_,_=r.locateFile?r.locateFile(E,c):c+E);var O="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function k(e,t,s,n,r){var i={string:e=>{var t=0;return null!=e&&0!==e&&(t=function(e){var t=function(e){for(var t=0,s=0;s<e.length;++s){var n=e.charCodeAt(s);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++s):t+=3}return t}(e)+1,s=W(t);return function(e,t,s){!function(e,t,s,n){if(!(n>0))return 0;for(var r=s+n-1,i=0;i<e.length;++i){var o=e.charCodeAt(i);if(o>=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++i)),o<=127){if(s>=r)break;t[s++]=o}else if(o<=2047){if(s+1>=r)break;t[s++]=192|o>>6,t[s++]=128|63&o}else if(o<=65535){if(s+2>=r)break;t[s++]=224|o>>12,t[s++]=128|o>>6&63,t[s++]=128|63&o}else{if(s+3>=r)break;t[s++]=240|o>>18,t[s++]=128|o>>12&63,t[s++]=128|o>>6&63,t[s++]=128|63&o}}t[s]=0}(e,p,t,s)}(e,s,t),s}(e)),t},array:e=>{var t,s,n=W(e.length);return t=e,s=n,m.set(t,s),n}},o=R(e),a=[],l=0;if(n)for(var c=0;c<n.length;c++){var h=i[s[c]];h?(0===l&&(l=G()),a[c]=h(n[c])):a[c]=n[c]}var u=o.apply(null,a);return function(e){return 0!==l&&H(l),function(e){return"string"===t?(s=e)?function(e,t,s){for(var n=t+s,r=t;e[r]&&!(r>=n);)++r;if(r-t>16&&e.buffer&&O)return O.decode(e.subarray(t,r));for(var i="";t<r;){var o=e[t++];if(128&o){var a=63&e[t++];if(192!=(224&o)){var l=63&e[t++];if((o=224==(240&o)?(15&o)<<12|a<<6|l:(7&o)<<18|a<<12|l<<6|63&e[t++])<65536)i+=String.fromCharCode(o);else{var c=o-65536;i+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else i+=String.fromCharCode((31&o)<<6|a)}else i+=String.fromCharCode(o)}return i}(p,s,n):"":"boolean"===t?Boolean(e):e;var s,n}(e)}(u)}var F,D={__cxa_throw:function(e,t,s){throw new L(e).init(t,s),e},abort:function(){S("")},emscripten_memcpy_big:function(e,t,s){p.copyWithin(e,t,t+s)},emscripten_resize_heap:function(e){var t,s=p.length,n=2147483648;if((e>>>=0)>n)return!1;for(var r=1;r<=4;r*=2){var i=s*(1+.2/r);if(i=Math.min(i,e+100663296),I(Math.min(n,(t=Math.max(e,i))+(65536-t%65536)%65536)))return!0}return!1}},G=(function(){var e,t,n,i,o={env:D,wasi_snapshot_preview1:D};function a(e,t){var s,n=e.exports;return r.asm=n,u=r.asm.memory,y(),r.asm.__indirect_function_table,s=r.asm.__wasm_call_ctors,w.unshift(s),function(e){if(v--,r.monitorRunDependencies&&r.monitorRunDependencies(v),0==v&&(null!==T&&(clearInterval(T),T=null),A)){var t=A;A=null,t()}}(),n}if(v++,r.monitorRunDependencies&&r.monitorRunDependencies(v),r.instantiateWasm)try{return r.instantiateWasm(o,a)}catch(e){d("Module.instantiateWasm callback failed with error: "+e),s(e)}(e=h,t=_,n=o,i=function(e){a(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||$(t)||"function"!=typeof fetch?N(t,n,i):fetch(t,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,n).then(i,(function(e){return d("wasm streaming compile failed: "+e),d("falling back to ArrayBuffer instantiation"),N(t,n,i)}))}))).catch(s)}(),r._dbscan=function(){return(r._dbscan=r.asm.dbscan).apply(null,arguments)},r._malloc=function(){return(r._malloc=r.asm.malloc).apply(null,arguments)},r._free=function(){return(r._free=r.asm.free).apply(null,arguments)},function(){return(G=r.asm.stackSave).apply(null,arguments)}),H=function(){return(H=r.asm.stackRestore).apply(null,arguments)},W=function(){return(W=r.asm.stackAlloc).apply(null,arguments)},B=function(){return(B=r.asm.__cxa_is_pointer_type).apply(null,arguments)};function V(){function e(){F||(F=!0,r.calledRun=!0,g||(M(w),t(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),function(){if(r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;)e=r.postRun.shift(),C.unshift(e);var e;M(C)}()))}v>0||(function(){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)e=r.preRun.shift(),b.unshift(e);var e;M(b)}(),v>0||(r.setStatus?(r.setStatus("Running..."),setTimeout((function(){setTimeout((function(){r.setStatus("")}),1),e()}),1)):e()))}if(r.ccall=k,r.cwrap=function(e,t,s,n){var r=!s||s.every((e=>"number"===e||"boolean"===e));return"string"!==t&&r&&!n?R(e):function(){return k(e,t,s,arguments)}},A=function e(){F||V(),F||(A=e)},r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return V(),e.ready});"object"==typeof exports?e.exports=r:"function"==typeof define&&s.amdO?define([],(function(){return r})):"object"==typeof exports&&(exports.exportCppDbscanLib=r)},5697:(e,t,s)=>{"use strict";s.d(t,{Dz:()=>b,FV:()=>c,KR:()=>l,MI:()=>C,NB:()=>p,UX:()=>m,WI:()=>d,Zd:()=>u,_h:()=>h,aW:()=>g,bX:()=>T,fX:()=>w,kg:()=>o,s:()=>f,yU:()=>y});var n=s(9657),r=s(1040),i=s(708);r.gk.Tanimoto,r.gk.Dice,r.gk.Asymmetric,r.gk.BraunBlanquet,r.gk.Cosine,r.gk.Kulczynski,r.gk.McConnaughey,r.gk.RogotGoldberg,r.gk.Russel,r.gk.Sokal,r.gk.Hamming,r.gk.Euclidean,r.gk.Tanimoto,r.gk.Dice,r.gk.Asymmetric,r.gk.BraunBlanquet,r.gk.Cosine,r.gk.Kulczynski,r.gk.McConnaughey,r.gk.RogotGoldberg,r.gk.Russel,r.gk.Sokal,r.gk.Hamming,r.gk.Euclidean;const o=[r.gk.Tanimoto,r.gk.Dice,r.gk.Cosine];function a(e,t){const s=e.trueCount()+t.trueCount();if(0==s)return 1;const n=e.andWithCountBits(t,!0);return n/(s-n)}function l(e,t){return 1-a(e,t)}function c(e,t){return v(a(new n.Z(e,32*e.length),new n.Z(t,32*t.length)))}function h(e,t){return 1-function(e,t){const s=e.trueCount()+t.trueCount();return 0==s?0:2*e.andWithCountBits(t,!0)/s}(e,t)}function u(e,t){return 1-function(e,t){const s=e.trueCount()*t.trueCount();return 0==s?0:e.andWithCountBits(t,!0)/Math.sqrt(s)}(e,t)}function d(e,t){return Math.sqrt(e.trueCount()+t.trueCount()-2*e.andWithCountBits(t,!0))}function m(e,t){return e.trueCount()+t.trueCount()-2*e.andWithCountBits(t,!0)}function p(e,t){return 1-function(e,t){const s=e.trueCount()+t.trueCount(),n=e.andWithCountBits(t,!0);return n/(2*s-3*n)}(e,t)}function f(e,t){return v(function(e,t){const s=e.trueCount()+t.trueCount(),n=e.trueCount()*t.trueCount();return 0==n?0:e.andWithCountBits(t,!0)*s/(2*n)}(e,t))}function g(e,t){return v(function(e,t){const s=e.trueCount()+t.trueCount(),n=e.trueCount()*t.trueCount();return 0==n?0:(e.andWithCountBits(t,!0)*s-n)/n}(e,t))}function y(e,t){return 1-function(e,t){const s=Math.min(e.trueCount(),t.trueCount());return 0==s?0:e.andWithCountBits(t,!0)/s}(e,t)}function b(e,t){return v(function(e,t){const s=Math.max(e.trueCount(),t.trueCount());return 0==s?0:e.andWithCountBits(t,!0)/s}(e,t))}function w(e,t){return v(function(e,t){return 0==e.length?0:e.andWithCountBits(t,!0)/e.length}(e,t))}function C(e,t){return v(function(e,t){const s=e.andWithCountBits(t,!0),n=e.countBits(!0)+t.countBits(!0),r=e.length,i=r-n+s;return s==r||i==r?1:s/n+i/(2*r-n)}(e,t))}function v(e){return 0===e?3402823e32:1/e-1}function T(e){if(e&&null!=e.range&&e.range>0){const t=e.range;return(e,s)=>Math.abs(e-s)/t}return(e,t)=>Math.abs(e-t)}r.gk.Tanimoto,r.gk.Asymmetric,r.gk.Cosine,r.gk.Sokal,i.U.HAMMING,i.U.LEVENSHTEIN,i.U.MONOMER_CHEMICAL_DISTANCE,i.U.NEEDLEMANN_WUNSCH},3277:(e,t,s)=>{"use strict";s.d(t,{Ec:()=>r,sS:()=>n});const n="bypassLargeDataWarning",r="show-scatterplot-progress"},708:(e,t,s)=>{"use strict";function n(e={}){const t=function(){if(!e||!e.scoringMatrix||!e.alphabetIndexes)return(e,t)=>e===t?0:1;if(e.scoringMatrix.length!==Object.keys(e.alphabetIndexes).length)throw new Error("Scoring matrix and alphabet indexes should have the same length");const t=e.alphabetIndexes,s=e.scoringMatrix,n=Math.min(...Object.keys(t).map((e=>e.charCodeAt(0))))+1,r=new Float32Array((s.length+n)*(s.length+n));return Object.entries(t).forEach((([e,n])=>{const i=s[n];Object.entries(t).forEach((([t,n])=>{r[e.charCodeAt(0)*s.length+t.charCodeAt(0)]=i[n]}))})),(e,t)=>r[e.charCodeAt(0)*s.length+t.charCodeAt(0)]}(),s=e?.threshold??0;return(e,n)=>{let r=0;const i=e.length,o=n.length,a=Math.max(i,o)*(1-s);i!==o&&(r=Math.abs(i-o));let l=0;for(let s=0;s<Math.min(i,o);s++)if(e[s]!==n[s]&&(l+=t(e[s],n[s]),l>a))return 1;return l+=r,l/=Math.max(i,o),l}}s.d(t,{U:()=>o,o:()=>a});var r=s(1811);const i={gapOpen:1,gapExtend:.6,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,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1,-4],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1,-4],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1,-4],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1,-4],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1,-4],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2,-4],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0,-4],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0,-4],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2,-4],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-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}};var o;!function(e){e.HAMMING="Hamming",e.LEVENSHTEIN="Levenshtein",e.NEEDLEMANN_WUNSCH="Needlemann-Wunsch",e.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance"}(o||(o={}));const a={[o.HAMMING]:n,[o.LEVENSHTEIN]:function(){return(e,t)=>(0,r.T)(e,t)/Math.max(e.length,t.length)},[o.NEEDLEMANN_WUNSCH]:function(e){const t=new Uint16Array(65536),{gapOpen:s,gapExtend:n,scoringMatrix:r,alphabetIndexes:o}={...i,...e};Object.entries(o).forEach((([e,s])=>t[e.charCodeAt(0)]=s));const a=[new Float32Array(1e4),new Float32Array(1e4)];return(e,i)=>{const o=new Array(e.length+1).fill(!1),l=new Array(e.length+1).fill(!1);let c=0,h=1;for(let t=1;t<e.length+1;t++)a[0][t]=-s-(t-1)*n,a[1][t]=0;a[0][0]=0;for(let u=1;u<i.length+1;u++){a[h][0]=-s-(u-1)*n;for(let d=1;d<e.length+1;d++){const m=a[c][d-1]+r[t[e.charCodeAt(d-1)]][t[i.charCodeAt(u-1)]],p=a[c][d]-(o[d]?n:s),f=a[h][d-1]-(l[d-1]?n:s);a[h][d]=Math.max(m,f,p),a[h][d]===m?(o[d]=!1,l[d]=!1):a[h][d]===f?(o[d]=!1,l[d]=!0):(o[d]=!0,l[d]=!1)}c=h,h=(h+1)%2}const u=Math.max(e.length,i.length);return(u-a[c][e.length])/u}},[o.MONOMER_CHEMICAL_DISTANCE]:n}},4628:(e,t,s)=>{"use strict";var n;s.d(t,{A:()=>n}),function(e){e.UMAP="UMAP",e.T_SNE="t-SNE"}(n||(n={}))},1040:(e,t,s)=>{"use strict";var n,r,i,o,a,l;s.d(t,{CF:()=>r,Qe:()=>a,W:()=>n,Yc:()=>l,gd:()=>o,gk:()=>i}),function(e){e.Levenshtein="Levenshtein",e.JaroWinkler="Jaro-Winkler",e.Manhattan="Manhattan",e.Onehot="One-Hot"}(n||(n={})),function(e){e.Euclidean="Euclidean"}(r||(r={})),function(e){e.Tanimoto="Tanimoto",e.Dice="Dice",e.Asymmetric="Asymmetric",e.BraunBlanquet="Braun-Blanquet",e.Cosine="Cosine",e.Kulczynski="Kulczynski",e.McConnaughey="Mc-Connaughey",e.RogotGoldberg="Rogot-Goldberg",e.Russel="Russel",e.Sokal="Sokal",e.Hamming="Hamming",e.Euclidean="Euclidean"}(i||(i={})),function(e){e.TanimotoIntArray="TanimotoIntArray"}(o||(o={})),function(e){e.Vector="Vector",e.String="String",e.BitArray="BitArray",e.MacroMolecule="MacroMolecule",e.Number="Number",e.IntArray="IntArray"}(a||(a={})),function(e){e.Difference="Difference"}(l||(l={}))},6361:(e,t,s)=>{"use strict";s.d(t,{gk:()=>n.gk});var n=s(1040);s(7861)},7861:(e,t,s)=>{"use strict";var n=s(1811),r=s(3979),i=s(5697),o=s(850),a=s(708),l=s(1040);const c={[l.CF.Euclidean]:o.dP},h={[l.W.Levenshtein]:n.T,[l.W.JaroWinkler]:r.H$,[l.W.Manhattan]:function(e,t){if(e.length!==t.length)return 1;{let s=0;for(let n=1;n<e.length;n++)s+=e[n]==t[n]?0:1;return s/e.length}},[l.W.Onehot]:function(e,t){return e===t?0:1}},u={[l.gk.Tanimoto]:i.KR,[l.gk.Dice]:i._h,[l.gk.Asymmetric]:i.yU,[l.gk.BraunBlanquet]:i.Dz,[l.gk.Cosine]:i.Zd,[l.gk.Kulczynski]:i.s,[l.gk.McConnaughey]:i.aW,[l.gk.RogotGoldberg]:i.MI,[l.gk.Russel]:i.fX,[l.gk.Sokal]:i.NB,[l.gk.Hamming]:i.UX,[l.gk.Euclidean]:i.WI},d={[l.gd.TanimotoIntArray]:i.FV},m={[l.Yc.Difference]:i.bX},p={[l.Qe.Vector]:{[l.CF.Euclidean]:c[l.CF.Euclidean]},[l.Qe.String]:{[l.W.Levenshtein]:h[l.W.Levenshtein],[l.W.JaroWinkler]:h[l.W.JaroWinkler],[l.W.Manhattan]:h[l.W.Manhattan],[l.W.Onehot]:h[l.W.Onehot]},[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],[a.U.MONOMER_CHEMICAL_DISTANCE]:a.o[a.U.MONOMER_CHEMICAL_DISTANCE]},[l.Qe.Number]:{[l.Yc.Difference]:m[l.Yc.Difference]},[l.Qe.IntArray]:{[l.gd.TanimotoIntArray]:d[l.gd.TanimotoIntArray]}};Object.keys(p).reduce(((e,t)=>{for(const s of Object.keys(p[t]))e[s]=t;return e}),{})},9657:(e,t,s)=>{"use strict";s.d(t,{Z:()=>n});class n{constructor(e,t=!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 e){const s=e,r=n._createBuffer(s);if(t)for(let e=0;e<r.length;e++)r[e]=-1;this._data=r,this._length=s}else{if(!(e instanceof Uint32Array))throw new Error("Invalid constructor");this._data=e,this._length=t}}getRawData(){return this._data}assureGoez(e,t){if(e<0)throw new Error(`${t} should be greater than zero`)}assureInRange(e,t,s,n){if(e<t||e>s)throw new Error(`Argument ${n} (${e}) out of range (${t}, ${s})`)}copy(e,t,s){for(let n=0;n<s;n++)t[n]=e[n]}copyFrom(e){if(this._length!=e._length)throw new Error(`Lengths differ (${this._length} != ${e._length})`);this.copy(e._data,this._data,this.lengthInInts),this._version++}get length(){return this._length}get buffer(){return this._data}set buffer(e){this._data=e,this._version++}get version(){return this._version}set version(e){this._version=e}incrementVersion(e=!0){this._version++}get lengthInInts(){return Math.floor((this._length+31)/32)}get versionedName(){return this._version==this._versionedNameVersion?this._versionedName:""}set versionedName(e){this._versionedName=e,this._versionedNameVersion=this._version}get self(){return this}setLength(e){if(e<0)throw new Error("should be >= 0");if(e==this._length)return;const t=Math.floor((e+31)/32);if(t>this._data.length||t+this.SHRINK_THRESHOLD<this._data.length){const e=new Uint32Array(t);this.copy(this._data,e,t>this._data.length?this._data.length:t),this._data=e}e>this._length&&(this._length%32>0&&(this._data[this.lengthInInts-1]&=(1<<(this._length%32&31))-1),this._data.fill(0,this.lengthInInts,t)),this._length=e,this._version++}static fromAnd(e,t){if(e._length!=t._length)throw new Error(`Lengths differ (${e._length} != ${t._length})`);const s=new n(e._length);s._length=e._length,s._data=n._createBuffer(s._length),s._version=0;const r=e.lengthInInts;for(let n=0;n<r;n++)s._data[n]=e._data[n]&t._data[n];return s}static _createBuffer(e){return new Uint32Array(Math.floor((e+31)/32))}static fromValues(e){const t=new n(e.length);t._version=0;for(let s=0;s<t._length;s++)e[s]&&(t._data[Math.floor(s/32)]|=1<<(s%32&31));return t}static fromSeq(e,t){const s=new n(e);for(let n=0;n<e;++n)s.setBit(n,t(n));return s._version=0,s}static fromString(e){return n.fromSeq(e.length,(t=>"1"==e.charAt(t)))}static fromUint32Array(e,t){const s=new n(e);return s._data=t,s}static fromBytes(e){const t=e.length,s=new n(8*t);s._data=new Uint32Array(Math.floor((t+3)/4)),s._length=8*t;let r=0,i=0;for(;t-i>=4;)s._data[r++]=255&e[i]|(255&e[i+1])<<8|(255&e[i+2])<<16|(255&e[i+3])<<24,i+=4;return t-i==3&&(s._data[r]=(255&e[i+2])<<16),t-i==2&&(s._data[r]|=(255&e[i+1])<<8),t-i==1&&(s._data[r]|=255&e[i]),s._version=0,s}toString(){return`${this._length} bits, ${this.countBits(!0)} set`}equals(e){if(this==e)return!0;if(null==e)return!1;if(this._length!=e._length)return!1;if(0==this._length)return!0;for(let t=0;t<this._data.length-1;t++)if(this._data[t]!=e._data[t])return!1;for(let t=8*(this._data.length-1);t<this._length;t++)if(this.getBit(t)!=e.getBit(t))return!1;return!0}clone(){const e=new n(0,!1);return e._data=Uint32Array.from(this._data),e._length=this._length,e._version=this._version,e}init(e,t){this.setAll(!1,!1);for(let t=0;t<this._length;t++)e(t)&&(this._data[Math.floor(t/32)]|=1<<(t%32&31));return this.incrementVersion(t),this}invert(e=!0){for(let e=0;e<this._data.length;e++)this._data[e]^=-1;this.incrementVersion(e)}setAll(e,t=!1){const s=e?-1:0,n=this.lengthInInts;for(let e=0;e<n;e++)this._data[e]=s;this.incrementVersion(t)}setIndexes(e,t=!0,s=!0,n=!0){s&&this.setAll(!t,!1);for(const s of e)this.setFast(s,t);this.incrementVersion(n)}everyIndex(e,t=!0){for(const s of e)if(this.getBit(s)!=t)return!1;return!0}anyIndex(e,t=!0){for(const s of e)if(this.getBit(s)==t)return!0;return!1}setWhere(e,t=!0,s=!0,n=!0,r=!0){if(s&&r&&this.setAll(!t,!1),r)for(let s=0;s<this._length;s++)e(s)&&this.setFast(s,t);else for(let s=0;s<this._length;s++)this.setFast(s,e(s)?t:!t);this.incrementVersion(n)}getRange(e,t){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length,"to");const s=[];for(let n=e;n<t;++n)s.push(this.getBit(n));return n.fromValues(s)}getRangeAsList(e,t){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length,"to");const s=[];for(let n=e;n<t;++n)s.push(this.getBit(n));return s}setRange(e,t,s,n=!0){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length-1,"to");const r=Math.min(e,t),i=Math.max(e,t);if(s)for(let e=r;e<=i;e++)this.setTrue(e);else for(let e=r;e<=i;e++)this.setFalse(e);return this.incrementVersion(n),this}setRandom(e,t,s=!0){if(e<0||e>this._length)throw new Error("n must be >= 0 && <= Count");e>this._length/2&&this.setRandom(this._length-e,!t),this.setAll(!t);for(let s=0;s<e;){const e=Math.floor(Math.random()*this._length);this.getBit(e)!=t&&(this.setFast(e,t),s++)}this.incrementVersion(s)}and(e,t=!0){if(this._length!=e._length)throw new Error("Array lengths differ.");for(let t=0,s=this.lengthInInts;t<s;t++)this._data[t]&=e._data[t];return this.incrementVersion(t),this}andNot(e,t=!0){if(this._length!=e._length)throw new Error("Array lengths differ.");const s=this.lengthInInts;for(let t=0;t<s;t++)this._data[t]&=~e._data[t];return this.incrementVersion(t),this}notAnd(e,t=!0){if(this._length!=e._length)throw new Error("Array lengths differ.");for(let t=0,s=this.lengthInInts;t<s;t++)this._data[t]=~this._data[t]&e._data[t];return this.incrementVersion(t),this}not(e=!0){for(let e=0,t=this.lengthInInts;e<t;e++)this._data[e]=~this._data[e];return this.incrementVersion(e),this}or(e,t=!0){if(this._length!=e._length)throw new Error("Array lengths differ.");for(let t=0,s=this.lengthInInts;t<s;t++)this._data[t]|=e._data[t];return this.incrementVersion(t),this}xor(e,t=!0){if(this._length!=e._length)throw new Error("Array lengths differ.");for(let t=0,s=this.lengthInInts;t<s;t++)this._data[t]^=e._data[t];return this.incrementVersion(t),this}insertAt(e,t,s=!1){if(this.assureInRange(e,0,this._length,"pos"),0==t)return;const n=this._length;this.setLength(this._length+t);for(let s=n-1;s>=e;s--)this.setBit(s+t,this.getBit(s));for(let n=e;n<e+t;n++)this.setBit(n,s)}removeAt(e,t=1){if(t<0)throw new Error("n cannot be negative");if(this.assureInRange(e,0,this._length-t,"pos"),this.contains(!0))for(let s=e;s<this._length-t;s++)this.setBit(s,this.getBit(s+t));this.setLength(this._length-t)}removeByMask(e,t=!0){if(this._length!=e.length)throw new Error("length != mask.length");if(e==this)this.setLength(e.countBits(!t)),this.setAll(!t);else{let s=0;for(let n=-1;-1!=(n=e.findNext(n,!t));)this.setFast(s++,this.getBit(n));this._length=s,this._version++}return this}getBit(e){return 0!=(this._data[Math.floor(e/32)]&1<<(31&e))}setBit(e,t,s=!0){this.setFast(e,t),this._version++}setFast(e,t){t?this._data[Math.floor(e/32)]|=1<<(31&e):this._data[Math.floor(e/32)]&=~(1<<(31&e))}setTrue(e){this._data[Math.floor(e/32)]|=1<<(31&e)}setFalse(e){this._data[Math.floor(e/32)]&=~(1<<(31&e))}trueCount(){return this.countBits(!0)}falseCount(){return this.countBits(!1)}countBits(e){if(0==this._length)return 0;if(this._selectedCountVersion!=this._version){this._selectedCount=0;const e=this.lengthInInts;let t=0;for(;t<e-1;t++)for(let e=this._data[t];0!=e;e>>>=8)this._selectedCount+=n._onBitCount[255&e];let s=this._data[t];const r=31&this._length;for(0!=r&&(s&=~(4294967295<<r));0!=s;s>>>=8)this._selectedCount+=n._onBitCount[255&s];this._selectedCountVersion=this._version}return e?this._selectedCount:this._length-this._selectedCount}countWhere(e){let t=0;if(this.trueCount()==this._length)for(let s=0;s<this._length;s++)t+=e(s)?1:0;else for(let s=-1;-1!=(s=this.findNext(s,!0));)t+=e(s)?1:0;return t}andWithCountBits(e,t){if(0==this._length)return 0;let s=0;const r=this.lengthInInts;let i=0;for(;i<r-1;i++)for(let t=this._data[i]&e._data[i];0!=t;t>>>=8)s+=n._onBitCount[255&t];let o=this._data[i]&e._data[i];const a=31&this._length;for(0!=a&&(o&=~(4294967295<<a));0!=o;o>>>=8)s+=n._onBitCount[255&o];return t?s:this._length-s}clear(){this.setLength(0)}contains(e){return this.findNext(-1,e)>=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(e,t=!0){if(this.assureInRange(e,-1,this._length,"index"),e>=this._length-1)return-1;let s=31&(e=e<0?0:e+1);const r=this.lengthInInts;for(let i=Math.floor(e/32);i<r;i++){let r=t?this._data[i]:~this._data[i];if(0!=s)r&=4294967295<<s&4294967295,s=0;else if(!t&&-4294967296==r)continue;for(let t=0;0!=r;t+=8,r>>>=8){const s=n._firstOnBit[255&r];if(s>=0)return(e=s+32*i+t)>=this._length?-1:e}}return-1}findPrev(e,t=!0){if(0==e)return-1;this.assureInRange(e,-1,this._length,"index");let s=1+(e=e<0?this._length-1:e-1)&31;for(let r=Math.floor(e/32);r>=0;r--){let e=t?this._data[r]:~this._data[r];0!=s&&(e&=~(4294967295<<s),s=0);for(let t=24;0!=e;t-=8,e<<=8){const s=n._lastOnBit[e>>>24];if(s>=0)return s+32*r+t}}return-1}}n._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]),n._firstOnBit=Int8Array.from([-1,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0]),n._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])},8467:(e,t,s)=>{"use strict";s.d(t,{X5:()=>M,ow:()=>F,bb:()=>N,W3:()=>x,gw:()=>k,l_:()=>_,f6:()=>$,jh:()=>E,Wh:()=>P,ci:()=>I,Bu:()=>S,zg:()=>A,AB:()=>H,QK:()=>m});var n=s(4469),r=s(976);s(9133);const i=r.DataFrame.fromCsv('countries,fasta,smiles,molregno,LON,Zip Code,Street Address Line 1,ImageUrl,user_id,error_message,xray,flag,magnitude,CS-id,pdb_id,accel_a,time_offset,chart,fit,Questions,empty_number,empty_string\nBelgium,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C(=O)OCCCc1cccnc1)c2cccc(c2)C(=O)c3ccccc3,1480014,36.276729583740234,995042300,14016 ROUTE 31W,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,1,1,1QBS,1,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.497360340644872, 1.7058694986686864, 5.278052678195135, 0.16000320889028383],""points"":[{""x"":0.10000000149011612,""y"":2.374499797821045},{""x"":0.6000000238418579,""y"":2.6242473125457764},{""x"":1.100000023841858,""y"":2.367267608642578},{""x"":1.600000023841858,""y"":2.6723148822784424},{""x"":2.0999999046325684,""y"":2.6537344455718994},{""x"":2.5999999046325684,""y"":2.3651671409606934},{""x"":3.0999999046325684,""y"":2.5654284954071045},{""x"":3.5999999046325684,""y"":2.4160959720611572},{""x"":4.099999904632568,""y"":2.286726713180542},{""x"":4.599999904632568,""y"":2.5100042819976807},{""x"":5.099999904632568,""y"":1.6676985025405884},{""x"":5.599999904632568,""y"":0.680136501789093},{""x"":6.099999904632568,""y"":0.3391543924808502},{""x"":6.599999904632568,""y"":0.09038983285427094},{""x"":7.099999904632568,""y"":0.19802775979042053}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[7.525235855508179, 1.3186911876809984, 5.335672608564294, 0.7860743343958098],""points"":[{""x"":0.10000000149011612,""y"":7.988070487976074},{""x"":0.6000000238418579,""y"":7.018453121185303},{""x"":1.100000023841858,""y"":8.115279197692871},{""x"":1.600000023841858,""y"":7.486658096313477},{""x"":2.0999999046325684,""y"":7.396438121795654},{""x"":2.5999999046325684,""y"":7.477052211761475},{""x"":3.0999999046325684,""y"":6.913095474243164},{""x"":3.5999999046325684,""y"":8.01385498046875},{""x"":4.099999904632568,""y"":6.985900402069092},{""x"":4.599999904632568,""y"":6.970335960388184},{""x"":5.099999904632568,""y"":5.448817253112793},{""x"":5.599999904632568,""y"":2.5534818172454834},{""x"":6.099999904632568,""y"":1.893947958946228},{""x"":6.599999904632568,""y"":0.6340042352676392},{""x"":7.099999904632568,""y"":0.8403874039649963}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,100,abc\nBurundi,MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW,COc1ccc2cc(ccc2c1)C(C)C(=O)Oc3ccc(C)cc3OC,1480015,36.276729583740234,995073444,80 STATE HIGHWAY 310,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,2,2,1ZP8,2,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.431460753103398, 2.1691498799246745, 5.266445597102774, 0.7825762827017926],""points"":[{""x"":0.10000000149011612,""y"":4.751083850860596},{""x"":0.6000000238418579,""y"":4.203000068664551},{""x"":1.100000023841858,""y"":4.415858745574951},{""x"":1.600000023841858,""y"":4.68414306640625},{""x"":2.0999999046325684,""y"":4.198400974273682},{""x"":2.5999999046325684,""y"":4.179222106933594},{""x"":3.0999999046325684,""y"":4.638473987579346},{""x"":3.5999999046325684,""y"":4.708553314208984},{""x"":4.099999904632568,""y"":4.291589260101318},{""x"":4.599999904632568,""y"":4.038082599639893},{""x"":5.099999904632568,""y"":3.4349939823150635},{""x"":5.599999904632568,""y"":1.2194708585739136},{""x"":6.099999904632568,""y"":1.1920831203460693},{""x"":6.599999904632568,""y"":0.5352635979652405},{""x"":7.099999904632568,""y"":0.3346920311450958}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.339458017970126, -1.0734184310171178, 4.746332950550934, 0.2482416857595658],""points"":[{""x"":0.10000000149011612,""y"":0.2139337658882141},{""x"":0.6000000238418579,""y"":0.4269562065601349},{""x"":1.100000023841858,""y"":0.2441573292016983},{""x"":1.600000023841858,""y"":0.146635964512825},{""x"":2.0999999046325684,""y"":0.08818462491035461},{""x"":2.5999999046325684,""y"":0.2560656666755676},{""x"":3.0999999046325684,""y"":0.42434045672416687},{""x"":3.5999999046325684,""y"":0.37111231684684753},{""x"":4.099999904632568,""y"":0.5581737160682678},{""x"":4.599999904632568,""y"":1.183590054512024},{""x"":5.099999904632568,""y"":1.5629843473434448},{""x"":5.599999904632568,""y"":2.3211288452148438},{""x"":6.099999904632568,""y"":2.229961633682251},{""x"":6.599999904632568,""y"":2.2560226917266846},{""x"":7.099999904632568,""y"":2.2142398357391357}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCameroon,MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL,COc1ccc2cc(ccc2c1)C(C)C(=O)OCCCc3cccnc3,1480016,36.26095962524414,995153596,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,3,3,2BDJ,3,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.6760652578642325, 0.9046956320756703, 5.651408971856738, 0.07738846012184185],""points"":[{""x"":0.10000000149011612,""y"":4.32425594329834},{""x"":0.6000000238418579,""y"":4.668442249298096},{""x"":1.100000023841858,""y"":4.379785060882568},{""x"":1.600000023841858,""y"":5.0345139503479},{""x"":2.0999999046325684,""y"":4.878653526306152},{""x"":2.5999999046325684,""y"":4.3451313972473145},{""x"":3.0999999046325684,""y"":4.336992263793945},{""x"":3.5999999046325684,""y"":5.037430286407471},{""x"":4.099999904632568,""y"":5.0092692375183105},{""x"":4.599999904632568,""y"":4.151902675628662},{""x"":5.099999904632568,""y"":3.4066951274871826},{""x"":5.599999904632568,""y"":2.3732759952545166},{""x"":6.099999904632568,""y"":1.673728108406067},{""x"":6.599999904632568,""y"":0.48574790358543396},{""x"":7.099999904632568,""y"":0.2783052325248718}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.938395863010111, -1.4658480661392117, 5.462702751996584, 0.3473139023615039],""points"":[{""x"":0.10000000149011612,""y"":0.4941710829734802},{""x"":0.6000000238418579,""y"":0.15323974192142487},{""x"":1.100000023841858,""y"":0.46373432874679565},{""x"":1.600000023841858,""y"":0.3370431363582611},{""x"":2.0999999046325684,""y"":0.5179030299186707},{""x"":2.5999999046325684,""y"":0.27899765968322754},{""x"":3.0999999046325684,""y"":0.22075064480304718},{""x"":3.5999999046325684,""y"":0.5789918899536133},{""x"":4.099999904632568,""y"":0.21169911324977875},{""x"":4.599999904632568,""y"":0.27857646346092224},{""x"":5.099999904632568,""y"":1.0906332731246948},{""x"":5.599999904632568,""y"":1.8520300388336182},{""x"":6.099999904632568,""y"":2.7177059650421143},{""x"":6.599999904632568,""y"":2.8680918216705322},{""x"":7.099999904632568,""y"":3.2413077354431152}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCanada,MMELVLKTIIGPIVVGVVLRIVDKWLNKDK,CC(C(=O)NCCS)c1cccc(c1)C(=O)c2ccccc2,1480017,36.26095962524414,99515,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,4,4,1IAN,4,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[0.8597390975430008, 1.0957625732481946, 5.260537067987958, 0.07974187998177736],""points"":[{""x"":0.10000000149011612,""y"":0.8190152645111084},{""x"":0.6000000238418579,""y"":0.8421689867973328},{""x"":1.100000023841858,""y"":0.8740922212600708},{""x"":1.600000023841858,""y"":0.8924275040626526},{""x"":2.0999999046325684,""y"":0.8249067664146423},{""x"":2.5999999046325684,""y"":0.9327669143676758},{""x"":3.0999999046325684,""y"":0.8522974252700806},{""x"":3.5999999046325684,""y"":0.8174492716789246},{""x"":4.099999904632568,""y"":0.8394647240638733},{""x"":4.599999904632568,""y"":0.7139387726783752},{""x"":5.099999904632568,""y"":0.5561167597770691},{""x"":5.599999904632568,""y"":0.3276226818561554},{""x"":6.099999904632568,""y"":0.12479474395513535},{""x"":6.599999904632568,""y"":0.13006797432899475},{""x"":7.099999904632568,""y"":0.059702079743146896}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.760930219582546, 1.6591793293833013, 4.667155929720851, 0.7858109544121652],""points"":[{""x"":0.10000000149011612,""y"":6.156993389129639},{""x"":0.6000000238418579,""y"":5.236701965332031},{""x"":1.100000023841858,""y"":6.010560512542725},{""x"":1.600000023841858,""y"":5.495512962341309},{""x"":2.0999999046325684,""y"":6.087770462036133},{""x"":2.5999999046325684,""y"":5.79986572265625},{""x"":3.0999999046325684,""y"":5.597546577453613},{""x"":3.5999999046325684,""y"":5.520902156829834},{""x"":4.099999904632568,""y"":5.360654354095459},{""x"":4.599999904632568,""y"":3.5539746284484863},{""x"":5.099999904632568,""y"":1.577236294746399},{""x"":5.599999904632568,""y"":1.0001264810562134},{""x"":6.099999904632568,""y"":0.9305797815322876},{""x"":6.599999904632568,""y"":0.6033638715744019},{""x"":7.099999904632568,""y"":0.4203685522079468}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nColombia,MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN,FC(F)(F)c1ccc(OC2CCNCC2)cc1,1480029,36.3309440612793,995152050,1 COURT HOUSE SQUARE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,5,5,4UJ1,5,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[6.4995088314153655, 2.4270351004539914, 5.178659535348579, 0.625653346241577],""points"":[{""x"":0.10000000149011612,""y"":6.496231555938721},{""x"":0.6000000238418579,""y"":6.42543363571167},{""x"":1.100000023841858,""y"":7.040063858032227},{""x"":1.600000023841858,""y"":6.1115403175354},{""x"":2.0999999046325684,""y"":6.680728435516357},{""x"":2.5999999046325684,""y"":6.406774520874023},{""x"":3.0999999046325684,""y"":6.611269474029541},{""x"":3.5999999046325684,""y"":5.889094352722168},{""x"":4.099999904632568,""y"":6.75344705581665},{""x"":4.599999904632568,""y"":6.361435890197754},{""x"":5.099999904632568,""y"":4.1666975021362305},{""x"":5.599999904632568,""y"":1.172118902206421},{""x"":6.099999904632568,""y"":0.801048994064331},{""x"":6.599999904632568,""y"":0.4640021026134491},{""x"":7.099999904632568,""y"":0.0010357667924836278}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[1.4734381347446401, 1.1649805188074196, 4.82958608866421, 0.09500545496710007],""points"":[{""x"":0.10000000149011612,""y"":1.5279096364974976},{""x"":0.6000000238418579,""y"":1.3559974431991577},{""x"":1.100000023841858,""y"":1.5246378183364868},{""x"":1.600000023841858,""y"":1.5567657947540283},{""x"":2.0999999046325684,""y"":1.4114240407943726},{""x"":2.5999999046325684,""y"":1.4045010805130005},{""x"":3.0999999046325684,""y"":1.4769829511642456},{""x"":3.5999999046325684,""y"":1.4875500202178955},{""x"":4.099999904632568,""y"":1.2991987466812134},{""x"":4.599999904632568,""y"":0.922961413860321},{""x"":5.099999904632568,""y"":0.6520044803619385},{""x"":5.599999904632568,""y"":0.15350978076457977},{""x"":6.099999904632568,""y"":0.1078903079032898},{""x"":6.599999904632568,""y"":0.17276449501514435},{""x"":7.099999904632568,""y"":0.14066608250141144}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCosta Rica,MKSTKEEIQTIKTLLKDSRTAKYHKRLQIVL,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCCc3ccccc3,1480018,36.3309440612793,995084218,4041 SOUTHWESTERN BLVD,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,6,6,2BPW,6,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.4833641843311227, -1.8945978742090062, 4.671127708092568, 0.24159861311815153],""points"":[{""x"":0.10000000149011612,""y"":0.0969524160027504},{""x"":0.6000000238418579,""y"":0.028483040630817413},{""x"":1.100000023841858,""y"":0.22087176144123077},{""x"":1.600000023841858,""y"":0.0068915546871721745},{""x"":2.0999999046325684,""y"":0.4305879771709442},{""x"":2.5999999046325684,""y"":0.44774115085601807},{""x"":3.0999999046325684,""y"":0.45346319675445557},{""x"":3.5999999046325684,""y"":0.2370593100786209},{""x"":4.099999904632568,""y"":0.4657953977584839},{""x"":4.599999904632568,""y"":1.155200719833374},{""x"":5.099999904632568,""y"":2.2294070720672607},{""x"":5.599999904632568,""y"":2.4311530590057373},{""x"":6.099999904632568,""y"":2.33846116065979},{""x"":6.599999904632568,""y"":2.608201026916504},{""x"":7.099999904632568,""y"":2.8136143684387207}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.224573521642033, 1.4454033924198528, 5.6014197746076535, 0.2823216054197577],""points"":[{""x"":0.10000000149011612,""y"":4.95027494430542},{""x"":0.6000000238418579,""y"":5.1754679679870605},{""x"":1.100000023841858,""y"":5.276752948760986},{""x"":1.600000023841858,""y"":5.589294910430908},{""x"":2.0999999046325684,""y"":5.616994857788086},{""x"":2.5999999046325684,""y"":5.120813846588135},{""x"":3.0999999046325684,""y"":5.340766906738281},{""x"":3.5999999046325684,""y"":4.876471042633057},{""x"":4.099999904632568,""y"":4.94999361038208},{""x"":4.599999904632568,""y"":5.162564754486084},{""x"":5.099999904632568,""y"":4.399557590484619},{""x"":5.599999904632568,""y"":2.7977969646453857},{""x"":6.099999904632568,""y"":1.0229872465133667},{""x"":6.599999904632568,""y"":0.48275601863861084},{""x"":7.099999904632568,""y"":0.10408931970596313}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCuba,MHAILRYFIRRLFYHIFYKIYSLISKKHQSLPSDVRQF,COc1ccc2c(c1)c(CC(=O)N3CCCC3C(=O)Oc4ccc(C)cc4OC)c(C)n2C(=O)c5ccc(Cl)cc5,1480019,36.33115768432617,995081928,1227 US HIGHWAY 11,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,7,7,1QBS,7,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.320838679713925, -1.2421619987316728, 4.831325425225256, 0.3236011098403072],""points"":[{""x"":0.10000000149011612,""y"":0.3727470338344574},{""x"":0.6000000238418579,""y"":0.12365014106035233},{""x"":1.100000023841858,""y"":0.48422467708587646},{""x"":1.600000023841858,""y"":0.2264465093612671},{""x"":2.0999999046325684,""y"":0.16821794211864471},{""x"":2.5999999046325684,""y"":0.3879014551639557},{""x"":3.0999999046325684,""y"":0.5470244884490967},{""x"":3.5999999046325684,""y"":0.3419053554534912},{""x"":4.099999904632568,""y"":0.7655120491981506},{""x"":4.599999904632568,""y"":1.2346516847610474},{""x"":5.099999904632568,""y"":2.453336715698242},{""x"":5.599999904632568,""y"":2.9565491676330566},{""x"":6.099999904632568,""y"":3.335299491882324},{""x"":6.599999904632568,""y"":3.240290880203247},{""x"":7.099999904632568,""y"":3.1107218265533447}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.6401853521511094, 1.26211588875013, 5.399028074402744, 0.5089580830068091],""points"":[{""x"":0.10000000149011612,""y"":3.8585598468780518},{""x"":0.6000000238418579,""y"":3.6077206134796143},{""x"":1.100000023841858,""y"":3.855252265930176},{""x"":1.600000023841858,""y"":3.619039297103882},{""x"":2.0999999046325684,""y"":3.839388370513916},{""x"":2.5999999046325684,""y"":3.335283041000366},{""x"":3.0999999046325684,""y"":3.571141481399536},{""x"":3.5999999046325684,""y"":3.4155046939849854},{""x"":4.099999904632568,""y"":3.7316646575927734},{""x"":4.599999904632568,""y"":3.0680155754089355},{""x"":5.099999904632568,""y"":2.891066551208496},{""x"":5.599999904632568,""y"":1.6022753715515137},{""x"":6.099999904632568,""y"":0.7652576565742493},{""x"":6.599999904632568,""y"":0.6875326037406921},{""x"":7.099999904632568,""y"":0.5828871726989746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nItaly,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO[N+](=O)[O-],1480020,36.33115768432617,99502,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,8,8,1ZP8,8,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.293592105923809, 1.3781586549141835, 5.1025898038676605, 0.03493851245291291],""points"":[{""x"":0.10000000149011612,""y"":2.1287283897399902},{""x"":0.6000000238418579,""y"":2.267972230911255},{""x"":1.100000023841858,""y"":2.398442506790161},{""x"":1.600000023841858,""y"":2.5130622386932373},{""x"":2.0999999046325684,""y"":2.3255116939544678},{""x"":2.5999999046325684,""y"":2.127340793609619},{""x"":3.0999999046325684,""y"":2.47259783744812},{""x"":3.5999999046325684,""y"":2.131181478500366},{""x"":4.099999904632568,""y"":2.090421438217163},{""x"":4.599999904632568,""y"":2.02299165725708},{""x"":5.099999904632568,""y"":1.1105059385299683},{""x"":5.599999904632568,""y"":0.4494485855102539},{""x"":6.099999904632568,""y"":0.1375635862350464},{""x"":6.599999904632568,""y"":0.036351121962070465},{""x"":7.099999904632568,""y"":0.1619771122932434}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.953125499439879, 1.2528620255306528, 5.187637440149802, 0.3110348753260886],""points"":[{""x"":0.10000000149011612,""y"":5.6585283279418945},{""x"":0.6000000238418579,""y"":5.911152362823486},{""x"":1.100000023841858,""y"":5.924920082092285},{""x"":1.600000023841858,""y"":5.8469438552856445},{""x"":2.0999999046325684,""y"":5.929472923278809},{""x"":2.5999999046325684,""y"":6.190037727355957},{""x"":3.0999999046325684,""y"":6.236179828643799},{""x"":3.5999999046325684,""y"":6.141019344329834},{""x"":4.099999904632568,""y"":5.295210838317871},{""x"":4.599999904632568,""y"":5.265801906585693},{""x"":5.099999904632568,""y"":3.3722851276397705},{""x"":5.599999904632568,""y"":1.8299226760864258},{""x"":6.099999904632568,""y"":0.32690900564193726},{""x"":6.599999904632568,""y"":0.6274543404579163},{""x"":7.099999904632568,""y"":0.8441857099533081}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nRwanda,MPNSEPASLLELFNSIATQGELVRSLKAGNASK,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO,1480021,36.33137130737305,995037247,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,9,2BDJ,9,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.8209972202654474, 1.3779216716448506, 5.299882228439686, 0.06040645519069608],""points"":[{""x"":0.10000000149011612,""y"":3.7821109294891357},{""x"":0.6000000238418579,""y"":3.542433023452759},{""x"":1.100000023841858,""y"":3.7008674144744873},{""x"":1.600000023841858,""y"":3.717301607131958},{""x"":2.0999999046325684,""y"":4.024452209472656},{""x"":2.5999999046325684,""y"":4.013899326324463},{""x"":3.0999999046325684,""y"":3.945094347000122},{""x"":3.5999999046325684,""y"":3.866621971130371},{""x"":4.099999904632568,""y"":3.7461626529693604},{""x"":4.599999904632568,""y"":3.3454740047454834},{""x"":5.099999904632568,""y"":2.61944317817688},{""x"":5.599999904632568,""y"":0.999405026435852},{""x"":6.099999904632568,""y"":0.46259793639183044},{""x"":6.599999904632568,""y"":0.054134611040353775},{""x"":7.099999904632568,""y"":0.05711187422275543}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.6318079657726035, 1.8495493770000595, 5.391793312471116, 0.17060707587348442],""points"":[{""x"":0.10000000149011612,""y"":5.458079814910889},{""x"":0.6000000238418579,""y"":5.554427146911621},{""x"":1.100000023841858,""y"":5.799983024597168},{""x"":1.600000023841858,""y"":5.364140033721924},{""x"":2.0999999046325684,""y"":5.864485740661621},{""x"":2.5999999046325684,""y"":5.4509806632995605},{""x"":3.0999999046325684,""y"":5.702574729919434},{""x"":3.5999999046325684,""y"":5.7314534187316895},{""x"":4.099999904632568,""y"":5.5123443603515625},{""x"":4.599999904632568,""y"":5.724395751953125},{""x"":5.099999904632568,""y"":4.354506969451904},{""x"":5.599999904632568,""y"":1.7307666540145874},{""x"":6.099999904632568,""y"":0.6305936574935913},{""x"":6.599999904632568,""y"":0.035183437168598175},{""x"":7.099999904632568,""y"":0.7575169205665588}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nSwitzerland,IRVVGRYLIEVWKAAGMDMDKVLFLWSSDEI,CN1CCC(CC1)Oc2ccc(cc2)C(F)(F)F,1480028,36.33137130737305,99504,92-11 179TH PLACE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,10,1IAN,10,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[1.1190255865097471, 2.3163895161544437, 5.4968866182279195, 0.2035204047289052],""points"":[{""x"":0.10000000149011612,""y"":1.1057683229446411},{""x"":0.6000000238418579,""y"":1.1019697189331055},{""x"":1.100000023841858,""y"":1.0818607807159424},{""x"":1.600000023841858,""y"":1.062997817993164},{""x"":2.0999999046325684,""y"":1.046447515487671},{""x"":2.5999999046325684,""y"":1.1217249631881714},{""x"":3.0999999046325684,""y"":1.2166996002197266},{""x"":3.5999999046325684,""y"":1.215477705001831},{""x"":4.099999904632568,""y"":1.0581893920898438},{""x"":4.599999904632568,""y"":1.1747995615005493},{""x"":5.099999904632568,""y"":1.0181127786636353},{""x"":5.599999904632568,""y"":0.5344523191452026},{""x"":6.099999904632568,""y"":0.2569526433944702},{""x"":6.599999904632568,""y"":0.1912207305431366},{""x"":7.099999904632568,""y"":0.15060538053512573}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.1038581025805785, 2.0032224204185245, 5.087602825989163, 0.13277988512492753],""points"":[{""x"":0.10000000149011612,""y"":3.0498509407043457},{""x"":0.6000000238418579,""y"":2.805217742919922},{""x"":1.100000023841858,""y"":3.3415253162384033},{""x"":1.600000023841858,""y"":3.0549843311309814},{""x"":2.0999999046325684,""y"":3.250074863433838},{""x"":2.5999999046325684,""y"":3.0432586669921875},{""x"":3.0999999046325684,""y"":3.265852451324463},{""x"":3.5999999046325684,""y"":2.9475724697113037},{""x"":4.099999904632568,""y"":3.1929898262023926},{""x"":4.599999904632568,""y"":2.7460060119628906},{""x"":5.099999904632568,""y"":1.6175861358642578},{""x"":5.599999904632568,""y"":0.3006608486175537},{""x"":6.099999904632568,""y"":0.3444803059101105},{""x"":6.599999904632568,""y"":0.015537971630692482},{""x"":7.099999904632568,""y"":0.5527358055114746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\n,,,,,,,,,,,,,,,,,,,,,');i.columns.add(r.Column.fromList(r.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var o=function(e,t,s,n){return new(s||(s=Promise))((function(r,i){function o(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}l((n=n.apply(e,t||[])).next())}))};const a=3e4,l=108e5,c=console.log.bind(console),h=console.info.bind(console),u=console.warn.bind(console),d=console.error.bind(console),m={},p="Auto Tests",f="Demo",g="Detectors",y="Core",b={};let w;var C;!function(e){e.notNull=function(e,t){if(null==e)throw new Error(`${null==t?"Value":t} not defined`)}}(C||(C={}));class v{constructor(e,t){this.catchUnhandled=!0,this.report=!1,void 0!==e&&(this.catchUnhandled=e),void 0!==t&&(this.report=t)}}class T{constructor(e,t,s,n){var r;this.category=e,this.name=t,null!=n||(n={}),null!==(r=n.timeout)&&void 0!==r||(n.timeout=a),this.options=n,this.test=()=>o(this,void 0,void 0,(function*(){return new Promise(((e,t)=>o(this,void 0,void 0,(function*(){let n="";try{n=yield s()}catch(e){t(e)}e(n)}))))}))}}function A(e,t,s,n=0,r="timeout"){return o(this,void 0,void 0,(function*(){return new Promise(((i,o)=>{const a=e.subscribe((e=>{try{t(e),i("OK")}catch(e){o(e)}a.unsubscribe(),clearTimeout(l)})),l=setTimeout((()=>{a.unsubscribe(),o(r)}),n);s()}))}))}function S(e,t,s){null==m[w]&&(m[w]={}),null==m[w].tests&&(m[w].tests=[]),m[w].tests.push(new T(w,e,t,s))}function _(e,t=!0,s){if(s=s?`${s}, `:"",e!==t)throw new Error(`${s}Expected "${t}", got "${e}"`)}function E(e,t,s=.001,n){if(e===Number.POSITIVE_INFINITY&&t===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY&&t===Number.NEGATIVE_INFINITY||e===Number.NaN&&t===Number.NaN||isNaN(e)&&isNaN(t))return;const r=Math.abs(e-t)<s;if(_(r,!0,`${null!=n?n:""} (tolerance = ${s})`),!r)throw new Error(`Expected ${t}, got ${e} (tolerance = ${s})`)}function P(e,t){for(const[s,n]of Object.entries(t)){if(!e.hasOwnProperty(s))throw new Error(`Expected property "${s}" not found`);const t=e[s];if(t instanceof Array&&n instanceof Array)$(t,n);else if(t instanceof Object&&n instanceof Object)P(t,n);else if(Number.isFinite(t)&&Number.isFinite(n))E(t,n);else if(t!=n)throw new Error(`Expected (${n}) for key '${s}', got (${t})`)}}function $(e,t){const s=e.length,n=t.length;if(s!=n)throw new Error(`Arrays are of different length: actual array length is ${s} and expected array length is ${n}`);for(let n=0;n<s;n++)if(e[n]instanceof Array&&t[n]instanceof Array)$(e[n],t[n]);else if(e[n]instanceof Object&&t[n]instanceof Object)P(e[n],t[n]);else if(e[n]!=t[n])throw new Error(`Expected ${t[n]} at position ${n}, got ${e[n]}`)}function x(e,t,s){var n;w=e,t(),m[w]&&(m[w].clear=null===(n=null==s?void 0:s.clear)||void 0===n||n,m[w].timeout=null==s?void 0:s.timeout)}function N(e){null==m[w]&&(m[w]={}),m[w].before=e}function M(e){null==m[w]&&(m[w]={}),m[w].after=e}function L(e,t){return e.replace(new RegExp(t.name,"gi"),t.nqName)}function I(e){var t,s,a,l,w,C,A;return o(this,void 0,void 0,(function*(){const S=null===(s=null===(t=n.functions.getCurrentCall())||void 0===t?void 0:t.func)||void 0===s?void 0:s.package;yield function(e,t){var s;return o(this,void 0,void 0,(function*(){const t=e.id;if(b[t])return;const a=m;if(void 0!==a[p]||void 0!==a[f]||Object.keys(a).find((e=>e.startsWith(p)||e.startsWith(y))))return void(b[t]=!0);if("DevTools"===e.name){const e=r.Func.find({tags:["dartTest"]});for(const t of e){const e=t.name.split(/\s*\|\s*/g),n=null!==(s=e.pop())&&void 0!==s?s:t.name,r=e.length?y+": "+e.join(": "):y;void 0===a[r]&&(a[r]={tests:[],clear:!0}),a[r].tests.push(new T(r,n,(()=>o(this,void 0,void 0,(function*(){return yield t.apply()}))),{isAggregated:t.outputs.length>0,timeout:3e5}))}}const l=[],c=[],h=[],u=yield n.dapi.functions.filter(`package.id = "${t}"`).list(),d=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)|timeout:\s*(\d+)/g);for(const e of u){const t=e.options.test,s=e.options.demoPath;if(t&&Array.isArray(t)&&t.length)for(let s=0;s<t.length;s++){const r=t[s].matchAll(d),i={};Array.from(r).forEach((e=>{e[0].startsWith("skip")?i.skip=e[1]:e[0].startsWith("wait")?i.wait=parseInt(e[2]):e[0].startsWith("cat")?i.cat=e[3]:e[0].startsWith("timeout")&&(i.timeout=parseInt(e[4]))}));const c=new T(p,1===t.length?e.name:`${e.name} ${s+1}`,(()=>o(this,void 0,void 0,(function*(){const r=yield n.functions.eval(L(t[s],e));if(i.wait&&(yield k(i.wait)),"boolean"==typeof r&&!r)throw`Failed: ${t[s]}, expected true, got ${r}`}))),{skipReason:i.skip,timeout:i.timeout});if(i.cat){const e=p+": "+i.cat;c.category=e,void 0===a[e]&&(a[e]={tests:[],clear:!0}),a[e].tests.push(c)}else l.push(c)}if(s){const t=e.options.demoWait?parseInt(e.options.demoWait):void 0,s=new T(f,e.friendlyName,(()=>o(this,void 0,void 0,(function*(){if(n.shell.lastError="",yield e.apply(),yield k(t||2e3),n.shell.lastError)throw new Error(n.shell.lastError)}))),{skipReason:e.options.demoSkip});c.push(s)}if(e.hasTag("semTypeDetector")){const t=new T(g,e.friendlyName,(()=>o(this,void 0,void 0,(function*(){const t=[];for(const s of i.clone().columns){const n=yield e.apply([s]);t.push(n||s.semType)}_(t.filter((e=>e)).length,1)}))),{skipReason:e.options.skipTest});h.push(t)}}b[t]=!0,l.length&&(a[p]={tests:l,clear:!0}),c.length&&(a[f]={tests:c,clear:!0}),h.length&&(a[g]={tests:h,clear:!1})}))}(S);const E=[];console.log("Running tests"),null!=e||(e={}),null!==(a=(A=e).testContext)&&void 0!==a||(A.testContext=new v),n.shell.lastError="";const P=[],$=function(){const e=[];return console.log=(...t)=>{e.push(...t),c(...t)},console.info=(...t)=>{e.push(...t),h(...t)},console.warn=(...t)=>{e.push(...t),u(...t)},console.error=(...t)=>{e.push(...t),d(...t)},e}();try{for(const[t,s]of Object.entries(m)){if((null==e?void 0:e.category)&&!t.toLowerCase().startsWith(null==e?void 0:e.category.toLowerCase())||(null===(l=e.exclude)||void 0===l?void 0:l.some((e=>t.startsWith(e)))))continue;c(`Started ${t} category`),P.push(t);const i=null===(w=s.tests)||void 0===w?void 0:w.every((e=>{var t;return null===(t=e.options)||void 0===t?void 0:t.skipReason}));try{s.before&&!i&&(yield s.before())}catch(e){s.beforeStatus=R(e)}const o=null!==(C=s.tests)&&void 0!==C?C:[],a=[];if(s.clear)for(let t=0;t<o.length;t++)a.push(yield O(o[t],null==e?void 0:e.test,$,s.timeout,S.name,e.verbose)),n.shell.closeAll(),r.Balloon.closeAll();else for(let t=0;t<o.length;t++)a.push(yield O(o[t],null==e?void 0:e.test,$,s.timeout,S.name,e.verbose));const h=a.filter((e=>"skipped"!=e.result));try{s.after&&!i&&(yield s.after())}catch(e){s.afterStatus=R(e)}s.afterStatus&&h.push({category:t,name:"after",result:s.afterStatus,success:!1,ms:0,skipped:!1}),s.beforeStatus&&h.push({category:t,name:"before",result:s.beforeStatus,success:!1,ms:0,skipped:!1}),E.push(...h)}}finally{console.log=c,console.info=h,console.warn=u,console.error=d}if(e.testContext.catchUnhandled&&(yield k(1e3),n.shell.lastError.length>0&&E.push({category:"Unhandled exceptions",name:"exceptions",result:n.shell.lastError,success:!1,ms:0,skipped:!1})),!e.test&&E.length){const t=E.filter((e=>e.success)).length,s=E.filter((e=>e.skipped)).length,i=E.filter((e=>!e.success)),o=S.name;for(const e of P){const t=E.filter((t=>t.category===e)),s=t.filter((e=>!e.success)).length,r={success:0===s,passed:t.filter((e=>e.success)).length,skipped:t.filter((e=>e.skipped)).length,failed:s,type:"package",packageName:o,category:e};n.log.usage(`${o}: ${e}`,r,`category-package ${o}: ${e}`)}if(!e.category){const e={success:0===i.length,passed:t,skipped:s,failed:i.length,type:"package",packageName:o};n.log.usage(o,e,`package-package ${o}`)}if(e.testContext.report){const e=new r.Logger,n="Package @package tested: @successful successful, @skipped skipped, @failed failed tests",o={successful:t,skipped:s,failed:i.length,package:S};for(const e of i)Object.assign(o,{[`${e.category} | ${e.name}`]:e.result});e.log(n,o,"package-tested")}}return E}))}function R(e){return`${e.toString()}\n${e.stack?r.Logger.translateStackTrace(e.stack):""}`}function O(e,t,s,i,h,u){var d,m,p,f,g,y;return o(this,void 0,void 0,(function*(){let o;s.length=0;let b="package";const w=null!=t&&e.name.toLowerCase()!==t.toLowerCase(),C=(null===(d=e.options)||void 0===d?void 0:d.skipReason)||w,v=w?"skipped":null===(m=e.options)||void 0===m?void 0:m.skipReason;C||c(`Started ${e.category} ${e.name}`);const T=Date.now();try{if(C)o={success:!0,result:v,ms:0,skipped:!0};else{let t=(null===(p=e.options)||void 0===p?void 0:p.timeout)===a&&i?i:null===(f=e.options)||void 0===f?void 0:f.timeout;t=r.Test.isInBenchmark&&t===a?l:t,o={success:!0,result:null!==(g=yield D(e.test,t))&&void 0!==g?g:"OK",ms:0,skipped:!1}}}catch(e){o={success:!1,result:R(e),ms:0,skipped:!1}}if((null===(y=e.options)||void 0===y?void 0:y.isAggregated)&&o.result.constructor===r.DataFrame){const e=o.result.col("success");if(b="core",e&&(o.success=e.stats.sum===e.length),!u){const e=o.result;e.columns.remove("stack"),e.rows.removeWhere((e=>e.get("success"))),o.result=e}o.result=o.result.toCsv()}if(o.logs=s.join("\n"),o.ms=Date.now()-T,C||c(`Finished ${e.category} ${e.name} for ${o.ms} ms`),o.category=e.category,o.name=e.name,!w){let t={success:o.success,result:o.result,ms:o.ms,skipped:o.skipped,type:b,packageName:h,category:e.category,test:e.name,logs:o.logs};if(o.result.constructor==Object){const e=Object.keys(o.result).reduce(((e,t)=>Object.assign(Object.assign({},e),{["result."+t]:o.result[t]})),{});t=Object.assign(Object.assign({},t),e)}n.log.usage(`${h}: ${e.category}: ${e.name}`,t,`test-${b} ${h}: ${e.category}: ${e.name}`)}return o}))}function k(e){return o(this,void 0,void 0,(function*(){yield new Promise((t=>setTimeout(t,e)))}))}function F(e,t="Timeout exceeded",s=500,n=50){return o(this,void 0,void 0,(function*(){return new Promise(((r,i)=>{setTimeout((()=>{clearInterval(o),i(new Error(t))}),s);const o=setInterval((()=>{e()&&(clearInterval(o),r())}),n)}))}))}function D(e,t){return o(this,void 0,void 0,(function*(){let s=null;const n=new Promise(((e,n)=>{s=setTimeout((()=>{n("EXECUTION TIMEOUT")}),t)}));try{return yield Promise.race([e(),n])}finally{s&&clearTimeout(s)}}))}const G=r.DataFrame.fromColumns([r.Column.fromStrings("col",["val1","val2","val3"])]);function H(e,t,s){var i;return o(this,void 0,void 0,(function*(){const a=(e,t,s)=>o(this,void 0,void 0,(function*(){let n;return s?(n=yield e.dataFrame.plot.fromType(t),e.dockManager.dock(n)):n=e.addViewer(t),n}));(null==s?void 0:s.detectSemanticTypes)&&(yield n.data.detectSemanticTypes(t));let l=n.shell.addTableView(t);const c=`[name=viewer-${e.replace(/\s+/g,"-")} i]`,h=["div.ui-box","canvas","svg","img","input","h1","a",".d4-viewer-error"].map((e=>`${c} ${e}`)).join(", "),u=[];try{let o=yield a(l,e,null==s?void 0:s.packageName);yield F((()=>null!==document.querySelector(h)),"cannot load viewer",3e3);const d=null===(i=document.querySelector(h))||void 0===i?void 0:i.tagName;if(u.push(Array.from(l.viewers).length),!(null==s?void 0:s.readOnly)){Array.from(t.row(0).cells).forEach((e=>e.value=null));const e=t.rowCount<20?Math.floor(t.rowCount/2):10;t.rows.select((t=>t.idx>=0&&t.idx<e)),yield k(50);for(let s=e;s<2*e;s++)t.filter.set(s,!1);yield k(50),t.currentRowIdx=1;const s=t.clone();t.columns.names().slice(0,Math.ceil(t.columns.length/2)).forEach((e=>t.columns.remove(e))),yield k(100),l.dataFrame=s}let m,p;try{m=o.getOptions(!0).look}catch(e){throw new Error("Viewer's .getOptions() error.",{cause:e})}try{p=o.getProperties()}catch(e){throw new Error("Viewer's .getProperties() error.",{cause:e})}const f={};Object.keys(m).filter((e=>"boolean"==typeof m[e])).forEach((e=>f[e]=!m[e])),p.filter((e=>null!==e.choices)).forEach((e=>f[e.name]=e.choices.find((t=>t!==m[e.name])))),o.setOptions(f),yield k(300);const g=l.saveLayout(),y=o.getOptions().look;l.resetLayout(),u.push(Array.from(l.viewers).length),l.loadLayout(g);const b=`${c} ${d}`;if(yield F((()=>null!==document.querySelector(b)),"cannot load viewer from layout",3e3),u.push(Array.from(l.viewers).length),o=Array.from(l.viewers).find((e=>"Grid"!==e.type)),$(u,[2,1,2]),_(JSON.stringify(o.getOptions().look),JSON.stringify(y)),!1!==(null==s?void 0:s.arbitraryDfTest)){(null==s?void 0:s.awaitViewer)&&(yield s.awaitViewer(o)),n.shell.closeAll(),yield k(100),l=n.shell.addTableView(G);try{o=yield a(l,e,null==s?void 0:s.packageName)}catch(e){return n.shell.closeAll(),void r.Balloon.closeAll()}yield F((()=>null!==document.querySelector(h)),"cannot load viewer on arbitrary dataset",3e3)}(null==s?void 0:s.awaitViewer)&&(yield s.awaitViewer(o))}finally{}}))}},850:(e,t,s)=>{"use strict";function n(e=!1,t="Assertion error."){if(!e)throw new Error(t)}function r(e){let t=0;for(let s=0;s<e.length;s++)t+=e[s]*e[s];return Math.sqrt(t)}function i(e,t){if(e.length!=t.length)throw new Error("The dimensionality of the vectors must match");let s=0;for(let n=0;n<e.length;n++)s+=e[n]*t[n];return s}function o(e,t){let s=0;const n=e.length;if(n!==t.length)throw new Error("The dimensionality of the vectors must match");for(let r=0;r<n;++r)s+=Math.pow(e[r]-t[r],2);return Math.sqrt(s)}function a(e){const t=e.length;let s=0,n=0;for(let r=0;r<t;++r)s+=e[r],n+=Math.pow(e[r],2);const r=s/t,i=1/Math.sqrt(n/t-Math.pow(r,2));for(let s=0;s<t;++s)e[s]=(e[s]-r)*i;return e}s.d(t,{$G:()=>r,Fv:()=>a,MA:()=>i,dP:()=>o,hu:()=>n})},3351:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(1581),r=s(3487),i=s(7023),o=s(4815),a=s(4181),l=s(2141),c="errorMessage",h=new n.Name("emUsed"),u={required:"missingProperty",dependencies:"property",dependentRequired:"property"},d=/\$\{[^}]+\}/,m=/\$\{([^}]+)\}/g,p=/^""\s*\+\s*|\s*\+\s*""$/g;const f=(e,t={})=>{if(!e.opts.allErrors)throw new Error("ajv-errors: Ajv option allErrors must be true");if(e.opts.jsPropertySyntax)throw new Error("ajv-errors: ajv option jsPropertySyntax is not supported");return e.addKeyword(function(e){return{keyword:c,schemaType:["string","object"],post:!0,code(t){const{gen:s,data:f,schema:g,schemaValue:y,it:b}=t;if(!1===b.createErrors)return;const w=g,C=r.strConcat(l.default.instancePath,b.errorPath);function v(e,t){return r.and(n._`${e}.keyword !== ${c}`,n._`!${e}.${h}`,n._`${e}.instancePath === ${C}`,n._`${e}.keyword in ${t}`,n._`${e}.schemaPath.indexOf(${b.errSchemaPath}) === 0`,n._`/^\\/[^\\/]*$/.test(${e}.schemaPath.slice(${b.errSchemaPath.length}))`)}function T(e,t){const n=[];for(const s in e){const e=t[s];d.test(e)&&n.push([s,S(e)])}return s.object(...n)}function A(e){return d.test(e)?new i._Code(i.safeStringify(e).replace(m,((e,t)=>`" + JSON.stringify(${o.getData(t,b)}) + "`)).replace(p,"")):n.stringify(e)}function S(e){return n._`function(){return ${A(e)}}`}s.if(n._`${l.default.errors} > 0`,(()=>{if("object"==typeof w){const[i,o]=function(e){let t,s;for(const n in e){if("properties"===n||"items"===n)continue;const r=e[n];if("object"==typeof r){t||(t={});const e=t[n]={};for(const t in r)e[t]=[]}else s||(s={}),s[n]=[]}return[t,s]}(w);o&&function(r){const i=s.const("emErrors",n.stringify(r)),o=s.const("templates",T(r,g));s.forOf("err",l.default.vErrors,(e=>s.if(v(e,i),(()=>s.code(n._`${i}[${e}.keyword].push(${e})`).assign(n._`${e}.${h}`,!0)))));const{singleError:c}=e;if(c){const e=s.let("message",n._`""`),r=s.let("paramsErrors",n._`[]`);u((t=>{s.if(e,(()=>s.code(n._`${e} += ${"string"==typeof c?c:";"}`))),s.code(n._`${e} += ${d(t)}`),s.assign(r,n._`${r}.concat(${i}[${t}])`)})),a.reportError(t,{message:e,params:n._`{errors: ${r}}`})}else u((e=>a.reportError(t,{message:d(e),params:n._`{errors: ${i}[${e}]}`})));function u(e){s.forIn("key",i,(t=>s.if(n._`${i}[${t}].length`,(()=>e(t)))))}function d(e){return n._`${e} in ${o} ? ${o}[${e}]() : ${y}[${e}]`}}(o),i&&function(e){const r=s.const("emErrors",n.stringify(e)),i=[];for(const t in e)i.push([t,T(e[t],g[t])]);const o=s.const("templates",s.object(...i)),c=s.scopeValue("obj",{ref:u,code:n.stringify(u)}),d=s.let("emPropParams"),m=s.let("emParamsErrors");s.forOf("err",l.default.vErrors,(e=>s.if(v(e,r),(()=>{s.assign(d,n._`${c}[${e}.keyword]`),s.assign(m,n._`${r}[${e}.keyword][${e}.params[${d}]]`),s.if(m,(()=>s.code(n._`${m}.push(${e})`).assign(n._`${e}.${h}`,!0)))})))),s.forIn("key",r,(e=>s.forIn("keyProp",n._`${r}[${e}]`,(i=>{s.assign(m,n._`${r}[${e}][${i}]`),s.if(n._`${m}.length`,(()=>{const r=s.const("tmpl",n._`${o}[${e}] && ${o}[${e}][${i}]`);a.reportError(t,{message:n._`${r} ? ${r}() : ${y}[${e}][${i}]`,params:n._`{errors: ${m}}`})}))}))))}(i),function(e){const{props:i,items:o}=e;if(!i&&!o)return;const u=n._`typeof ${f} == "object"`,d=n._`Array.isArray(${f})`,m=s.let("emErrors");let p,b;const w=s.let("templates");function v(e,t){s.assign(m,n.stringify(e)),s.assign(w,T(e,t))}i&&o?(p=s.let("emChildKwd"),s.if(u),s.if(d,(()=>{v(o,g.items),s.assign(p,n.str`items`)}),(()=>{v(i,g.properties),s.assign(p,n.str`properties`)})),b=n._`[${p}]`):o?(s.if(d),v(o,g.items),b=n._`.items`):i&&(s.if(r.and(u,r.not(d))),v(i,g.properties),b=n._`.properties`),s.forOf("err",l.default.vErrors,(e=>function(e,t,i){s.if(r.and(n._`${e}.keyword !== ${c}`,n._`!${e}.${h}`,n._`${e}.instancePath.indexOf(${C}) === 0`),(()=>{const r=s.scopeValue("pattern",{ref:/^\/([^/]*)(?:\/|$)/,code:n._`new RegExp("^\\\/([^/]*)(?:\\\/|$)")`}),o=s.const("emMatches",n._`${r}.exec(${e}.instancePath.slice(${C}.length))`),a=s.const("emChild",n._`${o} && ${o}[1].replace(/~1/g, "/").replace(/~0/g, "~")`);s.if(n._`${a} !== undefined && ${a} in ${t}`,(()=>i(a)))}))}(e,m,(t=>s.code(n._`${m}[${t}].push(${e})`).assign(n._`${e}.${h}`,!0))))),s.forIn("key",m,(e=>s.if(n._`${m}[${e}].length`,(()=>{a.reportError(t,{message:n._`${e} in ${w} ? ${w}[${e}]() : ${y}${b}[${e}]`,params:n._`{errors: ${m}[${e}]}`}),s.assign(n._`${l.default.vErrors}[${l.default.errors}-1].instancePath`,n._`${C} + "/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`)})))),s.endIf()}(function({properties:e,items:t}){const s={};if(e){s.props={};for(const t in e)s.props[t]=[]}if(t){s.items={};for(let e=0;e<t.length;e++)s.items[e]=[]}return s}(w))}const i="string"==typeof w?w:w._;i&&function(e){const i=s.const("emErrs",n._`[]`);s.forOf("err",l.default.vErrors,(e=>s.if(function(e){return r.and(n._`${e}.keyword !== ${c}`,n._`!${e}.${h}`,r.or(n._`${e}.instancePath === ${C}`,r.and(n._`${e}.instancePath.indexOf(${C}) === 0`,n._`${e}.instancePath[${C}.length] === "/"`)),n._`${e}.schemaPath.indexOf(${b.errSchemaPath}) === 0`,n._`${e}.schemaPath[${b.errSchemaPath}.length] === "/"`)}(e),(()=>s.code(n._`${i}.push(${e})`).assign(n._`${e}.${h}`,!0))))),s.if(n._`${i}.length`,(()=>a.reportError(t,{message:A(e),params:n._`{errors: ${i}}`})))}(i),e.keepErrors||function(){const e=s.const("emErrs",n._`[]`);s.forOf("err",l.default.vErrors,(t=>s.if(n._`!${t}.${h}`,(()=>s.code(n._`${e}.push(${t})`))))),s.assign(l.default.vErrors,e).assign(l.default.errors,n._`${e}.length`)}()}))},metaSchema:{anyOf:[{type:"string"},{type:"object",properties:{properties:{$ref:"#/$defs/stringMap"},items:{$ref:"#/$defs/stringList"},required:{$ref:"#/$defs/stringOrMap"},dependencies:{$ref:"#/$defs/stringOrMap"}},additionalProperties:{type:"string"}}],$defs:{stringMap:{type:"object",additionalProperties:{type:"string"}},stringOrMap:{anyOf:[{type:"string"},{$ref:"#/$defs/stringMap"}]},stringList:{type:"array",items:{type:"string"}}}}}}(t))};t.default=f,e.exports=f,e.exports.default=f},5128:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const n=s(7159),r=s(7299),i=s(1240),o=s(4087),a="https://json-schema.org/draft/2020-12/schema";class l extends n.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),r.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:e,meta:t}=this.opts;t&&(o.default.call(this,e),this.refs["http://json-schema.org/schema"]=a)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}}e.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var c=s(4815);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var h=s(3487);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return h._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return h.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return h.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return h.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return h.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return h.CodeGen}});var u=s(7426);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return u.default}});var d=s(6646);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return d.default}})},1581:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const n=s(7159),r=s(3924),i=s(1240),o=s(98),a=["/properties"],l="http://json-schema.org/draft-07/schema";class c extends n.default{_addVocabularies(){super._addVocabularies(),r.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(o,a):o;this.addMetaSchema(e,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}e.exports=t=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var h=s(4815);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return h.KeywordCxt}});var u=s(3487);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=s(7426);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var m=s(6646);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return m.default}})},7023:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class s{}t._CodeOrName=s,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class n extends s{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=n;class r extends s{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce(((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}function i(e,...t){const s=[e[0]];let n=0;for(;n<t.length;)l(s,t[n]),s.push(e[++n]);return new r(s)}t._Code=r,t.nil=new r(""),t._=i;const o=new r("+");function a(e,...t){const s=[h(e[0])];let n=0;for(;n<t.length;)s.push(o),l(s,t[n]),s.push(o,h(e[++n]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===o){const s=c(e[t-1],e[t+1]);if(void 0!==s){e.splice(t-1,3,s);continue}e[t++]="+"}t++}}(s),new r(s)}function l(e,t){var s;t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push("number"==typeof(s=t)||"boolean"==typeof s||null===s?s:h(Array.isArray(s)?s.join(","):s))}function c(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof n||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof n?void 0:`"${e}${t.slice(1)}`}function h(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=a,t.addCodeArg=l,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},t.stringify=function(e){return new r(h(e))},t.safeStringify=h,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new r(`.${e}`):i`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new r(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new r(e.toString())}},3487:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const n=s(7023),r=s(8490);var i=s(7023);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return i.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return i.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return i.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}});var o=s(8490);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),t.operators={GT:new n._Code(">"),GTE:new n._Code(">="),LT:new n._Code("<"),LTE:new n._Code("<="),EQ:new n._Code("==="),NEQ:new n._Code("!=="),NOT:new n._Code("!"),OR:new n._Code("||"),AND:new n._Code("&&"),ADD:new n._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends a{constructor(e,t,s){super(),this.varKind=e,this.name=t,this.rhs=s}render({es5:e,_n:t}){const s=e?r.varKinds.var:this.varKind,n=void 0===this.rhs?"":` = ${this.rhs}`;return`${s} ${this.name}${n};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=M(this.rhs,e,t)),this}get names(){return this.rhs instanceof n._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(e,t,s){super(),this.lhs=e,this.rhs=t,this.sideEffects=s}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof n.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=M(this.rhs,e,t),this}get names(){return N(this.lhs instanceof n.Name?{}:{...this.lhs.names},this.rhs)}}class h extends c{constructor(e,t,s,n){super(e,s,n),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class u extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class d extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class m extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class p extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=M(this.code,e,t),this}get names(){return this.code instanceof n._CodeOrName?this.code.names:{}}}class f extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce(((t,s)=>t+s.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const s=e[t].optimizeNodes();Array.isArray(s)?e.splice(t,1,...s):s?e[t]=s:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:s}=this;let n=s.length;for(;n--;){const r=s[n];r.optimizeNames(e,t)||(L(e,r.names),s.splice(n,1))}return s.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>x(e,t.names)),{})}}class g extends f{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class y extends f{}class b extends g{}b.kind="else";class w extends g{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new b(e):e}return t?!1===e?t instanceof w?t:t.nodes:this.nodes.length?this:new w(I(e),t instanceof w?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var s;if(this.else=null===(s=this.else)||void 0===s?void 0:s.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=M(this.condition,e,t),this}get names(){const e=super.names;return N(e,this.condition),this.else&&x(e,this.else.names),e}}w.kind="if";class C extends g{}C.kind="for";class v extends C{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=M(this.iteration,e,t),this}get names(){return x(super.names,this.iteration.names)}}class T extends C{constructor(e,t,s,n){super(),this.varKind=e,this.name=t,this.from=s,this.to=n}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:s,from:n,to:i}=this;return`for(${t} ${s}=${n}; ${s}<${i}; ${s}++)`+super.render(e)}get names(){const e=N(super.names,this.from);return N(e,this.to)}}class A extends C{constructor(e,t,s,n){super(),this.loop=e,this.varKind=t,this.name=s,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=M(this.iterable,e,t),this}get names(){return x(super.names,this.iterable.names)}}class S extends g{constructor(e,t,s){super(),this.name=e,this.args=t,this.async=s}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}S.kind="func";class _ extends f{render(e){return"return "+super.render(e)}}_.kind="return";class E extends g{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var s,n;return super.optimizeNames(e,t),null===(s=this.catch)||void 0===s||s.optimizeNames(e,t),null===(n=this.finally)||void 0===n||n.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&x(e,this.catch.names),this.finally&&x(e,this.finally.names),e}}class P extends g{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}P.kind="catch";class $ extends g{render(e){return"finally"+super.render(e)}}function x(e,t){for(const s in t)e[s]=(e[s]||0)+(t[s]||0);return e}function N(e,t){return t instanceof n._CodeOrName?x(e,t.names):e}function M(e,t,s){return e instanceof n.Name?i(e):(r=e)instanceof n._Code&&r._items.some((e=>e instanceof n.Name&&1===t[e.str]&&void 0!==s[e.str]))?new n._Code(e._items.reduce(((e,t)=>(t instanceof n.Name&&(t=i(t)),t instanceof n._Code?e.push(...t._items):e.push(t),e)),[])):e;var r;function i(e){const n=s[e.str];return void 0===n||1!==t[e.str]?e:(delete t[e.str],n)}}function L(e,t){for(const s in t)e[s]=(e[s]||0)-(t[s]||0)}function I(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:n._`!${F(e)}`}$.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new y]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const s=this._extScope.value(e,t);return(this._values[s.prefix]||(this._values[s.prefix]=new Set)).add(s),s}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,s,n){const r=this._scope.toName(t);return void 0!==s&&n&&(this._constants[r.str]=s),this._leafNode(new l(e,r,s)),r}const(e,t,s){return this._def(r.varKinds.const,e,t,s)}let(e,t,s){return this._def(r.varKinds.let,e,t,s)}var(e,t,s){return this._def(r.varKinds.var,e,t,s)}assign(e,t,s){return this._leafNode(new c(e,t,s))}add(e,s){return this._leafNode(new h(e,t.operators.ADD,s))}code(e){return"function"==typeof e?e():e!==n.nil&&this._leafNode(new p(e)),this}object(...e){const t=["{"];for(const[s,r]of e)t.length>1&&t.push(","),t.push(s),(s!==r||this.opts.es5)&&(t.push(":"),(0,n.addCodeArg)(t,r));return t.push("}"),new n._Code(t)}if(e,t,s){if(this._blockNode(new w(e)),t&&s)this.code(t).else().code(s).endIf();else if(t)this.code(t).endIf();else if(s)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new w(e))}else(){return this._elseNode(new b)}endIf(){return this._endBlockNode(w,b)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new v(e),t)}forRange(e,t,s,n,i=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const o=this._scope.toName(e);return this._for(new T(i,o,t,s),(()=>n(o)))}forOf(e,t,s,i=r.varKinds.const){const o=this._scope.toName(e);if(this.opts.es5){const e=t instanceof n.Name?t:this.var("_arr",t);return this.forRange("_i",0,n._`${e}.length`,(t=>{this.var(o,n._`${e}[${t}]`),s(o)}))}return this._for(new A("of",i,o,t),(()=>s(o)))}forIn(e,t,s,i=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,n._`Object.keys(${t})`,s);const o=this._scope.toName(e);return this._for(new A("in",i,o,t),(()=>s(o)))}endFor(){return this._endBlockNode(C)}label(e){return this._leafNode(new u(e))}break(e){return this._leafNode(new d(e))}return(e){const t=new _;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(_)}try(e,t,s){if(!t&&!s)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new E;if(this._blockNode(n),this.code(e),t){const e=this.name("e");this._currNode=n.catch=new P(e),t(e)}return s&&(this._currNode=n.finally=new $,this.code(s)),this._endBlockNode(P,$)}throw(e){return this._leafNode(new m(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const s=this._nodes.length-t;if(s<0||void 0!==e&&s!==e)throw new Error(`CodeGen: wrong number of nodes: ${s} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=n.nil,s,r){return this._blockNode(new S(e,t,s)),r&&this.code(r).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const s=this._currNode;if(s instanceof e||t&&s instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof w))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},t.not=I;const R=k(t.operators.AND);t.and=function(...e){return e.reduce(R)};const O=k(t.operators.OR);function k(e){return(t,s)=>t===n.nil?s:s===n.nil?t:n._`${F(t)} ${e} ${F(s)}`}function F(e){return e instanceof n.Name?e:n._`(${e})`}t.or=function(...e){return e.reduce(O)}},8490:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const n=s(7023);class r extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var i;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(i=t.UsedValueState||(t.UsedValueState={})),t.varKinds={const:new n.Name("const"),let:new n.Name("let"),var:new n.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof n.Name?e:this.name(e)}name(e){return new n.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,s;if((null===(s=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===s?void 0:s.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=o;class a extends n.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:s}){this.value=e,this.scopePath=n._`.${new n.Name(t)}[${s}]`}}t.ValueScopeName=a;const l=n._`\n`;t.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?l:n.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var s;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const n=this.toName(e),{prefix:r}=n,i=null!==(s=t.key)&&void 0!==s?s:t.ref;let o=this._values[r];if(o){const e=o.get(i);if(e)return e}else o=this._values[r]=new Map;o.set(i,n);const a=this._scope[r]||(this._scope[r]=[]),l=a.length;return a[l]=t.ref,n.setValue(t,{property:r,itemIndex:l}),n}getValue(e,t){const s=this._values[e];if(s)return s.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(t=>{if(void 0===t.scopePath)throw new Error(`CodeGen: name "${t}" has no value`);return n._`${e}${t.scopePath}`}))}scopeCode(e=this._values,t,s){return this._reduceValues(e,(e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,s)}_reduceValues(e,s,o={},a){let l=n.nil;for(const c in e){const h=e[c];if(!h)continue;const u=o[c]=o[c]||new Map;h.forEach((e=>{if(u.has(e))return;u.set(e,i.Started);let o=s(e);if(o){const s=this.opts.es5?t.varKinds.var:t.varKinds.const;l=n._`${l}${s} ${e} = ${o};${this.opts._n}`}else{if(!(o=null==a?void 0:a(e)))throw new r(e);l=n._`${l}${o}${this.opts._n}`}u.set(e,i.Completed)}))}return l}}},4181:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const n=s(3487),r=s(6776),i=s(2141);function o(e,t){const s=e.const("err",t);e.if(n._`${i.default.vErrors} === null`,(()=>e.assign(i.default.vErrors,n._`[${s}]`)),n._`${i.default.vErrors}.push(${s})`),e.code(n._`${i.default.errors}++`)}function a(e,t){const{gen:s,validateName:r,schemaEnv:i}=e;i.$async?s.throw(n._`new ${e.ValidationError}(${t})`):(s.assign(n._`${r}.errors`,t),s.return(!1))}t.keywordError={message:({keyword:e})=>n.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?n.str`"${e}" keyword must be ${t} ($data)`:n.str`"${e}" keyword is invalid ($data)`},t.reportError=function(e,s=t.keywordError,r,i){const{it:l}=e,{gen:h,compositeRule:u,allErrors:d}=l,m=c(e,s,r);(null!=i?i:u||d)?o(h,m):a(l,n._`[${m}]`)},t.reportExtraError=function(e,s=t.keywordError,n){const{it:r}=e,{gen:l,compositeRule:h,allErrors:u}=r;o(l,c(e,s,n)),h||u||a(r,i.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(i.default.errors,t),e.if(n._`${i.default.vErrors} !== null`,(()=>e.if(t,(()=>e.assign(n._`${i.default.vErrors}.length`,t)),(()=>e.assign(i.default.vErrors,null)))))},t.extendErrors=function({gen:e,keyword:t,schemaValue:s,data:r,errsCount:o,it:a}){if(void 0===o)throw new Error("ajv implementation error");const l=e.name("err");e.forRange("i",o,i.default.errors,(o=>{e.const(l,n._`${i.default.vErrors}[${o}]`),e.if(n._`${l}.instancePath === undefined`,(()=>e.assign(n._`${l}.instancePath`,(0,n.strConcat)(i.default.instancePath,a.errorPath)))),e.assign(n._`${l}.schemaPath`,n.str`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign(n._`${l}.schema`,s),e.assign(n._`${l}.data`,r))}))};const l={keyword:new n.Name("keyword"),schemaPath:new n.Name("schemaPath"),params:new n.Name("params"),propertyName:new n.Name("propertyName"),message:new n.Name("message"),schema:new n.Name("schema"),parentSchema:new n.Name("parentSchema")};function c(e,t,s){const{createErrors:r}=e.it;return!1===r?n._`{}`:function(e,t,s={}){const{gen:r,it:o}=e,a=[h(o,s),u(e,s)];return function(e,{params:t,message:s},r){const{keyword:o,data:a,schemaValue:c,it:h}=e,{opts:u,propertyName:d,topSchemaRef:m,schemaPath:p}=h;r.push([l.keyword,o],[l.params,"function"==typeof t?t(e):t||n._`{}`]),u.messages&&r.push([l.message,"function"==typeof s?s(e):s]),u.verbose&&r.push([l.schema,c],[l.parentSchema,n._`${m}${p}`],[i.default.data,a]),d&&r.push([l.propertyName,d])}(e,t,a),r.object(...a)}(e,t,s)}function h({errorPath:e},{instancePath:t}){const s=t?n.str`${e}${(0,r.getErrorPath)(t,r.Type.Str)}`:e;return[i.default.instancePath,(0,n.strConcat)(i.default.instancePath,s)]}function u({keyword:e,it:{errSchemaPath:t}},{schemaPath:s,parentSchema:i}){let o=i?t:n.str`${t}/${e}`;return s&&(o=n.str`${o}${(0,r.getErrorPath)(s,r.Type.Str)}`),[l.schemaPath,o]}},5173:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const n=s(3487),r=s(7426),i=s(2141),o=s(2531),a=s(6776),l=s(4815);class c{constructor(e){var t;let s;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(s=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,o.normalizeId)(null==s?void 0:s[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==s?void 0:s.$async,this.refs={}}}function h(e){const t=d.call(this,e);if(t)return t;const s=(0,o.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:a,lines:c}=this.opts.code,{ownProperties:h}=this.opts,u=new n.CodeGen(this.scope,{es5:a,lines:c,ownProperties:h});let m;e.$async&&(m=u.scopeValue("Error",{ref:r.default,code:n._`require("ajv/dist/runtime/validation_error").default`}));const p=u.scopeName("validate");e.validateName=p;const f={gen:u,allErrors:this.opts.allErrors,data:i.default.data,parentData:i.default.parentData,parentDataProperty:i.default.parentDataProperty,dataNames:[i.default.data],dataPathArr:[n.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:u.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,n.stringify)(e.schema)}:{ref:e.schema}),validateName:p,ValidationError:m,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:n.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:n._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(e),(0,l.validateFunctionCode)(f),u.optimize(this.opts.code.optimize);const t=u.toString();g=`${u.scopeRefs(i.default.scope)}return ${t}`,this.opts.code.process&&(g=this.opts.code.process(g,e));const s=new Function(`${i.default.self}`,`${i.default.scope}`,g)(this,this.scope.get());if(this.scope.value(p,{ref:s}),s.errors=null,s.schema=e.schema,s.schemaEnv=e,e.$async&&(s.$async=!0),!0===this.opts.code.source&&(s.source={validateName:p,validateCode:t,scopeValues:u._values}),this.opts.unevaluated){const{props:e,items:t}=f;s.evaluated={props:e instanceof n.Name?void 0:e,items:t instanceof n.Name?void 0:t,dynamicProps:e instanceof n.Name,dynamicItems:t instanceof n.Name},s.source&&(s.source.evaluated=(0,n.stringify)(s.evaluated))}return e.validate=s,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error("Error compiling schema, function code:",g),t}finally{this._compilations.delete(e)}}function u(e){return(0,o.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:h.call(this,e)}function d(e){for(const n of this._compilations)if(s=e,(t=n).schema===s.schema&&t.root===s.root&&t.baseId===s.baseId)return n;var t,s}function m(e,t){let s;for(;"string"==typeof(s=this.refs[t]);)t=s;return s||this.schemas[t]||p.call(this,e,t)}function p(e,t){const s=this.opts.uriResolver.parse(t),n=(0,o._getFullPath)(this.opts.uriResolver,s);let r=(0,o.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===r)return g.call(this,s,e);const i=(0,o.normalizeId)(n),a=this.refs[i]||this.schemas[i];if("string"==typeof a){const t=p.call(this,e,a);if("object"!=typeof(null==t?void 0:t.schema))return;return g.call(this,s,t)}if("object"==typeof(null==a?void 0:a.schema)){if(a.validate||h.call(this,a),i===(0,o.normalizeId)(t)){const{schema:t}=a,{schemaId:s}=this.opts,n=t[s];return n&&(r=(0,o.resolveUrl)(this.opts.uriResolver,r,n)),new c({schema:t,schemaId:s,root:e,baseId:r})}return g.call(this,s,a)}}t.SchemaEnv=c,t.compileSchema=h,t.resolveRef=function(e,t,s){var n;s=(0,o.resolveUrl)(this.opts.uriResolver,t,s);const r=e.refs[s];if(r)return r;let i=m.call(this,e,s);if(void 0===i){const r=null===(n=e.localRefs)||void 0===n?void 0:n[s],{schemaId:o}=this.opts;r&&(i=new c({schema:r,schemaId:o,root:e,baseId:t}))}return void 0!==i?e.refs[s]=u.call(this,i):void 0},t.getCompilingSchema=d,t.resolveSchema=p;const f=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function g(e,{baseId:t,schema:s,root:n}){var r;if("/"!==(null===(r=e.fragment)||void 0===r?void 0:r[0]))return;for(const n of e.fragment.slice(1).split("/")){if("boolean"==typeof s)return;const e=s[(0,a.unescapeFragment)(n)];if(void 0===e)return;const r="object"==typeof(s=e)&&s[this.opts.schemaId];!f.has(n)&&r&&(t=(0,o.resolveUrl)(this.opts.uriResolver,t,r))}let i;if("boolean"!=typeof s&&s.$ref&&!(0,a.schemaHasRulesButRef)(s,this.RULES)){const e=(0,o.resolveUrl)(this.opts.uriResolver,t,s.$ref);i=p.call(this,n,e)}const{schemaId:l}=this.opts;return i=i||new c({schema:s,schemaId:l,root:n,baseId:t}),i.schema!==i.root.schema?i:void 0}},2141:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r={data:new n.Name("data"),valCxt:new n.Name("valCxt"),instancePath:new n.Name("instancePath"),parentData:new n.Name("parentData"),parentDataProperty:new n.Name("parentDataProperty"),rootData:new n.Name("rootData"),dynamicAnchors:new n.Name("dynamicAnchors"),vErrors:new n.Name("vErrors"),errors:new n.Name("errors"),this:new n.Name("this"),self:new n.Name("self"),scope:new n.Name("scope"),json:new n.Name("json"),jsonPos:new n.Name("jsonPos"),jsonLen:new n.Name("jsonLen"),jsonPart:new n.Name("jsonPart")};t.default=r},6646:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(2531);class r extends Error{constructor(e,t,s,r){super(r||`can't resolve reference ${s} from id ${t}`),this.missingRef=(0,n.resolveUrl)(e,t,s),this.missingSchema=(0,n.normalizeId)((0,n.getFullPath)(e,this.missingRef))}}t.default=r},2531:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;const n=s(6776),r=s(4063),i=s(9461),o=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!l(e):!!t&&c(e)<=t)};const a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l(e){for(const t in e){if(a.has(t))return!0;const s=e[t];if(Array.isArray(s)&&s.some(l))return!0;if("object"==typeof s&&l(s))return!0}return!1}function c(e){let t=0;for(const s in e){if("$ref"===s)return 1/0;if(t++,!o.has(s)&&("object"==typeof e[s]&&(0,n.eachItem)(e[s],(e=>t+=c(e))),t===1/0))return 1/0}return t}function h(e,t="",s){!1!==s&&(t=m(t));const n=e.parse(t);return u(e,n)}function u(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=h,t._getFullPath=u;const d=/#\/?$/;function m(e){return e?e.replace(d,""):""}t.normalizeId=m,t.resolveUrl=function(e,t,s){return s=m(s),e.resolve(t,s)};const p=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:s,uriResolver:n}=this.opts,o=m(e[s]||t),a={"":o},l=h(n,o,!1),c={},u=new Set;return i(e,{allKeys:!0},((e,t,n,r)=>{if(void 0===r)return;const i=l+t;let o=a[r];function h(t){const s=this.opts.uriResolver.resolve;if(t=m(o?s(o,t):t),u.has(t))throw f(t);u.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?d(e,n.schema,t):t!==m(i)&&("#"===t[0]?(d(e,c[t],t),c[t]=e):this.refs[t]=i),t}function g(e){if("string"==typeof e){if(!p.test(e))throw new Error(`invalid anchor "${e}"`);h.call(this,`#${e}`)}}"string"==typeof e[s]&&(o=h.call(this,e[s])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),a[t]=o})),c;function d(e,t,s){if(void 0!==t&&!r(e,t))throw f(s)}function f(e){return new Error(`reference "${e}" resolves to more than one schema`)}}},3141:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;const s=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&s.has(e)},t.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},6776:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;const n=s(3487),r=s(7023);function i(e,t=e.schema){const{opts:s,self:n}=e;if(!s.strictSchema)return;if("boolean"==typeof t)return;const r=n.RULES.keywords;for(const s in t)r[s]||p(e,`unknown keyword: "${s}"`)}function o(e,t){if("boolean"==typeof e)return!e;for(const s in e)if(t[s])return!0;return!1}function a(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function l(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function c({mergeNames:e,mergeToName:t,mergeValues:s,resultToName:r}){return(i,o,a,l)=>{const c=void 0===a?o:a instanceof n.Name?(o instanceof n.Name?e(i,o,a):t(i,o,a),a):o instanceof n.Name?(t(i,a,o),o):s(o,a);return l!==n.Name||c instanceof n.Name?c:r(i,c)}}function h(e,t){if(!0===t)return e.var("props",!0);const s=e.var("props",n._`{}`);return void 0!==t&&u(e,s,t),s}function u(e,t,s){Object.keys(s).forEach((s=>e.assign(n._`${t}${(0,n.getProperty)(s)}`,!0)))}t.toHash=function(e){const t={};for(const s of e)t[s]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(i(e,t),!o(t,e.self.RULES.all))},t.checkUnknownRules=i,t.schemaHasRules=o,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const s in e)if("$ref"!==s&&t.all[s])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},s,r,i){if(!i){if("number"==typeof s||"boolean"==typeof s)return s;if("string"==typeof s)return n._`${s}`}return n._`${e}${t}${(0,n.getProperty)(r)}`},t.unescapeFragment=function(e){return l(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(a(e))},t.escapeJsonPointer=a,t.unescapeJsonPointer=l,t.eachItem=function(e,t){if(Array.isArray(e))for(const s of e)t(s);else t(e)},t.mergeEvaluated={props:c({mergeNames:(e,t,s)=>e.if(n._`${s} !== true && ${t} !== undefined`,(()=>{e.if(n._`${t} === true`,(()=>e.assign(s,!0)),(()=>e.assign(s,n._`${s} || {}`).code(n._`Object.assign(${s}, ${t})`)))})),mergeToName:(e,t,s)=>e.if(n._`${s} !== true`,(()=>{!0===t?e.assign(s,!0):(e.assign(s,n._`${s} || {}`),u(e,s,t))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:h}),items:c({mergeNames:(e,t,s)=>e.if(n._`${s} !== true && ${t} !== undefined`,(()=>e.assign(s,n._`${t} === true ? true : ${s} > ${t} ? ${s} : ${t}`))),mergeToName:(e,t,s)=>e.if(n._`${s} !== true`,(()=>e.assign(s,!0===t||n._`${s} > ${t} ? ${s} : ${t}`))),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=h,t.setEvaluated=u;const d={};var m;function p(e,t,s=e.opts.strictSchema){if(s){if(t=`strict mode: ${t}`,!0===s)throw new Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:d[t.code]||(d[t.code]=new r._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(m=t.Type||(t.Type={})),t.getErrorPath=function(e,t,s){if(e instanceof n.Name){const r=t===m.Num;return s?r?n._`"[" + ${e} + "]"`:n._`"['" + ${e} + "']"`:r?n._`"/" + ${e}`:n._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return s?(0,n.getProperty)(e).toString():"/"+a(e)},t.checkStrictMode=p},8876:(e,t)=>{"use strict";function s(e,t){return t.rules.some((t=>n(e,t)))}function n(e,t){var s;return void 0!==e[t.keyword]||(null===(s=t.definition.implements)||void 0===s?void 0:s.some((t=>void 0!==e[t])))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},n){const r=t.RULES.types[n];return r&&!0!==r&&s(e,r)},t.shouldUseGroup=s,t.shouldUseRule=n},5667:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const n=s(4181),r=s(3487),i=s(2141),o={message:"boolean schema is false"};function a(e,t){const{gen:s,data:r}=e,i={gen:s,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,n.reportError)(i,o,void 0,t)}t.topBoolOrEmptySchema=function(e){const{gen:t,schema:s,validateName:n}=e;!1===s?a(e,!1):"object"==typeof s&&!0===s.$async?t.return(i.default.data):(t.assign(r._`${n}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){const{gen:s,schema:n}=e;!1===n?(s.var(t,!1),a(e)):s.var(t,!0)}},453:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;const n=s(3141),r=s(8876),i=s(4181),o=s(3487),a=s(6776);var l;function c(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(n.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(l=t.DataType||(t.DataType={})),t.getSchemaTypes=function(e){const t=c(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=c,t.coerceAndCheckDataType=function(e,t){const{gen:s,data:n,opts:i}=e,a=function(e,t){return t?e.filter((e=>h.has(e)||"array"===t&&"array"===e)):[]}(t,i.coerceTypes),c=t.length>0&&!(0===a.length&&1===t.length&&(0,r.schemaHasRulesForType)(e,t[0]));if(c){const r=d(t,n,i.strictNumbers,l.Wrong);s.if(r,(()=>{a.length?function(e,t,s){const{gen:n,data:r,opts:i}=e,a=n.let("dataType",o._`typeof ${r}`),l=n.let("coerced",o._`undefined`);"array"===i.coerceTypes&&n.if(o._`${a} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,(()=>n.assign(r,o._`${r}[0]`).assign(a,o._`typeof ${r}`).if(d(t,r,i.strictNumbers),(()=>n.assign(l,r))))),n.if(o._`${l} !== undefined`);for(const e of s)(h.has(e)||"array"===e&&"array"===i.coerceTypes)&&c(e);function c(e){switch(e){case"string":return void n.elseIf(o._`${a} == "number" || ${a} == "boolean"`).assign(l,o._`"" + ${r}`).elseIf(o._`${r} === null`).assign(l,o._`""`);case"number":return void n.elseIf(o._`${a} == "boolean" || ${r} === null
|
|
3
3
|
|| (${a} == "string" && ${r} && ${r} == +${r})`).assign(l,o._`+${r}`);case"integer":return void n.elseIf(o._`${a} === "boolean" || ${r} === null
|
|
4
4
|
|| (${a} === "string" && ${r} && ${r} == +${r} && !(${r} % 1))`).assign(l,o._`+${r}`);case"boolean":return void n.elseIf(o._`${r} === "false" || ${r} === 0 || ${r} === null`).assign(l,!1).elseIf(o._`${r} === "true" || ${r} === 1`).assign(l,!0);case"null":return n.elseIf(o._`${r} === "" || ${r} === 0 || ${r} === false`),void n.assign(l,null);case"array":n.elseIf(o._`${a} === "string" || ${a} === "number"
|
|
5
|
-
|| ${a} === "boolean" || ${r} === null`).assign(l,o._`[${r}]`)}}n.else(),p(e),n.endIf(),n.if(o._`${l} !== undefined`,(()=>{n.assign(r,l),function({gen:e,parentData:t,parentDataProperty:s},n){e.if(o._`${t} !== undefined`,(()=>e.assign(o._`${t}[${s}]`,n)))}(e,l)}))}(e,t,a):p(e)}))}return c};const h=new Set(["string","number","integer","boolean","null"]);function u(e,t,s,n=l.Correct){const r=n===l.Correct?o.operators.EQ:o.operators.NEQ;let i;switch(e){case"null":return o._`${t} ${r} null`;case"array":i=o._`Array.isArray(${t})`;break;case"object":i=o._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=a(o._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=a();break;default:return o._`typeof ${t} ${r} ${e}`}return n===l.Correct?i:(0,o.not)(i);function a(e=o.nil){return(0,o.and)(o._`typeof ${t} == "number"`,e,s?o._`isFinite(${t})`:o.nil)}}function d(e,t,s,n){if(1===e.length)return u(e[0],t,s,n);let r;const i=(0,a.toHash)(e);if(i.array&&i.object){const e=o._`typeof ${t} != "object"`;r=i.null?e:o._`!${t} || ${e}`,delete i.null,delete i.array,delete i.object}else r=o.nil;i.number&&delete i.integer;for(const e in i)r=(0,o.and)(r,u(e,t,s,n));return r}t.checkDataType=u,t.checkDataTypes=d;const m={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?o._`{type: ${e}}`:o._`{type: ${t}}`};function p(e){const t=function(e){const{gen:t,data:s,schema:n}=e,r=(0,a.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:s,schema:n.type,schemaCode:r,schemaValue:r,parentSchema:n,params:{},it:e}}(e);(0,i.reportError)(t,m)}t.reportTypeError=p},313:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;const n=s(3487),r=s(6776);function i(e,t,s){const{gen:i,compositeRule:o,data:a,opts:l}=e;if(void 0===s)return;const c=n._`${a}${(0,n.getProperty)(t)}`;if(o)return void(0,r.checkStrictMode)(e,`default is ignored for: ${c}`);let h=n._`${c} === undefined`;"empty"===l.useDefaults&&(h=n._`${h} || ${c} === null || ${c} === ""`),i.if(h,n._`${c} = ${(0,n.stringify)(s)}`)}t.assignDefaults=function(e,t){const{properties:s,items:n}=e.schema;if("object"===t&&s)for(const t in s)i(e,t,s[t].default);else"array"===t&&Array.isArray(n)&&n.forEach(((t,s)=>i(e,s,t.default)))}},4815:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const n=s(5667),r=s(453),i=s(8876),o=s(453),a=s(313),l=s(5005),c=s(3099),h=s(3487),u=s(2141),d=s(2531),m=s(6776),p=s(4181);function f({gen:e,validateName:t,schema:s,schemaEnv:n,opts:r},i){r.code.es5?e.func(t,h._`${u.default.data}, ${u.default.valCxt}`,n.$async,(()=>{e.code(h._`"use strict"; ${g(s,r)}`),function(e,t){e.if(u.default.valCxt,(()=>{e.var(u.default.instancePath,h._`${u.default.valCxt}.${u.default.instancePath}`),e.var(u.default.parentData,h._`${u.default.valCxt}.${u.default.parentData}`),e.var(u.default.parentDataProperty,h._`${u.default.valCxt}.${u.default.parentDataProperty}`),e.var(u.default.rootData,h._`${u.default.valCxt}.${u.default.rootData}`),t.dynamicRef&&e.var(u.default.dynamicAnchors,h._`${u.default.valCxt}.${u.default.dynamicAnchors}`)}),(()=>{e.var(u.default.instancePath,h._`""`),e.var(u.default.parentData,h._`undefined`),e.var(u.default.parentDataProperty,h._`undefined`),e.var(u.default.rootData,u.default.data),t.dynamicRef&&e.var(u.default.dynamicAnchors,h._`{}`)}))}(e,r),e.code(i)})):e.func(t,h._`${u.default.data}, ${function(e){return h._`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${e.dynamicRef?h._`, ${u.default.dynamicAnchors}={}`:h.nil}}={}`}(r)}`,n.$async,(()=>e.code(g(s,r)).code(i)))}function g(e,t){const s="object"==typeof e&&e[t.schemaId];return s&&(t.code.source||t.code.process)?h._`/*# sourceURL=${s} */`:h.nil}function y({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const s in e)if(t.RULES.all[s])return!0;return!1}function w(e){return"boolean"!=typeof e.schema}function b(e){(0,m.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:s,opts:n,self:r}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,m.schemaHasRulesButRef)(t,r.RULES)&&r.logger.warn(`$ref: keywords ignored in schema at path "${s}"`)}(e)}function C(e,t){if(e.opts.jtd)return T(e,[],!1,t);const s=(0,r.getSchemaTypes)(e.schema);T(e,s,!(0,r.coerceAndCheckDataType)(e,s),t)}function v({gen:e,schemaEnv:t,schema:s,errSchemaPath:n,opts:r}){const i=s.$comment;if(!0===r.$comment)e.code(h._`${u.default.self}.logger.log(${i})`);else if("function"==typeof r.$comment){const s=h.str`${n}/$comment`,r=e.scopeValue("root",{ref:t.root});e.code(h._`${u.default.self}.opts.$comment(${i}, ${s}, ${r}.schema)`)}}function T(e,t,s,n){const{gen:r,schema:a,data:l,allErrors:c,opts:d,self:p}=e,{RULES:f}=p;function g(m){(0,i.shouldUseGroup)(a,m)&&(m.type?(r.if((0,o.checkDataType)(m.type,l,d.strictNumbers)),A(e,m),1===t.length&&t[0]===m.type&&s&&(r.else(),(0,o.reportTypeError)(e)),r.endIf()):A(e,m),c||r.if(h._`${u.default.errors} === ${n||0}`))}!a.$ref||!d.ignoreKeywordsWithRef&&(0,m.schemaHasRulesButRef)(a,f)?(d.jtd||function(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(function(e,t){t.length&&(e.dataTypes.length?(t.forEach((t=>{S(e.dataTypes,t)||_(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),function(e,t){const s=[];for(const n of e.dataTypes)S(t,n)?s.push(n):t.includes("integer")&&"number"===n&&s.push("integer");e.dataTypes=s}(e,t)):e.dataTypes=t)}(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&_(e,"use allowUnionTypes to allow union type keyword")}(e,t),function(e,t){const s=e.self.RULES.all;for(const n in s){const r=s[n];if("object"==typeof r&&(0,i.shouldUseRule)(e.schema,r)){const{type:s}=r.definition;s.length&&!s.some((e=>{return n=e,(s=t).includes(n)||"number"===n&&s.includes("integer");var s,n}))&&_(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}(e,e.dataTypes))}(e,t),r.block((()=>{for(const e of f.rules)g(e);g(f.post)}))):r.block((()=>P(e,"$ref",f.all.$ref.definition)))}function A(e,t){const{gen:s,schema:n,opts:{useDefaults:r}}=e;r&&(0,a.assignDefaults)(e,t.type),s.block((()=>{for(const s of t.rules)(0,i.shouldUseRule)(n,s)&&P(e,s.keyword,s.definition,t.type)}))}function S(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function _(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,m.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){w(e)&&(b(e),y(e))?function(e){const{schema:t,opts:s,gen:n}=e;f(e,(()=>{s.$comment&&t.$comment&&v(e),function(e){const{schema:t,opts:s}=e;void 0!==t.default&&s.useDefaults&&s.strictSchema&&(0,m.checkStrictMode)(e,"default is ignored in the schema root")}(e),n.let(u.default.vErrors,null),n.let(u.default.errors,0),s.unevaluated&&function(e){const{gen:t,validateName:s}=e;e.evaluated=t.const("evaluated",h._`${s}.evaluated`),t.if(h._`${e.evaluated}.dynamicProps`,(()=>t.assign(h._`${e.evaluated}.props`,h._`undefined`))),t.if(h._`${e.evaluated}.dynamicItems`,(()=>t.assign(h._`${e.evaluated}.items`,h._`undefined`)))}(e),C(e),function(e){const{gen:t,schemaEnv:s,validateName:n,ValidationError:r,opts:i}=e;s.$async?t.if(h._`${u.default.errors} === 0`,(()=>t.return(u.default.data)),(()=>t.throw(h._`new ${r}(${u.default.vErrors})`))):(t.assign(h._`${n}.errors`,u.default.vErrors),i.unevaluated&&function({gen:e,evaluated:t,props:s,items:n}){s instanceof h.Name&&e.assign(h._`${t}.props`,s),n instanceof h.Name&&e.assign(h._`${t}.items`,n)}(e),t.return(h._`${u.default.errors} === 0`))}(e)}))}(e):f(e,(()=>(0,n.topBoolOrEmptySchema)(e)))};class E{constructor(e,t,s){if((0,l.validateKeywordUsage)(e,t,s),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=s,this.data=e.data,this.schema=e.schema[s],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,m.schemaRefOrVal)(e,this.schema,s,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",N(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,l.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${s} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",u.default.errors))}result(e,t,s){this.failResult((0,h.not)(e),t,s)}failResult(e,t,s){this.gen.if(e),s?s():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,h.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(h._`${t} !== undefined && (${(0,h.or)(this.invalid$data(),e)})`)}error(e,t,s){if(t)return this.setParams(t),this._error(e,s),void this.setParams({});this._error(e,s)}_error(e,t){(e?p.reportExtraError:p.reportError)(this,this.def.error,t)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,s=h.nil){this.gen.block((()=>{this.check$data(e,s),t()}))}check$data(e=h.nil,t=h.nil){if(!this.$data)return;const{gen:s,schemaCode:n,schemaType:r,def:i}=this;s.if((0,h.or)(h._`${n} === undefined`,t)),e!==h.nil&&s.assign(e,!0),(r.length||i.validateSchema)&&(s.elseIf(this.invalid$data()),this.$dataError(),e!==h.nil&&s.assign(e,!1)),s.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:s,def:n,it:r}=this;return(0,h.or)(function(){if(s.length){if(!(t instanceof h.Name))throw new Error("ajv implementation error");const e=Array.isArray(s)?s:[s];return h._`${(0,o.checkDataTypes)(e,t,r.opts.strictNumbers,o.DataType.Wrong)}`}return h.nil}(),function(){if(n.validateSchema){const s=e.scopeValue("validate$data",{ref:n.validateSchema});return h._`!${s}(${t})`}return h.nil}())}subschema(e,t){const s=(0,c.getSubschema)(this.it,e);(0,c.extendSubschemaData)(s,this.it,e),(0,c.extendSubschemaMode)(s,e);const r={...this.it,...s,items:void 0,props:void 0};return function(e,t){w(e)&&(b(e),y(e))?function(e,t){const{schema:s,gen:n,opts:r}=e;r.$comment&&s.$comment&&v(e),function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,d.resolveUrl)(e.opts.uriResolver,e.baseId,t))}(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const i=n.const("_errs",u.default.errors);C(e,i),n.var(t,h._`${i} === ${u.default.errors}`)}(e,t):(0,n.boolOrEmptySchema)(e,t)}(r,t),r}mergeEvaluated(e,t){const{it:s,gen:n}=this;s.opts.unevaluated&&(!0!==s.props&&void 0!==e.props&&(s.props=m.mergeEvaluated.props(n,e.props,s.props,t)),!0!==s.items&&void 0!==e.items&&(s.items=m.mergeEvaluated.items(n,e.items,s.items,t)))}mergeValidEvaluated(e,t){const{it:s,gen:n}=this;if(s.opts.unevaluated&&(!0!==s.props||!0!==s.items))return n.if(t,(()=>this.mergeEvaluated(e,h.Name))),!0}}function P(e,t,s,n){const r=new E(e,s,t);"code"in s?s.code(r,n):r.$data&&s.validate?(0,l.funcKeywordCode)(r,s):"macro"in s?(0,l.macroKeywordCode)(r,s):(s.compile||s.validate)&&(0,l.funcKeywordCode)(r,s)}t.KeywordCxt=E;const $=/^\/(?:[^~]|~0|~1)*$/,x=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function N(e,{dataLevel:t,dataNames:s,dataPathArr:n}){let r,i;if(""===e)return u.default.rootData;if("/"===e[0]){if(!$.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);r=e,i=u.default.rootData}else{const o=x.exec(e);if(!o)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+o[1];if(r=o[2],"#"===r){if(a>=t)throw new Error(l("property/index",a));return n[t-a]}if(a>t)throw new Error(l("data",a));if(i=s[t-a],!r)return i}let o=i;const a=r.split("/");for(const e of a)e&&(i=h._`${i}${(0,h.getProperty)((0,m.unescapeJsonPointer)(e))}`,o=h._`${o} && ${i}`);return o;function l(e,s){return`Cannot access ${e} ${s} levels up, current level is ${t}`}}t.getData=N},5005:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const n=s(3487),r=s(2141),i=s(412),o=s(4181);function a(e){const{gen:t,data:s,it:r}=e;t.if(r.parentData,(()=>t.assign(s,n._`${r.parentData}[${r.parentDataProperty}]`)))}function l(e,t,s){if(void 0===s)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof s?{ref:s}:{ref:s,code:(0,n.stringify)(s)})}t.macroKeywordCode=function(e,t){const{gen:s,keyword:r,schema:i,parentSchema:o,it:a}=e,c=t.macro.call(a.self,i,o,a),h=l(s,r,c);!1!==a.opts.validateSchema&&a.self.validateSchema(c,!0);const u=s.name("valid");e.subschema({schema:c,schemaPath:n.nil,errSchemaPath:`${a.errSchemaPath}/${r}`,topSchemaRef:h,compositeRule:!0},u),e.pass(u,(()=>e.error(!0)))},t.funcKeywordCode=function(e,t){var s;const{gen:c,keyword:h,schema:u,parentSchema:d,$data:m,it:p}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(p,t);const f=!m&&t.compile?t.compile.call(p.self,u,d,p):t.validate,g=l(c,h,f),y=c.let("valid");function w(s=(t.async?n._`await `:n.nil)){const o=p.opts.passContext?r.default.this:r.default.self,a=!("compile"in t&&!m||!1===t.schema);c.assign(y,n._`${s}${(0,i.callValidateCode)(e,g,o,a)}`,t.modifying)}function b(e){var s;c.if((0,n.not)(null!==(s=t.valid)&&void 0!==s?s:y),e)}e.block$data(y,(function(){if(!1===t.errors)w(),t.modifying&&a(e),b((()=>e.error()));else{const s=t.async?function(){const e=c.let("ruleErrs",null);return c.try((()=>w(n._`await `)),(t=>c.assign(y,!1).if(n._`${t} instanceof ${p.ValidationError}`,(()=>c.assign(e,n._`${t}.errors`)),(()=>c.throw(t))))),e}():function(){const e=n._`${g}.errors`;return c.assign(e,null),w(n.nil),e}();t.modifying&&a(e),b((()=>function(e,t){const{gen:s}=e;s.if(n._`Array.isArray(${t})`,(()=>{s.assign(r.default.vErrors,n._`${r.default.vErrors} === null ? ${t} : ${r.default.vErrors}.concat(${t})`).assign(r.default.errors,n._`${r.default.vErrors}.length`),(0,o.extendErrors)(e)}),(()=>e.error()))}(e,s)))}})),e.ok(null!==(s=t.valid)&&void 0!==s?s:y)},t.validSchemaType=function(e,t,s=!1){return!t.length||t.some((t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||s&&void 0===e))},t.validateKeywordUsage=function({schema:e,opts:t,self:s,errSchemaPath:n},r,i){if(Array.isArray(r.keyword)?!r.keyword.includes(i):r.keyword!==i)throw new Error("ajv implementation error");const o=r.dependencies;if(null==o?void 0:o.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(r.validateSchema&&!r.validateSchema(e[i])){const e=`keyword "${i}" value is invalid at path "${n}": `+s.errorsText(r.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);s.logger.error(e)}}},3099:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;const n=s(3487),r=s(6776);t.getSubschema=function(e,{keyword:t,schemaProp:s,schema:i,schemaPath:o,errSchemaPath:a,topSchemaRef:l}){if(void 0!==t&&void 0!==i)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const i=e.schema[t];return void 0===s?{schema:i,schemaPath:n._`${e.schemaPath}${(0,n.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:i[s],schemaPath:n._`${e.schemaPath}${(0,n.getProperty)(t)}${(0,n.getProperty)(s)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,r.escapeFragment)(s)}`}}if(void 0!==i){if(void 0===o||void 0===a||void 0===l)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:o,topSchemaRef:l,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:s,dataPropType:i,data:o,dataTypes:a,propertyName:l}){if(void 0!==o&&void 0!==s)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:c}=t;if(void 0!==s){const{errorPath:o,dataPathArr:a,opts:l}=t;h(c.let("data",n._`${t.data}${(0,n.getProperty)(s)}`,!0)),e.errorPath=n.str`${o}${(0,r.getErrorPath)(s,i,l.jsPropertySyntax)}`,e.parentDataProperty=n._`${s}`,e.dataPathArr=[...a,e.parentDataProperty]}function h(s){e.data=s,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,s]}void 0!==o&&(h(o instanceof n.Name?o:c.let("data",o,!0)),void 0!==l&&(e.propertyName=l)),a&&(e.dataTypes=a)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:s,compositeRule:n,createErrors:r,allErrors:i}){void 0!==n&&(e.compositeRule=n),void 0!==r&&(e.createErrors=r),void 0!==i&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=s}},7159:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var n=s(4815);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return n.KeywordCxt}});var r=s(3487);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const i=s(7426),o=s(6646),a=s(3141),l=s(5173),c=s(3487),h=s(2531),u=s(453),d=s(6776),m=s(4775),p=s(3589),f=(e,t)=>new RegExp(e,t);f.code="new RegExp";const g=["removeAdditional","useDefaults","coerceTypes"],y=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),w={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},b={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},C=200;function v(e){var t,s,n,r,i,o,a,l,c,h,u,d,m,g,y,w,b,v,T,A,S,_,E,P,$;const x=e.strict,N=null===(t=e.code)||void 0===t?void 0:t.optimize,M=!0===N||void 0===N?1:N||0,L=null!==(n=null===(s=e.code)||void 0===s?void 0:s.regExp)&&void 0!==n?n:f,I=null!==(r=e.uriResolver)&&void 0!==r?r:p.default;return{strictSchema:null===(o=null!==(i=e.strictSchema)&&void 0!==i?i:x)||void 0===o||o,strictNumbers:null===(l=null!==(a=e.strictNumbers)&&void 0!==a?a:x)||void 0===l||l,strictTypes:null!==(h=null!==(c=e.strictTypes)&&void 0!==c?c:x)&&void 0!==h?h:"log",strictTuples:null!==(d=null!==(u=e.strictTuples)&&void 0!==u?u:x)&&void 0!==d?d:"log",strictRequired:null!==(g=null!==(m=e.strictRequired)&&void 0!==m?m:x)&&void 0!==g&&g,code:e.code?{...e.code,optimize:M,regExp:L}:{optimize:M,regExp:L},loopRequired:null!==(y=e.loopRequired)&&void 0!==y?y:C,loopEnum:null!==(w=e.loopEnum)&&void 0!==w?w:C,meta:null===(b=e.meta)||void 0===b||b,messages:null===(v=e.messages)||void 0===v||v,inlineRefs:null===(T=e.inlineRefs)||void 0===T||T,schemaId:null!==(A=e.schemaId)&&void 0!==A?A:"$id",addUsedSchema:null===(S=e.addUsedSchema)||void 0===S||S,validateSchema:null===(_=e.validateSchema)||void 0===_||_,validateFormats:null===(E=e.validateFormats)||void 0===E||E,unicodeRegExp:null===(P=e.unicodeRegExp)||void 0===P||P,int32range:null===($=e.int32range)||void 0===$||$,uriResolver:I}}class T{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...v(e)};const{es5:t,lines:s}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:y,es5:t,lines:s}),this.logger=function(e){if(!1===e)return x;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),A.call(this,w,e,"NOT SUPPORTED"),A.call(this,b,e,"DEPRECATED","warn"),this._metaOpts=$.call(this),e.formats&&E.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&P.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),_.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:s}=this.opts;let n=m;"id"===s&&(n={...m},n.id=n.$id,delete n.$id),t&&e&&this.addMetaSchema(n,n[s],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let s;if("string"==typeof e){if(s=this.getSchema(e),!s)throw new Error(`no schema with key or ref "${e}"`)}else s=this.compile(e);const n=s(t);return"$async"in s||(this.errors=s.errors),n}compile(e,t){const s=this._addSchema(e,t);return s.validate||this._compileSchemaEnv(s)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:s}=this.opts;return n.call(this,e,t);async function n(e,t){await r.call(this,e.$schema);const s=this._addSchema(e,t);return s.validate||i.call(this,s)}async function r(e){e&&!this.getSchema(e)&&await n.call(this,{$ref:e},!0)}async function i(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return a.call(this,t),await l.call(this,t.missingSchema),i.call(this,e)}}function a({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){const s=await c.call(this,e);this.refs[e]||await r.call(this,s.$schema),this.refs[e]||this.addSchema(s,e,t)}async function c(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=s(e))}finally{delete this._loading[e]}}}addSchema(e,t,s,n=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,s,n);return this}let r;if("object"==typeof e){const{schemaId:t}=this.opts;if(r=e[t],void 0!==r&&"string"!=typeof r)throw new Error(`schema ${t} must be string`)}return t=(0,h.normalizeId)(t||r),this._checkUnique(t),this.schemas[t]=this._addSchema(e,s,t,n,!0),this}addMetaSchema(e,t,s=this.opts.validateSchema){return this.addSchema(e,t,!0,s),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let s;if(s=e.$schema,void 0!==s&&"string"!=typeof s)throw new Error("$schema must be a string");if(s=s||this.opts.defaultMeta||this.defaultMeta(),!s)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const n=this.validate(s,e);if(!n&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return n}getSchema(e){let t;for(;"string"==typeof(t=S.call(this,e));)e=t;if(void 0===t){const{schemaId:s}=this.opts,n=new l.SchemaEnv({schema:{},schemaId:s});if(t=l.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=S.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let s=e[this.opts.schemaId];return s&&(s=(0,h.normalizeId)(s),delete this.schemas[s],delete this.refs[s]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let s;if("string"==typeof e)s=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=s);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(s=(t=e).keyword,Array.isArray(s)&&!s.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(M.call(this,s,t),!t)return(0,d.eachItem)(s,(e=>L.call(this,e))),this;R.call(this,t);const n={...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(s,0===n.type.length?e=>L.call(this,e,n):e=>n.type.forEach((t=>L.call(this,e,n,t)))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const s of t.rules){const t=s.rules.findIndex((t=>t.keyword===e));t>=0&&s.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:s="data"}={}){return e&&0!==e.length?e.map((e=>`${s}${e.instancePath} ${e.message}`)).reduce(((e,s)=>e+t+s)):"No errors"}$dataMetaSchema(e,t){const s=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const n of t){const t=n.split("/").slice(1);let r=e;for(const e of t)r=r[e];for(const e in s){const t=s[e];if("object"!=typeof t)continue;const{$data:n}=t.definition,i=r[e];n&&i&&(r[e]=k(i))}}return e}_removeAllSchemas(e,t){for(const s in e){const n=e[s];t&&!t.test(s)||("string"==typeof n?delete e[s]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[s]))}}_addSchema(e,t,s,n=this.opts.validateSchema,r=this.opts.addUsedSchema){let i;const{schemaId:o}=this.opts;if("object"==typeof e)i=e[o];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let a=this._cache.get(e);if(void 0!==a)return a;s=(0,h.normalizeId)(i||s);const c=h.getSchemaRefs.call(this,e,s);return a=new l.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:s,localRefs:c}),this._cache.set(a.schema,a),r&&!s.startsWith("#")&&(s&&this._checkUnique(s),this.refs[s]=a),n&&this.validateSchema(e,!0),a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):l.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{l.compileSchema.call(this,e)}finally{this.opts=t}}}function A(e,t,s,n="error"){for(const r in e){const i=r;i in t&&this.logger[n](`${s}: option ${r}. ${e[i]}`)}}function S(e){return e=(0,h.normalizeId)(e),this.schemas[e]||this.refs[e]}function _(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function E(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function P(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const s=e[t];s.keyword||(s.keyword=t),this.addKeyword(s)}}}function $(){const e={...this.opts};for(const t of g)delete e[t];return e}t.default=T,T.ValidationError=i.default,T.MissingRefError=o.default;const x={log(){},warn(){},error(){}},N=/^[a-z_$][a-z0-9_$:-]*$/i;function M(e,t){const{RULES:s}=this;if((0,d.eachItem)(e,(e=>{if(s.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!N.test(e))throw new Error(`Keyword ${e} has invalid name`)})),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function L(e,t,s){var n;const r=null==t?void 0:t.post;if(s&&r)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:i}=this;let o=r?i.post:i.rules.find((({type:e})=>e===s));if(o||(o={type:s,rules:[]},i.rules.push(o)),i.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)}};t.before?I.call(this,o,a,t.before):o.rules.push(a),i.all[e]=a,null===(n=t.implements)||void 0===n||n.forEach((e=>this.addKeyword(e)))}function I(e,t,s){const n=e.rules.findIndex((e=>e.keyword===s));n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${s} is not defined`))}function R(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=k(t)),e.validateSchema=this.compile(t,!0))}const O={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function k(e){return{anyOf:[e,O]}}},4087:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(2577),r=s(996),i=s(5568),o=s(6795),a=s(235),l=s(2567),c=s(1233),h=s(1968),u=["/properties"];t.default=function(e){return[n,r,i,o,a,t(this,l),c,t(this,h)].forEach((e=>this.addMetaSchema(e,void 0,!1))),this;function t(t,s){return e?t.$dataMetaSchema(s,u):s}}},3510:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(4063);n.code='require("ajv/dist/runtime/equal").default',t.default=n},4499:(e,t)=>{"use strict";function s(e){const t=e.length;let s,n=0,r=0;for(;r<t;)n++,s=e.charCodeAt(r++),s>=55296&&s<=56319&&r<t&&(s=e.charCodeAt(r),56320==(64512&s)&&r++);return n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=s,s.code='require("ajv/dist/runtime/ucs2length").default'},3589:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(540);n.code='require("ajv/dist/runtime/uri").default',t.default=n},7426:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class s extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}t.default=s},4783:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;const n=s(3487),r=s(6776),i={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>n.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>n._`{limit: ${e}}`},code(e){const{parentSchema:t,it:s}=e,{items:n}=t;Array.isArray(n)?o(e,n):(0,r.checkStrictMode)(s,'"additionalItems" is ignored when "items" is not an array of schemas')}};function o(e,t){const{gen:s,schema:i,data:o,keyword:a,it:l}=e;l.items=!0;const c=s.const("len",n._`${o}.length`);if(!1===i)e.setParams({len:t.length}),e.pass(n._`${c} <= ${t.length}`);else if("object"==typeof i&&!(0,r.alwaysValidSchema)(l,i)){const i=s.var("valid",n._`${c} <= ${t.length}`);s.if((0,n.not)(i),(()=>function(i){s.forRange("i",t.length,c,(t=>{e.subschema({keyword:a,dataProp:t,dataPropType:r.Type.Num},i),l.allErrors||s.if((0,n.not)(i),(()=>s.break()))}))}(i))),e.ok(i)}}t.validateAdditionalItems=o,t.default=i},9351:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(412),r=s(3487),i=s(2141),o=s(6776),a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>r._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:s,parentSchema:a,data:l,errsCount:c,it:h}=e;if(!c)throw new Error("ajv implementation error");const{allErrors:u,opts:d}=h;if(h.props=!0,"all"!==d.removeAdditional&&(0,o.alwaysValidSchema)(h,s))return;const m=(0,n.allSchemaProperties)(a.properties),p=(0,n.allSchemaProperties)(a.patternProperties);function f(e){t.code(r._`delete ${l}[${e}]`)}function g(n){if("all"===d.removeAdditional||d.removeAdditional&&!1===s)f(n);else{if(!1===s)return e.setParams({additionalProperty:n}),e.error(),void(u||t.break());if("object"==typeof s&&!(0,o.alwaysValidSchema)(h,s)){const s=t.name("valid");"failing"===d.removeAdditional?(y(n,s,!1),t.if((0,r.not)(s),(()=>{e.reset(),f(n)}))):(y(n,s),u||t.if((0,r.not)(s),(()=>t.break())))}}}function y(t,s,n){const r={keyword:"additionalProperties",dataProp:t,dataPropType:o.Type.Str};!1===n&&Object.assign(r,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(r,s)}t.forIn("key",l,(s=>{m.length||p.length?t.if(function(s){let i;if(m.length>8){const e=(0,o.schemaRefOrVal)(h,a.properties,"properties");i=(0,n.isOwnProperty)(t,e,s)}else i=m.length?(0,r.or)(...m.map((e=>r._`${s} === ${e}`))):r.nil;return p.length&&(i=(0,r.or)(i,...p.map((t=>r._`${(0,n.usePattern)(e,t)}.test(${s})`)))),(0,r.not)(i)}(s),(()=>g(s))):g(s)})),e.ok(r._`${c} === ${i.default.errors}`)}};t.default=a},1125:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(6776),r={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:s,it:r}=e;if(!Array.isArray(s))throw new Error("ajv implementation error");const i=t.name("valid");s.forEach(((t,s)=>{if((0,n.alwaysValidSchema)(r,t))return;const o=e.subschema({keyword:"allOf",schemaProp:s},i);e.ok(i),e.mergeEvaluated(o)}))}};t.default=r},19:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:s(412).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=n},9864:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?n.str`must contain at least ${e} valid item(s)`:n.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?n._`{minContains: ${e}}`:n._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:s,parentSchema:i,data:o,it:a}=e;let l,c;const{minContains:h,maxContains:u}=i;a.opts.next?(l=void 0===h?1:h,c=u):l=1;const d=t.const("len",n._`${o}.length`);if(e.setParams({min:l,max:c}),void 0===c&&0===l)return void(0,r.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==c&&l>c)return(0,r.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,r.alwaysValidSchema)(a,s)){let t=n._`${d} >= ${l}`;return void 0!==c&&(t=n._`${t} && ${d} <= ${c}`),void e.pass(t)}a.items=!0;const m=t.name("valid");function p(){const e=t.name("_valid"),s=t.let("count",0);f(e,(()=>t.if(e,(()=>function(e){t.code(n._`${e}++`),void 0===c?t.if(n._`${e} >= ${l}`,(()=>t.assign(m,!0).break())):(t.if(n._`${e} > ${c}`,(()=>t.assign(m,!1).break())),1===l?t.assign(m,!0):t.if(n._`${e} >= ${l}`,(()=>t.assign(m,!0))))}(s)))))}function f(s,n){t.forRange("i",0,d,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:r.Type.Num,compositeRule:!0},s),n()}))}void 0===c&&1===l?f(m,(()=>t.if(m,(()=>t.break())))):0===l?(t.let(m,!0),void 0!==c&&t.if(n._`${o}.length > 0`,p)):(t.let(m,!1),p()),e.result(m,(()=>e.reset()))}};t.default=i},7772:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const n=s(3487),r=s(6776),i=s(412);t.error={message:({params:{property:e,depsCount:t,deps:s}})=>{const r=1===t?"property":"properties";return n.str`must have ${r} ${s} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:s,missingProperty:r}})=>n._`{property: ${e},
|
|
5
|
+
|| ${a} === "boolean" || ${r} === null`).assign(l,o._`[${r}]`)}}n.else(),p(e),n.endIf(),n.if(o._`${l} !== undefined`,(()=>{n.assign(r,l),function({gen:e,parentData:t,parentDataProperty:s},n){e.if(o._`${t} !== undefined`,(()=>e.assign(o._`${t}[${s}]`,n)))}(e,l)}))}(e,t,a):p(e)}))}return c};const h=new Set(["string","number","integer","boolean","null"]);function u(e,t,s,n=l.Correct){const r=n===l.Correct?o.operators.EQ:o.operators.NEQ;let i;switch(e){case"null":return o._`${t} ${r} null`;case"array":i=o._`Array.isArray(${t})`;break;case"object":i=o._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=a(o._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=a();break;default:return o._`typeof ${t} ${r} ${e}`}return n===l.Correct?i:(0,o.not)(i);function a(e=o.nil){return(0,o.and)(o._`typeof ${t} == "number"`,e,s?o._`isFinite(${t})`:o.nil)}}function d(e,t,s,n){if(1===e.length)return u(e[0],t,s,n);let r;const i=(0,a.toHash)(e);if(i.array&&i.object){const e=o._`typeof ${t} != "object"`;r=i.null?e:o._`!${t} || ${e}`,delete i.null,delete i.array,delete i.object}else r=o.nil;i.number&&delete i.integer;for(const e in i)r=(0,o.and)(r,u(e,t,s,n));return r}t.checkDataType=u,t.checkDataTypes=d;const m={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?o._`{type: ${e}}`:o._`{type: ${t}}`};function p(e){const t=function(e){const{gen:t,data:s,schema:n}=e,r=(0,a.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:s,schema:n.type,schemaCode:r,schemaValue:r,parentSchema:n,params:{},it:e}}(e);(0,i.reportError)(t,m)}t.reportTypeError=p},313:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;const n=s(3487),r=s(6776);function i(e,t,s){const{gen:i,compositeRule:o,data:a,opts:l}=e;if(void 0===s)return;const c=n._`${a}${(0,n.getProperty)(t)}`;if(o)return void(0,r.checkStrictMode)(e,`default is ignored for: ${c}`);let h=n._`${c} === undefined`;"empty"===l.useDefaults&&(h=n._`${h} || ${c} === null || ${c} === ""`),i.if(h,n._`${c} = ${(0,n.stringify)(s)}`)}t.assignDefaults=function(e,t){const{properties:s,items:n}=e.schema;if("object"===t&&s)for(const t in s)i(e,t,s[t].default);else"array"===t&&Array.isArray(n)&&n.forEach(((t,s)=>i(e,s,t.default)))}},4815:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const n=s(5667),r=s(453),i=s(8876),o=s(453),a=s(313),l=s(5005),c=s(3099),h=s(3487),u=s(2141),d=s(2531),m=s(6776),p=s(4181);function f({gen:e,validateName:t,schema:s,schemaEnv:n,opts:r},i){r.code.es5?e.func(t,h._`${u.default.data}, ${u.default.valCxt}`,n.$async,(()=>{e.code(h._`"use strict"; ${g(s,r)}`),function(e,t){e.if(u.default.valCxt,(()=>{e.var(u.default.instancePath,h._`${u.default.valCxt}.${u.default.instancePath}`),e.var(u.default.parentData,h._`${u.default.valCxt}.${u.default.parentData}`),e.var(u.default.parentDataProperty,h._`${u.default.valCxt}.${u.default.parentDataProperty}`),e.var(u.default.rootData,h._`${u.default.valCxt}.${u.default.rootData}`),t.dynamicRef&&e.var(u.default.dynamicAnchors,h._`${u.default.valCxt}.${u.default.dynamicAnchors}`)}),(()=>{e.var(u.default.instancePath,h._`""`),e.var(u.default.parentData,h._`undefined`),e.var(u.default.parentDataProperty,h._`undefined`),e.var(u.default.rootData,u.default.data),t.dynamicRef&&e.var(u.default.dynamicAnchors,h._`{}`)}))}(e,r),e.code(i)})):e.func(t,h._`${u.default.data}, ${function(e){return h._`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${e.dynamicRef?h._`, ${u.default.dynamicAnchors}={}`:h.nil}}={}`}(r)}`,n.$async,(()=>e.code(g(s,r)).code(i)))}function g(e,t){const s="object"==typeof e&&e[t.schemaId];return s&&(t.code.source||t.code.process)?h._`/*# sourceURL=${s} */`:h.nil}function y({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const s in e)if(t.RULES.all[s])return!0;return!1}function b(e){return"boolean"!=typeof e.schema}function w(e){(0,m.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:s,opts:n,self:r}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,m.schemaHasRulesButRef)(t,r.RULES)&&r.logger.warn(`$ref: keywords ignored in schema at path "${s}"`)}(e)}function C(e,t){if(e.opts.jtd)return T(e,[],!1,t);const s=(0,r.getSchemaTypes)(e.schema);T(e,s,!(0,r.coerceAndCheckDataType)(e,s),t)}function v({gen:e,schemaEnv:t,schema:s,errSchemaPath:n,opts:r}){const i=s.$comment;if(!0===r.$comment)e.code(h._`${u.default.self}.logger.log(${i})`);else if("function"==typeof r.$comment){const s=h.str`${n}/$comment`,r=e.scopeValue("root",{ref:t.root});e.code(h._`${u.default.self}.opts.$comment(${i}, ${s}, ${r}.schema)`)}}function T(e,t,s,n){const{gen:r,schema:a,data:l,allErrors:c,opts:d,self:p}=e,{RULES:f}=p;function g(m){(0,i.shouldUseGroup)(a,m)&&(m.type?(r.if((0,o.checkDataType)(m.type,l,d.strictNumbers)),A(e,m),1===t.length&&t[0]===m.type&&s&&(r.else(),(0,o.reportTypeError)(e)),r.endIf()):A(e,m),c||r.if(h._`${u.default.errors} === ${n||0}`))}!a.$ref||!d.ignoreKeywordsWithRef&&(0,m.schemaHasRulesButRef)(a,f)?(d.jtd||function(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(function(e,t){t.length&&(e.dataTypes.length?(t.forEach((t=>{S(e.dataTypes,t)||_(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),function(e,t){const s=[];for(const n of e.dataTypes)S(t,n)?s.push(n):t.includes("integer")&&"number"===n&&s.push("integer");e.dataTypes=s}(e,t)):e.dataTypes=t)}(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&_(e,"use allowUnionTypes to allow union type keyword")}(e,t),function(e,t){const s=e.self.RULES.all;for(const n in s){const r=s[n];if("object"==typeof r&&(0,i.shouldUseRule)(e.schema,r)){const{type:s}=r.definition;s.length&&!s.some((e=>{return n=e,(s=t).includes(n)||"number"===n&&s.includes("integer");var s,n}))&&_(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}(e,e.dataTypes))}(e,t),r.block((()=>{for(const e of f.rules)g(e);g(f.post)}))):r.block((()=>P(e,"$ref",f.all.$ref.definition)))}function A(e,t){const{gen:s,schema:n,opts:{useDefaults:r}}=e;r&&(0,a.assignDefaults)(e,t.type),s.block((()=>{for(const s of t.rules)(0,i.shouldUseRule)(n,s)&&P(e,s.keyword,s.definition,t.type)}))}function S(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function _(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,m.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){b(e)&&(w(e),y(e))?function(e){const{schema:t,opts:s,gen:n}=e;f(e,(()=>{s.$comment&&t.$comment&&v(e),function(e){const{schema:t,opts:s}=e;void 0!==t.default&&s.useDefaults&&s.strictSchema&&(0,m.checkStrictMode)(e,"default is ignored in the schema root")}(e),n.let(u.default.vErrors,null),n.let(u.default.errors,0),s.unevaluated&&function(e){const{gen:t,validateName:s}=e;e.evaluated=t.const("evaluated",h._`${s}.evaluated`),t.if(h._`${e.evaluated}.dynamicProps`,(()=>t.assign(h._`${e.evaluated}.props`,h._`undefined`))),t.if(h._`${e.evaluated}.dynamicItems`,(()=>t.assign(h._`${e.evaluated}.items`,h._`undefined`)))}(e),C(e),function(e){const{gen:t,schemaEnv:s,validateName:n,ValidationError:r,opts:i}=e;s.$async?t.if(h._`${u.default.errors} === 0`,(()=>t.return(u.default.data)),(()=>t.throw(h._`new ${r}(${u.default.vErrors})`))):(t.assign(h._`${n}.errors`,u.default.vErrors),i.unevaluated&&function({gen:e,evaluated:t,props:s,items:n}){s instanceof h.Name&&e.assign(h._`${t}.props`,s),n instanceof h.Name&&e.assign(h._`${t}.items`,n)}(e),t.return(h._`${u.default.errors} === 0`))}(e)}))}(e):f(e,(()=>(0,n.topBoolOrEmptySchema)(e)))};class E{constructor(e,t,s){if((0,l.validateKeywordUsage)(e,t,s),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=s,this.data=e.data,this.schema=e.schema[s],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,m.schemaRefOrVal)(e,this.schema,s,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",N(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,l.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${s} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",u.default.errors))}result(e,t,s){this.failResult((0,h.not)(e),t,s)}failResult(e,t,s){this.gen.if(e),s?s():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,h.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(h._`${t} !== undefined && (${(0,h.or)(this.invalid$data(),e)})`)}error(e,t,s){if(t)return this.setParams(t),this._error(e,s),void this.setParams({});this._error(e,s)}_error(e,t){(e?p.reportExtraError:p.reportError)(this,this.def.error,t)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,s=h.nil){this.gen.block((()=>{this.check$data(e,s),t()}))}check$data(e=h.nil,t=h.nil){if(!this.$data)return;const{gen:s,schemaCode:n,schemaType:r,def:i}=this;s.if((0,h.or)(h._`${n} === undefined`,t)),e!==h.nil&&s.assign(e,!0),(r.length||i.validateSchema)&&(s.elseIf(this.invalid$data()),this.$dataError(),e!==h.nil&&s.assign(e,!1)),s.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:s,def:n,it:r}=this;return(0,h.or)(function(){if(s.length){if(!(t instanceof h.Name))throw new Error("ajv implementation error");const e=Array.isArray(s)?s:[s];return h._`${(0,o.checkDataTypes)(e,t,r.opts.strictNumbers,o.DataType.Wrong)}`}return h.nil}(),function(){if(n.validateSchema){const s=e.scopeValue("validate$data",{ref:n.validateSchema});return h._`!${s}(${t})`}return h.nil}())}subschema(e,t){const s=(0,c.getSubschema)(this.it,e);(0,c.extendSubschemaData)(s,this.it,e),(0,c.extendSubschemaMode)(s,e);const r={...this.it,...s,items:void 0,props:void 0};return function(e,t){b(e)&&(w(e),y(e))?function(e,t){const{schema:s,gen:n,opts:r}=e;r.$comment&&s.$comment&&v(e),function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,d.resolveUrl)(e.opts.uriResolver,e.baseId,t))}(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const i=n.const("_errs",u.default.errors);C(e,i),n.var(t,h._`${i} === ${u.default.errors}`)}(e,t):(0,n.boolOrEmptySchema)(e,t)}(r,t),r}mergeEvaluated(e,t){const{it:s,gen:n}=this;s.opts.unevaluated&&(!0!==s.props&&void 0!==e.props&&(s.props=m.mergeEvaluated.props(n,e.props,s.props,t)),!0!==s.items&&void 0!==e.items&&(s.items=m.mergeEvaluated.items(n,e.items,s.items,t)))}mergeValidEvaluated(e,t){const{it:s,gen:n}=this;if(s.opts.unevaluated&&(!0!==s.props||!0!==s.items))return n.if(t,(()=>this.mergeEvaluated(e,h.Name))),!0}}function P(e,t,s,n){const r=new E(e,s,t);"code"in s?s.code(r,n):r.$data&&s.validate?(0,l.funcKeywordCode)(r,s):"macro"in s?(0,l.macroKeywordCode)(r,s):(s.compile||s.validate)&&(0,l.funcKeywordCode)(r,s)}t.KeywordCxt=E;const $=/^\/(?:[^~]|~0|~1)*$/,x=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function N(e,{dataLevel:t,dataNames:s,dataPathArr:n}){let r,i;if(""===e)return u.default.rootData;if("/"===e[0]){if(!$.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);r=e,i=u.default.rootData}else{const o=x.exec(e);if(!o)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+o[1];if(r=o[2],"#"===r){if(a>=t)throw new Error(l("property/index",a));return n[t-a]}if(a>t)throw new Error(l("data",a));if(i=s[t-a],!r)return i}let o=i;const a=r.split("/");for(const e of a)e&&(i=h._`${i}${(0,h.getProperty)((0,m.unescapeJsonPointer)(e))}`,o=h._`${o} && ${i}`);return o;function l(e,s){return`Cannot access ${e} ${s} levels up, current level is ${t}`}}t.getData=N},5005:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const n=s(3487),r=s(2141),i=s(412),o=s(4181);function a(e){const{gen:t,data:s,it:r}=e;t.if(r.parentData,(()=>t.assign(s,n._`${r.parentData}[${r.parentDataProperty}]`)))}function l(e,t,s){if(void 0===s)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof s?{ref:s}:{ref:s,code:(0,n.stringify)(s)})}t.macroKeywordCode=function(e,t){const{gen:s,keyword:r,schema:i,parentSchema:o,it:a}=e,c=t.macro.call(a.self,i,o,a),h=l(s,r,c);!1!==a.opts.validateSchema&&a.self.validateSchema(c,!0);const u=s.name("valid");e.subschema({schema:c,schemaPath:n.nil,errSchemaPath:`${a.errSchemaPath}/${r}`,topSchemaRef:h,compositeRule:!0},u),e.pass(u,(()=>e.error(!0)))},t.funcKeywordCode=function(e,t){var s;const{gen:c,keyword:h,schema:u,parentSchema:d,$data:m,it:p}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(p,t);const f=!m&&t.compile?t.compile.call(p.self,u,d,p):t.validate,g=l(c,h,f),y=c.let("valid");function b(s=(t.async?n._`await `:n.nil)){const o=p.opts.passContext?r.default.this:r.default.self,a=!("compile"in t&&!m||!1===t.schema);c.assign(y,n._`${s}${(0,i.callValidateCode)(e,g,o,a)}`,t.modifying)}function w(e){var s;c.if((0,n.not)(null!==(s=t.valid)&&void 0!==s?s:y),e)}e.block$data(y,(function(){if(!1===t.errors)b(),t.modifying&&a(e),w((()=>e.error()));else{const s=t.async?function(){const e=c.let("ruleErrs",null);return c.try((()=>b(n._`await `)),(t=>c.assign(y,!1).if(n._`${t} instanceof ${p.ValidationError}`,(()=>c.assign(e,n._`${t}.errors`)),(()=>c.throw(t))))),e}():function(){const e=n._`${g}.errors`;return c.assign(e,null),b(n.nil),e}();t.modifying&&a(e),w((()=>function(e,t){const{gen:s}=e;s.if(n._`Array.isArray(${t})`,(()=>{s.assign(r.default.vErrors,n._`${r.default.vErrors} === null ? ${t} : ${r.default.vErrors}.concat(${t})`).assign(r.default.errors,n._`${r.default.vErrors}.length`),(0,o.extendErrors)(e)}),(()=>e.error()))}(e,s)))}})),e.ok(null!==(s=t.valid)&&void 0!==s?s:y)},t.validSchemaType=function(e,t,s=!1){return!t.length||t.some((t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||s&&void 0===e))},t.validateKeywordUsage=function({schema:e,opts:t,self:s,errSchemaPath:n},r,i){if(Array.isArray(r.keyword)?!r.keyword.includes(i):r.keyword!==i)throw new Error("ajv implementation error");const o=r.dependencies;if(null==o?void 0:o.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(r.validateSchema&&!r.validateSchema(e[i])){const e=`keyword "${i}" value is invalid at path "${n}": `+s.errorsText(r.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);s.logger.error(e)}}},3099:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;const n=s(3487),r=s(6776);t.getSubschema=function(e,{keyword:t,schemaProp:s,schema:i,schemaPath:o,errSchemaPath:a,topSchemaRef:l}){if(void 0!==t&&void 0!==i)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const i=e.schema[t];return void 0===s?{schema:i,schemaPath:n._`${e.schemaPath}${(0,n.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:i[s],schemaPath:n._`${e.schemaPath}${(0,n.getProperty)(t)}${(0,n.getProperty)(s)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,r.escapeFragment)(s)}`}}if(void 0!==i){if(void 0===o||void 0===a||void 0===l)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:o,topSchemaRef:l,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:s,dataPropType:i,data:o,dataTypes:a,propertyName:l}){if(void 0!==o&&void 0!==s)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:c}=t;if(void 0!==s){const{errorPath:o,dataPathArr:a,opts:l}=t;h(c.let("data",n._`${t.data}${(0,n.getProperty)(s)}`,!0)),e.errorPath=n.str`${o}${(0,r.getErrorPath)(s,i,l.jsPropertySyntax)}`,e.parentDataProperty=n._`${s}`,e.dataPathArr=[...a,e.parentDataProperty]}function h(s){e.data=s,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,s]}void 0!==o&&(h(o instanceof n.Name?o:c.let("data",o,!0)),void 0!==l&&(e.propertyName=l)),a&&(e.dataTypes=a)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:s,compositeRule:n,createErrors:r,allErrors:i}){void 0!==n&&(e.compositeRule=n),void 0!==r&&(e.createErrors=r),void 0!==i&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=s}},7159:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var n=s(4815);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return n.KeywordCxt}});var r=s(3487);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const i=s(7426),o=s(6646),a=s(3141),l=s(5173),c=s(3487),h=s(2531),u=s(453),d=s(6776),m=s(4775),p=s(3589),f=(e,t)=>new RegExp(e,t);f.code="new RegExp";const g=["removeAdditional","useDefaults","coerceTypes"],y=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),b={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},w={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},C=200;function v(e){var t,s,n,r,i,o,a,l,c,h,u,d,m,g,y,b,w,v,T,A,S,_,E,P,$;const x=e.strict,N=null===(t=e.code)||void 0===t?void 0:t.optimize,M=!0===N||void 0===N?1:N||0,L=null!==(n=null===(s=e.code)||void 0===s?void 0:s.regExp)&&void 0!==n?n:f,I=null!==(r=e.uriResolver)&&void 0!==r?r:p.default;return{strictSchema:null===(o=null!==(i=e.strictSchema)&&void 0!==i?i:x)||void 0===o||o,strictNumbers:null===(l=null!==(a=e.strictNumbers)&&void 0!==a?a:x)||void 0===l||l,strictTypes:null!==(h=null!==(c=e.strictTypes)&&void 0!==c?c:x)&&void 0!==h?h:"log",strictTuples:null!==(d=null!==(u=e.strictTuples)&&void 0!==u?u:x)&&void 0!==d?d:"log",strictRequired:null!==(g=null!==(m=e.strictRequired)&&void 0!==m?m:x)&&void 0!==g&&g,code:e.code?{...e.code,optimize:M,regExp:L}:{optimize:M,regExp:L},loopRequired:null!==(y=e.loopRequired)&&void 0!==y?y:C,loopEnum:null!==(b=e.loopEnum)&&void 0!==b?b:C,meta:null===(w=e.meta)||void 0===w||w,messages:null===(v=e.messages)||void 0===v||v,inlineRefs:null===(T=e.inlineRefs)||void 0===T||T,schemaId:null!==(A=e.schemaId)&&void 0!==A?A:"$id",addUsedSchema:null===(S=e.addUsedSchema)||void 0===S||S,validateSchema:null===(_=e.validateSchema)||void 0===_||_,validateFormats:null===(E=e.validateFormats)||void 0===E||E,unicodeRegExp:null===(P=e.unicodeRegExp)||void 0===P||P,int32range:null===($=e.int32range)||void 0===$||$,uriResolver:I}}class T{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...v(e)};const{es5:t,lines:s}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:y,es5:t,lines:s}),this.logger=function(e){if(!1===e)return x;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),A.call(this,b,e,"NOT SUPPORTED"),A.call(this,w,e,"DEPRECATED","warn"),this._metaOpts=$.call(this),e.formats&&E.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&P.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),_.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:s}=this.opts;let n=m;"id"===s&&(n={...m},n.id=n.$id,delete n.$id),t&&e&&this.addMetaSchema(n,n[s],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let s;if("string"==typeof e){if(s=this.getSchema(e),!s)throw new Error(`no schema with key or ref "${e}"`)}else s=this.compile(e);const n=s(t);return"$async"in s||(this.errors=s.errors),n}compile(e,t){const s=this._addSchema(e,t);return s.validate||this._compileSchemaEnv(s)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:s}=this.opts;return n.call(this,e,t);async function n(e,t){await r.call(this,e.$schema);const s=this._addSchema(e,t);return s.validate||i.call(this,s)}async function r(e){e&&!this.getSchema(e)&&await n.call(this,{$ref:e},!0)}async function i(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return a.call(this,t),await l.call(this,t.missingSchema),i.call(this,e)}}function a({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){const s=await c.call(this,e);this.refs[e]||await r.call(this,s.$schema),this.refs[e]||this.addSchema(s,e,t)}async function c(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=s(e))}finally{delete this._loading[e]}}}addSchema(e,t,s,n=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,s,n);return this}let r;if("object"==typeof e){const{schemaId:t}=this.opts;if(r=e[t],void 0!==r&&"string"!=typeof r)throw new Error(`schema ${t} must be string`)}return t=(0,h.normalizeId)(t||r),this._checkUnique(t),this.schemas[t]=this._addSchema(e,s,t,n,!0),this}addMetaSchema(e,t,s=this.opts.validateSchema){return this.addSchema(e,t,!0,s),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let s;if(s=e.$schema,void 0!==s&&"string"!=typeof s)throw new Error("$schema must be a string");if(s=s||this.opts.defaultMeta||this.defaultMeta(),!s)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const n=this.validate(s,e);if(!n&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return n}getSchema(e){let t;for(;"string"==typeof(t=S.call(this,e));)e=t;if(void 0===t){const{schemaId:s}=this.opts,n=new l.SchemaEnv({schema:{},schemaId:s});if(t=l.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=S.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let s=e[this.opts.schemaId];return s&&(s=(0,h.normalizeId)(s),delete this.schemas[s],delete this.refs[s]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let s;if("string"==typeof e)s=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=s);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(s=(t=e).keyword,Array.isArray(s)&&!s.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(M.call(this,s,t),!t)return(0,d.eachItem)(s,(e=>L.call(this,e))),this;R.call(this,t);const n={...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(s,0===n.type.length?e=>L.call(this,e,n):e=>n.type.forEach((t=>L.call(this,e,n,t)))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const s of t.rules){const t=s.rules.findIndex((t=>t.keyword===e));t>=0&&s.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:s="data"}={}){return e&&0!==e.length?e.map((e=>`${s}${e.instancePath} ${e.message}`)).reduce(((e,s)=>e+t+s)):"No errors"}$dataMetaSchema(e,t){const s=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const n of t){const t=n.split("/").slice(1);let r=e;for(const e of t)r=r[e];for(const e in s){const t=s[e];if("object"!=typeof t)continue;const{$data:n}=t.definition,i=r[e];n&&i&&(r[e]=k(i))}}return e}_removeAllSchemas(e,t){for(const s in e){const n=e[s];t&&!t.test(s)||("string"==typeof n?delete e[s]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[s]))}}_addSchema(e,t,s,n=this.opts.validateSchema,r=this.opts.addUsedSchema){let i;const{schemaId:o}=this.opts;if("object"==typeof e)i=e[o];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let a=this._cache.get(e);if(void 0!==a)return a;s=(0,h.normalizeId)(i||s);const c=h.getSchemaRefs.call(this,e,s);return a=new l.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:s,localRefs:c}),this._cache.set(a.schema,a),r&&!s.startsWith("#")&&(s&&this._checkUnique(s),this.refs[s]=a),n&&this.validateSchema(e,!0),a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):l.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{l.compileSchema.call(this,e)}finally{this.opts=t}}}function A(e,t,s,n="error"){for(const r in e){const i=r;i in t&&this.logger[n](`${s}: option ${r}. ${e[i]}`)}}function S(e){return e=(0,h.normalizeId)(e),this.schemas[e]||this.refs[e]}function _(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function E(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function P(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const s=e[t];s.keyword||(s.keyword=t),this.addKeyword(s)}}}function $(){const e={...this.opts};for(const t of g)delete e[t];return e}t.default=T,T.ValidationError=i.default,T.MissingRefError=o.default;const x={log(){},warn(){},error(){}},N=/^[a-z_$][a-z0-9_$:-]*$/i;function M(e,t){const{RULES:s}=this;if((0,d.eachItem)(e,(e=>{if(s.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!N.test(e))throw new Error(`Keyword ${e} has invalid name`)})),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function L(e,t,s){var n;const r=null==t?void 0:t.post;if(s&&r)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:i}=this;let o=r?i.post:i.rules.find((({type:e})=>e===s));if(o||(o={type:s,rules:[]},i.rules.push(o)),i.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)}};t.before?I.call(this,o,a,t.before):o.rules.push(a),i.all[e]=a,null===(n=t.implements)||void 0===n||n.forEach((e=>this.addKeyword(e)))}function I(e,t,s){const n=e.rules.findIndex((e=>e.keyword===s));n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${s} is not defined`))}function R(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=k(t)),e.validateSchema=this.compile(t,!0))}const O={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function k(e){return{anyOf:[e,O]}}},4087:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(2577),r=s(996),i=s(5568),o=s(6795),a=s(235),l=s(2567),c=s(1233),h=s(1968),u=["/properties"];t.default=function(e){return[n,r,i,o,a,t(this,l),c,t(this,h)].forEach((e=>this.addMetaSchema(e,void 0,!1))),this;function t(t,s){return e?t.$dataMetaSchema(s,u):s}}},3510:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(4063);n.code='require("ajv/dist/runtime/equal").default',t.default=n},4499:(e,t)=>{"use strict";function s(e){const t=e.length;let s,n=0,r=0;for(;r<t;)n++,s=e.charCodeAt(r++),s>=55296&&s<=56319&&r<t&&(s=e.charCodeAt(r),56320==(64512&s)&&r++);return n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=s,s.code='require("ajv/dist/runtime/ucs2length").default'},3589:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(540);n.code='require("ajv/dist/runtime/uri").default',t.default=n},7426:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class s extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}t.default=s},4783:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;const n=s(3487),r=s(6776),i={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>n.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>n._`{limit: ${e}}`},code(e){const{parentSchema:t,it:s}=e,{items:n}=t;Array.isArray(n)?o(e,n):(0,r.checkStrictMode)(s,'"additionalItems" is ignored when "items" is not an array of schemas')}};function o(e,t){const{gen:s,schema:i,data:o,keyword:a,it:l}=e;l.items=!0;const c=s.const("len",n._`${o}.length`);if(!1===i)e.setParams({len:t.length}),e.pass(n._`${c} <= ${t.length}`);else if("object"==typeof i&&!(0,r.alwaysValidSchema)(l,i)){const i=s.var("valid",n._`${c} <= ${t.length}`);s.if((0,n.not)(i),(()=>function(i){s.forRange("i",t.length,c,(t=>{e.subschema({keyword:a,dataProp:t,dataPropType:r.Type.Num},i),l.allErrors||s.if((0,n.not)(i),(()=>s.break()))}))}(i))),e.ok(i)}}t.validateAdditionalItems=o,t.default=i},9351:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(412),r=s(3487),i=s(2141),o=s(6776),a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>r._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:s,parentSchema:a,data:l,errsCount:c,it:h}=e;if(!c)throw new Error("ajv implementation error");const{allErrors:u,opts:d}=h;if(h.props=!0,"all"!==d.removeAdditional&&(0,o.alwaysValidSchema)(h,s))return;const m=(0,n.allSchemaProperties)(a.properties),p=(0,n.allSchemaProperties)(a.patternProperties);function f(e){t.code(r._`delete ${l}[${e}]`)}function g(n){if("all"===d.removeAdditional||d.removeAdditional&&!1===s)f(n);else{if(!1===s)return e.setParams({additionalProperty:n}),e.error(),void(u||t.break());if("object"==typeof s&&!(0,o.alwaysValidSchema)(h,s)){const s=t.name("valid");"failing"===d.removeAdditional?(y(n,s,!1),t.if((0,r.not)(s),(()=>{e.reset(),f(n)}))):(y(n,s),u||t.if((0,r.not)(s),(()=>t.break())))}}}function y(t,s,n){const r={keyword:"additionalProperties",dataProp:t,dataPropType:o.Type.Str};!1===n&&Object.assign(r,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(r,s)}t.forIn("key",l,(s=>{m.length||p.length?t.if(function(s){let i;if(m.length>8){const e=(0,o.schemaRefOrVal)(h,a.properties,"properties");i=(0,n.isOwnProperty)(t,e,s)}else i=m.length?(0,r.or)(...m.map((e=>r._`${s} === ${e}`))):r.nil;return p.length&&(i=(0,r.or)(i,...p.map((t=>r._`${(0,n.usePattern)(e,t)}.test(${s})`)))),(0,r.not)(i)}(s),(()=>g(s))):g(s)})),e.ok(r._`${c} === ${i.default.errors}`)}};t.default=a},1125:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(6776),r={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:s,it:r}=e;if(!Array.isArray(s))throw new Error("ajv implementation error");const i=t.name("valid");s.forEach(((t,s)=>{if((0,n.alwaysValidSchema)(r,t))return;const o=e.subschema({keyword:"allOf",schemaProp:s},i);e.ok(i),e.mergeEvaluated(o)}))}};t.default=r},19:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:s(412).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=n},9864:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?n.str`must contain at least ${e} valid item(s)`:n.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?n._`{minContains: ${e}}`:n._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:s,parentSchema:i,data:o,it:a}=e;let l,c;const{minContains:h,maxContains:u}=i;a.opts.next?(l=void 0===h?1:h,c=u):l=1;const d=t.const("len",n._`${o}.length`);if(e.setParams({min:l,max:c}),void 0===c&&0===l)return void(0,r.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==c&&l>c)return(0,r.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,r.alwaysValidSchema)(a,s)){let t=n._`${d} >= ${l}`;return void 0!==c&&(t=n._`${t} && ${d} <= ${c}`),void e.pass(t)}a.items=!0;const m=t.name("valid");function p(){const e=t.name("_valid"),s=t.let("count",0);f(e,(()=>t.if(e,(()=>function(e){t.code(n._`${e}++`),void 0===c?t.if(n._`${e} >= ${l}`,(()=>t.assign(m,!0).break())):(t.if(n._`${e} > ${c}`,(()=>t.assign(m,!1).break())),1===l?t.assign(m,!0):t.if(n._`${e} >= ${l}`,(()=>t.assign(m,!0))))}(s)))))}function f(s,n){t.forRange("i",0,d,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:r.Type.Num,compositeRule:!0},s),n()}))}void 0===c&&1===l?f(m,(()=>t.if(m,(()=>t.break())))):0===l?(t.let(m,!0),void 0!==c&&t.if(n._`${o}.length > 0`,p)):(t.let(m,!1),p()),e.result(m,(()=>e.reset()))}};t.default=i},7772:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const n=s(3487),r=s(6776),i=s(412);t.error={message:({params:{property:e,depsCount:t,deps:s}})=>{const r=1===t?"property":"properties";return n.str`must have ${r} ${s} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:s,missingProperty:r}})=>n._`{property: ${e},
|
|
6
6
|
missingProperty: ${r},
|
|
7
7
|
depsCount: ${t},
|
|
8
|
-
deps: ${s}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,s]=function({schema:e}){const t={},s={};for(const n in e)"__proto__"!==n&&((Array.isArray(e[n])?t:s)[n]=e[n]);return[t,s]}(e);a(e,t),l(e,s)}};function a(e,t=e.schema){const{gen:s,data:r,it:o}=e;if(0===Object.keys(t).length)return;const a=s.let("missing");for(const l in t){const c=t[l];if(0===c.length)continue;const h=(0,i.propertyInData)(s,r,l,o.opts.ownProperties);e.setParams({property:l,depsCount:c.length,deps:c.join(", ")}),o.allErrors?s.if(h,(()=>{for(const t of c)(0,i.checkReportMissingProp)(e,t)})):(s.if(n._`${h} && (${(0,i.checkMissingProp)(e,c,a)})`),(0,i.reportMissingProp)(e,a),s.else())}}function l(e,t=e.schema){const{gen:s,data:n,keyword:o,it:a}=e,l=s.name("valid");for(const c in t)(0,r.alwaysValidSchema)(a,t[c])||(s.if((0,i.propertyInData)(s,n,c,a.opts.ownProperties),(()=>{const t=e.subschema({keyword:o,schemaProp:c},l);e.mergeValidEvaluated(t,l)}),(()=>s.var(l,!0))),e.ok(l))}t.validatePropertyDeps=a,t.validateSchemaDeps=l,t.default=o},7274:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(7772),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,n.validateSchemaDeps)(e)};t.default=r},9434:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>n.str`must match "${e.ifClause}" schema`,params:({params:e})=>n._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:s,it:i}=e;void 0===s.then&&void 0===s.else&&(0,r.checkStrictMode)(i,'"if" without "then" and "else" is ignored');const a=o(i,"then"),l=o(i,"else");if(!a&&!l)return;const c=t.let("valid",!0),h=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},h);e.mergeEvaluated(t)}(),e.reset(),a&&l){const s=t.let("ifClause");e.setParams({ifClause:s}),t.if(h,u("then",s),u("else",s))}else a?t.if(h,u("then")):t.if((0,n.not)(h),u("else"));function u(s,r){return()=>{const i=e.subschema({keyword:s},h);t.assign(c,h),e.mergeValidEvaluated(i,c),r?t.assign(r,n._`${s}`):e.setParams({ifClause:s})}}e.pass(c,(()=>e.error(!0)))}};function o(e,t){const s=e.schema[t];return void 0!==s&&!(0,r.alwaysValidSchema)(e,s)}t.default=i},8200:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(4783),r=s(2924),i=s(4665),o=s(1119),a=s(9864),l=s(7772),c=s(3708),h=s(9351),u=s(6239),d=s(2296),m=s(2182),p=s(19),f=s(4200),g=s(1125),y=s(9434),w=s(6552);t.default=function(e=!1){const t=[m.default,p.default,f.default,g.default,y.default,w.default,c.default,h.default,l.default,u.default,d.default];return e?t.push(r.default,o.default):t.push(n.default,i.default),t.push(a.default),t}},4665:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;const n=s(3487),r=s(6776),i=s(412),o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:s}=e;if(Array.isArray(t))return a(e,"additionalItems",t);s.items=!0,(0,r.alwaysValidSchema)(s,t)||e.ok((0,i.validateArray)(e))}};function a(e,t,s=e.schema){const{gen:i,parentSchema:o,data:a,keyword:l,it:c}=e;!function(e){const{opts:n,errSchemaPath:i}=c,o=s.length,a=o===e.minItems&&(o===e.maxItems||!1===e[t]);if(n.strictTuples&&!a){const e=`"${l}" is ${o}-tuple, but minItems or maxItems/${t} are not specified or different at path "${i}"`;(0,r.checkStrictMode)(c,e,n.strictTuples)}}(o),c.opts.unevaluated&&s.length&&!0!==c.items&&(c.items=r.mergeEvaluated.items(i,s.length,c.items));const h=i.name("valid"),u=i.const("len",n._`${a}.length`);s.forEach(((t,s)=>{(0,r.alwaysValidSchema)(c,t)||(i.if(n._`${u} > ${s}`,(()=>e.subschema({keyword:l,schemaProp:s,dataProp:s},h))),e.ok(h))}))}t.validateTuple=a,t.default=o},1119:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i=s(412),o=s(4783),a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>n.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>n._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:s,it:n}=e,{prefixItems:a}=s;n.items=!0,(0,r.alwaysValidSchema)(n,t)||(a?(0,o.validateAdditionalItems)(e,a):e.ok((0,i.validateArray)(e)))}};t.default=a},2182:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(6776),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:s,it:r}=e;if((0,n.alwaysValidSchema)(r,s))return void e.fail();const i=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),e.failResult(i,(()=>e.reset()),(()=>e.error()))},error:{message:"must NOT be valid"}};t.default=r},4200:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>n._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:s,parentSchema:i,it:o}=e;if(!Array.isArray(s))throw new Error("ajv implementation error");if(o.opts.discriminator&&i.discriminator)return;const a=s,l=t.let("valid",!1),c=t.let("passing",null),h=t.name("_valid");e.setParams({passing:c}),t.block((function(){a.forEach(((s,i)=>{let a;(0,r.alwaysValidSchema)(o,s)?t.var(h,!0):a=e.subschema({keyword:"oneOf",schemaProp:i,compositeRule:!0},h),i>0&&t.if(n._`${h} && ${l}`).assign(l,!1).assign(c,n._`[${c}, ${i}]`).else(),t.if(h,(()=>{t.assign(l,!0),t.assign(c,i),a&&e.mergeEvaluated(a,n.Name)}))}))})),e.result(l,(()=>e.reset()),(()=>e.error(!0)))}};t.default=i},2296:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(412),r=s(3487),i=s(6776),o=s(6776),a={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:s,data:a,parentSchema:l,it:c}=e,{opts:h}=c,u=(0,n.allSchemaProperties)(s),d=u.filter((e=>(0,i.alwaysValidSchema)(c,s[e])));if(0===u.length||d.length===u.length&&(!c.opts.unevaluated||!0===c.props))return;const m=h.strictSchema&&!h.allowMatchingProperties&&l.properties,p=t.name("valid");!0===c.props||c.props instanceof r.Name||(c.props=(0,o.evaluatedPropsToName)(t,c.props));const{props:f}=c;function g(e){for(const t in m)new RegExp(e).test(t)&&(0,i.checkStrictMode)(c,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function y(s){t.forIn("key",a,(i=>{t.if(r._`${(0,n.usePattern)(e,s)}.test(${i})`,(()=>{const n=d.includes(s);n||e.subschema({keyword:"patternProperties",schemaProp:s,dataProp:i,dataPropType:o.Type.Str},p),c.opts.unevaluated&&!0!==f?t.assign(r._`${f}[${i}]`,!0):n||c.allErrors||t.if((0,r.not)(p),(()=>t.break()))}))}))}!function(){for(const e of u)m&&g(e),c.allErrors?y(e):(t.var(p,!0),y(e),t.if(p))}()}};t.default=a},2924:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(4665),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,n.validateTuple)(e,"items")};t.default=r},6239:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(4815),r=s(412),i=s(6776),o=s(9351),a={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:s,parentSchema:a,data:l,it:c}=e;"all"===c.opts.removeAdditional&&void 0===a.additionalProperties&&o.default.code(new n.KeywordCxt(c,o.default,"additionalProperties"));const h=(0,r.allSchemaProperties)(s);for(const e of h)c.definedProperties.add(e);c.opts.unevaluated&&h.length&&!0!==c.props&&(c.props=i.mergeEvaluated.props(t,(0,i.toHash)(h),c.props));const u=h.filter((e=>!(0,i.alwaysValidSchema)(c,s[e])));if(0===u.length)return;const d=t.name("valid");for(const s of u)m(s)?p(s):(t.if((0,r.propertyInData)(t,l,s,c.opts.ownProperties)),p(s),c.allErrors||t.else().var(d,!0),t.endIf()),e.it.definedProperties.add(s),e.ok(d);function m(e){return c.opts.useDefaults&&!c.compositeRule&&void 0!==s[e].default}function p(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},d)}}};t.default=a},3708:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>n._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:s,data:i,it:o}=e;if((0,r.alwaysValidSchema)(o,s))return;const a=t.name("valid");t.forIn("key",i,(s=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},a),t.if((0,n.not)(a),(()=>{e.error(!0),o.allErrors||t.break()}))})),e.ok(a)}};t.default=i},6552:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(6776),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:s}){void 0===t.if&&(0,n.checkStrictMode)(s,`"${e}" without "if" is ignored`)}};t.default=r},412:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;const n=s(3487),r=s(6776),i=s(2141),o=s(6776);function a(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:n._`Object.prototype.hasOwnProperty`})}function l(e,t,s){return n._`${a(e)}.call(${t}, ${s})`}function c(e,t,s,r){const i=n._`${t}${(0,n.getProperty)(s)} === undefined`;return r?(0,n.or)(i,(0,n.not)(l(e,t,s))):i}function h(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}t.checkReportMissingProp=function(e,t){const{gen:s,data:r,it:i}=e;s.if(c(s,r,t,i.opts.ownProperties),(()=>{e.setParams({missingProperty:n._`${t}`},!0),e.error()}))},t.checkMissingProp=function({gen:e,data:t,it:{opts:s}},r,i){return(0,n.or)(...r.map((r=>(0,n.and)(c(e,t,r,s.ownProperties),n._`${i} = ${r}`))))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=a,t.isOwnProperty=l,t.propertyInData=function(e,t,s,r){const i=n._`${t}${(0,n.getProperty)(s)} !== undefined`;return r?n._`${i} && ${l(e,t,s)}`:i},t.noPropertyInData=c,t.allSchemaProperties=h,t.schemaProperties=function(e,t){return h(t).filter((s=>!(0,r.alwaysValidSchema)(e,t[s])))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:s,topSchemaRef:r,schemaPath:o,errorPath:a},it:l},c,h,u){const d=u?n._`${e}, ${t}, ${r}${o}`:t,m=[[i.default.instancePath,(0,n.strConcat)(i.default.instancePath,a)],[i.default.parentData,l.parentData],[i.default.parentDataProperty,l.parentDataProperty],[i.default.rootData,i.default.rootData]];l.opts.dynamicRef&&m.push([i.default.dynamicAnchors,i.default.dynamicAnchors]);const p=n._`${d}, ${s.object(...m)}`;return h!==n.nil?n._`${c}.call(${h}, ${p})`:n._`${c}(${p})`};const u=n._`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},s){const r=t.unicodeRegExp?"u":"",{regExp:i}=t.code,a=i(s,r);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:n._`${"new RegExp"===i.code?u:(0,o.useFunc)(e,i)}(${s}, ${r})`})},t.validateArray=function(e){const{gen:t,data:s,keyword:i,it:o}=e,a=t.name("valid");if(o.allErrors){const e=t.let("valid",!0);return l((()=>t.assign(e,!1))),e}return t.var(a,!0),l((()=>t.break())),a;function l(o){const l=t.const("len",n._`${s}.length`);t.forRange("i",0,l,(s=>{e.subschema({keyword:i,dataProp:s,dataPropType:r.Type.Num},a),t.if((0,n.not)(a),o)}))}},t.validateUnion=function(e){const{gen:t,schema:s,keyword:i,it:o}=e;if(!Array.isArray(s))throw new Error("ajv implementation error");if(s.some((e=>(0,r.alwaysValidSchema)(o,e)))&&!o.opts.unevaluated)return;const a=t.let("valid",!1),l=t.name("_valid");t.block((()=>s.forEach(((s,r)=>{const o=e.subschema({keyword:i,schemaProp:r,compositeRule:!0},l);t.assign(a,n._`${a} || ${l}`),e.mergeValidEvaluated(o,l)||t.if((0,n.not)(a))})))),e.result(a,(()=>e.reset()),(()=>e.error(!0)))}},8386:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t.default=s},5684:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(8386),r=s(8280),i=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",n.default,r.default];t.default=i},8280:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;const n=s(6646),r=s(412),i=s(3487),o=s(2141),a=s(5173),l=s(6776),c={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:s,it:r}=e,{baseId:o,schemaEnv:l,validateName:c,opts:d,self:m}=r,{root:p}=l;if(("#"===s||"#/"===s)&&o===p.baseId)return function(){if(l===p)return u(e,c,l,l.$async);const s=t.scopeValue("root",{ref:p});return u(e,i._`${s}.validate`,p,p.$async)}();const f=a.resolveRef.call(m,p,o,s);if(void 0===f)throw new n.default(r.opts.uriResolver,o,s);return f instanceof a.SchemaEnv?function(t){const s=h(e,t);u(e,s,t,t.$async)}(f):function(n){const r=t.scopeValue("schema",!0===d.code.source?{ref:n,code:(0,i.stringify)(n)}:{ref:n}),o=t.name("valid"),a=e.subschema({schema:n,dataTypes:[],schemaPath:i.nil,topSchemaRef:r,errSchemaPath:s},o);e.mergeEvaluated(a),e.ok(o)}(f)}};function h(e,t){const{gen:s}=e;return t.validate?s.scopeValue("validate",{ref:t.validate}):i._`${s.scopeValue("wrapper",{ref:t})}.validate`}function u(e,t,s,n){const{gen:a,it:c}=e,{allErrors:h,schemaEnv:u,opts:d}=c,m=d.passContext?o.default.this:i.nil;function p(e){const t=i._`${e}.errors`;a.assign(o.default.vErrors,i._`${o.default.vErrors} === null ? ${t} : ${o.default.vErrors}.concat(${t})`),a.assign(o.default.errors,i._`${o.default.vErrors}.length`)}function f(e){var t;if(!c.opts.unevaluated)return;const n=null===(t=null==s?void 0:s.validate)||void 0===t?void 0:t.evaluated;if(!0!==c.props)if(n&&!n.dynamicProps)void 0!==n.props&&(c.props=l.mergeEvaluated.props(a,n.props,c.props));else{const t=a.var("props",i._`${e}.evaluated.props`);c.props=l.mergeEvaluated.props(a,t,c.props,i.Name)}if(!0!==c.items)if(n&&!n.dynamicItems)void 0!==n.items&&(c.items=l.mergeEvaluated.items(a,n.items,c.items));else{const t=a.var("items",i._`${e}.evaluated.items`);c.items=l.mergeEvaluated.items(a,t,c.items,i.Name)}}n?function(){if(!u.$async)throw new Error("async schema referenced by sync schema");const s=a.let("valid");a.try((()=>{a.code(i._`await ${(0,r.callValidateCode)(e,t,m)}`),f(t),h||a.assign(s,!0)}),(e=>{a.if(i._`!(${e} instanceof ${c.ValidationError})`,(()=>a.throw(e))),p(e),h||a.assign(s,!1)})),e.ok(s)}():e.result((0,r.callValidateCode)(e,t,m),(()=>f(t)),(()=>p(t)))}t.getValidate=h,t.callRef=u,t.default=c},1240:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(9306),i=s(5173),o=s(6776),a={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===r.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:s}})=>n._`{error: ${e}, tag: ${s}, tagValue: ${t}}`},code(e){const{gen:t,data:s,schema:a,parentSchema:l,it:c}=e,{oneOf:h}=l;if(!c.opts.discriminator)throw new Error("discriminator: requires discriminator option");const u=a.propertyName;if("string"!=typeof u)throw new Error("discriminator: requires propertyName");if(a.mapping)throw new Error("discriminator: mapping is not supported");if(!h)throw new Error("discriminator: requires oneOf keyword");const d=t.let("valid",!1),m=t.const("tag",n._`${s}${(0,n.getProperty)(u)}`);function p(s){const r=t.name("valid"),i=e.subschema({keyword:"oneOf",schemaProp:s},r);return e.mergeEvaluated(i,n.Name),r}t.if(n._`typeof ${m} == "string"`,(()=>function(){const s=function(){var e;const t={},s=r(l);let n=!0;for(let t=0;t<h.length;t++){let l=h[t];(null==l?void 0:l.$ref)&&!(0,o.schemaHasRulesButRef)(l,c.self.RULES)&&(l=i.resolveRef.call(c.self,c.schemaEnv.root,c.baseId,null==l?void 0:l.$ref),l instanceof i.SchemaEnv&&(l=l.schema));const d=null===(e=null==l?void 0:l.properties)||void 0===e?void 0:e[u];if("object"!=typeof d)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${u}"`);n=n&&(s||r(l)),a(d,t)}if(!n)throw new Error(`discriminator: "${u}" must be required`);return t;function r({required:e}){return Array.isArray(e)&&e.includes(u)}function a(e,t){if(e.const)d(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${u}" must have "const" or "enum"`);for(const s of e.enum)d(s,t)}}function d(e,s){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${u}" values must be unique strings`);t[e]=s}}();t.if(!1);for(const e in s)t.elseIf(n._`${m} === ${e}`),t.assign(d,p(s[e]));t.else(),e.error(!1,{discrError:r.DiscrError.Mapping,tag:m,tagName:u}),t.endIf()}()),(()=>e.error(!1,{discrError:r.DiscrError.Tag,tag:m,tagName:u}))),e.ok(d)}};t.default=a},9306:(e,t)=>{"use strict";var s;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(s=t.DiscrError||(t.DiscrError={})).Tag="tag",s.Mapping="mapping"},7299:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(5684),r=s(2649),i=s(8200),o=s(6121),a=s(1448),l=s(808),c=s(9502),h=s(6167),u=[o.default,n.default,r.default,(0,i.default)(!0),c.default,h.metadataVocabulary,h.contentVocabulary,a.default,l.default];t.default=u},3924:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(5684),r=s(2649),i=s(8200),o=s(9502),a=s(6167),l=[n.default,r.default,(0,i.default)(),o.default,a.metadataVocabulary,a.contentVocabulary];t.default=l},6215:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;const n=s(3487),r=s(2141),i=s(5173),o=s(8280),a={keyword:"$dynamicAnchor",schemaType:"string",code:e=>l(e,e.schema)};function l(e,t){const{gen:s,it:a}=e;a.schemaEnv.root.dynamicAnchors[t]=!0;const l=n._`${r.default.dynamicAnchors}${(0,n.getProperty)(t)}`,c="#"===a.errSchemaPath?a.validateName:function(e){const{schemaEnv:t,schema:s,self:n}=e.it,{root:r,baseId:a,localRefs:l,meta:c}=t.root,{schemaId:h}=n.opts,u=new i.SchemaEnv({schema:s,schemaId:h,root:r,baseId:a,localRefs:l,meta:c});return i.compileSchema.call(n,u),(0,o.getValidate)(e,u)}(e);s.if(n._`!${l}`,(()=>s.assign(l,c)))}t.dynamicAnchor=l,t.default=a},1919:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;const n=s(3487),r=s(2141),i=s(8280),o={keyword:"$dynamicRef",schemaType:"string",code:e=>a(e,e.schema)};function a(e,t){const{gen:s,keyword:o,it:a}=e;if("#"!==t[0])throw new Error(`"${o}" only supports hash fragment reference`);const l=t.slice(1);if(a.allErrors)c();else{const t=s.let("valid",!1);c(t),e.ok(t)}function c(e){if(a.schemaEnv.root.dynamicAnchors[l]){const t=s.let("_v",n._`${r.default.dynamicAnchors}${(0,n.getProperty)(l)}`);s.if(t,h(t,e),h(a.validateName,e))}else h(a.validateName,e)()}function h(t,n){return n?()=>s.block((()=>{(0,i.callRef)(e,t),s.let(n,!0)})):()=>(0,i.callRef)(e,t)}}t.dynamicRef=a,t.default=o},6121:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(6215),r=s(1919),i=s(4094),o=s(3944),a=[n.default,r.default,i.default,o.default];t.default=a},4094:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(6215),r=s(6776),i={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,n.dynamicAnchor)(e,""):(0,r.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}};t.default=i},3944:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(1919),r={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,n.dynamicRef)(e,e.schema)};t.default=r},9651:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>n.str`must match format "${e}"`,params:({schemaCode:e})=>n._`{format: ${e}}`},code(e,t){const{gen:s,data:r,$data:i,schema:o,schemaCode:a,it:l}=e,{opts:c,errSchemaPath:h,schemaEnv:u,self:d}=l;c.validateFormats&&(i?function(){const i=s.scopeValue("formats",{ref:d.formats,code:c.code.formats}),o=s.const("fDef",n._`${i}[${a}]`),l=s.let("fType"),h=s.let("format");s.if(n._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>s.assign(l,n._`${o}.type || "string"`).assign(h,n._`${o}.validate`)),(()=>s.assign(l,n._`"string"`).assign(h,o))),e.fail$data((0,n.or)(!1===c.strictSchema?n.nil:n._`${a} && !${h}`,function(){const e=u.$async?n._`(${o}.async ? await ${h}(${r}) : ${h}(${r}))`:n._`${h}(${r})`,s=n._`(typeof ${h} == "function" ? ${e} : ${h}.test(${r}))`;return n._`${h} && ${h} !== true && ${l} === ${t} && !${s}`}()))}():function(){const i=d.formats[o];if(!i)return void function(){if(!1!==c.strictSchema)throw new Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${h}"`}d.logger.warn(e())}();if(!0===i)return;const[a,l,m]=function(e){const t=e instanceof RegExp?(0,n.regexpCode)(e):c.code.formats?n._`${c.code.formats}${(0,n.getProperty)(o)}`:void 0,r=s.scopeValue("formats",{key:o,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,r]:[e.type||"string",e.validate,n._`${r}.validate`]}(i);a===t&&e.pass(function(){if("object"==typeof i&&!(i instanceof RegExp)&&i.async){if(!u.$async)throw new Error("async format in sync schema");return n._`await ${m}(${r})`}return"function"==typeof l?n._`${m}(${r})`:n._`${m}.test(${r})`}())}())}};t.default=r},9502:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=[s(9651).default];t.default=n},6167:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},1448:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(8921),r=s(7274),i=s(3633),o=[n.default,r.default,i.default];t.default=o},808:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(1782),r=s(4641),i=[n.default,r.default];t.default=i},4641:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:e}})=>n.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>n._`{limit: ${e}}`},code(e){const{gen:t,schema:s,data:i,it:o}=e,a=o.items||0;if(!0===a)return;const l=t.const("len",n._`${i}.length`);if(!1===s)e.setParams({len:a}),e.fail(n._`${l} > ${a}`);else if("object"==typeof s&&!(0,r.alwaysValidSchema)(o,s)){const s=t.var("valid",n._`${l} <= ${a}`);t.if((0,n.not)(s),(()=>function(s,i){t.forRange("i",i,l,(i=>{e.subschema({keyword:"unevaluatedItems",dataProp:i,dataPropType:r.Type.Num},s),o.allErrors||t.if((0,n.not)(s),(()=>t.break()))}))}(s,a))),e.ok(s)}o.items=!0}};t.default=i},1782:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i=s(2141),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:e})=>n._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){const{gen:t,schema:s,data:o,errsCount:a,it:l}=e;if(!a)throw new Error("ajv implementation error");const{allErrors:c,props:h}=l;function u(i){if(!1===s)return e.setParams({unevaluatedProperty:i}),e.error(),void(c||t.break());if(!(0,r.alwaysValidSchema)(l,s)){const s=t.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:i,dataPropType:r.Type.Str},s),c||t.if((0,n.not)(s),(()=>t.break()))}}h instanceof n.Name?t.if(n._`${h} !== true`,(()=>t.forIn("key",o,(e=>t.if(function(e,t){return n._`!${e} || !${e}[${t}]`}(h,e),(()=>u(e))))))):!0!==h&&t.forIn("key",o,(e=>void 0===h?u(e):t.if(function(e,t){const s=[];for(const r in e)!0===e[r]&&s.push(n._`${t} !== ${r}`);return(0,n.and)(...s)}(h,e),(()=>u(e))))),l.props=!0,e.ok(n._`${a} === ${i.default.errors}`)}};t.default=o},4693:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i=s(3510),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>n._`{allowedValue: ${e}}`},code(e){const{gen:t,data:s,$data:o,schemaCode:a,schema:l}=e;o||l&&"object"==typeof l?e.fail$data(n._`!${(0,r.useFunc)(t,i.default)}(${s}, ${a})`):e.fail(n._`${l} !== ${s}`)}};t.default=o},8921:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(7772),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:n.error,code:e=>(0,n.validatePropertyDeps)(e)};t.default=r},966:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i=s(3510),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>n._`{allowedValues: ${e}}`},code(e){const{gen:t,data:s,$data:o,schema:a,schemaCode:l,it:c}=e;if(!o&&0===a.length)throw new Error("enum must have non-empty array");const h=a.length>=c.opts.loopEnum;let u;const d=()=>null!=u?u:u=(0,r.useFunc)(t,i.default);let m;if(h||o)m=t.let("valid"),e.block$data(m,(function(){t.assign(m,!1),t.forOf("v",l,(e=>t.if(n._`${d()}(${s}, ${e})`,(()=>t.assign(m,!0).break()))))}));else{if(!Array.isArray(a))throw new Error("ajv implementation error");const e=t.const("vSchema",l);m=(0,n.or)(...a.map(((t,r)=>function(e,t){const r=a[t];return"object"==typeof r&&null!==r?n._`${d()}(${s}, ${e}[${t}])`:n._`${s} === ${r}`}(e,r))))}e.pass(m)}};t.default=o},2649:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3983),r=s(430),i=s(3229),o=s(4336),a=s(498),l=s(3301),c=s(1687),h=s(2958),u=s(4693),d=s(966),m=[n.default,r.default,i.default,o.default,a.default,l.default,c.default,h.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default];t.default=m},3633:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(6776),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:s}){void 0===t.contains&&(0,n.checkStrictMode)(s,`"${e}" without "contains" is ignored`)}};t.default=r},1687:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const s="maxItems"===e?"more":"fewer";return n.str`must NOT have ${s} than ${t} items`},params:({schemaCode:e})=>n._`{limit: ${e}}`},code(e){const{keyword:t,data:s,schemaCode:r}=e,i="maxItems"===t?n.operators.GT:n.operators.LT;e.fail$data(n._`${s}.length ${i} ${r}`)}};t.default=r},3229:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i=s(4499),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const s="maxLength"===e?"more":"fewer";return n.str`must NOT have ${s} than ${t} characters`},params:({schemaCode:e})=>n._`{limit: ${e}}`},code(e){const{keyword:t,data:s,schemaCode:o,it:a}=e,l="maxLength"===t?n.operators.GT:n.operators.LT,c=!1===a.opts.unicode?n._`${s}.length`:n._`${(0,r.useFunc)(e.gen,i.default)}(${s})`;e.fail$data(n._`${c} ${l} ${o}`)}};t.default=o},3983:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=n.operators,i={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},o={message:({keyword:e,schemaCode:t})=>n.str`must be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>n._`{comparison: ${i[e].okStr}, limit: ${t}}`},a={keyword:Object.keys(i),type:"number",schemaType:"number",$data:!0,error:o,code(e){const{keyword:t,data:s,schemaCode:r}=e;e.fail$data(n._`${s} ${i[t].fail} ${r} || isNaN(${s})`)}};t.default=a},498:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const s="maxProperties"===e?"more":"fewer";return n.str`must NOT have ${s} than ${t} properties`},params:({schemaCode:e})=>n._`{limit: ${e}}`},code(e){const{keyword:t,data:s,schemaCode:r}=e,i="maxProperties"===t?n.operators.GT:n.operators.LT;e.fail$data(n._`Object.keys(${s}).length ${i} ${r}`)}};t.default=r},430:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>n.str`must be multiple of ${e}`,params:({schemaCode:e})=>n._`{multipleOf: ${e}}`},code(e){const{gen:t,data:s,schemaCode:r,it:i}=e,o=i.opts.multipleOfPrecision,a=t.let("res"),l=o?n._`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:n._`${a} !== parseInt(${a})`;e.fail$data(n._`(${r} === 0 || (${a} = ${s}/${r}, ${l}))`)}};t.default=r},4336:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(412),r=s(3487),i={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>r.str`must match pattern "${e}"`,params:({schemaCode:e})=>r._`{pattern: ${e}}`},code(e){const{data:t,$data:s,schema:i,schemaCode:o,it:a}=e,l=a.opts.unicodeRegExp?"u":"",c=s?r._`(new RegExp(${o}, ${l}))`:(0,n.usePattern)(e,i);e.fail$data(r._`!${c}.test(${t})`)}};t.default=i},3301:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(412),r=s(3487),i=s(6776),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>r.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>r._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:s,schemaCode:o,data:a,$data:l,it:c}=e,{opts:h}=c;if(!l&&0===s.length)return;const u=s.length>=h.loopRequired;if(c.allErrors?function(){if(u||l)e.block$data(r.nil,d);else for(const t of s)(0,n.checkReportMissingProp)(e,t)}():function(){const i=t.let("missing");if(u||l){const s=t.let("valid",!0);e.block$data(s,(()=>function(s,i){e.setParams({missingProperty:s}),t.forOf(s,o,(()=>{t.assign(i,(0,n.propertyInData)(t,a,s,h.ownProperties)),t.if((0,r.not)(i),(()=>{e.error(),t.break()}))}),r.nil)}(i,s))),e.ok(s)}else t.if((0,n.checkMissingProp)(e,s,i)),(0,n.reportMissingProp)(e,i),t.else()}(),h.strictRequired){const t=e.parentSchema.properties,{definedProperties:n}=e.it;for(const e of s)if(void 0===(null==t?void 0:t[e])&&!n.has(e)){const t=`required property "${e}" is not defined at "${c.schemaEnv.baseId+c.errSchemaPath}" (strictRequired)`;(0,i.checkStrictMode)(c,t,c.opts.strictRequired)}}function d(){t.forOf("prop",o,(s=>{e.setParams({missingProperty:s}),t.if((0,n.noPropertyInData)(t,a,s,h.ownProperties),(()=>e.error()))}))}}};t.default=o},2958:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(453),r=s(3487),i=s(6776),o=s(3510),a={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>r.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>r._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:s,$data:a,schema:l,parentSchema:c,schemaCode:h,it:u}=e;if(!a&&!l)return;const d=t.let("valid"),m=c.items?(0,n.getSchemaTypes)(c.items):[];function p(i,o){const a=t.name("item"),l=(0,n.checkDataTypes)(m,a,u.opts.strictNumbers,n.DataType.Wrong),c=t.const("indices",r._`{}`);t.for(r._`;${i}--;`,(()=>{t.let(a,r._`${s}[${i}]`),t.if(l,r._`continue`),m.length>1&&t.if(r._`typeof ${a} == "string"`,r._`${a} += "_"`),t.if(r._`typeof ${c}[${a}] == "number"`,(()=>{t.assign(o,r._`${c}[${a}]`),e.error(),t.assign(d,!1).break()})).code(r._`${c}[${a}] = ${i}`)}))}function f(n,a){const l=(0,i.useFunc)(t,o.default),c=t.name("outer");t.label(c).for(r._`;${n}--;`,(()=>t.for(r._`${a} = ${n}; ${a}--;`,(()=>t.if(r._`${l}(${s}[${n}], ${s}[${a}])`,(()=>{e.error(),t.assign(d,!1).break(c)}))))))}e.block$data(d,(function(){const n=t.let("i",r._`${s}.length`),i=t.let("j");e.setParams({i:n,j:i}),t.assign(d,!0),t.if(r._`${n} > 1`,(()=>(m.length>0&&!m.some((e=>"object"===e||"array"===e))?p:f)(n,i)))}),r._`${h} === false`),e.ok(d)}};t.default=a},5362:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});var n=s(7537),r=s.n(n),i=s(3645),o=s.n(i)()(r());o.push([e.id,".macromolecule-cell-comp-analysis-host{\n max-height: 250px;\n overflow-y: scroll;\n}\n\n.macromolecule-cell-comp-analysis-bar{\n height: inherit;\n display: block;\n margin-top: 1.5px;\n margin-bottom: 1.5px;\n margin-right: 3px;\n}\n\n.macromolecule-cell-comp-analysis-value{\n display: flex;\n}","",{version:3,sources:["webpack://./css/composition-analysis.css"],names:[],mappings:"AAAA;IACI,iBAAiB;IACjB,kBAAkB;AACtB;;AAEA;IACI,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,oBAAoB;IACpB,iBAAiB;AACrB;;AAEA;IACI,aAAa;AACjB",sourcesContent:[".macromolecule-cell-comp-analysis-host{\n max-height: 250px;\n overflow-y: scroll;\n}\n\n.macromolecule-cell-comp-analysis-bar{\n height: inherit;\n display: block;\n margin-top: 1.5px;\n margin-bottom: 1.5px;\n margin-right: 3px;\n}\n\n.macromolecule-cell-comp-analysis-value{\n display: flex;\n}"],sourceRoot:""}]);const a=o},9564:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});var n=s(7537),r=s.n(n),i=s(3645),o=s.n(i)()(r());o.push([e.id,".kalign-version {\n margin-bottom: 0;\n text-align: end;\n font-size: 12px;\n opacity: 0.8;\n}\nbutton.msa-params-button.ui-btn {\n justify-content: end;\n}","",{version:3,sources:["webpack://./css/msa.css"],names:[],mappings:"AAAA;IACI,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,YAAY;AAChB;AACA;IACI,oBAAoB;AACxB",sourcesContent:[".kalign-version {\n margin-bottom: 0;\n text-align: end;\n font-size: 12px;\n opacity: 0.8;\n}\nbutton.msa-params-button.ui-btn {\n justify-content: end;\n}"],sourceRoot:""}]);const a=o},9414:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});var n=s(7537),r=s.n(n),i=s(3645),o=s.n(i)()(r());o.push([e.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},8710:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});var n=s(7537),r=s.n(n),i=s(3645),o=s.n(i)()(r());o.push([e.id,".monomer-lib-controls-form {\n margin-left: auto;\n margin-right: auto;\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n}\n","",{version:3,sources:["webpack://./src/utils/monomer-lib/library-file-manager/style.css"],names:[],mappings:"AAAA;EACE,iBAAiB;EACjB,kBAAkB;EAClB,aAAa;EACb,sBAAsB;EACtB,mBAAmB;EACnB,WAAW;AACb",sourcesContent:[".monomer-lib-controls-form {\n margin-left: auto;\n margin-right: auto;\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n}\n"],sourceRoot:""}]);const a=o},3645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var s="",n=void 0!==t[5];return t[4]&&(s+="@supports (".concat(t[4],") {")),t[2]&&(s+="@media ".concat(t[2]," {")),n&&(s+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),s+=e(t),n&&(s+="}"),t[2]&&(s+="}"),t[4]&&(s+="}"),s})).join("")},t.i=function(e,s,n,r,i){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(n)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(o[l]=!0)}for(var c=0;c<e.length;c++){var h=[].concat(e[c]);n&&o[h[0]]||(void 0!==i&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=i),s&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=s):h[2]=s),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),t.push(h))}},t}},7537:e=>{"use strict";e.exports=function(e){var t=e[1],s=e[3];if(!s)return t;if("function"==typeof btoa){var n=btoa(unescape(encodeURIComponent(JSON.stringify(s)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(n),i="/*# ".concat(r," */");return[t].concat([i]).join("\n")}return[t].join("\n")}},4063:e=>{"use strict";e.exports=function e(t,s){if(t===s)return!0;if(t&&s&&"object"==typeof t&&"object"==typeof s){if(t.constructor!==s.constructor)return!1;var n,r,i;if(Array.isArray(t)){if((n=t.length)!=s.length)return!1;for(r=n;0!=r--;)if(!e(t[r],s[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(s).length)return!1;for(r=n;0!=r--;)if(!Object.prototype.hasOwnProperty.call(s,i[r]))return!1;for(r=n;0!=r--;){var o=i[r];if(!e(t[o],s[o]))return!1}return!0}return t!=t&&s!=s}},9133:function(e,t,s){var n;!function(t,r){var i={};!function(e){"use strict";e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=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 s(e,s,n,r,i){for(var o,a,l,c,h,u,d,m,p,f,g,y,w;i>=64;){for(o=s[0],a=s[1],l=s[2],c=s[3],h=s[4],u=s[5],d=s[6],m=s[7],f=0;f<16;f++)g=r+4*f,e[f]=(255&n[g])<<24|(255&n[g+1])<<16|(255&n[g+2])<<8|255&n[g+3];for(f=16;f<64;f++)y=((p=e[f-2])>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,w=((p=e[f-15])>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,e[f]=(y+e[f-7]|0)+(w+e[f-16]|0);for(f=0;f<64;f++)y=(((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&u^~h&d)|0)+(m+(t[f]+e[f]|0)|0)|0,w=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&a^o&l^a&l)|0,m=d,d=u,u=h,h=c+y|0,c=l,l=a,a=o,o=y+w|0;s[0]+=o,s[1]+=a,s[2]+=l,s[3]+=c,s[4]+=h,s[5]+=u,s[6]+=d,s[7]+=m,r+=64,i-=64}return r}var n=function(){function t(){this.digestLength=e.digestLength,this.blockSize=e.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 t.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},t.prototype.clean=function(){for(var e=0;e<this.buffer.length;e++)this.buffer[e]=0;for(e=0;e<this.temp.length;e++)this.temp[e]=0;this.reset()},t.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this.bytesHashed+=t,this.bufferLength>0){for(;this.bufferLength<64&&t>0;)this.buffer[this.bufferLength++]=e[n++],t--;64===this.bufferLength&&(s(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(t>=64&&(n=s(this.temp,this.state,e,n,t),t%=64);t>0;)this.buffer[this.bufferLength++]=e[n++],t--;return this},t.prototype.finish=function(e){if(!this.finished){var t=this.bytesHashed,n=this.bufferLength,r=t/536870912|0,i=t<<3,o=t%64<56?64:128;this.buffer[n]=128;for(var a=n+1;a<o-8;a++)this.buffer[a]=0;this.buffer[o-8]=r>>>24&255,this.buffer[o-7]=r>>>16&255,this.buffer[o-6]=r>>>8&255,this.buffer[o-5]=r>>>0&255,this.buffer[o-4]=i>>>24&255,this.buffer[o-3]=i>>>16&255,this.buffer[o-2]=i>>>8&255,this.buffer[o-1]=i>>>0&255,s(this.temp,this.state,this.buffer,0,o),this.finished=!0}for(a=0;a<8;a++)e[4*a+0]=this.state[a]>>>24&255,e[4*a+1]=this.state[a]>>>16&255,e[4*a+2]=this.state[a]>>>8&255,e[4*a+3]=this.state[a]>>>0&255;return this},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype._saveState=function(e){for(var t=0;t<this.state.length;t++)e[t]=this.state[t]},t.prototype._restoreState=function(e,t){for(var s=0;s<this.state.length;s++)this.state[s]=e[s];this.bytesHashed=t,this.finished=!1,this.bufferLength=0},t}();e.Hash=n;var r=function(){function e(e){this.inner=new n,this.outer=new n,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var t=new Uint8Array(this.blockSize);if(e.length>this.blockSize)(new n).update(e).finish(t).clean();else for(var s=0;s<e.length;s++)t[s]=e[s];for(s=0;s<t.length;s++)t[s]^=54;for(this.inner.update(t),s=0;s<t.length;s++)t[s]^=106;for(this.outer.update(t),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate),s=0;s<t.length;s++)t[s]=0}return e.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},e.prototype.clean=function(){for(var e=0;e<this.istate.length;e++)this.ostate[e]=this.istate[e]=0;this.inner.clean(),this.outer.clean()},e.prototype.update=function(e){return this.inner.update(e),this},e.prototype.finish=function(e){return this.outer.finished?this.outer.finish(e):(this.inner.finish(e),this.outer.update(e,this.digestLength).finish(e)),this},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e}();function i(e){var t=(new n).update(e),s=t.digest();return t.clean(),s}function o(e,t){var s=new r(e).update(t),n=s.digest();return s.clean(),n}function a(e,t,s,n){var r=n[0];if(0===r)throw new Error("hkdf: cannot expand more");t.reset(),r>1&&t.update(e),s&&t.update(s),t.update(n),t.finish(e),n[0]++}e.HMAC=r,e.hash=i,e.default=i,e.hmac=o;var l=new Uint8Array(e.digestLength);e.hkdf=function(e,t,s,n){void 0===t&&(t=l),void 0===n&&(n=32);for(var i=new Uint8Array([1]),c=o(t,e),h=new r(c),u=new Uint8Array(h.digestLength),d=u.length,m=new Uint8Array(n),p=0;p<n;p++)d===u.length&&(a(u,h,s,i),d=0),m[p]=u[d++];return h.clean(),u.fill(0),i.fill(0),m},e.pbkdf2=function(e,t,s,n){for(var i=new r(e),o=i.digestLength,a=new Uint8Array(4),l=new Uint8Array(o),c=new Uint8Array(o),h=new Uint8Array(n),u=0;u*o<n;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,i.reset(),i.update(t),i.update(a),i.finish(c);for(var m=0;m<o;m++)l[m]=c[m];for(m=2;m<=s;m++){i.reset(),i.update(c).finish(c);for(var p=0;p<o;p++)l[p]^=c[p]}for(m=0;m<o&&u*o+m<n;m++)h[u*o+m]=l[m]}for(u=0;u<o;u++)l[u]=c[u]=0;for(u=0;u<4;u++)a[u]=0;return i.clean(),h}}(i);var o=i.default;for(var a in i)o[a]=i[a];"object"==typeof e.exports?e.exports=o:void 0===(n=function(){return o}.call(i,s,i,e))||(e.exports=n)}()},1811:(e,t,s)=>{"use strict";s.d(t,{T:()=>r});const n=new Uint32Array(65536),r=(e,t)=>{if(e.length<t.length){const s=t;t=e,e=s}return 0===t.length?e.length:e.length<=32?((e,t)=>{const s=e.length,r=t.length,i=1<<s-1;let o=-1,a=0,l=s,c=s;for(;c--;)n[e.charCodeAt(c)]|=1<<c;for(c=0;c<r;c++){let e=n[t.charCodeAt(c)];const s=e|a;e|=(e&o)+o^o,a|=~(e|o),o&=e,a&i&&l++,o&i&&l--,a=a<<1|1,o=o<<1|~(s|a),a&=s}for(c=s;c--;)n[e.charCodeAt(c)]=0;return l})(e,t):((e,t)=>{const s=t.length,r=e.length,i=[],o=[],a=Math.ceil(s/32),l=Math.ceil(r/32);for(let e=0;e<a;e++)o[e]=-1,i[e]=0;let c=0;for(;c<l-1;c++){let a=0,l=-1;const h=32*c,u=Math.min(32,r)+h;for(let t=h;t<u;t++)n[e.charCodeAt(t)]|=1<<t;for(let e=0;e<s;e++){const s=n[t.charCodeAt(e)],r=o[e/32|0]>>>e&1,c=i[e/32|0]>>>e&1,h=s|a,u=((s|c)&l)+l^l|s|c;let d=a|~(u|l),m=l&u;d>>>31^r&&(o[e/32|0]^=1<<e),m>>>31^c&&(i[e/32|0]^=1<<e),d=d<<1|r,m=m<<1|c,l=m|~(h|d),a=d&h}for(let t=h;t<u;t++)n[e.charCodeAt(t)]=0}let h=0,u=-1;const d=32*c,m=Math.min(32,r-d)+d;for(let t=d;t<m;t++)n[e.charCodeAt(t)]|=1<<t;let p=r;for(let e=0;e<s;e++){const s=n[t.charCodeAt(e)],a=o[e/32|0]>>>e&1,l=i[e/32|0]>>>e&1,c=s|h,d=((s|l)&u)+u^u|s|l;let m=h|~(d|u),f=u&d;p+=m>>>r-1&1,p-=f>>>r-1&1,m>>>31^a&&(o[e/32|0]^=1<<e),f>>>31^l&&(i[e/32|0]^=1<<e),m=m<<1|a,f=f<<1|l,u=f|~(c|m),h=m&c}for(let t=d;t<m;t++)n[e.charCodeAt(t)]=0;return p})(e,t)}},3979:(e,t)=>{"use strict";t.H$=void 0,t.H$=function(e,t,s){var n=function(e,t,s){if(0===e.length||0===t.length)return 0;if(s&&!s.caseSensitive&&(e=e.toUpperCase(),t=t.toUpperCase()),e===t)return 1;for(var n=0,r=e.length,i=t.length,o=Math.floor(Math.max(r,i)/2)-1,a=new Array(r),l=new Array(i),c=0;c<r;c++)for(var h=Math.max(0,c-o);h<=Math.min(i,c+o+1);h++)if(!a[c]&&!l[h]&&e[c]===t[h]){++n,a[c]=l[h]=!0;break}if(0===n)return 0;var u=0,d=0;for(c=0;c<r;c++)if(a[c]){for(;!l[d];)d++;e.charAt(c)!==t.charAt(d++)&&u++}return(n/r+n/i+(n-(u/=2))/n)/3}(e,t,s),r=0;if(n>.7){for(var i=Math.min(e.length,t.length),o=0;e[o]===t[o]&&o<4&&o<i;)++r,o++;n+=.1*r*(1-n)}return n}},9461:e=>{"use strict";var t=e.exports=function(e,t,n){"function"==typeof t&&(n=t,t={}),s(t,"function"==typeof(n=t.cb||n)?n:n.pre||function(){},n.post||function(){},e,"",e)};function s(e,n,r,i,o,a,l,c,h,u){if(i&&"object"==typeof i&&!Array.isArray(i)){for(var d in n(i,o,a,l,c,h,u),i){var m=i[d];if(Array.isArray(m)){if(d in t.arrayKeywords)for(var p=0;p<m.length;p++)s(e,n,r,m[p],o+"/"+d+"/"+p,a,o,d,i,p)}else if(d in t.propsKeywords){if(m&&"object"==typeof m)for(var f in m)s(e,n,r,m[f],o+"/"+d+"/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),a,o,d,i,f)}else(d in t.keywords||e.allKeys&&!(d in t.skipKeywords))&&s(e,n,r,m,o+"/"+d,a,o,d,i)}r(i,o,a,l,c,h,u)}}t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}},3379:e=>{"use strict";var t=[];function s(e){for(var s=-1,n=0;n<t.length;n++)if(t[n].identifier===e){s=n;break}return s}function n(e,n){for(var i={},o=[],a=0;a<e.length;a++){var l=e[a],c=n.base?l[0]+n.base:l[0],h=i[c]||0,u="".concat(c," ").concat(h);i[c]=h+1;var d=s(u),m={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)t[d].references++,t[d].updater(m);else{var p=r(m,n);n.byIndex=a,t.splice(a,0,{identifier:u,updater:p,references:1})}o.push(u)}return o}function r(e,t){var s=t.domAPI(t);return s.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;s.update(e=t)}else s.remove()}}e.exports=function(e,r){var i=n(e=e||[],r=r||{});return function(e){e=e||[];for(var o=0;o<i.length;o++){var a=s(i[o]);t[a].references--}for(var l=n(e,r),c=0;c<i.length;c++){var h=s(i[c]);0===t[h].references&&(t[h].updater(),t.splice(h,1))}i=l}}},569:e=>{"use strict";var t={};e.exports=function(e,s){var n=function(e){if(void 0===t[e]){var s=document.querySelector(e);if(window.HTMLIFrameElement&&s instanceof window.HTMLIFrameElement)try{s=s.contentDocument.head}catch(e){s=null}t[e]=s}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(s)}},9216:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},3565:(e,t,s)=>{"use strict";e.exports=function(e){var t=s.nc;t&&e.setAttribute("nonce",t)}},7795:e=>{"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(s){!function(e,t,s){var n="";s.supports&&(n+="@supports (".concat(s.supports,") {")),s.media&&(n+="@media ".concat(s.media," {"));var r=void 0!==s.layer;r&&(n+="@layer".concat(s.layer.length>0?" ".concat(s.layer):""," {")),n+=s.css,r&&(n+="}"),s.media&&(n+="}"),s.supports&&(n+="}");var i=s.sourceMap;i&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(n,e,t.options)}(t,e,s)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},4589:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},7241:(e,t,s)=>{"use strict";s.d(t,{D:()=>h});var n=s(4469),r=s(976),i=s(6414),o=s.n(i),a=s(2265),l=s(499);const c=31;async function h(e,t=!1,s){const i=l.Cn.getOrCreate(e);let h;s??(s=new Map);const d=i.isHelm()?(0,a.getHelmMonomers)(e):Object.keys(i.stats.freq).filter((e=>""!==e));for(let e=0;e<d.length;e++)s.has(d[e])||s.set(d[e],`${s.size+1}`);if(i.isHelm())h=await n.functions.call("HELM:getMolFiles",{col:e}),h=function(e,t,s=!1){const n=new Array(e.length);for(let r=0;r<e.length;r++){let i=0,o=0,a="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";const l=e.get(r);i=l.indexOf("\n",i)+1,i=l.indexOf("\n",i)+1,i=l.indexOf("\n",i)+1;const h=parseInt(l.substring(i,i+3)),u=parseInt(l.substring(i+3,i+6));a+=`M V30 COUNTS ${h} ${u} 0 0 0\n`,a+="M V30 BEGIN ATOM\n";for(let e=0;e<h;e++){i=l.indexOf("\n",i)+1+c,o=l.indexOf(" ",i);const n=l.substring(i,o);a+=s?`M V30 ${e+1} R${t.get(n)} 0.000 0.000 0 0\n`:`M V30 ${e+1} At 0.000 0.000 0 0 MASS=${t.get(n)}\n`}a+="M V30 END ATOM\n",a+="M V30 BEGIN BOND\n";for(let e=0;e<u;e++){i=l.indexOf("\n",i)+1;const t=parseInt(l.substring(i,i+3).trim()),s=parseInt(l.substring(i+3,i+6).trim());a+=`M V30 ${e+1} ${parseInt(l.substring(i+6,i+9).trim())} ${t} ${s}\n`}a+="M V30 END BOND\n",a+="M V30 END CTAB\n",a+="M END",n[r]=a}return n}(h,s,t);else{h=new Array(e.length);for(let n=0;n<e.length;n++){const e=u(o()(i.splitted[n]).filter((e=>""!==e)).toArray(),s,t);h[n]=e}}return r.Column.fromStrings("monomericMols",h)}function u(e,t,s=!1){let n="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";n+=`M V30 COUNTS ${e.length} ${e.length?e.length-1:0} 0 0 0\n`,n+="M V30 BEGIN ATOM\n";for(let r=0;r<e.length;r++)n+=s?`M V30 ${r+1} R${t.get(e[r])} 0.000 0.000 0 0\n`:`M V30 ${r+1} At 0.000 0.000 0 0 MASS=${t.get(e[r])}\n`;n+="M V30 END ATOM\n",n+="M V30 BEGIN BOND\n";for(let t=0;t<e.length-1;t++)n+=`M V30 ${t+1} 1 ${t+1} ${t+2}\n`;return n+="M V30 END BOND\n",n+="M V30 END CTAB\n",n+="M END",n}},2265:(e,t,s)=>{"use strict";s.d(t,{_package:()=>rt,activityCliffs:()=>at,getBioLib:()=>ot,getHelmMonomers:()=>ut,getMonomerLibHelper:()=>it,importFasta:()=>ht,sequenceIdentityScoring:()=>dt,sequenceSimilarityScoring:()=>mt,sequenceSpaceTopMenu:()=>lt,toAtomicLevel:()=>ct});var n,r,i=s(4469),o=s(3870),a=s(976),l=s(4628);(r=n||(n={})).EUCLIDEAN="EUCLIDEAN",r.MANHATTAN="MANHATTAN";const c="MCL";a.SEMTYPE.MOLECULE,a.SEMTYPE.MACROMOLECULE;const h=rxjs.operators;s(5697);var u=s(701),d=s(3379),m=s.n(d),p=s(7795),f=s.n(p),g=s(569),y=s.n(g),w=s(3565),b=s.n(w),C=s(9216),v=s.n(C),T=s(4589),A=s.n(T),S=s(9414),_={};_.styleTagTransform=A(),_.setAttributes=b(),_.insert=y().bind(null,"head"),_.domAPI=f(),_.insertStyleElement=v(),m()(S.Z,_),S.Z&&S.Z.locals&&S.Z.locals;const E=e=>null==e;function P(e,t,s,n){if(s>e[e.length-1])return;const r=e.findIndex((e=>s<e));e.pop(),e.splice(r,0,s),t.pop(),t.splice(r,0,n)}class ${_workerCount;constructor(){this._workerCount=Math.max(navigator.hardwareConcurrency-2,1)}async calcMultiColumn(e,t,r,i=[{}],o=[1],a=n.EUCLIDEAN){const l=e[0].length*(e[0].length-1)/2,c=Math.floor(l/this._workerCount),h=e[0].length>2e4?await this.getMinimalThreshold(e,t,i,o,a):0;r<h&&(console.log(`using threshold ${h}`),r=h),i.forEach(((e,t)=>i[t].threshold=r));const u=new Array(this._workerCount),d=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(s.p+s.u(23),s.b))));for(let s=0;s<this._workerCount;s++)u[s]=new Promise(((n,h)=>{const u=s*c,m=s===this._workerCount-1?l:(s+1)*c;m<=u&&n({i:new Int32Array(0),j:new Int32Array(0),distance:new Float32Array(0),idx:s}),d[s].postMessage({values:e,startIdx:u,endIdx:m,threshold:r,fnNames:t,opts:i,weights:o,aggregationMethod:a}),d[s].onmessage=({data:{error:e,i:t,j:r,distance:i}})=>{e?(d[s].terminate(),h(e)):(d[s].terminate(),n({i:t,j:r,distance:i,idx:s}))}}));const m=await Promise.all(u),p=m.reduce(((e,t)=>e+t.i.length),0),f=new Int32Array(p),g=new Int32Array(p),y=new Float32Array(p);let w=0;for(const e of m)f.set(e.i,w),g.set(e.j,w),y.set(e.distance,w),w+=e.i.length;return{i:f,j:g,distance:y}}async calc(e,t,s,n={}){return await this.calcMultiColumn([e],[t],s,[n],[1])}async getKNN(e,t,s=15,n={}){return await this.multiColumnKNN([e],[t],s,[n],[1])}async getThresholdKNN(e,t,s=.8,n={}){return await this.multiColumnThresholdKnn([e],[t],s,[n],[1])}async multiColumnThresholdKnn(e,t,r=.8,i,o,a=n.EUCLIDEAN){if(e.length!==t.length||e.length!==i.length||e.length!==o.length)throw new Error("values, distance functions, options and weights arrays should have the same length");if(e.some((t=>t.length!==e[0].length)))throw new Error("all values arrays should have the same length");const l=e[0].length*(e[0].length-1)/2,c=Math.floor(l/this._workerCount),h=new Array(this._workerCount),u=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(s.p+s.u(427),s.b))));for(let s=0;s<this._workerCount;s++)h[s]=new Promise(((n,h)=>{const d=s*c,m=s===this._workerCount-1?l:(s+1)*c;m<=d&&n({knnDistances:new Array(0),knnIndexes:new Array(0)}),u[s].postMessage({values:e,startIdx:d,endIdx:m,fnNames:t,opts:i,threshold:r,weights:o,aggregationMethod:a}),u[s].onmessage=({data:{error:e,knnDistances:t,knnIndexes:r}})=>{e?(u[s].terminate(),h(e)):(u[s].terminate(),n({knnDistances:t,knnIndexes:r}))}}));const d=await Promise.all(h),m=new Int32Array(e[0].length);for(const t of d)for(let s=0;s<e[0].length;++s)m[s]+=t.knnIndexes[s]?.length??0;const p={knnDistances:new Array(e[0].length).fill(null).map(((e,t)=>new Array(m[t]))),knnIndexes:new Array(e[0].length).fill(null).map(((e,t)=>new Array(m[t])))};for(const t of d)for(let s=0;s<e[0].length;++s)for(let e=0;e<t.knnDistances[s]?.length;++e)p.knnDistances[s][m[s]-1]=t.knnDistances[s][e],p.knnIndexes[s][m[s]-1]=t.knnIndexes[s][e],m[s]-=1;return p}async multiColumnKNN(e,t,r=15,i,o,a=n.EUCLIDEAN){if(e.length!==t.length||e.length!==i.length||e.length!==o.length)throw new Error("values, distance functions, options and weights arrays should have the same length");if(e.some((t=>t.length!==e[0].length)))throw new Error("all values arrays should have the same length");const l=e[0].length*(e[0].length-1)/2,c=Math.floor(l/this._workerCount),h=new Array(this._workerCount),u=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(s.p+s.u(282),s.b))));for(let s=0;s<this._workerCount;s++)h[s]=new Promise(((n,h)=>{const d=s*c,m=s===this._workerCount-1?l:(s+1)*c;m<=d&&n({knnDistances:new Array(0),knnIndexes:new Array(0)}),u[s].postMessage({values:e,startIdx:d,endIdx:m,fnNames:t,opts:i,nNeighbours:r,weights:o,aggregationMethod:a}),u[s].onmessage=({data:{error:e,knnDistances:t,knnIndexes:r}})=>{e?(u[s].terminate(),h(e)):(u[s].terminate(),n({knnDistances:t,knnIndexes:r}))}}));const d=await Promise.all(h),m={knnDistances:new Array(e[0].length).fill(null).map((()=>new Array(r).fill(99999))),knnIndexes:new Array(e[0].length).fill(null).map((()=>new Array(r).fill(-1)))};for(const t of d)for(let s=0;s<e[0].length;++s)for(let e=0;e<t.knnDistances[s]?.length;++e)P(m.knnDistances[s],m.knnIndexes[s],t.knnDistances[s][e],t.knnIndexes[s][e]);return m}async getSampleDistances(e,t,r=[],i,o=n.EUCLIDEAN){const a=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(s.p+s.u(40),s.b))));try{const s=e[0].length*(e[0].length-1)/2,n=Math.floor(s/this._workerCount),l=1e6,c=Math.max(Math.min(s/1e3,l),Math.min(s,l)),h=Math.floor(c/this._workerCount),u=new Array(this._workerCount);for(let l=0;l<this._workerCount;l++)u[l]=new Promise(((c,u)=>{const d=l*n,m=l===this._workerCount-1?s:(l+1)*n;a[l].postMessage({values:e,startIdx:d,endIdx:m,sampleLength:h,fnNames:t,opts:r,weights:i,aggregationMethod:o}),a[l].onmessage=({data:{error:e,distance:t}})=>{a[l].terminate(),e?u(e):c({distance:t})}}));const d=await Promise.all(u),m=d.reduce(((e,t)=>e+t.distance.length),0),p=new Float32Array(m);let f=0;for(const e of d)p.set(e.distance,f),f+=e.distance.length;return p.sort(),p}catch(e){return a?.forEach((e=>e?.terminate())),console.error(e),new Float32Array(1).fill(.5)}}async getMinimalThreshold(e,t,s=[],r,i=n.EUCLIDEAN){try{const n=e.length*(e.length-1)/2,o=await this.getSampleDistances(e,t,s,r,i);return 1-o[Math.floor(7e7/n*o.length)]}catch(e){return console.error(e),.5}}static calcSync(e,t,s,n){const r=[],i=[],o=[];let a=0,l=0,c=0;const h=e.length*(e.length-1)/2;for(;a<h;){const t=E(e[l])||E(e[c])?1:s(e[l],e[c]);1-t>=n&&(r.push(l),i.push(c),o.push(t)),a++,c++,c===e.length&&(l++,c=l+1)}return{i:new Int32Array(r),j:new Int32Array(i),distance:new Float32Array(o)}}}var x,N=s(9657);!function(e){e.none="none",e.bold="bold",e.dashed="dashed"}(x||(x={}));class M{get currentLineId(){return this._currentLineIdx}set currentLineId(e){e!==this._currentLineIdx&&(this._currentLineIdx=e,this.sp.render(this.ctx))}set linesToRender(e){this.updateLines(e),this.sp.render(this.ctx)}set linesVisibility(e){this.visibility=e,this.sp.render(this.ctx)}constructor(e,t,s,n,r=x.none){var i;this._currentLineIdx=-1,this.lineClicked=new u.Subject,this.lineHover=new u.Subject,this.mouseOverLineId=-1,this.arrowWidth=15,this.sp=e,this.xAxisCol=this.sp.dataFrame.columns.byName(t),this.yAxisCol=this.sp.dataFrame.columns.byName(s),this.canvas=this.sp.getInfo().canvas,this.ctx=this.canvas.getContext("2d"),this.currentLineStyle=r,this.updateLines(n),this.visibility=null!==(i=n.visibility)&&void 0!==i?i:new N.Z(this.lines.from.length),n.visibility||this.visibility.setAll(!0,!1),n.arrowSize&&(this.arrowWidth=n.arrowSize),this.canvas.onmousedown=e=>{-1!==this.mouseOverLineId&&this.lineClicked.next({x:e.clientX,y:e.clientY,id:this.mouseOverLineId,event:e})},this.canvas.onmousemove=e=>{this.mouseOverLineId=this.checkCoordsOnLine(e.offsetX,e.offsetY),-1!==this.mouseOverLineId&&this.lineHover.next({x:e.clientX,y:e.clientY,id:this.mouseOverLineId,event:e})},e.onEvent("d4-before-draw-scene").subscribe((e=>{this.renderLines()}))}updateLines(e){this.lines=e,this.multipleLinesCounts=new Uint8Array(this.lines.from.length),e.skipMultiLineCalculation?this.multipleLinesCounts.fill(0):this.createMultiLinesIndices()}renderLines(){var e,t,s,n,r,i,o,a,l,c,h,u,d;const m=this.sp.getOptions().look,p=this.lines.colors||this.lines.width||this.lines.opacities||this.lines.drawArrowsArr;p||(this.ctx.lineWidth=null!==(e=this.lines.width)&&void 0!==e?e:1,this.ctx.strokeStyle=`rgba(${null!==(t=this.lines.color)&&void 0!==t?t:"0,128,0"},${null!==(s=this.lines.opacity)&&void 0!==s?s:1})`);const f=m.sizeColumnName?this.sp.dataFrame.col(m.sizeColumnName):null,g=this.sp.dataFrame.filter;for(let e=0;e<this.lines.from.length;e++)if(g.get(this.lines.from[e])&&g.get(this.lines.to[e])&&this.visibility.getBit(e)){let t=0;const{sizeFrom:s,sizeTo:g}=this.getMarkersSizes(m,f,e),y=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[e]),this.yAxisCol.get(this.lines.from[e]));let w=null==y?void 0:y.x,b=null==y?void 0:y.y;const C=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[e]),this.yAxisCol.get(this.lines.to[e]));let v=null==C?void 0:C.x,T=null==C?void 0:C.y;const A=Math.min(this.sp.viewBox.width,this.sp.viewBox.height);if(this.ctx.beginPath(),w&&b&&v&&T&&Math.hypot(v-w,T-b)/A>.01){if(p){const t=(null===(n=this.lines.colors)||void 0===n?void 0:n[e])?null===(r=this.lines.colors)||void 0===r?void 0:r[e]:"0,128,0",s=(null===(i=this.lines.opacities)||void 0===i?void 0:i[e])?null===(o=this.lines.opacities)||void 0===o?void 0:o[e]:1;this.ctx.strokeStyle=`rgba(${t},${s})`,this.ctx.lineWidth=(null===(a=this.lines.widths)||void 0===a?void 0:a[e])?null===(l=this.lines.widths)||void 0===l?void 0:l[e]:1}e===this._currentLineIdx&&this.toggleCurrentLineStyle(!0);const m=this.multipleLinesCounts[e];let f=null;if(m){t=this.getLineLength(w,b,v,T);const n=this.getPointOnDistance(w,b,v,T,g,t),r=this.getPointOnDistance(v,T,w,b,s,t);w=n.x,b=n.y,v=r.x,T=r.y,f=this.lines.from[e]>this.lines.to[e]?this.findControlPoint(m,w,b,v,T,e):this.findControlPoint(m,v,T,w,b,e),this.ctx.moveTo(w,b),this.ctx.quadraticCurveTo(f.x,f.y,v,T)}else this.ctx.moveTo(w,b),this.ctx.lineTo(v,T);if((null!==(c=this.lines.drawArrows)&&void 0!==c?c:null===(h=this.lines.drawArrowsArr)||void 0===h?void 0:h.getBit(e))&&(t||(t=this.getLineLength(w,b,v,T)),t>this.arrowWidth)){const e=m?null:this.getPointOnDistance(w,b,v,T,g,t),s=m?f.x:w,n=m?f.y:b;this.canvasArrow(this.ctx,null!==(u=null==e?void 0:e.x)&&void 0!==u?u:w,null!==(d=null==e?void 0:e.y)&&void 0!==d?d:b,s,n)}this.ctx.stroke(),this.ctx.closePath(),e===this._currentLineIdx&&this.toggleCurrentLineStyle(!1)}}this.fillLeftBottomRect()}toggleCurrentLineStyle(e){switch(this.currentLineStyle){case x.bold:e?this.ctx.lineWidth+=2:this.ctx.lineWidth-=2;break;case x.dashed:e?this.ctx.setLineDash([5,5]):this.ctx.setLineDash([]);break;default:return}}getMarkersSizes(e,t,s){let n=3,r=3;return t?(n=(e.markerMinSize+(e.markerMaxSize-e.markerMinSize)*t.scale(this.lines.from[s]))/2,r=(e.markerMinSize+(e.markerMaxSize-e.markerMinSize)*t.scale(this.lines.to[s]))/2):e.markerDefaultSize&&(n=e.markerDefaultSize/2,r=e.markerDefaultSize/2),{sizeFrom:n,sizeTo:r}}fillLeftBottomRect(){const e=new Path2D;e.rect(this.sp.yAxisBox.minX,this.sp.yAxisBox.maxY,this.sp.yAxisBox.width,this.sp.xAxisBox.height),this.ctx.fillStyle="white",this.ctx.beginPath(),this.ctx.fill(e),this.ctx.closePath()}createMultiLinesIndices(){const e=new N.Z(this.lines.from.length);e.setAll(!0);for(let t=-1;-1!==(t=e.findNext(t));){const s=t,n=this.lines.from[s],r=this.lines.to[s];let i=1;for(let s=t;-1!==(s=e.findNext(s));){const t=this.lines.from[s],o=this.lines.to[s];(t===n&&o===r||o===n&&t===r)&&(this.multipleLinesCounts[s]=++i,e.setBit(s,!1,!1))}i>1&&(this.multipleLinesCounts[s]=1),e.setBit(t,!1,!1)}}checkCoordsOnLine(e,t){let s=-1,n=null,r=null;const i=this.sp.getOptions().look,o=i.sizeColumnName?this.sp.dataFrame.col(i.sizeColumnName):null,a=this.sp.dataFrame.filter;for(let l=0;l<this.lines.from.length;l++)if(a.get(this.lines.from[l])&&a.get(this.lines.to[l])&&this.visibility.getBit(l)){const{sizeFrom:a,sizeTo:c}=this.getMarkersSizes(i,o,l),h=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[l]),this.yAxisCol.get(this.lines.from[l])),u=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[l]),this.yAxisCol.get(this.lines.to[l]));if(this.multipleLinesCounts[l]){const s=this.getLineLength(h.x,h.y,u.x,u.y),n=this.getPointOnDistance(h.x,h.y,u.x,u.y,c,s),i=this.getPointOnDistance(u.x,u.y,null==h?void 0:h.x,null==h?void 0:h.y,a,s),o=this.lines.from[l]>this.lines.to[l]?this.findControlPoint(this.multipleLinesCounts[l],n.x,n.y,i.x,i.y,l):this.findControlPoint(this.multipleLinesCounts[l],i.x,i.y,n.x,n.y,l);r=this.calculateDistToCurveLine(l,e,t,n,i,o)}else r=this.calculateDistToStraightLine(e,t,h,u);(!n&&null!==r&&r<5||n&&null!==r&&r<n)&&(n=r,s=l)}return s}calculateDistToStraightLine(e,t,s,n){const r=Math.min(s.x,n.x),i=Math.max(s.x,n.x),o=Math.min(s.y,n.y),a=Math.max(s.y,n.y);return e>=r-2&&e<=i+2&&t>=o-2&&t<=a+2?this.distToStraightLineSegment(e,t,s,n):null}distToStraightLineSegment(e,t,s,n){const r=(e,t,s,n)=>Math.pow(e-s,2)+Math.pow(t-n,2),i=r(s.x,s.y,n.x,n.y);if(0==i)return r(e,t,s.x,s.y);let o=((e-s.x)*(n.x-s.x)+(t-s.y)*(n.y-s.y))/i;return o=Math.max(0,Math.min(1,o)),r(e,t,s.x+o*(n.x-s.x),s.y+o*(n.y-s.y))}calculateDistToCurveLine(e,t,s,n,r,i){const o=Math.min(n.x,r.x,i.x),a=Math.max(n.x,r.x,i.x),l=Math.min(n.y,r.y,i.y),c=Math.max(n.y,r.y,i.y);if(t>=o-2&&t<=a+2&&s>=l-2&&s<=c+2){const e=a-o,h=c-l;return this.calculateDistToCurveInRect(t,s,n,i,r,e,h)}return null}calculateDistToCurveInRect(e,t,s,n,r,i,o){const a=Math.floor((i+o)/3),l=1/a,c=new Uint32Array(a),h=new Uint32Array(a),u=new Uint32Array(a);let d=null;const m=new N.Z(a);for(let i=0;i<c.length;i++){const o=i*l,a=Math.pow(1-o,2)*s.x+2*o*(1-o)*n.x+Math.pow(o,2)*r.x,m=Math.pow(1-o,2)*s.y+2*o*(1-o)*n.y+Math.pow(o,2)*r.y,p=Math.abs(e-a),f=Math.abs(t-m),g=p+f;(!d||d>g)&&(d=g),u[i]=Math.max(p,f),c[i]=a,h[i]=m}for(let e=0;e<c.length;e++)u[e]<d&&m.setBit(e,!0,!1);let p=null;for(let s=-1;-1!==(s=m.findNext(s));){const n=Math.hypot(c[s]-e,h[s]-t);(!p||p>n)&&(p=n)}return p}getLineLength(e,t,s,n){return Math.sqrt(Math.pow(s-e,2)+Math.pow(n-t,2))}getPointOnDistance(e,t,s,n,r,i){const o=s-r*((s-e)/i),l=n-r*((n-t)/i);return new a.Point(o,l)}findControlPoint(e,t,s,n,r,i){const o=t+(n-t)/2,l=s+(r-s)/2;let c=o-t,h=l-s;const u=Math.sqrt(c*c+h*h);c/=u,h/=u;const d=50*Math.ceil(e/2);return e%2==0?new a.Point(o+d/2*h,l-d/2*c):new a.Point(o-d/2*h,l+d/2*c)}canvasArrow(e,t,s,n,r){const i=Math.atan2(n-t,r-s)+Math.PI;e.moveTo(t-this.arrowWidth*Math.sin(i-Math.PI/10),s-this.arrowWidth*Math.cos(i-Math.PI/10)),e.lineTo(t,s),e.lineTo(t-this.arrowWidth*Math.sin(i+Math.PI/10),s-this.arrowWidth*Math.cos(i+Math.PI/10))}}const L="dimensionality-reducer-terminate-event";var I=s(850);async function R(e,t,n,r,o,a,l){let c=await async function(e,t,n,r,o,a,l){if(!a.distanceFnArgs)throw new Error("options.distanceFnArgs must be defined");if(e.length!==t.length||e.length!==a.distanceFnArgs.length||e.length!==r.length)throw new Error("data, metrics and options and weights must have the same length");return new Promise((function(c,h){const u=new Worker(new URL(s.p+s.u(42),s.b));u.postMessage({columnsData:e,distanceMetrics:t,method:n,options:a,weights:r,aggregationMethod:o});const d=i.events.onCustomEvent(L).subscribe((()=>{try{u?.terminate()}finally{d.unsubscribe()}}));u.onmessage=({data:{error:e,embedding:t,epochNum:s,epochsLength:n}})=>{E(s)||E(n)?(d.unsubscribe(),e?h(e):c(t),setTimeout((()=>u.terminate()),100)):l&&l(s,n,t)}}))}(e,n,t,r,o,a,l);return c=c.map((e=>(0,I.Fv)(e))),c}let O=0;const k="cliffsDf",F=new u.Subject,D="activity_difference",G="SALI_index",H="similarity",W="line_index",B=["1_molecule","2_molecule"],V="filterCliffs";var U,j=s(499),Y=s(5226),K=s(7228),q=s(8457),Z=s(8260);async function z(e,t,s,n){const r=(0,q.O)(t),i=(0,Z.vU)(t.getTag(a.TAGS.UNITS),t.getTag("separator"))(s),o=n===U.IDENTITY?function(e,t){const s=t.columns.length,n=new Array(s),r=new Array(s),i=new Array(s);for(let o=0;o<s;++o){const s=t.columns.byIndex(o);n[o]=s.getRawData(),r[o]=s.categories.indexOf(""),i[o]=s.categories.indexOf(e[o]??"")}const o=a.Column.float("Identity",t.rowCount),l=o.getRawData();for(let s=0;s<t.rowCount;++s){l[s]=0;for(let t=0;t<e.length;++t)n[t][s]===i[t]&&++l[s];l[s]/=e.length}return o}(i,r):n===U.SIMILARITY?await async function(e,t){const s=t.columns.toList();return await(0,K.Qx)(s,e)}(i,r):null;if(null===o)throw new Error(`In bio library: Unkown sequence scoring method: ${n}`);return o.name=e.columns.getUnusedName(o.name),e.columns.add(o),o}!function(e){e.IDENTITY="identity",e.SIMILARITY="similarity"}(U||(U={}));var X=s(7945),J=(s(4293),s(6414)),Q=s.n(J);const ee="rgb(100,100,100)",te="#808080",se="rgb(0,0,0)",ne=Z.GU;var re,ie;function oe(e,t,s,n,r,i,o=ee,a=0,l=!1,c=1,h="",u=!1,d=ie.classic,m=[],p=0,f=null,g=[],y=null,w={}){r.textAlign="start";let b=i.substring(0),C=u?"":h;d===ie.MSA&&(C="");let v=!0,T=!0,A="difference";null!=f&&null!=f.cell.column&&(v=f.cell.column.temp["color-code"]??!0,T=f.cell.column.temp["compare-with-current"]??!0,A=f.cell.column.temp["highlight-difference"]??"difference");const S=g[p];T&&g.length>0&&"difference"===A&&(c=b==S?.3:c),T&&g.length>0&&"equal"===A&&(c=b!=S?.3:c),null!=y&&(b=ne(b,y));const _=b+C;w[_]??(w[_]=r.measureText(_));let E=w[_];w[b]??(w[b]=r.measureText(b));let P=w[b].width;w[C]??(w[C]=r.measureText(C));const $=w[C].width,x=n/2-(E.fontBoundingBoxAscent+E.fontBoundingBoxDescent)/2+1;function N(s,n){const i=v?o:se;r.fillStyle=i,r.globalAlpha=c,d===ie.classic&&(r.fillText(b,e+s,t+x),r.fillStyle=te,r.fillText(C,e+n,t+x)),d===ie.MSA&&r.fillText(b,e+s,t+x)}E=E.width,d===ie.MSA&&(P=m[p],E=m[p]);const M=(m[p]??0)-(m[0]??0);if(l||E>s)return N(M,M+P),e+M+P+$;{const t=(s-E)/2;return N(t,t+P),e+M+t+P}}!function(e){e.maxMonomerLength=".mm.cellRenderer.maxMonomerLength"}(re||(re={})),function(e){e.MSA="MSA",e.classic="classic"}(ie||(ie={})),s(9611);var ae,le,ce=s(8447),he=s(7331);function ue(e){const t=!Q().enumerate(e).some((([t,s])=>t.length>1&&0!=s&&s!=e.length-1)),s=[],n=t?"":" ";for(const[t,r]of Q().enumerate(e)){let i=t;r<e.length&&(i+=`${t?"":"-"}${n}`),s.push(i)}return[s,t]}(le=ae||(ae={})).long="long",le.short="short",s(3553),ce.GU;class de extends a.GridCellRenderer{constructor(){super(...arguments),this.padding=5}get name(){return"sequence"}get cellType(){return"sequence"}get defaultHeight(){return 30}get defaultWidth(){return 230}onClick(e,t){e.cell.column.temp["current-word"]=e.cell.value,e.grid.invalidate()}onMouseMove(e,t){const s=e.cell.column.temp["bio-seqCol"];if(!s)return;const n=e.bounds,r=t.offsetX-e.gridColumn.left+(e.gridColumn.left-n.x),a=s.getPosition(e.tableRowIndex,r),l=s.getSeqMonList(e.tableRowIndex);if(null!==a&&a<l.length){const e=l[a],n=[o.div(e)];if(s._monomerStructureMap[e])n.push(s._monomerStructureMap[e]);else{const t=s.getMonomer(e);if(t){const r={autoCrop:!0,autoCropMargin:0,suppressChiralText:!0},o=i.chem.svgMol(t.smiles,void 0,void 0,r);n.push(o),s._monomerStructureMap[e]=o}}o.tooltip.show(o.divV(n),t.x+16,t.y+16)}else o.tooltip.hide()}render(e,t,s,n,r,i,o){try{i.grid}catch(e){const[t,s]=(0,X.yf)(e);rt.logger.error(t,void 0,s)}i.cell.column}}class me extends a.GridCellRenderer{get name(){return"MacromoleculeDifferenceCR"}get cellType(){return constants.Of.MACROMOLECULE_DIFFERENCE}get defaultHeight(){return 30}get defaultWidth(){return 230}render(e,t,s,n,r,i,o){const l=window.devicePixelRatio,c=i.grid,h=i.cell,u=i.tableColumn,d=h.value??"",m=u.tags.separator,p=u.tags[a.TAGS.UNITS];getUpdatedWidth(c,e,t,n,l);const[f,g]=d.split("#"),y=(0,Z.vU)(p,m);pe(e,t,s,n,r,y(f),y(g),p)}}function pe(e,t,s,n,r,i,o,a,l,c){if(i.length!==o.length){const e=function(e,t){let s=0,n=0;const r=e.length>t.length?e:t,i=e.length>t.length?t:e;for(let e=0;e<i.length;e++)r[e]===i[e]&&s++;const o=r.length-i.length;for(let e=r.length-1;e>o;e--)r[e]===i[e-o]&&n++;const a=new Array(Math.abs(e.length-t.length)).fill("");function l(e){return s>n?e.concat(a):a.concat(e)}return e.length>t.length?t=l(t):e=l(e),{subParts1:e,subParts2:t}}(Q()(i).toArray(),Q()(o).toArray());i=e.subParts1,o=e.subParts2}const h=e.measureText(ue(i).join("")),u=e.measureText(ue(o).join("")),d=Math.max(h.width,u.width);l&&(n=d+4*i.length,e.canvas.width=d+4*i.length);let m=Math.max(t,t+(n-(d+4*i.length))/2)+5;const p=Math.max(s,s+(r-28)/2);e.save(),e.beginPath(),e.rect(t,s,l?d+4*i.length:n,r),e.clip(),e.font="12px monospace",e.textBaseline="top";let f=he.UE.Color;"HELM"!=a&&(f=(0,ce.py)(a.substring(a.length-2)));for(let t=0;t<i.length;t++){const s=i[t],a=o[t],l=f.get(s);if(s!=a){const i=f.get(a),o=oe(m,p-7,n,r,e,s,l,0,!0),h=oe(m,p+7,n,r,e,a,i,0,!0);m=Math.max(h,o),c&&(c[t]=fe(s,a,l,i,p,7,r))}else m=oe(m,p,n,r,e,s,l,0,!0,.5);m+=4}e.restore()}function fe(e,t,s,n,r,i,o){const a=document.createElement("canvas"),l=a.getContext("2d");l.font="12px monospace";const c=l.measureText(ue([e]).join("")).width,h=l.measureText(ue([t]).join("")).width,u=Math.max(c,h);return a.height=o,a.width=u+4,l.font="12px monospace",l.textBaseline="top",oe(0,r-i,u,o,l,e,s,0,!0),oe(0,r+i,u,o,l,t,n,0,!0),a}var ge,ye=s(8467),we=s(9298);!function(e){e.Unknown="unknown",e.FR="framework",e.CDR="cdr"}(ge||(ge={}));const be=new class{constructor(){this.regionTypes=[ge.CDR],this.chains=["Heavy","Light"],this.skipEmptyPositions=!1,this.fitWidth=!1,this.positionWidth=16,this.positionHeight=we.ES.Entropy,this.filterSource=we.vS.filterSource}};var Ce=s(172),ve=s(8415);const Te=ge;var Ae,Se;!function(e){e.STYLE="Style",e.BEHAVIOR="Behavior",e.LAYOUT="Layout",e.DATA="Data"}(Ae||(Ae={})),function(e){e.skipEmptyPositions="skipEmptyPositions",e.regionTypes="regionTypes",e.chains="chains",e.fitWidth="fitWidth",e.positionWidth="positionWidth",e.positionHeight="positionHeight",e.filterSource="filterSource"}(Se||(Se={}));const _e=be;class Ee extends a.JsViewer{constructor(){super(),this.viewed=!1,this.regionsFg=null,this.regionsRoot=null,this.isOpened=!1,this.panelNode=null,this.regions=[],this.viewerId=++Ee.viewerCounter,this.setDataInProgress=!1,this.host=null,this.mainLayout=null,this.logos=[],this.viewSubs=[],this.calcSizeRequested=!1,this._onRendered=new u.Subject,this.skipEmptyPositions=this.bool(Se.skipEmptyPositions,_e.skipEmptyPositions,{category:Ae.DATA}),this.regionTypes=this.stringList(Se.regionTypes,_e.regionTypes,{category:Ae.DATA,choices:Object.values(Te).filter((e=>e!=Te.Unknown))}),this.chains=this.stringList(Se.chains,_e.chains,{category:Ae.DATA,choices:["Heavy","Light"]}),this.fitWidth=this.bool(Se.fitWidth,_e.fitWidth,{category:Ae.LAYOUT}),this.positionWidth=this.float(Se.positionWidth,_e.positionWidth,{category:Ae.LAYOUT,editor:"slider",min:0,max:64,description:"Internal WebLogo viewers property width of position."}),this.positionHeight=this.string(Se.positionHeight,_e.positionHeight,{category:Ae.LAYOUT,choices:Object.keys(we.ES)}),this.filterSource=this.string(Se.filterSource,_e.filterSource,{category:Ae.BEHAVIOR,choices:Object.values(we.Ct)}),this.viewSyncer=new Ce.c(rt.logger)}viewerToLog(){return`VdRegionsViewer<${this.viewerId}>`}async init(){this.subs.push((0,u.fromEvent)(this.root,"mousemove").subscribe(this.rootOnMouseMove.bind(this)))}detach(){const e=`${this.viewerToLog()}.detach()`,t=super.detach.bind(this);this.viewSyncer.sync(`${e}`,(async()=>{this.setDataInProgress||(this.viewed&&(await this.destroyView("detach"),this.viewed=!1),t())}))}onTableAttached(){super.onTableAttached(),this.setData(this.regions)}onPropertyChanged(e){if(super.onPropertyChanged(e),e){switch(e.name){case Se.regionTypes:case Se.chains:this.setData(this.regions)}switch(e.name){case Se.skipEmptyPositions:for(let e=0;e<this.logos.length;++e)for(const t of this.chains)this.logos[e][t].setOptions({[ve.bo.skipEmptyPositions]:this.skipEmptyPositions});this.calcSize();break;case Se.fitWidth:case Se.positionWidth:this.calcSize();break;case Se.positionHeight:for(let e=0;e<this.logos.length;++e)for(const t of this.chains)this.logos[e][t].setOptions({[ve.bo.positionHeight]:this.positionHeight});this.calcSize();break;case Se.filterSource:this.filterSourceInput.value=this.filterSource;break;default:this.setData(this.regions)}}else console.warn("Bio: VdRegionsViewer.onPropertyChanged() property is null")}setData(e){const t=`${this.viewerToLog()}.setData()`;rt.logger.debug(`${t}, in, regions.length = ${e.length}`),this.viewSyncer.sync(`${t}`,(async()=>{if(!this.setDataInProgress){this.setDataInProgress=!0;try{this.viewed&&(await this.destroyView("setData"),this.viewed=!1),this.regions=e,this.viewed||(await this.buildView("setData"),this.viewed=!0)}finally{this.setDataInProgress=!1}}}))}async destroyView(e){rt.logger.debug(`Bio: VdRegionsViewer.destroyView( mainLayout = ${this.mainLayout?"value":"none"} ), purpose = '${e}', this.regions.length = ${this.regions.length}`),this.filterSourceInput&&o.empty(this.filterSourceInput.root),null!=this.mainLayout&&(this.mainLayout.remove(),this.host.remove(),this.host=null,this.mainLayout=null);for(const e of this.viewSubs)e.unsubscribe()}async buildView(e){rt.logger.debug(`Bio: VdRegionsViewer.buildView() begin, purpose = '${e}', this.regions.length = ${this.regions.length}`);const t=this.regions.filter((e=>this.regionTypes.includes(e.type))),s=Array.from(new Set(t.map((e=>e.order)))).sort(),n=[];for(let e=0;e<s.length;e++)for(const r of this.chains){const i=t.find((t=>t.order==s[e]&&t.chain==r));n.push((async()=>{const t=await this.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:i.sequenceColumnName,startPositionName:i.positionStartName,endPositionName:i.positionEndName,fixWidth:!0,skipEmptyPositions:this.skipEmptyPositions,positionWidth:this.positionWidth,positionHeight:this.positionHeight,filterSource:this.filterSource});return t.onSizeChanged.subscribe((()=>{this.calcSize()})),[e,r,t]})())}const r=await Promise.all(n);this.logos=new Array(s.length);for(let e=0;e<s.length;++e)this.logos[e]={};for(const[e,t,s]of r)this.logos[e][t]=s,this.viewSubs.push(s.onFreqsCalculated.subscribe((()=>{this.calcSize()})));this.mainLayout=o.table(this.chains,(e=>[...s.length>0?[o.div(e,{style:{transform:"rotate(-90deg)",font:"12px Roboto, Roboto Local, sans-serif",textAlign:"center",width:"16px",marginTop:"24px",marginLeft:"6px"}})]:[],...[...Array(s.length).keys()].map((t=>{const s=this.logos[t][e];return s.root.style.height="100%",o.div([s.root],{style:{marginTop:"4px",marginBottom:"4px"}})}))]),["",...[...Array(s.length).keys()].map((e=>t.find((t=>t.order==s[e]&&t.chain==this.chains[0])).name||"Name"))]),this.mainLayout.className="mlb-vd-regions-viewer-table2",this.filterSourceInput=o.choiceInput("Data source",this.filterSource,Object.values(we.Ct),this.filterSourceInputOnValueChanged.bind(this)),this.filterSourceInput.root.style.position="absolute",this.filterSourceInput.root.style.right="9px",this.filterSourceInput.root.style.top="-4px",Math.ceil(255*Math.random()).toString(16),this.host=o.div([this.mainLayout,this.filterSourceInput.root],{}),this.root.appendChild(this.host),this.root.style.overflowX="auto",this.calcSize(),this.viewSubs.push(o.onSizeChanged(this.root).subscribe(this.rootOnSizeChanged.bind(this))),rt.logger.debug("Bio: VdRegionsViewer.buildView() end")}calcSize(){rt.logger.debug("Bio: VdRegionsViewer.calcSize(), start");const e=()=>{if(!this.host)return;const e=(this.root.clientHeight-54)/this.chains.length;let t=0;for(let s=0;s<this.logos.length;s++){for(const t of this.chains)this.logos[s][t].root.style.height=`${e}px`;t+=Math.max(...this.chains.map((e=>this.logos[s][e].Length)))}if(this.fitWidth){if(this.logos.length>0&&t>0){const e=22,s=13,n=9,r=(this.root.clientWidth-e-(this.logos.length-1)*n-s)/t;for(let e=0;e<this.logos.length;e++)for(const t of this.chains){const s=this.logos[e][t];s.setOptions({[ve.bo.positionWidth]:r-s.positionMarginValue}),s.root.style.width=r*s.Length+"px"}}this.host.style.setProperty("overflow","hidden","important")}else{for(let e=0;e<this.logos.length;e++)for(const t of this.chains)this.logos[e][t].setOptions({[ve.bo.positionWidth]:this.positionWidth});this.host.style.removeProperty("overflow")}0===this.positionWidth?this.host.style.setProperty("overflow-x","hidden","important"):this.host.style.removeProperty("overflow-x")};this.calcSizeRequested||(this.calcSizeRequested=!0,window.setTimeout((()=>{e(),this.calcSizeRequested=!1}),0))}rootOnSizeChanged(e){this.calcSize()}rootOnMouseMove(e){}filterSourceInputOnValueChanged(){const e=`${this.viewerToLog()}.filterSourceInputOnValueChanged()`,t=this.filterSourceInput.value;this.viewSyncer.sync(`${e}`,(async()=>{if(this.filterSource!==t){this.props.getProperty(Se.filterSource).set(this,t);for(let e=0;e<this.logos.length;e++)for(let t=0;t<this.chains.length;t++){const s=this.chains[t];this.logos[e][s].setOptions({[ve.bo.filterSource]:this.filterSource})}}}))}get onRendered(){return this._onRendered}invalidate(e){const t=`${this.viewerToLog()}.invalidate(${e?` <- ${e} `:""})`;this.viewSyncer.sync(`${t}`,(async()=>{this._onRendered.next()}))}async awaitRendered(e=5e3){await(0,ye.zg)(this.onRendered,(()=>{}),(()=>{this.invalidate()}),e);const t=this.viewSyncer.resetErrors();if(t.length>0)throw t[0]}}function Pe(e){const t=o.divH([],{style:{gap:"10px"}}),s=o.divV([o.divText(e.seqCol.name),o.divText(e.activityCol.name)]);return s.style.fontWeight="bold",s.style.display="flex",s.style.justifyContent="space-between",t.append(s),e.points.forEach((s=>{const n=o.divText(e.activityCol.get(s).toFixed(2));n.style.display="flex",n.style.justifyContent="left",n.style.paddingLeft="30px",t.append(o.divV([o.divText(e.seqCol.get(s)),n]))})),t}function $e(e){const t=o.div();t.append(o.divText(e.seqCol.name,{style:{fontWeight:"bold"}}));const s=new Array(2),n=new Array(2);e.points.forEach(((t,r)=>{s[r]=e.seqCol.get(t),n[r]=e.activityCol.get(t)}));const r={},i=j.Cn.getOrCreate(e.seqCol),a=i.getSplitter(),l=function(e,t,s,n){const r=document.createElement("canvas"),i=r.getContext("2d");return r.height=30,pe(i,0,0,0,30,e,t,s,!0,n),r}(a(s[0]),a(s[1]),i.units,r);return t.append(o.div(l,{style:{width:"300px",overflow:"scroll"}})),t.append(function(e){const t=o.div();if(Object.keys(e).length>0){const s=o.divV([]);s.append(o.divH([o.divText("Pos",{style:{fontWeight:"bold",width:"30px",borderBottom:"1px solid"}}),o.divText("Difference",{style:{fontWeight:"bold",borderBottom:"1px solid"}})]));for(const t of Object.keys(e))e[t].style.borderBottom="1px solid lightgray",s.append(o.divH([o.divText((parseInt(t)+1).toString(),{style:{width:"30px",borderBottom:"1px solid lightgray"}}),e[t]]));t.append(s)}return t}(r)),t.append(xe("Activity delta",Math.abs(n[0]-n[1]))),t.append(xe("Cliff",e.sali)),t}function xe(e,t){return o.divH([o.divText(`${e}: `,{style:{fontWeight:"bold",paddingRight:"5px"}}),o.divText(t.toFixed(2))],{style:{paddingTop:"10px"}})}function Ne(e,t){const s=a.Column.string("seq_diff",e.rowCount).init((s=>`${e.get(t[0],s)}#${e.get(t[1],s)}`));s.semType="MacromoleculeDifference",s.setTag(a.TAGS.UNITS,e.col(t[0]).getTag(a.TAGS.UNITS)),s.setTag("separator",e.col(t[0]).getTag("separator")),e.columns.add(s);const n=e.plot.grid();return n.col(t[0]).visible=!1,n.col(t[1]).visible=!1,n}Ee.viewerCounter=-1,s(708),s(6361),s(7983);class Me extends a.JsViewer{constructor(e){super(),this.name="",this.metricsProperties=["distanceMetric","fingerprint"],this.fingerprintChoices=["Morgan","Pattern"],this.initialized=!1,this.tags=[a.TAGS.UNITS,"aligned","separator","alphabet"],this.preComputeDistanceMatrix=!1,this.renderPromise=Promise.resolve(),this.fingerprint=this.string("fingerprint",this.fingerprintChoices[0],{choices:this.fingerprintChoices}),this.limit=this.int("limit",10),this.distanceMetric=this.string("distanceMetric",distance_metrics_methods.kg[0],{choices:distance_metrics_methods.kg}),this.moleculeColumnName=this.string("moleculeColumnName"),this.name=e}init(){this.initialized=!0}detach(){this.subs.forEach((e=>e.unsubscribe()))}async onTableAttached(){if(this.init(),this.dataFrame){this.preComputeDistanceMatrix=this.dataFrame.rowCount<=22e3,this.subs.push(a.debounce(this.dataFrame.onRowsRemoved,50).subscribe((e=>this.render(!0))));const e="diversity"!==this.name;this.subs.push(a.debounce(this.dataFrame.onCurrentRowChanged,50).subscribe((t=>this.render(e)))),this.subs.push(a.debounce(this.dataFrame.selection.onChanged,50).subscribe((e=>this.render(!1)))),this.subs.push(a.debounce(o.onSizeChanged(this.root),50).subscribe((e=>this.render(!1)))),this.moleculeColumn=this.dataFrame.columns.bySemType(a.SEMTYPE.MACROMOLECULE),this.moleculeColumnName=this.moleculeColumn?.name,this.getProperty("limit").fromOptions({min:1,max:this.dataFrame.rowCount})}this.render()}onPropertyChanged(e){if(super.onPropertyChanged(e),this.initialized){if("moleculeColumnName"===e.name){const t=this.dataFrame.col(e.get(this));t.semType===a.SEMTYPE.MACROMOLECULE&&(this.moleculeColumn=t)}this.render()}}render(e=!0){this.renderPromise=this.renderPromise.then((async()=>{this.computeRequested=this.computeRequested||e,await this.renderInt(e)}))}async renderInt(e){}beforeRender(){return!(!this.initialized||this.dataFrame&&this.moleculeColumnName&&this.dataFrame.col(this.moleculeColumnName).semType!==a.SEMTYPE.MACROMOLECULE&&(i.shell.error(`${this.moleculeColumnName} is not Macromolecule type`),1))}}s(7241),s(4004),s(9943),s(5393);var Le=s(7572),Ie=(s(3336),s(8710)),Re={};Re.styleTagTransform=A(),Re.setAttributes=b(),Re.insert=y().bind(null,"head"),Re.domAPI=f(),Re.insertStyleElement=v(),m()(Ie.Z,Re),Ie.Z&&Ie.Z.locals&&Ie.Z.locals,s(6584),s(3776),s(2428);var Oe,ke=function(e,t,s,n){return new(s||(s=Promise))((function(r,i){function o(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}l((n=n.apply(e,t||[])).next())}))};class Fe{constructor(e,t,s=!1,n){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=o.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._steps=[],this._mainHeader=o.panel([],"tutorials-main-header"),this._header=o.h2(""),this._headerDiv=o.divH([],"tutorials-root-header"),this._stopStartBtn=o.button(o.iconFA("pause"),(()=>this._changeStopState()),"Play / pause"),this._restartBtn=o.button(o.iconFA("redo"),(()=>this._restartScript()),"Restart"),this._nextStepBtn=o.button(o.iconFA("play"),(()=>{this._isStepProcessed||this._nextStep()}),"Next step"),this._activity=o.panel([],"tutorials-root-description"),this._progressDiv=o.divV([],"tutorials-root-progress"),this._progress=o.element("progress"),this._progressSteps=o.divText(""),this._closeBtn=o.button(o.iconFA("chevron-left"),(()=>this._closeDock()),"Back to demo"),this.name=e,this.description=t,this._isAutomatic=s,this._autoStartFirstStep=null!==(r=null==n?void 0:n.autoStartFirstStep)&&void 0!==r&&r,this._progress.max=0,this._progress.value=1,Fe.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=o.divText(`Step: ${this._progress.value} of ${this.stepNumber}`),this._progressDiv.append(this._progressSteps)}_addDescription(){var e;this._activity.append(o.div(this.description,"tutorials-root-description"));for(let t=0;t<this.stepNumber;t++){let s=o.iconFA("clock");this._isAutomatic||0===t&&(s=o.iconFA("play",(()=>this._nextStep()),"Next step"),s.className="grok-icon fas fa-play");const n=o.div(this._steps[t].name,"grok-tutorial-entry-instruction"),r=o.div(null===(e=this._steps[t].options)||void 0===e?void 0:e.description,"grok-tutorial-step-description hidden"),i=o.divH([s,n],"grok-tutorial-entry");this._activity.append(i,r)}}_initRoot(){var e,t,s;i.shell.windows.showContextPanel=!0,i.shell.windows.showHelp=!1;const n=Array.from(i.shell.dockManager.rootNode.children)[0];this._node=i.shell.dockManager.dock(this._root,a.DOCK_TYPE.FILL,n,""),(null===(t=null===(e=n.parent.container.containerElement.firstElementChild)||void 0===e?void 0:e.lastElementChild)||void 0===t?void 0:t.classList.contains("tab-handle-list-container"))&&(null===(s=n.parent.container.containerElement.firstElementChild)||void 0===s||s.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 e,t;return ke(this,void 0,void 0,(function*(){this._isStepProcessed=!0,this._isAutomatic||(this._nextStepBtn.classList.add("disabled"),this._nextStepBtn.firstChild.classList.add("fa-disabled"));const s=this._activity.getElementsByClassName("grok-tutorial-entry")[this._currentStep],n=this._activity.getElementsByClassName("grok-icon")[this._currentStep],r=this._activity.getElementsByClassName("grok-tutorial-step-description")[this._currentStep];n.className="grok-icon far fa-spinner-third fa-spin",r.classList.remove("hidden"),r.classList.add("visible");const i=s,a=(null===(e=this._steps[this._currentStep].options)||void 0===e?void 0:e.delay)?null===(t=this._steps[this._currentStep].options)||void 0===t?void 0:t.delay:2e3;yield this._steps[this._currentStep].func(),this._scrollTo(this._root,i.offsetTop-this._mainHeader.offsetHeight),this._isAutomatic&&(yield this._countdown(s,n,a),yield(0,ye.gw)(a));const l=o.iconFA("check");if(n.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 e=this._activity.getElementsByClassName("grok-icon")[this._currentStep],t=o.iconFA("play",(()=>this._nextStep()),"Next step");t.className="grok-icon fas fa-play",e.replaceWith(t),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 ke(this,void 0,void 0,(function*(){for(let e=this._currentStep;e<this.stepNumber&&!this._isStopped&&!this._isCancelled;e++)yield this._nextStep()}))}_scrollTo(e,t){e.focus(),e.scrollTop=t}_countdown(e,t,s){return ke(this,void 0,void 0,(function*(){const n=o.div([],"demo-script-countdown");t.classList.add("hidden");let r=s/1e3;const i=this._createSVGIndicator(r);n.append(i),e.prepend(n);const a=setInterval((()=>{r--,0===r&&(clearInterval(a),n.remove(),t.classList.remove("hidden"),t.classList.add("visible"))}),1e3)}))}_createSVGIndicator(e){const t=document.createElementNS("http://www.w3.org/2000/svg","svg"),s=document.createElementNS("http://www.w3.org/2000/svg","circle");return s.setAttributeNS(null,"cx","7"),s.setAttributeNS(null,"cy","7"),s.setAttributeNS(null,"r","6"),s.setAttributeNS(null,"style",`animation: countdown ${e}s linear infinite forwards`),t.append(s),t}_changeStopState(){const e=this._stopStartBtn.getElementsByClassName("grok-icon");e[0].className="grok-icon fas fa-play",this._isStopped=!this._isStopped,this._isStopped||(e[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=o.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._mainHeader=o.panel([],"tutorials-main-header"),this._header=o.h2(""),this._headerDiv=o.divH([],"tutorials-root-header"),this._activity=o.panel([],"tutorials-root-description"),this._progressDiv=o.divV([],"tutorials-root-progress"),this._progress=o.element("progress"),this._progressSteps=o.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,Fe.currentObject=null}step(e,t,s){return this._steps[this.steps.length]={name:e,func:t,options:s},this}start(){return ke(this,void 0,void 0,(function*(){this._initRoot(),i.shell.newView(this.name),this._isAutomatic?this._startScript():this._autoStartFirstStep&&(yield this._nextStep())}))}}Fe.currentObject=null,function(e){e.X="Embed_X",e.Y="Embed_Y"}(Oe||(Oe={}));var De=function(e,t,s,n){return new(s||(s=Promise))((function(r,i){function o(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}l((n=n.apply(e,t||[])).next())}))};s(7905),s(8341);var Ge=s(2568);s(525),s(9416),new class{constructor(){this.tooltipHandlerTemp="tooltip-handler.Monomer"}};class He extends a.GridCellRenderer{get name(){return constants.Of.MONOMER}get cellType(){return constants.Of.MONOMER}get defaultHeight(){return 15}get defaultWidth(){return 40}render(e,t,s,n,r,i,o){if(i.gridRow<0)return;MonomerTooltipHandler.getOrCreate(i.gridColumn),e.font="12px monospace",e.textBaseline="middle",e.textAlign="center";const a=(0,ce.py)(i.cell.column.getTag("alphabet")),l=i.cell.value;if(!l)return;const c=a.get(l);e.fillStyle=c,e.fillText((0,ce.GU)(l,6),t+n/2,s+r/2,n)}}class We extends a.Package{constructor(){super(...arguments),this._initialized=!1}get properties(){return this._properties}set properties(e){this._properties=e}get initialized(){return this._initialized}completeInit(){this._initialized=!0}handleErrorUI(e){const[t,s]=(0,X.yf)(e);i.shell.error(t),this.logger.error(t,void 0,s)}}s(8770);class Be extends a.Widget{constructor(e){super(o.divV([])),this.viewed=!1,this.seqCol=e}async init(){const e=j.Cn.getOrCreate(this.seqCol),t=rt.properties.TooltipWebLogo,s=this.seqCol.getTag(we.DX.tooltipWebLogo);!1===t||["false","off","disable","disabled"].includes(s)||(this.wlViewer=await this.seqCol.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:this.seqCol.name,backgroundColor:0,positionHeight:"Entropy",positionWidth:e.getAlphabetIsMultichar()?24:16,fixWidth:!0,fitArea:!1}),this.wlViewer.root.style.height="50px",this.root.appendChild(this.wlViewer.root),this.root.style.width="100%")}detach(){this.wlViewer.detach(),super.detach()}}var Ve=s(922);class Ue{constructor(e,t){this.helmColumn=e,this.df=t,this.helmColumn=e}async convertToSmiles(){const e=await this.getSmilesList(),t=this.df.columns.getUnusedName(`smiles(${this.helmColumn.name})`);return a.Column.fromStrings(t,e.map((e=>null===e?"":e)))}async getSmilesList(){return(await this.convertToMolfileV2KColumn()).toList().map((e=>a.chem.convert(e,a.chem.Notation.MolBlock,a.chem.Notation.Smiles)))}async convertToRdKitBeautifiedMolfileColumn(){const e=await this.getSmilesList(),t=await i.functions.call("Chem:getRdKitModule"),s=e.map((e=>{if(""===e)return null;const s=t.get_mol(e);return s?(s.normalize_depiction(1),s.straighten_depiction(!0),s):null})),n=this.df.columns.getUnusedName(`molfile(${this.helmColumn.name})`);return a.Column.fromStrings(n,s.map((e=>null===e?"":e.get_molblock())))}async convertToMolfileV2KColumn(){const e=(await this.getPolymerGraphColumn()).toList().map(((e,t)=>{const s=this.helmColumn.get(t);if(!s)return"";let n="";try{n=this.getPolymerMolfile(s,e)}catch(e){const[t,s]=(0,X.yf)(e);rt.logger.error(t,void 0,s)}finally{return n}})),t=this.df.columns.getUnusedName(`molfileV2K(${this.helmColumn.name})`);return a.Column.fromList("string",t,e)}async getPolymerGraphColumn(){return await i.functions.call("HELM:getMolfiles",{col:this.helmColumn})}getPolymerMolfile(e,t){const s=new je(t),n=new et(e);return s.monomerSymbols.forEach(((e,t)=>{const r=s.getMonomerShifts(t);n.addMonomer(e,t,r)})),n.compileToMolfile()}}class je{constructor(e){this.molfileHandler=Ve._.getInstance(e)}get monomerSymbols(){return this.molfileHandler.atomTypes}getMonomerShifts(e){return{x:this.molfileHandler.x[e],y:this.molfileHandler.y[e]}}}class Ye{constructor(e,t){this.capGroupElements=[];const s=Le.A.instance.getBioLib().getMonomer(t,e);if(!s)throw new Error(`Monomer ${e} is not found in the library`);this.molfileWrapper=new ze(s.molfile,e),this.capGroupElements=s.rgroups.map((e=>(e.capGroupSMILES||e.capGroupSMILES).replace(/(\[|\]|\*|:|\d)/g,"")))}shiftCoordinates(e){this.molfileWrapper.shiftCoordinates(e)}getAtomLines(){return this.molfileWrapper.getAtomLines()}getBondLines(){return this.molfileWrapper.getBondLines()}removeBondedRGroups(e){this.molfileWrapper.removeRGroups(e)}capTrailingRGroups(){this.molfileWrapper.capRGroups(this.capGroupElements)}replaceRGroupWithAttachmentAtom(e,t){this.molfileWrapper.replaceRGroupWithAttachmentAtom(e,t)}getAttachmentAtomByRGroupId(e){return this.molfileWrapper.getAttachmentAtomByRGroupId(e)}deleteBondLineWithSpecifiedRGroup(e){this.molfileWrapper.deleteBondLineWithSpecifiedRGroup(e)}shiftBonds(e){this.molfileWrapper.shiftBonds(e)}}class Ke{constructor(e,t,s){this.atoms=t,this.bonds=s,this.rGroupBondPositionMap=new Map,this.rGroupIdToAtomicIndexMap=this.getRGroupIdToAtomicIdxMap(e)}getAtomicIdx(e){const t=this.rGroupIdToAtomicIndexMap.get(e);return void 0===t?null:t}removeRGroupsFromAtomBlock(e){e.forEach((e=>{if(void 0===this.rGroupIdToAtomicIndexMap.get(e))throw new Error(`Cannot find atomic index for R group ${e}`)}));const t=Array.from(this.rGroupIdToAtomicIndexMap.entries()).filter((([t,s])=>e.includes(t))).map((([e,t])=>t));this.atoms.deleteAtoms(t)}removeRGroups(e){this.removeRGroupsFromAtomBlock(e),e.forEach((e=>{const t=this.replaceRGroupInBondsByDummy(e);this.rGroupBondPositionMap.set(e,t)}))}replaceRGroupInBondsByDummy(e){const t=this.rGroupIdToAtomicIndexMap.get(e);if(this.rGroupBondPositionMap.has(e))throw new Error(`R group ${e} is already handled`);const s=this.bonds.getPositionsInBonds(t+1);if(0===s.length)throw new Error(`Cannot find position for R group ${e}`);if(s.length>1)throw new Error(`More than one position for R group ${e}`);const n=s[0];return this.bonds.replacePositionsInBondsByDummy([n]),this.bonds.removeAtomIdFromBonds(t+1),this.removeRGroupFromAtomicIdxMap(e,t),n}removeRGroupFromAtomicIdxMap(e,t){this.rGroupIdToAtomicIndexMap.delete(e);for(const[e,s]of this.rGroupIdToAtomicIndexMap)s>t&&this.rGroupIdToAtomicIndexMap.set(e,s-1)}getRGroupIdToAtomicIdxMap(e){const t=new Map;e.filter((e=>e.startsWith("M RGP"))).forEach((e=>{const s=function(e){const t=e.split(/\s+/).filter((e=>e)).slice(3).map((e=>parseInt(e))),s=new Array(t.length/2);for(let e=0;e<t.length;e+=2)s[e/2]=[t[e+1],t[e]-1];return s}(e);for(const[e,n]of s){if(t.has(e))throw new Error(`R group ${e} is already in the map`);t.set(e,n)}}));const s=e.map(((e,t)=>{if(e.startsWith("A "))return t})).filter((e=>void 0!==e)),n=s.map((t=>e[t])),r=s.map((t=>e[t+1]));n.forEach(((e,s)=>{const n=parseInt(e.split(/\s+/)[1])-1,i=parseInt(r[s].substring(1));if(t.has(i))throw new Error(`R group ${i} is already in the map`);t.set(i,n)}));const i=this.atoms.getRGroupAtomicIndices().filter((e=>!Array.from(t.values()).includes(e)));if(0!==i.length)throw new Error(`Unaccounted R group indices: ${i}`);return t}deleteBondLineWithSpecifiedRGroup(e){const t=this.rGroupBondPositionMap.get(e);if(!t)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:s}=t;this.bonds.deleteBondLines([s]),this.rGroupBondPositionMap.delete(e),this.rGroupIdToAtomicIndexMap.delete(e),this.rGroupBondPositionMap.forEach((e=>{e.bondLineIdx>s&&(e.bondLineIdx-=1)}))}replaceRGroupWithAttachmentAtom(e,t){const s=this.rGroupBondPositionMap.get(e);if(!s)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:n,nodeIdx:r}=s;this.bonds.bondedAtoms[n][r]=t}getAttachmentAtomIdByRGroupId(e){const t=this.rGroupBondPositionMap.get(e);if(!t)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:s,nodeIdx:n}=t;return this.bonds.bondedAtoms[s][(n+1)%2]}capRGroups(e){this.rGroupIdToAtomicIndexMap.forEach(((t,s)=>{const n=e[s-1];"H"===n?(this.removeRGroups([s]),this.deleteBondLineWithSpecifiedRGroup(s)):this.atoms.replaceElementSymbol(t,n)}))}}class qe{constructor(e){this.bondedPairs=[],this.rawBondLines=[],this.rawBondLines=e,this.bondedPairs=this.rawBondLines.map((e=>[parseInt(e.substring(0,3)),parseInt(e.substring(3,6))]))}getBondLines(){return this.bondedPairs.map(((e,t)=>{if(e.some((e=>-1===e)))throw new Error(`Bonded pair ${e} contains -1`);return`${e[0].toString().padStart(3," ")}${e[1].toString().padStart(3," ")}${this.rawBondLines[t].substring(6)}`}))}get bondedAtoms(){return this.bondedPairs}deleteBondLines(e){this.rawBondLines=this.rawBondLines.filter(((t,s)=>!e.includes(s))),this.bondedPairs=this.bondedPairs.filter(((t,s)=>!e.includes(s)))}getPositionsInBonds(e){const t=[];return this.bondedPairs.forEach(((s,n)=>{s.forEach(((s,r)=>{s===e&&t.push({bondLineIdx:n,nodeIdx:r})}))})),t}replacePositionsInBondsByDummy(e,t){void 0===t&&(t=-1),e.forEach((e=>{const{bondLineIdx:s,nodeIdx:n}=e;this.bondedPairs[s][n]=t}))}removeAtomIdFromBonds(e){this.bondedPairs=this.bondedPairs.map((t=>t.map((t=>t>e?t-1:t))))}shift(e){this.bondedPairs=this.bondedPairs.map((t=>t.map((t=>t+e))))}}class Ze{constructor(e){this.coordinates=[],this.rawAtomLines=[],this.rawAtomLines=e,this.coordinates=this.rawAtomLines.map((e=>({x:parseFloat(e.substring(0,10)),y:parseFloat(e.substring(10,20))})))}get atomCoordinates(){return this.coordinates}get atomLines(){return this.rawAtomLines.map(((e,t)=>{const s=this.coordinates[t];return`${s.x.toFixed(4).padStart(10," ")}${s.y.toFixed(4).padStart(10," ")}${e.substring(20)}`}))}replaceElementSymbol(e,t){this.rawAtomLines[e]=this.rawAtomLines[e].replace("R#",t)}deleteAtoms(e){this.coordinates=this.coordinates.filter(((t,s)=>!e.includes(s))),this.rawAtomLines=this.rawAtomLines.filter(((t,s)=>!e.includes(s)))}shift(e){this.coordinates=this.coordinates.map((t=>{const s=t.x+e.x,n=t.y+e.y;if(isNaN(s)||isNaN(n))throw new Error(`Cannot shift coordinates by ${e.x}, ${e.y}`);return{x:s,y:n}}))}rotate(e){this.coordinates=this.coordinates.map((t=>{const s=t.x,n=t.y,r=s*Math.cos(e)-n*Math.sin(e),i=s*Math.sin(e)+n*Math.cos(e);if(isNaN(r)||isNaN(i))throw new Error(`Cannot rotate coordinates by ${e}`);return{x:r,y:i}}))}getRGroupAtomicIndices(){return this.rawAtomLines.map(((e,t)=>{if(e.includes("R#"))return t})).filter((e=>void 0!==e))}}class ze{constructor(e,t){this.monomerSymbol=t;const s=e.split("\n"),n=parseInt(s[3].substring(0,3)),r=parseInt(s[3].substring(3,6)),i=s.slice(4,4+n);this.atoms=new Ze(i);const o=s.slice(4+n,4+n+r);this.bonds=new qe(o),this.rGroups=new Ke(s,this.atoms,this.bonds),this.shiftMonomerToDefaultPosition()}deleteBondLineWithSpecifiedRGroup(e){this.rGroups.deleteBondLineWithSpecifiedRGroup(e)}shiftCoordinates(e){this.atoms.shift(e)}rotateCoordinates(e){this.atoms.rotate(e)}getBondLines(){return this.bonds.getBondLines()}getAtomLines(){return this.atoms.atomLines}removeRGroups(e){this.rGroups.removeRGroups(e)}replaceRGroupWithAttachmentAtom(e,t){this.rGroups.replaceRGroupWithAttachmentAtom(e,t)}getAttachmentAtomByRGroupId(e){return this.rGroups.getAttachmentAtomIdByRGroupId(e)}shiftR1GroupToOrigin(){const e=this.rGroups.getAtomicIdx(1);if(null===e)throw new Error(`Cannot find R1 group for monomer ${this.monomerSymbol}`);const{x:t,y:s}=this.atoms.atomCoordinates[e];this.atoms.shift({x:-t,y:-s})}alignR2AlongX(){const e=this.rGroups.getAtomicIdx(2);if(null===e)throw new Error(`Cannot find R2 group for monomer ${this.monomerSymbol}`);const t=this.atoms.atomCoordinates[e],s=t.y/t.x,n=Math.atan(s);if(isNaN(n))throw new Error(`Cannot calculate angle for R2 group for monomer ${this.monomerSymbol}`);this.rotateCoordinates(-n)}shiftMonomerToDefaultPosition(){this.shiftR1GroupToOrigin(),null!==this.rGroups.getAtomicIdx(2)&&this.alignR2AlongX()}shiftBonds(e){this.bonds.shift(e)}capRGroups(e){this.rGroups.capRGroups(e)}}class Xe{constructor(e){this.simplePolymer=e,this.polymerType=this.getPolymerType(),this.idx=this.getIdx();const{monomers:t,monomerTypes:s}=this.getMonomerSymbolsAndTypes();this.monomers=t,this.monomerTypes=s}get id(){return this.polymerType+this.idx.toString()}getPolymerType(){const e=new RegExp("(PEPTIDE|RNA)[0-9]+{"),t=this.simplePolymer.match(e);if(!t)throw new Error(`Unsupported polymer type in ${this.simplePolymer}`);return t[1]}getIdx(){const e=new RegExp(`${this.polymerType}([0-9]+){`),t=this.simplePolymer.match(e);if(!t)throw new Error(`Cannot parse simple polymer id from ${this.simplePolymer}`);return parseInt(t[1])}getMonomerSymbolsAndTypes(){const e=new RegExp(`${this.polymerType}${this.idx}{|}`,"g"),t=this.simplePolymer.replace(e,"").split("."),s=[],n=[];return t.forEach((e=>{const t=e.split(/\(|\)/).map((e=>e.replace(/[\[\]]/g,"")));s.push(...t);const r=t.map(((e,t)=>t%2==0?0:1));n.push(...r)})),{monomers:s,monomerTypes:n}}getBondData(){const e=[],t=this.monomerTypes.map(((e,t)=>{if(0===e)return t})).filter((e=>void 0!==e)),s=this.monomerTypes.map(((e,t)=>{if(1===e)return t})).filter((e=>void 0!==e));for(let s=0;s<t.length-1;s++){const n=t[s],r=t[s+1];e.push([{monomerIdx:n,rGroupId:2},{monomerIdx:r,rGroupId:1}])}for(let t=0;t<s.length;t++){const n=s[t],r=n-1;e.push([{monomerIdx:r,rGroupId:3},{monomerIdx:n,rGroupId:1}])}return e}}class Je{constructor(e){const t=e.split("|");t.forEach((e=>this.validateConnectionItem(e))),this.connectionItems=t}validateConnectionItem(e){const t="(PEPTIDE|RNA)",s=new RegExp(`${t}[0-9]+,${t}[0-9]+,[0-9]+:R[0-9]+-[0-9]+:R[0-9]+`,"g");if(!e.match(s))throw new Error(`Cannot parse connection item from ${e}`)}getConnectionData(){const e=[];return this.connectionItems.forEach((t=>{const s=[],n=t.split(",");n[2].split("-").forEach(((e,t)=>{const r=n[t],i=e.split(":"),o={monomerIdx:parseInt(i[0])-1,rGroupId:parseInt(i[1].slice(1))};s.push({polymerId:r,bond:o})})),e.push(s)})),e}}class Qe{constructor(e){this.helm=e;const t=this.helm.split("$"),s=t[0].split("|");this.simplePolymers=s.map((e=>new Xe(e))),""!==t[1]&&(this.connectionList=new Je(t[1])),this.bondData=this.getBondData()}toString(){return this.helm}getPolymerTypeByMonomerIdx(e){return this.getSimplePolymerByMonomerIdx(e).polymerType}getSimplePolymerByMonomerIdx(e){const t=this.getMonomerIdxShifts(),s=Object.values(t).sort(((e,t)=>e-t)).find((t=>e>=t));if(void 0===s)throw new Error(`Cannot find simple polymer for monomer ${e}`);const n=Object.keys(t).find((e=>t[e]===s));return this.simplePolymers.find((e=>e.id===n))}shiftBondMonomerIds(e,t){t.forEach((t=>{t.forEach((t=>{t.monomerIdx+=e}))}))}getMonomerIdxShifts(){const e={};let t=0;return this.simplePolymers.forEach((s=>{e[s.id]=t,t+=s.monomers.length})),e}getBondData(){const e=this.getMonomerIdxShifts(),t=[];return this.simplePolymers.forEach((s=>{const n=s.getBondData(),r=e[s.id];this.shiftBondMonomerIds(r,n),t.push(...n)})),this.connectionList&&this.connectionList.getConnectionData().forEach((s=>{const n=[];s.forEach((t=>{const s=e[t.polymerId],r=t.bond;r.monomerIdx+=s,n.push(r)})),t.push(n)})),t}}class et{constructor(e){this.monomerWrappers=[],this.helm=new Qe(e),this.bondedRGroupsMap=new Map,this.helm.bondData.forEach((e=>{e.forEach((e=>{const t=e.monomerIdx,s=e.rGroupId;this.bondedRGroupsMap.get(t)||this.bondedRGroupsMap.set(t,[]),this.bondedRGroupsMap.get(t).push(s)}))}))}addMonomer(e,t,s){const n=this.helm.getPolymerTypeByMonomerIdx(t),r=new Ye(e,n);r.shiftCoordinates(s),this.monomerWrappers.push(r)}removeRGroups(){this.monomerWrappers.forEach(((e,t)=>{this.bondedRGroupsMap.has(t)&&e.removeBondedRGroups(this.bondedRGroupsMap.get(t)),e.capTrailingRGroups()}))}getAtomNumberShifts(){const e=[];let t=0;return this.monomerWrappers.forEach((s=>{e.push(t),t+=s.getAtomLines().length})),e}restoreBondsBetweenMonomers(){this.helm.bondData.forEach((e=>{const t=e.map((e=>e.monomerIdx)),s=e.map((e=>e.rGroupId)),n=t.map((e=>this.monomerWrappers[e])),r=n[1].getAttachmentAtomByRGroupId(s[1]);n[0].replaceRGroupWithAttachmentAtom(s[0],r),n[1].deleteBondLineWithSpecifiedRGroup(s[1])}))}compileToMolfile(){const e=[],t=[];this.removeRGroups();const s=this.getAtomNumberShifts();this.monomerWrappers.forEach(((e,t)=>{e.shiftBonds(s[t])})),this.restoreBondsBetweenMonomers(),this.monomerWrappers.forEach((s=>{e.push(...s.getAtomLines()),t.push(...s.getBondLines())}));const n=e.length;if(n>999)throw new Error(`Atom count in polymer ${this.helm.toString()} is ${n} and exceeds 999`);const r=t.length;return["\nDatagrok\n",`${n.toString().padStart(3," ")}${r.toString().padStart(3," ")} 0 0 1 0 0 V2000`,e.join("\n"),t.join("\n"),"M END\n"].join("\n")}}a.DataFrame.fromCsv("seq,value\nATCCGTCGT,0.5\nTGTTCGTCA,0.4\nATGGTCGTA,0.7\nATCCGTGCA,0.1"),["1","1A","1C","2","4","4A","4B","5","6"].join(ce.CI);var tt=s(8601),st=s(3277);function nt(e){const t=["Embed_X","Embed_Y"],s=e.columns.names().filter((e=>e.includes(t[0]))).length+1;return t.map((e=>`${e}_${s}`))}const rt=new We;function it(){return Le.A.instance}function ot(){return Le.A.instance.getBioLib()}async function at(e,t,n,r,u,d,m,p){if(!(0,Ge.n)(t,"Activity Cliffs"))return;const f=nt(e),g={units:t.getTag(a.TAGS.UNITS),aligned:t.getTag("aligned"),separator:t.getTag("separator"),alphabet:t.getTag("alphabet")},y=d,w=t,b=async()=>await async function(e,t,n,r,l,u,d,m,p,f,g,y,w,b,C,v){O++;const T=u/100;let A,S=!1;const _=y.inputs,E=await y.apply({[_[0].name]:t,[_[1].name]:d,...p.preprocessingFuncArgs??{}});let P=[];if(m===c){const t=await function(e,t,n,r,i,o,a=10){const l=new Worker(new URL(s.p+s.u(709),s.b));let c;return l.postMessage({data:e,threshold:t,weights:n,aggregationMethod:r,distanceFns:i,distanceFnArgs:o,maxIterations:a}),{promise:new Promise(((e,t)=>{c=e,l.onmessage=t=>{setTimeout((()=>l.terminate()),100),e(t.data.res)},l.onerror=e=>{setTimeout((()=>l.terminate()),100),t(e)}})),terminate:()=>{try{c(null),l.terminate()}catch(e){console.error(e)}}}}([E.entries],u,[1],"MANHATTAN",[d],[E.options??{}],p?.maxIterations??5).promise;e.columns.addNewInt(e.columns.getUnusedName("MCL Cluster")).init((e=>t.clusters[e])),P=[t.embedX,t.embedY]}else P=await R([E.entries],m,[d],[1],"MANHATTAN",{...p,distanceFnArgs:[E.options??{}]});if(P.length!==n.length)throw new Error("Number of axes names should be equal to number of embedding dimensions");for(let t=0;t<P.length;++t)e.columns.addNewFloat(n[t]).init((e=>P[t][e]));const N=await(new $).calc(E.entries,d,T,E.options),L=await async function(e,t){const s=e.distance.map(((s,n)=>{const r=Math.abs(t.get(e.i[n])-t.get(e.j[n]));return 0!=s?r/s:1/0})),n=e.distance.map((e=>1-e)),r=e.i,i=e.j,o=new Set;return e.distance.forEach(((t,s)=>{o.add(e.i[s]),o.add(e.j[s])})),{simVals:n,saliVals:s,n1:r,n2:i,cliffsMolIds:o}}(N,l),I=function(e,t,s,n,r,i){const o=new Array(e).fill(0);for(let e=0;e!=s.length;++e)t[e]!=1/0&&(i.get(s[e])>i.get(n[e])?o[s[e]]+=t[e]:o[n[e]]+=t[e]);return a.Column.fromList("double",`sali_${r[0].substring(r[0].lastIndexOf("_"))}`,o)}(t.length,L.saliVals,L.n1,L.n2,n,l);e.columns.add(I);const U=function(e,t){const s=a.BitSet.create(e.rowCount);for(let n=0;n<e.rowCount;n++)s.set(n,t.has(n));return s}(e,L.cliffsMolIds),j=function(e){const t=e.filter((e=>e!==1/0)),s=t.reduce(((e,t)=>Math.min(e,t)),Number.MAX_VALUE),n=t.reduce(((e,t)=>Math.max(e,t)),s);return{max:n,min:s}}(L.saliVals),Y=.8/(j.max-j.min),K=i.shell.getTableView(e.name),q=K.addViewer(a.VIEWER.SCATTER_PLOT,{xColumnName:n[0],yColumnName:n[1],size:I.name,color:l.name,showXSelector:!1,showYSelector:!1,showSizeSelector:!1,showColorSelector:!1,markerMinSize:5,markerMaxSize:25,title:r}),Z=function(e,t,s,n,r,i,o,l){const c={from:new Uint32Array(t.n1.length),to:new Uint32Array(t.n1.length),opacities:new Float32Array(t.n1.length),colors:new Array(t.n1.length),widths:new Float32Array(t.n1.length)};for(let s=0;s<t.n1.length;s++)c.from[s]=t.n1[s],c.to[s]=t.n2[s],c.opacities[s]=t.saliVals[s]===1/0?1:.2+(t.saliVals[s]-o.min)*l,c.colors[s]=e.selection.get(c.from[s])&&e.selection.get(c.to[s])?"255,255,0":"0,128,0",c.widths[s]=1;const h=a.DataFrame.create(c.from.length);return B.forEach(((e,t)=>{h.columns.addNewString(e).init((e=>s.get(0===t?c.from[e]:c.to[e]))),function(e,t){Object.keys(t).forEach((s=>{e.tags[s]=t[s]}))}(h.col(e),i),h.col(e).semType=r})),h.columns.addNewFloat(D).init((e=>Math.abs(n.get(c.from[e])-n.get(c.to[e])))),h.columns.addNewInt(W).init((e=>e)),h.columns.addNewFloat(G).init((e=>t.saliVals[e])),h.columns.addNewFloat(H).init((e=>t.simVals[e])),h.name=`${k}${O}`,{lines:c,linesDf:h}}(e,L,t,l,f,g,j,Y);Z.lines.skipMultiLineCalculation=!0,Z.linesDf.col(G).setTag("description","Structure−Activity Landscape Index (activity difference divided by 1 minus similarity)");const z=new M(q,n[0],n[1],Z.lines,x.none),X=C?C(Z.linesDf,B).sort([G],[!1]):Z.linesDf.plot.grid().sort([G],[!1]);X.col(W)&&(X.col(W).visible=!1),e.temp[".cliffsDfGrid"]=X;const J=o.button(`${Z.linesDf.rowCount} cliffs`,(()=>{K.dockManager.dock(X,"down",null,"Activity cliffs",v??.2)}));J.classList.add("scatter_plot_link","cliffs_grid"),q.root.append(J);const Q=o.switchInput("Show only cliffs",!1,(()=>{Q.value?(q.dataFrame.setTag(V,n[0]),e.filter.and(U),F.next(n[0])):(q.dataFrame.setTag(V,""),e.filter.setAll(!0),F.next(""))}));Q.root.classList.add("scatter_plot_link","show_only_cliffs"),q.root.append(Q.root),F.subscribe((e=>{Q.enabled=""===e||e===n[0]}));let ee=!1;q.onEvent("d4-before-draw-scene").subscribe((t=>{ee?ee=!1:Q.value&&(setTimeout((()=>{e.filter.and(U)}),100),ee=!0)}));const te=i.events.onViewerClosed.subscribe((e=>{e.args.viewer===q&&(K.dockManager.close(X.root),te.unsubscribe(),K.subs=K.subs.filter((e=>e!==te)))}));return K.subs.push(te),Z.linesDf.onCurrentCellChanged.subscribe((()=>{for(let e=0;e<Z.linesDf.rowCount;e++)Z.lines.widths[e]=e===Z.linesDf.currentRowIdx?3:1;z.linesToRender=Z.lines;const s=Z.linesDf.currentCol&&Z.linesDf.currentCol.name===B[1]?Z.lines.to:Z.lines.from,r=-1!==Z.linesDf.currentRowIdx?Z.linesDf.currentRowIdx:null;if(q.dataFrame.currentRowIdx=r?s[r]:-1,null!==r){const s=Z.linesDf.currentRowIdx;z.currentLineId=s;const{zoomLeft:a,zoomRight:c,zoomTop:h,zoomBottom:u}=function(e,t,s,n,r,i){const o=Math.abs(s-r),a=Math.abs(n-i),l=e/o,c=t/a,h=Math.min(l,c),u=e/h*5,d=t/h*5,m=(s<r?s:r)+o/2-u/2,p=(n>i?n:i)-a/2+d/2;return{zoomLeft:m,zoomRight:m+u,zoomTop:p,zoomBottom:p-d}}(q.viewport.width,q.viewport.height,q.dataFrame.get(n[0],Z.lines.from[s]),q.dataFrame.get(n[1],Z.lines.from[s]),q.dataFrame.get(n[0],Z.lines.to[s]),q.dataFrame.get(n[1],Z.lines.to[s]));q.zoom(a,h,c,u),Q.value?e.filter.and(U):!0===Q.enabled&&e.filter.setAll(!0),setTimeout((()=>{!function(e,t,s,n,r,a,l,c,h){const u=t.getPane("Cliff Details");o.empty(u.root);const d=h({points:[s,n],lineId:r,df:e,seqCol:a,activityCol:l,sali:c});u.root.append(d),setTimeout((()=>{i.shell.o=t.root}),500)}(e,A,Z.lines.from[r],Z.lines.to[r],r,t,l,Z.linesDf.get(G,r),b);const s=q.dataFrame.getSortedOrder(K.grid.sortByColumns,K.grid.sortTypes);K.grid.scrollToCell(t.name,s.indexOf(q.dataFrame.currentRowIdx))}),1e3)}})),Z.linesDf.onSelectionChanged.subscribe((t=>{setTimeout((()=>(()=>{const t=a.BitSet.create(e.rowCount);for(let e=0;e<Z.linesDf.rowCount;e++){const s=Z.linesDf.selection.get(e);s&&(t.set(Z.lines.from[e],!0),t.set(Z.lines.to[e],!0)),Z.lines.colors[e]=s?"255,255,0":"0,128,0"}e.selection.copyFrom(t),z.linesToRender=Z.lines})()),100)})),e.onSelectionChanged.subscribe((t=>{!1===e.selection.anyTrue&&"number"==typeof t&&(S?S=!1:(e=>{e.selection.setAll(!1);for(let e=0;e<Z.lines.colors.length;e++)Z.lines.colors[e]="0,128,0";z.linesToRender=Z.lines})(X.dataFrame))})),z.lineClicked.subscribe((t=>{if(S=!0,z.currentLineId=t.id,-1!==t.id){const s=Z.linesDf.selection.clone();setTimeout((()=>{t.event.ctrlKey?(s.set(t.id,!s.get(t.id)),Z.linesDf.selection.copyFrom(s)):(Z.linesDf.currentRowIdx!==t.id&&(Z.linesDf.currentRowIdx=t.id,e.currentRowIdx=Z.lines.from[t.id]),Z.linesDf.selection.copyFrom(s));const n=Z.linesDf.getSortedOrder(X.sortByColumns,X.sortTypes);X.scrollToCell(B[0],n.indexOf(t.id))}),500)}})),z.lineHover.pipe((0,h.debounceTime)(500)).subscribe((s=>{-1!==s.id&&-1===e.mouseOverRowIdx&&o.tooltip.show(w({lineId:s.id,points:[Z.lines.from[s.id],Z.lines.to[s.id]],df:e,seqCol:t,activityCol:l}),s.x,s.y)})),q.addProperty("similarityLimit","double",T),A=function(){const e=o.accordion(),t=o.element("i");return t.className="grok-icon svg-icon svg-view-layout",e.addTitle(o.span([t,o.label("Activity cliffs")])),e.addPane("Cliff Details",(()=>o.divText("Cliff has not been selected")),!0),i.shell.o=e.root,e}(),q}(e,w,f,"Activity cliffs",n,r,y,u,{...p??{}},a.SEMTYPE.MACROMOLECULE,g,m,Pe,$e,Ne),C=u===l.A.UMAP?2e5:2e4,v=u===l.A.UMAP?5e3:2e3;if(e.rowCount>C)return void i.shell.warning(`Too many rows, maximum for sequence activity cliffs is ${C}`);const T=a.TaskBarProgressIndicator.create("Running sequence activity cliffs ...");return new Promise(((t,s)=>{e.rowCount>v&&!p?.[st.sS]?o.dialog().add(o.divText("Activity cliffs analysis might take several minutes.\n Do you want to continue?")).onOK((async()=>{b().then((e=>t(e))).catch((e=>s(e)))})).onCancel((()=>{t(void 0)})).show():b().then((e=>t(e))).catch((e=>s(e)))})).catch((e=>{const[t,s]=(0,X.yf)(e);throw rt.logger.error(t,void 0,s),e})).finally((()=>{T.close()}))}async function lt(e,t,n,r,l,c,h,u){if((0,Ge.n)(t,"Sequence Space"))return c||(c=a.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0]),h??(h={}),await async function(e,t,n,r,l,c,h,u=!0,d=!1,m={preprocessingFuncArgs:[]},p={}){const f={showXAxis:!1,showYAxis:!1,showXSelector:!1,showYSelector:!1};if(t.length!==r.length||t.length!==c.length||t.length!==l.length||t.length!==m.preprocessingFuncArgs.length)throw new Error("columns, metrics and preprocessing functions, weights and function argumentsmust have the same length");const g=i.shell.tableView(e.name)??i.shell.addTableView(e),y=async()=>{const y=a.TaskBarProgressIndicator.create(`Initializing ${p.scatterPlotName??"dimensionality reduction"} ...`);let w;try{const b=nt(e);function C(t,s,n){let r=null,i=null;e.columns.names().includes(b[0])?(r=e.columns.byName(b[0]),i=e.columns.byName(b[1])):(r=e.columns.add(a.Column.float(b[0],e.rowCount)),i=e.columns.add(a.Column.float(b[1],e.rowCount)),u&&!w&&(w=g.scatterPlot({...f,x:b[0],y:b[1],title:p.scatterPlotName??"Embedding space"}))),p[st.Ec]&&(w?.root&&o.setUpdateIndicator(w.root,!1),r.init((e=>n[0]?n[0][e]:void 0)),i.init((e=>n[1]?n[1][e]:void 0)));const l=t/s*100;y.update(l,`Running ${p.scatterPlotName??"dimensionality reduction"}... ${l.toFixed(0)}%`)}async function v(){e.columns.add(a.Column.float(b[0],e.rowCount)),e.columns.add(a.Column.float(b[1],e.rowCount));let s=null;u&&(w=g.scatterPlot({...f,x:b[0],y:b[1],title:p.scatterPlotName??"Embedding space"}),o.setUpdateIndicator(w.root,!0));const d=i.events.onViewerClosed.subscribe((e=>{const t=e.args.viewer;t?.getOptions()?.look?.title&&w?.getOptions()?.look?.title&&t?.getOptions()?.look?.title===w?.getOptions()?.look?.title&&(i.events.fireCustomEvent(L,{}),d.unsubscribe(),s?.(),y.close())})),v=new Promise((async(e,i)=>{try{s=e;const i=[];for(let e=0;e<c.length;++e){const s=c[e];if(m.distanceFnArgs||(m.distanceFnArgs=[]),s){const n=s.inputs[0].name,o=s.inputs[1].name,{entries:a,options:l}=await s.apply({[n]:t[e],[o]:r[e],...m.preprocessingFuncArgs[e]??{}});i.push({entries:a,options:l}),m.distanceFnArgs.push(l)}else{const s=t[e].toList(),n={};i.push({entries:s,options:n}),m.distanceFnArgs.push(n)}}e(await R(i.map((e=>e.entries)),n,r,l,h,m,p[st.sS]?void 0:C))}catch(e){i(e)}})),T=await v;return y.close(),d.unsubscribe(),T}const T=await v();if(d&&T){const A=a.TaskBarProgressIndicator.create("Clustering embeddings ...");try{const S=await function(e,t,n,r){return De(this,void 0,void 0,(function*(){return new Promise((function(i,o){const a=new Worker(new URL(s.p+s.u(796),s.b));a.postMessage({embedX:e,embedY:t,minPts:r,epsilon:n}),a.onmessage=({data:{error:e,clusters:t}})=>{a.terminate(),e?o(e):i(t)}}))}))}(T[0],T[1],m.dbScanEpsilon??.01,m.dbScanMinPts??4),_=e.columns.getUnusedName("Cluster");e.columns.addNewString(_).init((e=>S[e].toString())),w&&(w.props.colorColumnName=_)}catch(E){i.shell.error("Clustering embeddings failed"),console.error(E)}finally{A.close()}}if(T&&u&&w){o.setUpdateIndicator(w.root,!1);const P=e.columns.byName(b[0]),$=e.columns.byName(b[1]);return P.init((e=>T[0][e])),$.init((e=>T[1][e])),w.helpUrl="/help/compute/sequence-space",w}}catch(x){i.shell.error("Dimensionality reduction failed"),console.error(x),y.close(),w&&o.setUpdateIndicator(w.root,!1)}};return new Promise((async(t,s)=>{try{if(p.fastRowCount&&e.rowCount>p.fastRowCount&&!p[st.sS])o.dialog().add(o.divText("Analysis might take several minutes. Do you want to continue?")).onOK((async()=>{try{const e=await y();t(e)}catch(e){s(e)}})).onCancel((()=>t(void 0))).show();else{const e=await y();t(e)}}catch(e){s(e)}}))}(e,[t],n,[r],[1],[c],"MANHATTAN",l,u??!1,{...h,preprocessingFuncArgs:[h.preprocessingFuncArgs??{}]},{fastRowCount:1e4,scatterPlotName:"Sequence space",bypassLargeDataWarning:h?.[st.sS]})}async function ct(e,t,s){const n=a.TaskBarProgressIndicator.create("Converting to atomic level ...");try{await async function(e,t,s){if(0===a.Func.find({package:"Chem",name:"getRdKitModule"}).length)return void i.shell.warning('Transformation to atomic level requires package "Chem" installed.');if(s){const s=j.Cn.getOrCreate(t);return s.isHelm()||(t=s.convert(ce.r2.HELM)),void async function(e,t){const s=await async function(e,t){const s=new Ue(t,e),n=await s.convertToRdKitBeautifiedMolfileColumn();return n.semType=a.SEMTYPE.MOLECULE,n}(e,t);e.columns.add(s,!0),await i.data.detectSemanticTypes(e)}(e,t)}if(!(0,Ge.n)(t,"To Atomic Level"))return;const n=it().getBioLib(),r=await(0,tt.i0)(e,t,n);null!==r.col&&(e.columns.add(r.col,!0),await i.data.detectSemanticTypes(e)),r.warnings&&r.warnings.length>0&&i.shell.warning(o.list(r.warnings))}(e,t,s)}finally{n.close()}}function ht(e){return new Y.i(e).importFasta()}function ut(e){const t=j.Cn.getOrCreate(e).stats;return Object.keys(t.freq)}async function dt(e,t,s){return z(e,t,s,U.IDENTITY)}async function mt(e,t,s){return z(e,t,s,U.SIMILARITY)}},7983:(e,t,s)=>{"use strict";s.d(t,{QF:()=>c,pf:()=>l});var n=s(4469),r=(s(3870),s(976)),i=s(7241),o=(s(4293),s(8467)),a=s(8447);function l(e,t,s){const n=s?function(e,t){const s=`${t}`.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),n=e.charAt(0)===t,r=e.charAt(e.length-1)===t,i=e.replace(new RegExp(`^${s}|${s}$`,"g"),"");return n?r?`${s}${i}${s}`:`${s}${i}${s}|${s}${i}$`:r?`^${i}${s}|${s}${i}${s}`:`^${i}${s}|${s}${i}${s}|${s}${i}$`}(e,s):e,i=r.BitSet.create(t.length);for(let s=0;s<t.length;s++){const r=t.get(s);(r.match(n)||r===e)&&i.set(s,!0,!1)}return i}async function c(e,t){t.version!==t.temp["last-invalidated-version"]&&await async function(e,t){const s=r.TaskBarProgressIndicator.create(`Invalidating molfiles for ${e.name}`);try{await(0,o.gw)(10);const t=new Map,s=await(0,i.D)(e,!0,t);e.temp["monomeric-mols"]=s,e.temp["monomers-dict"]=t,e.temp["last-invalidated-version"]=e.version}finally{s.close()}}(t);const s=r.Column.string("helm",1).init((t=>e));s.semType=r.SEMTYPE.MACROMOLECULE,s.setTag(r.TAGS.UNITS,a.r2.HELM);const l=await(0,i.D)(s,!0,t.temp["monomers-dict"]);return(await n.functions.call("Chem:searchSubstructure",{molStringsColumn:t.temp["monomeric-mols"],molString:l.get(0),molBlockFailover:""})).get(0)}},2568:(e,t,s)=>{"use strict";s.d(t,{l:()=>a,n:()=>o});var n=s(4469),r=s(976),i=s(499);function o(e,t,s=[],r=[],i=!0){const[o,l]=a(e,t,s,r);return i&&!o&&n.shell.warning(l),o}function a(e,t,s=[],o=[]){let a=!0,l="";const c=i.Cn.getOrCreate(e);if(e.semType!==r.SEMTYPE.MACROMOLECULE)n.shell.warning(t+" analysis is allowed for Macromolecules semantic type"),a=!1;else{const e=c.notation;if(s.length>0&&!s.some((t=>e.toUpperCase()==t.toUpperCase())))l=`${t} + ' analysis is allowed for Macromolecules with notation ${0==s.length?"any notation":`notation${s.length>1?"s":""} ${s.map((e=>`"${e}"`)).join(", ")} `}.`,a=!1;else if(!c.isHelm()){const e=c.alphabet;o.length>0&&!o.some((t=>e.toUpperCase()==t.toUpperCase()))&&(l=`${t} + ' analysis is allowed for Macromolecules with alphabet ${0==o.length?"any alphabet":`alphabet${o.length>1?"s":""} ${o.map((e=>`"${e}"`)).join(", ")}.`}.`,a=!1)}}return[a,l]}},3553:(e,t,s)=>{"use strict";s.d(t,{Of:()=>i,WY:()=>h,jB:()=>u,mU:()=>a,rs:()=>c});var n,r,i,o=s(8341);!function(e){e.SPLIT_COL="~split",e.ACTIVITY="~activity",e.ACTIVITY_SCALED="activity_scaled",e.ALIGNED_SEQUENCE="~aligned_sequence",e.AMINO_ACID_RESIDUE="AAR",e.POSITION="Pos",e.P_VALUE="pValue",e.MEAN_DIFFERENCE="Mean difference"}(n||(n={})),function(e){e.AAR="AAR",e.POSITION="Pos",e.SELECTION="selection"}(r||(r={})),function(e){e.MONOMER="Monomer",e.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference",e.ACTIVITY="activity",e.ACTIVITY_SCALED="activityScaled"}(i||(i={}));const a="MSA";var l,c;!function(e){e.CELL_CHANGING="isCellChanging"}(l||(l={})),function(e){e.SEPARATOR="."}(c||(c={}));const h="3.3.1",u={pepsea:{gapOpen:1.53,gapExtend:0,method:o.Jy[0]},kalign:{gapOpen:-1,gapExtend:-1,terminalGap:-1}}},4004:(e,t,s)=>{"use strict";s.d(t,{o:()=>i}),s(976),s(3870);var n=s(4469),r=(s(3336),s(8447),s(499));async function i(e,t,s){const i=r.Cn.getOrCreate(e).convert(t,s);e.dataFrame.columns.add(i);const o=await n.functions.call("Bio:detectMacromolecule",{col:i});return o&&(i.semType=o),await n.data.detectSemanticTypes(e.dataFrame),i}},7572:(e,t,s)=>{"use strict";s.d(t,{A:()=>h});var n=s(4469),r=s(6584),i=s(2832),o=s(3776),a=s(2428),l=s(2265);async function c(){const e=a.A.getInstance();return(await o.t.getInstance(e)).getValidLibraryPaths()}class h{constructor(){this._monomerLib=new i.B({}),this.loadLibrariesPromise=Promise.resolve()}getBioLib(){return this._monomerLib}async loadLibraries(e=!1){return this.loadLibrariesPromise=this.loadLibrariesPromise.then((async()=>{try{const[t,s]=await Promise.all([c(),(0,r.nW)()]),n=t.filter((e=>!s.exclude.includes(e))).filter((e=>!(s.explicit.length>0)||s.explicit.includes(e))),o=await Promise.all(n.map((e=>this.readLibrary(r.BX,e).catch((t=>{const s=`Loading monomers from '${e}' error: ${t instanceof Error?t.message:t.toString()}`;return new i.B({},s)})))));this._monomerLib.updateLibs(o,e)}catch(e){const t=`Loading monomer libraries error: ${e instanceof Error?e.message:e.toString()}`;n.shell.warning(t);const s=e instanceof Error?e.stack:void 0;l._package.logger.error(t,void 0,s)}}))}async readLibrary(e,t){const s=a.A.getInstance(),n=await o.t.getInstance(s);return await n.loadLibraryFromFile(e,t)}async selectSpecifiedLibraries(e){const t=await this.getInvalidFileNames(e);if(t.length>0)throw new Error(`Cannot select libraries ${t}: no such library in the list`);const s=await(0,r.nW)();s.exclude=(await c()).filter((t=>!e.includes(t))),await(0,r.tW)(s)}async getInvalidFileNames(e){const t=await c();return e.filter((e=>!t.includes(e)))}static get instance(){return window.$monomerLibHelper||(window.$monomerLibHelper=new h),window.$monomerLibHelper}}},2428:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});var n=s(701);class r{constructor(){this._libraryFilesUpdateSubject$=new n.BehaviorSubject([]),this._addLibraryFilesSubject$=new n.Subject,this._librarySelectionSubject$=new n.Subject}static getInstance(){return r._instance||(r._instance=new r),r._instance}getValidFilesPathList(){return this._libraryFilesUpdateSubject$.getValue()}changeValidFilesPathList(e){this._libraryFilesUpdateSubject$.next(e)}get updateUIControlsRequested$(){return this._libraryFilesUpdateSubject$.pipe()}get updateValidLibraryFileListRequested$(){return this._libraryFilesUpdateSubject$.pipe()}get addLibraryFileRequested$(){return this._addLibraryFilesSubject$.pipe()}addLibraryFile(){this._addLibraryFilesSubject$.next()}get librarySelectionRequested$(){return this._librarySelectionSubject$}updateLibrarySelectionStatus(e,t){this._librarySelectionSubject$.next([e,t])}}},3776:(e,t,s)=>{"use strict";s.d(t,{t:()=>m});var n=s(4469),r=s(976),i=s(6584),o=s(2832),a=s(5128),l=s.n(a),c=s(3351),h=s.n(c);class u{constructor(e){this.helmMonomerSchema=e;const t=new(l())({allErrors:!0,strictTuples:!1});h()(t),this.validateMonomerSchema=t.compile(this.helmMonomerSchema)}validateFile(e,t){const s=this.parseJson(e);return null!==s&&(Array.isArray(s)?this.validateJsonContent(s,t):(console.warn("Bio: Monomer Library File Validator: Invalid JSON format: The file must contain an array of monomers."),!1))}parseJson(e){try{return JSON.parse(e)}catch(e){return console.error("Bio: Monomer Library File Validator: Invalid JSON format:",e),null}}validateJsonContent(e,t){let s=!0;for(const n of e)if(s=this.validateMonomerSchema(n),!s){console.warn(`Bio: Monomer Library File Validator:\nfile${t}\n monomer violating JSON schema:`,n,"\nError reason: ",this.validateMonomerSchema.errors,`\nThere may be other errors in ${t} since the validation is stopped after the first error.`," Please, verify that the monomer library file satisfies the JSON schema");break}return s}}var d=s(7572);class m{constructor(e,t){this.libraryFileValidator=e,this.libraryEventManager=t,this.libraryEventManager.updateValidLibraryFileListRequested$.subscribe((async()=>{await this.updateValidLibraryList()}))}static async getInstance(e){if(void 0===m.instance){const t=await n.dapi.files.readAsText("System:AppData/Bio/tests/libraries/HELMmonomerSchema.json"),s=JSON.parse(t),r=new u(s);m.instance=new m(r,e)}return m.instance}async addLibraryFile(e,t){try{if(await this.libraryFileExists(t))return void n.shell.error(`File ${t} already exists`);await this.validateAgainstHELM(e,t),await n.dapi.files.writeAsText(i.BX+`${t}`,e),await this.updateValidLibraryList(),await n.dapi.files.exists(i.BX+`${t}`)?n.shell.info(`Added ${t} HELM library`):n.shell.error(`Failed to add ${t} library`)}catch(e){console.error(e),n.shell.error(`Failed to add ${t} library`)}}async deleteLibraryFile(e){try{await n.dapi.files.delete(i.BX+`${e}`),await this.updateValidLibraryList(),n.shell.info(`Deleted ${e} library`)}catch(t){console.error(t),await n.dapi.files.exists(i.BX+`${e}`)?n.shell.error(`Failed to delete ${e} library`):n.shell.warning(`File ${e} already deleted, refresh the list`)}}async loadLibraryFromFile(e,t){let s=[];const n=new r.FileSource(e),i=await n.readAsText(t);s=JSON.parse(i);const a={},l=[];return s.forEach((e=>{l.includes(e.polymerType)||(a[e.polymerType]={},l.push(e.polymerType)),a[e.polymerType][e.symbol]=e})),new o.B(a)}getValidLibraryPaths(){return this.libraryEventManager.getValidFilesPathList()}async libraryFileExists(e){return await n.dapi.files.exists(i.BX+`${e}`)}async updateValidLibraryList(){const e=[],t=await this.getFilePathsAtDefaultLocation();if(!this.fileListHasChanged(t))return;for(const s of t){if(!s.endsWith(".json")){e.push(s);continue}const t=await n.dapi.files.readAsText(i.BX+`${s}`);this.isValidHELMLibrary(t,s)||e.push(s)}const s=t.filter((t=>!e.includes(t)));if(this.fileListHasChanged(s)&&(this.libraryEventManager.changeValidFilesPathList(s),d.A.instance.loadLibraries(!0)),s.some((e=>!e.endsWith(".json")))&&console.warn(`Wrong validation: ${s}`),e.length>0){const t=`Invalid monomer library files in ${i.BX}, consider fixing or removing them: ${e.join(", ")}`;console.warn(t),n.shell.warning(t)}}fileListHasChanged(e){const t=this.libraryEventManager.getValidFilesPathList();return e.length!==t.length||e.some(((e,s)=>e!==t[s]))}async validateAgainstHELM(e,t){if(!this.isValidHELMLibrary(e,t))throw new Error(`File ${t} does not satisfy HELM standard`)}isValidHELMLibrary(e,t){return this.libraryFileValidator.validateFile(e,t)}async getFilePathsAtDefaultLocation(){const e=(await n.dapi.files.list(i.BX)).map((e=>e.fullPath)),t=[];for(const s of e)await n.dapi.files.exists(s)&&t.push(s);return t.map((e=>e.substring(i.BX.length)))}}},2832:(e,t,s)=>{"use strict";s.d(t,{B:()=>i});var n=s(701),r=s(922);class i{constructor(e,t){this._monomers={},this._onChanged=new n.Subject,this._monomers=e,this.error=t}getMonomer(e,t){return e in this._monomers&&t in this._monomers[e]?this._monomers[e][t]:null}getPolymerTypes(){return Object.keys(this._monomers)}getMonomerMolsByPolymerType(e){const t={};return Object.keys(this._monomers[e]??{}).forEach((s=>{t[s]=this._monomers[e][s].molfile})),t}getMonomerSymbolsByType(e){return Object.keys(this._monomers[e])}getMonomerSymbolsByRGroup(e,t,s){let n=this.getMonomerSymbolsByType(t).map((e=>this.getMonomer(t,e)));return n=n.filter((e=>null!==e)),0===n.length?[]:(n=n.filter((t=>{if(!t?.rgroups)return!1;let s=t?.rgroups.length>=e;return r._.getInstance(t.molfile).atomTypes.map(((e,t)=>"R#"===e?t:-1)).filter((e=>-1!==e)),s&&(s=!0),s})),n.map((e=>e?.symbol)))}get onChanged(){return this._onChanged}_updateInt(e){const t=e.getPolymerTypes(),s=this.getPolymerTypes();t.forEach((t=>{s.includes(t)||(this._monomers[t]={}),e.getMonomerSymbolsByType(t).forEach((s=>{this._monomers[t][s]=e.getMonomer(t,s)}))}))}update(e){this._updateInt(e),this._onChanged.next()}updateLibs(e,t=!1){t&&(this._monomers={});for(const t of e)t.error||this._updateInt(t);this._onChanged.next()}clear(){this._monomers={},this._onChanged.next()}}},525:(e,t,s)=>{"use strict";s.d(t,{K:()=>$});var n=s(4469),r=s(976),i=s(3870),o=s(8447),a=s(499),l=s(6098),c=s(8341),h=s(2568),u=s(3553),d=s(2265),m=s(3379),p=s.n(m),f=s(7795),g=s.n(f),y=s(569),w=s.n(y),b=s(3565),C=s.n(b),v=s(9216),T=s.n(v),A=s(4589),S=s.n(A),_=s(9564),E={};E.styleTagTransform=S(),E.setAttributes=C(),E.insert=w().bind(null,"head"),E.domAPI=g(),E.insertStyleElement=T(),p()(_.Z,E),_.Z&&_.Z.locals&&_.Z.locals;class P extends Error{constructor(e,t){super(e,t)}}async function $(e={}){return new Promise((async(t,s)=>{var o,a,l;e.clustersCol??(e.clustersCol=null),e.pepsea??(e.pepsea={}),(o=e.pepsea).method??(o.method=u.jB.pepsea.method),(a=e.pepsea).gapOpen??(a.gapOpen=u.jB.pepsea.gapOpen),(l=e.pepsea).gapExtend??(l.gapExtend=u.jB.pepsea.gapExtend);const h=e.col?.dataFrame??n.shell.t,d=e.col??h.columns.bySemType(r.SEMTYPE.MACROMOLECULE);if(null==d){const e="MSAError: dataset doesn't conain any Macromolecule column";n.shell.warning(e),s(new P(e))}const m=i.choiceInput("Method",e.pepsea.method,c.Jy);m.setTooltip("Alignment method");const p=i.floatInput("Terminal gap",e?.kalign?.terminalGap??null);p.setTooltip("Penalty for opening a gap at the beginning or end of the sequence");const f=i.p(`Kalign version: ${u.WY}`,"kalign-version"),g=i.floatInput("Gap open",e.pepsea.gapOpen);g.setTooltip("Gap opening penalty at group-to-group alignment");const y=i.floatInput("Gap extend",e.pepsea.gapExtend);y.setTooltip("Gap extension penalty to skip the alignment");const w=i.inputs([g,y,p]),b=i.button("Alignment parameters",(()=>{w.hidden=!w.hidden}),"Adjust alignment parameters such as penalties for opening and extending gaps");b.classList.add("msa-params-button"),w.hidden=!0,b.prepend(i.icons.settings((()=>null)));const C=[m.root.style],v=[p.root.style,f.style];let T;const A=i.columnInput("Sequence",h,d,(async()=>{T=await N(A.value,h,C,v,m,S,g,y,p)}),{filter:e=>e.semType===r.SEMTYPE.MACROMOLECULE});A.setTooltip("Sequences column to use for alignment");const S=i.columnInput("Clusters",h,e.clustersCol);if(S.nullable=!0,A.fireChanged(),e.col)return T=await N(e.col,h,C,v,m,S,g,y,p),void await x(A,h,T,t,s);i.dialog("MSA").add(A).add(S).add(m).add(w).add(b).add(f).onOK((async()=>{await x(A,h,T,t,s)})).show()}))}async function x(e,t,s,i,o){let a=null;const l=r.TaskBarProgressIndicator.create("Analyze for MSA ...");try{if(e.fireChanged(),e.value.semType!==r.SEMTYPE.MACROMOLECULE)throw new Error("Chosen column has to be of Macromolecule semantic type");if(void 0===s)throw new Error("Invalid column format");if(a=await s(),null==a)return o("PepSeA container has not started");t.columns.add(a),await n.data.detectSemanticTypes(t),i(a)}catch(e){const t=e instanceof Error?e.message:e.toString();n.shell.error(t),o(e)}finally{l.close()}}async function N(e,t,s,i,m,p,f,g,y){try{if(e.semType!==r.SEMTYPE.MACROMOLECULE)return;const n=t.columns.getUnusedName(`msa(${e.name})`);if((0,h.n)(e,e.name,[o.r2.FASTA,o.r2.SEPARATOR],["DNA","RNA","PT"],!1)){M(s,i,"kalign"),f.value=null,g.value=null,y.value=null;const t=a.Cn.getOrCreate(e),r=t.isFasta()?e:t.convert(o.r2.FASTA);return async()=>await(0,l.U)(r,!1,n,p.value)}if((0,h.n)(e,e.name,[o.r2.HELM],[],!1))return M(s,i,"pepsea"),f.value??(f.value=u.jB.pepsea.gapOpen),g.value??(g.value=u.jB.pepsea.gapExtend),async()=>await(0,c.f3)(e,n,m.value,f.value,g.value,p.value);if((0,h.n)(e,e.name,[o.r2.SEPARATOR],["UN"],!1)){const t=a.Cn.getOrCreate(e).convert(o.r2.HELM);return M(s,i,"pepsea"),f.value??(f.value=u.jB.pepsea.gapOpen),g.value??(g.value=u.jB.pepsea.gapExtend),async()=>await(0,c.f3)(t,n,m.value,f.value,g.value,p.value)}return f.value=null,g.value=null,y.value=null,void M(s,i,"kalign")}catch(e){const t=e instanceof Error?e.message:e.toString();n.shell.error(t),d._package.logger.error(t)}}function M(e,t,s){if("kalign"===s){for(const t of e)t.display="none";for(const e of t)e.removeProperty("display")}else{for(const e of t)e.display="none";for(const t of e)t.removeProperty("display")}}},6098:(e,t,s)=>{"use strict";s.d(t,{U:()=>R});var n=s(976),r=s(5226);const i=Symbol("Comlink.proxy"),o=Symbol("Comlink.endpoint"),a=Symbol("Comlink.releaseProxy"),l=Symbol("Comlink.thrown"),c=e=>"object"==typeof e&&null!==e||"function"==typeof e,h=new Map([["proxy",{canHandle:e=>c(e)&&e[i],serialize(e){const{port1:t,port2:s}=new MessageChannel;return u(e,t),[s,[s]]},deserialize:e=>(e.start(),m(e))}],["throw",{canHandle:e=>c(e)&&l in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}}]]);function u(e,t=self){t.addEventListener("message",(function s(n){if(!n||!n.data)return;const{id:r,type:o,path:a}=Object.assign({path:[]},n.data),c=(n.data.argumentList||[]).map(C);let h;try{const t=a.slice(0,-1).reduce(((e,t)=>e[t]),e),s=a.reduce(((e,t)=>e[t]),e);switch(o){case"GET":h=s;break;case"SET":t[a.slice(-1)[0]]=C(n.data.value),h=!0;break;case"APPLY":h=s.apply(t,c);break;case"CONSTRUCT":h=function(e){return Object.assign(e,{[i]:!0})}(new s(...c));break;case"ENDPOINT":{const{port1:t,port2:s}=new MessageChannel;u(e,s),h=function(e,t){return w.set(e,t),e}(t,[t])}break;case"RELEASE":h=void 0;break;default:return}}catch(e){h={value:e,[l]:0}}Promise.resolve(h).catch((e=>({value:e,[l]:0}))).then((e=>{const[n,i]=b(e);t.postMessage(Object.assign(Object.assign({},n),{id:r}),i),"RELEASE"===o&&(t.removeEventListener("message",s),d(t))}))})),t.start&&t.start()}function d(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function m(e,t){return f(e,[],t)}function p(e){if(e)throw new Error("Proxy has been released and is not useable")}function f(e,t=[],s=function(){}){let n=!1;const r=new Proxy(s,{get(s,i){if(p(n),i===a)return()=>v(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{d(e),n=!0}));if("then"===i){if(0===t.length)return{then:()=>r};const s=v(e,{type:"GET",path:t.map((e=>e.toString()))}).then(C);return s.then.bind(s)}return f(e,[...t,i])},set(s,r,i){p(n);const[o,a]=b(i);return v(e,{type:"SET",path:[...t,r].map((e=>e.toString())),value:o},a).then(C)},apply(s,r,i){p(n);const a=t[t.length-1];if(a===o)return v(e,{type:"ENDPOINT"}).then(C);if("bind"===a)return f(e,t.slice(0,-1));const[l,c]=y(i);return v(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:l},c).then(C)},construct(s,r){p(n);const[i,o]=y(r);return v(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:i},o).then(C)}});return r}function g(e){return Array.prototype.concat.apply([],e)}function y(e){const t=e.map(b);return[t.map((e=>e[0])),g(t.map((e=>e[1])))]}const w=new WeakMap;function b(e){for(const[t,s]of h)if(s.canHandle(e)){const[n,r]=s.serialize(e);return[{type:"HANDLER",name:t,value:n},r]}return[{type:"RAW",value:e},w.get(e)||[]]}function C(e){switch(e.type){case"HANDLER":return h.get(e.name).deserialize(e.value);case"RAW":return e.value}}function v(e,t,s){return new Promise((n=>{const r=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(s){!s.data||!s.data.id||s.data.id!==r||(e.removeEventListener("message",t),n(s.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:r},t),s)}))}const T="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0ICQ9U3ltYm9sKCJDb21saW5rLnByb3h5IiksQT1TeW1ib2woIkNvbWxpbmsuZW5kcG9pbnQiKSxSPVN5bWJvbCgiQ29tbGluay5yZWxlYXNlUHJveHkiKSx5PVN5bWJvbCgiQ29tbGluay50aHJvd24iKSxfPWU9PnR5cGVvZiBlPT0ib2JqZWN0IiYmZSE9PW51bGx8fHR5cGVvZiBlPT0iZnVuY3Rpb24iLEw9e2NhbkhhbmRsZTplPT5fKGUpJiZlWyRdLHNlcmlhbGl6ZShlKXtjb25zdHtwb3J0MTpyLHBvcnQyOml9PW5ldyBNZXNzYWdlQ2hhbm5lbDtyZXR1cm4gdyhlLHIpLFtpLFtpXV19LGRlc2VyaWFsaXplKGUpe3JldHVybiBlLnN0YXJ0KCksQyhlKX19LE89e2NhbkhhbmRsZTplPT5fKGUpJiZ5IGluIGUsc2VyaWFsaXplKHt2YWx1ZTplfSl7bGV0IHI7cmV0dXJuIGUgaW5zdGFuY2VvZiBFcnJvcj9yPXtpc0Vycm9yOiEwLHZhbHVlOnttZXNzYWdlOmUubWVzc2FnZSxuYW1lOmUubmFtZSxzdGFjazplLnN0YWNrfX06cj17aXNFcnJvcjohMSx2YWx1ZTplfSxbcixbXV19LGRlc2VyaWFsaXplKGUpe3Rocm93IGUuaXNFcnJvcj9PYmplY3QuYXNzaWduKG5ldyBFcnJvcihlLnZhbHVlLm1lc3NhZ2UpLGUudmFsdWUpOmUudmFsdWV9fSxFPW5ldyBNYXAoW1sicHJveHkiLExdLFsidGhyb3ciLE9dXSk7ZnVuY3Rpb24gdyhlLHI9c2VsZil7ci5hZGRFdmVudExpc3RlbmVyKCJtZXNzYWdlIixmdW5jdGlvbiBpKHMpe2lmKCFzfHwhcy5kYXRhKXJldHVybjtjb25zdHtpZDpvLHR5cGU6YSxwYXRoOm59PU9iamVjdC5hc3NpZ24oe3BhdGg6W119LHMuZGF0YSksdT0ocy5kYXRhLmFyZ3VtZW50TGlzdHx8W10pLm1hcChtKTtsZXQgbDt0cnl7Y29uc3QgYz1uLnNsaWNlKDAsLTEpLnJlZHVjZSgoZCxoKT0+ZFtoXSxlKSxmPW4ucmVkdWNlKChkLGgpPT5kW2hdLGUpO3N3aXRjaChhKXtjYXNlIkdFVCI6bD1mO2JyZWFrO2Nhc2UiU0VUIjpjW24uc2xpY2UoLTEpWzBdXT1tKHMuZGF0YS52YWx1ZSksbD0hMDticmVhaztjYXNlIkFQUExZIjpsPWYuYXBwbHkoYyx1KTticmVhaztjYXNlIkNPTlNUUlVDVCI6e2NvbnN0IGQ9bmV3IGYoLi4udSk7bD16KGQpfWJyZWFrO2Nhc2UiRU5EUE9JTlQiOntjb25zdHtwb3J0MTpkLHBvcnQyOmh9PW5ldyBNZXNzYWdlQ2hhbm5lbDt3KGUsaCksbD1OKGQsW2RdKX1icmVhaztjYXNlIlJFTEVBU0UiOmw9dm9pZCAwO2JyZWFrO2RlZmF1bHQ6cmV0dXJufX1jYXRjaChjKXtsPXt2YWx1ZTpjLFt5XTowfX1Qcm9taXNlLnJlc29sdmUobCkuY2F0Y2goYz0+KHt2YWx1ZTpjLFt5XTowfSkpLnRoZW4oYz0+e2NvbnN0W2YsZF09UyhjKTtyLnBvc3RNZXNzYWdlKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxmKSx7aWQ6b30pLGQpLGE9PT0iUkVMRUFTRSImJihyLnJlbW92ZUV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLGkpLEYocikpfSl9KSxyLnN0YXJ0JiZyLnN0YXJ0KCl9ZnVuY3Rpb24gVChlKXtyZXR1cm4gZS5jb25zdHJ1Y3Rvci5uYW1lPT09Ik1lc3NhZ2VQb3J0In1mdW5jdGlvbiBGKGUpe1QoZSkmJmUuY2xvc2UoKX1mdW5jdGlvbiBDKGUscil7cmV0dXJuIGIoZSxbXSxyKX1mdW5jdGlvbiBwKGUpe2lmKGUpdGhyb3cgbmV3IEVycm9yKCJQcm94eSBoYXMgYmVlbiByZWxlYXNlZCBhbmQgaXMgbm90IHVzZWFibGUiKX1mdW5jdGlvbiBiKGUscj1bXSxpPWZ1bmN0aW9uKCl7fSl7bGV0IHM9ITE7Y29uc3Qgbz1uZXcgUHJveHkoaSx7Z2V0KGEsbil7aWYocChzKSxuPT09UilyZXR1cm4oKT0+ZyhlLHt0eXBlOiJSRUxFQVNFIixwYXRoOnIubWFwKHU9PnUudG9TdHJpbmcoKSl9KS50aGVuKCgpPT57RihlKSxzPSEwfSk7aWYobj09PSJ0aGVuIil7aWYoci5sZW5ndGg9PT0wKXJldHVybnt0aGVuOigpPT5vfTtjb25zdCB1PWcoZSx7dHlwZToiR0VUIixwYXRoOnIubWFwKGw9PmwudG9TdHJpbmcoKSl9KS50aGVuKG0pO3JldHVybiB1LnRoZW4uYmluZCh1KX1yZXR1cm4gYihlLFsuLi5yLG5dKX0sc2V0KGEsbix1KXtwKHMpO2NvbnN0W2wsY109Uyh1KTtyZXR1cm4gZyhlLHt0eXBlOiJTRVQiLHBhdGg6Wy4uLnIsbl0ubWFwKGY9PmYudG9TdHJpbmcoKSksdmFsdWU6bH0sYykudGhlbihtKX0sYXBwbHkoYSxuLHUpe3Aocyk7Y29uc3QgbD1yW3IubGVuZ3RoLTFdO2lmKGw9PT1BKXJldHVybiBnKGUse3R5cGU6IkVORFBPSU5UIn0pLnRoZW4obSk7aWYobD09PSJiaW5kIilyZXR1cm4gYihlLHIuc2xpY2UoMCwtMSkpO2NvbnN0W2MsZl09TSh1KTtyZXR1cm4gZyhlLHt0eXBlOiJBUFBMWSIscGF0aDpyLm1hcChkPT5kLnRvU3RyaW5nKCkpLGFyZ3VtZW50TGlzdDpjfSxmKS50aGVuKG0pfSxjb25zdHJ1Y3QoYSxuKXtwKHMpO2NvbnN0W3UsbF09TShuKTtyZXR1cm4gZyhlLHt0eXBlOiJDT05TVFJVQ1QiLHBhdGg6ci5tYXAoYz0+Yy50b1N0cmluZygpKSxhcmd1bWVudExpc3Q6dX0sbCkudGhlbihtKX19KTtyZXR1cm4gb31mdW5jdGlvbiBEKGUpe3JldHVybiBBcnJheS5wcm90b3R5cGUuY29uY2F0LmFwcGx5KFtdLGUpfWZ1bmN0aW9uIE0oZSl7Y29uc3Qgcj1lLm1hcChTKTtyZXR1cm5bci5tYXAoaT0+aVswXSksRChyLm1hcChpPT5pWzFdKSldfWNvbnN0IFA9bmV3IFdlYWtNYXA7ZnVuY3Rpb24gTihlLHIpe3JldHVybiBQLnNldChlLHIpLGV9ZnVuY3Rpb24geihlKXtyZXR1cm4gT2JqZWN0LmFzc2lnbihlLHtbJF06ITB9KX1mdW5jdGlvbiBTKGUpe2Zvcihjb25zdFtyLGldb2YgRSlpZihpLmNhbkhhbmRsZShlKSl7Y29uc3RbcyxvXT1pLnNlcmlhbGl6ZShlKTtyZXR1cm5be3R5cGU6IkhBTkRMRVIiLG5hbWU6cix2YWx1ZTpzfSxvXX1yZXR1cm5be3R5cGU6IlJBVyIsdmFsdWU6ZX0sUC5nZXQoZSl8fFtdXX1mdW5jdGlvbiBtKGUpe3N3aXRjaChlLnR5cGUpe2Nhc2UiSEFORExFUiI6cmV0dXJuIEUuZ2V0KGUubmFtZSkuZGVzZXJpYWxpemUoZS52YWx1ZSk7Y2FzZSJSQVciOnJldHVybiBlLnZhbHVlfX1mdW5jdGlvbiBnKGUscixpKXtyZXR1cm4gbmV3IFByb21pc2Uocz0+e2NvbnN0IG89VSgpO2UuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24gYShuKXshbi5kYXRhfHwhbi5kYXRhLmlkfHxuLmRhdGEuaWQhPT1vfHwoZS5yZW1vdmVFdmVudExpc3RlbmVyKCJtZXNzYWdlIixhKSxzKG4uZGF0YSkpfSksZS5zdGFydCYmZS5zdGFydCgpLGUucG9zdE1lc3NhZ2UoT2JqZWN0LmFzc2lnbih7aWQ6b30sciksaSl9KX1mdW5jdGlvbiBVKCl7cmV0dXJuIG5ldyBBcnJheSg0KS5maWxsKDApLm1hcCgoKT0+TWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpKk51bWJlci5NQVhfU0FGRV9JTlRFR0VSKS50b1N0cmluZygxNikpLmpvaW4oIi0iKX1jb25zdCBXPWFzeW5jKCk9PldlYkFzc2VtYmx5LnZhbGlkYXRlKG5ldyBVaW50OEFycmF5KFswLDk3LDExNSwxMDksMSwwLDAsMCwxLDUsMSw5NiwwLDEsMTIzLDMsMiwxLDAsMTAsMTAsMSw4LDAsNjUsMCwyNTMsMTUsMjUzLDk4LDExXSkpLHg9ImVhZ2VyIixrPSJsYXp5IixqPXtzc3c6WyJzaW1kIl0sbWluaW1hcDI6WyJzaW1kIl19LHQ9e3Rvb2xzOltdLGNvbmZpZzp7fSxmaWxlczpbXSxiYXNlOnt9LGZzOnt9LGFzeW5jIGluaXQoKXtpZih0LnRvb2xzLmxlbmd0aD09PTApdGhyb3ciRXhwZWN0aW5nIGF0IGxlYXN0IDEgdG9vbC4iO2lmKG5ldyBTZXQodC50b29scy5tYXAocj0+YCR7ci50b29sfS8ke3IucHJvZ3JhbXx8ci50b29sfWApKS5zaXplIT09dC50b29scy5sZW5ndGgpdGhyb3ciRm91bmQgZHVwbGljYXRlIHRvb2xzOyBjYW4gb25seSBoYXZlIGVhY2ggdG9vbC9wcm9ncmFtIGNvbWJpbmF0aW9uIGF0IG1vc3Qgb25jZS4iO2lmKHQuYmFzZT10LnRvb2xzLmZpbmQocj0+ci5yZWluaXQhPT0hMCksIXQuYmFzZSl0aHJvdyJDb3VsZCBub3QgZmluZCBhIHRvb2wgd2l0aCBgcmVpbml0OiBmYWxzZWAgdG8gdXNlIGFzIHRoZSBiYXNlIG1vZHVsZS4gVG8gZml4IHRoaXMgaXNzdWUsIGluY2x1ZGUgdGhlIHRvb2wgYGJhc2UvMS4wLjBgIHdoZW4gaW5pdGlhbGl6aW5nIEFpb2xpLiI7cmV0dXJuIHQuYmFzZS5pc0Jhc2VNb2R1bGU9ITAsYXdhaXQgdGhpcy5fc2V0dXAodC5iYXNlKSxhd2FpdCB0aGlzLl9pbml0TW9kdWxlcygpLHQuX2xvZygiUmVhZHkiKSwhMH0sYXN5bmMgX2luaXRNb2R1bGVzKCl7YXdhaXQgUHJvbWlzZS5hbGwodC50b29scy5tYXAodGhpcy5fc2V0dXApKSxhd2FpdCB0aGlzLl9zZXR1cEZTKCl9LG1vdW50KGU9W10pe2NvbnN0IHI9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyRGF0YX1gLGk9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyTW91bnRlZH1gO2xldCBzPVtdLG89W10sYT1bXTshQXJyYXkuaXNBcnJheShlKSYmIShlIGluc3RhbmNlb2YgRmlsZUxpc3QpJiYoZT1bZV0pLHQuX2xvZyhgTW91bnRpbmcgJHtlLmxlbmd0aH0gZmlsZXNgKTtmb3IobGV0IG4gb2YgZSl7aWYobiBpbnN0YW5jZW9mIEZpbGV8fChuPT1udWxsP3ZvaWQgMDpuLmRhdGEpaW5zdGFuY2VvZiBCbG9iJiZuLm5hbWV8fHR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmbi5uYW1lKXR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmKG4uZGF0YT1uZXcgQmxvYihbbi5kYXRhXSx7dHlwZToidGV4dC9wbGFpbiJ9KSkscy5wdXNoKG4pO2Vsc2UgaWYobi5uYW1lJiZuLnVybClvLnB1c2gobik7ZWxzZSBpZih0eXBlb2Ygbj09InN0cmluZyImJm4uc3RhcnRzV2l0aCgiaHR0cCIpKW49e3VybDpuLG5hbWU6bi5zcGxpdCgiLy8iKS5wb3AoKS5yZXBsYWNlKC9cLy9nLCItIil9LG8ucHVzaChuKTtlbHNlIHRocm93J0Nhbm5vdCBtb3VudCBmaWxlKHMpIHNwZWNpZmllZC4gTXVzdCBiZSBhIEZpbGUsIEJsb2IsIGEgVVJMIHN0cmluZywgb3IgeyBuYW1lOiAiZmlsZS50eHQiLCBkYXRhOiAic3RyaW5nIiB9Lic7YS5wdXNoKG4ubmFtZSl9dHJ5e3QuZnMudW5tb3VudChpKX1jYXRjaHt9Zm9yKGxldCBuIG9mIG8pdC5mcy5jcmVhdGVMYXp5RmlsZShyLG4ubmFtZSxuLnVybCwhMCwhMCk7cmV0dXJuIHQuZmlsZXM9dC5maWxlcy5jb25jYXQocyksdC5iYXNlLm1vZHVsZS5GUy5tb3VudCh0LmJhc2UubW9kdWxlLldPUktFUkZTLHtmaWxlczp0LmZpbGVzLmZpbHRlcihuPT5uIGluc3RhbmNlb2YgRmlsZSksYmxvYnM6dC5maWxlcy5maWx0ZXIobj0+KG49PW51bGw/dm9pZCAwOm4uZGF0YSlpbnN0YW5jZW9mIEJsb2IpfSxpKSxzLm1hcChuPT57Y29uc3QgdT1gJHtpfS8ke24ubmFtZX1gLGw9YCR7cn0vJHtuLm5hbWV9YDt0cnl7dC5mcy51bmxpbmsobCl9Y2F0Y2h7fXQuX2xvZyhgQ3JlYXRpbmcgc3ltbGluazogJHtsfSAtLT4gJHt1fWApLHQuZnMuc3ltbGluayh1LGwpfSksYS5tYXAobj0+YCR7cn0vJHtufWApfSxhc3luYyBleGVjKGUscj1udWxsKXtpZih0Ll9sb2coYEV4ZWN1dGluZyAlYyR7ZX0lYyBhcmdzPSR7cn1gLCJjb2xvcjpkYXJrYmx1ZTsgZm9udC13ZWlnaHQ6Ym9sZCIsIiIpLCFlKXRocm93IkV4cGVjdGluZyBhIGNvbW1hbmQiO2xldCBpPWU7cj09bnVsbCYmKHI9ZS5zcGxpdCgiICIpLGk9ci5zaGlmdCgpKTtjb25zdCBzPXQudG9vbHMuZmluZChhPT57dmFyIHU7bGV0IG49aTtyZXR1cm4oKHU9YT09bnVsbD92b2lkIDA6YS5mZWF0dXJlcyk9PW51bGw/dm9pZCAwOnUuc2ltZCk9PT0hMCYmKG49YCR7bn0tc2ltZGApLGEucHJvZ3JhbT09bn0pO2lmKHM9PW51bGwpdGhyb3dgUHJvZ3JhbSAke2l9IG5vdCBmb3VuZC5gO3Muc3Rkb3V0PSIiLHMuc3RkZXJyPSIiLHMubG9hZGluZz09ayYmKHMubG9hZGluZz14LGF3YWl0IHRoaXMuX2luaXRNb2R1bGVzKCkpO3RyeXtzLm1vZHVsZS5jYWxsTWFpbihyKX1jYXRjaChhKXtjb25zb2xlLmVycm9yKGEpfXRyeXtzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzFdKSxzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzJdKX1jYXRjaHt9cy5tb2R1bGUuRlMuc3RyZWFtc1sxXT1zLm1vZHVsZS5GUy5vcGVuKCIvZGV2L3N0ZG91dCIsInciKSxzLm1vZHVsZS5GUy5zdHJlYW1zWzJdPXMubW9kdWxlLkZTLm9wZW4oIi9kZXYvc3RkZXJyIiwidyIpO2xldCBvPXtzdGRvdXQ6cy5zdGRvdXQsc3RkZXJyOnMuc3RkZXJyfTtpZih0LmNvbmZpZy5wcmludEludGVybGVhdmVkJiYobz1zLnN0ZG91dCkscy5yZWluaXQ9PT0hMCl7Y29uc3QgYT10LmJhc2UubW9kdWxlLkZTLmN3ZCgpO09iamVjdC5hc3NpZ24ocyxzLmNvbmZpZykscy5yZWFkeT0hMSxhd2FpdCB0aGlzLmluaXQoKSxzLmlzQmFzZU1vZHVsZSYmdGhpcy5tb3VudCgpLHRoaXMuY2QoYSl9cmV0dXJuIG99LGNhdChlKXtyZXR1cm4gdC5fZmlsZW9wKCJjYXQiLGUpfSxscyhlKXtyZXR1cm4gdC5fZmlsZW9wKCJscyIsZSl9LGRvd25sb2FkKGUpe3JldHVybiB0Ll9maWxlb3AoImRvd25sb2FkIixlKX0scHdkKCl7cmV0dXJuIHQuZnMuY3dkKCl9LGNkKGUpe2ZvcihsZXQgciBvZiB0LnRvb2xzKSFyLm1vZHVsZXx8ci5tb2R1bGUuRlMuY2hkaXIoZSl9LG1rZGlyKGUpe3JldHVybiB0LmZzLm1rZGlyKGUpLCEwfSxyZWFkKHtwYXRoOmUsbGVuZ3RoOnIsZmxhZzppPSJyIixvZmZzZXQ6cz0wLHBvc2l0aW9uOm89MH0pe2NvbnN0IGE9dC5mcy5vcGVuKGUsaSksbj1uZXcgVWludDhBcnJheShyKTtyZXR1cm4gdC5mcy5yZWFkKGEsbixzLHIsbyksdC5mcy5jbG9zZShhKSxufSx3cml0ZSh7cGF0aDplLGJ1ZmZlcjpyLGZsYWc6aT0idysiLG9mZnNldDpzPTAscG9zaXRpb246bz0wfSl7Y29uc3QgYT10LmZzLm9wZW4oZSxpKTt0LmZzLndyaXRlKGEscixzLHIubGVuZ3RoLG8pLHQuZnMuY2xvc2UoYSl9LF9zdGRpblR4dDoiIixfc3RkaW5QdHI6MCxnZXQgc3RkaW4oKXtyZXR1cm4gdC5fc3RkaW5UeHR9LHNldCBzdGRpbihlPSIiKXt0Ll9sb2coYFNldHRpbmcgc3RkaW4gdG8gJWMke2V9JWNgLCJjb2xvcjpkYXJrYmx1ZSIsIiIpLHQuX3N0ZGluVHh0PWUsdC5fc3RkaW5QdHI9MH0sYXN5bmMgX3NldHVwKGUpe2lmKGUucmVhZHkpcmV0dXJuO2lmKHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gKGJhc2UgPSAke2UuaXNCYXNlTW9kdWxlPT09ITB9KS4uLmApLGUuY29uZmlnPU9iamVjdC5hc3NpZ24oe30sZSksZS51cmxQcmVmaXh8fChlLnVybFByZWZpeD1gJHt0LmNvbmZpZy51cmxDRE59LyR7ZS50b29sfS8ke2UudmVyc2lvbn1gKSxlLnByb2dyYW18fChlLnByb2dyYW09ZS50b29sKSxlLmZlYXR1cmVzfHwoZS5mZWF0dXJlcz17fSwoaltlLnByb2dyYW1dfHxbXSkuaW5jbHVkZXMoInNpbWQiKSYmKGF3YWl0IFcoKT8oZS5wcm9ncmFtKz0iLXNpbWQiLGUuZmVhdHVyZXMuc2ltZD0hMCk6dC5fbG9nKGBXZWJBc3NlbWJseSBTSU1EIGlzIG5vdCBzdXBwb3J0ZWQgaW4gdGhpcyBicm93c2VyOyB3aWxsIGxvYWQgbm9uLVNJTUQgdmVyc2lvbiBvZiAke2UucHJvZ3JhbX0uYCkpKSxlLmlzQmFzZU1vZHVsZSYmKGUubG9hZGluZz14KSxlLmxvYWRpbmc9PT1rKXt0Ll9sb2coYFdpbGwgbGF6eS1sb2FkICR7ZS50b29sfTsgc2tpcHBpbmcgaW5pdGlhbGl6YXRpb24uYCk7cmV0dXJufXNlbGYuaW1wb3J0U2NyaXB0cyhgJHtlLnVybFByZWZpeH0vJHtlLnByb2dyYW19LmpzYCksZS5tb2R1bGU9YXdhaXQgTW9kdWxlKHt0aGlzUHJvZ3JhbTplLnByb2dyYW0sbG9jYXRlRmlsZTooaSxzKT0+YCR7ZS51cmxQcmVmaXh9LyR7aX1gLHN0ZGluOigpPT50Ll9zdGRpblB0cjx0LnN0ZGluLmxlbmd0aD90LnN0ZGluLmNoYXJDb2RlQXQodC5fc3RkaW5QdHIrKyk6KHQuc3RkaW49IiIsbnVsbCkscHJpbnQ6aT0+ZS5zdGRvdXQrPWAke2l9CmAscHJpbnRFcnI6dC5jb25maWcucHJpbnRJbnRlcmxlYXZlZD9pPT5lLnN0ZG91dCs9YCR7aX0KYDppPT5lLnN0ZGVycis9YCR7aX0KYH0pO2NvbnN0IHI9ZS5tb2R1bGUuRlM7ZS5pc0Jhc2VNb2R1bGU/KHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gd2l0aCBiYXNlIG1vZHVsZSBmaWxlc3lzdGVtLi4uYCksci5ta2Rpcih0LmNvbmZpZy5kaXJTaGFyZWQsNTExKSxyLm1rZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJEYXRhfWAsNTExKSxyLm1rZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJNb3VudGVkfWAsNTExKSxyLmNoZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJEYXRhfWApLHQuZnM9cik6KHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gd2l0aCBmaWxlc3lzdGVtLi4uYCksci5ta2Rpcih0LmNvbmZpZy5kaXJTaGFyZWQpLHIubW91bnQoZS5tb2R1bGUuUFJPWFlGUyx7cm9vdDp0LmNvbmZpZy5kaXJTaGFyZWQsZnM6dC5mc30sdC5jb25maWcuZGlyU2hhcmVkKSxyLmNoZGlyKHQuZnMuY3dkKCkpKSxlLnN0ZG91dD0iIixlLnN0ZGVycj0iIixlLnJlYWR5PSEwfSxhc3luYyBfc2V0dXBGUygpe2NvbnN0IGU9dC5mcztmb3IobGV0IHIgb2YgdC50b29scyl7aWYoIXIucmVhZHkpY29udGludWU7Y29uc3QgaT1yLm1vZHVsZS5GUyxzPWAvJHtyLnRvb2x9YCxvPWAke3QuY29uZmlnLmRpclNoYXJlZH0ke3N9YDshaS5hbmFseXplUGF0aChzKS5leGlzdHN8fGUuYW5hbHl6ZVBhdGgobykuZXhpc3RzfHwodC5fbG9nKGBNb3VudGluZyAke3N9IG9udG8gJHt0LmJhc2UudG9vbH0gZmlsZXN5c3RlbSBhdCAke299YCksZS5ta2RpcihvKSxlLm1vdW50KHQuYmFzZS5tb2R1bGUuUFJPWFlGUyx7cm9vdDpzLGZzOml9LG8pKX19LF9maWxlb3AoZSxyKXt0Ll9sb2coYFJ1bm5pbmcgJHtlfSAke3J9YCk7Y29uc3QgaT10LmZzLmFuYWx5emVQYXRoKHIpO2lmKCFpLmV4aXN0cylyZXR1cm4gdC5fbG9nKGBGaWxlICR7cn0gbm90IGZvdW5kLmApLCExO3N3aXRjaChlKXtjYXNlImNhdCI6cmV0dXJuIHQuZnMucmVhZEZpbGUocix7ZW5jb2Rpbmc6InV0ZjgifSk7Y2FzZSJscyI6cmV0dXJuIHQuZnMuaXNGaWxlKGkub2JqZWN0Lm1vZGUpP3QuZnMuc3RhdChyKTp0LmZzLnJlYWRkaXIocik7Y2FzZSJkb3dubG9hZCI6Y29uc3Qgcz1uZXcgQmxvYihbdGhpcy5jYXQocildKTtyZXR1cm4gVVJMLmNyZWF0ZU9iamVjdFVSTChzKX1yZXR1cm4hMX0sX2xvZyhlKXtpZighdC5jb25maWcuZGVidWcpcmV0dXJuO2xldCByPVsuLi5hcmd1bWVudHNdO3Iuc2hpZnQoKSxjb25zb2xlLmxvZyhgJWNbV2ViV29ya2VyXSVjICR7ZX1gLCJmb250LXdlaWdodDpib2xkIiwiIiwuLi5yKX19O3codCl9KSgpOwo=",A=typeof window<"u"&&window.Blob&&new Blob([atob(T)],{type:"text/javascript;charset=utf-8"});function S(){const e=A&&(window.URL||window.webkitURL).createObjectURL(A);try{return e?new Worker(e):new Worker("data:application/javascript;base64,"+T)}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}const _={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(e,t={}){if(null==e)throw"Expecting array of tools as input to Aioli constructor.";return Array.isArray(e)||(e=[e]),t=Object.assign({},_,t),e=e.map(this._parseTool),"stg"===t.env&&(t.urlCDN=t.urlCDNStg),this.tools=e,this.config=t,null!=this.config.callback&&(this.callback=this.config.callback),delete this.config.callback,this.init()}async init(){const e=new S;this.callback&&(e.onmessage=e=>{"biowasm"===e.data.type&&this.callback(e.data.value)});const t=m(e);return t.tools=this.tools,t.config=this.config,await t.init(),t}_parseTool(e){if("string"!=typeof e)return e;const t=e.split("/");if(2!=t.length&&3!=t.length)throw"Expecting '<tool>/<version>' or '<tool>/<program>/<version>'";return{tool:t[0],program:3==t.length?t[1]:t[0],version:t[t.length-1]}}}var P=s(850);class ${static getAvailableScales(){return Object.entries(this.scales).map((([e,t])=>e))}static getScale(e){return(0,P.hu)(!(void 0===this.scales[e]),`Scale '${e}' was not found.`),this.scales[e]}}$.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 x{constructor(e="categorial"){this.aa2num=$.getScale(e),this.num2aa={},Object.entries(this.aa2num).forEach((([e,t])=>this.num2aa[t]=e))}static _truncateSequence(e){let t=0,s=e.length;const n=["NH2","COOH"];if(e.startsWith(n[0])){const s=n[0].length;(0,P.hu)("-"==e[s],`Wrong sequence format: ${n[0]} without following '-' in '${e}'.`),t=s}if(e.endsWith(n[1])){const t=n[1].length+1;(0,P.hu)("-"==e[s-t],`Wrong sequence format: ${n[1]} without '-' precending in '${e}'.`),s-=t}return e.substring(t,s)}static _dropDefises(e){return e.replace(/(-)([^-]+)/g,"$2")}static clean(e){return x._dropDefises(x._truncateSequence(e))}encode(e){const t=e.length,s=new Array(t).fill(0);for(let n=0;n<t;++n){const t=e[n];(0,P.hu)(t in this.aa2num,`Unknown char '${t}' found in sequence '${e}'`),s[n]=this.encodeLettter(t)}return s}encodeLettter(e){return this.aa2num[e]}decode(e){let t="";for(let s=0;s<e.length;++s){const n=e[s];(0,P.hu)(n in this.num2aa,`Unknown code '${n}' found in vector '${e}'`),t+=this.num2aa[n]}return t}}var N=s(3553);const M="input.fa",L="result.fasta";function I(e){return e.reduce(((e,t,s)=>e+`>sample${s+1}\n${t}\n`),"")}async function R(e,t=!1,s="",i=null,o,a,l){let c=e.toList();t&&(c=c.map((e=>x.clean(e).replace(/\-/g,""))));const h=e.length;i??(i=n.Column.string("Clusters",h).init("0")),i.type!=n.COLUMN_TYPE.STRING&&(i=i.convertTo(n.TYPE.STRING)),i.compact();const u=i.categories,d=i.getRawData(),m=new Array(u.length),p=new Array(u.length);for(let e=0;e<h;++e){const t=d[e];(m[t]??(m[t]=[])).push(c[e]),(p[t]??(p[t]=[])).push(e)}const f=await new E(["base/1.0.0",{tool:"kalign",version:N.WY,reinit:!0}]),g=n.Column.string(s,h);for(let e=0;e<u.length;++e){const t=I(m[e]);await f.fs.writeFile(M,t);const s=`${void 0!==o?` --gpo ${o}`:""}${void 0!==a?` --gpe ${a}`:""}${void 0!==l?` --tgpe ${l}`:""}`,n=await f.exec(`kalign ${M} -f fasta -o ${L}${s}`);console.warn(n);const i=await f.cat(L);if(!i)throw new Error("kalign output no result");const c=new r.i(i).sequencesArray,h=p[e];for(let e=0;e<c.length;++e)g.set(h[e],c[e])}const y=e.getTag(n.TAGS.UNITS),w=e.getTag("alphabet");return g.setTag(n.TAGS.UNITS,y),g.setTag("aligned","SEQ.MSA"),g.setTag("alphabet",w),g.semType=n.SEMTYPE.MACROMOLECULE,g}},8341:(e,t,s)=>{"use strict";s.d(t,{Jy:()=>l,f3:()=>h});var n=s(4469),r=s(976),i=s(8447),o=s(3553);const a=new class{constructor(){this.dcName="bio"}async getDockerContainer(){return await n.dapi.docker.dockerContainers.filter(this.dcName).first()}},l=["mafft --auto","mafft","linsi","ginsi","einsi","fftns","fftnsi","nwns","nwnsi"],c=["AlignedSeq","AlignedSubpeptide","HELM","ID","PolymerID"];async function h(e,t,s="ginsi",l=1.53,h=0,d=null){const m=await a.getDockerContainer();if("started"!==m.status&&"checking"!==m.status)return n.log.warning("PepSeA container has not started yet"),null;const p=e.length;d??(d=r.Column.int("Clusters",p).init(0)),d.type!=r.COLUMN_TYPE.STRING&&(d=d.convertTo(r.TYPE.STRING));const f=d.categories,g=new Array(f.length);for(let t=0;t<p;++t){const s=d.get(t);if(""===s)continue;const n=f.indexOf(s),r=e.get(t);r&&(g[n]??(g[n]=[])).push({ID:t.toString(),HELM:r})}const y=new Array(p);for(const e of g){const t=(await u(m.id,e,s,l,h)).Alignment;for(const e of t)y[parseInt(e.ID)]=Object.entries(e).filter((e=>!c.includes(e[0]))).map((e=>"-"!==e[1]?e[1]:"")).join(o.rs.SEPARATOR)}const w=r.Column.fromStrings(t,y);return w.setTag(r.TAGS.UNITS,i.r2.SEPARATOR),w.setTag("separator",o.rs.SEPARATOR),w.setTag("aligned","SEQ.MSA"),w.setTag("alphabet","UN"),w.setTag(".alphabetIsMultichar","true"),w.semType=r.SEMTYPE.MACROMOLECULE,w}async function u(e,t,s,r,i){const o={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)},a=`/align?method=${s}&gap_open=${r}&gap_extend=${i}`,l=await n.dapi.docker.dockerContainers.request(e,a,o);return JSON.parse(l??"{}")}},9943:(e,t,s)=>{"use strict";s.d(t,{i$:()=>a,sK:()=>l}),s(976),s(3870),s(4469);var n=s(6414),r=s.n(n),i=s(8447);s(499);const o=60;function a(e,t,s=o,n="\n"){const r=i.kB,a=[];for(let i=0;i<t.length;i++){const o=e.map((e=>e.get(i).toString())).join("|"),c=l(t.get(i),r,s);a.push(`>${o}${n}`);for(const e of c)a.push(`${e}${n}`)}return"".concat(...a)}function l(e,t,s=o){const n=t(e);let i=0;const a=n.length,l=[];for(;i<a;){const e=r()(n).slice(i,i+s).toArray(),t=e.map((e=>e.length>1?`[${e}]`:e)).join("");l.push(t),i+=e.length}return l}},9416:(e,t,s)=>{"use strict";s.d(t,{n:()=>c});var n=s(4469),r=s(976),i=s(8467),o=s(2568),a=s(8457),l=s(3553);async function c(e,t){if(await(0,i.gw)(10),!(0,o.n)(t,"Sequence space"))return e;const s=(0,a.O)(t);s.name="splitToMonomers";const c=t.dataFrame;for(const e of s.columns)e.semType=l.Of.MONOMER,e.setTag("alphabet",t.getTag("alphabet"));const h=/(\d+)(?: \((\d+)\))?/,u=e=>{h.lastIndex=0;const t=e.match(h);return t?`${t[1]} (${parseInt(t[2]??0)+1})`:e};for(let e=0;e<s.columns.length;e++){const n=s.columns.byIndex(e);n.semType=l.Of.MONOMER,n.setTag("alphabet",t.getTag("alphabet"));const r=100;let i=0;for(;c.columns.byName(n.name)&&i<r;)n.name=u(n.name),i++;c.columns.add(n)}await n.data.detectSemanticTypes(c);for(let e=0;e<s.columns.length;e++){const t=s.columns.byIndex(e);t.setTag(r.TAGS.CELL_RENDERER,"Monomer"),t.setTag(".use-as-filter","false")}return c}},4293:(e,t,s)=>{"use strict";function n(e,t){e.innerHTML="",e.append(t)}s.d(t,{Y:()=>n}),s(4469),s(976)},8415:(e,t,s)=>{"use strict";s.d(t,{bo:()=>b,CK:()=>A,yW:()=>T,eZ:()=>$});var n=s(4469),r=s(3870),i=s(976),o=s(3336),a=s.n(o),l=s(6414),c=s.n(l),h=s(701),u=s(499),d=s(8447),m=s(9298);function p(e){var t;return"string"==typeof e||e instanceof String?e:("object"==typeof e||e instanceof Object)&&"$thrownJsError"in e?p(e.$thrownJsError):e instanceof Error?null!==(t=e.stack)&&void 0!==t?t:e.message:e.toString()}var f=s(7945),g=s(8467),y=s(172);var w,b,C=s(8770),v=s(2265);HTMLCanvasElement.prototype.getCursorPosition=function(e,t){const s=this.getBoundingClientRect();return new i.Point((e.clientX-s.left)*t,(e.clientY-s.top)*t)},i.Rect.prototype.contains=function(e,t){return this.left<=e&&e<=this.right&&this.top<=t&&t<=this.bottom};class T{constructor(e=0,t){this.valueList=null,this.valueIdx=0,this.value=this.rowCount=e,this.bounds=t}push(e){this.valueList||(this.valueList=new Array(this.rowCount),this.valueIdx=0),this.valueList[this.valueIdx]=e,++this.valueIdx}aggregate(e){this.value=e(this.valueList)??0,this.valueList=null}}class A{get label(){return this._label?this._label:this.name}constructor(e,t,s,n){this.sumRowCount=0,this.pos=e,this.name=t,this._freqs=s??{},n?.sumRowCount&&(this.sumRowCount=n.sumRowCount),n?.sumValueForHeight&&(this.sumPlotValue=n.sumValueForHeight),n?.label&&(this._label=n.label)}getMonomers(){return Object.keys(this._freqs)}hasMonomer(e){return e in this._freqs}getFreq(e){let t=this._freqs[e];return t||(t=this._freqs[e]=new T),t}aggregate(e){const t=function(e){return t=>{const s=function(e){let t;const s="agg";return t=e instanceof Float32Array?i.Column.fromFloat32Array(s,e):e instanceof Int32Array?i.Column.fromInt32Array(s,e):i.Column.fromList(i.COLUMN_TYPE.FLOAT,s,e),t}(t);return s.aggregate(e)}}(e);for(const[e,s]of Object.entries(this._freqs))s.aggregate(t)}getMinValue(){return Math.min(...Object.values(this._freqs).map((e=>e.value)))}calcPlotValue(e){for(const t of Object.values(this._freqs))t.plotValue=t.value-e}calcHeights(e){this.sumPlotValue=0;for(const e of Object.values(this._freqs))this.sumPlotValue+=e.plotValue;if(this.sumPlotValueForHeight=0,e===m.ES.Entropy){const e=Object.keys(this._freqs).length,t=.01*this.sumPlotValue,s=t/e;for(const e of Object.values(this._freqs)){const n=(e.plotValue+s)/(this.sumPlotValue+t);this.sumPlotValueForHeight+=-n*Math.log2(n)}}else if(e===m.ES.full)for(const[e,t]of Object.entries(this._freqs)){const e=t.plotValue/this.sumPlotValue;this.sumPlotValueForHeight+=e}}calcScreen(e,t,s,n,r,o,a,l,c,h){const u=r===m.ES.Entropy?n*(o-this.sumPlotValueForHeight)/o:n;let d=h*c+(n-u-1);const p=Object.entries(this._freqs).sort(((t,s)=>e(t[0])||e(s[0])?e(t[0])&&e(s[0])?0:e(t[0])?-1:1:s[1].value-t[1].value));for(const[e,n]of p){const e=u*n.plotValue/this.sumPlotValue;n.bounds=new i.Rect((t-s)*c*a,d,l*c,e),d+=e}}render(e,t,s,n,r,i){for(const[o,a]of Object.entries(this._freqs))if(!t(o)){const t=(0,d.GU)(o,5),l=a.bounds,c=l.left;e.resetTransform(),e.strokeStyle="lightgray",e.lineWidth=1,e.rect(c,l.top,l.width,l.height),e.fillStyle=i.get(o)??i.get("other"),e.textAlign="left",e.font=s;const h=e.measureText(t);e.setTransform(l.width/h.width,0,0,l.height/r,c,l.top),e.fillText(t,0,-n)}}getMonomerAt(e,t){const s=Object.entries(this._freqs).find((([s,n])=>n.bounds.contains(e,t)));return s?s[0]:void 0}buildCompositionTable(e){return(0,C._)(e,Object.assign({},...Object.entries(this._freqs).map((([e,t])=>({[e]:t.rowCount})))))}}!function(e){e.STYLE="Style",e.BEHAVIOR="Behavior",e.LAYOUT="Layout",e.DATA="Data"}(w||(w={})),function(e){e.sequenceColumnName="sequenceColumnName",e.valueAggrType="valueAggrType",e.valueColumnName="valueColumnName",e.startPositionName="startPositionName",e.endPositionName="endPositionName",e.skipEmptySequences="skipEmptySequences",e.skipEmptyPositions="skipEmptyPositions",e.shrinkEmptyTail="shrinkEmptyTail",e.backgroundColor="backgroundColor",e.positionHeight="positionHeight",e.positionWidth="positionWidth",e.verticalAlignment="verticalAlignment",e.horizontalAlignment="horizontalAlignment",e.fixWidth="fixWidth",e.fitArea="fitArea",e.minHeight="minHeight",e.maxHeight="maxHeight",e.showPositionLabels="showPositionLabels",e.positionMarginState="positionMarginState",e.positionMargin="positionMargin",e.filterSource="filterSource"}(b||(b={}));const S=m.vS;var _;!function(e){e[e.None=0]="None",e[e.Render=1]="Render",e[e.Layout=1]="Layout",e[e.Freqs=2]="Freqs"}(_||(_={}));const E=new class{constructor(){this.render=20}};class P extends i.JsViewer{get positionWidthWithMargin(){return this._positionWidthWithMargin}get Length(){return this.skipEmptyPositions?this.positions.length:this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0}get positionMarginValue(){return this.positionMarginState===m.dE.AUTO&&!0===this.unitsHandler.getAlphabetIsMultichar()||this.positionMarginState===m.dE.ON?this.positionMargin:0}constructor(){super(),this.viewed=!1,this.initialized=!1,this.palette=null,this.seqCol=null,this.positions=[],this.visibleSlider=!1,this.allowResize=!0,this.turnOfResizeForOneSetValue=!1,this.backgroundColor=4294967295,this.positionMargin=0,this.positionNames=[],this.positionLabels=void 0,this.startPosition=-1,this.endPosition=-1,this.error=null,this.viewerId=++P.viewerCounter,this.setDataInProgress=!1,this.viewSubs=[],this._onSizeChanged=new h.Subject,this._onFreqsCalculated=new h.Subject,this._onLayoutCalculated=new h.Subject,this.requestedRenderLevel=_.Freqs,this.renderRequest=new h.Subject,this._onRendered=new h.Subject,this.textBaseline="top",this.unitsHandler=null,this.sequenceColumnName=this.string(b.sequenceColumnName,S.sequenceColumnName,{category:w.DATA});const e=[i.AGG.KEY,i.AGG.PIVOT,i.AGG.MISSING_VALUE_COUNT,i.AGG.SKEW,i.AGG.KURT,i.AGG.SELECTED_ROWS_COUNT],t=Object.values(i.AGG).filter((t=>!e.includes(t)));this.valueAggrType=this.string(b.valueAggrType,S.valueAggrType,{category:w.DATA,choices:t}),this.valueColumnName=this.string(b.valueColumnName,S.valueColumnName,{category:w.DATA}),this.startPositionName=this.string(b.startPositionName,S.startPositionName,{category:w.DATA}),this.endPositionName=this.string(b.endPositionName,S.endPositionName,{category:w.DATA}),this.skipEmptySequences=this.bool(b.skipEmptySequences,S.skipEmptySequences,{category:w.DATA}),this.skipEmptyPositions=this.bool(b.skipEmptyPositions,S.skipEmptyPositions,{category:w.DATA}),this.shrinkEmptyTail=this.bool(b.shrinkEmptyTail,S.shrinkEmptyTail,{category:w.DATA}),this.backgroundColor=this.int(b.backgroundColor,S.backgroundColor,{category:w.STYLE}),this.positionHeight=this.string(b.positionHeight,S.positionHeight,{category:w.STYLE,choices:Object.values(m.ES)}),this._positionWidth=this.positionWidth=this.float(b.positionWidth,S.positionWidth,{category:w.STYLE}),this.verticalAlignment=this.string(b.verticalAlignment,S.verticalAlignment,{category:w.LAYOUT,choices:Object.values(m.vw)}),this.horizontalAlignment=this.string(b.horizontalAlignment,S.horizontalAlignment,{category:w.LAYOUT,choices:Object.values(m.iD)}),this.fixWidth=this.bool(b.fixWidth,S.fixWidth,{category:w.LAYOUT,userEditable:!1}),this.fitArea=this.bool(b.fitArea,S.fitArea,{category:w.LAYOUT}),this.minHeight=this.float(b.minHeight,S.minHeight,{category:w.LAYOUT}),this.maxHeight=this.float(b.maxHeight,S.maxHeight,{category:w.LAYOUT}),this.showPositionLabels=this.bool(b.showPositionLabels,S.showPositionLabels,{category:w.LAYOUT}),this.positionMarginState=this.string(b.positionMarginState,S.positionMarginState,{category:w.LAYOUT,choices:Object.values(m.dE)});let s=0;"auto"===this.positionMarginState&&(s=4),this.positionMargin=this.int(b.positionMargin,s,{category:w.LAYOUT,min:0,max:16}),this.filterSource=this.string(b.filterSource,S.filterSource,{category:w.BEHAVIOR,choices:Object.values(m.Ct)}),this.slider=r.rangeSlider(0,100,0,20,!1,{style:"barbell"}),this.canvas=r.canvas(),this.canvas.classList.value="bio-wl-canvas",this.canvas.style.width="100%",this.viewSyncer=new y.c(v._package.logger)}viewerToLog(){return`WebLogoViewer<${this.viewerId}>`}setData(){const e=`${this.viewerToLog()}.setData()`;v._package.logger.debug(`${e}, in`),this.viewSyncer.sync(`${e}`,(async()=>{if(!this.setDataInProgress){this.setDataInProgress=!0;try{this.viewed&&(this.renderRequestSub.unsubscribe(),await this.destroyView(),this.viewed=!1),this.updateSeqCol(),this.updateEditors(),this.viewed||(await this.buildView(),this.viewed=!0)}finally{this.setDataInProgress=!1}}})),v._package.logger.debug(`${e}, out`)}async destroyView(){for(const e of this.viewSubs)e.unsubscribe();this.viewSubs=[];const e=this.dataFrame?"data":"null";v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.destroyView( dataFrame = ${e} ) start`),this.host.remove(),this.msgHost=void 0,this.host=void 0,v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.destroyView() end`)}async buildView(){const e=this.dataFrame?"data":"null";v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.buildView( dataFrame = ${e} ) start`),window.devicePixelRatio,this.viewSubs.push(i.debounce(this.renderRequest,E.render).subscribe(this.renderRequestOnDebounce.bind(this))),this.helpUrl="/help/visualize/viewers/web-logo.md",this.msgHost=r.div("No message",{classes:"bio-wl-msg"}),this.msgHost.style.display="none",this.canvas=r.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.host=r.div([this.msgHost,this.canvas],{classes:"bio-wl-host",style:{display:"flex",flexDirection:"row",flexWrap:"wrap"}}),this.root.append(this.host),this.root.append(this.slider.root),this.error&&(this.msgHost.innerText=this.error.message,r.tooltip.bind(this.msgHost,this.error.stack),this.msgHost.style.setProperty("display",null)),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.viewSubs.push(r.onSizeChanged(this.root).subscribe(this.rootOnSizeChanged.bind(this))),this.viewSubs.push(this.slider.onValuesChanged.subscribe(this.sliderOnValuesChanged.bind(this))),this.viewSubs.push((0,h.fromEvent)(this.canvas,"mousemove").subscribe(this.canvasOnMouseMove.bind(this))),this.viewSubs.push((0,h.fromEvent)(this.canvas,"mousedown").subscribe(this.canvasOnMouseDown.bind(this))),this.viewSubs.push((0,h.fromEvent)(this.canvas,"wheel").subscribe(this.canvasOnWheel.bind(this))),this.render(_.Freqs,"buildView"),v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.buildView() end`)}rootOnSizeChanged(){v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.rootOnSizeChanged(), start `),this.render(_.Layout,"rootOnSizeChanged")}updateEditors(){this.props.getProperty(b.valueColumnName).choices=c()(this.dataFrame.columns.numerical).map((e=>e.name)).toArray()}updateSeqCol(){if(this.dataFrame&&(this.seqCol=this.sequenceColumnName?this.dataFrame.col(this.sequenceColumnName):null,null==this.seqCol&&(this.seqCol=(0,d.up)(this.dataFrame),this.sequenceColumnName=this.seqCol?this.seqCol.name:null),this.seqCol)){try{this.unitsHandler=u.Cn.getOrCreate(this.seqCol),this.palette=(0,d.dQ)(this.seqCol),this.render(_.Freqs,"updateSeqCol()"),this.error=null}catch(e){throw this.seqCol=null,this.error=e instanceof Error?e:new Error(e.toString()),e}this.seqCol||(this.unitsHandler=null,this.positionNames=[],this.positionLabels=[],this.startPosition=-1,this.endPosition=-1,this.palette=null)}}getFilter(){let e;switch(this.filterSource){case m.Ct.Filtered:e=this.dataFrame.filter;break;case m.Ct.Selected:e=0===this.dataFrame.selection.trueCount?this.dataFrame.filter:this.dataFrame.selection}return e}setSliderVisibility(e){e?(this.slider.root.style.display="inherit",this.visibleSlider=!0):(this.slider.root.style.display="none",this.visibleSlider=!1)}calcLayout(e){this.host&&this.canvas&&this.slider&&(this.host.classList.remove("bio-wl-fixWidth","bio-wl-fitArea"),this.canvas.classList.remove("bio-wl-fixWidth","bio-wl-fitArea"),this._positionWidth=this.positionWidth,this._positionMargin=this.positionMargin,this._positionWidthWithMargin=this._positionWidth+this.positionMarginValue,this.fixWidth?this.calcLayoutFixWidth(e):this.fitArea?this.calcLayoutFitArea(e):this.calcLayoutNoFitArea(e),this.slider.root.style.width=`${this.host.clientWidth}px`)}calcLayoutFixWidth(e){if(!this.host||!this.canvas||!this.slider)return;this.host.classList.add("bio-wl-fixWidth"),this.canvas.classList.add("bio-wl-fitArea");const t=this._positionWidthWithMargin*this.Length,s=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight);this.host.style.justifyContent=m.iD.LEFT,this.host.style.removeProperty("margin-left"),this.host.style.removeProperty("margin-top"),this.host.style.width=this.canvas.style.width=`${t}px`,this.host.style.height=this.canvas.style.height=`${s}px`,this.host.style.left=this.canvas.style.left="0",this.host.style.top=this.canvas.style.top="0",this.host.style.setProperty("overflow","hidden","important"),this.slider.root.style.display="none",this.slider.setValues(0,Math.max(0,this.Length-1),0,Math.max(0,this.Length-1)),this.canvas.width=t*e,this.canvas.height=s*e}calcLayoutNoFitArea(e){if(!this.host||!this.canvas||!this.slider)return;const t=this._positionWidthWithMargin*this.Length,s=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight),n=Math.min(this.root.clientWidth,t);this.canvas.style.width=`${n}px`,this.canvas.style.height=`${s}px`,this.host.style.width=`${n}px`,this.host.style.height=`${this.root.clientHeight}px`,this.host.style.justifyContent=this.horizontalAlignment,this.host.style.alignContent=this.verticalAlignment===m.vw.TOP?"start":this.verticalAlignment===m.vw.MIDDLE?"center":this.verticalAlignment===m.vw.BOTTOM?"end":"inherit",this.root.clientHeight<this.minHeight&&(this.host.style.alignContent="start",this.host.style.width=`${n+6}px`),this.host.style.width=`${this.host}px`;const r=t>n;if(this.setSliderVisibility(r),r){this.slider.root.style.removeProperty("display"),this.host.style.justifyContent="left",this.host.style.height=this.root.clientHeight-this.slider.root.offsetHeight+"px",this.slider.root.style.top=`${this.host.offsetHeight}px`;let e=Math.min(Math.max(0,this.slider.min),this.Length-.001),t=Math.min(Math.max(0,this.slider.max),this.Length-.001);const s=this.root.clientWidth/this._positionWidthWithMargin;t=Math.min(Math.max(e,0)+s,this.Length-.001),e=Math.max(0,Math.min(t,this.Length-.001)-s),this.slider.setValues(0,Math.max(this.Length-.001),e,t)}else this.slider.setValues(0,Math.max(0,this.Length-.001),0,Math.max(0,this.Length-.001));this.canvas.width=n*e,this.canvas.height=s*e}calcLayoutFitArea(e){if(!this.host||!this.canvas||!this.slider)return;const t=this._positionWidth*this.Length,s=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight),n=t>0?(this.root.clientWidth-this.positionMarginValue*this.Length)/t:0,r=this.root.clientHeight/s,i=Math.max(1,Math.min(n,r));this._positionWidth=this.positionWidth*i,this._positionWidthWithMargin=this._positionWidth+this.positionMarginValue;const o=(this._positionWidth+this.positionMarginValue)*this.Length,a=i*s,l=Math.min(this.root.clientWidth,o);this.canvas.style.width=`${l}px`,this.canvas.style.height=`${a}px`,this.host.style.width=`${l}px`,this.host.style.height=`${this.root.clientHeight}px`,this.host.style.justifyContent=this.horizontalAlignment,this.host.style.alignContent=this.verticalAlignment===m.vw.TOP?"start":this.verticalAlignment===m.vw.MIDDLE?"center":this.verticalAlignment===m.vw.BOTTOM?"end":"inherit",this.root.clientHeight<this.minHeight&&(this.host.style.alignContent="start",this.host.style.width=`${l+6}px`),this.host.style.width=`${this.host}px`;const c=o>l;if(this.setSliderVisibility(c),c){this.slider.root.style.removeProperty("display"),this.host.style.justifyContent="left",this.host.style.height=this.root.clientHeight-this.slider.root.offsetHeight+"px",this.slider.root.style.top=`${this.host.offsetHeight}px`;let e=Math.min(Math.max(0,this.slider.min),this.Length-.001),t=Math.min(Math.max(0,this.slider.max),this.Length-.001);const s=this.root.clientWidth/this._positionWidthWithMargin;t=Math.min(Math.max(e,0)+s,this.Length-.001),e=Math.max(0,Math.min(t,this.Length-.001)-s),this.slider.setValues(0,Math.max(0,this.Length-.001),e,t)}else this.slider.setValues(0,Math.max(0,this.Length-.001),0,Math.max(0,this.Length-.001));this.canvas.width=l*e,this.canvas.height=a*e}onPropertyChanged(e){switch(super.onPropertyChanged(e),e.name){case b.sequenceColumnName:this.updateSeqCol();break;case b.sequenceColumnName:case b.startPositionName:case b.endPositionName:case b.filterSource:case b.shrinkEmptyTail:case b.skipEmptyPositions:case b.positionHeight:case b.valueColumnName:case b.valueAggrType:this.render(_.Freqs,`onPropertyChanged( ${e.name} )`);break;case b.minHeight:case b.maxHeight:case b.positionWidth:case b.showPositionLabels:case b.fixWidth:case b.fitArea:case b.horizontalAlignment:case b.verticalAlignment:case b.positionMargin:case b.positionMarginState:this.render(_.Layout,`onPropertyChanged(${e.name})`);break;case b.backgroundColor:this.render(_.Render,`onPropertyChanged(${e.name})`)}}onTableAttached(){v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.onTableAttached(), `),super.onTableAttached(),this.setData()}detach(){const e=`${this.viewerToLog()}.detach()`;v._package.logger.debug(`${e}, in`);const t=super.detach.bind(this);this.viewSyncer.sync(`${e}`,(async()=>{this.setDataInProgress||(this.viewed&&(await this.destroyView(),this.viewed=!1),t())})),v._package.logger.debug(`${e}, out`)}get onSizeChanged(){return this._onSizeChanged}get onFreqsCalculated(){return this._onFreqsCalculated}get onLayoutCalculated(){return this._onLayoutCalculated}getMonomer(e,t){const s=e.x,n=Math.floor(e.x/(this._positionWidthWithMargin*t)+Math.floor(this.slider.min)),r=this.positions[n];if(!r)return[null,null,null];const i=r.getMonomerAt(s,e.y);return void 0===i?[r,null,null]:[r,i,r.getFreq(i)]}_nullSequence(e="X"){return this.skipEmptySequences?"":new Array(this.Length).fill(e).join("")}_removeEmptyPositions(){this.skipEmptyPositions&&(this.positions=c()(this.positions).filter((e=>{const t=this.unitsHandler.defaultGapSymbol;return!e.hasMonomer(t)||e.getFreq(t).rowCount!==e.sumRowCount})).toArray())}render(e,t){v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render( recalcLevelVal=${e}, reason='${t}' )`),this.requestedRenderLevel=Math.max(this.requestedRenderLevel,e),this.renderRequest.next(this.requestedRenderLevel)}async renderInt(e){if(v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.renderInt( renderLevel=${e} ), start `),this.msgHost&&(this.seqCol&&!this.palette?(this.msgHost.innerText=`Unknown palette (column semType: '${this.seqCol.semType}').`,this.msgHost.style.display=""):this.msgHost.style.display="none"),!this.seqCol||!this.dataFrame||!this.palette||null==this.host||null==this.slider)return;const t=window.devicePixelRatio,s=this.showPositionLabels?12:0;if(e>=_.Freqs&&(()=>{if(v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateFreqsInt(), start `),!this.host||!this.seqCol||!this.dataFrame)return;const e=this.getFilter(),t=0===e.trueCount?this.unitsHandler.maxLength:c().enumerate(this.unitsHandler.splitted).map((([t,s])=>e.get(s)&&t?t.length:0)).reduce(((e,t)=>Math.max(e,t)),0),s=this.seqCol.getTag(".positionNames"),n=this.seqCol.getTag(".positionLabels");this.positionNames=s?s.split(d.CI).map((e=>e.trim())):[...Array(t).keys()].map((e=>`${e+1}`)),this.positionLabels=n?n.split(d.CI).map((e=>e.trim())):void 0,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):t-1;const r=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.unitsHandler=u.Cn.getOrCreate(this.seqCol);const o=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.positions=new Array(o);for(let e=0;e<r;e++){const t=this.positionNames[this.startPosition+e],s=this.positionLabels?this.positionLabels[this.startPosition+e]:void 0;this.positions[e]=new A(this.startPosition+e,t,{},{label:s})}const a=this.dataFrame.rowCount,l=this.unitsHandler.splitted;for(let t=0;t<r;++t){for(let s=0;s<a;++s)if(e.get(s)){const e=l[s][this.startPosition+t]||this.unitsHandler.defaultGapSymbol,n=this.positions[t],r=n.getFreq(e);++n.sumRowCount,r.value=++r.rowCount}if(this.valueAggrType===i.AGG.TOTAL_COUNT)continue;let s=null;try{s=this.dataFrame.getCol(this.valueColumnName),s.matches("numerical")||(s=null)}catch{s=null}if(s){for(let n=0;n<a;++n)if(e.get(n)){const e=l[n][this.startPosition+t]||this.unitsHandler.defaultGapSymbol,r=s.get(n);this.positions[t].getFreq(e).push(r)}this.positions[t].aggregate(this.valueAggrType)}}const h=this.valueAggrType===i.AGG.TOTAL_COUNT?0:Math.min(0,Math.min(...this.positions.map((e=>e.getMinValue()))));for(let e=0;e<r;++e)this.positions[e].calcPlotValue(h),this.positions[e].calcHeights(this.positionHeight);this._removeEmptyPositions(),this._onFreqsCalculated.next()})(),this.calcLayout(t),-1===this.startPosition)return;const r=Math.max(Math.floor(this.slider.min),0),o=Math.min(this.positions.length-1,Math.floor(this.slider.max));e>=_.Layout&&((e,t,s,r)=>{v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt(), start `);const o=this.canvas.height-r*s;let a;if(this.valueAggrType===i.AGG.TOTAL_COUNT){const e=this.getAlphabetSize();this.positionHeight==m.ES.Entropy&&null==e&&n.shell.error("WebLogo: alphabet is undefined."),a=Math.log2(e)}else a=Math.max(...c().count(e).takeWhile((e=>e<=t)).map((e=>this.positions[e].sumPlotValueForHeight)));for(let n=e;n<=t;++n)n in this.positions?this.positions[n].calcScreen((e=>this.unitsHandler.isGap(e)),n,this.slider.min,o,this.positionHeight,a,this._positionWidthWithMargin,this._positionWidth,s,r):v._package.logger.warning(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt() this.positions.length = ${this.positions.length}, jPos = ${n}`);v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt(), end `),this._onLayoutCalculated.next()})(r,o,window.devicePixelRatio,s);const a=this.canvas.getContext("2d");if(a){a.save();try{this.Length,a.resetTransform(),a.fillStyle=function(e){const t=i.Color.a(e);return`#${(16777215&e).toString(16).padStart(6,"0")}`+t.toString(16).padStart(2,"0")}(this.backgroundColor),a.fillRect(0,0,this.canvas.width,this.canvas.height),a.textBaseline=this.textBaseline;const e=10*t;a.resetTransform(),a.fillStyle="black",a.textAlign="center",a.font=`${e.toFixed(1)}px Roboto, Roboto Local, sans-serif`,s>0&&this.positions.length>0&&function(e,t,s,n,r,i,o,a){e.save();try{e.textAlign="center";let l=null,c=null;for(let t=Math.floor(o);t<=Math.floor(a);t++){const s=i[t],n=e.measureText(s.name),r=n.actualBoundingBoxDescent-n.actualBoundingBoxAscent;l=null===l?n.width:Math.max(l,n.width),c=null===c?r:Math.max(c,r)}const h=l<n*t-2?1:(n*t-2)/l;for(let l=Math.floor(o);l<=Math.floor(a);l++){const a=i[l],u=(l-o)*s*t+n*t/2,d=(r*t-c)/2;e.setTransform(h,0,0,1,u,d),e.measureText(a.label),e.fillText(a.label,0,0)}}finally{e.restore()}}(a,t,this._positionWidthWithMargin,this._positionWidth,s,this.positions,this.slider.min,this.slider.max);const n="16px Roboto, Roboto Local, sans-serif",l=.25,c=12.2;for(let e=r;e<=o;e++)this.positions[e].render(a,(e=>this.unitsHandler.isGap(e)),n,l,c,this.palette)}finally{a.restore()}v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.renderInt( recalcLevel=${e} ), end`)}}renderRequestOnDebounce(e){const t=`${this.viewerToLog()}.renderRequestOnDebounce()`;"HTML"!==a()(this.root).offsetParent().get()[0]?.tagName?(this.requestedRenderLevel=_.None,this.renderInt(e).catch((e=>{const[t,s]=(0,f.yf)(e);v._package.logger.error(t,void 0,s)}))):v._package.logger.warning(`${t}, $(this.root).offsetParent() is the 'HTML' tag.`)}getAlphabetSize(){return this.unitsHandler?.getAlphabetSize()??0}sliderOnValuesChanged(e){try{const e={minRange:this.slider.minRange,min:this.slider.min,max:this.slider.max,maxRange:this.slider.maxRange};v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.sliderOnValuesChanged( ${JSON.stringify(e)} ), start`),this.render(_.Layout,"sliderOnValuesChanged")}catch(e){const t=p(e);v._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.sliderOnValuesChanged() error:\n`+t)}}dataFrameFilterOnChanged(e){v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameFilterChanged()`);try{this.filterSource===m.Ct.Filtered&&this.render(_.Freqs,"dataFrameFilterOnChanged")}catch(e){const t=p(e);v._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameFilterOnChanged() error:\n`+t)}}dataFrameSelectionOnChanged(e){v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameSelectionOnChanged()`);try{this.filterSource===m.Ct.Selected&&this.render(_.Freqs,"dataFrameSelectionOnChanged")}catch(e){const t=p(e);v._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameSelectionOnChanged() error:\n`+t)}}canvasOnMouseMove(e){const t=window.devicePixelRatio;try{const s=e,n=this.canvas.getCursorPosition(s,t),[o,a]=this.getMonomer(n,t),l=this.showPositionLabels?12*t:0;if(null!==o&&null===a&&0<=n.y&&n.y<=l){const e=[r.divText(`Position ${o.label}`)];this.valueAggrType===i.AGG.TOTAL_COUNT&&e.push(o.buildCompositionTable(this.palette));const t=r.divV(e);r.tooltip.show(t,s.x+16,s.y+16)}else if(null!==o&&a&&this.dataFrame&&this.seqCol&&this.unitsHandler){const e=o.getFreq(a),t=[r.div(`${a}`),r.div(`${e.rowCount} rows`)];this.valueAggrType!==i.AGG.TOTAL_COUNT&&t.push(r.div(`${this.valueAggrType}: ${e.value.toFixed(3)}`));const n=r.divV(t);r.tooltip.show(n,s.x+16,s.y+16)}else r.tooltip.hide()}catch(e){const t=p(e);v._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnMouseMove() error:\n`+t)}}canvasOnMouseDown(e){try{const t=e,s=window.devicePixelRatio,[n,r]=this.getMonomer(this.canvas.getCursorPosition(t,s),s);if(null!==n&&null!==r&&this.dataFrame&&this.seqCol&&this.unitsHandler){const e=i.BitSet.create(this.dataFrame.selection.length,(e=>function(e,t,s,n,r,i){const o=t.splitted[n],a=i.pos<o.length?o[i.pos]:null;return a===r||""===a&&r===t.defaultGapSymbol}(this.dataFrame,this.unitsHandler,this.getFilter(),e,r,n)));this.dataFrame.selection.init((t=>e.get(t)))}}catch(e){const t=p(e);v._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnMouseDown() error:\n`+t)}}canvasOnWheel(e){const t=window.devicePixelRatio;try{if(!this.visibleSlider)return;const s=this.canvas.width/(this._positionWidthWithMargin*t),n=e.deltaY/100*Math.max(Math.floor(s/5),1);this.slider.scrollBy(this.slider.min+n)}catch(e){const t=p(e);v._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnWheel() error:\n`+t)}}get onRendered(){return this._onRendered}invalidate(e){const t=`invalidate(${e?` <- ${e} `:""})`,s=`${this.viewerToLog()}.${t}`;this.viewSyncer.sync(`${s}`,(async()=>{this.render(_.None,t),this._onRendered.next()}))}async awaitRendered(e=5e3){await(0,g.zg)(this.onRendered,(()=>{}),(()=>{this.invalidate()}),e);const t=this.viewSyncer.resetErrors();if(t.length>0)throw t[0]}}function $(e,t,s,n,r){let i=0,o=-1;for(;-1!=(o=s.findNext(o,!0));){const e=t.splitted[o],s=r.pos;(s<e.length?e[s]:null)===n&&i++}return i}P.residuesSet="nucleotides",P.viewerCounter=-1},8755:(e,t,s)=>{"use strict";s.d(t,{Y:()=>o,x:()=>i});var n=s(701),r=s(2265);class i{get onChanged(){return this._onChanged}constructor(e){return this.substructure=e,this._onChanged=new n.Subject,new Proxy(this,{set:(e,t,s)=>(r._package.logger.debug(`BioFilterProps.set ${t.toString()}( '${s}' )`),e[t]=s,this._onChanged.next(),!0)})}save(){const e={};for(const[t,s]of Object.entries(this))"_onChanged"!==t&&(e[t]=this[t]);return e}apply(e){for(const[t,s]of Object.entries(this))"_onChanged"!==t&&(this[t]=e[t])}}class o{constructor(){this.onChanged=new n.Subject,this._propsChanging=!1,this._propsOnChangedSub=null}get props(){return this._props||(this._props=this.emptyProps),this._props}set props(e){this._propsChanging=!0;try{this._propsOnChangedSub&&(this._propsOnChangedSub.unsubscribe(),this._propsOnChangedSub=null),this._props=e,this.applyProps(),this.onChanged.next(),this._propsOnChangedSub=this._props.onChanged.subscribe((()=>{this.onChanged.next()}))}finally{this._propsChanging=!1}}async detach(){this._propsOnChangedSub&&(this._propsOnChangedSub.unsubscribe(),this._propsOnChangedSub=null)}get filterSummary(){return this.props.substructure}get isFiltering(){return""!==this.props.substructure}resetFilter(){this.props=this.emptyProps,this.onChanged.next()}}},5393:(e,t,s)=>{"use strict";s.d(t,{ST:()=>S,LH:()=>A});var n=s(3870),r=s(976),i=s(4469),o=s(6414),a=s.n(o),l=s(701),c=s(8447),h=s(8467),u=s(499),d=s(172),m=s(7983),p=s(8755),f=s(3336),g=s.n(f),y=s(7945),w=s(4293),b=s(2265);class C extends p.Y{viewerToLog(){return`HelmBioFilter<${this.viewerId}>`}get type(){return"HelmBioFilter"}constructor(){super(),this.emptyProps=new p.x(""),this._filterPanel=n.div("",{style:{cursor:"pointer"}}),this.viewerId=++C.viewerCounter,this.viewSubs=[],this.logger=b._package.logger}async detach(){await super.detach();for(const e of this.viewSubs)e.unsubscribe()}async attach(){this.viewerToLog();try{const e=await async function(){const e="Helm",t=r.Func.find({package:e,name:"getHelmHelper"});if(0===t.length)throw new Error(`Package '${e}' must be installed for HelmHelper.`);return(await t[0].prepare().call()).getOutputParamValue()}();let t,s;this.helmEditor=e.createHelmWebEditor(),this.logger.warning("TEST: HelmBioFilter.init().sync() waitForElementInDom waiting..."),await n.tools.waitForElementInDom(this._filterPanel),this.logger.warning("TEST: HelmBioFilter.init().sync() waitForElementInDom ready"),this.updateFilterPanel(),this.viewSubs.push((0,l.fromEvent)(this._filterPanel,"click").subscribe((()=>{t=n.div(),s=e.createWebEditorApp(t,this.props.substructure),n.dialog({showHeader:!1,showFooter:!0}).add(t).onOK((()=>{try{const e=s.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.props=new p.x(e)}catch(e){this.logger.error(e)}finally{g()(t).empty(),t=null,s=null}})).onCancel((()=>{g()(t).empty(),t=null,s=null})).show({modal:!0,fullScreen:!0})}))),this.viewSubs.push(n.onSizeChanged(this._filterPanel).subscribe((e=>{try{if(s){const e=s.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.updateFilterPanel(e)}}catch(e){const[t,s]=(0,y.yf)(e);this.logger.error(t,void 0,s)}})))}catch(e){const[t,s]=(0,y.yf)(e),r=this._filterPanel;r.innerText="error",r.classList.add("d4-error"),n.tooltip.bind(r,t)}}applyProps(){this.helmEditor&&this.helmEditor.editor.setHelm(this.props.substructure)}get filterPanel(){return this._filterPanel}updateFilterPanel(e){if(!this.helmEditor)throw new Error("helmEditor is not created, the filter is not in dom yet");const t=this._filterPanel.parentElement.clientWidth<100?100:this._filterPanel.parentElement.clientWidth,s=t/2;if(e)(0,w.Y)(this._filterPanel,this.helmEditor.host),this.helmEditor.editor.setHelm(e),this.helmEditor.resizeEditor(t,s);else{const e=n.divText("Click to edit","helm-substructure-filter");(0,w.Y)(this._filterPanel,e)}}async substructureSearch(e){return await(0,h.gw)(10),await(0,m.QF)(this.props.substructure,e)}}C.viewerCounter=-1;const v="bio-substructure-filter";class T{constructor(e,t,s,n,r){this.props=e,this.filterId=t,this.dataFrameId=s,this.columnName=n,this.bitset=r}}class A extends p.x{constructor(e,t){super(e),this.separator=t}}class S extends r.Filter{get calculating(){return"initial"==this.loader.style.display}set calculating(e){this.loader.style.display=e?"initial":"none"}get filterSummary(){return this.bioFilter.filterSummary}get isFiltering(){return super.isFiltering&&(this.bioFilter?.isFiltering??!1)}get isReadyToApplyFilter(){return!this.calculating&&null!=this.bitset}get debounceTime(){if(null==this.column)return 1e3;const e=this.column.length;return e<500?0:e>1e4?1e3:Math.floor((e-500)/9500*1e3)}constructor(){return super(),this.bioFilter=null,this.bitset=null,this.notation=void 0,this.filterId=++S.filterCounter,this.viewSubs=[],this._onRendered=new l.Subject,this.root=n.divV([]),this.loader=n.loader(),this.calculating=!1,this.filterSyncer=new d.c(this.logger=b._package.logger),new Proxy(this,{set:(e,t,s)=>(e[t]=s,!0)})}filterToLog(){return`BioSubstructureFilter<${this.filterId}>`}attach(e){const t=super.attach.bind(this),s=`${this.filterToLog()}.attach()`;this.filterSyncer.sync(s,(async()=>{t(e),this.column=e.columns.bySemType(r.SEMTYPE.MACROMOLECULE),u.Cn.getOrCreate(this.column),this.columnName??(this.columnName=this.column?.name),this.notation??(this.notation=this.column?.getTag(r.TAGS.UNITS)),this.bioFilter=this.notation===c.r2.FASTA?new _:this.notation===c.r2.SEPARATOR?new E(this.column.getTag("separator")):new C,this.root.appendChild(this.bioFilter.filterPanel),this.root.appendChild(this.loader),await this.bioFilter.attach(),this.viewSubs.push(r.debounce(this.bioFilter.onChanged,this.debounceTime).subscribe(this.bioFilterOnChangedDebounced.bind(this))),this.viewSubs.push(i.events.onResetFilterRequest.subscribe((e=>{this.bioFilter?.resetFilter()}))),this.viewSubs.push(i.events.onCustomEvent(v).subscribe(this.filterOnSync.bind(this)))}))}detach(){const e=super.detach.bind(this),t=`${this.filterToLog()}.detach()`;this.filterSyncer.sync(t,(async()=>{for(const e of this.viewSubs)e.unsubscribe();this.viewSubs=[],e(),this.bioFilter&&this.bioFilter.detach(),this.bioFilter=null}))}filterOnSync(e){e.filterId!==this.filterId&&e.dataFrameId===this.dataFrame.id&&e.columnName===this.columnName&&(this.bioFilter.props=e.props)}applyFilter(){this.bitset&&!this.isDetached&&this.dataFrame?.filter.and(this.bitset)}saveState(){const e=super.saveState();return e.props=this.bioFilter.props.save(),e}applyState(e){super.applyState(e),e.props&&this.bioFilter.props.apply(e.props)}fireFilterSync(){const e=`${this.filterToLog()}.fireFilterSync()`;b._package.logger.debug(`${e}, bioFilter = ${this.bioFilter?this.bioFilter.constructor.name:"null"}`+(this.bioFilter?`, props = ${JSON.stringify(this.bioFilter.props.save())}`:"")),i.events.fireCustomEvent(v,new T(this.bioFilter.props,this.filterId,this.dataFrame.id,this.columnName,this.bitset))}bioFilterOnChangedDebounced(){if(!this.dataFrame)return;const e=`${this.filterToLog()}.bioFilterOnChangedDebounced()`;if(b._package.logger.debug(`${e}, start, isFiltering = ${this.isFiltering}, props = ${JSON.stringify(this.bioFilter.props.save())}`),!this.isFiltering)return this.bitset=null,void this.dataFrame.rows.requestFilter();a()(this.dataFrame.rows.filters).has(`${this.columnName}: ${this.filterSummary}`)||this.filterSyncer.sync(e,(async()=>{this.calculating=!0;try{b._package.logger.debug(`${e}, before substructureSearch`),this.bitset=await(this.bioFilter?.substructureSearch(this.column)),b._package.logger.debug(`${e}, after substructureSearch`),this.calculating=!1,this.fireFilterSync(),this.dataFrame?.rows.requestFilter()}finally{this.calculating=!1,b._package.logger.debug(`${e}, end`)}}))}get onRendered(){return this._onRendered}invalidate(e){const t=`${this.filterToLog()}.invalidate(${e?` <- ${e} `:""})`;this.filterSyncer.sync(t,(async()=>{this._onRendered.next()}))}async awaitRendered(e=1e4){const t=`awaitRendered( ${e} )`,s=`${this.filterToLog()}.${t}`;await(0,h.gw)(0),await(0,h.zg)(this.onRendered,(()=>{this.logger.debug(`${s}, _onRendered event caught`)}),(()=>{this.invalidate(t)}),e,`${s} ${e} timeout`);const n=this.filterSyncer.resetErrors();if(n.length>0)throw n[0]}}S.filterCounter=-1;class _ extends p.Y{get type(){return"FastaBioFilter"}constructor(){super(),this.emptyProps=new p.x(""),this.substructureInput=n.stringInput("","",(()=>{this.props.substructure=this.substructureInput.value,this._propsChanging||this.onChanged.next()}),{placeholder:"Substructure"})}applyProps(){this.substructureInput.value=this.props.substructure}get filterPanel(){return this.substructureInput.root}get isFiltering(){return""!==this.substructureInput.value}async substructureSearch(e){return(0,m.pf)(this.props.substructure,e)}async attach(){}async detach(){await super.detach()}}class E extends p.Y{get type(){return"SeparatorBioFilter"}constructor(e){super(),this.emptyProps=new A(""),this.colSeparator="",this.substructureInput=n.stringInput("","",(()=>{this.props.substructure=this.substructureInput.value,this._propsChanging||this.onChanged.next()}),{placeholder:"Substructure"}),this.separatorInput=n.stringInput("",this.colSeparator=e,(()=>{this.props.separator=this.separatorInput.value?this.separatorInput.value:void 0,this._propsChanging||this.onChanged.next()}),{placeholder:"Separator"})}applyProps(){this.substructureInput.value=this.props.substructure,this.separatorInput.value=this.props.separator??this.colSeparator}get filterSummary(){return this.props.separator?this.props.separator:this.colSeparator,`${this.props.substructure}, {sep}`}get isFiltering(){return""!==this.props.substructure}resetFilter(){this.props=new A("")}get filterPanel(){return n.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(e){this.substructureInput.value=e}async substructureSearch(e){return(0,m.pf)(this.substructure,e,this.colSeparator)}async attach(){}async detach(){await super.detach()}}},8770:(e,t,s)=>{"use strict";s.d(t,{_:()=>w});var n=s(3870),r=(s(976),s(6414),s(8447),s(7331),s(3379)),i=s.n(r),o=s(7795),a=s.n(o),l=s(569),c=s.n(l),h=s(3565),u=s.n(h),d=s(9216),m=s.n(d),p=s(4589),f=s.n(p),g=s(5362),y={};function w(e,t){let s=0,r=null;for(const e of Object.values(t))s+=e,r=null===r?e:Math.max(r,e);const i=r/s,o=Object.assign({},...Array.from(Object.entries(t)).sort(((e,t)=>t[1]-e[1])).map((([t,r])=>{const o=r/s,a=e.get(t),l=n.div("",{classes:"macromolecule-cell-comp-analysis-bar"});l.style.width=50*o/i+"px",l.style.backgroundColor=a;const c=n.div(`${(100*o).toFixed(2)}%`);return{[t]:n.div([l,c],{classes:"macromolecule-cell-comp-analysis-value"})}}))),a=n.tableFromMap(o);return Array.from(a.rows).forEach((e=>{const t=e.getElementsByClassName("macromolecule-cell-comp-analysis-bar")[0].style.backgroundColor;e.cells[0].style.color=t})),a}y.styleTagTransform=f(),y.setAttributes=u(),y.insert=c().bind(null,"head"),y.domAPI=a(),y.insertStyleElement=m(),i()(g.Z,y),g.Z&&g.Z.locals&&g.Z.locals,s(499)},540:function(e,t){!function(e){"use strict";function t(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];if(t.length>1){t[0]=t[0].slice(0,-1);for(var n=t.length-1,r=1;r<n;++r)t[r]=t[r].slice(1,-1);return t[n]=t[n].slice(1),t.join("")}return t[0]}function s(e){return"(?:"+e+")"}function n(e){return void 0===e?"undefined":null===e?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function r(e){return e.toUpperCase()}function i(e){var n="[A-Za-z]",r="[0-9]",i=t(r,"[A-Fa-f]"),o=s(s("%[EFef]"+i+"%"+i+i+"%"+i+i)+"|"+s("%[89A-Fa-f]"+i+"%"+i+i)+"|"+s("%"+i+i)),a="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",l=t("[\\:\\/\\?\\#\\[\\]\\@]",a),c=e?"[\\uE000-\\uF8FF]":"[]",h=t(n,r,"[\\-\\.\\_\\~]",e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]"),u=s(n+t(n,r,"[\\+\\-\\.]")+"*"),d=s(s(o+"|"+t(h,a,"[\\:]"))+"*"),m=(s(s("25[0-5]")+"|"+s("2[0-4]"+r)+"|"+s("1"+r+r)+"|"+s("[1-9]"+r)+"|"+r),s(s("25[0-5]")+"|"+s("2[0-4]"+r)+"|"+s("1"+r+r)+"|"+s("0?[1-9]"+r)+"|0?0?"+r)),p=s(m+"\\."+m+"\\."+m+"\\."+m),f=s(i+"{1,4}"),g=s(s(f+"\\:"+f)+"|"+p),y=s(s(f+"\\:")+"{6}"+g),w=s("\\:\\:"+s(f+"\\:")+"{5}"+g),b=s(s(f)+"?\\:\\:"+s(f+"\\:")+"{4}"+g),C=s(s(s(f+"\\:")+"{0,1}"+f)+"?\\:\\:"+s(f+"\\:")+"{3}"+g),v=s(s(s(f+"\\:")+"{0,2}"+f)+"?\\:\\:"+s(f+"\\:")+"{2}"+g),T=s(s(s(f+"\\:")+"{0,3}"+f)+"?\\:\\:"+f+"\\:"+g),A=s(s(s(f+"\\:")+"{0,4}"+f)+"?\\:\\:"+g),S=s(s(s(f+"\\:")+"{0,5}"+f)+"?\\:\\:"+f),_=s(s(s(f+"\\:")+"{0,6}"+f)+"?\\:\\:"),E=s([y,w,b,C,v,T,A,S,_].join("|")),P=s(s(h+"|"+o)+"+"),$=(s(E+"\\%25"+P),s(E+s("\\%25|\\%(?!"+i+"{2})")+P)),x=s("[vV]"+i+"+\\."+t(h,a,"[\\:]")+"+"),N=s("\\["+s($+"|"+E+"|"+x)+"\\]"),M=s(s(o+"|"+t(h,a))+"*"),L=s(N+"|"+p+"(?!"+M+")|"+M),I=s(r+"*"),R=s(s(d+"@")+"?"+L+s("\\:"+I)+"?"),O=s(o+"|"+t(h,a,"[\\:\\@]")),k=s(O+"*"),F=s(O+"+"),D=s(s(o+"|"+t(h,a,"[\\@]"))+"+"),G=s(s("\\/"+k)+"*"),H=s("\\/"+s(F+G)+"?"),W=s(D+G),B=s(F+G),V="(?!"+O+")",U=(s(G+"|"+H+"|"+W+"|"+B+"|"+V),s(s(O+"|"+t("[\\/\\?]",c))+"*")),j=s(s(O+"|[\\/\\?]")+"*"),Y=s(s("\\/\\/"+R+G)+"|"+H+"|"+B+"|"+V),K=s(u+"\\:"+Y+s("\\?"+U)+"?"+s("\\#"+j)+"?"),q=s(s("\\/\\/"+R+G)+"|"+H+"|"+W+"|"+V),Z=s(q+s("\\?"+U)+"?"+s("\\#"+j)+"?");return s(K+"|"+Z),s(u+"\\:"+Y+s("\\?"+U)+"?"),s(s("\\/\\/("+s("("+d+")@")+"?("+L+")"+s("\\:("+I+")")+"?)")+"?("+G+"|"+H+"|"+B+"|"+V+")"),s("\\?("+U+")"),s("\\#("+j+")"),s(s("\\/\\/("+s("("+d+")@")+"?("+L+")"+s("\\:("+I+")")+"?)")+"?("+G+"|"+H+"|"+W+"|"+V+")"),s("\\?("+U+")"),s("\\#("+j+")"),s(s("\\/\\/("+s("("+d+")@")+"?("+L+")"+s("\\:("+I+")")+"?)")+"?("+G+"|"+H+"|"+B+"|"+V+")"),s("\\?("+U+")"),s("\\#("+j+")"),s("("+d+")@"),s("\\:("+I+")"),{NOT_SCHEME:new RegExp(t("[^]",n,r,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(t("[^\\%\\:]",h,a),"g"),NOT_HOST:new RegExp(t("[^\\%\\[\\]\\:]",h,a),"g"),NOT_PATH:new RegExp(t("[^\\%\\/\\:\\@]",h,a),"g"),NOT_PATH_NOSCHEME:new RegExp(t("[^\\%\\/\\@]",h,a),"g"),NOT_QUERY:new RegExp(t("[^\\%]",h,a,"[\\:\\@\\/\\?]",c),"g"),NOT_FRAGMENT:new RegExp(t("[^\\%]",h,a,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(t("[^]",h,a),"g"),UNRESERVED:new RegExp(h,"g"),OTHER_CHARS:new RegExp(t("[^\\%]",h,l),"g"),PCT_ENCODED:new RegExp(o,"g"),IPV4ADDRESS:new RegExp("^("+p+")$"),IPV6ADDRESS:new RegExp("^\\[?("+E+")"+s(s("\\%25|\\%(?!"+i+"{2})")+"("+P+")")+"?\\]?$")}}var o=i(!1),a=i(!0),l=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var s=[],n=!0,r=!1,i=void 0;try{for(var o,a=e[Symbol.iterator]();!(n=(o=a.next()).done)&&(s.push(o.value),!t||s.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}return s}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},c=2147483647,h=36,u=/^xn--/,d=/[^\0-\x7E]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,g=String.fromCharCode;function y(e){throw new RangeError(p[e])}function w(e,t){var s=e.split("@"),n="";return s.length>1&&(n=s[0]+"@",e=s[1]),n+function(e,t){for(var s=[],n=e.length;n--;)s[n]=t(e[n]);return s}((e=e.replace(m,".")).split("."),t).join(".")}function b(e){for(var t=[],s=0,n=e.length;s<n;){var r=e.charCodeAt(s++);if(r>=55296&&r<=56319&&s<n){var i=e.charCodeAt(s++);56320==(64512&i)?t.push(((1023&r)<<10)+(1023&i)+65536):(t.push(r),s--)}else t.push(r)}return t}var C=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},v=function(e,t,s){var n=0;for(e=s?f(e/700):e>>1,e+=f(e/t);e>455;n+=h)e=f(e/35);return f(n+36*e/(e+38))},T=function(e){var t,s=[],n=e.length,r=0,i=128,o=72,a=e.lastIndexOf("-");a<0&&(a=0);for(var l=0;l<a;++l)e.charCodeAt(l)>=128&&y("not-basic"),s.push(e.charCodeAt(l));for(var u=a>0?a+1:0;u<n;){for(var d=r,m=1,p=h;;p+=h){u>=n&&y("invalid-input");var g=(t=e.charCodeAt(u++))-48<10?t-22:t-65<26?t-65:t-97<26?t-97:h;(g>=h||g>f((c-r)/m))&&y("overflow"),r+=g*m;var w=p<=o?1:p>=o+26?26:p-o;if(g<w)break;var b=h-w;m>f(c/b)&&y("overflow"),m*=b}var C=s.length+1;o=v(r-d,C,0==d),f(r/C)>c-i&&y("overflow"),i+=f(r/C),r%=C,s.splice(r++,0,i)}return String.fromCodePoint.apply(String,s)},A=function(e){var t=[],s=(e=b(e)).length,n=128,r=0,i=72,o=!0,a=!1,l=void 0;try{for(var u,d=e[Symbol.iterator]();!(o=(u=d.next()).done);o=!0){var m=u.value;m<128&&t.push(g(m))}}catch(e){a=!0,l=e}finally{try{!o&&d.return&&d.return()}finally{if(a)throw l}}var p=t.length,w=p;for(p&&t.push("-");w<s;){var T=c,A=!0,S=!1,_=void 0;try{for(var E,P=e[Symbol.iterator]();!(A=(E=P.next()).done);A=!0){var $=E.value;$>=n&&$<T&&(T=$)}}catch(e){S=!0,_=e}finally{try{!A&&P.return&&P.return()}finally{if(S)throw _}}var x=w+1;T-n>f((c-r)/x)&&y("overflow"),r+=(T-n)*x,n=T;var N=!0,M=!1,L=void 0;try{for(var I,R=e[Symbol.iterator]();!(N=(I=R.next()).done);N=!0){var O=I.value;if(O<n&&++r>c&&y("overflow"),O==n){for(var k=r,F=h;;F+=h){var D=F<=i?1:F>=i+26?26:F-i;if(k<D)break;var G=k-D,H=h-D;t.push(g(C(D+G%H,0))),k=f(G/H)}t.push(g(C(k,0))),i=v(r,x,w==p),r=0,++w}}}catch(e){M=!0,L=e}finally{try{!N&&R.return&&R.return()}finally{if(M)throw L}}++r,++n}return t.join("")},S={version:"2.1.0",ucs2:{decode:b,encode:function(e){return String.fromCodePoint.apply(String,function(e){if(Array.isArray(e)){for(var t=0,s=Array(e.length);t<e.length;t++)s[t]=e[t];return s}return Array.from(e)}(e))}},decode:T,encode:A,toASCII:function(e){return w(e,(function(e){return d.test(e)?"xn--"+A(e):e}))},toUnicode:function(e){return w(e,(function(e){return u.test(e)?T(e.slice(4).toLowerCase()):e}))}},_={};function E(e){var t=e.charCodeAt(0);return t<16?"%0"+t.toString(16).toUpperCase():t<128?"%"+t.toString(16).toUpperCase():t<2048?"%"+(t>>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function P(e){for(var t="",s=0,n=e.length;s<n;){var r=parseInt(e.substr(s+1,2),16);if(r<128)t+=String.fromCharCode(r),s+=3;else if(r>=194&&r<224){if(n-s>=6){var i=parseInt(e.substr(s+4,2),16);t+=String.fromCharCode((31&r)<<6|63&i)}else t+=e.substr(s,6);s+=6}else if(r>=224){if(n-s>=9){var o=parseInt(e.substr(s+4,2),16),a=parseInt(e.substr(s+7,2),16);t+=String.fromCharCode((15&r)<<12|(63&o)<<6|63&a)}else t+=e.substr(s,9);s+=9}else t+=e.substr(s,3),s+=3}return t}function $(e,t){function s(e){var s=P(e);return s.match(t.UNRESERVED)?s:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,s).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,s).replace(t.NOT_USERINFO,E).replace(t.PCT_ENCODED,r)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,s).toLowerCase().replace(t.NOT_HOST,E).replace(t.PCT_ENCODED,r)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,s).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,E).replace(t.PCT_ENCODED,r)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,s).replace(t.NOT_QUERY,E).replace(t.PCT_ENCODED,r)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,s).replace(t.NOT_FRAGMENT,E).replace(t.PCT_ENCODED,r)),e}function x(e){return e.replace(/^0*(.*)/,"$1")||"0"}function N(e,t){var s=e.match(t.IPV4ADDRESS)||[],n=l(s,2)[1];return n?n.split(".").map(x).join("."):e}function M(e,t){var s=e.match(t.IPV6ADDRESS)||[],n=l(s,3),r=n[1],i=n[2];if(r){for(var o=r.toLowerCase().split("::").reverse(),a=l(o,2),c=a[0],h=a[1],u=h?h.split(":").map(x):[],d=c.split(":").map(x),m=t.IPV4ADDRESS.test(d[d.length-1]),p=m?7:8,f=d.length-p,g=Array(p),y=0;y<p;++y)g[y]=u[y]||d[f+y]||"";m&&(g[p-1]=N(g[p-1],t));var w=g.reduce((function(e,t,s){if(!t||"0"===t){var n=e[e.length-1];n&&n.index+n.length===s?n.length++:e.push({index:s,length:1})}return e}),[]).sort((function(e,t){return t.length-e.length}))[0],b=void 0;if(w&&w.length>1){var C=g.slice(0,w.index),v=g.slice(w.index+w.length);b=C.join(":")+"::"+v.join(":")}else b=g.join(":");return i&&(b+="%"+i),b}return e}var L=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,I=void 0==="".match(/(){0}/)[1];function R(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s={},n=!1!==t.iri?a:o;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var r=e.match(L);if(r){I?(s.scheme=r[1],s.userinfo=r[3],s.host=r[4],s.port=parseInt(r[5],10),s.path=r[6]||"",s.query=r[7],s.fragment=r[8],isNaN(s.port)&&(s.port=r[5])):(s.scheme=r[1]||void 0,s.userinfo=-1!==e.indexOf("@")?r[3]:void 0,s.host=-1!==e.indexOf("//")?r[4]:void 0,s.port=parseInt(r[5],10),s.path=r[6]||"",s.query=-1!==e.indexOf("?")?r[7]:void 0,s.fragment=-1!==e.indexOf("#")?r[8]:void 0,isNaN(s.port)&&(s.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?r[4]:void 0)),s.host&&(s.host=M(N(s.host,n),n)),void 0!==s.scheme||void 0!==s.userinfo||void 0!==s.host||void 0!==s.port||s.path||void 0!==s.query?void 0===s.scheme?s.reference="relative":void 0===s.fragment?s.reference="absolute":s.reference="uri":s.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==s.reference&&(s.error=s.error||"URI is not a "+t.reference+" reference.");var i=_[(t.scheme||s.scheme||"").toLowerCase()];if(t.unicodeSupport||i&&i.unicodeSupport)$(s,n);else{if(s.host&&(t.domainHost||i&&i.domainHost))try{s.host=S.toASCII(s.host.replace(n.PCT_ENCODED,P).toLowerCase())}catch(e){s.error=s.error||"Host's domain name can not be converted to ASCII via punycode: "+e}$(s,o)}i&&i.parse&&i.parse(s,t)}else s.error=s.error||"URI can not be parsed.";return s}var O=/^\.\.?\//,k=/^\/\.(\/|$)/,F=/^\/\.\.(\/|$)/,D=/^\/?(?:.|\n)*?(?=\/|$)/;function G(e){for(var t=[];e.length;)if(e.match(O))e=e.replace(O,"");else if(e.match(k))e=e.replace(k,"/");else if(e.match(F))e=e.replace(F,"/"),t.pop();else if("."===e||".."===e)e="";else{var s=e.match(D);if(!s)throw new Error("Unexpected dot segment condition");var n=s[0];e=e.slice(n.length),t.push(n)}return t.join("")}function H(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=t.iri?a:o,n=[],r=_[(t.scheme||e.scheme||"").toLowerCase()];if(r&&r.serialize&&r.serialize(e,t),e.host)if(s.IPV6ADDRESS.test(e.host));else if(t.domainHost||r&&r.domainHost)try{e.host=t.iri?S.toUnicode(e.host):S.toASCII(e.host.replace(s.PCT_ENCODED,P).toLowerCase())}catch(s){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+s}$(e,s),"suffix"!==t.reference&&e.scheme&&(n.push(e.scheme),n.push(":"));var i=function(e,t){var s=!1!==t.iri?a:o,n=[];return void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host&&n.push(M(N(String(e.host),s),s).replace(s.IPV6ADDRESS,(function(e,t,s){return"["+t+(s?"%25"+s:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(n.push(":"),n.push(String(e.port))),n.length?n.join(""):void 0}(e,t);if(void 0!==i&&("suffix"!==t.reference&&n.push("//"),n.push(i),e.path&&"/"!==e.path.charAt(0)&&n.push("/")),void 0!==e.path){var l=e.path;t.absolutePath||r&&r.absolutePath||(l=G(l)),void 0===i&&(l=l.replace(/^\/\//,"/%2F")),n.push(l)}return void 0!==e.query&&(n.push("?"),n.push(e.query)),void 0!==e.fragment&&(n.push("#"),n.push(e.fragment)),n.join("")}function W(e,t){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={};return arguments[3]||(e=R(H(e,s),s),t=R(H(t,s),s)),!(s=s||{}).tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=G(t.path||""),n.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=G(t.path||""),n.query=t.query):(t.path?("/"===t.path.charAt(0)?n.path=G(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path:n.path="/"+t.path,n.path=G(n.path)),n.query=t.query):(n.path=e.path,void 0!==t.query?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function B(e,t){return e&&e.toString().replace(t&&t.iri?a.PCT_ENCODED:o.PCT_ENCODED,P)}var V={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var s="https"===String(e.scheme).toLowerCase();return e.port!==(s?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},U={scheme:"https",domainHost:V.domainHost,parse:V.parse,serialize:V.serialize};function j(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var Y={scheme:"ws",domainHost:!0,parse:function(e,t){var s=e;return s.secure=j(s),s.resourceName=(s.path||"/")+(s.query?"?"+s.query:""),s.path=void 0,s.query=void 0,s},serialize:function(e,t){if(e.port!==(j(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var s=e.resourceName.split("?"),n=l(s,2),r=n[0],i=n[1];e.path=r&&"/"!==r?r:void 0,e.query=i,e.resourceName=void 0}return e.fragment=void 0,e}},K={scheme:"wss",domainHost:Y.domainHost,parse:Y.parse,serialize:Y.serialize},q={},Z="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",z="[0-9A-Fa-f]",X=s(s("%[EFef]"+z+"%"+z+z+"%"+z+z)+"|"+s("%[89A-Fa-f]"+z+"%"+z+z)+"|"+s("%"+z+z)),J=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),Q=new RegExp(Z,"g"),ee=new RegExp(X,"g"),te=new RegExp(t("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',J),"g"),se=new RegExp(t("[^]",Z,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),ne=se;function re(e){var t=P(e);return t.match(Q)?t:e}var ie={scheme:"mailto",parse:function(e,t){var s=e,n=s.to=s.path?s.path.split(","):[];if(s.path=void 0,s.query){for(var r=!1,i={},o=s.query.split("&"),a=0,l=o.length;a<l;++a){var c=o[a].split("=");switch(c[0]){case"to":for(var h=c[1].split(","),u=0,d=h.length;u<d;++u)n.push(h[u]);break;case"subject":s.subject=B(c[1],t);break;case"body":s.body=B(c[1],t);break;default:r=!0,i[B(c[0],t)]=B(c[1],t)}}r&&(s.headers=i)}s.query=void 0;for(var m=0,p=n.length;m<p;++m){var f=n[m].split("@");if(f[0]=B(f[0]),t.unicodeSupport)f[1]=B(f[1],t).toLowerCase();else try{f[1]=S.toASCII(B(f[1],t).toLowerCase())}catch(e){s.error=s.error||"Email address's domain name can not be converted to ASCII via punycode: "+e}n[m]=f.join("@")}return s},serialize:function(e,t){var s,n=e,i=null!=(s=e.to)?s instanceof Array?s:"number"!=typeof s.length||s.split||s.setInterval||s.call?[s]:Array.prototype.slice.call(s):[];if(i){for(var o=0,a=i.length;o<a;++o){var l=String(i[o]),c=l.lastIndexOf("@"),h=l.slice(0,c).replace(ee,re).replace(ee,r).replace(te,E),u=l.slice(c+1);try{u=t.iri?S.toUnicode(u):S.toASCII(B(u,t).toLowerCase())}catch(e){n.error=n.error||"Email address's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+e}i[o]=h+"@"+u}n.path=i.join(",")}var d=e.headers=e.headers||{};e.subject&&(d.subject=e.subject),e.body&&(d.body=e.body);var m=[];for(var p in d)d[p]!==q[p]&&m.push(p.replace(ee,re).replace(ee,r).replace(se,E)+"="+d[p].replace(ee,re).replace(ee,r).replace(ne,E));return m.length&&(n.query=m.join("&")),n}},oe=/^([^\:]+)\:(.*)/,ae={scheme:"urn",parse:function(e,t){var s=e.path&&e.path.match(oe),n=e;if(s){var r=t.scheme||n.scheme||"urn",i=s[1].toLowerCase(),o=s[2],a=r+":"+(t.nid||i),l=_[a];n.nid=i,n.nss=o,n.path=void 0,l&&(n=l.parse(n,t))}else n.error=n.error||"URN can not be parsed.";return n},serialize:function(e,t){var s=t.scheme||e.scheme||"urn",n=e.nid,r=s+":"+(t.nid||n),i=_[r];i&&(e=i.serialize(e,t));var o=e,a=e.nss;return o.path=(n||t.nid)+":"+a,o}},le=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,ce={scheme:"urn:uuid",parse:function(e,t){var s=e;return s.uuid=s.nss,s.nss=void 0,t.tolerant||s.uuid&&s.uuid.match(le)||(s.error=s.error||"UUID is not valid."),s},serialize:function(e,t){var s=e;return s.nss=(e.uuid||"").toLowerCase(),s}};_[V.scheme]=V,_[U.scheme]=U,_[Y.scheme]=Y,_[K.scheme]=K,_[ie.scheme]=ie,_[ae.scheme]=ae,_[ce.scheme]=ce,e.SCHEMES=_,e.pctEncChar=E,e.pctDecChars=P,e.parse=R,e.removeDotSegments=G,e.serialize=H,e.resolveComponents=W,e.resolve=function(e,t,s){var n=function(e,t){var s=e;if(t)for(var n in t)s[n]=t[n];return s}({scheme:"null"},s);return H(W(R(e,n),R(t,n),n,!0),n)},e.normalize=function(e,t){return"string"==typeof e?e=H(R(e,t),t):"object"===n(e)&&(e=R(H(e,t),t)),e},e.equal=function(e,t,s){return"string"==typeof e?e=H(R(e,s),s):"object"===n(e)&&(e=H(e,s)),"string"==typeof t?t=H(R(t,s),s):"object"===n(t)&&(t=H(t,s)),e===t},e.escapeComponent=function(e,t){return e&&e.toString().replace(t&&t.iri?a.ESCAPE:o.ESCAPE,E)},e.unescapeComponent=B,Object.defineProperty(e,"__esModule",{value:!0})}(t)},3336:e=>{"use strict";e.exports=$},976:e=>{"use strict";e.exports=DG},4469:e=>{"use strict";e.exports=grok},701:e=>{"use strict";e.exports=rxjs},3870:e=>{"use strict";e.exports=ui},6414:e=>{"use strict";e.exports=wu},4775:e=>{"use strict";e.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},996:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/applicator","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/applicator":true},"$dynamicAnchor":"meta","title":"Applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"prefixItems":{"$ref":"#/$defs/schemaArray"},"items":{"$dynamicRef":"#meta"},"contains":{"$dynamicRef":"#meta"},"additionalProperties":{"$dynamicRef":"#meta"},"properties":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"propertyNames":{"format":"regex"},"default":{}},"dependentSchemas":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"default":{}},"propertyNames":{"$dynamicRef":"#meta"},"if":{"$dynamicRef":"#meta"},"then":{"$dynamicRef":"#meta"},"else":{"$dynamicRef":"#meta"},"allOf":{"$ref":"#/$defs/schemaArray"},"anyOf":{"$ref":"#/$defs/schemaArray"},"oneOf":{"$ref":"#/$defs/schemaArray"},"not":{"$dynamicRef":"#meta"}},"$defs":{"schemaArray":{"type":"array","minItems":1,"items":{"$dynamicRef":"#meta"}}}}')},6795:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/content","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/content":true},"$dynamicAnchor":"meta","title":"Content vocabulary meta-schema","type":["object","boolean"],"properties":{"contentEncoding":{"type":"string"},"contentMediaType":{"type":"string"},"contentSchema":{"$dynamicRef":"#meta"}}}')},235:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/core","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/core":true},"$dynamicAnchor":"meta","title":"Core vocabulary meta-schema","type":["object","boolean"],"properties":{"$id":{"$ref":"#/$defs/uriReferenceString","$comment":"Non-empty fragments not allowed.","pattern":"^[^#]*#?$"},"$schema":{"$ref":"#/$defs/uriString"},"$ref":{"$ref":"#/$defs/uriReferenceString"},"$anchor":{"$ref":"#/$defs/anchorString"},"$dynamicRef":{"$ref":"#/$defs/uriReferenceString"},"$dynamicAnchor":{"$ref":"#/$defs/anchorString"},"$vocabulary":{"type":"object","propertyNames":{"$ref":"#/$defs/uriString"},"additionalProperties":{"type":"boolean"}},"$comment":{"type":"string"},"$defs":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"}}},"$defs":{"anchorString":{"type":"string","pattern":"^[A-Za-z_][-A-Za-z0-9._]*$"},"uriString":{"type":"string","format":"uri"},"uriReferenceString":{"type":"string","format":"uri-reference"}}}')},2567:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/format-annotation","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/format-annotation":true},"$dynamicAnchor":"meta","title":"Format vocabulary meta-schema for annotation results","type":["object","boolean"],"properties":{"format":{"type":"string"}}}')},1233:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/meta-data","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/meta-data":true},"$dynamicAnchor":"meta","title":"Meta-data vocabulary meta-schema","type":["object","boolean"],"properties":{"title":{"type":"string"},"description":{"type":"string"},"default":true,"deprecated":{"type":"boolean","default":false},"readOnly":{"type":"boolean","default":false},"writeOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true}}}')},5568:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/unevaluated","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/unevaluated":true},"$dynamicAnchor":"meta","title":"Unevaluated applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"unevaluatedItems":{"$dynamicRef":"#meta"},"unevaluatedProperties":{"$dynamicRef":"#meta"}}}')},1968:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/validation","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/validation":true},"$dynamicAnchor":"meta","title":"Validation vocabulary meta-schema","type":["object","boolean"],"properties":{"type":{"anyOf":[{"$ref":"#/$defs/simpleTypes"},{"type":"array","items":{"$ref":"#/$defs/simpleTypes"},"minItems":1,"uniqueItems":true}]},"const":true,"enum":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/$defs/nonNegativeInteger"},"minLength":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"maxItems":{"$ref":"#/$defs/nonNegativeInteger"},"minItems":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"maxContains":{"$ref":"#/$defs/nonNegativeInteger"},"minContains":{"$ref":"#/$defs/nonNegativeInteger","default":1},"maxProperties":{"$ref":"#/$defs/nonNegativeInteger"},"minProperties":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"required":{"$ref":"#/$defs/stringArray"},"dependentRequired":{"type":"object","additionalProperties":{"$ref":"#/$defs/stringArray"}}},"$defs":{"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"$ref":"#/$defs/nonNegativeInteger","default":0},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}}}')},2577:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/schema","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/core":true,"https://json-schema.org/draft/2020-12/vocab/applicator":true,"https://json-schema.org/draft/2020-12/vocab/unevaluated":true,"https://json-schema.org/draft/2020-12/vocab/validation":true,"https://json-schema.org/draft/2020-12/vocab/meta-data":true,"https://json-schema.org/draft/2020-12/vocab/format-annotation":true,"https://json-schema.org/draft/2020-12/vocab/content":true},"$dynamicAnchor":"meta","title":"Core and Validation specifications meta-schema","allOf":[{"$ref":"meta/core"},{"$ref":"meta/applicator"},{"$ref":"meta/unevaluated"},{"$ref":"meta/validation"},{"$ref":"meta/meta-data"},{"$ref":"meta/format-annotation"},{"$ref":"meta/content"}],"type":["object","boolean"],"$comment":"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.","properties":{"definitions":{"$comment":"\\"definitions\\" has been replaced by \\"$defs\\".","type":"object","additionalProperties":{"$dynamicRef":"#meta"},"deprecated":true,"default":{}},"dependencies":{"$comment":"\\"dependencies\\" has been split and replaced by \\"dependentSchemas\\" and \\"dependentRequired\\" in order to serve their differing semantics.","type":"object","additionalProperties":{"anyOf":[{"$dynamicRef":"#meta"},{"$ref":"meta/validation#/$defs/stringArray"}]},"deprecated":true,"default":{}},"$recursiveAnchor":{"$comment":"\\"$recursiveAnchor\\" has been replaced by \\"$dynamicAnchor\\".","$ref":"meta/core#/$defs/anchorString","deprecated":true},"$recursiveRef":{"$comment":"\\"$recursiveRef\\" has been replaced by \\"$dynamicRef\\".","$ref":"meta/core#/$defs/uriReferenceString","deprecated":true}}}')},98:e=>{"use strict";e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')}},t={};function s(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(i.exports,i,i.exports,s),i.loaded=!0,i.exports}s.m=e,s.amdO={},s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.u=e=>e+".js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;s.g.importScripts&&(e=s.g.location+"");var t=s.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&!e;)e=n[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=e})(),s.b=document.baseURI||self.location.href,s.nc=void 0;var n={};(()=>{"use strict";s.r(n),s.d(n,{_package:()=>ge,test:()=>ye,tests:()=>t.QK});var e=s(976),t=s(8467);(0,t.W3)("_first",(()=>{(0,t.Bu)("_first",(async()=>{}))}));var r=s(2012),i=s(9976),o=s(6137);(0,t.W3)("Palettes",(()=>{(0,t.Bu)("testPaletteN",(async()=>{await async function(){const e=o.J.Chromatogram;(0,t.l_)(e instanceof i.B,!0),(0,t.l_)(e instanceof o.J,!0)}()})),(0,t.Bu)("testPaletteAA",(async()=>{await async function(){const e=r.f.Lesk,s=r.f.RasMol,n=r.f.GrokGroups;(0,t.l_)(e instanceof i.B,!0),(0,t.l_)(s instanceof i.B,!0),(0,t.l_)(n instanceof i.B,!0),(0,t.l_)(e instanceof r.f,!0),(0,t.l_)(s instanceof r.f,!0),(0,t.l_)(n instanceof r.f,!0)}()})),(0,t.Bu)("testPalettePtMe",(async()=>{const e=r.f.GrokGroups.get("MeNle"),s=r.f.GrokGroups.get("MeA"),n=r.f.GrokGroups.get("MeG"),i=r.f.GrokGroups.get("MeF"),o=r.f.GrokGroups.get("L"),a=r.f.GrokGroups.get("A"),l=r.f.GrokGroups.get("G"),c=r.f.GrokGroups.get("F");(0,t.l_)(e,o),(0,t.l_)(s,a),(0,t.l_)(n,l),(0,t.l_)(i,c)}))}));var a=s(4469),l=s(2265),c=s(8447),h=s(499);async function u(t){const s=e.Column.fromList(e.TYPE.STRING,"col1",t);if(await a.functions.call("Bio:detectMacromolecule",{col:s}),s.semType===e.SEMTYPE.MACROMOLECULE){const t=`Negative test detected semType='${s.semType}', units='${s.getTag(e.TAGS.UNITS)}'.`;throw new Error(t)}}async function d(t,s){const n=(await t()).getCol(s),r=await a.functions.call("Bio:detectMacromolecule",{col:n});if(r&&(n.semType=r),n.semType===e.SEMTYPE.MACROMOLECULE){const t=`Negative test detected semType='${n.semType}', units='${n.getTag(e.TAGS.UNITS)}'.`;throw new Error(t)}}async function m(s,n,r,i,o,l,c=null){const u=e.Column.fromList(e.TYPE.STRING,"seq",s),d=await a.functions.call("Bio:detectMacromolecule",{col:u});d&&(u.semType=d),(0,t.l_)(u.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(u.getTag(e.TAGS.UNITS),n),(0,t.l_)(u.getTag("aligned"),r),(0,t.l_)(u.getTag("alphabet"),i),c&&(0,t.l_)(u.getTag("separator"),c);const m=h.Cn.getOrCreate(u);(0,t.l_)(m.getAlphabetSize(),o),(0,t.l_)(m.getAlphabetIsMultichar(),l),m.isHelm()||((0,t.l_)(m.aligned,r),(0,t.l_)(m.alphabet,i))}async function p(s,n,r,i,o,l,c,u=null){const d=(await s()).col(n),m=await a.functions.call("Bio:detectMacromolecule",{col:d});m&&(d.semType=m),(0,t.l_)(d.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(d.getTag(e.TAGS.UNITS),r),(0,t.l_)(d.getTag("aligned"),i),(0,t.l_)(d.getTag("alphabet"),o),u&&(0,t.l_)(d.getTag("separator"),u);const p=h.Cn.getOrCreate(d);(0,t.l_)(p.getAlphabetSize(),l),(0,t.l_)(p.getAlphabetIsMultichar(),c),p.isHelm()||((0,t.l_)(p.aligned,i),(0,t.l_)(p.alphabet,o))}(0,t.W3)("detectors",(()=>{var s,n,r,i,o,l,h,y,w,b,C,v,T,A,S,_,E,P,$,x;const N=new(x=class{constructor(){this[s]="id,col1\n1,\n2,\n3,\n4,\n5,",this[n]="col1\n1\n2\n3",this[r]="col1\n4\n5\n6\n7",this[i]="col1\n8\n9\n10\n11\n12",this[o]="col1\nCCCCN1C(=O)CN=C(c2cc(F)ccc12)C3CCCCC3\nC1CCCCC1\nCCCCCC",this[l]="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",this[h]="seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",this[y]="seq\nFWPHEY\nYNRQWYV\nMKPSEYV",this[w]="seq\n[meI][hHis][Aca]NT[dE][Thr_PO3H2][Aca]DN\n[meI][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2][Aca]\n[Lys_Boc][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2][Aca]",this[b]="seq\nA*C*G*T*C*A*C*G*T*C\nC*A*G*T*G*T*C*A*G*T*G*T\nT*T*C*A*A*C*T*T*C*A*A*C",this[C]="seq\nA*C*G*U*C*A*C*G*U*C\nC*A*G*U*G*U*C*A*G*U*G*U\nU*U*C*A*A*C*U*U*C*A*A*C",this[v]="seq\nF-W-P-H-E-Y-F-W-P-H-E-Y\nY-N-R-Q-W-Y-V-Y-N-R-Q-W-Y-V\nM-K-P-S-E-Y-V-M-K-P-S-E-Y-V",this[T]="seq\nabc-dfgg-abc1-cfr3-rty-wert-cfr3-rty-wert\nrut12-her2-rty-wert-abc-abc1-dfgg-abc-abc1-dfgg\nrut12-rty-her2-abc-cfr3-wert-rut12-cfr3-wert-rut12",this[A]="seq\nabc/dfgg/abc1/cfr3/rty/wert/abc/dfgg/abc1/cfr3/rty/wert\nrut12/her2/rty/wert//abc/abc1/dfgg/rut12/her2/rty/wert//abc/abc1/dfgg\nrut12/rty/her2/abc/cfr3//wert/rut12/rut12/rty/her2/abc/cfr3//wert/rut12",this[S]="seq\nA-C--G-T--C-T-A-C--G-T--C-T\nC-A-C--T--G-T-C-A-C--T--G-T\nA-C-C-G-T-A-C-T-A-C-C-G-T-A-C-T",this[_]="seq\nm1-M-m3-mon4-mon5-N-T-MON8-N9-m1-M-m3-mon4-mon5-N-T-MON8-N9\nm1-mon2-m3-mon4-mon5-Num--MON8-N9-m1-mon2-m3-mon4-mon5-Num--MON8-N9\n\nmon1-M-mon3-mon4-mon5---MON8-N9-mon1-M-mon3-mon4-mon5---MON8-N9",this[E]="seq\nAc(1)-F-K(AEEA-AEEA-R-Ac)-L-mF-V-Y-mNle-D-W-N-mF-C(1)-G-NH2\nAc(1)-F-K(AEEA-ARRA-W-Ac)-L-mF-V-Y-mNle-D-W-N-mF-C(1)-G-NH2\nAc(1)-F-K(AEEA-AEEA-Ac)-L-mF-V-Y-mNle-D-W-N-mF-C(1)-G-NH2",this[P]="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT",this[$]="seq\nFWR-WYV-KHPFWR-WYV-KHP\nYNR-WYV-KHPYNR-WYV-KHP\nMWRSWY-CKHPMWRSWY-CKHP"}},s="negEmpty",n="neg1",r="neg2",i="neg3",o="negSmiles",l="csvFastaDna1",h="fastaRna1",y="fastaPt1",w="fastaUn",b="sepDna",C="sepRna",v="sepPt",T="sepUn1",A="sepUn2",S="sepMsaDna1",_="sepMsaUnWEmpty",E="sepComplex",P="fastaMsaDna1",$="fastaMsaPt1",x),M={fastaFasta:"System:AppData/Bio/data/sample_FASTA.fasta",fastaPtCsv:"System:AppData/Bio/data/sample_FASTA_PT.csv",msaComplex:"System:AppData/Bio/samples/MSA.csv",fastaCsv:"System:AppData/Bio/samples/FASTA.csv",helmCsv:"System:AppData/Bio/samples/HELM.csv",peptidesComplex:"System:AppData/Bio/tests/peptides_complex_msa.csv",peptidesSimple:"System:AppData/Bio/tests/peptides_simple_msa.csv",testDemogCsv:"System:AppData/Bio/tests/testDemog.csv",testHelmCsv:"System:AppData/Bio/tests/testHelm.csv",testIdCsv:"System:AppData/Bio/tests/testId.csv",testSmilesCsv:"System:AppData/Bio/tests/testSmiles.csv",testSmiles2Csv:"System:AppData/Bio/tests/testSmiles2.csv",testSmilesShort:"System:AppData/Bio/tests/testSmilesShort.csv",testActivityCliffsCsv:"System:AppData/Bio/tests/testActivityCliffs.csv",testCerealCsv:"System:AppData/Bio/tests/testCereal.csv",testUnichemSources:"System:AppData/Bio/tests/testUnichemSources.csv",testDmvOffices:"System:AppData/Bio/tests/testDmvOffices.csv",testAlertCollection:"System:AppData/Bio/tests/testAlertCollection.csv",testSpgi100:"System:AppData/Bio/tests/testSpgi100.csv",testSpgi:"System:AppData/Bio/tests/SPGI-derived.csv",testUrl:"System:AppData/Bio/tests/testUrl.csv"},L={};function I(e,t=R){return async()=>(e in L||(L[e]=(async()=>await t(M[e]))().catch((t=>{throw delete L[e],t}))),L[e])}async function R(t){const s=await a.dapi.files.readAsText(t);return e.DataFrame.fromCsv(s)}const O=t=>async()=>{const s=N[t],n=e.DataFrame.fromCsv(s);return await a.data.detectSemanticTypes(n),n};(0,t.Bu)("NegativeEmpty",(async()=>{await d(O("negEmpty"),"col1")})),(0,t.Bu)("Negative1",(async()=>{await d(O("neg1"),"col1")})),(0,t.Bu)("Negative2",(async()=>{await d(O("neg2"),"col1")})),(0,t.Bu)("Negative3",(async()=>{await d(O("neg3"),"col1")})),(0,t.Bu)("NegativeSmiles",(async()=>{await d(O("negSmiles"),"col1")})),(0,t.Bu)("NegativeStartEnd",(async()=>{await u(["START","END"])})),(0,t.Bu)("NegativeStartEndIntermediate",(async()=>{await u(["START","END","INTERMEDIATE"])})),(0,t.Bu)("FastaDna1",(async()=>{await p(O("csvFastaDna1"),"seq",c.r2.FASTA,"SEQ","DNA",4,!1)})),(0,t.Bu)("FastaRna1",(async()=>{await p(O("fastaRna1"),"seq",c.r2.FASTA,"SEQ","RNA",4,!1)})),(0,t.Bu)("FastaPt1",(async()=>{await p(O("fastaPt1"),"seq",c.r2.FASTA,"SEQ","PT",20,!1)})),(0,t.Bu)("FastaPtGaps",(()=>m(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEYV"],c.r2.FASTA,"SEQ","PT",20,!1))),(0,t.Bu)("FastaPtGapsMsa",(()=>m(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEY"],c.r2.FASTA,"SEQ.MSA","PT",20,!1))),(0,t.Bu)("FastaUn",(async()=>{await p(O("fastaUn"),"seq",c.r2.FASTA,"SEQ.MSA","UN",12,!0)})),(0,t.Bu)("FastaMsaDna1",(async()=>{await p(O("fastaMsaDna1"),"seq",c.r2.FASTA,"SEQ.MSA","DNA",4,!1)})),(0,t.Bu)("FastaMsaPt1",(async()=>{await p(O("fastaMsaPt1"),"seq",c.r2.FASTA,"SEQ.MSA","PT",20,!1)})),(0,t.Bu)("SepDna",(async()=>{await p(O("sepDna"),"seq",c.r2.SEPARATOR,"SEQ","DNA",4,!1,"*")})),(0,t.Bu)("SepRna",(async()=>{await p(O("sepRna"),"seq",c.r2.SEPARATOR,"SEQ","RNA",4,!1,"*")})),(0,t.Bu)("SepPt",(async()=>{await p(O("sepPt"),"seq",c.r2.SEPARATOR,"SEQ","PT",20,!1,"-")})),(0,t.Bu)("SepUn1",(async()=>{await p(O("sepUn1"),"seq",c.r2.SEPARATOR,"SEQ","UN",8,!0,"-")})),(0,t.Bu)("SepUn2",(async()=>{await p(O("sepUn2"),"seq",c.r2.SEPARATOR,"SEQ","UN",9,!0,"/")})),(0,t.Bu)("SepMsaN1",(async()=>{await p(O("sepMsaDna1"),"seq",c.r2.SEPARATOR,"SEQ.MSA","DNA",4,!1,"-")})),(0,t.Bu)("SepMsaUnWEmpty",(async()=>{await p(O("sepMsaUnWEmpty"),"seq",c.r2.SEPARATOR,"SEQ.MSA","UN",14,!0)})),(0,t.Bu)("SepComplex",(async()=>{await p(O("sepComplex"),"seq",c.r2.SEPARATOR,"SEQ","UN",18,!0)})),(0,t.Bu)("samplesFastaCsv",(async()=>{await g(I("fastaCsv"),{Sequence:new f(c.r2.FASTA,"SEQ","PT",20,!1)})})),(0,t.Bu)("samplesFastaFasta",(async()=>{await g(I("fastaFasta"),{sequence:new f(c.r2.FASTA,"SEQ","PT",20,!1)})})),(0,t.Bu)("samplesPeptidesComplex",(async()=>{await g(I("peptidesComplex"),{})})),(0,t.Bu)("samplesMsaComplex",(async()=>{await g(I("msaComplex"),{MSA:new f(c.r2.SEPARATOR,"SEQ.MSA","UN",161,!0,"/")})})),(0,t.Bu)("samplesIdCsv",(async()=>{await g(I("testIdCsv"),{})})),(0,t.Bu)("samplesSarSmallCsv",(async()=>{await g(I("testSmilesCsv"),{})})),(0,t.Bu)("samplesHelmCsv",(async()=>{await g(I("helmCsv"),{HELM:new f(c.r2.HELM,null,null,160,!0)})})),(0,t.Bu)("samplesTestHelmCsv",(async()=>{await g(I("testHelmCsv"),{"HELM string":new f(c.r2.HELM,null,null,9,!0)})})),(0,t.Bu)("samplesTestDemogCsv",(async()=>{await g(I("testDemogCsv"),{})})),(0,t.Bu)("samplesTestSmiles2Csv",(async()=>{await g(I("testSmiles2Csv"),{})})),(0,t.Bu)("samplesTestSmilesShort",(async()=>{await g(I("testSmilesShort"),{})})),(0,t.Bu)("samplesTestActivityCliffsNegativeSmiles",(async()=>{await g(I("testActivityCliffsCsv"),{})})),(0,t.Bu)("samplesFastaPtCsv",(async()=>{await g(I("fastaPtCsv"),{sequence:new f(c.r2.FASTA,"SEQ","PT",20,!1)})})),(0,t.Bu)("samplesTestCerealCsv",(async()=>{await g(I("testCerealCsv"),{})})),(0,t.Bu)("samplesTestUnichemSources",(async()=>{await g(I("testUnichemSources"),{})})),(0,t.Bu)("samplesTestDmvOffices",(async()=>{await g(I("testDmvOffices"),{})})),(0,t.Bu)("samplesTestAlertCollection",(async()=>{await g(I("testAlertCollection"),{})})),(0,t.Bu)("samplesTestSpgi",(async()=>{await g(I("testSpgi"),{})})),(0,t.Bu)("samplesTestSpgi100",(async()=>{await g(I("testSpgi100"),{})})),(0,t.Bu)("samplesTestUrl",(async()=>{await g(I("testUrl"),{})}))}));class f{constructor(e,t,s,n,r,i){this.units=e,this.aligned=t,this.alphabet=s,this.alphabetSize=n,this.alphabetIsMultichar=r,this.separator=i}}async function g(e,t){const s=await e(),n=[];for(const r of s.columns.names())if(r in t){const s=t[r];try{await p(e,r,s.units,s.aligned,s.alphabet,s.alphabetSize,s.alphabetIsMultichar,s.separator)}catch(e){const t=e.toString();n.push(`Positive col '${r}' failed: ${t}`)}}else try{await d(e,r)}catch(e){const t=e.toString();n.push(`Negative col '${r}' failed: ${t}`)}if(n.length>0)throw new Error(n.join("\n"))}(0,t.W3)("detectors:weak-and-likely",(()=>{const s={fastaDnaWeak1:"id,colName\n1,TTTTTTTTTT\n2,TTTTTTTTTT\n3,TTTTTTTTTT\n4,TTTTTTTTTT",fastaDnaWeak1LikelyName:"id,seq\n1,TTTTTTT\n2,TTTTTTT\n3,TTTTTTT\n4,TTTTTTT",fastaRnaWeak1:"id,colName\n1,UUUUUUUUUU\n2,UUUUUUUUUU\n3,UUUUUUUUUU\n4,UUUUUUUUUU",fastaRnaWeak1LikelyName:"id,seq\n1,UUUUUUU\n2,UUUUUUU\n3,UUUUUUU\n4,UUUUUUU",fastaPtWeak1:"id,colName\n1,SLSLSPGKSLSLSPGK\n2,SLSLSPGKSLSLSPGK\n3,SLSLSPGKSLSLSPGK\n4,SLSLSPGKSLSLSPGK",fastaPtWeak1LikelyName:"id,seq\n1,SLSLSPGKSLSLSPGK\n2,SLSLSPGKSLSLSPGK\n3,SLSLSPGKSLSLSPGK\n4,SLSLSPGKSLSLSPGK",fastaUn1:"id,colName\n1,word\n2,other\n3,some\n4,another",fastaUn1LikelyName:"id,seq\n1,word\n2,other\n3,some\n4,another",fastaUn2LikelyName:'protein\nBoombastic\nMegafantastic\n"just-a-random-thought,oy!"',fastaUnMsa1LikelyName:"id,seq\n1,word\n2,male\n3,bare\n4,core"},n=t=>async()=>{const n=s[t],r=e.DataFrame.fromCsv(n);return await a.data.detectSemanticTypes(r),r};(0,t.Bu)("fastaDnaWeak1",(async()=>{await d(n("fastaDnaWeak1"),"colName")})),(0,t.Bu)("fastaDnaWeak1LikelyName",(async()=>{await p(n("fastaDnaWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA","DNA",4,!1)})),(0,t.Bu)("fastaRnaWeak1",(async()=>{await d(n("fastaRnaWeak1"),"colName")})),(0,t.Bu)("fastaRnaWeak1LikelyName",(async()=>{await p(n("fastaRnaWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA","RNA",4,!1)})),(0,t.Bu)("fastaPtWeak1",(async()=>{await d(n("fastaPtWeak1"),"colName")})),(0,t.Bu)("fastaPtWeak1LikelyName",(async()=>{await p(n("fastaPtWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA","PT",20,!1)})),(0,t.Bu)("fastaUn1",(async()=>{await d(n("fastaUn1"),"colName")})),(0,t.Bu)("fastaUn1LikelyName",(async()=>{await d(n("fastaUn1LikelyName"),"seq")})),(0,t.Bu)("fastaUn2LikelyName",(async()=>{await d(n("fastaUn2LikelyName"),"protein")})),(0,t.Bu)("fastaUnMsa1LikelyName",(async()=>{await d(n("fastaUnMsa1LikelyName"),"seq")}))})),(0,t.W3)("detectorsBenchmark",(()=>{let s;async function n(n,i,o,a,l,u){return await async function(n,d,m,p){const f=(()=>{const t=function(t,s,n,r,i){let o;switch(t){case c.r2.FASTA:o=e=>{let t="";for(let s=0;s<e.length;s++){const n=e[s];t+=1==n.length?n:`[${n}]`}return t};break;case c.r2.SEPARATOR:o=(e,t)=>e.join(t);break;default:throw new Error(`Not supported notation '${t}'.`)}const a=(e,t)=>{const s=new Array(t);for(let n=0;n<t;n++)s[n]=e[Math.floor(Math.random()*e.length)];return o(s,i)},l=Array(r);for(let e=0;e<r;e++)l[e]=a(s,n);return e.Column.fromStrings("seq",l)}(i,[...(0,c.gM)(o)],a,l,u),n=s.prepare({col:t});return r(n),n})(),g=Date.now(),y=await(async e=>r(e))(f),w=Date.now();(function(e,s){const n=h.Cn.getOrCreate(e);(0,t.l_)(e.semType===s.semType,!0),(0,t.l_)(n.notation===s.notation,!0),(0,t.l_)(n.alphabet===s.alphabet,!0),(0,t.l_)(n.separator===s.separator,!0)})(y,{semType:e.SEMTYPE.MACROMOLECULE,notation:i,alphabet:o,separator:u});const b=w-g;if(b>n){const e=`ET ${b} ms is more than max allowed ${n} ms.`;throw console.error(e),new Error(e)}return console.log(`ET ${b} ms is OK.`),b}(n)}function r(e){e.callSync();const t=e.getOutputParamValue(),s=e.inputs.col;return t&&(s.semType=t),s}(0,t.bb)((async()=>{const t=e.Func.find({package:"Bio",name:"detectMacromolecule"});s=t[0];const n=e.Column.fromStrings("seq",["ACGT","ACGT","ACGT"]);await s.prepare({col:n}).call()})),(0,t.Bu)("fastaDnaShorts50Few50",(async()=>{await n(10,c.r2.FASTA,"DNA",50,50)})),(0,t.Bu)("fastaDnaShorts50Many1E6",(async()=>{await n(20,c.r2.FASTA,"DNA",50,1e6)})),(0,t.Bu)("fastaDnaLong1e6Few50",(async()=>{await n(20,c.r2.FASTA,"DNA",1e6,50)})),(0,t.Bu)("separatorDnaShorts50Few50",(async()=>{await n(10,c.r2.SEPARATOR,"DNA",50,50,"/")})),(0,t.Bu)("separatorDnaShorts50Many1E6",(async()=>{await n(20,c.r2.SEPARATOR,"DNA",50,1e6,"/")})),(0,t.Bu)("separatorDnaLong1e6Few50",(async()=>{await n(20,c.r2.SEPARATOR,"DNA",1e6,50,"/")}))}));var y=s(6098),w=s(525);async function b(t){const s=await async function(e){return await ge.files.readAsText(e)}(t),n=e.DataFrame.fromCsv(s);return n.name=t.replace(".csv",""),n}async function C(e=3e4){const s=(await a.dapi.docker.dockerContainers.filter("bio").first()).id;await async function(e,s=3e4){await a.dapi.docker.dockerContainers.run(e);let n=!1;for(let r=0;r<s/200;++r){switch((await a.dapi.docker.dockerContainers.find(e)).status){case"stopped":await a.dapi.docker.dockerContainers.run(e);break;case"pending change":case"changing":break;case"checking":case"started":n=!0;break;case"error":throw new Error("Docker container error state.")}if(n)break;await(0,t.gw)(200)}if(!n)throw new Error("Docker container run timeout.")}(s,e)}async function v(e,s=5e3){await(0,t.gw)(0),await(0,t.zg)(e.onAfterDrawContent,(()=>{}),(()=>{e.invalidate()}),s)}async function T(s,n){const r=e.DataFrame.fromCsv(s),i=e.DataFrame.fromCsv(n),o=r.getCol("seq"),l=await a.functions.call("Bio:detectMacromolecule",{col:o});l&&(o.semType=l);const c=i.getCol("seq"),h=await(0,y.U)(o,!0);(0,t.f6)(h.toList(),c.toList())}async function A(s,n,r,i,o,l){const c=e.DataFrame.fromCsv(s),h=e.DataFrame.fromCsv(n),u=c.getCol("seq"),d=h.getCol("seq"),m=c.getCol("seq"),p=await a.functions.call("Bio:detectMacromolecule",{col:m});p&&(m.semType=p),await a.data.detectSemanticTypes(c),(0,t.l_)(u.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(u.getTag(e.TAGS.UNITS),r),o&&(0,t.l_)(u.getTag("alphabet"),o);const f=await(0,w.K)({col:u,pepsea:{method:l}});(0,t.l_)(f.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(f.getTag(e.TAGS.UNITS),i),(0,t.l_)(f.getTag("aligned"),"SEQ.MSA"),o&&(0,t.l_)(f.getTag("alphabet"),o),(0,t.f6)(f.toList(),d.toList())}(0,t.W3)("MSA",(async()=>{(0,t.Bu)("isCorrect",(async()=>{await T("seq\nFWRWYVKHP\nYNRWYVKHP\nMWRSWYCKHP","seq\nFWR-WYVKHP\nYNR-WYVKHP\nMWRSWYCKHP")})),(0,t.Bu)("isCorrectLong",(async()=>{await T("seq\nFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHP\nYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHP\nMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHP","seq\nFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHP\nYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHP\nMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHP")})),(0,t.Bu)("isCorrectHelm",(async()=>{await C(),await A("seq\n PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2}$$$$\n PEPTIDE1{meI.Aca.N.T.dE.Thr_PO3H2}$$$$\n PEPTIDE1{hHis.Aca.N.T.dE.Thr_PO3H2}$$$$","seq\n meI.hHis.Aca.N.T.dE.Thr_PO3H2\n .meI.Aca.N.T.dE.Thr_PO3H2\n .hHis.Aca.N.T.dE.Thr_PO3H2",c.r2.HELM,c.r2.SEPARATOR,void 0,"mafft")}),{timeout:6e4}),(0,t.Bu)("isCorrectHelmLong",(async()=>{await C(),await A("seq\n PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.dV.E.N.D-Orn.D-aThr.Phe_4Me.Thr_PO3H2}$$$$\n PEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Tyr_PO3H2.D-Chg.dV.Phe_ab-dehydro.N.D-Orn.D-aThr.Phe_4Me}$$$$\n PEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me}$$$$","seq\n meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.dV.E.N.D-Orn.D-aThr.Phe_4Me.Thr_PO3H2\n meI.hHis.Aca.Cys_SEt.T.dK..Tyr_PO3H2.D-Chg.dV.Phe_ab-dehydro.N.D-Orn.D-aThr.Phe_4Me.\n Lys_Boc.hHis.Aca.Cys_SEt.T.dK..Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me.",c.r2.HELM,c.r2.SEPARATOR,void 0,"mafft")}),{timeout:6e4}),(0,t.Bu)("isCorrectSeparator",(async()=>{await A("seq\n F-W-P-H-E-Y\n Y-N-R-Q-W-Y-V\n M-K-P-S-E-Y-V","seq\n FWPHEY-\n YNRQWYV\n MKPSEYV",c.r2.SEPARATOR,c.r2.FASTA,"PT")})),(0,t.Bu)("isCorrectSeparatorLong",(async()=>{await A("seq\n M-I-E-V-F-L-F-G-I-V-L-G-L-I-P-I-T-L-A-G-L-F-V-T-A-Y-L-Q-Y-R-R-G-D-Q-L-D-L\n M-M-E-L-V-L-K-T-I-I-G-P-I-V-V-G-V-V-L-R-I-V-D-K-W-L-N-K-D-K\n M-D-R-T-D-E-V-S-N-H-T-H-D-K-P-T-L-T-W-F-E-E-I-F-E-E-Y-H-S-P-F-H-N","seq\n MIEV-FLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL\n MMEL-VLKTII-GPIVVGVVLRIVDKWLNKDK------\n MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN-----",c.r2.SEPARATOR,c.r2.FASTA,"PT")}))}));var S=s(9416),_=s(3553);async function E(e,s){const n=(0,c.kB)(e);console.debug(`Bio: tests: splitters: src=${JSON.stringify(e)}, res=${JSON.stringify(n)} .`),(0,t.f6)(n,s)}async function P(e,s){const n=(0,c.gP)(e);console.debug(`Bio: tests: splitters: src=${JSON.stringify(e)}, res=${JSON.stringify(n)} .`),(0,t.f6)(n,s)}(0,t.W3)("splitters",(async()=>{(0,t.bb)((async()=>{})),(0,t.X5)((async()=>{}));const s=["M[MeI]YKETLL[MeF]PKTDFPMRGGL[MeA]",["M","MeI","Y","K","E","T","L","L","MeF","P","K","T","D","F","P","M","R","G","G","L","MeA"]],n=["[meI][Pip][dK][Thr_PO3H2][L-hArg(Et,Et)][D-Tyr_Et][Tyr_ab-dehydroMe][dV]EN[D-Orn][D-aThr][Phe_4Me]",["meI","Pip","dK","Thr_PO3H2","L-hArg(Et,Et)","D-Tyr_Et","Tyr_ab-dehydroMe","dV","E","N","D-Orn","D-aThr","Phe_4Me"]],r=["PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.Tyr_ab-dehydroMe.dV.E.N.D-Orn.D-aThr.Phe_4Me}$$$",["meI","hHis","Aca","N","T","dE","Thr_PO3H2","Aca","D-Tyr_Et","Tyr_ab-dehydroMe","dV","E","N","D-Orn","D-aThr","Phe_4Me"]],i=["PEPTIDE1{meI.hHis.Aca.N.T.dK.Thr_PO3H2.Aca.D-Tyr_Et.D-Dap.dV.E.N.pnG.Phe_4Me}$$$",["meI","hHis","Aca","N","T","dK","Thr_PO3H2","Aca","D-Tyr_Et","D-Dap","dV","E","N","pnG","Phe_4Me"]],o=["PEPTIDE1{[meI].[hHis].[Aca].N.T.[dK].[Thr_PO3H2].[Aca].[D-Tyr_Et].[D-Dap].[dV].E.N.[pnG].[Phe_4Me]}$$$",["meI","hHis","Aca","N","T","dK","Thr_PO3H2","Aca","D-Tyr_Et","D-Dap","dV","E","N","pnG","Phe_4Me"]],c=["RNA1{R(U)P.R(T)P.R(G)P.R(C)P.R(A)}$$$$",["R(U)P","R(T)P","R(G)P","R(C)P","R(A)"]],h=["RNA1{P.R(U)P.R(T)}$$$$",["P","R(U)P","R(T)"]],u=["RNA1{P.R(U).P.R(T)}$$$$",["P","R(U)","P","R(T)"]];(0,t.Bu)("fastaMulti",(async()=>{await E(s[0],s[1])})),(0,t.Bu)("fastaFromHelm",(async()=>{await E(n[0],n[1])})),(0,t.Bu)("helm1",(async()=>{await P(r[0],r[1])})),(0,t.Bu)("helm2",(async()=>{await P(i[0],i[1])})),(0,t.Bu)("helm3-multichar",(async()=>{await P(o[0],o[1])})),(0,t.Bu)("testHelm1",(async()=>{await P(c[0],c[1])})),(0,t.Bu)("testHelm2",(async()=>{await P(h[0],h[1])})),(0,t.Bu)("testHelm3",(async()=>{await P(u[0],u[1])})),(0,t.Bu)("splitToMonomers",(async()=>{const e=await a.dapi.files.readCsv("System:AppData/Bio/samples/MSA.csv"),s=e.getCol("MSA"),n=await a.functions.call("Bio:detectMacromolecule",{col:s});n&&(s.semType=n),s.setTag("aligned",_.mU);const r=await(0,S.n)(e,s);(0,t.l_)(r.columns.names().includes("17"),!0),await a.data.detectSemanticTypes(r);const i=a.shell.addTableView(r);await v(i.grid),(0,t.l_)(i.grid.dataFrame.id,e.id)})),(0,t.Bu)("getHelmMonomers",(async()=>{const t=e.DataFrame.fromCsv("HELM,Activity\nPEPTIDE1{hHis.N.T}$$$,5.30751\nPEPTIDE1{hHis.Aca.Cys_SEt}$$$,5.72388\n");await a.data.detectSemanticTypes(t);const s=["hHis","Aca","Cys_SEt","N","T"],n=t.getCol("HELM"),r=(0,l.getHelmMonomers)(n),i=s.filter((e=>!r.includes(e))),o=r.filter((e=>!s.includes(e)));if(i.length>0||o.length){const e=[];throw i.length>0&&e.push(`Missed monomers ${JSON.stringify(i)}.`),o.length>0&&e.push(`Unexpected monomers ${JSON.stringify(o)}.`),new Error(e.join(" "))}}))}));var $=s(7228),x=s(6584),N=s(3776),M=s(2428);(0,t.W3)("monomerLibraries",(()=>{let e,s=null;(0,t.bb)((async()=>{e=await(0,$.JN)(),s=(0,x.nW)()})),(0,t.X5)((async()=>{await(0,x.tW)(s)})),(0,t.Bu)("default",(async()=>{await(0,x.tW)({exclude:[],explicit:[]}),await e.loadLibraries(!0);const s=e.getBioLib();(0,t.l_)(s.getPolymerTypes().length>0,!0)})),(0,t.Bu)("forTests",(async()=>{await(0,x.tb)(),await e.loadLibraries(!0);const s=e.getBioLib();(0,t.l_)(s.getPolymerTypes().length,2),(0,t.l_)(s.getMonomerSymbolsByType("PEPTIDE").length,322),(0,t.l_)(s.getMonomerSymbolsByType("RNA").length,383)})),(0,t.Bu)("empty",(async()=>{const s=await(0,x.nW)(),n=M.A.getInstance(),r=(await N.t.getInstance(n)).getValidLibraryPaths();s.exclude=r,s.explicit=[],await(0,x.tW)(s),await e.loadLibraries(!0);const i=e.getBioLib();(0,t.l_)(0===i.getPolymerTypes().length,!0),i.getMonomerMolsByPolymerType("PEPTIDE")}),{skipReason:"#2690"})}));var L=s(4004);function I(){const t=[];return t.push(e.Column.fromList("string","MSA",new Array(10**6).fill("meI/hHis/Aca/N/T/dE/Thr_PO3H2/Aca/D-Tyr_Et/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr//Phe_4Me"))),t.push(e.Column.fromList("string","Activity",new Array(10**6).fill("5.30751"))),t}function R(){const t=[],s="meI/hHis/Aca/N/T/dE/Thr_PO3H2/Aca/D-Tyr_Et/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr".repeat(10**5);return t.push(e.Column.fromList("string","MSA",new Array(100).fill(s))),t.push(e.Column.fromList("string","Activity",new Array(100).fill("7.30751"))),t}async function O(s,n){const r=s(),i=e.DataFrame.fromColumns(r);await a.data.detectSemanticTypes(i);const o=Date.now(),l=(i.columns.byName("MSA"),a.shell.addTableView(i));await v(l.grid),(0,t.l_)(l.grid.dataFrame.id,i.id);const c=Date.now()-o;console.log(`Performance test: ${n}: ${c}ms`)}(0,t.W3)("renderers",(()=>{(0,t.Bu)("long sequence performance ",(async()=>{await O(R,"Long sequences")})),(0,t.Bu)("many sequence performance",(async()=>{await O(I,"Many sequences")})),(0,t.Bu)("many sequence performance",(async()=>{await O(I,"Many sequences")})),(0,t.Bu)("rendererMacromoleculeFasta",(async()=>{await async function(){const s=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA.csv"),n=e.DataFrame.fromCsv(s),r=n.getCol("Sequence"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});i&&(r.semType=i);const o=a.shell.addTableView(n);await a.data.detectSemanticTypes(n),await v(o.grid),(0,t.l_)(o.grid.dataFrame.id,n.id);const l=r.getTag(e.TAGS.CELL_RENDERER);(0,t.l_)(l,"sequence")}()})),(0,t.Bu)("rendererMacromoleculeSeparator",(async()=>{await async function(){const s=await a.dapi.files.readAsText("System:AppData/Bio/data/sample_SEPARATOR_PT.csv"),n=e.DataFrame.fromCsv(s),r=n.getCol("sequence"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});i&&(r.semType=i);const o=a.shell.addTableView(n);await a.data.detectSemanticTypes(n),await v(o.grid),(0,t.l_)(o.grid.dataFrame.id,n.id);const l=r.getTag(e.TAGS.CELL_RENDERER);(0,t.l_)(l,"sequence")}()})),(0,t.Bu)("rendererMacromoleculeDifference",(async()=>{await async function(){const s=e.Column.fromStrings("SequencesDiff",["meI/hHis/Aca/N/T/dK/Thr_PO3H2/Aca#D-Tyr_Et/Tyr_ab-dehydroMe/meN/E/N/dV"]);s.setTag(e.TAGS.UNITS,c.r2.SEPARATOR),s.setTag("separator","/"),s.setTag("aligned","SEQ"),s.setTag("alphabet","UN"),s.setTag(".alphabetIsMultichar","true"),s.semType=_.Of.MACROMOLECULE_DIFFERENCE;const n=e.DataFrame.fromColumns([s]),r=a.shell.addTableView(n);await a.data.detectSemanticTypes(n),await v(r.grid),(0,t.l_)(r.grid.dataFrame.id,n.id);const i=s.getTag(e.TAGS.CELL_RENDERER);(0,t.l_)(i,_.Of.MACROMOLECULE_DIFFERENCE)}()})),(0,t.Bu)("afterMsa",(async()=>{await async function(){const s=await a.dapi.files.readAsText("System:AppData/Bio/data/sample_FASTA.fasta"),n=(0,l.importFasta)(s)[0],r=n.getCol("sequence"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});i&&(r.semType=i);const o=a.shell.addTableView(n);await a.data.detectSemanticTypes(n),console.log("Bio: tests/renderers/afterMsa, table view"),await v(o.grid),(0,t.l_)(o.grid.dataFrame.id,n.id),console.log(`Bio: tests/renderers/afterMsa, src before test semType="${r.semType}", units="${r.getTag(e.TAGS.UNITS)}", cell.renderer="${r.getTag(e.TAGS.CELL_RENDERER)}"`),(0,t.l_)(r.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(r.getTag(e.TAGS.UNITS),c.r2.FASTA),(0,t.l_)(r.getTag("aligned"),"SEQ"),(0,t.l_)(r.getTag("alphabet"),"PT"),(0,t.l_)(r.getTag(e.TAGS.CELL_RENDERER),"sequence");const u=await(0,w.K)({col:r});await v(o.grid),(0,t.l_)(o.grid.dataFrame.id,n.id),(0,t.l_)(u.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(u.getTag(e.TAGS.UNITS),c.r2.FASTA),(0,t.l_)(u.getTag("aligned"),"SEQ.MSA"),(0,t.l_)(u.getTag("alphabet"),"PT"),(0,t.l_)(u.getTag(e.TAGS.CELL_RENDERER),"sequence"),h.Cn.getOrCreate(u)}()})),(0,t.Bu)("afterConvert",(async()=>{await async function(){const s=await a.dapi.files.readAsText("System:AppData/Bio/data/sample_FASTA_PT.csv"),n=e.DataFrame.fromCsv(s),r=n.col("sequence"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});i&&(r.semType=i);const o=a.shell.addTableView(n);await a.data.detectSemanticTypes(n);const l=await(0,L.o)(r,c.r2.SEPARATOR,"/");await v(o.grid),(0,t.l_)(o.grid.dataFrame.id,n.id);const u=l.getTag(e.TAGS.CELL_RENDERER);(0,t.l_)(u,"sequence"),h.Cn.getOrCreate(l)}()})),(0,t.Bu)("selectRendererBySemType",(async()=>{await async function(){const s=e.Column.fromStrings("SequencesDiff",["meI/hHis/Aca/N/T/dK/Thr_PO3H2/Aca#D-Tyr_Et/Tyr_ab-dehydroMe/meN/E/N/dV"]);s.setTag(e.TAGS.UNITS,c.r2.SEPARATOR),s.setTag("separator","/"),s.setTag("aligned","SEQ"),s.setTag("alphabet","UN"),s.setTag(".alphabetIsMultichar","true"),s.semType=_.Of.MACROMOLECULE_DIFFERENCE;const n=e.DataFrame.fromColumns([s]);a.shell.addTableView(n),await(0,t.gw)(100);const r=s.getTag(e.TAGS.CELL_RENDERER);if("MacromoleculeDifference"!==r)throw new Error(`Units 'separator', separator '/' and semType 'MacromoleculeDifference' have been manually set on column but after df was added as table, view renderer has set to '${r}' instead of correct 'MacromoleculeDifference'.`)}()}))}));var k=s(6414),F=s.n(k),D=s(9611);(0,t.W3)("renderers: monomerPlacer",(()=>{const s={splitter:{csv:"id,seq\nid1,m1-M-m3-mon4-mon5-N-T-MON8-N9\nid2,m1-mon2-m3-mon4-mon5-Num-MON8-N9\nid3,mon1-M-mon3-mon4-mon5-MON8-N9\n",testList:[{src:{row:0,x:-1},tgt:{pos:null}},{src:{row:1,x:0},tgt:{pos:null}},{src:{row:1,x:5},tgt:{pos:0}},{src:{row:1,x:6},tgt:{pos:0}},{src:{row:1,x:26},tgt:{pos:1}},{src:{row:1,x:160},tgt:{pos:6}},{src:{row:1,x:185},tgt:{pos:7}},{src:{row:2,x:140},tgt:{pos:5}},{src:{row:2,x:145},tgt:{pos:5}}]},splitterMsa:{csv:"id,seq\nid1,m1-M-m3-mon4-mon5-N-T-MON8-N9\nid2,m1-mon2-m3-mon4-mon5-Num--MON8-N9\nid3,\nid4,mon1-M-mon3-mon4-mon5---MON8-N9\n",testList:[{src:{row:0,x:-1},tgt:{pos:null}},{src:{row:1,x:0},tgt:{pos:null}},{src:{row:1,x:1},tgt:{pos:null}},{src:{row:1,x:4},tgt:{pos:null}},{src:{row:1,x:5},tgt:{pos:0}},{src:{row:1,x:37},tgt:{pos:0}},{src:{row:1,x:38},tgt:{pos:1}},{src:{row:1,x:170},tgt:{pos:4}},{src:{row:1,x:200},tgt:{pos:5}},{src:{row:2,x:20},tgt:{pos:null}},{src:{row:3,x:170},tgt:{pos:4}},{src:{row:3,x:200},tgt:{pos:5}},{src:{row:3,x:282},tgt:{pos:null}}]},fastaMsa:{csv:"id,seq\nid1,QQYNIYPLT\nid2,QQWSSFPYT\nid3,\nid3,QHIRE--LT\n",testList:[{src:{row:1,x:-1},tgt:{pos:null}},{src:{row:1,x:0},tgt:{pos:null}},{src:{row:1,x:1},tgt:{pos:null}},{src:{row:1,x:19},tgt:{pos:0}},{src:{row:1,x:170},tgt:{pos:8}},{src:{row:1,x:171},tgt:{pos:8}},{src:{row:2,x:5},tgt:{pos:null}},{src:{row:3,x:170},tgt:{pos:8}},{src:{row:3,x:181},tgt:{pos:null}}]}};for(const[n,r]of Object.entries(s))(0,t.Bu)(`getPosition-${n}`,(async()=>{const t=e.DataFrame.fromCsv(r.csv);await a.data.detectSemanticTypes(t);const s=t.getCol("seq"),n=new D.A(null,s,(()=>({unitsHandler:h.Cn.getOrCreate(s),monomerCharWidth:7,separatorWidth:12,monomerToShort:c.GU,monomerLengthLimit:3}))),i=r.testList;for(let e=0;e<s.length;++e)n.getCellMonomerLengths(e);const o=[];for(const[e,t]of F().enumerate(i)){const t={pos:n.getPosition(e.src.row,e.src.x)};e.tgt.pos!=t.pos&&o.push(`Test src ${JSON.stringify(e.src)} expected tgt ${JSON.stringify(e.tgt)}, but get ${JSON.stringify({res:t})}`)}if(o.length>0)throw new Error("Test failed error(s):\n"+o.join(", n"))}))})),(0,t.W3)("converters",(()=>{let s;!function(e){e.fastaPt="fastaPt",e.separatorPt="separatorPt",e.helmPt="helmPt",e.fastaDna="fastaDna",e.separatorDna="separatorDna",e.helmDna="helmDna",e.fastaRna="fastaRna",e.separatorRna="separatorRna",e.helmRna="helmRna",e.fastaGaps="fastaGaps",e.separatorGaps="separatorGaps",e.helmGaps="helmGaps",e.fastaUn="fastaUn",e.separatorUn="separatorUn",e.helmUn="helmUn",e.helmLoneDeoxyribose="helmLoneDeoxyribose",e.helmLoneRibose="helmLoneRibose",e.helmLonePhosphorus="helmLonePhosphorus",e.fastaLoneDeoxyribose="fastaLoneDeoxyribose",e.fastaLoneRibose="fastaLoneRibose",e.fastaLonePhosphorus="fastaLonePhosphorus"}(s||(s={}));const n={[s.fastaPt]:"seq\nFWPHEYFWPHEY\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",[s.separatorPt]:"seq\nF-W-P-H-E-Y-F-W-P-H-E-Y\nY-N-R-Q-W-Y-V-Y-N-R-Q-W-Y-V\nM-K-P-S-E-Y-V-M-K-P-S-E-Y-V",[s.helmPt]:"seq\nPEPTIDE1{F.W.P.H.E.Y.F.W.P.H.E.Y}$$$$\nPEPTIDE1{Y.N.R.Q.W.Y.V.Y.N.R.Q.W.Y.V}$$$$\nPEPTIDE1{M.K.P.S.E.Y.V.M.K.P.S.E.Y.V}$$$$",[s.fastaDna]:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",[s.separatorDna]:"seq\nA/C/G/T/C/A/C/G/T/C\nC/A/G/T/G/T/C/A/G/T/G/T\nT/T/C/A/A/C/T/T/C/A/A/C",[s.helmDna]:"seq\nRNA1{d(A)p.d(C)p.d(G)p.d(T)p.d(C)p.d(A)p.d(C)p.d(G)p.d(T)p.d(C)p}$$$$\nRNA1{d(C)p.d(A)p.d(G)p.d(T)p.d(G)p.d(T)p.d(C)p.d(A)p.d(G)p.d(T)p.d(G)p.d(T)p}$$$$\nRNA1{d(T)p.d(T)p.d(C)p.d(A)p.d(A)p.d(C)p.d(T)p.d(T)p.d(C)p.d(A)p.d(A)p.d(C)p}$$$$",[s.fastaRna]:"seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",[s.separatorRna]:"seq\nA*C*G*U*C*A*C*G*U*C\nC*A*G*U*G*U*C*A*G*U*G*U\nU*U*C*A*A*C*U*U*C*A*A*C",[s.helmRna]:"seq\nRNA1{r(A)p.r(C)p.r(G)p.r(U)p.r(C)p.r(A)p.r(C)p.r(G)p.r(U)p.r(C)p}$$$$\nRNA1{r(C)p.r(A)p.r(G)p.r(U)p.r(G)p.r(U)p.r(C)p.r(A)p.r(G)p.r(U)p.r(G)p.r(U)p}$$$$\nRNA1{r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p.r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p}$$$$",[s.fastaGaps]:"seq\nFW-PH-EYYFW-PH-EYY\nFYNRQWYV-FYNRQWYV-\nFKP-Q-SEYVFKP-Q-SEYV",[s.separatorGaps]:"seq\nF/W//P/H//E/Y/Y/F/W//P/H//E/Y/Y\nF/Y/N/R/Q/W/Y/V//F/Y/N/R/Q/W/Y/V/\nF/K/P//Q//S/E/Y/V/F/K/P//Q//S/E/Y/V",[s.helmGaps]:"seq\nPEPTIDE1{F.W.*.P.H.*.E.Y.Y.F.W.*.P.H.*.E.Y.Y}$$$$\nPEPTIDE1{F.Y.N.R.Q.W.Y.V.*.F.Y.N.R.Q.W.Y.V.*}$$$$\nPEPTIDE1{F.K.P.*.Q.*.S.E.Y.V.F.K.P.*.Q.*.S.E.Y.V}$$$$",[s.fastaUn]:"seq\n[meI][hHis][Aca]NT[dE][Thr_PO3H2][Aca]D[meI][hHis][Aca]NT[dE][Thr_PO3H2][Aca]D\n[meI][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2][meI][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2]\n[Lys_Boc][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2][Lys_Boc][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca]",[s.separatorUn]:"seq\nmeI-hHis-Aca-N-T-dE-Thr_PO3H2-Aca-D-meI-hHis-Aca-N-T-dE-Thr_PO3H2-Aca-D\nmeI-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2-meI-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2\nLys_Boc-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2-Lys_Boc-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca",[s.helmUn]:"seq\nPEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D.meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2}$$$$\nPEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca}$$$$",[s.helmLoneDeoxyribose]:"seq\nRNA1{d(A).d(C).d(G).d(T).d(C).d(A).d(C).d(G).d(T).d(C)}$$$$\nRNA1{d(C).d(A).d(G).d(T).d(G).d(T)p.d(C).d(A).d(G).d(T).d(G).d(T)p}$$$$\nRNA1{d(T).d(T).d(C).d(A).d(A).d(C)p.d(T).d(T).d(C).d(A).d(A).d(C)p}$$$$",[s.helmLoneRibose]:"seq\nRNA1{r(A).r(C).r(G).r(U).r(C).r(A).r(C).r(G).r(U).r(C)}$$$$\nRNA1{r(C).r(A).r(G).r(U).r(G).r(U)p.r(C).r(A).r(G).r(U).r(G).r(U)p}$$$$\nRNA1{r(U).r(U).r(C).r(A).r(A).r(C)p.r(U).r(U).r(C).r(A).r(A).r(C)p}$$$$",[s.helmLonePhosphorus]:"seq\nRNA1{p.p.r(A)p.r(C)p.r(G)p.r(U)p.r(C)p.r(A)p.r(C)p.r(G)p.r(U)p.r(C)p}$$$$\nRNA1{p.p.r(C)p.r(A)p.p.r(G)p.r(U)p.r(G)p.r(U)p.r(C)p.r(A)p.p.r(G)p.r(U)p.r(G)p.r(U)p}$$$$\nRNA1{p.r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p.r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p.p.p}$$$$"};async function r(t){const s=n[t],r=e.DataFrame.fromCsv(s);return await a.data.detectSemanticTypes(r),r}function i(s,n){if(s===c.r2.SEPARATOR&&!n)throw new Error(`Argument 'separator' is mandatory for target notation '${s.toString()}'.`);return function(r){const i=h.Cn.getOrCreate(r).convert(s,n);return(0,t.l_)(i.getTag(e.TAGS.UNITS),s),i}}async function o(e,s,n){const i=s((await r(e)).getCol("seq")),o=(await r(n)).getCol("seq");(0,t.f6)(i.toList(),o.toList()),h.Cn.getOrCreate(i)}(0,t.Bu)("testFastaPtToSeparator",(async()=>{await o(s.fastaPt,i(c.r2.SEPARATOR,"-"),s.separatorPt)})),(0,t.Bu)("testFastaDnaToSeparator",(async()=>{await o(s.fastaDna,i(c.r2.SEPARATOR,"/"),s.separatorDna)})),(0,t.Bu)("testFastaRnaToSeparator",(async()=>{await o(s.fastaRna,i(c.r2.SEPARATOR,"*"),s.separatorRna)})),(0,t.Bu)("testFastaGapsToSeparator",(async()=>{await o(s.fastaGaps,i(c.r2.SEPARATOR,"/"),s.separatorGaps)})),(0,t.Bu)("testFastaUnToSeparator",(async()=>{await o(s.fastaUn,i(c.r2.SEPARATOR,"-"),s.separatorUn)})),(0,t.Bu)("testFastaPtToHelm",(async()=>{await o(s.fastaPt,i(c.r2.HELM),s.helmPt)})),(0,t.Bu)("testFastaDnaToHelm",(async()=>{await o(s.fastaDna,i(c.r2.HELM),s.helmDna)})),(0,t.Bu)("testFastaRnaToHelm",(async()=>{await o(s.fastaRna,i(c.r2.HELM),s.helmRna)})),(0,t.Bu)("testFastaGapsToHelm",(async()=>{await o(s.fastaGaps,i(c.r2.HELM),s.helmGaps)})),(0,t.Bu)("testSeparatorPtToFasta",(async()=>{await o(s.separatorPt,i(c.r2.FASTA),s.fastaPt)})),(0,t.Bu)("testSeparatorDnaToFasta",(async()=>{await o(s.separatorDna,i(c.r2.FASTA),s.fastaDna)})),(0,t.Bu)("testSeparatorRnaToFasta",(async()=>{await o(s.separatorRna,i(c.r2.FASTA),s.fastaRna)})),(0,t.Bu)("testSeparatorGapsToFasta",(async()=>{await o(s.separatorGaps,i(c.r2.FASTA),s.fastaGaps)})),(0,t.Bu)("testSeparatorUnToFasta",(async()=>{await o(s.separatorUn,i(c.r2.FASTA),s.fastaUn)})),(0,t.Bu)("testSeparatorPtToHelm",(async()=>{await o(s.separatorPt,i(c.r2.HELM),s.helmPt)})),(0,t.Bu)("testSeparatorDnaToHelm",(async()=>{await o(s.separatorDna,i(c.r2.HELM),s.helmDna)})),(0,t.Bu)("testSeparatorRnaToHelm",(async()=>{await o(s.separatorRna,i(c.r2.HELM),s.helmRna)})),(0,t.Bu)("testSeparatorGapsToHelm",(async()=>{await o(s.separatorGaps,i(c.r2.HELM),s.helmGaps)})),(0,t.Bu)("testHelmDnaToFasta",(async()=>{await o(s.helmDna,i(c.r2.FASTA),s.fastaDna)})),(0,t.Bu)("testHelmRnaToFasta",(async()=>{await o(s.helmRna,i(c.r2.FASTA),s.fastaRna)})),(0,t.Bu)("testHelmPtToFasta",(async()=>{await o(s.helmPt,i(c.r2.FASTA),s.fastaPt)})),(0,t.Bu)("testHelmUnToFasta",(async()=>{await o(s.helmUn,i(c.r2.FASTA),s.fastaUn)})),(0,t.Bu)("testHelmDnaToSeparator",(async()=>{await o(s.helmDna,i(c.r2.SEPARATOR,"/"),s.separatorDna)})),(0,t.Bu)("testHelmRnaToSeparator",(async()=>{await o(s.helmRna,i(c.r2.SEPARATOR,"*"),s.separatorRna)})),(0,t.Bu)("testHelmPtToSeparator",(async()=>{await o(s.helmPt,i(c.r2.SEPARATOR,"-"),s.separatorPt)})),(0,t.Bu)("testHelmUnToSeparator",(async()=>{await o(s.helmUn,i(c.r2.SEPARATOR,"-"),s.separatorUn)})),(0,t.Bu)("testHelmLoneRibose",(async()=>{await o(s.helmLoneRibose,i(c.r2.FASTA),s.fastaRna)})),(0,t.Bu)("testHelmLoneDeoxyribose",(async()=>{await o(s.helmLoneDeoxyribose,i(c.r2.SEPARATOR,"/"),s.separatorDna)})),(0,t.Bu)("testHelmLonePhosphorus",(async()=>{await o(s.helmLonePhosphorus,i(c.r2.FASTA),s.fastaRna)}))}));var G=s(5226);(0,t.W3)("fastaFileHandler",(()=>{const s=["description:1","description:2","description:3","description:4"],n=(e.Column.fromStrings("description",s),["MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW","MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL","MMELVLKTIIGPIVVGVVLRIVDKWLNKDK","MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN"]);function r(e){const r=new G.i(e),i=r.descriptionsArray,o=r.sequencesArray;(0,t.f6)([i,o],[s,n])}(0,t.Bu)("testNormalFormatting",(async()=>{r(">description:1\nMDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\n\n>description:2\nMIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL\n\n>description:3\nMMELVLKTIIGPIVVGVVLRIVDKWLNKDK\n\n>description:4\nMDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN\n")})),(0,t.Bu)("testExtraSpaces",(async()=>{r(">description:1\n MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\n\n>description:2\nMI EVF LFGIVLGLI PITLAGLFVTAY LQYRRGDQLDL\n\n>description:3\nM MELVLKTI IGPI VVGVVLR IVDKWLNKDK\n\n>description:4\nMDR TDEVSNHTHDKP TLTWFEEIFEEYHSPFHN\n ")})),(0,t.Bu)("testExtraNewlines",(async()=>{r(">description:1\n\nMDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\n\n>description:2\nMIEVF\nLFGIVLGLI\nPITLAGLFVTA\nYLQYRRGDQLDL\n\n>description:3\nM\nME\n\nLVLKTIIG\n\nPIVVGVVLRI\nVDKWLNKDK\n\n\n>description:4\n\nMDRT\n\nDEVSNHTHDKP\n\nTLTWFEEIFEE\n\n\n\nYHSPFHN\n")}))}));var H=s(9943);(0,t.W3)("fastaExport",(()=>{let s;!function(e){e.single="single",e.multi="multi"}(s||(s={}));const n={[s.single]:{src:"MDYKETLLMPKTDFPMRGGLP",tgt:["MDYKETLLMP","KTDFPMRGGL","P"]},[s.multi]:{src:"M[MeI]YKETLL[MeF]PKTDFPMRGGL[MeA]",tgt:["M[MeI]YKETLL[MeF]P","KTDFPMRGGL","[MeA]"]}};let r;!function(e){e.test1="test1",e.test2="test2"}(r||(r={}));const i={[r.test1]:{srcCsv:"id,seq\n1,MDYKETLLMP\n2,KTDFPMRGGL\n3,P",idCols:["id"],seqCol:"seq",lineWidth:10,tgtFasta:">1\nMDYKETLLMP\n>2\nKTDFPMRGGL\n>3\nP\n"},[r.test2]:{srcCsv:"id,id2,seq\n1,seqA,M[MeI]YKETLL[MeF]P\n2,seqB,KTDFPMRGGL\n3,seqC,[MeA]\n",idCols:["id2","id"],seqCol:"seq",lineWidth:5,tgtFasta:">seqA|1\nM[MeI]YKE\nTLL[MeF]P\n>seqB|2\nKTDFP\nMRGGL\n>seqC|3\n[MeA]\n"}};function o(e,s=10){const r=c.kB,i=n[e].src,o=(0,H.sK)(i,r,s),a=n[e].tgt;(0,t.f6)(o,a)}async function a(s){const n=e.DataFrame.fromCsv(s.srcCsv),r=n.getCol(s.seqCol),i=s.idCols.map((e=>n.getCol(e))),o=(0,H.i$)(i,r,s.lineWidth);(0,t.l_)(o,s.tgtFasta)}(0,t.Bu)("wrapSequenceSingle",(async()=>{o(s.single,10)})),(0,t.Bu)("wrapSequenceMulti",(async()=>{o(s.multi,10)})),(0,t.Bu)("saveAsFastaTest1",(async()=>{a(i[r.test1])})),(0,t.Bu)("saveAsFastaTest2",(async()=>{a(i[r.test2])}))}));var W=s(7331),B=s(8260);(0,t.W3)("bio",(()=>{const s="seq\nACGTCT\nCAGTGT\nTTCAAC";(0,t.Bu)("testGetStatsHelm1",(async()=>{const s=e.DataFrame.fromCsv("seq\nPEPTIDE1{meI}$$$$").getCol("seq"),n=(0,B.jY)(s,1,c.gP);(0,t.Wh)(n.freq,{meI:1}),(0,t.l_)(n.sameLength,!0)})),(0,t.Bu)("testGetStatsN1",(async()=>{await async function(s){const n=e.DataFrame.fromCsv(s).col("seq"),r=(0,B.jY)(n,5,c.kB);(0,t.Wh)(r.freq,{A:4,C:5,G:3,T:6}),(0,t.l_)(r.sameLength,!0)}(s)})),(0,t.Bu)("testGetAlphabetSimilarity",(async()=>{await async function(){const e=new Set(Object.keys(o.V.Names)),s=(0,c.KX)({A:2041,C:3015,G:3015,T:2048,"-":1e3},e);(0,t.l_)(s>.6,!0)}()})),(0,t.Bu)("testPickupPaletteN1",(async()=>{await async function(s){const n=e.DataFrame.fromCsv(s).col("seq"),r=(0,c.dQ)(n);(0,t.l_)(r instanceof o.J,!0)}(s)})),(0,t.Bu)("testPickupPaletteN1e",(async()=>{await async function(s){const n=e.DataFrame.fromCsv("seq\nACGTAT\nCAGTTG\nTTCG2C").col("seq"),r=(0,c.dQ)(n);(0,t.l_)(r instanceof o.J,!0)}()})),(0,t.Bu)("testPickupPaletteAA1",(async()=>{await async function(s){const n=e.DataFrame.fromCsv("seq\nFWPHEYV\nYNRQWYV\nMKPSEYV").col("seq"),i=(0,c.dQ)(n);(0,t.l_)(i instanceof r.f,!0)}()})),(0,t.Bu)("testPickupPaletteX",(async()=>{await async function(s){const n=e.DataFrame.fromCsv("seq\nXZJ{}2\n5Z4733\n3Z6></\n675687").col("seq"),r=(0,c.dQ)(n);(0,t.l_)(r instanceof W.kQ,!0)}()}))})),(0,t.W3)("WebLogo.monomerToShort",(()=>{(0,t.Bu)("longMonomerSingle",(async()=>{(0,t.l_)((0,c.GU)("S",5),"S")})),(0,t.Bu)("longMonomerShort",(async()=>{(0,t.l_)((0,c.GU)("Short",5),"Short")})),(0,t.Bu)("longMonomerLong56",(async()=>{(0,t.l_)((0,c.GU)("Long56",6),"Long56")})),(0,t.Bu)("longMonomerComplexFirstPartShort",(async()=>{(0,t.l_)((0,c.GU)("Long-long",5),"Long…")})),(0,t.Bu)("longMonomerComplexFirstPartLong56",(async()=>{(0,t.l_)((0,c.GU)("Long56-long",6),"Long5…")})),(0,t.Bu)("monomerToShort",(async()=>{const e=[["AbC","AbC"],["AbCd","Ab…"],["ABc","ABc"],["ABcd","AB…"],["A_b","A_b"],["A_bc","A…"],["Ab_c","Ab…"],["A1_b","A1…"],["Abc_d","Ab…"],["Abcd_e","Ab…"],["A-b","A-b"],["A-bc","A…"],["Ab-c","Ab…"],["A1-b","A1…"],["Abc-d","Ab…"],["Abcd-e","Ab…"],["A","A"],["Ab","Ab"],["Abc","Abc"],["Ab…","Ab…"],["Abcd","Ab…"],["Abcde","Ab…"]],s=e.map((e=>e[0])),n=e.map((e=>e[1])),r=s.map((e=>(0,c.GU)(e,3)));(0,t.f6)(r,n)}))}));var V=s(8415);function U(e,s){(0,t.l_)(e.name,s.name),(0,t.f6)(e.getMonomers(),s.getMonomers());for(const n of e.getMonomers())(0,t.l_)(e.getFreq(n).rowCount,s.getFreq(n).rowCount)}(0,t.W3)("WebLogo-positions",(()=>{const s="seq\nATC-G-TTGC--\nATC-G-TTGC--\n-TC-G-TTGC--\n-TC-GCTTGC--\n-TC-GCTTGC--";(0,t.Bu)("allPositions",(async()=>{const n=e.DataFrame.fromCsv(s),r=a.shell.addTableView(n),i=n.getCol("seq");i.semType=e.SEMTYPE.MACROMOLECULE,i.setTag(e.TAGS.UNITS,c.r2.FASTA),i.setTag("alphabet","DNA"),i.setTag("aligned","SEQ.MSA");const o=await n.plot.fromType("WebLogo");await(0,t.zg)(o.onLayoutCalculated,(()=>{}),(()=>{r.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const l=o.positions,h=[new V.CK(0,"1",{A:new V.yW(2),"-":new V.yW(3)}),new V.CK(1,"2",{T:new V.yW(5)}),new V.CK(2,"3",{C:new V.yW(5)}),new V.CK(3,"4",{"-":new V.yW(5)}),new V.CK(4,"5",{G:new V.yW(5)}),new V.CK(5,"6",{"-":new V.yW(3),C:new V.yW(2)}),new V.CK(6,"7",{T:new V.yW(5)}),new V.CK(7,"8",{T:new V.yW(5)}),new V.CK(8,"9",{G:new V.yW(5)}),new V.CK(9,"10",{C:new V.yW(5)}),new V.CK(10,"11",{"-":new V.yW(5)}),new V.CK(11,"12",{"-":new V.yW(5)})];(0,t.l_)(l.length,h.length);for(let e=0;e<l.length;e++){(0,t.l_)(l[e].name,h[e].name);for(const s of l[e].getMonomers())(0,t.l_)(l[e].getFreq(s).rowCount,h[e].getFreq(s).rowCount)}await o.awaitRendered()})),(0,t.Bu)("positions with shrinkEmptyTail option true (filtered)",(async()=>{const s=e.DataFrame.fromCsv("seq\n-TC-G-TTGC--\n-TC-GCTTGC--\n-T--C-GT-\n-T--C-GT-\n-T--C-GT-\n-T--CCGT-"),n=a.shell.addTableView(s),r=s.getCol("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.setTag(e.TAGS.UNITS,c.r2.FASTA),r.setTag("alphabet","DNA"),r.setTag("aligned","SEQ"),s.filter.init((e=>e>2)),s.filter.fireChanged();const i=await s.plot.fromType("WebLogo",{shrinkEmptyTail:!0});await(0,t.zg)(i.onLayoutCalculated,(()=>{}),(()=>{n.dockManager.dock(i.root,e.DOCK_TYPE.DOWN)}),500);const o=i.positions,l=[new V.CK(0,"1",{"-":new V.yW(3)}),new V.CK(1,"2",{T:new V.yW(3)}),new V.CK(2,"3",{"-":new V.yW(3)}),new V.CK(3,"4",{"-":new V.yW(3)}),new V.CK(4,"5",{C:new V.yW(3)}),new V.CK(5,"6",{"-":new V.yW(2),C:new V.yW(1)}),new V.CK(6,"7",{G:new V.yW(3)}),new V.CK(7,"8",{T:new V.yW(3)}),new V.CK(8,"9",{"-":new V.yW(3)})];(0,t.l_)(o.length,l.length);for(let e=0;e<o.length;e++){(0,t.l_)(o[e].name,l[e].name);for(const s of o[e].getMonomers())(0,t.l_)(o[e].getFreq(s).rowCount,l[e].getFreq(s).rowCount)}await i.awaitRendered()})),(0,t.Bu)("positions with skipEmptyPositions option",(async()=>{const n=e.DataFrame.fromCsv(s),r=a.shell.addTableView(n),i=n.getCol("seq");i.semType=e.SEMTYPE.MACROMOLECULE,i.setTag(e.TAGS.UNITS,c.r2.FASTA),i.setTag("alphabet","DNA"),i.setTag("aligned","SEQ.MSA");const o=await n.plot.fromType("WebLogo",{skipEmptyPositions:!0});await(0,t.zg)(o.onLayoutCalculated,(()=>{}),(()=>{r.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const l=o.positions,h=[new V.CK(0,"1",{A:new V.yW(2),"-":new V.yW(3)}),new V.CK(1,"2",{T:new V.yW(5)}),new V.CK(2,"3",{C:new V.yW(5)}),new V.CK(4,"5",{G:new V.yW(5)}),new V.CK(5,"6",{"-":new V.yW(3),C:new V.yW(2)}),new V.CK(6,"7",{T:new V.yW(5)}),new V.CK(7,"8",{T:new V.yW(5)}),new V.CK(8,"9",{G:new V.yW(5)}),new V.CK(9,"10",{C:new V.yW(5)})];(0,t.l_)(l.length,h.length);for(let e=0;e<l.length;e++)U(l[e],h[e]);await o.awaitRendered()})),(0,t.Bu)("count sequences for monomer at position",(async()=>{const n=function(t,s,n,r){const i=e.DataFrame.fromCsv(t),o=i.getCol("seq");return o.semType=e.SEMTYPE.MACROMOLECULE,o.setTag(e.TAGS.UNITS,s),o.setTag("alphabet","DNA"),o.setTag("aligned","SEQ.MSA"),i}(s,c.r2.FASTA),r=n.getCol("seq"),i=a.shell.addTableView(n),o=await n.plot.fromType("WebLogo",{startPositionName:"3",endPositionName:"7",skipEmptyPositions:!0});await(0,t.zg)(o.onLayoutCalculated,(()=>{}),(()=>{i.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const l=o.positions,u=[new V.CK(2,"3",{C:new V.yW(5)}),new V.CK(4,"5",{G:new V.yW(5)}),new V.CK(5,"6",{"-":new V.yW(3),C:new V.yW(2)}),new V.CK(6,"7",{T:new V.yW(5)})];(0,t.l_)(l.length,u.length);for(let e=0;e<l.length;e++)U(l[e],u[e]);const d=l[1],m=h.Cn.getOrCreate(r),p=(0,V.eZ)(n,m,n.filter,"G",d);(0,t.l_)(p,5),await o.awaitRendered()})),(0,t.Bu)("empty",(async()=>{const s=e.DataFrame.fromColumns([(()=>{const t=e.Column.fromStrings("seq",[]);return t.setTag(e.TAGS.SEMTYPE,e.SEMTYPE.MACROMOLECULE),t.setTag(e.TAGS.UNITS,c.r2.FASTA),t.setTag("alphabet","DNA"),t})()]),n=a.shell.addTableView(s),r=await s.plot.fromType("WebLogo");await(0,t.zg)(r.onLayoutCalculated,(()=>{}),(()=>{n.dockManager.dock(r.root,e.DOCK_TYPE.DOWN)}),500),r.positions,await r.awaitRendered()}))})),(0,t.W3)("WebLogo-project",(()=>{(0,t.Bu)("fasta",(async()=>{const s="Tests.Bio.WebLogo-project.fasta",n=await ge.files.readCsv("tests/filter_FASTA.csv"),r=n.name,i=n.getCol("fasta");await a.data.detectSemanticTypes(n);const o=a.shell.addTableView(n),l=await n.plot.fromType("WebLogo",{sequenceColumnName:i.name});o.dockManager.dock(l),await l.awaitRendered(),await v(o.grid),await async function(t,s,n,r){const i=e.Project.create(),o=n.saveLayout();await a.dapi.layouts.save(n.saveLayout()),await a.dapi.tables.uploadDataFrame(r),await a.dapi.tables.save(s),i.name=t,i.addChild(s),i.addChild(o),await a.dapi.projects.save(i)}(s,n.getTableInfo(),o,n),a.shell.closeAll(),await(0,t.gw)(500),await a.dapi.projects.open(s);const c=a.shell.getTableView(r),h=F()(c.viewers).toArray();(0,t.l_)(h.length,2),(0,t.l_)(h.filter((e=>"Grid"===e.type)).length,1);const u=h.find((e=>"WebLogo"===e.type));(0,t.l_)(!!u,!0),await v(o.grid),await u.awaitRendered()}),{skipReason:"depends on 1.18"})})),(0,t.W3)("WebLogo-layout",(()=>{(0,t.Bu)("fasta",(async()=>{const e=await ge.files.readCsv("tests/filter_FASTA.csv"),s=e.getCol("fasta");await a.data.detectSemanticTypes(e);const n=a.shell.addTableView(e),r=await e.plot.fromType("WebLogo",{sequenceColumnName:s.name});n.dockManager.dock(r),await r.awaitRendered(),await v(n.grid);const i=n.saveLayout();i.toJson(),n.loadLayout(i),await r.awaitRendered(),await v(n.grid);const o=F()(n.viewers).toArray();(0,t.l_)(o.length,2),(0,t.l_)(o.filter((e=>"Grid"===e.type)).length,1),(0,t.l_)(o.filter((e=>"WebLogo"===e.type)).length,1)}))}));var j=s(2568);function Y(e,t){let s=null;for(const n of e.viewers)n.type===t&&(s=n);return s}(0,t.W3)("checkInputColumn",(()=>{const s="seq\nseq1,\nseq2,\nseq3,\nseq4";(0,t.Bu)("testMsaPos",(async()=>{const n=e.DataFrame.fromCsv(s).getCol("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.setTag(e.TAGS.UNITS,c.r2.FASTA),n.setTag("alphabet","DNA"),n.setTag("aligned","SEQ");const[r,i]=(0,j.l)(n,"Test",[c.r2.FASTA],["DNA","RNA","PT"]);(0,t.l_)(r,!0)})),(0,t.Bu)("testMsaNegHelm",(async()=>{const n=e.DataFrame.fromCsv(s).getCol("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.setTag(e.TAGS.UNITS,c.r2.HELM),n.setTag(".alphabetIsMultichar","true");const[r,i]=(0,j.l)(n,"Test",[c.r2.FASTA],["DNA","RNA","PT"]);(0,t.l_)(r,!1)})),(0,t.Bu)("testMsaNegUN",(async()=>{const n=e.DataFrame.fromCsv(s).getCol("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.setTag(e.TAGS.UNITS,c.r2.FASTA),n.setTag("alphabet","UN"),n.setTag(".alphabetSize","11"),n.setTag(".alphabetIsMultichar","true"),n.setTag("aligned","SEQ");const[r,i]=(0,j.l)(n,"Test",[c.r2.FASTA],["DNA","RNA","PT"]);(0,t.l_)(r,!1)})),(0,t.Bu)("testGetActionFunctionMeta",(async()=>{e.Func.find({package:"Bio",name:"multipleSequenceAlignmentDialog"})[0].inputs.find((e=>"sequence"==e.name))}))})),(0,t.W3)("similarity/diversity",(async()=>{(0,t.Bu)("similaritySearchViewer",(async()=>{await async function(){const s=await ge.files.readAsText("tests/sample_MSA_data.csv"),n=e.DataFrame.fromCsv(s);await a.data.detectSemanticTypes(n);const r=a.shell.addTableView(n),i=r.dataFrame.getCol("MSA");(0,t.l_)(i.semType,e.SEMTYPE.MACROMOLECULE);const o=await r.dataFrame.plot.fromType("Sequence Similarity Search");let l=!1;if(o.computeCompleted.subscribe((e=>{e&&(l=!0)})),r.dockManager.dock(o,e.DOCK_TYPE.RIGHT,null,"Similarity"),await o.renderPromise,await(0,t.ow)((()=>void 0!==Y(r,"Sequence Similarity Search")),"Sequence Similarity Search viewer has not been created",100),!o.initialized)throw new Error("The viewer is not initialized.");if(!o.moleculeColumn)throw new Error("The viewer has not molecule column (onTableAttached).");if(!o.beforeRender())throw new Error("The viewer is not able to render.");if(!o.computeRequested)throw new Error("The viewer has not compute requested even.");if(!l)throw new Error("The viewer has not compute completed.");const c=o;await(0,t.ow)((()=>0!==c.root.getElementsByClassName("d4-grid").length),"Sequence Similarity Search viewer grid has not been created",100);(0,t.l_)(c.fingerprint,"Morgan"),(0,t.l_)(c.distanceMetric,"Tanimoto"),(0,t.l_)(c.scores.get(0),e.FLOAT_NULL),(0,t.l_)(c.idxs.get(0),0),(0,t.l_)(c.molCol.get(0),"D-Tyr_Et/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr//Phe_4Me"),(0,t.l_)(c.scores.get(1).toFixed(2),"0.73"),(0,t.l_)(c.idxs.get(1),4),(0,t.l_)(c.molCol.get(1),"Thr_PO3H2/Aca/D-Tyr_Et/Tyr_ab-dehydroMe/dV/Chg/N/D-Orn/D-aThr//Phe_4Me"),r.dataFrame.currentRowIdx=1,await(0,t.ow)((()=>1===c.targetMoleculeIdx),"Target molecule has not been changed",5e3),await(0,t.ow)((()=>"meI/hHis/Aca/Cys_SEt/T/dK/Thr_PO3H2/Aca/Tyr_PO3H2/D-Chg/dV/Phe_ab-dehydro/N/D-Orn/D-aThr//Phe_4Me"===c.molCol.get(0)),"Incorrect first similar molecule",5e3)}()})),(0,t.Bu)("diversitySearchViewer",(async()=>{await async function(){const s=await ge.files.readAsText("tests/sample_MSA_data.csv"),n=e.DataFrame.fromCsv(s),r=a.shell.addTableView(n);await a.data.detectSemanticTypes(n);const i=r.dataFrame.getCol("MSA");(0,t.l_)(i.semType,e.SEMTYPE.MACROMOLECULE);const o=await r.dataFrame.plot.fromType("Sequence Diversity Search");let l=!1;if(o.computeCompleted.subscribe((e=>{e&&(l=!0)})),r.dockManager.dock(o,e.DOCK_TYPE.DOWN,null,"Diversity"),await o.renderPromise,await(0,t.ow)((()=>void 0!==Y(r,"Sequence Diversity Search")),"Sequence Diversity Search viewer has not been created",100),!o.initialized)throw new Error("The viewer is not initialized.");if(!o.moleculeColumn)throw new Error("The viewer has not molecule column (onTableAttached).");if(!o.beforeRender())throw new Error("The viewer is not able to render.");if(!o.computeRequested)throw new Error("The viewer has not compute requested even.");if(!l)throw new Error("The viewer has not compute completed.");const c=o;await(0,t.ow)((()=>0!==c.root.getElementsByClassName("d4-grid").length),"Sequence Diversity Search viewer grid has not been created",100),(0,t.l_)(c.fingerprint,"Morgan"),(0,t.l_)(c.distanceMetric,"Tanimoto"),(0,t.l_)(c.initialized,!0),(0,t.l_)(c.renderMolIds.length>0,!0)}()}))}));var K=s(3870),q=s(5393),Z=s(8755);async function z(e,t){if(!t.columns.names().includes(e))throw new Error(`The column '${e}' not found. Available in data frame are ${JSON.stringify(t.columns.names())}`);const s=new q.ST;return s.attach(t),s.applyState({columnName:e}),s.column=t.col(e),s.columnName=e,s}(0,t.W3)("substructureFilters",(async()=>{let e,s;(0,t.bb)((async()=>{e=await(0,$.JN)(),s=await(0,x.nW)(),await(0,x.tb)(),await e.loadLibraries(!0)})),(0,t.X5)((async()=>{await(0,x.tW)(s),await e.loadLibraries(!0)})),(0,t.Bu)("fasta",(async()=>{const e=await b("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(e);const s=new q.ST;s.attach(e),await s.awaitRendered();try{(0,t.l_)(!!s.bioFilter,!0),(0,t.l_)(s.bioFilter.type,"FastaBioFilter");const n=s.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{n.props=new Z.x("MD")}),5e3,"testEvent onRowsFiltered"),(0,t.l_)(s.dataFrame.filter.trueCount,3),(0,t.l_)(s.dataFrame?.filter.toBinaryString(),"10010000100000")}finally{s.detach()}await s.awaitRendered()})),(0,t.Bu)("separator",(async()=>{const e=await b("tests/filter_MSA.csv"),s=new q.ST;await a.data.detectSemanticTypes(e),s.attach(e),await s.awaitRendered();try{(0,t.l_)(!!s.bioFilter,!0),(0,t.l_)(s.bioFilter.type,"SeparatorBioFilter");const n=s.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{n.props=new q.LH("meI")}),5e3,"testEvent onRowsFiltered"),(0,t.l_)(s.dataFrame.filter.trueCount,7),(0,t.l_)(s.dataFrame.filter.get(2),!1),await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{n.props=new q.LH("/meI")}),5e3,"testEvent onRowsFiltered"),(0,t.l_)(s.dataFrame.filter.trueCount,0),await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{n.props=new q.LH("meI-hHis","-")}),5e3,"testEvent onRowsFiltered"),(0,t.l_)(s.dataFrame.filter.trueCount,7),(0,t.l_)(s.dataFrame.filter.get(2),!1)}finally{s.detach()}await s.awaitRendered()})),(0,t.Bu)("helm-dialog",(async()=>{const e="Bio tests: substructureFilters/helm-dialog",s=await b("tests/filter_HELM.csv");await a.data.detectSemanticTypes(s);const n=a.shell.addTableView(s);ge.logger.debug(`${e}, filter attaching.`);const r=new q.ST;r.attach(s);const i=K.dialog("Test filters").add(r.root).show();await r.awaitRendered();try{const i=r.bioFilter;(0,t.l_)(null!==r.bioFilter,!0,"bioFilter is not created"),ge.logger.debug(`${e}, filter 1 change awaiting...`),await(0,t.zg)(s.onRowsFiltered,(()=>{}),(()=>{i.props=new Z.x("PEPTIDE1{A.C}$$$$V2.0")}),2e4),ge.logger.debug(`${e}, filter 1 changed.`),(0,t.l_)(r.dataFrame.filter.trueCount,1),(0,t.l_)(r.dataFrame.filter.toBinaryString(),"0001"),ge.logger.debug(`${e}, filter 2 change awaiting...`),await(0,t.zg)(s.onRowsFiltered,(()=>{}),(()=>{i.props=new Z.x("PEPTIDE1{C}$$$$V2.0")}),2e4),await v(n.grid),ge.logger.debug(`${e}, filter 2 changed.`),(0,t.l_)(r.dataFrame.filter.trueCount,2),(0,t.l_)(r.dataFrame.filter.toBinaryString(),"1001")}finally{i.close()}await r.awaitRendered()})),(0,t.Bu)("helm-view",(async()=>{const e=await b("tests/filter_HELM.csv");e.getCol("HELM string"),await a.data.detectSemanticTypes(e);const t=a.shell.addTableView(e);t.getFiltersGroup(),await v(t.grid)})),(0,t.Bu)("sync-fasta",(async()=>{const e=await ge.files.readCsv("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(e);const s=await z("fasta",e),n=await z("fasta",e);await Promise.all([s.awaitRendered(),n.awaitRendered()]);try{(0,t.l_)(!!s.bioFilter,!0),(0,t.l_)(!!n.bioFilter,!0),(0,t.l_)(s.bioFilter.type,"FastaBioFilter"),(0,t.l_)(n.bioFilter.type,"FastaBioFilter");const r=s.bioFilter,i=n.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new Z.x("MD")}),1e4,"await onRowsFiltered"),(0,t.l_)(e.filter.trueCount,3),await s.awaitRendered(),(0,t.l_)(i.props.substructure,"MD")}finally{s.detach(),n.detach()}await Promise.all([s.awaitRendered(),n.awaitRendered()])})),(0,t.Bu)("sync-msa",(async()=>{const e=await ge.files.readCsv("tests/filter_MSA.csv");await a.data.detectSemanticTypes(e);const s="hHis-Aca",n=await z("MSA",e),r=await z("MSA",e);await Promise.all([n.awaitRendered(),r.awaitRendered()]);try{(0,t.l_)(!!n.bioFilter,!0),(0,t.l_)(!!r.bioFilter,!0),(0,t.l_)(n.bioFilter.type,"SeparatorBioFilter"),(0,t.l_)(r.bioFilter.type,"SeparatorBioFilter");const i=n.bioFilter,o=r.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{i.props=new q.LH(s,"-")}),1e4,"await onRowsFiltered"),(0,t.l_)(e.filter.trueCount,8),(0,t.l_)(o.props.substructure,s),(0,t.l_)(o.props.separator,"-")}finally{n.detach(),r.detach()}await Promise.all([n.awaitRendered(),r.awaitRendered()])})),(0,t.Bu)("sync-helm",(async()=>{const e=await ge.files.readCsv("tests/filter_HELM.csv");await a.data.detectSemanticTypes(e);const s=a.shell.addTableView(e),n="PEPTIDE1{A.C}$$$$V2.0",r=await z("HELM string",e),i=await z("HELM string",e),o=K.dialog("Test filters").add(r.root).add(i.root).show();await Promise.all([r.awaitRendered(),i.awaitRendered()]);try{(0,t.l_)(!!r.bioFilter,!0),(0,t.l_)(!!i.bioFilter,!0),(0,t.l_)(r.bioFilter.type,"HelmBioFilter"),(0,t.l_)(i.bioFilter.type,"HelmBioFilter");const o=r.bioFilter,a=i.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{o.props=new Z.x(n)}),6e4,"await onRowsFiltered"),await v(s.grid),ge.logger.debug("Bio tests: substructureFilters/sync-helm, before changed event"),await(0,t.gw)(2*r.debounceTime),ge.logger.debug("Bio tests: substructureFilters/sync-helm, after changed event"),(0,t.l_)(e.filter.trueCount,1),await r.awaitRendered(),(0,t.l_)(a.props.substructure,n)}finally{r.detach(),i.detach(),o.close()}await Promise.all([r.awaitRendered(),i.awaitRendered()]),await v(s.grid)}))}));var X=s(8341);(0,t.W3)("PepSeA",(()=>{(0,t.Bu)("Basic alignment",(async()=>{await C();const s=e.DataFrame.fromCsv('HELM,MSA\n "PEPTIDE1{F.L.R.G.W.[MeF].Y.S.N.N.C}$$$$","F.L.R.G.W.MeF.Y..S.N.N.C"\n "PEPTIDE1{F.L.R.G.Y.[MeF].Y.W.N.C}$$$$","F.L.R.G.Y.MeF.Y.W...N.C"\n "PEPTIDE1{F.G.Y.[MeF].Y.W.S.D.N.C}$$$$","F...G.Y.MeF.Y.W.S.D.N.C"\n "PEPTIDE1{F.L.R.G.Y.[MeF].Y.W.S.N.D.C}$$$$","F.L.R.G.Y.MeF.Y.W.S.N.D.C"\n "PEPTIDE1{F.V.R.G.Y.[MeF].Y.W.S.N.C}$$$$","F.V.R.G.Y.MeF.Y.W.S..N.C"'),n=await(0,X.f3)(s.getCol("HELM"),"msa(HELM)");(0,t.l_)(null!==n,!0,"PepSeA container has not started");const r=s.getCol("MSA");for(let e=0;e<n.length;++e)(0,t.l_)(n.get(e)==r.get(e),!0)}),{timeout:6e4})})),(0,t.W3)("viewers",(()=>{const s=e.Func.find({package:"Bio",tags:["viewer"]}).map((e=>e.friendlyName));for(const e of s)(0,t.Bu)(e,(async()=>{const s=await b("data/sample_FASTA_DNA.csv");await(0,t.AB)(e,s,{detectSemanticTypes:!0})}),{skipReason:{"Sequence Similarity Search":"GROK-13162","Sequence Diversity Search":"GROK-13162",WebLogo:"GROK-13162",VdRegions:"GROK-13162"}[e]})}));const J="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",Q="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT",ee="seq\nabc-dfgg-abc1-cfr3-rty-wert-abc-dfgg-abc1-cfr3-rty-wert\nrut12-her2-rty-wert-abc-abc1-dfgg-rut12-her2-rty-wert-abc-abc1-dfgg\nrut12-rty-her2-abc-cfr3-wert-rut12-rut12-rty-her2-abc-cfr3-wert-rut12";var te;(0,t.W3)("UnitsHandler",(()=>{async function s(t){const s=e.DataFrame.fromCsv(t);await a.data.detectSemanticTypes(s);const n=h.Cn.getOrCreate(s.getCol("seq"));return[s,n]}(0,t.Bu)("Seq-Fasta",(async()=>{const[e,n]=await s(J);(0,t.l_)(n.notation,c.r2.FASTA),(0,t.l_)(n.isMsa(),!1)})),(0,t.Bu)("Seq-Fasta-MSA",(async()=>{const[e,n]=await s(Q);(0,t.l_)(n.notation,c.r2.FASTA),(0,t.l_)(n.isMsa(),!0)})),(0,t.Bu)("Seq-Fasta-units",(async()=>{const[e,n]=await s(J);(0,t.l_)(n.notation,c.r2.FASTA),(0,t.l_)(n.isMsa(),!1)})),(0,t.Bu)("Seq-Fasta-MSA-units",(async()=>{const[e,n]=await s(Q);(0,t.l_)(n.notation,c.r2.FASTA),(0,t.l_)(n.isMsa(),!0)})),(0,t.Bu)("Seq-Helm",(async()=>{const[e,n]=await s("seq\nPEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.Tyr_ab-dehydroMe.dV.E.N.D-Orn.D-aThr.Phe_4Me}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.D-Chg.dV.Phe_ab-dehydro.N.D-Orn.D-aThr.Phe_4Me}$$$$\nPEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me}$$$$");(0,t.l_)(n.notation,c.r2.HELM),(0,t.l_)(n.isHelm(),!0)})),(0,t.Bu)("Seq-UN",(async()=>{const[e,n]=await s(ee);(0,t.l_)(n.notation,c.r2.SEPARATOR),(0,t.l_)(n.separator,"-"),(0,t.l_)(n.alphabet,"UN")})),(0,t.Bu)("Seq-UN-auto",(async()=>{const[e,n]=await s(ee);(0,t.l_)(n.notation,c.r2.SEPARATOR),(0,t.l_)(n.separator,"-"),(0,t.l_)(n.alphabet,"UN")}))})),function(e){e.fasta="fasta",e.fastaMsa="fastaMsa",e.separator="separator",e.separatorMsa="separatorMsa",e.helm="helm"}(te||(te={})),(0,t.W3)("UnitsHandler",(()=>{h._9[c.r2.FASTA],h._9[c.r2.HELM];const s=h._9[c.r2.SEPARATOR],n={[te.fasta]:{src:{csv:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC"},tgt:{notation:c.r2.FASTA,splitted:["ACGTCACGTC","CAGTGTCAGTGT","TTCAACTTCAAC"]}},[te.fastaMsa]:{src:{csv:"seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT"},tgt:{notation:c.r2.FASTA,splitted:["AC-GT-CTAC-GT-CT","CAC-T-GTCAC-T-GT","ACCGTACTACCGTACT"]}},[te.separator]:{src:{csv:"seq\nabc-dfgg-abc1-cfr3-rty-wert-abc-dfgg-abc1-cfr3-rty-wert\nrut12-her2-rty-wert-abc-abc1-dfgg-rut12-her2-rty-wert-abc\nrut12-rty-her2-abc-cfr3-wert-rut12-rut12-rty-her2-abc-cfr3"},tgt:{notation:c.r2.SEPARATOR,separator:"-",splitted:[["abc","dfgg","abc1","cfr3","rty","wert","abc","dfgg","abc1","cfr3","rty","wert"],["rut12","her2","rty","wert","abc","abc1","dfgg","rut12","her2","rty","wert","abc"],["rut12","rty","her2","abc","cfr3","wert","rut12","rut12","rty","her2","abc","cfr3"]]}},[te.separatorMsa]:{src:{csv:'seq\nrut0-dfgg-abc1-cfr3-rty-wert-abc-dfgg-abc1-cfr3-rty-wert\nrut1-her2-rty--abc1-dfgg-rut12-her2-rty--abc1-dfgg\nrut2-rty-her2---wert-rut12-rty-her2---wert\n"rut3-rty-her2-""-""-""-""-wert-rut12-rty-her2-""-""-""-""-wert"\n"""-""-rut4-her2-wert-rut12-rty-her2-wert"\n"rut5-rty-her2-wert-rut12-rty-her2-wert-""-"""'},tgt:{notation:c.r2.SEPARATOR,separator:"-",splitted:[["rut0","dfgg","abc1","cfr3","rty","wert","abc","dfgg","abc1","cfr3","rty","wert"],["rut1","her2","rty",s,"abc1","dfgg","rut12","her2","rty",s,"abc1","dfgg"],["rut2","rty","her2",s,s,"wert","rut12","rty","her2",s,s,"wert"],["rut3","rty","her2",s,s,"wert","rut12","rty","her2",s,s,"wert"],[s,"rut4","her2","wert","rut12","rty","her2","wert"],["rut5","rty","her2","wert","rut12","rty","her2","wert",s]]}},[te.helm]:{src:{csv:"seq\nPEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.Thr_PO3H2.Aca.D-Tyr_Et}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.dK.Thr_PO3H2.Aca}$$$$\nPEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.dK.Thr_PO3H2.Aca}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.T.dK.Thr_PO3H2}$$$$"},tgt:{notation:c.r2.HELM,splitted:[["meI","hHis","Aca","N","T","dE","Thr_PO3H2","Aca","D-Tyr_Et","Thr_PO3H2","Aca","D-Tyr_Et"],["meI","hHis","Aca","Cys_SEt","T","dK","Thr_PO3H2","Aca","dK","Thr_PO3H2","Aca"],["Lys_Boc","hHis","Aca","Cys_SEt","T","dK","Thr_PO3H2","Aca","dK","Thr_PO3H2","Aca"],["meI","hHis","Aca","Cys_SEt","T","dK","Thr_PO3H2","T","dK","Thr_PO3H2"]]}}};for(const[s,r]of Object.entries(n))(0,t.Bu)(`splitted-${s}`,(async()=>{const s=e.DataFrame.fromCsv(r.src.csv).getCol("seq"),n=await a.functions.call("Bio:detectMacromolecule",{col:s});n&&(s.semType=n),(0,t.l_)(s.semType,e.SEMTYPE.MACROMOLECULE);const i=h.Cn.getOrCreate(s);(0,t.l_)(i.notation,r.tgt.notation),(0,t.l_)(i.separator===r.tgt.separator,!0);const o=i.splitted;(0,t.f6)(o,r.tgt.splitted)}),s==te.separatorMsa?{skipReason:"#2468 CSV row starting with the quote character"}:void 0)})),(0,t.W3)("UnitsHandler: getRegion",(()=>{const s={fastaDna:{srcCsv:"seq\nATTCGT\nACTGCTC\nATTCCGTA",startIdx:2,endIdx:4,tgtCsv:"seq\nTCG\nTGC\nTCC",units:c.r2.FASTA,alphabet:"DNA",positionNames:{tag:"a, b, c, d, e, f, g, h",start:"c",end:"e"}},separatorPt:{srcCsv:"seq\nM-D-Y-K-E-T-L\nM-I-E-V-F-L-F-G-I\nM-M-",startIdx:5,endIdx:null,tgtCsv:"seq\nT-L--\nL-F-G-I\n---",units:c.r2.SEPARATOR,alphabet:"PT",positionNames:{tag:"1, 1A, 1B, 2, 3, 4, 4A, 4A, 4C",start:"4",end:null}},helm:{srcCsv:"seq\nPEPTIDE1{[meI].[hHis].[Aca].N.T.[dE].[Thr_PO3H2].[Aca].[D-Tyr_Et].[Tyr_ab-dehydroMe].[dV].E.N.[D-Orn]}$$$$\nPEPTIDE1{[meI].[hHis].[Aca].[Cys_SEt].T.[dK].[Thr_PO3H2].[Aca].[Tyr_PO3H2].[D-Chg].[dV].[Phe_ab-dehydro]}$$$$\nPEPTIDE1{[Lys_Boc].[hHis].[Aca].[Cys_SEt].T}$$$$",startIdx:3,endIdx:6,tgtCsv:"seq\nPEPTIDE1{N.T.[dE].[Thr_PO3H2]}$$$$\nPEPTIDE1{[Cys_SEt].T.[dK].[Thr_PO3H2]}$$$$\nPEPTIDE1{[Cys_SEt].T.*.*}$$$$",units:c.r2.HELM,alphabet:null,positionNames:{tag:null,start:"4",end:"7"}}};for(const[n,r]of Object.entries(s))(0,t.Bu)(`${n}-idx`,(async()=>{const s=e.DataFrame.fromCsv(r.srcCsv).getCol("seq"),n=await a.functions.call("Bio:detectMacromolecule",{col:s});n&&(s.semType=n);const i=h.Cn.getOrCreate(s).getRegion(r.startIdx,r.endIdx,"regSeq"),o=e.DataFrame.fromCsv(r.tgtCsv).getCol("seq");(0,t.l_)(s.getTag(e.TAGS.UNITS),r.units),(0,t.l_)(i.getTag(e.TAGS.UNITS),r.units),(0,t.l_)(s.getTag("alphabet"),r.alphabet),(0,t.l_)(i.getTag("alphabet"),r.alphabet),(0,t.f6)(i.toList(),o.toList())})),r.positionNames&&(0,t.Bu)(`${n}-positionNames`,(async()=>{const s=e.DataFrame.fromCsv(r.srcCsv).getCol("seq");r.positionNames.tag&&s.setTag(".positionNames",r.positionNames.tag);const n=await a.functions.call("Bio:detectMacromolecule",{col:s});n&&(s.semType=n);const i=await a.functions.call("Bio:getRegion",{sequence:s,start:r.positionNames.start,end:r.positionNames.end}),o=e.DataFrame.fromCsv(r.tgtCsv).getCol("seq");(0,t.l_)(s.getTag(e.TAGS.UNITS),r.units),(0,t.l_)(i.getTag(e.TAGS.UNITS),r.units),(0,t.l_)(s.getTag("alphabet"),r.alphabet),(0,t.l_)(i.getTag("alphabet"),r.alphabet),(0,t.f6)(i.toList(),o.toList())}))}));var se=s(8601);const ne=new e.FileSource("System:AppData/Bio"),re={"peptides-fasta":{inPath:"tests/to-atomic-level-peptides-fasta-input.csv",outPath:"tests/to-atomic-level-peptides-fasta-output.csv"},"dna-fasta":{inPath:"tests/to-atomic-level-dna-fasta-input.csv",outPath:"tests/to-atomic-level-dna-fasta-output.csv"},"msa-separator":{inPath:"tests/to-atomic-level-msa-separator-input.csv",outPath:"tests/to-atomic-level-msa-separator-output.csv"},"msa-fasta":{inPath:"tests/to-atomic-level-msa-fasta-input.csv",outPath:"tests/to-atomic-level-msa-fasta-output.csv"}},ie="molfile(sequence)";async function oe(e,t="seq",s){const n=e.getCol(t),r=s.getBioLib(),i=await(0,se.i0)(e,n,r);return i.warnings.length>0&&ge.logger.warning(`_toAtomicLevel() warnings ${i.warnings.join("\n")}`),i.col}function ae(e){return e.replaceAll("\r\n","\n").replace(/\n$/,"").split("\n").map((e=>e.trimEnd())).join("\n")}(0,t.W3)("toAtomicLevel",(async()=>{const s={},n={};let r,i,o;async function u(e,s){const n=e.getCol("sequence");await(0,l.toAtomicLevel)(e,n,!1);const r=e.getCol(ie),i=s.getCol(ie),o=F()(r.values()).map((e=>ae(e))).toArray(),a=F()(i.values()).map((e=>ae(e))).toArray();(0,t.f6)(o,a)}(0,t.bb)((async()=>{r=await(0,$.JN)(),i=await(0,x.nW)(),await(0,x.tb)(),await r.loadLibraries(!0);for(const[t,r]of Object.entries(re))r.inPath,s[t]=e.DataFrame.fromCsv((await ne.readAsText(r.inPath)).replace(/\n$/,"")),await a.data.detectSemanticTypes(s[t]),n[t]=e.DataFrame.fromCsv((await ne.readAsText(r.outPath)).replace(/\n$/,""))})),(0,t.X5)((async()=>{await(0,x.tW)(i),await r.loadLibraries(!0)}));for(const[e,r]of Object.entries(re))(0,t.Bu)(`${e}`,(async()=>{await u(s[e],n[e])}));!function(e){e.fastaDna="fastaDna",e.fastaRna="fastaRna",e.fastaPt="fastaPt",e.separatorDna="separatorDna",e.separatorRna="separatorRna",e.separatorPt="separatorPt",e.separatorUn="separatorUn",e.helm="helm"}(o||(o={}));const d={[o.fastaDna]:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",[o.fastaRna]:"seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",[o.fastaPt]:"seq\nFWPHEYFWPHEY\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",[o.separatorDna]:"seq\nA/C/G/T/C/A/C/G/T/C\nC/A/G/T/G/T/C/A/G/T/G/T\nT/T/C/A/A/C/T/T/C/A/A/C",[o.separatorRna]:"seq\nA*C*G*U*C*A*C*G*U*C\nC*A*G*U*G*U*C*A*G*U*G*U\nU*U*C*A*A*C*U*U*C*A*A*C",[o.separatorPt]:"seq\nF-W-P-H-E-Y-F-W-P-H-E-Y\nY-N-R-Q-W-Y-V-Y-N-R-Q-W-Y-V\nM-K-P-S-E-Y-V-M-K-P-S-E-Y-V",[o.separatorUn]:"seq\nmeI-hHis-Aca-N-T-dE-Thr_PO3H2-Aca-D-meI-hHis-Aca-N-T-dE-Thr_PO3H2-Aca-D\nmeI-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2-meI-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2\nLys_Boc-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2-Lys_Boc-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2",[o.helm]:"seq\nPEPTIDE1{meI.D-gGlu.Aca.N.T.dE.Thr_PO3H2.Aca.D.Thr_PO3H2.Aca.D}$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.Thr_PO3H2.Aca.Tyr_PO3H2}$$$\nPEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.Thr_PO3H2.Aca.Tyr_PO3H2}$$$"};async function m(t){const s=d[t],n=e.DataFrame.fromCsv(s.replace(/\n$/,""));return await a.data.detectSemanticTypes(n),n}(0,t.Bu)("fastaDna",(async()=>{await oe(await m(o.fastaDna),"seq",r)})),(0,t.Bu)("fastaRna",(async()=>{await oe(await m(o.fastaRna),"seq",r)})),(0,t.Bu)("fastaPt",(async()=>{await oe(await m(o.fastaPt),"seq",r)})),(0,t.Bu)("separatorDna",(async()=>{await oe(await m(o.separatorDna),"seq",r)})),(0,t.Bu)("separatorDna",(async()=>{await oe(await m(o.separatorRna),"seq",r)})),(0,t.Bu)("separatorPt",(async()=>{await oe(await m(o.separatorPt),"seq",r)})),(0,t.Bu)("separatorUn",(async()=>{await oe(await m(o.separatorUn),"seq",r)})),(0,t.Bu)("helm",(async()=>{await oe(await m(o.helm),"seq",r)})),(0,t.Bu)("ptFasta2",(async()=>{const s=await ge.files.readAsText("tests/to-atomic-level-pt-fasta-2.mol"),n=e.DataFrame.fromCsv("seq\nAR"),i=n.getCol("seq");i.semType=e.SEMTYPE.MACROMOLECULE,i.setTag(e.TAGS.UNITS,c.r2.FASTA),i.setTag("alphabet","PT"),h.Cn.getOrCreate(i);const o=await oe(n,"seq",r);(0,t.l_)(ae(o.get(0)),ae(s))}))}));var le=s(708);async function ce(t){const s=e.DataFrame.fromCsv(t),n=s.col("seq"),r=await a.functions.call("Bio:detectMacromolecule",{col:n});return r&&(n.semType=r),await a.data.detectSemanticTypes(s),h.Cn.getOrCreate(n)}function he(e,s,n,r){const i=n(e,s);(0,t.l_)(Number(i.toFixed(3)),Number(r.toFixed(3)))}(0,t.W3)("Distance",(async()=>{const s=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],n={F:0,W:1,R:2,Y:3},r="FWRWY",i="FWRWW",o="FWY",a="FWRWY",l="FWY",c="FWRRRRY";(0,t.Bu)("protein-distance-function",(async()=>{const e=(await ce("seq\nFWRWYVKHPFWRWYVKHP\nYNRWYVKHPYNRWYVKHP\nMWRSWYCKHPMWRSWYCKHP")).getDistanceFunctionName();(0,t.l_)(e,le.U.LEVENSHTEIN)})),(0,t.Bu)("DNA-distance-function",(async()=>{const e=(await ce("seq\nATAACGATAACG\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,t.l_)(e,le.U.LEVENSHTEIN)})),(0,t.Bu)("MSA-distance-function",(async()=>{const e=(await ce("seq\nATAACATAAC\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,t.l_)(e,le.U.HAMMING)})),(0,t.Bu)("levenstein-sub",(async()=>{const e=le.o[le.U.LEVENSHTEIN]();he(r,i,e,.2)})),(0,t.Bu)("levenstein-del",(async()=>{const e=le.o[le.U.LEVENSHTEIN]();he(o,a,e,.4)})),(0,t.Bu)("hamming",(async()=>{const e=le.o[le.U.HAMMING]();he(o,a,e,.6)})),(0,t.Bu)("needleman-blosum62",(async()=>{const e=le.o[le.U.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});he(r,i,e,-6)})),(0,t.Bu)("needleman-blosum62-del",(async()=>{const e=le.o[le.U.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});he(o,a,e,-1.8)})),(0,t.Bu)("needleman-custom-sub",(async()=>{const e=le.o[le.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:1,gapExtend:1});he(r,i,e,.2)})),(0,t.Bu)("needleman-custom-del",(async()=>{const e=le.o[le.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:1,gapExtend:1});he(o,a,e,.8)})),(0,t.Bu)("needleman-custom-zero-extend",(async()=>{const e=le.o[le.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:1,gapExtend:0});he(l,c,e,.714)})),(0,t.Bu)("needleman-custom-half-extend",(async()=>{const e=le.o[le.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:2,gapExtend:1});he(l,c,e,1.286)})),(0,t.Bu)("needleman-custom-same-extend",(async()=>{const t=le.o[le.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:1,gapExtend:1});e.Test.isInBenchmark?he(Array(1e4).fill("FWRY").join(""),Array(1e4).fill("FYWRRY").join(""),t,.667):he(l,c,t,1.143)}))}));var ue=s(3277);async function de(e,s,n,r,i,o,c,h){await a.data.detectSemanticTypes(e);const u=await(0,l.activityCliffs)(e,e.getCol(n),e.getCol(r),i,s,c,h,{[`${ue.sS}`]:!0});(0,t.l_)(null!=u,!0);const d=Array.from(u.root.children).find((e=>{const t=e.className.split(" ");return["ui-btn","ui-btn-ok"].every((e=>t.includes(e)))}));(0,t.l_)(d.innerText.toLowerCase(),`${o} cliffs`)}var me=s(6361),pe=s(4628);async function fe(s,n,r){const i=s.getCol(r),o=await a.functions.call("Bio:detectMacromolecule",{col:i});o&&(i.semType=o);const c=e.Func.find({package:"Bio",name:"macromoleculePreprocessingFunction"})[0];if(!c)throw new Error("Preprocessing function not found");const h=await(0,l.sequenceSpaceTopMenu)(s,s.col(r),n,le.U.LEVENSHTEIN,!0,c,{[ue.sS]:!0});(0,t.l_)(null!=h,!0)}(0,t.W3)("activityCliffs",(async()=>{let s,n,r=[],i=[];const o=e.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0],l=e.Func.find({name:"helmPreprocessingFunction",package:"Bio"})[0];(0,t.bb)((async()=>{s=await(0,$.JN)(),n=await(0,x.nW)(),await(0,x.tb)(),await s.loadLibraries(!0),r=[],i=[]})),(0,t.X5)((async()=>{await(0,x.tW)(n),await s.loadLibraries(!0)})),(0,t.Bu)("activityCliffsOpens",(async()=>{const t=await b(e.Test.isInBenchmark?"test/peptides_motif-with-random_10000.csv":"tests/100_3_clustests.csv");i.push(t);const s=a.shell.addTableView(t);r.push(s);const n=e.Test.isInBenchmark?6:3;await de(t,pe.A.UMAP,"sequence","Activity",90,n,le.U.LEVENSHTEIN,o)})),(0,t.Bu)("activityCliffsWithEmptyRows",(async()=>{const e=await b("tests/100_3_clustests_empty_vals.csv");i.push(e);const t=a.shell.addTableView(e);r.push(t),await de(e,pe.A.UMAP,"sequence","Activity",90,3,le.U.LEVENSHTEIN,o)})),(0,t.Bu)("Helm",(async()=>{const e=await ge.files.readCsv("data/sample_HELM_50.csv");a.shell.addTableView(e),await de(e,pe.A.UMAP,"HELM","Activity",65,20,me.gk.Tanimoto,l)}))})),(0,t.W3)("sequenceSpace",(async()=>{let s,n,r,i;(0,t.Bu)("sequenceSpaceOpens",(async()=>{s=await b(e.Test.isInBenchmark?"test/peptides_motif-with-random_10000.csv":"tests/100_3_clustests.csv"),n=a.shell.addTableView(s),await fe(s,pe.A.UMAP,"sequence")})),(0,t.Bu)("sequenceSpaceWithEmptyRows",(async()=>{r=await b("tests/100_3_clustests_empty_vals.csv"),i=a.shell.addTableView(r),await fe(r,pe.A.UMAP,"sequence")}))})),(0,t.W3)("Scoring",(()=>{const s="sequence",n="expected_similarity",r="expected_identity",i=e.DataFrame.fromCsv(`${s},${n},${r}\nPEPTIDE1{Aca.Orn.gGlu.Pqa.D-His_1Bn.dH.hHis.4Abz.D-Tic.D-Dap.Y.Iva.meS.F.P.F.D-1Nal}$$$$,1.0,1.0\nPEPTIDE1{Iva.Gly_allyl.gGlu.Pqa.D-Dip.dH.hHis.4Abz.D-aHyp.D-Dap.Y.Iva.I.Tyr_26diMe.P.Asu.meC}$$$$,0.68,0.53\nPEPTIDE1{[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal]}$$$$V2.0,0.34,0.0`),o=i.getCol(s);o.setTag(e.TAGS.UNITS,c.r2.HELM),o.semType=e.SEMTYPE.MACROMOLECULE;const a=o.get(0);let h,u;(0,t.bb)((async()=>{h=await(0,$.JN)(),u=await(0,x.nW)(),await(0,x.tb)(),await h.loadLibraries(!0)})),(0,t.X5)((async()=>{await(0,x.tW)(u),await h.loadLibraries(!0)})),(0,t.Bu)("Identity",(async()=>{const e=await(0,l.sequenceIdentityScoring)(i,o,a);for(let s=0;s<e.length;s++)(0,t.jh)(e.get(s),i.get(r,s),.01,`Wrong identity score for sequence at position ${s}`)})),(0,t.Bu)("Similarity",(async()=>{const e=await(0,l.sequenceSimilarityScoring)(i,o,a);for(let s=0;s<e.length;s++)(0,t.jh)(e.get(s),i.get(n,s),.01,`Wrong similarity score for sequence at position ${s}`)}))}));const ge=new e.Package;async function ye(s,n,r){const i=await(0,t.ci)({category:s,test:n,testContext:r});return e.DataFrame.fromObjects(i)}})(),bio_test=n})();
|
|
8
|
+
deps: ${s}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,s]=function({schema:e}){const t={},s={};for(const n in e)"__proto__"!==n&&((Array.isArray(e[n])?t:s)[n]=e[n]);return[t,s]}(e);a(e,t),l(e,s)}};function a(e,t=e.schema){const{gen:s,data:r,it:o}=e;if(0===Object.keys(t).length)return;const a=s.let("missing");for(const l in t){const c=t[l];if(0===c.length)continue;const h=(0,i.propertyInData)(s,r,l,o.opts.ownProperties);e.setParams({property:l,depsCount:c.length,deps:c.join(", ")}),o.allErrors?s.if(h,(()=>{for(const t of c)(0,i.checkReportMissingProp)(e,t)})):(s.if(n._`${h} && (${(0,i.checkMissingProp)(e,c,a)})`),(0,i.reportMissingProp)(e,a),s.else())}}function l(e,t=e.schema){const{gen:s,data:n,keyword:o,it:a}=e,l=s.name("valid");for(const c in t)(0,r.alwaysValidSchema)(a,t[c])||(s.if((0,i.propertyInData)(s,n,c,a.opts.ownProperties),(()=>{const t=e.subschema({keyword:o,schemaProp:c},l);e.mergeValidEvaluated(t,l)}),(()=>s.var(l,!0))),e.ok(l))}t.validatePropertyDeps=a,t.validateSchemaDeps=l,t.default=o},7274:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(7772),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,n.validateSchemaDeps)(e)};t.default=r},9434:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>n.str`must match "${e.ifClause}" schema`,params:({params:e})=>n._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:s,it:i}=e;void 0===s.then&&void 0===s.else&&(0,r.checkStrictMode)(i,'"if" without "then" and "else" is ignored');const a=o(i,"then"),l=o(i,"else");if(!a&&!l)return;const c=t.let("valid",!0),h=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},h);e.mergeEvaluated(t)}(),e.reset(),a&&l){const s=t.let("ifClause");e.setParams({ifClause:s}),t.if(h,u("then",s),u("else",s))}else a?t.if(h,u("then")):t.if((0,n.not)(h),u("else"));function u(s,r){return()=>{const i=e.subschema({keyword:s},h);t.assign(c,h),e.mergeValidEvaluated(i,c),r?t.assign(r,n._`${s}`):e.setParams({ifClause:s})}}e.pass(c,(()=>e.error(!0)))}};function o(e,t){const s=e.schema[t];return void 0!==s&&!(0,r.alwaysValidSchema)(e,s)}t.default=i},8200:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(4783),r=s(2924),i=s(4665),o=s(1119),a=s(9864),l=s(7772),c=s(3708),h=s(9351),u=s(6239),d=s(2296),m=s(2182),p=s(19),f=s(4200),g=s(1125),y=s(9434),b=s(6552);t.default=function(e=!1){const t=[m.default,p.default,f.default,g.default,y.default,b.default,c.default,h.default,l.default,u.default,d.default];return e?t.push(r.default,o.default):t.push(n.default,i.default),t.push(a.default),t}},4665:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;const n=s(3487),r=s(6776),i=s(412),o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:s}=e;if(Array.isArray(t))return a(e,"additionalItems",t);s.items=!0,(0,r.alwaysValidSchema)(s,t)||e.ok((0,i.validateArray)(e))}};function a(e,t,s=e.schema){const{gen:i,parentSchema:o,data:a,keyword:l,it:c}=e;!function(e){const{opts:n,errSchemaPath:i}=c,o=s.length,a=o===e.minItems&&(o===e.maxItems||!1===e[t]);if(n.strictTuples&&!a){const e=`"${l}" is ${o}-tuple, but minItems or maxItems/${t} are not specified or different at path "${i}"`;(0,r.checkStrictMode)(c,e,n.strictTuples)}}(o),c.opts.unevaluated&&s.length&&!0!==c.items&&(c.items=r.mergeEvaluated.items(i,s.length,c.items));const h=i.name("valid"),u=i.const("len",n._`${a}.length`);s.forEach(((t,s)=>{(0,r.alwaysValidSchema)(c,t)||(i.if(n._`${u} > ${s}`,(()=>e.subschema({keyword:l,schemaProp:s,dataProp:s},h))),e.ok(h))}))}t.validateTuple=a,t.default=o},1119:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i=s(412),o=s(4783),a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>n.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>n._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:s,it:n}=e,{prefixItems:a}=s;n.items=!0,(0,r.alwaysValidSchema)(n,t)||(a?(0,o.validateAdditionalItems)(e,a):e.ok((0,i.validateArray)(e)))}};t.default=a},2182:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(6776),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:s,it:r}=e;if((0,n.alwaysValidSchema)(r,s))return void e.fail();const i=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),e.failResult(i,(()=>e.reset()),(()=>e.error()))},error:{message:"must NOT be valid"}};t.default=r},4200:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>n._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:s,parentSchema:i,it:o}=e;if(!Array.isArray(s))throw new Error("ajv implementation error");if(o.opts.discriminator&&i.discriminator)return;const a=s,l=t.let("valid",!1),c=t.let("passing",null),h=t.name("_valid");e.setParams({passing:c}),t.block((function(){a.forEach(((s,i)=>{let a;(0,r.alwaysValidSchema)(o,s)?t.var(h,!0):a=e.subschema({keyword:"oneOf",schemaProp:i,compositeRule:!0},h),i>0&&t.if(n._`${h} && ${l}`).assign(l,!1).assign(c,n._`[${c}, ${i}]`).else(),t.if(h,(()=>{t.assign(l,!0),t.assign(c,i),a&&e.mergeEvaluated(a,n.Name)}))}))})),e.result(l,(()=>e.reset()),(()=>e.error(!0)))}};t.default=i},2296:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(412),r=s(3487),i=s(6776),o=s(6776),a={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:s,data:a,parentSchema:l,it:c}=e,{opts:h}=c,u=(0,n.allSchemaProperties)(s),d=u.filter((e=>(0,i.alwaysValidSchema)(c,s[e])));if(0===u.length||d.length===u.length&&(!c.opts.unevaluated||!0===c.props))return;const m=h.strictSchema&&!h.allowMatchingProperties&&l.properties,p=t.name("valid");!0===c.props||c.props instanceof r.Name||(c.props=(0,o.evaluatedPropsToName)(t,c.props));const{props:f}=c;function g(e){for(const t in m)new RegExp(e).test(t)&&(0,i.checkStrictMode)(c,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function y(s){t.forIn("key",a,(i=>{t.if(r._`${(0,n.usePattern)(e,s)}.test(${i})`,(()=>{const n=d.includes(s);n||e.subschema({keyword:"patternProperties",schemaProp:s,dataProp:i,dataPropType:o.Type.Str},p),c.opts.unevaluated&&!0!==f?t.assign(r._`${f}[${i}]`,!0):n||c.allErrors||t.if((0,r.not)(p),(()=>t.break()))}))}))}!function(){for(const e of u)m&&g(e),c.allErrors?y(e):(t.var(p,!0),y(e),t.if(p))}()}};t.default=a},2924:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(4665),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,n.validateTuple)(e,"items")};t.default=r},6239:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(4815),r=s(412),i=s(6776),o=s(9351),a={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:s,parentSchema:a,data:l,it:c}=e;"all"===c.opts.removeAdditional&&void 0===a.additionalProperties&&o.default.code(new n.KeywordCxt(c,o.default,"additionalProperties"));const h=(0,r.allSchemaProperties)(s);for(const e of h)c.definedProperties.add(e);c.opts.unevaluated&&h.length&&!0!==c.props&&(c.props=i.mergeEvaluated.props(t,(0,i.toHash)(h),c.props));const u=h.filter((e=>!(0,i.alwaysValidSchema)(c,s[e])));if(0===u.length)return;const d=t.name("valid");for(const s of u)m(s)?p(s):(t.if((0,r.propertyInData)(t,l,s,c.opts.ownProperties)),p(s),c.allErrors||t.else().var(d,!0),t.endIf()),e.it.definedProperties.add(s),e.ok(d);function m(e){return c.opts.useDefaults&&!c.compositeRule&&void 0!==s[e].default}function p(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},d)}}};t.default=a},3708:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>n._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:s,data:i,it:o}=e;if((0,r.alwaysValidSchema)(o,s))return;const a=t.name("valid");t.forIn("key",i,(s=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},a),t.if((0,n.not)(a),(()=>{e.error(!0),o.allErrors||t.break()}))})),e.ok(a)}};t.default=i},6552:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(6776),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:s}){void 0===t.if&&(0,n.checkStrictMode)(s,`"${e}" without "if" is ignored`)}};t.default=r},412:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;const n=s(3487),r=s(6776),i=s(2141),o=s(6776);function a(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:n._`Object.prototype.hasOwnProperty`})}function l(e,t,s){return n._`${a(e)}.call(${t}, ${s})`}function c(e,t,s,r){const i=n._`${t}${(0,n.getProperty)(s)} === undefined`;return r?(0,n.or)(i,(0,n.not)(l(e,t,s))):i}function h(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}t.checkReportMissingProp=function(e,t){const{gen:s,data:r,it:i}=e;s.if(c(s,r,t,i.opts.ownProperties),(()=>{e.setParams({missingProperty:n._`${t}`},!0),e.error()}))},t.checkMissingProp=function({gen:e,data:t,it:{opts:s}},r,i){return(0,n.or)(...r.map((r=>(0,n.and)(c(e,t,r,s.ownProperties),n._`${i} = ${r}`))))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=a,t.isOwnProperty=l,t.propertyInData=function(e,t,s,r){const i=n._`${t}${(0,n.getProperty)(s)} !== undefined`;return r?n._`${i} && ${l(e,t,s)}`:i},t.noPropertyInData=c,t.allSchemaProperties=h,t.schemaProperties=function(e,t){return h(t).filter((s=>!(0,r.alwaysValidSchema)(e,t[s])))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:s,topSchemaRef:r,schemaPath:o,errorPath:a},it:l},c,h,u){const d=u?n._`${e}, ${t}, ${r}${o}`:t,m=[[i.default.instancePath,(0,n.strConcat)(i.default.instancePath,a)],[i.default.parentData,l.parentData],[i.default.parentDataProperty,l.parentDataProperty],[i.default.rootData,i.default.rootData]];l.opts.dynamicRef&&m.push([i.default.dynamicAnchors,i.default.dynamicAnchors]);const p=n._`${d}, ${s.object(...m)}`;return h!==n.nil?n._`${c}.call(${h}, ${p})`:n._`${c}(${p})`};const u=n._`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},s){const r=t.unicodeRegExp?"u":"",{regExp:i}=t.code,a=i(s,r);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:n._`${"new RegExp"===i.code?u:(0,o.useFunc)(e,i)}(${s}, ${r})`})},t.validateArray=function(e){const{gen:t,data:s,keyword:i,it:o}=e,a=t.name("valid");if(o.allErrors){const e=t.let("valid",!0);return l((()=>t.assign(e,!1))),e}return t.var(a,!0),l((()=>t.break())),a;function l(o){const l=t.const("len",n._`${s}.length`);t.forRange("i",0,l,(s=>{e.subschema({keyword:i,dataProp:s,dataPropType:r.Type.Num},a),t.if((0,n.not)(a),o)}))}},t.validateUnion=function(e){const{gen:t,schema:s,keyword:i,it:o}=e;if(!Array.isArray(s))throw new Error("ajv implementation error");if(s.some((e=>(0,r.alwaysValidSchema)(o,e)))&&!o.opts.unevaluated)return;const a=t.let("valid",!1),l=t.name("_valid");t.block((()=>s.forEach(((s,r)=>{const o=e.subschema({keyword:i,schemaProp:r,compositeRule:!0},l);t.assign(a,n._`${a} || ${l}`),e.mergeValidEvaluated(o,l)||t.if((0,n.not)(a))})))),e.result(a,(()=>e.reset()),(()=>e.error(!0)))}},8386:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t.default=s},5684:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(8386),r=s(8280),i=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",n.default,r.default];t.default=i},8280:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;const n=s(6646),r=s(412),i=s(3487),o=s(2141),a=s(5173),l=s(6776),c={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:s,it:r}=e,{baseId:o,schemaEnv:l,validateName:c,opts:d,self:m}=r,{root:p}=l;if(("#"===s||"#/"===s)&&o===p.baseId)return function(){if(l===p)return u(e,c,l,l.$async);const s=t.scopeValue("root",{ref:p});return u(e,i._`${s}.validate`,p,p.$async)}();const f=a.resolveRef.call(m,p,o,s);if(void 0===f)throw new n.default(r.opts.uriResolver,o,s);return f instanceof a.SchemaEnv?function(t){const s=h(e,t);u(e,s,t,t.$async)}(f):function(n){const r=t.scopeValue("schema",!0===d.code.source?{ref:n,code:(0,i.stringify)(n)}:{ref:n}),o=t.name("valid"),a=e.subschema({schema:n,dataTypes:[],schemaPath:i.nil,topSchemaRef:r,errSchemaPath:s},o);e.mergeEvaluated(a),e.ok(o)}(f)}};function h(e,t){const{gen:s}=e;return t.validate?s.scopeValue("validate",{ref:t.validate}):i._`${s.scopeValue("wrapper",{ref:t})}.validate`}function u(e,t,s,n){const{gen:a,it:c}=e,{allErrors:h,schemaEnv:u,opts:d}=c,m=d.passContext?o.default.this:i.nil;function p(e){const t=i._`${e}.errors`;a.assign(o.default.vErrors,i._`${o.default.vErrors} === null ? ${t} : ${o.default.vErrors}.concat(${t})`),a.assign(o.default.errors,i._`${o.default.vErrors}.length`)}function f(e){var t;if(!c.opts.unevaluated)return;const n=null===(t=null==s?void 0:s.validate)||void 0===t?void 0:t.evaluated;if(!0!==c.props)if(n&&!n.dynamicProps)void 0!==n.props&&(c.props=l.mergeEvaluated.props(a,n.props,c.props));else{const t=a.var("props",i._`${e}.evaluated.props`);c.props=l.mergeEvaluated.props(a,t,c.props,i.Name)}if(!0!==c.items)if(n&&!n.dynamicItems)void 0!==n.items&&(c.items=l.mergeEvaluated.items(a,n.items,c.items));else{const t=a.var("items",i._`${e}.evaluated.items`);c.items=l.mergeEvaluated.items(a,t,c.items,i.Name)}}n?function(){if(!u.$async)throw new Error("async schema referenced by sync schema");const s=a.let("valid");a.try((()=>{a.code(i._`await ${(0,r.callValidateCode)(e,t,m)}`),f(t),h||a.assign(s,!0)}),(e=>{a.if(i._`!(${e} instanceof ${c.ValidationError})`,(()=>a.throw(e))),p(e),h||a.assign(s,!1)})),e.ok(s)}():e.result((0,r.callValidateCode)(e,t,m),(()=>f(t)),(()=>p(t)))}t.getValidate=h,t.callRef=u,t.default=c},1240:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(9306),i=s(5173),o=s(6776),a={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===r.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:s}})=>n._`{error: ${e}, tag: ${s}, tagValue: ${t}}`},code(e){const{gen:t,data:s,schema:a,parentSchema:l,it:c}=e,{oneOf:h}=l;if(!c.opts.discriminator)throw new Error("discriminator: requires discriminator option");const u=a.propertyName;if("string"!=typeof u)throw new Error("discriminator: requires propertyName");if(a.mapping)throw new Error("discriminator: mapping is not supported");if(!h)throw new Error("discriminator: requires oneOf keyword");const d=t.let("valid",!1),m=t.const("tag",n._`${s}${(0,n.getProperty)(u)}`);function p(s){const r=t.name("valid"),i=e.subschema({keyword:"oneOf",schemaProp:s},r);return e.mergeEvaluated(i,n.Name),r}t.if(n._`typeof ${m} == "string"`,(()=>function(){const s=function(){var e;const t={},s=r(l);let n=!0;for(let t=0;t<h.length;t++){let l=h[t];(null==l?void 0:l.$ref)&&!(0,o.schemaHasRulesButRef)(l,c.self.RULES)&&(l=i.resolveRef.call(c.self,c.schemaEnv.root,c.baseId,null==l?void 0:l.$ref),l instanceof i.SchemaEnv&&(l=l.schema));const d=null===(e=null==l?void 0:l.properties)||void 0===e?void 0:e[u];if("object"!=typeof d)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${u}"`);n=n&&(s||r(l)),a(d,t)}if(!n)throw new Error(`discriminator: "${u}" must be required`);return t;function r({required:e}){return Array.isArray(e)&&e.includes(u)}function a(e,t){if(e.const)d(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${u}" must have "const" or "enum"`);for(const s of e.enum)d(s,t)}}function d(e,s){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${u}" values must be unique strings`);t[e]=s}}();t.if(!1);for(const e in s)t.elseIf(n._`${m} === ${e}`),t.assign(d,p(s[e]));t.else(),e.error(!1,{discrError:r.DiscrError.Mapping,tag:m,tagName:u}),t.endIf()}()),(()=>e.error(!1,{discrError:r.DiscrError.Tag,tag:m,tagName:u}))),e.ok(d)}};t.default=a},9306:(e,t)=>{"use strict";var s;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(s=t.DiscrError||(t.DiscrError={})).Tag="tag",s.Mapping="mapping"},7299:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(5684),r=s(2649),i=s(8200),o=s(6121),a=s(1448),l=s(808),c=s(9502),h=s(6167),u=[o.default,n.default,r.default,(0,i.default)(!0),c.default,h.metadataVocabulary,h.contentVocabulary,a.default,l.default];t.default=u},3924:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(5684),r=s(2649),i=s(8200),o=s(9502),a=s(6167),l=[n.default,r.default,(0,i.default)(),o.default,a.metadataVocabulary,a.contentVocabulary];t.default=l},6215:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;const n=s(3487),r=s(2141),i=s(5173),o=s(8280),a={keyword:"$dynamicAnchor",schemaType:"string",code:e=>l(e,e.schema)};function l(e,t){const{gen:s,it:a}=e;a.schemaEnv.root.dynamicAnchors[t]=!0;const l=n._`${r.default.dynamicAnchors}${(0,n.getProperty)(t)}`,c="#"===a.errSchemaPath?a.validateName:function(e){const{schemaEnv:t,schema:s,self:n}=e.it,{root:r,baseId:a,localRefs:l,meta:c}=t.root,{schemaId:h}=n.opts,u=new i.SchemaEnv({schema:s,schemaId:h,root:r,baseId:a,localRefs:l,meta:c});return i.compileSchema.call(n,u),(0,o.getValidate)(e,u)}(e);s.if(n._`!${l}`,(()=>s.assign(l,c)))}t.dynamicAnchor=l,t.default=a},1919:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;const n=s(3487),r=s(2141),i=s(8280),o={keyword:"$dynamicRef",schemaType:"string",code:e=>a(e,e.schema)};function a(e,t){const{gen:s,keyword:o,it:a}=e;if("#"!==t[0])throw new Error(`"${o}" only supports hash fragment reference`);const l=t.slice(1);if(a.allErrors)c();else{const t=s.let("valid",!1);c(t),e.ok(t)}function c(e){if(a.schemaEnv.root.dynamicAnchors[l]){const t=s.let("_v",n._`${r.default.dynamicAnchors}${(0,n.getProperty)(l)}`);s.if(t,h(t,e),h(a.validateName,e))}else h(a.validateName,e)()}function h(t,n){return n?()=>s.block((()=>{(0,i.callRef)(e,t),s.let(n,!0)})):()=>(0,i.callRef)(e,t)}}t.dynamicRef=a,t.default=o},6121:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(6215),r=s(1919),i=s(4094),o=s(3944),a=[n.default,r.default,i.default,o.default];t.default=a},4094:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(6215),r=s(6776),i={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,n.dynamicAnchor)(e,""):(0,r.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}};t.default=i},3944:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(1919),r={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,n.dynamicRef)(e,e.schema)};t.default=r},9651:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>n.str`must match format "${e}"`,params:({schemaCode:e})=>n._`{format: ${e}}`},code(e,t){const{gen:s,data:r,$data:i,schema:o,schemaCode:a,it:l}=e,{opts:c,errSchemaPath:h,schemaEnv:u,self:d}=l;c.validateFormats&&(i?function(){const i=s.scopeValue("formats",{ref:d.formats,code:c.code.formats}),o=s.const("fDef",n._`${i}[${a}]`),l=s.let("fType"),h=s.let("format");s.if(n._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>s.assign(l,n._`${o}.type || "string"`).assign(h,n._`${o}.validate`)),(()=>s.assign(l,n._`"string"`).assign(h,o))),e.fail$data((0,n.or)(!1===c.strictSchema?n.nil:n._`${a} && !${h}`,function(){const e=u.$async?n._`(${o}.async ? await ${h}(${r}) : ${h}(${r}))`:n._`${h}(${r})`,s=n._`(typeof ${h} == "function" ? ${e} : ${h}.test(${r}))`;return n._`${h} && ${h} !== true && ${l} === ${t} && !${s}`}()))}():function(){const i=d.formats[o];if(!i)return void function(){if(!1!==c.strictSchema)throw new Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${h}"`}d.logger.warn(e())}();if(!0===i)return;const[a,l,m]=function(e){const t=e instanceof RegExp?(0,n.regexpCode)(e):c.code.formats?n._`${c.code.formats}${(0,n.getProperty)(o)}`:void 0,r=s.scopeValue("formats",{key:o,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,r]:[e.type||"string",e.validate,n._`${r}.validate`]}(i);a===t&&e.pass(function(){if("object"==typeof i&&!(i instanceof RegExp)&&i.async){if(!u.$async)throw new Error("async format in sync schema");return n._`await ${m}(${r})`}return"function"==typeof l?n._`${m}(${r})`:n._`${m}.test(${r})`}())}())}};t.default=r},9502:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=[s(9651).default];t.default=n},6167:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},1448:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(8921),r=s(7274),i=s(3633),o=[n.default,r.default,i.default];t.default=o},808:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(1782),r=s(4641),i=[n.default,r.default];t.default=i},4641:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:e}})=>n.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>n._`{limit: ${e}}`},code(e){const{gen:t,schema:s,data:i,it:o}=e,a=o.items||0;if(!0===a)return;const l=t.const("len",n._`${i}.length`);if(!1===s)e.setParams({len:a}),e.fail(n._`${l} > ${a}`);else if("object"==typeof s&&!(0,r.alwaysValidSchema)(o,s)){const s=t.var("valid",n._`${l} <= ${a}`);t.if((0,n.not)(s),(()=>function(s,i){t.forRange("i",i,l,(i=>{e.subschema({keyword:"unevaluatedItems",dataProp:i,dataPropType:r.Type.Num},s),o.allErrors||t.if((0,n.not)(s),(()=>t.break()))}))}(s,a))),e.ok(s)}o.items=!0}};t.default=i},1782:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i=s(2141),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:e})=>n._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){const{gen:t,schema:s,data:o,errsCount:a,it:l}=e;if(!a)throw new Error("ajv implementation error");const{allErrors:c,props:h}=l;function u(i){if(!1===s)return e.setParams({unevaluatedProperty:i}),e.error(),void(c||t.break());if(!(0,r.alwaysValidSchema)(l,s)){const s=t.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:i,dataPropType:r.Type.Str},s),c||t.if((0,n.not)(s),(()=>t.break()))}}h instanceof n.Name?t.if(n._`${h} !== true`,(()=>t.forIn("key",o,(e=>t.if(function(e,t){return n._`!${e} || !${e}[${t}]`}(h,e),(()=>u(e))))))):!0!==h&&t.forIn("key",o,(e=>void 0===h?u(e):t.if(function(e,t){const s=[];for(const r in e)!0===e[r]&&s.push(n._`${t} !== ${r}`);return(0,n.and)(...s)}(h,e),(()=>u(e))))),l.props=!0,e.ok(n._`${a} === ${i.default.errors}`)}};t.default=o},4693:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i=s(3510),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>n._`{allowedValue: ${e}}`},code(e){const{gen:t,data:s,$data:o,schemaCode:a,schema:l}=e;o||l&&"object"==typeof l?e.fail$data(n._`!${(0,r.useFunc)(t,i.default)}(${s}, ${a})`):e.fail(n._`${l} !== ${s}`)}};t.default=o},8921:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(7772),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:n.error,code:e=>(0,n.validatePropertyDeps)(e)};t.default=r},966:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i=s(3510),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>n._`{allowedValues: ${e}}`},code(e){const{gen:t,data:s,$data:o,schema:a,schemaCode:l,it:c}=e;if(!o&&0===a.length)throw new Error("enum must have non-empty array");const h=a.length>=c.opts.loopEnum;let u;const d=()=>null!=u?u:u=(0,r.useFunc)(t,i.default);let m;if(h||o)m=t.let("valid"),e.block$data(m,(function(){t.assign(m,!1),t.forOf("v",l,(e=>t.if(n._`${d()}(${s}, ${e})`,(()=>t.assign(m,!0).break()))))}));else{if(!Array.isArray(a))throw new Error("ajv implementation error");const e=t.const("vSchema",l);m=(0,n.or)(...a.map(((t,r)=>function(e,t){const r=a[t];return"object"==typeof r&&null!==r?n._`${d()}(${s}, ${e}[${t}])`:n._`${s} === ${r}`}(e,r))))}e.pass(m)}};t.default=o},2649:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3983),r=s(430),i=s(3229),o=s(4336),a=s(498),l=s(3301),c=s(1687),h=s(2958),u=s(4693),d=s(966),m=[n.default,r.default,i.default,o.default,a.default,l.default,c.default,h.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default];t.default=m},3633:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(6776),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:s}){void 0===t.contains&&(0,n.checkStrictMode)(s,`"${e}" without "contains" is ignored`)}};t.default=r},1687:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const s="maxItems"===e?"more":"fewer";return n.str`must NOT have ${s} than ${t} items`},params:({schemaCode:e})=>n._`{limit: ${e}}`},code(e){const{keyword:t,data:s,schemaCode:r}=e,i="maxItems"===t?n.operators.GT:n.operators.LT;e.fail$data(n._`${s}.length ${i} ${r}`)}};t.default=r},3229:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=s(6776),i=s(4499),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const s="maxLength"===e?"more":"fewer";return n.str`must NOT have ${s} than ${t} characters`},params:({schemaCode:e})=>n._`{limit: ${e}}`},code(e){const{keyword:t,data:s,schemaCode:o,it:a}=e,l="maxLength"===t?n.operators.GT:n.operators.LT,c=!1===a.opts.unicode?n._`${s}.length`:n._`${(0,r.useFunc)(e.gen,i.default)}(${s})`;e.fail$data(n._`${c} ${l} ${o}`)}};t.default=o},3983:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r=n.operators,i={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},o={message:({keyword:e,schemaCode:t})=>n.str`must be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>n._`{comparison: ${i[e].okStr}, limit: ${t}}`},a={keyword:Object.keys(i),type:"number",schemaType:"number",$data:!0,error:o,code(e){const{keyword:t,data:s,schemaCode:r}=e;e.fail$data(n._`${s} ${i[t].fail} ${r} || isNaN(${s})`)}};t.default=a},498:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const s="maxProperties"===e?"more":"fewer";return n.str`must NOT have ${s} than ${t} properties`},params:({schemaCode:e})=>n._`{limit: ${e}}`},code(e){const{keyword:t,data:s,schemaCode:r}=e,i="maxProperties"===t?n.operators.GT:n.operators.LT;e.fail$data(n._`Object.keys(${s}).length ${i} ${r}`)}};t.default=r},430:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(3487),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>n.str`must be multiple of ${e}`,params:({schemaCode:e})=>n._`{multipleOf: ${e}}`},code(e){const{gen:t,data:s,schemaCode:r,it:i}=e,o=i.opts.multipleOfPrecision,a=t.let("res"),l=o?n._`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:n._`${a} !== parseInt(${a})`;e.fail$data(n._`(${r} === 0 || (${a} = ${s}/${r}, ${l}))`)}};t.default=r},4336:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(412),r=s(3487),i={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>r.str`must match pattern "${e}"`,params:({schemaCode:e})=>r._`{pattern: ${e}}`},code(e){const{data:t,$data:s,schema:i,schemaCode:o,it:a}=e,l=a.opts.unicodeRegExp?"u":"",c=s?r._`(new RegExp(${o}, ${l}))`:(0,n.usePattern)(e,i);e.fail$data(r._`!${c}.test(${t})`)}};t.default=i},3301:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(412),r=s(3487),i=s(6776),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>r.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>r._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:s,schemaCode:o,data:a,$data:l,it:c}=e,{opts:h}=c;if(!l&&0===s.length)return;const u=s.length>=h.loopRequired;if(c.allErrors?function(){if(u||l)e.block$data(r.nil,d);else for(const t of s)(0,n.checkReportMissingProp)(e,t)}():function(){const i=t.let("missing");if(u||l){const s=t.let("valid",!0);e.block$data(s,(()=>function(s,i){e.setParams({missingProperty:s}),t.forOf(s,o,(()=>{t.assign(i,(0,n.propertyInData)(t,a,s,h.ownProperties)),t.if((0,r.not)(i),(()=>{e.error(),t.break()}))}),r.nil)}(i,s))),e.ok(s)}else t.if((0,n.checkMissingProp)(e,s,i)),(0,n.reportMissingProp)(e,i),t.else()}(),h.strictRequired){const t=e.parentSchema.properties,{definedProperties:n}=e.it;for(const e of s)if(void 0===(null==t?void 0:t[e])&&!n.has(e)){const t=`required property "${e}" is not defined at "${c.schemaEnv.baseId+c.errSchemaPath}" (strictRequired)`;(0,i.checkStrictMode)(c,t,c.opts.strictRequired)}}function d(){t.forOf("prop",o,(s=>{e.setParams({missingProperty:s}),t.if((0,n.noPropertyInData)(t,a,s,h.ownProperties),(()=>e.error()))}))}}};t.default=o},2958:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=s(453),r=s(3487),i=s(6776),o=s(3510),a={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>r.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>r._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:s,$data:a,schema:l,parentSchema:c,schemaCode:h,it:u}=e;if(!a&&!l)return;const d=t.let("valid"),m=c.items?(0,n.getSchemaTypes)(c.items):[];function p(i,o){const a=t.name("item"),l=(0,n.checkDataTypes)(m,a,u.opts.strictNumbers,n.DataType.Wrong),c=t.const("indices",r._`{}`);t.for(r._`;${i}--;`,(()=>{t.let(a,r._`${s}[${i}]`),t.if(l,r._`continue`),m.length>1&&t.if(r._`typeof ${a} == "string"`,r._`${a} += "_"`),t.if(r._`typeof ${c}[${a}] == "number"`,(()=>{t.assign(o,r._`${c}[${a}]`),e.error(),t.assign(d,!1).break()})).code(r._`${c}[${a}] = ${i}`)}))}function f(n,a){const l=(0,i.useFunc)(t,o.default),c=t.name("outer");t.label(c).for(r._`;${n}--;`,(()=>t.for(r._`${a} = ${n}; ${a}--;`,(()=>t.if(r._`${l}(${s}[${n}], ${s}[${a}])`,(()=>{e.error(),t.assign(d,!1).break(c)}))))))}e.block$data(d,(function(){const n=t.let("i",r._`${s}.length`),i=t.let("j");e.setParams({i:n,j:i}),t.assign(d,!0),t.if(r._`${n} > 1`,(()=>(m.length>0&&!m.some((e=>"object"===e||"array"===e))?p:f)(n,i)))}),r._`${h} === false`),e.ok(d)}};t.default=a},5362:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});var n=s(7537),r=s.n(n),i=s(3645),o=s.n(i)()(r());o.push([e.id,".macromolecule-cell-comp-analysis-host{\n max-height: 250px;\n overflow-y: scroll;\n}\n\n.macromolecule-cell-comp-analysis-bar{\n height: inherit;\n display: block;\n margin-top: 1.5px;\n margin-bottom: 1.5px;\n margin-right: 3px;\n}\n\n.macromolecule-cell-comp-analysis-value{\n display: flex;\n}","",{version:3,sources:["webpack://./css/composition-analysis.css"],names:[],mappings:"AAAA;IACI,iBAAiB;IACjB,kBAAkB;AACtB;;AAEA;IACI,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,oBAAoB;IACpB,iBAAiB;AACrB;;AAEA;IACI,aAAa;AACjB",sourcesContent:[".macromolecule-cell-comp-analysis-host{\n max-height: 250px;\n overflow-y: scroll;\n}\n\n.macromolecule-cell-comp-analysis-bar{\n height: inherit;\n display: block;\n margin-top: 1.5px;\n margin-bottom: 1.5px;\n margin-right: 3px;\n}\n\n.macromolecule-cell-comp-analysis-value{\n display: flex;\n}"],sourceRoot:""}]);const a=o},9564:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});var n=s(7537),r=s.n(n),i=s(3645),o=s.n(i)()(r());o.push([e.id,".kalign-version {\n margin-bottom: 0;\n text-align: end;\n font-size: 12px;\n opacity: 0.8;\n}\nbutton.msa-params-button.ui-btn {\n justify-content: end;\n}","",{version:3,sources:["webpack://./css/msa.css"],names:[],mappings:"AAAA;IACI,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,YAAY;AAChB;AACA;IACI,oBAAoB;AACxB",sourcesContent:[".kalign-version {\n margin-bottom: 0;\n text-align: end;\n font-size: 12px;\n opacity: 0.8;\n}\nbutton.msa-params-button.ui-btn {\n justify-content: end;\n}"],sourceRoot:""}]);const a=o},9414:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});var n=s(7537),r=s.n(n),i=s(3645),o=s.n(i)()(r());o.push([e.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},8710:(e,t,s)=>{"use strict";s.d(t,{Z:()=>a});var n=s(7537),r=s.n(n),i=s(3645),o=s.n(i)()(r());o.push([e.id,".monomer-lib-controls-form {\n margin-left: auto;\n margin-right: auto;\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n}\n","",{version:3,sources:["webpack://./src/utils/monomer-lib/library-file-manager/style.css"],names:[],mappings:"AAAA;EACE,iBAAiB;EACjB,kBAAkB;EAClB,aAAa;EACb,sBAAsB;EACtB,mBAAmB;EACnB,WAAW;AACb",sourcesContent:[".monomer-lib-controls-form {\n margin-left: auto;\n margin-right: auto;\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n}\n"],sourceRoot:""}]);const a=o},3645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var s="",n=void 0!==t[5];return t[4]&&(s+="@supports (".concat(t[4],") {")),t[2]&&(s+="@media ".concat(t[2]," {")),n&&(s+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),s+=e(t),n&&(s+="}"),t[2]&&(s+="}"),t[4]&&(s+="}"),s})).join("")},t.i=function(e,s,n,r,i){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(n)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(o[l]=!0)}for(var c=0;c<e.length;c++){var h=[].concat(e[c]);n&&o[h[0]]||(void 0!==i&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=i),s&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=s):h[2]=s),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),t.push(h))}},t}},7537:e=>{"use strict";e.exports=function(e){var t=e[1],s=e[3];if(!s)return t;if("function"==typeof btoa){var n=btoa(unescape(encodeURIComponent(JSON.stringify(s)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(n),i="/*# ".concat(r," */");return[t].concat([i]).join("\n")}return[t].join("\n")}},4063:e=>{"use strict";e.exports=function e(t,s){if(t===s)return!0;if(t&&s&&"object"==typeof t&&"object"==typeof s){if(t.constructor!==s.constructor)return!1;var n,r,i;if(Array.isArray(t)){if((n=t.length)!=s.length)return!1;for(r=n;0!=r--;)if(!e(t[r],s[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===s.source&&t.flags===s.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===s.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===s.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(s).length)return!1;for(r=n;0!=r--;)if(!Object.prototype.hasOwnProperty.call(s,i[r]))return!1;for(r=n;0!=r--;){var o=i[r];if(!e(t[o],s[o]))return!1}return!0}return t!=t&&s!=s}},9133:function(e,t,s){var n;!function(t,r){var i={};!function(e){"use strict";e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=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 s(e,s,n,r,i){for(var o,a,l,c,h,u,d,m,p,f,g,y,b;i>=64;){for(o=s[0],a=s[1],l=s[2],c=s[3],h=s[4],u=s[5],d=s[6],m=s[7],f=0;f<16;f++)g=r+4*f,e[f]=(255&n[g])<<24|(255&n[g+1])<<16|(255&n[g+2])<<8|255&n[g+3];for(f=16;f<64;f++)y=((p=e[f-2])>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,b=((p=e[f-15])>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,e[f]=(y+e[f-7]|0)+(b+e[f-16]|0);for(f=0;f<64;f++)y=(((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&u^~h&d)|0)+(m+(t[f]+e[f]|0)|0)|0,b=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&a^o&l^a&l)|0,m=d,d=u,u=h,h=c+y|0,c=l,l=a,a=o,o=y+b|0;s[0]+=o,s[1]+=a,s[2]+=l,s[3]+=c,s[4]+=h,s[5]+=u,s[6]+=d,s[7]+=m,r+=64,i-=64}return r}var n=function(){function t(){this.digestLength=e.digestLength,this.blockSize=e.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 t.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},t.prototype.clean=function(){for(var e=0;e<this.buffer.length;e++)this.buffer[e]=0;for(e=0;e<this.temp.length;e++)this.temp[e]=0;this.reset()},t.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this.bytesHashed+=t,this.bufferLength>0){for(;this.bufferLength<64&&t>0;)this.buffer[this.bufferLength++]=e[n++],t--;64===this.bufferLength&&(s(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(t>=64&&(n=s(this.temp,this.state,e,n,t),t%=64);t>0;)this.buffer[this.bufferLength++]=e[n++],t--;return this},t.prototype.finish=function(e){if(!this.finished){var t=this.bytesHashed,n=this.bufferLength,r=t/536870912|0,i=t<<3,o=t%64<56?64:128;this.buffer[n]=128;for(var a=n+1;a<o-8;a++)this.buffer[a]=0;this.buffer[o-8]=r>>>24&255,this.buffer[o-7]=r>>>16&255,this.buffer[o-6]=r>>>8&255,this.buffer[o-5]=r>>>0&255,this.buffer[o-4]=i>>>24&255,this.buffer[o-3]=i>>>16&255,this.buffer[o-2]=i>>>8&255,this.buffer[o-1]=i>>>0&255,s(this.temp,this.state,this.buffer,0,o),this.finished=!0}for(a=0;a<8;a++)e[4*a+0]=this.state[a]>>>24&255,e[4*a+1]=this.state[a]>>>16&255,e[4*a+2]=this.state[a]>>>8&255,e[4*a+3]=this.state[a]>>>0&255;return this},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype._saveState=function(e){for(var t=0;t<this.state.length;t++)e[t]=this.state[t]},t.prototype._restoreState=function(e,t){for(var s=0;s<this.state.length;s++)this.state[s]=e[s];this.bytesHashed=t,this.finished=!1,this.bufferLength=0},t}();e.Hash=n;var r=function(){function e(e){this.inner=new n,this.outer=new n,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var t=new Uint8Array(this.blockSize);if(e.length>this.blockSize)(new n).update(e).finish(t).clean();else for(var s=0;s<e.length;s++)t[s]=e[s];for(s=0;s<t.length;s++)t[s]^=54;for(this.inner.update(t),s=0;s<t.length;s++)t[s]^=106;for(this.outer.update(t),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate),s=0;s<t.length;s++)t[s]=0}return e.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},e.prototype.clean=function(){for(var e=0;e<this.istate.length;e++)this.ostate[e]=this.istate[e]=0;this.inner.clean(),this.outer.clean()},e.prototype.update=function(e){return this.inner.update(e),this},e.prototype.finish=function(e){return this.outer.finished?this.outer.finish(e):(this.inner.finish(e),this.outer.update(e,this.digestLength).finish(e)),this},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e}();function i(e){var t=(new n).update(e),s=t.digest();return t.clean(),s}function o(e,t){var s=new r(e).update(t),n=s.digest();return s.clean(),n}function a(e,t,s,n){var r=n[0];if(0===r)throw new Error("hkdf: cannot expand more");t.reset(),r>1&&t.update(e),s&&t.update(s),t.update(n),t.finish(e),n[0]++}e.HMAC=r,e.hash=i,e.default=i,e.hmac=o;var l=new Uint8Array(e.digestLength);e.hkdf=function(e,t,s,n){void 0===t&&(t=l),void 0===n&&(n=32);for(var i=new Uint8Array([1]),c=o(t,e),h=new r(c),u=new Uint8Array(h.digestLength),d=u.length,m=new Uint8Array(n),p=0;p<n;p++)d===u.length&&(a(u,h,s,i),d=0),m[p]=u[d++];return h.clean(),u.fill(0),i.fill(0),m},e.pbkdf2=function(e,t,s,n){for(var i=new r(e),o=i.digestLength,a=new Uint8Array(4),l=new Uint8Array(o),c=new Uint8Array(o),h=new Uint8Array(n),u=0;u*o<n;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,i.reset(),i.update(t),i.update(a),i.finish(c);for(var m=0;m<o;m++)l[m]=c[m];for(m=2;m<=s;m++){i.reset(),i.update(c).finish(c);for(var p=0;p<o;p++)l[p]^=c[p]}for(m=0;m<o&&u*o+m<n;m++)h[u*o+m]=l[m]}for(u=0;u<o;u++)l[u]=c[u]=0;for(u=0;u<4;u++)a[u]=0;return i.clean(),h}}(i);var o=i.default;for(var a in i)o[a]=i[a];"object"==typeof e.exports?e.exports=o:void 0===(n=function(){return o}.call(i,s,i,e))||(e.exports=n)}()},1811:(e,t,s)=>{"use strict";s.d(t,{T:()=>r});const n=new Uint32Array(65536),r=(e,t)=>{if(e.length<t.length){const s=t;t=e,e=s}return 0===t.length?e.length:e.length<=32?((e,t)=>{const s=e.length,r=t.length,i=1<<s-1;let o=-1,a=0,l=s,c=s;for(;c--;)n[e.charCodeAt(c)]|=1<<c;for(c=0;c<r;c++){let e=n[t.charCodeAt(c)];const s=e|a;e|=(e&o)+o^o,a|=~(e|o),o&=e,a&i&&l++,o&i&&l--,a=a<<1|1,o=o<<1|~(s|a),a&=s}for(c=s;c--;)n[e.charCodeAt(c)]=0;return l})(e,t):((e,t)=>{const s=t.length,r=e.length,i=[],o=[],a=Math.ceil(s/32),l=Math.ceil(r/32);for(let e=0;e<a;e++)o[e]=-1,i[e]=0;let c=0;for(;c<l-1;c++){let a=0,l=-1;const h=32*c,u=Math.min(32,r)+h;for(let t=h;t<u;t++)n[e.charCodeAt(t)]|=1<<t;for(let e=0;e<s;e++){const s=n[t.charCodeAt(e)],r=o[e/32|0]>>>e&1,c=i[e/32|0]>>>e&1,h=s|a,u=((s|c)&l)+l^l|s|c;let d=a|~(u|l),m=l&u;d>>>31^r&&(o[e/32|0]^=1<<e),m>>>31^c&&(i[e/32|0]^=1<<e),d=d<<1|r,m=m<<1|c,l=m|~(h|d),a=d&h}for(let t=h;t<u;t++)n[e.charCodeAt(t)]=0}let h=0,u=-1;const d=32*c,m=Math.min(32,r-d)+d;for(let t=d;t<m;t++)n[e.charCodeAt(t)]|=1<<t;let p=r;for(let e=0;e<s;e++){const s=n[t.charCodeAt(e)],a=o[e/32|0]>>>e&1,l=i[e/32|0]>>>e&1,c=s|h,d=((s|l)&u)+u^u|s|l;let m=h|~(d|u),f=u&d;p+=m>>>r-1&1,p-=f>>>r-1&1,m>>>31^a&&(o[e/32|0]^=1<<e),f>>>31^l&&(i[e/32|0]^=1<<e),m=m<<1|a,f=f<<1|l,u=f|~(c|m),h=m&c}for(let t=d;t<m;t++)n[e.charCodeAt(t)]=0;return p})(e,t)}},3979:(e,t)=>{"use strict";t.H$=void 0,t.H$=function(e,t,s){var n=function(e,t,s){if(0===e.length||0===t.length)return 0;if(s&&!s.caseSensitive&&(e=e.toUpperCase(),t=t.toUpperCase()),e===t)return 1;for(var n=0,r=e.length,i=t.length,o=Math.floor(Math.max(r,i)/2)-1,a=new Array(r),l=new Array(i),c=0;c<r;c++)for(var h=Math.max(0,c-o);h<=Math.min(i,c+o+1);h++)if(!a[c]&&!l[h]&&e[c]===t[h]){++n,a[c]=l[h]=!0;break}if(0===n)return 0;var u=0,d=0;for(c=0;c<r;c++)if(a[c]){for(;!l[d];)d++;e.charAt(c)!==t.charAt(d++)&&u++}return(n/r+n/i+(n-(u/=2))/n)/3}(e,t,s),r=0;if(n>.7){for(var i=Math.min(e.length,t.length),o=0;e[o]===t[o]&&o<4&&o<i;)++r,o++;n+=.1*r*(1-n)}return n}},9461:e=>{"use strict";var t=e.exports=function(e,t,n){"function"==typeof t&&(n=t,t={}),s(t,"function"==typeof(n=t.cb||n)?n:n.pre||function(){},n.post||function(){},e,"",e)};function s(e,n,r,i,o,a,l,c,h,u){if(i&&"object"==typeof i&&!Array.isArray(i)){for(var d in n(i,o,a,l,c,h,u),i){var m=i[d];if(Array.isArray(m)){if(d in t.arrayKeywords)for(var p=0;p<m.length;p++)s(e,n,r,m[p],o+"/"+d+"/"+p,a,o,d,i,p)}else if(d in t.propsKeywords){if(m&&"object"==typeof m)for(var f in m)s(e,n,r,m[f],o+"/"+d+"/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),a,o,d,i,f)}else(d in t.keywords||e.allKeys&&!(d in t.skipKeywords))&&s(e,n,r,m,o+"/"+d,a,o,d,i)}r(i,o,a,l,c,h,u)}}t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}},3379:e=>{"use strict";var t=[];function s(e){for(var s=-1,n=0;n<t.length;n++)if(t[n].identifier===e){s=n;break}return s}function n(e,n){for(var i={},o=[],a=0;a<e.length;a++){var l=e[a],c=n.base?l[0]+n.base:l[0],h=i[c]||0,u="".concat(c," ").concat(h);i[c]=h+1;var d=s(u),m={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)t[d].references++,t[d].updater(m);else{var p=r(m,n);n.byIndex=a,t.splice(a,0,{identifier:u,updater:p,references:1})}o.push(u)}return o}function r(e,t){var s=t.domAPI(t);return s.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;s.update(e=t)}else s.remove()}}e.exports=function(e,r){var i=n(e=e||[],r=r||{});return function(e){e=e||[];for(var o=0;o<i.length;o++){var a=s(i[o]);t[a].references--}for(var l=n(e,r),c=0;c<i.length;c++){var h=s(i[c]);0===t[h].references&&(t[h].updater(),t.splice(h,1))}i=l}}},569:e=>{"use strict";var t={};e.exports=function(e,s){var n=function(e){if(void 0===t[e]){var s=document.querySelector(e);if(window.HTMLIFrameElement&&s instanceof window.HTMLIFrameElement)try{s=s.contentDocument.head}catch(e){s=null}t[e]=s}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(s)}},9216:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},3565:(e,t,s)=>{"use strict";e.exports=function(e){var t=s.nc;t&&e.setAttribute("nonce",t)}},7795:e=>{"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(s){!function(e,t,s){var n="";s.supports&&(n+="@supports (".concat(s.supports,") {")),s.media&&(n+="@media ".concat(s.media," {"));var r=void 0!==s.layer;r&&(n+="@layer".concat(s.layer.length>0?" ".concat(s.layer):""," {")),n+=s.css,r&&(n+="}"),s.media&&(n+="}"),s.supports&&(n+="}");var i=s.sourceMap;i&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(n,e,t.options)}(t,e,s)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},4589:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},7241:(e,t,s)=>{"use strict";s.d(t,{D:()=>h});var n=s(4469),r=s(976),i=s(6414),o=s.n(i),a=s(3348),l=s(499);const c=31;async function h(e,t=!1,s){const i=l.Cn.getOrCreate(e);let h;s??(s=new Map);const d=i.isHelm()?(0,a.getHelmMonomers)(e):Object.keys(i.stats.freq).filter((e=>""!==e));for(let e=0;e<d.length;e++)s.has(d[e])||s.set(d[e],`${s.size+1}`);if(i.isHelm())h=await n.functions.call("HELM:getMolFiles",{col:e}),h=function(e,t,s=!1){const n=new Array(e.length);for(let r=0;r<e.length;r++){let i=0,o=0,a="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";const l=e.get(r);i=l.indexOf("\n",i)+1,i=l.indexOf("\n",i)+1,i=l.indexOf("\n",i)+1;const h=parseInt(l.substring(i,i+3)),u=parseInt(l.substring(i+3,i+6));a+=`M V30 COUNTS ${h} ${u} 0 0 0\n`,a+="M V30 BEGIN ATOM\n";for(let e=0;e<h;e++){i=l.indexOf("\n",i)+1+c,o=l.indexOf(" ",i);const n=l.substring(i,o);a+=s?`M V30 ${e+1} R${t.get(n)} 0.000 0.000 0 0\n`:`M V30 ${e+1} At 0.000 0.000 0 0 MASS=${t.get(n)}\n`}a+="M V30 END ATOM\n",a+="M V30 BEGIN BOND\n";for(let e=0;e<u;e++){i=l.indexOf("\n",i)+1;const t=parseInt(l.substring(i,i+3).trim()),s=parseInt(l.substring(i+3,i+6).trim());a+=`M V30 ${e+1} ${parseInt(l.substring(i+6,i+9).trim())} ${t} ${s}\n`}a+="M V30 END BOND\n",a+="M V30 END CTAB\n",a+="M END",n[r]=a}return n}(h,s,t);else{h=new Array(e.length);for(let n=0;n<e.length;n++){const e=u(o()(i.splitted[n]).filter((e=>""!==e)).toArray(),s,t);h[n]=e}}return r.Column.fromStrings("monomericMols",h)}function u(e,t,s=!1){let n="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";n+=`M V30 COUNTS ${e.length} ${e.length?e.length-1:0} 0 0 0\n`,n+="M V30 BEGIN ATOM\n";for(let r=0;r<e.length;r++)n+=s?`M V30 ${r+1} R${t.get(e[r])} 0.000 0.000 0 0\n`:`M V30 ${r+1} At 0.000 0.000 0 0 MASS=${t.get(e[r])}\n`;n+="M V30 END ATOM\n",n+="M V30 BEGIN BOND\n";for(let t=0;t<e.length-1;t++)n+=`M V30 ${t+1} 1 ${t+1} ${t+2}\n`;return n+="M V30 END BOND\n",n+="M V30 END CTAB\n",n+="M END",n}},3348:(e,t,s)=>{"use strict";s.d(t,{_package:()=>rt,activityCliffs:()=>at,getBioLib:()=>ot,getHelmMonomers:()=>ut,getMonomerLibHelper:()=>it,importFasta:()=>ht,sequenceIdentityScoring:()=>dt,sequenceSimilarityScoring:()=>mt,sequenceSpaceTopMenu:()=>lt,toAtomicLevel:()=>ct});var n,r,i=s(4469),o=s(3870),a=s(976),l=s(4628);(r=n||(n={})).EUCLIDEAN="EUCLIDEAN",r.MANHATTAN="MANHATTAN";const c="MCL";a.SEMTYPE.MOLECULE,a.SEMTYPE.MACROMOLECULE;var h=s(442),u=(s(5697),s(701)),d=s(3379),m=s.n(d),p=s(7795),f=s.n(p),g=s(569),y=s.n(g),b=s(3565),w=s.n(b),C=s(9216),v=s.n(C),T=s(4589),A=s.n(T),S=s(9414),_={};_.styleTagTransform=A(),_.setAttributes=w(),_.insert=y().bind(null,"head"),_.domAPI=f(),_.insertStyleElement=v(),m()(S.Z,_),S.Z&&S.Z.locals&&S.Z.locals;const E=e=>null==e;function P(e,t,s,n){if(s>e[e.length-1])return;const r=e.findIndex((e=>s<e));e.pop(),e.splice(r,0,s),t.pop(),t.splice(r,0,n)}class ${_workerCount;constructor(){this._workerCount=Math.max(navigator.hardwareConcurrency-2,1)}async calcMultiColumn(e,t,r,i=[{}],o=[1],a=n.EUCLIDEAN){const l=e[0].length*(e[0].length-1)/2,c=Math.floor(l/this._workerCount),h=e[0].length>2e4?await this.getMinimalThreshold(e,t,i,o,a):0;r<h&&(console.log(`using threshold ${h}`),r=h),i.forEach(((e,t)=>i[t].threshold=r));const u=new Array(this._workerCount),d=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(s.p+s.u(23),s.b))));for(let s=0;s<this._workerCount;s++)u[s]=new Promise(((n,h)=>{const u=s*c,m=s===this._workerCount-1?l:(s+1)*c;m<=u&&n({i:new Int32Array(0),j:new Int32Array(0),distance:new Float32Array(0),idx:s}),d[s].postMessage({values:e,startIdx:u,endIdx:m,threshold:r,fnNames:t,opts:i,weights:o,aggregationMethod:a}),d[s].onmessage=({data:{error:e,i:t,j:r,distance:i}})=>{e?(d[s].terminate(),h(e)):(d[s].terminate(),n({i:t,j:r,distance:i,idx:s}))}}));const m=await Promise.all(u),p=m.reduce(((e,t)=>e+t.i.length),0),f=new Int32Array(p),g=new Int32Array(p),y=new Float32Array(p);let b=0;for(const e of m)f.set(e.i,b),g.set(e.j,b),y.set(e.distance,b),b+=e.i.length;return{i:f,j:g,distance:y}}async calc(e,t,s,n={}){return await this.calcMultiColumn([e],[t],s,[n],[1])}async getKNN(e,t,s=15,n={}){return await this.multiColumnKNN([e],[t],s,[n],[1])}async getThresholdKNN(e,t,s=.8,n={}){return await this.multiColumnThresholdKnn([e],[t],s,[n],[1])}async multiColumnThresholdKnn(e,t,r=.8,i,o,a=n.EUCLIDEAN){if(e.length!==t.length||e.length!==i.length||e.length!==o.length)throw new Error("values, distance functions, options and weights arrays should have the same length");if(e.some((t=>t.length!==e[0].length)))throw new Error("all values arrays should have the same length");const l=e[0].length*(e[0].length-1)/2,c=Math.floor(l/this._workerCount),h=new Array(this._workerCount),u=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(s.p+s.u(427),s.b))));for(let s=0;s<this._workerCount;s++)h[s]=new Promise(((n,h)=>{const d=s*c,m=s===this._workerCount-1?l:(s+1)*c;m<=d&&n({knnDistances:new Array(0),knnIndexes:new Array(0)}),u[s].postMessage({values:e,startIdx:d,endIdx:m,fnNames:t,opts:i,threshold:r,weights:o,aggregationMethod:a}),u[s].onmessage=({data:{error:e,knnDistances:t,knnIndexes:r}})=>{e?(u[s].terminate(),h(e)):(u[s].terminate(),n({knnDistances:t,knnIndexes:r}))}}));const d=await Promise.all(h),m=new Int32Array(e[0].length);for(const t of d)for(let s=0;s<e[0].length;++s)m[s]+=t.knnIndexes[s]?.length??0;const p={knnDistances:new Array(e[0].length).fill(null).map(((e,t)=>new Array(m[t]))),knnIndexes:new Array(e[0].length).fill(null).map(((e,t)=>new Array(m[t])))};for(const t of d)for(let s=0;s<e[0].length;++s)for(let e=0;e<t.knnDistances[s]?.length;++e)p.knnDistances[s][m[s]-1]=t.knnDistances[s][e],p.knnIndexes[s][m[s]-1]=t.knnIndexes[s][e],m[s]-=1;return p}async multiColumnKNN(e,t,r=15,i,o,a=n.EUCLIDEAN){if(e.length!==t.length||e.length!==i.length||e.length!==o.length)throw new Error("values, distance functions, options and weights arrays should have the same length");if(e.some((t=>t.length!==e[0].length)))throw new Error("all values arrays should have the same length");const l=e[0].length*(e[0].length-1)/2,c=Math.floor(l/this._workerCount),h=new Array(this._workerCount),u=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(s.p+s.u(282),s.b))));for(let s=0;s<this._workerCount;s++)h[s]=new Promise(((n,h)=>{const d=s*c,m=s===this._workerCount-1?l:(s+1)*c;m<=d&&n({knnDistances:new Array(0),knnIndexes:new Array(0)}),u[s].postMessage({values:e,startIdx:d,endIdx:m,fnNames:t,opts:i,nNeighbours:r,weights:o,aggregationMethod:a}),u[s].onmessage=({data:{error:e,knnDistances:t,knnIndexes:r}})=>{e?(u[s].terminate(),h(e)):(u[s].terminate(),n({knnDistances:t,knnIndexes:r}))}}));const d=await Promise.all(h),m={knnDistances:new Array(e[0].length).fill(null).map((()=>new Array(r).fill(99999))),knnIndexes:new Array(e[0].length).fill(null).map((()=>new Array(r).fill(-1)))};for(const t of d)for(let s=0;s<e[0].length;++s)for(let e=0;e<t.knnDistances[s]?.length;++e)P(m.knnDistances[s],m.knnIndexes[s],t.knnDistances[s][e],t.knnIndexes[s][e]);return m}async getSampleDistances(e,t,r=[],i,o=n.EUCLIDEAN){const a=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(s.p+s.u(40),s.b))));try{const s=e[0].length*(e[0].length-1)/2,n=Math.floor(s/this._workerCount),l=1e6,c=Math.max(Math.min(s/1e3,l),Math.min(s,l)),h=Math.floor(c/this._workerCount),u=new Array(this._workerCount);for(let l=0;l<this._workerCount;l++)u[l]=new Promise(((c,u)=>{const d=l*n,m=l===this._workerCount-1?s:(l+1)*n;a[l].postMessage({values:e,startIdx:d,endIdx:m,sampleLength:h,fnNames:t,opts:r,weights:i,aggregationMethod:o}),a[l].onmessage=({data:{error:e,distance:t}})=>{a[l].terminate(),e?u(e):c({distance:t})}}));const d=await Promise.all(u),m=d.reduce(((e,t)=>e+t.distance.length),0),p=new Float32Array(m);let f=0;for(const e of d)p.set(e.distance,f),f+=e.distance.length;return p.sort(),p}catch(e){return a?.forEach((e=>e?.terminate())),console.error(e),new Float32Array(1).fill(.5)}}async getMinimalThreshold(e,t,s=[],r,i=n.EUCLIDEAN){try{const n=e.length*(e.length-1)/2,o=await this.getSampleDistances(e,t,s,r,i);return 1-o[Math.floor(7e7/n*o.length)]}catch(e){return console.error(e),.5}}static calcSync(e,t,s,n){const r=[],i=[],o=[];let a=0,l=0,c=0;const h=e.length*(e.length-1)/2;for(;a<h;){const t=E(e[l])||E(e[c])?1:s(e[l],e[c]);1-t>=n&&(r.push(l),i.push(c),o.push(t)),a++,c++,c===e.length&&(l++,c=l+1)}return{i:new Int32Array(r),j:new Int32Array(i),distance:new Float32Array(o)}}}var x,N=s(9657);!function(e){e.none="none",e.bold="bold",e.dashed="dashed"}(x||(x={}));class M{get currentLineId(){return this._currentLineIdx}set currentLineId(e){e!==this._currentLineIdx&&(this._currentLineIdx=e,this.sp.render(this.ctx))}set linesToRender(e){this.updateLines(e),this.sp.render(this.ctx)}set linesVisibility(e){this.visibility=e,this.sp.render(this.ctx)}constructor(e,t,s,n,r=x.none){var i;this._currentLineIdx=-1,this.lineClicked=new u.Subject,this.lineHover=new u.Subject,this.mouseOverLineId=-1,this.arrowWidth=15,this.sp=e,this.xAxisCol=this.sp.dataFrame.columns.byName(t),this.yAxisCol=this.sp.dataFrame.columns.byName(s),this.canvas=this.sp.getInfo().canvas,this.ctx=this.canvas.getContext("2d"),this.currentLineStyle=r,this.updateLines(n),this.visibility=null!==(i=n.visibility)&&void 0!==i?i:new N.Z(this.lines.from.length),n.visibility||this.visibility.setAll(!0,!1),n.arrowSize&&(this.arrowWidth=n.arrowSize),this.canvas.onmousedown=e=>{-1!==this.mouseOverLineId&&this.lineClicked.next({x:e.clientX,y:e.clientY,id:this.mouseOverLineId,event:e})},this.canvas.onmousemove=e=>{this.mouseOverLineId=this.checkCoordsOnLine(e.offsetX,e.offsetY),-1!==this.mouseOverLineId&&this.lineHover.next({x:e.clientX,y:e.clientY,id:this.mouseOverLineId,event:e})},e.onEvent("d4-before-draw-scene").subscribe((e=>{this.renderLines()}))}updateLines(e){this.lines=e,this.multipleLinesCounts=new Uint8Array(this.lines.from.length),e.skipMultiLineCalculation?this.multipleLinesCounts.fill(0):this.createMultiLinesIndices()}renderLines(){var e,t,s,n,r,i,o,a,l,c,h,u,d;const m=this.sp.getOptions().look,p=this.lines.colors||this.lines.width||this.lines.opacities||this.lines.drawArrowsArr;p||(this.ctx.lineWidth=null!==(e=this.lines.width)&&void 0!==e?e:1,this.ctx.strokeStyle=`rgba(${null!==(t=this.lines.color)&&void 0!==t?t:"0,128,0"},${null!==(s=this.lines.opacity)&&void 0!==s?s:1})`);const f=m.sizeColumnName?this.sp.dataFrame.col(m.sizeColumnName):null,g=this.sp.dataFrame.filter;for(let e=0;e<this.lines.from.length;e++)if(g.get(this.lines.from[e])&&g.get(this.lines.to[e])&&this.visibility.getBit(e)){let t=0;const{sizeFrom:s,sizeTo:g}=this.getMarkersSizes(m,f,e),y=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[e]),this.yAxisCol.get(this.lines.from[e]));let b=null==y?void 0:y.x,w=null==y?void 0:y.y;const C=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[e]),this.yAxisCol.get(this.lines.to[e]));let v=null==C?void 0:C.x,T=null==C?void 0:C.y;const A=Math.min(this.sp.viewBox.width,this.sp.viewBox.height);if(this.ctx.beginPath(),b&&w&&v&&T&&Math.hypot(v-b,T-w)/A>.01){if(p){const t=(null===(n=this.lines.colors)||void 0===n?void 0:n[e])?null===(r=this.lines.colors)||void 0===r?void 0:r[e]:"0,128,0",s=(null===(i=this.lines.opacities)||void 0===i?void 0:i[e])?null===(o=this.lines.opacities)||void 0===o?void 0:o[e]:1;this.ctx.strokeStyle=`rgba(${t},${s})`,this.ctx.lineWidth=(null===(a=this.lines.widths)||void 0===a?void 0:a[e])?null===(l=this.lines.widths)||void 0===l?void 0:l[e]:1}e===this._currentLineIdx&&this.toggleCurrentLineStyle(!0);const m=this.multipleLinesCounts[e];let f=null;if(m){t=this.getLineLength(b,w,v,T);const n=this.getPointOnDistance(b,w,v,T,g,t),r=this.getPointOnDistance(v,T,b,w,s,t);b=n.x,w=n.y,v=r.x,T=r.y,f=this.lines.from[e]>this.lines.to[e]?this.findControlPoint(m,b,w,v,T,e):this.findControlPoint(m,v,T,b,w,e),this.ctx.moveTo(b,w),this.ctx.quadraticCurveTo(f.x,f.y,v,T)}else this.ctx.moveTo(b,w),this.ctx.lineTo(v,T);if((null!==(c=this.lines.drawArrows)&&void 0!==c?c:null===(h=this.lines.drawArrowsArr)||void 0===h?void 0:h.getBit(e))&&(t||(t=this.getLineLength(b,w,v,T)),t>this.arrowWidth)){const e=m?null:this.getPointOnDistance(b,w,v,T,g,t),s=m?f.x:b,n=m?f.y:w;this.canvasArrow(this.ctx,null!==(u=null==e?void 0:e.x)&&void 0!==u?u:b,null!==(d=null==e?void 0:e.y)&&void 0!==d?d:w,s,n)}this.ctx.stroke(),this.ctx.closePath(),e===this._currentLineIdx&&this.toggleCurrentLineStyle(!1)}}this.fillLeftBottomRect()}toggleCurrentLineStyle(e){switch(this.currentLineStyle){case x.bold:e?this.ctx.lineWidth+=2:this.ctx.lineWidth-=2;break;case x.dashed:e?this.ctx.setLineDash([5,5]):this.ctx.setLineDash([]);break;default:return}}getMarkersSizes(e,t,s){let n=3,r=3;return t?(n=(e.markerMinSize+(e.markerMaxSize-e.markerMinSize)*t.scale(this.lines.from[s]))/2,r=(e.markerMinSize+(e.markerMaxSize-e.markerMinSize)*t.scale(this.lines.to[s]))/2):e.markerDefaultSize&&(n=e.markerDefaultSize/2,r=e.markerDefaultSize/2),{sizeFrom:n,sizeTo:r}}fillLeftBottomRect(){const e=new Path2D;e.rect(this.sp.yAxisBox.minX,this.sp.yAxisBox.maxY,this.sp.yAxisBox.width,this.sp.xAxisBox.height),this.ctx.fillStyle="white",this.ctx.beginPath(),this.ctx.fill(e),this.ctx.closePath()}createMultiLinesIndices(){const e=new N.Z(this.lines.from.length);e.setAll(!0);for(let t=-1;-1!==(t=e.findNext(t));){const s=t,n=this.lines.from[s],r=this.lines.to[s];let i=1;for(let s=t;-1!==(s=e.findNext(s));){const t=this.lines.from[s],o=this.lines.to[s];(t===n&&o===r||o===n&&t===r)&&(this.multipleLinesCounts[s]=++i,e.setBit(s,!1,!1))}i>1&&(this.multipleLinesCounts[s]=1),e.setBit(t,!1,!1)}}checkCoordsOnLine(e,t){let s=-1,n=null,r=null;const i=this.sp.getOptions().look,o=i.sizeColumnName?this.sp.dataFrame.col(i.sizeColumnName):null,a=this.sp.dataFrame.filter;for(let l=0;l<this.lines.from.length;l++)if(a.get(this.lines.from[l])&&a.get(this.lines.to[l])&&this.visibility.getBit(l)){const{sizeFrom:a,sizeTo:c}=this.getMarkersSizes(i,o,l),h=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[l]),this.yAxisCol.get(this.lines.from[l])),u=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[l]),this.yAxisCol.get(this.lines.to[l]));if(this.multipleLinesCounts[l]){const s=this.getLineLength(h.x,h.y,u.x,u.y),n=this.getPointOnDistance(h.x,h.y,u.x,u.y,c,s),i=this.getPointOnDistance(u.x,u.y,null==h?void 0:h.x,null==h?void 0:h.y,a,s),o=this.lines.from[l]>this.lines.to[l]?this.findControlPoint(this.multipleLinesCounts[l],n.x,n.y,i.x,i.y,l):this.findControlPoint(this.multipleLinesCounts[l],i.x,i.y,n.x,n.y,l);r=this.calculateDistToCurveLine(l,e,t,n,i,o)}else r=this.calculateDistToStraightLine(e,t,h,u);(!n&&null!==r&&r<5||n&&null!==r&&r<n)&&(n=r,s=l)}return s}calculateDistToStraightLine(e,t,s,n){const r=Math.min(s.x,n.x),i=Math.max(s.x,n.x),o=Math.min(s.y,n.y),a=Math.max(s.y,n.y);return e>=r-2&&e<=i+2&&t>=o-2&&t<=a+2?this.distToStraightLineSegment(e,t,s,n):null}distToStraightLineSegment(e,t,s,n){const r=(e,t,s,n)=>Math.pow(e-s,2)+Math.pow(t-n,2),i=r(s.x,s.y,n.x,n.y);if(0==i)return r(e,t,s.x,s.y);let o=((e-s.x)*(n.x-s.x)+(t-s.y)*(n.y-s.y))/i;return o=Math.max(0,Math.min(1,o)),r(e,t,s.x+o*(n.x-s.x),s.y+o*(n.y-s.y))}calculateDistToCurveLine(e,t,s,n,r,i){const o=Math.min(n.x,r.x,i.x),a=Math.max(n.x,r.x,i.x),l=Math.min(n.y,r.y,i.y),c=Math.max(n.y,r.y,i.y);if(t>=o-2&&t<=a+2&&s>=l-2&&s<=c+2){const e=a-o,h=c-l;return this.calculateDistToCurveInRect(t,s,n,i,r,e,h)}return null}calculateDistToCurveInRect(e,t,s,n,r,i,o){const a=Math.floor((i+o)/3),l=1/a,c=new Uint32Array(a),h=new Uint32Array(a),u=new Uint32Array(a);let d=null;const m=new N.Z(a);for(let i=0;i<c.length;i++){const o=i*l,a=Math.pow(1-o,2)*s.x+2*o*(1-o)*n.x+Math.pow(o,2)*r.x,m=Math.pow(1-o,2)*s.y+2*o*(1-o)*n.y+Math.pow(o,2)*r.y,p=Math.abs(e-a),f=Math.abs(t-m),g=p+f;(!d||d>g)&&(d=g),u[i]=Math.max(p,f),c[i]=a,h[i]=m}for(let e=0;e<c.length;e++)u[e]<d&&m.setBit(e,!0,!1);let p=null;for(let s=-1;-1!==(s=m.findNext(s));){const n=Math.hypot(c[s]-e,h[s]-t);(!p||p>n)&&(p=n)}return p}getLineLength(e,t,s,n){return Math.sqrt(Math.pow(s-e,2)+Math.pow(n-t,2))}getPointOnDistance(e,t,s,n,r,i){const o=s-r*((s-e)/i),l=n-r*((n-t)/i);return new a.Point(o,l)}findControlPoint(e,t,s,n,r,i){const o=t+(n-t)/2,l=s+(r-s)/2;let c=o-t,h=l-s;const u=Math.sqrt(c*c+h*h);c/=u,h/=u;const d=50*Math.ceil(e/2);return e%2==0?new a.Point(o+d/2*h,l-d/2*c):new a.Point(o-d/2*h,l+d/2*c)}canvasArrow(e,t,s,n,r){const i=Math.atan2(n-t,r-s)+Math.PI;e.moveTo(t-this.arrowWidth*Math.sin(i-Math.PI/10),s-this.arrowWidth*Math.cos(i-Math.PI/10)),e.lineTo(t,s),e.lineTo(t-this.arrowWidth*Math.sin(i+Math.PI/10),s-this.arrowWidth*Math.cos(i+Math.PI/10))}}const L="dimensionality-reducer-terminate-event";var I=s(850);async function R(e,t,n,r,o,a,l){let c=await async function(e,t,n,r,o,a,l){if(!a.distanceFnArgs)throw new Error("options.distanceFnArgs must be defined");if(e.length!==t.length||e.length!==a.distanceFnArgs.length||e.length!==r.length)throw new Error("data, metrics and options and weights must have the same length");return new Promise((function(c,h){const u=new Worker(new URL(s.p+s.u(42),s.b));u.postMessage({columnsData:e,distanceMetrics:t,method:n,options:a,weights:r,aggregationMethod:o});const d=i.events.onCustomEvent(L).subscribe((()=>{try{u?.terminate()}finally{d.unsubscribe()}}));u.onmessage=({data:{error:e,embedding:t,epochNum:s,epochsLength:n}})=>{E(s)||E(n)?(d.unsubscribe(),e?h(e):c(t),setTimeout((()=>u.terminate()),100)):l&&l(s,n,t)}}))}(e,n,t,r,o,a,l);return c=c.map((e=>(0,I.Fv)(e))),c}let O=0;const k="cliffsDf",F=new u.Subject,D="activity_difference",G="SALI_index",H="similarity",W="line_index",B=["1_molecule","2_molecule"],V="filterCliffs";var U,j=s(499),Y=s(5226),K=s(7228),q=s(8457),Z=s(8260);async function z(e,t,s,n){const r=(0,q.O)(t),i=(0,Z.vU)(t.getTag(a.TAGS.UNITS),t.getTag("separator"))(s),o=n===U.IDENTITY?function(e,t){const s=t.columns.length,n=new Array(s),r=new Array(s),i=new Array(s);for(let o=0;o<s;++o){const s=t.columns.byIndex(o);n[o]=s.getRawData(),r[o]=s.categories.indexOf(""),i[o]=s.categories.indexOf(e[o]??"")}const o=a.Column.float("Identity",t.rowCount),l=o.getRawData();for(let s=0;s<t.rowCount;++s){l[s]=0;for(let t=0;t<e.length;++t)n[t][s]===i[t]&&++l[s];l[s]/=e.length}return o}(i,r):n===U.SIMILARITY?await async function(e,t){const s=t.columns.toList();return await(0,K.Qx)(s,e)}(i,r):null;if(null===o)throw new Error(`In bio library: Unkown sequence scoring method: ${n}`);return o.name=e.columns.getUnusedName(o.name),e.columns.add(o),o}!function(e){e.IDENTITY="identity",e.SIMILARITY="similarity"}(U||(U={}));var X=s(7945),J=(s(4293),s(6414)),Q=s.n(J);const ee="rgb(100,100,100)",te="#808080",se="rgb(0,0,0)",ne=Z.GU;var re,ie;function oe(e,t,s,n,r,i,o=ee,a=0,l=!1,c=1,h="",u=!1,d=ie.classic,m=[],p=0,f=null,g=[],y=null,b={}){r.textAlign="start";let w=i.substring(0),C=u?"":h;d===ie.MSA&&(C="");let v=!0,T=!0,A="difference";null!=f&&null!=f.cell.column&&(v=f.cell.column.temp["color-code"]??!0,T=f.cell.column.temp["compare-with-current"]??!0,A=f.cell.column.temp["highlight-difference"]??"difference");const S=g[p];T&&g.length>0&&"difference"===A&&(c=w==S?.3:c),T&&g.length>0&&"equal"===A&&(c=w!=S?.3:c),null!=y&&(w=ne(w,y));const _=w+C;b[_]??(b[_]=r.measureText(_));let E=b[_];b[w]??(b[w]=r.measureText(w));let P=b[w].width;b[C]??(b[C]=r.measureText(C));const $=b[C].width,x=n/2-(E.fontBoundingBoxAscent+E.fontBoundingBoxDescent)/2+1;function N(s,n){const i=v?o:se;r.fillStyle=i,r.globalAlpha=c,d===ie.classic&&(r.fillText(w,e+s,t+x),r.fillStyle=te,r.fillText(C,e+n,t+x)),d===ie.MSA&&r.fillText(w,e+s,t+x)}E=E.width,d===ie.MSA&&(P=m[p],E=m[p]);const M=(m[p]??0)-(m[0]??0);if(l||E>s)return N(M,M+P),e+M+P+$;{const t=(s-E)/2;return N(t,t+P),e+M+t+P}}!function(e){e.maxMonomerLength=".mm.cellRenderer.maxMonomerLength"}(re||(re={})),function(e){e.MSA="MSA",e.classic="classic"}(ie||(ie={})),s(9611);var ae,le,ce=s(8447),he=s(7331);function ue(e){const t=!Q().enumerate(e).some((([t,s])=>t.length>1&&0!=s&&s!=e.length-1)),s=[],n=t?"":" ";for(const[t,r]of Q().enumerate(e)){let i=t;r<e.length&&(i+=`${t?"":"-"}${n}`),s.push(i)}return[s,t]}(le=ae||(ae={})).long="long",le.short="short",s(3553),ce.GU;class de extends a.GridCellRenderer{constructor(){super(...arguments),this.padding=5}get name(){return"sequence"}get cellType(){return"sequence"}get defaultHeight(){return 30}get defaultWidth(){return 230}onClick(e,t){e.cell.column.temp["current-word"]=e.cell.value,e.grid.invalidate()}onMouseMove(e,t){const s=e.cell.column.temp["bio-seqCol"];if(!s)return;const n=e.bounds,r=t.offsetX-e.gridColumn.left+(e.gridColumn.left-n.x),a=s.getPosition(e.tableRowIndex,r),l=s.getSeqMonList(e.tableRowIndex);if(null!==a&&a<l.length){const e=l[a],n=[o.div(e)];if(s._monomerStructureMap[e])n.push(s._monomerStructureMap[e]);else{const t=s.getMonomer(e);if(t){const r={autoCrop:!0,autoCropMargin:0,suppressChiralText:!0},o=i.chem.svgMol(t.smiles,void 0,void 0,r);n.push(o),s._monomerStructureMap[e]=o}}o.tooltip.show(o.divV(n),t.x+16,t.y+16)}else o.tooltip.hide()}render(e,t,s,n,r,i,o){try{i.grid}catch(e){const[t,s]=(0,X.yf)(e);rt.logger.error(t,void 0,s)}i.cell.column}}class me extends a.GridCellRenderer{get name(){return"MacromoleculeDifferenceCR"}get cellType(){return constants.Of.MACROMOLECULE_DIFFERENCE}get defaultHeight(){return 30}get defaultWidth(){return 230}render(e,t,s,n,r,i,o){const l=window.devicePixelRatio,c=i.grid,h=i.cell,u=i.tableColumn,d=h.value??"",m=u.tags.separator,p=u.tags[a.TAGS.UNITS];getUpdatedWidth(c,e,t,n,l);const[f,g]=d.split("#"),y=(0,Z.vU)(p,m);pe(e,t,s,n,r,y(f),y(g),p)}}function pe(e,t,s,n,r,i,o,a,l,c){if(i.length!==o.length){const e=function(e,t){let s=0,n=0;const r=e.length>t.length?e:t,i=e.length>t.length?t:e;for(let e=0;e<i.length;e++)r[e]===i[e]&&s++;const o=r.length-i.length;for(let e=r.length-1;e>o;e--)r[e]===i[e-o]&&n++;const a=new Array(Math.abs(e.length-t.length)).fill("");function l(e){return s>n?e.concat(a):a.concat(e)}return e.length>t.length?t=l(t):e=l(e),{subParts1:e,subParts2:t}}(Q()(i).toArray(),Q()(o).toArray());i=e.subParts1,o=e.subParts2}const h=e.measureText(ue(i).join("")),u=e.measureText(ue(o).join("")),d=Math.max(h.width,u.width);l&&(n=d+4*i.length,e.canvas.width=d+4*i.length);let m=Math.max(t,t+(n-(d+4*i.length))/2)+5;const p=Math.max(s,s+(r-28)/2);e.save(),e.beginPath(),e.rect(t,s,l?d+4*i.length:n,r),e.clip(),e.font="12px monospace",e.textBaseline="top";let f=he.UE.Color;"HELM"!=a&&(f=(0,ce.py)(a.substring(a.length-2)));for(let t=0;t<i.length;t++){const s=i[t],a=o[t],l=f.get(s);if(s!=a){const i=f.get(a),o=oe(m,p-7,n,r,e,s,l,0,!0),h=oe(m,p+7,n,r,e,a,i,0,!0);m=Math.max(h,o),c&&(c[t]=fe(s,a,l,i,p,7,r))}else m=oe(m,p,n,r,e,s,l,0,!0,.5);m+=4}e.restore()}function fe(e,t,s,n,r,i,o){const a=document.createElement("canvas"),l=a.getContext("2d");l.font="12px monospace";const c=l.measureText(ue([e]).join("")).width,h=l.measureText(ue([t]).join("")).width,u=Math.max(c,h);return a.height=o,a.width=u+4,l.font="12px monospace",l.textBaseline="top",oe(0,r-i,u,o,l,e,s,0,!0),oe(0,r+i,u,o,l,t,n,0,!0),a}var ge,ye=s(8467),be=s(9298);!function(e){e.Unknown="unknown",e.FR="framework",e.CDR="cdr"}(ge||(ge={}));const we=new class{constructor(){this.regionTypes=[ge.CDR],this.chains=["Heavy","Light"],this.skipEmptyPositions=!1,this.fitWidth=!1,this.positionWidth=16,this.positionHeight=be.ES.Entropy,this.filterSource=be.vS.filterSource}};var Ce=s(172),ve=s(8415);const Te=ge;var Ae,Se;!function(e){e.STYLE="Style",e.BEHAVIOR="Behavior",e.LAYOUT="Layout",e.DATA="Data"}(Ae||(Ae={})),function(e){e.skipEmptyPositions="skipEmptyPositions",e.regionTypes="regionTypes",e.chains="chains",e.fitWidth="fitWidth",e.positionWidth="positionWidth",e.positionHeight="positionHeight",e.filterSource="filterSource"}(Se||(Se={}));const _e=we;class Ee extends a.JsViewer{constructor(){super(),this.viewed=!1,this.regionsFg=null,this.regionsRoot=null,this.isOpened=!1,this.panelNode=null,this.regions=[],this.viewerId=++Ee.viewerCounter,this.setDataInProgress=!1,this.host=null,this.mainLayout=null,this.logos=[],this.viewSubs=[],this.calcSizeRequested=!1,this._onRendered=new u.Subject,this.skipEmptyPositions=this.bool(Se.skipEmptyPositions,_e.skipEmptyPositions,{category:Ae.DATA}),this.regionTypes=this.stringList(Se.regionTypes,_e.regionTypes,{category:Ae.DATA,choices:Object.values(Te).filter((e=>e!=Te.Unknown))}),this.chains=this.stringList(Se.chains,_e.chains,{category:Ae.DATA,choices:["Heavy","Light"]}),this.fitWidth=this.bool(Se.fitWidth,_e.fitWidth,{category:Ae.LAYOUT}),this.positionWidth=this.float(Se.positionWidth,_e.positionWidth,{category:Ae.LAYOUT,editor:"slider",min:0,max:64,description:"Internal WebLogo viewers property width of position."}),this.positionHeight=this.string(Se.positionHeight,_e.positionHeight,{category:Ae.LAYOUT,choices:Object.keys(be.ES)}),this.filterSource=this.string(Se.filterSource,_e.filterSource,{category:Ae.BEHAVIOR,choices:Object.values(be.Ct)}),this.viewSyncer=new Ce.c(rt.logger)}viewerToLog(){return`VdRegionsViewer<${this.viewerId}>`}async init(){this.subs.push((0,u.fromEvent)(this.root,"mousemove").subscribe(this.rootOnMouseMove.bind(this)))}detach(){const e=`${this.viewerToLog()}.detach()`,t=super.detach.bind(this);this.viewSyncer.sync(`${e}`,(async()=>{this.setDataInProgress||(this.viewed&&(await this.destroyView("detach"),this.viewed=!1),t())}))}onTableAttached(){super.onTableAttached(),this.setData(this.regions)}onPropertyChanged(e){if(super.onPropertyChanged(e),e){switch(e.name){case Se.regionTypes:case Se.chains:this.setData(this.regions)}switch(e.name){case Se.skipEmptyPositions:for(let e=0;e<this.logos.length;++e)for(const t of this.chains)this.logos[e][t].setOptions({[ve.bo.skipEmptyPositions]:this.skipEmptyPositions});this.calcSize();break;case Se.fitWidth:case Se.positionWidth:this.calcSize();break;case Se.positionHeight:for(let e=0;e<this.logos.length;++e)for(const t of this.chains)this.logos[e][t].setOptions({[ve.bo.positionHeight]:this.positionHeight});this.calcSize();break;case Se.filterSource:this.filterSourceInput.value=this.filterSource;break;default:this.setData(this.regions)}}else console.warn("Bio: VdRegionsViewer.onPropertyChanged() property is null")}setData(e){const t=`${this.viewerToLog()}.setData()`;rt.logger.debug(`${t}, in, regions.length = ${e.length}`),this.viewSyncer.sync(`${t}`,(async()=>{if(!this.setDataInProgress){this.setDataInProgress=!0;try{this.viewed&&(await this.destroyView("setData"),this.viewed=!1),this.regions=e,this.viewed||(await this.buildView("setData"),this.viewed=!0)}finally{this.setDataInProgress=!1}}}))}async destroyView(e){rt.logger.debug(`Bio: VdRegionsViewer.destroyView( mainLayout = ${this.mainLayout?"value":"none"} ), purpose = '${e}', this.regions.length = ${this.regions.length}`),this.filterSourceInput&&o.empty(this.filterSourceInput.root),null!=this.mainLayout&&(this.mainLayout.remove(),this.host.remove(),this.host=null,this.mainLayout=null);for(const e of this.viewSubs)e.unsubscribe()}async buildView(e){rt.logger.debug(`Bio: VdRegionsViewer.buildView() begin, purpose = '${e}', this.regions.length = ${this.regions.length}`);const t=this.regions.filter((e=>this.regionTypes.includes(e.type))),s=Array.from(new Set(t.map((e=>e.order)))).sort(),n=[];for(let e=0;e<s.length;e++)for(const r of this.chains){const i=t.find((t=>t.order==s[e]&&t.chain==r));n.push((async()=>{const t=await this.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:i.sequenceColumnName,startPositionName:i.positionStartName,endPositionName:i.positionEndName,fixWidth:!0,skipEmptyPositions:this.skipEmptyPositions,positionWidth:this.positionWidth,positionHeight:this.positionHeight,filterSource:this.filterSource});return t.onSizeChanged.subscribe((()=>{this.calcSize()})),[e,r,t]})())}const r=await Promise.all(n);this.logos=new Array(s.length);for(let e=0;e<s.length;++e)this.logos[e]={};for(const[e,t,s]of r)this.logos[e][t]=s,this.viewSubs.push(s.onFreqsCalculated.subscribe((()=>{this.calcSize()})));this.mainLayout=o.table(this.chains,(e=>[...s.length>0?[o.div(e,{style:{transform:"rotate(-90deg)",font:"12px Roboto, Roboto Local, sans-serif",textAlign:"center",width:"16px",marginTop:"24px",marginLeft:"6px"}})]:[],...[...Array(s.length).keys()].map((t=>{const s=this.logos[t][e];return s.root.style.height="100%",o.div([s.root],{style:{marginTop:"4px",marginBottom:"4px"}})}))]),["",...[...Array(s.length).keys()].map((e=>t.find((t=>t.order==s[e]&&t.chain==this.chains[0])).name||"Name"))]),this.mainLayout.className="mlb-vd-regions-viewer-table2",this.filterSourceInput=o.choiceInput("Data source",this.filterSource,Object.values(be.Ct),this.filterSourceInputOnValueChanged.bind(this)),this.filterSourceInput.root.style.position="absolute",this.filterSourceInput.root.style.right="9px",this.filterSourceInput.root.style.top="-4px",Math.ceil(255*Math.random()).toString(16),this.host=o.div([this.mainLayout,this.filterSourceInput.root],{}),this.root.appendChild(this.host),this.root.style.overflowX="auto",this.calcSize(),this.viewSubs.push(o.onSizeChanged(this.root).subscribe(this.rootOnSizeChanged.bind(this))),rt.logger.debug("Bio: VdRegionsViewer.buildView() end")}calcSize(){rt.logger.debug("Bio: VdRegionsViewer.calcSize(), start");const e=()=>{if(!this.host)return;const e=(this.root.clientHeight-54)/this.chains.length;let t=0;for(let s=0;s<this.logos.length;s++){for(const t of this.chains)this.logos[s][t].root.style.height=`${e}px`;t+=Math.max(...this.chains.map((e=>this.logos[s][e].Length)))}if(this.fitWidth){if(this.logos.length>0&&t>0){const e=22,s=13,n=9,r=(this.root.clientWidth-e-(this.logos.length-1)*n-s)/t;for(let e=0;e<this.logos.length;e++)for(const t of this.chains){const s=this.logos[e][t];s.setOptions({[ve.bo.positionWidth]:r-s.positionMarginValue}),s.root.style.width=r*s.Length+"px"}}this.host.style.setProperty("overflow","hidden","important")}else{for(let e=0;e<this.logos.length;e++)for(const t of this.chains)this.logos[e][t].setOptions({[ve.bo.positionWidth]:this.positionWidth});this.host.style.removeProperty("overflow")}0===this.positionWidth?this.host.style.setProperty("overflow-x","hidden","important"):this.host.style.removeProperty("overflow-x")};this.calcSizeRequested||(this.calcSizeRequested=!0,window.setTimeout((()=>{e(),this.calcSizeRequested=!1}),0))}rootOnSizeChanged(e){this.calcSize()}rootOnMouseMove(e){}filterSourceInputOnValueChanged(){const e=`${this.viewerToLog()}.filterSourceInputOnValueChanged()`,t=this.filterSourceInput.value;this.viewSyncer.sync(`${e}`,(async()=>{if(this.filterSource!==t){this.props.getProperty(Se.filterSource).set(this,t);for(let e=0;e<this.logos.length;e++)for(let t=0;t<this.chains.length;t++){const s=this.chains[t];this.logos[e][s].setOptions({[ve.bo.filterSource]:this.filterSource})}}}))}get onRendered(){return this._onRendered}invalidate(e){const t=`${this.viewerToLog()}.invalidate(${e?` <- ${e} `:""})`;this.viewSyncer.sync(`${t}`,(async()=>{this._onRendered.next()}))}async awaitRendered(e=5e3){await(0,ye.zg)(this.onRendered,(()=>{}),(()=>{this.invalidate()}),e);const t=this.viewSyncer.resetErrors();if(t.length>0)throw t[0]}}function Pe(e){const t=o.divH([],{style:{gap:"10px"}}),s=o.divV([o.divText(e.seqCol.name),o.divText(e.activityCol.name)]);return s.style.fontWeight="bold",s.style.display="flex",s.style.justifyContent="space-between",t.append(s),e.points.forEach((s=>{const n=o.divText(e.activityCol.get(s).toFixed(2));n.style.display="flex",n.style.justifyContent="left",n.style.paddingLeft="30px",t.append(o.divV([o.divText(e.seqCol.get(s)),n]))})),t}function $e(e){const t=o.div();t.append(o.divText(e.seqCol.name,{style:{fontWeight:"bold"}}));const s=new Array(2),n=new Array(2);e.points.forEach(((t,r)=>{s[r]=e.seqCol.get(t),n[r]=e.activityCol.get(t)}));const r={},i=j.Cn.getOrCreate(e.seqCol),a=i.getSplitter(),l=function(e,t,s,n){const r=document.createElement("canvas"),i=r.getContext("2d");return r.height=30,pe(i,0,0,0,30,e,t,s,!0,n),r}(a(s[0]),a(s[1]),i.units,r);return t.append(o.div(l,{style:{width:"300px",overflow:"scroll"}})),t.append(function(e){const t=o.div();if(Object.keys(e).length>0){const s=o.divV([]);s.append(o.divH([o.divText("Pos",{style:{fontWeight:"bold",width:"30px",borderBottom:"1px solid"}}),o.divText("Difference",{style:{fontWeight:"bold",borderBottom:"1px solid"}})]));for(const t of Object.keys(e))e[t].style.borderBottom="1px solid lightgray",s.append(o.divH([o.divText((parseInt(t)+1).toString(),{style:{width:"30px",borderBottom:"1px solid lightgray"}}),e[t]]));t.append(s)}return t}(r)),t.append(xe("Activity delta",Math.abs(n[0]-n[1]))),t.append(xe("Cliff",e.sali)),t}function xe(e,t){return o.divH([o.divText(`${e}: `,{style:{fontWeight:"bold",paddingRight:"5px"}}),o.divText(t.toFixed(2))],{style:{paddingTop:"10px"}})}function Ne(e,t){const s=a.Column.string("seq_diff",e.rowCount).init((s=>`${e.get(t[0],s)}#${e.get(t[1],s)}`));s.semType="MacromoleculeDifference",s.setTag(a.TAGS.UNITS,e.col(t[0]).getTag(a.TAGS.UNITS)),s.setTag("separator",e.col(t[0]).getTag("separator")),e.columns.add(s);const n=e.plot.grid();return n.col(t[0]).visible=!1,n.col(t[1]).visible=!1,n}Ee.viewerCounter=-1,s(708),s(6361),s(7983);class Me extends a.JsViewer{constructor(e){super(),this.name="",this.metricsProperties=["distanceMetric","fingerprint"],this.fingerprintChoices=["Morgan","Pattern"],this.initialized=!1,this.tags=[a.TAGS.UNITS,"aligned","separator","alphabet"],this.preComputeDistanceMatrix=!1,this.renderPromise=Promise.resolve(),this.fingerprint=this.string("fingerprint",this.fingerprintChoices[0],{choices:this.fingerprintChoices}),this.limit=this.int("limit",10),this.distanceMetric=this.string("distanceMetric",distance_metrics_methods.kg[0],{choices:distance_metrics_methods.kg}),this.moleculeColumnName=this.string("moleculeColumnName"),this.name=e}init(){this.initialized=!0}detach(){this.subs.forEach((e=>e.unsubscribe()))}async onTableAttached(){if(this.init(),this.dataFrame){this.preComputeDistanceMatrix=this.dataFrame.rowCount<=22e3,this.subs.push(a.debounce(this.dataFrame.onRowsRemoved,50).subscribe((e=>this.render(!0))));const e="diversity"!==this.name;this.subs.push(a.debounce(this.dataFrame.onCurrentRowChanged,50).subscribe((t=>this.render(e)))),this.subs.push(a.debounce(this.dataFrame.selection.onChanged,50).subscribe((e=>this.render(!1)))),this.subs.push(a.debounce(o.onSizeChanged(this.root),50).subscribe((e=>this.render(!1)))),this.moleculeColumn=this.dataFrame.columns.bySemType(a.SEMTYPE.MACROMOLECULE),this.moleculeColumnName=this.moleculeColumn?.name,this.getProperty("limit").fromOptions({min:1,max:this.dataFrame.rowCount})}this.render()}onPropertyChanged(e){if(super.onPropertyChanged(e),this.initialized){if("moleculeColumnName"===e.name){const t=this.dataFrame.col(e.get(this));t.semType===a.SEMTYPE.MACROMOLECULE&&(this.moleculeColumn=t)}this.render()}}render(e=!0){this.renderPromise=this.renderPromise.then((async()=>{this.computeRequested=this.computeRequested||e,await this.renderInt(e)}))}async renderInt(e){}beforeRender(){return!(!this.initialized||this.dataFrame&&this.moleculeColumnName&&this.dataFrame.col(this.moleculeColumnName).semType!==a.SEMTYPE.MACROMOLECULE&&(i.shell.error(`${this.moleculeColumnName} is not Macromolecule type`),1))}}s(7241),s(4004),s(9943),s(5393);var Le=s(7572),Ie=(s(3336),s(8710)),Re={};Re.styleTagTransform=A(),Re.setAttributes=w(),Re.insert=y().bind(null,"head"),Re.domAPI=f(),Re.insertStyleElement=v(),m()(Ie.Z,Re),Ie.Z&&Ie.Z.locals&&Ie.Z.locals,s(6584),s(3776),s(2428);var Oe,ke=function(e,t,s,n){return new(s||(s=Promise))((function(r,i){function o(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}l((n=n.apply(e,t||[])).next())}))};class Fe{constructor(e,t,s=!1,n){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=o.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._steps=[],this._mainHeader=o.panel([],"tutorials-main-header"),this._header=o.h2(""),this._headerDiv=o.divH([],"tutorials-root-header"),this._stopStartBtn=o.button(o.iconFA("pause"),(()=>this._changeStopState()),"Play / pause"),this._restartBtn=o.button(o.iconFA("redo"),(()=>this._restartScript()),"Restart"),this._nextStepBtn=o.button(o.iconFA("play"),(()=>{this._isStepProcessed||this._nextStep()}),"Next step"),this._activity=o.panel([],"tutorials-root-description"),this._progressDiv=o.divV([],"tutorials-root-progress"),this._progress=o.element("progress"),this._progressSteps=o.divText(""),this._closeBtn=o.button(o.iconFA("chevron-left"),(()=>this._closeDock()),"Back to demo"),this.name=e,this.description=t,this._isAutomatic=s,this._autoStartFirstStep=null!==(r=null==n?void 0:n.autoStartFirstStep)&&void 0!==r&&r,this._progress.max=0,this._progress.value=1,Fe.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=o.divText(`Step: ${this._progress.value} of ${this.stepNumber}`),this._progressDiv.append(this._progressSteps)}_addDescription(){var e;this._activity.append(o.div(this.description,"tutorials-root-description"));for(let t=0;t<this.stepNumber;t++){let s=o.iconFA("clock");this._isAutomatic||0===t&&(s=o.iconFA("play",(()=>this._nextStep()),"Next step"),s.className="grok-icon fas fa-play");const n=o.div(this._steps[t].name,"grok-tutorial-entry-instruction"),r=o.div(null===(e=this._steps[t].options)||void 0===e?void 0:e.description,"grok-tutorial-step-description hidden"),i=o.divH([s,n],"grok-tutorial-entry");this._activity.append(i,r)}}_initRoot(){var e,t,s;i.shell.windows.showContextPanel=!0,i.shell.windows.showHelp=!1;const n=Array.from(i.shell.dockManager.rootNode.children)[0];this._node=i.shell.dockManager.dock(this._root,a.DOCK_TYPE.FILL,n,""),(null===(t=null===(e=n.parent.container.containerElement.firstElementChild)||void 0===e?void 0:e.lastElementChild)||void 0===t?void 0:t.classList.contains("tab-handle-list-container"))&&(null===(s=n.parent.container.containerElement.firstElementChild)||void 0===s||s.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 e,t;return ke(this,void 0,void 0,(function*(){this._isStepProcessed=!0,this._isAutomatic||(this._nextStepBtn.classList.add("disabled"),this._nextStepBtn.firstChild.classList.add("fa-disabled"));const s=this._activity.getElementsByClassName("grok-tutorial-entry")[this._currentStep],n=this._activity.getElementsByClassName("grok-icon")[this._currentStep],r=this._activity.getElementsByClassName("grok-tutorial-step-description")[this._currentStep];n.className="grok-icon far fa-spinner-third fa-spin",r.classList.remove("hidden"),r.classList.add("visible");const i=s,a=(null===(e=this._steps[this._currentStep].options)||void 0===e?void 0:e.delay)?null===(t=this._steps[this._currentStep].options)||void 0===t?void 0:t.delay:2e3;yield this._steps[this._currentStep].func(),this._scrollTo(this._root,i.offsetTop-this._mainHeader.offsetHeight),this._isAutomatic&&(yield this._countdown(s,n,a),yield(0,ye.gw)(a));const l=o.iconFA("check");if(n.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 e=this._activity.getElementsByClassName("grok-icon")[this._currentStep],t=o.iconFA("play",(()=>this._nextStep()),"Next step");t.className="grok-icon fas fa-play",e.replaceWith(t),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 ke(this,void 0,void 0,(function*(){for(let e=this._currentStep;e<this.stepNumber&&!this._isStopped&&!this._isCancelled;e++)yield this._nextStep()}))}_scrollTo(e,t){e.focus(),e.scrollTop=t}_countdown(e,t,s){return ke(this,void 0,void 0,(function*(){const n=o.div([],"demo-script-countdown");t.classList.add("hidden");let r=s/1e3;const i=this._createSVGIndicator(r);n.append(i),e.prepend(n);const a=setInterval((()=>{r--,0===r&&(clearInterval(a),n.remove(),t.classList.remove("hidden"),t.classList.add("visible"))}),1e3)}))}_createSVGIndicator(e){const t=document.createElementNS("http://www.w3.org/2000/svg","svg"),s=document.createElementNS("http://www.w3.org/2000/svg","circle");return s.setAttributeNS(null,"cx","7"),s.setAttributeNS(null,"cy","7"),s.setAttributeNS(null,"r","6"),s.setAttributeNS(null,"style",`animation: countdown ${e}s linear infinite forwards`),t.append(s),t}_changeStopState(){const e=this._stopStartBtn.getElementsByClassName("grok-icon");e[0].className="grok-icon fas fa-play",this._isStopped=!this._isStopped,this._isStopped||(e[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=o.div([],{id:"demo-script",classes:"tutorials-root tutorials-track demo-app-script"}),this._mainHeader=o.panel([],"tutorials-main-header"),this._header=o.h2(""),this._headerDiv=o.divH([],"tutorials-root-header"),this._activity=o.panel([],"tutorials-root-description"),this._progressDiv=o.divV([],"tutorials-root-progress"),this._progress=o.element("progress"),this._progressSteps=o.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,Fe.currentObject=null}step(e,t,s){return this._steps[this.steps.length]={name:e,func:t,options:s},this}start(){return ke(this,void 0,void 0,(function*(){this._initRoot(),i.shell.newView(this.name),this._isAutomatic?this._startScript():this._autoStartFirstStep&&(yield this._nextStep())}))}}Fe.currentObject=null,function(e){e.X="Embed_X",e.Y="Embed_Y"}(Oe||(Oe={}));var De=function(e,t,s,n){return new(s||(s=Promise))((function(r,i){function o(e){try{l(n.next(e))}catch(e){i(e)}}function a(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}l((n=n.apply(e,t||[])).next())}))};s(7905),s(8341);var Ge=s(2568);s(525),s(9416),new class{constructor(){this.tooltipHandlerTemp="tooltip-handler.Monomer"}};class He extends a.GridCellRenderer{get name(){return constants.Of.MONOMER}get cellType(){return constants.Of.MONOMER}get defaultHeight(){return 15}get defaultWidth(){return 40}render(e,t,s,n,r,i,o){if(i.gridRow<0)return;MonomerTooltipHandler.getOrCreate(i.gridColumn),e.font="12px monospace",e.textBaseline="middle",e.textAlign="center";const a=(0,ce.py)(i.cell.column.getTag("alphabet")),l=i.cell.value;if(!l)return;const c=a.get(l);e.fillStyle=c,e.fillText((0,ce.GU)(l,6),t+n/2,s+r/2,n)}}class We extends a.Package{constructor(){super(...arguments),this._initialized=!1}get properties(){return this._properties}set properties(e){this._properties=e}get initialized(){return this._initialized}completeInit(){this._initialized=!0}handleErrorUI(e){const[t,s]=(0,X.yf)(e);i.shell.error(t),this.logger.error(t,void 0,s)}}s(8770);class Be extends a.Widget{constructor(e){super(o.divV([])),this.viewed=!1,this.seqCol=e}async init(){const e=j.Cn.getOrCreate(this.seqCol),t=rt.properties.TooltipWebLogo,s=this.seqCol.getTag(be.DX.tooltipWebLogo);!1===t||["false","off","disable","disabled"].includes(s)||(this.wlViewer=await this.seqCol.dataFrame.plot.fromType("WebLogo",{sequenceColumnName:this.seqCol.name,backgroundColor:0,positionHeight:"Entropy",positionWidth:e.getAlphabetIsMultichar()?24:16,fixWidth:!0,fitArea:!1}),this.wlViewer.root.style.height="50px",this.root.appendChild(this.wlViewer.root),this.root.style.width="100%")}detach(){this.wlViewer.detach(),super.detach()}}var Ve=s(922);class Ue{constructor(e,t){this.helmColumn=e,this.df=t,this.helmColumn=e}async convertToSmiles(){const e=await this.getSmilesList(),t=this.df.columns.getUnusedName(`smiles(${this.helmColumn.name})`);return a.Column.fromStrings(t,e.map((e=>null===e?"":e)))}async getSmilesList(){return(await this.convertToMolfileV2KColumn()).toList().map((e=>a.chem.convert(e,a.chem.Notation.MolBlock,a.chem.Notation.Smiles)))}async convertToRdKitBeautifiedMolfileColumn(){const e=await this.getSmilesList(),t=await i.functions.call("Chem:getRdKitModule"),s=e.map((e=>{if(""===e)return null;const s=t.get_mol(e);return s?(s.normalize_depiction(1),s.straighten_depiction(!0),s):null})),n=this.df.columns.getUnusedName(`molfile(${this.helmColumn.name})`);return a.Column.fromStrings(n,s.map((e=>null===e?"":e.get_molblock())))}async convertToMolfileV2KColumn(){const e=(await this.getPolymerGraphColumn()).toList().map(((e,t)=>{const s=this.helmColumn.get(t);if(!s)return"";let n="";try{n=this.getPolymerMolfile(s,e)}catch(e){const[t,s]=(0,X.yf)(e);rt.logger.error(t,void 0,s)}finally{return n}})),t=this.df.columns.getUnusedName(`molfileV2K(${this.helmColumn.name})`);return a.Column.fromList("string",t,e)}async getPolymerGraphColumn(){return await i.functions.call("HELM:getMolfiles",{col:this.helmColumn})}getPolymerMolfile(e,t){const s=new je(t),n=new et(e);return s.monomerSymbols.forEach(((e,t)=>{const r=s.getMonomerShifts(t);n.addMonomer(e,t,r)})),n.compileToMolfile()}}class je{constructor(e){this.molfileHandler=Ve._.getInstance(e)}get monomerSymbols(){return this.molfileHandler.atomTypes}getMonomerShifts(e){return{x:this.molfileHandler.x[e],y:this.molfileHandler.y[e]}}}class Ye{constructor(e,t){this.capGroupElements=[];const s=Le.A.instance.getBioLib().getMonomer(t,e);if(!s)throw new Error(`Monomer ${e} is not found in the library`);this.molfileWrapper=new ze(s.molfile,e),this.capGroupElements=s.rgroups.map((e=>(e.capGroupSMILES||e.capGroupSMILES).replace(/(\[|\]|\*|:|\d)/g,"")))}shiftCoordinates(e){this.molfileWrapper.shiftCoordinates(e)}getAtomLines(){return this.molfileWrapper.getAtomLines()}getBondLines(){return this.molfileWrapper.getBondLines()}removeBondedRGroups(e){this.molfileWrapper.removeRGroups(e)}capTrailingRGroups(){this.molfileWrapper.capRGroups(this.capGroupElements)}replaceRGroupWithAttachmentAtom(e,t){this.molfileWrapper.replaceRGroupWithAttachmentAtom(e,t)}getAttachmentAtomByRGroupId(e){return this.molfileWrapper.getAttachmentAtomByRGroupId(e)}deleteBondLineWithSpecifiedRGroup(e){this.molfileWrapper.deleteBondLineWithSpecifiedRGroup(e)}shiftBonds(e){this.molfileWrapper.shiftBonds(e)}}class Ke{constructor(e,t,s){this.atoms=t,this.bonds=s,this.rGroupBondPositionMap=new Map,this.rGroupIdToAtomicIndexMap=this.getRGroupIdToAtomicIdxMap(e)}getAtomicIdx(e){const t=this.rGroupIdToAtomicIndexMap.get(e);return void 0===t?null:t}removeRGroupsFromAtomBlock(e){e.forEach((e=>{if(void 0===this.rGroupIdToAtomicIndexMap.get(e))throw new Error(`Cannot find atomic index for R group ${e}`)}));const t=Array.from(this.rGroupIdToAtomicIndexMap.entries()).filter((([t,s])=>e.includes(t))).map((([e,t])=>t));this.atoms.deleteAtoms(t)}removeRGroups(e){this.removeRGroupsFromAtomBlock(e),e.forEach((e=>{const t=this.replaceRGroupInBondsByDummy(e);this.rGroupBondPositionMap.set(e,t)}))}replaceRGroupInBondsByDummy(e){const t=this.rGroupIdToAtomicIndexMap.get(e);if(this.rGroupBondPositionMap.has(e))throw new Error(`R group ${e} is already handled`);const s=this.bonds.getPositionsInBonds(t+1);if(0===s.length)throw new Error(`Cannot find position for R group ${e}`);if(s.length>1)throw new Error(`More than one position for R group ${e}`);const n=s[0];return this.bonds.replacePositionsInBondsByDummy([n]),this.bonds.removeAtomIdFromBonds(t+1),this.removeRGroupFromAtomicIdxMap(e,t),n}removeRGroupFromAtomicIdxMap(e,t){this.rGroupIdToAtomicIndexMap.delete(e);for(const[e,s]of this.rGroupIdToAtomicIndexMap)s>t&&this.rGroupIdToAtomicIndexMap.set(e,s-1)}getRGroupIdToAtomicIdxMap(e){const t=new Map;e.filter((e=>e.startsWith("M RGP"))).forEach((e=>{const s=function(e){const t=e.split(/\s+/).filter((e=>e)).slice(3).map((e=>parseInt(e))),s=new Array(t.length/2);for(let e=0;e<t.length;e+=2)s[e/2]=[t[e+1],t[e]-1];return s}(e);for(const[e,n]of s){if(t.has(e))throw new Error(`R group ${e} is already in the map`);t.set(e,n)}}));const s=e.map(((e,t)=>{if(e.startsWith("A "))return t})).filter((e=>void 0!==e)),n=s.map((t=>e[t])),r=s.map((t=>e[t+1]));n.forEach(((e,s)=>{const n=parseInt(e.split(/\s+/)[1])-1,i=parseInt(r[s].substring(1));if(t.has(i))throw new Error(`R group ${i} is already in the map`);t.set(i,n)}));const i=this.atoms.getRGroupAtomicIndices().filter((e=>!Array.from(t.values()).includes(e)));if(0!==i.length)throw new Error(`Unaccounted R group indices: ${i}`);return t}deleteBondLineWithSpecifiedRGroup(e){const t=this.rGroupBondPositionMap.get(e);if(!t)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:s}=t;this.bonds.deleteBondLines([s]),this.rGroupBondPositionMap.delete(e),this.rGroupIdToAtomicIndexMap.delete(e),this.rGroupBondPositionMap.forEach((e=>{e.bondLineIdx>s&&(e.bondLineIdx-=1)}))}replaceRGroupWithAttachmentAtom(e,t){const s=this.rGroupBondPositionMap.get(e);if(!s)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:n,nodeIdx:r}=s;this.bonds.bondedAtoms[n][r]=t}getAttachmentAtomIdByRGroupId(e){const t=this.rGroupBondPositionMap.get(e);if(!t)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:s,nodeIdx:n}=t;return this.bonds.bondedAtoms[s][(n+1)%2]}capRGroups(e){this.rGroupIdToAtomicIndexMap.forEach(((t,s)=>{const n=e[s-1];"H"===n?(this.removeRGroups([s]),this.deleteBondLineWithSpecifiedRGroup(s)):this.atoms.replaceElementSymbol(t,n)}))}}class qe{constructor(e){this.bondedPairs=[],this.rawBondLines=[],this.rawBondLines=e,this.bondedPairs=this.rawBondLines.map((e=>[parseInt(e.substring(0,3)),parseInt(e.substring(3,6))]))}getBondLines(){return this.bondedPairs.map(((e,t)=>{if(e.some((e=>-1===e)))throw new Error(`Bonded pair ${e} contains -1`);return`${e[0].toString().padStart(3," ")}${e[1].toString().padStart(3," ")}${this.rawBondLines[t].substring(6)}`}))}get bondedAtoms(){return this.bondedPairs}deleteBondLines(e){this.rawBondLines=this.rawBondLines.filter(((t,s)=>!e.includes(s))),this.bondedPairs=this.bondedPairs.filter(((t,s)=>!e.includes(s)))}getPositionsInBonds(e){const t=[];return this.bondedPairs.forEach(((s,n)=>{s.forEach(((s,r)=>{s===e&&t.push({bondLineIdx:n,nodeIdx:r})}))})),t}replacePositionsInBondsByDummy(e,t){void 0===t&&(t=-1),e.forEach((e=>{const{bondLineIdx:s,nodeIdx:n}=e;this.bondedPairs[s][n]=t}))}removeAtomIdFromBonds(e){this.bondedPairs=this.bondedPairs.map((t=>t.map((t=>t>e?t-1:t))))}shift(e){this.bondedPairs=this.bondedPairs.map((t=>t.map((t=>t+e))))}}class Ze{constructor(e){this.coordinates=[],this.rawAtomLines=[],this.rawAtomLines=e,this.coordinates=this.rawAtomLines.map((e=>({x:parseFloat(e.substring(0,10)),y:parseFloat(e.substring(10,20))})))}get atomCoordinates(){return this.coordinates}get atomLines(){return this.rawAtomLines.map(((e,t)=>{const s=this.coordinates[t];return`${s.x.toFixed(4).padStart(10," ")}${s.y.toFixed(4).padStart(10," ")}${e.substring(20)}`}))}replaceElementSymbol(e,t){this.rawAtomLines[e]=this.rawAtomLines[e].replace("R#",t)}deleteAtoms(e){this.coordinates=this.coordinates.filter(((t,s)=>!e.includes(s))),this.rawAtomLines=this.rawAtomLines.filter(((t,s)=>!e.includes(s)))}shift(e){this.coordinates=this.coordinates.map((t=>{const s=t.x+e.x,n=t.y+e.y;if(isNaN(s)||isNaN(n))throw new Error(`Cannot shift coordinates by ${e.x}, ${e.y}`);return{x:s,y:n}}))}rotate(e){this.coordinates=this.coordinates.map((t=>{const s=t.x,n=t.y,r=s*Math.cos(e)-n*Math.sin(e),i=s*Math.sin(e)+n*Math.cos(e);if(isNaN(r)||isNaN(i))throw new Error(`Cannot rotate coordinates by ${e}`);return{x:r,y:i}}))}getRGroupAtomicIndices(){return this.rawAtomLines.map(((e,t)=>{if(e.includes("R#"))return t})).filter((e=>void 0!==e))}}class ze{constructor(e,t){this.monomerSymbol=t;const s=e.split("\n"),n=parseInt(s[3].substring(0,3)),r=parseInt(s[3].substring(3,6)),i=s.slice(4,4+n);this.atoms=new Ze(i);const o=s.slice(4+n,4+n+r);this.bonds=new qe(o),this.rGroups=new Ke(s,this.atoms,this.bonds),this.shiftMonomerToDefaultPosition()}deleteBondLineWithSpecifiedRGroup(e){this.rGroups.deleteBondLineWithSpecifiedRGroup(e)}shiftCoordinates(e){this.atoms.shift(e)}rotateCoordinates(e){this.atoms.rotate(e)}getBondLines(){return this.bonds.getBondLines()}getAtomLines(){return this.atoms.atomLines}removeRGroups(e){this.rGroups.removeRGroups(e)}replaceRGroupWithAttachmentAtom(e,t){this.rGroups.replaceRGroupWithAttachmentAtom(e,t)}getAttachmentAtomByRGroupId(e){return this.rGroups.getAttachmentAtomIdByRGroupId(e)}shiftR1GroupToOrigin(){const e=this.rGroups.getAtomicIdx(1);if(null===e)throw new Error(`Cannot find R1 group for monomer ${this.monomerSymbol}`);const{x:t,y:s}=this.atoms.atomCoordinates[e];this.atoms.shift({x:-t,y:-s})}alignR2AlongX(){const e=this.rGroups.getAtomicIdx(2);if(null===e)throw new Error(`Cannot find R2 group for monomer ${this.monomerSymbol}`);const t=this.atoms.atomCoordinates[e],s=t.y/t.x,n=Math.atan(s);if(isNaN(n))throw new Error(`Cannot calculate angle for R2 group for monomer ${this.monomerSymbol}`);this.rotateCoordinates(-n)}shiftMonomerToDefaultPosition(){this.shiftR1GroupToOrigin(),null!==this.rGroups.getAtomicIdx(2)&&this.alignR2AlongX()}shiftBonds(e){this.bonds.shift(e)}capRGroups(e){this.rGroups.capRGroups(e)}}class Xe{constructor(e){this.simplePolymer=e,this.polymerType=this.getPolymerType(),this.idx=this.getIdx();const{monomers:t,monomerTypes:s}=this.getMonomerSymbolsAndTypes();this.monomers=t,this.monomerTypes=s}get id(){return this.polymerType+this.idx.toString()}getPolymerType(){const e=new RegExp("(PEPTIDE|RNA)[0-9]+{"),t=this.simplePolymer.match(e);if(!t)throw new Error(`Unsupported polymer type in ${this.simplePolymer}`);return t[1]}getIdx(){const e=new RegExp(`${this.polymerType}([0-9]+){`),t=this.simplePolymer.match(e);if(!t)throw new Error(`Cannot parse simple polymer id from ${this.simplePolymer}`);return parseInt(t[1])}getMonomerSymbolsAndTypes(){const e=new RegExp(`${this.polymerType}${this.idx}{|}`,"g"),t=this.simplePolymer.replace(e,"").split("."),s=[],n=[];return t.forEach((e=>{const t=e.split(/\(|\)/).map((e=>e.replace(/[\[\]]/g,"")));s.push(...t);const r=t.map(((e,t)=>t%2==0?0:1));n.push(...r)})),{monomers:s,monomerTypes:n}}getBondData(){const e=[],t=this.monomerTypes.map(((e,t)=>{if(0===e)return t})).filter((e=>void 0!==e)),s=this.monomerTypes.map(((e,t)=>{if(1===e)return t})).filter((e=>void 0!==e));for(let s=0;s<t.length-1;s++){const n=t[s],r=t[s+1];e.push([{monomerIdx:n,rGroupId:2},{monomerIdx:r,rGroupId:1}])}for(let t=0;t<s.length;t++){const n=s[t],r=n-1;e.push([{monomerIdx:r,rGroupId:3},{monomerIdx:n,rGroupId:1}])}return e}}class Je{constructor(e){const t=e.split("|");t.forEach((e=>this.validateConnectionItem(e))),this.connectionItems=t}validateConnectionItem(e){const t="(PEPTIDE|RNA)",s=new RegExp(`${t}[0-9]+,${t}[0-9]+,[0-9]+:R[0-9]+-[0-9]+:R[0-9]+`,"g");if(!e.match(s))throw new Error(`Cannot parse connection item from ${e}`)}getConnectionData(){const e=[];return this.connectionItems.forEach((t=>{const s=[],n=t.split(",");n[2].split("-").forEach(((e,t)=>{const r=n[t],i=e.split(":"),o={monomerIdx:parseInt(i[0])-1,rGroupId:parseInt(i[1].slice(1))};s.push({polymerId:r,bond:o})})),e.push(s)})),e}}class Qe{constructor(e){this.helm=e;const t=this.helm.split("$"),s=t[0].split("|");this.simplePolymers=s.map((e=>new Xe(e))),""!==t[1]&&(this.connectionList=new Je(t[1])),this.bondData=this.getBondData()}toString(){return this.helm}getPolymerTypeByMonomerIdx(e){return this.getSimplePolymerByMonomerIdx(e).polymerType}getSimplePolymerByMonomerIdx(e){const t=this.getMonomerIdxShifts(),s=Object.values(t).sort(((e,t)=>e-t)).find((t=>e>=t));if(void 0===s)throw new Error(`Cannot find simple polymer for monomer ${e}`);const n=Object.keys(t).find((e=>t[e]===s));return this.simplePolymers.find((e=>e.id===n))}shiftBondMonomerIds(e,t){t.forEach((t=>{t.forEach((t=>{t.monomerIdx+=e}))}))}getMonomerIdxShifts(){const e={};let t=0;return this.simplePolymers.forEach((s=>{e[s.id]=t,t+=s.monomers.length})),e}getBondData(){const e=this.getMonomerIdxShifts(),t=[];return this.simplePolymers.forEach((s=>{const n=s.getBondData(),r=e[s.id];this.shiftBondMonomerIds(r,n),t.push(...n)})),this.connectionList&&this.connectionList.getConnectionData().forEach((s=>{const n=[];s.forEach((t=>{const s=e[t.polymerId],r=t.bond;r.monomerIdx+=s,n.push(r)})),t.push(n)})),t}}class et{constructor(e){this.monomerWrappers=[],this.helm=new Qe(e),this.bondedRGroupsMap=new Map,this.helm.bondData.forEach((e=>{e.forEach((e=>{const t=e.monomerIdx,s=e.rGroupId;this.bondedRGroupsMap.get(t)||this.bondedRGroupsMap.set(t,[]),this.bondedRGroupsMap.get(t).push(s)}))}))}addMonomer(e,t,s){const n=this.helm.getPolymerTypeByMonomerIdx(t),r=new Ye(e,n);r.shiftCoordinates(s),this.monomerWrappers.push(r)}removeRGroups(){this.monomerWrappers.forEach(((e,t)=>{this.bondedRGroupsMap.has(t)&&e.removeBondedRGroups(this.bondedRGroupsMap.get(t)),e.capTrailingRGroups()}))}getAtomNumberShifts(){const e=[];let t=0;return this.monomerWrappers.forEach((s=>{e.push(t),t+=s.getAtomLines().length})),e}restoreBondsBetweenMonomers(){this.helm.bondData.forEach((e=>{const t=e.map((e=>e.monomerIdx)),s=e.map((e=>e.rGroupId)),n=t.map((e=>this.monomerWrappers[e])),r=n[1].getAttachmentAtomByRGroupId(s[1]);n[0].replaceRGroupWithAttachmentAtom(s[0],r),n[1].deleteBondLineWithSpecifiedRGroup(s[1])}))}compileToMolfile(){const e=[],t=[];this.removeRGroups();const s=this.getAtomNumberShifts();this.monomerWrappers.forEach(((e,t)=>{e.shiftBonds(s[t])})),this.restoreBondsBetweenMonomers(),this.monomerWrappers.forEach((s=>{e.push(...s.getAtomLines()),t.push(...s.getBondLines())}));const n=e.length;if(n>999)throw new Error(`Atom count in polymer ${this.helm.toString()} is ${n} and exceeds 999`);const r=t.length;return["\nDatagrok\n",`${n.toString().padStart(3," ")}${r.toString().padStart(3," ")} 0 0 1 0 0 V2000`,e.join("\n"),t.join("\n"),"M END\n"].join("\n")}}s(1047),a.DataFrame.fromCsv("seq,value\nATCCGTCGT,0.5\nTGTTCGTCA,0.4\nATGGTCGTA,0.7\nATCCGTGCA,0.1"),["1","1A","1C","2","4","4A","4B","5","6"].join(ce.CI);var tt=s(8601),st=s(3277);function nt(e){const t=["Embed_X","Embed_Y"],s=e.columns.names().filter((e=>e.includes(t[0]))).length+1;return t.map((e=>`${e}_${s}`))}const rt=new We;function it(){return Le.A.instance}function ot(){return Le.A.instance.getBioLib()}async function at(e,t,n,r,u,d,m,p){if(!(0,Ge.n)(t,"Activity Cliffs"))return;const f=nt(e),g={units:t.getTag(a.TAGS.UNITS),aligned:t.getTag("aligned"),separator:t.getTag("separator"),alphabet:t.getTag("alphabet")},y=d,b=t,w=async()=>await async function(e,t,n,r,l,u,d,m,p,f,g,y,b,w,C,v){O++;const T=u/100;let A,S=!1;const _=y.inputs,E=await y.apply({[_[0].name]:t,[_[1].name]:d,...p.preprocessingFuncArgs??{}});let P=[];if(m===c){const t=await function(e,t,n,r,i,o,a=10){const l=new Worker(new URL(s.p+s.u(709),s.b));let c;return l.postMessage({data:e,threshold:t,weights:n,aggregationMethod:r,distanceFns:i,distanceFnArgs:o,maxIterations:a}),{promise:new Promise(((e,t)=>{c=e,l.onmessage=t=>{setTimeout((()=>l.terminate()),100),e(t.data.res)},l.onerror=e=>{setTimeout((()=>l.terminate()),100),t(e)}})),terminate:()=>{try{c(null),l.terminate()}catch(e){console.error(e)}}}}([E.entries],u,[1],"MANHATTAN",[d],[E.options??{}],p?.maxIterations??5).promise;e.columns.addNewInt(e.columns.getUnusedName("MCL Cluster")).init((e=>t.clusters[e])),P=[t.embedX,t.embedY]}else P=await R([E.entries],m,[d],[1],"MANHATTAN",{...p,distanceFnArgs:[E.options??{}]});if(P.length!==n.length)throw new Error("Number of axes names should be equal to number of embedding dimensions");for(let t=0;t<P.length;++t)e.columns.addNewFloat(n[t]).init((e=>P[t][e]));const N=await(new $).calc(E.entries,d,T,E.options),L=await async function(e,t){const s=e.distance.map(((s,n)=>{const r=Math.abs(t.get(e.i[n])-t.get(e.j[n]));return 0!=s?r/s:1/0})),n=e.distance.map((e=>1-e)),r=e.i,i=e.j,o=new Set;return e.distance.forEach(((t,s)=>{o.add(e.i[s]),o.add(e.j[s])})),{simVals:n,saliVals:s,n1:r,n2:i,cliffsMolIds:o}}(N,l),I=function(e,t,s,n,r,i){const o=new Array(e).fill(0);for(let e=0;e!=s.length;++e)t[e]!=1/0&&(i.get(s[e])>i.get(n[e])?o[s[e]]+=t[e]:o[n[e]]+=t[e]);return a.Column.fromList("double",`sali_${r[0].substring(r[0].lastIndexOf("_"))}`,o)}(t.length,L.saliVals,L.n1,L.n2,n,l);e.columns.add(I);const U=function(e,t){const s=a.BitSet.create(e.rowCount);for(let n=0;n<e.rowCount;n++)s.set(n,t.has(n));return s}(e,L.cliffsMolIds),j=function(e){const t=e.filter((e=>e!==1/0)),s=t.reduce(((e,t)=>Math.min(e,t)),Number.MAX_VALUE),n=t.reduce(((e,t)=>Math.max(e,t)),s);return{max:n,min:s}}(L.saliVals),Y=.8/(j.max-j.min),K=i.shell.getTableView(e.name),q=K.addViewer(a.VIEWER.SCATTER_PLOT,{xColumnName:n[0],yColumnName:n[1],size:I.name,color:l.name,showXSelector:!1,showYSelector:!1,showSizeSelector:!1,showColorSelector:!1,markerMinSize:5,markerMaxSize:25,title:r}),Z=function(e,t,s,n,r,i,o,l){const c={from:new Uint32Array(t.n1.length),to:new Uint32Array(t.n1.length),opacities:new Float32Array(t.n1.length),colors:new Array(t.n1.length),widths:new Float32Array(t.n1.length)};for(let s=0;s<t.n1.length;s++)c.from[s]=t.n1[s],c.to[s]=t.n2[s],c.opacities[s]=t.saliVals[s]===1/0?1:.2+(t.saliVals[s]-o.min)*l,c.colors[s]=e.selection.get(c.from[s])&&e.selection.get(c.to[s])?"255,255,0":"0,128,0",c.widths[s]=1;const h=a.DataFrame.create(c.from.length);return B.forEach(((e,t)=>{h.columns.addNewString(e).init((e=>s.get(0===t?c.from[e]:c.to[e]))),function(e,t){Object.keys(t).forEach((s=>{e.tags[s]=t[s]}))}(h.col(e),i),h.col(e).semType=r})),h.columns.addNewFloat(D).init((e=>Math.abs(n.get(c.from[e])-n.get(c.to[e])))),h.columns.addNewInt(W).init((e=>e)),h.columns.addNewFloat(G).init((e=>t.saliVals[e])),h.columns.addNewFloat(H).init((e=>t.simVals[e])),h.name=`${k}${O}`,{lines:c,linesDf:h}}(e,L,t,l,f,g,j,Y);Z.lines.skipMultiLineCalculation=!0,Z.linesDf.col(G).setTag("description","Structure−Activity Landscape Index (activity difference divided by 1 minus similarity)");const z=new M(q,n[0],n[1],Z.lines,x.none),X=C?C(Z.linesDf,B).sort([G],[!1]):Z.linesDf.plot.grid().sort([G],[!1]);X.col(W)&&(X.col(W).visible=!1),e.temp[".cliffsDfGrid"]=X;const J=o.button(`${Z.linesDf.rowCount} cliffs`,(()=>{K.dockManager.dock(X,"down",null,"Activity cliffs",v??.2)}));J.classList.add("scatter_plot_link","cliffs_grid"),q.root.append(J);const Q=o.switchInput("Show only cliffs",!1,(()=>{Q.value?(q.dataFrame.setTag(V,n[0]),e.filter.and(U),F.next(n[0])):(q.dataFrame.setTag(V,""),e.filter.setAll(!0),F.next(""))}));Q.root.classList.add("scatter_plot_link","show_only_cliffs"),q.root.append(Q.root),F.subscribe((e=>{Q.enabled=""===e||e===n[0]}));let ee=!1;q.onEvent("d4-before-draw-scene").subscribe((t=>{ee?ee=!1:Q.value&&(setTimeout((()=>{e.filter.and(U)}),100),ee=!0)}));const te=i.events.onViewerClosed.subscribe((e=>{e.args.viewer===q&&(K.dockManager.close(X.root),te.unsubscribe(),K.subs=K.subs.filter((e=>e!==te)))}));return K.subs.push(te),Z.linesDf.onCurrentCellChanged.subscribe((()=>{for(let e=0;e<Z.linesDf.rowCount;e++)Z.lines.widths[e]=e===Z.linesDf.currentRowIdx?3:1;z.linesToRender=Z.lines;const s=Z.linesDf.currentCol&&Z.linesDf.currentCol.name===B[1]?Z.lines.to:Z.lines.from,r=-1!==Z.linesDf.currentRowIdx?Z.linesDf.currentRowIdx:null;if(q.dataFrame.currentRowIdx=r?s[r]:-1,null!==r){const s=Z.linesDf.currentRowIdx;z.currentLineId=s;const{zoomLeft:a,zoomRight:c,zoomTop:h,zoomBottom:u}=function(e,t,s,n,r,i){const o=Math.abs(s-r),a=Math.abs(n-i),l=e/o,c=t/a,h=Math.min(l,c),u=e/h*5,d=t/h*5,m=(s<r?s:r)+o/2-u/2,p=(n>i?n:i)-a/2+d/2;return{zoomLeft:m,zoomRight:m+u,zoomTop:p,zoomBottom:p-d}}(q.viewport.width,q.viewport.height,q.dataFrame.get(n[0],Z.lines.from[s]),q.dataFrame.get(n[1],Z.lines.from[s]),q.dataFrame.get(n[0],Z.lines.to[s]),q.dataFrame.get(n[1],Z.lines.to[s]));q.zoom(a,h,c,u),Q.value?e.filter.and(U):!0===Q.enabled&&e.filter.setAll(!0),setTimeout((()=>{!function(e,t,s,n,r,a,l,c,h){const u=t.getPane("Cliff Details");o.empty(u.root);const d=h({points:[s,n],lineId:r,df:e,seqCol:a,activityCol:l,sali:c});u.root.append(d),setTimeout((()=>{i.shell.o=t.root}),500)}(e,A,Z.lines.from[r],Z.lines.to[r],r,t,l,Z.linesDf.get(G,r),w);const s=q.dataFrame.getSortedOrder(K.grid.sortByColumns,K.grid.sortTypes);K.grid.scrollToCell(t.name,s.indexOf(q.dataFrame.currentRowIdx))}),1e3)}})),Z.linesDf.onSelectionChanged.subscribe((t=>{setTimeout((()=>(()=>{const t=a.BitSet.create(e.rowCount);for(let e=0;e<Z.linesDf.rowCount;e++){const s=Z.linesDf.selection.get(e);s&&(t.set(Z.lines.from[e],!0),t.set(Z.lines.to[e],!0)),Z.lines.colors[e]=s?"255,255,0":"0,128,0"}e.selection.copyFrom(t),z.linesToRender=Z.lines})()),100)})),e.onSelectionChanged.subscribe((t=>{!1===e.selection.anyTrue&&"number"==typeof t&&(S?S=!1:(e=>{e.selection.setAll(!1);for(let e=0;e<Z.lines.colors.length;e++)Z.lines.colors[e]="0,128,0";z.linesToRender=Z.lines})(X.dataFrame))})),z.lineClicked.subscribe((t=>{if(S=!0,z.currentLineId=t.id,-1!==t.id){const s=Z.linesDf.selection.clone();setTimeout((()=>{t.event.ctrlKey?(s.set(t.id,!s.get(t.id)),Z.linesDf.selection.copyFrom(s)):(Z.linesDf.currentRowIdx!==t.id&&(Z.linesDf.currentRowIdx=t.id,e.currentRowIdx=Z.lines.from[t.id]),Z.linesDf.selection.copyFrom(s));const n=Z.linesDf.getSortedOrder(X.sortByColumns,X.sortTypes);X.scrollToCell(B[0],n.indexOf(t.id))}),500)}})),z.lineHover.pipe((0,h.debounceTime)(500)).subscribe((s=>{-1!==s.id&&-1===e.mouseOverRowIdx&&o.tooltip.show(b({lineId:s.id,points:[Z.lines.from[s.id],Z.lines.to[s.id]],df:e,seqCol:t,activityCol:l}),s.x,s.y)})),q.addProperty("similarityLimit","double",T),A=function(){const e=o.accordion(),t=o.element("i");return t.className="grok-icon svg-icon svg-view-layout",e.addTitle(o.span([t,o.label("Activity cliffs")])),e.addPane("Cliff Details",(()=>o.divText("Cliff has not been selected")),!0),i.shell.o=e.root,e}(),q}(e,b,f,"Activity cliffs",n,r,y,u,{...p??{}},a.SEMTYPE.MACROMOLECULE,g,m,Pe,$e,Ne),C=u===l.A.UMAP?2e5:2e4,v=u===l.A.UMAP?5e3:2e3;if(e.rowCount>C)return void i.shell.warning(`Too many rows, maximum for sequence activity cliffs is ${C}`);const T=a.TaskBarProgressIndicator.create("Running sequence activity cliffs ...");return new Promise(((t,s)=>{e.rowCount>v&&!p?.[st.sS]?o.dialog().add(o.divText("Activity cliffs analysis might take several minutes.\n Do you want to continue?")).onOK((async()=>{w().then((e=>t(e))).catch((e=>s(e)))})).onCancel((()=>{t(void 0)})).show():w().then((e=>t(e))).catch((e=>s(e)))})).catch((e=>{const[t,s]=(0,X.yf)(e);throw rt.logger.error(t,void 0,s),e})).finally((()=>{T.close()}))}async function lt(e,t,n,r,l,c,h,u){if((0,Ge.n)(t,"Sequence Space"))return c||(c=a.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0]),h??(h={}),await async function(e,t,n,r,l,c,h,u=!0,d=!1,m={preprocessingFuncArgs:[]},p={}){const f={showXAxis:!1,showYAxis:!1,showXSelector:!1,showYSelector:!1};if(t.length!==r.length||t.length!==c.length||t.length!==l.length||t.length!==m.preprocessingFuncArgs.length)throw new Error("columns, metrics and preprocessing functions, weights and function argumentsmust have the same length");const g=i.shell.tableView(e.name)??i.shell.addTableView(e),y=async()=>{const y=a.TaskBarProgressIndicator.create(`Initializing ${p.scatterPlotName??"dimensionality reduction"} ...`);let b;try{const w=nt(e);function C(t,s,n){let r=null,i=null;e.columns.names().includes(w[0])?(r=e.columns.byName(w[0]),i=e.columns.byName(w[1])):(r=e.columns.add(a.Column.float(w[0],e.rowCount)),i=e.columns.add(a.Column.float(w[1],e.rowCount)),u&&!b&&(b=g.scatterPlot({...f,x:w[0],y:w[1],title:p.scatterPlotName??"Embedding space"}))),p[st.Ec]&&(b?.root&&o.setUpdateIndicator(b.root,!1),r.init((e=>n[0]?n[0][e]:void 0)),i.init((e=>n[1]?n[1][e]:void 0)));const l=t/s*100;y.update(l,`Running ${p.scatterPlotName??"dimensionality reduction"}... ${l.toFixed(0)}%`)}async function v(){e.columns.add(a.Column.float(w[0],e.rowCount)),e.columns.add(a.Column.float(w[1],e.rowCount));let s=null;u&&(b=g.scatterPlot({...f,x:w[0],y:w[1],title:p.scatterPlotName??"Embedding space"}),o.setUpdateIndicator(b.root,!0));const d=i.events.onViewerClosed.subscribe((e=>{const t=e.args.viewer;t?.getOptions()?.look?.title&&b?.getOptions()?.look?.title&&t?.getOptions()?.look?.title===b?.getOptions()?.look?.title&&(i.events.fireCustomEvent(L,{}),d.unsubscribe(),s?.(),y.close())})),v=new Promise((async(e,i)=>{try{s=e;const i=[];for(let e=0;e<c.length;++e){const s=c[e];if(m.distanceFnArgs||(m.distanceFnArgs=[]),s){const n=s.inputs[0].name,o=s.inputs[1].name,{entries:a,options:l}=await s.apply({[n]:t[e],[o]:r[e],...m.preprocessingFuncArgs[e]??{}});i.push({entries:a,options:l}),m.distanceFnArgs.push(l)}else{const s=t[e].toList(),n={};i.push({entries:s,options:n}),m.distanceFnArgs.push(n)}}e(await R(i.map((e=>e.entries)),n,r,l,h,m,p[st.sS]?void 0:C))}catch(e){i(e)}})),T=await v;return y.close(),d.unsubscribe(),T}const T=await v();if(d&&T){const A=a.TaskBarProgressIndicator.create("Clustering embeddings ...");try{const S=await function(e,t,n,r){return De(this,void 0,void 0,(function*(){return new Promise((function(i,o){const a=new Worker(new URL(s.p+s.u(796),s.b));a.postMessage({embedX:e,embedY:t,minPts:r,epsilon:n}),a.onmessage=({data:{error:e,clusters:t}})=>{a.terminate(),e?o(e):i(t)}}))}))}(T[0],T[1],m.dbScanEpsilon??.01,m.dbScanMinPts??4),_=e.columns.getUnusedName("Cluster");e.columns.addNewString(_).init((e=>S[e].toString())),b&&(b.props.colorColumnName=_)}catch(E){i.shell.error("Clustering embeddings failed"),console.error(E)}finally{A.close()}}if(T&&u&&b){o.setUpdateIndicator(b.root,!1);const P=e.columns.byName(w[0]),$=e.columns.byName(w[1]);return P.init((e=>T[0][e])),$.init((e=>T[1][e])),b.helpUrl="/help/compute/sequence-space",b}}catch(x){i.shell.error("Dimensionality reduction failed"),console.error(x),y.close(),b&&o.setUpdateIndicator(b.root,!1)}};return new Promise((async(t,s)=>{try{if(p.fastRowCount&&e.rowCount>p.fastRowCount&&!p[st.sS])o.dialog().add(o.divText("Analysis might take several minutes. Do you want to continue?")).onOK((async()=>{try{const e=await y();t(e)}catch(e){s(e)}})).onCancel((()=>t(void 0))).show();else{const e=await y();t(e)}}catch(e){s(e)}}))}(e,[t],n,[r],[1],[c],"MANHATTAN",l,u??!1,{...h,preprocessingFuncArgs:[h.preprocessingFuncArgs??{}]},{fastRowCount:1e4,scatterPlotName:"Sequence space",bypassLargeDataWarning:h?.[st.sS]})}async function ct(e,t,s){const n=a.TaskBarProgressIndicator.create("Converting to atomic level ...");try{await async function(e,t,s){if(0===a.Func.find({package:"Chem",name:"getRdKitModule"}).length)return void i.shell.warning('Transformation to atomic level requires package "Chem" installed.');if(s){const s=j.Cn.getOrCreate(t);return s.isHelm()||(t=s.convert(ce.r2.HELM)),void async function(e,t){const s=await async function(e,t){const s=new Ue(t,e),n=await s.convertToRdKitBeautifiedMolfileColumn();return n.semType=a.SEMTYPE.MOLECULE,n}(e,t);e.columns.add(s,!0),await i.data.detectSemanticTypes(e)}(e,t)}if(!(0,Ge.n)(t,"To Atomic Level"))return;const n=it().getBioLib(),r=await(0,tt.i0)(e,t,n);null!==r.col&&(e.columns.add(r.col,!0),await i.data.detectSemanticTypes(e)),r.warnings&&r.warnings.length>0&&i.shell.warning(o.list(r.warnings))}(e,t,s)}finally{n.close()}}function ht(e){return new Y.i(e).importFasta()}function ut(e){const t=j.Cn.getOrCreate(e).stats;return Object.keys(t.freq)}async function dt(e,t,s){return z(e,t,s,U.IDENTITY)}async function mt(e,t,s){return z(e,t,s,U.SIMILARITY)}},7983:(e,t,s)=>{"use strict";s.d(t,{QF:()=>c,pf:()=>l});var n=s(4469),r=(s(3870),s(976)),i=s(7241),o=(s(4293),s(8467)),a=s(8447);function l(e,t,s){const n=s?function(e,t){const s=`${t}`.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),n=e.charAt(0)===t,r=e.charAt(e.length-1)===t,i=e.replace(new RegExp(`^${s}|${s}$`,"g"),"");return n?r?`${s}${i}${s}`:`${s}${i}${s}|${s}${i}$`:r?`^${i}${s}|${s}${i}${s}`:`^${i}${s}|${s}${i}${s}|${s}${i}$`}(e,s):e,i=r.BitSet.create(t.length);for(let s=0;s<t.length;s++){const r=t.get(s);(r.match(n)||r===e)&&i.set(s,!0,!1)}return i}async function c(e,t){t.version!==t.temp["last-invalidated-version"]&&await async function(e,t){const s=r.TaskBarProgressIndicator.create(`Invalidating molfiles for ${e.name}`);try{await(0,o.gw)(10);const t=new Map,s=await(0,i.D)(e,!0,t);e.temp["monomeric-mols"]=s,e.temp["monomers-dict"]=t,e.temp["last-invalidated-version"]=e.version}finally{s.close()}}(t);const s=r.Column.string("helm",1).init((t=>e));s.semType=r.SEMTYPE.MACROMOLECULE,s.setTag(r.TAGS.UNITS,a.r2.HELM);const l=await(0,i.D)(s,!0,t.temp["monomers-dict"]);return(await n.functions.call("Chem:searchSubstructure",{molStringsColumn:t.temp["monomeric-mols"],molString:l.get(0),molBlockFailover:""})).get(0)}},2568:(e,t,s)=>{"use strict";s.d(t,{l:()=>a,n:()=>o});var n=s(4469),r=s(976),i=s(499);function o(e,t,s=[],r=[],i=!0){const[o,l]=a(e,t,s,r);return i&&!o&&n.shell.warning(l),o}function a(e,t,s=[],o=[]){let a=!0,l="";const c=i.Cn.getOrCreate(e);if(e.semType!==r.SEMTYPE.MACROMOLECULE)n.shell.warning(t+" analysis is allowed for Macromolecules semantic type"),a=!1;else{const e=c.notation;if(s.length>0&&!s.some((t=>e.toUpperCase()==t.toUpperCase())))l=`${t} + ' analysis is allowed for Macromolecules with notation ${0==s.length?"any notation":`notation${s.length>1?"s":""} ${s.map((e=>`"${e}"`)).join(", ")} `}.`,a=!1;else if(!c.isHelm()){const e=c.alphabet;o.length>0&&!o.some((t=>e.toUpperCase()==t.toUpperCase()))&&(l=`${t} + ' analysis is allowed for Macromolecules with alphabet ${0==o.length?"any alphabet":`alphabet${o.length>1?"s":""} ${o.map((e=>`"${e}"`)).join(", ")}.`}.`,a=!1)}}return[a,l]}},3553:(e,t,s)=>{"use strict";s.d(t,{Of:()=>i,WY:()=>h,jB:()=>u,mU:()=>a,rs:()=>c});var n,r,i,o=s(8341);!function(e){e.SPLIT_COL="~split",e.ACTIVITY="~activity",e.ACTIVITY_SCALED="activity_scaled",e.ALIGNED_SEQUENCE="~aligned_sequence",e.AMINO_ACID_RESIDUE="AAR",e.POSITION="Pos",e.P_VALUE="pValue",e.MEAN_DIFFERENCE="Mean difference"}(n||(n={})),function(e){e.AAR="AAR",e.POSITION="Pos",e.SELECTION="selection"}(r||(r={})),function(e){e.MONOMER="Monomer",e.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference",e.ACTIVITY="activity",e.ACTIVITY_SCALED="activityScaled"}(i||(i={}));const a="MSA";var l,c;!function(e){e.CELL_CHANGING="isCellChanging"}(l||(l={})),function(e){e.SEPARATOR="."}(c||(c={}));const h="3.3.1",u={pepsea:{gapOpen:1.53,gapExtend:0,method:o.Jy[0]},kalign:{gapOpen:-1,gapExtend:-1,terminalGap:-1}}},4004:(e,t,s)=>{"use strict";s.d(t,{o:()=>i}),s(976),s(3870);var n=s(4469),r=(s(3336),s(8447),s(499));async function i(e,t,s){const i=r.Cn.getOrCreate(e).convert(t,s);e.dataFrame.columns.add(i);const o=await n.functions.call("Bio:detectMacromolecule",{col:i});return o&&(i.semType=o),await n.data.detectSemanticTypes(e.dataFrame),i}},7572:(e,t,s)=>{"use strict";s.d(t,{A:()=>h});var n=s(4469),r=s(6584),i=s(2832),o=s(3776),a=s(2428),l=s(3348);async function c(){const e=a.A.getInstance();return(await o.t.getInstance(e)).getValidLibraryPaths()}class h{constructor(){this._monomerLib=new i.B({}),this.loadLibrariesPromise=Promise.resolve()}getBioLib(){return this._monomerLib}async loadLibraries(e=!1){return this.loadLibrariesPromise=this.loadLibrariesPromise.then((async()=>{try{const[t,s]=await Promise.all([c(),(0,r.nW)()]),n=t.filter((e=>{const t=!s.exclude.includes(e),n=0===s.explicit.length||s.explicit.includes(e);return t&&n})),o=await Promise.all(n.map((e=>this.readLibrary(r.BX,e).catch((t=>{const s=`Loading monomers from '${e}' error: ${t instanceof Error?t.message:t.toString()}`;return new i.B({},s)})))));this._monomerLib.updateLibs(o,e)}catch(e){const t=`Loading monomer libraries error: ${e instanceof Error?e.message:e.toString()}`;n.shell.warning(t);const s=e instanceof Error?e.stack:void 0;l._package.logger.error(t,void 0,s)}}))}async readLibrary(e,t){const s=a.A.getInstance(),n=await o.t.getInstance(s);return await n.loadLibraryFromFile(e,t)}async selectSpecifiedLibraries(e){const t=await this.getInvalidFileNames(e);if(t.length>0)throw new Error(`Cannot select libraries ${t}: no such library in the list`);const s=await(0,r.nW)();s.exclude=(await c()).filter((t=>!e.includes(t))),await(0,r.tW)(s)}async getInvalidFileNames(e){const t=await c();return e.filter((e=>!t.includes(e)))}static get instance(){return window.$monomerLibHelper||(window.$monomerLibHelper=new h),window.$monomerLibHelper}}},2428:(e,t,s)=>{"use strict";s.d(t,{A:()=>i});var n=s(701),r=s(442);class i{constructor(){this._libraryFilesUpdateSubject$=new n.BehaviorSubject([]),this._addLibraryFilesSubject$=new n.Subject,this._librarySelectionSubject$=new n.Subject}static getInstance(){return i._instance||(i._instance=new i),i._instance}getValidFilesPathList(){return this._libraryFilesUpdateSubject$.getValue()}async getValidLibraryPathsAsynchronously(){return new Promise((e=>{this._libraryFilesUpdateSubject$.pipe((0,r.skip)(1)).subscribe((t=>{e(t)}))}))}changeValidFilesPathList(e){this._libraryFilesUpdateSubject$.next(e)}get updateUIControlsRequested$(){return this._libraryFilesUpdateSubject$.pipe()}get updateValidLibraryFileListRequested$(){return this._libraryFilesUpdateSubject$.pipe()}get addLibraryFileRequested$(){return this._addLibraryFilesSubject$.pipe()}addLibraryFile(){this._addLibraryFilesSubject$.next()}get librarySelectionRequested$(){return this._librarySelectionSubject$}updateLibrarySelectionStatus(e,t){this._librarySelectionSubject$.next([e,t])}}},3776:(e,t,s)=>{"use strict";s.d(t,{t:()=>m});var n=s(4469),r=s(976),i=s(6584),o=s(2832),a=s(5128),l=s.n(a),c=s(3351),h=s.n(c);class u{constructor(e){this.helmMonomerSchema=e;const t=new(l())({allErrors:!0,strictTuples:!1});h()(t),this.validateMonomerSchema=t.compile(this.helmMonomerSchema)}validateFile(e,t){const s=this.parseJson(e);return null!==s&&(Array.isArray(s)?this.validateJsonContent(s,t):(console.warn("Bio: Monomer Library File Validator: Invalid JSON format: The file must contain an array of monomers."),!1))}parseJson(e){try{return JSON.parse(e)}catch(e){return console.error("Bio: Monomer Library File Validator: Invalid JSON format:",e),null}}validateJsonContent(e,t){let s=!0;for(const n of e)if(s=this.validateMonomerSchema(n),!s){console.warn(`Bio: Monomer Library File Validator:\nfile ${t}\n monomer violating JSON schema:`,n,"\nError reason: ",this.validateMonomerSchema.errors,`\nThere may be other errors in ${t} since the validation is stopped after the first error.`," Please, verify that the monomer library file satisfies the JSON schema");break}return s}}var d=s(7572);class m{constructor(e,t){this.libraryFileValidator=e,this.libraryEventManager=t,this.libraryEventManager.updateValidLibraryFileListRequested$.subscribe((async()=>{await this.updateValidLibraryList()}))}static async getInstance(e){return m.instancePromise||(m.instancePromise=(async()=>{const t=await n.dapi.files.readAsText("System:AppData/Bio/tests/libraries/HELMmonomerSchema.json"),s=JSON.parse(t),r=new u(s);return new m(r,e)})()),m.instancePromise}async addLibraryFile(e,t){try{if(await this.libraryFileExists(t))return void n.shell.error(`File ${t} already exists`);await this.validateAgainstHELM(e,t),await n.dapi.files.writeAsText(i.BX+`${t}`,e),await this.updateValidLibraryList(),await n.dapi.files.exists(i.BX+`${t}`)?n.shell.info(`Added ${t} HELM library`):n.shell.error(`Failed to add ${t} library`)}catch(e){console.error(e),n.shell.error(`Failed to add ${t} library`)}}async deleteLibraryFile(e){try{await n.dapi.files.delete(i.BX+`${e}`),await this.updateValidLibraryList(),n.shell.info(`Deleted ${e} library`)}catch(t){console.error(t),await n.dapi.files.exists(i.BX+`${e}`)?n.shell.error(`Failed to delete ${e} library`):n.shell.warning(`File ${e} already deleted, refresh the list`)}}async loadLibraryFromFile(e,t){let s=[];const n=new r.FileSource(e),i=await n.readAsText(t);s=JSON.parse(i);const a={},l=[];return s.forEach((e=>{l.includes(e.polymerType)||(a[e.polymerType]={},l.push(e.polymerType)),a[e.polymerType][e.symbol]=e})),new o.B(a)}getValidLibraryPaths(){return this.libraryEventManager.getValidFilesPathList()}async getValidLibraryPathsAsynchronously(){return await this.libraryEventManager.getValidLibraryPathsAsynchronously()}async libraryFileExists(e){return await n.dapi.files.exists(i.BX+`${e}`)}async updateValidLibraryList(){const e=[],t=await this.getFilePathsAtDefaultLocation();if(!this.fileListHasChanged(t))return;for(const s of t){if(!s.endsWith(".json")){e.push(s);continue}const t=await n.dapi.files.readAsText(i.BX+`${s}`);this.isValidHELMLibrary(t,s)||e.push(s)}const s=t.filter((t=>!e.includes(t)));if(this.fileListHasChanged(s)&&(this.libraryEventManager.changeValidFilesPathList(s),d.A.instance.loadLibraries(!0)),s.some((e=>!e.endsWith(".json")))&&console.warn(`Wrong validation: ${s}`),e.length>0){const t=`Invalid monomer library files in ${i.BX}, consider fixing or removing them: ${e.join(", ")}`;console.warn(t)}}fileListHasChanged(e){const t=this.libraryEventManager.getValidFilesPathList();return e.length!==t.length||e.some(((e,s)=>e!==t[s]))}async validateAgainstHELM(e,t){if(!this.isValidHELMLibrary(e,t))throw new Error(`File ${t} does not satisfy HELM standard`)}isValidHELMLibrary(e,t){return this.libraryFileValidator.validateFile(e,t)}async getFilePathsAtDefaultLocation(){const e=(await n.dapi.files.list(i.BX)).map((e=>e.fullPath)),t=[];for(const s of e)await n.dapi.files.exists(s)&&t.push(s);return t.map((e=>e.substring(i.BX.length)))}}},2832:(e,t,s)=>{"use strict";s.d(t,{B:()=>i});var n=s(701),r=s(922);class i{constructor(e,t){this._monomers={},this._onChanged=new n.Subject,this._monomers=e,this.error=t}getMonomer(e,t){return e in this._monomers&&t in this._monomers[e]?this._monomers[e][t]:null}getPolymerTypes(){return Object.keys(this._monomers)}getMonomerMolsByPolymerType(e){const t={};return Object.keys(this._monomers[e]??{}).forEach((s=>{t[s]=this._monomers[e][s].molfile})),t}getMonomerSymbolsByType(e){return Object.keys(this._monomers[e])}getMonomerSymbolsByRGroup(e,t,s){let n=this.getMonomerSymbolsByType(t).map((e=>this.getMonomer(t,e)));return n=n.filter((e=>null!==e)),0===n.length?[]:(n=n.filter((t=>{if(!t?.rgroups)return!1;let s=t?.rgroups.length>=e;return r._.getInstance(t.molfile).atomTypes.map(((e,t)=>"R#"===e?t:-1)).filter((e=>-1!==e)),s&&(s=!0),s})),n.map((e=>e?.symbol)))}get onChanged(){return this._onChanged}_updateInt(e){const t=e.getPolymerTypes(),s=this.getPolymerTypes();t.forEach((t=>{s.includes(t)||(this._monomers[t]={}),e.getMonomerSymbolsByType(t).forEach((s=>{this._monomers[t][s]=e.getMonomer(t,s)}))}))}update(e){this._updateInt(e),this._onChanged.next()}updateLibs(e,t=!1){t&&(this._monomers={});for(const t of e)t.error||this._updateInt(t);this._onChanged.next()}clear(){this._monomers={},this._onChanged.next()}}},525:(e,t,s)=>{"use strict";s.d(t,{K:()=>$});var n=s(4469),r=s(976),i=s(3870),o=s(8447),a=s(499),l=s(6098),c=s(8341),h=s(2568),u=s(3553),d=s(3348),m=s(3379),p=s.n(m),f=s(7795),g=s.n(f),y=s(569),b=s.n(y),w=s(3565),C=s.n(w),v=s(9216),T=s.n(v),A=s(4589),S=s.n(A),_=s(9564),E={};E.styleTagTransform=S(),E.setAttributes=C(),E.insert=b().bind(null,"head"),E.domAPI=g(),E.insertStyleElement=T(),p()(_.Z,E),_.Z&&_.Z.locals&&_.Z.locals;class P extends Error{constructor(e,t){super(e,t)}}async function $(e={}){return new Promise((async(t,s)=>{var o,a,l;e.clustersCol??(e.clustersCol=null),e.pepsea??(e.pepsea={}),(o=e.pepsea).method??(o.method=u.jB.pepsea.method),(a=e.pepsea).gapOpen??(a.gapOpen=u.jB.pepsea.gapOpen),(l=e.pepsea).gapExtend??(l.gapExtend=u.jB.pepsea.gapExtend);const h=e.col?.dataFrame??n.shell.t,d=e.col??h.columns.bySemType(r.SEMTYPE.MACROMOLECULE);if(null==d){const e="MSAError: dataset doesn't conain any Macromolecule column";n.shell.warning(e),s(new P(e))}const m=i.choiceInput("Method",e.pepsea.method,c.Jy);m.setTooltip("Alignment method");const p=i.floatInput("Terminal gap",e?.kalign?.terminalGap??null);p.setTooltip("Penalty for opening a gap at the beginning or end of the sequence");const f=i.p(`Kalign version: ${u.WY}`,"kalign-version"),g=i.floatInput("Gap open",e.pepsea.gapOpen);g.setTooltip("Gap opening penalty at group-to-group alignment");const y=i.floatInput("Gap extend",e.pepsea.gapExtend);y.setTooltip("Gap extension penalty to skip the alignment");const b=i.inputs([g,y,p]),w=i.button("Alignment parameters",(()=>{b.hidden=!b.hidden}),"Adjust alignment parameters such as penalties for opening and extending gaps");w.classList.add("msa-params-button"),b.hidden=!0,w.prepend(i.icons.settings((()=>null)));const C=[m.root.style],v=[p.root.style,f.style];let T;const A=i.columnInput("Sequence",h,d,(async()=>{T=await N(A.value,h,C,v,m,S,g,y,p)}),{filter:e=>e.semType===r.SEMTYPE.MACROMOLECULE});A.setTooltip("Sequences column to use for alignment");const S=i.columnInput("Clusters",h,e.clustersCol);if(S.nullable=!0,A.fireChanged(),e.col)return T=await N(e.col,h,C,v,m,S,g,y,p),void await x(A,h,T,t,s);i.dialog("MSA").add(A).add(S).add(m).add(b).add(w).add(f).onOK((async()=>{await x(A,h,T,t,s)})).show()}))}async function x(e,t,s,i,o){let a=null;const l=r.TaskBarProgressIndicator.create("Analyze for MSA ...");try{if(e.fireChanged(),e.value.semType!==r.SEMTYPE.MACROMOLECULE)throw new Error("Chosen column has to be of Macromolecule semantic type");if(void 0===s)throw new Error("Invalid column format");if(a=await s(),null==a)return o("PepSeA container has not started");t.columns.add(a),await n.data.detectSemanticTypes(t),i(a)}catch(e){const t=e instanceof Error?e.message:e.toString();n.shell.error(t),o(e)}finally{l.close()}}async function N(e,t,s,i,m,p,f,g,y){try{if(e.semType!==r.SEMTYPE.MACROMOLECULE)return;const n=t.columns.getUnusedName(`msa(${e.name})`);if((0,h.n)(e,e.name,[o.r2.FASTA,o.r2.SEPARATOR],["DNA","RNA","PT"],!1)){M(s,i,"kalign"),f.value=null,g.value=null,y.value=null;const t=a.Cn.getOrCreate(e),r=t.isFasta()?e:t.convert(o.r2.FASTA);return async()=>await(0,l.U)(r,!1,n,p.value)}if((0,h.n)(e,e.name,[o.r2.HELM],[],!1))return M(s,i,"pepsea"),f.value??(f.value=u.jB.pepsea.gapOpen),g.value??(g.value=u.jB.pepsea.gapExtend),async()=>await(0,c.f3)(e,n,m.value,f.value,g.value,p.value);if((0,h.n)(e,e.name,[o.r2.SEPARATOR],["UN"],!1)){const t=a.Cn.getOrCreate(e).convert(o.r2.HELM);return M(s,i,"pepsea"),f.value??(f.value=u.jB.pepsea.gapOpen),g.value??(g.value=u.jB.pepsea.gapExtend),async()=>await(0,c.f3)(t,n,m.value,f.value,g.value,p.value)}return f.value=null,g.value=null,y.value=null,void M(s,i,"kalign")}catch(e){const t=e instanceof Error?e.message:e.toString();n.shell.error(t),d._package.logger.error(t)}}function M(e,t,s){if("kalign"===s){for(const t of e)t.display="none";for(const e of t)e.removeProperty("display")}else{for(const e of t)e.display="none";for(const t of e)t.removeProperty("display")}}},6098:(e,t,s)=>{"use strict";s.d(t,{U:()=>R});var n=s(976),r=s(5226);const i=Symbol("Comlink.proxy"),o=Symbol("Comlink.endpoint"),a=Symbol("Comlink.releaseProxy"),l=Symbol("Comlink.thrown"),c=e=>"object"==typeof e&&null!==e||"function"==typeof e,h=new Map([["proxy",{canHandle:e=>c(e)&&e[i],serialize(e){const{port1:t,port2:s}=new MessageChannel;return u(e,t),[s,[s]]},deserialize:e=>(e.start(),m(e))}],["throw",{canHandle:e=>c(e)&&l in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}}]]);function u(e,t=self){t.addEventListener("message",(function s(n){if(!n||!n.data)return;const{id:r,type:o,path:a}=Object.assign({path:[]},n.data),c=(n.data.argumentList||[]).map(C);let h;try{const t=a.slice(0,-1).reduce(((e,t)=>e[t]),e),s=a.reduce(((e,t)=>e[t]),e);switch(o){case"GET":h=s;break;case"SET":t[a.slice(-1)[0]]=C(n.data.value),h=!0;break;case"APPLY":h=s.apply(t,c);break;case"CONSTRUCT":h=function(e){return Object.assign(e,{[i]:!0})}(new s(...c));break;case"ENDPOINT":{const{port1:t,port2:s}=new MessageChannel;u(e,s),h=function(e,t){return b.set(e,t),e}(t,[t])}break;case"RELEASE":h=void 0;break;default:return}}catch(e){h={value:e,[l]:0}}Promise.resolve(h).catch((e=>({value:e,[l]:0}))).then((e=>{const[n,i]=w(e);t.postMessage(Object.assign(Object.assign({},n),{id:r}),i),"RELEASE"===o&&(t.removeEventListener("message",s),d(t))}))})),t.start&&t.start()}function d(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function m(e,t){return f(e,[],t)}function p(e){if(e)throw new Error("Proxy has been released and is not useable")}function f(e,t=[],s=function(){}){let n=!1;const r=new Proxy(s,{get(s,i){if(p(n),i===a)return()=>v(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{d(e),n=!0}));if("then"===i){if(0===t.length)return{then:()=>r};const s=v(e,{type:"GET",path:t.map((e=>e.toString()))}).then(C);return s.then.bind(s)}return f(e,[...t,i])},set(s,r,i){p(n);const[o,a]=w(i);return v(e,{type:"SET",path:[...t,r].map((e=>e.toString())),value:o},a).then(C)},apply(s,r,i){p(n);const a=t[t.length-1];if(a===o)return v(e,{type:"ENDPOINT"}).then(C);if("bind"===a)return f(e,t.slice(0,-1));const[l,c]=y(i);return v(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:l},c).then(C)},construct(s,r){p(n);const[i,o]=y(r);return v(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:i},o).then(C)}});return r}function g(e){return Array.prototype.concat.apply([],e)}function y(e){const t=e.map(w);return[t.map((e=>e[0])),g(t.map((e=>e[1])))]}const b=new WeakMap;function w(e){for(const[t,s]of h)if(s.canHandle(e)){const[n,r]=s.serialize(e);return[{type:"HANDLER",name:t,value:n},r]}return[{type:"RAW",value:e},b.get(e)||[]]}function C(e){switch(e.type){case"HANDLER":return h.get(e.name).deserialize(e.value);case"RAW":return e.value}}function v(e,t,s){return new Promise((n=>{const r=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(s){!s.data||!s.data.id||s.data.id!==r||(e.removeEventListener("message",t),n(s.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:r},t),s)}))}const T="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0ICQ9U3ltYm9sKCJDb21saW5rLnByb3h5IiksQT1TeW1ib2woIkNvbWxpbmsuZW5kcG9pbnQiKSxSPVN5bWJvbCgiQ29tbGluay5yZWxlYXNlUHJveHkiKSx5PVN5bWJvbCgiQ29tbGluay50aHJvd24iKSxfPWU9PnR5cGVvZiBlPT0ib2JqZWN0IiYmZSE9PW51bGx8fHR5cGVvZiBlPT0iZnVuY3Rpb24iLEw9e2NhbkhhbmRsZTplPT5fKGUpJiZlWyRdLHNlcmlhbGl6ZShlKXtjb25zdHtwb3J0MTpyLHBvcnQyOml9PW5ldyBNZXNzYWdlQ2hhbm5lbDtyZXR1cm4gdyhlLHIpLFtpLFtpXV19LGRlc2VyaWFsaXplKGUpe3JldHVybiBlLnN0YXJ0KCksQyhlKX19LE89e2NhbkhhbmRsZTplPT5fKGUpJiZ5IGluIGUsc2VyaWFsaXplKHt2YWx1ZTplfSl7bGV0IHI7cmV0dXJuIGUgaW5zdGFuY2VvZiBFcnJvcj9yPXtpc0Vycm9yOiEwLHZhbHVlOnttZXNzYWdlOmUubWVzc2FnZSxuYW1lOmUubmFtZSxzdGFjazplLnN0YWNrfX06cj17aXNFcnJvcjohMSx2YWx1ZTplfSxbcixbXV19LGRlc2VyaWFsaXplKGUpe3Rocm93IGUuaXNFcnJvcj9PYmplY3QuYXNzaWduKG5ldyBFcnJvcihlLnZhbHVlLm1lc3NhZ2UpLGUudmFsdWUpOmUudmFsdWV9fSxFPW5ldyBNYXAoW1sicHJveHkiLExdLFsidGhyb3ciLE9dXSk7ZnVuY3Rpb24gdyhlLHI9c2VsZil7ci5hZGRFdmVudExpc3RlbmVyKCJtZXNzYWdlIixmdW5jdGlvbiBpKHMpe2lmKCFzfHwhcy5kYXRhKXJldHVybjtjb25zdHtpZDpvLHR5cGU6YSxwYXRoOm59PU9iamVjdC5hc3NpZ24oe3BhdGg6W119LHMuZGF0YSksdT0ocy5kYXRhLmFyZ3VtZW50TGlzdHx8W10pLm1hcChtKTtsZXQgbDt0cnl7Y29uc3QgYz1uLnNsaWNlKDAsLTEpLnJlZHVjZSgoZCxoKT0+ZFtoXSxlKSxmPW4ucmVkdWNlKChkLGgpPT5kW2hdLGUpO3N3aXRjaChhKXtjYXNlIkdFVCI6bD1mO2JyZWFrO2Nhc2UiU0VUIjpjW24uc2xpY2UoLTEpWzBdXT1tKHMuZGF0YS52YWx1ZSksbD0hMDticmVhaztjYXNlIkFQUExZIjpsPWYuYXBwbHkoYyx1KTticmVhaztjYXNlIkNPTlNUUlVDVCI6e2NvbnN0IGQ9bmV3IGYoLi4udSk7bD16KGQpfWJyZWFrO2Nhc2UiRU5EUE9JTlQiOntjb25zdHtwb3J0MTpkLHBvcnQyOmh9PW5ldyBNZXNzYWdlQ2hhbm5lbDt3KGUsaCksbD1OKGQsW2RdKX1icmVhaztjYXNlIlJFTEVBU0UiOmw9dm9pZCAwO2JyZWFrO2RlZmF1bHQ6cmV0dXJufX1jYXRjaChjKXtsPXt2YWx1ZTpjLFt5XTowfX1Qcm9taXNlLnJlc29sdmUobCkuY2F0Y2goYz0+KHt2YWx1ZTpjLFt5XTowfSkpLnRoZW4oYz0+e2NvbnN0W2YsZF09UyhjKTtyLnBvc3RNZXNzYWdlKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxmKSx7aWQ6b30pLGQpLGE9PT0iUkVMRUFTRSImJihyLnJlbW92ZUV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLGkpLEYocikpfSl9KSxyLnN0YXJ0JiZyLnN0YXJ0KCl9ZnVuY3Rpb24gVChlKXtyZXR1cm4gZS5jb25zdHJ1Y3Rvci5uYW1lPT09Ik1lc3NhZ2VQb3J0In1mdW5jdGlvbiBGKGUpe1QoZSkmJmUuY2xvc2UoKX1mdW5jdGlvbiBDKGUscil7cmV0dXJuIGIoZSxbXSxyKX1mdW5jdGlvbiBwKGUpe2lmKGUpdGhyb3cgbmV3IEVycm9yKCJQcm94eSBoYXMgYmVlbiByZWxlYXNlZCBhbmQgaXMgbm90IHVzZWFibGUiKX1mdW5jdGlvbiBiKGUscj1bXSxpPWZ1bmN0aW9uKCl7fSl7bGV0IHM9ITE7Y29uc3Qgbz1uZXcgUHJveHkoaSx7Z2V0KGEsbil7aWYocChzKSxuPT09UilyZXR1cm4oKT0+ZyhlLHt0eXBlOiJSRUxFQVNFIixwYXRoOnIubWFwKHU9PnUudG9TdHJpbmcoKSl9KS50aGVuKCgpPT57RihlKSxzPSEwfSk7aWYobj09PSJ0aGVuIil7aWYoci5sZW5ndGg9PT0wKXJldHVybnt0aGVuOigpPT5vfTtjb25zdCB1PWcoZSx7dHlwZToiR0VUIixwYXRoOnIubWFwKGw9PmwudG9TdHJpbmcoKSl9KS50aGVuKG0pO3JldHVybiB1LnRoZW4uYmluZCh1KX1yZXR1cm4gYihlLFsuLi5yLG5dKX0sc2V0KGEsbix1KXtwKHMpO2NvbnN0W2wsY109Uyh1KTtyZXR1cm4gZyhlLHt0eXBlOiJTRVQiLHBhdGg6Wy4uLnIsbl0ubWFwKGY9PmYudG9TdHJpbmcoKSksdmFsdWU6bH0sYykudGhlbihtKX0sYXBwbHkoYSxuLHUpe3Aocyk7Y29uc3QgbD1yW3IubGVuZ3RoLTFdO2lmKGw9PT1BKXJldHVybiBnKGUse3R5cGU6IkVORFBPSU5UIn0pLnRoZW4obSk7aWYobD09PSJiaW5kIilyZXR1cm4gYihlLHIuc2xpY2UoMCwtMSkpO2NvbnN0W2MsZl09TSh1KTtyZXR1cm4gZyhlLHt0eXBlOiJBUFBMWSIscGF0aDpyLm1hcChkPT5kLnRvU3RyaW5nKCkpLGFyZ3VtZW50TGlzdDpjfSxmKS50aGVuKG0pfSxjb25zdHJ1Y3QoYSxuKXtwKHMpO2NvbnN0W3UsbF09TShuKTtyZXR1cm4gZyhlLHt0eXBlOiJDT05TVFJVQ1QiLHBhdGg6ci5tYXAoYz0+Yy50b1N0cmluZygpKSxhcmd1bWVudExpc3Q6dX0sbCkudGhlbihtKX19KTtyZXR1cm4gb31mdW5jdGlvbiBEKGUpe3JldHVybiBBcnJheS5wcm90b3R5cGUuY29uY2F0LmFwcGx5KFtdLGUpfWZ1bmN0aW9uIE0oZSl7Y29uc3Qgcj1lLm1hcChTKTtyZXR1cm5bci5tYXAoaT0+aVswXSksRChyLm1hcChpPT5pWzFdKSldfWNvbnN0IFA9bmV3IFdlYWtNYXA7ZnVuY3Rpb24gTihlLHIpe3JldHVybiBQLnNldChlLHIpLGV9ZnVuY3Rpb24geihlKXtyZXR1cm4gT2JqZWN0LmFzc2lnbihlLHtbJF06ITB9KX1mdW5jdGlvbiBTKGUpe2Zvcihjb25zdFtyLGldb2YgRSlpZihpLmNhbkhhbmRsZShlKSl7Y29uc3RbcyxvXT1pLnNlcmlhbGl6ZShlKTtyZXR1cm5be3R5cGU6IkhBTkRMRVIiLG5hbWU6cix2YWx1ZTpzfSxvXX1yZXR1cm5be3R5cGU6IlJBVyIsdmFsdWU6ZX0sUC5nZXQoZSl8fFtdXX1mdW5jdGlvbiBtKGUpe3N3aXRjaChlLnR5cGUpe2Nhc2UiSEFORExFUiI6cmV0dXJuIEUuZ2V0KGUubmFtZSkuZGVzZXJpYWxpemUoZS52YWx1ZSk7Y2FzZSJSQVciOnJldHVybiBlLnZhbHVlfX1mdW5jdGlvbiBnKGUscixpKXtyZXR1cm4gbmV3IFByb21pc2Uocz0+e2NvbnN0IG89VSgpO2UuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24gYShuKXshbi5kYXRhfHwhbi5kYXRhLmlkfHxuLmRhdGEuaWQhPT1vfHwoZS5yZW1vdmVFdmVudExpc3RlbmVyKCJtZXNzYWdlIixhKSxzKG4uZGF0YSkpfSksZS5zdGFydCYmZS5zdGFydCgpLGUucG9zdE1lc3NhZ2UoT2JqZWN0LmFzc2lnbih7aWQ6b30sciksaSl9KX1mdW5jdGlvbiBVKCl7cmV0dXJuIG5ldyBBcnJheSg0KS5maWxsKDApLm1hcCgoKT0+TWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpKk51bWJlci5NQVhfU0FGRV9JTlRFR0VSKS50b1N0cmluZygxNikpLmpvaW4oIi0iKX1jb25zdCBXPWFzeW5jKCk9PldlYkFzc2VtYmx5LnZhbGlkYXRlKG5ldyBVaW50OEFycmF5KFswLDk3LDExNSwxMDksMSwwLDAsMCwxLDUsMSw5NiwwLDEsMTIzLDMsMiwxLDAsMTAsMTAsMSw4LDAsNjUsMCwyNTMsMTUsMjUzLDk4LDExXSkpLHg9ImVhZ2VyIixrPSJsYXp5IixqPXtzc3c6WyJzaW1kIl0sbWluaW1hcDI6WyJzaW1kIl19LHQ9e3Rvb2xzOltdLGNvbmZpZzp7fSxmaWxlczpbXSxiYXNlOnt9LGZzOnt9LGFzeW5jIGluaXQoKXtpZih0LnRvb2xzLmxlbmd0aD09PTApdGhyb3ciRXhwZWN0aW5nIGF0IGxlYXN0IDEgdG9vbC4iO2lmKG5ldyBTZXQodC50b29scy5tYXAocj0+YCR7ci50b29sfS8ke3IucHJvZ3JhbXx8ci50b29sfWApKS5zaXplIT09dC50b29scy5sZW5ndGgpdGhyb3ciRm91bmQgZHVwbGljYXRlIHRvb2xzOyBjYW4gb25seSBoYXZlIGVhY2ggdG9vbC9wcm9ncmFtIGNvbWJpbmF0aW9uIGF0IG1vc3Qgb25jZS4iO2lmKHQuYmFzZT10LnRvb2xzLmZpbmQocj0+ci5yZWluaXQhPT0hMCksIXQuYmFzZSl0aHJvdyJDb3VsZCBub3QgZmluZCBhIHRvb2wgd2l0aCBgcmVpbml0OiBmYWxzZWAgdG8gdXNlIGFzIHRoZSBiYXNlIG1vZHVsZS4gVG8gZml4IHRoaXMgaXNzdWUsIGluY2x1ZGUgdGhlIHRvb2wgYGJhc2UvMS4wLjBgIHdoZW4gaW5pdGlhbGl6aW5nIEFpb2xpLiI7cmV0dXJuIHQuYmFzZS5pc0Jhc2VNb2R1bGU9ITAsYXdhaXQgdGhpcy5fc2V0dXAodC5iYXNlKSxhd2FpdCB0aGlzLl9pbml0TW9kdWxlcygpLHQuX2xvZygiUmVhZHkiKSwhMH0sYXN5bmMgX2luaXRNb2R1bGVzKCl7YXdhaXQgUHJvbWlzZS5hbGwodC50b29scy5tYXAodGhpcy5fc2V0dXApKSxhd2FpdCB0aGlzLl9zZXR1cEZTKCl9LG1vdW50KGU9W10pe2NvbnN0IHI9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyRGF0YX1gLGk9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyTW91bnRlZH1gO2xldCBzPVtdLG89W10sYT1bXTshQXJyYXkuaXNBcnJheShlKSYmIShlIGluc3RhbmNlb2YgRmlsZUxpc3QpJiYoZT1bZV0pLHQuX2xvZyhgTW91bnRpbmcgJHtlLmxlbmd0aH0gZmlsZXNgKTtmb3IobGV0IG4gb2YgZSl7aWYobiBpbnN0YW5jZW9mIEZpbGV8fChuPT1udWxsP3ZvaWQgMDpuLmRhdGEpaW5zdGFuY2VvZiBCbG9iJiZuLm5hbWV8fHR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmbi5uYW1lKXR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmKG4uZGF0YT1uZXcgQmxvYihbbi5kYXRhXSx7dHlwZToidGV4dC9wbGFpbiJ9KSkscy5wdXNoKG4pO2Vsc2UgaWYobi5uYW1lJiZuLnVybClvLnB1c2gobik7ZWxzZSBpZih0eXBlb2Ygbj09InN0cmluZyImJm4uc3RhcnRzV2l0aCgiaHR0cCIpKW49e3VybDpuLG5hbWU6bi5zcGxpdCgiLy8iKS5wb3AoKS5yZXBsYWNlKC9cLy9nLCItIil9LG8ucHVzaChuKTtlbHNlIHRocm93J0Nhbm5vdCBtb3VudCBmaWxlKHMpIHNwZWNpZmllZC4gTXVzdCBiZSBhIEZpbGUsIEJsb2IsIGEgVVJMIHN0cmluZywgb3IgeyBuYW1lOiAiZmlsZS50eHQiLCBkYXRhOiAic3RyaW5nIiB9Lic7YS5wdXNoKG4ubmFtZSl9dHJ5e3QuZnMudW5tb3VudChpKX1jYXRjaHt9Zm9yKGxldCBuIG9mIG8pdC5mcy5jcmVhdGVMYXp5RmlsZShyLG4ubmFtZSxuLnVybCwhMCwhMCk7cmV0dXJuIHQuZmlsZXM9dC5maWxlcy5jb25jYXQocyksdC5iYXNlLm1vZHVsZS5GUy5tb3VudCh0LmJhc2UubW9kdWxlLldPUktFUkZTLHtmaWxlczp0LmZpbGVzLmZpbHRlcihuPT5uIGluc3RhbmNlb2YgRmlsZSksYmxvYnM6dC5maWxlcy5maWx0ZXIobj0+KG49PW51bGw/dm9pZCAwOm4uZGF0YSlpbnN0YW5jZW9mIEJsb2IpfSxpKSxzLm1hcChuPT57Y29uc3QgdT1gJHtpfS8ke24ubmFtZX1gLGw9YCR7cn0vJHtuLm5hbWV9YDt0cnl7dC5mcy51bmxpbmsobCl9Y2F0Y2h7fXQuX2xvZyhgQ3JlYXRpbmcgc3ltbGluazogJHtsfSAtLT4gJHt1fWApLHQuZnMuc3ltbGluayh1LGwpfSksYS5tYXAobj0+YCR7cn0vJHtufWApfSxhc3luYyBleGVjKGUscj1udWxsKXtpZih0Ll9sb2coYEV4ZWN1dGluZyAlYyR7ZX0lYyBhcmdzPSR7cn1gLCJjb2xvcjpkYXJrYmx1ZTsgZm9udC13ZWlnaHQ6Ym9sZCIsIiIpLCFlKXRocm93IkV4cGVjdGluZyBhIGNvbW1hbmQiO2xldCBpPWU7cj09bnVsbCYmKHI9ZS5zcGxpdCgiICIpLGk9ci5zaGlmdCgpKTtjb25zdCBzPXQudG9vbHMuZmluZChhPT57dmFyIHU7bGV0IG49aTtyZXR1cm4oKHU9YT09bnVsbD92b2lkIDA6YS5mZWF0dXJlcyk9PW51bGw/dm9pZCAwOnUuc2ltZCk9PT0hMCYmKG49YCR7bn0tc2ltZGApLGEucHJvZ3JhbT09bn0pO2lmKHM9PW51bGwpdGhyb3dgUHJvZ3JhbSAke2l9IG5vdCBmb3VuZC5gO3Muc3Rkb3V0PSIiLHMuc3RkZXJyPSIiLHMubG9hZGluZz09ayYmKHMubG9hZGluZz14LGF3YWl0IHRoaXMuX2luaXRNb2R1bGVzKCkpO3RyeXtzLm1vZHVsZS5jYWxsTWFpbihyKX1jYXRjaChhKXtjb25zb2xlLmVycm9yKGEpfXRyeXtzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzFdKSxzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzJdKX1jYXRjaHt9cy5tb2R1bGUuRlMuc3RyZWFtc1sxXT1zLm1vZHVsZS5GUy5vcGVuKCIvZGV2L3N0ZG91dCIsInciKSxzLm1vZHVsZS5GUy5zdHJlYW1zWzJdPXMubW9kdWxlLkZTLm9wZW4oIi9kZXYvc3RkZXJyIiwidyIpO2xldCBvPXtzdGRvdXQ6cy5zdGRvdXQsc3RkZXJyOnMuc3RkZXJyfTtpZih0LmNvbmZpZy5wcmludEludGVybGVhdmVkJiYobz1zLnN0ZG91dCkscy5yZWluaXQ9PT0hMCl7Y29uc3QgYT10LmJhc2UubW9kdWxlLkZTLmN3ZCgpO09iamVjdC5hc3NpZ24ocyxzLmNvbmZpZykscy5yZWFkeT0hMSxhd2FpdCB0aGlzLmluaXQoKSxzLmlzQmFzZU1vZHVsZSYmdGhpcy5tb3VudCgpLHRoaXMuY2QoYSl9cmV0dXJuIG99LGNhdChlKXtyZXR1cm4gdC5fZmlsZW9wKCJjYXQiLGUpfSxscyhlKXtyZXR1cm4gdC5fZmlsZW9wKCJscyIsZSl9LGRvd25sb2FkKGUpe3JldHVybiB0Ll9maWxlb3AoImRvd25sb2FkIixlKX0scHdkKCl7cmV0dXJuIHQuZnMuY3dkKCl9LGNkKGUpe2ZvcihsZXQgciBvZiB0LnRvb2xzKSFyLm1vZHVsZXx8ci5tb2R1bGUuRlMuY2hkaXIoZSl9LG1rZGlyKGUpe3JldHVybiB0LmZzLm1rZGlyKGUpLCEwfSxyZWFkKHtwYXRoOmUsbGVuZ3RoOnIsZmxhZzppPSJyIixvZmZzZXQ6cz0wLHBvc2l0aW9uOm89MH0pe2NvbnN0IGE9dC5mcy5vcGVuKGUsaSksbj1uZXcgVWludDhBcnJheShyKTtyZXR1cm4gdC5mcy5yZWFkKGEsbixzLHIsbyksdC5mcy5jbG9zZShhKSxufSx3cml0ZSh7cGF0aDplLGJ1ZmZlcjpyLGZsYWc6aT0idysiLG9mZnNldDpzPTAscG9zaXRpb246bz0wfSl7Y29uc3QgYT10LmZzLm9wZW4oZSxpKTt0LmZzLndyaXRlKGEscixzLHIubGVuZ3RoLG8pLHQuZnMuY2xvc2UoYSl9LF9zdGRpblR4dDoiIixfc3RkaW5QdHI6MCxnZXQgc3RkaW4oKXtyZXR1cm4gdC5fc3RkaW5UeHR9LHNldCBzdGRpbihlPSIiKXt0Ll9sb2coYFNldHRpbmcgc3RkaW4gdG8gJWMke2V9JWNgLCJjb2xvcjpkYXJrYmx1ZSIsIiIpLHQuX3N0ZGluVHh0PWUsdC5fc3RkaW5QdHI9MH0sYXN5bmMgX3NldHVwKGUpe2lmKGUucmVhZHkpcmV0dXJuO2lmKHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gKGJhc2UgPSAke2UuaXNCYXNlTW9kdWxlPT09ITB9KS4uLmApLGUuY29uZmlnPU9iamVjdC5hc3NpZ24oe30sZSksZS51cmxQcmVmaXh8fChlLnVybFByZWZpeD1gJHt0LmNvbmZpZy51cmxDRE59LyR7ZS50b29sfS8ke2UudmVyc2lvbn1gKSxlLnByb2dyYW18fChlLnByb2dyYW09ZS50b29sKSxlLmZlYXR1cmVzfHwoZS5mZWF0dXJlcz17fSwoaltlLnByb2dyYW1dfHxbXSkuaW5jbHVkZXMoInNpbWQiKSYmKGF3YWl0IFcoKT8oZS5wcm9ncmFtKz0iLXNpbWQiLGUuZmVhdHVyZXMuc2ltZD0hMCk6dC5fbG9nKGBXZWJBc3NlbWJseSBTSU1EIGlzIG5vdCBzdXBwb3J0ZWQgaW4gdGhpcyBicm93c2VyOyB3aWxsIGxvYWQgbm9uLVNJTUQgdmVyc2lvbiBvZiAke2UucHJvZ3JhbX0uYCkpKSxlLmlzQmFzZU1vZHVsZSYmKGUubG9hZGluZz14KSxlLmxvYWRpbmc9PT1rKXt0Ll9sb2coYFdpbGwgbGF6eS1sb2FkICR7ZS50b29sfTsgc2tpcHBpbmcgaW5pdGlhbGl6YXRpb24uYCk7cmV0dXJufXNlbGYuaW1wb3J0U2NyaXB0cyhgJHtlLnVybFByZWZpeH0vJHtlLnByb2dyYW19LmpzYCksZS5tb2R1bGU9YXdhaXQgTW9kdWxlKHt0aGlzUHJvZ3JhbTplLnByb2dyYW0sbG9jYXRlRmlsZTooaSxzKT0+YCR7ZS51cmxQcmVmaXh9LyR7aX1gLHN0ZGluOigpPT50Ll9zdGRpblB0cjx0LnN0ZGluLmxlbmd0aD90LnN0ZGluLmNoYXJDb2RlQXQodC5fc3RkaW5QdHIrKyk6KHQuc3RkaW49IiIsbnVsbCkscHJpbnQ6aT0+ZS5zdGRvdXQrPWAke2l9CmAscHJpbnRFcnI6dC5jb25maWcucHJpbnRJbnRlcmxlYXZlZD9pPT5lLnN0ZG91dCs9YCR7aX0KYDppPT5lLnN0ZGVycis9YCR7aX0KYH0pO2NvbnN0IHI9ZS5tb2R1bGUuRlM7ZS5pc0Jhc2VNb2R1bGU/KHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gd2l0aCBiYXNlIG1vZHVsZSBmaWxlc3lzdGVtLi4uYCksci5ta2Rpcih0LmNvbmZpZy5kaXJTaGFyZWQsNTExKSxyLm1rZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJEYXRhfWAsNTExKSxyLm1rZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJNb3VudGVkfWAsNTExKSxyLmNoZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJEYXRhfWApLHQuZnM9cik6KHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gd2l0aCBmaWxlc3lzdGVtLi4uYCksci5ta2Rpcih0LmNvbmZpZy5kaXJTaGFyZWQpLHIubW91bnQoZS5tb2R1bGUuUFJPWFlGUyx7cm9vdDp0LmNvbmZpZy5kaXJTaGFyZWQsZnM6dC5mc30sdC5jb25maWcuZGlyU2hhcmVkKSxyLmNoZGlyKHQuZnMuY3dkKCkpKSxlLnN0ZG91dD0iIixlLnN0ZGVycj0iIixlLnJlYWR5PSEwfSxhc3luYyBfc2V0dXBGUygpe2NvbnN0IGU9dC5mcztmb3IobGV0IHIgb2YgdC50b29scyl7aWYoIXIucmVhZHkpY29udGludWU7Y29uc3QgaT1yLm1vZHVsZS5GUyxzPWAvJHtyLnRvb2x9YCxvPWAke3QuY29uZmlnLmRpclNoYXJlZH0ke3N9YDshaS5hbmFseXplUGF0aChzKS5leGlzdHN8fGUuYW5hbHl6ZVBhdGgobykuZXhpc3RzfHwodC5fbG9nKGBNb3VudGluZyAke3N9IG9udG8gJHt0LmJhc2UudG9vbH0gZmlsZXN5c3RlbSBhdCAke299YCksZS5ta2RpcihvKSxlLm1vdW50KHQuYmFzZS5tb2R1bGUuUFJPWFlGUyx7cm9vdDpzLGZzOml9LG8pKX19LF9maWxlb3AoZSxyKXt0Ll9sb2coYFJ1bm5pbmcgJHtlfSAke3J9YCk7Y29uc3QgaT10LmZzLmFuYWx5emVQYXRoKHIpO2lmKCFpLmV4aXN0cylyZXR1cm4gdC5fbG9nKGBGaWxlICR7cn0gbm90IGZvdW5kLmApLCExO3N3aXRjaChlKXtjYXNlImNhdCI6cmV0dXJuIHQuZnMucmVhZEZpbGUocix7ZW5jb2Rpbmc6InV0ZjgifSk7Y2FzZSJscyI6cmV0dXJuIHQuZnMuaXNGaWxlKGkub2JqZWN0Lm1vZGUpP3QuZnMuc3RhdChyKTp0LmZzLnJlYWRkaXIocik7Y2FzZSJkb3dubG9hZCI6Y29uc3Qgcz1uZXcgQmxvYihbdGhpcy5jYXQocildKTtyZXR1cm4gVVJMLmNyZWF0ZU9iamVjdFVSTChzKX1yZXR1cm4hMX0sX2xvZyhlKXtpZighdC5jb25maWcuZGVidWcpcmV0dXJuO2xldCByPVsuLi5hcmd1bWVudHNdO3Iuc2hpZnQoKSxjb25zb2xlLmxvZyhgJWNbV2ViV29ya2VyXSVjICR7ZX1gLCJmb250LXdlaWdodDpib2xkIiwiIiwuLi5yKX19O3codCl9KSgpOwo=",A=typeof window<"u"&&window.Blob&&new Blob([atob(T)],{type:"text/javascript;charset=utf-8"});function S(){const e=A&&(window.URL||window.webkitURL).createObjectURL(A);try{return e?new Worker(e):new Worker("data:application/javascript;base64,"+T)}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}const _={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(e,t={}){if(null==e)throw"Expecting array of tools as input to Aioli constructor.";return Array.isArray(e)||(e=[e]),t=Object.assign({},_,t),e=e.map(this._parseTool),"stg"===t.env&&(t.urlCDN=t.urlCDNStg),this.tools=e,this.config=t,null!=this.config.callback&&(this.callback=this.config.callback),delete this.config.callback,this.init()}async init(){const e=new S;this.callback&&(e.onmessage=e=>{"biowasm"===e.data.type&&this.callback(e.data.value)});const t=m(e);return t.tools=this.tools,t.config=this.config,await t.init(),t}_parseTool(e){if("string"!=typeof e)return e;const t=e.split("/");if(2!=t.length&&3!=t.length)throw"Expecting '<tool>/<version>' or '<tool>/<program>/<version>'";return{tool:t[0],program:3==t.length?t[1]:t[0],version:t[t.length-1]}}}var P=s(850);class ${static getAvailableScales(){return Object.entries(this.scales).map((([e,t])=>e))}static getScale(e){return(0,P.hu)(!(void 0===this.scales[e]),`Scale '${e}' was not found.`),this.scales[e]}}$.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 x{constructor(e="categorial"){this.aa2num=$.getScale(e),this.num2aa={},Object.entries(this.aa2num).forEach((([e,t])=>this.num2aa[t]=e))}static _truncateSequence(e){let t=0,s=e.length;const n=["NH2","COOH"];if(e.startsWith(n[0])){const s=n[0].length;(0,P.hu)("-"==e[s],`Wrong sequence format: ${n[0]} without following '-' in '${e}'.`),t=s}if(e.endsWith(n[1])){const t=n[1].length+1;(0,P.hu)("-"==e[s-t],`Wrong sequence format: ${n[1]} without '-' precending in '${e}'.`),s-=t}return e.substring(t,s)}static _dropDefises(e){return e.replace(/(-)([^-]+)/g,"$2")}static clean(e){return x._dropDefises(x._truncateSequence(e))}encode(e){const t=e.length,s=new Array(t).fill(0);for(let n=0;n<t;++n){const t=e[n];(0,P.hu)(t in this.aa2num,`Unknown char '${t}' found in sequence '${e}'`),s[n]=this.encodeLettter(t)}return s}encodeLettter(e){return this.aa2num[e]}decode(e){let t="";for(let s=0;s<e.length;++s){const n=e[s];(0,P.hu)(n in this.num2aa,`Unknown code '${n}' found in vector '${e}'`),t+=this.num2aa[n]}return t}}var N=s(3553);const M="input.fa",L="result.fasta";function I(e){return e.reduce(((e,t,s)=>e+`>sample${s+1}\n${t}\n`),"")}async function R(e,t=!1,s="",i=null,o,a,l){let c=e.toList();t&&(c=c.map((e=>x.clean(e).replace(/\-/g,""))));const h=e.length;i??(i=n.Column.string("Clusters",h).init("0")),i.type!=n.COLUMN_TYPE.STRING&&(i=i.convertTo(n.TYPE.STRING)),i.compact();const u=i.categories,d=i.getRawData(),m=new Array(u.length),p=new Array(u.length);for(let e=0;e<h;++e){const t=d[e];(m[t]??(m[t]=[])).push(c[e]),(p[t]??(p[t]=[])).push(e)}const f=await new E(["base/1.0.0",{tool:"kalign",version:N.WY,reinit:!0}]),g=n.Column.string(s,h);for(let e=0;e<u.length;++e){const t=I(m[e]);await f.fs.writeFile(M,t);const s=`${void 0!==o?` --gpo ${o}`:""}${void 0!==a?` --gpe ${a}`:""}${void 0!==l?` --tgpe ${l}`:""}`,n=await f.exec(`kalign ${M} -f fasta -o ${L}${s}`);console.warn(n);const i=await f.cat(L);if(!i)throw new Error("kalign output no result");const c=new r.i(i).sequencesArray,h=p[e];for(let e=0;e<c.length;++e)g.set(h[e],c[e])}const y=e.getTag(n.TAGS.UNITS),b=e.getTag("alphabet");return g.setTag(n.TAGS.UNITS,y),g.setTag("aligned","SEQ.MSA"),g.setTag("alphabet",b),g.semType=n.SEMTYPE.MACROMOLECULE,g}},8341:(e,t,s)=>{"use strict";s.d(t,{Jy:()=>l,f3:()=>h});var n=s(4469),r=s(976),i=s(8447),o=s(3553);const a=new class{constructor(){this.dcName="bio"}async getDockerContainer(){return await n.dapi.docker.dockerContainers.filter(this.dcName).first()}},l=["mafft --auto","mafft","linsi","ginsi","einsi","fftns","fftnsi","nwns","nwnsi"],c=["AlignedSeq","AlignedSubpeptide","HELM","ID","PolymerID"];async function h(e,t,s="ginsi",l=1.53,h=0,d=null){const m=await a.getDockerContainer();if("started"!==m.status&&"checking"!==m.status)return n.log.warning("PepSeA container has not started yet"),null;const p=e.length;d??(d=r.Column.int("Clusters",p).init(0)),d.type!=r.COLUMN_TYPE.STRING&&(d=d.convertTo(r.TYPE.STRING));const f=d.categories,g=new Array(f.length);for(let t=0;t<p;++t){const s=d.get(t);if(""===s)continue;const n=f.indexOf(s),r=e.get(t);r&&(g[n]??(g[n]=[])).push({ID:t.toString(),HELM:r})}const y=new Array(p);for(const e of g){const t=(await u(m.id,e,s,l,h)).Alignment;for(const e of t)y[parseInt(e.ID)]=Object.entries(e).filter((e=>!c.includes(e[0]))).map((e=>"-"!==e[1]?e[1]:"")).join(o.rs.SEPARATOR)}const b=r.Column.fromStrings(t,y);return b.setTag(r.TAGS.UNITS,i.r2.SEPARATOR),b.setTag("separator",o.rs.SEPARATOR),b.setTag("aligned","SEQ.MSA"),b.setTag("alphabet","UN"),b.setTag(".alphabetIsMultichar","true"),b.semType=r.SEMTYPE.MACROMOLECULE,b}async function u(e,t,s,r,i){const o={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)},a=`/align?method=${s}&gap_open=${r}&gap_extend=${i}`,l=await n.dapi.docker.dockerContainers.request(e,a,o);return JSON.parse(l??"{}")}},9943:(e,t,s)=>{"use strict";s.d(t,{i$:()=>a,sK:()=>l}),s(976),s(3870),s(4469);var n=s(6414),r=s.n(n),i=s(8447);s(499);const o=60;function a(e,t,s=o,n="\n"){const r=i.kB,a=[];for(let i=0;i<t.length;i++){const o=e.map((e=>e.get(i).toString())).join("|"),c=l(t.get(i),r,s);a.push(`>${o}${n}`);for(const e of c)a.push(`${e}${n}`)}return"".concat(...a)}function l(e,t,s=o){const n=t(e);let i=0;const a=n.length,l=[];for(;i<a;){const e=r()(n).slice(i,i+s).toArray(),t=e.map((e=>e.length>1?`[${e}]`:e)).join("");l.push(t),i+=e.length}return l}},9416:(e,t,s)=>{"use strict";s.d(t,{n:()=>c});var n=s(4469),r=s(976),i=s(8467),o=s(2568),a=s(8457),l=s(3553);async function c(e,t){if(await(0,i.gw)(10),!(0,o.n)(t,"Sequence space"))return e;const s=(0,a.O)(t);s.name="splitToMonomers";const c=t.dataFrame;for(const e of s.columns)e.semType=l.Of.MONOMER,e.setTag("alphabet",t.getTag("alphabet"));const h=/(\d+)(?: \((\d+)\))?/,u=e=>{h.lastIndex=0;const t=e.match(h);return t?`${t[1]} (${parseInt(t[2]??0)+1})`:e};for(let e=0;e<s.columns.length;e++){const n=s.columns.byIndex(e);n.semType=l.Of.MONOMER,n.setTag("alphabet",t.getTag("alphabet"));const r=100;let i=0;for(;c.columns.byName(n.name)&&i<r;)n.name=u(n.name),i++;c.columns.add(n)}await n.data.detectSemanticTypes(c);for(let e=0;e<s.columns.length;e++){const t=s.columns.byIndex(e);t.setTag(r.TAGS.CELL_RENDERER,"Monomer"),t.setTag(".use-as-filter","false")}return c}},4293:(e,t,s)=>{"use strict";function n(e,t){e.innerHTML="",e.append(t)}s.d(t,{Y:()=>n}),s(4469),s(976)},8415:(e,t,s)=>{"use strict";s.d(t,{bo:()=>w,CK:()=>A,yW:()=>T,eZ:()=>$});var n=s(4469),r=s(3870),i=s(976),o=s(3336),a=s.n(o),l=s(6414),c=s.n(l),h=s(701),u=s(499),d=s(8447),m=s(9298);function p(e){var t;return"string"==typeof e||e instanceof String?e:("object"==typeof e||e instanceof Object)&&"$thrownJsError"in e?p(e.$thrownJsError):e instanceof Error?null!==(t=e.stack)&&void 0!==t?t:e.message:e.toString()}var f=s(7945),g=s(8467),y=s(172);var b,w,C=s(8770),v=s(3348);HTMLCanvasElement.prototype.getCursorPosition=function(e,t){const s=this.getBoundingClientRect();return new i.Point((e.clientX-s.left)*t,(e.clientY-s.top)*t)},i.Rect.prototype.contains=function(e,t){return this.left<=e&&e<=this.right&&this.top<=t&&t<=this.bottom};class T{constructor(e=0,t){this.valueList=null,this.valueIdx=0,this.value=this.rowCount=e,this.bounds=t}push(e){this.valueList||(this.valueList=new Array(this.rowCount),this.valueIdx=0),this.valueList[this.valueIdx]=e,++this.valueIdx}aggregate(e){this.value=e(this.valueList)??0,this.valueList=null}}class A{get label(){return this._label?this._label:this.name}constructor(e,t,s,n){this.sumRowCount=0,this.pos=e,this.name=t,this._freqs=s??{},n?.sumRowCount&&(this.sumRowCount=n.sumRowCount),n?.sumValueForHeight&&(this.sumPlotValue=n.sumValueForHeight),n?.label&&(this._label=n.label)}getMonomers(){return Object.keys(this._freqs)}hasMonomer(e){return e in this._freqs}getFreq(e){let t=this._freqs[e];return t||(t=this._freqs[e]=new T),t}aggregate(e){const t=function(e){return t=>{const s=function(e){let t;const s="agg";return t=e instanceof Float32Array?i.Column.fromFloat32Array(s,e):e instanceof Int32Array?i.Column.fromInt32Array(s,e):i.Column.fromList(i.COLUMN_TYPE.FLOAT,s,e),t}(t);return s.aggregate(e)}}(e);for(const[e,s]of Object.entries(this._freqs))s.aggregate(t)}getMinValue(){return Math.min(...Object.values(this._freqs).map((e=>e.value)))}calcPlotValue(e){for(const t of Object.values(this._freqs))t.plotValue=t.value-e}calcHeights(e){this.sumPlotValue=0;for(const e of Object.values(this._freqs))this.sumPlotValue+=e.plotValue;if(this.sumPlotValueForHeight=0,e===m.ES.Entropy){const e=Object.keys(this._freqs).length,t=.01*this.sumPlotValue,s=t/e;for(const e of Object.values(this._freqs)){const n=(e.plotValue+s)/(this.sumPlotValue+t);this.sumPlotValueForHeight+=-n*Math.log2(n)}}else if(e===m.ES.full)for(const[e,t]of Object.entries(this._freqs)){const e=t.plotValue/this.sumPlotValue;this.sumPlotValueForHeight+=e}}calcScreen(e,t,s,n,r,o,a,l,c,h){const u=r===m.ES.Entropy?n*(o-this.sumPlotValueForHeight)/o:n;let d=h*c+(n-u-1);const p=Object.entries(this._freqs).sort(((t,s)=>e(t[0])||e(s[0])?e(t[0])&&e(s[0])?0:e(t[0])?-1:1:s[1].value-t[1].value));for(const[e,n]of p){const e=u*n.plotValue/this.sumPlotValue;n.bounds=new i.Rect((t-s)*c*a,d,l*c,e),d+=e}}render(e,t,s,n,r,i){for(const[o,a]of Object.entries(this._freqs))if(!t(o)){const t=(0,d.GU)(o,5),l=a.bounds,c=l.left;e.resetTransform(),e.strokeStyle="lightgray",e.lineWidth=1,e.rect(c,l.top,l.width,l.height),e.fillStyle=i.get(o)??i.get("other"),e.textAlign="left",e.font=s;const h=e.measureText(t);e.setTransform(l.width/h.width,0,0,l.height/r,c,l.top),e.fillText(t,0,-n)}}getMonomerAt(e,t){const s=Object.entries(this._freqs).find((([s,n])=>n.bounds.contains(e,t)));return s?s[0]:void 0}buildCompositionTable(e){return(0,C._)(e,Object.assign({},...Object.entries(this._freqs).map((([e,t])=>({[e]:t.rowCount})))))}}!function(e){e.STYLE="Style",e.BEHAVIOR="Behavior",e.LAYOUT="Layout",e.DATA="Data"}(b||(b={})),function(e){e.sequenceColumnName="sequenceColumnName",e.valueAggrType="valueAggrType",e.valueColumnName="valueColumnName",e.startPositionName="startPositionName",e.endPositionName="endPositionName",e.skipEmptySequences="skipEmptySequences",e.skipEmptyPositions="skipEmptyPositions",e.shrinkEmptyTail="shrinkEmptyTail",e.backgroundColor="backgroundColor",e.positionHeight="positionHeight",e.positionWidth="positionWidth",e.verticalAlignment="verticalAlignment",e.horizontalAlignment="horizontalAlignment",e.fixWidth="fixWidth",e.fitArea="fitArea",e.minHeight="minHeight",e.maxHeight="maxHeight",e.showPositionLabels="showPositionLabels",e.positionMarginState="positionMarginState",e.positionMargin="positionMargin",e.filterSource="filterSource"}(w||(w={}));const S=m.vS;var _;!function(e){e[e.None=0]="None",e[e.Render=1]="Render",e[e.Layout=1]="Layout",e[e.Freqs=2]="Freqs"}(_||(_={}));const E=new class{constructor(){this.render=20}};class P extends i.JsViewer{get positionWidthWithMargin(){return this._positionWidthWithMargin}get Length(){return this.skipEmptyPositions?this.positions.length:this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0}get positionMarginValue(){return this.positionMarginState===m.dE.AUTO&&!0===this.unitsHandler.getAlphabetIsMultichar()||this.positionMarginState===m.dE.ON?this.positionMargin:0}constructor(){super(),this.viewed=!1,this.initialized=!1,this.palette=null,this.seqCol=null,this.positions=[],this.visibleSlider=!1,this.allowResize=!0,this.turnOfResizeForOneSetValue=!1,this.backgroundColor=4294967295,this.positionMargin=0,this.positionNames=[],this.positionLabels=void 0,this.startPosition=-1,this.endPosition=-1,this.error=null,this.viewerId=++P.viewerCounter,this.setDataInProgress=!1,this.viewSubs=[],this._onSizeChanged=new h.Subject,this._onFreqsCalculated=new h.Subject,this._onLayoutCalculated=new h.Subject,this.requestedRenderLevel=_.Freqs,this.renderRequest=new h.Subject,this._onRendered=new h.Subject,this.textBaseline="top",this.unitsHandler=null,this.sequenceColumnName=this.string(w.sequenceColumnName,S.sequenceColumnName,{category:b.DATA});const e=[i.AGG.KEY,i.AGG.PIVOT,i.AGG.MISSING_VALUE_COUNT,i.AGG.SKEW,i.AGG.KURT,i.AGG.SELECTED_ROWS_COUNT],t=Object.values(i.AGG).filter((t=>!e.includes(t)));this.valueAggrType=this.string(w.valueAggrType,S.valueAggrType,{category:b.DATA,choices:t}),this.valueColumnName=this.string(w.valueColumnName,S.valueColumnName,{category:b.DATA}),this.startPositionName=this.string(w.startPositionName,S.startPositionName,{category:b.DATA}),this.endPositionName=this.string(w.endPositionName,S.endPositionName,{category:b.DATA}),this.skipEmptySequences=this.bool(w.skipEmptySequences,S.skipEmptySequences,{category:b.DATA}),this.skipEmptyPositions=this.bool(w.skipEmptyPositions,S.skipEmptyPositions,{category:b.DATA}),this.shrinkEmptyTail=this.bool(w.shrinkEmptyTail,S.shrinkEmptyTail,{category:b.DATA}),this.backgroundColor=this.int(w.backgroundColor,S.backgroundColor,{category:b.STYLE}),this.positionHeight=this.string(w.positionHeight,S.positionHeight,{category:b.STYLE,choices:Object.values(m.ES)}),this._positionWidth=this.positionWidth=this.float(w.positionWidth,S.positionWidth,{category:b.STYLE}),this.verticalAlignment=this.string(w.verticalAlignment,S.verticalAlignment,{category:b.LAYOUT,choices:Object.values(m.vw)}),this.horizontalAlignment=this.string(w.horizontalAlignment,S.horizontalAlignment,{category:b.LAYOUT,choices:Object.values(m.iD)}),this.fixWidth=this.bool(w.fixWidth,S.fixWidth,{category:b.LAYOUT,userEditable:!1}),this.fitArea=this.bool(w.fitArea,S.fitArea,{category:b.LAYOUT}),this.minHeight=this.float(w.minHeight,S.minHeight,{category:b.LAYOUT}),this.maxHeight=this.float(w.maxHeight,S.maxHeight,{category:b.LAYOUT}),this.showPositionLabels=this.bool(w.showPositionLabels,S.showPositionLabels,{category:b.LAYOUT}),this.positionMarginState=this.string(w.positionMarginState,S.positionMarginState,{category:b.LAYOUT,choices:Object.values(m.dE)});let s=0;"auto"===this.positionMarginState&&(s=4),this.positionMargin=this.int(w.positionMargin,s,{category:b.LAYOUT,min:0,max:16}),this.filterSource=this.string(w.filterSource,S.filterSource,{category:b.BEHAVIOR,choices:Object.values(m.Ct)}),this.slider=r.rangeSlider(0,100,0,20,!1,{style:"barbell"}),this.canvas=r.canvas(),this.canvas.classList.value="bio-wl-canvas",this.canvas.style.width="100%",this.viewSyncer=new y.c(v._package.logger)}viewerToLog(){return`WebLogoViewer<${this.viewerId}>`}setData(){const e=`${this.viewerToLog()}.setData()`;v._package.logger.debug(`${e}, in`),this.viewSyncer.sync(`${e}`,(async()=>{if(!this.setDataInProgress){this.setDataInProgress=!0;try{this.viewed&&(this.renderRequestSub.unsubscribe(),await this.destroyView(),this.viewed=!1),this.updateSeqCol(),this.updateEditors(),this.viewed||(await this.buildView(),this.viewed=!0)}finally{this.setDataInProgress=!1}}})),v._package.logger.debug(`${e}, out`)}async destroyView(){for(const e of this.viewSubs)e.unsubscribe();this.viewSubs=[];const e=this.dataFrame?"data":"null";v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.destroyView( dataFrame = ${e} ) start`),this.host.remove(),this.msgHost=void 0,this.host=void 0,v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.destroyView() end`)}async buildView(){const e=this.dataFrame?"data":"null";v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.buildView( dataFrame = ${e} ) start`),window.devicePixelRatio,this.viewSubs.push(i.debounce(this.renderRequest,E.render).subscribe(this.renderRequestOnDebounce.bind(this))),this.helpUrl="/help/visualize/viewers/web-logo.md",this.msgHost=r.div("No message",{classes:"bio-wl-msg"}),this.msgHost.style.display="none",this.canvas=r.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.host=r.div([this.msgHost,this.canvas],{classes:"bio-wl-host",style:{display:"flex",flexDirection:"row",flexWrap:"wrap"}}),this.root.append(this.host),this.root.append(this.slider.root),this.error&&(this.msgHost.innerText=this.error.message,r.tooltip.bind(this.msgHost,this.error.stack),this.msgHost.style.setProperty("display",null)),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.viewSubs.push(r.onSizeChanged(this.root).subscribe(this.rootOnSizeChanged.bind(this))),this.viewSubs.push(this.slider.onValuesChanged.subscribe(this.sliderOnValuesChanged.bind(this))),this.viewSubs.push((0,h.fromEvent)(this.canvas,"mousemove").subscribe(this.canvasOnMouseMove.bind(this))),this.viewSubs.push((0,h.fromEvent)(this.canvas,"mousedown").subscribe(this.canvasOnMouseDown.bind(this))),this.viewSubs.push((0,h.fromEvent)(this.canvas,"wheel").subscribe(this.canvasOnWheel.bind(this))),this.render(_.Freqs,"buildView"),v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.buildView() end`)}rootOnSizeChanged(){v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.rootOnSizeChanged(), start `),this.render(_.Layout,"rootOnSizeChanged")}updateEditors(){this.props.getProperty(w.valueColumnName).choices=c()(this.dataFrame.columns.numerical).map((e=>e.name)).toArray()}updateSeqCol(){if(this.dataFrame&&(this.seqCol=this.sequenceColumnName?this.dataFrame.col(this.sequenceColumnName):null,null==this.seqCol&&(this.seqCol=(0,d.up)(this.dataFrame),this.sequenceColumnName=this.seqCol?this.seqCol.name:null),this.seqCol)){try{this.unitsHandler=u.Cn.getOrCreate(this.seqCol),this.palette=(0,d.dQ)(this.seqCol),this.render(_.Freqs,"updateSeqCol()"),this.error=null}catch(e){throw this.seqCol=null,this.error=e instanceof Error?e:new Error(e.toString()),e}this.seqCol||(this.unitsHandler=null,this.positionNames=[],this.positionLabels=[],this.startPosition=-1,this.endPosition=-1,this.palette=null)}}getFilter(){let e;switch(this.filterSource){case m.Ct.Filtered:e=this.dataFrame.filter;break;case m.Ct.Selected:e=0===this.dataFrame.selection.trueCount?this.dataFrame.filter:this.dataFrame.selection}return e}setSliderVisibility(e){e?(this.slider.root.style.display="inherit",this.visibleSlider=!0):(this.slider.root.style.display="none",this.visibleSlider=!1)}calcLayout(e){this.host&&this.canvas&&this.slider&&(this.host.classList.remove("bio-wl-fixWidth","bio-wl-fitArea"),this.canvas.classList.remove("bio-wl-fixWidth","bio-wl-fitArea"),this._positionWidth=this.positionWidth,this._positionMargin=this.positionMargin,this._positionWidthWithMargin=this._positionWidth+this.positionMarginValue,this.fixWidth?this.calcLayoutFixWidth(e):this.fitArea?this.calcLayoutFitArea(e):this.calcLayoutNoFitArea(e),this.slider.root.style.width=`${this.host.clientWidth}px`)}calcLayoutFixWidth(e){if(!this.host||!this.canvas||!this.slider)return;this.host.classList.add("bio-wl-fixWidth"),this.canvas.classList.add("bio-wl-fitArea");const t=this._positionWidthWithMargin*this.Length,s=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight);this.host.style.justifyContent=m.iD.LEFT,this.host.style.removeProperty("margin-left"),this.host.style.removeProperty("margin-top"),this.host.style.width=this.canvas.style.width=`${t}px`,this.host.style.height=this.canvas.style.height=`${s}px`,this.host.style.left=this.canvas.style.left="0",this.host.style.top=this.canvas.style.top="0",this.host.style.setProperty("overflow","hidden","important"),this.slider.root.style.display="none",this.slider.setValues(0,Math.max(0,this.Length-1),0,Math.max(0,this.Length-1)),this.canvas.width=t*e,this.canvas.height=s*e}calcLayoutNoFitArea(e){if(!this.host||!this.canvas||!this.slider)return;const t=this._positionWidthWithMargin*this.Length,s=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight),n=Math.min(this.root.clientWidth,t);this.canvas.style.width=`${n}px`,this.canvas.style.height=`${s}px`,this.host.style.width=`${n}px`,this.host.style.height=`${this.root.clientHeight}px`,this.host.style.justifyContent=this.horizontalAlignment,this.host.style.alignContent=this.verticalAlignment===m.vw.TOP?"start":this.verticalAlignment===m.vw.MIDDLE?"center":this.verticalAlignment===m.vw.BOTTOM?"end":"inherit",this.root.clientHeight<this.minHeight&&(this.host.style.alignContent="start",this.host.style.width=`${n+6}px`),this.host.style.width=`${this.host}px`;const r=t>n;if(this.setSliderVisibility(r),r){this.slider.root.style.removeProperty("display"),this.host.style.justifyContent="left",this.host.style.height=this.root.clientHeight-this.slider.root.offsetHeight+"px",this.slider.root.style.top=`${this.host.offsetHeight}px`;let e=Math.min(Math.max(0,this.slider.min),this.Length-.001),t=Math.min(Math.max(0,this.slider.max),this.Length-.001);const s=this.root.clientWidth/this._positionWidthWithMargin;t=Math.min(Math.max(e,0)+s,this.Length-.001),e=Math.max(0,Math.min(t,this.Length-.001)-s),this.slider.setValues(0,Math.max(this.Length-.001),e,t)}else this.slider.setValues(0,Math.max(0,this.Length-.001),0,Math.max(0,this.Length-.001));this.canvas.width=n*e,this.canvas.height=s*e}calcLayoutFitArea(e){if(!this.host||!this.canvas||!this.slider)return;const t=this._positionWidth*this.Length,s=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight),n=t>0?(this.root.clientWidth-this.positionMarginValue*this.Length)/t:0,r=this.root.clientHeight/s,i=Math.max(1,Math.min(n,r));this._positionWidth=this.positionWidth*i,this._positionWidthWithMargin=this._positionWidth+this.positionMarginValue;const o=(this._positionWidth+this.positionMarginValue)*this.Length,a=i*s,l=Math.min(this.root.clientWidth,o);this.canvas.style.width=`${l}px`,this.canvas.style.height=`${a}px`,this.host.style.width=`${l}px`,this.host.style.height=`${this.root.clientHeight}px`,this.host.style.justifyContent=this.horizontalAlignment,this.host.style.alignContent=this.verticalAlignment===m.vw.TOP?"start":this.verticalAlignment===m.vw.MIDDLE?"center":this.verticalAlignment===m.vw.BOTTOM?"end":"inherit",this.root.clientHeight<this.minHeight&&(this.host.style.alignContent="start",this.host.style.width=`${l+6}px`),this.host.style.width=`${this.host}px`;const c=o>l;if(this.setSliderVisibility(c),c){this.slider.root.style.removeProperty("display"),this.host.style.justifyContent="left",this.host.style.height=this.root.clientHeight-this.slider.root.offsetHeight+"px",this.slider.root.style.top=`${this.host.offsetHeight}px`;let e=Math.min(Math.max(0,this.slider.min),this.Length-.001),t=Math.min(Math.max(0,this.slider.max),this.Length-.001);const s=this.root.clientWidth/this._positionWidthWithMargin;t=Math.min(Math.max(e,0)+s,this.Length-.001),e=Math.max(0,Math.min(t,this.Length-.001)-s),this.slider.setValues(0,Math.max(0,this.Length-.001),e,t)}else this.slider.setValues(0,Math.max(0,this.Length-.001),0,Math.max(0,this.Length-.001));this.canvas.width=l*e,this.canvas.height=a*e}onPropertyChanged(e){switch(super.onPropertyChanged(e),e.name){case w.sequenceColumnName:this.updateSeqCol();break;case w.sequenceColumnName:case w.startPositionName:case w.endPositionName:case w.filterSource:case w.shrinkEmptyTail:case w.skipEmptyPositions:case w.positionHeight:case w.valueColumnName:case w.valueAggrType:this.render(_.Freqs,`onPropertyChanged( ${e.name} )`);break;case w.minHeight:case w.maxHeight:case w.positionWidth:case w.showPositionLabels:case w.fixWidth:case w.fitArea:case w.horizontalAlignment:case w.verticalAlignment:case w.positionMargin:case w.positionMarginState:this.render(_.Layout,`onPropertyChanged(${e.name})`);break;case w.backgroundColor:this.render(_.Render,`onPropertyChanged(${e.name})`)}}onTableAttached(){v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.onTableAttached(), `),super.onTableAttached(),this.setData()}detach(){const e=`${this.viewerToLog()}.detach()`;v._package.logger.debug(`${e}, in`);const t=super.detach.bind(this);this.viewSyncer.sync(`${e}`,(async()=>{this.setDataInProgress||(this.viewed&&(await this.destroyView(),this.viewed=!1),t())})),v._package.logger.debug(`${e}, out`)}get onSizeChanged(){return this._onSizeChanged}get onFreqsCalculated(){return this._onFreqsCalculated}get onLayoutCalculated(){return this._onLayoutCalculated}getMonomer(e,t){const s=e.x,n=Math.floor(e.x/(this._positionWidthWithMargin*t)+Math.floor(this.slider.min)),r=this.positions[n];if(!r)return[null,null,null];const i=r.getMonomerAt(s,e.y);return void 0===i?[r,null,null]:[r,i,r.getFreq(i)]}_nullSequence(e="X"){return this.skipEmptySequences?"":new Array(this.Length).fill(e).join("")}_removeEmptyPositions(){this.skipEmptyPositions&&(this.positions=c()(this.positions).filter((e=>{const t=this.unitsHandler.defaultGapSymbol;return!e.hasMonomer(t)||e.getFreq(t).rowCount!==e.sumRowCount})).toArray())}render(e,t){v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render( recalcLevelVal=${e}, reason='${t}' )`),this.requestedRenderLevel=Math.max(this.requestedRenderLevel,e),this.renderRequest.next(this.requestedRenderLevel)}async renderInt(e){if(v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.renderInt( renderLevel=${e} ), start `),this.msgHost&&(this.seqCol&&!this.palette?(this.msgHost.innerText=`Unknown palette (column semType: '${this.seqCol.semType}').`,this.msgHost.style.display=""):this.msgHost.style.display="none"),!this.seqCol||!this.dataFrame||!this.palette||null==this.host||null==this.slider)return;const t=window.devicePixelRatio,s=this.showPositionLabels?12:0;if(e>=_.Freqs&&(()=>{if(v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateFreqsInt(), start `),!this.host||!this.seqCol||!this.dataFrame)return;const e=this.getFilter(),t=0===e.trueCount?this.unitsHandler.maxLength:c().enumerate(this.unitsHandler.splitted).map((([t,s])=>e.get(s)&&t?t.length:0)).reduce(((e,t)=>Math.max(e,t)),0),s=this.seqCol.getTag(".positionNames"),n=this.seqCol.getTag(".positionLabels");this.positionNames=s?s.split(d.CI).map((e=>e.trim())):[...Array(t).keys()].map((e=>`${e+1}`)),this.positionLabels=n?n.split(d.CI).map((e=>e.trim())):void 0,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):t-1;const r=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.unitsHandler=u.Cn.getOrCreate(this.seqCol);const o=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.positions=new Array(o);for(let e=0;e<r;e++){const t=this.positionNames[this.startPosition+e],s=this.positionLabels?this.positionLabels[this.startPosition+e]:void 0;this.positions[e]=new A(this.startPosition+e,t,{},{label:s})}const a=this.dataFrame.rowCount,l=this.unitsHandler.splitted;for(let t=0;t<r;++t){for(let s=0;s<a;++s)if(e.get(s)){const e=l[s][this.startPosition+t]||this.unitsHandler.defaultGapSymbol,n=this.positions[t],r=n.getFreq(e);++n.sumRowCount,r.value=++r.rowCount}if(this.valueAggrType===i.AGG.TOTAL_COUNT)continue;let s=null;try{s=this.dataFrame.getCol(this.valueColumnName),s.matches("numerical")||(s=null)}catch{s=null}if(s){for(let n=0;n<a;++n)if(e.get(n)){const e=l[n][this.startPosition+t]||this.unitsHandler.defaultGapSymbol,r=s.get(n);this.positions[t].getFreq(e).push(r)}this.positions[t].aggregate(this.valueAggrType)}}const h=this.valueAggrType===i.AGG.TOTAL_COUNT?0:Math.min(0,Math.min(...this.positions.map((e=>e.getMinValue()))));for(let e=0;e<r;++e)this.positions[e].calcPlotValue(h),this.positions[e].calcHeights(this.positionHeight);this._removeEmptyPositions(),this._onFreqsCalculated.next()})(),this.calcLayout(t),-1===this.startPosition)return;const r=Math.max(Math.floor(this.slider.min),0),o=Math.min(this.positions.length-1,Math.floor(this.slider.max));e>=_.Layout&&((e,t,s,r)=>{v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt(), start `);const o=this.canvas.height-r*s;let a;if(this.valueAggrType===i.AGG.TOTAL_COUNT){const e=this.getAlphabetSize();this.positionHeight==m.ES.Entropy&&null==e&&n.shell.error("WebLogo: alphabet is undefined."),a=Math.log2(e)}else a=Math.max(...c().count(e).takeWhile((e=>e<=t)).map((e=>this.positions[e].sumPlotValueForHeight)));for(let n=e;n<=t;++n)n in this.positions?this.positions[n].calcScreen((e=>this.unitsHandler.isGap(e)),n,this.slider.min,o,this.positionHeight,a,this._positionWidthWithMargin,this._positionWidth,s,r):v._package.logger.warning(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt() this.positions.length = ${this.positions.length}, jPos = ${n}`);v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt(), end `),this._onLayoutCalculated.next()})(r,o,window.devicePixelRatio,s);const a=this.canvas.getContext("2d");if(a){a.save();try{this.Length,a.resetTransform(),a.fillStyle=function(e){const t=i.Color.a(e);return`#${(16777215&e).toString(16).padStart(6,"0")}`+t.toString(16).padStart(2,"0")}(this.backgroundColor),a.fillRect(0,0,this.canvas.width,this.canvas.height),a.textBaseline=this.textBaseline;const e=10*t;a.resetTransform(),a.fillStyle="black",a.textAlign="center",a.font=`${e.toFixed(1)}px Roboto, Roboto Local, sans-serif`,s>0&&this.positions.length>0&&function(e,t,s,n,r,i,o,a){e.save();try{e.textAlign="center";let l=null,c=null;for(let t=Math.floor(o);t<=Math.floor(a);t++){const s=i[t],n=e.measureText(s.name),r=n.actualBoundingBoxDescent-n.actualBoundingBoxAscent;l=null===l?n.width:Math.max(l,n.width),c=null===c?r:Math.max(c,r)}const h=l<n*t-2?1:(n*t-2)/l;for(let l=Math.floor(o);l<=Math.floor(a);l++){const a=i[l],u=(l-o)*s*t+n*t/2,d=(r*t-c)/2;e.setTransform(h,0,0,1,u,d),e.measureText(a.label),e.fillText(a.label,0,0)}}finally{e.restore()}}(a,t,this._positionWidthWithMargin,this._positionWidth,s,this.positions,this.slider.min,this.slider.max);const n="16px Roboto, Roboto Local, sans-serif",l=.25,c=12.2;for(let e=r;e<=o;e++)this.positions[e].render(a,(e=>this.unitsHandler.isGap(e)),n,l,c,this.palette)}finally{a.restore()}v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.renderInt( recalcLevel=${e} ), end`)}}renderRequestOnDebounce(e){const t=`${this.viewerToLog()}.renderRequestOnDebounce()`;"HTML"!==a()(this.root).offsetParent().get()[0]?.tagName?(this.requestedRenderLevel=_.None,this.renderInt(e).catch((e=>{const[t,s]=(0,f.yf)(e);v._package.logger.error(t,void 0,s)}))):v._package.logger.warning(`${t}, $(this.root).offsetParent() is the 'HTML' tag.`)}getAlphabetSize(){return this.unitsHandler?.getAlphabetSize()??0}sliderOnValuesChanged(e){try{const e={minRange:this.slider.minRange,min:this.slider.min,max:this.slider.max,maxRange:this.slider.maxRange};v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.sliderOnValuesChanged( ${JSON.stringify(e)} ), start`),this.render(_.Layout,"sliderOnValuesChanged")}catch(e){const t=p(e);v._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.sliderOnValuesChanged() error:\n`+t)}}dataFrameFilterOnChanged(e){v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameFilterChanged()`);try{this.filterSource===m.Ct.Filtered&&this.render(_.Freqs,"dataFrameFilterOnChanged")}catch(e){const t=p(e);v._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameFilterOnChanged() error:\n`+t)}}dataFrameSelectionOnChanged(e){v._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameSelectionOnChanged()`);try{this.filterSource===m.Ct.Selected&&this.render(_.Freqs,"dataFrameSelectionOnChanged")}catch(e){const t=p(e);v._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameSelectionOnChanged() error:\n`+t)}}canvasOnMouseMove(e){const t=window.devicePixelRatio;try{const s=e,n=this.canvas.getCursorPosition(s,t),[o,a]=this.getMonomer(n,t),l=this.showPositionLabels?12*t:0;if(null!==o&&null===a&&0<=n.y&&n.y<=l){const e=[r.divText(`Position ${o.label}`)];this.valueAggrType===i.AGG.TOTAL_COUNT&&e.push(o.buildCompositionTable(this.palette));const t=r.divV(e);r.tooltip.show(t,s.x+16,s.y+16)}else if(null!==o&&a&&this.dataFrame&&this.seqCol&&this.unitsHandler){const e=o.getFreq(a),t=[r.div(`${a}`),r.div(`${e.rowCount} rows`)];this.valueAggrType!==i.AGG.TOTAL_COUNT&&t.push(r.div(`${this.valueAggrType}: ${e.value.toFixed(3)}`));const n=r.divV(t);r.tooltip.show(n,s.x+16,s.y+16)}else r.tooltip.hide()}catch(e){const t=p(e);v._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnMouseMove() error:\n`+t)}}canvasOnMouseDown(e){try{const t=e,s=window.devicePixelRatio,[n,r]=this.getMonomer(this.canvas.getCursorPosition(t,s),s);if(null!==n&&null!==r&&this.dataFrame&&this.seqCol&&this.unitsHandler){const e=i.BitSet.create(this.dataFrame.selection.length,(e=>function(e,t,s,n,r,i){const o=t.splitted[n],a=i.pos<o.length?o[i.pos]:null;return a===r||""===a&&r===t.defaultGapSymbol}(this.dataFrame,this.unitsHandler,this.getFilter(),e,r,n)));this.dataFrame.selection.init((t=>e.get(t)))}}catch(e){const t=p(e);v._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnMouseDown() error:\n`+t)}}canvasOnWheel(e){const t=window.devicePixelRatio;try{if(!this.visibleSlider)return;const s=this.canvas.width/(this._positionWidthWithMargin*t),n=e.deltaY/100*Math.max(Math.floor(s/5),1);this.slider.scrollBy(this.slider.min+n)}catch(e){const t=p(e);v._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnWheel() error:\n`+t)}}get onRendered(){return this._onRendered}invalidate(e){const t=`invalidate(${e?` <- ${e} `:""})`,s=`${this.viewerToLog()}.${t}`;this.viewSyncer.sync(`${s}`,(async()=>{this.render(_.None,t),this._onRendered.next()}))}async awaitRendered(e=5e3){await(0,g.zg)(this.onRendered,(()=>{}),(()=>{this.invalidate()}),e);const t=this.viewSyncer.resetErrors();if(t.length>0)throw t[0]}}function $(e,t,s,n,r){let i=0,o=-1;for(;-1!=(o=s.findNext(o,!0));){const e=t.splitted[o],s=r.pos;(s<e.length?e[s]:null)===n&&i++}return i}P.residuesSet="nucleotides",P.viewerCounter=-1},8755:(e,t,s)=>{"use strict";s.d(t,{Y:()=>o,x:()=>i});var n=s(701),r=s(3348);class i{get onChanged(){return this._onChanged}constructor(e){return this.substructure=e,this._onChanged=new n.Subject,new Proxy(this,{set:(e,t,s)=>(r._package.logger.debug(`BioFilterProps.set ${t.toString()}( '${s}' )`),e[t]=s,this._onChanged.next(),!0)})}save(){const e={};for(const[t,s]of Object.entries(this))"_onChanged"!==t&&(e[t]=this[t]);return e}apply(e){for(const[t,s]of Object.entries(this))"_onChanged"!==t&&(this[t]=e[t])}}class o{constructor(){this.onChanged=new n.Subject,this._propsChanging=!1,this._propsOnChangedSub=null}get props(){return this._props||(this._props=this.emptyProps),this._props}set props(e){this._propsChanging=!0;try{this._propsOnChangedSub&&(this._propsOnChangedSub.unsubscribe(),this._propsOnChangedSub=null),this._props=e,this.applyProps(),this.onChanged.next(),this._propsOnChangedSub=this._props.onChanged.subscribe((()=>{this.onChanged.next()}))}finally{this._propsChanging=!1}}async detach(){this._propsOnChangedSub&&(this._propsOnChangedSub.unsubscribe(),this._propsOnChangedSub=null)}get filterSummary(){return this.props.substructure}get isFiltering(){return""!==this.props.substructure}resetFilter(){this.props=this.emptyProps,this.onChanged.next()}}},5393:(e,t,s)=>{"use strict";s.d(t,{ST:()=>S,LH:()=>A});var n=s(3870),r=s(976),i=s(4469),o=s(6414),a=s.n(o),l=s(701),c=s(8447),h=s(8467),u=s(499),d=s(172),m=s(7983),p=s(8755),f=s(3336),g=s.n(f),y=s(7945),b=s(4293),w=s(3348);class C extends p.Y{viewerToLog(){return`HelmBioFilter<${this.viewerId}>`}get type(){return"HelmBioFilter"}constructor(){super(),this.emptyProps=new p.x(""),this._filterPanel=n.div("",{style:{cursor:"pointer"}}),this.viewerId=++C.viewerCounter,this.viewSubs=[],this.logger=w._package.logger}async detach(){await super.detach();for(const e of this.viewSubs)e.unsubscribe()}async attach(){this.viewerToLog();try{const e=await async function(){const e="Helm",t=r.Func.find({package:e,name:"getHelmHelper"});if(0===t.length)throw new Error(`Package '${e}' must be installed for HelmHelper.`);return(await t[0].prepare().call()).getOutputParamValue()}();let t,s;this.helmEditor=e.createHelmWebEditor(),this.logger.warning("TEST: HelmBioFilter.init().sync() waitForElementInDom waiting..."),await n.tools.waitForElementInDom(this._filterPanel),this.logger.warning("TEST: HelmBioFilter.init().sync() waitForElementInDom ready"),this.updateFilterPanel(),this.viewSubs.push((0,l.fromEvent)(this._filterPanel,"click").subscribe((()=>{t=n.div(),s=e.createWebEditorApp(t,this.props.substructure),n.dialog({showHeader:!1,showFooter:!0}).add(t).onOK((()=>{try{const e=s.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.props=new p.x(e)}catch(e){this.logger.error(e)}finally{g()(t).empty(),t=null,s=null}})).onCancel((()=>{g()(t).empty(),t=null,s=null})).show({modal:!0,fullScreen:!0})}))),this.viewSubs.push(n.onSizeChanged(this._filterPanel).subscribe((e=>{try{if(s){const e=s.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.updateFilterPanel(e)}}catch(e){const[t,s]=(0,y.yf)(e);this.logger.error(t,void 0,s)}})))}catch(e){const[t,s]=(0,y.yf)(e),r=this._filterPanel;r.innerText="error",r.classList.add("d4-error"),n.tooltip.bind(r,t)}}applyProps(){this.helmEditor&&this.updateFilterPanel(this.props.substructure)}get filterPanel(){return this._filterPanel}updateFilterPanel(e){if(!this.helmEditor)throw new Error("helmEditor is not created, the filter is not in dom yet");const t=this._filterPanel.parentElement.clientWidth<100?100:this._filterPanel.parentElement.clientWidth,s=t/2;if(e)(0,b.Y)(this._filterPanel,this.helmEditor.host),this.helmEditor.editor.setHelm(e),this.helmEditor.resizeEditor(t,s);else{const e=n.divText("Click to edit","helm-substructure-filter");(0,b.Y)(this._filterPanel,e)}}async substructureSearch(e){return await(0,h.gw)(10),await(0,m.QF)(this.props.substructure,e)}}C.viewerCounter=-1;const v="bio-substructure-filter";class T{constructor(e,t,s,n,r){this.props=e,this.filterId=t,this.dataFrameId=s,this.columnName=n,this.bitset=r}}class A extends p.x{constructor(e,t){super(e),this.separator=t}}class S extends r.Filter{get calculating(){return"initial"==this.loader.style.display}set calculating(e){this.loader.style.display=e?"initial":"none"}get filterSummary(){return this.bioFilter.filterSummary}get isFiltering(){return super.isFiltering&&(this.bioFilter?.isFiltering??!1)}get isReadyToApplyFilter(){return!this.calculating&&null!=this.bitset}get debounceTime(){if(null==this.column)return 1e3;const e=this.column.length;return e<500?0:e>1e4?1e3:Math.floor((e-500)/9500*1e3)}constructor(){return super(),this.bioFilter=null,this.bitset=null,this.notation=void 0,this.filterId=++S.filterCounter,this.viewSubs=[],this._onRendered=new l.Subject,this.root=n.divV([]),this.loader=n.loader(),this.calculating=!1,this.filterSyncer=new d.c(this.logger=w._package.logger),new Proxy(this,{set:(e,t,s)=>(e[t]=s,!0)})}filterToLog(){return`BioSubstructureFilter<${this.filterId}>`}attach(e){const t=super.attach.bind(this),s=`${this.filterToLog()}.attach()`;this.filterSyncer.sync(s,(async()=>{t(e),this.column=e.columns.bySemType(r.SEMTYPE.MACROMOLECULE),u.Cn.getOrCreate(this.column),this.columnName??(this.columnName=this.column?.name),this.notation??(this.notation=this.column?.getTag(r.TAGS.UNITS)),this.bioFilter=this.notation===c.r2.FASTA?new _:this.notation===c.r2.SEPARATOR?new E(this.column.getTag("separator")):new C,this.root.appendChild(this.bioFilter.filterPanel),this.root.appendChild(this.loader),await this.bioFilter.attach(),this.viewSubs.push(r.debounce(this.bioFilter.onChanged,this.debounceTime).subscribe(this.bioFilterOnChangedDebounced.bind(this))),this.viewSubs.push(i.events.onResetFilterRequest.subscribe((e=>{this.bioFilter?.resetFilter()}))),this.viewSubs.push(i.events.onCustomEvent(v).subscribe(this.filterOnSync.bind(this)))}))}detach(){const e=super.detach.bind(this),t=`${this.filterToLog()}.detach()`;this.filterSyncer.sync(t,(async()=>{for(const e of this.viewSubs)e.unsubscribe();this.viewSubs=[],e(),this.bioFilter&&this.bioFilter.detach(),this.bioFilter=null}))}filterOnSync(e){e.filterId!==this.filterId&&e.dataFrameId===this.dataFrame.id&&e.columnName===this.columnName&&(this.bioFilter.props=e.props)}applyFilter(){this.bitset&&!this.isDetached&&this.dataFrame?.filter.and(this.bitset)}saveState(){const e=super.saveState();return e.props=this.bioFilter.props.save(),e}applyState(e){super.applyState(e),e.props&&this.bioFilter.props.apply(e.props)}fireFilterSync(){const e=`${this.filterToLog()}.fireFilterSync()`;w._package.logger.debug(`${e}, bioFilter = ${this.bioFilter?this.bioFilter.constructor.name:"null"}`+(this.bioFilter?`, props = ${JSON.stringify(this.bioFilter.props.save())}`:"")),i.events.fireCustomEvent(v,new T(this.bioFilter.props,this.filterId,this.dataFrame.id,this.columnName,this.bitset))}bioFilterOnChangedDebounced(){if(!this.dataFrame)return;const e=`${this.filterToLog()}.bioFilterOnChangedDebounced()`;if(w._package.logger.debug(`${e}, start, isFiltering = ${this.isFiltering}, props = ${JSON.stringify(this.bioFilter.props.save())}`),!this.isFiltering)return this.bitset=null,void this.dataFrame.rows.requestFilter();a()(this.dataFrame.rows.filters).has(`${this.columnName}: ${this.filterSummary}`)||this.filterSyncer.sync(e,(async()=>{this.calculating=!0;try{w._package.logger.debug(`${e}, before substructureSearch`),this.bitset=await(this.bioFilter?.substructureSearch(this.column)),w._package.logger.debug(`${e}, after substructureSearch`),this.calculating=!1,this.fireFilterSync(),this.dataFrame?.rows.requestFilter()}finally{this.calculating=!1,w._package.logger.debug(`${e}, end`)}}))}get onRendered(){return this._onRendered}invalidate(e){const t=`${this.filterToLog()}.invalidate(${e?` <- ${e} `:""})`;this.filterSyncer.sync(t,(async()=>{this._onRendered.next()}))}async awaitRendered(e=1e4){const t=`awaitRendered( ${e} )`,s=`${this.filterToLog()}.${t}`;await(0,h.gw)(0),await(0,h.zg)(this.onRendered,(()=>{this.logger.debug(`${s}, _onRendered event caught`)}),(()=>{this.invalidate(t)}),e,`${s} ${e} timeout`);const n=this.filterSyncer.resetErrors();if(n.length>0)throw n[0]}}S.filterCounter=-1;class _ extends p.Y{get type(){return"FastaBioFilter"}constructor(){super(),this.emptyProps=new p.x(""),this.substructureInput=n.stringInput("","",(()=>{this.props.substructure=this.substructureInput.value,this._propsChanging||this.onChanged.next()}),{placeholder:"Substructure"})}applyProps(){this.substructureInput.value=this.props.substructure}get filterPanel(){return this.substructureInput.root}get isFiltering(){return""!==this.substructureInput.value}async substructureSearch(e){return(0,m.pf)(this.props.substructure,e)}async attach(){}async detach(){await super.detach()}}class E extends p.Y{get type(){return"SeparatorBioFilter"}constructor(e){super(),this.emptyProps=new A(""),this.colSeparator="",this.substructureInput=n.stringInput("","",(()=>{this.props.substructure=this.substructureInput.value,this._propsChanging||this.onChanged.next()}),{placeholder:"Substructure"}),this.separatorInput=n.stringInput("",this.colSeparator=e,(()=>{this.props.separator=this.separatorInput.value?this.separatorInput.value:void 0,this._propsChanging||this.onChanged.next()}),{placeholder:"Separator"})}applyProps(){this.substructureInput.value=this.props.substructure,this.separatorInput.value=this.props.separator??this.colSeparator}get filterSummary(){return this.props.separator?this.props.separator:this.colSeparator,`${this.props.substructure}, {sep}`}get isFiltering(){return""!==this.props.substructure}resetFilter(){this.props=new A("")}get filterPanel(){return n.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(e){this.substructureInput.value=e}async substructureSearch(e){return(0,m.pf)(this.substructure,e,this.colSeparator)}async attach(){}async detach(){await super.detach()}}},8770:(e,t,s)=>{"use strict";s.d(t,{_:()=>b});var n=s(3870),r=(s(976),s(6414),s(8447),s(7331),s(3379)),i=s.n(r),o=s(7795),a=s.n(o),l=s(569),c=s.n(l),h=s(3565),u=s.n(h),d=s(9216),m=s.n(d),p=s(4589),f=s.n(p),g=s(5362),y={};function b(e,t){let s=0,r=null;for(const e of Object.values(t))s+=e,r=null===r?e:Math.max(r,e);const i=r/s,o=Object.assign({},...Array.from(Object.entries(t)).sort(((e,t)=>t[1]-e[1])).map((([t,r])=>{const o=r/s,a=e.get(t),l=n.div("",{classes:"macromolecule-cell-comp-analysis-bar"});l.style.width=50*o/i+"px",l.style.backgroundColor=a;const c=n.div(`${(100*o).toFixed(2)}%`);return{[t]:n.div([l,c],{classes:"macromolecule-cell-comp-analysis-value"})}}))),a=n.tableFromMap(o);return Array.from(a.rows).forEach((e=>{const t=e.getElementsByClassName("macromolecule-cell-comp-analysis-bar")[0].style.backgroundColor;e.cells[0].style.color=t})),a}y.styleTagTransform=f(),y.setAttributes=u(),y.insert=c().bind(null,"head"),y.domAPI=a(),y.insertStyleElement=m(),i()(g.Z,y),g.Z&&g.Z.locals&&g.Z.locals,s(499)},540:function(e,t){!function(e){"use strict";function t(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];if(t.length>1){t[0]=t[0].slice(0,-1);for(var n=t.length-1,r=1;r<n;++r)t[r]=t[r].slice(1,-1);return t[n]=t[n].slice(1),t.join("")}return t[0]}function s(e){return"(?:"+e+")"}function n(e){return void 0===e?"undefined":null===e?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function r(e){return e.toUpperCase()}function i(e){var n="[A-Za-z]",r="[0-9]",i=t(r,"[A-Fa-f]"),o=s(s("%[EFef]"+i+"%"+i+i+"%"+i+i)+"|"+s("%[89A-Fa-f]"+i+"%"+i+i)+"|"+s("%"+i+i)),a="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",l=t("[\\:\\/\\?\\#\\[\\]\\@]",a),c=e?"[\\uE000-\\uF8FF]":"[]",h=t(n,r,"[\\-\\.\\_\\~]",e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]"),u=s(n+t(n,r,"[\\+\\-\\.]")+"*"),d=s(s(o+"|"+t(h,a,"[\\:]"))+"*"),m=(s(s("25[0-5]")+"|"+s("2[0-4]"+r)+"|"+s("1"+r+r)+"|"+s("[1-9]"+r)+"|"+r),s(s("25[0-5]")+"|"+s("2[0-4]"+r)+"|"+s("1"+r+r)+"|"+s("0?[1-9]"+r)+"|0?0?"+r)),p=s(m+"\\."+m+"\\."+m+"\\."+m),f=s(i+"{1,4}"),g=s(s(f+"\\:"+f)+"|"+p),y=s(s(f+"\\:")+"{6}"+g),b=s("\\:\\:"+s(f+"\\:")+"{5}"+g),w=s(s(f)+"?\\:\\:"+s(f+"\\:")+"{4}"+g),C=s(s(s(f+"\\:")+"{0,1}"+f)+"?\\:\\:"+s(f+"\\:")+"{3}"+g),v=s(s(s(f+"\\:")+"{0,2}"+f)+"?\\:\\:"+s(f+"\\:")+"{2}"+g),T=s(s(s(f+"\\:")+"{0,3}"+f)+"?\\:\\:"+f+"\\:"+g),A=s(s(s(f+"\\:")+"{0,4}"+f)+"?\\:\\:"+g),S=s(s(s(f+"\\:")+"{0,5}"+f)+"?\\:\\:"+f),_=s(s(s(f+"\\:")+"{0,6}"+f)+"?\\:\\:"),E=s([y,b,w,C,v,T,A,S,_].join("|")),P=s(s(h+"|"+o)+"+"),$=(s(E+"\\%25"+P),s(E+s("\\%25|\\%(?!"+i+"{2})")+P)),x=s("[vV]"+i+"+\\."+t(h,a,"[\\:]")+"+"),N=s("\\["+s($+"|"+E+"|"+x)+"\\]"),M=s(s(o+"|"+t(h,a))+"*"),L=s(N+"|"+p+"(?!"+M+")|"+M),I=s(r+"*"),R=s(s(d+"@")+"?"+L+s("\\:"+I)+"?"),O=s(o+"|"+t(h,a,"[\\:\\@]")),k=s(O+"*"),F=s(O+"+"),D=s(s(o+"|"+t(h,a,"[\\@]"))+"+"),G=s(s("\\/"+k)+"*"),H=s("\\/"+s(F+G)+"?"),W=s(D+G),B=s(F+G),V="(?!"+O+")",U=(s(G+"|"+H+"|"+W+"|"+B+"|"+V),s(s(O+"|"+t("[\\/\\?]",c))+"*")),j=s(s(O+"|[\\/\\?]")+"*"),Y=s(s("\\/\\/"+R+G)+"|"+H+"|"+B+"|"+V),K=s(u+"\\:"+Y+s("\\?"+U)+"?"+s("\\#"+j)+"?"),q=s(s("\\/\\/"+R+G)+"|"+H+"|"+W+"|"+V),Z=s(q+s("\\?"+U)+"?"+s("\\#"+j)+"?");return s(K+"|"+Z),s(u+"\\:"+Y+s("\\?"+U)+"?"),s(s("\\/\\/("+s("("+d+")@")+"?("+L+")"+s("\\:("+I+")")+"?)")+"?("+G+"|"+H+"|"+B+"|"+V+")"),s("\\?("+U+")"),s("\\#("+j+")"),s(s("\\/\\/("+s("("+d+")@")+"?("+L+")"+s("\\:("+I+")")+"?)")+"?("+G+"|"+H+"|"+W+"|"+V+")"),s("\\?("+U+")"),s("\\#("+j+")"),s(s("\\/\\/("+s("("+d+")@")+"?("+L+")"+s("\\:("+I+")")+"?)")+"?("+G+"|"+H+"|"+B+"|"+V+")"),s("\\?("+U+")"),s("\\#("+j+")"),s("("+d+")@"),s("\\:("+I+")"),{NOT_SCHEME:new RegExp(t("[^]",n,r,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(t("[^\\%\\:]",h,a),"g"),NOT_HOST:new RegExp(t("[^\\%\\[\\]\\:]",h,a),"g"),NOT_PATH:new RegExp(t("[^\\%\\/\\:\\@]",h,a),"g"),NOT_PATH_NOSCHEME:new RegExp(t("[^\\%\\/\\@]",h,a),"g"),NOT_QUERY:new RegExp(t("[^\\%]",h,a,"[\\:\\@\\/\\?]",c),"g"),NOT_FRAGMENT:new RegExp(t("[^\\%]",h,a,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(t("[^]",h,a),"g"),UNRESERVED:new RegExp(h,"g"),OTHER_CHARS:new RegExp(t("[^\\%]",h,l),"g"),PCT_ENCODED:new RegExp(o,"g"),IPV4ADDRESS:new RegExp("^("+p+")$"),IPV6ADDRESS:new RegExp("^\\[?("+E+")"+s(s("\\%25|\\%(?!"+i+"{2})")+"("+P+")")+"?\\]?$")}}var o=i(!1),a=i(!0),l=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var s=[],n=!0,r=!1,i=void 0;try{for(var o,a=e[Symbol.iterator]();!(n=(o=a.next()).done)&&(s.push(o.value),!t||s.length!==t);n=!0);}catch(e){r=!0,i=e}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}return s}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},c=2147483647,h=36,u=/^xn--/,d=/[^\0-\x7E]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,g=String.fromCharCode;function y(e){throw new RangeError(p[e])}function b(e,t){var s=e.split("@"),n="";return s.length>1&&(n=s[0]+"@",e=s[1]),n+function(e,t){for(var s=[],n=e.length;n--;)s[n]=t(e[n]);return s}((e=e.replace(m,".")).split("."),t).join(".")}function w(e){for(var t=[],s=0,n=e.length;s<n;){var r=e.charCodeAt(s++);if(r>=55296&&r<=56319&&s<n){var i=e.charCodeAt(s++);56320==(64512&i)?t.push(((1023&r)<<10)+(1023&i)+65536):(t.push(r),s--)}else t.push(r)}return t}var C=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},v=function(e,t,s){var n=0;for(e=s?f(e/700):e>>1,e+=f(e/t);e>455;n+=h)e=f(e/35);return f(n+36*e/(e+38))},T=function(e){var t,s=[],n=e.length,r=0,i=128,o=72,a=e.lastIndexOf("-");a<0&&(a=0);for(var l=0;l<a;++l)e.charCodeAt(l)>=128&&y("not-basic"),s.push(e.charCodeAt(l));for(var u=a>0?a+1:0;u<n;){for(var d=r,m=1,p=h;;p+=h){u>=n&&y("invalid-input");var g=(t=e.charCodeAt(u++))-48<10?t-22:t-65<26?t-65:t-97<26?t-97:h;(g>=h||g>f((c-r)/m))&&y("overflow"),r+=g*m;var b=p<=o?1:p>=o+26?26:p-o;if(g<b)break;var w=h-b;m>f(c/w)&&y("overflow"),m*=w}var C=s.length+1;o=v(r-d,C,0==d),f(r/C)>c-i&&y("overflow"),i+=f(r/C),r%=C,s.splice(r++,0,i)}return String.fromCodePoint.apply(String,s)},A=function(e){var t=[],s=(e=w(e)).length,n=128,r=0,i=72,o=!0,a=!1,l=void 0;try{for(var u,d=e[Symbol.iterator]();!(o=(u=d.next()).done);o=!0){var m=u.value;m<128&&t.push(g(m))}}catch(e){a=!0,l=e}finally{try{!o&&d.return&&d.return()}finally{if(a)throw l}}var p=t.length,b=p;for(p&&t.push("-");b<s;){var T=c,A=!0,S=!1,_=void 0;try{for(var E,P=e[Symbol.iterator]();!(A=(E=P.next()).done);A=!0){var $=E.value;$>=n&&$<T&&(T=$)}}catch(e){S=!0,_=e}finally{try{!A&&P.return&&P.return()}finally{if(S)throw _}}var x=b+1;T-n>f((c-r)/x)&&y("overflow"),r+=(T-n)*x,n=T;var N=!0,M=!1,L=void 0;try{for(var I,R=e[Symbol.iterator]();!(N=(I=R.next()).done);N=!0){var O=I.value;if(O<n&&++r>c&&y("overflow"),O==n){for(var k=r,F=h;;F+=h){var D=F<=i?1:F>=i+26?26:F-i;if(k<D)break;var G=k-D,H=h-D;t.push(g(C(D+G%H,0))),k=f(G/H)}t.push(g(C(k,0))),i=v(r,x,b==p),r=0,++b}}}catch(e){M=!0,L=e}finally{try{!N&&R.return&&R.return()}finally{if(M)throw L}}++r,++n}return t.join("")},S={version:"2.1.0",ucs2:{decode:w,encode:function(e){return String.fromCodePoint.apply(String,function(e){if(Array.isArray(e)){for(var t=0,s=Array(e.length);t<e.length;t++)s[t]=e[t];return s}return Array.from(e)}(e))}},decode:T,encode:A,toASCII:function(e){return b(e,(function(e){return d.test(e)?"xn--"+A(e):e}))},toUnicode:function(e){return b(e,(function(e){return u.test(e)?T(e.slice(4).toLowerCase()):e}))}},_={};function E(e){var t=e.charCodeAt(0);return t<16?"%0"+t.toString(16).toUpperCase():t<128?"%"+t.toString(16).toUpperCase():t<2048?"%"+(t>>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function P(e){for(var t="",s=0,n=e.length;s<n;){var r=parseInt(e.substr(s+1,2),16);if(r<128)t+=String.fromCharCode(r),s+=3;else if(r>=194&&r<224){if(n-s>=6){var i=parseInt(e.substr(s+4,2),16);t+=String.fromCharCode((31&r)<<6|63&i)}else t+=e.substr(s,6);s+=6}else if(r>=224){if(n-s>=9){var o=parseInt(e.substr(s+4,2),16),a=parseInt(e.substr(s+7,2),16);t+=String.fromCharCode((15&r)<<12|(63&o)<<6|63&a)}else t+=e.substr(s,9);s+=9}else t+=e.substr(s,3),s+=3}return t}function $(e,t){function s(e){var s=P(e);return s.match(t.UNRESERVED)?s:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,s).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,s).replace(t.NOT_USERINFO,E).replace(t.PCT_ENCODED,r)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,s).toLowerCase().replace(t.NOT_HOST,E).replace(t.PCT_ENCODED,r)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,s).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,E).replace(t.PCT_ENCODED,r)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,s).replace(t.NOT_QUERY,E).replace(t.PCT_ENCODED,r)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,s).replace(t.NOT_FRAGMENT,E).replace(t.PCT_ENCODED,r)),e}function x(e){return e.replace(/^0*(.*)/,"$1")||"0"}function N(e,t){var s=e.match(t.IPV4ADDRESS)||[],n=l(s,2)[1];return n?n.split(".").map(x).join("."):e}function M(e,t){var s=e.match(t.IPV6ADDRESS)||[],n=l(s,3),r=n[1],i=n[2];if(r){for(var o=r.toLowerCase().split("::").reverse(),a=l(o,2),c=a[0],h=a[1],u=h?h.split(":").map(x):[],d=c.split(":").map(x),m=t.IPV4ADDRESS.test(d[d.length-1]),p=m?7:8,f=d.length-p,g=Array(p),y=0;y<p;++y)g[y]=u[y]||d[f+y]||"";m&&(g[p-1]=N(g[p-1],t));var b=g.reduce((function(e,t,s){if(!t||"0"===t){var n=e[e.length-1];n&&n.index+n.length===s?n.length++:e.push({index:s,length:1})}return e}),[]).sort((function(e,t){return t.length-e.length}))[0],w=void 0;if(b&&b.length>1){var C=g.slice(0,b.index),v=g.slice(b.index+b.length);w=C.join(":")+"::"+v.join(":")}else w=g.join(":");return i&&(w+="%"+i),w}return e}var L=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,I=void 0==="".match(/(){0}/)[1];function R(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s={},n=!1!==t.iri?a:o;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var r=e.match(L);if(r){I?(s.scheme=r[1],s.userinfo=r[3],s.host=r[4],s.port=parseInt(r[5],10),s.path=r[6]||"",s.query=r[7],s.fragment=r[8],isNaN(s.port)&&(s.port=r[5])):(s.scheme=r[1]||void 0,s.userinfo=-1!==e.indexOf("@")?r[3]:void 0,s.host=-1!==e.indexOf("//")?r[4]:void 0,s.port=parseInt(r[5],10),s.path=r[6]||"",s.query=-1!==e.indexOf("?")?r[7]:void 0,s.fragment=-1!==e.indexOf("#")?r[8]:void 0,isNaN(s.port)&&(s.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?r[4]:void 0)),s.host&&(s.host=M(N(s.host,n),n)),void 0!==s.scheme||void 0!==s.userinfo||void 0!==s.host||void 0!==s.port||s.path||void 0!==s.query?void 0===s.scheme?s.reference="relative":void 0===s.fragment?s.reference="absolute":s.reference="uri":s.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==s.reference&&(s.error=s.error||"URI is not a "+t.reference+" reference.");var i=_[(t.scheme||s.scheme||"").toLowerCase()];if(t.unicodeSupport||i&&i.unicodeSupport)$(s,n);else{if(s.host&&(t.domainHost||i&&i.domainHost))try{s.host=S.toASCII(s.host.replace(n.PCT_ENCODED,P).toLowerCase())}catch(e){s.error=s.error||"Host's domain name can not be converted to ASCII via punycode: "+e}$(s,o)}i&&i.parse&&i.parse(s,t)}else s.error=s.error||"URI can not be parsed.";return s}var O=/^\.\.?\//,k=/^\/\.(\/|$)/,F=/^\/\.\.(\/|$)/,D=/^\/?(?:.|\n)*?(?=\/|$)/;function G(e){for(var t=[];e.length;)if(e.match(O))e=e.replace(O,"");else if(e.match(k))e=e.replace(k,"/");else if(e.match(F))e=e.replace(F,"/"),t.pop();else if("."===e||".."===e)e="";else{var s=e.match(D);if(!s)throw new Error("Unexpected dot segment condition");var n=s[0];e=e.slice(n.length),t.push(n)}return t.join("")}function H(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=t.iri?a:o,n=[],r=_[(t.scheme||e.scheme||"").toLowerCase()];if(r&&r.serialize&&r.serialize(e,t),e.host)if(s.IPV6ADDRESS.test(e.host));else if(t.domainHost||r&&r.domainHost)try{e.host=t.iri?S.toUnicode(e.host):S.toASCII(e.host.replace(s.PCT_ENCODED,P).toLowerCase())}catch(s){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+s}$(e,s),"suffix"!==t.reference&&e.scheme&&(n.push(e.scheme),n.push(":"));var i=function(e,t){var s=!1!==t.iri?a:o,n=[];return void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host&&n.push(M(N(String(e.host),s),s).replace(s.IPV6ADDRESS,(function(e,t,s){return"["+t+(s?"%25"+s:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(n.push(":"),n.push(String(e.port))),n.length?n.join(""):void 0}(e,t);if(void 0!==i&&("suffix"!==t.reference&&n.push("//"),n.push(i),e.path&&"/"!==e.path.charAt(0)&&n.push("/")),void 0!==e.path){var l=e.path;t.absolutePath||r&&r.absolutePath||(l=G(l)),void 0===i&&(l=l.replace(/^\/\//,"/%2F")),n.push(l)}return void 0!==e.query&&(n.push("?"),n.push(e.query)),void 0!==e.fragment&&(n.push("#"),n.push(e.fragment)),n.join("")}function W(e,t){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={};return arguments[3]||(e=R(H(e,s),s),t=R(H(t,s),s)),!(s=s||{}).tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=G(t.path||""),n.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=G(t.path||""),n.query=t.query):(t.path?("/"===t.path.charAt(0)?n.path=G(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path:n.path="/"+t.path,n.path=G(n.path)),n.query=t.query):(n.path=e.path,void 0!==t.query?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function B(e,t){return e&&e.toString().replace(t&&t.iri?a.PCT_ENCODED:o.PCT_ENCODED,P)}var V={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var s="https"===String(e.scheme).toLowerCase();return e.port!==(s?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},U={scheme:"https",domainHost:V.domainHost,parse:V.parse,serialize:V.serialize};function j(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var Y={scheme:"ws",domainHost:!0,parse:function(e,t){var s=e;return s.secure=j(s),s.resourceName=(s.path||"/")+(s.query?"?"+s.query:""),s.path=void 0,s.query=void 0,s},serialize:function(e,t){if(e.port!==(j(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var s=e.resourceName.split("?"),n=l(s,2),r=n[0],i=n[1];e.path=r&&"/"!==r?r:void 0,e.query=i,e.resourceName=void 0}return e.fragment=void 0,e}},K={scheme:"wss",domainHost:Y.domainHost,parse:Y.parse,serialize:Y.serialize},q={},Z="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",z="[0-9A-Fa-f]",X=s(s("%[EFef]"+z+"%"+z+z+"%"+z+z)+"|"+s("%[89A-Fa-f]"+z+"%"+z+z)+"|"+s("%"+z+z)),J=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),Q=new RegExp(Z,"g"),ee=new RegExp(X,"g"),te=new RegExp(t("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',J),"g"),se=new RegExp(t("[^]",Z,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),ne=se;function re(e){var t=P(e);return t.match(Q)?t:e}var ie={scheme:"mailto",parse:function(e,t){var s=e,n=s.to=s.path?s.path.split(","):[];if(s.path=void 0,s.query){for(var r=!1,i={},o=s.query.split("&"),a=0,l=o.length;a<l;++a){var c=o[a].split("=");switch(c[0]){case"to":for(var h=c[1].split(","),u=0,d=h.length;u<d;++u)n.push(h[u]);break;case"subject":s.subject=B(c[1],t);break;case"body":s.body=B(c[1],t);break;default:r=!0,i[B(c[0],t)]=B(c[1],t)}}r&&(s.headers=i)}s.query=void 0;for(var m=0,p=n.length;m<p;++m){var f=n[m].split("@");if(f[0]=B(f[0]),t.unicodeSupport)f[1]=B(f[1],t).toLowerCase();else try{f[1]=S.toASCII(B(f[1],t).toLowerCase())}catch(e){s.error=s.error||"Email address's domain name can not be converted to ASCII via punycode: "+e}n[m]=f.join("@")}return s},serialize:function(e,t){var s,n=e,i=null!=(s=e.to)?s instanceof Array?s:"number"!=typeof s.length||s.split||s.setInterval||s.call?[s]:Array.prototype.slice.call(s):[];if(i){for(var o=0,a=i.length;o<a;++o){var l=String(i[o]),c=l.lastIndexOf("@"),h=l.slice(0,c).replace(ee,re).replace(ee,r).replace(te,E),u=l.slice(c+1);try{u=t.iri?S.toUnicode(u):S.toASCII(B(u,t).toLowerCase())}catch(e){n.error=n.error||"Email address's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+e}i[o]=h+"@"+u}n.path=i.join(",")}var d=e.headers=e.headers||{};e.subject&&(d.subject=e.subject),e.body&&(d.body=e.body);var m=[];for(var p in d)d[p]!==q[p]&&m.push(p.replace(ee,re).replace(ee,r).replace(se,E)+"="+d[p].replace(ee,re).replace(ee,r).replace(ne,E));return m.length&&(n.query=m.join("&")),n}},oe=/^([^\:]+)\:(.*)/,ae={scheme:"urn",parse:function(e,t){var s=e.path&&e.path.match(oe),n=e;if(s){var r=t.scheme||n.scheme||"urn",i=s[1].toLowerCase(),o=s[2],a=r+":"+(t.nid||i),l=_[a];n.nid=i,n.nss=o,n.path=void 0,l&&(n=l.parse(n,t))}else n.error=n.error||"URN can not be parsed.";return n},serialize:function(e,t){var s=t.scheme||e.scheme||"urn",n=e.nid,r=s+":"+(t.nid||n),i=_[r];i&&(e=i.serialize(e,t));var o=e,a=e.nss;return o.path=(n||t.nid)+":"+a,o}},le=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,ce={scheme:"urn:uuid",parse:function(e,t){var s=e;return s.uuid=s.nss,s.nss=void 0,t.tolerant||s.uuid&&s.uuid.match(le)||(s.error=s.error||"UUID is not valid."),s},serialize:function(e,t){var s=e;return s.nss=(e.uuid||"").toLowerCase(),s}};_[V.scheme]=V,_[U.scheme]=U,_[Y.scheme]=Y,_[K.scheme]=K,_[ie.scheme]=ie,_[ae.scheme]=ae,_[ce.scheme]=ce,e.SCHEMES=_,e.pctEncChar=E,e.pctDecChars=P,e.parse=R,e.removeDotSegments=G,e.serialize=H,e.resolveComponents=W,e.resolve=function(e,t,s){var n=function(e,t){var s=e;if(t)for(var n in t)s[n]=t[n];return s}({scheme:"null"},s);return H(W(R(e,n),R(t,n),n,!0),n)},e.normalize=function(e,t){return"string"==typeof e?e=H(R(e,t),t):"object"===n(e)&&(e=R(H(e,t),t)),e},e.equal=function(e,t,s){return"string"==typeof e?e=H(R(e,s),s):"object"===n(e)&&(e=H(e,s)),"string"==typeof t?t=H(R(t,s),s):"object"===n(t)&&(t=H(t,s)),e===t},e.escapeComponent=function(e,t){return e&&e.toString().replace(t&&t.iri?a.ESCAPE:o.ESCAPE,E)},e.unescapeComponent=B,Object.defineProperty(e,"__esModule",{value:!0})}(t)},3336:e=>{"use strict";e.exports=$},976:e=>{"use strict";e.exports=DG},4469:e=>{"use strict";e.exports=grok},701:e=>{"use strict";e.exports=rxjs},442:e=>{"use strict";e.exports=rxjs.operators},3870:e=>{"use strict";e.exports=ui},6414:e=>{"use strict";e.exports=wu},4775:e=>{"use strict";e.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},996:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/applicator","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/applicator":true},"$dynamicAnchor":"meta","title":"Applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"prefixItems":{"$ref":"#/$defs/schemaArray"},"items":{"$dynamicRef":"#meta"},"contains":{"$dynamicRef":"#meta"},"additionalProperties":{"$dynamicRef":"#meta"},"properties":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"propertyNames":{"format":"regex"},"default":{}},"dependentSchemas":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"},"default":{}},"propertyNames":{"$dynamicRef":"#meta"},"if":{"$dynamicRef":"#meta"},"then":{"$dynamicRef":"#meta"},"else":{"$dynamicRef":"#meta"},"allOf":{"$ref":"#/$defs/schemaArray"},"anyOf":{"$ref":"#/$defs/schemaArray"},"oneOf":{"$ref":"#/$defs/schemaArray"},"not":{"$dynamicRef":"#meta"}},"$defs":{"schemaArray":{"type":"array","minItems":1,"items":{"$dynamicRef":"#meta"}}}}')},6795:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/content","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/content":true},"$dynamicAnchor":"meta","title":"Content vocabulary meta-schema","type":["object","boolean"],"properties":{"contentEncoding":{"type":"string"},"contentMediaType":{"type":"string"},"contentSchema":{"$dynamicRef":"#meta"}}}')},235:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/core","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/core":true},"$dynamicAnchor":"meta","title":"Core vocabulary meta-schema","type":["object","boolean"],"properties":{"$id":{"$ref":"#/$defs/uriReferenceString","$comment":"Non-empty fragments not allowed.","pattern":"^[^#]*#?$"},"$schema":{"$ref":"#/$defs/uriString"},"$ref":{"$ref":"#/$defs/uriReferenceString"},"$anchor":{"$ref":"#/$defs/anchorString"},"$dynamicRef":{"$ref":"#/$defs/uriReferenceString"},"$dynamicAnchor":{"$ref":"#/$defs/anchorString"},"$vocabulary":{"type":"object","propertyNames":{"$ref":"#/$defs/uriString"},"additionalProperties":{"type":"boolean"}},"$comment":{"type":"string"},"$defs":{"type":"object","additionalProperties":{"$dynamicRef":"#meta"}}},"$defs":{"anchorString":{"type":"string","pattern":"^[A-Za-z_][-A-Za-z0-9._]*$"},"uriString":{"type":"string","format":"uri"},"uriReferenceString":{"type":"string","format":"uri-reference"}}}')},2567:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/format-annotation","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/format-annotation":true},"$dynamicAnchor":"meta","title":"Format vocabulary meta-schema for annotation results","type":["object","boolean"],"properties":{"format":{"type":"string"}}}')},1233:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/meta-data","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/meta-data":true},"$dynamicAnchor":"meta","title":"Meta-data vocabulary meta-schema","type":["object","boolean"],"properties":{"title":{"type":"string"},"description":{"type":"string"},"default":true,"deprecated":{"type":"boolean","default":false},"readOnly":{"type":"boolean","default":false},"writeOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true}}}')},5568:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/unevaluated","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/unevaluated":true},"$dynamicAnchor":"meta","title":"Unevaluated applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"unevaluatedItems":{"$dynamicRef":"#meta"},"unevaluatedProperties":{"$dynamicRef":"#meta"}}}')},1968:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/meta/validation","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/validation":true},"$dynamicAnchor":"meta","title":"Validation vocabulary meta-schema","type":["object","boolean"],"properties":{"type":{"anyOf":[{"$ref":"#/$defs/simpleTypes"},{"type":"array","items":{"$ref":"#/$defs/simpleTypes"},"minItems":1,"uniqueItems":true}]},"const":true,"enum":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/$defs/nonNegativeInteger"},"minLength":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"maxItems":{"$ref":"#/$defs/nonNegativeInteger"},"minItems":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"maxContains":{"$ref":"#/$defs/nonNegativeInteger"},"minContains":{"$ref":"#/$defs/nonNegativeInteger","default":1},"maxProperties":{"$ref":"#/$defs/nonNegativeInteger"},"minProperties":{"$ref":"#/$defs/nonNegativeIntegerDefault0"},"required":{"$ref":"#/$defs/stringArray"},"dependentRequired":{"type":"object","additionalProperties":{"$ref":"#/$defs/stringArray"}}},"$defs":{"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"$ref":"#/$defs/nonNegativeInteger","default":0},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}}}')},2577:e=>{"use strict";e.exports=JSON.parse('{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://json-schema.org/draft/2020-12/schema","$vocabulary":{"https://json-schema.org/draft/2020-12/vocab/core":true,"https://json-schema.org/draft/2020-12/vocab/applicator":true,"https://json-schema.org/draft/2020-12/vocab/unevaluated":true,"https://json-schema.org/draft/2020-12/vocab/validation":true,"https://json-schema.org/draft/2020-12/vocab/meta-data":true,"https://json-schema.org/draft/2020-12/vocab/format-annotation":true,"https://json-schema.org/draft/2020-12/vocab/content":true},"$dynamicAnchor":"meta","title":"Core and Validation specifications meta-schema","allOf":[{"$ref":"meta/core"},{"$ref":"meta/applicator"},{"$ref":"meta/unevaluated"},{"$ref":"meta/validation"},{"$ref":"meta/meta-data"},{"$ref":"meta/format-annotation"},{"$ref":"meta/content"}],"type":["object","boolean"],"$comment":"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.","properties":{"definitions":{"$comment":"\\"definitions\\" has been replaced by \\"$defs\\".","type":"object","additionalProperties":{"$dynamicRef":"#meta"},"deprecated":true,"default":{}},"dependencies":{"$comment":"\\"dependencies\\" has been split and replaced by \\"dependentSchemas\\" and \\"dependentRequired\\" in order to serve their differing semantics.","type":"object","additionalProperties":{"anyOf":[{"$dynamicRef":"#meta"},{"$ref":"meta/validation#/$defs/stringArray"}]},"deprecated":true,"default":{}},"$recursiveAnchor":{"$comment":"\\"$recursiveAnchor\\" has been replaced by \\"$dynamicAnchor\\".","$ref":"meta/core#/$defs/anchorString","deprecated":true},"$recursiveRef":{"$comment":"\\"$recursiveRef\\" has been replaced by \\"$dynamicRef\\".","$ref":"meta/core#/$defs/uriReferenceString","deprecated":true}}}')},98:e=>{"use strict";e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')}},t={};function s(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(i.exports,i,i.exports,s),i.loaded=!0,i.exports}s.m=e,s.amdO={},s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.u=e=>e+".js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.hmd=e=>((e=Object.create(e)).children||(e.children=[]),Object.defineProperty(e,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}}),e),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;s.g.importScripts&&(e=s.g.location+"");var t=s.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&!e;)e=n[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=e})(),s.b=document.baseURI||self.location.href,s.nc=void 0;var n={};(()=>{"use strict";s.r(n),s.d(n,{_package:()=>ge,test:()=>ye,tests:()=>t.QK});var e=s(976),t=s(8467);(0,t.W3)("_first",(()=>{(0,t.Bu)("_first",(async()=>{}))}));var r=s(2012),i=s(9976),o=s(6137);(0,t.W3)("Palettes",(()=>{(0,t.Bu)("testPaletteN",(async()=>{await async function(){const e=o.J.Chromatogram;(0,t.l_)(e instanceof i.B,!0),(0,t.l_)(e instanceof o.J,!0)}()})),(0,t.Bu)("testPaletteAA",(async()=>{await async function(){const e=r.f.Lesk,s=r.f.RasMol,n=r.f.GrokGroups;(0,t.l_)(e instanceof i.B,!0),(0,t.l_)(s instanceof i.B,!0),(0,t.l_)(n instanceof i.B,!0),(0,t.l_)(e instanceof r.f,!0),(0,t.l_)(s instanceof r.f,!0),(0,t.l_)(n instanceof r.f,!0)}()})),(0,t.Bu)("testPalettePtMe",(async()=>{const e=r.f.GrokGroups.get("MeNle"),s=r.f.GrokGroups.get("MeA"),n=r.f.GrokGroups.get("MeG"),i=r.f.GrokGroups.get("MeF"),o=r.f.GrokGroups.get("L"),a=r.f.GrokGroups.get("A"),l=r.f.GrokGroups.get("G"),c=r.f.GrokGroups.get("F");(0,t.l_)(e,o),(0,t.l_)(s,a),(0,t.l_)(n,l),(0,t.l_)(i,c)}))}));var a=s(4469),l=s(3348),c=s(8447),h=s(499);async function u(t){const s=e.Column.fromList(e.TYPE.STRING,"col1",t);if(await a.functions.call("Bio:detectMacromolecule",{col:s}),s.semType===e.SEMTYPE.MACROMOLECULE){const t=`Negative test detected semType='${s.semType}', units='${s.getTag(e.TAGS.UNITS)}'.`;throw new Error(t)}}async function d(t,s){const n=(await t()).getCol(s),r=await a.functions.call("Bio:detectMacromolecule",{col:n});if(r&&(n.semType=r),n.semType===e.SEMTYPE.MACROMOLECULE){const t=`Negative test detected semType='${n.semType}', units='${n.getTag(e.TAGS.UNITS)}'.`;throw new Error(t)}}async function m(s,n,r,i,o,l,c=null){const u=e.Column.fromList(e.TYPE.STRING,"seq",s),d=await a.functions.call("Bio:detectMacromolecule",{col:u});d&&(u.semType=d),(0,t.l_)(u.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(u.getTag(e.TAGS.UNITS),n),(0,t.l_)(u.getTag("aligned"),r),(0,t.l_)(u.getTag("alphabet"),i),c&&(0,t.l_)(u.getTag("separator"),c);const m=h.Cn.getOrCreate(u);(0,t.l_)(m.getAlphabetSize(),o),(0,t.l_)(m.getAlphabetIsMultichar(),l),m.isHelm()||((0,t.l_)(m.aligned,r),(0,t.l_)(m.alphabet,i))}async function p(s,n,r,i,o,l,c,u=null){const d=(await s()).col(n),m=await a.functions.call("Bio:detectMacromolecule",{col:d});m&&(d.semType=m),(0,t.l_)(d.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(d.getTag(e.TAGS.UNITS),r),(0,t.l_)(d.getTag("aligned"),i),(0,t.l_)(d.getTag("alphabet"),o),u&&(0,t.l_)(d.getTag("separator"),u);const p=h.Cn.getOrCreate(d);(0,t.l_)(p.getAlphabetSize(),l),(0,t.l_)(p.getAlphabetIsMultichar(),c),p.isHelm()||((0,t.l_)(p.aligned,i),(0,t.l_)(p.alphabet,o))}(0,t.W3)("detectors",(()=>{var s,n,r,i,o,l,h,y,b,w,C,v,T,A,S,_,E,P,$,x;const N=new(x=class{constructor(){this[s]="id,col1\n1,\n2,\n3,\n4,\n5,",this[n]="col1\n1\n2\n3",this[r]="col1\n4\n5\n6\n7",this[i]="col1\n8\n9\n10\n11\n12",this[o]="col1\nCCCCN1C(=O)CN=C(c2cc(F)ccc12)C3CCCCC3\nC1CCCCC1\nCCCCCC",this[l]="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",this[h]="seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",this[y]="seq\nFWPHEY\nYNRQWYV\nMKPSEYV",this[b]="seq\n[meI][hHis][Aca]NT[dE][Thr_PO3H2][Aca]DN\n[meI][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2][Aca]\n[Lys_Boc][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2][Aca]",this[w]="seq\nA*C*G*T*C*A*C*G*T*C\nC*A*G*T*G*T*C*A*G*T*G*T\nT*T*C*A*A*C*T*T*C*A*A*C",this[C]="seq\nA*C*G*U*C*A*C*G*U*C\nC*A*G*U*G*U*C*A*G*U*G*U\nU*U*C*A*A*C*U*U*C*A*A*C",this[v]="seq\nF-W-P-H-E-Y-F-W-P-H-E-Y\nY-N-R-Q-W-Y-V-Y-N-R-Q-W-Y-V\nM-K-P-S-E-Y-V-M-K-P-S-E-Y-V",this[T]="seq\nabc-dfgg-abc1-cfr3-rty-wert-cfr3-rty-wert\nrut12-her2-rty-wert-abc-abc1-dfgg-abc-abc1-dfgg\nrut12-rty-her2-abc-cfr3-wert-rut12-cfr3-wert-rut12",this[A]="seq\nabc/dfgg/abc1/cfr3/rty/wert/abc/dfgg/abc1/cfr3/rty/wert\nrut12/her2/rty/wert//abc/abc1/dfgg/rut12/her2/rty/wert//abc/abc1/dfgg\nrut12/rty/her2/abc/cfr3//wert/rut12/rut12/rty/her2/abc/cfr3//wert/rut12",this[S]="seq\nA-C--G-T--C-T-A-C--G-T--C-T\nC-A-C--T--G-T-C-A-C--T--G-T\nA-C-C-G-T-A-C-T-A-C-C-G-T-A-C-T",this[_]="seq\nm1-M-m3-mon4-mon5-N-T-MON8-N9-m1-M-m3-mon4-mon5-N-T-MON8-N9\nm1-mon2-m3-mon4-mon5-Num--MON8-N9-m1-mon2-m3-mon4-mon5-Num--MON8-N9\n\nmon1-M-mon3-mon4-mon5---MON8-N9-mon1-M-mon3-mon4-mon5---MON8-N9",this[E]="seq\nAc(1)-F-K(AEEA-AEEA-R-Ac)-L-mF-V-Y-mNle-D-W-N-mF-C(1)-G-NH2\nAc(1)-F-K(AEEA-ARRA-W-Ac)-L-mF-V-Y-mNle-D-W-N-mF-C(1)-G-NH2\nAc(1)-F-K(AEEA-AEEA-Ac)-L-mF-V-Y-mNle-D-W-N-mF-C(1)-G-NH2",this[P]="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT",this[$]="seq\nFWR-WYV-KHPFWR-WYV-KHP\nYNR-WYV-KHPYNR-WYV-KHP\nMWRSWY-CKHPMWRSWY-CKHP"}},s="negEmpty",n="neg1",r="neg2",i="neg3",o="negSmiles",l="csvFastaDna1",h="fastaRna1",y="fastaPt1",b="fastaUn",w="sepDna",C="sepRna",v="sepPt",T="sepUn1",A="sepUn2",S="sepMsaDna1",_="sepMsaUnWEmpty",E="sepComplex",P="fastaMsaDna1",$="fastaMsaPt1",x),M={fastaFasta:"System:AppData/Bio/data/sample_FASTA.fasta",fastaPtCsv:"System:AppData/Bio/data/sample_FASTA_PT.csv",msaComplex:"System:AppData/Bio/samples/MSA.csv",fastaCsv:"System:AppData/Bio/samples/FASTA.csv",helmCsv:"System:AppData/Bio/samples/HELM.csv",peptidesComplex:"System:AppData/Bio/tests/peptides_complex_msa.csv",peptidesSimple:"System:AppData/Bio/tests/peptides_simple_msa.csv",testDemogCsv:"System:AppData/Bio/tests/testDemog.csv",testHelmCsv:"System:AppData/Bio/tests/testHelm.csv",testIdCsv:"System:AppData/Bio/tests/testId.csv",testSmilesCsv:"System:AppData/Bio/tests/testSmiles.csv",testSmiles2Csv:"System:AppData/Bio/tests/testSmiles2.csv",testSmilesShort:"System:AppData/Bio/tests/testSmilesShort.csv",testActivityCliffsCsv:"System:AppData/Bio/tests/testActivityCliffs.csv",testCerealCsv:"System:AppData/Bio/tests/testCereal.csv",testUnichemSources:"System:AppData/Bio/tests/testUnichemSources.csv",testDmvOffices:"System:AppData/Bio/tests/testDmvOffices.csv",testAlertCollection:"System:AppData/Bio/tests/testAlertCollection.csv",testSpgi100:"System:AppData/Bio/tests/testSpgi100.csv",testSpgi:"System:AppData/Bio/tests/SPGI-derived.csv",testUrl:"System:AppData/Bio/tests/testUrl.csv"},L={};function I(e,t=R){return async()=>(e in L||(L[e]=(async()=>await t(M[e]))().catch((t=>{throw delete L[e],t}))),L[e])}async function R(t){const s=await a.dapi.files.readAsText(t);return e.DataFrame.fromCsv(s)}const O=t=>async()=>{const s=N[t],n=e.DataFrame.fromCsv(s);return await a.data.detectSemanticTypes(n),n};(0,t.Bu)("NegativeEmpty",(async()=>{await d(O("negEmpty"),"col1")})),(0,t.Bu)("Negative1",(async()=>{await d(O("neg1"),"col1")})),(0,t.Bu)("Negative2",(async()=>{await d(O("neg2"),"col1")})),(0,t.Bu)("Negative3",(async()=>{await d(O("neg3"),"col1")})),(0,t.Bu)("NegativeSmiles",(async()=>{await d(O("negSmiles"),"col1")})),(0,t.Bu)("NegativeStartEnd",(async()=>{await u(["START","END"])})),(0,t.Bu)("NegativeStartEndIntermediate",(async()=>{await u(["START","END","INTERMEDIATE"])})),(0,t.Bu)("FastaDna1",(async()=>{await p(O("csvFastaDna1"),"seq",c.r2.FASTA,"SEQ","DNA",4,!1)})),(0,t.Bu)("FastaRna1",(async()=>{await p(O("fastaRna1"),"seq",c.r2.FASTA,"SEQ","RNA",4,!1)})),(0,t.Bu)("FastaPt1",(async()=>{await p(O("fastaPt1"),"seq",c.r2.FASTA,"SEQ","PT",20,!1)})),(0,t.Bu)("FastaPtGaps",(()=>m(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEYV"],c.r2.FASTA,"SEQ","PT",20,!1))),(0,t.Bu)("FastaPtGapsMsa",(()=>m(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEY"],c.r2.FASTA,"SEQ.MSA","PT",20,!1))),(0,t.Bu)("FastaUn",(async()=>{await p(O("fastaUn"),"seq",c.r2.FASTA,"SEQ.MSA","UN",12,!0)})),(0,t.Bu)("FastaMsaDna1",(async()=>{await p(O("fastaMsaDna1"),"seq",c.r2.FASTA,"SEQ.MSA","DNA",4,!1)})),(0,t.Bu)("FastaMsaPt1",(async()=>{await p(O("fastaMsaPt1"),"seq",c.r2.FASTA,"SEQ.MSA","PT",20,!1)})),(0,t.Bu)("SepDna",(async()=>{await p(O("sepDna"),"seq",c.r2.SEPARATOR,"SEQ","DNA",4,!1,"*")})),(0,t.Bu)("SepRna",(async()=>{await p(O("sepRna"),"seq",c.r2.SEPARATOR,"SEQ","RNA",4,!1,"*")})),(0,t.Bu)("SepPt",(async()=>{await p(O("sepPt"),"seq",c.r2.SEPARATOR,"SEQ","PT",20,!1,"-")})),(0,t.Bu)("SepUn1",(async()=>{await p(O("sepUn1"),"seq",c.r2.SEPARATOR,"SEQ","UN",8,!0,"-")})),(0,t.Bu)("SepUn2",(async()=>{await p(O("sepUn2"),"seq",c.r2.SEPARATOR,"SEQ","UN",9,!0,"/")})),(0,t.Bu)("SepMsaN1",(async()=>{await p(O("sepMsaDna1"),"seq",c.r2.SEPARATOR,"SEQ.MSA","DNA",4,!1,"-")})),(0,t.Bu)("SepMsaUnWEmpty",(async()=>{await p(O("sepMsaUnWEmpty"),"seq",c.r2.SEPARATOR,"SEQ.MSA","UN",14,!0)})),(0,t.Bu)("SepComplex",(async()=>{await p(O("sepComplex"),"seq",c.r2.SEPARATOR,"SEQ","UN",18,!0)})),(0,t.Bu)("samplesFastaCsv",(async()=>{await g(I("fastaCsv"),{Sequence:new f(c.r2.FASTA,"SEQ","PT",20,!1)})})),(0,t.Bu)("samplesFastaFasta",(async()=>{await g(I("fastaFasta"),{sequence:new f(c.r2.FASTA,"SEQ","PT",20,!1)})})),(0,t.Bu)("samplesPeptidesComplex",(async()=>{await g(I("peptidesComplex"),{})})),(0,t.Bu)("samplesMsaComplex",(async()=>{await g(I("msaComplex"),{MSA:new f(c.r2.SEPARATOR,"SEQ.MSA","UN",161,!0,"/")})})),(0,t.Bu)("samplesIdCsv",(async()=>{await g(I("testIdCsv"),{})})),(0,t.Bu)("samplesSarSmallCsv",(async()=>{await g(I("testSmilesCsv"),{})})),(0,t.Bu)("samplesHelmCsv",(async()=>{await g(I("helmCsv"),{HELM:new f(c.r2.HELM,null,null,160,!0)})})),(0,t.Bu)("samplesTestHelmCsv",(async()=>{await g(I("testHelmCsv"),{"HELM string":new f(c.r2.HELM,null,null,9,!0)})})),(0,t.Bu)("samplesTestDemogCsv",(async()=>{await g(I("testDemogCsv"),{})})),(0,t.Bu)("samplesTestSmiles2Csv",(async()=>{await g(I("testSmiles2Csv"),{})})),(0,t.Bu)("samplesTestSmilesShort",(async()=>{await g(I("testSmilesShort"),{})})),(0,t.Bu)("samplesTestActivityCliffsNegativeSmiles",(async()=>{await g(I("testActivityCliffsCsv"),{})})),(0,t.Bu)("samplesFastaPtCsv",(async()=>{await g(I("fastaPtCsv"),{sequence:new f(c.r2.FASTA,"SEQ","PT",20,!1)})})),(0,t.Bu)("samplesTestCerealCsv",(async()=>{await g(I("testCerealCsv"),{})})),(0,t.Bu)("samplesTestUnichemSources",(async()=>{await g(I("testUnichemSources"),{})})),(0,t.Bu)("samplesTestDmvOffices",(async()=>{await g(I("testDmvOffices"),{})})),(0,t.Bu)("samplesTestAlertCollection",(async()=>{await g(I("testAlertCollection"),{})})),(0,t.Bu)("samplesTestSpgi",(async()=>{await g(I("testSpgi"),{})})),(0,t.Bu)("samplesTestSpgi100",(async()=>{await g(I("testSpgi100"),{})})),(0,t.Bu)("samplesTestUrl",(async()=>{await g(I("testUrl"),{})}))}));class f{constructor(e,t,s,n,r,i){this.units=e,this.aligned=t,this.alphabet=s,this.alphabetSize=n,this.alphabetIsMultichar=r,this.separator=i}}async function g(e,t){const s=await e(),n=[];for(const r of s.columns.names())if(r in t){const s=t[r];try{await p(e,r,s.units,s.aligned,s.alphabet,s.alphabetSize,s.alphabetIsMultichar,s.separator)}catch(e){const t=e.toString();n.push(`Positive col '${r}' failed: ${t}`)}}else try{await d(e,r)}catch(e){const t=e.toString();n.push(`Negative col '${r}' failed: ${t}`)}if(n.length>0)throw new Error(n.join("\n"))}(0,t.W3)("detectors:weak-and-likely",(()=>{const s={fastaDnaWeak1:"id,colName\n1,TTTTTTTTTT\n2,TTTTTTTTTT\n3,TTTTTTTTTT\n4,TTTTTTTTTT",fastaDnaWeak1LikelyName:"id,seq\n1,TTTTTTT\n2,TTTTTTT\n3,TTTTTTT\n4,TTTTTTT",fastaRnaWeak1:"id,colName\n1,UUUUUUUUUU\n2,UUUUUUUUUU\n3,UUUUUUUUUU\n4,UUUUUUUUUU",fastaRnaWeak1LikelyName:"id,seq\n1,UUUUUUU\n2,UUUUUUU\n3,UUUUUUU\n4,UUUUUUU",fastaPtWeak1:"id,colName\n1,SLSLSPGKSLSLSPGK\n2,SLSLSPGKSLSLSPGK\n3,SLSLSPGKSLSLSPGK\n4,SLSLSPGKSLSLSPGK",fastaPtWeak1LikelyName:"id,seq\n1,SLSLSPGKSLSLSPGK\n2,SLSLSPGKSLSLSPGK\n3,SLSLSPGKSLSLSPGK\n4,SLSLSPGKSLSLSPGK",fastaUn1:"id,colName\n1,word\n2,other\n3,some\n4,another",fastaUn1LikelyName:"id,seq\n1,word\n2,other\n3,some\n4,another",fastaUn2LikelyName:'protein\nBoombastic\nMegafantastic\n"just-a-random-thought,oy!"',fastaUnMsa1LikelyName:"id,seq\n1,word\n2,male\n3,bare\n4,core"},n=t=>async()=>{const n=s[t],r=e.DataFrame.fromCsv(n);return await a.data.detectSemanticTypes(r),r};(0,t.Bu)("fastaDnaWeak1",(async()=>{await d(n("fastaDnaWeak1"),"colName")})),(0,t.Bu)("fastaDnaWeak1LikelyName",(async()=>{await p(n("fastaDnaWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA","DNA",4,!1)})),(0,t.Bu)("fastaRnaWeak1",(async()=>{await d(n("fastaRnaWeak1"),"colName")})),(0,t.Bu)("fastaRnaWeak1LikelyName",(async()=>{await p(n("fastaRnaWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA","RNA",4,!1)})),(0,t.Bu)("fastaPtWeak1",(async()=>{await d(n("fastaPtWeak1"),"colName")})),(0,t.Bu)("fastaPtWeak1LikelyName",(async()=>{await p(n("fastaPtWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA","PT",20,!1)})),(0,t.Bu)("fastaUn1",(async()=>{await d(n("fastaUn1"),"colName")})),(0,t.Bu)("fastaUn1LikelyName",(async()=>{await d(n("fastaUn1LikelyName"),"seq")})),(0,t.Bu)("fastaUn2LikelyName",(async()=>{await d(n("fastaUn2LikelyName"),"protein")})),(0,t.Bu)("fastaUnMsa1LikelyName",(async()=>{await d(n("fastaUnMsa1LikelyName"),"seq")}))})),(0,t.W3)("detectorsBenchmark",(()=>{let s;async function n(n,i,o,a,l,u){return await async function(n,d,m,p){const f=(()=>{const t=function(t,s,n,r,i){let o;switch(t){case c.r2.FASTA:o=e=>{let t="";for(let s=0;s<e.length;s++){const n=e[s];t+=1==n.length?n:`[${n}]`}return t};break;case c.r2.SEPARATOR:o=(e,t)=>e.join(t);break;default:throw new Error(`Not supported notation '${t}'.`)}const a=(e,t)=>{const s=new Array(t);for(let n=0;n<t;n++)s[n]=e[Math.floor(Math.random()*e.length)];return o(s,i)},l=Array(r);for(let e=0;e<r;e++)l[e]=a(s,n);return e.Column.fromStrings("seq",l)}(i,[...(0,c.gM)(o)],a,l,u),n=s.prepare({col:t});return r(n),n})(),g=Date.now(),y=await(async e=>r(e))(f),b=Date.now();(function(e,s){const n=h.Cn.getOrCreate(e);(0,t.l_)(e.semType===s.semType,!0),(0,t.l_)(n.notation===s.notation,!0),(0,t.l_)(n.alphabet===s.alphabet,!0),(0,t.l_)(n.separator===s.separator,!0)})(y,{semType:e.SEMTYPE.MACROMOLECULE,notation:i,alphabet:o,separator:u});const w=b-g;if(w>n){const e=`ET ${w} ms is more than max allowed ${n} ms.`;throw console.error(e),new Error(e)}return console.log(`ET ${w} ms is OK.`),w}(n)}function r(e){e.callSync();const t=e.getOutputParamValue(),s=e.inputs.col;return t&&(s.semType=t),s}(0,t.bb)((async()=>{const t=e.Func.find({package:"Bio",name:"detectMacromolecule"});s=t[0];const n=e.Column.fromStrings("seq",["ACGT","ACGT","ACGT"]);await s.prepare({col:n}).call()})),(0,t.Bu)("fastaDnaShorts50Few50",(async()=>{await n(10,c.r2.FASTA,"DNA",50,50)})),(0,t.Bu)("fastaDnaShorts50Many1E6",(async()=>{await n(20,c.r2.FASTA,"DNA",50,1e6)})),(0,t.Bu)("fastaDnaLong1e6Few50",(async()=>{await n(20,c.r2.FASTA,"DNA",1e6,50)})),(0,t.Bu)("separatorDnaShorts50Few50",(async()=>{await n(10,c.r2.SEPARATOR,"DNA",50,50,"/")})),(0,t.Bu)("separatorDnaShorts50Many1E6",(async()=>{await n(20,c.r2.SEPARATOR,"DNA",50,1e6,"/")})),(0,t.Bu)("separatorDnaLong1e6Few50",(async()=>{await n(20,c.r2.SEPARATOR,"DNA",1e6,50,"/")}))}));var y=s(6098),b=s(525);async function w(t){const s=await async function(e){return await ge.files.readAsText(e)}(t),n=e.DataFrame.fromCsv(s);return n.name=t.replace(".csv",""),n}async function C(e=3e4){const s=(await a.dapi.docker.dockerContainers.filter("bio").first()).id;await async function(e,s=3e4){await a.dapi.docker.dockerContainers.run(e);let n=!1;for(let r=0;r<s/200;++r){switch((await a.dapi.docker.dockerContainers.find(e)).status){case"stopped":await a.dapi.docker.dockerContainers.run(e);break;case"pending change":case"changing":break;case"checking":case"started":n=!0;break;case"error":throw new Error("Docker container error state.")}if(n)break;await(0,t.gw)(200)}if(!n)throw new Error("Docker container run timeout.")}(s,e)}async function v(e,s=5e3){await(0,t.gw)(0),await(0,t.zg)(e.onAfterDrawContent,(()=>{}),(()=>{e.invalidate()}),s)}async function T(s,n){const r=e.DataFrame.fromCsv(s),i=e.DataFrame.fromCsv(n),o=r.getCol("seq"),l=await a.functions.call("Bio:detectMacromolecule",{col:o});l&&(o.semType=l);const c=i.getCol("seq"),h=await(0,y.U)(o,!0);(0,t.f6)(h.toList(),c.toList())}async function A(s,n,r,i,o,l){const c=e.DataFrame.fromCsv(s),h=e.DataFrame.fromCsv(n),u=c.getCol("seq"),d=h.getCol("seq"),m=c.getCol("seq"),p=await a.functions.call("Bio:detectMacromolecule",{col:m});p&&(m.semType=p),await a.data.detectSemanticTypes(c),(0,t.l_)(u.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(u.getTag(e.TAGS.UNITS),r),o&&(0,t.l_)(u.getTag("alphabet"),o);const f=await(0,b.K)({col:u,pepsea:{method:l}});(0,t.l_)(f.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(f.getTag(e.TAGS.UNITS),i),(0,t.l_)(f.getTag("aligned"),"SEQ.MSA"),o&&(0,t.l_)(f.getTag("alphabet"),o),(0,t.f6)(f.toList(),d.toList())}(0,t.W3)("MSA",(async()=>{(0,t.Bu)("isCorrect",(async()=>{await T("seq\nFWRWYVKHP\nYNRWYVKHP\nMWRSWYCKHP","seq\nFWR-WYVKHP\nYNR-WYVKHP\nMWRSWYCKHP")})),(0,t.Bu)("isCorrectLong",(async()=>{await T("seq\nFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHPFWRWYVKHP\nYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHPYNRWYVKHP\nMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHP","seq\nFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHPFWR-WYVKHP\nYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHPYNR-WYVKHP\nMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHPMWRSWYCKHP")})),(0,t.Bu)("isCorrectHelm",(async()=>{await C(),await A("seq\n PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2}$$$$\n PEPTIDE1{meI.Aca.N.T.dE.Thr_PO3H2}$$$$\n PEPTIDE1{hHis.Aca.N.T.dE.Thr_PO3H2}$$$$","seq\n meI.hHis.Aca.N.T.dE.Thr_PO3H2\n .meI.Aca.N.T.dE.Thr_PO3H2\n .hHis.Aca.N.T.dE.Thr_PO3H2",c.r2.HELM,c.r2.SEPARATOR,void 0,"mafft")}),{timeout:6e4}),(0,t.Bu)("isCorrectHelmLong",(async()=>{await C(),await A("seq\n PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.dV.E.N.D-Orn.D-aThr.Phe_4Me.Thr_PO3H2}$$$$\n PEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Tyr_PO3H2.D-Chg.dV.Phe_ab-dehydro.N.D-Orn.D-aThr.Phe_4Me}$$$$\n PEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me}$$$$","seq\n meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.dV.E.N.D-Orn.D-aThr.Phe_4Me.Thr_PO3H2\n meI.hHis.Aca.Cys_SEt.T.dK..Tyr_PO3H2.D-Chg.dV.Phe_ab-dehydro.N.D-Orn.D-aThr.Phe_4Me.\n Lys_Boc.hHis.Aca.Cys_SEt.T.dK..Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me.",c.r2.HELM,c.r2.SEPARATOR,void 0,"mafft")}),{timeout:6e4}),(0,t.Bu)("isCorrectSeparator",(async()=>{await A("seq\n F-W-P-H-E-Y\n Y-N-R-Q-W-Y-V\n M-K-P-S-E-Y-V","seq\n FWPHEY-\n YNRQWYV\n MKPSEYV",c.r2.SEPARATOR,c.r2.FASTA,"PT")})),(0,t.Bu)("isCorrectSeparatorLong",(async()=>{await A("seq\n M-I-E-V-F-L-F-G-I-V-L-G-L-I-P-I-T-L-A-G-L-F-V-T-A-Y-L-Q-Y-R-R-G-D-Q-L-D-L\n M-M-E-L-V-L-K-T-I-I-G-P-I-V-V-G-V-V-L-R-I-V-D-K-W-L-N-K-D-K\n M-D-R-T-D-E-V-S-N-H-T-H-D-K-P-T-L-T-W-F-E-E-I-F-E-E-Y-H-S-P-F-H-N","seq\n MIEV-FLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL\n MMEL-VLKTII-GPIVVGVVLRIVDKWLNKDK------\n MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN-----",c.r2.SEPARATOR,c.r2.FASTA,"PT")}))}));var S=s(9416),_=s(3553);async function E(e,s){const n=(0,c.kB)(e);console.debug(`Bio: tests: splitters: src=${JSON.stringify(e)}, res=${JSON.stringify(n)} .`),(0,t.f6)(n,s)}async function P(e,s){const n=(0,c.gP)(e);console.debug(`Bio: tests: splitters: src=${JSON.stringify(e)}, res=${JSON.stringify(n)} .`),(0,t.f6)(n,s)}(0,t.W3)("splitters",(async()=>{(0,t.bb)((async()=>{})),(0,t.X5)((async()=>{}));const s=["M[MeI]YKETLL[MeF]PKTDFPMRGGL[MeA]",["M","MeI","Y","K","E","T","L","L","MeF","P","K","T","D","F","P","M","R","G","G","L","MeA"]],n=["[meI][Pip][dK][Thr_PO3H2][L-hArg(Et,Et)][D-Tyr_Et][Tyr_ab-dehydroMe][dV]EN[D-Orn][D-aThr][Phe_4Me]",["meI","Pip","dK","Thr_PO3H2","L-hArg(Et,Et)","D-Tyr_Et","Tyr_ab-dehydroMe","dV","E","N","D-Orn","D-aThr","Phe_4Me"]],r=["PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.Tyr_ab-dehydroMe.dV.E.N.D-Orn.D-aThr.Phe_4Me}$$$",["meI","hHis","Aca","N","T","dE","Thr_PO3H2","Aca","D-Tyr_Et","Tyr_ab-dehydroMe","dV","E","N","D-Orn","D-aThr","Phe_4Me"]],i=["PEPTIDE1{meI.hHis.Aca.N.T.dK.Thr_PO3H2.Aca.D-Tyr_Et.D-Dap.dV.E.N.pnG.Phe_4Me}$$$",["meI","hHis","Aca","N","T","dK","Thr_PO3H2","Aca","D-Tyr_Et","D-Dap","dV","E","N","pnG","Phe_4Me"]],o=["PEPTIDE1{[meI].[hHis].[Aca].N.T.[dK].[Thr_PO3H2].[Aca].[D-Tyr_Et].[D-Dap].[dV].E.N.[pnG].[Phe_4Me]}$$$",["meI","hHis","Aca","N","T","dK","Thr_PO3H2","Aca","D-Tyr_Et","D-Dap","dV","E","N","pnG","Phe_4Me"]],c=["RNA1{R(U)P.R(T)P.R(G)P.R(C)P.R(A)}$$$$",["R(U)P","R(T)P","R(G)P","R(C)P","R(A)"]],h=["RNA1{P.R(U)P.R(T)}$$$$",["P","R(U)P","R(T)"]],u=["RNA1{P.R(U).P.R(T)}$$$$",["P","R(U)","P","R(T)"]];(0,t.Bu)("fastaMulti",(async()=>{await E(s[0],s[1])})),(0,t.Bu)("fastaFromHelm",(async()=>{await E(n[0],n[1])})),(0,t.Bu)("helm1",(async()=>{await P(r[0],r[1])})),(0,t.Bu)("helm2",(async()=>{await P(i[0],i[1])})),(0,t.Bu)("helm3-multichar",(async()=>{await P(o[0],o[1])})),(0,t.Bu)("testHelm1",(async()=>{await P(c[0],c[1])})),(0,t.Bu)("testHelm2",(async()=>{await P(h[0],h[1])})),(0,t.Bu)("testHelm3",(async()=>{await P(u[0],u[1])})),(0,t.Bu)("splitToMonomers",(async()=>{const e=await a.dapi.files.readCsv("System:AppData/Bio/samples/MSA.csv"),s=e.getCol("MSA"),n=await a.functions.call("Bio:detectMacromolecule",{col:s});n&&(s.semType=n),s.setTag("aligned",_.mU);const r=await(0,S.n)(e,s);(0,t.l_)(r.columns.names().includes("17"),!0),await a.data.detectSemanticTypes(r);const i=a.shell.addTableView(r);await v(i.grid),(0,t.l_)(i.grid.dataFrame.id,e.id)})),(0,t.Bu)("getHelmMonomers",(async()=>{const t=e.DataFrame.fromCsv("HELM,Activity\nPEPTIDE1{hHis.N.T}$$$,5.30751\nPEPTIDE1{hHis.Aca.Cys_SEt}$$$,5.72388\n");await a.data.detectSemanticTypes(t);const s=["hHis","Aca","Cys_SEt","N","T"],n=t.getCol("HELM"),r=(0,l.getHelmMonomers)(n),i=s.filter((e=>!r.includes(e))),o=r.filter((e=>!s.includes(e)));if(i.length>0||o.length){const e=[];throw i.length>0&&e.push(`Missed monomers ${JSON.stringify(i)}.`),o.length>0&&e.push(`Unexpected monomers ${JSON.stringify(o)}.`),new Error(e.join(" "))}}))}));var $=s(7228),x=s(6584),N=s(3776),M=s(2428);(0,t.W3)("monomerLibraries",(()=>{let e,s=null;(0,t.bb)((async()=>{e=await(0,$.JN)(),s=(0,x.nW)()})),(0,t.X5)((async()=>{await(0,x.tW)(s)})),(0,t.Bu)("default",(async()=>{await(0,x.tW)({exclude:[],explicit:[]}),await e.loadLibraries(!0);const s=e.getBioLib();(0,t.l_)(s.getPolymerTypes().length>0,!0)})),(0,t.Bu)("forTests",(async()=>{await(0,x.tb)(),await e.loadLibraries(!0);const s=e.getBioLib();(0,t.l_)(s.getPolymerTypes().length,2),(0,t.l_)(s.getMonomerSymbolsByType("PEPTIDE").length,322),(0,t.l_)(s.getMonomerSymbolsByType("RNA").length,383)})),(0,t.Bu)("empty",(async()=>{const s=await(0,x.nW)(),n=M.A.getInstance(),r=await N.t.getInstance(n);let i=r.getValidLibraryPaths();0===i.length&&(i=await r.getValidLibraryPathsAsynchronously()),s.exclude=i,s.explicit=[],await(0,x.tW)(s),await e.loadLibraries(!0);const o=e.getBioLib().getPolymerTypes();(0,t.l_)(0===o.length,!0)}))}));var L=s(4004);function I(){const t=[];return t.push(e.Column.fromList("string","MSA",new Array(10**6).fill("meI/hHis/Aca/N/T/dE/Thr_PO3H2/Aca/D-Tyr_Et/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr//Phe_4Me"))),t.push(e.Column.fromList("string","Activity",new Array(10**6).fill("5.30751"))),t}function R(){const t=[],s="meI/hHis/Aca/N/T/dE/Thr_PO3H2/Aca/D-Tyr_Et/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr".repeat(10**5);return t.push(e.Column.fromList("string","MSA",new Array(100).fill(s))),t.push(e.Column.fromList("string","Activity",new Array(100).fill("7.30751"))),t}async function O(s,n){const r=s(),i=e.DataFrame.fromColumns(r);await a.data.detectSemanticTypes(i);const o=Date.now(),l=(i.columns.byName("MSA"),a.shell.addTableView(i));await v(l.grid),(0,t.l_)(l.grid.dataFrame.id,i.id);const c=Date.now()-o;console.log(`Performance test: ${n}: ${c}ms`)}(0,t.W3)("renderers",(()=>{(0,t.Bu)("long sequence performance ",(async()=>{await O(R,"Long sequences")})),(0,t.Bu)("many sequence performance",(async()=>{await O(I,"Many sequences")})),(0,t.Bu)("many sequence performance",(async()=>{await O(I,"Many sequences")})),(0,t.Bu)("rendererMacromoleculeFasta",(async()=>{await async function(){const s=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA.csv"),n=e.DataFrame.fromCsv(s),r=n.getCol("Sequence"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});i&&(r.semType=i);const o=a.shell.addTableView(n);await a.data.detectSemanticTypes(n),await v(o.grid),(0,t.l_)(o.grid.dataFrame.id,n.id);const l=r.getTag(e.TAGS.CELL_RENDERER);(0,t.l_)(l,"sequence")}()})),(0,t.Bu)("rendererMacromoleculeSeparator",(async()=>{await async function(){const s=await a.dapi.files.readAsText("System:AppData/Bio/data/sample_SEPARATOR_PT.csv"),n=e.DataFrame.fromCsv(s),r=n.getCol("sequence"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});i&&(r.semType=i);const o=a.shell.addTableView(n);await a.data.detectSemanticTypes(n),await v(o.grid),(0,t.l_)(o.grid.dataFrame.id,n.id);const l=r.getTag(e.TAGS.CELL_RENDERER);(0,t.l_)(l,"sequence")}()})),(0,t.Bu)("rendererMacromoleculeDifference",(async()=>{await async function(){const s=e.Column.fromStrings("SequencesDiff",["meI/hHis/Aca/N/T/dK/Thr_PO3H2/Aca#D-Tyr_Et/Tyr_ab-dehydroMe/meN/E/N/dV"]);s.setTag(e.TAGS.UNITS,c.r2.SEPARATOR),s.setTag("separator","/"),s.setTag("aligned","SEQ"),s.setTag("alphabet","UN"),s.setTag(".alphabetIsMultichar","true"),s.semType=_.Of.MACROMOLECULE_DIFFERENCE;const n=e.DataFrame.fromColumns([s]),r=a.shell.addTableView(n);await a.data.detectSemanticTypes(n),await v(r.grid),(0,t.l_)(r.grid.dataFrame.id,n.id);const i=s.getTag(e.TAGS.CELL_RENDERER);(0,t.l_)(i,_.Of.MACROMOLECULE_DIFFERENCE)}()})),(0,t.Bu)("afterMsa",(async()=>{await async function(){const s=await a.dapi.files.readAsText("System:AppData/Bio/data/sample_FASTA.fasta"),n=(0,l.importFasta)(s)[0],r=n.getCol("sequence"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});i&&(r.semType=i);const o=a.shell.addTableView(n);await a.data.detectSemanticTypes(n),console.log("Bio: tests/renderers/afterMsa, table view"),await v(o.grid),(0,t.l_)(o.grid.dataFrame.id,n.id),console.log(`Bio: tests/renderers/afterMsa, src before test semType="${r.semType}", units="${r.getTag(e.TAGS.UNITS)}", cell.renderer="${r.getTag(e.TAGS.CELL_RENDERER)}"`),(0,t.l_)(r.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(r.getTag(e.TAGS.UNITS),c.r2.FASTA),(0,t.l_)(r.getTag("aligned"),"SEQ"),(0,t.l_)(r.getTag("alphabet"),"PT"),(0,t.l_)(r.getTag(e.TAGS.CELL_RENDERER),"sequence");const u=await(0,b.K)({col:r});await v(o.grid),(0,t.l_)(o.grid.dataFrame.id,n.id),(0,t.l_)(u.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(u.getTag(e.TAGS.UNITS),c.r2.FASTA),(0,t.l_)(u.getTag("aligned"),"SEQ.MSA"),(0,t.l_)(u.getTag("alphabet"),"PT"),(0,t.l_)(u.getTag(e.TAGS.CELL_RENDERER),"sequence"),h.Cn.getOrCreate(u)}()})),(0,t.Bu)("afterConvert",(async()=>{await async function(){const s=await a.dapi.files.readAsText("System:AppData/Bio/data/sample_FASTA_PT.csv"),n=e.DataFrame.fromCsv(s),r=n.col("sequence"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});i&&(r.semType=i);const o=a.shell.addTableView(n);await a.data.detectSemanticTypes(n);const l=await(0,L.o)(r,c.r2.SEPARATOR,"/");await v(o.grid),(0,t.l_)(o.grid.dataFrame.id,n.id);const u=l.getTag(e.TAGS.CELL_RENDERER);(0,t.l_)(u,"sequence"),h.Cn.getOrCreate(l)}()})),(0,t.Bu)("selectRendererBySemType",(async()=>{await async function(){const s=e.Column.fromStrings("SequencesDiff",["meI/hHis/Aca/N/T/dK/Thr_PO3H2/Aca#D-Tyr_Et/Tyr_ab-dehydroMe/meN/E/N/dV"]);s.setTag(e.TAGS.UNITS,c.r2.SEPARATOR),s.setTag("separator","/"),s.setTag("aligned","SEQ"),s.setTag("alphabet","UN"),s.setTag(".alphabetIsMultichar","true"),s.semType=_.Of.MACROMOLECULE_DIFFERENCE;const n=e.DataFrame.fromColumns([s]);a.shell.addTableView(n),await(0,t.gw)(100);const r=s.getTag(e.TAGS.CELL_RENDERER);if("MacromoleculeDifference"!==r)throw new Error(`Units 'separator', separator '/' and semType 'MacromoleculeDifference' have been manually set on column but after df was added as table, view renderer has set to '${r}' instead of correct 'MacromoleculeDifference'.`)}()}))}));var k=s(6414),F=s.n(k),D=s(9611);(0,t.W3)("renderers: monomerPlacer",(()=>{const s={splitter:{csv:"id,seq\nid1,m1-M-m3-mon4-mon5-N-T-MON8-N9\nid2,m1-mon2-m3-mon4-mon5-Num-MON8-N9\nid3,mon1-M-mon3-mon4-mon5-MON8-N9\n",testList:[{src:{row:0,x:-1},tgt:{pos:null}},{src:{row:1,x:0},tgt:{pos:null}},{src:{row:1,x:5},tgt:{pos:0}},{src:{row:1,x:6},tgt:{pos:0}},{src:{row:1,x:26},tgt:{pos:1}},{src:{row:1,x:160},tgt:{pos:6}},{src:{row:1,x:185},tgt:{pos:7}},{src:{row:2,x:140},tgt:{pos:5}},{src:{row:2,x:145},tgt:{pos:5}}]},splitterMsa:{csv:"id,seq\nid1,m1-M-m3-mon4-mon5-N-T-MON8-N9\nid2,m1-mon2-m3-mon4-mon5-Num--MON8-N9\nid3,\nid4,mon1-M-mon3-mon4-mon5---MON8-N9\n",testList:[{src:{row:0,x:-1},tgt:{pos:null}},{src:{row:1,x:0},tgt:{pos:null}},{src:{row:1,x:1},tgt:{pos:null}},{src:{row:1,x:4},tgt:{pos:null}},{src:{row:1,x:5},tgt:{pos:0}},{src:{row:1,x:37},tgt:{pos:0}},{src:{row:1,x:38},tgt:{pos:1}},{src:{row:1,x:170},tgt:{pos:4}},{src:{row:1,x:200},tgt:{pos:5}},{src:{row:2,x:20},tgt:{pos:null}},{src:{row:3,x:170},tgt:{pos:4}},{src:{row:3,x:200},tgt:{pos:5}},{src:{row:3,x:282},tgt:{pos:null}}]},fastaMsa:{csv:"id,seq\nid1,QQYNIYPLT\nid2,QQWSSFPYT\nid3,\nid3,QHIRE--LT\n",testList:[{src:{row:1,x:-1},tgt:{pos:null}},{src:{row:1,x:0},tgt:{pos:null}},{src:{row:1,x:1},tgt:{pos:null}},{src:{row:1,x:19},tgt:{pos:0}},{src:{row:1,x:170},tgt:{pos:8}},{src:{row:1,x:171},tgt:{pos:8}},{src:{row:2,x:5},tgt:{pos:null}},{src:{row:3,x:170},tgt:{pos:8}},{src:{row:3,x:181},tgt:{pos:null}}]}};for(const[n,r]of Object.entries(s))(0,t.Bu)(`getPosition-${n}`,(async()=>{const t=e.DataFrame.fromCsv(r.csv);await a.data.detectSemanticTypes(t);const s=t.getCol("seq"),n=new D.A(null,s,(()=>({unitsHandler:h.Cn.getOrCreate(s),monomerCharWidth:7,separatorWidth:12,monomerToShort:c.GU,monomerLengthLimit:3}))),i=r.testList;for(let e=0;e<s.length;++e)n.getCellMonomerLengths(e);const o=[];for(const[e,t]of F().enumerate(i)){const t={pos:n.getPosition(e.src.row,e.src.x)};e.tgt.pos!=t.pos&&o.push(`Test src ${JSON.stringify(e.src)} expected tgt ${JSON.stringify(e.tgt)}, but get ${JSON.stringify({res:t})}`)}if(o.length>0)throw new Error("Test failed error(s):\n"+o.join(", n"))}))})),(0,t.W3)("converters",(()=>{let s;!function(e){e.fastaPt="fastaPt",e.separatorPt="separatorPt",e.helmPt="helmPt",e.fastaDna="fastaDna",e.separatorDna="separatorDna",e.helmDna="helmDna",e.fastaRna="fastaRna",e.separatorRna="separatorRna",e.helmRna="helmRna",e.fastaGaps="fastaGaps",e.separatorGaps="separatorGaps",e.helmGaps="helmGaps",e.fastaUn="fastaUn",e.separatorUn="separatorUn",e.helmUn="helmUn",e.helmLoneDeoxyribose="helmLoneDeoxyribose",e.helmLoneRibose="helmLoneRibose",e.helmLonePhosphorus="helmLonePhosphorus",e.fastaLoneDeoxyribose="fastaLoneDeoxyribose",e.fastaLoneRibose="fastaLoneRibose",e.fastaLonePhosphorus="fastaLonePhosphorus"}(s||(s={}));const n={[s.fastaPt]:"seq\nFWPHEYFWPHEY\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",[s.separatorPt]:"seq\nF-W-P-H-E-Y-F-W-P-H-E-Y\nY-N-R-Q-W-Y-V-Y-N-R-Q-W-Y-V\nM-K-P-S-E-Y-V-M-K-P-S-E-Y-V",[s.helmPt]:"seq\nPEPTIDE1{F.W.P.H.E.Y.F.W.P.H.E.Y}$$$$\nPEPTIDE1{Y.N.R.Q.W.Y.V.Y.N.R.Q.W.Y.V}$$$$\nPEPTIDE1{M.K.P.S.E.Y.V.M.K.P.S.E.Y.V}$$$$",[s.fastaDna]:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",[s.separatorDna]:"seq\nA/C/G/T/C/A/C/G/T/C\nC/A/G/T/G/T/C/A/G/T/G/T\nT/T/C/A/A/C/T/T/C/A/A/C",[s.helmDna]:"seq\nRNA1{d(A)p.d(C)p.d(G)p.d(T)p.d(C)p.d(A)p.d(C)p.d(G)p.d(T)p.d(C)p}$$$$\nRNA1{d(C)p.d(A)p.d(G)p.d(T)p.d(G)p.d(T)p.d(C)p.d(A)p.d(G)p.d(T)p.d(G)p.d(T)p}$$$$\nRNA1{d(T)p.d(T)p.d(C)p.d(A)p.d(A)p.d(C)p.d(T)p.d(T)p.d(C)p.d(A)p.d(A)p.d(C)p}$$$$",[s.fastaRna]:"seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",[s.separatorRna]:"seq\nA*C*G*U*C*A*C*G*U*C\nC*A*G*U*G*U*C*A*G*U*G*U\nU*U*C*A*A*C*U*U*C*A*A*C",[s.helmRna]:"seq\nRNA1{r(A)p.r(C)p.r(G)p.r(U)p.r(C)p.r(A)p.r(C)p.r(G)p.r(U)p.r(C)p}$$$$\nRNA1{r(C)p.r(A)p.r(G)p.r(U)p.r(G)p.r(U)p.r(C)p.r(A)p.r(G)p.r(U)p.r(G)p.r(U)p}$$$$\nRNA1{r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p.r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p}$$$$",[s.fastaGaps]:"seq\nFW-PH-EYYFW-PH-EYY\nFYNRQWYV-FYNRQWYV-\nFKP-Q-SEYVFKP-Q-SEYV",[s.separatorGaps]:"seq\nF/W//P/H//E/Y/Y/F/W//P/H//E/Y/Y\nF/Y/N/R/Q/W/Y/V//F/Y/N/R/Q/W/Y/V/\nF/K/P//Q//S/E/Y/V/F/K/P//Q//S/E/Y/V",[s.helmGaps]:"seq\nPEPTIDE1{F.W.*.P.H.*.E.Y.Y.F.W.*.P.H.*.E.Y.Y}$$$$\nPEPTIDE1{F.Y.N.R.Q.W.Y.V.*.F.Y.N.R.Q.W.Y.V.*}$$$$\nPEPTIDE1{F.K.P.*.Q.*.S.E.Y.V.F.K.P.*.Q.*.S.E.Y.V}$$$$",[s.fastaUn]:"seq\n[meI][hHis][Aca]NT[dE][Thr_PO3H2][Aca]D[meI][hHis][Aca]NT[dE][Thr_PO3H2][Aca]D\n[meI][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2][meI][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2]\n[Lys_Boc][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca][Tyr_PO3H2][Lys_Boc][hHis][Aca][Cys_SEt]T[dK][Thr_PO3H2][Aca]",[s.separatorUn]:"seq\nmeI-hHis-Aca-N-T-dE-Thr_PO3H2-Aca-D-meI-hHis-Aca-N-T-dE-Thr_PO3H2-Aca-D\nmeI-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2-meI-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2\nLys_Boc-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2-Lys_Boc-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca",[s.helmUn]:"seq\nPEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D.meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2}$$$$\nPEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca}$$$$",[s.helmLoneDeoxyribose]:"seq\nRNA1{d(A).d(C).d(G).d(T).d(C).d(A).d(C).d(G).d(T).d(C)}$$$$\nRNA1{d(C).d(A).d(G).d(T).d(G).d(T)p.d(C).d(A).d(G).d(T).d(G).d(T)p}$$$$\nRNA1{d(T).d(T).d(C).d(A).d(A).d(C)p.d(T).d(T).d(C).d(A).d(A).d(C)p}$$$$",[s.helmLoneRibose]:"seq\nRNA1{r(A).r(C).r(G).r(U).r(C).r(A).r(C).r(G).r(U).r(C)}$$$$\nRNA1{r(C).r(A).r(G).r(U).r(G).r(U)p.r(C).r(A).r(G).r(U).r(G).r(U)p}$$$$\nRNA1{r(U).r(U).r(C).r(A).r(A).r(C)p.r(U).r(U).r(C).r(A).r(A).r(C)p}$$$$",[s.helmLonePhosphorus]:"seq\nRNA1{p.p.r(A)p.r(C)p.r(G)p.r(U)p.r(C)p.r(A)p.r(C)p.r(G)p.r(U)p.r(C)p}$$$$\nRNA1{p.p.r(C)p.r(A)p.p.r(G)p.r(U)p.r(G)p.r(U)p.r(C)p.r(A)p.p.r(G)p.r(U)p.r(G)p.r(U)p}$$$$\nRNA1{p.r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p.r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p.p.p}$$$$"};async function r(t){const s=n[t],r=e.DataFrame.fromCsv(s);return await a.data.detectSemanticTypes(r),r}function i(s,n){if(s===c.r2.SEPARATOR&&!n)throw new Error(`Argument 'separator' is mandatory for target notation '${s.toString()}'.`);return function(r){const i=h.Cn.getOrCreate(r).convert(s,n);return(0,t.l_)(i.getTag(e.TAGS.UNITS),s),i}}async function o(e,s,n){const i=s((await r(e)).getCol("seq")),o=(await r(n)).getCol("seq");(0,t.f6)(i.toList(),o.toList()),h.Cn.getOrCreate(i)}(0,t.Bu)("testFastaPtToSeparator",(async()=>{await o(s.fastaPt,i(c.r2.SEPARATOR,"-"),s.separatorPt)})),(0,t.Bu)("testFastaDnaToSeparator",(async()=>{await o(s.fastaDna,i(c.r2.SEPARATOR,"/"),s.separatorDna)})),(0,t.Bu)("testFastaRnaToSeparator",(async()=>{await o(s.fastaRna,i(c.r2.SEPARATOR,"*"),s.separatorRna)})),(0,t.Bu)("testFastaGapsToSeparator",(async()=>{await o(s.fastaGaps,i(c.r2.SEPARATOR,"/"),s.separatorGaps)})),(0,t.Bu)("testFastaUnToSeparator",(async()=>{await o(s.fastaUn,i(c.r2.SEPARATOR,"-"),s.separatorUn)})),(0,t.Bu)("testFastaPtToHelm",(async()=>{await o(s.fastaPt,i(c.r2.HELM),s.helmPt)})),(0,t.Bu)("testFastaDnaToHelm",(async()=>{await o(s.fastaDna,i(c.r2.HELM),s.helmDna)})),(0,t.Bu)("testFastaRnaToHelm",(async()=>{await o(s.fastaRna,i(c.r2.HELM),s.helmRna)})),(0,t.Bu)("testFastaGapsToHelm",(async()=>{await o(s.fastaGaps,i(c.r2.HELM),s.helmGaps)})),(0,t.Bu)("testSeparatorPtToFasta",(async()=>{await o(s.separatorPt,i(c.r2.FASTA),s.fastaPt)})),(0,t.Bu)("testSeparatorDnaToFasta",(async()=>{await o(s.separatorDna,i(c.r2.FASTA),s.fastaDna)})),(0,t.Bu)("testSeparatorRnaToFasta",(async()=>{await o(s.separatorRna,i(c.r2.FASTA),s.fastaRna)})),(0,t.Bu)("testSeparatorGapsToFasta",(async()=>{await o(s.separatorGaps,i(c.r2.FASTA),s.fastaGaps)})),(0,t.Bu)("testSeparatorUnToFasta",(async()=>{await o(s.separatorUn,i(c.r2.FASTA),s.fastaUn)})),(0,t.Bu)("testSeparatorPtToHelm",(async()=>{await o(s.separatorPt,i(c.r2.HELM),s.helmPt)})),(0,t.Bu)("testSeparatorDnaToHelm",(async()=>{await o(s.separatorDna,i(c.r2.HELM),s.helmDna)})),(0,t.Bu)("testSeparatorRnaToHelm",(async()=>{await o(s.separatorRna,i(c.r2.HELM),s.helmRna)})),(0,t.Bu)("testSeparatorGapsToHelm",(async()=>{await o(s.separatorGaps,i(c.r2.HELM),s.helmGaps)})),(0,t.Bu)("testHelmDnaToFasta",(async()=>{await o(s.helmDna,i(c.r2.FASTA),s.fastaDna)})),(0,t.Bu)("testHelmRnaToFasta",(async()=>{await o(s.helmRna,i(c.r2.FASTA),s.fastaRna)})),(0,t.Bu)("testHelmPtToFasta",(async()=>{await o(s.helmPt,i(c.r2.FASTA),s.fastaPt)})),(0,t.Bu)("testHelmUnToFasta",(async()=>{await o(s.helmUn,i(c.r2.FASTA),s.fastaUn)})),(0,t.Bu)("testHelmDnaToSeparator",(async()=>{await o(s.helmDna,i(c.r2.SEPARATOR,"/"),s.separatorDna)})),(0,t.Bu)("testHelmRnaToSeparator",(async()=>{await o(s.helmRna,i(c.r2.SEPARATOR,"*"),s.separatorRna)})),(0,t.Bu)("testHelmPtToSeparator",(async()=>{await o(s.helmPt,i(c.r2.SEPARATOR,"-"),s.separatorPt)})),(0,t.Bu)("testHelmUnToSeparator",(async()=>{await o(s.helmUn,i(c.r2.SEPARATOR,"-"),s.separatorUn)})),(0,t.Bu)("testHelmLoneRibose",(async()=>{await o(s.helmLoneRibose,i(c.r2.FASTA),s.fastaRna)})),(0,t.Bu)("testHelmLoneDeoxyribose",(async()=>{await o(s.helmLoneDeoxyribose,i(c.r2.SEPARATOR,"/"),s.separatorDna)})),(0,t.Bu)("testHelmLonePhosphorus",(async()=>{await o(s.helmLonePhosphorus,i(c.r2.FASTA),s.fastaRna)}))}));var G=s(5226);(0,t.W3)("fastaFileHandler",(()=>{const s=["description:1","description:2","description:3","description:4"],n=(e.Column.fromStrings("description",s),["MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW","MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL","MMELVLKTIIGPIVVGVVLRIVDKWLNKDK","MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN"]);function r(e){const r=new G.i(e),i=r.descriptionsArray,o=r.sequencesArray;(0,t.f6)([i,o],[s,n])}(0,t.Bu)("testNormalFormatting",(async()=>{r(">description:1\nMDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\n\n>description:2\nMIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL\n\n>description:3\nMMELVLKTIIGPIVVGVVLRIVDKWLNKDK\n\n>description:4\nMDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN\n")})),(0,t.Bu)("testExtraSpaces",(async()=>{r(">description:1\n MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\n\n>description:2\nMI EVF LFGIVLGLI PITLAGLFVTAY LQYRRGDQLDL\n\n>description:3\nM MELVLKTI IGPI VVGVVLR IVDKWLNKDK\n\n>description:4\nMDR TDEVSNHTHDKP TLTWFEEIFEEYHSPFHN\n ")})),(0,t.Bu)("testExtraNewlines",(async()=>{r(">description:1\n\nMDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\n\n>description:2\nMIEVF\nLFGIVLGLI\nPITLAGLFVTA\nYLQYRRGDQLDL\n\n>description:3\nM\nME\n\nLVLKTIIG\n\nPIVVGVVLRI\nVDKWLNKDK\n\n\n>description:4\n\nMDRT\n\nDEVSNHTHDKP\n\nTLTWFEEIFEE\n\n\n\nYHSPFHN\n")}))}));var H=s(9943);(0,t.W3)("fastaExport",(()=>{let s;!function(e){e.single="single",e.multi="multi"}(s||(s={}));const n={[s.single]:{src:"MDYKETLLMPKTDFPMRGGLP",tgt:["MDYKETLLMP","KTDFPMRGGL","P"]},[s.multi]:{src:"M[MeI]YKETLL[MeF]PKTDFPMRGGL[MeA]",tgt:["M[MeI]YKETLL[MeF]P","KTDFPMRGGL","[MeA]"]}};let r;!function(e){e.test1="test1",e.test2="test2"}(r||(r={}));const i={[r.test1]:{srcCsv:"id,seq\n1,MDYKETLLMP\n2,KTDFPMRGGL\n3,P",idCols:["id"],seqCol:"seq",lineWidth:10,tgtFasta:">1\nMDYKETLLMP\n>2\nKTDFPMRGGL\n>3\nP\n"},[r.test2]:{srcCsv:"id,id2,seq\n1,seqA,M[MeI]YKETLL[MeF]P\n2,seqB,KTDFPMRGGL\n3,seqC,[MeA]\n",idCols:["id2","id"],seqCol:"seq",lineWidth:5,tgtFasta:">seqA|1\nM[MeI]YKE\nTLL[MeF]P\n>seqB|2\nKTDFP\nMRGGL\n>seqC|3\n[MeA]\n"}};function o(e,s=10){const r=c.kB,i=n[e].src,o=(0,H.sK)(i,r,s),a=n[e].tgt;(0,t.f6)(o,a)}async function a(s){const n=e.DataFrame.fromCsv(s.srcCsv),r=n.getCol(s.seqCol),i=s.idCols.map((e=>n.getCol(e))),o=(0,H.i$)(i,r,s.lineWidth);(0,t.l_)(o,s.tgtFasta)}(0,t.Bu)("wrapSequenceSingle",(async()=>{o(s.single,10)})),(0,t.Bu)("wrapSequenceMulti",(async()=>{o(s.multi,10)})),(0,t.Bu)("saveAsFastaTest1",(async()=>{a(i[r.test1])})),(0,t.Bu)("saveAsFastaTest2",(async()=>{a(i[r.test2])}))}));var W=s(7331),B=s(8260);(0,t.W3)("bio",(()=>{const s="seq\nACGTCT\nCAGTGT\nTTCAAC";(0,t.Bu)("testGetStatsHelm1",(async()=>{const s=e.DataFrame.fromCsv("seq\nPEPTIDE1{meI}$$$$").getCol("seq"),n=(0,B.jY)(s,1,c.gP);(0,t.Wh)(n.freq,{meI:1}),(0,t.l_)(n.sameLength,!0)})),(0,t.Bu)("testGetStatsN1",(async()=>{await async function(s){const n=e.DataFrame.fromCsv(s).col("seq"),r=(0,B.jY)(n,5,c.kB);(0,t.Wh)(r.freq,{A:4,C:5,G:3,T:6}),(0,t.l_)(r.sameLength,!0)}(s)})),(0,t.Bu)("testGetAlphabetSimilarity",(async()=>{await async function(){const e=new Set(Object.keys(o.V.Names)),s=(0,c.KX)({A:2041,C:3015,G:3015,T:2048,"-":1e3},e);(0,t.l_)(s>.6,!0)}()})),(0,t.Bu)("testPickupPaletteN1",(async()=>{await async function(s){const n=e.DataFrame.fromCsv(s).col("seq"),r=(0,c.dQ)(n);(0,t.l_)(r instanceof o.J,!0)}(s)})),(0,t.Bu)("testPickupPaletteN1e",(async()=>{await async function(s){const n=e.DataFrame.fromCsv("seq\nACGTAT\nCAGTTG\nTTCG2C").col("seq"),r=(0,c.dQ)(n);(0,t.l_)(r instanceof o.J,!0)}()})),(0,t.Bu)("testPickupPaletteAA1",(async()=>{await async function(s){const n=e.DataFrame.fromCsv("seq\nFWPHEYV\nYNRQWYV\nMKPSEYV").col("seq"),i=(0,c.dQ)(n);(0,t.l_)(i instanceof r.f,!0)}()})),(0,t.Bu)("testPickupPaletteX",(async()=>{await async function(s){const n=e.DataFrame.fromCsv("seq\nXZJ{}2\n5Z4733\n3Z6></\n675687").col("seq"),r=(0,c.dQ)(n);(0,t.l_)(r instanceof W.kQ,!0)}()}))})),(0,t.W3)("WebLogo.monomerToShort",(()=>{(0,t.Bu)("longMonomerSingle",(async()=>{(0,t.l_)((0,c.GU)("S",5),"S")})),(0,t.Bu)("longMonomerShort",(async()=>{(0,t.l_)((0,c.GU)("Short",5),"Short")})),(0,t.Bu)("longMonomerLong56",(async()=>{(0,t.l_)((0,c.GU)("Long56",6),"Long56")})),(0,t.Bu)("longMonomerComplexFirstPartShort",(async()=>{(0,t.l_)((0,c.GU)("Long-long",5),"Long…")})),(0,t.Bu)("longMonomerComplexFirstPartLong56",(async()=>{(0,t.l_)((0,c.GU)("Long56-long",6),"Long5…")})),(0,t.Bu)("monomerToShort",(async()=>{const e=[["AbC","AbC"],["AbCd","Ab…"],["ABc","ABc"],["ABcd","AB…"],["A_b","A_b"],["A_bc","A…"],["Ab_c","Ab…"],["A1_b","A1…"],["Abc_d","Ab…"],["Abcd_e","Ab…"],["A-b","A-b"],["A-bc","A…"],["Ab-c","Ab…"],["A1-b","A1…"],["Abc-d","Ab…"],["Abcd-e","Ab…"],["A","A"],["Ab","Ab"],["Abc","Abc"],["Ab…","Ab…"],["Abcd","Ab…"],["Abcde","Ab…"]],s=e.map((e=>e[0])),n=e.map((e=>e[1])),r=s.map((e=>(0,c.GU)(e,3)));(0,t.f6)(r,n)}))}));var V=s(8415);function U(e,s){(0,t.l_)(e.name,s.name),(0,t.f6)(e.getMonomers(),s.getMonomers());for(const n of e.getMonomers())(0,t.l_)(e.getFreq(n).rowCount,s.getFreq(n).rowCount)}(0,t.W3)("WebLogo-positions",(()=>{const s="seq\nATC-G-TTGC--\nATC-G-TTGC--\n-TC-G-TTGC--\n-TC-GCTTGC--\n-TC-GCTTGC--";(0,t.Bu)("allPositions",(async()=>{const n=e.DataFrame.fromCsv(s),r=a.shell.addTableView(n),i=n.getCol("seq");i.semType=e.SEMTYPE.MACROMOLECULE,i.setTag(e.TAGS.UNITS,c.r2.FASTA),i.setTag("alphabet","DNA"),i.setTag("aligned","SEQ.MSA");const o=await n.plot.fromType("WebLogo");await(0,t.zg)(o.onLayoutCalculated,(()=>{}),(()=>{r.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const l=o.positions,h=[new V.CK(0,"1",{A:new V.yW(2),"-":new V.yW(3)}),new V.CK(1,"2",{T:new V.yW(5)}),new V.CK(2,"3",{C:new V.yW(5)}),new V.CK(3,"4",{"-":new V.yW(5)}),new V.CK(4,"5",{G:new V.yW(5)}),new V.CK(5,"6",{"-":new V.yW(3),C:new V.yW(2)}),new V.CK(6,"7",{T:new V.yW(5)}),new V.CK(7,"8",{T:new V.yW(5)}),new V.CK(8,"9",{G:new V.yW(5)}),new V.CK(9,"10",{C:new V.yW(5)}),new V.CK(10,"11",{"-":new V.yW(5)}),new V.CK(11,"12",{"-":new V.yW(5)})];(0,t.l_)(l.length,h.length);for(let e=0;e<l.length;e++){(0,t.l_)(l[e].name,h[e].name);for(const s of l[e].getMonomers())(0,t.l_)(l[e].getFreq(s).rowCount,h[e].getFreq(s).rowCount)}await o.awaitRendered()})),(0,t.Bu)("positions with shrinkEmptyTail option true (filtered)",(async()=>{const s=e.DataFrame.fromCsv("seq\n-TC-G-TTGC--\n-TC-GCTTGC--\n-T--C-GT-\n-T--C-GT-\n-T--C-GT-\n-T--CCGT-"),n=a.shell.addTableView(s),r=s.getCol("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.setTag(e.TAGS.UNITS,c.r2.FASTA),r.setTag("alphabet","DNA"),r.setTag("aligned","SEQ"),s.filter.init((e=>e>2)),s.filter.fireChanged();const i=await s.plot.fromType("WebLogo",{shrinkEmptyTail:!0});await(0,t.zg)(i.onLayoutCalculated,(()=>{}),(()=>{n.dockManager.dock(i.root,e.DOCK_TYPE.DOWN)}),500);const o=i.positions,l=[new V.CK(0,"1",{"-":new V.yW(3)}),new V.CK(1,"2",{T:new V.yW(3)}),new V.CK(2,"3",{"-":new V.yW(3)}),new V.CK(3,"4",{"-":new V.yW(3)}),new V.CK(4,"5",{C:new V.yW(3)}),new V.CK(5,"6",{"-":new V.yW(2),C:new V.yW(1)}),new V.CK(6,"7",{G:new V.yW(3)}),new V.CK(7,"8",{T:new V.yW(3)}),new V.CK(8,"9",{"-":new V.yW(3)})];(0,t.l_)(o.length,l.length);for(let e=0;e<o.length;e++){(0,t.l_)(o[e].name,l[e].name);for(const s of o[e].getMonomers())(0,t.l_)(o[e].getFreq(s).rowCount,l[e].getFreq(s).rowCount)}await i.awaitRendered()})),(0,t.Bu)("positions with skipEmptyPositions option",(async()=>{const n=e.DataFrame.fromCsv(s),r=a.shell.addTableView(n),i=n.getCol("seq");i.semType=e.SEMTYPE.MACROMOLECULE,i.setTag(e.TAGS.UNITS,c.r2.FASTA),i.setTag("alphabet","DNA"),i.setTag("aligned","SEQ.MSA");const o=await n.plot.fromType("WebLogo",{skipEmptyPositions:!0});await(0,t.zg)(o.onLayoutCalculated,(()=>{}),(()=>{r.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const l=o.positions,h=[new V.CK(0,"1",{A:new V.yW(2),"-":new V.yW(3)}),new V.CK(1,"2",{T:new V.yW(5)}),new V.CK(2,"3",{C:new V.yW(5)}),new V.CK(4,"5",{G:new V.yW(5)}),new V.CK(5,"6",{"-":new V.yW(3),C:new V.yW(2)}),new V.CK(6,"7",{T:new V.yW(5)}),new V.CK(7,"8",{T:new V.yW(5)}),new V.CK(8,"9",{G:new V.yW(5)}),new V.CK(9,"10",{C:new V.yW(5)})];(0,t.l_)(l.length,h.length);for(let e=0;e<l.length;e++)U(l[e],h[e]);await o.awaitRendered()})),(0,t.Bu)("count sequences for monomer at position",(async()=>{const n=function(t,s,n,r){const i=e.DataFrame.fromCsv(t),o=i.getCol("seq");return o.semType=e.SEMTYPE.MACROMOLECULE,o.setTag(e.TAGS.UNITS,s),o.setTag("alphabet","DNA"),o.setTag("aligned","SEQ.MSA"),i}(s,c.r2.FASTA),r=n.getCol("seq"),i=a.shell.addTableView(n),o=await n.plot.fromType("WebLogo",{startPositionName:"3",endPositionName:"7",skipEmptyPositions:!0});await(0,t.zg)(o.onLayoutCalculated,(()=>{}),(()=>{i.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const l=o.positions,u=[new V.CK(2,"3",{C:new V.yW(5)}),new V.CK(4,"5",{G:new V.yW(5)}),new V.CK(5,"6",{"-":new V.yW(3),C:new V.yW(2)}),new V.CK(6,"7",{T:new V.yW(5)})];(0,t.l_)(l.length,u.length);for(let e=0;e<l.length;e++)U(l[e],u[e]);const d=l[1],m=h.Cn.getOrCreate(r),p=(0,V.eZ)(n,m,n.filter,"G",d);(0,t.l_)(p,5),await o.awaitRendered()})),(0,t.Bu)("empty",(async()=>{const s=e.DataFrame.fromColumns([(()=>{const t=e.Column.fromStrings("seq",[]);return t.setTag(e.TAGS.SEMTYPE,e.SEMTYPE.MACROMOLECULE),t.setTag(e.TAGS.UNITS,c.r2.FASTA),t.setTag("alphabet","DNA"),t})()]),n=a.shell.addTableView(s),r=await s.plot.fromType("WebLogo");await(0,t.zg)(r.onLayoutCalculated,(()=>{}),(()=>{n.dockManager.dock(r.root,e.DOCK_TYPE.DOWN)}),500),r.positions,await r.awaitRendered()}))})),(0,t.W3)("WebLogo-project",(()=>{(0,t.Bu)("fasta",(async()=>{const s="Tests.Bio.WebLogo-project.fasta",n=await ge.files.readCsv("tests/filter_FASTA.csv"),r=n.name,i=n.getCol("fasta");await a.data.detectSemanticTypes(n);const o=a.shell.addTableView(n),l=await n.plot.fromType("WebLogo",{sequenceColumnName:i.name});o.dockManager.dock(l),await l.awaitRendered(),await v(o.grid),await async function(t,s,n,r){const i=e.Project.create(),o=n.saveLayout();await a.dapi.layouts.save(n.saveLayout()),await a.dapi.tables.uploadDataFrame(r),await a.dapi.tables.save(s),i.name=t,i.addChild(s),i.addChild(o),await a.dapi.projects.save(i)}(s,n.getTableInfo(),o,n),a.shell.closeAll(),await(0,t.gw)(500),await a.dapi.projects.open(s);const c=a.shell.getTableView(r),h=F()(c.viewers).toArray();(0,t.l_)(h.length,2),(0,t.l_)(h.filter((e=>"Grid"===e.type)).length,1);const u=h.find((e=>"WebLogo"===e.type));(0,t.l_)(!!u,!0),await v(o.grid),await u.awaitRendered()}),{skipReason:"depends on 1.18"})})),(0,t.W3)("WebLogo-layout",(()=>{(0,t.Bu)("fasta",(async()=>{const e=await ge.files.readCsv("tests/filter_FASTA.csv"),s=e.getCol("fasta");await a.data.detectSemanticTypes(e);const n=a.shell.addTableView(e),r=await e.plot.fromType("WebLogo",{sequenceColumnName:s.name});n.dockManager.dock(r),await r.awaitRendered(),await v(n.grid);const i=n.saveLayout();i.toJson(),n.loadLayout(i),await r.awaitRendered(),await v(n.grid);const o=F()(n.viewers).toArray();(0,t.l_)(o.length,2),(0,t.l_)(o.filter((e=>"Grid"===e.type)).length,1),(0,t.l_)(o.filter((e=>"WebLogo"===e.type)).length,1)}))}));var j=s(2568);function Y(e,t){let s=null;for(const n of e.viewers)n.type===t&&(s=n);return s}(0,t.W3)("checkInputColumn",(()=>{const s="seq\nseq1,\nseq2,\nseq3,\nseq4";(0,t.Bu)("testMsaPos",(async()=>{const n=e.DataFrame.fromCsv(s).getCol("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.setTag(e.TAGS.UNITS,c.r2.FASTA),n.setTag("alphabet","DNA"),n.setTag("aligned","SEQ");const[r,i]=(0,j.l)(n,"Test",[c.r2.FASTA],["DNA","RNA","PT"]);(0,t.l_)(r,!0)})),(0,t.Bu)("testMsaNegHelm",(async()=>{const n=e.DataFrame.fromCsv(s).getCol("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.setTag(e.TAGS.UNITS,c.r2.HELM),n.setTag(".alphabetIsMultichar","true");const[r,i]=(0,j.l)(n,"Test",[c.r2.FASTA],["DNA","RNA","PT"]);(0,t.l_)(r,!1)})),(0,t.Bu)("testMsaNegUN",(async()=>{const n=e.DataFrame.fromCsv(s).getCol("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.setTag(e.TAGS.UNITS,c.r2.FASTA),n.setTag("alphabet","UN"),n.setTag(".alphabetSize","11"),n.setTag(".alphabetIsMultichar","true"),n.setTag("aligned","SEQ");const[r,i]=(0,j.l)(n,"Test",[c.r2.FASTA],["DNA","RNA","PT"]);(0,t.l_)(r,!1)})),(0,t.Bu)("testGetActionFunctionMeta",(async()=>{e.Func.find({package:"Bio",name:"multipleSequenceAlignmentDialog"})[0].inputs.find((e=>"sequence"==e.name))}))})),(0,t.W3)("similarity/diversity",(async()=>{(0,t.Bu)("similaritySearchViewer",(async()=>{await async function(){const s=await ge.files.readAsText("tests/sample_MSA_data.csv"),n=e.DataFrame.fromCsv(s);await a.data.detectSemanticTypes(n);const r=a.shell.addTableView(n),i=r.dataFrame.getCol("MSA");(0,t.l_)(i.semType,e.SEMTYPE.MACROMOLECULE);const o=await r.dataFrame.plot.fromType("Sequence Similarity Search");let l=!1;if(o.computeCompleted.subscribe((e=>{e&&(l=!0)})),r.dockManager.dock(o,e.DOCK_TYPE.RIGHT,null,"Similarity"),await o.renderPromise,await(0,t.ow)((()=>void 0!==Y(r,"Sequence Similarity Search")),"Sequence Similarity Search viewer has not been created",100),!o.initialized)throw new Error("The viewer is not initialized.");if(!o.moleculeColumn)throw new Error("The viewer has not molecule column (onTableAttached).");if(!o.beforeRender())throw new Error("The viewer is not able to render.");if(!o.computeRequested)throw new Error("The viewer has not compute requested even.");if(!l)throw new Error("The viewer has not compute completed.");const c=o;await(0,t.ow)((()=>0!==c.root.getElementsByClassName("d4-grid").length),"Sequence Similarity Search viewer grid has not been created",100);(0,t.l_)(c.fingerprint,"Morgan"),(0,t.l_)(c.distanceMetric,"Tanimoto"),(0,t.l_)(c.scores.get(0),e.FLOAT_NULL),(0,t.l_)(c.idxs.get(0),0),(0,t.l_)(c.molCol.get(0),"D-Tyr_Et/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr//Phe_4Me"),(0,t.l_)(c.scores.get(1).toFixed(2),"0.73"),(0,t.l_)(c.idxs.get(1),4),(0,t.l_)(c.molCol.get(1),"Thr_PO3H2/Aca/D-Tyr_Et/Tyr_ab-dehydroMe/dV/Chg/N/D-Orn/D-aThr//Phe_4Me"),r.dataFrame.currentRowIdx=1,await(0,t.ow)((()=>1===c.targetMoleculeIdx),"Target molecule has not been changed",5e3),await(0,t.ow)((()=>"meI/hHis/Aca/Cys_SEt/T/dK/Thr_PO3H2/Aca/Tyr_PO3H2/D-Chg/dV/Phe_ab-dehydro/N/D-Orn/D-aThr//Phe_4Me"===c.molCol.get(0)),"Incorrect first similar molecule",5e3)}()})),(0,t.Bu)("diversitySearchViewer",(async()=>{await async function(){const s=await ge.files.readAsText("tests/sample_MSA_data.csv"),n=e.DataFrame.fromCsv(s),r=a.shell.addTableView(n);await a.data.detectSemanticTypes(n);const i=r.dataFrame.getCol("MSA");(0,t.l_)(i.semType,e.SEMTYPE.MACROMOLECULE);const o=await r.dataFrame.plot.fromType("Sequence Diversity Search");let l=!1;if(o.computeCompleted.subscribe((e=>{e&&(l=!0)})),r.dockManager.dock(o,e.DOCK_TYPE.DOWN,null,"Diversity"),await o.renderPromise,await(0,t.ow)((()=>void 0!==Y(r,"Sequence Diversity Search")),"Sequence Diversity Search viewer has not been created",100),!o.initialized)throw new Error("The viewer is not initialized.");if(!o.moleculeColumn)throw new Error("The viewer has not molecule column (onTableAttached).");if(!o.beforeRender())throw new Error("The viewer is not able to render.");if(!o.computeRequested)throw new Error("The viewer has not compute requested even.");if(!l)throw new Error("The viewer has not compute completed.");const c=o;await(0,t.ow)((()=>0!==c.root.getElementsByClassName("d4-grid").length),"Sequence Diversity Search viewer grid has not been created",100),(0,t.l_)(c.fingerprint,"Morgan"),(0,t.l_)(c.distanceMetric,"Tanimoto"),(0,t.l_)(c.initialized,!0),(0,t.l_)(c.renderMolIds.length>0,!0)}()}))}));var K=s(3870),q=s(5393),Z=s(8755);async function z(e,t){if(!t.columns.names().includes(e))throw new Error(`The column '${e}' not found. Available in data frame are ${JSON.stringify(t.columns.names())}`);const s=new q.ST;return s.attach(t),s.applyState({columnName:e}),s.column=t.col(e),s.columnName=e,s}(0,t.W3)("substructureFilters",(async()=>{let e,s;(0,t.bb)((async()=>{e=await(0,$.JN)(),s=await(0,x.nW)(),await(0,x.tb)(),await e.loadLibraries(!0)})),(0,t.X5)((async()=>{await(0,x.tW)(s),await e.loadLibraries(!0)})),(0,t.Bu)("fasta",(async()=>{const e=await w("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(e);const s=new q.ST;s.attach(e),await s.awaitRendered();try{(0,t.l_)(!!s.bioFilter,!0),(0,t.l_)(s.bioFilter.type,"FastaBioFilter");const n=s.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{n.props=new Z.x("MD")}),5e3,"testEvent onRowsFiltered"),(0,t.l_)(s.dataFrame.filter.trueCount,3),(0,t.l_)(s.dataFrame?.filter.toBinaryString(),"10010000100000")}finally{s.detach()}await s.awaitRendered()})),(0,t.Bu)("separator",(async()=>{const e=await w("tests/filter_MSA.csv"),s=new q.ST;await a.data.detectSemanticTypes(e),s.attach(e),await s.awaitRendered();try{(0,t.l_)(!!s.bioFilter,!0),(0,t.l_)(s.bioFilter.type,"SeparatorBioFilter");const n=s.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{n.props=new q.LH("meI")}),5e3,"testEvent onRowsFiltered"),(0,t.l_)(s.dataFrame.filter.trueCount,7),(0,t.l_)(s.dataFrame.filter.get(2),!1),await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{n.props=new q.LH("/meI")}),5e3,"testEvent onRowsFiltered"),(0,t.l_)(s.dataFrame.filter.trueCount,0),await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{n.props=new q.LH("meI-hHis","-")}),5e3,"testEvent onRowsFiltered"),(0,t.l_)(s.dataFrame.filter.trueCount,7),(0,t.l_)(s.dataFrame.filter.get(2),!1)}finally{s.detach()}await s.awaitRendered()})),(0,t.Bu)("helm-dialog",(async()=>{const e="Bio tests: substructureFilters/helm-dialog",s=await w("tests/filter_HELM.csv");await a.data.detectSemanticTypes(s);const n=a.shell.addTableView(s);ge.logger.debug(`${e}, filter attaching.`);const r=new q.ST;r.attach(s);const i=K.dialog("Test filters").add(r.root).show();await r.awaitRendered();try{const i=r.bioFilter;(0,t.l_)(null!==r.bioFilter,!0,"bioFilter is not created"),ge.logger.debug(`${e}, filter 1 change awaiting...`),await(0,t.zg)(s.onRowsFiltered,(()=>{}),(()=>{i.props=new Z.x("PEPTIDE1{A.C}$$$$V2.0")}),2e4),ge.logger.debug(`${e}, filter 1 changed.`),(0,t.l_)(r.dataFrame.filter.trueCount,1),(0,t.l_)(r.dataFrame.filter.toBinaryString(),"0001"),ge.logger.debug(`${e}, filter 2 change awaiting...`),await(0,t.zg)(s.onRowsFiltered,(()=>{}),(()=>{i.props=new Z.x("PEPTIDE1{C}$$$$V2.0")}),2e4),await v(n.grid),ge.logger.debug(`${e}, filter 2 changed.`),(0,t.l_)(r.dataFrame.filter.trueCount,2),(0,t.l_)(r.dataFrame.filter.toBinaryString(),"1001")}finally{i.close()}await r.awaitRendered()})),(0,t.Bu)("helm-view",(async()=>{const e=await w("tests/filter_HELM.csv");e.getCol("HELM string"),await a.data.detectSemanticTypes(e);const t=a.shell.addTableView(e);t.getFiltersGroup(),await v(t.grid)})),(0,t.Bu)("sync-fasta",(async()=>{const e=await ge.files.readCsv("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(e);const s=await z("fasta",e),n=await z("fasta",e);await Promise.all([s.awaitRendered(),n.awaitRendered()]);try{(0,t.l_)(!!s.bioFilter,!0),(0,t.l_)(!!n.bioFilter,!0),(0,t.l_)(s.bioFilter.type,"FastaBioFilter"),(0,t.l_)(n.bioFilter.type,"FastaBioFilter");const r=s.bioFilter,i=n.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new Z.x("MD")}),1e4,"await onRowsFiltered"),(0,t.l_)(e.filter.trueCount,3),await s.awaitRendered(),(0,t.l_)(i.props.substructure,"MD")}finally{s.detach(),n.detach()}await Promise.all([s.awaitRendered(),n.awaitRendered()])})),(0,t.Bu)("sync-msa",(async()=>{const e=await ge.files.readCsv("tests/filter_MSA.csv");await a.data.detectSemanticTypes(e);const s="hHis-Aca",n=await z("MSA",e),r=await z("MSA",e);await Promise.all([n.awaitRendered(),r.awaitRendered()]);try{(0,t.l_)(!!n.bioFilter,!0),(0,t.l_)(!!r.bioFilter,!0),(0,t.l_)(n.bioFilter.type,"SeparatorBioFilter"),(0,t.l_)(r.bioFilter.type,"SeparatorBioFilter");const i=n.bioFilter,o=r.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{i.props=new q.LH(s,"-")}),1e4,"await onRowsFiltered"),(0,t.l_)(e.filter.trueCount,8),(0,t.l_)(o.props.substructure,s),(0,t.l_)(o.props.separator,"-")}finally{n.detach(),r.detach()}await Promise.all([n.awaitRendered(),r.awaitRendered()])})),(0,t.Bu)("sync-helm",(async()=>{const e=await ge.files.readCsv("tests/filter_HELM.csv");await a.data.detectSemanticTypes(e);const s=a.shell.addTableView(e),n="PEPTIDE1{A.C}$$$$V2.0",r=await z("HELM string",e),i=await z("HELM string",e),o=K.dialog("Test filters").add(r.root).add(i.root).show();await Promise.all([r.awaitRendered(),i.awaitRendered()]);try{(0,t.l_)(!!r.bioFilter,!0),(0,t.l_)(!!i.bioFilter,!0),(0,t.l_)(r.bioFilter.type,"HelmBioFilter"),(0,t.l_)(i.bioFilter.type,"HelmBioFilter");const o=r.bioFilter,a=i.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{o.props=new Z.x(n)}),6e4,"await onRowsFiltered"),await v(s.grid),ge.logger.debug("Bio tests: substructureFilters/sync-helm, before changed event"),await(0,t.gw)(2*r.debounceTime),ge.logger.debug("Bio tests: substructureFilters/sync-helm, after changed event"),(0,t.l_)(e.filter.trueCount,1),await r.awaitRendered(),(0,t.l_)(a.props.substructure,n)}finally{r.detach(),i.detach(),o.close()}await Promise.all([r.awaitRendered(),i.awaitRendered()]),await v(s.grid)}))}));var X=s(8341);(0,t.W3)("PepSeA",(()=>{(0,t.Bu)("Basic alignment",(async()=>{await C();const s=e.DataFrame.fromCsv('HELM,MSA\n "PEPTIDE1{F.L.R.G.W.[MeF].Y.S.N.N.C}$$$$","F.L.R.G.W.MeF.Y..S.N.N.C"\n "PEPTIDE1{F.L.R.G.Y.[MeF].Y.W.N.C}$$$$","F.L.R.G.Y.MeF.Y.W...N.C"\n "PEPTIDE1{F.G.Y.[MeF].Y.W.S.D.N.C}$$$$","F...G.Y.MeF.Y.W.S.D.N.C"\n "PEPTIDE1{F.L.R.G.Y.[MeF].Y.W.S.N.D.C}$$$$","F.L.R.G.Y.MeF.Y.W.S.N.D.C"\n "PEPTIDE1{F.V.R.G.Y.[MeF].Y.W.S.N.C}$$$$","F.V.R.G.Y.MeF.Y.W.S..N.C"'),n=await(0,X.f3)(s.getCol("HELM"),"msa(HELM)");(0,t.l_)(null!==n,!0,"PepSeA container has not started");const r=s.getCol("MSA");for(let e=0;e<n.length;++e)(0,t.l_)(n.get(e)==r.get(e),!0)}),{timeout:6e4})})),(0,t.W3)("viewers",(()=>{const s=e.Func.find({package:"Bio",tags:["viewer"]}).map((e=>e.friendlyName));for(const e of s)(0,t.Bu)(e,(async()=>{const s=await w("data/sample_FASTA_DNA.csv");await(0,t.AB)(e,s,{detectSemanticTypes:!0})}),{skipReason:{"Sequence Similarity Search":"GROK-13162","Sequence Diversity Search":"GROK-13162",WebLogo:"GROK-13162",VdRegions:"GROK-13162"}[e]})}));const J="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",Q="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT",ee="seq\nabc-dfgg-abc1-cfr3-rty-wert-abc-dfgg-abc1-cfr3-rty-wert\nrut12-her2-rty-wert-abc-abc1-dfgg-rut12-her2-rty-wert-abc-abc1-dfgg\nrut12-rty-her2-abc-cfr3-wert-rut12-rut12-rty-her2-abc-cfr3-wert-rut12";var te;(0,t.W3)("UnitsHandler",(()=>{async function s(t){const s=e.DataFrame.fromCsv(t);await a.data.detectSemanticTypes(s);const n=h.Cn.getOrCreate(s.getCol("seq"));return[s,n]}(0,t.Bu)("Seq-Fasta",(async()=>{const[e,n]=await s(J);(0,t.l_)(n.notation,c.r2.FASTA),(0,t.l_)(n.isMsa(),!1)})),(0,t.Bu)("Seq-Fasta-MSA",(async()=>{const[e,n]=await s(Q);(0,t.l_)(n.notation,c.r2.FASTA),(0,t.l_)(n.isMsa(),!0)})),(0,t.Bu)("Seq-Fasta-units",(async()=>{const[e,n]=await s(J);(0,t.l_)(n.notation,c.r2.FASTA),(0,t.l_)(n.isMsa(),!1)})),(0,t.Bu)("Seq-Fasta-MSA-units",(async()=>{const[e,n]=await s(Q);(0,t.l_)(n.notation,c.r2.FASTA),(0,t.l_)(n.isMsa(),!0)})),(0,t.Bu)("Seq-Helm",(async()=>{const[e,n]=await s("seq\nPEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.Tyr_ab-dehydroMe.dV.E.N.D-Orn.D-aThr.Phe_4Me}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.D-Chg.dV.Phe_ab-dehydro.N.D-Orn.D-aThr.Phe_4Me}$$$$\nPEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me}$$$$");(0,t.l_)(n.notation,c.r2.HELM),(0,t.l_)(n.isHelm(),!0)})),(0,t.Bu)("Seq-UN",(async()=>{const[e,n]=await s(ee);(0,t.l_)(n.notation,c.r2.SEPARATOR),(0,t.l_)(n.separator,"-"),(0,t.l_)(n.alphabet,"UN")})),(0,t.Bu)("Seq-UN-auto",(async()=>{const[e,n]=await s(ee);(0,t.l_)(n.notation,c.r2.SEPARATOR),(0,t.l_)(n.separator,"-"),(0,t.l_)(n.alphabet,"UN")}))})),function(e){e.fasta="fasta",e.fastaMsa="fastaMsa",e.separator="separator",e.separatorMsa="separatorMsa",e.helm="helm"}(te||(te={})),(0,t.W3)("UnitsHandler",(()=>{h._9[c.r2.FASTA],h._9[c.r2.HELM];const s=h._9[c.r2.SEPARATOR],n={[te.fasta]:{src:{csv:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC"},tgt:{notation:c.r2.FASTA,splitted:["ACGTCACGTC","CAGTGTCAGTGT","TTCAACTTCAAC"]}},[te.fastaMsa]:{src:{csv:"seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT"},tgt:{notation:c.r2.FASTA,splitted:["AC-GT-CTAC-GT-CT","CAC-T-GTCAC-T-GT","ACCGTACTACCGTACT"]}},[te.separator]:{src:{csv:"seq\nabc-dfgg-abc1-cfr3-rty-wert-abc-dfgg-abc1-cfr3-rty-wert\nrut12-her2-rty-wert-abc-abc1-dfgg-rut12-her2-rty-wert-abc\nrut12-rty-her2-abc-cfr3-wert-rut12-rut12-rty-her2-abc-cfr3"},tgt:{notation:c.r2.SEPARATOR,separator:"-",splitted:[["abc","dfgg","abc1","cfr3","rty","wert","abc","dfgg","abc1","cfr3","rty","wert"],["rut12","her2","rty","wert","abc","abc1","dfgg","rut12","her2","rty","wert","abc"],["rut12","rty","her2","abc","cfr3","wert","rut12","rut12","rty","her2","abc","cfr3"]]}},[te.separatorMsa]:{src:{csv:'seq\nrut0-dfgg-abc1-cfr3-rty-wert-abc-dfgg-abc1-cfr3-rty-wert\nrut1-her2-rty--abc1-dfgg-rut12-her2-rty--abc1-dfgg\nrut2-rty-her2---wert-rut12-rty-her2---wert\n"rut3-rty-her2-""-""-""-""-wert-rut12-rty-her2-""-""-""-""-wert"\n"""-""-rut4-her2-wert-rut12-rty-her2-wert"\n"rut5-rty-her2-wert-rut12-rty-her2-wert-""-"""'},tgt:{notation:c.r2.SEPARATOR,separator:"-",splitted:[["rut0","dfgg","abc1","cfr3","rty","wert","abc","dfgg","abc1","cfr3","rty","wert"],["rut1","her2","rty",s,"abc1","dfgg","rut12","her2","rty",s,"abc1","dfgg"],["rut2","rty","her2",s,s,"wert","rut12","rty","her2",s,s,"wert"],["rut3","rty","her2",s,s,"wert","rut12","rty","her2",s,s,"wert"],[s,"rut4","her2","wert","rut12","rty","her2","wert"],["rut5","rty","her2","wert","rut12","rty","her2","wert",s]]}},[te.helm]:{src:{csv:"seq\nPEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.Thr_PO3H2.Aca.D-Tyr_Et}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.dK.Thr_PO3H2.Aca}$$$$\nPEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.dK.Thr_PO3H2.Aca}$$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.T.dK.Thr_PO3H2}$$$$"},tgt:{notation:c.r2.HELM,splitted:[["meI","hHis","Aca","N","T","dE","Thr_PO3H2","Aca","D-Tyr_Et","Thr_PO3H2","Aca","D-Tyr_Et"],["meI","hHis","Aca","Cys_SEt","T","dK","Thr_PO3H2","Aca","dK","Thr_PO3H2","Aca"],["Lys_Boc","hHis","Aca","Cys_SEt","T","dK","Thr_PO3H2","Aca","dK","Thr_PO3H2","Aca"],["meI","hHis","Aca","Cys_SEt","T","dK","Thr_PO3H2","T","dK","Thr_PO3H2"]]}}};for(const[s,r]of Object.entries(n))(0,t.Bu)(`splitted-${s}`,(async()=>{const s=e.DataFrame.fromCsv(r.src.csv).getCol("seq"),n=await a.functions.call("Bio:detectMacromolecule",{col:s});n&&(s.semType=n),(0,t.l_)(s.semType,e.SEMTYPE.MACROMOLECULE);const i=h.Cn.getOrCreate(s);(0,t.l_)(i.notation,r.tgt.notation),(0,t.l_)(i.separator===r.tgt.separator,!0);const o=i.splitted;(0,t.f6)(o,r.tgt.splitted)}),s==te.separatorMsa?{skipReason:"#2468 CSV row starting with the quote character"}:void 0)})),(0,t.W3)("UnitsHandler: getRegion",(()=>{const s={fastaDna:{srcCsv:"seq\nATTCGT\nACTGCTC\nATTCCGTA",startIdx:2,endIdx:4,tgtCsv:"seq\nTCG\nTGC\nTCC",units:c.r2.FASTA,alphabet:"DNA",positionNames:{tag:"a, b, c, d, e, f, g, h",start:"c",end:"e"}},separatorPt:{srcCsv:"seq\nM-D-Y-K-E-T-L\nM-I-E-V-F-L-F-G-I\nM-M-",startIdx:5,endIdx:null,tgtCsv:"seq\nT-L--\nL-F-G-I\n---",units:c.r2.SEPARATOR,alphabet:"PT",positionNames:{tag:"1, 1A, 1B, 2, 3, 4, 4A, 4A, 4C",start:"4",end:null}},helm:{srcCsv:"seq\nPEPTIDE1{[meI].[hHis].[Aca].N.T.[dE].[Thr_PO3H2].[Aca].[D-Tyr_Et].[Tyr_ab-dehydroMe].[dV].E.N.[D-Orn]}$$$$\nPEPTIDE1{[meI].[hHis].[Aca].[Cys_SEt].T.[dK].[Thr_PO3H2].[Aca].[Tyr_PO3H2].[D-Chg].[dV].[Phe_ab-dehydro]}$$$$\nPEPTIDE1{[Lys_Boc].[hHis].[Aca].[Cys_SEt].T}$$$$",startIdx:3,endIdx:6,tgtCsv:"seq\nPEPTIDE1{N.T.[dE].[Thr_PO3H2]}$$$$\nPEPTIDE1{[Cys_SEt].T.[dK].[Thr_PO3H2]}$$$$\nPEPTIDE1{[Cys_SEt].T.*.*}$$$$",units:c.r2.HELM,alphabet:null,positionNames:{tag:null,start:"4",end:"7"}}};for(const[n,r]of Object.entries(s))(0,t.Bu)(`${n}-idx`,(async()=>{const s=e.DataFrame.fromCsv(r.srcCsv).getCol("seq"),n=await a.functions.call("Bio:detectMacromolecule",{col:s});n&&(s.semType=n);const i=h.Cn.getOrCreate(s).getRegion(r.startIdx,r.endIdx,"regSeq"),o=e.DataFrame.fromCsv(r.tgtCsv).getCol("seq");(0,t.l_)(s.getTag(e.TAGS.UNITS),r.units),(0,t.l_)(i.getTag(e.TAGS.UNITS),r.units),(0,t.l_)(s.getTag("alphabet"),r.alphabet),(0,t.l_)(i.getTag("alphabet"),r.alphabet),(0,t.f6)(i.toList(),o.toList())})),r.positionNames&&(0,t.Bu)(`${n}-positionNames`,(async()=>{const s=e.DataFrame.fromCsv(r.srcCsv).getCol("seq");r.positionNames.tag&&s.setTag(".positionNames",r.positionNames.tag);const n=await a.functions.call("Bio:detectMacromolecule",{col:s});n&&(s.semType=n);const i=await a.functions.call("Bio:getRegion",{sequence:s,start:r.positionNames.start,end:r.positionNames.end}),o=e.DataFrame.fromCsv(r.tgtCsv).getCol("seq");(0,t.l_)(s.getTag(e.TAGS.UNITS),r.units),(0,t.l_)(i.getTag(e.TAGS.UNITS),r.units),(0,t.l_)(s.getTag("alphabet"),r.alphabet),(0,t.l_)(i.getTag("alphabet"),r.alphabet),(0,t.f6)(i.toList(),o.toList())}))}));var se=s(8601);const ne=new e.FileSource("System:AppData/Bio"),re={"peptides-fasta":{inPath:"tests/to-atomic-level-peptides-fasta-input.csv",outPath:"tests/to-atomic-level-peptides-fasta-output.csv"},"dna-fasta":{inPath:"tests/to-atomic-level-dna-fasta-input.csv",outPath:"tests/to-atomic-level-dna-fasta-output.csv"},"msa-separator":{inPath:"tests/to-atomic-level-msa-separator-input.csv",outPath:"tests/to-atomic-level-msa-separator-output.csv"},"msa-fasta":{inPath:"tests/to-atomic-level-msa-fasta-input.csv",outPath:"tests/to-atomic-level-msa-fasta-output.csv"}},ie="molfile(sequence)";async function oe(e,t="seq",s){const n=e.getCol(t),r=s.getBioLib(),i=await(0,se.i0)(e,n,r);return i.warnings.length>0&&ge.logger.warning(`_toAtomicLevel() warnings ${i.warnings.join("\n")}`),i.col}function ae(e){return e.replaceAll("\r\n","\n").replace(/\n$/,"").split("\n").map((e=>e.trimEnd())).join("\n")}(0,t.W3)("toAtomicLevel",(async()=>{const s={},n={};let r,i,o;async function u(e,s){const n=e.getCol("sequence");await(0,l.toAtomicLevel)(e,n,!1);const r=e.getCol(ie),i=s.getCol(ie),o=F()(r.values()).map((e=>ae(e))).toArray(),a=F()(i.values()).map((e=>ae(e))).toArray();(0,t.f6)(o,a)}(0,t.bb)((async()=>{r=await(0,$.JN)(),i=await(0,x.nW)(),await(0,x.tb)(),await r.loadLibraries(!0);for(const[t,r]of Object.entries(re))r.inPath,s[t]=e.DataFrame.fromCsv((await ne.readAsText(r.inPath)).replace(/\n$/,"")),await a.data.detectSemanticTypes(s[t]),n[t]=e.DataFrame.fromCsv((await ne.readAsText(r.outPath)).replace(/\n$/,""))})),(0,t.X5)((async()=>{await(0,x.tW)(i),await r.loadLibraries(!0)}));for(const[e,r]of Object.entries(re))(0,t.Bu)(`${e}`,(async()=>{await u(s[e],n[e])}));!function(e){e.fastaDna="fastaDna",e.fastaRna="fastaRna",e.fastaPt="fastaPt",e.separatorDna="separatorDna",e.separatorRna="separatorRna",e.separatorPt="separatorPt",e.separatorUn="separatorUn",e.helm="helm"}(o||(o={}));const d={[o.fastaDna]:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",[o.fastaRna]:"seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",[o.fastaPt]:"seq\nFWPHEYFWPHEY\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",[o.separatorDna]:"seq\nA/C/G/T/C/A/C/G/T/C\nC/A/G/T/G/T/C/A/G/T/G/T\nT/T/C/A/A/C/T/T/C/A/A/C",[o.separatorRna]:"seq\nA*C*G*U*C*A*C*G*U*C\nC*A*G*U*G*U*C*A*G*U*G*U\nU*U*C*A*A*C*U*U*C*A*A*C",[o.separatorPt]:"seq\nF-W-P-H-E-Y-F-W-P-H-E-Y\nY-N-R-Q-W-Y-V-Y-N-R-Q-W-Y-V\nM-K-P-S-E-Y-V-M-K-P-S-E-Y-V",[o.separatorUn]:"seq\nmeI-hHis-Aca-N-T-dE-Thr_PO3H2-Aca-D-meI-hHis-Aca-N-T-dE-Thr_PO3H2-Aca-D\nmeI-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2-meI-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2\nLys_Boc-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2-Lys_Boc-hHis-Aca-Cys_SEt-T-dK-Thr_PO3H2-Aca-Tyr_PO3H2",[o.helm]:"seq\nPEPTIDE1{meI.D-gGlu.Aca.N.T.dE.Thr_PO3H2.Aca.D.Thr_PO3H2.Aca.D}$$$\nPEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.Thr_PO3H2.Aca.Tyr_PO3H2}$$$\nPEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2.Thr_PO3H2.Aca.Tyr_PO3H2}$$$"};async function m(t){const s=d[t],n=e.DataFrame.fromCsv(s.replace(/\n$/,""));return await a.data.detectSemanticTypes(n),n}(0,t.Bu)("fastaDna",(async()=>{await oe(await m(o.fastaDna),"seq",r)})),(0,t.Bu)("fastaRna",(async()=>{await oe(await m(o.fastaRna),"seq",r)})),(0,t.Bu)("fastaPt",(async()=>{await oe(await m(o.fastaPt),"seq",r)})),(0,t.Bu)("separatorDna",(async()=>{await oe(await m(o.separatorDna),"seq",r)})),(0,t.Bu)("separatorDna",(async()=>{await oe(await m(o.separatorRna),"seq",r)})),(0,t.Bu)("separatorPt",(async()=>{await oe(await m(o.separatorPt),"seq",r)})),(0,t.Bu)("separatorUn",(async()=>{await oe(await m(o.separatorUn),"seq",r)})),(0,t.Bu)("helm",(async()=>{await oe(await m(o.helm),"seq",r)})),(0,t.Bu)("ptFasta2",(async()=>{const s=await ge.files.readAsText("tests/to-atomic-level-pt-fasta-2.mol"),n=e.DataFrame.fromCsv("seq\nAR"),i=n.getCol("seq");i.semType=e.SEMTYPE.MACROMOLECULE,i.setTag(e.TAGS.UNITS,c.r2.FASTA),i.setTag("alphabet","PT"),h.Cn.getOrCreate(i);const o=await oe(n,"seq",r);(0,t.l_)(ae(o.get(0)),ae(s))}))}));var le=s(708);async function ce(t){const s=e.DataFrame.fromCsv(t),n=s.col("seq"),r=await a.functions.call("Bio:detectMacromolecule",{col:n});return r&&(n.semType=r),await a.data.detectSemanticTypes(s),h.Cn.getOrCreate(n)}function he(e,s,n,r){const i=n(e,s);(0,t.l_)(Number(i.toFixed(3)),Number(r.toFixed(3)))}(0,t.W3)("Distance",(async()=>{const s=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],n={F:0,W:1,R:2,Y:3},r="FWRWY",i="FWRWW",o="FWY",a="FWRWY",l="FWY",c="FWRRRRY";(0,t.Bu)("protein-distance-function",(async()=>{const e=(await ce("seq\nFWRWYVKHPFWRWYVKHP\nYNRWYVKHPYNRWYVKHP\nMWRSWYCKHPMWRSWYCKHP")).getDistanceFunctionName();(0,t.l_)(e,le.U.LEVENSHTEIN)})),(0,t.Bu)("DNA-distance-function",(async()=>{const e=(await ce("seq\nATAACGATAACG\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,t.l_)(e,le.U.LEVENSHTEIN)})),(0,t.Bu)("MSA-distance-function",(async()=>{const e=(await ce("seq\nATAACATAAC\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,t.l_)(e,le.U.HAMMING)})),(0,t.Bu)("levenstein-sub",(async()=>{const e=le.o[le.U.LEVENSHTEIN]();he(r,i,e,.2)})),(0,t.Bu)("levenstein-del",(async()=>{const e=le.o[le.U.LEVENSHTEIN]();he(o,a,e,.4)})),(0,t.Bu)("hamming",(async()=>{const e=le.o[le.U.HAMMING]();he(o,a,e,.6)})),(0,t.Bu)("needleman-blosum62",(async()=>{const e=le.o[le.U.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});he(r,i,e,-6)})),(0,t.Bu)("needleman-blosum62-del",(async()=>{const e=le.o[le.U.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});he(o,a,e,-1.8)})),(0,t.Bu)("needleman-custom-sub",(async()=>{const e=le.o[le.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:1,gapExtend:1});he(r,i,e,.2)})),(0,t.Bu)("needleman-custom-del",(async()=>{const e=le.o[le.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:1,gapExtend:1});he(o,a,e,.8)})),(0,t.Bu)("needleman-custom-zero-extend",(async()=>{const e=le.o[le.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:1,gapExtend:0});he(l,c,e,.714)})),(0,t.Bu)("needleman-custom-half-extend",(async()=>{const e=le.o[le.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:2,gapExtend:1});he(l,c,e,1.286)})),(0,t.Bu)("needleman-custom-same-extend",(async()=>{const t=le.o[le.U.NEEDLEMANN_WUNSCH]({scoringMatrix:s,alphabetIndexes:n,gapOpen:1,gapExtend:1});e.Test.isInBenchmark?he(Array(1e4).fill("FWRY").join(""),Array(1e4).fill("FYWRRY").join(""),t,.667):he(l,c,t,1.143)}))}));var ue=s(3277);async function de(e,s,n,r,i,o,c,h){await a.data.detectSemanticTypes(e);const u=await(0,l.activityCliffs)(e,e.getCol(n),e.getCol(r),i,s,c,h,{[`${ue.sS}`]:!0});(0,t.l_)(null!=u,!0);const d=Array.from(u.root.children).find((e=>{const t=e.className.split(" ");return["ui-btn","ui-btn-ok"].every((e=>t.includes(e)))}));(0,t.l_)(d.innerText.toLowerCase(),`${o} cliffs`)}var me=s(6361),pe=s(4628);async function fe(s,n,r){const i=s.getCol(r),o=await a.functions.call("Bio:detectMacromolecule",{col:i});o&&(i.semType=o);const c=e.Func.find({package:"Bio",name:"macromoleculePreprocessingFunction"})[0];if(!c)throw new Error("Preprocessing function not found");const h=await(0,l.sequenceSpaceTopMenu)(s,s.col(r),n,le.U.LEVENSHTEIN,!0,c,{[ue.sS]:!0});(0,t.l_)(null!=h,!0)}(0,t.W3)("activityCliffs",(async()=>{let s,n,r=[],i=[];const o=e.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0],l=e.Func.find({name:"helmPreprocessingFunction",package:"Bio"})[0];(0,t.bb)((async()=>{s=await(0,$.JN)(),n=await(0,x.nW)(),await(0,x.tb)(),await s.loadLibraries(!0),r=[],i=[]})),(0,t.X5)((async()=>{await(0,x.tW)(n),await s.loadLibraries(!0)})),(0,t.Bu)("activityCliffsOpens",(async()=>{const t=await w(e.Test.isInBenchmark?"test/peptides_motif-with-random_10000.csv":"tests/100_3_clustests.csv");i.push(t);const s=a.shell.addTableView(t);r.push(s);const n=e.Test.isInBenchmark?6:3;await de(t,pe.A.UMAP,"sequence","Activity",90,n,le.U.LEVENSHTEIN,o)})),(0,t.Bu)("activityCliffsWithEmptyRows",(async()=>{const e=await w("tests/100_3_clustests_empty_vals.csv");i.push(e);const t=a.shell.addTableView(e);r.push(t),await de(e,pe.A.UMAP,"sequence","Activity",90,3,le.U.LEVENSHTEIN,o)})),(0,t.Bu)("Helm",(async()=>{const e=await ge.files.readCsv("data/sample_HELM_50.csv");a.shell.addTableView(e),await de(e,pe.A.UMAP,"HELM","Activity",65,20,me.gk.Tanimoto,l)}))})),(0,t.W3)("sequenceSpace",(async()=>{let s,n,r,i;(0,t.Bu)("sequenceSpaceOpens",(async()=>{s=await w(e.Test.isInBenchmark?"test/peptides_motif-with-random_10000.csv":"tests/100_3_clustests.csv"),n=a.shell.addTableView(s),await fe(s,pe.A.UMAP,"sequence")})),(0,t.Bu)("sequenceSpaceWithEmptyRows",(async()=>{r=await w("tests/100_3_clustests_empty_vals.csv"),i=a.shell.addTableView(r),await fe(r,pe.A.UMAP,"sequence")}))})),(0,t.W3)("Scoring",(()=>{const s="sequence",n="expected_similarity",r="expected_identity",i=e.DataFrame.fromCsv(`${s},${n},${r}\nPEPTIDE1{Aca.Orn.gGlu.Pqa.D-His_1Bn.dH.hHis.4Abz.D-Tic.D-Dap.Y.Iva.meS.F.P.F.D-1Nal}$$$$,1.0,1.0\nPEPTIDE1{Iva.Gly_allyl.gGlu.Pqa.D-Dip.dH.hHis.4Abz.D-aHyp.D-Dap.Y.Iva.I.Tyr_26diMe.P.Asu.meC}$$$$,0.68,0.53\nPEPTIDE1{[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal].[1Nal]}$$$$V2.0,0.34,0.0`),o=i.getCol(s);o.setTag(e.TAGS.UNITS,c.r2.HELM),o.semType=e.SEMTYPE.MACROMOLECULE;const a=o.get(0);let h,u;(0,t.bb)((async()=>{h=await(0,$.JN)(),u=await(0,x.nW)(),await(0,x.tb)(),await h.loadLibraries(!0)})),(0,t.X5)((async()=>{await(0,x.tW)(u),await h.loadLibraries(!0)})),(0,t.Bu)("Identity",(async()=>{const e=await(0,l.sequenceIdentityScoring)(i,o,a);for(let s=0;s<e.length;s++)(0,t.jh)(e.get(s),i.get(r,s),.01,`Wrong identity score for sequence at position ${s}`)})),(0,t.Bu)("Similarity",(async()=>{const e=await(0,l.sequenceSimilarityScoring)(i,o,a);for(let s=0;s<e.length;s++)(0,t.jh)(e.get(s),i.get(n,s),.01,`Wrong similarity score for sequence at position ${s}`)}))}));const ge=new e.Package;async function ye(s,n,r){const i=await(0,t.ci)({category:s,test:n,testContext:r});return e.DataFrame.fromObjects(i)}})(),bio_test=n})();
|
|
9
9
|
//# sourceMappingURL=package-test.js.map
|