@datagrok/bio 2.15.1 → 2.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/731.js +1 -1
- package/dist/731.js.map +1 -1
- package/dist/package-test.js +3 -3
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +2 -2
- package/dist/package.js.map +1 -1
- package/package.json +7 -7
- package/src/tests/pepsea-tests.ts +1 -1
- package/src/utils/monomer-lib/monomer-manager/monomer-manager.ts +8 -1
- package/src/utils/pepsea.ts +2 -1
package/dist/package-test.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var bio_test;(()=>{var e={8924:(e,t,n)=>{"use strict";n.d(t,{X:()=>i});var r=n(7362);class i extends r.e{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,i)),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,i)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new i({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 i.aaSynonyms?i.aaSynonyms[e]:e;return super.get(t)}}i.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class s{static getPalette(e="grok"){switch(e){case"grok":return i.GrokGroups;case"lesk":return i.Lesk;default:throw new Error(`ChemPalette: scheme \`${e}\` does not exist`)}}static getInnerOuter(e){let t=0,n="",r="";for(const i of e)"("==i?t++:")"==i?t--:t?n+=i:r+=i;return isNaN(parseInt(n))?[r,n]:[r,""]}static getColorAAPivot(e="",t="grok"){const n=this.getPalette(t);let[r,i]=this.getInnerOuter(e);if(r=r.length>6?`${r.slice(0,3)}...`:r,i=i.length>6?`${i.slice(0,3)}...`:i,1==e.length||"("==e[1]){const t=e[0]?.toUpperCase();return t in n?[n.get(t),t,i,1]:[this.undefinedColor,r,i,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,i,2]:[this.undefinedColor,r,i,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,i,3]:[this.undefinedColor,r,i,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,i,4]:[this.undefinedColor,r,i,4]}return[this.undefinedColor,r,i,0]}}s.SemType="Aminoacids",s.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",s.undefinedColor="rgb(100,100,100)",s.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"},s.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"},s.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(*)*"},s.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"}},6717:(e,t,n)=>{"use strict";n.d(t,{j:()=>i});var r=n(6082);async function i(){const e=r.Func.find({package:"Chem",name:"getRdKitModule"});if(0===e.length)throw new Error('Package "Chem" must be installed for getRdKitModule.');return(await e[0].prepare().call()).getOutputParamValue()}},9124:(e,t,n)=>{"use strict";n.d(t,{b:()=>s});var r=n(7389),i=n(6082);async function s(){const e="Helm",t=i.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()}i.JsInputBase,r.input.helmAsync=async function(e,t){return(await s()).createHelmInput(e,t)}},4356:(e,t,n)=>{"use strict";n.d(t,{Es:()=>a,Eu:()=>u,so:()=>s,ub:()=>l,yZ:()=>d});var r=n(4328);const i="Libraries",s="System:AppData/Bio/monomer-libraries/",o={explicit:["HELMCoreLibrary.json","polytool-lib.json"],exclude:[],duplicateMonomerPreferences:{}},a="System:AppData/Bio/monomer-sets/";let c=Promise.resolve();async function l(){let e;return c=c.then((async()=>{const t=await r.dapi.userDataStorage.getValue(i,"Settings",!0);e=t?JSON.parse(t):{exclude:[],explicit:[],duplicateMonomerPreferences:{}},e.exclude=e.exclude instanceof Array?e.exclude:[],e.explicit=e.explicit instanceof Array?e.explicit:[],e.duplicateMonomerPreferences=e.duplicateMonomerPreferences instanceof Object?e.duplicateMonomerPreferences:{},console.debug(`Bio: getUserLibSettings()\n${JSON.stringify(e,void 0,2)}`)})),await c,e}async function u(e){c=c.then((async()=>{console.debug(`Bio: setUserLibSettings()\n${JSON.stringify(e,void 0,2)}`),await r.dapi.userDataStorage.postValue(i,"Settings",JSON.stringify(e),!0)})),await c}async function d(){await u(o)}},6718:(e,t,n)=>{"use strict";n.d(t,{A7:()=>d,pj:()=>c,uL:()=>l});var r=n(6082),i=n(4328),s=n(6295),o=(n(3151),n(2738)),a=(n(826),n(3077));async function c(){const e=r.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 r.Column&&(e=(0,a.R)(e).columns.toList());const n=(await c()).getMonomerLib(),s=new Array(e.length),l=e[0].length,u=new Float32Array(l);for(let a=0;a<e.length;++a){const c=a<t.length?t.getCanonical(a):o._S,d=n.getMonomer("PEPTIDE",c)?.smiles??"",h=e[a],p=h.getRawData(),m=h.categories,f=m.indexOf("");if(s[a]={categories:m,data:p,emptyIndex:f},void 0===c)continue;const g=r.Column.fromStrings("smiles",m.map((e=>n.getMonomer("PEPTIDE",e)?.smiles??""))),y=(r.DataFrame.fromColumns([g]),await i.chem.getSimilarities(g,d)),w=y?y.getRawData():null;for(let e=0;e<l;++e){const t=p[e];c!==o._S&&t!==f?u[e]+=w[t]:c===o._S&&t===f&&(u[e]+=1)}}for(let n=0;n<u.length;++n){let i=u[n]/t.length;for(let o=0;o<e.length;++o){const e=s[o];if(o>=t.length&&e.data[n]!==e.emptyIndex||e.data[n]===e.emptyIndex&&o<t.length){i=r.FLOAT_NULL;break}}u[n]=i}return r.Column.fromFloat32Array("Similarity",u)}async function u(e){const t=(await c()).getMonomerLib(),n=[],s={},o=e.map((e=>t.getMonomer("PEPTIDE",e)?.smiles??"")),a=r.Column.fromStrings("smiles",o);for(let t=0;t<o.length;++t){s[e[t]]=t;const r=o[t],c=""===r?new Array(o.length).fill(0):(await i.chem.getSimilarities(a,r)).getRawData();c[t]=1,n[t]=Array.from(c)}return{scoringMatrix:n,alphabetIndexes:s}}async function d(e,t="Morgan"){const n=(await c()).getMonomerLib(),i=new Array(e.length).fill(0).map((()=>new Array(e.length).fill(0))),o={},a=e.map((e=>n.getMonomer("PEPTIDE",e)?.molfile||n.getMonomer("PEPTIDE",e)?.smiles||"")),l=r.Func.find({package:"Chem",name:"getFingerprints"})[0];if(!l)return console.warn('Function "Chem:getFingerprints" is not found in chem package. falling back to Morgan fingerprints'),await u(e);const d=r.Column.fromStrings("smiles",a),h=(r.DataFrame.fromColumns([d]),(await l.apply({col:d,fingerprintType:t}))?.entries);if(!h)return console.warn(`${t} Fingerprints could not be calculated for monomers from chem package.\n falling back to Morgan fingerprints`),await u(e);for(let t=0;t<h.length;++t)if(i[t][t]=1,o[e[t]]=t,h[t])for(let e=t+1;e<h.length;++e)h[e]&&(i[t][e]=i[e][t]=(0,s.$1)(h[t],h[e]));return{scoringMatrix:i,alphabetIndexes:o}}},7384:(e,t,n)=>{"use strict";n.d(t,{C4:()=>h});var r=n(4328),i=n(6082),s=n(1991),o=n.n(s),a=n(439),c=n(826);const l={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(3151);function d(e){return Math.round(l.PRECISION_FACTOR*e)/l.PRECISION_FACTOR}async function h(e,t,s){if(0===i.Func.find({package:"Chem",name:"getRdKitModule"}).length)return{col:null,warnings:['Transformation to atomic level requires the package "Chem" installed.']};if(t.semType!==i.SEMTYPE.MACROMOLECULE)return{col:null,warnings:[`Only the ${i.SEMTYPE.MACROMOLECULE} columns can be converted to atomic level, the chosen column has semType '${t.semType}'`]};let d=t;const h=c.GO.forColumn(t);h.isHelm()&&(d=h.convert(a.Hi.SEPARATOR,"."),d.name=t.name);const m=c.GO.forColumn(d).alphabet;let f;if(m===a.YI.PT||m===a.YI.UN)f="PEPTIDE";else{if(m!==a.YI.RNA&&m!==a.YI.DNA)return{col:null,warnings:[`Unexpected column's '${d.name}' alphabet '${m}'.`]};f="RNA"}const g=function(e){const t=e.length,n=new Array(t),i=c.GO.forColumn(e);let s=!1;for(let e=0;e<t;++e){const t=i.getSplitted(e);s||(s=0===t.length),n[e]=o()(t.canonicals).filter((e=>!i.isGap(e))).map((e=>e)).toArray()}return s&&r.shell.warning(`Some values in the "${e.name}" column are empty`),n}(d),y=await async function(e,t,n,i){const s=function(e,t,n){const r=new Map;for(const i of e.getMonomerSymbolsByType(t)){const s=e.getMonomer(t,i);if("RNA"===t&&("Branch"===s.monomerType||n===a.YI.DNA&&s.symbol===l.DEOXYRIBOSE||n===a.YI.RNA&&s.symbol===l.RIBOSE||s.symbol===l.PHOSPHATE)||"PEPTIDE"===t&&"Branch"!==s.monomerType){const e={};u.f6.forEach((t=>{e[t]=s[t]})),r.set(s.symbol,e)}}return r}(t,n,i),o=new Map,c=await r.functions.call("Chem:getRdKitModule"),d={value:null};if("RNA"===n){const e=i===a.YI.RNA?[l.RIBOSE,l.PHOSPHATE]:[l.DEOXYRIBOSE,l.PHOSPHATE];for(const t of e)p(o,t,s,c,n,d)}for(let t=0;t<e.length;++t){const r=e[t];for(const e of r)if(""!==e)try{p(o,e,s,c,n,d)}catch(t){const n=t instanceof Error?t.message:t.toString(),r=t instanceof Error?t.stack:void 0;throw console.error(`bio lib: getMonomersDictFromLib() sym='${e}', error:\n${n}\n${r}`),new Error(`Can't get monomer '${e}' from library: ${n}`)}}return o}(g,s,f,m),w=d.length,{molfileList:b,molfileWarningList:v}=await async function(e,t,r,i,s){const o=Math.max(navigator.hardwareConcurrency-2,1),a=new Array(o).fill(null).map((()=>new Worker(new URL(n.p+n.u(248),n.b)))),c=s/o;let l=[],u=[];const d=new Array(o);for(let n=0;n<o;n++){const l=Math.floor(n*c),u=n===o-1?s:Math.floor((n+1)*c);a[n].postMessage({monomerSequencesArray:e,monomersDict:t,alphabet:r,polymerType:i,start:l,end:u}),d[n]=new Promise((e=>{a[n].onmessage=({data:{molfileList:t,molfileWarningList:n}})=>{e({molfileList:t,molfileWarningList:n})}}))}return(await Promise.all(d)).forEach((e=>{l=l.concat(...e.molfileList),u=u.concat(...e.molfileWarningList)})),setTimeout((()=>{a.forEach((e=>{e.terminate()}))}),0),{molfileList:l,molfileWarningList:u}}(g,y,m,f,w);if(v.length>.05*w)throw new Error("Too many errors getting molfiles.");const A=`molfile(${d.name})`,E=e.columns.getUnusedName(A),C=i.Column.fromStrings(E,b);return C.semType=i.SEMTYPE.MOLECULE,C.meta.units=i.UNITS.Molecule.MOLBLOCK,{col:C,warnings:v}}function p(e,t,n,r,i,s){if(!e.has(t)){const o=function(e,t,n,r,i){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),c=(s=o.molfile).includes("V3000")?function(e){const t=new Map,n=/M V30 (\d+) R#.+RGROUPS=\((\d+) (\d+)\).*/gm;let r;for(;null!==(r=n.exec(e));)r.index===n.lastIndex&&n.lastIndex++,t.set(parseInt(r[1]),parseInt(r[3]));return t}(s):function(e){const t=new Map;let n=e.indexOf(l.V2K_A_LINE,0),r=n;for(;-1!==n;){r=e.indexOf("\n",n);const i=parseInt(e.substring(n,r).replace(/^A\s+/,""));n=e.indexOf("R",r),r=e.indexOf("\n",n);const s=parseInt(e.substring(n,r).replace(/^R/,""));t.set(i,s),n=e.indexOf(l.V2K_A_LINE,r)}for(n=e.indexOf(l.V2K_RGP_LINE,0),r=e.indexOf("\n",n);-1!==n;){n+=l.V2K_RGP_SHIFT,r=e.indexOf("\n",n);const i=e.substring(n,r).replaceAll(/\s+/g," ").split(" ").map((e=>parseInt(e))).slice(1);for(let e=0;e<i.length;e+=2){if(t.has(i[e])&&t.get(i[e])!==i[e+1])throw new Error(`r-group index ${i[e]} has already been added with a different value`);t.set(i[e],i[e+1])}n=e.indexOf(l.V2K_RGP_LINE,r)}return t}(s),u=o.molfile.includes("V3000")?o.molfile:function(e,t){const n=t.get_mol(e),r=n.get_v3Kmolblock();return n.delete(),r}(function(e){let t=e.indexOf(l.V2K_A_LINE,0);-1===t&&(t=e.indexOf(l.V2K_RGP_LINE));const n=e.indexOf(l.V3K_END,t);return e.substring(0,t)+e.substring(n)}(o.molfile),n),h=function(e){let t=(e=e.replaceAll("\r","")).indexOf(l.V3K_BEGIN_COUNTS_LINE)+l.V3K_COUNTS_SHIFT,n=e.indexOf(" ",t+1);const r=parseInt(e.substring(t,n));return t=n+1,n=e.indexOf(" ",t+1),{atomCount:r,bondCount:parseInt(e.substring(t,n))}}(u),p=function(e,t){const n=new Array(t),r=new Float32Array(t),i=new Float32Array(t),s=new Array(t);let o=e.indexOf(l.V3K_BEGIN_ATOM_BLOCK);o=e.indexOf("\n",o);let a=o;for(let c=0;c<t;c++){o=e.indexOf(l.V3K_BEGIN_DATA_LINE,o)+l.V3K_IDX_SHIFT,a=e.indexOf(" ",o),o=a+1,a=e.indexOf(" ",o),n[c]=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));r[c]=t[0],i[c]=t[1],o=a,a=e.indexOf("\n",o)+1,s[c]=e.slice(o,a),o=a}return{atomTypes:n,x:r,y:i,kwargs:s}}(u,h.atomCount),g=function(e,t){const n=new Uint32Array(t),r=new Array(t),i=new Map,s=new Map;let o=e.indexOf(l.V3K_BEGIN_BOND_BLOCK);o=e.indexOf("\n",o);let a=o;for(let c=0;c<t;++c){const t=new Array(3);o=e.indexOf(l.V3K_BEGIN_DATA_LINE,a)+l.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[c]=t[0],r[c]=t.slice(1);const u=e.indexOf("\n",o);let d=e.slice(a,u),h=d.indexOf(l.V3K_BOND_CONFIG);if(-1!==h){h=d.indexOf("=",h)+1;let e=d.indexOf(" ",h);-1===e&&(e=d.length);const t=parseInt(d.slice(h,e));i.set(c,t);const n=l.V3K_BOND_CONFIG+t.toString();d=d.replace(n,"")}d||s.set(c,d)}return{bondTypes:n,atomPairs:r,bondConfiguration:i,kwargs:s}}(u,h.bondCount),w=function(e,t,n,r){const i={backboneShift:null,branchShift:null,terminalNodes:[],rNodes:[]};return function(e,t,n){for(const[r,i]of n)e.atomTypes[r-1]=t[i-1]}(e,n,r),function(e,t){t.rNodes=Array.from(e.keys());for(let n=0;n<t.rNodes.length;n++)for(const r of[1,2])if(e.get(t.rNodes[n])===r){const e=t.rNodes[r-1];t.rNodes[r-1]=t.rNodes[n],t.rNodes[n]=e}}(r,i),m(t,i),i}(p,g,a,c),C=function(e){let t=[],n=e.indexOf("M V30 MDLV30/STEABS ATOMS=(");for(;-1!==n;){n+=28;const r=e.indexOf(")",n);t=t.concat(e.substring(n,r).split(" ").slice(1).map((e=>parseInt(e)))),n=r,n=e.indexOf("M V30 MDLV30/STEABS ATOMS=(",n)}return t}(u),T={atoms:p,bonds:g,meta:w,stereoAtoms:C};return"PEPTIDE"===r?function(e){const t=e.meta.terminalNodes[0]-1,n=e.meta.rNodes[0]-1,r=e.atoms.x,i=e.atoms.y;E(e,-r[t],-i[t]);const s=b(r[n],i[n]);v(e.atoms,-s),r[e.meta.rNodes[1]-1]<0&&function(e){A(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 r=n[e],i=n[(e+1)%2];t.has(r)?t.get(r)?.push(i):t.set(r,new Array(1).fill(i))}return t}(e);let n=0;const r=e.atoms.atomTypes.length;let i=0;for(;0===n;){const s=t.get(e.meta.terminalNodes[1])[i];if(e.atoms.atomTypes[s-1]===l.OXYGEN&&s!==e.meta.rNodes[1]&&(n=s),i++,i>r)throw new Error(`Search for double-bonded Oxygen in ${e} has exceeded the limit of ${r}`)}return n}(e);!function(e,t){e.atoms.y[e.meta.rNodes[1]-1]<0&&e.atoms.y[t-1]<0&&(function(e){A(e,!0)}(e),v(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 r=t-1,i=n-1,s=e.atoms.x,o=e.atoms.y,a=s[r],c=o[r];s[r]=s[i],o[r]=o[i],s[i]=a,o[i]=c}(e,t,e.meta.rNodes[1])}(e,o)}(T):e===l.RIBOSE||e===l.DEOXYRIBOSE?function(e,t){const n=e.atoms.x,r=e.atoms.y;let i=e.meta.terminalNodes[0]-1;const s=e.meta.rNodes[1]-1;E(e,-n[i],-r[i]);const o=b(n[s],r[s]);v(e.atoms,3*Math.PI/2-o),t.value=function(e){const t=e.atoms.x,n=e.atoms.y,r=e.meta.rNodes[2]-1,i=e.meta.terminalNodes[2]-1,s=t[r]-t[i],o=n[r]-n[i];return Math.atan(o/s)+Math.PI/2}(e),i=e.meta.terminalNodes[0]-1,E(e,-n[i],-r[i])}(T,i):e===l.PHOSPHATE?function(e){const t=e.meta.terminalNodes[0]-1,n=e.meta.rNodes[0]-1,r=e.atoms.x,i=e.atoms.y;E(e,-r[t],-i[t]);const s=b(r[n],i[n]);v(e.atoms,Math.PI/2-s)}(T):function(e,t){const n=e.atoms.x,r=e.atoms.y,i=e.meta.terminalNodes[0]-1,s=e.meta.rNodes[0]-1;E(e,-n[i],-r[i]);const o=b(n[s],r[s]),a=t.value;if(!a)throw new Error("The value of sugarBranchToOYAngle is null");v(e.atoms,Math.PI-o+a);const c=function(e,t){return d(Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2))}({x:n[e.meta.rNodes[0]-1],y:r[e.meta.rNodes[0]-1]},{x:n[e.meta.terminalNodes[0]-1],y:r[e.meta.terminalNodes[0]-1]});if(1!=c)for(let e=0;e<n.length;++e)n[e]=d(n[e]/c),r[e]=d(r[e]/c)}(T,i),function(e,t,n){"PEPTIDE"===e?(f(t,e),y(t,t.meta.rNodes[1])):n===l.RIBOSE||n===l.DEOXYRIBOSE?(y(t,t.meta.rNodes[1]),t.meta.rNodes[1]=t.meta.terminalNodes[1],m(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===l.PHOSPHATE&&(t.meta.terminalNodes[0]=t.meta.rNodes[0],E(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]))}(r,T,e),function(e){let t=0;for(;t<e.atoms.atomTypes.length;)e.atoms.atomTypes[t]===l.HYDROGEN&&(y(e,t+1),--t),++t}(T),T}var s;return null}(t,n,r,i,s);if(!o)throw new Error(`Monomer with symbol '${t}' is absent the monomer library`);e.set(t,o)}}function m(e,t){const n=t.rNodes;t.terminalNodes=new Array(n.length).fill(0);const r=t.terminalNodes,i=e.atomPairs;let s=0,o=0;for(;s<i.length&&o<r.length;){for(let e=0;e<r.length;++e)for(let t=0;t<2;++t)i[s][t]===n[e]&&(r[e]=i[s][(t+1)%2],n.length,++o);++s}}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[d(e.atoms.x[t]-e.atoms.x[n]),d(e.atoms.y[t]-e.atoms.y[n])]}function y(e,t){if(void 0!==t){const n=t-1,r=e.atoms,i=e.bonds,s=e.meta;r.atomTypes.splice(n,1),r.x=w(Float32Array,r.x,n,1),r.y=w(Float32Array,r.y,n,1),r.kwargs.splice(n,1);for(let e=0;e<s.terminalNodes.length;++e)s.terminalNodes[e]>t?--s.terminalNodes[e]:s.terminalNodes[e]===t&&(s.terminalNodes[e]=-1);for(let e=0;e<s.rNodes.length;++e)s.rNodes[e]>t?--s.rNodes[e]:s.rNodes[e]===t&&(s.rNodes[e]=-1);let o=0;for(;o<i.atomPairs.length;){const e=i.atomPairs[o][0],n=i.atomPairs[o][1];e===t||n===t?(i.atomPairs.splice(o,1),i.bondTypes=w(Uint32Array,i.bondTypes,o,1),i.bondConfiguration.has(o)&&i.bondConfiguration.delete(o),i.kwargs.has(o)&&i.kwargs.delete(o),--o):(i.atomPairs[o][0]=e>t?e-1:e,i.atomPairs[o][1]=n>t?n-1:n),++o}let a=Array.from(i.bondConfiguration.keys());a.forEach((e=>{if(i.bondConfiguration.has(e)&&e>n){const t=i.bondConfiguration.get(e);i.bondConfiguration.delete(e),i.bondConfiguration.set(e-1,t)}})),a=Array.from(i.kwargs.keys()),a.forEach((e=>{if(i.kwargs.has(e)&&e>n){const t=i.kwargs.get(e);i.kwargs.delete(e),i.kwargs.set(e-1,t)}}))}}function w(e,t,n,r){const i=new e(t.length-r);let s=0,o=0;for(;s<t.length;)s===n&&(s+=r),i[o]=t[s],++o,++s;return i}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 r=t/e,i=Math.atan(r);n=e<0?Math.PI/2+i:-Math.PI/2+i}return n}function v(e,t){if(0!==t){const n=e.x,r=e.y,i=Math.cos(t),s=Math.sin(t);for(let e=0;e<n.length;++e){const t=n[e];n[e]=d(t*i-r[e]*s),r[e]=d(t*s+r[e]*i)}}}function A(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 r=1===t?3:1;n.set(e,r)}}function E(e,t,n){const r=e.atoms.x,i=e.atoms.y;for(let e=0;e<r.length;++e)r[e]=d(r[e]+t),void 0!==n&&(i[e]=d(i[e]+n))}},1093:(e,t,n)=>{"use strict";n.d(t,{A:()=>i,Q:()=>s});var r=n(7362);class i extends r.e{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new i({A:"green",C:"blue",G:"black",T:"red",U:"red",others:"gray"})),this.chromatogram}}class s{}s.SemType="Nucleotides",s.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",s.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"}},7362:(e,t,n)=>{"use strict";n.d(t,{e:()=>r});class r{static makePalette(e,t=!1,n=r){const i={};return e.forEach((e=>{const n=e[0],r=e[1];n.forEach(((e,n)=>{i[e]=this.colourPalette[r][t?0:n]}))})),new n(i)}constructor(e){this._palette=e}get(e){return this._palette[e]}}r.undefinedColor="rgb(100,100,100)",r.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)"]}},4152:(e,t,n)=>{"use strict";n.d(t,{$u:()=>o,oT:()=>l});var r=n(6082),i=n(7362);class s{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 c extends o{static buildPalette(){return[].concat(...Object.values(i.e.colourPalette))}get(e){const t=s.hashCode(e)%c.palette.length;return function(e){if(null==e)return"rgb(100,100,100)";const t=r.Color.fromHtml(e),n=r.Color.g(t),i=r.Color.r(t),s=r.Color.b(t),o=Math.sqrt(Math.pow(0-i,2)+Math.pow(0-n,2)+Math.pow(0-s,2));return o>210?`rgb(${i/o*210},${n/o*210},${s/o*210})`:r.Color.toRgb(t)}(c.palette[t])}}c.palette=c.buildPalette();class l extends i.e{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 c),this.color}}},6642:(e,t,n)=>{"use strict";n.d(t,{h:()=>o,s:()=>a});var r=n(4328),i=n(1858),s=n(8070);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 r=e.cell.column;if(t=t??r.temp,!t)throw new Error("Grid cell renderer back store (GridColumn or Column) not found.");return[n,r,t]}class a{constructor(e,t,n){this.gridCol=e,this.tableCol=t,this.logger=n,this.subs=[],this.dirty=!0,this.destroyed=!1,this.viewerId=++a.viewerCounter,this.errors=[],this._onRendered=new i.Subject,this.tableCol&&this.tableCol.dataFrame&&this.subs.push(this.tableCol.dataFrame.onDataChanged.subscribe((()=>{this.dirty=!0}))),this.tableCol&&this.subs.push(r.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(r.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()}reset(){this.dirty=!1}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,s.PE)(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},6882:(e,t,n)=>{"use strict";n.d(t,{B:()=>u,J:()=>d});var r=n(6082),i=n(1991),s=n.n(i),o=n(826),a=n(6642),c=n(6718),l=n(9192);function u(e,t){let n,r=100,i=0,s=e.length-1;for(;i<=s;){if(n=Math.floor((s+i)/2),e[n]<=t&&t<e[n+1])return n;if(t<e[n]?s=n-1:i=n+1,--r<=0)throw new Error(`Get position for pointer x = ${t} searching has not converged on ${JSON.stringify(e)}. `)}return null}class d extends a.s{constructor(e,t,n,i,s){super(e,t,n),this.monomerLengthLimit=i,this.propsProvider=s,this.colWidth=0,this._monomerLengthList=null,this.separatorWidth=5,this._processedMaxVisibleSeqLength=0,this._monomerLengthMap={},this._monomerStructureMap={},this.props=this.propsProvider(),this._processedRows=r.BitSet.create(this.tableCol.length),this.gridCol&&this.subs.push(this.gridCol.grid.onAfterDrawContent.subscribe((()=>{this._onRendered.next()}))),(0,c.pj)().then((e=>{if(this.destroyed)return;const t=e.getMonomerLib();this.subs.push(t.onChanged.subscribe((()=>{this.dirty=!0,this.gridCol?.grid?.invalidate()})))}))}reset(){this.propsProvider&&(this.props=this.propsProvider()),this._processedRows=r.BitSet.create(this.tableCol.length),this._monomerLengthList=null,this._monomerLengthMap={},this._monomerStructureMap={},super.reset()}getCellMonomerLengths(e,t){if(this.colWidth<t&&(this.colWidth=t,this.dirty=!0),this.dirty)try{this.reset()}catch(e){const[t,n]=(0,l.AP)(e);this.logger.error(t,void 0,n)}const n=this.props.seqHandler.isMsa()?this.getCellMonomerLengthsForSeqMsa():this.getCellMonomerLengthsForSeq(e),r=new Array(n.length+1);r[0]=5;for(let e=1;e<r.length;e++)r[e]=r[e-1]+n[e-1];return[n,r]}getCellMonomerLengthsForSeq(e){this.toLog(),null===this._monomerLengthList&&(this._monomerLengthList=new Array(this.tableCol.length).fill(null));const t=this.props.separatorWidth+1*this.props.monomerCharWidth,n=Math.ceil(this.colWidth/t),r=o.GO.forColumn(this.tableCol).getSplitted(e).originals,i=Math.min(n,r.length);let s=this._monomerLengthList[e];if(null===s||s.length<i){s=this._monomerLengthList[e]=new Array(r.length);let t=0;for(let e=0;e<i;++e){const n=r[e],i=this.props.monomerToShort(n,this.monomerLengthLimit),o=(this.props.seqHandler.isSeparator()?this.separatorWidth:this.props.separatorWidth)+i.length*this.props.monomerCharWidth;if(s[e]=o,t+=o,t>this.colWidth)break}}return s}getCellMonomerLengthsForSeqMsa(){var e;this.toLog(),null===this._monomerLengthList&&(this._monomerLengthList=new Array(1).fill(null)),(e=this._monomerLengthList)[0]??(e[0]=new Array(0));const t=this._monomerLengthList[0],{startIdx:n,endIdx:r}=(()=>{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)}}})(),i=this.props.separatorWidth+1*this.props.monomerCharWidth,s=Math.ceil(this.colWidth/i);for(let e=n;e<r;e++){if(this._processedRows.get(e)&&s<=this._processedMaxVisibleSeqLength)continue;const n=o.GO.forColumn(this.tableCol).getSplitted(e,s).originals,r=Math.min(s,n.length);r>t.length&&t.push(...new Array(r-t.length).fill(i));let a=0;for(let e=0;e<r;++e){const r=n[e],i=this.props.monomerToShort(r,this.monomerLengthLimit),s=this.props.separatorWidth+i.length*this.props.monomerCharWidth;if(t[e]=Math.max(t[e]??0,s),a+=s,a>=this.colWidth)break}this._processedMaxVisibleSeqLength=Math.max(this._processedMaxVisibleSeqLength,s)}return t}getPosition(e,t,n){const[r,i]=this.getCellMonomerLengths(e,n),a=o.GO.forColumn(this.tableCol);return 0===s()(a.getSplitted(e).originals).toArray().length?null:u(i,t)}setMonomerLengthLimit(e){this.monomerLengthLimit=e,this.dirty=!0}setSeparatorWidth(e){this.props.separatorWidth=e,this.dirty=!0}isMsa(){return this.props.seqHandler.isMsa()}}},3151:(e,t,n)=>{"use strict";n.d(t,{EK:()=>s,f6:()=>r,q7:()=>i});const r=["symbol","molfile","rgroups","name"],i="p",s=new RegExp(`[rd]\\((\\w)\\)${i}?`,"g")},9192:(e,t,n)=>{"use strict";function r(e){return"string"==typeof e||e instanceof String?e:"StateError"===e.constructor.name?e.message:"StateError"===e.constructor.name&&"$thrownJsError"in e?r(e.$thrownJsError):e instanceof Error?e.message:e.toString()}function i(e){return e instanceof Error?e.stack:"StateError"===e.constructor.name&&"$thrownJsError"in e?i(e.$thrownJsError):void 0}function s(e){return[r(e),i(e)]}n.d(t,{AP:()=>s})},3516:(e,t,n)=>{"use strict";n.d(t,{m:()=>o});var r=n(6082),i=n(826),s=n(439);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 r=this._fileContent.substring(t.index+1,e.lastIndex);this._descriptionsArray.push(r),0!==n&&this._sequencesArray.push(this.parseMacromolecule(n,t.index)),n=e.lastIndex+1}this._sequencesArray.push(this.parseMacromolecule(n,-1))}importFasta(){const e=r.Column.fromStrings("description",this.descriptionsArray),t=r.Column.fromStrings("sequence",this.sequencesArray);return t.semType=r.SEMTYPE.MACROMOLECULE,t.meta.units=s.Hi.FASTA,i.GO.forColumn(t),[r.DataFrame.fromColumns([e,t])]}constructor(e){this._descriptionsArray=[],this._sequencesArray=[],this._fileContent=e,this.parseColumns()}}},6873:(e,t,n)=>{"use strict";n.d(t,{dW:()=>o,fD:()=>s});var r=n(6082),i=(n(1991),n(2003));function s(){const e=[];return e.push(r.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(r.Column.fromList(r.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=r.Column.fromList(r.COLUMN_TYPE.STRING,"MSA",new Array(100).fill(t));n.semType=r.SEMTYPE.MACROMOLECULE,n.meta.units=i.Hi.SEPARATOR,n.setTag(i.gp.separator,"/"),n.setTag(i.gp.alphabet,i.YI.UN),n.setTag(i.gp.alphabetIsMultichar,"true");const s=[];return s.push(n),s.push(r.Column.fromList(r.COLUMN_TYPE.FLOAT,"Activity",new Array(100).fill(7.30751))),s}n(826),n(9322)},439:(e,t,n)=>{"use strict";n.d(t,{B5:()=>c,Hi:()=>r,Vl:()=>l,YI:()=>i,gp:()=>s,q7:()=>u,z1:()=>a});var r,i,s,o=n(2738);!function(e){e.FASTA="fasta",e.SEPARATOR="separator",e.HELM="helm"}(r||(r={})),function(e){e.DNA="DNA",e.RNA="RNA",e.PT="PT",e.UN="UN"}(i||(i={})),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"}(s||(s={}));const a=", ",c=/(?:\[([A-Za-z0-9_\-,()]+)\])|([A-Za-z\-])/g,l=new class{constructor(){this.fasta={peptide:new Set(["G","L","Y","S","E","Q","D","N","F","A","K","R","H","C","V","P","W","I","M","T"]),dna:new Set(["A","C","G","T"]),rna:new Set(["A","C","G","U"])}}},u=[new o.aD(i.PT,l.fasta.peptide,.5),new o.aD(i.DNA,l.fasta.dna,.55),new o.aD(i.RNA,l.fasta.rna,.55)]},2003:(e,t,n)=>{"use strict";n.d(t,{Hi:()=>r.Hi,J9:()=>i.J9,Qf:()=>i.Qf,SM:()=>i.SM,YI:()=>r.YI,dh:()=>i.dh,gp:()=>r.gp,mn:()=>i.mn,nq:()=>i.nq,ny:()=>i.ny,q7:()=>r.q7,qp:()=>i.qp,z1:()=>r.z1,zS:()=>i.zS});var r=n(439),i=n(9322)},2738:(e,t,n)=>{"use strict";n.d(t,{XN:()=>s,_S:()=>r,aD:()=>i});const r="";class i{constructor(e,t,n){this.name=e,this.alphabet=t,this.cutoff=n}}class s extends i{constructor(e,t,n){super(e.name,e.alphabet,e.cutoff),this.freq=t,this.similarity=n}}},9322:(e,t,n)=>{"use strict";n.d(t,{Mu:()=>m,pc:()=>P,Qf:()=>_,nq:()=>x,ny:()=>$,Iv:()=>C,dh:()=>b,vZ:()=>g,zS:()=>S,SM:()=>M,mn:()=>N,J9:()=>y,tm:()=>w,qp:()=>E});var r=n(6082),i=n(1991),s=n.n(i),o=n(2738),a=n(439),c=n(826);class l extends Float32Array{}var u=n(3629),d=n(8924),h=n(1093),p=n(4152);class m{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)===c.b9[a.Hi.FASTA]}getCanonical(e){if(this.length<=e)throw new Error("Index out of bounds");return this.isGap(e)?o._S: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 r=e.categories;return function(e,t){const n={};let r=!0,i=null;for(const s of e)if(null==i?i=s.length:s.length!==i&&(r=!1),s.length>=t)for(const e of s.canonicals)e in n||(n[e]=0),n[e]+=1;return{freq:n,sameLength:r}}(s().enumerate(e.getRawData()).map((([e,t])=>n(r[e]))),t)}const y=e=>{const t=s()(e.toString().matchAll(a.B5)).map((e=>e[2]??e[1])).toArray();return new m(t,c.b9[a.Hi.FASTA])},w=e=>e?new f(e):new m([],c.b9[a.Hi.FASTA]);function b(e,t=void 0){return n=>{if(n){let r;const i=new RegExp(String.raw`"-"|'-'|[^${e}]+`,"g");if(void 0!==t){i.lastIndex=0,r=new Array(Math.ceil(t));let e=null,s=0;for(;null!==(e=i.exec(n))&&s<t;)r[s++]=e[0].replace('"-"',"").replace("'-'","");r.splice(s)}else r=n.replaceAll('"-"',"").replaceAll("'-'","").split(e,t);return new m(r,c.b9[a.Hi.SEPARATOR])}return new m([],c.b9[a.Hi.SEPARATOR])}}const v=/(PEPTIDE1|DNA1|RNA1)\{([^}]+)}/g,A=/\[([^\[\]]+)]/g,E=e=>{v.lastIndex=0;const t=v.exec(e.toString()),n=t?t[2]:null,r=n?n.split("."):[];return new m(r.map((e=>{A.lastIndex=0;const t=A.exec(e);return t&&t.length>=2?t[1]:e})),c.b9[a.Hi.HELM])};function C(e,t,n=void 0){if(e.toLowerCase().startsWith(a.Hi.FASTA))return y;if(e.toLowerCase().startsWith(a.Hi.SEPARATOR))return b(t,n);if(e.toLowerCase().startsWith(a.Hi.HELM))return E;throw new Error(`Unexpected units ${e} .`)}const T=/([^\W_]+)/g;function S(e,t){if(e.length<=t)return e;const n=e.match(T),r=e.length>t||(n?.length??0)>1,i=n?.[0]??" ";return r?i.substring(0,t-1)+"…":i}function _(e){switch(e){case a.YI.DNA:return a.Vl.fasta.dna;case a.YI.RNA:return a.Vl.fasta.rna;case a.YI.PT:return a.Vl.fasta.peptide;default:throw new Error(`Unsupported alphabet '${e}'.`)}}function x(e,t,n="-"){const r=new Set([...new Set(Object.keys(e)),...t]);r.delete(n);const i=[],s=[];for(const n of r)i.push(n in e?e[n]:0),s.push(t.has(n)?1:0);const o=new l(i),a=new l(s);return(0,u.KE)(o,a)/((0,u.wQ)(o)*(0,u.wQ)(a))}function P(e,t,n="-"){const r=t.map((t=>{const r=x(e,t.alphabet,n);return new o.XN(t,e,r)}));let i;const s=Math.max(...r.map((e=>e.similarity>e.cutoff?e.similarity:-1)));return i=s>0?r.find((e=>e.similarity===s)).name:a.YI.UN,i}function M(e,t=5){let n;return n=e.semType==r.SEMTYPE.MACROMOLECULE?c.GO.forColumn(e).alphabet:P(g(e,t,y).freq,a.q7),$(n)}function $(e){switch(e){case a.YI.PT:return d.X.GrokGroups;case a.YI.DNA:case a.YI.RNA:return h.A.Chromatogram;default:return p.oT.Color}}function N(e){const t=e.columns.bySemTypeAll(r.SEMTYPE.MACROMOLECULE);let n=t.find((e=>{const t=e.meta.units;return!!t&&-1!==t.indexOf("MSA")}))??null;return!n&&t.length>0&&(n=t[0]),n}},826:(e,t,n)=>{"use strict";n.d(t,{GO:()=>m,b9:()=>p});var r=n(6082),i=n(1991),s=n.n(i),o=n(2003),a=n(2738),c=n(9322),l=n(6863),u=n(6718),d=n(3151);const h=new class{constructor(){this.seqHandler="seq-handler",this.notationProvider="seq-handler.notation-provider"}},p={[o.Hi.FASTA]:"-",[o.Hi.SEPARATOR]:"",[o.Hi.HELM]:"*"};class m{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!==r.TYPE.STRING)throw new Error(`Unexpected column type '${e.type}', must be '${r.TYPE.STRING}'.`);this._column=e;const t=this._column.meta.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()?p[o.Hi.FASTA]:this.isHelm()?p[o.Hi.HELM]:p[o.Hi.SEPARATOR],!this.column.tags.has(o.gp.aligned)||!this.column.tags.has(o.gp.alphabet)||!this.column.tags.has(o.gp.alphabetIsMultichar)&&!this.isHelm()&&this.alphabet===o.YI.UN)if(this.isFasta())m.setUnitsToFastaColumn(this);else if(this.isSeparator()){const t=e.getTag(o.gp.separator);m.setUnitsToSeparatorColumn(this,t)}else{if(!this.isHelm())throw new Error(`Unexpected units '${this.column.meta.units}'.`);m.setUnitsToHelmColumn(this)}if(!this.column.tags.has(o.gp.alphabetIsMultichar))if(this.isHelm())this.column.setTag(o.gp.alphabetIsMultichar,"true");else if(["UN"].includes(this.alphabet))throw new Error(`For column '${this.column.name}' of alphabet '${this.alphabet}' tag '${o.gp.alphabetIsMultichar}' is mandatory.`);this.notationProvider=this.column.temp[h.notationProvider]??null,this.columnVersion=this.column.version}static setUnitsToFastaColumn(e){if(e.column.semType!==r.SEMTYPE.MACROMOLECULE||e.column.meta.units!==o.Hi.FASTA)throw new Error(`The column of notation '${o.Hi.FASTA}' must be '${r.SEMTYPE.MACROMOLECULE}'.`);e.column.meta.units=o.Hi.FASTA,m.setTags(e)}static setUnitsToSeparatorColumn(e,t){if(e.column.semType!==r.SEMTYPE.MACROMOLECULE||e.column.meta.units!==o.Hi.SEPARATOR)throw new Error(`The column of notation '${o.Hi.SEPARATOR}' must be '${r.SEMTYPE.MACROMOLECULE}'.`);if(!t)throw new Error(`The column of notation '${o.Hi.SEPARATOR}' must have the separator tag.`);e.column.meta.units=o.Hi.SEPARATOR,e.column.setTag(o.gp.separator,t),m.setTags(e)}static setUnitsToHelmColumn(e){if(e.column.semType!==r.SEMTYPE.MACROMOLECULE)throw new Error(`The column of notation '${o.Hi.HELM}' must be '${r.SEMTYPE.MACROMOLECULE}'`);e.column.meta.units=o.Hi.HELM,m.setTags(e)}static setTags(e){const t=e.column.meta.units;if([o.Hi.FASTA,o.Hi.SEPARATOR].includes(t)){if(!e.column.getTag(o.gp.alphabet)&&0===Object.keys(e.stats.freq).length)throw new Error("Alphabet is empty and not annotated.");let t=e.column.getTag(o.gp.aligned);null===t&&(t=e.stats.sameLength?"SEQ.MSA":"SEQ",e.column.setTag(o.gp.aligned,t));let n=e.column.getTag(o.gp.alphabet);if(null===n&&(n=(0,c.pc)(e.stats.freq,o.q7),e.column.setTag(o.gp.alphabet,n)),n===o.YI.UN){const t=Object.keys(e.stats.freq).length,n=Object.keys(e.stats.freq).some((e=>e.length>1));e.column.setTag(o.gp.alphabetSize,t.toString()),e.column.setTag(o.gp.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.gp.separator)??void 0;if(this.notation===o.Hi.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.gp.aligned);if(!e&&(this.isFasta()||this.isSeparator()))throw new Error("Tag aligned not set");return e}get alphabet(){const e=this.column.getTag(o.gp.alphabet);if(!e&&(this.isFasta()||this.isSeparator()))throw new Error("Tag alphabet not set");return e}get helmCompatible(){return this.column.getTag(o.gp.isHelmCompatible)}getAlphabetSize(){if(this.notation==o.Hi.HELM||this.alphabet==o.YI.UN){const e=this.column.getTag(o.gp.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.YI.PT:return 20;case o.YI.DNA:case o.YI.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.Hi.HELM||this.alphabet===o.YI.UN&&"true"===this.column.getTag(o.gp.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)}}async getHelm(e,t){const n=this.column.get(e);return this.notationProvider?(await this.notationProvider.getHelm(this.column,t)).get(e):this.convertToHelm(n)}get stats(){if(null===this._stats){const e={};let t=!0,n=null;const r=this.column.length;for(let i=0;i<r;++i){const r=this.getSplitted(i);null==n?n=r.length:r.length!==n&&(t=!1);for(const t of r.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(...s().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.gp.positionNames);this._posList=e?e.split(o.z1).map((e=>e.trim())):s().count(1).take(this.maxLength).map((e=>e.toString())).toArray()}return this._posList}isFasta(){return this.notation===o.Hi.FASTA}isSeparator(){return this.notation===o.Hi.SEPARATOR}isHelm(){return this.notation===o.Hi.HELM}isRna(){return this.alphabet===o.YI.RNA}isDna(){return this.alphabet===o.YI.DNA}isPeptide(){return this.alphabet===o.YI.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.Hi.FASTA))return o.Hi.FASTA;if(this.units.toLowerCase().startsWith(o.Hi.SEPARATOR))return o.Hi.SEPARATOR;if(this.units.toLowerCase().startsWith(o.Hi.HELM))return o.Hi.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,i){const s=this.column,a=e.toLowerCase()+"("+s.name+")",c=n??s.dataFrame.columns.getUnusedName(a),l=r.Column.fromList("string",c,i??new Array(this.column.length).fill(""));if(l.semType=r.SEMTYPE.MACROMOLECULE,l.meta.units=e,e===o.Hi.SEPARATOR){if(!t)throw new Error(`Notation '${o.Hi.SEPARATOR}' requires separator value.`);l.setTag(o.gp.separator,t)}l.setTag(r.TAGS.CELL_RENDERER,e===o.Hi.HELM?"helm":"sequence");const u=s.getTag(o.gp.aligned);u&&l.setTag(o.gp.aligned,u);let d=s.getTag(o.gp.alphabet);d||this.notation!==o.Hi.HELM||e===o.Hi.HELM||(d=o.YI.UN),null!=d&&l.setTag(o.gp.alphabet,d);let h=s.getTag(o.gp.alphabetSize);null!=d&&h&&l.setTag(o.gp.alphabetSize,h);const p=s.getTag(o.gp.alphabetIsMultichar);return null!=d&&void 0!==p&&l.setTag(o.gp.alphabetIsMultichar,p),e==o.Hi.HELM&&(h=this.getAlphabetSize().toString(),l.setTag(o.gp.alphabetSize,h)),l}getNewColumnFromList(e,t){return this.getNewColumn(this.notation,this.separator,e,t)}static getNewColumn(e){const t=m.forColumn(e),n=t.notation;return t.getNewColumn(n)}static unitsStringIsValid(e){return e=e.toLowerCase(),[o.Hi.FASTA,o.Hi.SEPARATOR,o.Hi.HELM].some((t=>e.startsWith(t.toLowerCase())))}static getNewColumnFromParams(e,t,n){if(!m.unitsStringIsValid(n))throw new Error("Invalid format of 'units' parameter");const i=r.Column.fromList("string",t,new Array(e).fill(""));return i.semType=r.SEMTYPE.MACROMOLECULE,i.meta.units=n,i}getSplitter(e){let t=null;if(t=this.notationProvider?this.notationProvider.splitter:null,t)return t;if(this.units.toLowerCase().startsWith(o.Hi.FASTA))return null===this.column.getTag(o.gp.alphabet)||this.getAlphabetIsMultichar()?o.J9:c.tm;if(this.units.toLowerCase().startsWith(o.Hi.SEPARATOR))return(0,o.dh)(this.separator,e);if(this.units.toLowerCase().startsWith(o.Hi.HELM))return o.qp;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 l.Z.HAMMING;switch(this.alphabet){case o.YI.DNA:case o.YI.RNA:case o.YI.PT:}return l.Z.LEVENSHTEIN}getDistanceFunction(){return l.V[this.getDistanceFunctionName()]()}async checkHelmCompatibility(){if(this.column.tags.has(o.gp.isHelmCompatible))return"true"===this.column.getTag(o.gp.isHelmCompatible);const e=(await(0,u.pj)()).getMonomerLib().getMonomerSymbolsByType("PEPTIDE"),t=new Set(e),n=((0,o.dh)(this.separator),new Set),r=this.column.length,i=this.column.getRawData();for(let e=0;e<r;++e){const r=i[e];if(!(r in n)){n.add(r);const i=this.getSplitted(e);for(const e of i.canonicals)if(!t.has(e))return this.column.setTag(o.gp.isHelmCompatible,"false"),!1}}return this.column.setTag(o.gp.isHelmCompatible,"true"),!0}get splitter(){return null===this._splitter&&(this._splitter=this.getSplitter()),this._splitter}toFasta(e){return e===o.Hi.FASTA}toSeparator(e){return e===o.Hi.SEPARATOR}toHelm(e){return e===o.Hi.HELM}convertHelmToFastaSeparator(e,t,n,r){r||(r=this.toFasta(t)?p[o.Hi.FASTA]:p[o.Hi.SEPARATOR]),n||(n=this.toFasta(t)?"":this.separator);const i=e.startsWith("RNA"),s=this.splitter(e),a=[];for(let e=0;e<s.length;++e){let n=s.getOriginal(e);if(i&&(n=n.replace(d.EK,"")),n===p[o.Hi.HELM])a.push(r);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}),r=this.getNewColumn(e,t);return r.init((e=>{const t=this.getSplitted(e);return n(t)})),r}getRegion(e,t,n){const r=this.getNewColumn(this.notation,this.separator);r.name=n;const i=e??0,s=t??this.maxLength-1,a=this.getJoiner(),l=s-i+1,u=p[this.notation];r.init((e=>{const t=this.getSplitted(e),n=new Array(l);for(let e=0;e<l;++e){const r=i+e;n[e]=r<t.length?t.getOriginal(r):u}return a(new c.Mu(n,u))}));const d=e=>{const t=e.split(",").map((e=>e.trim())),n=new Array(l);for(let e=0;e<l;++e){const r=i+e;n[e]=r<t.length?t[r]:"?"}return n.join(o.z1)},h=this.column.getTag(o.gp.positionNames);h&&r.setTag(o.gp.positionNames,d(h));const m=this.column.getTag(o.gp.positionLabels);return m&&r.setTag(o.gp.positionLabels,d(m)),r}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 r;const i=this;switch(t){case o.Hi.FASTA:r=function(e){return i.joinToFasta(e,i.isHelm())};break;case o.Hi.SEPARATOR:if(!n)throw new Error(`Separator is mandatory for notation '${t}'.`);r=function(e){return f(e,n,i.isHelm())};break;case o.Hi.HELM:{const e=i.alphabet===o.YI.DNA||i.alphabet===o.YI.RNA,t=i.getHelmWrappers();r=function(n){return g(n,t,e)};break}default:throw new Error(`Unexpected notation '${t}'.`)}return r}getConverter(e,t=void 0){if(e===o.Hi.SEPARATOR&&!t)throw new Error(`Target separator is not specified for target units '${o.Hi.SEPARATOR}'.`);const n=this;if(e===o.Hi.FASTA)return function(e){return n.convertToFasta(e)};if(e===o.Hi.HELM)return function(e){return n.convertToHelm(e)};if(e===o.Hi.SEPARATOR)return function(e){return n.convertToSeparator(e,t)};throw new Error}static forColumn(e){let t=e.temp[h.seqHandler];return t&&t.columnVersion===e.version||(t=e.temp[h.seqHandler]=new m(e)),t}joinToFasta(e,t){const n=new Array(e.length);for(let r=0;r<e.length;++r){const i=e.getOriginal(r);let s=e.getOriginal(r);t&&(s=s.replace(d.EK,"$1")),i===a._S?s=p[o.Hi.FASTA]:i===d.q7?s="":s.length>1&&(s="["+s+"]"),n[r]=s}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){if(this.notation==o.Hi.HELM)return 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),r=e.startsWith("DNA"),i=e.startsWith("RNA");for(let e=0;e<t.length;++e){let s=t.getOriginal(e);(r||i)&&(s=s.replace(d.EK,"$1"),s=s===d.q7?null:s),n[e]=s||null}return new c.Mu(n.filter((e=>!!e)),p[o.Hi.HELM])}}function f(e,t,n){const r=new Array(e.length);for(let t=0;t<e.length;++t){const i=e.getCanonical(t);let s=e.getOriginal(t);n&&(s=s.replace(d.EK,"$1")),i===a._S?s=p[o.Hi.SEPARATOR]:i===d.q7&&(s=""),r[t]=s}return r.join(t)}function g(e,t,n){const[r,i,s,c]=t,l=new Array(e.length);for(let t=0;t<e.length;++t){const r=e.getCanonical(t);let c=e.getOriginal(t);r===a._S?c=p[o.Hi.HELM]:(n&&(c=c.replace(d.EK,"$1")),c=1===c.length?`${i}${c}${s}`:`${i}[${c}]${s}`),l[t]=c}return`${r}${l.join(".")}${c}`}},8312:(e,t,n)=>{"use strict";n.d(t,{Q:()=>i});var r=n(6082);async function i(){const e=r.Func.find({package:"Bio",name:"getSeqHelper"});if(0===e.length)throw new Error("Package 'Bio' must be installed for SeqHelper.");return(await e[0].prepare().call()).getOutputParamValue()}},3077:(e,t,n)=>{"use strict";n.d(t,{R:()=>s});var r=n(6082),i=n(826);function s(e){const t=e=>{const t=o.columns.addNewString((e+1).toString());return n.push(t),t},n=[],s=e.length,o=r.DataFrame.create(s),a=i.GO.forColumn(e);for(let e=0;e<s;++e){const r=a.getSplitted(e);for(let i=0;i<r.length;++i){const s=r.getOriginal(i);((n[i]??null)||t(i)).set(e,s,!1)}}return o}},7602:(e,t,n)=>{"use strict";n.d(t,{g:()=>s});var r,i=n(9192);!function(e){e[e.error=0]="error",e[e.warning=1]="warning",e[e.info=2]="info",e[e.debug=3]="debug"}(r||(r={}));class s{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[r,s]=(0,i.AP)(t);this.logger.error(`${e}, SYNC syncId = ${n}, ERROR:\n${r}`,void 0,s),this.errors.push(t)}))}resetErrors(){const e=this.errors;return this.errors=[],e}}},4326:(e,t,n)=>{"use strict";n.d(t,{Fo:()=>u,Lp:()=>s,P4:()=>o,fH:()=>i,gp:()=>r,lT:()=>c,mH:()=>a});var r,i,s,o,a,c,l=n(6082);!function(e){e.tooltipWebLogo=".tooltipWebLogo"}(r||(r={})),function(e){e.Entropy="Entropy",e.full="100%"}(i||(i={})),function(e){e.TOP="top",e.MIDDLE="middle",e.BOTTOM="bottom"}(s||(s={})),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"}(c||(c={}));const u=new class{constructor(){this.sequenceColumnName=null,this.valueAggrType=l.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=i.Entropy,this.positionWidth=16,this.verticalAlignment=s.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=c.Filtered}}},5540:(e,t,n)=>{"use strict";e=n.hmd(e);var r,i=(r="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e={}){var t,n,i=void 0!==e?e:{};i.ready=new Promise((function(e,r){t=e,n=r}));var s,o=Object.assign({},i),a="object"==typeof window,c="function"==typeof importScripts,l=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(a||c)&&(c?l=self.location.href:"undefined"!=typeof document&&document.currentScript&&(l=document.currentScript.src),r&&(l=r),l=0!==l.indexOf("blob:")?l.substr(0,l.replace(/[?#].*/,"").lastIndexOf("/")+1):"",c&&(s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)})),i.print||console.log.bind(console);var u,d,h=i.printErr||console.warn.bind(console);Object.assign(i,o),o=null,i.arguments&&i.arguments,i.thisProgram&&i.thisProgram,i.quit&&i.quit,i.wasmBinary&&(u=i.wasmBinary),i.noExitRuntime,"object"!=typeof WebAssembly&&T("no native wasm support detected");var p,m,f,g=!1;function y(){var e=d.buffer;i.HEAP8=p=new Int8Array(e),i.HEAP16=new Int16Array(e),i.HEAP32=new Int32Array(e),i.HEAPU8=m=new Uint8Array(e),i.HEAPU16=new Uint16Array(e),i.HEAPU32=f=new Uint32Array(e),i.HEAPF32=new Float32Array(e),i.HEAPF64=new Float64Array(e)}var w=[],b=[],v=[],A=0,E=null,C=null;function T(e){i.onAbort&&i.onAbort(e),h(e="Aborted("+e+")"),g=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw n(t),t}var S,_;function x(e){return e.startsWith("data:application/octet-stream;base64,")}function P(e){try{if(e==S&&u)return new Uint8Array(u);if(s)return s(e);throw"both async and sync fetching of the wasm failed"}catch(e){T(e)}}function M(e,t,n){return function(e){return u||!a&&!c||"function"!=typeof fetch?Promise.resolve().then((function(){return P(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 P(e)}))}(e).then((function(e){return WebAssembly.instantiate(e,t)})).then((function(e){return e})).then(n,(function(e){h("failed to asynchronously prepare wasm: "+e),T(e)}))}function $(e){for(;e.length>0;)e.shift()(i)}function N(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,p[this.ptr+12|0]=e},this.get_caught=function(){return 0!=p[this.ptr+12|0]},this.set_rethrown=function(e){e=e?1:0,p[this.ptr+13|0]=e},this.get_rethrown=function(){return 0!=p[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(U(this.get_type()))return f[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}function L(e){var t=d.buffer;try{return d.grow(e-t.byteLength+65535>>>16),y(),1}catch(e){}}function I(e){return i["_"+e]}x(S="wasmDbscan.wasm")||(_=S,S=i.locateFile?i.locateFile(_,l):l+_);var R="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function O(e,t,n,r,i){var s={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 r=e.charCodeAt(n);r<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3}return t}(e)+1,n=F(t);return function(e,t,n){!function(e,t,n,r){if(!(r>0))return 0;for(var i=n+r-1,s=0;s<e.length;++s){var o=e.charCodeAt(s);if(o>=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++s)),o<=127){if(n>=i)break;t[n++]=o}else if(o<=2047){if(n+1>=i)break;t[n++]=192|o>>6,t[n++]=128|63&o}else if(o<=65535){if(n+2>=i)break;t[n++]=224|o>>12,t[n++]=128|o>>6&63,t[n++]=128|63&o}else{if(n+3>=i)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,m,t,n)}(e,n,t),n}(e)),t},array:e=>{var t,n,r=F(e.length);return t=e,n=r,p.set(t,n),r}},o=I(e),a=[],c=0;if(r)for(var l=0;l<r.length;l++){var u=s[n[l]];u?(0===c&&(c=H()),a[l]=u(r[l])):a[l]=r[l]}var d=o.apply(null,a);return function(e){return 0!==c&&D(c),function(e){return"string"===t?(n=e)?function(e,t,n){for(var r=t+n,i=t;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&R)return R.decode(e.subarray(t,i));for(var s="";t<i;){var o=e[t++];if(128&o){var a=63&e[t++];if(192!=(224&o)){var c=63&e[t++];if((o=224==(240&o)?(15&o)<<12|a<<6|c:(7&o)<<18|a<<12|c<<6|63&e[t++])<65536)s+=String.fromCharCode(o);else{var l=o-65536;s+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else s+=String.fromCharCode((31&o)<<6|a)}else s+=String.fromCharCode(o)}return s}(m,n,r):"":"boolean"===t?Boolean(e):e;var n,r}(e)}(d)}var k,G={__cxa_throw:function(e,t,n){throw new N(e).init(t,n),e},abort:function(){T("")},emscripten_memcpy_big:function(e,t,n){m.copyWithin(e,t,t+n)},emscripten_resize_heap:function(e){var t,n=m.length,r=2147483648;if((e>>>=0)>r)return!1;for(var i=1;i<=4;i*=2){var s=n*(1+.2/i);if(s=Math.min(s,e+100663296),L(Math.min(r,(t=Math.max(e,s))+(65536-t%65536)%65536)))return!0}return!1}},H=(function(){var e,t,r,s,o={env:G,wasi_snapshot_preview1:G};function a(e,t){var n,r=e.exports;return i.asm=r,d=i.asm.memory,y(),i.asm.__indirect_function_table,n=i.asm.__wasm_call_ctors,b.unshift(n),function(){if(A--,i.monitorRunDependencies&&i.monitorRunDependencies(A),0==A&&(null!==E&&(clearInterval(E),E=null),C)){var e=C;C=null,e()}}(),r}if(A++,i.monitorRunDependencies&&i.monitorRunDependencies(A),i.instantiateWasm)try{return i.instantiateWasm(o,a)}catch(e){h("Module.instantiateWasm callback failed with error: "+e),n(e)}(e=u,t=S,r=o,s=function(e){a(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||x(t)||"function"!=typeof fetch?M(t,r,s):fetch(t,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,r).then(s,(function(e){return h("wasm streaming compile failed: "+e),h("falling back to ArrayBuffer instantiation"),M(t,r,s)}))}))).catch(n)}(),i._dbscan=function(){return(i._dbscan=i.asm.dbscan).apply(null,arguments)},i._malloc=function(){return(i._malloc=i.asm.malloc).apply(null,arguments)},i._free=function(){return(i._free=i.asm.free).apply(null,arguments)},function(){return(H=i.asm.stackSave).apply(null,arguments)}),D=function(){return(D=i.asm.stackRestore).apply(null,arguments)},F=function(){return(F=i.asm.stackAlloc).apply(null,arguments)},U=function(){return(U=i.asm.__cxa_is_pointer_type).apply(null,arguments)};function V(){function e(){k||(k=!0,i.calledRun=!0,g||($(b),t(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),function(){if(i.postRun)for("function"==typeof i.postRun&&(i.postRun=[i.postRun]);i.postRun.length;)e=i.postRun.shift(),v.unshift(e);var e;$(v)}()))}A>0||(function(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)e=i.preRun.shift(),w.unshift(e);var e;$(w)}(),A>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),e()}),1)):e()))}if(i.ccall=O,i.cwrap=function(e,t,n,r){var i=!n||n.every((e=>"number"===e||"boolean"===e));return"string"!==t&&i&&!r?I(e):function(){return O(e,t,n,arguments)}},C=function e(){k||V(),k||(C=e)},i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return V(),e.ready});"object"==typeof exports?e.exports=i:"function"==typeof define&&n.amdO?define([],(function(){return i})):"object"==typeof exports&&(exports.exportCppDbscanLib=i)},6295:(e,t,n)=>{"use strict";n.d(t,{$1:()=>a,Hr:()=>C,Ii:()=>m,T6:()=>E,TK:()=>v,a4:()=>h,be:()=>p,gt:()=>y,iS:()=>o,ij:()=>w,lO:()=>d,lP:()=>g,rR:()=>f,tO:()=>c,v_:()=>l,yK:()=>b,zn:()=>u});var r=n(8774),i=n(8498),s=n(6863);i.aT.Tanimoto,i.aT.Dice,i.aT.Asymmetric,i.aT.BraunBlanquet,i.aT.Cosine,i.aT.Kulczynski,i.aT.McConnaughey,i.aT.RogotGoldberg,i.aT.Russel,i.aT.Sokal,i.aT.Hamming,i.aT.Euclidean,i.aT.Tanimoto,i.aT.Dice,i.aT.Asymmetric,i.aT.BraunBlanquet,i.aT.Cosine,i.aT.Kulczynski,i.aT.McConnaughey,i.aT.RogotGoldberg,i.aT.Russel,i.aT.Sokal,i.aT.Hamming,i.aT.Euclidean;const o=[i.aT.Tanimoto,i.aT.Dice,i.aT.Cosine];function a(e,t){const n=e.trueCount()+t.trueCount();if(0==n)return 1;const r=e.andWithCountBits(t,!0);return r/(n-r)}function c(e,t){return 1-a(e,t)}function l(e,t){return A(a(new r.A(e,32*e.length),new r.A(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 d(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 h(e,t){return Math.sqrt(e.trueCount()+t.trueCount()-2*e.andWithCountBits(t,!0))}function p(e,t){return e.trueCount()+t.trueCount()-2*e.andWithCountBits(t,!0)}function m(e,t){return 1-function(e,t){const n=e.trueCount()+t.trueCount(),r=e.andWithCountBits(t,!0);return r/(2*n-3*r)}(e,t)}function f(e,t){return A(function(e,t){const n=e.trueCount()+t.trueCount(),r=e.trueCount()*t.trueCount();return 0==r?0:e.andWithCountBits(t,!0)*n/(2*r)}(e,t))}function g(e,t){return A(function(e,t){const n=e.trueCount()+t.trueCount(),r=e.trueCount()*t.trueCount();return 0==r?0:(e.andWithCountBits(t,!0)*n-r)/r}(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 A(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 A(function(e,t){return 0==e.length?0:e.andWithCountBits(t,!0)/e.length}(e,t))}function v(e,t){return A(function(e,t){const n=e.andWithCountBits(t,!0),r=e.countBits(!0)+t.countBits(!0),i=e.length,s=i-r+n;return n==i||s==i?1:n/r+s/(2*i-r)}(e,t))}function A(e){return 0===e?3402823e32:1/e-1}function E(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 C(e){const t=function(e){const t=e?.mostCommon??new Set;return(e,n)=>{const r=e.length,i=n.length;let s=0,o=0,a=0;for(;o<r&&a<i;)e[o]===n[a]?(t?.has(e[o])||++s,++o,++a):e[o]<n[a]?++o:++a;return s}}(e);return(e,n)=>0===n.length||0===e.length?1e4:Math.min(e.length,n.length)/(t(e,n)+1e-4)}i.aT.Tanimoto,i.aT.Asymmetric,i.aT.Cosine,i.aT.Sokal,s.Z.HAMMING,s.Z.LEVENSHTEIN,s.Z.MONOMER_CHEMICAL_DISTANCE,s.Z.NEEDLEMANN_WUNSCH},684:(e,t,n)=>{"use strict";n.d(t,{C0:()=>s,GP:()=>r,Gi:()=>a,YP:()=>l,_X:()=>o,n3:()=>i,vb:()=>c});const r="dim-red-preprocessing-function",i="supportedSemTypes",s="supportedTypes",o="supportedUnits",a="supportedDistanceFunctions",c="bypassLargeDataWarning",l="show-scatterplot-progress"},6863:(e,t,n)=>{"use strict";function r(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,r=Math.min(...Object.keys(t).map((e=>e.charCodeAt(0))))+1,i=new Float32Array((n.length+r)*(n.length+r));return Object.entries(t).forEach((([e,r])=>{const s=n[r];Object.entries(t).forEach((([t,r])=>{i[e.charCodeAt(0)*n.length+t.charCodeAt(0)]=s[r]}))})),(e,t)=>1-i[e.charCodeAt(0)*n.length+t.charCodeAt(0)]}(),n=e?.threshold??0;return(e,r)=>{let i=0;const s=e.length,o=r.length,a=Math.ceil(Math.max(s,o)*(1-n));s!==o&&(i=Math.abs(s-o));let c=0;for(let n=0;n<Math.min(s,o);n++)if(e[n]!==r[n]&&(c+=t(e[n],r[n]),c>a))return 1;return c+=i,c/=Math.max(s,o),c}}n.d(t,{Z:()=>o,V:()=>a});var i=n(2787);const s={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]:r,[o.LEVENSHTEIN]:function(){return(e,t)=>(0,i.I)(e,t)/Math.max(e.length,t.length)},[o.NEEDLEMANN_WUNSCH]:function(e){const t=new Uint16Array(65536),{gapOpen:n,gapExtend:r,scoringMatrix:i,alphabetIndexes:o}={...s,...e};Object.entries(o).forEach((([e,n])=>t[e.charCodeAt(0)]=n));const a=[new Float32Array(1e4),new Float32Array(1e4)];return(e,s)=>{const o=new Array(e.length+1).fill(!1),c=new Array(e.length+1).fill(!1);let l=0,u=1;for(let t=1;t<e.length+1;t++)a[0][t]=-r-(t-1)*r,a[1][t]=0;a[0][0]=0;for(let d=1;d<s.length+1;d++){a[u][0]=-r-(d-1)*r;for(let h=1;h<e.length+1;h++){const p=a[l][h-1]+i[t[e.charCodeAt(h-1)]][t[s.charCodeAt(d-1)]],m=a[l][h]-(o[h]||1===d||d===s.length?r:n),f=a[u][h-1]-(c[h-1]||1===h||h===e.length?r:n);a[u][h]=Math.max(p,f,m),a[u][h]===p?(o[h]=!1,c[h]=!1):a[u][h]===f?(o[h]=!1,c[h]=!0):(o[h]=!0,c[h]=!1)}l=u,u=(u+1)%2}const d=Math.min(e.length,s.length);return(d-a[l][e.length])/d}},[o.MONOMER_CHEMICAL_DISTANCE]:r}},9039:(e,t,n)=>{"use strict";var r;n.d(t,{c:()=>r}),function(e){e.UMAP="UMAP",e.T_SNE="t-SNE"}(r||(r={}))},8498:(e,t,n)=>{"use strict";var r,i,s,o,a,c,l;n.d(t,{EG:()=>a,Pn:()=>i,RR:()=>c,Wn:()=>l,aT:()=>s,m6:()=>o,xL:()=>r}),function(e){e.Levenshtein="Levenshtein",e.JaroWinkler="Jaro-Winkler",e.Manhattan="Manhattan",e.Onehot="One-Hot"}(r||(r={})),function(e){e.Euclidean="Euclidean"}(i||(i={})),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"}(s||(s={})),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"}(c||(c={})),function(e){e.CommonItems="Common Items"}(l||(l={}))},2780:(e,t,n)=>{"use strict";n.d(t,{aT:()=>r.aT});var r=n(8498);n(9336)},9336:(e,t,n)=>{"use strict";var r=n(2787),i=n(944),s=n(6295),o=n(3629),a=n(6863),c=n(8498);const l={[c.Pn.Euclidean]:o.ou},u={[c.xL.Levenshtein]:r.I,[c.xL.JaroWinkler]:i.Vb,[c.xL.Manhattan]:function(e,t){if(e.length!==t.length)return 1;{let n=0;for(let r=1;r<e.length;r++)n+=e[r]==t[r]?0:1;return n/e.length}},[c.xL.Onehot]:function(e,t){return e===t?0:1}},d={[c.aT.Tanimoto]:s.tO,[c.aT.Dice]:s.zn,[c.aT.Asymmetric]:s.gt,[c.aT.BraunBlanquet]:s.ij,[c.aT.Cosine]:s.lO,[c.aT.Kulczynski]:s.rR,[c.aT.McConnaughey]:s.lP,[c.aT.RogotGoldberg]:s.TK,[c.aT.Russel]:s.yK,[c.aT.Sokal]:s.Ii,[c.aT.Hamming]:s.be,[c.aT.Euclidean]:s.a4},h={[c.m6.TanimotoIntArray]:s.v_},p={[c.RR.Difference]:s.T6},m={[c.Wn.CommonItems]:s.Hr},f={[c.EG.Vector]:{[c.Pn.Euclidean]:l[c.Pn.Euclidean]},[c.EG.String]:{[c.xL.Levenshtein]:u[c.xL.Levenshtein],[c.xL.JaroWinkler]:u[c.xL.JaroWinkler],[c.xL.Manhattan]:u[c.xL.Manhattan],[c.xL.Onehot]:u[c.xL.Onehot]},[c.EG.BitArray]:{[c.aT.Tanimoto]:d[c.aT.Tanimoto],[c.aT.Dice]:d[c.aT.Dice],[c.aT.Asymmetric]:d[c.aT.Asymmetric],[c.aT.BraunBlanquet]:d[c.aT.BraunBlanquet],[c.aT.Cosine]:d[c.aT.Cosine],[c.aT.Kulczynski]:d[c.aT.Kulczynski],[c.aT.McConnaughey]:d[c.aT.McConnaughey],[c.aT.RogotGoldberg]:d[c.aT.RogotGoldberg],[c.aT.Russel]:d[c.aT.Russel],[c.aT.Sokal]:d[c.aT.Sokal]},[c.EG.MacroMolecule]:{[a.Z.HAMMING]:a.V[a.Z.HAMMING],[a.Z.LEVENSHTEIN]:a.V[a.Z.LEVENSHTEIN],[a.Z.NEEDLEMANN_WUNSCH]:a.V[a.Z.NEEDLEMANN_WUNSCH],[a.Z.MONOMER_CHEMICAL_DISTANCE]:a.V[a.Z.MONOMER_CHEMICAL_DISTANCE]},[c.EG.Number]:{[c.RR.Difference]:p[c.RR.Difference]},[c.EG.IntArray]:{[c.m6.TanimotoIntArray]:h[c.m6.TanimotoIntArray]},[c.EG.NumberArray]:{[c.Wn.CommonItems]:m[c.Wn.CommonItems]}};Object.keys(f).reduce(((e,t)=>{for(const n of Object.keys(f[t]))e[n]=t;return e}),{})},8774:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});class r{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,i=r._createBuffer(n);if(t)for(let e=0;e<i.length;e++)i[e]=-1;this._data=i,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,r){if(e<t||e>n)throw new Error(`Argument ${r} (${e}) out of range (${t}, ${n})`)}copy(e,t,n){for(let r=0;r<n;r++)t[r]=e[r]}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 r(e._length);n._length=e._length,n._data=r._createBuffer(n._length),n._version=0;const i=e.lengthInInts;for(let r=0;r<i;r++)n._data[r]=e._data[r]&t._data[r];return n}static _createBuffer(e){return new Uint32Array(Math.floor((e+31)/32))}static fromValues(e){const t=new r(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 r(e);for(let r=0;r<e;++r)n.setBit(r,t(r));return n._version=0,n}static fromString(e){return r.fromSeq(e.length,(t=>"1"==e.charAt(t)))}static fromUint32Array(e,t){const n=new r(e);return n._data=t,n}static fromBytes(e){const t=e.length,n=new r(8*t);n._data=new Uint32Array(Math.floor((t+3)/4)),n._length=8*t;let i=0,s=0;for(;t-s>=4;)n._data[i++]=255&e[s]|(255&e[s+1])<<8|(255&e[s+2])<<16|(255&e[s+3])<<24,s+=4;return t-s==3&&(n._data[i]=(255&e[s+2])<<16),t-s==2&&(n._data[i]|=(255&e[s+1])<<8),t-s==1&&(n._data[i]|=255&e[s]),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 r(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,r=this.lengthInInts;for(let e=0;e<r;e++)this._data[e]=n;this.incrementVersion(t)}setIndexes(e,t=!0,n=!0,r=!0){n&&this.setAll(!t,!1);for(const n of e)this.setFast(n,t);this.incrementVersion(r)}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,r=!0,i=!0){if(n&&i&&this.setAll(!t,!1),i)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(r)}getRange(e,t){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length,"to");const n=[];for(let r=e;r<t;++r)n.push(this.getBit(r));return r.fromValues(n)}getRangeAsList(e,t){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length,"to");const n=[];for(let r=e;r<t;++r)n.push(this.getBit(r));return n}setRange(e,t,n,r=!0){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length-1,"to");const i=Math.min(e,t),s=Math.max(e,t);if(n)for(let e=i;e<=s;e++)this.setTrue(e);else for(let e=i;e<=s;e++)this.setFalse(e);return this.incrementVersion(r),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 r=this._length;this.setLength(this._length+t);for(let n=r-1;n>=e;n--)this.setBit(n+t,this.getBit(n));for(let r=e;r<e+t;r++)this.setBit(r,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 r=-1;-1!=(r=e.findNext(r,!t));)this.setFast(n++,this.getBit(r));this._length=n,this._version++}return this}getBit(e){return!!(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+=r._onBitCount[255&e];let n=this._data[t];const i=31&this._length;for(0!=i&&(n&=~(4294967295<<i));0!=n;n>>>=8)this._selectedCount+=r._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 i=this.lengthInInts;let s=0;for(;s<i-1;s++)for(let t=this._data[s]&e._data[s];0!=t;t>>>=8)n+=r._onBitCount[255&t];let o=this._data[s]&e._data[s];const a=31&this._length;for(0!=a&&(o&=~(4294967295<<a));0!=o;o>>>=8)n+=r._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 i=this.lengthInInts;for(let s=Math.floor(e/32);s<i;s++){let i=t?this._data[s]:~this._data[s];if(0!=n)i&=4294967295<<n&4294967295,n=0;else if(!t&&-4294967296==i)continue;for(let t=0;0!=i;t+=8,i>>>=8){const n=r._firstOnBit[255&i];if(n>=0)return(e=n+32*s+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 i=Math.floor(e/32);i>=0;i--){let e=t?this._data[i]:~this._data[i];0!=n&&(e&=~(4294967295<<n),n=0);for(let t=24;0!=e;t-=8,e<<=8){const n=r._lastOnBit[e>>>24];if(n>=0)return n+32*i+t}}return-1}}r._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]),r._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]),r._lastOnBit=Int8Array.from([-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7])},8070:(e,t,n)=>{"use strict";n.d(t,{Pl:()=>H,bk:()=>B,gM:()=>G,L1:()=>k,cb:()=>Y,E3:()=>L,J6:()=>O,Wj:()=>I,Xk:()=>R,N$:()=>F,t6:()=>N,PE:()=>M,rd:()=>$,Bl:()=>K,CN:()=>b});var r=n(4328),i=n(6082);n(9982);const s=i.DataFrame.fromCsv('countries,fasta,smiles,molregno,LON,Zip Code,Street Address Line 1,ImageUrl,user_id,error_message,xray,flag,magnitude,CS-id,pdb_id,accel_a,time_offset,chart,fit,Questions,empty_number,empty_string\nBelgium,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C(=O)OCCCc1cccnc1)c2cccc(c2)C(=O)c3ccccc3,1480014,36.276729583740234,995042300,14016 ROUTE 31W,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,1,1,1QBS,1,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.497360340644872, 1.7058694986686864, 5.278052678195135, 0.16000320889028383],""points"":[{""x"":0.10000000149011612,""y"":2.374499797821045},{""x"":0.6000000238418579,""y"":2.6242473125457764},{""x"":1.100000023841858,""y"":2.367267608642578},{""x"":1.600000023841858,""y"":2.6723148822784424},{""x"":2.0999999046325684,""y"":2.6537344455718994},{""x"":2.5999999046325684,""y"":2.3651671409606934},{""x"":3.0999999046325684,""y"":2.5654284954071045},{""x"":3.5999999046325684,""y"":2.4160959720611572},{""x"":4.099999904632568,""y"":2.286726713180542},{""x"":4.599999904632568,""y"":2.5100042819976807},{""x"":5.099999904632568,""y"":1.6676985025405884},{""x"":5.599999904632568,""y"":0.680136501789093},{""x"":6.099999904632568,""y"":0.3391543924808502},{""x"":6.599999904632568,""y"":0.09038983285427094},{""x"":7.099999904632568,""y"":0.19802775979042053}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[7.525235855508179, 1.3186911876809984, 5.335672608564294, 0.7860743343958098],""points"":[{""x"":0.10000000149011612,""y"":7.988070487976074},{""x"":0.6000000238418579,""y"":7.018453121185303},{""x"":1.100000023841858,""y"":8.115279197692871},{""x"":1.600000023841858,""y"":7.486658096313477},{""x"":2.0999999046325684,""y"":7.396438121795654},{""x"":2.5999999046325684,""y"":7.477052211761475},{""x"":3.0999999046325684,""y"":6.913095474243164},{""x"":3.5999999046325684,""y"":8.01385498046875},{""x"":4.099999904632568,""y"":6.985900402069092},{""x"":4.599999904632568,""y"":6.970335960388184},{""x"":5.099999904632568,""y"":5.448817253112793},{""x"":5.599999904632568,""y"":2.5534818172454834},{""x"":6.099999904632568,""y"":1.893947958946228},{""x"":6.599999904632568,""y"":0.6340042352676392},{""x"":7.099999904632568,""y"":0.8403874039649963}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,100,abc\nBurundi,MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW,COc1ccc2cc(ccc2c1)C(C)C(=O)Oc3ccc(C)cc3OC,1480015,36.276729583740234,995073444,80 STATE HIGHWAY 310,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,2,2,1ZP8,2,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.431460753103398, 2.1691498799246745, 5.266445597102774, 0.7825762827017926],""points"":[{""x"":0.10000000149011612,""y"":4.751083850860596},{""x"":0.6000000238418579,""y"":4.203000068664551},{""x"":1.100000023841858,""y"":4.415858745574951},{""x"":1.600000023841858,""y"":4.68414306640625},{""x"":2.0999999046325684,""y"":4.198400974273682},{""x"":2.5999999046325684,""y"":4.179222106933594},{""x"":3.0999999046325684,""y"":4.638473987579346},{""x"":3.5999999046325684,""y"":4.708553314208984},{""x"":4.099999904632568,""y"":4.291589260101318},{""x"":4.599999904632568,""y"":4.038082599639893},{""x"":5.099999904632568,""y"":3.4349939823150635},{""x"":5.599999904632568,""y"":1.2194708585739136},{""x"":6.099999904632568,""y"":1.1920831203460693},{""x"":6.599999904632568,""y"":0.5352635979652405},{""x"":7.099999904632568,""y"":0.3346920311450958}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.339458017970126, -1.0734184310171178, 4.746332950550934, 0.2482416857595658],""points"":[{""x"":0.10000000149011612,""y"":0.2139337658882141},{""x"":0.6000000238418579,""y"":0.4269562065601349},{""x"":1.100000023841858,""y"":0.2441573292016983},{""x"":1.600000023841858,""y"":0.146635964512825},{""x"":2.0999999046325684,""y"":0.08818462491035461},{""x"":2.5999999046325684,""y"":0.2560656666755676},{""x"":3.0999999046325684,""y"":0.42434045672416687},{""x"":3.5999999046325684,""y"":0.37111231684684753},{""x"":4.099999904632568,""y"":0.5581737160682678},{""x"":4.599999904632568,""y"":1.183590054512024},{""x"":5.099999904632568,""y"":1.5629843473434448},{""x"":5.599999904632568,""y"":2.3211288452148438},{""x"":6.099999904632568,""y"":2.229961633682251},{""x"":6.599999904632568,""y"":2.2560226917266846},{""x"":7.099999904632568,""y"":2.2142398357391357}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCameroon,MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL,COc1ccc2cc(ccc2c1)C(C)C(=O)OCCCc3cccnc3,1480016,36.26095962524414,995153596,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,3,3,2BDJ,3,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.6760652578642325, 0.9046956320756703, 5.651408971856738, 0.07738846012184185],""points"":[{""x"":0.10000000149011612,""y"":4.32425594329834},{""x"":0.6000000238418579,""y"":4.668442249298096},{""x"":1.100000023841858,""y"":4.379785060882568},{""x"":1.600000023841858,""y"":5.0345139503479},{""x"":2.0999999046325684,""y"":4.878653526306152},{""x"":2.5999999046325684,""y"":4.3451313972473145},{""x"":3.0999999046325684,""y"":4.336992263793945},{""x"":3.5999999046325684,""y"":5.037430286407471},{""x"":4.099999904632568,""y"":5.0092692375183105},{""x"":4.599999904632568,""y"":4.151902675628662},{""x"":5.099999904632568,""y"":3.4066951274871826},{""x"":5.599999904632568,""y"":2.3732759952545166},{""x"":6.099999904632568,""y"":1.673728108406067},{""x"":6.599999904632568,""y"":0.48574790358543396},{""x"":7.099999904632568,""y"":0.2783052325248718}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.938395863010111, -1.4658480661392117, 5.462702751996584, 0.3473139023615039],""points"":[{""x"":0.10000000149011612,""y"":0.4941710829734802},{""x"":0.6000000238418579,""y"":0.15323974192142487},{""x"":1.100000023841858,""y"":0.46373432874679565},{""x"":1.600000023841858,""y"":0.3370431363582611},{""x"":2.0999999046325684,""y"":0.5179030299186707},{""x"":2.5999999046325684,""y"":0.27899765968322754},{""x"":3.0999999046325684,""y"":0.22075064480304718},{""x"":3.5999999046325684,""y"":0.5789918899536133},{""x"":4.099999904632568,""y"":0.21169911324977875},{""x"":4.599999904632568,""y"":0.27857646346092224},{""x"":5.099999904632568,""y"":1.0906332731246948},{""x"":5.599999904632568,""y"":1.8520300388336182},{""x"":6.099999904632568,""y"":2.7177059650421143},{""x"":6.599999904632568,""y"":2.8680918216705322},{""x"":7.099999904632568,""y"":3.2413077354431152}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCanada,MMELVLKTIIGPIVVGVVLRIVDKWLNKDK,CC(C(=O)NCCS)c1cccc(c1)C(=O)c2ccccc2,1480017,36.26095962524414,99515,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,4,4,1IAN,4,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[0.8597390975430008, 1.0957625732481946, 5.260537067987958, 0.07974187998177736],""points"":[{""x"":0.10000000149011612,""y"":0.8190152645111084},{""x"":0.6000000238418579,""y"":0.8421689867973328},{""x"":1.100000023841858,""y"":0.8740922212600708},{""x"":1.600000023841858,""y"":0.8924275040626526},{""x"":2.0999999046325684,""y"":0.8249067664146423},{""x"":2.5999999046325684,""y"":0.9327669143676758},{""x"":3.0999999046325684,""y"":0.8522974252700806},{""x"":3.5999999046325684,""y"":0.8174492716789246},{""x"":4.099999904632568,""y"":0.8394647240638733},{""x"":4.599999904632568,""y"":0.7139387726783752},{""x"":5.099999904632568,""y"":0.5561167597770691},{""x"":5.599999904632568,""y"":0.3276226818561554},{""x"":6.099999904632568,""y"":0.12479474395513535},{""x"":6.599999904632568,""y"":0.13006797432899475},{""x"":7.099999904632568,""y"":0.059702079743146896}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.760930219582546, 1.6591793293833013, 4.667155929720851, 0.7858109544121652],""points"":[{""x"":0.10000000149011612,""y"":6.156993389129639},{""x"":0.6000000238418579,""y"":5.236701965332031},{""x"":1.100000023841858,""y"":6.010560512542725},{""x"":1.600000023841858,""y"":5.495512962341309},{""x"":2.0999999046325684,""y"":6.087770462036133},{""x"":2.5999999046325684,""y"":5.79986572265625},{""x"":3.0999999046325684,""y"":5.597546577453613},{""x"":3.5999999046325684,""y"":5.520902156829834},{""x"":4.099999904632568,""y"":5.360654354095459},{""x"":4.599999904632568,""y"":3.5539746284484863},{""x"":5.099999904632568,""y"":1.577236294746399},{""x"":5.599999904632568,""y"":1.0001264810562134},{""x"":6.099999904632568,""y"":0.9305797815322876},{""x"":6.599999904632568,""y"":0.6033638715744019},{""x"":7.099999904632568,""y"":0.4203685522079468}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nColombia,MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN,FC(F)(F)c1ccc(OC2CCNCC2)cc1,1480029,36.3309440612793,995152050,1 COURT HOUSE SQUARE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,5,5,4UJ1,5,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[6.4995088314153655, 2.4270351004539914, 5.178659535348579, 0.625653346241577],""points"":[{""x"":0.10000000149011612,""y"":6.496231555938721},{""x"":0.6000000238418579,""y"":6.42543363571167},{""x"":1.100000023841858,""y"":7.040063858032227},{""x"":1.600000023841858,""y"":6.1115403175354},{""x"":2.0999999046325684,""y"":6.680728435516357},{""x"":2.5999999046325684,""y"":6.406774520874023},{""x"":3.0999999046325684,""y"":6.611269474029541},{""x"":3.5999999046325684,""y"":5.889094352722168},{""x"":4.099999904632568,""y"":6.75344705581665},{""x"":4.599999904632568,""y"":6.361435890197754},{""x"":5.099999904632568,""y"":4.1666975021362305},{""x"":5.599999904632568,""y"":1.172118902206421},{""x"":6.099999904632568,""y"":0.801048994064331},{""x"":6.599999904632568,""y"":0.4640021026134491},{""x"":7.099999904632568,""y"":0.0010357667924836278}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[1.4734381347446401, 1.1649805188074196, 4.82958608866421, 0.09500545496710007],""points"":[{""x"":0.10000000149011612,""y"":1.5279096364974976},{""x"":0.6000000238418579,""y"":1.3559974431991577},{""x"":1.100000023841858,""y"":1.5246378183364868},{""x"":1.600000023841858,""y"":1.5567657947540283},{""x"":2.0999999046325684,""y"":1.4114240407943726},{""x"":2.5999999046325684,""y"":1.4045010805130005},{""x"":3.0999999046325684,""y"":1.4769829511642456},{""x"":3.5999999046325684,""y"":1.4875500202178955},{""x"":4.099999904632568,""y"":1.2991987466812134},{""x"":4.599999904632568,""y"":0.922961413860321},{""x"":5.099999904632568,""y"":0.6520044803619385},{""x"":5.599999904632568,""y"":0.15350978076457977},{""x"":6.099999904632568,""y"":0.1078903079032898},{""x"":6.599999904632568,""y"":0.17276449501514435},{""x"":7.099999904632568,""y"":0.14066608250141144}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCosta Rica,MKSTKEEIQTIKTLLKDSRTAKYHKRLQIVL,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCCc3ccccc3,1480018,36.3309440612793,995084218,4041 SOUTHWESTERN BLVD,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,6,6,2BPW,6,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.4833641843311227, -1.8945978742090062, 4.671127708092568, 0.24159861311815153],""points"":[{""x"":0.10000000149011612,""y"":0.0969524160027504},{""x"":0.6000000238418579,""y"":0.028483040630817413},{""x"":1.100000023841858,""y"":0.22087176144123077},{""x"":1.600000023841858,""y"":0.0068915546871721745},{""x"":2.0999999046325684,""y"":0.4305879771709442},{""x"":2.5999999046325684,""y"":0.44774115085601807},{""x"":3.0999999046325684,""y"":0.45346319675445557},{""x"":3.5999999046325684,""y"":0.2370593100786209},{""x"":4.099999904632568,""y"":0.4657953977584839},{""x"":4.599999904632568,""y"":1.155200719833374},{""x"":5.099999904632568,""y"":2.2294070720672607},{""x"":5.599999904632568,""y"":2.4311530590057373},{""x"":6.099999904632568,""y"":2.33846116065979},{""x"":6.599999904632568,""y"":2.608201026916504},{""x"":7.099999904632568,""y"":2.8136143684387207}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.224573521642033, 1.4454033924198528, 5.6014197746076535, 0.2823216054197577],""points"":[{""x"":0.10000000149011612,""y"":4.95027494430542},{""x"":0.6000000238418579,""y"":5.1754679679870605},{""x"":1.100000023841858,""y"":5.276752948760986},{""x"":1.600000023841858,""y"":5.589294910430908},{""x"":2.0999999046325684,""y"":5.616994857788086},{""x"":2.5999999046325684,""y"":5.120813846588135},{""x"":3.0999999046325684,""y"":5.340766906738281},{""x"":3.5999999046325684,""y"":4.876471042633057},{""x"":4.099999904632568,""y"":4.94999361038208},{""x"":4.599999904632568,""y"":5.162564754486084},{""x"":5.099999904632568,""y"":4.399557590484619},{""x"":5.599999904632568,""y"":2.7977969646453857},{""x"":6.099999904632568,""y"":1.0229872465133667},{""x"":6.599999904632568,""y"":0.48275601863861084},{""x"":7.099999904632568,""y"":0.10408931970596313}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCuba,MHAILRYFIRRLFYHIFYKIYSLISKKHQSLPSDVRQF,COc1ccc2c(c1)c(CC(=O)N3CCCC3C(=O)Oc4ccc(C)cc4OC)c(C)n2C(=O)c5ccc(Cl)cc5,1480019,36.33115768432617,995081928,1227 US HIGHWAY 11,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,7,7,1QBS,7,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.320838679713925, -1.2421619987316728, 4.831325425225256, 0.3236011098403072],""points"":[{""x"":0.10000000149011612,""y"":0.3727470338344574},{""x"":0.6000000238418579,""y"":0.12365014106035233},{""x"":1.100000023841858,""y"":0.48422467708587646},{""x"":1.600000023841858,""y"":0.2264465093612671},{""x"":2.0999999046325684,""y"":0.16821794211864471},{""x"":2.5999999046325684,""y"":0.3879014551639557},{""x"":3.0999999046325684,""y"":0.5470244884490967},{""x"":3.5999999046325684,""y"":0.3419053554534912},{""x"":4.099999904632568,""y"":0.7655120491981506},{""x"":4.599999904632568,""y"":1.2346516847610474},{""x"":5.099999904632568,""y"":2.453336715698242},{""x"":5.599999904632568,""y"":2.9565491676330566},{""x"":6.099999904632568,""y"":3.335299491882324},{""x"":6.599999904632568,""y"":3.240290880203247},{""x"":7.099999904632568,""y"":3.1107218265533447}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.6401853521511094, 1.26211588875013, 5.399028074402744, 0.5089580830068091],""points"":[{""x"":0.10000000149011612,""y"":3.8585598468780518},{""x"":0.6000000238418579,""y"":3.6077206134796143},{""x"":1.100000023841858,""y"":3.855252265930176},{""x"":1.600000023841858,""y"":3.619039297103882},{""x"":2.0999999046325684,""y"":3.839388370513916},{""x"":2.5999999046325684,""y"":3.335283041000366},{""x"":3.0999999046325684,""y"":3.571141481399536},{""x"":3.5999999046325684,""y"":3.4155046939849854},{""x"":4.099999904632568,""y"":3.7316646575927734},{""x"":4.599999904632568,""y"":3.0680155754089355},{""x"":5.099999904632568,""y"":2.891066551208496},{""x"":5.599999904632568,""y"":1.6022753715515137},{""x"":6.099999904632568,""y"":0.7652576565742493},{""x"":6.599999904632568,""y"":0.6875326037406921},{""x"":7.099999904632568,""y"":0.5828871726989746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nItaly,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO[N+](=O)[O-],1480020,36.33115768432617,99502,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,8,8,1ZP8,8,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.293592105923809, 1.3781586549141835, 5.1025898038676605, 0.03493851245291291],""points"":[{""x"":0.10000000149011612,""y"":2.1287283897399902},{""x"":0.6000000238418579,""y"":2.267972230911255},{""x"":1.100000023841858,""y"":2.398442506790161},{""x"":1.600000023841858,""y"":2.5130622386932373},{""x"":2.0999999046325684,""y"":2.3255116939544678},{""x"":2.5999999046325684,""y"":2.127340793609619},{""x"":3.0999999046325684,""y"":2.47259783744812},{""x"":3.5999999046325684,""y"":2.131181478500366},{""x"":4.099999904632568,""y"":2.090421438217163},{""x"":4.599999904632568,""y"":2.02299165725708},{""x"":5.099999904632568,""y"":1.1105059385299683},{""x"":5.599999904632568,""y"":0.4494485855102539},{""x"":6.099999904632568,""y"":0.1375635862350464},{""x"":6.599999904632568,""y"":0.036351121962070465},{""x"":7.099999904632568,""y"":0.1619771122932434}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.953125499439879, 1.2528620255306528, 5.187637440149802, 0.3110348753260886],""points"":[{""x"":0.10000000149011612,""y"":5.6585283279418945},{""x"":0.6000000238418579,""y"":5.911152362823486},{""x"":1.100000023841858,""y"":5.924920082092285},{""x"":1.600000023841858,""y"":5.8469438552856445},{""x"":2.0999999046325684,""y"":5.929472923278809},{""x"":2.5999999046325684,""y"":6.190037727355957},{""x"":3.0999999046325684,""y"":6.236179828643799},{""x"":3.5999999046325684,""y"":6.141019344329834},{""x"":4.099999904632568,""y"":5.295210838317871},{""x"":4.599999904632568,""y"":5.265801906585693},{""x"":5.099999904632568,""y"":3.3722851276397705},{""x"":5.599999904632568,""y"":1.8299226760864258},{""x"":6.099999904632568,""y"":0.32690900564193726},{""x"":6.599999904632568,""y"":0.6274543404579163},{""x"":7.099999904632568,""y"":0.8441857099533081}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nRwanda,MPNSEPASLLELFNSIATQGELVRSLKAGNASK,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO,1480021,36.33137130737305,995037247,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,9,2BDJ,9,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.8209972202654474, 1.3779216716448506, 5.299882228439686, 0.06040645519069608],""points"":[{""x"":0.10000000149011612,""y"":3.7821109294891357},{""x"":0.6000000238418579,""y"":3.542433023452759},{""x"":1.100000023841858,""y"":3.7008674144744873},{""x"":1.600000023841858,""y"":3.717301607131958},{""x"":2.0999999046325684,""y"":4.024452209472656},{""x"":2.5999999046325684,""y"":4.013899326324463},{""x"":3.0999999046325684,""y"":3.945094347000122},{""x"":3.5999999046325684,""y"":3.866621971130371},{""x"":4.099999904632568,""y"":3.7461626529693604},{""x"":4.599999904632568,""y"":3.3454740047454834},{""x"":5.099999904632568,""y"":2.61944317817688},{""x"":5.599999904632568,""y"":0.999405026435852},{""x"":6.099999904632568,""y"":0.46259793639183044},{""x"":6.599999904632568,""y"":0.054134611040353775},{""x"":7.099999904632568,""y"":0.05711187422275543}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.6318079657726035, 1.8495493770000595, 5.391793312471116, 0.17060707587348442],""points"":[{""x"":0.10000000149011612,""y"":5.458079814910889},{""x"":0.6000000238418579,""y"":5.554427146911621},{""x"":1.100000023841858,""y"":5.799983024597168},{""x"":1.600000023841858,""y"":5.364140033721924},{""x"":2.0999999046325684,""y"":5.864485740661621},{""x"":2.5999999046325684,""y"":5.4509806632995605},{""x"":3.0999999046325684,""y"":5.702574729919434},{""x"":3.5999999046325684,""y"":5.7314534187316895},{""x"":4.099999904632568,""y"":5.5123443603515625},{""x"":4.599999904632568,""y"":5.724395751953125},{""x"":5.099999904632568,""y"":4.354506969451904},{""x"":5.599999904632568,""y"":1.7307666540145874},{""x"":6.099999904632568,""y"":0.6305936574935913},{""x"":6.599999904632568,""y"":0.035183437168598175},{""x"":7.099999904632568,""y"":0.7575169205665588}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nSwitzerland,IRVVGRYLIEVWKAAGMDMDKVLFLWSSDEI,CN1CCC(CC1)Oc2ccc(cc2)C(F)(F)F,1480028,36.33137130737305,99504,92-11 179TH PLACE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,10,1IAN,10,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[1.1190255865097471, 2.3163895161544437, 5.4968866182279195, 0.2035204047289052],""points"":[{""x"":0.10000000149011612,""y"":1.1057683229446411},{""x"":0.6000000238418579,""y"":1.1019697189331055},{""x"":1.100000023841858,""y"":1.0818607807159424},{""x"":1.600000023841858,""y"":1.062997817993164},{""x"":2.0999999046325684,""y"":1.046447515487671},{""x"":2.5999999046325684,""y"":1.1217249631881714},{""x"":3.0999999046325684,""y"":1.2166996002197266},{""x"":3.5999999046325684,""y"":1.215477705001831},{""x"":4.099999904632568,""y"":1.0581893920898438},{""x"":4.599999904632568,""y"":1.1747995615005493},{""x"":5.099999904632568,""y"":1.0181127786636353},{""x"":5.599999904632568,""y"":0.5344523191452026},{""x"":6.099999904632568,""y"":0.2569526433944702},{""x"":6.599999904632568,""y"":0.1912207305431366},{""x"":7.099999904632568,""y"":0.15060538053512573}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.1038581025805785, 2.0032224204185245, 5.087602825989163, 0.13277988512492753],""points"":[{""x"":0.10000000149011612,""y"":3.0498509407043457},{""x"":0.6000000238418579,""y"":2.805217742919922},{""x"":1.100000023841858,""y"":3.3415253162384033},{""x"":1.600000023841858,""y"":3.0549843311309814},{""x"":2.0999999046325684,""y"":3.250074863433838},{""x"":2.5999999046325684,""y"":3.0432586669921875},{""x"":3.0999999046325684,""y"":3.265852451324463},{""x"":3.5999999046325684,""y"":2.9475724697113037},{""x"":4.099999904632568,""y"":3.1929898262023926},{""x"":4.599999904632568,""y"":2.7460060119628906},{""x"":5.099999904632568,""y"":1.6175861358642578},{""x"":5.599999904632568,""y"":0.3006608486175537},{""x"":6.099999904632568,""y"":0.3444803059101105},{""x"":6.599999904632568,""y"":0.015537971630692482},{""x"":7.099999904632568,""y"":0.5527358055114746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\n,,,,,,,,,,,,,,,,,,,,,');s.columns.add(i.Column.fromList(i.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var o=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};function a(e,t,n,i,s,a,c,l,u=!0){return o(this,void 0,void 0,(function*(){let d=null;if(yield $(i,(n=>o(this,void 0,void 0,(function*(){let n=null;for(const r of e.viewers)r.type===t&&(n=r);if(!n)throw Error("Viewer hasn't been added");if(yield Promise.resolve(),a&&(yield a(n)),s){const t=null!=l?l:{};t.tv=e,t.viewer=n,d=yield s(t,u)}yield M(r.events.onViewerClosed,(()=>{L(n.subs.some((e=>!e.closed)),!1)}),(()=>n.close()),3e3)}))),(()=>o(this,void 0,void 0,(function*(){c?e.loadLayout(c):yield function(e,t,n){return o(this,void 0,void 0,(function*(){let r;return n?(r=yield e.dataFrame.plot.fromType(t),e.dockManager.dock(r)):r=e.addViewer(t),r}))}(e,t,n)}))),6e4,"TEST_EVENT_ASYNC"),d)return d}))}function c(e,t=!0){return o(this,void 0,void 0,(function*(){const n=e.tv.dataFrame,r=n.clone();Array.from(n.row(0).cells).forEach((e=>e.value=null));const i=n.rowCount<20?Math.floor(n.rowCount/2):10;n.rows.select((e=>e.idx>=0&&e.idx<i)),t&&(yield Y(50));for(let e=i;e<2*i;e++)n.filter.set(e,!1);t&&(yield Y(50)),n.currentRowIdx=1,n.columns.names().slice(0,Math.ceil(n.columns.length/2)).forEach((e=>n.columns.remove(e))),t&&(yield Y(100)),e.tv.dataFrame=r,yield Y(50)}))}function l(e,t=!0){return o(this,void 0,void 0,(function*(){const t=e.tv.dataFrame;setTimeout((()=>t.filter.set(0,!t.filter.get(0))),0)}))}function u(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 r={};return Object.keys(t).filter((e=>"boolean"==typeof t[e])).forEach((e=>r[e]=!t[e])),n.filter((e=>null!==e.choices)).forEach((e=>r[e.name]=e.choices.find((n=>n!==t[e.name])))),e.viewer.setOptions(r),yield Y(300),{layout:e.tv.saveLayout(),savedProps:e.viewer.getOptions().look}}))}function d(e,t=!0){return o(this,void 0,void 0,(function*(){L(JSON.stringify(e.viewer.getOptions().look),JSON.stringify(e.savedProps))}))}var h=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const p=3e4,m=108e5,f=console.log.bind(console),g=console.info.bind(console),y=console.warn.bind(console),w=console.error.bind(console),b={},v="Auto Tests",A="Demo",E="Detectors",C="Core",T={};let S;var _;!function(e){e.notNull=function(e,t){if(null==e)throw new Error(`${null==t?"Value":t} not defined`)}}(_||(_={}));class x{constructor(e,t){this.catchUnhandled=!0,this.report=!1,void 0!==e&&(this.catchUnhandled=e),void 0!==t&&(this.report=t)}}class P{constructor(e,t,n,r){var i;this.category=e,this.name=t,null!=r||(r={}),null!==(i=r.timeout)&&void 0!==i||(r.timeout=p),this.options=r,this.test=()=>h(this,void 0,void 0,(function*(){return new Promise(((e,t)=>h(this,void 0,void 0,(function*(){let r="";try{r=yield n()}catch(e){t(e)}e(r)}))))}))}}function M(e,t,n,r=0,i="timeout"){return h(this,void 0,void 0,(function*(){return new Promise(((s,o)=>{const a=e.subscribe((e=>{try{t(e),s("OK")}catch(e){o(e)}finally{a.unsubscribe(),clearTimeout(c)}})),c=setTimeout((()=>{a.unsubscribe(),o(i)}),r);n()}))}))}function $(e,t,n,r=0,i="timeout"){return h(this,void 0,void 0,(function*(){return new Promise(((s,o)=>{const a=e.subscribe((e=>{t(e).then((()=>{s("OK")})).catch((e=>{o(e)})).finally((()=>{a.unsubscribe(),clearTimeout(c)}))})),c=setTimeout((()=>{a.unsubscribe(),o(i)}),r);n()}))}))}function N(e,t,n){null==b[S]&&(b[S]={}),null==b[S].tests&&(b[S].tests=[]),b[S].tests.push(new P(S,e,t,n))}function L(e,t=!0,n){if(n=n?`${n}, `:"",e!==t)throw new Error(`${n}Expected "${t}", got "${e}"`)}function I(e,t,n=.001,r){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 i=Math.abs(e-t)<n;if(L(i,!0,`${null!=r?r:""} (tolerance = ${n})`),!i)throw new Error(`Expected ${t}, got ${e} (tolerance = ${n})`)}function R(e,t){for(const[n,r]of Object.entries(t)){if(!e.hasOwnProperty(n))throw new Error(`Expected property "${n}" not found`);const t=e[n];if(t instanceof Array&&r instanceof Array)O(t,r);else if(t instanceof Object&&r instanceof Object)R(t,r);else if(Number.isFinite(t)&&Number.isFinite(r))I(t,r);else if(t!=r)throw new Error(`Expected (${r}) for key '${n}', got (${t})`)}}function O(e,t){const n=e.length,r=t.length;if(n!=r)throw new Error(`Arrays are of different length: actual array length is ${n} and expected array length is ${r}`);for(let r=0;r<n;r++)if(e[r]instanceof Array&&t[r]instanceof Array)O(e[r],t[r]);else if(e[r]instanceof Object&&t[r]instanceof Object)R(e[r],t[r]);else if(e[r]!=t[r])throw new Error(`Expected ${t[r]} at position ${r}, got ${e[r]}`)}function k(e,t,n){var r;S=e,t(),b[S]&&(b[S].clear=null===(r=null==n?void 0:n.clear)||void 0===r||r,b[S].timeout=null==n?void 0:n.timeout,b[S].benchmarks=null==n?void 0:n.benchmarks,b[S].stressTests=null==n?void 0:n.stressTests)}function G(e){null==b[S]&&(b[S]={}),b[S].before=e}function H(e){null==b[S]&&(b[S]={}),b[S].after=e}function D(e,t){return e.replace(new RegExp(t.name,"gi"),t.nqName)}function F(e){var t,n,o,a;return h(this,void 0,void 0,(function*(){const c=null===(n=null===(t=r.functions.getCurrentCall())||void 0===t?void 0:t.func)||void 0===n?void 0:n.package;yield function(e){var t,n,o,a;return h(this,void 0,void 0,(function*(){const c=e.id;if(T[c])return;const l=b;if(void 0!==l[v]||void 0!==l[A]||Object.keys(l).find((e=>e.startsWith(v)||e.startsWith(C))))return void(T[c]=!0);if("DevTools"===e.name)for(const e of window.dartTests){const r=e.name.split(/\s*\|\s*!/g);let i=null!==(t=r.pop())&&void 0!==t?t:e.name,s=r.length?C+": "+r.join(": "):C,c=i.split(" | ");i=c[c.length-1],c.unshift(s),c.pop(),s=c.join(": "),void 0===l[s]&&(l[s]={tests:[],clear:!0}),l[s].tests.push(new P(s,i,e.test,{isAggregated:!1,timeout:null!==(o=null===(n=e.options)||void 0===n?void 0:n.timeout)&&void 0!==o?o:p,skipReason:null===(a=e.options)||void 0===a?void 0:a.skipReason}))}const u=[],d=[],m=[],f=yield r.dapi.functions.filter(`package.id = "${c}"`).list(),g=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)|timeout:\s*(\d+)/g);for(const e of f){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 s=t[n].matchAll(g),o={};Array.from(s).forEach((e=>{e[0].startsWith("skip")?o.skip=e[1]:e[0].startsWith("wait")?o.wait=parseInt(e[2]):e[0].startsWith("cat")?o.cat=e[3]:e[0].startsWith("timeout")&&(o.timeout=parseInt(e[4]))}));const a=new P(v,1===t.length?e.name:`${e.name} ${n+1}`,(()=>h(this,void 0,void 0,(function*(){const i=yield r.functions.eval(D(t[n],e));if(o.wait&&(yield Y(o.wait)),"boolean"==typeof i&&!i)throw`Failed: ${t[n]}, expected true, got ${i}`}))),{skipReason:o.skip,timeout:i.Test.isInBenchmark?o.benchmarkTimeout:o.timeout});if(o.cat){const e=v+": "+o.cat;a.category=e,void 0===l[e]&&(l[e]={tests:[],clear:!0}),l[e].tests.push(a)}else u.push(a)}if(n){const t=e.options.demoWait?parseInt(e.options.demoWait):void 0,n=new P(A,e.friendlyName,(()=>h(this,void 0,void 0,(function*(){r.shell.isInDemo=!0,void 0===r.shell.view(i.View.BROWSE)&&(r.shell.v=i.View.createByType(i.View.BROWSE)),yield Y(300),r.shell.clearLastError(),yield e.apply(),yield Y(t||2e3);const n=yield r.shell.lastError;if(n)throw new Error(n);r.shell.isInDemo=!1}))),{skipReason:e.options.demoSkip});d.push(n)}if(e.hasTag("semTypeDetector")){const t=new P(E,e.friendlyName,(()=>h(this,void 0,void 0,(function*(){const t=[];for(const n of s.clone().columns){const r=yield e.apply([n]);t.push(r||n.semType)}L(t.filter((e=>e)).length,1)}))),{skipReason:e.options.skipTest});m.push(t)}}T[c]=!0,u.length&&(l[v]={tests:u,clear:!0}),d.length&&(l[A]={tests:d,clear:!0}),m.length&&(l[E]={tests:m,clear:!1})}))}(c);const l=[];console.log("Running tests"),null!=e||(e={}),null!==(o=(a=e).testContext)&&void 0!==o||(a.testContext=new x),r.shell.clearLastError();const u=function(){const e=[];return console.log=(...t)=>{e.push(...t),f(...t)},console.info=(...t)=>{e.push(...t),g(...t)},console.warn=(...t)=>{e.push(...t),y(...t)},console.error=(...t)=>{e.push(...t),w(...t)},e}();(null==e?void 0:e.stressTest)?yield function(e){var t,n,r,s,o,a;return h(this,void 0,void 0,(function*(){let h=[];for(const[e,i]of Object.entries(b)){let e=null===(t=i.tests)||void 0===t?void 0:t.filter((e=>{var t;return null===(t=e.options)||void 0===t?void 0:t.stressTest}));i.stressTests&&(e=null===(n=i.tests)||void 0===n?void 0:n.filter((e=>{var t,n;return void 0===(null===(t=e.options)||void 0===t?void 0:t.stressTest)||!0===(null===(n=e.options)||void 0===n?void 0:n.stressTest)})));const o=null===(r=i.tests)||void 0===r?void 0:r.every((e=>{var t;return null===(t=e.options)||void 0===t?void 0:t.skipReason}));if(!o)for(let t of null!=e?e:[])null==(null===(s=t.options)||void 0===s?void 0:s.skipReason)&&h.push({test:t,value:i})}h=function(e){const t=e.slice();return t.sort((()=>Math.random()-.5)),t}(h);const p=[];for(let t of h){yield d(t.value.before,null!==(o=e.category)&&void 0!==o?o:"");let n=yield V(t.test,null==e?void 0:e.test,u,i.Test.isInBenchmark?t.value.benchmarkTimeout:t.value.timeout,c.name,e.verbose);n&&p.push(n),console.log(`Test: ${null==N?void 0:N.name}; result: ${n}`),yield d(t.value.after,null!==(a=e.category)&&void 0!==a?a:"")}l.push(...p)}))}(e):yield function(e,t){var n,s,o,a,p,m,b;return h(this,void 0,void 0,(function*(){try{for(const[h,g]of Object.entries(e)){if((null==t?void 0:t.category)&&!h.toLowerCase().startsWith(null==t?void 0:t.category.toLowerCase())||(null===(n=t.exclude)||void 0===n?void 0:n.some((e=>h.startsWith(e)))))continue;f(`Started ${h} category`);const e=null===(s=g.tests)||void 0===s?void 0:s.every((e=>{var t;return null===(t=e.options)||void 0===t?void 0:t.skipReason}));e||(g.beforeStatus=yield d(g.before,null!==(o=t.category)&&void 0!==o?o:""));const y=null!==(a=g.tests)&&void 0!==a?a:[],w=[];if(g.clear)for(let e=0;e<y.length;e++){y[e].options&&void 0===(null===(p=y[e].options)||void 0===p?void 0:p.benchmark)&&(y[e].options||(y[e].options={}),y[e].options.benchmark=null!==(m=g.benchmarks)&&void 0!==m&&m);let n=yield V(y[e],null==t?void 0:t.test,u,i.Test.isInBenchmark?g.benchmarkTimeout:g.timeout,c.name,t.verbose);n&&w.push(n),r.shell.closeAll(),i.Balloon.closeAll()}else for(let e=0;e<y.length;e++){let n=yield V(y[e],null==t?void 0:t.test,u,i.Test.isInBenchmark?g.benchmarkTimeout:g.timeout,c.name,t.verbose);n&&w.push(n)}const v=w.filter((e=>"skipped"!=e.result));e||(g.afterStatus=yield d(g.after,null!==(b=t.category)&&void 0!==b?b:"")),g.afterStatus&&v.push({date:(new Date).toISOString(),logs:"",category:h,name:"after",result:g.afterStatus,success:!1,ms:0,skipped:!1}),g.beforeStatus&&v.push({date:(new Date).toISOString(),logs:"",category:h,name:"before",result:g.beforeStatus,success:!1,ms:0,skipped:!1}),l.push(...v)}}finally{console.log=f,console.info=g,console.warn=y,console.error=w}if(t.testContext.catchUnhandled&&!i.Test.isInBenchmark){yield Y(1e3);const e=yield r.shell.lastError,t={logs:"",date:(new Date).toISOString(),category:"Unhandled exceptions",name:"Exception",result:null!=e?e:"",success:!e,ms:0,skipped:!1};l.push(t),t.package=c.name,null!=r.shell.reportTest?yield r.shell.reportTest("package",t):yield fetch(`${r.dapi.root}/log/tests/package`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(t)})}}))}(b,e);for(let e of l)e.result=e.result.toString().replace(/"/g,"'"),null!=e.logs&&(e.logs=e.logs.toString().replace(/"/g,"'"));return l;function d(e,t){return h(this,void 0,void 0,(function*(){var n=void 0;try{void 0!==e&&(yield W((()=>h(this,void 0,void 0,(function*(){yield e()}))),1e5,`before ${t}: timeout error`))}catch(e){n=yield U(e)}return n}))}}))}function U(e){return h(this,void 0,void 0,(function*(){return`${e.toString()}\n${e.stack?yield i.Logger.translateStackTrace(e.stack):""}`}))}function V(e,t,n,s,o,a){var c,l,u,d,g,y,b,v;return h(this,void 0,void 0,(function*(){let h;n.length=0;let A="package";const E=null!=t&&e.name.toLowerCase()!==t.toLowerCase();let C=(null===(c=e.options)||void 0===c?void 0:c.skipReason)||E,T=E?"skipped":null===(l=e.options)||void 0===l?void 0:l.skipReason;if(i.Test.isInBenchmark&&!(null===(u=e.options)||void 0===u?void 0:u.benchmark))return void f(`SKIPPED: ${e.category} ${e.name} doesnt available in benchmark mode`);C||f(`Started ${e.category} ${e.name}`);const S=Date.now();try{if(C)h={date:(new Date).toISOString(),success:!0,result:T,ms:0,skipped:!0};else{let t=(null===(d=e.options)||void 0===d?void 0:d.timeout)===p&&s?s:null===(g=e.options)||void 0===g?void 0:g.timeout;t=t===p&&i.Test.isInBenchmark?m:t,h={date:(new Date).toISOString(),success:!0,result:null!==(y=yield W(e.test,t))&&void 0!==y?y:"OK",ms:0,skipped:!1}}}catch(e){w(e),h={date:(new Date).toISOString(),success:!1,result:yield U(e),ms:0,skipped:!1}}if((null===(b=e.options)||void 0===b?void 0:b.isAggregated)&&h.result.constructor===i.DataFrame){const e=h.result.col("success");if(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()-S,C||f(`Finished ${e.category} ${e.name} for ${h.ms} ms`),h.category=e.category,h.name=e.name,!E){let t={success:h.success,result:h.result,ms:h.ms,skipped:h.skipped,package:o,category:e.category,name: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)}t.result instanceof i.DataFrame&&(t.result=JSON.stringify(null===(v=t.result)||void 0===v?void 0:v.toJson())||""),null!=r.shell.reportTest?yield r.shell.reportTest(A,t):yield fetch(`${r.dapi.root}/log/tests/${A}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(t)})}return h}))}function Y(e){return h(this,void 0,void 0,(function*(){yield new Promise((t=>setTimeout(t,e)))}))}function B(e,t="Timeout exceeded",n=500,r=50){return h(this,void 0,void 0,(function*(){return new Promise(((i,s)=>{setTimeout((()=>{clearInterval(o),s(new Error(t))}),n);const o=setInterval((()=>{e()&&(clearInterval(o),i())}),r)}))}))}function W(e,t,n="EXECUTION TIMEOUT"){return h(this,void 0,void 0,(function*(){let r=null;const i=new Promise(((e,i)=>{r=setTimeout((()=>{i(n)}),t)}));try{return yield Promise.race([e(),i])}finally{r&&clearTimeout(r)}}))}const j=i.DataFrame.fromColumns([i.Column.fromStrings("col",["val1","val2","val3"])]);function K(e,t,n){var i;return h(this,void 0,void 0,(function*(){const s=null!==(i=null==n?void 0:n.packageName)&&void 0!==i?i:"";(null==n?void 0:n.detectSemanticTypes)&&(yield r.data.detectSemanticTypes(t));const o=r.shell.addTableView(t);try{yield a(o,e,s,r.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(o,e,s,r.events.onViewerAdded,void 0,n.awaitViewer)),(null==n?void 0:n.readOnly)||(yield a(o,e,s,r.events.onViewerAdded,c),(null==n?void 0:n.awaitViewer)&&(yield a(o,e,s,r.events.onViewerAdded,c,n.awaitViewer)));let t=null;t=yield a(o,e,s,r.events.onViewerAdded,u),(null==n?void 0:n.awaitViewer)&&(t=yield a(o,e,s,r.events.onViewerAdded,u,n.awaitViewer)),yield a(o,e,s,r.events.onViewLayoutApplied,d,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,s,r.events.onViewLayoutApplied,d,n.awaitViewer,null==t?void 0:t.layout,{savedProps:null==t?void 0:t.savedProps})),!1!==(null==n?void 0:n.arbitraryDfTest)&&(o.dataFrame=j,yield Y(50),yield a(o,e,s,r.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(o,e,s,r.events.onViewerAdded,void 0,n.awaitViewer))),yield a(o,e,s,r.events.onViewerAdded,l),(null==n?void 0:n.awaitViewer)&&(yield a(o,e,s,r.events.onViewerAdded,l,n.awaitViewer))}finally{}}))}},3629:(e,t,n)=>{"use strict";function r(e=!1,t="Assertion error."){if(!e)throw new Error(t)}function i(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(t)}function s(e,t){if(e.length!=t.length)throw new Error("The dimensionality of the vectors must match");let n=0;for(let r=0;r<e.length;r++)n+=e[r]*t[r];return n}function o(e,t){let n=0;const r=e.length;if(r!==t.length)throw new Error("The dimensionality of the vectors must match");for(let i=0;i<r;++i)n+=Math.pow(e[i]-t[i],2);return Math.sqrt(n)}function a(e){const t=e.length;let n=0,r=0;for(let i=0;i<t;++i)n+=e[i],r+=Math.pow(e[i],2);const i=n/t,s=1/Math.sqrt(r/t-Math.pow(i,2));for(let n=0;n<t;++n)e[n]=(e[n]-i)*s;return e}n.d(t,{KE:()=>s,S8:()=>a,ou:()=>o,vA:()=>r,wQ:()=>i})},1913:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3282),i=n(9029),s=n(1520),o=n(2586),a=n(8708),c=n(2023),l="errorMessage",u=new r.Name("emUsed"),d={required:"missingProperty",dependencies:"property",dependentRequired:"property"},h=/\$\{[^}]+\}/,p=/\$\{([^}]+)\}/g,m=/^""\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:l,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,v=i.strConcat(c.default.instancePath,w.errorPath);function A(e,t){return i.and(r._`${e}.keyword !== ${l}`,r._`!${e}.${u}`,r._`${e}.instancePath === ${v}`,r._`${e}.keyword in ${t}`,r._`${e}.schemaPath.indexOf(${w.errSchemaPath}) === 0`,r._`/^\\/[^\\/]*$/.test(${e}.schemaPath.slice(${w.errSchemaPath.length}))`)}function E(e,t){const r=[];for(const n in e){const e=t[n];h.test(e)&&r.push([n,T(e)])}return n.object(...r)}function C(e){return h.test(e)?new s._Code(s.safeStringify(e).replace(p,((e,t)=>`" + JSON.stringify(${o.getData(t,w)}) + "`)).replace(m,"")):r.stringify(e)}function T(e){return r._`function(){return ${C(e)}}`}n.if(r._`${c.default.errors} > 0`,(()=>{if("object"==typeof b){const[s,o]=function(e){let t,n;for(const r in e){if("properties"===r||"items"===r)continue;const i=e[r];if("object"==typeof i){t||(t={});const e=t[r]={};for(const t in i)e[t]=[]}else n||(n={}),n[r]=[]}return[t,n]}(b);o&&function(i){const s=n.const("emErrors",r.stringify(i)),o=n.const("templates",E(i,g));n.forOf("err",c.default.vErrors,(e=>n.if(A(e,s),(()=>n.code(r._`${s}[${e}.keyword].push(${e})`).assign(r._`${e}.${u}`,!0)))));const{singleError:l}=e;if(l){const e=n.let("message",r._`""`),i=n.let("paramsErrors",r._`[]`);d((t=>{n.if(e,(()=>n.code(r._`${e} += ${"string"==typeof l?l:";"}`))),n.code(r._`${e} += ${h(t)}`),n.assign(i,r._`${i}.concat(${s}[${t}])`)})),a.reportError(t,{message:e,params:r._`{errors: ${i}}`})}else d((e=>a.reportError(t,{message:h(e),params:r._`{errors: ${s}[${e}]}`})));function d(e){n.forIn("key",s,(t=>n.if(r._`${s}[${t}].length`,(()=>e(t)))))}function h(e){return r._`${e} in ${o} ? ${o}[${e}]() : ${y}[${e}]`}}(o),s&&function(e){const i=n.const("emErrors",r.stringify(e)),s=[];for(const t in e)s.push([t,E(e[t],g[t])]);const o=n.const("templates",n.object(...s)),l=n.scopeValue("obj",{ref:d,code:r.stringify(d)}),h=n.let("emPropParams"),p=n.let("emParamsErrors");n.forOf("err",c.default.vErrors,(e=>n.if(A(e,i),(()=>{n.assign(h,r._`${l}[${e}.keyword]`),n.assign(p,r._`${i}[${e}.keyword][${e}.params[${h}]]`),n.if(p,(()=>n.code(r._`${p}.push(${e})`).assign(r._`${e}.${u}`,!0)))})))),n.forIn("key",i,(e=>n.forIn("keyProp",r._`${i}[${e}]`,(s=>{n.assign(p,r._`${i}[${e}][${s}]`),n.if(r._`${p}.length`,(()=>{const i=n.const("tmpl",r._`${o}[${e}] && ${o}[${e}][${s}]`);a.reportError(t,{message:r._`${i} ? ${i}() : ${y}[${e}][${s}]`,params:r._`{errors: ${p}}`})}))}))))}(s),function(e){const{props:s,items:o}=e;if(!s&&!o)return;const d=r._`typeof ${f} == "object"`,h=r._`Array.isArray(${f})`,p=n.let("emErrors");let m,w;const b=n.let("templates");function A(e,t){n.assign(p,r.stringify(e)),n.assign(b,E(e,t))}s&&o?(m=n.let("emChildKwd"),n.if(d),n.if(h,(()=>{A(o,g.items),n.assign(m,r.str`items`)}),(()=>{A(s,g.properties),n.assign(m,r.str`properties`)})),w=r._`[${m}]`):o?(n.if(h),A(o,g.items),w=r._`.items`):s&&(n.if(i.and(d,i.not(h))),A(s,g.properties),w=r._`.properties`),n.forOf("err",c.default.vErrors,(e=>function(e,t,s){n.if(i.and(r._`${e}.keyword !== ${l}`,r._`!${e}.${u}`,r._`${e}.instancePath.indexOf(${v}) === 0`),(()=>{const i=n.scopeValue("pattern",{ref:/^\/([^/]*)(?:\/|$)/,code:r._`new RegExp("^\\\/([^/]*)(?:\\\/|$)")`}),o=n.const("emMatches",r._`${i}.exec(${e}.instancePath.slice(${v}.length))`),a=n.const("emChild",r._`${o} && ${o}[1].replace(/~1/g, "/").replace(/~0/g, "~")`);n.if(r._`${a} !== undefined && ${a} in ${t}`,(()=>s(a)))}))}(e,p,(t=>n.code(r._`${p}[${t}].push(${e})`).assign(r._`${e}.${u}`,!0))))),n.forIn("key",p,(e=>n.if(r._`${p}[${e}].length`,(()=>{a.reportError(t,{message:r._`${e} in ${b} ? ${b}[${e}]() : ${y}${w}[${e}]`,params:r._`{errors: ${p}[${e}]}`}),n.assign(r._`${c.default.vErrors}[${c.default.errors}-1].instancePath`,r._`${v} + "/" + ${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 s="string"==typeof b?b:b._;s&&function(e){const s=n.const("emErrs",r._`[]`);n.forOf("err",c.default.vErrors,(e=>n.if(function(e){return i.and(r._`${e}.keyword !== ${l}`,r._`!${e}.${u}`,i.or(r._`${e}.instancePath === ${v}`,i.and(r._`${e}.instancePath.indexOf(${v}) === 0`,r._`${e}.instancePath[${v}.length] === "/"`)),r._`${e}.schemaPath.indexOf(${w.errSchemaPath}) === 0`,r._`${e}.schemaPath[${w.errSchemaPath}.length] === "/"`)}(e),(()=>n.code(r._`${s}.push(${e})`).assign(r._`${e}.${u}`,!0))))),n.if(r._`${s}.length`,(()=>a.reportError(t,{message:C(e),params:r._`{errors: ${s}}`})))}(s),e.keepErrors||function(){const e=n.const("emErrs",r._`[]`);n.forOf("err",c.default.vErrors,(t=>n.if(r._`!${t}.${u}`,(()=>n.code(r._`${e}.push(${t})`))))),n.assign(c.default.vErrors,e).assign(c.default.errors,r._`${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},7433:(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=t.Ajv2020=void 0;const r=n(4042),i=n(6105),s=n(6653),o=n(9572),a="https://json-schema.org/draft/2020-12/schema";class c extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),i.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(s.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)}}t.Ajv2020=c,e.exports=t=c,e.exports.Ajv2020=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var l=n(2586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var u=n(9029);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=n(3558);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var h=n(4551);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})},3282:(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=t.Ajv=void 0;const r=n(4042),i=n(6144),s=n(6653),o=n(2079),a=["/properties"],c="http://json-schema.org/draft-07/schema";class l extends r.default{_addVocabularies(){super._addVocabularies(),i.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(o,a):o;this.addMetaSchema(e,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}}t.Ajv=l,e.exports=t=l,e.exports.Ajv=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var u=n(2586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=n(9029);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var h=n(3558);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var p=n(4551);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})},1520:(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 r 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=r;class i 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 r&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}function s(e,...t){const n=[e[0]];let r=0;for(;r<t.length;)c(n,t[r]),n.push(e[++r]);return new i(n)}t._Code=i,t.nil=new i(""),t._=s;const o=new i("+");function a(e,...t){const n=[u(e[0])];let r=0;for(;r<t.length;)n.push(o),c(n,t[r]),n.push(o,u(e[++r]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===o){const n=l(e[t-1],e[t+1]);if(void 0!==n){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}(n),new i(n)}function c(e,t){var n;t instanceof i?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(n=t)||"boolean"==typeof n||null===n?n:u(Array.isArray(n)?n.join(","):n))}function l(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof r||'"'!==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 r?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=c,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},t.stringify=function(e){return new i(u(e))},t.safeStringify=u,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new i(`.${e}`):s`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new i(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new i(e.toString())}},9029:(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 r=n(1520),i=n(7845);var s=n(1520);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return s._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return s.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return s.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return s.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return s.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return s.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return s.Name}});var o=n(7845);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 r._Code(">"),GTE:new r._Code(">="),LT:new r._Code("<"),LTE:new r._Code("<="),EQ:new r._Code("==="),NEQ:new r._Code("!=="),NOT:new r._Code("!"),OR:new r._Code("||"),AND:new r._Code("&&"),ADD:new r._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class c extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){const n=e?i.varKinds.var:this.varKind,r=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${r};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=N(this.rhs,e,t)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}}class l 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 r.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=N(this.rhs,e,t),this}get names(){return $(this.lhs instanceof r.Name?{}:{...this.lhs.names},this.rhs)}}class u extends l{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class d extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class h extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class p extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class m 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=N(this.code,e,t),this}get names(){return this.code instanceof r._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 r=n.length;for(;r--;){const i=n[r];i.optimizeNames(e,t)||(L(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>M(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=N(this.condition,e,t),this}get names(){const e=super.names;return $(e,this.condition),this.else&&M(e,this.else.names),e}}b.kind="if";class v extends g{}v.kind="for";class A extends v{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=N(this.iteration,e,t),this}get names(){return M(super.names,this.iteration.names)}}class E extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){const t=e.es5?i.varKinds.var:this.varKind,{name:n,from:r,to:s}=this;return`for(${t} ${n}=${r}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){const e=$(super.names,this.from);return $(e,this.to)}}class C extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}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=N(this.iterable,e,t),this}get names(){return M(super.names,this.iterable.names)}}class T 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)}}T.kind="func";class S extends f{render(e){return"return "+super.render(e)}}S.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,r;return super.optimizeNames(e,t),null===(n=this.catch)||void 0===n||n.optimizeNames(e,t),null===(r=this.finally)||void 0===r||r.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&M(e,this.catch.names),this.finally&&M(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 M(e,t){for(const n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function $(e,t){return t instanceof r._CodeOrName?M(e,t.names):e}function N(e,t,n){return e instanceof r.Name?s(e):(i=e)instanceof r._Code&&i._items.some((e=>e instanceof r.Name&&1===t[e.str]&&void 0!==n[e.str]))?new r._Code(e._items.reduce(((e,t)=>(t instanceof r.Name&&(t=s(t)),t instanceof r._Code?e.push(...t._items):e.push(t),e)),[])):e;var i;function s(e){const r=n[e.str];return void 0===r||1!==t[e.str]?e:(delete t[e.str],r)}}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:r._`!${G(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 i.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,r){const i=this._scope.toName(t);return void 0!==n&&r&&(this._constants[i.str]=n),this._leafNode(new c(e,i,n)),i}const(e,t,n){return this._def(i.varKinds.const,e,t,n)}let(e,t,n){return this._def(i.varKinds.let,e,t,n)}var(e,t,n){return this._def(i.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new l(e,t,n))}add(e,n){return this._leafNode(new u(e,t.operators.ADD,n))}code(e){return"function"==typeof e?e():e!==r.nil&&this._leafNode(new m(e)),this}object(...e){const t=["{"];for(const[n,i]of e)t.length>1&&t.push(","),t.push(n),(n!==i||this.opts.es5)&&(t.push(":"),(0,r.addCodeArg)(t,i));return t.push("}"),new r._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 A(e),t)}forRange(e,t,n,r,s=(this.opts.es5?i.varKinds.var:i.varKinds.let)){const o=this._scope.toName(e);return this._for(new E(s,o,t,n),(()=>r(o)))}forOf(e,t,n,s=i.varKinds.const){const o=this._scope.toName(e);if(this.opts.es5){const e=t instanceof r.Name?t:this.var("_arr",t);return this.forRange("_i",0,r._`${e}.length`,(t=>{this.var(o,r._`${e}[${t}]`),n(o)}))}return this._for(new C("of",s,o,t),(()=>n(o)))}forIn(e,t,n,s=(this.opts.es5?i.varKinds.var:i.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,r._`Object.keys(${t})`,n);const o=this._scope.toName(e);return this._for(new C("in",s,o,t),(()=>n(o)))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new d(e))}break(e){return this._leafNode(new h(e))}return(e){const t=new S;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(S)}try(e,t,n){if(!t&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');const r=new _;if(this._blockNode(r),this.code(e),t){const e=this.name("e");this._currNode=r.catch=new x(e),t(e)}return n&&(this._currNode=r.finally=new P,this.code(n)),this._endBlockNode(x,P)}throw(e){return this._leafNode(new p(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=r.nil,n,i){return this._blockNode(new T(e,t,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(T)}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=k(t.operators.AND);t.and=function(...e){return e.reduce(R)};const O=k(t.operators.OR);function k(e){return(t,n)=>t===r.nil?n:n===r.nil?t:r._`${G(t)} ${e} ${G(n)}`}function G(e){return e instanceof r.Name?e:r._`(${e})`}t.or=function(...e){return e.reduce(O)}},7845:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const r=n(1520);class i extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var s;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(s||(t.UsedValueState=s={})),t.varKinds={const:new r.Name("const"),let:new r.Name("let"),var:new r.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof r.Name?e:this.name(e)}name(e){return new r.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 r.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=r._`.${new r.Name(t)}[${n}]`}}t.ValueScopeName=a;const c=r._`\n`;t.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?c:r.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 r=this.toName(e),{prefix:i}=r,s=null!==(n=t.key)&&void 0!==n?n:t.ref;let o=this._values[i];if(o){const e=o.get(s);if(e)return e}else o=this._values[i]=new Map;o.set(s,r);const a=this._scope[i]||(this._scope[i]=[]),c=a.length;return a[c]=t.ref,r.setValue(t,{property:i,itemIndex:c}),r}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 r._`${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 c=r.nil;for(const l in e){const u=e[l];if(!u)continue;const d=o[l]=o[l]||new Map;u.forEach((e=>{if(d.has(e))return;d.set(e,s.Started);let o=n(e);if(o){const n=this.opts.es5?t.varKinds.var:t.varKinds.const;c=r._`${c}${n} ${e} = ${o};${this.opts._n}`}else{if(!(o=null==a?void 0:a(e)))throw new i(e);c=r._`${c}${o}${this.opts._n}`}d.set(e,s.Completed)}))}return c}}},8708:(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 r=n(9029),i=n(4227),s=n(2023);function o(e,t){const n=e.const("err",t);e.if(r._`${s.default.vErrors} === null`,(()=>e.assign(s.default.vErrors,r._`[${n}]`)),r._`${s.default.vErrors}.push(${n})`),e.code(r._`${s.default.errors}++`)}function a(e,t){const{gen:n,validateName:i,schemaEnv:s}=e;s.$async?n.throw(r._`new ${e.ValidationError}(${t})`):(n.assign(r._`${i}.errors`,t),n.return(!1))}t.keywordError={message:({keyword:e})=>r.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?r.str`"${e}" keyword must be ${t} ($data)`:r.str`"${e}" keyword is invalid ($data)`},t.reportError=function(e,n=t.keywordError,i,s){const{it:c}=e,{gen:u,compositeRule:d,allErrors:h}=c,p=l(e,n,i);(null!=s?s:d||h)?o(u,p):a(c,r._`[${p}]`)},t.reportExtraError=function(e,n=t.keywordError,r){const{it:i}=e,{gen:c,compositeRule:u,allErrors:d}=i;o(c,l(e,n,r)),u||d||a(i,s.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(s.default.errors,t),e.if(r._`${s.default.vErrors} !== null`,(()=>e.if(t,(()=>e.assign(r._`${s.default.vErrors}.length`,t)),(()=>e.assign(s.default.vErrors,null)))))},t.extendErrors=function({gen:e,keyword:t,schemaValue:n,data:i,errsCount:o,it:a}){if(void 0===o)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",o,s.default.errors,(o=>{e.const(c,r._`${s.default.vErrors}[${o}]`),e.if(r._`${c}.instancePath === undefined`,(()=>e.assign(r._`${c}.instancePath`,(0,r.strConcat)(s.default.instancePath,a.errorPath)))),e.assign(r._`${c}.schemaPath`,r.str`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign(r._`${c}.schema`,n),e.assign(r._`${c}.data`,i))}))};const c={keyword:new r.Name("keyword"),schemaPath:new r.Name("schemaPath"),params:new r.Name("params"),propertyName:new r.Name("propertyName"),message:new r.Name("message"),schema:new r.Name("schema"),parentSchema:new r.Name("parentSchema")};function l(e,t,n){const{createErrors:i}=e.it;return!1===i?r._`{}`:function(e,t,n={}){const{gen:i,it:o}=e,a=[u(o,n),d(e,n)];return function(e,{params:t,message:n},i){const{keyword:o,data:a,schemaValue:l,it:u}=e,{opts:d,propertyName:h,topSchemaRef:p,schemaPath:m}=u;i.push([c.keyword,o],[c.params,"function"==typeof t?t(e):t||r._`{}`]),d.messages&&i.push([c.message,"function"==typeof n?n(e):n]),d.verbose&&i.push([c.schema,l],[c.parentSchema,r._`${p}${m}`],[s.default.data,a]),h&&i.push([c.propertyName,h])}(e,t,a),i.object(...a)}(e,t,n)}function u({errorPath:e},{instancePath:t}){const n=t?r.str`${e}${(0,i.getErrorPath)(t,i.Type.Str)}`:e;return[s.default.instancePath,(0,r.strConcat)(s.default.instancePath,n)]}function d({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:s}){let o=s?t:r.str`${t}/${e}`;return n&&(o=r.str`${o}${(0,i.getErrorPath)(n,i.Type.Str)}`),[c.schemaPath,o]}},3835:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const r=n(9029),i=n(3558),s=n(2023),o=n(6939),a=n(4227),c=n(2586);class l{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=h.call(this,e);if(t)return t;const n=(0,o.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:a,lines:l}=this.opts.code,{ownProperties:u}=this.opts,d=new r.CodeGen(this.scope,{es5:a,lines:l,ownProperties:u});let p;e.$async&&(p=d.scopeValue("Error",{ref:i.default,code:r._`require("ajv/dist/runtime/validation_error").default`}));const m=d.scopeName("validate");e.validateName=m;const f={gen:d,allErrors:this.opts.allErrors,data:s.default.data,parentData:s.default.parentData,parentDataProperty:s.default.parentDataProperty,dataNames:[s.default.data],dataPathArr:[r.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:d.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,r.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:r.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:r._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(e),(0,c.validateFunctionCode)(f),d.optimize(this.opts.code.optimize);const t=d.toString();g=`${d.scopeRefs(s.default.scope)}return ${t}`,this.opts.code.process&&(g=this.opts.code.process(g,e));const n=new Function(`${s.default.self}`,`${s.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{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:m,validateCode:t,scopeValues:d._values}),this.opts.unevaluated){const{props:e,items:t}=f;n.evaluated={props:e instanceof r.Name?void 0:e,items:t instanceof r.Name?void 0:t,dynamicProps:e instanceof r.Name,dynamicItems:t instanceof r.Name},n.source&&(n.source.evaluated=(0,r.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 d(e){return(0,o.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:u.call(this,e)}function h(e){for(const r of this._compilations)if(n=e,(t=r).schema===n.schema&&t.root===n.root&&t.baseId===n.baseId)return r;var t,n}function p(e,t){let n;for(;"string"==typeof(n=this.refs[t]);)t=n;return n||this.schemas[t]||m.call(this,e,t)}function m(e,t){const n=this.opts.uriResolver.parse(t),r=(0,o._getFullPath)(this.opts.uriResolver,n);let i=(0,o.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===i)return g.call(this,n,e);const s=(0,o.normalizeId)(r),a=this.refs[s]||this.schemas[s];if("string"==typeof a){const t=m.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),s===(0,o.normalizeId)(t)){const{schema:t}=a,{schemaId:n}=this.opts,r=t[n];return r&&(i=(0,o.resolveUrl)(this.opts.uriResolver,i,r)),new l({schema:t,schemaId:n,root:e,baseId:i})}return g.call(this,n,a)}}t.SchemaEnv=l,t.compileSchema=u,t.resolveRef=function(e,t,n){var r;n=(0,o.resolveUrl)(this.opts.uriResolver,t,n);const i=e.refs[n];if(i)return i;let s=p.call(this,e,n);if(void 0===s){const i=null===(r=e.localRefs)||void 0===r?void 0:r[n],{schemaId:o}=this.opts;i&&(s=new l({schema:i,schemaId:o,root:e,baseId:t}))}return void 0!==s?e.refs[n]=d.call(this,s):void 0},t.getCompilingSchema=h,t.resolveSchema=m;const f=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function g(e,{baseId:t,schema:n,root:r}){var i;if("/"!==(null===(i=e.fragment)||void 0===i?void 0:i[0]))return;for(const r of e.fragment.slice(1).split("/")){if("boolean"==typeof n)return;const e=n[(0,a.unescapeFragment)(r)];if(void 0===e)return;const i="object"==typeof(n=e)&&n[this.opts.schemaId];!f.has(r)&&i&&(t=(0,o.resolveUrl)(this.opts.uriResolver,t,i))}let s;if("boolean"!=typeof n&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){const e=(0,o.resolveUrl)(this.opts.uriResolver,t,n.$ref);s=m.call(this,r,e)}const{schemaId:c}=this.opts;return s=s||new l({schema:n,schemaId:c,root:r,baseId:t}),s.schema!==s.root.schema?s:void 0}},2023:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={data:new r.Name("data"),valCxt:new r.Name("valCxt"),instancePath:new r.Name("instancePath"),parentData:new r.Name("parentData"),parentDataProperty:new r.Name("parentDataProperty"),rootData:new r.Name("rootData"),dynamicAnchors:new r.Name("dynamicAnchors"),vErrors:new r.Name("vErrors"),errors:new r.Name("errors"),this:new r.Name("this"),self:new r.Name("self"),scope:new r.Name("scope"),json:new r.Name("json"),jsonPos:new r.Name("jsonPos"),jsonLen:new r.Name("jsonLen"),jsonPart:new r.Name("jsonPart")};t.default=i},4551:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(6939);class i extends Error{constructor(e,t,n,i){super(i||`can't resolve reference ${n} from id ${t}`),this.missingRef=(0,r.resolveUrl)(e,t,n),this.missingSchema=(0,r.normalizeId)((0,r.getFullPath)(e,this.missingRef))}}t.default=i},6939:(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 r=n(4227),i=n(2017),s=n(7106),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?!c(e):!!t&&l(e)<=t)};const a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function c(e){for(const t in e){if(a.has(t))return!0;const n=e[t];if(Array.isArray(n)&&n.some(c))return!0;if("object"==typeof n&&c(n))return!0}return!1}function l(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,r.eachItem)(e[n],(e=>t+=l(e))),t===1/0))return 1/0}return t}function u(e,t="",n){!1!==n&&(t=p(t));const r=e.parse(t);return d(e,r)}function d(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=u,t._getFullPath=d;const h=/#\/?$/;function p(e){return e?e.replace(h,""):""}t.normalizeId=p,t.resolveUrl=function(e,t,n){return n=p(n),e.resolve(t,n)};const m=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:n,uriResolver:r}=this.opts,o=p(e[n]||t),a={"":o},c=u(r,o,!1),l={},d=new Set;return s(e,{allKeys:!0},((e,t,r,i)=>{if(void 0===i)return;const s=c+t;let o=a[i];function u(t){const n=this.opts.uriResolver.resolve;if(t=p(o?n(o,t):t),d.has(t))throw f(t);d.add(t);let r=this.refs[t];return"string"==typeof r&&(r=this.refs[r]),"object"==typeof r?h(e,r.schema,t):t!==p(s)&&("#"===t[0]?(h(e,l[t],t),l[t]=e):this.refs[t]=s),t}function g(e){if("string"==typeof e){if(!m.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})),l;function h(e,t,n){if(void 0!==t&&!i(e,t))throw f(n)}function f(e){return new Error(`reference "${e}" resolves to more than one schema`)}}},396:(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:{}}}},4227:(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 r=n(9029),i=n(1520);function s(e,t=e.schema){const{opts:n,self:r}=e;if(!n.strictSchema)return;if("boolean"==typeof t)return;const i=r.RULES.keywords;for(const n in t)i[n]||m(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 c(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function l({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:i}){return(s,o,a,c)=>{const l=void 0===a?o:a instanceof r.Name?(o instanceof r.Name?e(s,o,a):t(s,o,a),a):o instanceof r.Name?(t(s,a,o),o):n(o,a);return c!==r.Name||l instanceof r.Name?l:i(s,l)}}function u(e,t){if(!0===t)return e.var("props",!0);const n=e.var("props",r._`{}`);return void 0!==t&&d(e,n,t),n}function d(e,t,n){Object.keys(n).forEach((n=>e.assign(r._`${t}${(0,r.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||(s(e,t),!o(t,e.self.RULES.all))},t.checkUnknownRules=s,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,i,s){if(!s){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return r._`${n}`}return r._`${e}${t}${(0,r.getProperty)(i)}`},t.unescapeFragment=function(e){return c(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(a(e))},t.escapeJsonPointer=a,t.unescapeJsonPointer=c,t.eachItem=function(e,t){if(Array.isArray(e))for(const n of e)t(n);else t(e)},t.mergeEvaluated={props:l({mergeNames:(e,t,n)=>e.if(r._`${n} !== true && ${t} !== undefined`,(()=>{e.if(r._`${t} === true`,(()=>e.assign(n,!0)),(()=>e.assign(n,r._`${n} || {}`).code(r._`Object.assign(${n}, ${t})`)))})),mergeToName:(e,t,n)=>e.if(r._`${n} !== true`,(()=>{!0===t?e.assign(n,!0):(e.assign(n,r._`${n} || {}`),d(e,n,t))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:u}),items:l({mergeNames:(e,t,n)=>e.if(r._`${n} !== true && ${t} !== undefined`,(()=>e.assign(n,r._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`))),mergeToName:(e,t,n)=>e.if(r._`${n} !== true`,(()=>e.assign(n,!0===t||r._`${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=d;const h={};var p;function m(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:h[t.code]||(h[t.code]=new i._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(p||(t.Type=p={})),t.getErrorPath=function(e,t,n){if(e instanceof r.Name){const i=t===p.Num;return n?i?r._`"[" + ${e} + "]"`:r._`"['" + ${e} + "']"`:i?r._`"/" + ${e}`:r._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,r.getProperty)(e).toString():"/"+a(e)},t.checkStrictMode=m},7887:(e,t)=>{"use strict";function n(e,t){return t.rules.some((t=>r(e,t)))}function r(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},r){const i=t.RULES.types[r];return i&&!0!==i&&n(e,i)},t.shouldUseGroup=n,t.shouldUseRule=r},8727:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const r=n(8708),i=n(9029),s=n(2023),o={message:"boolean schema is false"};function a(e,t){const{gen:n,data:i}=e,s={gen:n,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,r.reportError)(s,o,void 0,t)}t.topBoolOrEmptySchema=function(e){const{gen:t,schema:n,validateName:r}=e;!1===n?a(e,!1):"object"==typeof n&&!0===n.$async?t.return(s.default.data):(t.assign(i._`${r}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){const{gen:n,schema:r}=e;!1===r?(n.var(t,!1),a(e)):n.var(t,!0)}},208:(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 r=n(396),i=n(7887),s=n(8708),o=n(9029),a=n(4227);var c;function l(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(r.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"}(c||(t.DataType=c={})),t.getSchemaTypes=function(e){const t=l(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=l,t.coerceAndCheckDataType=function(e,t){const{gen:n,data:r,opts:s}=e,a=function(e,t){return t?e.filter((e=>u.has(e)||"array"===t&&"array"===e)):[]}(t,s.coerceTypes),l=t.length>0&&!(0===a.length&&1===t.length&&(0,i.schemaHasRulesForType)(e,t[0]));if(l){const i=h(t,r,s.strictNumbers,c.Wrong);n.if(i,(()=>{a.length?function(e,t,n){const{gen:r,data:i,opts:s}=e,a=r.let("dataType",o._`typeof ${i}`),c=r.let("coerced",o._`undefined`);"array"===s.coerceTypes&&r.if(o._`${a} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,(()=>r.assign(i,o._`${i}[0]`).assign(a,o._`typeof ${i}`).if(h(t,i,s.strictNumbers),(()=>r.assign(c,i))))),r.if(o._`${c} !== undefined`);for(const e of n)(u.has(e)||"array"===e&&"array"===s.coerceTypes)&&l(e);function l(e){switch(e){case"string":return void r.elseIf(o._`${a} == "number" || ${a} == "boolean"`).assign(c,o._`"" + ${i}`).elseIf(o._`${i} === null`).assign(c,o._`""`);case"number":return void r.elseIf(o._`${a} == "boolean" || ${i} === null
|
|
1
|
+
var bio_test;(()=>{var e={8924:(e,t,n)=>{"use strict";n.d(t,{X:()=>i});var r=n(7362);class i extends r.e{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,i)),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,i)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new i({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 i.aaSynonyms?i.aaSynonyms[e]:e;return super.get(t)}}i.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class s{static getPalette(e="grok"){switch(e){case"grok":return i.GrokGroups;case"lesk":return i.Lesk;default:throw new Error(`ChemPalette: scheme \`${e}\` does not exist`)}}static getInnerOuter(e){let t=0,n="",r="";for(const i of e)"("==i?t++:")"==i?t--:t?n+=i:r+=i;return isNaN(parseInt(n))?[r,n]:[r,""]}static getColorAAPivot(e="",t="grok"){const n=this.getPalette(t);let[r,i]=this.getInnerOuter(e);if(r=r.length>6?`${r.slice(0,3)}...`:r,i=i.length>6?`${i.slice(0,3)}...`:i,1==e.length||"("==e[1]){const t=e[0]?.toUpperCase();return t in n?[n.get(t),t,i,1]:[this.undefinedColor,r,i,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,i,2]:[this.undefinedColor,r,i,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,i,3]:[this.undefinedColor,r,i,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,i,4]:[this.undefinedColor,r,i,4]}return[this.undefinedColor,r,i,0]}}s.SemType="Aminoacids",s.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",s.undefinedColor="rgb(100,100,100)",s.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"},s.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"},s.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(*)*"},s.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"}},6717:(e,t,n)=>{"use strict";n.d(t,{j:()=>i});var r=n(6082);async function i(){const e=r.Func.find({package:"Chem",name:"getRdKitModule"});if(0===e.length)throw new Error('Package "Chem" must be installed for getRdKitModule.');return(await e[0].prepare().call()).getOutputParamValue()}},9124:(e,t,n)=>{"use strict";n.d(t,{b:()=>s});var r=n(7389),i=n(6082);async function s(){const e="Helm",t=i.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()}i.JsInputBase,r.input.helmAsync=async function(e,t){return(await s()).createHelmInput(e,t)}},4356:(e,t,n)=>{"use strict";n.d(t,{Es:()=>a,Eu:()=>u,so:()=>s,ub:()=>l,yZ:()=>d});var r=n(4328);const i="Libraries",s="System:AppData/Bio/monomer-libraries/",o={explicit:["HELMCoreLibrary.json","polytool-lib.json"],exclude:[],duplicateMonomerPreferences:{}},a="System:AppData/Bio/monomer-sets/";let c=Promise.resolve();async function l(){let e;return c=c.then((async()=>{const t=await r.dapi.userDataStorage.getValue(i,"Settings",!0);e=t?JSON.parse(t):{exclude:[],explicit:[],duplicateMonomerPreferences:{}},e.exclude=e.exclude instanceof Array?e.exclude:[],e.explicit=e.explicit instanceof Array?e.explicit:[],e.duplicateMonomerPreferences=e.duplicateMonomerPreferences instanceof Object?e.duplicateMonomerPreferences:{},console.debug(`Bio: getUserLibSettings()\n${JSON.stringify(e,void 0,2)}`)})),await c,e}async function u(e){c=c.then((async()=>{console.debug(`Bio: setUserLibSettings()\n${JSON.stringify(e,void 0,2)}`),await r.dapi.userDataStorage.postValue(i,"Settings",JSON.stringify(e),!0)})),await c}async function d(){await u(o)}},6718:(e,t,n)=>{"use strict";n.d(t,{A7:()=>d,pj:()=>c,uL:()=>l});var r=n(6082),i=n(4328),s=n(6295),o=(n(3151),n(2738)),a=(n(826),n(3077));async function c(){const e=r.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 r.Column&&(e=(0,a.R)(e).columns.toList());const n=(await c()).getMonomerLib(),s=new Array(e.length),l=e[0].length,u=new Float32Array(l);for(let a=0;a<e.length;++a){const c=a<t.length?t.getCanonical(a):o._S,d=n.getMonomer("PEPTIDE",c)?.smiles??"",h=e[a],p=h.getRawData(),m=h.categories,f=m.indexOf("");if(s[a]={categories:m,data:p,emptyIndex:f},void 0===c)continue;const g=r.Column.fromStrings("smiles",m.map((e=>n.getMonomer("PEPTIDE",e)?.smiles??""))),y=(r.DataFrame.fromColumns([g]),await i.chem.getSimilarities(g,d)),w=y?y.getRawData():null;for(let e=0;e<l;++e){const t=p[e];c!==o._S&&t!==f?u[e]+=w[t]:c===o._S&&t===f&&(u[e]+=1)}}for(let n=0;n<u.length;++n){let i=u[n]/t.length;for(let o=0;o<e.length;++o){const e=s[o];if(o>=t.length&&e.data[n]!==e.emptyIndex||e.data[n]===e.emptyIndex&&o<t.length){i=r.FLOAT_NULL;break}}u[n]=i}return r.Column.fromFloat32Array("Similarity",u)}async function u(e){const t=(await c()).getMonomerLib(),n=[],s={},o=e.map((e=>t.getMonomer("PEPTIDE",e)?.smiles??"")),a=r.Column.fromStrings("smiles",o);for(let t=0;t<o.length;++t){s[e[t]]=t;const r=o[t],c=""===r?new Array(o.length).fill(0):(await i.chem.getSimilarities(a,r)).getRawData();c[t]=1,n[t]=Array.from(c)}return{scoringMatrix:n,alphabetIndexes:s}}async function d(e,t="Morgan"){const n=(await c()).getMonomerLib(),i=new Array(e.length).fill(0).map((()=>new Array(e.length).fill(0))),o={},a=e.map((e=>n.getMonomer("PEPTIDE",e)?.molfile||n.getMonomer("PEPTIDE",e)?.smiles||"")),l=r.Func.find({package:"Chem",name:"getFingerprints"})[0];if(!l)return console.warn('Function "Chem:getFingerprints" is not found in chem package. falling back to Morgan fingerprints'),await u(e);const d=r.Column.fromStrings("smiles",a),h=(r.DataFrame.fromColumns([d]),(await l.apply({col:d,fingerprintType:t}))?.entries);if(!h)return console.warn(`${t} Fingerprints could not be calculated for monomers from chem package.\n falling back to Morgan fingerprints`),await u(e);for(let t=0;t<h.length;++t)if(i[t][t]=1,o[e[t]]=t,h[t])for(let e=t+1;e<h.length;++e)h[e]&&(i[t][e]=i[e][t]=(0,s.$1)(h[t],h[e]));return{scoringMatrix:i,alphabetIndexes:o}}},7384:(e,t,n)=>{"use strict";n.d(t,{C4:()=>h});var r=n(4328),i=n(6082),s=n(1991),o=n.n(s),a=n(439),c=n(826);const l={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(3151);function d(e){return Math.round(l.PRECISION_FACTOR*e)/l.PRECISION_FACTOR}async function h(e,t,s){if(0===i.Func.find({package:"Chem",name:"getRdKitModule"}).length)return{col:null,warnings:['Transformation to atomic level requires the package "Chem" installed.']};if(t.semType!==i.SEMTYPE.MACROMOLECULE)return{col:null,warnings:[`Only the ${i.SEMTYPE.MACROMOLECULE} columns can be converted to atomic level, the chosen column has semType '${t.semType}'`]};let d=t;const h=c.GO.forColumn(t);h.isHelm()&&(d=h.convert(a.Hi.SEPARATOR,"."),d.name=t.name);const m=c.GO.forColumn(d).alphabet;let f;if(m===a.YI.PT||m===a.YI.UN)f="PEPTIDE";else{if(m!==a.YI.RNA&&m!==a.YI.DNA)return{col:null,warnings:[`Unexpected column's '${d.name}' alphabet '${m}'.`]};f="RNA"}const g=function(e){const t=e.length,n=new Array(t),i=c.GO.forColumn(e);let s=!1;for(let e=0;e<t;++e){const t=i.getSplitted(e);s||(s=0===t.length),n[e]=o()(t.canonicals).filter((e=>!i.isGap(e))).map((e=>e)).toArray()}return s&&r.shell.warning(`Some values in the "${e.name}" column are empty`),n}(d),y=await async function(e,t,n,i){const s=function(e,t,n){const r=new Map;for(const i of e.getMonomerSymbolsByType(t)){const s=e.getMonomer(t,i);if("RNA"===t&&("Branch"===s.monomerType||n===a.YI.DNA&&s.symbol===l.DEOXYRIBOSE||n===a.YI.RNA&&s.symbol===l.RIBOSE||s.symbol===l.PHOSPHATE)||"PEPTIDE"===t&&"Branch"!==s.monomerType){const e={};u.f6.forEach((t=>{e[t]=s[t]})),r.set(s.symbol,e)}}return r}(t,n,i),o=new Map,c=await r.functions.call("Chem:getRdKitModule"),d={value:null};if("RNA"===n){const e=i===a.YI.RNA?[l.RIBOSE,l.PHOSPHATE]:[l.DEOXYRIBOSE,l.PHOSPHATE];for(const t of e)p(o,t,s,c,n,d)}for(let t=0;t<e.length;++t){const r=e[t];for(const e of r)if(""!==e)try{p(o,e,s,c,n,d)}catch(t){const n=t instanceof Error?t.message:t.toString(),r=t instanceof Error?t.stack:void 0;throw console.error(`bio lib: getMonomersDictFromLib() sym='${e}', error:\n${n}\n${r}`),new Error(`Can't get monomer '${e}' from library: ${n}`)}}return o}(g,s,f,m),w=d.length,{molfileList:b,molfileWarningList:v}=await async function(e,t,r,i,s){const o=Math.max(navigator.hardwareConcurrency-2,1),a=new Array(o).fill(null).map((()=>new Worker(new URL(n.p+n.u(248),n.b)))),c=s/o;let l=[],u=[];const d=new Array(o);for(let n=0;n<o;n++){const l=Math.floor(n*c),u=n===o-1?s:Math.floor((n+1)*c);a[n].postMessage({monomerSequencesArray:e,monomersDict:t,alphabet:r,polymerType:i,start:l,end:u}),d[n]=new Promise((e=>{a[n].onmessage=({data:{molfileList:t,molfileWarningList:n}})=>{e({molfileList:t,molfileWarningList:n})}}))}return(await Promise.all(d)).forEach((e=>{l=l.concat(...e.molfileList),u=u.concat(...e.molfileWarningList)})),setTimeout((()=>{a.forEach((e=>{e.terminate()}))}),0),{molfileList:l,molfileWarningList:u}}(g,y,m,f,w);if(v.length>.05*w)throw new Error("Too many errors getting molfiles.");const A=`molfile(${d.name})`,E=e.columns.getUnusedName(A),C=i.Column.fromStrings(E,b);return C.semType=i.SEMTYPE.MOLECULE,C.meta.units=i.UNITS.Molecule.MOLBLOCK,{col:C,warnings:v}}function p(e,t,n,r,i,s){if(!e.has(t)){const o=function(e,t,n,r,i){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),c=(s=o.molfile).includes("V3000")?function(e){const t=new Map,n=/M V30 (\d+) R#.+RGROUPS=\((\d+) (\d+)\).*/gm;let r;for(;null!==(r=n.exec(e));)r.index===n.lastIndex&&n.lastIndex++,t.set(parseInt(r[1]),parseInt(r[3]));return t}(s):function(e){const t=new Map;let n=e.indexOf(l.V2K_A_LINE,0),r=n;for(;-1!==n;){r=e.indexOf("\n",n);const i=parseInt(e.substring(n,r).replace(/^A\s+/,""));n=e.indexOf("R",r),r=e.indexOf("\n",n);const s=parseInt(e.substring(n,r).replace(/^R/,""));t.set(i,s),n=e.indexOf(l.V2K_A_LINE,r)}for(n=e.indexOf(l.V2K_RGP_LINE,0),r=e.indexOf("\n",n);-1!==n;){n+=l.V2K_RGP_SHIFT,r=e.indexOf("\n",n);const i=e.substring(n,r).replaceAll(/\s+/g," ").split(" ").map((e=>parseInt(e))).slice(1);for(let e=0;e<i.length;e+=2){if(t.has(i[e])&&t.get(i[e])!==i[e+1])throw new Error(`r-group index ${i[e]} has already been added with a different value`);t.set(i[e],i[e+1])}n=e.indexOf(l.V2K_RGP_LINE,r)}return t}(s),u=o.molfile.includes("V3000")?o.molfile:function(e,t){const n=t.get_mol(e),r=n.get_v3Kmolblock();return n.delete(),r}(function(e){let t=e.indexOf(l.V2K_A_LINE,0);-1===t&&(t=e.indexOf(l.V2K_RGP_LINE));const n=e.indexOf(l.V3K_END,t);return e.substring(0,t)+e.substring(n)}(o.molfile),n),h=function(e){let t=(e=e.replaceAll("\r","")).indexOf(l.V3K_BEGIN_COUNTS_LINE)+l.V3K_COUNTS_SHIFT,n=e.indexOf(" ",t+1);const r=parseInt(e.substring(t,n));return t=n+1,n=e.indexOf(" ",t+1),{atomCount:r,bondCount:parseInt(e.substring(t,n))}}(u),p=function(e,t){const n=new Array(t),r=new Float32Array(t),i=new Float32Array(t),s=new Array(t);let o=e.indexOf(l.V3K_BEGIN_ATOM_BLOCK);o=e.indexOf("\n",o);let a=o;for(let c=0;c<t;c++){o=e.indexOf(l.V3K_BEGIN_DATA_LINE,o)+l.V3K_IDX_SHIFT,a=e.indexOf(" ",o),o=a+1,a=e.indexOf(" ",o),n[c]=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));r[c]=t[0],i[c]=t[1],o=a,a=e.indexOf("\n",o)+1,s[c]=e.slice(o,a),o=a}return{atomTypes:n,x:r,y:i,kwargs:s}}(u,h.atomCount),g=function(e,t){const n=new Uint32Array(t),r=new Array(t),i=new Map,s=new Map;let o=e.indexOf(l.V3K_BEGIN_BOND_BLOCK);o=e.indexOf("\n",o);let a=o;for(let c=0;c<t;++c){const t=new Array(3);o=e.indexOf(l.V3K_BEGIN_DATA_LINE,a)+l.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[c]=t[0],r[c]=t.slice(1);const u=e.indexOf("\n",o);let d=e.slice(a,u),h=d.indexOf(l.V3K_BOND_CONFIG);if(-1!==h){h=d.indexOf("=",h)+1;let e=d.indexOf(" ",h);-1===e&&(e=d.length);const t=parseInt(d.slice(h,e));i.set(c,t);const n=l.V3K_BOND_CONFIG+t.toString();d=d.replace(n,"")}d||s.set(c,d)}return{bondTypes:n,atomPairs:r,bondConfiguration:i,kwargs:s}}(u,h.bondCount),w=function(e,t,n,r){const i={backboneShift:null,branchShift:null,terminalNodes:[],rNodes:[]};return function(e,t,n){for(const[r,i]of n)e.atomTypes[r-1]=t[i-1]}(e,n,r),function(e,t){t.rNodes=Array.from(e.keys());for(let n=0;n<t.rNodes.length;n++)for(const r of[1,2])if(e.get(t.rNodes[n])===r){const e=t.rNodes[r-1];t.rNodes[r-1]=t.rNodes[n],t.rNodes[n]=e}}(r,i),m(t,i),i}(p,g,a,c),C=function(e){let t=[],n=e.indexOf("M V30 MDLV30/STEABS ATOMS=(");for(;-1!==n;){n+=28;const r=e.indexOf(")",n);t=t.concat(e.substring(n,r).split(" ").slice(1).map((e=>parseInt(e)))),n=r,n=e.indexOf("M V30 MDLV30/STEABS ATOMS=(",n)}return t}(u),T={atoms:p,bonds:g,meta:w,stereoAtoms:C};return"PEPTIDE"===r?function(e){const t=e.meta.terminalNodes[0]-1,n=e.meta.rNodes[0]-1,r=e.atoms.x,i=e.atoms.y;E(e,-r[t],-i[t]);const s=b(r[n],i[n]);v(e.atoms,-s),r[e.meta.rNodes[1]-1]<0&&function(e){A(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 r=n[e],i=n[(e+1)%2];t.has(r)?t.get(r)?.push(i):t.set(r,new Array(1).fill(i))}return t}(e);let n=0;const r=e.atoms.atomTypes.length;let i=0;for(;0===n;){const s=t.get(e.meta.terminalNodes[1])[i];if(e.atoms.atomTypes[s-1]===l.OXYGEN&&s!==e.meta.rNodes[1]&&(n=s),i++,i>r)throw new Error(`Search for double-bonded Oxygen in ${e} has exceeded the limit of ${r}`)}return n}(e);!function(e,t){e.atoms.y[e.meta.rNodes[1]-1]<0&&e.atoms.y[t-1]<0&&(function(e){A(e,!0)}(e),v(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 r=t-1,i=n-1,s=e.atoms.x,o=e.atoms.y,a=s[r],c=o[r];s[r]=s[i],o[r]=o[i],s[i]=a,o[i]=c}(e,t,e.meta.rNodes[1])}(e,o)}(T):e===l.RIBOSE||e===l.DEOXYRIBOSE?function(e,t){const n=e.atoms.x,r=e.atoms.y;let i=e.meta.terminalNodes[0]-1;const s=e.meta.rNodes[1]-1;E(e,-n[i],-r[i]);const o=b(n[s],r[s]);v(e.atoms,3*Math.PI/2-o),t.value=function(e){const t=e.atoms.x,n=e.atoms.y,r=e.meta.rNodes[2]-1,i=e.meta.terminalNodes[2]-1,s=t[r]-t[i],o=n[r]-n[i];return Math.atan(o/s)+Math.PI/2}(e),i=e.meta.terminalNodes[0]-1,E(e,-n[i],-r[i])}(T,i):e===l.PHOSPHATE?function(e){const t=e.meta.terminalNodes[0]-1,n=e.meta.rNodes[0]-1,r=e.atoms.x,i=e.atoms.y;E(e,-r[t],-i[t]);const s=b(r[n],i[n]);v(e.atoms,Math.PI/2-s)}(T):function(e,t){const n=e.atoms.x,r=e.atoms.y,i=e.meta.terminalNodes[0]-1,s=e.meta.rNodes[0]-1;E(e,-n[i],-r[i]);const o=b(n[s],r[s]),a=t.value;if(!a)throw new Error("The value of sugarBranchToOYAngle is null");v(e.atoms,Math.PI-o+a);const c=function(e,t){return d(Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2))}({x:n[e.meta.rNodes[0]-1],y:r[e.meta.rNodes[0]-1]},{x:n[e.meta.terminalNodes[0]-1],y:r[e.meta.terminalNodes[0]-1]});if(1!=c)for(let e=0;e<n.length;++e)n[e]=d(n[e]/c),r[e]=d(r[e]/c)}(T,i),function(e,t,n){"PEPTIDE"===e?(f(t,e),y(t,t.meta.rNodes[1])):n===l.RIBOSE||n===l.DEOXYRIBOSE?(y(t,t.meta.rNodes[1]),t.meta.rNodes[1]=t.meta.terminalNodes[1],m(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===l.PHOSPHATE&&(t.meta.terminalNodes[0]=t.meta.rNodes[0],E(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]))}(r,T,e),function(e){let t=0;for(;t<e.atoms.atomTypes.length;)e.atoms.atomTypes[t]===l.HYDROGEN&&(y(e,t+1),--t),++t}(T),T}var s;return null}(t,n,r,i,s);if(!o)throw new Error(`Monomer with symbol '${t}' is absent the monomer library`);e.set(t,o)}}function m(e,t){const n=t.rNodes;t.terminalNodes=new Array(n.length).fill(0);const r=t.terminalNodes,i=e.atomPairs;let s=0,o=0;for(;s<i.length&&o<r.length;){for(let e=0;e<r.length;++e)for(let t=0;t<2;++t)i[s][t]===n[e]&&(r[e]=i[s][(t+1)%2],n.length,++o);++s}}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[d(e.atoms.x[t]-e.atoms.x[n]),d(e.atoms.y[t]-e.atoms.y[n])]}function y(e,t){if(void 0!==t){const n=t-1,r=e.atoms,i=e.bonds,s=e.meta;r.atomTypes.splice(n,1),r.x=w(Float32Array,r.x,n,1),r.y=w(Float32Array,r.y,n,1),r.kwargs.splice(n,1);for(let e=0;e<s.terminalNodes.length;++e)s.terminalNodes[e]>t?--s.terminalNodes[e]:s.terminalNodes[e]===t&&(s.terminalNodes[e]=-1);for(let e=0;e<s.rNodes.length;++e)s.rNodes[e]>t?--s.rNodes[e]:s.rNodes[e]===t&&(s.rNodes[e]=-1);let o=0;for(;o<i.atomPairs.length;){const e=i.atomPairs[o][0],n=i.atomPairs[o][1];e===t||n===t?(i.atomPairs.splice(o,1),i.bondTypes=w(Uint32Array,i.bondTypes,o,1),i.bondConfiguration.has(o)&&i.bondConfiguration.delete(o),i.kwargs.has(o)&&i.kwargs.delete(o),--o):(i.atomPairs[o][0]=e>t?e-1:e,i.atomPairs[o][1]=n>t?n-1:n),++o}let a=Array.from(i.bondConfiguration.keys());a.forEach((e=>{if(i.bondConfiguration.has(e)&&e>n){const t=i.bondConfiguration.get(e);i.bondConfiguration.delete(e),i.bondConfiguration.set(e-1,t)}})),a=Array.from(i.kwargs.keys()),a.forEach((e=>{if(i.kwargs.has(e)&&e>n){const t=i.kwargs.get(e);i.kwargs.delete(e),i.kwargs.set(e-1,t)}}))}}function w(e,t,n,r){const i=new e(t.length-r);let s=0,o=0;for(;s<t.length;)s===n&&(s+=r),i[o]=t[s],++o,++s;return i}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 r=t/e,i=Math.atan(r);n=e<0?Math.PI/2+i:-Math.PI/2+i}return n}function v(e,t){if(0!==t){const n=e.x,r=e.y,i=Math.cos(t),s=Math.sin(t);for(let e=0;e<n.length;++e){const t=n[e];n[e]=d(t*i-r[e]*s),r[e]=d(t*s+r[e]*i)}}}function A(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 r=1===t?3:1;n.set(e,r)}}function E(e,t,n){const r=e.atoms.x,i=e.atoms.y;for(let e=0;e<r.length;++e)r[e]=d(r[e]+t),void 0!==n&&(i[e]=d(i[e]+n))}},1093:(e,t,n)=>{"use strict";n.d(t,{A:()=>i,Q:()=>s});var r=n(7362);class i extends r.e{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new i({A:"green",C:"blue",G:"black",T:"red",U:"red",others:"gray"})),this.chromatogram}}class s{}s.SemType="Nucleotides",s.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",s.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"}},7362:(e,t,n)=>{"use strict";n.d(t,{e:()=>r});class r{static makePalette(e,t=!1,n=r){const i={};return e.forEach((e=>{const n=e[0],r=e[1];n.forEach(((e,n)=>{i[e]=this.colourPalette[r][t?0:n]}))})),new n(i)}constructor(e){this._palette=e}get(e,t){return this._palette[e]}}r.undefinedColor="rgb(100,100,100)",r.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)"]}},4152:(e,t,n)=>{"use strict";n.d(t,{$u:()=>c,oT:()=>d});var r=n(6082),i=n(7362),s=n(6718);function o(e){if(null==e)return"rgb(100,100,100)";const t=r.Color.fromHtml(e),n=r.Color.g(t),i=r.Color.r(t),s=r.Color.b(t),o=Math.sqrt(Math.pow(0-i,2)+Math.pow(0-n,2)+Math.pow(0-s,2));return o>210?`rgb(${i/o*210},${n/o*210},${s/o*210})`:r.Color.toRgb(t)}class a{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 c{}class l extends c{get(e,t){return"#666666"}}class u extends c{static buildPalette(){return(0,s.pj)().then((e=>{e.awaitLoaded().then((()=>{const t=e.getMonomerLib();t.onChanged.subscribe((()=>{u.customMonomerColors={},u.polymerTypes=t.getPolymerTypes();for(const e of this.polymerTypes){const n=t.getMonomerSymbolsByType(e);for(const r of n){const n=t.getMonomer(e,r);n?.meta?.colors?.default?.background&&(this.customMonomerColors[r]||(this.customMonomerColors[r]={}),this.customMonomerColors[r][e]=o(n.meta.colors.default.background))}}}))}))})),[].concat(...Object.values(i.e.colourPalette))}get(e,t){const n=u.customMonomerColors[e],r=t??"PEPTIDE";if(n&&n[r])return n[r];const i=a.hashCode(e)%u.palette.length;return o(u.palette[i])}}u.palette=u.buildPalette(),u.customMonomerColors={},u.polymerTypes=[];class d extends i.e{static get Gray(){return void 0===this.gray&&(this.gray=new l),this.gray}static get Color(){return void 0===this.color&&(this.color=new u),this.color}}},6642:(e,t,n)=>{"use strict";n.d(t,{h:()=>o,s:()=>a});var r=n(4328),i=n(1858),s=n(8070);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 r=e.cell.column;if(t=t??r.temp,!t)throw new Error("Grid cell renderer back store (GridColumn or Column) not found.");return[n,r,t]}class a{constructor(e,t,n){this.gridCol=e,this.tableCol=t,this.logger=n,this.subs=[],this.dirty=!0,this.destroyed=!1,this.viewerId=++a.viewerCounter,this.errors=[],this._onRendered=new i.Subject,this.tableCol&&this.tableCol.dataFrame&&this.subs.push(this.tableCol.dataFrame.onDataChanged.subscribe((()=>{this.dirty=!0}))),this.tableCol&&this.subs.push(r.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(r.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()}reset(){this.dirty=!1}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,s.PE)(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},6882:(e,t,n)=>{"use strict";n.d(t,{B:()=>u,J:()=>d});var r=n(6082),i=n(1991),s=n.n(i),o=n(826),a=n(6642),c=n(6718),l=n(9192);function u(e,t){let n,r=100,i=0,s=e.length-1;for(;i<=s;){if(n=Math.floor((s+i)/2),e[n]<=t&&t<e[n+1])return n;if(t<e[n]?s=n-1:i=n+1,--r<=0)throw new Error(`Get position for pointer x = ${t} searching has not converged on ${JSON.stringify(e)}. `)}return null}class d extends a.s{constructor(e,t,n,i,s){super(e,t,n),this.monomerLengthLimit=i,this.propsProvider=s,this.colWidth=0,this._monomerLengthList=null,this.separatorWidth=5,this._processedMaxVisibleSeqLength=0,this._monomerLengthMap={},this._monomerStructureMap={},this.props=this.propsProvider(),this._processedRows=r.BitSet.create(this.tableCol.length),this.gridCol&&this.subs.push(this.gridCol.grid.onAfterDrawContent.subscribe((()=>{this._onRendered.next()}))),(0,c.pj)().then((e=>{if(this.destroyed)return;const t=e.getMonomerLib();this.subs.push(t.onChanged.subscribe((()=>{this.dirty=!0,this.gridCol?.grid?.invalidate()})))}))}reset(){this.propsProvider&&(this.props=this.propsProvider()),this._processedRows=r.BitSet.create(this.tableCol.length),this._monomerLengthList=null,this._monomerLengthMap={},this._monomerStructureMap={},super.reset()}getCellMonomerLengths(e,t){if(this.colWidth<t&&(this.colWidth=t,this.dirty=!0),this.dirty)try{this.reset()}catch(e){const[t,n]=(0,l.AP)(e);this.logger.error(t,void 0,n)}const n=this.props.seqHandler.isMsa()?this.getCellMonomerLengthsForSeqMsa():this.getCellMonomerLengthsForSeq(e),r=new Array(n.length+1);r[0]=5;for(let e=1;e<r.length;e++)r[e]=r[e-1]+n[e-1];return[n,r]}getCellMonomerLengthsForSeq(e){this.toLog(),null===this._monomerLengthList&&(this._monomerLengthList=new Array(this.tableCol.length).fill(null));const t=this.props.separatorWidth+1*this.props.monomerCharWidth,n=Math.ceil(this.colWidth/t),r=o.GO.forColumn(this.tableCol).getSplitted(e).originals,i=Math.min(n,r.length);let s=this._monomerLengthList[e];if(null===s||s.length<i){s=this._monomerLengthList[e]=new Array(r.length);let t=0;for(let e=0;e<i;++e){const n=r[e],i=this.props.monomerToShort(n,this.monomerLengthLimit),o=(this.props.seqHandler.isSeparator()?this.separatorWidth:this.props.separatorWidth)+i.length*this.props.monomerCharWidth;if(s[e]=o,t+=o,t>this.colWidth)break}}return s}getCellMonomerLengthsForSeqMsa(){var e;this.toLog(),null===this._monomerLengthList&&(this._monomerLengthList=new Array(1).fill(null)),(e=this._monomerLengthList)[0]??(e[0]=new Array(0));const t=this._monomerLengthList[0],{startIdx:n,endIdx:r}=(()=>{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)}}})(),i=this.props.separatorWidth+1*this.props.monomerCharWidth,s=Math.ceil(this.colWidth/i);for(let e=n;e<r;e++){if(this._processedRows.get(e)&&s<=this._processedMaxVisibleSeqLength)continue;const n=o.GO.forColumn(this.tableCol).getSplitted(e,s).originals,r=Math.min(s,n.length);r>t.length&&t.push(...new Array(r-t.length).fill(i));let a=0;for(let e=0;e<r;++e){const r=n[e],i=this.props.monomerToShort(r,this.monomerLengthLimit),s=this.props.separatorWidth+i.length*this.props.monomerCharWidth;if(t[e]=Math.max(t[e]??0,s),a+=s,a>=this.colWidth)break}this._processedMaxVisibleSeqLength=Math.max(this._processedMaxVisibleSeqLength,s)}return t}getPosition(e,t,n){const[r,i]=this.getCellMonomerLengths(e,n),a=o.GO.forColumn(this.tableCol);return 0===s()(a.getSplitted(e).originals).toArray().length?null:u(i,t)}setMonomerLengthLimit(e){this.monomerLengthLimit=e,this.dirty=!0}setSeparatorWidth(e){this.props.separatorWidth=e,this.dirty=!0}isMsa(){return this.props.seqHandler.isMsa()}}},3151:(e,t,n)=>{"use strict";n.d(t,{EK:()=>s,f6:()=>r,q7:()=>i});const r=["symbol","molfile","rgroups","name"],i="p",s=new RegExp(`[rd]\\((\\w)\\)${i}?`,"g")},9192:(e,t,n)=>{"use strict";function r(e){return"string"==typeof e||e instanceof String?e:"StateError"===e.constructor.name?e.message:"StateError"===e.constructor.name&&"$thrownJsError"in e?r(e.$thrownJsError):e instanceof Error?e.message:e.toString()}function i(e){return e instanceof Error?e.stack:"StateError"===e.constructor.name&&"$thrownJsError"in e?i(e.$thrownJsError):void 0}function s(e){return[r(e),i(e)]}n.d(t,{AP:()=>s})},3516:(e,t,n)=>{"use strict";n.d(t,{m:()=>o});var r=n(6082),i=n(826),s=n(439);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 r=this._fileContent.substring(t.index+1,e.lastIndex);this._descriptionsArray.push(r),0!==n&&this._sequencesArray.push(this.parseMacromolecule(n,t.index)),n=e.lastIndex+1}this._sequencesArray.push(this.parseMacromolecule(n,-1))}importFasta(){const e=r.Column.fromStrings("description",this.descriptionsArray),t=r.Column.fromStrings("sequence",this.sequencesArray);return t.semType=r.SEMTYPE.MACROMOLECULE,t.meta.units=s.Hi.FASTA,i.GO.forColumn(t),[r.DataFrame.fromColumns([e,t])]}constructor(e){this._descriptionsArray=[],this._sequencesArray=[],this._fileContent=e,this.parseColumns()}}},6873:(e,t,n)=>{"use strict";n.d(t,{dW:()=>o,fD:()=>s});var r=n(6082),i=(n(1991),n(2003));function s(){const e=[];return e.push(r.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(r.Column.fromList(r.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=r.Column.fromList(r.COLUMN_TYPE.STRING,"MSA",new Array(100).fill(t));n.semType=r.SEMTYPE.MACROMOLECULE,n.meta.units=i.Hi.SEPARATOR,n.setTag(i.gp.separator,"/"),n.setTag(i.gp.alphabet,i.YI.UN),n.setTag(i.gp.alphabetIsMultichar,"true");const s=[];return s.push(n),s.push(r.Column.fromList(r.COLUMN_TYPE.FLOAT,"Activity",new Array(100).fill(7.30751))),s}n(826),n(9322)},439:(e,t,n)=>{"use strict";n.d(t,{B5:()=>c,Hi:()=>r,Vl:()=>l,YI:()=>i,gp:()=>s,q7:()=>u,z1:()=>a});var r,i,s,o=n(2738);!function(e){e.FASTA="fasta",e.SEPARATOR="separator",e.HELM="helm"}(r||(r={})),function(e){e.DNA="DNA",e.RNA="RNA",e.PT="PT",e.UN="UN"}(i||(i={})),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"}(s||(s={}));const a=", ",c=/(?:\[([A-Za-z0-9_\-,()]+)\])|([A-Za-z\-])/g,l=new class{constructor(){this.fasta={peptide:new Set(["G","L","Y","S","E","Q","D","N","F","A","K","R","H","C","V","P","W","I","M","T"]),dna:new Set(["A","C","G","T"]),rna:new Set(["A","C","G","U"])}}},u=[new o.aD(i.PT,l.fasta.peptide,.5),new o.aD(i.DNA,l.fasta.dna,.55),new o.aD(i.RNA,l.fasta.rna,.55)]},2003:(e,t,n)=>{"use strict";n.d(t,{Hi:()=>r.Hi,J9:()=>i.J9,Qf:()=>i.Qf,SM:()=>i.SM,YI:()=>r.YI,dh:()=>i.dh,gp:()=>r.gp,mn:()=>i.mn,nq:()=>i.nq,ny:()=>i.ny,q7:()=>r.q7,qp:()=>i.qp,z1:()=>r.z1,zS:()=>i.zS});var r=n(439),i=n(9322)},2738:(e,t,n)=>{"use strict";n.d(t,{XN:()=>s,_S:()=>r,aD:()=>i});const r="";class i{constructor(e,t,n){this.name=e,this.alphabet=t,this.cutoff=n}}class s extends i{constructor(e,t,n){super(e.name,e.alphabet,e.cutoff),this.freq=t,this.similarity=n}}},9322:(e,t,n)=>{"use strict";n.d(t,{Mu:()=>m,pc:()=>x,Qf:()=>_,nq:()=>P,ny:()=>$,Iv:()=>C,dh:()=>b,vZ:()=>g,zS:()=>S,SM:()=>M,mn:()=>N,J9:()=>y,tm:()=>w,qp:()=>E});var r=n(6082),i=n(1991),s=n.n(i),o=n(2738),a=n(439),c=n(826);class l extends Float32Array{}var u=n(3629),d=n(8924),h=n(1093),p=n(4152);class m{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)===c.b9[a.Hi.FASTA]}getCanonical(e){if(this.length<=e)throw new Error("Index out of bounds");return this.isGap(e)?o._S: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 r=e.categories;return function(e,t){const n={};let r=!0,i=null;for(const s of e)if(null==i?i=s.length:s.length!==i&&(r=!1),s.length>=t)for(const e of s.canonicals)e in n||(n[e]=0),n[e]+=1;return{freq:n,sameLength:r}}(s().enumerate(e.getRawData()).map((([e,t])=>n(r[e]))),t)}const y=e=>{const t=s()(e.toString().matchAll(a.B5)).map((e=>e[2]??e[1])).toArray();return new m(t,c.b9[a.Hi.FASTA])},w=e=>e?new f(e):new m([],c.b9[a.Hi.FASTA]);function b(e,t=void 0){return n=>{if(n){let r;const i=new RegExp(String.raw`"-"|'-'|[^${e}]+`,"g");if(void 0!==t){i.lastIndex=0,r=new Array(Math.ceil(t));let e=null,s=0;for(;null!==(e=i.exec(n))&&s<t;)r[s++]=e[0].replace('"-"',"").replace("'-'","");r.splice(s)}else r=n.replaceAll('"-"',"").replaceAll("'-'","").split(e,t);return new m(r,c.b9[a.Hi.SEPARATOR])}return new m([],c.b9[a.Hi.SEPARATOR])}}const v=/(PEPTIDE1|DNA1|RNA1)\{([^}]+)}/g,A=/\[([^\[\]]+)]/g,E=e=>{v.lastIndex=0;const t=v.exec(e.toString()),n=t?t[2]:null,r=n?n.split("."):[];return new m(r.map((e=>{A.lastIndex=0;const t=A.exec(e);return t&&t.length>=2?t[1]:e})),c.b9[a.Hi.HELM])};function C(e,t,n=void 0){if(e.toLowerCase().startsWith(a.Hi.FASTA))return y;if(e.toLowerCase().startsWith(a.Hi.SEPARATOR))return b(t,n);if(e.toLowerCase().startsWith(a.Hi.HELM))return E;throw new Error(`Unexpected units ${e} .`)}const T=/([^\W_]+)/g;function S(e,t){if(e.length<=t)return e;const n=e.match(T),r=e.length>t||(n?.length??0)>1,i=n?.[0]??" ";return r?i.substring(0,t-1)+"…":i}function _(e){switch(e){case a.YI.DNA:return a.Vl.fasta.dna;case a.YI.RNA:return a.Vl.fasta.rna;case a.YI.PT:return a.Vl.fasta.peptide;default:throw new Error(`Unsupported alphabet '${e}'.`)}}function P(e,t,n="-"){const r=new Set([...new Set(Object.keys(e)),...t]);r.delete(n);const i=[],s=[];for(const n of r)i.push(n in e?e[n]:0),s.push(t.has(n)?1:0);const o=new l(i),a=new l(s);return(0,u.KE)(o,a)/((0,u.wQ)(o)*(0,u.wQ)(a))}function x(e,t,n="-"){const r=t.map((t=>{const r=P(e,t.alphabet,n);return new o.XN(t,e,r)}));let i;const s=Math.max(...r.map((e=>e.similarity>e.cutoff?e.similarity:-1)));return i=s>0?r.find((e=>e.similarity===s)).name:a.YI.UN,i}function M(e,t=5){let n;return n=e.semType==r.SEMTYPE.MACROMOLECULE?c.GO.forColumn(e).alphabet:x(g(e,t,y).freq,a.q7),$(n)}function $(e){switch(e){case a.YI.PT:return d.X.GrokGroups;case a.YI.DNA:case a.YI.RNA:return h.A.Chromatogram;default:return p.oT.Color}}function N(e){const t=e.columns.bySemTypeAll(r.SEMTYPE.MACROMOLECULE);let n=t.find((e=>{const t=e.meta.units;return!!t&&-1!==t.indexOf("MSA")}))??null;return!n&&t.length>0&&(n=t[0]),n}},826:(e,t,n)=>{"use strict";n.d(t,{GO:()=>m,b9:()=>p});var r=n(6082),i=n(1991),s=n.n(i),o=n(2003),a=n(2738),c=n(9322),l=n(6863),u=n(6718),d=n(3151);const h=new class{constructor(){this.seqHandler="seq-handler",this.notationProvider="seq-handler.notation-provider"}},p={[o.Hi.FASTA]:"-",[o.Hi.SEPARATOR]:"",[o.Hi.HELM]:"*"};class m{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!==r.TYPE.STRING)throw new Error(`Unexpected column type '${e.type}', must be '${r.TYPE.STRING}'.`);this._column=e;const t=this._column.meta.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()?p[o.Hi.FASTA]:this.isHelm()?p[o.Hi.HELM]:p[o.Hi.SEPARATOR],!this.column.tags.has(o.gp.aligned)||!this.column.tags.has(o.gp.alphabet)||!this.column.tags.has(o.gp.alphabetIsMultichar)&&!this.isHelm()&&this.alphabet===o.YI.UN)if(this.isFasta())m.setUnitsToFastaColumn(this);else if(this.isSeparator()){const t=e.getTag(o.gp.separator);m.setUnitsToSeparatorColumn(this,t)}else{if(!this.isHelm())throw new Error(`Unexpected units '${this.column.meta.units}'.`);m.setUnitsToHelmColumn(this)}if(!this.column.tags.has(o.gp.alphabetIsMultichar))if(this.isHelm())this.column.setTag(o.gp.alphabetIsMultichar,"true");else if(["UN"].includes(this.alphabet))throw new Error(`For column '${this.column.name}' of alphabet '${this.alphabet}' tag '${o.gp.alphabetIsMultichar}' is mandatory.`);this.notationProvider=this.column.temp[h.notationProvider]??null,this.columnVersion=this.column.version}static setUnitsToFastaColumn(e){if(e.column.semType!==r.SEMTYPE.MACROMOLECULE||e.column.meta.units!==o.Hi.FASTA)throw new Error(`The column of notation '${o.Hi.FASTA}' must be '${r.SEMTYPE.MACROMOLECULE}'.`);e.column.meta.units=o.Hi.FASTA,m.setTags(e)}static setUnitsToSeparatorColumn(e,t){if(e.column.semType!==r.SEMTYPE.MACROMOLECULE||e.column.meta.units!==o.Hi.SEPARATOR)throw new Error(`The column of notation '${o.Hi.SEPARATOR}' must be '${r.SEMTYPE.MACROMOLECULE}'.`);if(!t)throw new Error(`The column of notation '${o.Hi.SEPARATOR}' must have the separator tag.`);e.column.meta.units=o.Hi.SEPARATOR,e.column.setTag(o.gp.separator,t),m.setTags(e)}static setUnitsToHelmColumn(e){if(e.column.semType!==r.SEMTYPE.MACROMOLECULE)throw new Error(`The column of notation '${o.Hi.HELM}' must be '${r.SEMTYPE.MACROMOLECULE}'`);e.column.meta.units=o.Hi.HELM,m.setTags(e)}static setTags(e){const t=e.column.meta.units;if([o.Hi.FASTA,o.Hi.SEPARATOR].includes(t)){if(!e.column.getTag(o.gp.alphabet)&&0===Object.keys(e.stats.freq).length)throw new Error("Alphabet is empty and not annotated.");let t=e.column.getTag(o.gp.aligned);null===t&&(t=e.stats.sameLength?"SEQ.MSA":"SEQ",e.column.setTag(o.gp.aligned,t));let n=e.column.getTag(o.gp.alphabet);if(null===n&&(n=(0,c.pc)(e.stats.freq,o.q7),e.column.setTag(o.gp.alphabet,n)),n===o.YI.UN){const t=Object.keys(e.stats.freq).length,n=Object.keys(e.stats.freq).some((e=>e.length>1));e.column.setTag(o.gp.alphabetSize,t.toString()),e.column.setTag(o.gp.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.gp.separator)??void 0;if(this.notation===o.Hi.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.gp.aligned);if(!e&&(this.isFasta()||this.isSeparator()))throw new Error("Tag aligned not set");return e}get alphabet(){const e=this.column.getTag(o.gp.alphabet);if(!e&&(this.isFasta()||this.isSeparator()))throw new Error("Tag alphabet not set");return e}get helmCompatible(){return this.column.getTag(o.gp.isHelmCompatible)}getAlphabetSize(){if(this.notation==o.Hi.HELM||this.alphabet==o.YI.UN){const e=this.column.getTag(o.gp.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.YI.PT:return 20;case o.YI.DNA:case o.YI.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.Hi.HELM||this.alphabet===o.YI.UN&&"true"===this.column.getTag(o.gp.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)}}async getHelm(e,t){const n=this.column.get(e);return this.notationProvider?(await this.notationProvider.getHelm(this.column,t)).get(e):this.convertToHelm(n)}get stats(){if(null===this._stats){const e={};let t=!0,n=null;const r=this.column.length;for(let i=0;i<r;++i){const r=this.getSplitted(i);null==n?n=r.length:r.length!==n&&(t=!1);for(const t of r.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(...s().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.gp.positionNames);this._posList=e?e.split(o.z1).map((e=>e.trim())):s().count(1).take(this.maxLength).map((e=>e.toString())).toArray()}return this._posList}isFasta(){return this.notation===o.Hi.FASTA}isSeparator(){return this.notation===o.Hi.SEPARATOR}isHelm(){return this.notation===o.Hi.HELM}isRna(){return this.alphabet===o.YI.RNA}isDna(){return this.alphabet===o.YI.DNA}isPeptide(){return this.alphabet===o.YI.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.Hi.FASTA))return o.Hi.FASTA;if(this.units.toLowerCase().startsWith(o.Hi.SEPARATOR))return o.Hi.SEPARATOR;if(this.units.toLowerCase().startsWith(o.Hi.HELM))return o.Hi.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,i){const s=this.column,a=e.toLowerCase()+"("+s.name+")",c=n??s.dataFrame.columns.getUnusedName(a),l=r.Column.fromList("string",c,i??new Array(this.column.length).fill(""));if(l.semType=r.SEMTYPE.MACROMOLECULE,l.meta.units=e,e===o.Hi.SEPARATOR){if(!t)throw new Error(`Notation '${o.Hi.SEPARATOR}' requires separator value.`);l.setTag(o.gp.separator,t)}l.setTag(r.TAGS.CELL_RENDERER,e===o.Hi.HELM?"helm":"sequence");const u=s.getTag(o.gp.aligned);u&&l.setTag(o.gp.aligned,u);let d=s.getTag(o.gp.alphabet);d||this.notation!==o.Hi.HELM||e===o.Hi.HELM||(d=o.YI.UN),null!=d&&l.setTag(o.gp.alphabet,d);let h=s.getTag(o.gp.alphabetSize);null!=d&&h&&l.setTag(o.gp.alphabetSize,h);const p=s.getTag(o.gp.alphabetIsMultichar);return null!=d&&void 0!==p&&l.setTag(o.gp.alphabetIsMultichar,p),e==o.Hi.HELM&&(h=this.getAlphabetSize().toString(),l.setTag(o.gp.alphabetSize,h)),l}getNewColumnFromList(e,t){return this.getNewColumn(this.notation,this.separator,e,t)}static getNewColumn(e){const t=m.forColumn(e),n=t.notation;return t.getNewColumn(n)}static unitsStringIsValid(e){return e=e.toLowerCase(),[o.Hi.FASTA,o.Hi.SEPARATOR,o.Hi.HELM].some((t=>e.startsWith(t.toLowerCase())))}static getNewColumnFromParams(e,t,n){if(!m.unitsStringIsValid(n))throw new Error("Invalid format of 'units' parameter");const i=r.Column.fromList("string",t,new Array(e).fill(""));return i.semType=r.SEMTYPE.MACROMOLECULE,i.meta.units=n,i}getSplitter(e){let t=null;if(t=this.notationProvider?this.notationProvider.splitter:null,t)return t;if(this.units.toLowerCase().startsWith(o.Hi.FASTA))return null===this.column.getTag(o.gp.alphabet)||this.getAlphabetIsMultichar()?o.J9:c.tm;if(this.units.toLowerCase().startsWith(o.Hi.SEPARATOR))return(0,o.dh)(this.separator,e);if(this.units.toLowerCase().startsWith(o.Hi.HELM))return o.qp;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 l.Z.HAMMING;switch(this.alphabet){case o.YI.DNA:case o.YI.RNA:case o.YI.PT:}return l.Z.LEVENSHTEIN}getDistanceFunction(){return l.V[this.getDistanceFunctionName()]()}async checkHelmCompatibility(){if(this.column.tags.has(o.gp.isHelmCompatible))return"true"===this.column.getTag(o.gp.isHelmCompatible);const e=(await(0,u.pj)()).getMonomerLib().getMonomerSymbolsByType("PEPTIDE"),t=new Set(e),n=((0,o.dh)(this.separator),new Set),r=this.column.length,i=this.column.getRawData();for(let e=0;e<r;++e){const r=i[e];if(!(r in n)){n.add(r);const i=this.getSplitted(e);for(const e of i.canonicals)if(!t.has(e))return this.column.setTag(o.gp.isHelmCompatible,"false"),!1}}return this.column.setTag(o.gp.isHelmCompatible,"true"),!0}get splitter(){return null===this._splitter&&(this._splitter=this.getSplitter()),this._splitter}toFasta(e){return e===o.Hi.FASTA}toSeparator(e){return e===o.Hi.SEPARATOR}toHelm(e){return e===o.Hi.HELM}convertHelmToFastaSeparator(e,t,n,r){r||(r=this.toFasta(t)?p[o.Hi.FASTA]:p[o.Hi.SEPARATOR]),n||(n=this.toFasta(t)?"":this.separator);const i=e.startsWith("RNA"),s=this.splitter(e),a=[];for(let e=0;e<s.length;++e){let n=s.getOriginal(e);if(i&&(n=n.replace(d.EK,"")),n===p[o.Hi.HELM])a.push(r);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}),r=this.getNewColumn(e,t);return r.init((e=>{const t=this.getSplitted(e);return n(t)})),r}getRegion(e,t,n){const r=this.getNewColumn(this.notation,this.separator);r.name=n;const i=e??0,s=t??this.maxLength-1,a=this.getJoiner(),l=s-i+1,u=p[this.notation];r.init((e=>{const t=this.getSplitted(e),n=new Array(l);for(let e=0;e<l;++e){const r=i+e;n[e]=r<t.length?t.getOriginal(r):u}return a(new c.Mu(n,u))}));const d=e=>{const t=e.split(",").map((e=>e.trim())),n=new Array(l);for(let e=0;e<l;++e){const r=i+e;n[e]=r<t.length?t[r]:"?"}return n.join(o.z1)},h=this.column.getTag(o.gp.positionNames);h&&r.setTag(o.gp.positionNames,d(h));const m=this.column.getTag(o.gp.positionLabels);return m&&r.setTag(o.gp.positionLabels,d(m)),r}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 r;const i=this;switch(t){case o.Hi.FASTA:r=function(e){return i.joinToFasta(e,i.isHelm())};break;case o.Hi.SEPARATOR:if(!n)throw new Error(`Separator is mandatory for notation '${t}'.`);r=function(e){return f(e,n,i.isHelm())};break;case o.Hi.HELM:{const e=i.alphabet===o.YI.DNA||i.alphabet===o.YI.RNA,t=i.getHelmWrappers();r=function(n){return g(n,t,e)};break}default:throw new Error(`Unexpected notation '${t}'.`)}return r}getConverter(e,t=void 0){if(e===o.Hi.SEPARATOR&&!t)throw new Error(`Target separator is not specified for target units '${o.Hi.SEPARATOR}'.`);const n=this;if(e===o.Hi.FASTA)return function(e){return n.convertToFasta(e)};if(e===o.Hi.HELM)return function(e){return n.convertToHelm(e)};if(e===o.Hi.SEPARATOR)return function(e){return n.convertToSeparator(e,t)};throw new Error}static forColumn(e){let t=e.temp[h.seqHandler];return t&&t.columnVersion===e.version||(t=e.temp[h.seqHandler]=new m(e)),t}joinToFasta(e,t){const n=new Array(e.length);for(let r=0;r<e.length;++r){const i=e.getOriginal(r);let s=e.getOriginal(r);t&&(s=s.replace(d.EK,"$1")),i===a._S?s=p[o.Hi.FASTA]:i===d.q7?s="":s.length>1&&(s="["+s+"]"),n[r]=s}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){if(this.notation==o.Hi.HELM)return 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),r=e.startsWith("DNA"),i=e.startsWith("RNA");for(let e=0;e<t.length;++e){let s=t.getOriginal(e);(r||i)&&(s=s.replace(d.EK,"$1"),s=s===d.q7?null:s),n[e]=s||null}return new c.Mu(n.filter((e=>!!e)),p[o.Hi.HELM])}}function f(e,t,n){const r=new Array(e.length);for(let t=0;t<e.length;++t){const i=e.getCanonical(t);let s=e.getOriginal(t);n&&(s=s.replace(d.EK,"$1")),i===a._S?s=p[o.Hi.SEPARATOR]:i===d.q7&&(s=""),r[t]=s}return r.join(t)}function g(e,t,n){const[r,i,s,c]=t,l=new Array(e.length);for(let t=0;t<e.length;++t){const r=e.getCanonical(t);let c=e.getOriginal(t);r===a._S?c=p[o.Hi.HELM]:(n&&(c=c.replace(d.EK,"$1")),c=1===c.length?`${i}${c}${s}`:`${i}[${c}]${s}`),l[t]=c}return`${r}${l.join(".")}${c}`}},8312:(e,t,n)=>{"use strict";n.d(t,{Q:()=>i});var r=n(6082);async function i(){const e=r.Func.find({package:"Bio",name:"getSeqHelper"});if(0===e.length)throw new Error("Package 'Bio' must be installed for SeqHelper.");return(await e[0].prepare().call()).getOutputParamValue()}},3077:(e,t,n)=>{"use strict";n.d(t,{R:()=>s});var r=n(6082),i=n(826);function s(e){const t=e=>{const t=o.columns.addNewString((e+1).toString());return n.push(t),t},n=[],s=e.length,o=r.DataFrame.create(s),a=i.GO.forColumn(e);for(let e=0;e<s;++e){const r=a.getSplitted(e);for(let i=0;i<r.length;++i){const s=r.getOriginal(i);((n[i]??null)||t(i)).set(e,s,!1)}}return o}},7602:(e,t,n)=>{"use strict";n.d(t,{g:()=>s});var r,i=n(9192);!function(e){e[e.error=0]="error",e[e.warning=1]="warning",e[e.info=2]="info",e[e.debug=3]="debug"}(r||(r={}));class s{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[r,s]=(0,i.AP)(t);this.logger.error(`${e}, SYNC syncId = ${n}, ERROR:\n${r}`,void 0,s),this.errors.push(t)}))}resetErrors(){const e=this.errors;return this.errors=[],e}}},4326:(e,t,n)=>{"use strict";n.d(t,{Fo:()=>u,Lp:()=>s,P4:()=>o,fH:()=>i,gp:()=>r,lT:()=>c,mH:()=>a});var r,i,s,o,a,c,l=n(6082);!function(e){e.tooltipWebLogo=".tooltipWebLogo"}(r||(r={})),function(e){e.Entropy="Entropy",e.full="100%"}(i||(i={})),function(e){e.TOP="top",e.MIDDLE="middle",e.BOTTOM="bottom"}(s||(s={})),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"}(c||(c={}));const u=new class{constructor(){this.sequenceColumnName=null,this.valueAggrType=l.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=i.Entropy,this.positionWidth=16,this.verticalAlignment=s.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=c.Filtered}}},5540:(e,t,n)=>{"use strict";e=n.hmd(e);var r,i=(r="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e={}){var t,n,i=void 0!==e?e:{};i.ready=new Promise((function(e,r){t=e,n=r}));var s,o=Object.assign({},i),a="object"==typeof window,c="function"==typeof importScripts,l=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(a||c)&&(c?l=self.location.href:"undefined"!=typeof document&&document.currentScript&&(l=document.currentScript.src),r&&(l=r),l=0!==l.indexOf("blob:")?l.substr(0,l.replace(/[?#].*/,"").lastIndexOf("/")+1):"",c&&(s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)})),i.print||console.log.bind(console);var u,d,h=i.printErr||console.warn.bind(console);Object.assign(i,o),o=null,i.arguments&&i.arguments,i.thisProgram&&i.thisProgram,i.quit&&i.quit,i.wasmBinary&&(u=i.wasmBinary),i.noExitRuntime,"object"!=typeof WebAssembly&&T("no native wasm support detected");var p,m,f,g=!1;function y(){var e=d.buffer;i.HEAP8=p=new Int8Array(e),i.HEAP16=new Int16Array(e),i.HEAP32=new Int32Array(e),i.HEAPU8=m=new Uint8Array(e),i.HEAPU16=new Uint16Array(e),i.HEAPU32=f=new Uint32Array(e),i.HEAPF32=new Float32Array(e),i.HEAPF64=new Float64Array(e)}var w=[],b=[],v=[],A=0,E=null,C=null;function T(e){i.onAbort&&i.onAbort(e),h(e="Aborted("+e+")"),g=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw n(t),t}var S,_;function P(e){return e.startsWith("data:application/octet-stream;base64,")}function x(e){try{if(e==S&&u)return new Uint8Array(u);if(s)return s(e);throw"both async and sync fetching of the wasm failed"}catch(e){T(e)}}function M(e,t,n){return function(e){return u||!a&&!c||"function"!=typeof fetch?Promise.resolve().then((function(){return x(e)})):fetch(e,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((function(){return x(e)}))}(e).then((function(e){return WebAssembly.instantiate(e,t)})).then((function(e){return e})).then(n,(function(e){h("failed to asynchronously prepare wasm: "+e),T(e)}))}function $(e){for(;e.length>0;)e.shift()(i)}function N(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,p[this.ptr+12|0]=e},this.get_caught=function(){return 0!=p[this.ptr+12|0]},this.set_rethrown=function(e){e=e?1:0,p[this.ptr+13|0]=e},this.get_rethrown=function(){return 0!=p[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(U(this.get_type()))return f[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}function L(e){var t=d.buffer;try{return d.grow(e-t.byteLength+65535>>>16),y(),1}catch(e){}}function I(e){return i["_"+e]}P(S="wasmDbscan.wasm")||(_=S,S=i.locateFile?i.locateFile(_,l):l+_);var R="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function O(e,t,n,r,i){var s={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 r=e.charCodeAt(n);r<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3}return t}(e)+1,n=F(t);return function(e,t,n){!function(e,t,n,r){if(!(r>0))return 0;for(var i=n+r-1,s=0;s<e.length;++s){var o=e.charCodeAt(s);if(o>=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++s)),o<=127){if(n>=i)break;t[n++]=o}else if(o<=2047){if(n+1>=i)break;t[n++]=192|o>>6,t[n++]=128|63&o}else if(o<=65535){if(n+2>=i)break;t[n++]=224|o>>12,t[n++]=128|o>>6&63,t[n++]=128|63&o}else{if(n+3>=i)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,m,t,n)}(e,n,t),n}(e)),t},array:e=>{var t,n,r=F(e.length);return t=e,n=r,p.set(t,n),r}},o=I(e),a=[],c=0;if(r)for(var l=0;l<r.length;l++){var u=s[n[l]];u?(0===c&&(c=H()),a[l]=u(r[l])):a[l]=r[l]}var d=o.apply(null,a);return function(e){return 0!==c&&D(c),function(e){return"string"===t?(n=e)?function(e,t,n){for(var r=t+n,i=t;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&R)return R.decode(e.subarray(t,i));for(var s="";t<i;){var o=e[t++];if(128&o){var a=63&e[t++];if(192!=(224&o)){var c=63&e[t++];if((o=224==(240&o)?(15&o)<<12|a<<6|c:(7&o)<<18|a<<12|c<<6|63&e[t++])<65536)s+=String.fromCharCode(o);else{var l=o-65536;s+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else s+=String.fromCharCode((31&o)<<6|a)}else s+=String.fromCharCode(o)}return s}(m,n,r):"":"boolean"===t?Boolean(e):e;var n,r}(e)}(d)}var k,G={__cxa_throw:function(e,t,n){throw new N(e).init(t,n),e},abort:function(){T("")},emscripten_memcpy_big:function(e,t,n){m.copyWithin(e,t,t+n)},emscripten_resize_heap:function(e){var t,n=m.length,r=2147483648;if((e>>>=0)>r)return!1;for(var i=1;i<=4;i*=2){var s=n*(1+.2/i);if(s=Math.min(s,e+100663296),L(Math.min(r,(t=Math.max(e,s))+(65536-t%65536)%65536)))return!0}return!1}},H=(function(){var e,t,r,s,o={env:G,wasi_snapshot_preview1:G};function a(e,t){var n,r=e.exports;return i.asm=r,d=i.asm.memory,y(),i.asm.__indirect_function_table,n=i.asm.__wasm_call_ctors,b.unshift(n),function(){if(A--,i.monitorRunDependencies&&i.monitorRunDependencies(A),0==A&&(null!==E&&(clearInterval(E),E=null),C)){var e=C;C=null,e()}}(),r}if(A++,i.monitorRunDependencies&&i.monitorRunDependencies(A),i.instantiateWasm)try{return i.instantiateWasm(o,a)}catch(e){h("Module.instantiateWasm callback failed with error: "+e),n(e)}(e=u,t=S,r=o,s=function(e){a(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||P(t)||"function"!=typeof fetch?M(t,r,s):fetch(t,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,r).then(s,(function(e){return h("wasm streaming compile failed: "+e),h("falling back to ArrayBuffer instantiation"),M(t,r,s)}))}))).catch(n)}(),i._dbscan=function(){return(i._dbscan=i.asm.dbscan).apply(null,arguments)},i._malloc=function(){return(i._malloc=i.asm.malloc).apply(null,arguments)},i._free=function(){return(i._free=i.asm.free).apply(null,arguments)},function(){return(H=i.asm.stackSave).apply(null,arguments)}),D=function(){return(D=i.asm.stackRestore).apply(null,arguments)},F=function(){return(F=i.asm.stackAlloc).apply(null,arguments)},U=function(){return(U=i.asm.__cxa_is_pointer_type).apply(null,arguments)};function V(){function e(){k||(k=!0,i.calledRun=!0,g||($(b),t(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),function(){if(i.postRun)for("function"==typeof i.postRun&&(i.postRun=[i.postRun]);i.postRun.length;)e=i.postRun.shift(),v.unshift(e);var e;$(v)}()))}A>0||(function(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)e=i.preRun.shift(),w.unshift(e);var e;$(w)}(),A>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),e()}),1)):e()))}if(i.ccall=O,i.cwrap=function(e,t,n,r){var i=!n||n.every((e=>"number"===e||"boolean"===e));return"string"!==t&&i&&!r?I(e):function(){return O(e,t,n,arguments)}},C=function e(){k||V(),k||(C=e)},i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return V(),e.ready});"object"==typeof exports?e.exports=i:"function"==typeof define&&n.amdO?define([],(function(){return i})):"object"==typeof exports&&(exports.exportCppDbscanLib=i)},6295:(e,t,n)=>{"use strict";n.d(t,{$1:()=>a,Hr:()=>C,Ii:()=>m,T6:()=>E,TK:()=>v,a4:()=>h,be:()=>p,gt:()=>y,iS:()=>o,ij:()=>w,lO:()=>d,lP:()=>g,rR:()=>f,tO:()=>c,v_:()=>l,yK:()=>b,zn:()=>u});var r=n(8774),i=n(8498),s=n(6863);i.aT.Tanimoto,i.aT.Dice,i.aT.Asymmetric,i.aT.BraunBlanquet,i.aT.Cosine,i.aT.Kulczynski,i.aT.McConnaughey,i.aT.RogotGoldberg,i.aT.Russel,i.aT.Sokal,i.aT.Hamming,i.aT.Euclidean,i.aT.Tanimoto,i.aT.Dice,i.aT.Asymmetric,i.aT.BraunBlanquet,i.aT.Cosine,i.aT.Kulczynski,i.aT.McConnaughey,i.aT.RogotGoldberg,i.aT.Russel,i.aT.Sokal,i.aT.Hamming,i.aT.Euclidean;const o=[i.aT.Tanimoto,i.aT.Dice,i.aT.Cosine];function a(e,t){const n=e.trueCount()+t.trueCount();if(0==n)return 1;const r=e.andWithCountBits(t,!0);return r/(n-r)}function c(e,t){return 1-a(e,t)}function l(e,t){return A(a(new r.A(e,32*e.length),new r.A(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 d(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 h(e,t){return Math.sqrt(e.trueCount()+t.trueCount()-2*e.andWithCountBits(t,!0))}function p(e,t){return e.trueCount()+t.trueCount()-2*e.andWithCountBits(t,!0)}function m(e,t){return 1-function(e,t){const n=e.trueCount()+t.trueCount(),r=e.andWithCountBits(t,!0);return r/(2*n-3*r)}(e,t)}function f(e,t){return A(function(e,t){const n=e.trueCount()+t.trueCount(),r=e.trueCount()*t.trueCount();return 0==r?0:e.andWithCountBits(t,!0)*n/(2*r)}(e,t))}function g(e,t){return A(function(e,t){const n=e.trueCount()+t.trueCount(),r=e.trueCount()*t.trueCount();return 0==r?0:(e.andWithCountBits(t,!0)*n-r)/r}(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 A(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 A(function(e,t){return 0==e.length?0:e.andWithCountBits(t,!0)/e.length}(e,t))}function v(e,t){return A(function(e,t){const n=e.andWithCountBits(t,!0),r=e.countBits(!0)+t.countBits(!0),i=e.length,s=i-r+n;return n==i||s==i?1:n/r+s/(2*i-r)}(e,t))}function A(e){return 0===e?3402823e32:1/e-1}function E(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 C(e){const t=function(e){const t=e?.mostCommon??new Set;return(e,n)=>{const r=e.length,i=n.length;let s=0,o=0,a=0;for(;o<r&&a<i;)e[o]===n[a]?(t?.has(e[o])||++s,++o,++a):e[o]<n[a]?++o:++a;return s}}(e);return(e,n)=>0===n.length||0===e.length?1e4:Math.min(e.length,n.length)/(t(e,n)+1e-4)}i.aT.Tanimoto,i.aT.Asymmetric,i.aT.Cosine,i.aT.Sokal,s.Z.HAMMING,s.Z.LEVENSHTEIN,s.Z.MONOMER_CHEMICAL_DISTANCE,s.Z.NEEDLEMANN_WUNSCH},684:(e,t,n)=>{"use strict";n.d(t,{C0:()=>s,GP:()=>r,Gi:()=>a,YP:()=>l,_X:()=>o,n3:()=>i,vb:()=>c});const r="dim-red-preprocessing-function",i="supportedSemTypes",s="supportedTypes",o="supportedUnits",a="supportedDistanceFunctions",c="bypassLargeDataWarning",l="show-scatterplot-progress"},6863:(e,t,n)=>{"use strict";function r(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,r=Math.min(...Object.keys(t).map((e=>e.charCodeAt(0))))+1,i=new Float32Array((n.length+r)*(n.length+r));return Object.entries(t).forEach((([e,r])=>{const s=n[r];Object.entries(t).forEach((([t,r])=>{i[e.charCodeAt(0)*n.length+t.charCodeAt(0)]=s[r]}))})),(e,t)=>1-i[e.charCodeAt(0)*n.length+t.charCodeAt(0)]}(),n=e?.threshold??0;return(e,r)=>{let i=0;const s=e.length,o=r.length,a=Math.ceil(Math.max(s,o)*(1-n));s!==o&&(i=Math.abs(s-o));let c=0;for(let n=0;n<Math.min(s,o);n++)if(e[n]!==r[n]&&(c+=t(e[n],r[n]),c>a))return 1;return c+=i,c/=Math.max(s,o),c}}n.d(t,{Z:()=>o,V:()=>a});var i=n(2787);const s={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]:r,[o.LEVENSHTEIN]:function(){return(e,t)=>(0,i.I)(e,t)/Math.max(e.length,t.length)},[o.NEEDLEMANN_WUNSCH]:function(e){const t=new Uint16Array(65536),{gapOpen:n,gapExtend:r,scoringMatrix:i,alphabetIndexes:o}={...s,...e};Object.entries(o).forEach((([e,n])=>t[e.charCodeAt(0)]=n));const a=[new Float32Array(1e4),new Float32Array(1e4)];return(e,s)=>{const o=new Array(e.length+1).fill(!1),c=new Array(e.length+1).fill(!1);let l=0,u=1;for(let t=1;t<e.length+1;t++)a[0][t]=-r-(t-1)*r,a[1][t]=0;a[0][0]=0;for(let d=1;d<s.length+1;d++){a[u][0]=-r-(d-1)*r;for(let h=1;h<e.length+1;h++){const p=a[l][h-1]+i[t[e.charCodeAt(h-1)]][t[s.charCodeAt(d-1)]],m=a[l][h]-(o[h]||1===d||d===s.length?r:n),f=a[u][h-1]-(c[h-1]||1===h||h===e.length?r:n);a[u][h]=Math.max(p,f,m),a[u][h]===p?(o[h]=!1,c[h]=!1):a[u][h]===f?(o[h]=!1,c[h]=!0):(o[h]=!0,c[h]=!1)}l=u,u=(u+1)%2}const d=Math.min(e.length,s.length);return(d-a[l][e.length])/d}},[o.MONOMER_CHEMICAL_DISTANCE]:r}},9039:(e,t,n)=>{"use strict";var r;n.d(t,{c:()=>r}),function(e){e.UMAP="UMAP",e.T_SNE="t-SNE"}(r||(r={}))},8498:(e,t,n)=>{"use strict";var r,i,s,o,a,c,l;n.d(t,{EG:()=>a,Pn:()=>i,RR:()=>c,Wn:()=>l,aT:()=>s,m6:()=>o,xL:()=>r}),function(e){e.Levenshtein="Levenshtein",e.JaroWinkler="Jaro-Winkler",e.Manhattan="Manhattan",e.Onehot="One-Hot"}(r||(r={})),function(e){e.Euclidean="Euclidean"}(i||(i={})),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"}(s||(s={})),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"}(c||(c={})),function(e){e.CommonItems="Common Items"}(l||(l={}))},2780:(e,t,n)=>{"use strict";n.d(t,{aT:()=>r.aT});var r=n(8498);n(9336)},9336:(e,t,n)=>{"use strict";var r=n(2787),i=n(944),s=n(6295),o=n(3629),a=n(6863),c=n(8498);const l={[c.Pn.Euclidean]:o.ou},u={[c.xL.Levenshtein]:r.I,[c.xL.JaroWinkler]:i.Vb,[c.xL.Manhattan]:function(e,t){if(e.length!==t.length)return 1;{let n=0;for(let r=1;r<e.length;r++)n+=e[r]==t[r]?0:1;return n/e.length}},[c.xL.Onehot]:function(e,t){return e===t?0:1}},d={[c.aT.Tanimoto]:s.tO,[c.aT.Dice]:s.zn,[c.aT.Asymmetric]:s.gt,[c.aT.BraunBlanquet]:s.ij,[c.aT.Cosine]:s.lO,[c.aT.Kulczynski]:s.rR,[c.aT.McConnaughey]:s.lP,[c.aT.RogotGoldberg]:s.TK,[c.aT.Russel]:s.yK,[c.aT.Sokal]:s.Ii,[c.aT.Hamming]:s.be,[c.aT.Euclidean]:s.a4},h={[c.m6.TanimotoIntArray]:s.v_},p={[c.RR.Difference]:s.T6},m={[c.Wn.CommonItems]:s.Hr},f={[c.EG.Vector]:{[c.Pn.Euclidean]:l[c.Pn.Euclidean]},[c.EG.String]:{[c.xL.Levenshtein]:u[c.xL.Levenshtein],[c.xL.JaroWinkler]:u[c.xL.JaroWinkler],[c.xL.Manhattan]:u[c.xL.Manhattan],[c.xL.Onehot]:u[c.xL.Onehot]},[c.EG.BitArray]:{[c.aT.Tanimoto]:d[c.aT.Tanimoto],[c.aT.Dice]:d[c.aT.Dice],[c.aT.Asymmetric]:d[c.aT.Asymmetric],[c.aT.BraunBlanquet]:d[c.aT.BraunBlanquet],[c.aT.Cosine]:d[c.aT.Cosine],[c.aT.Kulczynski]:d[c.aT.Kulczynski],[c.aT.McConnaughey]:d[c.aT.McConnaughey],[c.aT.RogotGoldberg]:d[c.aT.RogotGoldberg],[c.aT.Russel]:d[c.aT.Russel],[c.aT.Sokal]:d[c.aT.Sokal]},[c.EG.MacroMolecule]:{[a.Z.HAMMING]:a.V[a.Z.HAMMING],[a.Z.LEVENSHTEIN]:a.V[a.Z.LEVENSHTEIN],[a.Z.NEEDLEMANN_WUNSCH]:a.V[a.Z.NEEDLEMANN_WUNSCH],[a.Z.MONOMER_CHEMICAL_DISTANCE]:a.V[a.Z.MONOMER_CHEMICAL_DISTANCE]},[c.EG.Number]:{[c.RR.Difference]:p[c.RR.Difference]},[c.EG.IntArray]:{[c.m6.TanimotoIntArray]:h[c.m6.TanimotoIntArray]},[c.EG.NumberArray]:{[c.Wn.CommonItems]:m[c.Wn.CommonItems]}};Object.keys(f).reduce(((e,t)=>{for(const n of Object.keys(f[t]))e[n]=t;return e}),{})},8774:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});class r{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,i=r._createBuffer(n);if(t)for(let e=0;e<i.length;e++)i[e]=-1;this._data=i,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,r){if(e<t||e>n)throw new Error(`Argument ${r} (${e}) out of range (${t}, ${n})`)}copy(e,t,n){for(let r=0;r<n;r++)t[r]=e[r]}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 r(e._length);n._length=e._length,n._data=r._createBuffer(n._length),n._version=0;const i=e.lengthInInts;for(let r=0;r<i;r++)n._data[r]=e._data[r]&t._data[r];return n}static _createBuffer(e){return new Uint32Array(Math.floor((e+31)/32))}static fromValues(e){const t=new r(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 r(e);for(let r=0;r<e;++r)n.setBit(r,t(r));return n._version=0,n}static fromString(e){return r.fromSeq(e.length,(t=>"1"==e.charAt(t)))}static fromUint32Array(e,t){const n=new r(e);return n._data=t,n}static fromBytes(e){const t=e.length,n=new r(8*t);n._data=new Uint32Array(Math.floor((t+3)/4)),n._length=8*t;let i=0,s=0;for(;t-s>=4;)n._data[i++]=255&e[s]|(255&e[s+1])<<8|(255&e[s+2])<<16|(255&e[s+3])<<24,s+=4;return t-s==3&&(n._data[i]=(255&e[s+2])<<16),t-s==2&&(n._data[i]|=(255&e[s+1])<<8),t-s==1&&(n._data[i]|=255&e[s]),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 r(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,r=this.lengthInInts;for(let e=0;e<r;e++)this._data[e]=n;this.incrementVersion(t)}setIndexes(e,t=!0,n=!0,r=!0){n&&this.setAll(!t,!1);for(const n of e)this.setFast(n,t);this.incrementVersion(r)}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,r=!0,i=!0){if(n&&i&&this.setAll(!t,!1),i)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(r)}getRange(e,t){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length,"to");const n=[];for(let r=e;r<t;++r)n.push(this.getBit(r));return r.fromValues(n)}getRangeAsList(e,t){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length,"to");const n=[];for(let r=e;r<t;++r)n.push(this.getBit(r));return n}setRange(e,t,n,r=!0){this.assureInRange(e,0,this._length-1,"from"),this.assureInRange(t,0,this._length-1,"to");const i=Math.min(e,t),s=Math.max(e,t);if(n)for(let e=i;e<=s;e++)this.setTrue(e);else for(let e=i;e<=s;e++)this.setFalse(e);return this.incrementVersion(r),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 r=this._length;this.setLength(this._length+t);for(let n=r-1;n>=e;n--)this.setBit(n+t,this.getBit(n));for(let r=e;r<e+t;r++)this.setBit(r,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 r=-1;-1!=(r=e.findNext(r,!t));)this.setFast(n++,this.getBit(r));this._length=n,this._version++}return this}getBit(e){return!!(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+=r._onBitCount[255&e];let n=this._data[t];const i=31&this._length;for(0!=i&&(n&=~(4294967295<<i));0!=n;n>>>=8)this._selectedCount+=r._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 i=this.lengthInInts;let s=0;for(;s<i-1;s++)for(let t=this._data[s]&e._data[s];0!=t;t>>>=8)n+=r._onBitCount[255&t];let o=this._data[s]&e._data[s];const a=31&this._length;for(0!=a&&(o&=~(4294967295<<a));0!=o;o>>>=8)n+=r._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 i=this.lengthInInts;for(let s=Math.floor(e/32);s<i;s++){let i=t?this._data[s]:~this._data[s];if(0!=n)i&=4294967295<<n&4294967295,n=0;else if(!t&&-4294967296==i)continue;for(let t=0;0!=i;t+=8,i>>>=8){const n=r._firstOnBit[255&i];if(n>=0)return(e=n+32*s+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 i=Math.floor(e/32);i>=0;i--){let e=t?this._data[i]:~this._data[i];0!=n&&(e&=~(4294967295<<n),n=0);for(let t=24;0!=e;t-=8,e<<=8){const n=r._lastOnBit[e>>>24];if(n>=0)return n+32*i+t}}return-1}}r._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]),r._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]),r._lastOnBit=Int8Array.from([-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7])},8070:(e,t,n)=>{"use strict";n.d(t,{Pl:()=>H,bk:()=>B,gM:()=>G,L1:()=>k,cb:()=>Y,E3:()=>L,J6:()=>O,Wj:()=>I,Xk:()=>R,N$:()=>F,t6:()=>N,PE:()=>M,rd:()=>$,Bl:()=>K,CN:()=>b});var r=n(4328),i=n(6082);n(9982);const s=i.DataFrame.fromCsv('countries,fasta,smiles,molregno,LON,Zip Code,Street Address Line 1,ImageUrl,user_id,error_message,xray,flag,magnitude,CS-id,pdb_id,accel_a,time_offset,chart,fit,Questions,empty_number,empty_string\nBelgium,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C(=O)OCCCc1cccnc1)c2cccc(c2)C(=O)c3ccccc3,1480014,36.276729583740234,995042300,14016 ROUTE 31W,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,1,1,1QBS,1,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.497360340644872, 1.7058694986686864, 5.278052678195135, 0.16000320889028383],""points"":[{""x"":0.10000000149011612,""y"":2.374499797821045},{""x"":0.6000000238418579,""y"":2.6242473125457764},{""x"":1.100000023841858,""y"":2.367267608642578},{""x"":1.600000023841858,""y"":2.6723148822784424},{""x"":2.0999999046325684,""y"":2.6537344455718994},{""x"":2.5999999046325684,""y"":2.3651671409606934},{""x"":3.0999999046325684,""y"":2.5654284954071045},{""x"":3.5999999046325684,""y"":2.4160959720611572},{""x"":4.099999904632568,""y"":2.286726713180542},{""x"":4.599999904632568,""y"":2.5100042819976807},{""x"":5.099999904632568,""y"":1.6676985025405884},{""x"":5.599999904632568,""y"":0.680136501789093},{""x"":6.099999904632568,""y"":0.3391543924808502},{""x"":6.599999904632568,""y"":0.09038983285427094},{""x"":7.099999904632568,""y"":0.19802775979042053}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[7.525235855508179, 1.3186911876809984, 5.335672608564294, 0.7860743343958098],""points"":[{""x"":0.10000000149011612,""y"":7.988070487976074},{""x"":0.6000000238418579,""y"":7.018453121185303},{""x"":1.100000023841858,""y"":8.115279197692871},{""x"":1.600000023841858,""y"":7.486658096313477},{""x"":2.0999999046325684,""y"":7.396438121795654},{""x"":2.5999999046325684,""y"":7.477052211761475},{""x"":3.0999999046325684,""y"":6.913095474243164},{""x"":3.5999999046325684,""y"":8.01385498046875},{""x"":4.099999904632568,""y"":6.985900402069092},{""x"":4.599999904632568,""y"":6.970335960388184},{""x"":5.099999904632568,""y"":5.448817253112793},{""x"":5.599999904632568,""y"":2.5534818172454834},{""x"":6.099999904632568,""y"":1.893947958946228},{""x"":6.599999904632568,""y"":0.6340042352676392},{""x"":7.099999904632568,""y"":0.8403874039649963}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,100,abc\nBurundi,MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW,COc1ccc2cc(ccc2c1)C(C)C(=O)Oc3ccc(C)cc3OC,1480015,36.276729583740234,995073444,80 STATE HIGHWAY 310,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,2,2,1ZP8,2,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.431460753103398, 2.1691498799246745, 5.266445597102774, 0.7825762827017926],""points"":[{""x"":0.10000000149011612,""y"":4.751083850860596},{""x"":0.6000000238418579,""y"":4.203000068664551},{""x"":1.100000023841858,""y"":4.415858745574951},{""x"":1.600000023841858,""y"":4.68414306640625},{""x"":2.0999999046325684,""y"":4.198400974273682},{""x"":2.5999999046325684,""y"":4.179222106933594},{""x"":3.0999999046325684,""y"":4.638473987579346},{""x"":3.5999999046325684,""y"":4.708553314208984},{""x"":4.099999904632568,""y"":4.291589260101318},{""x"":4.599999904632568,""y"":4.038082599639893},{""x"":5.099999904632568,""y"":3.4349939823150635},{""x"":5.599999904632568,""y"":1.2194708585739136},{""x"":6.099999904632568,""y"":1.1920831203460693},{""x"":6.599999904632568,""y"":0.5352635979652405},{""x"":7.099999904632568,""y"":0.3346920311450958}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.339458017970126, -1.0734184310171178, 4.746332950550934, 0.2482416857595658],""points"":[{""x"":0.10000000149011612,""y"":0.2139337658882141},{""x"":0.6000000238418579,""y"":0.4269562065601349},{""x"":1.100000023841858,""y"":0.2441573292016983},{""x"":1.600000023841858,""y"":0.146635964512825},{""x"":2.0999999046325684,""y"":0.08818462491035461},{""x"":2.5999999046325684,""y"":0.2560656666755676},{""x"":3.0999999046325684,""y"":0.42434045672416687},{""x"":3.5999999046325684,""y"":0.37111231684684753},{""x"":4.099999904632568,""y"":0.5581737160682678},{""x"":4.599999904632568,""y"":1.183590054512024},{""x"":5.099999904632568,""y"":1.5629843473434448},{""x"":5.599999904632568,""y"":2.3211288452148438},{""x"":6.099999904632568,""y"":2.229961633682251},{""x"":6.599999904632568,""y"":2.2560226917266846},{""x"":7.099999904632568,""y"":2.2142398357391357}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCameroon,MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL,COc1ccc2cc(ccc2c1)C(C)C(=O)OCCCc3cccnc3,1480016,36.26095962524414,995153596,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,3,3,2BDJ,3,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.6760652578642325, 0.9046956320756703, 5.651408971856738, 0.07738846012184185],""points"":[{""x"":0.10000000149011612,""y"":4.32425594329834},{""x"":0.6000000238418579,""y"":4.668442249298096},{""x"":1.100000023841858,""y"":4.379785060882568},{""x"":1.600000023841858,""y"":5.0345139503479},{""x"":2.0999999046325684,""y"":4.878653526306152},{""x"":2.5999999046325684,""y"":4.3451313972473145},{""x"":3.0999999046325684,""y"":4.336992263793945},{""x"":3.5999999046325684,""y"":5.037430286407471},{""x"":4.099999904632568,""y"":5.0092692375183105},{""x"":4.599999904632568,""y"":4.151902675628662},{""x"":5.099999904632568,""y"":3.4066951274871826},{""x"":5.599999904632568,""y"":2.3732759952545166},{""x"":6.099999904632568,""y"":1.673728108406067},{""x"":6.599999904632568,""y"":0.48574790358543396},{""x"":7.099999904632568,""y"":0.2783052325248718}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.938395863010111, -1.4658480661392117, 5.462702751996584, 0.3473139023615039],""points"":[{""x"":0.10000000149011612,""y"":0.4941710829734802},{""x"":0.6000000238418579,""y"":0.15323974192142487},{""x"":1.100000023841858,""y"":0.46373432874679565},{""x"":1.600000023841858,""y"":0.3370431363582611},{""x"":2.0999999046325684,""y"":0.5179030299186707},{""x"":2.5999999046325684,""y"":0.27899765968322754},{""x"":3.0999999046325684,""y"":0.22075064480304718},{""x"":3.5999999046325684,""y"":0.5789918899536133},{""x"":4.099999904632568,""y"":0.21169911324977875},{""x"":4.599999904632568,""y"":0.27857646346092224},{""x"":5.099999904632568,""y"":1.0906332731246948},{""x"":5.599999904632568,""y"":1.8520300388336182},{""x"":6.099999904632568,""y"":2.7177059650421143},{""x"":6.599999904632568,""y"":2.8680918216705322},{""x"":7.099999904632568,""y"":3.2413077354431152}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCanada,MMELVLKTIIGPIVVGVVLRIVDKWLNKDK,CC(C(=O)NCCS)c1cccc(c1)C(=O)c2ccccc2,1480017,36.26095962524414,99515,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,4,4,1IAN,4,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[0.8597390975430008, 1.0957625732481946, 5.260537067987958, 0.07974187998177736],""points"":[{""x"":0.10000000149011612,""y"":0.8190152645111084},{""x"":0.6000000238418579,""y"":0.8421689867973328},{""x"":1.100000023841858,""y"":0.8740922212600708},{""x"":1.600000023841858,""y"":0.8924275040626526},{""x"":2.0999999046325684,""y"":0.8249067664146423},{""x"":2.5999999046325684,""y"":0.9327669143676758},{""x"":3.0999999046325684,""y"":0.8522974252700806},{""x"":3.5999999046325684,""y"":0.8174492716789246},{""x"":4.099999904632568,""y"":0.8394647240638733},{""x"":4.599999904632568,""y"":0.7139387726783752},{""x"":5.099999904632568,""y"":0.5561167597770691},{""x"":5.599999904632568,""y"":0.3276226818561554},{""x"":6.099999904632568,""y"":0.12479474395513535},{""x"":6.599999904632568,""y"":0.13006797432899475},{""x"":7.099999904632568,""y"":0.059702079743146896}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.760930219582546, 1.6591793293833013, 4.667155929720851, 0.7858109544121652],""points"":[{""x"":0.10000000149011612,""y"":6.156993389129639},{""x"":0.6000000238418579,""y"":5.236701965332031},{""x"":1.100000023841858,""y"":6.010560512542725},{""x"":1.600000023841858,""y"":5.495512962341309},{""x"":2.0999999046325684,""y"":6.087770462036133},{""x"":2.5999999046325684,""y"":5.79986572265625},{""x"":3.0999999046325684,""y"":5.597546577453613},{""x"":3.5999999046325684,""y"":5.520902156829834},{""x"":4.099999904632568,""y"":5.360654354095459},{""x"":4.599999904632568,""y"":3.5539746284484863},{""x"":5.099999904632568,""y"":1.577236294746399},{""x"":5.599999904632568,""y"":1.0001264810562134},{""x"":6.099999904632568,""y"":0.9305797815322876},{""x"":6.599999904632568,""y"":0.6033638715744019},{""x"":7.099999904632568,""y"":0.4203685522079468}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nColombia,MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN,FC(F)(F)c1ccc(OC2CCNCC2)cc1,1480029,36.3309440612793,995152050,1 COURT HOUSE SQUARE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,5,5,4UJ1,5,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[6.4995088314153655, 2.4270351004539914, 5.178659535348579, 0.625653346241577],""points"":[{""x"":0.10000000149011612,""y"":6.496231555938721},{""x"":0.6000000238418579,""y"":6.42543363571167},{""x"":1.100000023841858,""y"":7.040063858032227},{""x"":1.600000023841858,""y"":6.1115403175354},{""x"":2.0999999046325684,""y"":6.680728435516357},{""x"":2.5999999046325684,""y"":6.406774520874023},{""x"":3.0999999046325684,""y"":6.611269474029541},{""x"":3.5999999046325684,""y"":5.889094352722168},{""x"":4.099999904632568,""y"":6.75344705581665},{""x"":4.599999904632568,""y"":6.361435890197754},{""x"":5.099999904632568,""y"":4.1666975021362305},{""x"":5.599999904632568,""y"":1.172118902206421},{""x"":6.099999904632568,""y"":0.801048994064331},{""x"":6.599999904632568,""y"":0.4640021026134491},{""x"":7.099999904632568,""y"":0.0010357667924836278}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[1.4734381347446401, 1.1649805188074196, 4.82958608866421, 0.09500545496710007],""points"":[{""x"":0.10000000149011612,""y"":1.5279096364974976},{""x"":0.6000000238418579,""y"":1.3559974431991577},{""x"":1.100000023841858,""y"":1.5246378183364868},{""x"":1.600000023841858,""y"":1.5567657947540283},{""x"":2.0999999046325684,""y"":1.4114240407943726},{""x"":2.5999999046325684,""y"":1.4045010805130005},{""x"":3.0999999046325684,""y"":1.4769829511642456},{""x"":3.5999999046325684,""y"":1.4875500202178955},{""x"":4.099999904632568,""y"":1.2991987466812134},{""x"":4.599999904632568,""y"":0.922961413860321},{""x"":5.099999904632568,""y"":0.6520044803619385},{""x"":5.599999904632568,""y"":0.15350978076457977},{""x"":6.099999904632568,""y"":0.1078903079032898},{""x"":6.599999904632568,""y"":0.17276449501514435},{""x"":7.099999904632568,""y"":0.14066608250141144}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCosta Rica,MKSTKEEIQTIKTLLKDSRTAKYHKRLQIVL,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCCc3ccccc3,1480018,36.3309440612793,995084218,4041 SOUTHWESTERN BLVD,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,6,6,2BPW,6,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.4833641843311227, -1.8945978742090062, 4.671127708092568, 0.24159861311815153],""points"":[{""x"":0.10000000149011612,""y"":0.0969524160027504},{""x"":0.6000000238418579,""y"":0.028483040630817413},{""x"":1.100000023841858,""y"":0.22087176144123077},{""x"":1.600000023841858,""y"":0.0068915546871721745},{""x"":2.0999999046325684,""y"":0.4305879771709442},{""x"":2.5999999046325684,""y"":0.44774115085601807},{""x"":3.0999999046325684,""y"":0.45346319675445557},{""x"":3.5999999046325684,""y"":0.2370593100786209},{""x"":4.099999904632568,""y"":0.4657953977584839},{""x"":4.599999904632568,""y"":1.155200719833374},{""x"":5.099999904632568,""y"":2.2294070720672607},{""x"":5.599999904632568,""y"":2.4311530590057373},{""x"":6.099999904632568,""y"":2.33846116065979},{""x"":6.599999904632568,""y"":2.608201026916504},{""x"":7.099999904632568,""y"":2.8136143684387207}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.224573521642033, 1.4454033924198528, 5.6014197746076535, 0.2823216054197577],""points"":[{""x"":0.10000000149011612,""y"":4.95027494430542},{""x"":0.6000000238418579,""y"":5.1754679679870605},{""x"":1.100000023841858,""y"":5.276752948760986},{""x"":1.600000023841858,""y"":5.589294910430908},{""x"":2.0999999046325684,""y"":5.616994857788086},{""x"":2.5999999046325684,""y"":5.120813846588135},{""x"":3.0999999046325684,""y"":5.340766906738281},{""x"":3.5999999046325684,""y"":4.876471042633057},{""x"":4.099999904632568,""y"":4.94999361038208},{""x"":4.599999904632568,""y"":5.162564754486084},{""x"":5.099999904632568,""y"":4.399557590484619},{""x"":5.599999904632568,""y"":2.7977969646453857},{""x"":6.099999904632568,""y"":1.0229872465133667},{""x"":6.599999904632568,""y"":0.48275601863861084},{""x"":7.099999904632568,""y"":0.10408931970596313}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCuba,MHAILRYFIRRLFYHIFYKIYSLISKKHQSLPSDVRQF,COc1ccc2c(c1)c(CC(=O)N3CCCC3C(=O)Oc4ccc(C)cc4OC)c(C)n2C(=O)c5ccc(Cl)cc5,1480019,36.33115768432617,995081928,1227 US HIGHWAY 11,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,7,7,1QBS,7,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.320838679713925, -1.2421619987316728, 4.831325425225256, 0.3236011098403072],""points"":[{""x"":0.10000000149011612,""y"":0.3727470338344574},{""x"":0.6000000238418579,""y"":0.12365014106035233},{""x"":1.100000023841858,""y"":0.48422467708587646},{""x"":1.600000023841858,""y"":0.2264465093612671},{""x"":2.0999999046325684,""y"":0.16821794211864471},{""x"":2.5999999046325684,""y"":0.3879014551639557},{""x"":3.0999999046325684,""y"":0.5470244884490967},{""x"":3.5999999046325684,""y"":0.3419053554534912},{""x"":4.099999904632568,""y"":0.7655120491981506},{""x"":4.599999904632568,""y"":1.2346516847610474},{""x"":5.099999904632568,""y"":2.453336715698242},{""x"":5.599999904632568,""y"":2.9565491676330566},{""x"":6.099999904632568,""y"":3.335299491882324},{""x"":6.599999904632568,""y"":3.240290880203247},{""x"":7.099999904632568,""y"":3.1107218265533447}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.6401853521511094, 1.26211588875013, 5.399028074402744, 0.5089580830068091],""points"":[{""x"":0.10000000149011612,""y"":3.8585598468780518},{""x"":0.6000000238418579,""y"":3.6077206134796143},{""x"":1.100000023841858,""y"":3.855252265930176},{""x"":1.600000023841858,""y"":3.619039297103882},{""x"":2.0999999046325684,""y"":3.839388370513916},{""x"":2.5999999046325684,""y"":3.335283041000366},{""x"":3.0999999046325684,""y"":3.571141481399536},{""x"":3.5999999046325684,""y"":3.4155046939849854},{""x"":4.099999904632568,""y"":3.7316646575927734},{""x"":4.599999904632568,""y"":3.0680155754089355},{""x"":5.099999904632568,""y"":2.891066551208496},{""x"":5.599999904632568,""y"":1.6022753715515137},{""x"":6.099999904632568,""y"":0.7652576565742493},{""x"":6.599999904632568,""y"":0.6875326037406921},{""x"":7.099999904632568,""y"":0.5828871726989746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nItaly,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO[N+](=O)[O-],1480020,36.33115768432617,99502,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,8,8,1ZP8,8,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.293592105923809, 1.3781586549141835, 5.1025898038676605, 0.03493851245291291],""points"":[{""x"":0.10000000149011612,""y"":2.1287283897399902},{""x"":0.6000000238418579,""y"":2.267972230911255},{""x"":1.100000023841858,""y"":2.398442506790161},{""x"":1.600000023841858,""y"":2.5130622386932373},{""x"":2.0999999046325684,""y"":2.3255116939544678},{""x"":2.5999999046325684,""y"":2.127340793609619},{""x"":3.0999999046325684,""y"":2.47259783744812},{""x"":3.5999999046325684,""y"":2.131181478500366},{""x"":4.099999904632568,""y"":2.090421438217163},{""x"":4.599999904632568,""y"":2.02299165725708},{""x"":5.099999904632568,""y"":1.1105059385299683},{""x"":5.599999904632568,""y"":0.4494485855102539},{""x"":6.099999904632568,""y"":0.1375635862350464},{""x"":6.599999904632568,""y"":0.036351121962070465},{""x"":7.099999904632568,""y"":0.1619771122932434}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.953125499439879, 1.2528620255306528, 5.187637440149802, 0.3110348753260886],""points"":[{""x"":0.10000000149011612,""y"":5.6585283279418945},{""x"":0.6000000238418579,""y"":5.911152362823486},{""x"":1.100000023841858,""y"":5.924920082092285},{""x"":1.600000023841858,""y"":5.8469438552856445},{""x"":2.0999999046325684,""y"":5.929472923278809},{""x"":2.5999999046325684,""y"":6.190037727355957},{""x"":3.0999999046325684,""y"":6.236179828643799},{""x"":3.5999999046325684,""y"":6.141019344329834},{""x"":4.099999904632568,""y"":5.295210838317871},{""x"":4.599999904632568,""y"":5.265801906585693},{""x"":5.099999904632568,""y"":3.3722851276397705},{""x"":5.599999904632568,""y"":1.8299226760864258},{""x"":6.099999904632568,""y"":0.32690900564193726},{""x"":6.599999904632568,""y"":0.6274543404579163},{""x"":7.099999904632568,""y"":0.8441857099533081}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nRwanda,MPNSEPASLLELFNSIATQGELVRSLKAGNASK,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO,1480021,36.33137130737305,995037247,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,9,2BDJ,9,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.8209972202654474, 1.3779216716448506, 5.299882228439686, 0.06040645519069608],""points"":[{""x"":0.10000000149011612,""y"":3.7821109294891357},{""x"":0.6000000238418579,""y"":3.542433023452759},{""x"":1.100000023841858,""y"":3.7008674144744873},{""x"":1.600000023841858,""y"":3.717301607131958},{""x"":2.0999999046325684,""y"":4.024452209472656},{""x"":2.5999999046325684,""y"":4.013899326324463},{""x"":3.0999999046325684,""y"":3.945094347000122},{""x"":3.5999999046325684,""y"":3.866621971130371},{""x"":4.099999904632568,""y"":3.7461626529693604},{""x"":4.599999904632568,""y"":3.3454740047454834},{""x"":5.099999904632568,""y"":2.61944317817688},{""x"":5.599999904632568,""y"":0.999405026435852},{""x"":6.099999904632568,""y"":0.46259793639183044},{""x"":6.599999904632568,""y"":0.054134611040353775},{""x"":7.099999904632568,""y"":0.05711187422275543}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.6318079657726035, 1.8495493770000595, 5.391793312471116, 0.17060707587348442],""points"":[{""x"":0.10000000149011612,""y"":5.458079814910889},{""x"":0.6000000238418579,""y"":5.554427146911621},{""x"":1.100000023841858,""y"":5.799983024597168},{""x"":1.600000023841858,""y"":5.364140033721924},{""x"":2.0999999046325684,""y"":5.864485740661621},{""x"":2.5999999046325684,""y"":5.4509806632995605},{""x"":3.0999999046325684,""y"":5.702574729919434},{""x"":3.5999999046325684,""y"":5.7314534187316895},{""x"":4.099999904632568,""y"":5.5123443603515625},{""x"":4.599999904632568,""y"":5.724395751953125},{""x"":5.099999904632568,""y"":4.354506969451904},{""x"":5.599999904632568,""y"":1.7307666540145874},{""x"":6.099999904632568,""y"":0.6305936574935913},{""x"":6.599999904632568,""y"":0.035183437168598175},{""x"":7.099999904632568,""y"":0.7575169205665588}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nSwitzerland,IRVVGRYLIEVWKAAGMDMDKVLFLWSSDEI,CN1CCC(CC1)Oc2ccc(cc2)C(F)(F)F,1480028,36.33137130737305,99504,92-11 179TH PLACE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,10,1IAN,10,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[1.1190255865097471, 2.3163895161544437, 5.4968866182279195, 0.2035204047289052],""points"":[{""x"":0.10000000149011612,""y"":1.1057683229446411},{""x"":0.6000000238418579,""y"":1.1019697189331055},{""x"":1.100000023841858,""y"":1.0818607807159424},{""x"":1.600000023841858,""y"":1.062997817993164},{""x"":2.0999999046325684,""y"":1.046447515487671},{""x"":2.5999999046325684,""y"":1.1217249631881714},{""x"":3.0999999046325684,""y"":1.2166996002197266},{""x"":3.5999999046325684,""y"":1.215477705001831},{""x"":4.099999904632568,""y"":1.0581893920898438},{""x"":4.599999904632568,""y"":1.1747995615005493},{""x"":5.099999904632568,""y"":1.0181127786636353},{""x"":5.599999904632568,""y"":0.5344523191452026},{""x"":6.099999904632568,""y"":0.2569526433944702},{""x"":6.599999904632568,""y"":0.1912207305431366},{""x"":7.099999904632568,""y"":0.15060538053512573}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.1038581025805785, 2.0032224204185245, 5.087602825989163, 0.13277988512492753],""points"":[{""x"":0.10000000149011612,""y"":3.0498509407043457},{""x"":0.6000000238418579,""y"":2.805217742919922},{""x"":1.100000023841858,""y"":3.3415253162384033},{""x"":1.600000023841858,""y"":3.0549843311309814},{""x"":2.0999999046325684,""y"":3.250074863433838},{""x"":2.5999999046325684,""y"":3.0432586669921875},{""x"":3.0999999046325684,""y"":3.265852451324463},{""x"":3.5999999046325684,""y"":2.9475724697113037},{""x"":4.099999904632568,""y"":3.1929898262023926},{""x"":4.599999904632568,""y"":2.7460060119628906},{""x"":5.099999904632568,""y"":1.6175861358642578},{""x"":5.599999904632568,""y"":0.3006608486175537},{""x"":6.099999904632568,""y"":0.3444803059101105},{""x"":6.599999904632568,""y"":0.015537971630692482},{""x"":7.099999904632568,""y"":0.5527358055114746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\n,,,,,,,,,,,,,,,,,,,,,');s.columns.add(i.Column.fromList(i.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var o=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};function a(e,t,n,i,s,a,c,l,u=!0){return o(this,void 0,void 0,(function*(){let d=null;if(yield $(i,(n=>o(this,void 0,void 0,(function*(){let n=null;for(const r of e.viewers)r.type===t&&(n=r);if(!n)throw Error("Viewer hasn't been added");if(yield Promise.resolve(),a&&(yield a(n)),s){const t=null!=l?l:{};t.tv=e,t.viewer=n,d=yield s(t,u)}yield M(r.events.onViewerClosed,(()=>{L(n.subs.some((e=>!e.closed)),!1)}),(()=>n.close()),3e3)}))),(()=>o(this,void 0,void 0,(function*(){c?e.loadLayout(c):yield function(e,t,n){return o(this,void 0,void 0,(function*(){let r;return n?(r=yield e.dataFrame.plot.fromType(t),e.dockManager.dock(r)):r=e.addViewer(t),r}))}(e,t,n)}))),6e4,"TEST_EVENT_ASYNC"),d)return d}))}function c(e,t=!0){return o(this,void 0,void 0,(function*(){const n=e.tv.dataFrame,r=n.clone();Array.from(n.row(0).cells).forEach((e=>e.value=null));const i=n.rowCount<20?Math.floor(n.rowCount/2):10;n.rows.select((e=>e.idx>=0&&e.idx<i)),t&&(yield Y(50));for(let e=i;e<2*i;e++)n.filter.set(e,!1);t&&(yield Y(50)),n.currentRowIdx=1,n.columns.names().slice(0,Math.ceil(n.columns.length/2)).forEach((e=>n.columns.remove(e))),t&&(yield Y(100)),e.tv.dataFrame=r,yield Y(50)}))}function l(e,t=!0){return o(this,void 0,void 0,(function*(){const t=e.tv.dataFrame;setTimeout((()=>t.filter.set(0,!t.filter.get(0))),0)}))}function u(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 r={};return Object.keys(t).filter((e=>"boolean"==typeof t[e])).forEach((e=>r[e]=!t[e])),n.filter((e=>null!==e.choices)).forEach((e=>r[e.name]=e.choices.find((n=>n!==t[e.name])))),e.viewer.setOptions(r),yield Y(300),{layout:e.tv.saveLayout(),savedProps:e.viewer.getOptions().look}}))}function d(e,t=!0){return o(this,void 0,void 0,(function*(){L(JSON.stringify(e.viewer.getOptions().look),JSON.stringify(e.savedProps))}))}var h=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};const p=3e4,m=108e5,f=console.log.bind(console),g=console.info.bind(console),y=console.warn.bind(console),w=console.error.bind(console),b={},v="Auto Tests",A="Demo",E="Detectors",C="Core",T={};let S;var _;!function(e){e.notNull=function(e,t){if(null==e)throw new Error(`${null==t?"Value":t} not defined`)}}(_||(_={}));class P{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,r){var i;this.category=e,this.name=t,null!=r||(r={}),null!==(i=r.timeout)&&void 0!==i||(r.timeout=p),this.options=r,this.test=()=>h(this,void 0,void 0,(function*(){return new Promise(((e,t)=>h(this,void 0,void 0,(function*(){let r="";try{r=yield n()}catch(e){t(e)}e(r)}))))}))}}function M(e,t,n,r=0,i="timeout"){return h(this,void 0,void 0,(function*(){return new Promise(((s,o)=>{const a=e.subscribe((e=>{try{t(e),s("OK")}catch(e){o(e)}finally{a.unsubscribe(),clearTimeout(c)}})),c=setTimeout((()=>{a.unsubscribe(),o(i)}),r);n()}))}))}function $(e,t,n,r=0,i="timeout"){return h(this,void 0,void 0,(function*(){return new Promise(((s,o)=>{const a=e.subscribe((e=>{t(e).then((()=>{s("OK")})).catch((e=>{o(e)})).finally((()=>{a.unsubscribe(),clearTimeout(c)}))})),c=setTimeout((()=>{a.unsubscribe(),o(i)}),r);n()}))}))}function N(e,t,n){null==b[S]&&(b[S]={}),null==b[S].tests&&(b[S].tests=[]),b[S].tests.push(new x(S,e,t,n))}function L(e,t=!0,n){if(n=n?`${n}, `:"",e!==t)throw new Error(`${n}Expected "${t}", got "${e}"`)}function I(e,t,n=.001,r){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 i=Math.abs(e-t)<n;if(L(i,!0,`${null!=r?r:""} (tolerance = ${n})`),!i)throw new Error(`Expected ${t}, got ${e} (tolerance = ${n})`)}function R(e,t){for(const[n,r]of Object.entries(t)){if(!e.hasOwnProperty(n))throw new Error(`Expected property "${n}" not found`);const t=e[n];if(t instanceof Array&&r instanceof Array)O(t,r);else if(t instanceof Object&&r instanceof Object)R(t,r);else if(Number.isFinite(t)&&Number.isFinite(r))I(t,r);else if(t!=r)throw new Error(`Expected (${r}) for key '${n}', got (${t})`)}}function O(e,t){const n=e.length,r=t.length;if(n!=r)throw new Error(`Arrays are of different length: actual array length is ${n} and expected array length is ${r}`);for(let r=0;r<n;r++)if(e[r]instanceof Array&&t[r]instanceof Array)O(e[r],t[r]);else if(e[r]instanceof Object&&t[r]instanceof Object)R(e[r],t[r]);else if(e[r]!=t[r])throw new Error(`Expected ${t[r]} at position ${r}, got ${e[r]}`)}function k(e,t,n){var r;S=e,t(),b[S]&&(b[S].clear=null===(r=null==n?void 0:n.clear)||void 0===r||r,b[S].timeout=null==n?void 0:n.timeout,b[S].benchmarks=null==n?void 0:n.benchmarks,b[S].stressTests=null==n?void 0:n.stressTests)}function G(e){null==b[S]&&(b[S]={}),b[S].before=e}function H(e){null==b[S]&&(b[S]={}),b[S].after=e}function D(e,t){return e.replace(new RegExp(t.name,"gi"),t.nqName)}function F(e){var t,n,o,a;return h(this,void 0,void 0,(function*(){const c=null===(n=null===(t=r.functions.getCurrentCall())||void 0===t?void 0:t.func)||void 0===n?void 0:n.package;yield function(e){var t,n,o,a;return h(this,void 0,void 0,(function*(){const c=e.id;if(T[c])return;const l=b;if(void 0!==l[v]||void 0!==l[A]||Object.keys(l).find((e=>e.startsWith(v)||e.startsWith(C))))return void(T[c]=!0);if("DevTools"===e.name)for(const e of window.dartTests){const r=e.name.split(/\s*\|\s*!/g);let i=null!==(t=r.pop())&&void 0!==t?t:e.name,s=r.length?C+": "+r.join(": "):C,c=i.split(" | ");i=c[c.length-1],c.unshift(s),c.pop(),s=c.join(": "),void 0===l[s]&&(l[s]={tests:[],clear:!0}),l[s].tests.push(new x(s,i,e.test,{isAggregated:!1,timeout:null!==(o=null===(n=e.options)||void 0===n?void 0:n.timeout)&&void 0!==o?o:p,skipReason:null===(a=e.options)||void 0===a?void 0:a.skipReason}))}const u=[],d=[],m=[],f=yield r.dapi.functions.filter(`package.id = "${c}"`).list(),g=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)|timeout:\s*(\d+)/g);for(const e of f){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 s=t[n].matchAll(g),o={};Array.from(s).forEach((e=>{e[0].startsWith("skip")?o.skip=e[1]:e[0].startsWith("wait")?o.wait=parseInt(e[2]):e[0].startsWith("cat")?o.cat=e[3]:e[0].startsWith("timeout")&&(o.timeout=parseInt(e[4]))}));const a=new x(v,1===t.length?e.name:`${e.name} ${n+1}`,(()=>h(this,void 0,void 0,(function*(){const i=yield r.functions.eval(D(t[n],e));if(o.wait&&(yield Y(o.wait)),"boolean"==typeof i&&!i)throw`Failed: ${t[n]}, expected true, got ${i}`}))),{skipReason:o.skip,timeout:i.Test.isInBenchmark?o.benchmarkTimeout:o.timeout});if(o.cat){const e=v+": "+o.cat;a.category=e,void 0===l[e]&&(l[e]={tests:[],clear:!0}),l[e].tests.push(a)}else u.push(a)}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*(){r.shell.isInDemo=!0,void 0===r.shell.view(i.View.BROWSE)&&(r.shell.v=i.View.createByType(i.View.BROWSE)),yield Y(300),r.shell.clearLastError(),yield e.apply(),yield Y(t||2e3);const n=yield r.shell.lastError;if(n)throw new Error(n);r.shell.isInDemo=!1}))),{skipReason:e.options.demoSkip});d.push(n)}if(e.hasTag("semTypeDetector")){const t=new x(E,e.friendlyName,(()=>h(this,void 0,void 0,(function*(){const t=[];for(const n of s.clone().columns){const r=yield e.apply([n]);t.push(r||n.semType)}L(t.filter((e=>e)).length,1)}))),{skipReason:e.options.skipTest});m.push(t)}}T[c]=!0,u.length&&(l[v]={tests:u,clear:!0}),d.length&&(l[A]={tests:d,clear:!0}),m.length&&(l[E]={tests:m,clear:!1})}))}(c);const l=[];console.log("Running tests"),null!=e||(e={}),null!==(o=(a=e).testContext)&&void 0!==o||(a.testContext=new P),r.shell.clearLastError();const u=function(){const e=[];return console.log=(...t)=>{e.push(...t),f(...t)},console.info=(...t)=>{e.push(...t),g(...t)},console.warn=(...t)=>{e.push(...t),y(...t)},console.error=(...t)=>{e.push(...t),w(...t)},e}();(null==e?void 0:e.stressTest)?yield function(e){var t,n,r,s,o,a;return h(this,void 0,void 0,(function*(){let h=[];for(const[e,i]of Object.entries(b)){let e=null===(t=i.tests)||void 0===t?void 0:t.filter((e=>{var t;return null===(t=e.options)||void 0===t?void 0:t.stressTest}));i.stressTests&&(e=null===(n=i.tests)||void 0===n?void 0:n.filter((e=>{var t,n;return void 0===(null===(t=e.options)||void 0===t?void 0:t.stressTest)||!0===(null===(n=e.options)||void 0===n?void 0:n.stressTest)})));const o=null===(r=i.tests)||void 0===r?void 0:r.every((e=>{var t;return null===(t=e.options)||void 0===t?void 0:t.skipReason}));if(!o)for(let t of null!=e?e:[])null==(null===(s=t.options)||void 0===s?void 0:s.skipReason)&&h.push({test:t,value:i})}h=function(e){const t=e.slice();return t.sort((()=>Math.random()-.5)),t}(h);const p=[];for(let t of h){yield d(t.value.before,null!==(o=e.category)&&void 0!==o?o:"");let n=yield V(t.test,null==e?void 0:e.test,u,i.Test.isInBenchmark?t.value.benchmarkTimeout:t.value.timeout,c.name,e.verbose);n&&p.push(n),console.log(`Test: ${null==N?void 0:N.name}; result: ${n}`),yield d(t.value.after,null!==(a=e.category)&&void 0!==a?a:"")}l.push(...p)}))}(e):yield function(e,t){var n,s,o,a,p,m,b;return h(this,void 0,void 0,(function*(){try{for(const[h,g]of Object.entries(e)){if((null==t?void 0:t.category)&&!h.toLowerCase().startsWith(null==t?void 0:t.category.toLowerCase())||(null===(n=t.exclude)||void 0===n?void 0:n.some((e=>h.startsWith(e)))))continue;f(`Started ${h} category`);const e=null===(s=g.tests)||void 0===s?void 0:s.every((e=>{var t;return null===(t=e.options)||void 0===t?void 0:t.skipReason}));e||(g.beforeStatus=yield d(g.before,null!==(o=t.category)&&void 0!==o?o:""));const y=null!==(a=g.tests)&&void 0!==a?a:[],w=[];if(g.clear)for(let e=0;e<y.length;e++){y[e].options&&void 0===(null===(p=y[e].options)||void 0===p?void 0:p.benchmark)&&(y[e].options||(y[e].options={}),y[e].options.benchmark=null!==(m=g.benchmarks)&&void 0!==m&&m);let n=yield V(y[e],null==t?void 0:t.test,u,i.Test.isInBenchmark?g.benchmarkTimeout:g.timeout,c.name,t.verbose);n&&w.push(n),r.shell.closeAll(),i.Balloon.closeAll()}else for(let e=0;e<y.length;e++){let n=yield V(y[e],null==t?void 0:t.test,u,i.Test.isInBenchmark?g.benchmarkTimeout:g.timeout,c.name,t.verbose);n&&w.push(n)}const v=w.filter((e=>"skipped"!=e.result));e||(g.afterStatus=yield d(g.after,null!==(b=t.category)&&void 0!==b?b:"")),g.afterStatus&&v.push({date:(new Date).toISOString(),logs:"",category:h,name:"after",result:g.afterStatus,success:!1,ms:0,skipped:!1}),g.beforeStatus&&v.push({date:(new Date).toISOString(),logs:"",category:h,name:"before",result:g.beforeStatus,success:!1,ms:0,skipped:!1}),l.push(...v)}}finally{console.log=f,console.info=g,console.warn=y,console.error=w}if(t.testContext.catchUnhandled&&!i.Test.isInBenchmark){yield Y(1e3);const e=yield r.shell.lastError,t={logs:"",date:(new Date).toISOString(),category:"Unhandled exceptions",name:"Exception",result:null!=e?e:"",success:!e,ms:0,skipped:!1};l.push(t),t.package=c.name,null!=r.shell.reportTest?yield r.shell.reportTest("package",t):yield fetch(`${r.dapi.root}/log/tests/package`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(t)})}}))}(b,e);for(let e of l)e.result=e.result.toString().replace(/"/g,"'"),null!=e.logs&&(e.logs=e.logs.toString().replace(/"/g,"'"));return l;function d(e,t){return h(this,void 0,void 0,(function*(){var n=void 0;try{void 0!==e&&(yield W((()=>h(this,void 0,void 0,(function*(){yield e()}))),1e5,`before ${t}: timeout error`))}catch(e){n=yield U(e)}return n}))}}))}function U(e){return h(this,void 0,void 0,(function*(){return`${e.toString()}\n${e.stack?yield i.Logger.translateStackTrace(e.stack):""}`}))}function V(e,t,n,s,o,a){var c,l,u,d,g,y,b,v;return h(this,void 0,void 0,(function*(){let h;n.length=0;let A="package";const E=null!=t&&e.name.toLowerCase()!==t.toLowerCase();let C=(null===(c=e.options)||void 0===c?void 0:c.skipReason)||E,T=E?"skipped":null===(l=e.options)||void 0===l?void 0:l.skipReason;if(i.Test.isInBenchmark&&!(null===(u=e.options)||void 0===u?void 0:u.benchmark))return void f(`SKIPPED: ${e.category} ${e.name} doesnt available in benchmark mode`);C||f(`Started ${e.category} ${e.name}`);const S=Date.now();try{if(C)h={date:(new Date).toISOString(),success:!0,result:T,ms:0,skipped:!0};else{let t=(null===(d=e.options)||void 0===d?void 0:d.timeout)===p&&s?s:null===(g=e.options)||void 0===g?void 0:g.timeout;t=t===p&&i.Test.isInBenchmark?m:t,h={date:(new Date).toISOString(),success:!0,result:null!==(y=yield W(e.test,t))&&void 0!==y?y:"OK",ms:0,skipped:!1}}}catch(e){w(e),h={date:(new Date).toISOString(),success:!1,result:yield U(e),ms:0,skipped:!1}}if((null===(b=e.options)||void 0===b?void 0:b.isAggregated)&&h.result.constructor===i.DataFrame){const e=h.result.col("success");if(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()-S,C||f(`Finished ${e.category} ${e.name} for ${h.ms} ms`),h.category=e.category,h.name=e.name,!E){let t={success:h.success,result:h.result,ms:h.ms,skipped:h.skipped,package:o,category:e.category,name: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)}t.result instanceof i.DataFrame&&(t.result=JSON.stringify(null===(v=t.result)||void 0===v?void 0:v.toJson())||""),null!=r.shell.reportTest?yield r.shell.reportTest(A,t):yield fetch(`${r.dapi.root}/log/tests/${A}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(t)})}return h}))}function Y(e){return h(this,void 0,void 0,(function*(){yield new Promise((t=>setTimeout(t,e)))}))}function B(e,t="Timeout exceeded",n=500,r=50){return h(this,void 0,void 0,(function*(){return new Promise(((i,s)=>{setTimeout((()=>{clearInterval(o),s(new Error(t))}),n);const o=setInterval((()=>{e()&&(clearInterval(o),i())}),r)}))}))}function W(e,t,n="EXECUTION TIMEOUT"){return h(this,void 0,void 0,(function*(){let r=null;const i=new Promise(((e,i)=>{r=setTimeout((()=>{i(n)}),t)}));try{return yield Promise.race([e(),i])}finally{r&&clearTimeout(r)}}))}const j=i.DataFrame.fromColumns([i.Column.fromStrings("col",["val1","val2","val3"])]);function K(e,t,n){var i;return h(this,void 0,void 0,(function*(){const s=null!==(i=null==n?void 0:n.packageName)&&void 0!==i?i:"";(null==n?void 0:n.detectSemanticTypes)&&(yield r.data.detectSemanticTypes(t));const o=r.shell.addTableView(t);try{yield a(o,e,s,r.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(o,e,s,r.events.onViewerAdded,void 0,n.awaitViewer)),(null==n?void 0:n.readOnly)||(yield a(o,e,s,r.events.onViewerAdded,c),(null==n?void 0:n.awaitViewer)&&(yield a(o,e,s,r.events.onViewerAdded,c,n.awaitViewer)));let t=null;t=yield a(o,e,s,r.events.onViewerAdded,u),(null==n?void 0:n.awaitViewer)&&(t=yield a(o,e,s,r.events.onViewerAdded,u,n.awaitViewer)),yield a(o,e,s,r.events.onViewLayoutApplied,d,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,s,r.events.onViewLayoutApplied,d,n.awaitViewer,null==t?void 0:t.layout,{savedProps:null==t?void 0:t.savedProps})),!1!==(null==n?void 0:n.arbitraryDfTest)&&(o.dataFrame=j,yield Y(50),yield a(o,e,s,r.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(o,e,s,r.events.onViewerAdded,void 0,n.awaitViewer))),yield a(o,e,s,r.events.onViewerAdded,l),(null==n?void 0:n.awaitViewer)&&(yield a(o,e,s,r.events.onViewerAdded,l,n.awaitViewer))}finally{}}))}},3629:(e,t,n)=>{"use strict";function r(e=!1,t="Assertion error."){if(!e)throw new Error(t)}function i(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n]*e[n];return Math.sqrt(t)}function s(e,t){if(e.length!=t.length)throw new Error("The dimensionality of the vectors must match");let n=0;for(let r=0;r<e.length;r++)n+=e[r]*t[r];return n}function o(e,t){let n=0;const r=e.length;if(r!==t.length)throw new Error("The dimensionality of the vectors must match");for(let i=0;i<r;++i)n+=Math.pow(e[i]-t[i],2);return Math.sqrt(n)}function a(e){const t=e.length;let n=0,r=0;for(let i=0;i<t;++i)n+=e[i],r+=Math.pow(e[i],2);const i=n/t,s=1/Math.sqrt(r/t-Math.pow(i,2));for(let n=0;n<t;++n)e[n]=(e[n]-i)*s;return e}n.d(t,{KE:()=>s,S8:()=>a,ou:()=>o,vA:()=>r,wQ:()=>i})},1913:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3282),i=n(9029),s=n(1520),o=n(2586),a=n(8708),c=n(2023),l="errorMessage",u=new r.Name("emUsed"),d={required:"missingProperty",dependencies:"property",dependentRequired:"property"},h=/\$\{[^}]+\}/,p=/\$\{([^}]+)\}/g,m=/^""\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:l,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,v=i.strConcat(c.default.instancePath,w.errorPath);function A(e,t){return i.and(r._`${e}.keyword !== ${l}`,r._`!${e}.${u}`,r._`${e}.instancePath === ${v}`,r._`${e}.keyword in ${t}`,r._`${e}.schemaPath.indexOf(${w.errSchemaPath}) === 0`,r._`/^\\/[^\\/]*$/.test(${e}.schemaPath.slice(${w.errSchemaPath.length}))`)}function E(e,t){const r=[];for(const n in e){const e=t[n];h.test(e)&&r.push([n,T(e)])}return n.object(...r)}function C(e){return h.test(e)?new s._Code(s.safeStringify(e).replace(p,((e,t)=>`" + JSON.stringify(${o.getData(t,w)}) + "`)).replace(m,"")):r.stringify(e)}function T(e){return r._`function(){return ${C(e)}}`}n.if(r._`${c.default.errors} > 0`,(()=>{if("object"==typeof b){const[s,o]=function(e){let t,n;for(const r in e){if("properties"===r||"items"===r)continue;const i=e[r];if("object"==typeof i){t||(t={});const e=t[r]={};for(const t in i)e[t]=[]}else n||(n={}),n[r]=[]}return[t,n]}(b);o&&function(i){const s=n.const("emErrors",r.stringify(i)),o=n.const("templates",E(i,g));n.forOf("err",c.default.vErrors,(e=>n.if(A(e,s),(()=>n.code(r._`${s}[${e}.keyword].push(${e})`).assign(r._`${e}.${u}`,!0)))));const{singleError:l}=e;if(l){const e=n.let("message",r._`""`),i=n.let("paramsErrors",r._`[]`);d((t=>{n.if(e,(()=>n.code(r._`${e} += ${"string"==typeof l?l:";"}`))),n.code(r._`${e} += ${h(t)}`),n.assign(i,r._`${i}.concat(${s}[${t}])`)})),a.reportError(t,{message:e,params:r._`{errors: ${i}}`})}else d((e=>a.reportError(t,{message:h(e),params:r._`{errors: ${s}[${e}]}`})));function d(e){n.forIn("key",s,(t=>n.if(r._`${s}[${t}].length`,(()=>e(t)))))}function h(e){return r._`${e} in ${o} ? ${o}[${e}]() : ${y}[${e}]`}}(o),s&&function(e){const i=n.const("emErrors",r.stringify(e)),s=[];for(const t in e)s.push([t,E(e[t],g[t])]);const o=n.const("templates",n.object(...s)),l=n.scopeValue("obj",{ref:d,code:r.stringify(d)}),h=n.let("emPropParams"),p=n.let("emParamsErrors");n.forOf("err",c.default.vErrors,(e=>n.if(A(e,i),(()=>{n.assign(h,r._`${l}[${e}.keyword]`),n.assign(p,r._`${i}[${e}.keyword][${e}.params[${h}]]`),n.if(p,(()=>n.code(r._`${p}.push(${e})`).assign(r._`${e}.${u}`,!0)))})))),n.forIn("key",i,(e=>n.forIn("keyProp",r._`${i}[${e}]`,(s=>{n.assign(p,r._`${i}[${e}][${s}]`),n.if(r._`${p}.length`,(()=>{const i=n.const("tmpl",r._`${o}[${e}] && ${o}[${e}][${s}]`);a.reportError(t,{message:r._`${i} ? ${i}() : ${y}[${e}][${s}]`,params:r._`{errors: ${p}}`})}))}))))}(s),function(e){const{props:s,items:o}=e;if(!s&&!o)return;const d=r._`typeof ${f} == "object"`,h=r._`Array.isArray(${f})`,p=n.let("emErrors");let m,w;const b=n.let("templates");function A(e,t){n.assign(p,r.stringify(e)),n.assign(b,E(e,t))}s&&o?(m=n.let("emChildKwd"),n.if(d),n.if(h,(()=>{A(o,g.items),n.assign(m,r.str`items`)}),(()=>{A(s,g.properties),n.assign(m,r.str`properties`)})),w=r._`[${m}]`):o?(n.if(h),A(o,g.items),w=r._`.items`):s&&(n.if(i.and(d,i.not(h))),A(s,g.properties),w=r._`.properties`),n.forOf("err",c.default.vErrors,(e=>function(e,t,s){n.if(i.and(r._`${e}.keyword !== ${l}`,r._`!${e}.${u}`,r._`${e}.instancePath.indexOf(${v}) === 0`),(()=>{const i=n.scopeValue("pattern",{ref:/^\/([^/]*)(?:\/|$)/,code:r._`new RegExp("^\\\/([^/]*)(?:\\\/|$)")`}),o=n.const("emMatches",r._`${i}.exec(${e}.instancePath.slice(${v}.length))`),a=n.const("emChild",r._`${o} && ${o}[1].replace(/~1/g, "/").replace(/~0/g, "~")`);n.if(r._`${a} !== undefined && ${a} in ${t}`,(()=>s(a)))}))}(e,p,(t=>n.code(r._`${p}[${t}].push(${e})`).assign(r._`${e}.${u}`,!0))))),n.forIn("key",p,(e=>n.if(r._`${p}[${e}].length`,(()=>{a.reportError(t,{message:r._`${e} in ${b} ? ${b}[${e}]() : ${y}${w}[${e}]`,params:r._`{errors: ${p}[${e}]}`}),n.assign(r._`${c.default.vErrors}[${c.default.errors}-1].instancePath`,r._`${v} + "/" + ${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 s="string"==typeof b?b:b._;s&&function(e){const s=n.const("emErrs",r._`[]`);n.forOf("err",c.default.vErrors,(e=>n.if(function(e){return i.and(r._`${e}.keyword !== ${l}`,r._`!${e}.${u}`,i.or(r._`${e}.instancePath === ${v}`,i.and(r._`${e}.instancePath.indexOf(${v}) === 0`,r._`${e}.instancePath[${v}.length] === "/"`)),r._`${e}.schemaPath.indexOf(${w.errSchemaPath}) === 0`,r._`${e}.schemaPath[${w.errSchemaPath}.length] === "/"`)}(e),(()=>n.code(r._`${s}.push(${e})`).assign(r._`${e}.${u}`,!0))))),n.if(r._`${s}.length`,(()=>a.reportError(t,{message:C(e),params:r._`{errors: ${s}}`})))}(s),e.keepErrors||function(){const e=n.const("emErrs",r._`[]`);n.forOf("err",c.default.vErrors,(t=>n.if(r._`!${t}.${u}`,(()=>n.code(r._`${e}.push(${t})`))))),n.assign(c.default.vErrors,e).assign(c.default.errors,r._`${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},7433:(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=t.Ajv2020=void 0;const r=n(4042),i=n(6105),s=n(6653),o=n(9572),a="https://json-schema.org/draft/2020-12/schema";class c extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),i.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(s.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)}}t.Ajv2020=c,e.exports=t=c,e.exports.Ajv2020=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var l=n(2586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var u=n(9029);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=n(3558);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var h=n(4551);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})},3282:(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=t.Ajv=void 0;const r=n(4042),i=n(6144),s=n(6653),o=n(2079),a=["/properties"],c="http://json-schema.org/draft-07/schema";class l extends r.default{_addVocabularies(){super._addVocabularies(),i.default.forEach((e=>this.addVocabulary(e))),this.opts.discriminator&&this.addKeyword(s.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(o,a):o;this.addMetaSchema(e,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}}t.Ajv=l,e.exports=t=l,e.exports.Ajv=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l;var u=n(2586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=n(9029);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var h=n(3558);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return h.default}});var p=n(4551);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})},1520:(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 r 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=r;class i 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 r&&(e[t.str]=(e[t.str]||0)+1),e)),{})}}function s(e,...t){const n=[e[0]];let r=0;for(;r<t.length;)c(n,t[r]),n.push(e[++r]);return new i(n)}t._Code=i,t.nil=new i(""),t._=s;const o=new i("+");function a(e,...t){const n=[u(e[0])];let r=0;for(;r<t.length;)n.push(o),c(n,t[r]),n.push(o,u(e[++r]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===o){const n=l(e[t-1],e[t+1]);if(void 0!==n){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}(n),new i(n)}function c(e,t){var n;t instanceof i?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(n=t)||"boolean"==typeof n||null===n?n:u(Array.isArray(n)?n.join(","):n))}function l(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof r||'"'!==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 r?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=c,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},t.stringify=function(e){return new i(u(e))},t.safeStringify=u,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new i(`.${e}`):s`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new i(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new i(e.toString())}},9029:(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 r=n(1520),i=n(7845);var s=n(1520);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return s._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return s.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return s.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return s.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return s.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return s.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return s.Name}});var o=n(7845);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 r._Code(">"),GTE:new r._Code(">="),LT:new r._Code("<"),LTE:new r._Code("<="),EQ:new r._Code("==="),NEQ:new r._Code("!=="),NOT:new r._Code("!"),OR:new r._Code("||"),AND:new r._Code("&&"),ADD:new r._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class c extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){const n=e?i.varKinds.var:this.varKind,r=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${r};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=N(this.rhs,e,t)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}}class l 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 r.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=N(this.rhs,e,t),this}get names(){return $(this.lhs instanceof r.Name?{}:{...this.lhs.names},this.rhs)}}class u extends l{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class d extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class h extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class p extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class m 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=N(this.code,e,t),this}get names(){return this.code instanceof r._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 r=n.length;for(;r--;){const i=n[r];i.optimizeNames(e,t)||(L(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce(((e,t)=>M(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=N(this.condition,e,t),this}get names(){const e=super.names;return $(e,this.condition),this.else&&M(e,this.else.names),e}}b.kind="if";class v extends g{}v.kind="for";class A extends v{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=N(this.iteration,e,t),this}get names(){return M(super.names,this.iteration.names)}}class E extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){const t=e.es5?i.varKinds.var:this.varKind,{name:n,from:r,to:s}=this;return`for(${t} ${n}=${r}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){const e=$(super.names,this.from);return $(e,this.to)}}class C extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}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=N(this.iterable,e,t),this}get names(){return M(super.names,this.iterable.names)}}class T 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)}}T.kind="func";class S extends f{render(e){return"return "+super.render(e)}}S.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,r;return super.optimizeNames(e,t),null===(n=this.catch)||void 0===n||n.optimizeNames(e,t),null===(r=this.finally)||void 0===r||r.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&M(e,this.catch.names),this.finally&&M(e,this.finally.names),e}}class P extends g{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}P.kind="catch";class x extends g{render(e){return"finally"+super.render(e)}}function M(e,t){for(const n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function $(e,t){return t instanceof r._CodeOrName?M(e,t.names):e}function N(e,t,n){return e instanceof r.Name?s(e):(i=e)instanceof r._Code&&i._items.some((e=>e instanceof r.Name&&1===t[e.str]&&void 0!==n[e.str]))?new r._Code(e._items.reduce(((e,t)=>(t instanceof r.Name&&(t=s(t)),t instanceof r._Code?e.push(...t._items):e.push(t),e)),[])):e;var i;function s(e){const r=n[e.str];return void 0===r||1!==t[e.str]?e:(delete t[e.str],r)}}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:r._`!${G(e)}`}x.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 i.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,r){const i=this._scope.toName(t);return void 0!==n&&r&&(this._constants[i.str]=n),this._leafNode(new c(e,i,n)),i}const(e,t,n){return this._def(i.varKinds.const,e,t,n)}let(e,t,n){return this._def(i.varKinds.let,e,t,n)}var(e,t,n){return this._def(i.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new l(e,t,n))}add(e,n){return this._leafNode(new u(e,t.operators.ADD,n))}code(e){return"function"==typeof e?e():e!==r.nil&&this._leafNode(new m(e)),this}object(...e){const t=["{"];for(const[n,i]of e)t.length>1&&t.push(","),t.push(n),(n!==i||this.opts.es5)&&(t.push(":"),(0,r.addCodeArg)(t,i));return t.push("}"),new r._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 A(e),t)}forRange(e,t,n,r,s=(this.opts.es5?i.varKinds.var:i.varKinds.let)){const o=this._scope.toName(e);return this._for(new E(s,o,t,n),(()=>r(o)))}forOf(e,t,n,s=i.varKinds.const){const o=this._scope.toName(e);if(this.opts.es5){const e=t instanceof r.Name?t:this.var("_arr",t);return this.forRange("_i",0,r._`${e}.length`,(t=>{this.var(o,r._`${e}[${t}]`),n(o)}))}return this._for(new C("of",s,o,t),(()=>n(o)))}forIn(e,t,n,s=(this.opts.es5?i.varKinds.var:i.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,r._`Object.keys(${t})`,n);const o=this._scope.toName(e);return this._for(new C("in",s,o,t),(()=>n(o)))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new d(e))}break(e){return this._leafNode(new h(e))}return(e){const t=new S;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(S)}try(e,t,n){if(!t&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');const r=new _;if(this._blockNode(r),this.code(e),t){const e=this.name("e");this._currNode=r.catch=new P(e),t(e)}return n&&(this._currNode=r.finally=new x,this.code(n)),this._endBlockNode(P,x)}throw(e){return this._leafNode(new p(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=r.nil,n,i){return this._blockNode(new T(e,t,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(T)}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=k(t.operators.AND);t.and=function(...e){return e.reduce(R)};const O=k(t.operators.OR);function k(e){return(t,n)=>t===r.nil?n:n===r.nil?t:r._`${G(t)} ${e} ${G(n)}`}function G(e){return e instanceof r.Name?e:r._`(${e})`}t.or=function(...e){return e.reduce(O)}},7845:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const r=n(1520);class i extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var s;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(s||(t.UsedValueState=s={})),t.varKinds={const:new r.Name("const"),let:new r.Name("let"),var:new r.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof r.Name?e:this.name(e)}name(e){return new r.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 r.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=r._`.${new r.Name(t)}[${n}]`}}t.ValueScopeName=a;const c=r._`\n`;t.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?c:r.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 r=this.toName(e),{prefix:i}=r,s=null!==(n=t.key)&&void 0!==n?n:t.ref;let o=this._values[i];if(o){const e=o.get(s);if(e)return e}else o=this._values[i]=new Map;o.set(s,r);const a=this._scope[i]||(this._scope[i]=[]),c=a.length;return a[c]=t.ref,r.setValue(t,{property:i,itemIndex:c}),r}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 r._`${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 c=r.nil;for(const l in e){const u=e[l];if(!u)continue;const d=o[l]=o[l]||new Map;u.forEach((e=>{if(d.has(e))return;d.set(e,s.Started);let o=n(e);if(o){const n=this.opts.es5?t.varKinds.var:t.varKinds.const;c=r._`${c}${n} ${e} = ${o};${this.opts._n}`}else{if(!(o=null==a?void 0:a(e)))throw new i(e);c=r._`${c}${o}${this.opts._n}`}d.set(e,s.Completed)}))}return c}}},8708:(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 r=n(9029),i=n(4227),s=n(2023);function o(e,t){const n=e.const("err",t);e.if(r._`${s.default.vErrors} === null`,(()=>e.assign(s.default.vErrors,r._`[${n}]`)),r._`${s.default.vErrors}.push(${n})`),e.code(r._`${s.default.errors}++`)}function a(e,t){const{gen:n,validateName:i,schemaEnv:s}=e;s.$async?n.throw(r._`new ${e.ValidationError}(${t})`):(n.assign(r._`${i}.errors`,t),n.return(!1))}t.keywordError={message:({keyword:e})=>r.str`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?r.str`"${e}" keyword must be ${t} ($data)`:r.str`"${e}" keyword is invalid ($data)`},t.reportError=function(e,n=t.keywordError,i,s){const{it:c}=e,{gen:u,compositeRule:d,allErrors:h}=c,p=l(e,n,i);(null!=s?s:d||h)?o(u,p):a(c,r._`[${p}]`)},t.reportExtraError=function(e,n=t.keywordError,r){const{it:i}=e,{gen:c,compositeRule:u,allErrors:d}=i;o(c,l(e,n,r)),u||d||a(i,s.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(s.default.errors,t),e.if(r._`${s.default.vErrors} !== null`,(()=>e.if(t,(()=>e.assign(r._`${s.default.vErrors}.length`,t)),(()=>e.assign(s.default.vErrors,null)))))},t.extendErrors=function({gen:e,keyword:t,schemaValue:n,data:i,errsCount:o,it:a}){if(void 0===o)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",o,s.default.errors,(o=>{e.const(c,r._`${s.default.vErrors}[${o}]`),e.if(r._`${c}.instancePath === undefined`,(()=>e.assign(r._`${c}.instancePath`,(0,r.strConcat)(s.default.instancePath,a.errorPath)))),e.assign(r._`${c}.schemaPath`,r.str`${a.errSchemaPath}/${t}`),a.opts.verbose&&(e.assign(r._`${c}.schema`,n),e.assign(r._`${c}.data`,i))}))};const c={keyword:new r.Name("keyword"),schemaPath:new r.Name("schemaPath"),params:new r.Name("params"),propertyName:new r.Name("propertyName"),message:new r.Name("message"),schema:new r.Name("schema"),parentSchema:new r.Name("parentSchema")};function l(e,t,n){const{createErrors:i}=e.it;return!1===i?r._`{}`:function(e,t,n={}){const{gen:i,it:o}=e,a=[u(o,n),d(e,n)];return function(e,{params:t,message:n},i){const{keyword:o,data:a,schemaValue:l,it:u}=e,{opts:d,propertyName:h,topSchemaRef:p,schemaPath:m}=u;i.push([c.keyword,o],[c.params,"function"==typeof t?t(e):t||r._`{}`]),d.messages&&i.push([c.message,"function"==typeof n?n(e):n]),d.verbose&&i.push([c.schema,l],[c.parentSchema,r._`${p}${m}`],[s.default.data,a]),h&&i.push([c.propertyName,h])}(e,t,a),i.object(...a)}(e,t,n)}function u({errorPath:e},{instancePath:t}){const n=t?r.str`${e}${(0,i.getErrorPath)(t,i.Type.Str)}`:e;return[s.default.instancePath,(0,r.strConcat)(s.default.instancePath,n)]}function d({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:s}){let o=s?t:r.str`${t}/${e}`;return n&&(o=r.str`${o}${(0,i.getErrorPath)(n,i.Type.Str)}`),[c.schemaPath,o]}},3835:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const r=n(9029),i=n(3558),s=n(2023),o=n(6939),a=n(4227),c=n(2586);class l{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=h.call(this,e);if(t)return t;const n=(0,o.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:a,lines:l}=this.opts.code,{ownProperties:u}=this.opts,d=new r.CodeGen(this.scope,{es5:a,lines:l,ownProperties:u});let p;e.$async&&(p=d.scopeValue("Error",{ref:i.default,code:r._`require("ajv/dist/runtime/validation_error").default`}));const m=d.scopeName("validate");e.validateName=m;const f={gen:d,allErrors:this.opts.allErrors,data:s.default.data,parentData:s.default.parentData,parentDataProperty:s.default.parentDataProperty,dataNames:[s.default.data],dataPathArr:[r.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:d.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,r.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:r.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:r._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(e),(0,c.validateFunctionCode)(f),d.optimize(this.opts.code.optimize);const t=d.toString();g=`${d.scopeRefs(s.default.scope)}return ${t}`,this.opts.code.process&&(g=this.opts.code.process(g,e));const n=new Function(`${s.default.self}`,`${s.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{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:m,validateCode:t,scopeValues:d._values}),this.opts.unevaluated){const{props:e,items:t}=f;n.evaluated={props:e instanceof r.Name?void 0:e,items:t instanceof r.Name?void 0:t,dynamicProps:e instanceof r.Name,dynamicItems:t instanceof r.Name},n.source&&(n.source.evaluated=(0,r.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 d(e){return(0,o.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:u.call(this,e)}function h(e){for(const r of this._compilations)if(n=e,(t=r).schema===n.schema&&t.root===n.root&&t.baseId===n.baseId)return r;var t,n}function p(e,t){let n;for(;"string"==typeof(n=this.refs[t]);)t=n;return n||this.schemas[t]||m.call(this,e,t)}function m(e,t){const n=this.opts.uriResolver.parse(t),r=(0,o._getFullPath)(this.opts.uriResolver,n);let i=(0,o.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===i)return g.call(this,n,e);const s=(0,o.normalizeId)(r),a=this.refs[s]||this.schemas[s];if("string"==typeof a){const t=m.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),s===(0,o.normalizeId)(t)){const{schema:t}=a,{schemaId:n}=this.opts,r=t[n];return r&&(i=(0,o.resolveUrl)(this.opts.uriResolver,i,r)),new l({schema:t,schemaId:n,root:e,baseId:i})}return g.call(this,n,a)}}t.SchemaEnv=l,t.compileSchema=u,t.resolveRef=function(e,t,n){var r;n=(0,o.resolveUrl)(this.opts.uriResolver,t,n);const i=e.refs[n];if(i)return i;let s=p.call(this,e,n);if(void 0===s){const i=null===(r=e.localRefs)||void 0===r?void 0:r[n],{schemaId:o}=this.opts;i&&(s=new l({schema:i,schemaId:o,root:e,baseId:t}))}return void 0!==s?e.refs[n]=d.call(this,s):void 0},t.getCompilingSchema=h,t.resolveSchema=m;const f=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function g(e,{baseId:t,schema:n,root:r}){var i;if("/"!==(null===(i=e.fragment)||void 0===i?void 0:i[0]))return;for(const r of e.fragment.slice(1).split("/")){if("boolean"==typeof n)return;const e=n[(0,a.unescapeFragment)(r)];if(void 0===e)return;const i="object"==typeof(n=e)&&n[this.opts.schemaId];!f.has(r)&&i&&(t=(0,o.resolveUrl)(this.opts.uriResolver,t,i))}let s;if("boolean"!=typeof n&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){const e=(0,o.resolveUrl)(this.opts.uriResolver,t,n.$ref);s=m.call(this,r,e)}const{schemaId:c}=this.opts;return s=s||new l({schema:n,schemaId:c,root:r,baseId:t}),s.schema!==s.root.schema?s:void 0}},2023:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={data:new r.Name("data"),valCxt:new r.Name("valCxt"),instancePath:new r.Name("instancePath"),parentData:new r.Name("parentData"),parentDataProperty:new r.Name("parentDataProperty"),rootData:new r.Name("rootData"),dynamicAnchors:new r.Name("dynamicAnchors"),vErrors:new r.Name("vErrors"),errors:new r.Name("errors"),this:new r.Name("this"),self:new r.Name("self"),scope:new r.Name("scope"),json:new r.Name("json"),jsonPos:new r.Name("jsonPos"),jsonLen:new r.Name("jsonLen"),jsonPart:new r.Name("jsonPart")};t.default=i},4551:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(6939);class i extends Error{constructor(e,t,n,i){super(i||`can't resolve reference ${n} from id ${t}`),this.missingRef=(0,r.resolveUrl)(e,t,n),this.missingSchema=(0,r.normalizeId)((0,r.getFullPath)(e,this.missingRef))}}t.default=i},6939:(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 r=n(4227),i=n(2017),s=n(7106),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?!c(e):!!t&&l(e)<=t)};const a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function c(e){for(const t in e){if(a.has(t))return!0;const n=e[t];if(Array.isArray(n)&&n.some(c))return!0;if("object"==typeof n&&c(n))return!0}return!1}function l(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,r.eachItem)(e[n],(e=>t+=l(e))),t===1/0))return 1/0}return t}function u(e,t="",n){!1!==n&&(t=p(t));const r=e.parse(t);return d(e,r)}function d(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=u,t._getFullPath=d;const h=/#\/?$/;function p(e){return e?e.replace(h,""):""}t.normalizeId=p,t.resolveUrl=function(e,t,n){return n=p(n),e.resolve(t,n)};const m=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};const{schemaId:n,uriResolver:r}=this.opts,o=p(e[n]||t),a={"":o},c=u(r,o,!1),l={},d=new Set;return s(e,{allKeys:!0},((e,t,r,i)=>{if(void 0===i)return;const s=c+t;let o=a[i];function u(t){const n=this.opts.uriResolver.resolve;if(t=p(o?n(o,t):t),d.has(t))throw f(t);d.add(t);let r=this.refs[t];return"string"==typeof r&&(r=this.refs[r]),"object"==typeof r?h(e,r.schema,t):t!==p(s)&&("#"===t[0]?(h(e,l[t],t),l[t]=e):this.refs[t]=s),t}function g(e){if("string"==typeof e){if(!m.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})),l;function h(e,t,n){if(void 0!==t&&!i(e,t))throw f(n)}function f(e){return new Error(`reference "${e}" resolves to more than one schema`)}}},396:(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:{}}}},4227:(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 r=n(9029),i=n(1520);function s(e,t=e.schema){const{opts:n,self:r}=e;if(!n.strictSchema)return;if("boolean"==typeof t)return;const i=r.RULES.keywords;for(const n in t)i[n]||m(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 c(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function l({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:i}){return(s,o,a,c)=>{const l=void 0===a?o:a instanceof r.Name?(o instanceof r.Name?e(s,o,a):t(s,o,a),a):o instanceof r.Name?(t(s,a,o),o):n(o,a);return c!==r.Name||l instanceof r.Name?l:i(s,l)}}function u(e,t){if(!0===t)return e.var("props",!0);const n=e.var("props",r._`{}`);return void 0!==t&&d(e,n,t),n}function d(e,t,n){Object.keys(n).forEach((n=>e.assign(r._`${t}${(0,r.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||(s(e,t),!o(t,e.self.RULES.all))},t.checkUnknownRules=s,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,i,s){if(!s){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return r._`${n}`}return r._`${e}${t}${(0,r.getProperty)(i)}`},t.unescapeFragment=function(e){return c(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(a(e))},t.escapeJsonPointer=a,t.unescapeJsonPointer=c,t.eachItem=function(e,t){if(Array.isArray(e))for(const n of e)t(n);else t(e)},t.mergeEvaluated={props:l({mergeNames:(e,t,n)=>e.if(r._`${n} !== true && ${t} !== undefined`,(()=>{e.if(r._`${t} === true`,(()=>e.assign(n,!0)),(()=>e.assign(n,r._`${n} || {}`).code(r._`Object.assign(${n}, ${t})`)))})),mergeToName:(e,t,n)=>e.if(r._`${n} !== true`,(()=>{!0===t?e.assign(n,!0):(e.assign(n,r._`${n} || {}`),d(e,n,t))})),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:u}),items:l({mergeNames:(e,t,n)=>e.if(r._`${n} !== true && ${t} !== undefined`,(()=>e.assign(n,r._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`))),mergeToName:(e,t,n)=>e.if(r._`${n} !== true`,(()=>e.assign(n,!0===t||r._`${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=d;const h={};var p;function m(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:h[t.code]||(h[t.code]=new i._Code(t.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(p||(t.Type=p={})),t.getErrorPath=function(e,t,n){if(e instanceof r.Name){const i=t===p.Num;return n?i?r._`"[" + ${e} + "]"`:r._`"['" + ${e} + "']"`:i?r._`"/" + ${e}`:r._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,r.getProperty)(e).toString():"/"+a(e)},t.checkStrictMode=m},7887:(e,t)=>{"use strict";function n(e,t){return t.rules.some((t=>r(e,t)))}function r(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},r){const i=t.RULES.types[r];return i&&!0!==i&&n(e,i)},t.shouldUseGroup=n,t.shouldUseRule=r},8727:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const r=n(8708),i=n(9029),s=n(2023),o={message:"boolean schema is false"};function a(e,t){const{gen:n,data:i}=e,s={gen:n,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,r.reportError)(s,o,void 0,t)}t.topBoolOrEmptySchema=function(e){const{gen:t,schema:n,validateName:r}=e;!1===n?a(e,!1):"object"==typeof n&&!0===n.$async?t.return(s.default.data):(t.assign(i._`${r}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){const{gen:n,schema:r}=e;!1===r?(n.var(t,!1),a(e)):n.var(t,!0)}},208:(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 r=n(396),i=n(7887),s=n(8708),o=n(9029),a=n(4227);var c;function l(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(r.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"}(c||(t.DataType=c={})),t.getSchemaTypes=function(e){const t=l(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=l,t.coerceAndCheckDataType=function(e,t){const{gen:n,data:r,opts:s}=e,a=function(e,t){return t?e.filter((e=>u.has(e)||"array"===t&&"array"===e)):[]}(t,s.coerceTypes),l=t.length>0&&!(0===a.length&&1===t.length&&(0,i.schemaHasRulesForType)(e,t[0]));if(l){const i=h(t,r,s.strictNumbers,c.Wrong);n.if(i,(()=>{a.length?function(e,t,n){const{gen:r,data:i,opts:s}=e,a=r.let("dataType",o._`typeof ${i}`),c=r.let("coerced",o._`undefined`);"array"===s.coerceTypes&&r.if(o._`${a} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,(()=>r.assign(i,o._`${i}[0]`).assign(a,o._`typeof ${i}`).if(h(t,i,s.strictNumbers),(()=>r.assign(c,i))))),r.if(o._`${c} !== undefined`);for(const e of n)(u.has(e)||"array"===e&&"array"===s.coerceTypes)&&l(e);function l(e){switch(e){case"string":return void r.elseIf(o._`${a} == "number" || ${a} == "boolean"`).assign(c,o._`"" + ${i}`).elseIf(o._`${i} === null`).assign(c,o._`""`);case"number":return void r.elseIf(o._`${a} == "boolean" || ${i} === null
|
|
2
2
|
|| (${a} == "string" && ${i} && ${i} == +${i})`).assign(c,o._`+${i}`);case"integer":return void r.elseIf(o._`${a} === "boolean" || ${i} === null
|
|
3
3
|
|| (${a} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(c,o._`+${i}`);case"boolean":return void r.elseIf(o._`${i} === "false" || ${i} === 0 || ${i} === null`).assign(c,!1).elseIf(o._`${i} === "true" || ${i} === 1`).assign(c,!0);case"null":return r.elseIf(o._`${i} === "" || ${i} === 0 || ${i} === false`),void r.assign(c,null);case"array":r.elseIf(o._`${a} === "string" || ${a} === "number"
|
|
4
|
-
|| ${a} === "boolean" || ${i} === null`).assign(c,o._`[${i}]`)}}r.else(),m(e),r.endIf(),r.if(o._`${c} !== undefined`,(()=>{r.assign(i,c),function({gen:e,parentData:t,parentDataProperty:n},r){e.if(o._`${t} !== undefined`,(()=>e.assign(o._`${t}[${n}]`,r)))}(e,c)}))}(e,t,a):m(e)}))}return l};const u=new Set(["string","number","integer","boolean","null"]);function d(e,t,n,r=c.Correct){const i=r===c.Correct?o.operators.EQ:o.operators.NEQ;let s;switch(e){case"null":return o._`${t} ${i} null`;case"array":s=o._`Array.isArray(${t})`;break;case"object":s=o._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=a(o._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=a();break;default:return o._`typeof ${t} ${i} ${e}`}return r===c.Correct?s:(0,o.not)(s);function a(e=o.nil){return(0,o.and)(o._`typeof ${t} == "number"`,e,n?o._`isFinite(${t})`:o.nil)}}function h(e,t,n,r){if(1===e.length)return d(e[0],t,n,r);let i;const s=(0,a.toHash)(e);if(s.array&&s.object){const e=o._`typeof ${t} != "object"`;i=s.null?e:o._`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else i=o.nil;s.number&&delete s.integer;for(const e in s)i=(0,o.and)(i,d(e,t,n,r));return i}t.checkDataType=d,t.checkDataTypes=h;const p={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?o._`{type: ${e}}`:o._`{type: ${t}}`};function m(e){const t=function(e){const{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}(e);(0,s.reportError)(t,p)}t.reportTypeError=m},7870:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;const r=n(9029),i=n(4227);function s(e,t,n){const{gen:s,compositeRule:o,data:a,opts:c}=e;if(void 0===n)return;const l=r._`${a}${(0,r.getProperty)(t)}`;if(o)return void(0,i.checkStrictMode)(e,`default is ignored for: ${l}`);let u=r._`${l} === undefined`;"empty"===c.useDefaults&&(u=r._`${u} || ${l} === null || ${l} === ""`),s.if(u,r._`${l} = ${(0,r.stringify)(n)}`)}t.assignDefaults=function(e,t){const{properties:n,items:r}=e.schema;if("object"===t&&n)for(const t in n)s(e,t,n[t].default);else"array"===t&&Array.isArray(r)&&r.forEach(((t,n)=>s(e,n,t.default)))}},2586:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const r=n(8727),i=n(208),s=n(7887),o=n(208),a=n(7870),c=n(3673),l=n(4495),u=n(9029),d=n(2023),h=n(6939),p=n(4227),m=n(8708);function f({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},s){i.code.es5?e.func(t,u._`${d.default.data}, ${d.default.valCxt}`,r.$async,(()=>{e.code(u._`"use strict"; ${g(n,i)}`),function(e,t){e.if(d.default.valCxt,(()=>{e.var(d.default.instancePath,u._`${d.default.valCxt}.${d.default.instancePath}`),e.var(d.default.parentData,u._`${d.default.valCxt}.${d.default.parentData}`),e.var(d.default.parentDataProperty,u._`${d.default.valCxt}.${d.default.parentDataProperty}`),e.var(d.default.rootData,u._`${d.default.valCxt}.${d.default.rootData}`),t.dynamicRef&&e.var(d.default.dynamicAnchors,u._`${d.default.valCxt}.${d.default.dynamicAnchors}`)}),(()=>{e.var(d.default.instancePath,u._`""`),e.var(d.default.parentData,u._`undefined`),e.var(d.default.parentDataProperty,u._`undefined`),e.var(d.default.rootData,d.default.data),t.dynamicRef&&e.var(d.default.dynamicAnchors,u._`{}`)}))}(e,i),e.code(s)})):e.func(t,u._`${d.default.data}, ${function(e){return u._`{${d.default.instancePath}="", ${d.default.parentData}, ${d.default.parentDataProperty}, ${d.default.rootData}=${d.default.data}${e.dynamicRef?u._`, ${d.default.dynamicAnchors}={}`:u.nil}}={}`}(i)}`,r.$async,(()=>e.code(g(n,i)).code(s)))}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,p.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}(e)}function v(e,t){if(e.opts.jtd)return E(e,[],!1,t);const n=(0,i.getSchemaTypes)(e.schema);E(e,n,!(0,i.coerceAndCheckDataType)(e,n),t)}function A({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){const s=n.$comment;if(!0===i.$comment)e.code(u._`${d.default.self}.logger.log(${s})`);else if("function"==typeof i.$comment){const n=u.str`${r}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code(u._`${d.default.self}.opts.$comment(${s}, ${n}, ${i}.schema)`)}}function E(e,t,n,r){const{gen:i,schema:a,data:c,allErrors:l,opts:h,self:m}=e,{RULES:f}=m;function g(p){(0,s.shouldUseGroup)(a,p)&&(p.type?(i.if((0,o.checkDataType)(p.type,c,h.strictNumbers)),C(e,p),1===t.length&&t[0]===p.type&&n&&(i.else(),(0,o.reportTypeError)(e)),i.endIf()):C(e,p),l||i.if(u._`${d.default.errors} === ${r||0}`))}!a.$ref||!h.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(a,f)?(h.jtd||function(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(function(e,t){t.length&&(e.dataTypes.length?(t.forEach((t=>{T(e.dataTypes,t)||S(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),function(e,t){const n=[];for(const r of e.dataTypes)T(t,r)?n.push(r):t.includes("integer")&&"number"===r&&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"))&&S(e,"use allowUnionTypes to allow union type keyword")}(e,t),function(e,t){const n=e.self.RULES.all;for(const r in n){const i=n[r];if("object"==typeof i&&(0,s.shouldUseRule)(e.schema,i)){const{type:n}=i.definition;n.length&&!n.some((e=>{return r=e,(n=t).includes(r)||"number"===r&&n.includes("integer");var n,r}))&&S(e,`missing type "${n.join(",")}" for keyword "${r}"`)}}}(e,e.dataTypes))}(e,t),i.block((()=>{for(const e of f.rules)g(e);g(f.post)}))):i.block((()=>x(e,"$ref",f.all.$ref.definition)))}function C(e,t){const{gen:n,schema:r,opts:{useDefaults:i}}=e;i&&(0,a.assignDefaults)(e,t.type),n.block((()=>{for(const n of t.rules)(0,s.shouldUseRule)(r,n)&&x(e,n.keyword,n.definition,t.type)}))}function T(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function S(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,p.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){w(e)&&(b(e),y(e))?function(e){const{schema:t,opts:n,gen:r}=e;f(e,(()=>{n.$comment&&t.$comment&&A(e),function(e){const{schema:t,opts:n}=e;void 0!==t.default&&n.useDefaults&&n.strictSchema&&(0,p.checkStrictMode)(e,"default is ignored in the schema root")}(e),r.let(d.default.vErrors,null),r.let(d.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),v(e),function(e){const{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:s}=e;n.$async?t.if(u._`${d.default.errors} === 0`,(()=>t.return(d.default.data)),(()=>t.throw(u._`new ${i}(${d.default.vErrors})`))):(t.assign(u._`${r}.errors`,d.default.vErrors),s.unevaluated&&function({gen:e,evaluated:t,props:n,items:r}){n instanceof u.Name&&e.assign(u._`${t}.props`,n),r instanceof u.Name&&e.assign(u._`${t}.items`,r)}(e),t.return(u._`${d.default.errors} === 0`))}(e)}))}(e):f(e,(()=>(0,r.topBoolOrEmptySchema)(e)))};class _{constructor(e,t,n){if((0,c.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,p.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,c.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",d.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?m.reportExtraError:m.reportError)(this,this.def.error,t)}$dataError(){(0,m.reportError)(this,this.def.$dataError||m.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,m.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:r,schemaType:i,def:s}=this;n.if((0,u.or)(u._`${r} === undefined`,t)),e!==u.nil&&n.assign(e,!0),(i.length||s.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:r,it:i}=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,i.opts.strictNumbers,o.DataType.Wrong)}`}return u.nil}(),function(){if(r.validateSchema){const n=e.scopeValue("validate$data",{ref:r.validateSchema});return u._`!${n}(${t})`}return u.nil}())}subschema(e,t){const n=(0,l.getSubschema)(this.it,e);(0,l.extendSubschemaData)(n,this.it,e),(0,l.extendSubschemaMode)(n,e);const i={...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:r,opts:i}=e;i.$comment&&n.$comment&&A(e),function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,h.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 s=r.const("_errs",d.default.errors);v(e,s),r.var(t,u._`${s} === ${d.default.errors}`)}(e,t):(0,r.boolOrEmptySchema)(e,t)}(i,t),i}mergeEvaluated(e,t){const{it:n,gen:r}=this;n.opts.unevaluated&&(!0!==n.props&&void 0!==e.props&&(n.props=p.mergeEvaluated.props(r,e.props,n.props,t)),!0!==n.items&&void 0!==e.items&&(n.items=p.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){const{it:n,gen:r}=this;if(n.opts.unevaluated&&(!0!==n.props||!0!==n.items))return r.if(t,(()=>this.mergeEvaluated(e,u.Name))),!0}}function x(e,t,n,r){const i=new _(e,n,t);"code"in n?n.code(i,r):i.$data&&n.validate?(0,c.funcKeywordCode)(i,n):"macro"in n?(0,c.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,c.funcKeywordCode)(i,n)}t.KeywordCxt=_;const P=/^\/(?:[^~]|~0|~1)*$/,M=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function $(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,s;if(""===e)return d.default.rootData;if("/"===e[0]){if(!P.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);i=e,s=d.default.rootData}else{const o=M.exec(e);if(!o)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+o[1];if(i=o[2],"#"===i){if(a>=t)throw new Error(c("property/index",a));return r[t-a]}if(a>t)throw new Error(c("data",a));if(s=n[t-a],!i)return s}let o=s;const a=i.split("/");for(const e of a)e&&(s=u._`${s}${(0,u.getProperty)((0,p.unescapeJsonPointer)(e))}`,o=u._`${o} && ${s}`);return o;function c(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}t.getData=$},3673:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const r=n(9029),i=n(2023),s=n(5765),o=n(8708);function a(e){const{gen:t,data:n,it:i}=e;t.if(i.parentData,(()=>t.assign(n,r._`${i.parentData}[${i.parentDataProperty}]`)))}function c(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,r.stringify)(n)})}t.macroKeywordCode=function(e,t){const{gen:n,keyword:i,schema:s,parentSchema:o,it:a}=e,l=t.macro.call(a.self,s,o,a),u=c(n,i,l);!1!==a.opts.validateSchema&&a.self.validateSchema(l,!0);const d=n.name("valid");e.subschema({schema:l,schemaPath:r.nil,errSchemaPath:`${a.errSchemaPath}/${i}`,topSchemaRef:u,compositeRule:!0},d),e.pass(d,(()=>e.error(!0)))},t.funcKeywordCode=function(e,t){var n;const{gen:l,keyword:u,schema:d,parentSchema:h,$data:p,it:m}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(m,t);const f=!p&&t.compile?t.compile.call(m.self,d,h,m):t.validate,g=c(l,u,f),y=l.let("valid");function w(n=(t.async?r._`await `:r.nil)){const o=m.opts.passContext?i.default.this:i.default.self,a=!("compile"in t&&!p||!1===t.schema);l.assign(y,r._`${n}${(0,s.callValidateCode)(e,g,o,a)}`,t.modifying)}function b(e){var n;l.if((0,r.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=l.let("ruleErrs",null);return l.try((()=>w(r._`await `)),(t=>l.assign(y,!1).if(r._`${t} instanceof ${m.ValidationError}`,(()=>l.assign(e,r._`${t}.errors`)),(()=>l.throw(t))))),e}():function(){const e=r._`${g}.errors`;return l.assign(e,null),w(r.nil),e}();t.modifying&&a(e),b((()=>function(e,t){const{gen:n}=e;n.if(r._`Array.isArray(${t})`,(()=>{n.assign(i.default.vErrors,r._`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`).assign(i.default.errors,r._`${i.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:r},i,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw new Error("ajv implementation error");const o=i.dependencies;if(null==o?void 0:o.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[s])){const e=`keyword "${s}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);n.logger.error(e)}}},4495:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;const r=n(9029),i=n(4227);t.getSubschema=function(e,{keyword:t,schemaProp:n,schema:s,schemaPath:o,errSchemaPath:a,topSchemaRef:c}){if(void 0!==t&&void 0!==s)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const s=e.schema[t];return void 0===n?{schema:s,schemaPath:r._`${e.schemaPath}${(0,r.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[n],schemaPath:r._`${e.schemaPath}${(0,r.getProperty)(t)}${(0,r.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,i.escapeFragment)(n)}`}}if(void 0!==s){if(void 0===o||void 0===a||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:o,topSchemaRef:c,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:n,dataPropType:s,data:o,dataTypes:a,propertyName:c}){if(void 0!==o&&void 0!==n)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:l}=t;if(void 0!==n){const{errorPath:o,dataPathArr:a,opts:c}=t;u(l.let("data",r._`${t.data}${(0,r.getProperty)(n)}`,!0)),e.errorPath=r.str`${o}${(0,i.getErrorPath)(n,s,c.jsPropertySyntax)}`,e.parentDataProperty=r._`${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 r.Name?o:l.let("data",o,!0)),void 0!==c&&(e.propertyName=c)),a&&(e.dataTypes=a)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:s}){void 0!==r&&(e.compositeRule=r),void 0!==i&&(e.createErrors=i),void 0!==s&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=n}},4042:(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 r=n(2586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return r.KeywordCxt}});var i=n(9029);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return i.CodeGen}});const s=n(3558),o=n(4551),a=n(396),c=n(3835),l=n(9029),u=n(6939),d=n(208),h=n(4227),p=n(3837),m=n(5944),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.'};function v(e){var t,n,r,i,s,o,a,c,l,u,d,h,p,g,y,w,b,v,A,E,C,T,S,_,x;const P=e.strict,M=null===(t=e.code)||void 0===t?void 0:t.optimize,$=!0===M||void 0===M?1:M||0,N=null!==(r=null===(n=e.code)||void 0===n?void 0:n.regExp)&&void 0!==r?r:f,L=null!==(i=e.uriResolver)&&void 0!==i?i:m.default;return{strictSchema:null===(o=null!==(s=e.strictSchema)&&void 0!==s?s:P)||void 0===o||o,strictNumbers:null===(c=null!==(a=e.strictNumbers)&&void 0!==a?a:P)||void 0===c||c,strictTypes:null!==(u=null!==(l=e.strictTypes)&&void 0!==l?l:P)&&void 0!==u?u:"log",strictTuples:null!==(h=null!==(d=e.strictTuples)&&void 0!==d?d:P)&&void 0!==h?h:"log",strictRequired:null!==(g=null!==(p=e.strictRequired)&&void 0!==p?p:P)&&void 0!==g&&g,code:e.code?{...e.code,optimize:$,regExp:N}:{optimize:$,regExp:N},loopRequired:null!==(y=e.loopRequired)&&void 0!==y?y:200,loopEnum:null!==(w=e.loopEnum)&&void 0!==w?w:200,meta:null===(b=e.meta)||void 0===b||b,messages:null===(v=e.messages)||void 0===v||v,inlineRefs:null===(A=e.inlineRefs)||void 0===A||A,schemaId:null!==(E=e.schemaId)&&void 0!==E?E:"$id",addUsedSchema:null===(C=e.addUsedSchema)||void 0===C||C,validateSchema:null===(T=e.validateSchema)||void 0===T||T,validateFormats:null===(S=e.validateFormats)||void 0===S||S,unicodeRegExp:null===(_=e.unicodeRegExp)||void 0===_||_,int32range:null===(x=e.int32range)||void 0===x||x,uriResolver:L}}class A{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...v(e)};const{es5:t,lines:n}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:y,es5:t,lines:n}),this.logger=function(e){if(!1===e)return P;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 r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),E.call(this,w,e,"NOT SUPPORTED"),E.call(this,b,e,"DEPRECATED","warn"),this._metaOpts=x.call(this),e.formats&&S.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&_.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),T.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:n}=this.opts;let r=p;"id"===n&&(r={...p},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[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 r=n(t);return"$async"in n||(this.errors=n.errors),r}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 r.call(this,e,t);async function r(e,t){await i.call(this,e.$schema);const n=this._addSchema(e,t);return n.validate||s.call(this,n)}async function i(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function s(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return a.call(this,t),await c.call(this,t.missingSchema),s.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 c(e){const n=await l.call(this,e);this.refs[e]||await i.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function l(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,r=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,n,r);return this}let i;if("object"==typeof e){const{schemaId:t}=this.opts;if(i=e[t],void 0!==i&&"string"!=typeof i)throw new Error(`schema ${t} must be string`)}return t=(0,u.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!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 r=this.validate(n,e);if(!r&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return r}getSchema(e){let t;for(;"string"==typeof(t=C.call(this,e));)e=t;if(void 0===t){const{schemaId:n}=this.opts,r=new c.SchemaEnv({schema:{},schemaId:n});if(t=c.resolveSchema.call(this,r,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=C.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($.call(this,n,t),!t)return(0,h.eachItem)(n,(e=>N.call(this,e))),this;I.call(this,t);const r={...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)};return(0,h.eachItem)(n,0===r.type.length?e=>N.call(this,e,r):e=>r.type.forEach((t=>N.call(this,e,r,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 r of t){const t=r.split("/").slice(1);let i=e;for(const e of t)i=i[e];for(const e in n){const t=n[e];if("object"!=typeof t)continue;const{$data:r}=t.definition,s=i[e];r&&s&&(i[e]=O(s))}}return e}_removeAllSchemas(e,t){for(const n in e){const r=e[n];t&&!t.test(n)||("string"==typeof r?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let s;const{schemaId:o}=this.opts;if("object"==typeof e)s=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)(s||n);const l=u.getSchemaRefs.call(this,e,n);return a=new c.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:n,localRefs:l}),this._cache.set(a.schema,a),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=a),r&&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):c.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{c.compileSchema.call(this,e)}finally{this.opts=t}}}function E(e,t,n,r="error"){for(const i in e){const s=i;s in t&&this.logger[r](`${n}: option ${i}. ${e[s]}`)}}function C(e){return e=(0,u.normalizeId)(e),this.schemas[e]||this.refs[e]}function T(){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 S(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function _(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 x(){const e={...this.opts};for(const t of g)delete e[t];return e}A.ValidationError=s.default,A.MissingRefError=o.default,t.default=A;const P={log(){},warn(){},error(){}},M=/^[a-z_$][a-z0-9_$:-]*$/i;function $(e,t){const{RULES:n}=this;if((0,h.eachItem)(e,(e=>{if(n.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!M.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 N(e,t,n){var r;const i=null==t?void 0:t.post;if(n&&i)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:s}=this;let o=i?s.post:s.rules.find((({type:e})=>e===n));if(o||(o={type:n,rules:[]},s.rules.push(o)),s.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)}};t.before?L.call(this,o,a,t.before):o.rules.push(a),s.all[e]=a,null===(r=t.implements)||void 0===r||r.forEach((e=>this.addKeyword(e)))}function L(e,t,n){const r=e.rules.findIndex((e=>e.keyword===n));r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function I(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=O(t)),e.validateSchema=this.compile(t,!0))}const R={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function O(e){return{anyOf:[e,R]}}},9572:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(1678),i=n(7216),s=n(9547),o=n(8226),a=n(518),c=n(4588),l=n(5707),u=n(7082),d=["/properties"];t.default=function(e){return[r,i,s,o,a,t(this,c),l,t(this,u)].forEach((e=>this.addMetaSchema(e,void 0,!1))),this;function t(t,n){return e?t.$dataMetaSchema(n,d):n}}},6250:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2017);r.code='require("ajv/dist/runtime/equal").default',t.default=r},3853:(e,t)=>{"use strict";function n(e){const t=e.length;let n,r=0,i=0;for(;i<t;)r++,n=e.charCodeAt(i++),n>=55296&&n<=56319&&i<t&&(n=e.charCodeAt(i),56320==(64512&n)&&i++);return r}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,n.code='require("ajv/dist/runtime/ucs2length").default'},5944:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(8343);r.code='require("ajv/dist/runtime/uri").default',t.default=r},3558:(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},5457:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;const r=n(9029),i=n(4227),s={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>r.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>r._`{limit: ${e}}`},code(e){const{parentSchema:t,it:n}=e,{items:r}=t;Array.isArray(r)?o(e,r):(0,i.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}};function o(e,t){const{gen:n,schema:s,data:o,keyword:a,it:c}=e;c.items=!0;const l=n.const("len",r._`${o}.length`);if(!1===s)e.setParams({len:t.length}),e.pass(r._`${l} <= ${t.length}`);else if("object"==typeof s&&!(0,i.alwaysValidSchema)(c,s)){const s=n.var("valid",r._`${l} <= ${t.length}`);n.if((0,r.not)(s),(()=>function(s){n.forRange("i",t.length,l,(t=>{e.subschema({keyword:a,dataProp:t,dataPropType:i.Type.Num},s),c.allErrors||n.if((0,r.not)(s),(()=>n.break()))}))}(s))),e.ok(s)}}t.validateAdditionalItems=o,t.default=s},8660:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5765),i=n(9029),s=n(2023),o=n(4227),a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>i._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:n,parentSchema:a,data:c,errsCount:l,it:u}=e;if(!l)throw new Error("ajv implementation error");const{allErrors:d,opts:h}=u;if(u.props=!0,"all"!==h.removeAdditional&&(0,o.alwaysValidSchema)(u,n))return;const p=(0,r.allSchemaProperties)(a.properties),m=(0,r.allSchemaProperties)(a.patternProperties);function f(e){t.code(i._`delete ${c}[${e}]`)}function g(r){if("all"===h.removeAdditional||h.removeAdditional&&!1===n)f(r);else{if(!1===n)return e.setParams({additionalProperty:r}),e.error(),void(d||t.break());if("object"==typeof n&&!(0,o.alwaysValidSchema)(u,n)){const n=t.name("valid");"failing"===h.removeAdditional?(y(r,n,!1),t.if((0,i.not)(n),(()=>{e.reset(),f(r)}))):(y(r,n),d||t.if((0,i.not)(n),(()=>t.break())))}}}function y(t,n,r){const i={keyword:"additionalProperties",dataProp:t,dataPropType:o.Type.Str};!1===r&&Object.assign(i,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(i,n)}t.forIn("key",c,(n=>{p.length||m.length?t.if(function(n){let s;if(p.length>8){const e=(0,o.schemaRefOrVal)(u,a.properties,"properties");s=(0,r.isOwnProperty)(t,e,n)}else s=p.length?(0,i.or)(...p.map((e=>i._`${n} === ${e}`))):i.nil;return m.length&&(s=(0,i.or)(s,...m.map((t=>i._`${(0,r.usePattern)(e,t)}.test(${n})`)))),(0,i.not)(s)}(n),(()=>g(n))):g(n)})),e.ok(i._`${l} === ${s.default.errors}`)}};t.default=a},5844:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4227),i={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:n,it:i}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");const s=t.name("valid");n.forEach(((t,n)=>{if((0,r.alwaysValidSchema)(i,t))return;const o=e.subschema({keyword:"allOf",schemaProp:n},s);e.ok(s),e.mergeEvaluated(o)}))}};t.default=i},6505:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:n(5765).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=r},2661:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?r.str`must contain at least ${e} valid item(s)`:r.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?r._`{minContains: ${e}}`:r._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:n,parentSchema:s,data:o,it:a}=e;let c,l;const{minContains:u,maxContains:d}=s;a.opts.next?(c=void 0===u?1:u,l=d):c=1;const h=t.const("len",r._`${o}.length`);if(e.setParams({min:c,max:l}),void 0===l&&0===c)return void(0,i.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==l&&c>l)return(0,i.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,i.alwaysValidSchema)(a,n)){let t=r._`${h} >= ${c}`;return void 0!==l&&(t=r._`${t} && ${h} <= ${l}`),void e.pass(t)}a.items=!0;const p=t.name("valid");function m(){const e=t.name("_valid"),n=t.let("count",0);f(e,(()=>t.if(e,(()=>function(e){t.code(r._`${e}++`),void 0===l?t.if(r._`${e} >= ${c}`,(()=>t.assign(p,!0).break())):(t.if(r._`${e} > ${l}`,(()=>t.assign(p,!1).break())),1===c?t.assign(p,!0):t.if(r._`${e} >= ${c}`,(()=>t.assign(p,!0))))}(n)))))}function f(n,r){t.forRange("i",0,h,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:i.Type.Num,compositeRule:!0},n),r()}))}void 0===l&&1===c?f(p,(()=>t.if(p,(()=>t.break())))):0===c?(t.let(p,!0),void 0!==l&&t.if(r._`${o}.length > 0`,m)):(t.let(p,!1),m()),e.result(p,(()=>e.reset()))}};t.default=s},3025:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const r=n(9029),i=n(4227),s=n(5765);t.error={message:({params:{property:e,depsCount:t,deps:n}})=>{const i=1===t?"property":"properties";return r.str`must have ${i} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:n,missingProperty:i}})=>r._`{property: ${e},
|
|
4
|
+
|| ${a} === "boolean" || ${i} === null`).assign(c,o._`[${i}]`)}}r.else(),m(e),r.endIf(),r.if(o._`${c} !== undefined`,(()=>{r.assign(i,c),function({gen:e,parentData:t,parentDataProperty:n},r){e.if(o._`${t} !== undefined`,(()=>e.assign(o._`${t}[${n}]`,r)))}(e,c)}))}(e,t,a):m(e)}))}return l};const u=new Set(["string","number","integer","boolean","null"]);function d(e,t,n,r=c.Correct){const i=r===c.Correct?o.operators.EQ:o.operators.NEQ;let s;switch(e){case"null":return o._`${t} ${i} null`;case"array":s=o._`Array.isArray(${t})`;break;case"object":s=o._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=a(o._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=a();break;default:return o._`typeof ${t} ${i} ${e}`}return r===c.Correct?s:(0,o.not)(s);function a(e=o.nil){return(0,o.and)(o._`typeof ${t} == "number"`,e,n?o._`isFinite(${t})`:o.nil)}}function h(e,t,n,r){if(1===e.length)return d(e[0],t,n,r);let i;const s=(0,a.toHash)(e);if(s.array&&s.object){const e=o._`typeof ${t} != "object"`;i=s.null?e:o._`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else i=o.nil;s.number&&delete s.integer;for(const e in s)i=(0,o.and)(i,d(e,t,n,r));return i}t.checkDataType=d,t.checkDataTypes=h;const p={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?o._`{type: ${e}}`:o._`{type: ${t}}`};function m(e){const t=function(e){const{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}(e);(0,s.reportError)(t,p)}t.reportTypeError=m},7870:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;const r=n(9029),i=n(4227);function s(e,t,n){const{gen:s,compositeRule:o,data:a,opts:c}=e;if(void 0===n)return;const l=r._`${a}${(0,r.getProperty)(t)}`;if(o)return void(0,i.checkStrictMode)(e,`default is ignored for: ${l}`);let u=r._`${l} === undefined`;"empty"===c.useDefaults&&(u=r._`${u} || ${l} === null || ${l} === ""`),s.if(u,r._`${l} = ${(0,r.stringify)(n)}`)}t.assignDefaults=function(e,t){const{properties:n,items:r}=e.schema;if("object"===t&&n)for(const t in n)s(e,t,n[t].default);else"array"===t&&Array.isArray(r)&&r.forEach(((t,n)=>s(e,n,t.default)))}},2586:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const r=n(8727),i=n(208),s=n(7887),o=n(208),a=n(7870),c=n(3673),l=n(4495),u=n(9029),d=n(2023),h=n(6939),p=n(4227),m=n(8708);function f({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},s){i.code.es5?e.func(t,u._`${d.default.data}, ${d.default.valCxt}`,r.$async,(()=>{e.code(u._`"use strict"; ${g(n,i)}`),function(e,t){e.if(d.default.valCxt,(()=>{e.var(d.default.instancePath,u._`${d.default.valCxt}.${d.default.instancePath}`),e.var(d.default.parentData,u._`${d.default.valCxt}.${d.default.parentData}`),e.var(d.default.parentDataProperty,u._`${d.default.valCxt}.${d.default.parentDataProperty}`),e.var(d.default.rootData,u._`${d.default.valCxt}.${d.default.rootData}`),t.dynamicRef&&e.var(d.default.dynamicAnchors,u._`${d.default.valCxt}.${d.default.dynamicAnchors}`)}),(()=>{e.var(d.default.instancePath,u._`""`),e.var(d.default.parentData,u._`undefined`),e.var(d.default.parentDataProperty,u._`undefined`),e.var(d.default.rootData,d.default.data),t.dynamicRef&&e.var(d.default.dynamicAnchors,u._`{}`)}))}(e,i),e.code(s)})):e.func(t,u._`${d.default.data}, ${function(e){return u._`{${d.default.instancePath}="", ${d.default.parentData}, ${d.default.parentDataProperty}, ${d.default.rootData}=${d.default.data}${e.dynamicRef?u._`, ${d.default.dynamicAnchors}={}`:u.nil}}={}`}(i)}`,r.$async,(()=>e.code(g(n,i)).code(s)))}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,p.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}(e)}function v(e,t){if(e.opts.jtd)return E(e,[],!1,t);const n=(0,i.getSchemaTypes)(e.schema);E(e,n,!(0,i.coerceAndCheckDataType)(e,n),t)}function A({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){const s=n.$comment;if(!0===i.$comment)e.code(u._`${d.default.self}.logger.log(${s})`);else if("function"==typeof i.$comment){const n=u.str`${r}/$comment`,i=e.scopeValue("root",{ref:t.root});e.code(u._`${d.default.self}.opts.$comment(${s}, ${n}, ${i}.schema)`)}}function E(e,t,n,r){const{gen:i,schema:a,data:c,allErrors:l,opts:h,self:m}=e,{RULES:f}=m;function g(p){(0,s.shouldUseGroup)(a,p)&&(p.type?(i.if((0,o.checkDataType)(p.type,c,h.strictNumbers)),C(e,p),1===t.length&&t[0]===p.type&&n&&(i.else(),(0,o.reportTypeError)(e)),i.endIf()):C(e,p),l||i.if(u._`${d.default.errors} === ${r||0}`))}!a.$ref||!h.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(a,f)?(h.jtd||function(e,t){!e.schemaEnv.meta&&e.opts.strictTypes&&(function(e,t){t.length&&(e.dataTypes.length?(t.forEach((t=>{T(e.dataTypes,t)||S(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)})),function(e,t){const n=[];for(const r of e.dataTypes)T(t,r)?n.push(r):t.includes("integer")&&"number"===r&&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"))&&S(e,"use allowUnionTypes to allow union type keyword")}(e,t),function(e,t){const n=e.self.RULES.all;for(const r in n){const i=n[r];if("object"==typeof i&&(0,s.shouldUseRule)(e.schema,i)){const{type:n}=i.definition;n.length&&!n.some((e=>{return r=e,(n=t).includes(r)||"number"===r&&n.includes("integer");var n,r}))&&S(e,`missing type "${n.join(",")}" for keyword "${r}"`)}}}(e,e.dataTypes))}(e,t),i.block((()=>{for(const e of f.rules)g(e);g(f.post)}))):i.block((()=>P(e,"$ref",f.all.$ref.definition)))}function C(e,t){const{gen:n,schema:r,opts:{useDefaults:i}}=e;i&&(0,a.assignDefaults)(e,t.type),n.block((()=>{for(const n of t.rules)(0,s.shouldUseRule)(r,n)&&P(e,n.keyword,n.definition,t.type)}))}function T(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function S(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,p.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){w(e)&&(b(e),y(e))?function(e){const{schema:t,opts:n,gen:r}=e;f(e,(()=>{n.$comment&&t.$comment&&A(e),function(e){const{schema:t,opts:n}=e;void 0!==t.default&&n.useDefaults&&n.strictSchema&&(0,p.checkStrictMode)(e,"default is ignored in the schema root")}(e),r.let(d.default.vErrors,null),r.let(d.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),v(e),function(e){const{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:s}=e;n.$async?t.if(u._`${d.default.errors} === 0`,(()=>t.return(d.default.data)),(()=>t.throw(u._`new ${i}(${d.default.vErrors})`))):(t.assign(u._`${r}.errors`,d.default.vErrors),s.unevaluated&&function({gen:e,evaluated:t,props:n,items:r}){n instanceof u.Name&&e.assign(u._`${t}.props`,n),r instanceof u.Name&&e.assign(u._`${t}.items`,r)}(e),t.return(u._`${d.default.errors} === 0`))}(e)}))}(e):f(e,(()=>(0,r.topBoolOrEmptySchema)(e)))};class _{constructor(e,t,n){if((0,c.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,p.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,c.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",d.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?m.reportExtraError:m.reportError)(this,this.def.error,t)}$dataError(){(0,m.reportError)(this,this.def.$dataError||m.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,m.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:r,schemaType:i,def:s}=this;n.if((0,u.or)(u._`${r} === undefined`,t)),e!==u.nil&&n.assign(e,!0),(i.length||s.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:r,it:i}=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,i.opts.strictNumbers,o.DataType.Wrong)}`}return u.nil}(),function(){if(r.validateSchema){const n=e.scopeValue("validate$data",{ref:r.validateSchema});return u._`!${n}(${t})`}return u.nil}())}subschema(e,t){const n=(0,l.getSubschema)(this.it,e);(0,l.extendSubschemaData)(n,this.it,e),(0,l.extendSubschemaMode)(n,e);const i={...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:r,opts:i}=e;i.$comment&&n.$comment&&A(e),function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,h.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 s=r.const("_errs",d.default.errors);v(e,s),r.var(t,u._`${s} === ${d.default.errors}`)}(e,t):(0,r.boolOrEmptySchema)(e,t)}(i,t),i}mergeEvaluated(e,t){const{it:n,gen:r}=this;n.opts.unevaluated&&(!0!==n.props&&void 0!==e.props&&(n.props=p.mergeEvaluated.props(r,e.props,n.props,t)),!0!==n.items&&void 0!==e.items&&(n.items=p.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){const{it:n,gen:r}=this;if(n.opts.unevaluated&&(!0!==n.props||!0!==n.items))return r.if(t,(()=>this.mergeEvaluated(e,u.Name))),!0}}function P(e,t,n,r){const i=new _(e,n,t);"code"in n?n.code(i,r):i.$data&&n.validate?(0,c.funcKeywordCode)(i,n):"macro"in n?(0,c.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,c.funcKeywordCode)(i,n)}t.KeywordCxt=_;const x=/^\/(?:[^~]|~0|~1)*$/,M=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function $(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,s;if(""===e)return d.default.rootData;if("/"===e[0]){if(!x.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);i=e,s=d.default.rootData}else{const o=M.exec(e);if(!o)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+o[1];if(i=o[2],"#"===i){if(a>=t)throw new Error(c("property/index",a));return r[t-a]}if(a>t)throw new Error(c("data",a));if(s=n[t-a],!i)return s}let o=s;const a=i.split("/");for(const e of a)e&&(s=u._`${s}${(0,u.getProperty)((0,p.unescapeJsonPointer)(e))}`,o=u._`${o} && ${s}`);return o;function c(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}t.getData=$},3673:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const r=n(9029),i=n(2023),s=n(5765),o=n(8708);function a(e){const{gen:t,data:n,it:i}=e;t.if(i.parentData,(()=>t.assign(n,r._`${i.parentData}[${i.parentDataProperty}]`)))}function c(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,r.stringify)(n)})}t.macroKeywordCode=function(e,t){const{gen:n,keyword:i,schema:s,parentSchema:o,it:a}=e,l=t.macro.call(a.self,s,o,a),u=c(n,i,l);!1!==a.opts.validateSchema&&a.self.validateSchema(l,!0);const d=n.name("valid");e.subschema({schema:l,schemaPath:r.nil,errSchemaPath:`${a.errSchemaPath}/${i}`,topSchemaRef:u,compositeRule:!0},d),e.pass(d,(()=>e.error(!0)))},t.funcKeywordCode=function(e,t){var n;const{gen:l,keyword:u,schema:d,parentSchema:h,$data:p,it:m}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(m,t);const f=!p&&t.compile?t.compile.call(m.self,d,h,m):t.validate,g=c(l,u,f),y=l.let("valid");function w(n=(t.async?r._`await `:r.nil)){const o=m.opts.passContext?i.default.this:i.default.self,a=!("compile"in t&&!p||!1===t.schema);l.assign(y,r._`${n}${(0,s.callValidateCode)(e,g,o,a)}`,t.modifying)}function b(e){var n;l.if((0,r.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=l.let("ruleErrs",null);return l.try((()=>w(r._`await `)),(t=>l.assign(y,!1).if(r._`${t} instanceof ${m.ValidationError}`,(()=>l.assign(e,r._`${t}.errors`)),(()=>l.throw(t))))),e}():function(){const e=r._`${g}.errors`;return l.assign(e,null),w(r.nil),e}();t.modifying&&a(e),b((()=>function(e,t){const{gen:n}=e;n.if(r._`Array.isArray(${t})`,(()=>{n.assign(i.default.vErrors,r._`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`).assign(i.default.errors,r._`${i.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:r},i,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw new Error("ajv implementation error");const o=i.dependencies;if(null==o?void 0:o.some((t=>!Object.prototype.hasOwnProperty.call(e,t))))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[s])){const e=`keyword "${s}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);n.logger.error(e)}}},4495:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;const r=n(9029),i=n(4227);t.getSubschema=function(e,{keyword:t,schemaProp:n,schema:s,schemaPath:o,errSchemaPath:a,topSchemaRef:c}){if(void 0!==t&&void 0!==s)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){const s=e.schema[t];return void 0===n?{schema:s,schemaPath:r._`${e.schemaPath}${(0,r.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[n],schemaPath:r._`${e.schemaPath}${(0,r.getProperty)(t)}${(0,r.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,i.escapeFragment)(n)}`}}if(void 0!==s){if(void 0===o||void 0===a||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:o,topSchemaRef:c,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:n,dataPropType:s,data:o,dataTypes:a,propertyName:c}){if(void 0!==o&&void 0!==n)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:l}=t;if(void 0!==n){const{errorPath:o,dataPathArr:a,opts:c}=t;u(l.let("data",r._`${t.data}${(0,r.getProperty)(n)}`,!0)),e.errorPath=r.str`${o}${(0,i.getErrorPath)(n,s,c.jsPropertySyntax)}`,e.parentDataProperty=r._`${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 r.Name?o:l.let("data",o,!0)),void 0!==c&&(e.propertyName=c)),a&&(e.dataTypes=a)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:s}){void 0!==r&&(e.compositeRule=r),void 0!==i&&(e.createErrors=i),void 0!==s&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=n}},4042:(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 r=n(2586);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return r.KeywordCxt}});var i=n(9029);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return i.CodeGen}});const s=n(3558),o=n(4551),a=n(396),c=n(3835),l=n(9029),u=n(6939),d=n(208),h=n(4227),p=n(3837),m=n(5944),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.'};function v(e){var t,n,r,i,s,o,a,c,l,u,d,h,p,g,y,w,b,v,A,E,C,T,S,_,P;const x=e.strict,M=null===(t=e.code)||void 0===t?void 0:t.optimize,$=!0===M||void 0===M?1:M||0,N=null!==(r=null===(n=e.code)||void 0===n?void 0:n.regExp)&&void 0!==r?r:f,L=null!==(i=e.uriResolver)&&void 0!==i?i:m.default;return{strictSchema:null===(o=null!==(s=e.strictSchema)&&void 0!==s?s:x)||void 0===o||o,strictNumbers:null===(c=null!==(a=e.strictNumbers)&&void 0!==a?a:x)||void 0===c||c,strictTypes:null!==(u=null!==(l=e.strictTypes)&&void 0!==l?l:x)&&void 0!==u?u:"log",strictTuples:null!==(h=null!==(d=e.strictTuples)&&void 0!==d?d:x)&&void 0!==h?h:"log",strictRequired:null!==(g=null!==(p=e.strictRequired)&&void 0!==p?p:x)&&void 0!==g&&g,code:e.code?{...e.code,optimize:$,regExp:N}:{optimize:$,regExp:N},loopRequired:null!==(y=e.loopRequired)&&void 0!==y?y:200,loopEnum:null!==(w=e.loopEnum)&&void 0!==w?w:200,meta:null===(b=e.meta)||void 0===b||b,messages:null===(v=e.messages)||void 0===v||v,inlineRefs:null===(A=e.inlineRefs)||void 0===A||A,schemaId:null!==(E=e.schemaId)&&void 0!==E?E:"$id",addUsedSchema:null===(C=e.addUsedSchema)||void 0===C||C,validateSchema:null===(T=e.validateSchema)||void 0===T||T,validateFormats:null===(S=e.validateFormats)||void 0===S||S,unicodeRegExp:null===(_=e.unicodeRegExp)||void 0===_||_,int32range:null===(P=e.int32range)||void 0===P||P,uriResolver:L}}class A{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...v(e)};const{es5:t,lines:n}=this.opts.code;this.scope=new l.ValueScope({scope:{},prefixes:y,es5:t,lines:n}),this.logger=function(e){if(!1===e)return x;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),E.call(this,w,e,"NOT SUPPORTED"),E.call(this,b,e,"DEPRECATED","warn"),this._metaOpts=P.call(this),e.formats&&S.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&_.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),T.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:n}=this.opts;let r=p;"id"===n&&(r={...p},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[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 r=n(t);return"$async"in n||(this.errors=n.errors),r}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 r.call(this,e,t);async function r(e,t){await i.call(this,e.$schema);const n=this._addSchema(e,t);return n.validate||s.call(this,n)}async function i(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function s(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return a.call(this,t),await c.call(this,t.missingSchema),s.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 c(e){const n=await l.call(this,e);this.refs[e]||await i.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function l(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,r=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,n,r);return this}let i;if("object"==typeof e){const{schemaId:t}=this.opts;if(i=e[t],void 0!==i&&"string"!=typeof i)throw new Error(`schema ${t} must be string`)}return t=(0,u.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!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 r=this.validate(n,e);if(!r&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return r}getSchema(e){let t;for(;"string"==typeof(t=C.call(this,e));)e=t;if(void 0===t){const{schemaId:n}=this.opts,r=new c.SchemaEnv({schema:{},schemaId:n});if(t=c.resolveSchema.call(this,r,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=C.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($.call(this,n,t),!t)return(0,h.eachItem)(n,(e=>N.call(this,e))),this;I.call(this,t);const r={...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)};return(0,h.eachItem)(n,0===r.type.length?e=>N.call(this,e,r):e=>r.type.forEach((t=>N.call(this,e,r,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 r of t){const t=r.split("/").slice(1);let i=e;for(const e of t)i=i[e];for(const e in n){const t=n[e];if("object"!=typeof t)continue;const{$data:r}=t.definition,s=i[e];r&&s&&(i[e]=O(s))}}return e}_removeAllSchemas(e,t){for(const n in e){const r=e[n];t&&!t.test(n)||("string"==typeof r?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let s;const{schemaId:o}=this.opts;if("object"==typeof e)s=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)(s||n);const l=u.getSchemaRefs.call(this,e,n);return a=new c.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:n,localRefs:l}),this._cache.set(a.schema,a),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=a),r&&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):c.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{c.compileSchema.call(this,e)}finally{this.opts=t}}}function E(e,t,n,r="error"){for(const i in e){const s=i;s in t&&this.logger[r](`${n}: option ${i}. ${e[s]}`)}}function C(e){return e=(0,u.normalizeId)(e),this.schemas[e]||this.refs[e]}function T(){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 S(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function _(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}A.ValidationError=s.default,A.MissingRefError=o.default,t.default=A;const x={log(){},warn(){},error(){}},M=/^[a-z_$][a-z0-9_$:-]*$/i;function $(e,t){const{RULES:n}=this;if((0,h.eachItem)(e,(e=>{if(n.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!M.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 N(e,t,n){var r;const i=null==t?void 0:t.post;if(n&&i)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:s}=this;let o=i?s.post:s.rules.find((({type:e})=>e===n));if(o||(o={type:n,rules:[]},s.rules.push(o)),s.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)}};t.before?L.call(this,o,a,t.before):o.rules.push(a),s.all[e]=a,null===(r=t.implements)||void 0===r||r.forEach((e=>this.addKeyword(e)))}function L(e,t,n){const r=e.rules.findIndex((e=>e.keyword===n));r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function I(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=O(t)),e.validateSchema=this.compile(t,!0))}const R={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function O(e){return{anyOf:[e,R]}}},9572:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(1678),i=n(7216),s=n(9547),o=n(8226),a=n(518),c=n(4588),l=n(5707),u=n(7082),d=["/properties"];t.default=function(e){return[r,i,s,o,a,t(this,c),l,t(this,u)].forEach((e=>this.addMetaSchema(e,void 0,!1))),this;function t(t,n){return e?t.$dataMetaSchema(n,d):n}}},6250:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2017);r.code='require("ajv/dist/runtime/equal").default',t.default=r},3853:(e,t)=>{"use strict";function n(e){const t=e.length;let n,r=0,i=0;for(;i<t;)r++,n=e.charCodeAt(i++),n>=55296&&n<=56319&&i<t&&(n=e.charCodeAt(i),56320==(64512&n)&&i++);return r}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n,n.code='require("ajv/dist/runtime/ucs2length").default'},5944:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(8343);r.code='require("ajv/dist/runtime/uri").default',t.default=r},3558:(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},5457:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;const r=n(9029),i=n(4227),s={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>r.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>r._`{limit: ${e}}`},code(e){const{parentSchema:t,it:n}=e,{items:r}=t;Array.isArray(r)?o(e,r):(0,i.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}};function o(e,t){const{gen:n,schema:s,data:o,keyword:a,it:c}=e;c.items=!0;const l=n.const("len",r._`${o}.length`);if(!1===s)e.setParams({len:t.length}),e.pass(r._`${l} <= ${t.length}`);else if("object"==typeof s&&!(0,i.alwaysValidSchema)(c,s)){const s=n.var("valid",r._`${l} <= ${t.length}`);n.if((0,r.not)(s),(()=>function(s){n.forRange("i",t.length,l,(t=>{e.subschema({keyword:a,dataProp:t,dataPropType:i.Type.Num},s),c.allErrors||n.if((0,r.not)(s),(()=>n.break()))}))}(s))),e.ok(s)}}t.validateAdditionalItems=o,t.default=s},8660:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5765),i=n(9029),s=n(2023),o=n(4227),a={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>i._`{additionalProperty: ${e.additionalProperty}}`},code(e){const{gen:t,schema:n,parentSchema:a,data:c,errsCount:l,it:u}=e;if(!l)throw new Error("ajv implementation error");const{allErrors:d,opts:h}=u;if(u.props=!0,"all"!==h.removeAdditional&&(0,o.alwaysValidSchema)(u,n))return;const p=(0,r.allSchemaProperties)(a.properties),m=(0,r.allSchemaProperties)(a.patternProperties);function f(e){t.code(i._`delete ${c}[${e}]`)}function g(r){if("all"===h.removeAdditional||h.removeAdditional&&!1===n)f(r);else{if(!1===n)return e.setParams({additionalProperty:r}),e.error(),void(d||t.break());if("object"==typeof n&&!(0,o.alwaysValidSchema)(u,n)){const n=t.name("valid");"failing"===h.removeAdditional?(y(r,n,!1),t.if((0,i.not)(n),(()=>{e.reset(),f(r)}))):(y(r,n),d||t.if((0,i.not)(n),(()=>t.break())))}}}function y(t,n,r){const i={keyword:"additionalProperties",dataProp:t,dataPropType:o.Type.Str};!1===r&&Object.assign(i,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(i,n)}t.forIn("key",c,(n=>{p.length||m.length?t.if(function(n){let s;if(p.length>8){const e=(0,o.schemaRefOrVal)(u,a.properties,"properties");s=(0,r.isOwnProperty)(t,e,n)}else s=p.length?(0,i.or)(...p.map((e=>i._`${n} === ${e}`))):i.nil;return m.length&&(s=(0,i.or)(s,...m.map((t=>i._`${(0,r.usePattern)(e,t)}.test(${n})`)))),(0,i.not)(s)}(n),(()=>g(n))):g(n)})),e.ok(i._`${l} === ${s.default.errors}`)}};t.default=a},5844:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4227),i={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:n,it:i}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");const s=t.name("valid");n.forEach(((t,n)=>{if((0,r.alwaysValidSchema)(i,t))return;const o=e.subschema({keyword:"allOf",schemaProp:n},s);e.ok(s),e.mergeEvaluated(o)}))}};t.default=i},6505:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:n(5765).validateUnion,error:{message:"must match a schema in anyOf"}};t.default=r},2661:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?r.str`must contain at least ${e} valid item(s)`:r.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?r._`{minContains: ${e}}`:r._`{minContains: ${e}, maxContains: ${t}}`},code(e){const{gen:t,schema:n,parentSchema:s,data:o,it:a}=e;let c,l;const{minContains:u,maxContains:d}=s;a.opts.next?(c=void 0===u?1:u,l=d):c=1;const h=t.const("len",r._`${o}.length`);if(e.setParams({min:c,max:l}),void 0===l&&0===c)return void(0,i.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==l&&c>l)return(0,i.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),void e.fail();if((0,i.alwaysValidSchema)(a,n)){let t=r._`${h} >= ${c}`;return void 0!==l&&(t=r._`${t} && ${h} <= ${l}`),void e.pass(t)}a.items=!0;const p=t.name("valid");function m(){const e=t.name("_valid"),n=t.let("count",0);f(e,(()=>t.if(e,(()=>function(e){t.code(r._`${e}++`),void 0===l?t.if(r._`${e} >= ${c}`,(()=>t.assign(p,!0).break())):(t.if(r._`${e} > ${l}`,(()=>t.assign(p,!1).break())),1===c?t.assign(p,!0):t.if(r._`${e} >= ${c}`,(()=>t.assign(p,!0))))}(n)))))}function f(n,r){t.forRange("i",0,h,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:i.Type.Num,compositeRule:!0},n),r()}))}void 0===l&&1===c?f(p,(()=>t.if(p,(()=>t.break())))):0===c?(t.let(p,!0),void 0!==l&&t.if(r._`${o}.length > 0`,m)):(t.let(p,!1),m()),e.result(p,(()=>e.reset()))}};t.default=s},3025:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const r=n(9029),i=n(4227),s=n(5765);t.error={message:({params:{property:e,depsCount:t,deps:n}})=>{const i=1===t?"property":"properties";return r.str`must have ${i} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:n,missingProperty:i}})=>r._`{property: ${e},
|
|
5
5
|
missingProperty: ${i},
|
|
6
6
|
depsCount: ${t},
|
|
7
|
-
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 r in e)"__proto__"!==r&&((Array.isArray(e[r])?t:n)[r]=e[r]);return[t,n]}(e);a(e,t),c(e,n)}};function a(e,t=e.schema){const{gen:n,data:i,it:o}=e;if(0===Object.keys(t).length)return;const a=n.let("missing");for(const c in t){const l=t[c];if(0===l.length)continue;const u=(0,s.propertyInData)(n,i,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(", ")}),o.allErrors?n.if(u,(()=>{for(const t of l)(0,s.checkReportMissingProp)(e,t)})):(n.if(r._`${u} && (${(0,s.checkMissingProp)(e,l,a)})`),(0,s.reportMissingProp)(e,a),n.else())}}function c(e,t=e.schema){const{gen:n,data:r,keyword:o,it:a}=e,c=n.name("valid");for(const l in t)(0,i.alwaysValidSchema)(a,t[l])||(n.if((0,s.propertyInData)(n,r,l,a.opts.ownProperties),(()=>{const t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)}),(()=>n.var(c,!0))),e.ok(c))}t.validatePropertyDeps=a,t.validateSchemaDeps=c,t.default=o},4845:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3025),i={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,r.validateSchemaDeps)(e)};t.default=i},1239:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>r.str`must match "${e.ifClause}" schema`,params:({params:e})=>r._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:n,it:s}=e;void 0===n.then&&void 0===n.else&&(0,i.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const a=o(s,"then"),c=o(s,"else");if(!a&&!c)return;const l=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&&c){const n=t.let("ifClause");e.setParams({ifClause:n}),t.if(u,d("then",n),d("else",n))}else a?t.if(u,d("then")):t.if((0,r.not)(u),d("else"));function d(n,i){return()=>{const s=e.subschema({keyword:n},u);t.assign(l,u),e.mergeValidEvaluated(s,l),i?t.assign(i,r._`${n}`):e.setParams({ifClause:n})}}e.pass(l,(()=>e.error(!0)))}};function o(e,t){const n=e.schema[t];return void 0!==n&&!(0,i.alwaysValidSchema)(e,n)}t.default=s},6378:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5457),i=n(5354),s=n(494),o=n(3966),a=n(2661),c=n(3025),l=n(9713),u=n(8660),d=n(117),h=n(5333),p=n(7923),m=n(6505),f=n(6163),g=n(5844),y=n(1239),w=n(4426);t.default=function(e=!1){const t=[p.default,m.default,f.default,g.default,y.default,w.default,l.default,u.default,c.default,d.default,h.default];return e?t.push(i.default,o.default):t.push(r.default,s.default),t.push(a.default),t}},494:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;const r=n(9029),i=n(4227),s=n(5765),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,i.alwaysValidSchema)(n,t)||e.ok((0,s.validateArray)(e))}};function a(e,t,n=e.schema){const{gen:s,parentSchema:o,data:a,keyword:c,it:l}=e;!function(e){const{opts:r,errSchemaPath:s}=l,o=n.length,a=o===e.minItems&&(o===e.maxItems||!1===e[t]);if(r.strictTuples&&!a){const e=`"${c}" is ${o}-tuple, but minItems or maxItems/${t} are not specified or different at path "${s}"`;(0,i.checkStrictMode)(l,e,r.strictTuples)}}(o),l.opts.unevaluated&&n.length&&!0!==l.items&&(l.items=i.mergeEvaluated.items(s,n.length,l.items));const u=s.name("valid"),d=s.const("len",r._`${a}.length`);n.forEach(((t,n)=>{(0,i.alwaysValidSchema)(l,t)||(s.if(r._`${d} > ${n}`,(()=>e.subschema({keyword:c,schemaProp:n,dataProp:n},u))),e.ok(u))}))}t.validateTuple=a,t.default=o},3966:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(5765),o=n(5457),a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>r.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>r._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:n,it:r}=e,{prefixItems:a}=n;r.items=!0,(0,i.alwaysValidSchema)(r,t)||(a?(0,o.validateAdditionalItems)(e,a):e.ok((0,s.validateArray)(e)))}};t.default=a},7923:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4227),i={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:i}=e;if((0,r.alwaysValidSchema)(i,n))return void e.fail();const s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,(()=>e.reset()),(()=>e.error()))},error:{message:"must NOT be valid"}};t.default=i},6163:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>r._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:n,parentSchema:s,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(o.opts.discriminator&&s.discriminator)return;const a=n,c=t.let("valid",!1),l=t.let("passing",null),u=t.name("_valid");e.setParams({passing:l}),t.block((function(){a.forEach(((n,s)=>{let a;(0,i.alwaysValidSchema)(o,n)?t.var(u,!0):a=e.subschema({keyword:"oneOf",schemaProp:s,compositeRule:!0},u),s>0&&t.if(r._`${u} && ${c}`).assign(c,!1).assign(l,r._`[${l}, ${s}]`).else(),t.if(u,(()=>{t.assign(c,!0),t.assign(l,s),a&&e.mergeEvaluated(a,r.Name)}))}))})),e.result(c,(()=>e.reset()),(()=>e.error(!0)))}};t.default=s},5333:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5765),i=n(9029),s=n(4227),o=n(4227),a={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,data:a,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,r.allSchemaProperties)(n),h=d.filter((e=>(0,s.alwaysValidSchema)(l,n[e])));if(0===d.length||h.length===d.length&&(!l.opts.unevaluated||!0===l.props))return;const p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=t.name("valid");!0===l.props||l.props instanceof i.Name||(l.props=(0,o.evaluatedPropsToName)(t,l.props));const{props:f}=l;function g(e){for(const t in p)new RegExp(e).test(t)&&(0,s.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function y(n){t.forIn("key",a,(s=>{t.if(i._`${(0,r.usePattern)(e,n)}.test(${s})`,(()=>{const r=h.includes(n);r||e.subschema({keyword:"patternProperties",schemaProp:n,dataProp:s,dataPropType:o.Type.Str},m),l.opts.unevaluated&&!0!==f?t.assign(i._`${f}[${s}]`,!0):r||l.allErrors||t.if((0,i.not)(m),(()=>t.break()))}))}))}!function(){for(const e of d)p&&g(e),l.allErrors?y(e):(t.var(m,!0),y(e),t.if(m))}()}};t.default=a},5354:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(494),i={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,r.validateTuple)(e,"items")};t.default=i},117:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2586),i=n(5765),s=n(4227),o=n(8660),a={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,parentSchema:a,data:c,it:l}=e;"all"===l.opts.removeAdditional&&void 0===a.additionalProperties&&o.default.code(new r.KeywordCxt(l,o.default,"additionalProperties"));const u=(0,i.allSchemaProperties)(n);for(const e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&!0!==l.props&&(l.props=s.mergeEvaluated.props(t,(0,s.toHash)(u),l.props));const d=u.filter((e=>!(0,s.alwaysValidSchema)(l,n[e])));if(0===d.length)return;const h=t.name("valid");for(const n of d)p(n)?m(n):(t.if((0,i.propertyInData)(t,c,n,l.opts.ownProperties)),m(n),l.allErrors||t.else().var(h,!0),t.endIf()),e.it.definedProperties.add(n),e.ok(h);function p(e){return l.opts.useDefaults&&!l.compositeRule&&void 0!==n[e].default}function m(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},h)}}};t.default=a},9713:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>r._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:n,data:s,it:o}=e;if((0,i.alwaysValidSchema)(o,n))return;const a=t.name("valid");t.forIn("key",s,(n=>{e.setParams({propertyName:n}),e.subschema({keyword:"propertyNames",data:n,dataTypes:["string"],propertyName:n,compositeRule:!0},a),t.if((0,r.not)(a),(()=>{e.error(!0),o.allErrors||t.break()}))})),e.ok(a)}};t.default=s},4426:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4227),i={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){void 0===t.if&&(0,r.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};t.default=i},5765:(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 r=n(9029),i=n(4227),s=n(2023),o=n(4227);function a(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:r._`Object.prototype.hasOwnProperty`})}function c(e,t,n){return r._`${a(e)}.call(${t}, ${n})`}function l(e,t,n,i){const s=r._`${t}${(0,r.getProperty)(n)} === undefined`;return i?(0,r.or)(s,(0,r.not)(c(e,t,n))):s}function u(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}t.checkReportMissingProp=function(e,t){const{gen:n,data:i,it:s}=e;n.if(l(n,i,t,s.opts.ownProperties),(()=>{e.setParams({missingProperty:r._`${t}`},!0),e.error()}))},t.checkMissingProp=function({gen:e,data:t,it:{opts:n}},i,s){return(0,r.or)(...i.map((i=>(0,r.and)(l(e,t,i,n.ownProperties),r._`${s} = ${i}`))))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=a,t.isOwnProperty=c,t.propertyInData=function(e,t,n,i){const s=r._`${t}${(0,r.getProperty)(n)} !== undefined`;return i?r._`${s} && ${c(e,t,n)}`:s},t.noPropertyInData=l,t.allSchemaProperties=u,t.schemaProperties=function(e,t){return u(t).filter((n=>!(0,i.alwaysValidSchema)(e,t[n])))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:n,topSchemaRef:i,schemaPath:o,errorPath:a},it:c},l,u,d){const h=d?r._`${e}, ${t}, ${i}${o}`:t,p=[[s.default.instancePath,(0,r.strConcat)(s.default.instancePath,a)],[s.default.parentData,c.parentData],[s.default.parentDataProperty,c.parentDataProperty],[s.default.rootData,s.default.rootData]];c.opts.dynamicRef&&p.push([s.default.dynamicAnchors,s.default.dynamicAnchors]);const m=r._`${h}, ${n.object(...p)}`;return u!==r.nil?r._`${l}.call(${u}, ${m})`:r._`${l}(${m})`};const d=r._`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},n){const i=t.unicodeRegExp?"u":"",{regExp:s}=t.code,a=s(n,i);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:r._`${"new RegExp"===s.code?d:(0,o.useFunc)(e,s)}(${n}, ${i})`})},t.validateArray=function(e){const{gen:t,data:n,keyword:s,it:o}=e,a=t.name("valid");if(o.allErrors){const e=t.let("valid",!0);return c((()=>t.assign(e,!1))),e}return t.var(a,!0),c((()=>t.break())),a;function c(o){const c=t.const("len",r._`${n}.length`);t.forRange("i",0,c,(n=>{e.subschema({keyword:s,dataProp:n,dataPropType:i.Type.Num},a),t.if((0,r.not)(a),o)}))}},t.validateUnion=function(e){const{gen:t,schema:n,keyword:s,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some((e=>(0,i.alwaysValidSchema)(o,e)))&&!o.opts.unevaluated)return;const a=t.let("valid",!1),c=t.name("_valid");t.block((()=>n.forEach(((n,i)=>{const o=e.subschema({keyword:s,schemaProp:i,compositeRule:!0},c);t.assign(a,r._`${a} || ${c}`),e.mergeValidEvaluated(o,c)||t.if((0,r.not)(a))})))),e.result(a,(()=>e.reset()),(()=>e.error(!0)))}},3463:(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},2128:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3463),i=n(3693),s=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,i.default];t.default=s},3693:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;const r=n(4551),i=n(5765),s=n(9029),o=n(2023),a=n(3835),c=n(4227),l={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:i}=e,{baseId:o,schemaEnv:c,validateName:l,opts:h,self:p}=i,{root:m}=c;if(("#"===n||"#/"===n)&&o===m.baseId)return function(){if(c===m)return d(e,l,c,c.$async);const n=t.scopeValue("root",{ref:m});return d(e,s._`${n}.validate`,m,m.$async)}();const f=a.resolveRef.call(p,m,o,n);if(void 0===f)throw new r.default(i.opts.uriResolver,o,n);return f instanceof a.SchemaEnv?function(t){const n=u(e,t);d(e,n,t,t.$async)}(f):function(r){const i=t.scopeValue("schema",!0===h.code.source?{ref:r,code:(0,s.stringify)(r)}:{ref:r}),o=t.name("valid"),a=e.subschema({schema:r,dataTypes:[],schemaPath:s.nil,topSchemaRef:i,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}):s._`${n.scopeValue("wrapper",{ref:t})}.validate`}function d(e,t,n,r){const{gen:a,it:l}=e,{allErrors:u,schemaEnv:d,opts:h}=l,p=h.passContext?o.default.this:s.nil;function m(e){const t=s._`${e}.errors`;a.assign(o.default.vErrors,s._`${o.default.vErrors} === null ? ${t} : ${o.default.vErrors}.concat(${t})`),a.assign(o.default.errors,s._`${o.default.vErrors}.length`)}function f(e){var t;if(!l.opts.unevaluated)return;const r=null===(t=null==n?void 0:n.validate)||void 0===t?void 0:t.evaluated;if(!0!==l.props)if(r&&!r.dynamicProps)void 0!==r.props&&(l.props=c.mergeEvaluated.props(a,r.props,l.props));else{const t=a.var("props",s._`${e}.evaluated.props`);l.props=c.mergeEvaluated.props(a,t,l.props,s.Name)}if(!0!==l.items)if(r&&!r.dynamicItems)void 0!==r.items&&(l.items=c.mergeEvaluated.items(a,r.items,l.items));else{const t=a.var("items",s._`${e}.evaluated.items`);l.items=c.mergeEvaluated.items(a,t,l.items,s.Name)}}r?function(){if(!d.$async)throw new Error("async schema referenced by sync schema");const n=a.let("valid");a.try((()=>{a.code(s._`await ${(0,i.callValidateCode)(e,t,p)}`),f(t),u||a.assign(n,!0)}),(e=>{a.if(s._`!(${e} instanceof ${l.ValidationError})`,(()=>a.throw(e))),m(e),u||a.assign(n,!1)})),e.ok(n)}():e.result((0,i.callValidateCode)(e,t,p),(()=>f(t)),(()=>m(t)))}t.getValidate=u,t.callRef=d,t.default=l},6653:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(7652),s=n(3835),o=n(4551),a=n(4227),c={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===i.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>r._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},code(e){const{gen:t,data:n,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw new Error("discriminator: requires discriminator option");const h=c.propertyName;if("string"!=typeof h)throw new Error("discriminator: requires propertyName");if(c.mapping)throw new Error("discriminator: mapping is not supported");if(!d)throw new Error("discriminator: requires oneOf keyword");const p=t.let("valid",!1),m=t.const("tag",r._`${n}${(0,r.getProperty)(h)}`);function f(n){const i=t.name("valid"),s=e.subschema({keyword:"oneOf",schemaProp:n},i);return e.mergeEvaluated(s,r.Name),i}t.if(r._`typeof ${m} == "string"`,(()=>function(){const n=function(){var e;const t={},n=i(l);let r=!0;for(let t=0;t<d.length;t++){let l=d[t];if((null==l?void 0:l.$ref)&&!(0,a.schemaHasRulesButRef)(l,u.self.RULES)){const e=l.$ref;if(l=s.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),l instanceof s.SchemaEnv&&(l=l.schema),void 0===l)throw new o.default(u.opts.uriResolver,u.baseId,e)}const p=null===(e=null==l?void 0:l.properties)||void 0===e?void 0:e[h];if("object"!=typeof p)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);r=r&&(n||i(l)),c(p,t)}if(!r)throw new Error(`discriminator: "${h}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(h)}function c(e,t){if(e.const)p(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${h}" must have "const" or "enum"`);for(const n of e.enum)p(n,t)}}function p(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(r._`${m} === ${e}`),t.assign(p,f(n[e]));t.else(),e.error(!1,{discrError:i.DiscrError.Mapping,tag:m,tagName:h}),t.endIf()}()),(()=>e.error(!1,{discrError:i.DiscrError.Tag,tag:m,tagName:h}))),e.ok(p)}};t.default=c},7652:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(n||(t.DiscrError=n={}))},6105:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2128),i=n(7060),s=n(6378),o=n(5520),a=n(5413),c=n(3265),l=n(7532),u=n(9857),d=[o.default,r.default,i.default,(0,s.default)(!0),l.default,u.metadataVocabulary,u.contentVocabulary,a.default,c.default];t.default=d},6144:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2128),i=n(7060),s=n(6378),o=n(7532),a=n(9857),c=[r.default,i.default,(0,s.default)(),o.default,a.metadataVocabulary,a.contentVocabulary];t.default=c},2476:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;const r=n(9029),i=n(2023),s=n(3835),o=n(3693),a={keyword:"$dynamicAnchor",schemaType:"string",code:e=>c(e,e.schema)};function c(e,t){const{gen:n,it:a}=e;a.schemaEnv.root.dynamicAnchors[t]=!0;const c=r._`${i.default.dynamicAnchors}${(0,r.getProperty)(t)}`,l="#"===a.errSchemaPath?a.validateName:function(e){const{schemaEnv:t,schema:n,self:r}=e.it,{root:i,baseId:a,localRefs:c,meta:l}=t.root,{schemaId:u}=r.opts,d=new s.SchemaEnv({schema:n,schemaId:u,root:i,baseId:a,localRefs:c,meta:l});return s.compileSchema.call(r,d),(0,o.getValidate)(e,d)}(e);n.if(r._`!${c}`,(()=>n.assign(c,l)))}t.dynamicAnchor=c,t.default=a},3252:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;const r=n(9029),i=n(2023),s=n(3693),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 c=t.slice(1);if(a.allErrors)l();else{const t=n.let("valid",!1);l(t),e.ok(t)}function l(e){if(a.schemaEnv.root.dynamicAnchors[c]){const t=n.let("_v",r._`${i.default.dynamicAnchors}${(0,r.getProperty)(c)}`);n.if(t,u(t,e),u(a.validateName,e))}else u(a.validateName,e)()}function u(t,r){return r?()=>n.block((()=>{(0,s.callRef)(e,t),n.let(r,!0)})):()=>(0,s.callRef)(e,t)}}t.dynamicRef=a,t.default=o},5520:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2476),i=n(3252),s=n(2721),o=n(3799),a=[r.default,i.default,s.default,o.default];t.default=a},2721:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2476),i=n(4227),s={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,r.dynamicAnchor)(e,""):(0,i.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}};t.default=s},3799:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3252),i={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,r.dynamicRef)(e,e.schema)};t.default=i},4737:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>r.str`must match format "${e}"`,params:({schemaCode:e})=>r._`{format: ${e}}`},code(e,t){const{gen:n,data:i,$data:s,schema:o,schemaCode:a,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:h}=c;l.validateFormats&&(s?function(){const s=n.scopeValue("formats",{ref:h.formats,code:l.code.formats}),o=n.const("fDef",r._`${s}[${a}]`),c=n.let("fType"),u=n.let("format");n.if(r._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>n.assign(c,r._`${o}.type || "string"`).assign(u,r._`${o}.validate`)),(()=>n.assign(c,r._`"string"`).assign(u,o))),e.fail$data((0,r.or)(!1===l.strictSchema?r.nil:r._`${a} && !${u}`,function(){const e=d.$async?r._`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:r._`${u}(${i})`,n=r._`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return r._`${u} && ${u} !== true && ${c} === ${t} && !${n}`}()))}():function(){const s=h.formats[o];if(!s)return void function(){if(!1!==l.strictSchema)throw new Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}h.logger.warn(e())}();if(!0===s)return;const[a,c,p]=function(e){const t=e instanceof RegExp?(0,r.regexpCode)(e):l.code.formats?r._`${l.code.formats}${(0,r.getProperty)(o)}`:void 0,i=n.scopeValue("formats",{key:o,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,i]:[e.type||"string",e.validate,r._`${i}.validate`]}(s);a===t&&e.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!d.$async)throw new Error("async format in sync schema");return r._`await ${p}(${i})`}return"function"==typeof c?r._`${p}(${i})`:r._`${p}.test(${i})`}())}())}};t.default=i},7532:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=[n(4737).default];t.default=r},9857:(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"]},5413:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(1846),i=n(4845),s=n(2626),o=[r.default,i.default,s.default];t.default=o},3265:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(392),i=n(3445),s=[r.default,i.default];t.default=s},3445:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:e}})=>r.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>r._`{limit: ${e}}`},code(e){const{gen:t,schema:n,data:s,it:o}=e,a=o.items||0;if(!0===a)return;const c=t.const("len",r._`${s}.length`);if(!1===n)e.setParams({len:a}),e.fail(r._`${c} > ${a}`);else if("object"==typeof n&&!(0,i.alwaysValidSchema)(o,n)){const n=t.var("valid",r._`${c} <= ${a}`);t.if((0,r.not)(n),(()=>function(n,s){t.forRange("i",s,c,(s=>{e.subschema({keyword:"unevaluatedItems",dataProp:s,dataPropType:i.Type.Num},n),o.allErrors||t.if((0,r.not)(n),(()=>t.break()))}))}(n,a))),e.ok(n)}o.items=!0}};t.default=s},392:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(2023),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:e})=>r._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){const{gen:t,schema:n,data:o,errsCount:a,it:c}=e;if(!a)throw new Error("ajv implementation error");const{allErrors:l,props:u}=c;function d(s){if(!1===n)return e.setParams({unevaluatedProperty:s}),e.error(),void(l||t.break());if(!(0,i.alwaysValidSchema)(c,n)){const n=t.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:s,dataPropType:i.Type.Str},n),l||t.if((0,r.not)(n),(()=>t.break()))}}u instanceof r.Name?t.if(r._`${u} !== true`,(()=>t.forIn("key",o,(e=>t.if(function(e,t){return r._`!${e} || !${e}[${t}]`}(u,e),(()=>d(e))))))):!0!==u&&t.forIn("key",o,(e=>void 0===u?d(e):t.if(function(e,t){const n=[];for(const i in e)!0===e[i]&&n.push(r._`${t} !== ${i}`);return(0,r.and)(...n)}(u,e),(()=>d(e))))),c.props=!0,e.ok(r._`${a} === ${s.default.errors}`)}};t.default=o},7935:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(6250),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>r._`{allowedValue: ${e}}`},code(e){const{gen:t,data:n,$data:o,schemaCode:a,schema:c}=e;o||c&&"object"==typeof c?e.fail$data(r._`!${(0,i.useFunc)(t,s.default)}(${n}, ${a})`):e.fail(r._`${c} !== ${n}`)}};t.default=o},1846:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3025),i={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:e=>(0,r.validatePropertyDeps)(e)};t.default=i},8643:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(6250),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>r._`{allowedValues: ${e}}`},code(e){const{gen:t,data:n,$data:o,schema:a,schemaCode:c,it:l}=e;if(!o&&0===a.length)throw new Error("enum must have non-empty array");const u=a.length>=l.opts.loopEnum;let d;const h=()=>null!=d?d:d=(0,i.useFunc)(t,s.default);let p;if(u||o)p=t.let("valid"),e.block$data(p,(function(){t.assign(p,!1),t.forOf("v",c,(e=>t.if(r._`${h()}(${n}, ${e})`,(()=>t.assign(p,!0).break()))))}));else{if(!Array.isArray(a))throw new Error("ajv implementation error");const e=t.const("vSchema",c);p=(0,r.or)(...a.map(((t,i)=>function(e,t){const i=a[t];return"object"==typeof i&&null!==i?r._`${h()}(${n}, ${e}[${t}])`:r._`${n} === ${i}`}(e,i))))}e.pass(p)}};t.default=o},7060:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5882),i=n(3439),s=n(7307),o=n(422),a=n(4486),c=n(4003),l=n(1163),u=n(617),d=n(7935),h=n(8643),p=[r.default,i.default,s.default,o.default,a.default,c.default,l.default,u.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},d.default,h.default];t.default=p},2626:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4227),i={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){void 0===t.contains&&(0,r.checkStrictMode)(n,`"${e}" without "contains" is ignored`)}};t.default=i},1163:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxItems"===e?"more":"fewer";return r.str`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>r._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:i}=e,s="maxItems"===t?r.operators.GT:r.operators.LT;e.fail$data(r._`${n}.length ${s} ${i}`)}};t.default=i},7307:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(3853),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxLength"===e?"more":"fewer";return r.str`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>r._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:o,it:a}=e,c="maxLength"===t?r.operators.GT:r.operators.LT,l=!1===a.opts.unicode?r._`${n}.length`:r._`${(0,i.useFunc)(e.gen,s.default)}(${n})`;e.fail$data(r._`${l} ${c} ${o}`)}};t.default=o},5882:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=r.operators,s={maximum:{okStr:"<=",ok:i.LTE,fail:i.GT},minimum:{okStr:">=",ok:i.GTE,fail:i.LT},exclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},exclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}},o={message:({keyword:e,schemaCode:t})=>r.str`must be ${s[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>r._`{comparison: ${s[e].okStr}, limit: ${t}}`},a={keyword:Object.keys(s),type:"number",schemaType:"number",$data:!0,error:o,code(e){const{keyword:t,data:n,schemaCode:i}=e;e.fail$data(r._`${n} ${s[t].fail} ${i} || isNaN(${n})`)}};t.default=a},4486:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxProperties"===e?"more":"fewer";return r.str`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>r._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:i}=e,s="maxProperties"===t?r.operators.GT:r.operators.LT;e.fail$data(r._`Object.keys(${n}).length ${s} ${i}`)}};t.default=i},3439:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>r.str`must be multiple of ${e}`,params:({schemaCode:e})=>r._`{multipleOf: ${e}}`},code(e){const{gen:t,data:n,schemaCode:i,it:s}=e,o=s.opts.multipleOfPrecision,a=t.let("res"),c=o?r._`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:r._`${a} !== parseInt(${a})`;e.fail$data(r._`(${i} === 0 || (${a} = ${n}/${i}, ${c}))`)}};t.default=i},422:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5765),i=n(9029),s={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>i.str`must match pattern "${e}"`,params:({schemaCode:e})=>i._`{pattern: ${e}}`},code(e){const{data:t,$data:n,schema:s,schemaCode:o,it:a}=e,c=a.opts.unicodeRegExp?"u":"",l=n?i._`(new RegExp(${o}, ${c}))`:(0,r.usePattern)(e,s);e.fail$data(i._`!${l}.test(${t})`)}};t.default=s},4003:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5765),i=n(9029),s=n(4227),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>i.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>i._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:n,schemaCode:o,data:a,$data:c,it:l}=e,{opts:u}=l;if(!c&&0===n.length)return;const d=n.length>=u.loopRequired;if(l.allErrors?function(){if(d||c)e.block$data(i.nil,h);else for(const t of n)(0,r.checkReportMissingProp)(e,t)}():function(){const s=t.let("missing");if(d||c){const n=t.let("valid",!0);e.block$data(n,(()=>function(n,s){e.setParams({missingProperty:n}),t.forOf(n,o,(()=>{t.assign(s,(0,r.propertyInData)(t,a,n,u.ownProperties)),t.if((0,i.not)(s),(()=>{e.error(),t.break()}))}),i.nil)}(s,n))),e.ok(n)}else t.if((0,r.checkMissingProp)(e,n,s)),(0,r.reportMissingProp)(e,s),t.else()}(),u.strictRequired){const t=e.parentSchema.properties,{definedProperties:r}=e.it;for(const e of n)if(void 0===(null==t?void 0:t[e])&&!r.has(e)){const t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,s.checkStrictMode)(l,t,l.opts.strictRequired)}}function h(){t.forOf("prop",o,(n=>{e.setParams({missingProperty:n}),t.if((0,r.noPropertyInData)(t,a,n,u.ownProperties),(()=>e.error()))}))}}};t.default=o},617:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(208),i=n(9029),s=n(4227),o=n(6250),a={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>i.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>i._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:n,$data:a,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!a&&!c)return;const h=t.let("valid"),p=l.items?(0,r.getSchemaTypes)(l.items):[];function m(s,o){const a=t.name("item"),c=(0,r.checkDataTypes)(p,a,d.opts.strictNumbers,r.DataType.Wrong),l=t.const("indices",i._`{}`);t.for(i._`;${s}--;`,(()=>{t.let(a,i._`${n}[${s}]`),t.if(c,i._`continue`),p.length>1&&t.if(i._`typeof ${a} == "string"`,i._`${a} += "_"`),t.if(i._`typeof ${l}[${a}] == "number"`,(()=>{t.assign(o,i._`${l}[${a}]`),e.error(),t.assign(h,!1).break()})).code(i._`${l}[${a}] = ${s}`)}))}function f(r,a){const c=(0,s.useFunc)(t,o.default),l=t.name("outer");t.label(l).for(i._`;${r}--;`,(()=>t.for(i._`${a} = ${r}; ${a}--;`,(()=>t.if(i._`${c}(${n}[${r}], ${n}[${a}])`,(()=>{e.error(),t.assign(h,!1).break(l)}))))))}e.block$data(h,(function(){const r=t.let("i",i._`${n}.length`),s=t.let("j");e.setParams({i:r,j:s}),t.assign(h,!0),t.if(i._`${r} > 1`,(()=>(p.length>0&&!p.some((e=>"object"===e||"array"===e))?m:f)(r,s)))}),i._`${u} === false`),e.ok(h)}};t.default=a},5488:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());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},5999:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());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},857:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());o.push([e.id,".monomer-manager-root .grok-sketcher {\n min-width: unset !important;\n}\n\n.monomer-manager-root {\n width: 100% !important;\n height: 100% !important;\n}\n\n.monomer-manager-sketcher .ketcher-host {\n height: 100% !important;\n} \n\n.monomer-manager-root > div:first-child {\n flex-basis: 40% !important;\n}\n.monomer-manager-root > div:nth-child(2) {\n flex-basis: 60% !important;\n}\n\n.monomer-manager-root > div:first-child > .ui-form {\n max-width: unset !important;\n}\n\n.monomer-card-info-row {\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-bottom: 10px;\n}\n\n.monomer-card-info-row > div:nth-child(2) {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.monomer-card-info-row > div:nth-child(1) {\n font-weight: bold;\n margin-right: 5px;\n text-wrap: nowrap;\n}\n\n.duplicate-monomer-symbol-row {\n visibility: visible !important;\n}\n\n.monomer-card-root {\n border: 2px solid var(--grey-2);\n border-radius: 5px;\n padding: 5px;\n margin: 5px;\n overflow: hidden;\n align-items: center;\n cursor: pointer;\n width: 200px;\n height: 300px;\n min-width: 200px;\n min-height: 300px;\n}\n\n.duplicate-monomers-virtual-view {\n width: 100% !important;\n overflow-x: clip;\n overflow-y: auto;\n}","",{version:3,sources:["webpack://./css/monomer-manager.css"],names:[],mappings:"AAAA;IACI,2BAA2B;AAC/B;;AAEA;IACI,sBAAsB;IACtB,uBAAuB;AAC3B;;AAEA;IACI,uBAAuB;AAC3B;;AAEA;IACI,0BAA0B;AAC9B;AACA;IACI,0BAA0B;AAC9B;;AAEA;IACI,2BAA2B;AAC/B;;AAEA;IACI,WAAW;IACX,gBAAgB;IAChB,uBAAuB;IACvB,mBAAmB;AACvB;;AAEA;IACI,mBAAmB;IACnB,gBAAgB;IAChB,uBAAuB;AAC3B;;AAEA;IACI,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;AACrB;;AAEA;IACI,8BAA8B;AAClC;;AAEA;IACI,+BAA+B;IAC/B,kBAAkB;IAClB,YAAY;IACZ,WAAW;IACX,gBAAgB;IAChB,mBAAmB;IACnB,eAAe;IACf,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,iBAAiB;AACrB;;AAEA;IACI,sBAAsB;IACtB,gBAAgB;IAChB,gBAAgB;AACpB",sourcesContent:[".monomer-manager-root .grok-sketcher {\n min-width: unset !important;\n}\n\n.monomer-manager-root {\n width: 100% !important;\n height: 100% !important;\n}\n\n.monomer-manager-sketcher .ketcher-host {\n height: 100% !important;\n} \n\n.monomer-manager-root > div:first-child {\n flex-basis: 40% !important;\n}\n.monomer-manager-root > div:nth-child(2) {\n flex-basis: 60% !important;\n}\n\n.monomer-manager-root > div:first-child > .ui-form {\n max-width: unset !important;\n}\n\n.monomer-card-info-row {\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-bottom: 10px;\n}\n\n.monomer-card-info-row > div:nth-child(2) {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.monomer-card-info-row > div:nth-child(1) {\n font-weight: bold;\n margin-right: 5px;\n text-wrap: nowrap;\n}\n\n.duplicate-monomer-symbol-row {\n visibility: visible !important;\n}\n\n.monomer-card-root {\n border: 2px solid var(--grey-2);\n border-radius: 5px;\n padding: 5px;\n margin: 5px;\n overflow: hidden;\n align-items: center;\n cursor: pointer;\n width: 200px;\n height: 300px;\n min-width: 200px;\n min-height: 300px;\n}\n\n.duplicate-monomers-virtual-view {\n width: 100% !important;\n overflow-x: clip;\n overflow-y: auto;\n}"],sourceRoot:""}]);const a=o},6369:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());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},7939:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());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\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings:not(.ml-dim-reduction-column-editor-input-root i) {\n left: -20px;\n}\n.dlg-dimensionality-reduction.ui-form, .dlg-markov-clustering.ui-form, .dlg-markov-clustering.ui-form .ui-form, .dlg-dimensionality-reduction.ui-form .ui-form {\n max-width: unset;\n}\n\n.ml-dim-reduction-column-editor-input-root label {\n display: none !important;\n}\n\n.dim-reduction-dialog-form > .ui-input-root, .dim-reduction-dialog-form > div > .ui-input-root {\n margin-left: 10px;\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: 700px !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}\n\n.ml-dim-reduction-column-editor-table-root .header > td:not(:first-child) {\n padding-left: 32px;\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;;AAEhB;;AAEA;IACI,WAAW;AACf;AACA;IACI,gBAAgB;AACpB;;AAEA;IACI,wBAAwB;AAC5B;;AAEA;IACI,iBAAiB;AACrB;;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;;AAEA;IACI,kBAAkB;AACtB",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\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings:not(.ml-dim-reduction-column-editor-input-root i) {\n left: -20px;\n}\n.dlg-dimensionality-reduction.ui-form, .dlg-markov-clustering.ui-form, .dlg-markov-clustering.ui-form .ui-form, .dlg-dimensionality-reduction.ui-form .ui-form {\n max-width: unset;\n}\n\n.ml-dim-reduction-column-editor-input-root label {\n display: none !important;\n}\n\n.dim-reduction-dialog-form > .ui-input-root, .dim-reduction-dialog-form > div > .ui-input-root {\n margin-left: 10px;\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: 700px !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}\n\n.ml-dim-reduction-column-editor-table-root .header > td:not(:first-child) {\n padding-left: 32px;\n}"],sourceRoot:""}]);const a=o},3017:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());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},6314:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,i,s){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(r)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(o[c]=!0)}for(var l=0;l<e.length;l++){var u=[].concat(e[l]);r&&o[u[0]]||(void 0!==s&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=s),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),i&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=i):u[4]="".concat(i)),t.push(u))}},t}},1354:e=>{"use strict";e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;if("function"==typeof btoa){var r=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),i="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(r),s="/*# ".concat(i," */");return[t].concat([s]).join("\n")}return[t].join("\n")}},2017: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 r,i,s;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))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((r=(s=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;0!=i--;){var o=s[i];if(!e(t[o],n[o]))return!1}return!0}return t!=t&&n!=n}},9982:function(e,t,n){var r;!function(){var t={};!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,r,i,s){for(var o,a,c,l,u,d,h,p,m,f,g,y,w;s>=64;){for(o=n[0],a=n[1],c=n[2],l=n[3],u=n[4],d=n[5],h=n[6],p=n[7],f=0;f<16;f++)g=i+4*f,e[f]=(255&r[g])<<24|(255&r[g+1])<<16|(255&r[g+2])<<8|255&r[g+3];for(f=16;f<64;f++)y=((m=e[f-2])>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,w=((m=e[f-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>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&d^~u&h)|0)+(p+(t[f]+e[f]|0)|0)|0,w=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&a^o&c^a&c)|0,p=h,h=d,d=u,u=l+y|0,l=c,c=a,a=o,o=y+w|0;n[0]+=o,n[1]+=a,n[2]+=c,n[3]+=l,n[4]+=u,n[5]+=d,n[6]+=h,n[7]+=p,i+=64,s-=64}return i}var r=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 r=0;if(this.bytesHashed+=t,this.bufferLength>0){for(;this.bufferLength<64&&t>0;)this.buffer[this.bufferLength++]=e[r++],t--;64===this.bufferLength&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(t>=64&&(r=n(this.temp,this.state,e,r,t),t%=64);t>0;)this.buffer[this.bufferLength++]=e[r++],t--;return this},t.prototype.finish=function(e){if(!this.finished){var t=this.bytesHashed,r=this.bufferLength,i=t/536870912|0,s=t<<3,o=t%64<56?64:128;this.buffer[r]=128;for(var a=r+1;a<o-8;a++)this.buffer[a]=0;this.buffer[o-8]=i>>>24&255,this.buffer[o-7]=i>>>16&255,this.buffer[o-6]=i>>>8&255,this.buffer[o-5]=i>>>0&255,this.buffer[o-4]=s>>>24&255,this.buffer[o-3]=s>>>16&255,this.buffer[o-2]=s>>>8&255,this.buffer[o-1]=s>>>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=r;var i=function(){function e(e){this.inner=new r,this.outer=new r,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var t=new Uint8Array(this.blockSize);if(e.length>this.blockSize)(new r).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 s(e){var t=(new r).update(e),n=t.digest();return t.clean(),n}function o(e,t){var n=new i(e).update(t),r=n.digest();return n.clean(),r}function a(e,t,n,r){var i=r[0];if(0===i)throw new Error("hkdf: cannot expand more");t.reset(),i>1&&t.update(e),n&&t.update(n),t.update(r),t.finish(e),r[0]++}e.HMAC=i,e.hash=s,e.default=s,e.hmac=o;var c=new Uint8Array(e.digestLength);e.hkdf=function(e,t,n,r){void 0===t&&(t=c),void 0===r&&(r=32);for(var s=new Uint8Array([1]),l=o(t,e),u=new i(l),d=new Uint8Array(u.digestLength),h=d.length,p=new Uint8Array(r),m=0;m<r;m++)h===d.length&&(a(d,u,n,s),h=0),p[m]=d[h++];return u.clean(),d.fill(0),s.fill(0),p},e.pbkdf2=function(e,t,n,r){for(var s=new i(e),o=s.digestLength,a=new Uint8Array(4),c=new Uint8Array(o),l=new Uint8Array(o),u=new Uint8Array(r),d=0;d*o<r;d++){var h=d+1;a[0]=h>>>24&255,a[1]=h>>>16&255,a[2]=h>>>8&255,a[3]=h>>>0&255,s.reset(),s.update(t),s.update(a),s.finish(l);for(var p=0;p<o;p++)c[p]=l[p];for(p=2;p<=n;p++){s.reset(),s.update(l).finish(l);for(var m=0;m<o;m++)c[m]^=l[m]}for(p=0;p<o&&d*o+p<r;p++)u[d*o+p]=c[p]}for(d=0;d<o;d++)c[d]=l[d]=0;for(d=0;d<4;d++)a[d]=0;return s.clean(),u}}(t);var i=t.default;for(var s in t)i[s]=t[s];"object"==typeof e.exports?e.exports=i:void 0===(r=function(){return i}.call(t,n,t,e))||(e.exports=r)}()},2787:(e,t,n)=>{"use strict";n.d(t,{I:()=>i});const r=new Uint32Array(65536),i=(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,i=t.length,s=1<<n-1;let o=-1,a=0,c=n,l=n;for(;l--;)r[e.charCodeAt(l)]|=1<<l;for(l=0;l<i;l++){let e=r[t.charCodeAt(l)];const n=e|a;e|=(e&o)+o^o,a|=~(e|o),o&=e,a&s&&c++,o&s&&c--,a=a<<1|1,o=o<<1|~(n|a),a&=n}for(l=n;l--;)r[e.charCodeAt(l)]=0;return c})(e,t):((e,t)=>{const n=t.length,i=e.length,s=[],o=[],a=Math.ceil(n/32),c=Math.ceil(i/32);for(let e=0;e<a;e++)o[e]=-1,s[e]=0;let l=0;for(;l<c-1;l++){let a=0,c=-1;const u=32*l,d=Math.min(32,i)+u;for(let t=u;t<d;t++)r[e.charCodeAt(t)]|=1<<t;for(let e=0;e<n;e++){const n=r[t.charCodeAt(e)],i=o[e/32|0]>>>e&1,l=s[e/32|0]>>>e&1,u=n|a,d=((n|l)&c)+c^c|n|l;let h=a|~(d|c),p=c&d;h>>>31^i&&(o[e/32|0]^=1<<e),p>>>31^l&&(s[e/32|0]^=1<<e),h=h<<1|i,p=p<<1|l,c=p|~(u|h),a=h&u}for(let t=u;t<d;t++)r[e.charCodeAt(t)]=0}let u=0,d=-1;const h=32*l,p=Math.min(32,i-h)+h;for(let t=h;t<p;t++)r[e.charCodeAt(t)]|=1<<t;let m=i;for(let e=0;e<n;e++){const n=r[t.charCodeAt(e)],a=o[e/32|0]>>>e&1,c=s[e/32|0]>>>e&1,l=n|u,h=((n|c)&d)+d^d|n|c;let p=u|~(h|d),f=d&h;m+=p>>>i-1&1,m-=f>>>i-1&1,p>>>31^a&&(o[e/32|0]^=1<<e),f>>>31^c&&(s[e/32|0]^=1<<e),p=p<<1|a,f=f<<1|c,d=f|~(l|p),u=p&l}for(let t=h;t<p;t++)r[e.charCodeAt(t)]=0;return m})(e,t)}},9937:e=>{e.exports={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}},1782:(e,t)=>{t.assign=function(e){e=e||{};var t,n,r,i=Array.prototype.slice.call(arguments).slice(1);for(t=0,r=i.length;t<r;t++)if(i[t])for(n in i[t])e[n]=i[t][n];return e},t.validateSettings=function(e){return"linLogMode"in e&&"boolean"!=typeof e.linLogMode?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in e&&"boolean"!=typeof e.outboundAttractionDistribution?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in e&&"boolean"!=typeof e.adjustSizes?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in e&&"number"!=typeof e.edgeWeightInfluence?{message:"the `edgeWeightInfluence` setting should be a number."}:!("scalingRatio"in e)||"number"==typeof e.scalingRatio&&e.scalingRatio>=0?"strongGravityMode"in e&&"boolean"!=typeof e.strongGravityMode?{message:"the `strongGravityMode` setting should be a boolean."}:!("gravity"in e)||"number"==typeof e.gravity&&e.gravity>=0?"slowDown"in e&&!("number"==typeof e.slowDown||e.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in e&&"boolean"!=typeof e.barnesHutOptimize?{message:"the `barnesHutOptimize` setting should be a boolean."}:!("barnesHutTheta"in e)||"number"==typeof e.barnesHutTheta&&e.barnesHutTheta>=0?null:{message:"the `barnesHutTheta` setting should be a number >= 0."}:{message:"the `gravity` setting should be a number >= 0."}:{message:"the `scalingRatio` setting should be a number >= 0."}},t.graphToByteArrays=function(e,t){var n,r=e.order,i=e.size,s={},o=new Float32Array(10*r),a=new Float32Array(3*i);return n=0,e.forEachNode((function(e,t){s[e]=n,o[n]=t.x,o[n+1]=t.y,o[n+2]=0,o[n+3]=0,o[n+4]=0,o[n+5]=0,o[n+6]=1,o[n+7]=1,o[n+8]=t.size||1,o[n+9]=t.fixed?1:0,n+=10})),n=0,e.forEachEdge((function(e,r,i,c,l,u,d){var h=s[i],p=s[c],m=t(e,r,i,c,l,u,d);o[h+6]+=m,o[p+6]+=m,a[n]=h,a[n+1]=p,a[n+2]=m,n+=3})),{nodes:o,edges:a}},t.assignLayoutChanges=function(e,t,n){var r=0;e.updateEachNodeAttributes((function(e,i){return i.x=t[r],i.y=t[r+1],r+=10,n?n(e,i):i}))},t.readGraphPositions=function(e,t){var n=0;e.forEachNode((function(e,r){t[n]=r.x,t[n+1]=r.y,n+=10}))},t.collectLayoutChanges=function(e,t,n){for(var r=e.nodes(),i={},s=0,o=0,a=t.length;s<a;s+=10){if(n){var c=Object.assign({},e.getNodeAttributes(r[o]));c.x=t[s],c.y=t[s+1],c=n(r[o],c),i[r[o]]={x:c.x,y:c.y}}else i[r[o]]={x:t[s],y:t[s+1]};o++}return i},t.createWorker=function(e){var t=window.URL||window.webkitURL,n=e.toString(),r=t.createObjectURL(new Blob(["("+n+").call(this);"],{type:"text/javascript"})),i=new Worker(r);return t.revokeObjectURL(r),i}},8903:(e,t,n)=>{var r=n(1736),i=n(8153).Fd,s=n(2561),o=n(1782),a=n(9937);function c(e,t,n){if(!r(t))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");"number"==typeof n&&(n={iterations:n});var c=n.iterations;if("number"!=typeof c)throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(c<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var l=i("getEdgeWeight"in n?n.getEdgeWeight:"weight").fromEntry,u="function"==typeof n.outputReducer?n.outputReducer:null,d=o.assign({},a,n.settings),h=o.validateSettings(d);if(h)throw new Error("graphology-layout-forceatlas2: "+h.message);var p,m=o.graphToByteArrays(t,l);for(p=0;p<c;p++)s(d,m.nodes,m.edges);if(!e)return o.collectLayoutChanges(t,m.nodes);o.assignLayoutChanges(t,m.nodes,u)}var l=c.bind(null,!1);l.assign=c.bind(null,!0),l.inferSettings=function(e){var t="number"==typeof e?e:e.order;return{barnesHutOptimize:t>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(t)}},e.exports=l},2561:e=>{var t=10;e.exports=function(e,n,r){var i,s,o,a,c,l,u,d,h,p,m,f,g,y,w,b,v,A,E,C,T,S,_,x=n.length,P=r.length,M=e.adjustSizes,$=e.barnesHutTheta*e.barnesHutTheta,N=[];for(o=0;o<x;o+=t)n[o+4]=n[o+2],n[o+5]=n[o+3],n[o+2]=0,n[o+3]=0;if(e.outboundAttractionDistribution){for(m=0,o=0;o<x;o+=t)m+=n[o+6];m/=x/t}if(e.barnesHutOptimize){var L,I,R,O=1/0,k=-1/0,G=1/0,H=-1/0;for(o=0;o<x;o+=t)O=Math.min(O,n[o+0]),k=Math.max(k,n[o+0]),G=Math.min(G,n[o+1]),H=Math.max(H,n[o+1]);var D=k-O,F=H-G;for(D>F?H=(G-=(D-F)/2)+D:k=(O-=(F-D)/2)+F,N[0]=-1,N[1]=(O+k)/2,N[2]=(G+H)/2,N[3]=Math.max(k-O,H-G),N[4]=-1,N[5]=-1,N[6]=0,N[7]=0,N[8]=0,i=1,o=0;o<x;o+=t)for(s=0,R=3;;){if(!(N[s+5]>=0)){if(N[s+0]<0){N[s+0]=o;break}if(N[s+5]=9*i,d=N[s+3]/2,N[(h=N[s+5])+0]=-1,N[h+1]=N[s+1]-d,N[h+2]=N[s+2]-d,N[h+3]=d,N[h+4]=h+9,N[h+5]=-1,N[h+6]=0,N[h+7]=0,N[h+8]=0,N[(h+=9)+0]=-1,N[h+1]=N[s+1]-d,N[h+2]=N[s+2]+d,N[h+3]=d,N[h+4]=h+9,N[h+5]=-1,N[h+6]=0,N[h+7]=0,N[h+8]=0,N[(h+=9)+0]=-1,N[h+1]=N[s+1]+d,N[h+2]=N[s+2]-d,N[h+3]=d,N[h+4]=h+9,N[h+5]=-1,N[h+6]=0,N[h+7]=0,N[h+8]=0,N[(h+=9)+0]=-1,N[h+1]=N[s+1]+d,N[h+2]=N[s+2]+d,N[h+3]=d,N[h+4]=N[s+4],N[h+5]=-1,N[h+6]=0,N[h+7]=0,N[h+8]=0,i+=4,L=n[N[s+0]+0]<N[s+1]?n[N[s+0]+1]<N[s+2]?N[s+5]:N[s+5]+9:n[N[s+0]+1]<N[s+2]?N[s+5]+18:N[s+5]+27,N[s+6]=n[N[s+0]+6],N[s+7]=n[N[s+0]+0],N[s+8]=n[N[s+0]+1],N[L+0]=N[s+0],N[s+0]=-1,L===(I=n[o+0]<N[s+1]?n[o+1]<N[s+2]?N[s+5]:N[s+5]+9:n[o+1]<N[s+2]?N[s+5]+18:N[s+5]+27)){if(R--){s=L;continue}R=3;break}N[I+0]=o;break}L=n[o+0]<N[s+1]?n[o+1]<N[s+2]?N[s+5]:N[s+5]+9:n[o+1]<N[s+2]?N[s+5]+18:N[s+5]+27,N[s+7]=(N[s+7]*N[s+6]+n[o+0]*n[o+6])/(N[s+6]+n[o+6]),N[s+8]=(N[s+8]*N[s+6]+n[o+1]*n[o+6])/(N[s+6]+n[o+6]),N[s+6]+=n[o+6],s=L}}if(e.barnesHutOptimize){for(f=e.scalingRatio,o=0;o<x;o+=t)for(s=0;;)if(N[s+5]>=0){if(b=Math.pow(n[o+0]-N[s+7],2)+Math.pow(n[o+1]-N[s+8],2),4*(p=N[s+3])*p/b<$){if(g=n[o+0]-N[s+7],y=n[o+1]-N[s+8],!0===M?b>0?(v=f*n[o+6]*N[s+6]/b,n[o+2]+=g*v,n[o+3]+=y*v):b<0&&(v=-f*n[o+6]*N[s+6]/Math.sqrt(b),n[o+2]+=g*v,n[o+3]+=y*v):b>0&&(v=f*n[o+6]*N[s+6]/b,n[o+2]+=g*v,n[o+3]+=y*v),(s=N[s+4])<0)break;continue}s=N[s+5]}else if((l=N[s+0])>=0&&l!==o&&(b=(g=n[o+0]-n[l+0])*g+(y=n[o+1]-n[l+1])*y,!0===M?b>0?(v=f*n[o+6]*n[l+6]/b,n[o+2]+=g*v,n[o+3]+=y*v):b<0&&(v=-f*n[o+6]*n[l+6]/Math.sqrt(b),n[o+2]+=g*v,n[o+3]+=y*v):b>0&&(v=f*n[o+6]*n[l+6]/b,n[o+2]+=g*v,n[o+3]+=y*v)),(s=N[s+4])<0)break}else for(f=e.scalingRatio,a=0;a<x;a+=t)for(c=0;c<a;c+=t)g=n[a+0]-n[c+0],y=n[a+1]-n[c+1],!0===M?(b=Math.sqrt(g*g+y*y)-n[a+8]-n[c+8])>0?(v=f*n[a+6]*n[c+6]/b/b,n[a+2]+=g*v,n[a+3]+=y*v,n[c+2]-=g*v,n[c+3]-=y*v):b<0&&(v=100*f*n[a+6]*n[c+6],n[a+2]+=g*v,n[a+3]+=y*v,n[c+2]-=g*v,n[c+3]-=y*v):(b=Math.sqrt(g*g+y*y))>0&&(v=f*n[a+6]*n[c+6]/b/b,n[a+2]+=g*v,n[a+3]+=y*v,n[c+2]-=g*v,n[c+3]-=y*v);for(h=e.gravity/e.scalingRatio,f=e.scalingRatio,o=0;o<x;o+=t)v=0,g=n[o+0],y=n[o+1],b=Math.sqrt(Math.pow(g,2)+Math.pow(y,2)),e.strongGravityMode?b>0&&(v=f*n[o+6]*h):b>0&&(v=f*n[o+6]*h/b),n[o+2]-=g*v,n[o+3]-=y*v;for(f=1*(e.outboundAttractionDistribution?m:1),u=0;u<P;u+=3)a=r[u+0],c=r[u+1],d=r[u+2],w=Math.pow(d,e.edgeWeightInfluence),g=n[a+0]-n[c+0],y=n[a+1]-n[c+1],!0===M?(b=Math.sqrt(g*g+y*y)-n[a+8]-n[c+8],e.linLogMode?e.outboundAttractionDistribution?b>0&&(v=-f*w*Math.log(1+b)/b/n[a+6]):b>0&&(v=-f*w*Math.log(1+b)/b):e.outboundAttractionDistribution?b>0&&(v=-f*w/n[a+6]):b>0&&(v=-f*w)):(b=Math.sqrt(Math.pow(g,2)+Math.pow(y,2)),e.linLogMode?e.outboundAttractionDistribution?b>0&&(v=-f*w*Math.log(1+b)/b/n[a+6]):b>0&&(v=-f*w*Math.log(1+b)/b):e.outboundAttractionDistribution?(b=1,v=-f*w/n[a+6]):(b=1,v=-f*w)),b>0&&(n[a+2]+=g*v,n[a+3]+=y*v,n[c+2]-=g*v,n[c+3]-=y*v);if(!0===M)for(o=0;o<x;o+=t)1!==n[o+9]&&((A=Math.sqrt(Math.pow(n[o+2],2)+Math.pow(n[o+3],2)))>10&&(n[o+2]=10*n[o+2]/A,n[o+3]=10*n[o+3]/A),E=n[o+6]*Math.sqrt((n[o+4]-n[o+2])*(n[o+4]-n[o+2])+(n[o+5]-n[o+3])*(n[o+5]-n[o+3])),C=Math.sqrt((n[o+4]+n[o+2])*(n[o+4]+n[o+2])+(n[o+5]+n[o+3])*(n[o+5]+n[o+3]))/2,T=.1*Math.log(1+C)/(1+Math.sqrt(E)),S=n[o+0]+n[o+2]*(T/e.slowDown),n[o+0]=S,_=n[o+1]+n[o+3]*(T/e.slowDown),n[o+1]=_);else for(o=0;o<x;o+=t)1!==n[o+9]&&(E=n[o+6]*Math.sqrt((n[o+4]-n[o+2])*(n[o+4]-n[o+2])+(n[o+5]-n[o+3])*(n[o+5]-n[o+3])),C=Math.sqrt((n[o+4]+n[o+2])*(n[o+4]+n[o+2])+(n[o+5]+n[o+3])*(n[o+5]+n[o+3]))/2,T=n[o+7]*Math.log(1+C)/(1+Math.sqrt(E)),n[o+7]=Math.min(1,Math.sqrt(T*(Math.pow(n[o+2],2)+Math.pow(n[o+3],2))/(1+Math.sqrt(E)))),S=n[o+0]+n[o+2]*(T/e.slowDown),n[o+0]=S,_=n[o+1]+n[o+3]*(T/e.slowDown),n[o+1]=_);return{}}},8153:(e,t)=>{function n(e){return"number"!=typeof e||isNaN(e)?1:e}t.Fd=function(e){return function(e,t){var n={},r=function(e){return void 0===e?t:e};"function"==typeof t&&(r=t);var i=function(t){return r(t[e])},s=function(){return r(void 0)};return"string"==typeof e?(n.fromAttributes=i,n.fromGraph=function(e,t){return i(e.getEdgeAttributes(t))},n.fromEntry=function(e,t){return i(t)},n.fromPartialEntry=n.fromEntry,n.fromMinimalEntry=n.fromEntry):"function"==typeof e?(n.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},n.fromGraph=function(t,n){var i=t.extremities(n);return r(e(n,t.getEdgeAttributes(n),i[0],i[1],t.getNodeAttributes(i[0]),t.getNodeAttributes(i[1]),t.isUndirected(n)))},n.fromEntry=function(t,n,i,s,o,a,c){return r(e(t,n,i,s,o,a,c))},n.fromPartialEntry=function(t,n,i,s){return r(e(t,n,i,s))},n.fromMinimalEntry=function(t,n){return r(e(t,n))}):(n.fromAttributes=s,n.fromGraph=s,n.fromEntry=s,n.fromMinimalEntry=s),n}(e,n)}},1736:e=>{e.exports=function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.addUndirectedEdgeWithKey&&"function"==typeof e.dropNode&&"boolean"==typeof e.multi}},934:function(e){e.exports=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}function i(e,t,n){return i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var s=new(Function.bind.apply(e,i));return n&&r(s,n.prototype),s},i.apply(null,arguments)}function s(e){var t="function"==typeof Map?new Map:void 0;return s=function(e){if(null===e||(s=e,-1===Function.toString.call(s).indexOf("[native code]")))return e;var s;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return i(e,arguments,n(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),r(o,e)},s(e)}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var a=function(){for(var e=arguments[0],t=1,n=arguments.length;t<n;t++)if(arguments[t])for(var r in arguments[t])e[r]=arguments[t][r];return e};function c(e,t,n,r){var i=e._nodes.get(t),s=null;return i?s="mixed"===r?i.out&&i.out[n]||i.undirected&&i.undirected[n]:"directed"===r?i.out&&i.out[n]:i.undirected&&i.undirected[n]:s}function l(t){return"object"===e(t)&&null!==t}function u(e){var t;for(t in e)return!1;return!0}function d(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function h(e,t,n){var r={enumerable:!0,configurable:!0};"function"==typeof n?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(e,t,r)}function p(e){return!(!l(e)||e.attributes&&!Array.isArray(e.attributes))}"function"==typeof Object.assign&&(a=Object.assign);var m,f={exports:{}},g="object"==typeof Reflect?Reflect:null,y=g&&"function"==typeof g.apply?g.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};m=g&&"function"==typeof g.ownKeys?g.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var w=Number.isNaN||function(e){return e!=e};function b(){b.init.call(this)}f.exports=b,f.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,s),r(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}M(e,t,s,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&M(e,"error",t,{once:!0})}(e,i)}))},b.EventEmitter=b,b.prototype._events=void 0,b.prototype._eventsCount=0,b.prototype._maxListeners=void 0;var v=10;function A(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function E(e){return void 0===e._maxListeners?b.defaultMaxListeners:e._maxListeners}function C(e,t,n,r){var i,s,o,a;if(A(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=E(e))>0&&o.length>i&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,a=c,console&&console.warn&&console.warn(a)}return e}function T(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function S(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=T.bind(r);return i.listener=n,r.wrapFn=i,i}function _(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):P(i,i.length)}function x(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function P(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function M(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(s){r.once&&e.removeEventListener(t,i),n(s)}))}}function $(e){if("function"!=typeof e)throw new Error("obliterator/iterator: expecting a function!");this.next=e}Object.defineProperty(b,"defaultMaxListeners",{enumerable:!0,get:function(){return v},set:function(e){if("number"!=typeof e||e<0||w(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");v=e}}),b.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},b.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||w(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},b.prototype.getMaxListeners=function(){return E(this)},b.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)y(a,this,t);else{var c=a.length,l=P(a,c);for(n=0;n<c;++n)y(l[n],this,t)}return!0},b.prototype.addListener=function(e,t){return C(this,e,t,!1)},b.prototype.on=b.prototype.addListener,b.prototype.prependListener=function(e,t){return C(this,e,t,!0)},b.prototype.once=function(e,t){return A(t),this.on(e,S(this,e,t)),this},b.prototype.prependOnceListener=function(e,t){return A(t),this.prependListener(e,S(this,e,t)),this},b.prototype.removeListener=function(e,t){var n,r,i,s,o;if(A(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||t)}return this},b.prototype.off=b.prototype.removeListener,b.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,s=Object.keys(n);for(r=0;r<s.length;++r)"removeListener"!==(i=s[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},b.prototype.listeners=function(e){return _(this,e,!0)},b.prototype.rawListeners=function(e){return _(this,e,!1)},b.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):x.call(e,t)},b.prototype.listenerCount=x,b.prototype.eventNames=function(){return this._eventsCount>0?m(this._events):[]},"undefined"!=typeof Symbol&&($.prototype[Symbol.iterator]=function(){return this}),$.of=function(){var e=arguments,t=e.length,n=0;return new $((function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}}))},$.empty=function(){return new $((function(){return{done:!0}}))},$.fromSequence=function(e){var t=0,n=e.length;return new $((function(){return t>=n?{done:!0}:{done:!1,value:e[t++]}}))},$.is=function(e){return e instanceof $||"object"==typeof e&&null!==e&&"function"==typeof e.next};var N=$,L={};L.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,L.SYMBOL_SUPPORT="undefined"!=typeof Symbol;var I=N,R=L,O=R.ARRAY_BUFFER_SUPPORT,k=R.SYMBOL_SUPPORT,G=function(e){var t=function(e){return"string"==typeof e||Array.isArray(e)||O&&ArrayBuffer.isView(e)?I.fromSequence(e):"object"!=typeof e||null===e?null:k&&"function"==typeof e[Symbol.iterator]?e[Symbol.iterator]():"function"==typeof e.next?e:null}(e);if(!t)throw new Error("obliterator: target is not iterable nor a valid iterator.");return t},H=G,D=function(e,t){for(var n,r=arguments.length>1?t:1/0,i=r!==1/0?new Array(r):[],s=0,o=H(e);;){if(s===r)return i;if((n=o.next()).done)return s!==t&&(i.length=s),i;i[s++]=n.value}},F=function(e){function n(t){var n;return(n=e.call(this)||this).name="GraphError",n.message=t,n}return t(n,e),n}(s(Error)),U=function(e){function n(t){var r;return(r=e.call(this,t)||this).name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(r),n.prototype.constructor),r}return t(n,e),n}(F),V=function(e){function n(t){var r;return(r=e.call(this,t)||this).name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(r),n.prototype.constructor),r}return t(n,e),n}(F),Y=function(e){function n(t){var r;return(r=e.call(this,t)||this).name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(r),n.prototype.constructor),r}return t(n,e),n}(F);function B(e,t){this.key=e,this.attributes=t,this.clear()}function W(e,t){this.key=e,this.attributes=t,this.clear()}function j(e,t){this.key=e,this.attributes=t,this.clear()}function K(e,t,n,r,i){this.key=t,this.attributes=i,this.undirected=e,this.source=n,this.target=r}function q(e,t,n,r,i,s,o){var a,c,l,u;if(r=""+r,0===n){if(!(a=e._nodes.get(r)))throw new V("Graph.".concat(t,': could not find the "').concat(r,'" node in the graph.'));l=i,u=s}else if(3===n){if(i=""+i,!(c=e._edges.get(i)))throw new V("Graph.".concat(t,': could not find the "').concat(i,'" edge in the graph.'));var d=c.source.key,h=c.target.key;if(r===d)a=c.target;else{if(r!==h)throw new V("Graph.".concat(t,': the "').concat(r,'" node is not attached to the "').concat(i,'" edge (').concat(d,", ").concat(h,")."));a=c.source}l=s,u=o}else{if(!(c=e._edges.get(r)))throw new V("Graph.".concat(t,': could not find the "').concat(r,'" edge in the graph.'));a=1===n?c.source:c.target,l=i,u=s}return[a,l,u]}B.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},W.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},j.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},K.prototype.attach=function(){var e="out",t="in";this.undirected&&(e=t="undirected");var n=this.source.key,r=this.target.key;this.source[e][r]=this,this.undirected&&n===r||(this.target[t][n]=this)},K.prototype.attachMulti=function(){var e="out",t="in",n=this.source.key,r=this.target.key;this.undirected&&(e=t="undirected");var i=this.source[e],s=i[r];if(void 0===s)return i[r]=this,void(this.undirected&&n===r||(this.target[t][n]=this));s.previous=this,this.next=s,i[r]=this,this.target[t][n]=this},K.prototype.detach=function(){var e=this.source.key,t=this.target.key,n="out",r="in";this.undirected&&(n=r="undirected"),delete this.source[n][t],delete this.target[r][e]},K.prototype.detachMulti=function(){var e=this.source.key,t=this.target.key,n="out",r="in";this.undirected&&(n=r="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][t],delete this.target[r][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[r][e]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};var z=[{name:function(e){return"get".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=q(this,t,n,e,r,i),o=s[0],a=s[1];return o.attributes[a]}}},{name:function(e){return"get".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r){return q(this,t,n,e,r)[0].attributes}}},{name:function(e){return"has".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=q(this,t,n,e,r,i),o=s[0],a=s[1];return o.attributes.hasOwnProperty(a)}}},{name:function(e){return"set".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i,s){var o=q(this,t,n,e,r,i,s),a=o[0],c=o[1],l=o[2];return a.attributes[c]=l,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:c}),this}}},{name:function(e){return"update".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i,s){var o=q(this,t,n,e,r,i,s),a=o[0],c=o[1],l=o[2];if("function"!=typeof l)throw new U("Graph.".concat(t,": updater should be a function."));var u=a.attributes,d=l(u[c]);return u[c]=d,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:c}),this}}},{name:function(e){return"remove".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=q(this,t,n,e,r,i),o=s[0],a=s[1];return delete o.attributes[a],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:a}),this}}},{name:function(e){return"replace".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=q(this,t,n,e,r,i),o=s[0],a=s[1];if(!l(a))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return o.attributes=a,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}},{name:function(e){return"merge".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=q(this,t,n,e,r,i),o=s[0],c=s[1];if(!l(c))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return a(o.attributes,c),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:c}),this}}},{name:function(e){return"update".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=q(this,t,n,e,r,i),o=s[0],a=s[1];if("function"!=typeof a)throw new U("Graph.".concat(t,": provided updater is not a function."));return o.attributes=a(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}}],Z=[{name:function(e){return"get".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return i.attributes[r]}}},{name:function(e){return"get".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var i=""+e,s=""+arguments[1];if(!(r=c(this,i,s,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(i,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(r=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return r.attributes}}},{name:function(e){return"has".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return i.attributes.hasOwnProperty(r)}}},{name:function(e){return"set".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+r;if(r=arguments[2],i=arguments[3],!(s=c(this,o,a,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(s=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return s.attributes[r]=i,this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:r}),this}}},{name:function(e){return"update".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+r;if(r=arguments[2],i=arguments[3],!(s=c(this,o,a,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(s=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if("function"!=typeof i)throw new U("Graph.".concat(t,": updater should be a function."));return s.attributes[r]=i(s.attributes[r]),this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:r}),this}}},{name:function(e){return"remove".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return delete i.attributes[r],this.emit("edgeAttributesUpdated",{key:i.key,type:"remove",attributes:i.attributes,name:r}),this}}},{name:function(e){return"replace".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if(!l(r))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return i.attributes=r,this.emit("edgeAttributesUpdated",{key:i.key,type:"replace",attributes:i.attributes}),this}}},{name:function(e){return"merge".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if(!l(r))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return a(i.attributes,r),this.emit("edgeAttributesUpdated",{key:i.key,type:"merge",attributes:i.attributes,data:r}),this}}},{name:function(e){return"update".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if("function"!=typeof r)throw new U("Graph.".concat(t,": provided updater is not a function."));return i.attributes=r(i.attributes),this.emit("edgeAttributesUpdated",{key:i.key,type:"update",attributes:i.attributes}),this}}}],X=N,J=G,Q=function(){var e=arguments,t=null,n=-1;return new X((function(){for(var r=null;;){if(null===t){if(++n>=e.length)return{done:!0};t=J(e[n])}if(!0!==(r=t.next()).done)break;t=null}return r}))},ee=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function te(e,t,n,r){var i=!1;for(var s in t)if(s!==r){var o=t[s];if(i=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&i)return o.key}}function ne(e,t,n,r){var i,s,o,a=!1;for(var c in t)if(c!==r){i=t[c];do{if(s=i.source,o=i.target,a=n(i.key,i.attributes,s.key,o.key,s.attributes,o.attributes,i.undirected),e&&a)return i.key;i=i.next}while(void 0!==i)}}function re(e,t){var n,r=Object.keys(e),i=r.length,s=0;return new N((function(){do{if(n)n=n.next;else{if(s>=i)return{done:!0};var o=r[s++];if(o===t){n=void 0;continue}n=e[o]}}while(!n);return{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}}}))}function ie(e,t,n,r){var i=t[n];if(i){var s=i.source,o=i.target;return r(i.key,i.attributes,s.key,o.key,s.attributes,o.attributes,i.undirected)&&e?i.key:void 0}}function se(e,t,n,r){var i=t[n];if(i){var s=!1;do{if(s=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),e&&s)return i.key;i=i.next}while(void 0!==i)}}function oe(e,t){var n=e[t];return void 0!==n.next?new N((function(){if(!n)return{done:!0};var e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}})):N.of({edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected})}function ae(e,t,n,r){if(0!==t.size)for(var i,s,o="mixed"!==n&&n!==t.type,a="undirected"===n,c=!1,l=t._edges.values();!0!==(i=l.next()).done;)if(s=i.value,!o||s.undirected===a){var u=s,d=u.key,h=u.attributes,p=u.source,m=u.target;if(c=r(d,h,p.key,m.key,p.attributes,m.attributes,s.undirected),e&&c)return d}}function ce(e,t,n,r,i,s){var o,a=t?ne:te;if("undirected"!==n){if("out"!==r&&(o=a(e,i.in,s),e&&o))return o;if("in"!==r&&(o=a(e,i.out,s,r?void 0:i.key),e&&o))return o}if("directed"!==n&&(o=a(e,i.undirected,s),e&&o))return o}function le(e,t,n,r,i,s,o){var a,c=n?se:ie;if("undirected"!==t){if(void 0!==i.in&&"out"!==r&&(a=c(e,i.in,s,o),e&&a))return a;if(void 0!==i.out&&"in"!==r&&(r||i.key!==s)&&(a=c(e,i.out,s,o),e&&a))return a}if("directed"!==t&&void 0!==i.undirected&&(a=c(e,i.undirected,s,o),e&&a))return a}var ue=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function de(){this.A=null,this.B=null}function he(e,t,n,r,i){for(var s in r){var o=r[s],a=o.source,c=o.target,l=a===n?c:a;if(!t||!t.has(l.key)){var u=i(l.key,l.attributes);if(e&&u)return l.key}}}function pe(e,t,n,r,i){if("mixed"!==t){if("undirected"===t)return he(e,null,r,r.undirected,i);if("string"==typeof n)return he(e,null,r,r[n],i)}var s,o=new de;if("undirected"!==t){if("out"!==n){if(s=he(e,null,r,r.in,i),e&&s)return s;o.wrap(r.in)}if("in"!==n){if(s=he(e,o,r,r.out,i),e&&s)return s;o.wrap(r.out)}}if("directed"!==t&&(s=he(e,o,r,r.undirected,i),e&&s))return s}function me(e,t,n){var r=Object.keys(n),i=r.length,s=0;return new N((function(){var o=null;do{if(s>=i)return e&&e.wrap(n),{done:!0};var a=n[r[s++]],c=a.source,l=a.target;o=c===t?l:c,e&&e.has(o.key)&&(o=null)}while(null===o);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}))}function fe(e,t,n,r,i){for(var s,o,a,c,l,u,d,h=r._nodes.values(),p=r.type;!0!==(s=h.next()).done;){var m=!1;if(o=s.value,"undirected"!==p)for(a in c=o.out){l=c[a];do{if(u=l.target,m=!0,d=i(o.key,u.key,o.attributes,u.attributes,l.key,l.attributes,l.undirected),e&&d)return l;l=l.next}while(l)}if("directed"!==p)for(a in c=o.undirected)if(!(t&&o.key>a)){l=c[a];do{if((u=l.target).key!==a&&(u=l.source),m=!0,d=i(o.key,u.key,o.attributes,u.attributes,l.key,l.attributes,l.undirected),e&&d)return l;l=l.next}while(l)}if(n&&!m&&(d=i(o.key,null,o.attributes,null,null,null,null),e&&d))return null}}function ge(e){if(!l(e))throw new U('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in e))throw new U("Graph.import: serialized node is missing its key.");if("attributes"in e&&(!l(e.attributes)||null===e.attributes))throw new U("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function ye(e){if(!l(e))throw new U('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in e))throw new U("Graph.import: serialized edge is missing its source.");if(!("target"in e))throw new U("Graph.import: serialized edge is missing its target.");if("attributes"in e&&(!l(e.attributes)||null===e.attributes))throw new U("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in e&&"boolean"!=typeof e.undirected)throw new U("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}de.prototype.wrap=function(e){null===this.A?this.A=e:null===this.B&&(this.B=e)},de.prototype.has=function(e){return null!==this.A&&e in this.A||null!==this.B&&e in this.B};var we,be=(we=255&Math.floor(256*Math.random()),function(){return we++}),ve=new Set(["directed","undirected","mixed"]),Ae=new Set(["domain","_events","_eventsCount","_maxListeners"]),Ee={allowSelfLoops:!0,multi:!1,type:"mixed"};function Ce(e,t,n){var r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:n}),r}function Te(e,t,n,r,i,s,o,a){if(!r&&"undirected"===e.type)throw new Y("Graph.".concat(t,": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead."));if(r&&"directed"===e.type)throw new Y("Graph.".concat(t,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(a&&!l(a))throw new U("Graph.".concat(t,': invalid attributes. Expecting an object but got "').concat(a,'"'));if(s=""+s,o=""+o,a=a||{},!e.allowSelfLoops&&s===o)throw new Y("Graph.".concat(t,': source & target are the same ("').concat(s,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var c=e._nodes.get(s),u=e._nodes.get(o);if(!c)throw new V("Graph.".concat(t,': source node "').concat(s,'" not found.'));if(!u)throw new V("Graph.".concat(t,': target node "').concat(o,'" not found.'));var d={key:null,undirected:r,source:s,target:o,attributes:a};if(n)i=e._edgeKeyGenerator();else if(i=""+i,e._edges.has(i))throw new Y("Graph.".concat(t,': the "').concat(i,'" edge already exists in the graph.'));if(!e.multi&&(r?void 0!==c.undirected[o]:void 0!==c.out[o]))throw new Y("Graph.".concat(t,': an edge linking "').concat(s,'" to "').concat(o,"\" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option."));var h=new K(r,i,c,u,a);e._edges.set(i,h);var p=s===o;return r?(c.undirectedDegree++,u.undirectedDegree++,p&&(c.undirectedLoops++,e._undirectedSelfLoopCount++)):(c.outDegree++,u.inDegree++,p&&(c.directedLoops++,e._directedSelfLoopCount++)),e.multi?h.attachMulti():h.attach(),r?e._undirectedSize++:e._directedSize++,d.key=i,e.emit("edgeAdded",d),i}function Se(e,t,n,r,i,s,o,c,u){if(!r&&"undirected"===e.type)throw new Y("Graph.".concat(t,": you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead."));if(r&&"directed"===e.type)throw new Y("Graph.".concat(t,": you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead."));if(c)if(u){if("function"!=typeof c)throw new U("Graph.".concat(t,': invalid updater function. Expecting a function but got "').concat(c,'"'))}else if(!l(c))throw new U("Graph.".concat(t,': invalid attributes. Expecting an object but got "').concat(c,'"'));var d;if(s=""+s,o=""+o,u&&(d=c,c=void 0),!e.allowSelfLoops&&s===o)throw new Y("Graph.".concat(t,': source & target are the same ("').concat(s,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var h,p,m=e._nodes.get(s),f=e._nodes.get(o);if(!n&&(h=e._edges.get(i))){if(!(h.source.key===s&&h.target.key===o||r&&h.source.key===o&&h.target.key===s))throw new Y("Graph.".concat(t,': inconsistency detected when attempting to merge the "').concat(i,'" edge with "').concat(s,'" source & "').concat(o,'" target vs. ("').concat(h.source.key,'", "').concat(h.target.key,'").'));p=h}if(p||e.multi||!m||(p=r?m.undirected[o]:m.out[o]),p){var g=[p.key,!1,!1,!1];if(u?!d:!c)return g;if(u){var y=p.attributes;p.attributes=d(y),e.emit("edgeAttributesUpdated",{type:"replace",key:p.key,attributes:p.attributes})}else a(p.attributes,c),e.emit("edgeAttributesUpdated",{type:"merge",key:p.key,attributes:p.attributes,data:c});return g}c=c||{},u&&d&&(c=d(c));var w={key:null,undirected:r,source:s,target:o,attributes:c};if(n)i=e._edgeKeyGenerator();else if(i=""+i,e._edges.has(i))throw new Y("Graph.".concat(t,': the "').concat(i,'" edge already exists in the graph.'));var b=!1,v=!1;m||(m=Ce(e,s,{}),b=!0,s===o&&(f=m,v=!0)),f||(f=Ce(e,o,{}),v=!0),h=new K(r,i,m,f,c),e._edges.set(i,h);var A=s===o;return r?(m.undirectedDegree++,f.undirectedDegree++,A&&(m.undirectedLoops++,e._undirectedSelfLoopCount++)):(m.outDegree++,f.inDegree++,A&&(m.directedLoops++,e._directedSelfLoopCount++)),e.multi?h.attachMulti():h.attach(),r?e._undirectedSize++:e._directedSize++,w.key=i,e.emit("edgeAdded",w),[i,!0,b,v]}function _e(e,t){e._edges.delete(t.key);var n=t.source,r=t.target,i=t.attributes,s=t.undirected,o=n===r;s?(n.undirectedDegree--,r.undirectedDegree--,o&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,o&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),s?e._undirectedSize--:e._directedSize--,e.emit("edgeDropped",{key:t.key,attributes:i,source:n.key,target:r.key,undirected:s})}var xe=function(n){function r(e){var t;if(t=n.call(this)||this,"boolean"!=typeof(e=a({},Ee,e)).multi)throw new U("Graph.constructor: invalid 'multi' option. Expecting a boolean but got \"".concat(e.multi,'".'));if(!ve.has(e.type))throw new U('Graph.constructor: invalid \'type\' option. Should be one of "mixed", "directed" or "undirected" but got "'.concat(e.type,'".'));if("boolean"!=typeof e.allowSelfLoops)throw new U("Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \"".concat(e.allowSelfLoops,'".'));var r="mixed"===e.type?B:"directed"===e.type?W:j;d(o(t),"NodeDataClass",r);var i="geid_"+be()+"_",s=0;return d(o(t),"_attributes",{}),d(o(t),"_nodes",new Map),d(o(t),"_edges",new Map),d(o(t),"_directedSize",0),d(o(t),"_undirectedSize",0),d(o(t),"_directedSelfLoopCount",0),d(o(t),"_undirectedSelfLoopCount",0),d(o(t),"_edgeKeyGenerator",(function(){var e;do{e=i+s++}while(t._edges.has(e));return e})),d(o(t),"_options",e),Ae.forEach((function(e){return d(o(t),e,t[e])})),h(o(t),"order",(function(){return t._nodes.size})),h(o(t),"size",(function(){return t._edges.size})),h(o(t),"directedSize",(function(){return t._directedSize})),h(o(t),"undirectedSize",(function(){return t._undirectedSize})),h(o(t),"selfLoopCount",(function(){return t._directedSelfLoopCount+t._undirectedSelfLoopCount})),h(o(t),"directedSelfLoopCount",(function(){return t._directedSelfLoopCount})),h(o(t),"undirectedSelfLoopCount",(function(){return t._undirectedSelfLoopCount})),h(o(t),"multi",t._options.multi),h(o(t),"type",t._options.type),h(o(t),"allowSelfLoops",t._options.allowSelfLoops),h(o(t),"implementation",(function(){return"graphology"})),t}t(r,n);var i=r.prototype;return i._resetInstanceCounters=function(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0},i.hasNode=function(e){return this._nodes.has(""+e)},i.hasDirectedEdge=function(e,t){if("undirected"===this.type)return!1;if(1===arguments.length){var n=""+e,r=this._edges.get(n);return!!r&&!r.undirected}if(2===arguments.length){e=""+e,t=""+t;var i=this._nodes.get(e);return!!i&&i.out.hasOwnProperty(t)}throw new U("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.hasUndirectedEdge=function(e,t){if("directed"===this.type)return!1;if(1===arguments.length){var n=""+e,r=this._edges.get(n);return!!r&&r.undirected}if(2===arguments.length){e=""+e,t=""+t;var i=this._nodes.get(e);return!!i&&i.undirected.hasOwnProperty(t)}throw new U("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.hasEdge=function(e,t){if(1===arguments.length){var n=""+e;return this._edges.has(n)}if(2===arguments.length){e=""+e,t=""+t;var r=this._nodes.get(e);return!!r&&(void 0!==r.out&&r.out.hasOwnProperty(t)||void 0!==r.undirected&&r.undirected.hasOwnProperty(t))}throw new U("Graph.hasEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.directedEdge=function(e,t){if("undirected"!==this.type){if(e=""+e,t=""+t,this.multi)throw new Y("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");var n=this._nodes.get(e);if(!n)throw new V('Graph.directedEdge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V('Graph.directedEdge: could not find the "'.concat(t,'" target node in the graph.'));var r=n.out&&n.out[t]||void 0;return r?r.key:void 0}},i.undirectedEdge=function(e,t){if("directed"!==this.type){if(e=""+e,t=""+t,this.multi)throw new Y("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");var n=this._nodes.get(e);if(!n)throw new V('Graph.undirectedEdge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V('Graph.undirectedEdge: could not find the "'.concat(t,'" target node in the graph.'));var r=n.undirected&&n.undirected[t]||void 0;return r?r.key:void 0}},i.edge=function(e,t){if(this.multi)throw new Y("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.edge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V('Graph.edge: could not find the "'.concat(t,'" target node in the graph.'));var r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key},i.areDirectedNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areDirectedNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&(t in n.in||t in n.out)},i.areOutNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areOutNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.out},i.areInNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areInNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.in},i.areUndirectedNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areUndirectedNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"directed"!==this.type&&t in n.undirected},i.areNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&(t in n.in||t in n.out)||"directed"!==this.type&&t in n.undirected},i.areInboundNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areInboundNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.in||"directed"!==this.type&&t in n.undirected},i.areOutboundNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areOutboundNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.out||"directed"!==this.type&&t in n.undirected},i.inDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.inDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree},i.outDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.outDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.outDegree},i.directedDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.directedDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree+t.outDegree},i.undirectedDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.undirectedDegree: could not find the "'.concat(e,'" node in the graph.'));return"directed"===this.type?0:t.undirectedDegree},i.inboundDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.inboundDegree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.inDegree),n},i.outboundDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.outboundDegree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.outDegree),n},i.degree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.degree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.inDegree+t.outDegree),n},i.inDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.inDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree-t.directedLoops},i.outDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.outDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.outDegree-t.directedLoops},i.directedDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.directedDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree+t.outDegree-2*t.directedLoops},i.undirectedDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.undirectedDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"directed"===this.type?0:t.undirectedDegree-2*t.undirectedLoops},i.inboundDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.inboundDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=t.undirectedDegree,r+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree,r+=t.directedLoops),n-r},i.outboundDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.outboundDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=t.undirectedDegree,r+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.outDegree,r+=t.directedLoops),n-r},i.degreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.degreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=t.undirectedDegree,r+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree+t.outDegree,r+=2*t.directedLoops),n-r},i.source=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.source: could not find the "'.concat(e,'" edge in the graph.'));return t.source.key},i.target=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.target: could not find the "'.concat(e,'" edge in the graph.'));return t.target.key},i.extremities=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.extremities: could not find the "'.concat(e,'" edge in the graph.'));return[t.source.key,t.target.key]},i.opposite=function(e,t){e=""+e,t=""+t;var n=this._edges.get(t);if(!n)throw new V('Graph.opposite: could not find the "'.concat(t,'" edge in the graph.'));var r=n.source.key,i=n.target.key;if(e===r)return i;if(e===i)return r;throw new V('Graph.opposite: the "'.concat(e,'" node is not attached to the "').concat(t,'" edge (').concat(r,", ").concat(i,")."))},i.hasExtremity=function(e,t){e=""+e,t=""+t;var n=this._edges.get(e);if(!n)throw new V('Graph.hasExtremity: could not find the "'.concat(e,'" edge in the graph.'));return n.source.key===t||n.target.key===t},i.isUndirected=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.isUndirected: could not find the "'.concat(e,'" edge in the graph.'));return t.undirected},i.isDirected=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.isDirected: could not find the "'.concat(e,'" edge in the graph.'));return!t.undirected},i.isSelfLoop=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.isSelfLoop: could not find the "'.concat(e,'" edge in the graph.'));return t.source===t.target},i.addNode=function(e,t){var n=function(e,t,n){if(n&&!l(n))throw new U('Graph.addNode: invalid attributes. Expecting an object but got "'.concat(n,'"'));if(t=""+t,n=n||{},e._nodes.has(t))throw new Y('Graph.addNode: the "'.concat(t,'" node already exist in the graph.'));var r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:n}),r}(this,e,t);return n.key},i.mergeNode=function(e,t){if(t&&!l(t))throw new U('Graph.mergeNode: invalid attributes. Expecting an object but got "'.concat(t,'"'));e=""+e,t=t||{};var n=this._nodes.get(e);return n?(t&&(a(n.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])},i.updateNode=function(e,t){if(t&&"function"!=typeof t)throw new U('Graph.updateNode: invalid updater function. Expecting a function but got "'.concat(t,'"'));e=""+e;var n=this._nodes.get(e);if(n){if(t){var r=n.attributes;n.attributes=t(r),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}var i=t?t({}):{};return n=new this.NodeDataClass(e,i),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:i}),[e,!0]},i.dropNode=function(e){e=""+e;var t,n=this._nodes.get(e);if(!n)throw new V('Graph.dropNode: could not find the "'.concat(e,'" node in the graph.'));if("undirected"!==this.type){for(var r in n.out){t=n.out[r];do{_e(this,t),t=t.next}while(t)}for(var i in n.in){t=n.in[i];do{_e(this,t),t=t.next}while(t)}}if("directed"!==this.type)for(var s in n.undirected){t=n.undirected[s];do{_e(this,t),t=t.next}while(t)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:n.attributes})},i.dropEdge=function(e){var t;if(arguments.length>1){var n=""+arguments[0],r=""+arguments[1];if(!(t=c(this,n,r,this.type)))throw new V('Graph.dropEdge: could not find the "'.concat(n,'" -> "').concat(r,'" edge in the graph.'))}else if(e=""+e,!(t=this._edges.get(e)))throw new V('Graph.dropEdge: could not find the "'.concat(e,'" edge in the graph.'));return _e(this,t),this},i.dropDirectedEdge=function(e,t){if(arguments.length<2)throw new Y("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new Y("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=c(this,e=""+e,t=""+t,"directed");if(!n)throw new V('Graph.dropDirectedEdge: could not find a "'.concat(e,'" -> "').concat(t,'" edge in the graph.'));return _e(this,n),this},i.dropUndirectedEdge=function(e,t){if(arguments.length<2)throw new Y("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new Y("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=c(this,e,t,"undirected");if(!n)throw new V('Graph.dropUndirectedEdge: could not find a "'.concat(e,'" -> "').concat(t,'" edge in the graph.'));return _e(this,n),this},i.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},i.clearEdges=function(){for(var e,t=this._nodes.values();!0!==(e=t.next()).done;)e.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")},i.getAttribute=function(e){return this._attributes[e]},i.getAttributes=function(){return this._attributes},i.hasAttribute=function(e){return this._attributes.hasOwnProperty(e)},i.setAttribute=function(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this},i.updateAttribute=function(e,t){if("function"!=typeof t)throw new U("Graph.updateAttribute: updater should be a function.");var n=this._attributes[e];return this._attributes[e]=t(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this},i.removeAttribute=function(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this},i.replaceAttributes=function(e){if(!l(e))throw new U("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this},i.mergeAttributes=function(e){if(!l(e))throw new U("Graph.mergeAttributes: provided attributes are not a plain object.");return a(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this},i.updateAttributes=function(e){if("function"!=typeof e)throw new U("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this},i.updateEachNodeAttributes=function(e,t){if("function"!=typeof e)throw new U("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!p(t))throw new U("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,r,i=this._nodes.values();!0!==(n=i.next()).done;)(r=n.value).attributes=e(r.key,r.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})},i.updateEachEdgeAttributes=function(e,t){if("function"!=typeof e)throw new U("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!p(t))throw new U("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,r,i,s,o=this._edges.values();!0!==(n=o.next()).done;)i=(r=n.value).source,s=r.target,r.attributes=e(r.key,r.attributes,i.key,s.key,i.attributes,s.attributes,r.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})},i.forEachAdjacencyEntry=function(e){if("function"!=typeof e)throw new U("Graph.forEachAdjacencyEntry: expecting a callback.");fe(!1,!1,!1,this,e)},i.forEachAdjacencyEntryWithOrphans=function(e){if("function"!=typeof e)throw new U("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");fe(!1,!1,!0,this,e)},i.forEachAssymetricAdjacencyEntry=function(e){if("function"!=typeof e)throw new U("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");fe(!1,!0,!1,this,e)},i.forEachAssymetricAdjacencyEntryWithOrphans=function(e){if("function"!=typeof e)throw new U("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");fe(!1,!0,!0,this,e)},i.nodes=function(){return"function"==typeof Array.from?Array.from(this._nodes.keys()):D(this._nodes.keys(),this._nodes.size)},i.forEachNode=function(e){if("function"!=typeof e)throw new U("Graph.forEachNode: expecting a callback.");for(var t,n,r=this._nodes.values();!0!==(t=r.next()).done;)e((n=t.value).key,n.attributes)},i.findNode=function(e){if("function"!=typeof e)throw new U("Graph.findNode: expecting a callback.");for(var t,n,r=this._nodes.values();!0!==(t=r.next()).done;)if(e((n=t.value).key,n.attributes))return n.key},i.mapNodes=function(e){if("function"!=typeof e)throw new U("Graph.mapNode: expecting a callback.");for(var t,n,r=this._nodes.values(),i=new Array(this.order),s=0;!0!==(t=r.next()).done;)n=t.value,i[s++]=e(n.key,n.attributes);return i},i.someNode=function(e){if("function"!=typeof e)throw new U("Graph.someNode: expecting a callback.");for(var t,n,r=this._nodes.values();!0!==(t=r.next()).done;)if(e((n=t.value).key,n.attributes))return!0;return!1},i.everyNode=function(e){if("function"!=typeof e)throw new U("Graph.everyNode: expecting a callback.");for(var t,n,r=this._nodes.values();!0!==(t=r.next()).done;)if(!e((n=t.value).key,n.attributes))return!1;return!0},i.filterNodes=function(e){if("function"!=typeof e)throw new U("Graph.filterNodes: expecting a callback.");for(var t,n,r=this._nodes.values(),i=[];!0!==(t=r.next()).done;)e((n=t.value).key,n.attributes)&&i.push(n.key);return i},i.reduceNodes=function(e,t){if("function"!=typeof e)throw new U("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new U("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");for(var n,r,i=t,s=this._nodes.values();!0!==(n=s.next()).done;)i=e(i,(r=n.value).key,r.attributes);return i},i.nodeEntries=function(){var e=this._nodes.values();return new N((function(){var t=e.next();if(t.done)return t;var n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}))},i.export=function(){var e=this,t=new Array(this._nodes.size),n=0;this._nodes.forEach((function(e,r){t[n++]=function(e,t){var n={key:e};return u(t.attributes)||(n.attributes=a({},t.attributes)),n}(r,e)}));var r=new Array(this._edges.size);return n=0,this._edges.forEach((function(t,i){r[n++]=function(e,t,n){var r={key:t,source:n.source.key,target:n.target.key};return u(n.attributes)||(r.attributes=a({},n.attributes)),"mixed"===e&&n.undirected&&(r.undirected=!0),r}(e.type,i,t)})),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:t,edges:r}},i.import=function(e){var t,n,i,s,o,a=this,c=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e instanceof r)return e.forEachNode((function(e,t){c?a.mergeNode(e,t):a.addNode(e,t)})),e.forEachEdge((function(e,t,n,r,i,s,o){c?o?a.mergeUndirectedEdgeWithKey(e,n,r,t):a.mergeDirectedEdgeWithKey(e,n,r,t):o?a.addUndirectedEdgeWithKey(e,n,r,t):a.addDirectedEdgeWithKey(e,n,r,t)})),this;if(!l(e))throw new U("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!l(e.attributes))throw new U("Graph.import: invalid attributes. Expecting a plain object.");c?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}if(e.nodes){if(i=e.nodes,!Array.isArray(i))throw new U("Graph.import: invalid nodes. Expecting an array.");for(t=0,n=i.length;t<n;t++){ge(s=i[t]);var u=s,d=u.key,h=u.attributes;c?this.mergeNode(d,h):this.addNode(d,h)}}if(e.edges){var p=!1;if("undirected"===this.type&&(p=!0),i=e.edges,!Array.isArray(i))throw new U("Graph.import: invalid edges. Expecting an array.");for(t=0,n=i.length;t<n;t++){ye(o=i[t]);var m=o,f=m.source,g=m.target,y=m.attributes,w=m.undirected,b=void 0===w?p:w;"key"in o?(c?b?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:b?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey).call(this,o.key,f,g,y):(c?b?this.mergeUndirectedEdge:this.mergeDirectedEdge:b?this.addUndirectedEdge:this.addDirectedEdge).call(this,f,g,y)}}return this},i.nullCopy=function(e){var t=new r(a({},this._options,e));return t.replaceAttributes(a({},this.getAttributes())),t},i.emptyCopy=function(e){var t=this.nullCopy(e);return this._nodes.forEach((function(e,n){var r=a({},e.attributes);e=new t.NodeDataClass(n,r),t._nodes.set(n,e)})),t},i.copy=function(e){if("string"==typeof(e=e||{}).type&&e.type!==this.type&&"mixed"!==e.type)throw new Y('Graph.copy: cannot create an incompatible copy from "'.concat(this.type,'" type to "').concat(e.type,'" because this would mean losing information about the current graph.'));if("boolean"==typeof e.multi&&e.multi!==this.multi&&!0!==e.multi)throw new Y("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if("boolean"==typeof e.allowSelfLoops&&e.allowSelfLoops!==this.allowSelfLoops&&!0!==e.allowSelfLoops)throw new Y("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");for(var t,n,r=this.emptyCopy(e),i=this._edges.values();!0!==(t=i.next()).done;)Te(r,"copy",!1,(n=t.value).undirected,n.key,n.source.key,n.target.key,a({},n.attributes));return r},i.toJSON=function(){return this.export()},i.toString=function(){return"[object Graph]"},i.inspect=function(){var t=this,n={};this._nodes.forEach((function(e,t){n[t]=e.attributes}));var r={},i={};this._edges.forEach((function(e,n){var s,o=e.undirected?"--":"->",a="",c=e.source.key,l=e.target.key;e.undirected&&c>l&&(s=c,c=l,l=s);var u="(".concat(c,")").concat(o,"(").concat(l,")");n.startsWith("geid_")?t.multi&&(void 0===i[u]?i[u]=0:i[u]++,a+="".concat(i[u],". ")):a+="[".concat(n,"]: "),r[a+=u]=e.attributes}));var s={};for(var o in this)this.hasOwnProperty(o)&&!Ae.has(o)&&"function"!=typeof this[o]&&"symbol"!==e(o)&&(s[o]=this[o]);return s.attributes=this._attributes,s.nodes=n,s.edges=r,d(s,"constructor",this.constructor),s},r}(f.exports.EventEmitter);"undefined"!=typeof Symbol&&(xe.prototype[Symbol.for("nodejs.util.inspect.custom")]=xe.prototype.inspect),[{name:function(e){return"".concat(e,"Edge")},generateKey:!0},{name:function(e){return"".concat(e,"DirectedEdge")},generateKey:!0,type:"directed"},{name:function(e){return"".concat(e,"UndirectedEdge")},generateKey:!0,type:"undirected"},{name:function(e){return"".concat(e,"EdgeWithKey")}},{name:function(e){return"".concat(e,"DirectedEdgeWithKey")},type:"directed"},{name:function(e){return"".concat(e,"UndirectedEdgeWithKey")},type:"undirected"}].forEach((function(e){["add","merge","update"].forEach((function(t){var n=e.name(t),r="add"===t?Te:Se;e.generateKey?xe.prototype[n]=function(i,s,o){return r(this,n,!0,"undirected"===(e.type||this.type),null,i,s,o,"update"===t)}:xe.prototype[n]=function(i,s,o,a){return r(this,n,!1,"undirected"===(e.type||this.type),i,s,o,a,"update"===t)}}))})),function(e){z.forEach((function(t){var n=t.name,r=t.attacher;r(e,n("Node"),0),r(e,n("Source"),1),r(e,n("Target"),2),r(e,n("Opposite"),3)}))}(xe),function(e){Z.forEach((function(t){var n=t.name,r=t.attacher;r(e,n("Edge"),"mixed"),r(e,n("DirectedEdge"),"directed"),r(e,n("UndirectedEdge"),"undirected")}))}(xe),function(e){ee.forEach((function(t){!function(e,t){var n=t.name,r=t.type,i=t.direction;e.prototype[n]=function(e,t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];if(!arguments.length)return function(e,t){if(0===e.size)return[];if("mixed"===t||t===e.type)return"function"==typeof Array.from?Array.from(e._edges.keys()):D(e._edges.keys(),e._edges.size);for(var n,r,i="undirected"===t?e.undirectedSize:e.directedSize,s=new Array(i),o="undirected"===t,a=e._edges.values(),c=0;!0!==(n=a.next()).done;)(r=n.value).undirected===o&&(s[c++]=r.key);return s}(this,r);if(1===arguments.length){e=""+e;var s=this._nodes.get(e);if(void 0===s)throw new V("Graph.".concat(n,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n,r){var i=[];return ce(!1,e,t,n,r,(function(e){i.push(e)})),i}(this.multi,"mixed"===r?this.type:r,i,s)}if(2===arguments.length){e=""+e,t=""+t;var o=this._nodes.get(e);if(!o)throw new V("Graph.".concat(n,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V("Graph.".concat(n,': could not find the "').concat(t,'" target node in the graph.'));return function(e,t,n,r,i){var s=[];return le(!1,e,t,n,r,i,(function(e){s.push(e)})),s}(r,this.multi,i,o,t)}throw new U("Graph.".concat(n,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t,n){if("mixed"===r||"mixed"===this.type||r===this.type){if(1===arguments.length)return ae(!1,this,r,n=e);if(2===arguments.length){e=""+e,n=t;var o=this._nodes.get(e);if(void 0===o)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));return ce(!1,this.multi,"mixed"===r?this.type:r,i,o,n)}if(3===arguments.length){e=""+e,t=""+t;var a=this._nodes.get(e);if(!a)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V("Graph.".concat(s,': could not find the "').concat(t,'" target node in the graph.'));return le(!1,r,this.multi,i,a,t,n)}throw new U("Graph.".concat(s,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))}};var o="map"+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(){var e,t=Array.prototype.slice.call(arguments),n=t.pop();if(0===t.length){var i=0;"directed"!==r&&(i+=this.undirectedSize),"undirected"!==r&&(i+=this.directedSize),e=new Array(i);var o=0;t.push((function(t,r,i,s,a,c,l){e[o++]=n(t,r,i,s,a,c,l)}))}else e=[],t.push((function(t,r,i,s,o,a,c){e.push(n(t,r,i,s,o,a,c))}));return this[s].apply(this,t),e};var a="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((function(e,r,i,s,o,a,c){t(e,r,i,s,o,a,c)&&n.push(e)})),this[s].apply(this,e),n};var c="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(){var e,t,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new U("Graph.".concat(c,": invalid number of arguments (expecting 2, 3 or 4 and got ").concat(n.length,")."));if("function"==typeof n[n.length-1]&&"function"!=typeof n[n.length-2])throw new U("Graph.".concat(c,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));2===n.length?(e=n[0],t=n[1],n=[]):3===n.length?(e=n[1],t=n[2],n=[n[0]]):4===n.length&&(e=n[2],t=n[3],n=[n[0],n[1]]);var r=t;return n.push((function(t,n,i,s,o,a,c){r=e(r,t,n,i,s,o,a,c)})),this[s].apply(this,n),r}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s="find"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t,n){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return!1;if(1===arguments.length)return ae(!0,this,r,n=e);if(2===arguments.length){e=""+e,n=t;var o=this._nodes.get(e);if(void 0===o)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));return ce(!0,this.multi,"mixed"===r?this.type:r,i,o,n)}if(3===arguments.length){e=""+e,t=""+t;var a=this._nodes.get(e);if(!a)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V("Graph.".concat(s,': could not find the "').concat(t,'" target node in the graph.'));return le(!0,r,this.multi,i,a,t,n)}throw new U("Graph.".concat(s,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))};var o="some"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((function(e,n,r,i,s,o,a){return t(e,n,r,i,s,o,a)})),!!this[s].apply(this,e)};var a="every"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((function(e,n,r,i,s,o,a){return!t(e,n,r,i,s,o,a)})),!this[s].apply(this,e)}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s=n.slice(0,-1)+"Entries";e.prototype[s]=function(e,t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return N.empty();if(!arguments.length)return function(e,t){if(0===e.size)return N.empty();var n="mixed"!==t&&t!==e.type,r="undirected"===t,i=e._edges.values();return new N((function(){for(var e,t;;){if((e=i.next()).done)return e;if(t=e.value,!n||t.undirected===r)break}return{value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected},done:!1}}))}(this,r);if(1===arguments.length){e=""+e;var n=this._nodes.get(e);if(!n)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){var r=N.empty();return"undirected"!==e&&("out"!==t&&void 0!==n.in&&(r=Q(r,re(n.in))),"in"!==t&&void 0!==n.out&&(r=Q(r,re(n.out,t?void 0:n.key)))),"directed"!==e&&void 0!==n.undirected&&(r=Q(r,re(n.undirected))),r}(r,i,n)}if(2===arguments.length){e=""+e,t=""+t;var o=this._nodes.get(e);if(!o)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V("Graph.".concat(s,': could not find the "').concat(t,'" target node in the graph.'));return function(e,t,n,r){var i=N.empty();return"undirected"!==e&&(void 0!==n.in&&"out"!==t&&r in n.in&&(i=Q(i,oe(n.in,r))),void 0!==n.out&&"in"!==t&&r in n.out&&(t||n.key!==r)&&(i=Q(i,oe(n.out,r)))),"directed"!==e&&void 0!==n.undirected&&r in n.undirected&&(i=Q(i,oe(n.undirected,r))),i}(r,i,o,t)}throw new U("Graph.".concat(s,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(e,t)}))}(xe),function(e){ue.forEach((function(t){(function(e,t){var n=t.name,r=t.type,i=t.direction;e.prototype[n]=function(e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];e=""+e;var t=this._nodes.get(e);if(void 0===t)throw new V("Graph.".concat(n,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){if("mixed"!==e){if("undirected"===e)return Object.keys(n.undirected);if("string"==typeof t)return Object.keys(n[t])}var r=[];return pe(!1,e,t,n,(function(e){r.push(e)})),r}("mixed"===r?this.type:r,i,t)}})(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t){if("mixed"===r||"mixed"===this.type||r===this.type){e=""+e;var n=this._nodes.get(e);if(void 0===n)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));pe(!1,"mixed"===r?this.type:r,i,n,t)}};var o="map"+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(e,t){var n=[];return this[s](e,(function(e,r){n.push(t(e,r))})),n};var a="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(e,t){var n=[];return this[s](e,(function(e,r){t(e,r)&&n.push(e)})),n};var c="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(e,t,n){if(arguments.length<3)throw new U("Graph.".concat(c,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));var r=n;return this[s](e,(function(e,n){r=t(r,e,n)})),r}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s=n[0].toUpperCase()+n.slice(1,-1),o="find"+s;e.prototype[o]=function(e,t){if("mixed"===r||"mixed"===this.type||r===this.type){e=""+e;var n=this._nodes.get(e);if(void 0===n)throw new V("Graph.".concat(o,': could not find the "').concat(e,'" node in the graph.'));return pe(!0,"mixed"===r?this.type:r,i,n,t)}};var a="some"+s;e.prototype[a]=function(e,t){return!!this[o](e,t)};var c="every"+s;e.prototype[c]=function(e,t){return!this[o](e,(function(e,n){return!t(e,n)}))}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s=n.slice(0,-1)+"Entries";e.prototype[s]=function(e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return N.empty();e=""+e;var t=this._nodes.get(e);if(void 0===t)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){if("mixed"!==e){if("undirected"===e)return me(null,n,n.undirected);if("string"==typeof t)return me(null,n,n[t])}var r=N.empty(),i=new de;return"undirected"!==e&&("out"!==t&&(r=Q(r,me(i,n,n.in))),"in"!==t&&(r=Q(r,me(i,n,n.out)))),"directed"!==e&&(r=Q(r,me(i,n,n.undirected))),r}("mixed"===r?this.type:r,i,t)}}(e,t)}))}(xe);var Pe=function(e){function n(t){var n=a({type:"directed"},t);if("multi"in n&&!1!==n.multi)throw new U("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==n.type)throw new U('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(xe),Me=function(e){function n(t){var n=a({type:"undirected"},t);if("multi"in n&&!1!==n.multi)throw new U("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==n.type)throw new U('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(xe),$e=function(e){function n(t){var n=a({multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");return e.call(this,n)||this}return t(n,e),n}(xe),Ne=function(e){function n(t){var n=a({type:"directed",multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==n.type)throw new U('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(xe),Le=function(e){function n(t){var n=a({type:"undirected",multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==n.type)throw new U('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(xe);function Ie(e){e.from=function(t,n){var r=a({},t.options,n),i=new e(r);return i.import(t),i}}return Ie(xe),Ie(Pe),Ie(Me),Ie($e),Ie(Ne),Ie(Le),xe.Graph=xe,xe.DirectedGraph=Pe,xe.UndirectedGraph=Me,xe.MultiGraph=$e,xe.MultiDirectedGraph=Ne,xe.MultiUndirectedGraph=Le,xe.InvalidArgumentsGraphError=U,xe.NotFoundGraphError=V,xe.UsageGraphError=Y,xe}()},944:(e,t)=>{"use strict";t.Vb=void 0,t.Vb=function(e,t,n){var r=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 r=0,i=e.length,s=t.length,o=Math.floor(Math.max(i,s)/2)-1,a=new Array(i),c=new Array(s),l=0;l<i;l++)for(var u=Math.max(0,l-o);u<=Math.min(s,l+o+1);u++)if(!a[l]&&!c[u]&&e[l]===t[u]){++r,a[l]=c[u]=!0;break}if(0===r)return 0;var d=0,h=0;for(l=0;l<i;l++)if(a[l]){for(;!c[h];)h++;e.charAt(l)!==t.charAt(h++)&&d++}return(r/i+r/s+(r-(d/=2))/r)/3}(e,t,n),i=0;if(r>.7){for(var s=Math.min(e.length,t.length),o=0;e[o]===t[o]&&o<4&&o<s;)++i,o++;r+=.1*i*(1-r)}return r}},7106:e=>{"use strict";var t=e.exports=function(e,t,r){"function"==typeof t&&(r=t,t={}),n(t,"function"==typeof(r=t.cb||r)?r:r.pre||function(){},r.post||function(){},e,"",e)};function n(e,r,i,s,o,a,c,l,u,d){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var h in r(s,o,a,c,l,u,d),s){var p=s[h];if(Array.isArray(p)){if(h in t.arrayKeywords)for(var m=0;m<p.length;m++)n(e,r,i,p[m],o+"/"+h+"/"+m,a,o,h,s,m)}else if(h in t.propsKeywords){if(p&&"object"==typeof p)for(var f in p)n(e,r,i,p[f],o+"/"+h+"/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),a,o,h,s,f)}else(h in t.keywords||e.allKeys&&!(h in t.skipKeywords))&&n(e,r,i,p,o+"/"+h,a,o,h,s)}i(s,o,a,c,l,u,d)}}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}},5072:e=>{"use strict";var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var s={},o=[],a=0;a<e.length;a++){var c=e[a],l=r.base?c[0]+r.base:c[0],u=s[l]||0,d="".concat(l," ").concat(u);s[l]=u+1;var h=n(d),p={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==h)t[h].references++,t[h].updater(p);else{var m=i(p,r);r.byIndex=a,t.splice(a,0,{identifier:d,updater:m,references:1})}o.push(d)}return o}function i(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,i){var s=r(e=e||[],i=i||{});return function(e){e=e||[];for(var o=0;o<s.length;o++){var a=n(s[o]);t[a].references--}for(var c=r(e,i),l=0;l<s.length;l++){var u=n(s[l]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}s=c}}},7659:e=>{"use strict";var t={};e.exports=function(e,n){var r=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(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},5056:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},7825: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 r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,i&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},1113: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))}}},1407:(e,t,n)=>{"use strict";n.d(t,{R:()=>l});var r=n(4328),i=n(6082),s=n(567),o=n(826),a=n(2738);const c=31;async function l(e,t=!1,n){const a=o.GO.forColumn(e);let l;n??=new Map;const d=a.isHelm()?(0,s.getHelmMonomers)(e):Object.keys(a.stats.freq).filter((e=>""!==e));for(let e=0;e<d.length;e++)n.has(d[e])||n.set(d[e],`${n.size+1}`);if(a.isHelm())l=await r.functions.call("HELM:getMolFiles",{col:e}),l=function(e,t,n=!1){const r=new Array(e.length);for(let i=0;i<e.length;i++){let s=0,o=0,a="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";const l=e.get(i);s=l.indexOf("\n",s)+1,s=l.indexOf("\n",s)+1,s=l.indexOf("\n",s)+1;const u=parseInt(l.substring(s,s+3)),d=parseInt(l.substring(s+3,s+6));a+=`M V30 COUNTS ${u} ${d} 0 0 0\n`,a+="M V30 BEGIN ATOM\n";for(let e=0;e<u;e++){s=l.indexOf("\n",s)+1+c,o=l.indexOf(" ",s);const r=l.substring(s,o);a+=n?`M V30 ${e+1} R${t.get(r)} 0.000 0.000 0 0\n`:`M V30 ${e+1} At 0.000 0.000 0 0 MASS=${t.get(r)}\n`}a+="M V30 END ATOM\n",a+="M V30 BEGIN BOND\n";for(let e=0;e<d;e++){s=l.indexOf("\n",s)+1;const t=parseInt(l.substring(s,s+3).trim()),n=parseInt(l.substring(s+3,s+6).trim());a+=`M V30 ${e+1} ${parseInt(l.substring(s+6,s+9).trim())} ${t} ${n}\n`}a+="M V30 END BOND\n",a+="M V30 END CTAB\n",a+="M END",r[i]=a}return r}(l,n,t);else{l=new Array(e.length);for(let r=0;r<e.length;r++){const e=u(a.getSplitted(r),n,t);l[r]=e}}return i.Column.fromStrings("monomericMols",l)}function u(e,t,n=!1){let r="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";r+=`M V30 COUNTS ${e.length} ${e.length?e.length-1:0} 0 0 0\n`,r+="M V30 BEGIN ATOM\n";for(let i=0;i<e.length;i++){const s=e.getCanonical(i);s!==a._S&&(r+=n?`M V30 ${i+1} R${t.get(s)} 0.000 0.000 0 0\n`:`M V30 ${i+1} At 0.000 0.000 0 0 MASS=${t.get(s)}\n`)}r+="M V30 END ATOM\n",r+="M V30 BEGIN BOND\n";for(let t=0;t<e.length-1;t++)r+=`M V30 ${t+1} 1 ${t+1} ${t+2}\n`;return r+="M V30 END BOND\n",r+="M V30 END CTAB\n",r+="M END",r}},567:(e,t,n)=>{"use strict";n.d(t,{_package:()=>Ct,activityCliffs:()=>xt,getHelmMonomers:()=>Nt,getMonomerLib:()=>_t,getMonomerLibHelper:()=>Tt,importFasta:()=>$t,sequenceIdentityScoring:()=>Lt,sequenceSimilarityScoring:()=>It,sequenceSpaceTopMenu:()=>Pt,toAtomicLevel:()=>Mt});var r,i,s=n(4328),o=n(7389),a=n(6082),c=n(684),l=n(9039);(i=r||(r={})).EUCLIDEAN="EUCLIDEAN",i.MANHATTAN="MANHATTAN";var u=n(1858),d=n(5072),h=n.n(d),p=n(7825),m=n.n(p),f=n(7659),g=n.n(f),y=n(5056),w=n.n(y),b=n(540),v=n.n(b),A=n(1113),E=n.n(A),C=n(7939),T={};T.styleTagTransform=E(),T.setAttributes=w(),T.insert=g().bind(null,"head"),T.domAPI=m(),T.insertStyleElement=v(),h()(C.A,T),C.A&&C.A.locals&&C.A.locals;var S=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};let _=null,x=null;Promise.resolve(),n(934),n(8903);const P="MCL";a.SEMTYPE.MOLECULE,a.SEMTYPE.MACROMOLECULE;const M=rxjs.operators;n(6295);const $=e=>null==e;function N(e,t,n,r){if(n>e[e.length-1])return;const i=e.findIndex((e=>n<e));e.pop(),e.splice(i,0,n),t.pop(),t.splice(i,0,r)}class L{constructor(){this._workerCount=Math.max(navigator.hardwareConcurrency-2,1)}async calcMultiColumn(e,t,i,s=[{}],o=[1],a=r.EUCLIDEAN){const c=e[0].length*(e[0].length-1)/2,l=Math.floor(c/this._workerCount),u=e[0].length>2e4?await this.getMinimalThreshold(e,t,s,o,a):0;i<u&&(console.log(`using threshold ${u}`),i=u),s.forEach(((e,t)=>s[t].threshold=i));const d=new Array(this._workerCount),h=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(111),n.b))));for(let n=0;n<this._workerCount;n++)d[n]=new Promise(((r,u)=>{const d=n*l,p=n===this._workerCount-1?c:(n+1)*l;p<=d&&r({i:new Int32Array(0),j:new Int32Array(0),distance:new Float32Array(0),idx:n}),h[n].postMessage({values:e,startIdx:d,endIdx:p,threshold:i,fnNames:t,opts:s,weights:o,aggregationMethod:a}),h[n].onmessage=({data:{error:e,i:t,j:i,distance:s}})=>{e?(h[n].terminate(),u(e)):(h[n].terminate(),r({i:t,j:i,distance:s,idx:n}))}}));const p=await Promise.all(d),m=p.reduce(((e,t)=>e+t.i.length),0),f=new Int32Array(m),g=new Int32Array(m),y=new Float32Array(m);let w=0;for(const e of p)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,r={}){return await this.calcMultiColumn([e],[t],n,[r],[1])}async getKNN(e,t,n=15,r={}){return await this.multiColumnKNN([e],[t],n,[r],[1])}async getThresholdKNN(e,t,n=.8,r={}){return await this.multiColumnThresholdKnn([e],[t],n,[r],[1])}async multiColumnThresholdKnn(e,t,i=.8,s,o,a=r.EUCLIDEAN){if(e.length!==t.length||e.length!==s.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 c=e[0].length*(e[0].length-1)/2,l=Math.floor(c/this._workerCount),u=new Array(this._workerCount),d=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(603),n.b))));for(let n=0;n<this._workerCount;n++)u[n]=new Promise(((r,u)=>{const h=n*l,p=n===this._workerCount-1?c:(n+1)*l;p<=h&&r({knnDistances:new Array(0),knnIndexes:new Array(0)}),d[n].postMessage({values:e,startIdx:h,endIdx:p,fnNames:t,opts:s,threshold:i,weights:o,aggregationMethod:a}),d[n].onmessage=({data:{error:e,knnDistances:t,knnIndexes:i}})=>{e?(d[n].terminate(),u(e)):(d[n].terminate(),r({knnDistances:t,knnIndexes:i}))}}));const h=await Promise.all(u),p=new Int32Array(e[0].length);for(const t of h)for(let n=0;n<e[0].length;++n)p[n]+=t.knnIndexes[n]?.length??0;const m={knnDistances:new Array(e[0].length).fill(null).map(((e,t)=>new Array(p[t]))),knnIndexes:new Array(e[0].length).fill(null).map(((e,t)=>new Array(p[t])))};for(const t of h)for(let n=0;n<e[0].length;++n)for(let e=0;e<t.knnDistances[n]?.length;++e)m.knnDistances[n][p[n]-1]=t.knnDistances[n][e],m.knnIndexes[n][p[n]-1]=t.knnIndexes[n][e],p[n]-=1;return m}async multiColumnKNN(e,t,i=15,s,o,a=r.EUCLIDEAN){if(e.length!==t.length||e.length!==s.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 c=e[0].length*(e[0].length-1)/2,l=Math.floor(c/this._workerCount),u=new Array(this._workerCount),d=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(950),n.b))));for(let n=0;n<this._workerCount;n++)u[n]=new Promise(((r,u)=>{const h=n*l,p=n===this._workerCount-1?c:(n+1)*l;p<=h&&r({knnDistances:new Array(0),knnIndexes:new Array(0)}),d[n].postMessage({values:e,startIdx:h,endIdx:p,fnNames:t,opts:s,nNeighbours:i,weights:o,aggregationMethod:a}),d[n].onmessage=({data:{error:e,knnDistances:t,knnIndexes:i}})=>{e?(d[n].terminate(),u(e)):(d[n].terminate(),r({knnDistances:t,knnIndexes:i}))}}));const h=await Promise.all(u),p={knnDistances:new Array(e[0].length).fill(null).map((()=>new Array(i).fill(99999))),knnIndexes:new Array(e[0].length).fill(null).map((()=>new Array(i).fill(-1)))};for(const t of h)for(let n=0;n<e[0].length;++n)for(let e=0;e<t.knnDistances[n]?.length;++e)N(p.knnDistances[n],p.knnIndexes[n],t.knnDistances[n][e],t.knnIndexes[n][e]);return p}async getSampleDistances(e,t,i=[],s,o=r.EUCLIDEAN){const a=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(778),n.b))));try{const n=e[0].length*(e[0].length-1)/2,r=Math.floor(n/this._workerCount),c=1e6,l=Math.max(Math.min(n/1e3,c),Math.min(n,c)),u=Math.floor(l/this._workerCount),d=new Array(this._workerCount);for(let c=0;c<this._workerCount;c++)d[c]=new Promise(((l,d)=>{const h=c*r,p=c===this._workerCount-1?n:(c+1)*r;a[c].postMessage({values:e,startIdx:h,endIdx:p,sampleLength:u,fnNames:t,opts:i,weights:s,aggregationMethod:o}),a[c].onmessage=({data:{error:e,distance:t}})=>{a[c].terminate(),e?d(e):l({distance:t})}}));const h=await Promise.all(d),p=h.reduce(((e,t)=>e+t.distance.length),0),m=new Float32Array(p);let f=0;for(const e of h)m.set(e.distance,f),f+=e.distance.length;return m.sort(),m}catch(e){return a?.forEach((e=>e?.terminate())),console.error(e),new Float32Array(1).fill(.5)}}async getMinimalThreshold(e,t,n=[],i,s=r.EUCLIDEAN){try{const r=e.length*(e.length-1)/2,o=await this.getSampleDistances(e,t,n,i,s);return 1-o[Math.floor(7e7/r*o.length)]}catch(e){return console.error(e),.5}}static calcSync(e,t,n,r){const i=[],s=[],o=[];let a=0,c=0,l=0;const u=e.length*(e.length-1)/2;for(;a<u;){const t=$(e[c])||$(e[l])?1:n(e[c],e[l]);1-t>=r&&(i.push(c),s.push(l),o.push(t)),a++,l++,l===e.length&&(c++,l=c+1)}return{i:new Int32Array(i),j:new Int32Array(s),distance:new Float32Array(o)}}}var I,R,O=n(8774);(R=I||(I={})).none="none",R.bold="bold",R.dashed="dashed";class k{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,r,i=I.none){var s;this._currentLineIdx=-1,this.lineClicked=new u.Subject,this.lineHover=new u.Subject,this.mouseOverLineId=-1,this.arrowWidth=15,this.sp=e,this.xAxisCol=this.sp.dataFrame.columns.byName(t),this.yAxisCol=this.sp.dataFrame.columns.byName(n),this.canvas=this.sp.getInfo().canvas,this.ctx=this.canvas.getContext("2d"),this.currentLineStyle=i,this.updateLines(r),this.visibility=null!==(s=r.visibility)&&void 0!==s?s:new O.A(this.lines.from.length),r.visibility||this.visibility.setAll(!0,!1),r.arrowSize&&(this.arrowWidth=r.arrowSize),this.canvas.onmousedown=e=>{var t;(null===(t=this.lines)||void 0===t?void 0:t.skipMouseOverDetection)&&(this.mouseOverLineId=this.checkCoordsOnLine(e.offsetX,e.offsetY)),-1!==this.mouseOverLineId&&this.lineClicked.next({x:e.clientX,y:e.clientY,id:this.mouseOverLineId,event:e})},this.canvas.onmousemove=e=>{var t;this.mouseOverLineId=(null===(t=this.lines)||void 0===t?void 0:t.skipMouseOverDetection)?-1: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,r,i,s,o,a,c,l,u,d,h,p,m,f,g;const y=this.sp.getOptions().look,w=this.lines.colors||this.lines.widths||this.lines.opacities||this.lines.drawArrowsArr;w||(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 b=y.sizeColumnName?this.sp.dataFrame.col(y.sizeColumnName):null,v=this.sp.dataFrame.filter,A=Math.pow(null!==(r=this.lines.shortLineThreshold)&&void 0!==r?r:5,2);for(let e=0;e<this.lines.from.length;e++)if(v.get(this.lines.from[e])&&v.get(this.lines.to[e])&&this.visibility.getBit(e)){let t=0;const{sizeFrom:n,sizeTo:r}=this.getMarkersSizes(y,b,e),v=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[e]),this.yAxisCol.get(this.lines.from[e]));let E=null==v?void 0:v.x,C=null==v?void 0:v.y;const T=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[e]),this.yAxisCol.get(this.lines.to[e]));let S=null==T?void 0:T.x,_=null==T?void 0:T.y;const x=Math.min(this.sp.viewBox.width,this.sp.viewBox.height);if(this.ctx.beginPath(),E&&C&&S&&_&&Math.hypot(S-E,_-C)/x>.01){if(w){const t=(null===(i=this.lines.colors)||void 0===i?void 0:i[e])?null===(s=this.lines.colors)||void 0===s?void 0:s[e]:null!==(o=this.lines.color)&&void 0!==o?o:"0,128,0",n=(null===(a=this.lines.opacities)||void 0===a?void 0:a[e])?null===(c=this.lines.opacities)||void 0===c?void 0:c[e]:null!==(l=this.lines.opacity)&&void 0!==l?l:1;this.ctx.strokeStyle=`rgba(${t},${n})`,this.ctx.lineWidth=(null===(u=this.lines.widths)||void 0===u?void 0:u[e])?null===(d=this.lines.widths)||void 0===d?void 0:d[e]:null!==(h=this.lines.width)&&void 0!==h?h:1}e===this._currentLineIdx&&this.toggleCurrentLineStyle(!0);const y=this.multipleLinesCounts[e];let b=null;if(y){t=this.getLineLength(E,C,S,_);const i=this.getPointOnDistance(E,C,S,_,r,t),s=this.getPointOnDistance(S,_,E,C,n,t);E=i.x,C=i.y,S=s.x,_=s.y,b=this.lines.from[e]>this.lines.to[e]?this.findControlPoint(y,E,C,S,_,e):this.findControlPoint(y,S,_,E,C,e),this.ctx.moveTo(E,C),this.ctx.quadraticCurveTo(b.x,b.y,S,_)}else(!this.lines.skipShortLines||Math.pow(S-E,2)+Math.pow(_-C,2)>A)&&(this.ctx.moveTo(E,C),this.ctx.lineTo(S,_));if((null!==(p=this.lines.drawArrows)&&void 0!==p?p:null===(m=this.lines.drawArrowsArr)||void 0===m?void 0:m.getBit(e))&&(t||(t=this.getLineLength(E,C,S,_)),t>this.arrowWidth)){const e=y?null:this.getPointOnDistance(E,C,S,_,r,t),n=y?b.x:E,i=y?b.y:C;this.canvasArrow(this.ctx,null!==(f=null==e?void 0:e.x)&&void 0!==f?f:E,null!==(g=null==e?void 0:e.y)&&void 0!==g?g:C,n,i)}this.ctx.stroke(),this.ctx.closePath(),e===this._currentLineIdx&&this.toggleCurrentLineStyle(!1)}}this.fillLeftBottomRect()}toggleCurrentLineStyle(e){switch(this.currentLineStyle){case I.bold:e?this.ctx.lineWidth+=2:this.ctx.lineWidth-=2;break;case I.dashed:e?this.ctx.setLineDash([5,5]):this.ctx.setLineDash([]);break;default:return}}getMarkersSizes(e,t,n){let r=3,i=3;return t?(r=(e.markerMinSize+(e.markerMaxSize-e.markerMinSize)*t.scale(this.lines.from[n]))/2,i=(e.markerMinSize+(e.markerMaxSize-e.markerMinSize)*t.scale(this.lines.to[n]))/2):e.markerDefaultSize&&(r=e.markerDefaultSize/2,i=e.markerDefaultSize/2),{sizeFrom:r,sizeTo:i}}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={};for(let t=0;t<this.lines.from.length;t++){let n=0,r=0;this.lines.from[t]<this.lines.to[t]?(n=this.lines.from[t],r=this.lines.to[t]):(n=this.lines.to[t],r=this.lines.from[t]),e[`${n}|${r}`]?(1===e[`${n}|${r}`].length&&(this.multipleLinesCounts[e[`${n}|${r}`][0]]=1,e[`${n}|${r}`].push(1)),this.multipleLinesCounts[t]=++e[`${n}|${r}`][1]):e[`${n}|${r}`]=[t]}}checkCoordsOnLine(e,t){let n=-1,r=null,i=null;const s=this.sp.getOptions().look,o=s.sizeColumnName?this.sp.dataFrame.col(s.sizeColumnName):null,a=this.sp.dataFrame.filter;for(let c=0;c<this.lines.from.length;c++)if(a.get(this.lines.from[c])&&a.get(this.lines.to[c])&&this.visibility.getBit(c)){const{sizeFrom:a,sizeTo:l}=this.getMarkersSizes(s,o,c),u=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[c]),this.yAxisCol.get(this.lines.from[c])),d=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[c]),this.yAxisCol.get(this.lines.to[c]));if(this.multipleLinesCounts[c]){const n=this.getLineLength(u.x,u.y,d.x,d.y),r=this.getPointOnDistance(u.x,u.y,d.x,d.y,l,n),s=this.getPointOnDistance(d.x,d.y,null==u?void 0:u.x,null==u?void 0:u.y,a,n),o=this.lines.from[c]>this.lines.to[c]?this.findControlPoint(this.multipleLinesCounts[c],r.x,r.y,s.x,s.y,c):this.findControlPoint(this.multipleLinesCounts[c],s.x,s.y,r.x,r.y,c);i=this.calculateDistToCurveLine(c,e,t,r,s,o)}else i=this.calculateDistToStraightLine(e,t,u,d);(!r&&null!==i&&i<5||r&&null!==i&&i<r)&&(r=i,n=c)}return n}calculateDistToStraightLine(e,t,n,r){const i=Math.min(n.x,r.x),s=Math.max(n.x,r.x),o=Math.min(n.y,r.y),a=Math.max(n.y,r.y);return e>=i-2&&e<=s+2&&t>=o-2&&t<=a+2?this.distToStraightLineSegment(e,t,n,r):null}distToStraightLineSegment(e,t,n,r){const i=(e,t,n,r)=>Math.pow(e-n,2)+Math.pow(t-r,2),s=i(n.x,n.y,r.x,r.y);if(0==s)return i(e,t,n.x,n.y);let o=((e-n.x)*(r.x-n.x)+(t-n.y)*(r.y-n.y))/s;return o=Math.max(0,Math.min(1,o)),i(e,t,n.x+o*(r.x-n.x),n.y+o*(r.y-n.y))}calculateDistToCurveLine(e,t,n,r,i,s){const o=Math.min(r.x,i.x,s.x),a=Math.max(r.x,i.x,s.x),c=Math.min(r.y,i.y,s.y),l=Math.max(r.y,i.y,s.y);if(t>=o-2&&t<=a+2&&n>=c-2&&n<=l+2){const e=a-o,u=l-c;return this.calculateDistToCurveInRect(t,n,r,s,i,e,u)}return null}calculateDistToCurveInRect(e,t,n,r,i,s,o){const a=Math.floor((s+o)/3),c=1/a,l=new Uint32Array(a),u=new Uint32Array(a),d=new Uint32Array(a);let h=null;const p=new O.A(a);for(let s=0;s<l.length;s++){const o=s*c,a=Math.pow(1-o,2)*n.x+2*o*(1-o)*r.x+Math.pow(o,2)*i.x,p=Math.pow(1-o,2)*n.y+2*o*(1-o)*r.y+Math.pow(o,2)*i.y,m=Math.abs(e-a),f=Math.abs(t-p),g=m+f;(!h||h>g)&&(h=g),d[s]=Math.max(m,f),l[s]=a,u[s]=p}for(let e=0;e<l.length;e++)d[e]<h&&p.setBit(e,!0,!1);let m=null;for(let n=-1;-1!==(n=p.findNext(n));){const r=Math.hypot(l[n]-e,u[n]-t);(!m||m>r)&&(m=r)}return m}getLineLength(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))}getPointOnDistance(e,t,n,r,i,s){const o=n-i*((n-e)/s),c=r-i*((r-t)/s);return new a.Point(o,c)}findControlPoint(e,t,n,r,i,s){const o=t+(r-t)/2,c=n+(i-n)/2;let l=o-t,u=c-n;const d=Math.sqrt(l*l+u*u);l/=d,u/=d;const h=50*Math.ceil(e/2);return e%2==0?new a.Point(o+h/2*u,c-h/2*l):new a.Point(o-h/2*u,c+h/2*l)}canvasArrow(e,t,n,r,i){const s=Math.atan2(r-t,i-n)+Math.PI;e.moveTo(t-this.arrowWidth*Math.sin(s-Math.PI/10),n-this.arrowWidth*Math.cos(s-Math.PI/10)),e.lineTo(t,n),e.lineTo(t-this.arrowWidth*Math.sin(s+Math.PI/10),n-this.arrowWidth*Math.cos(s+Math.PI/10))}}const G="dimensionality-reducer-terminate-event";var H,D,F=n(3629);async function U(e,t,r,i,o,a,c){let l=await async function(e,t,r,i,o,a,c){if(!a.distanceFnArgs)throw new Error("options.distanceFnArgs must be defined");if(e.length!==t.length||e.length!==a.distanceFnArgs.length||e.length!==i.length)throw new Error("data, metrics and options and weights must have the same length");return new Promise((function(l,u){const d=new Worker(new URL(n.p+n.u(234),n.b));d.postMessage({columnsData:e,distanceMetrics:t,method:r,options:a,weights:i,aggregationMethod:o});const h=s.events.onCustomEvent(G).subscribe((()=>{try{d?.terminate()}finally{h.unsubscribe()}}));d.onmessage=({data:{error:e,embedding:t,epochNum:n,epochsLength:r}})=>{$(n)||$(r)?(h.unsubscribe(),e?u(e):l(t),setTimeout((()=>d.terminate()),100)):c&&c(n,r,t)}}))}(e,r,t,i,o,a,c);return l=l.map((e=>(0,F.S8)(e))),l}(D=H||(H={})).EUCLIDEAN="EUCLIDEAN",D.MANHATTAN="MANHATTAN";const V={[H.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 `},[H.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 Y,B;(B=Y||(Y={})).HAMMING="Hamming",B.EUCLIDEAN="Euclidean",B.MANHATTAN="Manhattan",B.TANIMOTO="Tanimoto",B.LEVENSTEIN="Levenshtein",B.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",B.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",B.SOKAL="Sokal",B.COSINE="Cosine",B.ASYMMETRIC="Asymmetric",B.Difference="Difference",B.OneHot="One-Hot";const W={[Y.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 `},[Y.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 `},[Y.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 `},[Y.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 `},[Y.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 `},[Y.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] = gapExtensionPenalty + f32(i - 1) * gapExtensionPenalty; // accounting for the fact that left and right gaps are less costly\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] = gapExtensionPenalty + 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 || i == 1 || i == bLength) {\n top = top + gapExtensionPenalty;\n } else {\n top = top + gapOpenPenalty;\n }\n var left = (*curRow)[j - 1]; // insertion\n if (horizontalGaps[j - 1] > 0 || j == 1 || j == aLength) {\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(minLength);\n\n `},[Y.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 `},[Y.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 `},[Y.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 `},[Y.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 `},[Y.Difference]:function(e,t){return`\n let range = suppInfo.range${t};\n return f32(abs(f32(a[0]) - f32(b[0])) / range);\n `},[Y.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 `}},j={[Y.HAMMING]:e=>Math.ceil(e/30),[Y.EUCLIDEAN]:e=>Math.ceil(e/30),[Y.MANHATTAN]:e=>Math.ceil(e/30),[Y.TANIMOTO]:e=>Math.ceil(e/60),[Y.SOKAL]:e=>Math.ceil(e/60),[Y.COSINE]:e=>Math.ceil(e/60),[Y.ASYMMETRIC]:e=>Math.ceil(e/60),[Y.LEVENSTEIN]:e=>Math.ceil(e*e/60),[Y.NEEDLEMAN_WUNSCH]:e=>Math.ceil(e*e/60),[Y.MONOMER_CHEMICAL_DISTANCE]:e=>Math.ceil(e/25),[Y.Difference]:e=>1,[Y.OneHot]:e=>Math.ceil(e/40)},K={STRING:new Set([Y.HAMMING,Y.LEVENSTEIN,Y.NEEDLEMAN_WUNSCH,Y.MONOMER_CHEMICAL_DISTANCE,Y.OneHot]),UINT32ARRAY:new Set([Y.HAMMING,Y.EUCLIDEAN,Y.MANHATTAN,Y.MONOMER_CHEMICAL_DISTANCE,Y.LEVENSTEIN,Y.NEEDLEMAN_WUNSCH,Y.TANIMOTO,Y.COSINE,Y.SOKAL,Y.ASYMMETRIC,Y.OneHot,Y.Difference]),INT32ARRAY:new Set([Y.EUCLIDEAN,Y.MANHATTAN,Y.OneHot,Y.Difference]),FLOAT32ARRAY:new Set([Y.EUCLIDEAN,Y.MANHATTAN,Y.Difference]),NUMBER:new Set([Y.EUCLIDEAN,Y.MANHATTAN,Y.Difference]),BITARRAY:new Set([Y.TANIMOTO,Y.COSINE,Y.SOKAL,Y.ASYMMETRIC])};var q=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};function z(e,t,n,r){return e.map(((e,r)=>`\n fn distanceScript${r}(aIndex: u32, bIndex: u32) -> f32 {\n let a = computeInfo.data${r}[aIndex];\n let b = computeInfo.data${r}[bIndex];\n let maxDistance: f32 = ${n};\n ${W[e](t[r],r)}\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 ${V[r](e.length)}\n }\n \n `}let Z=0;const X="cliffsDf",J=new u.Subject,Q="activity_difference",ee="SALI_index",te="similarity",ne="line_index",re=["1_molecule","2_molecule"],ie="filterCliffs";async function se(e,t,r,i,c,l,u,d,h,p,m,f,g,y,w,b,v){Z++;const A=l/100;let E,C=!1;const T=f.inputs,$=await f.apply({[T[0].name]:t,[T[1].name]:u,...h.preprocessingFuncArgs??{}});let N=[];if(d===P){const t=await function(e,t,r,i,s,o,a=10,c=!1,l=2){const u=new Worker(new URL(n.p+n.u(980),n.b));let d;return u.postMessage({data:e,threshold:t,weights:r,aggregationMethod:i,distanceFns:s,distanceFnArgs:o,maxIterations:a,useWebGPU:c,inflate:l}),{promise:new Promise(((e,t)=>{d=e,u.onmessage=t=>{setTimeout((()=>u.terminate()),100),e(t.data.res)},u.onerror=e=>{setTimeout((()=>u.terminate()),100),t(e)}})),terminate:()=>{try{d(null),u.terminate()}catch(e){console.error(e)}}}}([$.entries],l,[1],"MANHATTAN",[u],[$.options??{}],h?.maxIterations??5,h.useWebGPU??!1).promise;e.columns.addNewInt(e.columns.getUnusedName("MCL Cluster")).init((e=>t.clusters[e])),N=[t.embedX,t.embedY]}else N=await U([$.entries],d,[u],[1],"MANHATTAN",{...h,distanceFnArgs:[$.options??{}]});if(N.length!==r.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(r[t]).init((e=>N[t][e]));let R=null;if(h.useWebGPU)try{R=await function(e,t=.8,n,r,i,s){return q(this,void 0,void 0,(function*(){const o=yield function(){return S(this,void 0,void 0,(function*(){if(!_&&(_=yield navigator.gpu.requestAdapter({powerPreference:"high-performance"}),null==_))return null;let e=!1;if(x&&(x.lost.then((()=>{e=!0})),yield new Promise((e=>setTimeout(e,10)))),!x||e){const e=1e9,t=_.limits,n=t.maxBufferSize,r=t.maxStorageBufferBindingSize;try{return x=yield _.requestDevice({requiredLimits:{maxBufferSize:Math.min(n,e),maxStorageBufferBindingSize:Math.min(r,e)}}),x}catch(e){return console.error("Failed to create device with required limits",e),x=yield _.requestDevice(),x}}return x}))}();if(!o)return null;const a=Object.values(Y);if(n.some((e=>!a.includes(e))))throw new Error("Invalid distance metrics provided: "+n.join(", "));if(!Object.values(H).includes(r))throw new Error("Invalid aggregation function provided: "+r);const c=1-t;if(s.length!==e.length||s.length!==n.length||s.length!==i.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 l=e.length,u=e[0].length,d=e.map(((e,t)=>function(e,t=Y.HAMMING,n,r={gapOpenPenalty:1,gapExtensionPenalty:.6}){var i,s;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 c=a[0]instanceof Int32Array?"INT32ARRAY":a[0]instanceof Float32Array?"FLOAT32ARRAY":"UINT32ARRAY",l=new Uint32Array(a.map((e=>e.length)));if(!K[o]||!K[o].has(t))throw new Error(`Distance metric '${t}' not supported for entry type '${o}'`);const u=l.reduce(((e,t)=>Math.max(e,t)),0),d=j[t](u),h="INT32ARRAY"===c?Int32Array:"FLOAT32ARRAY"===c?Float32Array:Uint32Array,p=new h(a.length*u);a.forEach(((e,t)=>{p.set(e,t*u)}));let m="",f=0,g="FLOAT32ARRAY",y=null;if(t===Y.NEEDLEMAN_WUNSCH||t===Y.MONOMER_CHEMICAL_DISTANCE){let e=r.scoringMatrix&&r.alphabetIndexes?Object.keys(r.alphabetIndexes).reduce(((e,t)=>Math.max(e,t.charCodeAt(0))),0):-1;if(!r.alphabetIndexes||!r.scoringMatrix){for(let t=0;t<p.length;t++)p[t]>e&&(e=p[t]);r.scoringMatrix=new Array(e+1).fill(null).map((()=>new Array(e+1).fill(0))),r.alphabetIndexes={};for(let e=0;e<r.scoringMatrix.length;e++)r.scoringMatrix[e][e]=1,r.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=r.alphabetIndexes;for(const e of Object.keys(a))for(const t of Object.keys(a))e!==t&&(o[e.charCodeAt(0)][t.charCodeAt(0)]=r.scoringMatrix[a[e]][a[t]]);f=2+t,g="FLOAT32ARRAY",y=new Float32Array(f),y[0]=null!==(i=r.gapOpenPenalty)&&void 0!==i?i:1,y[1]=null!==(s=r.gapExtensionPenalty)&&void 0!==s?s:.6;let c=2;for(let e=0;e<o.length;e++)y.set(o[e],c),c+=o[e].length;m=`\n gapOpenPenalty${n}: f32,\n gapExtensionPenalty${n}: f32,\n similarityMatrix${n}: array<array<f32, ${e+1}>, ${e+1}>`}else if(t===Y.Difference){if(!r.range||"number"!=typeof r.range||r.range<=0){const e=p.reduce(((e,t)=>Math.min(e,t)),p[0]),t=p.reduce(((e,t)=>Math.max(e,t)),p[0]);r.range=t-e}r.range<=0&&(r.range=1),f=1,g="FLOAT32ARRAY",y=new Float32Array([r.range]),m=`\n range${n}: f32`}const w=p instanceof Int32Array?"i32":p instanceof Float32Array?"f32":"u32",b=`data${n}: array<array<${w}, ${u}>, ${a.length}>`;return{flatSourceArray:p,sourceArraySize:p.length,maxEntryLen:u,arraySizes:l,complexity:d,suppInfoBuffer:y,suppInfoSize:f,suppInfoType:g,suppInfoStructWgsl:m,entryType:o,dataTypeWGSL:w,dataStructWgsl:b,EncodedArrayConstructor:h}}(e,n[t],t,s[t])));if(0===l)throw new Error("No columns provided. Please provide at least one column of data.");1===l&&(r=H.MANHATTAN);let h=d.map((e=>e.suppInfoStructWgsl)).filter((e=>!!e&&""!=e)).join(",\n"),p=!1;h&&""!=h.trim()||(p=!0,h="\ndummy: f32\n");const m=d.map((e=>e.dataStructWgsl)).filter((e=>!!e&&""!=e)).join(",\n"),f=new Uint32Array(l*u);d.forEach(((e,t)=>{f.set(e.arraySizes,t*u)}));const g=1e4,y=100,w=d.reduce(((e,t)=>e+t.complexity),0),b=Math.ceil(6e3/w),v=Math.ceil(Math.sqrt(Math.ceil(100))),A=10*v,E=u*(u-1)/2,C=Math.ceil(E/g),T=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 ${C} 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}>, ${l}>,\n // the weights for each entry\n weights: array<f32, ${l}>,\n // the data for each entry\n ${m} // 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 ${h}\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 ${p?"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 * ${A} + 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 <= ${c}) {\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 ${z(n,d.map((e=>e.maxEntryLen)),c,r)}\n\n\n `}),P=o.createComputePipeline({label:"sparse matrix compute pipeline",layout:"auto",compute:{module:T,entryPoint:"calcSparseMatrix"}}),M=new Uint32Array(g),$=new Uint32Array(g),N=new Uint32Array(g),L=new Uint32Array(g),I=Math.floor(E/g);let R=0,O=1;console.time("GPUthreadStarts");for(let e=0;e<g;e++){const t=9999===e?E-1:(e+1)*I,n=u-2-Math.floor(Math.sqrt(-8*t+4*u*(u-1)-7)/2-.5),r=t-u*n+Math.floor((n+1)*(n+2)/2);M[e]=O,$[e]=R,N[e]=r,L[e]=n,R=n,O=r}console.timeEnd("GPUthreadStarts");const k=4e4+u*l+l+d.reduce(((e,t)=>e+t.sourceArraySize),0),G=d.reduce(((e,t)=>e+t.suppInfoSize),0),D=1e6,F=k*Uint32Array.BYTES_PER_ELEMENT;let U=F;const V=15&F;0!==V&&(U+=16-V);const B=o.createBuffer({label:"compute info buffer",size:U,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),W=B.getMappedRange();let q=0;new Uint32Array(W,q,g).set(M),q+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(W,q,g).set($),q+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(W,q,g).set(N),q+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(W,q,g).set(L),q+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(W,q,f.length).set(f),q+=f.length*Uint32Array.BYTES_PER_ELEMENT,new Float32Array(W,q,l).set(i),q+=l*Float32Array.BYTES_PER_ELEMENT;for(const e of d){const t=e.EncodedArrayConstructor,n=e.sourceArraySize;new t(W,q,n).set(e.flatSourceArray),q+=n*t.BYTES_PER_ELEMENT}B.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 d)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 re=ne;const ie=15≠0!==ie&&(re+=16-ie);const se=o.createBuffer({label:"results buffer",size:re,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC}),oe=o.createBindGroup({label:"bindGroup for sparse matrix buffer",layout:P.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:B}},{binding:1,resource:{buffer:Q}},{binding:2,resource:{buffer:se}}]}),ae=o.createBuffer({label:"results out buffer",size:se.size,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),ce=[],le=[],ue=[];let de=!1;for(;!de;){const e=o.createCommandEncoder({label:"distance encoder"}),t=e.beginComputePass({label:"distance compute pass"});t.setPipeline(P),t.setBindGroup(0,oe),t.dispatchWorkgroups(v,v),t.end(),e.copyBufferToBuffer(se,0,ae,0,ae.size);const n=e.finish();o.queue.submit([n]),yield o.queue.onSubmittedWorkDone(),yield ae.mapAsync(GPUMapMode.READ);const r=ae.getMappedRange();let i=0;const s=new Uint32Array(r,i,D);i+=D*Uint32Array.BYTES_PER_ELEMENT;const a=new Uint32Array(r,i,D);i+=D*Uint32Array.BYTES_PER_ELEMENT;const c=new Float32Array(r,i,D);i+=D*Float32Array.BYTES_PER_ELEMENT;const l=new Uint32Array(r,i,g);i+=g*Uint32Array.BYTES_PER_ELEMENT,de=new Uint32Array(r,i,g).every((e=>1===e));const u=l.reduce(((e,t)=>e+t),0),d=new Uint32Array(u),h=new Uint32Array(u),p=new Float32Array(u);let m=0;for(let e=0;e<l.length;e++){const t=l[e];0!==t&&(d.set(s.subarray(e*y,e*y+t),m),h.set(a.subarray(e*y,e*y+t),m),p.set(c.subarray(e*y,e*y+t),m),m+=t)}ce.push(d),le.push(h),ue.push(p),ae.unmap()}const he=ce.reduce(((e,t)=>e+t.length),0),pe=new Uint32Array(he),me=new Uint32Array(he),fe=new Float32Array(he);let ge=0;for(let e=0;e<ce.length;e++)pe.set(ce[e],ge),me.set(le[e],ge),fe.set(ue[e],ge),ge+=ce[e].length;return B.destroy(),Q.destroy(),se.destroy(),ae.destroy(),{i:pe,j:me,distance:fe}}))}([$.entries],A,[u],H.MANHATTAN,[1],[$.options??{}])}catch(e){console.error(e)}R||(h.useWebGPU&&console.error("WebGPU sparse matrix calculation failed, falling back to CPU implementation"),R=await(new L).calc($.entries,u,A,$.options));const O=await async function(e,t){const n=e.distance.map(((n,r)=>{const i=Math.abs(t.get(e.i[r])-t.get(e.j[r]));return 0!=n?i/n:1/0})),r=e.distance.map((e=>1-e)),i=e.i,s=e.j,o=a.BitSet.create(t.length);return e.distance.forEach(((t,n)=>{o.set(e.i[n],!0),o.set(e.j[n],!0)})),{simVals:r,saliVals:n,n1:i,n2:s,cliffsBitSet:o}}(R,c),G=function(e,t,n,r,i,s,o){const c=new Array(e).fill(0);for(let e=0;e!=r.length;++e)n[e]!=1/0&&(o.get(r[e])>o.get(i[e])?c[r[e]]+=n[e]:c[i[e]]+=n[e]);return a.Column.fromList("double",t,c)}(t.length,`sali_${r[0].substring(r[0].lastIndexOf("_"))}`,O.saliVals,O.n1,O.n2,0,c);e.columns.add(G);const D=O.cliffsBitSet,F=function(e){const t=e.filter((e=>e!==1/0)),n=t.reduce(((e,t)=>Math.min(e,t)),Number.MAX_VALUE);return{max:t.reduce(((e,t)=>Math.max(e,t)),n),min:n}}(O.saliVals),V=.8/(F.max-F.min),B=v?s.shell.view("Browse").preview:s.shell.getTableView(e.name),W=B.addViewer(a.VIEWER.SCATTER_PLOT,{xColumnName:r[0],yColumnName:r[1],size:G.name,color:c.name,showXSelector:!1,showYSelector:!1,showSizeSelector:!1,showColorSelector:!1,markerMinSize:5,markerMaxSize:25,title:i}),se=function(e,t,n,r,i,s,o,c){const l={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++)l.from[n]=t.n1[n],l.to[n]=t.n2[n],l.opacities[n]=t.saliVals[n]===1/0?1:.2+(t.saliVals[n]-o.min)*c,l.colors[n]=e.selection.get(l.from[n])&&e.selection.get(l.to[n])?"255,255,0":"0,128,0",l.widths[n]=1;const u=a.DataFrame.create(l.from.length);return re.forEach(((e,t)=>{u.columns.addNewString(e).init((e=>n.get(0===t?l.from[e]:l.to[e]))),function(e,t){Object.keys(t).forEach((n=>{e.tags[n]=t[n]}))}(u.col(e),s),u.col(e).semType=i})),u.columns.addNewFloat(Q).init((e=>Math.abs(r.get(l.from[e])-r.get(l.to[e])))),u.columns.addNewInt(ne).init((e=>e)),u.columns.addNewFloat(ee).init((e=>t.saliVals[e])),u.columns.addNewFloat(te).init((e=>t.simVals[e])),u.name=`${X}${Z}`,{lines:l,linesDf:u}}(e,O,t,c,p,m,F,V);se.lines.skipMultiLineCalculation=!0,se.linesDf.col(ee).setTag("description","Structure−Activity Landscape Index (activity difference divided by 1 minus similarity)");const oe=new k(W,r[0],r[1],se.lines,I.none),ae=w?w(se.linesDf,re).sort([ee],[!1]):se.linesDf.plot.grid().sort([ee],[!1]);ae.col(ne)&&(ae.col(ne).visible=!1),e.temp[".cliffsDfGrid"]=ae;const ce=o.button(`${se.linesDf.rowCount} cliffs`,(()=>{v&&B.addViewer(ae),B.dockManager.dock(ae,"down",null,"Activity cliffs",b??.2)}));ce.classList.add("scatter_plot_link","cliffs_grid"),W.root.append(ce);const le=o.input.toggle("Show only cliffs",{value:!1,onValueChanged:t=>{t?(W.dataFrame.setTag(ie,r[0]),e.filter.and(D),J.next(r[0])):(W.dataFrame.setTag(ie,""),e.filter.setAll(!0),J.next(""))}});le.root.classList.add("scatter_plot_link","show_only_cliffs"),W.root.append(le.root),J.subscribe((e=>{le.enabled=""===e||e===r[0]}));let ue=!1;W.onEvent("d4-before-draw-scene").subscribe((t=>{ue?ue=!1:le.value&&(setTimeout((()=>{e.filter.and(D)}),100),ue=!0)}));const de=s.events.onViewerClosed.subscribe((e=>{e.args.viewer===W&&(B.dockManager.close(ae.root),de.unsubscribe(),B.subs=B.subs.filter((e=>e!==de)))}));return B.subs.push(de),se.linesDf.onCurrentCellChanged.subscribe((()=>{for(let e=0;e<se.linesDf.rowCount;e++)se.lines.widths[e]=e===se.linesDf.currentRowIdx?3:1;oe.linesToRender=se.lines;const n=se.linesDf.currentCol&&se.linesDf.currentCol.name===re[1]?se.lines.to:se.lines.from,i=-1!==se.linesDf.currentRowIdx?se.linesDf.currentRowIdx:null;if(W.dataFrame.currentRowIdx=i?n[i]:-1,null!==i){const n=se.linesDf.currentRowIdx;oe.currentLineId=n;const{zoomLeft:a,zoomRight:l,zoomTop:u,zoomBottom:d}=function(e,t,n,r,i,s){const o=Math.abs(n-i),a=Math.abs(r-s),c=e/o,l=t/a,u=Math.min(c,l),d=e/u*5,h=t/u*5,p=(n<i?n:i)+o/2-d/2,m=(r>s?r:s)-a/2+h/2;return{zoomLeft:p,zoomRight:p+d,zoomTop:m,zoomBottom:m-h}}(W.viewport.width,W.viewport.height,W.dataFrame.get(r[0],se.lines.from[n]),W.dataFrame.get(r[1],se.lines.from[n]),W.dataFrame.get(r[0],se.lines.to[n]),W.dataFrame.get(r[1],se.lines.to[n]));W.zoom(a,u,l,d),le.value?e.filter.and(D):!0===le.enabled&&e.filter.setAll(!0),setTimeout((()=>{!function(e,t,n,r,i,a,c,l,u){const d=t.getPane("Cliff Details");o.empty(d.root);const h=u({points:[n,r],lineId:i,df:e,seqCol:a,activityCol:c,sali:l});d.root.append(h),setTimeout((()=>{s.shell.o=t.root}),500)}(e,E,se.lines.from[i],se.lines.to[i],i,t,c,se.linesDf.get(ee,i),y);const n=W.dataFrame.getSortedOrder(B.grid.sortByColumns,B.grid.sortTypes);B.grid.scrollToCell(t.name,n.indexOf(W.dataFrame.currentRowIdx))}),1e3)}})),se.linesDf.onSelectionChanged.subscribe((t=>{setTimeout((()=>(()=>{const t=a.BitSet.create(e.rowCount);for(let e=0;e<se.linesDf.rowCount;e++){const n=se.linesDf.selection.get(e);n&&(t.set(se.lines.from[e],!0),t.set(se.lines.to[e],!0)),se.lines.colors[e]=n?"255,255,0":"0,128,0"}e.selection.copyFrom(t),oe.linesToRender=se.lines})()),100)})),e.onSelectionChanged.subscribe((t=>{!1===e.selection.anyTrue&&"number"==typeof t&&(C?C=!1:(e=>{e.selection.setAll(!1);for(let e=0;e<se.lines.colors.length;e++)se.lines.colors[e]="0,128,0";oe.linesToRender=se.lines})(ae.dataFrame))})),oe.lineClicked.subscribe((t=>{if(C=!0,oe.currentLineId=t.id,-1!==t.id){const n=se.linesDf.selection.clone();setTimeout((()=>{t.event.ctrlKey?(n.set(t.id,!n.get(t.id)),se.linesDf.selection.copyFrom(n)):(se.linesDf.currentRowIdx!==t.id&&(se.linesDf.currentRowIdx=t.id,e.currentRowIdx=se.lines.from[t.id]),se.linesDf.selection.copyFrom(n));const r=se.linesDf.getSortedOrder(ae.sortByColumns,ae.sortTypes);ae.scrollToCell(re[0],r.indexOf(t.id))}),500)}})),oe.lineHover.pipe((0,M.debounceTime)(500)).subscribe((n=>{-1!==n.id&&-1===e.mouseOverRowIdx&&o.tooltip.show(g({lineId:n.id,points:[se.lines.from[n.id],se.lines.to[n.id]],df:e,seqCol:t,activityCol:c}),n.x,n.y)})),W.addProperty("similarityLimit","double",A),E=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),s.shell.o=e.root,e}(),W}var oe,ae=n(2003),ce=n(826),le=n(3516),ue=n(6718),de=n(2738),he=n(3077);!function(e){e.IDENTITY="identity",e.SIMILARITY="similarity"}(oe||(oe={}));var pe,me,fe,ge=n(9192),ye=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};function we(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 be(e,t){return`${t} (${e.length>4?`${e.length} columns`:e.map((e=>e.name)).join(", ")})`}n(5540),function(e){e.ADD="ADD",e.SUB="SUB",e.MULT="MULT"}(pe||(pe={})),function(e){e.SQUARE="SQUARE",e.INVERSE="INVERSE",e.TRANSPOSE="TRANSPOSE",e.NORM="NORM",e.COLUMN_NORM="COLUMN_NORM"}(me||(me={})),function(e){e.SCALARMULT="SCALARMULT",e.SCALARADD="SCALARADD",e.SCALARPOW="SCALARPOW"}(fe||(fe={})),Object.prototype.toString,n(6873);var ve=n(4356),Ae=(n(6717),n(4870),n(1991)),Ee=n.n(Ae),Ce=n(9322);const Te="#808080",Se="rgb(0,0,0)",_e=Ce.zS;var xe,Pe;(xe||(xe={})).maxMonomerLength=".mm.cellRenderer.maxMonomerLength",function(e){e.MSA="MSA",e.classic="classic"}(Pe||(Pe={}));const Me=new class{constructor(){this.color="rgb(100,100,100)",this.pivot=0,this.left=!1,this.transparencyRate=1,this.separator="",this.last=!1,this.drawStyle=Pe.classic,this.maxWord=[],this.wordIdx=0,this.gridCell=null,this.referenceSequence=null,this.maxLengthOfMonomer=null,this.monomerTextSizeMap={},this.logger=void 0}};function $e(e,t,n,r,i,s,o){var a,c,l;const u=Object.assign(Object.assign({},Me),o);o.logger?.debug("Bio: printLeftOrCentered(), start"),e.textAlign="start";let d=t.substring(0),h=u.last?"":u.separator;u.drawStyle===Pe.MSA&&(h="");let p=!0,m=!0,f="difference";if(null!=u.gridCell&&null!=u.gridCell.cell.column&&(p=u.gridCell.cell.column.temp["color-code"]??!0,m=u.gridCell.cell.column.temp["compare-with-current"]??!0,f=u.gridCell.cell.column.temp["highlight-difference"]??"difference"),u.referenceSequence){const e=u.referenceSequence[u.wordIdx];m&&u.referenceSequence.length>0&&"difference"===f&&(u.transparencyRate=d==e?.3:u.transparencyRate),m&&u.referenceSequence.length>0&&"equal"===f&&(u.transparencyRate=d!=e?.3:u.transparencyRate)}null!=u.maxLengthOfMonomer&&(d=_e(d,u.maxLengthOfMonomer));const g=d+h;(a=u.monomerTextSizeMap)[g]??(a[g]=e.measureText(g));let y=u.monomerTextSizeMap[g];(c=u.monomerTextSizeMap)[d]??(c[d]=e.measureText(d));let w=u.monomerTextSizeMap[d].width;const b=s/2-(y.fontBoundingBoxAscent+y.fontBoundingBoxDescent)/2+1;(l=u.monomerTextSizeMap)[h]??(l[h]=e.measureText(h));const v=u.monomerTextSizeMap[h].width;function A(t,i){const s=p?u.color:Se;e.fillStyle=s,e.globalAlpha=u.transparencyRate,u.drawStyle===Pe.classic&&(e.fillText(d,n+t,r+b),e.fillStyle=Te,e.fillText(h,n+i,r+b)),u.drawStyle===Pe.MSA&&e.fillText(d,n+t,r+b)}y=y.width,u.drawStyle===Pe.MSA&&(w=u.maxWord[u.wordIdx],y=u.maxWord[u.wordIdx]);const E=(u.maxWord[u.wordIdx]??0)-(u.maxWord[0]??0);if(u.left||y>i)return A(E,E+w),n+E+w+v;{const e=(i-y)/2;return A(e,e+w),n+E+e+w}}n(6882);var Ne=n(4152);function Le(e){const t=!Ee().enumerate(e).some((([t,n])=>t.length>1&&0!=n&&n!=e.length-1)),n=[],r=t?"":" ";for(const[t,i]of Ee().enumerate(e)){let s=t;i<e.length&&(s+=`${t?"":"-"}${r}`),n.push(s)}return[n,t]}function Ie(e,t,n,r,i,s,o){const a=document.createElement("canvas"),c=a.getContext("2d");c.font="12px monospace";const l=c.measureText(Le([e]).join("")).width,u=c.measureText(Le([t]).join("")).width,d=Math.max(l,u);return a.height=o,a.width=d+4,c.font="12px monospace",c.textBaseline="top",$e(c,e,0,i-s,d,o,{color:n,pivot:0,left:!0}),$e(c,t,0,i+s,d,o,{color:r,pivot:0,left:!0}),a}ae.YI.DNA,ae.YI.RNA,ae.YI.PT,ae.YI.UN,n(6642),n(4139),ae.zS,a.GridCellRenderer,a.GridCellRenderer;var Re,Oe,ke,Ge=n(8070),He=n(4326);function De(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 r=o.divText(e.activityCol.get(n).toFixed(2));r.style.display="flex",r.style.justifyContent="left",r.style.paddingLeft="30px",t.append(o.divV([o.divText(e.seqCol.get(n)),r]))})),t}function Fe(e){const t=o.div();t.append(o.divText(e.seqCol.name,{style:{fontWeight:"bold"}}));const n=new Array(2);e.points.forEach(((t,r)=>{n[r]=e.activityCol.get(t)}));const r={},i=ce.GO.forColumn(e.seqCol),s=function(e,t,n,r){const i=document.createElement("canvas"),s=i.getContext("2d");return i.height=30,function(e,t,n,r,i,s,o,a,c,l){if(s.length!==o.length){const e=function(e,t){let n=0,r=0;const i=e.length>t.length?e:t,s=e.length>t.length?t:e;for(let e=0;e<s.length;e++)i[e]===s[e]&&n++;const o=i.length-s.length;for(let e=i.length-1;e>o;e--)i[e]===s[e-o]&&r++;const a=new Array(Math.abs(e.length-t.length)).fill(ce.b9[ae.Hi.FASTA]);function c(e){return n>r?e.concat(a):a.concat(e)}return e.length>t.length?t=c(Ee()(t).toArray()):e=c(Ee()(e).toArray()),{subParts1:e,subParts2:t}}(s,o);s=e.subParts1,o=e.subParts2}const u=e.measureText(Le(s).join("")),d=e.measureText(Le(o).join("")),h=Math.max(u.width,d.width);c&&(r=h+4*s.length,e.canvas.width=h+4*s.length);let p=Math.max(t,t+(r-(h+4*s.length))/2)+5;const m=Math.max(n,n+(i-28)/2);e.save(),e.beginPath(),e.rect(t,n,c?h+4*s.length:r,i),e.clip(),e.font="12px monospace",e.textBaseline="top";let f=Ne.oT.Color;"HELM"!==a&&(f=(0,ae.ny)(a.substring(a.length-2)));for(let t=0;t<s.length;t++){const n=s[t],a=o[t],c=f.get(n);if(n!=a){const s=f.get(a),o=$e(e,n,p,m-7,r,i,{color:c,pivot:0,left:!0}),u=$e(e,a,p,m+7,r,i,{color:s,pivot:0,left:!0});p=Math.max(u,o),l&&(l[t]=Ie(n,a,c,s,m,7,i))}else p=$e(e,n,p,m,r,i,{color:c,pivot:0,left:!0,transparencyRate:.5});p+=4}e.restore()}(s,0,0,0,30,Ee()(e.canonicals).toArray(),Ee()(t.canonicals).toArray(),n,!0,r),i}(i.getSplitted(e.points[0]),i.getSplitted(e.points[1]),i.units,r);return t.append(o.div(s,{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}(r)),t.append(Ue("Activity delta",Math.abs(n[0]-n[1]))),t.append(Ue("Cliff",e.sali)),t}function Ue(e,t){return o.divH([o.divText(`${e}: `,{style:{fontWeight:"bold",paddingRight:"5px"}}),o.divText(t.toFixed(2))],{style:{paddingTop:"10px"}})}function Ve(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.meta.units=e.col(t[0]).meta.units,n.setTag(ae.gp.separator,e.col(t[0]).getTag(ae.gp.separator)),e.columns.add(n);const r=e.plot.grid();return r.col(t[0]).visible=!1,r.col(t[1]).visible=!1,r}!function(e){e.Unknown="unknown",e.FR="framework",e.CDR="cdr"}(Re||(Re={})),new class{constructor(){this.regionTypes=[Re.CDR],this.chains=["Heavy","Light"],this.skipEmptyPositions=!1,this.fitWidth=!1,this.positionWidth=16,this.positionHeight=He.fH.Entropy,this.filterSource=He.Fo.filterSource}},n(7602),n(8047),function(e){e.STYLE="Style",e.BEHAVIOR="Behavior",e.LAYOUT="Layout",e.DATA="Data"}(Oe||(Oe={})),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={})),a.JsViewer,n(6863),n(2780),n(8115),a.JsViewer,n(1407);var Ye,Be,We=n(439);ce.b9[We.Hi.FASTA],n(5433),n(3890),n(1687),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"}(Ye||(Ye={}));class je{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 r=this.isWhitespace(n)?t:t-1;for(let e=0;e<r;e++)n=this.getNextColumnIdx(n);return n}parseAtomTypes(){const e=this.atomCount,t=new Array(e);let n=this.getAtomBlockIdx();for(let r=0;r<e;r++)n=this.shiftIdxToAtomType(n),t[r]=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 r=this.getAtomBlockIdx();for(let i=0;i<this.atomCount;i++){r=this.shiftIdxToXColumn(r);for(const s of[e,t,n])s[i]=this.parseFloatValue(r),r=this.getNextColumnIdx(r);r=this.getNextLineIdx(r)}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 r=new Uint16Array(2);r[0]=this.parseIntValue(t),t=this.getNextColumnIdx(t),r[1]=this.parseIntValue(t),e[n]=r,t=this.getNextLineIdx(t)}return e}parseBondTypes(){const e=this.bondCount,t=new Uint16Array(e);let n=this.getBondBlockIdx();for(let r=0;r<e;r++)n=this.shiftIdxToBondType(n),t[r]=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 Ke extends je{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 r=0;r<t;r++){if(n=this.shiftIdxToAtomType(n),e(this.fileContent.charCodeAt(n),n))return!0;n=this.getNextLineIdx(n)}return!1}}class qe extends Ke{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(Ye.RGP_LINE_START))).forEach((t=>{const n=this.getAtomIdxToRgpIdxList(t);for(const[t,r]of n){if(e.has(t))throw new Error(`R group ${t} is already in the map`);e.set(t,r)}}));const n=t.map(((e,t)=>{if(e.startsWith(Ye.ATOM_ALIAS_LINE_START))return t})).filter((e=>void 0!==e)),r=n.map((e=>t[e])),i=n.map((e=>t[e+1]));r.forEach(((t,n)=>{const r=parseInt(t.split(/\s+/)[1])-1,s=parseInt(i[n].substring(1));if(e.has(s))throw new Error(`R group ${s} is already in the map`);e.set(s,r)}));const s=this.getRGroupAtomicIndices().filter((t=>!Array.from(e.values()).includes(t)));if(0!==s.length)throw new Error(`Unaccounted R group indices: ${s}`);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(Ye.TYPE)&&-1!==e.indexOf(Ye.END)}shiftIdxToAtomType(e){return this.shiftIdxToSpecifiedColumn(e,Ye.ATOM_TYPE_COL)}getCountsLineIdx(){let e=0;for(let t=0;t<Ye.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,Ye.FIRST_BONDED_ATOM_COL)}shiftIdxToBondType(e){return this.shiftIdxToSpecifiedColumn(e,Ye.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+Ye.NUM_OF_COUNTS_DIGITS;const n=parseInt(this.fileContent.substring(e,t));return e=t,t+=Ye.NUM_OF_COUNTS_DIGITS,{atomCount:n,bondCount:parseInt(this.fileContent.substring(e,t))}}}class ze extends Ke{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 r=t.match(/RGROUPS=\(([\d\s]+)\)/);if(r){const t=r[1].split(/\s+/).map((e=>parseInt(e)));if(t.length>2)throw new Error(`R group data ${t} has more than 2 elements`);const i=t[1];if(e.has(i))throw new Error(`R group ${i} is already in the map`);e.set(i,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 Ze{constructor(){}static getInstance(e){if(Ze.isMolfileV2K(e))return new qe(e);if(Ze.isMolfileV3K(e))return new ze(e);throw new Error("Malformed molfile")}static isMolfileV2K(e){return qe.isValidMolfile(e)}static isMolfileV3K(e){return ze.isValidMolfile(e)}}!function(e){e.BASE="HELM_BASE",e.SUGAR="HELM_SUGAR",e.LINKER="HELM_LINKER",e.AA="HELM_AA",e.CHEM="HELM_CHEM",e.BLOB="HELM_BLOB",e.NUCLEOTIDE="HELM_NUCLETIDE"}(Be||(Be={}));var Xe=n(5488),Je={};Je.styleTagTransform=E(),Je.setAttributes=w(),Je.insert=g().bind(null,"head"),Je.domAPI=m(),Je.insertStyleElement=v(),h()(Xe.A,Je),Xe.A&&Xe.A.locals&&Xe.A.locals;class Qe{source;error;_monomers={};_onChanged=new u.Subject;_duplicateMonomers={};get duplicateMonomers(){return this._duplicateMonomers}_duplicatesHandled=!0;get duplicatesHandled(){return this._duplicatesHandled}duplicatesNotified=!1;constructor(e,t=void 0,n=void 0){this.source=t,this.error=n,this._monomers=e;for(const[e,t]of Object.entries(this._monomers))for(const[e,n]of Object.entries(t))n.lib=this}toJSON(){const e=[];for(const t of Object.values(this._monomers))for(const n of Object.values(t))e.push({...n,lib:void 0,wem:void 0});return e}addMissingMonomer(e,t){let n=this._monomers[e];n||(n=this._monomers[e]={});let r=t;return t===ce.b9[ae.Hi.HELM]?r="Gap":("PEPTIDE"===e&&"X"===t||"RNA"===e&&"N"===t)&&(r="Any"),n[t]={symbol:t,name:r,molfile:"",author:"MISSING",id:-1,rgroups:Ee().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;"RNA"==e&&"R"==n&&(n="r"),"RNA"==e&&"P"==n&&(n="p");let r=null;if(e){const t=this._monomers[e];r=t?t[n]:null}else{Ct.logger.warning(`Bio: MonomerLib.getMonomer() symbol '${t}', polymerType not specified.`);for(const[e,t]of Object.entries(this._monomers))if(r=t[n],r)break}return r}_monomerSets=null;getMonomerSet(e){const t=function(e){let t;switch(e){case Be.BASE:case Be.SUGAR:case Be.LINKER:case Be.NUCLEOTIDE:case"nucleotide":t="RNA";break;case Be.AA:t="PEPTIDE";break;case Be.CHEM:t="CHEM";break;case Be.BLOB:t="BLOB";break;default:t="PEPTIDE",console.warn(`Unexpected HelmType '${e}'`)}return t}(e);if(this._monomerSets||(this._monomerSets={}),!(e in this._monomerSets))for(const[e,n]of Object.entries(this._monomers[t]));return this._monomerSets[e]}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 r=this.getMonomerSymbolsByType(t).map((e=>this.getMonomer(t,e)));return r=r.filter((e=>null!==e)),0===r.length?[]:(r=r.filter((t=>{if(!t?.rgroups)return!1;let n=t?.rgroups.length>=e;var r;return r=Ze.getInstance(t.molfile).atomTypes,r.map(((e,t)=>"R#"===e?t:-1)).filter((e=>-1!==e)),n&&=!0,n})),r.map((e=>e?.symbol)))}get onChanged(){return this._onChanged}_updateLibInt(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]&&(this._duplicateMonomers[t]??={},this._duplicateMonomers[t][n]??=[this._monomers[t][n]],this._duplicateMonomers[t][n].push(e.getMonomer(t,n))),this._monomers[t][n]=e.getMonomer(t,n)}))}))}update(e){this._updateLibInt(e),this._onChanged.next()}updateLibs(e,t=!1){t&&(this._monomers={}),this._duplicateMonomers={};for(const t of e)t.error||this._updateLibInt(t);Object.entries(this.duplicateMonomers).length>0?(0,ve.ub)().then((e=>{this.assignDuplicatePreferances(e)})):this._duplicatesHandled=!0,this._onChanged.next()}assignDuplicatePreferances(e){let t=!0;for(const n in this.duplicateMonomers)for(const r in this.duplicateMonomers[n])if(e.duplicateMonomerPreferences?.[n]?.[r]){const i=e.duplicateMonomerPreferences[n][r],s=this.duplicateMonomers[n][r].find((e=>e.lib?.source===i));s?this._monomers[n][r]=s:t=!1}else t=!1;return this._duplicatesHandled=t,t}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,r]of Ee().enumerate(e))t[r]=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"}),r=this.getMonomer(e,t);if(r){const e=r.symbol;r.name,n.append(o.divH([o.div([e],{style:{fontWeight:"bolder",textWrap:"nowrap",marginRight:"6px"}}),o.div([r.name])],{style:{display:"flex",flexDirection:"row",justifyContent:"left"}}));const t={autoCrop:!0,autoCropMargin:0,suppressChiralText:!0};let i;i=r.molfile?s.chem.svgMol(r.molfile,void 0,void 0,t):r.smiles?o.divV([s.chem.svgMol(r.smiles,void 0,void 0,t),o.divText("from smiles",{style:{fontSize:"smaller"}})]):o.divText("No structure",{style:{margin:"6px"}}),n.append(o.div(i,{style:{display:"flex",flexDirection:"row",justifyContent:"center",margin:"6px"}})),n.append(o.divText(r.lib?.source??"Missed in libraries"))}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}}class et{monomerLib;symbol;polymerType;monomerType;monomerLinks;monomers;error=null;constructor(e,t,n,r,i){this.monomerLib=e,this.symbol=t,this.polymerType=n,this.monomerType=r,this.monomerLinks=i;try{this.monomers=this.monomerLinks.map((e=>{const n=this.monomerLib.getMonomer(this.polymerType,e.symbol);if(!n)throw new Error("Monomer not found: ");if(n.lib?.source!=e.source)throw new Error(`Monomer '${t}' found in different library.`);return n}))}catch(e){const[t,n]=(0,ge.AP)(e);this.error=t,this.monomers=[]}}}class tt{description;placeholders;source;error;constructor(e,t,n=void 0,r=void 0){this.description=e,this.placeholders=t,this.source=n,this.error=r}updateSets(e,t=!1){t&&(this.placeholders=[]);for(const t of e)t.error||this._updateSetInt(t)}_updateSetInt(e){for(const t of e.placeholders)this.placeholders.push(t)}}var nt=n(7433),rt=n.n(nt),it=n(1913),st=n.n(it);class ot{helmMonomerSchema;validateMonomerSchema;constructor(e){this.helmMonomerSchema=e;const t=new(rt())({allErrors:!0,strictTuples:!1,allowUnionTypes:!0});st()(t),this.validateMonomerSchema=t.compile(this.helmMonomerSchema)}validateFile(e,t){const n=this.parseJson(e,t);return null!==n&&(Array.isArray(n)?this.validateJsonContent(n,t):(console.warn(`Bio: Monomer Library File Validator file '${t}': Invalid JSON format: The file must contain an array of monomers.`),!1))}parseJson(e,t){try{return JSON.parse(e)}catch(e){return console.error(`Bio: Monomer Library File Validator file '${t}': Invalid JSON format:`,e),null}}validateJsonContent(e,t){let n=!0;const r=new Set;for(const i of e){const e=i.symbol??i.id??i.name??"#N/A";if(n=this.validateMonomerSchema(i),!n){console.warn(`Bio: Monomer Library File Validator file ${t}, monomer '${e}' violating JSON schema:`,i,"\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}const s=`${i.polymerType??""}-${e}`;r.has(s)&&console.warn(`Bio: Monomer Library File Validator file ${t}, monomer '${e}' is duplicated.`,"Please, verify that the monomer library file does not contain duplicated monomer symbols."),r.add(s)}return n}}class at{fileValidator;libHelper;eventManager;logger;filesPromise=Promise.resolve();constructor(e,t,n,r){this.fileValidator=e,this.libHelper=t,this.eventManager=n,this.logger=r,this.eventManager.updateValidLibraryFileListRequested$.subscribe((()=>{this.updateValidLibList().then((()=>{}))})),this.eventManager.updateValidSetFileListRequested$.subscribe((()=>{this.updateValidSetList().then((()=>{}))}))}static objCounter=-1;objId=++at.objCounter;toLog(){return`MonomerLibFileManager<${this.objId}>`}static async create(e,t,n){const r=await s.dapi.files.readAsText("System:AppData/Bio/tests/libraries/HELMmonomerSchema.json"),i=JSON.parse(r),o=new ot(i);return new at(o,e,t,n)}async addLibraryFile(e,t,n=!0){try{if(await s.dapi.files.exists(ve.so+`${t}`))return void s.shell.error(`File ${t} already exists`);await this.validateAgainstHELM(e,t),await s.dapi.files.writeAsText(ve.so+`${t}`,e),await this.updateValidLibList(),await s.dapi.files.exists(ve.so+`${t}`)?s.shell.info(`Added ${t} HELM library`):s.shell.error(`Failed to add ${t} library`)}catch(e){console.error(e),s.shell.error(`Failed to add ${t} library`)}}async deleteLibraryFile(e){try{await s.dapi.files.delete(ve.so+`${e}`),await this.updateValidLibList(),s.shell.info(`Deleted ${e} library`)}catch(t){console.error(t),await s.dapi.files.exists(ve.so+`${e}`)?s.shell.error(`Failed to delete ${e} library`):s.shell.warning(`File ${e} already deleted, refresh the list`)}}async loadLibraryFromFile(e,t){let n=[];const r=new a.FileSource(e),i=await r.readAsText(t);n=JSON.parse(i);const s={},o=[];return n.forEach((e=>{const t=e.polymerType,n=e.symbol;o.includes(t)||(s[t]={},o.push(t)),s[t][n]=e})),new Qe(s,t)}async loadSetFromFile(e,t,n){let r={};const i=new a.FileSource(t),s=await i.readAsText(n);r=JSON.parse(s);const o=r.description,c=Object.entries(r.placeholders).map((([t,n])=>{const r=t,i=n.polymerType,s=n.monomerType,o=n.set;return new et(e,r,i,s,o)}));return new tt(o,c)}getValidLibraryPaths(){return this.eventManager.getValidLibPathList()}getValidSetPaths(){return this.eventManager.getValidSetPathList()}async getValidLibraryPathsAsynchronously(){return await this.eventManager.getValidLibraryPathsAsynchronously()}async updateValidLibList(){const e=`${this.toLog()}.updateValidLibList()`;return this.logger.debug(`${e}, start`),this.filesPromise=this.filesPromise.then((async()=>{this.logger.debug(`${e}, IN`);const t=[],n=await this.getLibFileListAtLocation();if(!this.libListHasChanged(n))return void this.logger.debug(`${e}, end, not changed`);for(const e of n){if(!e.endsWith(".json")){t.push(e);continue}const n=await s.dapi.files.readAsText(ve.so+`${e}`);this.isValidHELMLibrary(n,e)||t.push(e)}const r=n.filter((e=>!t.includes(e)));if(this.libListHasChanged(r)&&(this.eventManager.changeValidLibPathList(r),this.libHelper.loadMonomerLib(!0)),r.some((e=>!e.endsWith(".json")))&&this.logger.warning(`Wrong validation: ${r}`),t.length>0){const e=`Invalid monomer library files in ${ve.so}, consider fixing or removing them: ${t.join(", ")}`;this.logger.warning(e)}this.logger.debug(`${e}, OUT`)})),this.logger.debug(`${e}, end`),this.filesPromise}async updateValidSetList(){const e=`${this.toLog()}.updateValidSetList()`;return Ct.logger.debug(`${e}, start`),this.filesPromise=this.filesPromise.then((async()=>{Ct.logger.debug(`${e}, IN`);const t=[],n=await this.getSetFileListAtLocation();if(!this.setListHasChanged(n))return void Ct.logger.debug(`${e}, end, not changed`);for(const e of n)e.endsWith(".json")?await s.dapi.files.readAsText(ve.Es+`${e}`):t.push(e);const r=n.filter((e=>!t.includes(e)));this.setListHasChanged(r)&&(this.eventManager.changeValidSetPathList(r),this.libHelper.loadMonomerSets(!0)),Ct.logger.debug(`${e}, OUT`)})),Ct.logger.debug(`${e}, end`),this.filesPromise}libListHasChanged(e){const t=this.eventManager.getValidLibPathList();return e.length!==t.length||e.some(((e,n)=>e!==t[n]))}setListHasChanged(e){const t=this.eventManager.getValidSetPathList();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 getLibFileListAtLocation(){const e=`${this.toLog()}.getLibFileListAtLocation()`;this.logger.debug(`${e}, start`);const t=await s.dapi.files.list(ve.so).then((e=>e.map((e=>e.fullPath)))),n=[];return n.push(...t),n.map((e=>e.substring(ve.so.length)))}async getSetFileListAtLocation(){const e=`${this.toLog()}.getSetFileListAtLocation()`;this.logger.debug(`${e}, start`);const t=await s.dapi.files.list(ve.Es).then((e=>e.map((e=>e.fullPath)))),n=[];return n.push(...t),n.map((e=>e.substring(ve.Es.length)))}}class ct{constructor(){}static _instance;static getInstance(){return ct._instance||(ct._instance=new ct),ct._instance}_libFilesUpdateSubject$=new u.BehaviorSubject([]);_setFilesUpdateSubject$=new u.BehaviorSubject([]);_addLibraryFilesSubject$=new u.Subject;_librarySelectionSubject$=new u.Subject;getValidLibPathList(){return this._libFilesUpdateSubject$.getValue()}getValidSetPathList(){return this._setFilesUpdateSubject$.getValue()}async getValidLibraryPathsAsynchronously(){return new Promise((e=>{const t=this._libFilesUpdateSubject$.pipe((0,M.skip)(1)).subscribe((n=>{e(n),t.unsubscribe()}))}))}changeValidLibPathList(e){this._libFilesUpdateSubject$.next(e)}changeValidSetPathList(e){this._setFilesUpdateSubject$.next(e)}get updateUIControlsRequested$(){return this._libFilesUpdateSubject$.pipe()}get updateValidLibraryFileListRequested$(){return this._libFilesUpdateSubject$.pipe()}get updateValidSetFileListRequested$(){return this._setFilesUpdateSubject$.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 lt{logger;_monomerLib=new Qe({},"MAIN");_monomerSets=new tt("MAIN",[]);_eventManager;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,Ge.cb)(e),!1))()]).then((t=>{if(!t)throw new Error(`Loading monomer libraries is timeout ${e} ms.`)}))}constructor(e){this.logger=e}static objCounter=-1;objId=(()=>{if(++lt.objCounter>0)throw new Error("MonomerLibManager MUST be a singleton.");return lt.objCounter})();toLog(){return`MonomerLibManager<${this.objId}>`}getMonomerLib(){return this._monomerLib}getBioLib(){return this.getMonomerLib()}getMonomerSets(){return this._monomerSets}get duplicateMonomers(){return this._monomerLib.duplicateMonomers}get duplicatesHandled(){return this._monomerLib.duplicatesHandled}assignDuplicatePreferances(e){this._monomerLib.assignDuplicatePreferances(e)}_fileManagerPromise;async getFileManager(){return void 0===this._fileManagerPromise&&(this._fileManagerPromise=(async()=>await at.create(this,this._eventManager,this.logger))()),this._fileManagerPromise}loadLibrariesPromise=Promise.resolve();async loadMonomerLib(e=!1){const t=`${this.toLog()}.loadMonomerLib()`;return this.logger.debug(`${t}, start`),this.loadLibrariesPromise=this.loadLibrariesPromise.then((async()=>{this.logger.debug(`${t}, IN`);const n=a.TaskBarProgressIndicator.create("Loading monomers ...");try{const[[t],r]=await Promise.all([await this.getFileManager().then((e=>[e.getValidLibraryPaths()])),(0,ve.ub)()]),i=t.filter((e=>{const t=!r.exclude.includes(e),n=0===r.explicit.length||r.explicit.includes(e);return t&&n}));let s=0;const o=i.length,[a]=await Promise.all([Promise.all(i.map((e=>this.readLibrary(ve.so,e).catch((t=>{const n=`Loading monomers from '${e}' error: ${t instanceof Error?t.message:t.toString()}`;return new Qe({},e,n)})).finally((()=>{n.update(Math.round(100*++s/o),`Loading monomers ${s}/${o}`)})))))]);this._monomerLib.updateLibs(a,e)}catch(e){const t=`Loading monomer libraries error: ${e instanceof Error?e.message:e.toString()}`;s.shell.warning(t);const n=e instanceof Error?e.stack:void 0;this.logger.error(t,void 0,n)}finally{n.close(),this.logger.debug(`${t}, OUT`)}})),this.logger.debug(`${t}, end`),this.loadLibrariesPromise}async loadLibraries(e){return this.loadMonomerLib(e)}loadSetsPromise=Promise.resolve();async loadMonomerSets(e=!1){const t=`${this.toLog()}.loadMonomerSets()`;return this.logger.debug(`${t}, start`),this.loadSetsPromise=this.loadSetsPromise.then((async()=>{this.logger.debug(`${t}, IN`);const e=a.TaskBarProgressIndicator.create("Loading monomer sets ...");try{const[[t]]=await Promise.all([await this.getFileManager().then((e=>[e.getValidSetPaths()]))]),n=t.filter((e=>!0));let r=0;const i=n.length,[s]=await Promise.all([Promise.all(n.map((t=>this.readSet(ve.Es,t).catch((e=>{const n=`Loading monomer sets from '${t}' error: ${e instanceof Error?e.message:e.toString()}`;return new tt("Broken monomer set",[],t,n)})).finally((()=>{e.update(Math.round(100*++r/i),`Loading monomers ${r}/${i}`)})))))]);this._monomerSets.updateSets(s)}catch(e){const t=`Loading monomer sets error: ${e instanceof Error?e.message:e.toString()}`;s.shell.warning(t);const n=e instanceof Error?e.stack:void 0;this.logger.error(t,void 0,n)}finally{e.close(),this.logger.debug(`${t}, OUT`)}})),this.logger.debug(`${t}, end`),this.loadSetsPromise}async readLibrary(e,t){const n=await this.getFileManager();return await n.loadLibraryFromFile(e,t)}async readSet(e,t){const n=await this.getFileManager();return await n.loadSetFromFile(this._monomerLib,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,ve.ub)();n.exclude=(await this.getFileManager()).getValidLibraryPaths().filter((t=>!e.includes(t))),await(0,ve.Eu)(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 null==e&&(e=window.$monomerLibHelperPromise=(async()=>{const e=new lt(Ct.logger);return e._eventManager=ct.getInstance(),e})()),e}}n(1757);var ut=n(3017),dt={};dt.styleTagTransform=E(),dt.setAttributes=w(),dt.insert=g().bind(null,"head"),dt.domAPI=m(),dt.insertStyleElement=v(),h()(ut.A,dt),ut.A&&ut.A.locals&&ut.A.locals,n(3151);new O.A(new Uint32Array([2,0,0,0,16,0,0,0,134217728,0,0,0,32,0,33554432,0,0,0,0,0,1024,0,0,0,262144,128,0,0,0,0,0,0,0,2,0,0,524288,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1048576,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,32,0,0,2,0,32,0,0,0,0,0,0,0,1024,0,0,0,262144,128,0,0,0,0,0,0,0,65536,0,0,524288,0,0,0,0,0,0,0,524288,524288,0,0,0,0,0,0,0,0,0,0,0,34603008,0,536870912,64,0,0,0]),2048),new O.A(new Uint32Array([2,0,65600,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,1024,0,0,0,262400,128,0,0,0,0,0,0,0,0,0,2097152,524288,0,0,0,1024,0,0,0,524288,0,0,0,0,0,0,0,0,0,512,0,0,34603008,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,1024,0,0,8,262144,128,0,0,16,134217728,0,0,0,0,0,0,524288,0,0,0,128,0,0,0,524288,0,0,0,268435456,0,0,0,0,0,512,2147483648,0,34603008,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,98304,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,1024,0,0,0,262144,128,33554432,0,0,0,0,33554432,0,1024,1,0,524288,32768,32,0,0,0,0,16,524288,0,0,0,0,0,0,0,0,0,71303168,0,0,34603008,131072,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([134217728,0,65536,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,1024,0,0,0,0,128,0,0,0,0,2097216,0,0,0,0,0,524288,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,512,0,0,0,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,1073840128,0,0,0,0,0,0,0,0,67108864,32,0,0,0,0,0,0,0,1024,0,512,0,262144,192,0,268435456,0,0,8200,0,0,0,67108864,0,524296,0,32,0,0,0,0,16,524288,0,0,2147483648,0,0,8,0,0,0,0,0,0,34603008,131072,536870920,4194304,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,0,150994944,64,0,0,32,0,0,0,0,0,0,0,1024,0,8388608,0,327680,128,0,0,0,0,0,0,0,2,0,524288,524288,0,0,0,0,0,0,0,0,0,0,0,256,0,0,0,0,8388608,0,33554432,0,1048576,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,0,0,0,0,0,268435488,0,0,0,0,0,0,0,1024,0,0,8,262144,128,0,0,0,0,2097152,0,0,67108864,0,0,524288,0,0,0,8,0,0,0,524288,0,0,8192,0,0,0,0,0,0,0,2147483648,0,34668544,0,545259520,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,0,134217728,0,0,0,32,512,0,0,0,0,0,0,1024,256,0,8388608,262400,128,0,0,0,0,0,0,0,2,0,0,524288,0,0,0,0,0,0,0,524288,0,0,0,0,0,0,0,0,0,0,0,0,42991616,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2050,0,65536,1048576,0,0,0,0,0,0,0,0,1056,0,0,0,0,0,0,0,1024,0,0,8,262144,128,0,0,0,0,0,536870912,0,2,0,0,1074266112,0,0,0,0,0,0,0,524288,0,0,0,4194304,0,0,0,0,0,0,2147483648,0,34603008,0,536870912,4194304,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,4096,0,0,0,0,0,0,16777216,32,0,0,0,0,0,0,0,1024,0,0,0,262400,128,0,0,0,0,0,0,0,0,0,0,524288,0,0,0,1024,0,0,0,524288,0,0,0,0,0,0,0,0,0,0,0,0,34603008,0,536871936,67108864,0,0,0]),2048),new O.A(new Uint32Array([0,0,1024,0,0,0,0,0,0,131072,0,1024,32,0,0,0,0,512,0,0,1024,0,0,64,0,128,0,0,1073741824,0,0,138412032,16,0,67108864,0,0,0,0,0,0,8192,0,0,8388608,0,0,8,0,0,0,0,0,0,256,0,0,0,0,553648128,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,4096,0,0,0,0,0,0,0,32,0,0,0,0,2,0,0,1024,0,0,8,262144,128,0,0,16,0,0,0,0,0,0,0,524288,0,0,0,0,0,0,0,524288,0,0,0,268435456,0,0,0,0,0,16777216,2147483648,0,34603008,0,536871936,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,4096,0,32,0,0,0,0,0,268435488,0,0,0,0,0,0,32768,134218752,0,16,8,262144,128,0,1073741824,0,0,8388608,0,0,0,65536,0,524289,0,0,0,0,0,0,0,524288,2048,0,0,0,0,0,0,0,0,0,2147483648,0,34603008,1048576,545259520,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,1073741824,0,0,0,0,0,32,0,0,4,0,0,0,0,1024,0,0,0,262144,128,0,0,0,0,0,0,0,0,0,0,524288,0,0,1048576,0,0,0,0,524288,0,0,0,0,0,0,0,0,0,8388608,0,0,34603008,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,0,0,0,0,0,8,134217728,0,0,67108864,32,0,0,0,0,0,0,0,1024,0,8388608,0,262144,128,0,0,0,0,0,0,0,2,0,524288,524288,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,536870912,0,0,0,0,1048576,67108864,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,0,0,0,0,0,0,134217728,0,0,0,32,0,0,0,0,0,0,0,1024,0,8388608,0,262144,128,0,0,0,0,0,1073741824,128,2,0,524288,524288,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8192,0,1048576,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,98304,8388608,0,0,0,0,0,0,256,4096,32,0,0,0,0,0,0,0,1024,0,0,0,262144,192,0,0,0,0,0,0,0,0,67108865,0,524288,32768,32,0,0,0,8224,16,524288,0,0,0,0,32,128,0,2097152,0,4194304,8388608,0,34603008,8519680,536870912,131072,262144,0,0]),2048),new O.A(new Uint32Array([2,0,98304,0,0,0,0,0,0,4194304,0,0,32,0,0,0,0,0,0,0,1024,0,0,512,262144,128,33554432,0,0,0,0,33554432,0,0,0,0,524288,0,32,0,0,2,0,16,524288,0,0,0,0,0,4,0,0,0,71303168,262144,0,34603008,131072,536870912,0,0,0,0]),2048);new O.A(new Uint32Array([0,0,0,0,0,0,0,0,0,1024,0,67108864,0,0,0,512,0,0,0,8388608,0,0,512,0,0,64,4,0,0,0,4,0,0,0,67108864,0,524289,0,0,0,0,0,0,16,0,659456,0,256,0,16,0,0,0,268435456,0,0,262144,0,131072,0,0,0,8388608,0]),2048),new O.A(new Uint32Array([0,1073741824,0,0,0,0,0,2147483648,4,67108864,0,67108864,0,256,0,0,0,0,0,0,1024,0,128,0,0,64,0,0,0,0,0,0,0,0,67108864,0,524289,0,65536,0,0,0,0,16,0,131072,0,4,0,0,0,0,0,0,4194304,0,0,2147483648,131072,0,4096,0,0,0]),2048),new O.A(new Uint32Array([0,0,0,0,1024,0,0,0,0,67109888,16384,67108864,0,0,0,0,0,0,0,33562624,1024,33554432,512,16384,0,64,4,0,0,33554432,0,0,0,0,67108864,0,524289,0,0,0,0,0,0,16,0,135168,0,268435456,0,0,0,0,0,268435456,131072,0,0,2147483648,131072,0,0,0,8388608,0]),2048),new O.A(new Uint32Array([8388608,0,0,0,0,0,0,0,0,67108864,0,0,0,4,0,0,0,0,0,0,1024,0,0,16384,0,64,0,0,0,0,0,0,0,2,67108864,0,0,0,0,0,0,0,0,40976,0,0,0,0,0,0,0,0,0,67108864,131072,524288,0,0,8519680,0,1,33554432,1048576,0]),2048),new O.A(new Uint32Array([0,0,131072,1073741824,0,0,0,0,0,67108864,0,0,0,0,0,0,0,0,0,0,1024,0,128,0,0,64,0,0,0,0,0,0,0,32768,67108864,0,0,0,0,0,0,0,0,16,0,0,0,4,0,0,2048,0,0,0,4341760,0,0,0,131072,0,0,33554432,1048576,0]),2048);var ht,pt=n(857),mt={};mt.styleTagTransform=E(),mt.setAttributes=w(),mt.insert=g().bind(null,"head"),mt.domAPI=m(),mt.insertStyleElement=v(),h()(pt.A,mt),pt.A&&pt.A.locals&&pt.A.locals,function(e){e.MONOMER="Monomer",e.SYMBOL="Symbol",e.NAME="Name",e.R_GROUPS="~R-Groups",e.MONOMER_TYPE="Monomer Type",e.POLYMER_TYPE="Polymer Type",e.NATURAL_ANALOG="Natural Analog",e.AUTHOR="Author",e.CREATE_DATE="Create Date",e.ID="ID",e.META="Meta",e.SOURCE="Source"}(ht||(ht={})),ht.MONOMER,a.COLUMN_TYPE.STRING,ht.SYMBOL,a.COLUMN_TYPE.STRING,ht.NAME,a.COLUMN_TYPE.STRING,ht.R_GROUPS,a.COLUMN_TYPE.STRING,ht.MONOMER_TYPE,a.COLUMN_TYPE.STRING,ht.POLYMER_TYPE,a.COLUMN_TYPE.STRING,ht.NATURAL_ANALOG,a.COLUMN_TYPE.STRING,ht.AUTHOR,a.COLUMN_TYPE.STRING,ht.CREATE_DATE,a.COLUMN_TYPE.DATE_TIME,ht.ID,a.COLUMN_TYPE.INT,ht.META,a.COLUMN_TYPE.STRING,ht.SOURCE,a.COLUMN_TYPE.STRING;var ft,gt=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};class yt{constructor(e,t,n=!1,r){var i;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"),(()=>gt(this,void 0,void 0,(function*(){return yield this._changeStopState()}))),"Play / pause"),this._restartBtn=o.button(o.iconFA("redo"),(()=>gt(this,void 0,void 0,(function*(){return yield this._restartScript()}))),"Restart"),this._nextStepBtn=o.button(o.iconFA("play"),(()=>gt(this,void 0,void 0,(function*(){this._isStepProcessed||(yield 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!==(i=null==r?void 0:r.autoStartFirstStep)&&void 0!==i&&i,this._progress.max=0,this._progress.value=1,yt.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 r=o.div(this._steps[t].name,"grok-tutorial-entry-instruction"),i=o.div(null===(e=this._steps[t].options)||void 0===e?void 0:e.description,"grok-tutorial-step-description hidden"),s=o.divH([n,r],"grok-tutorial-entry");this._activity.append(s,i)}}_initRoot(){var e,t,n;s.shell.windows.showContextPanel=!0,s.shell.windows.showHelp=!1;const r=s.shell.isInDemo?Array.from(s.shell.view("Browse").dockManager.rootNode.children)[0]:Array.from(s.shell.dockManager.rootNode.children)[0];this._node=s.shell.dockManager.dock(this._root,a.DOCK_TYPE.FILL,r,""),(null===(t=null===(e=r.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=r.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 gt(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],r=this._activity.getElementsByClassName("grok-icon")[this._currentStep],i=this._activity.getElementsByClassName("grok-tutorial-step-description")[this._currentStep];r.className="grok-icon far fa-spinner-third fa-spin",i.classList.remove("hidden"),i.classList.add("visible");const c=n,l=(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;try{yield this._steps[this._currentStep].func()}catch(e){s.shell.isInDemo=!1,console.error(e)}this._scrollTo(this._root,c.offsetTop-this._mainHeader.offsetHeight),this._isAutomatic&&(yield this._countdown(n,r,l),yield(0,Ge.cb)(l));const u=o.iconFA("check");if(r.replaceWith(u),u.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")}if(s.shell.isInDemo){const e=s.shell.view("Browse");(null==e?void 0:e.preview)instanceof a.TableView&&(yield s.data.detectSemanticTypes(e.preview.dataFrame))}}else this._isAutomatic?this._stopStartBtn.replaceWith(this._restartBtn):this._nextStepBtn.replaceWith(this._restartBtn)}))}_startScript(){return gt(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 gt(this,void 0,void 0,(function*(){const r=o.div([],"demo-script-countdown");t.classList.add("hidden");let i=n/1e3;const s=this._createSVGIndicator(i);r.append(s),e.prepend(r);const a=setInterval((()=>{i--,0===i&&(clearInterval(a),r.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(){return gt(this,void 0,void 0,(function*(){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||(yield this._startScript()))}))}_restartScript(){return gt(this,void 0,void 0,(function*(){s.shell.dockManager.close(this._node),this._clearRoot(),this._setInitParams(),yield 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(){s.shell.dockManager.close(this._node),this.cancelScript()}cancelScript(){this._isCancelled=!0,yt.currentObject=null,s.shell.isInDemo=!1}step(e,t,n){return this._steps[this.steps.length]={name:e,func:t,options:n},this}start(){return gt(this,void 0,void 0,(function*(){this._initRoot(),s.shell.newView(this.name),this._isAutomatic?yield this._startScript():this._autoStartFirstStep&&(yield this._nextStep())}))}}yt.currentObject=null,function(e){e.X="Embed_X",e.Y="Embed_Y"}(ft||(ft={})),n(8152);var wt=n(966);n(608),n(1619),n(5785),new class{tooltipHandlerTemp="tooltip-handler.Monomer"},a.GridCellRenderer;class bt{constructor(e,t,n=""){this.target=e,this.debugEnabled=t,this.prefix=n}error(e,t,n){return this.target.error(this.prefix+e,t,n)}warning(e,t){return this.target.warning(this.prefix+e,t)}info(e,t){return this.target.info(this.prefix+e,t)}debug(e,t){if(this.debugEnabled)return this.target.debug(this.prefix+e,t)}}Map;class vt extends a.Package{_properties;_rdKitModule;get rdKitModule(){return this._rdKitModule}get properties(){return this._properties}set properties(e){this._properties=e}_initialized=!1;get initialized(){return this._initialized}constructor(e={debug:!1}){super(),super._logger=new bt(super.logger,e.debug)}completeInit(e){this._rdKitModule=e,this._initialized=!0}handleErrorUI(e){const[t,n]=(0,ge.AP)(e);s.shell.error(t),this.logger.error(t,void 0,n)}}n(2174),a.Widget,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(ae.z1);var At=n(8754);async function Et(e,t,n,r){const i=await async function(e,t,n,r){const i=(0,he.R)(t),s=ce.GO.forColumn(t).getNewColumnFromList("ref",[n]),o=ce.GO.forColumn(s).getSplitted(0),c=r===oe.IDENTITY?function(e,t){const n=t.columns.length,r=new Array(n),i=new Array(n),s=new Array(n);for(let o=0;o<n;++o){const n=t.columns.byIndex(o);r[o]=n.getRawData(),i[o]=n.categories.indexOf("");const a=o<e.length?e.getOriginal(o):de._S;s[o]=n.categories.indexOf(a)}const o=a.Column.float("Identity",t.rowCount),c=o.getRawData();for(let n=0;n<t.rowCount;++n){c[n]=0;for(let t=0;t<e.length;++t)(r[t]?r[t][n]:0)===s[t]&&++c[n];c[n]/=e.length}return o}(o,i):r===oe.SIMILARITY?await async function(e,t){const n=t.columns.toList();return await(0,ue.uL)(n,e)}(o,i):null;if(null===c)throw new Error(`In bio library: Unknown sequence scoring method: ${r}`);return c.name=e.columns.getUnusedName(c.name),e.columns.add(c),c}(e,t,n,r);for(let e=0;e<i.length;e++)t.isNone(e)&&i.set(e,null,!1);return i}Ce.Mu,n(8312),n(9124),OCL,n(6956);const Ct=new vt;async function Tt(){return await lt.getInstance()}let St=null;function _t(){return St}async function xt(e,t,n,r,i,u,d,h,p){if(!(0,wt.V)(t,"Activity Cliffs"))return;const m=we(e),f={units:t.meta.units,aligned:t.getTag(ae.gp.aligned),separator:t.getTag(ae.gp.separator),alphabet:t.getTag(ae.gp.alphabet)},g=u,y=t,w=async()=>await se(e,y,m,"Activity cliffs",n,r,g,i,{...h??{}},a.SEMTYPE.MACROMOLECULE,f,d,De,Fe,Ve,void 0,p),b=i===l.c.UMAP?2e5:2e4,v=i===l.c.UMAP?5e3:2e3;if(e.rowCount>b)return void s.shell.warning(`Too many rows, maximum for sequence activity cliffs is ${b}`);const A=a.TaskBarProgressIndicator.create("Running sequence activity cliffs ...");return new Promise(((t,n)=>{e.rowCount>v&&!h?.[c.vb]?o.dialog().add(o.divText("Activity cliffs analysis might take several minutes.\n Do you want to continue?")).onOK((async()=>{w().then((e=>t(e))).catch((e=>n(e)))})).onCancel((()=>{t(void 0)})).show():w().then((e=>t(e))).catch((e=>n(e)))})).catch((e=>{const[t,n]=(0,ge.AP)(e);throw Ct.logger.error(t,void 0,n),e})).finally((()=>{A.close()}))}async function Pt(e,t,r,i,l,u,d,h,p){const m=p?s.shell.view("Browse").preview:s.shell.tv.dataFrame==e?s.shell.tv:void 0;if((0,wt.V)(t,"Sequence Space"))return u||(u=a.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0]),d??={},await async function(e,t,r,i,l,u,d,h=!0,p=!1,m={preprocessingFuncArgs:[]},f={},g=null,y={}){const w={showXAxis:!1,showYAxis:!1,showXSelector:!1,showYSelector:!1};if(t.length!==i.length||t.length!==u.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 b=h?f.tableView??s.shell.tableView(e.name)??s.shell.addTableView(e):null,v=async()=>{const v=a.TaskBarProgressIndicator.create(`Initializing ${f.scatterPlotName??"dimensionality reduction"} ...`);let A;try{const E=we(e);function C(n,i,s){let l=null,u=null;e.columns.names().includes(E[0])?(l=e.columns.byName(E[0]),u=e.columns.byName(E[1])):(l=e.columns.add(a.Column.float(E[0],e.rowCount)),u=e.columns.add(a.Column.float(E[1],e.rowCount)),h&&!A&&(A=b.scatterPlot({...w,x:E[0],y:E[1],title:f.scatterPlotName??be(t,r)}))),f[c.YP]&&(A?.root&&o.setUpdateIndicator(A.root,!1),l.init((e=>s[0]?s[0][e]:void 0)),u.init((e=>s[1]?s[1][e]:void 0)));const d=n/i*100;v.update(d,`Running ${f.scatterPlotName??"dimensionality reduction"}... ${d.toFixed(0)}%`)}async function T(){e.columns.add(a.Column.float(E[0],e.rowCount)),e.columns.add(a.Column.float(E[1],e.rowCount));let n=null;h&&(A=b.scatterPlot({...w,x:E[0],y:E[1],title:f.scatterPlotName??be(t,r)}),o.setUpdateIndicator(A.root,!0));const p=s.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&&(s.events.fireCustomEvent(G,{}),p.unsubscribe(),n?.(),v.close())})),g=new Promise((async(e,s)=>{try{n=e;const s=[];for(let e=0;e<u.length;++e){const n=u[e];if(m.distanceFnArgs||(m.distanceFnArgs=[]),n){const r=n.inputs[0].name,o=n.inputs[1].name,{entries:a,options:c}=await n.apply({[r]:t[e],[o]:i[e],...m.preprocessingFuncArgs[e]??{}});s.push({entries:a,options:c}),m.distanceFnArgs.push(c)}else{const n=t[e].toList(),r={};s.push({entries:n,options:r}),m.distanceFnArgs.push(r)}}e(await U(s.map((e=>e.entries)),r,i,l,d,m,f[c.vb]?void 0:C))}catch(e){s(e)}})),y=await g;return v.close(),p.unsubscribe(),y}const S=await T();if(p&&S){const _=a.TaskBarProgressIndicator.create("Clustering embeddings ...");try{const x=await function(e,t,r,i){return ye(this,void 0,void 0,(function*(){return new Promise((function(s,o){const a=new Worker(new URL(n.p+n.u(682),n.b));a.postMessage({embedX:e,embedY:t,minPts:i,epsilon:r}),a.onmessage=({data:{error:e,clusters:t}})=>{a.terminate(),e?o(e):s(t)}}))}))}(S[0],S[1],m.dbScanEpsilon??.01,m.dbScanMinPts??4),P=e.columns.getUnusedName("Cluster (DBSCAN)");e.columns.addNewString(P).init((e=>x[e].toString())),A&&(A.props.colorColumnName=P)}catch(M){s.shell.error("Clustering embeddings failed"),console.error(M)}finally{_.close()}}if(S){const $=e.columns.byName(E[0]),N=e.columns.byName(E[1]);if($.init((e=>S[0][e])),N.init((e=>S[1][e])),g)try{const L=g.inputs[0].name,I=g.inputs[1].name;await g.prepare({[L]:$,[I]:N,...y}).call(!0)}catch(R){s.shell.error("Post-processing failed"),console.error(R)}if(A)return o.setUpdateIndicator(A.root,!1),A.helpUrl="/help/compute/sequence-space",A}}catch(O){s.shell.error("Dimensionality reduction failed"),console.error(O),v.close(),A&&o.setUpdateIndicator(A.root,!1)}};return new Promise((async(t,n)=>{try{if(f.fastRowCount&&e.rowCount>f.fastRowCount&&!f[c.vb])o.dialog().add(o.divText("Analysis might take several minutes. Do you want to continue?")).onOK((async()=>{try{const e=await v();t(e)}catch(e){n(e)}})).onCancel((()=>t(void 0))).show();else{const e=await v();t(e)}}catch(e){n(e)}}))}(e,[t],r,[i],[1],[u],"MANHATTAN",l,h??!1,{...d,preprocessingFuncArgs:[d.preprocessingFuncArgs??{}]},{fastRowCount:1e4,scatterPlotName:"Sequence space",bypassLargeDataWarning:d?.[c.vb],tableView:m})}async function Mt(e,t,n){const r=a.TaskBarProgressIndicator.create("Converting to atomic level ...");try{const r=(await Tt()).getMonomerLib();await(0,At.V)(e,t,n,r)}finally{r.close()}}function $t(e){return new le.m(e).importFasta()}function Nt(e){const t=ce.GO.forColumn(e).stats;return Object.keys(t.freq)}async function Lt(e,t,n){return Et(e,t,n,oe.IDENTITY)}async function It(e,t,n){return Et(e,t,n,oe.SIMILARITY)}},8115:(e,t,n)=>{"use strict";n.d(t,{if:()=>l,nI:()=>c});var r=n(4328),i=(n(7389),n(6082)),s=n(1407),o=(n(4870),n(8070)),a=n(2003);function c(e,t,n){const r=n?function(e,t){const n=`${t}`.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),r=e.charAt(0)===t,i=e.charAt(e.length-1)===t,s=e.replace(new RegExp(`^${n}|${n}$`,"g"),"");return r?i?`${n}${s}${n}`:`${n}${s}${n}|${n}${s}$`:i?`^${s}${n}|${n}${s}${n}`:`^${s}${n}|${n}${s}${n}|${n}${s}$`}(e,n):e,s=i.BitSet.create(t.length);for(let n=0;n<t.length;n++){const i=t.get(n);(i.match(r)||i===e)&&s.set(n,!0,!1)}return s}async function l(e,t){t.version!==t.temp["last-invalidated-version"]&&await async function(e){const t=i.TaskBarProgressIndicator.create(`Invalidating molfiles for ${e.name}`);try{await(0,o.cb)(10);const t=new Map,n=await(0,s.R)(e,!0,t);e.temp["monomeric-mols"]=n,e.temp["monomers-dict"]=t,e.temp["last-invalidated-version"]=e.version}finally{t.close()}}(t);const n=i.Column.string("helm",1).init((t=>e));n.semType=i.SEMTYPE.MACROMOLECULE,n.meta.units=a.Hi.HELM;const c=await(0,s.R)(n,!0,t.temp["monomers-dict"]);return(await r.functions.call("Chem:searchSubstructure",{molStringsColumn:t.temp["monomeric-mols"],molString:c.get(0),molBlockFailover:""})).get(0)}},966:(e,t,n)=>{"use strict";n.d(t,{V:()=>o,l:()=>a});var r=n(4328),i=n(6082),s=n(826);function o(e,t,n=[],i=[],s=!0){const[o,c]=a(e,t,n,i);return s&&!o&&r.shell.warning(c),o}function a(e,t,n=[],o=[]){let a=!0,c="";const l=s.GO.forColumn(e);if(e.semType!==i.SEMTYPE.MACROMOLECULE)r.shell.warning(t+" analysis is allowed for Macromolecules semantic type"),a=!1;else{const e=l.notation;if(n.length>0&&!n.some((t=>e.toUpperCase()==t.toUpperCase())))c=`${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(!l.isHelm()){const e=l.alphabet;o.length>0&&!o.some((t=>e.toUpperCase()==t.toUpperCase()))&&(c=`${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,c]}},4139:(e,t,n)=>{"use strict";n.d(t,{HX:()=>d,J:()=>l,b9:()=>u,gN:()=>a,uF:()=>s});var r,i,s,o=n(8152);!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"}(r||(r={})),function(e){e.AAR="AAR",e.POSITION="Pos",e.SELECTION="selection"}(i||(i={})),function(e){e.MONOMER="Monomer",e.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference",e.ACTIVITY="activity",e.ACTIVITY_SCALED="activityScaled"}(s||(s={}));const a="MSA";var c,l;!function(e){e.CELL_CHANGING="isCellChanging"}(c||(c={})),function(e){e.SEPARATOR="."}(l||(l={}));const u="3.3.1",d={pepsea:{gapOpen:1.53,gapExtend:0,method:o.ZY[0]},kalign:{gapOpen:-1,gapExtend:-1,terminalGap:-1}}},5433:(e,t,n)=>{"use strict";n.d(t,{r:()=>s}),n(6082),n(7389);var r=n(4328),i=(n(1757),n(2003),n(826));async function s(e,t,n){const s=i.GO.forColumn(e).convert(t,n);e.dataFrame.columns.add(s);const o=await r.functions.call("Bio:detectMacromolecule",{col:s});return o&&(s.semType=o),await r.data.detectSemanticTypes(e.dataFrame),s}},6740:(e,t,n)=>{"use strict";n.d(t,{m8:()=>o});var r=n(4328),i=n(8070),s=n(8152);async function o(e=6e4){const t=await s.Nk.getDockerContainer();await async function(e,t=6e4){let n=e,s=!1;for(let o=0;o<t/200;++o){if(null===n&&(n=await r.dapi.docker.dockerContainers.find(e.id)),a(n)){s=!0;break}switch(n.status){case"stopped":await r.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,i.cb)(200)}if(!s)throw new Error("Docker container start timeout.")}(t,e)}function a(e){return"checking"===e.status||"started"===e.status}},6956:(e,t,n)=>{"use strict";n.d(t,{mP:()=>r});const r="H"},1619:(e,t,n)=>{"use strict";n.d(t,{D:()=>M});var r=n(4328),i=n(6082),s=n(7389),o=n(8070),a=n(2003),c=n(826),l=n(608),u=n(8152),d=n(966),h=n(4139),p=n(6740),m=n(567),f=n(5072),g=n.n(f),y=n(7825),w=n.n(y),b=n(7659),v=n.n(b),A=n(5056),E=n.n(A),C=n(540),T=n.n(C),S=n(1113),_=n.n(S),x=n(6369),P={};async function M(e={}){return new Promise((async(t,n)=>{e.clustersCol??=null,e.pepsea??={},e.pepsea.method??=h.HX.pepsea.method,e.pepsea.gapOpen??=h.HX.pepsea.gapOpen,e.pepsea.gapExtend??=h.HX.pepsea.gapExtend;const a=e.col?.dataFrame??r.shell.t,c=e.col??a.columns.bySemType(i.SEMTYPE.MACROMOLECULE);if(null==c){const e="Multiple Sequence Alignment analysis requires a dataset with a macromolecule column.";return r.shell.warning(e),void n(new l.Ap(s.divText(e)))}const d=s.input.choice("Method",{value:e.pepsea.method,items:u.ZY});d.setTooltip("Alignment method");const p=s.input.float("Terminal gap",{value:e?.kalign?.terminalGap});p.setTooltip("Penalty for opening a gap at the beginning or end of the sequence");const m=s.p(`Kalign version: ${h.b9}`,"kalign-version"),f=s.input.float("Gap open",{value:e.pepsea.gapOpen});f.setTooltip("Gap opening penalty at group-to-group alignment");const g=s.input.float("Gap extend",{value:e.pepsea.gapExtend});g.setTooltip("Gap extension penalty to skip the alignment");const y=s.inputs([f,g,p]),w=s.button("Alignment parameters",(()=>{y.hidden=!y.hidden,[f,g,p].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");w.classList.add("msa-params-button"),y.hidden=!0,w.prepend(s.icons.settings((()=>null)));const b=[d.root.style],v=[p.root.style,m.style];let A,E=c;const C=s.input.column("Sequence",{table:a,value:c,onValueChanged:async e=>{if(!e||e.semType!==i.SEMTYPE.MACROMOLECULE)return _.disabled=!0,await(0,o.cb)(0),void(C.value=E);E=e,_.disabled=!1,A=await N(C.value,a,b,v,d,T,f,g,p)},filter:e=>e.semType===i.SEMTYPE.MACROMOLECULE});C.setTooltip("Sequences column to use for alignment");const T=s.input.column("Clusters",{table:a,value:e.clustersCol});T.nullable=!0;const S=s.dialog("MSA").add(C).add(T).add(d).add(y).add(w).add(m).onOK((async()=>{await $(C,a,A,t,n)})),_=S.getButton("OK");if(C.fireChanged(),e.col)return A=await N(e.col,a,b,v,d,T,f,g,p),void await $(C,a,A,t,n);S.show()}))}async function $(e,t,n,s,o){let a=null;const c=i.TaskBarProgressIndicator.create("Analyze for MSA ...");try{if(e.fireChanged(),e.value.semType!==i.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 r.data.detectSemanticTypes(t),s(a)}catch(e){o(e)}finally{c.close()}}async function N(e,t,n,s,o,f,g,y,w){try{if(e.semType!==i.SEMTYPE.MACROMOLECULE)return;const r=t.columns.getUnusedName(`msa(${e.name})`);if((0,d.V)(e,e.name,[a.Hi.FASTA,a.Hi.SEPARATOR],[a.YI.DNA,a.YI.RNA,a.YI.PT],!1)){L(n,s,"kalign"),g.value=null,y.value=null,w.value=null;const t=c.GO.forColumn(e),i=t.isFasta()?e:t.convert(a.Hi.FASTA);return async()=>await(0,l.eE)(i,!1,r,f.value)}if((0,d.V)(e,e.name,[a.Hi.HELM],[],!1))return L(n,s,"pepsea"),g.value??=h.HX.pepsea.gapOpen,y.value??=h.HX.pepsea.gapExtend,async()=>(await(0,p.m8)(),(0,u.GD)(e,r,o.value,g.value,y.value,f.value));if((0,d.V)(e,e.name,[a.Hi.SEPARATOR],[a.YI.UN],!1)){const t=c.GO.forColumn(e).convert(a.Hi.HELM);return L(n,s,"pepsea"),g.value??=h.HX.pepsea.gapOpen,y.value??=h.HX.pepsea.gapExtend,async()=>(await(0,p.m8)(),(0,u.GD)(t,r,o.value,g.value,y.value,f.value))}return g.value=null,y.value=null,w.value=null,void L(n,s,"kalign")}catch(e){const t=e instanceof Error?e.message:e.toString();r.shell.error(t),m._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=E(),P.insert=v().bind(null,"head"),P.domAPI=w(),P.insertStyleElement=T(),g()(x.A,P),x.A&&x.A.locals&&x.A.locals},608:(e,t,n)=>{"use strict";n.d(t,{Ap:()=>G,aZ:()=>U,eE:()=>D});var r=n(7389),i=n(6082),s=n(1991),o=n.n(s),a=n(3516),c=n(2003);const l=Symbol("Comlink.proxy"),u=Symbol("Comlink.endpoint"),d=Symbol("Comlink.releaseProxy"),h=Symbol("Comlink.thrown"),p=e=>"object"==typeof e&&null!==e||"function"==typeof e,m=new Map([["proxy",{canHandle:e=>p(e)&&e[l],serialize(e){const{port1:t,port2:n}=new MessageChannel;return f(e,t),[n,[n]]},deserialize:e=>(e.start(),y(e))}],["throw",{canHandle:e=>p(e)&&h 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(r){if(!r||!r.data)return;const{id:i,type:s,path:o}=Object.assign({path:[]},r.data),a=(r.data.argumentList||[]).map(T);let c;try{const t=o.slice(0,-1).reduce(((e,t)=>e[t]),e),n=o.reduce(((e,t)=>e[t]),e);switch(s){case"GET":c=n;break;case"SET":t[o.slice(-1)[0]]=T(r.data.value),c=!0;break;case"APPLY":c=n.apply(t,a);break;case"CONSTRUCT":c=function(e){return Object.assign(e,{[l]:!0})}(new n(...a));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;f(e,n),c=function(e,t){return E.set(e,t),e}(t,[t])}break;case"RELEASE":c=void 0;break;default:return}}catch(e){c={value:e,[h]:0}}Promise.resolve(c).catch((e=>({value:e,[h]:0}))).then((e=>{const[r,o]=C(e);t.postMessage(Object.assign(Object.assign({},r),{id:i}),o),"RELEASE"===s&&(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 r=!1;const i=new Proxy(n,{get(n,s){if(w(r),s===d)return()=>S(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{g(e),r=!0}));if("then"===s){if(0===t.length)return{then:()=>i};const n=S(e,{type:"GET",path:t.map((e=>e.toString()))}).then(T);return n.then.bind(n)}return b(e,[...t,s])},set(n,i,s){w(r);const[o,a]=C(s);return S(e,{type:"SET",path:[...t,i].map((e=>e.toString())),value:o},a).then(T)},apply(n,i,s){w(r);const o=t[t.length-1];if(o===u)return S(e,{type:"ENDPOINT"}).then(T);if("bind"===o)return b(e,t.slice(0,-1));const[a,c]=A(s);return S(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:a},c).then(T)},construct(n,i){w(r);const[s,o]=A(i);return S(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:s},o).then(T)}});return i}function v(e){return Array.prototype.concat.apply([],e)}function A(e){const t=e.map(C);return[t.map((e=>e[0])),v(t.map((e=>e[1])))]}const E=new WeakMap;function C(e){for(const[t,n]of m)if(n.canHandle(e)){const[r,i]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},i]}return[{type:"RAW",value:e},E.get(e)||[]]}function T(e){switch(e.type){case"HANDLER":return m.get(e.name).deserialize(e.value);case"RAW":return e.value}}function S(e,t,n){return new Promise((r=>{const i=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!==i||(e.removeEventListener("message",t),r(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:i},t),n)}))}const _="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0ICQ9U3ltYm9sKCJDb21saW5rLnByb3h5IiksQT1TeW1ib2woIkNvbWxpbmsuZW5kcG9pbnQiKSxSPVN5bWJvbCgiQ29tbGluay5yZWxlYXNlUHJveHkiKSx5PVN5bWJvbCgiQ29tbGluay50aHJvd24iKSxfPWU9PnR5cGVvZiBlPT0ib2JqZWN0IiYmZSE9PW51bGx8fHR5cGVvZiBlPT0iZnVuY3Rpb24iLEw9e2NhbkhhbmRsZTplPT5fKGUpJiZlWyRdLHNlcmlhbGl6ZShlKXtjb25zdHtwb3J0MTpyLHBvcnQyOml9PW5ldyBNZXNzYWdlQ2hhbm5lbDtyZXR1cm4gdyhlLHIpLFtpLFtpXV19LGRlc2VyaWFsaXplKGUpe3JldHVybiBlLnN0YXJ0KCksQyhlKX19LE89e2NhbkhhbmRsZTplPT5fKGUpJiZ5IGluIGUsc2VyaWFsaXplKHt2YWx1ZTplfSl7bGV0IHI7cmV0dXJuIGUgaW5zdGFuY2VvZiBFcnJvcj9yPXtpc0Vycm9yOiEwLHZhbHVlOnttZXNzYWdlOmUubWVzc2FnZSxuYW1lOmUubmFtZSxzdGFjazplLnN0YWNrfX06cj17aXNFcnJvcjohMSx2YWx1ZTplfSxbcixbXV19LGRlc2VyaWFsaXplKGUpe3Rocm93IGUuaXNFcnJvcj9PYmplY3QuYXNzaWduKG5ldyBFcnJvcihlLnZhbHVlLm1lc3NhZ2UpLGUudmFsdWUpOmUudmFsdWV9fSxFPW5ldyBNYXAoW1sicHJveHkiLExdLFsidGhyb3ciLE9dXSk7ZnVuY3Rpb24gdyhlLHI9c2VsZil7ci5hZGRFdmVudExpc3RlbmVyKCJtZXNzYWdlIixmdW5jdGlvbiBpKHMpe2lmKCFzfHwhcy5kYXRhKXJldHVybjtjb25zdHtpZDpvLHR5cGU6YSxwYXRoOm59PU9iamVjdC5hc3NpZ24oe3BhdGg6W119LHMuZGF0YSksYz0ocy5kYXRhLmFyZ3VtZW50TGlzdHx8W10pLm1hcChtKTtsZXQgbDt0cnl7Y29uc3QgdT1uLnNsaWNlKDAsLTEpLnJlZHVjZSgoZCxwKT0+ZFtwXSxlKSxmPW4ucmVkdWNlKChkLHApPT5kW3BdLGUpO3N3aXRjaChhKXtjYXNlIkdFVCI6bD1mO2JyZWFrO2Nhc2UiU0VUIjp1W24uc2xpY2UoLTEpWzBdXT1tKHMuZGF0YS52YWx1ZSksbD0hMDticmVhaztjYXNlIkFQUExZIjpsPWYuYXBwbHkodSxjKTticmVhaztjYXNlIkNPTlNUUlVDVCI6e2NvbnN0IGQ9bmV3IGYoLi4uYyk7bD16KGQpfWJyZWFrO2Nhc2UiRU5EUE9JTlQiOntjb25zdHtwb3J0MTpkLHBvcnQyOnB9PW5ldyBNZXNzYWdlQ2hhbm5lbDt3KGUscCksbD1OKGQsW2RdKX1icmVhaztjYXNlIlJFTEVBU0UiOmw9dm9pZCAwO2JyZWFrO2RlZmF1bHQ6cmV0dXJufX1jYXRjaCh1KXtsPXt2YWx1ZTp1LFt5XTowfX1Qcm9taXNlLnJlc29sdmUobCkuY2F0Y2godT0+KHt2YWx1ZTp1LFt5XTowfSkpLnRoZW4odT0+e2NvbnN0W2YsZF09Uyh1KTtyLnBvc3RNZXNzYWdlKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxmKSx7aWQ6b30pLGQpLGE9PT0iUkVMRUFTRSImJihyLnJlbW92ZUV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLGkpLE0ocikpfSl9KSxyLnN0YXJ0JiZyLnN0YXJ0KCl9ZnVuY3Rpb24gVChlKXtyZXR1cm4gZS5jb25zdHJ1Y3Rvci5uYW1lPT09Ik1lc3NhZ2VQb3J0In1mdW5jdGlvbiBNKGUpe1QoZSkmJmUuY2xvc2UoKX1mdW5jdGlvbiBDKGUscil7cmV0dXJuIGIoZSxbXSxyKX1mdW5jdGlvbiBoKGUpe2lmKGUpdGhyb3cgbmV3IEVycm9yKCJQcm94eSBoYXMgYmVlbiByZWxlYXNlZCBhbmQgaXMgbm90IHVzZWFibGUiKX1mdW5jdGlvbiBiKGUscj1bXSxpPWZ1bmN0aW9uKCl7fSl7bGV0IHM9ITE7Y29uc3Qgbz1uZXcgUHJveHkoaSx7Z2V0KGEsbil7aWYoaChzKSxuPT09UilyZXR1cm4oKT0+ZyhlLHt0eXBlOiJSRUxFQVNFIixwYXRoOnIubWFwKGM9PmMudG9TdHJpbmcoKSl9KS50aGVuKCgpPT57TShlKSxzPSEwfSk7aWYobj09PSJ0aGVuIil7aWYoci5sZW5ndGg9PT0wKXJldHVybnt0aGVuOigpPT5vfTtjb25zdCBjPWcoZSx7dHlwZToiR0VUIixwYXRoOnIubWFwKGw9PmwudG9TdHJpbmcoKSl9KS50aGVuKG0pO3JldHVybiBjLnRoZW4uYmluZChjKX1yZXR1cm4gYihlLFsuLi5yLG5dKX0sc2V0KGEsbixjKXtoKHMpO2NvbnN0W2wsdV09UyhjKTtyZXR1cm4gZyhlLHt0eXBlOiJTRVQiLHBhdGg6Wy4uLnIsbl0ubWFwKGY9PmYudG9TdHJpbmcoKSksdmFsdWU6bH0sdSkudGhlbihtKX0sYXBwbHkoYSxuLGMpe2gocyk7Y29uc3QgbD1yW3IubGVuZ3RoLTFdO2lmKGw9PT1BKXJldHVybiBnKGUse3R5cGU6IkVORFBPSU5UIn0pLnRoZW4obSk7aWYobD09PSJiaW5kIilyZXR1cm4gYihlLHIuc2xpY2UoMCwtMSkpO2NvbnN0W3UsZl09RihjKTtyZXR1cm4gZyhlLHt0eXBlOiJBUFBMWSIscGF0aDpyLm1hcChkPT5kLnRvU3RyaW5nKCkpLGFyZ3VtZW50TGlzdDp1fSxmKS50aGVuKG0pfSxjb25zdHJ1Y3QoYSxuKXtoKHMpO2NvbnN0W2MsbF09RihuKTtyZXR1cm4gZyhlLHt0eXBlOiJDT05TVFJVQ1QiLHBhdGg6ci5tYXAodT0+dS50b1N0cmluZygpKSxhcmd1bWVudExpc3Q6Y30sbCkudGhlbihtKX19KTtyZXR1cm4gb31mdW5jdGlvbiBEKGUpe3JldHVybiBBcnJheS5wcm90b3R5cGUuY29uY2F0LmFwcGx5KFtdLGUpfWZ1bmN0aW9uIEYoZSl7Y29uc3Qgcj1lLm1hcChTKTtyZXR1cm5bci5tYXAoaT0+aVswXSksRChyLm1hcChpPT5pWzFdKSldfWNvbnN0IFA9bmV3IFdlYWtNYXA7ZnVuY3Rpb24gTihlLHIpe3JldHVybiBQLnNldChlLHIpLGV9ZnVuY3Rpb24geihlKXtyZXR1cm4gT2JqZWN0LmFzc2lnbihlLHtbJF06ITB9KX1mdW5jdGlvbiBTKGUpe2Zvcihjb25zdFtyLGldb2YgRSlpZihpLmNhbkhhbmRsZShlKSl7Y29uc3RbcyxvXT1pLnNlcmlhbGl6ZShlKTtyZXR1cm5be3R5cGU6IkhBTkRMRVIiLG5hbWU6cix2YWx1ZTpzfSxvXX1yZXR1cm5be3R5cGU6IlJBVyIsdmFsdWU6ZX0sUC5nZXQoZSl8fFtdXX1mdW5jdGlvbiBtKGUpe3N3aXRjaChlLnR5cGUpe2Nhc2UiSEFORExFUiI6cmV0dXJuIEUuZ2V0KGUubmFtZSkuZGVzZXJpYWxpemUoZS52YWx1ZSk7Y2FzZSJSQVciOnJldHVybiBlLnZhbHVlfX1mdW5jdGlvbiBnKGUscixpKXtyZXR1cm4gbmV3IFByb21pc2Uocz0+e2NvbnN0IG89VSgpO2UuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24gYShuKXshbi5kYXRhfHwhbi5kYXRhLmlkfHxuLmRhdGEuaWQhPT1vfHwoZS5yZW1vdmVFdmVudExpc3RlbmVyKCJtZXNzYWdlIixhKSxzKG4uZGF0YSkpfSksZS5zdGFydCYmZS5zdGFydCgpLGUucG9zdE1lc3NhZ2UoT2JqZWN0LmFzc2lnbih7aWQ6b30sciksaSl9KX1mdW5jdGlvbiBVKCl7cmV0dXJuIG5ldyBBcnJheSg0KS5maWxsKDApLm1hcCgoKT0+TWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpKk51bWJlci5NQVhfU0FGRV9JTlRFR0VSKS50b1N0cmluZygxNikpLmpvaW4oIi0iKX1jb25zdCBXPWFzeW5jKCk9PldlYkFzc2VtYmx5LnZhbGlkYXRlKG5ldyBVaW50OEFycmF5KFswLDk3LDExNSwxMDksMSwwLDAsMCwxLDUsMSw5NiwwLDEsMTIzLDMsMiwxLDAsMTAsMTAsMSw4LDAsNjUsMCwyNTMsMTUsMjUzLDk4LDExXSkpLGs9ImVhZ2VyIix4PSJsYXp5IixqPXtzc3c6WyJzaW1kIl0sbWluaW1hcDI6WyJzaW1kIl19LHQ9e3Rvb2xzOltdLGNvbmZpZzp7fSxmaWxlczpbXSxiYXNlOnt9LGZzOnt9LGFzeW5jIGluaXQoKXtpZih0LnRvb2xzLmxlbmd0aD09PTApdGhyb3ciRXhwZWN0aW5nIGF0IGxlYXN0IDEgdG9vbC4iO2lmKG5ldyBTZXQodC50b29scy5tYXAocj0+YCR7ci50b29sfS8ke3IucHJvZ3JhbXx8ci50b29sfWApKS5zaXplIT09dC50b29scy5sZW5ndGgpdGhyb3ciRm91bmQgZHVwbGljYXRlIHRvb2xzOyBjYW4gb25seSBoYXZlIGVhY2ggdG9vbC9wcm9ncmFtIGNvbWJpbmF0aW9uIGF0IG1vc3Qgb25jZS4iO2lmKHQuYmFzZT10LnRvb2xzLmZpbmQocj0+ci5yZWluaXQhPT0hMCksIXQuYmFzZSl0aHJvdyJDb3VsZCBub3QgZmluZCBhIHRvb2wgd2l0aCBgcmVpbml0OiBmYWxzZWAgdG8gdXNlIGFzIHRoZSBiYXNlIG1vZHVsZS4gVG8gZml4IHRoaXMgaXNzdWUsIGluY2x1ZGUgdGhlIHRvb2wgYGJhc2UvMS4wLjBgIHdoZW4gaW5pdGlhbGl6aW5nIEFpb2xpLiI7cmV0dXJuIHQuYmFzZS5pc0Jhc2VNb2R1bGU9ITAsYXdhaXQgdGhpcy5fc2V0dXAodC5iYXNlKSxhd2FpdCB0aGlzLl9pbml0TW9kdWxlcygpLHQuX2xvZygiUmVhZHkiKSwhMH0sYXN5bmMgX2luaXRNb2R1bGVzKCl7YXdhaXQgUHJvbWlzZS5hbGwodC50b29scy5tYXAodGhpcy5fc2V0dXApKSxhd2FpdCB0aGlzLl9zZXR1cEZTKCl9LG1vdW50KGU9W10pe2NvbnN0IHI9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyRGF0YX1gLGk9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyTW91bnRlZH1gO2xldCBzPVtdLG89W10sYT1bXTshQXJyYXkuaXNBcnJheShlKSYmIShlIGluc3RhbmNlb2YgRmlsZUxpc3QpJiYoZT1bZV0pLHQuX2xvZyhgTW91bnRpbmcgJHtlLmxlbmd0aH0gZmlsZXNgKTtmb3IobGV0IG4gb2YgZSl7aWYobiBpbnN0YW5jZW9mIEZpbGV8fChuPT1udWxsP3ZvaWQgMDpuLmRhdGEpaW5zdGFuY2VvZiBCbG9iJiZuLm5hbWV8fHR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmbi5uYW1lKXR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmKG4uZGF0YT1uZXcgQmxvYihbbi5kYXRhXSx7dHlwZToidGV4dC9wbGFpbiJ9KSkscy5wdXNoKG4pO2Vsc2UgaWYobi5uYW1lJiZuLnVybClvLnB1c2gobik7ZWxzZSBpZih0eXBlb2Ygbj09InN0cmluZyImJm4uc3RhcnRzV2l0aCgiaHR0cCIpKW49e3VybDpuLG5hbWU6bi5zcGxpdCgiLy8iKS5wb3AoKS5yZXBsYWNlKC9cLy9nLCItIil9LG8ucHVzaChuKTtlbHNlIHRocm93J0Nhbm5vdCBtb3VudCBmaWxlKHMpIHNwZWNpZmllZC4gTXVzdCBiZSBhIEZpbGUsIEJsb2IsIGEgVVJMIHN0cmluZywgb3IgeyBuYW1lOiAiZmlsZS50eHQiLCBkYXRhOiAic3RyaW5nIiB9Lic7YS5wdXNoKG4ubmFtZSl9dHJ5e3QuZnMudW5tb3VudChpKX1jYXRjaHt9Zm9yKGxldCBuIG9mIG8pdC5mcy5jcmVhdGVMYXp5RmlsZShyLG4ubmFtZSxuLnVybCwhMCwhMCk7cmV0dXJuIHQuZmlsZXM9dC5maWxlcy5jb25jYXQocyksdC5iYXNlLm1vZHVsZS5GUy5tb3VudCh0LmJhc2UubW9kdWxlLldPUktFUkZTLHtmaWxlczp0LmZpbGVzLmZpbHRlcihuPT5uIGluc3RhbmNlb2YgRmlsZSksYmxvYnM6dC5maWxlcy5maWx0ZXIobj0+KG49PW51bGw/dm9pZCAwOm4uZGF0YSlpbnN0YW5jZW9mIEJsb2IpfSxpKSxzLm1hcChuPT57Y29uc3QgYz1gJHtpfS8ke24ubmFtZX1gLGw9YCR7cn0vJHtuLm5hbWV9YDt0cnl7dC5mcy51bmxpbmsobCl9Y2F0Y2h7fXQuX2xvZyhgQ3JlYXRpbmcgc3ltbGluazogJHtsfSAtLT4gJHtjfWApLHQuZnMuc3ltbGluayhjLGwpfSksYS5tYXAobj0+YCR7cn0vJHtufWApfSxhc3luYyBleGVjKGUscj1udWxsKXtpZih0Ll9sb2coYEV4ZWN1dGluZyAlYyR7ZX0lYyBhcmdzPSR7cn1gLCJjb2xvcjpkYXJrYmx1ZTsgZm9udC13ZWlnaHQ6Ym9sZCIsIiIpLCFlKXRocm93IkV4cGVjdGluZyBhIGNvbW1hbmQiO2xldCBpPWU7cj09bnVsbCYmKHI9ZS5zcGxpdCgiICIpLGk9ci5zaGlmdCgpKTtjb25zdCBzPXQudG9vbHMuZmluZChhPT57dmFyIGM7bGV0IG49aTtyZXR1cm4oKGM9YT09bnVsbD92b2lkIDA6YS5mZWF0dXJlcyk9PW51bGw/dm9pZCAwOmMuc2ltZCk9PT0hMCYmKG49YCR7bn0tc2ltZGApLGEucHJvZ3JhbT09bn0pO2lmKHM9PW51bGwpdGhyb3dgUHJvZ3JhbSAke2l9IG5vdCBmb3VuZC5gO3Muc3Rkb3V0PSIiLHMuc3RkZXJyPSIiLHMubG9hZGluZz09eCYmKHMubG9hZGluZz1rLGF3YWl0IHRoaXMuX2luaXRNb2R1bGVzKCkpO3RyeXtzLm1vZHVsZS5jYWxsTWFpbihyKX1jYXRjaChhKXtjb25zb2xlLmVycm9yKGEpfXRyeXtzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzFdKSxzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzJdKX1jYXRjaHt9cy5tb2R1bGUuRlMuc3RyZWFtc1sxXT1zLm1vZHVsZS5GUy5vcGVuKCIvZGV2L3N0ZG91dCIsInciKSxzLm1vZHVsZS5GUy5zdHJlYW1zWzJdPXMubW9kdWxlLkZTLm9wZW4oIi9kZXYvc3RkZXJyIiwidyIpO2xldCBvPXtzdGRvdXQ6cy5zdGRvdXQsc3RkZXJyOnMuc3RkZXJyfTtyZXR1cm4gdC5jb25maWcucHJpbnRJbnRlcmxlYXZlZCYmKG89cy5zdGRvdXQpLHMucmVpbml0PT09ITAmJmF3YWl0IHRoaXMucmVpbml0KHMudG9vbCksb30sY2F0KGUpe3JldHVybiB0Ll9maWxlb3AoImNhdCIsZSl9LGxzKGUpe3JldHVybiB0Ll9maWxlb3AoImxzIixlKX0sZG93bmxvYWQoZSl7cmV0dXJuIHQuX2ZpbGVvcCgiZG93bmxvYWQiLGUpfSxwd2QoKXtyZXR1cm4gdC5mcy5jd2QoKX0sY2QoZSl7Zm9yKGxldCByIG9mIHQudG9vbHMpIXIubW9kdWxlfHxyLm1vZHVsZS5GUy5jaGRpcihlKX0sbWtkaXIoZSl7cmV0dXJuIHQuZnMubWtkaXIoZSksITB9LHJlYWQoe3BhdGg6ZSxsZW5ndGg6cixmbGFnOmk9InIiLG9mZnNldDpzPTAscG9zaXRpb246bz0wfSl7Y29uc3QgYT10LmZzLm9wZW4oZSxpKSxuPW5ldyBVaW50OEFycmF5KHIpO3JldHVybiB0LmZzLnJlYWQoYSxuLHMscixvKSx0LmZzLmNsb3NlKGEpLG59LHdyaXRlKHtwYXRoOmUsYnVmZmVyOnIsZmxhZzppPSJ3KyIsb2Zmc2V0OnM9MCxwb3NpdGlvbjpvPTB9KXtjb25zdCBhPXQuZnMub3BlbihlLGkpO3QuZnMud3JpdGUoYSxyLHMsci5sZW5ndGgsbyksdC5mcy5jbG9zZShhKX0sYXN5bmMgcmVpbml0KGUpe2NvbnN0IHI9dC50b29scy5maW5kKHM9PnMudG9vbD09ZSksaT10LmJhc2UubW9kdWxlLkZTLmN3ZCgpO09iamVjdC5hc3NpZ24ocixyLmNvbmZpZyksci5yZWFkeT0hMSxhd2FpdCB0aGlzLmluaXQoKSxyLmlzQmFzZU1vZHVsZSYmdGhpcy5tb3VudCgpLHRoaXMuY2QoaSl9LF9zdGRpblR4dDoiIixfc3RkaW5QdHI6MCxnZXQgc3RkaW4oKXtyZXR1cm4gdC5fc3RkaW5UeHR9LHNldCBzdGRpbihlPSIiKXt0Ll9sb2coYFNldHRpbmcgc3RkaW4gdG8gJWMke2V9JWNgLCJjb2xvcjpkYXJrYmx1ZSIsIiIpLHQuX3N0ZGluVHh0PWUsdC5fc3RkaW5QdHI9MH0sYXN5bmMgX3NldHVwKGUpe2lmKGUucmVhZHkpcmV0dXJuO2lmKHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gKGJhc2UgPSAke2UuaXNCYXNlTW9kdWxlPT09ITB9KS4uLmApLGUuY29uZmlnPU9iamVjdC5hc3NpZ24oe30sZSksZS51cmxQcmVmaXh8fChlLnVybFByZWZpeD1gJHt0LmNvbmZpZy51cmxDRE59LyR7ZS50b29sfS8ke2UudmVyc2lvbn1gKSxlLnByb2dyYW18fChlLnByb2dyYW09ZS50b29sKSxlLmZlYXR1cmVzfHwoZS5mZWF0dXJlcz17fSwoaltlLnByb2dyYW1dfHxbXSkuaW5jbHVkZXMoInNpbWQiKSYmKGF3YWl0IFcoKT8oZS5wcm9ncmFtKz0iLXNpbWQiLGUuZmVhdHVyZXMuc2ltZD0hMCk6dC5fbG9nKGBXZWJBc3NlbWJseSBTSU1EIGlzIG5vdCBzdXBwb3J0ZWQgaW4gdGhpcyBicm93c2VyOyB3aWxsIGxvYWQgbm9uLVNJTUQgdmVyc2lvbiBvZiAke2UucHJvZ3JhbX0uYCkpKSxlLmlzQmFzZU1vZHVsZSYmKGUubG9hZGluZz1rKSxlLmxvYWRpbmc9PT14KXt0Ll9sb2coYFdpbGwgbGF6eS1sb2FkICR7ZS50b29sfTsgc2tpcHBpbmcgaW5pdGlhbGl6YXRpb24uYCk7cmV0dXJufXNlbGYuaW1wb3J0U2NyaXB0cyhgJHtlLnVybFByZWZpeH0vJHtlLnByb2dyYW19LmpzYCksZS5tb2R1bGU9YXdhaXQgTW9kdWxlKHt0aGlzUHJvZ3JhbTplLnByb2dyYW0sbG9jYXRlRmlsZTooaSxzKT0+YCR7ZS51cmxQcmVmaXh9LyR7aX1gLHN0ZGluOigpPT50Ll9zdGRpblB0cjx0LnN0ZGluLmxlbmd0aD90LnN0ZGluLmNoYXJDb2RlQXQodC5fc3RkaW5QdHIrKyk6KHQuc3RkaW49IiIsbnVsbCkscHJpbnQ6aT0+e2Uuc3Rkb3V0Kz1pK2AKYCx0LmNvbmZpZy5wcmludFN0cmVhbSYmcG9zdE1lc3NhZ2Uoe3R5cGU6ImJpb3dhc20iLHZhbHVlOntzdGRvdXQ6aX19KX0scHJpbnRFcnI6aT0+e2NvbnN0IHM9dC5jb25maWcucHJpbnRJbnRlcmxlYXZlZD8ic3Rkb3V0Ijoic3RkZXJyIjtlW3NdKz1pK2AKYCx0LmNvbmZpZy5wcmludFN0cmVhbSYmcG9zdE1lc3NhZ2Uoe3R5cGU6ImJpb3dhc20iLHZhbHVlOntbc106aX19KX19KTtjb25zdCByPWUubW9kdWxlLkZTO2UuaXNCYXNlTW9kdWxlPyh0Ll9sb2coYFNldHRpbmcgdXAgJHtlLnRvb2x9IHdpdGggYmFzZSBtb2R1bGUgZmlsZXN5c3RlbS4uLmApLHIubWtkaXIodC5jb25maWcuZGlyU2hhcmVkLDUxMSksci5ta2RpcihgJHt0LmNvbmZpZy5kaXJTaGFyZWR9LyR7dC5jb25maWcuZGlyRGF0YX1gLDUxMSksci5ta2RpcihgJHt0LmNvbmZpZy5kaXJTaGFyZWR9LyR7dC5jb25maWcuZGlyTW91bnRlZH1gLDUxMSksci5jaGRpcihgJHt0LmNvbmZpZy5kaXJTaGFyZWR9LyR7dC5jb25maWcuZGlyRGF0YX1gKSx0LmZzPXIpOih0Ll9sb2coYFNldHRpbmcgdXAgJHtlLnRvb2x9IHdpdGggZmlsZXN5c3RlbS4uLmApLHIubWtkaXIodC5jb25maWcuZGlyU2hhcmVkKSxyLm1vdW50KGUubW9kdWxlLlBST1hZRlMse3Jvb3Q6dC5jb25maWcuZGlyU2hhcmVkLGZzOnQuZnN9LHQuY29uZmlnLmRpclNoYXJlZCksci5jaGRpcih0LmZzLmN3ZCgpKSksZS5zdGRvdXQ9IiIsZS5zdGRlcnI9IiIsZS5yZWFkeT0hMH0sYXN5bmMgX3NldHVwRlMoKXtjb25zdCBlPXQuZnM7Zm9yKGxldCByIG9mIHQudG9vbHMpe2lmKCFyLnJlYWR5KWNvbnRpbnVlO2NvbnN0IGk9ci5tb2R1bGUuRlMscz1gLyR7ci50b29sfWAsbz1gJHt0LmNvbmZpZy5kaXJTaGFyZWR9JHtzfWA7IWkuYW5hbHl6ZVBhdGgocykuZXhpc3RzfHxlLmFuYWx5emVQYXRoKG8pLmV4aXN0c3x8KHQuX2xvZyhgTW91bnRpbmcgJHtzfSBvbnRvICR7dC5iYXNlLnRvb2x9IGZpbGVzeXN0ZW0gYXQgJHtvfWApLGUubWtkaXIobyksZS5tb3VudCh0LmJhc2UubW9kdWxlLlBST1hZRlMse3Jvb3Q6cyxmczppfSxvKSl9fSxfZmlsZW9wKGUscil7dC5fbG9nKGBSdW5uaW5nICR7ZX0gJHtyfWApO2NvbnN0IGk9dC5mcy5hbmFseXplUGF0aChyKTtpZighaS5leGlzdHMpcmV0dXJuIHQuX2xvZyhgRmlsZSAke3J9IG5vdCBmb3VuZC5gKSwhMTtzd2l0Y2goZSl7Y2FzZSJjYXQiOnJldHVybiB0LmZzLnJlYWRGaWxlKHIse2VuY29kaW5nOiJ1dGY4In0pO2Nhc2UibHMiOnJldHVybiB0LmZzLmlzRmlsZShpLm9iamVjdC5tb2RlKT90LmZzLnN0YXQocik6dC5mcy5yZWFkZGlyKHIpO2Nhc2UiZG93bmxvYWQiOmNvbnN0IHM9bmV3IEJsb2IoW3RoaXMuY2F0KHIpXSk7cmV0dXJuIFVSTC5jcmVhdGVPYmplY3RVUkwocyl9cmV0dXJuITF9LF9sb2coZSl7aWYoIXQuY29uZmlnLmRlYnVnKXJldHVybjtsZXQgcj1bLi4uYXJndW1lbnRzXTtyLnNoaWZ0KCksY29uc29sZS5sb2coYCVjW1dlYldvcmtlcl0lYyAke2V9YCwiZm9udC13ZWlnaHQ6Ym9sZCIsIiIsLi4ucil9fTt3KHQpfSkoKTsK",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 M={urlCDN:"https://biowasm.com/cdn/v3",urlCDNStg:"https://stg.biowasm.com/cdn/v3",dirShared:"/shared",dirMounted:"/mnt",dirData:"/data",printInterleaved:!0,printStream:!1,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({},M,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 N=n(3629);class L{static getAvailableScales(){return Object.entries(this.scales).map((([e,t])=>e))}static getScale(e){return(0,N.vA)(!(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 r=["NH2","COOH"];if(e.startsWith(r[0])){const n=r[0].length;(0,N.vA)("-"==e[n],`Wrong sequence format: ${r[0]} without following '-' in '${e}'.`),t=n}if(e.endsWith(r[1])){const t=r[1].length+1;(0,N.vA)("-"==e[n-t],`Wrong sequence format: ${r[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 r=0;r<t;++r){const t=e[r];(0,N.vA)(t in this.aa2num,`Unknown char '${t}' found in sequence '${e}'`),n[r]=this.encodeLettter(t)}return n}encodeLettter(e){return this.aa2num[e]}decode(e){let t="";for(let n=0;n<e.length;++n){const r=e[n];(0,N.vA)(r in this.num2aa,`Unknown code '${r}' found in vector '${e}'`),t+=this.num2aa[r]}return t}}var R=n(4139);const O="input.fa",k="result.fasta";class G extends Error{element;constructor(e,t){super(e.innerText,t),this.element=e}}function H(e){return e.reduce(((e,t,n)=>e+`>sample${n+1}\n${t}\n`),"")}async function D(e,t=!1,n="",r=null,s,o,l){let u=e.toList();t&&(u=u.map((e=>I.clean(e).replace(/\-/g,""))));const d=e.length;r??=i.Column.string("Clusters",d).init("0"),r.type!=i.COLUMN_TYPE.STRING&&(r=r.convertTo(i.TYPE.STRING)),r.compact();const h=r.categories,p=r.getRawData(),m=new Array(h.length),f=new Array(h.length);for(let e=0;e<d;++e){const t=p[e];(m[t]??=[]).push(u[e]),(f[t]??=[]).push(e)}U(f,h);const g=await new $(["base/1.0.0",{tool:"kalign",version:R.b9,reinit:!0}]),y=i.Column.string(n,d);for(let e=0;e<h.length;++e){const t=H(m[e]);await g.fs.writeFile(O,t);const n=`${void 0!==s?` --gpo ${s}`:""}${void 0!==o?` --gpe ${o}`:""}${void 0!==l?` --tgpe ${l}`:""}`,r=await g.exec(`kalign ${O} -f fasta -o ${k}${n}`);console.warn(r);const i=await g.cat(k);if(!i){const e=F(r,1);throw new Error(e)}const c=new a.m(i).sequencesArray,u=f[e];for(let e=0;e<c.length;++e)y.set(u[e],c[e])}const w=e.meta.units,b=e.getTag(c.gp.alphabet);return y.meta.units=w,y.setTag(c.gp.aligned,"SEQ.MSA"),y.setTag(c.gp.alphabet,b),y.semType=i.SEMTYPE.MACROMOLECULE,y}function F(e,t){const n=[],r=/^.+ERROR : (.+)$/gm;let i;for(;null!=(i=r.exec(e))&&(void 0===t||n.length<t);)n.push(i[1]);return n.join("\n")}function U(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=r.div([r.divText(`MSA analysis is not available on single sequence clusters #${n.length}:`),...o()(n).take(3).map((e=>{let i=t[e];return i.length>25&&(i=i.slice(0,25)+"..."),r.divText(`"${i}"${e<n.length-1?", ":"."}`)})).toArray(),...n.length>3?[r.divText("...")]:[]]);throw new G(e)}}},8152:(e,t,n)=>{"use strict";n.d(t,{GD:()=>h,Nk:()=>l,ZY:()=>u});var r=n(4328),i=n(6082),s=n(2003),o=n(608),a=n(4139),c=n(567);const l=new class{dcName="bio";async getDockerContainer(){return await r.dapi.docker.dockerContainers.filter(this.dcName).first()}},u=["mafft --auto","mafft","linsi","ginsi","einsi","fftns","fftnsi","nwns","nwnsi"],d=["AlignedSeq","AlignedSubpeptide","HELM","ID","PolymerID"];async function h(e,t,n="ginsi",r=1.53,c=0,u=null,h){const m=await l.getDockerContainer();if("started"!==m.status&&"checking"!==m.status)throw new Error("PepSeA container has not started yet");const f=e.length;u??=i.Column.int("Clusters",f).init(0),u.type!=i.COLUMN_TYPE.STRING&&(u=u.convertTo(i.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],r=g[n];if(""===r)continue;const i=g.indexOf(r),s=e.get(t);s&&((w[i]??=[]).push({ID:t.toString(),HELM:s}),(b[n]??=[]).push(t))}(0,o.aZ)(b,g);const v=new Array(f);for(const e of w){const t=(await p(m.id,e,n,r,c,h)).Alignment;for(const e of t)v[parseInt(e.ID)]=Object.entries(e).filter((e=>!d.includes(e[0]))).map((e=>"-"!==e[1]?e[1]:"")).join(a.J.SEPARATOR)}const A=i.Column.fromStrings(t,v);return A.meta.units=s.Hi.SEPARATOR,A.setTag(s.gp.separator,a.J.SEPARATOR),A.setTag(s.gp.aligned,"SEQ.MSA"),A.setTag(s.gp.alphabet,s.YI.UN),A.setTag(s.gp.alphabetIsMultichar,"true"),A.semType=i.SEMTYPE.MACROMOLECULE,A}async function p(e,t,n,i,s,o){const a={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)},l=`/align?method=${n}&gap_open=${i}&gap_extend=${s}`;let u;if("fetchProxy"in r.dapi.docker.dockerContainers){const t=window.performance.now(),n=await r.dapi.docker.dockerContainers.fetchProxy(e,l,a),i=window.performance.now();c._package.logger.debug(`Bio: requestAlignedObjects() dockerContainers.fetchProxy(), ET: ${i-t} ms`);const s="application/json"===n.headers.get("content-type");if(!n.ok&&s){const e=await n.json(),t=e["pepsea-error"];if(t)throw new Error(`PepSeA error: ${t}`);const r=e["datagrok-error"];if(r)throw new Error(`Datagrok error: ${r}`);throw new Error(n.statusText)}if(!n.ok&&!s){const e=await n.text();throw new Error(`Error: ${e}`)}if(!s){const e=await n.text();throw new Error(`Error: PepSeA expected JSON response, got '${e}'.`)}u=await n.json()}else{const t=await r.dapi.docker.dockerContainers.request(e,l,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 i=u["datagrok-error"];if(i)throw new Error(`Datagrok error: ${i}`)}if("pepsea-stderr"in u){const e=u["pepsea-stderr"];o?.warning(e)}return u}},3890:(e,t,n)=>{"use strict";n.d(t,{aS:()=>c,wz:()=>a}),n(6082),n(7389),n(4328);var r=n(1991),i=n.n(r),s=n(826);const o=60;function a(e,t,n=o,r="\n"){const i=s.GO.forColumn(t),a=[];for(let s=0;s<t.length;s++){const t=e.map((e=>e.get(s).toString())).join("|"),o=c(i.getSplitted(s),n);a.push(`>${t}${r}`);for(const e of o)a.push(`${e}${r}`)}return"".concat(...a)}function c(e,t=o){let n=0;const r=e.length,s=[];for(;n<r;){const r=i()(e.originals).slice(n,n+t).toArray(),o=r.map((e=>e.length>1?`[${e}]`:e)).reduce(((e,t)=>e+t),"");s.push(o),n+=r.length}return s}},8754:(e,t,n)=>{"use strict";n.d(t,{V:()=>u});var r=n(4328),i=n(7384),s=n(826),o=n(2003),a=n(6717),c=n(8312),l=n(966);async function u(e,t,n,u){let d;try{d=await(0,a.j)()}catch(e){return r.shell.warning('Transformation to atomic level requires package "Chem" installed.'),null}let h=null;if(n){const n=await(0,c.Q)(),r=s.GO.forColumn(t);let i,a,l;r.isHelm()?a=t:(l=t.name,t.name=`__${l}`,a=r.convert(o.Hi.HELM),a.name=l,e.columns.add(a,!1));try{i=await n.helmToAtomicLevel(a,!0,!0)}finally{a!==t&&(e.columns.remove(a.name),t.name=l)}e.columns.add(i.molCol),e.columns.add(i.molHighlightCol),h=i.molCol}else{if(!(0,l.V)(t,"To Atomic Level"))return null;const n=await(0,i.C4)(e,t,u);null!==n.col&&(e.columns.add(n.col,!0),h=n.col)}return h&&await r.data.detectSemanticTypes(e),h}},5785:(e,t,n)=>{"use strict";n.d(t,{k:()=>u});var r=n(4328),i=n(6082),s=n(8070),o=n(966),a=n(3077),c=n(4139),l=n(439);async function u(e,t){if(await(0,s.cb)(10),!(0,o.V)(t,"Sequence space"))return e;const n=(0,a.R)(t);n.name="splitToMonomers";const u=t.dataFrame;for(const e of n.columns)e.semType=c.uF.MONOMER,e.setTag(l.gp.alphabet,t.getTag(l.gp.alphabet));const d=/(\d+)(?: \((\d+)\))?/,h=e=>{d.lastIndex=0;const t=e.match(d);return t?`${t[1]} (${parseInt(t[2]??"0")+1})`:e};for(let e=0;e<n.columns.length;e++){const r=n.columns.byIndex(e);r.semType=c.uF.MONOMER,r.setTag(l.gp.alphabet,t.getTag(l.gp.alphabet));const i=100;let s=0;for(;u.columns.byName(r.name)&&s<i;)r.name=h(r.name),s++;u.columns.add(r)}await r.data.detectSemanticTypes(u);for(let e=0;e<n.columns.length;e++){const t=n.columns.byIndex(e);t.setTag(i.TAGS.CELL_RENDERER,"Monomer"),t.setTag(".use-as-filter","false")}return u}},4870:(e,t,n)=>{"use strict";function r(e,t){e.innerHTML="",e.append(t)}n.d(t,{K:()=>r}),n(4328),n(6082)},8047:(e,t,n)=>{"use strict";n.d(t,{VN:()=>p,n5:()=>c,Ue:()=>h,Tc:()=>d,eN:()=>m}),n(4328),n(7389);var r=n(6082),i=(n(1757),n(1991),n(1858),n(826),n(2003)),s=n(4326),o=n(2738);n(8070),n(7602);var a,c,l,u=n(2174);n(567),HTMLCanvasElement.prototype.getCursorPosition=function(e,t){const n=this.getBoundingClientRect();return new r.Point((e.clientX-n.left)*t,(e.clientY-n.top)*t)},r.Rect.prototype.contains=function(e,t){return this.left<=e&&e<=this.right&&this.top<=t&&t<=this.bottom};class d{rowCount;value;plotValue;valueList=null;valueIdx=0;bounds;constructor(e=0,t){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 h{pos;name;_label;get label(){return this._label?this._label:this.name}_freqs;sumRowCount=0;sumPlotValue;sumPlotValueForHeight;constructor(e,t,n,r){this.pos=e,this.name=t,this._freqs=n??{},r?.sumRowCount&&(this.sumRowCount=r.sumRowCount),r?.sumValueForHeight&&(this.sumPlotValue=r.sumValueForHeight),r?.label&&(this._label=r.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 d),t}aggregate(e){const t=function(e){return t=>{const n=function(e){let t;const n="agg";return t=e instanceof Float32Array?r.Column.fromFloat32Array(n,e):e instanceof Int32Array?r.Column.fromInt32Array(n,e):r.Column.fromList(r.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===s.fH.Entropy){const e=Object.keys(this._freqs).length,t=.01*this.sumPlotValue,n=t/e;for(const e of Object.values(this._freqs)){const r=(e.plotValue+n)/(this.sumPlotValue+t);this.sumPlotValueForHeight+=-r*Math.log2(r)}}else if(e===s.fH.full)for(const[e,t]of Object.entries(this._freqs)){const e=t.plotValue/this.sumPlotValue;this.sumPlotValueForHeight+=e}}calcScreen(e,t,n,i,a,c,l,u,d){const h=i===s.fH.Entropy?n*(a-this.sumPlotValueForHeight)/a:n;let p=d*u+(n-h-1);const m=Object.entries(this._freqs).sort(((e,t)=>e[0]!==o._S&&t[0]!==o._S?t[1].value-e[1].value:e[0]===o._S&&t[0]===o._S?0:e[0]===o._S?-1:1));for(const[n,i]of m){const n=h*i.plotValue/this.sumPlotValue;i.bounds=new r.Rect((e-t)*u*c,p,l*u,n),p+=n}}render(e,t,n,r,s){for(const[a,c]of Object.entries(this._freqs))if(a!==o._S){const o=(0,i.zS)(a,5),l=c.bounds,u=l.left;e.resetTransform(),e.strokeStyle="lightgray",e.lineWidth=1,e.rect(u,l.top,l.width,l.height),e.fillStyle=s.get(a)??s.get("other"),e.textAlign="left",e.font=t;const d=e.measureText(o);e.setTransform(l.width/d.width,0,0,l.height/r,u,l.top),e.fillText(o,0,-n)}}getMonomerAt(e,t){const n=Object.entries(this._freqs).find((([n,r])=>r.bounds.contains(e,t)));return n?n[0]:void 0}buildCompositionTable(e){if("-"in this._freqs)throw new Error("Unexpected monomer symbol '-'.");return(0,u.F)(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"}(a||(a={})),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"}(c||(c={})),s.Fo,function(e){e[e.None=0]="None",e[e.Render=1]="Render",e[e.Layout=1]="Layout",e[e.Freqs=2]="Freqs"}(l||(l={}));const p=new class{render=20};function m(e,t,n,r,i){let s=0,o=-1;for(;-1!=(o=n.findNext(o,!0));){const e=t.getSplitted(o),n=i.pos,a=n<e.length?e.getCanonical(n):null;null!==a&&a===r&&s++}return s}r.JsViewer},4577:(e,t,n)=>{"use strict";n.d(t,{O:()=>o,n:()=>s});var r=n(1858),i=n(567);class s{substructure;readOnly;constructor(e,t=!0){return this.substructure=e,this.readOnly=t,new Proxy(this,{set:(e,t,n)=>{if(i._package.logger.debug(`BioFilterProps.set ${t.toString()}( '${n}' )`),this.readOnly)throw new Error("Properties are immutable.");return e[t]=n,!0}})}}class o{onChanged=new r.Subject;_props;_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()}}},1687:(e,t,n)=>{"use strict";n.d(t,{_i:()=>S,AR:()=>T});var r=n(7389),i=n(6082),s=n(4328),o=n(1991),a=n.n(o),c=n(1858),l=n(2003),u=n(8070),d=n(826),h=n(7602),p=n(8115),m=n(4577),f=n(1757),g=n.n(f),y=n(9124),w=n(9192),b=n(4870),v=n(567);class A extends m.O{emptyProps=new m.n("");helmEditor;_filterPanel=r.div("",{style:{cursor:"pointer"}});logger;static viewerCounter=-1;viewerId=++A.viewerCounter;viewerToLog(){return`HelmBioFilter<${this.viewerId}>`}get type(){return"HelmBioFilter"}constructor(){super(),this.logger=v._package.logger}viewSubs=[];async detach(){await super.detach();for(const e of this.viewSubs)e.unsubscribe()}async attach(){this.viewerToLog();try{const e=await(0,y.b)();let t,n;this.helmEditor=e.createHelmWebEditor(),this.logger.warning("TEST: HelmBioFilter.init().sync() waitForElementInDom waiting..."),await r.tools.waitForElementInDom(this._filterPanel),this.logger.warning("TEST: HelmBioFilter.init().sync() waitForElementInDom ready"),this.updateFilterPanel(),this.viewSubs.push((0,c.fromEvent)(this._filterPanel,"click").subscribe((()=>{t=r.div(),n=e.createWebEditorApp(t,this.props.substructure),r.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 m.n(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(r.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,w.AP)(e);this.logger.error(t,void 0,n)}})))}catch(e){const[t,n]=(0,w.AP)(e),i=this._filterPanel;i.innerText="error",i.classList.add("d4-error"),r.tooltip.bind(i,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,b.K)(this._filterPanel,this.helmEditor.host),this.helmEditor.editor.setHelm(e),this.helmEditor.resizeEditor(t,n);else{const e=r.divText("Click to edit","helm-substructure-filter");(0,b.K)(this._filterPanel,e)}}async substructureSearch(e){const t=`${this.viewerToLog()}.substructureSearch( column = <${e.name}> )`;v._package.logger.debug(`${t}, start`);try{return await(0,u.cb)(10),await(0,p.if)(this.props.substructure,e)}finally{v._package.logger.debug(`${t}, end`)}}}const E="bio-substructure-filter";class C{props;filterId;dataFrameId;columnName;bitset;constructor(e,t,n,r,i){this.props=e,this.filterId=t,this.dataFrameId=n,this.columnName=r,this.bitset=i}}class T extends m.n{separator;constructor(e,t){super(e,!1),this.separator=t,this.readOnly=!0}}class S extends i.Filter{bioFilter=null;bitset=null;loader;notation=void 0;logger;filterSyncer;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.root=r.divV([]),this.loader=r.loader(),this.calculating=!1,this.filterSyncer=new h.g(this.logger=v._package.logger),new Proxy(this,{set:(e,t,n)=>(e[t]=n,!0)})}static filterCounter=-1;filterId=++S.filterCounter;filterToLog(){return`BioSubstructureFilter<${this.filterId}>`}viewSubs=[];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(i.SEMTYPE.MACROMOLECULE)),d.GO.forColumn(this.column),this.columnName??=this.column?.name,this.notation??=this.column?.meta.units,this.bioFilter=this.notation===l.Hi.FASTA?new _:this.notation===l.Hi.SEPARATOR?new x(this.column.getTag(l.gp.separator)):new A,this.root.appendChild(this.bioFilter.filterPanel),this.root.appendChild(this.loader),await this.bioFilter.attach(),this.viewSubs.push(i.debounce(this.bioFilter.onChanged,this.debounceTime).subscribe(this.bioFilterOnChangedDebounced.bind(this))),this.viewSubs.push(s.events.onResetFilterRequest.subscribe(this.grokEventsOnResetFilterRequest.bind(this))),this.viewSubs.push(s.events.onCustomEvent(E).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=i.toJs(e.props??{}))}))}fireFilterSync(){const e=`${this.filterToLog()}.fireFilterSync()`;v._package.logger.debug(`${e}, bioFilter = ${this.bioFilter?this.bioFilter.constructor.name:"null"}`+(this.bioFilter?`, props = ${JSON.stringify(this.bioFilter.saveProps())}`:"")),s.events.fireCustomEvent(E,new C(this.bioFilter.props,this.filterId,this.dataFrame.id,this.columnName,this.bitset))}bioFilterOnChangedDebounced(){if(!this.dataFrame)return;const e=`${this.filterToLog()}.bioFilterOnChangedDebounced()`;if(v._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{v._package.logger.debug(`${e}, before substructureSearch`),this.bitset=await(this.bioFilter?.substructureSearch(this.column)),v._package.logger.debug(`${e}, after substructureSearch`),this.calculating=!1,this.fireFilterSync(),this.dataFrame?.rows.requestFilter()}finally{this.calculating=!1,v._package.logger.debug(`${e}, end`)}}))}grokEventsOnResetFilterRequest(){const e=`${this.filterToLog()}.grokEventsOnResetFilterRequest()`;v._package.logger.debug(`${e}`),this.bioFilter?.resetFilter()}_onRendered=new c.Subject;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.cb)(10),await(0,u.PE)(this.onRendered,(()=>{this.logger.debug(`${n}, _onRendered event caught`)}),(()=>{this.invalidate(t)}),e,`${n} timeout`);const r=this.filterSyncer.resetErrors();if(r.length>0)throw r[0]}}class _ extends m.O{emptyProps=new m.n("");substructureInput;get type(){return"FastaBioFilter"}constructor(){super(),this.substructureInput=r.input.string("",{value:"",onValueChanged:e=>{window.setTimeout((()=>{this.props=new m.n(e),this._propsChanging||this.onChanged.next()}),0)},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,p.nI)(this.props.substructure,e)}async attach(){}async detach(){await super.detach()}}class x extends m.O{emptyProps=new T("",void 0);substructureInput;separatorInput;colSeparator="";get type(){return"SeparatorBioFilter"}constructor(e){super(),this.substructureInput=r.input.string("",{value:"",onValueChanged:e=>{this.props=new T(e,this.props.separator),this._propsChanging||this.onChanged.next()},placeholder:"Substructure"}),this.separatorInput=r.input.string("",{value:this.colSeparator=e,onValueChanged:e=>{const t=e||void 0;this.props=new T(this.props.substructure,t),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 r.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,p.nI)(this.substructure,e,this.colSeparator)}async attach(){}async detach(){await super.detach()}}},2174:(e,t,n)=>{"use strict";n.d(t,{F:()=>v});var r=n(7389),i=n(6082),s=(n(1991),n(2003),n(4152),n(5072)),o=n.n(s),a=n(7825),c=n.n(a),l=n(7659),u=n.n(l),d=n(5056),h=n.n(d),p=n(540),m=n.n(p),f=n(1113),g=n.n(f),y=n(5999),w={};w.styleTagTransform=g(),w.setAttributes=h(),w.insert=u().bind(null,"head"),w.domAPI=c(),w.insertStyleElement=m(),o()(y.A,w),y.A&&y.A.locals&&y.A.locals,n(826);var b=n(2738);function v(e,t){let n=0,s=null;for(const e of Object.values(t))n+=e,s=null===s?e:Math.max(s,e);const o=s/n,a=Object.assign({},...Array.from(Object.entries(t)).sort(((e,t)=>t[1]-e[1])).map((([t,s])=>{const a=s/n,c=e.get(t),l=r.div("",{classes:"macromolecule-cell-comp-analysis-bar"});l.style.width=50*a/o+"px",l.style.backgroundColor=c,b._S===t&&(l.style.borderWidth="1px",l.style.borderStyle="solid",l.style.borderColor=i.Color.toHtml(i.Color.lightGray));const u=b._S===t?"-":t,d=r.div(`${(100*a).toFixed(2)}%`),h=r.div([l,d],{classes:"macromolecule-cell-comp-analysis-value"});return{[u]:h}}))),c=r.tableFromMap(a);return Array.from(c.rows).forEach((e=>{const t=e.getElementsByClassName("macromolecule-cell-comp-analysis-bar")[0].style.backgroundColor;e.cells[0].style.color=t})),c}},1757:e=>{"use strict";e.exports=$},6082:e=>{"use strict";e.exports=DG},4328:e=>{"use strict";e.exports=grok},1858:e=>{"use strict";e.exports=rxjs},7389:e=>{"use strict";e.exports=ui},1991:e=>{"use strict";e.exports=wu},8343:(e,t,n)=>{"use strict";const{normalizeIPv6:r,normalizeIPv4:i,removeDotSegments:s,recomposeAuthority:o,normalizeComponentEncoding:a}=n(4834),c=n(343);function l(e,t,n,r){const i={};return r||(e=p(u(e,n),n),t=p(u(t,n),n)),!(n=n||{}).tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=s(t.path||""),i.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=s(t.path||""),i.query=t.query):(t.path?("/"===t.path.charAt(0)?i.path=s(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path:i.path="/"+t.path,i.path=s(i.path)),i.query=t.query):(i.path=e.path,void 0!==t.query?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function u(e,t){const n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},r=Object.assign({},t),i=[],a=c[(r.scheme||n.scheme||"").toLowerCase()];a&&a.serialize&&a.serialize(n,r),void 0!==n.path&&(r.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),void 0!==n.scheme&&(n.path=n.path.split("%3A").join(":")))),"suffix"!==r.reference&&n.scheme&&(i.push(n.scheme),i.push(":"));const l=o(n,r);if(void 0!==l&&("suffix"!==r.reference&&i.push("//"),i.push(l),n.path&&"/"!==n.path.charAt(0)&&i.push("/")),void 0!==n.path){let e=n.path;r.absolutePath||a&&a.absolutePath||(e=s(e)),void 0===l&&(e=e.replace(/^\/\//u,"/%2F")),i.push(e)}return void 0!==n.query&&(i.push("?"),i.push(n.query)),void 0!==n.fragment&&(i.push("#"),i.push(n.fragment)),i.join("")}const d=Array.from({length:127},((e,t)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(t)))),h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function p(e,t){const n=Object.assign({},t),s={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=-1!==e.indexOf("%");let a=!1;"suffix"===n.reference&&(e=(n.scheme?n.scheme+":":"")+"//"+e);const l=e.match(h);if(l){if(s.scheme=l[1],s.userinfo=l[3],s.host=l[4],s.port=parseInt(l[5],10),s.path=l[6]||"",s.query=l[7],s.fragment=l[8],isNaN(s.port)&&(s.port=l[5]),s.host){const e=i(s.host);if(!1===e.isIPV4){const t=r(e.host,{isIPV4:!1});s.host=t.host.toLowerCase(),a=t.isIPV6}else s.host=e.host,a=!0}void 0!==s.scheme||void 0!==s.userinfo||void 0!==s.host||void 0!==s.port||s.path||void 0!==s.query?void 0===s.scheme?s.reference="relative":void 0===s.fragment?s.reference="absolute":s.reference="uri":s.reference="same-document",n.reference&&"suffix"!==n.reference&&n.reference!==s.reference&&(s.error=s.error||"URI is not a "+n.reference+" reference.");const e=c[(n.scheme||s.scheme||"").toLowerCase()];if(!(n.unicodeSupport||e&&e.unicodeSupport)&&s.host&&(n.domainHost||e&&e.domainHost)&&!1===a&&function(e){let t=0;for(let n=0,r=e.length;n<r;++n)if(t=e.charCodeAt(n),t>126||d[t])return!0;return!1}(s.host))try{s.host=URL.domainToASCII(s.host.toLowerCase())}catch(e){s.error=s.error||"Host's domain name can not be converted to ASCII: "+e}(!e||e&&!e.skipNormalize)&&(o&&void 0!==s.scheme&&(s.scheme=unescape(s.scheme)),o&&void 0!==s.userinfo&&(s.userinfo=unescape(s.userinfo)),o&&void 0!==s.host&&(s.host=unescape(s.host)),void 0!==s.path&&s.path.length&&(s.path=escape(unescape(s.path))),void 0!==s.fragment&&s.fragment.length&&(s.fragment=encodeURI(decodeURIComponent(s.fragment)))),e&&e.parse&&e.parse(s,n)}else s.error=s.error||"URI can not be parsed.";return s}const m={SCHEMES:c,normalize:function(e,t){return"string"==typeof e?e=u(p(e,t),t):"object"==typeof e&&(e=p(u(e,t),t)),e},resolve:function(e,t,n){const r=Object.assign({scheme:"null"},n);return u(l(p(e,r),p(t,r),r,!0),{...r,skipEscape:!0})},resolveComponents:l,equal:function(e,t,n){return"string"==typeof e?(e=unescape(e),e=u(a(p(e,n),!0),{...n,skipEscape:!0})):"object"==typeof e&&(e=u(a(e,!0),{...n,skipEscape:!0})),"string"==typeof t?(t=unescape(t),t=u(a(p(t,n),!0),{...n,skipEscape:!0})):"object"==typeof t&&(t=u(a(t,!0),{...n,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:u,parse:p};e.exports=m,e.exports.default=m,e.exports.fastUri=m},343:e=>{"use strict";const t=/^[\da-f]{8}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{12}$/iu,n=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function r(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}function i(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function s(e){const t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}const o={scheme:"http",domainHost:!0,parse:i,serialize:s},a={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=r(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(r(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){const[t,n]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}},c={http:o,https:{scheme:"https",domainHost:o.domainHost,parse:i,serialize:s},ws:a,wss:{scheme:"wss",domainHost:a.domainHost,parse:a.parse,serialize:a.serialize},urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;const r=e.path.match(n);if(r){const n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];const i=`${n}:${t.nid||e.nid}`,s=c[i];e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){const n=t.scheme||e.scheme||"urn",r=e.nid.toLowerCase(),i=`${n}:${t.nid||r}`,s=c[i];s&&(e=s.serialize(e,t));const o=e,a=e.nss;return o.path=`${r||t.nid}:${a}`,t.skipEscape=!0,o},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,n){const r=e;return r.uuid=r.nss,r.nss=void 0,n.tolerant||r.uuid&&t.test(r.uuid)||(r.error=r.error||"UUID is not valid."),r},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};e.exports=c},4914:e=>{"use strict";e.exports={HEX:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15}}},4834:(e,t,n)=>{"use strict";const{HEX:r}=n(4914);function i(e){if(c(e,".")<3)return{host:e,isIPV4:!1};const t=e.match(/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/u)||[],[n]=t;return n?{host:a(n,"."),isIPV4:!0}:{host:e,isIPV4:!1}}function s(e,t=!1){let n="",i=!0;for(const t of e){if(void 0===r[t])return;"0"!==t&&!0===i&&(i=!1),i||(n+=t)}return t&&0===n.length&&(n="0"),n}function o(e,t={}){if(c(e,":")<2)return{host:e,isIPV6:!1};const n=function(e){let t=0;const n={error:!1,address:"",zone:""},r=[],i=[];let o=!1,a=!1,c=!1;function l(){if(i.length){if(!1===o){const e=s(i);if(void 0===e)return n.error=!0,!1;r.push(e)}i.length=0}return!0}for(let s=0;s<e.length;s++){const u=e[s];if("["!==u&&"]"!==u)if(":"!==u)if("%"===u){if(!l())break;o=!0}else i.push(u);else{if(!0===a&&(c=!0),!l())break;if(t++,r.push(":"),t>7){n.error=!0;break}s-1>=0&&":"===e[s-1]&&(a=!0)}}return i.length&&(o?n.zone=i.join(""):c?r.push(i.join("")):r.push(s(i))),n.address=r.join(""),n}(e);if(n.error)return{host:e,isIPV6:!1};{let e=n.address,t=n.address;return n.zone&&(e+="%"+n.zone,t+="%25"+n.zone),{host:e,escapedHost:t,isIPV6:!0}}}function a(e,t){let n="",r=!0;const i=e.length;for(let s=0;s<i;s++){const o=e[s];"0"===o&&r?(s+1<=i&&e[s+1]===t||s+1===i)&&(n+=o,r=!1):(r=o===t,n+=o)}return n}function c(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}const l=/^\.\.?\//u,u=/^\/\.(?:\/|$)/u,d=/^\/\.\.(?:\/|$)/u,h=/^\/?(?:.|\n)*?(?=\/|$)/u;e.exports={recomposeAuthority:function(e,t){const n=[];if(void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host){let t=unescape(e.host);const r=i(t);if(r.isIPV4)t=r.host;else{const n=o(r.host,{isIPV4:!1});t=!0===n.isIPV6?`[${n.escapedHost}]`:e.host}n.push(t)}return"number"!=typeof e.port&&"string"!=typeof e.port||(n.push(":"),n.push(String(e.port))),n.length?n.join(""):void 0},normalizeComponentEncoding:function(e,t){const n=!0!==t?escape:unescape;return void 0!==e.scheme&&(e.scheme=n(e.scheme)),void 0!==e.userinfo&&(e.userinfo=n(e.userinfo)),void 0!==e.host&&(e.host=n(e.host)),void 0!==e.path&&(e.path=n(e.path)),void 0!==e.query&&(e.query=n(e.query)),void 0!==e.fragment&&(e.fragment=n(e.fragment)),e},removeDotSegments:function(e){const t=[];for(;e.length;)if(e.match(l))e=e.replace(l,"");else if(e.match(u))e=e.replace(u,"/");else if(e.match(d))e=e.replace(d,"/"),t.pop();else if("."===e||".."===e)e="";else{const n=e.match(h);if(!n)throw new Error("Unexpected dot segment condition");{const r=n[0];e=e.slice(r.length),t.push(r)}}return t.join("")},normalizeIPv4:i,normalizeIPv6:o,stringArrayToHexStripped:s}},3837: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}')},7216: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"}}}}')},8226: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"}}}')},518: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"}}}')},4588: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"}}}')},5707: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}}}')},9547: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"}}}')},7082: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":[]}}}')},1678: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}}}')},2079: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(r){var i=t[r];if(void 0!==i)return i.exports;var s=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(s.exports,s,s.exports,n),s.loaded=!0,s.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 r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},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&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=r[i--].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 r={};(()=>{"use strict";n.r(r),n.d(r,{_package:()=>_e,test:()=>xe,tests:()=>t.CN});var e=n(6082),t=n(8070);(0,t.L1)("_first",(()=>{(0,t.t6)("_first",(async()=>{}))}));var i=n(8924),s=n(7362),o=n(1093);(0,t.L1)("Palettes",(()=>{(0,t.t6)("testPaletteN",(async()=>{await async function(){const e=o.A.Chromatogram;(0,t.E3)(e instanceof s.e,!0),(0,t.E3)(e instanceof o.A,!0)}()})),(0,t.t6)("testPaletteAA",(async()=>{await async function(){const e=i.X.Lesk,n=i.X.RasMol,r=i.X.GrokGroups;(0,t.E3)(e instanceof s.e,!0),(0,t.E3)(n instanceof s.e,!0),(0,t.E3)(r instanceof s.e,!0),(0,t.E3)(e instanceof i.X,!0),(0,t.E3)(n instanceof i.X,!0),(0,t.E3)(r instanceof i.X,!0)}()})),(0,t.t6)("testPalettePtMe",(async()=>{const e=i.X.GrokGroups.get("MeNle"),n=i.X.GrokGroups.get("MeA"),r=i.X.GrokGroups.get("MeG"),s=i.X.GrokGroups.get("MeF"),o=i.X.GrokGroups.get("L"),a=i.X.GrokGroups.get("A"),c=i.X.GrokGroups.get("G"),l=i.X.GrokGroups.get("F");(0,t.E3)(e,o),(0,t.E3)(n,a),(0,t.E3)(r,c),(0,t.E3)(s,l)}))}));var a=n(4328),c=n(567),l=n(2003),u=n(826);class d{units;aligned;alphabet;alphabetSize;alphabetIsMultichar;separator;constructor(e,t,n,r,i,s){this.units=e,this.aligned=t,this.alphabet=n,this.alphabetSize=r,this.alphabetIsMultichar=i,this.separator=s}}async function h(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 e=`Negative test detected semType='${n.semType}', units='${n.meta.units}'.`;throw new Error(e)}}async function p(t,n){const r=(await t()).getCol(n),i=await a.functions.call("Bio:detectMacromolecule",{col:r});if(i&&(r.semType=i),r.semType===e.SEMTYPE.MACROMOLECULE){const e=`Negative test detected semType='${r.semType}', units='${r.meta.units}'.`;throw new Error(e)}}async function m(n,r,i,s,o,c,d=null){const h=e.Column.fromList(e.TYPE.STRING,"seq",n),p=await a.functions.call("Bio:detectMacromolecule",{col:h});p&&(h.semType=p),(0,t.E3)(h.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(h.meta.units,r),(0,t.E3)(h.getTag(l.gp.aligned),i),(0,t.E3)(h.getTag(l.gp.alphabet),s),d&&(0,t.E3)(h.getTag(l.gp.separator),d);const m=u.GO.forColumn(h);(0,t.E3)(m.getAlphabetSize(),o),(0,t.E3)(m.getAlphabetIsMultichar(),c),m.isHelm()||((0,t.E3)(m.aligned,i),(0,t.E3)(m.alphabet,s))}async function f(n,r,i,s,o,c,d,h=null){const p=(await n()).col(r),m=await a.functions.call("Bio:detectMacromolecule",{col:p});m&&(p.semType=m),(0,t.E3)(p.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(p.meta.units,i),(0,t.E3)(p.getTag(l.gp.aligned),s),(0,t.E3)(p.getTag(l.gp.alphabet),o),h&&(0,t.E3)(p.getTag(l.gp.separator),h);const f=u.GO.forColumn(p);(0,t.E3)(f.getAlphabetSize(),c),(0,t.E3)(f.getAlphabetIsMultichar(),d),f.isHelm()||((0,t.E3)(f.aligned,s),(0,t.E3)(f.alphabet,o))}async function g(e,t){const n=await e(),r=[];for(const i of n.columns.names())if(i in t){const n=t[i];try{await f(e,i,n.units,n.aligned,n.alphabet,n.alphabetSize,n.alphabetIsMultichar,n.separator)}catch(e){const t=e.toString();r.push(`Positive col '${i}' failed: ${t}`)}}else try{await p(e,i)}catch(e){const t=e.toString();r.push(`Negative col '${i}' failed: ${t}`)}if(r.length>0)throw new Error(r.join("\n"))}(0,t.L1)("detectors",(()=>{const n={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"]},negSmilesWithSquareBrackets:{csv:"col1\nCl.c1ccc2nc3ccccc3cc2c1\nOc1cccc2cc3ccccc3cc12\n[SeH]c1ccc2ccccc2c1",neg:["col1"]},negFastaUnSingleChar:{csv:"col1\nAlanine\nCysteine\nAspartic acid\nGlutamic acid\nPhenylalanine",neg:["col1"]},fastaMsaSameLength:{csv:"seq\nFWPHEYFWPHEYYV\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",pos:{seq:new d(l.Hi.FASTA,"SEQ.MSA",l.YI.PT,20,!1,void 0)}},fastaExtSameLength:{csv:"seq\nFW[Ac]PHEYFWPH\nYN[Re]VYNRQWYV\n[Me]EYVMPS[Et]",pos:{seq:new d(l.Hi.FASTA,"SEQ",l.YI.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 d(l.Hi.FASTA,"SEQ.MSA",l.YI.UN,14,!0,void 0)}},fastaMsaExtManyMinus:{csv:"seq\n[D-Tic]-------[D-Tyr_Et][Tyr_ab-dehydroMe][dV][Cys_SEt]N[D-Orn][D-aThr]-[Phe_4Me]\n[Phe_2F]--------[Tyr_ab-dehydroMe][dV][Aca]N[D-Orn][D-aThr]-[Phe_4Me]\n[D-Tic]-[Hcy]QTWQ[Phe_4NH2][D-Tyr_Et][Tyr_ab-dehydroMe][dV][Cys_SEt]----[Phe_4Me]",pos:{seq:new d(l.Hi.FASTA,"SEQ.MSA",l.YI.UN,17,!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 d(l.Hi.SEPARATOR,"SEQ.MSA",l.YI.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 d(l.Hi.SEPARATOR,"SEQ",l.YI.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 d(l.Hi.HELM,null,null,19,void 0,void 0)}}};for(const[r,i]of Object.entries(n))(0,t.t6)(`csvData2-${r}`,(async()=>{const t=(s=r,async()=>{const t=n[s].csv,r=e.DataFrame.fromCsv(t);return await a.data.detectSemanticTypes(r),r});var s;for(const e of i.neg??[])await p(t,e);for(const[e,n]of Object.entries(i.pos??{}))await f(t,e,n.units,n.aligned,n.alphabet,n.alphabetSize,n.alphabetIsMultichar,n.separator)}));const r=new class{csvFastaDna1="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC";fastaRna1="seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC";fastaPt1="seq\nFWPHEY\nYNRQWYV\nMKPSEYV";fastaUn="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]";sepDna="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";sepRna="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";sepPt="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";sepUn1="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";sepUn2="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";sepMsaDna1="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";sepMsaUnWEmpty="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";sepComplex="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";fastaMsaDna1="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT";fastaMsaPt1="seq\nFWR-WYV-KHPFWR-WYV-KHP\nYNR-WYV-KHPYNR-WYV-KHP\nMWRSWY-CKHPMWRSWY-CKHP"},i={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"},s={};function o(e,t=c){return async()=>(e in s||(s[e]=(async()=>await t(i[e]))().catch((t=>{throw delete s[e],t}))),s[e])}async function c(t){const n=await a.dapi.files.readAsText(t);return e.DataFrame.fromCsv(n)}const u=t=>async()=>{const n=r[t],i=e.DataFrame.fromCsv(n);return await a.data.detectSemanticTypes(i),i};(0,t.t6)("NegativeStartEnd",(async()=>{await h(["START","END"])})),(0,t.t6)("NegativeStartEndIntermediate",(async()=>{await h(["START","END","INTERMEDIATE"])})),(0,t.t6)("FastaDna1",(async()=>{await f(u("csvFastaDna1"),"seq",l.Hi.FASTA,"SEQ",l.YI.DNA,4,!1)})),(0,t.t6)("FastaRna1",(async()=>{await f(u("fastaRna1"),"seq",l.Hi.FASTA,"SEQ",l.YI.RNA,4,!1)})),(0,t.t6)("FastaPt1",(async()=>{await f(u("fastaPt1"),"seq",l.Hi.FASTA,"SEQ",l.YI.PT,20,!1)})),(0,t.t6)("FastaPtGaps",(()=>m(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEYV"],l.Hi.FASTA,"SEQ",l.YI.PT,20,!1))),(0,t.t6)("FastaPtGapsMsa",(()=>m(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEY"],l.Hi.FASTA,"SEQ.MSA",l.YI.PT,20,!1))),(0,t.t6)("FastaUn",(async()=>{await f(u("fastaUn"),"seq",l.Hi.FASTA,"SEQ.MSA",l.YI.UN,12,!0)})),(0,t.t6)("FastaMsaDna1",(async()=>{await f(u("fastaMsaDna1"),"seq",l.Hi.FASTA,"SEQ.MSA",l.YI.DNA,4,!1)})),(0,t.t6)("FastaMsaPt1",(async()=>{await f(u("fastaMsaPt1"),"seq",l.Hi.FASTA,"SEQ.MSA",l.YI.PT,20,!1)})),(0,t.t6)("SepDna",(async()=>{await f(u("sepDna"),"seq",l.Hi.SEPARATOR,"SEQ",l.YI.DNA,4,!1,"*")})),(0,t.t6)("SepRna",(async()=>{await f(u("sepRna"),"seq",l.Hi.SEPARATOR,"SEQ",l.YI.RNA,4,!1,"*")})),(0,t.t6)("SepPt",(async()=>{await f(u("sepPt"),"seq",l.Hi.SEPARATOR,"SEQ",l.YI.PT,20,!1,"-")})),(0,t.t6)("SepUn1",(async()=>{await f(u("sepUn1"),"seq",l.Hi.SEPARATOR,"SEQ",l.YI.UN,8,!0,"-")})),(0,t.t6)("SepUn2",(async()=>{await f(u("sepUn2"),"seq",l.Hi.SEPARATOR,"SEQ",l.YI.UN,9,!0,"/")})),(0,t.t6)("SepMsaN1",(async()=>{await f(u("sepMsaDna1"),"seq",l.Hi.SEPARATOR,"SEQ.MSA",l.YI.DNA,4,!1,"-")})),(0,t.t6)("SepMsaUnWEmpty",(async()=>{await f(u("sepMsaUnWEmpty"),"seq",l.Hi.SEPARATOR,"SEQ.MSA",l.YI.UN,14,!0)})),(0,t.t6)("SepComplex",(async()=>{await f(u("sepComplex"),"seq",l.Hi.SEPARATOR,"SEQ",l.YI.UN,18,!0)})),(0,t.t6)("samplesFastaCsv",(async()=>{await g(o("fastaCsv"),{Sequence:new d(l.Hi.FASTA,"SEQ",l.YI.PT,20,!1)})})),(0,t.t6)("samplesPeptidesComplex",(async()=>{await g(o("peptidesComplex"),{})})),(0,t.t6)("samplesMsaComplex",(async()=>{await g(o("msaComplex"),{MSA:new d(l.Hi.SEPARATOR,"SEQ.MSA",l.YI.UN,161,!0,"/")})})),(0,t.t6)("samplesIdCsv",(async()=>{await g(o("testIdCsv"),{})})),(0,t.t6)("samplesSarSmallCsv",(async()=>{await g(o("testSmilesCsv"),{})})),(0,t.t6)("samplesHelmCsv",(async()=>{await g(o("helmCsv"),{HELM:new d(l.Hi.HELM,null,null,160,!0)})})),(0,t.t6)("samplesTestHelmCsv",(async()=>{await g(o("testHelmCsv"),{"HELM string":new d(l.Hi.HELM,null,null,9,!0)})})),(0,t.t6)("samplesTestDemogCsv",(async()=>{await g(o("testDemogCsv"),{})})),(0,t.t6)("samplesTestSmiles2Csv",(async()=>{await g(o("testSmiles2Csv"),{})})),(0,t.t6)("samplesTestSmilesShort",(async()=>{await g(o("testSmilesShort"),{})})),(0,t.t6)("samplesTestActivityCliffsNegativeSmiles",(async()=>{await g(o("testActivityCliffsCsv"),{})})),(0,t.t6)("samplesFastaPtCsv",(async()=>{await g(o("fastaPtCsv"),{sequence:new d(l.Hi.FASTA,"SEQ",l.YI.PT,20,!1)})})),(0,t.t6)("samplesTestCerealCsv",(async()=>{await g(o("testCerealCsv"),{})})),(0,t.t6)("samplesTestUnichemSources",(async()=>{await g(o("testUnichemSources"),{})})),(0,t.t6)("samplesTestDmvOffices",(async()=>{await g(o("testDmvOffices"),{})})),(0,t.t6)("samplesTestAlertCollection",(async()=>{await g(o("testAlertCollection"),{})})),(0,t.t6)("samplesTestSpgi",(async()=>{await g(o("testSpgi"),{})})),(0,t.t6)("samplesTestSpgi100",(async()=>{await g(o("testSpgi100"),{})})),(0,t.t6)("samplesTestUrl",(async()=>{await g(o("testUrl"),{})}))})),(0,t.L1)("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"},r=t=>async()=>{const r=n[t],i=e.DataFrame.fromCsv(r);return await a.data.detectSemanticTypes(i),i};(0,t.t6)("fastaDnaWeak1",(async()=>{await p(r("fastaDnaWeak1"),"colName")})),(0,t.t6)("fastaDnaWeak1LikelyName",(async()=>{await f(r("fastaDnaWeak1LikelyName"),"seq",l.Hi.FASTA,"SEQ.MSA",l.YI.DNA,4,!1)})),(0,t.t6)("fastaRnaWeak1",(async()=>{await p(r("fastaRnaWeak1"),"colName")})),(0,t.t6)("fastaRnaWeak1LikelyName",(async()=>{await f(r("fastaRnaWeak1LikelyName"),"seq",l.Hi.FASTA,"SEQ.MSA",l.YI.RNA,4,!1)})),(0,t.t6)("fastaPtWeak1",(async()=>{await p(r("fastaPtWeak1"),"colName")})),(0,t.t6)("fastaPtWeak1LikelyName",(async()=>{await f(r("fastaPtWeak1LikelyName"),"seq",l.Hi.FASTA,"SEQ.MSA",l.YI.PT,20,!1)})),(0,t.t6)("fastaUn1",(async()=>{await p(r("fastaUn1"),"colName")})),(0,t.t6)("fastaUn1LikelyName",(async()=>{await p(r("fastaUn1LikelyName"),"seq")})),(0,t.t6)("fastaUn2LikelyName",(async()=>{await p(r("fastaUn2LikelyName"),"protein")})),(0,t.t6)("fastaUnMsa1LikelyName",(async()=>{await p(r("fastaUnMsa1LikelyName"),"seq")}))})),(0,t.L1)("detectorsBenchmark",(()=>{let n;async function r(r,s,o,a,c,d){return await async function(r){const h=await(async()=>{const t=function(t,n,r,i,s){let o;switch(t){case l.Hi.FASTA:o=e=>{let t="";for(let n=0;n<e.length;n++){const r=e[n];t+=1==r.length?r:`[${r}]`}return t};break;case l.Hi.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 r=0;r<t;r++)n[r]=e[Math.floor(Math.random()*e.length)];return o(n,s)},c=Array(i);for(let e=0;e<i;e++)c[e]=a(n,r);return e.Column.fromStrings("seq",c)}(s,[...(0,l.Qf)(o)],a,c,d),r=n.prepare({col:t});return i(r),r})(),p=Date.now(),m=i(h),f=Date.now();(function(e,n){const r=u.GO.forColumn(e);(0,t.E3)(e.semType===n.semType,!0),(0,t.E3)(r.notation===n.notation,!0),(0,t.E3)(r.alphabet===n.alphabet,!0),(0,t.E3)(r.separator===n.separator,!0)})(m,{semType:e.SEMTYPE.MACROMOLECULE,notation:s,alphabet:o,separator:d});const g=f-p;if(g>r){const e=`ET ${g} ms is more than max allowed ${r} ms.`;throw console.error(e),new Error(e)}return console.log(`ET ${g} ms is OK.`),g}(r)}function i(e){e.callSync();const t=e.getOutputParamValue(),n=e.inputs.col;return t&&(n.semType=t),n}(0,t.gM)((async()=>{const t=e.Func.find({package:"Bio",name:"detectMacromolecule"});n=t[0];const r=e.Column.fromStrings("seq",["ACGT","ACGT","ACGT"]);await n.prepare({col:r}).call()})),(0,t.t6)("fastaDnaShorts50Few50",(async()=>{await r(10,l.Hi.FASTA,l.YI.DNA,50,50)})),(0,t.t6)("fastaDnaShorts50Many1E6",(async()=>{await r(20,l.Hi.FASTA,l.YI.DNA,50,1e6)})),(0,t.t6)("fastaDnaLong1e6Few50",(async()=>{await r(20,l.Hi.FASTA,l.YI.DNA,1e6,50)})),(0,t.t6)("separatorDnaShorts50Few50",(async()=>{await r(10,l.Hi.SEPARATOR,l.YI.DNA,50,50,"/")})),(0,t.t6)("separatorDnaShorts50Many1E6",(async()=>{await r(20,l.Hi.SEPARATOR,l.YI.DNA,50,1e6,"/")})),(0,t.t6)("separatorDnaLong1e6Few50",(async()=>{await r(20,l.Hi.SEPARATOR,l.YI.DNA,1e6,50,"/")}))}));var y=n(608),w=n(1619),b=n(6740);async function v(n,r){const i=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(i);const s=e.DataFrame.fromCsv(r),o=i.getCol("seq");(0,t.E3)(o.semType,e.SEMTYPE.MACROMOLECULE);const c=s.getCol("seq"),l=await(0,y.eE)(o,!0);(0,t.J6)(l.toList(),c.toList())}async function A(n,r,i,s,o,c){const u=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(u);const d=e.DataFrame.fromCsv(r).getCol("seq"),h=u.getCol("seq");(0,t.E3)(h.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(h.meta.units,i),o&&(0,t.E3)(h.getTag(l.gp.alphabet),o);const p=await(0,w.D)({col:h,pepsea:{method:c}});(0,t.E3)(p.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(p.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(p.meta.units,s),(0,t.E3)(p.getTag(l.gp.aligned),"SEQ.MSA"),o&&(0,t.E3)(p.getTag(l.gp.alphabet),o),(0,t.J6)(p.toList(),d.toList())}(0,t.L1)("MSA",(async()=>{(0,t.t6)("isCorrect",(async()=>{await v("seq\nFWRWYVKHP\nYNRWYVKHP\nMWRSWYCKHP","seq\nFWR-WYVKHP\nYNR-WYVKHP\nMWRSWYCKHP")})),(0,t.t6)("isCorrectLong",(async()=>{await v("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.t6)("isCorrectHelm",(async()=>{await(0,b.m8)(),await A("seq\n PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2}$$$$\n PEPTIDE1{meI.Aca.N.T.dE.Thr_PO3H2}$$$$\n PEPTIDE1{hHis.Aca.N.T.dE.Thr_PO3H2}$$$$","seq\n meI.hHis.Aca.N.T.dE.Thr_PO3H2\n .meI.Aca.N.T.dE.Thr_PO3H2\n .hHis.Aca.N.T.dE.Thr_PO3H2",l.Hi.HELM,l.Hi.SEPARATOR,void 0,"mafft")}),{timeout:6e4}),(0,t.t6)("isCorrectHelmLong",(async()=>{await(0,b.m8)(),await A("seq\n PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.dV.E.N.D-Orn.D-aThr.Phe_4Me.Thr_PO3H2}$$$$\n PEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Tyr_PO3H2.D-Chg.dV.Phe_ab-dehydro.N.D-Orn.D-aThr.Phe_4Me}$$$$\n PEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me}$$$$","seq\n meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.dV.E.N.D-Orn.D-aThr.Phe_4Me.Thr_PO3H2\n meI.hHis.Aca.Cys_SEt.T.dK..Tyr_PO3H2.D-Chg.dV.Phe_ab-dehydro.N.D-Orn.D-aThr.Phe_4Me.\n Lys_Boc.hHis.Aca.Cys_SEt.T.dK..Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me.",l.Hi.HELM,l.Hi.SEPARATOR,void 0,"mafft")}),{timeout:6e4}),(0,t.t6)("isCorrectSeparator",(async()=>{await A("seq\n F-W-P-H-E-Y\n Y-N-R-Q-W-Y-V\n M-K-P-S-E-Y-V","seq\n FWPHEY-\n YNRQWYV\n MKPSEYV",l.Hi.SEPARATOR,l.Hi.FASTA,l.YI.PT)})),(0,t.t6)("isCorrectSeparatorLong",(async()=>{await A("seq\n M-I-E-V-F-L-F-G-I-V-L-G-L-I-P-I-T-L-A-G-L-F-V-T-A-Y-L-Q-Y-R-R-G-D-Q-L-D-L\n M-M-E-L-V-L-K-T-I-I-G-P-I-V-V-G-V-V-L-R-I-V-D-K-W-L-N-K-D-K\n M-D-R-T-D-E-V-S-N-H-T-H-D-K-P-T-L-T-W-F-E-E-I-F-E-E-Y-H-S-P-F-H-N","seq\n MIEV-FLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL\n MMEL-VLKTII-GPIVVGVVLRIVDKWLNKDK------\n MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN-----",l.Hi.SEPARATOR,l.Hi.FASTA,l.YI.PT)}))}));var E=n(1991),C=n.n(E),T=n(5785),S=n(6642);async function _(t){const n=await async function(e){return await _e.files.readAsText(e)}(t),r=e.DataFrame.fromCsv(n);return r.name=t.replace(".csv",""),r}async function x(e,n=5e3){await(0,t.cb)(0),await(0,t.PE)(e.onAfterDrawContent,(()=>{}),(()=>{e.invalidate()}),n);const r=e.columns.length;for(let t=0;t<r;++t){const n=e.columns.byIndex(t);if(n){const t=e.cell(n.name,0),[r,o,a]=(0,S.h)(t),c=(void 0,(s=i=a.rendererBack)&&void 0!==s.onRendered&&void 0!==s.invalidate&&void 0!==s.awaitRendered?i:null);c&&await c.awaitRendered()}}var i,s}var P=n(4139),M=n(9322);async function $(e,n){const r=(0,l.J9)(e);console.debug(`Bio: tests: splitters: src=${JSON.stringify(e)}, res=${JSON.stringify(r)} .`),(0,t.J6)(C()(r.originals).toArray(),n)}async function N(e,n){const r=(0,M.qp)(e);console.debug(`Bio: tests: splitters: src=${JSON.stringify(e)}, res=${JSON.stringify(r)} .`),(0,t.J6)(C()(r.originals).toArray(),n)}(0,t.L1)("splitters",(async()=>{(0,t.gM)((async()=>{})),(0,t.Pl)((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"]],r=["[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"]],i=["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"]],s=["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)"]],d=["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.t6)("fastaMulti",(async()=>{await $(n[0],n[1])})),(0,t.t6)("fastaFromHelm",(async()=>{await $(r[0],r[1])})),(0,t.t6)("helm1",(async()=>{await N(i[0],i[1])})),(0,t.t6)("helm2",(async()=>{await N(s[0],s[1])})),(0,t.t6)("helm3-multichar",(async()=>{await N(o[0],o[1])})),(0,t.t6)("testHelm1",(async()=>{await N(u[0],u[1])})),(0,t.t6)("testHelm2",(async()=>{await N(d[0],d[1])})),(0,t.t6)("testHelm3",(async()=>{await N(h[0],h[1])})),(0,t.t6)("splitToMonomers",(async()=>{const e=await a.dapi.files.readCsv("System:AppData/Bio/samples/MSA.csv"),n=e.getCol("MSA"),r=await a.functions.call("Bio:detectMacromolecule",{col:n});r&&(n.semType=r),n.setTag(l.gp.aligned,P.gN);const i=await(0,T.k)(e,n);(0,t.E3)(i.columns.names().includes("17"),!0),await a.data.detectSemanticTypes(i);const s=a.shell.addTableView(i);await x(s.grid),(0,t.E3)(s.grid.dataFrame.id,e.id)})),(0,t.t6)("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"],r=t.getCol("HELM"),i=(0,c.getHelmMonomers)(r),s=n.filter((e=>!i.includes(e))),o=i.filter((e=>!n.includes(e)));if(s.length>0||o.length){const e=[];throw s.length>0&&e.push(`Missed monomers ${JSON.stringify(s)}.`),o.length>0&&e.push(`Unexpected monomers ${JSON.stringify(o)}.`),new Error(e.join(" "))}}))}));var L=n(6718),I=n(4356);const R={PEPTIDE:324,RNA:383,CHEM:0};(0,t.L1)("monomerLibraries",(()=>{let e,n=null;(0,t.gM)((async()=>{e=await(0,L.pj)(),n=(0,I.ub)()})),(0,t.Pl)((async()=>{await(0,I.Eu)(n)})),(0,t.t6)("default",(async()=>{await(0,I.Eu)({exclude:[],explicit:[],duplicateMonomerPreferences:{}}),await e.loadLibraries(!0);const n=e.getMonomerLib();(0,t.E3)(n.getPolymerTypes().length>0,!0)})),(0,t.t6)("forTests",(async()=>{await(0,I.yZ)(),await e.loadMonomerLib(!0),function(e){const n=R,r=e.getSummaryObj();for(const e in n)n[e]||delete n[e];for(const e in r)r[e]||delete r[e];if(0==Object.keys(n).length&&0!=Object.keys(r).length)throw new Error("Expected empty monomer lib, actual is not.");if(0!=Object.keys(n).length&&0==Object.keys(r).length)throw new Error("Expected non-empty monomer lib, actual is empty.");try{(0,t.Xk)(r,n),(0,t.Xk)(n,r)}catch(e){throw new Error(`Expected monomer lib ${JSON.stringify(n)} does not match actual ${JSON.stringify(r)}.`)}}(e.getMonomerLib())})),(0,t.t6)("empty",(async()=>{const n=await(0,I.ub)(),r=await e.getFileManager();let i=r.getValidLibraryPaths();0===i.length&&(i=await r.getValidLibraryPathsAsynchronously()),n.exclude=i,n.explicit=[],await(0,I.Eu)(n),await e.loadMonomerLib(!0);const s=e.getMonomerLib().getPolymerTypes();(0,t.E3)(0===s.length,!0)}))}));var O=n(7389),k=n(1757),G=n.n(k),H=n(1858),D=n(6873),F=n(5433);async function U(n,r){const i=n(),s=e.DataFrame.fromColumns(i);await a.data.detectSemanticTypes(s);const o=Date.now(),c=(s.columns.byName("MSA"),a.shell.addTableView(s));await x(c.grid),(0,t.E3)(c.grid.dataFrame.id,s.id);const l=Date.now()-o;console.log(`Performance test: ${r}: ${l}ms`)}(0,t.L1)("renderers",(()=>{(0,t.t6)("long sequence performance ",(async()=>{await U(D.dW,"Long sequences")})),(0,t.t6)("many sequence performance",(async()=>{await U(D.fD,"Many sequences")})),(0,t.t6)("rendererMacromoleculeFasta",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA.csv"),r=e.DataFrame.fromCsv(n),i=r.getCol("Sequence"),s=await a.functions.call("Bio:detectMacromolecule",{col:i});s&&(i.semType=s);const o=a.shell.addTableView(r);await a.data.detectSemanticTypes(r),await x(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id);const c=i.getTag(e.TAGS.CELL_RENDERER);(0,t.E3)(c,"sequence")}()})),(0,t.t6)("rendererMacromoleculeSeparator",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/SEPARATOR_PT.csv"),r=e.DataFrame.fromCsv(n),i=r.getCol("sequence"),s=await a.functions.call("Bio:detectMacromolecule",{col:i});s&&(i.semType=s);const o=a.shell.addTableView(r);await a.data.detectSemanticTypes(r),await x(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id);const c=i.getTag(e.TAGS.CELL_RENDERER);(0,t.E3)(c,"sequence")}()})),(0,t.t6)("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.meta.units=l.Hi.SEPARATOR,n.setTag(l.gp.separator,"/"),n.setTag(l.gp.aligned,"SEQ"),n.setTag(l.gp.alphabet,"UN"),n.setTag(l.gp.alphabetIsMultichar,"true"),n.semType=P.uF.MACROMOLECULE_DIFFERENCE;const r=e.DataFrame.fromColumns([n]),i=a.shell.addTableView(r);await a.data.detectSemanticTypes(r),await x(i.grid),(0,t.E3)(i.grid.dataFrame.id,r.id);const s=n.getTag(e.TAGS.CELL_RENDERER);(0,t.E3)(s,P.uF.MACROMOLECULE_DIFFERENCE)}()})),(0,t.t6)("afterMsa",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA.fasta"),r=(0,c.importFasta)(n)[0],i=r.getCol("sequence"),s=await a.functions.call("Bio:detectMacromolecule",{col:i});s&&(i.semType=s);const o=a.shell.addTableView(r);await a.data.detectSemanticTypes(r),console.log("Bio: tests/renderers/afterMsa, table view"),await x(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id),console.log(`Bio: tests/renderers/afterMsa, src before test semType="${i.semType}", units="${i.meta.units}", cell.renderer="${i.getTag(e.TAGS.CELL_RENDERER)}"`),(0,t.E3)(i.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(i.meta.units,l.Hi.FASTA),(0,t.E3)(i.getTag(l.gp.aligned),"SEQ"),(0,t.E3)(i.getTag(l.gp.alphabet),l.YI.PT),(0,t.E3)(i.getTag(e.TAGS.CELL_RENDERER),"sequence");const d=await(0,w.D)({col:i});await x(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id),(0,t.E3)(d.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(d.meta.units,l.Hi.FASTA),(0,t.E3)(d.getTag(l.gp.aligned),"SEQ.MSA"),(0,t.E3)(d.getTag(l.gp.alphabet),l.YI.PT),(0,t.E3)(d.getTag(e.TAGS.CELL_RENDERER),"sequence"),u.GO.forColumn(d)}()})),(0,t.t6)("afterConvert",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA_PT.csv"),r=e.DataFrame.fromCsv(n),i=r.getCol("sequence"),s=await a.functions.call("Bio:detectMacromolecule",{col:i});s&&(i.semType=s);const o=a.shell.addTableView(r);await a.data.detectSemanticTypes(r);const c=await(0,F.r)(i,l.Hi.SEPARATOR,"/");await x(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id);const d=c.getTag(e.TAGS.CELL_RENDERER);(0,t.E3)(d,"sequence"),u.GO.forColumn(c)}()})),(0,t.t6)("afterConvertToHelm",(async()=>{await async function(){const n=await a.dapi.files.readCsv("System:AppData/Bio/samples/FASTA_PT.csv"),r=a.shell.addTableView(n);await x(r.grid);const i=n.getCol("sequence"),s=u.GO.forColumn(i).convert(l.Hi.HELM);n.columns.add(s),await x(r.grid),(0,t.E3)(s.getTag(e.TAGS.CELL_RENDERER),"helm")}()})),(0,t.t6)("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.meta.units=l.Hi.SEPARATOR,n.setTag(l.gp.separator,"/"),n.setTag(l.gp.aligned,"SEQ"),n.setTag(l.gp.alphabet,"UN"),n.setTag(l.gp.alphabetIsMultichar,"true"),n.semType=P.uF.MACROMOLECULE_DIFFERENCE;const r=e.DataFrame.fromColumns([n]);a.shell.addTableView(r),await(0,t.cb)(100);const i=n.getTag(e.TAGS.CELL_RENDERER);if("MacromoleculeDifference"!==i)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 '${i}' instead of correct 'MacromoleculeDifference'.`)}()})),(0,t.t6)("scatterPlotTooltip",(async()=>{await async function(){const r=e.DataFrame.fromCsv(n);r.currentRowIdx=0;const i=a.shell.addTableView(r),s=r.plot.scatter({x:"x",y:"y"});i.dockManager.dock(s,e.DOCK_TYPE.RIGHT,null),await Promise.all([(0,t.PE)(s.onAfterDrawScene,(()=>{}),(()=>{s.invalidateCanvas()}),1e3),x(i.grid,500)]);const o=s.root.getBoundingClientRect(),c=s.worldToScreen(1,0),l=new MouseEvent("mousemove",{cancelable:!0,bubbles:!0,view:window,button:0,clientX:o.left+c.x,clientY:o.top+c.y}),u=G()(s.root).find("canvas").get()[0];await(0,t.PE)((0,H.fromEvent)(u,"mousemove"),(()=>{_e.logger.debug(`Test: event, currentRowIdx=${r.currentRowIdx}`),(0,t.E3)(G()(O.tooltip.root).find("div table.d4-row-tooltip-table tr td canvas").length,1),(0,t.E3)(s.hitTest(c.x,c.y),1)}),(()=>{u.dispatchEvent(l)}),500),await x(i.grid,500)}()}));const n="seq,x,y\nACGGTGTCGT,0,0\nCGGTATCCCT,1,0\nCTCGGCATGC,2,0\n"}));var V=n(6882);(0,t.L1)("renderers: monomerPlacer",(()=>{let n,r;(0,t.gM)((async()=>{n=await(0,L.pj)(),r=await(0,I.ub)(),await(0,I.yZ)(),await n.awaitLoaded(),await n.loadMonomerLib(!0)})),(0,t.Pl)((async()=>{await(0,I.Eu)(r),await n.loadMonomerLib(!0)}));const i={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,r]of Object.entries(i))(0,t.t6)(`getPosition-${n}`,(async()=>{const t=e.DataFrame.fromCsv(r.csv);await a.data.detectSemanticTypes(t);const n=t.getCol("seq"),i=new V.J(null,n,_e.logger,3,(()=>({seqHandler:u.GO.forColumn(n),monomerCharWidth:7,separatorWidth:12,monomerToShort:l.zS}))),s=r.testList;for(let e=0;e<n.length;++e)i.getCellMonomerLengths(e,1e4);const o=[];for(const[e,t]of C().enumerate(s)){const t={pos:i.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.L1)("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[r,i]of Object.entries(n))(0,t.t6)("hitBounds-"+r,(async()=>{const n=(0,V.B)(e,i.x);(0,t.E3)(n,i.tgt)}))})),(0,t.L1)("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 r={[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}$$$$"},i=new Set(Object.values(l.gp));async function s(t){const n=r[t],i=e.DataFrame.fromCsv(n);return await a.data.detectSemanticTypes(i),i}function o(e,n){if(e===l.Hi.SEPARATOR&&!n)throw new Error(`Argument 'separator' is mandatory for target notation '${e.toString()}'.`);return function(r){const i=u.GO.forColumn(r).convert(e,n);return(0,t.E3)(i.meta.units,e),i}}async function c(e,n,r){const o=(await s(e)).getCol("seq"),a=n(o),c=(await s(r)).getCol("seq");(0,t.J6)(a.toList(),c.toList());const d=u.GO.forColumn(o),h=u.GO.forColumn(a);for(const[e,n]of Object.entries(c.tags)){if(!i.has(e)||d.notation===l.Hi.HELM&&[l.gp.alphabet,l.gp.alphabetIsMultichar].includes(e)||h.notation===l.Hi.HELM&&[l.gp.alphabet,l.gp.alphabetIsMultichar].includes(e))continue;const r=a.getTag(e);(0,t.E3)(r,n,`Tag '${e}' expected value '${n}' is not equal to actual '${r}'.`)}}(0,t.t6)("testFastaPtToSeparator",(async()=>{await c(n.fastaPt,o(l.Hi.SEPARATOR,"-"),n.separatorPt)})),(0,t.t6)("testFastaDnaToSeparator",(async()=>{await c(n.fastaDna,o(l.Hi.SEPARATOR,"/"),n.separatorDna)})),(0,t.t6)("testFastaRnaToSeparator",(async()=>{await c(n.fastaRna,o(l.Hi.SEPARATOR,"*"),n.separatorRna)})),(0,t.t6)("testFastaGapsToSeparator",(async()=>{await c(n.fastaGaps,o(l.Hi.SEPARATOR,"/"),n.separatorGaps)})),(0,t.t6)("testFastaUnToSeparator",(async()=>{await c(n.fastaUn,o(l.Hi.SEPARATOR,"-"),n.separatorUn)})),(0,t.t6)("testFastaPtToHelm",(async()=>{await c(n.fastaPt,o(l.Hi.HELM),n.helmPt)})),(0,t.t6)("testFastaDnaToHelm",(async()=>{await c(n.fastaDna,o(l.Hi.HELM),n.helmDna)})),(0,t.t6)("testFastaRnaToHelm",(async()=>{await c(n.fastaRna,o(l.Hi.HELM),n.helmRna)})),(0,t.t6)("testFastaGapsToHelm",(async()=>{await c(n.fastaGaps,o(l.Hi.HELM),n.helmGaps)})),(0,t.t6)("testSeparatorPtToFasta",(async()=>{await c(n.separatorPt,o(l.Hi.FASTA),n.fastaPt)})),(0,t.t6)("testSeparatorDnaToFasta",(async()=>{await c(n.separatorDna,o(l.Hi.FASTA),n.fastaDna)})),(0,t.t6)("testSeparatorRnaToFasta",(async()=>{await c(n.separatorRna,o(l.Hi.FASTA),n.fastaRna)})),(0,t.t6)("testSeparatorGapsToFasta",(async()=>{await c(n.separatorGaps,o(l.Hi.FASTA),n.fastaGaps)})),(0,t.t6)("testSeparatorUnToFasta",(async()=>{await c(n.separatorUn,o(l.Hi.FASTA),n.fastaUn)})),(0,t.t6)("testSeparatorPtToHelm",(async()=>{await c(n.separatorPt,o(l.Hi.HELM),n.helmPt)})),(0,t.t6)("testSeparatorDnaToHelm",(async()=>{await c(n.separatorDna,o(l.Hi.HELM),n.helmDna)})),(0,t.t6)("testSeparatorRnaToHelm",(async()=>{await c(n.separatorRna,o(l.Hi.HELM),n.helmRna)})),(0,t.t6)("testSeparatorGapsToHelm",(async()=>{await c(n.separatorGaps,o(l.Hi.HELM),n.helmGaps)})),(0,t.t6)("testHelmDnaToFasta",(async()=>{await c(n.helmDna,o(l.Hi.FASTA),n.fastaDna)})),(0,t.t6)("testHelmRnaToFasta",(async()=>{await c(n.helmRna,o(l.Hi.FASTA),n.fastaRna)})),(0,t.t6)("testHelmPtToFasta",(async()=>{await c(n.helmPt,o(l.Hi.FASTA),n.fastaPt)})),(0,t.t6)("testHelmUnToFasta",(async()=>{await c(n.helmUn,o(l.Hi.FASTA),n.fastaUn)})),(0,t.t6)("testHelmDnaToSeparator",(async()=>{await c(n.helmDna,o(l.Hi.SEPARATOR,"/"),n.separatorDna)})),(0,t.t6)("testHelmRnaToSeparator",(async()=>{await c(n.helmRna,o(l.Hi.SEPARATOR,"*"),n.separatorRna)})),(0,t.t6)("testHelmPtToSeparator",(async()=>{await c(n.helmPt,o(l.Hi.SEPARATOR,"-"),n.separatorPt)})),(0,t.t6)("testHelmUnToSeparator",(async()=>{await c(n.helmUn,o(l.Hi.SEPARATOR,"-"),n.separatorUn)})),(0,t.t6)("testHelmLoneRibose",(async()=>{await c(n.helmLoneRibose,o(l.Hi.FASTA),n.fastaRna)})),(0,t.t6)("testHelmLoneDeoxyribose",(async()=>{await c(n.helmLoneDeoxyribose,o(l.Hi.SEPARATOR,"/"),n.separatorDna)})),(0,t.t6)("testHelmLonePhosphorus",(async()=>{await c(n.helmLonePhosphorus,o(l.Hi.FASTA),n.fastaRna)}))}));var Y=n(3516);(0,t.L1)("fastaFileHandler",(()=>{const n=["description:1","description:2","description:3","description:4"],r=(e.Column.fromStrings("description",n),["MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW","MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL","MMELVLKTIIGPIVVGVVLRIVDKWLNKDK","MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN"]);function i(e){const i=new Y.m(e),s=i.descriptionsArray,o=i.sequencesArray;(0,t.J6)([s,o],[n,r])}(0,t.t6)("testNormalFormatting",(async()=>{i(">description:1\nMDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\n\n>description:2\nMIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL\n\n>description:3\nMMELVLKTIIGPIVVGVVLRIVDKWLNKDK\n\n>description:4\nMDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN\n")})),(0,t.t6)("testExtraSpaces",(async()=>{i(">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.t6)("testExtraNewlines",(async()=>{i(">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 B=n(3890);(0,t.L1)("fastaExport",(()=>{let n;!function(e){e.single="single",e.multi="multi"}(n||(n={}));const r={[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 i;!function(e){e.test1="test1",e.test2="test2"}(i||(i={}));const s={[i.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"},[i.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,i=10){const s=r[n].src,o=e.Column.fromStrings("src",[s]);o.semType=e.SEMTYPE.MACROMOLECULE,o.meta.units=l.Hi.FASTA;const a=u.GO.forColumn(o).getSplitted(0),c=(0,B.aS)(a,i),d=r[n].tgt;(0,t.J6)(c,d)}async function a(n){const r=e.DataFrame.fromCsv(n.srcCsv),i=r.getCol(n.seqCol);i.semType=e.SEMTYPE.MACROMOLECULE,i.meta.units=l.Hi.FASTA;const s=n.idCols.map((e=>r.getCol(e))),o=(0,B.wz)(s,i,n.lineWidth);(0,t.E3)(o,n.tgtFasta)}(0,t.t6)("wrapSequenceSingle",(async()=>{o(n.single,10)})),(0,t.t6)("wrapSequenceMulti",(async()=>{o(n.multi,10)})),(0,t.t6)("saveAsFastaTest1",(async()=>{a(s[i.test1])})),(0,t.t6)("saveAsFastaTest2",(async()=>{a(s[i.test2])}))}));var W=n(4152),j=n(2738);const K=j._S;(0,t.L1)("bio",(()=>{const n="seq\nACGTCT\nCAGTGT\nTTCAAC";(0,t.t6)("testGetStatsHelm1",(async()=>{const n=e.DataFrame.fromCsv("seq\nPEPTIDE1{meI}$$$$").getCol("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.meta.units=l.Hi.HELM;const r=(0,M.vZ)(n,1,l.qp);(0,t.Xk)(r.freq,{meI:1}),(0,t.E3)(r.sameLength,!0)})),(0,t.t6)("testGetStatsN1",(async()=>{await async function(n){const r=e.DataFrame.fromCsv(n).col("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=l.Hi.FASTA;const i=(0,M.vZ)(r,5,l.J9);(0,t.Xk)(i.freq,{A:4,C:5,G:3,T:6}),(0,t.E3)(i.sameLength,!0)}(n)})),(0,t.t6)("testGetAlphabetSimilarity",(async()=>{await async function(){const e={A:2041,C:3015,G:3015,T:2048,[K]:1e3},n=new Set(Object.keys(o.Q.Names)),r=(0,l.nq)(e,n);(0,t.E3)(r>.6,!0)}()})),(0,t.t6)("testPickupPaletteN1",(async()=>{await async function(n){const r=e.DataFrame.fromCsv(n).col("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=l.Hi.FASTA;const i=(0,l.SM)(r);(0,t.E3)(i instanceof o.A,!0)}(n)})),(0,t.t6)("testPickupPaletteN1e",(async()=>{await async function(){const n=e.DataFrame.fromCsv("seq\nACGTAT\nCAGTTG\nTTCG2C").col("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.meta.units=l.Hi.FASTA;const r=(0,l.SM)(n);(0,t.E3)(r instanceof o.A,!0)}()})),(0,t.t6)("testPickupPaletteAA1",(async()=>{await async function(){const n=e.DataFrame.fromCsv("seq\nFWPHEYV\nYNRQWYV\nMKPSEYV").col("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.meta.units=l.Hi.FASTA;const r=(0,l.SM)(n);(0,t.E3)(r instanceof i.X,!0)}()})),(0,t.t6)("testPickupPaletteX",(async()=>{await async function(){const n=e.DataFrame.fromCsv("seq\nXZJ{}2\n5Z4733\n3Z6></\n675687").col("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.meta.units=l.Hi.FASTA;const r=(0,l.SM)(n);(0,t.E3)(r instanceof W.$u,!0)}()}))})),(0,t.L1)("WebLogo.monomerToShort",(()=>{(0,t.t6)("longMonomerSingle",(async()=>{(0,t.E3)((0,l.zS)("S",5),"S")})),(0,t.t6)("longMonomerShort",(async()=>{(0,t.E3)((0,l.zS)("Short",5),"Short")})),(0,t.t6)("longMonomerLong56",(async()=>{(0,t.E3)((0,l.zS)("Long56",6),"Long56")})),(0,t.t6)("longMonomerComplexFirstPartShort",(async()=>{(0,t.E3)((0,l.zS)("Long-long",5),"Long…")})),(0,t.t6)("longMonomerComplexFirstPartLong56",(async()=>{(0,t.E3)((0,l.zS)("Long56-long",6),"Long5…")})),(0,t.t6)("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])),r=e.map((e=>e[1])),i=n.map((e=>(0,l.zS)(e,3)));(0,t.J6)(i,r)}))}));var q=n(8047);const z=j._S;function Z(e,n){(0,t.E3)(e.name,n.name),(0,t.J6)(e.getMonomers(),n.getMonomers());for(const r of e.getMonomers())(0,t.E3)(e.getFreq(r).rowCount,n.getFreq(r).rowCount)}(0,t.L1)("WebLogo-positions",(()=>{const n="seq\nATC-G-TTGC--\nATC-G-TTGC--\n-TC-G-TTGC--\n-TC-GCTTGC--\n-TC-GCTTGC--";(0,t.t6)("allPositions",(async()=>{const r=e.DataFrame.fromCsv(n),i=a.shell.addTableView(r),s=r.getCol("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.meta.units=l.Hi.FASTA,s.setTag(l.gp.alphabet,l.YI.DNA),s.setTag(l.gp.aligned,"SEQ.MSA");const o=await r.plot.fromType("WebLogo");await(0,t.PE)(o.onLayoutCalculated,(()=>{}),(()=>{i.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const c=o.positions,u=[new q.Ue(0,"1",{A:new q.Tc(2),[z]:new q.Tc(3)}),new q.Ue(1,"2",{T:new q.Tc(5)}),new q.Ue(2,"3",{C:new q.Tc(5)}),new q.Ue(3,"4",{[z]:new q.Tc(5)}),new q.Ue(4,"5",{G:new q.Tc(5)}),new q.Ue(5,"6",{[z]:new q.Tc(3),C:new q.Tc(2)}),new q.Ue(6,"7",{T:new q.Tc(5)}),new q.Ue(7,"8",{T:new q.Tc(5)}),new q.Ue(8,"9",{G:new q.Tc(5)}),new q.Ue(9,"10",{C:new q.Tc(5)}),new q.Ue(10,"11",{[z]:new q.Tc(5)}),new q.Ue(11,"12",{[z]:new q.Tc(5)})];(0,t.E3)(c.length,u.length);for(let e=0;e<c.length;e++){(0,t.E3)(c[e].name,u[e].name);for(const n of c[e].getMonomers())(0,t.E3)(c[e].getFreq(n).rowCount,u[e].getFreq(n).rowCount)}await o.awaitRendered()})),(0,t.t6)("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-"),r=a.shell.addTableView(n),i=n.getCol("seq");i.semType=e.SEMTYPE.MACROMOLECULE,i.meta.units=l.Hi.FASTA,i.setTag(l.gp.alphabet,l.YI.DNA),i.setTag(l.gp.aligned,"SEQ"),n.filter.init((e=>e>2)),n.filter.fireChanged();const s=await n.plot.fromType("WebLogo",{shrinkEmptyTail:!0});await(0,t.PE)(s.onLayoutCalculated,(()=>{}),(()=>{r.dockManager.dock(s.root,e.DOCK_TYPE.DOWN)}),500);const o=s.positions,c=[new q.Ue(0,"1",{[z]:new q.Tc(3)}),new q.Ue(1,"2",{T:new q.Tc(3)}),new q.Ue(2,"3",{[z]:new q.Tc(3)}),new q.Ue(3,"4",{[z]:new q.Tc(3)}),new q.Ue(4,"5",{C:new q.Tc(3)}),new q.Ue(5,"6",{[z]:new q.Tc(2),C:new q.Tc(1)}),new q.Ue(6,"7",{G:new q.Tc(3)}),new q.Ue(7,"8",{T:new q.Tc(3)}),new q.Ue(8,"9",{[z]:new q.Tc(3)})];(0,t.E3)(o.length,c.length);for(let e=0;e<o.length;e++){(0,t.E3)(o[e].name,c[e].name);for(const n of o[e].getMonomers())(0,t.E3)(o[e].getFreq(n).rowCount,c[e].getFreq(n).rowCount)}await s.awaitRendered()})),(0,t.t6)("positions with skipEmptyPositions option",(async()=>{const r=e.DataFrame.fromCsv(n),i=a.shell.addTableView(r),s=r.getCol("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.meta.units=l.Hi.FASTA,s.setTag(l.gp.alphabet,l.YI.DNA),s.setTag(l.gp.aligned,"SEQ.MSA");const o=await r.plot.fromType("WebLogo",{skipEmptyPositions:!0});await(0,t.PE)(o.onLayoutCalculated,(()=>{}),(()=>{i.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const c=o.positions,u=[new q.Ue(0,"1",{A:new q.Tc(2),[z]:new q.Tc(3)}),new q.Ue(1,"2",{T:new q.Tc(5)}),new q.Ue(2,"3",{C:new q.Tc(5)}),new q.Ue(4,"5",{G:new q.Tc(5)}),new q.Ue(5,"6",{[z]:new q.Tc(3),C:new q.Tc(2)}),new q.Ue(6,"7",{T:new q.Tc(5)}),new q.Ue(7,"8",{T:new q.Tc(5)}),new q.Ue(8,"9",{G:new q.Tc(5)}),new q.Ue(9,"10",{C:new q.Tc(5)})];(0,t.E3)(c.length,u.length);for(let e=0;e<c.length;e++)Z(c[e],u[e]);await o.awaitRendered()})),(0,t.t6)("count sequences for monomer at position",(async()=>{const r=function(t,n,r){const i=e.DataFrame.fromCsv(t),s=i.getCol("seq");return s.semType=e.SEMTYPE.MACROMOLECULE,s.meta.units=n,s.setTag(l.gp.alphabet,r),s.setTag(l.gp.aligned,"SEQ.MSA"),i}(n,l.Hi.FASTA,l.YI.DNA),i=r.getCol("seq"),s=a.shell.addTableView(r),o=await r.plot.fromType("WebLogo",{startPositionName:"3",endPositionName:"7",skipEmptyPositions:!0});await(0,t.PE)(o.onLayoutCalculated,(()=>{}),(()=>{s.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const c=o.positions,d=[new q.Ue(2,"3",{C:new q.Tc(5)}),new q.Ue(4,"5",{G:new q.Tc(5)}),new q.Ue(5,"6",{[z]:new q.Tc(3),C:new q.Tc(2)}),new q.Ue(6,"7",{T:new q.Tc(5)})];(0,t.E3)(c.length,d.length);for(let e=0;e<c.length;e++)Z(c[e],d[e]);const h=c[1],p=u.GO.forColumn(i),m=(0,q.eN)(r,p,r.filter,"G",h);(0,t.E3)(m,5),await o.awaitRendered()})),(0,t.t6)("empty",(async()=>{const n=e.DataFrame.fromColumns([(()=>{const t=e.Column.fromStrings("seq",[]);return t.semType=e.SEMTYPE.MACROMOLECULE,t.meta.units=l.Hi.FASTA,t.setTag(l.gp.alphabet,l.YI.DNA),t})()]),r=a.shell.addTableView(n),i=await n.plot.fromType("WebLogo");await(0,t.PE)(i.onLayoutCalculated,(()=>{}),(()=>{r.dockManager.dock(i.root,e.DOCK_TYPE.DOWN)}),500),i.positions,await i.awaitRendered()}))})),(0,t.L1)("WebLogo-project",(()=>{(0,t.t6)("fasta",(async()=>{const n="Tests.Bio.WebLogo-project.fasta",r=await _e.files.readCsv("tests/filter_FASTA.csv"),i=r.name,s=r.getCol("fasta");await a.data.detectSemanticTypes(r);const o=a.shell.addTableView(r),c=await r.plot.fromType("WebLogo",{sequenceColumnName:s.name});o.dockManager.dock(c),await c.awaitRendered(),await x(o.grid),await async function(t,n,r,i){const s=e.Project.create(),o=r.saveLayout();s.name=t,s.addChild(n),s.addChild(o),await a.dapi.layouts.save(r.saveLayout()),await a.dapi.tables.uploadDataFrame(i),await a.dapi.tables.save(n),await a.dapi.projects.save(s)}(n,r.getTableInfo(),o,r),a.shell.closeAll(),await(0,t.cb)(500),await a.dapi.projects.open(n);const l=a.shell.getTableView(i),u=C()(l.viewers).toArray();(0,t.E3)(u.length,2),(0,t.E3)(u.filter((e=>"Grid"===e.type)).length,1);const d=u.find((e=>"WebLogo"===e.type));(0,t.E3)(!!d,!0),await x(o.grid),await d.awaitRendered()}),{skipReason:"depends on 1.18"})})),(0,t.L1)("WebLogo-layout",(()=>{(0,t.t6)("fasta",(async()=>{const e=await _e.files.readCsv("tests/filter_FASTA.csv"),n=e.getCol("fasta");await a.data.detectSemanticTypes(e);const r=a.shell.addTableView(e),i=await e.plot.fromType("WebLogo",{sequenceColumnName:n.name});r.dockManager.dock(i),await(0,t.cb)(2*q.VN.render),await i.awaitRendered(),await x(r.grid);const s=r.saveLayout();s.toJson(),r.loadLayout(s),await(0,t.cb)(2*q.VN.render),await i.awaitRendered(),await x(r.grid);const o=C()(r.viewers).toArray();(0,t.E3)(o.length,2),(0,t.E3)(o.filter((e=>"Grid"===e.type)).length,1),(0,t.E3)(o.filter((e=>"WebLogo"===e.type)).length,1)}))}));var X=n(966);function J(e,t){let n=null;for(const r of e.viewers)r.type===t&&(n=r);return n}(0,t.L1)("checkInputColumn",(()=>{const n="seq\nseq1,\nseq2,\nseq3,\nseq4";(0,t.t6)("testMsaPos",(async()=>{const r=e.DataFrame.fromCsv(n).getCol("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=l.Hi.FASTA,r.setTag(l.gp.alphabet,l.YI.DNA),r.setTag(l.gp.aligned,"SEQ");const[i,s]=(0,X.l)(r,"Test",[l.Hi.FASTA],[l.YI.DNA,l.YI.RNA,l.YI.PT]);(0,t.E3)(i,!0)})),(0,t.t6)("testMsaNegHelm",(async()=>{const r=e.DataFrame.fromCsv(n).getCol("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=l.Hi.HELM,r.setTag(l.gp.alphabetIsMultichar,"true");const[i,s]=(0,X.l)(r,"Test",[l.Hi.FASTA],[l.YI.DNA,l.YI.RNA,l.YI.PT]);(0,t.E3)(i,!1)})),(0,t.t6)("testMsaNegUN",(async()=>{const r=e.DataFrame.fromCsv(n).getCol("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=l.Hi.FASTA,r.setTag(l.gp.alphabet,"UN"),r.setTag(l.gp.alphabetSize,"11"),r.setTag(l.gp.alphabetIsMultichar,"true"),r.setTag(l.gp.aligned,"SEQ");const[i,s]=(0,X.l)(r,"Test",[l.Hi.FASTA],[l.YI.DNA,l.YI.RNA,l.YI.PT]);(0,t.E3)(i,!1)})),(0,t.t6)("testGetActionFunctionMeta",(async()=>{e.Func.find({package:"Bio",name:"multipleSequenceAlignmentDialog"})[0].inputs.find((e=>"sequence"==e.name))}))})),(0,t.L1)("similarity/diversity",(async()=>{(0,t.t6)("similaritySearchViewer",(async()=>{await async function(){const n=await _e.files.readAsText("tests/sample_MSA_data.csv"),r=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(r);const i=a.shell.addTableView(r),s=i.dataFrame.getCol("MSA");(0,t.E3)(s.semType,e.SEMTYPE.MACROMOLECULE);const o=await i.dataFrame.plot.fromType("Sequence Similarity Search");let c=!1;if(o.computeCompleted.subscribe((e=>{e&&(c=!0)})),i.dockManager.dock(o,e.DOCK_TYPE.RIGHT,null,"Similarity"),await o.renderPromise,await(0,t.bk)((()=>void 0!==J(i,"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(!c)throw new Error("The viewer has not compute completed.");const l=o;await(0,t.bk)((()=>0!==l.root.getElementsByClassName("d4-grid").length),"Sequence Similarity Search viewer grid has not been created",100);(0,t.E3)(l.fingerprint,"Morgan"),(0,t.E3)(l.distanceMetric,"Tanimoto"),(0,t.E3)(l.scores.get(0),e.FLOAT_NULL),(0,t.E3)(l.idxs.get(0),0),(0,t.E3)(l.molCol.get(0),"D-Tyr_Et/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr//Phe_4Me"),(0,t.E3)(l.scores.get(1).toFixed(2),"0.73"),(0,t.E3)(l.idxs.get(1),4),(0,t.E3)(l.molCol.get(1),"Thr_PO3H2/Aca/D-Tyr_Et/Tyr_ab-dehydroMe/dV/Chg/N/D-Orn/D-aThr//Phe_4Me"),i.dataFrame.currentRowIdx=1,await(0,t.bk)((()=>1===l.targetMoleculeIdx),"Target molecule has not been changed",5e3),await(0,t.bk)((()=>"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"===l.molCol.get(0)),"Incorrect first similar molecule",5e3)}()})),(0,t.t6)("diversitySearchViewer",(async()=>{await async function(){const n=await _e.files.readAsText("tests/sample_MSA_data.csv"),r=e.DataFrame.fromCsv(n),i=a.shell.addTableView(r);await a.data.detectSemanticTypes(r);const s=i.dataFrame.getCol("MSA");(0,t.E3)(s.semType,e.SEMTYPE.MACROMOLECULE);const o=await i.dataFrame.plot.fromType("Sequence Diversity Search");let c=!1;if(o.computeCompleted.subscribe((e=>{e&&(c=!0)})),i.dockManager.dock(o,e.DOCK_TYPE.DOWN,null,"Diversity"),await o.renderPromise,await(0,t.bk)((()=>void 0!==J(i,"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(!c)throw new Error("The viewer has not compute completed.");const l=o;await(0,t.bk)((()=>0!==l.root.getElementsByClassName("d4-grid").length),"Sequence Diversity Search viewer grid has not been created",100),(0,t.E3)(l.fingerprint,"Morgan"),(0,t.E3)(l.distanceMetric,"Tanimoto"),(0,t.E3)(l.initialized,!0),(0,t.E3)(l.renderMolIds.length>0,!0)}()}))}));var Q=n(9124),ee=n(1687),te=n(4577);async function ne(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 ee._i;return n.attach(t),n.applyState({columnName:e}),n.column=t.col(e),n.columnName=e,n}(0,t.L1)("bio-substructure-filters",(async()=>{let n,r,i;(0,t.gM)((async()=>{n=await(0,Q.b)(),r=await(0,L.pj)(),i=await(0,I.ub)(),await(0,I.yZ)(),await r.loadMonomerLib(!0)})),(0,t.Pl)((async()=>{await(0,I.Eu)(i),await r.loadMonomerLib(!0)})),(0,t.t6)("fasta",(async()=>{const e=await _("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(e);const n=new ee._i;n.attach(e),await n.awaitRendered();try{(0,t.E3)(!!n.bioFilter,!0),(0,t.E3)(n.bioFilter.type,"FastaBioFilter");const r=n.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new te.n("MD")}),5e3,"testEvent onRowsFiltered"),(0,t.E3)(n.dataFrame.filter.trueCount,3),(0,t.E3)(n.dataFrame?.filter.toBinaryString(),"10010000100000")}finally{n.detach()}await n.awaitRendered()})),(0,t.t6)("separator",(async()=>{const e=await _("tests/filter_MSA.csv"),n=new ee._i;await a.data.detectSemanticTypes(e),n.attach(e),await n.awaitRendered();try{(0,t.E3)(!!n.bioFilter,!0),(0,t.E3)(n.bioFilter.type,"SeparatorBioFilter");const r=n.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new ee.AR("meI")}),5e3,"testEvent onRowsFiltered"),(0,t.E3)(n.dataFrame.filter.trueCount,7),(0,t.E3)(n.dataFrame.filter.get(2),!1),await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new ee.AR("/meI")}),5e3,"testEvent onRowsFiltered"),(0,t.E3)(n.dataFrame.filter.trueCount,0),await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new ee.AR("meI-hHis","-")}),5e3,"testEvent onRowsFiltered"),(0,t.E3)(n.dataFrame.filter.trueCount,7),(0,t.E3)(n.dataFrame.filter.get(2),!1)}finally{n.detach()}await n.awaitRendered()})),(0,t.t6)("helm-dialog",(async()=>{const e="Bio tests: substructureFilters/helm-dialog",n=await _("tests/filter_HELM.csv");await a.data.detectSemanticTypes(n);const r=a.shell.addTableView(n);_e.logger.debug(`${e}, filter attaching.`);const i=new ee._i;i.attach(n);const s=O.dialog("Test filters").add(i.root).show();await i.awaitRendered();try{const s=i.bioFilter;(0,t.E3)(null!==i.bioFilter,!0,"bioFilter is not created"),_e.logger.debug(`${e}, filter 1 change awaiting...`),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{s.props=new te.n("PEPTIDE1{A.C}$$$$V2.0")}),2e4),_e.logger.debug(`${e}, filter 1 changed.`),(0,t.E3)(i.dataFrame.filter.trueCount,1),(0,t.E3)(i.dataFrame.filter.toBinaryString(),"0001"),_e.logger.debug(`${e}, filter 2 change awaiting...`),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{s.props=new te.n("PEPTIDE1{C}$$$$V2.0")}),2e4),await x(r.grid),_e.logger.debug(`${e}, filter 2 changed.`),(0,t.E3)(i.dataFrame.filter.trueCount,2),(0,t.E3)(i.dataFrame.filter.toBinaryString(),"1001")}finally{s.close()}await i.awaitRendered(),await(0,t.cb)(3e3)})),(0,t.t6)("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.t6)("sync-fasta",(async()=>{const e=await _e.files.readCsv("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(e);const n=await ne("fasta",e),r=await ne("fasta",e);await Promise.all([n.awaitRendered(),r.awaitRendered()]);try{(0,t.E3)(!!n.bioFilter,!0),(0,t.E3)(!!r.bioFilter,!0),(0,t.E3)(n.bioFilter.type,"FastaBioFilter"),(0,t.E3)(r.bioFilter.type,"FastaBioFilter");const i=n.bioFilter,s=r.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{i.props=new te.n("MD")}),1e4,"await onRowsFiltered"),(0,t.E3)(e.filter.trueCount,3),await n.awaitRendered(),(0,t.E3)(s.props.substructure,"MD")}finally{n.detach(),r.detach()}await Promise.all([n.awaitRendered(),r.awaitRendered()])})),(0,t.t6)("sync-msa",(async()=>{const e=await _e.files.readCsv("tests/filter_MSA.csv");await a.data.detectSemanticTypes(e);const n="hHis-Aca",r=await ne("MSA",e),i=await ne("MSA",e);await Promise.all([r.awaitRendered(),i.awaitRendered()]);try{(0,t.E3)(!!r.bioFilter,!0),(0,t.E3)(!!i.bioFilter,!0),(0,t.E3)(r.bioFilter.type,"SeparatorBioFilter"),(0,t.E3)(i.bioFilter.type,"SeparatorBioFilter");const s=r.bioFilter,o=i.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{s.props=new ee.AR(n,"-")}),1e4,"await onRowsFiltered"),(0,t.E3)(e.filter.trueCount,8),(0,t.E3)(o.props.substructure,n),(0,t.E3)(o.props.separator,"-")}finally{r.detach(),i.detach()}await Promise.all([r.awaitRendered(),i.awaitRendered()])})),(0,t.t6)("sync-helm",(async()=>{const e=await _e.files.readCsv("tests/filter_HELM.csv");await a.data.detectSemanticTypes(e);const n=a.shell.addTableView(e),r="PEPTIDE1{A.C}$$$$V2.0",i=await ne("HELM string",e),s=await ne("HELM string",e),o=O.dialog("Test filters").add(i.root).add(s.root).show();await Promise.all([i.awaitRendered(),s.awaitRendered()]);try{(0,t.E3)(!!i.bioFilter,!0),(0,t.E3)(!!s.bioFilter,!0),(0,t.E3)(i.bioFilter.type,"HelmBioFilter"),(0,t.E3)(s.bioFilter.type,"HelmBioFilter");const o=i.bioFilter,a=s.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{o.props=new te.n(r)}),6e4,"await onRowsFiltered"),await x(n.grid),_e.logger.debug("Bio tests: substructureFilters/sync-helm, before changed event"),await(0,t.cb)(2*i.debounceTime),_e.logger.debug("Bio tests: substructureFilters/sync-helm, after changed event"),(0,t.E3)(e.filter.trueCount,1),await i.awaitRendered(),(0,t.E3)(a.props.substructure,r)}finally{i.detach(),s.detach(),o.close()}await Promise.all([i.awaitRendered(),s.awaitRendered()]),await x(n.grid),await(0,t.cb)(3e3)})),(0,t.t6)("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 r=a.shell.addTableView(n),i="seq1",s="CGGCTG",o=n.getCol("trueSeq1").toList(),c="seq2",l="GCATT",u=n.getCol("trueSeq2").toList(),d=[{type:"Bio:bioSubstructureFilter",columnName:i},{type:"Bio:bioSubstructureFilter",columnName:c}],h=await n.plot.fromType(e.VIEWER.FILTERS,{filters:d});r.dockManager.dock(h,e.DOCK_TYPE.LEFT),await(0,t.cb)(100),await x(r.grid);const p=h.filters[0],m=h.filters[1];(0,t.E3)(p.column.name,i),(0,t.E3)(m.column.name,c);const f=p.bioFilter,g=m.bioFilter;await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new te.n(s)}),1e3),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new te.n("")}),1e3,"testEvent onRowsFiltered on seq1"),(0,t.E3)(n.filter.trueCount,o.filter((e=>1===e)).length),(0,t.E3)(n.filter.toBinaryString(),o.map((e=>e.toString())).join("")),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new te.n("")}),1e3),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new te.n(l)}),1e3,"testEvent onRowsFiltered on seq2"),(0,t.E3)(n.filter.trueCount,u.filter((e=>1===e)).length),(0,t.E3)(n.filter.toBinaryString(),u.map((e=>e.toString())).join("")),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new te.n("")}),1e3),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new te.n("")}),1e3,"testEvent onRowsFiltered on neither"),(0,t.E3)(n.filter.trueCount,n.rowCount),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new te.n(s)}),5e3),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new te.n(l)}),5e3,"testEvent onRowsFiltered on both");const y=C().count(0).take(n.rowCount).map((e=>o[e]*u[e])).toArray();(0,t.E3)(n.filter.trueCount,y.filter((e=>1===e)).length),(0,t.E3)(n.filter.toBinaryString(),y.map((e=>e.toString())).join("")),await Promise.all([p.awaitRendered(),m.awaitRendered(),x(r.grid)])})),(0,t.t6)("reset-fasta",(async()=>{const n=await _("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(n);const r=a.shell.addTableView(n),i="MD",s=await n.plot.fromType(e.VIEWER.FILTERS,{filters:[{type:"Bio:bioSubstructureFilter",columnName:"fasta"}]});r.dockManager.dock(s,e.DOCK_TYPE.LEFT),await(0,t.cb)(100),await x(r.grid);const o=s.filters[0].bioFilter;await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{o.props=new te.n(i)}),1e3,"testEvent onRowsFiltered"),(0,t.E3)(n.filter.trueCount,3),(0,t.E3)(o.props.substructure,i),(0,t.E3)(o.substructureInput.value,i),G()(s.root).find('i[name="icon-arrow-rotate-left"]')[0].click(),await(0,t.cb)(100),await x(r.grid),(0,t.E3)(o.props.substructure,""),(0,t.E3)(o.substructureInput.value,"")})),(0,t.t6)("reopen",(async()=>{const n=await _e.files.readCsv("tests/filter_FASTA.csv"),r=a.shell.addTableView(n),i=[{type:"Bio:bioSubstructureFilter",columnName:"fasta"}],s=await n.plot.fromType(e.VIEWER.FILTERS,{filters:i});r.dockManager.dock(s,e.DOCK_TYPE.LEFT),await(0,t.cb)(100),await x(r.grid),s.close(),await x(r.grid);const o=await n.plot.fromType(e.VIEWER.FILTERS,{filters:i});r.dockManager.dock(o,e.DOCK_TYPE.LEFT),await(0,t.cb)(100),await x(r.grid)}))}));var re=n(8152);class ie{errorList=[];warningList=[];infoList=[];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(9192);(0,t.L1)("PepSeA",(()=>{(0,t.gM)((async()=>{await(0,b.m8)()})),(0,t.t6)("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'),r=await(0,re.GD)(n.getCol("HELM"),"msa(HELM)"),i=n.getCol("MSA");for(let e=0;e<r.length;++e)(0,t.E3)(r.get(e)==i.get(e),!0)}),{timeout:6e4,stressTest:!0}),(0,t.t6)("stderr",(async()=>{const n=new ie,r=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'),i=await(0,re.GD)(r.getCol("HELM"),"msa(HELM)",void 0,void 0,void 0,void 0,n),s=r.getCol("MSA");(0,t.J6)(i.toList(),s.toList()),(0,t.E3)(n.warningList[0].message,"Mis not found in Monomer Map\nMeF not found in Monomer Map\n")}),{timeout:6e4,stressTest:!0}),(0,t.t6)("error",(async()=>{const n=new ie;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,re.GD)(t.getCol("HELM"),"msa(HELM)",void 0,void 0,void 0,void 0,n)}catch(e){const[t,r]=(0,se.AP)(e);n.error(t,void 0,r)}(0,t.E3)(n.errorList[0].message,"PepSeA error: The pair (*,M) couldn't be found in the substitution matrix")}))})),(0,t.L1)("viewers",(()=>{const n=e.Func.find({package:"Bio",tags:["viewer"]}).map((e=>e.friendlyName));for(const e of n)(0,t.t6)(e,(async()=>{const n=await _("samples/FASTA_DNA.csv");await(0,t.Bl)(e,n,{detectSemanticTypes:!0})}),{skipReason:{"Sequence Similarity Search":"GROK-13162","Sequence Diversity Search":"GROK-13162",WebLogo:"GROK-13162",VdRegions:"GROK-13162"}[e]})}));const oe="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",ae="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT",ce="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 le;(0,t.L1)("SeqHandler",(()=>{async function n(t){const n=e.DataFrame.fromCsv(t);await a.data.detectSemanticTypes(n);const r=u.GO.forColumn(n.getCol("seq"));return[n,r]}(0,t.t6)("Seq-Fasta",(async()=>{const[e,r]=await n(oe);(0,t.E3)(r.notation,l.Hi.FASTA),(0,t.E3)(r.isMsa(),!1)})),(0,t.t6)("Seq-Fasta-MSA",(async()=>{const[e,r]=await n(ae);(0,t.E3)(r.notation,l.Hi.FASTA),(0,t.E3)(r.isMsa(),!0)})),(0,t.t6)("Seq-Fasta-units",(async()=>{const[e,r]=await n(oe);(0,t.E3)(r.notation,l.Hi.FASTA),(0,t.E3)(r.isMsa(),!1)})),(0,t.t6)("Seq-Fasta-MSA-units",(async()=>{const[e,r]=await n(ae);(0,t.E3)(r.notation,l.Hi.FASTA),(0,t.E3)(r.isMsa(),!0)})),(0,t.t6)("Seq-Helm",(async()=>{const[e,r]=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.E3)(r.notation,l.Hi.HELM),(0,t.E3)(r.isHelm(),!0)})),(0,t.t6)("Seq-UN",(async()=>{const[e,r]=await n(ce);(0,t.E3)(r.notation,l.Hi.SEPARATOR),(0,t.E3)(r.separator,"-"),(0,t.E3)(r.alphabet,l.YI.UN)})),(0,t.t6)("Seq-UN-auto",(async()=>{const[e,r]=await n(ce);(0,t.E3)(r.notation,l.Hi.SEPARATOR),(0,t.E3)(r.separator,"-"),(0,t.E3)(r.alphabet,l.YI.UN)})),(0,t.t6)("column-version",(async()=>{const n=e.DataFrame.fromCsv(oe);await a.data.detectSemanticTypes(n);const r=n.getCol("seq"),i=u.GO.forColumn(r),s=r.version,o=u.GO.forColumn(r),c=r.version;(0,t.E3)(s,c,"Unexpected column version changed"),(0,t.E3)(i,o,"Unexpected SeqHandler object changed"),n.rows.addNew(["TACCCCTTCAAC"]);const l=u.GO.forColumn(r),d=r.version;(0,t.E3)(c<d,!0,"Stalled column version on add row"),(0,t.E3)(o!==l,!0,"Stalled SeqHandler object on add row"),r.set(1,"CAGTGTCCCCGT");const h=u.GO.forColumn(r),p=r.version;(0,t.E3)(d<p,!0,"Stalled column version on change data"),(0,t.E3)(l!==h,!0,"Stalled SeqHandler object on change data"),r.setTag("testTag","testValue");const m=u.GO.forColumn(r),f=r.version;(0,t.E3)(p<f,!0,"Stalled column version on set tag"),(0,t.E3)(h!==m,!0,"Stalled SeqHandler object on set tag")}))})),function(e){e.fasta="fasta",e.fastaMsa="fastaMsa",e.separator="separator",e.separatorMsa="separatorMsa",e.helm="helm"}(le||(le={})),(0,t.L1)("SeqHandler",(()=>{u.b9[l.Hi.FASTA],u.b9[l.Hi.HELM];const n=u.b9[l.Hi.SEPARATOR],r={[le.fasta]:{src:{csv:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC"},tgt:{notation:l.Hi.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"]]}},[le.fastaMsa]:{src:{csv:"seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT"},tgt:{notation:l.Hi.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"]]}},[le.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:l.Hi.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"]]}},[le.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:l.Hi.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]]}},[le.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:l.Hi.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,i]of Object.entries(r))(0,t.t6)(`splitted-${n}`,(async()=>{const n=e.DataFrame.fromCsv(i.src.csv).getCol("seq"),r=await a.functions.call("Bio:detectMacromolecule",{col:n});r&&(n.semType=r),(0,t.E3)(n.semType,e.SEMTYPE.MACROMOLECULE);const s=u.GO.forColumn(n);(0,t.E3)(s.notation,i.tgt.notation),(0,t.E3)(s.separator===i.tgt.separator,!0);const o=C().count(0).take(s.length).map((e=>C()(s.getSplitted(e).originals).toArray())).toArray();(0,t.J6)(o,i.tgt.splitted)}))})),(0,t.L1)("SeqHandler: getRegion",(()=>{const n={fastaDna:{srcCsv:"seq\nATTCGT\nACTGCTC\nATTCCGTA",startIdx:2,endIdx:4,tgtCsv:"seq\nTCG\nTGC\nTCC",units:l.Hi.FASTA,alphabet:l.YI.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:l.Hi.SEPARATOR,alphabet:l.YI.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:l.Hi.HELM,alphabet:null,positionNames:{tag:null,start:"4",end:"7"}}};for(const[r,i]of Object.entries(n))(0,t.t6)(`${r}-idx`,(async()=>{const n=e.DataFrame.fromCsv(i.srcCsv).getCol("seq"),r=await a.functions.call("Bio:detectMacromolecule",{col:n});r&&(n.semType=r);const s=u.GO.forColumn(n).getRegion(i.startIdx,i.endIdx,"regSeq"),o=e.DataFrame.fromCsv(i.tgtCsv).getCol("seq");(0,t.E3)(n.meta.units,i.units),(0,t.E3)(s.meta.units,i.units),(0,t.E3)(n.getTag(l.gp.alphabet),i.alphabet),(0,t.E3)(s.getTag(l.gp.alphabet),i.alphabet),(0,t.J6)(s.toList(),o.toList())})),i.positionNames&&(0,t.t6)(`${r}-positionNames`,(async()=>{const n=e.DataFrame.fromCsv(i.srcCsv).getCol("seq");i.positionNames.tag&&n.setTag(l.gp.positionNames,i.positionNames.tag);const r=await a.functions.call("Bio:detectMacromolecule",{col:n});r&&(n.semType=r);const s=await a.functions.call("Bio:getRegion",{sequence:n,start:i.positionNames.start,end:i.positionNames.end}),o=e.DataFrame.fromCsv(i.tgtCsv).getCol("seq");(0,t.E3)(n.meta.units,i.units),(0,t.E3)(s.meta.units,i.units),(0,t.E3)(n.getTag(l.gp.alphabet),i.alphabet),(0,t.E3)(s.getTag(l.gp.alphabet),i.alphabet),(0,t.J6)(s.toList(),o.toList())}))})),(0,t.L1)("SeqHandler: getHelm",(()=>{let n,r;(0,t.gM)((async()=>{n=await(0,L.pj)(),r=await(0,I.ub)(),await(0,I.yZ)(),await n.loadMonomerLib(!0)})),(0,t.Pl)((async()=>{await(0,I.Eu)(r),await n.loadMonomerLib(!0)}));const i={fasta:{src:{seq:"MDYKETMDYKET",notation:l.Hi.FASTA},tgt:{helm:"PEPTIDE1{M.D.Y.K.E.T.M.D.Y.K.E.T}$$$$"}},separator:{src:{seq:"M-D-Y-K-E-T-M-D-Y-K-E-T",notation:l.Hi.SEPARATOR,separator:"-"},tgt:{helm:"PEPTIDE1{M.D.Y.K.E.T.M.D.Y.K.E.T}$$$$"}},helm:{src:{seq:"PEPTIDE1{M.D.Y.K.E.T}$$$$",notation:l.Hi.HELM},tgt:{helm:"PEPTIDE1{M.D.Y.K.E.T}$$$$"}},"helm-cyclic":{src:{seq:"PEPTIDE1{M.D.Y.K.E.T}$PEPTIDE1,PEPTIDE1,6:R2-1:R1$$$V2.0",notation:l.Hi.HELM},tgt:{helm:"PEPTIDE1{M.D.Y.K.E.T}$PEPTIDE1,PEPTIDE1,6:R2-1:R1$$$V2.0"}}};for(const[e,n]of Object.entries(i))(0,t.t6)(e,(async()=>{await s(n.src.seq,n.src.notation,n.src.separator,n.tgt.helm)}));async function s(n,r,i,s){const o=e.Column.fromStrings("seq",[n]),c=e.DataFrame.fromColumns([o]);await a.data.detectSemanticTypes(c);const l=u.GO.forColumn(o),d=await l.getHelm(0,!1);(0,t.E3)(d,s)}}));var ue=n(7384),de=n(6717);const he=new e.FileSource("System:AppData/Bio"),pe={"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"}},me="molfile(sequence)";async function fe(e,t="seq",n){await(0,de.j)();const r=e.getCol(t),i=n.getMonomerLib(),s=await(0,ue.C4)(e,r,i);return s.warnings.length>0&&_e.logger.warning(`_toAtomicLevel() warnings ${s.warnings.join("\n")}`),s.col}function ge(e){return e.replaceAll("\r\n","\n").replace(/\n$/,"").split("\n").map((e=>e.trimEnd())).join("\n")}(0,t.L1)("toAtomicLevel",(async()=>{const n={},r={};let i,s,o;async function d(e,n){const r=e.getCol("sequence");await(0,c.toAtomicLevel)(e,r,!1);const i=e.getCol(me),s=n.getCol(me),o=C()(i.values()).map((e=>ge(e))).toArray(),a=C()(s.values()).map((e=>ge(e))).toArray();(0,t.J6)(o,a)}(0,t.gM)((async()=>{i=await(0,L.pj)(),s=await(0,I.ub)(),await(0,I.yZ)(),await i.loadMonomerLib(!0);for(const[t,i]of Object.entries(pe))i.inPath,n[t]=e.DataFrame.fromCsv((await he.readAsText(i.inPath)).replace(/\n$/,"")),await a.data.detectSemanticTypes(n[t]),r[t]=e.DataFrame.fromCsv((await he.readAsText(i.outPath)).replace(/\n$/,""))})),(0,t.Pl)((async()=>{await(0,I.Eu)(s),await i.loadMonomerLib(!0)}));for(const[e,i]of Object.entries(pe))(0,t.t6)(`${e}`,(async()=>{await d(n[e],r[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 h={[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 p(t){const n=h[t],r=e.DataFrame.fromCsv(n.replace(/\n$/,""));return await a.data.detectSemanticTypes(r),r}(0,t.t6)("fastaDna",(async()=>{await fe(await p(o.fastaDna),"seq",i)})),(0,t.t6)("fastaRna",(async()=>{await fe(await p(o.fastaRna),"seq",i)})),(0,t.t6)("fastaPt",(async()=>{await fe(await p(o.fastaPt),"seq",i)})),(0,t.t6)("fastaUn",(async()=>{await fe(await p(o.fastaUn),"seq",i)})),(0,t.t6)("separatorDna",(async()=>{await fe(await p(o.separatorDna),"seq",i)})),(0,t.t6)("separatorDna",(async()=>{await fe(await p(o.separatorRna),"seq",i)})),(0,t.t6)("separatorPt",(async()=>{await fe(await p(o.separatorPt),"seq",i)})),(0,t.t6)("separatorUn",(async()=>{await fe(await p(o.separatorUn),"seq",i)})),(0,t.t6)("helm",(async()=>{await fe(await p(o.helm),"seq",i)})),(0,t.t6)("ptFasta2",(async()=>{const n=await _e.files.readAsText("tests/to-atomic-level-pt-fasta-2.mol"),r=e.DataFrame.fromCsv("seq\nAR"),s=r.getCol("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.meta.units=l.Hi.FASTA,s.setTag(l.gp.alphabet,l.YI.PT),u.GO.forColumn(s);const o=await fe(r,"seq",i);(0,t.E3)(ge(o.get(0)),ge(n))}))}));var ye=n(8754);(0,t.L1)("toAtomicLevel-ui",(()=>{let n,r,i;(0,t.gM)((async()=>{i=await(0,Q.b)(),n=await(0,L.pj)(),r=await(0,I.ub)(),await(0,I.yZ)(),await n.loadMonomerLib(!0)})),(0,t.Pl)((async()=>{await(0,I.Eu)(r),await n.loadMonomerLib(!0)}));const s="seq\nMDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\nMIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL\nMMELVLKTIIGPIVVGVVLRIVDKWLNKDK\n";async function o(r,i,s){const o=await(0,ye.V)(r,i,s,n.getMonomerLib());(0,t.E3)(o.semType,e.SEMTYPE.MOLECULE)}(0,t.t6)("toAtomicLevel-fasta-linear",(async()=>{const t=e.DataFrame.fromCsv(s);await a.data.detectSemanticTypes(t);const n=t.getCol("seq");await o(t,n,!1)})),(0,t.t6)("toAtomicLevel-fasta-nonlinear",(async()=>{const t=e.DataFrame.fromCsv(s);await a.data.detectSemanticTypes(t);const n=t.getCol("seq");await o(t,n,!0)})),(0,t.t6)("toAtomicLevel-helm",(async()=>{const t=e.DataFrame.fromCsv("seq\nPEPTIDE1{meI.hHis.Aca.N.T.dK.Thr_PO3H2.Aca.D-Tyr_Et.Aze.dV.E.N.dV.Phe_4Me}$$$$\nPEPTIDE1{meI.hHis.Aca.N.T.dK.Thr_PO3H2.Aca.meM.D-Chg.dV.E.N.D-Orn.D-aThr.Phe_4Me}$$$$\nPEPTIDE1{meI.Aca.N.T.dK.Thr_PO3H2.Aca.D-Tyr_Et.Tyr_ab-dehydroMe.dV.D-Cit.N.D-Orn.D-aThr.Phe_4Me}$$$$\n");await a.data.detectSemanticTypes(t);const n=t.getCol("seq");await o(t,n,!0)}))}));var we=n(6863);async function be(t){const n=e.DataFrame.fromCsv(t),r=n.col("seq"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});return i&&(r.semType=i),await a.data.detectSemanticTypes(n),u.GO.forColumn(r)}function ve(e,n,r,i){const s=r(e,n);(0,t.E3)(Number(s.toFixed(3)),Number(i.toFixed(3)))}(0,t.L1)("Distance",(async()=>{const n=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],r={F:0,W:1,R:2,Y:3},i="FWRWY",s="FWRWW",o="FWY",a="FWRWY",c="FWY",l="FWRRRRY";(0,t.t6)("protein-distance-function",(async()=>{const e=(await be("seq\nFWRWYVKHPFWRWYVKHP\nYNRWYVKHPYNRWYVKHP\nMWRSWYCKHPMWRSWYCKHP")).getDistanceFunctionName();(0,t.E3)(e,we.Z.LEVENSHTEIN)})),(0,t.t6)("DNA-distance-function",(async()=>{const e=(await be("seq\nATAACGATAACG\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,t.E3)(e,we.Z.LEVENSHTEIN)})),(0,t.t6)("MSA-distance-function",(async()=>{const e=(await be("seq\nATAACATAAC\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,t.E3)(e,we.Z.HAMMING)})),(0,t.t6)("levenstein-sub",(async()=>{const e=we.V[we.Z.LEVENSHTEIN]();ve(i,s,e,.2)})),(0,t.t6)("levenstein-del",(async()=>{const e=we.V[we.Z.LEVENSHTEIN]();ve(o,a,e,.4)})),(0,t.t6)("hamming",(async()=>{const e=we.V[we.Z.HAMMING]();ve(o,a,e,.6)})),(0,t.t6)("needleman-blosum62",(async()=>{const e=we.V[we.Z.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});ve(i,s,e,-6)})),(0,t.t6)("needleman-blosum62-del",(async()=>{const e=we.V[we.Z.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});ve(o,a,e,-3.667)})),(0,t.t6)("needleman-custom-sub",(async()=>{const e=we.V[we.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:1,gapExtend:1});ve(i,s,e,.2)})),(0,t.t6)("needleman-custom-del",(async()=>{const e=we.V[we.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:1,gapExtend:1});ve(o,a,e,.667)})),(0,t.t6)("needleman-custom-zero-extend",(async()=>{const e=we.V[we.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:1,gapExtend:0});ve(c,l,e,.333)})),(0,t.t6)("needleman-custom-half-extend",(async()=>{const e=we.V[we.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:2,gapExtend:1});ve(c,l,e,1.667)})),(0,t.t6)("needleman-custom-same-extend",(async()=>{const t=we.V[we.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:1,gapExtend:1});e.Test.isInBenchmark?ve(Array(1e3).fill(c).join(""),Array(1e3).fill(l).join(""),t,1.333):ve(c,l,t,1.333)}),{benchmark:!0})}));var Ae=n(684);async function Ee(e,n,r,i,s,o,l,u){await a.data.detectSemanticTypes(e);const d=await(0,c.activityCliffs)(e,e.getCol(r),e.getCol(i),s,n,l,u,{[`${Ae.vb}`]:!0});(0,t.E3)(null!=d,!0);const h=Array.from(d.root.children).find((e=>{const t=e.className.split(" ");return["ui-btn","ui-btn-ok"].every((e=>t.includes(e)))}));(0,t.E3)(h.innerText.toLowerCase(),`${o} cliffs`)}var Ce=n(2780),Te=n(9039);async function Se(n,r,i){const s=n.getCol(i),o=await a.functions.call("Bio:detectMacromolecule",{col:s});o&&(s.semType=o);const l=e.Func.find({package:"Bio",name:"macromoleculePreprocessingFunction"})[0];if(!l)throw new Error("Preprocessing function not found");const u=await(0,c.sequenceSpaceTopMenu)(n,n.col(i),r,we.Z.LEVENSHTEIN,!0,l,{[Ae.vb]:!0});(0,t.E3)(null!=u,!0)}(0,t.L1)("activityCliffs",(async()=>{let n,r,i;const s=e.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0],o=e.Func.find({name:"helmPreprocessingFunction",package:"Bio"})[0];(0,t.gM)((async()=>{n=await(0,Q.b)(),r=await(0,L.pj)(),i=await(0,I.ub)(),await(0,I.yZ)(),await r.loadMonomerLib(!0)})),(0,t.Pl)((async()=>{await(0,I.Eu)(i),await r.loadMonomerLib(!0)})),(0,t.t6)("activityCliffsOpens",(async()=>{const t=e.Test.isInBenchmark?{fileName:"tests/peptides_motif-with-random_10000.csv",tgt:{cliffCount:53}}:{fileName:"tests/100_3_clustests.csv",tgt:{cliffCount:3}},n=await _(t.fileName);a.shell.addTableView(n),await Ee(n,Te.c.UMAP,"sequence","Activity",90,t.tgt.cliffCount,we.Z.LEVENSHTEIN,s)}),{benchmark:!0}),(0,t.t6)("activityCliffsWithEmptyRows",(async()=>{const e=await _("tests/100_3_clustests_empty_vals.csv");a.shell.addTableView(e),await Ee(e,Te.c.UMAP,"sequence","Activity",90,3,we.Z.LEVENSHTEIN,s)})),(0,t.t6)("Helm",(async()=>{const e=await _e.files.readCsv("samples/HELM_50.csv");a.shell.addTableView(e),await Ee(e,Te.c.UMAP,"HELM","Activity",65,20,Ce.aT.Tanimoto,o)}))})),(0,t.L1)("sequenceSpace",(async()=>{let n,r,i,s;(0,t.t6)("sequenceSpaceOpens",(async()=>{const t=e.Test.isInBenchmark?{fileName:"tests/peptides_motif-with-random_10000.csv"}:{fileName:"tests/100_3_clustests.csv"};n=await _(t.fileName),r=a.shell.addTableView(n),await Se(n,Te.c.UMAP,"sequence")}),{benchmark:!0}),(0,t.t6)("sequenceSpaceWithEmptyRows",(async()=>{i=await _("tests/100_3_clustests_empty_vals.csv"),s=a.shell.addTableView(i),await Se(i,Te.c.UMAP,"sequence")}))})),(0,t.L1)("Scoring",(()=>{const n="sequence",r="expected_similarity",i="expected_identity",s=e.DataFrame.fromCsv(`${n},${r},${i}\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=s.getCol(n);o.meta.units=l.Hi.HELM,o.semType=e.SEMTYPE.MACROMOLECULE;const a=o.get(0);let u,d;(0,t.gM)((async()=>{u=await(0,c.getMonomerLibHelper)(),d=await(0,I.ub)(),await(0,I.yZ)(),await u.loadMonomerLib(!0)})),(0,t.Pl)((async()=>{await(0,I.Eu)(d),await u.loadMonomerLib(!0)})),(0,t.t6)("Identity",(async()=>{const e=await(0,c.sequenceIdentityScoring)(s,o,a);for(let n=0;n<e.length;n++){const r=e.get(n),o=s.get(i,n);(0,t.Wj)(r,o,.01,`Wrong identity score for sequence at position ${n}`)}})),(0,t.t6)("Identity-shortReference",(async()=>{const e=await(0,c.sequenceIdentityScoring)(s,o,"PEPTIDE1{Iva.Gly_allyl.gGlu.Pqa.D-Dip.dH.hHis.4Abz.D-aHyp.D-Dap.Y.Iva}$$$$");(0,t.E3)(C().count(0).take(e.length).map((t=>e.get(t))).every((e=>null!=e&&!isNaN(e))),!0)})),(0,t.t6)("Identity-longReference",(async()=>{const e=await(0,c.sequenceIdentityScoring)(s,o,"PEPTIDE1{Iva.Gly_allyl.gGlu.Pqa.D-Dip.dH.hHis.4Abz.D-aHyp.D-Dap.Y.Iva.I.Tyr_26diMe.P.Asu.meC.I.Tyr_26diMe.P.Asu.meC}$$$$");(0,t.E3)(C().count(0).take(e.length).map((t=>e.get(t))).every((e=>null!=e&&!isNaN(e))),!0)})),(0,t.t6)("Similarity",(async()=>{const e=await(0,c.sequenceSimilarityScoring)(s,o,a);for(let n=0;n<e.length;n++){const i=e.get(n),o=s.get(r,n);(0,t.Wj)(i,o,.01,`Wrong similarity score for sequence at position ${n}`)}}))}));const _e=new e.Package;async function xe(n,r,i,s){const o=await(0,t.N$)({category:n,test:r,testContext:i,stressTest:s});return e.DataFrame.fromObjects(o)}})(),bio_test=r})();
|
|
7
|
+
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 r in e)"__proto__"!==r&&((Array.isArray(e[r])?t:n)[r]=e[r]);return[t,n]}(e);a(e,t),c(e,n)}};function a(e,t=e.schema){const{gen:n,data:i,it:o}=e;if(0===Object.keys(t).length)return;const a=n.let("missing");for(const c in t){const l=t[c];if(0===l.length)continue;const u=(0,s.propertyInData)(n,i,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(", ")}),o.allErrors?n.if(u,(()=>{for(const t of l)(0,s.checkReportMissingProp)(e,t)})):(n.if(r._`${u} && (${(0,s.checkMissingProp)(e,l,a)})`),(0,s.reportMissingProp)(e,a),n.else())}}function c(e,t=e.schema){const{gen:n,data:r,keyword:o,it:a}=e,c=n.name("valid");for(const l in t)(0,i.alwaysValidSchema)(a,t[l])||(n.if((0,s.propertyInData)(n,r,l,a.opts.ownProperties),(()=>{const t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)}),(()=>n.var(c,!0))),e.ok(c))}t.validatePropertyDeps=a,t.validateSchemaDeps=c,t.default=o},4845:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3025),i={keyword:"dependentSchemas",type:"object",schemaType:"object",code:e=>(0,r.validateSchemaDeps)(e)};t.default=i},1239:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>r.str`must match "${e.ifClause}" schema`,params:({params:e})=>r._`{failingKeyword: ${e.ifClause}}`},code(e){const{gen:t,parentSchema:n,it:s}=e;void 0===n.then&&void 0===n.else&&(0,i.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const a=o(s,"then"),c=o(s,"else");if(!a&&!c)return;const l=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&&c){const n=t.let("ifClause");e.setParams({ifClause:n}),t.if(u,d("then",n),d("else",n))}else a?t.if(u,d("then")):t.if((0,r.not)(u),d("else"));function d(n,i){return()=>{const s=e.subschema({keyword:n},u);t.assign(l,u),e.mergeValidEvaluated(s,l),i?t.assign(i,r._`${n}`):e.setParams({ifClause:n})}}e.pass(l,(()=>e.error(!0)))}};function o(e,t){const n=e.schema[t];return void 0!==n&&!(0,i.alwaysValidSchema)(e,n)}t.default=s},6378:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5457),i=n(5354),s=n(494),o=n(3966),a=n(2661),c=n(3025),l=n(9713),u=n(8660),d=n(117),h=n(5333),p=n(7923),m=n(6505),f=n(6163),g=n(5844),y=n(1239),w=n(4426);t.default=function(e=!1){const t=[p.default,m.default,f.default,g.default,y.default,w.default,l.default,u.default,c.default,d.default,h.default];return e?t.push(i.default,o.default):t.push(r.default,s.default),t.push(a.default),t}},494:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;const r=n(9029),i=n(4227),s=n(5765),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,i.alwaysValidSchema)(n,t)||e.ok((0,s.validateArray)(e))}};function a(e,t,n=e.schema){const{gen:s,parentSchema:o,data:a,keyword:c,it:l}=e;!function(e){const{opts:r,errSchemaPath:s}=l,o=n.length,a=o===e.minItems&&(o===e.maxItems||!1===e[t]);if(r.strictTuples&&!a){const e=`"${c}" is ${o}-tuple, but minItems or maxItems/${t} are not specified or different at path "${s}"`;(0,i.checkStrictMode)(l,e,r.strictTuples)}}(o),l.opts.unevaluated&&n.length&&!0!==l.items&&(l.items=i.mergeEvaluated.items(s,n.length,l.items));const u=s.name("valid"),d=s.const("len",r._`${a}.length`);n.forEach(((t,n)=>{(0,i.alwaysValidSchema)(l,t)||(s.if(r._`${d} > ${n}`,(()=>e.subschema({keyword:c,schemaProp:n,dataProp:n},u))),e.ok(u))}))}t.validateTuple=a,t.default=o},3966:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(5765),o=n(5457),a={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>r.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>r._`{limit: ${e}}`},code(e){const{schema:t,parentSchema:n,it:r}=e,{prefixItems:a}=n;r.items=!0,(0,i.alwaysValidSchema)(r,t)||(a?(0,o.validateAdditionalItems)(e,a):e.ok((0,s.validateArray)(e)))}};t.default=a},7923:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4227),i={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){const{gen:t,schema:n,it:i}=e;if((0,r.alwaysValidSchema)(i,n))return void e.fail();const s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,(()=>e.reset()),(()=>e.error()))},error:{message:"must NOT be valid"}};t.default=i},6163:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>r._`{passingSchemas: ${e.passing}}`},code(e){const{gen:t,schema:n,parentSchema:s,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(o.opts.discriminator&&s.discriminator)return;const a=n,c=t.let("valid",!1),l=t.let("passing",null),u=t.name("_valid");e.setParams({passing:l}),t.block((function(){a.forEach(((n,s)=>{let a;(0,i.alwaysValidSchema)(o,n)?t.var(u,!0):a=e.subschema({keyword:"oneOf",schemaProp:s,compositeRule:!0},u),s>0&&t.if(r._`${u} && ${c}`).assign(c,!1).assign(l,r._`[${l}, ${s}]`).else(),t.if(u,(()=>{t.assign(c,!0),t.assign(l,s),a&&e.mergeEvaluated(a,r.Name)}))}))})),e.result(c,(()=>e.reset()),(()=>e.error(!0)))}};t.default=s},5333:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5765),i=n(9029),s=n(4227),o=n(4227),a={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,data:a,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,r.allSchemaProperties)(n),h=d.filter((e=>(0,s.alwaysValidSchema)(l,n[e])));if(0===d.length||h.length===d.length&&(!l.opts.unevaluated||!0===l.props))return;const p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=t.name("valid");!0===l.props||l.props instanceof i.Name||(l.props=(0,o.evaluatedPropsToName)(t,l.props));const{props:f}=l;function g(e){for(const t in p)new RegExp(e).test(t)&&(0,s.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function y(n){t.forIn("key",a,(s=>{t.if(i._`${(0,r.usePattern)(e,n)}.test(${s})`,(()=>{const r=h.includes(n);r||e.subschema({keyword:"patternProperties",schemaProp:n,dataProp:s,dataPropType:o.Type.Str},m),l.opts.unevaluated&&!0!==f?t.assign(i._`${f}[${s}]`,!0):r||l.allErrors||t.if((0,i.not)(m),(()=>t.break()))}))}))}!function(){for(const e of d)p&&g(e),l.allErrors?y(e):(t.var(m,!0),y(e),t.if(m))}()}};t.default=a},5354:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(494),i={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,r.validateTuple)(e,"items")};t.default=i},117:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2586),i=n(5765),s=n(4227),o=n(8660),a={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:n,parentSchema:a,data:c,it:l}=e;"all"===l.opts.removeAdditional&&void 0===a.additionalProperties&&o.default.code(new r.KeywordCxt(l,o.default,"additionalProperties"));const u=(0,i.allSchemaProperties)(n);for(const e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&!0!==l.props&&(l.props=s.mergeEvaluated.props(t,(0,s.toHash)(u),l.props));const d=u.filter((e=>!(0,s.alwaysValidSchema)(l,n[e])));if(0===d.length)return;const h=t.name("valid");for(const n of d)p(n)?m(n):(t.if((0,i.propertyInData)(t,c,n,l.opts.ownProperties)),m(n),l.allErrors||t.else().var(h,!0),t.endIf()),e.it.definedProperties.add(n),e.ok(h);function p(e){return l.opts.useDefaults&&!l.compositeRule&&void 0!==n[e].default}function m(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},h)}}};t.default=a},9713:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>r._`{propertyName: ${e.propertyName}}`},code(e){const{gen:t,schema:n,data:s,it:o}=e;if((0,i.alwaysValidSchema)(o,n))return;const a=t.name("valid");t.forIn("key",s,(n=>{e.setParams({propertyName:n}),e.subschema({keyword:"propertyNames",data:n,dataTypes:["string"],propertyName:n,compositeRule:!0},a),t.if((0,r.not)(a),(()=>{e.error(!0),o.allErrors||t.break()}))})),e.ok(a)}};t.default=s},4426:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4227),i={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){void 0===t.if&&(0,r.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};t.default=i},5765:(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 r=n(9029),i=n(4227),s=n(2023),o=n(4227);function a(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:r._`Object.prototype.hasOwnProperty`})}function c(e,t,n){return r._`${a(e)}.call(${t}, ${n})`}function l(e,t,n,i){const s=r._`${t}${(0,r.getProperty)(n)} === undefined`;return i?(0,r.or)(s,(0,r.not)(c(e,t,n))):s}function u(e){return e?Object.keys(e).filter((e=>"__proto__"!==e)):[]}t.checkReportMissingProp=function(e,t){const{gen:n,data:i,it:s}=e;n.if(l(n,i,t,s.opts.ownProperties),(()=>{e.setParams({missingProperty:r._`${t}`},!0),e.error()}))},t.checkMissingProp=function({gen:e,data:t,it:{opts:n}},i,s){return(0,r.or)(...i.map((i=>(0,r.and)(l(e,t,i,n.ownProperties),r._`${s} = ${i}`))))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=a,t.isOwnProperty=c,t.propertyInData=function(e,t,n,i){const s=r._`${t}${(0,r.getProperty)(n)} !== undefined`;return i?r._`${s} && ${c(e,t,n)}`:s},t.noPropertyInData=l,t.allSchemaProperties=u,t.schemaProperties=function(e,t){return u(t).filter((n=>!(0,i.alwaysValidSchema)(e,t[n])))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:n,topSchemaRef:i,schemaPath:o,errorPath:a},it:c},l,u,d){const h=d?r._`${e}, ${t}, ${i}${o}`:t,p=[[s.default.instancePath,(0,r.strConcat)(s.default.instancePath,a)],[s.default.parentData,c.parentData],[s.default.parentDataProperty,c.parentDataProperty],[s.default.rootData,s.default.rootData]];c.opts.dynamicRef&&p.push([s.default.dynamicAnchors,s.default.dynamicAnchors]);const m=r._`${h}, ${n.object(...p)}`;return u!==r.nil?r._`${l}.call(${u}, ${m})`:r._`${l}(${m})`};const d=r._`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},n){const i=t.unicodeRegExp?"u":"",{regExp:s}=t.code,a=s(n,i);return e.scopeValue("pattern",{key:a.toString(),ref:a,code:r._`${"new RegExp"===s.code?d:(0,o.useFunc)(e,s)}(${n}, ${i})`})},t.validateArray=function(e){const{gen:t,data:n,keyword:s,it:o}=e,a=t.name("valid");if(o.allErrors){const e=t.let("valid",!0);return c((()=>t.assign(e,!1))),e}return t.var(a,!0),c((()=>t.break())),a;function c(o){const c=t.const("len",r._`${n}.length`);t.forRange("i",0,c,(n=>{e.subschema({keyword:s,dataProp:n,dataPropType:i.Type.Num},a),t.if((0,r.not)(a),o)}))}},t.validateUnion=function(e){const{gen:t,schema:n,keyword:s,it:o}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some((e=>(0,i.alwaysValidSchema)(o,e)))&&!o.opts.unevaluated)return;const a=t.let("valid",!1),c=t.name("_valid");t.block((()=>n.forEach(((n,i)=>{const o=e.subschema({keyword:s,schemaProp:i,compositeRule:!0},c);t.assign(a,r._`${a} || ${c}`),e.mergeValidEvaluated(o,c)||t.if((0,r.not)(a))})))),e.result(a,(()=>e.reset()),(()=>e.error(!0)))}},3463:(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},2128:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3463),i=n(3693),s=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",r.default,i.default];t.default=s},3693:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;const r=n(4551),i=n(5765),s=n(9029),o=n(2023),a=n(3835),c=n(4227),l={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:n,it:i}=e,{baseId:o,schemaEnv:c,validateName:l,opts:h,self:p}=i,{root:m}=c;if(("#"===n||"#/"===n)&&o===m.baseId)return function(){if(c===m)return d(e,l,c,c.$async);const n=t.scopeValue("root",{ref:m});return d(e,s._`${n}.validate`,m,m.$async)}();const f=a.resolveRef.call(p,m,o,n);if(void 0===f)throw new r.default(i.opts.uriResolver,o,n);return f instanceof a.SchemaEnv?function(t){const n=u(e,t);d(e,n,t,t.$async)}(f):function(r){const i=t.scopeValue("schema",!0===h.code.source?{ref:r,code:(0,s.stringify)(r)}:{ref:r}),o=t.name("valid"),a=e.subschema({schema:r,dataTypes:[],schemaPath:s.nil,topSchemaRef:i,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}):s._`${n.scopeValue("wrapper",{ref:t})}.validate`}function d(e,t,n,r){const{gen:a,it:l}=e,{allErrors:u,schemaEnv:d,opts:h}=l,p=h.passContext?o.default.this:s.nil;function m(e){const t=s._`${e}.errors`;a.assign(o.default.vErrors,s._`${o.default.vErrors} === null ? ${t} : ${o.default.vErrors}.concat(${t})`),a.assign(o.default.errors,s._`${o.default.vErrors}.length`)}function f(e){var t;if(!l.opts.unevaluated)return;const r=null===(t=null==n?void 0:n.validate)||void 0===t?void 0:t.evaluated;if(!0!==l.props)if(r&&!r.dynamicProps)void 0!==r.props&&(l.props=c.mergeEvaluated.props(a,r.props,l.props));else{const t=a.var("props",s._`${e}.evaluated.props`);l.props=c.mergeEvaluated.props(a,t,l.props,s.Name)}if(!0!==l.items)if(r&&!r.dynamicItems)void 0!==r.items&&(l.items=c.mergeEvaluated.items(a,r.items,l.items));else{const t=a.var("items",s._`${e}.evaluated.items`);l.items=c.mergeEvaluated.items(a,t,l.items,s.Name)}}r?function(){if(!d.$async)throw new Error("async schema referenced by sync schema");const n=a.let("valid");a.try((()=>{a.code(s._`await ${(0,i.callValidateCode)(e,t,p)}`),f(t),u||a.assign(n,!0)}),(e=>{a.if(s._`!(${e} instanceof ${l.ValidationError})`,(()=>a.throw(e))),m(e),u||a.assign(n,!1)})),e.ok(n)}():e.result((0,i.callValidateCode)(e,t,p),(()=>f(t)),(()=>m(t)))}t.getValidate=u,t.callRef=d,t.default=l},6653:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(7652),s=n(3835),o=n(4551),a=n(4227),c={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===i.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>r._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},code(e){const{gen:t,data:n,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw new Error("discriminator: requires discriminator option");const h=c.propertyName;if("string"!=typeof h)throw new Error("discriminator: requires propertyName");if(c.mapping)throw new Error("discriminator: mapping is not supported");if(!d)throw new Error("discriminator: requires oneOf keyword");const p=t.let("valid",!1),m=t.const("tag",r._`${n}${(0,r.getProperty)(h)}`);function f(n){const i=t.name("valid"),s=e.subschema({keyword:"oneOf",schemaProp:n},i);return e.mergeEvaluated(s,r.Name),i}t.if(r._`typeof ${m} == "string"`,(()=>function(){const n=function(){var e;const t={},n=i(l);let r=!0;for(let t=0;t<d.length;t++){let l=d[t];if((null==l?void 0:l.$ref)&&!(0,a.schemaHasRulesButRef)(l,u.self.RULES)){const e=l.$ref;if(l=s.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),l instanceof s.SchemaEnv&&(l=l.schema),void 0===l)throw new o.default(u.opts.uriResolver,u.baseId,e)}const p=null===(e=null==l?void 0:l.properties)||void 0===e?void 0:e[h];if("object"!=typeof p)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${h}"`);r=r&&(n||i(l)),c(p,t)}if(!r)throw new Error(`discriminator: "${h}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(h)}function c(e,t){if(e.const)p(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${h}" must have "const" or "enum"`);for(const n of e.enum)p(n,t)}}function p(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(r._`${m} === ${e}`),t.assign(p,f(n[e]));t.else(),e.error(!1,{discrError:i.DiscrError.Mapping,tag:m,tagName:h}),t.endIf()}()),(()=>e.error(!1,{discrError:i.DiscrError.Tag,tag:m,tagName:h}))),e.ok(p)}};t.default=c},7652:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(n||(t.DiscrError=n={}))},6105:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2128),i=n(7060),s=n(6378),o=n(5520),a=n(5413),c=n(3265),l=n(7532),u=n(9857),d=[o.default,r.default,i.default,(0,s.default)(!0),l.default,u.metadataVocabulary,u.contentVocabulary,a.default,c.default];t.default=d},6144:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2128),i=n(7060),s=n(6378),o=n(7532),a=n(9857),c=[r.default,i.default,(0,s.default)(),o.default,a.metadataVocabulary,a.contentVocabulary];t.default=c},2476:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicAnchor=void 0;const r=n(9029),i=n(2023),s=n(3835),o=n(3693),a={keyword:"$dynamicAnchor",schemaType:"string",code:e=>c(e,e.schema)};function c(e,t){const{gen:n,it:a}=e;a.schemaEnv.root.dynamicAnchors[t]=!0;const c=r._`${i.default.dynamicAnchors}${(0,r.getProperty)(t)}`,l="#"===a.errSchemaPath?a.validateName:function(e){const{schemaEnv:t,schema:n,self:r}=e.it,{root:i,baseId:a,localRefs:c,meta:l}=t.root,{schemaId:u}=r.opts,d=new s.SchemaEnv({schema:n,schemaId:u,root:i,baseId:a,localRefs:c,meta:l});return s.compileSchema.call(r,d),(0,o.getValidate)(e,d)}(e);n.if(r._`!${c}`,(()=>n.assign(c,l)))}t.dynamicAnchor=c,t.default=a},3252:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dynamicRef=void 0;const r=n(9029),i=n(2023),s=n(3693),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 c=t.slice(1);if(a.allErrors)l();else{const t=n.let("valid",!1);l(t),e.ok(t)}function l(e){if(a.schemaEnv.root.dynamicAnchors[c]){const t=n.let("_v",r._`${i.default.dynamicAnchors}${(0,r.getProperty)(c)}`);n.if(t,u(t,e),u(a.validateName,e))}else u(a.validateName,e)()}function u(t,r){return r?()=>n.block((()=>{(0,s.callRef)(e,t),n.let(r,!0)})):()=>(0,s.callRef)(e,t)}}t.dynamicRef=a,t.default=o},5520:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2476),i=n(3252),s=n(2721),o=n(3799),a=[r.default,i.default,s.default,o.default];t.default=a},2721:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(2476),i=n(4227),s={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){e.schema?(0,r.dynamicAnchor)(e,""):(0,i.checkStrictMode)(e.it,"$recursiveAnchor: false is ignored")}};t.default=s},3799:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3252),i={keyword:"$recursiveRef",schemaType:"string",code:e=>(0,r.dynamicRef)(e,e.schema)};t.default=i},4737:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>r.str`must match format "${e}"`,params:({schemaCode:e})=>r._`{format: ${e}}`},code(e,t){const{gen:n,data:i,$data:s,schema:o,schemaCode:a,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:h}=c;l.validateFormats&&(s?function(){const s=n.scopeValue("formats",{ref:h.formats,code:l.code.formats}),o=n.const("fDef",r._`${s}[${a}]`),c=n.let("fType"),u=n.let("format");n.if(r._`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>n.assign(c,r._`${o}.type || "string"`).assign(u,r._`${o}.validate`)),(()=>n.assign(c,r._`"string"`).assign(u,o))),e.fail$data((0,r.or)(!1===l.strictSchema?r.nil:r._`${a} && !${u}`,function(){const e=d.$async?r._`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:r._`${u}(${i})`,n=r._`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return r._`${u} && ${u} !== true && ${c} === ${t} && !${n}`}()))}():function(){const s=h.formats[o];if(!s)return void function(){if(!1!==l.strictSchema)throw new Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}h.logger.warn(e())}();if(!0===s)return;const[a,c,p]=function(e){const t=e instanceof RegExp?(0,r.regexpCode)(e):l.code.formats?r._`${l.code.formats}${(0,r.getProperty)(o)}`:void 0,i=n.scopeValue("formats",{key:o,ref:e,code:t});return"object"!=typeof e||e instanceof RegExp?["string",e,i]:[e.type||"string",e.validate,r._`${i}.validate`]}(s);a===t&&e.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!d.$async)throw new Error("async format in sync schema");return r._`await ${p}(${i})`}return"function"==typeof c?r._`${p}(${i})`:r._`${p}.test(${i})`}())}())}};t.default=i},7532:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=[n(4737).default];t.default=r},9857:(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"]},5413:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(1846),i=n(4845),s=n(2626),o=[r.default,i.default,s.default];t.default=o},3265:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(392),i=n(3445),s=[r.default,i.default];t.default=s},3445:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:e}})=>r.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>r._`{limit: ${e}}`},code(e){const{gen:t,schema:n,data:s,it:o}=e,a=o.items||0;if(!0===a)return;const c=t.const("len",r._`${s}.length`);if(!1===n)e.setParams({len:a}),e.fail(r._`${c} > ${a}`);else if("object"==typeof n&&!(0,i.alwaysValidSchema)(o,n)){const n=t.var("valid",r._`${c} <= ${a}`);t.if((0,r.not)(n),(()=>function(n,s){t.forRange("i",s,c,(s=>{e.subschema({keyword:"unevaluatedItems",dataProp:s,dataPropType:i.Type.Num},n),o.allErrors||t.if((0,r.not)(n),(()=>t.break()))}))}(n,a))),e.ok(n)}o.items=!0}};t.default=s},392:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(2023),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:e})=>r._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},code(e){const{gen:t,schema:n,data:o,errsCount:a,it:c}=e;if(!a)throw new Error("ajv implementation error");const{allErrors:l,props:u}=c;function d(s){if(!1===n)return e.setParams({unevaluatedProperty:s}),e.error(),void(l||t.break());if(!(0,i.alwaysValidSchema)(c,n)){const n=t.name("valid");e.subschema({keyword:"unevaluatedProperties",dataProp:s,dataPropType:i.Type.Str},n),l||t.if((0,r.not)(n),(()=>t.break()))}}u instanceof r.Name?t.if(r._`${u} !== true`,(()=>t.forIn("key",o,(e=>t.if(function(e,t){return r._`!${e} || !${e}[${t}]`}(u,e),(()=>d(e))))))):!0!==u&&t.forIn("key",o,(e=>void 0===u?d(e):t.if(function(e,t){const n=[];for(const i in e)!0===e[i]&&n.push(r._`${t} !== ${i}`);return(0,r.and)(...n)}(u,e),(()=>d(e))))),c.props=!0,e.ok(r._`${a} === ${s.default.errors}`)}};t.default=o},7935:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(6250),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>r._`{allowedValue: ${e}}`},code(e){const{gen:t,data:n,$data:o,schemaCode:a,schema:c}=e;o||c&&"object"==typeof c?e.fail$data(r._`!${(0,i.useFunc)(t,s.default)}(${n}, ${a})`):e.fail(r._`${c} !== ${n}`)}};t.default=o},1846:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(3025),i={keyword:"dependentRequired",type:"object",schemaType:"object",error:r.error,code:e=>(0,r.validatePropertyDeps)(e)};t.default=i},8643:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(6250),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>r._`{allowedValues: ${e}}`},code(e){const{gen:t,data:n,$data:o,schema:a,schemaCode:c,it:l}=e;if(!o&&0===a.length)throw new Error("enum must have non-empty array");const u=a.length>=l.opts.loopEnum;let d;const h=()=>null!=d?d:d=(0,i.useFunc)(t,s.default);let p;if(u||o)p=t.let("valid"),e.block$data(p,(function(){t.assign(p,!1),t.forOf("v",c,(e=>t.if(r._`${h()}(${n}, ${e})`,(()=>t.assign(p,!0).break()))))}));else{if(!Array.isArray(a))throw new Error("ajv implementation error");const e=t.const("vSchema",c);p=(0,r.or)(...a.map(((t,i)=>function(e,t){const i=a[t];return"object"==typeof i&&null!==i?r._`${h()}(${n}, ${e}[${t}])`:r._`${n} === ${i}`}(e,i))))}e.pass(p)}};t.default=o},7060:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5882),i=n(3439),s=n(7307),o=n(422),a=n(4486),c=n(4003),l=n(1163),u=n(617),d=n(7935),h=n(8643),p=[r.default,i.default,s.default,o.default,a.default,c.default,l.default,u.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},d.default,h.default];t.default=p},2626:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4227),i={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){void 0===t.contains&&(0,r.checkStrictMode)(n,`"${e}" without "contains" is ignored`)}};t.default=i},1163:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxItems"===e?"more":"fewer";return r.str`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>r._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:i}=e,s="maxItems"===t?r.operators.GT:r.operators.LT;e.fail$data(r._`${n}.length ${s} ${i}`)}};t.default=i},7307:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=n(4227),s=n(3853),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxLength"===e?"more":"fewer";return r.str`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>r._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:o,it:a}=e,c="maxLength"===t?r.operators.GT:r.operators.LT,l=!1===a.opts.unicode?r._`${n}.length`:r._`${(0,i.useFunc)(e.gen,s.default)}(${n})`;e.fail$data(r._`${l} ${c} ${o}`)}};t.default=o},5882:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i=r.operators,s={maximum:{okStr:"<=",ok:i.LTE,fail:i.GT},minimum:{okStr:">=",ok:i.GTE,fail:i.LT},exclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},exclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}},o={message:({keyword:e,schemaCode:t})=>r.str`must be ${s[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>r._`{comparison: ${s[e].okStr}, limit: ${t}}`},a={keyword:Object.keys(s),type:"number",schemaType:"number",$data:!0,error:o,code(e){const{keyword:t,data:n,schemaCode:i}=e;e.fail$data(r._`${n} ${s[t].fail} ${i} || isNaN(${n})`)}};t.default=a},4486:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:e,schemaCode:t}){const n="maxProperties"===e?"more":"fewer";return r.str`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>r._`{limit: ${e}}`},code(e){const{keyword:t,data:n,schemaCode:i}=e,s="maxProperties"===t?r.operators.GT:r.operators.LT;e.fail$data(r._`Object.keys(${n}).length ${s} ${i}`)}};t.default=i},3439:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(9029),i={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>r.str`must be multiple of ${e}`,params:({schemaCode:e})=>r._`{multipleOf: ${e}}`},code(e){const{gen:t,data:n,schemaCode:i,it:s}=e,o=s.opts.multipleOfPrecision,a=t.let("res"),c=o?r._`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:r._`${a} !== parseInt(${a})`;e.fail$data(r._`(${i} === 0 || (${a} = ${n}/${i}, ${c}))`)}};t.default=i},422:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5765),i=n(9029),s={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>i.str`must match pattern "${e}"`,params:({schemaCode:e})=>i._`{pattern: ${e}}`},code(e){const{data:t,$data:n,schema:s,schemaCode:o,it:a}=e,c=a.opts.unicodeRegExp?"u":"",l=n?i._`(new RegExp(${o}, ${c}))`:(0,r.usePattern)(e,s);e.fail$data(i._`!${l}.test(${t})`)}};t.default=s},4003:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(5765),i=n(9029),s=n(4227),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>i.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>i._`{missingProperty: ${e}}`},code(e){const{gen:t,schema:n,schemaCode:o,data:a,$data:c,it:l}=e,{opts:u}=l;if(!c&&0===n.length)return;const d=n.length>=u.loopRequired;if(l.allErrors?function(){if(d||c)e.block$data(i.nil,h);else for(const t of n)(0,r.checkReportMissingProp)(e,t)}():function(){const s=t.let("missing");if(d||c){const n=t.let("valid",!0);e.block$data(n,(()=>function(n,s){e.setParams({missingProperty:n}),t.forOf(n,o,(()=>{t.assign(s,(0,r.propertyInData)(t,a,n,u.ownProperties)),t.if((0,i.not)(s),(()=>{e.error(),t.break()}))}),i.nil)}(s,n))),e.ok(n)}else t.if((0,r.checkMissingProp)(e,n,s)),(0,r.reportMissingProp)(e,s),t.else()}(),u.strictRequired){const t=e.parentSchema.properties,{definedProperties:r}=e.it;for(const e of n)if(void 0===(null==t?void 0:t[e])&&!r.has(e)){const t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,s.checkStrictMode)(l,t,l.opts.strictRequired)}}function h(){t.forOf("prop",o,(n=>{e.setParams({missingProperty:n}),t.if((0,r.noPropertyInData)(t,a,n,u.ownProperties),(()=>e.error()))}))}}};t.default=o},617:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(208),i=n(9029),s=n(4227),o=n(6250),a={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>i.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>i._`{i: ${e}, j: ${t}}`},code(e){const{gen:t,data:n,$data:a,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!a&&!c)return;const h=t.let("valid"),p=l.items?(0,r.getSchemaTypes)(l.items):[];function m(s,o){const a=t.name("item"),c=(0,r.checkDataTypes)(p,a,d.opts.strictNumbers,r.DataType.Wrong),l=t.const("indices",i._`{}`);t.for(i._`;${s}--;`,(()=>{t.let(a,i._`${n}[${s}]`),t.if(c,i._`continue`),p.length>1&&t.if(i._`typeof ${a} == "string"`,i._`${a} += "_"`),t.if(i._`typeof ${l}[${a}] == "number"`,(()=>{t.assign(o,i._`${l}[${a}]`),e.error(),t.assign(h,!1).break()})).code(i._`${l}[${a}] = ${s}`)}))}function f(r,a){const c=(0,s.useFunc)(t,o.default),l=t.name("outer");t.label(l).for(i._`;${r}--;`,(()=>t.for(i._`${a} = ${r}; ${a}--;`,(()=>t.if(i._`${c}(${n}[${r}], ${n}[${a}])`,(()=>{e.error(),t.assign(h,!1).break(l)}))))))}e.block$data(h,(function(){const r=t.let("i",i._`${n}.length`),s=t.let("j");e.setParams({i:r,j:s}),t.assign(h,!0),t.if(i._`${r} > 1`,(()=>(p.length>0&&!p.some((e=>"object"===e||"array"===e))?m:f)(r,s)))}),i._`${u} === false`),e.ok(h)}};t.default=a},5488:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());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},5999:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());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},857:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());o.push([e.id,".monomer-manager-root .grok-sketcher {\n min-width: unset !important;\n}\n\n.monomer-manager-root {\n width: 100% !important;\n height: 100% !important;\n}\n\n.monomer-manager-sketcher .ketcher-host {\n height: 100% !important;\n} \n\n.monomer-manager-root > div:first-child {\n flex-basis: 40% !important;\n}\n.monomer-manager-root > div:nth-child(2) {\n flex-basis: 60% !important;\n}\n\n.monomer-manager-root > div:first-child > .ui-form {\n max-width: unset !important;\n}\n\n.monomer-card-info-row {\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-bottom: 10px;\n}\n\n.monomer-card-info-row > div:nth-child(2) {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.monomer-card-info-row > div:nth-child(1) {\n font-weight: bold;\n margin-right: 5px;\n text-wrap: nowrap;\n}\n\n.duplicate-monomer-symbol-row {\n visibility: visible !important;\n}\n\n.monomer-card-root {\n border: 2px solid var(--grey-2);\n border-radius: 5px;\n padding: 5px;\n margin: 5px;\n overflow: hidden;\n align-items: center;\n cursor: pointer;\n width: 200px;\n height: 300px;\n min-width: 200px;\n min-height: 300px;\n}\n\n.duplicate-monomers-virtual-view {\n width: 100% !important;\n overflow-x: clip;\n overflow-y: auto;\n}","",{version:3,sources:["webpack://./css/monomer-manager.css"],names:[],mappings:"AAAA;IACI,2BAA2B;AAC/B;;AAEA;IACI,sBAAsB;IACtB,uBAAuB;AAC3B;;AAEA;IACI,uBAAuB;AAC3B;;AAEA;IACI,0BAA0B;AAC9B;AACA;IACI,0BAA0B;AAC9B;;AAEA;IACI,2BAA2B;AAC/B;;AAEA;IACI,WAAW;IACX,gBAAgB;IAChB,uBAAuB;IACvB,mBAAmB;AACvB;;AAEA;IACI,mBAAmB;IACnB,gBAAgB;IAChB,uBAAuB;AAC3B;;AAEA;IACI,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;AACrB;;AAEA;IACI,8BAA8B;AAClC;;AAEA;IACI,+BAA+B;IAC/B,kBAAkB;IAClB,YAAY;IACZ,WAAW;IACX,gBAAgB;IAChB,mBAAmB;IACnB,eAAe;IACf,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,iBAAiB;AACrB;;AAEA;IACI,sBAAsB;IACtB,gBAAgB;IAChB,gBAAgB;AACpB",sourcesContent:[".monomer-manager-root .grok-sketcher {\n min-width: unset !important;\n}\n\n.monomer-manager-root {\n width: 100% !important;\n height: 100% !important;\n}\n\n.monomer-manager-sketcher .ketcher-host {\n height: 100% !important;\n} \n\n.monomer-manager-root > div:first-child {\n flex-basis: 40% !important;\n}\n.monomer-manager-root > div:nth-child(2) {\n flex-basis: 60% !important;\n}\n\n.monomer-manager-root > div:first-child > .ui-form {\n max-width: unset !important;\n}\n\n.monomer-card-info-row {\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-bottom: 10px;\n}\n\n.monomer-card-info-row > div:nth-child(2) {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.monomer-card-info-row > div:nth-child(1) {\n font-weight: bold;\n margin-right: 5px;\n text-wrap: nowrap;\n}\n\n.duplicate-monomer-symbol-row {\n visibility: visible !important;\n}\n\n.monomer-card-root {\n border: 2px solid var(--grey-2);\n border-radius: 5px;\n padding: 5px;\n margin: 5px;\n overflow: hidden;\n align-items: center;\n cursor: pointer;\n width: 200px;\n height: 300px;\n min-width: 200px;\n min-height: 300px;\n}\n\n.duplicate-monomers-virtual-view {\n width: 100% !important;\n overflow-x: clip;\n overflow-y: auto;\n}"],sourceRoot:""}]);const a=o},6369:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());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},7939:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());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\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings:not(.ml-dim-reduction-column-editor-input-root i) {\n left: -20px;\n}\n.dlg-dimensionality-reduction.ui-form, .dlg-markov-clustering.ui-form, .dlg-markov-clustering.ui-form .ui-form, .dlg-dimensionality-reduction.ui-form .ui-form {\n max-width: unset;\n}\n\n.ml-dim-reduction-column-editor-input-root label {\n display: none !important;\n}\n\n.dim-reduction-dialog-form > .ui-input-root, .dim-reduction-dialog-form > div > .ui-input-root {\n margin-left: 10px;\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: 700px !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}\n\n.ml-dim-reduction-column-editor-table-root .header > td:not(:first-child) {\n padding-left: 32px;\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;;AAEhB;;AAEA;IACI,WAAW;AACf;AACA;IACI,gBAAgB;AACpB;;AAEA;IACI,wBAAwB;AAC5B;;AAEA;IACI,iBAAiB;AACrB;;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;;AAEA;IACI,kBAAkB;AACtB",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\n.ml-dim-reduction-settings-input i.grok-icon.grok-font-icon-settings:not(.ml-dim-reduction-column-editor-input-root i) {\n left: -20px;\n}\n.dlg-dimensionality-reduction.ui-form, .dlg-markov-clustering.ui-form, .dlg-markov-clustering.ui-form .ui-form, .dlg-dimensionality-reduction.ui-form .ui-form {\n max-width: unset;\n}\n\n.ml-dim-reduction-column-editor-input-root label {\n display: none !important;\n}\n\n.dim-reduction-dialog-form > .ui-input-root, .dim-reduction-dialog-form > div > .ui-input-root {\n margin-left: 10px;\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: 700px !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}\n\n.ml-dim-reduction-column-editor-table-root .header > td:not(:first-child) {\n padding-left: 32px;\n}"],sourceRoot:""}]);const a=o},3017:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(1354),i=n.n(r),s=n(6314),o=n.n(s)()(i());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},6314:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,i,s){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(r)for(var a=0;a<this.length;a++){var c=this[a][0];null!=c&&(o[c]=!0)}for(var l=0;l<e.length;l++){var u=[].concat(e[l]);r&&o[u[0]]||(void 0!==s&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=s),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),i&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=i):u[4]="".concat(i)),t.push(u))}},t}},1354:e=>{"use strict";e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;if("function"==typeof btoa){var r=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),i="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(r),s="/*# ".concat(i," */");return[t].concat([s]).join("\n")}return[t].join("\n")}},2017: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 r,i,s;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))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((r=(s=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;0!=i--;){var o=s[i];if(!e(t[o],n[o]))return!1}return!0}return t!=t&&n!=n}},9982:function(e,t,n){var r;!function(){var t={};!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,r,i,s){for(var o,a,c,l,u,d,h,p,m,f,g,y,w;s>=64;){for(o=n[0],a=n[1],c=n[2],l=n[3],u=n[4],d=n[5],h=n[6],p=n[7],f=0;f<16;f++)g=i+4*f,e[f]=(255&r[g])<<24|(255&r[g+1])<<16|(255&r[g+2])<<8|255&r[g+3];for(f=16;f<64;f++)y=((m=e[f-2])>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,w=((m=e[f-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>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&d^~u&h)|0)+(p+(t[f]+e[f]|0)|0)|0,w=((o>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+(o&a^o&c^a&c)|0,p=h,h=d,d=u,u=l+y|0,l=c,c=a,a=o,o=y+w|0;n[0]+=o,n[1]+=a,n[2]+=c,n[3]+=l,n[4]+=u,n[5]+=d,n[6]+=h,n[7]+=p,i+=64,s-=64}return i}var r=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 r=0;if(this.bytesHashed+=t,this.bufferLength>0){for(;this.bufferLength<64&&t>0;)this.buffer[this.bufferLength++]=e[r++],t--;64===this.bufferLength&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(t>=64&&(r=n(this.temp,this.state,e,r,t),t%=64);t>0;)this.buffer[this.bufferLength++]=e[r++],t--;return this},t.prototype.finish=function(e){if(!this.finished){var t=this.bytesHashed,r=this.bufferLength,i=t/536870912|0,s=t<<3,o=t%64<56?64:128;this.buffer[r]=128;for(var a=r+1;a<o-8;a++)this.buffer[a]=0;this.buffer[o-8]=i>>>24&255,this.buffer[o-7]=i>>>16&255,this.buffer[o-6]=i>>>8&255,this.buffer[o-5]=i>>>0&255,this.buffer[o-4]=s>>>24&255,this.buffer[o-3]=s>>>16&255,this.buffer[o-2]=s>>>8&255,this.buffer[o-1]=s>>>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=r;var i=function(){function e(e){this.inner=new r,this.outer=new r,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var t=new Uint8Array(this.blockSize);if(e.length>this.blockSize)(new r).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 s(e){var t=(new r).update(e),n=t.digest();return t.clean(),n}function o(e,t){var n=new i(e).update(t),r=n.digest();return n.clean(),r}function a(e,t,n,r){var i=r[0];if(0===i)throw new Error("hkdf: cannot expand more");t.reset(),i>1&&t.update(e),n&&t.update(n),t.update(r),t.finish(e),r[0]++}e.HMAC=i,e.hash=s,e.default=s,e.hmac=o;var c=new Uint8Array(e.digestLength);e.hkdf=function(e,t,n,r){void 0===t&&(t=c),void 0===r&&(r=32);for(var s=new Uint8Array([1]),l=o(t,e),u=new i(l),d=new Uint8Array(u.digestLength),h=d.length,p=new Uint8Array(r),m=0;m<r;m++)h===d.length&&(a(d,u,n,s),h=0),p[m]=d[h++];return u.clean(),d.fill(0),s.fill(0),p},e.pbkdf2=function(e,t,n,r){for(var s=new i(e),o=s.digestLength,a=new Uint8Array(4),c=new Uint8Array(o),l=new Uint8Array(o),u=new Uint8Array(r),d=0;d*o<r;d++){var h=d+1;a[0]=h>>>24&255,a[1]=h>>>16&255,a[2]=h>>>8&255,a[3]=h>>>0&255,s.reset(),s.update(t),s.update(a),s.finish(l);for(var p=0;p<o;p++)c[p]=l[p];for(p=2;p<=n;p++){s.reset(),s.update(l).finish(l);for(var m=0;m<o;m++)c[m]^=l[m]}for(p=0;p<o&&d*o+p<r;p++)u[d*o+p]=c[p]}for(d=0;d<o;d++)c[d]=l[d]=0;for(d=0;d<4;d++)a[d]=0;return s.clean(),u}}(t);var i=t.default;for(var s in t)i[s]=t[s];"object"==typeof e.exports?e.exports=i:void 0===(r=function(){return i}.call(t,n,t,e))||(e.exports=r)}()},2787:(e,t,n)=>{"use strict";n.d(t,{I:()=>i});const r=new Uint32Array(65536),i=(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,i=t.length,s=1<<n-1;let o=-1,a=0,c=n,l=n;for(;l--;)r[e.charCodeAt(l)]|=1<<l;for(l=0;l<i;l++){let e=r[t.charCodeAt(l)];const n=e|a;e|=(e&o)+o^o,a|=~(e|o),o&=e,a&s&&c++,o&s&&c--,a=a<<1|1,o=o<<1|~(n|a),a&=n}for(l=n;l--;)r[e.charCodeAt(l)]=0;return c})(e,t):((e,t)=>{const n=t.length,i=e.length,s=[],o=[],a=Math.ceil(n/32),c=Math.ceil(i/32);for(let e=0;e<a;e++)o[e]=-1,s[e]=0;let l=0;for(;l<c-1;l++){let a=0,c=-1;const u=32*l,d=Math.min(32,i)+u;for(let t=u;t<d;t++)r[e.charCodeAt(t)]|=1<<t;for(let e=0;e<n;e++){const n=r[t.charCodeAt(e)],i=o[e/32|0]>>>e&1,l=s[e/32|0]>>>e&1,u=n|a,d=((n|l)&c)+c^c|n|l;let h=a|~(d|c),p=c&d;h>>>31^i&&(o[e/32|0]^=1<<e),p>>>31^l&&(s[e/32|0]^=1<<e),h=h<<1|i,p=p<<1|l,c=p|~(u|h),a=h&u}for(let t=u;t<d;t++)r[e.charCodeAt(t)]=0}let u=0,d=-1;const h=32*l,p=Math.min(32,i-h)+h;for(let t=h;t<p;t++)r[e.charCodeAt(t)]|=1<<t;let m=i;for(let e=0;e<n;e++){const n=r[t.charCodeAt(e)],a=o[e/32|0]>>>e&1,c=s[e/32|0]>>>e&1,l=n|u,h=((n|c)&d)+d^d|n|c;let p=u|~(h|d),f=d&h;m+=p>>>i-1&1,m-=f>>>i-1&1,p>>>31^a&&(o[e/32|0]^=1<<e),f>>>31^c&&(s[e/32|0]^=1<<e),p=p<<1|a,f=f<<1|c,d=f|~(l|p),u=p&l}for(let t=h;t<p;t++)r[e.charCodeAt(t)]=0;return m})(e,t)}},9937:e=>{e.exports={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}},1782:(e,t)=>{t.assign=function(e){e=e||{};var t,n,r,i=Array.prototype.slice.call(arguments).slice(1);for(t=0,r=i.length;t<r;t++)if(i[t])for(n in i[t])e[n]=i[t][n];return e},t.validateSettings=function(e){return"linLogMode"in e&&"boolean"!=typeof e.linLogMode?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in e&&"boolean"!=typeof e.outboundAttractionDistribution?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in e&&"boolean"!=typeof e.adjustSizes?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in e&&"number"!=typeof e.edgeWeightInfluence?{message:"the `edgeWeightInfluence` setting should be a number."}:!("scalingRatio"in e)||"number"==typeof e.scalingRatio&&e.scalingRatio>=0?"strongGravityMode"in e&&"boolean"!=typeof e.strongGravityMode?{message:"the `strongGravityMode` setting should be a boolean."}:!("gravity"in e)||"number"==typeof e.gravity&&e.gravity>=0?"slowDown"in e&&!("number"==typeof e.slowDown||e.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in e&&"boolean"!=typeof e.barnesHutOptimize?{message:"the `barnesHutOptimize` setting should be a boolean."}:!("barnesHutTheta"in e)||"number"==typeof e.barnesHutTheta&&e.barnesHutTheta>=0?null:{message:"the `barnesHutTheta` setting should be a number >= 0."}:{message:"the `gravity` setting should be a number >= 0."}:{message:"the `scalingRatio` setting should be a number >= 0."}},t.graphToByteArrays=function(e,t){var n,r=e.order,i=e.size,s={},o=new Float32Array(10*r),a=new Float32Array(3*i);return n=0,e.forEachNode((function(e,t){s[e]=n,o[n]=t.x,o[n+1]=t.y,o[n+2]=0,o[n+3]=0,o[n+4]=0,o[n+5]=0,o[n+6]=1,o[n+7]=1,o[n+8]=t.size||1,o[n+9]=t.fixed?1:0,n+=10})),n=0,e.forEachEdge((function(e,r,i,c,l,u,d){var h=s[i],p=s[c],m=t(e,r,i,c,l,u,d);o[h+6]+=m,o[p+6]+=m,a[n]=h,a[n+1]=p,a[n+2]=m,n+=3})),{nodes:o,edges:a}},t.assignLayoutChanges=function(e,t,n){var r=0;e.updateEachNodeAttributes((function(e,i){return i.x=t[r],i.y=t[r+1],r+=10,n?n(e,i):i}))},t.readGraphPositions=function(e,t){var n=0;e.forEachNode((function(e,r){t[n]=r.x,t[n+1]=r.y,n+=10}))},t.collectLayoutChanges=function(e,t,n){for(var r=e.nodes(),i={},s=0,o=0,a=t.length;s<a;s+=10){if(n){var c=Object.assign({},e.getNodeAttributes(r[o]));c.x=t[s],c.y=t[s+1],c=n(r[o],c),i[r[o]]={x:c.x,y:c.y}}else i[r[o]]={x:t[s],y:t[s+1]};o++}return i},t.createWorker=function(e){var t=window.URL||window.webkitURL,n=e.toString(),r=t.createObjectURL(new Blob(["("+n+").call(this);"],{type:"text/javascript"})),i=new Worker(r);return t.revokeObjectURL(r),i}},8903:(e,t,n)=>{var r=n(1736),i=n(8153).Fd,s=n(2561),o=n(1782),a=n(9937);function c(e,t,n){if(!r(t))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");"number"==typeof n&&(n={iterations:n});var c=n.iterations;if("number"!=typeof c)throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(c<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var l=i("getEdgeWeight"in n?n.getEdgeWeight:"weight").fromEntry,u="function"==typeof n.outputReducer?n.outputReducer:null,d=o.assign({},a,n.settings),h=o.validateSettings(d);if(h)throw new Error("graphology-layout-forceatlas2: "+h.message);var p,m=o.graphToByteArrays(t,l);for(p=0;p<c;p++)s(d,m.nodes,m.edges);if(!e)return o.collectLayoutChanges(t,m.nodes);o.assignLayoutChanges(t,m.nodes,u)}var l=c.bind(null,!1);l.assign=c.bind(null,!0),l.inferSettings=function(e){var t="number"==typeof e?e:e.order;return{barnesHutOptimize:t>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(t)}},e.exports=l},2561:e=>{var t=10;e.exports=function(e,n,r){var i,s,o,a,c,l,u,d,h,p,m,f,g,y,w,b,v,A,E,C,T,S,_,P=n.length,x=r.length,M=e.adjustSizes,$=e.barnesHutTheta*e.barnesHutTheta,N=[];for(o=0;o<P;o+=t)n[o+4]=n[o+2],n[o+5]=n[o+3],n[o+2]=0,n[o+3]=0;if(e.outboundAttractionDistribution){for(m=0,o=0;o<P;o+=t)m+=n[o+6];m/=P/t}if(e.barnesHutOptimize){var L,I,R,O=1/0,k=-1/0,G=1/0,H=-1/0;for(o=0;o<P;o+=t)O=Math.min(O,n[o+0]),k=Math.max(k,n[o+0]),G=Math.min(G,n[o+1]),H=Math.max(H,n[o+1]);var D=k-O,F=H-G;for(D>F?H=(G-=(D-F)/2)+D:k=(O-=(F-D)/2)+F,N[0]=-1,N[1]=(O+k)/2,N[2]=(G+H)/2,N[3]=Math.max(k-O,H-G),N[4]=-1,N[5]=-1,N[6]=0,N[7]=0,N[8]=0,i=1,o=0;o<P;o+=t)for(s=0,R=3;;){if(!(N[s+5]>=0)){if(N[s+0]<0){N[s+0]=o;break}if(N[s+5]=9*i,d=N[s+3]/2,N[(h=N[s+5])+0]=-1,N[h+1]=N[s+1]-d,N[h+2]=N[s+2]-d,N[h+3]=d,N[h+4]=h+9,N[h+5]=-1,N[h+6]=0,N[h+7]=0,N[h+8]=0,N[(h+=9)+0]=-1,N[h+1]=N[s+1]-d,N[h+2]=N[s+2]+d,N[h+3]=d,N[h+4]=h+9,N[h+5]=-1,N[h+6]=0,N[h+7]=0,N[h+8]=0,N[(h+=9)+0]=-1,N[h+1]=N[s+1]+d,N[h+2]=N[s+2]-d,N[h+3]=d,N[h+4]=h+9,N[h+5]=-1,N[h+6]=0,N[h+7]=0,N[h+8]=0,N[(h+=9)+0]=-1,N[h+1]=N[s+1]+d,N[h+2]=N[s+2]+d,N[h+3]=d,N[h+4]=N[s+4],N[h+5]=-1,N[h+6]=0,N[h+7]=0,N[h+8]=0,i+=4,L=n[N[s+0]+0]<N[s+1]?n[N[s+0]+1]<N[s+2]?N[s+5]:N[s+5]+9:n[N[s+0]+1]<N[s+2]?N[s+5]+18:N[s+5]+27,N[s+6]=n[N[s+0]+6],N[s+7]=n[N[s+0]+0],N[s+8]=n[N[s+0]+1],N[L+0]=N[s+0],N[s+0]=-1,L===(I=n[o+0]<N[s+1]?n[o+1]<N[s+2]?N[s+5]:N[s+5]+9:n[o+1]<N[s+2]?N[s+5]+18:N[s+5]+27)){if(R--){s=L;continue}R=3;break}N[I+0]=o;break}L=n[o+0]<N[s+1]?n[o+1]<N[s+2]?N[s+5]:N[s+5]+9:n[o+1]<N[s+2]?N[s+5]+18:N[s+5]+27,N[s+7]=(N[s+7]*N[s+6]+n[o+0]*n[o+6])/(N[s+6]+n[o+6]),N[s+8]=(N[s+8]*N[s+6]+n[o+1]*n[o+6])/(N[s+6]+n[o+6]),N[s+6]+=n[o+6],s=L}}if(e.barnesHutOptimize){for(f=e.scalingRatio,o=0;o<P;o+=t)for(s=0;;)if(N[s+5]>=0){if(b=Math.pow(n[o+0]-N[s+7],2)+Math.pow(n[o+1]-N[s+8],2),4*(p=N[s+3])*p/b<$){if(g=n[o+0]-N[s+7],y=n[o+1]-N[s+8],!0===M?b>0?(v=f*n[o+6]*N[s+6]/b,n[o+2]+=g*v,n[o+3]+=y*v):b<0&&(v=-f*n[o+6]*N[s+6]/Math.sqrt(b),n[o+2]+=g*v,n[o+3]+=y*v):b>0&&(v=f*n[o+6]*N[s+6]/b,n[o+2]+=g*v,n[o+3]+=y*v),(s=N[s+4])<0)break;continue}s=N[s+5]}else if((l=N[s+0])>=0&&l!==o&&(b=(g=n[o+0]-n[l+0])*g+(y=n[o+1]-n[l+1])*y,!0===M?b>0?(v=f*n[o+6]*n[l+6]/b,n[o+2]+=g*v,n[o+3]+=y*v):b<0&&(v=-f*n[o+6]*n[l+6]/Math.sqrt(b),n[o+2]+=g*v,n[o+3]+=y*v):b>0&&(v=f*n[o+6]*n[l+6]/b,n[o+2]+=g*v,n[o+3]+=y*v)),(s=N[s+4])<0)break}else for(f=e.scalingRatio,a=0;a<P;a+=t)for(c=0;c<a;c+=t)g=n[a+0]-n[c+0],y=n[a+1]-n[c+1],!0===M?(b=Math.sqrt(g*g+y*y)-n[a+8]-n[c+8])>0?(v=f*n[a+6]*n[c+6]/b/b,n[a+2]+=g*v,n[a+3]+=y*v,n[c+2]-=g*v,n[c+3]-=y*v):b<0&&(v=100*f*n[a+6]*n[c+6],n[a+2]+=g*v,n[a+3]+=y*v,n[c+2]-=g*v,n[c+3]-=y*v):(b=Math.sqrt(g*g+y*y))>0&&(v=f*n[a+6]*n[c+6]/b/b,n[a+2]+=g*v,n[a+3]+=y*v,n[c+2]-=g*v,n[c+3]-=y*v);for(h=e.gravity/e.scalingRatio,f=e.scalingRatio,o=0;o<P;o+=t)v=0,g=n[o+0],y=n[o+1],b=Math.sqrt(Math.pow(g,2)+Math.pow(y,2)),e.strongGravityMode?b>0&&(v=f*n[o+6]*h):b>0&&(v=f*n[o+6]*h/b),n[o+2]-=g*v,n[o+3]-=y*v;for(f=1*(e.outboundAttractionDistribution?m:1),u=0;u<x;u+=3)a=r[u+0],c=r[u+1],d=r[u+2],w=Math.pow(d,e.edgeWeightInfluence),g=n[a+0]-n[c+0],y=n[a+1]-n[c+1],!0===M?(b=Math.sqrt(g*g+y*y)-n[a+8]-n[c+8],e.linLogMode?e.outboundAttractionDistribution?b>0&&(v=-f*w*Math.log(1+b)/b/n[a+6]):b>0&&(v=-f*w*Math.log(1+b)/b):e.outboundAttractionDistribution?b>0&&(v=-f*w/n[a+6]):b>0&&(v=-f*w)):(b=Math.sqrt(Math.pow(g,2)+Math.pow(y,2)),e.linLogMode?e.outboundAttractionDistribution?b>0&&(v=-f*w*Math.log(1+b)/b/n[a+6]):b>0&&(v=-f*w*Math.log(1+b)/b):e.outboundAttractionDistribution?(b=1,v=-f*w/n[a+6]):(b=1,v=-f*w)),b>0&&(n[a+2]+=g*v,n[a+3]+=y*v,n[c+2]-=g*v,n[c+3]-=y*v);if(!0===M)for(o=0;o<P;o+=t)1!==n[o+9]&&((A=Math.sqrt(Math.pow(n[o+2],2)+Math.pow(n[o+3],2)))>10&&(n[o+2]=10*n[o+2]/A,n[o+3]=10*n[o+3]/A),E=n[o+6]*Math.sqrt((n[o+4]-n[o+2])*(n[o+4]-n[o+2])+(n[o+5]-n[o+3])*(n[o+5]-n[o+3])),C=Math.sqrt((n[o+4]+n[o+2])*(n[o+4]+n[o+2])+(n[o+5]+n[o+3])*(n[o+5]+n[o+3]))/2,T=.1*Math.log(1+C)/(1+Math.sqrt(E)),S=n[o+0]+n[o+2]*(T/e.slowDown),n[o+0]=S,_=n[o+1]+n[o+3]*(T/e.slowDown),n[o+1]=_);else for(o=0;o<P;o+=t)1!==n[o+9]&&(E=n[o+6]*Math.sqrt((n[o+4]-n[o+2])*(n[o+4]-n[o+2])+(n[o+5]-n[o+3])*(n[o+5]-n[o+3])),C=Math.sqrt((n[o+4]+n[o+2])*(n[o+4]+n[o+2])+(n[o+5]+n[o+3])*(n[o+5]+n[o+3]))/2,T=n[o+7]*Math.log(1+C)/(1+Math.sqrt(E)),n[o+7]=Math.min(1,Math.sqrt(T*(Math.pow(n[o+2],2)+Math.pow(n[o+3],2))/(1+Math.sqrt(E)))),S=n[o+0]+n[o+2]*(T/e.slowDown),n[o+0]=S,_=n[o+1]+n[o+3]*(T/e.slowDown),n[o+1]=_);return{}}},8153:(e,t)=>{function n(e){return"number"!=typeof e||isNaN(e)?1:e}t.Fd=function(e){return function(e,t){var n={},r=function(e){return void 0===e?t:e};"function"==typeof t&&(r=t);var i=function(t){return r(t[e])},s=function(){return r(void 0)};return"string"==typeof e?(n.fromAttributes=i,n.fromGraph=function(e,t){return i(e.getEdgeAttributes(t))},n.fromEntry=function(e,t){return i(t)},n.fromPartialEntry=n.fromEntry,n.fromMinimalEntry=n.fromEntry):"function"==typeof e?(n.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},n.fromGraph=function(t,n){var i=t.extremities(n);return r(e(n,t.getEdgeAttributes(n),i[0],i[1],t.getNodeAttributes(i[0]),t.getNodeAttributes(i[1]),t.isUndirected(n)))},n.fromEntry=function(t,n,i,s,o,a,c){return r(e(t,n,i,s,o,a,c))},n.fromPartialEntry=function(t,n,i,s){return r(e(t,n,i,s))},n.fromMinimalEntry=function(t,n){return r(e(t,n))}):(n.fromAttributes=s,n.fromGraph=s,n.fromEntry=s,n.fromMinimalEntry=s),n}(e,n)}},1736:e=>{e.exports=function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.addUndirectedEdgeWithKey&&"function"==typeof e.dropNode&&"boolean"==typeof e.multi}},934:function(e){e.exports=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}function i(e,t,n){return i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var s=new(Function.bind.apply(e,i));return n&&r(s,n.prototype),s},i.apply(null,arguments)}function s(e){var t="function"==typeof Map?new Map:void 0;return s=function(e){if(null===e||(s=e,-1===Function.toString.call(s).indexOf("[native code]")))return e;var s;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return i(e,arguments,n(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),r(o,e)},s(e)}function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var a=function(){for(var e=arguments[0],t=1,n=arguments.length;t<n;t++)if(arguments[t])for(var r in arguments[t])e[r]=arguments[t][r];return e};function c(e,t,n,r){var i=e._nodes.get(t),s=null;return i?s="mixed"===r?i.out&&i.out[n]||i.undirected&&i.undirected[n]:"directed"===r?i.out&&i.out[n]:i.undirected&&i.undirected[n]:s}function l(t){return"object"===e(t)&&null!==t}function u(e){var t;for(t in e)return!1;return!0}function d(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function h(e,t,n){var r={enumerable:!0,configurable:!0};"function"==typeof n?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(e,t,r)}function p(e){return!(!l(e)||e.attributes&&!Array.isArray(e.attributes))}"function"==typeof Object.assign&&(a=Object.assign);var m,f={exports:{}},g="object"==typeof Reflect?Reflect:null,y=g&&"function"==typeof g.apply?g.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};m=g&&"function"==typeof g.ownKeys?g.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var w=Number.isNaN||function(e){return e!=e};function b(){b.init.call(this)}f.exports=b,f.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,s),r(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}M(e,t,s,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&M(e,"error",t,{once:!0})}(e,i)}))},b.EventEmitter=b,b.prototype._events=void 0,b.prototype._eventsCount=0,b.prototype._maxListeners=void 0;var v=10;function A(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function E(e){return void 0===e._maxListeners?b.defaultMaxListeners:e._maxListeners}function C(e,t,n,r){var i,s,o,a;if(A(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=E(e))>0&&o.length>i&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,a=c,console&&console.warn&&console.warn(a)}return e}function T(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function S(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=T.bind(r);return i.listener=n,r.wrapFn=i,i}function _(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):x(i,i.length)}function P(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function x(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function M(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(s){r.once&&e.removeEventListener(t,i),n(s)}))}}function $(e){if("function"!=typeof e)throw new Error("obliterator/iterator: expecting a function!");this.next=e}Object.defineProperty(b,"defaultMaxListeners",{enumerable:!0,get:function(){return v},set:function(e){if("number"!=typeof e||e<0||w(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");v=e}}),b.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},b.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||w(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},b.prototype.getMaxListeners=function(){return E(this)},b.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)y(a,this,t);else{var c=a.length,l=x(a,c);for(n=0;n<c;++n)y(l[n],this,t)}return!0},b.prototype.addListener=function(e,t){return C(this,e,t,!1)},b.prototype.on=b.prototype.addListener,b.prototype.prependListener=function(e,t){return C(this,e,t,!0)},b.prototype.once=function(e,t){return A(t),this.on(e,S(this,e,t)),this},b.prototype.prependOnceListener=function(e,t){return A(t),this.prependListener(e,S(this,e,t)),this},b.prototype.removeListener=function(e,t){var n,r,i,s,o;if(A(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||t)}return this},b.prototype.off=b.prototype.removeListener,b.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,s=Object.keys(n);for(r=0;r<s.length;++r)"removeListener"!==(i=s[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},b.prototype.listeners=function(e){return _(this,e,!0)},b.prototype.rawListeners=function(e){return _(this,e,!1)},b.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):P.call(e,t)},b.prototype.listenerCount=P,b.prototype.eventNames=function(){return this._eventsCount>0?m(this._events):[]},"undefined"!=typeof Symbol&&($.prototype[Symbol.iterator]=function(){return this}),$.of=function(){var e=arguments,t=e.length,n=0;return new $((function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}}))},$.empty=function(){return new $((function(){return{done:!0}}))},$.fromSequence=function(e){var t=0,n=e.length;return new $((function(){return t>=n?{done:!0}:{done:!1,value:e[t++]}}))},$.is=function(e){return e instanceof $||"object"==typeof e&&null!==e&&"function"==typeof e.next};var N=$,L={};L.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,L.SYMBOL_SUPPORT="undefined"!=typeof Symbol;var I=N,R=L,O=R.ARRAY_BUFFER_SUPPORT,k=R.SYMBOL_SUPPORT,G=function(e){var t=function(e){return"string"==typeof e||Array.isArray(e)||O&&ArrayBuffer.isView(e)?I.fromSequence(e):"object"!=typeof e||null===e?null:k&&"function"==typeof e[Symbol.iterator]?e[Symbol.iterator]():"function"==typeof e.next?e:null}(e);if(!t)throw new Error("obliterator: target is not iterable nor a valid iterator.");return t},H=G,D=function(e,t){for(var n,r=arguments.length>1?t:1/0,i=r!==1/0?new Array(r):[],s=0,o=H(e);;){if(s===r)return i;if((n=o.next()).done)return s!==t&&(i.length=s),i;i[s++]=n.value}},F=function(e){function n(t){var n;return(n=e.call(this)||this).name="GraphError",n.message=t,n}return t(n,e),n}(s(Error)),U=function(e){function n(t){var r;return(r=e.call(this,t)||this).name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(r),n.prototype.constructor),r}return t(n,e),n}(F),V=function(e){function n(t){var r;return(r=e.call(this,t)||this).name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(r),n.prototype.constructor),r}return t(n,e),n}(F),Y=function(e){function n(t){var r;return(r=e.call(this,t)||this).name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(r),n.prototype.constructor),r}return t(n,e),n}(F);function B(e,t){this.key=e,this.attributes=t,this.clear()}function W(e,t){this.key=e,this.attributes=t,this.clear()}function j(e,t){this.key=e,this.attributes=t,this.clear()}function K(e,t,n,r,i){this.key=t,this.attributes=i,this.undirected=e,this.source=n,this.target=r}function q(e,t,n,r,i,s,o){var a,c,l,u;if(r=""+r,0===n){if(!(a=e._nodes.get(r)))throw new V("Graph.".concat(t,': could not find the "').concat(r,'" node in the graph.'));l=i,u=s}else if(3===n){if(i=""+i,!(c=e._edges.get(i)))throw new V("Graph.".concat(t,': could not find the "').concat(i,'" edge in the graph.'));var d=c.source.key,h=c.target.key;if(r===d)a=c.target;else{if(r!==h)throw new V("Graph.".concat(t,': the "').concat(r,'" node is not attached to the "').concat(i,'" edge (').concat(d,", ").concat(h,")."));a=c.source}l=s,u=o}else{if(!(c=e._edges.get(r)))throw new V("Graph.".concat(t,': could not find the "').concat(r,'" edge in the graph.'));a=1===n?c.source:c.target,l=i,u=s}return[a,l,u]}B.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},W.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},j.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},K.prototype.attach=function(){var e="out",t="in";this.undirected&&(e=t="undirected");var n=this.source.key,r=this.target.key;this.source[e][r]=this,this.undirected&&n===r||(this.target[t][n]=this)},K.prototype.attachMulti=function(){var e="out",t="in",n=this.source.key,r=this.target.key;this.undirected&&(e=t="undirected");var i=this.source[e],s=i[r];if(void 0===s)return i[r]=this,void(this.undirected&&n===r||(this.target[t][n]=this));s.previous=this,this.next=s,i[r]=this,this.target[t][n]=this},K.prototype.detach=function(){var e=this.source.key,t=this.target.key,n="out",r="in";this.undirected&&(n=r="undirected"),delete this.source[n][t],delete this.target[r][e]},K.prototype.detachMulti=function(){var e=this.source.key,t=this.target.key,n="out",r="in";this.undirected&&(n=r="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][t],delete this.target[r][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[r][e]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};var Z=[{name:function(e){return"get".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=q(this,t,n,e,r,i),o=s[0],a=s[1];return o.attributes[a]}}},{name:function(e){return"get".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r){return q(this,t,n,e,r)[0].attributes}}},{name:function(e){return"has".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=q(this,t,n,e,r,i),o=s[0],a=s[1];return o.attributes.hasOwnProperty(a)}}},{name:function(e){return"set".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i,s){var o=q(this,t,n,e,r,i,s),a=o[0],c=o[1],l=o[2];return a.attributes[c]=l,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:c}),this}}},{name:function(e){return"update".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i,s){var o=q(this,t,n,e,r,i,s),a=o[0],c=o[1],l=o[2];if("function"!=typeof l)throw new U("Graph.".concat(t,": updater should be a function."));var u=a.attributes,d=l(u[c]);return u[c]=d,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:c}),this}}},{name:function(e){return"remove".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=q(this,t,n,e,r,i),o=s[0],a=s[1];return delete o.attributes[a],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:a}),this}}},{name:function(e){return"replace".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=q(this,t,n,e,r,i),o=s[0],a=s[1];if(!l(a))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return o.attributes=a,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}},{name:function(e){return"merge".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=q(this,t,n,e,r,i),o=s[0],c=s[1];if(!l(c))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return a(o.attributes,c),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:c}),this}}},{name:function(e){return"update".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s=q(this,t,n,e,r,i),o=s[0],a=s[1];if("function"!=typeof a)throw new U("Graph.".concat(t,": provided updater is not a function."));return o.attributes=a(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}}],z=[{name:function(e){return"get".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return i.attributes[r]}}},{name:function(e){return"get".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var i=""+e,s=""+arguments[1];if(!(r=c(this,i,s,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(i,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(r=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return r.attributes}}},{name:function(e){return"has".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return i.attributes.hasOwnProperty(r)}}},{name:function(e){return"set".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+r;if(r=arguments[2],i=arguments[3],!(s=c(this,o,a,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(s=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return s.attributes[r]=i,this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:r}),this}}},{name:function(e){return"update".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r,i){var s;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+e,a=""+r;if(r=arguments[2],i=arguments[3],!(s=c(this,o,a,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(o,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(s=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if("function"!=typeof i)throw new U("Graph.".concat(t,": updater should be a function."));return s.attributes[r]=i(s.attributes[r]),this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:r}),this}}},{name:function(e){return"remove".concat(e,"Attribute")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}return delete i.attributes[r],this.emit("edgeAttributesUpdated",{key:i.key,type:"remove",attributes:i.attributes,name:r}),this}}},{name:function(e){return"replace".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if(!l(r))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return i.attributes=r,this.emit("edgeAttributesUpdated",{key:i.key,type:"replace",attributes:i.attributes}),this}}},{name:function(e){return"merge".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if(!l(r))throw new U("Graph.".concat(t,": provided attributes are not a plain object."));return a(i.attributes,r),this.emit("edgeAttributesUpdated",{key:i.key,type:"merge",attributes:i.attributes,data:r}),this}}},{name:function(e){return"update".concat(e,"Attributes")},attacher:function(e,t,n){e.prototype[t]=function(e,r){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new Y("Graph.".concat(t,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new Y("Graph.".concat(t,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+e,o=""+r;if(r=arguments[2],!(i=c(this,s,o,n)))throw new V("Graph.".concat(t,': could not find an edge for the given path ("').concat(s,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new Y("Graph.".concat(t,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(e=""+e,!(i=this._edges.get(e)))throw new V("Graph.".concat(t,': could not find the "').concat(e,'" edge in the graph.'))}if("function"!=typeof r)throw new U("Graph.".concat(t,": provided updater is not a function."));return i.attributes=r(i.attributes),this.emit("edgeAttributesUpdated",{key:i.key,type:"update",attributes:i.attributes}),this}}}],X=N,J=G,Q=function(){var e=arguments,t=null,n=-1;return new X((function(){for(var r=null;;){if(null===t){if(++n>=e.length)return{done:!0};t=J(e[n])}if(!0!==(r=t.next()).done)break;t=null}return r}))},ee=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function te(e,t,n,r){var i=!1;for(var s in t)if(s!==r){var o=t[s];if(i=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&i)return o.key}}function ne(e,t,n,r){var i,s,o,a=!1;for(var c in t)if(c!==r){i=t[c];do{if(s=i.source,o=i.target,a=n(i.key,i.attributes,s.key,o.key,s.attributes,o.attributes,i.undirected),e&&a)return i.key;i=i.next}while(void 0!==i)}}function re(e,t){var n,r=Object.keys(e),i=r.length,s=0;return new N((function(){do{if(n)n=n.next;else{if(s>=i)return{done:!0};var o=r[s++];if(o===t){n=void 0;continue}n=e[o]}}while(!n);return{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}}}))}function ie(e,t,n,r){var i=t[n];if(i){var s=i.source,o=i.target;return r(i.key,i.attributes,s.key,o.key,s.attributes,o.attributes,i.undirected)&&e?i.key:void 0}}function se(e,t,n,r){var i=t[n];if(i){var s=!1;do{if(s=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),e&&s)return i.key;i=i.next}while(void 0!==i)}}function oe(e,t){var n=e[t];return void 0!==n.next?new N((function(){if(!n)return{done:!0};var e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}})):N.of({edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected})}function ae(e,t,n,r){if(0!==t.size)for(var i,s,o="mixed"!==n&&n!==t.type,a="undirected"===n,c=!1,l=t._edges.values();!0!==(i=l.next()).done;)if(s=i.value,!o||s.undirected===a){var u=s,d=u.key,h=u.attributes,p=u.source,m=u.target;if(c=r(d,h,p.key,m.key,p.attributes,m.attributes,s.undirected),e&&c)return d}}function ce(e,t,n,r,i,s){var o,a=t?ne:te;if("undirected"!==n){if("out"!==r&&(o=a(e,i.in,s),e&&o))return o;if("in"!==r&&(o=a(e,i.out,s,r?void 0:i.key),e&&o))return o}if("directed"!==n&&(o=a(e,i.undirected,s),e&&o))return o}function le(e,t,n,r,i,s,o){var a,c=n?se:ie;if("undirected"!==t){if(void 0!==i.in&&"out"!==r&&(a=c(e,i.in,s,o),e&&a))return a;if(void 0!==i.out&&"in"!==r&&(r||i.key!==s)&&(a=c(e,i.out,s,o),e&&a))return a}if("directed"!==t&&void 0!==i.undirected&&(a=c(e,i.undirected,s,o),e&&a))return a}var ue=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function de(){this.A=null,this.B=null}function he(e,t,n,r,i){for(var s in r){var o=r[s],a=o.source,c=o.target,l=a===n?c:a;if(!t||!t.has(l.key)){var u=i(l.key,l.attributes);if(e&&u)return l.key}}}function pe(e,t,n,r,i){if("mixed"!==t){if("undirected"===t)return he(e,null,r,r.undirected,i);if("string"==typeof n)return he(e,null,r,r[n],i)}var s,o=new de;if("undirected"!==t){if("out"!==n){if(s=he(e,null,r,r.in,i),e&&s)return s;o.wrap(r.in)}if("in"!==n){if(s=he(e,o,r,r.out,i),e&&s)return s;o.wrap(r.out)}}if("directed"!==t&&(s=he(e,o,r,r.undirected,i),e&&s))return s}function me(e,t,n){var r=Object.keys(n),i=r.length,s=0;return new N((function(){var o=null;do{if(s>=i)return e&&e.wrap(n),{done:!0};var a=n[r[s++]],c=a.source,l=a.target;o=c===t?l:c,e&&e.has(o.key)&&(o=null)}while(null===o);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}))}function fe(e,t,n,r,i){for(var s,o,a,c,l,u,d,h=r._nodes.values(),p=r.type;!0!==(s=h.next()).done;){var m=!1;if(o=s.value,"undirected"!==p)for(a in c=o.out){l=c[a];do{if(u=l.target,m=!0,d=i(o.key,u.key,o.attributes,u.attributes,l.key,l.attributes,l.undirected),e&&d)return l;l=l.next}while(l)}if("directed"!==p)for(a in c=o.undirected)if(!(t&&o.key>a)){l=c[a];do{if((u=l.target).key!==a&&(u=l.source),m=!0,d=i(o.key,u.key,o.attributes,u.attributes,l.key,l.attributes,l.undirected),e&&d)return l;l=l.next}while(l)}if(n&&!m&&(d=i(o.key,null,o.attributes,null,null,null,null),e&&d))return null}}function ge(e){if(!l(e))throw new U('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in e))throw new U("Graph.import: serialized node is missing its key.");if("attributes"in e&&(!l(e.attributes)||null===e.attributes))throw new U("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function ye(e){if(!l(e))throw new U('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in e))throw new U("Graph.import: serialized edge is missing its source.");if(!("target"in e))throw new U("Graph.import: serialized edge is missing its target.");if("attributes"in e&&(!l(e.attributes)||null===e.attributes))throw new U("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in e&&"boolean"!=typeof e.undirected)throw new U("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}de.prototype.wrap=function(e){null===this.A?this.A=e:null===this.B&&(this.B=e)},de.prototype.has=function(e){return null!==this.A&&e in this.A||null!==this.B&&e in this.B};var we,be=(we=255&Math.floor(256*Math.random()),function(){return we++}),ve=new Set(["directed","undirected","mixed"]),Ae=new Set(["domain","_events","_eventsCount","_maxListeners"]),Ee={allowSelfLoops:!0,multi:!1,type:"mixed"};function Ce(e,t,n){var r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:n}),r}function Te(e,t,n,r,i,s,o,a){if(!r&&"undirected"===e.type)throw new Y("Graph.".concat(t,": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead."));if(r&&"directed"===e.type)throw new Y("Graph.".concat(t,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(a&&!l(a))throw new U("Graph.".concat(t,': invalid attributes. Expecting an object but got "').concat(a,'"'));if(s=""+s,o=""+o,a=a||{},!e.allowSelfLoops&&s===o)throw new Y("Graph.".concat(t,': source & target are the same ("').concat(s,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var c=e._nodes.get(s),u=e._nodes.get(o);if(!c)throw new V("Graph.".concat(t,': source node "').concat(s,'" not found.'));if(!u)throw new V("Graph.".concat(t,': target node "').concat(o,'" not found.'));var d={key:null,undirected:r,source:s,target:o,attributes:a};if(n)i=e._edgeKeyGenerator();else if(i=""+i,e._edges.has(i))throw new Y("Graph.".concat(t,': the "').concat(i,'" edge already exists in the graph.'));if(!e.multi&&(r?void 0!==c.undirected[o]:void 0!==c.out[o]))throw new Y("Graph.".concat(t,': an edge linking "').concat(s,'" to "').concat(o,"\" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option."));var h=new K(r,i,c,u,a);e._edges.set(i,h);var p=s===o;return r?(c.undirectedDegree++,u.undirectedDegree++,p&&(c.undirectedLoops++,e._undirectedSelfLoopCount++)):(c.outDegree++,u.inDegree++,p&&(c.directedLoops++,e._directedSelfLoopCount++)),e.multi?h.attachMulti():h.attach(),r?e._undirectedSize++:e._directedSize++,d.key=i,e.emit("edgeAdded",d),i}function Se(e,t,n,r,i,s,o,c,u){if(!r&&"undirected"===e.type)throw new Y("Graph.".concat(t,": you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead."));if(r&&"directed"===e.type)throw new Y("Graph.".concat(t,": you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead."));if(c)if(u){if("function"!=typeof c)throw new U("Graph.".concat(t,': invalid updater function. Expecting a function but got "').concat(c,'"'))}else if(!l(c))throw new U("Graph.".concat(t,': invalid attributes. Expecting an object but got "').concat(c,'"'));var d;if(s=""+s,o=""+o,u&&(d=c,c=void 0),!e.allowSelfLoops&&s===o)throw new Y("Graph.".concat(t,': source & target are the same ("').concat(s,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var h,p,m=e._nodes.get(s),f=e._nodes.get(o);if(!n&&(h=e._edges.get(i))){if(!(h.source.key===s&&h.target.key===o||r&&h.source.key===o&&h.target.key===s))throw new Y("Graph.".concat(t,': inconsistency detected when attempting to merge the "').concat(i,'" edge with "').concat(s,'" source & "').concat(o,'" target vs. ("').concat(h.source.key,'", "').concat(h.target.key,'").'));p=h}if(p||e.multi||!m||(p=r?m.undirected[o]:m.out[o]),p){var g=[p.key,!1,!1,!1];if(u?!d:!c)return g;if(u){var y=p.attributes;p.attributes=d(y),e.emit("edgeAttributesUpdated",{type:"replace",key:p.key,attributes:p.attributes})}else a(p.attributes,c),e.emit("edgeAttributesUpdated",{type:"merge",key:p.key,attributes:p.attributes,data:c});return g}c=c||{},u&&d&&(c=d(c));var w={key:null,undirected:r,source:s,target:o,attributes:c};if(n)i=e._edgeKeyGenerator();else if(i=""+i,e._edges.has(i))throw new Y("Graph.".concat(t,': the "').concat(i,'" edge already exists in the graph.'));var b=!1,v=!1;m||(m=Ce(e,s,{}),b=!0,s===o&&(f=m,v=!0)),f||(f=Ce(e,o,{}),v=!0),h=new K(r,i,m,f,c),e._edges.set(i,h);var A=s===o;return r?(m.undirectedDegree++,f.undirectedDegree++,A&&(m.undirectedLoops++,e._undirectedSelfLoopCount++)):(m.outDegree++,f.inDegree++,A&&(m.directedLoops++,e._directedSelfLoopCount++)),e.multi?h.attachMulti():h.attach(),r?e._undirectedSize++:e._directedSize++,w.key=i,e.emit("edgeAdded",w),[i,!0,b,v]}function _e(e,t){e._edges.delete(t.key);var n=t.source,r=t.target,i=t.attributes,s=t.undirected,o=n===r;s?(n.undirectedDegree--,r.undirectedDegree--,o&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,o&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),s?e._undirectedSize--:e._directedSize--,e.emit("edgeDropped",{key:t.key,attributes:i,source:n.key,target:r.key,undirected:s})}var Pe=function(n){function r(e){var t;if(t=n.call(this)||this,"boolean"!=typeof(e=a({},Ee,e)).multi)throw new U("Graph.constructor: invalid 'multi' option. Expecting a boolean but got \"".concat(e.multi,'".'));if(!ve.has(e.type))throw new U('Graph.constructor: invalid \'type\' option. Should be one of "mixed", "directed" or "undirected" but got "'.concat(e.type,'".'));if("boolean"!=typeof e.allowSelfLoops)throw new U("Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \"".concat(e.allowSelfLoops,'".'));var r="mixed"===e.type?B:"directed"===e.type?W:j;d(o(t),"NodeDataClass",r);var i="geid_"+be()+"_",s=0;return d(o(t),"_attributes",{}),d(o(t),"_nodes",new Map),d(o(t),"_edges",new Map),d(o(t),"_directedSize",0),d(o(t),"_undirectedSize",0),d(o(t),"_directedSelfLoopCount",0),d(o(t),"_undirectedSelfLoopCount",0),d(o(t),"_edgeKeyGenerator",(function(){var e;do{e=i+s++}while(t._edges.has(e));return e})),d(o(t),"_options",e),Ae.forEach((function(e){return d(o(t),e,t[e])})),h(o(t),"order",(function(){return t._nodes.size})),h(o(t),"size",(function(){return t._edges.size})),h(o(t),"directedSize",(function(){return t._directedSize})),h(o(t),"undirectedSize",(function(){return t._undirectedSize})),h(o(t),"selfLoopCount",(function(){return t._directedSelfLoopCount+t._undirectedSelfLoopCount})),h(o(t),"directedSelfLoopCount",(function(){return t._directedSelfLoopCount})),h(o(t),"undirectedSelfLoopCount",(function(){return t._undirectedSelfLoopCount})),h(o(t),"multi",t._options.multi),h(o(t),"type",t._options.type),h(o(t),"allowSelfLoops",t._options.allowSelfLoops),h(o(t),"implementation",(function(){return"graphology"})),t}t(r,n);var i=r.prototype;return i._resetInstanceCounters=function(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0},i.hasNode=function(e){return this._nodes.has(""+e)},i.hasDirectedEdge=function(e,t){if("undirected"===this.type)return!1;if(1===arguments.length){var n=""+e,r=this._edges.get(n);return!!r&&!r.undirected}if(2===arguments.length){e=""+e,t=""+t;var i=this._nodes.get(e);return!!i&&i.out.hasOwnProperty(t)}throw new U("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.hasUndirectedEdge=function(e,t){if("directed"===this.type)return!1;if(1===arguments.length){var n=""+e,r=this._edges.get(n);return!!r&&r.undirected}if(2===arguments.length){e=""+e,t=""+t;var i=this._nodes.get(e);return!!i&&i.undirected.hasOwnProperty(t)}throw new U("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.hasEdge=function(e,t){if(1===arguments.length){var n=""+e;return this._edges.has(n)}if(2===arguments.length){e=""+e,t=""+t;var r=this._nodes.get(e);return!!r&&(void 0!==r.out&&r.out.hasOwnProperty(t)||void 0!==r.undirected&&r.undirected.hasOwnProperty(t))}throw new U("Graph.hasEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},i.directedEdge=function(e,t){if("undirected"!==this.type){if(e=""+e,t=""+t,this.multi)throw new Y("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");var n=this._nodes.get(e);if(!n)throw new V('Graph.directedEdge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V('Graph.directedEdge: could not find the "'.concat(t,'" target node in the graph.'));var r=n.out&&n.out[t]||void 0;return r?r.key:void 0}},i.undirectedEdge=function(e,t){if("directed"!==this.type){if(e=""+e,t=""+t,this.multi)throw new Y("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");var n=this._nodes.get(e);if(!n)throw new V('Graph.undirectedEdge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V('Graph.undirectedEdge: could not find the "'.concat(t,'" target node in the graph.'));var r=n.undirected&&n.undirected[t]||void 0;return r?r.key:void 0}},i.edge=function(e,t){if(this.multi)throw new Y("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.edge: could not find the "'.concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V('Graph.edge: could not find the "'.concat(t,'" target node in the graph.'));var r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key},i.areDirectedNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areDirectedNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&(t in n.in||t in n.out)},i.areOutNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areOutNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.out},i.areInNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areInNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.in},i.areUndirectedNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areUndirectedNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"directed"!==this.type&&t in n.undirected},i.areNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&(t in n.in||t in n.out)||"directed"!==this.type&&t in n.undirected},i.areInboundNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areInboundNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.in||"directed"!==this.type&&t in n.undirected},i.areOutboundNeighbors=function(e,t){e=""+e,t=""+t;var n=this._nodes.get(e);if(!n)throw new V('Graph.areOutboundNeighbors: could not find the "'.concat(e,'" node in the graph.'));return"undirected"!==this.type&&t in n.out||"directed"!==this.type&&t in n.undirected},i.inDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.inDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree},i.outDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.outDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.outDegree},i.directedDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.directedDegree: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree+t.outDegree},i.undirectedDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.undirectedDegree: could not find the "'.concat(e,'" node in the graph.'));return"directed"===this.type?0:t.undirectedDegree},i.inboundDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.inboundDegree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.inDegree),n},i.outboundDegree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.outboundDegree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.outDegree),n},i.degree=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.degree: could not find the "'.concat(e,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.inDegree+t.outDegree),n},i.inDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.inDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree-t.directedLoops},i.outDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.outDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.outDegree-t.directedLoops},i.directedDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.directedDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"undirected"===this.type?0:t.inDegree+t.outDegree-2*t.directedLoops},i.undirectedDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.undirectedDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));return"directed"===this.type?0:t.undirectedDegree-2*t.undirectedLoops},i.inboundDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.inboundDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=t.undirectedDegree,r+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree,r+=t.directedLoops),n-r},i.outboundDegreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.outboundDegreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=t.undirectedDegree,r+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.outDegree,r+=t.directedLoops),n-r},i.degreeWithoutSelfLoops=function(e){e=""+e;var t=this._nodes.get(e);if(!t)throw new V('Graph.degreeWithoutSelfLoops: could not find the "'.concat(e,'" node in the graph.'));var n=0,r=0;return"directed"!==this.type&&(n+=t.undirectedDegree,r+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree+t.outDegree,r+=2*t.directedLoops),n-r},i.source=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.source: could not find the "'.concat(e,'" edge in the graph.'));return t.source.key},i.target=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.target: could not find the "'.concat(e,'" edge in the graph.'));return t.target.key},i.extremities=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.extremities: could not find the "'.concat(e,'" edge in the graph.'));return[t.source.key,t.target.key]},i.opposite=function(e,t){e=""+e,t=""+t;var n=this._edges.get(t);if(!n)throw new V('Graph.opposite: could not find the "'.concat(t,'" edge in the graph.'));var r=n.source.key,i=n.target.key;if(e===r)return i;if(e===i)return r;throw new V('Graph.opposite: the "'.concat(e,'" node is not attached to the "').concat(t,'" edge (').concat(r,", ").concat(i,")."))},i.hasExtremity=function(e,t){e=""+e,t=""+t;var n=this._edges.get(e);if(!n)throw new V('Graph.hasExtremity: could not find the "'.concat(e,'" edge in the graph.'));return n.source.key===t||n.target.key===t},i.isUndirected=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.isUndirected: could not find the "'.concat(e,'" edge in the graph.'));return t.undirected},i.isDirected=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.isDirected: could not find the "'.concat(e,'" edge in the graph.'));return!t.undirected},i.isSelfLoop=function(e){e=""+e;var t=this._edges.get(e);if(!t)throw new V('Graph.isSelfLoop: could not find the "'.concat(e,'" edge in the graph.'));return t.source===t.target},i.addNode=function(e,t){var n=function(e,t,n){if(n&&!l(n))throw new U('Graph.addNode: invalid attributes. Expecting an object but got "'.concat(n,'"'));if(t=""+t,n=n||{},e._nodes.has(t))throw new Y('Graph.addNode: the "'.concat(t,'" node already exist in the graph.'));var r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit("nodeAdded",{key:t,attributes:n}),r}(this,e,t);return n.key},i.mergeNode=function(e,t){if(t&&!l(t))throw new U('Graph.mergeNode: invalid attributes. Expecting an object but got "'.concat(t,'"'));e=""+e,t=t||{};var n=this._nodes.get(e);return n?(t&&(a(n.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])},i.updateNode=function(e,t){if(t&&"function"!=typeof t)throw new U('Graph.updateNode: invalid updater function. Expecting a function but got "'.concat(t,'"'));e=""+e;var n=this._nodes.get(e);if(n){if(t){var r=n.attributes;n.attributes=t(r),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}var i=t?t({}):{};return n=new this.NodeDataClass(e,i),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:i}),[e,!0]},i.dropNode=function(e){e=""+e;var t,n=this._nodes.get(e);if(!n)throw new V('Graph.dropNode: could not find the "'.concat(e,'" node in the graph.'));if("undirected"!==this.type){for(var r in n.out){t=n.out[r];do{_e(this,t),t=t.next}while(t)}for(var i in n.in){t=n.in[i];do{_e(this,t),t=t.next}while(t)}}if("directed"!==this.type)for(var s in n.undirected){t=n.undirected[s];do{_e(this,t),t=t.next}while(t)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:n.attributes})},i.dropEdge=function(e){var t;if(arguments.length>1){var n=""+arguments[0],r=""+arguments[1];if(!(t=c(this,n,r,this.type)))throw new V('Graph.dropEdge: could not find the "'.concat(n,'" -> "').concat(r,'" edge in the graph.'))}else if(e=""+e,!(t=this._edges.get(e)))throw new V('Graph.dropEdge: could not find the "'.concat(e,'" edge in the graph.'));return _e(this,t),this},i.dropDirectedEdge=function(e,t){if(arguments.length<2)throw new Y("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new Y("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=c(this,e=""+e,t=""+t,"directed");if(!n)throw new V('Graph.dropDirectedEdge: could not find a "'.concat(e,'" -> "').concat(t,'" edge in the graph.'));return _e(this,n),this},i.dropUndirectedEdge=function(e,t){if(arguments.length<2)throw new Y("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new Y("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=c(this,e,t,"undirected");if(!n)throw new V('Graph.dropUndirectedEdge: could not find a "'.concat(e,'" -> "').concat(t,'" edge in the graph.'));return _e(this,n),this},i.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},i.clearEdges=function(){for(var e,t=this._nodes.values();!0!==(e=t.next()).done;)e.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")},i.getAttribute=function(e){return this._attributes[e]},i.getAttributes=function(){return this._attributes},i.hasAttribute=function(e){return this._attributes.hasOwnProperty(e)},i.setAttribute=function(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this},i.updateAttribute=function(e,t){if("function"!=typeof t)throw new U("Graph.updateAttribute: updater should be a function.");var n=this._attributes[e];return this._attributes[e]=t(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this},i.removeAttribute=function(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this},i.replaceAttributes=function(e){if(!l(e))throw new U("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this},i.mergeAttributes=function(e){if(!l(e))throw new U("Graph.mergeAttributes: provided attributes are not a plain object.");return a(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this},i.updateAttributes=function(e){if("function"!=typeof e)throw new U("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this},i.updateEachNodeAttributes=function(e,t){if("function"!=typeof e)throw new U("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!p(t))throw new U("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,r,i=this._nodes.values();!0!==(n=i.next()).done;)(r=n.value).attributes=e(r.key,r.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})},i.updateEachEdgeAttributes=function(e,t){if("function"!=typeof e)throw new U("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!p(t))throw new U("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,r,i,s,o=this._edges.values();!0!==(n=o.next()).done;)i=(r=n.value).source,s=r.target,r.attributes=e(r.key,r.attributes,i.key,s.key,i.attributes,s.attributes,r.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})},i.forEachAdjacencyEntry=function(e){if("function"!=typeof e)throw new U("Graph.forEachAdjacencyEntry: expecting a callback.");fe(!1,!1,!1,this,e)},i.forEachAdjacencyEntryWithOrphans=function(e){if("function"!=typeof e)throw new U("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");fe(!1,!1,!0,this,e)},i.forEachAssymetricAdjacencyEntry=function(e){if("function"!=typeof e)throw new U("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");fe(!1,!0,!1,this,e)},i.forEachAssymetricAdjacencyEntryWithOrphans=function(e){if("function"!=typeof e)throw new U("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");fe(!1,!0,!0,this,e)},i.nodes=function(){return"function"==typeof Array.from?Array.from(this._nodes.keys()):D(this._nodes.keys(),this._nodes.size)},i.forEachNode=function(e){if("function"!=typeof e)throw new U("Graph.forEachNode: expecting a callback.");for(var t,n,r=this._nodes.values();!0!==(t=r.next()).done;)e((n=t.value).key,n.attributes)},i.findNode=function(e){if("function"!=typeof e)throw new U("Graph.findNode: expecting a callback.");for(var t,n,r=this._nodes.values();!0!==(t=r.next()).done;)if(e((n=t.value).key,n.attributes))return n.key},i.mapNodes=function(e){if("function"!=typeof e)throw new U("Graph.mapNode: expecting a callback.");for(var t,n,r=this._nodes.values(),i=new Array(this.order),s=0;!0!==(t=r.next()).done;)n=t.value,i[s++]=e(n.key,n.attributes);return i},i.someNode=function(e){if("function"!=typeof e)throw new U("Graph.someNode: expecting a callback.");for(var t,n,r=this._nodes.values();!0!==(t=r.next()).done;)if(e((n=t.value).key,n.attributes))return!0;return!1},i.everyNode=function(e){if("function"!=typeof e)throw new U("Graph.everyNode: expecting a callback.");for(var t,n,r=this._nodes.values();!0!==(t=r.next()).done;)if(!e((n=t.value).key,n.attributes))return!1;return!0},i.filterNodes=function(e){if("function"!=typeof e)throw new U("Graph.filterNodes: expecting a callback.");for(var t,n,r=this._nodes.values(),i=[];!0!==(t=r.next()).done;)e((n=t.value).key,n.attributes)&&i.push(n.key);return i},i.reduceNodes=function(e,t){if("function"!=typeof e)throw new U("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new U("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");for(var n,r,i=t,s=this._nodes.values();!0!==(n=s.next()).done;)i=e(i,(r=n.value).key,r.attributes);return i},i.nodeEntries=function(){var e=this._nodes.values();return new N((function(){var t=e.next();if(t.done)return t;var n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}))},i.export=function(){var e=this,t=new Array(this._nodes.size),n=0;this._nodes.forEach((function(e,r){t[n++]=function(e,t){var n={key:e};return u(t.attributes)||(n.attributes=a({},t.attributes)),n}(r,e)}));var r=new Array(this._edges.size);return n=0,this._edges.forEach((function(t,i){r[n++]=function(e,t,n){var r={key:t,source:n.source.key,target:n.target.key};return u(n.attributes)||(r.attributes=a({},n.attributes)),"mixed"===e&&n.undirected&&(r.undirected=!0),r}(e.type,i,t)})),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:t,edges:r}},i.import=function(e){var t,n,i,s,o,a=this,c=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e instanceof r)return e.forEachNode((function(e,t){c?a.mergeNode(e,t):a.addNode(e,t)})),e.forEachEdge((function(e,t,n,r,i,s,o){c?o?a.mergeUndirectedEdgeWithKey(e,n,r,t):a.mergeDirectedEdgeWithKey(e,n,r,t):o?a.addUndirectedEdgeWithKey(e,n,r,t):a.addDirectedEdgeWithKey(e,n,r,t)})),this;if(!l(e))throw new U("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!l(e.attributes))throw new U("Graph.import: invalid attributes. Expecting a plain object.");c?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}if(e.nodes){if(i=e.nodes,!Array.isArray(i))throw new U("Graph.import: invalid nodes. Expecting an array.");for(t=0,n=i.length;t<n;t++){ge(s=i[t]);var u=s,d=u.key,h=u.attributes;c?this.mergeNode(d,h):this.addNode(d,h)}}if(e.edges){var p=!1;if("undirected"===this.type&&(p=!0),i=e.edges,!Array.isArray(i))throw new U("Graph.import: invalid edges. Expecting an array.");for(t=0,n=i.length;t<n;t++){ye(o=i[t]);var m=o,f=m.source,g=m.target,y=m.attributes,w=m.undirected,b=void 0===w?p:w;"key"in o?(c?b?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:b?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey).call(this,o.key,f,g,y):(c?b?this.mergeUndirectedEdge:this.mergeDirectedEdge:b?this.addUndirectedEdge:this.addDirectedEdge).call(this,f,g,y)}}return this},i.nullCopy=function(e){var t=new r(a({},this._options,e));return t.replaceAttributes(a({},this.getAttributes())),t},i.emptyCopy=function(e){var t=this.nullCopy(e);return this._nodes.forEach((function(e,n){var r=a({},e.attributes);e=new t.NodeDataClass(n,r),t._nodes.set(n,e)})),t},i.copy=function(e){if("string"==typeof(e=e||{}).type&&e.type!==this.type&&"mixed"!==e.type)throw new Y('Graph.copy: cannot create an incompatible copy from "'.concat(this.type,'" type to "').concat(e.type,'" because this would mean losing information about the current graph.'));if("boolean"==typeof e.multi&&e.multi!==this.multi&&!0!==e.multi)throw new Y("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if("boolean"==typeof e.allowSelfLoops&&e.allowSelfLoops!==this.allowSelfLoops&&!0!==e.allowSelfLoops)throw new Y("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");for(var t,n,r=this.emptyCopy(e),i=this._edges.values();!0!==(t=i.next()).done;)Te(r,"copy",!1,(n=t.value).undirected,n.key,n.source.key,n.target.key,a({},n.attributes));return r},i.toJSON=function(){return this.export()},i.toString=function(){return"[object Graph]"},i.inspect=function(){var t=this,n={};this._nodes.forEach((function(e,t){n[t]=e.attributes}));var r={},i={};this._edges.forEach((function(e,n){var s,o=e.undirected?"--":"->",a="",c=e.source.key,l=e.target.key;e.undirected&&c>l&&(s=c,c=l,l=s);var u="(".concat(c,")").concat(o,"(").concat(l,")");n.startsWith("geid_")?t.multi&&(void 0===i[u]?i[u]=0:i[u]++,a+="".concat(i[u],". ")):a+="[".concat(n,"]: "),r[a+=u]=e.attributes}));var s={};for(var o in this)this.hasOwnProperty(o)&&!Ae.has(o)&&"function"!=typeof this[o]&&"symbol"!==e(o)&&(s[o]=this[o]);return s.attributes=this._attributes,s.nodes=n,s.edges=r,d(s,"constructor",this.constructor),s},r}(f.exports.EventEmitter);"undefined"!=typeof Symbol&&(Pe.prototype[Symbol.for("nodejs.util.inspect.custom")]=Pe.prototype.inspect),[{name:function(e){return"".concat(e,"Edge")},generateKey:!0},{name:function(e){return"".concat(e,"DirectedEdge")},generateKey:!0,type:"directed"},{name:function(e){return"".concat(e,"UndirectedEdge")},generateKey:!0,type:"undirected"},{name:function(e){return"".concat(e,"EdgeWithKey")}},{name:function(e){return"".concat(e,"DirectedEdgeWithKey")},type:"directed"},{name:function(e){return"".concat(e,"UndirectedEdgeWithKey")},type:"undirected"}].forEach((function(e){["add","merge","update"].forEach((function(t){var n=e.name(t),r="add"===t?Te:Se;e.generateKey?Pe.prototype[n]=function(i,s,o){return r(this,n,!0,"undirected"===(e.type||this.type),null,i,s,o,"update"===t)}:Pe.prototype[n]=function(i,s,o,a){return r(this,n,!1,"undirected"===(e.type||this.type),i,s,o,a,"update"===t)}}))})),function(e){Z.forEach((function(t){var n=t.name,r=t.attacher;r(e,n("Node"),0),r(e,n("Source"),1),r(e,n("Target"),2),r(e,n("Opposite"),3)}))}(Pe),function(e){z.forEach((function(t){var n=t.name,r=t.attacher;r(e,n("Edge"),"mixed"),r(e,n("DirectedEdge"),"directed"),r(e,n("UndirectedEdge"),"undirected")}))}(Pe),function(e){ee.forEach((function(t){!function(e,t){var n=t.name,r=t.type,i=t.direction;e.prototype[n]=function(e,t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];if(!arguments.length)return function(e,t){if(0===e.size)return[];if("mixed"===t||t===e.type)return"function"==typeof Array.from?Array.from(e._edges.keys()):D(e._edges.keys(),e._edges.size);for(var n,r,i="undirected"===t?e.undirectedSize:e.directedSize,s=new Array(i),o="undirected"===t,a=e._edges.values(),c=0;!0!==(n=a.next()).done;)(r=n.value).undirected===o&&(s[c++]=r.key);return s}(this,r);if(1===arguments.length){e=""+e;var s=this._nodes.get(e);if(void 0===s)throw new V("Graph.".concat(n,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n,r){var i=[];return ce(!1,e,t,n,r,(function(e){i.push(e)})),i}(this.multi,"mixed"===r?this.type:r,i,s)}if(2===arguments.length){e=""+e,t=""+t;var o=this._nodes.get(e);if(!o)throw new V("Graph.".concat(n,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V("Graph.".concat(n,': could not find the "').concat(t,'" target node in the graph.'));return function(e,t,n,r,i){var s=[];return le(!1,e,t,n,r,i,(function(e){s.push(e)})),s}(r,this.multi,i,o,t)}throw new U("Graph.".concat(n,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t,n){if("mixed"===r||"mixed"===this.type||r===this.type){if(1===arguments.length)return ae(!1,this,r,n=e);if(2===arguments.length){e=""+e,n=t;var o=this._nodes.get(e);if(void 0===o)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));return ce(!1,this.multi,"mixed"===r?this.type:r,i,o,n)}if(3===arguments.length){e=""+e,t=""+t;var a=this._nodes.get(e);if(!a)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V("Graph.".concat(s,': could not find the "').concat(t,'" target node in the graph.'));return le(!1,r,this.multi,i,a,t,n)}throw new U("Graph.".concat(s,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))}};var o="map"+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(){var e,t=Array.prototype.slice.call(arguments),n=t.pop();if(0===t.length){var i=0;"directed"!==r&&(i+=this.undirectedSize),"undirected"!==r&&(i+=this.directedSize),e=new Array(i);var o=0;t.push((function(t,r,i,s,a,c,l){e[o++]=n(t,r,i,s,a,c,l)}))}else e=[],t.push((function(t,r,i,s,o,a,c){e.push(n(t,r,i,s,o,a,c))}));return this[s].apply(this,t),e};var a="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((function(e,r,i,s,o,a,c){t(e,r,i,s,o,a,c)&&n.push(e)})),this[s].apply(this,e),n};var c="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(){var e,t,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new U("Graph.".concat(c,": invalid number of arguments (expecting 2, 3 or 4 and got ").concat(n.length,")."));if("function"==typeof n[n.length-1]&&"function"!=typeof n[n.length-2])throw new U("Graph.".concat(c,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));2===n.length?(e=n[0],t=n[1],n=[]):3===n.length?(e=n[1],t=n[2],n=[n[0]]):4===n.length&&(e=n[2],t=n[3],n=[n[0],n[1]]);var r=t;return n.push((function(t,n,i,s,o,a,c){r=e(r,t,n,i,s,o,a,c)})),this[s].apply(this,n),r}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s="find"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t,n){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return!1;if(1===arguments.length)return ae(!0,this,r,n=e);if(2===arguments.length){e=""+e,n=t;var o=this._nodes.get(e);if(void 0===o)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));return ce(!0,this.multi,"mixed"===r?this.type:r,i,o,n)}if(3===arguments.length){e=""+e,t=""+t;var a=this._nodes.get(e);if(!a)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V("Graph.".concat(s,': could not find the "').concat(t,'" target node in the graph.'));return le(!0,r,this.multi,i,a,t,n)}throw new U("Graph.".concat(s,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))};var o="some"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((function(e,n,r,i,s,o,a){return t(e,n,r,i,s,o,a)})),!!this[s].apply(this,e)};var a="every"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(){var e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((function(e,n,r,i,s,o,a){return!t(e,n,r,i,s,o,a)})),!this[s].apply(this,e)}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s=n.slice(0,-1)+"Entries";e.prototype[s]=function(e,t){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return N.empty();if(!arguments.length)return function(e,t){if(0===e.size)return N.empty();var n="mixed"!==t&&t!==e.type,r="undirected"===t,i=e._edges.values();return new N((function(){for(var e,t;;){if((e=i.next()).done)return e;if(t=e.value,!n||t.undirected===r)break}return{value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected},done:!1}}))}(this,r);if(1===arguments.length){e=""+e;var n=this._nodes.get(e);if(!n)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){var r=N.empty();return"undirected"!==e&&("out"!==t&&void 0!==n.in&&(r=Q(r,re(n.in))),"in"!==t&&void 0!==n.out&&(r=Q(r,re(n.out,t?void 0:n.key)))),"directed"!==e&&void 0!==n.undirected&&(r=Q(r,re(n.undirected))),r}(r,i,n)}if(2===arguments.length){e=""+e,t=""+t;var o=this._nodes.get(e);if(!o)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" source node in the graph.'));if(!this._nodes.has(t))throw new V("Graph.".concat(s,': could not find the "').concat(t,'" target node in the graph.'));return function(e,t,n,r){var i=N.empty();return"undirected"!==e&&(void 0!==n.in&&"out"!==t&&r in n.in&&(i=Q(i,oe(n.in,r))),void 0!==n.out&&"in"!==t&&r in n.out&&(t||n.key!==r)&&(i=Q(i,oe(n.out,r)))),"directed"!==e&&void 0!==n.undirected&&r in n.undirected&&(i=Q(i,oe(n.undirected,r))),i}(r,i,o,t)}throw new U("Graph.".concat(s,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(e,t)}))}(Pe),function(e){ue.forEach((function(t){(function(e,t){var n=t.name,r=t.type,i=t.direction;e.prototype[n]=function(e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return[];e=""+e;var t=this._nodes.get(e);if(void 0===t)throw new V("Graph.".concat(n,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){if("mixed"!==e){if("undirected"===e)return Object.keys(n.undirected);if("string"==typeof t)return Object.keys(n[t])}var r=[];return pe(!1,e,t,n,(function(e){r.push(e)})),r}("mixed"===r?this.type:r,i,t)}})(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(e,t){if("mixed"===r||"mixed"===this.type||r===this.type){e=""+e;var n=this._nodes.get(e);if(void 0===n)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));pe(!1,"mixed"===r?this.type:r,i,n,t)}};var o="map"+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(e,t){var n=[];return this[s](e,(function(e,r){n.push(t(e,r))})),n};var a="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[a]=function(e,t){var n=[];return this[s](e,(function(e,r){t(e,r)&&n.push(e)})),n};var c="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(e,t,n){if(arguments.length<3)throw new U("Graph.".concat(c,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));var r=n;return this[s](e,(function(e,n){r=t(r,e,n)})),r}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s=n[0].toUpperCase()+n.slice(1,-1),o="find"+s;e.prototype[o]=function(e,t){if("mixed"===r||"mixed"===this.type||r===this.type){e=""+e;var n=this._nodes.get(e);if(void 0===n)throw new V("Graph.".concat(o,': could not find the "').concat(e,'" node in the graph.'));return pe(!0,"mixed"===r?this.type:r,i,n,t)}};var a="some"+s;e.prototype[a]=function(e,t){return!!this[o](e,t)};var c="every"+s;e.prototype[c]=function(e,t){return!this[o](e,(function(e,n){return!t(e,n)}))}}(e,t),function(e,t){var n=t.name,r=t.type,i=t.direction,s=n.slice(0,-1)+"Entries";e.prototype[s]=function(e){if("mixed"!==r&&"mixed"!==this.type&&r!==this.type)return N.empty();e=""+e;var t=this._nodes.get(e);if(void 0===t)throw new V("Graph.".concat(s,': could not find the "').concat(e,'" node in the graph.'));return function(e,t,n){if("mixed"!==e){if("undirected"===e)return me(null,n,n.undirected);if("string"==typeof t)return me(null,n,n[t])}var r=N.empty(),i=new de;return"undirected"!==e&&("out"!==t&&(r=Q(r,me(i,n,n.in))),"in"!==t&&(r=Q(r,me(i,n,n.out)))),"directed"!==e&&(r=Q(r,me(i,n,n.undirected))),r}("mixed"===r?this.type:r,i,t)}}(e,t)}))}(Pe);var xe=function(e){function n(t){var n=a({type:"directed"},t);if("multi"in n&&!1!==n.multi)throw new U("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==n.type)throw new U('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Pe),Me=function(e){function n(t){var n=a({type:"undirected"},t);if("multi"in n&&!1!==n.multi)throw new U("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==n.type)throw new U('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Pe),$e=function(e){function n(t){var n=a({multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");return e.call(this,n)||this}return t(n,e),n}(Pe),Ne=function(e){function n(t){var n=a({type:"directed",multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==n.type)throw new U('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Pe),Le=function(e){function n(t){var n=a({type:"undirected",multi:!0},t);if("multi"in n&&!0!==n.multi)throw new U("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==n.type)throw new U('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return e.call(this,n)||this}return t(n,e),n}(Pe);function Ie(e){e.from=function(t,n){var r=a({},t.options,n),i=new e(r);return i.import(t),i}}return Ie(Pe),Ie(xe),Ie(Me),Ie($e),Ie(Ne),Ie(Le),Pe.Graph=Pe,Pe.DirectedGraph=xe,Pe.UndirectedGraph=Me,Pe.MultiGraph=$e,Pe.MultiDirectedGraph=Ne,Pe.MultiUndirectedGraph=Le,Pe.InvalidArgumentsGraphError=U,Pe.NotFoundGraphError=V,Pe.UsageGraphError=Y,Pe}()},944:(e,t)=>{"use strict";t.Vb=void 0,t.Vb=function(e,t,n){var r=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 r=0,i=e.length,s=t.length,o=Math.floor(Math.max(i,s)/2)-1,a=new Array(i),c=new Array(s),l=0;l<i;l++)for(var u=Math.max(0,l-o);u<=Math.min(s,l+o+1);u++)if(!a[l]&&!c[u]&&e[l]===t[u]){++r,a[l]=c[u]=!0;break}if(0===r)return 0;var d=0,h=0;for(l=0;l<i;l++)if(a[l]){for(;!c[h];)h++;e.charAt(l)!==t.charAt(h++)&&d++}return(r/i+r/s+(r-(d/=2))/r)/3}(e,t,n),i=0;if(r>.7){for(var s=Math.min(e.length,t.length),o=0;e[o]===t[o]&&o<4&&o<s;)++i,o++;r+=.1*i*(1-r)}return r}},7106:e=>{"use strict";var t=e.exports=function(e,t,r){"function"==typeof t&&(r=t,t={}),n(t,"function"==typeof(r=t.cb||r)?r:r.pre||function(){},r.post||function(){},e,"",e)};function n(e,r,i,s,o,a,c,l,u,d){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var h in r(s,o,a,c,l,u,d),s){var p=s[h];if(Array.isArray(p)){if(h in t.arrayKeywords)for(var m=0;m<p.length;m++)n(e,r,i,p[m],o+"/"+h+"/"+m,a,o,h,s,m)}else if(h in t.propsKeywords){if(p&&"object"==typeof p)for(var f in p)n(e,r,i,p[f],o+"/"+h+"/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),a,o,h,s,f)}else(h in t.keywords||e.allKeys&&!(h in t.skipKeywords))&&n(e,r,i,p,o+"/"+h,a,o,h,s)}i(s,o,a,c,l,u,d)}}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}},5072:e=>{"use strict";var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var s={},o=[],a=0;a<e.length;a++){var c=e[a],l=r.base?c[0]+r.base:c[0],u=s[l]||0,d="".concat(l," ").concat(u);s[l]=u+1;var h=n(d),p={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==h)t[h].references++,t[h].updater(p);else{var m=i(p,r);r.byIndex=a,t.splice(a,0,{identifier:d,updater:m,references:1})}o.push(d)}return o}function i(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,i){var s=r(e=e||[],i=i||{});return function(e){e=e||[];for(var o=0;o<s.length;o++){var a=n(s[o]);t[a].references--}for(var c=r(e,i),l=0;l<s.length;l++){var u=n(s[l]);0===t[u].references&&(t[u].updater(),t.splice(u,1))}s=c}}},7659:e=>{"use strict";var t={};e.exports=function(e,n){var r=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(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},5056:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},7825: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 r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var i=void 0!==n.layer;i&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,i&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},1113: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))}}},1407:(e,t,n)=>{"use strict";n.d(t,{R:()=>l});var r=n(4328),i=n(6082),s=n(567),o=n(826),a=n(2738);const c=31;async function l(e,t=!1,n){const a=o.GO.forColumn(e);let l;n??=new Map;const d=a.isHelm()?(0,s.getHelmMonomers)(e):Object.keys(a.stats.freq).filter((e=>""!==e));for(let e=0;e<d.length;e++)n.has(d[e])||n.set(d[e],`${n.size+1}`);if(a.isHelm())l=await r.functions.call("HELM:getMolFiles",{col:e}),l=function(e,t,n=!1){const r=new Array(e.length);for(let i=0;i<e.length;i++){let s=0,o=0,a="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";const l=e.get(i);s=l.indexOf("\n",s)+1,s=l.indexOf("\n",s)+1,s=l.indexOf("\n",s)+1;const u=parseInt(l.substring(s,s+3)),d=parseInt(l.substring(s+3,s+6));a+=`M V30 COUNTS ${u} ${d} 0 0 0\n`,a+="M V30 BEGIN ATOM\n";for(let e=0;e<u;e++){s=l.indexOf("\n",s)+1+c,o=l.indexOf(" ",s);const r=l.substring(s,o);a+=n?`M V30 ${e+1} R${t.get(r)} 0.000 0.000 0 0\n`:`M V30 ${e+1} At 0.000 0.000 0 0 MASS=${t.get(r)}\n`}a+="M V30 END ATOM\n",a+="M V30 BEGIN BOND\n";for(let e=0;e<d;e++){s=l.indexOf("\n",s)+1;const t=parseInt(l.substring(s,s+3).trim()),n=parseInt(l.substring(s+3,s+6).trim());a+=`M V30 ${e+1} ${parseInt(l.substring(s+6,s+9).trim())} ${t} ${n}\n`}a+="M V30 END BOND\n",a+="M V30 END CTAB\n",a+="M END",r[i]=a}return r}(l,n,t);else{l=new Array(e.length);for(let r=0;r<e.length;r++){const e=u(a.getSplitted(r),n,t);l[r]=e}}return i.Column.fromStrings("monomericMols",l)}function u(e,t,n=!1){let r="\n Datagrok macromolecule handler\n\n 0 0 0 0 0 0 999 V3000\nM V30 BEGIN CTAB\n";r+=`M V30 COUNTS ${e.length} ${e.length?e.length-1:0} 0 0 0\n`,r+="M V30 BEGIN ATOM\n";for(let i=0;i<e.length;i++){const s=e.getCanonical(i);s!==a._S&&(r+=n?`M V30 ${i+1} R${t.get(s)} 0.000 0.000 0 0\n`:`M V30 ${i+1} At 0.000 0.000 0 0 MASS=${t.get(s)}\n`)}r+="M V30 END ATOM\n",r+="M V30 BEGIN BOND\n";for(let t=0;t<e.length-1;t++)r+=`M V30 ${t+1} 1 ${t+1} ${t+2}\n`;return r+="M V30 END BOND\n",r+="M V30 END CTAB\n",r+="M END",r}},567:(e,t,n)=>{"use strict";n.d(t,{_package:()=>Ct,activityCliffs:()=>Pt,getHelmMonomers:()=>Nt,getMonomerLib:()=>_t,getMonomerLibHelper:()=>Tt,importFasta:()=>$t,sequenceIdentityScoring:()=>Lt,sequenceSimilarityScoring:()=>It,sequenceSpaceTopMenu:()=>xt,toAtomicLevel:()=>Mt});var r,i,s=n(4328),o=n(7389),a=n(6082),c=n(684),l=n(9039);(i=r||(r={})).EUCLIDEAN="EUCLIDEAN",i.MANHATTAN="MANHATTAN";var u=n(1858),d=n(5072),h=n.n(d),p=n(7825),m=n.n(p),f=n(7659),g=n.n(f),y=n(5056),w=n.n(y),b=n(540),v=n.n(b),A=n(1113),E=n.n(A),C=n(7939),T={};T.styleTagTransform=E(),T.setAttributes=w(),T.insert=g().bind(null,"head"),T.domAPI=m(),T.insertStyleElement=v(),h()(C.A,T),C.A&&C.A.locals&&C.A.locals;var S=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};let _=null,P=null;Promise.resolve(),n(934),n(8903);const x="MCL";a.SEMTYPE.MOLECULE,a.SEMTYPE.MACROMOLECULE;const M=rxjs.operators;n(6295);const $=e=>null==e;function N(e,t,n,r){if(n>e[e.length-1])return;const i=e.findIndex((e=>n<e));e.pop(),e.splice(i,0,n),t.pop(),t.splice(i,0,r)}class L{constructor(){this._workerCount=Math.max(navigator.hardwareConcurrency-2,1)}async calcMultiColumn(e,t,i,s=[{}],o=[1],a=r.EUCLIDEAN){const c=e[0].length*(e[0].length-1)/2,l=Math.floor(c/this._workerCount),u=e[0].length>2e4?await this.getMinimalThreshold(e,t,s,o,a):0;i<u&&(console.log(`using threshold ${u}`),i=u),s.forEach(((e,t)=>s[t].threshold=i));const d=new Array(this._workerCount),h=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(111),n.b))));for(let n=0;n<this._workerCount;n++)d[n]=new Promise(((r,u)=>{const d=n*l,p=n===this._workerCount-1?c:(n+1)*l;p<=d&&r({i:new Int32Array(0),j:new Int32Array(0),distance:new Float32Array(0),idx:n}),h[n].postMessage({values:e,startIdx:d,endIdx:p,threshold:i,fnNames:t,opts:s,weights:o,aggregationMethod:a}),h[n].onmessage=({data:{error:e,i:t,j:i,distance:s}})=>{e?(h[n].terminate(),u(e)):(h[n].terminate(),r({i:t,j:i,distance:s,idx:n}))}}));const p=await Promise.all(d),m=p.reduce(((e,t)=>e+t.i.length),0),f=new Int32Array(m),g=new Int32Array(m),y=new Float32Array(m);let w=0;for(const e of p)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,r={}){return await this.calcMultiColumn([e],[t],n,[r],[1])}async getKNN(e,t,n=15,r={}){return await this.multiColumnKNN([e],[t],n,[r],[1])}async getThresholdKNN(e,t,n=.8,r={}){return await this.multiColumnThresholdKnn([e],[t],n,[r],[1])}async multiColumnThresholdKnn(e,t,i=.8,s,o,a=r.EUCLIDEAN){if(e.length!==t.length||e.length!==s.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 c=e[0].length*(e[0].length-1)/2,l=Math.floor(c/this._workerCount),u=new Array(this._workerCount),d=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(603),n.b))));for(let n=0;n<this._workerCount;n++)u[n]=new Promise(((r,u)=>{const h=n*l,p=n===this._workerCount-1?c:(n+1)*l;p<=h&&r({knnDistances:new Array(0),knnIndexes:new Array(0)}),d[n].postMessage({values:e,startIdx:h,endIdx:p,fnNames:t,opts:s,threshold:i,weights:o,aggregationMethod:a}),d[n].onmessage=({data:{error:e,knnDistances:t,knnIndexes:i}})=>{e?(d[n].terminate(),u(e)):(d[n].terminate(),r({knnDistances:t,knnIndexes:i}))}}));const h=await Promise.all(u),p=new Int32Array(e[0].length);for(const t of h)for(let n=0;n<e[0].length;++n)p[n]+=t.knnIndexes[n]?.length??0;const m={knnDistances:new Array(e[0].length).fill(null).map(((e,t)=>new Array(p[t]))),knnIndexes:new Array(e[0].length).fill(null).map(((e,t)=>new Array(p[t])))};for(const t of h)for(let n=0;n<e[0].length;++n)for(let e=0;e<(t.knnDistances[n]?.length??0);++e)m.knnDistances[n][p[n]-1]=t.knnDistances[n][e],m.knnIndexes[n][p[n]-1]=t.knnIndexes[n][e],p[n]-=1;return m}async multiColumnKNN(e,t,i=15,s,o,a=r.EUCLIDEAN){if(e.length!==t.length||e.length!==s.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 c=e[0].length*(e[0].length-1)/2,l=Math.floor(c/this._workerCount),u=new Array(this._workerCount),d=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(950),n.b))));for(let n=0;n<this._workerCount;n++)u[n]=new Promise(((r,u)=>{const h=n*l,p=n===this._workerCount-1?c:(n+1)*l;p<=h&&r({knnDistances:new Array(0),knnIndexes:new Array(0)}),d[n].postMessage({values:e,startIdx:h,endIdx:p,fnNames:t,opts:s,nNeighbours:i,weights:o,aggregationMethod:a}),d[n].onmessage=({data:{error:e,knnDistances:t,knnIndexes:i}})=>{e?(d[n].terminate(),u(e)):(d[n].terminate(),r({knnDistances:t,knnIndexes:i}))}}));const h=await Promise.all(u),p={knnDistances:new Array(e[0].length).fill(null).map((()=>new Array(i).fill(99999))),knnIndexes:new Array(e[0].length).fill(null).map((()=>new Array(i).fill(-1)))};for(const t of h)for(let n=0;n<e[0].length;++n)for(let e=0;e<(t.knnDistances[n]?.length??0);++e)N(p.knnDistances[n],p.knnIndexes[n],t.knnDistances[n][e],t.knnIndexes[n][e]);return p}async getSampleDistances(e,t,i=[],s,o=r.EUCLIDEAN){const a=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(778),n.b))));try{const n=e[0].length*(e[0].length-1)/2,r=Math.floor(n/this._workerCount),c=1e6,l=Math.max(Math.min(n/1e3,c),Math.min(n,c)),u=Math.floor(l/this._workerCount),d=new Array(this._workerCount);for(let c=0;c<this._workerCount;c++)d[c]=new Promise(((l,d)=>{const h=c*r,p=c===this._workerCount-1?n:(c+1)*r;a[c].postMessage({values:e,startIdx:h,endIdx:p,sampleLength:u,fnNames:t,opts:i,weights:s,aggregationMethod:o}),a[c].onmessage=({data:{error:e,distance:t}})=>{a[c].terminate(),e?d(e):l({distance:t})}}));const h=await Promise.all(d),p=h.reduce(((e,t)=>e+t.distance.length),0),m=new Float32Array(p);let f=0;for(const e of h)m.set(e.distance,f),f+=e.distance.length;return m.sort(),m}catch(e){return a?.forEach((e=>e?.terminate())),console.error(e),new Float32Array(1).fill(.5)}}async getMinimalThreshold(e,t,n=[],i,s=r.EUCLIDEAN){try{const r=e.length*(e.length-1)/2,o=await this.getSampleDistances(e,t,n,i,s);return 1-o[Math.floor(7e7/r*o.length)]}catch(e){return console.error(e),.5}}static calcSync(e,t,n,r){const i=[],s=[],o=[];let a=0,c=0,l=0;const u=e.length*(e.length-1)/2;for(;a<u;){const t=$(e[c])||$(e[l])?1:n(e[c],e[l]);1-t>=r&&(i.push(c),s.push(l),o.push(t)),a++,l++,l===e.length&&(c++,l=c+1)}return{i:new Int32Array(i),j:new Int32Array(s),distance:new Float32Array(o)}}}var I,R,O=n(8774);(R=I||(I={})).none="none",R.bold="bold",R.dashed="dashed";class k{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,r,i=I.none){var s;this._currentLineIdx=-1,this.lineClicked=new u.Subject,this.lineHover=new u.Subject,this.mouseOverLineId=-1,this.arrowWidth=15,this.sp=e,this.xAxisCol=this.sp.dataFrame.columns.byName(t),this.yAxisCol=this.sp.dataFrame.columns.byName(n),this.canvas=this.sp.getInfo().canvas,this.ctx=this.canvas.getContext("2d"),this.currentLineStyle=i,this.updateLines(r),this.visibility=null!==(s=r.visibility)&&void 0!==s?s:new O.A(this.lines.from.length),r.visibility||this.visibility.setAll(!0,!1),r.arrowSize&&(this.arrowWidth=r.arrowSize),this.canvas.onmousedown=e=>{var t;(null===(t=this.lines)||void 0===t?void 0:t.skipMouseOverDetection)&&(this.mouseOverLineId=this.checkCoordsOnLine(e.offsetX,e.offsetY)),-1!==this.mouseOverLineId&&this.lineClicked.next({x:e.clientX,y:e.clientY,id:this.mouseOverLineId,event:e})},this.canvas.onmousemove=e=>{var t;this.mouseOverLineId=(null===(t=this.lines)||void 0===t?void 0:t.skipMouseOverDetection)?-1: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,r,i,s,o,a,c,l,u,d,h,p,m,f,g;const y=this.lines.colors||this.lines.widths||this.lines.opacities||this.lines.drawArrowsArr;y||(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 w=this.sp.dataFrame.filter,b=Math.pow(null!==(r=this.lines.shortLineThreshold)&&void 0!==r?r:5,2);for(let e=0;e<this.lines.from.length;e++)if(w.get(this.lines.from[e])&&w.get(this.lines.to[e])&&this.visibility.getBit(e)){let t=0;const n=this.sp.getMarkerSize(this.lines.from[e])/2,r=this.sp.getMarkerSize(this.lines.to[e])/2,w=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[e]),this.yAxisCol.get(this.lines.from[e]));let v=null==w?void 0:w.x,A=null==w?void 0:w.y;const E=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[e]),this.yAxisCol.get(this.lines.to[e]));let C=null==E?void 0:E.x,T=null==E?void 0:E.y;const S=Math.min(this.sp.viewBox.width,this.sp.viewBox.height);if(this.ctx.beginPath(),v&&A&&C&&T&&Math.hypot(C-v,T-A)/S>.01){if(y){const t=(null===(i=this.lines.colors)||void 0===i?void 0:i[e])?null===(s=this.lines.colors)||void 0===s?void 0:s[e]:null!==(o=this.lines.color)&&void 0!==o?o:"0,128,0",n=(null===(a=this.lines.opacities)||void 0===a?void 0:a[e])?null===(c=this.lines.opacities)||void 0===c?void 0:c[e]:null!==(l=this.lines.opacity)&&void 0!==l?l:1;this.ctx.strokeStyle=`rgba(${t},${n})`,this.ctx.lineWidth=(null===(u=this.lines.widths)||void 0===u?void 0:u[e])?null===(d=this.lines.widths)||void 0===d?void 0:d[e]:null!==(h=this.lines.width)&&void 0!==h?h:1}e===this._currentLineIdx&&this.toggleCurrentLineStyle(!0);const w=this.multipleLinesCounts[e];let E=null;if(w){t=this.getLineLength(v,A,C,T);const i=this.getPointOnDistance(v,A,C,T,r,t),s=this.getPointOnDistance(C,T,v,A,n,t);v=i.x,A=i.y,C=s.x,T=s.y,E=this.lines.from[e]>this.lines.to[e]?this.findControlPoint(w,v,A,C,T,e):this.findControlPoint(w,C,T,v,A,e),this.ctx.moveTo(v,A),this.ctx.quadraticCurveTo(E.x,E.y,C,T)}else(!this.lines.skipShortLines||Math.pow(C-v,2)+Math.pow(T-A,2)>b)&&(this.ctx.moveTo(v,A),this.ctx.lineTo(C,T));if((null!==(p=this.lines.drawArrows)&&void 0!==p?p:null===(m=this.lines.drawArrowsArr)||void 0===m?void 0:m.getBit(e))&&(t||(t=this.getLineLength(v,A,C,T)),t>this.arrowWidth)){const e=w?null:this.getPointOnDistance(v,A,C,T,r,t),n=w?E.x:v,i=w?E.y:A;this.canvasArrow(this.ctx,null!==(f=null==e?void 0:e.x)&&void 0!==f?f:v,null!==(g=null==e?void 0:e.y)&&void 0!==g?g:A,n,i)}this.ctx.stroke(),this.ctx.closePath(),e===this._currentLineIdx&&this.toggleCurrentLineStyle(!1)}}this.fillLeftBottomRect()}toggleCurrentLineStyle(e){switch(this.currentLineStyle){case I.bold:e?this.ctx.lineWidth+=2:this.ctx.lineWidth-=2;break;case I.dashed:e?this.ctx.setLineDash([5,5]):this.ctx.setLineDash([]);break;default:return}}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={};for(let t=0;t<this.lines.from.length;t++){let n=0,r=0;this.lines.from[t]<this.lines.to[t]?(n=this.lines.from[t],r=this.lines.to[t]):(n=this.lines.to[t],r=this.lines.from[t]),e[`${n}|${r}`]?(1===e[`${n}|${r}`].length&&(this.multipleLinesCounts[e[`${n}|${r}`][0]]=1,e[`${n}|${r}`].push(1)),this.multipleLinesCounts[t]=++e[`${n}|${r}`][1]):e[`${n}|${r}`]=[t]}}checkCoordsOnLine(e,t){let n=-1,r=null,i=null;const s=this.sp.dataFrame.filter;for(let o=0;o<this.lines.from.length;o++)if(s.get(this.lines.from[o])&&s.get(this.lines.to[o])&&this.visibility.getBit(o)){const s=this.sp.getMarkerSize(this.lines.from[o])/2,a=this.sp.getMarkerSize(this.lines.to[o])/2,c=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[o]),this.yAxisCol.get(this.lines.from[o])),l=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[o]),this.yAxisCol.get(this.lines.to[o]));if(this.multipleLinesCounts[o]){const n=this.getLineLength(c.x,c.y,l.x,l.y),r=this.getPointOnDistance(c.x,c.y,l.x,l.y,a,n),u=this.getPointOnDistance(l.x,l.y,null==c?void 0:c.x,null==c?void 0:c.y,s,n),d=this.lines.from[o]>this.lines.to[o]?this.findControlPoint(this.multipleLinesCounts[o],r.x,r.y,u.x,u.y,o):this.findControlPoint(this.multipleLinesCounts[o],u.x,u.y,r.x,r.y,o);i=this.calculateDistToCurveLine(o,e,t,r,u,d)}else i=this.calculateDistToStraightLine(e,t,c,l);(!r&&null!==i&&i<5||r&&null!==i&&i<r)&&(r=i,n=o)}return n}calculateDistToStraightLine(e,t,n,r){const i=Math.min(n.x,r.x),s=Math.max(n.x,r.x),o=Math.min(n.y,r.y),a=Math.max(n.y,r.y);return e>=i-2&&e<=s+2&&t>=o-2&&t<=a+2?this.distToStraightLineSegment(e,t,n,r):null}distToStraightLineSegment(e,t,n,r){const i=(e,t,n,r)=>Math.pow(e-n,2)+Math.pow(t-r,2),s=i(n.x,n.y,r.x,r.y);if(0==s)return i(e,t,n.x,n.y);let o=((e-n.x)*(r.x-n.x)+(t-n.y)*(r.y-n.y))/s;return o=Math.max(0,Math.min(1,o)),i(e,t,n.x+o*(r.x-n.x),n.y+o*(r.y-n.y))}calculateDistToCurveLine(e,t,n,r,i,s){const o=Math.min(r.x,i.x,s.x),a=Math.max(r.x,i.x,s.x),c=Math.min(r.y,i.y,s.y),l=Math.max(r.y,i.y,s.y);if(t>=o-2&&t<=a+2&&n>=c-2&&n<=l+2){const e=a-o,u=l-c;return this.calculateDistToCurveInRect(t,n,r,s,i,e,u)}return null}calculateDistToCurveInRect(e,t,n,r,i,s,o){const a=Math.floor((s+o)/3),c=1/a,l=new Uint32Array(a),u=new Uint32Array(a),d=new Uint32Array(a);let h=null;const p=new O.A(a);for(let s=0;s<l.length;s++){const o=s*c,a=Math.pow(1-o,2)*n.x+2*o*(1-o)*r.x+Math.pow(o,2)*i.x,p=Math.pow(1-o,2)*n.y+2*o*(1-o)*r.y+Math.pow(o,2)*i.y,m=Math.abs(e-a),f=Math.abs(t-p),g=m+f;(!h||h>g)&&(h=g),d[s]=Math.max(m,f),l[s]=a,u[s]=p}for(let e=0;e<l.length;e++)d[e]<h&&p.setBit(e,!0,!1);let m=null;for(let n=-1;-1!==(n=p.findNext(n));){const r=Math.hypot(l[n]-e,u[n]-t);(!m||m>r)&&(m=r)}return m}getLineLength(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))}getPointOnDistance(e,t,n,r,i,s){const o=n-i*((n-e)/s),c=r-i*((r-t)/s);return new a.Point(o,c)}findControlPoint(e,t,n,r,i,s){const o=t+(r-t)/2,c=n+(i-n)/2;let l=o-t,u=c-n;const d=Math.sqrt(l*l+u*u);l/=d,u/=d;const h=50*Math.ceil(e/2);return e%2==0?new a.Point(o+h/2*u,c-h/2*l):new a.Point(o-h/2*u,c+h/2*l)}canvasArrow(e,t,n,r,i){const s=Math.atan2(r-t,i-n)+Math.PI;e.moveTo(t-this.arrowWidth*Math.sin(s-Math.PI/10),n-this.arrowWidth*Math.cos(s-Math.PI/10)),e.lineTo(t,n),e.lineTo(t-this.arrowWidth*Math.sin(s+Math.PI/10),n-this.arrowWidth*Math.cos(s+Math.PI/10))}}const G="dimensionality-reducer-terminate-event";var H,D,F=n(3629);async function U(e,t,r,i,o,a,c){let l=await async function(e,t,r,i,o,a,c){if(!a.distanceFnArgs)throw new Error("options.distanceFnArgs must be defined");if(e.length!==t.length||e.length!==a.distanceFnArgs.length||e.length!==i.length)throw new Error("data, metrics and options and weights must have the same length");return new Promise((function(l,u){const d=new Worker(new URL(n.p+n.u(234),n.b));d.postMessage({columnsData:e,distanceMetrics:t,method:r,options:a,weights:i,aggregationMethod:o});const h=s.events.onCustomEvent(G).subscribe((()=>{try{d?.terminate()}finally{h.unsubscribe()}}));d.onmessage=({data:{error:e,embedding:t,epochNum:n,epochsLength:r}})=>{$(n)||$(r)?(h.unsubscribe(),e?u(e):l(t),setTimeout((()=>d.terminate()),100)):c&&c(n,r,t)}}))}(e,r,t,i,o,a,c);return l=l.map((e=>(0,F.S8)(e))),l}(D=H||(H={})).EUCLIDEAN="EUCLIDEAN",D.MANHATTAN="MANHATTAN";const V={[H.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 `},[H.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 Y,B;(B=Y||(Y={})).HAMMING="Hamming",B.EUCLIDEAN="Euclidean",B.MANHATTAN="Manhattan",B.TANIMOTO="Tanimoto",B.LEVENSTEIN="Levenshtein",B.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",B.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",B.SOKAL="Sokal",B.COSINE="Cosine",B.ASYMMETRIC="Asymmetric",B.Difference="Difference",B.OneHot="One-Hot";const W={[Y.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 `},[Y.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 `},[Y.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 `},[Y.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 `},[Y.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 `},[Y.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] = gapExtensionPenalty + f32(i - 1) * gapExtensionPenalty; // accounting for the fact that left and right gaps are less costly\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] = gapExtensionPenalty + 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 || i == 1 || i == bLength) {\n top = top + gapExtensionPenalty;\n } else {\n top = top + gapOpenPenalty;\n }\n var left = (*curRow)[j - 1]; // insertion\n if (horizontalGaps[j - 1] > 0 || j == 1 || j == aLength) {\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(minLength);\n\n `},[Y.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 `},[Y.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 `},[Y.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 `},[Y.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 `},[Y.Difference]:function(e,t){return`\n let range = suppInfo.range${t};\n return f32(abs(f32(a[0]) - f32(b[0])) / range);\n `},[Y.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 `}},j={[Y.HAMMING]:e=>Math.ceil(e/30),[Y.EUCLIDEAN]:e=>Math.ceil(e/30),[Y.MANHATTAN]:e=>Math.ceil(e/30),[Y.TANIMOTO]:e=>Math.ceil(e/60),[Y.SOKAL]:e=>Math.ceil(e/60),[Y.COSINE]:e=>Math.ceil(e/60),[Y.ASYMMETRIC]:e=>Math.ceil(e/60),[Y.LEVENSTEIN]:e=>Math.ceil(e*e/60),[Y.NEEDLEMAN_WUNSCH]:e=>Math.ceil(e*e/60),[Y.MONOMER_CHEMICAL_DISTANCE]:e=>Math.ceil(e/25),[Y.Difference]:e=>1,[Y.OneHot]:e=>Math.ceil(e/40)},K={STRING:new Set([Y.HAMMING,Y.LEVENSTEIN,Y.NEEDLEMAN_WUNSCH,Y.MONOMER_CHEMICAL_DISTANCE,Y.OneHot]),UINT32ARRAY:new Set([Y.HAMMING,Y.EUCLIDEAN,Y.MANHATTAN,Y.MONOMER_CHEMICAL_DISTANCE,Y.LEVENSTEIN,Y.NEEDLEMAN_WUNSCH,Y.TANIMOTO,Y.COSINE,Y.SOKAL,Y.ASYMMETRIC,Y.OneHot,Y.Difference]),INT32ARRAY:new Set([Y.EUCLIDEAN,Y.MANHATTAN,Y.OneHot,Y.Difference]),FLOAT32ARRAY:new Set([Y.EUCLIDEAN,Y.MANHATTAN,Y.Difference]),NUMBER:new Set([Y.EUCLIDEAN,Y.MANHATTAN,Y.Difference]),BITARRAY:new Set([Y.TANIMOTO,Y.COSINE,Y.SOKAL,Y.ASYMMETRIC])};var q=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};function Z(e,t,n,r){return e.map(((e,r)=>`\n fn distanceScript${r}(aIndex: u32, bIndex: u32) -> f32 {\n let a = computeInfo.data${r}[aIndex];\n let b = computeInfo.data${r}[bIndex];\n let maxDistance: f32 = ${n};\n ${W[e](t[r],r)}\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 ${V[r](e.length)}\n }\n \n `}let z=0;const X="cliffsDf",J=new u.Subject,Q="activity_difference",ee="SALI_index",te="similarity",ne="line_index",re=["1_molecule","2_molecule"],ie="filterCliffs";async function se(e,t,r,i,c,l,u,d,h,p,m,f,g,y,w,b,v){z++;const A=l/100;let E,C=!1;const T=f.inputs,$=await f.apply({[T[0].name]:t,[T[1].name]:u,...h.preprocessingFuncArgs??{}});let N=[];if(d===x){const t=await function(e,t,r,i,s,o,a=10,c=!1,l=2){const u=new Worker(new URL(n.p+n.u(980),n.b));let d;return u.postMessage({data:e,threshold:t,weights:r,aggregationMethod:i,distanceFns:s,distanceFnArgs:o,maxIterations:a,useWebGPU:c,inflate:l}),{promise:new Promise(((e,t)=>{d=e,u.onmessage=t=>{setTimeout((()=>u.terminate()),100),e(t.data.res)},u.onerror=e=>{setTimeout((()=>u.terminate()),100),t(e)}})),terminate:()=>{try{d(null),u.terminate()}catch(e){console.error(e)}}}}([$.entries],l,[1],"MANHATTAN",[u],[$.options??{}],h?.maxIterations??5,h.useWebGPU??!1).promise;e.columns.addNewInt(e.columns.getUnusedName("MCL Cluster")).init((e=>t.clusters[e])),N=[t.embedX,t.embedY]}else N=await U([$.entries],d,[u],[1],"MANHATTAN",{...h,distanceFnArgs:[$.options??{}]});if(N.length!==r.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(r[t]).init((e=>N[t][e]));let R=null;if(h.useWebGPU)try{R=await function(e,t=.8,n,r,i,s){return q(this,void 0,void 0,(function*(){const o=yield function(){return S(this,void 0,void 0,(function*(){if(!_&&(_=yield navigator.gpu.requestAdapter({powerPreference:"high-performance"}),null==_))return null;let e=!1;if(P&&(P.lost.then((()=>{e=!0})),yield new Promise((e=>setTimeout(e,10)))),!P||e){const e=1e9,t=_.limits,n=t.maxBufferSize,r=t.maxStorageBufferBindingSize;try{return P=yield _.requestDevice({requiredLimits:{maxBufferSize:Math.min(n,e),maxStorageBufferBindingSize:Math.min(r,e)}}),P}catch(e){return console.error("Failed to create device with required limits",e),P=yield _.requestDevice(),P}}return P}))}();if(!o)return null;const a=Object.values(Y);if(n.some((e=>!a.includes(e))))throw new Error("Invalid distance metrics provided: "+n.join(", "));if(!Object.values(H).includes(r))throw new Error("Invalid aggregation function provided: "+r);const c=1-t;if(s.length!==e.length||s.length!==n.length||s.length!==i.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 l=e.length,u=e[0].length,d=e.map(((e,t)=>function(e,t=Y.HAMMING,n,r={gapOpenPenalty:1,gapExtensionPenalty:.6}){var i,s;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 c=a[0]instanceof Int32Array?"INT32ARRAY":a[0]instanceof Float32Array?"FLOAT32ARRAY":"UINT32ARRAY",l=new Uint32Array(a.map((e=>e.length)));if(!K[o]||!K[o].has(t))throw new Error(`Distance metric '${t}' not supported for entry type '${o}'`);const u=l.reduce(((e,t)=>Math.max(e,t)),0),d=j[t](u),h="INT32ARRAY"===c?Int32Array:"FLOAT32ARRAY"===c?Float32Array:Uint32Array,p=new h(a.length*u);a.forEach(((e,t)=>{p.set(e,t*u)}));let m="",f=0,g="FLOAT32ARRAY",y=null;if(t===Y.NEEDLEMAN_WUNSCH||t===Y.MONOMER_CHEMICAL_DISTANCE){let e=r.scoringMatrix&&r.alphabetIndexes?Object.keys(r.alphabetIndexes).reduce(((e,t)=>Math.max(e,t.charCodeAt(0))),0):-1;if(!r.alphabetIndexes||!r.scoringMatrix){for(let t=0;t<p.length;t++)p[t]>e&&(e=p[t]);r.scoringMatrix=new Array(e+1).fill(null).map((()=>new Array(e+1).fill(0))),r.alphabetIndexes={};for(let e=0;e<r.scoringMatrix.length;e++)r.scoringMatrix[e][e]=1,r.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=r.alphabetIndexes;for(const e of Object.keys(a))for(const t of Object.keys(a))e!==t&&(o[e.charCodeAt(0)][t.charCodeAt(0)]=r.scoringMatrix[a[e]][a[t]]);f=2+t,g="FLOAT32ARRAY",y=new Float32Array(f),y[0]=null!==(i=r.gapOpenPenalty)&&void 0!==i?i:1,y[1]=null!==(s=r.gapExtensionPenalty)&&void 0!==s?s:.6;let c=2;for(let e=0;e<o.length;e++)y.set(o[e],c),c+=o[e].length;m=`\n gapOpenPenalty${n}: f32,\n gapExtensionPenalty${n}: f32,\n similarityMatrix${n}: array<array<f32, ${e+1}>, ${e+1}>`}else if(t===Y.Difference){if(!r.range||"number"!=typeof r.range||r.range<=0){const e=p.reduce(((e,t)=>Math.min(e,t)),p[0]),t=p.reduce(((e,t)=>Math.max(e,t)),p[0]);r.range=t-e}r.range<=0&&(r.range=1),f=1,g="FLOAT32ARRAY",y=new Float32Array([r.range]),m=`\n range${n}: f32`}const w=p instanceof Int32Array?"i32":p instanceof Float32Array?"f32":"u32",b=`data${n}: array<array<${w}, ${u}>, ${a.length}>`;return{flatSourceArray:p,sourceArraySize:p.length,maxEntryLen:u,arraySizes:l,complexity:d,suppInfoBuffer:y,suppInfoSize:f,suppInfoType:g,suppInfoStructWgsl:m,entryType:o,dataTypeWGSL:w,dataStructWgsl:b,EncodedArrayConstructor:h}}(e,n[t],t,s[t])));if(0===l)throw new Error("No columns provided. Please provide at least one column of data.");1===l&&(r=H.MANHATTAN);let h=d.map((e=>e.suppInfoStructWgsl)).filter((e=>!!e&&""!=e)).join(",\n"),p=!1;h&&""!=h.trim()||(p=!0,h="\ndummy: f32\n");const m=d.map((e=>e.dataStructWgsl)).filter((e=>!!e&&""!=e)).join(",\n"),f=new Uint32Array(l*u);d.forEach(((e,t)=>{f.set(e.arraySizes,t*u)}));const g=1e4,y=100,w=d.reduce(((e,t)=>e+t.complexity),0),b=Math.ceil(6e3/w),v=Math.ceil(Math.sqrt(Math.ceil(100))),A=10*v,E=u*(u-1)/2,C=Math.ceil(E/g),T=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 ${C} 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}>, ${l}>,\n // the weights for each entry\n weights: array<f32, ${l}>,\n // the data for each entry\n ${m} // 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 ${h}\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 ${p?"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 * ${A} + 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 <= ${c}) {\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 ${Z(n,d.map((e=>e.maxEntryLen)),c,r)}\n\n\n `}),x=o.createComputePipeline({label:"sparse matrix compute pipeline",layout:"auto",compute:{module:T,entryPoint:"calcSparseMatrix"}}),M=new Uint32Array(g),$=new Uint32Array(g),N=new Uint32Array(g),L=new Uint32Array(g),I=Math.floor(E/g);let R=0,O=1;console.time("GPUthreadStarts");for(let e=0;e<g;e++){const t=9999===e?E-1:(e+1)*I,n=u-2-Math.floor(Math.sqrt(-8*t+4*u*(u-1)-7)/2-.5),r=t-u*n+Math.floor((n+1)*(n+2)/2);M[e]=O,$[e]=R,N[e]=r,L[e]=n,R=n,O=r}console.timeEnd("GPUthreadStarts");const k=4e4+u*l+l+d.reduce(((e,t)=>e+t.sourceArraySize),0),G=d.reduce(((e,t)=>e+t.suppInfoSize),0),D=1e6,F=k*Uint32Array.BYTES_PER_ELEMENT;let U=F;const V=15&F;0!==V&&(U+=16-V);const B=o.createBuffer({label:"compute info buffer",size:U,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),W=B.getMappedRange();let q=0;new Uint32Array(W,q,g).set(M),q+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(W,q,g).set($),q+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(W,q,g).set(N),q+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(W,q,g).set(L),q+=g*Uint32Array.BYTES_PER_ELEMENT,new Uint32Array(W,q,f.length).set(f),q+=f.length*Uint32Array.BYTES_PER_ELEMENT,new Float32Array(W,q,l).set(i),q+=l*Float32Array.BYTES_PER_ELEMENT;for(const e of d){const t=e.EncodedArrayConstructor,n=e.sourceArraySize;new t(W,q,n).set(e.flatSourceArray),q+=n*t.BYTES_PER_ELEMENT}B.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 d)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 re=ne;const ie=15≠0!==ie&&(re+=16-ie);const se=o.createBuffer({label:"results buffer",size:re,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC}),oe=o.createBindGroup({label:"bindGroup for sparse matrix buffer",layout:x.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:B}},{binding:1,resource:{buffer:Q}},{binding:2,resource:{buffer:se}}]}),ae=o.createBuffer({label:"results out buffer",size:se.size,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),ce=[],le=[],ue=[];let de=!1;for(;!de;){const e=o.createCommandEncoder({label:"distance encoder"}),t=e.beginComputePass({label:"distance compute pass"});t.setPipeline(x),t.setBindGroup(0,oe),t.dispatchWorkgroups(v,v),t.end(),e.copyBufferToBuffer(se,0,ae,0,ae.size);const n=e.finish();o.queue.submit([n]),yield o.queue.onSubmittedWorkDone(),yield ae.mapAsync(GPUMapMode.READ);const r=ae.getMappedRange();let i=0;const s=new Uint32Array(r,i,D);i+=D*Uint32Array.BYTES_PER_ELEMENT;const a=new Uint32Array(r,i,D);i+=D*Uint32Array.BYTES_PER_ELEMENT;const c=new Float32Array(r,i,D);i+=D*Float32Array.BYTES_PER_ELEMENT;const l=new Uint32Array(r,i,g);i+=g*Uint32Array.BYTES_PER_ELEMENT,de=new Uint32Array(r,i,g).every((e=>1===e));const u=l.reduce(((e,t)=>e+t),0),d=new Uint32Array(u),h=new Uint32Array(u),p=new Float32Array(u);let m=0;for(let e=0;e<l.length;e++){const t=l[e];0!==t&&(d.set(s.subarray(e*y,e*y+t),m),h.set(a.subarray(e*y,e*y+t),m),p.set(c.subarray(e*y,e*y+t),m),m+=t)}ce.push(d),le.push(h),ue.push(p),ae.unmap()}const he=ce.reduce(((e,t)=>e+t.length),0),pe=new Uint32Array(he),me=new Uint32Array(he),fe=new Float32Array(he);let ge=0;for(let e=0;e<ce.length;e++)pe.set(ce[e],ge),me.set(le[e],ge),fe.set(ue[e],ge),ge+=ce[e].length;return B.destroy(),Q.destroy(),se.destroy(),ae.destroy(),{i:pe,j:me,distance:fe}}))}([$.entries],A,[u],H.MANHATTAN,[1],[$.options??{}])}catch(e){console.error(e)}R||(h.useWebGPU&&console.error("WebGPU sparse matrix calculation failed, falling back to CPU implementation"),R=await(new L).calc($.entries,u,A,$.options));const O=await async function(e,t){const n=e.distance.map(((n,r)=>{const i=Math.abs(t.get(e.i[r])-t.get(e.j[r]));return 0!=n?i/n:1/0})),r=e.distance.map((e=>1-e)),i=e.i,s=e.j,o=a.BitSet.create(t.length);return e.distance.forEach(((t,n)=>{o.set(e.i[n],!0),o.set(e.j[n],!0)})),{simVals:r,saliVals:n,n1:i,n2:s,cliffsBitSet:o}}(R,c),G=function(e,t,n,r,i,s,o){const c=new Array(e).fill(0);for(let e=0;e!=r.length;++e)n[e]!=1/0&&(o.get(r[e])>o.get(i[e])?c[r[e]]+=n[e]:c[i[e]]+=n[e]);return a.Column.fromList("double",t,c)}(t.length,`sali_${r[0].substring(r[0].lastIndexOf("_"))}`,O.saliVals,O.n1,O.n2,0,c);e.columns.add(G);const D=O.cliffsBitSet,F=function(e){const t=e.filter((e=>e!==1/0)),n=t.reduce(((e,t)=>Math.min(e,t)),Number.MAX_VALUE);return{max:t.reduce(((e,t)=>Math.max(e,t)),n),min:n}}(O.saliVals),V=.8/(F.max-F.min),B=v?s.shell.view("Browse").preview:s.shell.getTableView(e.name),W=B.addViewer(a.VIEWER.SCATTER_PLOT,{xColumnName:r[0],yColumnName:r[1],size:G.name,color:c.name,showXSelector:!1,showYSelector:!1,showSizeSelector:!1,showColorSelector:!1,markerMinSize:5,markerMaxSize:25,title:i}),se=function(e,t,n,r,i,s,o,c){const l={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++)l.from[n]=t.n1[n],l.to[n]=t.n2[n],l.opacities[n]=t.saliVals[n]===1/0?1:.2+(t.saliVals[n]-o.min)*c,l.colors[n]=e.selection.get(l.from[n])&&e.selection.get(l.to[n])?"255,255,0":"0,128,0",l.widths[n]=1;const u=a.DataFrame.create(l.from.length);return re.forEach(((e,t)=>{u.columns.addNewString(e).init((e=>n.get(0===t?l.from[e]:l.to[e]))),function(e,t){Object.keys(t).forEach((n=>{e.tags[n]=t[n]}))}(u.col(e),s),u.col(e).semType=i})),u.columns.addNewFloat(Q).init((e=>Math.abs(r.get(l.from[e])-r.get(l.to[e])))),u.columns.addNewInt(ne).init((e=>e)),u.columns.addNewFloat(ee).init((e=>t.saliVals[e])),u.columns.addNewFloat(te).init((e=>t.simVals[e])),u.name=`${X}${z}`,{lines:l,linesDf:u}}(e,O,t,c,p,m,F,V);se.lines.skipMultiLineCalculation=!0,se.linesDf.col(ee).setTag("description","Structure−Activity Landscape Index (activity difference divided by 1 minus similarity)");const oe=new k(W,r[0],r[1],se.lines,I.none),ae=w?w(se.linesDf,re).sort([ee],[!1]):se.linesDf.plot.grid().sort([ee],[!1]);ae.col(ne)&&(ae.col(ne).visible=!1),e.temp[".cliffsDfGrid"]=ae;const ce=o.button(`${se.linesDf.rowCount} cliffs`,(()=>{v&&B.addViewer(ae),B.dockManager.dock(ae,"down",null,"Activity cliffs",b??.2)}));ce.classList.add("scatter_plot_link","cliffs_grid"),W.root.append(ce);const le=o.input.toggle("Show only cliffs",{value:!1,onValueChanged:t=>{t?(W.dataFrame.setTag(ie,r[0]),e.filter.and(D),J.next(r[0])):(W.dataFrame.setTag(ie,""),e.filter.setAll(!0),J.next(""))}});le.root.classList.add("scatter_plot_link","show_only_cliffs"),W.root.append(le.root),J.subscribe((e=>{le.enabled=""===e||e===r[0]}));let ue=!1;W.onEvent("d4-before-draw-scene").subscribe((t=>{ue?ue=!1:le.value&&(setTimeout((()=>{e.filter.and(D)}),100),ue=!0)}));const de=s.events.onViewerClosed.subscribe((e=>{e.args.viewer===W&&(B.dockManager.close(ae.root),de.unsubscribe(),B.subs=B.subs.filter((e=>e!==de)))}));return B.subs.push(de),se.linesDf.onCurrentCellChanged.subscribe((()=>{for(let e=0;e<se.linesDf.rowCount;e++)se.lines.widths[e]=e===se.linesDf.currentRowIdx?3:1;oe.linesToRender=se.lines;const n=se.linesDf.currentCol&&se.linesDf.currentCol.name===re[1]?se.lines.to:se.lines.from,i=-1!==se.linesDf.currentRowIdx?se.linesDf.currentRowIdx:null;if(W.dataFrame.currentRowIdx=i?n[i]:-1,null!==i){const n=se.linesDf.currentRowIdx;oe.currentLineId=n;const{zoomLeft:a,zoomRight:l,zoomTop:u,zoomBottom:d}=function(e,t,n,r,i,s){const o=Math.abs(n-i),a=Math.abs(r-s),c=e/o,l=t/a,u=Math.min(c,l),d=e/u*5,h=t/u*5,p=(n<i?n:i)+o/2-d/2,m=(r>s?r:s)-a/2+h/2;return{zoomLeft:p,zoomRight:p+d,zoomTop:m,zoomBottom:m-h}}(W.viewport.width,W.viewport.height,W.dataFrame.get(r[0],se.lines.from[n]),W.dataFrame.get(r[1],se.lines.from[n]),W.dataFrame.get(r[0],se.lines.to[n]),W.dataFrame.get(r[1],se.lines.to[n]));W.zoom(a,u,l,d),le.value?e.filter.and(D):!0===le.enabled&&e.filter.setAll(!0),setTimeout((()=>{!function(e,t,n,r,i,a,c,l,u){const d=t.getPane("Cliff Details");o.empty(d.root);const h=u({points:[n,r],lineId:i,df:e,seqCol:a,activityCol:c,sali:l});d.root.append(h),setTimeout((()=>{s.shell.o=t.root}),500)}(e,E,se.lines.from[i],se.lines.to[i],i,t,c,se.linesDf.get(ee,i),y);const n=W.dataFrame.getSortedOrder(B.grid.sortByColumns,B.grid.sortTypes);B.grid.scrollToCell(t.name,n.indexOf(W.dataFrame.currentRowIdx))}),1e3)}})),se.linesDf.onSelectionChanged.subscribe((t=>{setTimeout((()=>(()=>{const t=a.BitSet.create(e.rowCount);for(let e=0;e<se.linesDf.rowCount;e++){const n=se.linesDf.selection.get(e);n&&(t.set(se.lines.from[e],!0),t.set(se.lines.to[e],!0)),se.lines.colors[e]=n?"255,255,0":"0,128,0"}e.selection.copyFrom(t),oe.linesToRender=se.lines})()),100)})),e.onSelectionChanged.subscribe((t=>{!1===e.selection.anyTrue&&"number"==typeof t&&(C?C=!1:(e=>{e.selection.setAll(!1);for(let e=0;e<se.lines.colors.length;e++)se.lines.colors[e]="0,128,0";oe.linesToRender=se.lines})(ae.dataFrame))})),oe.lineClicked.subscribe((t=>{if(C=!0,oe.currentLineId=t.id,-1!==t.id){const n=se.linesDf.selection.clone();setTimeout((()=>{t.event.ctrlKey?(n.set(t.id,!n.get(t.id)),se.linesDf.selection.copyFrom(n)):(se.linesDf.currentRowIdx!==t.id&&(se.linesDf.currentRowIdx=t.id,e.currentRowIdx=se.lines.from[t.id]),se.linesDf.selection.copyFrom(n));const r=se.linesDf.getSortedOrder(ae.sortByColumns,ae.sortTypes);ae.scrollToCell(re[0],r.indexOf(t.id))}),500)}})),oe.lineHover.pipe((0,M.debounceTime)(500)).subscribe((n=>{-1!==n.id&&-1===e.mouseOverRowIdx&&o.tooltip.show(g({lineId:n.id,points:[se.lines.from[n.id],se.lines.to[n.id]],df:e,seqCol:t,activityCol:c}),n.x,n.y)})),W.addProperty("similarityLimit","double",A),E=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),s.shell.o=e.root,e}(),W}var oe,ae=n(2003),ce=n(826),le=n(3516),ue=n(6718),de=n(2738),he=n(3077);!function(e){e.IDENTITY="identity",e.SIMILARITY="similarity"}(oe||(oe={}));var pe,me,fe,ge=n(9192),ye=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};function we(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 be(e,t){return`${t} (${e.length>4?`${e.length} columns`:e.map((e=>e.name)).join(", ")})`}n(5540),function(e){e.ADD="ADD",e.SUB="SUB",e.MULT="MULT"}(pe||(pe={})),function(e){e.SQUARE="SQUARE",e.INVERSE="INVERSE",e.TRANSPOSE="TRANSPOSE",e.NORM="NORM",e.COLUMN_NORM="COLUMN_NORM"}(me||(me={})),function(e){e.SCALARMULT="SCALARMULT",e.SCALARADD="SCALARADD",e.SCALARPOW="SCALARPOW"}(fe||(fe={})),Object.prototype.toString,n(6873);var ve=n(4356),Ae=(n(6717),n(4870),n(1991)),Ee=n.n(Ae),Ce=n(9322);const Te="#808080",Se="rgb(0,0,0)",_e=Ce.zS;var Pe,xe;(Pe||(Pe={})).maxMonomerLength=".mm.cellRenderer.maxMonomerLength",function(e){e.MSA="MSA",e.classic="classic"}(xe||(xe={}));const Me=new class{constructor(){this.color="rgb(100,100,100)",this.pivot=0,this.left=!1,this.transparencyRate=1,this.separator="",this.last=!1,this.drawStyle=xe.classic,this.maxWord=[],this.wordIdx=0,this.gridCell=null,this.referenceSequence=null,this.maxLengthOfMonomer=null,this.monomerTextSizeMap={},this.logger=void 0}};function $e(e,t,n,r,i,s,o){var a,c,l;const u=Object.assign(Object.assign({},Me),o);o.logger?.debug("Bio: printLeftOrCentered(), start"),e.textAlign="start";let d=t.substring(0),h=u.last?"":u.separator;u.drawStyle===xe.MSA&&(h="");let p=!0,m=!0,f="difference";if(null!=u.gridCell&&null!=u.gridCell.cell.column&&(p=u.gridCell.cell.column.temp["color-code"]??!0,m=u.gridCell.cell.column.temp["compare-with-current"]??!0,f=u.gridCell.cell.column.temp["highlight-difference"]??"difference"),u.referenceSequence){const e=u.referenceSequence[u.wordIdx];m&&u.referenceSequence.length>0&&"difference"===f&&(u.transparencyRate=d==e?.3:u.transparencyRate),m&&u.referenceSequence.length>0&&"equal"===f&&(u.transparencyRate=d!=e?.3:u.transparencyRate)}null!=u.maxLengthOfMonomer&&(d=_e(d,u.maxLengthOfMonomer));const g=d+h;(a=u.monomerTextSizeMap)[g]??(a[g]=e.measureText(g));let y=u.monomerTextSizeMap[g];(c=u.monomerTextSizeMap)[d]??(c[d]=e.measureText(d));let w=u.monomerTextSizeMap[d].width;const b=s/2-(y.fontBoundingBoxAscent+y.fontBoundingBoxDescent)/2+1;(l=u.monomerTextSizeMap)[h]??(l[h]=e.measureText(h));const v=u.monomerTextSizeMap[h].width;function A(t,i){const s=p?u.color:Se;e.fillStyle=s,e.globalAlpha=u.transparencyRate,u.drawStyle===xe.classic&&(e.fillText(d,n+t,r+b),e.fillStyle=Te,e.fillText(h,n+i,r+b)),u.drawStyle===xe.MSA&&e.fillText(d,n+t,r+b)}y=y.width,u.drawStyle===xe.MSA&&(w=u.maxWord[u.wordIdx],y=u.maxWord[u.wordIdx]);const E=(u.maxWord[u.wordIdx]??0)-(u.maxWord[0]??0);if(u.left||y>i)return A(E,E+w),n+E+w+v;{const e=(i-y)/2;return A(e,e+w),n+E+e+w}}n(6882);var Ne=n(4152);function Le(e){const t=!Ee().enumerate(e).some((([t,n])=>t.length>1&&0!=n&&n!=e.length-1)),n=[],r=t?"":" ";for(const[t,i]of Ee().enumerate(e)){let s=t;i<e.length&&(s+=`${t?"":"-"}${r}`),n.push(s)}return[n,t]}function Ie(e,t,n,r,i,s,o){const a=document.createElement("canvas"),c=a.getContext("2d");c.font="12px monospace";const l=c.measureText(Le([e]).join("")).width,u=c.measureText(Le([t]).join("")).width,d=Math.max(l,u);return a.height=o,a.width=d+4,c.font="12px monospace",c.textBaseline="top",$e(c,e,0,i-s,d,o,{color:n,pivot:0,left:!0}),$e(c,t,0,i+s,d,o,{color:r,pivot:0,left:!0}),a}ae.YI.DNA,ae.YI.RNA,ae.YI.PT,ae.YI.UN,n(6642),n(4139),ae.zS,a.GridCellRenderer,a.GridCellRenderer;var Re,Oe,ke,Ge=n(8070),He=n(4326);function De(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 r=o.divText(e.activityCol.get(n).toFixed(2));r.style.display="flex",r.style.justifyContent="left",r.style.paddingLeft="30px",t.append(o.divV([o.divText(e.seqCol.get(n)),r]))})),t}function Fe(e){const t=o.div();t.append(o.divText(e.seqCol.name,{style:{fontWeight:"bold"}}));const n=new Array(2);e.points.forEach(((t,r)=>{n[r]=e.activityCol.get(t)}));const r={},i=ce.GO.forColumn(e.seqCol),s=function(e,t,n,r){const i=document.createElement("canvas"),s=i.getContext("2d");return i.height=30,function(e,t,n,r,i,s,o,a,c,l){if(s.length!==o.length){const e=function(e,t){let n=0,r=0;const i=e.length>t.length?e:t,s=e.length>t.length?t:e;for(let e=0;e<s.length;e++)i[e]===s[e]&&n++;const o=i.length-s.length;for(let e=i.length-1;e>o;e--)i[e]===s[e-o]&&r++;const a=new Array(Math.abs(e.length-t.length)).fill(ce.b9[ae.Hi.FASTA]);function c(e){return n>r?e.concat(a):a.concat(e)}return e.length>t.length?t=c(Ee()(t).toArray()):e=c(Ee()(e).toArray()),{subParts1:e,subParts2:t}}(s,o);s=e.subParts1,o=e.subParts2}const u=e.measureText(Le(s).join("")),d=e.measureText(Le(o).join("")),h=Math.max(u.width,d.width);c&&(r=h+4*s.length,e.canvas.width=h+4*s.length);let p=Math.max(t,t+(r-(h+4*s.length))/2)+5;const m=Math.max(n,n+(i-28)/2);e.save(),e.beginPath(),e.rect(t,n,c?h+4*s.length:r,i),e.clip(),e.font="12px monospace",e.textBaseline="top";let f=Ne.oT.Color;"HELM"!==a&&(f=(0,ae.ny)(a.substring(a.length-2)));for(let t=0;t<s.length;t++){const n=s[t],a=o[t],c=f.get(n);if(n!=a){const s=f.get(a),o=$e(e,n,p,m-7,r,i,{color:c,pivot:0,left:!0}),u=$e(e,a,p,m+7,r,i,{color:s,pivot:0,left:!0});p=Math.max(u,o),l&&(l[t]=Ie(n,a,c,s,m,7,i))}else p=$e(e,n,p,m,r,i,{color:c,pivot:0,left:!0,transparencyRate:.5});p+=4}e.restore()}(s,0,0,0,30,Ee()(e.canonicals).toArray(),Ee()(t.canonicals).toArray(),n,!0,r),i}(i.getSplitted(e.points[0]),i.getSplitted(e.points[1]),i.units,r);return t.append(o.div(s,{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}(r)),t.append(Ue("Activity delta",Math.abs(n[0]-n[1]))),t.append(Ue("Cliff",e.sali)),t}function Ue(e,t){return o.divH([o.divText(`${e}: `,{style:{fontWeight:"bold",paddingRight:"5px"}}),o.divText(t.toFixed(2))],{style:{paddingTop:"10px"}})}function Ve(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.meta.units=e.col(t[0]).meta.units,n.setTag(ae.gp.separator,e.col(t[0]).getTag(ae.gp.separator)),e.columns.add(n);const r=e.plot.grid();return r.col(t[0]).visible=!1,r.col(t[1]).visible=!1,r}!function(e){e.Unknown="unknown",e.FR="framework",e.CDR="cdr"}(Re||(Re={})),new class{constructor(){this.regionTypes=[Re.CDR],this.chains=["Heavy","Light"],this.skipEmptyPositions=!1,this.fitWidth=!1,this.positionWidth=16,this.positionHeight=He.fH.Entropy,this.filterSource=He.Fo.filterSource}},n(7602),n(8047),function(e){e.STYLE="Style",e.BEHAVIOR="Behavior",e.LAYOUT="Layout",e.DATA="Data"}(Oe||(Oe={})),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={})),a.JsViewer,n(6863),n(2780),n(8115),a.JsViewer,n(1407);var Ye,Be,We=n(439);ce.b9[We.Hi.FASTA],n(5433),n(3890),n(1687),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"}(Ye||(Ye={}));class je{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 r=this.isWhitespace(n)?t:t-1;for(let e=0;e<r;e++)n=this.getNextColumnIdx(n);return n}parseAtomTypes(){const e=this.atomCount,t=new Array(e);let n=this.getAtomBlockIdx();for(let r=0;r<e;r++)n=this.shiftIdxToAtomType(n),t[r]=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 r=this.getAtomBlockIdx();for(let i=0;i<this.atomCount;i++){r=this.shiftIdxToXColumn(r);for(const s of[e,t,n])s[i]=this.parseFloatValue(r),r=this.getNextColumnIdx(r);r=this.getNextLineIdx(r)}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 r=new Uint16Array(2);r[0]=this.parseIntValue(t),t=this.getNextColumnIdx(t),r[1]=this.parseIntValue(t),e[n]=r,t=this.getNextLineIdx(t)}return e}parseBondTypes(){const e=this.bondCount,t=new Uint16Array(e);let n=this.getBondBlockIdx();for(let r=0;r<e;r++)n=this.shiftIdxToBondType(n),t[r]=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 Ke extends je{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 r=0;r<t;r++){if(n=this.shiftIdxToAtomType(n),e(this.fileContent.charCodeAt(n),n))return!0;n=this.getNextLineIdx(n)}return!1}}class qe extends Ke{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(Ye.RGP_LINE_START))).forEach((t=>{const n=this.getAtomIdxToRgpIdxList(t);for(const[t,r]of n){if(e.has(t))throw new Error(`R group ${t} is already in the map`);e.set(t,r)}}));const n=t.map(((e,t)=>{if(e.startsWith(Ye.ATOM_ALIAS_LINE_START))return t})).filter((e=>void 0!==e)),r=n.map((e=>t[e])),i=n.map((e=>t[e+1]));r.forEach(((t,n)=>{const r=parseInt(t.split(/\s+/)[1])-1,s=parseInt(i[n].substring(1));if(e.has(s))throw new Error(`R group ${s} is already in the map`);e.set(s,r)}));const s=this.getRGroupAtomicIndices().filter((t=>!Array.from(e.values()).includes(t)));if(0!==s.length)throw new Error(`Unaccounted R group indices: ${s}`);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(Ye.TYPE)&&-1!==e.indexOf(Ye.END)}shiftIdxToAtomType(e){return this.shiftIdxToSpecifiedColumn(e,Ye.ATOM_TYPE_COL)}getCountsLineIdx(){let e=0;for(let t=0;t<Ye.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,Ye.FIRST_BONDED_ATOM_COL)}shiftIdxToBondType(e){return this.shiftIdxToSpecifiedColumn(e,Ye.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+Ye.NUM_OF_COUNTS_DIGITS;const n=parseInt(this.fileContent.substring(e,t));return e=t,t+=Ye.NUM_OF_COUNTS_DIGITS,{atomCount:n,bondCount:parseInt(this.fileContent.substring(e,t))}}}class Ze extends Ke{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 r=t.match(/RGROUPS=\(([\d\s]+)\)/);if(r){const t=r[1].split(/\s+/).map((e=>parseInt(e)));if(t.length>2)throw new Error(`R group data ${t} has more than 2 elements`);const i=t[1];if(e.has(i))throw new Error(`R group ${i} is already in the map`);e.set(i,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 ze{constructor(){}static getInstance(e){if(ze.isMolfileV2K(e))return new qe(e);if(ze.isMolfileV3K(e))return new Ze(e);throw new Error("Malformed molfile")}static isMolfileV2K(e){return qe.isValidMolfile(e)}static isMolfileV3K(e){return Ze.isValidMolfile(e)}}!function(e){e.BASE="HELM_BASE",e.SUGAR="HELM_SUGAR",e.LINKER="HELM_LINKER",e.AA="HELM_AA",e.CHEM="HELM_CHEM",e.BLOB="HELM_BLOB",e.NUCLEOTIDE="HELM_NUCLETIDE"}(Be||(Be={}));var Xe=n(5488),Je={};Je.styleTagTransform=E(),Je.setAttributes=w(),Je.insert=g().bind(null,"head"),Je.domAPI=m(),Je.insertStyleElement=v(),h()(Xe.A,Je),Xe.A&&Xe.A.locals&&Xe.A.locals;class Qe{source;error;_monomers={};_onChanged=new u.Subject;_duplicateMonomers={};get duplicateMonomers(){return this._duplicateMonomers}_duplicatesHandled=!0;get duplicatesHandled(){return this._duplicatesHandled}duplicatesNotified=!1;constructor(e,t=void 0,n=void 0){this.source=t,this.error=n,this._monomers=e;for(const[e,t]of Object.entries(this._monomers))for(const[e,n]of Object.entries(t))n.lib=this}toJSON(){const e=[];for(const t of Object.values(this._monomers))for(const n of Object.values(t))e.push({...n,lib:void 0,wem:void 0});return e}addMissingMonomer(e,t){let n=this._monomers[e];n||(n=this._monomers[e]={});let r=t;return t===ce.b9[ae.Hi.HELM]?r="Gap":("PEPTIDE"===e&&"X"===t||"RNA"===e&&"N"===t)&&(r="Any"),n[t]={symbol:t,name:r,molfile:"",author:"MISSING",id:-1,rgroups:Ee().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;"RNA"==e&&"R"==n&&(n="r"),"RNA"==e&&"P"==n&&(n="p");let r=null;if(e){const t=this._monomers[e];r=t?t[n]:null}else{Ct.logger.warning(`Bio: MonomerLib.getMonomer() symbol '${t}', polymerType not specified.`);for(const[e,t]of Object.entries(this._monomers))if(r=t[n],r)break}return r}_monomerSets=null;getMonomerSet(e){const t=function(e){let t;switch(e){case Be.BASE:case Be.SUGAR:case Be.LINKER:case Be.NUCLEOTIDE:case"nucleotide":t="RNA";break;case Be.AA:t="PEPTIDE";break;case Be.CHEM:t="CHEM";break;case Be.BLOB:t="BLOB";break;default:t="PEPTIDE",console.warn(`Unexpected HelmType '${e}'`)}return t}(e);if(this._monomerSets||(this._monomerSets={}),!(e in this._monomerSets))for(const[e,n]of Object.entries(this._monomers[t]));return this._monomerSets[e]}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 r=this.getMonomerSymbolsByType(t).map((e=>this.getMonomer(t,e)));return r=r.filter((e=>null!==e)),0===r.length?[]:(r=r.filter((t=>{if(!t?.rgroups)return!1;let n=t?.rgroups.length>=e;var r;return r=ze.getInstance(t.molfile).atomTypes,r.map(((e,t)=>"R#"===e?t:-1)).filter((e=>-1!==e)),n&&=!0,n})),r.map((e=>e?.symbol)))}get onChanged(){return this._onChanged}_updateLibInt(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]&&(this._duplicateMonomers[t]??={},this._duplicateMonomers[t][n]??=[this._monomers[t][n]],this._duplicateMonomers[t][n].push(e.getMonomer(t,n))),this._monomers[t][n]=e.getMonomer(t,n)}))}))}update(e){this._updateLibInt(e),this._onChanged.next()}updateLibs(e,t=!1){t&&(this._monomers={}),this._duplicateMonomers={};for(const t of e)t.error||this._updateLibInt(t);Object.entries(this.duplicateMonomers).length>0?(0,ve.ub)().then((e=>{this.assignDuplicatePreferances(e)})):this._duplicatesHandled=!0,this._onChanged.next()}assignDuplicatePreferances(e){let t=!0;for(const n in this.duplicateMonomers)for(const r in this.duplicateMonomers[n])if(e.duplicateMonomerPreferences?.[n]?.[r]){const i=e.duplicateMonomerPreferences[n][r],s=this.duplicateMonomers[n][r].find((e=>e.lib?.source===i));s?this._monomers[n][r]=s:t=!1}else t=!1;return this._duplicatesHandled=t,t}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,r]of Ee().enumerate(e))t[r]=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"}),r=this.getMonomer(e,t);if(r){const e=r.symbol;r.name,n.append(o.divH([o.div([e],{style:{fontWeight:"bolder",textWrap:"nowrap",marginRight:"6px"}}),o.div([r.name])],{style:{display:"flex",flexDirection:"row",justifyContent:"left"}}));const t={autoCrop:!0,autoCropMargin:0,suppressChiralText:!0};let i;i=r.molfile?s.chem.svgMol(r.molfile,void 0,void 0,t):r.smiles?o.divV([s.chem.svgMol(r.smiles,void 0,void 0,t),o.divText("from smiles",{style:{fontSize:"smaller"}})]):o.divText("No structure",{style:{margin:"6px"}}),n.append(o.div(i,{style:{display:"flex",flexDirection:"row",justifyContent:"center",margin:"6px"}})),n.append(o.divText(r.lib?.source??"Missed in libraries"))}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}}class et{monomerLib;symbol;polymerType;monomerType;monomerLinks;monomers;error=null;constructor(e,t,n,r,i){this.monomerLib=e,this.symbol=t,this.polymerType=n,this.monomerType=r,this.monomerLinks=i;try{this.monomers=this.monomerLinks.map((e=>{const n=this.monomerLib.getMonomer(this.polymerType,e.symbol);if(!n)throw new Error("Monomer not found: ");if(n.lib?.source!=e.source)throw new Error(`Monomer '${t}' found in different library.`);return n}))}catch(e){const[t,n]=(0,ge.AP)(e);this.error=t,this.monomers=[]}}}class tt{description;placeholders;source;error;constructor(e,t,n=void 0,r=void 0){this.description=e,this.placeholders=t,this.source=n,this.error=r}updateSets(e,t=!1){t&&(this.placeholders=[]);for(const t of e)t.error||this._updateSetInt(t)}_updateSetInt(e){for(const t of e.placeholders)this.placeholders.push(t)}}var nt=n(7433),rt=n.n(nt),it=n(1913),st=n.n(it);class ot{helmMonomerSchema;validateMonomerSchema;constructor(e){this.helmMonomerSchema=e;const t=new(rt())({allErrors:!0,strictTuples:!1,allowUnionTypes:!0});st()(t),this.validateMonomerSchema=t.compile(this.helmMonomerSchema)}validateFile(e,t){const n=this.parseJson(e,t);return null!==n&&(Array.isArray(n)?this.validateJsonContent(n,t):(console.warn(`Bio: Monomer Library File Validator file '${t}': Invalid JSON format: The file must contain an array of monomers.`),!1))}parseJson(e,t){try{return JSON.parse(e)}catch(e){return console.error(`Bio: Monomer Library File Validator file '${t}': Invalid JSON format:`,e),null}}validateJsonContent(e,t){let n=!0;const r=new Set;for(const i of e){const e=i.symbol??i.id??i.name??"#N/A";if(n=this.validateMonomerSchema(i),!n){console.warn(`Bio: Monomer Library File Validator file ${t}, monomer '${e}' violating JSON schema:`,i,"\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}const s=`${i.polymerType??""}-${e}`;r.has(s)&&console.warn(`Bio: Monomer Library File Validator file ${t}, monomer '${e}' is duplicated.`,"Please, verify that the monomer library file does not contain duplicated monomer symbols."),r.add(s)}return n}}class at{fileValidator;libHelper;eventManager;logger;filesPromise=Promise.resolve();constructor(e,t,n,r){this.fileValidator=e,this.libHelper=t,this.eventManager=n,this.logger=r,this.eventManager.updateValidLibraryFileListRequested$.subscribe((()=>{this.updateValidLibList().then((()=>{}))})),this.eventManager.updateValidSetFileListRequested$.subscribe((()=>{this.updateValidSetList().then((()=>{}))}))}static objCounter=-1;objId=++at.objCounter;toLog(){return`MonomerLibFileManager<${this.objId}>`}static async create(e,t,n){const r=await s.dapi.files.readAsText("System:AppData/Bio/tests/libraries/HELMmonomerSchema.json"),i=JSON.parse(r),o=new ot(i);return new at(o,e,t,n)}async addLibraryFile(e,t,n=!0){try{if(await s.dapi.files.exists(ve.so+`${t}`))return void s.shell.error(`File ${t} already exists`);await this.validateAgainstHELM(e,t),await s.dapi.files.writeAsText(ve.so+`${t}`,e),await this.updateValidLibList(),await s.dapi.files.exists(ve.so+`${t}`)?s.shell.info(`Added ${t} HELM library`):s.shell.error(`Failed to add ${t} library`)}catch(e){console.error(e),s.shell.error(`Failed to add ${t} library`)}}async deleteLibraryFile(e){try{await s.dapi.files.delete(ve.so+`${e}`),await this.updateValidLibList(),s.shell.info(`Deleted ${e} library`)}catch(t){console.error(t),await s.dapi.files.exists(ve.so+`${e}`)?s.shell.error(`Failed to delete ${e} library`):s.shell.warning(`File ${e} already deleted, refresh the list`)}}async loadLibraryFromFile(e,t){let n=[];const r=new a.FileSource(e),i=await r.readAsText(t);n=JSON.parse(i);const s={},o=[];return n.forEach((e=>{const t=e.polymerType,n=e.symbol;o.includes(t)||(s[t]={},o.push(t)),s[t][n]=e})),new Qe(s,t)}async loadSetFromFile(e,t,n){let r={};const i=new a.FileSource(t),s=await i.readAsText(n);r=JSON.parse(s);const o=r.description,c=Object.entries(r.placeholders).map((([t,n])=>{const r=t,i=n.polymerType,s=n.monomerType,o=n.set;return new et(e,r,i,s,o)}));return new tt(o,c)}getValidLibraryPaths(){return this.eventManager.getValidLibPathList()}getValidSetPaths(){return this.eventManager.getValidSetPathList()}async getValidLibraryPathsAsynchronously(){return await this.eventManager.getValidLibraryPathsAsynchronously()}async updateValidLibList(){const e=`${this.toLog()}.updateValidLibList()`;return this.logger.debug(`${e}, start`),this.filesPromise=this.filesPromise.then((async()=>{this.logger.debug(`${e}, IN`);const t=[],n=await this.getLibFileListAtLocation();if(!this.libListHasChanged(n))return void this.logger.debug(`${e}, end, not changed`);for(const e of n){if(!e.endsWith(".json")){t.push(e);continue}const n=await s.dapi.files.readAsText(ve.so+`${e}`);this.isValidHELMLibrary(n,e)||t.push(e)}const r=n.filter((e=>!t.includes(e)));if(this.libListHasChanged(r)&&(this.eventManager.changeValidLibPathList(r),this.libHelper.loadMonomerLib(!0)),r.some((e=>!e.endsWith(".json")))&&this.logger.warning(`Wrong validation: ${r}`),t.length>0){const e=`Invalid monomer library files in ${ve.so}, consider fixing or removing them: ${t.join(", ")}`;this.logger.warning(e)}this.logger.debug(`${e}, OUT`)})),this.logger.debug(`${e}, end`),this.filesPromise}async updateValidSetList(){const e=`${this.toLog()}.updateValidSetList()`;return Ct.logger.debug(`${e}, start`),this.filesPromise=this.filesPromise.then((async()=>{Ct.logger.debug(`${e}, IN`);const t=[],n=await this.getSetFileListAtLocation();if(!this.setListHasChanged(n))return void Ct.logger.debug(`${e}, end, not changed`);for(const e of n)e.endsWith(".json")?await s.dapi.files.readAsText(ve.Es+`${e}`):t.push(e);const r=n.filter((e=>!t.includes(e)));this.setListHasChanged(r)&&(this.eventManager.changeValidSetPathList(r),this.libHelper.loadMonomerSets(!0)),Ct.logger.debug(`${e}, OUT`)})),Ct.logger.debug(`${e}, end`),this.filesPromise}libListHasChanged(e){const t=this.eventManager.getValidLibPathList();return e.length!==t.length||e.some(((e,n)=>e!==t[n]))}setListHasChanged(e){const t=this.eventManager.getValidSetPathList();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 getLibFileListAtLocation(){const e=`${this.toLog()}.getLibFileListAtLocation()`;this.logger.debug(`${e}, start`);const t=await s.dapi.files.list(ve.so).then((e=>e.map((e=>e.fullPath)))),n=[];return n.push(...t),n.map((e=>e.substring(ve.so.length)))}async getSetFileListAtLocation(){const e=`${this.toLog()}.getSetFileListAtLocation()`;this.logger.debug(`${e}, start`);const t=await s.dapi.files.list(ve.Es).then((e=>e.map((e=>e.fullPath)))),n=[];return n.push(...t),n.map((e=>e.substring(ve.Es.length)))}}class ct{constructor(){}static _instance;static getInstance(){return ct._instance||(ct._instance=new ct),ct._instance}_libFilesUpdateSubject$=new u.BehaviorSubject([]);_setFilesUpdateSubject$=new u.BehaviorSubject([]);_addLibraryFilesSubject$=new u.Subject;_librarySelectionSubject$=new u.Subject;getValidLibPathList(){return this._libFilesUpdateSubject$.getValue()}getValidSetPathList(){return this._setFilesUpdateSubject$.getValue()}async getValidLibraryPathsAsynchronously(){return new Promise((e=>{const t=this._libFilesUpdateSubject$.pipe((0,M.skip)(1)).subscribe((n=>{e(n),t.unsubscribe()}))}))}changeValidLibPathList(e){this._libFilesUpdateSubject$.next(e)}changeValidSetPathList(e){this._setFilesUpdateSubject$.next(e)}get updateUIControlsRequested$(){return this._libFilesUpdateSubject$.pipe()}get updateValidLibraryFileListRequested$(){return this._libFilesUpdateSubject$.pipe()}get updateValidSetFileListRequested$(){return this._setFilesUpdateSubject$.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 lt{logger;_monomerLib=new Qe({},"MAIN");_monomerSets=new tt("MAIN",[]);_eventManager;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,Ge.cb)(e),!1))()]).then((t=>{if(!t)throw new Error(`Loading monomer libraries is timeout ${e} ms.`)}))}constructor(e){this.logger=e}static objCounter=-1;objId=(()=>{if(++lt.objCounter>0)throw new Error("MonomerLibManager MUST be a singleton.");return lt.objCounter})();toLog(){return`MonomerLibManager<${this.objId}>`}getMonomerLib(){return this._monomerLib}getBioLib(){return this.getMonomerLib()}getMonomerSets(){return this._monomerSets}get duplicateMonomers(){return this._monomerLib.duplicateMonomers}get duplicatesHandled(){return this._monomerLib.duplicatesHandled}assignDuplicatePreferances(e){this._monomerLib.assignDuplicatePreferances(e)}_fileManagerPromise;async getFileManager(){return void 0===this._fileManagerPromise&&(this._fileManagerPromise=(async()=>await at.create(this,this._eventManager,this.logger))()),this._fileManagerPromise}loadLibrariesPromise=Promise.resolve();async loadMonomerLib(e=!1){const t=`${this.toLog()}.loadMonomerLib()`;return this.logger.debug(`${t}, start`),this.loadLibrariesPromise=this.loadLibrariesPromise.then((async()=>{this.logger.debug(`${t}, IN`);const n=a.TaskBarProgressIndicator.create("Loading monomers ...");try{const[[t],r]=await Promise.all([await this.getFileManager().then((e=>[e.getValidLibraryPaths()])),(0,ve.ub)()]),i=t.filter((e=>{const t=!r.exclude.includes(e),n=0===r.explicit.length||r.explicit.includes(e);return t&&n}));let s=0;const o=i.length,[a]=await Promise.all([Promise.all(i.map((e=>this.readLibrary(ve.so,e).catch((t=>{const n=`Loading monomers from '${e}' error: ${t instanceof Error?t.message:t.toString()}`;return new Qe({},e,n)})).finally((()=>{n.update(Math.round(100*++s/o),`Loading monomers ${s}/${o}`)})))))]);this._monomerLib.updateLibs(a,e)}catch(e){const t=`Loading monomer libraries error: ${e instanceof Error?e.message:e.toString()}`;s.shell.warning(t);const n=e instanceof Error?e.stack:void 0;this.logger.error(t,void 0,n)}finally{n.close(),this.logger.debug(`${t}, OUT`)}})),this.logger.debug(`${t}, end`),this.loadLibrariesPromise}async loadLibraries(e){return this.loadMonomerLib(e)}loadSetsPromise=Promise.resolve();async loadMonomerSets(e=!1){const t=`${this.toLog()}.loadMonomerSets()`;return this.logger.debug(`${t}, start`),this.loadSetsPromise=this.loadSetsPromise.then((async()=>{this.logger.debug(`${t}, IN`);const e=a.TaskBarProgressIndicator.create("Loading monomer sets ...");try{const[[t]]=await Promise.all([await this.getFileManager().then((e=>[e.getValidSetPaths()]))]),n=t.filter((e=>!0));let r=0;const i=n.length,[s]=await Promise.all([Promise.all(n.map((t=>this.readSet(ve.Es,t).catch((e=>{const n=`Loading monomer sets from '${t}' error: ${e instanceof Error?e.message:e.toString()}`;return new tt("Broken monomer set",[],t,n)})).finally((()=>{e.update(Math.round(100*++r/i),`Loading monomers ${r}/${i}`)})))))]);this._monomerSets.updateSets(s)}catch(e){const t=`Loading monomer sets error: ${e instanceof Error?e.message:e.toString()}`;s.shell.warning(t);const n=e instanceof Error?e.stack:void 0;this.logger.error(t,void 0,n)}finally{e.close(),this.logger.debug(`${t}, OUT`)}})),this.logger.debug(`${t}, end`),this.loadSetsPromise}async readLibrary(e,t){const n=await this.getFileManager();return await n.loadLibraryFromFile(e,t)}async readSet(e,t){const n=await this.getFileManager();return await n.loadSetFromFile(this._monomerLib,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,ve.ub)();n.exclude=(await this.getFileManager()).getValidLibraryPaths().filter((t=>!e.includes(t))),await(0,ve.Eu)(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 null==e&&(e=window.$monomerLibHelperPromise=(async()=>{const e=new lt(Ct.logger);return e._eventManager=ct.getInstance(),e})()),e}}n(1757);var ut=n(3017),dt={};dt.styleTagTransform=E(),dt.setAttributes=w(),dt.insert=g().bind(null,"head"),dt.domAPI=m(),dt.insertStyleElement=v(),h()(ut.A,dt),ut.A&&ut.A.locals&&ut.A.locals,n(3151);new O.A(new Uint32Array([2,0,0,0,16,0,0,0,134217728,0,0,0,32,0,33554432,0,0,0,0,0,1024,0,0,0,262144,128,0,0,0,0,0,0,0,2,0,0,524288,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1048576,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,32,0,0,2,0,32,0,0,0,0,0,0,0,1024,0,0,0,262144,128,0,0,0,0,0,0,0,65536,0,0,524288,0,0,0,0,0,0,0,524288,524288,0,0,0,0,0,0,0,0,0,0,0,34603008,0,536870912,64,0,0,0]),2048),new O.A(new Uint32Array([2,0,65600,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,1024,0,0,0,262400,128,0,0,0,0,0,0,0,0,0,2097152,524288,0,0,0,1024,0,0,0,524288,0,0,0,0,0,0,0,0,0,512,0,0,34603008,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,1024,0,0,8,262144,128,0,0,16,134217728,0,0,0,0,0,0,524288,0,0,0,128,0,0,0,524288,0,0,0,268435456,0,0,0,0,0,512,2147483648,0,34603008,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,98304,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,1024,0,0,0,262144,128,33554432,0,0,0,0,33554432,0,1024,1,0,524288,32768,32,0,0,0,0,16,524288,0,0,0,0,0,0,0,0,0,71303168,0,0,34603008,131072,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([134217728,0,65536,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,1024,0,0,0,0,128,0,0,0,0,2097216,0,0,0,0,0,524288,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,512,0,0,0,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,1073840128,0,0,0,0,0,0,0,0,67108864,32,0,0,0,0,0,0,0,1024,0,512,0,262144,192,0,268435456,0,0,8200,0,0,0,67108864,0,524296,0,32,0,0,0,0,16,524288,0,0,2147483648,0,0,8,0,0,0,0,0,0,34603008,131072,536870920,4194304,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,0,150994944,64,0,0,32,0,0,0,0,0,0,0,1024,0,8388608,0,327680,128,0,0,0,0,0,0,0,2,0,524288,524288,0,0,0,0,0,0,0,0,0,0,0,256,0,0,0,0,8388608,0,33554432,0,1048576,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,0,0,0,0,0,268435488,0,0,0,0,0,0,0,1024,0,0,8,262144,128,0,0,0,0,2097152,0,0,67108864,0,0,524288,0,0,0,8,0,0,0,524288,0,0,8192,0,0,0,0,0,0,0,2147483648,0,34668544,0,545259520,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,0,0,134217728,0,0,0,32,512,0,0,0,0,0,0,1024,256,0,8388608,262400,128,0,0,0,0,0,0,0,2,0,0,524288,0,0,0,0,0,0,0,524288,0,0,0,0,0,0,0,0,0,0,0,0,42991616,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2050,0,65536,1048576,0,0,0,0,0,0,0,0,1056,0,0,0,0,0,0,0,1024,0,0,8,262144,128,0,0,0,0,0,536870912,0,2,0,0,1074266112,0,0,0,0,0,0,0,524288,0,0,0,4194304,0,0,0,0,0,0,2147483648,0,34603008,0,536870912,4194304,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,4096,0,0,0,0,0,0,16777216,32,0,0,0,0,0,0,0,1024,0,0,0,262400,128,0,0,0,0,0,0,0,0,0,0,524288,0,0,0,1024,0,0,0,524288,0,0,0,0,0,0,0,0,0,0,0,0,34603008,0,536871936,67108864,0,0,0]),2048),new O.A(new Uint32Array([0,0,1024,0,0,0,0,0,0,131072,0,1024,32,0,0,0,0,512,0,0,1024,0,0,64,0,128,0,0,1073741824,0,0,138412032,16,0,67108864,0,0,0,0,0,0,8192,0,0,8388608,0,0,8,0,0,0,0,0,0,256,0,0,0,0,553648128,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,4096,0,0,0,0,0,0,0,32,0,0,0,0,2,0,0,1024,0,0,8,262144,128,0,0,16,0,0,0,0,0,0,0,524288,0,0,0,0,0,0,0,524288,0,0,0,268435456,0,0,0,0,0,16777216,2147483648,0,34603008,0,536871936,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,4096,0,32,0,0,0,0,0,268435488,0,0,0,0,0,0,32768,134218752,0,16,8,262144,128,0,1073741824,0,0,8388608,0,0,0,65536,0,524289,0,0,0,0,0,0,0,524288,2048,0,0,0,0,0,0,0,0,0,2147483648,0,34603008,1048576,545259520,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,65536,0,0,0,1073741824,0,0,0,0,0,32,0,0,4,0,0,0,0,1024,0,0,0,262144,128,0,0,0,0,0,0,0,0,0,0,524288,0,0,1048576,0,0,0,0,524288,0,0,0,0,0,0,0,0,0,8388608,0,0,34603008,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,0,0,0,0,0,8,134217728,0,0,67108864,32,0,0,0,0,0,0,0,1024,0,8388608,0,262144,128,0,0,0,0,0,0,0,2,0,524288,524288,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,536870912,0,0,0,0,1048576,67108864,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,0,0,0,0,0,0,134217728,0,0,0,32,0,0,0,0,0,0,0,1024,0,8388608,0,262144,128,0,0,0,0,0,1073741824,128,2,0,524288,524288,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8192,0,1048576,0,536870912,0,0,0,0]),2048),new O.A(new Uint32Array([2,0,98304,8388608,0,0,0,0,0,0,256,4096,32,0,0,0,0,0,0,0,1024,0,0,0,262144,192,0,0,0,0,0,0,0,0,67108865,0,524288,32768,32,0,0,0,8224,16,524288,0,0,0,0,32,128,0,2097152,0,4194304,8388608,0,34603008,8519680,536870912,131072,262144,0,0]),2048),new O.A(new Uint32Array([2,0,98304,0,0,0,0,0,0,4194304,0,0,32,0,0,0,0,0,0,0,1024,0,0,512,262144,128,33554432,0,0,0,0,33554432,0,0,0,0,524288,0,32,0,0,2,0,16,524288,0,0,0,0,0,4,0,0,0,71303168,262144,0,34603008,131072,536870912,0,0,0,0]),2048);new O.A(new Uint32Array([0,0,0,0,0,0,0,0,0,1024,0,67108864,0,0,0,512,0,0,0,8388608,0,0,512,0,0,64,4,0,0,0,4,0,0,0,67108864,0,524289,0,0,0,0,0,0,16,0,659456,0,256,0,16,0,0,0,268435456,0,0,262144,0,131072,0,0,0,8388608,0]),2048),new O.A(new Uint32Array([0,1073741824,0,0,0,0,0,2147483648,4,67108864,0,67108864,0,256,0,0,0,0,0,0,1024,0,128,0,0,64,0,0,0,0,0,0,0,0,67108864,0,524289,0,65536,0,0,0,0,16,0,131072,0,4,0,0,0,0,0,0,4194304,0,0,2147483648,131072,0,4096,0,0,0]),2048),new O.A(new Uint32Array([0,0,0,0,1024,0,0,0,0,67109888,16384,67108864,0,0,0,0,0,0,0,33562624,1024,33554432,512,16384,0,64,4,0,0,33554432,0,0,0,0,67108864,0,524289,0,0,0,0,0,0,16,0,135168,0,268435456,0,0,0,0,0,268435456,131072,0,0,2147483648,131072,0,0,0,8388608,0]),2048),new O.A(new Uint32Array([8388608,0,0,0,0,0,0,0,0,67108864,0,0,0,4,0,0,0,0,0,0,1024,0,0,16384,0,64,0,0,0,0,0,0,0,2,67108864,0,0,0,0,0,0,0,0,40976,0,0,0,0,0,0,0,0,0,67108864,131072,524288,0,0,8519680,0,1,33554432,1048576,0]),2048),new O.A(new Uint32Array([0,0,131072,1073741824,0,0,0,0,0,67108864,0,0,0,0,0,0,0,0,0,0,1024,0,128,0,0,64,0,0,0,0,0,0,0,32768,67108864,0,0,0,0,0,0,0,0,16,0,0,0,4,0,0,2048,0,0,0,4341760,0,0,0,131072,0,0,33554432,1048576,0]),2048);var ht,pt=n(857),mt={};mt.styleTagTransform=E(),mt.setAttributes=w(),mt.insert=g().bind(null,"head"),mt.domAPI=m(),mt.insertStyleElement=v(),h()(pt.A,mt),pt.A&&pt.A.locals&&pt.A.locals,function(e){e.MONOMER="Monomer",e.SYMBOL="Symbol",e.NAME="Name",e.R_GROUPS="~R-Groups",e.MONOMER_TYPE="Monomer Type",e.POLYMER_TYPE="Polymer Type",e.NATURAL_ANALOG="Natural Analog",e.AUTHOR="Author",e.CREATE_DATE="Create Date",e.ID="ID",e.META="Meta",e.SOURCE="Source"}(ht||(ht={})),ht.MONOMER,a.COLUMN_TYPE.STRING,ht.SYMBOL,a.COLUMN_TYPE.STRING,ht.NAME,a.COLUMN_TYPE.STRING,ht.R_GROUPS,a.COLUMN_TYPE.STRING,ht.MONOMER_TYPE,a.COLUMN_TYPE.STRING,ht.POLYMER_TYPE,a.COLUMN_TYPE.STRING,ht.NATURAL_ANALOG,a.COLUMN_TYPE.STRING,ht.AUTHOR,a.COLUMN_TYPE.STRING,ht.CREATE_DATE,a.COLUMN_TYPE.DATE_TIME,ht.ID,a.COLUMN_TYPE.INT,ht.META,a.COLUMN_TYPE.STRING,ht.SOURCE,a.COLUMN_TYPE.STRING;var ft,gt=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};class yt{constructor(e,t,n=!1,r){var i;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"),(()=>gt(this,void 0,void 0,(function*(){return yield this._changeStopState()}))),"Play / pause"),this._restartBtn=o.button(o.iconFA("redo"),(()=>gt(this,void 0,void 0,(function*(){return yield this._restartScript()}))),"Restart"),this._nextStepBtn=o.button(o.iconFA("play"),(()=>gt(this,void 0,void 0,(function*(){this._isStepProcessed||(yield 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!==(i=null==r?void 0:r.autoStartFirstStep)&&void 0!==i&&i,this._progress.max=0,this._progress.value=1,yt.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 r=o.div(this._steps[t].name,"grok-tutorial-entry-instruction"),i=o.div(null===(e=this._steps[t].options)||void 0===e?void 0:e.description,"grok-tutorial-step-description hidden"),s=o.divH([n,r],"grok-tutorial-entry");this._activity.append(s,i)}}_initRoot(){var e,t,n;s.shell.windows.showContextPanel=!0,s.shell.windows.showHelp=!1;const r=s.shell.isInDemo?Array.from(s.shell.view("Browse").dockManager.rootNode.children)[0]:Array.from(s.shell.dockManager.rootNode.children)[0];this._node=s.shell.dockManager.dock(this._root,a.DOCK_TYPE.FILL,r,""),(null===(t=null===(e=r.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=r.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 gt(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],r=this._activity.getElementsByClassName("grok-icon")[this._currentStep],i=this._activity.getElementsByClassName("grok-tutorial-step-description")[this._currentStep];r.className="grok-icon far fa-spinner-third fa-spin",i.classList.remove("hidden"),i.classList.add("visible");const c=n,l=(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;try{yield this._steps[this._currentStep].func()}catch(e){s.shell.isInDemo=!1,console.error(e)}this._scrollTo(this._root,c.offsetTop-this._mainHeader.offsetHeight),this._isAutomatic&&(yield this._countdown(n,r,l),yield(0,Ge.cb)(l));const u=o.iconFA("check");if(r.replaceWith(u),u.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")}if(s.shell.isInDemo){const e=s.shell.view("Browse");(null==e?void 0:e.preview)instanceof a.TableView&&(yield s.data.detectSemanticTypes(e.preview.dataFrame))}}else this._isAutomatic?this._stopStartBtn.replaceWith(this._restartBtn):this._nextStepBtn.replaceWith(this._restartBtn)}))}_startScript(){return gt(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 gt(this,void 0,void 0,(function*(){const r=o.div([],"demo-script-countdown");t.classList.add("hidden");let i=n/1e3;const s=this._createSVGIndicator(i);r.append(s),e.prepend(r);const a=setInterval((()=>{i--,0===i&&(clearInterval(a),r.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(){return gt(this,void 0,void 0,(function*(){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||(yield this._startScript()))}))}_restartScript(){return gt(this,void 0,void 0,(function*(){s.shell.dockManager.close(this._node),this._clearRoot(),this._setInitParams(),yield 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(){s.shell.dockManager.close(this._node),this.cancelScript()}cancelScript(){this._isCancelled=!0,yt.currentObject=null,s.shell.isInDemo=!1}step(e,t,n){return this._steps[this.steps.length]={name:e,func:t,options:n},this}start(){return gt(this,void 0,void 0,(function*(){this._initRoot(),s.shell.newView(this.name),this._isAutomatic?yield this._startScript():this._autoStartFirstStep&&(yield this._nextStep())}))}}yt.currentObject=null,function(e){e.X="Embed_X",e.Y="Embed_Y"}(ft||(ft={})),n(5437);var wt=n(966);n(608),n(1619),n(5785),new class{tooltipHandlerTemp="tooltip-handler.Monomer"},a.GridCellRenderer;class bt{constructor(e,t,n=""){this.target=e,this.debugEnabled=t,this.prefix=n}error(e,t,n){return this.target.error(this.prefix+e,t,n)}warning(e,t){return this.target.warning(this.prefix+e,t)}info(e,t){return this.target.info(this.prefix+e,t)}debug(e,t){if(this.debugEnabled)return this.target.debug(this.prefix+e,t)}}Map;class vt extends a.Package{_properties;_rdKitModule;get rdKitModule(){return this._rdKitModule}get properties(){return this._properties}set properties(e){this._properties=e}_initialized=!1;get initialized(){return this._initialized}constructor(e={debug:!1}){super(),super._logger=new bt(super.logger,e.debug)}completeInit(e){this._rdKitModule=e,this._initialized=!0}handleErrorUI(e){const[t,n]=(0,ge.AP)(e);s.shell.error(t),this.logger.error(t,void 0,n)}}n(2174),a.Widget,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(ae.z1);var At=n(8754);async function Et(e,t,n,r){const i=await async function(e,t,n,r){const i=(0,he.R)(t),s=ce.GO.forColumn(t).getNewColumnFromList("ref",[n]),o=ce.GO.forColumn(s).getSplitted(0),c=r===oe.IDENTITY?function(e,t){const n=t.columns.length,r=new Array(n),i=new Array(n),s=new Array(n);for(let o=0;o<n;++o){const n=t.columns.byIndex(o);r[o]=n.getRawData(),i[o]=n.categories.indexOf("");const a=o<e.length?e.getOriginal(o):de._S;s[o]=n.categories.indexOf(a)}const o=a.Column.float("Identity",t.rowCount),c=o.getRawData();for(let n=0;n<t.rowCount;++n){c[n]=0;for(let t=0;t<e.length;++t)(r[t]?r[t][n]:0)===s[t]&&++c[n];c[n]/=e.length}return o}(o,i):r===oe.SIMILARITY?await async function(e,t){const n=t.columns.toList();return await(0,ue.uL)(n,e)}(o,i):null;if(null===c)throw new Error(`In bio library: Unknown sequence scoring method: ${r}`);return c.name=e.columns.getUnusedName(c.name),e.columns.add(c),c}(e,t,n,r);for(let e=0;e<i.length;e++)t.isNone(e)&&i.set(e,null,!1);return i}Ce.Mu,n(8312),n(9124),OCL,n(6956);const Ct=new vt;async function Tt(){return await lt.getInstance()}let St=null;function _t(){return St}async function Pt(e,t,n,r,i,u,d,h,p){if(!(0,wt.V)(t,"Activity Cliffs"))return;const m=we(e),f={units:t.meta.units,aligned:t.getTag(ae.gp.aligned),separator:t.getTag(ae.gp.separator),alphabet:t.getTag(ae.gp.alphabet)},g=u,y=t,w=async()=>await se(e,y,m,"Activity cliffs",n,r,g,i,{...h??{}},a.SEMTYPE.MACROMOLECULE,f,d,De,Fe,Ve,void 0,p),b=i===l.c.UMAP?2e5:2e4,v=i===l.c.UMAP?5e3:2e3;if(e.rowCount>b)return void s.shell.warning(`Too many rows, maximum for sequence activity cliffs is ${b}`);const A=a.TaskBarProgressIndicator.create("Running sequence activity cliffs ...");return new Promise(((t,n)=>{e.rowCount>v&&!h?.[c.vb]?o.dialog().add(o.divText("Activity cliffs analysis might take several minutes.\n Do you want to continue?")).onOK((async()=>{w().then((e=>t(e))).catch((e=>n(e)))})).onCancel((()=>{t(void 0)})).show():w().then((e=>t(e))).catch((e=>n(e)))})).catch((e=>{const[t,n]=(0,ge.AP)(e);throw Ct.logger.error(t,void 0,n),e})).finally((()=>{A.close()}))}async function xt(e,t,r,i,l,u,d,h,p){const m=p?s.shell.view("Browse").preview:s.shell.tv.dataFrame==e?s.shell.tv:void 0;if((0,wt.V)(t,"Sequence Space"))return u||(u=a.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0]),d??={},await async function(e,t,r,i,l,u,d,h=!0,p=!1,m={preprocessingFuncArgs:[]},f={},g=null,y={}){const w={showXAxis:!1,showYAxis:!1,showXSelector:!1,showYSelector:!1};if(t.length!==i.length||t.length!==u.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 b=h?f.tableView??s.shell.tableView(e.name)??s.shell.addTableView(e):null,v=async()=>{const v=a.TaskBarProgressIndicator.create(`Initializing ${f.scatterPlotName??"dimensionality reduction"} ...`);let A;try{const E=we(e);function C(n,i,s){let l=null,u=null;e.columns.names().includes(E[0])?(l=e.columns.byName(E[0]),u=e.columns.byName(E[1])):(l=e.columns.add(a.Column.float(E[0],e.rowCount)),u=e.columns.add(a.Column.float(E[1],e.rowCount)),h&&!A&&(A=b.scatterPlot({...w,x:E[0],y:E[1],title:f.scatterPlotName??be(t,r)}))),f[c.YP]&&(A?.root&&o.setUpdateIndicator(A.root,!1),l.init((e=>s[0]?s[0][e]:void 0)),u.init((e=>s[1]?s[1][e]:void 0)));const d=n/i*100;v.update(d,`Running ${f.scatterPlotName??"dimensionality reduction"}... ${d.toFixed(0)}%`)}async function T(){e.columns.add(a.Column.float(E[0],e.rowCount)),e.columns.add(a.Column.float(E[1],e.rowCount));let n=null;h&&(A=b.scatterPlot({...w,x:E[0],y:E[1],title:f.scatterPlotName??be(t,r)}),o.setUpdateIndicator(A.root,!0));const p=s.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&&(s.events.fireCustomEvent(G,{}),p.unsubscribe(),n?.(),v.close())})),g=new Promise((async(e,s)=>{try{n=e;const s=[];for(let e=0;e<u.length;++e){const n=u[e];if(m.distanceFnArgs||(m.distanceFnArgs=[]),n){const r=n.inputs[0].name,o=n.inputs[1].name,{entries:a,options:c}=await n.apply({[r]:t[e],[o]:i[e],...m.preprocessingFuncArgs[e]??{}});s.push({entries:a,options:c}),m.distanceFnArgs.push(c)}else{const n=t[e].toList(),r={};s.push({entries:n,options:r}),m.distanceFnArgs.push(r)}}e(await U(s.map((e=>e.entries)),r,i,l,d,m,f[c.vb]?void 0:C))}catch(e){s(e)}})),y=await g;return v.close(),p.unsubscribe(),y}const S=await T();if(p&&S){const _=a.TaskBarProgressIndicator.create("Clustering embeddings ...");try{const P=await function(e,t,r,i){return ye(this,void 0,void 0,(function*(){return new Promise((function(s,o){const a=new Worker(new URL(n.p+n.u(682),n.b));a.postMessage({embedX:e,embedY:t,minPts:i,epsilon:r}),a.onmessage=({data:{error:e,clusters:t}})=>{a.terminate(),e?o(e):s(t)}}))}))}(S[0],S[1],m.dbScanEpsilon??.01,m.dbScanMinPts??4),x=e.columns.getUnusedName("Cluster (DBSCAN)");e.columns.addNewString(x).init((e=>P[e].toString())),A&&(A.props.colorColumnName=x)}catch(M){s.shell.error("Clustering embeddings failed"),console.error(M)}finally{_.close()}}if(S){const $=e.columns.byName(E[0]),N=e.columns.byName(E[1]);if($.init((e=>S[0][e])),N.init((e=>S[1][e])),g)try{const L=g.inputs[0].name,I=g.inputs[1].name;await g.prepare({[L]:$,[I]:N,...y}).call(!0)}catch(R){s.shell.error("Post-processing failed"),console.error(R)}if(A)return o.setUpdateIndicator(A.root,!1),A.helpUrl="/help/compute/sequence-space",A}}catch(O){s.shell.error("Dimensionality reduction failed"),console.error(O),v.close(),A&&o.setUpdateIndicator(A.root,!1)}};return new Promise((async(t,n)=>{try{if(f.fastRowCount&&e.rowCount>f.fastRowCount&&!f[c.vb])o.dialog().add(o.divText("Analysis might take several minutes. Do you want to continue?")).onOK((async()=>{try{const e=await v();t(e)}catch(e){n(e)}})).onCancel((()=>t(void 0))).show();else{const e=await v();t(e)}}catch(e){n(e)}}))}(e,[t],r,[i],[1],[u],"MANHATTAN",l,h??!1,{...d,preprocessingFuncArgs:[d.preprocessingFuncArgs??{}]},{fastRowCount:1e4,scatterPlotName:"Sequence space",bypassLargeDataWarning:d?.[c.vb],tableView:m})}async function Mt(e,t,n){const r=a.TaskBarProgressIndicator.create("Converting to atomic level ...");try{const r=(await Tt()).getMonomerLib();await(0,At.V)(e,t,n,r)}finally{r.close()}}function $t(e){return new le.m(e).importFasta()}function Nt(e){const t=ce.GO.forColumn(e).stats;return Object.keys(t.freq)}async function Lt(e,t,n){return Et(e,t,n,oe.IDENTITY)}async function It(e,t,n){return Et(e,t,n,oe.SIMILARITY)}},8115:(e,t,n)=>{"use strict";n.d(t,{if:()=>l,nI:()=>c});var r=n(4328),i=(n(7389),n(6082)),s=n(1407),o=(n(4870),n(8070)),a=n(2003);function c(e,t,n){const r=n?function(e,t){const n=`${t}`.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),r=e.charAt(0)===t,i=e.charAt(e.length-1)===t,s=e.replace(new RegExp(`^${n}|${n}$`,"g"),"");return r?i?`${n}${s}${n}`:`${n}${s}${n}|${n}${s}$`:i?`^${s}${n}|${n}${s}${n}`:`^${s}${n}|${n}${s}${n}|${n}${s}$`}(e,n):e,s=i.BitSet.create(t.length);for(let n=0;n<t.length;n++){const i=t.get(n);(i.match(r)||i===e)&&s.set(n,!0,!1)}return s}async function l(e,t){t.version!==t.temp["last-invalidated-version"]&&await async function(e){const t=i.TaskBarProgressIndicator.create(`Invalidating molfiles for ${e.name}`);try{await(0,o.cb)(10);const t=new Map,n=await(0,s.R)(e,!0,t);e.temp["monomeric-mols"]=n,e.temp["monomers-dict"]=t,e.temp["last-invalidated-version"]=e.version}finally{t.close()}}(t);const n=i.Column.string("helm",1).init((t=>e));n.semType=i.SEMTYPE.MACROMOLECULE,n.meta.units=a.Hi.HELM;const c=await(0,s.R)(n,!0,t.temp["monomers-dict"]);return(await r.functions.call("Chem:searchSubstructure",{molStringsColumn:t.temp["monomeric-mols"],molString:c.get(0),molBlockFailover:""})).get(0)}},966:(e,t,n)=>{"use strict";n.d(t,{V:()=>o,l:()=>a});var r=n(4328),i=n(6082),s=n(826);function o(e,t,n=[],i=[],s=!0){const[o,c]=a(e,t,n,i);return s&&!o&&r.shell.warning(c),o}function a(e,t,n=[],o=[]){let a=!0,c="";const l=s.GO.forColumn(e);if(e.semType!==i.SEMTYPE.MACROMOLECULE)r.shell.warning(t+" analysis is allowed for Macromolecules semantic type"),a=!1;else{const e=l.notation;if(n.length>0&&!n.some((t=>e.toUpperCase()==t.toUpperCase())))c=`${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(!l.isHelm()){const e=l.alphabet;o.length>0&&!o.some((t=>e.toUpperCase()==t.toUpperCase()))&&(c=`${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,c]}},4139:(e,t,n)=>{"use strict";n.d(t,{HX:()=>d,J:()=>l,b9:()=>u,gN:()=>a,uF:()=>s});var r,i,s,o=n(5437);!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"}(r||(r={})),function(e){e.AAR="AAR",e.POSITION="Pos",e.SELECTION="selection"}(i||(i={})),function(e){e.MONOMER="Monomer",e.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference",e.ACTIVITY="activity",e.ACTIVITY_SCALED="activityScaled"}(s||(s={}));const a="MSA";var c,l;!function(e){e.CELL_CHANGING="isCellChanging"}(c||(c={})),function(e){e.SEPARATOR="."}(l||(l={}));const u="3.3.1",d={pepsea:{gapOpen:1.53,gapExtend:0,method:o.ZY[0]},kalign:{gapOpen:-1,gapExtend:-1,terminalGap:-1}}},5433:(e,t,n)=>{"use strict";n.d(t,{r:()=>s}),n(6082),n(7389);var r=n(4328),i=(n(1757),n(2003),n(826));async function s(e,t,n){const s=i.GO.forColumn(e).convert(t,n);e.dataFrame.columns.add(s);const o=await r.functions.call("Bio:detectMacromolecule",{col:s});return o&&(s.semType=o),await r.data.detectSemanticTypes(e.dataFrame),s}},6740:(e,t,n)=>{"use strict";n.d(t,{m8:()=>o});var r=n(4328),i=n(8070),s=n(5437);async function o(e=6e4){const t=await s.Nk.getDockerContainer();await async function(e,t=6e4){let n=e,s=!1;for(let o=0;o<t/200;++o){if(null===n&&(n=await r.dapi.docker.dockerContainers.find(e.id)),a(n)){s=!0;break}switch(n.status){case"stopped":await r.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,i.cb)(200)}if(!s)throw new Error("Docker container start timeout.")}(t,e)}function a(e){return"checking"===e.status||"started"===e.status}},6956:(e,t,n)=>{"use strict";n.d(t,{mP:()=>r});const r="H"},1619:(e,t,n)=>{"use strict";n.d(t,{D:()=>M});var r=n(4328),i=n(6082),s=n(7389),o=n(8070),a=n(2003),c=n(826),l=n(608),u=n(5437),d=n(966),h=n(4139),p=n(6740),m=n(567),f=n(5072),g=n.n(f),y=n(7825),w=n.n(y),b=n(7659),v=n.n(b),A=n(5056),E=n.n(A),C=n(540),T=n.n(C),S=n(1113),_=n.n(S),P=n(6369),x={};async function M(e={}){return new Promise((async(t,n)=>{e.clustersCol??=null,e.pepsea??={},e.pepsea.method??=h.HX.pepsea.method,e.pepsea.gapOpen??=h.HX.pepsea.gapOpen,e.pepsea.gapExtend??=h.HX.pepsea.gapExtend;const a=e.col?.dataFrame??r.shell.t,c=e.col??a.columns.bySemType(i.SEMTYPE.MACROMOLECULE);if(null==c){const e="Multiple Sequence Alignment analysis requires a dataset with a macromolecule column.";return r.shell.warning(e),void n(new l.Ap(s.divText(e)))}const d=s.input.choice("Method",{value:e.pepsea.method,items:u.ZY});d.setTooltip("Alignment method");const p=s.input.float("Terminal gap",{value:e?.kalign?.terminalGap});p.setTooltip("Penalty for opening a gap at the beginning or end of the sequence");const m=s.p(`Kalign version: ${h.b9}`,"kalign-version"),f=s.input.float("Gap open",{value:e.pepsea.gapOpen});f.setTooltip("Gap opening penalty at group-to-group alignment");const g=s.input.float("Gap extend",{value:e.pepsea.gapExtend});g.setTooltip("Gap extension penalty to skip the alignment");const y=s.inputs([f,g,p]),w=s.button("Alignment parameters",(()=>{y.hidden=!y.hidden,[f,g,p].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");w.classList.add("msa-params-button"),y.hidden=!0,w.prepend(s.icons.settings((()=>null)));const b=[d.root.style],v=[p.root.style,m.style];let A,E=c;const C=s.input.column("Sequence",{table:a,value:c,onValueChanged:async e=>{if(!e||e.semType!==i.SEMTYPE.MACROMOLECULE)return _.disabled=!0,await(0,o.cb)(0),void(C.value=E);E=e,_.disabled=!1,A=await N(C.value,a,b,v,d,T,f,g,p)},filter:e=>e.semType===i.SEMTYPE.MACROMOLECULE});C.setTooltip("Sequences column to use for alignment");const T=s.input.column("Clusters",{table:a,value:e.clustersCol});T.nullable=!0;const S=s.dialog("MSA").add(C).add(T).add(d).add(y).add(w).add(m).onOK((async()=>{await $(C,a,A,t,n)})),_=S.getButton("OK");if(C.fireChanged(),e.col)return A=await N(e.col,a,b,v,d,T,f,g,p),void await $(C,a,A,t,n);S.show()}))}async function $(e,t,n,s,o){let a=null;const c=i.TaskBarProgressIndicator.create("Analyze for MSA ...");try{if(e.fireChanged(),e.value.semType!==i.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 r.data.detectSemanticTypes(t),s(a)}catch(e){o(e)}finally{c.close()}}async function N(e,t,n,s,o,f,g,y,w){try{if(e.semType!==i.SEMTYPE.MACROMOLECULE)return;const r=t.columns.getUnusedName(`msa(${e.name})`);if((0,d.V)(e,e.name,[a.Hi.FASTA,a.Hi.SEPARATOR],[a.YI.DNA,a.YI.RNA,a.YI.PT],!1)){L(n,s,"kalign"),g.value=null,y.value=null,w.value=null;const t=c.GO.forColumn(e),i=t.isFasta()?e:t.convert(a.Hi.FASTA);return async()=>await(0,l.eE)(i,!1,r,f.value)}if((0,d.V)(e,e.name,[a.Hi.HELM],[],!1))return L(n,s,"pepsea"),g.value??=h.HX.pepsea.gapOpen,y.value??=h.HX.pepsea.gapExtend,async()=>(await(0,p.m8)(),(0,u.GD)(e,r,o.value,g.value,y.value,f.value));if((0,d.V)(e,e.name,[a.Hi.SEPARATOR],[a.YI.UN],!1)){const t=c.GO.forColumn(e).convert(a.Hi.HELM);return L(n,s,"pepsea"),g.value??=h.HX.pepsea.gapOpen,y.value??=h.HX.pepsea.gapExtend,async()=>(await(0,p.m8)(),(0,u.GD)(t,r,o.value,g.value,y.value,f.value))}return g.value=null,y.value=null,w.value=null,void L(n,s,"kalign")}catch(e){const t=e instanceof Error?e.message:e.toString();r.shell.error(t),m._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")}}x.styleTagTransform=_(),x.setAttributes=E(),x.insert=v().bind(null,"head"),x.domAPI=w(),x.insertStyleElement=T(),g()(P.A,x),P.A&&P.A.locals&&P.A.locals},608:(e,t,n)=>{"use strict";n.d(t,{Ap:()=>G,aZ:()=>U,eE:()=>D});var r=n(7389),i=n(6082),s=n(1991),o=n.n(s),a=n(3516),c=n(2003);const l=Symbol("Comlink.proxy"),u=Symbol("Comlink.endpoint"),d=Symbol("Comlink.releaseProxy"),h=Symbol("Comlink.thrown"),p=e=>"object"==typeof e&&null!==e||"function"==typeof e,m=new Map([["proxy",{canHandle:e=>p(e)&&e[l],serialize(e){const{port1:t,port2:n}=new MessageChannel;return f(e,t),[n,[n]]},deserialize:e=>(e.start(),y(e))}],["throw",{canHandle:e=>p(e)&&h 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(r){if(!r||!r.data)return;const{id:i,type:s,path:o}=Object.assign({path:[]},r.data),a=(r.data.argumentList||[]).map(T);let c;try{const t=o.slice(0,-1).reduce(((e,t)=>e[t]),e),n=o.reduce(((e,t)=>e[t]),e);switch(s){case"GET":c=n;break;case"SET":t[o.slice(-1)[0]]=T(r.data.value),c=!0;break;case"APPLY":c=n.apply(t,a);break;case"CONSTRUCT":c=function(e){return Object.assign(e,{[l]:!0})}(new n(...a));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;f(e,n),c=function(e,t){return E.set(e,t),e}(t,[t])}break;case"RELEASE":c=void 0;break;default:return}}catch(e){c={value:e,[h]:0}}Promise.resolve(c).catch((e=>({value:e,[h]:0}))).then((e=>{const[r,o]=C(e);t.postMessage(Object.assign(Object.assign({},r),{id:i}),o),"RELEASE"===s&&(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 r=!1;const i=new Proxy(n,{get(n,s){if(w(r),s===d)return()=>S(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{g(e),r=!0}));if("then"===s){if(0===t.length)return{then:()=>i};const n=S(e,{type:"GET",path:t.map((e=>e.toString()))}).then(T);return n.then.bind(n)}return b(e,[...t,s])},set(n,i,s){w(r);const[o,a]=C(s);return S(e,{type:"SET",path:[...t,i].map((e=>e.toString())),value:o},a).then(T)},apply(n,i,s){w(r);const o=t[t.length-1];if(o===u)return S(e,{type:"ENDPOINT"}).then(T);if("bind"===o)return b(e,t.slice(0,-1));const[a,c]=A(s);return S(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:a},c).then(T)},construct(n,i){w(r);const[s,o]=A(i);return S(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:s},o).then(T)}});return i}function v(e){return Array.prototype.concat.apply([],e)}function A(e){const t=e.map(C);return[t.map((e=>e[0])),v(t.map((e=>e[1])))]}const E=new WeakMap;function C(e){for(const[t,n]of m)if(n.canHandle(e)){const[r,i]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},i]}return[{type:"RAW",value:e},E.get(e)||[]]}function T(e){switch(e.type){case"HANDLER":return m.get(e.name).deserialize(e.value);case"RAW":return e.value}}function S(e,t,n){return new Promise((r=>{const i=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!==i||(e.removeEventListener("message",t),r(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:i},t),n)}))}const _="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0ICQ9U3ltYm9sKCJDb21saW5rLnByb3h5IiksQT1TeW1ib2woIkNvbWxpbmsuZW5kcG9pbnQiKSxSPVN5bWJvbCgiQ29tbGluay5yZWxlYXNlUHJveHkiKSx5PVN5bWJvbCgiQ29tbGluay50aHJvd24iKSxfPWU9PnR5cGVvZiBlPT0ib2JqZWN0IiYmZSE9PW51bGx8fHR5cGVvZiBlPT0iZnVuY3Rpb24iLEw9e2NhbkhhbmRsZTplPT5fKGUpJiZlWyRdLHNlcmlhbGl6ZShlKXtjb25zdHtwb3J0MTpyLHBvcnQyOml9PW5ldyBNZXNzYWdlQ2hhbm5lbDtyZXR1cm4gdyhlLHIpLFtpLFtpXV19LGRlc2VyaWFsaXplKGUpe3JldHVybiBlLnN0YXJ0KCksQyhlKX19LE89e2NhbkhhbmRsZTplPT5fKGUpJiZ5IGluIGUsc2VyaWFsaXplKHt2YWx1ZTplfSl7bGV0IHI7cmV0dXJuIGUgaW5zdGFuY2VvZiBFcnJvcj9yPXtpc0Vycm9yOiEwLHZhbHVlOnttZXNzYWdlOmUubWVzc2FnZSxuYW1lOmUubmFtZSxzdGFjazplLnN0YWNrfX06cj17aXNFcnJvcjohMSx2YWx1ZTplfSxbcixbXV19LGRlc2VyaWFsaXplKGUpe3Rocm93IGUuaXNFcnJvcj9PYmplY3QuYXNzaWduKG5ldyBFcnJvcihlLnZhbHVlLm1lc3NhZ2UpLGUudmFsdWUpOmUudmFsdWV9fSxFPW5ldyBNYXAoW1sicHJveHkiLExdLFsidGhyb3ciLE9dXSk7ZnVuY3Rpb24gdyhlLHI9c2VsZil7ci5hZGRFdmVudExpc3RlbmVyKCJtZXNzYWdlIixmdW5jdGlvbiBpKHMpe2lmKCFzfHwhcy5kYXRhKXJldHVybjtjb25zdHtpZDpvLHR5cGU6YSxwYXRoOm59PU9iamVjdC5hc3NpZ24oe3BhdGg6W119LHMuZGF0YSksYz0ocy5kYXRhLmFyZ3VtZW50TGlzdHx8W10pLm1hcChtKTtsZXQgbDt0cnl7Y29uc3QgdT1uLnNsaWNlKDAsLTEpLnJlZHVjZSgoZCxwKT0+ZFtwXSxlKSxmPW4ucmVkdWNlKChkLHApPT5kW3BdLGUpO3N3aXRjaChhKXtjYXNlIkdFVCI6bD1mO2JyZWFrO2Nhc2UiU0VUIjp1W24uc2xpY2UoLTEpWzBdXT1tKHMuZGF0YS52YWx1ZSksbD0hMDticmVhaztjYXNlIkFQUExZIjpsPWYuYXBwbHkodSxjKTticmVhaztjYXNlIkNPTlNUUlVDVCI6e2NvbnN0IGQ9bmV3IGYoLi4uYyk7bD16KGQpfWJyZWFrO2Nhc2UiRU5EUE9JTlQiOntjb25zdHtwb3J0MTpkLHBvcnQyOnB9PW5ldyBNZXNzYWdlQ2hhbm5lbDt3KGUscCksbD1OKGQsW2RdKX1icmVhaztjYXNlIlJFTEVBU0UiOmw9dm9pZCAwO2JyZWFrO2RlZmF1bHQ6cmV0dXJufX1jYXRjaCh1KXtsPXt2YWx1ZTp1LFt5XTowfX1Qcm9taXNlLnJlc29sdmUobCkuY2F0Y2godT0+KHt2YWx1ZTp1LFt5XTowfSkpLnRoZW4odT0+e2NvbnN0W2YsZF09Uyh1KTtyLnBvc3RNZXNzYWdlKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxmKSx7aWQ6b30pLGQpLGE9PT0iUkVMRUFTRSImJihyLnJlbW92ZUV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLGkpLE0ocikpfSl9KSxyLnN0YXJ0JiZyLnN0YXJ0KCl9ZnVuY3Rpb24gVChlKXtyZXR1cm4gZS5jb25zdHJ1Y3Rvci5uYW1lPT09Ik1lc3NhZ2VQb3J0In1mdW5jdGlvbiBNKGUpe1QoZSkmJmUuY2xvc2UoKX1mdW5jdGlvbiBDKGUscil7cmV0dXJuIGIoZSxbXSxyKX1mdW5jdGlvbiBoKGUpe2lmKGUpdGhyb3cgbmV3IEVycm9yKCJQcm94eSBoYXMgYmVlbiByZWxlYXNlZCBhbmQgaXMgbm90IHVzZWFibGUiKX1mdW5jdGlvbiBiKGUscj1bXSxpPWZ1bmN0aW9uKCl7fSl7bGV0IHM9ITE7Y29uc3Qgbz1uZXcgUHJveHkoaSx7Z2V0KGEsbil7aWYoaChzKSxuPT09UilyZXR1cm4oKT0+ZyhlLHt0eXBlOiJSRUxFQVNFIixwYXRoOnIubWFwKGM9PmMudG9TdHJpbmcoKSl9KS50aGVuKCgpPT57TShlKSxzPSEwfSk7aWYobj09PSJ0aGVuIil7aWYoci5sZW5ndGg9PT0wKXJldHVybnt0aGVuOigpPT5vfTtjb25zdCBjPWcoZSx7dHlwZToiR0VUIixwYXRoOnIubWFwKGw9PmwudG9TdHJpbmcoKSl9KS50aGVuKG0pO3JldHVybiBjLnRoZW4uYmluZChjKX1yZXR1cm4gYihlLFsuLi5yLG5dKX0sc2V0KGEsbixjKXtoKHMpO2NvbnN0W2wsdV09UyhjKTtyZXR1cm4gZyhlLHt0eXBlOiJTRVQiLHBhdGg6Wy4uLnIsbl0ubWFwKGY9PmYudG9TdHJpbmcoKSksdmFsdWU6bH0sdSkudGhlbihtKX0sYXBwbHkoYSxuLGMpe2gocyk7Y29uc3QgbD1yW3IubGVuZ3RoLTFdO2lmKGw9PT1BKXJldHVybiBnKGUse3R5cGU6IkVORFBPSU5UIn0pLnRoZW4obSk7aWYobD09PSJiaW5kIilyZXR1cm4gYihlLHIuc2xpY2UoMCwtMSkpO2NvbnN0W3UsZl09RihjKTtyZXR1cm4gZyhlLHt0eXBlOiJBUFBMWSIscGF0aDpyLm1hcChkPT5kLnRvU3RyaW5nKCkpLGFyZ3VtZW50TGlzdDp1fSxmKS50aGVuKG0pfSxjb25zdHJ1Y3QoYSxuKXtoKHMpO2NvbnN0W2MsbF09RihuKTtyZXR1cm4gZyhlLHt0eXBlOiJDT05TVFJVQ1QiLHBhdGg6ci5tYXAodT0+dS50b1N0cmluZygpKSxhcmd1bWVudExpc3Q6Y30sbCkudGhlbihtKX19KTtyZXR1cm4gb31mdW5jdGlvbiBEKGUpe3JldHVybiBBcnJheS5wcm90b3R5cGUuY29uY2F0LmFwcGx5KFtdLGUpfWZ1bmN0aW9uIEYoZSl7Y29uc3Qgcj1lLm1hcChTKTtyZXR1cm5bci5tYXAoaT0+aVswXSksRChyLm1hcChpPT5pWzFdKSldfWNvbnN0IFA9bmV3IFdlYWtNYXA7ZnVuY3Rpb24gTihlLHIpe3JldHVybiBQLnNldChlLHIpLGV9ZnVuY3Rpb24geihlKXtyZXR1cm4gT2JqZWN0LmFzc2lnbihlLHtbJF06ITB9KX1mdW5jdGlvbiBTKGUpe2Zvcihjb25zdFtyLGldb2YgRSlpZihpLmNhbkhhbmRsZShlKSl7Y29uc3RbcyxvXT1pLnNlcmlhbGl6ZShlKTtyZXR1cm5be3R5cGU6IkhBTkRMRVIiLG5hbWU6cix2YWx1ZTpzfSxvXX1yZXR1cm5be3R5cGU6IlJBVyIsdmFsdWU6ZX0sUC5nZXQoZSl8fFtdXX1mdW5jdGlvbiBtKGUpe3N3aXRjaChlLnR5cGUpe2Nhc2UiSEFORExFUiI6cmV0dXJuIEUuZ2V0KGUubmFtZSkuZGVzZXJpYWxpemUoZS52YWx1ZSk7Y2FzZSJSQVciOnJldHVybiBlLnZhbHVlfX1mdW5jdGlvbiBnKGUscixpKXtyZXR1cm4gbmV3IFByb21pc2Uocz0+e2NvbnN0IG89VSgpO2UuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsZnVuY3Rpb24gYShuKXshbi5kYXRhfHwhbi5kYXRhLmlkfHxuLmRhdGEuaWQhPT1vfHwoZS5yZW1vdmVFdmVudExpc3RlbmVyKCJtZXNzYWdlIixhKSxzKG4uZGF0YSkpfSksZS5zdGFydCYmZS5zdGFydCgpLGUucG9zdE1lc3NhZ2UoT2JqZWN0LmFzc2lnbih7aWQ6b30sciksaSl9KX1mdW5jdGlvbiBVKCl7cmV0dXJuIG5ldyBBcnJheSg0KS5maWxsKDApLm1hcCgoKT0+TWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpKk51bWJlci5NQVhfU0FGRV9JTlRFR0VSKS50b1N0cmluZygxNikpLmpvaW4oIi0iKX1jb25zdCBXPWFzeW5jKCk9PldlYkFzc2VtYmx5LnZhbGlkYXRlKG5ldyBVaW50OEFycmF5KFswLDk3LDExNSwxMDksMSwwLDAsMCwxLDUsMSw5NiwwLDEsMTIzLDMsMiwxLDAsMTAsMTAsMSw4LDAsNjUsMCwyNTMsMTUsMjUzLDk4LDExXSkpLGs9ImVhZ2VyIix4PSJsYXp5IixqPXtzc3c6WyJzaW1kIl0sbWluaW1hcDI6WyJzaW1kIl19LHQ9e3Rvb2xzOltdLGNvbmZpZzp7fSxmaWxlczpbXSxiYXNlOnt9LGZzOnt9LGFzeW5jIGluaXQoKXtpZih0LnRvb2xzLmxlbmd0aD09PTApdGhyb3ciRXhwZWN0aW5nIGF0IGxlYXN0IDEgdG9vbC4iO2lmKG5ldyBTZXQodC50b29scy5tYXAocj0+YCR7ci50b29sfS8ke3IucHJvZ3JhbXx8ci50b29sfWApKS5zaXplIT09dC50b29scy5sZW5ndGgpdGhyb3ciRm91bmQgZHVwbGljYXRlIHRvb2xzOyBjYW4gb25seSBoYXZlIGVhY2ggdG9vbC9wcm9ncmFtIGNvbWJpbmF0aW9uIGF0IG1vc3Qgb25jZS4iO2lmKHQuYmFzZT10LnRvb2xzLmZpbmQocj0+ci5yZWluaXQhPT0hMCksIXQuYmFzZSl0aHJvdyJDb3VsZCBub3QgZmluZCBhIHRvb2wgd2l0aCBgcmVpbml0OiBmYWxzZWAgdG8gdXNlIGFzIHRoZSBiYXNlIG1vZHVsZS4gVG8gZml4IHRoaXMgaXNzdWUsIGluY2x1ZGUgdGhlIHRvb2wgYGJhc2UvMS4wLjBgIHdoZW4gaW5pdGlhbGl6aW5nIEFpb2xpLiI7cmV0dXJuIHQuYmFzZS5pc0Jhc2VNb2R1bGU9ITAsYXdhaXQgdGhpcy5fc2V0dXAodC5iYXNlKSxhd2FpdCB0aGlzLl9pbml0TW9kdWxlcygpLHQuX2xvZygiUmVhZHkiKSwhMH0sYXN5bmMgX2luaXRNb2R1bGVzKCl7YXdhaXQgUHJvbWlzZS5hbGwodC50b29scy5tYXAodGhpcy5fc2V0dXApKSxhd2FpdCB0aGlzLl9zZXR1cEZTKCl9LG1vdW50KGU9W10pe2NvbnN0IHI9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyRGF0YX1gLGk9YCR7dC5jb25maWcuZGlyU2hhcmVkfSR7dC5jb25maWcuZGlyTW91bnRlZH1gO2xldCBzPVtdLG89W10sYT1bXTshQXJyYXkuaXNBcnJheShlKSYmIShlIGluc3RhbmNlb2YgRmlsZUxpc3QpJiYoZT1bZV0pLHQuX2xvZyhgTW91bnRpbmcgJHtlLmxlbmd0aH0gZmlsZXNgKTtmb3IobGV0IG4gb2YgZSl7aWYobiBpbnN0YW5jZW9mIEZpbGV8fChuPT1udWxsP3ZvaWQgMDpuLmRhdGEpaW5zdGFuY2VvZiBCbG9iJiZuLm5hbWV8fHR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmbi5uYW1lKXR5cGVvZihuPT1udWxsP3ZvaWQgMDpuLmRhdGEpPT0ic3RyaW5nIiYmKG4uZGF0YT1uZXcgQmxvYihbbi5kYXRhXSx7dHlwZToidGV4dC9wbGFpbiJ9KSkscy5wdXNoKG4pO2Vsc2UgaWYobi5uYW1lJiZuLnVybClvLnB1c2gobik7ZWxzZSBpZih0eXBlb2Ygbj09InN0cmluZyImJm4uc3RhcnRzV2l0aCgiaHR0cCIpKW49e3VybDpuLG5hbWU6bi5zcGxpdCgiLy8iKS5wb3AoKS5yZXBsYWNlKC9cLy9nLCItIil9LG8ucHVzaChuKTtlbHNlIHRocm93J0Nhbm5vdCBtb3VudCBmaWxlKHMpIHNwZWNpZmllZC4gTXVzdCBiZSBhIEZpbGUsIEJsb2IsIGEgVVJMIHN0cmluZywgb3IgeyBuYW1lOiAiZmlsZS50eHQiLCBkYXRhOiAic3RyaW5nIiB9Lic7YS5wdXNoKG4ubmFtZSl9dHJ5e3QuZnMudW5tb3VudChpKX1jYXRjaHt9Zm9yKGxldCBuIG9mIG8pdC5mcy5jcmVhdGVMYXp5RmlsZShyLG4ubmFtZSxuLnVybCwhMCwhMCk7cmV0dXJuIHQuZmlsZXM9dC5maWxlcy5jb25jYXQocyksdC5iYXNlLm1vZHVsZS5GUy5tb3VudCh0LmJhc2UubW9kdWxlLldPUktFUkZTLHtmaWxlczp0LmZpbGVzLmZpbHRlcihuPT5uIGluc3RhbmNlb2YgRmlsZSksYmxvYnM6dC5maWxlcy5maWx0ZXIobj0+KG49PW51bGw/dm9pZCAwOm4uZGF0YSlpbnN0YW5jZW9mIEJsb2IpfSxpKSxzLm1hcChuPT57Y29uc3QgYz1gJHtpfS8ke24ubmFtZX1gLGw9YCR7cn0vJHtuLm5hbWV9YDt0cnl7dC5mcy51bmxpbmsobCl9Y2F0Y2h7fXQuX2xvZyhgQ3JlYXRpbmcgc3ltbGluazogJHtsfSAtLT4gJHtjfWApLHQuZnMuc3ltbGluayhjLGwpfSksYS5tYXAobj0+YCR7cn0vJHtufWApfSxhc3luYyBleGVjKGUscj1udWxsKXtpZih0Ll9sb2coYEV4ZWN1dGluZyAlYyR7ZX0lYyBhcmdzPSR7cn1gLCJjb2xvcjpkYXJrYmx1ZTsgZm9udC13ZWlnaHQ6Ym9sZCIsIiIpLCFlKXRocm93IkV4cGVjdGluZyBhIGNvbW1hbmQiO2xldCBpPWU7cj09bnVsbCYmKHI9ZS5zcGxpdCgiICIpLGk9ci5zaGlmdCgpKTtjb25zdCBzPXQudG9vbHMuZmluZChhPT57dmFyIGM7bGV0IG49aTtyZXR1cm4oKGM9YT09bnVsbD92b2lkIDA6YS5mZWF0dXJlcyk9PW51bGw/dm9pZCAwOmMuc2ltZCk9PT0hMCYmKG49YCR7bn0tc2ltZGApLGEucHJvZ3JhbT09bn0pO2lmKHM9PW51bGwpdGhyb3dgUHJvZ3JhbSAke2l9IG5vdCBmb3VuZC5gO3Muc3Rkb3V0PSIiLHMuc3RkZXJyPSIiLHMubG9hZGluZz09eCYmKHMubG9hZGluZz1rLGF3YWl0IHRoaXMuX2luaXRNb2R1bGVzKCkpO3RyeXtzLm1vZHVsZS5jYWxsTWFpbihyKX1jYXRjaChhKXtjb25zb2xlLmVycm9yKGEpfXRyeXtzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzFdKSxzLm1vZHVsZS5GUy5jbG9zZShzLm1vZHVsZS5GUy5zdHJlYW1zWzJdKX1jYXRjaHt9cy5tb2R1bGUuRlMuc3RyZWFtc1sxXT1zLm1vZHVsZS5GUy5vcGVuKCIvZGV2L3N0ZG91dCIsInciKSxzLm1vZHVsZS5GUy5zdHJlYW1zWzJdPXMubW9kdWxlLkZTLm9wZW4oIi9kZXYvc3RkZXJyIiwidyIpO2xldCBvPXtzdGRvdXQ6cy5zdGRvdXQsc3RkZXJyOnMuc3RkZXJyfTtyZXR1cm4gdC5jb25maWcucHJpbnRJbnRlcmxlYXZlZCYmKG89cy5zdGRvdXQpLHMucmVpbml0PT09ITAmJmF3YWl0IHRoaXMucmVpbml0KHMudG9vbCksb30sY2F0KGUpe3JldHVybiB0Ll9maWxlb3AoImNhdCIsZSl9LGxzKGUpe3JldHVybiB0Ll9maWxlb3AoImxzIixlKX0sZG93bmxvYWQoZSl7cmV0dXJuIHQuX2ZpbGVvcCgiZG93bmxvYWQiLGUpfSxwd2QoKXtyZXR1cm4gdC5mcy5jd2QoKX0sY2QoZSl7Zm9yKGxldCByIG9mIHQudG9vbHMpIXIubW9kdWxlfHxyLm1vZHVsZS5GUy5jaGRpcihlKX0sbWtkaXIoZSl7cmV0dXJuIHQuZnMubWtkaXIoZSksITB9LHJlYWQoe3BhdGg6ZSxsZW5ndGg6cixmbGFnOmk9InIiLG9mZnNldDpzPTAscG9zaXRpb246bz0wfSl7Y29uc3QgYT10LmZzLm9wZW4oZSxpKSxuPW5ldyBVaW50OEFycmF5KHIpO3JldHVybiB0LmZzLnJlYWQoYSxuLHMscixvKSx0LmZzLmNsb3NlKGEpLG59LHdyaXRlKHtwYXRoOmUsYnVmZmVyOnIsZmxhZzppPSJ3KyIsb2Zmc2V0OnM9MCxwb3NpdGlvbjpvPTB9KXtjb25zdCBhPXQuZnMub3BlbihlLGkpO3QuZnMud3JpdGUoYSxyLHMsci5sZW5ndGgsbyksdC5mcy5jbG9zZShhKX0sYXN5bmMgcmVpbml0KGUpe2NvbnN0IHI9dC50b29scy5maW5kKHM9PnMudG9vbD09ZSksaT10LmJhc2UubW9kdWxlLkZTLmN3ZCgpO09iamVjdC5hc3NpZ24ocixyLmNvbmZpZyksci5yZWFkeT0hMSxhd2FpdCB0aGlzLmluaXQoKSxyLmlzQmFzZU1vZHVsZSYmdGhpcy5tb3VudCgpLHRoaXMuY2QoaSl9LF9zdGRpblR4dDoiIixfc3RkaW5QdHI6MCxnZXQgc3RkaW4oKXtyZXR1cm4gdC5fc3RkaW5UeHR9LHNldCBzdGRpbihlPSIiKXt0Ll9sb2coYFNldHRpbmcgc3RkaW4gdG8gJWMke2V9JWNgLCJjb2xvcjpkYXJrYmx1ZSIsIiIpLHQuX3N0ZGluVHh0PWUsdC5fc3RkaW5QdHI9MH0sYXN5bmMgX3NldHVwKGUpe2lmKGUucmVhZHkpcmV0dXJuO2lmKHQuX2xvZyhgU2V0dGluZyB1cCAke2UudG9vbH0gKGJhc2UgPSAke2UuaXNCYXNlTW9kdWxlPT09ITB9KS4uLmApLGUuY29uZmlnPU9iamVjdC5hc3NpZ24oe30sZSksZS51cmxQcmVmaXh8fChlLnVybFByZWZpeD1gJHt0LmNvbmZpZy51cmxDRE59LyR7ZS50b29sfS8ke2UudmVyc2lvbn1gKSxlLnByb2dyYW18fChlLnByb2dyYW09ZS50b29sKSxlLmZlYXR1cmVzfHwoZS5mZWF0dXJlcz17fSwoaltlLnByb2dyYW1dfHxbXSkuaW5jbHVkZXMoInNpbWQiKSYmKGF3YWl0IFcoKT8oZS5wcm9ncmFtKz0iLXNpbWQiLGUuZmVhdHVyZXMuc2ltZD0hMCk6dC5fbG9nKGBXZWJBc3NlbWJseSBTSU1EIGlzIG5vdCBzdXBwb3J0ZWQgaW4gdGhpcyBicm93c2VyOyB3aWxsIGxvYWQgbm9uLVNJTUQgdmVyc2lvbiBvZiAke2UucHJvZ3JhbX0uYCkpKSxlLmlzQmFzZU1vZHVsZSYmKGUubG9hZGluZz1rKSxlLmxvYWRpbmc9PT14KXt0Ll9sb2coYFdpbGwgbGF6eS1sb2FkICR7ZS50b29sfTsgc2tpcHBpbmcgaW5pdGlhbGl6YXRpb24uYCk7cmV0dXJufXNlbGYuaW1wb3J0U2NyaXB0cyhgJHtlLnVybFByZWZpeH0vJHtlLnByb2dyYW19LmpzYCksZS5tb2R1bGU9YXdhaXQgTW9kdWxlKHt0aGlzUHJvZ3JhbTplLnByb2dyYW0sbG9jYXRlRmlsZTooaSxzKT0+YCR7ZS51cmxQcmVmaXh9LyR7aX1gLHN0ZGluOigpPT50Ll9zdGRpblB0cjx0LnN0ZGluLmxlbmd0aD90LnN0ZGluLmNoYXJDb2RlQXQodC5fc3RkaW5QdHIrKyk6KHQuc3RkaW49IiIsbnVsbCkscHJpbnQ6aT0+e2Uuc3Rkb3V0Kz1pK2AKYCx0LmNvbmZpZy5wcmludFN0cmVhbSYmcG9zdE1lc3NhZ2Uoe3R5cGU6ImJpb3dhc20iLHZhbHVlOntzdGRvdXQ6aX19KX0scHJpbnRFcnI6aT0+e2NvbnN0IHM9dC5jb25maWcucHJpbnRJbnRlcmxlYXZlZD8ic3Rkb3V0Ijoic3RkZXJyIjtlW3NdKz1pK2AKYCx0LmNvbmZpZy5wcmludFN0cmVhbSYmcG9zdE1lc3NhZ2Uoe3R5cGU6ImJpb3dhc20iLHZhbHVlOntbc106aX19KX19KTtjb25zdCByPWUubW9kdWxlLkZTO2UuaXNCYXNlTW9kdWxlPyh0Ll9sb2coYFNldHRpbmcgdXAgJHtlLnRvb2x9IHdpdGggYmFzZSBtb2R1bGUgZmlsZXN5c3RlbS4uLmApLHIubWtkaXIodC5jb25maWcuZGlyU2hhcmVkLDUxMSksci5ta2RpcihgJHt0LmNvbmZpZy5kaXJTaGFyZWR9LyR7dC5jb25maWcuZGlyRGF0YX1gLDUxMSksci5ta2RpcihgJHt0LmNvbmZpZy5kaXJTaGFyZWR9LyR7dC5jb25maWcuZGlyTW91bnRlZH1gLDUxMSksci5jaGRpcihgJHt0LmNvbmZpZy5kaXJTaGFyZWR9LyR7dC5jb25maWcuZGlyRGF0YX1gKSx0LmZzPXIpOih0Ll9sb2coYFNldHRpbmcgdXAgJHtlLnRvb2x9IHdpdGggZmlsZXN5c3RlbS4uLmApLHIubWtkaXIodC5jb25maWcuZGlyU2hhcmVkKSxyLm1vdW50KGUubW9kdWxlLlBST1hZRlMse3Jvb3Q6dC5jb25maWcuZGlyU2hhcmVkLGZzOnQuZnN9LHQuY29uZmlnLmRpclNoYXJlZCksci5jaGRpcih0LmZzLmN3ZCgpKSksZS5zdGRvdXQ9IiIsZS5zdGRlcnI9IiIsZS5yZWFkeT0hMH0sYXN5bmMgX3NldHVwRlMoKXtjb25zdCBlPXQuZnM7Zm9yKGxldCByIG9mIHQudG9vbHMpe2lmKCFyLnJlYWR5KWNvbnRpbnVlO2NvbnN0IGk9ci5tb2R1bGUuRlMscz1gLyR7ci50b29sfWAsbz1gJHt0LmNvbmZpZy5kaXJTaGFyZWR9JHtzfWA7IWkuYW5hbHl6ZVBhdGgocykuZXhpc3RzfHxlLmFuYWx5emVQYXRoKG8pLmV4aXN0c3x8KHQuX2xvZyhgTW91bnRpbmcgJHtzfSBvbnRvICR7dC5iYXNlLnRvb2x9IGZpbGVzeXN0ZW0gYXQgJHtvfWApLGUubWtkaXIobyksZS5tb3VudCh0LmJhc2UubW9kdWxlLlBST1hZRlMse3Jvb3Q6cyxmczppfSxvKSl9fSxfZmlsZW9wKGUscil7dC5fbG9nKGBSdW5uaW5nICR7ZX0gJHtyfWApO2NvbnN0IGk9dC5mcy5hbmFseXplUGF0aChyKTtpZighaS5leGlzdHMpcmV0dXJuIHQuX2xvZyhgRmlsZSAke3J9IG5vdCBmb3VuZC5gKSwhMTtzd2l0Y2goZSl7Y2FzZSJjYXQiOnJldHVybiB0LmZzLnJlYWRGaWxlKHIse2VuY29kaW5nOiJ1dGY4In0pO2Nhc2UibHMiOnJldHVybiB0LmZzLmlzRmlsZShpLm9iamVjdC5tb2RlKT90LmZzLnN0YXQocik6dC5mcy5yZWFkZGlyKHIpO2Nhc2UiZG93bmxvYWQiOmNvbnN0IHM9bmV3IEJsb2IoW3RoaXMuY2F0KHIpXSk7cmV0dXJuIFVSTC5jcmVhdGVPYmplY3RVUkwocyl9cmV0dXJuITF9LF9sb2coZSl7aWYoIXQuY29uZmlnLmRlYnVnKXJldHVybjtsZXQgcj1bLi4uYXJndW1lbnRzXTtyLnNoaWZ0KCksY29uc29sZS5sb2coYCVjW1dlYldvcmtlcl0lYyAke2V9YCwiZm9udC13ZWlnaHQ6Ym9sZCIsIiIsLi4ucil9fTt3KHQpfSkoKTsK",P=typeof window<"u"&&window.Blob&&new Blob([atob(_)],{type:"text/javascript;charset=utf-8"});function x(){const e=P&&(window.URL||window.webkitURL).createObjectURL(P);try{return e?new Worker(e):new Worker("data:application/javascript;base64,"+_)}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}const M={urlCDN:"https://biowasm.com/cdn/v3",urlCDNStg:"https://stg.biowasm.com/cdn/v3",dirShared:"/shared",dirMounted:"/mnt",dirData:"/data",printInterleaved:!0,printStream:!1,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({},M,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 x;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 N=n(3629);class L{static getAvailableScales(){return Object.entries(this.scales).map((([e,t])=>e))}static getScale(e){return(0,N.vA)(!(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 r=["NH2","COOH"];if(e.startsWith(r[0])){const n=r[0].length;(0,N.vA)("-"==e[n],`Wrong sequence format: ${r[0]} without following '-' in '${e}'.`),t=n}if(e.endsWith(r[1])){const t=r[1].length+1;(0,N.vA)("-"==e[n-t],`Wrong sequence format: ${r[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 r=0;r<t;++r){const t=e[r];(0,N.vA)(t in this.aa2num,`Unknown char '${t}' found in sequence '${e}'`),n[r]=this.encodeLettter(t)}return n}encodeLettter(e){return this.aa2num[e]}decode(e){let t="";for(let n=0;n<e.length;++n){const r=e[n];(0,N.vA)(r in this.num2aa,`Unknown code '${r}' found in vector '${e}'`),t+=this.num2aa[r]}return t}}var R=n(4139);const O="input.fa",k="result.fasta";class G extends Error{element;constructor(e,t){super(e.innerText,t),this.element=e}}function H(e){return e.reduce(((e,t,n)=>e+`>sample${n+1}\n${t}\n`),"")}async function D(e,t=!1,n="",r=null,s,o,l){let u=e.toList();t&&(u=u.map((e=>I.clean(e).replace(/\-/g,""))));const d=e.length;r??=i.Column.string("Clusters",d).init("0"),r.type!=i.COLUMN_TYPE.STRING&&(r=r.convertTo(i.TYPE.STRING)),r.compact();const h=r.categories,p=r.getRawData(),m=new Array(h.length),f=new Array(h.length);for(let e=0;e<d;++e){const t=p[e];(m[t]??=[]).push(u[e]),(f[t]??=[]).push(e)}U(f,h);const g=await new $(["base/1.0.0",{tool:"kalign",version:R.b9,reinit:!0}]),y=i.Column.string(n,d);for(let e=0;e<h.length;++e){const t=H(m[e]);await g.fs.writeFile(O,t);const n=`${void 0!==s?` --gpo ${s}`:""}${void 0!==o?` --gpe ${o}`:""}${void 0!==l?` --tgpe ${l}`:""}`,r=await g.exec(`kalign ${O} -f fasta -o ${k}${n}`);console.warn(r);const i=await g.cat(k);if(!i){const e=F(r,1);throw new Error(e)}const c=new a.m(i).sequencesArray,u=f[e];for(let e=0;e<c.length;++e)y.set(u[e],c[e])}const w=e.meta.units,b=e.getTag(c.gp.alphabet);return y.meta.units=w,y.setTag(c.gp.aligned,"SEQ.MSA"),y.setTag(c.gp.alphabet,b),y.semType=i.SEMTYPE.MACROMOLECULE,y}function F(e,t){const n=[],r=/^.+ERROR : (.+)$/gm;let i;for(;null!=(i=r.exec(e))&&(void 0===t||n.length<t);)n.push(i[1]);return n.join("\n")}function U(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=r.div([r.divText(`MSA analysis is not available on single sequence clusters #${n.length}:`),...o()(n).take(3).map((e=>{let i=t[e];return i.length>25&&(i=i.slice(0,25)+"..."),r.divText(`"${i}"${e<n.length-1?", ":"."}`)})).toArray(),...n.length>3?[r.divText("...")]:[]]);throw new G(e)}}},5437:(e,t,n)=>{"use strict";n.d(t,{Nk:()=>d,ZY:()=>h,GD:()=>m});var r=n(4328),i=n(6082),s=n(2003),o=function(e,t,n,r){return new(n||(n=Promise))((function(i,s){function o(e){try{c(r.next(e))}catch(e){s(e)}}function a(e){try{c(r.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))};function a(e){return o(this,void 0,void 0,(function*(){try{return yield e()}catch(e){throw console.error("Promise rejected"),new Error("Promise rejected")}}))}var c=n(608),l=n(4139),u=n(567);const d=new class{dcName="bio";async getDockerContainer(){return await r.dapi.docker.dockerContainers.filter(this.dcName).first()}},h=["mafft --auto","mafft","linsi","ginsi","einsi","fftns","fftnsi","nwns","nwnsi"],p=["AlignedSeq","AlignedSubpeptide","HELM","ID","PolymerID"];async function m(e,t,n="ginsi",r=1.53,o=0,u=null,h){const m=await d.getDockerContainer();if("started"!==m.status&&"checking"!==m.status)throw new Error("PepSeA container has not started yet");const g=e.length;u??=i.Column.int("Clusters",g).init(0),u.type!=i.COLUMN_TYPE.STRING&&(u=u.convertTo(i.TYPE.STRING));const y=u.categories,w=u.getRawData(),b=new Array(y.length),v=new Array(y.length);for(let t=0;t<g;++t){const n=w[t],r=y[n];if(""===r)continue;const i=y.indexOf(r),s=e.get(t);s&&((b[i]??=[]).push({ID:t.toString(),HELM:s}),(v[n]??=[]).push(t))}(0,c.aZ)(v,y);const A=new Array(g);for(const e of b){const t=(await a((()=>f(m.id,e,n,r,o,h)))).Alignment;for(const e of t)A[parseInt(e.ID)]=Object.entries(e).filter((e=>!p.includes(e[0]))).map((e=>"-"!==e[1]?e[1]:"")).join(l.J.SEPARATOR)}const E=i.Column.fromStrings(t,A);return E.meta.units=s.Hi.SEPARATOR,E.setTag(s.gp.separator,l.J.SEPARATOR),E.setTag(s.gp.aligned,"SEQ.MSA"),E.setTag(s.gp.alphabet,s.YI.UN),E.setTag(s.gp.alphabetIsMultichar,"true"),E.semType=i.SEMTYPE.MACROMOLECULE,E}async function f(e,t,n,i,s,o){const a={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t)},c=`/align?method=${n}&gap_open=${i}&gap_extend=${s}`;let l;if("fetchProxy"in r.dapi.docker.dockerContainers){const t=window.performance.now(),n=await r.dapi.docker.dockerContainers.fetchProxy(e,c,a),i=window.performance.now();u._package.logger.debug(`Bio: requestAlignedObjects() dockerContainers.fetchProxy(), ET: ${i-t} ms`);const s="application/json"===n.headers.get("content-type");if(!n.ok&&s){const e=await n.json(),t=e["pepsea-error"];if(t)throw new Error(`PepSeA error: ${t}`);const r=e["datagrok-error"];if(r)throw new Error(`Datagrok error: ${r}`);throw new Error(n.statusText)}if(!n.ok&&!s){const e=await n.text();throw new Error(`Error: ${e}`)}if(!s){const e=await n.text();throw new Error(`Error: PepSeA expected JSON response, got '${e}'.`)}l=await n.json()}else{const t=await r.dapi.docker.dockerContainers.request(e,c,a);if(!t)throw new Error("Empty response");l=JSON.parse(t);const n=l["pepsea-error"];if(n)throw new Error(`PepSeA error: ${n}`);const i=l["datagrok-error"];if(i)throw new Error(`Datagrok error: ${i}`)}if("pepsea-stderr"in l){const e=l["pepsea-stderr"];o?.warning(e)}return l}},3890:(e,t,n)=>{"use strict";n.d(t,{aS:()=>c,wz:()=>a}),n(6082),n(7389),n(4328);var r=n(1991),i=n.n(r),s=n(826);const o=60;function a(e,t,n=o,r="\n"){const i=s.GO.forColumn(t),a=[];for(let s=0;s<t.length;s++){const t=e.map((e=>e.get(s).toString())).join("|"),o=c(i.getSplitted(s),n);a.push(`>${t}${r}`);for(const e of o)a.push(`${e}${r}`)}return"".concat(...a)}function c(e,t=o){let n=0;const r=e.length,s=[];for(;n<r;){const r=i()(e.originals).slice(n,n+t).toArray(),o=r.map((e=>e.length>1?`[${e}]`:e)).reduce(((e,t)=>e+t),"");s.push(o),n+=r.length}return s}},8754:(e,t,n)=>{"use strict";n.d(t,{V:()=>u});var r=n(4328),i=n(7384),s=n(826),o=n(2003),a=n(6717),c=n(8312),l=n(966);async function u(e,t,n,u){let d;try{d=await(0,a.j)()}catch(e){return r.shell.warning('Transformation to atomic level requires package "Chem" installed.'),null}let h=null;if(n){const n=await(0,c.Q)(),r=s.GO.forColumn(t);let i,a,l;r.isHelm()?a=t:(l=t.name,t.name=`__${l}`,a=r.convert(o.Hi.HELM),a.name=l,e.columns.add(a,!1));try{i=await n.helmToAtomicLevel(a,!0,!0)}finally{a!==t&&(e.columns.remove(a.name),t.name=l)}e.columns.add(i.molCol),e.columns.add(i.molHighlightCol),h=i.molCol}else{if(!(0,l.V)(t,"To Atomic Level"))return null;const n=await(0,i.C4)(e,t,u);null!==n.col&&(e.columns.add(n.col,!0),h=n.col)}return h&&await r.data.detectSemanticTypes(e),h}},5785:(e,t,n)=>{"use strict";n.d(t,{k:()=>u});var r=n(4328),i=n(6082),s=n(8070),o=n(966),a=n(3077),c=n(4139),l=n(439);async function u(e,t){if(await(0,s.cb)(10),!(0,o.V)(t,"Sequence space"))return e;const n=(0,a.R)(t);n.name="splitToMonomers";const u=t.dataFrame;for(const e of n.columns)e.semType=c.uF.MONOMER,e.setTag(l.gp.alphabet,t.getTag(l.gp.alphabet));const d=/(\d+)(?: \((\d+)\))?/,h=e=>{d.lastIndex=0;const t=e.match(d);return t?`${t[1]} (${parseInt(t[2]??"0")+1})`:e};for(let e=0;e<n.columns.length;e++){const r=n.columns.byIndex(e);r.semType=c.uF.MONOMER,r.setTag(l.gp.alphabet,t.getTag(l.gp.alphabet));const i=100;let s=0;for(;u.columns.byName(r.name)&&s<i;)r.name=h(r.name),s++;u.columns.add(r)}await r.data.detectSemanticTypes(u);for(let e=0;e<n.columns.length;e++){const t=n.columns.byIndex(e);t.setTag(i.TAGS.CELL_RENDERER,"Monomer"),t.setTag(".use-as-filter","false")}return u}},4870:(e,t,n)=>{"use strict";function r(e,t){e.innerHTML="",e.append(t)}n.d(t,{K:()=>r}),n(4328),n(6082)},8047:(e,t,n)=>{"use strict";n.d(t,{VN:()=>p,n5:()=>c,Ue:()=>h,Tc:()=>d,eN:()=>m}),n(4328),n(7389);var r=n(6082),i=(n(1757),n(1991),n(1858),n(826),n(2003)),s=n(4326),o=n(2738);n(8070),n(7602);var a,c,l,u=n(2174);n(567),HTMLCanvasElement.prototype.getCursorPosition=function(e,t){const n=this.getBoundingClientRect();return new r.Point((e.clientX-n.left)*t,(e.clientY-n.top)*t)},r.Rect.prototype.contains=function(e,t){return this.left<=e&&e<=this.right&&this.top<=t&&t<=this.bottom};class d{rowCount;value;plotValue;valueList=null;valueIdx=0;bounds;constructor(e=0,t){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 h{pos;name;_label;get label(){return this._label?this._label:this.name}_freqs;sumRowCount=0;sumPlotValue;sumPlotValueForHeight;constructor(e,t,n,r){this.pos=e,this.name=t,this._freqs=n??{},r?.sumRowCount&&(this.sumRowCount=r.sumRowCount),r?.sumValueForHeight&&(this.sumPlotValue=r.sumValueForHeight),r?.label&&(this._label=r.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 d),t}aggregate(e){const t=function(e){return t=>{const n=function(e){let t;const n="agg";return t=e instanceof Float32Array?r.Column.fromFloat32Array(n,e):e instanceof Int32Array?r.Column.fromInt32Array(n,e):r.Column.fromList(r.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===s.fH.Entropy){const e=Object.keys(this._freqs).length,t=.01*this.sumPlotValue,n=t/e;for(const e of Object.values(this._freqs)){const r=(e.plotValue+n)/(this.sumPlotValue+t);this.sumPlotValueForHeight+=-r*Math.log2(r)}}else if(e===s.fH.full)for(const[e,t]of Object.entries(this._freqs)){const e=t.plotValue/this.sumPlotValue;this.sumPlotValueForHeight+=e}}calcScreen(e,t,n,i,a,c,l,u,d){const h=i===s.fH.Entropy?n*(a-this.sumPlotValueForHeight)/a:n;let p=d*u+(n-h-1);const m=Object.entries(this._freqs).sort(((e,t)=>e[0]!==o._S&&t[0]!==o._S?t[1].value-e[1].value:e[0]===o._S&&t[0]===o._S?0:e[0]===o._S?-1:1));for(const[n,i]of m){const n=h*i.plotValue/this.sumPlotValue;i.bounds=new r.Rect((e-t)*u*c,p,l*u,n),p+=n}}render(e,t,n,r,s){for(const[a,c]of Object.entries(this._freqs))if(a!==o._S){const o=(0,i.zS)(a,5),l=c.bounds,u=l.left;e.resetTransform(),e.strokeStyle="lightgray",e.lineWidth=1,e.rect(u,l.top,l.width,l.height),e.fillStyle=s.get(a)??s.get("other"),e.textAlign="left",e.font=t;const d=e.measureText(o);e.setTransform(l.width/d.width,0,0,l.height/r,u,l.top),e.fillText(o,0,-n)}}getMonomerAt(e,t){const n=Object.entries(this._freqs).find((([n,r])=>r.bounds.contains(e,t)));return n?n[0]:void 0}buildCompositionTable(e){if("-"in this._freqs)throw new Error("Unexpected monomer symbol '-'.");return(0,u.F)(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"}(a||(a={})),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"}(c||(c={})),s.Fo,function(e){e[e.None=0]="None",e[e.Render=1]="Render",e[e.Layout=1]="Layout",e[e.Freqs=2]="Freqs"}(l||(l={}));const p=new class{render=20};function m(e,t,n,r,i){let s=0,o=-1;for(;-1!=(o=n.findNext(o,!0));){const e=t.getSplitted(o),n=i.pos,a=n<e.length?e.getCanonical(n):null;null!==a&&a===r&&s++}return s}r.JsViewer},4577:(e,t,n)=>{"use strict";n.d(t,{O:()=>o,n:()=>s});var r=n(1858),i=n(567);class s{substructure;readOnly;constructor(e,t=!0){return this.substructure=e,this.readOnly=t,new Proxy(this,{set:(e,t,n)=>{if(i._package.logger.debug(`BioFilterProps.set ${t.toString()}( '${n}' )`),this.readOnly)throw new Error("Properties are immutable.");return e[t]=n,!0}})}}class o{onChanged=new r.Subject;_props;_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()}}},1687:(e,t,n)=>{"use strict";n.d(t,{_i:()=>S,AR:()=>T});var r=n(7389),i=n(6082),s=n(4328),o=n(1991),a=n.n(o),c=n(1858),l=n(2003),u=n(8070),d=n(826),h=n(7602),p=n(8115),m=n(4577),f=n(1757),g=n.n(f),y=n(9124),w=n(9192),b=n(4870),v=n(567);class A extends m.O{emptyProps=new m.n("");helmEditor;_filterPanel=r.div("",{style:{cursor:"pointer"}});logger;static viewerCounter=-1;viewerId=++A.viewerCounter;viewerToLog(){return`HelmBioFilter<${this.viewerId}>`}get type(){return"HelmBioFilter"}constructor(){super(),this.logger=v._package.logger}viewSubs=[];async detach(){await super.detach();for(const e of this.viewSubs)e.unsubscribe()}async attach(){this.viewerToLog();try{const e=await(0,y.b)();let t,n;this.helmEditor=e.createHelmWebEditor(),this.logger.warning("TEST: HelmBioFilter.init().sync() waitForElementInDom waiting..."),await r.tools.waitForElementInDom(this._filterPanel),this.logger.warning("TEST: HelmBioFilter.init().sync() waitForElementInDom ready"),this.updateFilterPanel(),this.viewSubs.push((0,c.fromEvent)(this._filterPanel,"click").subscribe((()=>{t=r.div(),n=e.createWebEditorApp(t,this.props.substructure),r.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 m.n(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(r.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,w.AP)(e);this.logger.error(t,void 0,n)}})))}catch(e){const[t,n]=(0,w.AP)(e),i=this._filterPanel;i.innerText="error",i.classList.add("d4-error"),r.tooltip.bind(i,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,b.K)(this._filterPanel,this.helmEditor.host),this.helmEditor.editor.setHelm(e),this.helmEditor.resizeEditor(t,n);else{const e=r.divText("Click to edit","helm-substructure-filter");(0,b.K)(this._filterPanel,e)}}async substructureSearch(e){const t=`${this.viewerToLog()}.substructureSearch( column = <${e.name}> )`;v._package.logger.debug(`${t}, start`);try{return await(0,u.cb)(10),await(0,p.if)(this.props.substructure,e)}finally{v._package.logger.debug(`${t}, end`)}}}const E="bio-substructure-filter";class C{props;filterId;dataFrameId;columnName;bitset;constructor(e,t,n,r,i){this.props=e,this.filterId=t,this.dataFrameId=n,this.columnName=r,this.bitset=i}}class T extends m.n{separator;constructor(e,t){super(e,!1),this.separator=t,this.readOnly=!0}}class S extends i.Filter{bioFilter=null;bitset=null;loader;notation=void 0;logger;filterSyncer;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.root=r.divV([]),this.loader=r.loader(),this.calculating=!1,this.filterSyncer=new h.g(this.logger=v._package.logger),new Proxy(this,{set:(e,t,n)=>(e[t]=n,!0)})}static filterCounter=-1;filterId=++S.filterCounter;filterToLog(){return`BioSubstructureFilter<${this.filterId}>`}viewSubs=[];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(i.SEMTYPE.MACROMOLECULE)),d.GO.forColumn(this.column),this.columnName??=this.column?.name,this.notation??=this.column?.meta.units,this.bioFilter=this.notation===l.Hi.FASTA?new _:this.notation===l.Hi.SEPARATOR?new P(this.column.getTag(l.gp.separator)):new A,this.root.appendChild(this.bioFilter.filterPanel),this.root.appendChild(this.loader),await this.bioFilter.attach(),this.viewSubs.push(i.debounce(this.bioFilter.onChanged,this.debounceTime).subscribe(this.bioFilterOnChangedDebounced.bind(this))),this.viewSubs.push(s.events.onResetFilterRequest.subscribe(this.grokEventsOnResetFilterRequest.bind(this))),this.viewSubs.push(s.events.onCustomEvent(E).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=i.toJs(e.props??{}))}))}fireFilterSync(){const e=`${this.filterToLog()}.fireFilterSync()`;v._package.logger.debug(`${e}, bioFilter = ${this.bioFilter?this.bioFilter.constructor.name:"null"}`+(this.bioFilter?`, props = ${JSON.stringify(this.bioFilter.saveProps())}`:"")),s.events.fireCustomEvent(E,new C(this.bioFilter.props,this.filterId,this.dataFrame.id,this.columnName,this.bitset))}bioFilterOnChangedDebounced(){if(!this.dataFrame)return;const e=`${this.filterToLog()}.bioFilterOnChangedDebounced()`;if(v._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{v._package.logger.debug(`${e}, before substructureSearch`),this.bitset=await(this.bioFilter?.substructureSearch(this.column)),v._package.logger.debug(`${e}, after substructureSearch`),this.calculating=!1,this.fireFilterSync(),this.dataFrame?.rows.requestFilter()}finally{this.calculating=!1,v._package.logger.debug(`${e}, end`)}}))}grokEventsOnResetFilterRequest(){const e=`${this.filterToLog()}.grokEventsOnResetFilterRequest()`;v._package.logger.debug(`${e}`),this.bioFilter?.resetFilter()}_onRendered=new c.Subject;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.cb)(10),await(0,u.PE)(this.onRendered,(()=>{this.logger.debug(`${n}, _onRendered event caught`)}),(()=>{this.invalidate(t)}),e,`${n} timeout`);const r=this.filterSyncer.resetErrors();if(r.length>0)throw r[0]}}class _ extends m.O{emptyProps=new m.n("");substructureInput;get type(){return"FastaBioFilter"}constructor(){super(),this.substructureInput=r.input.string("",{value:"",onValueChanged:e=>{window.setTimeout((()=>{this.props=new m.n(e),this._propsChanging||this.onChanged.next()}),0)},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,p.nI)(this.props.substructure,e)}async attach(){}async detach(){await super.detach()}}class P extends m.O{emptyProps=new T("",void 0);substructureInput;separatorInput;colSeparator="";get type(){return"SeparatorBioFilter"}constructor(e){super(),this.substructureInput=r.input.string("",{value:"",onValueChanged:e=>{this.props=new T(e,this.props.separator),this._propsChanging||this.onChanged.next()},placeholder:"Substructure"}),this.separatorInput=r.input.string("",{value:this.colSeparator=e,onValueChanged:e=>{const t=e||void 0;this.props=new T(this.props.substructure,t),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 r.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,p.nI)(this.substructure,e,this.colSeparator)}async attach(){}async detach(){await super.detach()}}},2174:(e,t,n)=>{"use strict";n.d(t,{F:()=>v});var r=n(7389),i=n(6082),s=(n(1991),n(2003),n(4152),n(5072)),o=n.n(s),a=n(7825),c=n.n(a),l=n(7659),u=n.n(l),d=n(5056),h=n.n(d),p=n(540),m=n.n(p),f=n(1113),g=n.n(f),y=n(5999),w={};w.styleTagTransform=g(),w.setAttributes=h(),w.insert=u().bind(null,"head"),w.domAPI=c(),w.insertStyleElement=m(),o()(y.A,w),y.A&&y.A.locals&&y.A.locals,n(826);var b=n(2738);function v(e,t){let n=0,s=null;for(const e of Object.values(t))n+=e,s=null===s?e:Math.max(s,e);const o=s/n,a=Object.assign({},...Array.from(Object.entries(t)).sort(((e,t)=>t[1]-e[1])).map((([t,s])=>{const a=s/n,c=e.get(t),l=r.div("",{classes:"macromolecule-cell-comp-analysis-bar"});l.style.width=50*a/o+"px",l.style.backgroundColor=c,b._S===t&&(l.style.borderWidth="1px",l.style.borderStyle="solid",l.style.borderColor=i.Color.toHtml(i.Color.lightGray));const u=b._S===t?"-":t,d=r.div(`${(100*a).toFixed(2)}%`),h=r.div([l,d],{classes:"macromolecule-cell-comp-analysis-value"});return{[u]:h}}))),c=r.tableFromMap(a);return Array.from(c.rows).forEach((e=>{const t=e.getElementsByClassName("macromolecule-cell-comp-analysis-bar")[0].style.backgroundColor;e.cells[0].style.color=t})),c}},1757:e=>{"use strict";e.exports=$},6082:e=>{"use strict";e.exports=DG},4328:e=>{"use strict";e.exports=grok},1858:e=>{"use strict";e.exports=rxjs},7389:e=>{"use strict";e.exports=ui},1991:e=>{"use strict";e.exports=wu},8343:(e,t,n)=>{"use strict";const{normalizeIPv6:r,normalizeIPv4:i,removeDotSegments:s,recomposeAuthority:o,normalizeComponentEncoding:a}=n(4834),c=n(343);function l(e,t,n,r){const i={};return r||(e=p(u(e,n),n),t=p(u(t,n),n)),!(n=n||{}).tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=s(t.path||""),i.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=s(t.path||""),i.query=t.query):(t.path?("/"===t.path.charAt(0)?i.path=s(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path:i.path="/"+t.path,i.path=s(i.path)),i.query=t.query):(i.path=e.path,void 0!==t.query?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function u(e,t){const n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},r=Object.assign({},t),i=[],a=c[(r.scheme||n.scheme||"").toLowerCase()];a&&a.serialize&&a.serialize(n,r),void 0!==n.path&&(r.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),void 0!==n.scheme&&(n.path=n.path.split("%3A").join(":")))),"suffix"!==r.reference&&n.scheme&&(i.push(n.scheme),i.push(":"));const l=o(n,r);if(void 0!==l&&("suffix"!==r.reference&&i.push("//"),i.push(l),n.path&&"/"!==n.path.charAt(0)&&i.push("/")),void 0!==n.path){let e=n.path;r.absolutePath||a&&a.absolutePath||(e=s(e)),void 0===l&&(e=e.replace(/^\/\//u,"/%2F")),i.push(e)}return void 0!==n.query&&(i.push("?"),i.push(n.query)),void 0!==n.fragment&&(i.push("#"),i.push(n.fragment)),i.join("")}const d=Array.from({length:127},((e,t)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(t)))),h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function p(e,t){const n=Object.assign({},t),s={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=-1!==e.indexOf("%");let a=!1;"suffix"===n.reference&&(e=(n.scheme?n.scheme+":":"")+"//"+e);const l=e.match(h);if(l){if(s.scheme=l[1],s.userinfo=l[3],s.host=l[4],s.port=parseInt(l[5],10),s.path=l[6]||"",s.query=l[7],s.fragment=l[8],isNaN(s.port)&&(s.port=l[5]),s.host){const e=i(s.host);if(!1===e.isIPV4){const t=r(e.host,{isIPV4:!1});s.host=t.host.toLowerCase(),a=t.isIPV6}else s.host=e.host,a=!0}void 0!==s.scheme||void 0!==s.userinfo||void 0!==s.host||void 0!==s.port||s.path||void 0!==s.query?void 0===s.scheme?s.reference="relative":void 0===s.fragment?s.reference="absolute":s.reference="uri":s.reference="same-document",n.reference&&"suffix"!==n.reference&&n.reference!==s.reference&&(s.error=s.error||"URI is not a "+n.reference+" reference.");const e=c[(n.scheme||s.scheme||"").toLowerCase()];if(!(n.unicodeSupport||e&&e.unicodeSupport)&&s.host&&(n.domainHost||e&&e.domainHost)&&!1===a&&function(e){let t=0;for(let n=0,r=e.length;n<r;++n)if(t=e.charCodeAt(n),t>126||d[t])return!0;return!1}(s.host))try{s.host=URL.domainToASCII(s.host.toLowerCase())}catch(e){s.error=s.error||"Host's domain name can not be converted to ASCII: "+e}(!e||e&&!e.skipNormalize)&&(o&&void 0!==s.scheme&&(s.scheme=unescape(s.scheme)),o&&void 0!==s.userinfo&&(s.userinfo=unescape(s.userinfo)),o&&void 0!==s.host&&(s.host=unescape(s.host)),void 0!==s.path&&s.path.length&&(s.path=escape(unescape(s.path))),void 0!==s.fragment&&s.fragment.length&&(s.fragment=encodeURI(decodeURIComponent(s.fragment)))),e&&e.parse&&e.parse(s,n)}else s.error=s.error||"URI can not be parsed.";return s}const m={SCHEMES:c,normalize:function(e,t){return"string"==typeof e?e=u(p(e,t),t):"object"==typeof e&&(e=p(u(e,t),t)),e},resolve:function(e,t,n){const r=Object.assign({scheme:"null"},n);return u(l(p(e,r),p(t,r),r,!0),{...r,skipEscape:!0})},resolveComponents:l,equal:function(e,t,n){return"string"==typeof e?(e=unescape(e),e=u(a(p(e,n),!0),{...n,skipEscape:!0})):"object"==typeof e&&(e=u(a(e,!0),{...n,skipEscape:!0})),"string"==typeof t?(t=unescape(t),t=u(a(p(t,n),!0),{...n,skipEscape:!0})):"object"==typeof t&&(t=u(a(t,!0),{...n,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:u,parse:p};e.exports=m,e.exports.default=m,e.exports.fastUri=m},343:e=>{"use strict";const t=/^[\da-f]{8}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{12}$/iu,n=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function r(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}function i(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function s(e){const t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}const o={scheme:"http",domainHost:!0,parse:i,serialize:s},a={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=r(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(r(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){const[t,n]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}},c={http:o,https:{scheme:"https",domainHost:o.domainHost,parse:i,serialize:s},ws:a,wss:{scheme:"wss",domainHost:a.domainHost,parse:a.parse,serialize:a.serialize},urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;const r=e.path.match(n);if(r){const n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];const i=`${n}:${t.nid||e.nid}`,s=c[i];e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){const n=t.scheme||e.scheme||"urn",r=e.nid.toLowerCase(),i=`${n}:${t.nid||r}`,s=c[i];s&&(e=s.serialize(e,t));const o=e,a=e.nss;return o.path=`${r||t.nid}:${a}`,t.skipEscape=!0,o},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,n){const r=e;return r.uuid=r.nss,r.nss=void 0,n.tolerant||r.uuid&&t.test(r.uuid)||(r.error=r.error||"UUID is not valid."),r},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};e.exports=c},4914:e=>{"use strict";e.exports={HEX:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15}}},4834:(e,t,n)=>{"use strict";const{HEX:r}=n(4914);function i(e){if(c(e,".")<3)return{host:e,isIPV4:!1};const t=e.match(/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/u)||[],[n]=t;return n?{host:a(n,"."),isIPV4:!0}:{host:e,isIPV4:!1}}function s(e,t=!1){let n="",i=!0;for(const t of e){if(void 0===r[t])return;"0"!==t&&!0===i&&(i=!1),i||(n+=t)}return t&&0===n.length&&(n="0"),n}function o(e,t={}){if(c(e,":")<2)return{host:e,isIPV6:!1};const n=function(e){let t=0;const n={error:!1,address:"",zone:""},r=[],i=[];let o=!1,a=!1,c=!1;function l(){if(i.length){if(!1===o){const e=s(i);if(void 0===e)return n.error=!0,!1;r.push(e)}i.length=0}return!0}for(let s=0;s<e.length;s++){const u=e[s];if("["!==u&&"]"!==u)if(":"!==u)if("%"===u){if(!l())break;o=!0}else i.push(u);else{if(!0===a&&(c=!0),!l())break;if(t++,r.push(":"),t>7){n.error=!0;break}s-1>=0&&":"===e[s-1]&&(a=!0)}}return i.length&&(o?n.zone=i.join(""):c?r.push(i.join("")):r.push(s(i))),n.address=r.join(""),n}(e);if(n.error)return{host:e,isIPV6:!1};{let e=n.address,t=n.address;return n.zone&&(e+="%"+n.zone,t+="%25"+n.zone),{host:e,escapedHost:t,isIPV6:!0}}}function a(e,t){let n="",r=!0;const i=e.length;for(let s=0;s<i;s++){const o=e[s];"0"===o&&r?(s+1<=i&&e[s+1]===t||s+1===i)&&(n+=o,r=!1):(r=o===t,n+=o)}return n}function c(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}const l=/^\.\.?\//u,u=/^\/\.(?:\/|$)/u,d=/^\/\.\.(?:\/|$)/u,h=/^\/?(?:.|\n)*?(?=\/|$)/u;e.exports={recomposeAuthority:function(e,t){const n=[];if(void 0!==e.userinfo&&(n.push(e.userinfo),n.push("@")),void 0!==e.host){let t=unescape(e.host);const r=i(t);if(r.isIPV4)t=r.host;else{const n=o(r.host,{isIPV4:!1});t=!0===n.isIPV6?`[${n.escapedHost}]`:e.host}n.push(t)}return"number"!=typeof e.port&&"string"!=typeof e.port||(n.push(":"),n.push(String(e.port))),n.length?n.join(""):void 0},normalizeComponentEncoding:function(e,t){const n=!0!==t?escape:unescape;return void 0!==e.scheme&&(e.scheme=n(e.scheme)),void 0!==e.userinfo&&(e.userinfo=n(e.userinfo)),void 0!==e.host&&(e.host=n(e.host)),void 0!==e.path&&(e.path=n(e.path)),void 0!==e.query&&(e.query=n(e.query)),void 0!==e.fragment&&(e.fragment=n(e.fragment)),e},removeDotSegments:function(e){const t=[];for(;e.length;)if(e.match(l))e=e.replace(l,"");else if(e.match(u))e=e.replace(u,"/");else if(e.match(d))e=e.replace(d,"/"),t.pop();else if("."===e||".."===e)e="";else{const n=e.match(h);if(!n)throw new Error("Unexpected dot segment condition");{const r=n[0];e=e.slice(r.length),t.push(r)}}return t.join("")},normalizeIPv4:i,normalizeIPv6:o,stringArrayToHexStripped:s}},3837: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}')},7216: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"}}}}')},8226: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"}}}')},518: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"}}}')},4588: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"}}}')},5707: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}}}')},9547: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"}}}')},7082: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":[]}}}')},1678: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}}}')},2079: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(r){var i=t[r];if(void 0!==i)return i.exports;var s=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(s.exports,s,s.exports,n),s.loaded=!0,s.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 r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},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&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var i=r.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=r[i--].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 r={};(()=>{"use strict";n.r(r),n.d(r,{_package:()=>_e,test:()=>Pe,tests:()=>t.CN});var e=n(6082),t=n(8070);(0,t.L1)("_first",(()=>{(0,t.t6)("_first",(async()=>{}))}));var i=n(8924),s=n(7362),o=n(1093);(0,t.L1)("Palettes",(()=>{(0,t.t6)("testPaletteN",(async()=>{await async function(){const e=o.A.Chromatogram;(0,t.E3)(e instanceof s.e,!0),(0,t.E3)(e instanceof o.A,!0)}()})),(0,t.t6)("testPaletteAA",(async()=>{await async function(){const e=i.X.Lesk,n=i.X.RasMol,r=i.X.GrokGroups;(0,t.E3)(e instanceof s.e,!0),(0,t.E3)(n instanceof s.e,!0),(0,t.E3)(r instanceof s.e,!0),(0,t.E3)(e instanceof i.X,!0),(0,t.E3)(n instanceof i.X,!0),(0,t.E3)(r instanceof i.X,!0)}()})),(0,t.t6)("testPalettePtMe",(async()=>{const e=i.X.GrokGroups.get("MeNle"),n=i.X.GrokGroups.get("MeA"),r=i.X.GrokGroups.get("MeG"),s=i.X.GrokGroups.get("MeF"),o=i.X.GrokGroups.get("L"),a=i.X.GrokGroups.get("A"),c=i.X.GrokGroups.get("G"),l=i.X.GrokGroups.get("F");(0,t.E3)(e,o),(0,t.E3)(n,a),(0,t.E3)(r,c),(0,t.E3)(s,l)}))}));var a=n(4328),c=n(567),l=n(2003),u=n(826);class d{units;aligned;alphabet;alphabetSize;alphabetIsMultichar;separator;constructor(e,t,n,r,i,s){this.units=e,this.aligned=t,this.alphabet=n,this.alphabetSize=r,this.alphabetIsMultichar=i,this.separator=s}}async function h(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 e=`Negative test detected semType='${n.semType}', units='${n.meta.units}'.`;throw new Error(e)}}async function p(t,n){const r=(await t()).getCol(n),i=await a.functions.call("Bio:detectMacromolecule",{col:r});if(i&&(r.semType=i),r.semType===e.SEMTYPE.MACROMOLECULE){const e=`Negative test detected semType='${r.semType}', units='${r.meta.units}'.`;throw new Error(e)}}async function m(n,r,i,s,o,c,d=null){const h=e.Column.fromList(e.TYPE.STRING,"seq",n),p=await a.functions.call("Bio:detectMacromolecule",{col:h});p&&(h.semType=p),(0,t.E3)(h.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(h.meta.units,r),(0,t.E3)(h.getTag(l.gp.aligned),i),(0,t.E3)(h.getTag(l.gp.alphabet),s),d&&(0,t.E3)(h.getTag(l.gp.separator),d);const m=u.GO.forColumn(h);(0,t.E3)(m.getAlphabetSize(),o),(0,t.E3)(m.getAlphabetIsMultichar(),c),m.isHelm()||((0,t.E3)(m.aligned,i),(0,t.E3)(m.alphabet,s))}async function f(n,r,i,s,o,c,d,h=null){const p=(await n()).col(r),m=await a.functions.call("Bio:detectMacromolecule",{col:p});m&&(p.semType=m),(0,t.E3)(p.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(p.meta.units,i),(0,t.E3)(p.getTag(l.gp.aligned),s),(0,t.E3)(p.getTag(l.gp.alphabet),o),h&&(0,t.E3)(p.getTag(l.gp.separator),h);const f=u.GO.forColumn(p);(0,t.E3)(f.getAlphabetSize(),c),(0,t.E3)(f.getAlphabetIsMultichar(),d),f.isHelm()||((0,t.E3)(f.aligned,s),(0,t.E3)(f.alphabet,o))}async function g(e,t){const n=await e(),r=[];for(const i of n.columns.names())if(i in t){const n=t[i];try{await f(e,i,n.units,n.aligned,n.alphabet,n.alphabetSize,n.alphabetIsMultichar,n.separator)}catch(e){const t=e.toString();r.push(`Positive col '${i}' failed: ${t}`)}}else try{await p(e,i)}catch(e){const t=e.toString();r.push(`Negative col '${i}' failed: ${t}`)}if(r.length>0)throw new Error(r.join("\n"))}(0,t.L1)("detectors",(()=>{const n={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"]},negSmilesWithSquareBrackets:{csv:"col1\nCl.c1ccc2nc3ccccc3cc2c1\nOc1cccc2cc3ccccc3cc12\n[SeH]c1ccc2ccccc2c1",neg:["col1"]},negFastaUnSingleChar:{csv:"col1\nAlanine\nCysteine\nAspartic acid\nGlutamic acid\nPhenylalanine",neg:["col1"]},fastaMsaSameLength:{csv:"seq\nFWPHEYFWPHEYYV\nYNRQWYVYNRQWYV\nMKPSEYVMKPSEYV",pos:{seq:new d(l.Hi.FASTA,"SEQ.MSA",l.YI.PT,20,!1,void 0)}},fastaExtSameLength:{csv:"seq\nFW[Ac]PHEYFWPH\nYN[Re]VYNRQWYV\n[Me]EYVMPS[Et]",pos:{seq:new d(l.Hi.FASTA,"SEQ",l.YI.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 d(l.Hi.FASTA,"SEQ.MSA",l.YI.UN,14,!0,void 0)}},fastaMsaExtManyMinus:{csv:"seq\n[D-Tic]-------[D-Tyr_Et][Tyr_ab-dehydroMe][dV][Cys_SEt]N[D-Orn][D-aThr]-[Phe_4Me]\n[Phe_2F]--------[Tyr_ab-dehydroMe][dV][Aca]N[D-Orn][D-aThr]-[Phe_4Me]\n[D-Tic]-[Hcy]QTWQ[Phe_4NH2][D-Tyr_Et][Tyr_ab-dehydroMe][dV][Cys_SEt]----[Phe_4Me]",pos:{seq:new d(l.Hi.FASTA,"SEQ.MSA",l.YI.UN,17,!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 d(l.Hi.SEPARATOR,"SEQ.MSA",l.YI.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 d(l.Hi.SEPARATOR,"SEQ",l.YI.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 d(l.Hi.HELM,null,null,19,void 0,void 0)}}};for(const[r,i]of Object.entries(n))(0,t.t6)(`csvData2-${r}`,(async()=>{const t=(s=r,async()=>{const t=n[s].csv,r=e.DataFrame.fromCsv(t);return await a.data.detectSemanticTypes(r),r});var s;for(const e of i.neg??[])await p(t,e);for(const[e,n]of Object.entries(i.pos??{}))await f(t,e,n.units,n.aligned,n.alphabet,n.alphabetSize,n.alphabetIsMultichar,n.separator)}));const r=new class{csvFastaDna1="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC";fastaRna1="seq\nACGUCACGUC\nCAGUGUCAGUGU\nUUCAACUUCAAC";fastaPt1="seq\nFWPHEY\nYNRQWYV\nMKPSEYV";fastaUn="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]";sepDna="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";sepRna="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";sepPt="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";sepUn1="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";sepUn2="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";sepMsaDna1="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";sepMsaUnWEmpty="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";sepComplex="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";fastaMsaDna1="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT";fastaMsaPt1="seq\nFWR-WYV-KHPFWR-WYV-KHP\nYNR-WYV-KHPYNR-WYV-KHP\nMWRSWY-CKHPMWRSWY-CKHP"},i={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"},s={};function o(e,t=c){return async()=>(e in s||(s[e]=(async()=>await t(i[e]))().catch((t=>{throw delete s[e],t}))),s[e])}async function c(t){const n=await a.dapi.files.readAsText(t);return e.DataFrame.fromCsv(n)}const u=t=>async()=>{const n=r[t],i=e.DataFrame.fromCsv(n);return await a.data.detectSemanticTypes(i),i};(0,t.t6)("NegativeStartEnd",(async()=>{await h(["START","END"])})),(0,t.t6)("NegativeStartEndIntermediate",(async()=>{await h(["START","END","INTERMEDIATE"])})),(0,t.t6)("FastaDna1",(async()=>{await f(u("csvFastaDna1"),"seq",l.Hi.FASTA,"SEQ",l.YI.DNA,4,!1)})),(0,t.t6)("FastaRna1",(async()=>{await f(u("fastaRna1"),"seq",l.Hi.FASTA,"SEQ",l.YI.RNA,4,!1)})),(0,t.t6)("FastaPt1",(async()=>{await f(u("fastaPt1"),"seq",l.Hi.FASTA,"SEQ",l.YI.PT,20,!1)})),(0,t.t6)("FastaPtGaps",(()=>m(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEYV"],l.Hi.FASTA,"SEQ",l.YI.PT,20,!1))),(0,t.t6)("FastaPtGapsMsa",(()=>m(["FW-PH-EYY","FYNRQWYV-","FKP-Q-SEY"],l.Hi.FASTA,"SEQ.MSA",l.YI.PT,20,!1))),(0,t.t6)("FastaUn",(async()=>{await f(u("fastaUn"),"seq",l.Hi.FASTA,"SEQ.MSA",l.YI.UN,12,!0)})),(0,t.t6)("FastaMsaDna1",(async()=>{await f(u("fastaMsaDna1"),"seq",l.Hi.FASTA,"SEQ.MSA",l.YI.DNA,4,!1)})),(0,t.t6)("FastaMsaPt1",(async()=>{await f(u("fastaMsaPt1"),"seq",l.Hi.FASTA,"SEQ.MSA",l.YI.PT,20,!1)})),(0,t.t6)("SepDna",(async()=>{await f(u("sepDna"),"seq",l.Hi.SEPARATOR,"SEQ",l.YI.DNA,4,!1,"*")})),(0,t.t6)("SepRna",(async()=>{await f(u("sepRna"),"seq",l.Hi.SEPARATOR,"SEQ",l.YI.RNA,4,!1,"*")})),(0,t.t6)("SepPt",(async()=>{await f(u("sepPt"),"seq",l.Hi.SEPARATOR,"SEQ",l.YI.PT,20,!1,"-")})),(0,t.t6)("SepUn1",(async()=>{await f(u("sepUn1"),"seq",l.Hi.SEPARATOR,"SEQ",l.YI.UN,8,!0,"-")})),(0,t.t6)("SepUn2",(async()=>{await f(u("sepUn2"),"seq",l.Hi.SEPARATOR,"SEQ",l.YI.UN,9,!0,"/")})),(0,t.t6)("SepMsaN1",(async()=>{await f(u("sepMsaDna1"),"seq",l.Hi.SEPARATOR,"SEQ.MSA",l.YI.DNA,4,!1,"-")})),(0,t.t6)("SepMsaUnWEmpty",(async()=>{await f(u("sepMsaUnWEmpty"),"seq",l.Hi.SEPARATOR,"SEQ.MSA",l.YI.UN,14,!0)})),(0,t.t6)("SepComplex",(async()=>{await f(u("sepComplex"),"seq",l.Hi.SEPARATOR,"SEQ",l.YI.UN,18,!0)})),(0,t.t6)("samplesFastaCsv",(async()=>{await g(o("fastaCsv"),{Sequence:new d(l.Hi.FASTA,"SEQ",l.YI.PT,20,!1)})})),(0,t.t6)("samplesPeptidesComplex",(async()=>{await g(o("peptidesComplex"),{})})),(0,t.t6)("samplesMsaComplex",(async()=>{await g(o("msaComplex"),{MSA:new d(l.Hi.SEPARATOR,"SEQ.MSA",l.YI.UN,161,!0,"/")})})),(0,t.t6)("samplesIdCsv",(async()=>{await g(o("testIdCsv"),{})})),(0,t.t6)("samplesSarSmallCsv",(async()=>{await g(o("testSmilesCsv"),{})})),(0,t.t6)("samplesHelmCsv",(async()=>{await g(o("helmCsv"),{HELM:new d(l.Hi.HELM,null,null,160,!0)})})),(0,t.t6)("samplesTestHelmCsv",(async()=>{await g(o("testHelmCsv"),{"HELM string":new d(l.Hi.HELM,null,null,9,!0)})})),(0,t.t6)("samplesTestDemogCsv",(async()=>{await g(o("testDemogCsv"),{})})),(0,t.t6)("samplesTestSmiles2Csv",(async()=>{await g(o("testSmiles2Csv"),{})})),(0,t.t6)("samplesTestSmilesShort",(async()=>{await g(o("testSmilesShort"),{})})),(0,t.t6)("samplesTestActivityCliffsNegativeSmiles",(async()=>{await g(o("testActivityCliffsCsv"),{})})),(0,t.t6)("samplesFastaPtCsv",(async()=>{await g(o("fastaPtCsv"),{sequence:new d(l.Hi.FASTA,"SEQ",l.YI.PT,20,!1)})})),(0,t.t6)("samplesTestCerealCsv",(async()=>{await g(o("testCerealCsv"),{})})),(0,t.t6)("samplesTestUnichemSources",(async()=>{await g(o("testUnichemSources"),{})})),(0,t.t6)("samplesTestDmvOffices",(async()=>{await g(o("testDmvOffices"),{})})),(0,t.t6)("samplesTestAlertCollection",(async()=>{await g(o("testAlertCollection"),{})})),(0,t.t6)("samplesTestSpgi",(async()=>{await g(o("testSpgi"),{})})),(0,t.t6)("samplesTestSpgi100",(async()=>{await g(o("testSpgi100"),{})})),(0,t.t6)("samplesTestUrl",(async()=>{await g(o("testUrl"),{})}))})),(0,t.L1)("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"},r=t=>async()=>{const r=n[t],i=e.DataFrame.fromCsv(r);return await a.data.detectSemanticTypes(i),i};(0,t.t6)("fastaDnaWeak1",(async()=>{await p(r("fastaDnaWeak1"),"colName")})),(0,t.t6)("fastaDnaWeak1LikelyName",(async()=>{await f(r("fastaDnaWeak1LikelyName"),"seq",l.Hi.FASTA,"SEQ.MSA",l.YI.DNA,4,!1)})),(0,t.t6)("fastaRnaWeak1",(async()=>{await p(r("fastaRnaWeak1"),"colName")})),(0,t.t6)("fastaRnaWeak1LikelyName",(async()=>{await f(r("fastaRnaWeak1LikelyName"),"seq",l.Hi.FASTA,"SEQ.MSA",l.YI.RNA,4,!1)})),(0,t.t6)("fastaPtWeak1",(async()=>{await p(r("fastaPtWeak1"),"colName")})),(0,t.t6)("fastaPtWeak1LikelyName",(async()=>{await f(r("fastaPtWeak1LikelyName"),"seq",l.Hi.FASTA,"SEQ.MSA",l.YI.PT,20,!1)})),(0,t.t6)("fastaUn1",(async()=>{await p(r("fastaUn1"),"colName")})),(0,t.t6)("fastaUn1LikelyName",(async()=>{await p(r("fastaUn1LikelyName"),"seq")})),(0,t.t6)("fastaUn2LikelyName",(async()=>{await p(r("fastaUn2LikelyName"),"protein")})),(0,t.t6)("fastaUnMsa1LikelyName",(async()=>{await p(r("fastaUnMsa1LikelyName"),"seq")}))})),(0,t.L1)("detectorsBenchmark",(()=>{let n;async function r(r,s,o,a,c,d){return await async function(r){const h=await(async()=>{const t=function(t,n,r,i,s){let o;switch(t){case l.Hi.FASTA:o=e=>{let t="";for(let n=0;n<e.length;n++){const r=e[n];t+=1==r.length?r:`[${r}]`}return t};break;case l.Hi.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 r=0;r<t;r++)n[r]=e[Math.floor(Math.random()*e.length)];return o(n,s)},c=Array(i);for(let e=0;e<i;e++)c[e]=a(n,r);return e.Column.fromStrings("seq",c)}(s,[...(0,l.Qf)(o)],a,c,d),r=n.prepare({col:t});return i(r),r})(),p=Date.now(),m=i(h),f=Date.now();(function(e,n){const r=u.GO.forColumn(e);(0,t.E3)(e.semType===n.semType,!0),(0,t.E3)(r.notation===n.notation,!0),(0,t.E3)(r.alphabet===n.alphabet,!0),(0,t.E3)(r.separator===n.separator,!0)})(m,{semType:e.SEMTYPE.MACROMOLECULE,notation:s,alphabet:o,separator:d});const g=f-p;if(g>r){const e=`ET ${g} ms is more than max allowed ${r} ms.`;throw console.error(e),new Error(e)}return console.log(`ET ${g} ms is OK.`),g}(r)}function i(e){e.callSync();const t=e.getOutputParamValue(),n=e.inputs.col;return t&&(n.semType=t),n}(0,t.gM)((async()=>{const t=e.Func.find({package:"Bio",name:"detectMacromolecule"});n=t[0];const r=e.Column.fromStrings("seq",["ACGT","ACGT","ACGT"]);await n.prepare({col:r}).call()})),(0,t.t6)("fastaDnaShorts50Few50",(async()=>{await r(10,l.Hi.FASTA,l.YI.DNA,50,50)})),(0,t.t6)("fastaDnaShorts50Many1E6",(async()=>{await r(20,l.Hi.FASTA,l.YI.DNA,50,1e6)})),(0,t.t6)("fastaDnaLong1e6Few50",(async()=>{await r(20,l.Hi.FASTA,l.YI.DNA,1e6,50)})),(0,t.t6)("separatorDnaShorts50Few50",(async()=>{await r(10,l.Hi.SEPARATOR,l.YI.DNA,50,50,"/")})),(0,t.t6)("separatorDnaShorts50Many1E6",(async()=>{await r(20,l.Hi.SEPARATOR,l.YI.DNA,50,1e6,"/")})),(0,t.t6)("separatorDnaLong1e6Few50",(async()=>{await r(20,l.Hi.SEPARATOR,l.YI.DNA,1e6,50,"/")}))}));var y=n(608),w=n(1619),b=n(6740);async function v(n,r){const i=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(i);const s=e.DataFrame.fromCsv(r),o=i.getCol("seq");(0,t.E3)(o.semType,e.SEMTYPE.MACROMOLECULE);const c=s.getCol("seq"),l=await(0,y.eE)(o,!0);(0,t.J6)(l.toList(),c.toList())}async function A(n,r,i,s,o,c){const u=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(u);const d=e.DataFrame.fromCsv(r).getCol("seq"),h=u.getCol("seq");(0,t.E3)(h.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(h.meta.units,i),o&&(0,t.E3)(h.getTag(l.gp.alphabet),o);const p=await(0,w.D)({col:h,pepsea:{method:c}});(0,t.E3)(p.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(p.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(p.meta.units,s),(0,t.E3)(p.getTag(l.gp.aligned),"SEQ.MSA"),o&&(0,t.E3)(p.getTag(l.gp.alphabet),o),(0,t.J6)(p.toList(),d.toList())}(0,t.L1)("MSA",(async()=>{(0,t.t6)("isCorrect",(async()=>{await v("seq\nFWRWYVKHP\nYNRWYVKHP\nMWRSWYCKHP","seq\nFWR-WYVKHP\nYNR-WYVKHP\nMWRSWYCKHP")})),(0,t.t6)("isCorrectLong",(async()=>{await v("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.t6)("isCorrectHelm",(async()=>{await(0,b.m8)(),await A("seq\n PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2}$$$$\n PEPTIDE1{meI.Aca.N.T.dE.Thr_PO3H2}$$$$\n PEPTIDE1{hHis.Aca.N.T.dE.Thr_PO3H2}$$$$","seq\n meI.hHis.Aca.N.T.dE.Thr_PO3H2\n .meI.Aca.N.T.dE.Thr_PO3H2\n .hHis.Aca.N.T.dE.Thr_PO3H2",l.Hi.HELM,l.Hi.SEPARATOR,void 0,"mafft")}),{timeout:6e4}),(0,t.t6)("isCorrectHelmLong",(async()=>{await(0,b.m8)(),await A("seq\n PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.dV.E.N.D-Orn.D-aThr.Phe_4Me.Thr_PO3H2}$$$$\n PEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Tyr_PO3H2.D-Chg.dV.Phe_ab-dehydro.N.D-Orn.D-aThr.Phe_4Me}$$$$\n PEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me}$$$$","seq\n meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D-Tyr_Et.dV.E.N.D-Orn.D-aThr.Phe_4Me.Thr_PO3H2\n meI.hHis.Aca.Cys_SEt.T.dK..Tyr_PO3H2.D-Chg.dV.Phe_ab-dehydro.N.D-Orn.D-aThr.Phe_4Me.\n Lys_Boc.hHis.Aca.Cys_SEt.T.dK..Tyr_PO3H2.D-Chg.dV.Thr_PO3H2.N.D-Orn.D-aThr.Phe_4Me.",l.Hi.HELM,l.Hi.SEPARATOR,void 0,"mafft")}),{timeout:6e4}),(0,t.t6)("isCorrectSeparator",(async()=>{await A("seq\n F-W-P-H-E-Y\n Y-N-R-Q-W-Y-V\n M-K-P-S-E-Y-V","seq\n FWPHEY-\n YNRQWYV\n MKPSEYV",l.Hi.SEPARATOR,l.Hi.FASTA,l.YI.PT)})),(0,t.t6)("isCorrectSeparatorLong",(async()=>{await A("seq\n M-I-E-V-F-L-F-G-I-V-L-G-L-I-P-I-T-L-A-G-L-F-V-T-A-Y-L-Q-Y-R-R-G-D-Q-L-D-L\n M-M-E-L-V-L-K-T-I-I-G-P-I-V-V-G-V-V-L-R-I-V-D-K-W-L-N-K-D-K\n M-D-R-T-D-E-V-S-N-H-T-H-D-K-P-T-L-T-W-F-E-E-I-F-E-E-Y-H-S-P-F-H-N","seq\n MIEV-FLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL\n MMEL-VLKTII-GPIVVGVVLRIVDKWLNKDK------\n MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN-----",l.Hi.SEPARATOR,l.Hi.FASTA,l.YI.PT)}))}));var E=n(1991),C=n.n(E),T=n(5785),S=n(6642);async function _(t){const n=await async function(e){return await _e.files.readAsText(e)}(t),r=e.DataFrame.fromCsv(n);return r.name=t.replace(".csv",""),r}async function P(e,n=5e3){await(0,t.cb)(0),await(0,t.PE)(e.onAfterDrawContent,(()=>{}),(()=>{e.invalidate()}),n);const r=e.columns.length;for(let t=0;t<r;++t){const n=e.columns.byIndex(t);if(n){const t=e.cell(n.name,0),[r,o,a]=(0,S.h)(t),c=(void 0,(s=i=a.rendererBack)&&void 0!==s.onRendered&&void 0!==s.invalidate&&void 0!==s.awaitRendered?i:null);c&&await c.awaitRendered()}}var i,s}var x=n(4139),M=n(9322);async function $(e,n){const r=(0,l.J9)(e);console.debug(`Bio: tests: splitters: src=${JSON.stringify(e)}, res=${JSON.stringify(r)} .`),(0,t.J6)(C()(r.originals).toArray(),n)}async function N(e,n){const r=(0,M.qp)(e);console.debug(`Bio: tests: splitters: src=${JSON.stringify(e)}, res=${JSON.stringify(r)} .`),(0,t.J6)(C()(r.originals).toArray(),n)}(0,t.L1)("splitters",(async()=>{(0,t.gM)((async()=>{})),(0,t.Pl)((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"]],r=["[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"]],i=["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"]],s=["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)"]],d=["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.t6)("fastaMulti",(async()=>{await $(n[0],n[1])})),(0,t.t6)("fastaFromHelm",(async()=>{await $(r[0],r[1])})),(0,t.t6)("helm1",(async()=>{await N(i[0],i[1])})),(0,t.t6)("helm2",(async()=>{await N(s[0],s[1])})),(0,t.t6)("helm3-multichar",(async()=>{await N(o[0],o[1])})),(0,t.t6)("testHelm1",(async()=>{await N(u[0],u[1])})),(0,t.t6)("testHelm2",(async()=>{await N(d[0],d[1])})),(0,t.t6)("testHelm3",(async()=>{await N(h[0],h[1])})),(0,t.t6)("splitToMonomers",(async()=>{const e=await a.dapi.files.readCsv("System:AppData/Bio/samples/MSA.csv"),n=e.getCol("MSA"),r=await a.functions.call("Bio:detectMacromolecule",{col:n});r&&(n.semType=r),n.setTag(l.gp.aligned,x.gN);const i=await(0,T.k)(e,n);(0,t.E3)(i.columns.names().includes("17"),!0),await a.data.detectSemanticTypes(i);const s=a.shell.addTableView(i);await P(s.grid),(0,t.E3)(s.grid.dataFrame.id,e.id)})),(0,t.t6)("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"],r=t.getCol("HELM"),i=(0,c.getHelmMonomers)(r),s=n.filter((e=>!i.includes(e))),o=i.filter((e=>!n.includes(e)));if(s.length>0||o.length){const e=[];throw s.length>0&&e.push(`Missed monomers ${JSON.stringify(s)}.`),o.length>0&&e.push(`Unexpected monomers ${JSON.stringify(o)}.`),new Error(e.join(" "))}}))}));var L=n(6718),I=n(4356);const R={PEPTIDE:324,RNA:383,CHEM:0};(0,t.L1)("monomerLibraries",(()=>{let e,n=null;(0,t.gM)((async()=>{e=await(0,L.pj)(),n=(0,I.ub)()})),(0,t.Pl)((async()=>{await(0,I.Eu)(n)})),(0,t.t6)("default",(async()=>{await(0,I.Eu)({exclude:[],explicit:[],duplicateMonomerPreferences:{}}),await e.loadLibraries(!0);const n=e.getMonomerLib();(0,t.E3)(n.getPolymerTypes().length>0,!0)})),(0,t.t6)("forTests",(async()=>{await(0,I.yZ)(),await e.loadMonomerLib(!0),function(e){const n=R,r=e.getSummaryObj();for(const e in n)n[e]||delete n[e];for(const e in r)r[e]||delete r[e];if(0==Object.keys(n).length&&0!=Object.keys(r).length)throw new Error("Expected empty monomer lib, actual is not.");if(0!=Object.keys(n).length&&0==Object.keys(r).length)throw new Error("Expected non-empty monomer lib, actual is empty.");try{(0,t.Xk)(r,n),(0,t.Xk)(n,r)}catch(e){throw new Error(`Expected monomer lib ${JSON.stringify(n)} does not match actual ${JSON.stringify(r)}.`)}}(e.getMonomerLib())})),(0,t.t6)("empty",(async()=>{const n=await(0,I.ub)(),r=await e.getFileManager();let i=r.getValidLibraryPaths();0===i.length&&(i=await r.getValidLibraryPathsAsynchronously()),n.exclude=i,n.explicit=[],await(0,I.Eu)(n),await e.loadMonomerLib(!0);const s=e.getMonomerLib().getPolymerTypes();(0,t.E3)(0===s.length,!0)}))}));var O=n(7389),k=n(1757),G=n.n(k),H=n(1858),D=n(6873),F=n(5433);async function U(n,r){const i=n(),s=e.DataFrame.fromColumns(i);await a.data.detectSemanticTypes(s);const o=Date.now(),c=(s.columns.byName("MSA"),a.shell.addTableView(s));await P(c.grid),(0,t.E3)(c.grid.dataFrame.id,s.id);const l=Date.now()-o;console.log(`Performance test: ${r}: ${l}ms`)}(0,t.L1)("renderers",(()=>{(0,t.t6)("long sequence performance ",(async()=>{await U(D.dW,"Long sequences")})),(0,t.t6)("many sequence performance",(async()=>{await U(D.fD,"Many sequences")})),(0,t.t6)("rendererMacromoleculeFasta",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA.csv"),r=e.DataFrame.fromCsv(n),i=r.getCol("Sequence"),s=await a.functions.call("Bio:detectMacromolecule",{col:i});s&&(i.semType=s);const o=a.shell.addTableView(r);await a.data.detectSemanticTypes(r),await P(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id);const c=i.getTag(e.TAGS.CELL_RENDERER);(0,t.E3)(c,"sequence")}()})),(0,t.t6)("rendererMacromoleculeSeparator",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/SEPARATOR_PT.csv"),r=e.DataFrame.fromCsv(n),i=r.getCol("sequence"),s=await a.functions.call("Bio:detectMacromolecule",{col:i});s&&(i.semType=s);const o=a.shell.addTableView(r);await a.data.detectSemanticTypes(r),await P(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id);const c=i.getTag(e.TAGS.CELL_RENDERER);(0,t.E3)(c,"sequence")}()})),(0,t.t6)("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.meta.units=l.Hi.SEPARATOR,n.setTag(l.gp.separator,"/"),n.setTag(l.gp.aligned,"SEQ"),n.setTag(l.gp.alphabet,"UN"),n.setTag(l.gp.alphabetIsMultichar,"true"),n.semType=x.uF.MACROMOLECULE_DIFFERENCE;const r=e.DataFrame.fromColumns([n]),i=a.shell.addTableView(r);await a.data.detectSemanticTypes(r),await P(i.grid),(0,t.E3)(i.grid.dataFrame.id,r.id);const s=n.getTag(e.TAGS.CELL_RENDERER);(0,t.E3)(s,x.uF.MACROMOLECULE_DIFFERENCE)}()})),(0,t.t6)("afterMsa",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA.fasta"),r=(0,c.importFasta)(n)[0],i=r.getCol("sequence"),s=await a.functions.call("Bio:detectMacromolecule",{col:i});s&&(i.semType=s);const o=a.shell.addTableView(r);await a.data.detectSemanticTypes(r),console.log("Bio: tests/renderers/afterMsa, table view"),await P(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id),console.log(`Bio: tests/renderers/afterMsa, src before test semType="${i.semType}", units="${i.meta.units}", cell.renderer="${i.getTag(e.TAGS.CELL_RENDERER)}"`),(0,t.E3)(i.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(i.meta.units,l.Hi.FASTA),(0,t.E3)(i.getTag(l.gp.aligned),"SEQ"),(0,t.E3)(i.getTag(l.gp.alphabet),l.YI.PT),(0,t.E3)(i.getTag(e.TAGS.CELL_RENDERER),"sequence");const d=await(0,w.D)({col:i});await P(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id),(0,t.E3)(d.semType,e.SEMTYPE.MACROMOLECULE),(0,t.E3)(d.meta.units,l.Hi.FASTA),(0,t.E3)(d.getTag(l.gp.aligned),"SEQ.MSA"),(0,t.E3)(d.getTag(l.gp.alphabet),l.YI.PT),(0,t.E3)(d.getTag(e.TAGS.CELL_RENDERER),"sequence"),u.GO.forColumn(d)}()})),(0,t.t6)("afterConvert",(async()=>{await async function(){const n=await a.dapi.files.readAsText("System:AppData/Bio/samples/FASTA_PT.csv"),r=e.DataFrame.fromCsv(n),i=r.getCol("sequence"),s=await a.functions.call("Bio:detectMacromolecule",{col:i});s&&(i.semType=s);const o=a.shell.addTableView(r);await a.data.detectSemanticTypes(r);const c=await(0,F.r)(i,l.Hi.SEPARATOR,"/");await P(o.grid),(0,t.E3)(o.grid.dataFrame.id,r.id);const d=c.getTag(e.TAGS.CELL_RENDERER);(0,t.E3)(d,"sequence"),u.GO.forColumn(c)}()})),(0,t.t6)("afterConvertToHelm",(async()=>{await async function(){const n=await a.dapi.files.readCsv("System:AppData/Bio/samples/FASTA_PT.csv"),r=a.shell.addTableView(n);await P(r.grid);const i=n.getCol("sequence"),s=u.GO.forColumn(i).convert(l.Hi.HELM);n.columns.add(s),await P(r.grid),(0,t.E3)(s.getTag(e.TAGS.CELL_RENDERER),"helm")}()})),(0,t.t6)("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.meta.units=l.Hi.SEPARATOR,n.setTag(l.gp.separator,"/"),n.setTag(l.gp.aligned,"SEQ"),n.setTag(l.gp.alphabet,"UN"),n.setTag(l.gp.alphabetIsMultichar,"true"),n.semType=x.uF.MACROMOLECULE_DIFFERENCE;const r=e.DataFrame.fromColumns([n]);a.shell.addTableView(r),await(0,t.cb)(100);const i=n.getTag(e.TAGS.CELL_RENDERER);if("MacromoleculeDifference"!==i)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 '${i}' instead of correct 'MacromoleculeDifference'.`)}()})),(0,t.t6)("scatterPlotTooltip",(async()=>{await async function(){const r=e.DataFrame.fromCsv(n);r.currentRowIdx=0;const i=a.shell.addTableView(r),s=r.plot.scatter({x:"x",y:"y"});i.dockManager.dock(s,e.DOCK_TYPE.RIGHT,null),await Promise.all([(0,t.PE)(s.onAfterDrawScene,(()=>{}),(()=>{s.invalidateCanvas()}),1e3),P(i.grid,500)]);const o=s.root.getBoundingClientRect(),c=s.worldToScreen(1,0),l=new MouseEvent("mousemove",{cancelable:!0,bubbles:!0,view:window,button:0,clientX:o.left+c.x,clientY:o.top+c.y}),u=G()(s.root).find("canvas").get()[0];await(0,t.PE)((0,H.fromEvent)(u,"mousemove"),(()=>{_e.logger.debug(`Test: event, currentRowIdx=${r.currentRowIdx}`),(0,t.E3)(G()(O.tooltip.root).find("div table.d4-row-tooltip-table tr td canvas").length,1),(0,t.E3)(s.hitTest(c.x,c.y),1)}),(()=>{u.dispatchEvent(l)}),500),await P(i.grid,500)}()}));const n="seq,x,y\nACGGTGTCGT,0,0\nCGGTATCCCT,1,0\nCTCGGCATGC,2,0\n"}));var V=n(6882);(0,t.L1)("renderers: monomerPlacer",(()=>{let n,r;(0,t.gM)((async()=>{n=await(0,L.pj)(),r=await(0,I.ub)(),await(0,I.yZ)(),await n.awaitLoaded(),await n.loadMonomerLib(!0)})),(0,t.Pl)((async()=>{await(0,I.Eu)(r),await n.loadMonomerLib(!0)}));const i={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,r]of Object.entries(i))(0,t.t6)(`getPosition-${n}`,(async()=>{const t=e.DataFrame.fromCsv(r.csv);await a.data.detectSemanticTypes(t);const n=t.getCol("seq"),i=new V.J(null,n,_e.logger,3,(()=>({seqHandler:u.GO.forColumn(n),monomerCharWidth:7,separatorWidth:12,monomerToShort:l.zS}))),s=r.testList;for(let e=0;e<n.length;++e)i.getCellMonomerLengths(e,1e4);const o=[];for(const[e,t]of C().enumerate(s)){const t={pos:i.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.L1)("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[r,i]of Object.entries(n))(0,t.t6)("hitBounds-"+r,(async()=>{const n=(0,V.B)(e,i.x);(0,t.E3)(n,i.tgt)}))})),(0,t.L1)("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 r={[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}$$$$"},i=new Set(Object.values(l.gp));async function s(t){const n=r[t],i=e.DataFrame.fromCsv(n);return await a.data.detectSemanticTypes(i),i}function o(e,n){if(e===l.Hi.SEPARATOR&&!n)throw new Error(`Argument 'separator' is mandatory for target notation '${e.toString()}'.`);return function(r){const i=u.GO.forColumn(r).convert(e,n);return(0,t.E3)(i.meta.units,e),i}}async function c(e,n,r){const o=(await s(e)).getCol("seq"),a=n(o),c=(await s(r)).getCol("seq");(0,t.J6)(a.toList(),c.toList());const d=u.GO.forColumn(o),h=u.GO.forColumn(a);for(const[e,n]of Object.entries(c.tags)){if(!i.has(e)||d.notation===l.Hi.HELM&&[l.gp.alphabet,l.gp.alphabetIsMultichar].includes(e)||h.notation===l.Hi.HELM&&[l.gp.alphabet,l.gp.alphabetIsMultichar].includes(e))continue;const r=a.getTag(e);(0,t.E3)(r,n,`Tag '${e}' expected value '${n}' is not equal to actual '${r}'.`)}}(0,t.t6)("testFastaPtToSeparator",(async()=>{await c(n.fastaPt,o(l.Hi.SEPARATOR,"-"),n.separatorPt)})),(0,t.t6)("testFastaDnaToSeparator",(async()=>{await c(n.fastaDna,o(l.Hi.SEPARATOR,"/"),n.separatorDna)})),(0,t.t6)("testFastaRnaToSeparator",(async()=>{await c(n.fastaRna,o(l.Hi.SEPARATOR,"*"),n.separatorRna)})),(0,t.t6)("testFastaGapsToSeparator",(async()=>{await c(n.fastaGaps,o(l.Hi.SEPARATOR,"/"),n.separatorGaps)})),(0,t.t6)("testFastaUnToSeparator",(async()=>{await c(n.fastaUn,o(l.Hi.SEPARATOR,"-"),n.separatorUn)})),(0,t.t6)("testFastaPtToHelm",(async()=>{await c(n.fastaPt,o(l.Hi.HELM),n.helmPt)})),(0,t.t6)("testFastaDnaToHelm",(async()=>{await c(n.fastaDna,o(l.Hi.HELM),n.helmDna)})),(0,t.t6)("testFastaRnaToHelm",(async()=>{await c(n.fastaRna,o(l.Hi.HELM),n.helmRna)})),(0,t.t6)("testFastaGapsToHelm",(async()=>{await c(n.fastaGaps,o(l.Hi.HELM),n.helmGaps)})),(0,t.t6)("testSeparatorPtToFasta",(async()=>{await c(n.separatorPt,o(l.Hi.FASTA),n.fastaPt)})),(0,t.t6)("testSeparatorDnaToFasta",(async()=>{await c(n.separatorDna,o(l.Hi.FASTA),n.fastaDna)})),(0,t.t6)("testSeparatorRnaToFasta",(async()=>{await c(n.separatorRna,o(l.Hi.FASTA),n.fastaRna)})),(0,t.t6)("testSeparatorGapsToFasta",(async()=>{await c(n.separatorGaps,o(l.Hi.FASTA),n.fastaGaps)})),(0,t.t6)("testSeparatorUnToFasta",(async()=>{await c(n.separatorUn,o(l.Hi.FASTA),n.fastaUn)})),(0,t.t6)("testSeparatorPtToHelm",(async()=>{await c(n.separatorPt,o(l.Hi.HELM),n.helmPt)})),(0,t.t6)("testSeparatorDnaToHelm",(async()=>{await c(n.separatorDna,o(l.Hi.HELM),n.helmDna)})),(0,t.t6)("testSeparatorRnaToHelm",(async()=>{await c(n.separatorRna,o(l.Hi.HELM),n.helmRna)})),(0,t.t6)("testSeparatorGapsToHelm",(async()=>{await c(n.separatorGaps,o(l.Hi.HELM),n.helmGaps)})),(0,t.t6)("testHelmDnaToFasta",(async()=>{await c(n.helmDna,o(l.Hi.FASTA),n.fastaDna)})),(0,t.t6)("testHelmRnaToFasta",(async()=>{await c(n.helmRna,o(l.Hi.FASTA),n.fastaRna)})),(0,t.t6)("testHelmPtToFasta",(async()=>{await c(n.helmPt,o(l.Hi.FASTA),n.fastaPt)})),(0,t.t6)("testHelmUnToFasta",(async()=>{await c(n.helmUn,o(l.Hi.FASTA),n.fastaUn)})),(0,t.t6)("testHelmDnaToSeparator",(async()=>{await c(n.helmDna,o(l.Hi.SEPARATOR,"/"),n.separatorDna)})),(0,t.t6)("testHelmRnaToSeparator",(async()=>{await c(n.helmRna,o(l.Hi.SEPARATOR,"*"),n.separatorRna)})),(0,t.t6)("testHelmPtToSeparator",(async()=>{await c(n.helmPt,o(l.Hi.SEPARATOR,"-"),n.separatorPt)})),(0,t.t6)("testHelmUnToSeparator",(async()=>{await c(n.helmUn,o(l.Hi.SEPARATOR,"-"),n.separatorUn)})),(0,t.t6)("testHelmLoneRibose",(async()=>{await c(n.helmLoneRibose,o(l.Hi.FASTA),n.fastaRna)})),(0,t.t6)("testHelmLoneDeoxyribose",(async()=>{await c(n.helmLoneDeoxyribose,o(l.Hi.SEPARATOR,"/"),n.separatorDna)})),(0,t.t6)("testHelmLonePhosphorus",(async()=>{await c(n.helmLonePhosphorus,o(l.Hi.FASTA),n.fastaRna)}))}));var Y=n(3516);(0,t.L1)("fastaFileHandler",(()=>{const n=["description:1","description:2","description:3","description:4"],r=(e.Column.fromStrings("description",n),["MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW","MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL","MMELVLKTIIGPIVVGVVLRIVDKWLNKDK","MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN"]);function i(e){const i=new Y.m(e),s=i.descriptionsArray,o=i.sequencesArray;(0,t.J6)([s,o],[n,r])}(0,t.t6)("testNormalFormatting",(async()=>{i(">description:1\nMDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\n\n>description:2\nMIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL\n\n>description:3\nMMELVLKTIIGPIVVGVVLRIVDKWLNKDK\n\n>description:4\nMDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN\n")})),(0,t.t6)("testExtraSpaces",(async()=>{i(">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.t6)("testExtraNewlines",(async()=>{i(">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 B=n(3890);(0,t.L1)("fastaExport",(()=>{let n;!function(e){e.single="single",e.multi="multi"}(n||(n={}));const r={[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 i;!function(e){e.test1="test1",e.test2="test2"}(i||(i={}));const s={[i.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"},[i.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,i=10){const s=r[n].src,o=e.Column.fromStrings("src",[s]);o.semType=e.SEMTYPE.MACROMOLECULE,o.meta.units=l.Hi.FASTA;const a=u.GO.forColumn(o).getSplitted(0),c=(0,B.aS)(a,i),d=r[n].tgt;(0,t.J6)(c,d)}async function a(n){const r=e.DataFrame.fromCsv(n.srcCsv),i=r.getCol(n.seqCol);i.semType=e.SEMTYPE.MACROMOLECULE,i.meta.units=l.Hi.FASTA;const s=n.idCols.map((e=>r.getCol(e))),o=(0,B.wz)(s,i,n.lineWidth);(0,t.E3)(o,n.tgtFasta)}(0,t.t6)("wrapSequenceSingle",(async()=>{o(n.single,10)})),(0,t.t6)("wrapSequenceMulti",(async()=>{o(n.multi,10)})),(0,t.t6)("saveAsFastaTest1",(async()=>{a(s[i.test1])})),(0,t.t6)("saveAsFastaTest2",(async()=>{a(s[i.test2])}))}));var W=n(4152),j=n(2738);const K=j._S;(0,t.L1)("bio",(()=>{const n="seq\nACGTCT\nCAGTGT\nTTCAAC";(0,t.t6)("testGetStatsHelm1",(async()=>{const n=e.DataFrame.fromCsv("seq\nPEPTIDE1{meI}$$$$").getCol("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.meta.units=l.Hi.HELM;const r=(0,M.vZ)(n,1,l.qp);(0,t.Xk)(r.freq,{meI:1}),(0,t.E3)(r.sameLength,!0)})),(0,t.t6)("testGetStatsN1",(async()=>{await async function(n){const r=e.DataFrame.fromCsv(n).col("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=l.Hi.FASTA;const i=(0,M.vZ)(r,5,l.J9);(0,t.Xk)(i.freq,{A:4,C:5,G:3,T:6}),(0,t.E3)(i.sameLength,!0)}(n)})),(0,t.t6)("testGetAlphabetSimilarity",(async()=>{await async function(){const e={A:2041,C:3015,G:3015,T:2048,[K]:1e3},n=new Set(Object.keys(o.Q.Names)),r=(0,l.nq)(e,n);(0,t.E3)(r>.6,!0)}()})),(0,t.t6)("testPickupPaletteN1",(async()=>{await async function(n){const r=e.DataFrame.fromCsv(n).col("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=l.Hi.FASTA;const i=(0,l.SM)(r);(0,t.E3)(i instanceof o.A,!0)}(n)})),(0,t.t6)("testPickupPaletteN1e",(async()=>{await async function(){const n=e.DataFrame.fromCsv("seq\nACGTAT\nCAGTTG\nTTCG2C").col("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.meta.units=l.Hi.FASTA;const r=(0,l.SM)(n);(0,t.E3)(r instanceof o.A,!0)}()})),(0,t.t6)("testPickupPaletteAA1",(async()=>{await async function(){const n=e.DataFrame.fromCsv("seq\nFWPHEYV\nYNRQWYV\nMKPSEYV").col("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.meta.units=l.Hi.FASTA;const r=(0,l.SM)(n);(0,t.E3)(r instanceof i.X,!0)}()})),(0,t.t6)("testPickupPaletteX",(async()=>{await async function(){const n=e.DataFrame.fromCsv("seq\nXZJ{}2\n5Z4733\n3Z6></\n675687").col("seq");n.semType=e.SEMTYPE.MACROMOLECULE,n.meta.units=l.Hi.FASTA;const r=(0,l.SM)(n);(0,t.E3)(r instanceof W.$u,!0)}()}))})),(0,t.L1)("WebLogo.monomerToShort",(()=>{(0,t.t6)("longMonomerSingle",(async()=>{(0,t.E3)((0,l.zS)("S",5),"S")})),(0,t.t6)("longMonomerShort",(async()=>{(0,t.E3)((0,l.zS)("Short",5),"Short")})),(0,t.t6)("longMonomerLong56",(async()=>{(0,t.E3)((0,l.zS)("Long56",6),"Long56")})),(0,t.t6)("longMonomerComplexFirstPartShort",(async()=>{(0,t.E3)((0,l.zS)("Long-long",5),"Long…")})),(0,t.t6)("longMonomerComplexFirstPartLong56",(async()=>{(0,t.E3)((0,l.zS)("Long56-long",6),"Long5…")})),(0,t.t6)("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])),r=e.map((e=>e[1])),i=n.map((e=>(0,l.zS)(e,3)));(0,t.J6)(i,r)}))}));var q=n(8047);const Z=j._S;function z(e,n){(0,t.E3)(e.name,n.name),(0,t.J6)(e.getMonomers(),n.getMonomers());for(const r of e.getMonomers())(0,t.E3)(e.getFreq(r).rowCount,n.getFreq(r).rowCount)}(0,t.L1)("WebLogo-positions",(()=>{const n="seq\nATC-G-TTGC--\nATC-G-TTGC--\n-TC-G-TTGC--\n-TC-GCTTGC--\n-TC-GCTTGC--";(0,t.t6)("allPositions",(async()=>{const r=e.DataFrame.fromCsv(n),i=a.shell.addTableView(r),s=r.getCol("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.meta.units=l.Hi.FASTA,s.setTag(l.gp.alphabet,l.YI.DNA),s.setTag(l.gp.aligned,"SEQ.MSA");const o=await r.plot.fromType("WebLogo");await(0,t.PE)(o.onLayoutCalculated,(()=>{}),(()=>{i.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const c=o.positions,u=[new q.Ue(0,"1",{A:new q.Tc(2),[Z]:new q.Tc(3)}),new q.Ue(1,"2",{T:new q.Tc(5)}),new q.Ue(2,"3",{C:new q.Tc(5)}),new q.Ue(3,"4",{[Z]:new q.Tc(5)}),new q.Ue(4,"5",{G:new q.Tc(5)}),new q.Ue(5,"6",{[Z]:new q.Tc(3),C:new q.Tc(2)}),new q.Ue(6,"7",{T:new q.Tc(5)}),new q.Ue(7,"8",{T:new q.Tc(5)}),new q.Ue(8,"9",{G:new q.Tc(5)}),new q.Ue(9,"10",{C:new q.Tc(5)}),new q.Ue(10,"11",{[Z]:new q.Tc(5)}),new q.Ue(11,"12",{[Z]:new q.Tc(5)})];(0,t.E3)(c.length,u.length);for(let e=0;e<c.length;e++){(0,t.E3)(c[e].name,u[e].name);for(const n of c[e].getMonomers())(0,t.E3)(c[e].getFreq(n).rowCount,u[e].getFreq(n).rowCount)}await o.awaitRendered()})),(0,t.t6)("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-"),r=a.shell.addTableView(n),i=n.getCol("seq");i.semType=e.SEMTYPE.MACROMOLECULE,i.meta.units=l.Hi.FASTA,i.setTag(l.gp.alphabet,l.YI.DNA),i.setTag(l.gp.aligned,"SEQ"),n.filter.init((e=>e>2)),n.filter.fireChanged();const s=await n.plot.fromType("WebLogo",{shrinkEmptyTail:!0});await(0,t.PE)(s.onLayoutCalculated,(()=>{}),(()=>{r.dockManager.dock(s.root,e.DOCK_TYPE.DOWN)}),500);const o=s.positions,c=[new q.Ue(0,"1",{[Z]:new q.Tc(3)}),new q.Ue(1,"2",{T:new q.Tc(3)}),new q.Ue(2,"3",{[Z]:new q.Tc(3)}),new q.Ue(3,"4",{[Z]:new q.Tc(3)}),new q.Ue(4,"5",{C:new q.Tc(3)}),new q.Ue(5,"6",{[Z]:new q.Tc(2),C:new q.Tc(1)}),new q.Ue(6,"7",{G:new q.Tc(3)}),new q.Ue(7,"8",{T:new q.Tc(3)}),new q.Ue(8,"9",{[Z]:new q.Tc(3)})];(0,t.E3)(o.length,c.length);for(let e=0;e<o.length;e++){(0,t.E3)(o[e].name,c[e].name);for(const n of o[e].getMonomers())(0,t.E3)(o[e].getFreq(n).rowCount,c[e].getFreq(n).rowCount)}await s.awaitRendered()})),(0,t.t6)("positions with skipEmptyPositions option",(async()=>{const r=e.DataFrame.fromCsv(n),i=a.shell.addTableView(r),s=r.getCol("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.meta.units=l.Hi.FASTA,s.setTag(l.gp.alphabet,l.YI.DNA),s.setTag(l.gp.aligned,"SEQ.MSA");const o=await r.plot.fromType("WebLogo",{skipEmptyPositions:!0});await(0,t.PE)(o.onLayoutCalculated,(()=>{}),(()=>{i.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const c=o.positions,u=[new q.Ue(0,"1",{A:new q.Tc(2),[Z]:new q.Tc(3)}),new q.Ue(1,"2",{T:new q.Tc(5)}),new q.Ue(2,"3",{C:new q.Tc(5)}),new q.Ue(4,"5",{G:new q.Tc(5)}),new q.Ue(5,"6",{[Z]:new q.Tc(3),C:new q.Tc(2)}),new q.Ue(6,"7",{T:new q.Tc(5)}),new q.Ue(7,"8",{T:new q.Tc(5)}),new q.Ue(8,"9",{G:new q.Tc(5)}),new q.Ue(9,"10",{C:new q.Tc(5)})];(0,t.E3)(c.length,u.length);for(let e=0;e<c.length;e++)z(c[e],u[e]);await o.awaitRendered()})),(0,t.t6)("count sequences for monomer at position",(async()=>{const r=function(t,n,r){const i=e.DataFrame.fromCsv(t),s=i.getCol("seq");return s.semType=e.SEMTYPE.MACROMOLECULE,s.meta.units=n,s.setTag(l.gp.alphabet,r),s.setTag(l.gp.aligned,"SEQ.MSA"),i}(n,l.Hi.FASTA,l.YI.DNA),i=r.getCol("seq"),s=a.shell.addTableView(r),o=await r.plot.fromType("WebLogo",{startPositionName:"3",endPositionName:"7",skipEmptyPositions:!0});await(0,t.PE)(o.onLayoutCalculated,(()=>{}),(()=>{s.dockManager.dock(o.root,e.DOCK_TYPE.DOWN)}),500);const c=o.positions,d=[new q.Ue(2,"3",{C:new q.Tc(5)}),new q.Ue(4,"5",{G:new q.Tc(5)}),new q.Ue(5,"6",{[Z]:new q.Tc(3),C:new q.Tc(2)}),new q.Ue(6,"7",{T:new q.Tc(5)})];(0,t.E3)(c.length,d.length);for(let e=0;e<c.length;e++)z(c[e],d[e]);const h=c[1],p=u.GO.forColumn(i),m=(0,q.eN)(r,p,r.filter,"G",h);(0,t.E3)(m,5),await o.awaitRendered()})),(0,t.t6)("empty",(async()=>{const n=e.DataFrame.fromColumns([(()=>{const t=e.Column.fromStrings("seq",[]);return t.semType=e.SEMTYPE.MACROMOLECULE,t.meta.units=l.Hi.FASTA,t.setTag(l.gp.alphabet,l.YI.DNA),t})()]),r=a.shell.addTableView(n),i=await n.plot.fromType("WebLogo");await(0,t.PE)(i.onLayoutCalculated,(()=>{}),(()=>{r.dockManager.dock(i.root,e.DOCK_TYPE.DOWN)}),500),i.positions,await i.awaitRendered()}))})),(0,t.L1)("WebLogo-project",(()=>{(0,t.t6)("fasta",(async()=>{const n="Tests.Bio.WebLogo-project.fasta",r=await _e.files.readCsv("tests/filter_FASTA.csv"),i=r.name,s=r.getCol("fasta");await a.data.detectSemanticTypes(r);const o=a.shell.addTableView(r),c=await r.plot.fromType("WebLogo",{sequenceColumnName:s.name});o.dockManager.dock(c),await c.awaitRendered(),await P(o.grid),await async function(t,n,r,i){const s=e.Project.create(),o=r.saveLayout();s.name=t,s.addChild(n),s.addChild(o),await a.dapi.layouts.save(r.saveLayout()),await a.dapi.tables.uploadDataFrame(i),await a.dapi.tables.save(n),await a.dapi.projects.save(s)}(n,r.getTableInfo(),o,r),a.shell.closeAll(),await(0,t.cb)(500),await a.dapi.projects.open(n);const l=a.shell.getTableView(i),u=C()(l.viewers).toArray();(0,t.E3)(u.length,2),(0,t.E3)(u.filter((e=>"Grid"===e.type)).length,1);const d=u.find((e=>"WebLogo"===e.type));(0,t.E3)(!!d,!0),await P(o.grid),await d.awaitRendered()}),{skipReason:"depends on 1.18"})})),(0,t.L1)("WebLogo-layout",(()=>{(0,t.t6)("fasta",(async()=>{const e=await _e.files.readCsv("tests/filter_FASTA.csv"),n=e.getCol("fasta");await a.data.detectSemanticTypes(e);const r=a.shell.addTableView(e),i=await e.plot.fromType("WebLogo",{sequenceColumnName:n.name});r.dockManager.dock(i),await(0,t.cb)(2*q.VN.render),await i.awaitRendered(),await P(r.grid);const s=r.saveLayout();s.toJson(),r.loadLayout(s),await(0,t.cb)(2*q.VN.render),await i.awaitRendered(),await P(r.grid);const o=C()(r.viewers).toArray();(0,t.E3)(o.length,2),(0,t.E3)(o.filter((e=>"Grid"===e.type)).length,1),(0,t.E3)(o.filter((e=>"WebLogo"===e.type)).length,1)}))}));var X=n(966);function J(e,t){let n=null;for(const r of e.viewers)r.type===t&&(n=r);return n}(0,t.L1)("checkInputColumn",(()=>{const n="seq\nseq1,\nseq2,\nseq3,\nseq4";(0,t.t6)("testMsaPos",(async()=>{const r=e.DataFrame.fromCsv(n).getCol("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=l.Hi.FASTA,r.setTag(l.gp.alphabet,l.YI.DNA),r.setTag(l.gp.aligned,"SEQ");const[i,s]=(0,X.l)(r,"Test",[l.Hi.FASTA],[l.YI.DNA,l.YI.RNA,l.YI.PT]);(0,t.E3)(i,!0)})),(0,t.t6)("testMsaNegHelm",(async()=>{const r=e.DataFrame.fromCsv(n).getCol("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=l.Hi.HELM,r.setTag(l.gp.alphabetIsMultichar,"true");const[i,s]=(0,X.l)(r,"Test",[l.Hi.FASTA],[l.YI.DNA,l.YI.RNA,l.YI.PT]);(0,t.E3)(i,!1)})),(0,t.t6)("testMsaNegUN",(async()=>{const r=e.DataFrame.fromCsv(n).getCol("seq");r.semType=e.SEMTYPE.MACROMOLECULE,r.meta.units=l.Hi.FASTA,r.setTag(l.gp.alphabet,"UN"),r.setTag(l.gp.alphabetSize,"11"),r.setTag(l.gp.alphabetIsMultichar,"true"),r.setTag(l.gp.aligned,"SEQ");const[i,s]=(0,X.l)(r,"Test",[l.Hi.FASTA],[l.YI.DNA,l.YI.RNA,l.YI.PT]);(0,t.E3)(i,!1)})),(0,t.t6)("testGetActionFunctionMeta",(async()=>{e.Func.find({package:"Bio",name:"multipleSequenceAlignmentDialog"})[0].inputs.find((e=>"sequence"==e.name))}))})),(0,t.L1)("similarity/diversity",(async()=>{(0,t.t6)("similaritySearchViewer",(async()=>{await async function(){const n=await _e.files.readAsText("tests/sample_MSA_data.csv"),r=e.DataFrame.fromCsv(n);await a.data.detectSemanticTypes(r);const i=a.shell.addTableView(r),s=i.dataFrame.getCol("MSA");(0,t.E3)(s.semType,e.SEMTYPE.MACROMOLECULE);const o=await i.dataFrame.plot.fromType("Sequence Similarity Search");let c=!1;if(o.computeCompleted.subscribe((e=>{e&&(c=!0)})),i.dockManager.dock(o,e.DOCK_TYPE.RIGHT,null,"Similarity"),await o.renderPromise,await(0,t.bk)((()=>void 0!==J(i,"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(!c)throw new Error("The viewer has not compute completed.");const l=o;await(0,t.bk)((()=>0!==l.root.getElementsByClassName("d4-grid").length),"Sequence Similarity Search viewer grid has not been created",100);(0,t.E3)(l.fingerprint,"Morgan"),(0,t.E3)(l.distanceMetric,"Tanimoto"),(0,t.E3)(l.scores.get(0),e.FLOAT_NULL),(0,t.E3)(l.idxs.get(0),0),(0,t.E3)(l.molCol.get(0),"D-Tyr_Et/Tyr_ab-dehydroMe/dV/E/N/D-Orn/D-aThr//Phe_4Me"),(0,t.E3)(l.scores.get(1).toFixed(2),"0.73"),(0,t.E3)(l.idxs.get(1),4),(0,t.E3)(l.molCol.get(1),"Thr_PO3H2/Aca/D-Tyr_Et/Tyr_ab-dehydroMe/dV/Chg/N/D-Orn/D-aThr//Phe_4Me"),i.dataFrame.currentRowIdx=1,await(0,t.bk)((()=>1===l.targetMoleculeIdx),"Target molecule has not been changed",5e3),await(0,t.bk)((()=>"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"===l.molCol.get(0)),"Incorrect first similar molecule",5e3)}()})),(0,t.t6)("diversitySearchViewer",(async()=>{await async function(){const n=await _e.files.readAsText("tests/sample_MSA_data.csv"),r=e.DataFrame.fromCsv(n),i=a.shell.addTableView(r);await a.data.detectSemanticTypes(r);const s=i.dataFrame.getCol("MSA");(0,t.E3)(s.semType,e.SEMTYPE.MACROMOLECULE);const o=await i.dataFrame.plot.fromType("Sequence Diversity Search");let c=!1;if(o.computeCompleted.subscribe((e=>{e&&(c=!0)})),i.dockManager.dock(o,e.DOCK_TYPE.DOWN,null,"Diversity"),await o.renderPromise,await(0,t.bk)((()=>void 0!==J(i,"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(!c)throw new Error("The viewer has not compute completed.");const l=o;await(0,t.bk)((()=>0!==l.root.getElementsByClassName("d4-grid").length),"Sequence Diversity Search viewer grid has not been created",100),(0,t.E3)(l.fingerprint,"Morgan"),(0,t.E3)(l.distanceMetric,"Tanimoto"),(0,t.E3)(l.initialized,!0),(0,t.E3)(l.renderMolIds.length>0,!0)}()}))}));var Q=n(9124),ee=n(1687),te=n(4577);async function ne(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 ee._i;return n.attach(t),n.applyState({columnName:e}),n.column=t.col(e),n.columnName=e,n}(0,t.L1)("bio-substructure-filters",(async()=>{let n,r,i;(0,t.gM)((async()=>{n=await(0,Q.b)(),r=await(0,L.pj)(),i=await(0,I.ub)(),await(0,I.yZ)(),await r.loadMonomerLib(!0)})),(0,t.Pl)((async()=>{await(0,I.Eu)(i),await r.loadMonomerLib(!0)})),(0,t.t6)("fasta",(async()=>{const e=await _("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(e);const n=new ee._i;n.attach(e),await n.awaitRendered();try{(0,t.E3)(!!n.bioFilter,!0),(0,t.E3)(n.bioFilter.type,"FastaBioFilter");const r=n.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new te.n("MD")}),5e3,"testEvent onRowsFiltered"),(0,t.E3)(n.dataFrame.filter.trueCount,3),(0,t.E3)(n.dataFrame?.filter.toBinaryString(),"10010000100000")}finally{n.detach()}await n.awaitRendered()})),(0,t.t6)("separator",(async()=>{const e=await _("tests/filter_MSA.csv"),n=new ee._i;await a.data.detectSemanticTypes(e),n.attach(e),await n.awaitRendered();try{(0,t.E3)(!!n.bioFilter,!0),(0,t.E3)(n.bioFilter.type,"SeparatorBioFilter");const r=n.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new ee.AR("meI")}),5e3,"testEvent onRowsFiltered"),(0,t.E3)(n.dataFrame.filter.trueCount,7),(0,t.E3)(n.dataFrame.filter.get(2),!1),await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new ee.AR("/meI")}),5e3,"testEvent onRowsFiltered"),(0,t.E3)(n.dataFrame.filter.trueCount,0),await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{r.props=new ee.AR("meI-hHis","-")}),5e3,"testEvent onRowsFiltered"),(0,t.E3)(n.dataFrame.filter.trueCount,7),(0,t.E3)(n.dataFrame.filter.get(2),!1)}finally{n.detach()}await n.awaitRendered()})),(0,t.t6)("helm-dialog",(async()=>{const e="Bio tests: substructureFilters/helm-dialog",n=await _("tests/filter_HELM.csv");await a.data.detectSemanticTypes(n);const r=a.shell.addTableView(n);_e.logger.debug(`${e}, filter attaching.`);const i=new ee._i;i.attach(n);const s=O.dialog("Test filters").add(i.root).show();await i.awaitRendered();try{const s=i.bioFilter;(0,t.E3)(null!==i.bioFilter,!0,"bioFilter is not created"),_e.logger.debug(`${e}, filter 1 change awaiting...`),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{s.props=new te.n("PEPTIDE1{A.C}$$$$V2.0")}),2e4),_e.logger.debug(`${e}, filter 1 changed.`),(0,t.E3)(i.dataFrame.filter.trueCount,1),(0,t.E3)(i.dataFrame.filter.toBinaryString(),"0001"),_e.logger.debug(`${e}, filter 2 change awaiting...`),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{s.props=new te.n("PEPTIDE1{C}$$$$V2.0")}),2e4),await P(r.grid),_e.logger.debug(`${e}, filter 2 changed.`),(0,t.E3)(i.dataFrame.filter.trueCount,2),(0,t.E3)(i.dataFrame.filter.toBinaryString(),"1001")}finally{s.close()}await i.awaitRendered(),await(0,t.cb)(3e3)})),(0,t.t6)("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 P(t.grid)})),(0,t.t6)("sync-fasta",(async()=>{const e=await _e.files.readCsv("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(e);const n=await ne("fasta",e),r=await ne("fasta",e);await Promise.all([n.awaitRendered(),r.awaitRendered()]);try{(0,t.E3)(!!n.bioFilter,!0),(0,t.E3)(!!r.bioFilter,!0),(0,t.E3)(n.bioFilter.type,"FastaBioFilter"),(0,t.E3)(r.bioFilter.type,"FastaBioFilter");const i=n.bioFilter,s=r.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{i.props=new te.n("MD")}),1e4,"await onRowsFiltered"),(0,t.E3)(e.filter.trueCount,3),await n.awaitRendered(),(0,t.E3)(s.props.substructure,"MD")}finally{n.detach(),r.detach()}await Promise.all([n.awaitRendered(),r.awaitRendered()])})),(0,t.t6)("sync-msa",(async()=>{const e=await _e.files.readCsv("tests/filter_MSA.csv");await a.data.detectSemanticTypes(e);const n="hHis-Aca",r=await ne("MSA",e),i=await ne("MSA",e);await Promise.all([r.awaitRendered(),i.awaitRendered()]);try{(0,t.E3)(!!r.bioFilter,!0),(0,t.E3)(!!i.bioFilter,!0),(0,t.E3)(r.bioFilter.type,"SeparatorBioFilter"),(0,t.E3)(i.bioFilter.type,"SeparatorBioFilter");const s=r.bioFilter,o=i.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{s.props=new ee.AR(n,"-")}),1e4,"await onRowsFiltered"),(0,t.E3)(e.filter.trueCount,8),(0,t.E3)(o.props.substructure,n),(0,t.E3)(o.props.separator,"-")}finally{r.detach(),i.detach()}await Promise.all([r.awaitRendered(),i.awaitRendered()])})),(0,t.t6)("sync-helm",(async()=>{const e=await _e.files.readCsv("tests/filter_HELM.csv");await a.data.detectSemanticTypes(e);const n=a.shell.addTableView(e),r="PEPTIDE1{A.C}$$$$V2.0",i=await ne("HELM string",e),s=await ne("HELM string",e),o=O.dialog("Test filters").add(i.root).add(s.root).show();await Promise.all([i.awaitRendered(),s.awaitRendered()]);try{(0,t.E3)(!!i.bioFilter,!0),(0,t.E3)(!!s.bioFilter,!0),(0,t.E3)(i.bioFilter.type,"HelmBioFilter"),(0,t.E3)(s.bioFilter.type,"HelmBioFilter");const o=i.bioFilter,a=s.bioFilter;await(0,t.PE)(e.onRowsFiltered,(()=>{}),(()=>{o.props=new te.n(r)}),6e4,"await onRowsFiltered"),await P(n.grid),_e.logger.debug("Bio tests: substructureFilters/sync-helm, before changed event"),await(0,t.cb)(2*i.debounceTime),_e.logger.debug("Bio tests: substructureFilters/sync-helm, after changed event"),(0,t.E3)(e.filter.trueCount,1),await i.awaitRendered(),(0,t.E3)(a.props.substructure,r)}finally{i.detach(),s.detach(),o.close()}await Promise.all([i.awaitRendered(),s.awaitRendered()]),await P(n.grid),await(0,t.cb)(3e3)})),(0,t.t6)("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 r=a.shell.addTableView(n),i="seq1",s="CGGCTG",o=n.getCol("trueSeq1").toList(),c="seq2",l="GCATT",u=n.getCol("trueSeq2").toList(),d=[{type:"Bio:bioSubstructureFilter",columnName:i},{type:"Bio:bioSubstructureFilter",columnName:c}],h=await n.plot.fromType(e.VIEWER.FILTERS,{filters:d});r.dockManager.dock(h,e.DOCK_TYPE.LEFT),await(0,t.cb)(100),await P(r.grid);const p=h.filters[0],m=h.filters[1];(0,t.E3)(p.column.name,i),(0,t.E3)(m.column.name,c);const f=p.bioFilter,g=m.bioFilter;await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new te.n(s)}),1e3),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new te.n("")}),1e3,"testEvent onRowsFiltered on seq1"),(0,t.E3)(n.filter.trueCount,o.filter((e=>1===e)).length),(0,t.E3)(n.filter.toBinaryString(),o.map((e=>e.toString())).join("")),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new te.n("")}),1e3),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new te.n(l)}),1e3,"testEvent onRowsFiltered on seq2"),(0,t.E3)(n.filter.trueCount,u.filter((e=>1===e)).length),(0,t.E3)(n.filter.toBinaryString(),u.map((e=>e.toString())).join("")),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new te.n("")}),1e3),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new te.n("")}),1e3,"testEvent onRowsFiltered on neither"),(0,t.E3)(n.filter.trueCount,n.rowCount),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{f.props=new te.n(s)}),5e3),await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{g.props=new te.n(l)}),5e3,"testEvent onRowsFiltered on both");const y=C().count(0).take(n.rowCount).map((e=>o[e]*u[e])).toArray();(0,t.E3)(n.filter.trueCount,y.filter((e=>1===e)).length),(0,t.E3)(n.filter.toBinaryString(),y.map((e=>e.toString())).join("")),await Promise.all([p.awaitRendered(),m.awaitRendered(),P(r.grid)])})),(0,t.t6)("reset-fasta",(async()=>{const n=await _("tests/filter_FASTA.csv");await a.data.detectSemanticTypes(n);const r=a.shell.addTableView(n),i="MD",s=await n.plot.fromType(e.VIEWER.FILTERS,{filters:[{type:"Bio:bioSubstructureFilter",columnName:"fasta"}]});r.dockManager.dock(s,e.DOCK_TYPE.LEFT),await(0,t.cb)(100),await P(r.grid);const o=s.filters[0].bioFilter;await(0,t.PE)(n.onRowsFiltered,(()=>{}),(()=>{o.props=new te.n(i)}),1e3,"testEvent onRowsFiltered"),(0,t.E3)(n.filter.trueCount,3),(0,t.E3)(o.props.substructure,i),(0,t.E3)(o.substructureInput.value,i),G()(s.root).find('i[name="icon-arrow-rotate-left"]')[0].click(),await(0,t.cb)(100),await P(r.grid),(0,t.E3)(o.props.substructure,""),(0,t.E3)(o.substructureInput.value,"")})),(0,t.t6)("reopen",(async()=>{const n=await _e.files.readCsv("tests/filter_FASTA.csv"),r=a.shell.addTableView(n),i=[{type:"Bio:bioSubstructureFilter",columnName:"fasta"}],s=await n.plot.fromType(e.VIEWER.FILTERS,{filters:i});r.dockManager.dock(s,e.DOCK_TYPE.LEFT),await(0,t.cb)(100),await P(r.grid),s.close(),await P(r.grid);const o=await n.plot.fromType(e.VIEWER.FILTERS,{filters:i});r.dockManager.dock(o,e.DOCK_TYPE.LEFT),await(0,t.cb)(100),await P(r.grid)}))}));var re=n(5437);class ie{errorList=[];warningList=[];infoList=[];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(9192);(0,t.L1)("PepSeA",(()=>{(0,t.gM)((async()=>{await(0,b.m8)()})),(0,t.t6)("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'),r=await(0,re.GD)(n.getCol("HELM"),"msa(HELM)"),i=n.getCol("MSA");for(let e=0;e<r.length;++e)(0,t.E3)(r.get(e)==i.get(e),!0)}),{timeout:6e4,stressTest:!0}),(0,t.t6)("stderr",(async()=>{const n=new ie,r=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'),i=await(0,re.GD)(r.getCol("HELM"),"msa(HELM)",void 0,void 0,void 0,void 0,n),s=r.getCol("MSA");(0,t.J6)(i.toList(),s.toList()),(0,t.E3)(n.warningList[0].message,"Mis not found in Monomer Map\nMeF not found in Monomer Map\n")}),{timeout:6e4,stressTest:!0}),(0,t.t6)("error",(async()=>{const n=new ie;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,re.GD)(t.getCol("HELM"),"msa(HELM)",void 0,void 0,void 0,void 0,n)}catch(e){const[t,r]=(0,se.AP)(e);n.error(t,void 0,r)}(0,t.E3)(n.errorList[0].message,"PepSeA error: The pair (*,M) couldn't be found in the substitution matrix")}),{skipReason:"GROK-16699"})})),(0,t.L1)("viewers",(()=>{const n=e.Func.find({package:"Bio",tags:["viewer"]}).map((e=>e.friendlyName));for(const e of n)(0,t.t6)(e,(async()=>{const n=await _("samples/FASTA_DNA.csv");await(0,t.Bl)(e,n,{detectSemanticTypes:!0})}),{skipReason:{"Sequence Similarity Search":"GROK-13162","Sequence Diversity Search":"GROK-13162",WebLogo:"GROK-13162",VdRegions:"GROK-13162"}[e]})}));const oe="seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC",ae="seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT",ce="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 le;(0,t.L1)("SeqHandler",(()=>{async function n(t){const n=e.DataFrame.fromCsv(t);await a.data.detectSemanticTypes(n);const r=u.GO.forColumn(n.getCol("seq"));return[n,r]}(0,t.t6)("Seq-Fasta",(async()=>{const[e,r]=await n(oe);(0,t.E3)(r.notation,l.Hi.FASTA),(0,t.E3)(r.isMsa(),!1)})),(0,t.t6)("Seq-Fasta-MSA",(async()=>{const[e,r]=await n(ae);(0,t.E3)(r.notation,l.Hi.FASTA),(0,t.E3)(r.isMsa(),!0)})),(0,t.t6)("Seq-Fasta-units",(async()=>{const[e,r]=await n(oe);(0,t.E3)(r.notation,l.Hi.FASTA),(0,t.E3)(r.isMsa(),!1)})),(0,t.t6)("Seq-Fasta-MSA-units",(async()=>{const[e,r]=await n(ae);(0,t.E3)(r.notation,l.Hi.FASTA),(0,t.E3)(r.isMsa(),!0)})),(0,t.t6)("Seq-Helm",(async()=>{const[e,r]=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.E3)(r.notation,l.Hi.HELM),(0,t.E3)(r.isHelm(),!0)})),(0,t.t6)("Seq-UN",(async()=>{const[e,r]=await n(ce);(0,t.E3)(r.notation,l.Hi.SEPARATOR),(0,t.E3)(r.separator,"-"),(0,t.E3)(r.alphabet,l.YI.UN)})),(0,t.t6)("Seq-UN-auto",(async()=>{const[e,r]=await n(ce);(0,t.E3)(r.notation,l.Hi.SEPARATOR),(0,t.E3)(r.separator,"-"),(0,t.E3)(r.alphabet,l.YI.UN)})),(0,t.t6)("column-version",(async()=>{const n=e.DataFrame.fromCsv(oe);await a.data.detectSemanticTypes(n);const r=n.getCol("seq"),i=u.GO.forColumn(r),s=r.version,o=u.GO.forColumn(r),c=r.version;(0,t.E3)(s,c,"Unexpected column version changed"),(0,t.E3)(i,o,"Unexpected SeqHandler object changed"),n.rows.addNew(["TACCCCTTCAAC"]);const l=u.GO.forColumn(r),d=r.version;(0,t.E3)(c<d,!0,"Stalled column version on add row"),(0,t.E3)(o!==l,!0,"Stalled SeqHandler object on add row"),r.set(1,"CAGTGTCCCCGT");const h=u.GO.forColumn(r),p=r.version;(0,t.E3)(d<p,!0,"Stalled column version on change data"),(0,t.E3)(l!==h,!0,"Stalled SeqHandler object on change data"),r.setTag("testTag","testValue");const m=u.GO.forColumn(r),f=r.version;(0,t.E3)(p<f,!0,"Stalled column version on set tag"),(0,t.E3)(h!==m,!0,"Stalled SeqHandler object on set tag")}))})),function(e){e.fasta="fasta",e.fastaMsa="fastaMsa",e.separator="separator",e.separatorMsa="separatorMsa",e.helm="helm"}(le||(le={})),(0,t.L1)("SeqHandler",(()=>{u.b9[l.Hi.FASTA],u.b9[l.Hi.HELM];const n=u.b9[l.Hi.SEPARATOR],r={[le.fasta]:{src:{csv:"seq\nACGTCACGTC\nCAGTGTCAGTGT\nTTCAACTTCAAC"},tgt:{notation:l.Hi.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"]]}},[le.fastaMsa]:{src:{csv:"seq\nAC-GT-CTAC-GT-CT\nCAC-T-GTCAC-T-GT\nACCGTACTACCGTACT"},tgt:{notation:l.Hi.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"]]}},[le.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:l.Hi.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"]]}},[le.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:l.Hi.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]]}},[le.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:l.Hi.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,i]of Object.entries(r))(0,t.t6)(`splitted-${n}`,(async()=>{const n=e.DataFrame.fromCsv(i.src.csv).getCol("seq"),r=await a.functions.call("Bio:detectMacromolecule",{col:n});r&&(n.semType=r),(0,t.E3)(n.semType,e.SEMTYPE.MACROMOLECULE);const s=u.GO.forColumn(n);(0,t.E3)(s.notation,i.tgt.notation),(0,t.E3)(s.separator===i.tgt.separator,!0);const o=C().count(0).take(s.length).map((e=>C()(s.getSplitted(e).originals).toArray())).toArray();(0,t.J6)(o,i.tgt.splitted)}))})),(0,t.L1)("SeqHandler: getRegion",(()=>{const n={fastaDna:{srcCsv:"seq\nATTCGT\nACTGCTC\nATTCCGTA",startIdx:2,endIdx:4,tgtCsv:"seq\nTCG\nTGC\nTCC",units:l.Hi.FASTA,alphabet:l.YI.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:l.Hi.SEPARATOR,alphabet:l.YI.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:l.Hi.HELM,alphabet:null,positionNames:{tag:null,start:"4",end:"7"}}};for(const[r,i]of Object.entries(n))(0,t.t6)(`${r}-idx`,(async()=>{const n=e.DataFrame.fromCsv(i.srcCsv).getCol("seq"),r=await a.functions.call("Bio:detectMacromolecule",{col:n});r&&(n.semType=r);const s=u.GO.forColumn(n).getRegion(i.startIdx,i.endIdx,"regSeq"),o=e.DataFrame.fromCsv(i.tgtCsv).getCol("seq");(0,t.E3)(n.meta.units,i.units),(0,t.E3)(s.meta.units,i.units),(0,t.E3)(n.getTag(l.gp.alphabet),i.alphabet),(0,t.E3)(s.getTag(l.gp.alphabet),i.alphabet),(0,t.J6)(s.toList(),o.toList())})),i.positionNames&&(0,t.t6)(`${r}-positionNames`,(async()=>{const n=e.DataFrame.fromCsv(i.srcCsv).getCol("seq");i.positionNames.tag&&n.setTag(l.gp.positionNames,i.positionNames.tag);const r=await a.functions.call("Bio:detectMacromolecule",{col:n});r&&(n.semType=r);const s=await a.functions.call("Bio:getRegion",{sequence:n,start:i.positionNames.start,end:i.positionNames.end}),o=e.DataFrame.fromCsv(i.tgtCsv).getCol("seq");(0,t.E3)(n.meta.units,i.units),(0,t.E3)(s.meta.units,i.units),(0,t.E3)(n.getTag(l.gp.alphabet),i.alphabet),(0,t.E3)(s.getTag(l.gp.alphabet),i.alphabet),(0,t.J6)(s.toList(),o.toList())}))})),(0,t.L1)("SeqHandler: getHelm",(()=>{let n,r;(0,t.gM)((async()=>{n=await(0,L.pj)(),r=await(0,I.ub)(),await(0,I.yZ)(),await n.loadMonomerLib(!0)})),(0,t.Pl)((async()=>{await(0,I.Eu)(r),await n.loadMonomerLib(!0)}));const i={fasta:{src:{seq:"MDYKETMDYKET",notation:l.Hi.FASTA},tgt:{helm:"PEPTIDE1{M.D.Y.K.E.T.M.D.Y.K.E.T}$$$$"}},separator:{src:{seq:"M-D-Y-K-E-T-M-D-Y-K-E-T",notation:l.Hi.SEPARATOR,separator:"-"},tgt:{helm:"PEPTIDE1{M.D.Y.K.E.T.M.D.Y.K.E.T}$$$$"}},helm:{src:{seq:"PEPTIDE1{M.D.Y.K.E.T}$$$$",notation:l.Hi.HELM},tgt:{helm:"PEPTIDE1{M.D.Y.K.E.T}$$$$"}},"helm-cyclic":{src:{seq:"PEPTIDE1{M.D.Y.K.E.T}$PEPTIDE1,PEPTIDE1,6:R2-1:R1$$$V2.0",notation:l.Hi.HELM},tgt:{helm:"PEPTIDE1{M.D.Y.K.E.T}$PEPTIDE1,PEPTIDE1,6:R2-1:R1$$$V2.0"}}};for(const[e,n]of Object.entries(i))(0,t.t6)(e,(async()=>{await s(n.src.seq,n.src.notation,n.src.separator,n.tgt.helm)}));async function s(n,r,i,s){const o=e.Column.fromStrings("seq",[n]),c=e.DataFrame.fromColumns([o]);await a.data.detectSemanticTypes(c);const l=u.GO.forColumn(o),d=await l.getHelm(0,!1);(0,t.E3)(d,s)}}));var ue=n(7384),de=n(6717);const he=new e.FileSource("System:AppData/Bio"),pe={"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"}},me="molfile(sequence)";async function fe(e,t="seq",n){await(0,de.j)();const r=e.getCol(t),i=n.getMonomerLib(),s=await(0,ue.C4)(e,r,i);return s.warnings.length>0&&_e.logger.warning(`_toAtomicLevel() warnings ${s.warnings.join("\n")}`),s.col}function ge(e){return e.replaceAll("\r\n","\n").replace(/\n$/,"").split("\n").map((e=>e.trimEnd())).join("\n")}(0,t.L1)("toAtomicLevel",(async()=>{const n={},r={};let i,s,o;async function d(e,n){const r=e.getCol("sequence");await(0,c.toAtomicLevel)(e,r,!1);const i=e.getCol(me),s=n.getCol(me),o=C()(i.values()).map((e=>ge(e))).toArray(),a=C()(s.values()).map((e=>ge(e))).toArray();(0,t.J6)(o,a)}(0,t.gM)((async()=>{i=await(0,L.pj)(),s=await(0,I.ub)(),await(0,I.yZ)(),await i.loadMonomerLib(!0);for(const[t,i]of Object.entries(pe))i.inPath,n[t]=e.DataFrame.fromCsv((await he.readAsText(i.inPath)).replace(/\n$/,"")),await a.data.detectSemanticTypes(n[t]),r[t]=e.DataFrame.fromCsv((await he.readAsText(i.outPath)).replace(/\n$/,""))})),(0,t.Pl)((async()=>{await(0,I.Eu)(s),await i.loadMonomerLib(!0)}));for(const[e,i]of Object.entries(pe))(0,t.t6)(`${e}`,(async()=>{await d(n[e],r[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 h={[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 p(t){const n=h[t],r=e.DataFrame.fromCsv(n.replace(/\n$/,""));return await a.data.detectSemanticTypes(r),r}(0,t.t6)("fastaDna",(async()=>{await fe(await p(o.fastaDna),"seq",i)})),(0,t.t6)("fastaRna",(async()=>{await fe(await p(o.fastaRna),"seq",i)})),(0,t.t6)("fastaPt",(async()=>{await fe(await p(o.fastaPt),"seq",i)})),(0,t.t6)("fastaUn",(async()=>{await fe(await p(o.fastaUn),"seq",i)})),(0,t.t6)("separatorDna",(async()=>{await fe(await p(o.separatorDna),"seq",i)})),(0,t.t6)("separatorDna",(async()=>{await fe(await p(o.separatorRna),"seq",i)})),(0,t.t6)("separatorPt",(async()=>{await fe(await p(o.separatorPt),"seq",i)})),(0,t.t6)("separatorUn",(async()=>{await fe(await p(o.separatorUn),"seq",i)})),(0,t.t6)("helm",(async()=>{await fe(await p(o.helm),"seq",i)})),(0,t.t6)("ptFasta2",(async()=>{const n=await _e.files.readAsText("tests/to-atomic-level-pt-fasta-2.mol"),r=e.DataFrame.fromCsv("seq\nAR"),s=r.getCol("seq");s.semType=e.SEMTYPE.MACROMOLECULE,s.meta.units=l.Hi.FASTA,s.setTag(l.gp.alphabet,l.YI.PT),u.GO.forColumn(s);const o=await fe(r,"seq",i);(0,t.E3)(ge(o.get(0)),ge(n))}))}));var ye=n(8754);(0,t.L1)("toAtomicLevel-ui",(()=>{let n,r,i;(0,t.gM)((async()=>{i=await(0,Q.b)(),n=await(0,L.pj)(),r=await(0,I.ub)(),await(0,I.yZ)(),await n.loadMonomerLib(!0)})),(0,t.Pl)((async()=>{await(0,I.Eu)(r),await n.loadMonomerLib(!0)}));const s="seq\nMDYKETLLMPKTDFPMRGGLPNKEPQIQEKW\nMIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL\nMMELVLKTIIGPIVVGVVLRIVDKWLNKDK\n";async function o(r,i,s){const o=await(0,ye.V)(r,i,s,n.getMonomerLib());(0,t.E3)(o.semType,e.SEMTYPE.MOLECULE)}(0,t.t6)("toAtomicLevel-fasta-linear",(async()=>{const t=e.DataFrame.fromCsv(s);await a.data.detectSemanticTypes(t);const n=t.getCol("seq");await o(t,n,!1)})),(0,t.t6)("toAtomicLevel-fasta-nonlinear",(async()=>{const t=e.DataFrame.fromCsv(s);await a.data.detectSemanticTypes(t);const n=t.getCol("seq");await o(t,n,!0)})),(0,t.t6)("toAtomicLevel-helm",(async()=>{const t=e.DataFrame.fromCsv("seq\nPEPTIDE1{meI.hHis.Aca.N.T.dK.Thr_PO3H2.Aca.D-Tyr_Et.Aze.dV.E.N.dV.Phe_4Me}$$$$\nPEPTIDE1{meI.hHis.Aca.N.T.dK.Thr_PO3H2.Aca.meM.D-Chg.dV.E.N.D-Orn.D-aThr.Phe_4Me}$$$$\nPEPTIDE1{meI.Aca.N.T.dK.Thr_PO3H2.Aca.D-Tyr_Et.Tyr_ab-dehydroMe.dV.D-Cit.N.D-Orn.D-aThr.Phe_4Me}$$$$\n");await a.data.detectSemanticTypes(t);const n=t.getCol("seq");await o(t,n,!0)}))}));var we=n(6863);async function be(t){const n=e.DataFrame.fromCsv(t),r=n.col("seq"),i=await a.functions.call("Bio:detectMacromolecule",{col:r});return i&&(r.semType=i),await a.data.detectSemanticTypes(n),u.GO.forColumn(r)}function ve(e,n,r,i){const s=r(e,n);(0,t.E3)(Number(s.toFixed(3)),Number(i.toFixed(3)))}(0,t.L1)("Distance",(async()=>{const n=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],r={F:0,W:1,R:2,Y:3},i="FWRWY",s="FWRWW",o="FWY",a="FWRWY",c="FWY",l="FWRRRRY";(0,t.t6)("protein-distance-function",(async()=>{const e=(await be("seq\nFWRWYVKHPFWRWYVKHP\nYNRWYVKHPYNRWYVKHP\nMWRSWYCKHPMWRSWYCKHP")).getDistanceFunctionName();(0,t.E3)(e,we.Z.LEVENSHTEIN)})),(0,t.t6)("DNA-distance-function",(async()=>{const e=(await be("seq\nATAACGATAACG\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,t.E3)(e,we.Z.LEVENSHTEIN)})),(0,t.t6)("MSA-distance-function",(async()=>{const e=(await be("seq\nATAACATAAC\nATCGAATCGA\nATCGAATCGA")).getDistanceFunctionName();(0,t.E3)(e,we.Z.HAMMING)})),(0,t.t6)("levenstein-sub",(async()=>{const e=we.V[we.Z.LEVENSHTEIN]();ve(i,s,e,.2)})),(0,t.t6)("levenstein-del",(async()=>{const e=we.V[we.Z.LEVENSHTEIN]();ve(o,a,e,.4)})),(0,t.t6)("hamming",(async()=>{const e=we.V[we.Z.HAMMING]();ve(o,a,e,.6)})),(0,t.t6)("needleman-blosum62",(async()=>{const e=we.V[we.Z.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});ve(i,s,e,-6)})),(0,t.t6)("needleman-blosum62-del",(async()=>{const e=we.V[we.Z.NEEDLEMANN_WUNSCH]({gapOpen:8,gapExtend:2});ve(o,a,e,-3.667)})),(0,t.t6)("needleman-custom-sub",(async()=>{const e=we.V[we.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:1,gapExtend:1});ve(i,s,e,.2)})),(0,t.t6)("needleman-custom-del",(async()=>{const e=we.V[we.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:1,gapExtend:1});ve(o,a,e,.667)})),(0,t.t6)("needleman-custom-zero-extend",(async()=>{const e=we.V[we.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:1,gapExtend:0});ve(c,l,e,.333)})),(0,t.t6)("needleman-custom-half-extend",(async()=>{const e=we.V[we.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:2,gapExtend:1});ve(c,l,e,1.667)})),(0,t.t6)("needleman-custom-same-extend",(async()=>{const t=we.V[we.Z.NEEDLEMANN_WUNSCH]({scoringMatrix:n,alphabetIndexes:r,gapOpen:1,gapExtend:1});e.Test.isInBenchmark?ve(Array(1e3).fill(c).join(""),Array(1e3).fill(l).join(""),t,1.333):ve(c,l,t,1.333)}),{benchmark:!0})}));var Ae=n(684);async function Ee(e,n,r,i,s,o,l,u){await a.data.detectSemanticTypes(e);const d=await(0,c.activityCliffs)(e,e.getCol(r),e.getCol(i),s,n,l,u,{[`${Ae.vb}`]:!0});(0,t.E3)(null!=d,!0);const h=Array.from(d.root.children).find((e=>{const t=e.className.split(" ");return["ui-btn","ui-btn-ok"].every((e=>t.includes(e)))}));(0,t.E3)(h.innerText.toLowerCase(),`${o} cliffs`)}var Ce=n(2780),Te=n(9039);async function Se(n,r,i){const s=n.getCol(i),o=await a.functions.call("Bio:detectMacromolecule",{col:s});o&&(s.semType=o);const l=e.Func.find({package:"Bio",name:"macromoleculePreprocessingFunction"})[0];if(!l)throw new Error("Preprocessing function not found");const u=await(0,c.sequenceSpaceTopMenu)(n,n.col(i),r,we.Z.LEVENSHTEIN,!0,l,{[Ae.vb]:!0});(0,t.E3)(null!=u,!0)}(0,t.L1)("activityCliffs",(async()=>{let n,r,i;const s=e.Func.find({name:"macromoleculePreprocessingFunction",package:"Bio"})[0],o=e.Func.find({name:"helmPreprocessingFunction",package:"Bio"})[0];(0,t.gM)((async()=>{n=await(0,Q.b)(),r=await(0,L.pj)(),i=await(0,I.ub)(),await(0,I.yZ)(),await r.loadMonomerLib(!0)})),(0,t.Pl)((async()=>{await(0,I.Eu)(i),await r.loadMonomerLib(!0)})),(0,t.t6)("activityCliffsOpens",(async()=>{const t=e.Test.isInBenchmark?{fileName:"tests/peptides_motif-with-random_10000.csv",tgt:{cliffCount:53}}:{fileName:"tests/100_3_clustests.csv",tgt:{cliffCount:3}},n=await _(t.fileName);a.shell.addTableView(n),await Ee(n,Te.c.UMAP,"sequence","Activity",90,t.tgt.cliffCount,we.Z.LEVENSHTEIN,s)}),{benchmark:!0}),(0,t.t6)("activityCliffsWithEmptyRows",(async()=>{const e=await _("tests/100_3_clustests_empty_vals.csv");a.shell.addTableView(e),await Ee(e,Te.c.UMAP,"sequence","Activity",90,3,we.Z.LEVENSHTEIN,s)})),(0,t.t6)("Helm",(async()=>{const e=await _e.files.readCsv("samples/HELM_50.csv");a.shell.addTableView(e),await Ee(e,Te.c.UMAP,"HELM","Activity",65,20,Ce.aT.Tanimoto,o)}))})),(0,t.L1)("sequenceSpace",(async()=>{let n,r,i,s;(0,t.t6)("sequenceSpaceOpens",(async()=>{const t=e.Test.isInBenchmark?{fileName:"tests/peptides_motif-with-random_10000.csv"}:{fileName:"tests/100_3_clustests.csv"};n=await _(t.fileName),r=a.shell.addTableView(n),await Se(n,Te.c.UMAP,"sequence")}),{benchmark:!0}),(0,t.t6)("sequenceSpaceWithEmptyRows",(async()=>{i=await _("tests/100_3_clustests_empty_vals.csv"),s=a.shell.addTableView(i),await Se(i,Te.c.UMAP,"sequence")}))})),(0,t.L1)("Scoring",(()=>{const n="sequence",r="expected_similarity",i="expected_identity",s=e.DataFrame.fromCsv(`${n},${r},${i}\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=s.getCol(n);o.meta.units=l.Hi.HELM,o.semType=e.SEMTYPE.MACROMOLECULE;const a=o.get(0);let u,d;(0,t.gM)((async()=>{u=await(0,c.getMonomerLibHelper)(),d=await(0,I.ub)(),await(0,I.yZ)(),await u.loadMonomerLib(!0)})),(0,t.Pl)((async()=>{await(0,I.Eu)(d),await u.loadMonomerLib(!0)})),(0,t.t6)("Identity",(async()=>{const e=await(0,c.sequenceIdentityScoring)(s,o,a);for(let n=0;n<e.length;n++){const r=e.get(n),o=s.get(i,n);(0,t.Wj)(r,o,.01,`Wrong identity score for sequence at position ${n}`)}})),(0,t.t6)("Identity-shortReference",(async()=>{const e=await(0,c.sequenceIdentityScoring)(s,o,"PEPTIDE1{Iva.Gly_allyl.gGlu.Pqa.D-Dip.dH.hHis.4Abz.D-aHyp.D-Dap.Y.Iva}$$$$");(0,t.E3)(C().count(0).take(e.length).map((t=>e.get(t))).every((e=>null!=e&&!isNaN(e))),!0)})),(0,t.t6)("Identity-longReference",(async()=>{const e=await(0,c.sequenceIdentityScoring)(s,o,"PEPTIDE1{Iva.Gly_allyl.gGlu.Pqa.D-Dip.dH.hHis.4Abz.D-aHyp.D-Dap.Y.Iva.I.Tyr_26diMe.P.Asu.meC.I.Tyr_26diMe.P.Asu.meC}$$$$");(0,t.E3)(C().count(0).take(e.length).map((t=>e.get(t))).every((e=>null!=e&&!isNaN(e))),!0)})),(0,t.t6)("Similarity",(async()=>{const e=await(0,c.sequenceSimilarityScoring)(s,o,a);for(let n=0;n<e.length;n++){const i=e.get(n),o=s.get(r,n);(0,t.Wj)(i,o,.01,`Wrong similarity score for sequence at position ${n}`)}}))}));const _e=new e.Package;async function Pe(n,r,i,s){const o=await(0,t.N$)({category:n,test:r,testContext:i,stressTest:s});return e.DataFrame.fromObjects(o)}})(),bio_test=r})();
|
|
8
8
|
//# sourceMappingURL=package-test.js.map
|