@datagrok/bio 2.12.21 → 2.12.23
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 +15 -0
- package/dist/286.js +2 -0
- package/dist/286.js.map +1 -0
- package/dist/package-test.js +3 -3
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +3 -3
- package/dist/package.js.map +1 -1
- package/files/samples/FASTA.csv +65 -65
- package/files/samples/HELM_50.csv +51 -51
- package/package.json +2 -2
- package/src/package.ts +9 -4
- package/src/tests/converters-test.ts +17 -5
- package/src/tests/renderers-test.ts +19 -2
- package/src/tests/to-atomic-level-tests.ts +9 -0
- package/src/utils/convert.ts +9 -9
- package/src/utils/helm-to-molfile/converter/mol-atoms-v3k.ts +9 -0
- package/src/utils/helm-to-molfile/converter/simple-polymer.ts +10 -7
- package/src/utils/multiple-sequence-alignment-ui.ts +3 -11
- package/src/utils/multiple-sequence-alignment.ts +50 -3
- package/src/utils/pepsea.ts +13 -5
- package/dist/79.js +0 -2
- package/dist/79.js.map +0 -1
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,n)=>{"use strict";n.d(t,{f:()=>r});var s=n(9976);class r extends s.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,n="",s="";for(const r of e)"("==r?t++:")"==r?t--:t?n+=r:s+=r;return isNaN(parseInt(n))?[s,n]:[s,""]}static getColorAAPivot(e="",t="grok"){const n=this.getPalette(t);let[s,r]=this.getInnerOuter(e);if(s=s.length>6?`${s.slice(0,3)}...`:s,r=r.length>6?`${r.slice(0,3)}...`:r,1==e.length||"("==e[1]){const t=e[0]?.toUpperCase();return t in n?[n.get(t),t,r,1]:[this.undefinedColor,s,r,1]}if("d"==e[0]&&e[1]in n&&(2==e.length||"("==e[2])){const t=e[1]?.toUpperCase();return t in n?[n.get(t),t,r,2]:[this.undefinedColor,s,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 n?[n.get(t),t,r,3]:[this.undefinedColor,s,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 n?[n.get(t),t,r,4]:[this.undefinedColor,s,r,4]}return[this.undefinedColor,s,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,n)=>{"use strict";n.d(t,{BX:()=>i,nW:()=>l,tW:()=>c,tb:()=>u});var s=n(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 s.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 s.dapi.userDataStorage.postValue(r,"Settings",JSON.stringify(e),!0)})),await a}async function u(){await c(o)}},7228:(e,t,n)=>{"use strict";n.d(t,{JN:()=>a,Qx:()=>l});var s=n(976),r=n(4469),i=(n(5697),n(1047),n(6286)),o=(n(8607),n(8457));async function a(){const e=s.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 l(e,t){e instanceof s.Column&&(e=(0,o.O)(e).columns.toList());const n=(await a()).getBioLib(),l=new Array(e.length),c=e[0].length,u=new Float32Array(c);for(let o=0;o<e.length;++o){const a=t.getCanonical(o),h=n.getMonomer("PEPTIDE",a)?.smiles??"",d=e[o],m=d.getRawData(),p=d.categories,f=p.indexOf("");if(l[o]={categories:p,data:m,emptyIndex:f},void 0===a)continue;const g=s.Column.fromStrings("smiles",p.map((e=>n.getMonomer("PEPTIDE",e)?.smiles??""))),y=(s.DataFrame.fromColumns([g]),(await r.chem.getSimilarities(g,h)).getRawData());for(let e=0;e<c;++e){const t=m[e];u[e]+=a!==i.G2&&t!==f?y[t]:a===i.G2&&t===f?1:0}}for(let n=0;n<u.length;++n){let r=u[n]/t.length;for(let i=0;i<e.length;++i){const e=l[i];if(i>=t.length&&e.data[n]!==e.emptyIndex||e.data[n]===e.emptyIndex&&i<t.length){r=s.FLOAT_NULL;break}}u[n]=r}return s.Column.fromFloat32Array("Similarity",u)}},8601:(e,t,n)=>{"use strict";n.d(t,{i0:()=>d});var s=n(4469),r=n(976),i=n(6414),o=n.n(i),a=n(1821),l=n(8607);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 u=n(1047);function h(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 h=t;const d=l.g.forColumn(t);d.isHelm()&&(h=d.convert(a.r2.SEPARATOR,"."),h.name=t.name);const p=l.g.forColumn(h).alphabet;let f;if("PT"===p||"UN"===p)f="PEPTIDE";else{if("RNA"!==p&&"DNA"!==p)return{col:null,warnings:[`Unexpected column's '${h.name}' alphabet '${p}'.`]};f="RNA"}const g=function(e){const t=e.length,n=new Array(t),r=l.g.forColumn(e);let i=!1;for(let e=0;e<t;++e){const t=r.getSplitted(e);i||(i=0===t.length),n[e]=o()(t.canonicals).filter((e=>!r.isGap(e))).map((e=>e)).toArray()}return i&&s.shell.warning(`Some values in the "${e.name}" column are empty`),n}(h),y=await async function(e,t,n,r){const i=function(e,t,n){const s=new Map;for(const r of e.getMonomerSymbolsByType(t)){const i=e.getMonomer(t,r);if("RNA"===t&&("Branch"===i.monomerType||"DNA"===n&&i.symbol===c.DEOXYRIBOSE||"RNA"===n&&i.symbol===c.RIBOSE||i.symbol===c.PHOSPHATE)||"PEPTIDE"===t&&"Branch"!==i.monomerType){const e={};u.rx.forEach((t=>{e[t]=i[t]})),s.set(i.symbol,e)}}return s}(t,n,r),o=new Map,a=await s.functions.call("Chem:getRdKitModule"),l={value:null};if("RNA"===n){const e="RNA"===r?[c.RIBOSE,c.PHOSPHATE]:[c.DEOXYRIBOSE,c.PHOSPHATE];for(const t of e)m(o,t,i,a,n,l)}for(let t=0;t<e.length;++t){const s=e[t];for(const e of s)if(""!==e)try{m(o,e,i,a,n,l)}catch(t){const n=t instanceof Error?t.message:t.toString(),s=t instanceof Error?t.stack:void 0;throw console.error(`bio lib: getMonomersDictFromLib() sym='${e}', error:\n${n}\n${s}`),new Error(`Can't get monomer '${e}' from library: ${n}`)}}return o}(g,i,f,p),w=h.length,{molfileList:b,molfileWarningList:A}=await async function(e,t,s,r,i){const o=Math.max(navigator.hardwareConcurrency-2,1),a=new Array(o).fill(null).map((()=>new Worker(new URL(n.p+n.u(79),n.b)))),l=i/o;let c=[],u=[];const h=new Array(o);for(let n=0;n<o;n++){const c=Math.floor(n*l),u=n===o-1?i:Math.floor((n+1)*l);a[n].postMessage({monomerSequencesArray:e,monomersDict:t,alphabet:s,polymerType:r,start:c,end:u}),h[n]=new Promise((e=>{a[n].onmessage=({data:{molfileList:t,molfileWarningList:n}})=>{e({molfileList:t,molfileWarningList:n})}}))}return(await Promise.all(h)).forEach((e=>{c=c.concat(...e.molfileList),u=u.concat(...e.molfileWarningList)})),setTimeout((()=>{a.forEach((e=>{e.terminate()}))}),0),{molfileList:c,molfileWarningList:u}}(g,y,p,f,w);if(A.length>.05*w)throw new Error("Too many errors getting molfiles.");const C=`molfile(${h.name})`,v=e.columns.getUnusedName(C),T=r.Column.fromStrings(v,b);return T.semType=r.SEMTYPE.MOLECULE,T.setTag(r.TAGS.UNITS,r.UNITS.Molecule.MOLBLOCK),{col:T,warnings:A}}function m(e,t,n,s,r,i){if(!e.has(t)){const o=function(e,t,n,s,r){if(t.has(e)){const o=t.get(e),a=function(e){const t=[];for(const n of e){let e=n.capGroupSmiles;e||(e=n.capGroupSMILES),e=e.replace(/(\[|\]|\*|:|\d)/g,""),t.push(e)}return t}(o.rgroups),l=(i=o.molfile).includes("V3000")?function(e){const t=new Map,n=/M V30 (\d+) R#.+RGROUPS=\((\d+) (\d+)\).*/gm;let s;for(;null!==(s=n.exec(e));)s.index===n.lastIndex&&n.lastIndex++,t.set(parseInt(s[1]),parseInt(s[3]));return t}(i):function(e){const t=new Map;let n=e.indexOf(c.V2K_A_LINE,0),s=n;for(;-1!==n;){s=e.indexOf("\n",n);const r=parseInt(e.substring(n,s).replace(/^A\s+/,""));n=e.indexOf("R",s),s=e.indexOf("\n",n);const i=parseInt(e.substring(n,s).replace(/^R/,""));t.set(r,i),n=e.indexOf(c.V2K_A_LINE,s)}for(n=e.indexOf(c.V2K_RGP_LINE,0),s=e.indexOf("\n",n);-1!==n;){n+=c.V2K_RGP_SHIFT,s=e.indexOf("\n",n);const r=e.substring(n,s).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])}n=e.indexOf(c.V2K_RGP_LINE,s)}return t}(i),u=o.molfile.includes("V3000")?o.molfile:function(e,t){const n=t.get_mol(e),s=n.get_v3Kmolblock();return n.delete(),s}(function(e){let t=e.indexOf(c.V2K_A_LINE,0);-1===t&&(t=e.indexOf(c.V2K_RGP_LINE));const n=e.indexOf(c.V3K_END,t);return e.substring(0,t)+e.substring(n)}(o.molfile),n),d=function(e){let t=(e=e.replaceAll("\r","")).indexOf(c.V3K_BEGIN_COUNTS_LINE)+c.V3K_COUNTS_SHIFT,n=e.indexOf(" ",t+1);const s=parseInt(e.substring(t,n));return t=n+1,n=e.indexOf(" ",t+1),{atomCount:s,bondCount:parseInt(e.substring(t,n))}}(u),m=function(e,t){const n=new Array(t),s=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),n[l]=e.substring(o,a);const t=new Array(2);for(let n=0;n<2;++n)o=a+1,a=e.indexOf(" ",o),t[n]=parseFloat(e.substring(o,a));s[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:n,x:s,y:r,kwargs:i}}(u,d.atomCount),g=function(e,t){const n=new Uint32Array(t),s=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 n=0;n<3;++n)o=a+1,a=Math.min(e.indexOf("\n",o),e.indexOf(" ",o)),t[n]=parseInt(e.slice(o,a));n[l]=t[0],s[l]=t.slice(1);const u=e.indexOf("\n",o);let h=e.slice(a,u),d=h.indexOf(c.V3K_BOND_CONFIG);if(-1!==d){d=h.indexOf("=",d)+1;let e=h.indexOf(" ",d);-1===e&&(e=h.length);const t=parseInt(h.slice(d,e));r.set(l,t);const n=c.V3K_BOND_CONFIG+t.toString();h=h.replace(n,"")}h||i.set(l,h)}return{bondTypes:n,atomPairs:s,bondConfiguration:r,kwargs:i}}(u,d.bondCount),w=function(e,t,n,s){const r={backboneShift:null,branchShift:null,terminalNodes:[],rNodes:[]};return function(e,t,n){for(const[s,r]of n)e.atomTypes[s-1]=t[r-1]}(e,n,s),function(e,t){t.rNodes=Array.from(e.keys());for(let n=0;n<t.rNodes.length;n++)for(const s of[1,2])if(e.get(t.rNodes[n])===s){const e=t.rNodes[s-1];t.rNodes[s-1]=t.rNodes[n],t.rNodes[n]=e}}(s,r),p(t,r),r}(m,g,a,l),T=function(e){let t=[],n=e.indexOf("M V30 MDLV30/STEABS ATOMS=(");for(;-1!==n;){n+=28;const s=e.indexOf(")",n);t=t.concat(e.substring(n,s).split(" ").slice(1).map((e=>parseInt(e)))),n=s,n=e.indexOf("M V30 MDLV30/STEABS ATOMS=(",n)}return t}(u),S={atoms:m,bonds:g,meta:w,stereoAtoms:T};return"PEPTIDE"===s?function(e){const t=e.meta.terminalNodes[0]-1,n=e.meta.rNodes[0]-1,s=e.atoms.x,r=e.atoms.y;v(e,-s[t],-r[t]);const i=b(s[n],r[n]);A(e.atoms,-i),s[e.meta.rNodes[1]-1]<0&&function(e){C(e,!1)}(e);const o=function(e){const t=function(e){const t=new Map;for(const n of e.bonds.atomPairs)for(let e=0;e<2;e++){const s=n[e],r=n[(e+1)%2];t.has(s)?t.get(s)?.push(r):t.set(s,new Array(1).fill(r))}return t}(e);let n=0;const s=e.atoms.atomTypes.length;let r=0;for(;0===n;){const i=t.get(e.meta.terminalNodes[1])[r];if(e.atoms.atomTypes[i-1]===c.OXYGEN&&i!==e.meta.rNodes[1]&&(n=i),r++,r>s)throw new Error(`Search for double-bonded Oxygen in ${e} has exceeded the limit of ${s}`)}return n}(e);!function(e,t){e.atoms.y[e.meta.rNodes[1]-1]<0&&e.atoms.y[t-1]<0&&(function(e){C(e,!0)}(e),A(e.atoms,-function(e,t){return b(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 n=e.atoms.x;n[e.meta.rNodes[1]-1]>n[t-1]&&function(e,t,n){const s=t-1,r=n-1,i=e.atoms.x,o=e.atoms.y,a=i[s],l=o[s];i[s]=i[r],o[s]=o[r],i[r]=a,o[r]=l}(e,t,e.meta.rNodes[1])}(e,o)}(S):e===c.RIBOSE||e===c.DEOXYRIBOSE?function(e,t){const n=e.atoms.x,s=e.atoms.y;let r=e.meta.terminalNodes[0]-1;const i=e.meta.rNodes[1]-1;v(e,-n[r],-s[r]);const o=b(n[i],s[i]);A(e.atoms,3*Math.PI/2-o),t.value=function(e){const t=e.atoms.x,n=e.atoms.y,s=e.meta.rNodes[2]-1,r=e.meta.terminalNodes[2]-1,i=t[s]-t[r],o=n[s]-n[r];return Math.atan(o/i)+Math.PI/2}(e),r=e.meta.terminalNodes[0]-1,v(e,-n[r],-s[r])}(S,r):e===c.PHOSPHATE?function(e){const t=e.meta.terminalNodes[0]-1,n=e.meta.rNodes[0]-1,s=e.atoms.x,r=e.atoms.y;v(e,-s[t],-r[t]);const i=b(s[n],r[n]);A(e.atoms,Math.PI/2-i)}(S):function(e,t){const n=e.atoms.x,s=e.atoms.y,r=e.meta.terminalNodes[0]-1,i=e.meta.rNodes[0]-1;v(e,-n[r],-s[r]);const o=b(n[i],s[i]),a=t.value;if(!a)throw new Error("The value of sugarBranchToOYAngle is null");A(e.atoms,Math.PI-o+a);const l=function(e,t){return h(Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2))}({x:n[e.meta.rNodes[0]-1],y:s[e.meta.rNodes[0]-1]},{x:n[e.meta.terminalNodes[0]-1],y:s[e.meta.terminalNodes[0]-1]});if(1!=l)for(let e=0;e<n.length;++e)n[e]=h(n[e]/l),s[e]=h(s[e]/l)}(S,r),function(e,t,n){"PEPTIDE"===e?(f(t,e),y(t,t.meta.rNodes[1])):n===c.RIBOSE||n===c.DEOXYRIBOSE?(y(t,t.meta.rNodes[1]),t.meta.rNodes[1]=t.meta.terminalNodes[1],p(t.bonds,t.meta),f(t,e),y(t,t.meta.rNodes[1]),y(t,t.meta.rNodes[0]),y(t,t.meta.rNodes[2])):n===c.PHOSPHATE&&(t.meta.terminalNodes[0]=t.meta.rNodes[0],v(t,-t.atoms.x[t.meta.terminalNodes[0]-1],-t.atoms.y[t.meta.terminalNodes[0]-1]),f(t,e),y(t,t.meta.rNodes[1]))}(s,S,e),function(e){let t=0;for(;t<e.atoms.atomTypes.length;)e.atoms.atomTypes[t]===c.HYDROGEN&&(y(e,t+1),--t),++t}(S),S}var i;return null}(t,n,s,r,i);if(!o)throw new Error(`Monomer with symbol '${t}' is absent the monomer library`);e.set(t,o)}}function p(e,t){const n=t.rNodes;t.terminalNodes=new Array(n.length).fill(0);const s=t.terminalNodes,r=e.atomPairs;let i=0,o=0;for(;i<r.length&&o<s.length;){for(let e=0;e<s.length;++e)for(let t=0;t<2;++t)r[i][t]===n[e]&&(s[e]=r[i][(t+1)%2],n.length,++o);++i}}function f(e,t){e.meta.rNodes.length>1&&(e.meta.backboneShift=g(e,e.meta.rNodes[1]-1,e.meta.terminalNodes[0]-1)),"RNA"===t&&e.meta.rNodes.length>2&&(e.meta.branchShift=g(e,e.meta.rNodes[2]-1,e.meta.terminalNodes[0]-1))}function g(e,t,n){return[h(e.atoms.x[t]-e.atoms.x[n]),h(e.atoms.y[t]-e.atoms.y[n])]}function y(e,t){if(void 0!==t){const n=t-1,s=e.atoms,r=e.bonds,i=e.meta;s.atomTypes.splice(n,1),s.x=w(Float32Array,s.x,n,1),s.y=w(Float32Array,s.y,n,1),s.kwargs.splice(n,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],n=r.atomPairs[o][1];e===t||n===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]=n>t?n-1:n),++o}let a=Array.from(r.bondConfiguration.keys());a.forEach((e=>{if(r.bondConfiguration.has(e)&&e>n){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>n){const t=r.kwargs.get(e);r.kwargs.delete(e),r.kwargs.set(e-1,t)}}))}}function w(e,t,n,s){const r=new e(t.length-s);let i=0,o=0;for(;i<t.length;)i===n&&(i+=s),r[o]=t[i],++o,++i;return r}function b(e,t){let n;if(0===e)n=t>0?0:Math.PI;else if(0===t)n=e>0?-Math.PI/2:Math.PI/2;else{const s=t/e,r=Math.atan(s);n=e<0?Math.PI/2+r:-Math.PI/2+r}return n}function A(e,t){if(0!==t){const n=e.x,s=e.y,r=Math.cos(t),i=Math.sin(t);for(let e=0;e<n.length;++e){const t=n[e];n[e]=h(t*r-s[e]*i),s[e]=h(t*i+s[e]*r)}}}function C(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 n=e.bonds.bondConfiguration;for(const[e,t]of n){const s=1===t?3:1;n.set(e,s)}}function v(e,t,n){const s=e.atoms.x,r=e.atoms.y;for(let e=0;e<s.length;++e)s[e]=h(s[e]+t),void 0!==n&&(r[e]=h(r[e]+n))}},6137:(e,t,n)=>{"use strict";n.d(t,{J:()=>r,V:()=>i});var s=n(9976);class r extends s.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,n)=>{"use strict";n.d(t,{B:()=>s});class s{static makePalette(e,t=!1,n=s){const r={};return e.forEach((e=>{const n=e[0],s=e[1];n.forEach(((e,n)=>{r[e]=this.colourPalette[s][t?0:n]}))})),new n(r)}constructor(e){this._palette=e}get(e){return this._palette[e]}}s.undefinedColor="rgb(100,100,100)",s.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,n)=>{"use strict";n.d(t,{UE:()=>c,kQ:()=>o});var s=n(976),r=n(9976);class i{static hashCode(e){let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),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=s.Color.fromHtml(e),n=s.Color.g(t),r=s.Color.r(t),i=s.Color.b(t),o=Math.sqrt(Math.pow(0-r,2)+Math.pow(0-n,2)+Math.pow(0-i,2));return o>210?`rgb(${r/o*210},${n/o*210},${i/o*210})`:s.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}}},9713:(e,t,n)=>{"use strict";n.d(t,{N:()=>o,b:()=>a});var s=n(4469),r=n(701),i=n(2997);function o(e){let t=null,n=null;try{n=e.dart?e.gridColumn:null,t=n?n.temp:null}catch{[n,t]=[null,null]}const s=e.cell.column;if(t=t??s.temp,!t)throw new Error("Grid cell renderer back store (GridColumn or Column) not found.");return[n,s,t]}class a{constructor(e,t,n){this.gridCol=e,this.tableCol=t,this.logger=n,this.subs=[],this.destroyed=!1,this.viewerId=++a.viewerCounter,this.errors=[],this._onRendered=new r.Subject,this.reset(),this.tableCol&&this.tableCol.dataFrame&&this.subs.push(this.tableCol.dataFrame.onDataChanged.subscribe((()=>{try{this.reset()}catch(e){this.logger.error(e)}}))),this.tableCol&&this.subs.push(s.events.onTableRemoved.subscribe((e=>{try{const t=e.args.dataFrame;this.tableCol?.dataFrame.id!==t.id||this.destroyed||this.destroy()}catch(e){this.logger.error(e)}}))),this.gridCol&&this.subs.push(s.events.onViewRemoving.subscribe((e=>{try{const t=e.args.view;this.gridCol?.dart&&this.gridCol.grid&&this.gridCol?.grid?.dart&&this.gridCol?.grid?.view?.id===t.id&&!this.destroyed&&this.destroy()}catch(e){this.logger.error(e)}})))}toLog(){return`${this.constructor.name}<${this.viewerId}>`}destroy(){for(const e of this.subs)e.unsubscribe();this.destroyed=!0}invalidateGrid(){this.gridCol&&this.gridCol.dart&&this.gridCol.grid?.invalidate()}get onRendered(){return this._onRendered}invalidate(e){this.invalidateGrid()}async awaitRendered(e=1e4,t=`${e} timeout`){const n=`${this.toLog()}.awaitRendered()`;if(this.logger.debug(`${n}, start, testEvent before`),await(0,i.zg)(this._onRendered,(()=>{}),(()=>{this.invalidate()}),e,`${n}, ${t}`),this.errors.length>0){const e=this.errors[0];throw this.errors=[],e}this.logger.debug(`${n}, end`)}}a.viewerCounter=-1},9611:(e,t,n)=>{"use strict";n.d(t,{A:()=>u,m:()=>c});var s=n(976),r=n(6414),i=n.n(r),o=n(8607),a=n(9713),l=n(7228);function c(e,t){let n,s=100,r=0,i=e.length-1;for(;r<=i;){if(n=Math.floor((i+r)/2),e[n]<=t&&t<e[n+1])return n;if(t<e[n]?i=n-1:r=n+1,--s<=0)throw new Error(`Get position for pointer x = ${t} searching has not converged on ${JSON.stringify(e)}. `)}return null}class u extends a.b{get updated(){return this._updated}constructor(e,t,n,r){super(e,t,n),this.propsProvider=r,this.colWidth=0,this._monomerLengthList=null,this.separatorWidth=5,this._processedMaxVisibleSeqLength=0,this._updated=!1,this._monomerLengthMap={},this._monomerStructureMap={},this.props=this.propsProvider(),this._processedRows=s.BitSet.create(this.tableCol.length),this.gridCol&&this.subs.push(this.gridCol.grid.onAfterDrawContent.subscribe((()=>{this._onRendered.next()}))),(0,l.JN)().then((e=>{if(this.destroyed)return;const t=e.getBioLib();this.subs.push(t.onChanged.subscribe((()=>{this.reset(),this.gridCol?.grid?.invalidate()})))}))}reset(){this.propsProvider&&(this.props=this.propsProvider()),this._processedRows=s.BitSet.create(this.tableCol.length),this._monomerLengthList=null,this._monomerLengthMap={},this._monomerStructureMap={}}getCellMonomerLengths(e,t){this.colWidth<t&&(this.colWidth=t,this.reset());const n=this.props.seqHandler.isMsa()?this.getCellMonomerLengthsForSeqMsa():this.getCellMonomerLengthsForSeq(e),s=new Array(n.length+1);s[0]=5;for(let e=1;e<s.length;e++)s[e]=s[e-1]+n[e-1];return[n,s]}getCellMonomerLengthsForSeq(e){null===this._monomerLengthList&&(this._monomerLengthList=new Array(this.tableCol.length).fill(null),this._updated=!0);const t=this.props.separatorWidth+1*this.props.monomerCharWidth,n=Math.ceil(this.colWidth/t),s=o.g.forColumn(this.tableCol).getSplitted(e).originals,r=Math.min(n,s.length);let i=this._monomerLengthList[e];if(null===i||i.length<r){i=this._monomerLengthList[e]=new Array(s.length);let t=0;for(let e=0;e<r;++e){const n=s[e],r=this.props.monomerToShort(n,this.props.monomerLengthLimit),o=(this.props.seqHandler.isSeparator()?this.separatorWidth:this.props.separatorWidth)+r.length*this.props.monomerCharWidth;if(i[e]=o,t+=o,t>this.colWidth)break}this._updated=!0}return i}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:n,endIdx:s}=(()=>{try{const e=this.gridCol&&this.gridCol.dart?this.gridCol.grid:null;return e&&e.dart?{startIdx:Math.max(Math.floor((e?.vertScroll.min??0)-10),0),endIdx:Math.min(Math.ceil((e?.vertScroll.max??0)+10),this.tableCol.length)}:{startIdx:0,endIdx:Math.min(this.tableCol.length,10)}}catch(e){return{startIdx:0,endIdx:Math.min(this.tableCol.length,10)}}})(),r=this.props.separatorWidth+1*this.props.monomerCharWidth,i=Math.ceil(this.colWidth/r);for(let e=n;e<s;e++){if(this._processedRows.get(e)&&i<=this._processedMaxVisibleSeqLength)continue;const n=o.g.forColumn(this.tableCol).getSplitted(e,i).originals,s=Math.min(i,n.length);s>t.length&&t.push(...new Array(s-t.length).fill(r));let a=0;for(let e=0;e<s;++e){const s=n[e],r=this.props.monomerToShort(s,this.props.monomerLengthLimit),i=this.props.separatorWidth+r.length*this.props.monomerCharWidth;if(t[e]=Math.max(t[e]??0,i),a+=i,a>=this.colWidth)break}this._updated=!0,this._processedMaxVisibleSeqLength=Math.max(this._processedMaxVisibleSeqLength,i)}return t}getPosition(e,t,n){const[s,r]=this.getCellMonomerLengths(e,n),a=o.g.forColumn(this.tableCol);return 0===i()(a.getSplitted(e).originals).toArray().length?null:c(r,t)}setMonomerLengthLimit(e){this.props.monomerLengthLimit=e,this._updated=!0}setSeparatorWidth(e){this.props.separatorWidth=e,this._updated=!0}isMsa(){return this.props.seqHandler.isMsa()}}},1047:(e,t,n)=>{"use strict";n.d(t,{$3:()=>r,pU:()=>i,rx:()=>s});const s=["symbol","molfile","rgroups","name"],r="p",i=new RegExp(`[rd]\\((\\w)\\)${r}?`,"g")},7945:(e,t,n)=>{"use strict";function s(e){return"string"==typeof e||e instanceof String?e:"StateError"===e.constructor.name?e.message:"StateError"===e.constructor.name&&"$thrownJsError"in e?s(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[s(e),r(e)]}n.d(t,{yf:()=>i})},5226:(e,t,n)=>{"use strict";n.d(t,{i:()=>o});var s=n(976),r=n(8607),i=n(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,n=0;for(;t=e.exec(this._fileContent);){const s=this._fileContent.substring(t.index+1,e.lastIndex);this._descriptionsArray.push(s),0!==n&&this._sequencesArray.push(this.parseMacromolecule(n,t.index)),n=e.lastIndex+1}this._sequencesArray.push(this.parseMacromolecule(n,-1))}importFasta(){const e=s.Column.fromStrings("description",this.descriptionsArray),t=s.Column.fromStrings("sequence",this.sequencesArray);return t.semType=s.SEMTYPE.MACROMOLECULE,t.setTag(s.TAGS.UNITS,i.r2.FASTA),r.g.forColumn(t),[s.DataFrame.fromColumns([e,t])]}constructor(e){this._descriptionsArray=[],this._sequencesArray=[],this._fileContent=e,this.parseColumns()}}},706:(e,t,n)=>{"use strict";n.d(t,{Ug:()=>i,io:()=>o});var s=n(976),r=n(8447);function i(){const e=[];return e.push(s.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"))),e.push(s.Column.fromList(s.COLUMN_TYPE.FLOAT,"Activity",new Array(10**6).fill(5.30751))),e}function o(e=10**5){const t="meI/hHis/Aca/N//dE/Thr_PO3H2/Aca/D-Tyr_Et/Tyr_ab-dehydroMe".repeat(Math.ceil(e/10)).slice(0,-1),n=s.Column.fromList(s.COLUMN_TYPE.STRING,"MSA",new Array(100).fill(t));n.semType=s.SEMTYPE.MACROMOLECULE,n.setTag(s.TAGS.UNITS,r.r2.SEPARATOR),n.setTag("separator","/"),n.setTag("alphabet","UN"),n.setTag(".alphabetIsMultichar","true");const i=[];return i.push(n),i.push(s.Column.fromList(s.COLUMN_TYPE.FLOAT,"Activity",new Array(100).fill(7.30751))),i}n(6414),n(8607),n(8260)},1821:(e,t,n)=>{"use strict";n.d(t,{BM:()=>o,CI:()=>i,XS:()=>l,r2:()=>s,se:()=>a});var s,r=n(6286);!function(e){e.FASTA="fasta",e.SEPARATOR="separator",e.HELM="helm"}(s||(s={}));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.LA("PT",a.fasta.peptide,.5),new r.LA("DNA",a.fasta.dna,.55),new r.LA("RNA",a.fasta.rna,.55)]},8447:(e,t,n)=>{"use strict";n.d(t,{Ar:()=>r.Ar,CI:()=>s.CI,GU:()=>r.GU,KX:()=>r.KX,XS:()=>s.XS,dQ:()=>r.dQ,gM:()=>r.gM,gP:()=>r.gP,kB:()=>r.kB,py:()=>r.py,r2:()=>s.r2,up:()=>r.up});var s=n(1821),r=n(8260)},6286:(e,t,n)=>{"use strict";n.d(t,{G2:()=>s,LA:()=>r,dJ:()=>i});const s="";class r{constructor(e,t,n){this.name=e,this.alphabet=t,this.cutoff=n}}class i extends r{constructor(e,t,n){super(e.name,e.alphabet,e.cutoff),this.freq=t,this.similarity=n}}},8260:(e,t,n)=>{"use strict";n.d(t,{wx:()=>p,w4:()=>P,gM:()=>_,KX:()=>x,py:()=>N,vU:()=>T,Ar:()=>b,jY:()=>g,GU:()=>E,dQ:()=>$,up:()=>M,kB:()=>y,FJ:()=>w,gP:()=>v});var s=n(976),r=n(6414),i=n.n(r),o=n(6286),a=n(1821),l=n(8607);class c extends Float32Array{}var u=n(850),h=n(2012),d=n(6137),m=n(7331);class p{get length(){return this.mList.length}get canonicals(){return this.mList}get originals(){return this.mList}isGap(e){return this.getOriginal(e)===this.gapOriginalMonomer}getCanonical(e){if(this.length<=e)throw new Error("Index out of bounds");return this.mList[e]}getOriginal(e){if(this.length<=e)throw new Error("Index out of bounds");return this.mList[e]}constructor(e,t){this.mList=e,this.gapOriginalMonomer=t}}class f{get length(){return this.seqS.length}get canonicals(){return this.seqS}get originals(){return this.seqS}isGap(e){return this.getOriginal(e)===l.lh[a.r2.FASTA]}getCanonical(e){if(this.length<=e)throw new Error("Index out of bounds");return this.isGap(e)?o.G2:this.seqS[e]}getOriginal(e){if(this.length<=e)throw new Error("Index out of bounds");return this.seqS[e]}constructor(e){this.seqS=e}}function g(e,t,n){const s=e.categories;return function(e,t){const n={};let s=!0,r=null;for(const i of e)if(null==r?r=i.length:i.length!==r&&(s=!1),i.length>=t)for(const e of i.canonicals)e in n||(n[e]=0),n[e]+=1;return{freq:n,sameLength:s}}(i().enumerate(e.getRawData()).map((([e,t])=>n(s[e]))),t)}const y=e=>{const t=i()(e.toString().matchAll(a.BM)).map((e=>e[2]??e[1])).toArray();return new p(t,l.lh[a.r2.FASTA])},w=e=>e?new f(e):new p([],l.lh[a.r2.FASTA]);function b(e,t=undefined){return n=>{if(n){let s;const r=new RegExp(String.raw`"-"|'-'|[^${e}]+`,"g");if(void 0!==t){r.lastIndex=0,s=new Array(Math.ceil(t));let e=null,i=0;for(;null!==(e=r.exec(n))&&i<t;)s[i++]=e[0].replace('"-"',"").replace("'-'","");s.splice(i)}else s=n.replaceAll('"-"',"").replaceAll("'-'","").split(e,t);return new p(s,l.lh[a.r2.SEPARATOR])}return new p([],l.lh[a.r2.SEPARATOR])}}const A=/(PEPTIDE1|DNA1|RNA1)\{([^}]+)}/g,C=/\[([^\[\]]+)]/g,v=e=>{A.lastIndex=0;const t=A.exec(e.toString()),n=t?t[2]:null,s=n?n.split("."):[];return new p(s.map((e=>{C.lastIndex=0;const t=C.exec(e);return t&&t.length>=2?t[1]:e})),l.lh[a.r2.HELM])};function T(e,t,n=undefined){if(e.toLowerCase().startsWith(a.r2.FASTA))return y;if(e.toLowerCase().startsWith(a.r2.SEPARATOR))return b(t,n);if(e.toLowerCase().startsWith(a.r2.HELM))return v;throw new Error(`Unexpected units ${e} .`)}const S=/([^\W_]+)/g;function E(e,t){if(e.length<=t)return e;const n=e.match(S),s=e.length>t||(n?.length??0)>1,r=n?.[0]??" ";return s?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 x(e,t,n="-"){const s=new Set([...new Set(Object.keys(e)),...t]);s.delete(n);const r=[],i=[];for(const n of s)r.push(n in e?e[n]:0),i.push(t.has(n)?1:0);const o=new c(r),a=new c(i);return(0,u.MA)(o,a)/((0,u.$G)(o)*(0,u.$G)(a))}function P(e,t,n="-"){const s=t.map((t=>{const s=x(e,t.alphabet,n);return new o.dJ(t,e,s)}));let r;const i=Math.max(...s.map((e=>e.similarity>e.cutoff?e.similarity:-1)));return r=i>0?s.find((e=>e.similarity===i)).name:"UN",r}function $(e,t=5){let n;return n=e.semType==s.SEMTYPE.MACROMOLECULE?l.g.forColumn(e).alphabet:P(g(e,t,y).freq,a.XS),N(n)}function N(e){switch(e){case"PT":return h.f.GrokGroups;case"DNA":case"RNA":return d.J.Chromatogram;default:return m.UE.Color}}function M(e){const t=e.columns.bySemTypeAll(s.SEMTYPE.MACROMOLECULE);let n=t.find((e=>{const t=e.getTag(s.TAGS.UNITS);return!!t&&-1!==t.indexOf("MSA")}))??null;return!n&&t.length>0&&(n=t[0]),n}},8607:(e,t,n)=>{"use strict";n.d(t,{g:()=>p,lh:()=>m});var s=n(976),r=n(6414),i=n.n(r),o=n(8447),a=n(6286),l=n(8260),c=n(708),u=n(7228),h=n(1047);const d=new class{constructor(){this.seqHandler="seq-handler",this.notationProvider="seq-handler.notation-provider"}},m={[o.r2.FASTA]:"-",[o.r2.SEPARATOR]:"",[o.r2.HELM]:"*"};class p{constructor(e){if(this._splitter=null,this.cached=!0,this._splitted=null,this.columnVersion=null,this._stats=null,this._maxLength=null,this._posList=null,this._joiner=void 0,e.type!==s.TYPE.STRING)throw new Error(`Unexpected column type '${e.type}', must be '${s.TYPE.STRING}'.`);this._column=e;const t=this._column.getTag(s.TAGS.UNITS);if(null==t)throw new Error("Units are not specified in column");if(this._units=t,this._notation=this.getNotation(),this._defaultGapOriginal=this.isFasta()?m[o.r2.FASTA]:this.isHelm()?m[o.r2.HELM]:m[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())p.setUnitsToFastaColumn(this);else if(this.isSeparator()){const t=e.getTag("separator");p.setUnitsToSeparatorColumn(this,t)}else{if(!this.isHelm())throw new Error(`Unexpected units '${this.column.getTag(s.TAGS.UNITS)}'.`);p.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.`);this.notationProvider=this.column.temp[d.notationProvider]??null,this.columnVersion=this.column.version}static setUnitsToFastaColumn(e){if(e.column.semType!==s.SEMTYPE.MACROMOLECULE||e.column.getTag(s.TAGS.UNITS)!==o.r2.FASTA)throw new Error(`The column of notation '${o.r2.FASTA}' must be '${s.SEMTYPE.MACROMOLECULE}'.`);e.column.setTag(s.TAGS.UNITS,o.r2.FASTA),p.setTags(e)}static setUnitsToSeparatorColumn(e,t){if(e.column.semType!==s.SEMTYPE.MACROMOLECULE||e.column.getTag(s.TAGS.UNITS)!==o.r2.SEPARATOR)throw new Error(`The column of notation '${o.r2.SEPARATOR}' must be '${s.SEMTYPE.MACROMOLECULE}'.`);if(!t)throw new Error(`The column of notation '${o.r2.SEPARATOR}' must have the separator tag.`);e.column.setTag(s.TAGS.UNITS,o.r2.SEPARATOR),e.column.setTag("separator",t),p.setTags(e)}static setUnitsToHelmColumn(e){if(e.column.semType!==s.SEMTYPE.MACROMOLECULE)throw new Error(`The column of notation '${o.r2.HELM}' must be '${s.SEMTYPE.MACROMOLECULE}'`);e.column.setTag(s.TAGS.UNITS,o.r2.HELM),p.setTags(e)}static setTags(e){const t=e.column.getTag(s.TAGS.UNITS);if([o.r2.FASTA,o.r2.SEPARATOR].includes(t)){if(!e.column.getTag("alphabet")&&0===Object.keys(e.stats.freq).length)throw new Error("Alphabet is empty and not annotated.");let t=e.column.getTag("aligned");null===t&&(t=e.stats.sameLength?"SEQ.MSA":"SEQ",e.column.setTag("aligned",t));let n=e.column.getTag("alphabet");if(null===n&&(n=(0,l.w4)(e.stats.freq,o.XS),e.column.setTag("alphabet",n)),"UN"===n){const t=Object.keys(e.stats.freq).length,n=Object.keys(e.stats.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 length(){return this._column.length}get units(){return this._units}get notation(){return this._notation}get defaultGapOriginal(){return this._defaultGapOriginal}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")}getSplitted(e,t){if(this.cached&&void 0===t){this.column.version===this.columnVersion&&null!==this._splitted||(this.columnVersion=this.column.version,this._splitted=new Array(this.column.length));let t=this._splitted[e]?this._splitted[e].deref():void 0;if(!t){const n=this.column.get(e);t=this.splitter(n),this._splitted[e]=new WeakRef(t)}return t}{const n=this.column.get(e);return this.getSplitter(t)(n)}}get stats(){if(null===this._stats){const e={};let t=!0,n=null;const s=this.column.length;for(let r=0;r<s;++r){const s=this.getSplitted(r);null==n?n=s.length:s.length!==n&&(t=!1);for(const t of s.canonicals)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.column.length?0:Math.max(...i().count(0).take(this.column.length).map((e=>this.getSplitted(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||e===this._defaultGapOriginal}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,n,r){const i=this.column,a=e.toLowerCase()+"("+i.name+")",l=n??i.dataFrame.columns.getUnusedName(a),c=s.Column.fromList("string",l,r??new Array(this.column.length).fill(""));if(c.semType=s.SEMTYPE.MACROMOLECULE,c.setTag(s.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(s.TAGS.CELL_RENDERER,"sequence");const u=i.getTag("aligned");u&&c.setTag("aligned",u);let h=i.getTag("alphabet");h||this.notation!==o.r2.HELM||e===o.r2.HELM||(h="UN"),null!=h&&c.setTag("alphabet",h);let d=i.getTag(".alphabetSize");null!=h&&d&&c.setTag(".alphabetSize",d);const m=i.getTag(".alphabetIsMultichar");return null!=h&&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=p.forColumn(e),n=t.notation;return t.getNewColumn(n)}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,n){if(!p.unitsStringIsValid(n))throw new Error("Invalid format of 'units' parameter");const r=s.Column.fromList("string",t,new Array(e).fill(""));return r.semType=s.SEMTYPE.MACROMOLECULE,r.setTag(s.TAGS.UNITS,n),r}getSplitter(e){let t=null;if(t=this.notationProvider?this.notationProvider.splitter:null,t)return t;if(this.units.toLowerCase().startsWith(o.r2.FASTA))return null===this.column.getTag("alphabet")||this.getAlphabetIsMultichar()?o.kB:l.FJ;if(this.units.toLowerCase().startsWith(o.r2.SEPARATOR))return(0,o.Ar)(this.separator,e);if(this.units.toLowerCase().startsWith(o.r2.HELM))return o.gP;throw new Error(`Unexpected units ${this.units} .`)}split(e){return this.splitter(e)}getDistanceFunctionName(){if(!this.isFasta())throw new Error("Only FASTA notation is supported");return this.isMsa()?c.U.HAMMING:(this.alphabet,c.U.LEVENSHTEIN)}getDistanceFunction(){return c.o[this.getDistanceFunctionName()]()}async checkHelmCompatibility(){if(this.column.tags.has(".isHelmCompatible"))return"true"===this.column.getTag(".isHelmCompatible");const e=(await(0,u.JN)()).getBioLib().getMonomerSymbolsByType("PEPTIDE"),t=new Set(e),n=((0,o.Ar)(this.separator),new Set),s=this.column.length,r=this.column.getRawData();for(let e=0;e<s;++e){const s=r[e];if(!(s in n)){n.add(s);const r=this.getSplitted(e);for(const e of r.canonicals)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=this.getSplitter()),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,n,s){s||(s=this.toFasta(t)?m[o.r2.FASTA]:m[o.r2.SEPARATOR]),n||(n=this.toFasta(t)?"":this.separator);const r=e.startsWith("RNA"),i=this.splitter(e),a=[];for(let e=0;e<i.length;++e){let n=i.getOriginal(e);if(r&&(n=n.replace(h.pU,"")),n===m[o.r2.HELM])a.push(s);else if(this.toFasta(t)&&n.length>1){const e="["+n+"]";a.push(e)}else a.push(n)}return a.join(n)}convert(e,t){const n=this.getJoiner({notation:e,separator:t}),s=this.getNewColumn(e,t);return s.init((e=>{const t=this.getSplitted(e);return n(t)})),s}getRegion(e,t,n){const s=this.getNewColumn(this.notation,this.separator);s.name=n;const r=e??0,i=t??this.maxLength-1,a=this.getJoiner(),c=i-r+1,u=m[this.notation];s.init((e=>{const t=this.getSplitted(e),n=new Array(c);for(let e=0;e<c;++e){const s=r+e;n[e]=s<t.length?t.getOriginal(s):u}return a(new l.wx(n,u))}));const h=e=>{const t=e.split(",").map((e=>e.trim())),n=new Array(c);for(let e=0;e<c;++e){const s=r+e;n[e]=s<t.length?t[s]:"?"}return n.join(o.CI)},d=this.column.getTag(".positionNames");d&&s.setTag(".positionNames",h(d));const p=this.column.getTag(".positionLabels");return p&&s.setTag(".positionLabels",h(p)),s}get joiner(){return this._joiner||(this._joiner=this.getJoiner()),this._joiner}getJoiner(e){const t=e?e.notation:this.notation,n=e?e.separator:this.separator;let s;const r=this;switch(t){case o.r2.FASTA:s=function(e){return r.joinToFasta(e,r.isHelm())};break;case o.r2.SEPARATOR:if(!n)throw new Error(`Separator is mandatory for notation '${t}'.`);s=function(e){return f(e,n,r.isHelm())};break;case o.r2.HELM:{const e="DNA"===r.alphabet||"RNA"===r.alphabet,t=r.getHelmWrappers();s=function(n){return g(n,t,e)};break}default:throw new Error(`Unexpected notation '${t}'.`)}return s}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 n=this;if(e===o.r2.FASTA)return function(e){return n.convertToFasta(e)};if(e===o.r2.HELM)return function(e){return n.convertToHelm(e)};if(e===o.r2.SEPARATOR)return function(e){return n.convertToSeparator(e,t)};throw new Error}static forColumn(e){let t=e.temp[d.seqHandler];return t&&t.columnVersion===e.version||(t=e.temp[d.seqHandler]=new p(e)),t}joinToFasta(e,t){const n=new Array(e.length);for(let s=0;s<e.length;++s){const r=e.getOriginal(s);let i=e.getOriginal(s);t&&(i=i.replace(h.pU,"$1")),r===a.G2?i=m[o.r2.FASTA]:r===h.$3?i="":i.length>1&&(i="["+i+"]"),n[s]=i}return n.join("")}convertToFasta(e){const t=this.splitter,n=this.isHelm()?this.splitterAsHelmNucl(e):t(e);return this.joinToFasta(n,this.isHelm())}convertToSeparator(e,t){return f(this.isHelm()?this.splitterAsHelmNucl(e):this.splitter(e),t,this.isHelm())}convertToHelm(e){const t=this.getHelmWrappers(),n=e.startsWith("DNA")||e.startsWith("RNA");return g(this.splitter(e),t,n)}splitterAsHelmNucl(e){const t=this.splitter(e),n=new Array(t.length),s=e.startsWith("DNA"),r=e.startsWith("RNA");for(let e=0;e<t.length;++e){let i=t.getOriginal(e);(s||r)&&(i=i.replace(h.pU,"$1"),i=i===h.$3?null:i),n[e]=i||null}return new l.wx(n.filter((e=>!!e)),m[o.r2.HELM])}}function f(e,t,n){const s=new Array(e.length);for(let t=0;t<e.length;++t){const r=e.getCanonical(t);let i=e.getOriginal(t);n&&(i=i.replace(h.pU,"$1")),r===a.G2?i=m[o.r2.SEPARATOR]:r===h.$3&&(i=""),s[t]=i}return s.join(t)}function g(e,t,n){const[s,r,i,l]=t,c=new Array(e.length);for(let t=0;t<e.length;++t){const s=e.getCanonical(t);let l=e.getOriginal(t);s===a.G2?l=m[o.r2.HELM]:(n&&(l=l.replace(h.pU,"$1")),l=1===l.length?`${r}${l}${i}`:`${r}[${l}]${i}`),c[t]=l}return`${s}${c.join(".")}${l}`}},8457:(e,t,n)=>{"use strict";n.d(t,{O:()=>i});var s=n(976),r=n(8607);function i(e){const t=e=>{const t=o.columns.addNewString((e+1).toString());return n.push(t),t},n=[],i=e.length,o=s.DataFrame.create(i),a=r.g.forColumn(e);for(let e=0;e<i;++e){const s=a.getSplitted(e);for(let r=0;r<s.length;++r){const i=s.getOriginal(r);((n[r]??null)||t(r)).set(e,i,!1)}}return o}},172:(e,t,n)=>{"use strict";n.d(t,{c:()=>i});var s,r=n(7945);!function(e){e[e.error=0]="error",e[e.warning=1]="warning",e[e.info=2]="info",e[e.debug=3]="debug"}(s||(s={}));class i{constructor(e){this.logger=e,this.promise=Promise.resolve(),this.errors=[],this.syncCounter=0}sync(e,t){const n=++this.syncCounter;this.logger.debug(`${e}, SYNC syncId = ${n}, IN `),this.promise=this.promise.then((async()=>{this.logger.debug(`${e}, SYNC syncId = ${n}, START `),await t(),this.logger.debug(`${e}, SYNC syncId = ${n}, END `)})).catch((t=>{const[s,i]=(0,r.yf)(t);this.logger.error(`${e}, SYNC syncId = ${n}, ERROR:\n${s}`,void 0,i),this.errors.push(t)}))}resetErrors(){const e=this.errors;return this.errors=[],e}}},9298:(e,t,n)=>{"use strict";n.d(t,{Ct:()=>l,DX:()=>s,ES:()=>r,dE:()=>a,iD:()=>o,vS:()=>u,vw:()=>i});var s,r,i,o,a,l,c=n(976);!function(e){e.tooltipWebLogo=".tooltipWebLogo"}(s||(s={})),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 u=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}}},7905:(e,t,n)=>{"use strict";e=n.hmd(e);var s,r=(s="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e={}){var t,n,r=void 0!==e?e:{};r.ready=new Promise((function(e,s){t=e,n=s}));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),s&&(c=s),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 u,h,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&&(u=r.wasmBinary),r.noExitRuntime,"object"!=typeof WebAssembly&&S("no native wasm support detected");var m,p,f,g=!1;function y(){var e=h.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=[],A=[],C=0,v=null,T=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 n(t),t}var E,_,x="data:application/octet-stream;base64,";function P(e){return e.startsWith(x)}function $(e){try{if(e==E&&u)return new Uint8Array(u);if(i)return i(e);throw"both async and sync fetching of the wasm failed"}catch(e){S(e)}}function N(e,t,n){return function(e){return u||!a&&!l||"function"!=typeof fetch?Promise.resolve().then((function(){return $(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 $(e)}))}(e).then((function(e){return WebAssembly.instantiate(e,t)})).then((function(e){return e})).then(n,(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(W(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=h.buffer;try{return h.grow(e-t.byteLength+65535>>>16),y(),1}catch(e){}}function R(e){return r["_"+e]}P(E="wasmDbscan.wasm")||(_=E,E=r.locateFile?r.locateFile(_,c):c+_);var O="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function F(e,t,n,s,r){var i={string:e=>{var t=0;return null!=e&&0!==e&&(t=function(e){var t=function(e){for(var t=0,n=0;n<e.length;++n){var s=e.charCodeAt(n);s<=127?t++:s<=2047?t+=2:s>=55296&&s<=57343?(t+=4,++n):t+=3}return t}(e)+1,n=H(t);return function(e,t,n){!function(e,t,n,s){if(!(s>0))return 0;for(var r=n+s-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(n>=r)break;t[n++]=o}else if(o<=2047){if(n+1>=r)break;t[n++]=192|o>>6,t[n++]=128|63&o}else if(o<=65535){if(n+2>=r)break;t[n++]=224|o>>12,t[n++]=128|o>>6&63,t[n++]=128|63&o}else{if(n+3>=r)break;t[n++]=240|o>>18,t[n++]=128|o>>12&63,t[n++]=128|o>>6&63,t[n++]=128|63&o}}t[n]=0}(e,p,t,n)}(e,n,t),n}(e)),t},array:e=>{var t,n,s=H(e.length);return t=e,n=s,m.set(t,n),s}},o=R(e),a=[],l=0;if(s)for(var c=0;c<s.length;c++){var u=i[n[c]];u?(0===l&&(l=D()),a[c]=u(s[c])):a[c]=s[c]}var h=o.apply(null,a);return function(e){return 0!==l&&B(l),function(e){return"string"===t?(n=e)?function(e,t,n){for(var s=t+n,r=t;e[r]&&!(r>=s);)++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,n,s):"":"boolean"===t?Boolean(e):e;var n,s}(e)}(h)}var k,G={__cxa_throw:function(e,t,n){throw new L(e).init(t,n),e},abort:function(){S("")},emscripten_memcpy_big:function(e,t,n){p.copyWithin(e,t,t+n)},emscripten_resize_heap:function(e){var t,n=p.length,s=2147483648;if((e>>>=0)>s)return!1;for(var r=1;r<=4;r*=2){var i=n*(1+.2/r);if(i=Math.min(i,e+100663296),I(Math.min(s,(t=Math.max(e,i))+(65536-t%65536)%65536)))return!0}return!1}},D=(function(){var e,t,s,i,o={env:G,wasi_snapshot_preview1:G};function a(e,t){var n,s=e.exports;return r.asm=s,h=r.asm.memory,y(),r.asm.__indirect_function_table,n=r.asm.__wasm_call_ctors,b.unshift(n),function(e){if(C--,r.monitorRunDependencies&&r.monitorRunDependencies(C),0==C&&(null!==v&&(clearInterval(v),v=null),T)){var t=T;T=null,t()}}(),s}if(C++,r.monitorRunDependencies&&r.monitorRunDependencies(C),r.instantiateWasm)try{return r.instantiateWasm(o,a)}catch(e){d("Module.instantiateWasm callback failed with error: "+e),n(e)}(e=u,t=E,s=o,i=function(e){a(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||P(t)||"function"!=typeof fetch?N(t,s,i):fetch(t,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,s).then(i,(function(e){return d("wasm streaming compile failed: "+e),d("falling back to ArrayBuffer instantiation"),N(t,s,i)}))}))).catch(n)}(),r._dbscan=function(){return(r._dbscan=r.asm.dbscan).apply(null,arguments)},r._malloc=function(){return(r._malloc=r.asm.malloc).apply(null,arguments)},r._free=function(){return(r._free=r.asm.free).apply(null,arguments)},function(){return(D=r.asm.stackSave).apply(null,arguments)}),B=function(){return(B=r.asm.stackRestore).apply(null,arguments)},H=function(){return(H=r.asm.stackAlloc).apply(null,arguments)},W=function(){return(W=r.asm.__cxa_is_pointer_type).apply(null,arguments)};function V(){function e(){k||(k=!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(),A.unshift(e);var e;M(A)}()))}C>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)}(),C>0||(r.setStatus?(r.setStatus("Running..."),setTimeout((function(){setTimeout((function(){r.setStatus("")}),1),e()}),1)):e()))}if(r.ccall=F,r.cwrap=function(e,t,n,s){var r=!n||n.every((e=>"number"===e||"boolean"===e));return"string"!==t&&r&&!s?R(e):function(){return F(e,t,n,arguments)}},T=function e(){k||V(),k||(T=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&&n.amdO?define([],(function(){return r})):"object"==typeof exports&&(exports.exportCppDbscanLib=r)},5697:(e,t,n)=>{"use strict";n.d(t,{Dz:()=>w,FV:()=>c,Jv:()=>T,KR:()=>l,MI:()=>A,NB:()=>p,UX:()=>m,WI:()=>d,Zd:()=>h,_h:()=>u,aW:()=>g,bX:()=>v,fX:()=>b,kg:()=>o,s:()=>f,yU:()=>y});var s=n(9657),r=n(1040),i=n(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 n=e.trueCount()+t.trueCount();if(0==n)return 1;const s=e.andWithCountBits(t,!0);return s/(n-s)}function l(e,t){return 1-a(e,t)}function c(e,t){return C(a(new s.Z(e,32*e.length),new s.Z(t,32*t.length)))}function u(e,t){return 1-function(e,t){const n=e.trueCount()+t.trueCount();return 0==n?0:2*e.andWithCountBits(t,!0)/n}(e,t)}function h(e,t){return 1-function(e,t){const n=e.trueCount()*t.trueCount();return 0==n?0:e.andWithCountBits(t,!0)/Math.sqrt(n)}(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 n=e.trueCount()+t.trueCount(),s=e.andWithCountBits(t,!0);return s/(2*n-3*s)}(e,t)}function f(e,t){return C(function(e,t){const n=e.trueCount()+t.trueCount(),s=e.trueCount()*t.trueCount();return 0==s?0:e.andWithCountBits(t,!0)*n/(2*s)}(e,t))}function g(e,t){return C(function(e,t){const n=e.trueCount()+t.trueCount(),s=e.trueCount()*t.trueCount();return 0==s?0:(e.andWithCountBits(t,!0)*n-s)/s}(e,t))}function y(e,t){return 1-function(e,t){const n=Math.min(e.trueCount(),t.trueCount());return 0==n?0:e.andWithCountBits(t,!0)/n}(e,t)}function w(e,t){return C(function(e,t){const n=Math.max(e.trueCount(),t.trueCount());return 0==n?0:e.andWithCountBits(t,!0)/n}(e,t))}function b(e,t){return C(function(e,t){return 0==e.length?0:e.andWithCountBits(t,!0)/e.length}(e,t))}function A(e,t){return C(function(e,t){const n=e.andWithCountBits(t,!0),s=e.countBits(!0)+t.countBits(!0),r=e.length,i=r-s+n;return n==r||i==r?1:n/s+i/(2*r-s)}(e,t))}function C(e){return 0===e?3402823e32:1/e-1}function v(e){if(e&&null!=e.range&&e.range>0){const t=e.range;return(e,n)=>Math.abs(e-n)/t}return(e,t)=>Math.abs(e-t)}function T(e){const t=function(e){const t=e?.mostCommon??new Set;return(e,n)=>{const s=e.length,r=n.length;let i=0,o=0,a=0;for(;o<s&&a<r;)e[o]===n[a]?(t?.has(e[o])||++i,++o,++a):e[o]<n[a]?++o:++a;return i}}(e);return(e,n)=>0===n.length||0===e.length?1e4:Math.min(e.length,n.length)/(t(e,n)+1e-4)}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,n)=>{"use strict";n.d(t,{Ec:()=>r,sS:()=>s});const s="bypassLargeDataWarning",r="show-scatterplot-progress"},708:(e,t,n)=>{"use strict";function s(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,n=e.scoringMatrix,s=Math.min(...Object.keys(t).map((e=>e.charCodeAt(0))))+1,r=new Float32Array((n.length+s)*(n.length+s));return Object.entries(t).forEach((([e,s])=>{const i=n[s];Object.entries(t).forEach((([t,s])=>{r[e.charCodeAt(0)*n.length+t.charCodeAt(0)]=i[s]}))})),(e,t)=>1-r[e.charCodeAt(0)*n.length+t.charCodeAt(0)]}(),n=e?.threshold??0;return(e,s)=>{let r=0;const i=e.length,o=s.length,a=Math.ceil(Math.max(i,o)*(1-n));i!==o&&(r=Math.abs(i-o));let l=0;for(let n=0;n<Math.min(i,o);n++)if(e[n]!==s[n]&&(l+=t(e[n],s[n]),l>a))return 1;return l+=r,l/=Math.max(i,o),l}}n.d(t,{U:()=>o,o:()=>a});var r=n(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]:s,[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:n,gapExtend:s,scoringMatrix:r,alphabetIndexes:o}={...i,...e};Object.entries(o).forEach((([e,n])=>t[e.charCodeAt(0)]=n));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,u=1;for(let t=1;t<e.length+1;t++)a[0][t]=-n-(t-1)*s,a[1][t]=0;a[0][0]=0;for(let h=1;h<i.length+1;h++){a[u][0]=-n-(h-1)*s;for(let d=1;d<e.length+1;d++){const m=a[c][d-1]+r[t[e.charCodeAt(d-1)]][t[i.charCodeAt(h-1)]],p=a[c][d]-(o[d]?s:n),f=a[u][d-1]-(l[d-1]?s:n);a[u][d]=Math.max(m,f,p),a[u][d]===m?(o[d]=!1,l[d]=!1):a[u][d]===f?(o[d]=!1,l[d]=!0):(o[d]=!0,l[d]=!1)}c=u,u=(u+1)%2}const h=Math.max(e.length,i.length);return(h-a[c][e.length])/h}},[o.MONOMER_CHEMICAL_DISTANCE]:s}},4628:(e,t,n)=>{"use strict";var s;n.d(t,{A:()=>s}),function(e){e.UMAP="UMAP",e.T_SNE="t-SNE"}(s||(s={}))},1040:(e,t,n)=>{"use strict";var s,r,i,o,a,l,c;n.d(t,{CF:()=>r,Qe:()=>a,W:()=>s,Yc:()=>l,gd:()=>o,gj:()=>c,gk:()=>i}),function(e){e.Levenshtein="Levenshtein",e.JaroWinkler="Jaro-Winkler",e.Manhattan="Manhattan",e.Onehot="One-Hot"}(s||(s={})),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",e.NumberArray="NumberArray"}(a||(a={})),function(e){e.Difference="Difference"}(l||(l={})),function(e){e.CommonItems="Common Items"}(c||(c={}))},6361:(e,t,n)=>{"use strict";n.d(t,{gk:()=>s.gk});var s=n(1040);n(7861)},7861:(e,t,n)=>{"use strict";var s=n(1811),r=n(3979),i=n(5697),o=n(850),a=n(708),l=n(1040);const c={[l.CF.Euclidean]:o.dP},u={[l.W.Levenshtein]:s.T,[l.W.JaroWinkler]:r.H$,[l.W.Manhattan]:function(e,t){if(e.length!==t.length)return 1;{let n=0;for(let s=1;s<e.length;s++)n+=e[s]==t[s]?0:1;return n/e.length}},[l.W.Onehot]:function(e,t){return e===t?0:1}},h={[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.gj.CommonItems]:i.Jv},f={[l.Qe.Vector]:{[l.CF.Euclidean]:c[l.CF.Euclidean]},[l.Qe.String]:{[l.W.Levenshtein]:u[l.W.Levenshtein],[l.W.JaroWinkler]:u[l.W.JaroWinkler],[l.W.Manhattan]:u[l.W.Manhattan],[l.W.Onehot]:u[l.W.Onehot]},[l.Qe.BitArray]:{[l.gk.Tanimoto]:h[l.gk.Tanimoto],[l.gk.Dice]:h[l.gk.Dice],[l.gk.Asymmetric]:h[l.gk.Asymmetric],[l.gk.BraunBlanquet]:h[l.gk.BraunBlanquet],[l.gk.Cosine]:h[l.gk.Cosine],[l.gk.Kulczynski]:h[l.gk.Kulczynski],[l.gk.McConnaughey]:h[l.gk.McConnaughey],[l.gk.RogotGoldberg]:h[l.gk.RogotGoldberg],[l.gk.Russel]:h[l.gk.Russel],[l.gk.Sokal]:h[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]},[l.Qe.NumberArray]:{[l.gj.CommonItems]:p[l.gj.CommonItems]}};Object.keys(f).reduce(((e,t)=>{for(const n of Object.keys(f[t]))e[n]=t;return e}),{})},9657:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});class s{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 n=e,r=s._createBuffer(n);if(t)for(let e=0;e<r.length;e++)r[e]=-1;this._data=r,this._length=n}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,n,s){if(e<t||e>n)throw new Error(`Argument ${s} (${e}) out of range (${t}, ${n})`)}copy(e,t,n){for(let s=0;s<n;s++)t[s]=e[s]}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 n=new s(e._length);n._length=e._length,n._data=s._createBuffer(n._length),n._version=0;const r=e.lengthInInts;for(let s=0;s<r;s++)n._data[s]=e._data[s]&t._data[s];return n}static _createBuffer(e){return new Uint32Array(Math.floor((e+31)/32))}static fromValues(e){const t=new s(e.length);t._version=0;for(let n=0;n<t._length;n++)e[n]&&(t._data[Math.floor(n/32)]|=1<<(n%32&31));return t}static fromSeq(e,t){const n=new s(e);for(let s=0;s<e;++s)n.setBit(s,t(s));return n._version=0,n}static fromString(e){return s.fromSeq(e.length,(t=>"1"==e.charAt(t)))}static fromUint32Array(e,t){const n=new s(e);return n._data=t,n}static fromBytes(e){const t=e.length,n=new s(8*t);n._data=new Uint32Array(Math.floor((t+3)/4)),n._length=8*t;let r=0,i=0;for(;t-i>=4;)n._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&&(n._data[r]=(255&e[i+2])<<16),t-i==2&&(n._data[r]|=(255&e[i+1])<<8),t-i==1&&(n._data[r]|=255&e[i]),n._version=0,n}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 s(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 n=e?-1:0,s=this.lengthInInts;for(let e=0;e<s;e++)this._data[e]=n;this.incrementVersion(t)}setIndexes(e,t=!0,n=!0,s=!0){n&&this.setAll(!t,!1);for(const n of e)this.setFast(n,t);this.incrementVersion(s)}everyIndex(e,t=!0){for(const n of e)if(this.getBit(n)!=t)return!1;return!0}anyIndex(e,t=!0){for(const n of e)if(this.getBit(n)==t)return!0;return!1}setWhere(e,t=!0,n=!0,s=!0,r=!0){if(n&&r&&this.setAll(!t,!1),r)for(let n=0;n<this._length;n++)e(n)&&this.setFast(n,t);else for(let n=0;n<this._length;n++)this.setFast(n,e(n)?t:!t);this.incrementVersion(s)}getRange(e,t){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length,"to");const n=[];for(let s=e;s<t;++s)n.push(this.getBit(s));return s.fromValues(n)}getRangeAsList(e,t){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length,"to");const n=[];for(let s=e;s<t;++s)n.push(this.getBit(s));return n}setRange(e,t,n,s=!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(n)for(let e=r;e<=i;e++)this.setTrue(e);else for(let e=r;e<=i;e++)this.setFalse(e);return this.incrementVersion(s),this}setRandom(e,t,n=!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 n=0;n<e;){const e=Math.floor(Math.random()*this._length);this.getBit(e)!=t&&(this.setFast(e,t),n++)}this.incrementVersion(n)}and(e,t=!0){if(this._length!=e._length)throw new Error("Array lengths differ.");for(let t=0,n=this.lengthInInts;t<n;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 n=this.lengthInInts;for(let t=0;t<n;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,n=this.lengthInInts;t<n;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,n=this.lengthInInts;t<n;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,n=this.lengthInInts;t<n;t++)this._data[t]^=e._data[t];return this.incrementVersion(t),this}insertAt(e,t,n=!1){if(this.assureInRange(e,0,this._length,"pos"),0==t)return;const s=this._length;this.setLength(this._length+t);for(let n=s-1;n>=e;n--)this.setBit(n+t,this.getBit(n));for(let s=e;s<e+t;s++)this.setBit(s,n)}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 n=e;n<this._length-t;n++)this.setBit(n,this.getBit(n+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 n=0;for(let s=-1;-1!=(s=e.findNext(s,!t));)this.setFast(n++,this.getBit(s));this._length=n,this._version++}return this}getBit(e){return 0!=(this._data[Math.floor(e/32)]&1<<(31&e))}setBit(e,t,n=!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+=s._onBitCount[255&e];let n=this._data[t];const r=31&this._length;for(0!=r&&(n&=~(4294967295<<r));0!=n;n>>>=8)this._selectedCount+=s._onBitCount[255&n];this._selectedCountVersion=this._version}return e?this._selectedCount:this._length-this._selectedCount}countWhere(e){let t=0;if(this.trueCount()==this._length)for(let n=0;n<this._length;n++)t+=e(n)?1:0;else for(let n=-1;-1!=(n=this.findNext(n,!0));)t+=e(n)?1:0;return t}andWithCountBits(e,t){if(0==this._length)return 0;let n=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)n+=s._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)n+=s._onBitCount[255&o];return t?n:this._length-n}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 n=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!=n)r&=4294967295<<n&4294967295,n=0;else if(!t&&-4294967296==r)continue;for(let t=0;0!=r;t+=8,r>>>=8){const n=s._firstOnBit[255&r];if(n>=0)return(e=n+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 n=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!=n&&(e&=~(4294967295<<n),n=0);for(let t=24;0!=e;t-=8,e<<=8){const n=s._lastOnBit[e>>>24];if(n>=0)return n+32*r+t}}return-1}}s._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]),s._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]),s._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])},2997:(e,t,n)=>{"use strict";n.d(t,{X5:()=>k,ow:()=>V,bb:()=>F,W3:()=>O,gw:()=>W,l_:()=>M,f6:()=>R,jh:()=>L,Wh:()=>I,ci:()=>D,Bu:()=>N,zg:()=>P,zN:()=>$,AB:()=>j,QK:()=>w});var s=n(4469),r=n(976);n(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,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))};function a(e,t,n,s,r,i,a,l,c=!0){return o(this,void 0,void 0,(function*(){let u=null;if(yield $(s,(n=>o(this,void 0,void 0,(function*(){let n=null;for(const s of e.viewers)s.type===t&&(n=s);if(!n)throw Error("Viewer hasn't been added");if(yield Promise.resolve(),i&&(yield i(n)),r){const t=null!=l?l:{};t.tv=e,t.viewer=n,u=yield r(t,c)}n.close()}))),(()=>o(this,void 0,void 0,(function*(){a?e.loadLayout(a):yield function(e,t,n){return o(this,void 0,void 0,(function*(){let s;return n?(s=yield e.dataFrame.plot.fromType(t),e.dockManager.dock(s)):s=e.addViewer(t),s}))}(e,t,n)}))),6e4,"TEST_EVENT_ASYNC"),u)return u}))}function l(e,t=!0){return o(this,void 0,void 0,(function*(){const n=e.tv.dataFrame,s=n.clone();Array.from(n.row(0).cells).forEach((e=>e.value=null));const r=n.rowCount<20?Math.floor(n.rowCount/2):10;n.rows.select((e=>e.idx>=0&&e.idx<r)),t&&(yield W(50));for(let e=r;e<2*r;e++)n.filter.set(e,!1);t&&(yield W(50)),n.currentRowIdx=1,n.columns.names().slice(0,Math.ceil(n.columns.length/2)).forEach((e=>n.columns.remove(e))),t&&(yield W(100)),e.tv.dataFrame=s,yield W(50)}))}function c(e,t=!0){return o(this,void 0,void 0,(function*(){let t,n;try{t=e.viewer.getOptions(!0).look}catch(e){throw new Error("Viewer's .getOptions() error.",{cause:e})}try{n=e.viewer.getProperties()}catch(e){throw new Error("Viewer's .getProperties() error.",{cause:e})}const s={};return Object.keys(t).filter((e=>"boolean"==typeof t[e])).forEach((e=>s[e]=!t[e])),n.filter((e=>null!==e.choices)).forEach((e=>s[e.name]=e.choices.find((n=>n!==t[e.name])))),e.viewer.setOptions(s),yield W(300),{layout:e.tv.saveLayout(),savedProps:e.viewer.getOptions().look}}))}function u(e,t=!0){return o(this,void 0,void 0,(function*(){M(JSON.stringify(e.viewer.getOptions().look),JSON.stringify(e.savedProps))}))}var h=function(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))};const d=3e4,m=108e5,p=console.log.bind(console),f=console.info.bind(console),g=console.warn.bind(console),y=console.error.bind(console),w={},b="Auto Tests",A="Demo",C="Detectors",v="Core",T={};let S;var E;!function(e){e.notNull=function(e,t){if(null==e)throw new Error(`${null==t?"Value":t} not defined`)}}(E||(E={}));class _{constructor(e,t){this.catchUnhandled=!0,this.report=!1,void 0!==e&&(this.catchUnhandled=e),void 0!==t&&(this.report=t)}}class x{constructor(e,t,n,s){var r;this.category=e,this.name=t,null!=s||(s={}),null!==(r=s.timeout)&&void 0!==r||(s.timeout=d),this.options=s,this.test=()=>h(this,void 0,void 0,(function*(){return new Promise(((e,t)=>h(this,void 0,void 0,(function*(){let s="";try{s=yield n()}catch(e){t(e)}e(s)}))))}))}}function P(e,t,n,s=0,r="timeout"){return h(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)}finally{a.unsubscribe(),clearTimeout(l)}})),l=setTimeout((()=>{a.unsubscribe(),o(r)}),s);n()}))}))}function $(e,t,n,s=0,r="timeout"){return h(this,void 0,void 0,(function*(){return new Promise(((i,o)=>{const a=e.subscribe((e=>{t(e).then((()=>{i("OK")})).catch((e=>{o(e)})).finally((()=>{a.unsubscribe(),clearTimeout(l)}))})),l=setTimeout((()=>{a.unsubscribe(),o(r)}),s);n()}))}))}function N(e,t,n){null==w[S]&&(w[S]={}),null==w[S].tests&&(w[S].tests=[]),w[S].tests.push(new x(S,e,t,n))}function M(e,t=!0,n){if(n=n?`${n}, `:"",e!==t)throw new Error(`${n}Expected "${t}", got "${e}"`)}function L(e,t,n=.001,s){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)<n;if(M(r,!0,`${null!=s?s:""} (tolerance = ${n})`),!r)throw new Error(`Expected ${t}, got ${e} (tolerance = ${n})`)}function I(e,t){for(const[n,s]of Object.entries(t)){if(!e.hasOwnProperty(n))throw new Error(`Expected property "${n}" not found`);const t=e[n];if(t instanceof Array&&s instanceof Array)R(t,s);else if(t instanceof Object&&s instanceof Object)I(t,s);else if(Number.isFinite(t)&&Number.isFinite(s))L(t,s);else if(t!=s)throw new Error(`Expected (${s}) for key '${n}', got (${t})`)}}function R(e,t){const n=e.length,s=t.length;if(n!=s)throw new Error(`Arrays are of different length: actual array length is ${n} and expected array length is ${s}`);for(let s=0;s<n;s++)if(e[s]instanceof Array&&t[s]instanceof Array)R(e[s],t[s]);else if(e[s]instanceof Object&&t[s]instanceof Object)I(e[s],t[s]);else if(e[s]!=t[s])throw new Error(`Expected ${t[s]} at position ${s}, got ${e[s]}`)}function O(e,t,n){var s;S=e,t(),w[S]&&(w[S].clear=null===(s=null==n?void 0:n.clear)||void 0===s||s,w[S].timeout=null==n?void 0:n.timeout)}function F(e){null==w[S]&&(w[S]={}),w[S].before=e}function k(e){null==w[S]&&(w[S]={}),w[S].after=e}function G(e,t){return e.replace(new RegExp(t.name,"gi"),t.nqName)}function D(e){var t,n,o,a,l,c,u;return h(this,void 0,void 0,(function*(){const d=null===(n=null===(t=s.functions.getCurrentCall())||void 0===t?void 0:t.func)||void 0===n?void 0:n.package;yield function(e,t){var n;return h(this,void 0,void 0,(function*(){const t=e.id;if(T[t])return;const o=w;if(void 0!==o[b]||void 0!==o[A]||Object.keys(o).find((e=>e.startsWith(b)||e.startsWith(v))))return void(T[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),s=null!==(n=e.pop())&&void 0!==n?n:t.name,r=e.length?v+": "+e.join(": "):v;void 0===o[r]&&(o[r]={tests:[],clear:!0}),o[r].tests.push(new x(r,s,(()=>h(this,void 0,void 0,(function*(){return yield t.apply()}))),{isAggregated:t.outputs.length>0,timeout:3e5}))}}const a=[],l=[],c=[],u=yield s.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,n=e.options.demoPath;if(t&&Array.isArray(t)&&t.length)for(let n=0;n<t.length;n++){const r=t[n].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 l=new x(b,1===t.length?e.name:`${e.name} ${n+1}`,(()=>h(this,void 0,void 0,(function*(){const r=yield s.functions.eval(G(t[n],e));if(i.wait&&(yield W(i.wait)),"boolean"==typeof r&&!r)throw`Failed: ${t[n]}, expected true, got ${r}`}))),{skipReason:i.skip,timeout:i.timeout});if(i.cat){const e=b+": "+i.cat;l.category=e,void 0===o[e]&&(o[e]={tests:[],clear:!0}),o[e].tests.push(l)}else a.push(l)}if(n){const t=e.options.demoWait?parseInt(e.options.demoWait):void 0,n=new x(A,e.friendlyName,(()=>h(this,void 0,void 0,(function*(){if(s.shell.lastError="",yield e.apply(),yield W(t||2e3),s.shell.lastError)throw new Error(s.shell.lastError)}))),{skipReason:e.options.demoSkip});l.push(n)}if(e.hasTag("semTypeDetector")){const t=new x(C,e.friendlyName,(()=>h(this,void 0,void 0,(function*(){const t=[];for(const n of i.clone().columns){const s=yield e.apply([n]);t.push(s||n.semType)}M(t.filter((e=>e)).length,1)}))),{skipReason:e.options.skipTest});c.push(t)}}T[t]=!0,a.length&&(o[b]={tests:a,clear:!0}),l.length&&(o[A]={tests:l,clear:!0}),c.length&&(o[C]={tests:c,clear:!1})}))}(d);const m=[];console.log("Running tests"),null!=e||(e={}),null!==(o=(u=e).testContext)&&void 0!==o||(u.testContext=new _),s.shell.lastError="";const S=[],E=function(){const e=[];return console.log=(...t)=>{e.push(...t),p(...t)},console.info=(...t)=>{e.push(...t),f(...t)},console.warn=(...t)=>{e.push(...t),g(...t)},console.error=(...t)=>{e.push(...t),y(...t)},e}();try{for(const[t,n]of Object.entries(w)){if((null==e?void 0:e.category)&&!t.toLowerCase().startsWith(null==e?void 0:e.category.toLowerCase())||(null===(a=e.exclude)||void 0===a?void 0:a.some((e=>t.startsWith(e)))))continue;p(`Started ${t} category`),S.push(t);const i=null===(l=n.tests)||void 0===l?void 0:l.every((e=>{var t;return null===(t=e.options)||void 0===t?void 0:t.skipReason}));try{n.before&&!i&&(yield n.before())}catch(e){n.beforeStatus=yield B(e)}const o=null!==(c=n.tests)&&void 0!==c?c:[],u=[];if(n.clear)for(let t=0;t<o.length;t++)u.push(yield H(o[t],null==e?void 0:e.test,E,n.timeout,d.name,e.verbose)),s.shell.closeAll(),r.Balloon.closeAll();else for(let t=0;t<o.length;t++)u.push(yield H(o[t],null==e?void 0:e.test,E,n.timeout,d.name,e.verbose));const h=u.filter((e=>"skipped"!=e.result));try{n.after&&!i&&(yield n.after())}catch(e){n.afterStatus=yield B(e)}n.afterStatus&&h.push({category:t,name:"after",result:n.afterStatus,success:!1,ms:0,skipped:!1}),n.beforeStatus&&h.push({category:t,name:"before",result:n.beforeStatus,success:!1,ms:0,skipped:!1}),m.push(...h)}}finally{console.log=p,console.info=f,console.warn=g,console.error=y}if(e.testContext.catchUnhandled&&(yield W(1e3),s.shell.lastError.length>0&&m.push({category:"Unhandled exceptions",name:"exceptions",result:s.shell.lastError,success:!1,ms:0,skipped:!1})),!e.test&&m.length){const t=m.filter((e=>e.success)).length,n=m.filter((e=>e.skipped)).length,i=m.filter((e=>!e.success)),o=d.name;for(const e of S){const t=m.filter((t=>t.category===e)),n=t.filter((e=>!e.success)).length,r={success:0===n,passed:t.filter((e=>e.success)).length,skipped:t.filter((e=>e.skipped)).length,failed:n,type:"package",packageName:o,category:e};s.log.usage(`${o}: ${e}`,r,`category-package ${o}: ${e}`)}if(!e.category){const e={success:0===i.length,passed:t,skipped:n,failed:i.length,type:"package",packageName:o};s.log.usage(o,e,`package-package ${o}`)}if(e.testContext.report){const e=new r.Logger,s="Package @package tested: @successful successful, @skipped skipped, @failed failed tests",o={successful:t,skipped:n,failed:i.length,package:d};for(const e of i)Object.assign(o,{[`${e.category} | ${e.name}`]:e.result});e.log(s,o,"package-tested")}}return m}))}function B(e){return h(this,void 0,void 0,(function*(){return`${e.toString()}\n${e.stack?yield r.Logger.translateStackTrace(e.stack):""}`}))}function H(e,t,n,i,o,a){var l,c,u,f,g,w;return h(this,void 0,void 0,(function*(){let h;n.length=0;let b="package";const A=null!=t&&e.name.toLowerCase()!==t.toLowerCase(),C=(null===(l=e.options)||void 0===l?void 0:l.skipReason)||A,v=A?"skipped":null===(c=e.options)||void 0===c?void 0:c.skipReason;C||p(`Started ${e.category} ${e.name}`);const T=Date.now();try{if(C)h={success:!0,result:v,ms:0,skipped:!0};else{let t=(null===(u=e.options)||void 0===u?void 0:u.timeout)===d&&i?i:null===(f=e.options)||void 0===f?void 0:f.timeout;t=r.Test.isInBenchmark&&t===d?m:t,h={success:!0,result:null!==(g=yield U(e.test,t))&&void 0!==g?g:"OK",ms:0,skipped:!1}}}catch(e){y(e),h={success:!1,result:yield B(e),ms:0,skipped:!1}}if((null===(w=e.options)||void 0===w?void 0:w.isAggregated)&&h.result.constructor===r.DataFrame){const e=h.result.col("success");if(b="core",e&&(h.success=e.stats.sum===e.length),!a){const e=h.result;e.columns.remove("stack"),e.rows.removeWhere((e=>e.get("success"))),h.result=e}h.result=h.result.toCsv()}if(h.logs=n.join("\n"),h.ms=Date.now()-T,C||p(`Finished ${e.category} ${e.name} for ${h.ms} ms`),h.category=e.category,h.name=e.name,!A){let t={success:h.success,result:h.result,ms:h.ms,skipped:h.skipped,type:b,packageName:o,category:e.category,test:e.name,logs:h.logs};if(h.result.constructor==Object){const e=Object.keys(h.result).reduce(((e,t)=>Object.assign(Object.assign({},e),{["result."+t]:h.result[t]})),{});t=Object.assign(Object.assign({},t),e)}s.log.usage(`${o}: ${e.category}: ${e.name}`,t,`test-${b} ${o}: ${e.category}: ${e.name}`)}return h}))}function W(e){return h(this,void 0,void 0,(function*(){yield new Promise((t=>setTimeout(t,e)))}))}function V(e,t="Timeout exceeded",n=500,s=50){return h(this,void 0,void 0,(function*(){return new Promise(((r,i)=>{setTimeout((()=>{clearInterval(o),i(new Error(t))}),n);const o=setInterval((()=>{e()&&(clearInterval(o),r())}),s)}))}))}function U(e,t){return h(this,void 0,void 0,(function*(){let n=null;const s=new Promise(((e,s)=>{n=setTimeout((()=>{s("EXECUTION TIMEOUT")}),t)}));try{return yield Promise.race([e(),s])}finally{n&&clearTimeout(n)}}))}const Y=r.DataFrame.fromColumns([r.Column.fromStrings("col",["val1","val2","val3"])]);function j(e,t,n){var r;return h(this,void 0,void 0,(function*(){const i=null!==(r=null==n?void 0:n.packageName)&&void 0!==r?r:"";(null==n?void 0:n.detectSemanticTypes)&&(yield s.data.detectSemanticTypes(t));const o=s.shell.addTableView(t);try{yield a(o,e,i,s.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(o,e,i,s.events.onViewerAdded,void 0,n.awaitViewer)),(null==n?void 0:n.readOnly)||(yield a(o,e,i,s.events.onViewerAdded,l),(null==n?void 0:n.awaitViewer)&&(yield a(o,e,i,s.events.onViewerAdded,l,n.awaitViewer)));let t=null;t=yield a(o,e,i,s.events.onViewerAdded,c),(null==n?void 0:n.awaitViewer)&&(t=yield a(o,e,i,s.events.onViewerAdded,c,n.awaitViewer)),yield a(o,e,i,s.events.onViewLayoutApplied,u,void 0,null==t?void 0:t.layout,{savedProps:null==t?void 0:t.savedProps}),(null==n?void 0:n.awaitViewer)&&(yield a(o,e,i,s.events.onViewLayoutApplied,u,n.awaitViewer,null==t?void 0:t.layout,{savedProps:null==t?void 0:t.savedProps})),!1!==(null==n?void 0:n.arbitraryDfTest)&&(o.dataFrame=Y,yield W(50),yield a(o,e,i,s.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(o,e,i,s.events.onViewerAdded,void 0,n.awaitViewer)))}finally{}}))}},850:(e,t,n)=>{"use strict";function s(e=!1,t="Assertion error."){if(!e)throw new Error(t)}function r(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(t)}function i(e,t){if(e.length!=t.length)throw new Error("The dimensionality of the vectors must match");let n=0;for(let s=0;s<e.length;s++)n+=e[s]*t[s];return n}function o(e,t){let n=0;const s=e.length;if(s!==t.length)throw new Error("The dimensionality of the vectors must match");for(let r=0;r<s;++r)n+=Math.pow(e[r]-t[r],2);return Math.sqrt(n)}function a(e){const t=e.length;let n=0,s=0;for(let r=0;r<t;++r)n+=e[r],s+=Math.pow(e[r],2);const r=n/t,i=1/Math.sqrt(s/t-Math.pow(r,2));for(let n=0;n<t;++n)e[n]=(e[n]-r)*i;return e}n.d(t,{$G:()=>r,Fv:()=>a,MA:()=>i,dP:()=>o,hu:()=>s})},3351:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(1581),r=n(3487),i=n(7023),o=n(4815),a=n(4181),l=n(2141),c="errorMessage",u=new s.Name("emUsed"),h={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:n,data:f,schema:g,schemaValue:y,it:w}=t;if(!1===w.createErrors)return;const b=g,A=r.strConcat(l.default.instancePath,w.errorPath);function C(e,t){return r.and(s._`${e}.keyword !== ${c}`,s._`!${e}.${u}`,s._`${e}.instancePath === ${A}`,s._`${e}.keyword in ${t}`,s._`${e}.schemaPath.indexOf(${w.errSchemaPath}) === 0`,s._`/^\\/[^\\/]*$/.test(${e}.schemaPath.slice(${w.errSchemaPath.length}))`)}function v(e,t){const s=[];for(const n in e){const e=t[n];d.test(e)&&s.push([n,S(e)])}return n.object(...s)}function T(e){return d.test(e)?new i._Code(i.safeStringify(e).replace(m,((e,t)=>`" + JSON.stringify(${o.getData(t,w)}) + "`)).replace(p,"")):s.stringify(e)}function S(e){return s._`function(){return ${T(e)}}`}n.if(s._`${l.default.errors} > 0`,(()=>{if("object"==typeof b){const[i,o]=function(e){let t,n;for(const s in e){if("properties"===s||"items"===s)continue;const r=e[s];if("object"==typeof r){t||(t={});const e=t[s]={};for(const t in r)e[t]=[]}else n||(n={}),n[s]=[]}return[t,n]}(b);o&&function(r){const i=n.const("emErrors",s.stringify(r)),o=n.const("templates",v(r,g));n.forOf("err",l.default.vErrors,(e=>n.if(C(e,i),(()=>n.code(s._`${i}[${e}.keyword].push(${e})`).assign(s._`${e}.${u}`,!0)))));const{singleError:c}=e;if(c){const e=n.let("message",s._`""`),r=n.let("paramsErrors",s._`[]`);h((t=>{n.if(e,(()=>n.code(s._`${e} += ${"string"==typeof c?c:";"}`))),n.code(s._`${e} += ${d(t)}`),n.assign(r,s._`${r}.concat(${i}[${t}])`)})),a.reportError(t,{message:e,params:s._`{errors: ${r}}`})}else h((e=>a.reportError(t,{message:d(e),params:s._`{errors: ${i}[${e}]}`})));function h(e){n.forIn("key",i,(t=>n.if(s._`${i}[${t}].length`,(()=>e(t)))))}function d(e){return s._`${e} in ${o} ? ${o}[${e}]() : ${y}[${e}]`}}(o),i&&function(e){const r=n.const("emErrors",s.stringify(e)),i=[];for(const t in e)i.push([t,v(e[t],g[t])]);const o=n.const("templates",n.object(...i)),c=n.scopeValue("obj",{ref:h,code:s.stringify(h)}),d=n.let("emPropParams"),m=n.let("emParamsErrors");n.forOf("err",l.default.vErrors,(e=>n.if(C(e,r),(()=>{n.assign(d,s._`${c}[${e}.keyword]`),n.assign(m,s._`${r}[${e}.keyword][${e}.params[${d}]]`),n.if(m,(()=>n.code(s._`${m}.push(${e})`).assign(s._`${e}.${u}`,!0)))})))),n.forIn("key",r,(e=>n.forIn("keyProp",s._`${r}[${e}]`,(i=>{n.assign(m,s._`${r}[${e}][${i}]`),n.if(s._`${m}.length`,(()=>{const r=n.const("tmpl",s._`${o}[${e}] && ${o}[${e}][${i}]`);a.reportError(t,{message:s._`${r} ? ${r}() : ${y}[${e}][${i}]`,params:s._`{errors: ${m}}`})}))}))))}(i),function(e){const{props:i,items:o}=e;if(!i&&!o)return;const h=s._`typeof ${f} == "object"`,d=s._`Array.isArray(${f})`,m=n.let("emErrors");let p,w;const b=n.let("templates");function C(e,t){n.assign(m,s.stringify(e)),n.assign(b,v(e,t))}i&&o?(p=n.let("emChildKwd"),n.if(h),n.if(d,(()=>{C(o,g.items),n.assign(p,s.str`items`)}),(()=>{C(i,g.properties),n.assign(p,s.str`properties`)})),w=s._`[${p}]`):o?(n.if(d),C(o,g.items),w=s._`.items`):i&&(n.if(r.and(h,r.not(d))),C(i,g.properties),w=s._`.properties`),n.forOf("err",l.default.vErrors,(e=>function(e,t,i){n.if(r.and(s._`${e}.keyword !== ${c}`,s._`!${e}.${u}`,s._`${e}.instancePath.indexOf(${A}) === 0`),(()=>{const r=n.scopeValue("pattern",{ref:/^\/([^/]*)(?:\/|$)/,code:s._`new RegExp("^\\\/([^/]*)(?:\\\/|$)")`}),o=n.const("emMatches",s._`${r}.exec(${e}.instancePath.slice(${A}.length))`),a=n.const("emChild",s._`${o} && ${o}[1].replace(/~1/g, "/").replace(/~0/g, "~")`);n.if(s._`${a} !== undefined && ${a} in ${t}`,(()=>i(a)))}))}(e,m,(t=>n.code(s._`${m}[${t}].push(${e})`).assign(s._`${e}.${u}`,!0))))),n.forIn("key",m,(e=>n.if(s._`${m}[${e}].length`,(()=>{a.reportError(t,{message:s._`${e} in ${b} ? ${b}[${e}]() : ${y}${w}[${e}]`,params:s._`{errors: ${m}[${e}]}`}),n.assign(s._`${l.default.vErrors}[${l.default.errors}-1].instancePath`,s._`${A} + "/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`)})))),n.endIf()}(function({properties:e,items:t}){const n={};if(e){n.props={};for(const t in e)n.props[t]=[]}if(t){n.items={};for(let e=0;e<t.length;e++)n.items[e]=[]}return n}(b))}const i="string"==typeof b?b:b._;i&&function(e){const i=n.const("emErrs",s._`[]`);n.forOf("err",l.default.vErrors,(e=>n.if(function(e){return r.and(s._`${e}.keyword !== ${c}`,s._`!${e}.${u}`,r.or(s._`${e}.instancePath === ${A}`,r.and(s._`${e}.instancePath.indexOf(${A}) === 0`,s._`${e}.instancePath[${A}.length] === "/"`)),s._`${e}.schemaPath.indexOf(${w.errSchemaPath}) === 0`,s._`${e}.schemaPath[${w.errSchemaPath}.length] === "/"`)}(e),(()=>n.code(s._`${i}.push(${e})`).assign(s._`${e}.${u}`,!0))))),n.if(s._`${i}.length`,(()=>a.reportError(t,{message:T(e),params:s._`{errors: ${i}}`})))}(i),e.keepErrors||function(){const e=n.const("emErrs",s._`[]`);n.forOf("err",l.default.vErrors,(t=>n.if(s._`!${t}.${u}`,(()=>n.code(s._`${e}.push(${t})`))))),n.assign(l.default.vErrors,e).assign(l.default.errors,s._`${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,n)=>{"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 s=n(7159),r=n(7299),i=n(1240),o=n(4087),a="https://json-schema.org/draft/2020-12/schema";class l extends s.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=n(4815);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=n(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 h=n(7426);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var d=n(6646);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return d.default}})},1581:(e,t,n)=>{"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 s=n(7159),r=n(3924),i=n(1240),o=n(98),a=["/properties"],l="http://json-schema.org/draft-07/schema";class c extends s.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 u=n(4815);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var h=n(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 d=n(7426);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var m=n(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 n{}t._CodeOrName=n,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class s extends n{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=s;class r extends n{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 s&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}function i(e,...t){const n=[e[0]];let s=0;for(;s<t.length;)l(n,t[s]),n.push(e[++s]);return new r(n)}t._Code=r,t.nil=new r(""),t._=i;const o=new r("+");function a(e,...t){const n=[u(e[0])];let s=0;for(;s<t.length;)n.push(o),l(n,t[s]),n.push(o,u(e[++s]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===o){const n=c(e[t-1],e[t+1]);if(void 0!==n){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}(n),new r(n)}function l(e,t){var n;t instanceof r?e.push(...t._items):t instanceof s?e.push(t):e.push("number"==typeof(n=t)||"boolean"==typeof n||null===n?n:u(Array.isArray(n)?n.join(","):n))}function c(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof s||'"'!==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 s?void 0:`"${e}${t.slice(1)}`}function u(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(u(e))},t.safeStringify=u,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,n)=>{"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 s=n(7023),r=n(8490);var i=n(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=n(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 s._Code(">"),GTE:new s._Code(">="),LT:new s._Code("<"),LTE:new s._Code("<="),EQ:new s._Code("==="),NEQ:new s._Code("!=="),NOT:new s._Code("!"),OR:new s._Code("||"),AND:new s._Code("&&"),ADD:new s._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){const n=e?r.varKinds.var:this.varKind,s=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${s};`+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 s._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof s.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=M(this.rhs,e,t),this}get names(){return N(this.lhs instanceof s.Name?{}:{...this.lhs.names},this.rhs)}}class u extends c{constructor(e,t,n,s){super(e,n,s),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class h 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 s._CodeOrName?this.code.names:{}}}class f extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce(((t,n)=>t+n.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:n}=this;let s=n.length;for(;s--;){const r=n[s];r.optimizeNames(e,t)||(L(e,r.names),n.splice(s,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>$(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 n;if(this.else=null===(n=this.else)||void 0===n?void 0:n.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&&$(e,this.else.names),e}}b.kind="if";class A extends g{}A.kind="for";class C extends A{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 $(super.names,this.iteration.names)}}class v extends A{constructor(e,t,n,s){super(),this.varKind=e,this.name=t,this.from=n,this.to=s}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:n,from:s,to:i}=this;return`for(${t} ${n}=${s}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){const e=N(super.names,this.from);return N(e,this.to)}}class T extends A{constructor(e,t,n,s){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=s}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 $(super.names,this.iterable.names)}}class S extends g{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}S.kind="func";class E extends f{render(e){return"return "+super.render(e)}}E.kind="return";class _ 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 n,s;return super.optimizeNames(e,t),null===(n=this.catch)||void 0===n||n.optimizeNames(e,t),null===(s=this.finally)||void 0===s||s.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&$(e,this.catch.names),this.finally&&$(e,this.finally.names),e}}class x extends g{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}x.kind="catch";class P extends g{render(e){return"finally"+super.render(e)}}function $(e,t){for(const n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function N(e,t){return t instanceof s._CodeOrName?$(e,t.names):e}function M(e,t,n){return e instanceof s.Name?i(e):(r=e)instanceof s._Code&&r._items.some((e=>e instanceof s.Name&&1===t[e.str]&&void 0!==n[e.str]))?new s._Code(e._items.reduce(((e,t)=>(t instanceof s.Name&&(t=i(t)),t instanceof s._Code?e.push(...t._items):e.push(t),e)),[])):e;var r;function i(e){const s=n[e.str];return void 0===s||1!==t[e.str]?e:(delete t[e.str],s)}}function L(e,t){for(const n in t)e[n]=(e[n]||0)-(t[n]||0)}function I(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:s._`!${k(e)}`}P.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 n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}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,n,s){const r=this._scope.toName(t);return void 0!==n&&s&&(this._constants[r.str]=n),this._leafNode(new l(e,r,n)),r}const(e,t,n){return this._def(r.varKinds.const,e,t,n)}let(e,t,n){return this._def(r.varKinds.let,e,t,n)}var(e,t,n){return this._def(r.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new c(e,t,n))}add(e,n){return this._leafNode(new u(e,t.operators.ADD,n))}code(e){return"function"==typeof e?e():e!==s.nil&&this._leafNode(new p(e)),this}object(...e){const t=["{"];for(const[n,r]of e)t.length>1&&t.push(","),t.push(n),(n!==r||this.opts.es5)&&(t.push(":"),(0,s.addCodeArg)(t,r));return t.push("}"),new s._Code(t)}if(e,t,n){if(this._blockNode(new b(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)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 C(e),t)}forRange(e,t,n,s,i=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const o=this._scope.toName(e);return this._for(new v(i,o,t,n),(()=>s(o)))}forOf(e,t,n,i=r.varKinds.const){const o=this._scope.toName(e);if(this.opts.es5){const e=t instanceof s.Name?t:this.var("_arr",t);return this.forRange("_i",0,s._`${e}.length`,(t=>{this.var(o,s._`${e}[${t}]`),n(o)}))}return this._for(new T("of",i,o,t),(()=>n(o)))}forIn(e,t,n,i=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,s._`Object.keys(${t})`,n);const o=this._scope.toName(e);return this._for(new T("in",i,o,t),(()=>n(o)))}endFor(){return this._endBlockNode(A)}label(e){return this._leafNode(new h(e))}break(e){return this._leafNode(new d(e))}return(e){const t=new E;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(e,t,n){if(!t&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');const s=new _;if(this._blockNode(s),this.code(e),t){const e=this.name("e");this._currNode=s.catch=new x(e),t(e)}return n&&(this._currNode=s.finally=new P,this.code(n)),this._endBlockNode(x,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 n=this._nodes.length-t;if(n<0||void 0!==e&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=s.nil,n,r){return this._blockNode(new S(e,t,n)),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 n=this._currNode;if(n instanceof e||t&&n 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=F(t.operators.AND);t.and=function(...e){return e.reduce(R)};const O=F(t.operators.OR);function F(e){return(t,n)=>t===s.nil?n:n===s.nil?t:s._`${k(t)} ${e} ${k(n)}`}function k(e){return e instanceof s.Name?e:s._`(${e})`}t.or=function(...e){return e.reduce(O)}},8490:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const s=n(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 s.Name("const"),let:new s.Name("let"),var:new s.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof s.Name?e:this.name(e)}name(e){return new s.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,n;if((null===(n=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===n?void 0:n.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 s.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=s._`.${new s.Name(t)}[${n}]`}}t.ValueScopeName=a;const l=s._`\n`;t.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?l:s.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var n;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const s=this.toName(e),{prefix:r}=s,i=null!==(n=t.key)&&void 0!==n?n: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,s);const a=this._scope[r]||(this._scope[r]=[]),l=a.length;return a[l]=t.ref,s.setValue(t,{property:r,itemIndex:l}),s}getValue(e,t){const n=this._values[e];if(n)return n.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 s._`${e}${t.scopePath}`}))}scopeCode(e=this._values,t,n){return this._reduceValues(e,(e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,n)}_reduceValues(e,n,o={},a){let l=s.nil;for(const c in e){const u=e[c];if(!u)continue;const h=o[c]=o[c]||new Map;u.forEach((e=>{if(h.has(e))return;h.set(e,i.Started);let o=n(e);if(o){const n=this.opts.es5?t.varKinds.var:t.varKinds.const;l=s._`${l}${n} ${e} = ${o};${this.opts._n}`}else{if(!(o=null==a?void 0:a(e)))throw new r(e);l=s._`${l}${o}${this.opts._n}`}h.set(e,i.Completed)}))}return l}}},4181:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const s=n(3487),r=n(6776),i=n(2141);function o(e,t){const n=e.const("err",t);e.if(s._`${i.default.vErrors} === null`,(()=>e.assign(i.default.vErrors,s._`[${n}]`)),s._`${i.default.vErrors}.push(${n})`),e.code(s._`${i.default.errors}++`)}function a(e,t){const{gen:n,validateName:r,schemaEnv:i}=e;i.$async?n.throw(s._`new ${e.ValidationError}(${t})`):(n.assign(s._`${r}.errors`,t),n.return(!1))}t.keywordError={message:({keyword:e})=>s.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?s.str`"${e}" keyword must be ${t} ($data)`:s.str`"${e}" keyword is invalid ($data)`},t.reportError=function(e,n=t.keywordError,r,i){const{it:l}=e,{gen:u,compositeRule:h,allErrors:d}=l,m=c(e,n,r);(null!=i?i:h||d)?o(u,m):a(l,s._`[${m}]`)},t.reportExtraError=function(e,n=t.keywordError,s){const{it:r}=e,{gen:l,compositeRule:u,allErrors:h}=r;o(l,c(e,n,s)),u||h||a(r,i.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(i.default.errors,t),e.if(s._`${i.default.vErrors} !== null`,(()=>e.if(t,(()=>e.assign(s._`${i.default.vErrors}.length`,t)),(()=>e.assign(i.default.vErrors,null)))))},t.extendErrors=function({gen:e,keyword:t,schemaValue:n,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,s._`${i.default.vErrors}[${o}]`),e.if(s._`${l}.instancePath === undefined`,(()=>e.assign(s._`${l}.instancePath`,(0,s.strConcat)(i.default.instancePath,a.errorPath)))),e.assign(s._`${l}.schemaPath`,s.str`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign(s._`${l}.schema`,n),e.assign(s._`${l}.data`,r))}))};const l={keyword:new s.Name("keyword"),schemaPath:new s.Name("schemaPath"),params:new s.Name("params"),propertyName:new s.Name("propertyName"),message:new s.Name("message"),schema:new s.Name("schema"),parentSchema:new s.Name("parentSchema")};function c(e,t,n){const{createErrors:r}=e.it;return!1===r?s._`{}`:function(e,t,n={}){const{gen:r,it:o}=e,a=[u(o,n),h(e,n)];return function(e,{params:t,message:n},r){const{keyword:o,data:a,schemaValue:c,it:u}=e,{opts:h,propertyName:d,topSchemaRef:m,schemaPath:p}=u;r.push([l.keyword,o],[l.params,"function"==typeof t?t(e):t||s._`{}`]),h.messages&&r.push([l.message,"function"==typeof n?n(e):n]),h.verbose&&r.push([l.schema,c],[l.parentSchema,s._`${m}${p}`],[i.default.data,a]),d&&r.push([l.propertyName,d])}(e,t,a),r.object(...a)}(e,t,n)}function u({errorPath:e},{instancePath:t}){const n=t?s.str`${e}${(0,r.getErrorPath)(t,r.Type.Str)}`:e;return[i.default.instancePath,(0,s.strConcat)(i.default.instancePath,n)]}function h({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:i}){let o=i?t:s.str`${t}/${e}`;return n&&(o=s.str`${o}${(0,r.getErrorPath)(n,r.Type.Str)}`),[l.schemaPath,o]}},5173:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const s=n(3487),r=n(7426),i=n(2141),o=n(2531),a=n(6776),l=n(4815);class c{constructor(e){var t;let n;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(n=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==n?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==n?void 0:n.$async,this.refs={}}}function u(e){const t=d.call(this,e);if(t)return t;const n=(0,o.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:a,lines:c}=this.opts.code,{ownProperties:u}=this.opts,h=new s.CodeGen(this.scope,{es5:a,lines:c,ownProperties:u});let m;e.$async&&(m=h.scopeValue("Error",{ref:r.default,code:s._`require("ajv/dist/runtime/validation_error").default`}));const p=h.scopeName("validate");e.validateName=p;const f={gen:h,allErrors:this.opts.allErrors,data:i.default.data,parentData:i.default.parentData,parentDataProperty:i.default.parentDataProperty,dataNames:[i.default.data],dataPathArr:[s.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,s.stringify)(e.schema)}:{ref:e.schema}),validateName:p,ValidationError:m,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:s.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:s._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(e),(0,l.validateFunctionCode)(f),h.optimize(this.opts.code.optimize);const t=h.toString();g=`${h.scopeRefs(i.default.scope)}return ${t}`,this.opts.code.process&&(g=this.opts.code.process(g,e));const n=new Function(`${i.default.self}`,`${i.default.scope}`,g)(this,this.scope.get());if(this.scope.value(p,{ref:n}),n.errors=null,n.schema=e.schema,n.schemaEnv=e,e.$async&&(n.$async=!0),!0===this.opts.code.source&&(n.source={validateName:p,validateCode:t,scopeValues:h._values}),this.opts.unevaluated){const{props:e,items:t}=f;n.evaluated={props:e instanceof s.Name?void 0:e,items:t instanceof s.Name?void 0:t,dynamicProps:e instanceof s.Name,dynamicItems:t instanceof s.Name},n.source&&(n.source.evaluated=(0,s.stringify)(n.evaluated))}return e.validate=n,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 h(e){return(0,o.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:u.call(this,e)}function d(e){for(const s of this._compilations)if(n=e,(t=s).schema===n.schema&&t.root===n.root&&t.baseId===n.baseId)return s;var t,n}function m(e,t){let n;for(;"string"==typeof(n=this.refs[t]);)t=n;return n||this.schemas[t]||p.call(this,e,t)}function p(e,t){const n=this.opts.uriResolver.parse(t),s=(0,o._getFullPath)(this.opts.uriResolver,n);let r=(0,o.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&s===r)return g.call(this,n,e);const i=(0,o.normalizeId)(s),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,n,t)}if("object"==typeof(null==a?void 0:a.schema)){if(a.validate||u.call(this,a),i===(0,o.normalizeId)(t)){const{schema:t}=a,{schemaId:n}=this.opts,s=t[n];return s&&(r=(0,o.resolveUrl)(this.opts.uriResolver,r,s)),new c({schema:t,schemaId:n,root:e,baseId:r})}return g.call(this,n,a)}}t.SchemaEnv=c,t.compileSchema=u,t.resolveRef=function(e,t,n){var s;n=(0,o.resolveUrl)(this.opts.uriResolver,t,n);const r=e.refs[n];if(r)return r;let i=m.call(this,e,n);if(void 0===i){const r=null===(s=e.localRefs)||void 0===s?void 0:s[n],{schemaId:o}=this.opts;r&&(i=new c({schema:r,schemaId:o,root:e,baseId:t}))}return void 0!==i?e.refs[n]=h.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:n,root:s}){var r;if("/"!==(null===(r=e.fragment)||void 0===r?void 0:r[0]))return;for(const s of e.fragment.slice(1).split("/")){if("boolean"==typeof n)return;const e=n[(0,a.unescapeFragment)(s)];if(void 0===e)return;const r="object"==typeof(n=e)&&n[this.opts.schemaId];!f.has(s)&&r&&(t=(0,o.resolveUrl)(this.opts.uriResolver,t,r))}let i;if("boolean"!=typeof n&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){const e=(0,o.resolveUrl)(this.opts.uriResolver,t,n.$ref);i=p.call(this,s,e)}const{schemaId:l}=this.opts;return i=i||new c({schema:n,schemaId:l,root:s,baseId:t}),i.schema!==i.root.schema?i:void 0}},2141:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r={data:new s.Name("data"),valCxt:new s.Name("valCxt"),instancePath:new s.Name("instancePath"),parentData:new s.Name("parentData"),parentDataProperty:new s.Name("parentDataProperty"),rootData:new s.Name("rootData"),dynamicAnchors:new s.Name("dynamicAnchors"),vErrors:new s.Name("vErrors"),errors:new s.Name("errors"),this:new s.Name("this"),self:new s.Name("self"),scope:new s.Name("scope"),json:new s.Name("json"),jsonPos:new s.Name("jsonPos"),jsonLen:new s.Name("jsonLen"),jsonPart:new s.Name("jsonPart")};t.default=r},6646:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(2531);class r extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`),this.missingRef=(0,s.resolveUrl)(e,t,n),this.missingSchema=(0,s.normalizeId)((0,s.getFullPath)(e,this.missingRef))}}t.default=r},2531:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;const s=n(6776),r=n(4063),i=n(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 n=e[t];if(Array.isArray(n)&&n.some(l))return!0;if("object"==typeof n&&l(n))return!0}return!1}function c(e){let t=0;for(const n in e){if("$ref"===n)return 1/0;if(t++,!o.has(n)&&("object"==typeof e[n]&&(0,s.eachItem)(e[n],(e=>t+=c(e))),t===1/0))return 1/0}return t}function u(e,t="",n){!1!==n&&(t=m(t));const s=e.parse(t);return h(e,s)}function h(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=u,t._getFullPath=h;const d=/#\/?$/;function m(e){return e?e.replace(d,""):""}t.normalizeId=m,t.resolveUrl=function(e,t,n){return n=m(n),e.resolve(t,n)};const p=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:n,uriResolver:s}=this.opts,o=m(e[n]||t),a={"":o},l=u(s,o,!1),c={},h=new Set;return i(e,{allKeys:!0},((e,t,s,r)=>{if(void 0===r)return;const i=l+t;let o=a[r];function u(t){const n=this.opts.uriResolver.resolve;if(t=m(o?n(o,t):t),h.has(t))throw f(t);h.add(t);let s=this.refs[t];return"string"==typeof s&&(s=this.refs[s]),"object"==typeof s?d(e,s.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}"`);u.call(this,`#${e}`)}}"string"==typeof e[n]&&(o=u.call(this,e[n])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),a[t]=o})),c;function d(e,t,n){if(void 0!==t&&!r(e,t))throw f(n)}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 n=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&n.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,n)=>{"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 s=n(3487),r=n(7023);function i(e,t=e.schema){const{opts:n,self:s}=e;if(!n.strictSchema)return;if("boolean"==typeof t)return;const r=s.RULES.keywords;for(const n in t)r[n]||p(e,`unknown keyword: "${n}"`)}function o(e,t){if("boolean"==typeof e)return!e;for(const n in e)if(t[n])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:n,resultToName:r}){return(i,o,a,l)=>{const c=void 0===a?o:a instanceof s.Name?(o instanceof s.Name?e(i,o,a):t(i,o,a),a):o instanceof s.Name?(t(i,a,o),o):n(o,a);return l!==s.Name||c instanceof s.Name?c:r(i,c)}}function u(e,t){if(!0===t)return e.var("props",!0);const n=e.var("props",s._`{}`);return void 0!==t&&h(e,n,t),n}function h(e,t,n){Object.keys(n).forEach((n=>e.assign(s._`${t}${(0,s.getProperty)(n)}`,!0)))}t.toHash=function(e){const t={};for(const n of e)t[n]=!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 n in e)if("$ref"!==n&&t.all[n])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},n,r,i){if(!i){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return s._`${n}`}return s._`${e}${t}${(0,s.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 n of e)t(n);else t(e)},t.mergeEvaluated={props:c({mergeNames:(e,t,n)=>e.if(s._`${n} !== true && ${t} !== undefined`,(()=>{e.if(s._`${t} === true`,(()=>e.assign(n,!0)),(()=>e.assign(n,s._`${n} || {}`).code(s._`Object.assign(${n}, ${t})`)))})),mergeToName:(e,t,n)=>e.if(s._`${n} !== true`,(()=>{!0===t?e.assign(n,!0):(e.assign(n,s._`${n} || {}`),h(e,n,t))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:u}),items:c({mergeNames:(e,t,n)=>e.if(s._`${n} !== true && ${t} !== undefined`,(()=>e.assign(n,s._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`))),mergeToName:(e,t,n)=>e.if(s._`${n} !== true`,(()=>e.assign(n,!0===t||s._`${n} > ${t} ? ${n} : ${t}`))),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=u,t.setEvaluated=h;const d={};var m;function p(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,!0===n)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,n){if(e instanceof s.Name){const r=t===m.Num;return n?r?s._`"[" + ${e} + "]"`:s._`"['" + ${e} + "']"`:r?s._`"/" + ${e}`:s._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,s.getProperty)(e).toString():"/"+a(e)},t.checkStrictMode=p},8876:(e,t)=>{"use strict";function n(e,t){return t.rules.some((t=>s(e,t)))}function s(e,t){var n;return void 0!==e[t.keyword]||(null===(n=t.definition.implements)||void 0===n?void 0:n.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},s){const r=t.RULES.types[s];return r&&!0!==r&&n(e,r)},t.shouldUseGroup=n,t.shouldUseRule=s},5667:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const s=n(4181),r=n(3487),i=n(2141),o={message:"boolean schema is false"};function a(e,t){const{gen:n,data:r}=e,i={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,s.reportError)(i,o,void 0,t)}t.topBoolOrEmptySchema=function(e){const{gen:t,schema:n,validateName:s}=e;!1===n?a(e,!1):"object"==typeof n&&!0===n.$async?t.return(i.default.data):(t.assign(r._`${s}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){const{gen:n,schema:s}=e;!1===s?(n.var(t,!1),a(e)):n.var(t,!0)}},453:(e,t,n)=>{"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 s=n(3141),r=n(8876),i=n(4181),o=n(3487),a=n(6776);var l;function c(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(s.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:n,data:s,opts:i}=e,a=function(e,t){return t?e.filter((e=>u.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,s,i.strictNumbers,l.Wrong);n.if(r,(()=>{a.length?function(e,t,n){const{gen:s,data:r,opts:i}=e,a=s.let("dataType",o._`typeof ${r}`),l=s.let("coerced",o._`undefined`);"array"===i.coerceTypes&&s.if(o._`${a} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,(()=>s.assign(r,o._`${r}[0]`).assign(a,o._`typeof ${r}`).if(d(t,r,i.strictNumbers),(()=>s.assign(l,r))))),s.if(o._`${l} !== undefined`);for(const e of n)(u.has(e)||"array"===e&&"array"===i.coerceTypes)&&c(e);function c(e){switch(e){case"string":return void s.elseIf(o._`${a} == "number" || ${a} == "boolean"`).assign(l,o._`"" + ${r}`).elseIf(o._`${r} === null`).assign(l,o._`""`);case"number":return void s.elseIf(o._`${a} == "boolean" || ${r} === null
|
|
2
|
+
var bio_test;(()=>{var e={2012:(e,t,n)=>{"use strict";n.d(t,{f:()=>r});var s=n(9976);class r extends s.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,n="",s="";for(const r of e)"("==r?t++:")"==r?t--:t?n+=r:s+=r;return isNaN(parseInt(n))?[s,n]:[s,""]}static getColorAAPivot(e="",t="grok"){const n=this.getPalette(t);let[s,r]=this.getInnerOuter(e);if(s=s.length>6?`${s.slice(0,3)}...`:s,r=r.length>6?`${r.slice(0,3)}...`:r,1==e.length||"("==e[1]){const t=e[0]?.toUpperCase();return t in n?[n.get(t),t,r,1]:[this.undefinedColor,s,r,1]}if("d"==e[0]&&e[1]in n&&(2==e.length||"("==e[2])){const t=e[1]?.toUpperCase();return t in n?[n.get(t),t,r,2]:[this.undefinedColor,s,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 n?[n.get(t),t,r,3]:[this.undefinedColor,s,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 n?[n.get(t),t,r,4]:[this.undefinedColor,s,r,4]}return[this.undefinedColor,s,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,n)=>{"use strict";n.d(t,{BX:()=>i,nW:()=>l,tW:()=>c,tb:()=>u});var s=n(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 s.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 s.dapi.userDataStorage.postValue(r,"Settings",JSON.stringify(e),!0)})),await a}async function u(){await c(o)}},7228:(e,t,n)=>{"use strict";n.d(t,{JN:()=>a,Qx:()=>l});var s=n(976),r=n(4469),i=(n(5697),n(1047),n(6286)),o=(n(8607),n(8457));async function a(){const e=s.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 l(e,t){e instanceof s.Column&&(e=(0,o.O)(e).columns.toList());const n=(await a()).getBioLib(),l=new Array(e.length),c=e[0].length,u=new Float32Array(c);for(let o=0;o<e.length;++o){const a=t.getCanonical(o),h=n.getMonomer("PEPTIDE",a)?.smiles??"",d=e[o],m=d.getRawData(),p=d.categories,f=p.indexOf("");if(l[o]={categories:p,data:m,emptyIndex:f},void 0===a)continue;const g=s.Column.fromStrings("smiles",p.map((e=>n.getMonomer("PEPTIDE",e)?.smiles??""))),y=(s.DataFrame.fromColumns([g]),(await r.chem.getSimilarities(g,h)).getRawData());for(let e=0;e<c;++e){const t=m[e];u[e]+=a!==i.G2&&t!==f?y[t]:a===i.G2&&t===f?1:0}}for(let n=0;n<u.length;++n){let r=u[n]/t.length;for(let i=0;i<e.length;++i){const e=l[i];if(i>=t.length&&e.data[n]!==e.emptyIndex||e.data[n]===e.emptyIndex&&i<t.length){r=s.FLOAT_NULL;break}}u[n]=r}return s.Column.fromFloat32Array("Similarity",u)}},8601:(e,t,n)=>{"use strict";n.d(t,{i0:()=>d});var s=n(4469),r=n(976),i=n(6414),o=n.n(i),a=n(1821),l=n(8607);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 u=n(1047);function h(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 h=t;const d=l.g.forColumn(t);d.isHelm()&&(h=d.convert(a.r2.SEPARATOR,"."),h.name=t.name);const p=l.g.forColumn(h).alphabet;let f;if(p===a.fb.PT||p===a.fb.UN)f="PEPTIDE";else{if(p!==a.fb.RNA&&p!==a.fb.DNA)return{col:null,warnings:[`Unexpected column's '${h.name}' alphabet '${p}'.`]};f="RNA"}const g=function(e){const t=e.length,n=new Array(t),r=l.g.forColumn(e);let i=!1;for(let e=0;e<t;++e){const t=r.getSplitted(e);i||(i=0===t.length),n[e]=o()(t.canonicals).filter((e=>!r.isGap(e))).map((e=>e)).toArray()}return i&&s.shell.warning(`Some values in the "${e.name}" column are empty`),n}(h),y=await async function(e,t,n,r){const i=function(e,t,n){const s=new Map;for(const r of e.getMonomerSymbolsByType(t)){const i=e.getMonomer(t,r);if("RNA"===t&&("Branch"===i.monomerType||n===a.fb.DNA&&i.symbol===c.DEOXYRIBOSE||n===a.fb.RNA&&i.symbol===c.RIBOSE||i.symbol===c.PHOSPHATE)||"PEPTIDE"===t&&"Branch"!==i.monomerType){const e={};u.rx.forEach((t=>{e[t]=i[t]})),s.set(i.symbol,e)}}return s}(t,n,r),o=new Map,l=await s.functions.call("Chem:getRdKitModule"),h={value:null};if("RNA"===n){const e=r===a.fb.RNA?[c.RIBOSE,c.PHOSPHATE]:[c.DEOXYRIBOSE,c.PHOSPHATE];for(const t of e)m(o,t,i,l,n,h)}for(let t=0;t<e.length;++t){const s=e[t];for(const e of s)if(""!==e)try{m(o,e,i,l,n,h)}catch(t){const n=t instanceof Error?t.message:t.toString(),s=t instanceof Error?t.stack:void 0;throw console.error(`bio lib: getMonomersDictFromLib() sym='${e}', error:\n${n}\n${s}`),new Error(`Can't get monomer '${e}' from library: ${n}`)}}return o}(g,i,f,p),w=h.length,{molfileList:b,molfileWarningList:A}=await async function(e,t,s,r,i){const o=Math.max(navigator.hardwareConcurrency-2,1),a=new Array(o).fill(null).map((()=>new Worker(new URL(n.p+n.u(286),n.b)))),l=i/o;let c=[],u=[];const h=new Array(o);for(let n=0;n<o;n++){const c=Math.floor(n*l),u=n===o-1?i:Math.floor((n+1)*l);a[n].postMessage({monomerSequencesArray:e,monomersDict:t,alphabet:s,polymerType:r,start:c,end:u}),h[n]=new Promise((e=>{a[n].onmessage=({data:{molfileList:t,molfileWarningList:n}})=>{e({molfileList:t,molfileWarningList:n})}}))}return(await Promise.all(h)).forEach((e=>{c=c.concat(...e.molfileList),u=u.concat(...e.molfileWarningList)})),setTimeout((()=>{a.forEach((e=>{e.terminate()}))}),0),{molfileList:c,molfileWarningList:u}}(g,y,p,f,w);if(A.length>.05*w)throw new Error("Too many errors getting molfiles.");const C=`molfile(${h.name})`,v=e.columns.getUnusedName(C),T=r.Column.fromStrings(v,b);return T.semType=r.SEMTYPE.MOLECULE,T.setTag(r.TAGS.UNITS,r.UNITS.Molecule.MOLBLOCK),{col:T,warnings:A}}function m(e,t,n,s,r,i){if(!e.has(t)){const o=function(e,t,n,s,r){if(t.has(e)){const o=t.get(e),a=function(e){const t=[];for(const n of e){let e=n.capGroupSmiles;e||(e=n.capGroupSMILES),e=e.replace(/(\[|\]|\*|:|\d)/g,""),t.push(e)}return t}(o.rgroups),l=(i=o.molfile).includes("V3000")?function(e){const t=new Map,n=/M V30 (\d+) R#.+RGROUPS=\((\d+) (\d+)\).*/gm;let s;for(;null!==(s=n.exec(e));)s.index===n.lastIndex&&n.lastIndex++,t.set(parseInt(s[1]),parseInt(s[3]));return t}(i):function(e){const t=new Map;let n=e.indexOf(c.V2K_A_LINE,0),s=n;for(;-1!==n;){s=e.indexOf("\n",n);const r=parseInt(e.substring(n,s).replace(/^A\s+/,""));n=e.indexOf("R",s),s=e.indexOf("\n",n);const i=parseInt(e.substring(n,s).replace(/^R/,""));t.set(r,i),n=e.indexOf(c.V2K_A_LINE,s)}for(n=e.indexOf(c.V2K_RGP_LINE,0),s=e.indexOf("\n",n);-1!==n;){n+=c.V2K_RGP_SHIFT,s=e.indexOf("\n",n);const r=e.substring(n,s).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])}n=e.indexOf(c.V2K_RGP_LINE,s)}return t}(i),u=o.molfile.includes("V3000")?o.molfile:function(e,t){const n=t.get_mol(e),s=n.get_v3Kmolblock();return n.delete(),s}(function(e){let t=e.indexOf(c.V2K_A_LINE,0);-1===t&&(t=e.indexOf(c.V2K_RGP_LINE));const n=e.indexOf(c.V3K_END,t);return e.substring(0,t)+e.substring(n)}(o.molfile),n),d=function(e){let t=(e=e.replaceAll("\r","")).indexOf(c.V3K_BEGIN_COUNTS_LINE)+c.V3K_COUNTS_SHIFT,n=e.indexOf(" ",t+1);const s=parseInt(e.substring(t,n));return t=n+1,n=e.indexOf(" ",t+1),{atomCount:s,bondCount:parseInt(e.substring(t,n))}}(u),m=function(e,t){const n=new Array(t),s=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),n[l]=e.substring(o,a);const t=new Array(2);for(let n=0;n<2;++n)o=a+1,a=e.indexOf(" ",o),t[n]=parseFloat(e.substring(o,a));s[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:n,x:s,y:r,kwargs:i}}(u,d.atomCount),g=function(e,t){const n=new Uint32Array(t),s=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 n=0;n<3;++n)o=a+1,a=Math.min(e.indexOf("\n",o),e.indexOf(" ",o)),t[n]=parseInt(e.slice(o,a));n[l]=t[0],s[l]=t.slice(1);const u=e.indexOf("\n",o);let h=e.slice(a,u),d=h.indexOf(c.V3K_BOND_CONFIG);if(-1!==d){d=h.indexOf("=",d)+1;let e=h.indexOf(" ",d);-1===e&&(e=h.length);const t=parseInt(h.slice(d,e));r.set(l,t);const n=c.V3K_BOND_CONFIG+t.toString();h=h.replace(n,"")}h||i.set(l,h)}return{bondTypes:n,atomPairs:s,bondConfiguration:r,kwargs:i}}(u,d.bondCount),w=function(e,t,n,s){const r={backboneShift:null,branchShift:null,terminalNodes:[],rNodes:[]};return function(e,t,n){for(const[s,r]of n)e.atomTypes[s-1]=t[r-1]}(e,n,s),function(e,t){t.rNodes=Array.from(e.keys());for(let n=0;n<t.rNodes.length;n++)for(const s of[1,2])if(e.get(t.rNodes[n])===s){const e=t.rNodes[s-1];t.rNodes[s-1]=t.rNodes[n],t.rNodes[n]=e}}(s,r),p(t,r),r}(m,g,a,l),T=function(e){let t=[],n=e.indexOf("M V30 MDLV30/STEABS ATOMS=(");for(;-1!==n;){n+=28;const s=e.indexOf(")",n);t=t.concat(e.substring(n,s).split(" ").slice(1).map((e=>parseInt(e)))),n=s,n=e.indexOf("M V30 MDLV30/STEABS ATOMS=(",n)}return t}(u),S={atoms:m,bonds:g,meta:w,stereoAtoms:T};return"PEPTIDE"===s?function(e){const t=e.meta.terminalNodes[0]-1,n=e.meta.rNodes[0]-1,s=e.atoms.x,r=e.atoms.y;v(e,-s[t],-r[t]);const i=b(s[n],r[n]);A(e.atoms,-i),s[e.meta.rNodes[1]-1]<0&&function(e){C(e,!1)}(e);const o=function(e){const t=function(e){const t=new Map;for(const n of e.bonds.atomPairs)for(let e=0;e<2;e++){const s=n[e],r=n[(e+1)%2];t.has(s)?t.get(s)?.push(r):t.set(s,new Array(1).fill(r))}return t}(e);let n=0;const s=e.atoms.atomTypes.length;let r=0;for(;0===n;){const i=t.get(e.meta.terminalNodes[1])[r];if(e.atoms.atomTypes[i-1]===c.OXYGEN&&i!==e.meta.rNodes[1]&&(n=i),r++,r>s)throw new Error(`Search for double-bonded Oxygen in ${e} has exceeded the limit of ${s}`)}return n}(e);!function(e,t){e.atoms.y[e.meta.rNodes[1]-1]<0&&e.atoms.y[t-1]<0&&(function(e){C(e,!0)}(e),A(e.atoms,-function(e,t){return b(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 n=e.atoms.x;n[e.meta.rNodes[1]-1]>n[t-1]&&function(e,t,n){const s=t-1,r=n-1,i=e.atoms.x,o=e.atoms.y,a=i[s],l=o[s];i[s]=i[r],o[s]=o[r],i[r]=a,o[r]=l}(e,t,e.meta.rNodes[1])}(e,o)}(S):e===c.RIBOSE||e===c.DEOXYRIBOSE?function(e,t){const n=e.atoms.x,s=e.atoms.y;let r=e.meta.terminalNodes[0]-1;const i=e.meta.rNodes[1]-1;v(e,-n[r],-s[r]);const o=b(n[i],s[i]);A(e.atoms,3*Math.PI/2-o),t.value=function(e){const t=e.atoms.x,n=e.atoms.y,s=e.meta.rNodes[2]-1,r=e.meta.terminalNodes[2]-1,i=t[s]-t[r],o=n[s]-n[r];return Math.atan(o/i)+Math.PI/2}(e),r=e.meta.terminalNodes[0]-1,v(e,-n[r],-s[r])}(S,r):e===c.PHOSPHATE?function(e){const t=e.meta.terminalNodes[0]-1,n=e.meta.rNodes[0]-1,s=e.atoms.x,r=e.atoms.y;v(e,-s[t],-r[t]);const i=b(s[n],r[n]);A(e.atoms,Math.PI/2-i)}(S):function(e,t){const n=e.atoms.x,s=e.atoms.y,r=e.meta.terminalNodes[0]-1,i=e.meta.rNodes[0]-1;v(e,-n[r],-s[r]);const o=b(n[i],s[i]),a=t.value;if(!a)throw new Error("The value of sugarBranchToOYAngle is null");A(e.atoms,Math.PI-o+a);const l=function(e,t){return h(Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2))}({x:n[e.meta.rNodes[0]-1],y:s[e.meta.rNodes[0]-1]},{x:n[e.meta.terminalNodes[0]-1],y:s[e.meta.terminalNodes[0]-1]});if(1!=l)for(let e=0;e<n.length;++e)n[e]=h(n[e]/l),s[e]=h(s[e]/l)}(S,r),function(e,t,n){"PEPTIDE"===e?(f(t,e),y(t,t.meta.rNodes[1])):n===c.RIBOSE||n===c.DEOXYRIBOSE?(y(t,t.meta.rNodes[1]),t.meta.rNodes[1]=t.meta.terminalNodes[1],p(t.bonds,t.meta),f(t,e),y(t,t.meta.rNodes[1]),y(t,t.meta.rNodes[0]),y(t,t.meta.rNodes[2])):n===c.PHOSPHATE&&(t.meta.terminalNodes[0]=t.meta.rNodes[0],v(t,-t.atoms.x[t.meta.terminalNodes[0]-1],-t.atoms.y[t.meta.terminalNodes[0]-1]),f(t,e),y(t,t.meta.rNodes[1]))}(s,S,e),function(e){let t=0;for(;t<e.atoms.atomTypes.length;)e.atoms.atomTypes[t]===c.HYDROGEN&&(y(e,t+1),--t),++t}(S),S}var i;return null}(t,n,s,r,i);if(!o)throw new Error(`Monomer with symbol '${t}' is absent the monomer library`);e.set(t,o)}}function p(e,t){const n=t.rNodes;t.terminalNodes=new Array(n.length).fill(0);const s=t.terminalNodes,r=e.atomPairs;let i=0,o=0;for(;i<r.length&&o<s.length;){for(let e=0;e<s.length;++e)for(let t=0;t<2;++t)r[i][t]===n[e]&&(s[e]=r[i][(t+1)%2],n.length,++o);++i}}function f(e,t){e.meta.rNodes.length>1&&(e.meta.backboneShift=g(e,e.meta.rNodes[1]-1,e.meta.terminalNodes[0]-1)),"RNA"===t&&e.meta.rNodes.length>2&&(e.meta.branchShift=g(e,e.meta.rNodes[2]-1,e.meta.terminalNodes[0]-1))}function g(e,t,n){return[h(e.atoms.x[t]-e.atoms.x[n]),h(e.atoms.y[t]-e.atoms.y[n])]}function y(e,t){if(void 0!==t){const n=t-1,s=e.atoms,r=e.bonds,i=e.meta;s.atomTypes.splice(n,1),s.x=w(Float32Array,s.x,n,1),s.y=w(Float32Array,s.y,n,1),s.kwargs.splice(n,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],n=r.atomPairs[o][1];e===t||n===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]=n>t?n-1:n),++o}let a=Array.from(r.bondConfiguration.keys());a.forEach((e=>{if(r.bondConfiguration.has(e)&&e>n){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>n){const t=r.kwargs.get(e);r.kwargs.delete(e),r.kwargs.set(e-1,t)}}))}}function w(e,t,n,s){const r=new e(t.length-s);let i=0,o=0;for(;i<t.length;)i===n&&(i+=s),r[o]=t[i],++o,++i;return r}function b(e,t){let n;if(0===e)n=t>0?0:Math.PI;else if(0===t)n=e>0?-Math.PI/2:Math.PI/2;else{const s=t/e,r=Math.atan(s);n=e<0?Math.PI/2+r:-Math.PI/2+r}return n}function A(e,t){if(0!==t){const n=e.x,s=e.y,r=Math.cos(t),i=Math.sin(t);for(let e=0;e<n.length;++e){const t=n[e];n[e]=h(t*r-s[e]*i),s[e]=h(t*i+s[e]*r)}}}function C(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 n=e.bonds.bondConfiguration;for(const[e,t]of n){const s=1===t?3:1;n.set(e,s)}}function v(e,t,n){const s=e.atoms.x,r=e.atoms.y;for(let e=0;e<s.length;++e)s[e]=h(s[e]+t),void 0!==n&&(r[e]=h(r[e]+n))}},6137:(e,t,n)=>{"use strict";n.d(t,{J:()=>r,V:()=>i});var s=n(9976);class r extends s.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,n)=>{"use strict";n.d(t,{B:()=>s});class s{static makePalette(e,t=!1,n=s){const r={};return e.forEach((e=>{const n=e[0],s=e[1];n.forEach(((e,n)=>{r[e]=this.colourPalette[s][t?0:n]}))})),new n(r)}constructor(e){this._palette=e}get(e){return this._palette[e]}}s.undefinedColor="rgb(100,100,100)",s.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,n)=>{"use strict";n.d(t,{UE:()=>c,kQ:()=>o});var s=n(976),r=n(9976);class i{static hashCode(e){let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),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=s.Color.fromHtml(e),n=s.Color.g(t),r=s.Color.r(t),i=s.Color.b(t),o=Math.sqrt(Math.pow(0-r,2)+Math.pow(0-n,2)+Math.pow(0-i,2));return o>210?`rgb(${r/o*210},${n/o*210},${i/o*210})`:s.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}}},9713:(e,t,n)=>{"use strict";n.d(t,{N:()=>o,b:()=>a});var s=n(4469),r=n(701),i=n(2997);function o(e){let t=null,n=null;try{n=e.dart?e.gridColumn:null,t=n?n.temp:null}catch{[n,t]=[null,null]}const s=e.cell.column;if(t=t??s.temp,!t)throw new Error("Grid cell renderer back store (GridColumn or Column) not found.");return[n,s,t]}class a{constructor(e,t,n){this.gridCol=e,this.tableCol=t,this.logger=n,this.subs=[],this.destroyed=!1,this.viewerId=++a.viewerCounter,this.errors=[],this._onRendered=new r.Subject,this.reset(),this.tableCol&&this.tableCol.dataFrame&&this.subs.push(this.tableCol.dataFrame.onDataChanged.subscribe((()=>{try{this.reset()}catch(e){this.logger.error(e)}}))),this.tableCol&&this.subs.push(s.events.onTableRemoved.subscribe((e=>{try{const t=e.args.dataFrame;this.tableCol?.dataFrame.id!==t.id||this.destroyed||this.destroy()}catch(e){this.logger.error(e)}}))),this.gridCol&&this.subs.push(s.events.onViewRemoving.subscribe((e=>{try{const t=e.args.view;this.gridCol?.dart&&this.gridCol.grid&&this.gridCol?.grid?.dart&&this.gridCol?.grid?.view?.id===t.id&&!this.destroyed&&this.destroy()}catch(e){this.logger.error(e)}})))}toLog(){return`${this.constructor.name}<${this.viewerId}>`}destroy(){for(const e of this.subs)e.unsubscribe();this.destroyed=!0}invalidateGrid(){this.gridCol&&this.gridCol.dart&&this.gridCol.grid?.invalidate()}get onRendered(){return this._onRendered}invalidate(e){this.invalidateGrid()}async awaitRendered(e=1e4,t=`${e} timeout`){const n=`${this.toLog()}.awaitRendered()`;if(this.logger.debug(`${n}, start, testEvent before`),await(0,i.zg)(this._onRendered,(()=>{}),(()=>{this.invalidate()}),e,`${n}, ${t}`),this.errors.length>0){const e=this.errors[0];throw this.errors=[],e}this.logger.debug(`${n}, end`)}}a.viewerCounter=-1},9611:(e,t,n)=>{"use strict";n.d(t,{A:()=>u,m:()=>c});var s=n(976),r=n(6414),i=n.n(r),o=n(8607),a=n(9713),l=n(7228);function c(e,t){let n,s=100,r=0,i=e.length-1;for(;r<=i;){if(n=Math.floor((i+r)/2),e[n]<=t&&t<e[n+1])return n;if(t<e[n]?i=n-1:r=n+1,--s<=0)throw new Error(`Get position for pointer x = ${t} searching has not converged on ${JSON.stringify(e)}. `)}return null}class u extends a.b{get updated(){return this._updated}constructor(e,t,n,r){super(e,t,n),this.propsProvider=r,this.colWidth=0,this._monomerLengthList=null,this.separatorWidth=5,this._processedMaxVisibleSeqLength=0,this._updated=!1,this._monomerLengthMap={},this._monomerStructureMap={},this.props=this.propsProvider(),this._processedRows=s.BitSet.create(this.tableCol.length),this.gridCol&&this.subs.push(this.gridCol.grid.onAfterDrawContent.subscribe((()=>{this._onRendered.next()}))),(0,l.JN)().then((e=>{if(this.destroyed)return;const t=e.getBioLib();this.subs.push(t.onChanged.subscribe((()=>{this.reset(),this.gridCol?.grid?.invalidate()})))}))}reset(){this.propsProvider&&(this.props=this.propsProvider()),this._processedRows=s.BitSet.create(this.tableCol.length),this._monomerLengthList=null,this._monomerLengthMap={},this._monomerStructureMap={}}getCellMonomerLengths(e,t){this.colWidth<t&&(this.colWidth=t,this.reset());const n=this.props.seqHandler.isMsa()?this.getCellMonomerLengthsForSeqMsa():this.getCellMonomerLengthsForSeq(e),s=new Array(n.length+1);s[0]=5;for(let e=1;e<s.length;e++)s[e]=s[e-1]+n[e-1];return[n,s]}getCellMonomerLengthsForSeq(e){null===this._monomerLengthList&&(this._monomerLengthList=new Array(this.tableCol.length).fill(null),this._updated=!0);const t=this.props.separatorWidth+1*this.props.monomerCharWidth,n=Math.ceil(this.colWidth/t),s=o.g.forColumn(this.tableCol).getSplitted(e).originals,r=Math.min(n,s.length);let i=this._monomerLengthList[e];if(null===i||i.length<r){i=this._monomerLengthList[e]=new Array(s.length);let t=0;for(let e=0;e<r;++e){const n=s[e],r=this.props.monomerToShort(n,this.props.monomerLengthLimit),o=(this.props.seqHandler.isSeparator()?this.separatorWidth:this.props.separatorWidth)+r.length*this.props.monomerCharWidth;if(i[e]=o,t+=o,t>this.colWidth)break}this._updated=!0}return i}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:n,endIdx:s}=(()=>{try{const e=this.gridCol&&this.gridCol.dart?this.gridCol.grid:null;return e&&e.dart?{startIdx:Math.max(Math.floor((e?.vertScroll.min??0)-10),0),endIdx:Math.min(Math.ceil((e?.vertScroll.max??0)+10),this.tableCol.length)}:{startIdx:0,endIdx:Math.min(this.tableCol.length,10)}}catch(e){return{startIdx:0,endIdx:Math.min(this.tableCol.length,10)}}})(),r=this.props.separatorWidth+1*this.props.monomerCharWidth,i=Math.ceil(this.colWidth/r);for(let e=n;e<s;e++){if(this._processedRows.get(e)&&i<=this._processedMaxVisibleSeqLength)continue;const n=o.g.forColumn(this.tableCol).getSplitted(e,i).originals,s=Math.min(i,n.length);s>t.length&&t.push(...new Array(s-t.length).fill(r));let a=0;for(let e=0;e<s;++e){const s=n[e],r=this.props.monomerToShort(s,this.props.monomerLengthLimit),i=this.props.separatorWidth+r.length*this.props.monomerCharWidth;if(t[e]=Math.max(t[e]??0,i),a+=i,a>=this.colWidth)break}this._updated=!0,this._processedMaxVisibleSeqLength=Math.max(this._processedMaxVisibleSeqLength,i)}return t}getPosition(e,t,n){const[s,r]=this.getCellMonomerLengths(e,n),a=o.g.forColumn(this.tableCol);return 0===i()(a.getSplitted(e).originals).toArray().length?null:c(r,t)}setMonomerLengthLimit(e){this.props.monomerLengthLimit=e,this._updated=!0}setSeparatorWidth(e){this.props.separatorWidth=e,this._updated=!0}isMsa(){return this.props.seqHandler.isMsa()}}},1047:(e,t,n)=>{"use strict";n.d(t,{$3:()=>r,pU:()=>i,rx:()=>s});const s=["symbol","molfile","rgroups","name"],r="p",i=new RegExp(`[rd]\\((\\w)\\)${r}?`,"g")},7945:(e,t,n)=>{"use strict";function s(e){return"string"==typeof e||e instanceof String?e:"StateError"===e.constructor.name?e.message:"StateError"===e.constructor.name&&"$thrownJsError"in e?s(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[s(e),r(e)]}n.d(t,{yf:()=>i})},5226:(e,t,n)=>{"use strict";n.d(t,{i:()=>o});var s=n(976),r=n(8607),i=n(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,n=0;for(;t=e.exec(this._fileContent);){const s=this._fileContent.substring(t.index+1,e.lastIndex);this._descriptionsArray.push(s),0!==n&&this._sequencesArray.push(this.parseMacromolecule(n,t.index)),n=e.lastIndex+1}this._sequencesArray.push(this.parseMacromolecule(n,-1))}importFasta(){const e=s.Column.fromStrings("description",this.descriptionsArray),t=s.Column.fromStrings("sequence",this.sequencesArray);return t.semType=s.SEMTYPE.MACROMOLECULE,t.setTag(s.TAGS.UNITS,i.r2.FASTA),r.g.forColumn(t),[s.DataFrame.fromColumns([e,t])]}constructor(e){this._descriptionsArray=[],this._sequencesArray=[],this._fileContent=e,this.parseColumns()}}},706:(e,t,n)=>{"use strict";n.d(t,{Ug:()=>i,io:()=>o});var s=n(976),r=n(8447);function i(){const e=[];return e.push(s.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"))),e.push(s.Column.fromList(s.COLUMN_TYPE.FLOAT,"Activity",new Array(10**6).fill(5.30751))),e}function o(e=10**5){const t="meI/hHis/Aca/N//dE/Thr_PO3H2/Aca/D-Tyr_Et/Tyr_ab-dehydroMe".repeat(Math.ceil(e/10)).slice(0,-1),n=s.Column.fromList(s.COLUMN_TYPE.STRING,"MSA",new Array(100).fill(t));n.semType=s.SEMTYPE.MACROMOLECULE,n.setTag(s.TAGS.UNITS,r.r2.SEPARATOR),n.setTag(r.DX.separator,"/"),n.setTag(r.DX.alphabet,r.fb.UN),n.setTag(r.DX.alphabetIsMultichar,"true");const i=[];return i.push(n),i.push(s.Column.fromList(s.COLUMN_TYPE.FLOAT,"Activity",new Array(100).fill(7.30751))),i}n(6414),n(8607),n(8260)},1821:(e,t,n)=>{"use strict";n.d(t,{BM:()=>l,CI:()=>a,DX:()=>i,XS:()=>u,fb:()=>r,r2:()=>s,se:()=>c});var s,r,i,o=n(6286);!function(e){e.FASTA="fasta",e.SEPARATOR="separator",e.HELM="helm"}(s||(s={})),function(e){e.DNA="DNA",e.RNA="RNA",e.PT="PT",e.UN="UN"}(r||(r={})),function(e){e.aligned="aligned",e.alphabet="alphabet",e.alphabetSize=".alphabetSize",e.alphabetIsMultichar=".alphabetIsMultichar",e.separator="separator",e.isHelmCompatible=".isHelmCompatible",e.positionNames=".positionNames",e.positionLabels=".positionLabels",e.regions=".regions"}(i||(i={}));const a=", ",l=/(?:\[([A-Za-z0-9_\-,()]+)\])|([A-Za-z\-])/g,c=new class{constructor(){this.fasta={peptide:new Set(["G","L","Y","S","E","Q","D","N","F","A","K","R","H","C","V","P","W","I","M","T"]),dna:new Set(["A","C","G","T"]),rna:new Set(["A","C","G","U"])}}},u=[new o.LA(r.PT,c.fasta.peptide,.5),new o.LA(r.DNA,c.fasta.dna,.55),new o.LA(r.RNA,c.fasta.rna,.55)]},8447:(e,t,n)=>{"use strict";n.d(t,{Ar:()=>r.Ar,CI:()=>s.CI,DX:()=>s.DX,GU:()=>r.GU,KX:()=>r.KX,XS:()=>s.XS,dQ:()=>r.dQ,fb:()=>s.fb,gM:()=>r.gM,gP:()=>r.gP,kB:()=>r.kB,py:()=>r.py,r2:()=>s.r2,up:()=>r.up});var s=n(1821),r=n(8260)},6286:(e,t,n)=>{"use strict";n.d(t,{G2:()=>s,LA:()=>r,dJ:()=>i});const s="";class r{constructor(e,t,n){this.name=e,this.alphabet=t,this.cutoff=n}}class i extends r{constructor(e,t,n){super(e.name,e.alphabet,e.cutoff),this.freq=t,this.similarity=n}}},8260:(e,t,n)=>{"use strict";n.d(t,{wx:()=>p,w4:()=>P,gM:()=>_,KX:()=>x,py:()=>$,vU:()=>T,Ar:()=>b,jY:()=>g,GU:()=>E,dQ:()=>N,up:()=>M,kB:()=>y,FJ:()=>w,gP:()=>v});var s=n(976),r=n(6414),i=n.n(r),o=n(6286),a=n(1821),l=n(8607);class c extends Float32Array{}var u=n(850),h=n(2012),d=n(6137),m=n(7331);class p{get length(){return this.mList.length}get canonicals(){return this.mList}get originals(){return this.mList}isGap(e){return this.getOriginal(e)===this.gapOriginalMonomer}getCanonical(e){if(this.length<=e)throw new Error("Index out of bounds");return this.mList[e]}getOriginal(e){if(this.length<=e)throw new Error("Index out of bounds");return this.mList[e]}constructor(e,t){this.mList=e,this.gapOriginalMonomer=t}}class f{get length(){return this.seqS.length}get canonicals(){return this.seqS}get originals(){return this.seqS}isGap(e){return this.getOriginal(e)===l.lh[a.r2.FASTA]}getCanonical(e){if(this.length<=e)throw new Error("Index out of bounds");return this.isGap(e)?o.G2:this.seqS[e]}getOriginal(e){if(this.length<=e)throw new Error("Index out of bounds");return this.seqS[e]}constructor(e){this.seqS=e}}function g(e,t,n){const s=e.categories;return function(e,t){const n={};let s=!0,r=null;for(const i of e)if(null==r?r=i.length:i.length!==r&&(s=!1),i.length>=t)for(const e of i.canonicals)e in n||(n[e]=0),n[e]+=1;return{freq:n,sameLength:s}}(i().enumerate(e.getRawData()).map((([e,t])=>n(s[e]))),t)}const y=e=>{const t=i()(e.toString().matchAll(a.BM)).map((e=>e[2]??e[1])).toArray();return new p(t,l.lh[a.r2.FASTA])},w=e=>e?new f(e):new p([],l.lh[a.r2.FASTA]);function b(e,t=undefined){return n=>{if(n){let s;const r=new RegExp(String.raw`"-"|'-'|[^${e}]+`,"g");if(void 0!==t){r.lastIndex=0,s=new Array(Math.ceil(t));let e=null,i=0;for(;null!==(e=r.exec(n))&&i<t;)s[i++]=e[0].replace('"-"',"").replace("'-'","");s.splice(i)}else s=n.replaceAll('"-"',"").replaceAll("'-'","").split(e,t);return new p(s,l.lh[a.r2.SEPARATOR])}return new p([],l.lh[a.r2.SEPARATOR])}}const A=/(PEPTIDE1|DNA1|RNA1)\{([^}]+)}/g,C=/\[([^\[\]]+)]/g,v=e=>{A.lastIndex=0;const t=A.exec(e.toString()),n=t?t[2]:null,s=n?n.split("."):[];return new p(s.map((e=>{C.lastIndex=0;const t=C.exec(e);return t&&t.length>=2?t[1]:e})),l.lh[a.r2.HELM])};function T(e,t,n=undefined){if(e.toLowerCase().startsWith(a.r2.FASTA))return y;if(e.toLowerCase().startsWith(a.r2.SEPARATOR))return b(t,n);if(e.toLowerCase().startsWith(a.r2.HELM))return v;throw new Error(`Unexpected units ${e} .`)}const S=/([^\W_]+)/g;function E(e,t){if(e.length<=t)return e;const n=e.match(S),s=e.length>t||(n?.length??0)>1,r=n?.[0]??" ";return s?r.substring(0,t-1)+"…":r}function _(e){switch(e){case a.fb.DNA:return a.se.fasta.dna;case a.fb.RNA:return a.se.fasta.rna;case a.fb.PT:return a.se.fasta.peptide;default:throw new Error(`Unsupported alphabet '${e}'.`)}}function x(e,t,n="-"){const s=new Set([...new Set(Object.keys(e)),...t]);s.delete(n);const r=[],i=[];for(const n of s)r.push(n in e?e[n]:0),i.push(t.has(n)?1:0);const o=new c(r),a=new c(i);return(0,u.MA)(o,a)/((0,u.$G)(o)*(0,u.$G)(a))}function P(e,t,n="-"){const s=t.map((t=>{const s=x(e,t.alphabet,n);return new o.dJ(t,e,s)}));let r;const i=Math.max(...s.map((e=>e.similarity>e.cutoff?e.similarity:-1)));return r=i>0?s.find((e=>e.similarity===i)).name:a.fb.UN,r}function N(e,t=5){let n;return n=e.semType==s.SEMTYPE.MACROMOLECULE?l.g.forColumn(e).alphabet:P(g(e,t,y).freq,a.XS),$(n)}function $(e){switch(e){case a.fb.PT:return h.f.GrokGroups;case a.fb.DNA:case a.fb.RNA:return d.J.Chromatogram;default:return m.UE.Color}}function M(e){const t=e.columns.bySemTypeAll(s.SEMTYPE.MACROMOLECULE);let n=t.find((e=>{const t=e.getTag(s.TAGS.UNITS);return!!t&&-1!==t.indexOf("MSA")}))??null;return!n&&t.length>0&&(n=t[0]),n}},8607:(e,t,n)=>{"use strict";n.d(t,{g:()=>p,lh:()=>m});var s=n(976),r=n(6414),i=n.n(r),o=n(8447),a=n(6286),l=n(8260),c=n(708),u=n(7228),h=n(1047);const d=new class{constructor(){this.seqHandler="seq-handler",this.notationProvider="seq-handler.notation-provider"}},m={[o.r2.FASTA]:"-",[o.r2.SEPARATOR]:"",[o.r2.HELM]:"*"};class p{constructor(e){if(this._splitter=null,this.cached=!0,this._splitted=null,this.columnVersion=null,this._stats=null,this._maxLength=null,this._posList=null,this._joiner=void 0,e.type!==s.TYPE.STRING)throw new Error(`Unexpected column type '${e.type}', must be '${s.TYPE.STRING}'.`);this._column=e;const t=this._column.getTag(s.TAGS.UNITS);if(null==t)throw new Error("Units are not specified in column");if(this._units=t,this._notation=this.getNotation(),this._defaultGapOriginal=this.isFasta()?m[o.r2.FASTA]:this.isHelm()?m[o.r2.HELM]:m[o.r2.SEPARATOR],!this.column.tags.has(o.DX.aligned)||!this.column.tags.has(o.DX.alphabet)||!this.column.tags.has(o.DX.alphabetIsMultichar)&&!this.isHelm()&&this.alphabet===o.fb.UN)if(this.isFasta())p.setUnitsToFastaColumn(this);else if(this.isSeparator()){const t=e.getTag(o.DX.separator);p.setUnitsToSeparatorColumn(this,t)}else{if(!this.isHelm())throw new Error(`Unexpected units '${this.column.getTag(s.TAGS.UNITS)}'.`);p.setUnitsToHelmColumn(this)}if(!this.column.tags.has(o.DX.alphabetIsMultichar))if(this.isHelm())this.column.setTag(o.DX.alphabetIsMultichar,"true");else if(["UN"].includes(this.alphabet))throw new Error(`For column '${this.column.name}' of alphabet '${this.alphabet}' tag '${o.DX.alphabetIsMultichar}' is mandatory.`);this.notationProvider=this.column.temp[d.notationProvider]??null,this.columnVersion=this.column.version}static setUnitsToFastaColumn(e){if(e.column.semType!==s.SEMTYPE.MACROMOLECULE||e.column.getTag(s.TAGS.UNITS)!==o.r2.FASTA)throw new Error(`The column of notation '${o.r2.FASTA}' must be '${s.SEMTYPE.MACROMOLECULE}'.`);e.column.setTag(s.TAGS.UNITS,o.r2.FASTA),p.setTags(e)}static setUnitsToSeparatorColumn(e,t){if(e.column.semType!==s.SEMTYPE.MACROMOLECULE||e.column.getTag(s.TAGS.UNITS)!==o.r2.SEPARATOR)throw new Error(`The column of notation '${o.r2.SEPARATOR}' must be '${s.SEMTYPE.MACROMOLECULE}'.`);if(!t)throw new Error(`The column of notation '${o.r2.SEPARATOR}' must have the separator tag.`);e.column.setTag(s.TAGS.UNITS,o.r2.SEPARATOR),e.column.setTag(o.DX.separator,t),p.setTags(e)}static setUnitsToHelmColumn(e){if(e.column.semType!==s.SEMTYPE.MACROMOLECULE)throw new Error(`The column of notation '${o.r2.HELM}' must be '${s.SEMTYPE.MACROMOLECULE}'`);e.column.setTag(s.TAGS.UNITS,o.r2.HELM),p.setTags(e)}static setTags(e){const t=e.column.getTag(s.TAGS.UNITS);if([o.r2.FASTA,o.r2.SEPARATOR].includes(t)){if(!e.column.getTag(o.DX.alphabet)&&0===Object.keys(e.stats.freq).length)throw new Error("Alphabet is empty and not annotated.");let t=e.column.getTag(o.DX.aligned);null===t&&(t=e.stats.sameLength?"SEQ.MSA":"SEQ",e.column.setTag(o.DX.aligned,t));let n=e.column.getTag(o.DX.alphabet);if(null===n&&(n=(0,l.w4)(e.stats.freq,o.XS),e.column.setTag(o.DX.alphabet,n)),n===o.fb.UN){const t=Object.keys(e.stats.freq).length,n=Object.keys(e.stats.freq).some((e=>e.length>1));e.column.setTag(o.DX.alphabetSize,t.toString()),e.column.setTag(o.DX.alphabetIsMultichar,n?"true":"false")}}}get column(){return this._column}get length(){return this._column.length}get units(){return this._units}get notation(){return this._notation}get defaultGapOriginal(){return this._defaultGapOriginal}get separator(){const e=this.column.getTag(o.DX.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(o.DX.aligned);if(!e&&(this.isFasta()||this.isSeparator()))throw new Error("Tag aligned not set");return e}get alphabet(){const e=this.column.getTag(o.DX.alphabet);if(!e&&(this.isFasta()||this.isSeparator()))throw new Error("Tag alphabet not set");return e}get helmCompatible(){return this.column.getTag(o.DX.isHelmCompatible)}getAlphabetSize(){if(this.notation==o.r2.HELM||this.alphabet==o.fb.UN){const e=this.column.getTag(o.DX.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 o.fb.PT:return 20;case o.fb.DNA:case o.fb.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||this.alphabet===o.fb.UN&&"true"===this.column.getTag(o.DX.alphabetIsMultichar)}getSplitted(e,t){if(this.cached&&void 0===t){this.column.version===this.columnVersion&&null!==this._splitted||(this.columnVersion=this.column.version,this._splitted=new Array(this.column.length));let t=this._splitted[e]?this._splitted[e].deref():void 0;if(!t){const n=this.column.get(e);t=this.splitter(n),this._splitted[e]=new WeakRef(t)}return t}{const n=this.column.get(e);return this.getSplitter(t)(n)}}get stats(){if(null===this._stats){const e={};let t=!0,n=null;const s=this.column.length;for(let r=0;r<s;++r){const s=this.getSplitted(r);null==n?n=s.length:s.length!==n&&(t=!1);for(const t of s.canonicals)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.column.length?0:Math.max(...i().count(0).take(this.column.length).map((e=>this.getSplitted(e).length)))),this._maxLength}get posList(){if(null===this._posList){const e=this.column.getTag(o.DX.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 this.alphabet===o.fb.RNA}isDna(){return this.alphabet===o.fb.DNA}isPeptide(){return this.alphabet===o.fb.PT}isMsa(){return!!this.aligned&&this.aligned.toUpperCase().includes("MSA")}isHelmCompatible(){return"true"===this.helmCompatible}isGap(e){return!e||e===this._defaultGapOriginal}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,n,r){const i=this.column,a=e.toLowerCase()+"("+i.name+")",l=n??i.dataFrame.columns.getUnusedName(a),c=s.Column.fromList("string",l,r??new Array(this.column.length).fill(""));if(c.semType=s.SEMTYPE.MACROMOLECULE,c.setTag(s.TAGS.UNITS,e),e===o.r2.SEPARATOR){if(!t)throw new Error(`Notation '${o.r2.SEPARATOR}' requires separator value.`);c.setTag(o.DX.separator,t)}c.setTag(s.TAGS.CELL_RENDERER,e===o.r2.HELM?"helm":"sequence");const u=i.getTag(o.DX.aligned);u&&c.setTag(o.DX.aligned,u);let h=i.getTag(o.DX.alphabet);h||this.notation!==o.r2.HELM||e===o.r2.HELM||(h=o.fb.UN),null!=h&&c.setTag(o.DX.alphabet,h);let d=i.getTag(o.DX.alphabetSize);null!=h&&d&&c.setTag(o.DX.alphabetSize,d);const m=i.getTag(o.DX.alphabetIsMultichar);return null!=h&&void 0!==m&&c.setTag(o.DX.alphabetIsMultichar,m),e==o.r2.HELM&&(d=this.getAlphabetSize().toString(),c.setTag(o.DX.alphabetSize,d)),c}getNewColumnFromList(e,t){return this.getNewColumn(this.notation,this.separator,e,t)}static getNewColumn(e){const t=p.forColumn(e),n=t.notation;return t.getNewColumn(n)}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,n){if(!p.unitsStringIsValid(n))throw new Error("Invalid format of 'units' parameter");const r=s.Column.fromList("string",t,new Array(e).fill(""));return r.semType=s.SEMTYPE.MACROMOLECULE,r.setTag(s.TAGS.UNITS,n),r}getSplitter(e){let t=null;if(t=this.notationProvider?this.notationProvider.splitter:null,t)return t;if(this.units.toLowerCase().startsWith(o.r2.FASTA))return null===this.column.getTag(o.DX.alphabet)||this.getAlphabetIsMultichar()?o.kB:l.FJ;if(this.units.toLowerCase().startsWith(o.r2.SEPARATOR))return(0,o.Ar)(this.separator,e);if(this.units.toLowerCase().startsWith(o.r2.HELM))return o.gP;throw new Error(`Unexpected units ${this.units} .`)}split(e){return this.splitter(e)}getDistanceFunctionName(){if(!this.isFasta())throw new Error("Only FASTA notation is supported");if(this.isMsa())return c.U.HAMMING;switch(this.alphabet){case o.fb.DNA:case o.fb.RNA:case o.fb.PT:}return c.U.LEVENSHTEIN}getDistanceFunction(){return c.o[this.getDistanceFunctionName()]()}async checkHelmCompatibility(){if(this.column.tags.has(o.DX.isHelmCompatible))return"true"===this.column.getTag(o.DX.isHelmCompatible);const e=(await(0,u.JN)()).getBioLib().getMonomerSymbolsByType("PEPTIDE"),t=new Set(e),n=((0,o.Ar)(this.separator),new Set),s=this.column.length,r=this.column.getRawData();for(let e=0;e<s;++e){const s=r[e];if(!(s in n)){n.add(s);const r=this.getSplitted(e);for(const e of r.canonicals)if(!t.has(e))return this.column.setTag(o.DX.isHelmCompatible,"false"),!1}}return this.column.setTag(o.DX.isHelmCompatible,"true"),!0}get splitter(){return null===this._splitter&&(this._splitter=this.getSplitter()),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,n,s){s||(s=this.toFasta(t)?m[o.r2.FASTA]:m[o.r2.SEPARATOR]),n||(n=this.toFasta(t)?"":this.separator);const r=e.startsWith("RNA"),i=this.splitter(e),a=[];for(let e=0;e<i.length;++e){let n=i.getOriginal(e);if(r&&(n=n.replace(h.pU,"")),n===m[o.r2.HELM])a.push(s);else if(this.toFasta(t)&&n.length>1){const e="["+n+"]";a.push(e)}else a.push(n)}return a.join(n)}convert(e,t){const n=this.getJoiner({notation:e,separator:t}),s=this.getNewColumn(e,t);return s.init((e=>{const t=this.getSplitted(e);return n(t)})),s}getRegion(e,t,n){const s=this.getNewColumn(this.notation,this.separator);s.name=n;const r=e??0,i=t??this.maxLength-1,a=this.getJoiner(),c=i-r+1,u=m[this.notation];s.init((e=>{const t=this.getSplitted(e),n=new Array(c);for(let e=0;e<c;++e){const s=r+e;n[e]=s<t.length?t.getOriginal(s):u}return a(new l.wx(n,u))}));const h=e=>{const t=e.split(",").map((e=>e.trim())),n=new Array(c);for(let e=0;e<c;++e){const s=r+e;n[e]=s<t.length?t[s]:"?"}return n.join(o.CI)},d=this.column.getTag(o.DX.positionNames);d&&s.setTag(o.DX.positionNames,h(d));const p=this.column.getTag(o.DX.positionLabels);return p&&s.setTag(o.DX.positionLabels,h(p)),s}get joiner(){return this._joiner||(this._joiner=this.getJoiner()),this._joiner}getJoiner(e){const t=e?e.notation:this.notation,n=e?e.separator:this.separator;let s;const r=this;switch(t){case o.r2.FASTA:s=function(e){return r.joinToFasta(e,r.isHelm())};break;case o.r2.SEPARATOR:if(!n)throw new Error(`Separator is mandatory for notation '${t}'.`);s=function(e){return f(e,n,r.isHelm())};break;case o.r2.HELM:{const e=r.alphabet===o.fb.DNA||r.alphabet===o.fb.RNA,t=r.getHelmWrappers();s=function(n){return g(n,t,e)};break}default:throw new Error(`Unexpected notation '${t}'.`)}return s}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 n=this;if(e===o.r2.FASTA)return function(e){return n.convertToFasta(e)};if(e===o.r2.HELM)return function(e){return n.convertToHelm(e)};if(e===o.r2.SEPARATOR)return function(e){return n.convertToSeparator(e,t)};throw new Error}static forColumn(e){let t=e.temp[d.seqHandler];return t&&t.columnVersion===e.version||(t=e.temp[d.seqHandler]=new p(e)),t}joinToFasta(e,t){const n=new Array(e.length);for(let s=0;s<e.length;++s){const r=e.getOriginal(s);let i=e.getOriginal(s);t&&(i=i.replace(h.pU,"$1")),r===a.G2?i=m[o.r2.FASTA]:r===h.$3?i="":i.length>1&&(i="["+i+"]"),n[s]=i}return n.join("")}convertToFasta(e){const t=this.splitter,n=this.isHelm()?this.splitterAsHelmNucl(e):t(e);return this.joinToFasta(n,this.isHelm())}convertToSeparator(e,t){return f(this.isHelm()?this.splitterAsHelmNucl(e):this.splitter(e),t,this.isHelm())}convertToHelm(e){const t=this.getHelmWrappers(),n=e.startsWith("DNA")||e.startsWith("RNA");return g(this.splitter(e),t,n)}splitterAsHelmNucl(e){const t=this.splitter(e),n=new Array(t.length),s=e.startsWith("DNA"),r=e.startsWith("RNA");for(let e=0;e<t.length;++e){let i=t.getOriginal(e);(s||r)&&(i=i.replace(h.pU,"$1"),i=i===h.$3?null:i),n[e]=i||null}return new l.wx(n.filter((e=>!!e)),m[o.r2.HELM])}}function f(e,t,n){const s=new Array(e.length);for(let t=0;t<e.length;++t){const r=e.getCanonical(t);let i=e.getOriginal(t);n&&(i=i.replace(h.pU,"$1")),r===a.G2?i=m[o.r2.SEPARATOR]:r===h.$3&&(i=""),s[t]=i}return s.join(t)}function g(e,t,n){const[s,r,i,l]=t,c=new Array(e.length);for(let t=0;t<e.length;++t){const s=e.getCanonical(t);let l=e.getOriginal(t);s===a.G2?l=m[o.r2.HELM]:(n&&(l=l.replace(h.pU,"$1")),l=1===l.length?`${r}${l}${i}`:`${r}[${l}]${i}`),c[t]=l}return`${s}${c.join(".")}${l}`}},8457:(e,t,n)=>{"use strict";n.d(t,{O:()=>i});var s=n(976),r=n(8607);function i(e){const t=e=>{const t=o.columns.addNewString((e+1).toString());return n.push(t),t},n=[],i=e.length,o=s.DataFrame.create(i),a=r.g.forColumn(e);for(let e=0;e<i;++e){const s=a.getSplitted(e);for(let r=0;r<s.length;++r){const i=s.getOriginal(r);((n[r]??null)||t(r)).set(e,i,!1)}}return o}},172:(e,t,n)=>{"use strict";n.d(t,{c:()=>i});var s,r=n(7945);!function(e){e[e.error=0]="error",e[e.warning=1]="warning",e[e.info=2]="info",e[e.debug=3]="debug"}(s||(s={}));class i{constructor(e){this.logger=e,this.promise=Promise.resolve(),this.errors=[],this.syncCounter=0}sync(e,t){const n=++this.syncCounter;this.logger.debug(`${e}, SYNC syncId = ${n}, IN `),this.promise=this.promise.then((async()=>{this.logger.debug(`${e}, SYNC syncId = ${n}, START `),await t(),this.logger.debug(`${e}, SYNC syncId = ${n}, END `)})).catch((t=>{const[s,i]=(0,r.yf)(t);this.logger.error(`${e}, SYNC syncId = ${n}, ERROR:\n${s}`,void 0,i),this.errors.push(t)}))}resetErrors(){const e=this.errors;return this.errors=[],e}}},9298:(e,t,n)=>{"use strict";n.d(t,{Ct:()=>l,DX:()=>s,ES:()=>r,dE:()=>a,iD:()=>o,vS:()=>u,vw:()=>i});var s,r,i,o,a,l,c=n(976);!function(e){e.tooltipWebLogo=".tooltipWebLogo"}(s||(s={})),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 u=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}}},7905:(e,t,n)=>{"use strict";e=n.hmd(e);var s,r=(s="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e={}){var t,n,r=void 0!==e?e:{};r.ready=new Promise((function(e,s){t=e,n=s}));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),s&&(c=s),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 u,h,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&&(u=r.wasmBinary),r.noExitRuntime,"object"!=typeof WebAssembly&&S("no native wasm support detected");var m,p,f,g=!1;function y(){var e=h.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=[],A=[],C=0,v=null,T=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 n(t),t}var E,_,x="data:application/octet-stream;base64,";function P(e){return e.startsWith(x)}function N(e){try{if(e==E&&u)return new Uint8Array(u);if(i)return i(e);throw"both async and sync fetching of the wasm failed"}catch(e){S(e)}}function $(e,t,n){return function(e){return u||!a&&!l||"function"!=typeof fetch?Promise.resolve().then((function(){return N(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 N(e)}))}(e).then((function(e){return WebAssembly.instantiate(e,t)})).then((function(e){return e})).then(n,(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(W(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=h.buffer;try{return h.grow(e-t.byteLength+65535>>>16),y(),1}catch(e){}}function R(e){return r["_"+e]}P(E="wasmDbscan.wasm")||(_=E,E=r.locateFile?r.locateFile(_,c):c+_);var O="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function D(e,t,n,s,r){var i={string:e=>{var t=0;return null!=e&&0!==e&&(t=function(e){var t=function(e){for(var t=0,n=0;n<e.length;++n){var s=e.charCodeAt(n);s<=127?t++:s<=2047?t+=2:s>=55296&&s<=57343?(t+=4,++n):t+=3}return t}(e)+1,n=H(t);return function(e,t,n){!function(e,t,n,s){if(!(s>0))return 0;for(var r=n+s-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(n>=r)break;t[n++]=o}else if(o<=2047){if(n+1>=r)break;t[n++]=192|o>>6,t[n++]=128|63&o}else if(o<=65535){if(n+2>=r)break;t[n++]=224|o>>12,t[n++]=128|o>>6&63,t[n++]=128|63&o}else{if(n+3>=r)break;t[n++]=240|o>>18,t[n++]=128|o>>12&63,t[n++]=128|o>>6&63,t[n++]=128|63&o}}t[n]=0}(e,p,t,n)}(e,n,t),n}(e)),t},array:e=>{var t,n,s=H(e.length);return t=e,n=s,m.set(t,n),s}},o=R(e),a=[],l=0;if(s)for(var c=0;c<s.length;c++){var u=i[n[c]];u?(0===l&&(l=G()),a[c]=u(s[c])):a[c]=s[c]}var h=o.apply(null,a);return function(e){return 0!==l&&B(l),function(e){return"string"===t?(n=e)?function(e,t,n){for(var s=t+n,r=t;e[r]&&!(r>=s);)++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,n,s):"":"boolean"===t?Boolean(e):e;var n,s}(e)}(h)}var F,k={__cxa_throw:function(e,t,n){throw new L(e).init(t,n),e},abort:function(){S("")},emscripten_memcpy_big:function(e,t,n){p.copyWithin(e,t,t+n)},emscripten_resize_heap:function(e){var t,n=p.length,s=2147483648;if((e>>>=0)>s)return!1;for(var r=1;r<=4;r*=2){var i=n*(1+.2/r);if(i=Math.min(i,e+100663296),I(Math.min(s,(t=Math.max(e,i))+(65536-t%65536)%65536)))return!0}return!1}},G=(function(){var e,t,s,i,o={env:k,wasi_snapshot_preview1:k};function a(e,t){var n,s=e.exports;return r.asm=s,h=r.asm.memory,y(),r.asm.__indirect_function_table,n=r.asm.__wasm_call_ctors,b.unshift(n),function(e){if(C--,r.monitorRunDependencies&&r.monitorRunDependencies(C),0==C&&(null!==v&&(clearInterval(v),v=null),T)){var t=T;T=null,t()}}(),s}if(C++,r.monitorRunDependencies&&r.monitorRunDependencies(C),r.instantiateWasm)try{return r.instantiateWasm(o,a)}catch(e){d("Module.instantiateWasm callback failed with error: "+e),n(e)}(e=u,t=E,s=o,i=function(e){a(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||P(t)||"function"!=typeof fetch?$(t,s,i):fetch(t,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,s).then(i,(function(e){return d("wasm streaming compile failed: "+e),d("falling back to ArrayBuffer instantiation"),$(t,s,i)}))}))).catch(n)}(),r._dbscan=function(){return(r._dbscan=r.asm.dbscan).apply(null,arguments)},r._malloc=function(){return(r._malloc=r.asm.malloc).apply(null,arguments)},r._free=function(){return(r._free=r.asm.free).apply(null,arguments)},function(){return(G=r.asm.stackSave).apply(null,arguments)}),B=function(){return(B=r.asm.stackRestore).apply(null,arguments)},H=function(){return(H=r.asm.stackAlloc).apply(null,arguments)},W=function(){return(W=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(),A.unshift(e);var e;M(A)}()))}C>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)}(),C>0||(r.setStatus?(r.setStatus("Running..."),setTimeout((function(){setTimeout((function(){r.setStatus("")}),1),e()}),1)):e()))}if(r.ccall=D,r.cwrap=function(e,t,n,s){var r=!n||n.every((e=>"number"===e||"boolean"===e));return"string"!==t&&r&&!s?R(e):function(){return D(e,t,n,arguments)}},T=function e(){F||V(),F||(T=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&&n.amdO?define([],(function(){return r})):"object"==typeof exports&&(exports.exportCppDbscanLib=r)},5697:(e,t,n)=>{"use strict";n.d(t,{Dz:()=>w,FV:()=>c,Jv:()=>T,KR:()=>l,MI:()=>A,NB:()=>p,UX:()=>m,WI:()=>d,Zd:()=>h,_h:()=>u,aW:()=>g,bX:()=>v,fX:()=>b,kg:()=>o,s:()=>f,yU:()=>y});var s=n(9657),r=n(1040),i=n(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 n=e.trueCount()+t.trueCount();if(0==n)return 1;const s=e.andWithCountBits(t,!0);return s/(n-s)}function l(e,t){return 1-a(e,t)}function c(e,t){return C(a(new s.Z(e,32*e.length),new s.Z(t,32*t.length)))}function u(e,t){return 1-function(e,t){const n=e.trueCount()+t.trueCount();return 0==n?0:2*e.andWithCountBits(t,!0)/n}(e,t)}function h(e,t){return 1-function(e,t){const n=e.trueCount()*t.trueCount();return 0==n?0:e.andWithCountBits(t,!0)/Math.sqrt(n)}(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 n=e.trueCount()+t.trueCount(),s=e.andWithCountBits(t,!0);return s/(2*n-3*s)}(e,t)}function f(e,t){return C(function(e,t){const n=e.trueCount()+t.trueCount(),s=e.trueCount()*t.trueCount();return 0==s?0:e.andWithCountBits(t,!0)*n/(2*s)}(e,t))}function g(e,t){return C(function(e,t){const n=e.trueCount()+t.trueCount(),s=e.trueCount()*t.trueCount();return 0==s?0:(e.andWithCountBits(t,!0)*n-s)/s}(e,t))}function y(e,t){return 1-function(e,t){const n=Math.min(e.trueCount(),t.trueCount());return 0==n?0:e.andWithCountBits(t,!0)/n}(e,t)}function w(e,t){return C(function(e,t){const n=Math.max(e.trueCount(),t.trueCount());return 0==n?0:e.andWithCountBits(t,!0)/n}(e,t))}function b(e,t){return C(function(e,t){return 0==e.length?0:e.andWithCountBits(t,!0)/e.length}(e,t))}function A(e,t){return C(function(e,t){const n=e.andWithCountBits(t,!0),s=e.countBits(!0)+t.countBits(!0),r=e.length,i=r-s+n;return n==r||i==r?1:n/s+i/(2*r-s)}(e,t))}function C(e){return 0===e?3402823e32:1/e-1}function v(e){if(e&&null!=e.range&&e.range>0){const t=e.range;return(e,n)=>Math.abs(e-n)/t}return(e,t)=>Math.abs(e-t)}function T(e){const t=function(e){const t=e?.mostCommon??new Set;return(e,n)=>{const s=e.length,r=n.length;let i=0,o=0,a=0;for(;o<s&&a<r;)e[o]===n[a]?(t?.has(e[o])||++i,++o,++a):e[o]<n[a]?++o:++a;return i}}(e);return(e,n)=>0===n.length||0===e.length?1e4:Math.min(e.length,n.length)/(t(e,n)+1e-4)}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,n)=>{"use strict";n.d(t,{Ec:()=>r,sS:()=>s});const s="bypassLargeDataWarning",r="show-scatterplot-progress"},708:(e,t,n)=>{"use strict";function s(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,n=e.scoringMatrix,s=Math.min(...Object.keys(t).map((e=>e.charCodeAt(0))))+1,r=new Float32Array((n.length+s)*(n.length+s));return Object.entries(t).forEach((([e,s])=>{const i=n[s];Object.entries(t).forEach((([t,s])=>{r[e.charCodeAt(0)*n.length+t.charCodeAt(0)]=i[s]}))})),(e,t)=>1-r[e.charCodeAt(0)*n.length+t.charCodeAt(0)]}(),n=e?.threshold??0;return(e,s)=>{let r=0;const i=e.length,o=s.length,a=Math.ceil(Math.max(i,o)*(1-n));i!==o&&(r=Math.abs(i-o));let l=0;for(let n=0;n<Math.min(i,o);n++)if(e[n]!==s[n]&&(l+=t(e[n],s[n]),l>a))return 1;return l+=r,l/=Math.max(i,o),l}}n.d(t,{U:()=>o,o:()=>a});var r=n(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]:s,[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:n,gapExtend:s,scoringMatrix:r,alphabetIndexes:o}={...i,...e};Object.entries(o).forEach((([e,n])=>t[e.charCodeAt(0)]=n));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,u=1;for(let t=1;t<e.length+1;t++)a[0][t]=-n-(t-1)*s,a[1][t]=0;a[0][0]=0;for(let h=1;h<i.length+1;h++){a[u][0]=-n-(h-1)*s;for(let d=1;d<e.length+1;d++){const m=a[c][d-1]+r[t[e.charCodeAt(d-1)]][t[i.charCodeAt(h-1)]],p=a[c][d]-(o[d]?s:n),f=a[u][d-1]-(l[d-1]?s:n);a[u][d]=Math.max(m,f,p),a[u][d]===m?(o[d]=!1,l[d]=!1):a[u][d]===f?(o[d]=!1,l[d]=!0):(o[d]=!0,l[d]=!1)}c=u,u=(u+1)%2}const h=Math.max(e.length,i.length);return(h-a[c][e.length])/h}},[o.MONOMER_CHEMICAL_DISTANCE]:s}},4628:(e,t,n)=>{"use strict";var s;n.d(t,{A:()=>s}),function(e){e.UMAP="UMAP",e.T_SNE="t-SNE"}(s||(s={}))},1040:(e,t,n)=>{"use strict";var s,r,i,o,a,l,c;n.d(t,{CF:()=>r,Qe:()=>a,W:()=>s,Yc:()=>l,gd:()=>o,gj:()=>c,gk:()=>i}),function(e){e.Levenshtein="Levenshtein",e.JaroWinkler="Jaro-Winkler",e.Manhattan="Manhattan",e.Onehot="One-Hot"}(s||(s={})),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",e.NumberArray="NumberArray"}(a||(a={})),function(e){e.Difference="Difference"}(l||(l={})),function(e){e.CommonItems="Common Items"}(c||(c={}))},6361:(e,t,n)=>{"use strict";n.d(t,{gk:()=>s.gk});var s=n(1040);n(7861)},7861:(e,t,n)=>{"use strict";var s=n(1811),r=n(3979),i=n(5697),o=n(850),a=n(708),l=n(1040);const c={[l.CF.Euclidean]:o.dP},u={[l.W.Levenshtein]:s.T,[l.W.JaroWinkler]:r.H$,[l.W.Manhattan]:function(e,t){if(e.length!==t.length)return 1;{let n=0;for(let s=1;s<e.length;s++)n+=e[s]==t[s]?0:1;return n/e.length}},[l.W.Onehot]:function(e,t){return e===t?0:1}},h={[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.gj.CommonItems]:i.Jv},f={[l.Qe.Vector]:{[l.CF.Euclidean]:c[l.CF.Euclidean]},[l.Qe.String]:{[l.W.Levenshtein]:u[l.W.Levenshtein],[l.W.JaroWinkler]:u[l.W.JaroWinkler],[l.W.Manhattan]:u[l.W.Manhattan],[l.W.Onehot]:u[l.W.Onehot]},[l.Qe.BitArray]:{[l.gk.Tanimoto]:h[l.gk.Tanimoto],[l.gk.Dice]:h[l.gk.Dice],[l.gk.Asymmetric]:h[l.gk.Asymmetric],[l.gk.BraunBlanquet]:h[l.gk.BraunBlanquet],[l.gk.Cosine]:h[l.gk.Cosine],[l.gk.Kulczynski]:h[l.gk.Kulczynski],[l.gk.McConnaughey]:h[l.gk.McConnaughey],[l.gk.RogotGoldberg]:h[l.gk.RogotGoldberg],[l.gk.Russel]:h[l.gk.Russel],[l.gk.Sokal]:h[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]},[l.Qe.NumberArray]:{[l.gj.CommonItems]:p[l.gj.CommonItems]}};Object.keys(f).reduce(((e,t)=>{for(const n of Object.keys(f[t]))e[n]=t;return e}),{})},9657:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});class s{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 n=e,r=s._createBuffer(n);if(t)for(let e=0;e<r.length;e++)r[e]=-1;this._data=r,this._length=n}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,n,s){if(e<t||e>n)throw new Error(`Argument ${s} (${e}) out of range (${t}, ${n})`)}copy(e,t,n){for(let s=0;s<n;s++)t[s]=e[s]}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 n=new s(e._length);n._length=e._length,n._data=s._createBuffer(n._length),n._version=0;const r=e.lengthInInts;for(let s=0;s<r;s++)n._data[s]=e._data[s]&t._data[s];return n}static _createBuffer(e){return new Uint32Array(Math.floor((e+31)/32))}static fromValues(e){const t=new s(e.length);t._version=0;for(let n=0;n<t._length;n++)e[n]&&(t._data[Math.floor(n/32)]|=1<<(n%32&31));return t}static fromSeq(e,t){const n=new s(e);for(let s=0;s<e;++s)n.setBit(s,t(s));return n._version=0,n}static fromString(e){return s.fromSeq(e.length,(t=>"1"==e.charAt(t)))}static fromUint32Array(e,t){const n=new s(e);return n._data=t,n}static fromBytes(e){const t=e.length,n=new s(8*t);n._data=new Uint32Array(Math.floor((t+3)/4)),n._length=8*t;let r=0,i=0;for(;t-i>=4;)n._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&&(n._data[r]=(255&e[i+2])<<16),t-i==2&&(n._data[r]|=(255&e[i+1])<<8),t-i==1&&(n._data[r]|=255&e[i]),n._version=0,n}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 s(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 n=e?-1:0,s=this.lengthInInts;for(let e=0;e<s;e++)this._data[e]=n;this.incrementVersion(t)}setIndexes(e,t=!0,n=!0,s=!0){n&&this.setAll(!t,!1);for(const n of e)this.setFast(n,t);this.incrementVersion(s)}everyIndex(e,t=!0){for(const n of e)if(this.getBit(n)!=t)return!1;return!0}anyIndex(e,t=!0){for(const n of e)if(this.getBit(n)==t)return!0;return!1}setWhere(e,t=!0,n=!0,s=!0,r=!0){if(n&&r&&this.setAll(!t,!1),r)for(let n=0;n<this._length;n++)e(n)&&this.setFast(n,t);else for(let n=0;n<this._length;n++)this.setFast(n,e(n)?t:!t);this.incrementVersion(s)}getRange(e,t){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length,"to");const n=[];for(let s=e;s<t;++s)n.push(this.getBit(s));return s.fromValues(n)}getRangeAsList(e,t){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length,"to");const n=[];for(let s=e;s<t;++s)n.push(this.getBit(s));return n}setRange(e,t,n,s=!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(n)for(let e=r;e<=i;e++)this.setTrue(e);else for(let e=r;e<=i;e++)this.setFalse(e);return this.incrementVersion(s),this}setRandom(e,t,n=!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 n=0;n<e;){const e=Math.floor(Math.random()*this._length);this.getBit(e)!=t&&(this.setFast(e,t),n++)}this.incrementVersion(n)}and(e,t=!0){if(this._length!=e._length)throw new Error("Array lengths differ.");for(let t=0,n=this.lengthInInts;t<n;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 n=this.lengthInInts;for(let t=0;t<n;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,n=this.lengthInInts;t<n;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,n=this.lengthInInts;t<n;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,n=this.lengthInInts;t<n;t++)this._data[t]^=e._data[t];return this.incrementVersion(t),this}insertAt(e,t,n=!1){if(this.assureInRange(e,0,this._length,"pos"),0==t)return;const s=this._length;this.setLength(this._length+t);for(let n=s-1;n>=e;n--)this.setBit(n+t,this.getBit(n));for(let s=e;s<e+t;s++)this.setBit(s,n)}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 n=e;n<this._length-t;n++)this.setBit(n,this.getBit(n+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 n=0;for(let s=-1;-1!=(s=e.findNext(s,!t));)this.setFast(n++,this.getBit(s));this._length=n,this._version++}return this}getBit(e){return 0!=(this._data[Math.floor(e/32)]&1<<(31&e))}setBit(e,t,n=!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+=s._onBitCount[255&e];let n=this._data[t];const r=31&this._length;for(0!=r&&(n&=~(4294967295<<r));0!=n;n>>>=8)this._selectedCount+=s._onBitCount[255&n];this._selectedCountVersion=this._version}return e?this._selectedCount:this._length-this._selectedCount}countWhere(e){let t=0;if(this.trueCount()==this._length)for(let n=0;n<this._length;n++)t+=e(n)?1:0;else for(let n=-1;-1!=(n=this.findNext(n,!0));)t+=e(n)?1:0;return t}andWithCountBits(e,t){if(0==this._length)return 0;let n=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)n+=s._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)n+=s._onBitCount[255&o];return t?n:this._length-n}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 n=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!=n)r&=4294967295<<n&4294967295,n=0;else if(!t&&-4294967296==r)continue;for(let t=0;0!=r;t+=8,r>>>=8){const n=s._firstOnBit[255&r];if(n>=0)return(e=n+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 n=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!=n&&(e&=~(4294967295<<n),n=0);for(let t=24;0!=e;t-=8,e<<=8){const n=s._lastOnBit[e>>>24];if(n>=0)return n+32*r+t}}return-1}}s._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]),s._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]),s._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])},2997:(e,t,n)=>{"use strict";n.d(t,{X5:()=>F,ow:()=>V,bb:()=>D,W3:()=>O,gw:()=>W,l_:()=>M,f6:()=>R,jh:()=>L,Wh:()=>I,ci:()=>G,Bu:()=>$,zg:()=>P,zN:()=>N,AB:()=>j,QK:()=>w});var s=n(4469),r=n(976);n(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,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))};function a(e,t,n,s,r,i,a,l,c=!0){return o(this,void 0,void 0,(function*(){let u=null;if(yield N(s,(n=>o(this,void 0,void 0,(function*(){let n=null;for(const s of e.viewers)s.type===t&&(n=s);if(!n)throw Error("Viewer hasn't been added");if(yield Promise.resolve(),i&&(yield i(n)),r){const t=null!=l?l:{};t.tv=e,t.viewer=n,u=yield r(t,c)}n.close()}))),(()=>o(this,void 0,void 0,(function*(){a?e.loadLayout(a):yield function(e,t,n){return o(this,void 0,void 0,(function*(){let s;return n?(s=yield e.dataFrame.plot.fromType(t),e.dockManager.dock(s)):s=e.addViewer(t),s}))}(e,t,n)}))),6e4,"TEST_EVENT_ASYNC"),u)return u}))}function l(e,t=!0){return o(this,void 0,void 0,(function*(){const n=e.tv.dataFrame,s=n.clone();Array.from(n.row(0).cells).forEach((e=>e.value=null));const r=n.rowCount<20?Math.floor(n.rowCount/2):10;n.rows.select((e=>e.idx>=0&&e.idx<r)),t&&(yield W(50));for(let e=r;e<2*r;e++)n.filter.set(e,!1);t&&(yield W(50)),n.currentRowIdx=1,n.columns.names().slice(0,Math.ceil(n.columns.length/2)).forEach((e=>n.columns.remove(e))),t&&(yield W(100)),e.tv.dataFrame=s,yield W(50)}))}function c(e,t=!0){return o(this,void 0,void 0,(function*(){let t,n;try{t=e.viewer.getOptions(!0).look}catch(e){throw new Error("Viewer's .getOptions() error.",{cause:e})}try{n=e.viewer.getProperties()}catch(e){throw new Error("Viewer's .getProperties() error.",{cause:e})}const s={};return Object.keys(t).filter((e=>"boolean"==typeof t[e])).forEach((e=>s[e]=!t[e])),n.filter((e=>null!==e.choices)).forEach((e=>s[e.name]=e.choices.find((n=>n!==t[e.name])))),e.viewer.setOptions(s),yield W(300),{layout:e.tv.saveLayout(),savedProps:e.viewer.getOptions().look}}))}function u(e,t=!0){return o(this,void 0,void 0,(function*(){M(JSON.stringify(e.viewer.getOptions().look),JSON.stringify(e.savedProps))}))}var h=function(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))};const d=3e4,m=108e5,p=console.log.bind(console),f=console.info.bind(console),g=console.warn.bind(console),y=console.error.bind(console),w={},b="Auto Tests",A="Demo",C="Detectors",v="Core",T={};let S;var E;!function(e){e.notNull=function(e,t){if(null==e)throw new Error(`${null==t?"Value":t} not defined`)}}(E||(E={}));class _{constructor(e,t){this.catchUnhandled=!0,this.report=!1,void 0!==e&&(this.catchUnhandled=e),void 0!==t&&(this.report=t)}}class x{constructor(e,t,n,s){var r;this.category=e,this.name=t,null!=s||(s={}),null!==(r=s.timeout)&&void 0!==r||(s.timeout=d),this.options=s,this.test=()=>h(this,void 0,void 0,(function*(){return new Promise(((e,t)=>h(this,void 0,void 0,(function*(){let s="";try{s=yield n()}catch(e){t(e)}e(s)}))))}))}}function P(e,t,n,s=0,r="timeout"){return h(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)}finally{a.unsubscribe(),clearTimeout(l)}})),l=setTimeout((()=>{a.unsubscribe(),o(r)}),s);n()}))}))}function N(e,t,n,s=0,r="timeout"){return h(this,void 0,void 0,(function*(){return new Promise(((i,o)=>{const a=e.subscribe((e=>{t(e).then((()=>{i("OK")})).catch((e=>{o(e)})).finally((()=>{a.unsubscribe(),clearTimeout(l)}))})),l=setTimeout((()=>{a.unsubscribe(),o(r)}),s);n()}))}))}function $(e,t,n){null==w[S]&&(w[S]={}),null==w[S].tests&&(w[S].tests=[]),w[S].tests.push(new x(S,e,t,n))}function M(e,t=!0,n){if(n=n?`${n}, `:"",e!==t)throw new Error(`${n}Expected "${t}", got "${e}"`)}function L(e,t,n=.001,s){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)<n;if(M(r,!0,`${null!=s?s:""} (tolerance = ${n})`),!r)throw new Error(`Expected ${t}, got ${e} (tolerance = ${n})`)}function I(e,t){for(const[n,s]of Object.entries(t)){if(!e.hasOwnProperty(n))throw new Error(`Expected property "${n}" not found`);const t=e[n];if(t instanceof Array&&s instanceof Array)R(t,s);else if(t instanceof Object&&s instanceof Object)I(t,s);else if(Number.isFinite(t)&&Number.isFinite(s))L(t,s);else if(t!=s)throw new Error(`Expected (${s}) for key '${n}', got (${t})`)}}function R(e,t){const n=e.length,s=t.length;if(n!=s)throw new Error(`Arrays are of different length: actual array length is ${n} and expected array length is ${s}`);for(let s=0;s<n;s++)if(e[s]instanceof Array&&t[s]instanceof Array)R(e[s],t[s]);else if(e[s]instanceof Object&&t[s]instanceof Object)I(e[s],t[s]);else if(e[s]!=t[s])throw new Error(`Expected ${t[s]} at position ${s}, got ${e[s]}`)}function O(e,t,n){var s;S=e,t(),w[S]&&(w[S].clear=null===(s=null==n?void 0:n.clear)||void 0===s||s,w[S].timeout=null==n?void 0:n.timeout)}function D(e){null==w[S]&&(w[S]={}),w[S].before=e}function F(e){null==w[S]&&(w[S]={}),w[S].after=e}function k(e,t){return e.replace(new RegExp(t.name,"gi"),t.nqName)}function G(e){var t,n,o,a,l,c,u;return h(this,void 0,void 0,(function*(){const d=null===(n=null===(t=s.functions.getCurrentCall())||void 0===t?void 0:t.func)||void 0===n?void 0:n.package;yield function(e,t){var n;return h(this,void 0,void 0,(function*(){const t=e.id;if(T[t])return;const o=w;if(void 0!==o[b]||void 0!==o[A]||Object.keys(o).find((e=>e.startsWith(b)||e.startsWith(v))))return void(T[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),s=null!==(n=e.pop())&&void 0!==n?n:t.name,r=e.length?v+": "+e.join(": "):v;void 0===o[r]&&(o[r]={tests:[],clear:!0}),o[r].tests.push(new x(r,s,(()=>h(this,void 0,void 0,(function*(){return yield t.apply()}))),{isAggregated:t.outputs.length>0,timeout:3e5}))}}const a=[],l=[],c=[],u=yield s.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,n=e.options.demoPath;if(t&&Array.isArray(t)&&t.length)for(let n=0;n<t.length;n++){const r=t[n].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 l=new x(b,1===t.length?e.name:`${e.name} ${n+1}`,(()=>h(this,void 0,void 0,(function*(){const r=yield s.functions.eval(k(t[n],e));if(i.wait&&(yield W(i.wait)),"boolean"==typeof r&&!r)throw`Failed: ${t[n]}, expected true, got ${r}`}))),{skipReason:i.skip,timeout:i.timeout});if(i.cat){const e=b+": "+i.cat;l.category=e,void 0===o[e]&&(o[e]={tests:[],clear:!0}),o[e].tests.push(l)}else a.push(l)}if(n){const t=e.options.demoWait?parseInt(e.options.demoWait):void 0,n=new x(A,e.friendlyName,(()=>h(this,void 0,void 0,(function*(){if(s.shell.lastError="",yield e.apply(),yield W(t||2e3),s.shell.lastError)throw new Error(s.shell.lastError)}))),{skipReason:e.options.demoSkip});l.push(n)}if(e.hasTag("semTypeDetector")){const t=new x(C,e.friendlyName,(()=>h(this,void 0,void 0,(function*(){const t=[];for(const n of i.clone().columns){const s=yield e.apply([n]);t.push(s||n.semType)}M(t.filter((e=>e)).length,1)}))),{skipReason:e.options.skipTest});c.push(t)}}T[t]=!0,a.length&&(o[b]={tests:a,clear:!0}),l.length&&(o[A]={tests:l,clear:!0}),c.length&&(o[C]={tests:c,clear:!1})}))}(d);const m=[];console.log("Running tests"),null!=e||(e={}),null!==(o=(u=e).testContext)&&void 0!==o||(u.testContext=new _),s.shell.lastError="";const S=[],E=function(){const e=[];return console.log=(...t)=>{e.push(...t),p(...t)},console.info=(...t)=>{e.push(...t),f(...t)},console.warn=(...t)=>{e.push(...t),g(...t)},console.error=(...t)=>{e.push(...t),y(...t)},e}();try{for(const[t,n]of Object.entries(w)){if((null==e?void 0:e.category)&&!t.toLowerCase().startsWith(null==e?void 0:e.category.toLowerCase())||(null===(a=e.exclude)||void 0===a?void 0:a.some((e=>t.startsWith(e)))))continue;p(`Started ${t} category`),S.push(t);const i=null===(l=n.tests)||void 0===l?void 0:l.every((e=>{var t;return null===(t=e.options)||void 0===t?void 0:t.skipReason}));try{n.before&&!i&&(yield n.before())}catch(e){n.beforeStatus=yield B(e)}const o=null!==(c=n.tests)&&void 0!==c?c:[],u=[];if(n.clear)for(let t=0;t<o.length;t++)u.push(yield H(o[t],null==e?void 0:e.test,E,n.timeout,d.name,e.verbose)),s.shell.closeAll(),r.Balloon.closeAll();else for(let t=0;t<o.length;t++)u.push(yield H(o[t],null==e?void 0:e.test,E,n.timeout,d.name,e.verbose));const h=u.filter((e=>"skipped"!=e.result));try{n.after&&!i&&(yield n.after())}catch(e){n.afterStatus=yield B(e)}n.afterStatus&&h.push({category:t,name:"after",result:n.afterStatus,success:!1,ms:0,skipped:!1}),n.beforeStatus&&h.push({category:t,name:"before",result:n.beforeStatus,success:!1,ms:0,skipped:!1}),m.push(...h)}}finally{console.log=p,console.info=f,console.warn=g,console.error=y}if(e.testContext.catchUnhandled&&(yield W(1e3),s.shell.lastError.length>0&&m.push({category:"Unhandled exceptions",name:"exceptions",result:s.shell.lastError,success:!1,ms:0,skipped:!1})),!e.test&&m.length){const t=m.filter((e=>e.success)).length,n=m.filter((e=>e.skipped)).length,i=m.filter((e=>!e.success)),o=d.name;for(const e of S){const t=m.filter((t=>t.category===e)),n=t.filter((e=>!e.success)).length,r={success:0===n,passed:t.filter((e=>e.success)).length,skipped:t.filter((e=>e.skipped)).length,failed:n,type:"package",packageName:o,category:e};s.log.usage(`${o}: ${e}`,r,`category-package ${o}: ${e}`)}if(!e.category){const e={success:0===i.length,passed:t,skipped:n,failed:i.length,type:"package",packageName:o};s.log.usage(o,e,`package-package ${o}`)}if(e.testContext.report){const e=new r.Logger,s="Package @package tested: @successful successful, @skipped skipped, @failed failed tests",o={successful:t,skipped:n,failed:i.length,package:d};for(const e of i)Object.assign(o,{[`${e.category} | ${e.name}`]:e.result});e.log(s,o,"package-tested")}}return m}))}function B(e){return h(this,void 0,void 0,(function*(){return`${e.toString()}\n${e.stack?yield r.Logger.translateStackTrace(e.stack):""}`}))}function H(e,t,n,i,o,a){var l,c,u,f,g,w;return h(this,void 0,void 0,(function*(){let h;n.length=0;let b="package";const A=null!=t&&e.name.toLowerCase()!==t.toLowerCase(),C=(null===(l=e.options)||void 0===l?void 0:l.skipReason)||A,v=A?"skipped":null===(c=e.options)||void 0===c?void 0:c.skipReason;C||p(`Started ${e.category} ${e.name}`);const T=Date.now();try{if(C)h={success:!0,result:v,ms:0,skipped:!0};else{let t=(null===(u=e.options)||void 0===u?void 0:u.timeout)===d&&i?i:null===(f=e.options)||void 0===f?void 0:f.timeout;t=r.Test.isInBenchmark&&t===d?m:t,h={success:!0,result:null!==(g=yield U(e.test,t))&&void 0!==g?g:"OK",ms:0,skipped:!1}}}catch(e){y(e),h={success:!1,result:yield B(e),ms:0,skipped:!1}}if((null===(w=e.options)||void 0===w?void 0:w.isAggregated)&&h.result.constructor===r.DataFrame){const e=h.result.col("success");if(b="core",e&&(h.success=e.stats.sum===e.length),!a){const e=h.result;e.columns.remove("stack"),e.rows.removeWhere((e=>e.get("success"))),h.result=e}h.result=h.result.toCsv()}if(h.logs=n.join("\n"),h.ms=Date.now()-T,C||p(`Finished ${e.category} ${e.name} for ${h.ms} ms`),h.category=e.category,h.name=e.name,!A){let t={success:h.success,result:h.result,ms:h.ms,skipped:h.skipped,type:b,packageName:o,category:e.category,test:e.name,logs:h.logs};if(h.result.constructor==Object){const e=Object.keys(h.result).reduce(((e,t)=>Object.assign(Object.assign({},e),{["result."+t]:h.result[t]})),{});t=Object.assign(Object.assign({},t),e)}s.log.usage(`${o}: ${e.category}: ${e.name}`,t,`test-${b} ${o}: ${e.category}: ${e.name}`)}return h}))}function W(e){return h(this,void 0,void 0,(function*(){yield new Promise((t=>setTimeout(t,e)))}))}function V(e,t="Timeout exceeded",n=500,s=50){return h(this,void 0,void 0,(function*(){return new Promise(((r,i)=>{setTimeout((()=>{clearInterval(o),i(new Error(t))}),n);const o=setInterval((()=>{e()&&(clearInterval(o),r())}),s)}))}))}function U(e,t){return h(this,void 0,void 0,(function*(){let n=null;const s=new Promise(((e,s)=>{n=setTimeout((()=>{s("EXECUTION TIMEOUT")}),t)}));try{return yield Promise.race([e(),s])}finally{n&&clearTimeout(n)}}))}const Y=r.DataFrame.fromColumns([r.Column.fromStrings("col",["val1","val2","val3"])]);function j(e,t,n){var r;return h(this,void 0,void 0,(function*(){const i=null!==(r=null==n?void 0:n.packageName)&&void 0!==r?r:"";(null==n?void 0:n.detectSemanticTypes)&&(yield s.data.detectSemanticTypes(t));const o=s.shell.addTableView(t);try{yield a(o,e,i,s.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(o,e,i,s.events.onViewerAdded,void 0,n.awaitViewer)),(null==n?void 0:n.readOnly)||(yield a(o,e,i,s.events.onViewerAdded,l),(null==n?void 0:n.awaitViewer)&&(yield a(o,e,i,s.events.onViewerAdded,l,n.awaitViewer)));let t=null;t=yield a(o,e,i,s.events.onViewerAdded,c),(null==n?void 0:n.awaitViewer)&&(t=yield a(o,e,i,s.events.onViewerAdded,c,n.awaitViewer)),yield a(o,e,i,s.events.onViewLayoutApplied,u,void 0,null==t?void 0:t.layout,{savedProps:null==t?void 0:t.savedProps}),(null==n?void 0:n.awaitViewer)&&(yield a(o,e,i,s.events.onViewLayoutApplied,u,n.awaitViewer,null==t?void 0:t.layout,{savedProps:null==t?void 0:t.savedProps})),!1!==(null==n?void 0:n.arbitraryDfTest)&&(o.dataFrame=Y,yield W(50),yield a(o,e,i,s.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(o,e,i,s.events.onViewerAdded,void 0,n.awaitViewer)))}finally{}}))}},850:(e,t,n)=>{"use strict";function s(e=!1,t="Assertion error."){if(!e)throw new Error(t)}function r(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(t)}function i(e,t){if(e.length!=t.length)throw new Error("The dimensionality of the vectors must match");let n=0;for(let s=0;s<e.length;s++)n+=e[s]*t[s];return n}function o(e,t){let n=0;const s=e.length;if(s!==t.length)throw new Error("The dimensionality of the vectors must match");for(let r=0;r<s;++r)n+=Math.pow(e[r]-t[r],2);return Math.sqrt(n)}function a(e){const t=e.length;let n=0,s=0;for(let r=0;r<t;++r)n+=e[r],s+=Math.pow(e[r],2);const r=n/t,i=1/Math.sqrt(s/t-Math.pow(r,2));for(let n=0;n<t;++n)e[n]=(e[n]-r)*i;return e}n.d(t,{$G:()=>r,Fv:()=>a,MA:()=>i,dP:()=>o,hu:()=>s})},3351:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(1581),r=n(3487),i=n(7023),o=n(4815),a=n(4181),l=n(2141),c="errorMessage",u=new s.Name("emUsed"),h={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:n,data:f,schema:g,schemaValue:y,it:w}=t;if(!1===w.createErrors)return;const b=g,A=r.strConcat(l.default.instancePath,w.errorPath);function C(e,t){return r.and(s._`${e}.keyword !== ${c}`,s._`!${e}.${u}`,s._`${e}.instancePath === ${A}`,s._`${e}.keyword in ${t}`,s._`${e}.schemaPath.indexOf(${w.errSchemaPath}) === 0`,s._`/^\\/[^\\/]*$/.test(${e}.schemaPath.slice(${w.errSchemaPath.length}))`)}function v(e,t){const s=[];for(const n in e){const e=t[n];d.test(e)&&s.push([n,S(e)])}return n.object(...s)}function T(e){return d.test(e)?new i._Code(i.safeStringify(e).replace(m,((e,t)=>`" + JSON.stringify(${o.getData(t,w)}) + "`)).replace(p,"")):s.stringify(e)}function S(e){return s._`function(){return ${T(e)}}`}n.if(s._`${l.default.errors} > 0`,(()=>{if("object"==typeof b){const[i,o]=function(e){let t,n;for(const s in e){if("properties"===s||"items"===s)continue;const r=e[s];if("object"==typeof r){t||(t={});const e=t[s]={};for(const t in r)e[t]=[]}else n||(n={}),n[s]=[]}return[t,n]}(b);o&&function(r){const i=n.const("emErrors",s.stringify(r)),o=n.const("templates",v(r,g));n.forOf("err",l.default.vErrors,(e=>n.if(C(e,i),(()=>n.code(s._`${i}[${e}.keyword].push(${e})`).assign(s._`${e}.${u}`,!0)))));const{singleError:c}=e;if(c){const e=n.let("message",s._`""`),r=n.let("paramsErrors",s._`[]`);h((t=>{n.if(e,(()=>n.code(s._`${e} += ${"string"==typeof c?c:";"}`))),n.code(s._`${e} += ${d(t)}`),n.assign(r,s._`${r}.concat(${i}[${t}])`)})),a.reportError(t,{message:e,params:s._`{errors: ${r}}`})}else h((e=>a.reportError(t,{message:d(e),params:s._`{errors: ${i}[${e}]}`})));function h(e){n.forIn("key",i,(t=>n.if(s._`${i}[${t}].length`,(()=>e(t)))))}function d(e){return s._`${e} in ${o} ? ${o}[${e}]() : ${y}[${e}]`}}(o),i&&function(e){const r=n.const("emErrors",s.stringify(e)),i=[];for(const t in e)i.push([t,v(e[t],g[t])]);const o=n.const("templates",n.object(...i)),c=n.scopeValue("obj",{ref:h,code:s.stringify(h)}),d=n.let("emPropParams"),m=n.let("emParamsErrors");n.forOf("err",l.default.vErrors,(e=>n.if(C(e,r),(()=>{n.assign(d,s._`${c}[${e}.keyword]`),n.assign(m,s._`${r}[${e}.keyword][${e}.params[${d}]]`),n.if(m,(()=>n.code(s._`${m}.push(${e})`).assign(s._`${e}.${u}`,!0)))})))),n.forIn("key",r,(e=>n.forIn("keyProp",s._`${r}[${e}]`,(i=>{n.assign(m,s._`${r}[${e}][${i}]`),n.if(s._`${m}.length`,(()=>{const r=n.const("tmpl",s._`${o}[${e}] && ${o}[${e}][${i}]`);a.reportError(t,{message:s._`${r} ? ${r}() : ${y}[${e}][${i}]`,params:s._`{errors: ${m}}`})}))}))))}(i),function(e){const{props:i,items:o}=e;if(!i&&!o)return;const h=s._`typeof ${f} == "object"`,d=s._`Array.isArray(${f})`,m=n.let("emErrors");let p,w;const b=n.let("templates");function C(e,t){n.assign(m,s.stringify(e)),n.assign(b,v(e,t))}i&&o?(p=n.let("emChildKwd"),n.if(h),n.if(d,(()=>{C(o,g.items),n.assign(p,s.str`items`)}),(()=>{C(i,g.properties),n.assign(p,s.str`properties`)})),w=s._`[${p}]`):o?(n.if(d),C(o,g.items),w=s._`.items`):i&&(n.if(r.and(h,r.not(d))),C(i,g.properties),w=s._`.properties`),n.forOf("err",l.default.vErrors,(e=>function(e,t,i){n.if(r.and(s._`${e}.keyword !== ${c}`,s._`!${e}.${u}`,s._`${e}.instancePath.indexOf(${A}) === 0`),(()=>{const r=n.scopeValue("pattern",{ref:/^\/([^/]*)(?:\/|$)/,code:s._`new RegExp("^\\\/([^/]*)(?:\\\/|$)")`}),o=n.const("emMatches",s._`${r}.exec(${e}.instancePath.slice(${A}.length))`),a=n.const("emChild",s._`${o} && ${o}[1].replace(/~1/g, "/").replace(/~0/g, "~")`);n.if(s._`${a} !== undefined && ${a} in ${t}`,(()=>i(a)))}))}(e,m,(t=>n.code(s._`${m}[${t}].push(${e})`).assign(s._`${e}.${u}`,!0))))),n.forIn("key",m,(e=>n.if(s._`${m}[${e}].length`,(()=>{a.reportError(t,{message:s._`${e} in ${b} ? ${b}[${e}]() : ${y}${w}[${e}]`,params:s._`{errors: ${m}[${e}]}`}),n.assign(s._`${l.default.vErrors}[${l.default.errors}-1].instancePath`,s._`${A} + "/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`)})))),n.endIf()}(function({properties:e,items:t}){const n={};if(e){n.props={};for(const t in e)n.props[t]=[]}if(t){n.items={};for(let e=0;e<t.length;e++)n.items[e]=[]}return n}(b))}const i="string"==typeof b?b:b._;i&&function(e){const i=n.const("emErrs",s._`[]`);n.forOf("err",l.default.vErrors,(e=>n.if(function(e){return r.and(s._`${e}.keyword !== ${c}`,s._`!${e}.${u}`,r.or(s._`${e}.instancePath === ${A}`,r.and(s._`${e}.instancePath.indexOf(${A}) === 0`,s._`${e}.instancePath[${A}.length] === "/"`)),s._`${e}.schemaPath.indexOf(${w.errSchemaPath}) === 0`,s._`${e}.schemaPath[${w.errSchemaPath}.length] === "/"`)}(e),(()=>n.code(s._`${i}.push(${e})`).assign(s._`${e}.${u}`,!0))))),n.if(s._`${i}.length`,(()=>a.reportError(t,{message:T(e),params:s._`{errors: ${i}}`})))}(i),e.keepErrors||function(){const e=n.const("emErrs",s._`[]`);n.forOf("err",l.default.vErrors,(t=>n.if(s._`!${t}.${u}`,(()=>n.code(s._`${e}.push(${t})`))))),n.assign(l.default.vErrors,e).assign(l.default.errors,s._`${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,n)=>{"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 s=n(7159),r=n(7299),i=n(1240),o=n(4087),a="https://json-schema.org/draft/2020-12/schema";class l extends s.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=n(4815);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var u=n(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 h=n(7426);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var d=n(6646);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return d.default}})},1581:(e,t,n)=>{"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 s=n(7159),r=n(3924),i=n(1240),o=n(98),a=["/properties"],l="http://json-schema.org/draft-07/schema";class c extends s.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 u=n(4815);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var h=n(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 d=n(7426);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var m=n(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 n{}t._CodeOrName=n,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class s extends n{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=s;class r extends n{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 s&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}function i(e,...t){const n=[e[0]];let s=0;for(;s<t.length;)l(n,t[s]),n.push(e[++s]);return new r(n)}t._Code=r,t.nil=new r(""),t._=i;const o=new r("+");function a(e,...t){const n=[u(e[0])];let s=0;for(;s<t.length;)n.push(o),l(n,t[s]),n.push(o,u(e[++s]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===o){const n=c(e[t-1],e[t+1]);if(void 0!==n){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}(n),new r(n)}function l(e,t){var n;t instanceof r?e.push(...t._items):t instanceof s?e.push(t):e.push("number"==typeof(n=t)||"boolean"==typeof n||null===n?n:u(Array.isArray(n)?n.join(","):n))}function c(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof s||'"'!==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 s?void 0:`"${e}${t.slice(1)}`}function u(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(u(e))},t.safeStringify=u,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,n)=>{"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 s=n(7023),r=n(8490);var i=n(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=n(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 s._Code(">"),GTE:new s._Code(">="),LT:new s._Code("<"),LTE:new s._Code("<="),EQ:new s._Code("==="),NEQ:new s._Code("!=="),NOT:new s._Code("!"),OR:new s._Code("||"),AND:new s._Code("&&"),ADD:new s._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){const n=e?r.varKinds.var:this.varKind,s=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${s};`+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 s._CodeOrName?this.rhs.names:{}}}class c extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof s.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=M(this.rhs,e,t),this}get names(){return $(this.lhs instanceof s.Name?{}:{...this.lhs.names},this.rhs)}}class u extends c{constructor(e,t,n,s){super(e,n,s),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class h 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 s._CodeOrName?this.code.names:{}}}class f extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce(((t,n)=>t+n.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:n}=this;let s=n.length;for(;s--;){const r=n[s];r.optimizeNames(e,t)||(L(e,r.names),n.splice(s,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>N(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 n;if(this.else=null===(n=this.else)||void 0===n?void 0:n.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 $(e,this.condition),this.else&&N(e,this.else.names),e}}b.kind="if";class A extends g{}A.kind="for";class C extends A{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 N(super.names,this.iteration.names)}}class v extends A{constructor(e,t,n,s){super(),this.varKind=e,this.name=t,this.from=n,this.to=s}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:n,from:s,to:i}=this;return`for(${t} ${n}=${s}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){const e=$(super.names,this.from);return $(e,this.to)}}class T extends A{constructor(e,t,n,s){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=s}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 N(super.names,this.iterable.names)}}class S extends g{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}S.kind="func";class E extends f{render(e){return"return "+super.render(e)}}E.kind="return";class _ 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 n,s;return super.optimizeNames(e,t),null===(n=this.catch)||void 0===n||n.optimizeNames(e,t),null===(s=this.finally)||void 0===s||s.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&N(e,this.catch.names),this.finally&&N(e,this.finally.names),e}}class x extends g{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}x.kind="catch";class P extends g{render(e){return"finally"+super.render(e)}}function N(e,t){for(const n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function $(e,t){return t instanceof s._CodeOrName?N(e,t.names):e}function M(e,t,n){return e instanceof s.Name?i(e):(r=e)instanceof s._Code&&r._items.some((e=>e instanceof s.Name&&1===t[e.str]&&void 0!==n[e.str]))?new s._Code(e._items.reduce(((e,t)=>(t instanceof s.Name&&(t=i(t)),t instanceof s._Code?e.push(...t._items):e.push(t),e)),[])):e;var r;function i(e){const s=n[e.str];return void 0===s||1!==t[e.str]?e:(delete t[e.str],s)}}function L(e,t){for(const n in t)e[n]=(e[n]||0)-(t[n]||0)}function I(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:s._`!${F(e)}`}P.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 n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}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,n,s){const r=this._scope.toName(t);return void 0!==n&&s&&(this._constants[r.str]=n),this._leafNode(new l(e,r,n)),r}const(e,t,n){return this._def(r.varKinds.const,e,t,n)}let(e,t,n){return this._def(r.varKinds.let,e,t,n)}var(e,t,n){return this._def(r.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new c(e,t,n))}add(e,n){return this._leafNode(new u(e,t.operators.ADD,n))}code(e){return"function"==typeof e?e():e!==s.nil&&this._leafNode(new p(e)),this}object(...e){const t=["{"];for(const[n,r]of e)t.length>1&&t.push(","),t.push(n),(n!==r||this.opts.es5)&&(t.push(":"),(0,s.addCodeArg)(t,r));return t.push("}"),new s._Code(t)}if(e,t,n){if(this._blockNode(new b(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)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 C(e),t)}forRange(e,t,n,s,i=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const o=this._scope.toName(e);return this._for(new v(i,o,t,n),(()=>s(o)))}forOf(e,t,n,i=r.varKinds.const){const o=this._scope.toName(e);if(this.opts.es5){const e=t instanceof s.Name?t:this.var("_arr",t);return this.forRange("_i",0,s._`${e}.length`,(t=>{this.var(o,s._`${e}[${t}]`),n(o)}))}return this._for(new T("of",i,o,t),(()=>n(o)))}forIn(e,t,n,i=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,s._`Object.keys(${t})`,n);const o=this._scope.toName(e);return this._for(new T("in",i,o,t),(()=>n(o)))}endFor(){return this._endBlockNode(A)}label(e){return this._leafNode(new h(e))}break(e){return this._leafNode(new d(e))}return(e){const t=new E;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(E)}try(e,t,n){if(!t&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');const s=new _;if(this._blockNode(s),this.code(e),t){const e=this.name("e");this._currNode=s.catch=new x(e),t(e)}return n&&(this._currNode=s.finally=new P,this.code(n)),this._endBlockNode(x,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 n=this._nodes.length-t;if(n<0||void 0!==e&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=s.nil,n,r){return this._blockNode(new S(e,t,n)),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 n=this._currNode;if(n instanceof e||t&&n 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=D(t.operators.AND);t.and=function(...e){return e.reduce(R)};const O=D(t.operators.OR);function D(e){return(t,n)=>t===s.nil?n:n===s.nil?t:s._`${F(t)} ${e} ${F(n)}`}function F(e){return e instanceof s.Name?e:s._`(${e})`}t.or=function(...e){return e.reduce(O)}},8490:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const s=n(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 s.Name("const"),let:new s.Name("let"),var:new s.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof s.Name?e:this.name(e)}name(e){return new s.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,n;if((null===(n=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===n?void 0:n.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 s.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=s._`.${new s.Name(t)}[${n}]`}}t.ValueScopeName=a;const l=s._`\n`;t.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?l:s.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var n;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const s=this.toName(e),{prefix:r}=s,i=null!==(n=t.key)&&void 0!==n?n: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,s);const a=this._scope[r]||(this._scope[r]=[]),l=a.length;return a[l]=t.ref,s.setValue(t,{property:r,itemIndex:l}),s}getValue(e,t){const n=this._values[e];if(n)return n.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 s._`${e}${t.scopePath}`}))}scopeCode(e=this._values,t,n){return this._reduceValues(e,(e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,n)}_reduceValues(e,n,o={},a){let l=s.nil;for(const c in e){const u=e[c];if(!u)continue;const h=o[c]=o[c]||new Map;u.forEach((e=>{if(h.has(e))return;h.set(e,i.Started);let o=n(e);if(o){const n=this.opts.es5?t.varKinds.var:t.varKinds.const;l=s._`${l}${n} ${e} = ${o};${this.opts._n}`}else{if(!(o=null==a?void 0:a(e)))throw new r(e);l=s._`${l}${o}${this.opts._n}`}h.set(e,i.Completed)}))}return l}}},4181:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const s=n(3487),r=n(6776),i=n(2141);function o(e,t){const n=e.const("err",t);e.if(s._`${i.default.vErrors} === null`,(()=>e.assign(i.default.vErrors,s._`[${n}]`)),s._`${i.default.vErrors}.push(${n})`),e.code(s._`${i.default.errors}++`)}function a(e,t){const{gen:n,validateName:r,schemaEnv:i}=e;i.$async?n.throw(s._`new ${e.ValidationError}(${t})`):(n.assign(s._`${r}.errors`,t),n.return(!1))}t.keywordError={message:({keyword:e})=>s.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?s.str`"${e}" keyword must be ${t} ($data)`:s.str`"${e}" keyword is invalid ($data)`},t.reportError=function(e,n=t.keywordError,r,i){const{it:l}=e,{gen:u,compositeRule:h,allErrors:d}=l,m=c(e,n,r);(null!=i?i:h||d)?o(u,m):a(l,s._`[${m}]`)},t.reportExtraError=function(e,n=t.keywordError,s){const{it:r}=e,{gen:l,compositeRule:u,allErrors:h}=r;o(l,c(e,n,s)),u||h||a(r,i.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(i.default.errors,t),e.if(s._`${i.default.vErrors} !== null`,(()=>e.if(t,(()=>e.assign(s._`${i.default.vErrors}.length`,t)),(()=>e.assign(i.default.vErrors,null)))))},t.extendErrors=function({gen:e,keyword:t,schemaValue:n,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,s._`${i.default.vErrors}[${o}]`),e.if(s._`${l}.instancePath === undefined`,(()=>e.assign(s._`${l}.instancePath`,(0,s.strConcat)(i.default.instancePath,a.errorPath)))),e.assign(s._`${l}.schemaPath`,s.str`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign(s._`${l}.schema`,n),e.assign(s._`${l}.data`,r))}))};const l={keyword:new s.Name("keyword"),schemaPath:new s.Name("schemaPath"),params:new s.Name("params"),propertyName:new s.Name("propertyName"),message:new s.Name("message"),schema:new s.Name("schema"),parentSchema:new s.Name("parentSchema")};function c(e,t,n){const{createErrors:r}=e.it;return!1===r?s._`{}`:function(e,t,n={}){const{gen:r,it:o}=e,a=[u(o,n),h(e,n)];return function(e,{params:t,message:n},r){const{keyword:o,data:a,schemaValue:c,it:u}=e,{opts:h,propertyName:d,topSchemaRef:m,schemaPath:p}=u;r.push([l.keyword,o],[l.params,"function"==typeof t?t(e):t||s._`{}`]),h.messages&&r.push([l.message,"function"==typeof n?n(e):n]),h.verbose&&r.push([l.schema,c],[l.parentSchema,s._`${m}${p}`],[i.default.data,a]),d&&r.push([l.propertyName,d])}(e,t,a),r.object(...a)}(e,t,n)}function u({errorPath:e},{instancePath:t}){const n=t?s.str`${e}${(0,r.getErrorPath)(t,r.Type.Str)}`:e;return[i.default.instancePath,(0,s.strConcat)(i.default.instancePath,n)]}function h({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:i}){let o=i?t:s.str`${t}/${e}`;return n&&(o=s.str`${o}${(0,r.getErrorPath)(n,r.Type.Str)}`),[l.schemaPath,o]}},5173:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const s=n(3487),r=n(7426),i=n(2141),o=n(2531),a=n(6776),l=n(4815);class c{constructor(e){var t;let n;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(n=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==n?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==n?void 0:n.$async,this.refs={}}}function u(e){const t=d.call(this,e);if(t)return t;const n=(0,o.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:a,lines:c}=this.opts.code,{ownProperties:u}=this.opts,h=new s.CodeGen(this.scope,{es5:a,lines:c,ownProperties:u});let m;e.$async&&(m=h.scopeValue("Error",{ref:r.default,code:s._`require("ajv/dist/runtime/validation_error").default`}));const p=h.scopeName("validate");e.validateName=p;const f={gen:h,allErrors:this.opts.allErrors,data:i.default.data,parentData:i.default.parentData,parentDataProperty:i.default.parentDataProperty,dataNames:[i.default.data],dataPathArr:[s.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:h.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,s.stringify)(e.schema)}:{ref:e.schema}),validateName:p,ValidationError:m,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:s.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:s._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(e),(0,l.validateFunctionCode)(f),h.optimize(this.opts.code.optimize);const t=h.toString();g=`${h.scopeRefs(i.default.scope)}return ${t}`,this.opts.code.process&&(g=this.opts.code.process(g,e));const n=new Function(`${i.default.self}`,`${i.default.scope}`,g)(this,this.scope.get());if(this.scope.value(p,{ref:n}),n.errors=null,n.schema=e.schema,n.schemaEnv=e,e.$async&&(n.$async=!0),!0===this.opts.code.source&&(n.source={validateName:p,validateCode:t,scopeValues:h._values}),this.opts.unevaluated){const{props:e,items:t}=f;n.evaluated={props:e instanceof s.Name?void 0:e,items:t instanceof s.Name?void 0:t,dynamicProps:e instanceof s.Name,dynamicItems:t instanceof s.Name},n.source&&(n.source.evaluated=(0,s.stringify)(n.evaluated))}return e.validate=n,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 h(e){return(0,o.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:u.call(this,e)}function d(e){for(const s of this._compilations)if(n=e,(t=s).schema===n.schema&&t.root===n.root&&t.baseId===n.baseId)return s;var t,n}function m(e,t){let n;for(;"string"==typeof(n=this.refs[t]);)t=n;return n||this.schemas[t]||p.call(this,e,t)}function p(e,t){const n=this.opts.uriResolver.parse(t),s=(0,o._getFullPath)(this.opts.uriResolver,n);let r=(0,o.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&s===r)return g.call(this,n,e);const i=(0,o.normalizeId)(s),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,n,t)}if("object"==typeof(null==a?void 0:a.schema)){if(a.validate||u.call(this,a),i===(0,o.normalizeId)(t)){const{schema:t}=a,{schemaId:n}=this.opts,s=t[n];return s&&(r=(0,o.resolveUrl)(this.opts.uriResolver,r,s)),new c({schema:t,schemaId:n,root:e,baseId:r})}return g.call(this,n,a)}}t.SchemaEnv=c,t.compileSchema=u,t.resolveRef=function(e,t,n){var s;n=(0,o.resolveUrl)(this.opts.uriResolver,t,n);const r=e.refs[n];if(r)return r;let i=m.call(this,e,n);if(void 0===i){const r=null===(s=e.localRefs)||void 0===s?void 0:s[n],{schemaId:o}=this.opts;r&&(i=new c({schema:r,schemaId:o,root:e,baseId:t}))}return void 0!==i?e.refs[n]=h.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:n,root:s}){var r;if("/"!==(null===(r=e.fragment)||void 0===r?void 0:r[0]))return;for(const s of e.fragment.slice(1).split("/")){if("boolean"==typeof n)return;const e=n[(0,a.unescapeFragment)(s)];if(void 0===e)return;const r="object"==typeof(n=e)&&n[this.opts.schemaId];!f.has(s)&&r&&(t=(0,o.resolveUrl)(this.opts.uriResolver,t,r))}let i;if("boolean"!=typeof n&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){const e=(0,o.resolveUrl)(this.opts.uriResolver,t,n.$ref);i=p.call(this,s,e)}const{schemaId:l}=this.opts;return i=i||new c({schema:n,schemaId:l,root:s,baseId:t}),i.schema!==i.root.schema?i:void 0}},2141:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r={data:new s.Name("data"),valCxt:new s.Name("valCxt"),instancePath:new s.Name("instancePath"),parentData:new s.Name("parentData"),parentDataProperty:new s.Name("parentDataProperty"),rootData:new s.Name("rootData"),dynamicAnchors:new s.Name("dynamicAnchors"),vErrors:new s.Name("vErrors"),errors:new s.Name("errors"),this:new s.Name("this"),self:new s.Name("self"),scope:new s.Name("scope"),json:new s.Name("json"),jsonPos:new s.Name("jsonPos"),jsonLen:new s.Name("jsonLen"),jsonPart:new s.Name("jsonPart")};t.default=r},6646:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(2531);class r extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`),this.missingRef=(0,s.resolveUrl)(e,t,n),this.missingSchema=(0,s.normalizeId)((0,s.getFullPath)(e,this.missingRef))}}t.default=r},2531:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;const s=n(6776),r=n(4063),i=n(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 n=e[t];if(Array.isArray(n)&&n.some(l))return!0;if("object"==typeof n&&l(n))return!0}return!1}function c(e){let t=0;for(const n in e){if("$ref"===n)return 1/0;if(t++,!o.has(n)&&("object"==typeof e[n]&&(0,s.eachItem)(e[n],(e=>t+=c(e))),t===1/0))return 1/0}return t}function u(e,t="",n){!1!==n&&(t=m(t));const s=e.parse(t);return h(e,s)}function h(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=u,t._getFullPath=h;const d=/#\/?$/;function m(e){return e?e.replace(d,""):""}t.normalizeId=m,t.resolveUrl=function(e,t,n){return n=m(n),e.resolve(t,n)};const p=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:n,uriResolver:s}=this.opts,o=m(e[n]||t),a={"":o},l=u(s,o,!1),c={},h=new Set;return i(e,{allKeys:!0},((e,t,s,r)=>{if(void 0===r)return;const i=l+t;let o=a[r];function u(t){const n=this.opts.uriResolver.resolve;if(t=m(o?n(o,t):t),h.has(t))throw f(t);h.add(t);let s=this.refs[t];return"string"==typeof s&&(s=this.refs[s]),"object"==typeof s?d(e,s.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}"`);u.call(this,`#${e}`)}}"string"==typeof e[n]&&(o=u.call(this,e[n])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),a[t]=o})),c;function d(e,t,n){if(void 0!==t&&!r(e,t))throw f(n)}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 n=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&n.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,n)=>{"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 s=n(3487),r=n(7023);function i(e,t=e.schema){const{opts:n,self:s}=e;if(!n.strictSchema)return;if("boolean"==typeof t)return;const r=s.RULES.keywords;for(const n in t)r[n]||p(e,`unknown keyword: "${n}"`)}function o(e,t){if("boolean"==typeof e)return!e;for(const n in e)if(t[n])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:n,resultToName:r}){return(i,o,a,l)=>{const c=void 0===a?o:a instanceof s.Name?(o instanceof s.Name?e(i,o,a):t(i,o,a),a):o instanceof s.Name?(t(i,a,o),o):n(o,a);return l!==s.Name||c instanceof s.Name?c:r(i,c)}}function u(e,t){if(!0===t)return e.var("props",!0);const n=e.var("props",s._`{}`);return void 0!==t&&h(e,n,t),n}function h(e,t,n){Object.keys(n).forEach((n=>e.assign(s._`${t}${(0,s.getProperty)(n)}`,!0)))}t.toHash=function(e){const t={};for(const n of e)t[n]=!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 n in e)if("$ref"!==n&&t.all[n])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},n,r,i){if(!i){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return s._`${n}`}return s._`${e}${t}${(0,s.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 n of e)t(n);else t(e)},t.mergeEvaluated={props:c({mergeNames:(e,t,n)=>e.if(s._`${n} !== true && ${t} !== undefined`,(()=>{e.if(s._`${t} === true`,(()=>e.assign(n,!0)),(()=>e.assign(n,s._`${n} || {}`).code(s._`Object.assign(${n}, ${t})`)))})),mergeToName:(e,t,n)=>e.if(s._`${n} !== true`,(()=>{!0===t?e.assign(n,!0):(e.assign(n,s._`${n} || {}`),h(e,n,t))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:u}),items:c({mergeNames:(e,t,n)=>e.if(s._`${n} !== true && ${t} !== undefined`,(()=>e.assign(n,s._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`))),mergeToName:(e,t,n)=>e.if(s._`${n} !== true`,(()=>e.assign(n,!0===t||s._`${n} > ${t} ? ${n} : ${t}`))),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=u,t.setEvaluated=h;const d={};var m;function p(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,!0===n)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,n){if(e instanceof s.Name){const r=t===m.Num;return n?r?s._`"[" + ${e} + "]"`:s._`"['" + ${e} + "']"`:r?s._`"/" + ${e}`:s._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,s.getProperty)(e).toString():"/"+a(e)},t.checkStrictMode=p},8876:(e,t)=>{"use strict";function n(e,t){return t.rules.some((t=>s(e,t)))}function s(e,t){var n;return void 0!==e[t.keyword]||(null===(n=t.definition.implements)||void 0===n?void 0:n.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},s){const r=t.RULES.types[s];return r&&!0!==r&&n(e,r)},t.shouldUseGroup=n,t.shouldUseRule=s},5667:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const s=n(4181),r=n(3487),i=n(2141),o={message:"boolean schema is false"};function a(e,t){const{gen:n,data:r}=e,i={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,s.reportError)(i,o,void 0,t)}t.topBoolOrEmptySchema=function(e){const{gen:t,schema:n,validateName:s}=e;!1===n?a(e,!1):"object"==typeof n&&!0===n.$async?t.return(i.default.data):(t.assign(r._`${s}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){const{gen:n,schema:s}=e;!1===s?(n.var(t,!1),a(e)):n.var(t,!0)}},453:(e,t,n)=>{"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 s=n(3141),r=n(8876),i=n(4181),o=n(3487),a=n(6776);var l;function c(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(s.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:n,data:s,opts:i}=e,a=function(e,t){return t?e.filter((e=>u.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,s,i.strictNumbers,l.Wrong);n.if(r,(()=>{a.length?function(e,t,n){const{gen:s,data:r,opts:i}=e,a=s.let("dataType",o._`typeof ${r}`),l=s.let("coerced",o._`undefined`);"array"===i.coerceTypes&&s.if(o._`${a} == 'object' && Array.isArray(${r}) && ${r}.length == 1`,(()=>s.assign(r,o._`${r}[0]`).assign(a,o._`typeof ${r}`).if(d(t,r,i.strictNumbers),(()=>s.assign(l,r))))),s.if(o._`${l} !== undefined`);for(const e of n)(u.has(e)||"array"===e&&"array"===i.coerceTypes)&&c(e);function c(e){switch(e){case"string":return void s.elseIf(o._`${a} == "number" || ${a} == "boolean"`).assign(l,o._`"" + ${r}`).elseIf(o._`${r} === null`).assign(l,o._`""`);case"number":return void s.elseIf(o._`${a} == "boolean" || ${r} === null
|
|
3
3
|
|| (${a} == "string" && ${r} && ${r} == +${r})`).assign(l,o._`+${r}`);case"integer":return void s.elseIf(o._`${a} === "boolean" || ${r} === null
|
|
4
4
|
|| (${a} === "string" && ${r} && ${r} == +${r} && !(${r} % 1))`).assign(l,o._`+${r}`);case"boolean":return void s.elseIf(o._`${r} === "false" || ${r} === 0 || ${r} === null`).assign(l,!1).elseIf(o._`${r} === "true" || ${r} === 1`).assign(l,!0);case"null":return s.elseIf(o._`${r} === "" || ${r} === 0 || ${r} === false`),void s.assign(l,null);case"array":s.elseIf(o._`${a} === "string" || ${a} === "number"
|
|
5
|
-
|| ${a} === "boolean" || ${r} === null`).assign(l,o._`[${r}]`)}}s.else(),p(e),s.endIf(),s.if(o._`${l} !== undefined`,(()=>{s.assign(r,l),function({gen:e,parentData:t,parentDataProperty:n},s){e.if(o._`${t} !== undefined`,(()=>e.assign(o._`${t}[${n}]`,s)))}(e,l)}))}(e,t,a):p(e)}))}return c};const u=new Set(["string","number","integer","boolean","null"]);function h(e,t,n,s=l.Correct){const r=s===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 s===l.Correct?i:(0,o.not)(i);function a(e=o.nil){return(0,o.and)(o._`typeof ${t} == "number"`,e,n?o._`isFinite(${t})`:o.nil)}}function d(e,t,n,s){if(1===e.length)return h(e[0],t,n,s);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,h(e,t,n,s));return r}t.checkDataType=h,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:n,schema:s}=e,r=(0,a.schemaRefOrVal)(e,s,"type");return{gen:t,keyword:"type",data:n,schema:s.type,schemaCode:r,schemaValue:r,parentSchema:s,params:{},it:e}}(e);(0,i.reportError)(t,m)}t.reportTypeError=p},313:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;const s=n(3487),r=n(6776);function i(e,t,n){const{gen:i,compositeRule:o,data:a,opts:l}=e;if(void 0===n)return;const c=s._`${a}${(0,s.getProperty)(t)}`;if(o)return void(0,r.checkStrictMode)(e,`default is ignored for: ${c}`);let u=s._`${c} === undefined`;"empty"===l.useDefaults&&(u=s._`${u} || ${c} === null || ${c} === ""`),i.if(u,s._`${c} = ${(0,s.stringify)(n)}`)}t.assignDefaults=function(e,t){const{properties:n,items:s}=e.schema;if("object"===t&&n)for(const t in n)i(e,t,n[t].default);else"array"===t&&Array.isArray(s)&&s.forEach(((t,n)=>i(e,n,t.default)))}},4815:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const s=n(5667),r=n(453),i=n(8876),o=n(453),a=n(313),l=n(5005),c=n(3099),u=n(3487),h=n(2141),d=n(2531),m=n(6776),p=n(4181);function f({gen:e,validateName:t,schema:n,schemaEnv:s,opts:r},i){r.code.es5?e.func(t,u._`${h.default.data}, ${h.default.valCxt}`,s.$async,(()=>{e.code(u._`"use strict"; ${g(n,r)}`),function(e,t){e.if(h.default.valCxt,(()=>{e.var(h.default.instancePath,u._`${h.default.valCxt}.${h.default.instancePath}`),e.var(h.default.parentData,u._`${h.default.valCxt}.${h.default.parentData}`),e.var(h.default.parentDataProperty,u._`${h.default.valCxt}.${h.default.parentDataProperty}`),e.var(h.default.rootData,u._`${h.default.valCxt}.${h.default.rootData}`),t.dynamicRef&&e.var(h.default.dynamicAnchors,u._`${h.default.valCxt}.${h.default.dynamicAnchors}`)}),(()=>{e.var(h.default.instancePath,u._`""`),e.var(h.default.parentData,u._`undefined`),e.var(h.default.parentDataProperty,u._`undefined`),e.var(h.default.rootData,h.default.data),t.dynamicRef&&e.var(h.default.dynamicAnchors,u._`{}`)}))}(e,r),e.code(i)})):e.func(t,u._`${h.default.data}, ${function(e){return u._`{${h.default.instancePath}="", ${h.default.parentData}, ${h.default.parentDataProperty}, ${h.default.rootData}=${h.default.data}${e.dynamicRef?u._`, ${h.default.dynamicAnchors}={}`:u.nil}}={}`}(r)}`,s.$async,(()=>e.code(g(n,r)).code(i)))}function g(e,t){const n="object"==typeof e&&e[t.schemaId];return n&&(t.code.source||t.code.process)?u._`/*# sourceURL=${n} */`:u.nil}function y({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const n in e)if(t.RULES.all[n])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:n,opts:s,self:r}=e;t.$ref&&s.ignoreKeywordsWithRef&&(0,m.schemaHasRulesButRef)(t,r.RULES)&&r.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}(e)}function A(e,t){if(e.opts.jtd)return v(e,[],!1,t);const n=(0,r.getSchemaTypes)(e.schema);v(e,n,!(0,r.coerceAndCheckDataType)(e,n),t)}function C({gen:e,schemaEnv:t,schema:n,errSchemaPath:s,opts:r}){const i=n.$comment;if(!0===r.$comment)e.code(u._`${h.default.self}.logger.log(${i})`);else if("function"==typeof r.$comment){const n=u.str`${s}/$comment`,r=e.scopeValue("root",{ref:t.root});e.code(u._`${h.default.self}.opts.$comment(${i}, ${n}, ${r}.schema)`)}}function v(e,t,n,s){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)),T(e,m),1===t.length&&t[0]===m.type&&n&&(r.else(),(0,o.reportTypeError)(e)),r.endIf()):T(e,m),c||r.if(u._`${h.default.errors} === ${s||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(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),function(e,t){const n=[];for(const s of e.dataTypes)S(t,s)?n.push(s):t.includes("integer")&&"number"===s&&n.push("integer");e.dataTypes=n}(e,t)):e.dataTypes=t)}(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&E(e,"use allowUnionTypes to allow union type keyword")}(e,t),function(e,t){const n=e.self.RULES.all;for(const s in n){const r=n[s];if("object"==typeof r&&(0,i.shouldUseRule)(e.schema,r)){const{type:n}=r.definition;n.length&&!n.some((e=>{return s=e,(n=t).includes(s)||"number"===s&&n.includes("integer");var n,s}))&&E(e,`missing type "${n.join(",")}" for keyword "${s}"`)}}}(e,e.dataTypes))}(e,t),r.block((()=>{for(const e of f.rules)g(e);g(f.post)}))):r.block((()=>x(e,"$ref",f.all.$ref.definition)))}function T(e,t){const{gen:n,schema:s,opts:{useDefaults:r}}=e;r&&(0,a.assignDefaults)(e,t.type),n.block((()=>{for(const n of t.rules)(0,i.shouldUseRule)(s,n)&&x(e,n.keyword,n.definition,t.type)}))}function S(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function E(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:n,gen:s}=e;f(e,(()=>{n.$comment&&t.$comment&&C(e),function(e){const{schema:t,opts:n}=e;void 0!==t.default&&n.useDefaults&&n.strictSchema&&(0,m.checkStrictMode)(e,"default is ignored in the schema root")}(e),s.let(h.default.vErrors,null),s.let(h.default.errors,0),n.unevaluated&&function(e){const{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",u._`${n}.evaluated`),t.if(u._`${e.evaluated}.dynamicProps`,(()=>t.assign(u._`${e.evaluated}.props`,u._`undefined`))),t.if(u._`${e.evaluated}.dynamicItems`,(()=>t.assign(u._`${e.evaluated}.items`,u._`undefined`)))}(e),A(e),function(e){const{gen:t,schemaEnv:n,validateName:s,ValidationError:r,opts:i}=e;n.$async?t.if(u._`${h.default.errors} === 0`,(()=>t.return(h.default.data)),(()=>t.throw(u._`new ${r}(${h.default.vErrors})`))):(t.assign(u._`${s}.errors`,h.default.vErrors),i.unevaluated&&function({gen:e,evaluated:t,props:n,items:s}){n instanceof u.Name&&e.assign(u._`${t}.props`,n),s instanceof u.Name&&e.assign(u._`${t}.items`,s)}(e),t.return(u._`${h.default.errors} === 0`))}(e)}))}(e):f(e,(()=>(0,s.topBoolOrEmptySchema)(e)))};class _{constructor(e,t,n){if((0,l.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,m.schemaRefOrVal)(e,this.schema,n,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(`${n} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",h.default.errors))}result(e,t,n){this.failResult((0,u.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():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,u.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(u._`${t} !== undefined && (${(0,u.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t)return this.setParams(t),this._error(e,n),void this.setParams({});this._error(e,n)}_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,n=u.nil){this.gen.block((()=>{this.check$data(e,n),t()}))}check$data(e=u.nil,t=u.nil){if(!this.$data)return;const{gen:n,schemaCode:s,schemaType:r,def:i}=this;n.if((0,u.or)(u._`${s} === undefined`,t)),e!==u.nil&&n.assign(e,!0),(r.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==u.nil&&n.assign(e,!1)),n.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:n,def:s,it:r}=this;return(0,u.or)(function(){if(n.length){if(!(t instanceof u.Name))throw new Error("ajv implementation error");const e=Array.isArray(n)?n:[n];return u._`${(0,o.checkDataTypes)(e,t,r.opts.strictNumbers,o.DataType.Wrong)}`}return u.nil}(),function(){if(s.validateSchema){const n=e.scopeValue("validate$data",{ref:s.validateSchema});return u._`!${n}(${t})`}return u.nil}())}subschema(e,t){const n=(0,c.getSubschema)(this.it,e);(0,c.extendSubschemaData)(n,this.it,e),(0,c.extendSubschemaMode)(n,e);const r={...this.it,...n,items:void 0,props:void 0};return function(e,t){w(e)&&(b(e),y(e))?function(e,t){const{schema:n,gen:s,opts:r}=e;r.$comment&&n.$comment&&C(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=s.const("_errs",h.default.errors);A(e,i),s.var(t,u._`${i} === ${h.default.errors}`)}(e,t):(0,s.boolOrEmptySchema)(e,t)}(r,t),r}mergeEvaluated(e,t){const{it:n,gen:s}=this;n.opts.unevaluated&&(!0!==n.props&&void 0!==e.props&&(n.props=m.mergeEvaluated.props(s,e.props,n.props,t)),!0!==n.items&&void 0!==e.items&&(n.items=m.mergeEvaluated.items(s,e.items,n.items,t)))}mergeValidEvaluated(e,t){const{it:n,gen:s}=this;if(n.opts.unevaluated&&(!0!==n.props||!0!==n.items))return s.if(t,(()=>this.mergeEvaluated(e,u.Name))),!0}}function x(e,t,n,s){const r=new _(e,n,t);"code"in n?n.code(r,s):r.$data&&n.validate?(0,l.funcKeywordCode)(r,n):"macro"in n?(0,l.macroKeywordCode)(r,n):(n.compile||n.validate)&&(0,l.funcKeywordCode)(r,n)}t.KeywordCxt=_;const P=/^\/(?:[^~]|~0|~1)*$/,$=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function N(e,{dataLevel:t,dataNames:n,dataPathArr:s}){let r,i;if(""===e)return h.default.rootData;if("/"===e[0]){if(!P.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);r=e,i=h.default.rootData}else{const o=$.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 s[t-a]}if(a>t)throw new Error(l("data",a));if(i=n[t-a],!r)return i}let o=i;const a=r.split("/");for(const e of a)e&&(i=u._`${i}${(0,u.getProperty)((0,m.unescapeJsonPointer)(e))}`,o=u._`${o} && ${i}`);return o;function l(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}t.getData=N},5005:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const s=n(3487),r=n(2141),i=n(412),o=n(4181);function a(e){const{gen:t,data:n,it:r}=e;t.if(r.parentData,(()=>t.assign(n,s._`${r.parentData}[${r.parentDataProperty}]`)))}function l(e,t,n){if(void 0===n)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,s.stringify)(n)})}t.macroKeywordCode=function(e,t){const{gen:n,keyword:r,schema:i,parentSchema:o,it:a}=e,c=t.macro.call(a.self,i,o,a),u=l(n,r,c);!1!==a.opts.validateSchema&&a.self.validateSchema(c,!0);const h=n.name("valid");e.subschema({schema:c,schemaPath:s.nil,errSchemaPath:`${a.errSchemaPath}/${r}`,topSchemaRef:u,compositeRule:!0},h),e.pass(h,(()=>e.error(!0)))},t.funcKeywordCode=function(e,t){var n;const{gen:c,keyword:u,schema:h,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,h,d,p):t.validate,g=l(c,u,f),y=c.let("valid");function w(n=(t.async?s._`await `:s.nil)){const o=p.opts.passContext?r.default.this:r.default.self,a=!("compile"in t&&!m||!1===t.schema);c.assign(y,s._`${n}${(0,i.callValidateCode)(e,g,o,a)}`,t.modifying)}function b(e){var n;c.if((0,s.not)(null!==(n=t.valid)&&void 0!==n?n:y),e)}e.block$data(y,(function(){if(!1===t.errors)w(),t.modifying&&a(e),b((()=>e.error()));else{const n=t.async?function(){const e=c.let("ruleErrs",null);return c.try((()=>w(s._`await `)),(t=>c.assign(y,!1).if(s._`${t} instanceof ${p.ValidationError}`,(()=>c.assign(e,s._`${t}.errors`)),(()=>c.throw(t))))),e}():function(){const e=s._`${g}.errors`;return c.assign(e,null),w(s.nil),e}();t.modifying&&a(e),b((()=>function(e,t){const{gen:n}=e;n.if(s._`Array.isArray(${t})`,(()=>{n.assign(r.default.vErrors,s._`${r.default.vErrors} === null ? ${t} : ${r.default.vErrors}.concat(${t})`).assign(r.default.errors,s._`${r.default.vErrors}.length`),(0,o.extendErrors)(e)}),(()=>e.error()))}(e,n)))}})),e.ok(null!==(n=t.valid)&&void 0!==n?n:y)},t.validSchemaType=function(e,t,n=!1){return!t.length||t.some((t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||n&&void 0===e))},t.validateKeywordUsage=function({schema:e,opts:t,self:n,errSchemaPath:s},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 "${s}": `+n.errorsText(r.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);n.logger.error(e)}}},3099:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;const s=n(3487),r=n(6776);t.getSubschema=function(e,{keyword:t,schemaProp:n,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===n?{schema:i,schemaPath:s._`${e.schemaPath}${(0,s.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:i[n],schemaPath:s._`${e.schemaPath}${(0,s.getProperty)(t)}${(0,s.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,r.escapeFragment)(n)}`}}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:n,dataPropType:i,data:o,dataTypes:a,propertyName:l}){if(void 0!==o&&void 0!==n)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:c}=t;if(void 0!==n){const{errorPath:o,dataPathArr:a,opts:l}=t;u(c.let("data",s._`${t.data}${(0,s.getProperty)(n)}`,!0)),e.errorPath=s.str`${o}${(0,r.getErrorPath)(n,i,l.jsPropertySyntax)}`,e.parentDataProperty=s._`${n}`,e.dataPathArr=[...a,e.parentDataProperty]}function u(n){e.data=n,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,n]}void 0!==o&&(u(o instanceof s.Name?o:c.let("data",o,!0)),void 0!==l&&(e.propertyName=l)),a&&(e.dataTypes=a)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:s,createErrors:r,allErrors:i}){void 0!==s&&(e.compositeRule=s),void 0!==r&&(e.createErrors=r),void 0!==i&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=n}},7159:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var s=n(4815);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return s.KeywordCxt}});var r=n(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=n(7426),o=n(6646),a=n(3141),l=n(5173),c=n(3487),u=n(2531),h=n(453),d=n(6776),m=n(4775),p=n(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.'},A=200;function C(e){var t,n,s,r,i,o,a,l,c,u,h,d,m,g,y,w,b,C,v,T,S,E,_,x,P;const $=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!==(s=null===(n=e.code)||void 0===n?void 0:n.regExp)&&void 0!==s?s:f,I=null!==(r=e.uriResolver)&&void 0!==r?r:p.default;return{strictSchema:null===(o=null!==(i=e.strictSchema)&&void 0!==i?i:$)||void 0===o||o,strictNumbers:null===(l=null!==(a=e.strictNumbers)&&void 0!==a?a:$)||void 0===l||l,strictTypes:null!==(u=null!==(c=e.strictTypes)&&void 0!==c?c:$)&&void 0!==u?u:"log",strictTuples:null!==(d=null!==(h=e.strictTuples)&&void 0!==h?h:$)&&void 0!==d?d:"log",strictRequired:null!==(g=null!==(m=e.strictRequired)&&void 0!==m?m:$)&&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:A,loopEnum:null!==(w=e.loopEnum)&&void 0!==w?w:A,meta:null===(b=e.meta)||void 0===b||b,messages:null===(C=e.messages)||void 0===C||C,inlineRefs:null===(v=e.inlineRefs)||void 0===v||v,schemaId:null!==(T=e.schemaId)&&void 0!==T?T:"$id",addUsedSchema:null===(S=e.addUsedSchema)||void 0===S||S,validateSchema:null===(E=e.validateSchema)||void 0===E||E,validateFormats:null===(_=e.validateFormats)||void 0===_||_,unicodeRegExp:null===(x=e.unicodeRegExp)||void 0===x||x,int32range:null===(P=e.int32range)||void 0===P||P,uriResolver:I}}class v{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...C(e)};const{es5:t,lines:n}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:y,es5:t,lines:n}),this.logger=function(e){if(!1===e)return $;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 s=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),T.call(this,w,e,"NOT SUPPORTED"),T.call(this,b,e,"DEPRECATED","warn"),this._metaOpts=P.call(this),e.formats&&_.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&x.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),E.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:n}=this.opts;let s=m;"id"===n&&(s={...m},s.id=s.$id,delete s.$id),t&&e&&this.addMetaSchema(s,s[n],!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 n;if("string"==typeof e){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);const s=n(t);return"$async"in n||(this.errors=n.errors),s}compile(e,t){const n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:n}=this.opts;return s.call(this,e,t);async function s(e,t){await r.call(this,e.$schema);const n=this._addSchema(e,t);return n.validate||i.call(this,n)}async function r(e){e&&!this.getSchema(e)&&await s.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 n=await c.call(this,e);this.refs[e]||await r.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function c(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,s=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,n,s);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,u.normalizeId)(t||r),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,s,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let n;if(n=e.$schema,void 0!==n&&"string"!=typeof n)throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const s=this.validate(n,e);if(!s&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return s}getSchema(e){let t;for(;"string"==typeof(t=S.call(this,e));)e=t;if(void 0===t){const{schemaId:n}=this.opts,s=new l.SchemaEnv({schema:{},schemaId:n});if(t=l.resolveSchema.call(this,s,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 n=e[this.opts.schemaId];return n&&(n=(0,u.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),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 n;if("string"==typeof e)n=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(n=(t=e).keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(M.call(this,n,t),!t)return(0,d.eachItem)(n,(e=>L.call(this,e))),this;R.call(this,t);const s={...t,type:(0,h.getJSONTypes)(t.type),schemaType:(0,h.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(n,0===s.type.length?e=>L.call(this,e,s):e=>s.type.forEach((t=>L.call(this,e,s,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 n of t.rules){const t=n.rules.findIndex((t=>t.keyword===e));t>=0&&n.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:n="data"}={}){return e&&0!==e.length?e.map((e=>`${n}${e.instancePath} ${e.message}`)).reduce(((e,n)=>e+t+n)):"No errors"}$dataMetaSchema(e,t){const n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const s of t){const t=s.split("/").slice(1);let r=e;for(const e of t)r=r[e];for(const e in n){const t=n[e];if("object"!=typeof t)continue;const{$data:s}=t.definition,i=r[e];s&&i&&(r[e]=F(i))}}return e}_removeAllSchemas(e,t){for(const n in e){const s=e[n];t&&!t.test(n)||("string"==typeof s?delete e[n]:s&&!s.meta&&(this._cache.delete(s.schema),delete e[n]))}}_addSchema(e,t,n,s=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;n=(0,u.normalizeId)(i||n);const c=u.getSchemaRefs.call(this,e,n);return a=new l.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:n,localRefs:c}),this._cache.set(a.schema,a),r&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=a),s&&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 T(e,t,n,s="error"){for(const r in e){const i=r;i in t&&this.logger[s](`${n}: option ${r}. ${e[i]}`)}}function S(e){return e=(0,u.normalizeId)(e),this.schemas[e]||this.refs[e]}function E(){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 _(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function x(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 n=e[t];n.keyword||(n.keyword=t),this.addKeyword(n)}}}function P(){const e={...this.opts};for(const t of g)delete e[t];return e}t.default=v,v.ValidationError=i.default,v.MissingRefError=o.default;const $={log(){},warn(){},error(){}},N=/^[a-z_$][a-z0-9_$:-]*$/i;function M(e,t){const{RULES:n}=this;if((0,d.eachItem)(e,(e=>{if(n.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,n){var s;const r=null==t?void 0:t.post;if(n&&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===n));if(o||(o={type:n,rules:[]},i.rules.push(o)),i.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,h.getJSONTypes)(t.type),schemaType:(0,h.getJSONTypes)(t.schemaType)}};t.before?I.call(this,o,a,t.before):o.rules.push(a),i.all[e]=a,null===(s=t.implements)||void 0===s||s.forEach((e=>this.addKeyword(e)))}function I(e,t,n){const s=e.rules.findIndex((e=>e.keyword===n));s>=0?e.rules.splice(s,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function R(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=F(t)),e.validateSchema=this.compile(t,!0))}const O={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function F(e){return{anyOf:[e,O]}}},4087:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(2577),r=n(996),i=n(5568),o=n(6795),a=n(235),l=n(2567),c=n(1233),u=n(1968),h=["/properties"];t.default=function(e){return[s,r,i,o,a,t(this,l),c,t(this,u)].forEach((e=>this.addMetaSchema(e,void 0,!1))),this;function t(t,n){return e?t.$dataMetaSchema(n,h):n}}},3510:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(4063);s.code='require("ajv/dist/runtime/equal").default',t.default=s},4499:(e,t)=>{"use strict";function n(e){const t=e.length;let n,s=0,r=0;for(;r<t;)s++,n=e.charCodeAt(r++),n>=55296&&n<=56319&&r<t&&(n=e.charCodeAt(r),56320==(64512&n)&&r++);return s}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,n.code='require("ajv/dist/runtime/ucs2length").default'},3589:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(540);s.code='require("ajv/dist/runtime/uri").default',t.default=s},7426:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}t.default=n},4783:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;const s=n(3487),r=n(6776),i={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>s.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>s._`{limit: ${e}}`},code(e){const{parentSchema:t,it:n}=e,{items:s}=t;Array.isArray(s)?o(e,s):(0,r.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}};function o(e,t){const{gen:n,schema:i,data:o,keyword:a,it:l}=e;l.items=!0;const c=n.const("len",s._`${o}.length`);if(!1===i)e.setParams({len:t.length}),e.pass(s._`${c} <= ${t.length}`);else if("object"==typeof i&&!(0,r.alwaysValidSchema)(l,i)){const i=n.var("valid",s._`${c} <= ${t.length}`);n.if((0,s.not)(i),(()=>function(i){n.forRange("i",t.length,c,(t=>{e.subschema({keyword:a,dataProp:t,dataPropType:r.Type.Num},i),l.allErrors||n.if((0,s.not)(i),(()=>n.break()))}))}(i))),e.ok(i)}}t.validateAdditionalItems=o,t.default=i},9351:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(412),r=n(3487),i=n(2141),o=n(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:n,parentSchema:a,data:l,errsCount:c,it:u}=e;if(!c)throw new Error("ajv implementation error");const{allErrors:h,opts:d}=u;if(u.props=!0,"all"!==d.removeAdditional&&(0,o.alwaysValidSchema)(u,n))return;const m=(0,s.allSchemaProperties)(a.properties),p=(0,s.allSchemaProperties)(a.patternProperties);function f(e){t.code(r._`delete ${l}[${e}]`)}function g(s){if("all"===d.removeAdditional||d.removeAdditional&&!1===n)f(s);else{if(!1===n)return e.setParams({additionalProperty:s}),e.error(),void(h||t.break());if("object"==typeof n&&!(0,o.alwaysValidSchema)(u,n)){const n=t.name("valid");"failing"===d.removeAdditional?(y(s,n,!1),t.if((0,r.not)(n),(()=>{e.reset(),f(s)}))):(y(s,n),h||t.if((0,r.not)(n),(()=>t.break())))}}}function y(t,n,s){const r={keyword:"additionalProperties",dataProp:t,dataPropType:o.Type.Str};!1===s&&Object.assign(r,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(r,n)}t.forIn("key",l,(n=>{m.length||p.length?t.if(function(n){let i;if(m.length>8){const e=(0,o.schemaRefOrVal)(u,a.properties,"properties");i=(0,s.isOwnProperty)(t,e,n)}else i=m.length?(0,r.or)(...m.map((e=>r._`${n} === ${e}`))):r.nil;return p.length&&(i=(0,r.or)(i,...p.map((t=>r._`${(0,s.usePattern)(e,t)}.test(${n})`)))),(0,r.not)(i)}(n),(()=>g(n))):g(n)})),e.ok(r._`${c} === ${i.default.errors}`)}};t.default=a},1125:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(6776),r={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");const i=t.name("valid");n.forEach(((t,n)=>{if((0,s.alwaysValidSchema)(r,t))return;const o=e.subschema({keyword:"allOf",schemaProp:n},i);e.ok(i),e.mergeEvaluated(o)}))}};t.default=r},19:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:n(412).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=s},9864:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?s.str`must contain at least ${e} valid item(s)`:s.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?s._`{minContains: ${e}}`:s._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:n,parentSchema:i,data:o,it:a}=e;let l,c;const{minContains:u,maxContains:h}=i;a.opts.next?(l=void 0===u?1:u,c=h):l=1;const d=t.const("len",s._`${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,n)){let t=s._`${d} >= ${l}`;return void 0!==c&&(t=s._`${t} && ${d} <= ${c}`),void e.pass(t)}a.items=!0;const m=t.name("valid");function p(){const e=t.name("_valid"),n=t.let("count",0);f(e,(()=>t.if(e,(()=>function(e){t.code(s._`${e}++`),void 0===c?t.if(s._`${e} >= ${l}`,(()=>t.assign(m,!0).break())):(t.if(s._`${e} > ${c}`,(()=>t.assign(m,!1).break())),1===l?t.assign(m,!0):t.if(s._`${e} >= ${l}`,(()=>t.assign(m,!0))))}(n)))))}function f(n,s){t.forRange("i",0,d,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:r.Type.Num,compositeRule:!0},n),s()}))}void 0===c&&1===l?f(m,(()=>t.if(m,(()=>t.break())))):0===l?(t.let(m,!0),void 0!==c&&t.if(s._`${o}.length > 0`,p)):(t.let(m,!1),p()),e.result(m,(()=>e.reset()))}};t.default=i},7772:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const s=n(3487),r=n(6776),i=n(412);t.error={message:({params:{property:e,depsCount:t,deps:n}})=>{const r=1===t?"property":"properties";return s.str`must have ${r} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:n,missingProperty:r}})=>s._`{property: ${e},
|
|
5
|
+
|| ${a} === "boolean" || ${r} === null`).assign(l,o._`[${r}]`)}}s.else(),p(e),s.endIf(),s.if(o._`${l} !== undefined`,(()=>{s.assign(r,l),function({gen:e,parentData:t,parentDataProperty:n},s){e.if(o._`${t} !== undefined`,(()=>e.assign(o._`${t}[${n}]`,s)))}(e,l)}))}(e,t,a):p(e)}))}return c};const u=new Set(["string","number","integer","boolean","null"]);function h(e,t,n,s=l.Correct){const r=s===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 s===l.Correct?i:(0,o.not)(i);function a(e=o.nil){return(0,o.and)(o._`typeof ${t} == "number"`,e,n?o._`isFinite(${t})`:o.nil)}}function d(e,t,n,s){if(1===e.length)return h(e[0],t,n,s);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,h(e,t,n,s));return r}t.checkDataType=h,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:n,schema:s}=e,r=(0,a.schemaRefOrVal)(e,s,"type");return{gen:t,keyword:"type",data:n,schema:s.type,schemaCode:r,schemaValue:r,parentSchema:s,params:{},it:e}}(e);(0,i.reportError)(t,m)}t.reportTypeError=p},313:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;const s=n(3487),r=n(6776);function i(e,t,n){const{gen:i,compositeRule:o,data:a,opts:l}=e;if(void 0===n)return;const c=s._`${a}${(0,s.getProperty)(t)}`;if(o)return void(0,r.checkStrictMode)(e,`default is ignored for: ${c}`);let u=s._`${c} === undefined`;"empty"===l.useDefaults&&(u=s._`${u} || ${c} === null || ${c} === ""`),i.if(u,s._`${c} = ${(0,s.stringify)(n)}`)}t.assignDefaults=function(e,t){const{properties:n,items:s}=e.schema;if("object"===t&&n)for(const t in n)i(e,t,n[t].default);else"array"===t&&Array.isArray(s)&&s.forEach(((t,n)=>i(e,n,t.default)))}},4815:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const s=n(5667),r=n(453),i=n(8876),o=n(453),a=n(313),l=n(5005),c=n(3099),u=n(3487),h=n(2141),d=n(2531),m=n(6776),p=n(4181);function f({gen:e,validateName:t,schema:n,schemaEnv:s,opts:r},i){r.code.es5?e.func(t,u._`${h.default.data}, ${h.default.valCxt}`,s.$async,(()=>{e.code(u._`"use strict"; ${g(n,r)}`),function(e,t){e.if(h.default.valCxt,(()=>{e.var(h.default.instancePath,u._`${h.default.valCxt}.${h.default.instancePath}`),e.var(h.default.parentData,u._`${h.default.valCxt}.${h.default.parentData}`),e.var(h.default.parentDataProperty,u._`${h.default.valCxt}.${h.default.parentDataProperty}`),e.var(h.default.rootData,u._`${h.default.valCxt}.${h.default.rootData}`),t.dynamicRef&&e.var(h.default.dynamicAnchors,u._`${h.default.valCxt}.${h.default.dynamicAnchors}`)}),(()=>{e.var(h.default.instancePath,u._`""`),e.var(h.default.parentData,u._`undefined`),e.var(h.default.parentDataProperty,u._`undefined`),e.var(h.default.rootData,h.default.data),t.dynamicRef&&e.var(h.default.dynamicAnchors,u._`{}`)}))}(e,r),e.code(i)})):e.func(t,u._`${h.default.data}, ${function(e){return u._`{${h.default.instancePath}="", ${h.default.parentData}, ${h.default.parentDataProperty}, ${h.default.rootData}=${h.default.data}${e.dynamicRef?u._`, ${h.default.dynamicAnchors}={}`:u.nil}}={}`}(r)}`,s.$async,(()=>e.code(g(n,r)).code(i)))}function g(e,t){const n="object"==typeof e&&e[t.schemaId];return n&&(t.code.source||t.code.process)?u._`/*# sourceURL=${n} */`:u.nil}function y({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const n in e)if(t.RULES.all[n])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:n,opts:s,self:r}=e;t.$ref&&s.ignoreKeywordsWithRef&&(0,m.schemaHasRulesButRef)(t,r.RULES)&&r.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}(e)}function A(e,t){if(e.opts.jtd)return v(e,[],!1,t);const n=(0,r.getSchemaTypes)(e.schema);v(e,n,!(0,r.coerceAndCheckDataType)(e,n),t)}function C({gen:e,schemaEnv:t,schema:n,errSchemaPath:s,opts:r}){const i=n.$comment;if(!0===r.$comment)e.code(u._`${h.default.self}.logger.log(${i})`);else if("function"==typeof r.$comment){const n=u.str`${s}/$comment`,r=e.scopeValue("root",{ref:t.root});e.code(u._`${h.default.self}.opts.$comment(${i}, ${n}, ${r}.schema)`)}}function v(e,t,n,s){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)),T(e,m),1===t.length&&t[0]===m.type&&n&&(r.else(),(0,o.reportTypeError)(e)),r.endIf()):T(e,m),c||r.if(u._`${h.default.errors} === ${s||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(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),function(e,t){const n=[];for(const s of e.dataTypes)S(t,s)?n.push(s):t.includes("integer")&&"number"===s&&n.push("integer");e.dataTypes=n}(e,t)):e.dataTypes=t)}(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&E(e,"use allowUnionTypes to allow union type keyword")}(e,t),function(e,t){const n=e.self.RULES.all;for(const s in n){const r=n[s];if("object"==typeof r&&(0,i.shouldUseRule)(e.schema,r)){const{type:n}=r.definition;n.length&&!n.some((e=>{return s=e,(n=t).includes(s)||"number"===s&&n.includes("integer");var n,s}))&&E(e,`missing type "${n.join(",")}" for keyword "${s}"`)}}}(e,e.dataTypes))}(e,t),r.block((()=>{for(const e of f.rules)g(e);g(f.post)}))):r.block((()=>x(e,"$ref",f.all.$ref.definition)))}function T(e,t){const{gen:n,schema:s,opts:{useDefaults:r}}=e;r&&(0,a.assignDefaults)(e,t.type),n.block((()=>{for(const n of t.rules)(0,i.shouldUseRule)(s,n)&&x(e,n.keyword,n.definition,t.type)}))}function S(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function E(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:n,gen:s}=e;f(e,(()=>{n.$comment&&t.$comment&&C(e),function(e){const{schema:t,opts:n}=e;void 0!==t.default&&n.useDefaults&&n.strictSchema&&(0,m.checkStrictMode)(e,"default is ignored in the schema root")}(e),s.let(h.default.vErrors,null),s.let(h.default.errors,0),n.unevaluated&&function(e){const{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",u._`${n}.evaluated`),t.if(u._`${e.evaluated}.dynamicProps`,(()=>t.assign(u._`${e.evaluated}.props`,u._`undefined`))),t.if(u._`${e.evaluated}.dynamicItems`,(()=>t.assign(u._`${e.evaluated}.items`,u._`undefined`)))}(e),A(e),function(e){const{gen:t,schemaEnv:n,validateName:s,ValidationError:r,opts:i}=e;n.$async?t.if(u._`${h.default.errors} === 0`,(()=>t.return(h.default.data)),(()=>t.throw(u._`new ${r}(${h.default.vErrors})`))):(t.assign(u._`${s}.errors`,h.default.vErrors),i.unevaluated&&function({gen:e,evaluated:t,props:n,items:s}){n instanceof u.Name&&e.assign(u._`${t}.props`,n),s instanceof u.Name&&e.assign(u._`${t}.items`,s)}(e),t.return(u._`${h.default.errors} === 0`))}(e)}))}(e):f(e,(()=>(0,s.topBoolOrEmptySchema)(e)))};class _{constructor(e,t,n){if((0,l.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,m.schemaRefOrVal)(e,this.schema,n,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",$(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,l.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",h.default.errors))}result(e,t,n){this.failResult((0,u.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():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,u.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(u._`${t} !== undefined && (${(0,u.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t)return this.setParams(t),this._error(e,n),void this.setParams({});this._error(e,n)}_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,n=u.nil){this.gen.block((()=>{this.check$data(e,n),t()}))}check$data(e=u.nil,t=u.nil){if(!this.$data)return;const{gen:n,schemaCode:s,schemaType:r,def:i}=this;n.if((0,u.or)(u._`${s} === undefined`,t)),e!==u.nil&&n.assign(e,!0),(r.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==u.nil&&n.assign(e,!1)),n.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:n,def:s,it:r}=this;return(0,u.or)(function(){if(n.length){if(!(t instanceof u.Name))throw new Error("ajv implementation error");const e=Array.isArray(n)?n:[n];return u._`${(0,o.checkDataTypes)(e,t,r.opts.strictNumbers,o.DataType.Wrong)}`}return u.nil}(),function(){if(s.validateSchema){const n=e.scopeValue("validate$data",{ref:s.validateSchema});return u._`!${n}(${t})`}return u.nil}())}subschema(e,t){const n=(0,c.getSubschema)(this.it,e);(0,c.extendSubschemaData)(n,this.it,e),(0,c.extendSubschemaMode)(n,e);const r={...this.it,...n,items:void 0,props:void 0};return function(e,t){w(e)&&(b(e),y(e))?function(e,t){const{schema:n,gen:s,opts:r}=e;r.$comment&&n.$comment&&C(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=s.const("_errs",h.default.errors);A(e,i),s.var(t,u._`${i} === ${h.default.errors}`)}(e,t):(0,s.boolOrEmptySchema)(e,t)}(r,t),r}mergeEvaluated(e,t){const{it:n,gen:s}=this;n.opts.unevaluated&&(!0!==n.props&&void 0!==e.props&&(n.props=m.mergeEvaluated.props(s,e.props,n.props,t)),!0!==n.items&&void 0!==e.items&&(n.items=m.mergeEvaluated.items(s,e.items,n.items,t)))}mergeValidEvaluated(e,t){const{it:n,gen:s}=this;if(n.opts.unevaluated&&(!0!==n.props||!0!==n.items))return s.if(t,(()=>this.mergeEvaluated(e,u.Name))),!0}}function x(e,t,n,s){const r=new _(e,n,t);"code"in n?n.code(r,s):r.$data&&n.validate?(0,l.funcKeywordCode)(r,n):"macro"in n?(0,l.macroKeywordCode)(r,n):(n.compile||n.validate)&&(0,l.funcKeywordCode)(r,n)}t.KeywordCxt=_;const P=/^\/(?:[^~]|~0|~1)*$/,N=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function $(e,{dataLevel:t,dataNames:n,dataPathArr:s}){let r,i;if(""===e)return h.default.rootData;if("/"===e[0]){if(!P.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);r=e,i=h.default.rootData}else{const o=N.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 s[t-a]}if(a>t)throw new Error(l("data",a));if(i=n[t-a],!r)return i}let o=i;const a=r.split("/");for(const e of a)e&&(i=u._`${i}${(0,u.getProperty)((0,m.unescapeJsonPointer)(e))}`,o=u._`${o} && ${i}`);return o;function l(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}t.getData=$},5005:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const s=n(3487),r=n(2141),i=n(412),o=n(4181);function a(e){const{gen:t,data:n,it:r}=e;t.if(r.parentData,(()=>t.assign(n,s._`${r.parentData}[${r.parentDataProperty}]`)))}function l(e,t,n){if(void 0===n)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,s.stringify)(n)})}t.macroKeywordCode=function(e,t){const{gen:n,keyword:r,schema:i,parentSchema:o,it:a}=e,c=t.macro.call(a.self,i,o,a),u=l(n,r,c);!1!==a.opts.validateSchema&&a.self.validateSchema(c,!0);const h=n.name("valid");e.subschema({schema:c,schemaPath:s.nil,errSchemaPath:`${a.errSchemaPath}/${r}`,topSchemaRef:u,compositeRule:!0},h),e.pass(h,(()=>e.error(!0)))},t.funcKeywordCode=function(e,t){var n;const{gen:c,keyword:u,schema:h,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,h,d,p):t.validate,g=l(c,u,f),y=c.let("valid");function w(n=(t.async?s._`await `:s.nil)){const o=p.opts.passContext?r.default.this:r.default.self,a=!("compile"in t&&!m||!1===t.schema);c.assign(y,s._`${n}${(0,i.callValidateCode)(e,g,o,a)}`,t.modifying)}function b(e){var n;c.if((0,s.not)(null!==(n=t.valid)&&void 0!==n?n:y),e)}e.block$data(y,(function(){if(!1===t.errors)w(),t.modifying&&a(e),b((()=>e.error()));else{const n=t.async?function(){const e=c.let("ruleErrs",null);return c.try((()=>w(s._`await `)),(t=>c.assign(y,!1).if(s._`${t} instanceof ${p.ValidationError}`,(()=>c.assign(e,s._`${t}.errors`)),(()=>c.throw(t))))),e}():function(){const e=s._`${g}.errors`;return c.assign(e,null),w(s.nil),e}();t.modifying&&a(e),b((()=>function(e,t){const{gen:n}=e;n.if(s._`Array.isArray(${t})`,(()=>{n.assign(r.default.vErrors,s._`${r.default.vErrors} === null ? ${t} : ${r.default.vErrors}.concat(${t})`).assign(r.default.errors,s._`${r.default.vErrors}.length`),(0,o.extendErrors)(e)}),(()=>e.error()))}(e,n)))}})),e.ok(null!==(n=t.valid)&&void 0!==n?n:y)},t.validSchemaType=function(e,t,n=!1){return!t.length||t.some((t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||n&&void 0===e))},t.validateKeywordUsage=function({schema:e,opts:t,self:n,errSchemaPath:s},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 "${s}": `+n.errorsText(r.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);n.logger.error(e)}}},3099:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;const s=n(3487),r=n(6776);t.getSubschema=function(e,{keyword:t,schemaProp:n,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===n?{schema:i,schemaPath:s._`${e.schemaPath}${(0,s.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:i[n],schemaPath:s._`${e.schemaPath}${(0,s.getProperty)(t)}${(0,s.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,r.escapeFragment)(n)}`}}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:n,dataPropType:i,data:o,dataTypes:a,propertyName:l}){if(void 0!==o&&void 0!==n)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:c}=t;if(void 0!==n){const{errorPath:o,dataPathArr:a,opts:l}=t;u(c.let("data",s._`${t.data}${(0,s.getProperty)(n)}`,!0)),e.errorPath=s.str`${o}${(0,r.getErrorPath)(n,i,l.jsPropertySyntax)}`,e.parentDataProperty=s._`${n}`,e.dataPathArr=[...a,e.parentDataProperty]}function u(n){e.data=n,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,n]}void 0!==o&&(u(o instanceof s.Name?o:c.let("data",o,!0)),void 0!==l&&(e.propertyName=l)),a&&(e.dataTypes=a)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:s,createErrors:r,allErrors:i}){void 0!==s&&(e.compositeRule=s),void 0!==r&&(e.createErrors=r),void 0!==i&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=n}},7159:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var s=n(4815);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return s.KeywordCxt}});var r=n(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=n(7426),o=n(6646),a=n(3141),l=n(5173),c=n(3487),u=n(2531),h=n(453),d=n(6776),m=n(4775),p=n(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.'},A=200;function C(e){var t,n,s,r,i,o,a,l,c,u,h,d,m,g,y,w,b,C,v,T,S,E,_,x,P;const N=e.strict,$=null===(t=e.code)||void 0===t?void 0:t.optimize,M=!0===$||void 0===$?1:$||0,L=null!==(s=null===(n=e.code)||void 0===n?void 0:n.regExp)&&void 0!==s?s:f,I=null!==(r=e.uriResolver)&&void 0!==r?r:p.default;return{strictSchema:null===(o=null!==(i=e.strictSchema)&&void 0!==i?i:N)||void 0===o||o,strictNumbers:null===(l=null!==(a=e.strictNumbers)&&void 0!==a?a:N)||void 0===l||l,strictTypes:null!==(u=null!==(c=e.strictTypes)&&void 0!==c?c:N)&&void 0!==u?u:"log",strictTuples:null!==(d=null!==(h=e.strictTuples)&&void 0!==h?h:N)&&void 0!==d?d:"log",strictRequired:null!==(g=null!==(m=e.strictRequired)&&void 0!==m?m:N)&&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:A,loopEnum:null!==(w=e.loopEnum)&&void 0!==w?w:A,meta:null===(b=e.meta)||void 0===b||b,messages:null===(C=e.messages)||void 0===C||C,inlineRefs:null===(v=e.inlineRefs)||void 0===v||v,schemaId:null!==(T=e.schemaId)&&void 0!==T?T:"$id",addUsedSchema:null===(S=e.addUsedSchema)||void 0===S||S,validateSchema:null===(E=e.validateSchema)||void 0===E||E,validateFormats:null===(_=e.validateFormats)||void 0===_||_,unicodeRegExp:null===(x=e.unicodeRegExp)||void 0===x||x,int32range:null===(P=e.int32range)||void 0===P||P,uriResolver:I}}class v{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...C(e)};const{es5:t,lines:n}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:y,es5:t,lines:n}),this.logger=function(e){if(!1===e)return N;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 s=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),T.call(this,w,e,"NOT SUPPORTED"),T.call(this,b,e,"DEPRECATED","warn"),this._metaOpts=P.call(this),e.formats&&_.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&x.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),E.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:n}=this.opts;let s=m;"id"===n&&(s={...m},s.id=s.$id,delete s.$id),t&&e&&this.addMetaSchema(s,s[n],!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 n;if("string"==typeof e){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);const s=n(t);return"$async"in n||(this.errors=n.errors),s}compile(e,t){const n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:n}=this.opts;return s.call(this,e,t);async function s(e,t){await r.call(this,e.$schema);const n=this._addSchema(e,t);return n.validate||i.call(this,n)}async function r(e){e&&!this.getSchema(e)&&await s.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 n=await c.call(this,e);this.refs[e]||await r.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function c(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,s=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,n,s);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,u.normalizeId)(t||r),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,s,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let n;if(n=e.$schema,void 0!==n&&"string"!=typeof n)throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const s=this.validate(n,e);if(!s&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return s}getSchema(e){let t;for(;"string"==typeof(t=S.call(this,e));)e=t;if(void 0===t){const{schemaId:n}=this.opts,s=new l.SchemaEnv({schema:{},schemaId:n});if(t=l.resolveSchema.call(this,s,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 n=e[this.opts.schemaId];return n&&(n=(0,u.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),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 n;if("string"==typeof e)n=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(n=(t=e).keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(M.call(this,n,t),!t)return(0,d.eachItem)(n,(e=>L.call(this,e))),this;R.call(this,t);const s={...t,type:(0,h.getJSONTypes)(t.type),schemaType:(0,h.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(n,0===s.type.length?e=>L.call(this,e,s):e=>s.type.forEach((t=>L.call(this,e,s,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 n of t.rules){const t=n.rules.findIndex((t=>t.keyword===e));t>=0&&n.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:n="data"}={}){return e&&0!==e.length?e.map((e=>`${n}${e.instancePath} ${e.message}`)).reduce(((e,n)=>e+t+n)):"No errors"}$dataMetaSchema(e,t){const n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const s of t){const t=s.split("/").slice(1);let r=e;for(const e of t)r=r[e];for(const e in n){const t=n[e];if("object"!=typeof t)continue;const{$data:s}=t.definition,i=r[e];s&&i&&(r[e]=D(i))}}return e}_removeAllSchemas(e,t){for(const n in e){const s=e[n];t&&!t.test(n)||("string"==typeof s?delete e[n]:s&&!s.meta&&(this._cache.delete(s.schema),delete e[n]))}}_addSchema(e,t,n,s=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;n=(0,u.normalizeId)(i||n);const c=u.getSchemaRefs.call(this,e,n);return a=new l.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:n,localRefs:c}),this._cache.set(a.schema,a),r&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=a),s&&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 T(e,t,n,s="error"){for(const r in e){const i=r;i in t&&this.logger[s](`${n}: option ${r}. ${e[i]}`)}}function S(e){return e=(0,u.normalizeId)(e),this.schemas[e]||this.refs[e]}function E(){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 _(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function x(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 n=e[t];n.keyword||(n.keyword=t),this.addKeyword(n)}}}function P(){const e={...this.opts};for(const t of g)delete e[t];return e}t.default=v,v.ValidationError=i.default,v.MissingRefError=o.default;const N={log(){},warn(){},error(){}},$=/^[a-z_$][a-z0-9_$:-]*$/i;function M(e,t){const{RULES:n}=this;if((0,d.eachItem)(e,(e=>{if(n.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!$.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,n){var s;const r=null==t?void 0:t.post;if(n&&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===n));if(o||(o={type:n,rules:[]},i.rules.push(o)),i.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,h.getJSONTypes)(t.type),schemaType:(0,h.getJSONTypes)(t.schemaType)}};t.before?I.call(this,o,a,t.before):o.rules.push(a),i.all[e]=a,null===(s=t.implements)||void 0===s||s.forEach((e=>this.addKeyword(e)))}function I(e,t,n){const s=e.rules.findIndex((e=>e.keyword===n));s>=0?e.rules.splice(s,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function R(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=D(t)),e.validateSchema=this.compile(t,!0))}const O={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function D(e){return{anyOf:[e,O]}}},4087:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(2577),r=n(996),i=n(5568),o=n(6795),a=n(235),l=n(2567),c=n(1233),u=n(1968),h=["/properties"];t.default=function(e){return[s,r,i,o,a,t(this,l),c,t(this,u)].forEach((e=>this.addMetaSchema(e,void 0,!1))),this;function t(t,n){return e?t.$dataMetaSchema(n,h):n}}},3510:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(4063);s.code='require("ajv/dist/runtime/equal").default',t.default=s},4499:(e,t)=>{"use strict";function n(e){const t=e.length;let n,s=0,r=0;for(;r<t;)s++,n=e.charCodeAt(r++),n>=55296&&n<=56319&&r<t&&(n=e.charCodeAt(r),56320==(64512&n)&&r++);return s}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,n.code='require("ajv/dist/runtime/ucs2length").default'},3589:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(540);s.code='require("ajv/dist/runtime/uri").default',t.default=s},7426:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class n extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}t.default=n},4783:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;const s=n(3487),r=n(6776),i={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>s.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>s._`{limit: ${e}}`},code(e){const{parentSchema:t,it:n}=e,{items:s}=t;Array.isArray(s)?o(e,s):(0,r.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}};function o(e,t){const{gen:n,schema:i,data:o,keyword:a,it:l}=e;l.items=!0;const c=n.const("len",s._`${o}.length`);if(!1===i)e.setParams({len:t.length}),e.pass(s._`${c} <= ${t.length}`);else if("object"==typeof i&&!(0,r.alwaysValidSchema)(l,i)){const i=n.var("valid",s._`${c} <= ${t.length}`);n.if((0,s.not)(i),(()=>function(i){n.forRange("i",t.length,c,(t=>{e.subschema({keyword:a,dataProp:t,dataPropType:r.Type.Num},i),l.allErrors||n.if((0,s.not)(i),(()=>n.break()))}))}(i))),e.ok(i)}}t.validateAdditionalItems=o,t.default=i},9351:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(412),r=n(3487),i=n(2141),o=n(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:n,parentSchema:a,data:l,errsCount:c,it:u}=e;if(!c)throw new Error("ajv implementation error");const{allErrors:h,opts:d}=u;if(u.props=!0,"all"!==d.removeAdditional&&(0,o.alwaysValidSchema)(u,n))return;const m=(0,s.allSchemaProperties)(a.properties),p=(0,s.allSchemaProperties)(a.patternProperties);function f(e){t.code(r._`delete ${l}[${e}]`)}function g(s){if("all"===d.removeAdditional||d.removeAdditional&&!1===n)f(s);else{if(!1===n)return e.setParams({additionalProperty:s}),e.error(),void(h||t.break());if("object"==typeof n&&!(0,o.alwaysValidSchema)(u,n)){const n=t.name("valid");"failing"===d.removeAdditional?(y(s,n,!1),t.if((0,r.not)(n),(()=>{e.reset(),f(s)}))):(y(s,n),h||t.if((0,r.not)(n),(()=>t.break())))}}}function y(t,n,s){const r={keyword:"additionalProperties",dataProp:t,dataPropType:o.Type.Str};!1===s&&Object.assign(r,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(r,n)}t.forIn("key",l,(n=>{m.length||p.length?t.if(function(n){let i;if(m.length>8){const e=(0,o.schemaRefOrVal)(u,a.properties,"properties");i=(0,s.isOwnProperty)(t,e,n)}else i=m.length?(0,r.or)(...m.map((e=>r._`${n} === ${e}`))):r.nil;return p.length&&(i=(0,r.or)(i,...p.map((t=>r._`${(0,s.usePattern)(e,t)}.test(${n})`)))),(0,r.not)(i)}(n),(()=>g(n))):g(n)})),e.ok(r._`${c} === ${i.default.errors}`)}};t.default=a},1125:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(6776),r={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");const i=t.name("valid");n.forEach(((t,n)=>{if((0,s.alwaysValidSchema)(r,t))return;const o=e.subschema({keyword:"allOf",schemaProp:n},i);e.ok(i),e.mergeEvaluated(o)}))}};t.default=r},19:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:n(412).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=s},9864:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?s.str`must contain at least ${e} valid item(s)`:s.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?s._`{minContains: ${e}}`:s._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:n,parentSchema:i,data:o,it:a}=e;let l,c;const{minContains:u,maxContains:h}=i;a.opts.next?(l=void 0===u?1:u,c=h):l=1;const d=t.const("len",s._`${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,n)){let t=s._`${d} >= ${l}`;return void 0!==c&&(t=s._`${t} && ${d} <= ${c}`),void e.pass(t)}a.items=!0;const m=t.name("valid");function p(){const e=t.name("_valid"),n=t.let("count",0);f(e,(()=>t.if(e,(()=>function(e){t.code(s._`${e}++`),void 0===c?t.if(s._`${e} >= ${l}`,(()=>t.assign(m,!0).break())):(t.if(s._`${e} > ${c}`,(()=>t.assign(m,!1).break())),1===l?t.assign(m,!0):t.if(s._`${e} >= ${l}`,(()=>t.assign(m,!0))))}(n)))))}function f(n,s){t.forRange("i",0,d,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:r.Type.Num,compositeRule:!0},n),s()}))}void 0===c&&1===l?f(m,(()=>t.if(m,(()=>t.break())))):0===l?(t.let(m,!0),void 0!==c&&t.if(s._`${o}.length > 0`,p)):(t.let(m,!1),p()),e.result(m,(()=>e.reset()))}};t.default=i},7772:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const s=n(3487),r=n(6776),i=n(412);t.error={message:({params:{property:e,depsCount:t,deps:n}})=>{const r=1===t?"property":"properties";return s.str`must have ${r} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:n,missingProperty:r}})=>s._`{property: ${e},
|
|
6
6
|
missingProperty: ${r},
|
|
7
7
|
depsCount: ${t},
|
|
8
|
-
deps: ${n}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,n]=function({schema:e}){const t={},n={};for(const s in e)"__proto__"!==s&&((Array.isArray(e[s])?t:n)[s]=e[s]);return[t,n]}(e);a(e,t),l(e,n)}};function a(e,t=e.schema){const{gen:n,data:r,it:o}=e;if(0===Object.keys(t).length)return;const a=n.let("missing");for(const l in t){const c=t[l];if(0===c.length)continue;const u=(0,i.propertyInData)(n,r,l,o.opts.ownProperties);e.setParams({property:l,depsCount:c.length,deps:c.join(", ")}),o.allErrors?n.if(u,(()=>{for(const t of c)(0,i.checkReportMissingProp)(e,t)})):(n.if(s._`${u} && (${(0,i.checkMissingProp)(e,c,a)})`),(0,i.reportMissingProp)(e,a),n.else())}}function l(e,t=e.schema){const{gen:n,data:s,keyword:o,it:a}=e,l=n.name("valid");for(const c in t)(0,r.alwaysValidSchema)(a,t[c])||(n.if((0,i.propertyInData)(n,s,c,a.opts.ownProperties),(()=>{const t=e.subschema({keyword:o,schemaProp:c},l);e.mergeValidEvaluated(t,l)}),(()=>n.var(l,!0))),e.ok(l))}t.validatePropertyDeps=a,t.validateSchemaDeps=l,t.default=o},7274:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(7772),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,s.validateSchemaDeps)(e)};t.default=r},9434:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>s.str`must match "${e.ifClause}" schema`,params:({params:e})=>s._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:n,it:i}=e;void 0===n.then&&void 0===n.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),u=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}(),e.reset(),a&&l){const n=t.let("ifClause");e.setParams({ifClause:n}),t.if(u,h("then",n),h("else",n))}else a?t.if(u,h("then")):t.if((0,s.not)(u),h("else"));function h(n,r){return()=>{const i=e.subschema({keyword:n},u);t.assign(c,u),e.mergeValidEvaluated(i,c),r?t.assign(r,s._`${n}`):e.setParams({ifClause:n})}}e.pass(c,(()=>e.error(!0)))}};function o(e,t){const n=e.schema[t];return void 0!==n&&!(0,r.alwaysValidSchema)(e,n)}t.default=i},8200:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(4783),r=n(2924),i=n(4665),o=n(1119),a=n(9864),l=n(7772),c=n(3708),u=n(9351),h=n(6239),d=n(2296),m=n(2182),p=n(19),f=n(4200),g=n(1125),y=n(9434),w=n(6552);t.default=function(e=!1){const t=[m.default,p.default,f.default,g.default,y.default,w.default,c.default,u.default,l.default,h.default,d.default];return e?t.push(r.default,o.default):t.push(s.default,i.default),t.push(a.default),t}},4665:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;const s=n(3487),r=n(6776),i=n(412),o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:n}=e;if(Array.isArray(t))return a(e,"additionalItems",t);n.items=!0,(0,r.alwaysValidSchema)(n,t)||e.ok((0,i.validateArray)(e))}};function a(e,t,n=e.schema){const{gen:i,parentSchema:o,data:a,keyword:l,it:c}=e;!function(e){const{opts:s,errSchemaPath:i}=c,o=n.length,a=o===e.minItems&&(o===e.maxItems||!1===e[t]);if(s.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,s.strictTuples)}}(o),c.opts.unevaluated&&n.length&&!0!==c.items&&(c.items=r.mergeEvaluated.items(i,n.length,c.items));const u=i.name("valid"),h=i.const("len",s._`${a}.length`);n.forEach(((t,n)=>{(0,r.alwaysValidSchema)(c,t)||(i.if(s._`${h} > ${n}`,(()=>e.subschema({keyword:l,schemaProp:n,dataProp:n},u))),e.ok(u))}))}t.validateTuple=a,t.default=o},1119:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i=n(412),o=n(4783),a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>s.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>s._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:n,it:s}=e,{prefixItems:a}=n;s.items=!0,(0,r.alwaysValidSchema)(s,t)||(a?(0,o.validateAdditionalItems)(e,a):e.ok((0,i.validateArray)(e)))}};t.default=a},2182:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(6776),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:r}=e;if((0,s.alwaysValidSchema)(r,n))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,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>s._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:n,parentSchema:i,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(o.opts.discriminator&&i.discriminator)return;const a=n,l=t.let("valid",!1),c=t.let("passing",null),u=t.name("_valid");e.setParams({passing:c}),t.block((function(){a.forEach(((n,i)=>{let a;(0,r.alwaysValidSchema)(o,n)?t.var(u,!0):a=e.subschema({keyword:"oneOf",schemaProp:i,compositeRule:!0},u),i>0&&t.if(s._`${u} && ${l}`).assign(l,!1).assign(c,s._`[${c}, ${i}]`).else(),t.if(u,(()=>{t.assign(l,!0),t.assign(c,i),a&&e.mergeEvaluated(a,s.Name)}))}))})),e.result(l,(()=>e.reset()),(()=>e.error(!0)))}};t.default=i},2296:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(412),r=n(3487),i=n(6776),o=n(6776),a={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,data:a,parentSchema:l,it:c}=e,{opts:u}=c,h=(0,s.allSchemaProperties)(n),d=h.filter((e=>(0,i.alwaysValidSchema)(c,n[e])));if(0===h.length||d.length===h.length&&(!c.opts.unevaluated||!0===c.props))return;const m=u.strictSchema&&!u.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(n){t.forIn("key",a,(i=>{t.if(r._`${(0,s.usePattern)(e,n)}.test(${i})`,(()=>{const s=d.includes(n);s||e.subschema({keyword:"patternProperties",schemaProp:n,dataProp:i,dataPropType:o.Type.Str},p),c.opts.unevaluated&&!0!==f?t.assign(r._`${f}[${i}]`,!0):s||c.allErrors||t.if((0,r.not)(p),(()=>t.break()))}))}))}!function(){for(const e of h)m&&g(e),c.allErrors?y(e):(t.var(p,!0),y(e),t.if(p))}()}};t.default=a},2924:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(4665),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,s.validateTuple)(e,"items")};t.default=r},6239:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(4815),r=n(412),i=n(6776),o=n(9351),a={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,parentSchema:a,data:l,it:c}=e;"all"===c.opts.removeAdditional&&void 0===a.additionalProperties&&o.default.code(new s.KeywordCxt(c,o.default,"additionalProperties"));const u=(0,r.allSchemaProperties)(n);for(const e of u)c.definedProperties.add(e);c.opts.unevaluated&&u.length&&!0!==c.props&&(c.props=i.mergeEvaluated.props(t,(0,i.toHash)(u),c.props));const h=u.filter((e=>!(0,i.alwaysValidSchema)(c,n[e])));if(0===h.length)return;const d=t.name("valid");for(const n of h)m(n)?p(n):(t.if((0,r.propertyInData)(t,l,n,c.opts.ownProperties)),p(n),c.allErrors||t.else().var(d,!0),t.endIf()),e.it.definedProperties.add(n),e.ok(d);function m(e){return c.opts.useDefaults&&!c.compositeRule&&void 0!==n[e].default}function p(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},d)}}};t.default=a},3708:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>s._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:n,data:i,it:o}=e;if((0,r.alwaysValidSchema)(o,n))return;const a=t.name("valid");t.forIn("key",i,(n=>{e.setParams({propertyName:n}),e.subschema({keyword:"propertyNames",data:n,dataTypes:["string"],propertyName:n,compositeRule:!0},a),t.if((0,s.not)(a),(()=>{e.error(!0),o.allErrors||t.break()}))})),e.ok(a)}};t.default=i},6552:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(6776),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){void 0===t.if&&(0,s.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};t.default=r},412:(e,t,n)=>{"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 s=n(3487),r=n(6776),i=n(2141),o=n(6776);function a(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:s._`Object.prototype.hasOwnProperty`})}function l(e,t,n){return s._`${a(e)}.call(${t}, ${n})`}function c(e,t,n,r){const i=s._`${t}${(0,s.getProperty)(n)} === undefined`;return r?(0,s.or)(i,(0,s.not)(l(e,t,n))):i}function u(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}t.checkReportMissingProp=function(e,t){const{gen:n,data:r,it:i}=e;n.if(c(n,r,t,i.opts.ownProperties),(()=>{e.setParams({missingProperty:s._`${t}`},!0),e.error()}))},t.checkMissingProp=function({gen:e,data:t,it:{opts:n}},r,i){return(0,s.or)(...r.map((r=>(0,s.and)(c(e,t,r,n.ownProperties),s._`${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,n,r){const i=s._`${t}${(0,s.getProperty)(n)} !== undefined`;return r?s._`${i} && ${l(e,t,n)}`:i},t.noPropertyInData=c,t.allSchemaProperties=u,t.schemaProperties=function(e,t){return u(t).filter((n=>!(0,r.alwaysValidSchema)(e,t[n])))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:o,errorPath:a},it:l},c,u,h){const d=h?s._`${e}, ${t}, ${r}${o}`:t,m=[[i.default.instancePath,(0,s.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=s._`${d}, ${n.object(...m)}`;return u!==s.nil?s._`${c}.call(${u}, ${p})`:s._`${c}(${p})`};const h=s._`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},n){const r=t.unicodeRegExp?"u":"",{regExp:i}=t.code,a=i(n,r);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:s._`${"new RegExp"===i.code?h:(0,o.useFunc)(e,i)}(${n}, ${r})`})},t.validateArray=function(e){const{gen:t,data:n,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",s._`${n}.length`);t.forRange("i",0,l,(n=>{e.subschema({keyword:i,dataProp:n,dataPropType:r.Type.Num},a),t.if((0,s.not)(a),o)}))}},t.validateUnion=function(e){const{gen:t,schema:n,keyword:i,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some((e=>(0,r.alwaysValidSchema)(o,e)))&&!o.opts.unevaluated)return;const a=t.let("valid",!1),l=t.name("_valid");t.block((()=>n.forEach(((n,r)=>{const o=e.subschema({keyword:i,schemaProp:r,compositeRule:!0},l);t.assign(a,s._`${a} || ${l}`),e.mergeValidEvaluated(o,l)||t.if((0,s.not)(a))})))),e.result(a,(()=>e.reset()),(()=>e.error(!0)))}},8386:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t.default=n},5684:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(8386),r=n(8280),i=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",s.default,r.default];t.default=i},8280:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;const s=n(6646),r=n(412),i=n(3487),o=n(2141),a=n(5173),l=n(6776),c={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:r}=e,{baseId:o,schemaEnv:l,validateName:c,opts:d,self:m}=r,{root:p}=l;if(("#"===n||"#/"===n)&&o===p.baseId)return function(){if(l===p)return h(e,c,l,l.$async);const n=t.scopeValue("root",{ref:p});return h(e,i._`${n}.validate`,p,p.$async)}();const f=a.resolveRef.call(m,p,o,n);if(void 0===f)throw new s.default(r.opts.uriResolver,o,n);return f instanceof a.SchemaEnv?function(t){const n=u(e,t);h(e,n,t,t.$async)}(f):function(s){const r=t.scopeValue("schema",!0===d.code.source?{ref:s,code:(0,i.stringify)(s)}:{ref:s}),o=t.name("valid"),a=e.subschema({schema:s,dataTypes:[],schemaPath:i.nil,topSchemaRef:r,errSchemaPath:n},o);e.mergeEvaluated(a),e.ok(o)}(f)}};function u(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):i._`${n.scopeValue("wrapper",{ref:t})}.validate`}function h(e,t,n,s){const{gen:a,it:c}=e,{allErrors:u,schemaEnv:h,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 s=null===(t=null==n?void 0:n.validate)||void 0===t?void 0:t.evaluated;if(!0!==c.props)if(s&&!s.dynamicProps)void 0!==s.props&&(c.props=l.mergeEvaluated.props(a,s.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(s&&!s.dynamicItems)void 0!==s.items&&(c.items=l.mergeEvaluated.items(a,s.items,c.items));else{const t=a.var("items",i._`${e}.evaluated.items`);c.items=l.mergeEvaluated.items(a,t,c.items,i.Name)}}s?function(){if(!h.$async)throw new Error("async schema referenced by sync schema");const n=a.let("valid");a.try((()=>{a.code(i._`await ${(0,r.callValidateCode)(e,t,m)}`),f(t),u||a.assign(n,!0)}),(e=>{a.if(i._`!(${e} instanceof ${c.ValidationError})`,(()=>a.throw(e))),p(e),u||a.assign(n,!1)})),e.ok(n)}():e.result((0,r.callValidateCode)(e,t,m),(()=>f(t)),(()=>p(t)))}t.getValidate=u,t.callRef=h,t.default=c},1240:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(9306),i=n(5173),o=n(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:n}})=>s._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},code(e){const{gen:t,data:n,schema:a,parentSchema:l,it:c}=e,{oneOf:u}=l;if(!c.opts.discriminator)throw new Error("discriminator: requires discriminator option");const h=a.propertyName;if("string"!=typeof h)throw new Error("discriminator: requires propertyName");if(a.mapping)throw new Error("discriminator: mapping is not supported");if(!u)throw new Error("discriminator: requires oneOf keyword");const d=t.let("valid",!1),m=t.const("tag",s._`${n}${(0,s.getProperty)(h)}`);function p(n){const r=t.name("valid"),i=e.subschema({keyword:"oneOf",schemaProp:n},r);return e.mergeEvaluated(i,s.Name),r}t.if(s._`typeof ${m} == "string"`,(()=>function(){const n=function(){var e;const t={},n=r(l);let s=!0;for(let t=0;t<u.length;t++){let l=u[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[h];if("object"!=typeof d)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);s=s&&(n||r(l)),a(d,t)}if(!s)throw new Error(`discriminator: "${h}" must be required`);return t;function r({required:e}){return Array.isArray(e)&&e.includes(h)}function a(e,t){if(e.const)d(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${h}" must have "const" or "enum"`);for(const n of e.enum)d(n,t)}}function d(e,n){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${h}" values must be unique strings`);t[e]=n}}();t.if(!1);for(const e in n)t.elseIf(s._`${m} === ${e}`),t.assign(d,p(n[e]));t.else(),e.error(!1,{discrError:r.DiscrError.Mapping,tag:m,tagName:h}),t.endIf()}()),(()=>e.error(!1,{discrError:r.DiscrError.Tag,tag:m,tagName:h}))),e.ok(d)}};t.default=a},9306:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(n=t.DiscrError||(t.DiscrError={})).Tag="tag",n.Mapping="mapping"},7299:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(5684),r=n(2649),i=n(8200),o=n(6121),a=n(1448),l=n(808),c=n(9502),u=n(6167),h=[o.default,s.default,r.default,(0,i.default)(!0),c.default,u.metadataVocabulary,u.contentVocabulary,a.default,l.default];t.default=h},3924:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(5684),r=n(2649),i=n(8200),o=n(9502),a=n(6167),l=[s.default,r.default,(0,i.default)(),o.default,a.metadataVocabulary,a.contentVocabulary];t.default=l},6215:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;const s=n(3487),r=n(2141),i=n(5173),o=n(8280),a={keyword:"$dynamicAnchor",schemaType:"string",code:e=>l(e,e.schema)};function l(e,t){const{gen:n,it:a}=e;a.schemaEnv.root.dynamicAnchors[t]=!0;const l=s._`${r.default.dynamicAnchors}${(0,s.getProperty)(t)}`,c="#"===a.errSchemaPath?a.validateName:function(e){const{schemaEnv:t,schema:n,self:s}=e.it,{root:r,baseId:a,localRefs:l,meta:c}=t.root,{schemaId:u}=s.opts,h=new i.SchemaEnv({schema:n,schemaId:u,root:r,baseId:a,localRefs:l,meta:c});return i.compileSchema.call(s,h),(0,o.getValidate)(e,h)}(e);n.if(s._`!${l}`,(()=>n.assign(l,c)))}t.dynamicAnchor=l,t.default=a},1919:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;const s=n(3487),r=n(2141),i=n(8280),o={keyword:"$dynamicRef",schemaType:"string",code:e=>a(e,e.schema)};function a(e,t){const{gen:n,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=n.let("valid",!1);c(t),e.ok(t)}function c(e){if(a.schemaEnv.root.dynamicAnchors[l]){const t=n.let("_v",s._`${r.default.dynamicAnchors}${(0,s.getProperty)(l)}`);n.if(t,u(t,e),u(a.validateName,e))}else u(a.validateName,e)()}function u(t,s){return s?()=>n.block((()=>{(0,i.callRef)(e,t),n.let(s,!0)})):()=>(0,i.callRef)(e,t)}}t.dynamicRef=a,t.default=o},6121:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(6215),r=n(1919),i=n(4094),o=n(3944),a=[s.default,r.default,i.default,o.default];t.default=a},4094:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(6215),r=n(6776),i={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,s.dynamicAnchor)(e,""):(0,r.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}};t.default=i},3944:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(1919),r={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,s.dynamicRef)(e,e.schema)};t.default=r},9651:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>s.str`must match format "${e}"`,params:({schemaCode:e})=>s._`{format: ${e}}`},code(e,t){const{gen:n,data:r,$data:i,schema:o,schemaCode:a,it:l}=e,{opts:c,errSchemaPath:u,schemaEnv:h,self:d}=l;c.validateFormats&&(i?function(){const i=n.scopeValue("formats",{ref:d.formats,code:c.code.formats}),o=n.const("fDef",s._`${i}[${a}]`),l=n.let("fType"),u=n.let("format");n.if(s._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>n.assign(l,s._`${o}.type || "string"`).assign(u,s._`${o}.validate`)),(()=>n.assign(l,s._`"string"`).assign(u,o))),e.fail$data((0,s.or)(!1===c.strictSchema?s.nil:s._`${a} && !${u}`,function(){const e=h.$async?s._`(${o}.async ? await ${u}(${r}) : ${u}(${r}))`:s._`${u}(${r})`,n=s._`(typeof ${u} == "function" ? ${e} : ${u}.test(${r}))`;return s._`${u} && ${u} !== true && ${l} === ${t} && !${n}`}()))}():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 "${u}"`}d.logger.warn(e())}();if(!0===i)return;const[a,l,m]=function(e){const t=e instanceof RegExp?(0,s.regexpCode)(e):c.code.formats?s._`${c.code.formats}${(0,s.getProperty)(o)}`:void 0,r=n.scopeValue("formats",{key:o,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,r]:[e.type||"string",e.validate,s._`${r}.validate`]}(i);a===t&&e.pass(function(){if("object"==typeof i&&!(i instanceof RegExp)&&i.async){if(!h.$async)throw new Error("async format in sync schema");return s._`await ${m}(${r})`}return"function"==typeof l?s._`${m}(${r})`:s._`${m}.test(${r})`}())}())}};t.default=r},9502:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=[n(9651).default];t.default=s},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,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(8921),r=n(7274),i=n(3633),o=[s.default,r.default,i.default];t.default=o},808:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(1782),r=n(4641),i=[s.default,r.default];t.default=i},4641:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:e}})=>s.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>s._`{limit: ${e}}`},code(e){const{gen:t,schema:n,data:i,it:o}=e,a=o.items||0;if(!0===a)return;const l=t.const("len",s._`${i}.length`);if(!1===n)e.setParams({len:a}),e.fail(s._`${l} > ${a}`);else if("object"==typeof n&&!(0,r.alwaysValidSchema)(o,n)){const n=t.var("valid",s._`${l} <= ${a}`);t.if((0,s.not)(n),(()=>function(n,i){t.forRange("i",i,l,(i=>{e.subschema({keyword:"unevaluatedItems",dataProp:i,dataPropType:r.Type.Num},n),o.allErrors||t.if((0,s.not)(n),(()=>t.break()))}))}(n,a))),e.ok(n)}o.items=!0}};t.default=i},1782:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i=n(2141),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:e})=>s._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){const{gen:t,schema:n,data:o,errsCount:a,it:l}=e;if(!a)throw new Error("ajv implementation error");const{allErrors:c,props:u}=l;function h(i){if(!1===n)return e.setParams({unevaluatedProperty:i}),e.error(),void(c||t.break());if(!(0,r.alwaysValidSchema)(l,n)){const n=t.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:i,dataPropType:r.Type.Str},n),c||t.if((0,s.not)(n),(()=>t.break()))}}u instanceof s.Name?t.if(s._`${u} !== true`,(()=>t.forIn("key",o,(e=>t.if(function(e,t){return s._`!${e} || !${e}[${t}]`}(u,e),(()=>h(e))))))):!0!==u&&t.forIn("key",o,(e=>void 0===u?h(e):t.if(function(e,t){const n=[];for(const r in e)!0===e[r]&&n.push(s._`${t} !== ${r}`);return(0,s.and)(...n)}(u,e),(()=>h(e))))),l.props=!0,e.ok(s._`${a} === ${i.default.errors}`)}};t.default=o},4693:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i=n(3510),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>s._`{allowedValue: ${e}}`},code(e){const{gen:t,data:n,$data:o,schemaCode:a,schema:l}=e;o||l&&"object"==typeof l?e.fail$data(s._`!${(0,r.useFunc)(t,i.default)}(${n}, ${a})`):e.fail(s._`${l} !== ${n}`)}};t.default=o},8921:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(7772),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:s.error,code:e=>(0,s.validatePropertyDeps)(e)};t.default=r},966:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i=n(3510),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>s._`{allowedValues: ${e}}`},code(e){const{gen:t,data:n,$data:o,schema:a,schemaCode:l,it:c}=e;if(!o&&0===a.length)throw new Error("enum must have non-empty array");const u=a.length>=c.opts.loopEnum;let h;const d=()=>null!=h?h:h=(0,r.useFunc)(t,i.default);let m;if(u||o)m=t.let("valid"),e.block$data(m,(function(){t.assign(m,!1),t.forOf("v",l,(e=>t.if(s._`${d()}(${n}, ${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,s.or)(...a.map(((t,r)=>function(e,t){const r=a[t];return"object"==typeof r&&null!==r?s._`${d()}(${n}, ${e}[${t}])`:s._`${n} === ${r}`}(e,r))))}e.pass(m)}};t.default=o},2649:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3983),r=n(430),i=n(3229),o=n(4336),a=n(498),l=n(3301),c=n(1687),u=n(2958),h=n(4693),d=n(966),m=[s.default,r.default,i.default,o.default,a.default,l.default,c.default,u.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},h.default,d.default];t.default=m},3633:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(6776),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){void 0===t.contains&&(0,s.checkStrictMode)(n,`"${e}" without "contains" is ignored`)}};t.default=r},1687:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxItems"===e?"more":"fewer";return s.str`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>s._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:r}=e,i="maxItems"===t?s.operators.GT:s.operators.LT;e.fail$data(s._`${n}.length ${i} ${r}`)}};t.default=r},3229:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i=n(4499),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxLength"===e?"more":"fewer";return s.str`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>s._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:o,it:a}=e,l="maxLength"===t?s.operators.GT:s.operators.LT,c=!1===a.opts.unicode?s._`${n}.length`:s._`${(0,r.useFunc)(e.gen,i.default)}(${n})`;e.fail$data(s._`${c} ${l} ${o}`)}};t.default=o},3983:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=s.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})=>s.str`must be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>s._`{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:n,schemaCode:r}=e;e.fail$data(s._`${n} ${i[t].fail} ${r} || isNaN(${n})`)}};t.default=a},498:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxProperties"===e?"more":"fewer";return s.str`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>s._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:r}=e,i="maxProperties"===t?s.operators.GT:s.operators.LT;e.fail$data(s._`Object.keys(${n}).length ${i} ${r}`)}};t.default=r},430:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>s.str`must be multiple of ${e}`,params:({schemaCode:e})=>s._`{multipleOf: ${e}}`},code(e){const{gen:t,data:n,schemaCode:r,it:i}=e,o=i.opts.multipleOfPrecision,a=t.let("res"),l=o?s._`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:s._`${a} !== parseInt(${a})`;e.fail$data(s._`(${r} === 0 || (${a} = ${n}/${r}, ${l}))`)}};t.default=r},4336:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(412),r=n(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:n,schema:i,schemaCode:o,it:a}=e,l=a.opts.unicodeRegExp?"u":"",c=n?r._`(new RegExp(${o}, ${l}))`:(0,s.usePattern)(e,i);e.fail$data(r._`!${c}.test(${t})`)}};t.default=i},3301:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(412),r=n(3487),i=n(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:n,schemaCode:o,data:a,$data:l,it:c}=e,{opts:u}=c;if(!l&&0===n.length)return;const h=n.length>=u.loopRequired;if(c.allErrors?function(){if(h||l)e.block$data(r.nil,d);else for(const t of n)(0,s.checkReportMissingProp)(e,t)}():function(){const i=t.let("missing");if(h||l){const n=t.let("valid",!0);e.block$data(n,(()=>function(n,i){e.setParams({missingProperty:n}),t.forOf(n,o,(()=>{t.assign(i,(0,s.propertyInData)(t,a,n,u.ownProperties)),t.if((0,r.not)(i),(()=>{e.error(),t.break()}))}),r.nil)}(i,n))),e.ok(n)}else t.if((0,s.checkMissingProp)(e,n,i)),(0,s.reportMissingProp)(e,i),t.else()}(),u.strictRequired){const t=e.parentSchema.properties,{definedProperties:s}=e.it;for(const e of n)if(void 0===(null==t?void 0:t[e])&&!s.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,(n=>{e.setParams({missingProperty:n}),t.if((0,s.noPropertyInData)(t,a,n,u.ownProperties),(()=>e.error()))}))}}};t.default=o},2958:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(453),r=n(3487),i=n(6776),o=n(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:n,$data:a,schema:l,parentSchema:c,schemaCode:u,it:h}=e;if(!a&&!l)return;const d=t.let("valid"),m=c.items?(0,s.getSchemaTypes)(c.items):[];function p(i,o){const a=t.name("item"),l=(0,s.checkDataTypes)(m,a,h.opts.strictNumbers,s.DataType.Wrong),c=t.const("indices",r._`{}`);t.for(r._`;${i}--;`,(()=>{t.let(a,r._`${n}[${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(s,a){const l=(0,i.useFunc)(t,o.default),c=t.name("outer");t.label(c).for(r._`;${s}--;`,(()=>t.for(r._`${a} = ${s}; ${a}--;`,(()=>t.if(r._`${l}(${n}[${s}], ${n}[${a}])`,(()=>{e.error(),t.assign(d,!1).break(c)}))))))}e.block$data(d,(function(){const s=t.let("i",r._`${n}.length`),i=t.let("j");e.setParams({i:s,j:i}),t.assign(d,!0),t.if(r._`${s} > 1`,(()=>(m.length>0&&!m.some((e=>"object"===e||"array"===e))?p:f)(s,i)))}),r._`${u} === false`),e.ok(d)}};t.default=a},8277:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7537),r=n.n(s),i=n(3645),o=n.n(i)()(r());o.push([e.id,"\n.ui-form.ui-tooltip .ui-input-root > label.ui-input-label:not(:empty) {\n /* min-width: 30px; /* Breaks right margin /**/\n}\n\n.ui-form.ui-tooltip .ui-input-root > div.ui-input-text:not(:empty) {\n margin-top: 6px;\n}","",{version:3,sources:["webpack://./css/cell-renderer.css"],names:[],mappings:";AACA;IACI,8CAA8C;AAClD;;AAEA;IACI,eAAe;AACnB",sourcesContent:["\n.ui-form.ui-tooltip .ui-input-root > label.ui-input-label:not(:empty) {\n /* min-width: 30px; /* Breaks right margin /**/\n}\n\n.ui-form.ui-tooltip .ui-input-root > div.ui-input-text:not(:empty) {\n margin-top: 6px;\n}"],sourceRoot:""}]);const a=o},5362:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7537),r=n.n(s),i=n(3645),o=n.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,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7537),r=n.n(s),i=n(3645),o=n.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,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7537),r=n.n(s),i=n(3645),o=n.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\n.ml-dim-reduction-column-editor-input-root label {\n display: none !important;\n}\n\n.ml-dim-reduction-column-editor-input-root input, .ml-dim-reduction-column-editor-input-root select {\n margin-left: 20px !important;\n}\n\nh3.ml-dim-reduction-column-editor-input-root {\n margin: 0 !important;\n}\n\n.ml-dim-reduction-column-editor-root, .ml-dim-reduction-column-editor-header-root {\n display: flex;\n flex-direction: row;\n align-items: center;\n margin-bottom: 10px !important;\n width: 600px !important;\n}\n\n.ml-dim-reduction-column-editor-column-title {\n text-overflow: ellipsis;\n overflow: hidden;\n}\n\n.ml-dim-reduction-column-editor-header-root > h1:not(:first-child) {\n margin-left: 20px !important;\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;;AAEA;IACI,wBAAwB;AAC5B;;AAEA;IACI,4BAA4B;AAChC;;AAEA;IACI,oBAAoB;AACxB;;AAEA;IACI,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,8BAA8B;IAC9B,uBAAuB;AAC3B;;AAEA;IACI,uBAAuB;IACvB,gBAAgB;AACpB;;AAEA;IACI,4BAA4B;AAChC",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\n.ml-dim-reduction-column-editor-input-root label {\n display: none !important;\n}\n\n.ml-dim-reduction-column-editor-input-root input, .ml-dim-reduction-column-editor-input-root select {\n margin-left: 20px !important;\n}\n\nh3.ml-dim-reduction-column-editor-input-root {\n margin: 0 !important;\n}\n\n.ml-dim-reduction-column-editor-root, .ml-dim-reduction-column-editor-header-root {\n display: flex;\n flex-direction: row;\n align-items: center;\n margin-bottom: 10px !important;\n width: 600px !important;\n}\n\n.ml-dim-reduction-column-editor-column-title {\n text-overflow: ellipsis;\n overflow: hidden;\n}\n\n.ml-dim-reduction-column-editor-header-root > h1:not(:first-child) {\n margin-left: 20px !important;\n}"],sourceRoot:""}]);const a=o},8710:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7537),r=n.n(s),i=n(3645),o=n.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 n="",s=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),s&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),s&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,s,r,i){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(s)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 u=[].concat(e[c]);s&&o[u[0]]||(void 0!==i&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),r&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=r):u[4]="".concat(r)),t.push(u))}},t}},7537:e=>{"use strict";e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;if("function"==typeof btoa){var s=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),i="/*# ".concat(r," */");return[t].concat([i]).join("\n")}return[t].join("\n")}},4063:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var s,r,i;if(Array.isArray(t)){if((s=t.length)!=n.length)return!1;for(r=s;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((s=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=s;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=s;0!=r--;){var o=i[r];if(!e(t[o],n[o]))return!1}return!0}return t!=t&&n!=n}},9133:function(e,t,n){var s;!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 n(e,n,s,r,i){for(var o,a,l,c,u,h,d,m,p,f,g,y,w;i>=64;){for(o=n[0],a=n[1],l=n[2],c=n[3],u=n[4],h=n[5],d=n[6],m=n[7],f=0;f<16;f++)g=r+4*f,e[f]=(255&s[g])<<24|(255&s[g+1])<<16|(255&s[g+2])<<8|255&s[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=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&h^~u&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=h,h=u,u=c+y|0,c=l,l=a,a=o,o=y+w|0;n[0]+=o,n[1]+=a,n[2]+=l,n[3]+=c,n[4]+=u,n[5]+=h,n[6]+=d,n[7]+=m,r+=64,i-=64}return r}var s=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 s=0;if(this.bytesHashed+=t,this.bufferLength>0){for(;this.bufferLength<64&&t>0;)this.buffer[this.bufferLength++]=e[s++],t--;64===this.bufferLength&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(t>=64&&(s=n(this.temp,this.state,e,s,t),t%=64);t>0;)this.buffer[this.bufferLength++]=e[s++],t--;return this},t.prototype.finish=function(e){if(!this.finished){var t=this.bytesHashed,s=this.bufferLength,r=t/536870912|0,i=t<<3,o=t%64<56?64:128;this.buffer[s]=128;for(var a=s+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,n(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 n=0;n<this.state.length;n++)this.state[n]=e[n];this.bytesHashed=t,this.finished=!1,this.bufferLength=0},t}();e.Hash=s;var r=function(){function e(e){this.inner=new s,this.outer=new s,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var t=new Uint8Array(this.blockSize);if(e.length>this.blockSize)(new s).update(e).finish(t).clean();else for(var n=0;n<e.length;n++)t[n]=e[n];for(n=0;n<t.length;n++)t[n]^=54;for(this.inner.update(t),n=0;n<t.length;n++)t[n]^=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),n=0;n<t.length;n++)t[n]=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 s).update(e),n=t.digest();return t.clean(),n}function o(e,t){var n=new r(e).update(t),s=n.digest();return n.clean(),s}function a(e,t,n,s){var r=s[0];if(0===r)throw new Error("hkdf: cannot expand more");t.reset(),r>1&&t.update(e),n&&t.update(n),t.update(s),t.finish(e),s[0]++}e.HMAC=r,e.hash=i,e.default=i,e.hmac=o;var l=new Uint8Array(e.digestLength);e.hkdf=function(e,t,n,s){void 0===t&&(t=l),void 0===s&&(s=32);for(var i=new Uint8Array([1]),c=o(t,e),u=new r(c),h=new Uint8Array(u.digestLength),d=h.length,m=new Uint8Array(s),p=0;p<s;p++)d===h.length&&(a(h,u,n,i),d=0),m[p]=h[d++];return u.clean(),h.fill(0),i.fill(0),m},e.pbkdf2=function(e,t,n,s){for(var i=new r(e),o=i.digestLength,a=new Uint8Array(4),l=new Uint8Array(o),c=new Uint8Array(o),u=new Uint8Array(s),h=0;h*o<s;h++){var d=h+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<=n;m++){i.reset(),i.update(c).finish(c);for(var p=0;p<o;p++)l[p]^=c[p]}for(m=0;m<o&&h*o+m<s;m++)u[h*o+m]=l[m]}for(h=0;h<o;h++)l[h]=c[h]=0;for(h=0;h<4;h++)a[h]=0;return i.clean(),u}}(i);var o=i.default;for(var a in i)o[a]=i[a];"object"==typeof e.exports?e.exports=o:void 0===(s=function(){return o}.call(i,n,i,e))||(e.exports=s)}()},1811:(e,t,n)=>{"use strict";n.d(t,{T:()=>r});const s=new Uint32Array(65536),r=(e,t)=>{if(e.length<t.length){const n=t;t=e,e=n}return 0===t.length?e.length:e.length<=32?((e,t)=>{const n=e.length,r=t.length,i=1<<n-1;let o=-1,a=0,l=n,c=n;for(;c--;)s[e.charCodeAt(c)]|=1<<c;for(c=0;c<r;c++){let e=s[t.charCodeAt(c)];const n=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|~(n|a),a&=n}for(c=n;c--;)s[e.charCodeAt(c)]=0;return l})(e,t):((e,t)=>{const n=t.length,r=e.length,i=[],o=[],a=Math.ceil(n/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 u=32*c,h=Math.min(32,r)+u;for(let t=u;t<h;t++)s[e.charCodeAt(t)]|=1<<t;for(let e=0;e<n;e++){const n=s[t.charCodeAt(e)],r=o[e/32|0]>>>e&1,c=i[e/32|0]>>>e&1,u=n|a,h=((n|c)&l)+l^l|n|c;let d=a|~(h|l),m=l&h;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|~(u|d),a=d&u}for(let t=u;t<h;t++)s[e.charCodeAt(t)]=0}let u=0,h=-1;const d=32*c,m=Math.min(32,r-d)+d;for(let t=d;t<m;t++)s[e.charCodeAt(t)]|=1<<t;let p=r;for(let e=0;e<n;e++){const n=s[t.charCodeAt(e)],a=o[e/32|0]>>>e&1,l=i[e/32|0]>>>e&1,c=n|u,d=((n|l)&h)+h^h|n|l;let m=u|~(d|h),f=h&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,h=f|~(c|m),u=m&c}for(let t=d;t<m;t++)s[e.charCodeAt(t)]=0;return p})(e,t)}},3979:(e,t)=>{"use strict";t.H$=void 0,t.H$=function(e,t,n){var s=function(e,t,n){if(0===e.length||0===t.length)return 0;if(n&&!n.caseSensitive&&(e=e.toUpperCase(),t=t.toUpperCase()),e===t)return 1;for(var s=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 u=Math.max(0,c-o);u<=Math.min(i,c+o+1);u++)if(!a[c]&&!l[u]&&e[c]===t[u]){++s,a[c]=l[u]=!0;break}if(0===s)return 0;var h=0,d=0;for(c=0;c<r;c++)if(a[c]){for(;!l[d];)d++;e.charAt(c)!==t.charAt(d++)&&h++}return(s/r+s/i+(s-(h/=2))/s)/3}(e,t,n),r=0;if(s>.7){for(var i=Math.min(e.length,t.length),o=0;e[o]===t[o]&&o<4&&o<i;)++r,o++;s+=.1*r*(1-s)}return s}},9461:e=>{"use strict";var t=e.exports=function(e,t,s){"function"==typeof t&&(s=t,t={}),n(t,"function"==typeof(s=t.cb||s)?s:s.pre||function(){},s.post||function(){},e,"",e)};function n(e,s,r,i,o,a,l,c,u,h){if(i&&"object"==typeof i&&!Array.isArray(i)){for(var d in s(i,o,a,l,c,u,h),i){var m=i[d];if(Array.isArray(m)){if(d in t.arrayKeywords)for(var p=0;p<m.length;p++)n(e,s,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)n(e,s,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))&&n(e,s,r,m,o+"/"+d,a,o,d,i)}r(i,o,a,l,c,u,h)}}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 n(e){for(var n=-1,s=0;s<t.length;s++)if(t[s].identifier===e){n=s;break}return n}function s(e,s){for(var i={},o=[],a=0;a<e.length;a++){var l=e[a],c=s.base?l[0]+s.base:l[0],u=i[c]||0,h="".concat(c," ").concat(u);i[c]=u+1;var d=n(h),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,s);s.byIndex=a,t.splice(a,0,{identifier:h,updater:p,references:1})}o.push(h)}return o}function r(e,t){var n=t.domAPI(t);return n.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;n.update(e=t)}else n.remove()}}e.exports=function(e,r){var i=s(e=e||[],r=r||{});return function(e){e=e||[];for(var o=0;o<i.length;o++){var a=n(i[o]);t[a].references--}for(var l=s(e,r),c=0;c<i.length;c++){var u=n(i[c]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}i=l}}},569:e=>{"use strict";var t={};e.exports=function(e,n){var s=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(n)}},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,n)=>{"use strict";e.exports=function(e){var t=n.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(n){!function(e,t,n){var s="";n.supports&&(s+="@supports (".concat(n.supports,") {")),n.media&&(s+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(s+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),s+=n.css,r&&(s+="}"),n.media&&(s+="}"),n.supports&&(s+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(s+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(s,e,t.options)}(t,e,n)},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,n)=>{"use strict";n.d(t,{D:()=>c});var s=n(4469),r=n(976),i=n(7422),o=n(8607),a=n(6286);const l=31;async function c(e,t=!1,n){const a=o.g.forColumn(e);let c;n??(n=new Map);const h=a.isHelm()?(0,i.getHelmMonomers)(e):Object.keys(a.stats.freq).filter((e=>""!==e));for(let e=0;e<h.length;e++)n.has(h[e])||n.set(h[e],`${n.size+1}`);if(a.isHelm())c=await s.functions.call("HELM:getMolFiles",{col:e}),c=function(e,t,n=!1){const s=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 c=e.get(r);i=c.indexOf("\n",i)+1,i=c.indexOf("\n",i)+1,i=c.indexOf("\n",i)+1;const u=parseInt(c.substring(i,i+3)),h=parseInt(c.substring(i+3,i+6));a+=`M V30 COUNTS ${u} ${h} 0 0 0\n`,a+="M V30 BEGIN ATOM\n";for(let e=0;e<u;e++){i=c.indexOf("\n",i)+1+l,o=c.indexOf(" ",i);const s=c.substring(i,o);a+=n?`M V30 ${e+1} R${t.get(s)} 0.000 0.000 0 0\n`:`M V30 ${e+1} At 0.000 0.000 0 0 MASS=${t.get(s)}\n`}a+="M V30 END ATOM\n",a+="M V30 BEGIN BOND\n";for(let e=0;e<h;e++){i=c.indexOf("\n",i)+1;const t=parseInt(c.substring(i,i+3).trim()),n=parseInt(c.substring(i+3,i+6).trim());a+=`M V30 ${e+1} ${parseInt(c.substring(i+6,i+9).trim())} ${t} ${n}\n`}a+="M V30 END BOND\n",a+="M V30 END CTAB\n",a+="M END",s[r]=a}return s}(c,n,t);else{c=new Array(e.length);for(let s=0;s<e.length;s++){const e=u(a.getSplitted(s),n,t);c[s]=e}}return r.Column.fromStrings("monomericMols",c)}function u(e,t,n=!1){let s="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";s+=`M V30 COUNTS ${e.length} ${e.length?e.length-1:0} 0 0 0\n`,s+="M V30 BEGIN ATOM\n";for(let r=0;r<e.length;r++){const i=e.getCanonical(r);i!==a.G2&&(s+=n?`M V30 ${r+1} R${t.get(i)} 0.000 0.000 0 0\n`:`M V30 ${r+1} At 0.000 0.000 0 0 MASS=${t.get(i)}\n`)}s+="M V30 END ATOM\n",s+="M V30 BEGIN BOND\n";for(let t=0;t<e.length-1;t++)s+=`M V30 ${t+1} 1 ${t+1} ${t+2}\n`;return s+="M V30 END BOND\n",s+="M V30 END CTAB\n",s+="M END",s}},7422:(e,t,n)=>{"use strict";n.d(t,{_package:()=>Kt,activityCliffs:()=>Xt,getHelmMonomers:()=>tn,getMonomerLib:()=>zt,getMonomerLibHelper:()=>qt,importFasta:()=>en,sequenceIdentityScoring:()=>nn,sequenceSimilarityScoring:()=>sn,sequenceSpaceTopMenu:()=>Jt,toAtomicLevel:()=>Qt});var s,r,i=n(4469),o=n(3870),a=n(976),l=n(4628);(r=s||(s={})).EUCLIDEAN="EUCLIDEAN",r.MANHATTAN="MANHATTAN";var c=n(701),u=n(3379),h=n.n(u),d=n(7795),m=n.n(d),p=n(569),f=n.n(p),g=n(3565),y=n.n(g),w=n(9216),b=n.n(w),A=n(4589),C=n.n(A),v=n(9414),T={};T.styleTagTransform=C(),T.setAttributes=y(),T.insert=f().bind(null,"head"),T.domAPI=m(),T.insertStyleElement=b(),h()(v.Z,T),v.Z&&v.Z.locals&&v.Z.locals;var S=function(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))};let E=null,_=null;Object.prototype.toString;const x="MCL";a.SEMTYPE.MOLECULE,a.SEMTYPE.MACROMOLECULE;const P=rxjs.operators;n(5697);const $=e=>null==e;function N(e,t,n,s){if(n>e[e.length-1])return;const r=e.findIndex((e=>n<e));e.pop(),e.splice(r,0,n),t.pop(),t.splice(r,0,s)}class M{constructor(){this._workerCount=Math.max(navigator.hardwareConcurrency-2,1)}async calcMultiColumn(e,t,r,i=[{}],o=[1],a=s.EUCLIDEAN){const l=e[0].length*(e[0].length-1)/2,c=Math.floor(l/this._workerCount),u=e[0].length>2e4?await this.getMinimalThreshold(e,t,i,o,a):0;r<u&&(console.log(`using threshold ${u}`),r=u),i.forEach(((e,t)=>i[t].threshold=r));const h=new Array(this._workerCount),d=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(23),n.b))));for(let n=0;n<this._workerCount;n++)h[n]=new Promise(((s,u)=>{const h=n*c,m=n===this._workerCount-1?l:(n+1)*c;m<=h&&s({i:new Int32Array(0),j:new Int32Array(0),distance:new Float32Array(0),idx:n}),d[n].postMessage({values:e,startIdx:h,endIdx:m,threshold:r,fnNames:t,opts:i,weights:o,aggregationMethod:a}),d[n].onmessage=({data:{error:e,i:t,j:r,distance:i}})=>{e?(d[n].terminate(),u(e)):(d[n].terminate(),s({i:t,j:r,distance:i,idx:n}))}}));const m=await Promise.all(h),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,n,s={}){return await this.calcMultiColumn([e],[t],n,[s],[1])}async getKNN(e,t,n=15,s={}){return await this.multiColumnKNN([e],[t],n,[s],[1])}async getThresholdKNN(e,t,n=.8,s={}){return await this.multiColumnThresholdKnn([e],[t],n,[s],[1])}async multiColumnThresholdKnn(e,t,r=.8,i,o,a=s.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),u=new Array(this._workerCount),h=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(427),n.b))));for(let n=0;n<this._workerCount;n++)u[n]=new Promise(((s,u)=>{const d=n*c,m=n===this._workerCount-1?l:(n+1)*c;m<=d&&s({knnDistances:new Array(0),knnIndexes:new Array(0)}),h[n].postMessage({values:e,startIdx:d,endIdx:m,fnNames:t,opts:i,threshold:r,weights:o,aggregationMethod:a}),h[n].onmessage=({data:{error:e,knnDistances:t,knnIndexes:r}})=>{e?(h[n].terminate(),u(e)):(h[n].terminate(),s({knnDistances:t,knnIndexes:r}))}}));const d=await Promise.all(u),m=new Int32Array(e[0].length);for(const t of d)for(let n=0;n<e[0].length;++n)m[n]+=t.knnIndexes[n]?.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 n=0;n<e[0].length;++n)for(let e=0;e<t.knnDistances[n]?.length;++e)p.knnDistances[n][m[n]-1]=t.knnDistances[n][e],p.knnIndexes[n][m[n]-1]=t.knnIndexes[n][e],m[n]-=1;return p}async multiColumnKNN(e,t,r=15,i,o,a=s.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),u=new Array(this._workerCount),h=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(282),n.b))));for(let n=0;n<this._workerCount;n++)u[n]=new Promise(((s,u)=>{const d=n*c,m=n===this._workerCount-1?l:(n+1)*c;m<=d&&s({knnDistances:new Array(0),knnIndexes:new Array(0)}),h[n].postMessage({values:e,startIdx:d,endIdx:m,fnNames:t,opts:i,nNeighbours:r,weights:o,aggregationMethod:a}),h[n].onmessage=({data:{error:e,knnDistances:t,knnIndexes:r}})=>{e?(h[n].terminate(),u(e)):(h[n].terminate(),s({knnDistances:t,knnIndexes:r}))}}));const d=await Promise.all(u),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 n=0;n<e[0].length;++n)for(let e=0;e<t.knnDistances[n]?.length;++e)N(m.knnDistances[n],m.knnIndexes[n],t.knnDistances[n][e],t.knnIndexes[n][e]);return m}async getSampleDistances(e,t,r=[],i,o=s.EUCLIDEAN){const a=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(40),n.b))));try{const n=e[0].length*(e[0].length-1)/2,s=Math.floor(n/this._workerCount),l=1e6,c=Math.max(Math.min(n/1e3,l),Math.min(n,l)),u=Math.floor(c/this._workerCount),h=new Array(this._workerCount);for(let l=0;l<this._workerCount;l++)h[l]=new Promise(((c,h)=>{const d=l*s,m=l===this._workerCount-1?n:(l+1)*s;a[l].postMessage({values:e,startIdx:d,endIdx:m,sampleLength:u,fnNames:t,opts:r,weights:i,aggregationMethod:o}),a[l].onmessage=({data:{error:e,distance:t}})=>{a[l].terminate(),e?h(e):c({distance:t})}}));const d=await Promise.all(h),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,n=[],r,i=s.EUCLIDEAN){try{const s=e.length*(e.length-1)/2,o=await this.getSampleDistances(e,t,n,r,i);return 1-o[Math.floor(7e7/s*o.length)]}catch(e){return console.error(e),.5}}static calcSync(e,t,n,s){const r=[],i=[],o=[];let a=0,l=0,c=0;const u=e.length*(e.length-1)/2;for(;a<u;){const t=$(e[l])||$(e[c])?1:n(e[l],e[c]);1-t>=s&&(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 L,I=n(9657);!function(e){e.none="none",e.bold="bold",e.dashed="dashed"}(L||(L={}));class R{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,n,s,r=L.none){var i;this._currentLineIdx=-1,this.lineClicked=new c.Subject,this.lineHover=new c.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(n),this.canvas=this.sp.getInfo().canvas,this.ctx=this.canvas.getContext("2d"),this.currentLineStyle=r,this.updateLines(s),this.visibility=null!==(i=s.visibility)&&void 0!==i?i:new I.Z(this.lines.from.length),s.visibility||this.visibility.setAll(!0,!1),s.arrowSize&&(this.arrowWidth=s.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,n,s,r,i,o,a,l,c,u,h,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!==(n=this.lines.opacity)&&void 0!==n?n: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:n,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 A=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[e]),this.yAxisCol.get(this.lines.to[e]));let C=null==A?void 0:A.x,v=null==A?void 0:A.y;const T=Math.min(this.sp.viewBox.width,this.sp.viewBox.height);if(this.ctx.beginPath(),w&&b&&C&&v&&Math.hypot(C-w,v-b)/T>.01){if(p){const t=(null===(s=this.lines.colors)||void 0===s?void 0:s[e])?null===(r=this.lines.colors)||void 0===r?void 0:r[e]:"0,128,0",n=(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},${n})`,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,C,v);const s=this.getPointOnDistance(w,b,C,v,g,t),r=this.getPointOnDistance(C,v,w,b,n,t);w=s.x,b=s.y,C=r.x,v=r.y,f=this.lines.from[e]>this.lines.to[e]?this.findControlPoint(m,w,b,C,v,e):this.findControlPoint(m,C,v,w,b,e),this.ctx.moveTo(w,b),this.ctx.quadraticCurveTo(f.x,f.y,C,v)}else this.ctx.moveTo(w,b),this.ctx.lineTo(C,v);if((null!==(c=this.lines.drawArrows)&&void 0!==c?c:null===(u=this.lines.drawArrowsArr)||void 0===u?void 0:u.getBit(e))&&(t||(t=this.getLineLength(w,b,C,v)),t>this.arrowWidth)){const e=m?null:this.getPointOnDistance(w,b,C,v,g,t),n=m?f.x:w,s=m?f.y:b;this.canvasArrow(this.ctx,null!==(h=null==e?void 0:e.x)&&void 0!==h?h:w,null!==(d=null==e?void 0:e.y)&&void 0!==d?d:b,n,s)}this.ctx.stroke(),this.ctx.closePath(),e===this._currentLineIdx&&this.toggleCurrentLineStyle(!1)}}this.fillLeftBottomRect()}toggleCurrentLineStyle(e){switch(this.currentLineStyle){case L.bold:e?this.ctx.lineWidth+=2:this.ctx.lineWidth-=2;break;case L.dashed:e?this.ctx.setLineDash([5,5]):this.ctx.setLineDash([]);break;default:return}}getMarkersSizes(e,t,n){let s=3,r=3;return t?(s=(e.markerMinSize+(e.markerMaxSize-e.markerMinSize)*t.scale(this.lines.from[n]))/2,r=(e.markerMinSize+(e.markerMaxSize-e.markerMinSize)*t.scale(this.lines.to[n]))/2):e.markerDefaultSize&&(s=e.markerDefaultSize/2,r=e.markerDefaultSize/2),{sizeFrom:s,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 I.Z(this.lines.from.length);e.setAll(!0);for(let t=-1;-1!==(t=e.findNext(t));){const n=t,s=this.lines.from[n],r=this.lines.to[n];let i=1;for(let n=t;-1!==(n=e.findNext(n));){const t=this.lines.from[n],o=this.lines.to[n];(t===s&&o===r||o===s&&t===r)&&(this.multipleLinesCounts[n]=++i,e.setBit(n,!1,!1))}i>1&&(this.multipleLinesCounts[n]=1),e.setBit(t,!1,!1)}}checkCoordsOnLine(e,t){let n=-1,s=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),u=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[l]),this.yAxisCol.get(this.lines.from[l])),h=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[l]),this.yAxisCol.get(this.lines.to[l]));if(this.multipleLinesCounts[l]){const n=this.getLineLength(u.x,u.y,h.x,h.y),s=this.getPointOnDistance(u.x,u.y,h.x,h.y,c,n),i=this.getPointOnDistance(h.x,h.y,null==u?void 0:u.x,null==u?void 0:u.y,a,n),o=this.lines.from[l]>this.lines.to[l]?this.findControlPoint(this.multipleLinesCounts[l],s.x,s.y,i.x,i.y,l):this.findControlPoint(this.multipleLinesCounts[l],i.x,i.y,s.x,s.y,l);r=this.calculateDistToCurveLine(l,e,t,s,i,o)}else r=this.calculateDistToStraightLine(e,t,u,h);(!s&&null!==r&&r<5||s&&null!==r&&r<s)&&(s=r,n=l)}return n}calculateDistToStraightLine(e,t,n,s){const r=Math.min(n.x,s.x),i=Math.max(n.x,s.x),o=Math.min(n.y,s.y),a=Math.max(n.y,s.y);return e>=r-2&&e<=i+2&&t>=o-2&&t<=a+2?this.distToStraightLineSegment(e,t,n,s):null}distToStraightLineSegment(e,t,n,s){const r=(e,t,n,s)=>Math.pow(e-n,2)+Math.pow(t-s,2),i=r(n.x,n.y,s.x,s.y);if(0==i)return r(e,t,n.x,n.y);let o=((e-n.x)*(s.x-n.x)+(t-n.y)*(s.y-n.y))/i;return o=Math.max(0,Math.min(1,o)),r(e,t,n.x+o*(s.x-n.x),n.y+o*(s.y-n.y))}calculateDistToCurveLine(e,t,n,s,r,i){const o=Math.min(s.x,r.x,i.x),a=Math.max(s.x,r.x,i.x),l=Math.min(s.y,r.y,i.y),c=Math.max(s.y,r.y,i.y);if(t>=o-2&&t<=a+2&&n>=l-2&&n<=c+2){const e=a-o,u=c-l;return this.calculateDistToCurveInRect(t,n,s,i,r,e,u)}return null}calculateDistToCurveInRect(e,t,n,s,r,i,o){const a=Math.floor((i+o)/3),l=1/a,c=new Uint32Array(a),u=new Uint32Array(a),h=new Uint32Array(a);let d=null;const m=new I.Z(a);for(let i=0;i<c.length;i++){const o=i*l,a=Math.pow(1-o,2)*n.x+2*o*(1-o)*s.x+Math.pow(o,2)*r.x,m=Math.pow(1-o,2)*n.y+2*o*(1-o)*s.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),h[i]=Math.max(p,f),c[i]=a,u[i]=m}for(let e=0;e<c.length;e++)h[e]<d&&m.setBit(e,!0,!1);let p=null;for(let n=-1;-1!==(n=m.findNext(n));){const s=Math.hypot(c[n]-e,u[n]-t);(!p||p>s)&&(p=s)}return p}getLineLength(e,t,n,s){return Math.sqrt(Math.pow(n-e,2)+Math.pow(s-t,2))}getPointOnDistance(e,t,n,s,r,i){const o=n-r*((n-e)/i),l=s-r*((s-t)/i);return new a.Point(o,l)}findControlPoint(e,t,n,s,r,i){const o=t+(s-t)/2,l=n+(r-n)/2;let c=o-t,u=l-n;const h=Math.sqrt(c*c+u*u);c/=h,u/=h;const d=50*Math.ceil(e/2);return e%2==0?new a.Point(o+d/2*u,l-d/2*c):new a.Point(o-d/2*u,l+d/2*c)}canvasArrow(e,t,n,s,r){const i=Math.atan2(s-t,r-n)+Math.PI;e.moveTo(t-this.arrowWidth*Math.sin(i-Math.PI/10),n-this.arrowWidth*Math.cos(i-Math.PI/10)),e.lineTo(t,n),e.lineTo(t-this.arrowWidth*Math.sin(i+Math.PI/10),n-this.arrowWidth*Math.cos(i+Math.PI/10))}}const O="dimensionality-reducer-terminate-event";var F,k,G=n(850);async function D(e,t,s,r,o,a,l){let c=await async function(e,t,s,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,u){const h=new Worker(new URL(n.p+n.u(42),n.b));h.postMessage({columnsData:e,distanceMetrics:t,method:s,options:a,weights:r,aggregationMethod:o});const d=i.events.onCustomEvent(O).subscribe((()=>{try{h?.terminate()}finally{d.unsubscribe()}}));h.onmessage=({data:{error:e,embedding:t,epochNum:n,epochsLength:s}})=>{$(n)||$(s)?(d.unsubscribe(),e?u(e):c(t),setTimeout((()=>h.terminate()),100)):l&&l(n,s,t)}}))}(e,s,t,r,o,a,l);return c=c.map((e=>(0,G.Fv)(e))),c}(k=F||(F={})).EUCLIDEAN="EUCLIDEAN",k.MANHATTAN="MANHATTAN";const B={[F.EUCLIDEAN]:function(e){return`\n var sum = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n sum = sum + distances[i] * distances[i] * computeInfo.weights[i] * computeInfo.weights[i];\n }\n return sqrt(sum);\n `},[F.MANHATTAN]:function(e){return`\n var sum = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n sum = sum + abs(distances[i]) * computeInfo.weights[i];\n }\n return sum;\n `}};var H,W;(W=H||(H={})).HAMMING="Hamming",W.EUCLIDEAN="Euclidean",W.MANHATTAN="Manhattan",W.TANIMOTO="Tanimoto",W.LEVENSTEIN="Levenshtein",W.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",W.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",W.SOKAL="Sokal",W.COSINE="Cosine",W.ASYMMETRIC="Asymmetric",W.Difference="Difference",W.OneHot="One-Hot";const V={[H.HAMMING]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n let sizeDiff: u32 = maxLength - minLength;\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength)) - f32(sizeDiff);\n\n var diff: f32 = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n diff = diff + f32(a[i] != b[i]);\n if (diff > maxIntDistance) {\n return 1.0;\n }\n }\n diff += f32(sizeDiff);\n return diff / ${e};\n `},[H.EUCLIDEAN]:function(e,t){return`\n var dist: f32 = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n dist = dist + f32(a[i] - b[i]) * f32(a[i] - b[i]);\n }\n return sqrt(dist);\n `},[H.MANHATTAN]:function(e,t){return`\n var dist: f32 = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n dist = dist + abs(f32(a[i] - b[i]));\n }\n return dist;\n `},[H.TANIMOTO]:function(e,t){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n\n if (onBitsa == 0u && onBitsb == 0u) {\n return 0.0;\n }\n\n let totalOnBits = onBitsa + onBitsb;\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n\n return 1.0 - f32(commonBits) / f32(totalOnBits - commonBits);\n `},[H.LEVENSTEIN]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n\n let maxIntDistance = ceil(maxDistance * f32(maxLength));\n\n // we will store two arrays as matrix and swap the working indices per pass.\n // this way we can reduce memory usage per computation to just O(aLength)\n // the grid will have aLength + 1 columns and bLength + 1 rows\n // this will be guaranteed by iteration, but the array sizes must be known at compile time, so we will use a fixed size of maxArraySize\n var dynamicPassMat: array<array<f32, ${e+1}u>, 2>; // initialize to 0\n \n var prevIndex: u32 = 0;\n var curIndex: u32 = 1; // we will swap these indices per pass\n\n // initialize the first row\n for (var i = 0u; i <= aLength; i = i + 1u) {\n dynamicPassMat[prevIndex][i] = f32(i);\n }\n\n // iterate over the rows\n for (var i = 1u; i <= bLength; i = i + 1u) {\n dynamicPassMat[curIndex][0] = f32(i);\n var minEntry: f32 = f32(maxLength);\n let prevRow = &dynamicPassMat[prevIndex];\n let curRow = &dynamicPassMat[curIndex];\n let bMon = u32(b[i - 1]);\n for (var j = 1u; j <= aLength; j = j + 1u) {\n var cost: f32 = f32(a[j - 1] != bMon);\n var res: f32 = min(\n min(\n (*prevRow)[j] + 1.0, // deletion\n (*curRow)[j - 1] + 1.0, // insertion\n ),\n (*prevRow)[j - 1] + cost // substitution\n );\n (*curRow)[j] = res;\n if (res < minEntry) {\n minEntry = res;\n }\n }\n // swap the indices\n let temp: u32 = prevIndex;\n prevIndex = curIndex;\n curIndex = temp;\n if (minEntry > maxIntDistance) {\n return 1.0;\n }\n }\n\n return dynamicPassMat[prevIndex][aLength] / f32(maxLength);\n `},[H.NEEDLEMAN_WUNSCH]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength));\n // we will store two arrays as matrix and swap the working indices per pass.\n // this way we can reduce memory usage per computation to just O(aLength)\n // the grid will have aLength + 1 columns and bLength + 1 rows\n // this will be guaranteed by iteration, but the array sizes must be known at compile time, so we will use a fixed size of maxArraySize\n var dynamicPassMat: array<array<f32, ${e+1}u>, 2>; // initialize to 0\n \n // we need to keep track of which operation led to the current cell\n // i.e. whether we came from the left, top or diagonal to assign gap open/gap extend penalty\n var verticalGaps: array<u32, ${e+1}u>;\n var horizontalGaps: array<u32, ${e+1}u>;\n\n let gapOpenPenalty: f32 = suppInfo.gapOpenPenalty${t};\n let gapExtensionPenalty: f32 = suppInfo.gapExtensionPenalty${t};\n var prevIndex: u32 = 0;\n var curIndex: u32 = 1; // we will swap these indices per pass\n // initialize the first row\n for (var i = 0u; i <= aLength; i = i + 1u) {\n dynamicPassMat[prevIndex][i] = gapOpenPenalty + f32(i - 1) * gapExtensionPenalty;\n dynamicPassMat[curIndex][i] = 0.0;\n }\n dynamicPassMat[0][0] = 0.0;\n\n let simMatrix = &suppInfo.similarityMatrix${t}; // using pointers make things faster\n // iterate over the rows\n for (var i = 1u; i <= bLength; i = i + 1u) {\n let prevRow = &dynamicPassMat[prevIndex];\n let curRow = &dynamicPassMat[curIndex];\n (*curRow)[0] = gapOpenPenalty + f32(i - 1) * gapExtensionPenalty;\n var minEntry: f32 = f32(maxLength);\n let monB = u32(b[i - 1]);\n for (var j = 1u; j <= aLength; j = j + 1u) {\n let monA = u32(a[j - 1]);\n \n let cost: f32 = (*prevRow)[j - 1] + 1f - (*simMatrix)[monA][monB];\n var top = (*prevRow)[j]; // deletion\n if (verticalGaps[j] > 0) {\n top = top + gapExtensionPenalty;\n } else {\n top = top + gapOpenPenalty;\n }\n var left = (*curRow)[j - 1]; // insertion\n if (horizontalGaps[j - 1] > 0) {\n left = left + gapExtensionPenalty;\n } else {\n left = left + gapOpenPenalty;\n }\n var res: f32 = min(\n min(\n top, // deletion\n left, // insertion\n ),\n cost // substitution\n );\n (*curRow)[j] = res;\n if (res < minEntry) {\n minEntry = res;\n }\n // update the horizontal and vertical gaps\n if (res == cost) {\n verticalGaps[j] = 0;\n horizontalGaps[j] = 0;\n } else if (res == left) {\n verticalGaps[j] = 0;\n horizontalGaps[j] = 1;\n } else {\n verticalGaps[j] = 1;\n horizontalGaps[j] = 0;\n }\n }\n // swap the indices\n let temp: u32 = prevIndex;\n prevIndex = curIndex;\n curIndex = temp;\n if (minEntry > maxIntDistance) {\n return 1.0;\n }\n }\n return dynamicPassMat[prevIndex][aLength] / f32(maxLength);\n \n `},[H.MONOMER_CHEMICAL_DISTANCE]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n let sizeDiff: u32 = maxLength - minLength;\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength)) - f32(sizeDiff);\n\n let simMatrix = &(suppInfo.similarityMatrix${t}); // using pointers make things faster\n var diff: f32 = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n diff = diff + 1.0 - (*simMatrix)[u32(a[i])][u32(b[i])];\n if (diff > maxIntDistance) {\n return 1.0;\n }\n }\n diff += f32(sizeDiff);\n return diff / ${e};\n `},[H.SOKAL]:function(e,t){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let total = onBitsa + onBitsb;\n if (total == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / f32(total * 2 - commonBits * 3);\n `},[H.COSINE]:function(e,t){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let total = onBitsa * onBitsb; // p.s. here total is taken by multiplying\n if (total == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / sqrt(f32(total));\n `},[H.ASYMMETRIC]:function(e,t){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let min = min(onBitsa, onBitsb);\n if (min == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / f32(min);\n `},[H.Difference]:function(e,t){return`\n let range = suppInfo.range${t};\n return f32(abs(f32(a[0]) - f32(b[0])) / range);\n `},[H.OneHot]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n if (aLength != bLength) {\n return 1.0;\n }\n for (var i = 0u; i < aLength; i = i + 1u) {\n if(a[i] != b[i]) {\n return 1.0;\n }\n }\n return 0.0;\n `}},U={[H.HAMMING]:e=>Math.ceil(e/30),[H.EUCLIDEAN]:e=>Math.ceil(e/30),[H.MANHATTAN]:e=>Math.ceil(e/30),[H.TANIMOTO]:e=>Math.ceil(e/60),[H.SOKAL]:e=>Math.ceil(e/60),[H.COSINE]:e=>Math.ceil(e/60),[H.ASYMMETRIC]:e=>Math.ceil(e/60),[H.LEVENSTEIN]:e=>Math.ceil(e*e/60),[H.NEEDLEMAN_WUNSCH]:e=>Math.ceil(e*e/60),[H.MONOMER_CHEMICAL_DISTANCE]:e=>Math.ceil(e/25),[H.Difference]:e=>1,[H.OneHot]:e=>Math.ceil(e/40)},Y={STRING:new Set([H.HAMMING,H.LEVENSTEIN,H.NEEDLEMAN_WUNSCH,H.MONOMER_CHEMICAL_DISTANCE,H.OneHot]),UINT32ARRAY:new Set([H.HAMMING,H.EUCLIDEAN,H.MANHATTAN,H.MONOMER_CHEMICAL_DISTANCE,H.LEVENSTEIN,H.NEEDLEMAN_WUNSCH,H.TANIMOTO,H.COSINE,H.SOKAL,H.ASYMMETRIC,H.OneHot,H.Difference]),INT32ARRAY:new Set([H.EUCLIDEAN,H.MANHATTAN,H.OneHot,H.Difference]),FLOAT32ARRAY:new Set([H.EUCLIDEAN,H.MANHATTAN,H.Difference]),NUMBER:new Set([H.EUCLIDEAN,H.MANHATTAN,H.Difference]),BITARRAY:new Set([H.TANIMOTO,H.COSINE,H.SOKAL,H.ASYMMETRIC])};var j=function(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))};function K(e,t,n,s){return e.map(((e,s)=>`\n fn distanceScript${s}(aIndex: u32, bIndex: u32) -> f32 {\n let a = computeInfo.data${s}[aIndex];\n let b = computeInfo.data${s}[bIndex];\n let maxDistance: f32 = ${n};\n ${V[e](t[s],s)}\n }\n `)).join("\n")+"\n"+`\n fn combinedDistance(aIndex: u32, bIndex: u32) -> f32 {\n var distances: array<f32, ${e.length}>;\n ${e.map(((e,t)=>`distances[${t}] = distanceScript${t}(aIndex, bIndex);`)).join("\n")}\n ${B[s](e.length)}\n }\n \n `}let q=0;const Z="cliffsDf",z=new c.Subject,X="activity_difference",J="SALI_index",Q="similarity",ee="line_index",te=["1_molecule","2_molecule"],ne="filterCliffs";async function se(e,t,s,r,l,c,u,h,d,m,p,f,g,y,w,b){q++;const A=c/100;let C,v=!1;const T=f.inputs,$=await f.apply({[T[0].name]:t,[T[1].name]:u,...d.preprocessingFuncArgs??{}});let N=[];if(h===x){const t=await function(e,t,s,r,i,o,a=10,l=!1){const c=new Worker(new URL(n.p+n.u(231),n.b));let u;return c.postMessage({data:e,threshold:t,weights:s,aggregationMethod:r,distanceFns:i,distanceFnArgs:o,maxIterations:a,useWebGPU:l}),{promise:new Promise(((e,t)=>{u=e,c.onmessage=t=>{setTimeout((()=>c.terminate()),100),e(t.data.res)},c.onerror=e=>{setTimeout((()=>c.terminate()),100),t(e)}})),terminate:()=>{try{u(null),c.terminate()}catch(e){console.error(e)}}}}([$.entries],c,[1],"MANHATTAN",[u],[$.options??{}],d?.maxIterations??5,d.useWebGPU??!1).promise;e.columns.addNewInt(e.columns.getUnusedName("MCL Cluster")).init((e=>t.clusters[e])),N=[t.embedX,t.embedY]}else N=await D([$.entries],h,[u],[1],"MANHATTAN",{...d,distanceFnArgs:[$.options??{}]});if(N.length!==s.length)throw new Error("Number of axes names should be equal to number of embedding dimensions");for(let t=0;t<N.length;++t)e.columns.addNewFloat(s[t]).init((e=>N[t][e]));let I=null;if(d.useWebGPU)try{I=await function(e,t=.8,n,s,r,i){return j(this,void 0,void 0,(function*(){const o=yield function(){return S(this,void 0,void 0,(function*(){if(!E&&(E=yield navigator.gpu.requestAdapter({powerPreference:"high-performance"}),null==E))return null;let e=!1;if(_&&(_.lost.then((()=>{e=!0})),yield new Promise((e=>setTimeout(e,10)))),!_||e){const e=1e9,t=E.limits,n=t.maxBufferSize,s=t.maxStorageBufferBindingSize;try{return _=yield E.requestDevice({requiredLimits:{maxBufferSize:Math.min(n,e),maxStorageBufferBindingSize:Math.min(s,e)}}),_}catch(e){return console.error("Failed to create device with required limits",e),_=yield E.requestDevice(),_}}return _}))}();if(!o)return null;const a=Object.values(H);if(n.some((e=>!a.includes(e))))throw new Error("Invalid distance metrics provided: "+n.join(", "));if(!Object.values(F).includes(s))throw new Error("Invalid aggregation function provided: "+s);const l=1-t;if(i.length!==e.length||i.length!==n.length||i.length!==r.length)throw new Error("Options, weigths and distance functions must be provided for each column");if(e.some((t=>t.length!==e[0].length)))throw new Error("All entry lists must be the same length");const c=e.length,u=e[0].length,h=e.map(((e,t)=>function(e,t=H.HAMMING,n,s={gapOpenPenalty:1,gapExtensionPenalty:.6}){var r,i;let o=null;const a=e.some((e=>"string"==typeof e))?(o="STRING",e.map((e=>new Uint32Array(e.split("").map((e=>e.charCodeAt(0))))))):e.some((e=>"number"==typeof e))?(o="NUMBER",e.map((e=>new Float32Array([e])))):"object"==typeof e[0]&&e.some((e=>"_data"in e&&"_length"in e))?(o="BITARRAY",e.map((e=>e._data))):e.some((e=>e instanceof Float32Array))?(o="FLOAT32ARRAY",e):e.some((e=>e instanceof Uint32Array))?(o="UINT32ARRAY",e):e.some((e=>e instanceof Int32Array))?(o="INT32ARRAY",e):void 0;if(!a||!o)throw new Error("Invalid entry type, could not determine entry type from input list");const l=a[0]instanceof Int32Array?"INT32ARRAY":a[0]instanceof Float32Array?"FLOAT32ARRAY":"UINT32ARRAY",c=new Uint32Array(a.map((e=>e.length)));if(!Y[o]||!Y[o].has(t))throw new Error(`Distance metric '${t}' not supported for entry type '${o}'`);const u=c.reduce(((e,t)=>Math.max(e,t)),0),h=U[t](u),d="INT32ARRAY"===l?Int32Array:"FLOAT32ARRAY"===l?Float32Array:Uint32Array,m=new d(a.length*u);a.forEach(((e,t)=>{m.set(e,t*u)}));let p="",f=0,g="FLOAT32ARRAY",y=null;if(t===H.NEEDLEMAN_WUNSCH||t===H.MONOMER_CHEMICAL_DISTANCE){let e=s.scoringMatrix&&s.alphabetIndexes?Object.keys(s.alphabetIndexes).reduce(((e,t)=>Math.max(e,t.charCodeAt(0))),0):-1;if(!s.alphabetIndexes||!s.scoringMatrix){for(let t=0;t<m.length;t++)m[t]>e&&(e=m[t]);s.scoringMatrix=new Array(e+1).fill(null).map((()=>new Array(e+1).fill(0))),s.alphabetIndexes={};for(let e=0;e<s.scoringMatrix.length;e++)s.scoringMatrix[e][e]=1,s.alphabetIndexes[String.fromCharCode(e)]=e}const t=(e+1)*(e+1),o=new Array(e+1).fill(null).map((()=>new Float32Array(e+1)));for(let t=0;t<e+1;t++)o[t][t]=1;const a=s.alphabetIndexes;for(const e of Object.keys(a))for(const t of Object.keys(a))e!==t&&(o[e.charCodeAt(0)][t.charCodeAt(0)]=s.scoringMatrix[a[e]][a[t]]);f=2+t,g="FLOAT32ARRAY",y=new Float32Array(f),y[0]=null!==(r=s.gapOpenPenalty)&&void 0!==r?r:1,y[1]=null!==(i=s.gapExtensionPenalty)&&void 0!==i?i:.6;let l=2;for(let e=0;e<o.length;e++)y.set(o[e],l),l+=o[e].length;p=`\n gapOpenPenalty${n}: f32,\n gapExtensionPenalty${n}: f32,\n similarityMatrix${n}: array<array<f32, ${e+1}>, ${e+1}>`}else if(t===H.Difference){if(!s.range||"number"!=typeof s.range||s.range<=0){const e=m.reduce(((e,t)=>Math.min(e,t)),m[0]),t=m.reduce(((e,t)=>Math.max(e,t)),m[0]);s.range=t-e}s.range<=0&&(s.range=1),f=1,g="FLOAT32ARRAY",y=new Float32Array([s.range]),p=`\n range${n}: f32`}const w=m instanceof Int32Array?"i32":m instanceof Float32Array?"f32":"u32",b=`data${n}: array<array<${w}, ${u}>, ${a.length}>`;return{flatSourceArray:m,sourceArraySize:m.length,maxEntryLen:u,arraySizes:c,complexity:h,suppInfoBuffer:y,suppInfoSize:f,suppInfoType:g,suppInfoStructWgsl:p,entryType:o,dataTypeWGSL:w,dataStructWgsl:b,EncodedArrayConstructor:d}}(e,n[t],t,i[t])));if(0===c)throw new Error("No columns provided. Please provide at least one column of data.");1===c&&(s=F.MANHATTAN);let d=h.map((e=>e.suppInfoStructWgsl)).filter((e=>!!e&&""!=e)).join(",\n"),m=!1;d&&""!=d.trim()||(m=!0,d="\ndummy: f32\n");const p=h.map((e=>e.dataStructWgsl)).filter((e=>!!e&&""!=e)).join(",\n"),f=new Uint32Array(c*u);h.forEach(((e,t)=>{f.set(e.arraySizes,t*u)}));const g=1e4,y=100,w=h.reduce(((e,t)=>e+t.complexity),0),b=Math.ceil(1e4/w),A=Math.ceil(Math.sqrt(Math.ceil(100))),C=10*A,v=u*(u-1)/2,T=Math.ceil(v/g),x=o.createShaderModule({label:"Sparse matrix compute shader",code:`\n // each thread will perform 100 iterations at one time, comparing 100 pairs of entries.\n // in total, each thread will perform at most ${T} comparisons.\n // first is the result struct, containing is, js, and distances. each array with length of 100,\n // and also integer for how many pairs were found to be below threshold.\n struct SparseResult {\n i: array<array<u32, 100>, 10000>,\n j: array<array<u32, 100>, 10000>,\n distances: array<array<f32, 100>, 10000>,\n found: array<u32, 10000>,\n done: array<u32, 10000>\n }\n // struct for the data\n struct ComputeInfo {\n // start at cols and rows, and end at cols and rows for each thread, these will be calculated on cpu and passed to gpu.\n startAtCols: array<u32, 10000>,\n startAtRows: array<u32, 10000>,\n endAtCols: array<u32, 10000>,\n endAtRows: array<u32, 10000>,\n\n // the ACTUALLY sizes of each entry\n entrySizes: array<array<u32, ${u}>, ${c}>,\n // the weights for each entry\n weights: array<f32, ${c}>,\n // the data for each entry\n ${p} // an example of the dataWgsl would be:\n //data0: array<array<u32,20>,100>,\n //data1: array<array<u32,20>,100>\n }\n\n // struct for the supplementary information\n struct SuppInfo {\n // struct containing all the supplementary info, like scoring matrix, alphabet indexes, range, etc.\n ${d}\n };\n\n @group(0) @binding(0) var<storage, read_write> computeInfo: ComputeInfo;\n @group(0) @binding(1) var<storage, read_write> suppInfo: SuppInfo;\n @group(0) @binding(2) var<storage, read_write> results: SparseResult;\n @compute @workgroup_size(10, 10) fn calcSparseMatrix(\n @builtin(global_invocation_id) id: vec3<u32>\n ) {\n ${m?"let otherDummy = suppInfo.dummy * 2;":""} // just to make sure that the suppInfo is not optimized out\n let threadCol = id.x;\n let threadRow = id.y;\n let linearIndex = threadRow * ${C} + threadCol;\n if (linearIndex >= 10000) {\n return; // if we are out of bounds, return\n } \n var startAtCol: u32 = computeInfo.startAtCols[linearIndex];\n var startAtRow: u32 = computeInfo.startAtRows[linearIndex];\n let endAtCol: u32 = min(computeInfo.endAtCols[linearIndex], ${u}u);\n let endAtRow: u32 = min(computeInfo.endAtRows[linearIndex], ${u}u);\n let is = &results.i[linearIndex];\n let js = &results.j[linearIndex];\n let distances = &results.distances[linearIndex];\n results.found[linearIndex] = 0; // initialize the found counter\n var found: u32 = 0;\n if (results.done[linearIndex] > 0) {\n return; // if we are done, return\n }\n for (var i = 0; i < ${b}; i++) {\n if (startAtCol >= endAtCol && startAtRow >= endAtRow) {\n results.done[linearIndex] = 1;\n break;\n }\n if (found >= 100) {\n break;\n }\n let dist = combinedDistance(startAtCol, startAtRow);\n if (dist <= ${l}) {\n (*is)[found] = startAtCol;\n (*js)[found] = startAtRow;\n (*distances)[found] = dist;\n found = found + 1;\n }\n startAtCol = startAtCol + 1;\n if (startAtCol >= ${u}u) {\n startAtRow += 1;\n startAtCol = startAtRow + 1;\n }\n }\n results.found[linearIndex] = found;\n // update the startAtCols and startAtRows\n computeInfo.startAtCols[linearIndex] = startAtCol;\n computeInfo.startAtRows[linearIndex] = startAtRow;\n\n }\n\n // this will generate the distance script for each distance metric and then combine them into one\n ${K(n,h.map((e=>e.maxEntryLen)),l,s)}\n\n\n `}),P=o.createComputePipeline({label:"sparse matrix compute pipeline",layout:"auto",compute:{module:x,entryPoint:"calcSparseMatrix"}}),$=new Uint32Array(g),N=new Uint32Array(g),M=new Uint32Array(g),L=new Uint32Array(g),I=Math.floor(v/g);let R=0,O=1;console.time("GPUthreadStarts");for(let e=0;e<g;e++){const t=9999===e?v-1:(e+1)*I,n=u-2-Math.floor(Math.sqrt(-8*t+4*u*(u-1)-7)/2-.5),s=t-u*n+Math.floor((n+1)*(n+2)/2);$[e]=O,N[e]=R,M[e]=s,L[e]=n,R=n,O=s}console.timeEnd("GPUthreadStarts");const k=4e4+u*c+c+h.reduce(((e,t)=>e+t.sourceArraySize),0),G=h.reduce(((e,t)=>e+t.suppInfoSize),0),D=1e6,B=k*Uint32Array.BYTES_PER_ELEMENT;let W=B;const V=15&B;0!==V&&(W+=16-V);const j=o.createBuffer({label:"compute info buffer",size:W,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),q=j.getMappedRange();let Z=0;new Uint32Array(q,Z,g).set($),Z+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(q,Z,g).set(N),Z+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(q,Z,g).set(M),Z+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(q,Z,g).set(L),Z+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(q,Z,f.length).set(f),Z+=f.length*Uint32Array.BYTES_PER_ELEMENT,new Float32Array(q,Z,c).set(r),Z+=c*Float32Array.BYTES_PER_ELEMENT;for(const e of h){const t=e.EncodedArrayConstructor,n=e.sourceArraySize;new t(q,Z,n).set(e.flatSourceArray),Z+=n*t.BYTES_PER_ELEMENT}j.unmap();const z=G*Uint32Array.BYTES_PER_ELEMENT;let X=z;const J=15&z;0!==J&&(X+=16-J),X=Math.max(X,16);const Q=o.createBuffer({label:"supp info buffer",size:X,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),ee=Q.getMappedRange();let te=0;for(const e of h)e.suppInfoBuffer&&e.suppInfoBuffer.byteLength>0&&e.suppInfoSize>0&&(new("UINT32ARRAY"===e.suppInfoType?Uint32Array:Float32Array)(ee,te,e.suppInfoBuffer.length).set(e.suppInfoBuffer),te+=e.suppInfoBuffer.byteLength);0===te&&new Uint32Array(ee,0,4).set([1,1,1,1]),Q.unmap();const ne=302e4*Uint32Array.BYTES_PER_ELEMENT;let se=ne;const re=15≠0!==re&&(se+=16-re);const ie=o.createBuffer({label:"results buffer",size:se,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC}),oe=o.createBindGroup({label:"bindGroup for sparse matrix buffer",layout:P.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:j}},{binding:1,resource:{buffer:Q}},{binding:2,resource:{buffer:ie}}]}),ae=o.createBuffer({label:"results out buffer",size:ie.size,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),le=[],ce=[],ue=[];let he=!1;for(;!he;){const e=o.createCommandEncoder({label:"distance encoder"}),t=e.beginComputePass({label:"distance compute pass"});t.setPipeline(P),t.setBindGroup(0,oe),t.dispatchWorkgroups(A,A),t.end(),e.copyBufferToBuffer(ie,0,ae,0,ae.size);const n=e.finish();o.queue.submit([n]),yield o.queue.onSubmittedWorkDone(),yield ae.mapAsync(GPUMapMode.READ);const s=ae.getMappedRange();let r=0;const i=new Uint32Array(s,r,D);r+=D*Uint32Array.BYTES_PER_ELEMENT;const a=new Uint32Array(s,r,D);r+=D*Uint32Array.BYTES_PER_ELEMENT;const l=new Float32Array(s,r,D);r+=D*Float32Array.BYTES_PER_ELEMENT;const c=new Uint32Array(s,r,g);r+=g*Uint32Array.BYTES_PER_ELEMENT,he=new Uint32Array(s,r,g).every((e=>1===e));const u=c.reduce(((e,t)=>e+t),0),h=new Uint32Array(u),d=new Uint32Array(u),m=new Float32Array(u);let p=0;for(let e=0;e<c.length;e++){const t=c[e];0!==t&&(h.set(i.subarray(e*y,e*y+t),p),d.set(a.subarray(e*y,e*y+t),p),m.set(l.subarray(e*y,e*y+t),p),p+=t)}le.push(h),ce.push(d),ue.push(m),ae.unmap()}const de=le.reduce(((e,t)=>e+t.length),0),me=new Uint32Array(de),pe=new Uint32Array(de),fe=new Float32Array(de);let ge=0;for(let e=0;e<le.length;e++)me.set(le[e],ge),pe.set(ce[e],ge),fe.set(ue[e],ge),ge+=le[e].length;return j.destroy(),Q.destroy(),ie.destroy(),ae.destroy(),{i:me,j:pe,distance:fe}}))}([$.entries],A,[u],F.MANHATTAN,[1],[$.options??{}])}catch(e){console.error(e)}I||(d.useWebGPU&&console.error("WebGPU sparse matrix calculation failed, falling back to CPU implementation"),I=await(new M).calc($.entries,u,A,$.options));const O=await async function(e,t){const n=e.distance.map(((n,s)=>{const r=Math.abs(t.get(e.i[s])-t.get(e.j[s]));return 0!=n?r/n:1/0})),s=e.distance.map((e=>1-e)),r=e.i,i=e.j,o=new Set;return e.distance.forEach(((t,n)=>{o.add(e.i[n]),o.add(e.j[n])})),{simVals:s,saliVals:n,n1:r,n2:i,cliffsMolIds:o}}(I,l),k=function(e,t,n,s,r,i){const o=new Array(e).fill(0);for(let e=0;e!=n.length;++e)t[e]!=1/0&&(i.get(n[e])>i.get(s[e])?o[n[e]]+=t[e]:o[s[e]]+=t[e]);return a.Column.fromList("double",`sali_${r[0].substring(r[0].lastIndexOf("_"))}`,o)}(t.length,O.saliVals,O.n1,O.n2,s,l);e.columns.add(k);const G=function(e,t){const n=a.BitSet.create(e.rowCount);for(let s=0;s<e.rowCount;s++)n.set(s,t.has(s));return n}(e,O.cliffsMolIds),B=function(e){const t=e.filter((e=>e!==1/0)),n=t.reduce(((e,t)=>Math.min(e,t)),Number.MAX_VALUE),s=t.reduce(((e,t)=>Math.max(e,t)),n);return{max:s,min:n}}(O.saliVals),W=.8/(B.max-B.min),V=i.shell.getTableView(e.name),se=V.addViewer(a.VIEWER.SCATTER_PLOT,{xColumnName:s[0],yColumnName:s[1],size:k.name,color:l.name,showXSelector:!1,showYSelector:!1,showSizeSelector:!1,showColorSelector:!1,markerMinSize:5,markerMaxSize:25,title:r}),re=function(e,t,n,s,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 n=0;n<t.n1.length;n++)c.from[n]=t.n1[n],c.to[n]=t.n2[n],c.opacities[n]=t.saliVals[n]===1/0?1:.2+(t.saliVals[n]-o.min)*l,c.colors[n]=e.selection.get(c.from[n])&&e.selection.get(c.to[n])?"255,255,0":"0,128,0",c.widths[n]=1;const u=a.DataFrame.create(c.from.length);return te.forEach(((e,t)=>{u.columns.addNewString(e).init((e=>n.get(0===t?c.from[e]:c.to[e]))),function(e,t){Object.keys(t).forEach((n=>{e.tags[n]=t[n]}))}(u.col(e),i),u.col(e).semType=r})),u.columns.addNewFloat(X).init((e=>Math.abs(s.get(c.from[e])-s.get(c.to[e])))),u.columns.addNewInt(ee).init((e=>e)),u.columns.addNewFloat(J).init((e=>t.saliVals[e])),u.columns.addNewFloat(Q).init((e=>t.simVals[e])),u.name=`${Z}${q}`,{lines:c,linesDf:u}}(e,O,t,l,m,p,B,W);re.lines.skipMultiLineCalculation=!0,re.linesDf.col(J).setTag("description","Structure−Activity Landscape Index (activity difference divided by 1 minus similarity)");const ie=new R(se,s[0],s[1],re.lines,L.none),oe=w?w(re.linesDf,te).sort([J],[!1]):re.linesDf.plot.grid().sort([J],[!1]);oe.col(ee)&&(oe.col(ee).visible=!1),e.temp[".cliffsDfGrid"]=oe;const ae=o.button(`${re.linesDf.rowCount} cliffs`,(()=>{V.dockManager.dock(oe,"down",null,"Activity cliffs",b??.2)}));ae.classList.add("scatter_plot_link","cliffs_grid"),se.root.append(ae);const le=o.switchInput("Show only cliffs",!1,(()=>{le.value?(se.dataFrame.setTag(ne,s[0]),e.filter.and(G),z.next(s[0])):(se.dataFrame.setTag(ne,""),e.filter.setAll(!0),z.next(""))}));le.root.classList.add("scatter_plot_link","show_only_cliffs"),se.root.append(le.root),z.subscribe((e=>{le.enabled=""===e||e===s[0]}));let ce=!1;se.onEvent("d4-before-draw-scene").subscribe((t=>{ce?ce=!1:le.value&&(setTimeout((()=>{e.filter.and(G)}),100),ce=!0)}));const ue=i.events.onViewerClosed.subscribe((e=>{e.args.viewer===se&&(V.dockManager.close(oe.root),ue.unsubscribe(),V.subs=V.subs.filter((e=>e!==ue)))}));return V.subs.push(ue),re.linesDf.onCurrentCellChanged.subscribe((()=>{for(let e=0;e<re.linesDf.rowCount;e++)re.lines.widths[e]=e===re.linesDf.currentRowIdx?3:1;ie.linesToRender=re.lines;const n=re.linesDf.currentCol&&re.linesDf.currentCol.name===te[1]?re.lines.to:re.lines.from,r=-1!==re.linesDf.currentRowIdx?re.linesDf.currentRowIdx:null;if(se.dataFrame.currentRowIdx=r?n[r]:-1,null!==r){const n=re.linesDf.currentRowIdx;ie.currentLineId=n;const{zoomLeft:a,zoomRight:c,zoomTop:u,zoomBottom:h}=function(e,t,n,s,r,i){const o=Math.abs(n-r),a=Math.abs(s-i),l=e/o,c=t/a,u=Math.min(l,c),h=e/u*5,d=t/u*5,m=(n<r?n:r)+o/2-h/2,p=(s>i?s:i)-a/2+d/2;return{zoomLeft:m,zoomRight:m+h,zoomTop:p,zoomBottom:p-d}}(se.viewport.width,se.viewport.height,se.dataFrame.get(s[0],re.lines.from[n]),se.dataFrame.get(s[1],re.lines.from[n]),se.dataFrame.get(s[0],re.lines.to[n]),se.dataFrame.get(s[1],re.lines.to[n]));se.zoom(a,u,c,h),le.value?e.filter.and(G):!0===le.enabled&&e.filter.setAll(!0),setTimeout((()=>{!function(e,t,n,s,r,a,l,c,u){const h=t.getPane("Cliff Details");o.empty(h.root);const d=u({points:[n,s],lineId:r,df:e,seqCol:a,activityCol:l,sali:c});h.root.append(d),setTimeout((()=>{i.shell.o=t.root}),500)}(e,C,re.lines.from[r],re.lines.to[r],r,t,l,re.linesDf.get(J,r),y);const n=se.dataFrame.getSortedOrder(V.grid.sortByColumns,V.grid.sortTypes);V.grid.scrollToCell(t.name,n.indexOf(se.dataFrame.currentRowIdx))}),1e3)}})),re.linesDf.onSelectionChanged.subscribe((t=>{setTimeout((()=>(()=>{const t=a.BitSet.create(e.rowCount);for(let e=0;e<re.linesDf.rowCount;e++){const n=re.linesDf.selection.get(e);n&&(t.set(re.lines.from[e],!0),t.set(re.lines.to[e],!0)),re.lines.colors[e]=n?"255,255,0":"0,128,0"}e.selection.copyFrom(t),ie.linesToRender=re.lines})()),100)})),e.onSelectionChanged.subscribe((t=>{!1===e.selection.anyTrue&&"number"==typeof t&&(v?v=!1:(e=>{e.selection.setAll(!1);for(let e=0;e<re.lines.colors.length;e++)re.lines.colors[e]="0,128,0";ie.linesToRender=re.lines})(oe.dataFrame))})),ie.lineClicked.subscribe((t=>{if(v=!0,ie.currentLineId=t.id,-1!==t.id){const n=re.linesDf.selection.clone();setTimeout((()=>{t.event.ctrlKey?(n.set(t.id,!n.get(t.id)),re.linesDf.selection.copyFrom(n)):(re.linesDf.currentRowIdx!==t.id&&(re.linesDf.currentRowIdx=t.id,e.currentRowIdx=re.lines.from[t.id]),re.linesDf.selection.copyFrom(n));const s=re.linesDf.getSortedOrder(oe.sortByColumns,oe.sortTypes);oe.scrollToCell(te[0],s.indexOf(t.id))}),500)}})),ie.lineHover.pipe((0,P.debounceTime)(500)).subscribe((n=>{-1!==n.id&&-1===e.mouseOverRowIdx&&o.tooltip.show(g({lineId:n.id,points:[re.lines.from[n.id],re.lines.to[n.id]],df:e,seqCol:t,activityCol:l}),n.x,n.y)})),se.addProperty("similarityLimit","double",A),C=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}(),se}var re,ie=n(8447),oe=n(8607),ae=n(5226),le=n(7228),ce=n(8457);async function ue(e,t,n,s){const r=(0,ce.O)(t),i=oe.g.forColumn(t).getNewColumnFromList("ref",[n]),o=oe.g.forColumn(i).getSplitted(0),l=s===re.IDENTITY?function(e,t){const n=t.columns.length,s=new Array(n),r=new Array(n),i=new Array(n);for(let o=0;o<n;++o){const n=t.columns.byIndex(o);s[o]=n.getRawData(),r[o]=n.categories.indexOf(""),i[o]=n.categories.indexOf(e.getOriginal(o)??"")}const o=a.Column.float("Identity",t.rowCount),l=o.getRawData();for(let n=0;n<t.rowCount;++n){l[n]=0;for(let t=0;t<e.length;++t)s[t][n]===i[t]&&++l[n];l[n]/=e.length}return o}(o,r):s===re.SIMILARITY?await async function(e,t){const n=t.columns.toList();return await(0,le.Qx)(n,e)}(o,r):null;if(null===l)throw new Error(`In bio library: Unkown sequence scoring method: ${s}`);return l.name=e.columns.getUnusedName(l.name),e.columns.add(l),l}!function(e){e.IDENTITY="identity",e.SIMILARITY="similarity"}(re||(re={}));var he=n(7945),de=(n(4293),n(6414)),me=n.n(de),pe=n(8260);const fe="rgb(100,100,100)",ge="#808080",ye="rgb(0,0,0)",we=pe.GU;var be,Ae;function Ce(e,t,n,s,r,i,o=fe,a=0,l=!1,c=1,u="",h=!1,d=Ae.classic,m=[],p=0,f=null,g=null,y=null,w={}){r.textAlign="start";let b=i.substring(0),A=h?"":u;d===Ae.MSA&&(A="");let C=!0,v=!0,T="difference";if(null!=f&&null!=f.cell.column&&(C=f.cell.column.temp["color-code"]??!0,v=f.cell.column.temp["compare-with-current"]??!0,T=f.cell.column.temp["highlight-difference"]??"difference"),g){const e=g[p];v&&g.length>0&&"difference"===T&&(c=b==e?.3:c),v&&g.length>0&&"equal"===T&&(c=b!=e?.3:c)}null!=y&&(b=we(b,y));const S=b+A;w[S]??(w[S]=r.measureText(S));let E=w[S];w[b]??(w[b]=r.measureText(b));let _=w[b].width;w[A]??(w[A]=r.measureText(A));const x=w[A].width,P=s/2-(E.fontBoundingBoxAscent+E.fontBoundingBoxDescent)/2+1;function $(n,s){const i=C?o:ye;r.fillStyle=i,r.globalAlpha=c,d===Ae.classic&&(r.fillText(b,e+n,t+P),r.fillStyle=ge,r.fillText(A,e+s,t+P)),d===Ae.MSA&&r.fillText(b,e+n,t+P)}E=E.width,d===Ae.MSA&&(_=m[p],E=m[p]);const N=(m[p]??0)-(m[0]??0);if(l||E>n)return $(N,N+_),e+N+_+x;{const t=(n-E)/2;return $(t,t+_),e+N+t+_}}!function(e){e.maxMonomerLength=".mm.cellRenderer.maxMonomerLength"}(be||(be={})),function(e){e.MSA="MSA",e.classic="classic"}(Ae||(Ae={})),n(9611);var ve,Te,Se=n(7331);function Ee(e){const t=!me().enumerate(e).some((([t,n])=>t.length>1&&0!=n&&n!=e.length-1)),n=[],s=t?"":" ";for(const[t,r]of me().enumerate(e)){let i=t;r<e.length&&(i+=`${t?"":"-"}${s}`),n.push(i)}return[n,t]}n(9713),(Te=ve||(ve={})).long="long",Te.short="short",n(3553),ie.GU;class _e 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[n,s,r]=(0,cell_renderer_back_base.N)(e),i=r.rendererBack;if(!i)return;const a=e.bounds,l=t.offsetX-e.gridColumn.left+(e.gridColumn.left-a.x),c=i.getPosition(e.tableRowIndex,l,a.width),u=oe.g.forColumn(s).getSplitted(e.tableRowIndex).canonicals;if(null!==c&&c<u.length){const e=u[c],n=[];let r=i._monomerStructureMap[e];i._monomerStructureMap[e]=(()=>{const t=oe.g.forColumn(s).alphabet??"UN",n=alphabetPolymerTypes[t],r=zt();return r?r.getTooltip(n,e):o.divText("Monomer library is not available")})(),n.push(r),o.tooltip.show(o.divV(n),t.x+16,t.y+16)}else o.tooltip.hide()}render(e,t,n,s,r,i,o){const l=window.devicePixelRatio,[c,u,h]=(0,cell_renderer_back_base.N)(i);if(!u)return;const d=u.temp;const m=d["monomer-width"];if("short"===(null!=m?m:"short")){const e=parseInt(u.getTag(be.maxMonomerLength));isNaN(e)&&Kt.properties?.MaxMonomerLength}const[p,f,g]=(0,cell_renderer_back_base.N)(i);let y=g.rendererBack;y||(g.rendererBack=new cell_renderer_monomer_placer.A(c,u,Kt.logger,(()=>{const e=oe.g.forColumn(u);return{seqHandler:e,monomerCharWidth:7,separatorWidth:e.isMsa()?8:0,monomerToShort:cell_renderer_monomerToShortFunction,monomerLengthLimit:50}}))),e.save();try{u.tags[".mm.cellRenderer.settingsChanged"]===cell_renderer_consts_rendererSettingsChangedState_true&&(d[".mm.cellRenderer.gapLength"],y.setMonomerLengthLimit(50),y.setSeparatorWidth(y.isMsa()?8:0),u.setTag(".mm.cellRenderer.settingsChanged",cell_renderer_consts_rendererSettingsChangedState_false));const[o,h]=y.getCellMonomerLengths(i.tableRowIndex,s),m=(o.length,i.cell.value,i.cell.rowIndex),p=u.getTag("alphabet"),f=50;getUpdatedWidth(c?.grid,e,t,s,l),e.beginPath(),e.rect(t+this.padding,n+this.padding,s-this.padding-1,r-2*this.padding),e.clip(),e.font="12px monospace",e.textBaseline="top";const g=u.getTag(a.TAGS.UNITS),w=u.getTag("aligned"),b=(0,ie.py)(p),A=u.getTag("separator")??"",C=y.props.separatorWidth+1*y.props.monomerCharWidth,v=Math.ceil(s/C),T=oe.g.forColumn(u),S=d["reference-sequence"],E=d["current-word"];E&&-1===u?.dataFrame?.currentRowIdx&&(d["current-word"]=null);const _=(()=>{const e=T.getSplitter(v);return me()(e(null!=S&&""!=S?S:E??"").originals).toArray()})(),x=T.getSplitted(m);let P=cell_renderer_undefinedColor,$=Ae.classic;w&&w.includes("MSA")&&g==ie.r2.SEPARATOR&&Ae.MSA;const N=Math.min(x.length,v);for(let o=0;o<N;++o){const a=x.getOriginal(o);b.get(a),e.fillStyle=cell_renderer_undefinedColor;const l=o===x.length-1;if(Ce(t+this.padding,n,s,r,e,a,P,0,!0,1,A,l,$,h,o,i,_,50,y._monomerLengthMap),f>s)break}}catch(e){const[t,n]=(0,he.yf)(e);y.logger.error(t,void 0,n),y.errors.push(e)}finally{e.restore()}}}class xe 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,n,s,r,i,o){const l=window.devicePixelRatio,c=i.grid,u=i.cell,h=i.tableColumn,d=u.value??"",m=h.tags.separator,p=h.tags[a.TAGS.UNITS];getUpdatedWidth(c,e,t,s,l);const[f,g]=d.split("#"),y=(0,pe.vU)(p,m);Pe(e,t,n,s,r,me()(y(f).canonicals).toArray(),me()(y(g).canonicals).toArray(),p)}}function Pe(e,t,n,s,r,i,o,a,l,c){if(i.length!==o.length){const e=function(e,t){let n=0,s=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]&&n++;const o=r.length-i.length;for(let e=r.length-1;e>o;e--)r[e]===i[e-o]&&s++;const a=new Array(Math.abs(e.length-t.length)).fill(oe.lh[ie.r2.FASTA]);function l(e){return n>s?e.concat(a):a.concat(e)}return e.length>t.length?t=l(me()(t).toArray()):e=l(me()(e).toArray()),{subParts1:e,subParts2:t}}(i,o);i=e.subParts1,o=e.subParts2}const u=e.measureText(Ee(i).join("")),h=e.measureText(Ee(o).join("")),d=Math.max(u.width,h.width);l&&(s=d+4*i.length,e.canvas.width=d+4*i.length);let m=Math.max(t,t+(s-(d+4*i.length))/2)+5;const p=Math.max(n,n+(r-28)/2);e.save(),e.beginPath(),e.rect(t,n,l?d+4*i.length:s,r),e.clip(),e.font="12px monospace",e.textBaseline="top";let f=Se.UE.Color;"HELM"!=a&&(f=(0,ie.py)(a.substring(a.length-2)));for(let t=0;t<i.length;t++){const n=i[t],a=o[t],l=f.get(n);if(n!=a){const i=f.get(a),o=Ce(m,p-7,s,r,e,n,l,0,!0),u=Ce(m,p+7,s,r,e,a,i,0,!0);m=Math.max(u,o),c&&(c[t]=$e(n,a,l,i,p,7,r))}else m=Ce(m,p,s,r,e,n,l,0,!0,.5);m+=4}e.restore()}function $e(e,t,n,s,r,i,o){const a=document.createElement("canvas"),l=a.getContext("2d");l.font="12px monospace";const c=l.measureText(Ee([e]).join("")).width,u=l.measureText(Ee([t]).join("")).width,h=Math.max(c,u);return a.height=o,a.width=h+4,l.font="12px monospace",l.textBaseline="top",Ce(0,r-i,h,o,l,e,n,0,!0),Ce(0,r+i,h,o,l,t,s,0,!0),a}var Ne,Me=n(2997),Le=n(9298);!function(e){e.Unknown="unknown",e.FR="framework",e.CDR="cdr"}(Ne||(Ne={}));const Ie=new class{constructor(){this.regionTypes=[Ne.CDR],this.chains=["Heavy","Light"],this.skipEmptyPositions=!1,this.fitWidth=!1,this.positionWidth=16,this.positionHeight=Le.ES.Entropy,this.filterSource=Le.vS.filterSource}};var Re=n(172),Oe=n(8415);const Fe=Ne;var ke,Ge;!function(e){e.STYLE="Style",e.BEHAVIOR="Behavior",e.LAYOUT="Layout",e.DATA="Data"}(ke||(ke={})),function(e){e.skipEmptyPositions="skipEmptyPositions",e.regionTypes="regionTypes",e.chains="chains",e.fitWidth="fitWidth",e.positionWidth="positionWidth",e.positionHeight="positionHeight",e.filterSource="filterSource"}(Ge||(Ge={}));const De=Ie;class Be extends a.JsViewer{constructor(){super(),this.viewed=!1,this.regionsFg=null,this.regionsRoot=null,this.isOpened=!1,this.panelNode=null,this.regions=[],this.viewerId=++Be.viewerCounter,this.setDataInProgress=!1,this.host=null,this.mainLayout=null,this.logos=[],this.viewSubs=[],this.calcSizeRequested=!1,this._onRendered=new c.Subject,this.skipEmptyPositions=this.bool(Ge.skipEmptyPositions,De.skipEmptyPositions,{category:ke.DATA}),this.regionTypes=this.stringList(Ge.regionTypes,De.regionTypes,{category:ke.DATA,choices:Object.values(Fe).filter((e=>e!=Fe.Unknown))}),this.chains=this.stringList(Ge.chains,De.chains,{category:ke.DATA,choices:["Heavy","Light"]}),this.fitWidth=this.bool(Ge.fitWidth,De.fitWidth,{category:ke.LAYOUT}),this.positionWidth=this.float(Ge.positionWidth,De.positionWidth,{category:ke.LAYOUT,editor:"slider",min:0,max:64,description:"Internal WebLogo viewers property width of position."}),this.positionHeight=this.string(Ge.positionHeight,De.positionHeight,{category:ke.LAYOUT,choices:Object.keys(Le.ES)}),this.filterSource=this.string(Ge.filterSource,De.filterSource,{category:ke.BEHAVIOR,choices:Object.values(Le.Ct)}),this.viewSyncer=new Re.c(Kt.logger)}viewerToLog(){return`VdRegionsViewer<${this.viewerId}>`}async init(){this.subs.push((0,c.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 Ge.regionTypes:case Ge.chains:this.setData(this.regions)}switch(e.name){case Ge.skipEmptyPositions:for(let e=0;e<this.logos.length;++e)for(const t of this.chains)this.logos[e][t].setOptions({[Oe.bo.skipEmptyPositions]:this.skipEmptyPositions});this.calcSize();break;case Ge.fitWidth:case Ge.positionWidth:this.calcSize();break;case Ge.positionHeight:for(let e=0;e<this.logos.length;++e)for(const t of this.chains)this.logos[e][t].setOptions({[Oe.bo.positionHeight]:this.positionHeight});this.calcSize();break;case Ge.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()`;Kt.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){Kt.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){Kt.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))),n=Array.from(new Set(t.map((e=>e.order)))).sort(),s=[];for(let e=0;e<n.length;e++)for(const r of this.chains){const i=t.find((t=>t.order==n[e]&&t.chain==r));s.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(s);this.logos=new Array(n.length);for(let e=0;e<n.length;++e)this.logos[e]={};for(const[e,t,n]of r)this.logos[e][t]=n,this.viewSubs.push(n.onFreqsCalculated.subscribe((()=>{this.calcSize()})));this.mainLayout=o.table(this.chains,(e=>[...n.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(n.length).keys()].map((t=>{const n=this.logos[t][e];return n.root.style.height="100%",o.div([n.root],{style:{marginTop:"4px",marginBottom:"4px"}})}))]),["",...[...Array(n.length).keys()].map((e=>t.find((t=>t.order==n[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(Le.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))),Kt.logger.debug("Bio: VdRegionsViewer.buildView() end")}calcSize(){Kt.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 n=0;n<this.logos.length;n++){for(const t of this.chains)this.logos[n][t].root.style.height=`${e}px`;t+=Math.max(...this.chains.map((e=>this.logos[n][e].Length)))}if(this.fitWidth){if(this.logos.length>0&&t>0){const e=22,n=13,s=9,r=(this.root.clientWidth-e-(this.logos.length-1)*s-n)/t;for(let e=0;e<this.logos.length;e++)for(const t of this.chains){const n=this.logos[e][t];n.setOptions({[Oe.bo.positionWidth]:r-n.positionMarginValue}),n.root.style.width=r*n.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({[Oe.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(Ge.filterSource).set(this,t);for(let e=0;e<this.logos.length;e++)for(let t=0;t<this.chains.length;t++){const n=this.chains[t];this.logos[e][n].setOptions({[Oe.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,Me.zg)(this.onRendered,(()=>{}),(()=>{this.invalidate()}),e);const t=this.viewSyncer.resetErrors();if(t.length>0)throw t[0]}}function He(e){const t=o.divH([],{style:{gap:"10px"}}),n=o.divV([o.divText(e.seqCol.name),o.divText(e.activityCol.name)]);return n.style.fontWeight="bold",n.style.display="flex",n.style.justifyContent="space-between",t.append(n),e.points.forEach((n=>{const s=o.divText(e.activityCol.get(n).toFixed(2));s.style.display="flex",s.style.justifyContent="left",s.style.paddingLeft="30px",t.append(o.divV([o.divText(e.seqCol.get(n)),s]))})),t}function We(e){const t=o.div();t.append(o.divText(e.seqCol.name,{style:{fontWeight:"bold"}}));const n=new Array(2);e.points.forEach(((t,s)=>{n[s]=e.activityCol.get(t)}));const s={},r=oe.g.forColumn(e.seqCol),i=function(e,t,n,s){const r=document.createElement("canvas"),i=r.getContext("2d");return r.height=30,Pe(i,0,0,0,30,me()(e.canonicals).toArray(),me()(t.canonicals).toArray(),n,!0,s),r}(r.getSplitted(e.points[0]),r.getSplitted(e.points[1]),r.units,s);return t.append(o.div(i,{style:{width:"300px",overflow:"scroll"}})),t.append(function(e){const t=o.div();if(Object.keys(e).length>0){const n=o.divV([]);n.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",n.append(o.divH([o.divText((parseInt(t)+1).toString(),{style:{width:"30px",borderBottom:"1px solid lightgray"}}),e[t]]));t.append(n)}return t}(s)),t.append(Ve("Activity delta",Math.abs(n[0]-n[1]))),t.append(Ve("Cliff",e.sali)),t}function Ve(e,t){return o.divH([o.divText(`${e}: `,{style:{fontWeight:"bold",paddingRight:"5px"}}),o.divText(t.toFixed(2))],{style:{paddingTop:"10px"}})}function Ue(e,t){const n=a.Column.string("seq_diff",e.rowCount).init((n=>`${e.get(t[0],n)}#${e.get(t[1],n)}`));n.semType="MacromoleculeDifference",n.setTag(a.TAGS.UNITS,e.col(t[0]).getTag(a.TAGS.UNITS)),n.setTag("separator",e.col(t[0]).getTag("separator")),e.columns.add(n);const s=e.plot.grid();return s.col(t[0]).visible=!1,s.col(t[1]).visible=!1,s}Be.viewerCounter=-1,n(708),n(6361),n(7983);class Ye 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))}}n(7241);var je=n(1821);oe.lh[je.r2.FASTA],n(4004),n(9943),n(5393);var Ke,qe=n(6584);!function(e){e.TYPE="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[e.MAX_ATOM_COUNT=999]="MAX_ATOM_COUNT",e.RGP_LINE_START="M RGP",e.ATOM_ALIAS_LINE_START="A ",e.END="M END"}(Ke||(Ke={}));class Ze{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 n=e;const s=this.isWhitespace(n)?t:t-1;for(let e=0;e<s;e++)n=this.getNextColumnIdx(n);return n}parseAtomTypes(){const e=this.atomCount,t=new Array(e);let n=this.getAtomBlockIdx();for(let s=0;s<e;s++)n=this.shiftIdxToAtomType(n),t[s]=this.parseAtomType(n),n=this.getNextLineIdx(n);return t}parseAtomCoordinates(){const e=new Float32Array(this.atomCount),t=new Float32Array(this.atomCount),n=new Float32Array(this.atomCount);let s=this.getAtomBlockIdx();for(let r=0;r<this.atomCount;r++){s=this.shiftIdxToXColumn(s);for(const i of[e,t,n])i[r]=this.parseFloatValue(s),s=this.getNextColumnIdx(s);s=this.getNextLineIdx(s)}return{x:e,y:t,z:n}}parseBondedAtomPairs(){const e=new Array(this.bondCount);let t=this.getBondBlockIdx();for(let n=0;n<this.bondCount;n++){t=this.shiftIdxToBondedAtomsPair(t);const s=new Uint16Array(2);s[0]=this.parseIntValue(t),t=this.getNextColumnIdx(t),s[1]=this.parseIntValue(t),e[n]=s,t=this.getNextLineIdx(t)}return e}parseBondTypes(){const e=this.bondCount,t=new Uint16Array(e);let n=this.getBondBlockIdx();for(let s=0;s<e;s++)n=this.shiftIdxToBondType(n),t[s]=this.parseIntValue(n),n=this.getNextLineIdx(n);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 n=t+1;for(;!this.isWhitespace(n);)++n;return e(this.fileContent.substring(t,n))}}class ze extends Ze{constructor(e){super(e),this.init(e)}init(e){super.init(e)}parseAtomType(e){let t=e,n=t;return this.isQuote(t)?(n=this.getNextIdenticalChar(t),t++):n=this.fileContent.indexOf(" ",n),this.fileContent.substring(t,n)}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&&!((n=this.fileContent.charCodeAt(t+1))>64&&n<91||n>96&&n<123);var n}))}isFragment(){return this.isQueryOrFragment((e=>82===e||42===e))}isQueryOrFragment(e){const t=this.atomCount;let n=this.getAtomBlockIdx();for(let s=0;s<t;s++){if(n=this.shiftIdxToAtomType(n),e(this.fileContent.charCodeAt(n),n))return!0;n=this.getNextLineIdx(n)}return!1}}class Xe extends ze{constructor(e){super(e)}getAtomLines(){const e=this.getAtomBlockIdx(),t=this.getBondBlockIdx();return this.fileContent.substring(e,t).split("\n").slice(0,this.atomCount)}getBondLines(){const e=this.getBondBlockIdx();return this.fileContent.substring(e).split("\n").slice(0,this.bondCount)}getRGroupIdToAtomicIdxMap(){const e=new Map,t=this.fileContent.split("\n");t.filter((e=>e.startsWith(Ke.RGP_LINE_START))).forEach((t=>{const n=this.getAtomIdxToRgpIdxList(t);for(const[t,s]of n){if(e.has(t))throw new Error(`R group ${t} is already in the map`);e.set(t,s)}}));const n=t.map(((e,t)=>{if(e.startsWith(Ke.ATOM_ALIAS_LINE_START))return t})).filter((e=>void 0!==e)),s=n.map((e=>t[e])),r=n.map((e=>t[e+1]));s.forEach(((t,n)=>{const s=parseInt(t.split(/\s+/)[1])-1,i=parseInt(r[n].substring(1));if(e.has(i))throw new Error(`R group ${i} is already in the map`);e.set(i,s)}));const i=this.getRGroupAtomicIndices().filter((t=>!Array.from(e.values()).includes(t)));if(0!==i.length)throw new Error(`Unaccounted R group indices: ${i}`);return e}getAtomIdxToRgpIdxList(e){const t=e.split(/\s+/).filter((e=>e)).slice(3).map((e=>parseInt(e))),n=new Array(t.length/2);for(let e=0;e<t.length;e+=2)n[e/2]=[t[e+1],t[e]-1];return n}getRGroupAtomicIndices(){return this.atomTypes.map(((e,t)=>{if(e.includes("R#"))return t})).filter((e=>void 0!==e))}static isValidMolfile(e){return-1!==e.indexOf(Ke.TYPE)&&-1!==e.indexOf(Ke.END)}shiftIdxToAtomType(e){return this.shiftIdxToSpecifiedColumn(e,Ke.ATOM_TYPE_COL)}getCountsLineIdx(){let e=0;for(let t=0;t<Ke.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,Ke.FIRST_BONDED_ATOM_COL)}shiftIdxToBondType(e){return this.shiftIdxToSpecifiedColumn(e,Ke.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+Ke.NUM_OF_COUNTS_DIGITS;const n=parseInt(this.fileContent.substring(e,t));return e=t,t+=Ke.NUM_OF_COUNTS_DIGITS,{atomCount:n,bondCount:parseInt(this.fileContent.substring(e,t))}}}class Je extends ze{constructor(e){super(e),this.init(e)}getAtomLines(){const e=this.getAtomBlockIdx(),t=this.getBondBlockIdx();return this.fileContent.substring(e,t).split("\n").slice(0,this.atomCount)}getBondLines(){const e=this.getBondBlockIdx();return this.fileContent.substring(e).split("\n").slice(0,this.bondCount)}getRGroupIdToAtomicIdxMap(){const e=new Map;return this.getAtomLines().forEach(((t,n)=>{const s=t.match(/RGROUPS=\(([\d\s]+)\)/);if(s){const t=s[1].split(/\s+/).map((e=>parseInt(e)));if(t.length>2)throw new Error(`R group data ${t} has more than 2 elements`);const r=t[1];if(e.has(r))throw new Error(`R group ${r} is already in the map`);e.set(r,n)}})),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 isValidMolfile(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 n=parseInt(this.fileContent.substring(e,t));return e=t+1,t=this.fileContent.indexOf(" ",e+1),{atomCount:n,bondCount:parseInt(this.fileContent.substring(e,t))}}}class Qe{constructor(){}static getInstance(e){if(Qe.isMolfileV2K(e))return new Xe(e);if(Qe.isMolfileV3K(e))return new Je(e);throw new Error("Malformed molfile")}static isMolfileV2K(e){return Xe.isValidMolfile(e)}static isMolfileV3K(e){return Je.isValidMolfile(e)}}var et=n(8277),tt={};tt.styleTagTransform=C(),tt.setAttributes=y(),tt.insert=f().bind(null,"head"),tt.domAPI=m(),tt.insertStyleElement=b(),h()(et.Z,tt),et.Z&&et.Z.locals&&et.Z.locals;class nt{constructor(e,t=undefined,n=undefined){this.source=t,this.error=n,this._monomers={},this._onChanged=new c.Subject,this._monomers=e;for(const[e,t]of Object.entries(this._monomers))for(const[e,n]of Object.entries(t))n.lib=this}addMissingMonomer(e,t){let n=this._monomers[e];n||(n=this._monomers[e]={});let s=t;return t===oe.lh[ie.r2.HELM]?s="Gap":("PEPTIDE"===e&&"X"===t||"RNA"===e&&"N"===t)&&(s="Any"),n[t]={symbol:t,name:s,molfile:"",author:"MISSING",id:-1,rgroups:me().count(1).take(9).map((e=>({capGroupSmiles:"",alternateId:"",capGroupName:"",label:`R${e.toString()}`}))).toArray(),smiles:"",polymerType:e,monomerType:void 0,createDate:null}}getMonomer(e,t){let n=t;return"RNA"==e&&"R"==n&&(n="r"),"RNA"==e&&"P"==n&&(n="p"),e in this._monomers&&n in this._monomers[e]?this._monomers[e][n]:null}getPolymerTypes(){return Object.keys(this._monomers)}getMonomerMolsByPolymerType(e){const t={};return Object.keys(this._monomers[e]??{}).forEach((n=>{t[n]=this._monomers[e][n].molfile})),t}getMonomerSymbolsByType(e){return Object.keys(this._monomers[e])}getMonomerSymbolsByRGroup(e,t,n){let s=this.getMonomerSymbolsByType(t).map((e=>this.getMonomer(t,e)));return s=s.filter((e=>null!==e)),0===s.length?[]:(s=s.filter((t=>{if(!t?.rgroups)return!1;let n=t?.rgroups.length>=e;return Qe.getInstance(t.molfile).atomTypes.map(((e,t)=>"R#"===e?t:-1)).filter((e=>-1!==e)),n&&(n=!0),n})),s.map((e=>e?.symbol)))}get onChanged(){return this._onChanged}_updateInt(e){const t=e.getPolymerTypes(),n=this.getPolymerTypes();t.forEach((t=>{n.includes(t)||(this._monomers[t]={}),e.getMonomerSymbolsByType(t).forEach((n=>{this._monomers[t][n]=e.getMonomer(t,n)}))}))}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()}getSummaryObj(){const e={},t=this.getPolymerTypes();for(const n of t)e[n]=this.getMonomerSymbolsByType(n).length;return e}getSummaryDf(){const e=this.getPolymerTypes(),t=new Array(e.length);for(const[n,s]of me().enumerate(e))t[s]=this.getMonomerSymbolsByType(n).length;return a.DataFrame.fromColumns([a.Column.fromStrings("polymerType",e),a.Column.fromList(a.COLUMN_TYPE.INT,"count",t)])}getSummary(){const e=this.getPolymerTypes();return 0==e.length?"empty":e.map((e=>`${e} ${this.getMonomerSymbolsByType(e).length}`)).join("\n")}getTooltip(e,t){const n=o.div([],{classes:"ui-form ui-tooltip"}),s=this.getMonomer(e,t);if(s){const e=s.symbol;s.name,n.append(o.divH([o.div([e],{style:{fontWeight:"bolder",textWrap:"nowrap",marginRight:"6px"}}),o.div([s.name])],{style:{display:"flex",flexDirection:"row",justifyContent:"left"}}));const t={autoCrop:!0,autoCropMargin:0,suppressChiralText:!0};let r;r=s.molfile?i.chem.svgMol(s.molfile,void 0,void 0,t):s.smiles?o.divV([i.chem.svgMol(s.smiles,void 0,void 0,t),o.divText("from smiles",{style:{fontSize:"smaller"}})]):o.divText("No structure",{style:{margin:"6px"}}),n.append(o.div(r,{style:{display:"flex",flexDirection:"row",justifyContent:"center",margin:"6px"}})),n.append(o.divText(s.lib?.source??"unknown"))}else n.append(o.divV([o.divText(`Monomer '${t}' of type '${e}' not found.`),o.divText("Open the Context Panel, then expand Manage Libraries")]));return n}}var st=n(5128),rt=n.n(st),it=n(3351),ot=n.n(it);class at{constructor(e){this.helmMonomerSchema=e;const t=new(rt())({allErrors:!0,strictTuples:!1});ot()(t),this.validateMonomerSchema=t.compile(this.helmMonomerSchema)}validateFile(e,t){const n=this.parseJson(e);return null!==n&&(Array.isArray(n)?this.validateJsonContent(n,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 n=!0;for(const s of e)if(n=this.validateMonomerSchema(s),!n){console.warn(`Bio: Monomer Library File Validator:\nfile ${t}\n monomer violating JSON schema:`,s,"\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 n}}class lt{constructor(e,t,n){this.fileValidator=e,this.libHelper=t,this.eventManager=n,this.filesPromise=Promise.resolve(),this.objId=++lt.objCounter,this.eventManager.updateValidLibraryFileListRequested$.subscribe((async()=>{await this.updateValidLibraryList()}))}toLog(){return`MonomerLibFileManager<${this.objId}>`}static async create(e,t){const n=await i.dapi.files.readAsText("System:AppData/Bio/tests/libraries/HELMmonomerSchema.json"),s=JSON.parse(n),r=new at(s);return new lt(r,e,t)}async addLibraryFile(e,t){try{if(await this.libraryFileExists(t))return void i.shell.error(`File ${t} already exists`);await this.validateAgainstHELM(e,t),await i.dapi.files.writeAsText(qe.BX+`${t}`,e),await this.updateValidLibraryList(),await i.dapi.files.exists(qe.BX+`${t}`)?i.shell.info(`Added ${t} HELM library`):i.shell.error(`Failed to add ${t} library`)}catch(e){console.error(e),i.shell.error(`Failed to add ${t} library`)}}async deleteLibraryFile(e){try{await i.dapi.files.delete(qe.BX+`${e}`),await this.updateValidLibraryList(),i.shell.info(`Deleted ${e} library`)}catch(t){console.error(t),await i.dapi.files.exists(qe.BX+`${e}`)?i.shell.error(`Failed to delete ${e} library`):i.shell.warning(`File ${e} already deleted, refresh the list`)}}async loadLibraryFromFile(e,t){let n=[];const s=new a.FileSource(e),r=await s.readAsText(t);n=JSON.parse(r);const i={},o=[];return n.forEach((e=>{const t=e.polymerType,n=e.symbol;o.includes(t)||(i[t]={},o.push(t)),i[t][n]=e})),new nt(i,t)}getValidLibraryPaths(){return this.eventManager.getValidFilesPathList()}async getValidLibraryPathsAsynchronously(){return await this.eventManager.getValidLibraryPathsAsynchronously()}async libraryFileExists(e){return await i.dapi.files.exists(qe.BX+`${e}`)}async updateValidLibraryList(){const e=`${this.toLog()}.updateValidLibraryList()`;return Kt.logger.debug(`${e}, start`),this.filesPromise=this.filesPromise.then((async()=>{Kt.logger.debug(`${e}, IN`);const t=[],n=await this.getFilePathsAtDefaultLocation();if(!this.fileListHasChanged(n))return void Kt.logger.debug(`${e}, end, not changed`);for(const e of n){if(!e.endsWith(".json")){t.push(e);continue}const n=await i.dapi.files.readAsText(qe.BX+`${e}`);this.isValidHELMLibrary(n,e)||t.push(e)}const s=n.filter((e=>!t.includes(e)));if(this.fileListHasChanged(s)&&(this.eventManager.changeValidFilesPathList(s),this.libHelper.loadLibraries(!0)),s.some((e=>!e.endsWith(".json")))&&Kt.logger.warning(`Wrong validation: ${s}`),t.length>0){const e=`Invalid monomer library files in ${qe.BX}, consider fixing or removing them: ${t.join(", ")}`;Kt.logger.warning(e)}Kt.logger.debug(`${e}, OUT`)}))}fileListHasChanged(e){const t=this.eventManager.getValidFilesPathList();return e.length!==t.length||e.some(((e,n)=>e!==t[n]))}async validateAgainstHELM(e,t){if(!this.isValidHELMLibrary(e,t))throw new Error(`File ${t} does not satisfy HELM standard`)}isValidHELMLibrary(e,t){return this.fileValidator.validateFile(e,t)}async getFilePathsAtDefaultLocation(){const e=(await i.dapi.files.list(qe.BX)).map((e=>e.fullPath)),t=[];for(const n of e)await i.dapi.files.exists(n)&&t.push(n);return t.map((e=>e.substring(qe.BX.length)))}}lt.objCounter=-1;class ct{constructor(){this._libraryFilesUpdateSubject$=new c.BehaviorSubject([]),this._addLibraryFilesSubject$=new c.Subject,this._librarySelectionSubject$=new c.Subject}static getInstance(){return ct._instance||(ct._instance=new ct),ct._instance}getValidFilesPathList(){return this._libraryFilesUpdateSubject$.getValue()}async getValidLibraryPathsAsynchronously(){return new Promise((e=>{this._libraryFilesUpdateSubject$.pipe((0,P.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])}}class ut{get eventManager(){return this._eventManager}async awaitLoaded(e=3e3){return await Promise.race([(async()=>{const e=await this.getFileManager();return await e.filesPromise,!0})(),(async()=>(await(0,Me.gw)(e),!1))()]).then((t=>{if(!t)throw new Error(`Loading monomer libraries is timeout ${e} ms.`)}))}constructor(){this._monomerLib=new nt({},"MAIN"),this.loadLibrariesPromise=Promise.resolve()}getBioLib(){return this._monomerLib}async getFileManager(){return void 0===this._fileManagerPromise&&(this._fileManagerPromise=(async()=>await lt.create(this,this._eventManager))()),this._fileManagerPromise}async loadLibraries(e=!1){return this.loadLibrariesPromise=this.loadLibrariesPromise.then((async()=>{try{const[t,n]=await Promise.all([(await this.getFileManager()).getValidLibraryPaths(),(0,qe.nW)()]),s=t.filter((e=>{const t=!n.exclude.includes(e),s=0===n.explicit.length||n.explicit.includes(e);return t&&s})),r=await Promise.all(s.map((e=>this.readLibrary(qe.BX,e).catch((t=>{const n=`Loading monomers from '${e}' error: ${t instanceof Error?t.message:t.toString()}`;return new nt({},e,n)})))));this._monomerLib.updateLibs(r,e)}catch(e){const t=`Loading monomer libraries error: ${e instanceof Error?e.message:e.toString()}`;i.shell.warning(t);const n=e instanceof Error?e.stack:void 0;Kt.logger.error(t,void 0,n)}}))}async readLibrary(e,t){const n=await this.getFileManager();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 n=await(0,qe.nW)();n.exclude=(await this.getFileManager()).getValidLibraryPaths().filter((t=>!e.includes(t))),await(0,qe.tW)(n)}async getInvalidFileNames(e){const t=(await this.getFileManager()).getValidLibraryPaths();return e.filter((e=>!t.includes(e)))}static async getInstance(){let e=window.$monomerLibHelperPromise;return void 0===e&&(e=window.$monomerLibHelperPromise=(async()=>{const e=new ut;return e._eventManager=ct.getInstance(),e})()),e}}n(3336);var ht=n(8710),dt={};dt.styleTagTransform=C(),dt.setAttributes=y(),dt.insert=f().bind(null,"head"),dt.domAPI=m(),dt.insertStyleElement=b(),h()(ht.Z,dt),ht.Z&&ht.Z.locals&&ht.Z.locals;var mt,pt=function(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))};class ft{constructor(e,t,n=!1,s){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=n,this._autoStartFirstStep=null!==(r=null==s?void 0:s.autoStartFirstStep)&&void 0!==r&&r,this._progress.max=0,this._progress.value=1,ft.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 n=o.iconFA("clock");this._isAutomatic||0===t&&(n=o.iconFA("play",(()=>this._nextStep()),"Next step"),n.className="grok-icon fas fa-play");const s=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([n,s],"grok-tutorial-entry");this._activity.append(i,r)}}_initRoot(){var e,t,n;i.shell.windows.showContextPanel=!0,i.shell.windows.showHelp=!1;const s=Array.from(i.shell.dockManager.rootNode.children)[0];this._node=i.shell.dockManager.dock(this._root,a.DOCK_TYPE.FILL,s,""),(null===(t=null===(e=s.parent.container.containerElement.firstElementChild)||void 0===e?void 0:e.lastElementChild)||void 0===t?void 0:t.classList.contains("tab-handle-list-container"))&&(null===(n=s.parent.container.containerElement.firstElementChild)||void 0===n||n.lastElementChild.remove()),this._node.container.containerElement.classList.add("tutorials-demo-script-container"),this._addHeader(),this._root.append(this._mainHeader),this._addDescription(),this._root.append(this._activity)}_nextStep(){var e,t;return pt(this,void 0,void 0,(function*(){this._isStepProcessed=!0,this._isAutomatic||(this._nextStepBtn.classList.add("disabled"),this._nextStepBtn.firstChild.classList.add("fa-disabled"));const n=this._activity.getElementsByClassName("grok-tutorial-entry")[this._currentStep],s=this._activity.getElementsByClassName("grok-icon")[this._currentStep],r=this._activity.getElementsByClassName("grok-tutorial-step-description")[this._currentStep];s.className="grok-icon far fa-spinner-third fa-spin",r.classList.remove("hidden"),r.classList.add("visible");const i=n,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(n,s,a),yield(0,Me.gw)(a));const l=o.iconFA("check");if(s.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 pt(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,n){return pt(this,void 0,void 0,(function*(){const s=o.div([],"demo-script-countdown");t.classList.add("hidden");let r=n/1e3;const i=this._createSVGIndicator(r);s.append(i),e.prepend(s);const a=setInterval((()=>{r--,0===r&&(clearInterval(a),s.remove(),t.classList.remove("hidden"),t.classList.add("visible"))}),1e3)}))}_createSVGIndicator(e){const t=document.createElementNS("http://www.w3.org/2000/svg","svg"),n=document.createElementNS("http://www.w3.org/2000/svg","circle");return n.setAttributeNS(null,"cx","7"),n.setAttributeNS(null,"cy","7"),n.setAttributeNS(null,"r","6"),n.setAttributeNS(null,"style",`animation: countdown ${e}s linear infinite forwards`),t.append(n),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,ft.currentObject=null}step(e,t,n){return this._steps[this.steps.length]={name:e,func:t,options:n},this}start(){return pt(this,void 0,void 0,(function*(){this._initRoot(),i.shell.newView(this.name),this._isAutomatic?this._startScript():this._autoStartFirstStep&&(yield this._nextStep())}))}}ft.currentObject=null,function(e){e.X="Embed_X",e.Y="Embed_Y"}(mt||(mt={}));var gt,yt,wt,bt=function(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))};n(7905),function(e){e.ADD="ADD",e.SUB="SUB",e.MULT="MULT"}(gt||(gt={})),function(e){e.SQUARE="SQUARE",e.INVERSE="INVERSE",e.TRANSPOSE="TRANSPOSE",e.NORM="NORM",e.COLUMN_NORM="COLUMN_NORM"}(yt||(yt={})),function(e){e.SCALARMULT="SCALARMULT",e.SCALARADD="SCALARADD",e.SCALARPOW="SCALARPOW"}(wt||(wt={})),n(8341);var At=n(2568);n(525),n(9416),new class{constructor(){this.tooltipHandlerTemp="tooltip-handler.Monomer"}};class Ct 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,n,s,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,ie.py)(i.cell.column.getTag("alphabet")),l=i.cell.value;if(!l)return;const c=a.get(l);e.fillStyle=c,e.fillText((0,ie.GU)(l,6),t+s/2,n+r/2,s)}}class vt 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,n]=(0,he.yf)(e);i.shell.error(t),this.logger.error(t,void 0,n)}}n(8770);class Tt extends a.Widget{constructor(e){super(o.divV([])),this.viewed=!1,this.wlViewer=null,this.seqCol=e}async init(){const e=oe.g.forColumn(this.seqCol),t=Kt.properties.TooltipWebLogo,n=this.seqCol.getTag(Le.DX.tooltipWebLogo);!1===t||["false","off","disable","disabled"].includes(n)||(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,positionNames:"",endPositionName:"50"}),this.wlViewer.root.style.height="50px",this.root.appendChild(this.wlViewer.root),this.root.style.width="100%")}detach(){this.wlViewer&&(this.wlViewer.detach(),this.wlViewer=null),super.detach()}}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(ie.CI);var St=n(8601);const Et=OCL;class _t{constructor(e){const t=e.split("|");t.forEach((e=>this.validateConnectionItem(e))),this.connectionItems=t}validateConnectionItem(e){const t="(PEPTIDE|RNA)",n=new RegExp(`${t}[0-9]+,${t}[0-9]+,[0-9]+:R[0-9]+-[0-9]+:R[0-9]+`,"g");if(!e.match(n))throw new Error(`Cannot parse connection item from ${e}`)}getConnectionData(){const e=[];return this.connectionItems.forEach((t=>{const n=[],s=t.split(",");s[2].split("-").forEach(((e,t)=>{const r=s[t],i=e.split(":"),o={monomerIdx:parseInt(i[0])-1,rGroupId:parseInt(i[1].slice(1))};n.push({polymerId:r,bond:o})})),e.push(n)})),e}}class xt{constructor(e){this.simplePolymer=e,this.polymerType=this.getPolymerType(),this.idx=this.getIdx();const{monomers:t,monomerTypes:n}=this.getMonomerSymbolsAndTypes();this.monomers=t,this.monomerTypes=n}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("."),n=[],s=[];return t.forEach((e=>{const t=e.split(/\(|\)/).map((e=>e.replace(/[\[\]]/g,"")));n.push(...t);const r=t.map(((e,t)=>t%2==0?"Backbone":"Branch"));s.push(...r)})),{monomers:n,monomerTypes:s}}getBondData(){const e=[],t=this.monomerTypes.map(((e,t)=>{if("Backbone"===e)return t})).filter((e=>void 0!==e)),n=this.monomerTypes.map(((e,t)=>{if("Branch"===e)return t})).filter((e=>void 0!==e));for(let n=0;n<t.length-1;n++){const s=t[n],r=t[n+1];e.push([{monomerIdx:s,rGroupId:2},{monomerIdx:r,rGroupId:1}])}for(let t=0;t<n.length;t++){const s=n[t],r=s-1;e.push([{monomerIdx:r,rGroupId:3},{monomerIdx:s,rGroupId:1}])}return e}}class Pt{constructor(e){this.helmString=e;const t=this.helmString.split("$"),n=t[0].split("|");this.simplePolymers=n.map((e=>new xt(e))),""!==t[1]&&(this.connectionList=new _t(t[1])),this.bondData=this.getBondData(),this.bondedRGroupsMap=this.getBondedRGroupsMap()}getBondedRGroupsMap(){const e=new Map;return this.bondData.forEach((t=>{t.forEach((t=>{const n=t.monomerIdx,s=t.rGroupId;e.get(n)||e.set(n,[]),e.get(n).push(s)}))})),e}toString(){return this.helmString}getPolymerTypeByMonomerIdx(e){return this.getSimplePolymerByMonomerIdx(e).polymerType}getSimplePolymerByMonomerIdx(e){const t=this.getMonomerIdxShifts(),n=Object.values(t).sort(((e,t)=>e-t)).find((t=>e>=t));if(void 0===n)throw new Error(`Cannot find simple polymer for monomer ${e}`);const s=Object.keys(t).find((e=>t[e]===n));return this.simplePolymers.find((e=>e.id===s))}shiftBondMonomerIds(e,t){t.forEach((t=>{t.forEach((t=>{t.monomerIdx+=e}))}))}getMonomerIdxShifts(){const e={};let t=0;return this.simplePolymers.forEach((n=>{e[n.id]=t,t+=n.monomers.length})),e}getBondData(){const e=this.getMonomerIdxShifts(),t=[];return this.simplePolymers.forEach((n=>{const s=n.getBondData(),r=e[n.id];this.shiftBondMonomerIds(r,s),t.push(...s)})),this.connectionList&&this.connectionList.getConnectionData().forEach((n=>{const s=[];n.forEach((t=>{const n=e[t.polymerId],r=t.bond;r.monomerIdx+=n,s.push(r)})),t.push(s)})),t}}class $t{constructor(e){this.monomerSymbol=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:n}=this.atoms.atomCoordinates[e];this.atoms.shift({x:-t,y:-n})}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],n=t.y/t.x,s=Math.atan(n);if(isNaN(s))throw new Error(`Cannot calculate angle for R2 group for monomer ${this.monomerSymbol}`);this.rotateCoordinates(-s)}shiftMonomerToDefaultPosition(){this.shiftR1GroupToOrigin(),null!==this.rGroups.getAtomicIdx(2)&&this.alignR2AlongX()}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)}shiftBonds(e){this.bonds.shift(e)}capRGroups(e){this.rGroups.capRGroups(e)}}class Nt{constructor(e,t,n){this.atoms=t,this.bonds=n,this.rGroupBondPositionMap=new Map,this.rGroupIdToAtomicIndexMap=e.getRGroupIdToAtomicIdxMap()}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,n])=>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 n=this.bonds.getPositionsInBonds(t+1);if(0===n.length)throw new Error(`Cannot find position for R group ${e}`);if(n.length>1)throw new Error(`More than one position for R group ${e}`);const s=n[0];return this.bonds.replacePositionsInBondsByDummy([s]),this.bonds.removeAtomIdFromBonds(t+1),this.removeRGroupFromAtomicIdxMap(e,t),s}removeRGroupFromAtomicIdxMap(e,t){this.rGroupIdToAtomicIndexMap.delete(e);for(const[e,n]of this.rGroupIdToAtomicIndexMap)n>t&&this.rGroupIdToAtomicIndexMap.set(e,n-1)}deleteBondLineWithSpecifiedRGroup(e){const t=this.rGroupBondPositionMap.get(e);if(!t)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:n}=t;this.bonds.deleteBondLines([n]),this.rGroupBondPositionMap.delete(e),this.rGroupIdToAtomicIndexMap.delete(e),this.rGroupBondPositionMap.forEach((e=>{e.bondLineIdx>n&&(e.bondLineIdx-=1)}))}replaceRGroupWithAttachmentAtom(e,t){const n=this.rGroupBondPositionMap.get(e);if(!n)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:s,nodeIdx:r}=n;this.bonds.bondedAtoms[s][r]=t}getAttachmentAtomIdByRGroupId(e){const t=this.rGroupBondPositionMap.get(e);if(!t)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:n,nodeIdx:s}=t;return this.bonds.bondedAtoms[n][(s+1)%2]}capRGroups(e){this.rGroupIdToAtomicIndexMap.forEach(((t,n)=>{const s=e[n-1];"H"===s?(this.removeRGroups([n]),this.deleteBondLineWithSpecifiedRGroup(n)):this.atoms.replaceRGroupSymbolByElement(t,s)}))}}class Mt{constructor(){this.coordinates=[],this.rawAtomLines=[]}get atomCoordinates(){return this.coordinates}replaceRGroupSymbolByElement(e,t){this.rawAtomLines[e]=this.rawAtomLines[e].replace("R#",t)}deleteAtoms(e){this.coordinates=this.coordinates.filter(((t,n)=>!e.includes(n))),this.rawAtomLines=this.rawAtomLines.filter(((t,n)=>!e.includes(n)))}shift(e){this.coordinates=this.coordinates.map((t=>{const n=t.x+e.x,s=t.y+e.y;if(isNaN(n)||isNaN(s))throw new Error(`Cannot shift coordinates by ${e.x}, ${e.y}`);return{x:n,y:s}}))}rotate(e){this.coordinates=this.coordinates.map((t=>{const n=t.x,s=t.y,r=n*Math.cos(e)-s*Math.sin(e),i=n*Math.sin(e)+s*Math.cos(e);if(isNaN(r)||isNaN(i))throw new Error(`Cannot rotate coordinates by ${e}`);return{x:r,y:i}}))}}class Lt extends Mt{constructor(e){super(),this.rawAtomLines=e.getAtomLines(),this.coordinates=this.rawAtomLines.map((e=>({x:parseFloat(e.substring(0,10)),y:parseFloat(e.substring(10,20))})))}get atomLines(){return this.rawAtomLines.map(((e,t)=>{const n=this.coordinates[t];return`${n.x.toFixed(4).padStart(10," ")}${n.y.toFixed(4).padStart(10," ")}${e.substring(20)}`}))}}class It{constructor(){this.bondedAtomPairs=[],this.rawBondLines=[]}get bondedAtoms(){return this.bondedAtomPairs}deleteBondLines(e){this.rawBondLines=this.rawBondLines.filter(((t,n)=>!e.includes(n))),this.bondedAtomPairs=this.bondedAtomPairs.filter(((t,n)=>!e.includes(n)))}getPositionsInBonds(e){const t=[];return this.bondedAtomPairs.forEach(((n,s)=>{n.forEach(((n,r)=>{n===e&&t.push({bondLineIdx:s,nodeIdx:r})}))})),t}replacePositionsInBondsByDummy(e,t){void 0===t&&(t=-1),e.forEach((e=>{const{bondLineIdx:n,nodeIdx:s}=e;this.bondedAtomPairs[n][s]=t}))}removeAtomIdFromBonds(e){this.bondedAtomPairs=this.bondedAtomPairs.map((t=>t.map((t=>t>e?t-1:t))))}shift(e){this.bondedAtomPairs=this.bondedAtomPairs.map((t=>t.map((t=>t+e))))}}class Rt extends It{constructor(e){super(),this.rawBondLines=e.getBondLines(),this.bondedAtomPairs=this.rawBondLines.map((e=>[parseInt(e.substring(0,3)),parseInt(e.substring(3,6))]))}getBondLines(){return this.bondedAtomPairs.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)}`}))}}class Ot extends $t{constructor(e,t){super(t);const n=Qe.getInstance(e);this.atoms=new Lt(n),this.bonds=new Rt(n),this.rGroups=new Nt(n,this.atoms,this.bonds),this.shiftMonomerToDefaultPosition()}}class Ft extends Mt{constructor(e){super(),this.molfileHandler=e,this.rawAtomLines=e.getAtomLines(),this.coordinates=this.getCoordinates()}getCoordinates(){const e=this.molfileHandler.x,t=this.molfileHandler.y;return Array.from(e).map(((e,n)=>({x:e,y:t[n]})))}get atomLines(){const e=/^(M V30 [^-]*)(-?\d+\.\d+)( )(-?\d+\.\d+)( -?\d+\.\d+.*)$/,t=/\sRGROUPS=\(\d+(\s+\d+)*\)/;return this.rawAtomLines.map(((n,s)=>{const r=this.coordinates[s],i=r.x.toFixed(4)+"00",o=r.y.toFixed(4)+"00";return n.replace(e,((e,t,n,s,r,a)=>t+i+s+o+a)).replace(t,"")}))}}class kt extends It{constructor(e){super(),this.molfileHandler=e,this.rawBondLines=e.getBondLines(),this.bondedAtomPairs=this.getBondedAtomPairs()}getBondedAtomPairs(){return this.molfileHandler.pairsOfBondedAtoms.map((e=>[e[0],e[1]]))}getBondLines(){const e=/^(M\s+V30\s+\d+\s+\d+\s+)(\d+)(\s+)(\d+)(.*)$/;return this.bondedAtomPairs.map(((t,n)=>{if(t.some((e=>-1===e)))throw new Error(`Bonded pair ${t} contains -1`);return this.rawBondLines[n].replace(e,((e,n,s,r,i,o)=>`${n}${t[0]}${r}${t[1]}${o}`))}))}}class Gt extends $t{constructor(e,t){super(t);const n=Qe.getInstance(e);this.atoms=new Ft(n),this.bonds=new kt(n),this.rGroups=new Nt(n,this.atoms,this.bonds),this.shiftMonomerToDefaultPosition()}}class Dt{static getInstance(e,t){if(Qe.isMolfileV2K(e))return new Ot(e,t);if(Qe.isMolfileV3K(e))return new Gt(e,t);throw new Error("Unsupported molfile version")}}class Bt{constructor(e,t,n,s,r,i){this.monomerSymbol=e,this.monomerIdx=t,this.helm=n,this.monomerLib=i,this.capGroupElements=[];const o=this.getLibraryMonomerObject();let a=o.molfile;Qe.isMolfileV2K(a)&&(a=this.convertMolfileToV3KFormat(a,e,r)),this.molfileWrapper=Dt.getInstance(a,e),this.capGroupElements=this.getCapGroupElements(o),n.bondedRGroupsMap.has(t)&&this.removeRGroups(n.bondedRGroupsMap.get(t)),this.capRemainingRGroups(),this.shiftCoordinates(s)}convertMolfileToV3KFormat(e,t,n){let s=null;try{if(s=n.get_mol(e,JSON.stringify({mergeQueryHs:!0})),s)return s.get_v3Kmolblock();throw new Error(`Cannot convert ${t} to molV3000`)}finally{s?.delete()}}getLibraryMonomerObject(){const e=this.helm.getPolymerTypeByMonomerIdx(this.monomerIdx),t=this.monomerLib.getMonomer(e,this.monomerSymbol);if(!t)throw new Error(`Monomer ${this.monomerSymbol} is not found in the library`);return t}getCapGroupElements(e){return e.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()}removeRGroups(e){this.molfileWrapper.removeRGroups(e)}capRemainingRGroups(){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 Ht{constructor(e,t,n){this.rdKitModule=t,this.monomerLib=n,this.monomerWrappers=[],this.helm=new Pt(e)}addMonomer(e,t,n){const s=new Bt(e,t,this.helm,n,this.rdKitModule,this.monomerLib);this.monomerWrappers.push(s)}getAtomNumberShifts(){const e=[];let t=0;return this.monomerWrappers.forEach((n=>{e.push(t),t+=n.getAtomLines().length})),e}restoreBondsBetweenMonomers(){this.helm.bondData.forEach((e=>{const t=e.map((e=>e.monomerIdx)),n=e.map((e=>e.rGroupId)),s=t.map((e=>this.monomerWrappers[e])),r=s[1].getAttachmentAtomByRGroupId(n[1]);s[0].replaceRGroupWithAttachmentAtom(n[0],r),s[1].deleteBondLineWithSpecifiedRGroup(n[1])}))}compileToMolfile(){const e=[],t=[],n=this.getAtomNumberShifts();this.monomerWrappers.forEach(((e,t)=>{e.shiftBonds(n[t])})),this.restoreBondsBetweenMonomers(),this.monomerWrappers.forEach((n=>{e.push(...n.getAtomLines()),t.push(...n.getBondLines())}));const s=e.length,r=t.length;return[this.getV3KHeader(s,r),this.getV3KAtomBlock(e),this.getV3KBondBlock(t),"M V30 END CTAB\nM END"].join("\n")}getV3KHeader(e,t){return`\n Datagrok\n\n 0 0 0 0 0 0 0 0 0 0999 V3000\nM V30 BEGIN CTAB\nM V30 COUNTS ${e} ${t} 0 0 1`}getV3KAtomBlock(e){const t=/^(M V30 )(\d+)( .*)$/;return["M V30 BEGIN ATOM",...e.map(((e,n)=>{const s=n+1;return e.replace(t,((e,t,n,r)=>t+s+r))})),"M V30 END ATOM"].join("\n")}getV3KBondBlock(e){const t=/^(M V30 )(\d+)( .*)$/;return["M V30 BEGIN BOND",...e.map(((e,n)=>{const s=n+1;return e.replace(t,((e,t,n,r)=>t+s+r))})),"M V30 END BOND"].join("\n")}}class Wt{constructor(e){this.molfileHandler=Qe.getInstance(e)}get monomerSymbols(){return this.molfileHandler.atomTypes}getMonomerShifts(e){return{x:this.molfileHandler.x[e],y:this.molfileHandler.y[e]}}}class Vt{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.convertToMolfileV3KColumn()).toList().map((e=>a.chem.convert(e,a.chem.Notation.MolBlock,a.chem.Notation.Smiles)))}async getMolV3000ViaOCL(e,t){const n=e.map((e=>{if(null===e)return"";const t=e.get_v3Kmolblock();return e.delete(),t})),s=new Array(n.length),r=a.TaskBarProgressIndicator.create("Handling chirality...");for(let e=0;e<n.length;e++){const t=Et.Molecule.fromMolfile(n[e]).toMolfileV3();s[e]=t.replace("STERAC1","STEABS");const i=e/n.length*100;r.update(i,`${i?.toFixed(2)}% of molecules completed`)}return r.close(),a.Column.fromStrings(t,s)}async convertToRdKitBeautifiedMolfileColumn(e){const t=(await this.convertToMolfileV3KColumn()).toList(),n=await i.functions.call("Chem:getRdKitModule"),s=t.map((e=>{if(""===e)return null;const t=n.get_mol(e);return t?(t.set_new_coords(),t.normalize_depiction(1),t.straighten_depiction(!0),t):null})),r=this.df.columns.getUnusedName(`molfile(${this.helmColumn.name})`);return e?await this.getMolV3000ViaOCL(s,r):a.Column.fromStrings(r,s.map((e=>{if(null===e)return"";const t=e.get_v3Kmolblock();return e.delete(),t})))}async convertToMolfileV3KColumn(){const e=await this.getPolymerGraphColumn(),t=await i.functions.call("Chem:getRdKitModule"),n=(await qt()).getBioLib(),s=e.toList().map(((e,s)=>{const r=this.helmColumn.get(s);if(!r)return"";let i="";try{i=this.getPolymerMolfile(r,e,t,n)}catch(e){const[t,n]=(0,he.yf)(e);Kt.logger.error(t,void 0,n)}finally{return i}})),r=this.df.columns.getUnusedName(`molfileV2K(${this.helmColumn.name})`);return a.Column.fromList("string",r,s)}async getPolymerGraphColumn(){return await i.functions.call("HELM:getMolfiles",{col:this.helmColumn})}getPolymerMolfile(e,t,n,s){const r=new Wt(t),i=new Ht(e,n,s);return r.monomerSymbols.forEach(((e,t)=>{const n=r.getMonomerShifts(t);i.addMonomer(e,t,n)})),i.compileToMolfile()}}var Ut=n(3277);function Yt(e){const t=["Embed_X","Embed_Y"],n=e.columns.names().filter((e=>e.includes(t[0]))).length+1;return t.map((e=>`${e}_${n}`))}function jt(e,t){return`${t} (${e.length>4?`${e.length} columns`:e.map((e=>e.name)).join(", ")})`}n(706);const Kt=new vt;async function qt(){return await ut.getInstance()}let Zt=null;function zt(){return Zt}async function Xt(e,t,n,s,r,c,u,h){if(!(0,At.n)(t,"Activity Cliffs"))return;const d=Yt(e),m={units:t.getTag(a.TAGS.UNITS),aligned:t.getTag("aligned"),separator:t.getTag("separator"),alphabet:t.getTag("alphabet")},p=c,f=t,g=async()=>await se(e,f,d,"Activity cliffs",n,s,p,r,{...h??{}},a.SEMTYPE.MACROMOLECULE,m,u,He,We,Ue),y=r===l.A.UMAP?2e5:2e4,w=r===l.A.UMAP?5e3:2e3;if(e.rowCount>y)return void i.shell.warning(`Too many rows, maximum for sequence activity cliffs is ${y}`);const b=a.TaskBarProgressIndicator.create("Running sequence activity cliffs ...");return new Promise(((t,n)=>{e.rowCount>w&&!h?.[Ut.sS]?o.dialog().add(o.divText("Activity cliffs analysis might take several minutes.\n Do you want to continue?")).onOK((async()=>{g().then((e=>t(e))).catch((e=>n(e)))})).onCancel((()=>{t(void 0)})).show():g().then((e=>t(e))).catch((e=>n(e)))})).catch((e=>{const[t,n]=(0,he.yf)(e);throw Kt.logger.error(t,void 0,n),e})).finally((()=>{b.close()}))}async function Jt(e,t,s,r,l,c,u,h){if((0,At.n)(t,"Sequence Space"))return c||(c=a.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0]),u??(u={}),await async function(e,t,s,r,l,c,u,h=!0,d=!1,m={preprocessingFuncArgs:[]},p={},f=null,g={}){const y={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 w=h?i.shell.tableView(e.name)??i.shell.addTableView(e):null,b=async()=>{const b=a.TaskBarProgressIndicator.create(`Initializing ${p.scatterPlotName??"dimensionality reduction"} ...`);let A;try{const C=Yt(e);function v(n,r,i){let l=null,c=null;e.columns.names().includes(C[0])?(l=e.columns.byName(C[0]),c=e.columns.byName(C[1])):(l=e.columns.add(a.Column.float(C[0],e.rowCount)),c=e.columns.add(a.Column.float(C[1],e.rowCount)),h&&!A&&(A=w.scatterPlot({...y,x:C[0],y:C[1],title:p.scatterPlotName??jt(t,s)}))),p[Ut.Ec]&&(A?.root&&o.setUpdateIndicator(A.root,!1),l.init((e=>i[0]?i[0][e]:void 0)),c.init((e=>i[1]?i[1][e]:void 0)));const u=n/r*100;b.update(u,`Running ${p.scatterPlotName??"dimensionality reduction"}... ${u.toFixed(0)}%`)}async function T(){e.columns.add(a.Column.float(C[0],e.rowCount)),e.columns.add(a.Column.float(C[1],e.rowCount));let n=null;h&&(A=w.scatterPlot({...y,x:C[0],y:C[1],title:p.scatterPlotName??jt(t,s)}),o.setUpdateIndicator(A.root,!0));const d=i.events.onViewerClosed.subscribe((e=>{const t=e.args.viewer;t?.getOptions()?.look?.title&&A?.getOptions()?.look?.title&&t?.getOptions()?.look?.title===A?.getOptions()?.look?.title&&(i.events.fireCustomEvent(O,{}),d.unsubscribe(),n?.(),b.close())})),f=new Promise((async(e,i)=>{try{n=e;const i=[];for(let e=0;e<c.length;++e){const n=c[e];if(m.distanceFnArgs||(m.distanceFnArgs=[]),n){const s=n.inputs[0].name,o=n.inputs[1].name,{entries:a,options:l}=await n.apply({[s]:t[e],[o]:r[e],...m.preprocessingFuncArgs[e]??{}});i.push({entries:a,options:l}),m.distanceFnArgs.push(l)}else{const n=t[e].toList(),s={};i.push({entries:n,options:s}),m.distanceFnArgs.push(s)}}e(await D(i.map((e=>e.entries)),s,r,l,u,m,p[Ut.sS]?void 0:v))}catch(e){i(e)}})),g=await f;return b.close(),d.unsubscribe(),g}const S=await T();if(d&&S){const E=a.TaskBarProgressIndicator.create("Clustering embeddings ...");try{const _=await function(e,t,s,r){return bt(this,void 0,void 0,(function*(){return new Promise((function(i,o){const a=new Worker(new URL(n.p+n.u(796),n.b));a.postMessage({embedX:e,embedY:t,minPts:r,epsilon:s}),a.onmessage=({data:{error:e,clusters:t}})=>{a.terminate(),e?o(e):i(t)}}))}))}(S[0],S[1],m.dbScanEpsilon??.01,m.dbScanMinPts??4),x=e.columns.getUnusedName("Cluster (DBSCAN)");e.columns.addNewString(x).init((e=>_[e].toString())),A&&(A.props.colorColumnName=x)}catch(P){i.shell.error("Clustering embeddings failed"),console.error(P)}finally{E.close()}}if(S){const $=e.columns.byName(C[0]),N=e.columns.byName(C[1]);if($.init((e=>S[0][e])),N.init((e=>S[1][e])),f)try{const M=f.inputs[0].name,L=f.inputs[1].name;await f.prepare({[M]:$,[L]:N,...g}).call(!0)}catch(I){i.shell.error("Post-processing failed"),console.error(I)}if(A)return o.setUpdateIndicator(A.root,!1),A.helpUrl="/help/compute/sequence-space",A}}catch(R){i.shell.error("Dimensionality reduction failed"),console.error(R),b.close(),A&&o.setUpdateIndicator(A.root,!1)}};return new Promise((async(t,n)=>{try{if(p.fastRowCount&&e.rowCount>p.fastRowCount&&!p[Ut.sS])o.dialog().add(o.divText("Analysis might take several minutes. Do you want to continue?")).onOK((async()=>{try{const e=await b();t(e)}catch(e){n(e)}})).onCancel((()=>t(void 0))).show();else{const e=await b();t(e)}}catch(e){n(e)}}))}(e,[t],s,[r],[1],[c],"MANHATTAN",l,h??!1,{...u,preprocessingFuncArgs:[u.preprocessingFuncArgs??{}]},{fastRowCount:1e4,scatterPlotName:"Sequence space",bypassLargeDataWarning:u?.[Ut.sS]})}async function Qt(e,t,n){const s=a.TaskBarProgressIndicator.create("Converting to atomic level ...");try{const s=(await qt()).getBioLib();await async function(e,t,n,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(n){const n=oe.g.forColumn(t);return n.isHelm()||(t=n.convert(ie.r2.HELM)),async function(e,t){const n=await async function(e,t,n){const s=new Vt(t,e),r=await s.convertToRdKitBeautifiedMolfileColumn(void 0);return r.semType=a.SEMTYPE.MOLECULE,r}(e,t);e.columns.add(n,!0),await i.data.detectSemanticTypes(e)}(e,t)}if(!(0,At.n)(t,"To Atomic Level"))return;const r=await(0,St.i0)(e,t,s);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,n,s)}finally{s.close()}}function en(e){return new ae.i(e).importFasta()}function tn(e){const t=oe.g.forColumn(e).stats;return Object.keys(t.freq)}async function nn(e,t,n){return ue(e,t,n,re.IDENTITY)}async function sn(e,t,n){return ue(e,t,n,re.SIMILARITY)}},7983:(e,t,n)=>{"use strict";n.d(t,{QF:()=>c,pf:()=>l});var s=n(4469),r=(n(3870),n(976)),i=n(7241),o=(n(4293),n(2997)),a=n(8447);function l(e,t,n){const s=n?function(e,t){const n=`${t}`.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),s=e.charAt(0)===t,r=e.charAt(e.length-1)===t,i=e.replace(new RegExp(`^${n}|${n}$`,"g"),"");return s?r?`${n}${i}${n}`:`${n}${i}${n}|${n}${i}$`:r?`^${i}${n}|${n}${i}${n}`:`^${i}${n}|${n}${i}${n}|${n}${i}$`}(e,n):e,i=r.BitSet.create(t.length);for(let n=0;n<t.length;n++){const r=t.get(n);(r.match(s)||r===e)&&i.set(n,!0,!1)}return i}async function c(e,t){t.version!==t.temp["last-invalidated-version"]&&await async function(e,t){const n=r.TaskBarProgressIndicator.create(`Invalidating molfiles for ${e.name}`);try{await(0,o.gw)(10);const t=new Map,n=await(0,i.D)(e,!0,t);e.temp["monomeric-mols"]=n,e.temp["monomers-dict"]=t,e.temp["last-invalidated-version"]=e.version}finally{n.close()}}(t);const n=r.Column.string("helm",1).init((t=>e));n.semType=r.SEMTYPE.MACROMOLECULE,n.setTag(r.TAGS.UNITS,a.r2.HELM);const l=await(0,i.D)(n,!0,t.temp["monomers-dict"]);return(await s.functions.call("Chem:searchSubstructure",{molStringsColumn:t.temp["monomeric-mols"],molString:l.get(0),molBlockFailover:""})).get(0)}},2568:(e,t,n)=>{"use strict";n.d(t,{l:()=>a,n:()=>o});var s=n(4469),r=n(976),i=n(8607);function o(e,t,n=[],r=[],i=!0){const[o,l]=a(e,t,n,r);return i&&!o&&s.shell.warning(l),o}function a(e,t,n=[],o=[]){let a=!0,l="";const c=i.g.forColumn(e);if(e.semType!==r.SEMTYPE.MACROMOLECULE)s.shell.warning(t+" analysis is allowed for Macromolecules semantic type"),a=!1;else{const e=c.notation;if(n.length>0&&!n.some((t=>e.toUpperCase()==t.toUpperCase())))l=`${t} + ' analysis is allowed for Macromolecules with notation ${0==n.length?"any notation":`notation${n.length>1?"s":""} ${n.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,n)=>{"use strict";n.d(t,{Of:()=>i,WY:()=>u,jB:()=>h,mU:()=>a,rs:()=>c});var s,r,i,o=n(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"}(s||(s={})),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 u="3.3.1",h={pepsea:{gapOpen:1.53,gapExtend:0,method:o.Jy[0]},kalign:{gapOpen:-1,gapExtend:-1,terminalGap:-1}}},4004:(e,t,n)=>{"use strict";n.d(t,{o:()=>i}),n(976),n(3870);var s=n(4469),r=(n(3336),n(8447),n(8607));async function i(e,t,n){const i=r.g.forColumn(e).convert(t,n);e.dataFrame.columns.add(i);const o=await s.functions.call("Bio:detectMacromolecule",{col:i});return o&&(i.semType=o),await s.data.detectSemanticTypes(e.dataFrame),i}},6032:(e,t,n)=>{"use strict";n.d(t,{Ns:()=>o});var s=n(4469),r=n(2997),i=n(8341);async function o(e=6e4){const t=await i.lp.getDockerContainer();await async function(e,t=6e4){let n=e,i=!1;for(let o=0;o<t/200;++o){if(null===n&&(n=await s.dapi.docker.dockerContainers.find(e.id)),a(n)){i=!0;break}switch(n.status){case"stopped":await s.dapi.docker.dockerContainers.run(n.id);break;case"pending change":case"changing":break;case"error":throw new Error("Docker container error state.")}n=null,await(0,r.gw)(200)}if(!i)throw new Error("Docker container start timeout.")}(t,e)}function a(e){return"checking"===e.status||"started"===e.status}},525:(e,t,n)=>{"use strict";n.d(t,{K:()=>N});var s=n(4469),r=n(976),i=n(3870),o=n(2997),a=n(8447),l=n(8607),c=n(6098),u=n(8341),h=n(2568),d=n(3553),m=n(6032),p=n(7422),f=n(3379),g=n.n(f),y=n(7795),w=n.n(y),b=n(569),A=n.n(b),C=n(3565),v=n.n(C),T=n(9216),S=n.n(T),E=n(4589),_=n.n(E),x=n(9564),P={};P.styleTagTransform=_(),P.setAttributes=v(),P.insert=A().bind(null,"head"),P.domAPI=w(),P.insertStyleElement=S(),g()(x.Z,P),x.Z&&x.Z.locals&&x.Z.locals;class $ extends Error{constructor(e,t){super(e,t)}}async function N(e={}){return new Promise((async(t,n)=>{var a,l,c;e.clustersCol??(e.clustersCol=null),e.pepsea??(e.pepsea={}),(a=e.pepsea).method??(a.method=d.jB.pepsea.method),(l=e.pepsea).gapOpen??(l.gapOpen=d.jB.pepsea.gapOpen),(c=e.pepsea).gapExtend??(c.gapExtend=d.jB.pepsea.gapExtend);const h=e.col?.dataFrame??s.shell.t,m=e.col??h.columns.bySemType(r.SEMTYPE.MACROMOLECULE);if(null==m){const e="Multiple sequence analysis requires a dataset with a macromolecule column.";return s.shell.warning(e),void n(new $(e))}const p=i.choiceInput("Method",e.pepsea.method,u.Jy);p.setTooltip("Alignment method");const f=i.floatInput("Terminal gap",e?.kalign?.terminalGap??null);f.setTooltip("Penalty for opening a gap at the beginning or end of the sequence");const g=i.p(`Kalign version: ${d.WY}`,"kalign-version"),y=i.floatInput("Gap open",e.pepsea.gapOpen);y.setTooltip("Gap opening penalty at group-to-group alignment");const w=i.floatInput("Gap extend",e.pepsea.gapExtend);w.setTooltip("Gap extension penalty to skip the alignment");const b=i.inputs([y,w,f]),A=i.button("Alignment parameters",(()=>{b.hidden=!b.hidden,[y,w,f].forEach((e=>{e.root.style.removeProperty("max-width"),e.captionLabel.style.removeProperty("max-width")}))}),"Adjust alignment parameters such as penalties for opening and extending gaps");A.classList.add("msa-params-button"),b.hidden=!0,A.prepend(i.icons.settings((()=>null)));const C=[p.root.style],v=[f.root.style,g.style];let T,S=m;const E=i.columnInput("Sequence",h,m,(async e=>{if(!e||e.semType!==r.SEMTYPE.MACROMOLECULE)return P.disabled=!0,await(0,o.gw)(0),void(E.value=S);S=e,P.disabled=!1,T=await L(E.value,h,C,v,p,_,y,w,f)}),{filter:e=>e.semType===r.SEMTYPE.MACROMOLECULE});E.setTooltip("Sequences column to use for alignment");const _=i.columnInput("Clusters",h,e.clustersCol);_.nullable=!0;const x=i.dialog("MSA").add(E).add(_).add(p).add(b).add(A).add(g).onOK((async()=>{await M(E,h,T,t,n)})),P=x.getButton("OK");if(E.fireChanged(),e.col)return T=await L(e.col,h,C,v,p,_,y,w,f),void await M(E,h,T,t,n);x.show()}))}async function M(e,t,n,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===n)throw new Error("Invalid column format");if(a=await n(),null==a)return o("PepSeA container has not started");t.columns.add(a),await s.data.detectSemanticTypes(t),i(a)}catch(e){const t=e instanceof Error?e.message:e.toString();s.shell.error(t),o(e)}finally{l.close()}}async function L(e,t,n,i,o,f,g,y,w){try{if(e.semType!==r.SEMTYPE.MACROMOLECULE)return;const s=t.columns.getUnusedName(`msa(${e.name})`);if((0,h.n)(e,e.name,[a.r2.FASTA,a.r2.SEPARATOR],["DNA","RNA","PT"],!1)){I(n,i,"kalign"),g.value=null,y.value=null,w.value=null;const t=l.g.forColumn(e),r=t.isFasta()?e:t.convert(a.r2.FASTA);return async()=>await(0,c.U)(r,!1,s,f.value)}if((0,h.n)(e,e.name,[a.r2.HELM],[],!1))return I(n,i,"pepsea"),g.value??(g.value=d.jB.pepsea.gapOpen),y.value??(y.value=d.jB.pepsea.gapExtend),async()=>(await(0,m.Ns)(),(0,u.f3)(e,s,o.value,g.value,y.value,f.value));if((0,h.n)(e,e.name,[a.r2.SEPARATOR],["UN"],!1)){const t=l.g.forColumn(e).convert(a.r2.HELM);return I(n,i,"pepsea"),g.value??(g.value=d.jB.pepsea.gapOpen),y.value??(y.value=d.jB.pepsea.gapExtend),async()=>(await(0,m.Ns)(),(0,u.f3)(t,s,o.value,g.value,y.value,f.value))}return g.value=null,y.value=null,w.value=null,void I(n,i,"kalign")}catch(e){const t=e instanceof Error?e.message:e.toString();s.shell.error(t),p._package.logger.error(t)}}function I(e,t,n){if("kalign"===n){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,n)=>{"use strict";n.d(t,{U:()=>R});var s=n(976),r=n(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,u=new Map([["proxy",{canHandle:e=>c(e)&&e[i],serialize(e){const{port1:t,port2:n}=new MessageChannel;return h(e,t),[n,[n]]},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 h(e,t=self){t.addEventListener("message",(function n(s){if(!s||!s.data)return;const{id:r,type:o,path:a}=Object.assign({path:[]},s.data),c=(s.data.argumentList||[]).map(A);let u;try{const t=a.slice(0,-1).reduce(((e,t)=>e[t]),e),n=a.reduce(((e,t)=>e[t]),e);switch(o){case"GET":u=n;break;case"SET":t[a.slice(-1)[0]]=A(s.data.value),u=!0;break;case"APPLY":u=n.apply(t,c);break;case"CONSTRUCT":u=function(e){return Object.assign(e,{[i]:!0})}(new n(...c));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;h(e,n),u=function(e,t){return w.set(e,t),e}(t,[t])}break;case"RELEASE":u=void 0;break;default:return}}catch(e){u={value:e,[l]:0}}Promise.resolve(u).catch((e=>({value:e,[l]:0}))).then((e=>{const[s,i]=b(e);t.postMessage(Object.assign(Object.assign({},s),{id:r}),i),"RELEASE"===o&&(t.removeEventListener("message",n),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=[],n=function(){}){let s=!1;const r=new Proxy(n,{get(n,i){if(p(s),i===a)return()=>C(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{d(e),s=!0}));if("then"===i){if(0===t.length)return{then:()=>r};const n=C(e,{type:"GET",path:t.map((e=>e.toString()))}).then(A);return n.then.bind(n)}return f(e,[...t,i])},set(n,r,i){p(s);const[o,a]=b(i);return C(e,{type:"SET",path:[...t,r].map((e=>e.toString())),value:o},a).then(A)},apply(n,r,i){p(s);const a=t[t.length-1];if(a===o)return C(e,{type:"ENDPOINT"}).then(A);if("bind"===a)return f(e,t.slice(0,-1));const[l,c]=y(i);return C(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:l},c).then(A)},construct(n,r){p(s);const[i,o]=y(r);return C(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:i},o).then(A)}});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,n]of u)if(n.canHandle(e)){const[s,r]=n.serialize(e);return[{type:"HANDLER",name:t,value:s},r]}return[{type:"RAW",value:e},w.get(e)||[]]}function A(e){switch(e.type){case"HANDLER":return u.get(e.name).deserialize(e.value);case"RAW":return e.value}}function C(e,t,n){return new Promise((s=>{const r=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){!n.data||!n.data.id||n.data.id!==r||(e.removeEventListener("message",t),s(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:r},t),n)}))}const v="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0ICQ9U3ltYm9sKCJDb21saW5rLnByb3h5IiksQT1TeW1ib2woIkNvbWxpbmsuZW5kcG9pbnQiKSxSPVN5bWJvbCgiQ29tbGluay5yZWxlYXNlUHJveHkiKSx5PVN5bWJvbCgiQ29tbGluay50aHJvd24iKSxfPWU9PnR5cGVvZiBlPT0ib2JqZWN0IiYmZSE9PW51bGx8fHR5cGVvZiBlPT0iZnVuY3Rpb24iLEw9e2NhbkhhbmRsZTplPT5fKGUpJiZlWyRdLHNlcmlhbGl6ZShlKXtjb25zdHtwb3J0MTpyLHBvcnQyOml9PW5ldyBNZXNzYWdlQ2hhbm5lbDtyZXR1cm4gdyhlLHIpLFtpLFtpXV19LGRlc2VyaWFsaXplKGUpe3JldHVybiBlLnN0YXJ0KCksQyhlKX19LE89e2NhbkhhbmRsZTplPT5fKGUpJiZ5IGluIGUsc2VyaWFsaXplKHt2YWx1ZTplfSl7bGV0IHI7cmV0dXJuIGUgaW5zdGFuY2VvZiBFcnJvcj9yPXtpc0Vycm9yOiEwLHZhbHVlOnttZXNzYWdlOmUubWVzc2FnZSxuYW1lOmUubmFtZSxzdGFjazplLnN0YWNrfX06cj17aXNFcnJvcjohMSx2YWx1ZTplfSxbcixbXV19LGRlc2VyaWFsaXplKGUpe3Rocm93IGUuaXNFcnJvcj9PYmplY3QuYXNzaWduKG5ldyBFcnJvcihlLnZhbHVlLm1lc3NhZ2UpLGUudmFsdWUpOmUudmFsdWV9fSxFPW5ldyBNYXAoW1sicHJveHkiLExdLFsidGhyb3ciLE9dXSk7ZnVuY3Rpb24gdyhlLHI9c2VsZil7ci5hZGRFdmVudExpc3RlbmVyKCJtZXNzYWdlIixmdW5jdGlvbiBpKHMpe2lmKCFzfHwhcy5kYXRhKXJldHVybjtjb25zdHtpZDpvLHR5cGU6YSxwYXRoOm59PU9iamVjdC5hc3NpZ24oe3BhdGg6W119LHMuZGF0YSksdT0ocy5kYXRhLmFyZ3VtZW50TGlzdHx8W10pLm1hcChtKTtsZXQgbDt0cnl7Y29uc3QgYz1uLnNsaWNlKDAsLTEpLnJlZHVjZSgoZCxoKT0+ZFtoXSxlKSxmPW4ucmVkdWNlKChkLGgpPT5kW2hdLGUpO3N3aXRjaChhKXtjYXNlIkdFVCI6bD1mO2JyZWFrO2Nhc2UiU0VUIjpjW24uc2xpY2UoLTEpWzBdXT1tKHMuZGF0YS52YWx1ZSksbD0hMDticmVhaztjYXNlIkFQUExZIjpsPWYuYXBwbHkoYyx1KTticmVhaztjYXNlIkNPTlNUUlVDVCI6e2NvbnN0IGQ9bmV3IGYoLi4udSk7bD16KGQpfWJyZWFrO2Nhc2UiRU5EUE9JTlQiOntjb25zdHtwb3J0MTpkLHBvcnQyOmh9PW5ldyBNZXNzYWdlQ2hhbm5lbDt3KGUsaCksbD1OKGQsW2RdKX1icmVhaztjYXNlIlJFTEVBU0UiOmw9dm9pZCAwO2JyZWFrO2RlZmF1bHQ6cmV0dXJufX1jYXRjaChjKXtsPXt2YWx1ZTpjLFt5XTowfX1Qcm9taXNlLnJlc29sdmUobCkuY2F0Y2goYz0+KHt2YWx1ZTpjLFt5XTowfSkpLnRoZW4oYz0+e2NvbnN0W2YsZF09UyhjKTtyLnBvc3RNZXNzYWdlKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxmKSx7aWQ6b30pLGQpLGE9PT0iUkVMRUFTRSImJihyLnJlbW92ZUV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLGkpLEYocikpfSl9KSxyLnN0YXJ0JiZyLnN0YXJ0KCl9ZnVuY3Rpb24gVChlKXtyZXR1cm4gZS5jb25zdHJ1Y3Rvci5uYW1lPT09Ik1lc3NhZ2VQb3J0In1mdW5jdGlvbiBGKGUpe1QoZSkmJmUuY2xvc2UoKX1mdW5jdGlvbiBDKGUscil7cmV0dXJuIGIoZSxbXSxyKX1mdW5jdGlvbiBwKGUpe2lmKGUpdGhyb3cgbmV3IEVycm9yKCJQcm94eSBoYXMgYmVlbiByZWxlYXNlZCBhbmQgaXMgbm90IHVzZWFibGUiKX1mdW5jdGlvbiBiKGUscj1bXSxpPWZ1bmN0aW9uKCl7fSl7bGV0IHM9ITE7Y29uc3Qgbz1uZXcgUHJveHkoaSx7Z2V0KGEsbil7aWYocChzKSxuPT09UilyZXR1cm4oKT0+ZyhlLHt0eXBlOiJSRUxFQVNFIixwYXRoOnIubWFwKHU9PnUudG9TdHJpbmcoKSl9KS50aGVuKCgpPT57RihlKSxzPSEwfSk7aWYobj09PSJ0aGVuIil7aWYoci5sZW5ndGg9PT0wKXJldHVybnt0aGVuOigpPT5vfTtjb25zdCB1PWcoZSx7dHlwZToiR0VUIixwYXRoOnIubWFwKGw9PmwudG9TdHJpbmcoKSl9KS50aGVuKG0pO3JldHVybiB1LnRoZW4uYmluZCh1KX1yZXR1cm4gYihlLFsuLi5yLG5dKX0sc2V0KGEsbix1KXtwKHMpO2NvbnN0W2wsY109Uyh1KTtyZXR1cm4gZyhlLHt0eXBlOiJTRVQiLHBhdGg6Wy4uLnIsbl0ubWFwKGY9PmYudG9TdHJpbmcoKSksdmFsdWU6bH0sYykudGhlbihtKX0sYXBwbHkoYSxuLHUpe3Aocyk7Y29uc3QgbD1yW3IubGVuZ3RoLTFdO2lmKGw9PT1BKXJldHVybiBnKGUse3R5cGU6IkVORFBPSU5UIn0pLnRoZW4obSk7aWYobD09PSJiaW5kIilyZXR1cm4gYihlLHIuc2xpY2UoMCwtMSkpO2NvbnN0W2MsZl09TSh1KTtyZXR1cm4gZyhlLHt0eXBlOiJBUFBMWSIscGF0aDpyLm1hcChkPT5kLnRvU3RyaW5nKCkpLGFyZ3VtZW50TGlzdDpjfSxmKS50aGVuKG0pfSxjb25zdHJ1Y3QoYSxuKXtwKHMpO2NvbnN0W3UsbF09TShuKTtyZXR1cm4gZyhlLHt0eXBlOiJDT05TVFJVQ1QiLHBhdGg6ci5tYXAoYz0+Yy50b1N0cmluZygpKSxhcmd1bWVudExpc3Q6dX0sbCkudGhlbihtKX19KTtyZXR1cm4gb31mdW5jdGlvbiBEKGUpe3JldHVybiBBcnJheS5wcm90b3R5cGUuY29uY2F0LmFwcGx5KFtdLGUpfWZ1bmN0aW9uIE0oZSl7Y29uc3Qgcj1lLm1hcChTKTtyZXR1cm5bci5tYXAoaT0+aVswXSksRChyLm1hcChpPT5pWzFdKSldfWNvbnN0IFA9bmV3IFdlYWtNYXA7ZnVuY3Rpb24gTihlLHIpe3JldHVybiBQLnNldChlLHIpLGV9ZnVuY3Rpb24geihlKXtyZXR1cm4gT2JqZWN0LmFzc2lnbihlLHtbJF06ITB9KX1mdW5jdGlvbiBTKGUpe2Zvcihjb25zdFtyLGldb2YgRSlpZihpLmNhbkhhbmRsZShlKSl7Y29uc3RbcyxvXT1pLnNlcmlhbGl6ZShlKTtyZXR1cm5be3R5cGU6IkhBTkRMRVIiLG5hbWU6cix2YWx1ZTpzfSxvXX1yZXR1cm5be3R5cGU6IlJBVyIsdmFsdWU6ZX0sUC5nZXQoZSl8fFtdXX1mdW5jdGlvbiBtKGUpe3N3aXRjaChlLnR5cGUpe2Nhc2UiSEFORExFUiI6cmV0dXJuIEUuZ2V0KGUubmFtZSkuZGVzZXJpYWxpemUoZS52YWx1ZSk7Y2FzZSJSQVciOnJldHVybiBlLnZhbHVlfX1mdW5jdGlvbiBnKGUscixpKXtyZXR1cm4gbmV3IFByb21pc2Uocz0+e2NvbnN0IG89VSgpO2UuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24gYShuKXshbi5kYXRhfHwhbi5kYXRhLmlkfHxuLmRhdGEuaWQhPT1vfHwoZS5yZW1vdmVFdmVudExpc3RlbmVyKCJtZXNzYWdlIixhKSxzKG4uZGF0YSkpfSksZS5zdGFydCYmZS5zdGFydCgpLGUucG9zdE1lc3NhZ2UoT2JqZWN0LmFzc2lnbih7aWQ6b30sciksaSl9KX1mdW5jdGlvbiBVKCl7cmV0dXJuIG5ldyBBcnJheSg0KS5maWxsKDApLm1hcCgoKT0+TWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpKk51bWJlci5NQVhfU0FGRV9JTlRFR0VSKS50b1N0cmluZygxNikpLmpvaW4oIi0iKX1jb25zdCBXPWFzeW5jKCk9PldlYkFzc2VtYmx5LnZhbGlkYXRlKG5ldyBVaW50OEFycmF5KFswLDk3LDExNSwxMDksMSwwLDAsMCwxLDUsMSw5NiwwLDEsMTIzLDMsMiwxLDAsMTAsMTAsMSw4LDAsNjUsMCwyNTMsMTUsMjUzLDk4LDExXSkpLHg9ImVhZ2VyIixrPSJsYXp5IixqPXtzc3c6WyJzaW1kIl0sbWluaW1hcDI6WyJzaW1kIl19LHQ9e3Rvb2xzOltdLGNvbmZpZzp7fSxmaWxlczpbXSxiYXNlOnt9LGZzOnt9LGFzeW5jIGluaXQoKXtpZih0LnRvb2xzLmxlbmd0aD09PTApdGhyb3ciRXhwZWN0aW5nIGF0IGxlYXN0IDEgdG9vbC4iO2lmKG5ldyBTZXQodC50b29scy5tYXAocj0+YCR7ci50b29sfS8ke3IucHJvZ3JhbXx8ci50b29sfWApKS5zaXplIT09dC50b29scy5sZW5ndGgpdGhyb3ciRm91bmQgZHVwbGljYXRlIHRvb2xzOyBjYW4gb25seSBoYXZlIGVhY2ggdG9vbC9wcm9ncmFtIGNvbWJpbmF0aW9uIGF0IG1vc3Qgb25jZS4iO2lmKHQuYmFzZT10LnRvb2xzLmZpbmQocj0+ci5yZWluaXQhPT0hMCksIXQuYmFzZSl0aHJvdyJDb3VsZCBub3QgZmluZCBhIHRvb2wgd2l0aCBgcmVpbml0OiBmYWxzZWAgdG8gdXNlIGFzIHRoZSBiYXNlIG1vZHVsZS4gVG8gZml4IHRoaXMgaXNzdWUsIGluY2x1ZGUgdGhlIHRvb2wgYGJhc2UvMS4wLjBgIHdoZW4gaW5pdGlhbGl6aW5nIEFpb2xpLiI7cmV0dXJuIHQuYmFzZS5pc0Jhc2VNb2R1bGU9ITAsYXdhaXQgdGhpcy5fc2V0dXAodC5iYXNlKSxhd2FpdCB0aGlzLl9pbml0TW9kdWxlcygpLHQuX2xvZygiUmVhZHkiKSwhMH0sYXN5bmMgX2luaXRNb2R1bGVzKCl7YXdhaXQgUHJvbWlzZS5hbGwodC50b29scy5tYXAodGhpcy5fc2V0dXApKSxhd2FpdCB0aGlzLl9zZXR1cEZTKCl9LG1vdW50KGU9W10pe2NvbnN0IHI9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyRGF0YX1gLGk9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyTW91bnRlZH1gO2xldCBzPVtdLG89W10sYT1bXTshQXJyYXkuaXNBcnJheShlKSYmIShlIGluc3RhbmNlb2YgRmlsZUxpc3QpJiYoZT1bZV0pLHQuX2xvZyhgTW91bnRpbmcgJHtlLmxlbmd0aH0gZmlsZXNgKTtmb3IobGV0IG4gb2YgZSl7aWYobiBpbnN0YW5jZW9mIEZpbGV8fChuPT1udWxsP3ZvaWQgMDpuLmRhdGEpaW5zdGFuY2VvZiBCbG9iJiZuLm5hbWV8fHR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmbi5uYW1lKXR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmKG4uZGF0YT1uZXcgQmxvYihbbi5kYXRhXSx7dHlwZToidGV4dC9wbGFpbiJ9KSkscy5wdXNoKG4pO2Vsc2UgaWYobi5uYW1lJiZuLnVybClvLnB1c2gobik7ZWxzZSBpZih0eXBlb2Ygbj09InN0cmluZyImJm4uc3RhcnRzV2l0aCgiaHR0cCIpKW49e3VybDpuLG5hbWU6bi5zcGxpdCgiLy8iKS5wb3AoKS5yZXBsYWNlKC9cLy9nLCItIil9LG8ucHVzaChuKTtlbHNlIHRocm93J0Nhbm5vdCBtb3VudCBmaWxlKHMpIHNwZWNpZmllZC4gTXVzdCBiZSBhIEZpbGUsIEJsb2IsIGEgVVJMIHN0cmluZywgb3IgeyBuYW1lOiAiZmlsZS50eHQiLCBkYXRhOiAic3RyaW5nIiB9Lic7YS5wdXNoKG4ubmFtZSl9dHJ5e3QuZnMudW5tb3VudChpKX1jYXRjaHt9Zm9yKGxldCBuIG9mIG8pdC5mcy5jcmVhdGVMYXp5RmlsZShyLG4ubmFtZSxuLnVybCwhMCwhMCk7cmV0dXJuIHQuZmlsZXM9dC5maWxlcy5jb25jYXQocyksdC5iYXNlLm1vZHVsZS5GUy5tb3VudCh0LmJhc2UubW9kdWxlLldPUktFUkZTLHtmaWxlczp0LmZpbGVzLmZpbHRlcihuPT5uIGluc3RhbmNlb2YgRmlsZSksYmxvYnM6dC5maWxlcy5maWx0ZXIobj0+KG49PW51bGw/dm9pZCAwOm4uZGF0YSlpbnN0YW5jZW9mIEJsb2IpfSxpKSxzLm1hcChuPT57Y29uc3QgdT1gJHtpfS8ke24ubmFtZX1gLGw9YCR7cn0vJHtuLm5hbWV9YDt0cnl7dC5mcy51bmxpbmsobCl9Y2F0Y2h7fXQuX2xvZyhgQ3JlYXRpbmcgc3ltbGluazogJHtsfSAtLT4gJHt1fWApLHQuZnMuc3ltbGluayh1LGwpfSksYS5tYXAobj0+YCR7cn0vJHtufWApfSxhc3luYyBleGVjKGUscj1udWxsKXtpZih0Ll9sb2coYEV4ZWN1dGluZyAlYyR7ZX0lYyBhcmdzPSR7cn1gLCJjb2xvcjpkYXJrYmx1ZTsgZm9udC13ZWlnaHQ6Ym9sZCIsIiIpLCFlKXRocm93IkV4cGVjdGluZyBhIGNvbW1hbmQiO2xldCBpPWU7cj09bnVsbCYmKHI9ZS5zcGxpdCgiICIpLGk9ci5zaGlmdCgpKTtjb25zdCBzPXQudG9vbHMuZmluZChhPT57dmFyIHU7bGV0IG49aTtyZXR1cm4oKHU9YT09bnVsbD92b2lkIDA6YS5mZWF0dXJlcyk9PW51bGw/dm9pZCAwOnUuc2ltZCk9PT0hMCYmKG49YCR7bn0tc2ltZGApLGEucHJvZ3JhbT09bn0pO2lmKHM9PW51bGwpdGhyb3dgUHJvZ3JhbSAke2l9IG5vdCBmb3VuZC5gO3Muc3Rkb3V0PSIiLHMuc3RkZXJyPSIiLHMubG9hZGluZz09ayYmKHMubG9hZGluZz14LGF3YWl0IHRoaXMuX2luaXRNb2R1bGVzKCkpO3RyeXtzLm1vZHVsZS5jYWxsTWFpbihyKX1jYXRjaChhKXtjb25zb2xlLmVycm9yKGEpfXRyeXtzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzFdKSxzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzJdKX1jYXRjaHt9cy5tb2R1bGUuRlMuc3RyZWFtc1sxXT1zLm1vZHVsZS5GUy5vcGVuKCIvZGV2L3N0ZG91dCIsInciKSxzLm1vZHVsZS5GUy5zdHJlYW1zWzJdPXMubW9kdWxlLkZTLm9wZW4oIi9kZXYvc3RkZXJyIiwidyIpO2xldCBvPXtzdGRvdXQ6cy5zdGRvdXQsc3RkZXJyOnMuc3RkZXJyfTtpZih0LmNvbmZpZy5wcmludEludGVybGVhdmVkJiYobz1zLnN0ZG91dCkscy5yZWluaXQ9PT0hMCl7Y29uc3QgYT10LmJhc2UubW9kdWxlLkZTLmN3ZCgpO09iamVjdC5hc3NpZ24ocyxzLmNvbmZpZykscy5yZWFkeT0hMSxhd2FpdCB0aGlzLmluaXQoKSxzLmlzQmFzZU1vZHVsZSYmdGhpcy5tb3VudCgpLHRoaXMuY2QoYSl9cmV0dXJuIG99LGNhdChlKXtyZXR1cm4gdC5fZmlsZW9wKCJjYXQiLGUpfSxscyhlKXtyZXR1cm4gdC5fZmlsZW9wKCJscyIsZSl9LGRvd25sb2FkKGUpe3JldHVybiB0Ll9maWxlb3AoImRvd25sb2FkIixlKX0scHdkKCl7cmV0dXJuIHQuZnMuY3dkKCl9LGNkKGUpe2ZvcihsZXQgciBvZiB0LnRvb2xzKSFyLm1vZHVsZXx8ci5tb2R1bGUuRlMuY2hkaXIoZSl9LG1rZGlyKGUpe3JldHVybiB0LmZzLm1rZGlyKGUpLCEwfSxyZWFkKHtwYXRoOmUsbGVuZ3RoOnIsZmxhZzppPSJyIixvZmZzZXQ6cz0wLHBvc2l0aW9uOm89MH0pe2NvbnN0IGE9dC5mcy5vcGVuKGUsaSksbj1uZXcgVWludDhBcnJheShyKTtyZXR1cm4gdC5mcy5yZWFkKGEsbixzLHIsbyksdC5mcy5jbG9zZShhKSxufSx3cml0ZSh7cGF0aDplLGJ1ZmZlcjpyLGZsYWc6aT0idysiLG9mZnNldDpzPTAscG9zaXRpb246bz0wfSl7Y29uc3QgYT10LmZzLm9wZW4oZSxpKTt0LmZzLndyaXRlKGEscixzLHIubGVuZ3RoLG8pLHQuZnMuY2xvc2UoYSl9LF9zdGRpblR4dDoiIixfc3RkaW5QdHI6MCxnZXQgc3RkaW4oKXtyZXR1cm4gdC5fc3RkaW5UeHR9LHNldCBzdGRpbihlPSIiKXt0Ll9sb2coYFNldHRpbmcgc3RkaW4gdG8gJWMke2V9JWNgLCJjb2xvcjpkYXJrYmx1ZSIsIiIpLHQuX3N0ZGluVHh0PWUsdC5fc3RkaW5QdHI9MH0sYXN5bmMgX3NldHVwKGUpe2lmKGUucmVhZHkpcmV0dXJuO2lmKHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gKGJhc2UgPSAke2UuaXNCYXNlTW9kdWxlPT09ITB9KS4uLmApLGUuY29uZmlnPU9iamVjdC5hc3NpZ24oe30sZSksZS51cmxQcmVmaXh8fChlLnVybFByZWZpeD1gJHt0LmNvbmZpZy51cmxDRE59LyR7ZS50b29sfS8ke2UudmVyc2lvbn1gKSxlLnByb2dyYW18fChlLnByb2dyYW09ZS50b29sKSxlLmZlYXR1cmVzfHwoZS5mZWF0dXJlcz17fSwoaltlLnByb2dyYW1dfHxbXSkuaW5jbHVkZXMoInNpbWQiKSYmKGF3YWl0IFcoKT8oZS5wcm9ncmFtKz0iLXNpbWQiLGUuZmVhdHVyZXMuc2ltZD0hMCk6dC5fbG9nKGBXZWJBc3NlbWJseSBTSU1EIGlzIG5vdCBzdXBwb3J0ZWQgaW4gdGhpcyBicm93c2VyOyB3aWxsIGxvYWQgbm9uLVNJTUQgdmVyc2lvbiBvZiAke2UucHJvZ3JhbX0uYCkpKSxlLmlzQmFzZU1vZHVsZSYmKGUubG9hZGluZz14KSxlLmxvYWRpbmc9PT1rKXt0Ll9sb2coYFdpbGwgbGF6eS1sb2FkICR7ZS50b29sfTsgc2tpcHBpbmcgaW5pdGlhbGl6YXRpb24uYCk7cmV0dXJufXNlbGYuaW1wb3J0U2NyaXB0cyhgJHtlLnVybFByZWZpeH0vJHtlLnByb2dyYW19LmpzYCksZS5tb2R1bGU9YXdhaXQgTW9kdWxlKHt0aGlzUHJvZ3JhbTplLnByb2dyYW0sbG9jYXRlRmlsZTooaSxzKT0+YCR7ZS51cmxQcmVmaXh9LyR7aX1gLHN0ZGluOigpPT50Ll9zdGRpblB0cjx0LnN0ZGluLmxlbmd0aD90LnN0ZGluLmNoYXJDb2RlQXQodC5fc3RkaW5QdHIrKyk6KHQuc3RkaW49IiIsbnVsbCkscHJpbnQ6aT0+ZS5zdGRvdXQrPWAke2l9CmAscHJpbnRFcnI6dC5jb25maWcucHJpbnRJbnRlcmxlYXZlZD9pPT5lLnN0ZG91dCs9YCR7aX0KYDppPT5lLnN0ZGVycis9YCR7aX0KYH0pO2NvbnN0IHI9ZS5tb2R1bGUuRlM7ZS5pc0Jhc2VNb2R1bGU/KHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gd2l0aCBiYXNlIG1vZHVsZSBmaWxlc3lzdGVtLi4uYCksci5ta2Rpcih0LmNvbmZpZy5kaXJTaGFyZWQsNTExKSxyLm1rZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJEYXRhfWAsNTExKSxyLm1rZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJNb3VudGVkfWAsNTExKSxyLmNoZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJEYXRhfWApLHQuZnM9cik6KHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gd2l0aCBmaWxlc3lzdGVtLi4uYCksci5ta2Rpcih0LmNvbmZpZy5kaXJTaGFyZWQpLHIubW91bnQoZS5tb2R1bGUuUFJPWFlGUyx7cm9vdDp0LmNvbmZpZy5kaXJTaGFyZWQsZnM6dC5mc30sdC5jb25maWcuZGlyU2hhcmVkKSxyLmNoZGlyKHQuZnMuY3dkKCkpKSxlLnN0ZG91dD0iIixlLnN0ZGVycj0iIixlLnJlYWR5PSEwfSxhc3luYyBfc2V0dXBGUygpe2NvbnN0IGU9dC5mcztmb3IobGV0IHIgb2YgdC50b29scyl7aWYoIXIucmVhZHkpY29udGludWU7Y29uc3QgaT1yLm1vZHVsZS5GUyxzPWAvJHtyLnRvb2x9YCxvPWAke3QuY29uZmlnLmRpclNoYXJlZH0ke3N9YDshaS5hbmFseXplUGF0aChzKS5leGlzdHN8fGUuYW5hbHl6ZVBhdGgobykuZXhpc3RzfHwodC5fbG9nKGBNb3VudGluZyAke3N9IG9udG8gJHt0LmJhc2UudG9vbH0gZmlsZXN5c3RlbSBhdCAke299YCksZS5ta2RpcihvKSxlLm1vdW50KHQuYmFzZS5tb2R1bGUuUFJPWFlGUyx7cm9vdDpzLGZzOml9LG8pKX19LF9maWxlb3AoZSxyKXt0Ll9sb2coYFJ1bm5pbmcgJHtlfSAke3J9YCk7Y29uc3QgaT10LmZzLmFuYWx5emVQYXRoKHIpO2lmKCFpLmV4aXN0cylyZXR1cm4gdC5fbG9nKGBGaWxlICR7cn0gbm90IGZvdW5kLmApLCExO3N3aXRjaChlKXtjYXNlImNhdCI6cmV0dXJuIHQuZnMucmVhZEZpbGUocix7ZW5jb2Rpbmc6InV0ZjgifSk7Y2FzZSJscyI6cmV0dXJuIHQuZnMuaXNGaWxlKGkub2JqZWN0Lm1vZGUpP3QuZnMuc3RhdChyKTp0LmZzLnJlYWRkaXIocik7Y2FzZSJkb3dubG9hZCI6Y29uc3Qgcz1uZXcgQmxvYihbdGhpcy5jYXQocildKTtyZXR1cm4gVVJMLmNyZWF0ZU9iamVjdFVSTChzKX1yZXR1cm4hMX0sX2xvZyhlKXtpZighdC5jb25maWcuZGVidWcpcmV0dXJuO2xldCByPVsuLi5hcmd1bWVudHNdO3Iuc2hpZnQoKSxjb25zb2xlLmxvZyhgJWNbV2ViV29ya2VyXSVjICR7ZX1gLCJmb250LXdlaWdodDpib2xkIiwiIiwuLi5yKX19O3codCl9KSgpOwo=",T=typeof window<"u"&&window.Blob&&new Blob([atob(v)],{type:"text/javascript;charset=utf-8"});function S(){const e=T&&(window.URL||window.webkitURL).createObjectURL(T);try{return e?new Worker(e):new Worker("data:application/javascript;base64,"+v)}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}const E={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 _{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({},E,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 x=n(850);class P{static getAvailableScales(){return Object.entries(this.scales).map((([e,t])=>e))}static getScale(e){return(0,x.hu)(!(void 0===this.scales[e]),`Scale '${e}' was not found.`),this.scales[e]}}P.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 ${constructor(e="categorial"){this.aa2num=P.getScale(e),this.num2aa={},Object.entries(this.aa2num).forEach((([e,t])=>this.num2aa[t]=e))}static _truncateSequence(e){let t=0,n=e.length;const s=["NH2","COOH"];if(e.startsWith(s[0])){const n=s[0].length;(0,x.hu)("-"==e[n],`Wrong sequence format: ${s[0]} without following '-' in '${e}'.`),t=n}if(e.endsWith(s[1])){const t=s[1].length+1;(0,x.hu)("-"==e[n-t],`Wrong sequence format: ${s[1]} without '-' precending in '${e}'.`),n-=t}return e.substring(t,n)}static _dropDefises(e){return e.replace(/(-)([^-]+)/g,"$2")}static clean(e){return $._dropDefises($._truncateSequence(e))}encode(e){const t=e.length,n=new Array(t).fill(0);for(let s=0;s<t;++s){const t=e[s];(0,x.hu)(t in this.aa2num,`Unknown char '${t}' found in sequence '${e}'`),n[s]=this.encodeLettter(t)}return n}encodeLettter(e){return this.aa2num[e]}decode(e){let t="";for(let n=0;n<e.length;++n){const s=e[n];(0,x.hu)(s in this.num2aa,`Unknown code '${s}' found in vector '${e}'`),t+=this.num2aa[s]}return t}}var N=n(3553);const M="input.fa",L="result.fasta";function I(e){return e.reduce(((e,t,n)=>e+`>sample${n+1}\n${t}\n`),"")}async function R(e,t=!1,n="",i=null,o,a,l){let c=e.toList();t&&(c=c.map((e=>$.clean(e).replace(/\-/g,""))));const u=e.length;i??(i=s.Column.string("Clusters",u).init("0")),i.type!=s.COLUMN_TYPE.STRING&&(i=i.convertTo(s.TYPE.STRING)),i.compact();const h=i.categories,d=i.getRawData(),m=new Array(h.length),p=new Array(h.length);for(let e=0;e<u;++e){const t=d[e];(m[t]??(m[t]=[])).push(c[e]),(p[t]??(p[t]=[])).push(e)}const f=await new _(["base/1.0.0",{tool:"kalign",version:N.WY,reinit:!0}]),g=s.Column.string(n,u);for(let e=0;e<h.length;++e){const t=I(m[e]);await f.fs.writeFile(M,t);const n=`${void 0!==o?` --gpo ${o}`:""}${void 0!==a?` --gpe ${a}`:""}${void 0!==l?` --tgpe ${l}`:""}`,s=await f.exec(`kalign ${M} -f fasta -o ${L}${n}`);console.warn(s);const i=await f.cat(L);if(!i)throw new Error("kalign output no result");const c=new r.i(i).sequencesArray,u=p[e];for(let e=0;e<c.length;++e)g.set(u[e],c[e])}const y=e.getTag(s.TAGS.UNITS),w=e.getTag("alphabet");return g.setTag(s.TAGS.UNITS,y),g.setTag("aligned","SEQ.MSA"),g.setTag("alphabet",w),g.semType=s.SEMTYPE.MACROMOLECULE,g}},8341:(e,t,n)=>{"use strict";n.d(t,{Jy:()=>c,f3:()=>h,lp:()=>l});var s=n(4469),r=n(976),i=n(8447),o=n(3553),a=n(7422);const l=new class{constructor(){this.dcName="bio"}async getDockerContainer(){return await s.dapi.docker.dockerContainers.filter(this.dcName).first()}},c=["mafft --auto","mafft","linsi","ginsi","einsi","fftns","fftnsi","nwns","nwnsi"],u=["AlignedSeq","AlignedSubpeptide","HELM","ID","PolymerID"];async function h(e,t,n="ginsi",s=1.53,a=0,c=null,h){const m=await l.getDockerContainer();if("started"!==m.status&&"checking"!==m.status)throw new Error("PepSeA container has not started yet");const p=e.length;c??(c=r.Column.int("Clusters",p).init(0)),c.type!=r.COLUMN_TYPE.STRING&&(c=c.convertTo(r.TYPE.STRING));const f=c.categories,g=new Array(f.length);for(let t=0;t<p;++t){const n=c.get(t);if(""===n)continue;const s=f.indexOf(n),r=e.get(t);r&&(g[s]??(g[s]=[])).push({ID:t.toString(),HELM:r})}const y=new Array(p);for(const e of g){const t=(await d(m.id,e,n,s,a,h)).Alignment;for(const e of t)y[parseInt(e.ID)]=Object.entries(e).filter((e=>!u.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 d(e,t,n,r,i,o){const l={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)},c=`/align?method=${n}&gap_open=${r}&gap_extend=${i}`;let u;if("fetchProxy"in s.dapi.docker.dockerContainers){const t=window.performance.now(),n=await s.dapi.docker.dockerContainers.fetchProxy(e,c,l),r=window.performance.now();a._package.logger.debug(`Bio: requestAlignedObjects() dockerContainers.fetchProxy(), ET: ${r-t} ms`);const i="application/json"===n.headers.get("content-type");if(!n.ok&&i){const e=await n.json(),t=e["pepsea-error"];if(t)throw new Error(`PepSeA error: ${t}`);const s=e["datagrok-error"];if(s)throw new Error(`Datagrok error: ${s}`);throw new Error(n.statusText)}if(!n.ok&&!i){const e=await n.text();throw new Error(`Error: ${e}`)}if(!i){const e=await n.text();throw new Error(`Error: PepSeA expected JSON response, got '${e}'.`)}u=await n.json()}else{const t=await s.dapi.docker.dockerContainers.request(e,c,l);if(!t)throw new Error("Empty response");u=JSON.parse(t);const n=u["pepsea-error"];if(n)throw new Error(`PepSeA error: ${n}`);const r=u["datagrok-error"];if(r)throw new Error(`Datagrok error: ${r}`)}if("pepsea-stderr"in u){const e=u["pepsea-stderr"];o?.warning(e)}return u}},9943:(e,t,n)=>{"use strict";n.d(t,{i$:()=>a,sK:()=>l}),n(976),n(3870),n(4469);var s=n(6414),r=n.n(s),i=n(8607);const o=60;function a(e,t,n=o,s="\n"){const r=i.g.forColumn(t),a=[];for(let i=0;i<t.length;i++){const t=e.map((e=>e.get(i).toString())).join("|"),o=l(r.getSplitted(i),n);a.push(`>${t}${s}`);for(const e of o)a.push(`${e}${s}`)}return"".concat(...a)}function l(e,t=o){let n=0;const s=e.length,i=[];for(;n<s;){const s=r()(e.originals).slice(n,n+t).toArray(),o=s.map((e=>e.length>1?`[${e}]`:e)).reduce(((e,t)=>e+t),"");i.push(o),n+=s.length}return i}},9416:(e,t,n)=>{"use strict";n.d(t,{n:()=>c});var s=n(4469),r=n(976),i=n(2997),o=n(2568),a=n(8457),l=n(3553);async function c(e,t){if(await(0,i.gw)(10),!(0,o.n)(t,"Sequence space"))return e;const n=(0,a.O)(t);n.name="splitToMonomers";const c=t.dataFrame;for(const e of n.columns)e.semType=l.Of.MONOMER,e.setTag("alphabet",t.getTag("alphabet"));const u=/(\d+)(?: \((\d+)\))?/,h=e=>{u.lastIndex=0;const t=e.match(u);return t?`${t[1]} (${parseInt(t[2]??0)+1})`:e};for(let e=0;e<n.columns.length;e++){const s=n.columns.byIndex(e);s.semType=l.Of.MONOMER,s.setTag("alphabet",t.getTag("alphabet"));const r=100;let i=0;for(;c.columns.byName(s.name)&&i<r;)s.name=h(s.name),i++;c.columns.add(s)}await s.data.detectSemanticTypes(c);for(let e=0;e<n.columns.length;e++){const t=n.columns.byIndex(e);t.setTag(r.TAGS.CELL_RENDERER,"Monomer"),t.setTag(".use-as-filter","false")}return c}},4293:(e,t,n)=>{"use strict";function s(e,t){e.innerHTML="",e.append(t)}n.d(t,{Y:()=>s}),n(4469),n(976)},8415:(e,t,n)=>{"use strict";n.d(t,{Fs:()=>_,bo:()=>b,CK:()=>T,yW:()=>v,eZ:()=>P});var s=n(4469),r=n(3870),i=n(976),o=n(3336),a=n.n(o),l=n(6414),c=n.n(l),u=n(701),h=n(8607),d=n(8447),m=n(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=n(6286),g=n(2997),y=n(172);var w,b,A=n(8770),C=n(7422);HTMLCanvasElement.prototype.getCursorPosition=function(e,t){const n=this.getBoundingClientRect();return new i.Point((e.clientX-n.left)*t,(e.clientY-n.top)*t)},i.Rect.prototype.contains=function(e,t){return this.left<=e&&e<=this.right&&this.top<=t&&t<=this.bottom};class v{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 T{get label(){return this._label?this._label:this.name}constructor(e,t,n,s){this.pos=e,this.name=t,this.sumRowCount=0,this._freqs=n??{},s?.sumRowCount&&(this.sumRowCount=s.sumRowCount),s?.sumValueForHeight&&(this.sumPlotValue=s.sumValueForHeight),s?.label&&(this._label=s.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 v),t}aggregate(e){const t=function(e){return t=>{const n=function(e){let t;const n="agg";return t=e instanceof Float32Array?i.Column.fromFloat32Array(n,e):e instanceof Int32Array?i.Column.fromInt32Array(n,e):i.Column.fromList(i.COLUMN_TYPE.FLOAT,n,e),t}(t);return n.aggregate(e)}}(e);for(const[e,n]of Object.entries(this._freqs))n.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,n=t/e;for(const e of Object.values(this._freqs)){const s=(e.plotValue+n)/(this.sumPlotValue+t);this.sumPlotValueForHeight+=-s*Math.log2(s)}}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,n,s,r,o,a,l,c){const u=s===m.ES.Entropy?n*(r-this.sumPlotValueForHeight)/r:n;let h=c*l+(n-u-1);const d=Object.entries(this._freqs).sort(((e,t)=>e[0]!==f.G2&&t[0]!==f.G2?t[1].value-e[1].value:e[0]===f.G2&&t[0]===f.G2?0:e[0]===f.G2?-1:1));for(const[n,s]of d){const n=u*s.plotValue/this.sumPlotValue;s.bounds=new i.Rect((e-t)*l*o,h,a*l,n),h+=n}}render(e,t,n,s,r){for(const[i,o]of Object.entries(this._freqs))if(i!==f.G2){const a=(0,d.GU)(i,5),l=o.bounds,c=l.left;e.resetTransform(),e.strokeStyle="lightgray",e.lineWidth=1,e.rect(c,l.top,l.width,l.height),e.fillStyle=r.get(i)??r.get("other"),e.textAlign="left",e.font=t;const u=e.measureText(a);e.setTransform(l.width/u.width,0,0,l.height/s,c,l.top),e.fillText(a,0,-n)}}getMonomerAt(e,t){const n=Object.entries(this._freqs).find((([n,s])=>s.bounds.contains(e,t)));return n?n[0]:void 0}buildCompositionTable(e){if("-"in this._freqs)throw new Error("Unexpected monomer symbol '-'.");return(0,A._)(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 E;!function(e){e[e.None=0]="None",e[e.Render=1]="Render",e[e.Layout=1]="Layout",e[e.Freqs=2]="Freqs"}(E||(E={}));const _=new class{constructor(){this.render=20}};class x 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.seqHandler.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=++x.viewerCounter,this.setDataInProgress=!1,this.viewSubs=[],this._onSizeChanged=new u.Subject,this._onFreqsCalculated=new u.Subject,this._onLayoutCalculated=new u.Subject,this.requestedRenderLevel=E.Freqs,this.renderRequest=new u.Subject,this._onRendered=new u.Subject,this.textBaseline="top",this.seqHandler=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 n=0;"auto"===this.positionMarginState&&(n=4),this.positionMargin=this.int(b.positionMargin,n,{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(C._package.logger)}viewerToLog(){return`WebLogoViewer<${this.viewerId}>`}setData(){const e=`${this.viewerToLog()}.setData()`;C._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}}})),C._package.logger.debug(`${e}, out`)}async destroyView(){for(const e of this.viewSubs)e.unsubscribe();this.viewSubs=[];const e=this.dataFrame?"data":"null";C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.destroyView( dataFrame = ${e} ) start`),this.host.remove(),this.msgHost=void 0,this.host=void 0,C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.destroyView() end`)}async buildView(){const e=this.dataFrame?"data":"null";C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.buildView( dataFrame = ${e} ) start`),window.devicePixelRatio,this.viewSubs.push(i.debounce(this.renderRequest,_.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,u.fromEvent)(this.canvas,"mousemove").subscribe(this.canvasOnMouseMove.bind(this))),this.viewSubs.push((0,u.fromEvent)(this.canvas,"mousedown").subscribe(this.canvasOnMouseDown.bind(this))),this.viewSubs.push((0,u.fromEvent)(this.canvas,"wheel").subscribe(this.canvasOnWheel.bind(this))),this.render(E.Freqs,"buildView"),C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.buildView() end`)}rootOnSizeChanged(){C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.rootOnSizeChanged(), start `),this.render(E.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.seqHandler=h.g.forColumn(this.seqCol),this.palette=(0,d.dQ)(this.seqCol),this.render(E.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.seqHandler=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,n=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=`${n}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=n*e}calcLayoutNoFitArea(e){if(!this.host||!this.canvas||!this.slider)return;const t=this._positionWidthWithMargin*this.Length,n=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight),s=Math.min(this.root.clientWidth,t);this.canvas.style.width=`${s}px`,this.canvas.style.height=`${n}px`,this.host.style.width=`${s}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=`${s+6}px`),this.host.style.width=`${this.host}px`;const r=t>s;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 n=this.root.clientWidth/this._positionWidthWithMargin;t=Math.min(Math.max(e,0)+n,this.Length-.001),e=Math.max(0,Math.min(t,this.Length-.001)-n),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=s*e,this.canvas.height=n*e}calcLayoutFitArea(e){if(!this.host||!this.canvas||!this.slider)return;const t=this._positionWidth*this.Length,n=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight),s=t>0?(this.root.clientWidth-this.positionMarginValue*this.Length)/t:0,r=this.root.clientHeight/n,i=Math.max(1,Math.min(s,r));this._positionWidth=this.positionWidth*i,this._positionWidthWithMargin=this._positionWidth+this.positionMarginValue;const o=(this._positionWidth+this.positionMarginValue)*this.Length,a=i*n,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 n=this.root.clientWidth/this._positionWidthWithMargin;t=Math.min(Math.max(e,0)+n,this.Length-.001),e=Math.max(0,Math.min(t,this.Length-.001)-n),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(E.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(E.Layout,`onPropertyChanged(${e.name})`);break;case b.backgroundColor:this.render(E.Render,`onPropertyChanged(${e.name})`)}}onTableAttached(){C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.onTableAttached(), `),super.onTableAttached(),this.setData()}detach(){const e=`${this.viewerToLog()}.detach()`;C._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())})),C._package.logger.debug(`${e}, out`)}get onSizeChanged(){return this._onSizeChanged}get onFreqsCalculated(){return this._onFreqsCalculated}get onLayoutCalculated(){return this._onLayoutCalculated}getMonomer(e,t){const n=e.x,s=Math.floor(e.x/(this._positionWidthWithMargin*t)+Math.floor(this.slider.min)),r=this.positions[s];if(!r)return[null,null,null];const i=r.getMonomerAt(n,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=>!e.hasMonomer(f.G2)||e.getFreq(f.G2).rowCount!==e.sumRowCount)).toArray())}render(e,t){C._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(C._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,n=this.showPositionLabels?12:0;if(e>=E.Freqs&&(()=>{if(C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateFreqsInt(), start `),!this.host||!this.seqCol||!this.dataFrame)return;const e=this.seqCol.getTag(".positionNames"),t=this.seqCol.getTag(".positionLabels");let n;!e&&this.endPositionName&&/\d+/.test(this.endPositionName)?n=Number(this.endPositionName):e&&this.endPositionName&&(n=e.split(d.CI).indexOf(this.endPositionName),n=-1!==n?n:void 0);const s=this.getFilter(),r=0===s.trueCount?this.seqHandler.maxLength:c().count(0).take(this.seqHandler.length).map((e=>{const t=this.seqHandler.getSplitted(e,n);return s.get(e)&&t?t.length:0})).reduce(((e,t)=>Math.max(e,t)),0);this.positionNames=e?e.split(d.CI).map((e=>e.trim())):[...Array(r).keys()].map((e=>`${e+1}`)),this.positionLabels=t?t.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):r-1;const o=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.seqHandler=h.g.forColumn(this.seqCol);const a=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.positions=new Array(a);for(let e=0;e<o;e++){const t=this.positionNames[this.startPosition+e],n=this.positionLabels?this.positionLabels[this.startPosition+e]:void 0;this.positions[e]=new T(this.startPosition+e,t,{},{label:n})}const l=this.dataFrame.rowCount;for(let e=0;e<o;++e){for(let t=0;t<l;++t)if(s.get(t)){const n=this.seqHandler.getSplitted(t),s=e<n.length?n.getCanonical(this.startPosition+e):this.seqHandler.defaultGapOriginal,r=this.seqHandler.defaultGapOriginal===s?f.G2:s,i=this.positions[e],o=i.getFreq(r);++i.sumRowCount,o.value=++o.rowCount}if(this.valueAggrType===i.AGG.TOTAL_COUNT)continue;let t=null;try{t=this.dataFrame.getCol(this.valueColumnName),t.matches("numerical")||(t=null)}catch{t=null}if(t){for(let n=0;n<l;++n)if(s.get(n)){const s=this.seqHandler.getSplitted(n).getCanonical(this.startPosition+e),r=t.get(n);this.positions[e].getFreq(s).push(r)}this.positions[e].aggregate(this.valueAggrType)}}const u=this.valueAggrType===i.AGG.TOTAL_COUNT?0:Math.min(0,Math.min(...this.positions.map((e=>e.getMinValue()))));for(let e=0;e<o;++e)this.positions[e].calcPlotValue(u),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>=E.Layout&&((e,t,n,r)=>{C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt(), start `);const o=this.canvas.height-r*n;let a;if(this.valueAggrType===i.AGG.TOTAL_COUNT){const e=this.getAlphabetSize();this.positionHeight==m.ES.Entropy&&null==e&&s.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 s=e;s<=t;++s)s in this.positions?this.positions[s].calcScreen(s,this.slider.min,o,this.positionHeight,a,this._positionWidthWithMargin,this._positionWidth,n,r):C._package.logger.warning(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt() this.positions.length = ${this.positions.length}, jPos = ${s}`);C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt(), end `),this._onLayoutCalculated.next()})(r,o,window.devicePixelRatio,n);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`,n>0&&this.positions.length>0&&function(e,t,n,s,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 n=i[t],s=e.measureText(n.name),r=s.actualBoundingBoxDescent-s.actualBoundingBoxAscent;l=null===l?s.width:Math.max(l,s.width),c=null===c?r:Math.max(c,r)}const u=l<s*t-2?1:(s*t-2)/l;for(let l=Math.floor(o);l<=Math.floor(a);l++){const a=i[l],h=(l-o)*n*t+s*t/2,d=(r*t-c)/2;e.setTransform(u,0,0,1,h,d),e.measureText(a.label),e.fillText(a.label,0,0)}}finally{e.restore()}}(a,t,this._positionWidthWithMargin,this._positionWidth,n,this.positions,this.slider.min,this.slider.max);const s="16px Roboto, Roboto Local, sans-serif",l=.25,c=12.2;for(let e=r;e<=o;e++)this.positions[e].render(a,s,l,c,this.palette)}finally{a.restore()}C._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=E.None,this.viewSyncer.sync(t,(async()=>{await this.renderInt(e)}))):C._package.logger.warning(`${t}, $(this.root).offsetParent() is the 'HTML' tag.`)}getAlphabetSize(){return this.seqHandler?.getAlphabetSize()??0}sliderOnValuesChanged(e){try{const e={minRange:this.slider.minRange,min:this.slider.min,max:this.slider.max,maxRange:this.slider.maxRange};C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.sliderOnValuesChanged( ${JSON.stringify(e)} ), start`),this.render(E.Layout,"sliderOnValuesChanged")}catch(e){const t=p(e);C._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.sliderOnValuesChanged() error:\n`+t)}}dataFrameFilterOnChanged(e){C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameFilterChanged()`);try{this.filterSource===m.Ct.Filtered&&this.render(E.Freqs,"dataFrameFilterOnChanged")}catch(e){const t=p(e);C._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameFilterOnChanged() error:\n`+t)}}dataFrameSelectionOnChanged(e){C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameSelectionOnChanged()`);try{this.filterSource===m.Ct.Selected&&this.render(E.Freqs,"dataFrameSelectionOnChanged")}catch(e){const t=p(e);C._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameSelectionOnChanged() error:\n`+t)}}canvasOnMouseMove(e){const t=window.devicePixelRatio;try{const n=e,s=this.canvas.getCursorPosition(n,t),[o,a]=this.getMonomer(s,t),l=this.showPositionLabels?12*t:0;if(null!==o&&null===a&&0<=s.y&&s.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,n.x+16,n.y+16)}else if(null!==o&&a&&this.dataFrame&&this.seqCol&&this.seqHandler){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 s=r.divV(t);r.tooltip.show(s,n.x+16,n.y+16)}else r.tooltip.hide()}catch(e){const t=p(e);C._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnMouseMove() error:\n`+t)}}canvasOnMouseDown(e){try{const t=e,n=window.devicePixelRatio,[s,r]=this.getMonomer(this.canvas.getCursorPosition(t,n),n);if(null!==s&&null!==r&&this.dataFrame&&this.seqCol&&this.seqHandler){const e=i.BitSet.create(this.dataFrame.selection.length,(e=>function(e,t,n,s,r,i){const o=t.getSplitted(s),a=i.pos<o.length?o.getCanonical(i.pos):null;return null!==a&&a===r}(this.dataFrame,this.seqHandler,this.getFilter(),e,r,s)));this.dataFrame.selection.init((t=>e.get(t)))}}catch(e){const t=p(e);C._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnMouseDown() error:\n`+t)}}canvasOnWheel(e){const t=window.devicePixelRatio;try{if(!this.visibleSlider)return;const n=this.canvas.width/(this._positionWidthWithMargin*t),s=e.deltaY/100*Math.max(Math.floor(n/5),1);this.slider.scrollBy(this.slider.min+s)}catch(e){const t=p(e);C._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnWheel() error:\n`+t)}}get onRendered(){return this._onRendered}invalidate(e){const t=`invalidate(${e?` <- ${e} `:""})`,n=`${this.viewerToLog()}.${t}`;this.render(E.None,t),this.viewSyncer.sync(`${n}`,(async()=>{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 P(e,t,n,s,r){let i=0,o=-1;for(;-1!=(o=n.findNext(o,!0));){const e=t.getSplitted(o),n=r.pos,a=n<e.length?e.getCanonical(n):null;null!==a&&a===s&&i++}return i}x.residuesSet="nucleotides",x.viewerCounter=-1},8755:(e,t,n)=>{"use strict";n.d(t,{Y:()=>o,x:()=>i});var s=n(701),r=n(7422);class i{constructor(e,t=!0){return this.substructure=e,this.readOnly=t,new Proxy(this,{set:(e,t,n)=>{if(r._package.logger.debug(`BioFilterProps.set ${t.toString()}( '${n}' )`),this.readOnly)throw new Error("Properties are immutable.");return e[t]=n,!0}})}}class o{constructor(){this.onChanged=new s.Subject,this._propsChanging=!1}get props(){return this._props||(this._props=this.emptyProps),this._props}set props(e){this._propsChanging=!0;try{this._props=e,this.applyProps(),this.onChanged.next()}finally{this._propsChanging=!1}}saveProps(){const e={};for(const[t,n]of Object.entries(this.props))"_onChanged"!==t&&(e[t]=this.props[t]);return e}async detach(){}get filterSummary(){return this.props.substructure}get isFiltering(){return""!==this.props.substructure}resetFilter(){this.props=this.emptyProps,this.onChanged.next()}}},5393:(e,t,n)=>{"use strict";n.d(t,{ST:()=>S,LH:()=>T});var s=n(3870),r=n(976),i=n(4469),o=n(6414),a=n.n(o),l=n(701),c=n(8447),u=n(2997),h=n(8607),d=n(172),m=n(7983),p=n(8755),f=n(3336),g=n.n(f),y=n(7945),w=n(4293),b=n(7422);class A extends p.Y{viewerToLog(){return`HelmBioFilter<${this.viewerId}>`}get type(){return"HelmBioFilter"}constructor(){super(),this.emptyProps=new p.x(""),this._filterPanel=s.div("",{style:{cursor:"pointer"}}),this.viewerId=++A.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,n;this.helmEditor=e.createHelmWebEditor(),this.logger.warning("TEST: HelmBioFilter.init().sync() waitForElementInDom waiting..."),await s.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=s.div(),n=e.createWebEditorApp(t,this.props.substructure),s.dialog({showHeader:!1,showFooter:!0}).add(t).onOK((()=>{try{const e=n.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,n=null}})).onCancel((()=>{g()(t).empty(),t=null,n=null})).show({modal:!0,fullScreen:!0})}))),this.viewSubs.push(s.onSizeChanged(this._filterPanel).subscribe((e=>{try{if(n){const e=n.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.updateFilterPanel(e)}}catch(e){const[t,n]=(0,y.yf)(e);this.logger.error(t,void 0,n)}})))}catch(e){const[t,n]=(0,y.yf)(e),r=this._filterPanel;r.innerText="error",r.classList.add("d4-error"),s.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,n=t/2;if(e)(0,w.Y)(this._filterPanel,this.helmEditor.host),this.helmEditor.editor.setHelm(e),this.helmEditor.resizeEditor(t,n);else{const e=s.divText("Click to edit","helm-substructure-filter");(0,w.Y)(this._filterPanel,e)}}async substructureSearch(e){const t=`${this.viewerToLog()}.substructureSearch( column = <${e.name}> )`;b._package.logger.debug(`${t}, start`);try{return await(0,u.gw)(10),await(0,m.QF)(this.props.substructure,e)}finally{b._package.logger.debug(`${t}, end`)}}}A.viewerCounter=-1;const C="bio-substructure-filter";class v{constructor(e,t,n,s,r){this.props=e,this.filterId=t,this.dataFrameId=n,this.columnName=s,this.bitset=r}}class T extends p.x{constructor(e,t){super(e,!1),this.separator=t,this.readOnly=!0}}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=s.divV([]),this.loader=s.loader(),this.calculating=!1,this.filterSyncer=new d.c(this.logger=b._package.logger),new Proxy(this,{set:(e,t,n)=>(e[t]=n,!0)})}filterToLog(){return`BioSubstructureFilter<${this.filterId}>`}attach(e){const t=super.attach.bind(this),n=`${this.filterToLog()}.attach()`;this.filterSyncer.sync(n,(async()=>{t(e),this.column||(this.columnName?this.column=this.dataFrame.getCol(this.columnName):this.column=e.columns.bySemType(r.SEMTYPE.MACROMOLECULE)),h.g.forColumn(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 E:this.notation===c.r2.SEPARATOR?new _(this.column.getTag("separator")):new A,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(this.grokEventsOnResetFilterRequest.bind(this))),this.viewSubs.push(i.events.onCustomEvent(C).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(){const e=`${this.filterToLog()}.applyFilter()`;this.logger.debug(`${e}, IN`),this.bitset&&!this.isDetached&&this.dataFrame?.filter.and(this.bitset)}saveState(){const e=`${this.filterToLog()}.saveState()`,t=super.saveState();return this.logger.debug(`${e}, super.state = ${JSON.stringify(t)}`),t.props=this.bioFilter.saveProps(),t}applyState(e){const t=`${this.filterToLog()}.applyState()`;super.applyState(e),this.filterSyncer.sync(t,(async()=>{e.props&&this.bioFilter&&(this.bioFilter.props=r.toJs(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.saveProps())}`:"")),i.events.fireCustomEvent(C,new v(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.saveProps())}`),!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`)}}))}grokEventsOnResetFilterRequest(){const e=`${this.filterToLog()}.grokEventsOnResetFilterRequest()`;b._package.logger.debug(`${e}`),this.bioFilter?.resetFilter()}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} )`,n=`${this.filterToLog()}.${t}`;await(0,u.gw)(10),await(0,u.zg)(this.onRendered,(()=>{this.logger.debug(`${n}, _onRendered event caught`)}),(()=>{this.invalidate(t)}),e,`${n} timeout`);const s=this.filterSyncer.resetErrors();if(s.length>0)throw s[0]}}S.filterCounter=-1;class E extends p.Y{get type(){return"FastaBioFilter"}constructor(){super(),this.emptyProps=new p.x(""),this.substructureInput=s.stringInput("","",(()=>{this.props=new p.x(this.substructureInput.value),this._propsChanging||this.onChanged.next()}),{placeholder:"Substructure"})}applyProps(){this.substructureInput.value!==this.props.substructure&&(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 _ extends p.Y{get type(){return"SeparatorBioFilter"}constructor(e){super(),this.emptyProps=new T("",void 0),this.colSeparator="",this.substructureInput=s.stringInput("","",(()=>{this.props=new T(this.substructureInput.value,this.props.separator),this._propsChanging||this.onChanged.next()}),{placeholder:"Substructure"}),this.separatorInput=s.stringInput("",this.colSeparator=e,(()=>{const e=this.separatorInput.value?this.separatorInput.value:void 0;this.props=new T(this.props.substructure,e),this._propsChanging||this.onChanged.next()}),{placeholder:"Separator"})}applyProps(){this.substructureInput.value!==this.props.substructure&&(this.substructureInput.value=this.props.substructure);const e=this.props.separator??this.colSeparator;this.separatorInput.value!==e&&(this.separatorInput.value=e)}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 T("")}get filterPanel(){return s.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,n)=>{"use strict";n.d(t,{_:()=>A});var s=n(3870),r=n(976),i=(n(6414),n(8447),n(7331),n(3379)),o=n.n(i),a=n(7795),l=n.n(a),c=n(569),u=n.n(c),h=n(3565),d=n.n(h),m=n(9216),p=n.n(m),f=n(4589),g=n.n(f),y=n(5362),w={};w.styleTagTransform=g(),w.setAttributes=d(),w.insert=u().bind(null,"head"),w.domAPI=l(),w.insertStyleElement=p(),o()(y.Z,w),y.Z&&y.Z.locals&&y.Z.locals,n(8607);var b=n(6286);function A(e,t){let n=0,i=null;for(const e of Object.values(t))n+=e,i=null===i?e:Math.max(i,e);const o=i/n,a=Object.assign({},...Array.from(Object.entries(t)).sort(((e,t)=>t[1]-e[1])).map((([t,i])=>{const a=i/n,l=e.get(t),c=s.div("",{classes:"macromolecule-cell-comp-analysis-bar"});c.style.width=50*a/o+"px",c.style.backgroundColor=l,b.G2===t&&(c.style.borderWidth="1px",c.style.borderStyle="solid",c.style.borderColor=r.Color.toHtml(r.Color.lightGray));const u=b.G2===t?"-":t,h=s.div(`${(100*a).toFixed(2)}%`);return{[u]:s.div([c,h],{classes:"macromolecule-cell-comp-analysis-value"})}}))),l=s.tableFromMap(a);return Array.from(l.rows).forEach((e=>{const t=e.getElementsByClassName("macromolecule-cell-comp-analysis-bar")[0].style.backgroundColor;e.cells[0].style.color=t})),l}},540:function(e,t){!function(e){"use strict";function t(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(t.length>1){t[0]=t[0].slice(0,-1);for(var s=t.length-1,r=1;r<s;++r)t[r]=t[r].slice(1,-1);return t[s]=t[s].slice(1),t.join("")}return t[0]}function n(e){return"(?:"+e+")"}function s(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 s="[A-Za-z]",r="[0-9]",i=t(r,"[A-Fa-f]"),o=n(n("%[EFef]"+i+"%"+i+i+"%"+i+i)+"|"+n("%[89A-Fa-f]"+i+"%"+i+i)+"|"+n("%"+i+i)),a="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",l=t("[\\:\\/\\?\\#\\[\\]\\@]",a),c=e?"[\\uE000-\\uF8FF]":"[]",u=t(s,r,"[\\-\\.\\_\\~]",e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]"),h=n(s+t(s,r,"[\\+\\-\\.]")+"*"),d=n(n(o+"|"+t(u,a,"[\\:]"))+"*"),m=(n(n("25[0-5]")+"|"+n("2[0-4]"+r)+"|"+n("1"+r+r)+"|"+n("[1-9]"+r)+"|"+r),n(n("25[0-5]")+"|"+n("2[0-4]"+r)+"|"+n("1"+r+r)+"|"+n("0?[1-9]"+r)+"|0?0?"+r)),p=n(m+"\\."+m+"\\."+m+"\\."+m),f=n(i+"{1,4}"),g=n(n(f+"\\:"+f)+"|"+p),y=n(n(f+"\\:")+"{6}"+g),w=n("\\:\\:"+n(f+"\\:")+"{5}"+g),b=n(n(f)+"?\\:\\:"+n(f+"\\:")+"{4}"+g),A=n(n(n(f+"\\:")+"{0,1}"+f)+"?\\:\\:"+n(f+"\\:")+"{3}"+g),C=n(n(n(f+"\\:")+"{0,2}"+f)+"?\\:\\:"+n(f+"\\:")+"{2}"+g),v=n(n(n(f+"\\:")+"{0,3}"+f)+"?\\:\\:"+f+"\\:"+g),T=n(n(n(f+"\\:")+"{0,4}"+f)+"?\\:\\:"+g),S=n(n(n(f+"\\:")+"{0,5}"+f)+"?\\:\\:"+f),E=n(n(n(f+"\\:")+"{0,6}"+f)+"?\\:\\:"),_=n([y,w,b,A,C,v,T,S,E].join("|")),x=n(n(u+"|"+o)+"+"),P=(n(_+"\\%25"+x),n(_+n("\\%25|\\%(?!"+i+"{2})")+x)),$=n("[vV]"+i+"+\\."+t(u,a,"[\\:]")+"+"),N=n("\\["+n(P+"|"+_+"|"+$)+"\\]"),M=n(n(o+"|"+t(u,a))+"*"),L=n(N+"|"+p+"(?!"+M+")|"+M),I=n(r+"*"),R=n(n(d+"@")+"?"+L+n("\\:"+I)+"?"),O=n(o+"|"+t(u,a,"[\\:\\@]")),F=n(O+"*"),k=n(O+"+"),G=n(n(o+"|"+t(u,a,"[\\@]"))+"+"),D=n(n("\\/"+F)+"*"),B=n("\\/"+n(k+D)+"?"),H=n(G+D),W=n(k+D),V="(?!"+O+")",U=(n(D+"|"+B+"|"+H+"|"+W+"|"+V),n(n(O+"|"+t("[\\/\\?]",c))+"*")),Y=n(n(O+"|[\\/\\?]")+"*"),j=n(n("\\/\\/"+R+D)+"|"+B+"|"+W+"|"+V),K=n(h+"\\:"+j+n("\\?"+U)+"?"+n("\\#"+Y)+"?"),q=n(n("\\/\\/"+R+D)+"|"+B+"|"+H+"|"+V),Z=n(q+n("\\?"+U)+"?"+n("\\#"+Y)+"?");return n(K+"|"+Z),n(h+"\\:"+j+n("\\?"+U)+"?"),n(n("\\/\\/("+n("("+d+")@")+"?("+L+")"+n("\\:("+I+")")+"?)")+"?("+D+"|"+B+"|"+W+"|"+V+")"),n("\\?("+U+")"),n("\\#("+Y+")"),n(n("\\/\\/("+n("("+d+")@")+"?("+L+")"+n("\\:("+I+")")+"?)")+"?("+D+"|"+B+"|"+H+"|"+V+")"),n("\\?("+U+")"),n("\\#("+Y+")"),n(n("\\/\\/("+n("("+d+")@")+"?("+L+")"+n("\\:("+I+")")+"?)")+"?("+D+"|"+B+"|"+W+"|"+V+")"),n("\\?("+U+")"),n("\\#("+Y+")"),n("("+d+")@"),n("\\:("+I+")"),{NOT_SCHEME:new RegExp(t("[^]",s,r,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(t("[^\\%\\:]",u,a),"g"),NOT_HOST:new RegExp(t("[^\\%\\[\\]\\:]",u,a),"g"),NOT_PATH:new RegExp(t("[^\\%\\/\\:\\@]",u,a),"g"),NOT_PATH_NOSCHEME:new RegExp(t("[^\\%\\/\\@]",u,a),"g"),NOT_QUERY:new RegExp(t("[^\\%]",u,a,"[\\:\\@\\/\\?]",c),"g"),NOT_FRAGMENT:new RegExp(t("[^\\%]",u,a,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(t("[^]",u,a),"g"),UNRESERVED:new RegExp(u,"g"),OTHER_CHARS:new RegExp(t("[^\\%]",u,l),"g"),PCT_ENCODED:new RegExp(o,"g"),IPV4ADDRESS:new RegExp("^("+p+")$"),IPV6ADDRESS:new RegExp("^\\[?("+_+")"+n(n("\\%25|\\%(?!"+i+"{2})")+"("+x+")")+"?\\]?$")}}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 n=[],s=!0,r=!1,i=void 0;try{for(var o,a=e[Symbol.iterator]();!(s=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);s=!0);}catch(e){r=!0,i=e}finally{try{!s&&a.return&&a.return()}finally{if(r)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},c=2147483647,u=36,h=/^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 n=e.split("@"),s="";return n.length>1&&(s=n[0]+"@",e=n[1]),s+function(e,t){for(var n=[],s=e.length;s--;)n[s]=t(e[s]);return n}((e=e.replace(m,".")).split("."),t).join(".")}function b(e){for(var t=[],n=0,s=e.length;n<s;){var r=e.charCodeAt(n++);if(r>=55296&&r<=56319&&n<s){var i=e.charCodeAt(n++);56320==(64512&i)?t.push(((1023&r)<<10)+(1023&i)+65536):(t.push(r),n--)}else t.push(r)}return t}var A=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},C=function(e,t,n){var s=0;for(e=n?f(e/700):e>>1,e+=f(e/t);e>455;s+=u)e=f(e/35);return f(s+36*e/(e+38))},v=function(e){var t,n=[],s=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"),n.push(e.charCodeAt(l));for(var h=a>0?a+1:0;h<s;){for(var d=r,m=1,p=u;;p+=u){h>=s&&y("invalid-input");var g=(t=e.charCodeAt(h++))-48<10?t-22:t-65<26?t-65:t-97<26?t-97:u;(g>=u||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=u-w;m>f(c/b)&&y("overflow"),m*=b}var A=n.length+1;o=C(r-d,A,0==d),f(r/A)>c-i&&y("overflow"),i+=f(r/A),r%=A,n.splice(r++,0,i)}return String.fromCodePoint.apply(String,n)},T=function(e){var t=[],n=(e=b(e)).length,s=128,r=0,i=72,o=!0,a=!1,l=void 0;try{for(var h,d=e[Symbol.iterator]();!(o=(h=d.next()).done);o=!0){var m=h.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<n;){var v=c,T=!0,S=!1,E=void 0;try{for(var _,x=e[Symbol.iterator]();!(T=(_=x.next()).done);T=!0){var P=_.value;P>=s&&P<v&&(v=P)}}catch(e){S=!0,E=e}finally{try{!T&&x.return&&x.return()}finally{if(S)throw E}}var $=w+1;v-s>f((c-r)/$)&&y("overflow"),r+=(v-s)*$,s=v;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<s&&++r>c&&y("overflow"),O==s){for(var F=r,k=u;;k+=u){var G=k<=i?1:k>=i+26?26:k-i;if(F<G)break;var D=F-G,B=u-G;t.push(g(A(G+D%B,0))),F=f(D/B)}t.push(g(A(F,0))),i=C(r,$,w==p),r=0,++w}}}catch(e){M=!0,L=e}finally{try{!N&&R.return&&R.return()}finally{if(M)throw L}}++r,++s}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,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(e))}},decode:v,encode:T,toASCII:function(e){return w(e,(function(e){return d.test(e)?"xn--"+T(e):e}))},toUnicode:function(e){return w(e,(function(e){return h.test(e)?v(e.slice(4).toLowerCase()):e}))}},E={};function _(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 x(e){for(var t="",n=0,s=e.length;n<s;){var r=parseInt(e.substr(n+1,2),16);if(r<128)t+=String.fromCharCode(r),n+=3;else if(r>=194&&r<224){if(s-n>=6){var i=parseInt(e.substr(n+4,2),16);t+=String.fromCharCode((31&r)<<6|63&i)}else t+=e.substr(n,6);n+=6}else if(r>=224){if(s-n>=9){var o=parseInt(e.substr(n+4,2),16),a=parseInt(e.substr(n+7,2),16);t+=String.fromCharCode((15&r)<<12|(63&o)<<6|63&a)}else t+=e.substr(n,9);n+=9}else t+=e.substr(n,3),n+=3}return t}function P(e,t){function n(e){var n=x(e);return n.match(t.UNRESERVED)?n:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,n).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,n).replace(t.NOT_USERINFO,_).replace(t.PCT_ENCODED,r)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,n).toLowerCase().replace(t.NOT_HOST,_).replace(t.PCT_ENCODED,r)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,n).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,_).replace(t.PCT_ENCODED,r)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,n).replace(t.NOT_QUERY,_).replace(t.PCT_ENCODED,r)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,n).replace(t.NOT_FRAGMENT,_).replace(t.PCT_ENCODED,r)),e}function $(e){return e.replace(/^0*(.*)/,"$1")||"0"}function N(e,t){var n=e.match(t.IPV4ADDRESS)||[],s=l(n,2)[1];return s?s.split(".").map($).join("."):e}function M(e,t){var n=e.match(t.IPV6ADDRESS)||[],s=l(n,3),r=s[1],i=s[2];if(r){for(var o=r.toLowerCase().split("::").reverse(),a=l(o,2),c=a[0],u=a[1],h=u?u.split(":").map($):[],d=c.split(":").map($),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]=h[y]||d[f+y]||"";m&&(g[p-1]=N(g[p-1],t));var w=g.reduce((function(e,t,n){if(!t||"0"===t){var s=e[e.length-1];s&&s.index+s.length===n?s.length++:e.push({index:n,length:1})}return e}),[]).sort((function(e,t){return t.length-e.length}))[0],b=void 0;if(w&&w.length>1){var A=g.slice(0,w.index),C=g.slice(w.index+w.length);b=A.join(":")+"::"+C.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]:{},n={},s=!1!==t.iri?a:o;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var r=e.match(L);if(r){I?(n.scheme=r[1],n.userinfo=r[3],n.host=r[4],n.port=parseInt(r[5],10),n.path=r[6]||"",n.query=r[7],n.fragment=r[8],isNaN(n.port)&&(n.port=r[5])):(n.scheme=r[1]||void 0,n.userinfo=-1!==e.indexOf("@")?r[3]:void 0,n.host=-1!==e.indexOf("//")?r[4]:void 0,n.port=parseInt(r[5],10),n.path=r[6]||"",n.query=-1!==e.indexOf("?")?r[7]:void 0,n.fragment=-1!==e.indexOf("#")?r[8]:void 0,isNaN(n.port)&&(n.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?r[4]:void 0)),n.host&&(n.host=M(N(n.host,s),s)),void 0!==n.scheme||void 0!==n.userinfo||void 0!==n.host||void 0!==n.port||n.path||void 0!==n.query?void 0===n.scheme?n.reference="relative":void 0===n.fragment?n.reference="absolute":n.reference="uri":n.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==n.reference&&(n.error=n.error||"URI is not a "+t.reference+" reference.");var i=E[(t.scheme||n.scheme||"").toLowerCase()];if(t.unicodeSupport||i&&i.unicodeSupport)P(n,s);else{if(n.host&&(t.domainHost||i&&i.domainHost))try{n.host=S.toASCII(n.host.replace(s.PCT_ENCODED,x).toLowerCase())}catch(e){n.error=n.error||"Host's domain name can not be converted to ASCII via punycode: "+e}P(n,o)}i&&i.parse&&i.parse(n,t)}else n.error=n.error||"URI can not be parsed.";return n}var O=/^\.\.?\//,F=/^\/\.(\/|$)/,k=/^\/\.\.(\/|$)/,G=/^\/?(?:.|\n)*?(?=\/|$)/;function D(e){for(var t=[];e.length;)if(e.match(O))e=e.replace(O,"");else if(e.match(F))e=e.replace(F,"/");else if(e.match(k))e=e.replace(k,"/"),t.pop();else if("."===e||".."===e)e="";else{var n=e.match(G);if(!n)throw new Error("Unexpected dot segment condition");var s=n[0];e=e.slice(s.length),t.push(s)}return t.join("")}function B(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.iri?a:o,s=[],r=E[(t.scheme||e.scheme||"").toLowerCase()];if(r&&r.serialize&&r.serialize(e,t),e.host)if(n.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(n.PCT_ENCODED,x).toLowerCase())}catch(n){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+n}P(e,n),"suffix"!==t.reference&&e.scheme&&(s.push(e.scheme),s.push(":"));var i=function(e,t){var n=!1!==t.iri?a:o,s=[];return void 0!==e.userinfo&&(s.push(e.userinfo),s.push("@")),void 0!==e.host&&s.push(M(N(String(e.host),n),n).replace(n.IPV6ADDRESS,(function(e,t,n){return"["+t+(n?"%25"+n:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(s.push(":"),s.push(String(e.port))),s.length?s.join(""):void 0}(e,t);if(void 0!==i&&("suffix"!==t.reference&&s.push("//"),s.push(i),e.path&&"/"!==e.path.charAt(0)&&s.push("/")),void 0!==e.path){var l=e.path;t.absolutePath||r&&r.absolutePath||(l=D(l)),void 0===i&&(l=l.replace(/^\/\//,"/%2F")),s.push(l)}return void 0!==e.query&&(s.push("?"),s.push(e.query)),void 0!==e.fragment&&(s.push("#"),s.push(e.fragment)),s.join("")}function H(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s={};return arguments[3]||(e=R(B(e,n),n),t=R(B(t,n),n)),!(n=n||{}).tolerant&&t.scheme?(s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=D(t.path||""),s.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=D(t.path||""),s.query=t.query):(t.path?("/"===t.path.charAt(0)?s.path=D(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:s.path=t.path:s.path="/"+t.path,s.path=D(s.path)),s.query=t.query):(s.path=e.path,void 0!==t.query?s.query=t.query:s.query=e.query),s.userinfo=e.userinfo,s.host=e.host,s.port=e.port),s.scheme=e.scheme),s.fragment=t.fragment,s}function W(e,t){return e&&e.toString().replace(t&&t.iri?a.PCT_ENCODED:o.PCT_ENCODED,x)}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 n="https"===String(e.scheme).toLowerCase();return e.port!==(n?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 Y(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var j={scheme:"ws",domainHost:!0,parse:function(e,t){var n=e;return n.secure=Y(n),n.resourceName=(n.path||"/")+(n.query?"?"+n.query:""),n.path=void 0,n.query=void 0,n},serialize:function(e,t){if(e.port!==(Y(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 n=e.resourceName.split("?"),s=l(n,2),r=s[0],i=s[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:j.domainHost,parse:j.parse,serialize:j.serialize},q={},Z="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",z="[0-9A-Fa-f]",X=n(n("%[EFef]"+z+"%"+z+z+"%"+z+z)+"|"+n("%[89A-Fa-f]"+z+"%"+z+z)+"|"+n("%"+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"),ne=new RegExp(t("[^]",Z,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),se=ne;function re(e){var t=x(e);return t.match(Q)?t:e}var ie={scheme:"mailto",parse:function(e,t){var n=e,s=n.to=n.path?n.path.split(","):[];if(n.path=void 0,n.query){for(var r=!1,i={},o=n.query.split("&"),a=0,l=o.length;a<l;++a){var c=o[a].split("=");switch(c[0]){case"to":for(var u=c[1].split(","),h=0,d=u.length;h<d;++h)s.push(u[h]);break;case"subject":n.subject=W(c[1],t);break;case"body":n.body=W(c[1],t);break;default:r=!0,i[W(c[0],t)]=W(c[1],t)}}r&&(n.headers=i)}n.query=void 0;for(var m=0,p=s.length;m<p;++m){var f=s[m].split("@");if(f[0]=W(f[0]),t.unicodeSupport)f[1]=W(f[1],t).toLowerCase();else try{f[1]=S.toASCII(W(f[1],t).toLowerCase())}catch(e){n.error=n.error||"Email address's domain name can not be converted to ASCII via punycode: "+e}s[m]=f.join("@")}return n},serialize:function(e,t){var n,s=e,i=null!=(n=e.to)?n instanceof Array?n:"number"!=typeof n.length||n.split||n.setInterval||n.call?[n]:Array.prototype.slice.call(n):[];if(i){for(var o=0,a=i.length;o<a;++o){var l=String(i[o]),c=l.lastIndexOf("@"),u=l.slice(0,c).replace(ee,re).replace(ee,r).replace(te,_),h=l.slice(c+1);try{h=t.iri?S.toUnicode(h):S.toASCII(W(h,t).toLowerCase())}catch(e){s.error=s.error||"Email address's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+e}i[o]=u+"@"+h}s.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(ne,_)+"="+d[p].replace(ee,re).replace(ee,r).replace(se,_));return m.length&&(s.query=m.join("&")),s}},oe=/^([^\:]+)\:(.*)/,ae={scheme:"urn",parse:function(e,t){var n=e.path&&e.path.match(oe),s=e;if(n){var r=t.scheme||s.scheme||"urn",i=n[1].toLowerCase(),o=n[2],a=r+":"+(t.nid||i),l=E[a];s.nid=i,s.nss=o,s.path=void 0,l&&(s=l.parse(s,t))}else s.error=s.error||"URN can not be parsed.";return s},serialize:function(e,t){var n=t.scheme||e.scheme||"urn",s=e.nid,r=n+":"+(t.nid||s),i=E[r];i&&(e=i.serialize(e,t));var o=e,a=e.nss;return o.path=(s||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 n=e;return n.uuid=n.nss,n.nss=void 0,t.tolerant||n.uuid&&n.uuid.match(le)||(n.error=n.error||"UUID is not valid."),n},serialize:function(e,t){var n=e;return n.nss=(e.uuid||"").toLowerCase(),n}};E[V.scheme]=V,E[U.scheme]=U,E[j.scheme]=j,E[K.scheme]=K,E[ie.scheme]=ie,E[ae.scheme]=ae,E[ce.scheme]=ce,e.SCHEMES=E,e.pctEncChar=_,e.pctDecChars=x,e.parse=R,e.removeDotSegments=D,e.serialize=B,e.resolveComponents=H,e.resolve=function(e,t,n){var s=function(e,t){var n=e;if(t)for(var s in t)n[s]=t[s];return n}({scheme:"null"},n);return B(H(R(e,s),R(t,s),s,!0),s)},e.normalize=function(e,t){return"string"==typeof e?e=B(R(e,t),t):"object"===s(e)&&(e=R(B(e,t),t)),e},e.equal=function(e,t,n){return"string"==typeof e?e=B(R(e,n),n):"object"===s(e)&&(e=B(e,n)),"string"==typeof t?t=B(R(t,n),n):"object"===s(t)&&(t=B(t,n)),e===t},e.escapeComponent=function(e,t){return e&&e.toString().replace(t&&t.iri?a.ESCAPE:o.ESCAPE,_)},e.unescapeComponent=W,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 n(s){var r=t[s];if(void 0!==r)return r.exports;var i=t[s]={id:s,loaded:!1,exports:{}};return e[s].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.m=e,n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.u=e=>e+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.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),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var s=t.getElementsByTagName("script");if(s.length)for(var r=s.length-1;r>-1&&!e;)e=s[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),n.b=document.baseURI||self.location.href,n.nc=void 0;var s={};(()=>{"use strict";n.r(s),n.d(s,{_package:()=>ve,test:()=>Te,tests:()=>t.QK});var e=n(976),t=n(2997);(0,t.W3)("_first",(()=>{(0,t.Bu)("_first",(async()=>{}))}));var r=n(2012),i=n(9976),o=n(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,n=r.f.RasMol,s=r.f.GrokGroups;(0,t.l_)(e instanceof i.B,!0),(0,t.l_)(n instanceof i.B,!0),(0,t.l_)(s instanceof i.B,!0),(0,t.l_)(e instanceof r.f,!0),(0,t.l_)(n instanceof r.f,!0),(0,t.l_)(s instanceof r.f,!0)}()})),(0,t.Bu)("testPalettePtMe",(async()=>{const e=r.f.GrokGroups.get("MeNle"),n=r.f.GrokGroups.get("MeA"),s=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_)(n,a),(0,t.l_)(s,l),(0,t.l_)(i,c)}))}));var a=n(4469),l=n(7422),c=n(8447),u=n(8607);class h{constructor(e,t,n,s,r,i){this.units=e,this.aligned=t,this.alphabet=n,this.alphabetSize=s,this.alphabetIsMultichar=r,this.separator=i}}async function d(t){const n=e.Column.fromList(e.TYPE.STRING,"col1",t);if(await a.functions.call("Bio:detectMacromolecule",{col:n}),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(t,n){const s=(await t()).getCol(n),r=await a.functions.call("Bio:detectMacromolecule",{col:s});if(r&&(s.semType=r),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 p(n,s,r,i,o,l,c=null){const h=e.Column.fromList(e.TYPE.STRING,"seq",n),d=await a.functions.call("Bio:detectMacromolecule",{col:h});d&&(h.semType=d),(0,t.l_)(h.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(h.getTag(e.TAGS.UNITS),s),(0,t.l_)(h.getTag("aligned"),r),(0,t.l_)(h.getTag("alphabet"),i),c&&(0,t.l_)(h.getTag("separator"),c);const m=u.g.forColumn(h);(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 f(n,s,r,i,o,l,c,h=null){const d=(await n()).col(s),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),h&&(0,t.l_)(d.getTag("separator"),h);const p=u.g.forColumn(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))}async function g(e,t){const n=await e(),s=[];for(const r of n.columns.names())if(r in t){const n=t[r];try{await f(e,r,n.units,n.aligned,n.alphabet,n.alphabetSize,n.alphabetIsMultichar,n.separator)}catch(e){const t=e.toString();s.push(`Positive col '${r}' failed: ${t}`)}}else try{await m(e,r)}catch(e){const t=e.toString();s.push(`Negative col '${r}' failed: ${t}`)}if(s.length>0)throw new Error(s.join("\n"))}(0,t.W3)("detectors",(()=>{var n,s,r,i,o,l,u,y,w,b,A,C,v,T,S;const E={negEmpty:{csv:"id,col1\n1,\n2,\n3,\n4,\n5,",neg:["col1"]},negNum1:{csv:"col1\n1\n2\n3",neg:["col1"]},negNum2:{csv:"col1\n4\n5\n6\n7",neg:["col1"]},negNum3:{csv:"col1\n8\n9\n10\n11\n12",neg:["col1"]},negSmiles:{csv:"col1\nCCCCN1C(=O)CN=C(c2cc(F)ccc12)C3CCCCC3\nC1CCCCC1\nCCCCCC",neg:["col1"]},fastaMsaSameLength:{csv:"seq\nFWPHEYFWPHEYYV\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",pos:{seq:new h(c.r2.FASTA,"SEQ.MSA","PT",20,!1,void 0)}},fastaExtSameLength:{csv:"seq\nFW[Ac]PHEYFWPH\nYN[Re]VYNRQWYV\n[Me]EYVMPS[Et]",pos:{seq:new h(c.r2.FASTA,"SEQ","UN",16,!0,void 0)}},fastaMsaExtSameLength:{csv:"seq\nFW[Ac]PHEY[Re]WPH\nYN[Re]VYNR[Ac]WYV\n[Me]EYVMPSFW[Me]H",pos:{seq:new h(c.r2.FASTA,"SEQ.MSA","UN",14,!0,void 0)}},sepSameLength:{csv:"seq\nAc(1)-A-A-A-A-A-A-A-A-A-A-A-A-A-C(1)-G-NH2\nAc(1)-A-A-A-A-A-A-A-A-A-A-A-A-A-C(1)-G-NH2\nAc(1)-A-A-A-A-A-A-A-A-A-A-A-A-A-C(1)-G-NH2",pos:{seq:new h(c.r2.SEPARATOR,"SEQ.MSA","UN",5,!0,"-")}},sepMsaSameLength:{csv:"seq\nAc(1)-A-A-A-A-A-A-A-A-A-A-A-A-A-C(1)-G-NH2\nAc(1)-A-A(2)-A-A-A-C(2)-A-A-A-A-C(1)-G-NH2\nAc(1)-A-A-A-A-A-A-A-A-A-A-A-A-A-C(1)-G-NH2",pos:{seq:new h(c.r2.SEPARATOR,"SEQ","UN",5,!0,"-")}},helmSameLength:{csv:"seq\nPEPTIDE1{Ac(1).A.A.A.A.A.A.A.A.A.A.A.A.A.C(1).G.NH2}$$$$\nPEPTIDE1{Ab(1).Y.V.K.H.P.F.W.R.W.Y.A.A.A.C(1).G.NH2}$$$$\nPEPTIDE1{Ad(1).S.W.Y.C.K.H.P.M.W.A.A.A.A.C(1)-G-NH2}$$$$",pos:{seq:new h(c.r2.HELM,null,null,19,void 0,void 0)}}};for(const[n,s]of Object.entries(E))(0,t.Bu)(`csvData2-${n}`,(async()=>{const t=(r=n,async()=>{const t=E[r].csv,n=e.DataFrame.fromCsv(t);return await a.data.detectSemanticTypes(n),n});var r;for(const e of s.neg??[])await m(t,e);for(const[e,n]of Object.entries(s.pos??{}))await f(t,e,n.units,n.aligned,n.alphabet,n.alphabetSize,n.alphabetIsMultichar,n.separator)}));const _=new(S=class{constructor(){this[n]="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",this[s]="seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",this[r]="seq\nFWPHEY\nYNRQWYV\nMKPSEYV",this[i]="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[o]="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[l]="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[u]="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[y]="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[w]="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[b]="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[A]="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[C]="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[v]="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT",this[T]="seq\nFWR-WYV-KHPFWR-WYV-KHP\nYNR-WYV-KHPYNR-WYV-KHP\nMWRSWY-CKHPMWRSWY-CKHP"}},n="csvFastaDna1",s="fastaRna1",r="fastaPt1",i="fastaUn",o="sepDna",l="sepRna",u="sepPt",y="sepUn1",w="sepUn2",b="sepMsaDna1",A="sepMsaUnWEmpty",C="sepComplex",v="fastaMsaDna1",T="fastaMsaPt1",S),x={fastaFasta:"System:AppData/Bio/samples/FASTA.fasta",fastaPtCsv:"System:AppData/Bio/samples/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"},P={};function $(e,t=N){return async()=>(e in P||(P[e]=(async()=>await t(x[e]))().catch((t=>{throw delete P[e],t}))),P[e])}async function N(t){const n=await a.dapi.files.readAsText(t);return e.DataFrame.fromCsv(n)}const M=t=>async()=>{const n=_[t],s=e.DataFrame.fromCsv(n);return await a.data.detectSemanticTypes(s),s};(0,t.Bu)("NegativeStartEnd",(async()=>{await d(["START","END"])})),(0,t.Bu)("NegativeStartEndIntermediate",(async()=>{await d(["START","END","INTERMEDIATE"])})),(0,t.Bu)("FastaDna1",(async()=>{await f(M("csvFastaDna1"),"seq",c.r2.FASTA,"SEQ","DNA",4,!1)})),(0,t.Bu)("FastaRna1",(async()=>{await f(M("fastaRna1"),"seq",c.r2.FASTA,"SEQ","RNA",4,!1)})),(0,t.Bu)("FastaPt1",(async()=>{await f(M("fastaPt1"),"seq",c.r2.FASTA,"SEQ","PT",20,!1)})),(0,t.Bu)("FastaPtGaps",(()=>p(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEYV"],c.r2.FASTA,"SEQ","PT",20,!1))),(0,t.Bu)("FastaPtGapsMsa",(()=>p(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEY"],c.r2.FASTA,"SEQ.MSA","PT",20,!1))),(0,t.Bu)("FastaUn",(async()=>{await f(M("fastaUn"),"seq",c.r2.FASTA,"SEQ.MSA","UN",12,!0)})),(0,t.Bu)("FastaMsaDna1",(async()=>{await f(M("fastaMsaDna1"),"seq",c.r2.FASTA,"SEQ.MSA","DNA",4,!1)})),(0,t.Bu)("FastaMsaPt1",(async()=>{await f(M("fastaMsaPt1"),"seq",c.r2.FASTA,"SEQ.MSA","PT",20,!1)})),(0,t.Bu)("SepDna",(async()=>{await f(M("sepDna"),"seq",c.r2.SEPARATOR,"SEQ","DNA",4,!1,"*")})),(0,t.Bu)("SepRna",(async()=>{await f(M("sepRna"),"seq",c.r2.SEPARATOR,"SEQ","RNA",4,!1,"*")})),(0,t.Bu)("SepPt",(async()=>{await f(M("sepPt"),"seq",c.r2.SEPARATOR,"SEQ","PT",20,!1,"-")})),(0,t.Bu)("SepUn1",(async()=>{await f(M("sepUn1"),"seq",c.r2.SEPARATOR,"SEQ","UN",8,!0,"-")})),(0,t.Bu)("SepUn2",(async()=>{await f(M("sepUn2"),"seq",c.r2.SEPARATOR,"SEQ","UN",9,!0,"/")})),(0,t.Bu)("SepMsaN1",(async()=>{await f(M("sepMsaDna1"),"seq",c.r2.SEPARATOR,"SEQ.MSA","DNA",4,!1,"-")})),(0,t.Bu)("SepMsaUnWEmpty",(async()=>{await f(M("sepMsaUnWEmpty"),"seq",c.r2.SEPARATOR,"SEQ.MSA","UN",14,!0)})),(0,t.Bu)("SepComplex",(async()=>{await f(M("sepComplex"),"seq",c.r2.SEPARATOR,"SEQ","UN",18,!0)})),(0,t.Bu)("samplesFastaCsv",(async()=>{await g($("fastaCsv"),{Sequence:new h(c.r2.FASTA,"SEQ","PT",20,!1)})})),(0,t.Bu)("samplesFastaFasta",(async()=>{await g($("fastaFasta"),{sequence:new h(c.r2.FASTA,"SEQ","PT",20,!1)})})),(0,t.Bu)("samplesPeptidesComplex",(async()=>{await g($("peptidesComplex"),{})})),(0,t.Bu)("samplesMsaComplex",(async()=>{await g($("msaComplex"),{MSA:new h(c.r2.SEPARATOR,"SEQ.MSA","UN",161,!0,"/")})})),(0,t.Bu)("samplesIdCsv",(async()=>{await g($("testIdCsv"),{})})),(0,t.Bu)("samplesSarSmallCsv",(async()=>{await g($("testSmilesCsv"),{})})),(0,t.Bu)("samplesHelmCsv",(async()=>{await g($("helmCsv"),{HELM:new h(c.r2.HELM,null,null,160,!0)})})),(0,t.Bu)("samplesTestHelmCsv",(async()=>{await g($("testHelmCsv"),{"HELM string":new h(c.r2.HELM,null,null,9,!0)})})),(0,t.Bu)("samplesTestDemogCsv",(async()=>{await g($("testDemogCsv"),{})})),(0,t.Bu)("samplesTestSmiles2Csv",(async()=>{await g($("testSmiles2Csv"),{})})),(0,t.Bu)("samplesTestSmilesShort",(async()=>{await g($("testSmilesShort"),{})})),(0,t.Bu)("samplesTestActivityCliffsNegativeSmiles",(async()=>{await g($("testActivityCliffsCsv"),{})})),(0,t.Bu)("samplesFastaPtCsv",(async()=>{await g($("fastaPtCsv"),{sequence:new h(c.r2.FASTA,"SEQ","PT",20,!1)})})),(0,t.Bu)("samplesTestCerealCsv",(async()=>{await g($("testCerealCsv"),{})})),(0,t.Bu)("samplesTestUnichemSources",(async()=>{await g($("testUnichemSources"),{})})),(0,t.Bu)("samplesTestDmvOffices",(async()=>{await g($("testDmvOffices"),{})})),(0,t.Bu)("samplesTestAlertCollection",(async()=>{await g($("testAlertCollection"),{})})),(0,t.Bu)("samplesTestSpgi",(async()=>{await g($("testSpgi"),{})})),(0,t.Bu)("samplesTestSpgi100",(async()=>{await g($("testSpgi100"),{})})),(0,t.Bu)("samplesTestUrl",(async()=>{await g($("testUrl"),{})}))})),(0,t.W3)("detectors:weak-and-likely",(()=>{const n={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"},s=t=>async()=>{const s=n[t],r=e.DataFrame.fromCsv(s);return await a.data.detectSemanticTypes(r),r};(0,t.Bu)("fastaDnaWeak1",(async()=>{await m(s("fastaDnaWeak1"),"colName")})),(0,t.Bu)("fastaDnaWeak1LikelyName",(async()=>{await f(s("fastaDnaWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA","DNA",4,!1)})),(0,t.Bu)("fastaRnaWeak1",(async()=>{await m(s("fastaRnaWeak1"),"colName")})),(0,t.Bu)("fastaRnaWeak1LikelyName",(async()=>{await f(s("fastaRnaWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA","RNA",4,!1)})),(0,t.Bu)("fastaPtWeak1",(async()=>{await m(s("fastaPtWeak1"),"colName")})),(0,t.Bu)("fastaPtWeak1LikelyName",(async()=>{await f(s("fastaPtWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA","PT",20,!1)})),(0,t.Bu)("fastaUn1",(async()=>{await m(s("fastaUn1"),"colName")})),(0,t.Bu)("fastaUn1LikelyName",(async()=>{await m(s("fastaUn1LikelyName"),"seq")})),(0,t.Bu)("fastaUn2LikelyName",(async()=>{await m(s("fastaUn2LikelyName"),"protein")})),(0,t.Bu)("fastaUnMsa1LikelyName",(async()=>{await m(s("fastaUnMsa1LikelyName"),"seq")}))})),(0,t.W3)("detectorsBenchmark",(()=>{let n;async function s(s,i,o,a,l,h){return await async function(s,d,m,p){const f=await(async()=>{const t=function(t,n,s,r,i){let o;switch(t){case c.r2.FASTA:o=e=>{let t="";for(let n=0;n<e.length;n++){const s=e[n];t+=1==s.length?s:`[${s}]`}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 n=new Array(t);for(let s=0;s<t;s++)n[s]=e[Math.floor(Math.random()*e.length)];return o(n,i)},l=Array(r);for(let e=0;e<r;e++)l[e]=a(n,s);return e.Column.fromStrings("seq",l)}(i,[...(0,c.gM)(o)],a,l,h),s=n.prepare({col:t});return await r(s),s})(),g=Date.now(),y=await(async e=>r(e))(f),w=Date.now();(function(e,n){const s=u.g.forColumn(e);(0,t.l_)(e.semType===n.semType,!0),(0,t.l_)(s.notation===n.notation,!0),(0,t.l_)(s.alphabet===n.alphabet,!0),(0,t.l_)(s.separator===n.separator,!0)})(y,{semType:e.SEMTYPE.MACROMOLECULE,notation:i,alphabet:o,separator:h});const b=w-g;if(b>s){const e=`ET ${b} ms is more than max allowed ${s} ms.`;throw console.error(e),new Error(e)}return console.log(`ET ${b} ms is OK.`),b}(s)}async function r(e){await e.call();const t=e.getOutputParamValue(),n=e.inputs.col;return t&&(n.semType=t),n}(0,t.bb)((async()=>{const t=e.Func.find({package:"Bio",name:"detectMacromolecule"});n=t[0];const s=e.Column.fromStrings("seq",["ACGT","ACGT","ACGT"]);await n.prepare({col:s}).call()})),(0,t.Bu)("fastaDnaShorts50Few50",(async()=>{await s(10,c.r2.FASTA,"DNA",50,50)})),(0,t.Bu)("fastaDnaShorts50Many1E6",(async()=>{await s(20,c.r2.FASTA,"DNA",50,1e6)})),(0,t.Bu)("fastaDnaLong1e6Few50",(async()=>{await s(20,c.r2.FASTA,"DNA",1e6,50)})),(0,t.Bu)("separatorDnaShorts50Few50",(async()=>{await s(10,c.r2.SEPARATOR,"DNA",50,50,"/")})),(0,t.Bu)("separatorDnaShorts50Many1E6",(async()=>{await s(20,c.r2.SEPARATOR,"DNA",50,1e6,"/")})),(0,t.Bu)("separatorDnaLong1e6Few50",(async()=>{await s(20,c.r2.SEPARATOR,"DNA",1e6,50,"/")}))}));var y=n(6098),w=n(525),b=n(6032);async function A(n,s){const r=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(r);const i=e.DataFrame.fromCsv(s),o=r.getCol("seq");(0,t.l_)(o.semType,e.SEMTYPE.MACROMOLECULE);const l=i.getCol("seq"),c=await(0,y.U)(o,!0);(0,t.f6)(c.toList(),l.toList())}async function C(n,s,r,i,o,l){const c=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(c);const u=e.DataFrame.fromCsv(s).getCol("seq"),h=c.getCol("seq");(0,t.l_)(h.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(h.getTag(e.TAGS.UNITS),r),o&&(0,t.l_)(h.getTag("alphabet"),o);const d=await(0,w.K)({col:h,pepsea:{method:l}});(0,t.l_)(d.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(d.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(d.getTag(e.TAGS.UNITS),i),(0,t.l_)(d.getTag("aligned"),"SEQ.MSA"),o&&(0,t.l_)(d.getTag("alphabet"),o),(0,t.f6)(d.toList(),u.toList())}(0,t.W3)("MSA",(async()=>{(0,t.Bu)("isCorrect",(async()=>{await A("seq\nFWRWYVKHP\nYNRWYVKHP\nMWRSWYCKHP","seq\nFWR-WYVKHP\nYNR-WYVKHP\nMWRSWYCKHP")})),(0,t.Bu)("isCorrectLong",(async()=>{await A("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(0,b.Ns)(),await C("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(0,b.Ns)(),await C("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 C("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 C("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 v=n(6414),T=n.n(v),S=n(9416),E=n(9713);async function _(t){const n=await async function(e){return await ve.files.readAsText(e)}(t),s=e.DataFrame.fromCsv(n);return s.name=t.replace(".csv",""),s}async function x(e,n=5e3){await(0,t.gw)(0),await(0,t.zg)(e.onAfterDrawContent,(()=>{}),(()=>{e.invalidate()}),n);const s=e.columns.length;for(let t=0;t<s;++t){const n=e.columns.byIndex(t);if(n){const t=e.cell(n.name,0),[s,o,a]=(0,E.N)(t),l=(void 0,(i=r=a.rendererBack)&&void 0!==i.onRendered&&void 0!==i.invalidate&&void 0!==i.awaitRendered?r:null);l&&await l.awaitRendered()}}var r,i}var P=n(3553),$=n(8260);async function N(e,n){const s=(0,c.kB)(e);console.debug(`Bio: tests: splitters: src=${JSON.stringify(e)}, res=${JSON.stringify(s)} .`),(0,t.f6)(T()(s.originals).toArray(),n)}async function M(e,n){const s=(0,$.gP)(e);console.debug(`Bio: tests: splitters: src=${JSON.stringify(e)}, res=${JSON.stringify(s)} .`),(0,t.f6)(T()(s.originals).toArray(),n)}(0,t.W3)("splitters",(async()=>{(0,t.bb)((async()=>{})),(0,t.X5)((async()=>{}));const n=["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"]],s=["[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)"]],u=["RNA1{P.R(U)P.R(T)}$$$$",["P","R(U)P","R(T)"]],h=["RNA1{P.R(U).P.R(T)}$$$$",["P","R(U)","P","R(T)"]];(0,t.Bu)("fastaMulti",(async()=>{await N(n[0],n[1])})),(0,t.Bu)("fastaFromHelm",(async()=>{await N(s[0],s[1])})),(0,t.Bu)("helm1",(async()=>{await M(r[0],r[1])})),(0,t.Bu)("helm2",(async()=>{await M(i[0],i[1])})),(0,t.Bu)("helm3-multichar",(async()=>{await M(o[0],o[1])})),(0,t.Bu)("testHelm1",(async()=>{await M(c[0],c[1])})),(0,t.Bu)("testHelm2",(async()=>{await M(u[0],u[1])})),(0,t.Bu)("testHelm3",(async()=>{await M(h[0],h[1])})),(0,t.Bu)("splitToMonomers",(async()=>{const e=await a.dapi.files.readCsv("System:AppData/Bio/samples/MSA.csv"),n=e.getCol("MSA"),s=await a.functions.call("Bio:detectMacromolecule",{col:n});s&&(n.semType=s),n.setTag("aligned",P.mU);const r=await(0,S.n)(e,n);(0,t.l_)(r.columns.names().includes("17"),!0),await a.data.detectSemanticTypes(r);const i=a.shell.addTableView(r);await x(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 n=["hHis","Aca","Cys_SEt","N","T"],s=t.getCol("HELM"),r=(0,l.getHelmMonomers)(s),i=n.filter((e=>!r.includes(e))),o=r.filter((e=>!n.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 L=n(7228),I=n(6584);(0,t.W3)("monomerLibraries",(()=>{let e,n=null;(0,t.bb)((async()=>{e=await(0,L.JN)(),n=(0,I.nW)()})),(0,t.X5)((async()=>{await(0,I.tW)(n)})),(0,t.Bu)("default",(async()=>{await(0,I.tW)({exclude:[],explicit:[]}),await e.loadLibraries(!0);const n=e.getBioLib();(0,t.l_)(n.getPolymerTypes().length>0,!0)})),(0,t.Bu)("forTests",(async()=>{await(0,I.tb)(),await e.loadLibraries(!0);const n=e.getBioLib();(0,t.l_)(n.getPolymerTypes().length,2),(0,t.l_)(n.getMonomerSymbolsByType("PEPTIDE").length,322),(0,t.l_)(n.getMonomerSymbolsByType("RNA").length,383)})),(0,t.Bu)("empty",(async()=>{const n=await(0,I.nW)(),s=await e.getFileManager();let r=s.getValidLibraryPaths();0===r.length&&(r=await s.getValidLibraryPathsAsynchronously()),n.exclude=r,n.explicit=[],await(0,I.tW)(n),await e.loadLibraries(!0);const i=e.getBioLib().getPolymerTypes();(0,t.l_)(0===i.length,!0)}))}));var R=n(3870),O=n(3336),F=n.n(O),k=n(701),G=n(706),D=n(4004);async function B(n,s){const r=n(),i=e.DataFrame.fromColumns(r);await a.data.detectSemanticTypes(i);const o=Date.now(),l=(i.columns.byName("MSA"),a.shell.addTableView(i));await x(l.grid),(0,t.l_)(l.grid.dataFrame.id,i.id);const c=Date.now()-o;console.log(`Performance test: ${s}: ${c}ms`)}(0,t.W3)("renderers",(()=>{(0,t.Bu)("long sequence performance ",(async()=>{await B(G.io,"Long sequences")})),(0,t.Bu)("many sequence performance",(async()=>{await B(G.Ug,"Many sequences")})),(0,t.Bu)("rendererMacromoleculeFasta",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA.csv"),s=e.DataFrame.fromCsv(n),r=s.getCol("Sequence"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});i&&(r.semType=i);const o=a.shell.addTableView(s);await a.data.detectSemanticTypes(s),await x(o.grid),(0,t.l_)(o.grid.dataFrame.id,s.id);const l=r.getTag(e.TAGS.CELL_RENDERER);(0,t.l_)(l,"sequence")}()})),(0,t.Bu)("rendererMacromoleculeSeparator",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/SEPARATOR_PT.csv"),s=e.DataFrame.fromCsv(n),r=s.getCol("sequence"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});i&&(r.semType=i);const o=a.shell.addTableView(s);await a.data.detectSemanticTypes(s),await x(o.grid),(0,t.l_)(o.grid.dataFrame.id,s.id);const l=r.getTag(e.TAGS.CELL_RENDERER);(0,t.l_)(l,"sequence")}()})),(0,t.Bu)("rendererMacromoleculeDifference",(async()=>{await async function(){const n=e.Column.fromStrings("SequencesDiff",["meI/hHis/Aca/N/T/dK/Thr_PO3H2/Aca#D-Tyr_Et/Tyr_ab-dehydroMe/meN/E/N/dV"]);n.setTag(e.TAGS.UNITS,c.r2.SEPARATOR),n.setTag("separator","/"),n.setTag("aligned","SEQ"),n.setTag("alphabet","UN"),n.setTag(".alphabetIsMultichar","true"),n.semType=P.Of.MACROMOLECULE_DIFFERENCE;const s=e.DataFrame.fromColumns([n]),r=a.shell.addTableView(s);await a.data.detectSemanticTypes(s),await x(r.grid),(0,t.l_)(r.grid.dataFrame.id,s.id);const i=n.getTag(e.TAGS.CELL_RENDERER);(0,t.l_)(i,P.Of.MACROMOLECULE_DIFFERENCE)}()})),(0,t.Bu)("afterMsa",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA.fasta"),s=(0,l.importFasta)(n)[0],r=s.getCol("sequence"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});i&&(r.semType=i);const o=a.shell.addTableView(s);await a.data.detectSemanticTypes(s),console.log("Bio: tests/renderers/afterMsa, table view"),await x(o.grid),(0,t.l_)(o.grid.dataFrame.id,s.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 h=await(0,w.K)({col:r});await x(o.grid),(0,t.l_)(o.grid.dataFrame.id,s.id),(0,t.l_)(h.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(h.getTag(e.TAGS.UNITS),c.r2.FASTA),(0,t.l_)(h.getTag("aligned"),"SEQ.MSA"),(0,t.l_)(h.getTag("alphabet"),"PT"),(0,t.l_)(h.getTag(e.TAGS.CELL_RENDERER),"sequence"),u.g.forColumn(h)}()})),(0,t.Bu)("afterConvert",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA_PT.csv"),s=e.DataFrame.fromCsv(n),r=s.col("sequence"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});i&&(r.semType=i);const o=a.shell.addTableView(s);await a.data.detectSemanticTypes(s);const l=await(0,D.o)(r,c.r2.SEPARATOR,"/");await x(o.grid),(0,t.l_)(o.grid.dataFrame.id,s.id);const h=l.getTag(e.TAGS.CELL_RENDERER);(0,t.l_)(h,"sequence"),u.g.forColumn(l)}()})),(0,t.Bu)("selectRendererBySemType",(async()=>{await async function(){const n=e.Column.fromStrings("SequencesDiff",["meI/hHis/Aca/N/T/dK/Thr_PO3H2/Aca#D-Tyr_Et/Tyr_ab-dehydroMe/meN/E/N/dV"]);n.setTag(e.TAGS.UNITS,c.r2.SEPARATOR),n.setTag("separator","/"),n.setTag("aligned","SEQ"),n.setTag("alphabet","UN"),n.setTag(".alphabetIsMultichar","true"),n.semType=P.Of.MACROMOLECULE_DIFFERENCE;const s=e.DataFrame.fromColumns([n]);a.shell.addTableView(s),await(0,t.gw)(100);const r=n.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'.`)}()})),(0,t.Bu)("scatterPlotTooltip",(async()=>{await async function(){const s=e.DataFrame.fromCsv(n);s.currentRowIdx=0;const r=a.shell.addTableView(s),i=s.plot.scatter({x:"x",y:"y"});r.dockManager.dock(i,e.DOCK_TYPE.RIGHT,null),await Promise.all([(0,t.zg)(i.onAfterDrawScene,(()=>{}),(()=>{i.invalidateCanvas()}),1e3),x(r.grid,500)]);const o=i.root.getBoundingClientRect(),l=i.worldToScreen(1,0),c=new MouseEvent("mousemove",{cancelable:!0,bubbles:!0,view:window,button:0,clientX:o.left+l.x,clientY:o.top+l.y}),u=F()(i.root).find("canvas").get()[0];await(0,t.zg)((0,k.fromEvent)(u,"mousemove"),(()=>{ve.logger.debug(`Test: event, currentRowIdx=${s.currentRowIdx}`),(0,t.l_)(F()(R.tooltip.root).find("div table.d4-row-tooltip-table tr td canvas").length,1),(0,t.l_)(i.hitTest(l.x,l.y),1)}),(()=>{u.dispatchEvent(c)}),500),await x(r.grid,500)}()}),{skipReason:"GROK-15679"});const n="seq,x,y\nACGGTGTCGT,0,0\nCGGTATCCCT,1,0\nCTCGGCATGC,2,0\n"}));var H=n(9611);(0,t.W3)("renderers: monomerPlacer",(()=>{let n,s;(0,t.bb)((async()=>{n=await(0,L.JN)(),s=await(0,I.nW)(),await(0,I.tb)(),await n.awaitLoaded(),await n.loadLibraries(!0)})),(0,t.X5)((async()=>{await(0,I.tW)(s),await n.loadLibraries(!0)}));const r={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:5}},{src:{row:1,x:200},tgt:{pos:5}},{src:{row:2,x:20},tgt:{pos:null}},{src:{row:3,x:170},tgt:{pos:5}},{src:{row:3,x:200},tgt:{pos:5}},{src:{row:3,x:297},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,s]of Object.entries(r))(0,t.Bu)(`getPosition-${n}`,(async()=>{(await(0,L.JN)()).getBioLib();const t=e.DataFrame.fromCsv(s.csv);await a.data.detectSemanticTypes(t);const n=t.getCol("seq"),r=new H.A(null,n,ve.logger,(()=>({seqHandler:u.g.forColumn(n),monomerCharWidth:7,separatorWidth:12,monomerToShort:c.GU,monomerLengthLimit:3}))),i=s.testList;for(let e=0;e<n.length;++e)r.getCellMonomerLengths(e,1e4);const o=[];for(const[e,t]of T().enumerate(i)){const t={pos:r.getPosition(e.src.row,e.src.x,1e4)};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)("renderers: monomerPlacer",(()=>{const e=[10,20,30,40,50,60],n={left:{x:3,tgt:null},c0left:{x:10,tgt:0},c0mid:{x:12,tgt:0},c0right:{x:19,tgt:0},c1left:{x:20,tgt:1},c2right:{x:39,tgt:2},c4left:{x:50,tgt:4},c4right:{x:59,tgt:4},max:{x:60,tgt:null},right:{x:65,tgt:null}};for(const[s,r]of Object.entries(n))(0,t.Bu)("hitBounds-"+s,(async()=>{const n=(0,H.m)(e,r.x);(0,t.l_)(n,r.tgt)}))})),(0,t.W3)("converters",(()=>{let n;!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"}(n||(n={}));const s={[n.fastaPt]:"seq\nFWPHEYFWPHEY\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",[n.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",[n.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}$$$$",[n.fastaDna]:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",[n.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",[n.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}$$$$",[n.fastaRna]:"seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",[n.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",[n.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}$$$$",[n.fastaGaps]:"seq\nFW-PH-EYYFW-PH-EYY\nFYNRQWYV-FYNRQWYV-\nFKP-Q-SEYVFKP-Q-SEYV",[n.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",[n.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}$$$$",[n.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]",[n.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",[n.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}$$$$",[n.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}$$$$",[n.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}$$$$",[n.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 n=s[t],r=e.DataFrame.fromCsv(n);return await a.data.detectSemanticTypes(r),r}function i(n,s){if(n===c.r2.SEPARATOR&&!s)throw new Error(`Argument 'separator' is mandatory for target notation '${n.toString()}'.`);return function(r){const i=u.g.forColumn(r).convert(n,s);return(0,t.l_)(i.getTag(e.TAGS.UNITS),n),i}}async function o(e,n,s){const i=n((await r(e)).getCol("seq")),o=(await r(s)).getCol("seq");(0,t.f6)(i.toList(),o.toList()),u.g.forColumn(i)}(0,t.Bu)("testFastaPtToSeparator",(async()=>{await o(n.fastaPt,i(c.r2.SEPARATOR,"-"),n.separatorPt)})),(0,t.Bu)("testFastaDnaToSeparator",(async()=>{await o(n.fastaDna,i(c.r2.SEPARATOR,"/"),n.separatorDna)})),(0,t.Bu)("testFastaRnaToSeparator",(async()=>{await o(n.fastaRna,i(c.r2.SEPARATOR,"*"),n.separatorRna)})),(0,t.Bu)("testFastaGapsToSeparator",(async()=>{await o(n.fastaGaps,i(c.r2.SEPARATOR,"/"),n.separatorGaps)})),(0,t.Bu)("testFastaUnToSeparator",(async()=>{await o(n.fastaUn,i(c.r2.SEPARATOR,"-"),n.separatorUn)})),(0,t.Bu)("testFastaPtToHelm",(async()=>{await o(n.fastaPt,i(c.r2.HELM),n.helmPt)})),(0,t.Bu)("testFastaDnaToHelm",(async()=>{await o(n.fastaDna,i(c.r2.HELM),n.helmDna)})),(0,t.Bu)("testFastaRnaToHelm",(async()=>{await o(n.fastaRna,i(c.r2.HELM),n.helmRna)})),(0,t.Bu)("testFastaGapsToHelm",(async()=>{await o(n.fastaGaps,i(c.r2.HELM),n.helmGaps)})),(0,t.Bu)("testSeparatorPtToFasta",(async()=>{await o(n.separatorPt,i(c.r2.FASTA),n.fastaPt)})),(0,t.Bu)("testSeparatorDnaToFasta",(async()=>{await o(n.separatorDna,i(c.r2.FASTA),n.fastaDna)})),(0,t.Bu)("testSeparatorRnaToFasta",(async()=>{await o(n.separatorRna,i(c.r2.FASTA),n.fastaRna)})),(0,t.Bu)("testSeparatorGapsToFasta",(async()=>{await o(n.separatorGaps,i(c.r2.FASTA),n.fastaGaps)})),(0,t.Bu)("testSeparatorUnToFasta",(async()=>{await o(n.separatorUn,i(c.r2.FASTA),n.fastaUn)})),(0,t.Bu)("testSeparatorPtToHelm",(async()=>{await o(n.separatorPt,i(c.r2.HELM),n.helmPt)})),(0,t.Bu)("testSeparatorDnaToHelm",(async()=>{await o(n.separatorDna,i(c.r2.HELM),n.helmDna)})),(0,t.Bu)("testSeparatorRnaToHelm",(async()=>{await o(n.separatorRna,i(c.r2.HELM),n.helmRna)})),(0,t.Bu)("testSeparatorGapsToHelm",(async()=>{await o(n.separatorGaps,i(c.r2.HELM),n.helmGaps)})),(0,t.Bu)("testHelmDnaToFasta",(async()=>{await o(n.helmDna,i(c.r2.FASTA),n.fastaDna)})),(0,t.Bu)("testHelmRnaToFasta",(async()=>{await o(n.helmRna,i(c.r2.FASTA),n.fastaRna)})),(0,t.Bu)("testHelmPtToFasta",(async()=>{await o(n.helmPt,i(c.r2.FASTA),n.fastaPt)})),(0,t.Bu)("testHelmUnToFasta",(async()=>{await o(n.helmUn,i(c.r2.FASTA),n.fastaUn)})),(0,t.Bu)("testHelmDnaToSeparator",(async()=>{await o(n.helmDna,i(c.r2.SEPARATOR,"/"),n.separatorDna)})),(0,t.Bu)("testHelmRnaToSeparator",(async()=>{await o(n.helmRna,i(c.r2.SEPARATOR,"*"),n.separatorRna)})),(0,t.Bu)("testHelmPtToSeparator",(async()=>{await o(n.helmPt,i(c.r2.SEPARATOR,"-"),n.separatorPt)})),(0,t.Bu)("testHelmUnToSeparator",(async()=>{await o(n.helmUn,i(c.r2.SEPARATOR,"-"),n.separatorUn)})),(0,t.Bu)("testHelmLoneRibose",(async()=>{await o(n.helmLoneRibose,i(c.r2.FASTA),n.fastaRna)})),(0,t.Bu)("testHelmLoneDeoxyribose",(async()=>{await o(n.helmLoneDeoxyribose,i(c.r2.SEPARATOR,"/"),n.separatorDna)})),(0,t.Bu)("testHelmLonePhosphorus",(async()=>{await o(n.helmLonePhosphorus,i(c.r2.FASTA),n.fastaRna)}))}));var W=n(5226);(0,t.W3)("fastaFileHandler",(()=>{const n=["description:1","description:2","description:3","description:4"],s=(e.Column.fromStrings("description",n),["MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW","MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL","MMELVLKTIIGPIVVGVVLRIVDKWLNKDK","MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN"]);function r(e){const r=new W.i(e),i=r.descriptionsArray,o=r.sequencesArray;(0,t.f6)([i,o],[n,s])}(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 V=n(9943);(0,t.W3)("fastaExport",(()=>{let n;!function(e){e.single="single",e.multi="multi"}(n||(n={}));const s={[n.single]:{src:"MDYKETLLMPKTDFPMRGGLP",tgt:["MDYKETLLMP","KTDFPMRGGL","P"]},[n.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(n,r=10){const i=s[n].src,o=e.Column.fromStrings("src",[i]);o.semType=e.SEMTYPE.MACROMOLECULE,o.setTag(e.TAGS.UNITS,c.r2.FASTA);const a=u.g.forColumn(o).getSplitted(0),l=(0,V.sK)(a,r),h=s[n].tgt;(0,t.f6)(l,h)}async function a(n){const s=e.DataFrame.fromCsv(n.srcCsv),r=s.getCol(n.seqCol);r.semType=e.SEMTYPE.MACROMOLECULE,r.setTag(e.TAGS.UNITS,c.r2.FASTA);const i=n.idCols.map((e=>s.getCol(e))),o=(0,V.i$)(i,r,n.lineWidth);(0,t.l_)(o,n.tgtFasta)}(0,t.Bu)("wrapSequenceSingle",(async()=>{o(n.single,10)})),(0,t.Bu)("wrapSequenceMulti",(async()=>{o(n.multi,10)})),(0,t.Bu)("saveAsFastaTest1",(async()=>{a(i[r.test1])})),(0,t.Bu)("saveAsFastaTest2",(async()=>{a(i[r.test2])}))}));var U=n(7331),Y=n(6286);const j=Y.G2;(0,t.W3)("bio",(()=>{const n="seq\nACGTCT\nCAGTGT\nTTCAAC";(0,t.Bu)("testGetStatsHelm1",(async()=>{const n=e.DataFrame.fromCsv("seq\nPEPTIDE1{meI}$$$$").getCol("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.setTag(e.TAGS.UNITS,c.r2.HELM);const s=(0,$.jY)(n,1,c.gP);(0,t.Wh)(s.freq,{meI:1}),(0,t.l_)(s.sameLength,!0)})),(0,t.Bu)("testGetStatsN1",(async()=>{await async function(n){const s=e.DataFrame.fromCsv(n).col("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.setTag(e.TAGS.UNITS,c.r2.FASTA);const r=(0,$.jY)(s,5,c.kB);(0,t.Wh)(r.freq,{A:4,C:5,G:3,T:6}),(0,t.l_)(r.sameLength,!0)}(n)})),(0,t.Bu)("testGetAlphabetSimilarity",(async()=>{await async function(){const e={A:2041,C:3015,G:3015,T:2048,[j]:1e3},n=new Set(Object.keys(o.V.Names)),s=(0,c.KX)(e,n);(0,t.l_)(s>.6,!0)}()})),(0,t.Bu)("testPickupPaletteN1",(async()=>{await async function(n){const s=e.DataFrame.fromCsv(n).col("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.setTag(e.TAGS.UNITS,c.r2.FASTA);const r=(0,c.dQ)(s);(0,t.l_)(r instanceof o.J,!0)}(n)})),(0,t.Bu)("testPickupPaletteN1e",(async()=>{await async function(n){const s=e.DataFrame.fromCsv("seq\nACGTAT\nCAGTTG\nTTCG2C").col("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.setTag(e.TAGS.UNITS,c.r2.FASTA);const r=(0,c.dQ)(s);(0,t.l_)(r instanceof o.J,!0)}()})),(0,t.Bu)("testPickupPaletteAA1",(async()=>{await async function(n){const s=e.DataFrame.fromCsv("seq\nFWPHEYV\nYNRQWYV\nMKPSEYV").col("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.setTag(e.TAGS.UNITS,c.r2.FASTA);const i=(0,c.dQ)(s);(0,t.l_)(i instanceof r.f,!0)}()})),(0,t.Bu)("testPickupPaletteX",(async()=>{await async function(n){const s=e.DataFrame.fromCsv("seq\nXZJ{}2\n5Z4733\n3Z6></\n675687").col("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.setTag(e.TAGS.UNITS,c.r2.FASTA);const r=(0,c.dQ)(s);(0,t.l_)(r instanceof U.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…"]],n=e.map((e=>e[0])),s=e.map((e=>e[1])),r=n.map((e=>(0,c.GU)(e,3)));(0,t.f6)(r,s)}))}));var K=n(8415);const q=Y.G2;function Z(e,n){(0,t.l_)(e.name,n.name),(0,t.f6)(e.getMonomers(),n.getMonomers());for(const s of e.getMonomers())(0,t.l_)(e.getFreq(s).rowCount,n.getFreq(s).rowCount)}(0,t.W3)("WebLogo-positions",(()=>{const n="seq\nATC-G-TTGC--\nATC-G-TTGC--\n-TC-G-TTGC--\n-TC-GCTTGC--\n-TC-GCTTGC--";(0,t.Bu)("allPositions",(async()=>{const s=e.DataFrame.fromCsv(n),r=a.shell.addTableView(s),i=s.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 s.plot.fromType("WebLogo");await(0,t.zg)(o.onLayoutCalculated,(()=>{}),(()=>{r.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const l=o.positions,u=[new K.CK(0,"1",{A:new K.yW(2),[q]:new K.yW(3)}),new K.CK(1,"2",{T:new K.yW(5)}),new K.CK(2,"3",{C:new K.yW(5)}),new K.CK(3,"4",{[q]:new K.yW(5)}),new K.CK(4,"5",{G:new K.yW(5)}),new K.CK(5,"6",{[q]:new K.yW(3),C:new K.yW(2)}),new K.CK(6,"7",{T:new K.yW(5)}),new K.CK(7,"8",{T:new K.yW(5)}),new K.CK(8,"9",{G:new K.yW(5)}),new K.CK(9,"10",{C:new K.yW(5)}),new K.CK(10,"11",{[q]:new K.yW(5)}),new K.CK(11,"12",{[q]:new K.yW(5)})];(0,t.l_)(l.length,u.length);for(let e=0;e<l.length;e++){(0,t.l_)(l[e].name,u[e].name);for(const n of l[e].getMonomers())(0,t.l_)(l[e].getFreq(n).rowCount,u[e].getFreq(n).rowCount)}await o.awaitRendered()})),(0,t.Bu)("positions with shrinkEmptyTail option true (filtered)",(async()=>{const n=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-"),s=a.shell.addTableView(n),r=n.getCol("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.setTag(e.TAGS.UNITS,c.r2.FASTA),r.setTag("alphabet","DNA"),r.setTag("aligned","SEQ"),n.filter.init((e=>e>2)),n.filter.fireChanged();const i=await n.plot.fromType("WebLogo",{shrinkEmptyTail:!0});await(0,t.zg)(i.onLayoutCalculated,(()=>{}),(()=>{s.dockManager.dock(i.root,e.DOCK_TYPE.DOWN)}),500);const o=i.positions,l=[new K.CK(0,"1",{[q]:new K.yW(3)}),new K.CK(1,"2",{T:new K.yW(3)}),new K.CK(2,"3",{[q]:new K.yW(3)}),new K.CK(3,"4",{[q]:new K.yW(3)}),new K.CK(4,"5",{C:new K.yW(3)}),new K.CK(5,"6",{[q]:new K.yW(2),C:new K.yW(1)}),new K.CK(6,"7",{G:new K.yW(3)}),new K.CK(7,"8",{T:new K.yW(3)}),new K.CK(8,"9",{[q]:new K.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 n of o[e].getMonomers())(0,t.l_)(o[e].getFreq(n).rowCount,l[e].getFreq(n).rowCount)}await i.awaitRendered()})),(0,t.Bu)("positions with skipEmptyPositions option",(async()=>{const s=e.DataFrame.fromCsv(n),r=a.shell.addTableView(s),i=s.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 s.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,u=[new K.CK(0,"1",{A:new K.yW(2),[q]:new K.yW(3)}),new K.CK(1,"2",{T:new K.yW(5)}),new K.CK(2,"3",{C:new K.yW(5)}),new K.CK(4,"5",{G:new K.yW(5)}),new K.CK(5,"6",{[q]:new K.yW(3),C:new K.yW(2)}),new K.CK(6,"7",{T:new K.yW(5)}),new K.CK(7,"8",{T:new K.yW(5)}),new K.CK(8,"9",{G:new K.yW(5)}),new K.CK(9,"10",{C:new K.yW(5)})];(0,t.l_)(l.length,u.length);for(let e=0;e<l.length;e++)Z(l[e],u[e]);await o.awaitRendered()})),(0,t.Bu)("count sequences for monomer at position",(async()=>{const s=function(t,n,s,r){const i=e.DataFrame.fromCsv(t),o=i.getCol("seq");return o.semType=e.SEMTYPE.MACROMOLECULE,o.setTag(e.TAGS.UNITS,n),o.setTag("alphabet","DNA"),o.setTag("aligned","SEQ.MSA"),i}(n,c.r2.FASTA),r=s.getCol("seq"),i=a.shell.addTableView(s),o=await s.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,h=[new K.CK(2,"3",{C:new K.yW(5)}),new K.CK(4,"5",{G:new K.yW(5)}),new K.CK(5,"6",{[q]:new K.yW(3),C:new K.yW(2)}),new K.CK(6,"7",{T:new K.yW(5)})];(0,t.l_)(l.length,h.length);for(let e=0;e<l.length;e++)Z(l[e],h[e]);const d=l[1],m=u.g.forColumn(r),p=(0,K.eZ)(s,m,s.filter,"G",d);(0,t.l_)(p,5),await o.awaitRendered()})),(0,t.Bu)("empty",(async()=>{const n=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})()]),s=a.shell.addTableView(n),r=await n.plot.fromType("WebLogo");await(0,t.zg)(r.onLayoutCalculated,(()=>{}),(()=>{s.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 n="Tests.Bio.WebLogo-project.fasta",s=await ve.files.readCsv("tests/filter_FASTA.csv"),r=s.name,i=s.getCol("fasta");await a.data.detectSemanticTypes(s);const o=a.shell.addTableView(s),l=await s.plot.fromType("WebLogo",{sequenceColumnName:i.name});o.dockManager.dock(l),await l.awaitRendered(),await x(o.grid),await async function(t,n,s,r){const i=e.Project.create(),o=s.saveLayout();await a.dapi.layouts.save(s.saveLayout()),await a.dapi.tables.uploadDataFrame(r),await a.dapi.tables.save(n),i.name=t,i.addChild(n),i.addChild(o),await a.dapi.projects.save(i)}(n,s.getTableInfo(),o,s),a.shell.closeAll(),await(0,t.gw)(500),await a.dapi.projects.open(n);const c=a.shell.getTableView(r),u=T()(c.viewers).toArray();(0,t.l_)(u.length,2),(0,t.l_)(u.filter((e=>"Grid"===e.type)).length,1);const h=u.find((e=>"WebLogo"===e.type));(0,t.l_)(!!h,!0),await x(o.grid),await h.awaitRendered()}),{skipReason:"depends on 1.18"})})),(0,t.W3)("WebLogo-layout",(()=>{(0,t.Bu)("fasta",(async()=>{const e=await ve.files.readCsv("tests/filter_FASTA.csv"),n=e.getCol("fasta");await a.data.detectSemanticTypes(e);const s=a.shell.addTableView(e),r=await e.plot.fromType("WebLogo",{sequenceColumnName:n.name});s.dockManager.dock(r),await(0,t.gw)(2*K.Fs.render),await r.awaitRendered(),await x(s.grid);const i=s.saveLayout();i.toJson(),s.loadLayout(i),await(0,t.gw)(2*K.Fs.render),await r.awaitRendered(),await x(s.grid);const o=T()(s.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 z=n(2568);function X(e,t){let n=null;for(const s of e.viewers)s.type===t&&(n=s);return n}(0,t.W3)("checkInputColumn",(()=>{const n="seq\nseq1,\nseq2,\nseq3,\nseq4";(0,t.Bu)("testMsaPos",(async()=>{const s=e.DataFrame.fromCsv(n).getCol("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.setTag(e.TAGS.UNITS,c.r2.FASTA),s.setTag("alphabet","DNA"),s.setTag("aligned","SEQ");const[r,i]=(0,z.l)(s,"Test",[c.r2.FASTA],["DNA","RNA","PT"]);(0,t.l_)(r,!0)})),(0,t.Bu)("testMsaNegHelm",(async()=>{const s=e.DataFrame.fromCsv(n).getCol("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.setTag(e.TAGS.UNITS,c.r2.HELM),s.setTag(".alphabetIsMultichar","true");const[r,i]=(0,z.l)(s,"Test",[c.r2.FASTA],["DNA","RNA","PT"]);(0,t.l_)(r,!1)})),(0,t.Bu)("testMsaNegUN",(async()=>{const s=e.DataFrame.fromCsv(n).getCol("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.setTag(e.TAGS.UNITS,c.r2.FASTA),s.setTag("alphabet","UN"),s.setTag(".alphabetSize","11"),s.setTag(".alphabetIsMultichar","true"),s.setTag("aligned","SEQ");const[r,i]=(0,z.l)(s,"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 n=await ve.files.readAsText("tests/sample_MSA_data.csv"),s=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(s);const r=a.shell.addTableView(s),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!==X(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 n=await ve.files.readAsText("tests/sample_MSA_data.csv"),s=e.DataFrame.fromCsv(n),r=a.shell.addTableView(s);await a.data.detectSemanticTypes(s);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!==X(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 J=n(5393),Q=n(8755);async function ee(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 n=new J.ST;return n.attach(t),n.applyState({columnName:e}),n.column=t.col(e),n.columnName=e,n}(0,t.W3)("bio-substructure-filters",(async()=>{let n,s;(0,t.bb)((async()=>{n=await(0,L.JN)(),s=await(0,I.nW)(),await(0,I.tb)(),await n.loadLibraries(!0)})),(0,t.X5)((async()=>{await(0,I.tW)(s),await n.loadLibraries(!0)})),(0,t.Bu)("fasta",(async()=>{const e=await _("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(e);const n=new J.ST;n.attach(e),await n.awaitRendered();try{(0,t.l_)(!!n.bioFilter,!0),(0,t.l_)(n.bioFilter.type,"FastaBioFilter");const s=n.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{s.props=new Q.x("MD")}),5e3,"testEvent onRowsFiltered"),(0,t.l_)(n.dataFrame.filter.trueCount,3),(0,t.l_)(n.dataFrame?.filter.toBinaryString(),"10010000100000")}finally{n.detach()}await n.awaitRendered()})),(0,t.Bu)("separator",(async()=>{const e=await _("tests/filter_MSA.csv"),n=new J.ST;await a.data.detectSemanticTypes(e),n.attach(e),await n.awaitRendered();try{(0,t.l_)(!!n.bioFilter,!0),(0,t.l_)(n.bioFilter.type,"SeparatorBioFilter");const s=n.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{s.props=new J.LH("meI")}),5e3,"testEvent onRowsFiltered"),(0,t.l_)(n.dataFrame.filter.trueCount,7),(0,t.l_)(n.dataFrame.filter.get(2),!1),await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{s.props=new J.LH("/meI")}),5e3,"testEvent onRowsFiltered"),(0,t.l_)(n.dataFrame.filter.trueCount,0),await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{s.props=new J.LH("meI-hHis","-")}),5e3,"testEvent onRowsFiltered"),(0,t.l_)(n.dataFrame.filter.trueCount,7),(0,t.l_)(n.dataFrame.filter.get(2),!1)}finally{n.detach()}await n.awaitRendered()})),(0,t.Bu)("helm-dialog",(async()=>{const e="Bio tests: substructureFilters/helm-dialog",n=await _("tests/filter_HELM.csv");await a.data.detectSemanticTypes(n);const s=a.shell.addTableView(n);ve.logger.debug(`${e}, filter attaching.`);const r=new J.ST;r.attach(n);const i=R.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"),ve.logger.debug(`${e}, filter 1 change awaiting...`),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{i.props=new Q.x("PEPTIDE1{A.C}$$$$V2.0")}),2e4),ve.logger.debug(`${e}, filter 1 changed.`),(0,t.l_)(r.dataFrame.filter.trueCount,1),(0,t.l_)(r.dataFrame.filter.toBinaryString(),"0001"),ve.logger.debug(`${e}, filter 2 change awaiting...`),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{i.props=new Q.x("PEPTIDE1{C}$$$$V2.0")}),2e4),await x(s.grid),ve.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(),await(0,t.gw)(3e3)})),(0,t.Bu)("helm-view",(async()=>{const e=await _("tests/filter_HELM.csv");e.getCol("HELM string"),await a.data.detectSemanticTypes(e);const t=a.shell.addTableView(e);t.getFiltersGroup(),await x(t.grid)})),(0,t.Bu)("sync-fasta",(async()=>{const e=await ve.files.readCsv("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(e);const n=await ee("fasta",e),s=await ee("fasta",e);await Promise.all([n.awaitRendered(),s.awaitRendered()]);try{(0,t.l_)(!!n.bioFilter,!0),(0,t.l_)(!!s.bioFilter,!0),(0,t.l_)(n.bioFilter.type,"FastaBioFilter"),(0,t.l_)(s.bioFilter.type,"FastaBioFilter");const r=n.bioFilter,i=s.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new Q.x("MD")}),1e4,"await onRowsFiltered"),(0,t.l_)(e.filter.trueCount,3),await n.awaitRendered(),(0,t.l_)(i.props.substructure,"MD")}finally{n.detach(),s.detach()}await Promise.all([n.awaitRendered(),s.awaitRendered()])})),(0,t.Bu)("sync-msa",(async()=>{const e=await ve.files.readCsv("tests/filter_MSA.csv");await a.data.detectSemanticTypes(e);const n="hHis-Aca",s=await ee("MSA",e),r=await ee("MSA",e);await Promise.all([s.awaitRendered(),r.awaitRendered()]);try{(0,t.l_)(!!s.bioFilter,!0),(0,t.l_)(!!r.bioFilter,!0),(0,t.l_)(s.bioFilter.type,"SeparatorBioFilter"),(0,t.l_)(r.bioFilter.type,"SeparatorBioFilter");const i=s.bioFilter,o=r.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{i.props=new J.LH(n,"-")}),1e4,"await onRowsFiltered"),(0,t.l_)(e.filter.trueCount,8),(0,t.l_)(o.props.substructure,n),(0,t.l_)(o.props.separator,"-")}finally{s.detach(),r.detach()}await Promise.all([s.awaitRendered(),r.awaitRendered()])})),(0,t.Bu)("sync-helm",(async()=>{const e=await ve.files.readCsv("tests/filter_HELM.csv");await a.data.detectSemanticTypes(e);const n=a.shell.addTableView(e),s="PEPTIDE1{A.C}$$$$V2.0",r=await ee("HELM string",e),i=await ee("HELM string",e),o=R.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 Q.x(s)}),6e4,"await onRowsFiltered"),await x(n.grid),ve.logger.debug("Bio tests: substructureFilters/sync-helm, before changed event"),await(0,t.gw)(2*r.debounceTime),ve.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,s)}finally{r.detach(),i.detach(),o.close()}await Promise.all([r.awaitRendered(),i.awaitRendered()]),await x(n.grid),await(0,t.gw)(3e3)})),(0,t.Bu)("two-columns-fasta",(async()=>{const n=e.DataFrame.fromCsv("id,seq1,seq2,trueSeq1,trueSeq2\n0,CGGCTACGGC,ATTGCATTCG,0,1,\n1,CGGCTGCCGC,ATAGCATTCG,1,1,\n2,CGGCTGCGCC,AATGCATACG,1,0,\n3,CGGCTGCATT,TTTGCATTCG,1,1,\n4,CGGCTGCATT,AAAGCATACG,1,0,\n");await a.data.detectSemanticTypes(n);const s=a.shell.addTableView(n),r="seq1",i="CGGCTG",o=n.getCol("trueSeq1").toList(),l="seq2",c="GCATT",u=n.getCol("trueSeq2").toList(),h=[{type:"Bio:bioSubstructureFilter",columnName:r},{type:"Bio:bioSubstructureFilter",columnName:l}],d=await n.plot.fromType(e.VIEWER.FILTERS,{filters:h});s.dockManager.dock(d,e.DOCK_TYPE.LEFT),await(0,t.gw)(100),await x(s.grid);const m=d.filters[0],p=d.filters[1];(0,t.l_)(m.column.name,r),(0,t.l_)(p.column.name,l);const f=m.bioFilter,g=p.bioFilter;await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new Q.x(i)}),1e3),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new Q.x("")}),1e3,"testEvent onRowsFiltered on seq1"),(0,t.l_)(n.filter.trueCount,o.filter((e=>1===e)).length),(0,t.l_)(n.filter.toBinaryString(),o.map((e=>e.toString())).join("")),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new Q.x("")}),1e3),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new Q.x(c)}),1e3,"testEvent onRowsFiltered on seq2"),(0,t.l_)(n.filter.trueCount,u.filter((e=>1===e)).length),(0,t.l_)(n.filter.toBinaryString(),u.map((e=>e.toString())).join("")),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new Q.x("")}),1e3),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new Q.x("")}),1e3,"testEvent onRowsFiltered on neither"),(0,t.l_)(n.filter.trueCount,n.rowCount),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new Q.x(i)}),5e3),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new Q.x(c)}),5e3,"testEvent onRowsFiltered on both");const y=T().count(0).take(n.rowCount).map((e=>o[e]*u[e])).toArray();(0,t.l_)(n.filter.trueCount,y.filter((e=>1===e)).length),(0,t.l_)(n.filter.toBinaryString(),y.map((e=>e.toString())).join("")),await Promise.all([m.awaitRendered(),p.awaitRendered(),x(s.grid)])})),(0,t.Bu)("reset-fasta",(async()=>{const n=await _("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(n);const s=a.shell.addTableView(n),r="MD",i=await n.plot.fromType(e.VIEWER.FILTERS,{filters:[{type:"Bio:bioSubstructureFilter",columnName:"fasta"}]});s.dockManager.dock(i,e.DOCK_TYPE.LEFT),await(0,t.gw)(100),await x(s.grid);const o=i.filters[0].bioFilter;await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{o.props=new Q.x(r)}),1e3,"testEvent onRowsFiltered"),(0,t.l_)(n.filter.trueCount,3),(0,t.l_)(o.props.substructure,r),(0,t.l_)(o.substructureInput.value,r),F()(i.root).find('i[name="icon-arrow-rotate-left"]')[0].click(),await(0,t.gw)(100),await x(s.grid),(0,t.l_)(o.props.substructure,""),(0,t.l_)(o.substructureInput.value,"")})),(0,t.Bu)("reopen",(async()=>{const n=await ve.files.readCsv("tests/filter_FASTA.csv"),s=a.shell.addTableView(n),r=[{type:"Bio:bioSubstructureFilter",columnName:"fasta"}],i=await n.plot.fromType(e.VIEWER.FILTERS,{filters:r});s.dockManager.dock(i,e.DOCK_TYPE.LEFT),await(0,t.gw)(100),await x(s.grid),i.close(),await x(s.grid);const o=await n.plot.fromType(e.VIEWER.FILTERS,{filters:r});s.dockManager.dock(o,e.DOCK_TYPE.LEFT),await(0,t.gw)(100),await x(s.grid)}))}));var te=n(8341);class ne{constructor(){this.errorList=[],this.warningList=[],this.infoList=[],this.debugList=[]}error(e,t,n){this.errorList.push({message:e,params:t,stackTrace:n})}warning(e,t){this.warningList.push({message:e,params:t})}info(e,t){this.infoList.push({message:e,params:t})}debug(e,t){this.debugList.push({message:e,params:t})}}var se=n(7945);(0,t.W3)("PepSeA",(()=>{(0,t.bb)((async()=>{await(0,b.Ns)()})),(0,t.Bu)("Basic alignment",(async()=>{const n=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'),s=await(0,te.f3)(n.getCol("HELM"),"msa(HELM)"),r=n.getCol("MSA");for(let e=0;e<s.length;++e)(0,t.l_)(s.get(e)==r.get(e),!0)}),{timeout:6e4}),(0,t.Bu)("stderr",(async()=>{const n=new ne,s=e.DataFrame.fromCsv('HELM,MSA\n"PEPTIDE1{F.L.Mis.G.W.[MeF].Y.S.N.N.C}$$$$","F.L.Mis.G.W.MeF.Y..S.N.N.C"\n"PEPTIDE1{F.L.Mis.G.Y.[MeF].Y.W.N.C}$$$$","F.L.Mis.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'),r=await(0,te.f3)(s.getCol("HELM"),"msa(HELM)",void 0,void 0,void 0,void 0,n),i=s.getCol("MSA");(0,t.f6)(r.toList(),i.toList()),(0,t.l_)(n.warningList[0].message,"Mis not found in Monomer Map\nMeF not found in Monomer Map\n")}),{timeout:6e4}),(0,t.Bu)("error",(async()=>{const n=new ne;try{const t=e.DataFrame.fromCsv('HELM\n"PEPTIDE1{[NH2].*.A.Q.T.T.Y.K.N.Y.R.R.N.L.L.*.[COOH]}$$$$"\n"PEPTIDE1{[NH2].M.A.N.T.T.Y.K.N.Y.R.N.N.L.L.*.[COOH]}$$$$"\n"PEPTIDE1{[NH2].*.A.N.T.T.Y.K.C.Y.R.R.N.L.L.*.[COOH]}$$$$"\n"PEPTIDE1{[NH2].*.A.N.T.T.Y.K.F.Y.R.R.N.L.L.*.[COOH]}$$$$"\n');await(0,te.f3)(t.getCol("HELM"),"msa(HELM)",void 0,void 0,void 0,void 0,n)}catch(e){const[t,s]=(0,se.yf)(e);n.error(t,void 0,s)}(0,t.l_)(n.errorList[0].message,"PepSeA error: The pair (*,M) couldn't be found in the substitution matrix")}))})),(0,t.W3)("viewers",(()=>{const n=e.Func.find({package:"Bio",tags:["viewer"]}).map((e=>e.friendlyName));for(const e of n)(0,t.Bu)(e,(async()=>{const n=await _("samples/FASTA_DNA.csv");await(0,t.AB)(e,n,{detectSemanticTypes:!0})}),{skipReason:{"Sequence Similarity Search":"GROK-13162","Sequence Diversity Search":"GROK-13162",WebLogo:"GROK-13162",VdRegions:"GROK-13162"}[e]})}));const re="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",ie="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT",oe="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 ae;(0,t.W3)("SeqHandler",(()=>{async function n(t){const n=e.DataFrame.fromCsv(t);await a.data.detectSemanticTypes(n);const s=u.g.forColumn(n.getCol("seq"));return[n,s]}(0,t.Bu)("Seq-Fasta",(async()=>{const[e,s]=await n(re);(0,t.l_)(s.notation,c.r2.FASTA),(0,t.l_)(s.isMsa(),!1)})),(0,t.Bu)("Seq-Fasta-MSA",(async()=>{const[e,s]=await n(ie);(0,t.l_)(s.notation,c.r2.FASTA),(0,t.l_)(s.isMsa(),!0)})),(0,t.Bu)("Seq-Fasta-units",(async()=>{const[e,s]=await n(re);(0,t.l_)(s.notation,c.r2.FASTA),(0,t.l_)(s.isMsa(),!1)})),(0,t.Bu)("Seq-Fasta-MSA-units",(async()=>{const[e,s]=await n(ie);(0,t.l_)(s.notation,c.r2.FASTA),(0,t.l_)(s.isMsa(),!0)})),(0,t.Bu)("Seq-Helm",(async()=>{const[e,s]=await n("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_)(s.notation,c.r2.HELM),(0,t.l_)(s.isHelm(),!0)})),(0,t.Bu)("Seq-UN",(async()=>{const[e,s]=await n(oe);(0,t.l_)(s.notation,c.r2.SEPARATOR),(0,t.l_)(s.separator,"-"),(0,t.l_)(s.alphabet,"UN")})),(0,t.Bu)("Seq-UN-auto",(async()=>{const[e,s]=await n(oe);(0,t.l_)(s.notation,c.r2.SEPARATOR),(0,t.l_)(s.separator,"-"),(0,t.l_)(s.alphabet,"UN")})),(0,t.Bu)("column-version",(async()=>{const n=e.DataFrame.fromCsv(re);await a.data.detectSemanticTypes(n);const s=n.getCol("seq"),r=u.g.forColumn(s),i=s.version,o=u.g.forColumn(s),l=s.version;(0,t.l_)(i,l,"Unexpected column version changed"),(0,t.l_)(r,o,"Unexpected SeqHandler object changed"),n.rows.addNew(["TACCCCTTCAAC"]);const c=u.g.forColumn(s),h=s.version;(0,t.l_)(l<h,!0,"Stalled column version on add row"),(0,t.l_)(o!==c,!0,"Stalled SeqHandler object on add row"),s.set(1,"CAGTGTCCCCGT");const d=u.g.forColumn(s),m=s.version;(0,t.l_)(h<m,!0,"Stalled column version on change data"),(0,t.l_)(c!==d,!0,"Stalled SeqHandler object on change data"),s.setTag("testTag","testValue");const p=u.g.forColumn(s),f=s.version;(0,t.l_)(m<f,!0,"Stalled column version on set tag"),(0,t.l_)(d!==p,!0,"Stalled SeqHandler object on set tag")}))})),function(e){e.fasta="fasta",e.fastaMsa="fastaMsa",e.separator="separator",e.separatorMsa="separatorMsa",e.helm="helm"}(ae||(ae={})),(0,t.W3)("SeqHandler",(()=>{u.lh[c.r2.FASTA],u.lh[c.r2.HELM];const n=u.lh[c.r2.SEPARATOR],s={[ae.fasta]:{src:{csv:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC"},tgt:{notation:c.r2.FASTA,splitted:[["A","C","G","T","C","A","C","G","T","C"],["C","A","G","T","G","T","C","A","G","T","G","T"],["T","T","C","A","A","C","T","T","C","A","A","C"]]}},[ae.fastaMsa]:{src:{csv:"seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT"},tgt:{notation:c.r2.FASTA,splitted:[["A","C","-","G","T","-","C","T","A","C","-","G","T","-","C","T"],["C","A","C","-","T","-","G","T","C","A","C","-","T","-","G","T"],["A","C","C","G","T","A","C","T","A","C","C","G","T","A","C","T"]]}},[ae.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"]]}},[ae.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",n,"abc1","dfgg","rut12","her2","rty",n,"abc1","dfgg"],["rut2","rty","her2",n,n,"wert","rut12","rty","her2",n,n,"wert"],["rut3","rty","her2",n,n,"wert","rut12","rty","her2",n,n,"wert"],[n,"rut4","her2","wert","rut12","rty","her2","wert"],["rut5","rty","her2","wert","rut12","rty","her2","wert",n]]}},[ae.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[n,r]of Object.entries(s))(0,t.Bu)(`splitted-${n}`,(async()=>{const n=e.DataFrame.fromCsv(r.src.csv).getCol("seq"),s=await a.functions.call("Bio:detectMacromolecule",{col:n});s&&(n.semType=s),(0,t.l_)(n.semType,e.SEMTYPE.MACROMOLECULE);const i=u.g.forColumn(n);(0,t.l_)(i.notation,r.tgt.notation),(0,t.l_)(i.separator===r.tgt.separator,!0);const o=T().count(0).take(i.length).map((e=>T()(i.getSplitted(e).originals).toArray())).toArray();(0,t.f6)(o,r.tgt.splitted)}))})),(0,t.W3)("SeqHandler: getRegion",(()=>{const n={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[s,r]of Object.entries(n))(0,t.Bu)(`${s}-idx`,(async()=>{const n=e.DataFrame.fromCsv(r.srcCsv).getCol("seq"),s=await a.functions.call("Bio:detectMacromolecule",{col:n});s&&(n.semType=s);const i=u.g.forColumn(n).getRegion(r.startIdx,r.endIdx,"regSeq"),o=e.DataFrame.fromCsv(r.tgtCsv).getCol("seq");(0,t.l_)(n.getTag(e.TAGS.UNITS),r.units),(0,t.l_)(i.getTag(e.TAGS.UNITS),r.units),(0,t.l_)(n.getTag("alphabet"),r.alphabet),(0,t.l_)(i.getTag("alphabet"),r.alphabet),(0,t.f6)(i.toList(),o.toList())})),r.positionNames&&(0,t.Bu)(`${s}-positionNames`,(async()=>{const n=e.DataFrame.fromCsv(r.srcCsv).getCol("seq");r.positionNames.tag&&n.setTag(".positionNames",r.positionNames.tag);const s=await a.functions.call("Bio:detectMacromolecule",{col:n});s&&(n.semType=s);const i=await a.functions.call("Bio:getRegion",{sequence:n,start:r.positionNames.start,end:r.positionNames.end}),o=e.DataFrame.fromCsv(r.tgtCsv).getCol("seq");(0,t.l_)(n.getTag(e.TAGS.UNITS),r.units),(0,t.l_)(i.getTag(e.TAGS.UNITS),r.units),(0,t.l_)(n.getTag("alphabet"),r.alphabet),(0,t.l_)(i.getTag("alphabet"),r.alphabet),(0,t.f6)(i.toList(),o.toList())}))}));var le=n(8601);const ce=new e.FileSource("System:AppData/Bio"),ue={"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"}},he="molfile(sequence)";async function de(e,t="seq",n){const s=e.getCol(t),r=n.getBioLib(),i=await(0,le.i0)(e,s,r);return i.warnings.length>0&&ve.logger.warning(`_toAtomicLevel() warnings ${i.warnings.join("\n")}`),i.col}function me(e){return e.replaceAll("\r\n","\n").replace(/\n$/,"").split("\n").map((e=>e.trimEnd())).join("\n")}(0,t.W3)("toAtomicLevel",(async()=>{const n={},s={};let r,i,o;async function h(e,n){const s=e.getCol("sequence");await(0,l.toAtomicLevel)(e,s,!1);const r=e.getCol(he),i=n.getCol(he),o=T()(r.values()).map((e=>me(e))).toArray(),a=T()(i.values()).map((e=>me(e))).toArray();(0,t.f6)(o,a)}(0,t.bb)((async()=>{r=await(0,L.JN)(),i=await(0,I.nW)(),await(0,I.tb)(),await r.loadLibraries(!0);for(const[t,r]of Object.entries(ue))r.inPath,n[t]=e.DataFrame.fromCsv((await ce.readAsText(r.inPath)).replace(/\n$/,"")),await a.data.detectSemanticTypes(n[t]),s[t]=e.DataFrame.fromCsv((await ce.readAsText(r.outPath)).replace(/\n$/,""))})),(0,t.X5)((async()=>{await(0,I.tW)(i),await r.loadLibraries(!0)}));for(const[e,r]of Object.entries(ue))(0,t.Bu)(`${e}`,(async()=>{await h(n[e],s[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 n=d[t],s=e.DataFrame.fromCsv(n.replace(/\n$/,""));return await a.data.detectSemanticTypes(s),s}(0,t.Bu)("fastaDna",(async()=>{await de(await m(o.fastaDna),"seq",r)})),(0,t.Bu)("fastaRna",(async()=>{await de(await m(o.fastaRna),"seq",r)})),(0,t.Bu)("fastaPt",(async()=>{await de(await m(o.fastaPt),"seq",r)})),(0,t.Bu)("separatorDna",(async()=>{await de(await m(o.separatorDna),"seq",r)})),(0,t.Bu)("separatorDna",(async()=>{await de(await m(o.separatorRna),"seq",r)})),(0,t.Bu)("separatorPt",(async()=>{await de(await m(o.separatorPt),"seq",r)})),(0,t.Bu)("separatorUn",(async()=>{await de(await m(o.separatorUn),"seq",r)})),(0,t.Bu)("helm",(async()=>{await de(await m(o.helm),"seq",r)})),(0,t.Bu)("ptFasta2",(async()=>{const n=await ve.files.readAsText("tests/to-atomic-level-pt-fasta-2.mol"),s=e.DataFrame.fromCsv("seq\nAR"),i=s.getCol("seq");i.semType=e.SEMTYPE.MACROMOLECULE,i.setTag(e.TAGS.UNITS,c.r2.FASTA),i.setTag("alphabet","PT"),u.g.forColumn(i);const o=await de(s,"seq",r);(0,t.l_)(me(o.get(0)),me(n))}))}));var pe=n(708);async function fe(t){const n=e.DataFrame.fromCsv(t),s=n.col("seq"),r=await a.functions.call("Bio:detectMacromolecule",{col:s});return r&&(s.semType=r),await a.data.detectSemanticTypes(n),u.g.forColumn(s)}function ge(e,n,s,r){const i=s(e,n);(0,t.l_)(Number(i.toFixed(3)),Number(r.toFixed(3)))}(0,t.W3)("Distance",(async()=>{const n=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],s={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 fe("seq\nFWRWYVKHPFWRWYVKHP\nYNRWYVKHPYNRWYVKHP\nMWRSWYCKHPMWRSWYCKHP")).getDistanceFunctionName();(0,t.l_)(e,pe.U.LEVENSHTEIN)})),(0,t.Bu)("DNA-distance-function",(async()=>{const e=(await fe("seq\nATAACGATAACG\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,t.l_)(e,pe.U.LEVENSHTEIN)})),(0,t.Bu)("MSA-distance-function",(async()=>{const e=(await fe("seq\nATAACATAAC\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,t.l_)(e,pe.U.HAMMING)})),(0,t.Bu)("levenstein-sub",(async()=>{const e=pe.o[pe.U.LEVENSHTEIN]();ge(r,i,e,.2)})),(0,t.Bu)("levenstein-del",(async()=>{const e=pe.o[pe.U.LEVENSHTEIN]();ge(o,a,e,.4)})),(0,t.Bu)("hamming",(async()=>{const e=pe.o[pe.U.HAMMING]();ge(o,a,e,.6)})),(0,t.Bu)("needleman-blosum62",(async()=>{const e=pe.o[pe.U.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});ge(r,i,e,-6)})),(0,t.Bu)("needleman-blosum62-del",(async()=>{const e=pe.o[pe.U.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});ge(o,a,e,-1.8)})),(0,t.Bu)("needleman-custom-sub",(async()=>{const e=pe.o[pe.U.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:s,gapOpen:1,gapExtend:1});ge(r,i,e,.2)})),(0,t.Bu)("needleman-custom-del",(async()=>{const e=pe.o[pe.U.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:s,gapOpen:1,gapExtend:1});ge(o,a,e,.8)})),(0,t.Bu)("needleman-custom-zero-extend",(async()=>{const e=pe.o[pe.U.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:s,gapOpen:1,gapExtend:0});ge(l,c,e,.714)})),(0,t.Bu)("needleman-custom-half-extend",(async()=>{const e=pe.o[pe.U.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:s,gapOpen:2,gapExtend:1});ge(l,c,e,1.286)})),(0,t.Bu)("needleman-custom-same-extend",(async()=>{const t=pe.o[pe.U.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:s,gapOpen:1,gapExtend:1});e.Test.isInBenchmark?ge(Array(1e4).fill("FWRY").join(""),Array(1e4).fill("FYWRRY").join(""),t,.667):ge(l,c,t,1.143)}))}));var ye=n(3277);async function we(e,n,s,r,i,o,c,u){await a.data.detectSemanticTypes(e);const h=await(0,l.activityCliffs)(e,e.getCol(s),e.getCol(r),i,n,c,u,{[`${ye.sS}`]:!0});(0,t.l_)(null!=h,!0);const d=Array.from(h.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 be=n(6361),Ae=n(4628);async function Ce(n,s,r){const i=n.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 u=await(0,l.sequenceSpaceTopMenu)(n,n.col(r),s,pe.U.LEVENSHTEIN,!0,c,{[ye.sS]:!0});(0,t.l_)(null!=u,!0)}(0,t.W3)("activityCliffs",(async()=>{let n,s,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()=>{n=await(0,L.JN)(),s=await(0,I.nW)(),await(0,I.tb)(),await n.loadLibraries(!0),r=[],i=[]})),(0,t.X5)((async()=>{await(0,I.tW)(s),await n.loadLibraries(!0)})),(0,t.Bu)("activityCliffsOpens",(async()=>{const t=await _(e.Test.isInBenchmark?"test/peptides_motif-with-random_10000.csv":"tests/100_3_clustests.csv");i.push(t);const n=a.shell.addTableView(t);r.push(n);const s=e.Test.isInBenchmark?6:3;await we(t,Ae.A.UMAP,"sequence","Activity",90,s,pe.U.LEVENSHTEIN,o)})),(0,t.Bu)("activityCliffsWithEmptyRows",(async()=>{const e=await _("tests/100_3_clustests_empty_vals.csv");i.push(e);const t=a.shell.addTableView(e);r.push(t),await we(e,Ae.A.UMAP,"sequence","Activity",90,3,pe.U.LEVENSHTEIN,o)})),(0,t.Bu)("Helm",(async()=>{const e=await ve.files.readCsv("samples/HELM_50.csv");a.shell.addTableView(e),await we(e,Ae.A.UMAP,"HELM","Activity",65,20,be.gk.Tanimoto,l)}))})),(0,t.W3)("sequenceSpace",(async()=>{let n,s,r,i;(0,t.Bu)("sequenceSpaceOpens",(async()=>{n=await _(e.Test.isInBenchmark?"test/peptides_motif-with-random_10000.csv":"tests/100_3_clustests.csv"),s=a.shell.addTableView(n),await Ce(n,Ae.A.UMAP,"sequence")})),(0,t.Bu)("sequenceSpaceWithEmptyRows",(async()=>{r=await _("tests/100_3_clustests_empty_vals.csv"),i=a.shell.addTableView(r),await Ce(r,Ae.A.UMAP,"sequence")}))})),(0,t.W3)("Scoring",(()=>{const n="sequence",s="expected_similarity",r="expected_identity",i=e.DataFrame.fromCsv(`${n},${s},${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(n);o.setTag(e.TAGS.UNITS,c.r2.HELM),o.semType=e.SEMTYPE.MACROMOLECULE;const a=o.get(0);let u,h;(0,t.bb)((async()=>{u=await(0,l.getMonomerLibHelper)(),h=await(0,I.nW)(),await(0,I.tb)(),await u.loadLibraries(!0)})),(0,t.X5)((async()=>{await(0,I.tW)(h),await u.loadLibraries(!0)})),(0,t.Bu)("Identity",(async()=>{const e=await(0,l.sequenceIdentityScoring)(i,o,a);for(let n=0;n<e.length;n++)(0,t.jh)(e.get(n),i.get(r,n),.01,`Wrong identity score for sequence at position ${n}`)})),(0,t.Bu)("Similarity",(async()=>{const e=await(0,l.sequenceSimilarityScoring)(i,o,a);for(let n=0;n<e.length;n++)(0,t.jh)(e.get(n),i.get(s,n),.01,`Wrong similarity score for sequence at position ${n}`)}))}));const ve=new e.Package;async function Te(n,s,r){const i=await(0,t.ci)({category:n,test:s,testContext:r});return e.DataFrame.fromObjects(i)}})(),bio_test=s})();
|
|
8
|
+
deps: ${n}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,n]=function({schema:e}){const t={},n={};for(const s in e)"__proto__"!==s&&((Array.isArray(e[s])?t:n)[s]=e[s]);return[t,n]}(e);a(e,t),l(e,n)}};function a(e,t=e.schema){const{gen:n,data:r,it:o}=e;if(0===Object.keys(t).length)return;const a=n.let("missing");for(const l in t){const c=t[l];if(0===c.length)continue;const u=(0,i.propertyInData)(n,r,l,o.opts.ownProperties);e.setParams({property:l,depsCount:c.length,deps:c.join(", ")}),o.allErrors?n.if(u,(()=>{for(const t of c)(0,i.checkReportMissingProp)(e,t)})):(n.if(s._`${u} && (${(0,i.checkMissingProp)(e,c,a)})`),(0,i.reportMissingProp)(e,a),n.else())}}function l(e,t=e.schema){const{gen:n,data:s,keyword:o,it:a}=e,l=n.name("valid");for(const c in t)(0,r.alwaysValidSchema)(a,t[c])||(n.if((0,i.propertyInData)(n,s,c,a.opts.ownProperties),(()=>{const t=e.subschema({keyword:o,schemaProp:c},l);e.mergeValidEvaluated(t,l)}),(()=>n.var(l,!0))),e.ok(l))}t.validatePropertyDeps=a,t.validateSchemaDeps=l,t.default=o},7274:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(7772),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,s.validateSchemaDeps)(e)};t.default=r},9434:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>s.str`must match "${e.ifClause}" schema`,params:({params:e})=>s._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:n,it:i}=e;void 0===n.then&&void 0===n.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),u=t.name("_valid");if(function(){const t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}(),e.reset(),a&&l){const n=t.let("ifClause");e.setParams({ifClause:n}),t.if(u,h("then",n),h("else",n))}else a?t.if(u,h("then")):t.if((0,s.not)(u),h("else"));function h(n,r){return()=>{const i=e.subschema({keyword:n},u);t.assign(c,u),e.mergeValidEvaluated(i,c),r?t.assign(r,s._`${n}`):e.setParams({ifClause:n})}}e.pass(c,(()=>e.error(!0)))}};function o(e,t){const n=e.schema[t];return void 0!==n&&!(0,r.alwaysValidSchema)(e,n)}t.default=i},8200:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(4783),r=n(2924),i=n(4665),o=n(1119),a=n(9864),l=n(7772),c=n(3708),u=n(9351),h=n(6239),d=n(2296),m=n(2182),p=n(19),f=n(4200),g=n(1125),y=n(9434),w=n(6552);t.default=function(e=!1){const t=[m.default,p.default,f.default,g.default,y.default,w.default,c.default,u.default,l.default,h.default,d.default];return e?t.push(r.default,o.default):t.push(s.default,i.default),t.push(a.default),t}},4665:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;const s=n(3487),r=n(6776),i=n(412),o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:n}=e;if(Array.isArray(t))return a(e,"additionalItems",t);n.items=!0,(0,r.alwaysValidSchema)(n,t)||e.ok((0,i.validateArray)(e))}};function a(e,t,n=e.schema){const{gen:i,parentSchema:o,data:a,keyword:l,it:c}=e;!function(e){const{opts:s,errSchemaPath:i}=c,o=n.length,a=o===e.minItems&&(o===e.maxItems||!1===e[t]);if(s.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,s.strictTuples)}}(o),c.opts.unevaluated&&n.length&&!0!==c.items&&(c.items=r.mergeEvaluated.items(i,n.length,c.items));const u=i.name("valid"),h=i.const("len",s._`${a}.length`);n.forEach(((t,n)=>{(0,r.alwaysValidSchema)(c,t)||(i.if(s._`${h} > ${n}`,(()=>e.subschema({keyword:l,schemaProp:n,dataProp:n},u))),e.ok(u))}))}t.validateTuple=a,t.default=o},1119:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i=n(412),o=n(4783),a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>s.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>s._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:n,it:s}=e,{prefixItems:a}=n;s.items=!0,(0,r.alwaysValidSchema)(s,t)||(a?(0,o.validateAdditionalItems)(e,a):e.ok((0,i.validateArray)(e)))}};t.default=a},2182:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(6776),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:r}=e;if((0,s.alwaysValidSchema)(r,n))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,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>s._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:n,parentSchema:i,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(o.opts.discriminator&&i.discriminator)return;const a=n,l=t.let("valid",!1),c=t.let("passing",null),u=t.name("_valid");e.setParams({passing:c}),t.block((function(){a.forEach(((n,i)=>{let a;(0,r.alwaysValidSchema)(o,n)?t.var(u,!0):a=e.subschema({keyword:"oneOf",schemaProp:i,compositeRule:!0},u),i>0&&t.if(s._`${u} && ${l}`).assign(l,!1).assign(c,s._`[${c}, ${i}]`).else(),t.if(u,(()=>{t.assign(l,!0),t.assign(c,i),a&&e.mergeEvaluated(a,s.Name)}))}))})),e.result(l,(()=>e.reset()),(()=>e.error(!0)))}};t.default=i},2296:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(412),r=n(3487),i=n(6776),o=n(6776),a={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,data:a,parentSchema:l,it:c}=e,{opts:u}=c,h=(0,s.allSchemaProperties)(n),d=h.filter((e=>(0,i.alwaysValidSchema)(c,n[e])));if(0===h.length||d.length===h.length&&(!c.opts.unevaluated||!0===c.props))return;const m=u.strictSchema&&!u.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(n){t.forIn("key",a,(i=>{t.if(r._`${(0,s.usePattern)(e,n)}.test(${i})`,(()=>{const s=d.includes(n);s||e.subschema({keyword:"patternProperties",schemaProp:n,dataProp:i,dataPropType:o.Type.Str},p),c.opts.unevaluated&&!0!==f?t.assign(r._`${f}[${i}]`,!0):s||c.allErrors||t.if((0,r.not)(p),(()=>t.break()))}))}))}!function(){for(const e of h)m&&g(e),c.allErrors?y(e):(t.var(p,!0),y(e),t.if(p))}()}};t.default=a},2924:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(4665),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,s.validateTuple)(e,"items")};t.default=r},6239:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(4815),r=n(412),i=n(6776),o=n(9351),a={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,parentSchema:a,data:l,it:c}=e;"all"===c.opts.removeAdditional&&void 0===a.additionalProperties&&o.default.code(new s.KeywordCxt(c,o.default,"additionalProperties"));const u=(0,r.allSchemaProperties)(n);for(const e of u)c.definedProperties.add(e);c.opts.unevaluated&&u.length&&!0!==c.props&&(c.props=i.mergeEvaluated.props(t,(0,i.toHash)(u),c.props));const h=u.filter((e=>!(0,i.alwaysValidSchema)(c,n[e])));if(0===h.length)return;const d=t.name("valid");for(const n of h)m(n)?p(n):(t.if((0,r.propertyInData)(t,l,n,c.opts.ownProperties)),p(n),c.allErrors||t.else().var(d,!0),t.endIf()),e.it.definedProperties.add(n),e.ok(d);function m(e){return c.opts.useDefaults&&!c.compositeRule&&void 0!==n[e].default}function p(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},d)}}};t.default=a},3708:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>s._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:n,data:i,it:o}=e;if((0,r.alwaysValidSchema)(o,n))return;const a=t.name("valid");t.forIn("key",i,(n=>{e.setParams({propertyName:n}),e.subschema({keyword:"propertyNames",data:n,dataTypes:["string"],propertyName:n,compositeRule:!0},a),t.if((0,s.not)(a),(()=>{e.error(!0),o.allErrors||t.break()}))})),e.ok(a)}};t.default=i},6552:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(6776),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){void 0===t.if&&(0,s.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};t.default=r},412:(e,t,n)=>{"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 s=n(3487),r=n(6776),i=n(2141),o=n(6776);function a(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:s._`Object.prototype.hasOwnProperty`})}function l(e,t,n){return s._`${a(e)}.call(${t}, ${n})`}function c(e,t,n,r){const i=s._`${t}${(0,s.getProperty)(n)} === undefined`;return r?(0,s.or)(i,(0,s.not)(l(e,t,n))):i}function u(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}t.checkReportMissingProp=function(e,t){const{gen:n,data:r,it:i}=e;n.if(c(n,r,t,i.opts.ownProperties),(()=>{e.setParams({missingProperty:s._`${t}`},!0),e.error()}))},t.checkMissingProp=function({gen:e,data:t,it:{opts:n}},r,i){return(0,s.or)(...r.map((r=>(0,s.and)(c(e,t,r,n.ownProperties),s._`${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,n,r){const i=s._`${t}${(0,s.getProperty)(n)} !== undefined`;return r?s._`${i} && ${l(e,t,n)}`:i},t.noPropertyInData=c,t.allSchemaProperties=u,t.schemaProperties=function(e,t){return u(t).filter((n=>!(0,r.alwaysValidSchema)(e,t[n])))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:o,errorPath:a},it:l},c,u,h){const d=h?s._`${e}, ${t}, ${r}${o}`:t,m=[[i.default.instancePath,(0,s.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=s._`${d}, ${n.object(...m)}`;return u!==s.nil?s._`${c}.call(${u}, ${p})`:s._`${c}(${p})`};const h=s._`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},n){const r=t.unicodeRegExp?"u":"",{regExp:i}=t.code,a=i(n,r);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:s._`${"new RegExp"===i.code?h:(0,o.useFunc)(e,i)}(${n}, ${r})`})},t.validateArray=function(e){const{gen:t,data:n,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",s._`${n}.length`);t.forRange("i",0,l,(n=>{e.subschema({keyword:i,dataProp:n,dataPropType:r.Type.Num},a),t.if((0,s.not)(a),o)}))}},t.validateUnion=function(e){const{gen:t,schema:n,keyword:i,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some((e=>(0,r.alwaysValidSchema)(o,e)))&&!o.opts.unevaluated)return;const a=t.let("valid",!1),l=t.name("_valid");t.block((()=>n.forEach(((n,r)=>{const o=e.subschema({keyword:i,schemaProp:r,compositeRule:!0},l);t.assign(a,s._`${a} || ${l}`),e.mergeValidEvaluated(o,l)||t.if((0,s.not)(a))})))),e.result(a,(()=>e.reset()),(()=>e.error(!0)))}},8386:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t.default=n},5684:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(8386),r=n(8280),i=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",s.default,r.default];t.default=i},8280:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;const s=n(6646),r=n(412),i=n(3487),o=n(2141),a=n(5173),l=n(6776),c={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:r}=e,{baseId:o,schemaEnv:l,validateName:c,opts:d,self:m}=r,{root:p}=l;if(("#"===n||"#/"===n)&&o===p.baseId)return function(){if(l===p)return h(e,c,l,l.$async);const n=t.scopeValue("root",{ref:p});return h(e,i._`${n}.validate`,p,p.$async)}();const f=a.resolveRef.call(m,p,o,n);if(void 0===f)throw new s.default(r.opts.uriResolver,o,n);return f instanceof a.SchemaEnv?function(t){const n=u(e,t);h(e,n,t,t.$async)}(f):function(s){const r=t.scopeValue("schema",!0===d.code.source?{ref:s,code:(0,i.stringify)(s)}:{ref:s}),o=t.name("valid"),a=e.subschema({schema:s,dataTypes:[],schemaPath:i.nil,topSchemaRef:r,errSchemaPath:n},o);e.mergeEvaluated(a),e.ok(o)}(f)}};function u(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):i._`${n.scopeValue("wrapper",{ref:t})}.validate`}function h(e,t,n,s){const{gen:a,it:c}=e,{allErrors:u,schemaEnv:h,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 s=null===(t=null==n?void 0:n.validate)||void 0===t?void 0:t.evaluated;if(!0!==c.props)if(s&&!s.dynamicProps)void 0!==s.props&&(c.props=l.mergeEvaluated.props(a,s.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(s&&!s.dynamicItems)void 0!==s.items&&(c.items=l.mergeEvaluated.items(a,s.items,c.items));else{const t=a.var("items",i._`${e}.evaluated.items`);c.items=l.mergeEvaluated.items(a,t,c.items,i.Name)}}s?function(){if(!h.$async)throw new Error("async schema referenced by sync schema");const n=a.let("valid");a.try((()=>{a.code(i._`await ${(0,r.callValidateCode)(e,t,m)}`),f(t),u||a.assign(n,!0)}),(e=>{a.if(i._`!(${e} instanceof ${c.ValidationError})`,(()=>a.throw(e))),p(e),u||a.assign(n,!1)})),e.ok(n)}():e.result((0,r.callValidateCode)(e,t,m),(()=>f(t)),(()=>p(t)))}t.getValidate=u,t.callRef=h,t.default=c},1240:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(9306),i=n(5173),o=n(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:n}})=>s._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},code(e){const{gen:t,data:n,schema:a,parentSchema:l,it:c}=e,{oneOf:u}=l;if(!c.opts.discriminator)throw new Error("discriminator: requires discriminator option");const h=a.propertyName;if("string"!=typeof h)throw new Error("discriminator: requires propertyName");if(a.mapping)throw new Error("discriminator: mapping is not supported");if(!u)throw new Error("discriminator: requires oneOf keyword");const d=t.let("valid",!1),m=t.const("tag",s._`${n}${(0,s.getProperty)(h)}`);function p(n){const r=t.name("valid"),i=e.subschema({keyword:"oneOf",schemaProp:n},r);return e.mergeEvaluated(i,s.Name),r}t.if(s._`typeof ${m} == "string"`,(()=>function(){const n=function(){var e;const t={},n=r(l);let s=!0;for(let t=0;t<u.length;t++){let l=u[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[h];if("object"!=typeof d)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);s=s&&(n||r(l)),a(d,t)}if(!s)throw new Error(`discriminator: "${h}" must be required`);return t;function r({required:e}){return Array.isArray(e)&&e.includes(h)}function a(e,t){if(e.const)d(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${h}" must have "const" or "enum"`);for(const n of e.enum)d(n,t)}}function d(e,n){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${h}" values must be unique strings`);t[e]=n}}();t.if(!1);for(const e in n)t.elseIf(s._`${m} === ${e}`),t.assign(d,p(n[e]));t.else(),e.error(!1,{discrError:r.DiscrError.Mapping,tag:m,tagName:h}),t.endIf()}()),(()=>e.error(!1,{discrError:r.DiscrError.Tag,tag:m,tagName:h}))),e.ok(d)}};t.default=a},9306:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(n=t.DiscrError||(t.DiscrError={})).Tag="tag",n.Mapping="mapping"},7299:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(5684),r=n(2649),i=n(8200),o=n(6121),a=n(1448),l=n(808),c=n(9502),u=n(6167),h=[o.default,s.default,r.default,(0,i.default)(!0),c.default,u.metadataVocabulary,u.contentVocabulary,a.default,l.default];t.default=h},3924:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(5684),r=n(2649),i=n(8200),o=n(9502),a=n(6167),l=[s.default,r.default,(0,i.default)(),o.default,a.metadataVocabulary,a.contentVocabulary];t.default=l},6215:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;const s=n(3487),r=n(2141),i=n(5173),o=n(8280),a={keyword:"$dynamicAnchor",schemaType:"string",code:e=>l(e,e.schema)};function l(e,t){const{gen:n,it:a}=e;a.schemaEnv.root.dynamicAnchors[t]=!0;const l=s._`${r.default.dynamicAnchors}${(0,s.getProperty)(t)}`,c="#"===a.errSchemaPath?a.validateName:function(e){const{schemaEnv:t,schema:n,self:s}=e.it,{root:r,baseId:a,localRefs:l,meta:c}=t.root,{schemaId:u}=s.opts,h=new i.SchemaEnv({schema:n,schemaId:u,root:r,baseId:a,localRefs:l,meta:c});return i.compileSchema.call(s,h),(0,o.getValidate)(e,h)}(e);n.if(s._`!${l}`,(()=>n.assign(l,c)))}t.dynamicAnchor=l,t.default=a},1919:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;const s=n(3487),r=n(2141),i=n(8280),o={keyword:"$dynamicRef",schemaType:"string",code:e=>a(e,e.schema)};function a(e,t){const{gen:n,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=n.let("valid",!1);c(t),e.ok(t)}function c(e){if(a.schemaEnv.root.dynamicAnchors[l]){const t=n.let("_v",s._`${r.default.dynamicAnchors}${(0,s.getProperty)(l)}`);n.if(t,u(t,e),u(a.validateName,e))}else u(a.validateName,e)()}function u(t,s){return s?()=>n.block((()=>{(0,i.callRef)(e,t),n.let(s,!0)})):()=>(0,i.callRef)(e,t)}}t.dynamicRef=a,t.default=o},6121:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(6215),r=n(1919),i=n(4094),o=n(3944),a=[s.default,r.default,i.default,o.default];t.default=a},4094:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(6215),r=n(6776),i={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,s.dynamicAnchor)(e,""):(0,r.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}};t.default=i},3944:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(1919),r={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,s.dynamicRef)(e,e.schema)};t.default=r},9651:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>s.str`must match format "${e}"`,params:({schemaCode:e})=>s._`{format: ${e}}`},code(e,t){const{gen:n,data:r,$data:i,schema:o,schemaCode:a,it:l}=e,{opts:c,errSchemaPath:u,schemaEnv:h,self:d}=l;c.validateFormats&&(i?function(){const i=n.scopeValue("formats",{ref:d.formats,code:c.code.formats}),o=n.const("fDef",s._`${i}[${a}]`),l=n.let("fType"),u=n.let("format");n.if(s._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>n.assign(l,s._`${o}.type || "string"`).assign(u,s._`${o}.validate`)),(()=>n.assign(l,s._`"string"`).assign(u,o))),e.fail$data((0,s.or)(!1===c.strictSchema?s.nil:s._`${a} && !${u}`,function(){const e=h.$async?s._`(${o}.async ? await ${u}(${r}) : ${u}(${r}))`:s._`${u}(${r})`,n=s._`(typeof ${u} == "function" ? ${e} : ${u}.test(${r}))`;return s._`${u} && ${u} !== true && ${l} === ${t} && !${n}`}()))}():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 "${u}"`}d.logger.warn(e())}();if(!0===i)return;const[a,l,m]=function(e){const t=e instanceof RegExp?(0,s.regexpCode)(e):c.code.formats?s._`${c.code.formats}${(0,s.getProperty)(o)}`:void 0,r=n.scopeValue("formats",{key:o,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,r]:[e.type||"string",e.validate,s._`${r}.validate`]}(i);a===t&&e.pass(function(){if("object"==typeof i&&!(i instanceof RegExp)&&i.async){if(!h.$async)throw new Error("async format in sync schema");return s._`await ${m}(${r})`}return"function"==typeof l?s._`${m}(${r})`:s._`${m}.test(${r})`}())}())}};t.default=r},9502:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=[n(9651).default];t.default=s},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,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(8921),r=n(7274),i=n(3633),o=[s.default,r.default,i.default];t.default=o},808:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(1782),r=n(4641),i=[s.default,r.default];t.default=i},4641:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:e}})=>s.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>s._`{limit: ${e}}`},code(e){const{gen:t,schema:n,data:i,it:o}=e,a=o.items||0;if(!0===a)return;const l=t.const("len",s._`${i}.length`);if(!1===n)e.setParams({len:a}),e.fail(s._`${l} > ${a}`);else if("object"==typeof n&&!(0,r.alwaysValidSchema)(o,n)){const n=t.var("valid",s._`${l} <= ${a}`);t.if((0,s.not)(n),(()=>function(n,i){t.forRange("i",i,l,(i=>{e.subschema({keyword:"unevaluatedItems",dataProp:i,dataPropType:r.Type.Num},n),o.allErrors||t.if((0,s.not)(n),(()=>t.break()))}))}(n,a))),e.ok(n)}o.items=!0}};t.default=i},1782:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i=n(2141),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:e})=>s._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){const{gen:t,schema:n,data:o,errsCount:a,it:l}=e;if(!a)throw new Error("ajv implementation error");const{allErrors:c,props:u}=l;function h(i){if(!1===n)return e.setParams({unevaluatedProperty:i}),e.error(),void(c||t.break());if(!(0,r.alwaysValidSchema)(l,n)){const n=t.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:i,dataPropType:r.Type.Str},n),c||t.if((0,s.not)(n),(()=>t.break()))}}u instanceof s.Name?t.if(s._`${u} !== true`,(()=>t.forIn("key",o,(e=>t.if(function(e,t){return s._`!${e} || !${e}[${t}]`}(u,e),(()=>h(e))))))):!0!==u&&t.forIn("key",o,(e=>void 0===u?h(e):t.if(function(e,t){const n=[];for(const r in e)!0===e[r]&&n.push(s._`${t} !== ${r}`);return(0,s.and)(...n)}(u,e),(()=>h(e))))),l.props=!0,e.ok(s._`${a} === ${i.default.errors}`)}};t.default=o},4693:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i=n(3510),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>s._`{allowedValue: ${e}}`},code(e){const{gen:t,data:n,$data:o,schemaCode:a,schema:l}=e;o||l&&"object"==typeof l?e.fail$data(s._`!${(0,r.useFunc)(t,i.default)}(${n}, ${a})`):e.fail(s._`${l} !== ${n}`)}};t.default=o},8921:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(7772),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:s.error,code:e=>(0,s.validatePropertyDeps)(e)};t.default=r},966:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i=n(3510),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>s._`{allowedValues: ${e}}`},code(e){const{gen:t,data:n,$data:o,schema:a,schemaCode:l,it:c}=e;if(!o&&0===a.length)throw new Error("enum must have non-empty array");const u=a.length>=c.opts.loopEnum;let h;const d=()=>null!=h?h:h=(0,r.useFunc)(t,i.default);let m;if(u||o)m=t.let("valid"),e.block$data(m,(function(){t.assign(m,!1),t.forOf("v",l,(e=>t.if(s._`${d()}(${n}, ${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,s.or)(...a.map(((t,r)=>function(e,t){const r=a[t];return"object"==typeof r&&null!==r?s._`${d()}(${n}, ${e}[${t}])`:s._`${n} === ${r}`}(e,r))))}e.pass(m)}};t.default=o},2649:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3983),r=n(430),i=n(3229),o=n(4336),a=n(498),l=n(3301),c=n(1687),u=n(2958),h=n(4693),d=n(966),m=[s.default,r.default,i.default,o.default,a.default,l.default,c.default,u.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},h.default,d.default];t.default=m},3633:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(6776),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){void 0===t.contains&&(0,s.checkStrictMode)(n,`"${e}" without "contains" is ignored`)}};t.default=r},1687:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxItems"===e?"more":"fewer";return s.str`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>s._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:r}=e,i="maxItems"===t?s.operators.GT:s.operators.LT;e.fail$data(s._`${n}.length ${i} ${r}`)}};t.default=r},3229:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=n(6776),i=n(4499),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxLength"===e?"more":"fewer";return s.str`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>s._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:o,it:a}=e,l="maxLength"===t?s.operators.GT:s.operators.LT,c=!1===a.opts.unicode?s._`${n}.length`:s._`${(0,r.useFunc)(e.gen,i.default)}(${n})`;e.fail$data(s._`${c} ${l} ${o}`)}};t.default=o},3983:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r=s.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})=>s.str`must be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>s._`{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:n,schemaCode:r}=e;e.fail$data(s._`${n} ${i[t].fail} ${r} || isNaN(${n})`)}};t.default=a},498:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxProperties"===e?"more":"fewer";return s.str`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>s._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:r}=e,i="maxProperties"===t?s.operators.GT:s.operators.LT;e.fail$data(s._`Object.keys(${n}).length ${i} ${r}`)}};t.default=r},430:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(3487),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>s.str`must be multiple of ${e}`,params:({schemaCode:e})=>s._`{multipleOf: ${e}}`},code(e){const{gen:t,data:n,schemaCode:r,it:i}=e,o=i.opts.multipleOfPrecision,a=t.let("res"),l=o?s._`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:s._`${a} !== parseInt(${a})`;e.fail$data(s._`(${r} === 0 || (${a} = ${n}/${r}, ${l}))`)}};t.default=r},4336:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(412),r=n(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:n,schema:i,schemaCode:o,it:a}=e,l=a.opts.unicodeRegExp?"u":"",c=n?r._`(new RegExp(${o}, ${l}))`:(0,s.usePattern)(e,i);e.fail$data(r._`!${c}.test(${t})`)}};t.default=i},3301:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(412),r=n(3487),i=n(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:n,schemaCode:o,data:a,$data:l,it:c}=e,{opts:u}=c;if(!l&&0===n.length)return;const h=n.length>=u.loopRequired;if(c.allErrors?function(){if(h||l)e.block$data(r.nil,d);else for(const t of n)(0,s.checkReportMissingProp)(e,t)}():function(){const i=t.let("missing");if(h||l){const n=t.let("valid",!0);e.block$data(n,(()=>function(n,i){e.setParams({missingProperty:n}),t.forOf(n,o,(()=>{t.assign(i,(0,s.propertyInData)(t,a,n,u.ownProperties)),t.if((0,r.not)(i),(()=>{e.error(),t.break()}))}),r.nil)}(i,n))),e.ok(n)}else t.if((0,s.checkMissingProp)(e,n,i)),(0,s.reportMissingProp)(e,i),t.else()}(),u.strictRequired){const t=e.parentSchema.properties,{definedProperties:s}=e.it;for(const e of n)if(void 0===(null==t?void 0:t[e])&&!s.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,(n=>{e.setParams({missingProperty:n}),t.if((0,s.noPropertyInData)(t,a,n,u.ownProperties),(()=>e.error()))}))}}};t.default=o},2958:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=n(453),r=n(3487),i=n(6776),o=n(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:n,$data:a,schema:l,parentSchema:c,schemaCode:u,it:h}=e;if(!a&&!l)return;const d=t.let("valid"),m=c.items?(0,s.getSchemaTypes)(c.items):[];function p(i,o){const a=t.name("item"),l=(0,s.checkDataTypes)(m,a,h.opts.strictNumbers,s.DataType.Wrong),c=t.const("indices",r._`{}`);t.for(r._`;${i}--;`,(()=>{t.let(a,r._`${n}[${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(s,a){const l=(0,i.useFunc)(t,o.default),c=t.name("outer");t.label(c).for(r._`;${s}--;`,(()=>t.for(r._`${a} = ${s}; ${a}--;`,(()=>t.if(r._`${l}(${n}[${s}], ${n}[${a}])`,(()=>{e.error(),t.assign(d,!1).break(c)}))))))}e.block$data(d,(function(){const s=t.let("i",r._`${n}.length`),i=t.let("j");e.setParams({i:s,j:i}),t.assign(d,!0),t.if(r._`${s} > 1`,(()=>(m.length>0&&!m.some((e=>"object"===e||"array"===e))?p:f)(s,i)))}),r._`${u} === false`),e.ok(d)}};t.default=a},8277:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7537),r=n.n(s),i=n(3645),o=n.n(i)()(r());o.push([e.id,"\n.ui-form.ui-tooltip .ui-input-root > label.ui-input-label:not(:empty) {\n /* min-width: 30px; /* Breaks right margin /**/\n}\n\n.ui-form.ui-tooltip .ui-input-root > div.ui-input-text:not(:empty) {\n margin-top: 6px;\n}","",{version:3,sources:["webpack://./css/cell-renderer.css"],names:[],mappings:";AACA;IACI,8CAA8C;AAClD;;AAEA;IACI,eAAe;AACnB",sourcesContent:["\n.ui-form.ui-tooltip .ui-input-root > label.ui-input-label:not(:empty) {\n /* min-width: 30px; /* Breaks right margin /**/\n}\n\n.ui-form.ui-tooltip .ui-input-root > div.ui-input-text:not(:empty) {\n margin-top: 6px;\n}"],sourceRoot:""}]);const a=o},5362:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7537),r=n.n(s),i=n(3645),o=n.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,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7537),r=n.n(s),i=n(3645),o=n.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,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7537),r=n.n(s),i=n(3645),o=n.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\n.ml-dim-reduction-column-editor-input-root label {\n display: none !important;\n}\n\n.ml-dim-reduction-column-editor-input-root input, .ml-dim-reduction-column-editor-input-root select {\n margin-left: 20px !important;\n}\n\nh3.ml-dim-reduction-column-editor-input-root {\n margin: 0 !important;\n}\n\n.ml-dim-reduction-column-editor-root, .ml-dim-reduction-column-editor-header-root {\n display: flex;\n flex-direction: row;\n align-items: center;\n margin-bottom: 10px !important;\n width: 600px !important;\n}\n\n.ml-dim-reduction-column-editor-column-title {\n text-overflow: ellipsis;\n overflow: hidden;\n}\n\n.ml-dim-reduction-column-editor-header-root > h1:not(:first-child) {\n margin-left: 20px !important;\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;;AAEA;IACI,wBAAwB;AAC5B;;AAEA;IACI,4BAA4B;AAChC;;AAEA;IACI,oBAAoB;AACxB;;AAEA;IACI,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,8BAA8B;IAC9B,uBAAuB;AAC3B;;AAEA;IACI,uBAAuB;IACvB,gBAAgB;AACpB;;AAEA;IACI,4BAA4B;AAChC",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\n.ml-dim-reduction-column-editor-input-root label {\n display: none !important;\n}\n\n.ml-dim-reduction-column-editor-input-root input, .ml-dim-reduction-column-editor-input-root select {\n margin-left: 20px !important;\n}\n\nh3.ml-dim-reduction-column-editor-input-root {\n margin: 0 !important;\n}\n\n.ml-dim-reduction-column-editor-root, .ml-dim-reduction-column-editor-header-root {\n display: flex;\n flex-direction: row;\n align-items: center;\n margin-bottom: 10px !important;\n width: 600px !important;\n}\n\n.ml-dim-reduction-column-editor-column-title {\n text-overflow: ellipsis;\n overflow: hidden;\n}\n\n.ml-dim-reduction-column-editor-header-root > h1:not(:first-child) {\n margin-left: 20px !important;\n}"],sourceRoot:""}]);const a=o},8710:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var s=n(7537),r=n.n(s),i=n(3645),o=n.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 n="",s=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),s&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),s&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,s,r,i){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(s)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 u=[].concat(e[c]);s&&o[u[0]]||(void 0!==i&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=i),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),r&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=r):u[4]="".concat(r)),t.push(u))}},t}},7537:e=>{"use strict";e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;if("function"==typeof btoa){var s=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),i="/*# ".concat(r," */");return[t].concat([i]).join("\n")}return[t].join("\n")}},4063:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var s,r,i;if(Array.isArray(t)){if((s=t.length)!=n.length)return!1;for(r=s;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((s=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=s;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=s;0!=r--;){var o=i[r];if(!e(t[o],n[o]))return!1}return!0}return t!=t&&n!=n}},9133:function(e,t,n){var s;!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 n(e,n,s,r,i){for(var o,a,l,c,u,h,d,m,p,f,g,y,w;i>=64;){for(o=n[0],a=n[1],l=n[2],c=n[3],u=n[4],h=n[5],d=n[6],m=n[7],f=0;f<16;f++)g=r+4*f,e[f]=(255&s[g])<<24|(255&s[g+1])<<16|(255&s[g+2])<<8|255&s[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=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&h^~u&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=h,h=u,u=c+y|0,c=l,l=a,a=o,o=y+w|0;n[0]+=o,n[1]+=a,n[2]+=l,n[3]+=c,n[4]+=u,n[5]+=h,n[6]+=d,n[7]+=m,r+=64,i-=64}return r}var s=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 s=0;if(this.bytesHashed+=t,this.bufferLength>0){for(;this.bufferLength<64&&t>0;)this.buffer[this.bufferLength++]=e[s++],t--;64===this.bufferLength&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(t>=64&&(s=n(this.temp,this.state,e,s,t),t%=64);t>0;)this.buffer[this.bufferLength++]=e[s++],t--;return this},t.prototype.finish=function(e){if(!this.finished){var t=this.bytesHashed,s=this.bufferLength,r=t/536870912|0,i=t<<3,o=t%64<56?64:128;this.buffer[s]=128;for(var a=s+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,n(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 n=0;n<this.state.length;n++)this.state[n]=e[n];this.bytesHashed=t,this.finished=!1,this.bufferLength=0},t}();e.Hash=s;var r=function(){function e(e){this.inner=new s,this.outer=new s,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var t=new Uint8Array(this.blockSize);if(e.length>this.blockSize)(new s).update(e).finish(t).clean();else for(var n=0;n<e.length;n++)t[n]=e[n];for(n=0;n<t.length;n++)t[n]^=54;for(this.inner.update(t),n=0;n<t.length;n++)t[n]^=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),n=0;n<t.length;n++)t[n]=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 s).update(e),n=t.digest();return t.clean(),n}function o(e,t){var n=new r(e).update(t),s=n.digest();return n.clean(),s}function a(e,t,n,s){var r=s[0];if(0===r)throw new Error("hkdf: cannot expand more");t.reset(),r>1&&t.update(e),n&&t.update(n),t.update(s),t.finish(e),s[0]++}e.HMAC=r,e.hash=i,e.default=i,e.hmac=o;var l=new Uint8Array(e.digestLength);e.hkdf=function(e,t,n,s){void 0===t&&(t=l),void 0===s&&(s=32);for(var i=new Uint8Array([1]),c=o(t,e),u=new r(c),h=new Uint8Array(u.digestLength),d=h.length,m=new Uint8Array(s),p=0;p<s;p++)d===h.length&&(a(h,u,n,i),d=0),m[p]=h[d++];return u.clean(),h.fill(0),i.fill(0),m},e.pbkdf2=function(e,t,n,s){for(var i=new r(e),o=i.digestLength,a=new Uint8Array(4),l=new Uint8Array(o),c=new Uint8Array(o),u=new Uint8Array(s),h=0;h*o<s;h++){var d=h+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<=n;m++){i.reset(),i.update(c).finish(c);for(var p=0;p<o;p++)l[p]^=c[p]}for(m=0;m<o&&h*o+m<s;m++)u[h*o+m]=l[m]}for(h=0;h<o;h++)l[h]=c[h]=0;for(h=0;h<4;h++)a[h]=0;return i.clean(),u}}(i);var o=i.default;for(var a in i)o[a]=i[a];"object"==typeof e.exports?e.exports=o:void 0===(s=function(){return o}.call(i,n,i,e))||(e.exports=s)}()},1811:(e,t,n)=>{"use strict";n.d(t,{T:()=>r});const s=new Uint32Array(65536),r=(e,t)=>{if(e.length<t.length){const n=t;t=e,e=n}return 0===t.length?e.length:e.length<=32?((e,t)=>{const n=e.length,r=t.length,i=1<<n-1;let o=-1,a=0,l=n,c=n;for(;c--;)s[e.charCodeAt(c)]|=1<<c;for(c=0;c<r;c++){let e=s[t.charCodeAt(c)];const n=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|~(n|a),a&=n}for(c=n;c--;)s[e.charCodeAt(c)]=0;return l})(e,t):((e,t)=>{const n=t.length,r=e.length,i=[],o=[],a=Math.ceil(n/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 u=32*c,h=Math.min(32,r)+u;for(let t=u;t<h;t++)s[e.charCodeAt(t)]|=1<<t;for(let e=0;e<n;e++){const n=s[t.charCodeAt(e)],r=o[e/32|0]>>>e&1,c=i[e/32|0]>>>e&1,u=n|a,h=((n|c)&l)+l^l|n|c;let d=a|~(h|l),m=l&h;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|~(u|d),a=d&u}for(let t=u;t<h;t++)s[e.charCodeAt(t)]=0}let u=0,h=-1;const d=32*c,m=Math.min(32,r-d)+d;for(let t=d;t<m;t++)s[e.charCodeAt(t)]|=1<<t;let p=r;for(let e=0;e<n;e++){const n=s[t.charCodeAt(e)],a=o[e/32|0]>>>e&1,l=i[e/32|0]>>>e&1,c=n|u,d=((n|l)&h)+h^h|n|l;let m=u|~(d|h),f=h&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,h=f|~(c|m),u=m&c}for(let t=d;t<m;t++)s[e.charCodeAt(t)]=0;return p})(e,t)}},3979:(e,t)=>{"use strict";t.H$=void 0,t.H$=function(e,t,n){var s=function(e,t,n){if(0===e.length||0===t.length)return 0;if(n&&!n.caseSensitive&&(e=e.toUpperCase(),t=t.toUpperCase()),e===t)return 1;for(var s=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 u=Math.max(0,c-o);u<=Math.min(i,c+o+1);u++)if(!a[c]&&!l[u]&&e[c]===t[u]){++s,a[c]=l[u]=!0;break}if(0===s)return 0;var h=0,d=0;for(c=0;c<r;c++)if(a[c]){for(;!l[d];)d++;e.charAt(c)!==t.charAt(d++)&&h++}return(s/r+s/i+(s-(h/=2))/s)/3}(e,t,n),r=0;if(s>.7){for(var i=Math.min(e.length,t.length),o=0;e[o]===t[o]&&o<4&&o<i;)++r,o++;s+=.1*r*(1-s)}return s}},9461:e=>{"use strict";var t=e.exports=function(e,t,s){"function"==typeof t&&(s=t,t={}),n(t,"function"==typeof(s=t.cb||s)?s:s.pre||function(){},s.post||function(){},e,"",e)};function n(e,s,r,i,o,a,l,c,u,h){if(i&&"object"==typeof i&&!Array.isArray(i)){for(var d in s(i,o,a,l,c,u,h),i){var m=i[d];if(Array.isArray(m)){if(d in t.arrayKeywords)for(var p=0;p<m.length;p++)n(e,s,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)n(e,s,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))&&n(e,s,r,m,o+"/"+d,a,o,d,i)}r(i,o,a,l,c,u,h)}}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 n(e){for(var n=-1,s=0;s<t.length;s++)if(t[s].identifier===e){n=s;break}return n}function s(e,s){for(var i={},o=[],a=0;a<e.length;a++){var l=e[a],c=s.base?l[0]+s.base:l[0],u=i[c]||0,h="".concat(c," ").concat(u);i[c]=u+1;var d=n(h),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,s);s.byIndex=a,t.splice(a,0,{identifier:h,updater:p,references:1})}o.push(h)}return o}function r(e,t){var n=t.domAPI(t);return n.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;n.update(e=t)}else n.remove()}}e.exports=function(e,r){var i=s(e=e||[],r=r||{});return function(e){e=e||[];for(var o=0;o<i.length;o++){var a=n(i[o]);t[a].references--}for(var l=s(e,r),c=0;c<i.length;c++){var u=n(i[c]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}i=l}}},569:e=>{"use strict";var t={};e.exports=function(e,n){var s=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(n)}},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,n)=>{"use strict";e.exports=function(e){var t=n.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(n){!function(e,t,n){var s="";n.supports&&(s+="@supports (".concat(n.supports,") {")),n.media&&(s+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(s+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),s+=n.css,r&&(s+="}"),n.media&&(s+="}"),n.supports&&(s+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(s+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(s,e,t.options)}(t,e,n)},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,n)=>{"use strict";n.d(t,{D:()=>c});var s=n(4469),r=n(976),i=n(7422),o=n(8607),a=n(6286);const l=31;async function c(e,t=!1,n){const a=o.g.forColumn(e);let c;n??(n=new Map);const h=a.isHelm()?(0,i.getHelmMonomers)(e):Object.keys(a.stats.freq).filter((e=>""!==e));for(let e=0;e<h.length;e++)n.has(h[e])||n.set(h[e],`${n.size+1}`);if(a.isHelm())c=await s.functions.call("HELM:getMolFiles",{col:e}),c=function(e,t,n=!1){const s=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 c=e.get(r);i=c.indexOf("\n",i)+1,i=c.indexOf("\n",i)+1,i=c.indexOf("\n",i)+1;const u=parseInt(c.substring(i,i+3)),h=parseInt(c.substring(i+3,i+6));a+=`M V30 COUNTS ${u} ${h} 0 0 0\n`,a+="M V30 BEGIN ATOM\n";for(let e=0;e<u;e++){i=c.indexOf("\n",i)+1+l,o=c.indexOf(" ",i);const s=c.substring(i,o);a+=n?`M V30 ${e+1} R${t.get(s)} 0.000 0.000 0 0\n`:`M V30 ${e+1} At 0.000 0.000 0 0 MASS=${t.get(s)}\n`}a+="M V30 END ATOM\n",a+="M V30 BEGIN BOND\n";for(let e=0;e<h;e++){i=c.indexOf("\n",i)+1;const t=parseInt(c.substring(i,i+3).trim()),n=parseInt(c.substring(i+3,i+6).trim());a+=`M V30 ${e+1} ${parseInt(c.substring(i+6,i+9).trim())} ${t} ${n}\n`}a+="M V30 END BOND\n",a+="M V30 END CTAB\n",a+="M END",s[r]=a}return s}(c,n,t);else{c=new Array(e.length);for(let s=0;s<e.length;s++){const e=u(a.getSplitted(s),n,t);c[s]=e}}return r.Column.fromStrings("monomericMols",c)}function u(e,t,n=!1){let s="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";s+=`M V30 COUNTS ${e.length} ${e.length?e.length-1:0} 0 0 0\n`,s+="M V30 BEGIN ATOM\n";for(let r=0;r<e.length;r++){const i=e.getCanonical(r);i!==a.G2&&(s+=n?`M V30 ${r+1} R${t.get(i)} 0.000 0.000 0 0\n`:`M V30 ${r+1} At 0.000 0.000 0 0 MASS=${t.get(i)}\n`)}s+="M V30 END ATOM\n",s+="M V30 BEGIN BOND\n";for(let t=0;t<e.length-1;t++)s+=`M V30 ${t+1} 1 ${t+1} ${t+2}\n`;return s+="M V30 END BOND\n",s+="M V30 END CTAB\n",s+="M END",s}},7422:(e,t,n)=>{"use strict";n.d(t,{_package:()=>Kt,activityCliffs:()=>zt,getHelmMonomers:()=>tn,getMonomerLib:()=>Zt,getMonomerLibHelper:()=>qt,importFasta:()=>en,sequenceIdentityScoring:()=>nn,sequenceSimilarityScoring:()=>sn,sequenceSpaceTopMenu:()=>Jt,toAtomicLevel:()=>Qt});var s,r,i=n(4469),o=n(3870),a=n(976),l=n(4628);(r=s||(s={})).EUCLIDEAN="EUCLIDEAN",r.MANHATTAN="MANHATTAN";var c=n(701),u=n(3379),h=n.n(u),d=n(7795),m=n.n(d),p=n(569),f=n.n(p),g=n(3565),y=n.n(g),w=n(9216),b=n.n(w),A=n(4589),C=n.n(A),v=n(9414),T={};T.styleTagTransform=C(),T.setAttributes=y(),T.insert=f().bind(null,"head"),T.domAPI=m(),T.insertStyleElement=b(),h()(v.Z,T),v.Z&&v.Z.locals&&v.Z.locals;var S=function(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))};let E=null,_=null;Object.prototype.toString;const x="MCL";a.SEMTYPE.MOLECULE,a.SEMTYPE.MACROMOLECULE;const P=rxjs.operators;n(5697);const N=e=>null==e;function $(e,t,n,s){if(n>e[e.length-1])return;const r=e.findIndex((e=>n<e));e.pop(),e.splice(r,0,n),t.pop(),t.splice(r,0,s)}class M{constructor(){this._workerCount=Math.max(navigator.hardwareConcurrency-2,1)}async calcMultiColumn(e,t,r,i=[{}],o=[1],a=s.EUCLIDEAN){const l=e[0].length*(e[0].length-1)/2,c=Math.floor(l/this._workerCount),u=e[0].length>2e4?await this.getMinimalThreshold(e,t,i,o,a):0;r<u&&(console.log(`using threshold ${u}`),r=u),i.forEach(((e,t)=>i[t].threshold=r));const h=new Array(this._workerCount),d=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(23),n.b))));for(let n=0;n<this._workerCount;n++)h[n]=new Promise(((s,u)=>{const h=n*c,m=n===this._workerCount-1?l:(n+1)*c;m<=h&&s({i:new Int32Array(0),j:new Int32Array(0),distance:new Float32Array(0),idx:n}),d[n].postMessage({values:e,startIdx:h,endIdx:m,threshold:r,fnNames:t,opts:i,weights:o,aggregationMethod:a}),d[n].onmessage=({data:{error:e,i:t,j:r,distance:i}})=>{e?(d[n].terminate(),u(e)):(d[n].terminate(),s({i:t,j:r,distance:i,idx:n}))}}));const m=await Promise.all(h),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,n,s={}){return await this.calcMultiColumn([e],[t],n,[s],[1])}async getKNN(e,t,n=15,s={}){return await this.multiColumnKNN([e],[t],n,[s],[1])}async getThresholdKNN(e,t,n=.8,s={}){return await this.multiColumnThresholdKnn([e],[t],n,[s],[1])}async multiColumnThresholdKnn(e,t,r=.8,i,o,a=s.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),u=new Array(this._workerCount),h=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(427),n.b))));for(let n=0;n<this._workerCount;n++)u[n]=new Promise(((s,u)=>{const d=n*c,m=n===this._workerCount-1?l:(n+1)*c;m<=d&&s({knnDistances:new Array(0),knnIndexes:new Array(0)}),h[n].postMessage({values:e,startIdx:d,endIdx:m,fnNames:t,opts:i,threshold:r,weights:o,aggregationMethod:a}),h[n].onmessage=({data:{error:e,knnDistances:t,knnIndexes:r}})=>{e?(h[n].terminate(),u(e)):(h[n].terminate(),s({knnDistances:t,knnIndexes:r}))}}));const d=await Promise.all(u),m=new Int32Array(e[0].length);for(const t of d)for(let n=0;n<e[0].length;++n)m[n]+=t.knnIndexes[n]?.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 n=0;n<e[0].length;++n)for(let e=0;e<t.knnDistances[n]?.length;++e)p.knnDistances[n][m[n]-1]=t.knnDistances[n][e],p.knnIndexes[n][m[n]-1]=t.knnIndexes[n][e],m[n]-=1;return p}async multiColumnKNN(e,t,r=15,i,o,a=s.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),u=new Array(this._workerCount),h=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(282),n.b))));for(let n=0;n<this._workerCount;n++)u[n]=new Promise(((s,u)=>{const d=n*c,m=n===this._workerCount-1?l:(n+1)*c;m<=d&&s({knnDistances:new Array(0),knnIndexes:new Array(0)}),h[n].postMessage({values:e,startIdx:d,endIdx:m,fnNames:t,opts:i,nNeighbours:r,weights:o,aggregationMethod:a}),h[n].onmessage=({data:{error:e,knnDistances:t,knnIndexes:r}})=>{e?(h[n].terminate(),u(e)):(h[n].terminate(),s({knnDistances:t,knnIndexes:r}))}}));const d=await Promise.all(u),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 n=0;n<e[0].length;++n)for(let e=0;e<t.knnDistances[n]?.length;++e)$(m.knnDistances[n],m.knnIndexes[n],t.knnDistances[n][e],t.knnIndexes[n][e]);return m}async getSampleDistances(e,t,r=[],i,o=s.EUCLIDEAN){const a=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(40),n.b))));try{const n=e[0].length*(e[0].length-1)/2,s=Math.floor(n/this._workerCount),l=1e6,c=Math.max(Math.min(n/1e3,l),Math.min(n,l)),u=Math.floor(c/this._workerCount),h=new Array(this._workerCount);for(let l=0;l<this._workerCount;l++)h[l]=new Promise(((c,h)=>{const d=l*s,m=l===this._workerCount-1?n:(l+1)*s;a[l].postMessage({values:e,startIdx:d,endIdx:m,sampleLength:u,fnNames:t,opts:r,weights:i,aggregationMethod:o}),a[l].onmessage=({data:{error:e,distance:t}})=>{a[l].terminate(),e?h(e):c({distance:t})}}));const d=await Promise.all(h),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,n=[],r,i=s.EUCLIDEAN){try{const s=e.length*(e.length-1)/2,o=await this.getSampleDistances(e,t,n,r,i);return 1-o[Math.floor(7e7/s*o.length)]}catch(e){return console.error(e),.5}}static calcSync(e,t,n,s){const r=[],i=[],o=[];let a=0,l=0,c=0;const u=e.length*(e.length-1)/2;for(;a<u;){const t=N(e[l])||N(e[c])?1:n(e[l],e[c]);1-t>=s&&(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 L,I=n(9657);!function(e){e.none="none",e.bold="bold",e.dashed="dashed"}(L||(L={}));class R{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,n,s,r=L.none){var i;this._currentLineIdx=-1,this.lineClicked=new c.Subject,this.lineHover=new c.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(n),this.canvas=this.sp.getInfo().canvas,this.ctx=this.canvas.getContext("2d"),this.currentLineStyle=r,this.updateLines(s),this.visibility=null!==(i=s.visibility)&&void 0!==i?i:new I.Z(this.lines.from.length),s.visibility||this.visibility.setAll(!0,!1),s.arrowSize&&(this.arrowWidth=s.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,n,s,r,i,o,a,l,c,u,h,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!==(n=this.lines.opacity)&&void 0!==n?n: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:n,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 A=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[e]),this.yAxisCol.get(this.lines.to[e]));let C=null==A?void 0:A.x,v=null==A?void 0:A.y;const T=Math.min(this.sp.viewBox.width,this.sp.viewBox.height);if(this.ctx.beginPath(),w&&b&&C&&v&&Math.hypot(C-w,v-b)/T>.01){if(p){const t=(null===(s=this.lines.colors)||void 0===s?void 0:s[e])?null===(r=this.lines.colors)||void 0===r?void 0:r[e]:"0,128,0",n=(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},${n})`,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,C,v);const s=this.getPointOnDistance(w,b,C,v,g,t),r=this.getPointOnDistance(C,v,w,b,n,t);w=s.x,b=s.y,C=r.x,v=r.y,f=this.lines.from[e]>this.lines.to[e]?this.findControlPoint(m,w,b,C,v,e):this.findControlPoint(m,C,v,w,b,e),this.ctx.moveTo(w,b),this.ctx.quadraticCurveTo(f.x,f.y,C,v)}else this.ctx.moveTo(w,b),this.ctx.lineTo(C,v);if((null!==(c=this.lines.drawArrows)&&void 0!==c?c:null===(u=this.lines.drawArrowsArr)||void 0===u?void 0:u.getBit(e))&&(t||(t=this.getLineLength(w,b,C,v)),t>this.arrowWidth)){const e=m?null:this.getPointOnDistance(w,b,C,v,g,t),n=m?f.x:w,s=m?f.y:b;this.canvasArrow(this.ctx,null!==(h=null==e?void 0:e.x)&&void 0!==h?h:w,null!==(d=null==e?void 0:e.y)&&void 0!==d?d:b,n,s)}this.ctx.stroke(),this.ctx.closePath(),e===this._currentLineIdx&&this.toggleCurrentLineStyle(!1)}}this.fillLeftBottomRect()}toggleCurrentLineStyle(e){switch(this.currentLineStyle){case L.bold:e?this.ctx.lineWidth+=2:this.ctx.lineWidth-=2;break;case L.dashed:e?this.ctx.setLineDash([5,5]):this.ctx.setLineDash([]);break;default:return}}getMarkersSizes(e,t,n){let s=3,r=3;return t?(s=(e.markerMinSize+(e.markerMaxSize-e.markerMinSize)*t.scale(this.lines.from[n]))/2,r=(e.markerMinSize+(e.markerMaxSize-e.markerMinSize)*t.scale(this.lines.to[n]))/2):e.markerDefaultSize&&(s=e.markerDefaultSize/2,r=e.markerDefaultSize/2),{sizeFrom:s,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 I.Z(this.lines.from.length);e.setAll(!0);for(let t=-1;-1!==(t=e.findNext(t));){const n=t,s=this.lines.from[n],r=this.lines.to[n];let i=1;for(let n=t;-1!==(n=e.findNext(n));){const t=this.lines.from[n],o=this.lines.to[n];(t===s&&o===r||o===s&&t===r)&&(this.multipleLinesCounts[n]=++i,e.setBit(n,!1,!1))}i>1&&(this.multipleLinesCounts[n]=1),e.setBit(t,!1,!1)}}checkCoordsOnLine(e,t){let n=-1,s=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),u=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[l]),this.yAxisCol.get(this.lines.from[l])),h=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[l]),this.yAxisCol.get(this.lines.to[l]));if(this.multipleLinesCounts[l]){const n=this.getLineLength(u.x,u.y,h.x,h.y),s=this.getPointOnDistance(u.x,u.y,h.x,h.y,c,n),i=this.getPointOnDistance(h.x,h.y,null==u?void 0:u.x,null==u?void 0:u.y,a,n),o=this.lines.from[l]>this.lines.to[l]?this.findControlPoint(this.multipleLinesCounts[l],s.x,s.y,i.x,i.y,l):this.findControlPoint(this.multipleLinesCounts[l],i.x,i.y,s.x,s.y,l);r=this.calculateDistToCurveLine(l,e,t,s,i,o)}else r=this.calculateDistToStraightLine(e,t,u,h);(!s&&null!==r&&r<5||s&&null!==r&&r<s)&&(s=r,n=l)}return n}calculateDistToStraightLine(e,t,n,s){const r=Math.min(n.x,s.x),i=Math.max(n.x,s.x),o=Math.min(n.y,s.y),a=Math.max(n.y,s.y);return e>=r-2&&e<=i+2&&t>=o-2&&t<=a+2?this.distToStraightLineSegment(e,t,n,s):null}distToStraightLineSegment(e,t,n,s){const r=(e,t,n,s)=>Math.pow(e-n,2)+Math.pow(t-s,2),i=r(n.x,n.y,s.x,s.y);if(0==i)return r(e,t,n.x,n.y);let o=((e-n.x)*(s.x-n.x)+(t-n.y)*(s.y-n.y))/i;return o=Math.max(0,Math.min(1,o)),r(e,t,n.x+o*(s.x-n.x),n.y+o*(s.y-n.y))}calculateDistToCurveLine(e,t,n,s,r,i){const o=Math.min(s.x,r.x,i.x),a=Math.max(s.x,r.x,i.x),l=Math.min(s.y,r.y,i.y),c=Math.max(s.y,r.y,i.y);if(t>=o-2&&t<=a+2&&n>=l-2&&n<=c+2){const e=a-o,u=c-l;return this.calculateDistToCurveInRect(t,n,s,i,r,e,u)}return null}calculateDistToCurveInRect(e,t,n,s,r,i,o){const a=Math.floor((i+o)/3),l=1/a,c=new Uint32Array(a),u=new Uint32Array(a),h=new Uint32Array(a);let d=null;const m=new I.Z(a);for(let i=0;i<c.length;i++){const o=i*l,a=Math.pow(1-o,2)*n.x+2*o*(1-o)*s.x+Math.pow(o,2)*r.x,m=Math.pow(1-o,2)*n.y+2*o*(1-o)*s.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),h[i]=Math.max(p,f),c[i]=a,u[i]=m}for(let e=0;e<c.length;e++)h[e]<d&&m.setBit(e,!0,!1);let p=null;for(let n=-1;-1!==(n=m.findNext(n));){const s=Math.hypot(c[n]-e,u[n]-t);(!p||p>s)&&(p=s)}return p}getLineLength(e,t,n,s){return Math.sqrt(Math.pow(n-e,2)+Math.pow(s-t,2))}getPointOnDistance(e,t,n,s,r,i){const o=n-r*((n-e)/i),l=s-r*((s-t)/i);return new a.Point(o,l)}findControlPoint(e,t,n,s,r,i){const o=t+(s-t)/2,l=n+(r-n)/2;let c=o-t,u=l-n;const h=Math.sqrt(c*c+u*u);c/=h,u/=h;const d=50*Math.ceil(e/2);return e%2==0?new a.Point(o+d/2*u,l-d/2*c):new a.Point(o-d/2*u,l+d/2*c)}canvasArrow(e,t,n,s,r){const i=Math.atan2(s-t,r-n)+Math.PI;e.moveTo(t-this.arrowWidth*Math.sin(i-Math.PI/10),n-this.arrowWidth*Math.cos(i-Math.PI/10)),e.lineTo(t,n),e.lineTo(t-this.arrowWidth*Math.sin(i+Math.PI/10),n-this.arrowWidth*Math.cos(i+Math.PI/10))}}const O="dimensionality-reducer-terminate-event";var D,F,k=n(850);async function G(e,t,s,r,o,a,l){let c=await async function(e,t,s,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,u){const h=new Worker(new URL(n.p+n.u(42),n.b));h.postMessage({columnsData:e,distanceMetrics:t,method:s,options:a,weights:r,aggregationMethod:o});const d=i.events.onCustomEvent(O).subscribe((()=>{try{h?.terminate()}finally{d.unsubscribe()}}));h.onmessage=({data:{error:e,embedding:t,epochNum:n,epochsLength:s}})=>{N(n)||N(s)?(d.unsubscribe(),e?u(e):c(t),setTimeout((()=>h.terminate()),100)):l&&l(n,s,t)}}))}(e,s,t,r,o,a,l);return c=c.map((e=>(0,k.Fv)(e))),c}(F=D||(D={})).EUCLIDEAN="EUCLIDEAN",F.MANHATTAN="MANHATTAN";const B={[D.EUCLIDEAN]:function(e){return`\n var sum = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n sum = sum + distances[i] * distances[i] * computeInfo.weights[i] * computeInfo.weights[i];\n }\n return sqrt(sum);\n `},[D.MANHATTAN]:function(e){return`\n var sum = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n sum = sum + abs(distances[i]) * computeInfo.weights[i];\n }\n return sum;\n `}};var H,W;(W=H||(H={})).HAMMING="Hamming",W.EUCLIDEAN="Euclidean",W.MANHATTAN="Manhattan",W.TANIMOTO="Tanimoto",W.LEVENSTEIN="Levenshtein",W.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",W.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",W.SOKAL="Sokal",W.COSINE="Cosine",W.ASYMMETRIC="Asymmetric",W.Difference="Difference",W.OneHot="One-Hot";const V={[H.HAMMING]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n let sizeDiff: u32 = maxLength - minLength;\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength)) - f32(sizeDiff);\n\n var diff: f32 = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n diff = diff + f32(a[i] != b[i]);\n if (diff > maxIntDistance) {\n return 1.0;\n }\n }\n diff += f32(sizeDiff);\n return diff / ${e};\n `},[H.EUCLIDEAN]:function(e,t){return`\n var dist: f32 = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n dist = dist + f32(a[i] - b[i]) * f32(a[i] - b[i]);\n }\n return sqrt(dist);\n `},[H.MANHATTAN]:function(e,t){return`\n var dist: f32 = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n dist = dist + abs(f32(a[i] - b[i]));\n }\n return dist;\n `},[H.TANIMOTO]:function(e,t){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n\n if (onBitsa == 0u && onBitsb == 0u) {\n return 0.0;\n }\n\n let totalOnBits = onBitsa + onBitsb;\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n\n return 1.0 - f32(commonBits) / f32(totalOnBits - commonBits);\n `},[H.LEVENSTEIN]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n\n let maxIntDistance = ceil(maxDistance * f32(maxLength));\n\n // we will store two arrays as matrix and swap the working indices per pass.\n // this way we can reduce memory usage per computation to just O(aLength)\n // the grid will have aLength + 1 columns and bLength + 1 rows\n // this will be guaranteed by iteration, but the array sizes must be known at compile time, so we will use a fixed size of maxArraySize\n var dynamicPassMat: array<array<f32, ${e+1}u>, 2>; // initialize to 0\n \n var prevIndex: u32 = 0;\n var curIndex: u32 = 1; // we will swap these indices per pass\n\n // initialize the first row\n for (var i = 0u; i <= aLength; i = i + 1u) {\n dynamicPassMat[prevIndex][i] = f32(i);\n }\n\n // iterate over the rows\n for (var i = 1u; i <= bLength; i = i + 1u) {\n dynamicPassMat[curIndex][0] = f32(i);\n var minEntry: f32 = f32(maxLength);\n let prevRow = &dynamicPassMat[prevIndex];\n let curRow = &dynamicPassMat[curIndex];\n let bMon = u32(b[i - 1]);\n for (var j = 1u; j <= aLength; j = j + 1u) {\n var cost: f32 = f32(a[j - 1] != bMon);\n var res: f32 = min(\n min(\n (*prevRow)[j] + 1.0, // deletion\n (*curRow)[j - 1] + 1.0, // insertion\n ),\n (*prevRow)[j - 1] + cost // substitution\n );\n (*curRow)[j] = res;\n if (res < minEntry) {\n minEntry = res;\n }\n }\n // swap the indices\n let temp: u32 = prevIndex;\n prevIndex = curIndex;\n curIndex = temp;\n if (minEntry > maxIntDistance) {\n return 1.0;\n }\n }\n\n return dynamicPassMat[prevIndex][aLength] / f32(maxLength);\n `},[H.NEEDLEMAN_WUNSCH]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength));\n // we will store two arrays as matrix and swap the working indices per pass.\n // this way we can reduce memory usage per computation to just O(aLength)\n // the grid will have aLength + 1 columns and bLength + 1 rows\n // this will be guaranteed by iteration, but the array sizes must be known at compile time, so we will use a fixed size of maxArraySize\n var dynamicPassMat: array<array<f32, ${e+1}u>, 2>; // initialize to 0\n \n // we need to keep track of which operation led to the current cell\n // i.e. whether we came from the left, top or diagonal to assign gap open/gap extend penalty\n var verticalGaps: array<u32, ${e+1}u>;\n var horizontalGaps: array<u32, ${e+1}u>;\n\n let gapOpenPenalty: f32 = suppInfo.gapOpenPenalty${t};\n let gapExtensionPenalty: f32 = suppInfo.gapExtensionPenalty${t};\n var prevIndex: u32 = 0;\n var curIndex: u32 = 1; // we will swap these indices per pass\n // initialize the first row\n for (var i = 0u; i <= aLength; i = i + 1u) {\n dynamicPassMat[prevIndex][i] = gapOpenPenalty + f32(i - 1) * gapExtensionPenalty;\n dynamicPassMat[curIndex][i] = 0.0;\n }\n dynamicPassMat[0][0] = 0.0;\n\n let simMatrix = &suppInfo.similarityMatrix${t}; // using pointers make things faster\n // iterate over the rows\n for (var i = 1u; i <= bLength; i = i + 1u) {\n let prevRow = &dynamicPassMat[prevIndex];\n let curRow = &dynamicPassMat[curIndex];\n (*curRow)[0] = gapOpenPenalty + f32(i - 1) * gapExtensionPenalty;\n var minEntry: f32 = f32(maxLength);\n let monB = u32(b[i - 1]);\n for (var j = 1u; j <= aLength; j = j + 1u) {\n let monA = u32(a[j - 1]);\n \n let cost: f32 = (*prevRow)[j - 1] + 1f - (*simMatrix)[monA][monB];\n var top = (*prevRow)[j]; // deletion\n if (verticalGaps[j] > 0) {\n top = top + gapExtensionPenalty;\n } else {\n top = top + gapOpenPenalty;\n }\n var left = (*curRow)[j - 1]; // insertion\n if (horizontalGaps[j - 1] > 0) {\n left = left + gapExtensionPenalty;\n } else {\n left = left + gapOpenPenalty;\n }\n var res: f32 = min(\n min(\n top, // deletion\n left, // insertion\n ),\n cost // substitution\n );\n (*curRow)[j] = res;\n if (res < minEntry) {\n minEntry = res;\n }\n // update the horizontal and vertical gaps\n if (res == cost) {\n verticalGaps[j] = 0;\n horizontalGaps[j] = 0;\n } else if (res == left) {\n verticalGaps[j] = 0;\n horizontalGaps[j] = 1;\n } else {\n verticalGaps[j] = 1;\n horizontalGaps[j] = 0;\n }\n }\n // swap the indices\n let temp: u32 = prevIndex;\n prevIndex = curIndex;\n curIndex = temp;\n if (minEntry > maxIntDistance) {\n return 1.0;\n }\n }\n return dynamicPassMat[prevIndex][aLength] / f32(maxLength);\n \n `},[H.MONOMER_CHEMICAL_DISTANCE]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n let maxLength: u32 = max(aLength, bLength);\n let minLength: u32 = min(aLength, bLength);\n let sizeDiff: u32 = maxLength - minLength;\n \n let maxIntDistance = ceil(maxDistance * f32(maxLength)) - f32(sizeDiff);\n\n let simMatrix = &(suppInfo.similarityMatrix${t}); // using pointers make things faster\n var diff: f32 = 0.0;\n for (var i = 0u; i < ${e}; i = i + 1u) {\n diff = diff + 1.0 - (*simMatrix)[u32(a[i])][u32(b[i])];\n if (diff > maxIntDistance) {\n return 1.0;\n }\n }\n diff += f32(sizeDiff);\n return diff / ${e};\n `},[H.SOKAL]:function(e,t){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let total = onBitsa + onBitsb;\n if (total == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / f32(total * 2 - commonBits * 3);\n `},[H.COSINE]:function(e,t){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let total = onBitsa * onBitsb; // p.s. here total is taken by multiplying\n if (total == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / sqrt(f32(total));\n `},[H.ASYMMETRIC]:function(e,t){return`\n var onBitsa: u32 = 0u;\n var onBitsb: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n onBitsa = onBitsa + countOneBits(a[i]);\n onBitsb = onBitsb + countOneBits(b[i]);\n }\n let min = min(onBitsa, onBitsb);\n if (min == 0u) {\n return 1.0;\n }\n var commonBits: u32 = 0u;\n for (var i = 0u; i < ${e}u; i = i + 1u) {\n commonBits = commonBits + countOneBits(a[i] & b[i]);\n }\n return 1.0 - f32(commonBits) / f32(min);\n `},[H.Difference]:function(e,t){return`\n let range = suppInfo.range${t};\n return f32(abs(f32(a[0]) - f32(b[0])) / range);\n `},[H.OneHot]:function(e,t){return`\n let aLength: u32 = computeInfo.entrySizes[${t}][aIndex];\n let bLength: u32 = computeInfo.entrySizes[${t}][bIndex];\n if (aLength != bLength) {\n return 1.0;\n }\n for (var i = 0u; i < aLength; i = i + 1u) {\n if(a[i] != b[i]) {\n return 1.0;\n }\n }\n return 0.0;\n `}},U={[H.HAMMING]:e=>Math.ceil(e/30),[H.EUCLIDEAN]:e=>Math.ceil(e/30),[H.MANHATTAN]:e=>Math.ceil(e/30),[H.TANIMOTO]:e=>Math.ceil(e/60),[H.SOKAL]:e=>Math.ceil(e/60),[H.COSINE]:e=>Math.ceil(e/60),[H.ASYMMETRIC]:e=>Math.ceil(e/60),[H.LEVENSTEIN]:e=>Math.ceil(e*e/60),[H.NEEDLEMAN_WUNSCH]:e=>Math.ceil(e*e/60),[H.MONOMER_CHEMICAL_DISTANCE]:e=>Math.ceil(e/25),[H.Difference]:e=>1,[H.OneHot]:e=>Math.ceil(e/40)},Y={STRING:new Set([H.HAMMING,H.LEVENSTEIN,H.NEEDLEMAN_WUNSCH,H.MONOMER_CHEMICAL_DISTANCE,H.OneHot]),UINT32ARRAY:new Set([H.HAMMING,H.EUCLIDEAN,H.MANHATTAN,H.MONOMER_CHEMICAL_DISTANCE,H.LEVENSTEIN,H.NEEDLEMAN_WUNSCH,H.TANIMOTO,H.COSINE,H.SOKAL,H.ASYMMETRIC,H.OneHot,H.Difference]),INT32ARRAY:new Set([H.EUCLIDEAN,H.MANHATTAN,H.OneHot,H.Difference]),FLOAT32ARRAY:new Set([H.EUCLIDEAN,H.MANHATTAN,H.Difference]),NUMBER:new Set([H.EUCLIDEAN,H.MANHATTAN,H.Difference]),BITARRAY:new Set([H.TANIMOTO,H.COSINE,H.SOKAL,H.ASYMMETRIC])};var j=function(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))};function K(e,t,n,s){return e.map(((e,s)=>`\n fn distanceScript${s}(aIndex: u32, bIndex: u32) -> f32 {\n let a = computeInfo.data${s}[aIndex];\n let b = computeInfo.data${s}[bIndex];\n let maxDistance: f32 = ${n};\n ${V[e](t[s],s)}\n }\n `)).join("\n")+"\n"+`\n fn combinedDistance(aIndex: u32, bIndex: u32) -> f32 {\n var distances: array<f32, ${e.length}>;\n ${e.map(((e,t)=>`distances[${t}] = distanceScript${t}(aIndex, bIndex);`)).join("\n")}\n ${B[s](e.length)}\n }\n \n `}let q=0;const X="cliffsDf",Z=new c.Subject,z="activity_difference",J="SALI_index",Q="similarity",ee="line_index",te=["1_molecule","2_molecule"],ne="filterCliffs";async function se(e,t,s,r,l,c,u,h,d,m,p,f,g,y,w,b){q++;const A=c/100;let C,v=!1;const T=f.inputs,N=await f.apply({[T[0].name]:t,[T[1].name]:u,...d.preprocessingFuncArgs??{}});let $=[];if(h===x){const t=await function(e,t,s,r,i,o,a=10,l=!1){const c=new Worker(new URL(n.p+n.u(231),n.b));let u;return c.postMessage({data:e,threshold:t,weights:s,aggregationMethod:r,distanceFns:i,distanceFnArgs:o,maxIterations:a,useWebGPU:l}),{promise:new Promise(((e,t)=>{u=e,c.onmessage=t=>{setTimeout((()=>c.terminate()),100),e(t.data.res)},c.onerror=e=>{setTimeout((()=>c.terminate()),100),t(e)}})),terminate:()=>{try{u(null),c.terminate()}catch(e){console.error(e)}}}}([N.entries],c,[1],"MANHATTAN",[u],[N.options??{}],d?.maxIterations??5,d.useWebGPU??!1).promise;e.columns.addNewInt(e.columns.getUnusedName("MCL Cluster")).init((e=>t.clusters[e])),$=[t.embedX,t.embedY]}else $=await G([N.entries],h,[u],[1],"MANHATTAN",{...d,distanceFnArgs:[N.options??{}]});if($.length!==s.length)throw new Error("Number of axes names should be equal to number of embedding dimensions");for(let t=0;t<$.length;++t)e.columns.addNewFloat(s[t]).init((e=>$[t][e]));let I=null;if(d.useWebGPU)try{I=await function(e,t=.8,n,s,r,i){return j(this,void 0,void 0,(function*(){const o=yield function(){return S(this,void 0,void 0,(function*(){if(!E&&(E=yield navigator.gpu.requestAdapter({powerPreference:"high-performance"}),null==E))return null;let e=!1;if(_&&(_.lost.then((()=>{e=!0})),yield new Promise((e=>setTimeout(e,10)))),!_||e){const e=1e9,t=E.limits,n=t.maxBufferSize,s=t.maxStorageBufferBindingSize;try{return _=yield E.requestDevice({requiredLimits:{maxBufferSize:Math.min(n,e),maxStorageBufferBindingSize:Math.min(s,e)}}),_}catch(e){return console.error("Failed to create device with required limits",e),_=yield E.requestDevice(),_}}return _}))}();if(!o)return null;const a=Object.values(H);if(n.some((e=>!a.includes(e))))throw new Error("Invalid distance metrics provided: "+n.join(", "));if(!Object.values(D).includes(s))throw new Error("Invalid aggregation function provided: "+s);const l=1-t;if(i.length!==e.length||i.length!==n.length||i.length!==r.length)throw new Error("Options, weigths and distance functions must be provided for each column");if(e.some((t=>t.length!==e[0].length)))throw new Error("All entry lists must be the same length");const c=e.length,u=e[0].length,h=e.map(((e,t)=>function(e,t=H.HAMMING,n,s={gapOpenPenalty:1,gapExtensionPenalty:.6}){var r,i;let o=null;const a=e.some((e=>"string"==typeof e))?(o="STRING",e.map((e=>new Uint32Array(e.split("").map((e=>e.charCodeAt(0))))))):e.some((e=>"number"==typeof e))?(o="NUMBER",e.map((e=>new Float32Array([e])))):"object"==typeof e[0]&&e.some((e=>"_data"in e&&"_length"in e))?(o="BITARRAY",e.map((e=>e._data))):e.some((e=>e instanceof Float32Array))?(o="FLOAT32ARRAY",e):e.some((e=>e instanceof Uint32Array))?(o="UINT32ARRAY",e):e.some((e=>e instanceof Int32Array))?(o="INT32ARRAY",e):void 0;if(!a||!o)throw new Error("Invalid entry type, could not determine entry type from input list");const l=a[0]instanceof Int32Array?"INT32ARRAY":a[0]instanceof Float32Array?"FLOAT32ARRAY":"UINT32ARRAY",c=new Uint32Array(a.map((e=>e.length)));if(!Y[o]||!Y[o].has(t))throw new Error(`Distance metric '${t}' not supported for entry type '${o}'`);const u=c.reduce(((e,t)=>Math.max(e,t)),0),h=U[t](u),d="INT32ARRAY"===l?Int32Array:"FLOAT32ARRAY"===l?Float32Array:Uint32Array,m=new d(a.length*u);a.forEach(((e,t)=>{m.set(e,t*u)}));let p="",f=0,g="FLOAT32ARRAY",y=null;if(t===H.NEEDLEMAN_WUNSCH||t===H.MONOMER_CHEMICAL_DISTANCE){let e=s.scoringMatrix&&s.alphabetIndexes?Object.keys(s.alphabetIndexes).reduce(((e,t)=>Math.max(e,t.charCodeAt(0))),0):-1;if(!s.alphabetIndexes||!s.scoringMatrix){for(let t=0;t<m.length;t++)m[t]>e&&(e=m[t]);s.scoringMatrix=new Array(e+1).fill(null).map((()=>new Array(e+1).fill(0))),s.alphabetIndexes={};for(let e=0;e<s.scoringMatrix.length;e++)s.scoringMatrix[e][e]=1,s.alphabetIndexes[String.fromCharCode(e)]=e}const t=(e+1)*(e+1),o=new Array(e+1).fill(null).map((()=>new Float32Array(e+1)));for(let t=0;t<e+1;t++)o[t][t]=1;const a=s.alphabetIndexes;for(const e of Object.keys(a))for(const t of Object.keys(a))e!==t&&(o[e.charCodeAt(0)][t.charCodeAt(0)]=s.scoringMatrix[a[e]][a[t]]);f=2+t,g="FLOAT32ARRAY",y=new Float32Array(f),y[0]=null!==(r=s.gapOpenPenalty)&&void 0!==r?r:1,y[1]=null!==(i=s.gapExtensionPenalty)&&void 0!==i?i:.6;let l=2;for(let e=0;e<o.length;e++)y.set(o[e],l),l+=o[e].length;p=`\n gapOpenPenalty${n}: f32,\n gapExtensionPenalty${n}: f32,\n similarityMatrix${n}: array<array<f32, ${e+1}>, ${e+1}>`}else if(t===H.Difference){if(!s.range||"number"!=typeof s.range||s.range<=0){const e=m.reduce(((e,t)=>Math.min(e,t)),m[0]),t=m.reduce(((e,t)=>Math.max(e,t)),m[0]);s.range=t-e}s.range<=0&&(s.range=1),f=1,g="FLOAT32ARRAY",y=new Float32Array([s.range]),p=`\n range${n}: f32`}const w=m instanceof Int32Array?"i32":m instanceof Float32Array?"f32":"u32",b=`data${n}: array<array<${w}, ${u}>, ${a.length}>`;return{flatSourceArray:m,sourceArraySize:m.length,maxEntryLen:u,arraySizes:c,complexity:h,suppInfoBuffer:y,suppInfoSize:f,suppInfoType:g,suppInfoStructWgsl:p,entryType:o,dataTypeWGSL:w,dataStructWgsl:b,EncodedArrayConstructor:d}}(e,n[t],t,i[t])));if(0===c)throw new Error("No columns provided. Please provide at least one column of data.");1===c&&(s=D.MANHATTAN);let d=h.map((e=>e.suppInfoStructWgsl)).filter((e=>!!e&&""!=e)).join(",\n"),m=!1;d&&""!=d.trim()||(m=!0,d="\ndummy: f32\n");const p=h.map((e=>e.dataStructWgsl)).filter((e=>!!e&&""!=e)).join(",\n"),f=new Uint32Array(c*u);h.forEach(((e,t)=>{f.set(e.arraySizes,t*u)}));const g=1e4,y=100,w=h.reduce(((e,t)=>e+t.complexity),0),b=Math.ceil(1e4/w),A=Math.ceil(Math.sqrt(Math.ceil(100))),C=10*A,v=u*(u-1)/2,T=Math.ceil(v/g),x=o.createShaderModule({label:"Sparse matrix compute shader",code:`\n // each thread will perform 100 iterations at one time, comparing 100 pairs of entries.\n // in total, each thread will perform at most ${T} comparisons.\n // first is the result struct, containing is, js, and distances. each array with length of 100,\n // and also integer for how many pairs were found to be below threshold.\n struct SparseResult {\n i: array<array<u32, 100>, 10000>,\n j: array<array<u32, 100>, 10000>,\n distances: array<array<f32, 100>, 10000>,\n found: array<u32, 10000>,\n done: array<u32, 10000>\n }\n // struct for the data\n struct ComputeInfo {\n // start at cols and rows, and end at cols and rows for each thread, these will be calculated on cpu and passed to gpu.\n startAtCols: array<u32, 10000>,\n startAtRows: array<u32, 10000>,\n endAtCols: array<u32, 10000>,\n endAtRows: array<u32, 10000>,\n\n // the ACTUALLY sizes of each entry\n entrySizes: array<array<u32, ${u}>, ${c}>,\n // the weights for each entry\n weights: array<f32, ${c}>,\n // the data for each entry\n ${p} // an example of the dataWgsl would be:\n //data0: array<array<u32,20>,100>,\n //data1: array<array<u32,20>,100>\n }\n\n // struct for the supplementary information\n struct SuppInfo {\n // struct containing all the supplementary info, like scoring matrix, alphabet indexes, range, etc.\n ${d}\n };\n\n @group(0) @binding(0) var<storage, read_write> computeInfo: ComputeInfo;\n @group(0) @binding(1) var<storage, read_write> suppInfo: SuppInfo;\n @group(0) @binding(2) var<storage, read_write> results: SparseResult;\n @compute @workgroup_size(10, 10) fn calcSparseMatrix(\n @builtin(global_invocation_id) id: vec3<u32>\n ) {\n ${m?"let otherDummy = suppInfo.dummy * 2;":""} // just to make sure that the suppInfo is not optimized out\n let threadCol = id.x;\n let threadRow = id.y;\n let linearIndex = threadRow * ${C} + threadCol;\n if (linearIndex >= 10000) {\n return; // if we are out of bounds, return\n } \n var startAtCol: u32 = computeInfo.startAtCols[linearIndex];\n var startAtRow: u32 = computeInfo.startAtRows[linearIndex];\n let endAtCol: u32 = min(computeInfo.endAtCols[linearIndex], ${u}u);\n let endAtRow: u32 = min(computeInfo.endAtRows[linearIndex], ${u}u);\n let is = &results.i[linearIndex];\n let js = &results.j[linearIndex];\n let distances = &results.distances[linearIndex];\n results.found[linearIndex] = 0; // initialize the found counter\n var found: u32 = 0;\n if (results.done[linearIndex] > 0) {\n return; // if we are done, return\n }\n for (var i = 0; i < ${b}; i++) {\n if (startAtCol >= endAtCol && startAtRow >= endAtRow) {\n results.done[linearIndex] = 1;\n break;\n }\n if (found >= 100) {\n break;\n }\n let dist = combinedDistance(startAtCol, startAtRow);\n if (dist <= ${l}) {\n (*is)[found] = startAtCol;\n (*js)[found] = startAtRow;\n (*distances)[found] = dist;\n found = found + 1;\n }\n startAtCol = startAtCol + 1;\n if (startAtCol >= ${u}u) {\n startAtRow += 1;\n startAtCol = startAtRow + 1;\n }\n }\n results.found[linearIndex] = found;\n // update the startAtCols and startAtRows\n computeInfo.startAtCols[linearIndex] = startAtCol;\n computeInfo.startAtRows[linearIndex] = startAtRow;\n\n }\n\n // this will generate the distance script for each distance metric and then combine them into one\n ${K(n,h.map((e=>e.maxEntryLen)),l,s)}\n\n\n `}),P=o.createComputePipeline({label:"sparse matrix compute pipeline",layout:"auto",compute:{module:x,entryPoint:"calcSparseMatrix"}}),N=new Uint32Array(g),$=new Uint32Array(g),M=new Uint32Array(g),L=new Uint32Array(g),I=Math.floor(v/g);let R=0,O=1;console.time("GPUthreadStarts");for(let e=0;e<g;e++){const t=9999===e?v-1:(e+1)*I,n=u-2-Math.floor(Math.sqrt(-8*t+4*u*(u-1)-7)/2-.5),s=t-u*n+Math.floor((n+1)*(n+2)/2);N[e]=O,$[e]=R,M[e]=s,L[e]=n,R=n,O=s}console.timeEnd("GPUthreadStarts");const F=4e4+u*c+c+h.reduce(((e,t)=>e+t.sourceArraySize),0),k=h.reduce(((e,t)=>e+t.suppInfoSize),0),G=1e6,B=F*Uint32Array.BYTES_PER_ELEMENT;let W=B;const V=15&B;0!==V&&(W+=16-V);const j=o.createBuffer({label:"compute info buffer",size:W,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),q=j.getMappedRange();let X=0;new Uint32Array(q,X,g).set(N),X+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(q,X,g).set($),X+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(q,X,g).set(M),X+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(q,X,g).set(L),X+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(q,X,f.length).set(f),X+=f.length*Uint32Array.BYTES_PER_ELEMENT,new Float32Array(q,X,c).set(r),X+=c*Float32Array.BYTES_PER_ELEMENT;for(const e of h){const t=e.EncodedArrayConstructor,n=e.sourceArraySize;new t(q,X,n).set(e.flatSourceArray),X+=n*t.BYTES_PER_ELEMENT}j.unmap();const Z=k*Uint32Array.BYTES_PER_ELEMENT;let z=Z;const J=15&Z;0!==J&&(z+=16-J),z=Math.max(z,16);const Q=o.createBuffer({label:"supp info buffer",size:z,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),ee=Q.getMappedRange();let te=0;for(const e of h)e.suppInfoBuffer&&e.suppInfoBuffer.byteLength>0&&e.suppInfoSize>0&&(new("UINT32ARRAY"===e.suppInfoType?Uint32Array:Float32Array)(ee,te,e.suppInfoBuffer.length).set(e.suppInfoBuffer),te+=e.suppInfoBuffer.byteLength);0===te&&new Uint32Array(ee,0,4).set([1,1,1,1]),Q.unmap();const ne=302e4*Uint32Array.BYTES_PER_ELEMENT;let se=ne;const re=15≠0!==re&&(se+=16-re);const ie=o.createBuffer({label:"results buffer",size:se,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC}),oe=o.createBindGroup({label:"bindGroup for sparse matrix buffer",layout:P.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:j}},{binding:1,resource:{buffer:Q}},{binding:2,resource:{buffer:ie}}]}),ae=o.createBuffer({label:"results out buffer",size:ie.size,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),le=[],ce=[],ue=[];let he=!1;for(;!he;){const e=o.createCommandEncoder({label:"distance encoder"}),t=e.beginComputePass({label:"distance compute pass"});t.setPipeline(P),t.setBindGroup(0,oe),t.dispatchWorkgroups(A,A),t.end(),e.copyBufferToBuffer(ie,0,ae,0,ae.size);const n=e.finish();o.queue.submit([n]),yield o.queue.onSubmittedWorkDone(),yield ae.mapAsync(GPUMapMode.READ);const s=ae.getMappedRange();let r=0;const i=new Uint32Array(s,r,G);r+=G*Uint32Array.BYTES_PER_ELEMENT;const a=new Uint32Array(s,r,G);r+=G*Uint32Array.BYTES_PER_ELEMENT;const l=new Float32Array(s,r,G);r+=G*Float32Array.BYTES_PER_ELEMENT;const c=new Uint32Array(s,r,g);r+=g*Uint32Array.BYTES_PER_ELEMENT,he=new Uint32Array(s,r,g).every((e=>1===e));const u=c.reduce(((e,t)=>e+t),0),h=new Uint32Array(u),d=new Uint32Array(u),m=new Float32Array(u);let p=0;for(let e=0;e<c.length;e++){const t=c[e];0!==t&&(h.set(i.subarray(e*y,e*y+t),p),d.set(a.subarray(e*y,e*y+t),p),m.set(l.subarray(e*y,e*y+t),p),p+=t)}le.push(h),ce.push(d),ue.push(m),ae.unmap()}const de=le.reduce(((e,t)=>e+t.length),0),me=new Uint32Array(de),pe=new Uint32Array(de),fe=new Float32Array(de);let ge=0;for(let e=0;e<le.length;e++)me.set(le[e],ge),pe.set(ce[e],ge),fe.set(ue[e],ge),ge+=le[e].length;return j.destroy(),Q.destroy(),ie.destroy(),ae.destroy(),{i:me,j:pe,distance:fe}}))}([N.entries],A,[u],D.MANHATTAN,[1],[N.options??{}])}catch(e){console.error(e)}I||(d.useWebGPU&&console.error("WebGPU sparse matrix calculation failed, falling back to CPU implementation"),I=await(new M).calc(N.entries,u,A,N.options));const O=await async function(e,t){const n=e.distance.map(((n,s)=>{const r=Math.abs(t.get(e.i[s])-t.get(e.j[s]));return 0!=n?r/n:1/0})),s=e.distance.map((e=>1-e)),r=e.i,i=e.j,o=new Set;return e.distance.forEach(((t,n)=>{o.add(e.i[n]),o.add(e.j[n])})),{simVals:s,saliVals:n,n1:r,n2:i,cliffsMolIds:o}}(I,l),F=function(e,t,n,s,r,i){const o=new Array(e).fill(0);for(let e=0;e!=n.length;++e)t[e]!=1/0&&(i.get(n[e])>i.get(s[e])?o[n[e]]+=t[e]:o[s[e]]+=t[e]);return a.Column.fromList("double",`sali_${r[0].substring(r[0].lastIndexOf("_"))}`,o)}(t.length,O.saliVals,O.n1,O.n2,s,l);e.columns.add(F);const k=function(e,t){const n=a.BitSet.create(e.rowCount);for(let s=0;s<e.rowCount;s++)n.set(s,t.has(s));return n}(e,O.cliffsMolIds),B=function(e){const t=e.filter((e=>e!==1/0)),n=t.reduce(((e,t)=>Math.min(e,t)),Number.MAX_VALUE),s=t.reduce(((e,t)=>Math.max(e,t)),n);return{max:s,min:n}}(O.saliVals),W=.8/(B.max-B.min),V=i.shell.getTableView(e.name),se=V.addViewer(a.VIEWER.SCATTER_PLOT,{xColumnName:s[0],yColumnName:s[1],size:F.name,color:l.name,showXSelector:!1,showYSelector:!1,showSizeSelector:!1,showColorSelector:!1,markerMinSize:5,markerMaxSize:25,title:r}),re=function(e,t,n,s,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 n=0;n<t.n1.length;n++)c.from[n]=t.n1[n],c.to[n]=t.n2[n],c.opacities[n]=t.saliVals[n]===1/0?1:.2+(t.saliVals[n]-o.min)*l,c.colors[n]=e.selection.get(c.from[n])&&e.selection.get(c.to[n])?"255,255,0":"0,128,0",c.widths[n]=1;const u=a.DataFrame.create(c.from.length);return te.forEach(((e,t)=>{u.columns.addNewString(e).init((e=>n.get(0===t?c.from[e]:c.to[e]))),function(e,t){Object.keys(t).forEach((n=>{e.tags[n]=t[n]}))}(u.col(e),i),u.col(e).semType=r})),u.columns.addNewFloat(z).init((e=>Math.abs(s.get(c.from[e])-s.get(c.to[e])))),u.columns.addNewInt(ee).init((e=>e)),u.columns.addNewFloat(J).init((e=>t.saliVals[e])),u.columns.addNewFloat(Q).init((e=>t.simVals[e])),u.name=`${X}${q}`,{lines:c,linesDf:u}}(e,O,t,l,m,p,B,W);re.lines.skipMultiLineCalculation=!0,re.linesDf.col(J).setTag("description","Structure−Activity Landscape Index (activity difference divided by 1 minus similarity)");const ie=new R(se,s[0],s[1],re.lines,L.none),oe=w?w(re.linesDf,te).sort([J],[!1]):re.linesDf.plot.grid().sort([J],[!1]);oe.col(ee)&&(oe.col(ee).visible=!1),e.temp[".cliffsDfGrid"]=oe;const ae=o.button(`${re.linesDf.rowCount} cliffs`,(()=>{V.dockManager.dock(oe,"down",null,"Activity cliffs",b??.2)}));ae.classList.add("scatter_plot_link","cliffs_grid"),se.root.append(ae);const le=o.switchInput("Show only cliffs",!1,(()=>{le.value?(se.dataFrame.setTag(ne,s[0]),e.filter.and(k),Z.next(s[0])):(se.dataFrame.setTag(ne,""),e.filter.setAll(!0),Z.next(""))}));le.root.classList.add("scatter_plot_link","show_only_cliffs"),se.root.append(le.root),Z.subscribe((e=>{le.enabled=""===e||e===s[0]}));let ce=!1;se.onEvent("d4-before-draw-scene").subscribe((t=>{ce?ce=!1:le.value&&(setTimeout((()=>{e.filter.and(k)}),100),ce=!0)}));const ue=i.events.onViewerClosed.subscribe((e=>{e.args.viewer===se&&(V.dockManager.close(oe.root),ue.unsubscribe(),V.subs=V.subs.filter((e=>e!==ue)))}));return V.subs.push(ue),re.linesDf.onCurrentCellChanged.subscribe((()=>{for(let e=0;e<re.linesDf.rowCount;e++)re.lines.widths[e]=e===re.linesDf.currentRowIdx?3:1;ie.linesToRender=re.lines;const n=re.linesDf.currentCol&&re.linesDf.currentCol.name===te[1]?re.lines.to:re.lines.from,r=-1!==re.linesDf.currentRowIdx?re.linesDf.currentRowIdx:null;if(se.dataFrame.currentRowIdx=r?n[r]:-1,null!==r){const n=re.linesDf.currentRowIdx;ie.currentLineId=n;const{zoomLeft:a,zoomRight:c,zoomTop:u,zoomBottom:h}=function(e,t,n,s,r,i){const o=Math.abs(n-r),a=Math.abs(s-i),l=e/o,c=t/a,u=Math.min(l,c),h=e/u*5,d=t/u*5,m=(n<r?n:r)+o/2-h/2,p=(s>i?s:i)-a/2+d/2;return{zoomLeft:m,zoomRight:m+h,zoomTop:p,zoomBottom:p-d}}(se.viewport.width,se.viewport.height,se.dataFrame.get(s[0],re.lines.from[n]),se.dataFrame.get(s[1],re.lines.from[n]),se.dataFrame.get(s[0],re.lines.to[n]),se.dataFrame.get(s[1],re.lines.to[n]));se.zoom(a,u,c,h),le.value?e.filter.and(k):!0===le.enabled&&e.filter.setAll(!0),setTimeout((()=>{!function(e,t,n,s,r,a,l,c,u){const h=t.getPane("Cliff Details");o.empty(h.root);const d=u({points:[n,s],lineId:r,df:e,seqCol:a,activityCol:l,sali:c});h.root.append(d),setTimeout((()=>{i.shell.o=t.root}),500)}(e,C,re.lines.from[r],re.lines.to[r],r,t,l,re.linesDf.get(J,r),y);const n=se.dataFrame.getSortedOrder(V.grid.sortByColumns,V.grid.sortTypes);V.grid.scrollToCell(t.name,n.indexOf(se.dataFrame.currentRowIdx))}),1e3)}})),re.linesDf.onSelectionChanged.subscribe((t=>{setTimeout((()=>(()=>{const t=a.BitSet.create(e.rowCount);for(let e=0;e<re.linesDf.rowCount;e++){const n=re.linesDf.selection.get(e);n&&(t.set(re.lines.from[e],!0),t.set(re.lines.to[e],!0)),re.lines.colors[e]=n?"255,255,0":"0,128,0"}e.selection.copyFrom(t),ie.linesToRender=re.lines})()),100)})),e.onSelectionChanged.subscribe((t=>{!1===e.selection.anyTrue&&"number"==typeof t&&(v?v=!1:(e=>{e.selection.setAll(!1);for(let e=0;e<re.lines.colors.length;e++)re.lines.colors[e]="0,128,0";ie.linesToRender=re.lines})(oe.dataFrame))})),ie.lineClicked.subscribe((t=>{if(v=!0,ie.currentLineId=t.id,-1!==t.id){const n=re.linesDf.selection.clone();setTimeout((()=>{t.event.ctrlKey?(n.set(t.id,!n.get(t.id)),re.linesDf.selection.copyFrom(n)):(re.linesDf.currentRowIdx!==t.id&&(re.linesDf.currentRowIdx=t.id,e.currentRowIdx=re.lines.from[t.id]),re.linesDf.selection.copyFrom(n));const s=re.linesDf.getSortedOrder(oe.sortByColumns,oe.sortTypes);oe.scrollToCell(te[0],s.indexOf(t.id))}),500)}})),ie.lineHover.pipe((0,P.debounceTime)(500)).subscribe((n=>{-1!==n.id&&-1===e.mouseOverRowIdx&&o.tooltip.show(g({lineId:n.id,points:[re.lines.from[n.id],re.lines.to[n.id]],df:e,seqCol:t,activityCol:l}),n.x,n.y)})),se.addProperty("similarityLimit","double",A),C=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}(),se}var re,ie=n(8447),oe=n(8607),ae=n(5226),le=n(7228),ce=n(8457);async function ue(e,t,n,s){const r=(0,ce.O)(t),i=oe.g.forColumn(t).getNewColumnFromList("ref",[n]),o=oe.g.forColumn(i).getSplitted(0),l=s===re.IDENTITY?function(e,t){const n=t.columns.length,s=new Array(n),r=new Array(n),i=new Array(n);for(let o=0;o<n;++o){const n=t.columns.byIndex(o);s[o]=n.getRawData(),r[o]=n.categories.indexOf(""),i[o]=n.categories.indexOf(e.getOriginal(o)??"")}const o=a.Column.float("Identity",t.rowCount),l=o.getRawData();for(let n=0;n<t.rowCount;++n){l[n]=0;for(let t=0;t<e.length;++t)s[t][n]===i[t]&&++l[n];l[n]/=e.length}return o}(o,r):s===re.SIMILARITY?await async function(e,t){const n=t.columns.toList();return await(0,le.Qx)(n,e)}(o,r):null;if(null===l)throw new Error(`In bio library: Unkown sequence scoring method: ${s}`);return l.name=e.columns.getUnusedName(l.name),e.columns.add(l),l}!function(e){e.IDENTITY="identity",e.SIMILARITY="similarity"}(re||(re={}));var he=n(7945),de=(n(4293),n(6414)),me=n.n(de),pe=n(8260);const fe="rgb(100,100,100)",ge="#808080",ye="rgb(0,0,0)",we=pe.GU;var be,Ae;function Ce(e,t,n,s,r,i,o=fe,a=0,l=!1,c=1,u="",h=!1,d=Ae.classic,m=[],p=0,f=null,g=null,y=null,w={}){r.textAlign="start";let b=i.substring(0),A=h?"":u;d===Ae.MSA&&(A="");let C=!0,v=!0,T="difference";if(null!=f&&null!=f.cell.column&&(C=f.cell.column.temp["color-code"]??!0,v=f.cell.column.temp["compare-with-current"]??!0,T=f.cell.column.temp["highlight-difference"]??"difference"),g){const e=g[p];v&&g.length>0&&"difference"===T&&(c=b==e?.3:c),v&&g.length>0&&"equal"===T&&(c=b!=e?.3:c)}null!=y&&(b=we(b,y));const S=b+A;w[S]??(w[S]=r.measureText(S));let E=w[S];w[b]??(w[b]=r.measureText(b));let _=w[b].width;w[A]??(w[A]=r.measureText(A));const x=w[A].width,P=s/2-(E.fontBoundingBoxAscent+E.fontBoundingBoxDescent)/2+1;function N(n,s){const i=C?o:ye;r.fillStyle=i,r.globalAlpha=c,d===Ae.classic&&(r.fillText(b,e+n,t+P),r.fillStyle=ge,r.fillText(A,e+s,t+P)),d===Ae.MSA&&r.fillText(b,e+n,t+P)}E=E.width,d===Ae.MSA&&(_=m[p],E=m[p]);const $=(m[p]??0)-(m[0]??0);if(l||E>n)return N($,$+_),e+$+_+x;{const t=(n-E)/2;return N(t,t+_),e+$+t+_}}(be||(be={})).maxMonomerLength=".mm.cellRenderer.maxMonomerLength",function(e){e.MSA="MSA",e.classic="classic"}(Ae||(Ae={})),n(9611);var ve,Te,Se=n(7331);function Ee(e){const t=!me().enumerate(e).some((([t,n])=>t.length>1&&0!=n&&n!=e.length-1)),n=[],s=t?"":" ";for(const[t,r]of me().enumerate(e)){let i=t;r<e.length&&(i+=`${t?"":"-"}${s}`),n.push(i)}return[n,t]}ie.fb.DNA,ie.fb.RNA,ie.fb.PT,ie.fb.UN,n(9713),(Te=ve||(ve={})).long="long",Te.short="short",n(3553),ie.GU;class _e 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[n,s,r]=(0,cell_renderer_back_base.N)(e),i=r.rendererBack;if(!i)return;const a=e.bounds,l=t.offsetX-e.gridColumn.left+(e.gridColumn.left-a.x),c=i.getPosition(e.tableRowIndex,l,a.width),u=oe.g.forColumn(s).getSplitted(e.tableRowIndex).canonicals;if(null!==c&&c<u.length){const e=u[c],n=[];let r=i._monomerStructureMap[e];i._monomerStructureMap[e]=(()=>{const t=oe.g.forColumn(s).alphabet??ie.fb.UN,n=alphabetPolymerTypes[t],r=Zt();return r?r.getTooltip(n,e):o.divText("Monomer library is not available")})(),n.push(r),o.tooltip.show(o.divV(n),t.x+16,t.y+16)}else o.tooltip.hide()}render(e,t,n,s,r,i,o){const l=window.devicePixelRatio,[c,u,h]=(0,cell_renderer_back_base.N)(i);if(!u)return;const d=u.temp;const m=d["monomer-width"];if("short"===(null!=m?m:"short")){const e=parseInt(u.getTag(be.maxMonomerLength));isNaN(e)&&Kt.properties?.MaxMonomerLength}const[p,f,g]=(0,cell_renderer_back_base.N)(i);let y=g.rendererBack;y||(g.rendererBack=new cell_renderer_monomer_placer.A(c,u,Kt.logger,(()=>{const e=oe.g.forColumn(u);return{seqHandler:e,monomerCharWidth:7,separatorWidth:e.isMsa()?8:0,monomerToShort:cell_renderer_monomerToShortFunction,monomerLengthLimit:50}}))),e.save();try{u.tags[".mm.cellRenderer.settingsChanged"]===cell_renderer_consts_rendererSettingsChangedState_true&&(d[".mm.cellRenderer.gapLength"],y.setMonomerLengthLimit(50),y.setSeparatorWidth(y.isMsa()?8:0),u.setTag(".mm.cellRenderer.settingsChanged",cell_renderer_consts_rendererSettingsChangedState_false));const[o,h]=y.getCellMonomerLengths(i.tableRowIndex,s),m=(o.length,i.cell.value,i.cell.rowIndex),p=u.getTag(ie.DX.alphabet),f=50;getUpdatedWidth(c?.grid,e,t,s,l),e.beginPath(),e.rect(t+this.padding,n+this.padding,s-this.padding-1,r-2*this.padding),e.clip(),e.font="12px monospace",e.textBaseline="top";const g=u.getTag(a.TAGS.UNITS),w=u.getTag(ie.DX.aligned),b=(0,ie.py)(p),A=u.getTag(ie.DX.separator)??"",C=y.props.separatorWidth+1*y.props.monomerCharWidth,v=Math.ceil(s/C),T=oe.g.forColumn(u),S=d["reference-sequence"],E=d["current-word"];E&&-1===u?.dataFrame?.currentRowIdx&&(d["current-word"]=null);const _=(()=>{const e=T.getSplitter(v);return me()(e(null!=S&&""!=S?S:E??"").originals).toArray()})(),x=T.getSplitted(m);let P=cell_renderer_undefinedColor,N=Ae.classic;w&&w.includes("MSA")&&g==ie.r2.SEPARATOR&&Ae.MSA;const $=Math.min(x.length,v);for(let o=0;o<$;++o){const a=x.getOriginal(o);b.get(a),e.fillStyle=cell_renderer_undefinedColor;const l=o===x.length-1;if(Ce(t+this.padding,n,s,r,e,a,P,0,!0,1,A,l,N,h,o,i,_,50,y._monomerLengthMap),f>s)break}}catch(e){const[t,n]=(0,he.yf)(e);y.logger.error(t,void 0,n),y.errors.push(e)}finally{e.restore()}}}class xe 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,n,s,r,i,o){const l=window.devicePixelRatio,c=i.grid,u=i.cell,h=i.tableColumn,d=u.value??"",m=h.tags[ie.DX.separator],p=h.tags[a.TAGS.UNITS];getUpdatedWidth(c,e,t,s,l);const[f,g]=d.split("#"),y=(0,pe.vU)(p,m);Pe(e,t,n,s,r,me()(y(f).canonicals).toArray(),me()(y(g).canonicals).toArray(),p)}}function Pe(e,t,n,s,r,i,o,a,l,c){if(i.length!==o.length){const e=function(e,t){let n=0,s=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]&&n++;const o=r.length-i.length;for(let e=r.length-1;e>o;e--)r[e]===i[e-o]&&s++;const a=new Array(Math.abs(e.length-t.length)).fill(oe.lh[ie.r2.FASTA]);function l(e){return n>s?e.concat(a):a.concat(e)}return e.length>t.length?t=l(me()(t).toArray()):e=l(me()(e).toArray()),{subParts1:e,subParts2:t}}(i,o);i=e.subParts1,o=e.subParts2}const u=e.measureText(Ee(i).join("")),h=e.measureText(Ee(o).join("")),d=Math.max(u.width,h.width);l&&(s=d+4*i.length,e.canvas.width=d+4*i.length);let m=Math.max(t,t+(s-(d+4*i.length))/2)+5;const p=Math.max(n,n+(r-28)/2);e.save(),e.beginPath(),e.rect(t,n,l?d+4*i.length:s,r),e.clip(),e.font="12px monospace",e.textBaseline="top";let f=Se.UE.Color;"HELM"!=a&&(f=(0,ie.py)(a.substring(a.length-2)));for(let t=0;t<i.length;t++){const n=i[t],a=o[t],l=f.get(n);if(n!=a){const i=f.get(a),o=Ce(m,p-7,s,r,e,n,l,0,!0),u=Ce(m,p+7,s,r,e,a,i,0,!0);m=Math.max(u,o),c&&(c[t]=Ne(n,a,l,i,p,7,r))}else m=Ce(m,p,s,r,e,n,l,0,!0,.5);m+=4}e.restore()}function Ne(e,t,n,s,r,i,o){const a=document.createElement("canvas"),l=a.getContext("2d");l.font="12px monospace";const c=l.measureText(Ee([e]).join("")).width,u=l.measureText(Ee([t]).join("")).width,h=Math.max(c,u);return a.height=o,a.width=h+4,l.font="12px monospace",l.textBaseline="top",Ce(0,r-i,h,o,l,e,n,0,!0),Ce(0,r+i,h,o,l,t,s,0,!0),a}var $e,Me=n(2997),Le=n(9298);!function(e){e.Unknown="unknown",e.FR="framework",e.CDR="cdr"}($e||($e={}));const Ie=new class{constructor(){this.regionTypes=[$e.CDR],this.chains=["Heavy","Light"],this.skipEmptyPositions=!1,this.fitWidth=!1,this.positionWidth=16,this.positionHeight=Le.ES.Entropy,this.filterSource=Le.vS.filterSource}};var Re=n(172),Oe=n(8415);const De=$e;var Fe,ke;!function(e){e.STYLE="Style",e.BEHAVIOR="Behavior",e.LAYOUT="Layout",e.DATA="Data"}(Fe||(Fe={})),function(e){e.skipEmptyPositions="skipEmptyPositions",e.regionTypes="regionTypes",e.chains="chains",e.fitWidth="fitWidth",e.positionWidth="positionWidth",e.positionHeight="positionHeight",e.filterSource="filterSource"}(ke||(ke={}));const Ge=Ie;class Be extends a.JsViewer{constructor(){super(),this.viewed=!1,this.regionsFg=null,this.regionsRoot=null,this.isOpened=!1,this.panelNode=null,this.regions=[],this.viewerId=++Be.viewerCounter,this.setDataInProgress=!1,this.host=null,this.mainLayout=null,this.logos=[],this.viewSubs=[],this.calcSizeRequested=!1,this._onRendered=new c.Subject,this.skipEmptyPositions=this.bool(ke.skipEmptyPositions,Ge.skipEmptyPositions,{category:Fe.DATA}),this.regionTypes=this.stringList(ke.regionTypes,Ge.regionTypes,{category:Fe.DATA,choices:Object.values(De).filter((e=>e!=De.Unknown))}),this.chains=this.stringList(ke.chains,Ge.chains,{category:Fe.DATA,choices:["Heavy","Light"]}),this.fitWidth=this.bool(ke.fitWidth,Ge.fitWidth,{category:Fe.LAYOUT}),this.positionWidth=this.float(ke.positionWidth,Ge.positionWidth,{category:Fe.LAYOUT,editor:"slider",min:0,max:64,description:"Internal WebLogo viewers property width of position."}),this.positionHeight=this.string(ke.positionHeight,Ge.positionHeight,{category:Fe.LAYOUT,choices:Object.keys(Le.ES)}),this.filterSource=this.string(ke.filterSource,Ge.filterSource,{category:Fe.BEHAVIOR,choices:Object.values(Le.Ct)}),this.viewSyncer=new Re.c(Kt.logger)}viewerToLog(){return`VdRegionsViewer<${this.viewerId}>`}async init(){this.subs.push((0,c.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 ke.regionTypes:case ke.chains:this.setData(this.regions)}switch(e.name){case ke.skipEmptyPositions:for(let e=0;e<this.logos.length;++e)for(const t of this.chains)this.logos[e][t].setOptions({[Oe.bo.skipEmptyPositions]:this.skipEmptyPositions});this.calcSize();break;case ke.fitWidth:case ke.positionWidth:this.calcSize();break;case ke.positionHeight:for(let e=0;e<this.logos.length;++e)for(const t of this.chains)this.logos[e][t].setOptions({[Oe.bo.positionHeight]:this.positionHeight});this.calcSize();break;case ke.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()`;Kt.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){Kt.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){Kt.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))),n=Array.from(new Set(t.map((e=>e.order)))).sort(),s=[];for(let e=0;e<n.length;e++)for(const r of this.chains){const i=t.find((t=>t.order==n[e]&&t.chain==r));s.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(s);this.logos=new Array(n.length);for(let e=0;e<n.length;++e)this.logos[e]={};for(const[e,t,n]of r)this.logos[e][t]=n,this.viewSubs.push(n.onFreqsCalculated.subscribe((()=>{this.calcSize()})));this.mainLayout=o.table(this.chains,(e=>[...n.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(n.length).keys()].map((t=>{const n=this.logos[t][e];return n.root.style.height="100%",o.div([n.root],{style:{marginTop:"4px",marginBottom:"4px"}})}))]),["",...[...Array(n.length).keys()].map((e=>t.find((t=>t.order==n[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(Le.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))),Kt.logger.debug("Bio: VdRegionsViewer.buildView() end")}calcSize(){Kt.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 n=0;n<this.logos.length;n++){for(const t of this.chains)this.logos[n][t].root.style.height=`${e}px`;t+=Math.max(...this.chains.map((e=>this.logos[n][e].Length)))}if(this.fitWidth){if(this.logos.length>0&&t>0){const e=22,n=13,s=9,r=(this.root.clientWidth-e-(this.logos.length-1)*s-n)/t;for(let e=0;e<this.logos.length;e++)for(const t of this.chains){const n=this.logos[e][t];n.setOptions({[Oe.bo.positionWidth]:r-n.positionMarginValue}),n.root.style.width=r*n.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({[Oe.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(ke.filterSource).set(this,t);for(let e=0;e<this.logos.length;e++)for(let t=0;t<this.chains.length;t++){const n=this.chains[t];this.logos[e][n].setOptions({[Oe.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,Me.zg)(this.onRendered,(()=>{}),(()=>{this.invalidate()}),e);const t=this.viewSyncer.resetErrors();if(t.length>0)throw t[0]}}function He(e){const t=o.divH([],{style:{gap:"10px"}}),n=o.divV([o.divText(e.seqCol.name),o.divText(e.activityCol.name)]);return n.style.fontWeight="bold",n.style.display="flex",n.style.justifyContent="space-between",t.append(n),e.points.forEach((n=>{const s=o.divText(e.activityCol.get(n).toFixed(2));s.style.display="flex",s.style.justifyContent="left",s.style.paddingLeft="30px",t.append(o.divV([o.divText(e.seqCol.get(n)),s]))})),t}function We(e){const t=o.div();t.append(o.divText(e.seqCol.name,{style:{fontWeight:"bold"}}));const n=new Array(2);e.points.forEach(((t,s)=>{n[s]=e.activityCol.get(t)}));const s={},r=oe.g.forColumn(e.seqCol),i=function(e,t,n,s){const r=document.createElement("canvas"),i=r.getContext("2d");return r.height=30,Pe(i,0,0,0,30,me()(e.canonicals).toArray(),me()(t.canonicals).toArray(),n,!0,s),r}(r.getSplitted(e.points[0]),r.getSplitted(e.points[1]),r.units,s);return t.append(o.div(i,{style:{width:"300px",overflow:"scroll"}})),t.append(function(e){const t=o.div();if(Object.keys(e).length>0){const n=o.divV([]);n.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",n.append(o.divH([o.divText((parseInt(t)+1).toString(),{style:{width:"30px",borderBottom:"1px solid lightgray"}}),e[t]]));t.append(n)}return t}(s)),t.append(Ve("Activity delta",Math.abs(n[0]-n[1]))),t.append(Ve("Cliff",e.sali)),t}function Ve(e,t){return o.divH([o.divText(`${e}: `,{style:{fontWeight:"bold",paddingRight:"5px"}}),o.divText(t.toFixed(2))],{style:{paddingTop:"10px"}})}function Ue(e,t){const n=a.Column.string("seq_diff",e.rowCount).init((n=>`${e.get(t[0],n)}#${e.get(t[1],n)}`));n.semType="MacromoleculeDifference",n.setTag(a.TAGS.UNITS,e.col(t[0]).getTag(a.TAGS.UNITS)),n.setTag(ie.DX.separator,e.col(t[0]).getTag(ie.DX.separator)),e.columns.add(n);const s=e.plot.grid();return s.col(t[0]).visible=!1,s.col(t[1]).visible=!1,s}Be.viewerCounter=-1,n(708),n(6361),n(7983);class Ye extends a.JsViewer{constructor(e){super(),this.name="",this.metricsProperties=["distanceMetric","fingerprint"],this.fingerprintChoices=["Morgan","Pattern"],this.initialized=!1,this.tags=[a.TAGS.UNITS,ie.DX.aligned,ie.DX.separator,ie.DX.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))}}n(7241);var je=n(1821);oe.lh[je.r2.FASTA],n(4004),n(9943),n(5393);var Ke,qe=n(6584);!function(e){e.TYPE="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[e.MAX_ATOM_COUNT=999]="MAX_ATOM_COUNT",e.RGP_LINE_START="M RGP",e.ATOM_ALIAS_LINE_START="A ",e.END="M END"}(Ke||(Ke={}));class Xe{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 n=e;const s=this.isWhitespace(n)?t:t-1;for(let e=0;e<s;e++)n=this.getNextColumnIdx(n);return n}parseAtomTypes(){const e=this.atomCount,t=new Array(e);let n=this.getAtomBlockIdx();for(let s=0;s<e;s++)n=this.shiftIdxToAtomType(n),t[s]=this.parseAtomType(n),n=this.getNextLineIdx(n);return t}parseAtomCoordinates(){const e=new Float32Array(this.atomCount),t=new Float32Array(this.atomCount),n=new Float32Array(this.atomCount);let s=this.getAtomBlockIdx();for(let r=0;r<this.atomCount;r++){s=this.shiftIdxToXColumn(s);for(const i of[e,t,n])i[r]=this.parseFloatValue(s),s=this.getNextColumnIdx(s);s=this.getNextLineIdx(s)}return{x:e,y:t,z:n}}parseBondedAtomPairs(){const e=new Array(this.bondCount);let t=this.getBondBlockIdx();for(let n=0;n<this.bondCount;n++){t=this.shiftIdxToBondedAtomsPair(t);const s=new Uint16Array(2);s[0]=this.parseIntValue(t),t=this.getNextColumnIdx(t),s[1]=this.parseIntValue(t),e[n]=s,t=this.getNextLineIdx(t)}return e}parseBondTypes(){const e=this.bondCount,t=new Uint16Array(e);let n=this.getBondBlockIdx();for(let s=0;s<e;s++)n=this.shiftIdxToBondType(n),t[s]=this.parseIntValue(n),n=this.getNextLineIdx(n);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 n=t+1;for(;!this.isWhitespace(n);)++n;return e(this.fileContent.substring(t,n))}}class Ze extends Xe{constructor(e){super(e),this.init(e)}init(e){super.init(e)}parseAtomType(e){let t=e,n=t;return this.isQuote(t)?(n=this.getNextIdenticalChar(t),t++):n=this.fileContent.indexOf(" ",n),this.fileContent.substring(t,n)}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&&!((n=this.fileContent.charCodeAt(t+1))>64&&n<91||n>96&&n<123);var n}))}isFragment(){return this.isQueryOrFragment((e=>82===e||42===e))}isQueryOrFragment(e){const t=this.atomCount;let n=this.getAtomBlockIdx();for(let s=0;s<t;s++){if(n=this.shiftIdxToAtomType(n),e(this.fileContent.charCodeAt(n),n))return!0;n=this.getNextLineIdx(n)}return!1}}class ze extends Ze{constructor(e){super(e)}getAtomLines(){const e=this.getAtomBlockIdx(),t=this.getBondBlockIdx();return this.fileContent.substring(e,t).split("\n").slice(0,this.atomCount)}getBondLines(){const e=this.getBondBlockIdx();return this.fileContent.substring(e).split("\n").slice(0,this.bondCount)}getRGroupIdToAtomicIdxMap(){const e=new Map,t=this.fileContent.split("\n");t.filter((e=>e.startsWith(Ke.RGP_LINE_START))).forEach((t=>{const n=this.getAtomIdxToRgpIdxList(t);for(const[t,s]of n){if(e.has(t))throw new Error(`R group ${t} is already in the map`);e.set(t,s)}}));const n=t.map(((e,t)=>{if(e.startsWith(Ke.ATOM_ALIAS_LINE_START))return t})).filter((e=>void 0!==e)),s=n.map((e=>t[e])),r=n.map((e=>t[e+1]));s.forEach(((t,n)=>{const s=parseInt(t.split(/\s+/)[1])-1,i=parseInt(r[n].substring(1));if(e.has(i))throw new Error(`R group ${i} is already in the map`);e.set(i,s)}));const i=this.getRGroupAtomicIndices().filter((t=>!Array.from(e.values()).includes(t)));if(0!==i.length)throw new Error(`Unaccounted R group indices: ${i}`);return e}getAtomIdxToRgpIdxList(e){const t=e.split(/\s+/).filter((e=>e)).slice(3).map((e=>parseInt(e))),n=new Array(t.length/2);for(let e=0;e<t.length;e+=2)n[e/2]=[t[e+1],t[e]-1];return n}getRGroupAtomicIndices(){return this.atomTypes.map(((e,t)=>{if(e.includes("R#"))return t})).filter((e=>void 0!==e))}static isValidMolfile(e){return-1!==e.indexOf(Ke.TYPE)&&-1!==e.indexOf(Ke.END)}shiftIdxToAtomType(e){return this.shiftIdxToSpecifiedColumn(e,Ke.ATOM_TYPE_COL)}getCountsLineIdx(){let e=0;for(let t=0;t<Ke.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,Ke.FIRST_BONDED_ATOM_COL)}shiftIdxToBondType(e){return this.shiftIdxToSpecifiedColumn(e,Ke.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+Ke.NUM_OF_COUNTS_DIGITS;const n=parseInt(this.fileContent.substring(e,t));return e=t,t+=Ke.NUM_OF_COUNTS_DIGITS,{atomCount:n,bondCount:parseInt(this.fileContent.substring(e,t))}}}class Je extends Ze{constructor(e){super(e),this.init(e)}getAtomLines(){const e=this.getAtomBlockIdx(),t=this.getBondBlockIdx();return this.fileContent.substring(e,t).split("\n").slice(0,this.atomCount)}getBondLines(){const e=this.getBondBlockIdx();return this.fileContent.substring(e).split("\n").slice(0,this.bondCount)}getRGroupIdToAtomicIdxMap(){const e=new Map;return this.getAtomLines().forEach(((t,n)=>{const s=t.match(/RGROUPS=\(([\d\s]+)\)/);if(s){const t=s[1].split(/\s+/).map((e=>parseInt(e)));if(t.length>2)throw new Error(`R group data ${t} has more than 2 elements`);const r=t[1];if(e.has(r))throw new Error(`R group ${r} is already in the map`);e.set(r,n)}})),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 isValidMolfile(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 n=parseInt(this.fileContent.substring(e,t));return e=t+1,t=this.fileContent.indexOf(" ",e+1),{atomCount:n,bondCount:parseInt(this.fileContent.substring(e,t))}}}class Qe{constructor(){}static getInstance(e){if(Qe.isMolfileV2K(e))return new ze(e);if(Qe.isMolfileV3K(e))return new Je(e);throw new Error("Malformed molfile")}static isMolfileV2K(e){return ze.isValidMolfile(e)}static isMolfileV3K(e){return Je.isValidMolfile(e)}}var et=n(8277),tt={};tt.styleTagTransform=C(),tt.setAttributes=y(),tt.insert=f().bind(null,"head"),tt.domAPI=m(),tt.insertStyleElement=b(),h()(et.Z,tt),et.Z&&et.Z.locals&&et.Z.locals;class nt{constructor(e,t=undefined,n=undefined){this.source=t,this.error=n,this._monomers={},this._onChanged=new c.Subject,this._monomers=e;for(const[e,t]of Object.entries(this._monomers))for(const[e,n]of Object.entries(t))n.lib=this}addMissingMonomer(e,t){let n=this._monomers[e];n||(n=this._monomers[e]={});let s=t;return t===oe.lh[ie.r2.HELM]?s="Gap":("PEPTIDE"===e&&"X"===t||"RNA"===e&&"N"===t)&&(s="Any"),n[t]={symbol:t,name:s,molfile:"",author:"MISSING",id:-1,rgroups:me().count(1).take(9).map((e=>({capGroupSmiles:"",alternateId:"",capGroupName:"",label:`R${e.toString()}`}))).toArray(),smiles:"",polymerType:e,monomerType:void 0,createDate:null}}getMonomer(e,t){let n=t;return"RNA"==e&&"R"==n&&(n="r"),"RNA"==e&&"P"==n&&(n="p"),e in this._monomers&&n in this._monomers[e]?this._monomers[e][n]:null}getPolymerTypes(){return Object.keys(this._monomers)}getMonomerMolsByPolymerType(e){const t={};return Object.keys(this._monomers[e]??{}).forEach((n=>{t[n]=this._monomers[e][n].molfile})),t}getMonomerSymbolsByType(e){return Object.keys(this._monomers[e])}getMonomerSymbolsByRGroup(e,t,n){let s=this.getMonomerSymbolsByType(t).map((e=>this.getMonomer(t,e)));return s=s.filter((e=>null!==e)),0===s.length?[]:(s=s.filter((t=>{if(!t?.rgroups)return!1;let n=t?.rgroups.length>=e;return Qe.getInstance(t.molfile).atomTypes.map(((e,t)=>"R#"===e?t:-1)).filter((e=>-1!==e)),n&&(n=!0),n})),s.map((e=>e?.symbol)))}get onChanged(){return this._onChanged}_updateInt(e){const t=e.getPolymerTypes(),n=this.getPolymerTypes();t.forEach((t=>{n.includes(t)||(this._monomers[t]={}),e.getMonomerSymbolsByType(t).forEach((n=>{this._monomers[t][n]=e.getMonomer(t,n)}))}))}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()}getSummaryObj(){const e={},t=this.getPolymerTypes();for(const n of t)e[n]=this.getMonomerSymbolsByType(n).length;return e}getSummaryDf(){const e=this.getPolymerTypes(),t=new Array(e.length);for(const[n,s]of me().enumerate(e))t[s]=this.getMonomerSymbolsByType(n).length;return a.DataFrame.fromColumns([a.Column.fromStrings("polymerType",e),a.Column.fromList(a.COLUMN_TYPE.INT,"count",t)])}getSummary(){const e=this.getPolymerTypes();return 0==e.length?"empty":e.map((e=>`${e} ${this.getMonomerSymbolsByType(e).length}`)).join("\n")}getTooltip(e,t){const n=o.div([],{classes:"ui-form ui-tooltip"}),s=this.getMonomer(e,t);if(s){const e=s.symbol;s.name,n.append(o.divH([o.div([e],{style:{fontWeight:"bolder",textWrap:"nowrap",marginRight:"6px"}}),o.div([s.name])],{style:{display:"flex",flexDirection:"row",justifyContent:"left"}}));const t={autoCrop:!0,autoCropMargin:0,suppressChiralText:!0};let r;r=s.molfile?i.chem.svgMol(s.molfile,void 0,void 0,t):s.smiles?o.divV([i.chem.svgMol(s.smiles,void 0,void 0,t),o.divText("from smiles",{style:{fontSize:"smaller"}})]):o.divText("No structure",{style:{margin:"6px"}}),n.append(o.div(r,{style:{display:"flex",flexDirection:"row",justifyContent:"center",margin:"6px"}})),n.append(o.divText(s.lib?.source??"unknown"))}else n.append(o.divV([o.divText(`Monomer '${t}' of type '${e}' not found.`),o.divText("Open the Context Panel, then expand Manage Libraries")]));return n}}var st=n(5128),rt=n.n(st),it=n(3351),ot=n.n(it);class at{constructor(e){this.helmMonomerSchema=e;const t=new(rt())({allErrors:!0,strictTuples:!1});ot()(t),this.validateMonomerSchema=t.compile(this.helmMonomerSchema)}validateFile(e,t){const n=this.parseJson(e);return null!==n&&(Array.isArray(n)?this.validateJsonContent(n,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 n=!0;for(const s of e)if(n=this.validateMonomerSchema(s),!n){console.warn(`Bio: Monomer Library File Validator:\nfile ${t}\n monomer violating JSON schema:`,s,"\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 n}}class lt{constructor(e,t,n){this.fileValidator=e,this.libHelper=t,this.eventManager=n,this.filesPromise=Promise.resolve(),this.objId=++lt.objCounter,this.eventManager.updateValidLibraryFileListRequested$.subscribe((async()=>{await this.updateValidLibraryList()}))}toLog(){return`MonomerLibFileManager<${this.objId}>`}static async create(e,t){const n=await i.dapi.files.readAsText("System:AppData/Bio/tests/libraries/HELMmonomerSchema.json"),s=JSON.parse(n),r=new at(s);return new lt(r,e,t)}async addLibraryFile(e,t){try{if(await this.libraryFileExists(t))return void i.shell.error(`File ${t} already exists`);await this.validateAgainstHELM(e,t),await i.dapi.files.writeAsText(qe.BX+`${t}`,e),await this.updateValidLibraryList(),await i.dapi.files.exists(qe.BX+`${t}`)?i.shell.info(`Added ${t} HELM library`):i.shell.error(`Failed to add ${t} library`)}catch(e){console.error(e),i.shell.error(`Failed to add ${t} library`)}}async deleteLibraryFile(e){try{await i.dapi.files.delete(qe.BX+`${e}`),await this.updateValidLibraryList(),i.shell.info(`Deleted ${e} library`)}catch(t){console.error(t),await i.dapi.files.exists(qe.BX+`${e}`)?i.shell.error(`Failed to delete ${e} library`):i.shell.warning(`File ${e} already deleted, refresh the list`)}}async loadLibraryFromFile(e,t){let n=[];const s=new a.FileSource(e),r=await s.readAsText(t);n=JSON.parse(r);const i={},o=[];return n.forEach((e=>{const t=e.polymerType,n=e.symbol;o.includes(t)||(i[t]={},o.push(t)),i[t][n]=e})),new nt(i,t)}getValidLibraryPaths(){return this.eventManager.getValidFilesPathList()}async getValidLibraryPathsAsynchronously(){return await this.eventManager.getValidLibraryPathsAsynchronously()}async libraryFileExists(e){return await i.dapi.files.exists(qe.BX+`${e}`)}async updateValidLibraryList(){const e=`${this.toLog()}.updateValidLibraryList()`;return Kt.logger.debug(`${e}, start`),this.filesPromise=this.filesPromise.then((async()=>{Kt.logger.debug(`${e}, IN`);const t=[],n=await this.getFilePathsAtDefaultLocation();if(!this.fileListHasChanged(n))return void Kt.logger.debug(`${e}, end, not changed`);for(const e of n){if(!e.endsWith(".json")){t.push(e);continue}const n=await i.dapi.files.readAsText(qe.BX+`${e}`);this.isValidHELMLibrary(n,e)||t.push(e)}const s=n.filter((e=>!t.includes(e)));if(this.fileListHasChanged(s)&&(this.eventManager.changeValidFilesPathList(s),this.libHelper.loadLibraries(!0)),s.some((e=>!e.endsWith(".json")))&&Kt.logger.warning(`Wrong validation: ${s}`),t.length>0){const e=`Invalid monomer library files in ${qe.BX}, consider fixing or removing them: ${t.join(", ")}`;Kt.logger.warning(e)}Kt.logger.debug(`${e}, OUT`)}))}fileListHasChanged(e){const t=this.eventManager.getValidFilesPathList();return e.length!==t.length||e.some(((e,n)=>e!==t[n]))}async validateAgainstHELM(e,t){if(!this.isValidHELMLibrary(e,t))throw new Error(`File ${t} does not satisfy HELM standard`)}isValidHELMLibrary(e,t){return this.fileValidator.validateFile(e,t)}async getFilePathsAtDefaultLocation(){const e=(await i.dapi.files.list(qe.BX)).map((e=>e.fullPath)),t=[];for(const n of e)await i.dapi.files.exists(n)&&t.push(n);return t.map((e=>e.substring(qe.BX.length)))}}lt.objCounter=-1;class ct{constructor(){this._libraryFilesUpdateSubject$=new c.BehaviorSubject([]),this._addLibraryFilesSubject$=new c.Subject,this._librarySelectionSubject$=new c.Subject}static getInstance(){return ct._instance||(ct._instance=new ct),ct._instance}getValidFilesPathList(){return this._libraryFilesUpdateSubject$.getValue()}async getValidLibraryPathsAsynchronously(){return new Promise((e=>{this._libraryFilesUpdateSubject$.pipe((0,P.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])}}class ut{get eventManager(){return this._eventManager}async awaitLoaded(e=3e3){return await Promise.race([(async()=>{const e=await this.getFileManager();return await e.filesPromise,!0})(),(async()=>(await(0,Me.gw)(e),!1))()]).then((t=>{if(!t)throw new Error(`Loading monomer libraries is timeout ${e} ms.`)}))}constructor(){this._monomerLib=new nt({},"MAIN"),this.loadLibrariesPromise=Promise.resolve()}getBioLib(){return this._monomerLib}async getFileManager(){return void 0===this._fileManagerPromise&&(this._fileManagerPromise=(async()=>await lt.create(this,this._eventManager))()),this._fileManagerPromise}async loadLibraries(e=!1){return this.loadLibrariesPromise=this.loadLibrariesPromise.then((async()=>{try{const[t,n]=await Promise.all([(await this.getFileManager()).getValidLibraryPaths(),(0,qe.nW)()]),s=t.filter((e=>{const t=!n.exclude.includes(e),s=0===n.explicit.length||n.explicit.includes(e);return t&&s})),r=await Promise.all(s.map((e=>this.readLibrary(qe.BX,e).catch((t=>{const n=`Loading monomers from '${e}' error: ${t instanceof Error?t.message:t.toString()}`;return new nt({},e,n)})))));this._monomerLib.updateLibs(r,e)}catch(e){const t=`Loading monomer libraries error: ${e instanceof Error?e.message:e.toString()}`;i.shell.warning(t);const n=e instanceof Error?e.stack:void 0;Kt.logger.error(t,void 0,n)}}))}async readLibrary(e,t){const n=await this.getFileManager();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 n=await(0,qe.nW)();n.exclude=(await this.getFileManager()).getValidLibraryPaths().filter((t=>!e.includes(t))),await(0,qe.tW)(n)}async getInvalidFileNames(e){const t=(await this.getFileManager()).getValidLibraryPaths();return e.filter((e=>!t.includes(e)))}static async getInstance(){let e=window.$monomerLibHelperPromise;return void 0===e&&(e=window.$monomerLibHelperPromise=(async()=>{const e=new ut;return e._eventManager=ct.getInstance(),e})()),e}}n(3336);var ht=n(8710),dt={};dt.styleTagTransform=C(),dt.setAttributes=y(),dt.insert=f().bind(null,"head"),dt.domAPI=m(),dt.insertStyleElement=b(),h()(ht.Z,dt),ht.Z&&ht.Z.locals&&ht.Z.locals;var mt,pt=function(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))};class ft{constructor(e,t,n=!1,s){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=n,this._autoStartFirstStep=null!==(r=null==s?void 0:s.autoStartFirstStep)&&void 0!==r&&r,this._progress.max=0,this._progress.value=1,ft.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 n=o.iconFA("clock");this._isAutomatic||0===t&&(n=o.iconFA("play",(()=>this._nextStep()),"Next step"),n.className="grok-icon fas fa-play");const s=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([n,s],"grok-tutorial-entry");this._activity.append(i,r)}}_initRoot(){var e,t,n;i.shell.windows.showContextPanel=!0,i.shell.windows.showHelp=!1;const s=Array.from(i.shell.dockManager.rootNode.children)[0];this._node=i.shell.dockManager.dock(this._root,a.DOCK_TYPE.FILL,s,""),(null===(t=null===(e=s.parent.container.containerElement.firstElementChild)||void 0===e?void 0:e.lastElementChild)||void 0===t?void 0:t.classList.contains("tab-handle-list-container"))&&(null===(n=s.parent.container.containerElement.firstElementChild)||void 0===n||n.lastElementChild.remove()),this._node.container.containerElement.classList.add("tutorials-demo-script-container"),this._addHeader(),this._root.append(this._mainHeader),this._addDescription(),this._root.append(this._activity)}_nextStep(){var e,t;return pt(this,void 0,void 0,(function*(){this._isStepProcessed=!0,this._isAutomatic||(this._nextStepBtn.classList.add("disabled"),this._nextStepBtn.firstChild.classList.add("fa-disabled"));const n=this._activity.getElementsByClassName("grok-tutorial-entry")[this._currentStep],s=this._activity.getElementsByClassName("grok-icon")[this._currentStep],r=this._activity.getElementsByClassName("grok-tutorial-step-description")[this._currentStep];s.className="grok-icon far fa-spinner-third fa-spin",r.classList.remove("hidden"),r.classList.add("visible");const i=n,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(n,s,a),yield(0,Me.gw)(a));const l=o.iconFA("check");if(s.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 pt(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,n){return pt(this,void 0,void 0,(function*(){const s=o.div([],"demo-script-countdown");t.classList.add("hidden");let r=n/1e3;const i=this._createSVGIndicator(r);s.append(i),e.prepend(s);const a=setInterval((()=>{r--,0===r&&(clearInterval(a),s.remove(),t.classList.remove("hidden"),t.classList.add("visible"))}),1e3)}))}_createSVGIndicator(e){const t=document.createElementNS("http://www.w3.org/2000/svg","svg"),n=document.createElementNS("http://www.w3.org/2000/svg","circle");return n.setAttributeNS(null,"cx","7"),n.setAttributeNS(null,"cy","7"),n.setAttributeNS(null,"r","6"),n.setAttributeNS(null,"style",`animation: countdown ${e}s linear infinite forwards`),t.append(n),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,ft.currentObject=null}step(e,t,n){return this._steps[this.steps.length]={name:e,func:t,options:n},this}start(){return pt(this,void 0,void 0,(function*(){this._initRoot(),i.shell.newView(this.name),this._isAutomatic?this._startScript():this._autoStartFirstStep&&(yield this._nextStep())}))}}ft.currentObject=null,function(e){e.X="Embed_X",e.Y="Embed_Y"}(mt||(mt={}));var gt,yt,wt,bt=function(e,t,n,s){return new(n||(n=Promise))((function(r,i){function o(e){try{l(s.next(e))}catch(e){i(e)}}function a(e){try{l(s.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((s=s.apply(e,t||[])).next())}))};n(7905),function(e){e.ADD="ADD",e.SUB="SUB",e.MULT="MULT"}(gt||(gt={})),function(e){e.SQUARE="SQUARE",e.INVERSE="INVERSE",e.TRANSPOSE="TRANSPOSE",e.NORM="NORM",e.COLUMN_NORM="COLUMN_NORM"}(yt||(yt={})),function(e){e.SCALARMULT="SCALARMULT",e.SCALARADD="SCALARADD",e.SCALARPOW="SCALARPOW"}(wt||(wt={})),n(8341);var At=n(2568);n(6098),n(525),n(9416),new class{constructor(){this.tooltipHandlerTemp="tooltip-handler.Monomer"}};class Ct 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,n,s,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,ie.py)(i.cell.column.getTag(je.DX.alphabet)),l=i.cell.value;if(!l)return;const c=a.get(l);e.fillStyle=c,e.fillText((0,ie.GU)(l,6),t+s/2,n+r/2,s)}}class vt 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,n]=(0,he.yf)(e);i.shell.error(t),this.logger.error(t,void 0,n)}}n(8770);class Tt extends a.Widget{constructor(e){super(o.divV([])),this.viewed=!1,this.wlViewer=null,this.seqCol=e}async init(){const e=oe.g.forColumn(this.seqCol),t=Kt.properties.TooltipWebLogo,n=this.seqCol.getTag(Le.DX.tooltipWebLogo);!1===t||["false","off","disable","disabled"].includes(n)||(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,positionNames:"",endPositionName:"50"}),this.wlViewer.root.style.height="50px",this.root.appendChild(this.wlViewer.root),this.root.style.width="100%")}detach(){this.wlViewer&&(this.wlViewer.detach(),this.wlViewer=null),super.detach()}}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(ie.CI);var St=n(8601);const Et=OCL;class _t{constructor(e){const t=e.split("|");t.forEach((e=>this.validateConnectionItem(e))),this.connectionItems=t}validateConnectionItem(e){const t="(PEPTIDE|RNA)",n=new RegExp(`${t}[0-9]+,${t}[0-9]+,[0-9]+:R[0-9]+-[0-9]+:R[0-9]+`,"g");if(!e.match(n))throw new Error(`Cannot parse connection item from ${e}`)}getConnectionData(){const e=[];return this.connectionItems.forEach((t=>{const n=[],s=t.split(",");s[2].split("-").forEach(((e,t)=>{const r=s[t],i=e.split(":"),o={monomerIdx:parseInt(i[0])-1,rGroupId:parseInt(i[1].slice(1))};n.push({polymerId:r,bond:o})})),e.push(n)})),e}}class xt{constructor(e){this.simplePolymer=e,this.polymerType=this.getPolymerType(),this.idx=this.getIdx();const{monomers:t,monomerTypes:n}=this.getMonomerSymbolsAndTypes();this.monomers=t,this.monomerTypes=n}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("."),n=[],s=[];return t.forEach((e=>{n.push(e),s.push("Backbone")})),{monomers:n,monomerTypes:s}}getBondData(){const e=[],t=this.monomerTypes.map(((e,t)=>{if("Backbone"===e)return t})).filter((e=>void 0!==e)),n=this.monomerTypes.map(((e,t)=>{if("Branch"===e)return t})).filter((e=>void 0!==e));for(let n=0;n<t.length-1;n++){const s=t[n],r=t[n+1];e.push([{monomerIdx:s,rGroupId:2},{monomerIdx:r,rGroupId:1}])}for(let t=0;t<n.length;t++){const s=n[t],r=s-1;e.push([{monomerIdx:r,rGroupId:3},{monomerIdx:s,rGroupId:1}])}return e}}class Pt{constructor(e){this.helmString=e;const t=this.helmString.split("$"),n=t[0].split("|");this.simplePolymers=n.map((e=>new xt(e))),""!==t[1]&&(this.connectionList=new _t(t[1])),this.bondData=this.getBondData(),this.bondedRGroupsMap=this.getBondedRGroupsMap()}getBondedRGroupsMap(){const e=new Map;return this.bondData.forEach((t=>{t.forEach((t=>{const n=t.monomerIdx,s=t.rGroupId;e.get(n)||e.set(n,[]),e.get(n).push(s)}))})),e}toString(){return this.helmString}getPolymerTypeByMonomerIdx(e){return this.getSimplePolymerByMonomerIdx(e).polymerType}getSimplePolymerByMonomerIdx(e){const t=this.getMonomerIdxShifts(),n=Object.values(t).sort(((e,t)=>e-t)).find((t=>e>=t));if(void 0===n)throw new Error(`Cannot find simple polymer for monomer ${e}`);const s=Object.keys(t).find((e=>t[e]===n));return this.simplePolymers.find((e=>e.id===s))}shiftBondMonomerIds(e,t){t.forEach((t=>{t.forEach((t=>{t.monomerIdx+=e}))}))}getMonomerIdxShifts(){const e={};let t=0;return this.simplePolymers.forEach((n=>{e[n.id]=t,t+=n.monomers.length})),e}getBondData(){const e=this.getMonomerIdxShifts(),t=[];return this.simplePolymers.forEach((n=>{const s=n.getBondData(),r=e[n.id];this.shiftBondMonomerIds(r,s),t.push(...s)})),this.connectionList&&this.connectionList.getConnectionData().forEach((n=>{const s=[];n.forEach((t=>{const n=e[t.polymerId],r=t.bond;r.monomerIdx+=n,s.push(r)})),t.push(s)})),t}}class Nt{constructor(e){this.monomerSymbol=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:n}=this.atoms.atomCoordinates[e];this.atoms.shift({x:-t,y:-n})}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],n=t.y/t.x,s=Math.atan(n);if(isNaN(s))throw new Error(`Cannot calculate angle for R2 group for monomer ${this.monomerSymbol}`);this.rotateCoordinates(-s)}shiftMonomerToDefaultPosition(){this.shiftR1GroupToOrigin(),null!==this.rGroups.getAtomicIdx(2)&&this.alignR2AlongX()}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)}shiftBonds(e){this.bonds.shift(e)}capRGroups(e){this.rGroups.capRGroups(e)}}class $t{constructor(e,t,n){this.atoms=t,this.bonds=n,this.rGroupBondPositionMap=new Map,this.rGroupIdToAtomicIndexMap=e.getRGroupIdToAtomicIdxMap()}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,n])=>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 n=this.bonds.getPositionsInBonds(t+1);if(0===n.length)throw new Error(`Cannot find position for R group ${e}`);if(n.length>1)throw new Error(`More than one position for R group ${e}`);const s=n[0];return this.bonds.replacePositionsInBondsByDummy([s]),this.bonds.removeAtomIdFromBonds(t+1),this.removeRGroupFromAtomicIdxMap(e,t),s}removeRGroupFromAtomicIdxMap(e,t){this.rGroupIdToAtomicIndexMap.delete(e);for(const[e,n]of this.rGroupIdToAtomicIndexMap)n>t&&this.rGroupIdToAtomicIndexMap.set(e,n-1)}deleteBondLineWithSpecifiedRGroup(e){const t=this.rGroupBondPositionMap.get(e);if(!t)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:n}=t;this.bonds.deleteBondLines([n]),this.rGroupBondPositionMap.delete(e),this.rGroupIdToAtomicIndexMap.delete(e),this.rGroupBondPositionMap.forEach((e=>{e.bondLineIdx>n&&(e.bondLineIdx-=1)}))}replaceRGroupWithAttachmentAtom(e,t){const n=this.rGroupBondPositionMap.get(e);if(!n)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:s,nodeIdx:r}=n;this.bonds.bondedAtoms[s][r]=t}getAttachmentAtomIdByRGroupId(e){const t=this.rGroupBondPositionMap.get(e);if(!t)throw new Error(`Cannot find position for R group ${e}`);const{bondLineIdx:n,nodeIdx:s}=t;return this.bonds.bondedAtoms[n][(s+1)%2]}capRGroups(e){this.rGroupIdToAtomicIndexMap.forEach(((t,n)=>{const s=e[n-1];"H"===s?(this.removeRGroups([n]),this.deleteBondLineWithSpecifiedRGroup(n)):this.atoms.replaceRGroupSymbolByElement(t,s)}))}}class Mt{constructor(){this.coordinates=[],this.rawAtomLines=[]}get atomCoordinates(){return this.coordinates}replaceRGroupSymbolByElement(e,t){this.rawAtomLines[e]=this.rawAtomLines[e].replace("R#",t)}deleteAtoms(e){this.coordinates=this.coordinates.filter(((t,n)=>!e.includes(n))),this.rawAtomLines=this.rawAtomLines.filter(((t,n)=>!e.includes(n)))}shift(e){this.coordinates=this.coordinates.map((t=>{const n=t.x+e.x,s=t.y+e.y;if(isNaN(n)||isNaN(s))throw new Error(`Cannot shift coordinates by ${e.x}, ${e.y}`);return{x:n,y:s}}))}rotate(e){this.coordinates=this.coordinates.map((t=>{const n=t.x,s=t.y,r=n*Math.cos(e)-s*Math.sin(e),i=n*Math.sin(e)+s*Math.cos(e);if(isNaN(r)||isNaN(i))throw new Error(`Cannot rotate coordinates by ${e}`);return{x:r,y:i}}))}}class Lt extends Mt{constructor(e){super(),this.rawAtomLines=e.getAtomLines(),this.coordinates=this.rawAtomLines.map((e=>({x:parseFloat(e.substring(0,10)),y:parseFloat(e.substring(10,20))})))}get atomLines(){return this.rawAtomLines.map(((e,t)=>{const n=this.coordinates[t];return`${n.x.toFixed(4).padStart(10," ")}${n.y.toFixed(4).padStart(10," ")}${e.substring(20)}`}))}}class It{constructor(){this.bondedAtomPairs=[],this.rawBondLines=[]}get bondedAtoms(){return this.bondedAtomPairs}deleteBondLines(e){this.rawBondLines=this.rawBondLines.filter(((t,n)=>!e.includes(n))),this.bondedAtomPairs=this.bondedAtomPairs.filter(((t,n)=>!e.includes(n)))}getPositionsInBonds(e){const t=[];return this.bondedAtomPairs.forEach(((n,s)=>{n.forEach(((n,r)=>{n===e&&t.push({bondLineIdx:s,nodeIdx:r})}))})),t}replacePositionsInBondsByDummy(e,t){void 0===t&&(t=-1),e.forEach((e=>{const{bondLineIdx:n,nodeIdx:s}=e;this.bondedAtomPairs[n][s]=t}))}removeAtomIdFromBonds(e){this.bondedAtomPairs=this.bondedAtomPairs.map((t=>t.map((t=>t>e?t-1:t))))}shift(e){this.bondedAtomPairs=this.bondedAtomPairs.map((t=>t.map((t=>t+e))))}}class Rt extends It{constructor(e){super(),this.rawBondLines=e.getBondLines(),this.bondedAtomPairs=this.rawBondLines.map((e=>[parseInt(e.substring(0,3)),parseInt(e.substring(3,6))]))}getBondLines(){return this.bondedAtomPairs.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)}`}))}}class Ot extends Nt{constructor(e,t){super(t);const n=Qe.getInstance(e);this.atoms=new Lt(n),this.bonds=new Rt(n),this.rGroups=new $t(n,this.atoms,this.bonds),this.shiftMonomerToDefaultPosition()}}class Dt extends Mt{constructor(e){super(),this.molfileHandler=e,this.rawAtomLines=e.getAtomLines(),this.coordinates=this.getCoordinates()}getCoordinates(){const e=this.molfileHandler.x,t=this.molfileHandler.y;return Array.from(e).map(((e,n)=>({x:e,y:t[n]})))}get atomLines(){const e=/^(M V30 [^-]*)(-?\d+\.\d+)( )(-?\d+\.\d+)( -?\d+\.\d+.*)$/,t=/\sRGROUPS=\(\d+(\s+\d+)*\)/;return this.rawAtomLines.map(((n,s)=>{const r=this.coordinates[s],i=r.x.toFixed(4)+"00",o=r.y.toFixed(4)+"00";return n.replace(e,((e,t,n,s,r,a)=>t+i+s+o+a)).replace(t,"")}))}replaceRGroupSymbolByElement(e,t){super.replaceRGroupSymbolByElement(e,t);const n=this.rawAtomLines[e].substring(3).split(" ");n.length>7&&(this.rawAtomLines[e]=`M ${n.slice(0,7).join(" ")}`)}}class Ft extends It{constructor(e){super(),this.molfileHandler=e,this.rawBondLines=e.getBondLines(),this.bondedAtomPairs=this.getBondedAtomPairs()}getBondedAtomPairs(){return this.molfileHandler.pairsOfBondedAtoms.map((e=>[e[0],e[1]]))}getBondLines(){const e=/^(M\s+V30\s+\d+\s+\d+\s+)(\d+)(\s+)(\d+)(.*)$/;return this.bondedAtomPairs.map(((t,n)=>{if(t.some((e=>-1===e)))throw new Error(`Bonded pair ${t} contains -1`);return this.rawBondLines[n].replace(e,((e,n,s,r,i,o)=>`${n}${t[0]}${r}${t[1]}${o}`))}))}}class kt extends Nt{constructor(e,t){super(t);const n=Qe.getInstance(e);this.atoms=new Dt(n),this.bonds=new Ft(n),this.rGroups=new $t(n,this.atoms,this.bonds),this.shiftMonomerToDefaultPosition()}}class Gt{static getInstance(e,t){if(Qe.isMolfileV2K(e))return new Ot(e,t);if(Qe.isMolfileV3K(e))return new kt(e,t);throw new Error("Unsupported molfile version")}}class Bt{constructor(e,t,n,s,r,i){this.monomerSymbol=e,this.monomerIdx=t,this.helm=n,this.monomerLib=i,this.capGroupElements=[];const o=this.getLibraryMonomerObject();let a=o.molfile;Qe.isMolfileV2K(a)&&(a=this.convertMolfileToV3KFormat(a,e,r)),this.molfileWrapper=Gt.getInstance(a,e),this.capGroupElements=this.getCapGroupElements(o),n.bondedRGroupsMap.has(t)&&this.removeRGroups(n.bondedRGroupsMap.get(t)),this.capRemainingRGroups(),this.shiftCoordinates(s)}convertMolfileToV3KFormat(e,t,n){let s=null;try{if(s=n.get_mol(e,JSON.stringify({mergeQueryHs:!0})),s)return s.get_v3Kmolblock();throw new Error(`Cannot convert ${t} to molV3000`)}finally{s?.delete()}}getLibraryMonomerObject(){const e=this.helm.getPolymerTypeByMonomerIdx(this.monomerIdx),t=this.monomerLib.getMonomer(e,this.monomerSymbol);if(!t)throw new Error(`Monomer ${this.monomerSymbol} is not found in the library`);return t}getCapGroupElements(e){return e.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()}removeRGroups(e){this.molfileWrapper.removeRGroups(e)}capRemainingRGroups(){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 Ht{constructor(e,t,n){this.rdKitModule=t,this.monomerLib=n,this.monomerWrappers=[],this.helm=new Pt(e)}addMonomer(e,t,n){const s=new Bt(e,t,this.helm,n,this.rdKitModule,this.monomerLib);this.monomerWrappers.push(s)}getAtomNumberShifts(){const e=[];let t=0;return this.monomerWrappers.forEach((n=>{e.push(t),t+=n.getAtomLines().length})),e}restoreBondsBetweenMonomers(){this.helm.bondData.forEach((e=>{const t=e.map((e=>e.monomerIdx)),n=e.map((e=>e.rGroupId)),s=t.map((e=>this.monomerWrappers[e])),r=s[1].getAttachmentAtomByRGroupId(n[1]);s[0].replaceRGroupWithAttachmentAtom(n[0],r),s[1].deleteBondLineWithSpecifiedRGroup(n[1])}))}compileToMolfile(){const e=[],t=[],n=this.getAtomNumberShifts();this.monomerWrappers.forEach(((e,t)=>{e.shiftBonds(n[t])})),this.restoreBondsBetweenMonomers(),this.monomerWrappers.forEach((n=>{e.push(...n.getAtomLines()),t.push(...n.getBondLines())}));const s=e.length,r=t.length;return[this.getV3KHeader(s,r),this.getV3KAtomBlock(e),this.getV3KBondBlock(t),"M V30 END CTAB\nM END"].join("\n")}getV3KHeader(e,t){return`\n Datagrok\n\n 0 0 0 0 0 0 0 0 0 0999 V3000\nM V30 BEGIN CTAB\nM V30 COUNTS ${e} ${t} 0 0 1`}getV3KAtomBlock(e){const t=/^(M V30 )(\d+)( .*)$/;return["M V30 BEGIN ATOM",...e.map(((e,n)=>{const s=n+1;return e.replace(t,((e,t,n,r)=>t+s+r))})),"M V30 END ATOM"].join("\n")}getV3KBondBlock(e){const t=/^(M V30 )(\d+)( .*)$/;return["M V30 BEGIN BOND",...e.map(((e,n)=>{const s=n+1;return e.replace(t,((e,t,n,r)=>t+s+r))})),"M V30 END BOND"].join("\n")}}class Wt{constructor(e){this.molfileHandler=Qe.getInstance(e)}get monomerSymbols(){return this.molfileHandler.atomTypes}getMonomerShifts(e){return{x:this.molfileHandler.x[e],y:this.molfileHandler.y[e]}}}class Vt{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.convertToMolfileV3KColumn()).toList().map((e=>a.chem.convert(e,a.chem.Notation.MolBlock,a.chem.Notation.Smiles)))}async getMolV3000ViaOCL(e,t){const n=e.map((e=>{if(null===e)return"";const t=e.get_v3Kmolblock();return e.delete(),t})),s=new Array(n.length),r=a.TaskBarProgressIndicator.create("Handling chirality...");for(let e=0;e<n.length;e++){const t=Et.Molecule.fromMolfile(n[e]).toMolfileV3();s[e]=t.replace("STERAC1","STEABS");const i=e/n.length*100;r.update(i,`${i?.toFixed(2)}% of molecules completed`)}return r.close(),a.Column.fromStrings(t,s)}async convertToRdKitBeautifiedMolfileColumn(e){const t=(await this.convertToMolfileV3KColumn()).toList(),n=await i.functions.call("Chem:getRdKitModule"),s=t.map((e=>{if(""===e)return null;const t=n.get_mol(e);return t?(t.set_new_coords(),t.normalize_depiction(1),t.straighten_depiction(!0),t):null})),r=this.df.columns.getUnusedName(`molfile(${this.helmColumn.name})`);return e?await this.getMolV3000ViaOCL(s,r):a.Column.fromStrings(r,s.map((e=>{if(null===e)return"";const t=e.get_v3Kmolblock();return e.delete(),t})))}async convertToMolfileV3KColumn(){const e=await this.getPolymerGraphColumn(),t=await i.functions.call("Chem:getRdKitModule"),n=(await qt()).getBioLib(),s=e.toList().map(((e,s)=>{const r=this.helmColumn.get(s);if(!r)return"";let i="";try{i=this.getPolymerMolfile(r,e,t,n)}catch(e){const[t,n]=(0,he.yf)(e);Kt.logger.error(t,void 0,n)}finally{return i}})),r=this.df.columns.getUnusedName(`molfileV2K(${this.helmColumn.name})`);return a.Column.fromList("string",r,s)}async getPolymerGraphColumn(){return await i.functions.call("HELM:getMolfiles",{col:this.helmColumn})}getPolymerMolfile(e,t,n,s){const r=new Wt(t),i=new Ht(e,n,s);return r.monomerSymbols.forEach(((e,t)=>{const n=r.getMonomerShifts(t);i.addMonomer(e,t,n)})),i.compileToMolfile()}}var Ut=n(3277);function Yt(e){const t=["Embed_X","Embed_Y"],n=e.columns.names().filter((e=>e.includes(t[0]))).length+1;return t.map((e=>`${e}_${n}`))}function jt(e,t){return`${t} (${e.length>4?`${e.length} columns`:e.map((e=>e.name)).join(", ")})`}n(706);const Kt=new vt;async function qt(){return await ut.getInstance()}let Xt=null;function Zt(){return Xt}async function zt(e,t,n,s,r,c,u,h){if(!(0,At.n)(t,"Activity Cliffs"))return;const d=Yt(e),m={units:t.getTag(a.TAGS.UNITS),aligned:t.getTag(ie.DX.aligned),separator:t.getTag(ie.DX.separator),alphabet:t.getTag(ie.DX.alphabet)},p=c,f=t,g=async()=>await se(e,f,d,"Activity cliffs",n,s,p,r,{...h??{}},a.SEMTYPE.MACROMOLECULE,m,u,He,We,Ue),y=r===l.A.UMAP?2e5:2e4,w=r===l.A.UMAP?5e3:2e3;if(e.rowCount>y)return void i.shell.warning(`Too many rows, maximum for sequence activity cliffs is ${y}`);const b=a.TaskBarProgressIndicator.create("Running sequence activity cliffs ...");return new Promise(((t,n)=>{e.rowCount>w&&!h?.[Ut.sS]?o.dialog().add(o.divText("Activity cliffs analysis might take several minutes.\n Do you want to continue?")).onOK((async()=>{g().then((e=>t(e))).catch((e=>n(e)))})).onCancel((()=>{t(void 0)})).show():g().then((e=>t(e))).catch((e=>n(e)))})).catch((e=>{const[t,n]=(0,he.yf)(e);throw Kt.logger.error(t,void 0,n),e})).finally((()=>{b.close()}))}async function Jt(e,t,s,r,l,c,u,h){if((0,At.n)(t,"Sequence Space"))return c||(c=a.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0]),u??(u={}),await async function(e,t,s,r,l,c,u,h=!0,d=!1,m={preprocessingFuncArgs:[]},p={},f=null,g={}){const y={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 w=h?i.shell.tableView(e.name)??i.shell.addTableView(e):null,b=async()=>{const b=a.TaskBarProgressIndicator.create(`Initializing ${p.scatterPlotName??"dimensionality reduction"} ...`);let A;try{const C=Yt(e);function v(n,r,i){let l=null,c=null;e.columns.names().includes(C[0])?(l=e.columns.byName(C[0]),c=e.columns.byName(C[1])):(l=e.columns.add(a.Column.float(C[0],e.rowCount)),c=e.columns.add(a.Column.float(C[1],e.rowCount)),h&&!A&&(A=w.scatterPlot({...y,x:C[0],y:C[1],title:p.scatterPlotName??jt(t,s)}))),p[Ut.Ec]&&(A?.root&&o.setUpdateIndicator(A.root,!1),l.init((e=>i[0]?i[0][e]:void 0)),c.init((e=>i[1]?i[1][e]:void 0)));const u=n/r*100;b.update(u,`Running ${p.scatterPlotName??"dimensionality reduction"}... ${u.toFixed(0)}%`)}async function T(){e.columns.add(a.Column.float(C[0],e.rowCount)),e.columns.add(a.Column.float(C[1],e.rowCount));let n=null;h&&(A=w.scatterPlot({...y,x:C[0],y:C[1],title:p.scatterPlotName??jt(t,s)}),o.setUpdateIndicator(A.root,!0));const d=i.events.onViewerClosed.subscribe((e=>{const t=e.args.viewer;t?.getOptions()?.look?.title&&A?.getOptions()?.look?.title&&t?.getOptions()?.look?.title===A?.getOptions()?.look?.title&&(i.events.fireCustomEvent(O,{}),d.unsubscribe(),n?.(),b.close())})),f=new Promise((async(e,i)=>{try{n=e;const i=[];for(let e=0;e<c.length;++e){const n=c[e];if(m.distanceFnArgs||(m.distanceFnArgs=[]),n){const s=n.inputs[0].name,o=n.inputs[1].name,{entries:a,options:l}=await n.apply({[s]:t[e],[o]:r[e],...m.preprocessingFuncArgs[e]??{}});i.push({entries:a,options:l}),m.distanceFnArgs.push(l)}else{const n=t[e].toList(),s={};i.push({entries:n,options:s}),m.distanceFnArgs.push(s)}}e(await G(i.map((e=>e.entries)),s,r,l,u,m,p[Ut.sS]?void 0:v))}catch(e){i(e)}})),g=await f;return b.close(),d.unsubscribe(),g}const S=await T();if(d&&S){const E=a.TaskBarProgressIndicator.create("Clustering embeddings ...");try{const _=await function(e,t,s,r){return bt(this,void 0,void 0,(function*(){return new Promise((function(i,o){const a=new Worker(new URL(n.p+n.u(796),n.b));a.postMessage({embedX:e,embedY:t,minPts:r,epsilon:s}),a.onmessage=({data:{error:e,clusters:t}})=>{a.terminate(),e?o(e):i(t)}}))}))}(S[0],S[1],m.dbScanEpsilon??.01,m.dbScanMinPts??4),x=e.columns.getUnusedName("Cluster (DBSCAN)");e.columns.addNewString(x).init((e=>_[e].toString())),A&&(A.props.colorColumnName=x)}catch(P){i.shell.error("Clustering embeddings failed"),console.error(P)}finally{E.close()}}if(S){const N=e.columns.byName(C[0]),$=e.columns.byName(C[1]);if(N.init((e=>S[0][e])),$.init((e=>S[1][e])),f)try{const M=f.inputs[0].name,L=f.inputs[1].name;await f.prepare({[M]:N,[L]:$,...g}).call(!0)}catch(I){i.shell.error("Post-processing failed"),console.error(I)}if(A)return o.setUpdateIndicator(A.root,!1),A.helpUrl="/help/compute/sequence-space",A}}catch(R){i.shell.error("Dimensionality reduction failed"),console.error(R),b.close(),A&&o.setUpdateIndicator(A.root,!1)}};return new Promise((async(t,n)=>{try{if(p.fastRowCount&&e.rowCount>p.fastRowCount&&!p[Ut.sS])o.dialog().add(o.divText("Analysis might take several minutes. Do you want to continue?")).onOK((async()=>{try{const e=await b();t(e)}catch(e){n(e)}})).onCancel((()=>t(void 0))).show();else{const e=await b();t(e)}}catch(e){n(e)}}))}(e,[t],s,[r],[1],[c],"MANHATTAN",l,h??!1,{...u,preprocessingFuncArgs:[u.preprocessingFuncArgs??{}]},{fastRowCount:1e4,scatterPlotName:"Sequence space",bypassLargeDataWarning:u?.[Ut.sS]})}async function Qt(e,t,n){const s=a.TaskBarProgressIndicator.create("Converting to atomic level ...");try{const s=(await qt()).getBioLib();await async function(e,t,n,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(n){const n=oe.g.forColumn(t);return n.isHelm()||(t=n.convert(ie.r2.HELM)),async function(e,t){const n=await async function(e,t,n){const s=new Vt(t,e),r=await s.convertToRdKitBeautifiedMolfileColumn(void 0);return r.semType=a.SEMTYPE.MOLECULE,r}(e,t);e.columns.add(n,!0),await i.data.detectSemanticTypes(e)}(e,t)}if(!(0,At.n)(t,"To Atomic Level"))return;const r=await(0,St.i0)(e,t,s);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,n,s)}finally{s.close()}}function en(e){return new ae.i(e).importFasta()}function tn(e){const t=oe.g.forColumn(e).stats;return Object.keys(t.freq)}async function nn(e,t,n){return ue(e,t,n,re.IDENTITY)}async function sn(e,t,n){return ue(e,t,n,re.SIMILARITY)}},7983:(e,t,n)=>{"use strict";n.d(t,{QF:()=>c,pf:()=>l});var s=n(4469),r=(n(3870),n(976)),i=n(7241),o=(n(4293),n(2997)),a=n(8447);function l(e,t,n){const s=n?function(e,t){const n=`${t}`.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),s=e.charAt(0)===t,r=e.charAt(e.length-1)===t,i=e.replace(new RegExp(`^${n}|${n}$`,"g"),"");return s?r?`${n}${i}${n}`:`${n}${i}${n}|${n}${i}$`:r?`^${i}${n}|${n}${i}${n}`:`^${i}${n}|${n}${i}${n}|${n}${i}$`}(e,n):e,i=r.BitSet.create(t.length);for(let n=0;n<t.length;n++){const r=t.get(n);(r.match(s)||r===e)&&i.set(n,!0,!1)}return i}async function c(e,t){t.version!==t.temp["last-invalidated-version"]&&await async function(e,t){const n=r.TaskBarProgressIndicator.create(`Invalidating molfiles for ${e.name}`);try{await(0,o.gw)(10);const t=new Map,n=await(0,i.D)(e,!0,t);e.temp["monomeric-mols"]=n,e.temp["monomers-dict"]=t,e.temp["last-invalidated-version"]=e.version}finally{n.close()}}(t);const n=r.Column.string("helm",1).init((t=>e));n.semType=r.SEMTYPE.MACROMOLECULE,n.setTag(r.TAGS.UNITS,a.r2.HELM);const l=await(0,i.D)(n,!0,t.temp["monomers-dict"]);return(await s.functions.call("Chem:searchSubstructure",{molStringsColumn:t.temp["monomeric-mols"],molString:l.get(0),molBlockFailover:""})).get(0)}},2568:(e,t,n)=>{"use strict";n.d(t,{l:()=>a,n:()=>o});var s=n(4469),r=n(976),i=n(8607);function o(e,t,n=[],r=[],i=!0){const[o,l]=a(e,t,n,r);return i&&!o&&s.shell.warning(l),o}function a(e,t,n=[],o=[]){let a=!0,l="";const c=i.g.forColumn(e);if(e.semType!==r.SEMTYPE.MACROMOLECULE)s.shell.warning(t+" analysis is allowed for Macromolecules semantic type"),a=!1;else{const e=c.notation;if(n.length>0&&!n.some((t=>e.toUpperCase()==t.toUpperCase())))l=`${t} + ' analysis is allowed for Macromolecules with notation ${0==n.length?"any notation":`notation${n.length>1?"s":""} ${n.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,n)=>{"use strict";n.d(t,{Of:()=>i,WY:()=>u,jB:()=>h,mU:()=>a,rs:()=>c});var s,r,i,o=n(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"}(s||(s={})),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 u="3.3.1",h={pepsea:{gapOpen:1.53,gapExtend:0,method:o.Jy[0]},kalign:{gapOpen:-1,gapExtend:-1,terminalGap:-1}}},4004:(e,t,n)=>{"use strict";n.d(t,{o:()=>i}),n(976),n(3870);var s=n(4469),r=(n(3336),n(8447),n(8607));async function i(e,t,n){const i=r.g.forColumn(e).convert(t,n);e.dataFrame.columns.add(i);const o=await s.functions.call("Bio:detectMacromolecule",{col:i});return o&&(i.semType=o),await s.data.detectSemanticTypes(e.dataFrame),i}},6032:(e,t,n)=>{"use strict";n.d(t,{Ns:()=>o});var s=n(4469),r=n(2997),i=n(8341);async function o(e=6e4){const t=await i.lp.getDockerContainer();await async function(e,t=6e4){let n=e,i=!1;for(let o=0;o<t/200;++o){if(null===n&&(n=await s.dapi.docker.dockerContainers.find(e.id)),a(n)){i=!0;break}switch(n.status){case"stopped":await s.dapi.docker.dockerContainers.run(n.id);break;case"pending change":case"changing":break;case"error":throw new Error("Docker container error state.")}n=null,await(0,r.gw)(200)}if(!i)throw new Error("Docker container start timeout.")}(t,e)}function a(e){return"checking"===e.status||"started"===e.status}},525:(e,t,n)=>{"use strict";n.d(t,{K:()=>N});var s=n(4469),r=n(976),i=n(3870),o=n(2997),a=n(8447),l=n(8607),c=n(6098),u=n(8341),h=n(2568),d=n(3553),m=n(6032),p=n(7422),f=n(3379),g=n.n(f),y=n(7795),w=n.n(y),b=n(569),A=n.n(b),C=n(3565),v=n.n(C),T=n(9216),S=n.n(T),E=n(4589),_=n.n(E),x=n(9564),P={};async function N(e={}){return new Promise((async(t,n)=>{var a,l,h;e.clustersCol??(e.clustersCol=null),e.pepsea??(e.pepsea={}),(a=e.pepsea).method??(a.method=d.jB.pepsea.method),(l=e.pepsea).gapOpen??(l.gapOpen=d.jB.pepsea.gapOpen),(h=e.pepsea).gapExtend??(h.gapExtend=d.jB.pepsea.gapExtend);const m=e.col?.dataFrame??s.shell.t,p=e.col??m.columns.bySemType(r.SEMTYPE.MACROMOLECULE);if(null==p){const e="Multiple Sequence Alignment analysis requires a dataset with a macromolecule column.";return s.shell.warning(e),void n(new c.rE(i.divText(e)))}const f=i.choiceInput("Method",e.pepsea.method,u.Jy);f.setTooltip("Alignment method");const g=i.floatInput("Terminal gap",e?.kalign?.terminalGap??null);g.setTooltip("Penalty for opening a gap at the beginning or end of the sequence");const y=i.p(`Kalign version: ${d.WY}`,"kalign-version"),w=i.floatInput("Gap open",e.pepsea.gapOpen);w.setTooltip("Gap opening penalty at group-to-group alignment");const b=i.floatInput("Gap extend",e.pepsea.gapExtend);b.setTooltip("Gap extension penalty to skip the alignment");const A=i.inputs([w,b,g]),C=i.button("Alignment parameters",(()=>{A.hidden=!A.hidden,[w,b,g].forEach((e=>{e.root.style.removeProperty("max-width"),e.captionLabel.style.removeProperty("max-width")}))}),"Adjust alignment parameters such as penalties for opening and extending gaps");C.classList.add("msa-params-button"),A.hidden=!0,C.prepend(i.icons.settings((()=>null)));const v=[f.root.style],T=[g.root.style,y.style];let S,E=p;const _=i.columnInput("Sequence",m,p,(async e=>{if(!e||e.semType!==r.SEMTYPE.MACROMOLECULE)return N.disabled=!0,await(0,o.gw)(0),void(_.value=E);E=e,N.disabled=!1,S=await M(_.value,m,v,T,f,x,w,b,g)}),{filter:e=>e.semType===r.SEMTYPE.MACROMOLECULE});_.setTooltip("Sequences column to use for alignment");const x=i.columnInput("Clusters",m,e.clustersCol);x.nullable=!0;const P=i.dialog("MSA").add(_).add(x).add(f).add(A).add(C).add(y).onOK((async()=>{await $(_,m,S,t,n)})),N=P.getButton("OK");if(_.fireChanged(),e.col)return S=await M(e.col,m,v,T,f,x,w,b,g),void await $(_,m,S,t,n);P.show()}))}async function $(e,t,n,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===n)throw new Error("Invalid column format");if(a=await n(),null==a)return o("PepSeA container has not started");t.columns.add(a),await s.data.detectSemanticTypes(t),i(a)}catch(e){o(e)}finally{l.close()}}async function M(e,t,n,i,o,f,g,y,w){try{if(e.semType!==r.SEMTYPE.MACROMOLECULE)return;const s=t.columns.getUnusedName(`msa(${e.name})`);if((0,h.n)(e,e.name,[a.r2.FASTA,a.r2.SEPARATOR],[a.fb.DNA,a.fb.RNA,a.fb.PT],!1)){L(n,i,"kalign"),g.value=null,y.value=null,w.value=null;const t=l.g.forColumn(e),r=t.isFasta()?e:t.convert(a.r2.FASTA);return async()=>await(0,c.U4)(r,!1,s,f.value)}if((0,h.n)(e,e.name,[a.r2.HELM],[],!1))return L(n,i,"pepsea"),g.value??(g.value=d.jB.pepsea.gapOpen),y.value??(y.value=d.jB.pepsea.gapExtend),async()=>(await(0,m.Ns)(),(0,u.f3)(e,s,o.value,g.value,y.value,f.value));if((0,h.n)(e,e.name,[a.r2.SEPARATOR],[a.fb.UN],!1)){const t=l.g.forColumn(e).convert(a.r2.HELM);return L(n,i,"pepsea"),g.value??(g.value=d.jB.pepsea.gapOpen),y.value??(y.value=d.jB.pepsea.gapExtend),async()=>(await(0,m.Ns)(),(0,u.f3)(t,s,o.value,g.value,y.value,f.value))}return g.value=null,y.value=null,w.value=null,void L(n,i,"kalign")}catch(e){const t=e instanceof Error?e.message:e.toString();s.shell.error(t),p._package.logger.error(t)}}function L(e,t,n){if("kalign"===n){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")}}P.styleTagTransform=_(),P.setAttributes=v(),P.insert=A().bind(null,"head"),P.domAPI=w(),P.insertStyleElement=S(),g()(x.Z,P),x.Z&&x.Z.locals&&x.Z.locals},6098:(e,t,n)=>{"use strict";n.d(t,{rE:()=>F,Xd:()=>H,U4:()=>G});var s=n(3870),r=n(976),i=n(6414),o=n.n(i),a=n(5226),l=n(8447);const c=Symbol("Comlink.proxy"),u=Symbol("Comlink.endpoint"),h=Symbol("Comlink.releaseProxy"),d=Symbol("Comlink.thrown"),m=e=>"object"==typeof e&&null!==e||"function"==typeof e,p=new Map([["proxy",{canHandle:e=>m(e)&&e[c],serialize(e){const{port1:t,port2:n}=new MessageChannel;return f(e,t),[n,[n]]},deserialize:e=>(e.start(),y(e))}],["throw",{canHandle:e=>m(e)&&d 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 f(e,t=self){t.addEventListener("message",(function n(s){if(!s||!s.data)return;const{id:r,type:i,path:o}=Object.assign({path:[]},s.data),a=(s.data.argumentList||[]).map(S);let l;try{const t=o.slice(0,-1).reduce(((e,t)=>e[t]),e),n=o.reduce(((e,t)=>e[t]),e);switch(i){case"GET":l=n;break;case"SET":t[o.slice(-1)[0]]=S(s.data.value),l=!0;break;case"APPLY":l=n.apply(t,a);break;case"CONSTRUCT":l=function(e){return Object.assign(e,{[c]:!0})}(new n(...a));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;f(e,n),l=function(e,t){return v.set(e,t),e}(t,[t])}break;case"RELEASE":l=void 0;break;default:return}}catch(e){l={value:e,[d]:0}}Promise.resolve(l).catch((e=>({value:e,[d]:0}))).then((e=>{const[s,o]=T(e);t.postMessage(Object.assign(Object.assign({},s),{id:r}),o),"RELEASE"===i&&(t.removeEventListener("message",n),g(t))}))})),t.start&&t.start()}function g(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function y(e,t){return b(e,[],t)}function w(e){if(e)throw new Error("Proxy has been released and is not useable")}function b(e,t=[],n=function(){}){let s=!1;const r=new Proxy(n,{get(n,i){if(w(s),i===h)return()=>E(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{g(e),s=!0}));if("then"===i){if(0===t.length)return{then:()=>r};const n=E(e,{type:"GET",path:t.map((e=>e.toString()))}).then(S);return n.then.bind(n)}return b(e,[...t,i])},set(n,r,i){w(s);const[o,a]=T(i);return E(e,{type:"SET",path:[...t,r].map((e=>e.toString())),value:o},a).then(S)},apply(n,r,i){w(s);const o=t[t.length-1];if(o===u)return E(e,{type:"ENDPOINT"}).then(S);if("bind"===o)return b(e,t.slice(0,-1));const[a,l]=C(i);return E(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:a},l).then(S)},construct(n,r){w(s);const[i,o]=C(r);return E(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:i},o).then(S)}});return r}function A(e){return Array.prototype.concat.apply([],e)}function C(e){const t=e.map(T);return[t.map((e=>e[0])),A(t.map((e=>e[1])))]}const v=new WeakMap;function T(e){for(const[t,n]of p)if(n.canHandle(e)){const[s,r]=n.serialize(e);return[{type:"HANDLER",name:t,value:s},r]}return[{type:"RAW",value:e},v.get(e)||[]]}function S(e){switch(e.type){case"HANDLER":return p.get(e.name).deserialize(e.value);case"RAW":return e.value}}function E(e,t,n){return new Promise((s=>{const r=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){!n.data||!n.data.id||n.data.id!==r||(e.removeEventListener("message",t),s(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:r},t),n)}))}const _="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0ICQ9U3ltYm9sKCJDb21saW5rLnByb3h5IiksQT1TeW1ib2woIkNvbWxpbmsuZW5kcG9pbnQiKSxSPVN5bWJvbCgiQ29tbGluay5yZWxlYXNlUHJveHkiKSx5PVN5bWJvbCgiQ29tbGluay50aHJvd24iKSxfPWU9PnR5cGVvZiBlPT0ib2JqZWN0IiYmZSE9PW51bGx8fHR5cGVvZiBlPT0iZnVuY3Rpb24iLEw9e2NhbkhhbmRsZTplPT5fKGUpJiZlWyRdLHNlcmlhbGl6ZShlKXtjb25zdHtwb3J0MTpyLHBvcnQyOml9PW5ldyBNZXNzYWdlQ2hhbm5lbDtyZXR1cm4gdyhlLHIpLFtpLFtpXV19LGRlc2VyaWFsaXplKGUpe3JldHVybiBlLnN0YXJ0KCksQyhlKX19LE89e2NhbkhhbmRsZTplPT5fKGUpJiZ5IGluIGUsc2VyaWFsaXplKHt2YWx1ZTplfSl7bGV0IHI7cmV0dXJuIGUgaW5zdGFuY2VvZiBFcnJvcj9yPXtpc0Vycm9yOiEwLHZhbHVlOnttZXNzYWdlOmUubWVzc2FnZSxuYW1lOmUubmFtZSxzdGFjazplLnN0YWNrfX06cj17aXNFcnJvcjohMSx2YWx1ZTplfSxbcixbXV19LGRlc2VyaWFsaXplKGUpe3Rocm93IGUuaXNFcnJvcj9PYmplY3QuYXNzaWduKG5ldyBFcnJvcihlLnZhbHVlLm1lc3NhZ2UpLGUudmFsdWUpOmUudmFsdWV9fSxFPW5ldyBNYXAoW1sicHJveHkiLExdLFsidGhyb3ciLE9dXSk7ZnVuY3Rpb24gdyhlLHI9c2VsZil7ci5hZGRFdmVudExpc3RlbmVyKCJtZXNzYWdlIixmdW5jdGlvbiBpKHMpe2lmKCFzfHwhcy5kYXRhKXJldHVybjtjb25zdHtpZDpvLHR5cGU6YSxwYXRoOm59PU9iamVjdC5hc3NpZ24oe3BhdGg6W119LHMuZGF0YSksdT0ocy5kYXRhLmFyZ3VtZW50TGlzdHx8W10pLm1hcChtKTtsZXQgbDt0cnl7Y29uc3QgYz1uLnNsaWNlKDAsLTEpLnJlZHVjZSgoZCxoKT0+ZFtoXSxlKSxmPW4ucmVkdWNlKChkLGgpPT5kW2hdLGUpO3N3aXRjaChhKXtjYXNlIkdFVCI6bD1mO2JyZWFrO2Nhc2UiU0VUIjpjW24uc2xpY2UoLTEpWzBdXT1tKHMuZGF0YS52YWx1ZSksbD0hMDticmVhaztjYXNlIkFQUExZIjpsPWYuYXBwbHkoYyx1KTticmVhaztjYXNlIkNPTlNUUlVDVCI6e2NvbnN0IGQ9bmV3IGYoLi4udSk7bD16KGQpfWJyZWFrO2Nhc2UiRU5EUE9JTlQiOntjb25zdHtwb3J0MTpkLHBvcnQyOmh9PW5ldyBNZXNzYWdlQ2hhbm5lbDt3KGUsaCksbD1OKGQsW2RdKX1icmVhaztjYXNlIlJFTEVBU0UiOmw9dm9pZCAwO2JyZWFrO2RlZmF1bHQ6cmV0dXJufX1jYXRjaChjKXtsPXt2YWx1ZTpjLFt5XTowfX1Qcm9taXNlLnJlc29sdmUobCkuY2F0Y2goYz0+KHt2YWx1ZTpjLFt5XTowfSkpLnRoZW4oYz0+e2NvbnN0W2YsZF09UyhjKTtyLnBvc3RNZXNzYWdlKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxmKSx7aWQ6b30pLGQpLGE9PT0iUkVMRUFTRSImJihyLnJlbW92ZUV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLGkpLEYocikpfSl9KSxyLnN0YXJ0JiZyLnN0YXJ0KCl9ZnVuY3Rpb24gVChlKXtyZXR1cm4gZS5jb25zdHJ1Y3Rvci5uYW1lPT09Ik1lc3NhZ2VQb3J0In1mdW5jdGlvbiBGKGUpe1QoZSkmJmUuY2xvc2UoKX1mdW5jdGlvbiBDKGUscil7cmV0dXJuIGIoZSxbXSxyKX1mdW5jdGlvbiBwKGUpe2lmKGUpdGhyb3cgbmV3IEVycm9yKCJQcm94eSBoYXMgYmVlbiByZWxlYXNlZCBhbmQgaXMgbm90IHVzZWFibGUiKX1mdW5jdGlvbiBiKGUscj1bXSxpPWZ1bmN0aW9uKCl7fSl7bGV0IHM9ITE7Y29uc3Qgbz1uZXcgUHJveHkoaSx7Z2V0KGEsbil7aWYocChzKSxuPT09UilyZXR1cm4oKT0+ZyhlLHt0eXBlOiJSRUxFQVNFIixwYXRoOnIubWFwKHU9PnUudG9TdHJpbmcoKSl9KS50aGVuKCgpPT57RihlKSxzPSEwfSk7aWYobj09PSJ0aGVuIil7aWYoci5sZW5ndGg9PT0wKXJldHVybnt0aGVuOigpPT5vfTtjb25zdCB1PWcoZSx7dHlwZToiR0VUIixwYXRoOnIubWFwKGw9PmwudG9TdHJpbmcoKSl9KS50aGVuKG0pO3JldHVybiB1LnRoZW4uYmluZCh1KX1yZXR1cm4gYihlLFsuLi5yLG5dKX0sc2V0KGEsbix1KXtwKHMpO2NvbnN0W2wsY109Uyh1KTtyZXR1cm4gZyhlLHt0eXBlOiJTRVQiLHBhdGg6Wy4uLnIsbl0ubWFwKGY9PmYudG9TdHJpbmcoKSksdmFsdWU6bH0sYykudGhlbihtKX0sYXBwbHkoYSxuLHUpe3Aocyk7Y29uc3QgbD1yW3IubGVuZ3RoLTFdO2lmKGw9PT1BKXJldHVybiBnKGUse3R5cGU6IkVORFBPSU5UIn0pLnRoZW4obSk7aWYobD09PSJiaW5kIilyZXR1cm4gYihlLHIuc2xpY2UoMCwtMSkpO2NvbnN0W2MsZl09TSh1KTtyZXR1cm4gZyhlLHt0eXBlOiJBUFBMWSIscGF0aDpyLm1hcChkPT5kLnRvU3RyaW5nKCkpLGFyZ3VtZW50TGlzdDpjfSxmKS50aGVuKG0pfSxjb25zdHJ1Y3QoYSxuKXtwKHMpO2NvbnN0W3UsbF09TShuKTtyZXR1cm4gZyhlLHt0eXBlOiJDT05TVFJVQ1QiLHBhdGg6ci5tYXAoYz0+Yy50b1N0cmluZygpKSxhcmd1bWVudExpc3Q6dX0sbCkudGhlbihtKX19KTtyZXR1cm4gb31mdW5jdGlvbiBEKGUpe3JldHVybiBBcnJheS5wcm90b3R5cGUuY29uY2F0LmFwcGx5KFtdLGUpfWZ1bmN0aW9uIE0oZSl7Y29uc3Qgcj1lLm1hcChTKTtyZXR1cm5bci5tYXAoaT0+aVswXSksRChyLm1hcChpPT5pWzFdKSldfWNvbnN0IFA9bmV3IFdlYWtNYXA7ZnVuY3Rpb24gTihlLHIpe3JldHVybiBQLnNldChlLHIpLGV9ZnVuY3Rpb24geihlKXtyZXR1cm4gT2JqZWN0LmFzc2lnbihlLHtbJF06ITB9KX1mdW5jdGlvbiBTKGUpe2Zvcihjb25zdFtyLGldb2YgRSlpZihpLmNhbkhhbmRsZShlKSl7Y29uc3RbcyxvXT1pLnNlcmlhbGl6ZShlKTtyZXR1cm5be3R5cGU6IkhBTkRMRVIiLG5hbWU6cix2YWx1ZTpzfSxvXX1yZXR1cm5be3R5cGU6IlJBVyIsdmFsdWU6ZX0sUC5nZXQoZSl8fFtdXX1mdW5jdGlvbiBtKGUpe3N3aXRjaChlLnR5cGUpe2Nhc2UiSEFORExFUiI6cmV0dXJuIEUuZ2V0KGUubmFtZSkuZGVzZXJpYWxpemUoZS52YWx1ZSk7Y2FzZSJSQVciOnJldHVybiBlLnZhbHVlfX1mdW5jdGlvbiBnKGUscixpKXtyZXR1cm4gbmV3IFByb21pc2Uocz0+e2NvbnN0IG89VSgpO2UuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24gYShuKXshbi5kYXRhfHwhbi5kYXRhLmlkfHxuLmRhdGEuaWQhPT1vfHwoZS5yZW1vdmVFdmVudExpc3RlbmVyKCJtZXNzYWdlIixhKSxzKG4uZGF0YSkpfSksZS5zdGFydCYmZS5zdGFydCgpLGUucG9zdE1lc3NhZ2UoT2JqZWN0LmFzc2lnbih7aWQ6b30sciksaSl9KX1mdW5jdGlvbiBVKCl7cmV0dXJuIG5ldyBBcnJheSg0KS5maWxsKDApLm1hcCgoKT0+TWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpKk51bWJlci5NQVhfU0FGRV9JTlRFR0VSKS50b1N0cmluZygxNikpLmpvaW4oIi0iKX1jb25zdCBXPWFzeW5jKCk9PldlYkFzc2VtYmx5LnZhbGlkYXRlKG5ldyBVaW50OEFycmF5KFswLDk3LDExNSwxMDksMSwwLDAsMCwxLDUsMSw5NiwwLDEsMTIzLDMsMiwxLDAsMTAsMTAsMSw4LDAsNjUsMCwyNTMsMTUsMjUzLDk4LDExXSkpLHg9ImVhZ2VyIixrPSJsYXp5IixqPXtzc3c6WyJzaW1kIl0sbWluaW1hcDI6WyJzaW1kIl19LHQ9e3Rvb2xzOltdLGNvbmZpZzp7fSxmaWxlczpbXSxiYXNlOnt9LGZzOnt9LGFzeW5jIGluaXQoKXtpZih0LnRvb2xzLmxlbmd0aD09PTApdGhyb3ciRXhwZWN0aW5nIGF0IGxlYXN0IDEgdG9vbC4iO2lmKG5ldyBTZXQodC50b29scy5tYXAocj0+YCR7ci50b29sfS8ke3IucHJvZ3JhbXx8ci50b29sfWApKS5zaXplIT09dC50b29scy5sZW5ndGgpdGhyb3ciRm91bmQgZHVwbGljYXRlIHRvb2xzOyBjYW4gb25seSBoYXZlIGVhY2ggdG9vbC9wcm9ncmFtIGNvbWJpbmF0aW9uIGF0IG1vc3Qgb25jZS4iO2lmKHQuYmFzZT10LnRvb2xzLmZpbmQocj0+ci5yZWluaXQhPT0hMCksIXQuYmFzZSl0aHJvdyJDb3VsZCBub3QgZmluZCBhIHRvb2wgd2l0aCBgcmVpbml0OiBmYWxzZWAgdG8gdXNlIGFzIHRoZSBiYXNlIG1vZHVsZS4gVG8gZml4IHRoaXMgaXNzdWUsIGluY2x1ZGUgdGhlIHRvb2wgYGJhc2UvMS4wLjBgIHdoZW4gaW5pdGlhbGl6aW5nIEFpb2xpLiI7cmV0dXJuIHQuYmFzZS5pc0Jhc2VNb2R1bGU9ITAsYXdhaXQgdGhpcy5fc2V0dXAodC5iYXNlKSxhd2FpdCB0aGlzLl9pbml0TW9kdWxlcygpLHQuX2xvZygiUmVhZHkiKSwhMH0sYXN5bmMgX2luaXRNb2R1bGVzKCl7YXdhaXQgUHJvbWlzZS5hbGwodC50b29scy5tYXAodGhpcy5fc2V0dXApKSxhd2FpdCB0aGlzLl9zZXR1cEZTKCl9LG1vdW50KGU9W10pe2NvbnN0IHI9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyRGF0YX1gLGk9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyTW91bnRlZH1gO2xldCBzPVtdLG89W10sYT1bXTshQXJyYXkuaXNBcnJheShlKSYmIShlIGluc3RhbmNlb2YgRmlsZUxpc3QpJiYoZT1bZV0pLHQuX2xvZyhgTW91bnRpbmcgJHtlLmxlbmd0aH0gZmlsZXNgKTtmb3IobGV0IG4gb2YgZSl7aWYobiBpbnN0YW5jZW9mIEZpbGV8fChuPT1udWxsP3ZvaWQgMDpuLmRhdGEpaW5zdGFuY2VvZiBCbG9iJiZuLm5hbWV8fHR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmbi5uYW1lKXR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmKG4uZGF0YT1uZXcgQmxvYihbbi5kYXRhXSx7dHlwZToidGV4dC9wbGFpbiJ9KSkscy5wdXNoKG4pO2Vsc2UgaWYobi5uYW1lJiZuLnVybClvLnB1c2gobik7ZWxzZSBpZih0eXBlb2Ygbj09InN0cmluZyImJm4uc3RhcnRzV2l0aCgiaHR0cCIpKW49e3VybDpuLG5hbWU6bi5zcGxpdCgiLy8iKS5wb3AoKS5yZXBsYWNlKC9cLy9nLCItIil9LG8ucHVzaChuKTtlbHNlIHRocm93J0Nhbm5vdCBtb3VudCBmaWxlKHMpIHNwZWNpZmllZC4gTXVzdCBiZSBhIEZpbGUsIEJsb2IsIGEgVVJMIHN0cmluZywgb3IgeyBuYW1lOiAiZmlsZS50eHQiLCBkYXRhOiAic3RyaW5nIiB9Lic7YS5wdXNoKG4ubmFtZSl9dHJ5e3QuZnMudW5tb3VudChpKX1jYXRjaHt9Zm9yKGxldCBuIG9mIG8pdC5mcy5jcmVhdGVMYXp5RmlsZShyLG4ubmFtZSxuLnVybCwhMCwhMCk7cmV0dXJuIHQuZmlsZXM9dC5maWxlcy5jb25jYXQocyksdC5iYXNlLm1vZHVsZS5GUy5tb3VudCh0LmJhc2UubW9kdWxlLldPUktFUkZTLHtmaWxlczp0LmZpbGVzLmZpbHRlcihuPT5uIGluc3RhbmNlb2YgRmlsZSksYmxvYnM6dC5maWxlcy5maWx0ZXIobj0+KG49PW51bGw/dm9pZCAwOm4uZGF0YSlpbnN0YW5jZW9mIEJsb2IpfSxpKSxzLm1hcChuPT57Y29uc3QgdT1gJHtpfS8ke24ubmFtZX1gLGw9YCR7cn0vJHtuLm5hbWV9YDt0cnl7dC5mcy51bmxpbmsobCl9Y2F0Y2h7fXQuX2xvZyhgQ3JlYXRpbmcgc3ltbGluazogJHtsfSAtLT4gJHt1fWApLHQuZnMuc3ltbGluayh1LGwpfSksYS5tYXAobj0+YCR7cn0vJHtufWApfSxhc3luYyBleGVjKGUscj1udWxsKXtpZih0Ll9sb2coYEV4ZWN1dGluZyAlYyR7ZX0lYyBhcmdzPSR7cn1gLCJjb2xvcjpkYXJrYmx1ZTsgZm9udC13ZWlnaHQ6Ym9sZCIsIiIpLCFlKXRocm93IkV4cGVjdGluZyBhIGNvbW1hbmQiO2xldCBpPWU7cj09bnVsbCYmKHI9ZS5zcGxpdCgiICIpLGk9ci5zaGlmdCgpKTtjb25zdCBzPXQudG9vbHMuZmluZChhPT57dmFyIHU7bGV0IG49aTtyZXR1cm4oKHU9YT09bnVsbD92b2lkIDA6YS5mZWF0dXJlcyk9PW51bGw/dm9pZCAwOnUuc2ltZCk9PT0hMCYmKG49YCR7bn0tc2ltZGApLGEucHJvZ3JhbT09bn0pO2lmKHM9PW51bGwpdGhyb3dgUHJvZ3JhbSAke2l9IG5vdCBmb3VuZC5gO3Muc3Rkb3V0PSIiLHMuc3RkZXJyPSIiLHMubG9hZGluZz09ayYmKHMubG9hZGluZz14LGF3YWl0IHRoaXMuX2luaXRNb2R1bGVzKCkpO3RyeXtzLm1vZHVsZS5jYWxsTWFpbihyKX1jYXRjaChhKXtjb25zb2xlLmVycm9yKGEpfXRyeXtzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzFdKSxzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzJdKX1jYXRjaHt9cy5tb2R1bGUuRlMuc3RyZWFtc1sxXT1zLm1vZHVsZS5GUy5vcGVuKCIvZGV2L3N0ZG91dCIsInciKSxzLm1vZHVsZS5GUy5zdHJlYW1zWzJdPXMubW9kdWxlLkZTLm9wZW4oIi9kZXYvc3RkZXJyIiwidyIpO2xldCBvPXtzdGRvdXQ6cy5zdGRvdXQsc3RkZXJyOnMuc3RkZXJyfTtpZih0LmNvbmZpZy5wcmludEludGVybGVhdmVkJiYobz1zLnN0ZG91dCkscy5yZWluaXQ9PT0hMCl7Y29uc3QgYT10LmJhc2UubW9kdWxlLkZTLmN3ZCgpO09iamVjdC5hc3NpZ24ocyxzLmNvbmZpZykscy5yZWFkeT0hMSxhd2FpdCB0aGlzLmluaXQoKSxzLmlzQmFzZU1vZHVsZSYmdGhpcy5tb3VudCgpLHRoaXMuY2QoYSl9cmV0dXJuIG99LGNhdChlKXtyZXR1cm4gdC5fZmlsZW9wKCJjYXQiLGUpfSxscyhlKXtyZXR1cm4gdC5fZmlsZW9wKCJscyIsZSl9LGRvd25sb2FkKGUpe3JldHVybiB0Ll9maWxlb3AoImRvd25sb2FkIixlKX0scHdkKCl7cmV0dXJuIHQuZnMuY3dkKCl9LGNkKGUpe2ZvcihsZXQgciBvZiB0LnRvb2xzKSFyLm1vZHVsZXx8ci5tb2R1bGUuRlMuY2hkaXIoZSl9LG1rZGlyKGUpe3JldHVybiB0LmZzLm1rZGlyKGUpLCEwfSxyZWFkKHtwYXRoOmUsbGVuZ3RoOnIsZmxhZzppPSJyIixvZmZzZXQ6cz0wLHBvc2l0aW9uOm89MH0pe2NvbnN0IGE9dC5mcy5vcGVuKGUsaSksbj1uZXcgVWludDhBcnJheShyKTtyZXR1cm4gdC5mcy5yZWFkKGEsbixzLHIsbyksdC5mcy5jbG9zZShhKSxufSx3cml0ZSh7cGF0aDplLGJ1ZmZlcjpyLGZsYWc6aT0idysiLG9mZnNldDpzPTAscG9zaXRpb246bz0wfSl7Y29uc3QgYT10LmZzLm9wZW4oZSxpKTt0LmZzLndyaXRlKGEscixzLHIubGVuZ3RoLG8pLHQuZnMuY2xvc2UoYSl9LF9zdGRpblR4dDoiIixfc3RkaW5QdHI6MCxnZXQgc3RkaW4oKXtyZXR1cm4gdC5fc3RkaW5UeHR9LHNldCBzdGRpbihlPSIiKXt0Ll9sb2coYFNldHRpbmcgc3RkaW4gdG8gJWMke2V9JWNgLCJjb2xvcjpkYXJrYmx1ZSIsIiIpLHQuX3N0ZGluVHh0PWUsdC5fc3RkaW5QdHI9MH0sYXN5bmMgX3NldHVwKGUpe2lmKGUucmVhZHkpcmV0dXJuO2lmKHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gKGJhc2UgPSAke2UuaXNCYXNlTW9kdWxlPT09ITB9KS4uLmApLGUuY29uZmlnPU9iamVjdC5hc3NpZ24oe30sZSksZS51cmxQcmVmaXh8fChlLnVybFByZWZpeD1gJHt0LmNvbmZpZy51cmxDRE59LyR7ZS50b29sfS8ke2UudmVyc2lvbn1gKSxlLnByb2dyYW18fChlLnByb2dyYW09ZS50b29sKSxlLmZlYXR1cmVzfHwoZS5mZWF0dXJlcz17fSwoaltlLnByb2dyYW1dfHxbXSkuaW5jbHVkZXMoInNpbWQiKSYmKGF3YWl0IFcoKT8oZS5wcm9ncmFtKz0iLXNpbWQiLGUuZmVhdHVyZXMuc2ltZD0hMCk6dC5fbG9nKGBXZWJBc3NlbWJseSBTSU1EIGlzIG5vdCBzdXBwb3J0ZWQgaW4gdGhpcyBicm93c2VyOyB3aWxsIGxvYWQgbm9uLVNJTUQgdmVyc2lvbiBvZiAke2UucHJvZ3JhbX0uYCkpKSxlLmlzQmFzZU1vZHVsZSYmKGUubG9hZGluZz14KSxlLmxvYWRpbmc9PT1rKXt0Ll9sb2coYFdpbGwgbGF6eS1sb2FkICR7ZS50b29sfTsgc2tpcHBpbmcgaW5pdGlhbGl6YXRpb24uYCk7cmV0dXJufXNlbGYuaW1wb3J0U2NyaXB0cyhgJHtlLnVybFByZWZpeH0vJHtlLnByb2dyYW19LmpzYCksZS5tb2R1bGU9YXdhaXQgTW9kdWxlKHt0aGlzUHJvZ3JhbTplLnByb2dyYW0sbG9jYXRlRmlsZTooaSxzKT0+YCR7ZS51cmxQcmVmaXh9LyR7aX1gLHN0ZGluOigpPT50Ll9zdGRpblB0cjx0LnN0ZGluLmxlbmd0aD90LnN0ZGluLmNoYXJDb2RlQXQodC5fc3RkaW5QdHIrKyk6KHQuc3RkaW49IiIsbnVsbCkscHJpbnQ6aT0+ZS5zdGRvdXQrPWAke2l9CmAscHJpbnRFcnI6dC5jb25maWcucHJpbnRJbnRlcmxlYXZlZD9pPT5lLnN0ZG91dCs9YCR7aX0KYDppPT5lLnN0ZGVycis9YCR7aX0KYH0pO2NvbnN0IHI9ZS5tb2R1bGUuRlM7ZS5pc0Jhc2VNb2R1bGU/KHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gd2l0aCBiYXNlIG1vZHVsZSBmaWxlc3lzdGVtLi4uYCksci5ta2Rpcih0LmNvbmZpZy5kaXJTaGFyZWQsNTExKSxyLm1rZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJEYXRhfWAsNTExKSxyLm1rZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJNb3VudGVkfWAsNTExKSxyLmNoZGlyKGAke3QuY29uZmlnLmRpclNoYXJlZH0vJHt0LmNvbmZpZy5kaXJEYXRhfWApLHQuZnM9cik6KHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gd2l0aCBmaWxlc3lzdGVtLi4uYCksci5ta2Rpcih0LmNvbmZpZy5kaXJTaGFyZWQpLHIubW91bnQoZS5tb2R1bGUuUFJPWFlGUyx7cm9vdDp0LmNvbmZpZy5kaXJTaGFyZWQsZnM6dC5mc30sdC5jb25maWcuZGlyU2hhcmVkKSxyLmNoZGlyKHQuZnMuY3dkKCkpKSxlLnN0ZG91dD0iIixlLnN0ZGVycj0iIixlLnJlYWR5PSEwfSxhc3luYyBfc2V0dXBGUygpe2NvbnN0IGU9dC5mcztmb3IobGV0IHIgb2YgdC50b29scyl7aWYoIXIucmVhZHkpY29udGludWU7Y29uc3QgaT1yLm1vZHVsZS5GUyxzPWAvJHtyLnRvb2x9YCxvPWAke3QuY29uZmlnLmRpclNoYXJlZH0ke3N9YDshaS5hbmFseXplUGF0aChzKS5leGlzdHN8fGUuYW5hbHl6ZVBhdGgobykuZXhpc3RzfHwodC5fbG9nKGBNb3VudGluZyAke3N9IG9udG8gJHt0LmJhc2UudG9vbH0gZmlsZXN5c3RlbSBhdCAke299YCksZS5ta2RpcihvKSxlLm1vdW50KHQuYmFzZS5tb2R1bGUuUFJPWFlGUyx7cm9vdDpzLGZzOml9LG8pKX19LF9maWxlb3AoZSxyKXt0Ll9sb2coYFJ1bm5pbmcgJHtlfSAke3J9YCk7Y29uc3QgaT10LmZzLmFuYWx5emVQYXRoKHIpO2lmKCFpLmV4aXN0cylyZXR1cm4gdC5fbG9nKGBGaWxlICR7cn0gbm90IGZvdW5kLmApLCExO3N3aXRjaChlKXtjYXNlImNhdCI6cmV0dXJuIHQuZnMucmVhZEZpbGUocix7ZW5jb2Rpbmc6InV0ZjgifSk7Y2FzZSJscyI6cmV0dXJuIHQuZnMuaXNGaWxlKGkub2JqZWN0Lm1vZGUpP3QuZnMuc3RhdChyKTp0LmZzLnJlYWRkaXIocik7Y2FzZSJkb3dubG9hZCI6Y29uc3Qgcz1uZXcgQmxvYihbdGhpcy5jYXQocildKTtyZXR1cm4gVVJMLmNyZWF0ZU9iamVjdFVSTChzKX1yZXR1cm4hMX0sX2xvZyhlKXtpZighdC5jb25maWcuZGVidWcpcmV0dXJuO2xldCByPVsuLi5hcmd1bWVudHNdO3Iuc2hpZnQoKSxjb25zb2xlLmxvZyhgJWNbV2ViV29ya2VyXSVjICR7ZX1gLCJmb250LXdlaWdodDpib2xkIiwiIiwuLi5yKX19O3codCl9KSgpOwo=",x=typeof window<"u"&&window.Blob&&new Blob([atob(_)],{type:"text/javascript;charset=utf-8"});function P(){const e=x&&(window.URL||window.webkitURL).createObjectURL(x);try{return e?new Worker(e):new Worker("data:application/javascript;base64,"+_)}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}const N={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 ${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({},N,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 P;this.callback&&(e.onmessage=e=>{"biowasm"===e.data.type&&this.callback(e.data.value)});const t=y(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 M=n(850);class L{static getAvailableScales(){return Object.entries(this.scales).map((([e,t])=>e))}static getScale(e){return(0,M.hu)(!(void 0===this.scales[e]),`Scale '${e}' was not found.`),this.scales[e]}}L.scales={WimleyWhite:{"-":0,A:.17,C:-.24,D:-.07,E:-.01,F:-1.13,G:.01,H:.17,I:-.31,K:.99,L:-.56,M:-.23,N:.42,P:.45,Q:.58,R:.81,S:.13,T:.14,V:.07,W:-1.85,Y:-.94},categorial:{"-":0,A:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,K:9,L:10,M:11,N:12,P:13,Q:14,R:15,S:16,T:17,V:18,W:19,Y:20}};class I{constructor(e="categorial"){this.aa2num=L.getScale(e),this.num2aa={},Object.entries(this.aa2num).forEach((([e,t])=>this.num2aa[t]=e))}static _truncateSequence(e){let t=0,n=e.length;const s=["NH2","COOH"];if(e.startsWith(s[0])){const n=s[0].length;(0,M.hu)("-"==e[n],`Wrong sequence format: ${s[0]} without following '-' in '${e}'.`),t=n}if(e.endsWith(s[1])){const t=s[1].length+1;(0,M.hu)("-"==e[n-t],`Wrong sequence format: ${s[1]} without '-' precending in '${e}'.`),n-=t}return e.substring(t,n)}static _dropDefises(e){return e.replace(/(-)([^-]+)/g,"$2")}static clean(e){return I._dropDefises(I._truncateSequence(e))}encode(e){const t=e.length,n=new Array(t).fill(0);for(let s=0;s<t;++s){const t=e[s];(0,M.hu)(t in this.aa2num,`Unknown char '${t}' found in sequence '${e}'`),n[s]=this.encodeLettter(t)}return n}encodeLettter(e){return this.aa2num[e]}decode(e){let t="";for(let n=0;n<e.length;++n){const s=e[n];(0,M.hu)(s in this.num2aa,`Unknown code '${s}' found in vector '${e}'`),t+=this.num2aa[s]}return t}}var R=n(3553);const O="input.fa",D="result.fasta";class F extends Error{constructor(e,t){super(e.innerText,t),this.element=e}}function k(e){return e.reduce(((e,t,n)=>e+`>sample${n+1}\n${t}\n`),"")}async function G(e,t=!1,n="",s=null,i,o,c){let u=e.toList();t&&(u=u.map((e=>I.clean(e).replace(/\-/g,""))));const h=e.length;s??(s=r.Column.string("Clusters",h).init("0")),s.type!=r.COLUMN_TYPE.STRING&&(s=s.convertTo(r.TYPE.STRING)),s.compact();const d=s.categories,m=s.getRawData(),p=new Array(d.length),f=new Array(d.length);for(let e=0;e<h;++e){const t=m[e];(p[t]??(p[t]=[])).push(u[e]),(f[t]??(f[t]=[])).push(e)}H(f,d);const g=await new $(["base/1.0.0",{tool:"kalign",version:R.WY,reinit:!0}]),y=r.Column.string(n,h);for(let e=0;e<d.length;++e){const t=k(p[e]);await g.fs.writeFile(O,t);const n=`${void 0!==i?` --gpo ${i}`:""}${void 0!==o?` --gpe ${o}`:""}${void 0!==c?` --tgpe ${c}`:""}`,s=await g.exec(`kalign ${O} -f fasta -o ${D}${n}`);console.warn(s);const r=await g.cat(D);if(!r){const e=B(s,1);throw new Error(e)}const l=new a.i(r).sequencesArray,u=f[e];for(let e=0;e<l.length;++e)y.set(u[e],l[e])}const w=e.getTag(r.TAGS.UNITS),b=e.getTag(l.DX.alphabet);return y.setTag(r.TAGS.UNITS,w),y.setTag(l.DX.aligned,"SEQ.MSA"),y.setTag(l.DX.alphabet,b),y.semType=r.SEMTYPE.MACROMOLECULE,y}function B(e,t){const n=[],s=/^.+ERROR : (.+)$/gm;let r;for(;null!=(r=s.exec(e))&&(void 0===t||n.length<t);)n.push(r[1]);return n.join("\n")}function H(e,t){const n=e.map(((e,t)=>[e,t])).filter((([e,t])=>1==e.length)).map((([e,t])=>t));if(n.length>0){const e=s.div([s.divText(`MSA analysis is not available on single sequence clusters #${n.length}:`),...o()(n).take(3).map((e=>{let r=t[e];return r.length>25&&(r=r.slice(0,25)+"..."),s.divText(`"${r}"${e<n.length-1?", ":"."}`)})).toArray(),...n.length>3?[s.divText("...")]:[]]);throw new F(e)}}},8341:(e,t,n)=>{"use strict";n.d(t,{Jy:()=>u,f3:()=>d,lp:()=>c});var s=n(4469),r=n(976),i=n(8447),o=n(6098),a=n(3553),l=n(7422);const c=new class{constructor(){this.dcName="bio"}async getDockerContainer(){return await s.dapi.docker.dockerContainers.filter(this.dcName).first()}},u=["mafft --auto","mafft","linsi","ginsi","einsi","fftns","fftnsi","nwns","nwnsi"],h=["AlignedSeq","AlignedSubpeptide","HELM","ID","PolymerID"];async function d(e,t,n="ginsi",s=1.53,l=0,u=null,d){const p=await c.getDockerContainer();if("started"!==p.status&&"checking"!==p.status)throw new Error("PepSeA container has not started yet");const f=e.length;u??(u=r.Column.int("Clusters",f).init(0)),u.type!=r.COLUMN_TYPE.STRING&&(u=u.convertTo(r.TYPE.STRING));const g=u.categories,y=u.getRawData(),w=new Array(g.length),b=new Array(g.length);for(let t=0;t<f;++t){const n=y[t],s=g[n];if(""===s)continue;const r=g.indexOf(s),i=e.get(t);i&&((w[r]??(w[r]=[])).push({ID:t.toString(),HELM:i}),(b[n]??(b[n]=[])).push(t))}(0,o.Xd)(b,g);const A=new Array(f);for(const e of w){const t=(await m(p.id,e,n,s,l,d)).Alignment;for(const e of t)A[parseInt(e.ID)]=Object.entries(e).filter((e=>!h.includes(e[0]))).map((e=>"-"!==e[1]?e[1]:"")).join(a.rs.SEPARATOR)}const C=r.Column.fromStrings(t,A);return C.setTag(r.TAGS.UNITS,i.r2.SEPARATOR),C.setTag(i.DX.separator,a.rs.SEPARATOR),C.setTag(i.DX.aligned,"SEQ.MSA"),C.setTag(i.DX.alphabet,i.fb.UN),C.setTag(i.DX.alphabetIsMultichar,"true"),C.semType=r.SEMTYPE.MACROMOLECULE,C}async function m(e,t,n,r,i,o){const a={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)},c=`/align?method=${n}&gap_open=${r}&gap_extend=${i}`;let u;if("fetchProxy"in s.dapi.docker.dockerContainers){const t=window.performance.now(),n=await s.dapi.docker.dockerContainers.fetchProxy(e,c,a),r=window.performance.now();l._package.logger.debug(`Bio: requestAlignedObjects() dockerContainers.fetchProxy(), ET: ${r-t} ms`);const i="application/json"===n.headers.get("content-type");if(!n.ok&&i){const e=await n.json(),t=e["pepsea-error"];if(t)throw new Error(`PepSeA error: ${t}`);const s=e["datagrok-error"];if(s)throw new Error(`Datagrok error: ${s}`);throw new Error(n.statusText)}if(!n.ok&&!i){const e=await n.text();throw new Error(`Error: ${e}`)}if(!i){const e=await n.text();throw new Error(`Error: PepSeA expected JSON response, got '${e}'.`)}u=await n.json()}else{const t=await s.dapi.docker.dockerContainers.request(e,c,a);if(!t)throw new Error("Empty response");u=JSON.parse(t);const n=u["pepsea-error"];if(n)throw new Error(`PepSeA error: ${n}`);const r=u["datagrok-error"];if(r)throw new Error(`Datagrok error: ${r}`)}if("pepsea-stderr"in u){const e=u["pepsea-stderr"];o?.warning(e)}return u}},9943:(e,t,n)=>{"use strict";n.d(t,{i$:()=>a,sK:()=>l}),n(976),n(3870),n(4469);var s=n(6414),r=n.n(s),i=n(8607);const o=60;function a(e,t,n=o,s="\n"){const r=i.g.forColumn(t),a=[];for(let i=0;i<t.length;i++){const t=e.map((e=>e.get(i).toString())).join("|"),o=l(r.getSplitted(i),n);a.push(`>${t}${s}`);for(const e of o)a.push(`${e}${s}`)}return"".concat(...a)}function l(e,t=o){let n=0;const s=e.length,i=[];for(;n<s;){const s=r()(e.originals).slice(n,n+t).toArray(),o=s.map((e=>e.length>1?`[${e}]`:e)).reduce(((e,t)=>e+t),"");i.push(o),n+=s.length}return i}},9416:(e,t,n)=>{"use strict";n.d(t,{n:()=>u});var s=n(4469),r=n(976),i=n(2997),o=n(2568),a=n(8457),l=n(3553),c=n(1821);async function u(e,t){if(await(0,i.gw)(10),!(0,o.n)(t,"Sequence space"))return e;const n=(0,a.O)(t);n.name="splitToMonomers";const u=t.dataFrame;for(const e of n.columns)e.semType=l.Of.MONOMER,e.setTag(c.DX.alphabet,t.getTag(c.DX.alphabet));const h=/(\d+)(?: \((\d+)\))?/,d=e=>{h.lastIndex=0;const t=e.match(h);return t?`${t[1]} (${parseInt(t[2]??0)+1})`:e};for(let e=0;e<n.columns.length;e++){const s=n.columns.byIndex(e);s.semType=l.Of.MONOMER,s.setTag(c.DX.alphabet,t.getTag(c.DX.alphabet));const r=100;let i=0;for(;u.columns.byName(s.name)&&i<r;)s.name=d(s.name),i++;u.columns.add(s)}await s.data.detectSemanticTypes(u);for(let e=0;e<n.columns.length;e++){const t=n.columns.byIndex(e);t.setTag(r.TAGS.CELL_RENDERER,"Monomer"),t.setTag(".use-as-filter","false")}return u}},4293:(e,t,n)=>{"use strict";function s(e,t){e.innerHTML="",e.append(t)}n.d(t,{Y:()=>s}),n(4469),n(976)},8415:(e,t,n)=>{"use strict";n.d(t,{Fs:()=>_,bo:()=>b,CK:()=>T,yW:()=>v,eZ:()=>P});var s=n(4469),r=n(3870),i=n(976),o=n(3336),a=n.n(o),l=n(6414),c=n.n(l),u=n(701),h=n(8607),d=n(8447),m=n(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=n(6286),g=n(2997),y=n(172);var w,b,A=n(8770),C=n(7422);HTMLCanvasElement.prototype.getCursorPosition=function(e,t){const n=this.getBoundingClientRect();return new i.Point((e.clientX-n.left)*t,(e.clientY-n.top)*t)},i.Rect.prototype.contains=function(e,t){return this.left<=e&&e<=this.right&&this.top<=t&&t<=this.bottom};class v{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 T{get label(){return this._label?this._label:this.name}constructor(e,t,n,s){this.pos=e,this.name=t,this.sumRowCount=0,this._freqs=n??{},s?.sumRowCount&&(this.sumRowCount=s.sumRowCount),s?.sumValueForHeight&&(this.sumPlotValue=s.sumValueForHeight),s?.label&&(this._label=s.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 v),t}aggregate(e){const t=function(e){return t=>{const n=function(e){let t;const n="agg";return t=e instanceof Float32Array?i.Column.fromFloat32Array(n,e):e instanceof Int32Array?i.Column.fromInt32Array(n,e):i.Column.fromList(i.COLUMN_TYPE.FLOAT,n,e),t}(t);return n.aggregate(e)}}(e);for(const[e,n]of Object.entries(this._freqs))n.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,n=t/e;for(const e of Object.values(this._freqs)){const s=(e.plotValue+n)/(this.sumPlotValue+t);this.sumPlotValueForHeight+=-s*Math.log2(s)}}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,n,s,r,o,a,l,c){const u=s===m.ES.Entropy?n*(r-this.sumPlotValueForHeight)/r:n;let h=c*l+(n-u-1);const d=Object.entries(this._freqs).sort(((e,t)=>e[0]!==f.G2&&t[0]!==f.G2?t[1].value-e[1].value:e[0]===f.G2&&t[0]===f.G2?0:e[0]===f.G2?-1:1));for(const[n,s]of d){const n=u*s.plotValue/this.sumPlotValue;s.bounds=new i.Rect((e-t)*l*o,h,a*l,n),h+=n}}render(e,t,n,s,r){for(const[i,o]of Object.entries(this._freqs))if(i!==f.G2){const a=(0,d.GU)(i,5),l=o.bounds,c=l.left;e.resetTransform(),e.strokeStyle="lightgray",e.lineWidth=1,e.rect(c,l.top,l.width,l.height),e.fillStyle=r.get(i)??r.get("other"),e.textAlign="left",e.font=t;const u=e.measureText(a);e.setTransform(l.width/u.width,0,0,l.height/s,c,l.top),e.fillText(a,0,-n)}}getMonomerAt(e,t){const n=Object.entries(this._freqs).find((([n,s])=>s.bounds.contains(e,t)));return n?n[0]:void 0}buildCompositionTable(e){if("-"in this._freqs)throw new Error("Unexpected monomer symbol '-'.");return(0,A._)(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 E;!function(e){e[e.None=0]="None",e[e.Render=1]="Render",e[e.Layout=1]="Layout",e[e.Freqs=2]="Freqs"}(E||(E={}));const _=new class{constructor(){this.render=20}};class x 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.seqHandler.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=++x.viewerCounter,this.setDataInProgress=!1,this.viewSubs=[],this._onSizeChanged=new u.Subject,this._onFreqsCalculated=new u.Subject,this._onLayoutCalculated=new u.Subject,this.requestedRenderLevel=E.Freqs,this.renderRequest=new u.Subject,this._onRendered=new u.Subject,this.textBaseline="top",this.seqHandler=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 n=0;"auto"===this.positionMarginState&&(n=4),this.positionMargin=this.int(b.positionMargin,n,{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(C._package.logger)}viewerToLog(){return`WebLogoViewer<${this.viewerId}>`}setData(){const e=`${this.viewerToLog()}.setData()`;C._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}}})),C._package.logger.debug(`${e}, out`)}async destroyView(){for(const e of this.viewSubs)e.unsubscribe();this.viewSubs=[];const e=this.dataFrame?"data":"null";C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.destroyView( dataFrame = ${e} ) start`),this.host.remove(),this.msgHost=void 0,this.host=void 0,C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.destroyView() end`)}async buildView(){const e=this.dataFrame?"data":"null";C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.buildView( dataFrame = ${e} ) start`),window.devicePixelRatio,this.viewSubs.push(i.debounce(this.renderRequest,_.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,u.fromEvent)(this.canvas,"mousemove").subscribe(this.canvasOnMouseMove.bind(this))),this.viewSubs.push((0,u.fromEvent)(this.canvas,"mousedown").subscribe(this.canvasOnMouseDown.bind(this))),this.viewSubs.push((0,u.fromEvent)(this.canvas,"wheel").subscribe(this.canvasOnWheel.bind(this))),this.render(E.Freqs,"buildView"),C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.buildView() end`)}rootOnSizeChanged(){C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.rootOnSizeChanged(), start `),this.render(E.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.seqHandler=h.g.forColumn(this.seqCol),this.palette=(0,d.dQ)(this.seqCol),this.render(E.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.seqHandler=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,n=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=`${n}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=n*e}calcLayoutNoFitArea(e){if(!this.host||!this.canvas||!this.slider)return;const t=this._positionWidthWithMargin*this.Length,n=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight),s=Math.min(this.root.clientWidth,t);this.canvas.style.width=`${s}px`,this.canvas.style.height=`${n}px`,this.host.style.width=`${s}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=`${s+6}px`),this.host.style.width=`${this.host}px`;const r=t>s;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 n=this.root.clientWidth/this._positionWidthWithMargin;t=Math.min(Math.max(e,0)+n,this.Length-.001),e=Math.max(0,Math.min(t,this.Length-.001)-n),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=s*e,this.canvas.height=n*e}calcLayoutFitArea(e){if(!this.host||!this.canvas||!this.slider)return;const t=this._positionWidth*this.Length,n=Math.min(Math.max(this.minHeight,this.root.clientHeight),this.maxHeight),s=t>0?(this.root.clientWidth-this.positionMarginValue*this.Length)/t:0,r=this.root.clientHeight/n,i=Math.max(1,Math.min(s,r));this._positionWidth=this.positionWidth*i,this._positionWidthWithMargin=this._positionWidth+this.positionMarginValue;const o=(this._positionWidth+this.positionMarginValue)*this.Length,a=i*n,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 n=this.root.clientWidth/this._positionWidthWithMargin;t=Math.min(Math.max(e,0)+n,this.Length-.001),e=Math.max(0,Math.min(t,this.Length-.001)-n),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(E.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(E.Layout,`onPropertyChanged(${e.name})`);break;case b.backgroundColor:this.render(E.Render,`onPropertyChanged(${e.name})`)}}onTableAttached(){C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.onTableAttached(), `),super.onTableAttached(),this.setData()}detach(){const e=`${this.viewerToLog()}.detach()`;C._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())})),C._package.logger.debug(`${e}, out`)}get onSizeChanged(){return this._onSizeChanged}get onFreqsCalculated(){return this._onFreqsCalculated}get onLayoutCalculated(){return this._onLayoutCalculated}getMonomer(e,t){const n=e.x,s=Math.floor(e.x/(this._positionWidthWithMargin*t)+Math.floor(this.slider.min)),r=this.positions[s];if(!r)return[null,null,null];const i=r.getMonomerAt(n,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=>!e.hasMonomer(f.G2)||e.getFreq(f.G2).rowCount!==e.sumRowCount)).toArray())}render(e,t){C._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(C._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,n=this.showPositionLabels?12:0;if(e>=E.Freqs&&(()=>{if(C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateFreqsInt(), start `),!this.host||!this.seqCol||!this.dataFrame)return;const e=this.seqCol.getTag(d.DX.positionNames),t=this.seqCol.getTag(d.DX.positionLabels);let n;!e&&this.endPositionName&&/\d+/.test(this.endPositionName)?n=Number(this.endPositionName):e&&this.endPositionName&&(n=e.split(d.CI).indexOf(this.endPositionName),n=-1!==n?n:void 0);const s=this.getFilter(),r=0===s.trueCount?this.seqHandler.maxLength:c().count(0).take(this.seqHandler.length).map((e=>{const t=this.seqHandler.getSplitted(e,n);return s.get(e)&&t?t.length:0})).reduce(((e,t)=>Math.max(e,t)),0);this.positionNames=e?e.split(d.CI).map((e=>e.trim())):[...Array(r).keys()].map((e=>`${e+1}`)),this.positionLabels=t?t.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):r-1;const o=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.seqHandler=h.g.forColumn(this.seqCol);const a=this.startPosition<=this.endPosition?this.endPosition-this.startPosition+1:0;this.positions=new Array(a);for(let e=0;e<o;e++){const t=this.positionNames[this.startPosition+e],n=this.positionLabels?this.positionLabels[this.startPosition+e]:void 0;this.positions[e]=new T(this.startPosition+e,t,{},{label:n})}const l=this.dataFrame.rowCount;for(let e=0;e<o;++e){for(let t=0;t<l;++t)if(s.get(t)){const n=this.seqHandler.getSplitted(t),s=e<n.length?n.getCanonical(this.startPosition+e):this.seqHandler.defaultGapOriginal,r=this.seqHandler.defaultGapOriginal===s?f.G2:s,i=this.positions[e],o=i.getFreq(r);++i.sumRowCount,o.value=++o.rowCount}if(this.valueAggrType===i.AGG.TOTAL_COUNT)continue;let t=null;try{t=this.dataFrame.getCol(this.valueColumnName),t.matches("numerical")||(t=null)}catch{t=null}if(t){for(let n=0;n<l;++n)if(s.get(n)){const s=this.seqHandler.getSplitted(n).getCanonical(this.startPosition+e),r=t.get(n);this.positions[e].getFreq(s).push(r)}this.positions[e].aggregate(this.valueAggrType)}}const u=this.valueAggrType===i.AGG.TOTAL_COUNT?0:Math.min(0,Math.min(...this.positions.map((e=>e.getMinValue()))));for(let e=0;e<o;++e)this.positions[e].calcPlotValue(u),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>=E.Layout&&((e,t,n,r)=>{C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt(), start `);const o=this.canvas.height-r*n;let a;if(this.valueAggrType===i.AGG.TOTAL_COUNT){const e=this.getAlphabetSize();this.positionHeight==m.ES.Entropy&&null==e&&s.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 s=e;s<=t;++s)s in this.positions?this.positions[s].calcScreen(s,this.slider.min,o,this.positionHeight,a,this._positionWidthWithMargin,this._positionWidth,n,r):C._package.logger.warning(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt() this.positions.length = ${this.positions.length}, jPos = ${s}`);C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.render.calculateLayoutInt(), end `),this._onLayoutCalculated.next()})(r,o,window.devicePixelRatio,n);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`,n>0&&this.positions.length>0&&function(e,t,n,s,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 n=i[t],s=e.measureText(n.name),r=s.actualBoundingBoxDescent-s.actualBoundingBoxAscent;l=null===l?s.width:Math.max(l,s.width),c=null===c?r:Math.max(c,r)}const u=l<s*t-2?1:(s*t-2)/l;for(let l=Math.floor(o);l<=Math.floor(a);l++){const a=i[l],h=(l-o)*n*t+s*t/2,d=(r*t-c)/2;e.setTransform(u,0,0,1,h,d),e.measureText(a.label),e.fillText(a.label,0,0)}}finally{e.restore()}}(a,t,this._positionWidthWithMargin,this._positionWidth,n,this.positions,this.slider.min,this.slider.max);const s="16px Roboto, Roboto Local, sans-serif",l=.25,c=12.2;for(let e=r;e<=o;e++)this.positions[e].render(a,s,l,c,this.palette)}finally{a.restore()}C._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=E.None,this.viewSyncer.sync(t,(async()=>{await this.renderInt(e)}))):C._package.logger.warning(`${t}, $(this.root).offsetParent() is the 'HTML' tag.`)}getAlphabetSize(){return this.seqHandler?.getAlphabetSize()??0}sliderOnValuesChanged(e){try{const e={minRange:this.slider.minRange,min:this.slider.min,max:this.slider.max,maxRange:this.slider.maxRange};C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.sliderOnValuesChanged( ${JSON.stringify(e)} ), start`),this.render(E.Layout,"sliderOnValuesChanged")}catch(e){const t=p(e);C._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.sliderOnValuesChanged() error:\n`+t)}}dataFrameFilterOnChanged(e){C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameFilterChanged()`);try{this.filterSource===m.Ct.Filtered&&this.render(E.Freqs,"dataFrameFilterOnChanged")}catch(e){const t=p(e);C._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameFilterOnChanged() error:\n`+t)}}dataFrameSelectionOnChanged(e){C._package.logger.debug(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameSelectionOnChanged()`);try{this.filterSource===m.Ct.Selected&&this.render(E.Freqs,"dataFrameSelectionOnChanged")}catch(e){const t=p(e);C._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.dataFrameSelectionOnChanged() error:\n`+t)}}canvasOnMouseMove(e){const t=window.devicePixelRatio;try{const n=e,s=this.canvas.getCursorPosition(n,t),[o,a]=this.getMonomer(s,t),l=this.showPositionLabels?12*t:0;if(null!==o&&null===a&&0<=s.y&&s.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,n.x+16,n.y+16)}else if(null!==o&&a&&this.dataFrame&&this.seqCol&&this.seqHandler){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 s=r.divV(t);r.tooltip.show(s,n.x+16,n.y+16)}else r.tooltip.hide()}catch(e){const t=p(e);C._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnMouseMove() error:\n`+t)}}canvasOnMouseDown(e){try{const t=e,n=window.devicePixelRatio,[s,r]=this.getMonomer(this.canvas.getCursorPosition(t,n),n);if(null!==s&&null!==r&&this.dataFrame&&this.seqCol&&this.seqHandler){const e=i.BitSet.create(this.dataFrame.selection.length,(e=>function(e,t,n,s,r,i){const o=t.getSplitted(s),a=i.pos<o.length?o.getCanonical(i.pos):null;return null!==a&&a===r}(this.dataFrame,this.seqHandler,this.getFilter(),e,r,s)));this.dataFrame.selection.init((t=>e.get(t)))}}catch(e){const t=p(e);C._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnMouseDown() error:\n`+t)}}canvasOnWheel(e){const t=window.devicePixelRatio;try{if(!this.visibleSlider)return;const n=this.canvas.width/(this._positionWidthWithMargin*t),s=e.deltaY/100*Math.max(Math.floor(n/5),1);this.slider.scrollBy(this.slider.min+s)}catch(e){const t=p(e);C._package.logger.error(`Bio: WebLogoViewer<${this.viewerId}>.canvasOnWheel() error:\n`+t)}}get onRendered(){return this._onRendered}invalidate(e){const t=`invalidate(${e?` <- ${e} `:""})`,n=`${this.viewerToLog()}.${t}`;this.render(E.None,t),this.viewSyncer.sync(`${n}`,(async()=>{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 P(e,t,n,s,r){let i=0,o=-1;for(;-1!=(o=n.findNext(o,!0));){const e=t.getSplitted(o),n=r.pos,a=n<e.length?e.getCanonical(n):null;null!==a&&a===s&&i++}return i}x.residuesSet="nucleotides",x.viewerCounter=-1},8755:(e,t,n)=>{"use strict";n.d(t,{Y:()=>o,x:()=>i});var s=n(701),r=n(7422);class i{constructor(e,t=!0){return this.substructure=e,this.readOnly=t,new Proxy(this,{set:(e,t,n)=>{if(r._package.logger.debug(`BioFilterProps.set ${t.toString()}( '${n}' )`),this.readOnly)throw new Error("Properties are immutable.");return e[t]=n,!0}})}}class o{constructor(){this.onChanged=new s.Subject,this._propsChanging=!1}get props(){return this._props||(this._props=this.emptyProps),this._props}set props(e){this._propsChanging=!0;try{this._props=e,this.applyProps(),this.onChanged.next()}finally{this._propsChanging=!1}}saveProps(){const e={};for(const[t,n]of Object.entries(this.props))"_onChanged"!==t&&(e[t]=this.props[t]);return e}async detach(){}get filterSummary(){return this.props.substructure}get isFiltering(){return""!==this.props.substructure}resetFilter(){this.props=this.emptyProps,this.onChanged.next()}}},5393:(e,t,n)=>{"use strict";n.d(t,{ST:()=>S,LH:()=>T});var s=n(3870),r=n(976),i=n(4469),o=n(6414),a=n.n(o),l=n(701),c=n(8447),u=n(2997),h=n(8607),d=n(172),m=n(7983),p=n(8755),f=n(3336),g=n.n(f),y=n(7945),w=n(4293),b=n(7422);class A extends p.Y{viewerToLog(){return`HelmBioFilter<${this.viewerId}>`}get type(){return"HelmBioFilter"}constructor(){super(),this.emptyProps=new p.x(""),this._filterPanel=s.div("",{style:{cursor:"pointer"}}),this.viewerId=++A.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,n;this.helmEditor=e.createHelmWebEditor(),this.logger.warning("TEST: HelmBioFilter.init().sync() waitForElementInDom waiting..."),await s.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=s.div(),n=e.createWebEditorApp(t,this.props.substructure),s.dialog({showHeader:!1,showFooter:!0}).add(t).onOK((()=>{try{const e=n.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,n=null}})).onCancel((()=>{g()(t).empty(),t=null,n=null})).show({modal:!0,fullScreen:!0})}))),this.viewSubs.push(s.onSizeChanged(this._filterPanel).subscribe((e=>{try{if(n){const e=n.canvas.getHelm(!0).replace(/<\/span>/g,"").replace(/<span style='background:#bbf;'>/g,"");this.updateFilterPanel(e)}}catch(e){const[t,n]=(0,y.yf)(e);this.logger.error(t,void 0,n)}})))}catch(e){const[t,n]=(0,y.yf)(e),r=this._filterPanel;r.innerText="error",r.classList.add("d4-error"),s.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,n=t/2;if(e)(0,w.Y)(this._filterPanel,this.helmEditor.host),this.helmEditor.editor.setHelm(e),this.helmEditor.resizeEditor(t,n);else{const e=s.divText("Click to edit","helm-substructure-filter");(0,w.Y)(this._filterPanel,e)}}async substructureSearch(e){const t=`${this.viewerToLog()}.substructureSearch( column = <${e.name}> )`;b._package.logger.debug(`${t}, start`);try{return await(0,u.gw)(10),await(0,m.QF)(this.props.substructure,e)}finally{b._package.logger.debug(`${t}, end`)}}}A.viewerCounter=-1;const C="bio-substructure-filter";class v{constructor(e,t,n,s,r){this.props=e,this.filterId=t,this.dataFrameId=n,this.columnName=s,this.bitset=r}}class T extends p.x{constructor(e,t){super(e,!1),this.separator=t,this.readOnly=!0}}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=s.divV([]),this.loader=s.loader(),this.calculating=!1,this.filterSyncer=new d.c(this.logger=b._package.logger),new Proxy(this,{set:(e,t,n)=>(e[t]=n,!0)})}filterToLog(){return`BioSubstructureFilter<${this.filterId}>`}attach(e){const t=super.attach.bind(this),n=`${this.filterToLog()}.attach()`;this.filterSyncer.sync(n,(async()=>{t(e),this.column||(this.columnName?this.column=this.dataFrame.getCol(this.columnName):this.column=e.columns.bySemType(r.SEMTYPE.MACROMOLECULE)),h.g.forColumn(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 E:this.notation===c.r2.SEPARATOR?new _(this.column.getTag(c.DX.separator)):new A,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(this.grokEventsOnResetFilterRequest.bind(this))),this.viewSubs.push(i.events.onCustomEvent(C).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(){const e=`${this.filterToLog()}.applyFilter()`;this.logger.debug(`${e}, IN`),this.bitset&&!this.isDetached&&this.dataFrame?.filter.and(this.bitset)}saveState(){const e=`${this.filterToLog()}.saveState()`,t=super.saveState();return this.logger.debug(`${e}, super.state = ${JSON.stringify(t)}`),t.props=this.bioFilter.saveProps(),t}applyState(e){const t=`${this.filterToLog()}.applyState()`;super.applyState(e),this.filterSyncer.sync(t,(async()=>{e.props&&this.bioFilter&&(this.bioFilter.props=r.toJs(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.saveProps())}`:"")),i.events.fireCustomEvent(C,new v(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.saveProps())}`),!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`)}}))}grokEventsOnResetFilterRequest(){const e=`${this.filterToLog()}.grokEventsOnResetFilterRequest()`;b._package.logger.debug(`${e}`),this.bioFilter?.resetFilter()}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} )`,n=`${this.filterToLog()}.${t}`;await(0,u.gw)(10),await(0,u.zg)(this.onRendered,(()=>{this.logger.debug(`${n}, _onRendered event caught`)}),(()=>{this.invalidate(t)}),e,`${n} timeout`);const s=this.filterSyncer.resetErrors();if(s.length>0)throw s[0]}}S.filterCounter=-1;class E extends p.Y{get type(){return"FastaBioFilter"}constructor(){super(),this.emptyProps=new p.x(""),this.substructureInput=s.stringInput("","",(()=>{this.props=new p.x(this.substructureInput.value),this._propsChanging||this.onChanged.next()}),{placeholder:"Substructure"})}applyProps(){this.substructureInput.value!==this.props.substructure&&(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 _ extends p.Y{get type(){return"SeparatorBioFilter"}constructor(e){super(),this.emptyProps=new T("",void 0),this.colSeparator="",this.substructureInput=s.stringInput("","",(()=>{this.props=new T(this.substructureInput.value,this.props.separator),this._propsChanging||this.onChanged.next()}),{placeholder:"Substructure"}),this.separatorInput=s.stringInput("",this.colSeparator=e,(()=>{const e=this.separatorInput.value?this.separatorInput.value:void 0;this.props=new T(this.props.substructure,e),this._propsChanging||this.onChanged.next()}),{placeholder:"Separator"})}applyProps(){this.substructureInput.value!==this.props.substructure&&(this.substructureInput.value=this.props.substructure);const e=this.props.separator??this.colSeparator;this.separatorInput.value!==e&&(this.separatorInput.value=e)}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 T("")}get filterPanel(){return s.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,n)=>{"use strict";n.d(t,{_:()=>A});var s=n(3870),r=n(976),i=(n(6414),n(8447),n(7331),n(3379)),o=n.n(i),a=n(7795),l=n.n(a),c=n(569),u=n.n(c),h=n(3565),d=n.n(h),m=n(9216),p=n.n(m),f=n(4589),g=n.n(f),y=n(5362),w={};w.styleTagTransform=g(),w.setAttributes=d(),w.insert=u().bind(null,"head"),w.domAPI=l(),w.insertStyleElement=p(),o()(y.Z,w),y.Z&&y.Z.locals&&y.Z.locals,n(8607);var b=n(6286);function A(e,t){let n=0,i=null;for(const e of Object.values(t))n+=e,i=null===i?e:Math.max(i,e);const o=i/n,a=Object.assign({},...Array.from(Object.entries(t)).sort(((e,t)=>t[1]-e[1])).map((([t,i])=>{const a=i/n,l=e.get(t),c=s.div("",{classes:"macromolecule-cell-comp-analysis-bar"});c.style.width=50*a/o+"px",c.style.backgroundColor=l,b.G2===t&&(c.style.borderWidth="1px",c.style.borderStyle="solid",c.style.borderColor=r.Color.toHtml(r.Color.lightGray));const u=b.G2===t?"-":t,h=s.div(`${(100*a).toFixed(2)}%`);return{[u]:s.div([c,h],{classes:"macromolecule-cell-comp-analysis-value"})}}))),l=s.tableFromMap(a);return Array.from(l.rows).forEach((e=>{const t=e.getElementsByClassName("macromolecule-cell-comp-analysis-bar")[0].style.backgroundColor;e.cells[0].style.color=t})),l}},540:function(e,t){!function(e){"use strict";function t(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(t.length>1){t[0]=t[0].slice(0,-1);for(var s=t.length-1,r=1;r<s;++r)t[r]=t[r].slice(1,-1);return t[s]=t[s].slice(1),t.join("")}return t[0]}function n(e){return"(?:"+e+")"}function s(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 s="[A-Za-z]",r="[0-9]",i=t(r,"[A-Fa-f]"),o=n(n("%[EFef]"+i+"%"+i+i+"%"+i+i)+"|"+n("%[89A-Fa-f]"+i+"%"+i+i)+"|"+n("%"+i+i)),a="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",l=t("[\\:\\/\\?\\#\\[\\]\\@]",a),c=e?"[\\uE000-\\uF8FF]":"[]",u=t(s,r,"[\\-\\.\\_\\~]",e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]"),h=n(s+t(s,r,"[\\+\\-\\.]")+"*"),d=n(n(o+"|"+t(u,a,"[\\:]"))+"*"),m=(n(n("25[0-5]")+"|"+n("2[0-4]"+r)+"|"+n("1"+r+r)+"|"+n("[1-9]"+r)+"|"+r),n(n("25[0-5]")+"|"+n("2[0-4]"+r)+"|"+n("1"+r+r)+"|"+n("0?[1-9]"+r)+"|0?0?"+r)),p=n(m+"\\."+m+"\\."+m+"\\."+m),f=n(i+"{1,4}"),g=n(n(f+"\\:"+f)+"|"+p),y=n(n(f+"\\:")+"{6}"+g),w=n("\\:\\:"+n(f+"\\:")+"{5}"+g),b=n(n(f)+"?\\:\\:"+n(f+"\\:")+"{4}"+g),A=n(n(n(f+"\\:")+"{0,1}"+f)+"?\\:\\:"+n(f+"\\:")+"{3}"+g),C=n(n(n(f+"\\:")+"{0,2}"+f)+"?\\:\\:"+n(f+"\\:")+"{2}"+g),v=n(n(n(f+"\\:")+"{0,3}"+f)+"?\\:\\:"+f+"\\:"+g),T=n(n(n(f+"\\:")+"{0,4}"+f)+"?\\:\\:"+g),S=n(n(n(f+"\\:")+"{0,5}"+f)+"?\\:\\:"+f),E=n(n(n(f+"\\:")+"{0,6}"+f)+"?\\:\\:"),_=n([y,w,b,A,C,v,T,S,E].join("|")),x=n(n(u+"|"+o)+"+"),P=(n(_+"\\%25"+x),n(_+n("\\%25|\\%(?!"+i+"{2})")+x)),N=n("[vV]"+i+"+\\."+t(u,a,"[\\:]")+"+"),$=n("\\["+n(P+"|"+_+"|"+N)+"\\]"),M=n(n(o+"|"+t(u,a))+"*"),L=n($+"|"+p+"(?!"+M+")|"+M),I=n(r+"*"),R=n(n(d+"@")+"?"+L+n("\\:"+I)+"?"),O=n(o+"|"+t(u,a,"[\\:\\@]")),D=n(O+"*"),F=n(O+"+"),k=n(n(o+"|"+t(u,a,"[\\@]"))+"+"),G=n(n("\\/"+D)+"*"),B=n("\\/"+n(F+G)+"?"),H=n(k+G),W=n(F+G),V="(?!"+O+")",U=(n(G+"|"+B+"|"+H+"|"+W+"|"+V),n(n(O+"|"+t("[\\/\\?]",c))+"*")),Y=n(n(O+"|[\\/\\?]")+"*"),j=n(n("\\/\\/"+R+G)+"|"+B+"|"+W+"|"+V),K=n(h+"\\:"+j+n("\\?"+U)+"?"+n("\\#"+Y)+"?"),q=n(n("\\/\\/"+R+G)+"|"+B+"|"+H+"|"+V),X=n(q+n("\\?"+U)+"?"+n("\\#"+Y)+"?");return n(K+"|"+X),n(h+"\\:"+j+n("\\?"+U)+"?"),n(n("\\/\\/("+n("("+d+")@")+"?("+L+")"+n("\\:("+I+")")+"?)")+"?("+G+"|"+B+"|"+W+"|"+V+")"),n("\\?("+U+")"),n("\\#("+Y+")"),n(n("\\/\\/("+n("("+d+")@")+"?("+L+")"+n("\\:("+I+")")+"?)")+"?("+G+"|"+B+"|"+H+"|"+V+")"),n("\\?("+U+")"),n("\\#("+Y+")"),n(n("\\/\\/("+n("("+d+")@")+"?("+L+")"+n("\\:("+I+")")+"?)")+"?("+G+"|"+B+"|"+W+"|"+V+")"),n("\\?("+U+")"),n("\\#("+Y+")"),n("("+d+")@"),n("\\:("+I+")"),{NOT_SCHEME:new RegExp(t("[^]",s,r,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(t("[^\\%\\:]",u,a),"g"),NOT_HOST:new RegExp(t("[^\\%\\[\\]\\:]",u,a),"g"),NOT_PATH:new RegExp(t("[^\\%\\/\\:\\@]",u,a),"g"),NOT_PATH_NOSCHEME:new RegExp(t("[^\\%\\/\\@]",u,a),"g"),NOT_QUERY:new RegExp(t("[^\\%]",u,a,"[\\:\\@\\/\\?]",c),"g"),NOT_FRAGMENT:new RegExp(t("[^\\%]",u,a,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(t("[^]",u,a),"g"),UNRESERVED:new RegExp(u,"g"),OTHER_CHARS:new RegExp(t("[^\\%]",u,l),"g"),PCT_ENCODED:new RegExp(o,"g"),IPV4ADDRESS:new RegExp("^("+p+")$"),IPV6ADDRESS:new RegExp("^\\[?("+_+")"+n(n("\\%25|\\%(?!"+i+"{2})")+"("+x+")")+"?\\]?$")}}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 n=[],s=!0,r=!1,i=void 0;try{for(var o,a=e[Symbol.iterator]();!(s=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);s=!0);}catch(e){r=!0,i=e}finally{try{!s&&a.return&&a.return()}finally{if(r)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},c=2147483647,u=36,h=/^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 n=e.split("@"),s="";return n.length>1&&(s=n[0]+"@",e=n[1]),s+function(e,t){for(var n=[],s=e.length;s--;)n[s]=t(e[s]);return n}((e=e.replace(m,".")).split("."),t).join(".")}function b(e){for(var t=[],n=0,s=e.length;n<s;){var r=e.charCodeAt(n++);if(r>=55296&&r<=56319&&n<s){var i=e.charCodeAt(n++);56320==(64512&i)?t.push(((1023&r)<<10)+(1023&i)+65536):(t.push(r),n--)}else t.push(r)}return t}var A=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},C=function(e,t,n){var s=0;for(e=n?f(e/700):e>>1,e+=f(e/t);e>455;s+=u)e=f(e/35);return f(s+36*e/(e+38))},v=function(e){var t,n=[],s=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"),n.push(e.charCodeAt(l));for(var h=a>0?a+1:0;h<s;){for(var d=r,m=1,p=u;;p+=u){h>=s&&y("invalid-input");var g=(t=e.charCodeAt(h++))-48<10?t-22:t-65<26?t-65:t-97<26?t-97:u;(g>=u||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=u-w;m>f(c/b)&&y("overflow"),m*=b}var A=n.length+1;o=C(r-d,A,0==d),f(r/A)>c-i&&y("overflow"),i+=f(r/A),r%=A,n.splice(r++,0,i)}return String.fromCodePoint.apply(String,n)},T=function(e){var t=[],n=(e=b(e)).length,s=128,r=0,i=72,o=!0,a=!1,l=void 0;try{for(var h,d=e[Symbol.iterator]();!(o=(h=d.next()).done);o=!0){var m=h.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<n;){var v=c,T=!0,S=!1,E=void 0;try{for(var _,x=e[Symbol.iterator]();!(T=(_=x.next()).done);T=!0){var P=_.value;P>=s&&P<v&&(v=P)}}catch(e){S=!0,E=e}finally{try{!T&&x.return&&x.return()}finally{if(S)throw E}}var N=w+1;v-s>f((c-r)/N)&&y("overflow"),r+=(v-s)*N,s=v;var $=!0,M=!1,L=void 0;try{for(var I,R=e[Symbol.iterator]();!($=(I=R.next()).done);$=!0){var O=I.value;if(O<s&&++r>c&&y("overflow"),O==s){for(var D=r,F=u;;F+=u){var k=F<=i?1:F>=i+26?26:F-i;if(D<k)break;var G=D-k,B=u-k;t.push(g(A(k+G%B,0))),D=f(G/B)}t.push(g(A(D,0))),i=C(r,N,w==p),r=0,++w}}}catch(e){M=!0,L=e}finally{try{!$&&R.return&&R.return()}finally{if(M)throw L}}++r,++s}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,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(e))}},decode:v,encode:T,toASCII:function(e){return w(e,(function(e){return d.test(e)?"xn--"+T(e):e}))},toUnicode:function(e){return w(e,(function(e){return h.test(e)?v(e.slice(4).toLowerCase()):e}))}},E={};function _(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 x(e){for(var t="",n=0,s=e.length;n<s;){var r=parseInt(e.substr(n+1,2),16);if(r<128)t+=String.fromCharCode(r),n+=3;else if(r>=194&&r<224){if(s-n>=6){var i=parseInt(e.substr(n+4,2),16);t+=String.fromCharCode((31&r)<<6|63&i)}else t+=e.substr(n,6);n+=6}else if(r>=224){if(s-n>=9){var o=parseInt(e.substr(n+4,2),16),a=parseInt(e.substr(n+7,2),16);t+=String.fromCharCode((15&r)<<12|(63&o)<<6|63&a)}else t+=e.substr(n,9);n+=9}else t+=e.substr(n,3),n+=3}return t}function P(e,t){function n(e){var n=x(e);return n.match(t.UNRESERVED)?n:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,n).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,n).replace(t.NOT_USERINFO,_).replace(t.PCT_ENCODED,r)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,n).toLowerCase().replace(t.NOT_HOST,_).replace(t.PCT_ENCODED,r)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,n).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,_).replace(t.PCT_ENCODED,r)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,n).replace(t.NOT_QUERY,_).replace(t.PCT_ENCODED,r)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,n).replace(t.NOT_FRAGMENT,_).replace(t.PCT_ENCODED,r)),e}function N(e){return e.replace(/^0*(.*)/,"$1")||"0"}function $(e,t){var n=e.match(t.IPV4ADDRESS)||[],s=l(n,2)[1];return s?s.split(".").map(N).join("."):e}function M(e,t){var n=e.match(t.IPV6ADDRESS)||[],s=l(n,3),r=s[1],i=s[2];if(r){for(var o=r.toLowerCase().split("::").reverse(),a=l(o,2),c=a[0],u=a[1],h=u?u.split(":").map(N):[],d=c.split(":").map(N),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]=h[y]||d[f+y]||"";m&&(g[p-1]=$(g[p-1],t));var w=g.reduce((function(e,t,n){if(!t||"0"===t){var s=e[e.length-1];s&&s.index+s.length===n?s.length++:e.push({index:n,length:1})}return e}),[]).sort((function(e,t){return t.length-e.length}))[0],b=void 0;if(w&&w.length>1){var A=g.slice(0,w.index),C=g.slice(w.index+w.length);b=A.join(":")+"::"+C.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]:{},n={},s=!1!==t.iri?a:o;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var r=e.match(L);if(r){I?(n.scheme=r[1],n.userinfo=r[3],n.host=r[4],n.port=parseInt(r[5],10),n.path=r[6]||"",n.query=r[7],n.fragment=r[8],isNaN(n.port)&&(n.port=r[5])):(n.scheme=r[1]||void 0,n.userinfo=-1!==e.indexOf("@")?r[3]:void 0,n.host=-1!==e.indexOf("//")?r[4]:void 0,n.port=parseInt(r[5],10),n.path=r[6]||"",n.query=-1!==e.indexOf("?")?r[7]:void 0,n.fragment=-1!==e.indexOf("#")?r[8]:void 0,isNaN(n.port)&&(n.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?r[4]:void 0)),n.host&&(n.host=M($(n.host,s),s)),void 0!==n.scheme||void 0!==n.userinfo||void 0!==n.host||void 0!==n.port||n.path||void 0!==n.query?void 0===n.scheme?n.reference="relative":void 0===n.fragment?n.reference="absolute":n.reference="uri":n.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==n.reference&&(n.error=n.error||"URI is not a "+t.reference+" reference.");var i=E[(t.scheme||n.scheme||"").toLowerCase()];if(t.unicodeSupport||i&&i.unicodeSupport)P(n,s);else{if(n.host&&(t.domainHost||i&&i.domainHost))try{n.host=S.toASCII(n.host.replace(s.PCT_ENCODED,x).toLowerCase())}catch(e){n.error=n.error||"Host's domain name can not be converted to ASCII via punycode: "+e}P(n,o)}i&&i.parse&&i.parse(n,t)}else n.error=n.error||"URI can not be parsed.";return n}var O=/^\.\.?\//,D=/^\/\.(\/|$)/,F=/^\/\.\.(\/|$)/,k=/^\/?(?:.|\n)*?(?=\/|$)/;function G(e){for(var t=[];e.length;)if(e.match(O))e=e.replace(O,"");else if(e.match(D))e=e.replace(D,"/");else if(e.match(F))e=e.replace(F,"/"),t.pop();else if("."===e||".."===e)e="";else{var n=e.match(k);if(!n)throw new Error("Unexpected dot segment condition");var s=n[0];e=e.slice(s.length),t.push(s)}return t.join("")}function B(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.iri?a:o,s=[],r=E[(t.scheme||e.scheme||"").toLowerCase()];if(r&&r.serialize&&r.serialize(e,t),e.host)if(n.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(n.PCT_ENCODED,x).toLowerCase())}catch(n){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+n}P(e,n),"suffix"!==t.reference&&e.scheme&&(s.push(e.scheme),s.push(":"));var i=function(e,t){var n=!1!==t.iri?a:o,s=[];return void 0!==e.userinfo&&(s.push(e.userinfo),s.push("@")),void 0!==e.host&&s.push(M($(String(e.host),n),n).replace(n.IPV6ADDRESS,(function(e,t,n){return"["+t+(n?"%25"+n:"")+"]"}))),"number"!=typeof e.port&&"string"!=typeof e.port||(s.push(":"),s.push(String(e.port))),s.length?s.join(""):void 0}(e,t);if(void 0!==i&&("suffix"!==t.reference&&s.push("//"),s.push(i),e.path&&"/"!==e.path.charAt(0)&&s.push("/")),void 0!==e.path){var l=e.path;t.absolutePath||r&&r.absolutePath||(l=G(l)),void 0===i&&(l=l.replace(/^\/\//,"/%2F")),s.push(l)}return void 0!==e.query&&(s.push("?"),s.push(e.query)),void 0!==e.fragment&&(s.push("#"),s.push(e.fragment)),s.join("")}function H(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s={};return arguments[3]||(e=R(B(e,n),n),t=R(B(t,n),n)),!(n=n||{}).tolerant&&t.scheme?(s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=G(t.path||""),s.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=G(t.path||""),s.query=t.query):(t.path?("/"===t.path.charAt(0)?s.path=G(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:s.path=t.path:s.path="/"+t.path,s.path=G(s.path)),s.query=t.query):(s.path=e.path,void 0!==t.query?s.query=t.query:s.query=e.query),s.userinfo=e.userinfo,s.host=e.host,s.port=e.port),s.scheme=e.scheme),s.fragment=t.fragment,s}function W(e,t){return e&&e.toString().replace(t&&t.iri?a.PCT_ENCODED:o.PCT_ENCODED,x)}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 n="https"===String(e.scheme).toLowerCase();return e.port!==(n?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 Y(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var j={scheme:"ws",domainHost:!0,parse:function(e,t){var n=e;return n.secure=Y(n),n.resourceName=(n.path||"/")+(n.query?"?"+n.query:""),n.path=void 0,n.query=void 0,n},serialize:function(e,t){if(e.port!==(Y(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 n=e.resourceName.split("?"),s=l(n,2),r=s[0],i=s[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:j.domainHost,parse:j.parse,serialize:j.serialize},q={},X="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Z="[0-9A-Fa-f]",z=n(n("%[EFef]"+Z+"%"+Z+Z+"%"+Z+Z)+"|"+n("%[89A-Fa-f]"+Z+"%"+Z+Z)+"|"+n("%"+Z+Z)),J=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),Q=new RegExp(X,"g"),ee=new RegExp(z,"g"),te=new RegExp(t("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',J),"g"),ne=new RegExp(t("[^]",X,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),se=ne;function re(e){var t=x(e);return t.match(Q)?t:e}var ie={scheme:"mailto",parse:function(e,t){var n=e,s=n.to=n.path?n.path.split(","):[];if(n.path=void 0,n.query){for(var r=!1,i={},o=n.query.split("&"),a=0,l=o.length;a<l;++a){var c=o[a].split("=");switch(c[0]){case"to":for(var u=c[1].split(","),h=0,d=u.length;h<d;++h)s.push(u[h]);break;case"subject":n.subject=W(c[1],t);break;case"body":n.body=W(c[1],t);break;default:r=!0,i[W(c[0],t)]=W(c[1],t)}}r&&(n.headers=i)}n.query=void 0;for(var m=0,p=s.length;m<p;++m){var f=s[m].split("@");if(f[0]=W(f[0]),t.unicodeSupport)f[1]=W(f[1],t).toLowerCase();else try{f[1]=S.toASCII(W(f[1],t).toLowerCase())}catch(e){n.error=n.error||"Email address's domain name can not be converted to ASCII via punycode: "+e}s[m]=f.join("@")}return n},serialize:function(e,t){var n,s=e,i=null!=(n=e.to)?n instanceof Array?n:"number"!=typeof n.length||n.split||n.setInterval||n.call?[n]:Array.prototype.slice.call(n):[];if(i){for(var o=0,a=i.length;o<a;++o){var l=String(i[o]),c=l.lastIndexOf("@"),u=l.slice(0,c).replace(ee,re).replace(ee,r).replace(te,_),h=l.slice(c+1);try{h=t.iri?S.toUnicode(h):S.toASCII(W(h,t).toLowerCase())}catch(e){s.error=s.error||"Email address's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+e}i[o]=u+"@"+h}s.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(ne,_)+"="+d[p].replace(ee,re).replace(ee,r).replace(se,_));return m.length&&(s.query=m.join("&")),s}},oe=/^([^\:]+)\:(.*)/,ae={scheme:"urn",parse:function(e,t){var n=e.path&&e.path.match(oe),s=e;if(n){var r=t.scheme||s.scheme||"urn",i=n[1].toLowerCase(),o=n[2],a=r+":"+(t.nid||i),l=E[a];s.nid=i,s.nss=o,s.path=void 0,l&&(s=l.parse(s,t))}else s.error=s.error||"URN can not be parsed.";return s},serialize:function(e,t){var n=t.scheme||e.scheme||"urn",s=e.nid,r=n+":"+(t.nid||s),i=E[r];i&&(e=i.serialize(e,t));var o=e,a=e.nss;return o.path=(s||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 n=e;return n.uuid=n.nss,n.nss=void 0,t.tolerant||n.uuid&&n.uuid.match(le)||(n.error=n.error||"UUID is not valid."),n},serialize:function(e,t){var n=e;return n.nss=(e.uuid||"").toLowerCase(),n}};E[V.scheme]=V,E[U.scheme]=U,E[j.scheme]=j,E[K.scheme]=K,E[ie.scheme]=ie,E[ae.scheme]=ae,E[ce.scheme]=ce,e.SCHEMES=E,e.pctEncChar=_,e.pctDecChars=x,e.parse=R,e.removeDotSegments=G,e.serialize=B,e.resolveComponents=H,e.resolve=function(e,t,n){var s=function(e,t){var n=e;if(t)for(var s in t)n[s]=t[s];return n}({scheme:"null"},n);return B(H(R(e,s),R(t,s),s,!0),s)},e.normalize=function(e,t){return"string"==typeof e?e=B(R(e,t),t):"object"===s(e)&&(e=R(B(e,t),t)),e},e.equal=function(e,t,n){return"string"==typeof e?e=B(R(e,n),n):"object"===s(e)&&(e=B(e,n)),"string"==typeof t?t=B(R(t,n),n):"object"===s(t)&&(t=B(t,n)),e===t},e.escapeComponent=function(e,t){return e&&e.toString().replace(t&&t.iri?a.ESCAPE:o.ESCAPE,_)},e.unescapeComponent=W,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 n(s){var r=t[s];if(void 0!==r)return r.exports;var i=t[s]={id:s,loaded:!1,exports:{}};return e[s].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.m=e,n.amdO={},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.u=e=>e+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.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),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var s=t.getElementsByTagName("script");if(s.length)for(var r=s.length-1;r>-1&&!e;)e=s[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),n.b=document.baseURI||self.location.href,n.nc=void 0;var s={};(()=>{"use strict";n.r(s),n.d(s,{_package:()=>ve,test:()=>Te,tests:()=>t.QK});var e=n(976),t=n(2997);(0,t.W3)("_first",(()=>{(0,t.Bu)("_first",(async()=>{}))}));var r=n(2012),i=n(9976),o=n(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,n=r.f.RasMol,s=r.f.GrokGroups;(0,t.l_)(e instanceof i.B,!0),(0,t.l_)(n instanceof i.B,!0),(0,t.l_)(s instanceof i.B,!0),(0,t.l_)(e instanceof r.f,!0),(0,t.l_)(n instanceof r.f,!0),(0,t.l_)(s instanceof r.f,!0)}()})),(0,t.Bu)("testPalettePtMe",(async()=>{const e=r.f.GrokGroups.get("MeNle"),n=r.f.GrokGroups.get("MeA"),s=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_)(n,a),(0,t.l_)(s,l),(0,t.l_)(i,c)}))}));var a=n(4469),l=n(7422),c=n(8447),u=n(8607);class h{constructor(e,t,n,s,r,i){this.units=e,this.aligned=t,this.alphabet=n,this.alphabetSize=s,this.alphabetIsMultichar=r,this.separator=i}}async function d(t){const n=e.Column.fromList(e.TYPE.STRING,"col1",t);if(await a.functions.call("Bio:detectMacromolecule",{col:n}),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(t,n){const s=(await t()).getCol(n),r=await a.functions.call("Bio:detectMacromolecule",{col:s});if(r&&(s.semType=r),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 p(n,s,r,i,o,l,h=null){const d=e.Column.fromList(e.TYPE.STRING,"seq",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),s),(0,t.l_)(d.getTag(c.DX.aligned),r),(0,t.l_)(d.getTag(c.DX.alphabet),i),h&&(0,t.l_)(d.getTag(c.DX.separator),h);const p=u.g.forColumn(d);(0,t.l_)(p.getAlphabetSize(),o),(0,t.l_)(p.getAlphabetIsMultichar(),l),p.isHelm()||((0,t.l_)(p.aligned,r),(0,t.l_)(p.alphabet,i))}async function f(n,s,r,i,o,l,h,d=null){const m=(await n()).col(s),p=await a.functions.call("Bio:detectMacromolecule",{col:m});p&&(m.semType=p),(0,t.l_)(m.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(m.getTag(e.TAGS.UNITS),r),(0,t.l_)(m.getTag(c.DX.aligned),i),(0,t.l_)(m.getTag(c.DX.alphabet),o),d&&(0,t.l_)(m.getTag(c.DX.separator),d);const f=u.g.forColumn(m);(0,t.l_)(f.getAlphabetSize(),l),(0,t.l_)(f.getAlphabetIsMultichar(),h),f.isHelm()||((0,t.l_)(f.aligned,i),(0,t.l_)(f.alphabet,o))}async function g(e,t){const n=await e(),s=[];for(const r of n.columns.names())if(r in t){const n=t[r];try{await f(e,r,n.units,n.aligned,n.alphabet,n.alphabetSize,n.alphabetIsMultichar,n.separator)}catch(e){const t=e.toString();s.push(`Positive col '${r}' failed: ${t}`)}}else try{await m(e,r)}catch(e){const t=e.toString();s.push(`Negative col '${r}' failed: ${t}`)}if(s.length>0)throw new Error(s.join("\n"))}(0,t.W3)("detectors",(()=>{var n,s,r,i,o,l,u,y,w,b,A,C,v,T,S;const E={negEmpty:{csv:"id,col1\n1,\n2,\n3,\n4,\n5,",neg:["col1"]},negNum1:{csv:"col1\n1\n2\n3",neg:["col1"]},negNum2:{csv:"col1\n4\n5\n6\n7",neg:["col1"]},negNum3:{csv:"col1\n8\n9\n10\n11\n12",neg:["col1"]},negSmiles:{csv:"col1\nCCCCN1C(=O)CN=C(c2cc(F)ccc12)C3CCCCC3\nC1CCCCC1\nCCCCCC",neg:["col1"]},fastaMsaSameLength:{csv:"seq\nFWPHEYFWPHEYYV\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",pos:{seq:new h(c.r2.FASTA,"SEQ.MSA",c.fb.PT,20,!1,void 0)}},fastaExtSameLength:{csv:"seq\nFW[Ac]PHEYFWPH\nYN[Re]VYNRQWYV\n[Me]EYVMPS[Et]",pos:{seq:new h(c.r2.FASTA,"SEQ",c.fb.UN,16,!0,void 0)}},fastaMsaExtSameLength:{csv:"seq\nFW[Ac]PHEY[Re]WPH\nYN[Re]VYNR[Ac]WYV\n[Me]EYVMPSFW[Me]H",pos:{seq:new h(c.r2.FASTA,"SEQ.MSA",c.fb.UN,14,!0,void 0)}},sepSameLength:{csv:"seq\nAc(1)-A-A-A-A-A-A-A-A-A-A-A-A-A-C(1)-G-NH2\nAc(1)-A-A-A-A-A-A-A-A-A-A-A-A-A-C(1)-G-NH2\nAc(1)-A-A-A-A-A-A-A-A-A-A-A-A-A-C(1)-G-NH2",pos:{seq:new h(c.r2.SEPARATOR,"SEQ.MSA",c.fb.UN,5,!0,"-")}},sepMsaSameLength:{csv:"seq\nAc(1)-A-A-A-A-A-A-A-A-A-A-A-A-A-C(1)-G-NH2\nAc(1)-A-A(2)-A-A-A-C(2)-A-A-A-A-C(1)-G-NH2\nAc(1)-A-A-A-A-A-A-A-A-A-A-A-A-A-C(1)-G-NH2",pos:{seq:new h(c.r2.SEPARATOR,"SEQ",c.fb.UN,5,!0,"-")}},helmSameLength:{csv:"seq\nPEPTIDE1{Ac(1).A.A.A.A.A.A.A.A.A.A.A.A.A.C(1).G.NH2}$$$$\nPEPTIDE1{Ab(1).Y.V.K.H.P.F.W.R.W.Y.A.A.A.C(1).G.NH2}$$$$\nPEPTIDE1{Ad(1).S.W.Y.C.K.H.P.M.W.A.A.A.A.C(1)-G-NH2}$$$$",pos:{seq:new h(c.r2.HELM,null,null,19,void 0,void 0)}}};for(const[n,s]of Object.entries(E))(0,t.Bu)(`csvData2-${n}`,(async()=>{const t=(r=n,async()=>{const t=E[r].csv,n=e.DataFrame.fromCsv(t);return await a.data.detectSemanticTypes(n),n});var r;for(const e of s.neg??[])await m(t,e);for(const[e,n]of Object.entries(s.pos??{}))await f(t,e,n.units,n.aligned,n.alphabet,n.alphabetSize,n.alphabetIsMultichar,n.separator)}));const _=new(S=class{constructor(){this[n]="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",this[s]="seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",this[r]="seq\nFWPHEY\nYNRQWYV\nMKPSEYV",this[i]="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[o]="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[l]="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[u]="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[y]="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[w]="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[b]="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[A]="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[C]="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[v]="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT",this[T]="seq\nFWR-WYV-KHPFWR-WYV-KHP\nYNR-WYV-KHPYNR-WYV-KHP\nMWRSWY-CKHPMWRSWY-CKHP"}},n="csvFastaDna1",s="fastaRna1",r="fastaPt1",i="fastaUn",o="sepDna",l="sepRna",u="sepPt",y="sepUn1",w="sepUn2",b="sepMsaDna1",A="sepMsaUnWEmpty",C="sepComplex",v="fastaMsaDna1",T="fastaMsaPt1",S),x={fastaFasta:"System:AppData/Bio/samples/FASTA.fasta",fastaPtCsv:"System:AppData/Bio/samples/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"},P={};function N(e,t=$){return async()=>(e in P||(P[e]=(async()=>await t(x[e]))().catch((t=>{throw delete P[e],t}))),P[e])}async function $(t){const n=await a.dapi.files.readAsText(t);return e.DataFrame.fromCsv(n)}const M=t=>async()=>{const n=_[t],s=e.DataFrame.fromCsv(n);return await a.data.detectSemanticTypes(s),s};(0,t.Bu)("NegativeStartEnd",(async()=>{await d(["START","END"])})),(0,t.Bu)("NegativeStartEndIntermediate",(async()=>{await d(["START","END","INTERMEDIATE"])})),(0,t.Bu)("FastaDna1",(async()=>{await f(M("csvFastaDna1"),"seq",c.r2.FASTA,"SEQ",c.fb.DNA,4,!1)})),(0,t.Bu)("FastaRna1",(async()=>{await f(M("fastaRna1"),"seq",c.r2.FASTA,"SEQ",c.fb.RNA,4,!1)})),(0,t.Bu)("FastaPt1",(async()=>{await f(M("fastaPt1"),"seq",c.r2.FASTA,"SEQ",c.fb.PT,20,!1)})),(0,t.Bu)("FastaPtGaps",(()=>p(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEYV"],c.r2.FASTA,"SEQ",c.fb.PT,20,!1))),(0,t.Bu)("FastaPtGapsMsa",(()=>p(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEY"],c.r2.FASTA,"SEQ.MSA",c.fb.PT,20,!1))),(0,t.Bu)("FastaUn",(async()=>{await f(M("fastaUn"),"seq",c.r2.FASTA,"SEQ.MSA",c.fb.UN,12,!0)})),(0,t.Bu)("FastaMsaDna1",(async()=>{await f(M("fastaMsaDna1"),"seq",c.r2.FASTA,"SEQ.MSA",c.fb.DNA,4,!1)})),(0,t.Bu)("FastaMsaPt1",(async()=>{await f(M("fastaMsaPt1"),"seq",c.r2.FASTA,"SEQ.MSA",c.fb.PT,20,!1)})),(0,t.Bu)("SepDna",(async()=>{await f(M("sepDna"),"seq",c.r2.SEPARATOR,"SEQ",c.fb.DNA,4,!1,"*")})),(0,t.Bu)("SepRna",(async()=>{await f(M("sepRna"),"seq",c.r2.SEPARATOR,"SEQ",c.fb.RNA,4,!1,"*")})),(0,t.Bu)("SepPt",(async()=>{await f(M("sepPt"),"seq",c.r2.SEPARATOR,"SEQ",c.fb.PT,20,!1,"-")})),(0,t.Bu)("SepUn1",(async()=>{await f(M("sepUn1"),"seq",c.r2.SEPARATOR,"SEQ",c.fb.UN,8,!0,"-")})),(0,t.Bu)("SepUn2",(async()=>{await f(M("sepUn2"),"seq",c.r2.SEPARATOR,"SEQ",c.fb.UN,9,!0,"/")})),(0,t.Bu)("SepMsaN1",(async()=>{await f(M("sepMsaDna1"),"seq",c.r2.SEPARATOR,"SEQ.MSA",c.fb.DNA,4,!1,"-")})),(0,t.Bu)("SepMsaUnWEmpty",(async()=>{await f(M("sepMsaUnWEmpty"),"seq",c.r2.SEPARATOR,"SEQ.MSA",c.fb.UN,14,!0)})),(0,t.Bu)("SepComplex",(async()=>{await f(M("sepComplex"),"seq",c.r2.SEPARATOR,"SEQ",c.fb.UN,18,!0)})),(0,t.Bu)("samplesFastaCsv",(async()=>{await g(N("fastaCsv"),{Sequence:new h(c.r2.FASTA,"SEQ",c.fb.PT,20,!1)})})),(0,t.Bu)("samplesFastaFasta",(async()=>{await g(N("fastaFasta"),{sequence:new h(c.r2.FASTA,"SEQ",c.fb.PT,20,!1)})})),(0,t.Bu)("samplesPeptidesComplex",(async()=>{await g(N("peptidesComplex"),{})})),(0,t.Bu)("samplesMsaComplex",(async()=>{await g(N("msaComplex"),{MSA:new h(c.r2.SEPARATOR,"SEQ.MSA",c.fb.UN,161,!0,"/")})})),(0,t.Bu)("samplesIdCsv",(async()=>{await g(N("testIdCsv"),{})})),(0,t.Bu)("samplesSarSmallCsv",(async()=>{await g(N("testSmilesCsv"),{})})),(0,t.Bu)("samplesHelmCsv",(async()=>{await g(N("helmCsv"),{HELM:new h(c.r2.HELM,null,null,160,!0)})})),(0,t.Bu)("samplesTestHelmCsv",(async()=>{await g(N("testHelmCsv"),{"HELM string":new h(c.r2.HELM,null,null,9,!0)})})),(0,t.Bu)("samplesTestDemogCsv",(async()=>{await g(N("testDemogCsv"),{})})),(0,t.Bu)("samplesTestSmiles2Csv",(async()=>{await g(N("testSmiles2Csv"),{})})),(0,t.Bu)("samplesTestSmilesShort",(async()=>{await g(N("testSmilesShort"),{})})),(0,t.Bu)("samplesTestActivityCliffsNegativeSmiles",(async()=>{await g(N("testActivityCliffsCsv"),{})})),(0,t.Bu)("samplesFastaPtCsv",(async()=>{await g(N("fastaPtCsv"),{sequence:new h(c.r2.FASTA,"SEQ",c.fb.PT,20,!1)})})),(0,t.Bu)("samplesTestCerealCsv",(async()=>{await g(N("testCerealCsv"),{})})),(0,t.Bu)("samplesTestUnichemSources",(async()=>{await g(N("testUnichemSources"),{})})),(0,t.Bu)("samplesTestDmvOffices",(async()=>{await g(N("testDmvOffices"),{})})),(0,t.Bu)("samplesTestAlertCollection",(async()=>{await g(N("testAlertCollection"),{})})),(0,t.Bu)("samplesTestSpgi",(async()=>{await g(N("testSpgi"),{})})),(0,t.Bu)("samplesTestSpgi100",(async()=>{await g(N("testSpgi100"),{})})),(0,t.Bu)("samplesTestUrl",(async()=>{await g(N("testUrl"),{})}))})),(0,t.W3)("detectors:weak-and-likely",(()=>{const n={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"},s=t=>async()=>{const s=n[t],r=e.DataFrame.fromCsv(s);return await a.data.detectSemanticTypes(r),r};(0,t.Bu)("fastaDnaWeak1",(async()=>{await m(s("fastaDnaWeak1"),"colName")})),(0,t.Bu)("fastaDnaWeak1LikelyName",(async()=>{await f(s("fastaDnaWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA",c.fb.DNA,4,!1)})),(0,t.Bu)("fastaRnaWeak1",(async()=>{await m(s("fastaRnaWeak1"),"colName")})),(0,t.Bu)("fastaRnaWeak1LikelyName",(async()=>{await f(s("fastaRnaWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA",c.fb.RNA,4,!1)})),(0,t.Bu)("fastaPtWeak1",(async()=>{await m(s("fastaPtWeak1"),"colName")})),(0,t.Bu)("fastaPtWeak1LikelyName",(async()=>{await f(s("fastaPtWeak1LikelyName"),"seq",c.r2.FASTA,"SEQ.MSA",c.fb.PT,20,!1)})),(0,t.Bu)("fastaUn1",(async()=>{await m(s("fastaUn1"),"colName")})),(0,t.Bu)("fastaUn1LikelyName",(async()=>{await m(s("fastaUn1LikelyName"),"seq")})),(0,t.Bu)("fastaUn2LikelyName",(async()=>{await m(s("fastaUn2LikelyName"),"protein")})),(0,t.Bu)("fastaUnMsa1LikelyName",(async()=>{await m(s("fastaUnMsa1LikelyName"),"seq")}))})),(0,t.W3)("detectorsBenchmark",(()=>{let n;async function s(s,i,o,a,l,h){return await async function(s,d,m,p){const f=await(async()=>{const t=function(t,n,s,r,i){let o;switch(t){case c.r2.FASTA:o=e=>{let t="";for(let n=0;n<e.length;n++){const s=e[n];t+=1==s.length?s:`[${s}]`}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 n=new Array(t);for(let s=0;s<t;s++)n[s]=e[Math.floor(Math.random()*e.length)];return o(n,i)},l=Array(r);for(let e=0;e<r;e++)l[e]=a(n,s);return e.Column.fromStrings("seq",l)}(i,[...(0,c.gM)(o)],a,l,h),s=n.prepare({col:t});return await r(s),s})(),g=Date.now(),y=await(async e=>r(e))(f),w=Date.now();(function(e,n){const s=u.g.forColumn(e);(0,t.l_)(e.semType===n.semType,!0),(0,t.l_)(s.notation===n.notation,!0),(0,t.l_)(s.alphabet===n.alphabet,!0),(0,t.l_)(s.separator===n.separator,!0)})(y,{semType:e.SEMTYPE.MACROMOLECULE,notation:i,alphabet:o,separator:h});const b=w-g;if(b>s){const e=`ET ${b} ms is more than max allowed ${s} ms.`;throw console.error(e),new Error(e)}return console.log(`ET ${b} ms is OK.`),b}(s)}async function r(e){await e.call();const t=e.getOutputParamValue(),n=e.inputs.col;return t&&(n.semType=t),n}(0,t.bb)((async()=>{const t=e.Func.find({package:"Bio",name:"detectMacromolecule"});n=t[0];const s=e.Column.fromStrings("seq",["ACGT","ACGT","ACGT"]);await n.prepare({col:s}).call()})),(0,t.Bu)("fastaDnaShorts50Few50",(async()=>{await s(10,c.r2.FASTA,c.fb.DNA,50,50)})),(0,t.Bu)("fastaDnaShorts50Many1E6",(async()=>{await s(20,c.r2.FASTA,c.fb.DNA,50,1e6)})),(0,t.Bu)("fastaDnaLong1e6Few50",(async()=>{await s(20,c.r2.FASTA,c.fb.DNA,1e6,50)})),(0,t.Bu)("separatorDnaShorts50Few50",(async()=>{await s(10,c.r2.SEPARATOR,c.fb.DNA,50,50,"/")})),(0,t.Bu)("separatorDnaShorts50Many1E6",(async()=>{await s(20,c.r2.SEPARATOR,c.fb.DNA,50,1e6,"/")})),(0,t.Bu)("separatorDnaLong1e6Few50",(async()=>{await s(20,c.r2.SEPARATOR,c.fb.DNA,1e6,50,"/")}))}));var y=n(6098),w=n(525),b=n(6032);async function A(n,s){const r=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(r);const i=e.DataFrame.fromCsv(s),o=r.getCol("seq");(0,t.l_)(o.semType,e.SEMTYPE.MACROMOLECULE);const l=i.getCol("seq"),c=await(0,y.U4)(o,!0);(0,t.f6)(c.toList(),l.toList())}async function C(n,s,r,i,o,l){const u=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(u);const h=e.DataFrame.fromCsv(s).getCol("seq"),d=u.getCol("seq");(0,t.l_)(d.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(d.getTag(e.TAGS.UNITS),r),o&&(0,t.l_)(d.getTag(c.DX.alphabet),o);const m=await(0,w.K)({col:d,pepsea:{method:l}});(0,t.l_)(m.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(m.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(m.getTag(e.TAGS.UNITS),i),(0,t.l_)(m.getTag(c.DX.aligned),"SEQ.MSA"),o&&(0,t.l_)(m.getTag(c.DX.alphabet),o),(0,t.f6)(m.toList(),h.toList())}(0,t.W3)("MSA",(async()=>{(0,t.Bu)("isCorrect",(async()=>{await A("seq\nFWRWYVKHP\nYNRWYVKHP\nMWRSWYCKHP","seq\nFWR-WYVKHP\nYNR-WYVKHP\nMWRSWYCKHP")})),(0,t.Bu)("isCorrectLong",(async()=>{await A("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(0,b.Ns)(),await C("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(0,b.Ns)(),await C("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 C("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,c.fb.PT)})),(0,t.Bu)("isCorrectSeparatorLong",(async()=>{await C("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,c.fb.PT)}))}));var v=n(6414),T=n.n(v),S=n(9416),E=n(9713);async function _(t){const n=await async function(e){return await ve.files.readAsText(e)}(t),s=e.DataFrame.fromCsv(n);return s.name=t.replace(".csv",""),s}async function x(e,n=5e3){await(0,t.gw)(0),await(0,t.zg)(e.onAfterDrawContent,(()=>{}),(()=>{e.invalidate()}),n);const s=e.columns.length;for(let t=0;t<s;++t){const n=e.columns.byIndex(t);if(n){const t=e.cell(n.name,0),[s,o,a]=(0,E.N)(t),l=(void 0,(i=r=a.rendererBack)&&void 0!==i.onRendered&&void 0!==i.invalidate&&void 0!==i.awaitRendered?r:null);l&&await l.awaitRendered()}}var r,i}var P=n(3553),N=n(8260);async function $(e,n){const s=(0,c.kB)(e);console.debug(`Bio: tests: splitters: src=${JSON.stringify(e)}, res=${JSON.stringify(s)} .`),(0,t.f6)(T()(s.originals).toArray(),n)}async function M(e,n){const s=(0,N.gP)(e);console.debug(`Bio: tests: splitters: src=${JSON.stringify(e)}, res=${JSON.stringify(s)} .`),(0,t.f6)(T()(s.originals).toArray(),n)}(0,t.W3)("splitters",(async()=>{(0,t.bb)((async()=>{})),(0,t.X5)((async()=>{}));const n=["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"]],s=["[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"]],u=["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)"]],d=["RNA1{P.R(U).P.R(T)}$$$$",["P","R(U)","P","R(T)"]];(0,t.Bu)("fastaMulti",(async()=>{await $(n[0],n[1])})),(0,t.Bu)("fastaFromHelm",(async()=>{await $(s[0],s[1])})),(0,t.Bu)("helm1",(async()=>{await M(r[0],r[1])})),(0,t.Bu)("helm2",(async()=>{await M(i[0],i[1])})),(0,t.Bu)("helm3-multichar",(async()=>{await M(o[0],o[1])})),(0,t.Bu)("testHelm1",(async()=>{await M(u[0],u[1])})),(0,t.Bu)("testHelm2",(async()=>{await M(h[0],h[1])})),(0,t.Bu)("testHelm3",(async()=>{await M(d[0],d[1])})),(0,t.Bu)("splitToMonomers",(async()=>{const e=await a.dapi.files.readCsv("System:AppData/Bio/samples/MSA.csv"),n=e.getCol("MSA"),s=await a.functions.call("Bio:detectMacromolecule",{col:n});s&&(n.semType=s),n.setTag(c.DX.aligned,P.mU);const r=await(0,S.n)(e,n);(0,t.l_)(r.columns.names().includes("17"),!0),await a.data.detectSemanticTypes(r);const i=a.shell.addTableView(r);await x(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 n=["hHis","Aca","Cys_SEt","N","T"],s=t.getCol("HELM"),r=(0,l.getHelmMonomers)(s),i=n.filter((e=>!r.includes(e))),o=r.filter((e=>!n.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 L=n(7228),I=n(6584);(0,t.W3)("monomerLibraries",(()=>{let e,n=null;(0,t.bb)((async()=>{e=await(0,L.JN)(),n=(0,I.nW)()})),(0,t.X5)((async()=>{await(0,I.tW)(n)})),(0,t.Bu)("default",(async()=>{await(0,I.tW)({exclude:[],explicit:[]}),await e.loadLibraries(!0);const n=e.getBioLib();(0,t.l_)(n.getPolymerTypes().length>0,!0)})),(0,t.Bu)("forTests",(async()=>{await(0,I.tb)(),await e.loadLibraries(!0);const n=e.getBioLib();(0,t.l_)(n.getPolymerTypes().length,2),(0,t.l_)(n.getMonomerSymbolsByType("PEPTIDE").length,322),(0,t.l_)(n.getMonomerSymbolsByType("RNA").length,383)})),(0,t.Bu)("empty",(async()=>{const n=await(0,I.nW)(),s=await e.getFileManager();let r=s.getValidLibraryPaths();0===r.length&&(r=await s.getValidLibraryPathsAsynchronously()),n.exclude=r,n.explicit=[],await(0,I.tW)(n),await e.loadLibraries(!0);const i=e.getBioLib().getPolymerTypes();(0,t.l_)(0===i.length,!0)}))}));var R=n(3870),O=n(3336),D=n.n(O),F=n(701),k=n(706),G=n(4004);async function B(n,s){const r=n(),i=e.DataFrame.fromColumns(r);await a.data.detectSemanticTypes(i);const o=Date.now(),l=(i.columns.byName("MSA"),a.shell.addTableView(i));await x(l.grid),(0,t.l_)(l.grid.dataFrame.id,i.id);const c=Date.now()-o;console.log(`Performance test: ${s}: ${c}ms`)}(0,t.W3)("renderers",(()=>{(0,t.Bu)("long sequence performance ",(async()=>{await B(k.io,"Long sequences")})),(0,t.Bu)("many sequence performance",(async()=>{await B(k.Ug,"Many sequences")})),(0,t.Bu)("rendererMacromoleculeFasta",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA.csv"),s=e.DataFrame.fromCsv(n),r=s.getCol("Sequence"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});i&&(r.semType=i);const o=a.shell.addTableView(s);await a.data.detectSemanticTypes(s),await x(o.grid),(0,t.l_)(o.grid.dataFrame.id,s.id);const l=r.getTag(e.TAGS.CELL_RENDERER);(0,t.l_)(l,"sequence")}()})),(0,t.Bu)("rendererMacromoleculeSeparator",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/SEPARATOR_PT.csv"),s=e.DataFrame.fromCsv(n),r=s.getCol("sequence"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});i&&(r.semType=i);const o=a.shell.addTableView(s);await a.data.detectSemanticTypes(s),await x(o.grid),(0,t.l_)(o.grid.dataFrame.id,s.id);const l=r.getTag(e.TAGS.CELL_RENDERER);(0,t.l_)(l,"sequence")}()})),(0,t.Bu)("rendererMacromoleculeDifference",(async()=>{await async function(){const n=e.Column.fromStrings("SequencesDiff",["meI/hHis/Aca/N/T/dK/Thr_PO3H2/Aca#D-Tyr_Et/Tyr_ab-dehydroMe/meN/E/N/dV"]);n.setTag(e.TAGS.UNITS,c.r2.SEPARATOR),n.setTag(c.DX.separator,"/"),n.setTag(c.DX.aligned,"SEQ"),n.setTag(c.DX.alphabet,"UN"),n.setTag(c.DX.alphabetIsMultichar,"true"),n.semType=P.Of.MACROMOLECULE_DIFFERENCE;const s=e.DataFrame.fromColumns([n]),r=a.shell.addTableView(s);await a.data.detectSemanticTypes(s),await x(r.grid),(0,t.l_)(r.grid.dataFrame.id,s.id);const i=n.getTag(e.TAGS.CELL_RENDERER);(0,t.l_)(i,P.Of.MACROMOLECULE_DIFFERENCE)}()})),(0,t.Bu)("afterMsa",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA.fasta"),s=(0,l.importFasta)(n)[0],r=s.getCol("sequence"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});i&&(r.semType=i);const o=a.shell.addTableView(s);await a.data.detectSemanticTypes(s),console.log("Bio: tests/renderers/afterMsa, table view"),await x(o.grid),(0,t.l_)(o.grid.dataFrame.id,s.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(c.DX.aligned),"SEQ"),(0,t.l_)(r.getTag(c.DX.alphabet),c.fb.PT),(0,t.l_)(r.getTag(e.TAGS.CELL_RENDERER),"sequence");const h=await(0,w.K)({col:r});await x(o.grid),(0,t.l_)(o.grid.dataFrame.id,s.id),(0,t.l_)(h.semType,e.SEMTYPE.MACROMOLECULE),(0,t.l_)(h.getTag(e.TAGS.UNITS),c.r2.FASTA),(0,t.l_)(h.getTag(c.DX.aligned),"SEQ.MSA"),(0,t.l_)(h.getTag(c.DX.alphabet),c.fb.PT),(0,t.l_)(h.getTag(e.TAGS.CELL_RENDERER),"sequence"),u.g.forColumn(h)}()})),(0,t.Bu)("afterConvert",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA_PT.csv"),s=e.DataFrame.fromCsv(n),r=s.getCol("sequence"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});i&&(r.semType=i);const o=a.shell.addTableView(s);await a.data.detectSemanticTypes(s);const l=await(0,G.o)(r,c.r2.SEPARATOR,"/");await x(o.grid),(0,t.l_)(o.grid.dataFrame.id,s.id);const h=l.getTag(e.TAGS.CELL_RENDERER);(0,t.l_)(h,"sequence"),u.g.forColumn(l)}()})),(0,t.Bu)("afterConvertToHelm",(async()=>{await async function(){const n=await a.dapi.files.readCsv("System:AppData/Bio/samples/FASTA_PT.csv"),s=a.shell.addTableView(n);await x(s.grid);const r=n.getCol("sequence"),i=u.g.forColumn(r).convert(c.r2.HELM);n.columns.add(i),await x(s.grid),(0,t.l_)(i.getTag(e.TAGS.CELL_RENDERER),"helm")}()})),(0,t.Bu)("selectRendererBySemType",(async()=>{await async function(){const n=e.Column.fromStrings("SequencesDiff",["meI/hHis/Aca/N/T/dK/Thr_PO3H2/Aca#D-Tyr_Et/Tyr_ab-dehydroMe/meN/E/N/dV"]);n.setTag(e.TAGS.UNITS,c.r2.SEPARATOR),n.setTag(c.DX.separator,"/"),n.setTag(c.DX.aligned,"SEQ"),n.setTag(c.DX.alphabet,"UN"),n.setTag(c.DX.alphabetIsMultichar,"true"),n.semType=P.Of.MACROMOLECULE_DIFFERENCE;const s=e.DataFrame.fromColumns([n]);a.shell.addTableView(s),await(0,t.gw)(100);const r=n.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'.`)}()})),(0,t.Bu)("scatterPlotTooltip",(async()=>{await async function(){const s=e.DataFrame.fromCsv(n);s.currentRowIdx=0;const r=a.shell.addTableView(s),i=s.plot.scatter({x:"x",y:"y"});r.dockManager.dock(i,e.DOCK_TYPE.RIGHT,null),await Promise.all([(0,t.zg)(i.onAfterDrawScene,(()=>{}),(()=>{i.invalidateCanvas()}),1e3),x(r.grid,500)]);const o=i.root.getBoundingClientRect(),l=i.worldToScreen(1,0),c=new MouseEvent("mousemove",{cancelable:!0,bubbles:!0,view:window,button:0,clientX:o.left+l.x,clientY:o.top+l.y}),u=D()(i.root).find("canvas").get()[0];await(0,t.zg)((0,F.fromEvent)(u,"mousemove"),(()=>{ve.logger.debug(`Test: event, currentRowIdx=${s.currentRowIdx}`),(0,t.l_)(D()(R.tooltip.root).find("div table.d4-row-tooltip-table tr td canvas").length,1),(0,t.l_)(i.hitTest(l.x,l.y),1)}),(()=>{u.dispatchEvent(c)}),500),await x(r.grid,500)}()}));const n="seq,x,y\nACGGTGTCGT,0,0\nCGGTATCCCT,1,0\nCTCGGCATGC,2,0\n"}));var H=n(9611);(0,t.W3)("renderers: monomerPlacer",(()=>{let n,s;(0,t.bb)((async()=>{n=await(0,L.JN)(),s=await(0,I.nW)(),await(0,I.tb)(),await n.awaitLoaded(),await n.loadLibraries(!0)})),(0,t.X5)((async()=>{await(0,I.tW)(s),await n.loadLibraries(!0)}));const r={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:5}},{src:{row:1,x:200},tgt:{pos:5}},{src:{row:2,x:20},tgt:{pos:null}},{src:{row:3,x:170},tgt:{pos:5}},{src:{row:3,x:200},tgt:{pos:5}},{src:{row:3,x:297},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,s]of Object.entries(r))(0,t.Bu)(`getPosition-${n}`,(async()=>{(await(0,L.JN)()).getBioLib();const t=e.DataFrame.fromCsv(s.csv);await a.data.detectSemanticTypes(t);const n=t.getCol("seq"),r=new H.A(null,n,ve.logger,(()=>({seqHandler:u.g.forColumn(n),monomerCharWidth:7,separatorWidth:12,monomerToShort:c.GU,monomerLengthLimit:3}))),i=s.testList;for(let e=0;e<n.length;++e)r.getCellMonomerLengths(e,1e4);const o=[];for(const[e,t]of T().enumerate(i)){const t={pos:r.getPosition(e.src.row,e.src.x,1e4)};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)("renderers: monomerPlacer",(()=>{const e=[10,20,30,40,50,60],n={left:{x:3,tgt:null},c0left:{x:10,tgt:0},c0mid:{x:12,tgt:0},c0right:{x:19,tgt:0},c1left:{x:20,tgt:1},c2right:{x:39,tgt:2},c4left:{x:50,tgt:4},c4right:{x:59,tgt:4},max:{x:60,tgt:null},right:{x:65,tgt:null}};for(const[s,r]of Object.entries(n))(0,t.Bu)("hitBounds-"+s,(async()=>{const n=(0,H.m)(e,r.x);(0,t.l_)(n,r.tgt)}))})),(0,t.W3)("converters",(()=>{let n;!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"}(n||(n={}));const s={[n.fastaPt]:"seq\nFWPHEYFWPHEY\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",[n.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",[n.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}$$$$",[n.fastaDna]:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",[n.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",[n.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}$$$$",[n.fastaRna]:"seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC",[n.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",[n.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}$$$$",[n.fastaGaps]:"seq\nFW-PH-EYYFW-PH-EYY\nFYNRQWYV-FYNRQWYV-\nFKP-Q-SEYVFKP-Q-SEYV",[n.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",[n.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}$$$$",[n.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]",[n.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",[n.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}$$$$",[n.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}$$$$",[n.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}$$$$",[n.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}$$$$"},r=new Set(Object.values(c.DX));async function i(t){const n=s[t],r=e.DataFrame.fromCsv(n);return await a.data.detectSemanticTypes(r),r}function o(n,s){if(n===c.r2.SEPARATOR&&!s)throw new Error(`Argument 'separator' is mandatory for target notation '${n.toString()}'.`);return function(r){const i=u.g.forColumn(r).convert(n,s);return(0,t.l_)(i.getTag(e.TAGS.UNITS),n),i}}async function l(e,n,s){const o=(await i(e)).getCol("seq"),a=n(o),l=(await i(s)).getCol("seq");(0,t.f6)(a.toList(),l.toList());const h=u.g.forColumn(o),d=u.g.forColumn(a);for(const[e,n]of Object.entries(l.tags)){if(!r.has(e)||h.notation===c.r2.HELM&&[c.DX.alphabet,c.DX.alphabetIsMultichar].includes(e)||d.notation===c.r2.HELM&&[c.DX.alphabet,c.DX.alphabetIsMultichar].includes(e))continue;const s=a.getTag(e);(0,t.l_)(s,n,`Tag '${e}' expected value '${n}' is not equal to actual '${s}'.`)}}(0,t.Bu)("testFastaPtToSeparator",(async()=>{await l(n.fastaPt,o(c.r2.SEPARATOR,"-"),n.separatorPt)})),(0,t.Bu)("testFastaDnaToSeparator",(async()=>{await l(n.fastaDna,o(c.r2.SEPARATOR,"/"),n.separatorDna)})),(0,t.Bu)("testFastaRnaToSeparator",(async()=>{await l(n.fastaRna,o(c.r2.SEPARATOR,"*"),n.separatorRna)})),(0,t.Bu)("testFastaGapsToSeparator",(async()=>{await l(n.fastaGaps,o(c.r2.SEPARATOR,"/"),n.separatorGaps)})),(0,t.Bu)("testFastaUnToSeparator",(async()=>{await l(n.fastaUn,o(c.r2.SEPARATOR,"-"),n.separatorUn)})),(0,t.Bu)("testFastaPtToHelm",(async()=>{await l(n.fastaPt,o(c.r2.HELM),n.helmPt)})),(0,t.Bu)("testFastaDnaToHelm",(async()=>{await l(n.fastaDna,o(c.r2.HELM),n.helmDna)})),(0,t.Bu)("testFastaRnaToHelm",(async()=>{await l(n.fastaRna,o(c.r2.HELM),n.helmRna)})),(0,t.Bu)("testFastaGapsToHelm",(async()=>{await l(n.fastaGaps,o(c.r2.HELM),n.helmGaps)})),(0,t.Bu)("testSeparatorPtToFasta",(async()=>{await l(n.separatorPt,o(c.r2.FASTA),n.fastaPt)})),(0,t.Bu)("testSeparatorDnaToFasta",(async()=>{await l(n.separatorDna,o(c.r2.FASTA),n.fastaDna)})),(0,t.Bu)("testSeparatorRnaToFasta",(async()=>{await l(n.separatorRna,o(c.r2.FASTA),n.fastaRna)})),(0,t.Bu)("testSeparatorGapsToFasta",(async()=>{await l(n.separatorGaps,o(c.r2.FASTA),n.fastaGaps)})),(0,t.Bu)("testSeparatorUnToFasta",(async()=>{await l(n.separatorUn,o(c.r2.FASTA),n.fastaUn)})),(0,t.Bu)("testSeparatorPtToHelm",(async()=>{await l(n.separatorPt,o(c.r2.HELM),n.helmPt)})),(0,t.Bu)("testSeparatorDnaToHelm",(async()=>{await l(n.separatorDna,o(c.r2.HELM),n.helmDna)})),(0,t.Bu)("testSeparatorRnaToHelm",(async()=>{await l(n.separatorRna,o(c.r2.HELM),n.helmRna)})),(0,t.Bu)("testSeparatorGapsToHelm",(async()=>{await l(n.separatorGaps,o(c.r2.HELM),n.helmGaps)})),(0,t.Bu)("testHelmDnaToFasta",(async()=>{await l(n.helmDna,o(c.r2.FASTA),n.fastaDna)})),(0,t.Bu)("testHelmRnaToFasta",(async()=>{await l(n.helmRna,o(c.r2.FASTA),n.fastaRna)})),(0,t.Bu)("testHelmPtToFasta",(async()=>{await l(n.helmPt,o(c.r2.FASTA),n.fastaPt)})),(0,t.Bu)("testHelmUnToFasta",(async()=>{await l(n.helmUn,o(c.r2.FASTA),n.fastaUn)})),(0,t.Bu)("testHelmDnaToSeparator",(async()=>{await l(n.helmDna,o(c.r2.SEPARATOR,"/"),n.separatorDna)})),(0,t.Bu)("testHelmRnaToSeparator",(async()=>{await l(n.helmRna,o(c.r2.SEPARATOR,"*"),n.separatorRna)})),(0,t.Bu)("testHelmPtToSeparator",(async()=>{await l(n.helmPt,o(c.r2.SEPARATOR,"-"),n.separatorPt)})),(0,t.Bu)("testHelmUnToSeparator",(async()=>{await l(n.helmUn,o(c.r2.SEPARATOR,"-"),n.separatorUn)})),(0,t.Bu)("testHelmLoneRibose",(async()=>{await l(n.helmLoneRibose,o(c.r2.FASTA),n.fastaRna)})),(0,t.Bu)("testHelmLoneDeoxyribose",(async()=>{await l(n.helmLoneDeoxyribose,o(c.r2.SEPARATOR,"/"),n.separatorDna)})),(0,t.Bu)("testHelmLonePhosphorus",(async()=>{await l(n.helmLonePhosphorus,o(c.r2.FASTA),n.fastaRna)}))}));var W=n(5226);(0,t.W3)("fastaFileHandler",(()=>{const n=["description:1","description:2","description:3","description:4"],s=(e.Column.fromStrings("description",n),["MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW","MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL","MMELVLKTIIGPIVVGVVLRIVDKWLNKDK","MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN"]);function r(e){const r=new W.i(e),i=r.descriptionsArray,o=r.sequencesArray;(0,t.f6)([i,o],[n,s])}(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 V=n(9943);(0,t.W3)("fastaExport",(()=>{let n;!function(e){e.single="single",e.multi="multi"}(n||(n={}));const s={[n.single]:{src:"MDYKETLLMPKTDFPMRGGLP",tgt:["MDYKETLLMP","KTDFPMRGGL","P"]},[n.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(n,r=10){const i=s[n].src,o=e.Column.fromStrings("src",[i]);o.semType=e.SEMTYPE.MACROMOLECULE,o.setTag(e.TAGS.UNITS,c.r2.FASTA);const a=u.g.forColumn(o).getSplitted(0),l=(0,V.sK)(a,r),h=s[n].tgt;(0,t.f6)(l,h)}async function a(n){const s=e.DataFrame.fromCsv(n.srcCsv),r=s.getCol(n.seqCol);r.semType=e.SEMTYPE.MACROMOLECULE,r.setTag(e.TAGS.UNITS,c.r2.FASTA);const i=n.idCols.map((e=>s.getCol(e))),o=(0,V.i$)(i,r,n.lineWidth);(0,t.l_)(o,n.tgtFasta)}(0,t.Bu)("wrapSequenceSingle",(async()=>{o(n.single,10)})),(0,t.Bu)("wrapSequenceMulti",(async()=>{o(n.multi,10)})),(0,t.Bu)("saveAsFastaTest1",(async()=>{a(i[r.test1])})),(0,t.Bu)("saveAsFastaTest2",(async()=>{a(i[r.test2])}))}));var U=n(7331),Y=n(6286);const j=Y.G2;(0,t.W3)("bio",(()=>{const n="seq\nACGTCT\nCAGTGT\nTTCAAC";(0,t.Bu)("testGetStatsHelm1",(async()=>{const n=e.DataFrame.fromCsv("seq\nPEPTIDE1{meI}$$$$").getCol("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.setTag(e.TAGS.UNITS,c.r2.HELM);const s=(0,N.jY)(n,1,c.gP);(0,t.Wh)(s.freq,{meI:1}),(0,t.l_)(s.sameLength,!0)})),(0,t.Bu)("testGetStatsN1",(async()=>{await async function(n){const s=e.DataFrame.fromCsv(n).col("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.setTag(e.TAGS.UNITS,c.r2.FASTA);const r=(0,N.jY)(s,5,c.kB);(0,t.Wh)(r.freq,{A:4,C:5,G:3,T:6}),(0,t.l_)(r.sameLength,!0)}(n)})),(0,t.Bu)("testGetAlphabetSimilarity",(async()=>{await async function(){const e={A:2041,C:3015,G:3015,T:2048,[j]:1e3},n=new Set(Object.keys(o.V.Names)),s=(0,c.KX)(e,n);(0,t.l_)(s>.6,!0)}()})),(0,t.Bu)("testPickupPaletteN1",(async()=>{await async function(n){const s=e.DataFrame.fromCsv(n).col("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.setTag(e.TAGS.UNITS,c.r2.FASTA);const r=(0,c.dQ)(s);(0,t.l_)(r instanceof o.J,!0)}(n)})),(0,t.Bu)("testPickupPaletteN1e",(async()=>{await async function(n){const s=e.DataFrame.fromCsv("seq\nACGTAT\nCAGTTG\nTTCG2C").col("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.setTag(e.TAGS.UNITS,c.r2.FASTA);const r=(0,c.dQ)(s);(0,t.l_)(r instanceof o.J,!0)}()})),(0,t.Bu)("testPickupPaletteAA1",(async()=>{await async function(n){const s=e.DataFrame.fromCsv("seq\nFWPHEYV\nYNRQWYV\nMKPSEYV").col("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.setTag(e.TAGS.UNITS,c.r2.FASTA);const i=(0,c.dQ)(s);(0,t.l_)(i instanceof r.f,!0)}()})),(0,t.Bu)("testPickupPaletteX",(async()=>{await async function(n){const s=e.DataFrame.fromCsv("seq\nXZJ{}2\n5Z4733\n3Z6></\n675687").col("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.setTag(e.TAGS.UNITS,c.r2.FASTA);const r=(0,c.dQ)(s);(0,t.l_)(r instanceof U.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…"]],n=e.map((e=>e[0])),s=e.map((e=>e[1])),r=n.map((e=>(0,c.GU)(e,3)));(0,t.f6)(r,s)}))}));var K=n(8415);const q=Y.G2;function X(e,n){(0,t.l_)(e.name,n.name),(0,t.f6)(e.getMonomers(),n.getMonomers());for(const s of e.getMonomers())(0,t.l_)(e.getFreq(s).rowCount,n.getFreq(s).rowCount)}(0,t.W3)("WebLogo-positions",(()=>{const n="seq\nATC-G-TTGC--\nATC-G-TTGC--\n-TC-G-TTGC--\n-TC-GCTTGC--\n-TC-GCTTGC--";(0,t.Bu)("allPositions",(async()=>{const s=e.DataFrame.fromCsv(n),r=a.shell.addTableView(s),i=s.getCol("seq");i.semType=e.SEMTYPE.MACROMOLECULE,i.setTag(e.TAGS.UNITS,c.r2.FASTA),i.setTag(c.DX.alphabet,c.fb.DNA),i.setTag(c.DX.aligned,"SEQ.MSA");const o=await s.plot.fromType("WebLogo");await(0,t.zg)(o.onLayoutCalculated,(()=>{}),(()=>{r.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const l=o.positions,u=[new K.CK(0,"1",{A:new K.yW(2),[q]:new K.yW(3)}),new K.CK(1,"2",{T:new K.yW(5)}),new K.CK(2,"3",{C:new K.yW(5)}),new K.CK(3,"4",{[q]:new K.yW(5)}),new K.CK(4,"5",{G:new K.yW(5)}),new K.CK(5,"6",{[q]:new K.yW(3),C:new K.yW(2)}),new K.CK(6,"7",{T:new K.yW(5)}),new K.CK(7,"8",{T:new K.yW(5)}),new K.CK(8,"9",{G:new K.yW(5)}),new K.CK(9,"10",{C:new K.yW(5)}),new K.CK(10,"11",{[q]:new K.yW(5)}),new K.CK(11,"12",{[q]:new K.yW(5)})];(0,t.l_)(l.length,u.length);for(let e=0;e<l.length;e++){(0,t.l_)(l[e].name,u[e].name);for(const n of l[e].getMonomers())(0,t.l_)(l[e].getFreq(n).rowCount,u[e].getFreq(n).rowCount)}await o.awaitRendered()})),(0,t.Bu)("positions with shrinkEmptyTail option true (filtered)",(async()=>{const n=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-"),s=a.shell.addTableView(n),r=n.getCol("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.setTag(e.TAGS.UNITS,c.r2.FASTA),r.setTag(c.DX.alphabet,c.fb.DNA),r.setTag(c.DX.aligned,"SEQ"),n.filter.init((e=>e>2)),n.filter.fireChanged();const i=await n.plot.fromType("WebLogo",{shrinkEmptyTail:!0});await(0,t.zg)(i.onLayoutCalculated,(()=>{}),(()=>{s.dockManager.dock(i.root,e.DOCK_TYPE.DOWN)}),500);const o=i.positions,l=[new K.CK(0,"1",{[q]:new K.yW(3)}),new K.CK(1,"2",{T:new K.yW(3)}),new K.CK(2,"3",{[q]:new K.yW(3)}),new K.CK(3,"4",{[q]:new K.yW(3)}),new K.CK(4,"5",{C:new K.yW(3)}),new K.CK(5,"6",{[q]:new K.yW(2),C:new K.yW(1)}),new K.CK(6,"7",{G:new K.yW(3)}),new K.CK(7,"8",{T:new K.yW(3)}),new K.CK(8,"9",{[q]:new K.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 n of o[e].getMonomers())(0,t.l_)(o[e].getFreq(n).rowCount,l[e].getFreq(n).rowCount)}await i.awaitRendered()})),(0,t.Bu)("positions with skipEmptyPositions option",(async()=>{const s=e.DataFrame.fromCsv(n),r=a.shell.addTableView(s),i=s.getCol("seq");i.semType=e.SEMTYPE.MACROMOLECULE,i.setTag(e.TAGS.UNITS,c.r2.FASTA),i.setTag(c.DX.alphabet,c.fb.DNA),i.setTag(c.DX.aligned,"SEQ.MSA");const o=await s.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,u=[new K.CK(0,"1",{A:new K.yW(2),[q]:new K.yW(3)}),new K.CK(1,"2",{T:new K.yW(5)}),new K.CK(2,"3",{C:new K.yW(5)}),new K.CK(4,"5",{G:new K.yW(5)}),new K.CK(5,"6",{[q]:new K.yW(3),C:new K.yW(2)}),new K.CK(6,"7",{T:new K.yW(5)}),new K.CK(7,"8",{T:new K.yW(5)}),new K.CK(8,"9",{G:new K.yW(5)}),new K.CK(9,"10",{C:new K.yW(5)})];(0,t.l_)(l.length,u.length);for(let e=0;e<l.length;e++)X(l[e],u[e]);await o.awaitRendered()})),(0,t.Bu)("count sequences for monomer at position",(async()=>{const s=function(t,n,s,r){const i=e.DataFrame.fromCsv(t),o=i.getCol("seq");return o.semType=e.SEMTYPE.MACROMOLECULE,o.setTag(e.TAGS.UNITS,n),o.setTag(c.DX.alphabet,s),o.setTag(c.DX.aligned,"SEQ.MSA"),i}(n,c.r2.FASTA,c.fb.DNA),r=s.getCol("seq"),i=a.shell.addTableView(s),o=await s.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,h=[new K.CK(2,"3",{C:new K.yW(5)}),new K.CK(4,"5",{G:new K.yW(5)}),new K.CK(5,"6",{[q]:new K.yW(3),C:new K.yW(2)}),new K.CK(6,"7",{T:new K.yW(5)})];(0,t.l_)(l.length,h.length);for(let e=0;e<l.length;e++)X(l[e],h[e]);const d=l[1],m=u.g.forColumn(r),p=(0,K.eZ)(s,m,s.filter,"G",d);(0,t.l_)(p,5),await o.awaitRendered()})),(0,t.Bu)("empty",(async()=>{const n=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(c.DX.alphabet,c.fb.DNA),t})()]),s=a.shell.addTableView(n),r=await n.plot.fromType("WebLogo");await(0,t.zg)(r.onLayoutCalculated,(()=>{}),(()=>{s.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 n="Tests.Bio.WebLogo-project.fasta",s=await ve.files.readCsv("tests/filter_FASTA.csv"),r=s.name,i=s.getCol("fasta");await a.data.detectSemanticTypes(s);const o=a.shell.addTableView(s),l=await s.plot.fromType("WebLogo",{sequenceColumnName:i.name});o.dockManager.dock(l),await l.awaitRendered(),await x(o.grid),await async function(t,n,s,r){const i=e.Project.create(),o=s.saveLayout();await a.dapi.layouts.save(s.saveLayout()),await a.dapi.tables.uploadDataFrame(r),await a.dapi.tables.save(n),i.name=t,i.addChild(n),i.addChild(o),await a.dapi.projects.save(i)}(n,s.getTableInfo(),o,s),a.shell.closeAll(),await(0,t.gw)(500),await a.dapi.projects.open(n);const c=a.shell.getTableView(r),u=T()(c.viewers).toArray();(0,t.l_)(u.length,2),(0,t.l_)(u.filter((e=>"Grid"===e.type)).length,1);const h=u.find((e=>"WebLogo"===e.type));(0,t.l_)(!!h,!0),await x(o.grid),await h.awaitRendered()}),{skipReason:"depends on 1.18"})})),(0,t.W3)("WebLogo-layout",(()=>{(0,t.Bu)("fasta",(async()=>{const e=await ve.files.readCsv("tests/filter_FASTA.csv"),n=e.getCol("fasta");await a.data.detectSemanticTypes(e);const s=a.shell.addTableView(e),r=await e.plot.fromType("WebLogo",{sequenceColumnName:n.name});s.dockManager.dock(r),await(0,t.gw)(2*K.Fs.render),await r.awaitRendered(),await x(s.grid);const i=s.saveLayout();i.toJson(),s.loadLayout(i),await(0,t.gw)(2*K.Fs.render),await r.awaitRendered(),await x(s.grid);const o=T()(s.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 Z=n(2568);function z(e,t){let n=null;for(const s of e.viewers)s.type===t&&(n=s);return n}(0,t.W3)("checkInputColumn",(()=>{const n="seq\nseq1,\nseq2,\nseq3,\nseq4";(0,t.Bu)("testMsaPos",(async()=>{const s=e.DataFrame.fromCsv(n).getCol("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.setTag(e.TAGS.UNITS,c.r2.FASTA),s.setTag(c.DX.alphabet,c.fb.DNA),s.setTag(c.DX.aligned,"SEQ");const[r,i]=(0,Z.l)(s,"Test",[c.r2.FASTA],[c.fb.DNA,c.fb.RNA,c.fb.PT]);(0,t.l_)(r,!0)})),(0,t.Bu)("testMsaNegHelm",(async()=>{const s=e.DataFrame.fromCsv(n).getCol("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.setTag(e.TAGS.UNITS,c.r2.HELM),s.setTag(c.DX.alphabetIsMultichar,"true");const[r,i]=(0,Z.l)(s,"Test",[c.r2.FASTA],[c.fb.DNA,c.fb.RNA,c.fb.PT]);(0,t.l_)(r,!1)})),(0,t.Bu)("testMsaNegUN",(async()=>{const s=e.DataFrame.fromCsv(n).getCol("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.setTag(e.TAGS.UNITS,c.r2.FASTA),s.setTag(c.DX.alphabet,"UN"),s.setTag(c.DX.alphabetSize,"11"),s.setTag(c.DX.alphabetIsMultichar,"true"),s.setTag(c.DX.aligned,"SEQ");const[r,i]=(0,Z.l)(s,"Test",[c.r2.FASTA],[c.fb.DNA,c.fb.RNA,c.fb.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 n=await ve.files.readAsText("tests/sample_MSA_data.csv"),s=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(s);const r=a.shell.addTableView(s),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!==z(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 n=await ve.files.readAsText("tests/sample_MSA_data.csv"),s=e.DataFrame.fromCsv(n),r=a.shell.addTableView(s);await a.data.detectSemanticTypes(s);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!==z(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 J=n(5393),Q=n(8755);async function ee(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 n=new J.ST;return n.attach(t),n.applyState({columnName:e}),n.column=t.col(e),n.columnName=e,n}(0,t.W3)("bio-substructure-filters",(async()=>{let n,s;(0,t.bb)((async()=>{n=await(0,L.JN)(),s=await(0,I.nW)(),await(0,I.tb)(),await n.loadLibraries(!0)})),(0,t.X5)((async()=>{await(0,I.tW)(s),await n.loadLibraries(!0)})),(0,t.Bu)("fasta",(async()=>{const e=await _("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(e);const n=new J.ST;n.attach(e),await n.awaitRendered();try{(0,t.l_)(!!n.bioFilter,!0),(0,t.l_)(n.bioFilter.type,"FastaBioFilter");const s=n.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{s.props=new Q.x("MD")}),5e3,"testEvent onRowsFiltered"),(0,t.l_)(n.dataFrame.filter.trueCount,3),(0,t.l_)(n.dataFrame?.filter.toBinaryString(),"10010000100000")}finally{n.detach()}await n.awaitRendered()})),(0,t.Bu)("separator",(async()=>{const e=await _("tests/filter_MSA.csv"),n=new J.ST;await a.data.detectSemanticTypes(e),n.attach(e),await n.awaitRendered();try{(0,t.l_)(!!n.bioFilter,!0),(0,t.l_)(n.bioFilter.type,"SeparatorBioFilter");const s=n.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{s.props=new J.LH("meI")}),5e3,"testEvent onRowsFiltered"),(0,t.l_)(n.dataFrame.filter.trueCount,7),(0,t.l_)(n.dataFrame.filter.get(2),!1),await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{s.props=new J.LH("/meI")}),5e3,"testEvent onRowsFiltered"),(0,t.l_)(n.dataFrame.filter.trueCount,0),await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{s.props=new J.LH("meI-hHis","-")}),5e3,"testEvent onRowsFiltered"),(0,t.l_)(n.dataFrame.filter.trueCount,7),(0,t.l_)(n.dataFrame.filter.get(2),!1)}finally{n.detach()}await n.awaitRendered()})),(0,t.Bu)("helm-dialog",(async()=>{const e="Bio tests: substructureFilters/helm-dialog",n=await _("tests/filter_HELM.csv");await a.data.detectSemanticTypes(n);const s=a.shell.addTableView(n);ve.logger.debug(`${e}, filter attaching.`);const r=new J.ST;r.attach(n);const i=R.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"),ve.logger.debug(`${e}, filter 1 change awaiting...`),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{i.props=new Q.x("PEPTIDE1{A.C}$$$$V2.0")}),2e4),ve.logger.debug(`${e}, filter 1 changed.`),(0,t.l_)(r.dataFrame.filter.trueCount,1),(0,t.l_)(r.dataFrame.filter.toBinaryString(),"0001"),ve.logger.debug(`${e}, filter 2 change awaiting...`),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{i.props=new Q.x("PEPTIDE1{C}$$$$V2.0")}),2e4),await x(s.grid),ve.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(),await(0,t.gw)(3e3)})),(0,t.Bu)("helm-view",(async()=>{const e=await _("tests/filter_HELM.csv");e.getCol("HELM string"),await a.data.detectSemanticTypes(e);const t=a.shell.addTableView(e);t.getFiltersGroup(),await x(t.grid)})),(0,t.Bu)("sync-fasta",(async()=>{const e=await ve.files.readCsv("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(e);const n=await ee("fasta",e),s=await ee("fasta",e);await Promise.all([n.awaitRendered(),s.awaitRendered()]);try{(0,t.l_)(!!n.bioFilter,!0),(0,t.l_)(!!s.bioFilter,!0),(0,t.l_)(n.bioFilter.type,"FastaBioFilter"),(0,t.l_)(s.bioFilter.type,"FastaBioFilter");const r=n.bioFilter,i=s.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new Q.x("MD")}),1e4,"await onRowsFiltered"),(0,t.l_)(e.filter.trueCount,3),await n.awaitRendered(),(0,t.l_)(i.props.substructure,"MD")}finally{n.detach(),s.detach()}await Promise.all([n.awaitRendered(),s.awaitRendered()])})),(0,t.Bu)("sync-msa",(async()=>{const e=await ve.files.readCsv("tests/filter_MSA.csv");await a.data.detectSemanticTypes(e);const n="hHis-Aca",s=await ee("MSA",e),r=await ee("MSA",e);await Promise.all([s.awaitRendered(),r.awaitRendered()]);try{(0,t.l_)(!!s.bioFilter,!0),(0,t.l_)(!!r.bioFilter,!0),(0,t.l_)(s.bioFilter.type,"SeparatorBioFilter"),(0,t.l_)(r.bioFilter.type,"SeparatorBioFilter");const i=s.bioFilter,o=r.bioFilter;await(0,t.zg)(e.onRowsFiltered,(()=>{}),(()=>{i.props=new J.LH(n,"-")}),1e4,"await onRowsFiltered"),(0,t.l_)(e.filter.trueCount,8),(0,t.l_)(o.props.substructure,n),(0,t.l_)(o.props.separator,"-")}finally{s.detach(),r.detach()}await Promise.all([s.awaitRendered(),r.awaitRendered()])})),(0,t.Bu)("sync-helm",(async()=>{const e=await ve.files.readCsv("tests/filter_HELM.csv");await a.data.detectSemanticTypes(e);const n=a.shell.addTableView(e),s="PEPTIDE1{A.C}$$$$V2.0",r=await ee("HELM string",e),i=await ee("HELM string",e),o=R.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 Q.x(s)}),6e4,"await onRowsFiltered"),await x(n.grid),ve.logger.debug("Bio tests: substructureFilters/sync-helm, before changed event"),await(0,t.gw)(2*r.debounceTime),ve.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,s)}finally{r.detach(),i.detach(),o.close()}await Promise.all([r.awaitRendered(),i.awaitRendered()]),await x(n.grid),await(0,t.gw)(3e3)})),(0,t.Bu)("two-columns-fasta",(async()=>{const n=e.DataFrame.fromCsv("id,seq1,seq2,trueSeq1,trueSeq2\n0,CGGCTACGGC,ATTGCATTCG,0,1,\n1,CGGCTGCCGC,ATAGCATTCG,1,1,\n2,CGGCTGCGCC,AATGCATACG,1,0,\n3,CGGCTGCATT,TTTGCATTCG,1,1,\n4,CGGCTGCATT,AAAGCATACG,1,0,\n");await a.data.detectSemanticTypes(n);const s=a.shell.addTableView(n),r="seq1",i="CGGCTG",o=n.getCol("trueSeq1").toList(),l="seq2",c="GCATT",u=n.getCol("trueSeq2").toList(),h=[{type:"Bio:bioSubstructureFilter",columnName:r},{type:"Bio:bioSubstructureFilter",columnName:l}],d=await n.plot.fromType(e.VIEWER.FILTERS,{filters:h});s.dockManager.dock(d,e.DOCK_TYPE.LEFT),await(0,t.gw)(100),await x(s.grid);const m=d.filters[0],p=d.filters[1];(0,t.l_)(m.column.name,r),(0,t.l_)(p.column.name,l);const f=m.bioFilter,g=p.bioFilter;await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new Q.x(i)}),1e3),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new Q.x("")}),1e3,"testEvent onRowsFiltered on seq1"),(0,t.l_)(n.filter.trueCount,o.filter((e=>1===e)).length),(0,t.l_)(n.filter.toBinaryString(),o.map((e=>e.toString())).join("")),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new Q.x("")}),1e3),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new Q.x(c)}),1e3,"testEvent onRowsFiltered on seq2"),(0,t.l_)(n.filter.trueCount,u.filter((e=>1===e)).length),(0,t.l_)(n.filter.toBinaryString(),u.map((e=>e.toString())).join("")),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new Q.x("")}),1e3),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new Q.x("")}),1e3,"testEvent onRowsFiltered on neither"),(0,t.l_)(n.filter.trueCount,n.rowCount),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new Q.x(i)}),5e3),await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new Q.x(c)}),5e3,"testEvent onRowsFiltered on both");const y=T().count(0).take(n.rowCount).map((e=>o[e]*u[e])).toArray();(0,t.l_)(n.filter.trueCount,y.filter((e=>1===e)).length),(0,t.l_)(n.filter.toBinaryString(),y.map((e=>e.toString())).join("")),await Promise.all([m.awaitRendered(),p.awaitRendered(),x(s.grid)])})),(0,t.Bu)("reset-fasta",(async()=>{const n=await _("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(n);const s=a.shell.addTableView(n),r="MD",i=await n.plot.fromType(e.VIEWER.FILTERS,{filters:[{type:"Bio:bioSubstructureFilter",columnName:"fasta"}]});s.dockManager.dock(i,e.DOCK_TYPE.LEFT),await(0,t.gw)(100),await x(s.grid);const o=i.filters[0].bioFilter;await(0,t.zg)(n.onRowsFiltered,(()=>{}),(()=>{o.props=new Q.x(r)}),1e3,"testEvent onRowsFiltered"),(0,t.l_)(n.filter.trueCount,3),(0,t.l_)(o.props.substructure,r),(0,t.l_)(o.substructureInput.value,r),D()(i.root).find('i[name="icon-arrow-rotate-left"]')[0].click(),await(0,t.gw)(100),await x(s.grid),(0,t.l_)(o.props.substructure,""),(0,t.l_)(o.substructureInput.value,"")})),(0,t.Bu)("reopen",(async()=>{const n=await ve.files.readCsv("tests/filter_FASTA.csv"),s=a.shell.addTableView(n),r=[{type:"Bio:bioSubstructureFilter",columnName:"fasta"}],i=await n.plot.fromType(e.VIEWER.FILTERS,{filters:r});s.dockManager.dock(i,e.DOCK_TYPE.LEFT),await(0,t.gw)(100),await x(s.grid),i.close(),await x(s.grid);const o=await n.plot.fromType(e.VIEWER.FILTERS,{filters:r});s.dockManager.dock(o,e.DOCK_TYPE.LEFT),await(0,t.gw)(100),await x(s.grid)}))}));var te=n(8341);class ne{constructor(){this.errorList=[],this.warningList=[],this.infoList=[],this.debugList=[]}error(e,t,n){this.errorList.push({message:e,params:t,stackTrace:n})}warning(e,t){this.warningList.push({message:e,params:t})}info(e,t){this.infoList.push({message:e,params:t})}debug(e,t){this.debugList.push({message:e,params:t})}}var se=n(7945);(0,t.W3)("PepSeA",(()=>{(0,t.bb)((async()=>{await(0,b.Ns)()})),(0,t.Bu)("Basic alignment",(async()=>{const n=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'),s=await(0,te.f3)(n.getCol("HELM"),"msa(HELM)"),r=n.getCol("MSA");for(let e=0;e<s.length;++e)(0,t.l_)(s.get(e)==r.get(e),!0)}),{timeout:6e4}),(0,t.Bu)("stderr",(async()=>{const n=new ne,s=e.DataFrame.fromCsv('HELM,MSA\n"PEPTIDE1{F.L.Mis.G.W.[MeF].Y.S.N.N.C}$$$$","F.L.Mis.G.W.MeF.Y..S.N.N.C"\n"PEPTIDE1{F.L.Mis.G.Y.[MeF].Y.W.N.C}$$$$","F.L.Mis.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'),r=await(0,te.f3)(s.getCol("HELM"),"msa(HELM)",void 0,void 0,void 0,void 0,n),i=s.getCol("MSA");(0,t.f6)(r.toList(),i.toList()),(0,t.l_)(n.warningList[0].message,"Mis not found in Monomer Map\nMeF not found in Monomer Map\n")}),{timeout:6e4}),(0,t.Bu)("error",(async()=>{const n=new ne;try{const t=e.DataFrame.fromCsv('HELM\n"PEPTIDE1{[NH2].*.A.Q.T.T.Y.K.N.Y.R.R.N.L.L.*.[COOH]}$$$$"\n"PEPTIDE1{[NH2].M.A.N.T.T.Y.K.N.Y.R.N.N.L.L.*.[COOH]}$$$$"\n"PEPTIDE1{[NH2].*.A.N.T.T.Y.K.C.Y.R.R.N.L.L.*.[COOH]}$$$$"\n"PEPTIDE1{[NH2].*.A.N.T.T.Y.K.F.Y.R.R.N.L.L.*.[COOH]}$$$$"\n');await(0,te.f3)(t.getCol("HELM"),"msa(HELM)",void 0,void 0,void 0,void 0,n)}catch(e){const[t,s]=(0,se.yf)(e);n.error(t,void 0,s)}(0,t.l_)(n.errorList[0].message,"PepSeA error: The pair (*,M) couldn't be found in the substitution matrix")}))})),(0,t.W3)("viewers",(()=>{const n=e.Func.find({package:"Bio",tags:["viewer"]}).map((e=>e.friendlyName));for(const e of n)(0,t.Bu)(e,(async()=>{const n=await _("samples/FASTA_DNA.csv");await(0,t.AB)(e,n,{detectSemanticTypes:!0})}),{skipReason:{"Sequence Similarity Search":"GROK-13162","Sequence Diversity Search":"GROK-13162",WebLogo:"GROK-13162",VdRegions:"GROK-13162"}[e]})}));const re="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",ie="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT",oe="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 ae;(0,t.W3)("SeqHandler",(()=>{async function n(t){const n=e.DataFrame.fromCsv(t);await a.data.detectSemanticTypes(n);const s=u.g.forColumn(n.getCol("seq"));return[n,s]}(0,t.Bu)("Seq-Fasta",(async()=>{const[e,s]=await n(re);(0,t.l_)(s.notation,c.r2.FASTA),(0,t.l_)(s.isMsa(),!1)})),(0,t.Bu)("Seq-Fasta-MSA",(async()=>{const[e,s]=await n(ie);(0,t.l_)(s.notation,c.r2.FASTA),(0,t.l_)(s.isMsa(),!0)})),(0,t.Bu)("Seq-Fasta-units",(async()=>{const[e,s]=await n(re);(0,t.l_)(s.notation,c.r2.FASTA),(0,t.l_)(s.isMsa(),!1)})),(0,t.Bu)("Seq-Fasta-MSA-units",(async()=>{const[e,s]=await n(ie);(0,t.l_)(s.notation,c.r2.FASTA),(0,t.l_)(s.isMsa(),!0)})),(0,t.Bu)("Seq-Helm",(async()=>{const[e,s]=await n("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_)(s.notation,c.r2.HELM),(0,t.l_)(s.isHelm(),!0)})),(0,t.Bu)("Seq-UN",(async()=>{const[e,s]=await n(oe);(0,t.l_)(s.notation,c.r2.SEPARATOR),(0,t.l_)(s.separator,"-"),(0,t.l_)(s.alphabet,c.fb.UN)})),(0,t.Bu)("Seq-UN-auto",(async()=>{const[e,s]=await n(oe);(0,t.l_)(s.notation,c.r2.SEPARATOR),(0,t.l_)(s.separator,"-"),(0,t.l_)(s.alphabet,c.fb.UN)})),(0,t.Bu)("column-version",(async()=>{const n=e.DataFrame.fromCsv(re);await a.data.detectSemanticTypes(n);const s=n.getCol("seq"),r=u.g.forColumn(s),i=s.version,o=u.g.forColumn(s),l=s.version;(0,t.l_)(i,l,"Unexpected column version changed"),(0,t.l_)(r,o,"Unexpected SeqHandler object changed"),n.rows.addNew(["TACCCCTTCAAC"]);const c=u.g.forColumn(s),h=s.version;(0,t.l_)(l<h,!0,"Stalled column version on add row"),(0,t.l_)(o!==c,!0,"Stalled SeqHandler object on add row"),s.set(1,"CAGTGTCCCCGT");const d=u.g.forColumn(s),m=s.version;(0,t.l_)(h<m,!0,"Stalled column version on change data"),(0,t.l_)(c!==d,!0,"Stalled SeqHandler object on change data"),s.setTag("testTag","testValue");const p=u.g.forColumn(s),f=s.version;(0,t.l_)(m<f,!0,"Stalled column version on set tag"),(0,t.l_)(d!==p,!0,"Stalled SeqHandler object on set tag")}))})),function(e){e.fasta="fasta",e.fastaMsa="fastaMsa",e.separator="separator",e.separatorMsa="separatorMsa",e.helm="helm"}(ae||(ae={})),(0,t.W3)("SeqHandler",(()=>{u.lh[c.r2.FASTA],u.lh[c.r2.HELM];const n=u.lh[c.r2.SEPARATOR],s={[ae.fasta]:{src:{csv:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC"},tgt:{notation:c.r2.FASTA,splitted:[["A","C","G","T","C","A","C","G","T","C"],["C","A","G","T","G","T","C","A","G","T","G","T"],["T","T","C","A","A","C","T","T","C","A","A","C"]]}},[ae.fastaMsa]:{src:{csv:"seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT"},tgt:{notation:c.r2.FASTA,splitted:[["A","C","-","G","T","-","C","T","A","C","-","G","T","-","C","T"],["C","A","C","-","T","-","G","T","C","A","C","-","T","-","G","T"],["A","C","C","G","T","A","C","T","A","C","C","G","T","A","C","T"]]}},[ae.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"]]}},[ae.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",n,"abc1","dfgg","rut12","her2","rty",n,"abc1","dfgg"],["rut2","rty","her2",n,n,"wert","rut12","rty","her2",n,n,"wert"],["rut3","rty","her2",n,n,"wert","rut12","rty","her2",n,n,"wert"],[n,"rut4","her2","wert","rut12","rty","her2","wert"],["rut5","rty","her2","wert","rut12","rty","her2","wert",n]]}},[ae.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[n,r]of Object.entries(s))(0,t.Bu)(`splitted-${n}`,(async()=>{const n=e.DataFrame.fromCsv(r.src.csv).getCol("seq"),s=await a.functions.call("Bio:detectMacromolecule",{col:n});s&&(n.semType=s),(0,t.l_)(n.semType,e.SEMTYPE.MACROMOLECULE);const i=u.g.forColumn(n);(0,t.l_)(i.notation,r.tgt.notation),(0,t.l_)(i.separator===r.tgt.separator,!0);const o=T().count(0).take(i.length).map((e=>T()(i.getSplitted(e).originals).toArray())).toArray();(0,t.f6)(o,r.tgt.splitted)}))})),(0,t.W3)("SeqHandler: getRegion",(()=>{const n={fastaDna:{srcCsv:"seq\nATTCGT\nACTGCTC\nATTCCGTA",startIdx:2,endIdx:4,tgtCsv:"seq\nTCG\nTGC\nTCC",units:c.r2.FASTA,alphabet:c.fb.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:c.fb.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[s,r]of Object.entries(n))(0,t.Bu)(`${s}-idx`,(async()=>{const n=e.DataFrame.fromCsv(r.srcCsv).getCol("seq"),s=await a.functions.call("Bio:detectMacromolecule",{col:n});s&&(n.semType=s);const i=u.g.forColumn(n).getRegion(r.startIdx,r.endIdx,"regSeq"),o=e.DataFrame.fromCsv(r.tgtCsv).getCol("seq");(0,t.l_)(n.getTag(e.TAGS.UNITS),r.units),(0,t.l_)(i.getTag(e.TAGS.UNITS),r.units),(0,t.l_)(n.getTag(c.DX.alphabet),r.alphabet),(0,t.l_)(i.getTag(c.DX.alphabet),r.alphabet),(0,t.f6)(i.toList(),o.toList())})),r.positionNames&&(0,t.Bu)(`${s}-positionNames`,(async()=>{const n=e.DataFrame.fromCsv(r.srcCsv).getCol("seq");r.positionNames.tag&&n.setTag(c.DX.positionNames,r.positionNames.tag);const s=await a.functions.call("Bio:detectMacromolecule",{col:n});s&&(n.semType=s);const i=await a.functions.call("Bio:getRegion",{sequence:n,start:r.positionNames.start,end:r.positionNames.end}),o=e.DataFrame.fromCsv(r.tgtCsv).getCol("seq");(0,t.l_)(n.getTag(e.TAGS.UNITS),r.units),(0,t.l_)(i.getTag(e.TAGS.UNITS),r.units),(0,t.l_)(n.getTag(c.DX.alphabet),r.alphabet),(0,t.l_)(i.getTag(c.DX.alphabet),r.alphabet),(0,t.f6)(i.toList(),o.toList())}))}));var le=n(8601);const ce=new e.FileSource("System:AppData/Bio"),ue={"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"}},he="molfile(sequence)";async function de(e,t="seq",n){const s=e.getCol(t),r=n.getBioLib(),i=await(0,le.i0)(e,s,r);return i.warnings.length>0&&ve.logger.warning(`_toAtomicLevel() warnings ${i.warnings.join("\n")}`),i.col}function me(e){return e.replaceAll("\r\n","\n").replace(/\n$/,"").split("\n").map((e=>e.trimEnd())).join("\n")}(0,t.W3)("toAtomicLevel",(async()=>{const n={},s={};let r,i,o;async function h(e,n){const s=e.getCol("sequence");await(0,l.toAtomicLevel)(e,s,!1);const r=e.getCol(he),i=n.getCol(he),o=T()(r.values()).map((e=>me(e))).toArray(),a=T()(i.values()).map((e=>me(e))).toArray();(0,t.f6)(o,a)}(0,t.bb)((async()=>{r=await(0,L.JN)(),i=await(0,I.nW)(),await(0,I.tb)(),await r.loadLibraries(!0);for(const[t,r]of Object.entries(ue))r.inPath,n[t]=e.DataFrame.fromCsv((await ce.readAsText(r.inPath)).replace(/\n$/,"")),await a.data.detectSemanticTypes(n[t]),s[t]=e.DataFrame.fromCsv((await ce.readAsText(r.outPath)).replace(/\n$/,""))})),(0,t.X5)((async()=>{await(0,I.tW)(i),await r.loadLibraries(!0)}));for(const[e,r]of Object.entries(ue))(0,t.Bu)(`${e}`,(async()=>{await h(n[e],s[e])}));!function(e){e.fastaDna="fastaDna",e.fastaRna="fastaRna",e.fastaPt="fastaPt",e.fastaUn="fastaUn",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.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][Tyr_PO3H2]",[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 n=d[t],s=e.DataFrame.fromCsv(n.replace(/\n$/,""));return await a.data.detectSemanticTypes(s),s}(0,t.Bu)("fastaDna",(async()=>{await de(await m(o.fastaDna),"seq",r)})),(0,t.Bu)("fastaRna",(async()=>{await de(await m(o.fastaRna),"seq",r)})),(0,t.Bu)("fastaPt",(async()=>{await de(await m(o.fastaPt),"seq",r)})),(0,t.Bu)("fastaUn",(async()=>{await de(await m(o.fastaUn),"seq",r)})),(0,t.Bu)("separatorDna",(async()=>{await de(await m(o.separatorDna),"seq",r)})),(0,t.Bu)("separatorDna",(async()=>{await de(await m(o.separatorRna),"seq",r)})),(0,t.Bu)("separatorPt",(async()=>{await de(await m(o.separatorPt),"seq",r)})),(0,t.Bu)("separatorUn",(async()=>{await de(await m(o.separatorUn),"seq",r)})),(0,t.Bu)("helm",(async()=>{await de(await m(o.helm),"seq",r)})),(0,t.Bu)("ptFasta2",(async()=>{const n=await ve.files.readAsText("tests/to-atomic-level-pt-fasta-2.mol"),s=e.DataFrame.fromCsv("seq\nAR"),i=s.getCol("seq");i.semType=e.SEMTYPE.MACROMOLECULE,i.setTag(e.TAGS.UNITS,c.r2.FASTA),i.setTag(c.DX.alphabet,c.fb.PT),u.g.forColumn(i);const o=await de(s,"seq",r);(0,t.l_)(me(o.get(0)),me(n))}))}));var pe=n(708);async function fe(t){const n=e.DataFrame.fromCsv(t),s=n.col("seq"),r=await a.functions.call("Bio:detectMacromolecule",{col:s});return r&&(s.semType=r),await a.data.detectSemanticTypes(n),u.g.forColumn(s)}function ge(e,n,s,r){const i=s(e,n);(0,t.l_)(Number(i.toFixed(3)),Number(r.toFixed(3)))}(0,t.W3)("Distance",(async()=>{const n=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],s={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 fe("seq\nFWRWYVKHPFWRWYVKHP\nYNRWYVKHPYNRWYVKHP\nMWRSWYCKHPMWRSWYCKHP")).getDistanceFunctionName();(0,t.l_)(e,pe.U.LEVENSHTEIN)})),(0,t.Bu)("DNA-distance-function",(async()=>{const e=(await fe("seq\nATAACGATAACG\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,t.l_)(e,pe.U.LEVENSHTEIN)})),(0,t.Bu)("MSA-distance-function",(async()=>{const e=(await fe("seq\nATAACATAAC\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,t.l_)(e,pe.U.HAMMING)})),(0,t.Bu)("levenstein-sub",(async()=>{const e=pe.o[pe.U.LEVENSHTEIN]();ge(r,i,e,.2)})),(0,t.Bu)("levenstein-del",(async()=>{const e=pe.o[pe.U.LEVENSHTEIN]();ge(o,a,e,.4)})),(0,t.Bu)("hamming",(async()=>{const e=pe.o[pe.U.HAMMING]();ge(o,a,e,.6)})),(0,t.Bu)("needleman-blosum62",(async()=>{const e=pe.o[pe.U.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});ge(r,i,e,-6)})),(0,t.Bu)("needleman-blosum62-del",(async()=>{const e=pe.o[pe.U.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});ge(o,a,e,-1.8)})),(0,t.Bu)("needleman-custom-sub",(async()=>{const e=pe.o[pe.U.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:s,gapOpen:1,gapExtend:1});ge(r,i,e,.2)})),(0,t.Bu)("needleman-custom-del",(async()=>{const e=pe.o[pe.U.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:s,gapOpen:1,gapExtend:1});ge(o,a,e,.8)})),(0,t.Bu)("needleman-custom-zero-extend",(async()=>{const e=pe.o[pe.U.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:s,gapOpen:1,gapExtend:0});ge(l,c,e,.714)})),(0,t.Bu)("needleman-custom-half-extend",(async()=>{const e=pe.o[pe.U.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:s,gapOpen:2,gapExtend:1});ge(l,c,e,1.286)})),(0,t.Bu)("needleman-custom-same-extend",(async()=>{const t=pe.o[pe.U.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:s,gapOpen:1,gapExtend:1});e.Test.isInBenchmark?ge(Array(1e4).fill("FWRY").join(""),Array(1e4).fill("FYWRRY").join(""),t,.667):ge(l,c,t,1.143)}))}));var ye=n(3277);async function we(e,n,s,r,i,o,c,u){await a.data.detectSemanticTypes(e);const h=await(0,l.activityCliffs)(e,e.getCol(s),e.getCol(r),i,n,c,u,{[`${ye.sS}`]:!0});(0,t.l_)(null!=h,!0);const d=Array.from(h.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 be=n(6361),Ae=n(4628);async function Ce(n,s,r){const i=n.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 u=await(0,l.sequenceSpaceTopMenu)(n,n.col(r),s,pe.U.LEVENSHTEIN,!0,c,{[ye.sS]:!0});(0,t.l_)(null!=u,!0)}(0,t.W3)("activityCliffs",(async()=>{let n,s,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()=>{n=await(0,L.JN)(),s=await(0,I.nW)(),await(0,I.tb)(),await n.loadLibraries(!0),r=[],i=[]})),(0,t.X5)((async()=>{await(0,I.tW)(s),await n.loadLibraries(!0)})),(0,t.Bu)("activityCliffsOpens",(async()=>{const t=await _(e.Test.isInBenchmark?"test/peptides_motif-with-random_10000.csv":"tests/100_3_clustests.csv");i.push(t);const n=a.shell.addTableView(t);r.push(n);const s=e.Test.isInBenchmark?6:3;await we(t,Ae.A.UMAP,"sequence","Activity",90,s,pe.U.LEVENSHTEIN,o)})),(0,t.Bu)("activityCliffsWithEmptyRows",(async()=>{const e=await _("tests/100_3_clustests_empty_vals.csv");i.push(e);const t=a.shell.addTableView(e);r.push(t),await we(e,Ae.A.UMAP,"sequence","Activity",90,3,pe.U.LEVENSHTEIN,o)})),(0,t.Bu)("Helm",(async()=>{const e=await ve.files.readCsv("samples/HELM_50.csv");a.shell.addTableView(e),await we(e,Ae.A.UMAP,"HELM","Activity",65,20,be.gk.Tanimoto,l)}))})),(0,t.W3)("sequenceSpace",(async()=>{let n,s,r,i;(0,t.Bu)("sequenceSpaceOpens",(async()=>{n=await _(e.Test.isInBenchmark?"test/peptides_motif-with-random_10000.csv":"tests/100_3_clustests.csv"),s=a.shell.addTableView(n),await Ce(n,Ae.A.UMAP,"sequence")})),(0,t.Bu)("sequenceSpaceWithEmptyRows",(async()=>{r=await _("tests/100_3_clustests_empty_vals.csv"),i=a.shell.addTableView(r),await Ce(r,Ae.A.UMAP,"sequence")}))})),(0,t.W3)("Scoring",(()=>{const n="sequence",s="expected_similarity",r="expected_identity",i=e.DataFrame.fromCsv(`${n},${s},${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(n);o.setTag(e.TAGS.UNITS,c.r2.HELM),o.semType=e.SEMTYPE.MACROMOLECULE;const a=o.get(0);let u,h;(0,t.bb)((async()=>{u=await(0,l.getMonomerLibHelper)(),h=await(0,I.nW)(),await(0,I.tb)(),await u.loadLibraries(!0)})),(0,t.X5)((async()=>{await(0,I.tW)(h),await u.loadLibraries(!0)})),(0,t.Bu)("Identity",(async()=>{const e=await(0,l.sequenceIdentityScoring)(i,o,a);for(let n=0;n<e.length;n++)(0,t.jh)(e.get(n),i.get(r,n),.01,`Wrong identity score for sequence at position ${n}`)})),(0,t.Bu)("Similarity",(async()=>{const e=await(0,l.sequenceSimilarityScoring)(i,o,a);for(let n=0;n<e.length;n++)(0,t.jh)(e.get(n),i.get(s,n),.01,`Wrong similarity score for sequence at position ${n}`)}))}));const ve=new e.Package;async function Te(n,s,r){const i=await(0,t.ci)({category:n,test:s,testContext:r});return e.DataFrame.fromObjects(i)}})(),bio_test=s})();
|
|
9
9
|
//# sourceMappingURL=package-test.js.map
|